[ Index ] |
|
Code source de Joomla 1.0.13 |
1 <?php 2 /** 3 * @version $Id: HTML_toolbar.php 4677 2006-08-23 16:55:24Z stingrey $ 4 * @package Joomla 5 * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved. 6 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php 7 * Joomla! is free software. This version may have been modified pursuant 8 * to the GNU General Public License, and as distributed it includes or 9 * is derivative of works licensed under the GNU General Public License or 10 * other free or open source software licenses. 11 * See COPYRIGHT.php for copyright notices and details. 12 */ 13 14 // no direct access 15 defined( '_VALID_MOS' ) or die( 'Restricted access' ); 16 17 /** 18 * Utility class for the button bar 19 * @package Joomla 20 */ 21 class mosToolBar { 22 23 /** 24 * Writes the start of the button bar table 25 */ 26 function startTable() { 27 ?> 28 <style type="text/css"> 29 table#toolbar { 30 margin-right: 10px; 31 } 32 33 table#toolbar a.toolbar { 34 color : #808080; 35 text-decoration : none; 36 display: block; 37 border: 1px solid #DDD; 38 width: 40px; 39 padding: 2px 5px 2px 5px; 40 } 41 table#toolbar a.toolbar:hover { 42 color : #C64934; 43 cursor: pointer; 44 border: 1px solid #c24733; 45 background-color: #f1e8e6; 46 padding: 3px 5px 1px 5px; 47 } 48 table#toolbar a.toolbar:active { 49 color : #FF9900; 50 } 51 </style> 52 <table cellpadding="0" cellspacing="3" border="0" id="toolbar"> 53 <tr height="60" valign="middle" align="center"> 54 <?php 55 } 56 57 /** 58 * Writes a custom option and task button for the button bar 59 * @param string The task to perform (picked up by the switch($task) blocks 60 * @param string The image to display 61 * @param string The image to display when moused over 62 * @param string The alt text for the icon image 63 * @param boolean True if required to check that a standard list item is checked 64 */ 65 function custom( $task='', $icon=NULL, $iconOver='', $alt='', $listSelect=true ) { 66 if ($listSelect) { 67 $href = "javascript:if (document.adminForm.boxchecked.value == 0){ alert('Please make a selection from the list to $alt');}else{submitbutton('$task')}"; 68 } else { 69 $href = "javascript:submitbutton('$task')"; 70 } 71 ?> 72 <td> 73 <a class="toolbar" href="<?php echo $href;?>" > 74 <img name="<?php echo $task;?>" src="images/<?php echo $iconOver;?>" alt="<?php echo $alt;?>" title="<?php echo $alt;?>" border="0" /></a> 75 </td> 76 <?php 77 } 78 79 /** 80 * Writes the common 'new' icon for the button bar 81 * @param string An override for the task 82 * @param string An override for the alt text 83 */ 84 function addNew( $task='new', $alt=_CMN_NEW ) { 85 $image = mosAdminMenus::ImageCheck( 'new_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 86 ?> 87 <td> 88 <a class="toolbar" href="javascript:submitbutton('<?php echo $task;?>');" > 89 <?php echo $image; ?></a> 90 </td> 91 <?php 92 } 93 94 /** 95 * Writes a common 'publish' button 96 * @param string An override for the task 97 * @param string An override for the alt text 98 */ 99 function publish( $task='publish', $alt=_CMN_PUBLISHED ) { 100 $image = mosAdminMenus::ImageCheck( 'publish_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 101 ?> 102 <td> 103 <a class="toolbar" href="javascript:submitbutton('<?php echo $task;?>');" > 104 <?php echo $image; ?></a> 105 </td> 106 <?php 107 } 108 109 /** 110 * Writes a common 'publish' button for a list of records 111 * @param string An override for the task 112 * @param string An override for the alt text 113 */ 114 function publishList( $task='publish', $alt=_CMN_PUBLISHED ) { 115 $image = mosAdminMenus::ImageCheck( 'publish_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 116 ?> 117 <td> 118 <a class="toolbar" href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('Please make a selection from the list to publish'); } else {submitbutton('<?php echo $task;?>', '');}" > 119 <?php echo $image; ?></a> 120 </td> 121 <?php 122 } 123 124 /** 125 * Writes a common 'unpublish' button 126 * @param string An override for the task 127 * @param string An override for the alt text 128 */ 129 function unpublish( $task='unpublish', $alt=_CMN_UNPUBLISHED ) { 130 $image = mosAdminMenus::ImageCheck( 'unpublish_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 131 ?> 132 <td> 133 <a class="toolbar" href="javascript:submitbutton('<?php echo $task;?>');" > 134 <?php echo $image; ?></a> 135 </td> 136 <?php 137 } 138 139 /** 140 * Writes a common 'unpublish' button for a list of records 141 * @param string An override for the task 142 * @param string An override for the alt text 143 */ 144 function unpublishList( $task='unpublish', $alt=_CMN_UNPUBLISHED ) { 145 $image = mosAdminMenus::ImageCheck( 'unpublish_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 146 ?> 147 <td> 148 <a class="toolbar" href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('Please make a selection from the list to unpublish'); } else {submitbutton('<?php echo $task;?>', '');}" > 149 <?php echo $image; ?></a> 150 </td> 151 <?php 152 } 153 154 /** 155 * Writes a common 'archive' button for a list of records 156 * @param string An override for the task 157 * @param string An override for the alt text 158 */ 159 function archiveList( $task='archive', $alt=_CMN_ARCHIVE ) { 160 $image = mosAdminMenus::ImageCheck( 'archive_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 161 ?> 162 <td> 163 <a class="toolbar" href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('Please make a selection from the list to archive'); } else {submitbutton('<?php echo $task;?>', '');}" > 164 <?php echo $image; ?></a> 165 </td> 166 <?php 167 } 168 169 /** 170 * Writes an unarchive button for a list of records 171 * @param string An override for the task 172 * @param string An override for the alt text 173 */ 174 function unarchiveList( $task='unarchive', $alt=_CMN_UNARCHIVE ) { 175 $image = mosAdminMenus::ImageCheck( 'unarchive_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 176 ?> 177 <td> 178 <a class="toolbar" href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('Please select a news story to unarchive'); } else {submitbutton('<?php echo $task;?>', '');}" > 179 <?php echo $image; ?></a> 180 </td> 181 <?php 182 } 183 184 /** 185 * Writes a common 'edit' button for a list of records 186 * @param string An override for the task 187 * @param string An override for the alt text 188 */ 189 function editList( $task='edit', $alt=_E_EDIT ) { 190 $image = mosAdminMenus::ImageCheck( 'edit_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 191 ?> 192 <td> 193 <a class="toolbar" href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('Please select an item from the list to edit'); } else {submitbutton('<?php echo $task;?>', '');}" > 194 <?php echo $image; ?></a> 195 </td> 196 <?php 197 } 198 199 /** 200 * Writes a common 'edit' button for a template html 201 * @param string An override for the task 202 * @param string An override for the alt text 203 */ 204 function editHtml( $task='edit_source', $alt=_CMN_EDIT_HTML ) { 205 $image = mosAdminMenus::ImageCheck( 'edit_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 206 ?> 207 <td> 208 <a class="toolbar" href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('Please select an item from the list to edit'); } else {submitbutton('<?php echo $task;?>', '');}" > 209 <?php echo $image; ?></a> 210 </td> 211 <?php 212 } 213 214 /** 215 * Writes a common 'edit' button for a template css 216 * @param string An override for the task 217 * @param string An override for the alt text 218 */ 219 function editCss( $task='edit_css', $alt=_CMN_EDIT_CSS ) { 220 $image = mosAdminMenus::ImageCheck( 'css_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 221 ?> 222 <td> 223 <a class="toolbar" href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('Please select an item from the list to edit'); } else {submitbutton('<?php echo $task;?>', '');}" > 224 <?php echo $image; ?></a> 225 </td> 226 <?php 227 } 228 229 /** 230 * Writes a common 'delete' button for a list of records 231 * @param string Postscript for the 'are you sure' message 232 * @param string An override for the task 233 * @param string An override for the alt text 234 */ 235 function deleteList( $msg='', $task='remove', $alt=_CMN_DELETE ) { 236 $image = mosAdminMenus::ImageCheck( 'delete_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 237 ?> 238 <td> 239 <a class="toolbar" href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('Please make a selection from the list to delete'); } else if (confirm('Are you sure you want to delete selected items. <?php echo $msg;?>')){ submitbutton('<?php echo $task;?>');}" > 240 <?php echo $image; ?></a> 241 </td> 242 <?php 243 } 244 245 /** 246 * Writes a preview button for a given option (opens a popup window) 247 * @param string The name of the popup file (excluding the file extension) 248 */ 249 function preview( $popup='' ) { 250 global $database; 251 $sql = "SELECT template" 252 . "\n FROM #__templates_menu" 253 . "\n WHERE client_id = 0" 254 . "\n AND menuid = 0"; 255 $database->setQuery( $sql ); 256 $cur_template = $database->loadResult(); 257 258 $image = mosAdminMenus::ImageCheck( 'preview_f2.png', 'images/', NULL, NULL, 'Preview', 'preview', 1 ); 259 ?> 260 <td> 261 <a class="toolbar" href="#" onclick="window.open('popups/<?php echo $popup;?>.php?t=<?php echo $cur_template; ?>', 'win1', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');" > 262 <?php echo $image; ?></a> 263 </td> 264 <?php 265 } 266 267 /** 268 * Writes a save button for a given option 269 * @param string An override for the task 270 * @param string An override for the alt text 271 */ 272 function save( $task='save', $alt=_CMN_SAVE ) { 273 $image = mosAdminMenus::ImageCheck( 'save_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 274 ?> 275 <td> 276 <a class="toolbar" href="javascript:submitbutton('<?php echo $task;?>');" > 277 <?php echo $image;?></a> 278 </td> 279 <?php 280 } 281 282 /** 283 * Writes a save button for a given option 284 * @param string An override for the task 285 * @param string An override for the alt text 286 */ 287 function apply( $task='apply', $alt=_CMN_APPLY ) { 288 $image = mosAdminMenus::ImageCheck( 'apply_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 289 ?> 290 <td> 291 <a class="toolbar" href="javascript:submitbutton('<?php echo $task;?>');" > 292 <?php echo $image;?></a> 293 </td> 294 <?php 295 } 296 297 /** 298 * Writes a save button for a given option (NOTE this is being deprecated) 299 */ 300 function savenew() { 301 $image = mosAdminMenus::ImageCheck( 'save_f2.png', '/images/', NULL, NULL, 'save', 'save', 1 ); 302 ?> 303 <td> 304 <a class="toolbar" href="javascript:submitbutton('savenew');" > 305 <?php echo $image;?></a> 306 </td> 307 <?php 308 } 309 310 /** 311 * Writes a save button for a given option (NOTE this is being deprecated) 312 */ 313 function saveedit() { 314 $image = mosAdminMenus::ImageCheck( 'save_f2.png', '/images/', NULL, NULL, 'save', 'save', 1 ); 315 ?> 316 <td> 317 <a class="toolbar" href="javascript:submitbutton('saveedit');" > 318 <?php echo $image;?></a> 319 </td> 320 <?php 321 } 322 323 /** 324 * Writes a cancel button and invokes a cancel operation (eg a checkin) 325 * @param string An override for the task 326 * @param string An override for the alt text 327 */ 328 function cancel( $task='cancel', $alt=_CMN_CANCEL ) { 329 $image = mosAdminMenus::ImageCheck( 'cancel_f2.png', '/images/', NULL, NULL, $alt, $task, 1, 'middle', $alt ); 330 ?> 331 <td> 332 <a class="toolbar" href="javascript:submitbutton('<?php echo $task;?>');" > 333 <?php echo $image;?></a> 334 </td> 335 <?php 336 } 337 338 /** 339 * Writes a cancel button that will go back to the previous page without doing 340 * any other operation 341 */ 342 function back() { 343 $image = mosAdminMenus::ImageCheck( 'back_f2.png', '/images/', NULL, NULL, 'back', 'cancel', 1 ); 344 ?> 345 <td> 346 <a class="toolbar" href="javascript:window.history.back();" > 347 <?php echo $image;?></a> 348 </td> 349 <?php 350 } 351 352 /** 353 * Write a divider between menu buttons 354 */ 355 function divider() { 356 $image = mosAdminMenus::ImageCheck( 'menu_divider.png', '/images/' ); 357 ?> 358 <td> 359 <?php echo $image; ?> 360 </td> 361 <?php 362 } 363 364 /** 365 * Writes a media_manager button 366 * @param string The sub-drectory to upload the media to 367 */ 368 function media_manager( $directory = '' ) { 369 $image = mosAdminMenus::ImageCheck( 'upload_f2.png', '/images/', NULL, NULL, 'Upload Image', 'uploadPic', 1 ); 370 ?> 371 <td> 372 <a class="toolbar" href="#" onclick="popupWindow('popups/uploadimage.php?directory=<?php echo $directory; ?>','win1',250,100,'no');"> 373 <?php echo $image; ?></a> 374 </td> 375 <?php 376 } 377 378 /** 379 * Writes a spacer cell 380 * @param string The width for the cell 381 */ 382 function spacer( $width='' ) { 383 if ($width != '') { 384 ?> 385 <td width="<?php echo $width;?>"> </td> 386 <?php 387 } else { 388 ?> 389 <td> </td> 390 <?php 391 } 392 } 393 394 /** 395 * Writes the end of the menu bar table 396 */ 397 function endTable() { 398 ?> 399 </tr> 400 </table> 401 <?php 402 } 403 } 404 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 14:43:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |