function Form($name, $entity, $method = "GET")
 {
     /* can the name of the form be given in an automated way,
     		using maybe an identified which is generated from the
     		timestamp ? */
     $this->name = $name;
     $this->method = $method;
     $this->formNo++;
     /* this is used to control the visibility of the "delete" button
     		in the form while the EDIT mode */
     $this->noDelete = false;
     /* this is used to denote that the form has a POSITION widget type */
     $this->withPosition = false;
     /* the following denotes that the current form will be
     		triggered by some other form, the invoking form is referred
     		in triggerForm */
     $this->triggered = false;
     $this->triggeredForm = false;
     $this->triggeredForms = false;
     $this->moderationMode = false;
     /* the following is the DTML template path */
     $this->templatePath = "dtml";
     $this->labels[ADD] = "Aggiungi";
     $this->labels[EDIT] = "Modifica";
     $this->labels[DELETE] = "Rimuovi";
     $this->labels['MSG_SURE'] = "Sei sicuro";
     $this->labels['MSG_UPDATE'] = "The item has been correctly updated!";
     $this->entity = $entity;
     $content_js = "<script language=\"JavaScript\" src=\"js/calendar.js\"></script>\n";
     $content_js .= "<script language=\"JavaScript\" src=\"js/position.js\"></script>\n";
     //$content_js .= "<script src=\"js/plugin_colorpicker.js\" type=\"text/JavaScript\"></script>\n";
     $content_js .= "<script language=\"JavaScript\" src=\"js/ajax-decode-2.js\"></script>\n";
     $content_style = "<LINK REL=STYLESHEET HREF=\"css/calendar.css\" TYPE=\"text/css\">\n";
     $content_style .= "<link href=\"css/plugin_colorpicker.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
     $GLOBALS['main']->setContentOnce("javascript", "{$content_js}");
     $GLOBALS['main']->setContentOnce("style", $content_style);
     /* RSS enabled entities management */
     if ($this->entity->rss) {
         $new_form = new Form("Channel-gestion", $this->entity->channel);
         $new_form->mainFormEntity = $this->entity;
         $new_form->addRelationManager("bc_channel", '<img src="img/rss/rss.gif" />');
         $this->triggers($new_form);
     }
     $this->reportTemplate = "dtml/report.html";
     $this->reportQuery = "";
     if ($_REQUEST['formname'] == $this->name) {
         $this->active = true;
     } else {
         if ($_REQUEST['page'] == 0) {
             $this->active = true;
         } else {
             $this->active = false;
         }
     }
     $this->jquery = true;
     $GLOBALS['currentform'] =& $this;
 }
$form->addText("name", "Name", 40, MANDATORY);
$form->addText("script", "Script", 60, MANDATORY);
$form->addEditor("des", "Description", 15, 40);
//$form->addFile("icon", "Icon");
$form->addSection("Menu");
$form->addText("entry", "Menu Entry", 40, MANDATORY);
$form->addSelectFromReference2($servicecategoryEntity, "servicecategory", "Category");
$form->addHierarchicalPosition("position", "Position", "name", "servicecategory");
$form->addCheck("Visible", ":visible:*:*");
$form->addSection("Data filtering");
$form->addSelectFromReference2($entitiesEntity, "id_entities", "Entity");
$form->restrictReference("id_entities", "owner = '1' or name = '{$usersEntity->name}' or name = '{$logEntity->name}'");
$form->addSelectFromReference2($groupsEntity, "superuser_group", "Superuser Group");
$form_groups = new Form("dataEntry2", $servicesGroupsRelation);
$form->addSection("Groups");
$form_groups->addRelationManager("groups", "Groups");
$form->triggers($form_groups);
if (!isset($_REQUEST['action'])) {
    $_REQUEST['action'] = "edit";
}
switch ($_REQUEST['action']) {
    case "add":
        $main->setContent("body", $form->addItem());
        break;
    case "edit":
        $main->setContent("body", $form->editItem());
        break;
}
$main->close();
?>
 
<?php

session_start();
require "include/template2.inc.php";
require "include/beContent.inc.php";
require "include/auth.inc.php";
$main = new Skin();
$form = new Form("dataEntry", $groupsEntity);
$form->addSection("Group Management");
$form->addText("name", "Name", 40, MANDATORY);
$form->addEditor("description", "Description", 17, 120);
$form_services = new Form("dataEntry2", $servicesGroupsRelation);
$form_services->addRelationManager("services", "Services", LEFT);
$form->triggers($form_services);
$form_users = new Form("dataEntry3", $usersGroupsRelation);
$form_users->addRelationManager("users", "Users", LEFT);
$form->triggers($form_users);
switch ($_REQUEST['action']) {
    case "add":
        $main->setContent("body", $form->addItem());
        break;
    case "edit":
        $main->setContent("body", $form->editItem());
        break;
}
$main->close();
?>