noalyss Version-9
modele_document.js
Go to the documentation of this file.
1/*
2 * This file is part of NOALYSS.
3 *
4 * NOALYSS is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * NOALYSS is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with NOALYSS; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19/*!\brief
20 * \param p_value jrn.jr_id
21 */
22function modifyModeleDocument(p_value,dossier)
23{
24 layer++;
25 id='det'+layer;
26 var pos_y=posY+offsetY-20;
27 var pos_x=posX+offsetX+40;
28 var style="position:absolute;top:"+pos_y+"px;left:10%;width:80%";
29 var popup={'id':'mod_doc',
30 'cssclass':'inner_box',
31 'html': loading(),
32 'drag':false,
33 'style':style
34 };
35
36 querystring='gDossier='+dossier+'&op=mod_doc&id='+p_value+'&div=mod_doc';
37 if ( ! $('mod_doc'))
38 {
39 add_div(popup);
40 }
41
42 var action=new Ajax.Request(
43 "ajax_misc.php",
44 {
45 method:'get',
46 parameters:querystring,
47 onFailure:error_box,
48 onSuccess:modify_document_success_box
49 }
50 );
51}
52/**
53 *@brief receive answer from ajax and just display it into the IBox
54 * XML must contains at least 2 fields : code is the ID of the IBOX and
55 * html which is the contain
56 */
57function modify_document_success_box(req,json)
58{
59 try
60 {
61 $('mod_doc').show();
62 var answer=req.responseXML;
63 var a=answer.getElementsByTagName('ctl');
64 var html=answer.getElementsByTagName('code');
65 if ( a.length == 0 )
66 {
67 var rec=req.responseText;
68 alert_box ('erreur :'+rec);
69 }
70 var name_ctl=a[0].firstChild.nodeValue;
71 var code_html=getNodeText(html[0]);
72
73 code_html=unescape_xml(code_html);
74 g(name_ctl).innerHTML=code_html;
75 g(name_ctl).style.height='auto';
76 }
77 catch (e)
78 {
79 alert_box("success_box"+e.message);
80 }
81 try
82 {
83 code_html.evalScripts();
84 }
85 catch(e)
86 {
87 alert_box(content[53]+"\n"+e.message);
88 }
89}