| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @author Mambo Foundation Inc see README.php 5 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 6 * See COPYRIGHT.php for copyright notices and details. 7 * @license GNU/GPL Version 2, see LICENSE.php 8 * 9 * Redistributions of files must retain the above copyright notice. 10 * 11 * Mambo is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation; version 2 of the License. 14 */ 15 16 /** 17 * Utility class for the button bar 18 */ 19 class mosToolBar { 20 21 /** 22 * Writes the start of the button bar table 23 */ 24 function startTable() { 25 ?> 26 <table cellpadding="0" cellspacing="0" border="0" width="99%"> 27 <tr> 28 <?php 29 } 30 31 /** 32 * Writes a custom option and task button for the button bar 33 * @param string The task to perform (picked up by the switch($task) blocks 34 * @param string The image to display 35 * @param string The image to display when moused over 36 * @param string The alt text for the icon image 37 * @param boolean True if required to check that a standard list item is checked 38 */ 39 function custom( $task='', $icon='', $iconOver='', $alt='', $listSelect=true ) { 40 if ($listSelect) { 41 $href = "javascript:if (document.adminForm.boxchecked.value == 0){ alert('".T_('Please make a selection from the list to') ." $alt');}else{submitbutton('$task')}"; 42 } else { 43 $href = "javascript:submitbutton('$task')"; 44 } 45 ?> 46 <td width="25" align="center"> 47 <a href="<?php echo $href;?>" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','images/<?php echo $iconOver;?>',1);"> 48 <img name="<?php echo $task;?>" src="images/<?php echo $icon;?>" alt="<?php echo $alt;?>" border="0" /> 49 </a> 50 </td> 51 <?php 52 } 53 54 /** 55 * Writes the common 'new' icon for the button bar 56 * @param string An override for the task 57 * @param string An override for the alt text 58 */ 59 function addNew( $task='new', $alt=null ) { 60 if (is_null($alt)) $alt = T_('New'); 61 62 $mainframe =& mosMainFrame::getInstance(); 63 $image = $mainframe->ImageCheck( 'new.png', '/images/', NULL, NULL, $alt, $task ); 64 $image2 = $mainframe->ImageCheck( 'new_f2.png', '/images/', NULL, NULL, $alt, $task, 0 ); 65 ?> 66 <td width="25" align="center"> 67 <a href="javascript:submitbutton('<?php echo $task;?>');" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','<?php echo $image2; ?>',1);"> 68 <?php echo $image; ?> 69 </a> 70 </td> 71 <?php 72 } 73 74 /** 75 * Writes a common 'publish' button 76 * @param string An override for the task 77 * @param string An override for the alt text 78 */ 79 function publish( $task='publish', $alt=null ) { 80 if (is_null($alt)) $alt = T_('Published'); 81 82 $mainframe =& mosMainFrame::getInstance(); 83 $image = $mainframe->ImageCheck( 'publish.png', '/images/', NULL, NULL, $alt, $task ); 84 $image2 = $mainframe->ImageCheck( 'publish_f2.png', '/images/', NULL, NULL, $alt, $task, 0 ); 85 ?> 86 <td width="25" align="center"> 87 <a href="javascript:submitbutton('<?php echo $task;?>');" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','<?php echo $image2; ?>',1);"> 88 <?php echo $image; ?> 89 </a> 90 </td> 91 <?php 92 } 93 94 /** 95 * Writes a common 'publish' button for a list of records 96 * @param string An override for the task 97 * @param string An override for the alt text 98 */ 99 function publishList( $task='publish', $alt=null ) { 100 if (is_null($alt)) $alt = T_('Published'); 101 102 $mainframe =& mosMainFrame::getInstance(); 103 $image = $mainframe->ImageCheck( 'publish.png', '/images/', NULL, NULL, $alt, $task ); 104 $image2 = $mainframe->ImageCheck( 'publish_f2.png', '/images/', NULL, NULL, $alt, $task, 0 ); 105 ?> 106 <td width="25" align="center"> 107 <a href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php echo T_('Please make a selection from the list to publish')?> '); } else {submitbutton('<?php echo $task;?>', '');}" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','<?php echo $image2; ?>',1);"> 108 <?php echo $image; ?> 109 </a> 110 </td> 111 <?php 112 } 113 114 /** 115 * Writes a common 'unpublish' button 116 * @param string An override for the task 117 * @param string An override for the alt text 118 */ 119 function unpublish( $task='unpublish', $alt=null ) { 120 if (is_null($alt)) $alt = T_('Unpublished'); 121 122 $mainframe =& mosMainFrame::getInstance(); 123 $image = $mainframe->ImageCheck( 'unpublish.png', '/images/', NULL, NULL, $alt, $task ); 124 $image2 = $mainframe->ImageCheck( 'unpublish_f2.png', '/images/', NULL, NULL, $alt, $task, 0 ); 125 ?> 126 <td width="25" align="center"> 127 <a href="javascript:submitbutton('<?php echo $task;?>');" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','<?php echo $image2; ?>',1);" > 128 <?php echo $image; ?> 129 </a> 130 </td> 131 <?php 132 } 133 134 /** 135 * Writes a common 'unpublish' button for a list of records 136 * @param string An override for the task 137 * @param string An override for the alt text 138 */ 139 function unpublishList( $task='unpublish', $alt=null ) { 140 if (is_null($alt)) $alt = T_('Unpublished'); 141 142 $mainframe =& mosMainFrame::getInstance(); 143 $image = $mainframe->ImageCheck( 'unpublish.png', '/images/', NULL, NULL, $alt, $task ); 144 $image2 = $mainframe->ImageCheck( 'unpublish_f2.png', '/images/', NULL, NULL, $alt, $task, 0 ); 145 ?> 146 <td width="25" align="center"> 147 <a href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php T_('Please make a selection from the list to unpublish') ?>'); } else {submitbutton('<?php echo $task;?>', '');}" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','<?php echo $image2; ?>',1);" > 148 <?php echo $image; ?> 149 </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=null ) { 160 if (is_null($alt)) $alt = T_('Archive'); 161 162 $mainframe =& mosMainFrame::getInstance(); 163 $image = $mainframe->ImageCheck( 'archive.png', '/images/', NULL, NULL, $alt, $task ); 164 $image2 = $mainframe->ImageCheck( 'archive_f2.png', '/images/', NULL, NULL, $alt, $task, 0 ); 165 ?> 166 <td width="25" align="center"> 167 <a href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php T_('Please make a selection from the list to archive') ?>'); } else {submitbutton('<?php echo $task;?>', '');}" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','<?php echo $image2; ?>',1);"> 168 <?php echo $image; ?> 169 </a> 170 </td> 171 <?php 172 } 173 174 /** 175 * Writes an unarchive button for a list of records 176 * @param string An override for the task 177 * @param string An override for the alt text 178 */ 179 function unarchiveList( $task='unarchive', $alt=null ) { 180 if (is_null($alt)) $alt = T_('Unarchive'); 181 182 $mainframe =& mosMainFrame::getInstance(); 183 $image = $mainframe->ImageCheck( 'unarchive.png', '/images/', NULL, NULL, $alt, $task ); 184 $image2 = $mainframe->ImageCheck( 'unarchive_f2.png', '/images/', NULL, NULL, $alt, $task, 0 ); 185 ?> 186 <td width="25" align="center"> 187 <a href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php T_('Please select a news story to unarchive') ?>'); } else {submitbutton('<?php echo $task;?>', '');}" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','<?php echo $image2; ?>',1);"> 188 <?php echo $image; ?> 189 </a> 190 </td> 191 <?php 192 } 193 194 /** 195 * Writes a common 'edit' button for a list of records 196 * @param string An override for the task 197 * @param string An override for the alt text 198 */ 199 function editList( $task='edit', $alt=null ) { 200 if (is_null($alt)) $alt = T_('Edit'); 201 202 $mainframe =& mosMainFrame::getInstance(); 203 $image = $mainframe->ImageCheck( 'html.png', '/images/', NULL, NULL, $alt, $task ); 204 $image2 = $mainframe->ImageCheck( 'html_f2.png', '/images/', NULL, NULL, $alt, $task, 0 ); 205 ?> 206 <td width="25" align="center"> 207 <a href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php T_('Please select an item from the list to edit') ?>'); } else {submitbutton('<?php echo $task;?>', '');}" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','<?php echo $image2; ?>',1);"> 208 <?php echo $image; ?> 209 </a> 210 </td> 211 <?php 212 } 213 214 /** 215 * Writes a common 'edit' button for a template html 216 * @param string An override for the task 217 * @param string An override for the alt text 218 */ 219 function editHtml( $task='edit_source', $alt=null ) { 220 if (is_null($alt)) $alt = T_('Edit HTML'); 221 $mainframe =& mosMainFrame::getInstance(); 222 $image = $mainframe->ImageCheck( 'html.png', '/images/', NULL, NULL, $alt, $task ); 223 $image2 = $mainframe->ImageCheck( 'html_f2.png', '/images/', NULL, NULL, $alt, $task, 0 ); 224 ?> 225 <td width="25" align="center"> 226 <a href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php T_('Please select an item from the list to edit') ?>'); } else {submitbutton('<?php echo $task;?>', '');}" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','<?php echo $image2; ?>',1);"> 227 <?php echo $image; ?> 228 </a> 229 </td> 230 <?php 231 } 232 233 /** 234 * Writes a common 'edit' button for a template css 235 * @param string An override for the task 236 * @param string An override for the alt text 237 */ 238 function editCss( $task='edit_css', $alt=null ) { 239 if (is_null($alt)) $alt = T_('Edit CSS'); 240 $mainframe =& mosMainFrame::getInstance(); 241 $image = $mainframe->ImageCheck( 'css.png', '/images/', NULL, NULL, $alt, $task ); 242 $image2 = $mainframe->ImageCheck( 'css_f2.png', '/images/', NULL, NULL, $alt, $task, 0 ); 243 ?> 244 <td width="25" align="center"> 245 <a href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php T_('Please select an item from the list to edit') ?>'); } else {submitbutton('<?php echo $task;?>', '');}" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','<?php echo $image2; ?>',1);"> 246 <?php echo $image; ?> 247 </a> 248 </td> 249 <?php 250 } 251 252 /** 253 * Writes a common 'delete' button for a list of records 254 * @param string Postscript for the 'are you sure' message 255 * @param string An override for the task 256 * @param string An override for the alt text 257 */ 258 function deleteList( $msg='', $task='remove', $alt=null ) { 259 if (is_null($alt)) $alt = T_('Delete'); 260 261 $mainframe =& mosMainFrame::getInstance(); 262 $image = $mainframe->ImageCheck( 'delete.png', '/images/', NULL, NULL, $alt, $task ); 263 $image2 = $mainframe->ImageCheck( 'delete_f2.png', '/images/', NULL, NULL, $alt, $task, 0 ); 264 ?> 265 <td width="25" align="center"> 266 <a href="javascript:if (document.adminForm.boxchecked.value == 0){ alert('<?php T_('Please make a selection from the list to delete') ?>'); } else if (confirm('<?php T_('Are you sure you want to delete selected items?') ?> <?php echo $msg;?>')){ submitbutton('<?php echo $task;?>');}" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','<?php echo $image2; ?>',1);"> 267 <?php echo $image; ?> 268 </a> 269 </td> 270 <?php 271 } 272 273 /** 274 * Writes a preview button for a given option (opens a popup window) 275 * @param string The name of the popup file (excluding the file extension) 276 */ 277 function preview( $popup='' ) { 278 global $database; 279 $sql = "SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='0'"; 280 $database->setQuery( $sql ); 281 $cur_template = $database->loadResult(); 282 $mainframe =& mosMainFrame::getInstance(); 283 $image = $mainframe->ImageCheck( 'preview.png', 'images/', NULL, NULL, T_('Preview'), 'preview' ); 284 $image2 = $mainframe->ImageCheck( 'preview_f2.png', 'images/', NULL, NULL, T_('Preview'), 'preview', 0 ); 285 ?> 286 <td width="25" align="center"> 287 <a 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');" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('preview','','<?php echo $image2; ?>',1);"> 288 <?php echo $image; ?> 289 </a> 290 </td> 291 <?php 292 } 293 294 /** 295 * Writes a save button for a given option 296 * @param string An override for the task 297 * @param string An override for the alt text 298 */ 299 function save( $task='save', $alt=null ) { 300 if (is_null($alt)) $alt = T_('Save'); 301 302 $mainframe =& mosMainFrame::getInstance(); 303 $image = $mainframe->ImageCheck( 'save.png', '/images/', NULL, NULL, $alt, $task ); 304 $image2 = $mainframe->ImageCheck( 'save_f2.png', '/images/', NULL, NULL, $alt, $task, 0 ); 305 ?> 306 <td width="25" align="center"> 307 <a href="javascript:submitbutton('<?php echo $task;?>');" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','<?php echo $image2;?>',1);"> 308 <?php echo $image;?> 309 </a> 310 </td> 311 <?php 312 } 313 314 /** 315 * Writes a save button for a given option (NOTE this is being deprecated) 316 */ 317 function savenew() { 318 $mainframe =& mosMainFrame::getInstance(); 319 $image = $mainframe->ImageCheck( 'save.png', '/images/', NULL, NULL, T_('save'), 'save' ); 320 $image2 = $mainframe->ImageCheck( 'save_f2.png', '/images/', NULL, NULL, T_('save'), 'save', 0 ); 321 ?> 322 <td width="25" align="center"> 323 <a href="javascript:submitbutton('savenew');" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('save','','<?php echo $image2;?>',1);"> 324 <?php echo $image;?> 325 </a> 326 </td> 327 <?php 328 } 329 330 /** 331 * Writes a save button for a given option (NOTE this is being deprecated) 332 */ 333 function saveedit() { 334 $mainframe =& mosMainFrame::getInstance(); 335 $image = $mainframe->ImageCheck( 'save.png', '/images/', NULL, NULL, T_('save'), 'save' ); 336 $image2 = $mainframe->ImageCheck( 'save_f2.png', '/images/', NULL, NULL, T_('save'), 'save', 0 ); 337 ?> 338 <td width="25" align="center"> 339 <a href="javascript:submitbutton('saveedit');" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('save','','<?php echo $image2;?>',1);"> 340 <?php echo $image;?> 341 </a> 342 </td> 343 <?php 344 } 345 346 /** 347 * Writes a cancel button and invokes a cancel operation (eg a checkin) 348 * @param string An override for the task 349 * @param string An override for the alt text 350 */ 351 function cancel( $task='cancel', $alt=null ) { 352 if (is_null($alt)) $alt = T_('Cancel'); 353 354 $mainframe =& mosMainFrame::getInstance(); 355 $image = $mainframe->ImageCheck( 'cancel.png', '/images/', NULL, NULL, $alt, $task ); 356 $image2 = $mainframe->ImageCheck( 'cancel_f2.png', '/images/', NULL, NULL, $alt, $task, 0 ); 357 ?> 358 <td width="25" align="center"> 359 <a href="javascript:submitbutton('<?php echo $task;?>');" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('<?php echo $task;?>','','<?php echo $image2;?>',1);"> 360 <?php echo $image;?> 361 </a> 362 </td> 363 <?php 364 } 365 366 /** 367 * Writes a cancel button that will go back to the previous page without doing 368 * any other operation 369 */ 370 function back() { 371 $mainframe =& mosMainFrame::getInstance(); 372 $image = $mainframe->ImageCheck( 'back.png', '/images/', NULL, NULL, T_('back'), 'cancel' ); 373 $image2 = $mainframe->ImageCheck( 'back_f2.png', '/images/', NULL, NULL, T_('back'), 'cancel', 0 ); 374 ?> 375 <td width="25" align="center"> 376 <a href="javascript:window.history.back();" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('cancel','','images/<?php echo $image2;?>',1);"> 377 <?php echo $image;?> 378 </a> 379 </td> 380 <?php 381 } 382 383 /** 384 * Write a divider between menu buttons 385 */ 386 function divider() { 387 $image = $mainframe->ImageCheck( 'menu_divider.png', '/images/' ); 388 ?> 389 <td width="25" align="center"> 390 <?php echo $image; ?> 391 </td> 392 <?php 393 } 394 395 /** 396 * Writes a media_manager button 397 * @param string The sub-drectory to upload the media to 398 */ 399 function media_manager( $directory = '' ) { 400 $mainframe =& mosMainFrame::getInstance(); 401 $image = $mainframe->ImageCheck( 'upload.png', '/images/', NULL, NULL, T_('Upload Image'), 'uploadPic' ); 402 $image2 = $mainframe->ImageCheck( 'upload_f2.png', '/images/', NULL, NULL, T_('Upload Image'), 'uploadPic', 0 ); 403 ?> 404 <td width="25" align="center"> 405 <a href="#" onclick="popupWindow('popups/uploadimage.php?directory=<?php echo $directory; ?>','win1',250,100,'no');" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('uploadPic','','<?php echo $image2; ?>',1);"> 406 <?php echo $image; ?> 407 </a> 408 </td> 409 <?php 410 } 411 412 /** 413 * Writes a spacer cell 414 * @param string The width for the cell 415 */ 416 function spacer( $width='' ) 417 { 418 if ($width != '') { 419 ?> 420 <td width="<?php echo $width;?>"> </td> 421 <?php 422 } else { 423 ?> 424 <td> </td> 425 <?php 426 } 427 } 428 429 /** 430 * Writes the end of the menu bar table 431 */ 432 function endTable() { 433 ?> 434 </tr> 435 </table> 436 <?php 437 } 438 } 439 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |