Action - gestion : enleve tag, ajoute tag, imprime plusieurs action

This commit is contained in:
Dany De Bontridder 2013-09-27 17:07:31 +00:00
parent f92ed5d27e
commit cf1a4851b1
15 changed files with 143 additions and 62 deletions

View file

@ -38,7 +38,29 @@ if (isset($_REQUEST['f_id']))
if (isset($_REQUEST['sb']))
$supl_hidden.=HtmlInput::hidden('sb', $_REQUEST['sb']);
$supl_hidden.=HtmlInput::hidden('ac', $_REQUEST['ac']);
/*-----------------------------------------------------------------------------*/
/* For other action
/*-----------------------------------------------------------------------------*/
if ( isset ($_GET['other_action_bt'])) {
var_dump($_GET);
/**
* The action id are in the array mag_id
* the tag to remove are vin the array remtag
* the tag to add are in the array addtag
* the state in ag_state
*/
if ( isset ($_GET['ag_id'])) {
switch ($_GET['othact']) {
case 'IMP':
//Impression
case 'ST':
// Etat
case 'ETIREM':
//tag
case 'ETIADD':
}
}
}
/* --------------------------------------------------------------------------- */
/* We ask to generate the document */
@ -188,14 +210,14 @@ if ($sub_action == 'delete')
// Show a list of the action
if ($sub_action == "list")
{
Follow_Up::show_action_list($cn, $base);
// Add a button to export to Csv
echo '<form method="GET" ACTION="export.php">';
echo '<form method="GET" style="display:inline;" 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","date_start","date_end","tag"));
"tdoc", "query","date_start","date_end","hsstate","searchtag"));
echo HtmlInput::hidden("act", "CSV:ActionGestion");
echo HtmlInput::submit("follow_up_csv", "Export CSV");
echo "</form>";
Follow_Up::show_action_list($cn, $base);
}
//--------------------------------------------------------------------------------
// Add an action

View file

@ -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","tag")));
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","searchtag")));
//-----------------------------------------------------
// Follow_Up
//-----------------------------------------------------

View file

@ -24,10 +24,10 @@ require_once 'class_tag.php';
ob_start();
if ($_GET['clear']==1) {
/* Add a clear button */
echo Tag::add_clear_button();
echo Tag::add_clear_button($_GET['pref']);
}
$tag=new Tag($cn,$_GET['id']);
$tag->update_search_cell();
$tag->update_search_cell($_GET['pref']);
$response= ob_get_clean();
ob_end_clean();

View file

@ -22,7 +22,7 @@ if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once 'class_tag.php';
ob_start();
echo Tag::button_search();
echo Tag::button_search($_GET['pref']);
$response= ob_get_clean();
ob_end_clean();
$html=escape_xml($response);

View file

@ -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_search();
$tag->select_search($_GET['pref']);
$response= ob_get_clean();
ob_end_clean();

View file

@ -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","tag","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","searchtag","sb","sc"),"");
$retour=HtmlInput::button_anchor('Retour','?'.dossier::get().'&'.$base);
$fiche=new Fiche($cn,$_REQUEST['f_id']);

View file

