Source for file admin.templates.html.php

Documentation is available at admin.templates.html.php

  1. <?php
  2. /**
  3. @package Mambo
  4. @subpackage Templates
  5. @copyright  Refer to copyright.php
  6. @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
  7. @author Mambo Foundation Inc see README.php
  8. */
  9.  
  10. /** ensure this file is being included by a parent file */
  11. defined'_VALID_MOS' or die'Direct Access to this location is not allowed.' );
  12.  
  13. class HTML_templates {
  14.     /**
  15.     * @param array An array of data objects
  16.     * @param object page navigation object
  17.     * @param string The option
  18.     */
  19.     function showTemplates&$rows&$pageNav$option$client {
  20.         global $my$mosConfig_live_site;
  21.  
  22.         if isset$row->authorUrl&& $row->authorUrl != '' {
  23.             $row->authorUrl str_replace'http://'''$row->authorUrl );
  24.         }
  25.  
  26.         mosCommonHTML::loadOverlib();
  27.         ?>
  28.         <script language="Javascript">
  29.         <!--
  30.         function showInfo(name) {
  31.             var pattern = /\b \b/ig;
  32.             name = name.replace(pattern,'_');
  33.             name = name.toLowerCase();
  34.             if (document.adminForm.doPreview.checked) {
  35.                 var src = '<?php echo $mosConfig_live_site ($client == 'admin' '/administrator' '');?>/templates/'+name+'/template_thumbnail.png';
  36.                 var html=name;
  37.                 html = '<br /><img border="1" src="'+src+'" name="imagelib" alt="<?php echo T_('No preview available')?>" width="206" height="145" />';
  38.                 return overlib(html, CAPTION, name)
  39.             } else {
  40.                 return false;
  41.             }
  42.         }
  43.         -->
  44.         </script>
  45.  
  46.         <form action="index2.php" method="post" name="adminForm">
  47.         <table class="adminheading">
  48.         <tr>
  49.             <th class="templates">
  50.             <?php echo T_('Template Manager')?> <small><small>[ <?php echo $client == 'admin' T_('Administrator'T_('Site');?> ]</small></small>
  51.             </th>
  52.             <td align="right" nowrap="true">
  53.             <?php echo T_('Preview Template')?>
  54.             </td>
  55.             <td align="right">
  56.             <input type="checkbox" name="doPreview" checked="checked"/>
  57.             </td>
  58.         </tr>
  59.         </table>
  60.         <table class="adminlist">
  61.         <tr>
  62.             <th width="3%">#</th>
  63.             <th width="3%">&nbsp;</th>
  64.             <th width="25%" class="title" align="right">
  65.             <?php echo T_('Name')?>
  66.             </th>
  67.             <?php
  68.             if $client == 'admin' {
  69.                 ?>
  70.                 <th width="10%">
  71.                 <?php echo T_('Default')?>
  72.                 </th>
  73.                 <?php
  74.             else {
  75.                 ?>
  76.                 <th width="5%">
  77.                 <?php echo T_('Default')?>
  78.                 </th>
  79.                 <th width="5%">
  80.                 <?php echo T_('Assigned')?>
  81.                 </th>
  82.                 <?php
  83.             }
  84.             ?>
  85.             <th width="20%" align="right">
  86.             <?php echo T_('Author')?>
  87.             </th>
  88.             <th width="5%" align="center">
  89.             <?php echo T_('Version')?>
  90.             </th>
  91.             <th width="10%" align="center">
  92.             <?php echo T_('Date')?>
  93.             </th>
  94.             <th width="20%" align="right">
  95.             <?php echo T_('Author URL')?>
  96.             </th>
  97.         </tr>
  98.         <?php
  99.         $k 0;
  100.         for $i=0$n count$rows )$i $n$i++ {
  101.             $row &$rows[$i];
  102.             ?>
  103.             <tr class="<?php echo 'row'$k?>">
  104.                 <td>
  105.                 <?php echo $pageNav->rowNumber$i )?>
  106.                 </td>
  107.                 <td>
  108.                 <?php
  109.                 if $row->checked_out && $row->checked_out != $my->id {
  110.                     ?>
  111.                     &nbsp;
  112.                     <?php
  113.                 else {
  114.                     ?>
  115.                     <input type="radio" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->directory?>" onClick="isChecked(this.checked);" />
  116.                     <?php
  117.                 }
  118.                 ?>
  119.                 </td>
  120.                 <td>
  121.                 <a href="#info" onmouseover="showInfo('<?php echo $row->name;?>')" onmouseout="return nd();">
  122.                 <?php echo $row->name;?>
  123.                 </a>
  124.                 </td>
  125.                 <?php
  126.                 if $client == 'admin' {
  127.                     ?>
  128.                     <td align="center">
  129.                     <?php
  130.                     if $row->published == {
  131.                         ?>
  132.                     <img src="images/tick.png" alt="<?php echo T_('Published')?>">
  133.                         <?php
  134.                     else {
  135.                         ?>
  136.                         &nbsp;
  137.                         <?php
  138.                     }
  139.                     ?>
  140.                     </td>
  141.                     <?php
  142.                 else {
  143.                     ?>
  144.                     <td align="center">
  145.                     <?php
  146.                     if $row->published == {
  147.                         ?>
  148.                         <img src="images/tick.png" alt="<?php echo T_('Default')?>">
  149.                         <?php
  150.                     else {
  151.                         ?>
  152.                         &nbsp;
  153.                         <?php
  154.                     }
  155.                     ?>
  156.                     </td>
  157.                     <td align="center">
  158.                     <?php
  159.                     if $row->assigned == {
  160.                         ?>
  161.                         <img src="images/tick.png" alt="<?php echo T_('Assigned')?>" />
  162.                         <?php
  163.                     else {
  164.                         ?>
  165.                         &nbsp;
  166.                         <?php
  167.                     }
  168.                     ?>
  169.                     </td>
  170.                     <?php
  171.                 }
  172.                 ?>
  173.                 <td>
  174.                 <?php echo $row->authorEmail '<a href="mailto:'$row->authorEmail .'">'$row->author .'</a>' $row->author?>
  175.                 </td>
  176.                 <td align="center">
  177.                 <?php echo $row->version?>
  178.                 </td>
  179.                 <td align="center">
  180.                 <?php echo $row->creationdate?>
  181.                 </td>
  182.                 <td>
  183.                 <a href="<?php echo substr$row->authorUrl07== 'http://' $row->authorUrl 'http://'.$row->authorUrl?>" target="_blank">
  184.                 <?php echo $row->authorUrl?>
  185.                 </a>
  186.                 </td>
  187.             </tr>
  188.             <?php
  189.         }
  190.         ?>
  191.         </table>
  192.         <?php echo $pageNav->getListFooter()?>
  193.  
  194.         <input type="hidden" name="option" value="<?php echo $option;?>" />
  195.         <input type="hidden" name="task" value="" />
  196.         <input type="hidden" name="boxchecked" value="0" />
  197.         <input type="hidden" name="hidemainmenu" value="0" />
  198.         <input type="hidden" name="client" value="<?php echo $client;?>" />
  199.         </form>
  200.         <?php
  201.     }
  202.  
  203.  
  204.     /**
  205.     * @param string Template name
  206.     * @param string Source code
  207.     * @param string The option
  208.     */
  209.     function editTemplateSource$template&$content$option$client {
  210.         global $mosConfig_absolute_path;
  211.         $template_path =
  212.             $mosConfig_absolute_path ($client == 'admin' '/administrator':''.
  213.             '/templates/' $template '/index.php';
  214.         ?>
  215.         <form action="index2.php" method="post" name="adminForm">
  216.         <table cellpadding="1" cellspacing="1" border="0" width="100%">
  217.         <tr>
  218.             <td width="290"><table class="adminheading"><tr><th class="templates"><?php echo T_('Template HTML Editor')?></th></tr></table></td>
  219.             <td width="220">
  220.                 <span class="componentheading">index.php is :
  221.                 <b><?php echo is_writable($template_path'<span class="green">'.T_('Writeable').'</span>' '<span class="red">'.T_('Unwriteable').'</span>' ?></b>
  222.                 </span>
  223.             </td>
  224. <?php
  225.             if (mosIsChmodable($template_path)) {
  226.                 if (is_writable($template_path)) {
  227. ?>
  228.             <td>
  229.                 <input type="checkbox" id="disable_write" name="disable_write" value="1"/>
  230.                 <label for="disable_write"><?php echo T_('Make unwriteable after saving')?></label>
  231.             </td>
  232. <?php
  233.                 else {
  234. ?>
  235.             <td>
  236.                 <input type="checkbox" id="enable_write" name="enable_write" value="1"/>
  237.                 <label for="enable_write"><?php echo T_('Override write protection while saving')?></label>
  238.             </td>
  239. <?php
  240.                 // if
  241.             // if
  242. ?>
  243.         </tr>
  244.         </table>
  245.         <table class="adminform">
  246.             <tr><th dir="ltr"><?php echo $template_path?></th></tr>
  247.             <tr><td><textarea style="width:100%;height:500px" cols="110" rows="25" name="filecontent" class="inputbox" dir="ltr"><?php echo $content?></textarea></td></tr>
  248.         </table>
  249.         <input type="hidden" name="template" value="<?php echo $template?>" />
  250.         <input type="hidden" name="option" value="<?php echo $option;?>" />
  251.         <input type="hidden" name="task" value="" />
  252.         <input type="hidden" name="client" value="<?php echo $client;?>" />
  253.         </form>
  254.         <?php
  255.     }
  256.  
  257.  
  258.     /**
  259.     * @param string Template name
  260.     * @param string Source code
  261.     * @param string The option
  262.     */
  263.     function editCSSSource$template&$content$option$client {
  264.         global $mosConfig_absolute_path;
  265.         $css_path =
  266.             $mosConfig_absolute_path ($client == 'admin' '/administrator' '')
  267.             . '/templates/' $template '/css/template_css.css';
  268.         ?>
  269.         <form action="index2.php" method="post" name="adminForm">
  270.         <table cellpadding="1" cellspacing="1" border="0" width="100%">
  271.         <tr>
  272.             <td width="280"><table class="adminheading"><tr><th class="templates"><?php echo T_('Template CSS Editor')?></th></tr></table></td>
  273.             <td width="260">
  274.                 <span class="componentheading">template_css.css is :
  275.                 <b><?php echo is_writable($css_path'<span class="green">'.T_('Writeable').'</span>' '<span class="red">'.T_('Unwriteable').'</span>' ?></b>
  276.                 </span>
  277.             </td>
  278. <?php
  279.             if (mosIsChmodable($css_path)) {
  280.                 if (is_writable($css_path)) {
  281. ?>
  282.             <td>
  283.                 <input type="checkbox" id="disable_write" name="disable_write" value="1"/>
  284.                 <label for="disable_write"><?php echo T_('Make unwriteable after saving')?></label>
  285.             </td>
  286. <?php
  287.                 else {
  288. ?>
  289.             <td>
  290.                 <input type="checkbox" id="enable_write" name="enable_write" value="1"/>
  291.                 <label for="enable_write"><?php echo T_('Override write protection while saving')?></label>
  292.             </td>
  293. <?php
  294.                 // if
  295.             // if
  296. ?>
  297.         </tr>
  298.         </table>
  299.         <table class="adminform">
  300.             <tr><th dir="ltr"><?php echo $css_path?></th></tr>
  301.             <tr><td><textarea style="width:100%;height:500px" cols="110" rows="25" name="filecontent" class="inputbox" dir="ltr"><?php echo $content?></textarea></td></tr>
  302.         </table>
  303.         <input type="hidden" name="template" value="<?php echo $template?>" />
  304.         <input type="hidden" name="option" value="<?php echo $option;?>" />
  305.         <input type="hidden" name="task" value="" />
  306.         <input type="hidden" name="client" value="<?php echo $client;?>" />
  307.         </form>
  308.         <?php
  309.     }
  310.  
  311.  
  312.     /**
  313.     * @param string Template name
  314.     * @param string Menu list
  315.     * @param string The option
  316.     */
  317.     function assignTemplate$template&$menulist$option {
  318.         ?>
  319.         <form action="index2.php" method="post" name="adminForm">
  320.         <table class="adminform">
  321.         <tr>
  322.             <th class="right" colspan="2">
  323.             <?php printf(T_('Assign template %s to menu items')$template)?>
  324.             </th>
  325.         </tr>
  326.         <tr>
  327.             <td valign="top" align="right">
  328.             <?php echo T_('Page(s):')?>
  329.             </td>
  330.             <td width="90%">
  331.             <?php echo $menulist?>
  332.             </td>
  333.         </tr>
  334.         </table>
  335.         <input type="hidden" name="template" value="<?php echo $template?>" />
  336.         <input type="hidden" name="option" value="<?php echo $option;?>" />
  337.         <input type="hidden" name="task" value="" />
  338.         </form>
  339.         <?php
  340.     }
  341.  
  342.  
  343.     /**
  344.     * @param array 
  345.     * @param string The option
  346.     */
  347.     function editPositions&$positions$option {
  348.         $rows 25;
  349.         $cols 2;
  350.         $n $rows $cols;
  351.         ?>
  352.         <form action="index2.php" method="post" name="adminForm">
  353.         <table class="adminheading">
  354.         <tr>
  355.             <th class="templates">
  356.             <?php echo T_('Module Positions')?>
  357.             </th>
  358.         </tr>
  359.         </table>
  360.  
  361.         <table class="adminlist">
  362.         <tr>
  363.         <?php
  364.         for $c 0$c $cols$c++ {
  365.             ?>
  366.             <th width="25">
  367.             #
  368.             </th>
  369.             <th align="right">
  370.             <?php echo T_('Position')?>
  371.             </th>
  372.             <th align="right">
  373.             <?php echo T_('Description')?>
  374.             </th>
  375.             <?php
  376.         }
  377.         ?>
  378.         </tr>
  379.         <?php
  380.         $i 1;
  381.         for $r 0$r $rows$r++ {
  382.             ?>
  383.             <tr>
  384.             <?php
  385.             for $c 0$c $cols$c++ {
  386.                 ?>
  387.                 <td>(<?php echo $i?>)</td>
  388.                 <td>
  389.                 <input type="text" name="position[<?php echo $i?>]" value="<?php echo @$positions[$i-1]->position?>" size="10" maxlength="10" dir="ltr"/>
  390.                 </td>
  391.                 <td>
  392.                 <input type="text" name="description[<?php echo $i?>]" value="<?php echo htmlspecialchars@$positions[$i-1]->description )?>" size="50" maxlength="255" />
  393.                 </td>
  394.                 <?php
  395.                 $i++;
  396.             }
  397.             ?>
  398.             </tr>
  399.             <?php
  400.         }
  401.         ?>
  402.         </table>
  403.         <input type="hidden" name="option" value="<?php echo $option;?>" />
  404.         <input type="hidden" name="task" value="" />
  405.         </form>
  406.         <?php
  407.     }
  408. }
  409. ?>

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