2012-03-08 Miguel de Dios <miguel.dedios@artica.es>

* pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
	extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql,
	extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql,
	extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql: added the field
	shortcut_data for to save as serialize the quick links.

	* general/shortcut_bar.php: added code to new feature to save in the
	sortcut the important links for quick access.

	* include/functions_menu.php, godmode/agentes/modificar_agente.php: added
	class "item_drag_shortcut" to links for drag to shorcut. For make a example.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5729 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-03-08 18:09:21 +00:00
parent 93e51b8144
commit 1da151df03
10 changed files with 308 additions and 191 deletions

View File

@ -1,3 +1,17 @@
2012-03-08 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql: added the field
shortcut_data for to save as serialize the quick links.
* general/shortcut_bar.php: added code to new feature to save in the
sortcut the important links for quick access.
* include/functions_menu.php, godmode/agentes/modificar_agente.php: added
class "item_drag_shortcut" to links for drag to shorcut. For make a example.
2012-03-08 Sancho Lerena <slerena@artica.es>
* include/functions_visual_map.php

View File

@ -55,6 +55,7 @@ CREATE TABLE IF NOT EXISTS `tnetflow_report_content` (
ALTER TABLE `tusuario` ADD COLUMN `disabled` int(4) NOT NULL DEFAULT 0;
ALTER TABLE `tusuario` ADD COLUMN `shortcut` tinyint(1) DEFAULT 0;
ALTER TABLE tusuario ADD COLUMN `shortcut_data` text default '';
-- -----------------------------------------------------
-- Table `tincidencia`

View File

@ -168,9 +168,15 @@ ALTER TABLE tgraph ADD (id_graph_template NUMBER(11, 0) default 0 NOT NULL);
-- Table `ttipo_modulo`
-- -----------------------------------------------------
UPDATE ttipo_modulo SET descripcion='Generic data' WHERE id_tipo=1;
UPDATE ttipo_modulo SET descripcion='Generic data incremental' WHERE id_tipo=4;
-- -----------------------------------------------------
-- Table `tusuario`
-- -----------------------------------------------------
ALTER TABLE tusuario ADD COLUMN disabled NUMBER(10, 0) NOT NULL DEFAULT 0;
ALTER TABLE tusuario ADD COLUMN shortcut NUMBER(5, 0) DEFAULT 0;
ALTER TABLE tusuario ADD COLUMN shortcut_data CLOB default '';
-- -----------------------------------------------------
-- Table `tusuario`
-- -----------------------------------------------------

View File

@ -155,9 +155,15 @@ ALTER TABLE "tgraph" ADD COLUMN "id_graph_template" INTEGER NOT NULL default 0;
-- Table `ttipo_modulo`
-- -----------------------------------------------------
UPDATE "ttipo_modulo" SET "descripcion"='Generic data' WHERE "id_tipo"=1;
UPDATE "ttipo_modulo" SET "descripcion"='Generic data incremental' WHERE "id_tipo"=4;
-- -----------------------------------------------------
-- Table `tusuario`
-- -----------------------------------------------------
ALTER TABLE "tusuario" ADD COLUMN "disabled" INTEGER NOT NULL DEFAULT 0;
ALTER TABLE "tusuario" ADD COLUMN "shortcut" SMALLINT DEFAULT 0;
ALTER TABLE "tusuario" ADD COLUMN "shortcut_data" text default '';
-- -----------------------------------------------------
-- Table `tusuario`
-- -----------------------------------------------------

View File

@ -14,6 +14,37 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
// Login check
check_login ();
if (is_ajax()){
require_once("include/functions_reporting.php");
$save_item_shorcut = get_parameter("save_item_shorcut", 0);
if ($save_item_shorcut) {
$data = get_parameter("data", '');
$id_user = get_parameter('id_user', 0);
if ($config['id_user'] != $id_user) return;
$shortcut_data = db_get_value('shortcut_data', 'tusuario', 'id_user', $id_user);
if ($shortcut_data !== false) {
$serialize = $shortcut_data;
$unserialize = json_decode($serialize, true);
$unserialize['item_shorcut'][] = $data;
$shortcut_data = array();
$shortcut_data['shortcut_data'] = json_encode($unserialize);
db_process_sql_update('tusuario', $shortcut_data, array('id_user' => $id_user));
}
}
return;
}
$shortcut_state = db_get_value_filter('shortcut', 'tusuario', array('id_user' => $config['id_user']));
// If shortcut bar is disabled return to index.php
@ -222,6 +253,28 @@
}
html_print_input_hidden("shortcut_id_user", $config['id_user']);
//Quick access
$shortcut_data = db_get_value('shortcut_data', 'tusuario', 'id_user', $config['id_user']);
if (!empty($shortcut_data)) {
$serialize = $shortcut_data;
$unserialize = json_decode($serialize, true);
$items = $unserialize['item_shorcut'];
}
else {
$items = array();
}
echo "<div id='shortcut_icons_box' style='font-size: 9pt; color:#696969; font-weight: bold; display: inline; float: right; padding-right: 20px;'>" .
__("Shortcut: ");
echo "<ul style='display: inline; font-size: 9pt; color:#000;'>";
foreach ($items as $item) {
echo "<li style='display: inline; padding-right: 10px;'>" . io_safe_output($item) . "</li>";
}
echo "</ul>";
echo "</div>";
echo "</div>";
?>
@ -308,8 +361,42 @@
}
$(document).ready (function () {
//TODO: Fix the change the content for the menu as html.
setInterval("shortcut_check_alerts()", (10 * 1000)); //10 seconds between ajax request
setInterval("shortcut_check_events()", (10 * 1000)); //10 seconds between ajax request
setInterval("shortcut_check_incidents()", (10 * 1000)); //10 seconds between ajax request
//For to make a link as item for drag only put "item_drag_shortcut" as class.
//TODO: In the future show better as icons and the handle some icon.
//TODO: Remove the class "item_drag_shortcut" for avoid drag.
//TODO: Method for remove items.
$("#shortcut_icons_box").droppable({
drop: function( event, ui ) {
var item = ui.draggable.clone();
//unescape for avoid change returns
var content_item = unescape($('<div id="content_item"></div>').html(item).html()); //hack
//Add the element
$("<li style='display: inline; padding-right: 10px;'></li>").html(item).appendTo($("#shortcut_icons_box > ul"));
jQuery.post ('ajax.php',
{"page": "general/shortcut_bar",
"save_item_shorcut": 1,
"id_user": "<?php echo $config['id_user'];?>",
"data": content_item
},
function (data) {
}
);
}
});
$(".item_drag_shortcut").draggable({
appendTo: 'body',
helper: "clone",
scroll: false
});
});
</script>

