Project

General

Profile

Feature #22363 » 13982-taskcenter_v2.patch

Administrator Admin, 2010-04-13 18:50

View differences:

typo3/sysext/taskcenter/classes/class.tx_taskcenter_status.php (revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2010 Georg Ringer <typo3@ringerge.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Status of tasks
*
* @author Georg Ringer <typo3@ringerge.org
* @package TYPO3
* @subpackage taskcenter
*
*/
class tx_taskcenter_status {
/**
* Saves the section toggle state of tasks in the backend user's uc
*
* @param array array of parameters from the AJAX interface, currently unused
* @param TYPO3AJAX object of type TYPO3AJAX
* @return void
*/
public function saveCollapseState(array $params, TYPO3AJAX $ajaxObj) {
// remove 'el_' in the beginning which is needed for the saveSortingState
$item = substr(htmlspecialchars(t3lib_div::_POST('item')), 3);
$state = (bool)t3lib_div::_POST('state');
$GLOBALS['BE_USER']->uc['taskcenter']['states'][$item] = $state;
$GLOBALS['BE_USER']->writeUC();
}
/**
* Saves the sorting order of tasks in the backend user's uc
*
* @param array array of parameters from the AJAX interface, currently unused
* @param TYPO3AJAX object of type TYPO3AJAX
* @return void
*/
public function saveSortingState(array $params, TYPO3AJAX $ajaxObj) {
$sort = array();
$items = explode('&', t3lib_div::_POST('data'));
foreach($items as $item) {
$sort[] = substr($item, 12);
}
$GLOBALS['BE_USER']->uc['taskcenter']['sorting'] = serialize($sort);
$GLOBALS['BE_USER']->writeUC();
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/taskcenter/classes/class.tx_taskcenter_status.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/taskcenter/classes/class.tx_taskcenter_status.php']);
}
?>
typo3/sysext/taskcenter/ext_autoload.php (revision 0)
<?php
/*
* Register necessary class names with autoloader
*
*/
$extensionPath = t3lib_extMgm::extPath('taskcenter');
return array (
'tx_taskcenter_task' => $extensionPath . 'interfaces/interface.tx_taskcenter_task.php',
'tx_taskcenter_about' => $extensionPath . 'task/class.tx_taskcenter_about.php',
);
?>
typo3/sysext/taskcenter/ext_emconf.php (working copy)
########################################################################
# Extension Manager/Repository config file for ext "taskcenter".
#
# Auto generated 21-10-2009 11:25
# Auto generated 13-04-2010 13:34
#
# Manual updates:
# Only the data in the array - everything else is removed by next
......
'conflicts' => '',
'priority' => '',
'loadOrder' => '',
'module' => 'task',
'doNotLoadInFE' => 1,
'state' => 'stable',
'internal' => 0,
......
'author_company' => 'Curby Soft Multimedia',
'CGLcompliance' => '',
'CGLcompliance_note' => '',
'version' => '0.2.0',
'_md5_values_when_last_written' => 'a:9:{s:12:"ext_icon.gif";s:4:"fc53";s:14:"ext_tables.php";s:4:"837d";s:28:"task/class.mod_user_task.php";s:4:"5869";s:14:"task/clear.gif";s:4:"cc11";s:13:"task/conf.php";s:4:"1fae";s:14:"task/index.php";s:4:"87b2";s:18:"task/locallang.xml";s:4:"0f9b";s:22:"task/locallang_mod.xml";s:4:"c0f2";s:13:"task/task.gif";s:4:"fc53";}',
'version' => '1.0.0',
'_md5_values_when_last_written' => 'a:22:{s:16:"ext_autoload.php";s:4:"db4e";s:12:"ext_icon.gif";s:4:"fc53";s:14:"ext_tables.php";s:4:"697a";s:13:"locallang.xml";s:4:"5e6d";s:38:"classes/class.tx_taskcenter_status.php";s:4:"bdbe";s:43:"interfaces/interface.tx_taskcenter_task.php";s:4:"a913";s:13:"res/Thumbs.db";s:4:"2468";s:23:"res/item-background.jpg";s:4:"c87c";s:21:"res/list-item-act.gif";s:4:"6fa4";s:17:"res/list-item.gif";s:4:"e82d";s:18:"res/mod_styles.css";s:4:"a29c";s:19:"res/mod_styles2.css";s:4:"a66b";s:21:"res/mod_template.html";s:4:"eb07";s:28:"task/class.mod_user_task.php";s:4:"5869";s:34:"task/class.tx_taskcenter_about.php";s:4:"3ca7";s:14:"task/clear.gif";s:4:"cc11";s:13:"task/conf.php";s:4:"e419";s:13:"task/icon.gif";s:4:"7941";s:14:"task/index.php";s:4:"2baa";s:18:"task/locallang.xml";s:4:"c202";s:22:"task/locallang_mod.xml";s:4:"c0f2";s:13:"task/task.gif";s:4:"fc53";}',
'constraints' => array(
'depends' => array(
'php' => '5.1.0-0.0.0',
typo3/sysext/taskcenter/ext_tables.php (working copy)
<?php
if (!defined ('TYPO3_MODE')) die ('Access denied.');
if (!defined ('TYPO3_MODE')) {
die ('Access denied.');
}
if (TYPO3_MODE=='BE') t3lib_extMgm::addModule('user','task','top',t3lib_extMgm::extPath($_EXTKEY).'task/');
if (TYPO3_MODE == 'BE') {
t3lib_extMgm::addModulePath('tools_txtaskcenterM1', t3lib_extMgm::extPath($_EXTKEY) . 'task/');
t3lib_extMgm::addModule('user','task', 'top', t3lib_extMgm::extPath($_EXTKEY) . 'task/');
// $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter']['taskcenter']['about'] = array(
// 'title' => 'LLL:EXT:taskcenter/locallang.xml:task_help_title',
// 'description' => 'LLL:EXT:taskcenter/locallang.xml:task_help_description',
// 'icon' => 'EXT:taskcenter/task/icon.gif',
// 'task' => 'tx_taskcenter_about'
// );
$GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX']['Taskcenter::saveCollapseState'] = 'EXT:taskcenter/classes/class.tx_taskcenter_status.php:tx_taskcenter_status->saveCollapseState';
$GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX']['Taskcenter::saveSortingState'] = 'EXT:taskcenter/classes/class.tx_taskcenter_status.php:tx_taskcenter_status->saveSortingState';
}
?>
typo3/sysext/taskcenter/interfaces/interface.tx_taskcenter_task.php (revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2010 Georg Ringer <typo3@ringerge.orgY
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Interface for classes which provide a report.
*
* @author Georg Ringer <typo3@ringerge.org
* @package TYPO3
* @subpackage tx_taskcenter
*
*/
interface tx_taskcenter_Task {
/**
* returns the content for a task
*
* @return string A task rendered HTML
*/
public function getTask();
/**
* returns the overview of a task
*
* @return string A task rendered HTML
*/
public function getOverview();
}
?>
typo3/sysext/taskcenter/locallang.xml (revision 0)
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<description>Module labels</description>
<type>module</type>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="taskcenter">Taskcenter</label>
<label index="choose_task">Task:</label>
<label index="mlang_tabs_tab">Tasks</label>
<label index="task_overview">Overview</label>
<label index="lReplyAddress">Reply address is your email</label>
<label index="lSelf">Self</label>
<label index="lSendNew">Send message</label>
<label index="lSendReply">Reply to message</label>
<label index="listSeparator_Groups">__Groups:__</label>
<label index="lHomedir">Home dir</label>
<label index="lNone">[none]</label>
<label index="lCreate">Create</label>
<label index="lCancel">Cancel</label>
<label index="lDelete_warning">Are you sure you want to delete this user?</label>
<label index="lDelete">Delete</label>
<label index="lUpdate">Update</label>
<label index="task_help_title">About the taskcenter</label>
<label index="task_help_description">Get more information about the taskcenter</label>
</languageKey>
</data>
</T3locallang>
typo3/sysext/taskcenter/res/mod_styles.css (revision 0)
/* ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- */
/* general */
body#ext-taskcenter-task-index-php {
margin:0;
}
body#ext-taskcenter-task-index-php div#typo3-docbody {
top:60px;
}
body#ext-taskcenter-task-index-php div#typo3-inner-docbody {
padding:0 10px;
height:100%;
}
#typo3-inner-docbody p.help {
font-size: 12px;
margin-bottom: 10px;
}
body#ext-taskcenter-task-index-php img.icon {
vertical-align: bottom;
}
body#ext-taskcenter-task-index-php h3 {
margin:4px 0 8px;
padding:0;
}
/* ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- */
/* overview */
#taskcenter-main {
width:100%;
}
#taskcenter-main #taskcenter-menu {
width:250px;
}
#taskcenter-main #taskcenter-item {
position:absolute;
margin-left:270px;
margin-right:20px;
top:0;
min-width:300px;
}
/* ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- */
/* menu */
#taskcenter-menu ul {
list-style:none;
padding:0;
margin:0;
border-bottom:1px solid #b0b7c2;
}
#taskcenter-menu li {
margin-top:1px;
border-top:1px solid #EFEFF4;
}
#taskcenter-menu .image {
float:left;
height:23px;
width:23px;
}
#taskcenter-menu .image img {
margin:3px 0 0 1px;
}
#taskcenter-menu .down {
background:url(../../t3skin/icons/gfx/pil2down.gif) no-repeat 5px 7px;
height:23px;
float:left;
width:25px;
cursor:pointer;
}
#taskcenter-menu .collapsed .down {
background-image:url(../../t3skin/icons/gfx/pil2right.gif);
}
#taskcenter-menu .drag {
float:right;
height:23px;
width:24px;
}
#taskcenter-menu .drag img {
margin-top:6px;
cursor:move;
}
#taskcenter-menu .link {
background:url(item-background.jpg) repeat-x;
border:1px solid #b0b7c2;
border-width:1px 1px 0;
line-height:18px;
/*height:23px;*/
display:block;
}
#taskcenter-menu .link a {
padding:2px 5px;
display:block;
color:#fff;
}
#taskcenter-menu .active-task .link a {
font-weight:bold;
}
#taskcenter-menu .content {
padding:5px 0;
background:#fff;
border:1px solid #b7bec9;
}
#taskcenter-menu .content p {
padding:3px 5px 5px 5px;
margin:0;
}
#taskcenter-menu .content ul, #taskcenter-menu .content ul li {
border:0;
}
#taskcenter-menu .content ul li a {
display:block;
line-height:16px;
margin:0;
padding:2px 24px;
background:url(list-item.gif) no-repeat 10px 6px;
}
#taskcenter-menu .content ul li.active {
background-color:#e1e6ec;
}
#taskcenter-menu .content ul li.active a {
color:#272527;
font-weight:bold;
background-image:url(list-item-act.gif);
}
/* ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- */
/* content section */
#taskcenter-item ul {
padding:5px 0 5px 5px;
margin:0;
list-style:none;
}
#taskcenter-item ul li {
padding:5px 0 0 12px;
}
#taskcenter-item ul.withicons li {
background:url(list-item.gif) no-repeat 0 7px;
}
#taskcenter-item ul .image {
float:left;
width: 20px;
}
#taskcenter-item ul .link {
font-weight: bold;
padding: 2px 5px;
}
#taskcenter-item ul .link a {
padding:5px;
}
#taskcenter-item ul .link a:hover {
text-decoration:underline;
}
#taskcenter-item ul .content {
padding:2px 0 0 25px;
}
#taskcenter-item ul .content .edit {
display:block;
margin-top:2px;
}
/* ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- */
/* forms */
#taskcenter-item fieldset.fields legend {
font-weight:bold;
border-bottom:1px solid #ccc;
width:100%;
padding:0 0 2px 20px;
}
#taskcenter-item fieldset.fields {
border:0;
}
#taskcenter-item fieldset.fields .row {
width:350px;
clear:both;
padding:5px 0;
}
#taskcenter-item fieldset.fields label {
width:120px;
display:block;
float:left;
}
#taskcenter-item fieldset.fields input, #taskcenter-item fieldset.fields select {
/*margin-left:140px;*/
width:160px;
float:left;
border:1px solid #ccc;
padding:2px 3px;
}
#taskcenter-item fieldset.fields select {
width:170px;
}
#taskcenter-item fieldset.fields input[type=checkbox] {
width:16px;
text-align:left;
}
typo3/sysext/taskcenter/res/mod_template.html (revision 0)
<!-- ###FULLDOC### begin -->
<div class="typo3-fullDoc">
<!-- Page header with buttons, path details and csh -->
<div id="typo3-docheader">
<div id="typo3-docheader-row1">
<div class="buttonsleft">###BUTTONLIST_LEFT###</div>
<div class="buttonsright">###BUTTONLIST_RIGHT###</div>
</div>
<div id="typo3-docheader-row2" style="xdisplay:none;">
<div class="docheader-row2-left"><div class="docheader-funcmenu">###FUNC_MENU###</div></div>
<div class="docheader-row2-right"> </div>
</div>
</div>
<!-- Content of module, for instance listing, info or editing -->
<div id="typo3-docbody">
<div id="typo3-inner-docbody">
###CONTENT###
</div>
</div>
</div>
<!-- ###FULLDOC### end -->
<!-- Grouping the icons on top -->
<!-- ###BUTTON_GROUP_WRAP### -->
<div class="buttongroup">###BUTTONS###</div>
<!-- ###BUTTON_GROUP_WRAP### -->
<!-- ###BUTTON_GROUPS_LEFT### -->
<!-- ###BUTTON_GROUPS_LEFT### -->
<!-- ###BUTTON_GROUPS_RIGHT### -->
<!-- ###BUTTON_GROUP1### -->###OPEN_NEW_WINDOW### ###SHORTCUT###<!-- ###BUTTON_GROUP1### -->
<!-- ###BUTTON_GROUPS_RIGHT### -->
typo3/sysext/taskcenter/task/conf.php (working copy)
<?php
define('TYPO3_MOD_PATH', 'sysext/taskcenter/task/');
$BACK_PATH='../../../';
$MLANG['default']['tabs_images']['tab'] = 'task.gif';
$MLANG['default']['ll_ref']='LLL:EXT:taskcenter/task/locallang_mod.php';
$MCONF['script']='index.php';
$MCONF['access']='group,user';
$MCONF['name']='user_task';
$MLANG['default']['tabs_images']['tab'] = 'task.gif';
$MLANG['default']['ll_ref']='LLL:EXT:taskcenter/task/locallang_mod.xml';
$MCONF['script']='_DISPATCH';
$MCONF['access']='group,user';
$MCONF['name']='user_task';
?>
typo3/sysext/taskcenter/task/index.php (working copy)
/***************************************************************
* Copyright notice
*
* (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
* (c) 2010 Georg Ringer <typo3@ringerge.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* User Task Center
*
* @author Kasper Sk?rh?j <kasperYYYY@typo3.com>
* @author Christian Jul Jensen <christian(at)jul(dot)net>
* Revision for TYPO3 3.8.0 / Native Workflow System
*/
* This class provides a taskcenter for BE users
*
* @author Georg Ringer <typo3@ringerge.org>
* @package TYPO3
* @subpackage taskcenter
*
*/
unset($MCONF);
require ('conf.php');
require ($BACK_PATH.'init.php');
require ($BACK_PATH.'template.php');
$LANG->includeLLFile('EXT:taskcenter/task/locallang.php');
require_once('class.mod_user_task.php');
$LANG->includeLLFile('EXT:taskcenter/task/locallang.xml');
$BE_USER->modAccess($MCONF, 1);
......
// Script Classes
// ***************************
class SC_mod_user_task_index extends t3lib_SCbase {
var $allExtClassConf = array();
var $backPath;
protected $pageinfo;
/**
* BE user
* Initializes the Module
*
* @var t3lib_beUserAuth
* @return void
*/
var $BE_USER;
public function __construct() {
parent::init();
// initialize document
$this->doc = t3lib_div::makeInstance('template');
$this->doc->setModuleTemplate(
t3lib_extMgm::extPath('taskcenter') . 'res/mod_template.html'
);
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->getPageRenderer()->loadScriptaculous('effects,dragdrop');
$this->doc->addStyleSheet(
'tx_taskcenter',
'../' . t3lib_extMgm::siteRelPath('taskcenter') . 'res/mod_styles.css'
);
}
/**
* document template object
* Adds items to the ->MOD_MENU array. Used for the function menu selector.
*
* @var noDoc
* @return void
*/
var $doc;
public function menuConfig() {
$this->MOD_MENU = array('mode' => array());
$this->MOD_MENU['mode']['tasks'] = 'Tasks';
$this->MOD_MENU['mode']['information'] = $GLOBALS['LANG']->sL('LLL:EXT:scheduler/mod1/locallang.xml:function.info');
parent::menuConfig();
}
/**
* This makes sure that all classes of task-center related extensions are included
* Further it registers the classes in the variable $this->allExtClassConf
* Creates the module's content. In this case it rather acts as a kind of #
* dispatcher redirecting requests to specific tasks.
*
* @return void
*/
function includeAllClasses() {
foreach($this->MOD_MENU['function'] as $key => $name) {
$curExtClassConf = $this->getExternalItemConfig($this->MCONF['name'], 'function', $key);
if (is_array($curExtClassConf) && $curExtClassConf['path']) {
$this->allExtClassConf[] = $curExtClassConf;
$this->include_once[] = $curExtClassConf['path'];
public function main() {
$docHeaderButtons = $this->getButtons();
$markers = array();
// Access check! @todo: need access check?
if ($GLOBALS['BE_USER']->user['admin'] || 1==1) {
$this->doc->JScodeArray[] = '
script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
Event.observe(document, "dom:loaded", function(){
var changeEffect;
Sortable.create("task-list", { handles:$$("#task-list .drag"), tag: "li", ghosting:false, overlap:"vertical", constraint:false,
onChange: function(item) {
var list = Sortable.options(item).element;
// deactivate link
$$("#task-list a").each(function(link) {
link.writeAttribute("onclick","return false;");
});
},
onUpdate: function(list) {
new Ajax.Request("ajax.php", {
method: "post",
parameters: { ajaxID :"Taskcenter::saveSortingState", data: Sortable.serialize(list)}
});
// activate link
Event.observe(window,"mouseup",function(){
$$("#task-list a").each(function(link) {
link.writeAttribute("onclick","");
});
});
}
});
$$("#taskcenter-menu .down").invoke("observe", "click", function(event){
var item = Event.element(event);
var itemParent = item.up();
item = item.next("div").next("div").next("div").next("div");
if (itemParent.hasClassName("expanded")) {
itemParent.removeClassName("expanded").addClassName("collapsed");
Effect.BlindUp(item, {duration : 0.5});
state = 1;
} else {
itemParent.removeClassName("collapsed").addClassName("expanded");
Effect.BlindDown(item, {duration : 0.5});
state = 0;
}
new Ajax.Request("ajax.php", {
parameters : "ajaxID=Taskcenter::saveCollapseState&item=" + itemParent.id + "&state=" + state
});
});
});
';
$this->doc->postCode='
<script language="javascript" type="text/javascript">
script_ended = 1;
if (top.fsMod) {
top.fsMod.recentIds["web"] = 0;
}
</script>
';
// Render content depending on the mode
$mode = (string)$this->MOD_SETTINGS['mode'];
if ($mode == 'information') {
$this->renderInformationContent();
} else {
$this->renderModuleContent();
}
} else {
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('error-access', true),
$GLOBALS['LANG']->getLL('error_header'),
t3lib_FlashMessage::ERROR
);
$this->content.= $flashMessage->render();
}
// compile document
$markers['FUNC_MENU'] = t3lib_BEfunc::getFuncMenu(
0,
'SET[mode]',
$this->MOD_SETTINGS['mode'],
$this->MOD_MENU['mode']
);
$markers['CONTENT'] = $this->content;
// Build the <body> for the module
$this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
$this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
$this->content .= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
}
/**
* This is the main function called by the TYPO3 framework
* Prints out the module's HTML
*
* @return string The conntent of the module (HTML)
* @return void
*/
function main() {
global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
public function printContent() {
echo $this->content;
}
/* Setup document template */
$this->doc = t3lib_div::makeInstance('noDoc');
$this->doc->divClass = '';
$this->doc->form = '<form action="index.php" method="post" name="editform">';
$this->backPath = $this->doc->backPath = $BACK_PATH;
$this->doc->getPageRenderer()->loadPrototype();
$this->doc->JScode = ' <script language="javascript" type="text/javascript">
script_ended = 0;
function jumpToUrl(URL) {
window.location.href = URL;
/**
* Generates the module content by calling the selected task
*
* @return void
*/
protected function renderModuleContent() {
$title = $content = $actionContent = '';
$chosenTask = (string)$this->MOD_SETTINGS['function'];
// render the taskcenter task as default
if (empty($chosenTask) || $chosenTask == 'index') {
$chosenTask = 'taskcenter.tasks';
}
// remder the task
list($extKey, $taskName) = explode('.', $chosenTask, 2);
$taskClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter'][$extKey][$taskName]['task'];
$title = $GLOBALS['LANG']->sL($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter'][$extKey][$taskName]['title']);
if (class_exists($taskClass)) {
$taskInstance = t3lib_div::makeInstance($taskClass, $this);
if ($taskInstance instanceof tx_taskcenter_Task) {
// check if the task is restricted to admins only
if ($this->checkAccess($extKey, $taskName)) {
$actionContent .= $taskInstance->getTask();
} else {
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('error-access', TRUE),
$GLOBALS['LANG']->getLL('error_header'),
t3lib_FlashMessage::ERROR
);
$actionContent .= $flashMessage->render();
}
} else {
// error if the task is not an instance of tx_taskcenter_Task
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
sprintf($GLOBALS['LANG']->getLL('error_no-instance', TRUE), $taskClass, 'tx_taskcenter_Task'),
$GLOBALS['LANG']->getLL('error_header'),
t3lib_FlashMessage::ERROR
);
$actionContent .= $flashMessage->render();
}
'.(is_object($this->extObj)?$this->extObj->JScode():"").'
</script>
';
$this->doc->JScode .= $this->doc->getDynTabMenuJScode();
$this->doc->JScode .= '<script language="javascript" type="text/javascript">
function resizeIframe(frame,max) {
var parent = $("list_frame").up("body");
var parentHeight = $(parent).getHeight();
$("list_frame").setStyle({height: parentHeight+"px"});
}
$content = '<div id="taskcenter-main">
<div id="taskcenter-menu">' . $this->indexAction() . '</div>
<div id="taskcenter-item" class="' . $extKey . '-' . $taskName . '">' .
$actionContent . '
</div>
</div>';
$this->content .= $content;
}
/**
* Generates the information content
*
* @return void
*/
protected function renderInformationContent() {
$content = $this->description (
$GLOBALS['LANG']->getLL('mlang_tabs_tab'),
$GLOBALS['LANG']->sL('LLL:EXT:taskcenter/task/locallang_mod.xml:mlang_labels_tabdescr')
);
$content .= $GLOBALS['LANG']->getLL('taskcenter-about');
if ($GLOBALS['BE_USER']->isAdmin()) {
$content .= '<br /><br />' . $this->description (
$GLOBALS['LANG']->getLL('taskcenter-adminheader'),
$GLOBALS['LANG']->getLL('taskcenter-admin')
);
}
// event crashes IE6 so he is excluded first
//TODO: use a central handler instead of multiple single ones
var version = parseFloat(navigator.appVersion.split(\';\')[1].strip().split(\' \')[1]);
if (!(Prototype.Browser.IE && version == 6)) {
Event.observe(window, "resize", resizeIframe, false);
$this->content .= $content;
}
/**
* Render the headline of a task including a title and an optional description.
*
* @param string $title: Title
* @param string $description: Description
* @return string formatted title and description
*/
public function description($title, $description='') {
if (!empty($description)) {
$description = '<p class="description">' . nl2br(htmlspecialchars($description)) . '</p><br />';
}
</script>';
$content = $this->doc->section($title, $description, FALSE, TRUE);
/* call getMainContent first, because what happens here might affect leftContent */
$mainContent = $this->getMainContent();
return $content;
}
/* content... */
$this->content = '';
$this->content .= $this->doc->startPage($this->MOD_MENU['function'][$this->MOD_SETTINGS['function']]);
$this->content .= '<table style="width: 98%;"><tr>';
$this->content .= '<td valign="top" style="width: 20%;">'.$this->getleftHeader().$this->getDynTabMenu().'</td>';
$this->content .= '<td valign="top" style="height:100%">'.$mainContent.'</td>';
$this->content .= '</tr></table>';
/**
* Render a list of items as a nicely formated definition list including a
* link, icon, title and description.
* The keys of a single item are:
* - title: Title of the item
* - link: Link to the task
* - icon: Path to the icon or Icon as HTML if it begins with <img
* - description: Description of the task, using htmlspecialchars()
* - descriptionHtml: Description allowing HTML tags which will override the
* description
*
* @param array $items: List of items to be displayed in the definition list.
* @param boolean $mainMenu: Set it to true to render the main menu
* @return string definition list
*/
public function renderListMenu($items, $mainMenu=FALSE) {
$content = '';
$count = 0;
// change the sorting of items to the user's one
if ($mainMenu) {
$userSorting = unserialize($GLOBALS['BE_USER']->uc['taskcenter']['sorting']);
if (is_array($userSorting)) {
$newSorting = array();
foreach($userSorting as $item) {
if(isset($items[$item])) {
$newSorting[] = $items[$item];
unset($items[$item]);
}
}
$items = $newSorting + $items;
}
}
if (is_array($items) && count($items) > 0) {
foreach($items as $item) {
$title = htmlspecialchars($item['title']);
$icon = $additionalClass = $collapsedStyle = '';
// Check for custom icon
if (!empty($item['icon'])) {
if (strpos($item['icon'], '<img ') === FALSE) {
$absIconPath = t3lib_div::getFileAbsFilename($item['icon']);
// If the file indeed exists, assemble relative path to it
if (file_exists($absIconPath)) {
$icon = $GLOBALS['BACK_PATH'] . '../' . str_replace(PATH_site, '', $absIconPath);
$icon = '<img src="' . $icon . '" title="' . $title . '" alt="' . $title . '" />';
}
if (@is_file($icon)) {
$icon = '<img' . t3lib_iconworks::skinImg($GLOBALS['BACK_PATH'], $icon, 'width="16" height="16"') . ' title="' . $title . '" alt="' . $title . '" />';
}
} else {
$icon = $item['icon'];
}
}
$description = (!empty($item['descriptionHtml'])) ? $item['descriptionHtml'] : '<p>' . nl2br(htmlspecialchars($item['description'])) . '</p>';
$id = $this->getUniqueKey($item['uid']);
// collapsed & expanded menu items
if ($mainMenu && isset($GLOBALS['BE_USER']->uc['taskcenter']['states'][$id]) && $GLOBALS['BE_USER']->uc['taskcenter']['states'][$id]) {
$collapsedStyle = 'style="display:none"';
$additionalClass = 'collapsed';
} else {
$additionalClass = 'expanded';
}
// first & last menu item
if ($count == 0) {
$additionalClass .= ' first-item';
} elseif ($count + 1 === count($items)) {
$additionalClass .= ' last-item';
}
// active menu item
$active = ((string) $this->MOD_SETTINGS['function'] == $item['uid']) ? ' active-task' : '';
if ($mainMenu) {
$section = '<div class="down">&nbsp;</div>
<div class="image">' . $icon . '</div>
<div class="drag">
<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/move.gif', 'width="16" height="16" hspace="2"') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.move', 1) . '" alt="" />
</div>';
}
$content .= '<li class="' . $additionalClass . $active . '" id="el_' .$id . '">
' . $section . '
<div class="link"><a href="' . $item['link'] . '">' . $title . '</a></div>
<div class="content " ' . $collapsedStyle . '>' . $description . '</div>
</li>';
$count++;
}
$navId = ($mainMenu) ? 'id="task-list"' : '';
$content = '<ul ' . $navId . ' class="task-list">' . $content . '</ul>';
}
return $content;
}
/** Generate the dynamic tab menu in the left side by iterating
* over all submodules and creating configurations.
/**
* Shows an overview list of available reports.
*
* @return string the code for the dynamic tab menu (HTML)
* @return string list of available reports
*/
function getDynTabMenu() {
//walk through registered submodules and generate configuration
//for tabmenu
$parts = Array();
foreach($this->allExtClassConf as $conf) {
$extObj = t3lib_div::makeInstance($conf['name']);
/* call init to make sure the LOCAL_LANG is included for all listed
* extensions. If they OVERRIDE each other there is trouble! */
$extObj->init($this, $conf);
$extObj->backPath = $this->backPath;
$extObj->mod_user_task_init($GLOBALS['BE_USER']);
$part = $extObj->overview_main();
if (is_array($part)) {
$parts[] = $part;
protected function indexAction() {
$icon = t3lib_extMgm::extRelPath('taskcenter') . 'task/task.gif';
$tasks = array();
// render the tasks only if there are any available
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter']) && count($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter']) > 0) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter'] as $extKey => $extensionReports) {
foreach ($extensionReports as $taskName => $task) {
if (!$this->checkAccess($extKey, $taskName)) {
continue;
}
$link = 'mod.php?M=user_task&SET[function]=' . $extKey . '.' . $taskName;
$taskTitle = $GLOBALS['LANG']->sL($task['title']);
$taskDescriptionHtml = '';
// Check for custom icon
if (!empty($task['icon'])) {
$icon = t3lib_div::getFileAbsFilename($task['icon']);
}
$taskInstance = t3lib_div::makeInstance($task['task'], $this);
if ($taskInstance instanceof tx_taskcenter_Task) {
$taskDescriptionHtml = $taskInstance->getOverview();
}
$uniqueKey = $this->getUniqueKey($extKey . '.' . $taskName);
$tasks[$uniqueKey] = array(
'title' => $taskTitle,
'descriptionHtml' => $taskDescriptionHtml,
'description' => $GLOBALS['LANG']->sL($task['description']),
'icon' => $icon,
'link' => $link,
'uid' => $extKey . '.' . $taskName
);
}
}
$content .= $this->renderListMenu($tasks, TRUE);
} else {
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('no-tasks', TRUE),
'',
t3lib_FlashMessage::INFO
);
$this->content.= $flashMessage->render();
}
return $this->doc->getDynTabMenu($parts, 'tx_taskcenter', 1, true);
return $content;
}
/**
* Generate the header of the left column
* Create the panel of buttons for submitting the form or otherwise
* perform operations.
*
* @return string header in the left side (HTML)
* @return array all available buttons as an assoc. array
*/
function getleftHeader() {
$name = $GLOBALS['BE_USER']->user['realName'] ? $GLOBALS['BE_USER']->user['realName'] : $GLOBALS['BE_USER']->user['username'];
return '<h1>TYPO3 taskcenter <br />' . htmlspecialchars($name) . '</h1>';
protected function getButtons() {
$buttons = array(
'csh' => t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']),
'shortcut' => '',
'open_new_window' => $this->openInNewWindow()
);
// Shortcut
if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
$buttons['shortcut'] = $this->doc->makeShortcutIcon('', 'function', $this->MCONF['name']);
}
return $buttons;
}
/**
* Get the main content for the module by initiating the external object (if any) and calling it's main function.
* Check the access to a task. Considered are:
* - Admins are always allowed
* - Tasks can be restriced to admins only
* - Tasks can be blinded for Users with TsConfig taskcenter.<extensionkey>.<taskName> = 0
*
* @return string main content (HTML)
* @param string $extKey: Extension key
* @param string $taskName: Name of the task
* @return boolean Access to the task allowed or not
*/
function getMainContent() {
if (is_object($this->extObj)) {
$this->extObj->backPath = $this->backPath;
$this->extObj->mod_user_task_init($GLOBALS['BE_USER']);
return $this->extObj->main();
protected function checkAccess($extKey, $taskName) {
// check if task is blinded with TsConfig (taskcenter.<extkey>.<taskName>
$tsConfig = $GLOBALS['BE_USER']->getTSConfig('taskcenter.' . $extKey . '.' . $taskName);
if (isset($tsConfig['value']) && intval($tsConfig['value']) == 0) {
return FALSE;
}
// admins are always allowed
if ($GLOBALS['BE_USER']->isAdmin()) {
return TRUE;
}
// check if task is restricted to admins
if (intval($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter'][$extKey][$taskName]['admin']) == 1) {
return FALSE;
}
}
/**
* Output the content of the object to the browser
* Returns HTML code to dislay an url in an iframe at the right side of the taskcenter
*
* @return void
* @param string $url: url to display
* @param int $max:
* @return string code that inserts the iframe (HTML)
*/
function printContent() {
$this->content .= $this->doc->endPage();
echo $this->content;
public function urlInIframe($url, $max=0) {
$this->doc->JScodeArray[] =
'function resizeIframe(frame,max) {
var parent = $("typo3-docbody");
var parentHeight = $(parent).getHeight() - 0;
var parentWidth = $(parent).getWidth() - $("taskcenter-menu").getWidth() - 50;
$("list_frame").setStyle({height: parentHeight+"px", width: parentWidth+"px"});
}
// event crashes IE6 so he is excluded first
var version = parseFloat(navigator.appVersion.split(";")[1].strip().split(" ")[1]);
if (!(Prototype.Browser.IE && version == 6)) {
Event.observe(window, "resize", resizeIframe, false);
}';
return '<iframe onload="resizeIframe(this,' . $max . ');" scrolling="auto" width="100%" src="' . $url . '" name="list_frame" id="list_frame" frameborder="no" style="margin-top:-51px;border: none;"></iframe>';
}
/**
* Create a unique key from a string which can be used in Prototype's Sortable
* Therefore '_' are replaced
*
* @param string $string: string which is used to generate the identifier
* @return string modified string
*/
protected function getUniqueKey($string) {
$search = array('.', '_');
$replace = array('-', '');
return str_replace($search, $replace, $string);
}
/**
* This method prepares the link for opening the devlog in a new window
*
* @return string Hyperlink with icon and appropriate JavaScript
*/
protected function openInNewWindow() {
$url = t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT');
$onClick = "devlogWin=window.open('" . $url . "','taskcenter','width=790,status=0,menubar=1,resizable=1,location=0,scrollbars=1,toolbar=0');return false;";
$content = '<a href="#" onclick="' . htmlspecialchars($onClick).'">' .
'<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/open_in_new_window.gif', 'width="19" height="14"') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.openInNewWindow', 1) . '" class="absmiddle" alt="" />' .
'</a>';
return $content;
}
}
......
// Make instance:
$SOBE = t3lib_div::makeInstance('SC_mod_user_task_index');
$SOBE->init();
$SOBE->includeAllClasses();
// Include files?
foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
$SOBE->checkExtObj(); // Checking for first level external objects
foreach($SOBE->include_once as $INC_FILE) {
include_once($INC_FILE);
}
$SOBE->main();
$SOBE->printContent();
typo3/sysext/taskcenter/task/locallang.xml (working copy)
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="title">Task overview</label>
<label index="mlang_tabs_tab">Tasks</label>
<label index="task_overview">Overview</label>
<label index="error_header">Error</label>
<label index="error-access">No access to this module.</label>
<label index="error_no-instance">The class "%s" does not implement the task interface "%s" which is necessary to be displayed here.</label>
<label index="no-tasks">No tasks have been registered yet.</label>
<label index="lReplyAddress">Reply address is your email</label>
<label index="lSelf">Self</label>
<label index="lSendNew">Send message</label>
......
<label index="lDelete_warning">Are you sure you want to delete this user?</label>
<label index="lDelete">Delete</label>
<label index="lUpdate">Update</label>
<label index="task_description">Description, blablabla lipusm</label>
<label index="taskcenter-about">
<![CDATA[
<p>The menu on the left side shows all allowed tasks and let you allow to complete your tasks in an effecient way.</p>
<ul class="withicons">
<li>Clicking on the title of a task will open a detailed view of the task itself.</li>
<li>Click on the arrow on the right side will open/close the submenu of the task.</li>
</ul>
<br />
<strong>Note:</strong> Set the taskcenter as the default module after your login to be even faster!
]]>
</label>
<label index="taskcenter-adminheader">Create a task</label>
<label index="taskcenter-admin">It is very to extend the taskcenter by a custom task. For more information please look into the manual of the extension 'taskcenter'.</label>
</languageKey>
</data>
</T3locallang>
(4-4/6)