<?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('config.inc.php');
include_once('classes/core/Site.class.php');
include_once('classes/core/forms/EditionForm.class.php');
include_once('classes/core/forms/GroupForm.class.php');

include_once('classes/core/groups/Group.class.php');
include_once('classes/core/groups/GroupsManager.class.php');

include_once('interface/egScript.class.php');
include_once('interface/egManager.class.php');
include_once('interface/egContainer.class.php');
include_once('interface/egMenuItem.class.php');
include_once('interface/egFrame.class.php');
include_once('interface/egToolTip.class.php');
include_once('interface/egRichText.class.php');
include_once('interface/egLink.class.php');
include_once('interface/egStatic.class.php');
include_once('interface/egEdit.class.php');
include_once('interface/egCheckBox.class.php');
include_once('interface/egRadioButton.class.php');
include_once('interface/egPressButton.class.php');
include_once('interface/egDropDownListBox.class.php');
include_once('interface/egDropDownPropertyList.class.php');
include_once('interface/egPropertyList.class.php');
include_once('interface/egPropertySheet.class.php');
include_once('interface/egPropertyPage.class.php');

/**
* GroupEditionForm : edition form for Groups
*
* @access   public
* @author	Cedric Francoys <cedric.francoys@easy-cms.org>
* @version	GroupEditionForm.class, Sun Dec 26 16:41:28 CET 2004
* @package	Forms
*/
class GroupEditionForm extends EditionForm {
	/**
	 * Class constructor.
	 *
	 * @access   public
 	 * @param    string    The mode in which the form is to be displayed.
 	 * @return   void
	 */
	function GroupEditionForm(&$group, &$groupsManager) {
		parent::EditionForm($group, $groupsManager);
	}

	function populateUIContainer(&$guiContainer, $currLangId, $action) {
		if($action == ASK_DELETE_GROUP) {
      $summary = '';
      $invalid_groups = array(GROUP_ID_ADMINS, GROUP_ID_EVERYONE);
 			$summary .= "<b>".LANG_GROUP_IDENTIFIER_STATIC." :</b> ".$this->object->getGroupId();
 			$summary .= "<br /><b>".LANG_GROUP_NAME_STATIC." :</b> ".$this->object->getGroupName();
      if(in_array($this->object->getGroupId(), $invalid_groups)) {
        $summary .= "<br /><br /><font style=\"color: red;\"><b>".LANG_SYSTEM_OBJECT." :<br />".LANG_SYSTEM_OBJECT_DELETION_MESSAGE."</b></font>";
      }
      $txtLang = &new egStatic("sta_1", LANG_GROUP_DELETION_MESSAGE.LANG_COLON."<br /><br />".$summary."<br /><br />".LANG_GROUP_DELETION_CONFIRM, 20, 20, 300, 0);
			$guiContainer->addObject($txtLang);
		}
		else {
  		$previousTop = 40;

      $txtItemName = &new egStatic("txt_item_name", LANG_GROUP_NAME_STATIC.LANG_COLON, 5, $previousTop, 80, 0, true);
   		$objItemName = &new egEdit("obj_item_name", $this->object->getGroupName(), 90, $previousTop, 290, 18, 'name');
  		$previousTop += 50;

      $txtItemDescription = &new egStatic("txt_item_description", LANG_GROUP_DESCRIPTION_STATIC.LANG_COLON, 5, $previousTop, 80, 0, true);
  		$objItemDescription = &new egEdit("obj_item_description", $this->object->getGroupDescription(), 90, $previousTop, 290, 18, 'description');
  		$previousTop += 50;

  	  //var $disabled;

  		$guiContainer->addObject($txtItemName);
  		$guiContainer->addObject($objItemName);

  		$guiContainer->addObject($txtItemDescription);
  		$guiContainer->addObject($objItemDescription);

      return '';
    }
  }
}
?>