Source for file weblinks.html.php

Documentation is available at weblinks.html.php

  1. <?php
  2. /**
  3. @package Mambo
  4. @subpackage Weblinks
  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. require_once$GLOBALS['mosConfig_absolute_path''/includes/HTML_toolbar.php' );
  14.  
  15. class HTML_weblinks {
  16.  
  17.     function displaylist&$categories&$rows$catid$currentcat=NULL&$params$tabclass {
  18.         global $Itemid$mosConfig_live_site$hide_js;
  19.         if $params->get'page_title' ) ) {
  20.             ?>
  21.             <div class="componentheading<?php echo $params->get'pageclass_sfx' )?>">
  22.             <?php echo $currentcat->header?>
  23.             </div>
  24.             <?php
  25.         }
  26.         ?>
  27.         <form action="index.php" method="post" name="adminForm">
  28.  
  29.         <table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane<?php echo $params->get'pageclass_sfx' )?>">
  30.         <tr>
  31.             <td width="60%" valign="top" class="contentdescription<?php echo $params->get'pageclass_sfx' )?>" colspan="2">
  32.             <?php
  33.             // show image
  34.             if $currentcat->img {
  35.                 ?>
  36.                 <img src="<?php echo $currentcat->img?>" align="<?php echo $currentcat->align?>" hspace="6" alt="<?php echo T_('Web Links')?>" />
  37.                 <?php
  38.             }
  39.             echo $currentcat->descrip;
  40.             ?>
  41.             </td>
  42.         </tr>
  43.         <tr>
  44.             <td>
  45.             <?php
  46.             if count$rows ) ) {
  47.                 HTML_weblinks::showTable$params$rows$catid$tabclass );
  48.             }
  49.             ?>
  50.             </td>
  51.         </tr>
  52.         <tr>
  53.             <td>&nbsp;
  54.  
  55.             </td>
  56.         </tr>
  57.         <tr>
  58.             <td>
  59.             <?php
  60.             // Displays listing of Categories
  61.             if ( ( $params->get'type' == 'category' && $params->get'other_cat' ) ) {
  62.                 HTML_weblinks::showCategories$params$categories$catid );
  63.             else if ( ( $params->get'type' == 'section' && $params->get'other_cat_section' ) ) {
  64.                 HTML_weblinks::showCategories$params$categories$catid );
  65.             }
  66.             ?>
  67.             </td>
  68.         </tr>
  69.         </table>
  70.         </form>
  71.         <?php
  72.         // displays back button
  73.         mosHTML::BackButton $params$hide_js );
  74.     }
  75.  
  76.     /**
  77.     * Display Table of items
  78.     */
  79.     function showTable&$params&$rows$catid$tabclass {
  80.         global $mosConfig_live_site;
  81.         // icon in table display
  82.         if $params->get'weblink_icons' <> -{
  83.             $mainframe =mosMainFrame::getInstance();
  84.             $img $mainframe->ImageCheck'weblink.png''/images/M_images/'$params->get'weblink_icons' ) );
  85.         else {
  86.             $img NULL;
  87.         }
  88.         ?>
  89.         <table width="100%" border="0" cellspacing="0" cellpadding="0">
  90.         <?php
  91.         if $params->get'headings' ) ) {
  92.             ?>
  93.             <tr>
  94.                 <?php
  95.                 if $img {
  96.                     ?>
  97.                     <td class="sectiontableheader<?php echo $params->get'pageclass_sfx' )?>">&nbsp;
  98.  
  99.                     </td>
  100.                     <?php
  101.                 }
  102.                 ?>
  103.                 <td width="90%" height="20" class="sectiontableheader<?php echo $params->get'pageclass_sfx' )?>">
  104.                 <?php echo T_('Web Link')?>
  105.                 </td>
  106.                 <?php
  107.                 if $params->get'hits' ) ) {
  108.                     ?>
  109.                     <td width="30px" height="20" class="sectiontableheader<?php echo $params->get'pageclass_sfx' )?>" align="right">
  110.                     <?php echo T_('Hits')?>
  111.                     </td>
  112.                     <?php
  113.                 }
  114.                 ?>
  115.             </tr>
  116.             <?php
  117.         }
  118.  
  119.         $k 0;
  120.         foreach ($rows as $row{
  121.             $iparams =new mosParameters$row->params );
  122.  
  123.             $link sefRelToAbs'index.php?option=com_weblinks&task=view&catid='$catid .'&id='$row->id );
  124.             $menuclass 'category'.$params->get'pageclass_sfx' );
  125.             switch ($iparams->get'target' )) {
  126.                 // cases are slightly different
  127.                 case 1:
  128.                 // open in a new window
  129.                 $txt '<a href="'$link .'" target="_blank" class="'$menuclass .'">'$row->title .'</a>';
  130.                 break;
  131.  
  132.                 case 2:
  133.                 // open in a popup window
  134.                 $txt "<a href=\"#\" onclick=\"javascript: window.open('"$link ."', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"$menuclass\">"$row->title ."</a>\n";
  135.                 break;
  136.  
  137.                 default:    // formerly case 2
  138.                 // open in parent window
  139.                 $txt '<a href="'$link .'" class="'$menuclass .'">'$row->title .'</a>';
  140.                 break;
  141.             }
  142.             ?>
  143.             <tr class="<?php echo $tabclass[$k]?>">
  144.                 <?php
  145.                 if $img {
  146.                     ?>
  147.                     <td width="100px" height="20" align="center">
  148.                     &nbsp;&nbsp;<?php echo $img;?>&nbsp;&nbsp;
  149.                     </td>
  150.                     <?php
  151.                 }
  152.                 ?>
  153.                 <td height="20">
  154.                 <?php echo $txt?>
  155.                 <?php
  156.                 if $params->get'item_description' ) ) {
  157.                     ?>
  158.                     <br />
  159.                     <?php echo $row->description?>
  160.                     <?php
  161.                 }
  162.                 ?>
  163.                 </td>
  164.                 <?php
  165.                 if $params->get'hits' ) ) {
  166.                     ?>
  167.                     <td align="center">
  168.                     <?php echo $row->hits?>
  169.                     </td>
  170.                     <?php
  171.                 }
  172.                 ?>
  173.             </tr>
  174.             <?php
  175.             $k $k;
  176.         }
  177.         ?>
  178.         </table>
  179.         <?php
  180.     }
  181.  
  182.     /**
  183.     * Display links to categories
  184.     */
  185.     function showCategories&$params&$categories$catid {
  186.         global $mosConfig_live_site$Itemid;
  187.         ?>
  188.         <ul>
  189.         <?php
  190.         if ($categories)  {
  191.             foreach $categories as $cat {
  192.                 if $catid == $cat->catid {
  193.                     ?>
  194.                     <li>
  195.                         <b>
  196.                         <?php echo $cat->name;?>
  197.                         </b>
  198.                         &nbsp;
  199.                         <span class="small">
  200.                         (<?php echo $cat->numlinks;?>)
  201.                         </span>
  202.                     </li>
  203.                     <?php
  204.                 else {
  205.                     $link 'index.php?option=com_weblinks&catid='$cat->catid .'&Itemid='$Itemid;
  206.                     ?>
  207.                     <li>
  208.                         <a href="<?php echo sefRelToAbs$link )?>" class="category<?php echo $params->get'pageclass_sfx' )?>">
  209.                         <?php echo $cat->name;?>
  210.                         </a>
  211.                         &nbsp;
  212.                         <span class="small">
  213.                         (<?php echo $cat->numlinks;?>)
  214.                         </span>
  215.                     </li>
  216.                     <?php
  217.                 }
  218.             }
  219.         else {
  220.             echo T_('There are currently no links');
  221.         }
  222.         ?>
  223.         </ul>
  224.         <?php
  225.     }
  226.  
  227.     /**
  228.     * Writes the edit form for new and existing record (FRONTEND)
  229.     *
  230.     * A new record is defined when <var>$row</var> is passed with the <var>id</var>
  231.     * property set to 0.
  232.     * @param mosWeblink The weblink object
  233.     * @param string The html for the categories select list
  234.     */
  235.     function editWeblink$option&$row&$lists {
  236.         $Returnid intvalmosGetParam$_REQUEST'Returnid') );
  237.         ?>
  238.         <script language="javascript" type="text/javascript">
  239.         function submitbutton(pressbutton) {
  240.             var form = document.adminForm;
  241.             if (pressbutton == 'cancel') {
  242.                 submitform( pressbutton );
  243.                 return;
  244.             }
  245.  
  246.             // do field validation
  247.             if (form.title.value == ""){
  248.                 alert( '<?php echo T_("Web Link item must have a title")?>' );
  249.             } else if (getSelectedValue('adminForm','catid') < 1) {
  250.                 alert( '<?php echo T_("You must select a category.")?>' );
  251.             } else if (form.url.value == ""){
  252.                 alert( '<?php echo T_("You must have a url.")?>' );
  253.             } else {
  254.                 submitform( pressbutton );
  255.             }
  256.         }
  257.         </script>
  258.  
  259.         <form action="<?php echo sefRelToAbs("index.php")?>" method="post" name="adminForm" id="adminForm">
  260.         <table cellpadding="0" cellspacing="0" border="0" width="100%">
  261.         <tr>
  262.             <td class="contentheading">
  263.             <?php echo T_('Submit A Web Link')?>
  264.             </td>
  265.             <td width="10%">
  266.             <?php
  267.             mosToolBar::startTable();
  268.             mosToolBar::spacer();
  269.             mosToolBar::save();
  270.             mosToolBar::cancel();
  271.             mosToolBar::endtable();
  272.             ?>
  273.             </td>
  274.         </tr>
  275.         </table>
  276.  
  277.         <table cellpadding="4" cellspacing="1" border="0" width="100%">
  278.         <tr>
  279.             <td width="20%" align="right">
  280.             <?php echo T_('Name:')?>
  281.             </td>
  282.             <td width="80%">
  283.             <input class="inputbox" type="text" name="title" size="50" maxlength="250" value="<?php echo htmlspecialchars$row->titleENT_QUOTES );?>" />
  284.             </td>
  285.         </tr>
  286.         <tr>
  287.             <td valign="top" align="right">
  288.             <?php echo T_('Section:')?>
  289.             </td>
  290.             <td>
  291.             <?php echo $lists['catid']?>
  292.             </td>
  293.         </tr>
  294.         <tr>
  295.             <td valign="top" align="right">
  296.             <?php echo T_('URL:')?>
  297.             </td>
  298.             <td>
  299.             <input class="inputbox" type="text" name="url" value="<?php echo $row->url?>" size="50" maxlength="250" />
  300.             </td>
  301.         </tr>
  302.         <tr>
  303.             <td valign="top" align="right">
  304.             <?php echo T_('Description:')?>
  305.             </td>
  306.             <td>
  307.             <textarea class="inputbox" cols="30" rows="6" name="description" style="width:300px" width="300"><?php echo htmlspecialchars$row->descriptionENT_QUOTES );?></textarea>
  308.             </td>
  309.         </tr>
  310.         </table>
  311.  
  312.         <input type="hidden" name="id" value="<?php echo $row->id?>" />
  313.         <input type="hidden" name="option" value="<?php echo $option;?>" />
  314.         <input type="hidden" name="task" value="" />
  315.         <input type="hidden" name="ordering" value="<?php echo $row->ordering?>" />
  316.         <input type="hidden" name="approved" value="<?php echo $row->approved?>" />
  317.         <input type="hidden" name="Returnid" value="<?php echo $Returnid?>" />
  318.         </form>
  319.         <?php
  320.     }
  321.  
  322. }
  323. ?>

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