20080209_new_menu_taskcenter.diff

Administrator Admin, 2008-02-09 17:32

Download (7.88 KB)

View differences:

typo3/stylesheet.css (working copy)
554 554
BODY#typo3-mod-tools-em-index-php TR.unsupported-ext TD A { color: #ff0000; }
555 555
BODY#typo3-mod-tools-em-index-php TR TD.extstate { color: #fff; font-weight: bold; text-align: center; }
556 556

  
557
/* Task Center */
558
#ext-taskcenter-task-index-php ul.taskcenter-module,ul.taskcenter-module li ul {list-style:none;margin:0;padding:0;}
559
#ext-taskcenter-task-index-php ul.taskcenter-module li a{cursor:pointer;border:1px solid black;background:#eee;padding:6px 12px;display:block;clear:left;}
560
#ext-taskcenter-task-index-php ul.taskcenter-module li a.active {background:#aaa;}
561
#ext-taskcenter-task-index-php ul.taskcenter-module li a:hover {background:#d7dbe2;}
562
#ext-taskcenter-task-index-php ul.taskcenter-module li ul {margin:5px 0;}
563
#ext-taskcenter-task-index-php ul.taskcenter-module li ul li {display:block;padding-left:24px;}
564
#ext-taskcenter-task-index-php ul.taskcenter-module li ul li a {padding:0;border:none;background:transparent;display:inline;}
557 565

  
566
#ext-taskcenter-task-index-php {height:95%;}
567

  
568

  
558 569
/* Workspace */
559 570
div.workspace-info {
560 571
	padding: 0px 2px 0px 2px;
typo3/sysext/taskcenter/ext_tables.php (working copy)
2 2
if (!defined ('TYPO3_MODE')) 	die ('Access denied.');
3 3

  
4 4
if (TYPO3_MODE=='BE')	t3lib_extMgm::addModule('user','task','top',t3lib_extMgm::extPath($_EXTKEY).'task/');
5
?>
5

  
6
$TYPO3_CONF_VARS['BE']['AJAX']['TaskCenter::saveMenuState'] = t3lib_extMgm::extPath($_EXTKEY).'task/class.mod_user_task.php:mod_user_task->ajaxSaveMenuStatus';
7
?>
typo3/sysext/taskcenter/task/class.mod_user_task.php (working copy)
203 203
	function urlInIframe($url,$max=0) {
204 204
		return '<iframe onload="resizeIframe(this,'.$max.');" scrolling="auto" width="100%" src="'.$url.'" name="list_frame" frameborder="no" style="border: none;"></iframe>';
205 205
	}
206
	
207
	
208
	function ajaxSaveMenuStatus($params = array(), TYPO3AJAX &$ajaxObj = null) {
209
		$menuid = t3lib_div::_POST('menuid');
210
		$state = t3lib_div::_POST('state') === 'true' ? 0 : 1;
211
		
212
		$GLOBALS['BE_USER']->uc['moduleData']['TaskCenter'][$menuid] = $state;
213
		$GLOBALS['BE_USER']->uc['moduleData']['TaskCenter']['active'] = $menuid;
214
		$GLOBALS['BE_USER']->writeUC();
215
	}
206 216

  
207

  
208 217
}
209 218

  
210 219
// Include extension?
typo3/sysext/taskcenter/task/index.php (working copy)
92 92
		$this->doc = t3lib_div::makeInstance('noDoc');
93 93
		$this->doc->docType = 'xhtml_trans';
94 94
		$this->doc->divClass = '';
95
		
96
		
95 97
		$this->doc->form = '<form action="index.php" method="POST" name="editform">';
96 98
		$this->backPath = $this->doc->backPath = $BACK_PATH;
97 99
		$this->doc->JScode = '  <script language="javascript" type="text/javascript">
......
102 104
			'.(is_object($this->extObj)?$this->extObj->JScode():"").'
103 105
			</script>
104 106
			';
105
		$this->doc->JScode .= $this->doc->getDynTabMenuJScode();
107

  
108
		$this->doc->loadJavascriptLib('contrib/prototype/prototype.js');
106 109
		$this->doc->JScode .= '<script language="javascript" type="text/javascript">
107 110
		function resizeIframe(frame,max) {
108 111
			try {
......
117 120
				window.status = e.message;
118 121
			}
119 122
		}
120
</script>';
123
</script>
124
<script type="text/javascript" src="'.$BACK_PATH.t3lib_extMgm::extRelPath('taskcenter').'TaskCenterMenu.js"></script>	
125
		';