@ -504,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","tag"));
$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","searchtag"));
$a_tag=$this->tag_get();
/* get template */
ob_start();
@ -663,18 +663,19 @@ class Follow_Up
$this->insert_action();
}
/** myList($p_filter="")
* \brief Show list of action by default if sorted on date
* \param $p_base base url with ac...
* \param $p_filter filters on the document_type
* \param $p_search must a valid sql command ( ex 'and ag_title like upper('%hjkh%'))
* \return string containing html code
/**
* myList($p_base, $p_filter = "", $p_search = "")
* Show list of action by default if sorted on date
* @param $p_base base url with ac...
* @param $p_filter filters on the document_type
* @param $p_search must a valid sql command ( ex 'and ag_title like upper('%hjkh%'))
* @return string containing html code
*/
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","tag")) . '&' . $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","searchtag")) . '&' . $p_base;
$table = new Sort_Table();
$table->add('Date Doc.', $url, 'order by ag_timestamp asc', 'order by ag_timestamp desc', 'da', 'dd');
@ -725,6 +726,7 @@ class Follow_Up
$r.=$bar;
$r.='<table class="document">';
$r.="<tr>";
$r.='<th name="ag_id_td" style="display:none" >'. ICheckBox::toggle_checkbox('ag','list_ag_frm').'</th>';
$r.='<th>' . $table->get_header(0) . '</th>';
$r.='<th>' . $table->get_header(1) . '</th>';
$r.='<th>' . $table->get_header(2) . '</th>';
@ -747,10 +749,11 @@ class Follow_Up
}
$today = date('d.m.Y');
$i = 0;
$checkbox=new ICheckBox("mag_id[]");
//show the sub_action
foreach ($a_row as $row)
{
$href = '<A class="document" HREF="do.php?' . $p_base .HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier", "qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate", "tag","ac"),"&") . '&sa=detail&ag_id=' . $row['ag_id'] . '">';
$href = '<A class="document" HREF="do.php?' . $p_base .HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier", "qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate", "searchtag","ac"),"&") . '&sa=detail&ag_id=' . $row['ag_id'] . '">';
$i++;
$tr = ($i % 2 == 0) ? 'even' : 'odd';
if ($row['ag_priority'] < 2)
@ -765,6 +768,8 @@ class Follow_Up
if ($date_remind != "" && $date_remind < $date_today && $row['ag_state']!=1 && $row['ag_state']!=3)
$st = ' style="font-weight:bold;background:#FF0000"';
$r.="<tr class=\"$tr\" $st>";
$checkbox->value=$row['ag_id'];
$r.='<td name="ag_id_td" style="display:none">'.$checkbox->input().'</td>';
$r.="<td>" . $href . smaller_date($row['my_date']) . '</a>' . "</td>";
$r.="<td>" . $href . $row['last_comment'] . '</a>' . "</td>";
$r.="<td>" . $href . smaller_date($row['my_remind']) . '</a>' . "</td>";
@ -1189,7 +1194,7 @@ class Follow_Up
require_once 'template/action_search.php';
}
/**
*@brief show a list of actions
*@brief show a list of documents
* @param $cn database connextion
* @param $p_base base URL
*/
@ -1203,11 +1208,12 @@ class Follow_Up
* \note The field 'recherche' is about a part of the title or a ref. number
*/
$query = Follow_Up::create_query($cn);
$r = $act->myList($p_base, "", $query);
echo $r;
echo '<form method="get" id="list_ag_frm" style="display:inline">';
echo HtmlInput::request_to_hidden(array("gDossier","ac","sb","sc","f_id"));
require_once 'template/action_other_action.php';
echo $act->myList($p_base, "", $query);
echo '</form>';
}
/**
* Create a subquery to filter thanks the selected tag
@ -1222,10 +1228,10 @@ class Follow_Up
extract($p_array);
$query = "";
if ( count($tag) == 0 )return "";
for ($i=0;$i<count($tag);$i++) {
if (isNumber($tag[$i])==1)
$query .= ' and ag_id in (select ag_id from action_tags where t_id= '. sql_string($tag[$i]).')';
if ( count($searchtag) == 0 )return "";
for ($i=0;$i<count($searchtag);$i++) {
if (isNumber($searchtag[$i])==1)
$query .= ' and ag_id in (select ag_id from action_tags where t_id= '. sql_string($searchtag[$i]).')';
}
return $query;
}
@ -1323,7 +1329,7 @@ class Follow_Up
if ( ! isset ($closed_action)) {
$query.=" and s_status is null ";
}
if ( isset ($tag)) {
if ( isset ($searchtag)) {
$query .= Follow_Up::filter_by_tag($cn,$p_array);
}
return $query . $str;
@ -1407,7 +1413,7 @@ class Follow_Up
array("title"=>"doc id","type"=>"string"),
array("title"=>"date","type"=>"date"),
array("title"=>"rappel","type"=>"date"),
array("title"=>"dernier comm.","type"=>"date"),
array("title"=>"date dernier commentaire","type"=>"date"),
array("title"=>"tags","type"=>"string"),
array("title"=>"nom","type"=>"string"),
array("title"=>"titre","type"=>"string"),

View file

@ -64,6 +64,11 @@ class ICheckBox extends HtmlInput
{
if ($this->value==$p_value)$this->selected=true;
}
static function toggle_checkbox($p_name,$p_form) {
$a=new ICheckBox($p_name);
$a->javascript='onclick="toggle_checkbox(\''.$p_form.'\')"';
return $a->input();
}
static public function test_me()
{
}

View file

@ -69,5 +69,5 @@ class IRadio extends HtmlInput
{
}
}

View file

@ -79,16 +79,16 @@ class Tag
* Show a button to select tag for Search
* @return HTML
*/
static function button_search()
static function button_search($p_prefix)
{
$r="";
$r.=HtmlInput::button("choose_tag", "Etiquette", 'onclick="search_display_tag('.Dossier::id().')"', "smallbutton");
$r.=HtmlInput::button("choose_tag", "Etiquette", 'onclick="search_display_tag('.Dossier::id().',\''.$p_prefix.'\')"', "smallbutton");
return $r;
}
/**
* let select a tag to add to the search
*/
function select_search()
function select_search($p_prefix)
{
$ret=$this->data->seek(' order by t_tag');
require_once 'template/tag_search_select.php';
@ -96,11 +96,11 @@ class Tag
/**
* In the screen search add this data to the cell
*/
function update_search_cell() {
echo '<span id="sp_'.$this->data->t_id.'" style="border:1px solid black;margin-right:5px;">';
function update_search_cell($p_prefix) {
echo '<span id="sp_'.$p_prefix.$this->data->t_id.'" style="border:1px solid black;margin-right:5px;">';
echo h($this->data->t_tag);
echo HtmlInput::hidden('tag[]', $this->data->t_id);
$js=sprintf("$('sp_".$this->data->t_id."').remove()='';");
echo HtmlInput::hidden($p_prefix.'tag[]', $this->data->t_id);
$js=sprintf("$('sp_".$p_prefix.$this->data->t_id."').remove();");
echo '<span style="background-color:red;text-align:center;border-top:1px solid black; border-right:1px solid black;border-bottom:1px solid black;">';
echo HtmlInput::anchor('X', "javascript:void(0)", "onclick=\"$js\"");
echo '</span>';
@ -109,8 +109,8 @@ class Tag
/**
* clear the search cell
*/
static function add_clear_button() {
$clear=HtmlInput::button('clear', 'X', 'onclick="search_clear_tag('.Dossier::id().');"', 'smallbutton');
static function add_clear_button($p_prefix) {
$clear=HtmlInput::button('clear', 'X', 'onclick="search_clear_tag('.Dossier::id().',\''.$p_prefix.'\');"', 'smallbutton');
return $clear;
}
}

View file

@ -60,21 +60,18 @@ $g_captcha=false;
$g_failed="<span style=\"font-size:18px;color:red\">&#x2716;</span>";
$g_succeed="<span style=\"font-size:18px;color:green\">&#x2713;</span>";
/* uncomment for development */
define ('SVNINFO',5900);
define ("DEBUG",true);
define ('SVNINFO',5900);
define ("DEBUG",true);
//define ("DEBUG",false);
$version_phpcompta=SVNINFO;
/* define ('SVNINFO',5015);
* $version_phpcompta=SVNINFO;
* define ("DEBUG",true);
*/
// If you don't want to be notified of the update
// define ("SITE_UPDATE",'');
define ("SITE_UPDATE",'http://www.phpcompta.eu/last_version.txt');
define ("SITE_UPDATE_PLUGIN",'http://www.phpcompta.eu/plugin_last_version.txt');
define ("DBVERSION",107);
define ("DBVERSION",108);
define ("MONO_DATABASE",25);
define ("DBVERSIONREPO",14);
define ('NOTFOUND','--not found--');

View file

@ -27,9 +27,9 @@
*
*/
?>
<div class="content" >
<div>
<form method="get" action="do.php">
<div class="content" style="display:inline" >
<div style="display:inline">
<form method="get" style="display:inline" action="do.php">
<?php echo dossier::hidden();
?>
<input type="submit" class="button" name="submit_query" value="<?php echo _("Ajout Action")?>">

View file

@ -0,0 +1,51 @@
<?php
echo HtmlInput::button("other_bt", "Autres actions", 'onclick="$(\'other_div\').style.display=\'block\';action_show_checkbox();"', "button");
$radio=new IRadio("othact");
/*
* Hidden values for a previous search
*/
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","date_start","date_end","hsstate","searchtag"));
?>
<div id="other_div" class="inner_box" style="width:40%;display: none">
<?php echo HtmlInput::title_box('Actions sur plusieurs documents','other_div', 'hide') ?>
Sélectionner les documents et l' action :
<ul style='list-style-type: none;padding-left:30px;margin: 0px' >
<li >
<?php $radio->value="IMP"; $radio->selected=true;echo $radio->input(); ?>
Impression
</li>
<li>
<?php $radio->value="ST";$radio->selected=false;echo $radio->input(); ?>
Changement des états
<?php
$etat=new ISelect('ag_state');
$etat->value=$cn->make_array('select s_id,s_value from document_state order by s_value');
echo $etat->input();
?>
</li>
<li>
<?php $radio->value="ETIADD";echo $radio->input(); ?>
Ajout d'étiquettes
<?php echo Tag::button_search('add'); ?>
<?php echo Tag::add_clear_button('add'); ?>
<span id="addtag_choose_td">
</span>
</li>
<li>
<?php $radio->value="ETIREM";echo $radio->input(); ?>
Enlever des étiquettes
<?php echo Tag::button_search('rem'); ?>
<?php echo Tag::add_clear_button('rem'); ?>
<span id="remtag_choose_td">
</span>
</li>
</ul>
<?php
echo HtmlInput::submit("other_action_bt", "Valider");
?>
</div>

View file

@ -31,7 +31,7 @@
<?php echo HtmlInput::anchor_hide('Fermer', "$('search_action').style.display='none';");?>
<?php endif; ?>
<?php if ( $inner ) : ?>
<div id="search_action" class="op_detail_frame">
<div id="search_action" class="">
<?php echo HtmlInput::anchor_hide('Fermer', "removeDiv('search_action_div');");?>
<?php endif; ?>
@ -65,14 +65,14 @@
</tr>
<tr>
<td style="width:180px;text-align:right"><?php echo _('Etiquette'); ?></td>
<td id="tag_choose_td">
<?php echo Tag::button_search(); ?>
<td id="searchtag_choose_td">
<?php echo Tag::button_search('search'); ?>
<?php
if ( isset($_GET['tag'])) {
echo Tag::add_clear_button();
for ($i=0;$i<count($_GET['tag']);$i++) {
$t=new Tag($cn, $_GET['tag'][$i]);
echo $t->update_search_cell();
if ( isset($_GET['searchtag'])) {
echo Tag::add_clear_button('search');
for ($i=0;$i<count($_GET['searchtag']);$i++) {
$t=new Tag($cn, $_GET['searchtag'][$i]);
echo $t->update_search_cell('search');
}
}
?>

View file

@ -1,12 +1,12 @@
<?php
echo HtmlInput::title_box('Tag', 'tag_div');
echo HtmlInput::title_box('Tag', $p_prefix.'tag_div');
$max=$this->cn->count($ret);
if ( $max == 0 ) {
echo h2("Aucune étiquette disponible",' class="notice"');
return;
}
?>
Filtrer = <?php echo HtmlInput::filter_table('tag_tb_id', '0,1', 1); ?>
Filtrer = <?php echo HtmlInput::filter_table($p_prefix.'tag_tb_id', '0,1', 1); ?>
<table id="tag_tb_id">
<tr>
<th>
@ -24,7 +24,7 @@ $gDossier=Dossier::id();
<tr class="<?php echo (($i%2==0)?'even':'odd');?>">
<td>
<?php
$js=sprintf("search_add_tag('%s','%s')",$gDossier,$row['t_id']);
$js=sprintf("search_add_tag('%s','%s','%s')",$gDossier,$row['t_id'],$p_prefix);
echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
?>
</td>