mosCommonHTML.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /*******************************************************************************
00004  * Aliro - the modern, accessible content management system
00005  *
00006  * Aliro is open source software, free to use, and licensed under GPL.
00007  * You can find the full licence at http://www.gnu.org/copyleft/gpl.html GNU/GPL
00008  *
00009  * The author freely draws attention to the fact that Aliro derives from Mambo,
00010  * software that is controlled by the Mambo Foundation.  However, this section
00011  * of code is totally new.  If it should contain any fragments that are similar
00012  * to Mambo, please bear in mind (1) there are only so many ways to do things
00013  * and (2) the author of Aliro is also the author and copyright owner for large
00014  * parts of Mambo 4.6.
00015  *
00016  * Tribute should be paid to all the developers who took Mambo to the stage
00017  * it had reached at the time Aliro was created.  It is a feature rich system
00018  * that contains a good deal of innovation.
00019  *
00020  * Your attention is also drawn to the fact that Aliro relies on other items of
00021  * open source software, which is very much in the spirit of open source.  Aliro
00022  * wishes to give credit to those items of code.  Please refer to
00023  * http://aliro.org/credits for details.  The credits are not included within
00024  * the Aliro package simply to avoid providing a marker that allows hackers to
00025  * identify the system.
00026  *
00027  * Copyright in this code is strictly reserved by its author, Martin Brampton.
00028  * If it seems appropriate, the copyright will be vested in the Aliro Organisation
00029  * at a suitable time.
00030  *
00031  * Copyright (c) 2007 Martin Brampton
00032  *
00033  * http://aliro.org
00034  *
00035  * counterpoint@aliro.org
00036  *
00037  * mosCommonHTML is largely unchanged from Mambo 4.6.x and most methods here are
00038  * deprecated.  The first few are available from aliroHTML, and the remainder
00039  * seem insuffiently general to be part of the core.
00040  *
00041  */
00042 
00043 class mosCommonHTML {
00044 
00045 
00046     static function mosFormatDate ($date, $format="", $offset="") {
00047         return aliroHTML::getInstance()->formatDate ($date, $format, $offset);
00048     }
00049 
00050     /*
00051     * Loads all necessary files for JS Overlib tooltips
00052     */
00053     static function loadOverlib() {
00054         aliroRequest::getInstance()->requestOverlib();
00055     }
00056 
00057     static function CheckedOutProcessing ($row, $i) {
00058         return aliroHTML::getInstance()->checkedOutProcessing ($row, $i);
00059     }
00060 
00061     static function PublishedProcessing ($row, $i) {
00062         return aliroHTML::getInstance()->publishedProcessing ($row, $i);
00063     }
00064 
00065     /*
00066     * Loads all necessary files for JS Calendar
00067     */
00068     static function loadCalendar() {
00069         aliroHTML::getInstance()->loadCalendar();
00070     }
00071 
00072     /****************************************************************************
00073     *
00074     * The following are deprecated - use similar non-static methods in aliroHTML
00075     * or consider writing your own code for the long routines that seem presently
00076     * to be the preserve of content related components and not sufficiently general
00077     * to warrant inclusion in the core.
00078     *
00079     */
00080 
00081     static function checkedOut( &$row, $overlib=1 ) {
00082         $hover = '';
00083         if ( $overlib ) {
00084             $date               = mosCommonHTML::mosFormatDate( $row->checked_out_time, '%A, %d %B %Y' );
00085             $time               = mosCommonHTML::mosFormatDate( $row->checked_out_time, '%H:%M' );
00086             $checked_out_text   = '<table>';
00087             $checked_out_text   .= '<tr><td>'. $row->editor .'</td></tr>';
00088             $checked_out_text   .= '<tr><td>'. $date .'</td></tr>';
00089             $checked_out_text   .= '<tr><td>'. $time .'</td></tr>';
00090             $checked_out_text   .= '</table>';
00091             $hover = 'onmouseover="return overlib(\''. $checked_out_text .'\', CAPTION, \'Checked Out\', BELOW, RIGHT);" onMouseOut="return nd();"';
00092         }
00093         $checked            = '<img src="images/checked_out.png" '. $hover .'/>';
00094 
00095         return $checked;
00096     }
00097 
00098     static function ContentLegend( ) {
00099         ?>
00100         <table cellspacing="0" cellpadding="4" border="0" align="center">
00101         <tr align="center">
00102             <td>
00103             <img src="images/publish_y.png" width="12" height="12" border="0" alt="Pending" />
00104             </td>
00105             <td>
00106             Published, but is <u>Pending</u> |
00107             </td>
00108             <td>
00109             <img src="images/publish_g.png" width="12" height="12" border="0" alt="Visible" />
00110             </td>
00111             <td>
00112             Published and is <u>Current</u> |
00113             </td>
00114             <td>
00115             <img src="images/publish_r.png" width="12" height="12" border="0" alt="Finished" />
00116             </td>
00117             <td>
00118             Published, but has <u>Expired</u> |
00119             </td>
00120             <td>
00121             <img src="images/publish_x.png" width="12" height="12" border="0" alt="Finished" />
00122             </td>
00123             <td>
00124             Not Published
00125             </td>
00126         </tr>
00127         <tr>
00128             <td colspan="8" align="center">
00129             Click on icon to toggle state.
00130             </td>
00131         </tr>
00132         </table>
00133         <?php
00134     }
00135 
00136     static function menuLinksContent( &$menus ) {
00137         ?>
00138         <script language="javascript" type="text/javascript">
00139         static function go2( pressbutton, menu, id ) {
00140             var form = document.adminForm;
00141 
00142             if (pressbutton == 'go2menu') {
00143                 form.menu.value = menu;
00144                 submitform( pressbutton );
00145                 return;
00146             }
00147 
00148             if (pressbutton == 'go2menuitem') {
00149                 form.menu.value     = menu;
00150                 form.menuid.value   = id;
00151                 submitform( pressbutton );
00152                 return;
00153             }
00154         }
00155         </script>
00156         <?php
00157         foreach( $menus as $menu ) {
00158             ?>
00159             <tr>
00160                 <td colspan="2">
00161                 <hr />
00162                 </td>
00163             </tr>
00164             <tr>
00165                 <td width="90px" valign="top">
00166                 Menu
00167                 </td>
00168                 <td>
00169                 <a href="javascript:go2( 'go2menu', '<?php echo $menu->menutype; ?>' );" title="Go to Menu">
00170                 <?php echo $menu->menutype; ?>
00171                 </a>
00172                 </td>
00173             </tr>
00174             <tr>
00175                 <td width="90px" valign="top">
00176                 Link Name
00177                 </td>
00178                 <td>
00179                 <strong>
00180                 <a href="javascript:go2( 'go2menuitem', '<?php echo $menu->menutype; ?>', '<?php echo $menu->id; ?>' );" title="Go to Menu Item">
00181                 <?php echo $menu->name; ?>
00182                 </a>
00183                 </strong>
00184                 </td>
00185             </tr>
00186             <tr>
00187                 <td width="90px" valign="top">
00188                 State
00189                 </td>
00190                 <td>
00191                 <?php
00192                 switch ( $menu->published ) {
00193                     case -2:
00194                         echo '<font color="red">Trashed</font>';
00195                         break;
00196                     case 0:
00197                         echo 'UnPublished';
00198                         break;
00199                     case 1:
00200                     default:
00201                         echo '<font color="green">Published</font>';
00202                         break;
00203                 }
00204                 ?>
00205                 </td>
00206             </tr>
00207             <?php
00208         }
00209         ?>
00210         <input type="hidden" name="menu" value="" />
00211         <input type="hidden" name="menuid" value="" />
00212         <?php
00213     }
00214 
00215     static function menuLinksSecCat( &$menus ) {
00216         ?>
00217         <script language="javascript" type="text/javascript">
00218         static function go2( pressbutton, menu, id ) {
00219             var form = document.adminForm;
00220 
00221             if (pressbutton == 'go2menu') {
00222                 form.menu.value = menu;
00223                 submitform( pressbutton );
00224                 return;
00225             }
00226 
00227             if (pressbutton == 'go2menuitem') {
00228                 form.menu.value     = menu;
00229                 form.menuid.value   = id;
00230                 submitform( pressbutton );
00231                 return;
00232             }
00233         }
00234         </script>
00235         <?php
00236         foreach( $menus as $menu ) {
00237             ?>
00238             <tr>
00239                 <td colspan="2">
00240                 <hr/>
00241                 </td>
00242             </tr>
00243             <tr>
00244                 <td width="90px" valign="top">
00245                 Menu
00246                 </td>
00247                 <td>
00248                 <a href="javascript:go2( 'go2menu', '<?php echo $menu->menutype; ?>' );" title="Go to Menu">
00249                 <?php echo $menu->menutype; ?>
00250                 </a>
00251                 </td>
00252             </tr>
00253             <tr>
00254                 <td width="90px" valign="top">
00255                 Type
00256                 </td>
00257                 <td>
00258                 <?php echo $menu->type; ?>
00259                 </td>
00260             </tr>
00261             <tr>
00262                 <td width="90px" valign="top">
00263                 Item Name
00264                 </td>
00265                 <td>
00266                 <strong>
00267                 <a href="javascript:go2( 'go2menuitem', '<?php echo $menu->menutype; ?>', '<?php echo $menu->id; ?>' );" title="Go to Menu Item">
00268                 <?php echo $menu->name; ?>
00269                 </a>
00270                 </strong>
00271                 </td>
00272             </tr>
00273             <tr>
00274                 <td width="90px" valign="top">
00275                 State
00276                 </td>
00277                 <td>
00278                 <?php
00279                 switch ( $menu->published ) {
00280                     case -2:
00281                         echo '<font color="red">Trashed</font>';
00282                         break;
00283                     case 0:
00284                         echo 'UnPublished';
00285                         break;
00286                     case 1:
00287                     default:
00288                         echo '<font color="green">Published</font>';
00289                         break;
00290                 }
00291                 ?>
00292                 </td>
00293             </tr>
00294             <?php
00295         }
00296         ?>
00297         <input type="hidden" name="menu" value="" />
00298         <input type="hidden" name="menuid" value="" />
00299         <?php
00300     }
00301 
00302     static function AccessProcessing( &$row, $i ) {
00303         if ( !$row->access ) {
00304             $color_access = 'style="color: green;"';
00305             $task_access = 'accessregistered';
00306         } else if ( $row->access == 1 ) {
00307             $color_access = 'style="color: red;"';
00308             $task_access = 'accessspecial';
00309         } else {
00310             $color_access = 'style="color: black;"';
00311             $task_access = 'accesspublic';
00312         }
00313 
00314         $href = '
00315         <a href="javascript: void(0);" onclick="return listItemTask(\'cb'. $i .'\',\''. $task_access .'\')" '. $color_access .'>
00316         '. $row->groupname .'
00317         </a>'
00318         ;
00319 
00320         return $href;
00321     }
00322 
00323 }

Generated on Wed May 14 13:01:56 2008 for ALIRO by  doxygen 1.5.5