Source for file admin.sections.html.php

Documentation is available at admin.sections.html.php

  1. <?php
  2. /**
  3. @package Mambo
  4. @subpackage Sections
  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 sections_html {
  14.     /**
  15.     * Writes a list of the categories for a section
  16.     * @param array An array of category objects
  17.     * @param string The name of the category section
  18.     */
  19.     function show&$rows$scope$myid&$pageNav$option {
  20.         global $my;
  21.  
  22.         mosCommonHTML::loadOverlib();
  23.         ?>
  24.         <form action="index2.php" method="post" name="adminForm">
  25.         <table class="adminheading">
  26.         <tr>
  27.              <th class="sections">
  28.             <?php echo T_('Section Manager')?>
  29.             </th>
  30.         </tr>
  31.         </table>
  32.  
  33.         <table class="adminlist">
  34.         <tr>
  35.             <th width="20">
  36.             #
  37.             </th>
  38.             <th width="20">
  39.             <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count$rows );?>);" />
  40.             </th>
  41.             <th class="title">
  42.             <?php echo T_('Section Name')?>
  43.             </th>
  44.             <th width="10%">
  45.             <?php echo T_('Published')?>
  46.             </th>
  47.             <th colspan="2" width="5%">
  48.             <?php echo T_('Reorder')?>
  49.             </th>
  50.             <th width="2%">
  51.             <?php echo T_('Order')?>
  52.             </th>
  53.             <th width="1%">
  54.             <a href="javascript: saveorder( <?php echo count$rows )-1?> )"><img src="images/filesave.png" border="0" width="16" height="16" alt="<?php echo T_('Save Order')?>" /></a>
  55.             </th>
  56.             <th width="8%">
  57.             <?php echo T_('Access')?>
  58.             </th>
  59.             <th width="12%" nowrap>
  60.             <?php echo T_('Section ID')?>
  61.             </th>
  62.             <th width="12%" nowrap>
  63.             <?php echo T_('# Categories')?>
  64.             </th>
  65.             <th width="12%" nowrap>
  66.             <?php echo T_('# Active')?>
  67.             </th>
  68.             <th width="12%" nowrap>
  69.             <?php echo T_('# Trash')?>
  70.             </th>
  71.  
  72.         </tr>
  73.         <?php
  74.         $k 0;
  75.         for $i=0$n=count$rows )$i $n$i++ {
  76.             $row &$rows[$i];
  77.  
  78.             $link 'index2.php?option=com_sections&scope=content&task=editA&hidemainmenu=1&id='$row->id;
  79.  
  80.             $access     mosCommonHTML::AccessProcessing$row$i );
  81.             $checked     mosCommonHTML::CheckedOutProcessing$row$i );
  82.             $published     mosCommonHTML::PublishedProcessing$row$i );
  83.             ?>
  84.             <tr class="<?php echo "row$k"?>">
  85.                 <td width="20" align="right">
  86.                 <?php echo $pageNav->rowNumber$i )?>
  87.                 </td>
  88.                 <td width="20">
  89.                 <?php echo $checked?>
  90.                 </td>
  91.                 <td width="35%">
  92.                 <?php
  93.                 if $row->checked_out && $row->checked_out != $my->id ) ) {
  94.                     echo $row->name" ( "$row->title ." )";
  95.                 else {
  96.                     ?>
  97.                     <a href="<?php echo $link?>">
  98.                     <?php echo $row->name" ( "$row->title ." )"?>
  99.                     </a>
  100.                     <?php
  101.                 }
  102.                 ?>
  103.                 </td>
  104.                 <td align="center">
  105.                 <?php echo $published;?>
  106.                 </td>
  107.                 <td>
  108.                 <?php echo $pageNav->orderUpIcon$i )?>
  109.                 </td>
  110.                 <td>
  111.                 <?php echo $pageNav->orderDownIcon$i$n )?>
  112.                 </td>
  113.                 <td align="center" colspan="2">
  114.                 <input type="text" name="order[]" size="5" value="<?php echo $row->ordering?>" class="text_area" style="text-align: center" />
  115.                 </td>
  116.                 <td align="center">
  117.                 <?php echo $access;?>
  118.                 </td>
  119.                 <td align="center">
  120.                 <?php echo $row->id?>
  121.                 </td>
  122.                 <td align="center">
  123.                 <?php echo $row->categories?>
  124.                 </td>
  125.                 <td align="center">
  126.                 <?php echo $row->active?>
  127.                 </td>
  128.                 <td align="center">
  129.                 <?php echo $row->trash?>
  130.                 </td>
  131.                 <?php
  132.                 $k $k;
  133.                 ?>
  134.             </tr>
  135.             <?php
  136.         }
  137.         ?>
  138.         </table>
  139.  
  140.         <?php echo $pageNav->getListFooter()?>
  141.  
  142.         <input type="hidden" name="option" value="<?php echo $option;?>" />
  143.         <input type="hidden" name="scope" value="<?php echo $scope;?>" />
  144.         <input type="hidden" name="task" value="" />
  145.         <input type="hidden" name="chosen" value="" />
  146.         <input type="hidden" name="act" value="" />
  147.         <input type="hidden" name="boxchecked" value="0" />
  148.         <input type="hidden" name="hidemainmenu" value="0" />
  149.         </form>
  150.         <?php
  151.     }
  152.  
  153.     /**
  154.     * Writes the edit form for new and existing categories
  155.     *
  156.     * A new record is defined when <var>$row</var> is passed with the <var>id</var>
  157.     * property set to 0.  Note that the <var>section</var> property <b>must</b> be defined
  158.     * even for a new record.
  159.     * @param mosCategory The category object
  160.     * @param string The html for the image list select list
  161.     * @param string The html for the image position select list
  162.     * @param string The html for the ordering list
  163.     * @param string The html for the groups select list
  164.     */
  165.     function edit&$row$option&$lists&$menus {
  166.         global $mosConfig_live_site;
  167.         if $row->name != '' {
  168.             $name $row->name;
  169.         else {
  170.             $name T_("New Section");
  171.         }
  172.         if ($row->image == ""{
  173.             $row->image 'blank.png';
  174.         }
  175.         ?>
  176.         <script language="javascript" type="text/javascript">
  177.         function submitbutton(pressbutton) {
  178.             var form = document.adminForm;
  179.             if (pressbutton == 'cancel') {
  180.                 submitform( pressbutton );
  181.                 return;
  182.             }
  183.  
  184.             if ( pressbutton == 'menulink' ) {
  185.                 if ( form.menuselect.value == "" ) {
  186.                     alert( "<?php echo T_('Please select a Menu')?>" );
  187.                     return;
  188.                 } else if ( form.link_type.value == "" ) {
  189.                     alert( "<?php echo T_('Please select a menu type')?>" );
  190.                     return;
  191.                 } else if ( form.link_name.value == "" ) {
  192.                     alert( "<?php echo T_('Please enter a Name for this menu item')?>" );
  193.                     return;
  194.                 }
  195.             }
  196.  
  197.             if (form.name.value == ""){
  198.                 alert("<?php echo T_('Section must have a name')?>");
  199.             } else if (form.title.value ==""){
  200.                 alert("<?php echo T_('Section must have a title')?>");
  201.             } else {
  202.                 <?php getEditorContents'editor1''description' ?>
  203.                 submitform(pressbutton);
  204.             }
  205.         }
  206.         // show / hide publishing information
  207.             function displayParameterInfo()
  208.             {
  209.  
  210.                 if(document.getElementById('simpleediting').style.display == 'block')
  211.                 {
  212.                     document.getElementById('simpleediting').style.display = 'none';
  213.                     document.getElementById('show').style.display = 'block';
  214.                     document.getElementById('hide').style.display = 'none';
  215.                     document.adminForm.simple_editing.value ='on';
  216.                 }
  217.                 else
  218.                 {
  219.                     document.getElementById('simpleediting').style.display = 'block';
  220.                     document.getElementById('show').style.display = 'none';
  221.                     document.getElementById('hide').style.display = 'block';
  222.                     document.adminForm.simple_editing.value ='off';
  223.                 }
  224.  
  225.             }
  226.         </script>
  227.         <?php
  228.         if($_SESSION['simple_editing'== 'on')
  229.         {
  230.             $simpleediting ='none';
  231.             $simple 'block';
  232.             $advanced 'none';
  233.         }
  234.         else
  235.         {
  236.  
  237.             $advanced 'block';
  238.             $simple 'none';
  239.             $simpleediting ='block';
  240.         }
  241.  
  242.         ?>
  243.         <form action="index2.php" method="post" name="adminForm">
  244.         <input type ="hidden" name="simple_editing" value='' />
  245.         <table class="adminheading">
  246.         <tr>
  247.             <th class="sections">
  248.             <?php echo T_('Section:')?>
  249.             <small>
  250.             <?php echo $row->id T_('Edit'T_('New');?>
  251.             </small>
  252.             <small><small>
  253.             [ <?php echo $name ?> ]
  254.             </small></small>
  255.             </th>
  256.         </tr>
  257.         </table>
  258.         <table width="100%">
  259.             <tr>
  260.                 <td valign="top" align="right">
  261.                 <div id = "show" style="display:<?php echo $simple;?>">
  262.                 <a href="javascript:displayParameterInfo();"><?php echo T_('Show Advanced Details')?></a>
  263.                 </div>
  264.                 <div id = "hide" style="display:<?php echo $advanced;?>">
  265.                 <a href="javascript:displayParameterInfo();"><?php echo T_('Hide Advanced Details')?></a>
  266.                 </div>
  267.                 </td>
  268.             </tr>
  269.         </table>
  270.         <table width="100%">
  271.         <tr>
  272.             <td valign="top" >
  273.                 <table class="adminform">
  274.                 <tr>
  275.                     <th colspan="3">
  276.                     <?php echo T_('Section Details')?>
  277.                     </th>
  278.                 </tr>
  279.                 <tr>
  280.                     <td width="150">
  281.                     <?php echo T_('Scope:')?>
  282.                     </td>
  283.                     <td width="85%" colspan="2">
  284.                     <strong>
  285.                     <?php echo $row->scope?>
  286.                     </strong>
  287.                     </td>
  288.                 </tr>
  289.                 <tr>
  290.                     <td>
  291.                     <?php echo T_('Title:')?>
  292.                     </td>
  293.                     <td colspan="2">
  294.                     <input class="text_area" type="text" name="title" value="<?php echo $row->title?>" size="50" maxlength="50" title="<?php echo T_('A short name to appear in menus')?>" />
  295.                     </td>
  296.                 </tr>
  297.                 <tr>
  298.                     <td>
  299.                     <?php echo (isset($row->sectionT_("Category"T_("Section"));?> <?php echo T_('Name:')?>
  300.                     </td>
  301.                     <td colspan="2">
  302.                     <input class="text_area" type="text" name="name" value="<?php echo $row->name?>" size="50" maxlength="255" title="<?php echo T_('A long name to be displayed in headings')?>" />
  303.                     </td>
  304.                 </tr>
  305.                 <tr>
  306.                     <td>
  307.                     <?php echo T_('Image:')?>
  308.                     </td>
  309.                     <td>
  310.                     <?php echo $lists['image']?>
  311.                     </td>
  312.                     <td rowspan="4" width="50%">
  313.                     <?php
  314.                         $path $mosConfig_live_site "/images/";
  315.                         if ($row->image != "blank.png"{
  316.                             $path.= "stories/";
  317.                         }
  318.                     ?>
  319.                     <img src="<?php echo $path;?><?php echo $row->image;?>" name="imagelib" width="80" height="80" border="2" alt="<?php echo T_('Preview')?>" />
  320.                     </td>
  321.                 </tr>
  322.                 <tr>
  323.                     <td>
  324.                     <?php echo T_('Image Position:')?>
  325.                     </td>
  326.                     <td>
  327.                     <?php echo $lists['image_position']?>
  328.                     </td>
  329.                 </tr>
  330.                 <tr>
  331.                     <td>
  332.                     <?php echo T_('Ordering:')?>
  333.                     </td>
  334.                     <td>
  335.                     <?php echo $lists['ordering']?>
  336.                     </td>
  337.                 </tr>
  338.                 <tr>
  339.                     <td>
  340.                     <?php echo T_('Access Level:')?>
  341.                     </td>
  342.                     <td>
  343.                     <?php echo $lists['access']?>
  344.                     </td>
  345.                 </tr>
  346.                 <tr>
  347.                     <td>
  348.                     <?php echo T_('Published:')?>
  349.                     </td>
  350.                     <td>
  351.                     <?php echo $lists['published']?>
  352.                     </td>
  353.                 </tr>
  354.                 <tr>
  355.                     <td valign="top">
  356.                     <?php echo T_('Description:')?>
  357.                     </td>
  358.                     <td colspan="2">
  359.                     <?php
  360.                     // parameters : areaname, content, hidden field, width, height, rows, cols
  361.                     editorArea'editor1',  $row->description 'description''100%;''300''60''20' ?>
  362.                     </td>
  363.                 </tr>
  364.                 </table>
  365.             </td>
  366.             <td valign="top" align="right">
  367.             <div id="simpleediting" style="display:<?php echo $simpleediting;?>">
  368.             <table cellspacing="0" cellpadding="0" border="0" width="100%" >
  369.                 <tr>
  370.                     <td width="40%">
  371.             <?php
  372.             if $row->id {
  373.                     ?>
  374.                 <table class="adminform">
  375.                 <tr>
  376.                     <th colspan="2">
  377.                     <?php echo T_('Link to Menu')?>
  378.                     </th>
  379.                 </tr>
  380.                 <tr>
  381.                     <td colspan="2">
  382.                     <?php echo T_('This will create a new menu item in the menu you select')?>
  383.                     <br /><br />
  384.                     </td>
  385.                 </tr>
  386.                 <tr>
  387.                     <td valign="top" width="100px">
  388.                     <?php echo T_('Select a Menu')?>
  389.                     </td>
  390.                     <td>
  391.                     <?php echo $lists['menuselect']?>
  392.                     </td>
  393.                 </tr>
  394.                 <tr>
  395.                     <td valign="top" width="100px">
  396.                     <?php echo T_('Select Menu Type')?>
  397.                     </td>
  398.                     <td>
  399.                     <?php echo $lists['link_type']?>
  400.                     </td>
  401.                 </tr>
  402.                 <tr>
  403.                     <td valign="top" width="100px">
  404.                     <?php echo T_('Menu Item Name')?>
  405.                     </td>
  406.                     <td>
  407.                     <input type="text" name="link_name" class="inputbox" value="" size="25" />
  408.                     </td>
  409.                 </tr>
  410.                 <tr>
  411.                     <td>
  412.                     </td>
  413.                     <td>
  414.                     <input name="menu_link" type="button" class="button" value="<?php echo T_('Link to Menu')?>" onClick="submitbutton('menulink');" />
  415.                     </td>
  416.                 </tr>
  417.                 <tr>
  418.                     <th colspan="2">
  419.                     <?php echo T_('Existing Menu Links')?>
  420.                     </th>
  421.                 </tr>
  422.                 <?php
  423.                 if $menus == NULL {
  424.                     ?>
  425.                     <tr>
  426.                         <td colspan="2">
  427.                         <?php echo T_('None')?>
  428.                         </td>
  429.                     </tr>
  430.                     <?php
  431.                 else {
  432.                     mosCommonHTML::menuLinksSecCat$menus );
  433.                 }
  434.                 ?>
  435.                 <tr>
  436.                     <td colspan="2">
  437.                     </td>
  438.                 </tr>
  439.                 </table>
  440.             <?php
  441.             else {
  442.             ?>
  443.  
  444.             <table class="adminform" width="40%">
  445.                 <tr><th>&nbsp;</th></tr>
  446.                 <tr><td><?php echo T_('Menu links available when saved')?></td></tr>
  447.             </table>
  448.             <?php
  449.             }
  450.             ?>
  451.             </td>
  452.         </tr>
  453.         </table>
  454.         </div>
  455.         </td>
  456.         </tr>
  457.         </table>
  458.         <input type="hidden" name="option" value="<?php echo $option;?>" />
  459.         <input type="hidden" name="scope" value="<?php echo $row->scope?>" />
  460.         <input type="hidden" name="id" value="<?php echo $row->id?>" />
  461.         <input type="hidden" name="task" value="" />
  462.         <input type="hidden" name="hidemainmenu" value="0" />
  463.         <input type="hidden" name="oldtitle" value="<?php echo $row->title ?>" />
  464.         </form>
  465.         </td>
  466.         </tr>
  467.         </table>
  468.         <?php
  469.     }
  470.  
  471.  
  472.     /**
  473.     * Form to select Section to copy Category to
  474.     */
  475.     function copySectionSelect$option$cid$categories$contents$section {
  476.         ?>
  477.         <form action="index2.php" method="post" name="adminForm">
  478.         <br />
  479.         <table class="adminheading">
  480.         <tr>
  481.             <th class="sections">
  482.             <?php echo T_('Copy Section')?>
  483.             </th>
  484.         </tr>
  485.         </table>
  486.  
  487.         <br />
  488.         <table class="adminform">
  489.         <tr>
  490.             <td width="3%"></td>
  491.             <td align="right" valign="top" width="30%">
  492.             <strong><?php echo T_('Copy to Section:')?></strong>
  493.             <br />
  494.             <input class="text_area" type="text" name="title" value="" size="35" maxlength="50" title="<?php echo T_('The new Section name')?>" />
  495.             <br /><br />
  496.             </td>
  497.             <td align="right" valign="top" width="20%">
  498.             <strong><?php echo T_('Categories being copied:')?></strong>
  499.             <br />
  500.             <?php
  501.             echo "<ol>";
  502.             if ($categories{
  503.                 foreach $categories as $category {
  504.                     echo "<li>"$category->name ."</li>";
  505.                     echo "\n <input type=\"hidden\" name=\"category[]\" value=\"$category->id\" />";
  506.                 }
  507.             else {
  508.                 echo 'none';
  509.             }
  510.             echo "</ol>";
  511.             ?>
  512.             </td>
  513.             <td valign="top" width="20%">
  514.             <strong><?php echo T_('Content Items being copied:')?></strong>
  515.             <br />
  516.             <?php
  517.             echo "<ol>";
  518.             if ($contents{
  519.                 foreach $contents as $content {
  520.                     echo "<li>"$content->title ."</li>";
  521.                     echo "\n <input type=\"hidden\" name=\"content[]\" value=\"$content->id\" />";
  522.                 }
  523.             else {
  524.                 echo 'none';
  525.             }
  526.             echo "</ol>";
  527.             ?>
  528.             </td>
  529.             <td valign="top">
  530.             <?php echo T_('This will copy the Categories listed
  531.             <br />
  532.             and all the items within the category (also listed)
  533.             <br />
  534.             to the new Section created.')?>
  535.             </td>.
  536.         </tr>
  537.         </table>
  538.         <br /><br />
  539.  
  540.         <input type="hidden" name="option" value="<?php echo $option;?>" />
  541.         <input type="hidden" name="section" value="<?php echo $section;?>" />
  542.         <input type="hidden" name="boxchecked" value="1" />
  543.         <input type="hidden" name="task" value="" />
  544.         <input type="hidden" name="scope" value="content" />
  545.         <?php
  546.         foreach $cid as $id {
  547.             echo "\n <input type=\"hidden\" name=\"cid[]\" value=\"$id\" />";
  548.         }
  549.         ?>
  550.         </form>
  551.         <?php
  552.     }
  553.  
  554. }
  555. ?>

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