Source for file mamboHTML.php

Documentation is available at mamboHTML.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 all HTML drawing classes
  17. */
  18.  
  19. class mosHTML {
  20.  
  21.     function makeOption$value$text='' {
  22.         $obj new stdClass;
  23.         $obj->value $value;
  24.         $obj->text trim$text $text $value;
  25.         return $obj;
  26.     }
  27.  
  28.     function writableCell$folder {
  29.          echo '<tr>';
  30.           echo '<td class="item">' $folder '/</td>';
  31.           echo '<td align="left">';
  32.           echo is_writable"../$folder'<b><span class="green">'.T_('Writeable').'</span></b>' '<b><span class="red">'.T_('Unwriteable').'</span></b>' '</td>';
  33.           echo '</tr>';
  34.     }
  35.  
  36.     /**
  37.     * Generates an HTML select list
  38.     * @param array An array of objects
  39.     * @param string The value of the HTML name attribute
  40.     * @param string Additional HTML attributes for the <select> tag
  41.     * @param string The name of the object variable for the option value
  42.     * @param string The name of the object variable for the option text
  43.     * @param mixed The key that is selected
  44.     * @returns string HTML for the select list
  45.     */
  46.     function selectList &$arr$tag_name$tag_attribs$key$text$selected=NULL {
  47.         if (is_array($arr)){
  48.           reset$arr );
  49.         }
  50.         $html "\n<select name=\"$tag_name\" $tag_attribs>";
  51.         for ($i=0$n=count$arr )$i $n$i++ {
  52.             $k $arr[$i]->$key;
  53.             $t $arr[$i]->$text;
  54.             $id = isset($arr[$i]->id$arr[$i]->id null;
  55.  
  56.             $extra '';
  57.             $extra .= $id " id=\"" $arr[$i]->id "\"" '';
  58.             if (is_array$selected )) {
  59.                 foreach ($selected as $obj{
  60.                     $k2 $obj->$key;
  61.                     if ($k == $k2{
  62.                         $extra .= " selected=\"selected\"";
  63.                         break;
  64.                     }
  65.                 }
  66.             else {
  67.                 $extra .= ($k == $selected " selected=\"selected\"" '');
  68.             }
  69.             $html .= "\n\t<option value=\"".$k."\"$extra>$t "</option>";
  70.         }
  71.         $html .= "\n</select>\n";
  72.         return $html;
  73.     }
  74.  
  75.     /**
  76.     * Writes a select list of integers
  77.     * @param int The start integer
  78.     * @param int The end integer
  79.     * @param int The increment
  80.     * @param string The value of the HTML name attribute
  81.     * @param string Additional HTML attributes for the <select> tag
  82.     * @param mixed The key that is selected
  83.     * @param string The printf format to be applied to the number
  84.     * @returns string HTML for the select list
  85.     */
  86.     function integerSelectList$start$end$inc$tag_name$tag_attribs$selected$format="" {
  87.         $start intval$start );
  88.         $end intval$end );
  89.         $inc intval$inc );
  90.         $arr array();
  91.         for ($i=$start$i <= $end$i+=$inc{
  92.             $fi $format sprintf"$format"$i "$i";
  93.             $arr[mosHTML::makeOption$fi$fi );
  94.         }
  95.  
  96.         return mosHTML::selectList$arr$tag_name$tag_attribs'value''text'$selected );
  97.     }
  98.  
  99.     /**
  100.     * Writes a select list of month names based on Language settings
  101.     * @param string The value of the HTML name attribute
  102.     * @param string Additional HTML attributes for the <select> tag
  103.     * @param mixed The key that is selected
  104.     * @returns string HTML for the select list values
  105.     */
  106.     function monthSelectList$tag_name$tag_attribs$selected {
  107.         $arr array(
  108.         mosHTML::makeOption'01'T_('January') ),
  109.         mosHTML::makeOption'02'T_('February') ),
  110.         mosHTML::makeOption'03'T_('March') ),
  111.         mosHTML::makeOption'04'T_('April') ),
  112.         mosHTML::makeOption'05'T_('May') ),
  113.         mosHTML::makeOption'06'T_('June') ),
  114.         mosHTML::makeOption'07'T_('July') ),
  115.         mosHTML::makeOption'08'T_('August') ),
  116.         mosHTML::makeOption'09'T_('September') ),
  117.         mosHTML::makeOption'10'T_('October') ),
  118.         mosHTML::makeOption'11'T_('November') ),
  119.         mosHTML::makeOption'12'T_('December') )
  120.         );
  121.  
  122.         return mosHTML::selectList$arr$tag_name$tag_attribs'value''text'$selected );
  123.     }
  124.  
  125.     /**
  126.     * Writes a yes/no select list
  127.     * @param string The value of the HTML name attribute
  128.     * @param string Additional HTML attributes for the <select> tag
  129.     * @param mixed The key that is selected
  130.     * @returns string HTML for the select list values
  131.     */
  132.     function yesnoSelectList$tag_name$tag_attribs$selected$yes=false$no=false {
  133.         $arr array(
  134.         mosHTML::makeOption'0'$no  $no  T_('No') ),
  135.         mosHTML::makeOption'1'$yes $yes T_('Yes') ),
  136.         );
  137.  
  138.         return mosHTML::selectList$arr$tag_name$tag_attribs'value''text'$selected );
  139.     }
  140.  
  141.     /**
  142.     * Generates an HTML radio list
  143.     * @param array An array of objects
  144.     * @param string The value of the HTML name attribute
  145.     * @param string Additional HTML attributes for the <select> tag
  146.     * @param mixed The key that is selected
  147.     * @param string The name of the object variable for the option value
  148.     * @param string The name of the object variable for the option text
  149.     * @returns string HTML for the select list
  150.     */
  151.     function radioList&$arr$tag_name$tag_attribs$selected=null$key='value'$text='text' {
  152.         reset$arr );
  153.         $html "";
  154.         foreach ($arr as $choice{
  155.             $id @$choice->id;
  156.             $extra $id " id=\"" $choice->id "\"" '';
  157.             if (is_array$selected )) {
  158.                 foreach ($selected as $obj{
  159.                     if ($choice->$key == $obj->$key{
  160.                         $extra .= ' selected="selected"';
  161.                         break;
  162.                     }
  163.                 }
  164.             else {
  165.                 $extra .= ($choice->$key == $selected " checked=\"checked\"" '');
  166.             }
  167.             $html .= "\n\t<input type=\"radio\" name=\"$tag_name\" value=\"".$choice->$key."\"$extra $tag_attribs />$choice->$text;
  168.         }
  169.         $html .= "\n";
  170.         return $html;
  171.     }
  172.  
  173.     /**
  174.     * Writes a yes/no radio list
  175.     * @param string The value of the HTML name attribute
  176.     * @param string Additional HTML attributes for the <select> tag
  177.     * @param mixed The key that is selected
  178.     * @returns string HTML for the radio list
  179.     */
  180.     function yesnoRadioList$tag_name$tag_attribs$selected$yes=false$no=false {
  181.  
  182.         $arr array(
  183.         mosHTML::makeOption'0'$no  $no  T_('No') ),
  184.         mosHTML::makeOption'1'$yes $yes T_('Yes') )
  185.         );
  186.         return mosHTML::radioList$arr$tag_name$tag_attribs$selected );
  187.     }
  188.  
  189.     /**
  190.     * @param int The row index
  191.     * @param int The record id
  192.     * @param boolean 
  193.     * @param string The name of the form element
  194.     * @return string 
  195.     */
  196.     function idBox$rowNum$recId$checkedOut=false$name='cid' {
  197.         if $checkedOut {
  198.             return '';
  199.         else {
  200.             return '<input type="checkbox" id="cb'.$rowNum.'" name="'.$name.'[]" value="'.$recId.'" onclick="isChecked(this.checked);" />';
  201.         }
  202.     }
  203.  
  204.     function sortIcon$base_href$field$state='none' {
  205.         $mosConfig_live_site mamboCore::get('mosConfig_live_site');
  206.         $alts array(
  207.         'none' => T_('No Sorting'),
  208.         'asc' => T_('Sort Ascending'),
  209.         'desc' => T_('Sort Descending'),
  210.         );
  211.         $next_state 'asc';
  212.         if ($state == 'asc'{
  213.             $next_state 'desc';
  214.         else if ($state == 'desc'{
  215.             $next_state 'none';
  216.         }
  217.  
  218.         $html "<a href=\"$base_href&field=$field&order=$next_state\">"
  219.         . "<img src=\"$mosConfig_live_site/images/M_images/sort_$state.png\" width=\"12\" height=\"12\" border=\"0\" alt=\"{$alts[$next_state]}\" />"
  220.         . "</a>";
  221.         return $html;
  222.     }
  223.  
  224.     /**
  225.     * Writes Close Button
  226.     */
  227.     function CloseButton &$params$hide_js=NULL {
  228.         // displays close button in Pop-up window
  229.         if $params->get'popup' && !$hide_js {
  230.             ?>
  231.             <div align="center" style="margin-top: 30px; margin-bottom: 30px;">
  232.             <a href='javascript:window.close();'>
  233.             <span class="small">
  234.             <?php echo T_('Close Window');?>
  235.             </span>
  236.             </a>
  237.             </div>
  238.             <?php
  239.         }
  240.     }
  241.  
  242.     /**
  243.     * Writes Back Button
  244.     */
  245.     function BackButton &$params$hide_js=NULL {
  246.         // Back Button
  247.         if $params->get'back_button' && !$params->get'popup' && !$hide_js{
  248.             ?>
  249.             <div class="back_button">
  250.             <a href='javascript:history.go(-1)'>
  251.             <?php echo T_('Back')?>
  252.             </a>
  253.             </div>
  254.             <?php
  255.         }
  256.     }
  257.  
  258.     /**
  259.     * Cleans text of all formating and scripting code
  260.     */
  261.     function cleanText &$text {
  262.         $text preg_replace"'<script[^>]*>.*?</script>'si"''$text );
  263.         $text preg_replace'/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is''\2 (\1)'$text );
  264.         $text preg_replace'/<!--.+?-->/'''$text );
  265.         $text preg_replace'/{.+?}/'''$text );
  266.         $text preg_replace'/&nbsp;/'' '$text );
  267.         $text preg_replace'/&amp;/'' '$text );
  268.         $text preg_replace'/&quot;/'' '$text );
  269.         $text strip_tags$text );
  270.         $text htmlspecialchars$text );
  271.         return $text;
  272.     }
  273.  
  274.     /**
  275.     * Writes Print icon
  276.     */
  277.     function PrintIcon&$row&$params$hide_js$link$status=NULL {
  278.         if $params->get'print' )  && !$hide_js {
  279.             // use default settings if none declared
  280.             if !$status {
  281.                 $status 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
  282.             }
  283.  
  284.             // checks template image directory for image, if non found default are loaded
  285.             if $params->get'icons' ) ) {
  286.                 $mainframe =mosMainFrame::getInstance();
  287.                 $image $mainframe->ImageCheck'printButton.png''/images/M_images/'NULLNULLT_('Print'));
  288.             else {
  289.                 $image _ICON_SEP .'&nbsp;'T_('Print')'&nbsp;'_ICON_SEP;
  290.             }
  291.  
  292.             if $params->get'popup' && !$hide_js {
  293.                 // Print Preview button - used when viewing page
  294.                 ?>
  295.                 <td align="right" class="buttonheading">
  296.                 <a href="#" onclick="javascript:window.print(); return false" title="<?php echo T_('Print');?>">
  297.                 <?php echo $image;?>
  298.                 </a>
  299.                 </td>
  300.                 <?php
  301.             else {
  302.                 // Print Button - used in pop-up window
  303.                 ?>
  304.                 <td align="right" class="buttonheading">
  305.                 <a href="javascript:void window.open('<?php echo $link?>', 'win2', '<?php echo $status?>');" title="<?php echo T_('Print');?>">
  306.                 <?php echo $image;?>
  307.                 </a>
  308.                 </td>
  309.                 <?php
  310.             }
  311.         }
  312.     }
  313.  
  314.     /**
  315.     * simple Javascript Cloaking
  316.     * email cloacking
  317.      * by default replaces an email with a mailto link with email cloacked
  318.     */
  319.     function emailCloaking$mail$mailto=1$text=''$email={
  320.         // convert text
  321.         $mail         mosHTML::encoding_converter$mail );
  322.         // split email by @ symbol
  323.         $mail        explode'@'$mail );
  324.         $mail_parts    explode'.'$mail[1);
  325.         // random number
  326.         $rand    rand1100000 );
  327.  
  328.         $replacement     "\n<script language='JavaScript' type='text/javascript'> \n";
  329.         $replacement     .= "<!-- \n";
  330.         $replacement     .= "var prefix = '&#109;a' + 'i&#108;' + '&#116;o'; \n";
  331.         $replacement     .= "var path = 'hr' + 'ef' + '='; \n";
  332.         $replacement     .= "var addy"$rand ." = '"@$mail[0."' + '&#64;' + '"implode"' + '&#46;' + '"$mail_parts ."'; \n";
  333.         if $mailto {
  334.             // special handling when mail text is different from mail addy
  335.             if $text {
  336.                 if $email {
  337.                     // convert text
  338.                     $text     mosHTML::encoding_converter$text );
  339.                     // split email by @ symbol
  340.                     $text     explode'@'$text );
  341.                     $text_parts    explode'.'$text[1);
  342.                     $replacement     .= "var addy_text"$rand ." = '"@$text[0."' + '&#64;' + '"implode"' + '&#46;' + '"@$text_parts ."'; \n";
  343.                 else {
  344.                     $text     mosHTML::encoding_converter$text );
  345.                     $replacement     .= "var addy_text"$rand ." = '"$text ."';\n";
  346.                 }
  347.                 $replacement     .= "document.write( '<a ' + path + '\'' + prefix + ':' + addy"$rand ." + '\'>' ); \n";
  348.                 $replacement     .= "document.write( addy_text"$rand ." ); \n";
  349.                 $replacement     .= "document.write( '<\/a>' ); \n";
  350.             else {
  351.                 $replacement     .= "document.write( '<a ' + path + '\'' + prefix + ':' + addy"$rand ." + '\'>' ); \n";
  352.                 $replacement     .= "document.write( addy"$rand ." ); \n";
  353.                 $replacement     .= "document.write( '<\/a>' ); \n";
  354.             }
  355.         else {
  356.             $replacement     .= "document.write( addy"$rand ." ); \n";
  357.         }
  358.         $replacement     .= "//--> \n";
  359.         $replacement     .= "</script> \n";
  360.         $replacement     .= "<noscript> \n";
  361.         $replacement     .= T_('This email address is being protected from spam bots, you need Javascript enabled to view it');
  362.         $replacement     .= "\n</noscript> \n";
  363.  
  364.         return $replacement;
  365.     }
  366.  
  367.     function encoding_converter$text {
  368.         // replace vowels with character encoding
  369.         $text     str_replace'a''&#97;'$text );
  370.         $text     str_replace'e''&#101;'$text );
  371.         $text     str_replace'i''&#105;'$text );
  372.         $text     str_replace'o''&#111;'$text );
  373.         $text    str_replace'u''&#117;'$text );
  374.  
  375.         return $text;
  376.     }
  377. }
  378.  
  379. class mosCommonHTML {
  380.  
  381.     function ContentLegend{
  382.         ?>
  383.         <table cellspacing="0" cellpadding="4" border="0" align="center">
  384.         <tr align="center">
  385.             <td>
  386.             <img src="images/publish_y.png" width="12" height="12" border="0" alt="<?php echo T_('Pending'?>" />
  387.             </td>
  388.             <td>
  389.             <?php echo T_('Published, but is <u>Pending</u>'?> |
  390.             </td>
  391.             <td>
  392.             <img src="images/publish_g.png" width="12" height="12" border="0" alt="<?php echo T_('Visible'?>" />
  393.             </td>
  394.             <td>
  395.             <?php echo T_('Published and is <u>Current</u>'?> |
  396.             </td>
  397.             <td>
  398.             <img src="images/publish_r.png" width="12" height="12" border="0" alt="<?php echo T_('Finished'?>" />
  399.             </td>
  400.             <td>
  401.             <?php echo T_('Published, but has <u>Expired</u>'?> |
  402.             </td>
  403.             <td>
  404.             <img src="images/publish_x.png" width="12" height="12" border="0" alt="<?php echo T_('Finished'?>" />
  405.             </td>
  406.             <td>
  407.             <?php echo T_('Not Published'?>
  408.             </td>
  409.         </tr>
  410.         <tr>
  411.             <td colspan="8" align="center">
  412.             <?php echo T_('Click on icon to toggle state.'?>
  413.             </td>
  414.         </tr>
  415.         </table>
  416.         <?php
  417.     }
  418.  
  419.     function menuLinksContent&$menus {
  420.         ?>
  421.         <script language="javascript" type="text/javascript">
  422.         function go2( pressbutton, menu, id ) {
  423.             var form = document.adminForm;
  424.  
  425.             if (pressbutton == 'go2menu') {
  426.                 form.menu.value = menu;
  427.                 submitform( pressbutton );
  428.                 return;
  429.             }
  430.  
  431.             if (pressbutton == 'go2menuitem') {
  432.                 form.menu.value     = menu;
  433.                 form.menuid.value     = id;
  434.                 submitform( pressbutton );
  435.                 return;
  436.             }
  437.         }
  438.         </script>
  439.         <?php
  440.         foreach$menus as $menu {
  441.             ?>
  442.             <tr>
  443.                 <td colspan="2">
  444.                 <hr />
  445.                 </td>
  446.             </tr>
  447.             <tr>
  448.                 <td width="90px" valign="top">
  449.                 <?php echo T_('Menu'?>
  450.                 </td>
  451.                 <td>
  452.                 <a href="javascript:go2( 'go2menu', '<?php echo $menu->menutype?>' );" title="<?php echo T_('Go to Menu'?>">
  453.                 <?php echo $menu->menutype?>
  454.                 </a>
  455.                 </td>
  456.             </tr>
  457.             <tr>
  458.                 <td width="90px" valign="top">
  459.                 <?php echo T_('Link Name'?>
  460.                 </td>
  461.                 <td>
  462.                 <strong>
  463.                 <a href="javascript:go2( 'go2menuitem', '<?php echo $menu->menutype?>', '<?php echo $menu->id?>' );" title="<?php echo T_('Go to Menu Item'?>">
  464.                 <?php echo $menu->name?>
  465.                 </a>
  466.                 </strong>
  467.                 </td>
  468.             </tr>
  469.             <tr>
  470.                 <td width="90px" valign="top">
  471.                 <?php echo T_('State'?>
  472.                 </td>
  473.                 <td>
  474.                 <?php
  475.                 switch $menu->published {
  476.                     case -2:
  477.                         echo '<font color="red">'.T_('Trashed').'</font>';
  478.                         break;
  479.                     case 0:
  480.                         echo T_('UnPublished';
  481.                         break;
  482.                     case 1:
  483.                     default:
  484.                         echo '<font color="green">'.T_('Published').'</font>';
  485.                         break;
  486.                 }
  487.                 ?>
  488.                 </td>
  489.             </tr>
  490.             <?php
  491.         }
  492.         ?>
  493.         <input type="hidden" name="menu" value="" />
  494.         <input type="hidden" name="menuid" value="" />
  495.         <?php
  496.     }
  497.  
  498.     function menuLinksSecCat&$menus {
  499.         ?>
  500.         <script language="javascript" type="text/javascript">
  501.         function go2( pressbutton, menu, id ) {
  502.             var form = document.adminForm;
  503.  
  504.             if (pressbutton == 'go2menu') {
  505.                 form.menu.value = menu;
  506.                 submitform( pressbutton );
  507.                 return;
  508.             }
  509.  
  510.             if (pressbutton == 'go2menuitem') {
  511.                 form.menu.value     = menu;
  512.                 form.menuid.value     = id;
  513.                 submitform( pressbutton );
  514.                 return;
  515.             }
  516.         }
  517.         </script>
  518.         <?php
  519.         foreach$menus as $menu {
  520.             ?>
  521.             <tr>
  522.                 <td colspan="2">
  523.                 <hr/>
  524.                 </td>
  525.             </tr>
  526.             <tr>
  527.                 <td width="90px" valign="top">
  528.                 <?php echo T_('Menu'?>
  529.                 </td>
  530.                 <td>
  531.                 <a href="javascript:go2( 'go2menu', '<?php echo $menu->menutype?>' );" title="<?php echo T_('Go to Menu'?>">
  532.                 <?php echo $menu->menutype?>
  533.                 </a>
  534.                 </td>
  535.             </tr>
  536.             <tr>
  537.                 <td width="90px" valign="top">
  538.                 <?php echo T_('Type'?>
  539.                 </td>
  540.                 <td>
  541.                 <?php echo $menu->type?>
  542.                 </td>
  543.             </tr>
  544.             <tr>
  545.                 <td width="90px" valign="top">
  546.                 <?php echo T_('Item Name'?>
  547.                 </td>
  548.                 <td>
  549.                 <strong>
  550.                 <a href="javascript:go2( 'go2menuitem', '<?php echo $menu->menutype?>', '<?php echo $menu->id?>' );" title="<?php echo T_('Go to Menu Item'?>">
  551.                 <?php echo $menu->name?>
  552.                 </a>
  553.                 </strong>
  554.                 </td>
  555.             </tr>
  556.             <tr>
  557.                 <td width="90px" valign="top">
  558.                 <?php echo T_('State'?>
  559.                 </td>
  560.                 <td>
  561.                 <?php
  562.                 switch $menu->published {
  563.                     case -2:
  564.                         echo '<font color="red">'.T_('Trashed').'</font>';
  565.                         break;
  566.                     case 0:
  567.                         echo T_('UnPublished');
  568.                         break;
  569.                     case 1:
  570.                     default:
  571.                         echo '<font color="green">'.T_('Published').'</font>';
  572.                         break;
  573.                 }
  574.                 ?>
  575.                 </td>
  576.             </tr>
  577.             <?php
  578.         }
  579.         ?>
  580.         <input type="hidden" name="menu" value="" />
  581.         <input type="hidden" name="menuid" value="" />
  582.         <?php
  583.     }
  584.  
  585.     function checkedOut&$row$overlib={
  586.         $hover '';
  587.         if $overlib {
  588.             $date                 mosFormatDate$row->checked_out_time'a, d F Y' );
  589.             $time                mosFormatDate$row->checked_out_time'H:i' );
  590.             $checked_out_text     '<table>';
  591.             $checked_out_text     .= '<tr><td>'$row->editor .'</td></tr>';
  592.             $checked_out_text     .= '<tr><td>'$date .'</td></tr>';
  593.             $checked_out_text     .= '<tr><td>'$time .'</td></tr>';
  594.             $checked_out_text     .= '</table>';
  595.             $hover 'onMouseOver="return overlib(\''$checked_out_text .'\', CAPTION, \''.T_('Checked Out'.'\', BELOW, RIGHT);" onMouseOut="return nd();"';
  596.         }
  597.         $checked             '<img src="images/checked_out.png" '$hover .'/>';
  598.  
  599.         return $checked;
  600.     }
  601.  
  602.     /*
  603.     * Loads all necessary files for JS Overlib tooltips
  604.     */
  605.     function loadOverlib({
  606.         ?>
  607.         <script language="Javascript" src="<?php echo mamboCore::get('mosConfig_live_site');?>/includes/js/overlib_mini.js"></script>
  608.         <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
  609.         <?php
  610.     }
  611.  
  612.  
  613.     /*
  614.     * Loads all necessary files for JS Calendar
  615.     */
  616.     function loadCalendar({
  617.         $mosConfig_live_site mamboCore::get('mosConfig_live_site');
  618.         ?>
  619.         <link rel="stylesheet" type="text/css" media="all" href="<?php echo $mosConfig_live_site;?>/includes/js/calendar/calendar-mos.css" title="green" />
  620.         <!-- import the calendar script -->
  621.         <script type="text/javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/calendar/calendar.js"></script>
  622.         <!-- import the language module -->
  623.         <script type="text/javascript" src="<?php echo $mosConfig_live_site;?>/includes/js/calendar/lang/calendar-en.js"></script>
  624.         <Script Language="JavaScript" Src="<?php echo $mosConfig_live_site;?>/includes/js/calendar/dateScript.js"></Script>
  625.         <Script Language="JavaScript" Src="<?php echo $mosConfig_live_site;?>/includes/js/calendar/persianPopupCalendar.js"></Script>
  626.         <?php
  627.     }
  628.  
  629.     function AccessProcessing&$row$i {
  630.         if !$row->access {
  631.             $color_access 'style="color: green;"';
  632.             $task_access 'accessregistered';
  633.         else if $row->access == {
  634.             $color_access 'style="color: red;"';
  635.             $task_access 'accessspecial';
  636.         else {
  637.             $color_access 'style="color: black;"';
  638.             $task_access 'accesspublic';
  639.         }
  640.  
  641.         $href '
  642.         <a href="javascript: void(0);" onclick="return listItemTask(\'cb'$i .'\',\''$task_access .'\')" '$color_access .'>
  643.         '$row->groupname .'
  644.         </a>'
  645.         ;
  646.  
  647.         return $href;
  648.     }
  649.  
  650.     function CheckedOutProcessing&$row$i {
  651.         $my mamboCore::get('currentUser');
  652.         if $row->checked_out {
  653.             $checked mosCommonHTML::checkedOut$row );
  654.         else {
  655.             $checked mosHTML::idBox$i$row->id($row->checked_out && $row->checked_out != $my->id ) );
  656.         }
  657.  
  658.         return $checked;
  659.     }
  660.  
  661.     function PublishedProcessing&$row$i {
  662.         $img     $row->published 'publish_g.png' 'publish_x.png';
  663.         $task     $row->published 'unpublish' 'publish';
  664.         $alt     $row->published T_('Published'T_('Unpublished');
  665.         $action    $row->published T_('Unpublish Item'T_('Publish item');
  666.  
  667.         $href '
  668.         <a href="javascript: void(0);" onclick="return listItemTask(\'cb'$i .'\',\''$task .'\')" title="'$action .'">
  669.         <img src="images/'$img .'" border="0" alt="'$alt .'" />
  670.         </a>'
  671.         ;
  672.  
  673.         return $href;
  674.     }
  675. }
  676.  
  677. /**
  678. * Tab Creation handler
  679. @package Mambo
  680. @author Phil Taylor
  681. */
  682. class mosTabs {
  683.     /** @var int Use cookies */
  684.     var $useCookies = 0;
  685.  
  686.     /**
  687.     * Constructor
  688.     * Includes files needed for displaying tabs and sets cookie options
  689.     * @param int useCookies, if set to 1 cookie will hold last used tab between page refreshes
  690.     */
  691.     function mosTabs($useCookies{
  692.         $mosConfig_live_site mamboCore::get('mosConfig_live_site');
  693.         echo "<link id=\"luna-tab-style-sheet\" type=\"text/css\" rel=\"stylesheet\" href=\"" $mosConfig_live_site"/includes/js/tabs/tabpane.css\" />";
  694.         echo "<script type=\"text/javascript\" src=\""$mosConfig_live_site "/includes/js/tabs/tabpane.js\"></script>";
  695.         $this->useCookies = $useCookies;
  696.     }
  697.  
  698.     /**
  699.     * creates a tab pane and creates JS obj
  700.     * @param string The Tab Pane Name
  701.     */
  702.     function startPane($id){
  703.         echo "<div class=\"tab-page\" id=\"".$id."\">";
  704.         echo "<script type=\"text/javascript\">\n";
  705.         echo "   var tabPane1 = new WebFXTabPane( document.getElementById( \"".$id."\" ), ".$this->useCookies." )\n";
  706.         echo "</script>\n";
  707.     }
  708.  
  709.     /**
  710.     * Ends Tab Pane
  711.     */
  712.     function endPane({
  713.         echo "</div>";
  714.     }
  715.  
  716.     /*
  717.     * Creates a tab with title text and starts that tabs page
  718.     * @param tabText - This is what is displayed on the tab
  719.     * @param paneid - This is the parent pane to build this tab on
  720.     */
  721.     function startTab$tabText$paneid {
  722.         echo "<div class=\"tab-page\" id=\"".$paneid."\">";
  723.         echo "<h2 class=\"tab\">".$tabText."</h2>";
  724.         echo "<script type=\"text/javascript\">\n";
  725.         echo "  tabPane1.addTabPage( document.getElementById( \"".$paneid."\" ) );";
  726.         echo "</script>";
  727.     }
  728.  
  729.     /*
  730.     * Ends a tab page
  731.     */
  732.     function endTab({
  733.         echo "</div>";
  734.     }
  735. }
  736.  
  737. ?>

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