/4.8/administrator/components/com_mambots/admin.mambots.html.php
PHP | 332 lines | 281 code | 16 blank | 35 comment | 21 complexity | 827b48fd9ae1bd29f9c961a2523cd21d MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, LGPL-2.0
- <?php
- /**
- * @package MiaCMS
- * @subpackage Mambots
- * @author MiaCMS see README.php
- * @copyright see README.php
- * See COPYRIGHT.php for copyright notices and details.
- * @license GNU/GPL Version 2, see LICENSE.php
- * MiaCMS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; version 2 of the License.
- */
- /** ensure this file is being included by a parent file */
- defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
- class HTML_modules {
- /**
- * Writes a list of the defined modules
- * @param array An array of category objects
- */
- function showMambots( &$rows, $client, &$pageNav, $option, &$lists, $search ) {
- global $my, $mainframe;
- ?>
- <form action="index2.php" method="post" id="adminForm" name="adminForm">
- <table class="adminheading">
- <tr>
- <th class="modules">
- <?php echo T_('Mambot Manager')?> <small><small>[ <?php echo $client == 'admin' ? T_('Administrator') : T_('Site');?> ]</small></small>
- </th>
- <td>
- <?php echo T_('Filter:')?>
- </td>
- <td>
- <input type="text" id="search" name="search" value="<?php echo $search;?>" class="text_area" />
- </td>
- <td>
- <?php echo $lists['type'];?>
- </td>
- </tr>
- </table>
- <table class="adminlist">
- <tr>
- <th width="20">#</th>
- <th width="20">
- <input id="check_all" type="checkbox" name="toggle" value="" />
- </th>
- <th class="title">
- <?php echo T_('Mambot Name')?>
- </th>
- <th nowrap="nowrap" width="10%">
- <?php echo T_('Published')?>
- </th>
- <th colspan="2" nowrap="nowrap" width="5%">
- <?php echo T_('Reorder')?>
- </th>
- <th width="2%">
- <?php echo T_('Order')?>
- </th>
- <th width="1%">
- <img id="saveorder" class="saveorder-icon" src="images/filesave.png" width="16" height="16" alt="<?php echo T_('Save Order'); ?>" />
- </th>
- <th nowrap="nowrap" width="10%">
- <?php echo T_('Access')?>
- </th>
- <th nowrap="nowrap" align="left" width="10%">
- <?php echo T_('Type')?>
- </th>
- <th nowrap="nowrap" align="left" width="10%">
- <?php echo T_('File')?>
- </th>
- </tr>
- <?php
- $k = 0;
- for ($i=0, $n=count( $rows ); $i < $n; $i++) {
- $row = &$rows[$i];
- $link = htmlentities('index2.php?option=com_mambots&client='. $client .'&task=editA&hidemainmenu=1&id='. $row->id);
- $access = mosCommonHTML::AccessProcessing( $row, $i );
- $checked = mosCommonHTML::CheckedOutProcessing( $row, $i );
- $published = mosCommonHTML::PublishedProcessing( $row, $i );
- ?>
- <tr class="<?php echo "row$k"; ?>">
- <td align="right"><?php echo $pageNav->rowNumber( $i ); ?></td>
- <td>
- <?php echo $checked; ?>
- </td>
- <td>
- <?php
- if ( $row->checked_out && ( $row->checked_out != $my->id ) ) {
- echo $row->name;
- } else {
- ?>
- <a href="<?php echo $link; ?>">
- <?php echo $row->name; ?>
- </a>
- <?php
- }
- ?>
- </td>
- <td align="center">
- <?php echo $published;?>
- </td>
- <td>
- <?php echo $pageNav->orderUpIcon( $i, ($row->folder == @$rows[$i-1]->folder && $row->ordering > -10000 && $row->ordering < 10000) ); ?>
- </td>
- <td>
- <?php echo $pageNav->orderDownIcon( $i, $n, ($row->folder == @$rows[$i+1]->folder && $row->ordering > -10000 && $row->ordering < 10000) ); ?>
- </td>
- <td align="center" colspan="2">
- <input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" class="text_area" style="text-align: center" />
- </td>
- <td align="center">
- <?php echo $access;?>
- </td>
- <td align="left" nowrap="nowrap">
- <?php echo $row->folder;?>
- </td>
- <td align="left" nowrap="nowrap">
- <?php echo $row->element;?>
- </td>
- </tr>
- <?php
- $k = 1 - $k;
- }
- ?>
- </table>
- <?php echo $pageNav->getListFooter(); ?>
- <input type="hidden" name="option" value="<?php echo $option;?>" />
- <input type="hidden" name="task" value="" />
- <input type="hidden" name="client" value="<?php echo $client;?>" />
- <input type="hidden" id="boxchecked" name="boxchecked" value="0" />
- <input type="hidden" id="hidemainmenu" name="hidemainmenu" value="0" />
- </form>
- <?php
- $rowCount = count( $rows );
- $saveOrderCount = $rowCount - 1;
- $tag = <<<JSTAG
- <script type="text/javascript">
- //Setup the check all onclick handler
- YAHOO.util.Event.addListener("check_all", "click", function() {
- YAHOO.miacms.base.checkAll($rowCount);
- });
- //Setup filter event handlers
- YAHOO.util.Event.addListener("search", "change", function() {
- YAHOO.util.Dom.get("adminForm").submit();
- });
- YAHOO.util.Event.addListener("filter_type", "change", function() {
- YAHOO.util.Dom.get("adminForm").submit();
- });
- //Setup save icon event handler
- YAHOO.util.Event.addListener("saveorder", "click", function() {
- YAHOO.miacms.base.saveorder($saveOrderCount);
- });
- </script>
- JSTAG;
- $mainframe->addCustomFootTag($tag);
- }
- /**
- * Writes the edit form for new and existing module
- *
- * A new record is defined when <var>$row</var> is passed with the <var>id</var>
- * property set to 0.
- * @param mosCategory The category object
- * @param array <p>The modules of the left side. The array elements are in the form
- * <var>$leftorder[<i>order</i>] = <i>label</i></var>
- * where <i>order</i> is the module order from the db table and <i>label</i> is a
- * text label associciated with the order.</p>
- * @param array See notes for leftorder
- * @param array An array of select lists
- * @param object Parameters
- */
- function editMambot( &$row, &$lists, &$params, $option ) {
- global $mosConfig_live_site, $mainframe;
- $row->nameA = '';
- if ( $row->id ) {
- $row->nameA = '<small><small>[ '. $row->name .' ]</small></small>';
- }
- ?>
- <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
- <table class="adminheading">
- <tr>
- <th class="mambots">
- <?php echo T_('Site Mambot:')?>
- <small>
- <?php echo $row->id ? T_('Edit') : T_('New');?>
- </small>
- <?php echo $row->nameA; ?>
- </th>
- </tr>
- </table>
- <form action="index2.php" method="post" id="adminForm" name="adminForm">
- <table cellspacing="0" cellpadding="0" width="100%">
- <tr valign="top">
- <td width="60%" valign="top">
- <table class="adminform">
- <tr>
- <th colspan="2">
- <?php echo T_('Mambot Details'); ?>
- </th>
- <tr>
- <tr>
- <td width="100" align="left">
- <?php echo T_('Name:'); ?>
- </td>
- <td>
- <input class="text_area" type="text" name="name" size="35" value="<?php echo $row->name; ?>" />
- </td>
- </tr>
- <tr>
- <td valign="top" align="left">
- <?php echo T_('Folder:'); ?>
- </td>
- <td>
- <?php echo $lists['folder']; ?>
- </td>
- </tr>
- <tr>
- <td valign="top" align="left">
- <?php echo T_('Mambot file:'); ?>
- </td>
- <td>
- <input class="text_area" type="text" name="element" size="35" value="<?php echo $row->element; ?>" />.php
- </td>
- </tr>
- <tr>
- <td valign="top" align="left">
- <?php echo T_('Mambot Order:'); ?>
- </td>
- <td>
- <?php echo $lists['ordering']; ?>
- </td>
- </tr>
- <tr>
- <td valign="top" align="left">
- <?php echo T_('Access Level:'); ?>
- </td>
- <td>
- <?php echo $lists['access']; ?>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <?php echo T_('Published:'); ?>
- </td>
- <td>
- <?php echo $lists['published']; ?>
- </td>
- </tr>
- <tr>
- <td valign="top" colspan="2">
- </td>
- </tr>
- <tr>
- <td valign="top">
- <?php echo T_('Description:'); ?>
- </td>
- <td>
- <?php echo $row->description; ?>
- </td>
- </tr>
- </table>
- </td>
- <td width="40%">
- <table class="adminform">
- <tr>
- <th colspan="2">
- <?php echo T_('Parameters'); ?>
- </th>
- <tr>
- <tr>
- <td>
- <?php
- if ( $row->id ) {
- echo $params->render();
- } else {
- echo '<i>'.T_('No Parameters').'</i>';
- }
- ?>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <input type="hidden" name="option" value="<?php echo $option; ?>" />
- <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
- <input type="hidden" name="client" value="<?php echo $row->client_id; ?>" />
- <input type="hidden" name="task" value="" />
- </form>
- <?php
- //Define heredoc vars
- $nameMsg = T_('Mambot must have a name');
- $filenameMsg = T_('Mambot must have a filename');
- $tag = <<<JSTAG
- <script type="text/javascript">
- YAHOO.util.Event.on(window, "load", function() {
- YAHOO.miacms.base.submitbutton = function(pressbutton) {
- if (pressbutton === "cancel") {
- YAHOO.miacms.base.submitform(pressbutton);
- return;
- }
- // validation
- var form = YAHOO.util.Dom.get("adminForm") || document.adminForm;
- if (YAHOO.miacms.base.trim(form.name.value) === "") {
- alert( '$nameMsg' );
- } else if (YAHOO.miacms.base.trim(form.element.value) === "") {
- alert( '$filenameMsg' );
- } else {
- YAHOO.miacms.base.submitform(pressbutton);
- }
- };
- });
- </script>
- JSTAG;
- $mainframe->addCustomFootTag($tag);
- }
- }
- ?>