[TASK] Scheduler: Add "Add Task" button to header
authorMarkus Klein <klein.t3@mfc-linz.at>
Wed, 21 Dec 2011 22:24:01 +0000 (16:24 -0600)
committerAndreas Wolf <andreas.wolf@ikt-werk.de>
Sat, 24 Dec 2011 12:52:18 +0000 (13:52 +0100)
This patch adds a "Add Task" button to the left area of
the module header.
It improves usability for long task lists and enforces
the standard layout of backend modules.
The "Add Task" link below the table is removed at the
same time.

Change-Id: Id5647861b1ec31ac5c3401153ea58c5d525f99c3
Resolves: #32753
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/7511
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf
typo3/sysext/scheduler/class.tx_scheduler_module.php
typo3/sysext/scheduler/mod1/mod_template.html

index 9c50b0f..7d0ef75 100644 (file)
@@ -1184,14 +1184,7 @@ class tx_scheduler_Module extends t3lib_SCbase {
                        $content .= '<input type="submit" class="button" name="go" id="scheduler_executeselected" value="' . $GLOBALS['LANG']->getLL('label.executeSelected') . '" />';
                }
 
-               if (count($registeredClasses) > 0) {
-                               // Display add new task link
-                       $link = $GLOBALS['MCONF']['_'] . '&CMD=add';
-                       $content .= '<p><a href="' . htmlspecialchars($link) .'"><img '
-                               . t3lib_iconWorks::skinImg($this->backPath, 'gfx/new_el.gif')
-                               . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:new', TRUE)
-                               . '" /> ' . $GLOBALS['LANG']->getLL('action.add') . '</a></p>';
-               } else {
+               if (!count($registeredClasses) > 0) {
                                /** @var t3lib_FlashMessage $flashMessage */
                        $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage',
                                $GLOBALS['LANG']->getLL('msg.noTasksDefined'),
@@ -1566,14 +1559,22 @@ class tx_scheduler_Module extends t3lib_SCbase {
         */
        protected function getDocHeaderButtons() {
                $buttons = array(
+                       'addtask'  => '',
                        'reload'   => '',
                        'shortcut' => $this->getShortcutButton(),
                );
 
                if (empty($this->CMD) || $this->CMD == 'list') {
                        $buttons['reload'] = '<a href="' . $GLOBALS['MCONF']['_'] . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.reload', TRUE) . '">' .
-                         t3lib_iconWorks::getSpriteIcon('actions-system-refresh') .
-                 '</a>';
+                               t3lib_iconWorks::getSpriteIcon('actions-system-refresh') .
+                               '</a>';
+                       if ($this->MOD_SETTINGS['function'] === 'scheduler' && count(self::getRegisteredClasses())) {
+                               $link = $GLOBALS['MCONF']['_'] . '&CMD=add';
+                               $image = '<img ' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/new_el.gif') .
+                                       ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:new', TRUE) . '" />';
+                               $buttons['addtask'] = '<a href="' . htmlspecialchars($link) . '" ' .
+                                       'title="' . $GLOBALS['LANG']->getLL('action.add') . '">' . $image . '</a>';
+                       }
                }
 
                return $buttons;
index 3f6b600..3665716 100644 (file)
@@ -3,7 +3,7 @@
        <!-- Page header with buttons, path details and csh -->
        <div id="typo3-docheader">
                <div id="typo3-docheader-row1">
-                       <div class="buttonsleft"></div>
+                       <div class="buttonsleft">###BUTTONLIST_LEFT###</div>
                        <div class="buttonsright">###BUTTONLIST_RIGHT###</div>
                </div>
                <div id="typo3-docheader-row2">
        <div class="buttongroup">###BUTTONS###</div>
 <!-- ###BUTTON_GROUP_WRAP### -->
 
+<!-- ###BUTTON_GROUPS_LEFT### -->
+<!-- ###BUTTON_GROUP1### -->###ADDTASK###<!-- ###BUTTON_GROUP1### -->
+<!-- ###BUTTON_GROUPS_LEFT### -->
+
 <!-- ###BUTTON_GROUPS_RIGHT### -->
 <!-- ###BUTTON_GROUP1### -->###RELOAD######SHORTCUT###<!-- ###BUTTON_GROUP1### -->
 <!-- ###BUTTON_GROUPS_RIGHT### -->