View File

@ -401,7 +401,7 @@ if ($agents !== false) {
echo "<em>";
}
echo '<span class="left">';
echo "<strong><a href='index.php?sec=gagente&
echo "<strong><a class='item_drag_shortcut' href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=main&
id_agente=".$agent["id_agente"]."'>" . ui_print_truncate_text($agent["nombre"], 60, true, true, true, '[&hellip;]', 'font-size: 7pt')."</a></strong>";
if ($agent["disabled"]) {

View File

@ -184,7 +184,7 @@ function menu_print_menu (&$menu) {
} else {
$title = '';
}
$submenu_output .= '<a href="index.php?'.$extensionInMenu.'sec='.$secUrl.'&amp;sec2='.$subsec2.($sub["refr"] ? '&amp;refr=' . $sub["refr"] : '').$link_add.'"' . $title . '>'.$sub["text"].'</a>';
$submenu_output .= '<a class="item_drag_shortcut" href="index.php?'.$extensionInMenu.'sec='.$secUrl.'&amp;sec2='.$subsec2.($sub["refr"] ? '&amp;refr=' . $sub["refr"] : '').$link_add.'"' . $title . '>'.$sub["text"].'</a>';
$submenu_output .= '</li>';
}
}

View File

@ -869,6 +869,7 @@ CREATE TABLE tusuario (
id_skin NUMBER(10, 0) DEFAULT 0 NOT NULL,
disabled NUMBER(10, 0) default 0 NOT NULL,
shortcut NUMBER(5, 0) DEFAULT 0,
shortcut_data CLOB default '',
section VARCHAR2(255) NOT NULL,
data_section VARCHAR2(255) NOT NULL
);

View File

@ -699,6 +699,7 @@ CREATE TABLE "tusuario" (
"id_skin" INTEGER NOT NULL DEFAULT 0,
"disabled" INTEGER NOT NULL default 1,
"shortcut" SMALLINT DEFAULT 0,
"shortcut_data" text default '',
"section" varchar(255) NOT NULL,
"data_section" varchar(255) NOT NULL
);

View File

@ -774,6 +774,7 @@ CREATE TABLE IF NOT EXISTS `tusuario` (
`id_skin` int(10) unsigned NOT NULL,
`disabled` int(4) NOT NULL DEFAULT 0,
`shortcut` tinyint(1) DEFAULT 0,
`shortcut_data` text default '',
`section` TEXT NOT NULL,
`data_section` TEXT NOT NULL,
UNIQUE KEY `id_user` (`id_user`)