121 126

  
122 127
		/* call getMainContent first, because what happens here might affect leftContent */
123 128
		$mainContent = $this->getMainContent();
......
140 145
		//walk through registered submodules and generate configuration
141 146
		//for tabmenu
142 147
		$parts = Array();
148
		$i=0;
149
		$output .= '<ul class="taskcenter-module">';
143 150
		foreach($this->allExtClassConf as $conf) {
144 151
			$extObj = t3lib_div::makeInstance($conf['name']);
145 152
			/* call init to make sure the LOCAL_LANG is included for all listed
......
149 156
			$extObj->mod_user_task_init($GLOBALS['BE_USER']);
150 157
			$part = $extObj->overview_main();
151 158
			if (is_array($part)) {
152
				$parts[] = $part;
159
				$parts[$i++] = $part;
160
				$status = intval($GLOBALS['BE_USER']->uc['moduleData']['TaskCenter']['taskcenter-module-header-'.$i]);
161
				$activeID = ($GLOBALS['BE_USER']->uc['moduleData']['TaskCenter']['active'] === 'taskcenter-module-header-'.$i);
162
				
163
				$output .='<li class="taskcenter-module-header" id="taskcenter-module-header-'.$i.'"><a href="#"'.($activeID ? ' class="active"' : '').'>'.$part['icon'].'</a>';
164
				if(isset($part['content'])) {
165
					$items=explode('<BR>',$part['content']);
166
					$output .= '<ul'.($status==1 ? ' style="display:none;"' : '').'>';
167
					foreach($items as $item) {
168
						if($item) $output .= '<li>'.$item.'</li>';
169
					}
170
					$output .= '</ul>';
171
				}
172
				$output .= '</li>';
153 173
			}
154 174
		}
155
		return $this->doc->getDynTabMenu($parts, 'tx_taskcenter', 1, true);
175
		$output .= '</ul>';
176
		return $output;
156 177
	}
157 178

  
158 179
	/**
......
188 209
		$this->content .= $this->doc->endPage();
189 210
		echo $this->content;
190 211
	}
191

  
212
	
213
	
192 214
}
193 215

  
194 216

  
typo3/sysext/taskcenter/TaskCenterMenu.js (revision 0)
1
/***************************************************************
2
*  Copyright notice
3
*
4
*  (c) 2008 Steffen Kamper <info@sk-typo3.de>
5
*  All rights reserved
6
*
7
*  This script is part of the TYPO3 project. The TYPO3 project is
8
*  free software; you can redistribute it and/or modify
9
*  it under the terms of the GNU General Public License as published by
10
*  the Free Software Foundation; either version 2 of the License, or
11
*  (at your option) any later version.
12
*
13
*  The GNU General Public License can be found at
14
*  http://www.gnu.org/copyleft/gpl.html.
15
*  A copy is found in the textfile GPL.txt and important notices to the license
16
*  from the author is found in LICENSE.txt distributed with these scripts.
17
*
18
*
19
*  This script is distributed in the hope that it will be useful,
20
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
*  GNU General Public License for more details.
23
*
24
*  This copyright notice MUST APPEAR in all copies of the script!
25
***************************************************************/
26

  
27
/**
28
 * class to handle the menu in taskcenter
29
 *
30
 * $Id$
31
 */
32
var TaskCenterMenu = Class.create({
33

  
34
	/**
35
	 * registers for resize event listener and executes on DOM ready
36
	 */
37
	initialize: function() {
38
		Event.observe(window, 'load', function(){
39
			$$('.taskcenter-module-header a').invoke('observe','click', this.toggleMenu.bindAsEventListener(this));
40
		}.bindAsEventListener(this));
41
	},
42

  
43
	/**
44
	 * toggles the visibility of the menu 
45
	 */
46
	toggleMenu: function(event) {
47
		var moduleHeader = Event.element(event);	
48
		var moduleID = $(moduleHeader).up('li').id;
49
		var subList = $(moduleHeader).next('ul');
50
		
51
		if(!Object.isUndefined(subList)) {
52
			$(subList).toggle();
53
			$$('.taskcenter-module-header a').invoke('removeClassName', 'active');
54
			$(moduleHeader).addClassName('active');
55
					// save state
56
			
57
			new Ajax.Request( top.TS.PATH_typo3 + 'ajax.php', {
58
				parameters : 'ajaxID=TaskCenter::saveMenuState&menuid=' + moduleID + '&state=' + $(subList).visible()
59
			});
60
			
61
		}
62
	}
63

  
64

  
65
});
66

  
67
var TYPO3TaskCenterMenu = new TaskCenterMenu();