source: ISOcat/trunk/mod-ISOcat-interface-gi/interface/JSXAPPS/ISOcat/js/org/isocat/gui/ChangeRequest.js @ 2029

Last change on this file since 2029 was 2029, checked in by mwindhouwer, 12 years ago

Initial import of all the *cats, i.e., ISOcat, RELcat and SCHEMAcat.

File size: 2.8 KB
Line 
1jsx3.util.Logger.getLogger("org.isocat").info("Loading class[org.isocat.gui.ChangeRequest]");
2
3/**
4 * The ChangeRequest viewer
5 * @author Menzo.Windhouwer@mpi.nl
6 */
7jsx3.lang.Class.defineClass("org.isocat.gui.ChangeRequest", null, [], function(ChangeRequest, ChangeRequest_prototype) { 
8
9    /**
10     * The class logger
11     */
12    ChangeRequest.log = jsx3.util.Logger.getLogger("org.isocat.gui.ChangeRequest");
13   
14    /**
15     * The view block of the component
16     */
17    ChangeRequest_prototype.view;
18   
19    /**
20     * The window of the component
21     */
22    ChangeRequest_prototype.window;
23   
24    /**
25     * The label
26     */
27    ChangeRequest_prototype.label;
28
29    /**
30     * The actual ChangeRequest viewer
31     */
32    ChangeRequest_prototype.viewer;
33   
34    /**
35     * The ChangeRequest
36     */
37    ChangeRequest_prototype.cr;
38   
39    /**
40     * Constructor
41     */
42    ChangeRequest_prototype.init = function(view) {
43        org.isocat.gui.ChangeRequest.log.info("initialize ChangeRequest viewer["+this+"]");
44
45        this.view = view;
46        org.isocat.gui.ChangeRequest.log.info("- ChangeRequest viewer view["+this.view+"]");
47        this.label = this.view.getDescendantOfName("label");
48        org.isocat.gui.ChangeRequest.log.info("- label["+this.label+"]");
49        this.viewer = this.view.getDescendantOfName("CRView");
50        org.isocat.gui.ChangeRequest.log.info("- ChangeRequest text view["+this.viewer+"]");
51       
52        this.cr = null;
53
54        org.isocat.gui.ChangeRequest.log.info("initialized ChangeRequest viewer["+this+"]");
55       
56        this.view.controller = this;
57       
58        // publish the message using PageBus
59        org.isocat.publish("org.isocat.gui.ChangeRequest.init", this);
60    };
61   
62    ChangeRequest_prototype.showChangeRequest = function(cr) {
63        this.cr = cr;
64   
65        org.isocat.gui.ChangeRequest.log.info("loading CR["+cr.id+"]");
66   
67        // set the title
68        this.label.setText(cr.name,true);
69
70        // load the ChangeRequest content
71        var uri = "http://localhost:8080/isocat/rest/cr/"+cr.id+".html?title=none";
72        org.isocat.gui.ChangeRequest.log.info("loading uri["+uri+"]");
73   
74        var req = new jsx3.net.Request(new Date().getTime());
75        req.open("GET", uri, false);
76        req.send();
77   
78        org.isocat.gui.ChangeRequest.log.info("loaded uri["+uri+"]");
79   
80        this.viewer.setText(req.getResponseText(),true);
81   
82        org.isocat.gui.ChangeRequest.log.info("showing CR["+cr.id+"]");
83    };
84   
85    ChangeRequest_prototype.reset = function() {
86        this.label.setText("change request",true);
87        this.viewer.setText("Please select a change request from the active workspace.",true);
88    };
89});
Note: See TracBrowser for help on using the repository browser.