FollowUp : improve esthetic,use inplace_edit for commenting on files
This commit is contained in:
parent
c33a3fed59
commit
2efcf87803
7 changed files with 97 additions and 65 deletions
|
|
@ -221,7 +221,9 @@ $path = array(
|
|||
// template category of card
|
||||
'template_cat_card'=>'ajax_template_cat_card',
|
||||
// Attribute for category of card
|
||||
'template_cat_category'=>'ajax_template_cat_category'
|
||||
'template_cat_category'=>'ajax_template_cat_category',
|
||||
// From FollowUp , update a comment on a file
|
||||
'update_comment_followUp'=>'ajax_follow_up'
|
||||
) ;
|
||||
|
||||
if (array_key_exists($op, $path)) {
|
||||
|
|
|
|||
|
|
@ -51,36 +51,7 @@ function remove_document(p_dossier,p_id)
|
|||
);
|
||||
|
||||
}
|
||||
/**
|
||||
*@brief update the description of an attached document of an action
|
||||
*@param dossier
|
||||
*@param dt_id id of the document (pk document:d_id)
|
||||
*/
|
||||
function update_document(p_dossier,p_id)
|
||||
{
|
||||
var queryString={
|
||||
"gDossier":p_dossier,
|
||||
"a":"upd_doc",
|
||||
"d_id":p_id,
|
||||
'act':'RAW:document',
|
||||
'value':$('input_desc_txt'+p_id).value
|
||||
};
|
||||
var action=new Ajax.Request (
|
||||
"export.php",
|
||||
{
|
||||
method:'get',
|
||||
parameters:queryString,
|
||||
onFailure:errorRemoveDoc,
|
||||
onSuccess:function(req){
|
||||
$('input_desc'+p_id).hide();
|
||||
$('print_desc'+p_id).innerHTML=$('input_desc_txt'+p_id).value+'<a class="line" id="desc'+p_id+'" onclick="javascript:show_description('+p_id+')">Modifier</a>';
|
||||
$('print_desc'+p_id).show();
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*@brief remove the concerned operation of an action
|
||||
|
|
|
|||
|
|
@ -2204,6 +2204,9 @@ div.menu2 td.mtitle a{
|
|||
.icon:hover {
|
||||
font-family: "fontello";
|
||||
}
|
||||
*.icon {
|
||||
text-decoration: none;
|
||||
}
|
||||
/**
|
||||
* Icon in the title of Box
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ require_once NOALYSS_INCLUDE.'/lib/icard.class.php';
|
|||
require_once NOALYSS_INCLUDE.'/lib/ispan.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/ifile.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/inplace_edit.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/follow_up.class.php';
|
||||
/*!\brief Show the list of action, this code should be common
|
||||
* to several webpage. But for the moment we keep like that
|
||||
|
|
|
|||
74
include/ajax/ajax_follow_up.php
Normal file
74
include/ajax/ajax_follow_up.php
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
|
||||
|
||||
if (!defined('ALLOWED'))
|
||||
die('Appel direct ne sont pas permis');
|
||||
require_once NOALYSS_INCLUDE."/class/document.class.php";
|
||||
require_once NOALYSS_INCLUDE."/lib/inplace_edit.class.php";
|
||||
/**
|
||||
* @file
|
||||
* @brief Update description on file
|
||||
*/
|
||||
$op=$http->request('op');
|
||||
global $g_user;
|
||||
|
||||
if ($op=='update_comment_followUp')
|
||||
{
|
||||
$input=$http->request('input');
|
||||
$action=$http->request('ieaction', 'string', 'display');
|
||||
$d_id=$http->request('d_id', "number");
|
||||
|
||||
// Build inplace input
|
||||
$inplace_description=Inplace_Edit::build($input);
|
||||
$inplace_description->set_callback("ajax_misc.php");
|
||||
$inplace_description->add_json_param("d_id", $d_id);
|
||||
$inplace_description->add_json_param("gDossier", Dossier::id());
|
||||
$inplace_description->add_json_param("op", "update_comment_followUp");
|
||||
switch ($action)
|
||||
{
|
||||
case 'display':
|
||||
echo $inplace_description->ajax_input();
|
||||
|
||||
break;
|
||||
case 'ok':
|
||||
if ($g_user->check_action(VIEWDOC)==1)
|
||||
{
|
||||
$value=$http->request('value');
|
||||
$doc=new Document($cn, $d_id);
|
||||
$doc->get();
|
||||
if ($g_user->can_write_action($doc->ag_id))
|
||||
{
|
||||
// retrieve the document
|
||||
$doc->update_description(strip_tags($value));
|
||||
}
|
||||
$inplace_description->set_value($value);
|
||||
}
|
||||
|
||||
echo $inplace_description->value();
|
||||
break;
|
||||
case 'cancel':
|
||||
echo $inplace_description->value();
|
||||
break;
|
||||
default:
|
||||
throw new Exception(__FILE__.':'.__LINE__.'Invalide value');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -63,21 +63,6 @@ if ($action == 'rm')
|
|||
header("Content-type: text/html; charset: utf8", true);
|
||||
print $json;
|
||||
}
|
||||
/* update the description of the document */
|
||||
if ( $action == "upd_doc")
|
||||
{
|
||||
if ($g_user->check_action(VIEWDOC) == 1)
|
||||
{
|
||||
$d_id=$http->request('d_id',"number");
|
||||
|
||||
$doc = new Document($cn, $d_id);
|
||||
$doc->get();
|
||||
if ( $g_user->can_write_action($doc->ag_id))
|
||||
// retrieve the document
|
||||
$doc->update_description(strip_tags ($value));
|
||||
}
|
||||
|
||||
}
|
||||
/* remove the operation from action_gestion_operation */
|
||||
if ($action == 'rmop')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -419,26 +419,22 @@ for ($i=0;$i<sizeof($aAttachedFile);$i++) :
|
|||
</td>
|
||||
<td>
|
||||
<label> : </label>
|
||||
<span id="print_desc<?php echo $aAttachedFile[$i]['d_id'];?>"> <?php echo h($aAttachedFile[$i]['d_description'])?>
|
||||
<?php if ($p_view != 'READ') : ?>
|
||||
<?php
|
||||
$js=sprintf("javascript:show_description('%s')",$aAttachedFile[$i]['d_id']);
|
||||
<?php
|
||||
// Description of the file
|
||||
if ($p_view != 'READ') :
|
||||
$description=new IText("value");
|
||||
$description->id="input_desc_txt".$aAttachedFile[$i]['d_id'];
|
||||
$description->value=h($aAttachedFile[$i]['d_description']);
|
||||
$inplace_description=new Inplace_Edit($description);
|
||||
$inplace_description->set_callback("ajax_misc.php");
|
||||
$inplace_description->add_json_param("d_id", $aAttachedFile[$i]['d_id']);
|
||||
$inplace_description->add_json_param("gDossier", Dossier::id());
|
||||
$inplace_description->add_json_param("op", "update_comment_followUp");
|
||||
echo $inplace_description->input();
|
||||
else:
|
||||
echo h($aAttachedFile[$i]['d_description']);
|
||||
endif;
|
||||
?>
|
||||
<a class="line" id="<?php echo 'desc'.$aAttachedFile[$i]['d_id'];?>" onclick="<?php echo $js?>"><?php echo _("Modifier")?></a>
|
||||
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="noprint" id="input_desc<?php echo $aAttachedFile[$i]['d_id'];?>" style="display:none" >
|
||||
<input type="input" class="input_text" id="input_desc_txt<?php echo $aAttachedFile[$i]['d_id'];?>" value="<?php echo h($aAttachedFile[$i]['d_description'])?>">
|
||||
<?php
|
||||
$js=sprintf("update_document('%s','%s')",dossier::id(),$aAttachedFile[$i]['d_id']);
|
||||
echo HtmlInput::button('save_desc'.$aAttachedFile[$i]['d_id'], _('Sauve'), 'onclick="'.$js.'"','smallbutton');
|
||||
?>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
</span>
|
||||
<?php endif;?>
|
||||
<?php $rmDoc=sprintf("return confirm_box(null,'"._('Voulez-vous effacer le document')." %s' , function(){remove_document('%s','%s');});",
|
||||
$aAttachedFile[$i]['d_filename'],
|
||||
dossier::id(),
|
||||
|
|
@ -446,7 +442,7 @@ for ($i=0;$i<sizeof($aAttachedFile);$i++) :
|
|||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($p_view != 'READ') : ?> <a class="line" id="<?php echo "ac".$aAttachedFile[$i]['d_id'];?>" href="javascript:void(0)" onclick="<?php echo $rmDoc;?>"><?php echo _("Effacer")?></a><?php endif;?>
|
||||
<?php if ($p_view != 'READ') : ?> <span class="icon" id="<?php echo "ac".$aAttachedFile[$i]['d_id'];?>" href="javascript:void(0)" onclick="<?php echo $rmDoc;?>"></span><?php endif;?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue