Project

General

Profile

Corot » History » Version 5

Anonymous, 17/04/2012 15:30

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 3 Anonymous
</pre></code>
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 5 Anonymous
        return new VOTableRepresentation(dataModel, template_name);
99 5 Anonymous
100 5 Anonymous
101 5 Anonymous
</pre></code>