[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r5419 - in phpcompta/trunk: html html/js include include
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r5419 - in phpcompta/trunk: html html/js include include/template sql |
Date: |
Mon, 23 Sep 2013 22:03:35 +0200 (CEST) |
Author: danydb
Date: 2013-09-23 22:03:34 +0200 (Mon, 23 Sep 2013)
New Revision: 5419
Modified:
phpcompta/trunk/html/ajax_misc.php
phpcompta/trunk/html/js/scripts.js
phpcompta/trunk/include/ajax_tag_detail.php
phpcompta/trunk/include/cfgtags.inc.php
phpcompta/trunk/include/class_follow_up.php
phpcompta/trunk/include/class_tag.php
phpcompta/trunk/include/template/tag_detail.php
phpcompta/trunk/include/template/tag_list.php
phpcompta/trunk/include/template/tag_select.php
phpcompta/trunk/sql/upgrade.sql
Log:
Tag : gestion
Tag dans document : ajout, enlever
Modified: phpcompta/trunk/html/ajax_misc.php
===================================================================
--- phpcompta/trunk/html/ajax_misc.php 2013-09-23 19:51:26 UTC (rev 5418)
+++ phpcompta/trunk/html/ajax_misc.php 2013-09-23 20:03:34 UTC (rev 5419)
@@ -588,7 +588,7 @@
case 'tag_detail':
require_once 'ajax_tag_detail.php';
break;
- case 'save_tag':
+ case 'tag_save':
require_once 'ajax_tag_save.php';
break;
case 'tag_list':
Modified: phpcompta/trunk/html/js/scripts.js
===================================================================
--- phpcompta/trunk/html/js/scripts.js 2013-09-23 19:51:26 UTC (rev 5418)
+++ phpcompta/trunk/html/js/scripts.js 2013-09-23 20:03:34 UTC (rev 5419)
@@ -1984,13 +1984,14 @@
$('error_div').style.visibility='visible';
}
/**
- * @brief show the detail of a tag
+ * @brief show the detail of a tag and propose to save it
*/
-function show_tag(p_dossier,p_ac,p_tag_id)
+function show_tag(p_dossier,p_ac,p_tag_id,p_post)
{
try {
waiting_box();
- var
queryString="op=tag_detail&tag="+p_tag_id+"&gDossier="+p_dossier+"&ac="+p_ac;
+ console.log(p_post);
+ var
queryString="op=tag_detail&tag="+p_tag_id+"&gDossier="+p_dossier+"&ac="+p_ac+'&form='+p_post;
var action = new Ajax.Request(
"ajax_misc.php" ,
{
@@ -2037,36 +2038,20 @@
var action = new Ajax.Request(
"ajax_misc.php" ,
{
- method:'get', parameters:queryString,
+ 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=req.responseText;
- alert ('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').innerHTML=code_html;
- try
- {
- code_html.evalScripts();
- }
- catch(e)
- {
- alert("answer_box
Impossible executer script de la reponse\n"+e.message);
- }
-
+ remove_waiting_box();
+ removeDiv('tag_div');
}
}
);
} catch (e) {
error_message(e.getMessage);
+ return false;
}
+ return false;
}
/**
Modified: phpcompta/trunk/include/ajax_tag_detail.php
===================================================================
--- phpcompta/trunk/include/ajax_tag_detail.php 2013-09-23 19:51:26 UTC (rev
5418)
+++ phpcompta/trunk/include/ajax_tag_detail.php 2013-09-23 20:03:34 UTC (rev
5419)
@@ -12,14 +12,25 @@
echo HtmlInput::title_box("Détail du dossier / tag", "tag_div");
?>
-<form id="tag_frm_detail" method="post">
+<?php
+// save via POST and reload page
+if ($_GET['form']=='p') : ?>
+ <form id="tag_detail_frm" method="POST" >
+<?php
+/*
+ * save via javascript and don't reload page
+ */
+else :
+ ?>
+ <form id="tag_detail_frm" method="POST" onsubmit="return save_tag();">
+<?php endif; ?>
<?php
echo dossier::hidden();
echo HtmlInput::hidden('t_id', $_GET['tag']);
echo HtmlInput::hidden('ac',$_GET['ac']);
$data=$tag->data;
require_once 'template/tag_detail.php';
- echo HtmlInput::submit("save_tag", "Valider");
+ echo HtmlInput::submit("save_tag_sb", "Valider");
?>
</form>
<?php
Modified: phpcompta/trunk/include/cfgtags.inc.php
===================================================================
--- phpcompta/trunk/include/cfgtags.inc.php 2013-09-23 19:51:26 UTC (rev
5418)
+++ phpcompta/trunk/include/cfgtags.inc.php 2013-09-23 20:03:34 UTC (rev
5419)
@@ -18,6 +18,7 @@
*/
/* $Revision$ */
// Copyright Author Dany De Bontridder address@hidden
+if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
/**
* @file
@@ -29,15 +30,20 @@
$tag=new Tag($cn);
$uos=new Tool_Uos('tag');
-if ( isset ($_POST['save_tag']))
+if ( isset ($_POST['save_tag_sb']))
{
- try {
- $uos->check();
- $tag->save($_POST);
- $uos->save();
- } catch (Exception $e)
+ if ( ! isset ($_POST['remove']))
{
- alert("déjà sauvé");
+ try {
+ $uos->check();
+ $tag->save($_POST);
+ $uos->save();
+ } catch (Exception $e)
+ {
+ alert("déjà sauvé");
+ }
+ } else {
+ $tag->remove($_POST);
}
}
?>
@@ -49,6 +55,6 @@
</p>
<?php
$tag->show_list();
-
$js=sprintf("onclick=\"show_tag('%s','%s','%s')\"",Dossier::id(),$_REQUEST['ac'],'-1');
- echo HtmlInput::button("tag_add", "Ajout d'un dossier", $js);
+
$js=sprintf("onclick=\"show_tag('%s','%s','%s','p')\"",Dossier::id(),$_REQUEST['ac'],'-1');
+ echo HtmlInput::button("tag_add", "Ajout d'un tag", $js);
?>
\ No newline at end of file
Modified: phpcompta/trunk/include/class_follow_up.php
===================================================================
--- phpcompta/trunk/include/class_follow_up.php 2013-09-23 19:51:26 UTC (rev
5418)
+++ phpcompta/trunk/include/class_follow_up.php 2013-09-23 20:03:34 UTC (rev
5419)
@@ -676,14 +676,16 @@
$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;
$table = new Sort_Table();
- $table->add('Date', $url, 'order by ag_timestamp asc', 'order
by ag_timestamp desc', 'da', 'dd');
+ $table->add('Date Doc.', $url, 'order by ag_timestamp asc',
'order by ag_timestamp desc', 'da', 'dd');
+ $table->add('Date Comm.', $url, 'order by last_comment', 'order
by last_comment desc', 'dca', 'dcd');
$table->add('Date Limite', $url, 'order by ag_remind_date asc',
'order by ag_remind_date desc', 'ra', 'rd');
+ $table->add('Tag', $url, 'order by tags asc', 'order by tags
desc', 'taa', 'tad');
$table->add('Réf.', $url, 'order by ag_ref asc', 'order by
ag_ref desc', 'ra', 'rd');
$table->add('Groupe', $url, "order by coalesce((select p_name
from profile where p_id=ag_dest),'Aucun groupe')", "order by coalesce((select
p_name from profile where p_id=ag_dest),'Aucun groupe') desc", 'dea', 'ded');
$table->add('Dest/Exp', $url, 'order by name asc', 'order by
name desc', 'ea', 'ed');
$table->add('Titre', $url, 'order by ag_title asc', 'order by
ag_title desc', 'ta', 'td');
- $ord = (!isset($_GET['ord'])) ? "dd" : $_GET['ord'];
+ $ord = (!isset($_GET['ord'])) ? "dcd" : $_GET['ord'];
$sort = $table->get_sql_order($ord);
if (strlen(trim($p_filter)) != 0)
@@ -693,16 +695,17 @@
$sql = "
select ag_id,to_char(ag_timestamp,'DD.MM.YYYY') as my_date,
- to_char(ag_remind_date,'DD.MM.YYYY') as my_remind,
- f_id_dest,
- s_value,
- ag_title,dt_value,ag_ref, ag_priority,ag_state,
- coalesce((select p_name from profile where
p_id=ag_dest),'Aucun groupe') as dest,
- (select ad_value from fiche_Detail where
f_id=action_gestion.f_id_dest and ad_id=1) as name,
- (select count(d_id) from document where
document.ag_id=action_gestion.ag_id) as cnt_doc
- from action_gestion
- join document_type on (ag_type=dt_id)
- join document_state on (ag_state=s_id)
+ 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.ag_id),ag_timestamp),'DD.MM.YY') as last_comment,
+ f_id_dest,
+ s_value,
+ ag_title,dt_value,ag_ref, ag_priority,ag_state,
+ coalesce((select p_name from profile where
p_id=ag_dest),'Aucun groupe') as dest,
+ (select ad_value from fiche_Detail where f_id=ag.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
+ from action_gestion as ag
+ join document_type on (ag_type=dt_id)
+ join document_state on (ag_state=s_id)
where $p_filter_doc $p_search $sort";
$max_line = $this->db->count_sql($sql);
$step = $_SESSION['g_pagesize'];
@@ -727,9 +730,8 @@
$r.='<th>' . $table->get_header(3) . '</th>';
$r.='<th>' . $table->get_header(4) . '</th>';
$r.='<th>' . $table->get_header(5) . '</th>';
- $r.=th(_("Nbre doc."));
- $r.='<th>' . _('type') . '</th>';
- $r.=th('Etat');
+ $r.='<th>' . $table->get_header(6) . '</th>';
+ $r.='<th>' . $table->get_header(7) . '</th>';
$r.=th('Priorité');
$r.="</tr>";
@@ -763,7 +765,9 @@
$st = '
style="font-weight:bold;background:#FF0000"';
$r.="<tr class=\"$tr\" $st>";
$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>";
+ $r.="<td>" . $href . h($row['tags']). '</a>' . "</td>";
$r.="<td>" . $href . $row['ag_ref'] . '</a>' . "</td>";
$r.="<td>" . $href . h($row['dest']) . '</a>' . "</td>";
@@ -786,14 +790,7 @@
$r.='<td>' . $href .
h($row['ag_title']) . "</A></td>";
- if ($row['cnt_doc'] != 0)
- $r.="<td style=\"text-align:center\">" . $href
. h($row['cnt_doc']) . '</a>' . "</td>";
- else
- $r.="<td ></td>";
- $r.="<td>" . $row['dt_value'] . "</td>";
-
- $r.=td($row['s_value']);
/*
* State
*/
@@ -818,7 +815,6 @@
$r.="</table>";
$r.=$bar;
- //$r.="</div>";
return $r;
}
@@ -1365,14 +1361,17 @@
select ag_id,
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,
ag_title,
dt_value,
ag_ref,
ag_priority,
ag_state,
+
coalesce((select p_name from profile where
p_id=ag_dest),'Aucun groupe') as dest
- from action_gestion
+ 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";
@@ -1383,6 +1382,8 @@
array("title"=>"doc id","type"=>"string"),
array("title"=>"date","type"=>"date"),
array("title"=>"rappel","type"=>"date"),
+ array("title"=>"dernier comm.","type"=>"date"),
+ array("title"=>"tags","type"=>"string"),
array("title"=>"nom","type"=>"string"),
array("title"=>"titre","type"=>"string"),
array("title"=>"type
document","type"=>"string"),
@@ -1461,9 +1462,10 @@
echo $a_tag[$e]['t_tag'];
echo '</span>';
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)",
$js_remove).' ';
+ echo HtmlInput::anchor("X", "javascript:void(0)", $js_remove);
echo '</span>';
echo ' ';
+ echo ' ';
}
$js=sprintf("onclick=\"action_tag_select('%s','%s')\"",dossier::id(),$this->ag_id);
echo HtmlInput::button('tag_bt', 'Ajout tag',$js, 'smallbutton');
Modified: phpcompta/trunk/include/class_tag.php
===================================================================
--- phpcompta/trunk/include/class_tag.php 2013-09-23 19:51:26 UTC (rev
5418)
+++ phpcompta/trunk/include/class_tag.php 2013-09-23 20:03:34 UTC (rev
5419)
@@ -64,11 +64,17 @@
}
function save($p_array)
{
+ if ( trim($p_array['t_tag'])=="" ) return ;
$this->data->t_id=$p_array['t_id'];
$this->data->t_tag=str_ireplace('<script>','<_script_>',$p_array['t_tag']);
$this->data->t_description=str_ireplace('<script>','<_script_>',$p_array['t_description']);
$this->data->save();
}
+ function remove($p_array)
+ {
+ $this->data->t_id=$p_array['t_id'];
+ $this->data->delete();
+ }
}
?>
Modified: phpcompta/trunk/include/template/tag_detail.php
===================================================================
--- phpcompta/trunk/include/template/tag_detail.php 2013-09-23 19:51:26 UTC
(rev 5418)
+++ phpcompta/trunk/include/template/tag_detail.php 2013-09-23 20:03:34 UTC
(rev 5419)
@@ -13,4 +13,14 @@
</p>
<p>
Description (tag) : <?php echo $t_description->input(); ?>
-</p>
\ No newline at end of file
+</p>
+<?php
+// If exist you can remove it
+if ( $data->t_id != '-1') :
+?>
+<p>Cochez pour cette case pour effacer ce tag<input type="checkbox"
name="remove">
+</p>
+
+<?php
+endif;
+?>
\ No newline at end of file
Modified: phpcompta/trunk/include/template/tag_list.php
===================================================================
--- phpcompta/trunk/include/template/tag_list.php 2013-09-23 19:51:26 UTC
(rev 5418)
+++ phpcompta/trunk/include/template/tag_list.php 2013-09-23 20:03:34 UTC
(rev 5419)
@@ -1,7 +1,7 @@
<?php
$max=$this->cn->count($ret);
?>
-<table>
+<table id="tag_tb">
<tr>
<th>
Tag
@@ -19,7 +19,7 @@
<tr class="<?php echo (($i%2==0)?'even':'odd');?>">
<td>
<?php
- $js=sprintf("show_tag('%s','%s','%s')",$gDossier,$ac,$row['t_id']);
+
$js=sprintf("show_tag('%s','%s','%s','p')",$gDossier,$ac,$row['t_id']);
echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
?>
</td>
Modified: phpcompta/trunk/include/template/tag_select.php
===================================================================
--- phpcompta/trunk/include/template/tag_select.php 2013-09-23 19:51:26 UTC
(rev 5418)
+++ phpcompta/trunk/include/template/tag_select.php 2013-09-23 20:03:34 UTC
(rev 5419)
@@ -37,4 +37,8 @@
<?php
endfor;
?>
-</table>
\ No newline at end of file
+</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);
+?>
\ No newline at end of file
Modified: phpcompta/trunk/sql/upgrade.sql
===================================================================
--- phpcompta/trunk/sql/upgrade.sql 2013-09-23 19:51:26 UTC (rev 5418)
+++ phpcompta/trunk/sql/upgrade.sql 2013-09-23 20:03:34 UTC (rev 5419)
@@ -185,8 +185,7 @@
/* Config tag */
insert into menu_ref(me_code,me_menu,me_file,
me_url,me_description,me_parameter,me_javascript,me_type,me_description_etendue)
values
-('CFGTAG','Configuration dossier','cfgtags.inc.php',null,'Configuration des
dossiers',null,null,'ME','Configuration des tags ou dossiers, on l''appele tag
ou dossier suivant la façon dont vous utilisez
-cette fonctionnalité. Vous pouvez en ajouter, en supprimer ou les modifier');
+('CFGTAG','Configuration tag','cfgtags.inc.php',null,'Configuration des
tags',null,null,'ME','Configuration des tags. Vous pouvez en ajouter, en
supprimer ou les modifier');
insert into profile_menu (me_code,me_code_dep,p_id,p_order,
p_type_display,pm_default)
values
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r5419 - in phpcompta/trunk: html html/js include include/template sql,
phpcompta-dev <=