2011-03-01 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/ajax/skins.ajax.php: Replaced "give_acl" function call to 
	"check_acl". 
	* include/config_process.php: "block_size" and "flash_charts" user options
	override global options.
	* include/functions_ui.php: If user has assigned a skin then use skins's 
	css files if it's possible.
	* include/functions_db.php: Added missing function get_profile_filter.
	* include/functions_themes.php: New parameter "path" in order to list all
	css files of an specific path.
	* index.php: Added functions_themes.php include statement.
	* operation/users/user_edit.php
	godmode/users/configure_user.php: Added new user options: "skin", "block_size" 
	and "flash_charts". 
	* godmode/setup/setup_visuals.php: Removed "custom_logo" options in setup for
	pandora enterprise version. 




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4038 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-03-01 15:47:48 +00:00
parent e3a2d38033
commit 830742c25d
10 changed files with 150 additions and 24 deletions

View File

@ -1,3 +1,21 @@
2011-03-01 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/ajax/skins.ajax.php: Replaced "give_acl" function call to
"check_acl".
* include/config_process.php: "block_size" and "flash_charts" user options
override global options.
* include/functions_ui.php: If user has assigned a skin then use skins's
css files if it's possible.
* include/functions_db.php: Added missing function get_profile_filter.
* include/functions_themes.php: New parameter "path" in order to list all
css files of an specific path.
* index.php: Added functions_themes.php include statement.
* operation/users/user_edit.php
godmode/users/configure_user.php: Added new user options: "skin", "block_size"
and "flash_charts".
* godmode/setup/setup_visuals.php: Removed "custom_logo" options in setup for
pandora enterprise version.
2011-03-01 Miguel de Dios <miguel.dedios@artica.es> 2011-03-01 Miguel de Dios <miguel.dedios@artica.es>
* include/db/postgresql.php, include/db/mysql.php, include/functions_db.php: * include/db/postgresql.php, include/db/mysql.php, include/functions_db.php:

View File

