2012-08-17 Miguel de Dios <miguel.dedios@artica.es>
* godmode/users/configure_user.php: fixed when the metaconsole is not set. * godmode/reporting/reporting_builder.php: cleaned source code style. * include/functions_reports.php: fixed into the function "reports_get_reports" to get reports in All group for users of others groups. * include/functions_api.php: fixed the confused error messages when there is data events. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6878 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
b29979813e
commit
44ac0709ba
|
@ -1,3 +1,18 @@
|
|||
2012-08-17 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/users/configure_user.php: fixed when the metaconsole is
|
||||
not set.
|
||||
|
||||
* godmode/reporting/reporting_builder.php: cleaned source code
|
||||
style.
|
||||
|
||||
* include/functions_reports.php: fixed into the function
|
||||
"reports_get_reports" to get reports in All group for users of
|
||||
others groups.
|
||||
|
||||
* include/functions_api.php: fixed the confused error messages when
|
||||
there is data events.
|
||||
|
||||
2012-08-17 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/javascript/pandora_modules.js
|
||||
|
|
|
@ -137,26 +137,28 @@ switch ($action) {
|
|||
case 'delete_items':
|
||||
$resultOperationDB = null;
|
||||
$ids_serialize = (string)get_parameter('ids_items_to_delete', '');
|
||||
|
||||
|
||||
if (!empty($ids_serialize)) {
|
||||
$sql = "DELETE FROM treport_content WHERE id_rc IN ($ids_serialize)";
|
||||
$resultOperationDB = db_process_sql($sql);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$resultOperationDB = false;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'delete_items_pos':
|
||||
$resultOperationDB = null;
|
||||
$position_to_delete = (int)get_parameter('position_to_delete', 1);
|
||||
$pos_delete = (string)get_parameter('delete_m', 'below');
|
||||
|
||||
|
||||
$countItems = db_get_sql('SELECT COUNT(id_rc)
|
||||
FROM treport_content WHERE id_report = ' . $idReport);
|
||||
|
||||
|
||||
if (($countItems < $position_to_delete) || ($position_to_delete < 1)) {
|
||||
$resultOperationDB = false;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$sql = "SELECT id_rc FROM treport_content WHERE id_report=$idReport ORDER BY '`order`'";
|
||||
$items = db_get_all_rows_sql($sql);
|
||||
switch ($pos_delete) {
|
||||
|
@ -187,7 +189,7 @@ switch ($action) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'delete_report':
|
||||
case 'list':
|
||||
|
@ -195,22 +197,23 @@ switch ($action) {
|
|||
'list_reports' => array('active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder">' .
|
||||
html_print_image("images/god6.png", true, array ("title" => __('Main'))) .'</a>')
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
if ($enterpriseEnable){
|
||||
$buttons = reporting_enterprise_add_main_Tabs($buttons);
|
||||
}
|
||||
|
||||
$subsection = '';
|
||||
switch ($activeTab){
|
||||
|
||||
case 'main': $buttons['list_reports']['active'] = true;
|
||||
$subsection = ' » '.__('Custom reporting');
|
||||
break;
|
||||
default: $subsection = reporting_enterprise_add_subsection_main($activeTab, $buttons);
|
||||
break;
|
||||
switch ($activeTab) {
|
||||
case 'main':
|
||||
$buttons['list_reports']['active'] = true;
|
||||
$subsection = ' » '.__('Custom reporting');
|
||||
break;
|
||||
default:
|
||||
$subsection = reporting_enterprise_add_subsection_main($activeTab, $buttons);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Report LIST
|
||||
ui_print_page_header (__('Reporting').' » '.__('Custom reporting'), "images/reporting.png", false, "",false, $buttons);
|
||||
|
||||
|
@ -220,17 +223,17 @@ switch ($action) {
|
|||
db_pandora_audit("Report management", "Delete report #$idReport");
|
||||
else
|
||||
db_pandora_audit("Report management", "Fail try to delete report #$idReport");
|
||||
|
||||
|
||||
ui_print_result_message ($result,
|
||||
__('Successfully deleted'),
|
||||
__('Could not be deleted'));
|
||||
}
|
||||
|
||||
|
||||
$id_group = (int) get_parameter ("id_group", 0);
|
||||
$search = trim(get_parameter ("search", ""));
|
||||
|
||||
$search_sql = '';
|
||||
if ($search != ""){
|
||||
if ($search != "") {
|
||||
$search_name = "%$search%' OR description LIKE '%$search%";
|
||||
}
|
||||
|
||||
|
@ -242,9 +245,9 @@ switch ($action) {
|
|||
|
||||
$table_aux->data[0][2] = "<b>". __("Free text for search: ") . "</b>";
|
||||
$table_aux->data[0][3] = html_print_input_text ("search", $search, '', 30, '', true);
|
||||
|
||||
|
||||
$table_aux->data[0][6] = html_print_submit_button(__('Search'), 'search_submit', false, 'class="sub upd"', true);
|
||||
|
||||
|
||||
echo "<form action='index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&id_group='.$id_group'
|
||||
method='post'>";
|
||||
html_print_table($table_aux);
|
||||
|
@ -254,12 +257,13 @@ switch ($action) {
|
|||
ui_require_jquery_file ('ajaxqueue');
|
||||
ui_require_jquery_file ('bgiframe');
|
||||
ui_require_jquery_file ('autocomplete');
|
||||
|
||||
|
||||
// Show only selected groups
|
||||
|
||||
|
||||
// Show only selected groups
|
||||
if ($id_group > 0) {
|
||||
$group = array("$id_group" => $id_group);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$group = false;
|
||||
}
|
||||
|
||||
|
@ -273,14 +277,16 @@ switch ($action) {
|
|||
'name' => $search_name,
|
||||
'order' => 'name'
|
||||
);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$filter = array (
|
||||
'order' => 'name'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$reports = reports_get_reports ($filter,
|
||||
array ('name', 'id_report', 'description', 'private', 'id_user', 'id_group'), $return_all_group, 'IR', $group);
|
||||
array ('name', 'id_report', 'description', 'private',
|
||||
'id_user', 'id_group'), $return_all_group, 'IR', $group);
|
||||
$table->width = '0px';
|
||||
if (sizeof ($reports)) {
|
||||
$table->id = 'report_list';
|
||||
|
@ -332,7 +338,7 @@ switch ($action) {
|
|||
|
||||
if (check_acl ($config["id_user"], $report["id_group"], "AW")) {
|
||||
$data[0] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=edit&id_report='.
|
||||
$report['id_report'].'">'.$report['name'].'</a>';
|
||||
$report['id_report'].'">'.$report['name'].'</a>';
|
||||
}
|
||||
else {
|
||||
$data[0] = $report['name'];
|
||||
|
@ -991,26 +997,26 @@ switch ($action) {
|
|||
'list_reports' => array('active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder">' .
|
||||
html_print_image("images/god6.png", true, array ("title" => __('Main'))) .'</a>')
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
$buttons = reporting_enterprise_add_main_Tabs($buttons);
|
||||
|
||||
|
||||
$subsection = '';
|
||||
switch ($activeTab){
|
||||
|
||||
case 'main': $buttons['list_reports']['active'] = true;
|
||||
$subsection = ' » '.__('Custom reporting');
|
||||
break;
|
||||
default: $subsection = reporting_enterprise_add_subsection_main($activeTab, $buttons);
|
||||
break;
|
||||
switch ($activeTab) {
|
||||
case 'main':
|
||||
$buttons['list_reports']['active'] = true;
|
||||
$subsection = ' » '.__('Custom reporting');
|
||||
break;
|
||||
default:
|
||||
$subsection = reporting_enterprise_add_subsection_main($activeTab, $buttons);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Report LIST
|
||||
ui_print_page_header (__('Reporting') . $subsection, "images/reporting_edit.png", false, "", true, $buttons);
|
||||
|
||||
reporting_enterprise_select_main_tab($action);
|
||||
|
||||
reporting_enterprise_select_main_tab($action);
|
||||
}
|
||||
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
@ -1040,7 +1046,7 @@ if ($enterpriseEnable) {
|
|||
|
||||
$buttons['view'] = array('active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=' . $idReport . '">' .
|
||||
html_print_image("images/reporting.png", true, array ("title" => __('View report'))) .'</a>');
|
||||
html_print_image("images/reporting.png", true, array ("title" => __('View report'))) .'</a>');
|
||||
|
||||
$buttons[$activeTab]['active'] = true;
|
||||
|
||||
|
@ -1075,5 +1081,4 @@ switch ($activeTab) {
|
|||
reporting_enterprise_select_tab($activeTab);
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
|
@ -48,7 +48,7 @@ if (! check_acl ($config['id_user'], 0, "UM")) {
|
|||
if (!check_refererer()) {
|
||||
require ("general/noaccess.php");
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
$tab = get_parameter('tab', 'user');
|
||||
|
@ -62,7 +62,7 @@ $buttons = array(
|
|||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gusuarios&sec2=godmode/users/profile_list&tab=profile">' .
|
||||
html_print_image ("images/profiles.png", true, array ("title" => __('Profile management'))) .'</a>'));
|
||||
|
||||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
// Header
|
||||
|
@ -84,7 +84,8 @@ $update_user = (bool) get_parameter ('update_user');
|
|||
$status = get_parameter ('status', -1);
|
||||
|
||||
// Reset status var if current action is not update_user
|
||||
if ($new_user || $create_user || $add_profile || $delete_profile || $update_user){
|
||||
if ($new_user || $create_user || $add_profile ||
|
||||
$delete_profile || $update_user) {
|
||||
$status = -1;
|
||||
}
|
||||
|
||||
|
@ -184,13 +185,13 @@ if ($create_user) {
|
|||
if ($result) {
|
||||
$res = db_process_sql('/INSERT INTO tpassword_history (id_user, password, date_begin) VALUES (\'' . $id . '\',\'' . md5($password_new) . '\',\'' . date ("Y/m/d H:i:s", get_system_time()) . '\')');
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
db_pandora_audit("User management",
|
||||
"Created user ".io_safe_input($id), false, false, $info);
|
||||
|
||||
|
||||
ui_print_result_message ($result,
|
||||
__('Successfully created'),
|
||||
__('Could not be created'));
|
||||
|
@ -225,7 +226,7 @@ if ($update_user) {
|
|||
}
|
||||
$values['block_size'] = get_parameter ('block_size', $config["block_size"]);
|
||||
$values['flash_chart'] = get_parameter ('flash_charts', $config["flash_charts"]);
|
||||
|
||||
|
||||
if(enterprise_installed()) {
|
||||
$values['metaconsole_access'] = get_parameter ('metaconsole_access');
|
||||
}
|
||||
|
@ -284,7 +285,7 @@ if ($update_user) {
|
|||
|
||||
db_pandora_audit("User management", "Updated user ".io_safe_input($id),
|
||||
false, false, $info);
|
||||
|
||||
|
||||
ui_print_result_message ($res1,
|
||||
__('User info successfully updated'),
|
||||
__('Error updating user info (no change?)'));
|
||||
|
@ -328,7 +329,7 @@ if ($delete_profile) {
|
|||
|
||||
db_pandora_audit("User management",
|
||||
"Deleted profile for user ".io_safe_input($id2), false, false, 'The profile with id ' . $id_perfil . ' in the group ' . $perfilUser['id_grupo']);
|
||||
|
||||
|
||||
$return = profile_delete_user_profile ($id2, $id_up);
|
||||
ui_print_result_message ($return,
|
||||
__('Successfully deleted'),
|
||||
|
@ -399,7 +400,7 @@ if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
|||
else
|
||||
$display_all_group = false;
|
||||
|
||||
if ($new_user) {
|
||||
if ($new_user) {
|
||||
$usr_groups = (users_get_groups($config['id_user'], 'AR', $display_all_group));
|
||||
$id_usr = $config['id_user'];
|
||||
}
|
||||
|
@ -409,7 +410,7 @@ else {
|
|||
}
|
||||
|
||||
// User only can change skins if has more than one group
|
||||
if (count($usr_groups) > 1){
|
||||
if (count($usr_groups) > 1) {
|
||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->data[10][0] = __('Skin');
|
||||
$table->data[10][1] = skins_print_select($id_usr,'skin', $user_info['id_skin'], '', __('None'), 0, true);
|
||||
|
@ -422,18 +423,24 @@ $table->data[11][1] = html_print_select($values, 'flash_charts', $user_info["fla
|
|||
$table->data[12][0] = __('Block size for pagination');
|
||||
$table->data[12][1] = html_print_input_text ('block_size', $user_info["block_size"], '', 5, 5, true);
|
||||
|
||||
if($id == $config['id_user']) {
|
||||
if ($id == $config['id_user']) {
|
||||
$table->data[12][1] .= html_print_input_hidden('quick_language_change', 1, true);
|
||||
}
|
||||
|
||||
if(enterprise_installed()) {
|
||||
if (enterprise_installed()) {
|
||||
$user_info_metaconsole_access = 'only_console';
|
||||
if (isset($user_info["metaconsole_access"])) {
|
||||
$user_info_metaconsole_access = $user_info["metaconsole_access"];
|
||||
}
|
||||
$table->data[12][0] = __('Metaconsole access');
|
||||
$metaconsole_accesses = array('only_console' => __('No access'),
|
||||
'basic' => __('Basic (Only Metaconsole)'),
|
||||
'advanced' => __('Advanced (Only Metaconsole)'),
|
||||
//'custom' => __('Custom access (Only Metaconsole)'),
|
||||
'all' => __('Full (Metaconsole and normal console)'));
|
||||
$table->data[12][1] = html_print_select($metaconsole_accesses,'metaconsole_access',$user_info["metaconsole_access"],'','',-1,true, false, false);
|
||||
'basic' => __('Basic (Only Metaconsole)'),
|
||||
'advanced' => __('Advanced (Only Metaconsole)'),
|
||||
//'custom' => __('Custom access (Only Metaconsole)'),
|
||||
'all' => __('Full (Metaconsole and normal console)'));
|
||||
$table->data[12][1] = html_print_select($metaconsole_accesses,
|
||||
'metaconsole_access', $user_info_metaconsole_access,
|
||||
'','',-1,true, false, false);
|
||||
}
|
||||
|
||||
echo '<form method="post" autocomplete="off">';
|
||||
|
@ -442,7 +449,7 @@ html_print_table ($table);
|
|||
|
||||
echo '<div style="width: '.$table->width.'" class="action-buttons">';
|
||||
if ($new_user) {
|
||||
if ($config['admin_can_add_user']){
|
||||
if ($config['admin_can_add_user']) {
|
||||
html_print_input_hidden ('create_user', 1);
|
||||
html_print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
|
||||
}
|
||||
|
@ -461,7 +468,7 @@ echo '<br />';
|
|||
if (empty ($id) || $new_user)
|
||||
return;
|
||||
|
||||
echo '<h4>'.__('Profiles/Groups assigned to this user').'</h4>';
|
||||
echo '<h4>'. __('Profiles/Groups assigned to this user') . '</h4>';
|
||||
|
||||
$table->width = '98%';
|
||||
$table->data = array ();
|
||||
|
@ -507,33 +514,30 @@ foreach ($result as $profile) {
|
|||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
$data = array ();
|
||||
|
||||
$data[0] = '<form method="post">';
|
||||
if (check_acl ($config['id_user'], 0, "PM")) {
|
||||
$data[0] .= html_print_select (profile_get_profiles (), 'assign_profile', 0, '',
|
||||
__('None'), 0, true, false, false);
|
||||
}
|
||||
else {
|
||||
$data[0] .= html_print_select (profile_get_profiles (array ('pandora_management' => '<> 1',
|
||||
'db_management' => '<> 1')), 'assign_profile', 0, '', __('None'), 0,
|
||||
true, false, false);
|
||||
}
|
||||
|
||||
$data[1] = html_print_select_groups($config['id_user'], "UM",
|
||||
$own_info['is_admin'], 'assign_group', -1, '', __('None'), -1, true,
|
||||
false, false);
|
||||
|
||||
$data[2] = html_print_input_image ('add', 'images/add.png', 1, '', true);
|
||||
$data[2] .= html_print_input_hidden ('id', $id, true);
|
||||
$data[2] .= html_print_input_hidden ('add_profile', 1, true);
|
||||
$data[2] .= '</form>';
|
||||
$data = array ();
|
||||
|
||||
$data[0] = '<form method="post">';
|
||||
if (check_acl ($config['id_user'], 0, "PM")) {
|
||||
$data[0] .= html_print_select (profile_get_profiles (), 'assign_profile', 0, '',
|
||||
__('None'), 0, true, false, false);
|
||||
}
|
||||
else {
|
||||
$data[0] .= html_print_select (profile_get_profiles (array ('pandora_management' => '<> 1',
|
||||
'db_management' => '<> 1')), 'assign_profile', 0, '', __('None'), 0,
|
||||
true, false, false);
|
||||
}
|
||||
|
||||
$data[1] = html_print_select_groups($config['id_user'], "UM",
|
||||
$own_info['is_admin'], 'assign_group', -1, '', __('None'), -1, true,
|
||||
false, false);
|
||||
|
||||
$data[2] = html_print_input_image ('add', 'images/add.png', 1, '', true);
|
||||
$data[2] .= html_print_input_hidden ('id', $id, true);
|
||||
$data[2] .= html_print_input_hidden ('add_profile', 1, true);
|
||||
$data[2] .= '</form>';
|
||||
|
||||
array_push ($table->data, $data);
|
||||
|
||||
html_print_table ($table);
|
||||
|
||||
|
||||
unset ($table);
|
||||
|
||||
?>
|
||||
?>
|
|
@ -4987,8 +4987,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
|||
$data['data'] = $result;
|
||||
|
||||
returnData($returnType, $data, $separator);
|
||||
|
||||
return;
|
||||
if (empty($result))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5001,9 +5002,10 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
|||
*/
|
||||
function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db = null) {
|
||||
if ($user_in_db !== null) {
|
||||
get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db);
|
||||
$correct = get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db);
|
||||
|
||||
$last_error = error_get_last();
|
||||
if (!empty($last_error)) {
|
||||
if (!$correct && !empty($last_error)) {
|
||||
$errors = array(E_ERROR, E_WARNING, E_USER_ERROR,
|
||||
E_USER_WARNING);
|
||||
if (in_array($last_error['type'], $errors)) {
|
||||
|
|
|
@ -83,22 +83,27 @@ function reports_get_reports ($filter = false, $fields = false, $returnAllGroup
|
|||
|
||||
$reports = array ();
|
||||
$all_reports = @db_get_all_rows_filter ('treport', $filter, $fields);
|
||||
|
||||
if (empty($all_reports))
|
||||
$all_reports = array();
|
||||
|
||||
if ($group) {
|
||||
$groups = $group;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
//Recheck in all reports if the user have permissions to see each report.
|
||||
$groups = users_get_groups ($config['id_user'], $privileges, $returnAllGroup);
|
||||
}
|
||||
|
||||
|
||||
foreach ($all_reports as $report) {
|
||||
if (!in_array($report['id_group'], array_keys($groups)))
|
||||
continue;
|
||||
if ($config['id_user'] != $report['id_user']
|
||||
&& ! check_acl ($config['id_user'], $report['id_group'], 'AR'))
|
||||
continue;
|
||||
//If the report is not in all group.
|
||||
if ($report['id_group'] != 0) {
|
||||
if (!in_array($report['id_group'], array_keys($groups)))
|
||||
continue;
|
||||
if ($config['id_user'] != $report['id_user']
|
||||
&& ! check_acl ($config['id_user'], $report['id_group'], 'AR'))
|
||||
continue;
|
||||
}
|
||||
array_push ($reports, $report);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue