﻿var StudioFiles = Class.create(); StudioFiles.prototype= { initialize: function(content, container) { this.content = content; this.container = $(container); this.applicationRoot = applicationRoot || "/"; this.insertHtml(); }, insertHtml: function() { var properties = this.content["GetItemResult"]["Properties"]["Property"]; var fileName = properties[properties.length-1]["Value"]; if(fileName != null) this.container.href = this.applicationRoot + fileName; } }; var Cases = Class.create(); Cases.prototype = { initialize: function(content, container) { this.applicationRoot = applicationRoot || "/"; this.content = content; this.container = $(container); this.insertHtml(); }, insertHtml: function() { this.container.clear(); var result = this.content["GetItemListResult"]; if(result["@Count"] == 0) return; if(result["Item"].length != null) { for(var i=0; i<result["@Count"]; i++) { var item = result["Item"][i]; var div = document.createElement("div"); var a = this.addItem(item); div.appendChild(a); this.container.appendChild(div); } } else { var item = result["Item"]; var div = document.createElement("div"); var a = this.addItem(item); div.appendChild(a); this.container.appendChild(div); } }, addItem: function(item) { var a = document.createElement("a"); var span = document.createElement("span"); var b = document.createElement("b"); var img = document.createElement("img"); img.src = "/Images/ppt.gif"; span.appendChild(img); a.href = this.applicationRoot + item["Properties"]["Property"][1]["Value"]; a.appendChild(span); b.appendChild(document.createTextNode(item["Properties"]["Property"][0]["Value"])); a.appendChild(b); return a; } }; 