@ -80,14 +80,14 @@ $table->data[9][1] = print_select ($iconsets, 'status_images_set', $config["stat
$table->data[10][0] = __('Font path'); $table->data[10][0] = __('Font path');
$table->data[10][1] = print_input_text ('fontpath', $config["fontpath"], '', 50, 255, true); $table->data[10][1] = print_input_text ('fontpath', $config["fontpath"], '', 50, 255, true);
$table->data[11][0] = __('Flash charts');
$table->data[11][1] = __('Yes').'&nbsp;'.print_radio_button ('flash_charts', 1, '', $config["flash_charts"], true).'&nbsp;&nbsp;';
$table->data[11][1] .= __('No').'&nbsp;'.print_radio_button ('flash_charts', 0, '', $config["flash_charts"], true);
$table->data[12][0] = __('Flash charts'); if (!defined ('PANDORA_ENTERPRISE')){
$table->data[12][1] = __('Yes').'&nbsp;'.print_radio_button ('flash_charts', 1, '', $config["flash_charts"], true).'&nbsp;&nbsp;'; $table->data[12][0] = __('Custom logo') . print_help_icon("custom_logo", true);
$table->data[12][1] .= __('No').'&nbsp;'.print_radio_button ('flash_charts', 0, '', $config["flash_charts"], true); $table->data[12][1] = print_select (list_files ('images/custom_logo', "png", 1, 0), 'custom_logo', $config["custom_logo"], '', '', '', true);
}
$table->data[13][0] = __('Custom logo') . print_help_icon("custom_logo", true);
$table->data[13][1] = print_select (list_files ('images/custom_logo', "png", 1, 0), 'custom_logo', $config["custom_logo"], '', '', '', true);
echo '<form id="form_setup" method="post">'; echo '<form id="form_setup" method="post">';
print_input_hidden ('update_config', 1); print_input_hidden ('update_config', 1);

View File

@ -63,6 +63,9 @@ if ($new_user && $config['admin_can_add_user']) {
$user_info['is_admin'] = 0; $user_info['is_admin'] = 0;
$user_info['language'] = $config["language"]; $user_info['language'] = $config["language"];
$user_info['id_skin'] = ''; $user_info['id_skin'] = '';
//This attributes are inherited from global configuration
$user_info['block_size'] = $config["block_size"];
$user_info['flash_chart'] = $config["flash_charts"];
} }
if ($create_user) { if ($create_user) {
@ -84,6 +87,8 @@ if ($create_user) {
$values['is_admin'] = get_parameter ('is_admin', 0); $values['is_admin'] = get_parameter ('is_admin', 0);
$values['language'] = get_parameter ('language', $config["language"]); $values['language'] = get_parameter ('language', $config["language"]);
$values['id_skin'] = get_parameter ('skin', 0); $values['id_skin'] = get_parameter ('skin', 0);
$values['block_size'] = get_parameter ('block_size', $config["block_size"]);
$values['flash_chart'] = get_parameter ('flash_charts', $config["flash_charts"]);
if ($id == '') { if ($id == '') {
print_error_message (__('User ID cannot be empty')); print_error_message (__('User ID cannot be empty'));
@ -111,7 +116,8 @@ if ($create_user) {
' Lastname: ' . $values['lastname'] . ' Email: ' . $values['email'] . ' Lastname: ' . $values['lastname'] . ' Email: ' . $values['email'] .
' Phone: ' . $values['phone'] . ' Comments: ' . $values['comments'] . ' Phone: ' . $values['phone'] . ' Comments: ' . $values['comments'] .
' Is_admin: ' . $values['is_admin'] . ' Is_admin: ' . $values['is_admin'] .
' Language: ' . $values['language'] . ' Skin: ' . $values['id_skin']; ' Language: ' . $values['language'] . ' Skin: ' . $values['id_skin'] .
' Block size: ' . $values['block_size'] . ' Flash Chats: ' . $values['flash_chart'];
$result = create_user ($id, $password_new, $values); $result = create_user ($id, $password_new, $values);
@ -148,6 +154,8 @@ if ($update_user) {
$values['is_admin'] = get_parameter ('is_admin', 0 ); $values['is_admin'] = get_parameter ('is_admin', 0 );
$values['language'] = (string) get_parameter ('language', $config["language"]); $values['language'] = (string) get_parameter ('language', $config["language"]);
$values['id_skin'] = get_parameter ('skin', 0); $values['id_skin'] = get_parameter ('skin', 0);
$values['block_size'] = get_parameter ('block_size', $config["block_size"]);
$values['flash_chart'] = get_parameter ('flash_charts', $config["flash_charts"]);
$res1 = update_user ($id, $values); $res1 = update_user ($id, $values);
@ -170,7 +178,8 @@ if ($update_user) {
' Lastname: ' . $values['lastname'] . ' Email: ' . $values['email'] . ' Lastname: ' . $values['lastname'] . ' Email: ' . $values['email'] .
' Phone: ' . $values['phone'] . ' Comments: ' . $values['comments'] . ' Phone: ' . $values['phone'] . ' Comments: ' . $values['comments'] .
' Is_admin: ' . $values['is_admin'] . ' Is_admin: ' . $values['is_admin'] .
' Language: ' . $values['language'] . ' Skin: ' . $values['id_skin']; ' Language: ' . $values['language'] . ' Skin: ' . $values['id_skin'] .
' Block size: ' . $values['block_size'] . ' Flash Chats: ' . $values['flash_chart'];
pandora_audit("User management", "Updated user ".safe_input($id), pandora_audit("User management", "Updated user ".safe_input($id),
false, false, $info); false, false, $info);
@ -286,11 +295,17 @@ $table->data[9][1] = print_textarea ("comments", 2, 65, $user_info['comments'],
($view_mode ? 'readonly="readonly"' : ''), true); ($view_mode ? 'readonly="readonly"' : ''), true);
// If we want to create a new user, skins displayed are the skins of the creator's group. If we want to update, skins displayed are the skins of the modified user. // If we want to create a new user, skins displayed are the skins of the creator's group. If we want to update, skins displayed are the skins of the modified user.
if ($new_user){ $own_info = get_user_info ($config['id_user']);
$usr_groups = (get_user_groups($config['id_user'])); if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$display_all_group = true;
else
$display_all_group = false;
if ($new_user){
$usr_groups = (get_user_groups($config['id_user'], 'AR', $display_all_group));
$id_usr = $config['id_user']; $id_usr = $config['id_user'];
}else{ }else{
$usr_groups = (get_user_groups($id)); $usr_groups = (get_user_groups($id, 'AR', $display_all_group));
$id_usr = $id; $id_usr = $id;
} }
@ -304,6 +319,13 @@ if (count($usr_groups) > 1){
} }
} }
$table->data[11][0] = __('Flash charts');
$table->data[11][1] = __('Yes').'&nbsp;'.print_radio_button ('flash_charts', 1, '', $user_info["flash_chart"], true).'&nbsp;&nbsp;';
$table->data[11][1] .= __('No').'&nbsp;'.print_radio_button ('flash_charts', 0, '', $user_info["flash_chart"], true);
$table->data[12][0] = __('Block size for pagination');
$table->data[12][1] = print_input_text ('block_size', $user_info["block_size"], '', 5, 5, true);
echo '<form method="post">'; echo '<form method="post">';
print_table ($table); print_table ($table);

View File

@ -17,7 +17,7 @@ global $config;
check_login (); check_login ();
if (! give_acl ($config['id_user'], 0, "IR")) { if (! check_acl ($config['id_user'], 0, "IR")) {
pandora_audit("ACL Violation", pandora_audit("ACL Violation",
"Trying to access report builder"); "Trying to access report builder");
require ("general/noaccess.php"); require ("general/noaccess.php");

View File

@ -103,6 +103,12 @@ if (isset ($config['id_user'])){
$config['user_language'] = $userinfo["language"]; $config['user_language'] = $userinfo["language"];
} }
// If block_size or flash_chart are provided then override global settings
if (!empty($userinfo["block_size"]))
$config["block_size"] = $userinfo["block_size"];
if (!empty($userinfo["block_size"]))
$config["flash_charts"] = $userinfo["flash_chart"];
// Each user could have it's own timezone) // Each user could have it's own timezone)
if (isset($userinfo["timezone"])) { if (isset($userinfo["timezone"])) {
if ($userinfo["timezone"] != ""){ if ($userinfo["timezone"] != ""){

View File

@ -437,6 +437,24 @@ function get_profiles () {
return $return; return $return;
} }
/**
* Selects profiles filtered
*
* @return array List of profiles filtered
*/
function get_profiles_filter ($filter) {
$sql = sprintf('SELECT * FROM tperfil WHERE %s', $filter);
$profiles = get_db_all_rows_sql ($sql);
$return = array ();
if ($profiles === false) {
return $return;
}
foreach ($profiles as $profile) {
$return[$profile["id_perfil"]] = $profile["name"];
}
return $return;
}
/** /**
* Create Profile for User * Create Profile for User

View File

@ -22,16 +22,27 @@
/** /**
* Get a list of CSS themes installed. * Get a list of CSS themes installed.
* *
* @param bool List all css files of an specific path without filter "pandora*" pattern
*
* @return array An indexed array with the file name in the index and the theme * @return array An indexed array with the file name in the index and the theme
* name (if available) as the value. * name (if available) as the value.
*/ */
function get_css_themes () { function get_css_themes ($path = false) {
$theme_dir = 'include/styles/'; if ($path)
$theme_dir = $path;
else
$theme_dir = 'include/styles/';
$files = list_files ($theme_dir, "pandora", 1, 0); if ($path)
$files = list_files ($theme_dir, "pandora", 0, 0);
else
$files = list_files ($theme_dir, "pandora", 1, 0);
$retval = array (); $retval = array ();
foreach ($files as $file) { foreach ($files as $file) {
//Skip '..' and '.' entries and files not ended in '.css'
if ($path && ($file == '.' || $file == '..' || strtolower(substr ($file, strlen ($file) - 4)) !== '.css'))
continue;
$data = implode ('', file ($theme_dir.'/'.$file)); $data = implode ('', file ($theme_dir.'/'.$file));
preg_match ('|Name:(.*)$|mi', $data, $name); preg_match ('|Name:(.*)$|mi', $data, $name);
if (isset ($name[1])) if (isset ($name[1]))

View File

@ -831,13 +831,35 @@ function process_page_head ($string, $bitfield) {
if (empty ($config['css'])) { if (empty ($config['css'])) {
$config['css'] = array (); $config['css'] = array ();
} }
//First, if user has assigned a skin then try to use css files of skin subdirectory
$isFunctionSkins = enterprise_include_once ('include/functions_skins.php');
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
//Checks if user's skin is available
$exists_skin = enterprise_hook('is_skin_path_set');
if ($exists_skin){
$skin_path = enterprise_hook('get_skin_path');
$skin_styles = get_css_themes ($skin_path . 'include/styles/');
$exists_css = !empty($skin_styles);
}
}
//If skin's css files exists then add them
if ($exists_css){
foreach ($skin_styles as $filename => $name){
$style = substr ($filename, 0, strlen ($filename) - 4);
$config['css'] = array_merge(array ($style => $skin_path . 'include/styles/' . $filename));
}
}
//Otherwise assign default and user's css
else{
//User style should go last so it can rewrite common styles //User style should go last so it can rewrite common styles
$config['css'] = array_merge (array ( $config['css'] = array_merge (array (
"common" => "include/styles/common.css", "common" => "include/styles/common.css",
"menu" => "include/styles/menu.css", "menu" => "include/styles/menu.css",
"tip", "include/styles/tip.css", "tip", "include/styles/tip.css",
$config['style'] => "include/styles/".$config['style'].".css"), $config['css']); $config['style'] => "include/styles/".$config['style'].".css"), $config['css']);
}
//We can't load empty and we loaded (conditionally) ie //We can't load empty and we loaded (conditionally) ie
$loaded = array ('', 'ie'); $loaded = array ('', 'ie');

View File

@ -116,7 +116,7 @@ enterprise_include ('index.php');
// This tag is included in the buffer passed to process_page_head so // This tag is included in the buffer passed to process_page_head so
// technically it can be stripped // technically it can be stripped
echo '</head>'."\n"; echo '</head>'."\n";
require_once ("include/functions_themes.php");
ob_start ('process_page_body'); ob_start ('process_page_body');
$config["remote_addr"] = $_SERVER['REMOTE_ADDR']; $config["remote_addr"] = $_SERVER['REMOTE_ADDR'];

View File

@ -54,6 +54,9 @@ if (isset ($_GET["modified"]) && !$view_mode) {
$upd_info["phone"] = get_parameter_post ("phone", $user_info["phone"]); $upd_info["phone"] = get_parameter_post ("phone", $user_info["phone"]);
$upd_info["comments"] = get_parameter_post ("comments", $user_info["comments"]); $upd_info["comments"] = get_parameter_post ("comments", $user_info["comments"]);
$upd_info["language"] = get_parameter_post ("language", $user_info["language"]); $upd_info["language"] = get_parameter_post ("language", $user_info["language"]);
$upd_info["id_skin"] = get_parameter ("skin", $user_info["id_skin"]);
$upd_info["block_size"] = get_parameter ("block_size", $config["block_size"]);
$upd_info["flash_chart"] = get_parameter ("flash_charts", $config["flash_charts"]);
if ( !empty ($password_new)) { if ( !empty ($password_new)) {
if ($config["user_can_update_password"] && $password_confirm == $password_new) { if ($config["user_can_update_password"] && $password_confirm == $password_new) {
@ -135,7 +138,33 @@ echo print_select_from_sql ('SELECT id_language, name FROM tlanguage',
echo '</td></tr><tr><td class="datos2">'.__('Comments').'</td><td class="datos">'; echo '</td></tr><tr><td class="datos2">'.__('Comments').'</td><td class="datos">';
print_textarea ("comments", 2, 60, $user_info["comments"], ($view_mode ? 'readonly="readonly"' : '')); print_textarea ("comments", 2, 60, $user_info["comments"], ($view_mode ? 'readonly="readonly"' : ''));
$own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$display_all_group = true;
else
$display_all_group = false;
$usr_groups = (get_user_groups($config['id_user'], 'AR', $display_all_group));
$id_usr = $config['id_user'];
// User only can change skins if has more than one group
if (count($usr_groups) > 1){
$isFunctionSkins = enterprise_include_once ('include/functions_skins.php');
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
echo '</td></tr><tr><td class="datos">' . __('Skin') . '</td><td class="datos2">';
echo print_select_skins($id_usr,'skin', $user_info['id_skin'], '', __('None'), 0, true);
}
}
echo '</td></tr><tr><td class="datos">'.__('Flash charts').'</td><td class="datos2">';
echo __('Yes').'&nbsp;'.print_radio_button ('flash_charts', 1, '', $user_info["flash_chart"], true).'&nbsp;&nbsp;';
echo __('No').'&nbsp;'.print_radio_button ('flash_charts', 0, '', $user_info["flash_chart"], true);
echo '</td></tr><tr><td class="datos">'.__('Block size for pagination').'</td><td class="datos2">';
echo print_input_text ('block_size', $user_info["block_size"], '', 5, 5, true);
echo '</td></tr></table>'; echo '</td></tr></table>';
echo '<div style="width:90%; text-align:right;">'; echo '<div style="width:90%; text-align:right;">';