1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/noalyss_ynh.git synced 2024-09-03 19:46:20 +02:00
noalyss_ynh/sources/noalyss-6.9.0.0/html/js/modele_document.js
Laurent Peuch fce579e032 init
2015-09-27 00:42:21 +02:00

89 lines
2.5 KiB
JavaScript

/*
* This file is part of NOALYSS.
*
* NOALYSS 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.
*
* NOALYSS 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 NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*!\brief
* \param p_value jrn.jr_id
*/
function modifyModeleDocument(p_value,dossier)
{
layer++;
id='det'+layer;
var pos_y=posY+offsetY-20;
var pos_x=posX+offsetX+40;
var style="position:absolute;top:"+pos_y+"px;left:10%;width:80%";
var popup={'id':'mod_doc',
'cssclass':'inner_box',
'html': loading(),
'drag':false,
'style':style
};
querystring='gDossier='+dossier+'&op=mod_doc&id='+p_value+'&div=mod_doc';
if ( ! $('mod_doc'))
{
add_div(popup);
}
var action=new Ajax.Request(
"ajax_misc.php",
{
method:'get',
parameters:querystring,
onFailure:error_box,
onSuccess:modify_document_success_box
}
);
}
/**
*@brief receive answer from ajax and just display it into the IBox
* XML must contains at least 2 fields : code is the ID of the IBOX and
* html which is the contain
*/
function modify_document_success_box(req,json)
{
try
{
$('mod_doc').show();
var answer=req.responseXML;
var a=answer.getElementsByTagName('ctl');
var html=answer.getElementsByTagName('code');
if ( a.length == 0 )
{
var rec=req.responseText;
alert_box ('erreur :'+rec);
}
var name_ctl=a[0].firstChild.nodeValue;
var code_html=getNodeText(html[0]);
code_html=unescape_xml(code_html);
g(name_ctl).innerHTML=code_html;
g(name_ctl).style.height='auto';
}
catch (e)
{
alert_box("success_box"+e.message);
}
try
{
code_html.evalScripts();
}
catch(e)
{
alert_box("answer_box Impossible executer script de la reponse\n"+e.message);
}
}