[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:58:51 +0000 (13:58 +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: If513454a895aefbbb7817753a7bacd6724562333
Resolves: #32753
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/7512
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf
typo3/sysext/scheduler/mod1/index.php
typo3/sysext/scheduler/mod1/mod_template.html

index 12b348c..2b53678 100755 (executable)
@@ -1197,14 +1197,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'),
@@ -1579,14 +1572,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### -->