diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 40f450505..a35fd1987 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -603,6 +603,18 @@ EOF;
case 'tag_choose':
require_once 'ajax_tag_choose.php';
break;
+ case 'tag_choose':
+ require_once 'ajax_tag_choose.php';
+ break;
+ case 'search_display_tag':
+ require_once 'ajax_search_display_tag.php';
+ break;
+ case 'search_add_tag':
+ require_once 'ajax_search_add_tag.php';
+ break;
+ case 'search_clear_tag':
+ require_once 'ajax_search_clear_tag.php';
+ break;
default:
var_dump($_GET);
}
diff --git a/html/do.php b/html/do.php
index a6e4718d0..dd2883193 100644
--- a/html/do.php
+++ b/html/do.php
@@ -21,6 +21,7 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
define('ALLOWED',1);
+
/**\file
* \brief Main file
*/
@@ -149,7 +150,6 @@ if ( isset ($_POST['set_preference'])) {
$_SESSION['g_pagesize']=$p_size;
$_SESSION['g_lang']=$lang;
}
-
/*
* if an action is requested
*/
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 88a370c92..ec6507f3f 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -23,8 +23,9 @@
* \brief javascript script, always added to every page
*
*/
-
var ask_reload=0;
+var tag_choose='';
+
/**
* callback function when we just need to update a hidden div with an info
* message
@@ -2165,11 +2166,19 @@ function action_tag_remove(p_dossier,ag_id,t_id)
error_message(e.getMessage);
}
}
-function choose_tag(p_dossier)
+
+
+/**
+ * Display a div with available tags, this div can update the cell
+ * tag_choose_td
+ * @param {type} p_dossier
+ * @returns {undefined}
+ */
+function search_display_tag(p_dossier)
{
try {
waiting_box();
- var queryString="op=tag_choose&gDossier="+p_dossier;
+ var queryString="op=search_display_tag&gDossier="+p_dossier;
var action = new Ajax.Request(
"ajax_misc.php" ,
{
@@ -2187,8 +2196,8 @@ function choose_tag(p_dossier)
code_html=unescape_xml(code_html);
remove_waiting_box();
add_div({id:'tag_div',cssclass:'inner_box',drag:1});
- $('tag_div').style.top=posY-70;
- $('tag_div').style.left=posX-70;
+ $('tag_div').style.top=posY-80;
+ $('tag_div').style.left=posX+102;
remove_waiting_box();
$('tag_div').innerHTML=code_html;
@@ -2198,4 +2207,77 @@ function choose_tag(p_dossier)
} catch (e) {
error_message(e.getMessage);
}
+}
+/**
+ * @brief Add the selected tag (p_tag_id) to the cell of tag_choose_td in the search screen
+ * in the search screen
+ * @param {type} p_dossier
+ * @param {type} p_tag_id
+ */
+function search_add_tag(p_dossier,p_tag_id)
+{
+ try {
+ var clear_button=0;
+ if ( tag_choose == '') {
+ tag_choose=$('tag_choose_td').innerHTML ;
+ clear_button=1;
+ }
+ waiting_box();
+ var queryString="op=search_add_tag&gDossier="+p_dossier+"&id="+p_tag_id+"&clear="+clear_button;
+ var action = new Ajax.Request(
+ "ajax_misc.php" ,
+ {
+ method:'get', parameters:queryString,
+ onFailure:ajax_misc_failure,
+ onSuccess:function(req,j){
+ var answer=req.responseXML;
+ var html=answer.getElementsByTagName('html');
+ if ( html.length == 0 )
+ {
+ var rec=unescape_xml(req.responseText);
+ error_message ('erreur :'+rec);
+ }
+ var code_html=getNodeText(html[0]);
+ code_html=unescape_xml(code_html);
+ remove_waiting_box();
+ $('tag_choose_td').innerHTML=$('tag_choose_td').innerHTML+code_html;
+ removeDiv('tag_div');
+ }
+ }
+ );
+ }catch (e) {
+ error_message(e.getMessage);
+ }
+}
+/**
+ * Clear the tags in the cell tag_choose_td of the search screen
+ * @returns {undefined}
+ */
+function search_clear_tag(p_dossier)
+{
+ try {
+ var queryString="op=search_clear_tag&gDossier="+p_dossier;
+ var action = new Ajax.Request(
+ "ajax_misc.php" ,
+ {
+ method:'get', parameters:queryString,
+ onFailure:ajax_misc_failure,
+ onSuccess:function(req,j){
+ var answer=req.responseXML;
+ var html=answer.getElementsByTagName('html');
+ if ( html.length == 0 )
+ {
+ var rec=unescape_xml(req.responseText);
+ error_message ('erreur :'+rec);
+ }
+ var code_html=getNodeText(html[0]);
+ code_html=unescape_xml(code_html);
+ $('tag_choose_td').innerHTML=code_html;
+ tag_choose="";
+ }
+ }
+ );
+ }catch (e) {
+ error_message(e.getMessage);
+ }
}
\ No newline at end of file
diff --git a/include/action.common.inc.php b/include/action.common.inc.php
index b7ad548df..e870fe74e 100644
--- a/include/action.common.inc.php
+++ b/include/action.common.inc.php
@@ -192,7 +192,7 @@ if ($sub_action == "list")
// Add a button to export to Csv
echo '
";
diff --git a/include/action.inc.php b/include/action.inc.php
index 7627c5e7a..2eb535a9d 100644
--- a/include/action.inc.php
+++ b/include/action.inc.php
@@ -25,7 +25,7 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once('class_ipopup.php');
global $g_user;
$retour=HtmlInput::button_anchor(_('Retour liste'),
- HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","ac","gDossier","qcode","ag_dest_query","query","tdoc","date_start","date_end","hsstate")));
+ HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","ac","gDossier","qcode","ag_dest_query","query","tdoc","date_start","date_end","hsstate","tag")));
//-----------------------------------------------------
// Follow_Up
//-----------------------------------------------------
diff --git a/include/ajax_search_add_tag.php b/include/ajax_search_add_tag.php
new file mode 100644
index 000000000..e69b2aa8c
--- /dev/null
+++ b/include/ajax_search_add_tag.php
@@ -0,0 +1,47 @@
+update_search_cell();
+
+$response= ob_get_clean();
+ob_end_clean();
+$html=escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+
+$html
+
+EOF;
+exit();
+
+
+?>
+
diff --git a/include/ajax_search_clear_tag.php b/include/ajax_search_clear_tag.php
new file mode 100644
index 000000000..7d9640699
--- /dev/null
+++ b/include/ajax_search_clear_tag.php
@@ -0,0 +1,40 @@
+
+
+
+$html
+
+EOF;
+exit();
+
+
+?>
diff --git a/include/ajax_tag_choose.php b/include/ajax_search_display_tag.php
similarity index 98%
rename from include/ajax_tag_choose.php
rename to include/ajax_search_display_tag.php
index 87b867ccd..f211114c2 100644
--- a/include/ajax_tag_choose.php
+++ b/include/ajax_search_display_tag.php
@@ -23,7 +23,7 @@ if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once 'class_tag.php';
ob_start();
$tag=new Tag($cn);
-$tag->select();
+$tag->select_search();
$response= ob_get_clean();
ob_end_clean();
diff --git a/include/ajax_tag_select_search.php b/include/ajax_tag_select_search.php
new file mode 100644
index 000000000..f211114c2
--- /dev/null
+++ b/include/ajax_tag_select_search.php
@@ -0,0 +1,42 @@
+select_search();
+
+$response= ob_get_clean();
+ob_end_clean();
+$html=escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+
+$html
+
+EOF;
+exit();
+
+
+?>
diff --git a/include/category_followup.inc.php b/include/category_followup.inc.php
index 19767f8c8..fc2a51793 100644
--- a/include/category_followup.inc.php
+++ b/include/category_followup.inc.php
@@ -40,7 +40,7 @@ $ag_id=(isset($_REQUEST['ag_id']))?$_REQUEST['ag_id']:0;
if (! isset($_GET['submit_query'])) {$_REQUEST['closed_action']=1;$_GET['closed_action']=1;}
$p_action=$_REQUEST['ac'];
-$base="ac=$p_action&sc=sv&sb=detail&f_id=".$_REQUEST['f_id']."&".HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier","qcode","ag_dest","query","tdoc","date_start","date_end","hsstate","sb","sc"),"");
+$base="ac=$p_action&sc=sv&sb=detail&f_id=".$_REQUEST['f_id']."&".HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier","qcode","ag_dest","query","tdoc","date_start","date_end","hsstate","tag","sb","sc"),"");
$retour=HtmlInput::button_anchor('Retour','?'.dossier::get().'&'.$base);
$fiche=new Fiche($cn,$_REQUEST['f_id']);
diff --git a/include/class_follow_up.php b/include/class_follow_up.php
index 3353f1bef..04a6d4ec2 100644
--- a/include/class_follow_up.php
+++ b/include/class_follow_up.php
@@ -108,7 +108,8 @@ class Follow_Up
}
return $sql;
}
- //----------------------------------------------------------------------
+
+ //----------------------------------------------------------------------
/**
* \brief Display the object, the tags for the FORM
* are in the caller. It will be used for adding and updating
@@ -503,7 +504,7 @@ class Follow_Up
/* add the number of item */
$Hid = new IHidden();
$r.=$Hid->input("nb_item", MAX_ARTICLE);
- $r.=HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate"));
+ $r.=HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate","tag"));
$a_tag=$this->tag_get();
/* get template */
ob_start();
@@ -673,7 +674,7 @@ class Follow_Up
function myList($p_base, $p_filter = "", $p_search = "")
{
// for the sort
- $url = HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate")) . '&' . $p_base;
+ $url = HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate","tag")) . '&' . $p_base;
$table = new Sort_Table();
$table->add('Date Doc.', $url, 'order by ag_timestamp asc', 'order by ag_timestamp desc', 'da', 'dd');
@@ -749,7 +750,7 @@ class Follow_Up
//show the sub_action
foreach ($a_row as $row)
{
- $href = '';
+ $href = '';
$i++;
$tr = ($i % 2 == 0) ? 'even' : 'odd';
if ($row['ag_priority'] < 2)
@@ -1182,8 +1183,8 @@ class Follow_Up
$remind_date->value=(isset($_GET['remind_date']))?$_GET['remind_date']:"";
$remind_date_end=new IDate('remind_date_end');
$remind_date_end->value=(isset($_GET['remind_date_end']))?$_GET['remind_date_end']:"";
- $tag=new Tag($cn);
-
+ $otag=new Tag($cn);
+
// show the action in
require_once 'template/action_search.php';
}
@@ -1208,7 +1209,26 @@ class Follow_Up
$r = $act->myList($p_base, "", $query);
echo $r;
}
+ /**
+ * Create a subquery to filter thanks the selected tag
+ * @param $cn db connx
+ * @param $p_array
+ * @return SQL
+ */
+ static function filter_by_tag ($cn, $p_array = null)
+ {
+ if ($p_array == null)
+ $p_array = $_GET;
+ extract($p_array);
+ $query = "";
+ if ( count($tag) == 0 )return "";
+ for ($i=0;$iag_id,
$a_tag[$e]['t_id']);
- echo '';
+ echo '';
echo $a_tag[$e]['t_tag'];
echo '';
echo '';
diff --git a/include/class_html_input.php b/include/class_html_input.php
index 23e814cd5..08383ee2e 100755
--- a/include/class_html_input.php
+++ b/include/class_html_input.php
@@ -478,7 +478,14 @@ class HtmlInput
if ( count($global_array )==0) return '';
foreach ($array as $a)
{
- if (isset($global_array [$a])) $r.=HtmlInput::hidden($a,$global_array [$a]);
+ if (isset($global_array [$a]))
+ if (is_array($global_array[$a]) == false ) {
+ $r.=HtmlInput::hidden($a,$global_array [$a]);
+ } else {
+ for ($i=0;$icn=$p_cn;
- $this->data=new Tag_SQL($p_cn);
+ $this->data=new Tag_SQL($p_cn,$id);
}
/**
* Show the list of available tag
@@ -79,10 +79,10 @@ class Tag
* Show a button to select tag for Search
* @return HTML
*/
- function choose()
+ static function button_search()
{
$r="";
- $r.=HtmlInput::button("choose_tag", "Etiquette", 'onclick="choose_tag('.Dossier::id().')"', "smallbutton");
+ $r.=HtmlInput::button("choose_tag", "Etiquette", 'onclick="search_display_tag('.Dossier::id().')"', "smallbutton");
return $r;
}
/**
@@ -91,7 +91,27 @@ class Tag
function select_search()
{
$ret=$this->data->seek(' order by t_tag');
- require_once 'template/tag_select.php';
+ require_once 'template/tag_search_select.php';
+ }
+ /**
+ * In the screen search add this data to the cell
+ */
+ function update_search_cell() {
+ echo '';
+ echo h($this->data->t_tag);
+ echo HtmlInput::hidden('tag[]', $this->data->t_id);
+ $js=sprintf("$('sp_".$this->data->t_id."').remove()='';");
+ echo '';
+ echo HtmlInput::anchor('X', "javascript:void(0)", "onclick=\"$js\"");
+ echo '';
+ echo '';
+ }
+ /**
+ * clear the search cell
+ */
+ static function add_clear_button() {
+ $clear=HtmlInput::button('clear', 'X', 'onclick="search_clear_tag('.Dossier::id().');"', 'smallbutton');
+ return $clear;
}
}
diff --git a/include/template/action_search.php b/include/template/action_search.php
index fc927f57b..e45c33441 100644
--- a/include/template/action_search.php
+++ b/include/template/action_search.php
@@ -66,7 +66,16 @@
|
- choose(); ?>
+
+ update_search_cell();
+ }
+ }
+ ?>
|
diff --git a/include/template/tag_search_select.php b/include/template/tag_search_select.php
new file mode 100644
index 000000000..de270531b
--- /dev/null
+++ b/include/template/tag_search_select.php
@@ -0,0 +1,40 @@
+cn->count($ret);
+if ( $max == 0 ) {
+ echo h2("Aucune étiquette disponible",' class="notice"');
+ return;
+}
+?>
+Filtrer =
+
+
+ |
+ Tag
+ |
+
+ Description
+ |
+
+
+
+ |
+
+ |
+
+
+ |
+
+
+
\ No newline at end of file
diff --git a/include/template/tag_select.php b/include/template/tag_select.php
index 6829ad5ce..b4897b764 100644
--- a/include/template/tag_select.php
+++ b/include/template/tag_select.php
@@ -6,7 +6,8 @@ if ( $max == 0 ) {
return;
}
?>
-
+Filtrer =
+
|
Tag
@@ -24,7 +25,7 @@ if (isNumber($_REQUEST['ag_id']) == 0 ) die ('ERROR : parameters invalid');
|
|
|
diff --git a/release-note b/release-note
index 49eb708b1..8a326842a 100644
--- a/release-note
+++ b/release-note
@@ -49,13 +49,19 @@ Si aucun quickcode donné, un calculé un en se basant sur le nom de la fiche (5
code php
fiche_def.inc.php
+Action - Suivi
+===============
+Recherche par tag
+L'avoir dans les changements de page
+Tag repris dans le bouton retour
+Visible dans la recherche après une recherche
+
+
+
===================================================================
|| A faire
===================================================================
-Action - Suivi
-===============
-Recherche par tag
Document à générer
=================