From 26d18671da64f45a7cbb9410d2e2062fafb26498 Mon Sep 17 00:00:00 2001 From: SJ Date: Sun, 31 Mar 2013 14:50:21 +0200 Subject: [PATCH] folder fixes --- webui/model/folder/folder.php | 5 + webui/model/search/search.php | 4 +- webui/view/javascript/piler-in.js | 100 ++++++++++++++++-- .../default/stylesheet/style-default.css | 18 +--- .../default/templates/common/menu-admin.tpl | 53 ---------- .../theme/default/templates/common/menu.tpl | 3 + .../theme/default/templates/folder/list.tpl | 2 +- .../theme/default/templates/search/folder.tpl | 16 +-- .../theme/default/templates/search/helper.tpl | 4 +- 9 files changed, 118 insertions(+), 87 deletions(-) delete mode 100644 webui/view/theme/default/templates/common/menu-admin.tpl diff --git a/webui/model/folder/folder.php b/webui/model/folder/folder.php index 4e49a00a..9c1dd2c8 100644 --- a/webui/model/folder/folder.php +++ b/webui/model/folder/folder.php @@ -188,6 +188,11 @@ class ModelFolderFolder extends Model { if($name == '') { return -1; } $query = $this->db->query("INSERT INTO " . TABLE_FOLDER_EXTRA . " (uid, name) VALUES(?,?)", array($_SESSION['uid'], $name)); + + $last_id = $this->db->getLastId(); + + if(!isset($_SESSION['extra_folders'][$last_id])) { array_push($_SESSION['extra_folders'], $last_id); } + return $this->db->countAffected(); } diff --git a/webui/model/search/search.php b/webui/model/search/search.php index ca3a71db..bea7c740 100644 --- a/webui/model/search/search.php +++ b/webui/model/search/search.php @@ -302,7 +302,9 @@ class ModelSearchSearch extends Model { if(count($__folders) > 0) { $folders = "folder IN (" . implode(",", $__folders) . ") AND "; } - + else { + $folders = "folder IN (" . implode(",", $_SESSION['folders']) . ") AND "; + } } diff --git a/webui/view/javascript/piler-in.js b/webui/view/javascript/piler-in.js index 8bde1bef..313b2ec3 100644 --- a/webui/view/javascript/piler-in.js +++ b/webui/view/javascript/piler-in.js @@ -12,6 +12,10 @@ var Piler = piler_ui_lang: '', prev_message_id: 0, pos: -1, + current_message_id: 0, + folders: '', + extra_folders: '', + /* * variables used at search listing @@ -125,7 +129,7 @@ var Piler = Piler.Shared.type == 'search' ? url = '/search-helper.php' : url = '/audit-helper.php'; Piler.log("[load_search_results]", url); - + Piler.spinner('start'); jQuery.ajax( url, { @@ -401,6 +405,7 @@ var Piler = Piler.Messages = u; Piler.pos = -1; Piler.prev_message_id = 0; + Piler.current_message_id = 0; }, @@ -469,11 +474,15 @@ var Piler = Piler.Shared.page = 0; Piler.Shared.type = 'search'; - + + Piler.assemble_folder_restrictions(); + Piler.Searches.Expert = { search : $('input#_search').val().trim(), searchtype : 'expert', - ref: $('#ref').val() + ref: $('#ref').val(), + folders: Piler.folders, + extra_folders: Piler.extra_folders } $('#ref').val(''); @@ -495,14 +504,16 @@ var Piler = // a = $( a );// a == DOM element // a = Piler.getSource( a );// a == Javascript event - + var z = $('div#searchpopup1'); - + Piler.search = 'Complex'; Piler.Shared.page = 0; Piler.Shared.type = 'search'; - + + Piler.assemble_folder_restrictions(); + Piler.Searches.Complex = { from : $('input#xfrom', z).val().trim(), to : $('input#xto', z).val().trim(), @@ -515,7 +526,7 @@ var Piler = date2 : $('input#date2', z).val().trim(), searchtype : 'simple' } - + Piler.load_search_results();//, Piler.assemble_search_term( count ), 0); $('#searchpopup1').hide(); @@ -758,6 +769,81 @@ var Piler = }); + }, + + + assemble_folder_restrictions: function() + { + Piler.log("[assemble_folder_restrictions]"); + + Piler.folders = ''; + Piler.extra_folders = ''; + + a = document.getElementById('folders'); + if(!a) { return false; } + + childNodeArray = a.getElementsByTagName('*'); + + if(childNodeArray) { + for(i=0; i - -
- -
- -
-
-
- - -
-
-
- - -
- -
-
- : , id="active"> -
-
- - -
- - - diff --git a/webui/view/theme/default/templates/common/menu.tpl b/webui/view/theme/default/templates/common/menu.tpl index 556cbdc5..870244d8 100644 --- a/webui/view/theme/default/templates/common/menu.tpl +++ b/webui/view/theme/default/templates/common/menu.tpl @@ -39,6 +39,9 @@ class="active"> + + class="active"> + diff --git a/webui/view/theme/default/templates/folder/list.tpl b/webui/view/theme/default/templates/folder/list.tpl index f64082d3..c3b0507b 100644 --- a/webui/view/theme/default/templates/folder/list.tpl +++ b/webui/view/theme/default/templates/folder/list.tpl @@ -16,7 +16,7 @@
 
-
+
diff --git a/webui/view/theme/default/templates/search/folder.tpl b/webui/view/theme/default/templates/search/folder.tpl index 1eea76fd..a05b210b 100644 --- a/webui/view/theme/default/templates/search/folder.tpl +++ b/webui/view/theme/default/templates/search/folder.tpl @@ -1,11 +1,13 @@ -

:

+

:

-
+
-
- +
+
@@ -16,7 +18,7 @@ function display_folders($arr = array(), &$i) { ?> -
+
0) { ?> - - + +
diff --git a/webui/view/theme/default/templates/search/helper.tpl b/webui/view/theme/default/templates/search/helper.tpl index fa5cca70..ca7213aa 100644 --- a/webui/view/theme/default/templates/search/helper.tpl +++ b/webui/view/theme/default/templates/search/helper.tpl @@ -45,7 +45,7 @@ - + checked="checked" /> . @@ -82,7 +82,7 @@
-
+ = $page_len){ ?>