Project

General

Profile

Feature #22363 » 13983-sys_action_v2.patch

Administrator Admin, 2010-04-13 18:50

View differences:

typo3/sysext/sys_action/ext_autoload.php (revision 0)
<?php
/*
* Register necessary class names with autoloader
*
*/
$extensionPath = t3lib_extMgm::extPath('sys_action');
return array(
'tx_sysaction_task' => $extensionPath . 'task/class.tx_sysaction_task.php',
);
?>
typo3/sysext/sys_action/ext_emconf.php (working copy)
########################################################################
# Extension Manager/Repository config file for ext "sys_action".
#
# Auto generated 25-11-2009 22:10
# Auto generated 13-04-2010 13:46
#
# Manual updates:
# Only the data in the array - everything else is removed by next
......
'CGLcompliance' => '',
'CGLcompliance_note' => '',
'version' => '1.2.0',
'_md5_values_when_last_written' => 'a:15:{s:8:"TODO.txt";s:4:"17ff";s:22:"class.tx_sysaction.php";s:4:"6103";s:12:"ext_icon.gif";s:4:"f410";s:14:"ext_tables.php";s:4:"6561";s:14:"ext_tables.sql";s:4:"c36f";s:13:"locallang.xml";s:4:"6f52";s:27:"locallang_csh_sysaction.xml";s:4:"a1d4";s:17:"locallang_tca.xml";s:4:"dd78";s:14:"sys_action.gif";s:4:"eb3a";s:17:"sys_action__h.gif";s:4:"7a29";s:7:"tca.php";s:4:"f3d0";s:46:"toolbarmenu/class.tx_sysaction_toolbarmenu.php";s:4:"978d";s:35:"toolbarmenu/registerToolbarItem.php";s:4:"58a6";s:29:"toolbarmenu/tx_sysactions.css";s:4:"bd1b";s:28:"toolbarmenu/tx_sysactions.js";s:4:"deb0";}',
'_md5_values_when_last_written' => 'a:17:{s:8:"TODO.txt";s:4:"17ff";s:22:"class.tx_sysaction.php";s:4:"627a";s:16:"ext_autoload.php";s:4:"9b72";s:12:"ext_icon.gif";s:4:"f410";s:14:"ext_tables.php";s:4:"abdf";s:14:"ext_tables.sql";s:4:"c36f";s:13:"locallang.xml";s:4:"3327";s:27:"locallang_csh_sysaction.xml";s:4:"a1d4";s:17:"locallang_tca.xml";s:4:"abe1";s:14:"sys_action.gif";s:4:"eb3a";s:17:"sys_action__h.gif";s:4:"7a29";s:7:"tca.php";s:4:"3356";s:32:"task/class.tx_sysaction_task.php";s:4:"207e";s:46:"toolbarmenu/class.tx_sysaction_toolbarmenu.php";s:4:"11d3";s:35:"toolbarmenu/registerToolbarItem.php";s:4:"58a6";s:29:"toolbarmenu/tx_sysactions.css";s:4:"bd1b";s:28:"toolbarmenu/tx_sysactions.js";s:4:"deb0";}',
'constraints' => array(
'depends' => array(
'taskcenter' => '',
'taskcenter' => '1.0.0-0.0.0',
'php' => '5.1.0-0.0.0',
'typo3' => '4.3.0-0.0.0',
),
typo3/sysext/sys_action/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::insertModuleFunction(
'user_task',
'tx_sysaction',
t3lib_extMgm::extPath($_EXTKEY).'class.tx_sysaction.php',
'LLL:EXT:sys_action/locallang_tca.php:tx_sys_action'
);
$TCA['sys_action'] = Array (
'ctrl' => Array (
if (TYPO3_MODE == 'BE') {
$TCA['sys_action'] = array (
'ctrl' => array (
'label' => 'title',
'tstamp' => 'tstamp',
'default_sortby' => 'ORDER BY title',
......
'adminOnly' => 1,
'rootLevel' => -1,
'setToDefaultOnCopy' => 'assign_to_groups',
'enablecolumns' => Array (
'enablecolumns' => array (
'disabled' => 'hidden'
),
'type' => 'type',
......
);
$GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'][] = t3lib_extMgm::extPath('sys_action') . 'toolbarmenu/registerToolbarItem.php';
}
t3lib_extMgm::addLLrefForTCAdescr('sys_action','EXT:sys_action/locallang_csh_sysaction.xml');
t3lib_extMgm::addLLrefForTCAdescr('sys_action','EXT:sys_action/locallang_csh_sysaction.xml');
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter']['sys_action']['tasks'] = array(
'title' => 'LLL:EXT:sys_action/locallang_tca.xml:sys_action',
'description' => 'LLL:EXT:sys_action/locallang_csh_sysaction.xml:.description',
'icon' => 'EXT:sys_action/sys_action.gif',
'task' => 'tx_sysaction_task'
);
}
?>
typo3/sysext/sys_action/locallang.xml (working copy)
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="sys_action">Action</label>
<label index="description">An 'Action' is a configuration of a specific task which may be performed by assigned usergroups via the Task Center.</label>
<label index="new-sys_action">Create a new action</label>
<label index="edit-sys_action">Edit record</label>
<label index="action_error-not-found">The action doesn't exist</label>
<label index="action_not-found">No actions found</label>
<label index="action_not-found-description">Currently there are no actions yet defined!</label>
<label index="action_error-access">You don't have sufficient rights to see the records. Please ask the administrator to set those for you.</label>
<label index="error-wrong-email">The E-mail address is wrong.</label>
<label index="error-username-empty">The username is empty.</label>
<label index="error-password-empty">The password is empty.</label>
<label index="error-wrong-user">You are not allowed to edit this user.</label>
<label index="success">Success</label>
<label index="success-user-created">The user has been created.</label>
<label index="success-user-updated">The user has been updated.</label>
<label index="action_noType">Error: The action had no type defined.</label>
<label index="action_notReady">Error: The action configuration is not finished.</label>
<label index="action_download_file">Click here to download the exported data in a file</label>
typo3/sysext/sys_action/locallang.xml.bak (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="sys_action">Action</label>
<label index="description">An 'Action' is a configuration of a specific task which may be performed by assigned usergroups via the Task Center.</label>
<label index="new-sys_action">Create a new action</label>
<label index="edit-sys_action">Edit record</label>
<label index="action_error-not-found">The action doesn't exist</label>
<label index="action_not-found">No actions found</label>
<label index="action_not-found-description">Currently there are no actions yet defined!</label>
<label index="action_error-access">You don't have sufficient rights to see the records. Please ask the administrator to set those for you.</label>
<label index="error-wrong-email">The E-mail address is wrong.</label>
<label index="error-username-empty">The username is empty.</label>
<label index="error-password-empty">The password is empty.</label>
<label index="error-wrong-user">You are not allowed to edit this user.</label>
<label index="success">Success</label>
<label index="success-user-created">The user has been created.</label>
<label index="success-user-updated">The user has been updated.</label>
<label index="action_noType">Error: The action had no type defined.</label>
<label index="action_notReady">Error: The action configuration is not finished.</label>
<label index="action_download_file">Click here to download the exported data in a file</label>
<label index="action_editQuery">Edit Query</label>
<label index="action_error">Action error!</label>
<label index="action_lowlevelMissing">The extension "lowlevel" must be installed in order to create a query.</label>
<label index="action_t2_result">Result of query</label>
<label index="action_Create">Create Backend User</label>
<label index="action_Update">Update Backend User</label>
<label index="action_t1_listOfUsers">List of backend users</label>
<label index="action_BEu_db_mount">Pagetree starting points</label>
<label index="action_t4_edit">Select record to edit:</label>
<label index="action_toolbaritem">Open System Actions</label>
</languageKey>
</data>
</T3locallang>
typo3/sysext/sys_action/locallang_tca.xml (working copy)
<label index="sys_action.t3_listPid">List pid:</label>
<label index="sys_action.t3_tables">List only table:</label>
<label index="sys_action.t4_recordsToEdit">Records to edit:</label>
<label index="sys_action.type.1">Create Backend User</label>
<label index="sys_action.type.2">SQL query</label>
<label index="sys_action.type.3">Record list</label>
<label index="sys_action.type.4">Edit records</label>
<label index="sys_action.type.5">New Record</label>
</languageKey>
</data>
</T3locallang>
typo3/sysext/sys_action/task/class.tx_sysaction_task.php (revision 0)
<?php
/***************************************************************
* 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
* 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!
***************************************************************/
/**
* This class provides a task for the taskcenter
*
* @author Kasper Skaarhoj <kasperYYYY@typo3.com>
* @author Georg Ringer <typo3@ringerge.org>
* @package TYPO3
* @subpackage tx_sysaction
*
*/
class tx_sysaction_task implements tx_taskcenter_Task {
protected $taskObject;
var $t3lib_TCEforms;
/**
* Constructor
*/
public function __construct(SC_mod_user_task_index $taskObject) {
$this->taskObject = $taskObject;
$GLOBALS['LANG']->includeLLFile('EXT:sys_action/locallang.xml');
}
/**
* This method renders the task
*
* @return string The task as HTML
*/
public function getTask() {
$content = '';
$show = intval(t3lib_div::_GP('show'));
// if no task selected, render the menu
if ($show == 0) {
$content .= $this->taskObject->description(
$GLOBALS['LANG']->getLL('sys_action'),
$GLOBALS['LANG']->getLL('description')
);
$content .= $this->renderActionList();
} else {
$record = t3lib_BEfunc::getRecord('sys_action', $show);
// if the action is not found
if (count($record) == 0) {
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('action_error-not-found', true),
$GLOBALS['LANG']->getLL('action_error'),
t3lib_FlashMessage::ERROR
);
$content .= $flashMessage->render();
} else {
// render the task
$content .= $this->taskObject->description($record['title'], $record['description']);
// output depends on the type
switch ($record['type']) {
case 1:
$content .= $this->viewNewBackendUser($record);
break;
case 2:
$content .= $this->viewSqlQuery($record);
break;
case 3:
$content .= $this->viewRecordList($record);
break;
case 4:
$content .= $this->viewEditRecord($record);
break;
case 5:
$content .= $this->viewNewRecord($record);
break;
default:
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('action_noType', true),
$GLOBALS['LANG']->getLL('action_error'),
t3lib_FlashMessage::ERROR
);
$content .= '<br />' . $flashMessage->render();
}
}
}
return $content;
}
/**
* Gemeral overview over the task in the taskcenter menu
*
* @return string Overview as HTML
*/
public function getOverview() {
$content = '<p>' . $GLOBALS['LANG']->getLL('description') . '</p>';
// get the actions
$lines = $this->getActions();
if (count($lines) > 0) {
$items = '';
// render a single action menu item
foreach ($lines as $line) {
$active = (t3lib_div::_GP('show') === $line['uid']) ? ' class="active" ' : '';
$items .= '<li' . $active . '>
<a href="' . $line['link'] . '" title="' . htmlspecialchars($line['description']) . '">' .
htmlspecialchars($line['title']) .
'</a>
</li>';
}
$content .= '<ul>' . $items . '</ul>';
}
return $content;
}
/**
* Get all actions of an user. Admins can see any action, all others only those
* whic are allowed in sys_action record itself.
*
* @param boolean $toOverview: If true, the link redirects to the taskcenter
* @return array Array holding every needed information of a sys_action
*/
protected function getActions() {
$lines = array();
// admins can see any record
if ($GLOBALS['BE_USER']->isAdmin()) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*',
'sys_action',
'',
'',
'sys_action.sorting'
);
} else {
// editors can only see the actions which are assigned to a usergroup they belong to
$additionalWhere = 'be_groups.uid IN (' . ($GLOBALS['BE_USER']->groupList ? $GLOBALS['BE_USER']->groupList : 0) . ')';
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
'sys_action.*',
'sys_action',
'sys_action_asgr_mm',
'be_groups',
' AND sys_action.hidden=0 AND ' . $additionalWhere,
'sys_action.uid',
'sys_action.sorting'
);
}
while($actionRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$editActionLink = '';
// admins are allowed to edit sys_action records
if ($GLOBALS['BE_USER']->isAdmin()) {
$returnUrl = rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
$link = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR') . $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . $returnUrl . '&edit[sys_action][' . $actionRow['uid'] . ']=edit';
$editActionLink = '<a class="edit" href="' . $link . '">' .
'<img class="icon"' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/edit2.gif') . ' title="' . $GLOBALS['LANG']->getLL('edit-sys_action') . '" alt="" />' .
$GLOBALS['LANG']->getLL('edit-sys_action') .
'</a>';
}
$lines[] = array(
'uid' => $actionRow['uid'],
'title' => $actionRow['title'],
'description' => $actionRow['description'],
'descriptionHtml' => nl2br(htmlspecialchars($actionRow['description'])) . $editActionLink,
'link' => 'mod.php?M=user_task&SET[function]=sys_action.tasks&show=' . $actionRow['uid'],
'icon' => 'EXT:sys_action/sys_action.gif'
);
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
return $lines;
}
/**
* Render the menu of sys_actions
*
* @return string list of sys_actions as HTML
*/
protected function renderActionList() {
$content = '';
// get the sys_action records
$lines = $this->getActions();
// if any actions are found for the current users
if (count($lines) > 0) {
$content .= $this->taskObject->renderListMenu($lines);
} else {
$flashMessage = t3lib_div::makeInstance (
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('action_not-found-description', true),
$GLOBALS['LANG']->getLL('action_not-found'),
t3lib_FlashMessage::INFO
);
$content .= $flashMessage->render();
}
// Admin users can create a new action
if ($GLOBALS['BE_USER']->isAdmin()) {
$returnUrl = rawurlencode('mod.php?M=user_task');
$link = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR') . $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . $returnUrl. '&edit[sys_action][0]=new';
$content .= '<br />
<a href="' . $link . '" title="' . $GLOBALS['LANG']->getLL('new-sys_action') . '">' .
'<img class="icon"' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/new_record.gif') . ' title="' . $GLOBALS['LANG']->getLL('new-sys_action') . '" alt="" /> ' .
$GLOBALS['LANG']->getLL('new-sys_action') .
'</a>';
}
return $content;
}
/**
* Action to create a new BE user
*
* @param array $record: sys_action record
* @return string form to create a new user
*/
protected function viewNewBackendUser($record) {
$content = '';
$beRec = t3lib_BEfunc::getRecord('be_users', intval($record['t1_copy_of_user']));
// a record is neeed which is used as copy for the new user
if (!is_array($beRec)) {
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('action_notReady', true),
$GLOBALS['LANG']->getLL('action_error'),
t3lib_FlashMessage::ERROR
);
$content .= $flashMessage->render();
return $content;
}
$userRecord = array();
$newFlag = 0;
$vars = t3lib_div::_POST('data');
$key = 'NEW';
if ($vars['sent'] == 1) {
$errors = array();
// basic error checks
if (!empty($vars['email']) && !t3lib_div::validEmail($vars['email'])) {
$errors[] = $GLOBALS['LANG']->getLL('error-wrong-email');
}
if (empty($vars['username'])) {
$errors[] = $GLOBALS['LANG']->getLL('error-username-empty');
}
if (empty($vars['password'])) {
$errors[] = $GLOBALS['LANG']->getLL('error-password-empty');
}
if ($vars['key'] !== 'NEW' && !$this->isCreatedByUser($vars['key'], $record)) {
$errors[] = $GLOBALS['LANG']->getLL('error-wrong-user');
}
// show errors if there are any
if (count($errors) > 0) {
$flashMessage = t3lib_div::makeInstance (
't3lib_FlashMessage',
implode('<br />', $errors),
$GLOBALS['LANG']->getLL('action_error'),
t3lib_FlashMessage::ERROR
);
$content .= $flashMessage->render() . '<br />';
} else {
// save user
$key = $this->saveNewBackendUser($record, $vars);
// success messsage
$flashMessage = t3lib_div::makeInstance (
't3lib_FlashMessage',
($vars['key'] === 'NEW' ? $GLOBALS['LANG']->getLL('success-user-created') : $GLOBALS['LANG']->getLL('success-user-updated')),
$GLOBALS['LANG']->getLL('success'),
t3lib_FlashMessage::OK
);
$content .= $flashMessage->render() . '<br />' ;
}
}
// load BE user to edit
if (intval(t3lib_div::_GP('be_users_uid')) > 0) {
$tmpUserId = intval(t3lib_div::_GP('be_users_uid'));
$rawRecord = $this->isCreatedByUser($tmpUserId, $record);
if ($rawRecord) {
// delete user
if (t3lib_div::_GP('delete') == 1) {
$this->deleteUser($tmpUserId, $record['uid']);
}
$key = $tmpUserId;
$vars = $rawRecord;
}
}
$this->JScode();
$loadDB = t3lib_div::makeInstance('t3lib_loadDBGroup');
$loadDB->start($vars['db_mountpoints'], 'pages');
$content .= '<form action="" method="post" enctype="multipart/form-data">
<fieldset class="fields">
<legend>General fields</legend>
<div class="row">
<label for="disable">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.disable') . '</label>
<input type="checkbox" id="disable" name="data[disable]" value="1" class="checkbox" ' . ($vars['disable'] == 1 ? ' checked="checked" ' : '') . ' />
</div>
<div class="row">
<label for="realname">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.name') . '</label>
<input type="text" id="realname" name="data[realName]" value="' . htmlspecialchars($vars['realName']) .'" />
</div>
<div class="row">
<label for="username">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xml:be_users.username') . '</label>
<input type="text" id="username" name="data[username]" value="' . htmlspecialchars($vars['username']) .'" />
</div>
<div class="row">
<label for="password">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xml:be_users.password') . '</label>
<input type="password" id="password" name="data[password]" value="" />
</div>
<div class="row">
<label for="email">' .$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.email') . '</label>
<input type="text" id="email" name="data[email]" value="' . htmlspecialchars($vars['email']) .'" />
</div>
</fieldset>
<fieldset class="fields">
<legend>Configuration</legend>
<div class="row">
<label for="usergroup">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xml:be_users.usergroup') . '</label>
<select id="usergroup" name="data[usergroup][]" multiple="multiple">
' . $this->getUsergroups($record, $vars) . '
</select>
</div>
<div class="row">
<label for="db_mountpoints">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xml:be_users.options_db_mounts') . '</label>
' . $this->t3lib_TCEforms->dbFileIcons('data[db_mountpoints]', 'db', 'pages', $loadDB->itemArray, '', array('size' => 3)) . '
</div>
<div class="row">
<input type="hidden" name="data[key]" value="' . $key . '" />
<input type="hidden" name="data[sent]" value="1" />
<input type="submit" value="' . ($key === 'NEW' ? $GLOBALS['LANG']->getLL('action_Create') : $GLOBALS['LANG']->getLL('action_Update')) . '" />
</div>
</fieldset>
</form>';
$content .= $this->getCreatedUsers($record, $key);
return $content;
}
/**
* Delete a BE user and redirect to the action by its id
*
* @param int $userId: Id of the BE user
* @param int $actionId: Id of the action
* @return void
*/
protected function deleteUser($userId, $actionId) {
$GLOBALS['TYPO3_DB']->exec_UPDATEquery(
'be_users',
'uid=' . $userId,
array (
'deleted' => 1,
'tstamp' => $GLOBALS['ACCESS_TIME']
)
);
// redirect to the original task
$redirectUrl = 'mod.php?M=user_task&show=' . $actionId;
t3lib_utility_Http::redirect($redirectUrl);
}
/**
* Check if a BE user is created by the current user
*
* @param int $id: Id of the BE user
* @param array $action: sys_action record.
* @return mixed the record of the BE user if found, otherwise false
*/
protected function isCreatedByUser($id, $action) {
$record = t3lib_BEfunc::getRecord(
'be_users',
$id,
'*',
' AND cruser_id=' . $GLOBALS['BE_USER']->user['uid'] . ' AND createdByAction=' . intval($action['uid'])
);
if (is_array($record)) {
return $record;
} else {
return FALSE;
}
}
/**
* Render all users who are created by the current BE user including a link to edit the record
*
* @param array $action: sys_action record.
* @param int $selectedUser: Id of a selected user
* @return html list of users
*/
protected function getCreatedUsers($action, $selectedUser) {
$content = '';
$lines = array();
// List of users
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*',
'be_users',
'cruser_id=' . $GLOBALS['BE_USER']->user['uid'] . ' AND createdByAction=' . intval($action['uid']) . t3lib_BEfunc::deleteClause('be_users'),
'',
'username'
);
// render the user records
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$icon = t3lib_iconworks::getIconImage('be_users', $row, $GLOBALS['BACK_PATH'], 'title="uid=' . $row['uid'] . '" hspace="2" align="top"');
$line = $icon . $this->action_linkUserName($row['username'], $row['realName'], $action['uid'], $row['uid']);
// selected user
if ($row['uid'] == $selectedUser) {
$line = '<strong>' . $line . '</strong>';
}
$lines[] = $line;
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
// if any records found
if (count($lines)) {
$content .= '<br />' . $this->taskObject->doc->section($GLOBALS['LANG']->getLL('action_t1_listOfUsers'), implode('<br />', $lines));
}
return $content;
}
/**
* Create a link to edit a user
*
* @param string $username: Username
* @param string $realName: Real name of the user
* @param int $sysActionUid: Id of the sys_action record
* @param int $userId: Id of the user
* @return html link
*/
protected function action_linkUserName($username, $realName, $sysActionUid, $userId) {
if (!empty($realName)) {
$username .= ' (' . $realName . ')';
}
// link to update the user record
$href = 'mod.php?M=user_task&SET[function]=sys_action.tasks&show=' . intval($sysActionUid) . '&be_users_uid=' . intval($userId);
$link = '<a href="' . $href . '">' . htmlspecialchars($username) . '</a>';
// link to delete the user record
$onClick = ' onClick="return confirm('.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL("lDelete_warning")).');"';
$link .= '
<a href="' . $href . '&delete=1" ' . $onClick . '>
<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/delete_record.gif') . ' alt="" />
</a>';
return $link;
}
/**
* Save/Update a BE user
*
* @param array $record: Current action record
* @param array $vars: POST vars
* @return int Id of the new/updated user
*/
protected function saveNewBackendUser($record, $vars) {
$content = '';
// check if the db mount is a page the current user is allowed to.);
$vars['db_mountpoints'] = $this->fixDbMount($vars['db_mountpoints']);
// check if the usergroup is allowed
$vars['usergroup'] = $this->fixUserGroup($vars['usergroup'], $record);
// check if md5 is used as password encryption
if (strpos($GLOBALS['TCA']['be_users']['columns']['password']['config']['eval'], 'md5') !== FALSE) {
$vars['password'] = md5($vars['password']);
}
$key = $vars['key'];
$data = '';
$newUserId = 0;
if ($key === 'NEW') {
$beRec = t3lib_BEfunc::getRecord('be_users', intval($record['t1_copy_of_user']));
if (is_array($beRec)) {
$data = array();
$data['be_users'][$key] = $beRec;
$data['be_users'][$key]['username'] = $this->fixUsername($vars['username'], $record['t1_userprefix']);
$data['be_users'][$key]['password'] = (trim($vars['password']));
$data['be_users'][$key]['realName'] = $vars['realName'];
$data['be_users'][$key]['email'] = $vars['email'];
$data['be_users'][$key]['disable'] = intval($vars['disable']);
$data['be_users'][$key]['admin'] = 0;
$data['be_users'][$key]['usergroup'] = $vars['usergroup'];
$data['be_users'][$key]['db_mountpoints'] = $vars['db_mountpoints'];
$data['be_users'][$key]['createdByAction'] = $record['uid'];
}
} else {
// check ownership
$beRec = t3lib_BEfunc::getRecord('be_users', intval($key));
if (is_array($beRec) && $beRec['cruser_id'] == $GLOBALS['BE_USER']->user['uid']) {
$data=array();
$data['be_users'][$key]['username'] = $this->fixUsername($vars['username'], $record['t1_userprefix']);
if (trim($vars['password'])) {
$data['be_users'][$key]['password'] = (trim($vars['password']));
}
$data['be_users'][$key]['realName'] = $vars['realName'];
$data['be_users'][$key]['email'] = $vars['email'];
$data['be_users'][$key]['disable'] = intval($vars['disable']);
$data['be_users'][$key]['admin'] = 0;
$data['be_users'][$key]['usergroup'] = $vars['usergroup'];
$data['be_users'][$key]['db_mountpoints'] = $vars['db_mountpoints'];
$newUserId = $key;
}
}
// save/update user by using TCEmain
if (is_array($data)) {
$tce = t3lib_div::makeInstance("t3lib_TCEmain");
$tce->stripslashes_values = 0;
$tce->start($data, array(), $GLOBALS['BE_USER']);
$tce->admin = 1;
$tce->process_datamap();
$newUserId = intval($tce->substNEWwithIDs['NEW']);
if ($newUserId) {
// Create
$this->action_createDir($newUserId);
} else {
// update
$newUserId = intval($key);
}
unset($tce);
}
return $newUserId;
}
/**
* Create the username based on the given username and the prefix
*
* @param string $username: username
* @param string $prefix: prefix
* @return string Combined username
*/
private function fixUsername($username, $prefix) {
return trim($prefix) . trim($username);
}
/**
* Clean the to be applied usergroups from not allowed ones
*
* @param array $appliedUsergroups: array of to be applied user groups
* @return array Cleaned array
*/
protected function fixUserGroup($appliedUsergroups, $actionRecord) {
if (is_array($appliedUsergroups)) {
$cleanGroupList = array();
// create an array from the allowed usergroups using the uid as key
$allowedUsergroups = array_flip(explode(',', $actionRecord['t1_allowed_groups']));
// walk through the array and check every uid if it is undder the allowed ines
foreach ($appliedUsergroups as $group) {
if (isset($allowedUsergroups[$group])) {
$cleanGroupList[] = $group;
}
}
$appliedUsergroups = $cleanGroupList;
}
return $appliedUsergroups;
}
/**
* Clean the to be applied DB-Mounts from not allowed ones
*
* @param string $appliedDbMounts: List of pages like pages_123,pages456
* @return string Cleaned list
*/
protected function fixDbMount($appliedDbMounts) {
// Admins can see any page, no need to check there
if (!empty($appliedDbMounts) && !$GLOBALS['BE_USER']->isAdmin()) {
$cleanDbMountList = array();
$dbMounts = t3lib_div::trimExplode(',', $appliedDbMounts, 1);
// walk through every wanted DB-Mount and check if it allowed for the current user
foreach ($dbMounts as $dbMount) {
$uid = intval(substr($dbMount, (strrpos($dbMount, '_') + 1)));
$page = t3lib_BEfunc::getRecord('pages', $uid);
// check rootline and access rights
if ($this->checkRootline($uid) && $GLOBALS['BE_USER']->calcPerms($page)) {
$cleanDbMountList[] = 'pages' . $uid;
}
}
// build the clean list
$appliedDbMounts = implode(',', $cleanDbMountList);
}
return $appliedDbMounts;
}
/**
* Check if a page is inside the rootline the current user can see
*
* @param int $pageId: Id of the the page to be checked
* @return boolean Access to the page
*/
protected function checkRootline($pageId) {
$access = FALSE;
$dbMounts = array_flip(explode(',', trim($GLOBALS['BE_USER']->dataLists['webmount_list'], ',')));
$rootline = t3lib_BEfunc::BEgetRootLine($pageId);
foreach ($rootline as $page) {
if (isset($dbMounts[$page['uid']]) && !$access) {
$access = TRUE;
}
}
return $access;
}
/**
* Add additional JavaScript to use the tceform select box
*
* @param int $uid: Id of the user record
* @return void
*/
protected function JScode() {
$this->t3lib_TCEforms = t3lib_div::makeInstance("t3lib_TCEforms");
$this->t3lib_TCEforms->backPath = $GLOBALS['BACK_PATH'];
$js = $this->t3lib_TCEforms->dbFileCon();
$this->taskObject->doc->JScodeArray[] = $js;
return $js;
}
/**
* Create a user directory if defined
*
* @param int $uid: Id of the user record
* @return void
*/
protected function action_createDir($uid) {
$path = $this->action_getUserMainDir();
if ($path) {
t3lib_div::mkdir($path . $uid);
t3lib_div::mkdir($path . $uid . '/_temp_/');
}
}
/**
* Get the path to the user home directory which is set in the localconf.php
*
* @return string path
*/
protected function action_getUserMainDir() {
$path = $GLOBALS['TYPO3_CONF_VARS']['BE']['userHomePath'];
// if path is set and a valid directory
if ($path && @is_dir($path) &&
$GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath'] &&
t3lib_div::isFirstPartOfStr($path, $GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath']) &&
substr($path,-1) == '/'
) {
return $path;
}
}
protected function getUsergroups($record, $vars) {
$content = '';
// do nothing if no groups are allowed
if (empty($record['t1_allowed_groups'])) {
return $content;
}
$content .= '<option value=""></option>';
$grList = t3lib_div::trimExplode(',', $record['t1_allowed_groups'], 1);
foreach($grList as $group) {
$checkGroup = t3lib_BEfunc::getRecord('be_groups', $group);
if (is_array($checkGroup)) {
$selected = (is_array($vars['usergroup']) && t3lib_div::inList(implode(',', $vars['usergroup']), $checkGroup['uid'])) ? ' selected="selected" ' : '';
$content .= '<option ' . $selected . 'value="' . $checkGroup['uid'] . '">' . htmlspecialchars($checkGroup['title']) . '</option>';
}
}
return $content;
}
/**
* Action to create a new record
*
* @param array $record: sys_action record
* @return redirect to form to create a record
*/
protected function viewNewRecord($record) {
$returnUrl = rawurlencode('mod.php?M=user_task');
$link = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR') . $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . $returnUrl. '&edit[' . $record['t3_tables'] . '][' . intval($record['t3_listPid']) . ']=new';
t3lib_utility_Http::redirect($link);
}
/**
* Action to edit records
*
* @param array $record: sys_action record
* @return string list of records
*/
protected function viewEditRecord($record) {
$content = '';
$lines = array();
$dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
$dbAnalysis->fromTC = 0;
$dbAnalysis->start($record['t4_recordsToEdit'], '*');
$dbAnalysis->getFromDB();
// collect the records
foreach ($dbAnalysis->itemArray as $el) {
$path = t3lib_BEfunc::getRecordPath ($el['id'], $this->taskObject->perms_clause, $GLOBALS['BE_USER']->uc['titleLen']);
$record = t3lib_BEfunc::getRecord($el['table'], $dbAnalysis->results[$el['table']][$el['id']]);
$title = t3lib_BEfunc::getRecordTitle($el['table'], $dbAnalysis->results[$el['table']][$el['id']]);
$description = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$el['table']]['ctrl']['title'], 1);
if (isset($record['crdate'])) { // @todo: which information could be needfull
$description .= ' - ' . t3lib_BEfunc::dateTimeAge($record['crdate']);
}
$lines[$el['id']] = array(
'title' => $title,
'description' => t3lib_BEfunc::getRecordTitle($el['table'], $dbAnalysis->results[$el['table']][$el['id']]),
'descriptionHtml' => $description,
'link' => $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv("REQUEST_URI")) . '&edit[' . $el['table'] . '][' . $el['id'] . ']=edit',
'icon' => t3lib_iconworks::getIconImage($el['table'], $dbAnalysis->results[$el['table']][$el['id']], $GLOBALS['BACK_PATH'], 'hspace="2" align="top" title="' . htmlspecialchars($path) . '"')
);
}
// render the record list
$content .= $this->taskObject->renderListMenu($lines);
return $content;
}
/**
* Action to view the result of a SQL query
*
* @param array $record: sys_action record
* @return string result of the query
*/
protected function viewSqlQuery($record) {
$content = '';
if (t3lib_extMgm::isLoaded('lowlevel')) {
$sql_query = unserialize($record['t2_data']);
if (is_array($sql_query) && strtoupper(substr(trim($sql_query['qSelect']), 0, 6)) == 'SELECT') {
$actionContent = '';
$fullsearch = t3lib_div::makeInstance("t3lib_fullsearch");
$fullsearch->formW = 40;
$fullsearch->noDownloadB = 1;
$type = $sql_query['qC']['search_query_makeQuery'];
$res = $GLOBALS['TYPO3_DB']->sql_query($sql_query['qSelect']);
if (!$GLOBALS['TYPO3_DB']->sql_error()) {
$fullsearch->formW = 48;
// additional configuration
$GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels'] = 1;
$cP = $fullsearch->getQueryResultCode($type, $res, $sql_query['qC']['queryTable']);
$actionContent = $cP['content'];
// if the result is rendered as csv or xml, show a download link
if ($type == 'csv' || $type == 'xml' ) {
$actionContent .= '<br /><br /><a href="' . t3lib_div::getIndpEnv('REQUEST_URI') . '&download_file=1"><strong>' . $GLOBALS['LANG']->getLL('action_download_file') . '</strong></a>';
}
} else {
$actionContent .= $GLOBALS['TYPO3_DB']->sql_error();
}
// Admin users are allowed to see and edit the query
if ($GLOBALS['BE_USER']->isAdmin()) {
$actionContent .= '<hr /> ' . $fullsearch->tableWrap($sql_query['qSelect']);
$actionContent .= '<br /><a title="' . $GLOBALS['LANG']->getLL('action_editQuery') . '" href="'.$GLOBALS['BACK_PATH'] . t3lib_extMgm::extRelPath('lowlevel') . 'dbint/index.php?id='.
'&SET[function]=search' .
'&SET[search]=query' .
'&storeControl[STORE]=-' . $record['uid'] .
'&storeControl[LOAD]=1' .
'">
<img class="icon"' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/edit2.gif') . ' alt="" />' .
$GLOBALS['LANG']->getLL('action_editQuery') . '</a><br /><br />';
}
$content .= $this->taskObject->doc->section($GLOBALS['LANG']->getLL('action_t2_result'), $actionContent, 0, 1);
} else {
// query is not configured
$flashMessage = t3lib_div::makeInstance (
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('action_notReady', true),
$GLOBALS['LANG']->getLL('action_error'),
t3lib_FlashMessage::ERROR
);
$content .= '<br />' . $flashMessage->render();
}
} else {
// required sysext lowlevel is not installed
$flashMessage = t3lib_div::makeInstance (
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('action_lowlevelMissing', true),
$GLOBALS['LANG']->getLL('action_error'),
t3lib_FlashMessage::ERROR
);
$content .= '<br />' . $flashMessage->render();
}
return $content;
}
/**
* Action to create a list of records of a specific table and pid
*
* @param array $record: sys_action record
* @return string list of records
*/
protected function viewRecordList($record) {
$content = '';
$this->id = intval($record['t3_listPid']);
$this->table = $record['t3_tables'];
if ($this->id == 0 || $this->table == '') {
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('action_lowlevelMissing', true),
$GLOBALS['LANG']->getLL('action_error'),
t3lib_FlashMessage::ERROR
);
$content .= '<br />' . $flashMessage->render();
return $content;
}
require_once($GLOBALS['BACK_PATH'] . 'class.db_list.inc');
require_once($GLOBALS['BACK_PATH'] . 'class.db_list_extra.inc');
// Start document template object:
// $this->doc = t3lib_div::makeInstance('template');
// Loading current page record and checking access:
$this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->taskObject->perms_clause);
$access = is_array($this->pageinfo) ? 1 : 0;
// If there is access to the page, then render the list contents and set up the document template object:
if ($access) {
// Initialize the dblist object:
$dblist = t3lib_div::makeInstance('localRecordList');
$dblist->script = t3lib_div::getIndpEnv('REQUEST_URI');
$dblist->backPath = $GLOBALS['BACK_PATH'];
$dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($this->pageinfo);
$dblist->thumbs = $GLOBALS['BE_USER']->uc['thumbnailsByDefault'];
$dblist->returnUrl=$this->taskObject->returnUrl;
$dblist->allFields = 1;
$dblist->localizationView = 1;
$dblist->showClipboard = 0;
$dblist->disableSingleTableView = 1;
$dblist->pageRow = $this->pageinfo;
$dblist->counter++;
$dblist->MOD_MENU = array('bigControlPanel' => '', 'clipBoard' => '', 'localization' => '');
$dblist->modTSconfig = $this->taskObject->modTSconfig;
$dblist->dontShowClipControlPanels = $CLIENT['FORMSTYLE'] && !$this->taskObject->MOD_SETTINGS['bigControlPanel'] && $dblist->clipObj->current=='normal' && !$GLOBALS['BE_USER']->uc['disableCMlayers'] && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers'];
// Initialize the listing object, dblist, for rendering the list:
$this->pointer = t3lib_div::intInRange($this->taskObject->pointer,0,100000);
$dblist->start($this->id,$this->table,$this->pointer,$this->taskObject->search_field,$this->taskObject->search_levels,$this->taskObject->showLimit);
$dblist->setDispFields();
// Render the list of tables:
$dblist->generateList();
// Add JavaScript functions to the page:
$this->taskObject->doc->JScode=$this->taskObject->doc->wrapScriptTags('
function jumpToUrl(URL) {
window.location.href = URL;
return false;
}
function jumpExt(URL,anchor) {
var anc = anchor?anchor:"";
window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc;
return false;
}
function jumpSelf(URL) {
window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:"");
return false;
}
function setHighlight(id) {
top.fsMod.recentIds["web"]=id;
top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank; // For highlighting
if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
top.content.nav_frame.refresh_nav();
}
}
' . $dblist->CBfunctions() . '
function editRecords(table,idList,addParams,CBflag) {
window.location.href="' . $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) .
'&edit["+table+"]["+idList+"]=edit"+addParams;
}
function editList(table,idList) {
var list="";
// Checking how many is checked, how many is not
var pointer=0;
var pos = idList.indexOf(",");
while (pos!=-1) {
if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) {
list+=idList.substr(pointer,pos-pointer)+",";
}
pointer=pos+1;
pos = idList.indexOf(",",pointer);
}
if (cbValue(table+"|"+idList.substr(pointer))) {
list+=idList.substr(pointer)+",";
}
return list ? list : idList;
}
T3_THIS_LOCATION = "' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '";
if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
');
// Setting up the context sensitive menu:
$this->taskObject->doc->getContextMenuCode();
// Begin to compile the whole page
$content .= '<form action="'.htmlspecialchars($dblist->listURL()).'" method="post" name="dblistForm">' .
$dblist->HTMLcode .
'<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" />
</form>';
// If a listing was produced, create the page footer with search form etc:
if ($dblist->HTMLcode) {
// Making field select box (when extended view for a single table is enabled):
if ($dblist->table) {
$tmpBackpath = $GLOBALS['BACK_PATH'];
$GLOBALS['BACK_PATH'] = '';
$content .= $dblist->fieldSelectBox($dblist->table);
$GLOBALS['BACK_PATH'] = $tmpBackpath;
}
}
} else {
// not enough rights to access the list view or the page
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('action_error-access', true),
$GLOBALS['LANG']->getLL('action_error'),
t3lib_FlashMessage::ERROR
);
$content .= $flashMessage->render();
}
return $content;
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/sys_action/task/class.tx_sysaction_task.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/sys_action/task/class.tx_sysaction_task.php']);
}
?>
typo3/sysext/sys_action/tca.php (working copy)
// ******************************************************************
// sys_action
// ******************************************************************
$TCA['sys_action'] = Array (
$TCA['sys_action'] = array (
'ctrl' => $TCA['sys_action']['ctrl'],
'interface' => Array (
'interface' => array (
'showRecordFieldList' => 'hidden,title,type,description,assign_to_groups'
),
'columns' => Array (
'title' => Array (
'columns' => array (
'title' => array (
'label' => 'LLL:EXT:lang/locallang_general.php:LGL.title',
'config' => Array (
'config' => array (
'type' => 'input',
'size' => '25',
'max' => '256',
'eval' => 'trim,required'
)
),
'description' => Array (
'description' => array (
'label' => 'LLL:EXT:lang/locallang_general.php:LGL.description',
'config' => Array (
'config' => array (
'type' => 'text',
'rows' => 10,
'cols' => 48
)
),
'hidden' => Array (
'hidden' => array (
'label' => 'LLL:EXT:sys_action/locallang_tca.php:sys_action.hidden',
'config' => Array (
'config' => array (
'type' => 'check'
)
),
'type' => Array (
'type' => array (
'label' => 'LLL:EXT:lang/locallang_general.php:LGL.type',
'config' => Array (
'config' => array (
'type' => 'select',
'items' => Array (
Array('', '0'),
Array('Create Backend User', '1'),
Array('SQL-query', '2'),
Array('Record list', '3'),
Array('Edit records', '4'),
Array('New Record', '5')
'items' => array (
array('', '0'),
array('LLL:EXT:sys_action/locallang_tca.php:sys_action.type.1', '1'),
array('LLL:EXT:sys_action/locallang_tca.php:sys_action.type.2', '2'),
array('LLL:EXT:sys_action/locallang_tca.php:sys_action.type.3', '3'),
array('LLL:EXT:sys_action/locallang_tca.php:sys_action.type.4', '4'),
array('LLL:EXT:sys_action/locallang_tca.php:sys_action.type.5', '5')
)
)
),
'assign_to_groups' => Array (
'assign_to_groups' => array (
'label' => 'LLL:EXT:sys_action/locallang_tca.php:sys_action.assign_to_groups',
'config' => Array (
'config' => array (
'type' => 'select',
'foreign_table' => 'be_groups',
'foreign_table_where' => 'ORDER BY be_groups.title',
'MM' => 'sys_action_asgr_mm',
'size' => '5',
'size' => '10',
'minitems' => '0',
'maxitems' => '200'
'maxitems' => '200',
'autoSizeMax' => '10'
)
),
't1_userprefix' => Array (
't1_userprefix' => array (
'label' => 'LLL:EXT:sys_action/locallang_tca.php:sys_action.t1_userprefix',
'config' => Array (
'config' => array (
'type' => 'input',
'size' => '25',
'max' => '10',
'eval' => 'trim'
)
),
't1_allowed_groups' => Array (
't1_allowed_groups' => array (
'label' => 'LLL:EXT:sys_action/locallang_tca.php:sys_action.t1_allowed_groups',
'config' => Array (
'config' => array (
'type' => 'select',
'foreign_table' => 'be_groups',
'foreign_table_where' => 'ORDER BY be_groups.title',
'size' => '2',
'maxitems' => '20'
'size' => '10',
'maxitems' => '20',
'autoSizeMax' => '10'
)
),
't1_create_user_dir' => Array (
't1_create_user_dir' => array (
'label' => 'LLL:EXT:sys_action/locallang_tca.php:sys_action.t1_create_user_dir',
'config' => Array (
'config' => array (
'type' => 'check'
)
),
't1_copy_of_user' => Array (
't1_copy_of_user' => array (
'label' => 'LLL:EXT:sys_action/locallang_tca.php:sys_action.t1_copy_of_user',
'config' => Array (
'config' => array (
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'be_users',
......
)
)
),
't3_listPid' => Array (
't3_listPid' => array (
'label' => 'LLL:EXT:sys_action/locallang_tca.php:sys_action.t3_listPid',
'config' => Array (
'config' => array (
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'pages',
......
)
)
),
't3_tables' => Array (
't3_tables' => array (
'label' => 'LLL:EXT:sys_action/locallang_tca.php:sys_action.t3_tables',
'config' => Array (
'config' => array (
'type' => 'select',
'special' => 'tables',
'items' => Array (
Array('','')
'items' => array (
array('','')
)
)
),
't4_recordsToEdit' => Array (
't4_recordsToEdit' => array (
'label' => 'LLL:EXT:sys_action/locallang_tca.php:sys_action.t4_recordsToEdit',
'config' => Array (
'config' => array (
'type' => 'group',
'internal_type' => 'db',
'allowed' => '*',
......
'size' => '5',
'maxitems' => '50',
'minitems' => '1',
'show_thumbs' => '1'
'show_thumbs' => '1',
'wizards' => array(
'suggest' => array(
'type' => 'suggest',
)
)
)
),
),
'types' => Array (
'0' => Array('showitem' => 'hidden;;;;1-1-1,type,title;;;;2-2-2'),
'1' => Array('showitem' => 'hidden;;;;1-1-1,type,title;;;;2-2-2,description;;;;3-3-3,assign_to_groups,--div--,t1_userprefix;;;;5-5-5,t1_copy_of_user,t1_allowed_groups,t1_create_user_dir'),
'2' => Array('showitem' => 'hidden;;;;1-1-1,type,title;;;;2-2-2,description;;;;3-3-3,assign_to_groups,--div--,'),
'3' => Array('showitem' => 'hidden;;;;1-1-1,type,title;;;;2-2-2,description;;;;3-3-3,assign_to_groups,--div--,t3_listPid;;;;5-5-5,t3_tables;'),
'4' => Array('showitem' => 'hidden;;;;1-1-1,type,title;;;;2-2-2,description;;;;3-3-3,assign_to_groups,--div--,t4_recordsToEdit;;;;5-5-5'),
'5' => Array('showitem' => 'hidden;;;;1-1-1,type,title;;;;2-2-2,description;;;;3-3-3,assign_to_groups,--div--,t3_listPid;Where to create records:;;;5-5-5,t3_tables;Create records in table:'),
'types' => array (
'0' => array('showitem' => 'hidden;;;;1-1-1,type,title;;;;2-2-2'),
'1' => array('showitem' => 'hidden;;;;1-1-1,type,title;;;;2-2-2,description;;;;3-3-3,assign_to_groups,--div--,t1_userprefix;;;;5-5-5,t1_copy_of_user,t1_allowed_groups,t1_create_user_dir'),
'2' => array('showitem' => 'hidden;;;;1-1-1,type,title;;;;2-2-2,description;;;;3-3-3,assign_to_groups,--div--,'),
'3' => array('showitem' => 'hidden;;;;1-1-1,type,title;;;;2-2-2,description;;;;3-3-3,assign_to_groups,--div--,t3_listPid;;;;5-5-5,t3_tables;'),
'4' => array('showitem' => 'hidden;;;;1-1-1,type,title;;;;2-2-2,description;;;;3-3-3,assign_to_groups,--div--,t4_recordsToEdit;;;;5-5-5'),
'5' => array('showitem' => 'hidden;;;;1-1-1,type,title;;;;2-2-2,description;;;;3-3-3,assign_to_groups,--div--,t3_listPid;Where to create records:;;;5-5-5,t3_tables;Create records in table:'),
)
);
?>
?>
typo3/sysext/sys_action/toolbarmenu/class.tx_sysaction_toolbarmenu.php (working copy)
if ($actionEntries) {
$this->addJavascriptToBackend();
$this->addCssToBackend();
$title = $GLOBALS['LANG']->getLL('action_toolbaritem', true);
$title = $GLOBALS['LANG']->getLL('action_toolbaritem', TRUE);
$actionMenu[] = '<a href="#" class="toolbar-item"><img' .
t3lib_iconWorks::skinImg(
......
}
$actionMenu[] = '</ul>';
return implode(LF, $actionMenu);
return implode("\n", $actionMenu);
} else {
return '';
}
......
while ($actionRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($queryResource)) {
$actions[] = array(
$actionRow['title'],
'sysext/taskcenter/task/index.php?SET[function]=tx_sysaction&sys_action_uid=' . $actionRow['uid'],
'mod.php?M=user_task&SET[function]=sys_action.tasks&show=' . $actionRow['uid'],
t3lib_iconworks::getIconImage(
'sys_action',
$actionRow,
......
*/
public function checkAccess() {
// taskcenter is enabled for everybody
return true;
return TRUE;
}
}
(5-5/6)