Project

General

Profile

Corot » History » Version 7

Anonymous, 26/04/2012 16:42

1 1 Anonymous
h1. Corot
2 1 Anonymous
3 1 Anonymous
4 1 Anonymous
h2. Gestion des imagettes dans le Detail
5 1 Anonymous
6 1 Anonymous
Dans le fichier : /usr/local/Sitools2_Corot/workspace/client-user/js/components/viewDataDetail/viewDataDetail.js
7 1 Anonymous
Ligne 102 : collapsed : false
8 2 Anonymous
9 2 Anonymous
10 2 Anonymous
h2. Export VOTABLE
11 3 Anonymous
12 3 Anonymous
Dans contextMenu.js (client) :
13 3 Anonymous
14 3 Anonymous
<pre><code class="javascript">
15 4 Anonymous
         // ligne 864 fichier version 0.9.1
16 3 Anonymous
        // on test que l'utilisateur ne selectionne pas CHR et MON en meme temps + qu'il n'a pas pris de WINDESC et d'IMAG
17 3 Anonymous
	if((request.search("EN2_STAR_CHR")!=-1 && request.search("EN2_STAR_MON")!=-1) || request.search("EN2_WIN")!=-1 || request.search("EN2_STAR_IMAG")!=-1){
18 3 Anonymous
                       // si oui on l'averti que ce n'est pas possible et on ne lance pas le VOTable
19 3 Anonymous
			Ext.Msg.alert("WARNING !", "DONT SELECT WINDESCRIPTOR OR IMAG" +  "<br/>"  + " ALSO DONT PICK EN2_STAR_MON AND EN2_STAR_CHR AT THE SAME TIME PLEASE !!!");
20 3 Anonymous
21 3 Anonymous
		}else{ 
22 3 Anonymous
 // sinon on lance exportVOTable
23 3 Anonymous
24 3 Anonymous
			
25 3 Anonymous
			url += "?1=1" + request;
26 3 Anonymous
			if (!Ext.isEmpty(limit)) {
27 3 Anonymous
				url += "&limit=" + limit;
28 3 Anonymous
			}
29 3 Anonymous
			if (! Ext.isEmpty(userParameters)) {
30 3 Anonymous
				Ext.iterate(userParameters, function (key, value) {
31 3 Anonymous
					url += "&" + key + "=" + value; 
32 3 Anonymous
				});
33 3 Anonymous
			}
34 3 Anonymous
			
35 3 Anonymous
			// If Get => the Resource MUST be synchrone and then send a representation
36 3 Anonymous
			if (method == "GET") {
37 3 Anonymous
				window.open(url);
38 3 Anonymous
				Ext.getBody().unmask();
39 3 Anonymous
				return;
40 3 Anonymous
			} else {
41 3 Anonymous
				this._executeRequestForResource(url, method);
42 3 Anonymous
			}
43 3 Anonymous
		}
44 3 Anonymous
45 6 Anonymous
</code></pre>
46 5 Anonymous
47 5 Anonymous
48 5 Anonymous
Puis dans ExportVORessource.java :
49 5 Anonymous
50 5 Anonymous
<pre><code class="java">
51 5 Anonymous
     // ligne 192
52 5 Anonymous
     // Execute request to know which value are selected
53 5 Anonymous
        String primkey=""; 
54 5 Anonymous
        Integer type=0;
55 5 Anonymous
        try {
56 5 Anonymous
            primkey = databaseRequest.getRequestAsString(); //.getSelectedPrimaryKey();
57 5 Anonymous
            boolean found = primkey.contains("AN2");
58 5 Anonymous
            if(found){
59 5 Anonymous
                System.out.println("J'ai trouvé AN2 !!!\n");
60 5 Anonymous
                type=1;
61 5 Anonymous
            }else{
62 5 Anonymous
            //System.out.println("AN2 non trouvé !!!\n");
63 5 Anonymous
            if((primkey.contains("EN2_STAR_CHR") && primkey.contains("EN2_STAR_MON")) || primkey.contains("EN2_WIN") || primkey.contains("EN2_STAR_IMAG")){
64 5 Anonymous
                System.out.println("Error j'ai trouvé CHR et MON !!!\n");
65 5 Anonymous
            }else{ 
66 5 Anonymous
                if(primkey.contains("EN2_STAR_CHR")){
67 5 Anonymous
                    System.out.println("J'ai trouvé CHR !!!\n");
68 5 Anonymous
                    type = 2;
69 5 Anonymous
                } else{ 
70 5 Anonymous
                    if(primkey.contains("EN2_STAR_MON")){
71 5 Anonymous
                        System.out.println("J'ai trouvé MON !!!\n");
72 5 Anonymous
                        type = 3;   
73 5 Anonymous
                    }
74 5 Anonymous
                    }
75 5 Anonymous
                }
76 5 Anonymous
            }
77 5 Anonymous
        System.out.println("Type vaux : " + type);
78 5 Anonymous
        } catch (SitoolsException ex) {
79 5 Anonymous
            Logger.getLogger(ExportVOResource.class.getName()).log(Level.SEVERE, null, ex);
80 5 Anonymous
        }
