Reduce the number of file in HTML folder, move ajax_ledger.php to include/ajax called from ajax_misc.php

This commit is contained in:
Dany De Bontridder 2015-10-14 18:30:42 +02:00
parent 7cd27cd61a
commit dae59dd68f
4 changed files with 42 additions and 50 deletions

View file

@ -104,6 +104,9 @@ switch ($op)
case 'card' :
require NOALYSS_INCLUDE.'/ajax/ajax_card.php';
return;
case 'ledger' :
require NOALYSS_INCLUDE.'/ajax/ajax_ledger.php';
return;
case "todo_list":
require NOALYSS_INCLUDE.'/ajax/ajax_todo_list.php';
return;

View file

@ -795,9 +795,13 @@ function update_history_card(obj)
function removeOperation(p_jr_id, dossier, div)
{
waiting_box();
var qs = "gDossier=" + dossier + "&act=rmop&div=" + div + "&jr_id=" + p_jr_id;
var action = new Ajax.Request(
"ajax_ledger.php",
var qs = { "gDossier" : dossier ,
"op":"ledger",
"act":"rmop",
"div" : div ,
"jr_id" : p_jr_id};
new Ajax.Request(
"ajax_misc.php",
{
method: 'get',
parameters: qs,
@ -815,11 +819,12 @@ function removeOperation(p_jr_id, dossier, div)
function reverseOperation(obj)
{
var qs = $(obj).serialize();
qs["op"]="ledger";
g('ext' + obj.divname).style.display = 'none';
g('bext' + obj.divname).style.display = 'none';
waiting_box();
var action = new Ajax.Request(
"ajax_ledger.php",
new Ajax.Request(
"ajax_misc.php",
{
method: 'get',
parameters: qs,
@ -839,18 +844,21 @@ function reverseOperation(obj)
function modifyOperation(p_value, dossier)
{
layer++;
var id = 'det' + layer;
var id_div = 'det' + layer;
waiting_box();
var querystring = 'gDossier=' + dossier + '&act=de&jr_id=' + p_value + '&div=' + id;
var querystring = { "gDossier" : dossier ,
"op":"ledger",
"act":"de",
"div" : id_div ,
"jr_id" : p_jr_id};
var action = new Ajax.Request(
"ajax_ledger.php",
"ajax_misc.php",
{
method: 'get',
parameters: querystring,
onFailure: error_box,
onSuccess: function (xml, txt) {
var popup = {'id': id, 'cssclass': 'inner_box'
var popup = {'id': id_div, 'cssclass': 'inner_box'
, 'html': "", 'drag': true};
remove_waiting_box();
add_div(popup);
@ -872,12 +880,13 @@ function viewOperation(p_value, p_dossier)
}
function dropLink(p_dossier, p_div, p_jr_id, p_jr_id2)
{
var querystring = 'gDossier=' + p_dossier;
querystring += '&div=' + p_div;
querystring += '&jr_id=' + p_jr_id;
querystring += '&act=rmr';
querystring += '&jr_id2=' + p_jr_id2;
var action = new Ajax.Request('ajax_ledger.php',
var querystring = { "gDossier" : p_dossier ,
"op":"ledger",
"act":"rmr",
"div" : p_div ,
"jr_id" : p_jr_id,
"jr_id2" : p_jr_id2};
var action = new Ajax.Request('ajax_misc.php',
{
method: 'get',
parameters: querystring,
@ -1035,13 +1044,15 @@ function op_save(obj)
queryString += '&div=' + obj.whatdiv.value;
var divid=obj.whatdiv.value;
queryString += '&act=save';
queryString += '&op=ledger';
waiting_box();
/*
* Operation detail is in a new window
*/
if (g('inpopup'))
{
var action = new Ajax.Request('ajax_ledger.php',
var action = new Ajax.Request('ajax_misc.php',
{
method: 'post',
parameters: queryString,
@ -1056,15 +1067,16 @@ function op_save(obj)
/*
*Operation is in a modal box
*/
var action = new Ajax.Request('ajax_ledger.php',
var action = new Ajax.Request('ajax_misc.php',
{
method: 'post',
parameters: queryString,
onFailure: null,
onSuccess: function(req,json) {
new Ajax.Request('ajax_ledger.php', {
new Ajax.Request('ajax_misc.php', {
parameters:{'gDossier':obj.gDossier.value,
'act':'de',
'op':'ledger',
'jr_id' : jr_id,
'div' : divid},
onSuccess:function(xml) {
@ -1181,9 +1193,9 @@ function document_remove(p_dossier,p_div,p_jrid)
smoke.confirm('Effacer ?', function (e)
{
if (e) {
new Ajax.Request('ajax_ledger.php',
new Ajax.Request('ajax_misc.php',
{
parameters:{"p_dossier":p_dossier,"div":p_div,"p_jrid":p_jrid,'act':'rmf'},
parameters:{"op":"ledger","gDossier":p_dossier,"div":p_div,"p_jrid":p_jrid,'act':'rmf'},
onSuccess : function(x) {
$('receipt'+p_div).innerHTML=x.responseText;
}

View file

@ -28,9 +28,8 @@
- for reconcialiation
- update of analytic content
*/
if ( ! defined('ALLOWED')) define ('ALLOWED',1);
if ( ! defined('ALLOWED')) die(_('Non authorisé'));
require_once '../include/constant.php';
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
require_once NOALYSS_INCLUDE.'/class/class_user.php';
require_once NOALYSS_INCLUDE.'/class/class_acc_operation.php';
@ -60,32 +59,10 @@ $gDossier=dossier::id();
/**
*if $_SESSION['g_user'] is not set : echo a warning
*/
ajax_disconnected($div);
$cn=Dossier::connect();
$g_parameter=new Own($cn);
if ( LOGINPUT)
{
$file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+');
fwrite ($file_loginput,"<?php \n");
fwrite ($file_loginput,'//@description:'.$action."\n");
fwrite($file_loginput, '$_GET='.var_export($_GET,true));
fwrite($file_loginput,";\n");
fwrite($file_loginput, '$_POST='.var_export($_POST,true));
fwrite($file_loginput,";\n");
fwrite($file_loginput, '$_POST[\'gDossier\']=$gDossierLogInput;');
fwrite($file_loginput,"\n");
fwrite($file_loginput, '$_GET[\'gDossier\']=$gDossierLogInput;');
fwrite($file_loginput,"\n");
fwrite($file_loginput,' $_REQUEST=array_merge($_GET,$_POST);');
fwrite($file_loginput,"\n");
fwrite($file_loginput,"include '".basename(__FILE__)."';\n");
fclose($file_loginput);
}
// check if the user is valid and can access this folder
global $g_user;
$g_user=new User($cn);
set_language();
$g_user->check();
if ( $g_user->check_dossier(dossier::id(),true)=='X' )
{
@ -297,7 +274,7 @@ case 'file':
{
// Not possible to remove the file thanks a modal dialog box,
// because of the frameset
$x=sprintf('<a class="smallbutton" style="margin-left:12;margin-right:12" href="ajax_ledger.php?gDossier=%d&div=%s&jr_id=%s&act=rmf" onclick="return confirm(\'Effacer le document ?\')">'.SMALLX.'</a>',
$x=sprintf('<a class="smallbutton" style="margin-left:12;margin-right:12" href="ajax_misc.php?op=ledger&gDossier=%d&div=%s&jr_id=%s&act=rmf" onclick="return confirm(\'Effacer le document ?\')">'.SMALLX.'</a>',
$gDossier,$div,$jr_id);
}
@ -342,7 +319,7 @@ case 'loadfile':
if ($g_user->check_action (RMRECEIPT) == 1) {
// Not possible to remove the file thanks a modal dialog box,
// because of the frameset
$x=sprintf('<a class="mtitle" class="notice" style="margin-left:12;margin-right:12px" href="ajax_ledger.php?gDossier=%d&div=%s&jr_id=%s&act=rmf" onclick="return confirm(\'Effacer le document ?\')">'.SMALLX.'</a>',
$x=sprintf('<a class="mtitle" class="notice" style="margin-left:12;margin-right:12px" href="ajax_misc.php?op=ledger&gDossier=%d&div=%s&jr_id=%s&act=rmf" onclick="return confirm(\'Effacer le document ?\')">'.SMALLX.'</a>',
$gDossier,$div,$jr_id);
echo $x;
}

View file

@ -7,10 +7,10 @@
* - a input type to save a file
* - a file name (which can be opened or removed
*/
$str='?'.dossier::get()."&div=$div&act=file&jr_id=$jr_id";
$str='?'.dossier::get()."&op=ledger&div=$div&act=file&jr_id=$jr_id";
if ( isset ($_REQUEST['ajax'])) $str.="&ajax=1";
?>
<div id="document_operation_div<?php echo $div;?>" class="myfieldset noprint" style="display:<?php echo $a_tab['document_operation_div']['display']?>">
<iframe frameborder=0 scrolling="no" style="margin:0px;padding: 0px;border:0px;width:100%;height:90px;overflow:hidden" src="<?php echo 'ajax_ledger.php'.$str; ?>"></iframe>
<iframe frameborder=0 scrolling="no" style="margin:0px;padding: 0px;border:0px;width:100%;height:90px;overflow:hidden" src="<?php echo 'ajax_misc.php'.$str; ?>"></iframe>
</div>