Seach tag

This commit is contained in:
Dany De Bontridder 2013-09-23 21:00:47 +00:00
parent 82c21a13de
commit 9dc1a42dbb
9 changed files with 164 additions and 17 deletions

View file

@ -600,6 +600,9 @@ EOF;
case 'tag_remove':
require_once 'ajax_tag_remove_action.php';
break;
case 'tag_choose':
require_once 'ajax_tag_choose.php';
break;
default:
var_dump($_GET);
}

View file

@ -2164,4 +2164,38 @@ function action_tag_remove(p_dossier,ag_id,t_id)
} catch (e) {
error_message(e.getMessage);
}
}
function choose_tag(p_dossier)
{
try {
waiting_box();
var queryString="op=tag_choose&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('code');
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();
add_div({id:'tag_div',cssclass:'inner_box',drag:1});
$('tag_div').style.top=posY-70;
$('tag_div').style.left=posX-70;
remove_waiting_box();
$('tag_div').innerHTML=code_html;
}
}
);
} catch (e) {
error_message(e.getMessage);
}
}

View file

@ -192,7 +192,7 @@ if ($sub_action == "list")
// Add a button to export to Csv
echo '<form method="GET" ACTION="export.php">';
echo HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref", "remind_date","only_internal", "state", "gDossier", "qcode", "start_date", "end_date", "ag_id", "ag_dest_query",
"tdoc", "query"));
"tdoc", "query","date_start","date_end"));
echo HtmlInput::hidden("act", "CSV:ActionGestion");
echo HtmlInput::submit("follow_up_csv", "Export CSV");
echo "</form>";

View file

@ -0,0 +1,42 @@
<?php
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once 'class_tag.php';
ob_start();
$tag=new Tag($cn);
$tag->select();
$response= ob_get_clean();
ob_end_clean();
$html=escape_xml($response);
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<ctl></ctl>
<code>$html</code>
</data>
EOF;
exit();
?>

View file

@ -1182,6 +1182,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);
// show the action in
require_once 'template/action_search.php';
}
@ -1362,8 +1364,8 @@ class Follow_Up
to_char(ag_timestamp,'DD.MM.YYYY') as my_date,
to_char(ag_remind_date,'DD.MM.YYYY') as my_remind,
to_char(coalesce((select max(agc_date) from action_gestion_comment as agc where agc.ag_id=ag_id),ag_timestamp),'DD.MM.YY') as last_comment,
array_to_string((select array_agg(t1.t_tag) from action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag_id ),',') as tags,
(select ad_value from fiche_Detail where f_id=action_gestion.f_id_dest and ad_id=1) as name,
array_to_string((select array_agg(t1.t_tag) from action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id ),',') as tags,
(select ad_value from fiche_Detail where f_id=ag.f_id_dest and ad_id=1) as name,
ag_title,
dt_value,
ag_ref,
@ -1371,10 +1373,10 @@ class Follow_Up
ag_state,
coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') as dest
from action_gestion
join document_type on (ag_type=dt_id)
join document_state on(ag_state=s_id)
where true $p_search order by ag_timestamp,ag_id";
from action_gestion as ag
join document_type on (ag.ag_type=dt_id)
join document_state on(ag.ag_state=s_id)
where true $p_search order by ag.ag_timestamp,ag.ag_id";
$ret=$this->db->exec_sql($sql);
if ( Database::num_row($ret)==0)exit();

View file

@ -75,6 +75,24 @@ class Tag
$this->data->t_id=$p_array['t_id'];
$this->data->delete();
}
/**
* Show a button to select tag for Search
* @return HTML
*/
function choose()
{
$r="";
$r.=HtmlInput::button("choose_tag", "Tag", 'onclick="choose_tag('.Dossier::id().')"', "smallbutton");
return $r;
}
/**
* let select a tag to add to the search
*/
function select_search()
{
$ret=$this->data->seek(' order by t_tag');
require_once 'template/tag_select.php';
}
}
?>

View file

@ -52,32 +52,40 @@
<td>
<?php echo $remind_date->input();?>
</td>
<tr>
</tr>
<tr>
<td style="width:180px;text-align:right"> Date de rappel avant</td>
<td>
<?php echo $remind_date_end->input();?>
</td>
<tr>
</tr>
<tr>
<td style="width:180px;text-align:right"> Affiche aussi les actions fermées</td>
<td><?php echo $closed_action->input();?></td>
</tr>
<tr>
<td style="width:180px;text-align:right"> Tag</td>
<td id="tag_choose_td">
<?php echo $tag->choose(); ?>
</td>
</tr>
<tr>
<td style="width:180px;text-align:right"> Référence</td>
<td>
<?php echo $osag_ref->input();?>
</td>
<tr>
</tr>
<tr>
<td style="width:180px;text-align:right"> Numéro document</td>
<td>
<?php $num=new INum('ag_id');echo $num->input();?>
</td>
</tr>
<tr>
<td style="width:180px;text-align:right"><?php echo _('Destinataire')?></td>
<?php $label=$w->id."_label";?>
<td ><?php echo $w->input() . $w->search()?><span id="<?php echo $label?>"></span></td>
<tr>
</tr>
<tr>
<td style="text-align:right" ><?php echo _("Profil")?></td>
<td><?php echo $str_ag_dest?></td>

View file

@ -0,0 +1,44 @@
<?php
echo HtmlInput::title_box('Tag', 'tag_div');
$max=$this->cn->count($ret);
if ( $max == 0 ) {
echo h2("Aucun tag disponible",' class="notice"');
return;
}
?>
<table>
<tr>
<th>
Tag
</th>
<th>
Description
</th>
</tr>
<?php
$gDossier=Dossier::id();
if (isNumber($_REQUEST['ag_id']) == 0 ) die ('ERROR : parameters invalid');
for ($i=0;$i<$max;$i++):
$row=Database::fetch_array($ret, $i);
?>
<tr class="<?php echo (($i%2==0)?'even':'odd');?>">
<td>
<?php
$js=sprintf("action_tag_add('%s','%s','%s')",$gDossier,$_REQUEST['ag_id'],$row['t_id']);
echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
?>
</td>
<td>
<?php
echo $row['t_description'];
?>
</td>
</tr>
<?php
endfor;
?>
</table>
<?php
$js=sprintf("onclick=\"show_tag('%s','%s','%s','j')\"",Dossier::id(),"none",'-1');
echo HtmlInput::button("tag_add", "Ajout d'un tag", $js);
?>

View file

@ -24,7 +24,7 @@ if (isNumber($_REQUEST['ag_id']) == 0 ) die ('ERROR : parameters invalid');
<tr class="<?php echo (($i%2==0)?'even':'odd');?>">
<td>
<?php
$js=sprintf("action_tag_add('%s','%s','%s')",$gDossier,$_REQUEST['ag_id'],$row['t_id']);
$js=sprintf("search_tag_add('%s','%s')",$gDossier,$row['t_id']);
echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
?>
</td>
@ -37,8 +37,4 @@ if (isNumber($_REQUEST['ag_id']) == 0 ) die ('ERROR : parameters invalid');
<?php
endfor;
?>
</table>
<?php
$js=sprintf("onclick=\"show_tag('%s','%s','%s','j')\"",Dossier::id(),"none",'-1');
echo HtmlInput::button("tag_add", "Ajout d'un tag", $js);
?>
</table>