81 5 Anonymous
       System.out.println("primkey : " + primkey); // astero et AN2_STAR dans la requete !!!
82 5 Anonymous
83 5 Anonymous
      [ ........  ]
84 5 Anonymous
85 5 Anonymous
     // ligne 246
86 5 Anonymous
    String template_name = "";
87 5 Anonymous
        if (type==1)
88 5 Anonymous
            template_name = "template_astero.ftl";
89 5 Anonymous
        else if (type==2)
90 5 Anonymous
             template_name = "template_exo_chr.ftl";
91 5 Anonymous
        else if (type==3)
92 5 Anonymous
             template_name = "template_exo_mon.ftl";
93 5 Anonymous
        
94 5 Anonymous
        
95 5 Anonymous
        System.out.println("j'envoie le template : " + template_name);
96 5 Anonymous
        
97 5 Anonymous
        //Return the response
98 7 Anonymous
        if (type!=0)
99 7 Anonymous
           return new VOTableRepresentation(dataModel, template_name);
100 7 Anonymous
        else
101 7 Anonymous
           return null;
102 6 Anonymous
</code></pre>
103 6 Anonymous
104 6 Anonymous
105 6 Anonymous
106 6 Anonymous
Les templates.ftl doivent être dans le folder de VOTableRepresentation.java et doivent être bien définis.
107 6 Anonymous
108 6 Anonymous
Exemple :  Pour EN2_STAR_MON, template_exo_mon.ftl
109 6 Anonymous
110 6 Anonymous
<pre><code class="XML">
111 6 Anonymous
112 6 Anonymous
<?xml version="1.0" encoding="UTF-8"?>
113 6 Anonymous
<VOTABLE version="1.2" 
114 6 Anonymous
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
115 6 Anonymous
xsi:schemaLocation="http://www.ivoa.net/xml/VOTable/v1.2" 
116 6 Anonymous
xmlns="http://www.ivoa.net/xml/VOTable/v1.2">
117 6 Anonymous
<!--
118 6 Anonymous
 !  VOTable written by MHUSSON@IAS version 0.1 (mhusson@ias.u-psud.fr)
119 6 Anonymous
 !  at 2012-03-30
120 6 Anonymous
 !  Best use with TOPCAT 3.9 or higher version
121 6 Anonymous
 !-->
122 6 Anonymous
    <RESOURCE name="COROT N2 EN2MON">        
123 6 Anonymous
        <DESCRIPTION>COROT N2 PUBLIC DATA VOTABLE STREAM FORMAT</DESCRIPTION>          
124 6 Anonymous
	<PARAM name="COROT VERSION" datatype="char" arraysize="*" value="N2">
125 6 Anonymous
		<DESCRIPTION>COROT N2 FITS STREAM</DESCRIPTION>
126 6 Anonymous
	</PARAM>
127 6 Anonymous
	<INFO name="SITOOLS2 COROT PROJECT" value="http://idoc-corotn2-public-v2.ias.u-psud.fr">
128 6 Anonymous
		VOTABLE generated with SItools2 COROT and exportVO Ressource (J-C.Malapert@CNES, M.Husson@IAS)
129 6 Anonymous
	</INFO>
130 6 Anonymous
 	<TABLE ID="reference">
131 6 Anonymous
	<FIELD ID="date" arraysize="23" datatype="char" name="DATE" unit="yyyy-mm-jjThh:mi:ss"/>
132 6 Anonymous
	<FIELD ID="datejd" datatype="double" name="DATEJD" unit="COROT JULIAN DAY"/>
133 6 Anonymous
	<FIELD ID="datehel" datatype="double" name="DATEHEL" unit="COROT JULIAN DAY"/>
134 6 Anonymous
	<FIELD ID="status" datatype="int" name="STATUS"/>
135 6 Anonymous
	<FIELD ID="whiteflux" datatype="float" name="WHITEFLUX" unit="ELECTRONS"/>
136 6 Anonymous
	<FIELD ID="whitefluxdev" datatype="float" name="WHITEFLUXDEV" unit="ELECTRONS"/>
137 6 Anonymous
	<FIELD ID="bg" datatype="float" name="BG" unit="ELECTRONS PER PIXEL"/>
138 6 Anonymous
	<FIELD ID="correc" datatype="float" name="CORREC" unit="ELECTRONS"/>
139 6 Anonymous
	</TABLE>
140 6 Anonymous
	<#list rows as row>
141 6 Anonymous
	<TABLE ref="reference" name="${row["file"]}">
142 6 Anonymous
	<PARAM name="COROT ID" value="${row["corotid"]}"/>
143 6 Anonymous
	<PARAM name="COROT RUN" value="${row["run_code"]}"/>
144 6 Anonymous
        	<DATA>
145 6 Anonymous
			<FITS extnum="1">
146 6 Anonymous
				<STREAM actuate="onRequest" href="${row["download"]}"/>
147 6 Anonymous
			</FITS>
148 6 Anonymous
        	   </DATA>
149 6 Anonymous
        </TABLE>
150 6 Anonymous
    	</#list>
151 6 Anonymous
    </RESOURCE>
152 6 Anonymous
</VOTABLE>
153 6 Anonymous
154 6 Anonymous
</code></pre>