Source for file HTML_toolbar.php

Documentation is available at HTML_toolbar.php

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

Documentation generated on Mon, 05 May 2008 16:20:16 +0400 by phpDocumentor 1.4.0