- Timestamp:
- 07/26/11 12:36:33 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/trunk/MDService2/WebContent/scripts/mdservice_model.js
r1467 r1472 117 117 return reptype; 118 118 }; 119 /* 120 Workspace.prototype.addquery = function(jsonquery, qsid){ 121 var qsjson = this.user_json["WorkspaceProfile"]["Querysets"][qsid]; 122 var queries = qsjson["Queries"]; //this.user_json["WorkspaceProfile"]["Querysets"][qsid]["Queries"]; 123 var iq = 0; 124 125 if (queries == "null"){ 126 //this.user_json["WorkspaceProfile"]["Querysets"][qsid]["Queries"] = [{}]; 127 qsjson["Queries"] = [{}]; 128 } else { 129 iq = queries.length; 130 } 131 //this.user_json["WorkspaceProfile"]["Querysets"][qsid]["Queries"][iq] = jsonq; 132 qsjson["Queries"][iq] = jsonquery; 133 }; 134 Workspace.prototype.addqueryset = function(name){ 135 136 var id = $('#qts_select option').size(); 137 var dt = new Date(); 138 var str_time = dateFormat(dt);//dt.toString("yyyy-MM-dd HH:mm:ss"); 139 140 if (id == 0){ 141 this.user_json["WorkspaceProfile"]["Querysets"] = [{}]; 142 } 143 144 this.user_json["WorkspaceProfile"]["Querysets"][id] = {"name":name, "id":0, "created":str_time , "Queries" : "null"}; 145 146 }; 147 148 Workspace.prototype.addbookmark = function(jsonquery, qsid){ 149 var qsjson = this.user_json["WorkspaceProfile"]["Bookmarksets"][qsid]; 150 var queries = qsjson["Bookmarks"]; 151 var iq = 0; 152 153 if (queries == "null"){ 154 qsjson["Bookmarks"] = [{}]; 155 } else { 156 iq = queries.length; 157 } 158 qsjson["Bookmarks"][iq] = jsonquery; 159 }; 160 Workspace.prototype.addbookmarkset = function(name){ 161 162 var id = $('#bts_select option').size(); 163 var dt = new Date(); 164 var str_time = dateFormat(dt); 165 166 if (id == 0){ 167 this.user_json["WorkspaceProfile"]["Bookmarksets"] = [{}]; 168 } 169 170 this.user_json["WorkspaceProfile"]["Bookmarksets"][id] = {"name":name, "id":0, "created":str_time , "Bookmarks" : "null"}; 171 172 }; 173 */ 119 174 120 Workspace.prototype.removeelement = function(type, id1, id2){ 175 121 var set = this.getTypedElement('user', type,id2); … … 185 131 } 186 132 }; 187 /* 188 Workspace.prototype.removebookmarkset = function(qsid){ 189 190 var size = this.user_json["WorkspaceProfile"].Bookmarksets.length; 191 192 for (var i=qsid;i<size-1;i++){ 193 this.user_json["WorkspaceProfile"].Bookmarksets[i] = this.user_json["WorkspaceProfile"].Bookmarksets[i+1]; 194 } 195 196 delete this.user_json["WorkspaceProfile"].Bookmarksets[size-1]; 197 this.user_json["WorkspaceProfile"]["Bookmarksets"].length = size-1; 198 // set null string , if 0 querysets 199 if (size == 1) { 200 this.user_json["WorkspaceProfile"]["Bookmarksets"] = "null"; 201 } 202 }; 203 Workspace.prototype.getQuerysets = function(type){ 204 var json; 205 if (type == "user"){ 206 return this.user_json["WorkspaceProfile"]["Querysets"]; 207 } 208 return this.server_json["WorkspaceProfile"]["Querysets"]; 209 }; 210 211 Workspace.prototype.getBookmarksets = function(){ 212 213 return this.user_json["WorkspaceProfile"]["Bookmarksets"]; 214 215 }; 216 */ 133 217 134 Workspace.prototype.getCustomTermsets = function(){ 218 135 var json; … … 270 187 }); 271 188 }; 272 /*Workspace.save = function(type, query, id, iq){ 273 var JSONText; 274 var qdata = "/"; 275 276 JSONText = JSON.stringify(jsonw["WorkspaceProfile"]); 277 if (query != undefined){ 278 qdata = "/" + query.id; 279 } 280 $.post("/MDService2/workspaceprofilesave/" + type + qdata,{"data":JSONText}, function(data) { 281 if (query != undefined){ 282 if (query.id == 0){ 283 query.id = $(data).text(); 284 jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][iq]["id"] = query.id; 285 appendQueryUI(jsonw["WorkspaceProfile"]["Querysets"][id]["Queries"][iq],iq, $('#userqueries')); 286 } 287 } 288 }); 289 290 }; 291 */ 189 292 190 function Collection(index, name){ 293 191 this.index = index; … … 324 222 //vcr 325 223 this.vcrid = 0; 326 }; 327 224 225 //pazpar 226 this.pz2 = new md_pz2( { "onshow": this.pazpar2show, 227 "showtime": 500, //each timer (show, stat, term, bytarget) can be specified this way 228 "queryobject": this 229 //"repository": q.repository 230 //"pazpar2path": pazpar2path, 231 //"oninit": my_oninit, 232 //"onstat": my_onstat, 233 //"onterm": my_onterm, 234 //"termlist": "xtargets,subject,author", 235 //"onbytarget": my_onbytarget, 236 //"onrecord": my_onrecord 237 } ); 238 }; 239 Query.prototype.pazpar2show = function(data){ 240 //this.container.find('.result').html(data); 241 242 243 var res = $(this.queryobject.container).find('.result'); 244 //res.append('<ul></ul>'); 245 $.each(data.hits,function(){ 246 //$(res.children('ul')[res.length]).append('<li>'+this+'</li>'); 247 res.append(this); 248 }); 249 250 if (data.activeclients == 0){ 251 notifyUser("result-loaded",'debug'); 252 253 var get = $(res).parent().find('.cmd_get'); 254 255 get.removeClass('cmd_get'); 256 get.addClass('cmd_up'); 257 } 258 }; 328 259 Query.prototype.load = function(json) { 329 260
Note: See TracChangeset
for help on using the changeset viewer.