From 24151ef5687fe473886ee5ffe4944f72f9fe869e Mon Sep 17 00:00:00 2001 From: sparkyx Date: Wed, 15 Jan 2025 16:43:01 +0100 Subject: [PATCH] Rewrite Bookmark javascript --- .gitignore | 1 + html/js/noalyss_script.js | 34 ++++++++++++++++++++++------------ include/ajax/ajax_bookmark.php | 22 ++++++++++++++++++---- sql/upgrade.sql | 3 +++ 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index b5318cf3b..b656f0851 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,4 @@ local/* .idea/* include/tfpdf/font/unifont/* html/ads.html +doc/code/* diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js index 8d2351f5b..275ca6e5b 100644 --- a/html/js/noalyss_script.js +++ b/html/js/noalyss_script.js @@ -2423,12 +2423,20 @@ function set_preference(p_dossier) { } } +//////////////////////////////////////////////////////// +/** + *@class Bookmark + */ +//////////////////////////////////////////////////////// +var Bookmark = function() { + +} /** * Display user's bookmark - * + * @param p_dossier {int} Dossier id */ -function show_bookmark(p_dossier) { + Bookmark.prototype.show = function (p_dossier) { try { waiting_box(); removeDiv('bookmark_div'); @@ -2449,6 +2457,7 @@ function show_bookmark(p_dossier) { } catch (e) { alert_box(content[53] + "\n" + e.message); } + id$('lk_bookmark_tb').focus(); } } @@ -2458,11 +2467,10 @@ function show_bookmark(p_dossier) { } } - /** * save the bookmark */ -function save_bookmark() { +Bookmark.prototype.save = function () { try { waiting_box(); var queryString = "op=bookmark&" + id$("bookmark_frm").serialize(); @@ -2494,7 +2502,7 @@ function save_bookmark() { /** * remove selected bookmark */ -function remove_bookmark() { +Bookmark.prototype.remove= function () { try { waiting_box(); var queryString = "op=bookmark&" + id$("bookmark_del_frm").serialize(); @@ -3302,9 +3310,9 @@ function show_all_row(p_table_id) { * @class * Periode handling * Variables : - * - id of the row of the periode row_per_(p_periode_id) , attribute exercice =per_exercice,periode_id=p_id - * - (this.dialog) - * - id of the table with the rows : periode_tbl + * id of the row of the periode row_per_(p_periode_id) , attribute exercice =per_exercice,periode_id=p_id + * # (this.dialog) + * # id of the table with the rows : periode_tbl * * Members : * - periode_id the concerned Periode , 0 none @@ -4377,11 +4385,11 @@ function activate_plugin(elt) alert_box(e.message); } } -/**********************************************************************************************************************/ +/**********************************************************************************************/ /** * @class Widget - */ -/**********************************************************************************************************************/ + * +*************************************************************************************************************/ Widget = function(dossier_id) { this.dossier_id=dossier_id; @@ -4698,4 +4706,6 @@ Widget.prototype.toggle_full_size=function (widget_domid) { (function(){window.addEventListener("beforeunload", (event) => {waiting_box()});})(); (function(){window.addEventListener("onload", (event) => {remove_waiting_box()});})(); -*/ \ No newline at end of file +*/ + +var bookmark=new Bookmark(); \ No newline at end of file diff --git a/include/ajax/ajax_bookmark.php b/include/ajax/ajax_bookmark.php index 854e42ce3..02e12bf18 100644 --- a/include/ajax/ajax_bookmark.php +++ b/include/ajax/ajax_bookmark.php @@ -24,6 +24,10 @@ * @file * @brief user's bookmark */ +/** + * @var $cn Database inherited + * @var $g_user User_Noalyss inherited + */ if ( ! defined ('ALLOWED')) die('Appel direct ne sont pas permis'); echo HtmlInput::title_box(_("Favoris"), "bookmark_div"); if (! isset($_GET['ac'])) { @@ -32,7 +36,10 @@ if (! isset($_GET['ac'])) { */ $_GET['ac']= find_default_module(); } +//------------------------------------------------------------------------------------------- +// // Add bookmark +//------------------------------------------------------------------------------------------- if (isset($_GET['bookmark_add'])){ $count=$cn->get_value("select count(*) from bookmark" . " where b_action=$1 and login=$2", @@ -47,7 +54,10 @@ if (isset($_GET['bookmark_add'])){ echo create_script($js); } } +//------------------------------------------------------------------------------------------- // remove bookmark +// +//------------------------------------------------------------------------------------------- if (isset($_GET['bookmark_delete']) && isset ($_GET['book'])){ $a_book=$_GET['book']; for ($e=0;$eget_array($bookmark_sql,array($g_user->login)); $url="do.php?gDossier=".Dossier::id()."&ac="; +//------------------------------------------------------------------------------------------- +// Display content +//------------------------------------------------------------------------------------------- ?>
-
+ + - +
0) : endif; ?> - + - \ No newline at end of file + diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 04fe2a1a7..c7f275742 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -5,3 +5,6 @@ update parm_appearance set a_value='#FAFAFA' where a_code='FOLDER' and lower(a_v update parm_appearance set a_value='#506cb8 ' where a_code='MENU1-SELECTED' and lower(a_value)='#000074 '; ALTER TABLE public.todo_list ALTER COLUMN tl_date drop NOT NULL; + + +update menu_ref set me_javascript='bookmark.show()' where me_code='BOOKMARK'; \ No newline at end of file