2012-08-06 Sergio Martin <sergio.martin@artica.es>

* include/functions_users.php
	include/functions_html.php
	include/constants.php
	godmode/modules/manage_network_components_form_plugin.php: order 
	functions to use from enterprise side, fix little interface bug in
	components form



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6848 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2012-08-06 08:40:31 +00:00
parent 26320dddfc
commit 6a35a3a9f6
5 changed files with 64 additions and 29 deletions

View File

@ -1,3 +1,12 @@
2012-08-06 Sergio Martin <sergio.martin@artica.es>
* include/functions_users.php
include/functions_html.php
include/constants.php
godmode/modules/manage_network_components_form_plugin.php: order
functions to use from enterprise side, fix little interface bug in
components form
2012-08-02 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb_data.sql, pandoradb.data.postgreSQL.sql,

View File

@ -117,7 +117,11 @@ while(1) {
$data[1] = __('Add macro').' <a href="javascript:new_macro(\'network_component-plugin_\')">'.html_print_image('images/add.png',true).'</a>';
$data[1] .= '<div id="next_macro" style="display:none">'.$i.'</div>';
$data[1] .= '<div id="next_row" style="display:none">'.$next_name_number.'</div>';
$data[2] = '<div id="delete_macro_button" style="display:none;">'.__('Delete macro').' <a href="javascript:delete_macro(\'network_component-plugin_\')">'.html_print_image('images/cancel.png',true).'</a></div>';
$delete_macro_style = '';
if($i <= 2) {
$delete_macro_style = 'display:none;';
}
$data[2] = '<div id="delete_macro_button" style="'.$delete_macro_style.'">'.__('Delete macro').' <a href="javascript:delete_macro(\'network_component-plugin_\')">'.html_print_image('images/cancel.png',true).'</a></div>';
push_table_row ($data, 'plugin_n');
}

View File

@ -48,6 +48,7 @@ define ('ERR_FILE', -50000);
define ('ERR_NOCHANGES', -60000);
define ('ERR_NODATA', -70000);
define ('ERR_CONNECTION', -80000);
define ('ERR_DISABLED', -90000);

View File

@ -211,34 +211,8 @@ function html_print_select_groups($id_user = false, $privilege = "AR", $returnAl
$multiple = false, $sort = true, $class = '', $disabled = false, $style = false, $option_style = false, $id_group = false) {
global $config;
$user_groups = users_get_groups ($id_user, $privilege, $returnAllGroup, true);
if ($id_group !== false) {
$childrens = groups_get_childrens($id_group);
foreach ($childrens as $child) {
unset($user_groups[$child['id_grupo']]);
}
unset($user_groups[$id_group]);
}
if (empty($user_groups)) {
$user_groups_tree = array();
}
else {
// First group it's needed to retrieve its parent group
$first_group = array_slice($user_groups, 0, 1);
$parent_group = $first_group[0]['parent'];
$user_groups_tree = groups_get_groups_tree_recursive($user_groups, $parent_group);
}
$fields = array();
foreach ($user_groups_tree as $group) {
$groupName = ui_print_truncate_text($group['nombre'], GENERIC_SIZE_TEXT, false, true, false);
$fields[$group['id_grupo']] = str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $group['deep']) . $groupName;
}
$fields = users_get_groups_for_select($id_user, $privilege, $returnAllGroup, true, $id_group);
$output = html_print_select ($fields, $name, $selected, $script, $nothing, $nothing_value,
$return, $multiple, false, $class, $disabled, $style, $option_style);

View File

@ -73,6 +73,53 @@ function users_get_all_model_groups () {
return $returnGroups;
}
/**
* Get all the groups a user has reading privileges with the special format to use it on select.
*
* @param string User id
* @param string The privilege to evaluate, and it is false then no check ACL.
* @param boolean $returnAllGroup Flag the return group, by default true.
* @param boolean $returnAllColumns Flag to return all columns of groups.
* @param array $id_groups The list of group to scan to bottom child. By default null.
*
* @return array A list of the groups the user has certain privileges.
*/
function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGroup = true, $returnAllColumns = false, $id_groups = null) {
if($id_groups === false) {
$id_groups = null;
}
$user_groups = users_get_groups ($id_user, $privilege, $returnAllGroup, $returnAllColumns, $id_groups);
if ($id_groups !== null) {
$childrens = groups_get_childrens($id_groups);
foreach ($childrens as $child) {
unset($user_groups[$child['id_grupo']]);
}
unset($user_groups[$id_groups]);
}
if (empty($user_groups)) {
$user_groups_tree = array();
}
else {
// First group it's needed to retrieve its parent group
$first_group = array_slice($user_groups, 0, 1);
$parent_group = $first_group[0]['parent'];
$user_groups_tree = groups_get_groups_tree_recursive($user_groups, $parent_group);
}
$fields = array();
foreach ($user_groups_tree as $group) {
$groupName = ui_print_truncate_text($group['nombre'], GENERIC_SIZE_TEXT, false, true, false);
$fields[$group['id_grupo']] = str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $group['deep']) . $groupName;
}
return $fields;
}
/**
* Get all the groups a user has reading privileges.
*