2013-04-02 Junichi Satoh <junichi@rworks.jp>

* extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
	extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
	extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
	pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
	godmode/alerts/alert_special_days.php,
	godmode/alerts/configure_alert_special_days.php: Added group ACL to
	'Special days list'.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7908 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
jsatoh 2013-04-02 06:29:38 +00:00
parent 7220edb95e
commit 757685ead6
9 changed files with 53 additions and 17 deletions

View File

@ -1,3 +1,13 @@
2013-04-02 Junichi Satoh <junichi@rworks.jp>
* extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
godmode/alerts/alert_special_days.php,
godmode/alerts/configure_alert_special_days.php: Added group ACL to
'Special days list'.
2013-04-01 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/include/ui.class.php,

View File

@ -73,6 +73,7 @@ ALTER TABLE `tagente` ADD COLUMN `update_alert_count` tinyint(1) NOT NULL DEFAUL
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `talert_special_days` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_group` INT(10) NOT NULL DEFAULT 0,
`date` date NOT NULL DEFAULT '0000-00-00',
`same_day` enum('monday','tuesday','wednesday','thursday','friday','saturday','sunday') NOT NULL DEFAULT 'sunday',
`description` text,

View File

@ -94,6 +94,7 @@ ALTER TABLE tagente ADD (update_alert_count NUMBER(5, 0) default 0 NOT NULL);
-- -----------------------------------------------------
CREATE TABLE talert_special_days (
id NUMBER(10,0) NOT NULL PRIMARY KEY,
id_group NUMBER(10, 0) default 0 NOT NULL,
date DATE default '0000-00-00' NOT NULL,
same_day VARCHAR2(20) default 'sunday',
description CLOB,

View File

@ -90,6 +90,7 @@ ALTER TABLE "tagente" ADD COLUMN "update_alert_count" SMALLINT NOT NULL default
CREATE TYPE type_talert_special_days_same_day AS ENUM ('monday','tuesday','wednesday','thursday','friday','saturday','sunday');
CREATE TABLE "talert_special_days" (
"id" SERIAL NOT NULL PRIMARY KEY,
"id_group" INTEGER NOT NULL default 0,
"date" DATE NOT NULL default '0001-01-01',
"same_day" type_talert_special_days_same_day NOT NULL default 'sunday',
"description" TEXT

View File

@ -3,7 +3,7 @@
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Copyright (c) 2012 Junichi Satoh
// Copyright (c) 2012-2013 Junichi Satoh
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
@ -49,7 +49,9 @@ $delete_special_day = (bool) get_parameter ('delete_special_day');
if ($create_special_day) {
$date = (string) get_parameter ('date');
$same_day = (string) get_parameter ('same_day');
$description = (string) get_parameter ('description');
$values = array();
$values['id_group'] = (string) get_parameter ('id_group');
$values['description'] = (string) get_parameter ('description');
list($year, $month, $day) = explode("-", $date);
if ($year == '*') {
@ -68,8 +70,8 @@ if ($create_special_day) {
$result = '';
}
else {
$result = alerts_create_alert_special_day ($date, $same_day, array ('description' => $description));
$info = 'Date: ' . $date . ' Same day of the week: ' . $same_day . ' Description: ' . $description;
$result = alerts_create_alert_special_day ($date, $same_day, $values);
$info = 'Date: ' . $date . ' Same day of the week: ' . $same_day . ' Description: ' . $values['description'];
}
}
@ -91,6 +93,7 @@ if ($update_special_day) {
$date = (string) get_parameter ('date');
$same_day = (string) get_parameter ('same_day');
$description = (string) get_parameter ('description');
$id_group = (string) get_parameter ('id_group');
list($year, $month, $day) = explode("-", $date);
if ($year == '*') {
@ -101,6 +104,7 @@ if ($update_special_day) {
$values = array ();
$values['date'] = $date;
$values['id_group'] = $id_group;
$values['same_day'] = $same_day;
$values['description'] = $description;
@ -147,18 +151,25 @@ $table->head = array ();
$table->head[0] = __('Date');
$table->head[1] = __('Same day of the week');
$table->head[2] = __('Description');
$table->head[3] = __('Delete');
$table->head[3] = __('Group');
$table->head[4] = __('Delete');
$table->style = array ();
$table->style[0] = 'font-weight: bold';
$table->size = array ();
$table->size[0] = '20%';
$table->size[1] = '15%';
$table->size[2] = '60%';
$table->size[2] = '55%';
$table->size[3] = '5%';
$table->size[4] = '5%';
$table->align = array ();
$table->align[3] = 'center';
$table->align[4] = 'center';
$special_days = db_get_all_rows_in_table ('talert_special_days', 'date');
$filter = array();
if (!is_user_admin($config['id_user']))
$filter['id_group'] = array_keys(users_get_groups(false, "LM"));
$special_days = db_get_all_rows_filter ('talert_special_days', $filter);
if ($special_days === false)
$special_days = array ();
@ -194,8 +205,8 @@ foreach ($special_days as $special_day) {
break;
}
$data[2] = $special_day['description'];
$data[3] = '';
$data[3] = '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&delete_special_day=1&id='.$special_day['id'].'"
$data[3] = ui_print_group_icon ($special_day["id_group"], true);
$data[4] = '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&delete_special_day=1&id='.$special_day['id'].'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
html_print_image("images/cross.png", true) . '</a>';

View File

@ -3,7 +3,7 @@
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Copyright (c) 2012 Junichi Satoh
// Copyright (c) 2012-2013 Junichi Satoh
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
@ -36,6 +36,7 @@ $command = '';
$description = '';
$date = '';
$same_day = '';
$id_group = 0;
if ($id) {
$special_day = alerts_get_alert_special_day ($id);
$date = str_replace('0001', '*', $special_day['date']);
@ -59,7 +60,17 @@ $table->data = array ();
$table->data[0][0] = __('Date');
$table->data[0][1] = html_print_input_text ('date', $date, '', 10, 10, true);
$table->data[0][1] .= html_print_image ("images/calendar_view_day.png", true, array ("alt" => "calendar", "onclick" => "scwShow(scwID('text-date'),this);"));
$table->data[1][0] = __('Same day of the week');
$table->data[1][0] = __('Group');
$groups = users_get_groups ();
$own_info = get_user_info ($config['id_user']);
// Only display group "All" if user is administrator or has "PM" privileges
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$display_all_group = true;
else
$display_all_group = false;
$table->data[1][1] = html_print_select_groups(false, "LW", $display_all_group, 'id_group', $id_group, '', '', 0, true);
$table->data[2][0] = __('Same day of the week');
$days = array ();
$days["monday"] = __('Monday');
$days["tuesday"] = __('Tuesday');
@ -68,12 +79,10 @@ $days["thursday"] = __('Thursday');
$days["friday"] = __('Friday');
$days["saturday"] = __('Saturday');
$days["sunday"] = __('Sunday');
$table->data[1][1] = html_print_select ($days, "same_day", $same_day, '', '', 0, true, false, false);
$table->data[2][1] = html_print_select ($days, "same_day", $same_day, '', '', 0, true, false, false);
#$table->data[1][1] = html_print_input_text ('same_day', $same_day, '', 80, 255, true);
$table->data[2][0] = __('Description');
$table->data[2][1] = html_print_textarea ('description', 10, 30, $description, '', true);
$table->data[3][0] = __('Description');
$table->data[3][1] = html_print_textarea ('description', 10, 30, $description, '', true);
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days">';
html_print_table ($table);
@ -90,4 +99,4 @@ else {
}
echo '</div>';
echo '</form>';
?>
?>

View File

@ -453,6 +453,7 @@ CREATE OR REPLACE TRIGGER talert_template_mod_ac_update1 AFTER UPDATE OF ID ON t
CREATE TABLE talert_special_days (
id NUMBER(10,0) NOT NULL PRIMARY KEY,
id_group NUMBER(10, 0) default 0 NOT NULL,
date DATE default '0000-00-00' NOT NULL,
same_day VARCHAR2(20) default 'sunday',
description CLOB,

View File

@ -392,6 +392,7 @@ CREATE TABLE "talert_template_module_actions" (
CREATE TYPE type_talert_special_days_same_day AS ENUM ('monday','tuesday','wednesday','thursday','friday','saturday','sunday');
CREATE TABLE "talert_special_days" (
"id" SERIAL NOT NULL PRIMARY KEY,
"id_group" INTEGER NOT NULL default 0,
"date" DATE NOT NULL default '0001-01-01',
"same_day" type_talert_special_days_same_day NOT NULL default 'sunday',
"description" TEXT

View File

@ -436,6 +436,7 @@ CREATE TABLE IF NOT EXISTS `talert_template_module_actions` (
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `talert_special_days` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_group` INT(10) NOT NULL DEFAULT 0,
`date` date NOT NULL DEFAULT '0000-00-00',
`same_day` enum('monday','tuesday','wednesday','thursday','friday','saturday','sunday') NOT NULL DEFAULT 'sunday',
`description` text,