From 135d487c88c623a96bbfac4cdf82259db1b1e017 Mon Sep 17 00:00:00 2001 From: Cyril Vazquez <cyril.vazquez@maarch.org> Date: Fri, 22 Feb 2013 16:00:56 +0000 Subject: [PATCH] Evo: listmodel_types --- entities/trunk/admin_entities.php | 9 +- entities/trunk/admin_listmodel.php | 208 ++++++++++++++++++ .../trunk/admin_listmodel_objectId_input.php | 103 +++++++++ entities/trunk/admin_listmodel_type.php | 122 ++++++++++ .../trunk/admin_listmodel_type_validate.php | 63 ++++++ entities/trunk/admin_listmodel_types.php | 126 +++++++++++ entities/trunk/admin_listmodel_validate.php | 18 ++ entities/trunk/admin_listmodels.php | 158 +++++++++++++ .../trunk/class/class_manage_listdiff.php | 171 ++++++++------ entities/trunk/creation_listmodel.php | 143 ++++++------ entities/trunk/entities_tables.php | 3 + entities/trunk/js/functions.js | 87 ++++++++ entities/trunk/lang/fr.php | 52 ++++- entities/trunk/load_listinstance.php | 3 +- entities/trunk/param_entity_listmodel.php | 28 ++- entities/trunk/xml/services.xml | 16 +- 16 files changed, 1160 insertions(+), 150 deletions(-) create mode 100644 entities/trunk/admin_listmodel.php create mode 100644 entities/trunk/admin_listmodel_objectId_input.php create mode 100644 entities/trunk/admin_listmodel_type.php create mode 100644 entities/trunk/admin_listmodel_type_validate.php create mode 100644 entities/trunk/admin_listmodel_types.php create mode 100644 entities/trunk/admin_listmodel_validate.php create mode 100644 entities/trunk/admin_listmodels.php diff --git a/entities/trunk/admin_entities.php b/entities/trunk/admin_entities.php index 59e51cf8029..c6597d1a32a 100644 --- a/entities/trunk/admin_entities.php +++ b/entities/trunk/admin_entities.php @@ -70,9 +70,14 @@ unset($_SESSION['m_admin']); <strong><?php echo _LISTINSTANCE_ROLES;?></strong> </div> </div> - <!--div class="admin_item" id="admin_listmodels" title="<?php echo _LISTMODELS_DESC;?>" onclick="window.top.location='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=admin_listmodels&module=entities';"> + <div class="admin_item" id="admin_listmodel_types" title="<?php echo _LISTMODEL_TYPES_DESC;?>" onclick="window.top.location='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=admin_listmodel_types&module=entities';"> + <div class="sum_margin"> + <strong><?php echo _LISTMODEL_TYPES;?></strong> + </div> + </div> + <div class="admin_item" id="admin_listmodels" title="<?php echo _LISTMODELS_DESC;?>" onclick="window.top.location='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=admin_listmodels&module=entities';"> <div class="sum_margin"> <strong><?php echo _LISTMODELS;?></strong> </div> - </div--> + </div> </div> diff --git a/entities/trunk/admin_listmodel.php b/entities/trunk/admin_listmodel.php new file mode 100644 index 00000000000..787c9d3db58 --- /dev/null +++ b/entities/trunk/admin_listmodel.php @@ -0,0 +1,208 @@ +<?php + +require_once 'modules/entities/class/class_manage_listdiff.php'; +$core_tools = new core_tools(); + +$admin = new core_tools(); +$admin->test_admin('admin_listmodels', 'entities'); + /****************Management of the location bar ************/ +$init = false; +if(isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if(isset($_REQUEST['level']) &&($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=amdin_listmodel&module=entities'; +$page_label = _ADMIN_LISTMODEL; +$page_id = "amdin_listmodel"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); + +$listdiff = new diffusion_list(); +$roles = $listdiff->get_listinstance_roles(); +$listmodel_types = $listdiff->get_listmodel_types(); +/* +$params ['mode'] : 'listmodel' or 'listinstance' (mandatory) + ['table'] : table to update (mandatory) + ['object_id'] : Object identifier linked to the diffusion list, entity identifier (mandatory if mode = 'listmodel') + ['coll_id'] : Collection identifier (mandatory if mode = 'listinstance') + ['res_id'] : Resource identifier (mandatory if mode = 'listinstance') + ['user_id'] : User identifier of the person who add an item in the list + ['concat_list'] : True or false (can be set only in 'listinstance' mode )*/ + +# Load listmodel into session +switch ($_REQUEST['mode']) { +case 'add': + if(!isset($_SESSION['m_admin']['entity']['listmodel'])) { + # First load (add action on list) + $objectType = ''; + $objectId = ''; + } else { + # list already loaded and managed (reload after update of list) + $objectType = $_SESSION['m_admin']['entity']['listmodel_objectType']; + $objectId = $_SESSION['m_admin']['entity']['listmodel_objectId']; + $objectTypeLabel = $listmodel_types['objectType']; + } + break; + +case 'up' : + if(!isset($_SESSION['m_admin']['entity']['listmodel'])) { + # First load (up action on list) + $objectType = trim(strtok($_REQUEST['id'], ' ')); + $objectId = strtok(' '); + $_SESSION['m_admin']['entity']['listmodel'] = + $listdiff->get_listmodel( + $objectType, + $objectId + ); + $_SESSION['m_admin']['entity']['listmodel_objectType'] = $objectType; + $_SESSION['m_admin']['entity']['listmodel_objectId'] = $objectId; + } else { + # list already loaded and managed (reload after update of list) + $objectType = $_SESSION['m_admin']['entity']['listmodel_objectType']; + $objectId = $_SESSION['m_admin']['entity']['listmodel_objectId']; + } + break; +} +?> +<h1 class="tit"><?php + echo _ADMIN_LISTMODEL; + if($objectType) echo ' : ' . $objectTypeLabel; + if($objectId) echo " " . $objectId; + ?> +</h1> +<br/> +<h2><?php echo _ADMIN_LISTMODEL_TITLE; ?></h2> +<div id="listmodel_box" class="block"> + <h2 class="tit"><?php echo _LINKED_DIFF_LIST;?> : </h2><?php + if($_SESSION['m_admin']['entity']['listmodel']['dest']['user_id']) { ?> + <p class="sstit"><?php echo _RECIPIENT;?></p> + <table cellpadding="0" cellspacing="0" border="0" class="listingsmall list_diff spec"> + <tr > + <td> + <img src="<?php echo $_SESSION['config']['businessappurl'].'static.php?filename=manage_users_entities_b_small.gif&module=entities';?>" alt="<?php echo _USER;?>" title="<?php echo _USER;?>" /> + </td> + <td><?php echo $_SESSION['m_admin']['entity']['listmodel']['dest']['lastname'];?></td> + <td><?php echo $_SESSION['m_admin']['entity']['listmodel']['dest']['firstname'];?></td> + <td><?php echo $_SESSION['m_admin']['entity']['listmodel']['dest']['entity_label']; ?></td> + </tr> + </table> + <br/> <?php + } + foreach($roles as $role_id => $role_config) { + if(count($_SESSION['m_admin']['entity']['listmodel'][$role_id]['users']) > 0 + || count($_SESSION['m_admin']['entity']['listmodel'][$role_id]['entities']) > 0 + ) { ?> + <h2 class="sstit"><?php echo $role_config['list_label'];?></h2> + <table cellpadding="0" cellspacing="0" border="0" class="listingsmall liste_diff spec"> + <?php + $color = ' class="col"'; + for($i=0, $l=count($_SESSION['m_admin']['entity']['listmodel'][$role_id]['users']); + $i<$l; + $i++ + ) { + if ($color == ' class="col"') $color = ' '; + else $color = ' class="col"'; ?> + <tr <?php echo $color; ?> > + <td> + <img src="<?php echo $_SESSION['config']['businessappurl'] ?>static.php?filename=manage_users_entities_b_small.gif&module=entities" alt="<?php echo _USER . " " . $list_config['role_label'] ;?>" title="<?php echo _USER . " " . $list_config['role_label'] ; ?>" /> + </td> + <td ><?php echo $_SESSION['m_admin']['entity']['listmodel'][$role_id]['users'][$i]['lastname']; ?></td> + <td ><?php echo $_SESSION['m_admin']['entity']['listmodel'][$role_id]['users'][$i]['firstname'];?></td> + <td><?php echo $_SESSION['m_admin']['entity']['listmodel'][$role_id]['users'][$i]['entity_label']; ?></td> + </tr> <?php + } + $color = ' class="col"'; + for ($i=0, $l=count($_SESSION['m_admin']['entity']['listmodel'][$role_id]['entities']); + $i<$l; + $i++ + ) { + if ($color == ' class="col"') $color = ''; + else $color = ' class="col"';?> + <tr <?php echo $color; ?> > + <td> + <img src="<?php echo $_SESSION['config']['businessappurl'] ?>static.php?filename=manage_entities_b_small.gif&module=entities" alt="<?php echo _ENTITY . " " . $list_config['role_label'] ;?>" title="<?php echo _ENTITY . " " . $list_config['role_label'] ; ?>" /> + </td> + <td ><?php echo $_SESSION['m_admin']['entity']['listmodel'][$role_id]['entities'][$i]['entity_id']; ?></td> + <td ><?php echo $_SESSION['m_admin']['entity']['listmodel'][$role_id]['entities'][$i]['entity_label']; ?></td> + <td> </td> + </tr> <?php + } ?> + </table> + <br/> <?php + } + } ?> + <p class="buttons"> + <input type="button" onclick="openListmodel()" class="button" value="<?php echo _MODIFY_LIST;?>" /> + </p> +</div> +<div> + <table width="50%"> + <tr height="20px;"/> + <tr> + <td width="33%"> + <label for="objectType" ><?php echo _OBJECT_TYPE; ?>: </label> + </td> + <td> + <select id="objectType" <?php if($objectId) echo "disabled='true'"; ?> onChange="getObjectIdInput()" style="width:300px;"> + <option value="" ><?php echo _SELECT_OBJECT_TYPE; ?></option><?php + foreach($listmodel_types as $listmodel_type_id => $listmodel_type_label) { ?> + <option value="<?php echo $listmodel_type_id; ?>" <?php if($objectType == $listmodel_type_id) echo "selected='true'"; ?> ><?php echo $listmodel_type_label; ?></option><?php + } ?> + </select> + </td> + </tr> + <tr> + <td> + <label for="objectId" ><?php echo _ID; ?> : </label> + </td> + <td> + <div id="objectId_input"><?php + if(!$objectId) { ?> + <select id="objectId" style="width:300px;"> + <option value=""><?php echo _SELECT_OBJECT_TYPE; ?></option> + </select><?php + } else if($objectId) { ?> + <input type="text" id="objectId" readonly='true' style="width:300px;" value="<?php echo $objectId; ?>" /><?php + } ?> + </div> + </td> + </tr> + </table> + <br/> + <br/> + <p class="buttons"><?php + if($objectId) { ?> + <input type="button" onclick="saveListmodel();" class="button" value="<?php echo _SAVE_LISTMODEL;?>" /><?php + } ?> + <input type="button" onclick="goTo('index.php?module=entities&page=admin_listmodels');" class="button" value="<?php echo _CANCEL;?>" /> + </p> +</div> +<script type="text/javascript"> + function openListmodel() +{ + var main_error = $('main_error'); + var objectType = $('objectType').value; + var objectId = $('objectId').value; + + if(objectType && objectId) { + var idValid = isIdToken(objectId); + if(idValid == false) { + main_error.innerHTML = '<?php echo _OBJECT_ID_IS_NOT_VALID_ID; ?>'; + return; + } + main_error.innerHTML = ''; + window.open( + '<?php echo $_SESSION['config']['businessappurl']?>index.php?display=true&module=entities&page=creation_listmodel&objectType='+objectType+'&objectId='+objectId, + '', + 'scrollbars=yes,menubar=no,toolbar=no,status=no,resizable=yes,width=1024,height=650,location=no' + ); + }else + main_error.innerHTML = '<?php echo _SELECT_OBJECT_TYPE_AND_ID; ?>'; +} + +</script> + diff --git a/entities/trunk/admin_listmodel_objectId_input.php b/entities/trunk/admin_listmodel_objectId_input.php new file mode 100644 index 00000000000..bb5d7f7f68e --- /dev/null +++ b/entities/trunk/admin_listmodel_objectId_input.php @@ -0,0 +1,103 @@ +<?php +# loadListmodelObjects +# AJAX script to list objects to be linked with list model + +function asSelect( + $items +) { + $return = "<select id='objectId' style='width:300px;'>"; + + foreach($items as $id => $label) { + $return .= "<option value='".$id."'>".$id . ' - ' .$label."</option>"; + } + $return .= "</select>"; + return $return; +} + +require_once 'core/class/class_core_tools.php'; +$core = new core_tools(); +$core->load_lang(); + +require_once 'modules/entities/class/class_manage_listdiff.php'; +$difflist = new diffusion_list(); + +switch($_REQUEST['objectType']) { +case 'entity_id': + require_once 'modules/entities/class/class_manage_entities.php'; + $ent = new entity(); + $entity_ids = $ent->get_all_entities_id_user(); + $entities = array(); + for($i=0, $l=count($entity_ids); + $i<$l; + $i++ + ) { + $entity_id = substr($entity_ids[$i], 1, -1); + $existinglist = + $difflist->get_listmodel( + 'entity_id', + $entity_id + ); + if(count($existinglist) == 0) { + $entities[$entity_id] = $ent->getentitylabel($entity_id); + } + } + if(count($entities) > 0) + echo asSelect($entities); + else { + echo asSelect(array("" => _ALL_OBJECTS_ARE_LINKED)); + } + break; + +case 'type_id': + require_once 'core/class/class_db.php'; + require_once 'core/core_tables.php'; + $db = new dbquery(); + $db->connect(); + $db->query("SELECT type_id, description FROM " . DOCTYPES_TABLE); + while($doctype = $db->fetch_object()) { + $type_id = $doctype->type_id; + $existinglist = + $difflist->get_listmodel( + 'type_id', + $type_id + ); + if(count($existinglist) == 0) { + $doctypes[$type_id] = $doctype->description; + } + } + if(count($doctypes) > 0) + echo asSelect($doctypes); + else + echo asSelect(array("" => _ALL_OBJECTS_ARE_LINKED)); + + break; + +case 'foldertype_id': + require_once 'core/class/class_db.php'; + require_once 'modules/folder/folder_tables.php'; + $db = new dbquery(); + $db->connect(); + $db->query("SELECT foldertype_id, foldertype_label FROM " . FOLD_FOLDERTYPES_TABLE); + while($foldertype = $db->fetch_object()) { + $foldertype_id = $foldertype->foldertype_id; + $existinglist = + $difflist->get_listmodel( + 'foldertype_id', + $foldertype_id + ); + if(count($existinglist) == 0) { + $foldertypes[$foldertype_id] = $foldertype->foldertype_label; + } + } + if(count($foldertypes) > 0) + echo asSelect($foldertypes); + else + echo asSelect(array("" => _ALL_OBJECTS_ARE_LINKED)); + break; + +case 'user_defined_id': +default: + echo "<input type='text' id='objectId' style='width:300px;' />"; + break; +} + diff --git a/entities/trunk/admin_listmodel_type.php b/entities/trunk/admin_listmodel_type.php new file mode 100644 index 00000000000..48b1236ce2b --- /dev/null +++ b/entities/trunk/admin_listmodel_type.php @@ -0,0 +1,122 @@ +<?php +/* +* +* Copyright 2008,2012 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework 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 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +* +* @author Cyril Vazquez <dev@maarch.org> +*/ + +$admin = new core_tools(); +$admin->test_admin('admin_listmodel_types', 'entities'); +$_SESSION['m_admin']= array(); +/****************Management of the location bar ************/ +$init = false; +if(isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if(isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=admin_listmodel_type&module=entities'; +$page_label = _LISTMODEL_TYPE; +$page_id = "admin_listmodel_type"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +#****************************************************************************** + +require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_list_show.php"); +require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); +require_once("modules/entities/entities_tables.php"); + +# Prepare view for UP/ADD +#****************************************************************************** +$view = new DOMDocument(); +$view->loadHTMLFile( + __DIR__ . DIRECTORY_SEPARATOR . 'html' + . DIRECTORY_SEPARATOR . 'admin_listmodel_type.html' +); +$xview = new DOMXPath($view); + +# Set action mode +$mode = $view->getElementById("mode"); +$mode->setAttribute('value', $_REQUEST['mode']); + +# Translate +$labels = $view->getElementsByTagName('label'); +for($i=0, $l=$labels->length; $i<$l; $i++) { + $label = $labels->item($i); + $const = $label->nodeValue; + if($text = @constant($const)) + $label->nodeValue = $text; +} +$buttons = $xview->query('//input[@type="button"]'); +for($i=0, $l=$buttons->length; $i<$l; $i++) { + $button = $buttons->item($i); + $value = $button->getAttribute('value'); + if($text = @constant($value)) + $button->setAttribute('value', $text); +} + +# Manage local path +$cancel_btn = $view->getElementById("cancel"); +$cancel_btn->setAttribute( + 'onclick', + "goTo('index.php?module=entities&page=admin_listmodel_types');" +); + +# Get data for UP/DEL +#****************************************************************************** +$request = new request(); +$request->connect(); +$request->query( + "select * from " . ENT_LISTMODEL_TYPES + . " where listmodel_type_id = '".$_REQUEST['id']."' " +); +$listmodel_type = $request->fetch_object(); + +# Switch on mode/action +#****************************************************************************** +switch($_REQUEST['mode']) { +case 'add': + echo $view->saveXML(); + break; + +case 'up': + # listmodel_type id + $listmodel_type_id = $view->getElementById("listmodel_type_id"); + $listmodel_type_id->setAttribute('value', $listmodel_type->listmodel_type_id); + $listmodel_type_id->setAttribute('readonly', 'true'); + $listmodel_type_id->setAttribute('disabled', 'true'); + + # listmodel_type Label + $listmodel_type_label = $view->getElementById("listmodel_type_label"); + $listmodel_type_label->setAttribute('value', $listmodel_type->listmodel_type_label); + + echo $view->saveXML(); + break; + +case "del": + $res = $request->query( + "delete from " . ENT_LISTMODEL_TYPES + . " where listmodel_type_id = '" . $listmodel_type->listmodel_type_id . "'" + ); + echo "<script type='text/javascript'> goTo('".$_SESSION['config']['businessappurl']."index.php?page=admin_listmodel_types&module=entities');</script>"; + break; +} diff --git a/entities/trunk/admin_listmodel_type_validate.php b/entities/trunk/admin_listmodel_type_validate.php new file mode 100644 index 00000000000..f982baf313f --- /dev/null +++ b/entities/trunk/admin_listmodel_type_validate.php @@ -0,0 +1,63 @@ +<?php +/* +listmodel_type_id : $('listmodel_type_id').value, +listmodel_type_label : $('listmodel_type_label').value, +*/ +require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); +require_once("modules/entities/entities_tables.php"); +$request = new request(); +$request->connect(); + +$listmodel_type_id = $request->protect_string_db($_REQUEST['listmodel_type_id']); +$listmodel_type_label = $request->protect_string_db($_REQUEST['listmodel_type_label']); + +# Controls +$errors = false; +if(!empty($listmodel_type_id)) { + $request->query( + "select count(1) as nb from " . ENT_LISTMODEL_TYPES + . " where listmodel_type_id = '" . $listmodel_type_id . "'" + ); + $res = $request->fetch_object(); + $nb = $res->nb; + if($_REQUEST['mode'] == 'add' && $nb == 1) + $errors .= "<br/>" . _LISTMODEL_TYPE_ID_ALREADY_USED; + if($_REQUEST['mode'] == 'up' && $nb == 0) + $errors .= "<br/>" . _LISTMODEL_TYPE_ID_IS_UNKNOWN; +} else { + $errors .= "<br/>" . _LISTMODEL_TYPE_ID_IS_MANDATORY; +} + + +if(empty($listmodel_type_label)) + $errors .= "<br/>" . _LISTMODEL_TYPE_LABEL_IS_MANDATORY; + + +# If errors detected, return html +if($errors) { + echo $errors; + return; +} + +# If no error, proceed +switch($_REQUEST['mode']) { +case 'add': + $res = $request->query( + "insert into " . ENT_LISTMODEL_TYPES + . " (listmodel_type_id, listmodel_type_label)" + . " values (" + . "'" . $listmodel_type_id . "'," + . "'" . $listmodel_type_label . "')" + ); + + break; +case 'up': + $res = $request->query( + "update " . ENT_LISTMODEL_TYPES + . " set " + . " listmodel_type_label = '" . $listmodel_type_label . "'" + . " where listmodel_type_id = '" . $listmodel_type_id . "'" + ); + break; + +} \ No newline at end of file diff --git a/entities/trunk/admin_listmodel_types.php b/entities/trunk/admin_listmodel_types.php new file mode 100644 index 00000000000..5ed9d441131 --- /dev/null +++ b/entities/trunk/admin_listmodel_types.php @@ -0,0 +1,126 @@ +<?php +/* +* +* Copyright 2008,2012 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework 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 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +* +* @author Cyril Vazquez <dev@maarch.org> +*/ + +$admin = new core_tools(); +$admin->test_admin('admin_listmodel_types', 'entities'); +$_SESSION['m_admin']= array(); +/****************Management of the location bar ************/ +$init = false; +if(isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if(isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=admin_listmodel_types&module=entities'; +$page_label = _LISTMODEL_TYPES; +$page_id = "admin_listmodel_types"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ + +require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_list_show.php"); +require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); +require_once("modules/entities/entities_tables.php"); + +$func = new functions(); +$request = new request; + +$what = ''; +$where = ''; + +$list = new list_show(); + +if(isset($_REQUEST['what']) && !empty($_REQUEST['what'])) +{ + $what = $func->protect_string_db($_REQUEST['what']); + $where = " lower(listmodel_type_label) like lower('".$what."%')"; +} + +$order = 'asc'; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +$field = 'listmodel_type_id'; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $field = trim($_REQUEST['order_field']); +} + +$orderstr = $list->define_order($order, $field); + +$select[ENT_LISTMODEL_TYPES] = array(); +array_push($select[ENT_LISTMODEL_TYPES], "listmodel_type_id", "listmodel_type_label"); + +$tab = $request->select($select, $where, $orderstr, $_SESSION['config']['databasetype']); +//$request->show(); + +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="listmodel_type_id") + { + $tab[$i][$j]["listmodel_type_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]= _ID; + $tab[$i][$j]["size"]="18"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["order"]=$tab[$i][$j][$value]; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + } + + if($tab[$i][$j][$value]=="listmodel_type_label") + { + $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["listmodel_type_label"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_LISTMODEL_TYPE_LABEL; + $tab[$i][$j]["size"]="25"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["order"]=$tab[$i][$j][$value]; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + } + } + } +} + +$page_name = "admin_listmodel_types"; +$page_name_up = "admin_listmodel_type&mode=up"; +$page_name_add = "admin_listmodel_type&mode=add"; +$page_name_del = "admin_listmodel_type&mode=del"; +$label_add = _ADD_LISTMODEL_TYPE; +$_SESSION['m_admin']['init'] = true; + +$title = _LISTMODEL_TYPES." : ".$i." "._LISTMODEL_TYPE; +$autoCompletionArray = false;//array(); + +$list->admin_list($tab, $i, $title, 'listmodel_type_id','admin_listmodel_types','entities', 'listmodel_type_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, false, false, _ALL_LISTMODEL_TYPES, _LISTMODEL_TYPE, $_SESSION['config']['businessappurl'].'static.php?module=entities&filename=manage_entities_b.gif', true, true, false, true, "", true, $autoCompletionArray, false, true); +?> diff --git a/entities/trunk/admin_listmodel_validate.php b/entities/trunk/admin_listmodel_validate.php new file mode 100644 index 00000000000..103d5b48cf9 --- /dev/null +++ b/entities/trunk/admin_listmodel_validate.php @@ -0,0 +1,18 @@ +<?php +/* +$_SESSION[m_admin][entity][listmodel][objectType] + [objectId] + [dest] + [*role*][users] + [*role*][entities] +*/ +require_once("modules/entities/class/class_manage_listdiff.php"); +$difflist = new diffusion_list(); + +$difflist->save_listmodel( + $_SESSION['m_admin']['entity']['listmodel'], + $collId = 'letterbox_coll', + $listType = 'DOC', + $objectType = $_SESSION['m_admin']['entity']['listmodel_objectType'], + $objectId = $_SESSION['m_admin']['entity']['listmodel_objectId'] +); \ No newline at end of file diff --git a/entities/trunk/admin_listmodels.php b/entities/trunk/admin_listmodels.php new file mode 100644 index 00000000000..bf9ac672c89 --- /dev/null +++ b/entities/trunk/admin_listmodels.php @@ -0,0 +1,158 @@ +<?php +/* +* +* Copyright 2008,2012 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework 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 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +* +* @author Cyril Vazquez <dev@maarch.org> +*/ + +$admin = new core_tools(); +$admin->test_admin('admin_listmodels', 'entities'); +$_SESSION['m_admin']= array(); +/****************Management of the location bar ************/ +$init = false; +if(isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true") +{ + $init = true; +} +$level = ""; +if(isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)) +{ + $level = $_REQUEST['level']; +} +$page_path = $_SESSION['config']['businessappurl'].'index.php?page=admin_listmodels&module=entities'; +$page_label = _LISTMODELS; +$page_id = "admin_listmodels"; +$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); +/***********************************************************/ + +require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_list_show.php"); +require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); +require_once 'modules/entities/class/class_manage_listdiff.php'; +require_once("modules/entities/entities_tables.php"); + +$func = new functions(); +$request = new request; + +$listdiff = new diffusion_list(); +$roles = $listdiff->get_listinstance_roles(); +$listmodel_types = $listdiff->get_listmodel_types(); + +$what = ''; +$where = ''; + +$list = new list_show(); + +if(isset($_REQUEST['what']) && !empty($_REQUEST['what'])) +{ + $what = $func->protect_string_db($_REQUEST['what']); + $where = " lower(object_id) like lower('".$what."%') and "; +} + +$order = 'asc'; +if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) +{ + $order = trim($_REQUEST['order']); +} +$field = 'object_id'; +if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) +{ + $field = trim($_REQUEST['order_field']); +} + +$orderstr = $list->define_order($order, $field); + +$select[ENT_LISTMODELS] = array(); +array_push($select[ENT_LISTMODELS], "object_type ||' '||object_id as list_id", 'object_type', 'object_id', "coll_id"); + +$where .= ' 1=1 group by object_type, object_id, coll_id'; +$tab = $request->select($select, $where, $orderstr, $_SESSION['config']['databasetype']); +//$request->show(); + +for ($i=0;$i<count($tab);$i++) +{ + for ($j=0;$j<count($tab[$i]);$j++) + { + foreach(array_keys($tab[$i][$j]) as $value) + { + if($tab[$i][$j][$value]=="list_id") + { + $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["list_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_ID; + $tab[$i][$j]["size"]="25"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["order"]=$tab[$i][$j][$value]; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + } + + if($tab[$i][$j][$value]=="object_type") + { + $objectType = $tab[$i][$j]['value']; + $tab[$i][$j]['value'] = $listmodel_types[$objectType]; + $tab[$i][$j]["label"]= _OBJECT_TYPE; + $tab[$i][$j]["size"]="18"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["order"]=$tab[$i][$j][$value]; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + } + + if($tab[$i][$j][$value]=="object_id") + { + $tab[$i][$j]["object_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]= _ID; + $tab[$i][$j]["size"]="18"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["order"]=$tab[$i][$j][$value]; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + } + + if($tab[$i][$j][$value]=="coll_id") + { + $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); + $tab[$i][$j]["coll_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_COLL_ID; + $tab[$i][$j]["size"]="15"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["order"]=$tab[$i][$j][$value]; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + } + } + } +} + +$page_name = "admin_listmodels"; +$page_name_up = "admin_listmodel&mode=up"; +$page_name_add = "admin_listmodel&mode=add"; +$page_name_del = "admin_listmodel&mode=del"; +$label_add = _ADD_LISTMODEL; +$_SESSION['m_admin']['init'] = true; + +$title = _LISTMODELS." : ".$i." "._LISTMODEL; +$autoCompletionArray = false;//array(); + +$list->admin_list($tab, $i, $title, 'list_id','admin_listmodels','entities', 'list_id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, false, false, _ALL_LISTMODELS, _LISTMODEL, $_SESSION['config']['businessappurl'].'static.php?module=entities&filename=manage_entities_b.gif', true, true, false, true, "", true, $autoCompletionArray, false, true); +?> diff --git a/entities/trunk/class/class_manage_listdiff.php b/entities/trunk/class/class_manage_listdiff.php index 49f8dfb1d1f..05dc11c1de2 100644 --- a/entities/trunk/class/class_manage_listdiff.php +++ b/entities/trunk/class/class_manage_listdiff.php @@ -65,43 +65,43 @@ class diffusion_list extends dbquery * ['entity_id'] : entity identifier of the entity in copy * ['entity_label'] : entity label of the entity in copy */ - public function get_listmodel_from_entity($entityId, $collId = 'letterbox_coll') - { + public function get_listmodel( + $objectType='entity_id', + $objectId, + $collId = 'letterbox_coll' + ) { + $objectId = $this->protect_string_db($objectId); + $objectType = $this->protect_string_db($objectType); + $collId = $this->protect_string_db(trim($collId)); + $this->connect(); $roles = $this->get_listinstance_roles(); $listmodel = array(); - $listmodel['dest'] = array(); - - foreach($roles as $role_id => $role_config) { - $listmodel[$role_id] = array(); - $listmodel[$role_id]['users'] = array(); - $listmodel[$role_id]['entities'] = array(); - } - if (empty($entityId)) + if (empty($objectId) || empty($objectType)) return $listmodel; - - $entityId = $this->protect_string_db($entityId); - $this->connect(); # Dest user $this->query( - "select l.item_id, u.firstname, u.lastname, e.entity_id, " - . "e.entity_label from " . ENT_LISTMODELS . " l, " . USERS_TABLE - . " u, " . ENT_ENTITIES . " e, " . ENT_USERS_ENTITIES - . " ue where l.coll_id = '" . $this->protect_string_db(trim($collId)) - . "' and l.listmodel_type = 'DOC' and l.item_mode = 'dest' " - . "and l.item_type = 'user_id' and l.object_type = 'entity_id' " - . "and l.sequence = 0 and l.object_id = '" - . $this->protect_string_db(trim($entityId)) . "' " - . "and l.item_id = u.user_id and u.user_id = ue.user_id " - . "and e.entity_id = ue.entity_id and ue.primary_entity = 'Y'" + "SELECT l.item_id, u.firstname, u.lastname, e.entity_id, e.entity_label " + . " FROM " . ENT_LISTMODELS . " l " + . " JOIN " . USERS_TABLE . " u ON l.item_id = u.user_id " + . " JOIN " . ENT_USERS_ENTITIES . " ue ON u.user_id = ue.user_id " + . " JOIN " . ENT_ENTITIES . " e ON ue.entity_id = e.entity_id" + . " WHERE " + . "l.listmodel_type = 'DOC' and ue.primary_entity = 'Y' " + . "and l.item_mode = 'dest' " + . "and l.item_type = 'user_id' " + . "and l.object_type = '". $objectType ."' " + . "and l.object_id = '" . $objectId . "'" + . "and l.coll_id = '" . $collId . "' " ); $res = $this->fetch_object(); if ($this->nb_result() > 0 && isset($res)) { + $listmodel['dest'] = array(); $listmodel['dest']['user_id'] = $this->show_str($res->item_id); $listmodel['dest']['lastname'] = $this->show_str($res->lastname); $listmodel['dest']['firstname'] = $this->show_str($res->firstname); @@ -111,21 +111,26 @@ class diffusion_list extends dbquery # Users in copy and other roles $this->query( - "select l.item_id, u.firstname, u.lastname, e.entity_id, " - . "e.entity_label, l.item_mode from " . ENT_LISTMODELS . " l, " . USERS_TABLE - . " u, " . ENT_ENTITIES . " e, " . ENT_USERS_ENTITIES - . " ue where l.coll_id = '" . $this->protect_string_db(trim($collId)) - . "' and l.listmodel_type = 'DOC' and l.item_mode != 'dest' " - . "and l.item_type = 'user_id' and l.object_type = 'entity_id' " - . "and l.object_id = '" . $this->protect_string_db(trim($entityId)) - . "' and l.item_id = u.user_id and l.item_id = ue.user_id " - . "and e.entity_id = ue.entity_id and ue.primary_entity='Y' " - . "order by l.sequence " + "SELECT l.item_id, l.item_mode, u.firstname, u.lastname, e.entity_id, e.entity_label " + . " FROM " . ENT_LISTMODELS . " l " + . " JOIN " . USERS_TABLE . " u ON l.item_id = u.user_id " + . " JOIN " . ENT_USERS_ENTITIES . " ue ON u.user_id = ue.user_id " + . " JOIN " . ENT_ENTITIES . " e ON ue.entity_id = e.entity_id" + . " WHERE " + . "l.listmodel_type = 'DOC' and ue.primary_entity = 'Y' " + . "and l.item_mode != 'dest' " + . "and l.item_type = 'user_id' " + . "and l.object_type = '". $objectType ."' " + . "and l.object_id = '" . $objectId . "'" + . "and l.coll_id = '" . $collId . "' " + . "ORDER BY l.sequence" ); while ($res = $this->fetch_object()) { $role_id = $res->item_mode; if($role_id =='cc') $role_id = 'copy'; + if(!isset($listmodel[$role_id])) + $listmodel[$role_id] = array(); if(!isset($listmodel[$role_id]['users'])) $listmodel[$role_id]['users'] = array(); array_push( @@ -142,18 +147,23 @@ class diffusion_list extends dbquery # Users in copy and other roles $this->query( - "select l.item_id, e.entity_label, l.item_mode from " . ENT_LISTMODELS . " l, " - . ENT_ENTITIES . " e where l.coll_id = '" - . $this->protect_string_db(trim($collId)) . "' " - . "and l.listmodel_type = 'DOC' and l.item_mode != 'dest' " - . "and l.item_type = 'entity_id' and l.object_type = 'entity_id' " - . "and l.object_id = '" . $this->protect_string_db(trim($entityId)) - . "' and l.item_id = e.entity_id order by l.sequence " + "SELECT l.item_id, e.entity_label, l.item_mode " + . "FROM " . ENT_LISTMODELS . " l " + . "JOIN " . ENT_ENTITIES . " e ON l.item_id = e.entity_id " + . "WHERE l.listmodel_type = 'DOC' " + . "and l.item_mode != 'dest' " + . "and l.item_type = 'entity_id' " + . "and l.object_type = '" . $objectType . "' " + . "and l.object_id = '" . $objectId . "' " + . "and l.coll_id = '" . $collId . "' " + . "ORDER BY l.sequence " ); while ($res = $this->fetch_object()) { $role_mode = $res->item_mode; if($role_mode=='cc') $role_id = 'copy'; + if(!isset($listmodel[$role_id])) + $listmodel[$role_id] = array(); if(!isset($listmodel[$role_id]['entities'])) $listmodel[$role_id]['entities'] = array(); array_push( @@ -166,46 +176,51 @@ class diffusion_list extends dbquery } return $listmodel; } - - public function save_listmodel_from_entity($diffList, $params, $listType = 'DOC', $objectType = 'entity_id') - { + + public function save_listmodel( + $diffList, + $collId = 'letterbox_coll', + $listType = 'DOC', + $objectType = 'entity_id', + $objectId + ) { $this->connect(); $roles = $this->get_listinstance_roles(); require_once 'core/class/class_history.php'; $hist = new history(); - $coll_id = $this->protect_string_db(trim($params['coll_id'])); + $collId = $this->protect_string_db($collId); $objectType = $this->protect_string_db(trim($objectType)); - $objectId = $this->protect_string_db(trim($params['object_id'])); + $objectId = $this->protect_string_db(trim($objectId)); $listType = $this->protect_string_db(trim($listType)); # Delete all and replace full list #********************************************************************** $this->query( - "delete from " . $params['table'] - . " where coll_id = '" . $coll_id . "' " + "delete from " . ENT_LISTMODELS + . " where coll_id = '" . $collId . "' " . "and object_type = '" . $objectType . "' " - . "and object_id = '" . $object_id . "' " + . "and object_id = '" . $objectId . "' " . "and listmodel_type = '" . $listType . "'" ); # Dest user #********************************************************************** - $dest_user_id = $this->protect_string_db(trim($diffList['dest']['user_id'])); - $this->query( - "insert into " . $params['table'] - . " (coll_id, object_id, object_type, sequence, item_id, item_type, item_mode, listmodel_type ) " - . " values (" - . "'" . $coll_id . "', " - . "'" . $object_id . "' , " - . "'" . $objectType . "', " - . "0, " - . "'" . $dest_user_id . "', " - . "'user_id', " - . "'dest', " - . "'" . $listType . "'" - .")" - ); + if($dest_user_id = $this->protect_string_db(trim($diffList['dest']['user_id']))) + $this->query( + "insert into " . ENT_LISTMODELS + . " (coll_id, object_id, object_type, sequence, item_id, item_type, item_mode, listmodel_type ) " + . " values (" + . "'" . $collId . "', " + . "'" . $objectId . "' , " + . "'" . $objectType . "', " + . "0, " + . "'" . $dest_user_id . "', " + . "'user_id', " + . "'dest', " + . "'" . $listType . "'" + .")" + ); # Roles #********************************************************************** @@ -218,11 +233,11 @@ class diffusion_list extends dbquery ) { $user_id = $this->protect_string_db(trim($diffList[$role_id]['users'][$i]['user_id'])); $this->query( - "insert into " . $params['table'] + "insert into " . ENT_LISTMODELS . " (coll_id, object_id, object_type, sequence, item_id, item_type, item_mode, listmodel_type ) " . " values (" - . "'" . $coll_id . "', " - . "'" . $object_id . "' , " + . "'" . $collId . "', " + . "'" . $objectId . "' , " . "'" . $objectType . "', " . $i . ", " . "'" . $user_id . "', " @@ -237,11 +252,11 @@ class diffusion_list extends dbquery for ($i=0, $l=count($diffList[$role_id]['entities']); $i<$l ; $i++) { $entity_id = $this->protect_string_db(trim($diffList[$role_id]['entities'][$i]['entity_id'])); $this->query( - "insert into " . $params['table'] + "insert into " . ENT_LISTMODELS . " (coll_id, object_id, object_type, sequence, item_id, item_type, item_mode, listmodel_type ) " . " values (" - . "'" . $coll_id . "', " - . "'" . $object_id . "' , " + . "'" . $collId . "', " + . "'" . $objectId . "' , " . "'" . $objectType . "', " . $i . ", " . "'" . $entity_id . "', " @@ -666,5 +681,23 @@ class diffusion_list extends dbquery return $roles; } + # Get list of available list model types + public function get_listmodel_types() + { + $this->connect(); + $this->query('select * from ' . ENT_LISTMODEL_TYPES); + + $types = array(); + + $types['entity_id'] = _ENTITY; + $types['type_id'] = _DOCTYPE; + $types['foldertype_id'] = _FOLDER; + + while ($type = $this->fetch_object()) { + $types[(string) $type->listmodel_type_id] = $type->listmodel_type_label; + } + return $types; + } + } \ No newline at end of file diff --git a/entities/trunk/creation_listmodel.php b/entities/trunk/creation_listmodel.php index 233e65568f2..d04d13b157c 100644 --- a/entities/trunk/creation_listmodel.php +++ b/entities/trunk/creation_listmodel.php @@ -11,9 +11,9 @@ * @author Claire Figueras <dev@maarch.org> * @author Cyril Vazquez <dev@maarch.org> */ -require 'modules/entities/class/class_manage_listdiff.php'; -require 'modules/entities/entities_tables.php'; -require 'core/core_tables.php'; +require_once 'modules/entities/class/class_manage_listdiff.php'; +require_once 'modules/entities/entities_tables.php'; +require_once 'core/core_tables.php'; $core_tools = new core_tools(); $core_tools->load_lang(); @@ -25,7 +25,7 @@ $db->connect(); $difflist = new diffusion_list(); if (isset($_POST['valid'])) { $_SESSION['popup_suite'] = true; - ?> + # Reload caller with new list in session ?> <script type="text/javascript"> window.parent.opener.location.reload(); self.close(); @@ -110,33 +110,21 @@ while ($line = $db->fetch_object()) { } $origin = $_REQUEST['origin']; -$id = ''; -$desc = ''; -# ***************************************************************************** -# Create empty lists -# ***************************************************************************** -$roles = $difflist->get_listinstance_roles(); -if (! isset($_SESSION['m_admin']['entity']['listmodel']['copy']['users'])) { - $_SESSION['m_admin']['entity']['listmodel']['copy']['users'] = array(); -} -if (! isset($_SESSION['m_admin']['entity']['listmodel']['copy']['entities'])) { - $_SESSION['m_admin']['entity']['listmodel']['copy']['entities'] = array(); -} - -// 1.4 custom listinstance modes -if(count($roles) > 0) { - foreach($roles as $role_id => $role_config) { - if(! isset($_SESSION['m_admin']['entity']['listmodel'][$role_id]['users'])) - $_SESSION['m_admin']['entity']['listmodel'][$role_id]['users'] = array(); - if($role_config['allow_entities'] && ! isset($_SESSION['m_admin']['entity']['listmodel'][$role_id]['entities'])) - $_SESSION['m_admin']['entity']['listmodel'][$role_id]['entities'] = array(); - } -} +$roles = $difflist->get_listinstance_roles(); # ***************************************************************************** # Manage request paramaters # ***************************************************************************** +// Object type +$objectType = $_REQUEST['objectType']; +$_SESSION['m_admin']['entity']['listmodel_objectType'] = $objectType; + + +// Object id +$objectId = $_REQUEST['objectId']; +$_SESSION['m_admin']['entity']['listmodel_objectId'] = $objectId; + // Action ? if (isset($_GET['action'])) $action = $_GET['action']; @@ -161,6 +149,9 @@ if(isset($_GET['role']) && !empty($_GET['role'])) else $role_id = 'dest'; +// Workflow mode +$role_workflow_mode = $roles[$role_id]['workflow_mode']; + // Dest user if(isset($_SESSION['m_admin']['entity']['listmodel']['dest']['user_id']) && !empty($_SESSION['m_admin']['entity']['listmodel']['dest']['user_id'])) @@ -186,6 +177,8 @@ case "add_user": $line = $db->fetch_object(); # IF DEST, set unique dest if($role_id == 'dest') { + if(! isset($_SESSION['m_admin']['entity']['listmodel']['dest'])) + $_SESSION['m_admin']['entity']['listmodel']['dest'] = array(); $_SESSION['m_admin']['entity']['listmodel']['dest']['user_id'] = $db->show_string($id); $_SESSION['m_admin']['entity']['listmodel']['dest']['firstname'] = $db->show_string($line->firstname); $_SESSION['m_admin']['entity']['listmodel']['dest']['lastname'] = $db->show_string($line->lastname); @@ -194,6 +187,8 @@ case "add_user": $dest_is_set = true; } else { # OTHER ROLES + if(! isset($_SESSION['m_admin']['entity']['listmodel'][$role_id]['users'])) + $_SESSION['m_admin']['entity']['listmodel'][$role_id]['users'] = array(); array_push( $_SESSION['m_admin']['entity']['listmodel'][$role_id]['users'], array( @@ -214,6 +209,8 @@ case 'add_entity': . " WHERE entity_id = '" . $db->protect_string_db($id) . "'" ); $line = $db->fetch_object(); + if(! isset($_SESSION['m_admin']['entity']['listmodel'][$role_id]['entities'])) + $_SESSION['m_admin']['entity']['listmodel'][$role_id]['entities'] = array(); array_push( $_SESSION['m_admin']['entity']['listmodel'][$role_id]['entities'], array( @@ -259,6 +256,8 @@ case 'remove_entity': //*************************************************************************************** case 'dest_to_copy': if ($dest_is_set) { + if(! isset($_SESSION['m_admin']['entity']['listmodel']['copy']['users'])) + $_SESSION['m_admin']['entity']['listmodel']['copy']['users'] = array(); array_push( $_SESSION['m_admin']['entity']['listmodel']['copy']['users'], array( @@ -276,6 +275,8 @@ case 'dest_to_copy': case 'copy_to_dest': if ($dest_is_set) { + if(! isset($_SESSION['m_admin']['entity']['listmodel'][$role_id]['users'])) + $_SESSION['m_admin']['entity']['listmodel'][$role_id]['users'] = array(); array_push( $_SESSION['m_admin']['entity']['listmodel'][$role_id]['users'], array( @@ -369,7 +370,12 @@ $core_tools->load_html(); $core_tools->load_header(_USER_ENTITIES_TITLE); $time = $core_tools->get_session_time_expire(); $link = $_SESSION['config']['businessappurl']."index.php?display=true&module=entities&page=creation_listmodel"; -$linkwithwhat = $link . '&what_users=' . $whatUsers . '&what_services=' . $whatServices; +$linkwithwhat = + $link + . '&what_users=' . $whatUsers + . '&what_services=' . $whatServices + . '&objectType=' . $objectType + . '&objectId=' . $objectId; #****************************************************************************** # DISPLAY EXISTING LIST #****************************************************************************** @@ -388,13 +394,16 @@ $linkwithwhat = $link . '&what_users=' . $whatUsers . '&what_services=' . $what } </script> <br/> - <?php - if((isset($_GET['what_users']) && !empty($_GET['what_users'])) - || (isset($_GET['what_services']) && !empty($_GET['what_services'])) - || ( !empty($indexed_diff_list)) - ) { ?> <div id="diff_list" align="center"> - <h2 class="tit"><?php echo _DIFFUSION_LIST;?></h2><?php + <h2 class="tit"><?php echo _DIFFUSION_LIST . ' - '; + + switch($objectType) { + case "entity_id" : echo _ENTITY; break; + case "type_id" : echo _DOCTYPE; break; + case "foldertype_id" : echo _FOLDERTYPE;break; + } + echo ' ' . $objectId; + ?></h2><?php #************************************************************************** # DEST USER #************************************************************************** @@ -424,6 +433,7 @@ $linkwithwhat = $link . '&what_users=' . $whatUsers . '&what_services=' . $what # OTHER ROLES #************************************************************************** foreach($roles as $role_id => $role_config) { + $workflow_mode = $role_config['workflow_mode']; if (count($_SESSION['m_admin']['entity']['listmodel'][$role_id]['users']) > 0 || count($_SESSION['m_admin']['entity']['listmodel'][$role_id]['entities']) > 0 ) { ?> @@ -451,8 +461,13 @@ $linkwithwhat = $link . '&what_users=' . $whatUsers . '&what_services=' . $what <a href="<?php echo $linkwithwhat;?>&action=copy_to_dest&role=copy&rank=<?php echo $i;?>" class="up"><?php echo _TO_DEST;?></a><?php } ?> </td> + <td class="action_entities"><!-- Move up in list --><?php + if($l>1 && $i>0 && $workflow_mode == 'sequential') { ?> + <a href="<?php echo $linkwithwhat;?>&action=move_user_up&role=<?php echo $role_id ?>&rank=<?php echo $i;?>" class="up"></a><?php + } ?> + </td> <td class="action_entities"><!-- Move down in list --><?php - if($l>1 && $i<($l-1)) { ?> + if($l>1 && $i<($l-1) && $workflow_mode == 'sequential') { ?> <a href="<?php echo $linkwithwhat;?>&action=move_user_down&role=<?php echo $role_id ?>&rank=<?php echo $i;?>" class="down"></a><?php } ?> </td> @@ -480,8 +495,13 @@ $linkwithwhat = $link . '&what_users=' . $whatUsers . '&what_services=' . $what </a> </td> <td class="action_entities"> </td> + <td class="action_entities"><!-- Move up in list --><?php + if($l>1 && $i>0 && $workflow_mode == 'sequential') { ?> + <a href="<?php echo $linkwithwhat;?>&action=move_entity_up&role=<?php echo $role_id ?>&rank=<?php echo $i;?>" class="up"></a><?php + } ?> + </td> <td class="action_entities"><!-- Move down in list --><?php - if($l>1 && $i<($l-1)) { ?> + if($l>1 && $i<($l-1) && $workflow_mode == 'sequential') { ?> <a href="<?php echo $linkwithwhat;?>&action=move_entity_down&role=<?php echo $role_id ?>&rank=<?php echo $i;?>" class="down"></a><?php } ?> </td> @@ -491,24 +511,32 @@ $linkwithwhat = $link . '&what_users=' . $whatUsers . '&what_services=' . $what <br/><?php } } - - #****************************************************************************** - # LIST OF AVAILABLE ENTITIES / USERS #****************************************************************************** - ?> + # LIST LINK WITH OBJECT + VALIDATION + #******************************************************************************?> <form name="pop_diff" method="post" > <div align="center"> <?php - if(isset($_SESSION['m_admin']['entity']['listmodel']['dest']['user_id']) - && !empty($_SESSION['m_admin']['entity']['listmodel']['dest']['user_id']) + # Mode dest + copy but no dest : can't save + if((empty($_SESSION['m_admin']['entity']['listmodel']['dest']['user_id']) + && (count($_SESSION['m_admin']['entity']['listmodel']['copy']['entities']) > 0 + || count($_SESSION['m_admin']['entity']['listmodel']['copy']['users']) > 0) + ) + || count($_SESSION['m_admin']['entity']['listmodel']) == 0 ) { ?> - <input align="middle" type="submit" value="<?php echo _VALIDATE;?>" class="button" name="valid" /><?php + <div class="error"><?php echo _MUST_CHOOSE_DEST; ?></div> + <?php } - else echo '<div class="error">'._MUST_CHOOSE_DEST.'</div>'; ?> + else { ?> + <input align="middle" type="submit" value="<?php echo _VALIDATE;?>" class="button" name="valid" /><?php + } ?> <input align="middle" type="button" value="<?php echo _CANCEL;?>" onclick="self.close();" class="button"/> </div> </form> <br/> - <br/> + <br/><?php + #****************************************************************************** + # LIST OF AVAILABLE ENTITIES / USERS + #******************************************************************************?> <hr align="center" color="#6633CC" size="5" width="60%"> <div align="center"> <form action="#" name="search_diff_list" > @@ -575,9 +603,7 @@ $linkwithwhat = $link . '&what_users=' . $whatUsers . '&what_services=' . $what <td class="action_entities"><?php if($already_in_list_as) { echo $already_in_list_as; - } elseif(count($roles) == 0) { ?> - <a href="<?php echo $linkwithwhat; ?>&action=add_user&id=<?php echo $users[$j]['ID']; ?>" class="change"><?php echo _ADD; ?></a><?php - } else if(count($roles) > 0) { ?> + } else { ?> <input type="hidden" id="user_id_<?php echo $j; ?>" value="<?php echo $users[$j]['ID'];?>" /> <select name="role" id="user_role_<?php echo $j; ?>"><?php if(!$dest_is_set) { ?> @@ -629,9 +655,7 @@ $linkwithwhat = $link . '&what_users=' . $whatUsers . '&what_services=' . $what <td class="action_entities"><?php if($already_in_list_as) { echo $already_in_list_as; - } else if(count($roles) == 0) { ?> - <a href="<?php echo $linkwithwhat; ?>&action=add_entity&id=<?php echo $entities[$j]['ID']; ?>" class="change"><?php echo _ADD_CC; ?></a><?php - } else if(count($roles) > 0) { ?> + } else { ?> <input type="hidden" id="entity_id_<?php echo $j; ?>" value="<?php echo $entities[$j]['ID'];?>" /> <select name="role" id="entity_role_<?php echo $j; ?>"><?php foreach($roles as $role_id => $role_config) { @@ -651,23 +675,6 @@ $linkwithwhat = $link . '&what_users=' . $whatUsers . '&what_services=' . $what </table> </div> </div> - </div> <?php -} else { ?> - <div id="diff_list" align="center"> - <br/> - <h2 class="tit"><?php echo _MANAGE_MODEL_LIST_TITLE;?> </h2> - <table width="79%" border="0"> - <tr> - <td><p align="center"><img src="<?php echo $_SESSION['config']['businessappurl'];?>static.php?filename=separateur_1.jpg" width="800" height="1" alt="" /><br/><?php echo _WELCOME_MODEL_LIST_TITLE;?>.<br/><br/> - <?php //echo _MODEL_LIST_EXPLANATION1;?>.</p> - <!-- <p align="center"><?php echo _ADD_USER_TO_LIST_EXPLANATION.', '._CLICK_ON;?> : <img src="<?php echo $_SESSION['config']['businessappurl'];?>static.php?filename=picto_change.gif" width="21" height="21" alt="" />.</p> - <p align="center"><?php echo _REMOVE_USER_FROM_LIST_EXPLANATION.', '._CLICK_ON;?> : <img src="<?php echo $_SESSION['config']['businessappurl'];?>static.php?filename=picto_delete.gif" width="19" height="19" alt="" />.</p> - <p align="center"><?php echo _TO_MODIFY_LIST_ORDER_EXPLANATION;?> <img src="<?php echo $_SESSION['config']['businessappurl'];?>static.php?filename=arrow_down.gif" width="16" height="16" alt="" /> <?php echo _AND;?> <img src="<?php echo $_SESSION['config']['businessappurl'];?>static.php?filename=arrow_up.gif" width="16" height="16" alt=""/>. <br/><br/><img src="<?php echo $_SESSION['config']['businessappurl'];?>static.php?filename=separateur_1.jpg" width="800" height="1" alt=""/></p>--> - </td> - </tr> - </table> - <input align="middle" type="button" value="<?php echo _CANCEL;?>" class="button" onclick="self.close();"/> - </div><?php -}?> + </div> </body> </html> diff --git a/entities/trunk/entities_tables.php b/entities/trunk/entities_tables.php index 0f31abf66a8..508b3011ec7 100644 --- a/entities/trunk/entities_tables.php +++ b/entities/trunk/entities_tables.php @@ -46,4 +46,7 @@ if (! defined('ENT_GROUPBASKET_REDIRECT')) { } if (! defined('ENT_LISTINSTANCE_ROLES')) { define('ENT_LISTINSTANCE_ROLES', 'listinstance_roles'); +} +if (! defined('ENT_LISTMODEL_TYPES')) { + define('ENT_LISTMODEL_TYPES', 'listmodel_types'); } \ No newline at end of file diff --git a/entities/trunk/js/functions.js b/entities/trunk/js/functions.js index 6866f91a56b..93bbeda9389 100644 --- a/entities/trunk/js/functions.js +++ b/entities/trunk/js/functions.js @@ -144,4 +144,91 @@ function validate_listinstance_role() { } ); +} + +function getObjectIdInput() +{ + var objectType = $('objectType').value; + var objectId_input = $('objectId_input'); + + new Ajax.Request( + 'index.php?display=true&module=entities&page=admin_listmodel_objectId_input&objectType='+objectType, + { + method:'post', + parameters: { }, + onSuccess: function(answer){ + objectId_input.innerHTML = answer.responseText; + objectId_input.style.display = 'block'; + } + } + ); + +} + +function saveListmodel() +{ + var main_error = $('main_error'); + main_error.innerHTML = ''; + + new Ajax.Request( + 'index.php?display=true&module=entities&page=admin_listmodel_validate', + { + method:'post', + parameters: { }, + onSuccess: function(answer){ + if(answer.responseText) + main_error.innerHTML = answer.responseText; + else { + goTo('index.php?module=entities&page=admin_listmodels'); + } + } + } + ); +} + +function isIdToken(value) +{ + var token = value.match(/[\w_]+/g); + if(!token) + return false; + if(token[0] != value) + return false; + else + return true; + +} + +function validate_listmodel_type() { + var main_error = $('main_error'); + main_error.innerHTML = ''; + + var listmodel_type_id = $('listmodel_type_id').value; + var listmodel_type_label = $('listmodel_type_label').value; + var idValid = isIdToken(listmodel_type_id); + if(idValid == false) { + main_error.innerHTML = 'Identifiant invalide (A-Z, a-z, 0-9 et _)'; + return; + } + main_error.innerHTML = ''; + + new Ajax.Request( + 'index.php?module=entities&page=admin_listmodel_type_validate&display=true', + { + method: 'post', + parameters: + { + mode : $('mode').value, + listmodel_type_id : listmodel_type_id, + listmodel_type_label : listmodel_type_label + }, + onSuccess: function(transport) { + var responseText = transport.responseText.replace(new RegExp("(\r|\n)", "g"), ""); + if(responseText) + $('listmodel_type_messages').innerHTML += responseText; + else + goTo('index.php?module=entities&page=admin_listmodel_types'); + } + } + ); + } \ No newline at end of file diff --git a/entities/trunk/lang/fr.php b/entities/trunk/lang/fr.php index 1fff405e14e..b2a0ce39179 100644 --- a/entities/trunk/lang/fr.php +++ b/entities/trunk/lang/fr.php @@ -185,7 +185,7 @@ if (!defined('_DIFF_LIST')) if (!defined('_NO_USER')) define('_NO_USER', 'Pas d’utilisateur'); if (!defined('_MUST_CHOOSE_DEST')) - define('_MUST_CHOOSE_DEST', 'Vous devez sélectionner un destinataire principal'); + define('_MUST_CHOOSE_DEST', 'Vous devez sélectionner au moins un destinataire'); if (!defined('_ENTITIES__DEL')) define('_ENTITIES__DEL', 'Suppression'); if (!defined('_ENTITY_DELETION')) @@ -294,6 +294,56 @@ if (!defined('_CANCEL')) define('_CANCEL', 'Annuler'); if (!defined('_WORKFLOW_MODE')) define('_WORKFLOW_MODE', 'Type de flux'); + + /******************** Listmodels types ***********/ + if (!defined('_ALL_LISTMODEL_TYPES')) + define('_ALL_LISTMODEL_TYPES', 'Tous les types'); +if (!defined('_LISTMODEL_TYPES_DESC')) + define('_LISTMODEL_TYPES_DESC', 'Types listes de diffusion'); +if (!defined('_LISTMODEL_TYPES')) + define('_LISTMODEL_TYPES', 'Types de listes de diffusion'); +if (!defined('_LISTMODEL_TYPE')) + define('_LISTMODEL_TYPE', 'Type(s) de liste'); +if (!defined('_ADD_LISTMODEL_TYPE')) + define('_ADD_LISTMODEL_TYPE', 'Ajouter un type'); +if (!defined('_LISTMODEL_TYPE_ID')) + define('_LISTMODEL_TYPE_ID', 'Identifiant'); +if (!defined('_LISTMODEL_TYPE_LABEL')) + define('_LISTMODEL_TYPE_LABEL', 'Description'); + + + /******************** Listmodels ***********/ +if (!defined('_ALL_LISTMODELS')) + define('_ALL_LISTMODELS', 'Toutes les listes'); +if (!defined('_LISTMODELS_DESC')) + define('_LISTMODELS_DESC', 'Modèles de listes de diffusion des documents et dossiers'); +if (!defined('_LISTMODELS')) + define('_LISTMODELS', 'Modèles de listes de diffusion'); +if (!defined('_LISTMODEL')) + define('_LISTMODEL', 'Modèle(s) de liste'); +if (!defined('_ADD_LISTMODEL')) + define('_ADD_LISTMODEL', 'Nouveau modèle'); +if (!defined('_ADMIN_LISTMODEL')) + define('_ADMIN_LISTMODEL', 'Modèle de liste de diffusion'); +if (!defined('_ADMIN_LISTMODEL_TITLE')) + define('_ADMIN_LISTMODEL_TITLE', 'Identification du modèle de liste:'); +if (!defined('_OBJECT_TYPE')) + define('_OBJECT_TYPE', 'Type de modèle de liste'); +if (!defined('_SELECT_OBJECT_TYPE')) + define('_SELECT_OBJECT_TYPE', 'Sélectionnez un type...'); +if (!defined('_SELECT_OBJECT_ID')) + define('_SELECT_OBJECT_ID', 'Sélectionnez un lien...'); +if (!defined('_USER_DEFINED_ID')) + define('_USER_DEFINED_ID', 'Libre'); +if (!defined('_ALL_OBJECTS_ARE_LINKED')) + define('_ALL_OBJECTS_ARE_LINKED', 'Toutes les listes sont déjà définies'); +if (!defined('_SELECT_OBJECT_TYPE_AND_ID')) + define('_SELECT_OBJECT_TYPE_AND_ID', 'Vous devez spécifier un type de liste et un identifiant!'); +if (!defined('_SAVE_LISTMODEL')) + define('_SAVE_LISTMODEL', 'Valider'); +if (!defined('_OBJECT_ID_IS_NOT_VALID_ID')) + define('_OBJECT_ID_IS_NOT_VALID_ID', 'Identifiant invalide: il ne doit contenir que des caractères alphabétiques, numériques ou des tiret bas (A-Z, a-z, 0-9, _)'); + /******************** RM ENTITIES ************/ if (!defined('_STANDARD')) define('_STANDARD', 'Standard'); diff --git a/entities/trunk/load_listinstance.php b/entities/trunk/load_listinstance.php index 6d54c6df48c..d3b66369b5c 100644 --- a/entities/trunk/load_listinstance.php +++ b/entities/trunk/load_listinstance.php @@ -42,7 +42,8 @@ if (isset($_REQUEST['only_cc'])) { $origin = $_REQUEST['origin']; if ($_REQUEST['load_from_model'] == 'true') { - $_SESSION[$origin]['diff_list'] = $diffList->get_listmodel_from_entity( + $_SESSION[$origin]['diff_list'] = $diffList->get_listmodel( + 'entity_id', $_REQUEST['id_entity'] ); } diff --git a/entities/trunk/param_entity_listmodel.php b/entities/trunk/param_entity_listmodel.php index 646d1a0973e..b424c926203 100644 --- a/entities/trunk/param_entity_listmodel.php +++ b/entities/trunk/param_entity_listmodel.php @@ -43,8 +43,11 @@ elseif($_SESSION['service_tag'] == 'entity_up') { if(!isset($_SESSION['m_admin']['entity']['listmodel'])) { - - $_SESSION['m_admin']['entity']['listmodel'] = $listdiff->get_listmodel_from_entity($_SESSION['m_admin']['entity']['entityId']); + $_SESSION['m_admin']['entity']['listmodel'] = + $listdiff->get_listmodel( + 'entity_id', + $_SESSION['m_admin']['entity']['entityId'] + ); } } elseif($_SESSION['service_tag'] == 'entities_list_init') @@ -61,20 +64,28 @@ elseif($_SESSION['service_tag'] == 'entity_check') elseif($_SESSION['service_tag'] == 'entity_add_db' || $_SESSION['service_tag'] == 'entity_up_db') { require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_listdiff.php'); - $params = array('mode' => 'listmodel', 'table' => $_SESSION['tablename']['ent_listmodels'], 'object_id' => $_SESSION['m_admin']['entity']['entityId'], 'coll_id' => 'letterbox_coll'); $diff_list = new diffusion_list(); - $diff_list->save_listmodel_from_entity($_SESSION['m_admin']['entity']['listmodel'], $params); + $diff_list->save_listmodel( + $_SESSION['m_admin']['entity']['listmodel'], + $collId = 'letterbox_coll', + $listType = 'DOC', + $objectType = 'entity_id', + $objectId = $_SESSION['m_admin']['entity']['entityId'] + ); } if($_SESSION['service_tag_form'] == 'formentity') { $_SESSION['service_tag_form'] = ""; + $_SESSION['m_admin']['entity']['listmodel_objectType'] = 'entity_id'; + $_SESSION['m_admin']['entity']['listmodel_objectId'] = $_SESSION['m_admin']['entity']['entity_id']; ?> <!--div id="inner_content" class="clearfix"--> <div id="listmodel_box" class="block"> <?php if(isset($_SESSION['m_admin']['entity']['listmodel']['dest']['user_id']) && !empty($_SESSION['m_admin']['entity']['listmodel']['dest']['user_id']) ) { ?> - <h2 class="tit"><?php echo _LINKED_DIFF_LIST;?> : </h2> - <p class="sstit"><?php echo _RECIPIENT;?></p> + <h2 class="tit"><?php echo _LINKED_DIFF_LIST;?> : </h2><?php + if($_SESSION['m_admin']['entity']['listmodel']['dest']['user_id']) { ?> + <p class="sstit"><?php echo _RECIPIENT;?></p> <table cellpadding="0" cellspacing="0" border="0" class="listingsmall list_diff spec"> <tr > <td> @@ -86,6 +97,7 @@ if($_SESSION['service_tag_form'] == 'formentity') { </tr> </table> <br/> <?php + } foreach($roles as $role_id => $role_config) { if(count($_SESSION['m_admin']['entity']['listmodel'][$role_id]['users']) > 0 || count($_SESSION['m_admin']['entity']['listmodel'][$role_id]['entities']) > 0 @@ -130,13 +142,13 @@ if($_SESSION['service_tag_form'] == 'formentity') { } } ?> <p class="buttons"> - <input type="button" onclick="window.open('<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=entities&page=';?>creation_listmodel&what=A', '', 'scrollbars=yes,menubar=no,toolbar=no,status=no,resizable=yes,width=1024,height=650,location=no');" class="button" value="<?php echo _MODIFY_LIST;?>" /> + <input type="button" onclick="window.open('<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=entities&page=';?>creation_listmodel&what=A&objectType=entity_id&objectId=<?php echo $_SESSION['m_admin']['entity']['entityId'];?>', '', 'scrollbars=yes,menubar=no,toolbar=no,status=no,resizable=yes,width=1024,height=650,location=no');" class="button" value="<?php echo _MODIFY_LIST;?>" /> </p> <?php } else { ?> <h2 class="tit"><?php echo _NO_LINKED_DIFF_LIST;?>.</h2> <p class="buttons"> <p> - <input type="button" onclick="window.open('<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=entities&page=';?>creation_listmodel', '', 'scrollbars=yes,menubar=no,toolbar=no,status=no,resizable=yes,width=1024,height=650,location=no');" class="button" value="<?php echo _CREATE_LIST;?>" /> + <input type="button" onclick="window.open('<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&module=entities&page=';?>creation_listmodel&objectType=entity_id&objectId=<?php echo $_SESSION['m_admin']['entity']['entityId'];?>', '', 'scrollbars=yes,menubar=no,toolbar=no,status=no,resizable=yes,width=1024,height=650,location=no');" class="button" value="<?php echo _CREATE_LIST;?>" /> </p> </p> <?php } ?> diff --git a/entities/trunk/xml/services.xml b/entities/trunk/xml/services.xml index 06aba621cfb..1d64d0cbbe3 100644 --- a/entities/trunk/xml/services.xml +++ b/entities/trunk/xml/services.xml @@ -28,7 +28,21 @@ <nature>listelement</nature> </WHEREAMIUSED> </SERVICE> - <SERVICE> + <SERVICE> + <id>admin_listmodel_types</id> + <name>_ADMIN_LISTMODEL_TYPES</name> + <comment>_ADMIN_LISTMODEL_TYPES_DESC</comment> + <servicepage>index.php?page=admin_listmodel_types&module=entities</servicepage> + <servicetype>use</servicetype> + <system_service>true</system_service> + <style>ent_manage_entities</style> + <enabled>true</enabled> + <WHEREAMIUSED> + <page>admin.php</page> + <nature>listelement</nature> + </WHEREAMIUSED> + </SERVICE> + <SERVICE> <id>admin_listmodels</id> <name>_ADMIN_LISTMODELS</name> <comment>_ADMIN_LISTMODELS_DESC</comment> -- GitLab