<?php
/*
 * This file is part of the Easy-CMS project.
 * Easy-CMS 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; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * Easy-CMS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Easy-CMS; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
/**
 * @package    Core
 * @subpackage Forms
 */

/**
 */
include_once('classes/core/Site.class.php');
include_once('classes/core/forms/EditionForm.class.php');

include_once('classes/core/containersLists/ContainersList.class.php');
include_once('classes/core/containersLists/ContainersListsManager.class.php');

include_once('classes/core/forms/ObjectForm.class.php');
include_once('classes/core/forms/ContainersListForm.class.php');
include_once('classes/core/forms/ACLForm.class.php');
/**
* ContainersListEditionForm : edition form for ContainersLists
*
* @access   public
* @author	Cedric Francoys <cedric.francoys@easy-cms.org>
* @version	ContainersListEditionForm.class, Sun Dec 26 16:41:36 CET 2004
* @package	Forms
*/
class ContainersListEditionForm extends EditionForm {
	
	/**
	* Class constructor.
	* 
	* @access   public
 	* @param    string    The mode in which the form is to be displayed.	
 	* @return   void  
	*/	  
	function ContainersListEditionForm(&$containersList, &$containersListsManager) {
		parent::EditionForm($containersList, $containersListsManager);
	}

	function populateUIContainer(&$guiContainer, $currLangId, $action) {
		$valuesTable = &$this->object->getContainersListValuesTable();

		$previousTop = 25;

		$idText = &new egStatic("st_value_name", LANG_CONTAINERSLIST_IDENTIFIER_STATIC.' :', 5, $previousTop, 80, 0, true);
		$idValue = &new egStatic("obj_item_name", $valuesTable['id'], 90, $previousTop, 80, 0);
		$previousTop += 30;

    $cloneText = &new egStatic("st_value_clone", LANG_CONTAINERSLIST_CLONE_STATIC.' :', 5, $previousTop, 80, 0, true);
    $cloneValue = &new egEdit("obj_item_clone", $valuesTable['clone_id'], 90, $previousTop, 33, 18, 'clone_id');
    $cloneComment = &new egStatic("st_value_clone_comment", LANG_CONTAINERSLIST_CLONE_COMMENT_STATIC, 133, $previousTop, 200, 0);
 		$previousTop += 30;

    $showText = &new egStatic("st_value_show", LANG_CONTAINERSLIST_SHOW_STATIC.' :', 5, $previousTop, 80, 0, true);
		$showValue = &new egEdit("obj_item_show", $valuesTable['count_shown'], 90, $previousTop, 33, 18, 'count_shown');
    $showComment = &new egStatic("st_comment_show", '<b>'.LANG_CONTAINERSLIST_ITEMS_STATIC.'</b> '.LANG_CONTAINERSLIST_SHOW_COMMENT_STATIC, 133, $previousTop, 200, 0);
 		$previousTop += 25;

    $orderText = &new egStatic("st_value_order", LANG_CONTAINERSLIST_ORDER_STATIC.' :', 5, $previousTop, 80, 0, true);
    $orderManual = &new egRadiobutton("obj_item_order_manual", LANG_CONTAINERSLIST_MANUALSORT_STATIC, 90, $previousTop, 100, null, "sorting_type", SORTING_BY_LIST, ($valuesTable['sorting_type'] == SORTING_BY_LIST));
    $orderAuto = &new egRadiobutton("obj_item_order_auto", LANG_CONTAINERSLIST_AUTOSORT_STATIC, 220, $previousTop, 100, null, "sorting_type", SORTING_BY_FIELD, ($valuesTable['sorting_type'] == SORTING_BY_FIELD));
 		$previousTop += 40;

    $sortByText = &new egStatic("st_value_sort_by", LANG_CONTAINERSLIST_SORT_STATIC.' :', 5, $previousTop, 80, 0, true);
  	$sortByValue = &new egDropDownListBox("obj_item_sort_field", 90, $previousTop, 100, null, 'sort_field');
    $sortByValue->addListItem(new egListItem("lti_field_id", LANG_CONTAINER_IDENTIFIER_STATIC, null, 'id'));
    $sortByValue->addListItem(new egListItem("lti_field_name", LANG_CONTAINER_NAME_STATIC, null, 'name'));
    $sortByValue->setSelectedItemByValue($valuesTable['sort_field']);

    $sortOnText = &new egStatic("st_value_sort_on", LANG_CONTAINERSLIST_ON_STATIC, 210, $previousTop, 80, 0, true);

    $sortOrderContainer = &new egContainer('edt_sort_order_ctn', 250, $previousTop-10, 150, 60, true);
    $sortOnAsc  = &new egRadiobutton("obj_item_sort_on_asc", LANG_CONTAINERSLIST_ASCENDING_STATIC, 0, 0, 100, null, "sort_order", SORT_ASCENDING, ($valuesTable['sort_order'] == SORT_ASCENDING));
    $sortOnDesc = &new egRadiobutton("obj_item_sort_on_desc", LANG_CONTAINERSLIST_DESCENDING_STATIC, 0, 25, 100, null, "sort_order", SORT_DESCENDING, ($valuesTable['sort_order'] == SORT_DESCENDING));
    $sortOrderContainer->addObject($sortOnAsc);
    $sortOrderContainer->addObject($sortOnDesc);

		$guiContainer->addObject($idText);
		$guiContainer->addObject($idValue);

		$guiContainer->addObject($cloneText);
		$guiContainer->addObject($cloneValue);
		$guiContainer->addObject($cloneComment);

		$guiContainer->addObject($orderText);
		$guiContainer->addObject($orderManual);
		$guiContainer->addObject($orderAuto);

		$guiContainer->addObject($showText);
		$guiContainer->addObject($showValue);
		$guiContainer->addObject($showComment);

		$guiContainer->addObject($sortByText);
	  $guiContainer->addObject($sortByValue);

		$guiContainer->addObject($sortOnText);
		$guiContainer->addObject($sortOrderContainer);

		return "";
	}
}

?>