Skip to content
Browse files

Several bugfixes and sample Scrummy application (client and server)

  • Loading branch information...
1 parent c084553 commit 7699e3edac071161238d0ad23890e2f1e037add7 @antoniogarrote committed Jul 4, 2010
Showing with 29,818 additions and 1,046 deletions.
  1. +93 −1 js/css/plaza-ui.css
  2. +702 −24 js/plaza-ui.js
  3. +339 −53 js/plaza.js
  4. +489 −0 src/plaza/examples/scrummy-clone/client/css/jquery-ui.css
  5. +221 −0 src/plaza/examples/scrummy-clone/client/css/plaza-ui.css
  6. +286 −0 src/plaza/examples/scrummy-clone/client/css/scrummy.css
  7. BIN src/plaza/examples/scrummy-clone/client/css/smoothness/images/ui-anim_basic_16x16.gif
  8. BIN src/plaza/examples/scrummy-clone/client/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
  9. BIN src/plaza/examples/scrummy-clone/client/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
  10. BIN src/plaza/examples/scrummy-clone/client/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
  11. BIN src/plaza/examples/scrummy-clone/client/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
  12. BIN src/plaza/examples/scrummy-clone/client/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png
  13. BIN src/plaza/examples/scrummy-clone/client/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
  14. BIN src/plaza/examples/scrummy-clone/client/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
  15. BIN ...laza/examples/scrummy-clone/client/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  16. BIN src/plaza/examples/scrummy-clone/client/css/smoothness/images/ui-icons_222222_256x240.png
  17. BIN src/plaza/examples/scrummy-clone/client/css/smoothness/images/ui-icons_2e83ff_256x240.png
  18. BIN src/plaza/examples/scrummy-clone/client/css/smoothness/images/ui-icons_454545_256x240.png
  19. BIN src/plaza/examples/scrummy-clone/client/css/smoothness/images/ui-icons_888888_256x240.png
  20. BIN src/plaza/examples/scrummy-clone/client/css/smoothness/images/ui-icons_cd0a0a_256x240.png
  21. +489 −0 src/plaza/examples/scrummy-clone/client/css/smoothness/jquery-ui.css
  22. BIN src/plaza/examples/scrummy-clone/client/images/ui-anim_basic_16x16.gif
  23. BIN src/plaza/examples/scrummy-clone/client/images/ui-bg_flat_0_aaaaaa_40x100.png
  24. BIN src/plaza/examples/scrummy-clone/client/images/ui-bg_flat_75_ffffff_40x100.png
  25. BIN src/plaza/examples/scrummy-clone/client/images/ui-bg_glass_55_fbf9ee_1x400.png
  26. BIN src/plaza/examples/scrummy-clone/client/images/ui-bg_glass_65_ffffff_1x400.png
  27. BIN src/plaza/examples/scrummy-clone/client/images/ui-bg_glass_75_dadada_1x400.png
  28. BIN src/plaza/examples/scrummy-clone/client/images/ui-bg_glass_75_e6e6e6_1x400.png
  29. BIN src/plaza/examples/scrummy-clone/client/images/ui-bg_glass_95_fef1ec_1x400.png
  30. BIN src/plaza/examples/scrummy-clone/client/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  31. BIN src/plaza/examples/scrummy-clone/client/images/ui-icons_222222_256x240.png
  32. BIN src/plaza/examples/scrummy-clone/client/images/ui-icons_2e83ff_256x240.png
  33. BIN src/plaza/examples/scrummy-clone/client/images/ui-icons_454545_256x240.png
  34. BIN src/plaza/examples/scrummy-clone/client/images/ui-icons_888888_256x240.png
  35. BIN src/plaza/examples/scrummy-clone/client/images/ui-icons_cd0a0a_256x240.png
  36. +69 −0 src/plaza/examples/scrummy-clone/client/index.html
  37. +1,012 −0 src/plaza/examples/scrummy-clone/client/js/jquery-ui.js
  38. +6,240 −0 src/plaza/examples/scrummy-clone/client/js/jquery.js
  39. +1,443 −0 src/plaza/examples/scrummy-clone/client/js/plaza-ui.js
  40. +1,129 −0 src/plaza/examples/scrummy-clone/client/js/plaza.js
  41. +15,323 −0 src/plaza/examples/scrummy-clone/client/js/protovis.js
  42. +307 −0 src/plaza/examples/scrummy-clone/client/js/scrummy.js
  43. +146 −0 src/plaza/examples/scrummy-clone/client/js/test.js
  44. +128 −0 src/plaza/examples/scrummy-clone/client/project.html
  45. +5 −0 src/plaza/examples/scrummy-clone/server/README
  46. +4 −0 src/plaza/examples/scrummy-clone/server/project.clj
  47. +75 −0 src/plaza/examples/scrummy-clone/server/src/scrummy_clone/core.clj
  48. +58 −0 src/plaza/examples/scrummy-clone/server/src/scrummy_clone/resources/common.clj
  49. +23 −0 src/plaza/examples/scrummy-clone/server/src/scrummy_clone/utils.clj
  50. +6 −0 src/plaza/examples/scrummy-clone/server/test/scrummy_clone/core_test.clj
  51. +12 −7 src/plaza/examples/webapp.clj
  52. +48 −960 src/plaza/rest/core.clj
  53. +254 −0 src/plaza/rest/handlers.clj
  54. +916 −0 src/plaza/rest/utils.clj
  55. +1 −1 test/plaza/rest/core_test.clj
View
94 js/css/plaza-ui.css
@@ -68,7 +68,8 @@
}
.triple-space-browser-panel-body {
- text-align: right
+ text-align: right;
+ padding: 10px
}
.triple-space-actions {
@@ -84,6 +85,9 @@
padding: 5px
}
+.collection-triple-space-actions input {
+ margin: 3px
+}
.overline {
border-top:1px solid #aaaaaa;
font-size: 80%
@@ -109,6 +113,20 @@
margin-right: 10px;
}
+.inspect-tbox-toolbox-feature div {
+ margin: 5px;
+ margin-top: 20px
+}
+
+.inspect-tbox-toolbox-feature input {
+ margin: 5px
+}
+
+.inspect-tbox-toolbox-feature select {
+ margin: 5px
+}
+
+
/* TriplesTable */
.plaza-triples-table-widget {
font-size: 70%
@@ -127,3 +145,77 @@
background-color: white;
padding: 3px
}
+
+
+/* PlazaUI.Widgets.ToolboxEntityCreatorForm */
+.toolbox-entity-creator-widget {
+ width: 600px;
+ font-size: 70%;
+}
+
+.toolbox-entity-creator-widget-body {
+ text-align: right
+}
+
+.toolbox-entity-creator-widget-body .property input {
+ width: 400px;
+ margin-right: 20px;
+ margin: 5px
+}
+
+.toolbox-entity-creator-widget-body .entity-creator-actions input {
+ margin: 5px
+}
+
+/* PlazaIO.Widgets.PanelListFrame */
+
+.panel-list-widget {
+ font-size: 70%
+}
+
+.panel-list-header {
+
+}
+
+.panel-list-panel {
+ background: white;
+ border: 1px solid #aaaaaa;
+ margin: 3px
+}
+
+.panel-list-panel-header {
+ background: #aaaaaa;
+ padding: 3px
+}
+
+.panel-list-panel-body {
+ text-align: right;
+ padding: 10px
+}
+
+.panel-list-panel-body input {
+ width: 100px;
+ margin: 5px
+}
+
+/* RDFS Class Browser */
+.class-uri-panel-body {
+ text-align: left
+}
+
+.panel-list-panel input {
+ width: 100px
+}
+
+
+/* Multi Entity selector */
+
+.entities-selector-title select {
+ margin-left:5px;
+ margin-right:10px;
+ width:400px;
+}
+
+.entities-selector-title option {
+ padding: 5px
+}
View
726 js/plaza-ui.js
@@ -9,6 +9,57 @@
PlazaUI = {};
/**
+ * PlazaUI.Utils
+ */
+
+PlazaUI.Utils = function() {
+ return {
+ showDialog: function(title, txt) {
+ var dialog = jQuery("<div title='"+ title +"'><p>" + txt + "</p></div>");
+ jQuery("body").append(dialog);
+ dialog.dialog();
+ },
+
+ center: function(widget) {
+ widget.css("position","absolute");
+ var top = ($(window).height() - widget.height() ) / 2+$(window).scrollTop();
+ if (top < 0) {
+ top = 20;
+ }
+ widget.css("top", top + "px");
+ widget.css("left", ( $(window).width() - widget.width() ) / 2+$(window).scrollLeft() + "px");
+ },
+
+ generateSetup: function() {
+ var js = "Plaza.setup(\n";
+ js = js + "\t// Schemas\n"
+ for (var i in Plaza.TBox.schemaList) {
+ js = js + '\tPlaza.TBox.registerSchema("'+Plaza.TBox.schemaList[i]+'"),\n'
+ }
+
+ js = js + "\n\t// TripleSpaces\n"
+ for(var spaceId in Plaza.ABox.spacesRegistry) {
+ var space = Plaza.ABox.spacesRegistry[spaceId];
+ var singleResource = Plaza.Services.servicesRegistry[space.singleResource];
+ var collectionResource = Plaza.Services.servicesRegistry[space.collectionResource];
+
+ if(singleResource == null && collectionResource != null) {
+ js = js + '\tPlaza.ABox.TripleSpace.connect("'+spaceId+'", {"collectionResource": "'+collectionResource+'"}),\n'
+ } else if(singleResource != null && collectionResource == null) {
+ js = js + '\tPlaza.ABox.TripleSpace.connect("'+spaceId+'", {"singleResource": "'+singleResource+'"}),\n'
+ } else {
+ js = js + '\tPlaza.ABox.TripleSpace.connect("'+spaceId+'", {"collectionResource": "'+collectionResource+'", "singleResource": "'+singleResource+'"}),\n'
+ }
+ }
+
+ js = js + "\n\tfunction(){\n\t\t//application code here\n\t})";
+
+ return js;
+ }
+ };
+}();
+
+/**
* PlazaUI.Base
*/
PlazaUI.Base = function(){
@@ -364,9 +415,9 @@ PlazaUI.Widgets.EntityDebugger = function(){
// UI tweaks
if(this.entity == null) {
- this.attachedElement.css("width",300)
+ this.attachedElement.css("width",300);
} else {
- this.attachedElement.css("width",this.entity._uri.length * 8)
+ this.attachedElement.css("width",this.entity._uri.length * 8);
}
var attached = this.attachedElement;
@@ -378,6 +429,8 @@ PlazaUI.Widgets.EntityDebugger = function(){
this.attachedElement.find(".entity-debugger-widget-header").bind('mouseup',function(event){
attached.draggable("destroy");
});
+
+ PlazaUI.Utils.center(this.attachedElement);
};
w.onUpdated = function(entity) {
@@ -388,11 +441,19 @@ PlazaUI.Widgets.EntityDebugger = function(){
for(var p in entity) {
var val = "<div class='entity-debugger-widget-prop'><div class='entity-debugger-widget-prop-alias'>" + p + "</div>";
- var uri = Plaza.TBox.findPropertyUri(p);
+ var uri = Plaza.TBox.findPropertyUri(p)[0];
if(uri != undefined) {
- val = val + "<div class='entity-debugger-widget-prop-uri'>uri: " + uri + "</div>"
+ val = val + "<div class='entity-debugger-widget-prop-uri'>uri: " + uri + "</div>";
+ }
+ if(Plaza.Utils.typeOf(entity[p]) === "array") {
+ val = val + "<div class='multiple-values' style='overflow:auto'>"
+ for(var i in entity[p]) {
+ val = val + "<div class='entity-debugger-widget-prop-val'>value: " + entity[p][i] + "</div>";
+ }
+ val = val + "</div></div>";
+ } else {
+ val = val + "<div class='entity-debugger-widget-prop-val'>value: " + entity[p] + "</div></div>";
}
- val = val + "<div class='entity-debugger-widget-prop-val'>value: " + entity[p] + "</div></div>"
var props = jQuery(val);
this.attachedElement.find(".entity-debugger-widget-body").append(props);
@@ -448,12 +509,20 @@ PlazaUI.Widgets.TripleSpacesBrowser = function(){
});
if(spaceCollectionResource != null) {
- var collectionResourceActions = "<div class='collection-triple-space-actions'><div class='overline'><p>collection resource actions</p></div><input type='button' value='load instances'></input></div>"
+ var collectionResourceActions = "<div class='collection-triple-space-actions'><div class='overline'><p>collection resource actions</p></div><input class='load-instances-action' type='button' value='load instances'></input>"
+ collectionResourceActions = collectionResourceActions + "<input class='create-instance-action' type='button' value='create instance'></input></div>";
+
panel.append(jQuery(collectionResourceActions));
- panel.find(".collection-triple-space-actions").bind("click",function() {
+ panel.find(".load-instances-action").bind("click",function() {
Plaza.ABox.loadInstances(spaceId, {});
});
+
+ panel.find(".create-instance-action").bind("click",function() {
+ var f = PlazaUI.Widgets.ToolboxEntityCreatorForm.extend();
+ f.attach();
+ f.wrap(spaceId, "post", "collectionResource", {});
+ });
}
return panel;
@@ -489,6 +558,8 @@ PlazaUI.Widgets.TripleSpacesBrowser = function(){
attachedElement.find(".triple-spaces-browser-header").bind('mouseup',function(event){
attachedElement.draggable("destroy");
});
+
+ PlazaUI.Utils.center(attachedElement);
};
return w;
@@ -504,18 +575,18 @@ PlazaUI.Widgets.Toolbox = function(){
var w = PlazaUI.Base.extend();
w.build = function() {
- PlazaUI.Base.build.apply(this,[])
+ PlazaUI.Base.build.apply(this,[]);
};
var _addFeature = function(container, header, cls, featureBody) {
- var body = container.find(".toolbox-widget-body")
+ var body = container.find(".toolbox-widget-body");
var elmt = "<h3 class='toolbox-widget-section-header " + cls + "'><a href='#'>" + header + "</a></h3>";
- var panel = jQuery(elmt)
+ var panel = jQuery(elmt);
body.append(panel);
- var elmt = "<div class='toolbox-widget-section-body'></div>"
+ var elmt = "<div class='toolbox-widget-section-body'></div>";
var panel = jQuery(elmt);
panel.append(featureBody);
@@ -524,25 +595,50 @@ PlazaUI.Widgets.Toolbox = function(){
var makeSearchTriples = function() {
- var code = "<div><input type='text' class ='entity-search-fld'></input><input class='entitySearchBtn' type='button' value='search'></input></div>"
- var elem = jQuery(code)
+ var code = "<div><label>free text:</label><input type='text' class ='entity-search-fld'></input><input class='entity-search-btn' type='button' value='search'></input></div>";
+
+ code = code + "<div><label>triple space:</label><select name='tspace-selector' class='tspace-selector'>";
+ for (var i in Plaza.ABox.spacesRegistry) {
+ code = code + "<option value='"+i+"'>"+i+"</option>";
+ }
+ code = code + "</select><input class='tspace-browse-btn' type='button' value='browse entities'></input></div>";
+
+
+ var elem = jQuery(code);
+
elem.find(".entity-search-fld").autocomplete({source: function(term,callback) {
var matches = [];
for(var uri in Plaza.ABox.entitiesRegistry) {
- if(uri.indexOf(term.term) != -1 || term == "") {
- matches.push(uri);
+ var entity = Plaza.ABox.entitiesRegistry[uri];
+ var found = false;
+ for(var p in entity.value) {
+ if(!found && (""+entity.value[p]).indexOf(term.term) != -1) {
+ matches.push(uri);
+ found = true;
+ }
}
}
callback(matches);
}});
- elem.find(".entitySearchBtn").bind("click", function(event) {
- var uri = elem.find(".entity-search-fld").val()
+ elem.find(".entity-search-btn").bind("click", function(event) {
+ var uri = elem.find(".entity-search-fld").val();
var w = PlazaUI.Widgets.EntityDebugger.extend();
w.setEntity(Plaza.ABox.findEntityByURI(uri));
w.attach();
});
+
+ elem.find(".tspace-browse-btn").bind("click", function(event) {
+ var spaceId = elem.find(".tspace-selector").val();
+ var w = PlazaUI.Widgets.EntitiesBrowser.extend();
+ w.setSpaceId(spaceId);
+ w.attach();
+ w.setWidth(600);
+ w.setTitle("Entities in triple space"+spaceId);
+ w.createPanels();
+ });
+
return elem;
};
@@ -565,13 +661,33 @@ PlazaUI.Widgets.Toolbox = function(){
return elem;
};
+ var makeClassesSelector = function() {
+ var txt = "<div class='tbox-classes-selector-group'><label>RDFS Classes</label>"
+ txt = txt + "<select name='classes-selector' id='tbox-inspector-classes-selector'>";
+ for(var c in Plaza.TBox.classesRegistry) {
+ txt = txt + "<option value='"+c+"'>"+c+"</option>";
+ }
+ txt = txt + "</select><input type='button' value='show'></input></div>";
+
+ return txt;
+ };
+
var makeInspectTBox = function() {
var code = "<div class='inspect-tbox-toolbox-feature'>";
code = code + "<div><input type='button' class='browse-services-btn' value='Browse registered triple spaces'></input></div>";
+ code = code + makeClassesSelector();
code = code + "</div>";
var elem = jQuery(code);
+ elem.find(".tbox-classes-selector-group > input").bind("click", function(){
+ var clsAlias = jQuery("#tbox-inspector-classes-selector").val();
+ w = PlazaUI.Widgets.RDFSClassBrowser.extend();
+ w.setRDFSClass(clsAlias);
+ w.attach();
+ w.createPanels();
+ });
+
elem.find('.browse-services-btn').bind("click", function(){
var w = PlazaUI.Widgets.TripleSpacesBrowser.extend();
w.attach();
@@ -625,6 +741,30 @@ PlazaUI.Widgets.Toolbox = function(){
return elem;
}
+ var makeCodeGeneration = function() {
+ var code = "<div class='code-generation-toolbox-feature' style='height:120px'><fieldset style='padding:10px'>";
+ code = code + "<div><label>Setup code:</label><input type='button' class='setup-code-btn' value='generate'></input></div>";
+ code = code +"</div>";
+
+ var elem = jQuery(code)
+
+ elem.find(".setup-code-btn").bind("click", function(event) {
+ var code = PlazaUI.Utils.generateSetup();
+ var window = jQuery("<div class='plaza-widget'><div class='widget-header plaza-widget-header'>Setup code generation</div><div class='plaza-widget-body'><textarea style='width:100%; height:600px'>"+code+"</textarea></div></div>");
+ PlazaUI.Widgets.makeClosable(window);
+ window.css("width",800)
+ window.css("height",600)
+ window.find(".plaza-widget-header").bind('mousedown',function(event){
+ window.draggable();
+ });
+ window.find(".plaza-widget-header").bind('mouseup',function(event){
+ window.draggable("destroy");
+ });
+ jQuery("body").append(window);
+ });
+ return elem;
+ };
+
// Insertes the widget in the DOM
w.attach = function() {
var elem = null;
@@ -642,6 +782,7 @@ PlazaUI.Widgets.Toolbox = function(){
_addFeature(this.attachedElement, "Services connection", "", makeConnectToService());
_addFeature(this.attachedElement, "Search entity", "", makeSearchTriples());
_addFeature(this.attachedElement, "Inspect tbox", "", makeInspectTBox());
+ _addFeature(this.attachedElement, "Code generation", "", makeCodeGeneration());
elem.append(this.attachedElement);
this.attachedElement.find(".toolbox-widget-body").accordion({collapsible: true, active: false});
@@ -656,6 +797,8 @@ PlazaUI.Widgets.Toolbox = function(){
this.attachedElement.find(".widget-header").bind('mouseup',function(event){
attached.draggable("destroy");
});
+
+ PlazaUI.Utils.center(this.attachedElement);
};
return w;
@@ -693,13 +836,16 @@ PlazaUI.Widgets.TriplesTable = function(){
var subject = data._uri;
for(var p in data) {
if(p != "_uri") {
- var predicate = Plaza.TBox.findPropertyUri(p);
- if(predicate == null) {
- predicate = p;
+ var predicates = Plaza.TBox.findPropertyUri(p);
+ if(predicates[0] == null) {
+ predicates = [p];
+ }
+ for(var i in predicates){
+ var predicate = predicates[i]
+ var object = data[p];
+ var txt = "<tr class='" + rowClass + "'><td>" + subject + "</td><td>" + predicate + "</td><td>" + object + "</td></tr>";
+ this.attachedElement.find("tbody").append(jQuery(txt));
}
- var object = data[p];
- var txt = "<tr class='" + rowClass + "'><td>" + subject + "</td><td>" + predicate + "</td><td>" + object + "</td></tr>";
- this.attachedElement.find("tbody").append(jQuery(txt));
}
}
}
@@ -743,7 +889,7 @@ PlazaUI.Widgets.TriplesTable = function(){
for(var i in this.space.elements) {
var elt = this.space.elements[i];
- this.createdAdapter(this.space.id, Plaza.ABox.EVENTS.CREATED, elt.value)
+ this.createdAdapter(this.space.id, Plaza.ABox.EVENTS.CREATED, elt.value);
}
}
@@ -759,6 +905,538 @@ PlazaUI.Widgets.TriplesTable = function(){
this.attachedElement.find(".widget-header").bind('mouseup',function(event){
attached.draggable("destroy");
});
+
+ PlazaUI.Utils.center(this.attachedElement);
+ };
+
+ return w;
+}();
+
+/* PlazaUI.Widgets.EntityCreatorForm */
+
+PlazaUI.Widgets.EntityCreatorForm = function(){
+ var w = PlazaUI.Base.extend();
+
+ w.build = function() {
+ PlazaUI.Base.build.apply(this,[]);
+ this.spaceId = null;
+ this.method = null;
+ this.serviceKind = null;
+ this.entity = null;
+ this.propertyCounter = 0;
+ this.currentProperties = {};
+ this.attachedElement = null;
+ };
+
+ var attributesForSpace = function(spaceId, serviceKind, method) {
+ var space = Plaza.ABox.findSpace(spaceId);
+ if(space != null) {
+ var serviceAlias = space[serviceKind];
+ if(serviceAlias != null) {
+ return Plaza.Services.inputMessagesMap(serviceAlias, method);
+ } else {
+ PlazaUI.Utils.showDialog("Error", "Servive cannot be found for triple space:"+spaceId)
+ }
+ } else {
+ PlazaUI.Utils.showDialog("Error", "Triple space cannot be found with identifier:"+spaceId)
+ }
+ };
+
+ w.inputTxtForProp = function(prop, entity){
+ var inputId = this.propertyCounter++;
+ var propId = this.__plz_id+"-"+inputId;
+ value = entity[prop];
+ if(value == undefined) {
+ value = "";
+ }
+
+ this.currentProperties[prop] = propId;
+
+ var dt = Plaza.XSD.DATATYPES;
+ // @todo a selector for the type of the property must be added
+ var range = Plaza.TBox.propertiesMap[Plaza.TBox.propertiesRegistry[prop]].range[0];
+ if(range == dt.boolean) {
+ var txt = "<select name='"+prop+"' id='"+propId+"'>";
+ if(value === true) {
+ txt = txt + "<option value='true' selected='true'>true</option>";
+ } else {
+ txt = txt + "<option value='true'>true</option>";
+ }
+ if(value === false) {
+ txt = txt + "<option value='false' selected='true'>true</option>";
+ } else {
+ txt = txt + "<option value='false'>true</option>";
+ }
+ return jQuery(txt + "</select>");
+ } else if(range == dt.dateTime || range == dt.date) {
+ var txt = jQuery("<input type='text' id='"+propId+"'></input>");
+ if (value == "") {
+ value = null;
+ }
+ txt.datepicker({defaultDate: null, dateFormat: "yy-mm-dd"});
+ return txt;
+ } else {
+ if(Plaza.XSD.isKnownUriDatatype(range) || prop == "restResourceId") {
+ return jQuery("<input name='"+prop+"' id='"+propId+"' type='text' value='"+value+"'></input>");
+ } else {
+ var w = PlazaUI.Widgets.MultiEntitiesSelector.extend();
+ w.setRDFSClass(range);
+ w.setPropertyValues(value);
+ w.attach();
+ w.attachedElement.find('.entities-selector-list').attr('id', propId);
+ return w.attachedElement;
+ }
+ }
+ },
+
+ w.addPropertyToForm = function(formBody, prop, entity) {
+ var label = Plaza.Utils.humanize(prop);
+ var propClass = prop
+ if(prop.indexOf("http://") == 0) {
+ label = prop;
+ propClass = ""
+ }
+
+ var value = entity[prop];
+ if(value == null) {
+ value = "";
+ }
+ var propHtml = jQuery("<div class='property'><label class='"+ propClass +"Label'>"+label+"</label></div>");
+ propHtml.append(this.inputTxtForProp(prop,entity));
+
+ formBody.append(propHtml);
+ };
+
+ w.retrieveFormData = function(){
+ var data = {};
+
+ for(var p in this.currentProperties) {
+ var val = this.attachedElement.find("#"+this.currentProperties[p]).val();
+
+ if(val == "") {
+ val = null;
+ }
+
+ if(val != null) {
+ data[p] = val;
+ }
+ }
+
+ return data;
+ };
+
+ w.wrap = function(spaceId, method, serviceKind, entity) {
+ this.spaceId = spaceId;
+ this.method = method;
+ this.serviceKind = serviceKind;
+ this.entity = entity;
+
+ var attributes = attributesForSpace(spaceId, serviceKind, method);
+ this.currentProperties = {};
+
+ if( this.attachedElement != null) {
+ var body = this.attachedElement.find(".entity-creator-form");
+ for(var p in attributes) {
+ this.addPropertyToForm(body,p,entity);
+ }
+
+ var actions = this.attachedElement.find('.entity-creator-actions');
+ var that = this;
+ if(serviceKind == "collectionResource") {
+ var btn = jQuery("<input class='entity-creator-form-btn' type='button' value='save'></input>");
+ btn.bind("click",function() {
+ var data = that.retrieveFormData();
+ Plaza.ABox.createEntity(that.spaceId, data);
+ });
+ actions.append(btn);
+ } else if(serviceKind == "singleResource" && method.toLowerCase() == "get") {
+ var btn = jQuery("<input class='entity-creator-form-btn' type='button' value='load'></input>");
+ actions.append(btn);
+ } else if(serviceKind == "singleResource" && method.toLowerCase() == "put") {
+ var btn = jQuery("<input class='entity-creator-form-btn' type='button' value='update'></input>");
+ btn.bind("click",function() {
+ var data = that.retrieveFormData();
+ Plaza.ABox.updateEntity(entity._uri, data);
+ });
+ actions.append(btn);
+ } else if(serviceKind == "singleResource" && method.toLowerCase() == "delete") {
+ var btn = jQuery("<input class='entity-creator-form-btn' type='button' value='destroy'></input>");
+ btn.bind("click",function() {
+ var data = that.retrieveFormData();
+ Plaza.ABox.destroyEntity(entity._uri);
+ });
+ actions.append(btn);
+ }
+
+ PlazaUI.Utils.center(this.attachedElement);
+ }
+ };
+
+ w.attach = function() {
+ var elem = null;
+ if( arguments.length == 0) {
+ elem = jQuery("body");
+ } else {
+ elem = arguments[0];
+ };
+
+ this.attachedElement = jQuery("<div class='plaza-widget entity-creator-widget'>");
+ this.attachedElement.append(jQuery("<div class='entity-creator-widget-body'><div class='entity-creator-form'></div><div class='entity-creator-actions'></div></div>"));
+
+ if(this.spaceId != null && this.method != null && this.serviceKind != null && this.entity != null) {
+ this.wrap(this.spaceId, this.method, this.serviceKind, this.entity);
+ }
+ elem.append(this.attachedElement);
+ PlazaUI.Utils.center(this.attachedElement);
+ };
+
+ return w;
+}();
+
+
+/**
+ * PlazaUI.Widgets.ToolboxEntityCreatorForm
+ */
+PlazaUI.Widgets.ToolboxEntityCreatorForm = function(){
+ var w = PlazaUI.Widgets.EntityCreatorForm.extend();
+
+ w.build = function(){
+ PlazaUI.Widgets.EntityCreatorForm.build.apply(this, []);
+ };
+
+ w.wrap = function() {
+ PlazaUI.Widgets.EntityCreatorForm.wrap.apply(this,arguments);
+ if(this.spaceId != null && this.method != null && this.serviceKind != null) {
+ this.attachedElement.find(".toolbox-entity-creator-form-header").html("Triple space "+ this.spaceId + " " + this.method + " operation");
+ }
+ PlazaUI.Widgets.makeClosable(this.attachedElement);
+ var attachedElement = this.attachedElement;
+ this.attachedElement.resizable();
+ this.attachedElement.find(".toolbox-entity-creator-form-header").bind('mousedown',function(event){
+ attachedElement.draggable();
+ });
+ this.attachedElement.find(".toolbox-entity-creator-form-header").bind('mouseup',function(event){
+ attachedElement.draggable("destroy");
+ });
+ PlazaUI.Utils.center(this.attachedElement);
+ };
+
+ w.attach = function() {
+ PlazaUI.Widgets.EntityCreatorForm.attach.apply(this,[]);
+ var body = this.attachedElement;
+ body.addClass("toolbox-entity-creator-widget");
+ body.find(".entity-creator-widget-body").addClass("toolbox-entity-creator-widget-body");
+ body.prepend(jQuery("<div class='toolbox-entity-creator-form-header widget-header'></div>"));
+
+ if(this.spaceId != null && this.method != null && this.serviceKind != null) {
+ this.attachedElement.find(".toolbox-entity-creator-form-header").html("Triple space "+ this.spaceId + " " + this.method + " operation");
+ }
+
+ PlazaUI.Widgets.makeClosable(this.attachedElement);
+ var attachedElement = this.attachedElement;
+ this.attachedElement.resizable();
+ this.attachedElement.find(".toolbox-entity-creator-form-header").bind('mousedown',function(event){
+ attachedElement.draggable();
+ });
+ this.attachedElement.find(".toolbox-entity-creator-form-header").bind('mouseup',function(event){
+ attachedElement.draggable("destroy");
+ });
+ PlazaUI.Utils.center(this.attachedElement);
+ };
+
+ return w;
+}();
+
+/**
+ * PlazaUI.Widgets.PanelListFrame
+ */
+PlazaUI.Widgets.PanelListFrame = function(){
+
+ var w = PlazaUI.Base.extend();
+
+ w.build = function() {
+ PlazaUI.Base.build.apply(this,[]);
+ this.panels = [];
+ this.attachedElement = null;
+ };
+
+ w.appendPanels = function() {
+ for(var p in this.panels) {
+ this.attachedElement.find(".panel-list-body").append(this.panels[p]);
+ }
+ };
+
+ // Inserts the widget in the DOM
+ w.attach = function() {
+ var elem = null;
+ if( arguments.length == 0) {
+ elem = jQuery("body");
+ } else {
+ elem = arguments[0];
+ };
+
+ var attachedElement = jQuery("<div class='plaza-widget panel-list-widget'>");
+ attachedElement.append(jQuery("<div class='panel-list-header widget-header'>Panel List</div>"));
+ attachedElement.append(jQuery("<div class='panel-list-body widget-body'></div>"));
+
+ elem.append(attachedElement);
+
+ // UI tweaks
+ attachedElement.css("width",500)
+
+ PlazaUI.Widgets.makeClosable(attachedElement);
+ attachedElement.resizable();
+ attachedElement.find(".panel-list-header").bind('mousedown',function(event){
+ attachedElement.draggable();
+ });
+ attachedElement.find(".panel-list-header").bind('mouseup',function(event){
+ attachedElement.draggable("destroy");
+ });
+
+ this.attachedElement = attachedElement;
+ this.attachedElement.find(".panel-list-body").css("overflow","auto");
+ PlazaUI.Utils.center(this.attachedElement);
+ };
+
+ // @todo refactor to some frame parent prototype
+ w.setWidth = function(width) {
+ this.attachedElement.css('width', width);
+ };
+
+ w.setHeight = function(height) {
+ this.attachedElement.find(".panel-list-body").css('height', height);
+ };
+
+ w.setTitle = function(title) {
+ this.attachedElement.find(".panel-list-header").html(title);
+ };
+
+ w.addWidgetClass = function(cls) {
+ this.attachedElement.find(".panel-list-widget").addClass(cls);
+ };
+
+ w.addWidgetHeaderClass = function(cls) {
+ this.attachedElement.find(".panel-list-header").addClass(cls);
+ };
+
+ return w;
+}();
+
+
+/**
+ * PlazaUI.Widgets.RDFSClassBrowser
+ */
+PlazaUI.Widgets.RDFSClassBrowser = function() {
+ w = PlazaUI.Widgets.PanelListFrame.extend();
+
+ w.build = function(){
+ PlazaUI.Widgets.PanelListFrame.build.apply(this,[]);
+ this.rdfsClass = null;
+ };
+
+ w.setRDFSClass = function(clsAlias) {
+ this.rdfsClass = clsAlias;
+ };
+
+ var classDescriptionPanel = function(classAlias) {
+ var panel = jQuery("<div class='panel-list-panel'><div class='panel-list-panel-header'>Class URI</div><div class='class-uri-panel-body panel-list-panel-body'>"+Plaza.TBox.classesRegistry[classAlias]+"</div></div>");
+ return panel;
+ };
+
+ var makePropertyPanel = function(propertyAlias){
+ var uri = Plaza.TBox.propertiesRegistry[propertyAlias];
+ var def = Plaza.TBox.propertiesMap[uri];
+ var domains = def.domain;
+ var ranges = def.range;
+
+ var panelBody = "<div><label>URI<label><input type='text' value='"+uri+"'></input></div>";
+ for(var domain in domains) {
+ panelBody = panelBody + "<div><label>domain<label><input type='text' value='"+domain+"'></input></div>";
+ }
+ for(var range in rages) {
+ panelBody = panelBody + "<div><label>range<label><input type='text' value='"+range+"'></input></div>";
+ }
+ var panel = jQuery("<div class='panel-list-panel'><div class='panel-list-panel-header'>Property "+propertyAlias+"</div><div class='panel-list-panel-body'>"+panelBody+"</div></div>");
+ return panel;
+ };
+
+ w.createPanels = function() {
+ var clsUri = Plaza.TBox.classesRegistry[this.rdfsClass];
+
+ this.panels = [classDescriptionPanel(this.rdfsClass)];
+
+ for(var p in Plaza.TBox.propertiesRegistry) {
+ var pUri = Plaza.TBox.propertiesRegistry[p];
+ var pDef = Plaza.TBox.propertiesMap[pUri];
+
+ if(Plaza.Utils.includes(pDef.domain, clsUri)) {
+ var panel = makePropertyPanel(p);
+ this.panels.push(panel);
+ }
+ }
+
+ this.appendPanels();
+ this.addWidgetHeaderClass("tbox-class-panel-header");
+ this.addWidgetClass("tbox-class-panel-body");
+ this.setTitle("Class "+clsUri);
+ PlazaUI.Widgets.makeClosable(this.attachedElement);
+ this.setWidth(600);
+ this.setHeight(500);
+ };
+
+ return w;
+}();
+
+
+
+/**
+ * PlazaUI.Widgets.EntitiesBrowser
+ */
+PlazaUI.Widgets.EntitiesBrowser = function() {
+ w = PlazaUI.Widgets.PanelListFrame.extend();
+
+ w.build = function(){
+ PlazaUI.Widgets.PanelListFrame.build.apply(this,[]);
+ this.spaceId = null;
+ };
+
+ w.setSpaceId = function(spaceId) {
+ this.spaceId = spaceId;
+ };
+
+ var makeEntityPanel = function(entity){
+
+ var panelBody = "<div><label> URI<label><input type='text' value='"+entity.uri+"'></input></div>";
+ var panelBody = "<div class='entity-actions'><input class='entity-show' type='button' value='show'><input class='entity-edit' type='button' value='edit'></input><input class='entity-delete' type='button' value='destroy'></input></div>";
+ var panel = jQuery("<div class='panel-list-panel'><div class='panel-list-panel-header'>Entity "+entity.uri+"</div><div class='panel-list-panel-body'>"+panelBody+"</div></div>");
+
+ panel.find(".entity-show").bind("click", function(){
+ var w = PlazaUI.Widgets.EntityDebugger.extend();
+ w.setEntity(Plaza.ABox.findEntityByURI(entity.uri));
+ w.attach();
+ });
+
+ panel.find(".entity-edit").bind("click", function(){
+ var f = PlazaUI.Widgets.ToolboxEntityCreatorForm.extend();
+ f.attach();
+ f.wrap(entity.space.id, "put", "singleResource", entity.value);
+ });
+
+ panel.find(".entity-delete").bind("click", function(){
+ Plaza.ABox.destroyEntity(entity.uri);
+ PlazaUI.Utils.showDialog("Notice", "Trying to destroy triples for entity:"+entity.uri+"\n Open this panel again afterwards.")
+ });
+
+ return panel;
+ };
+
+ w.createPanels = function() {
+ var space = Plaza.ABox.spacesRegistry[this.spaceId];
+
+
+ this.panels = [];
+
+ for(var i in space.entities) {
+ var entity = space.entities[i];
+ var panel = makeEntityPanel(entity);
+ this.panels.push(panel);
+ }
+
+ this.appendPanels();
+ this.addWidgetHeaderClass("tbox-class-panel-header");
+ this.addWidgetClass("tbox-class-panel-body");
+ this.setTitle("Entities in triple space "+this.spaceId);
+ PlazaUI.Widgets.makeClosable(this.attachedElement);
+ this.setWidth(600);
+ this.setHeight(this.panels.count * 50);
+ };
+
+ return w;
+}();
+
+/**
+ * PlazaUI.Widgets.MultiEntitiesSelector
+ */
+PlazaUI.Widgets.MultiEntitiesSelector = function(){
+
+ var w = PlazaUI.Base.extend();
+
+ w.build = function() {
+ PlazaUI.Base.build.apply(this,[]);
+ this.RDFSclass = null;
+ this.attachedElement = null;
+ this.propertyValues = null;
+ };
+
+ w.setRDFSClass = function(cls) {
+ this.RDFSclass = cls;
+ if(this.attachedElement!=null) {
+ this.addOptions();
+ }
+ };
+
+ w.setPropertyValues = function(values) {
+ this.propertyValues = values;
+ };
+
+ w.addOptions = function() {
+ var select = this.attachedElement.find('.entities-selector-list');
+ var selected = [];
+ for(var uri in Plaza.ABox.entitiesRegistry) {
+ var entity = Plaza.ABox.entitiesRegistry[uri];
+ var val = entity.value;
+ var match = false;
+ for(var p in val) {
+ if(val[p] == this.RDFSclass) {
+ match = true;
+ break;
+ }
+ }
+ if(match == true) {
+ selected.push(entity.uri);
+ }
+ }
+
+ for(var i in selected) {
+ var uri = selected[i];
+ if(this.propertyValues != null) {
+ if(Plaza.Utils.includes(this.propertyValues, uri)) {
+ select.append(jQuery("<option value='"+uri+"' selected='true'>"+uri+"</option>"));
+ } else {
+ select.append(jQuery("<option value='"+uri+"'>"+uri+"</option>"));
+ }
+ } else {
+ select.append(jQuery("<option value='"+uri+"'>"+uri+"</option>"));
+ }
+ }
+ };
+
+ // Inserts the widget in the DOM
+ w.attach = function() {
+ var attachedElement = jQuery("<span class='multi-entities-selector-widget'>");
+ attachedElement.append(jQuery("<span class='selector'><span class='entities-selector-title'><select class='entities-selector-list' multiple='multiple'></select></span></span>"));
+
+
+ // UI tweaks
+ this.attachedElement = attachedElement;
+ PlazaUI.Utils.center(this.attachedElement);
+
+ if(this.RDFSclass != null) {
+ this.addOptions();
+ }
+ };
+
+ w.setSelectId = function(value){
+ this.attachedElement.find(".entities-selector-list").attr("id", value);
+ };
+
+ // @todo refactor to some frame parent prototype
+ w.setWidth = function(width) {
+ this.attachedElement.css('width', width);
+ };
+
+ w.setHeight = function(height) {
+ this.attachedElement.css('height', height);
};
return w;
View
392 js/plaza.js
@@ -157,6 +157,15 @@ Plaza.XSD.DATATYPES_INV["http://www.w3.org/2001/XMLSchema#unsignedShort"] = "uns
Plaza.XSD.DATATYPES_INV["http://www.w3.org/2001/XMLSchema#unsignedByte"] = "unsignedByte";
Plaza.XSD.DATATYPES_INV["http://www.w3.org/2001/XMLSchema#positiveInteger" ] = "positiveInteger";
+Plaza.XSD.isKnownUriDatatype = function(uri) {
+ for(var du in Plaza.XSD.DATATYPES_INV) {
+ if(du == uri) {
+ return true;
+ }
+ }
+ return false;
+}
+
// Parses a URI datatype string or a Datatype object to the JS value
// {"value":"test","datatype":"http://www.w3.org/2001/XMLSchema#string"} -> "test"
// {"value":"25","datatype":"http://www.w3.org/2001/XMLSchema#int"} -> 25
@@ -180,6 +189,21 @@ Plaza.XSD.parseType= function(uri) {
Plaza.Utils = {
/**
+ * TypeOf capable of detecting arrays and nulls
+ */
+ typeOf: function(obj) {
+ if ( typeof(obj) == 'object' ) {
+ if (obj.length) {
+ return 'array';
+ } else {
+ return 'object';
+ }
+ } else {
+ return typeof(obj);
+ }
+ },
+
+ /**
* Registers a new namespace in the javascript
* runtime.
*/
@@ -236,13 +260,99 @@ Plaza.Utils = {
}
return {"value": content, "datatype": datatype};
- }
+ },
+
+ isoDate: function(date) {
+ var year = 1900+date.getYear();
+ var month = date.getMonth() + 1;
+ var day = date.getDate();
+
+ var isoDate = ""+year;
+
+ isoDate = isoDate + "-";
+ if(month < 10) {
+ isoDate = isoDate + "0" + month;
+ } else {
+ isoDate = isoDate + month;
+ }
+
+ isoDate = isoDate + "-";
+
+ if(day<10) {
+ isoDate = isoDate + "0" + day;
+ } else {
+ isoDate = isoDate + day;
+ }
+
+ return isoDate;
+ },
+
+ _Letters: function(str) {
+ var acum = []
+ for(var i in str) {
+ acum.push(str[i]);
+ }
+
+ return acum;
+ },
+
+ _isUpcase: function(letter) {
+ if(letter.toUpperCase() != letter) {
+ return false;
+ } else {
+ return true;
+ }
+ },
+
+ humanize: function(str) {
+ var lets = Plaza.Utils._letters(str);
+ var acum = [];
+ for(var i in lets) {
+ if(lets[i] == "-" || lets[i] == "_") {
+ if(i != 0) {
+ acum.push(" ")
+ }
+ } else {
+ if(Plaza.Utils._isUpcase(lets[i])) {
+ if(i !=0) {
+ acum.push(" ")
+ }
+ acum.push(lets[i].toLowerCase());
+ } else {
+ acum.push(lets[i]);
+ }
+ }
+ }
+ return String.concat.apply("",acum);
+ },
+
+ includes: function(array, val) {
+ for(var i in array) {
+ var valArray = array[i];
+ if(valArray == val) {
+ return true;
+ }
+ }
+ return false;
+ },
+
+ keysIncludes: function(map,val) {
+ for(var p in map) {
+ if(p == val) {
+ return true;
+ }
+ }
+ return false;
+ }
};
/* TBox */
Plaza.TBox = {
+ // List with all the schemas loaded
+ schemaList: [],
+
// Map URI -> alias
classesMap: {},
@@ -251,20 +361,20 @@ Plaza.TBox = {
// Map URI -> definition
propertiesMap: {"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": {"uri": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
- "domain": "http://www.w3.org/2000/01/rdf-schema#Resource",
- "range": "http://www.w3.org/2000/01/rdf-schema#Resource" },
+ "domain": ["http://www.w3.org/2000/01/rdf-schema#Resource"],
+ "range": ["http://www.w3.org/2000/01/rdf-schema#Resource"] },
"http://plaza.org/vocabularies/restResourceId": {"uri": "http://plaza.org/vocabularies/restResourceId",
- "domain": "http://www.w3.org/2000/01/rdf-schema#Resource",
- "range": "http://www.w3.org/2000/01/rdf-schema#Resource"}},
+ "domain": ["http://www.w3.org/2000/01/rdf-schema#Resource"],
+ "range": ["http://www.w3.org/2000/01/rdf-schema#Resource"]}},
// Map alias -> URI
- propertiesRegistry: {"rdf_type": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
- "plaza_id": "http://plaza.org/vocabularies/restResourceId" },
+ propertiesRegistry: {"rdf_type": ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"],
+ "restResourceId": ["http://plaza.org/vocabularies/restResourceId"] },
// Map URI -> alias
- propertiesInvRegistry: {"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "rdf_type",
- "http://plaza.org/vocabularies/restResourceId": "plaza_id" },
+ propertiesInvRegistry: {"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": ["rdf_type"],
+ "http://plaza.org/vocabularies/restResourceId": ["restResourceId"] },
// Retrieves a service in JSON format provided the URI
_retrieveSchema: function(uri, callback) {
@@ -287,7 +397,9 @@ Plaza.TBox = {
if(null == Plaza.TBox.classesRegistry[alias]) {
Plaza.TBox.classesRegistry[alias] = [uri];
} else {
- Plaza.TBox.classesRegistry[alias].push(uri);
+ if(!Plaza.Utils.includes(Plaza.TBox.classesRegistry[alias], uri)) {
+ Plaza.TBox.classesRegistry[alias].push(uri);
+ }
}
}
},
@@ -297,13 +409,26 @@ Plaza.TBox = {
var uri= propDef.uri;
if(uri != null) {
var alias = Plaza.Utils.extractQLocal(uri);
- Plaza.TBox.propertiesMap[uri] = propDef;
- Plaza.TBox.propertiesInvRegistry[uri] = alias;
+ if(Plaza.TBox.propertiesMap[uri] == null) {
+ Plaza.TBox.propertiesMap[uri] = propDef;
+ Plaza.TBox.propertiesMap[uri].domain = [propDef.domain];
+ Plaza.TBox.propertiesMap[uri].range = [propDef.range];
+ if(Plaza.TBox.propertiesInvRegistry[uri]==null) {
+ Plaza.TBox.propertiesInvRegistry[uri] = [alias];
+ } else {
+ Plaza.TBox.propertiesInvRegistry[uri].push(alias);
+ }
+ } else {
+ Plaza.TBox.propertiesMap[uri].domain.push(propDef.domain);
+ Plaza.TBox.propertiesMap[uri].range.push(propDef.range);
+ }
if(Plaza.TBox.propertiesRegistry[alias] == null) {
Plaza.TBox.propertiesRegistry[alias] = [uri];
} else {
- Plaza.TBox.propertiesRegistry[alias].push(uri);
+ if(!Plaza.Utils.includes(Plaza.TBox.propertiesRegistry[alias], uri)) {
+ Plaza.TBox.propertiesRegistry[alias].push(uri);
+ }
}
}
},
@@ -321,14 +446,19 @@ Plaza.TBox = {
var cont = function(callback) {
Plaza.TBox._retrieveSchema(uri, function(schema) {
- for(var i in schema) {
- if(schema[i].type != null) {
- Plaza.TBox._processSchema(schema[i]);
- } else {
- Plaza.TBox._processProperty(schema[i]);
+ if(schema.length > 0) {
+ Plaza.TBox.schemaList.push(uri);
+ for(var i in schema) {
+ if(schema[i].type != null) {
+ Plaza.TBox._processSchema(schema[i]);
+ } else {
+ Plaza.TBox._processProperty(schema[i]);
+ }
}
+ callback(uri);
+ } else {
+ callback(null);
}
- callback(uri);
});
};
@@ -346,7 +476,16 @@ Plaza.TBox = {
// Finds the URI registered for an alias
findPropertyUri: function(alias) {
- return Plaza.TBox.propertiesRegistry[alias];
+ var choices = Plaza.TBox.propertiesRegistry[alias];
+ for(choice in choices) {
+ if(choice.indexOf(alias) == 0) {
+ return [choice];
+ }
+ }
+ if(choices == undefined) {
+ choices = [undefined];
+ }
+ return choices;
}
@@ -513,7 +652,7 @@ Plaza.ABox = {
if(entity != null) {
entity.dirty = true;
entity.value = triples;
-
+ entity.value["_uri"] = uri
entity.space.callback(Plaza.ABox.EVENTS.UPDATED, uri, entity);
Plaza.ABox.notifyEntityObservers(uri, Plaza.ABox.EVENTS.UPDATED, entity.value);
@@ -559,7 +698,13 @@ Plaza.JSON = {
var subject = triple[0];
var predicate = triple[1];
var object = triple[2];
- var alias = Plaza.TBox.findPropertyAlias(predicate);
+ //@todo why first?
+ // We are using this function when retrieving data
+ // from some service and transforming it into a JSON
+ // object
+ // Maybe we can take a look at the service and see
+ // what alias does it define for the property URI...
+ var alias = Plaza.TBox.findPropertyAlias(predicate)[0];
if(acum[subject] == null) {
obj = {"_uri": subject};
@@ -572,7 +717,15 @@ Plaza.JSON = {
if(typeof(object) == "object" || (typeof(object) == "string" && object.indexOf("http://") != 0)) {
obj[alias] = Plaza.XSD.parseType(object);
} else {
- obj[alias] = object;
+ if(Plaza.Utils.typeOf(obj[alias]) === "array") {
+ obj[alias].push(object);
+ } else if(obj[alias] == null) {
+ obj[alias] = object;
+ } else {
+ var oldVal = obj[alias];
+ obj[alias] = [oldVal];
+ obj[alias].push(object);
+ }
}
}
}
@@ -625,6 +778,45 @@ Plaza.Services = {
return Plaza.Services.servicesMap[uri];
},
+ // Creates an object with alias -> uri for all the properties in messages
+ // of one service operation
+ inputMessagesMap: function(alias, method) {
+ var service = Plaza.Services.findByAlias(alias);
+ if(service == null) {
+ throw("Cannot find service to consume for alias: " + alias);
+ }
+
+ var operation = null;
+ for (var i in service.operations) {
+ var op = service.operations[i]
+ if(op.method.toLowerCase() == method.toLowerCase()) {
+ operation = op;
+ }
+ }
+ if(operation == null) {
+ throw("Cannot find operation for service " + alias +" and method " + method);
+ }
+
+ var messages = operation.inputMessages;
+
+ var mapping = {};
+
+ for (var i in messages) {
+ var msg = messages[i];
+ var modelReference = msg.modelReference;
+ // @todo here we choosing the first... problem
+ var modelReferenceAlias = Plaza.TBox.findPropertyAlias(modelReference)[0];
+
+ if(modelReferenceAlias != null) {
+ mapping[modelReferenceAlias] = modelReference
+ } else {
+ mapping[modelReference] = modelReference
+ }
+ }
+
+ return mapping;
+ },
+
// Creates a map with urlReplacements and values extracted from the data
// passed as arguments
_computeReplacements: function(data, messages) {
@@ -634,11 +826,15 @@ Plaza.Services = {
var msg = messages[i];
var modelReference = msg.modelReference;
var urlReplacement = Plaza.Utils.cleanTypedLiteral(msg.urlReplacement).value;
- var modelReferenceAlias = Plaza.TBox.findPropertyAlias(modelReference);
- var value = data[modelReferenceAlias];
- if(value == null) {
- value = data[modelReference];
+ var modelReferenceAliases = Plaza.TBox.findPropertyAlias(modelReference);
+ modelReferenceAliases.push(urlReplacement);
+
+ var value = null;
+ for(var modelReferenceAlias in modelReferenceAliases) {
+ if(value == null) {
+ value = data[modelReferenceAliases[modelReferenceAlias]];
+ }
}
if(value != null) {
mapping[urlReplacement] = value;
@@ -705,11 +901,13 @@ Plaza.Services = {
type: realMethod.toUpperCase(),
dataType: 'json',
data: parameters,
+ traditional: true,
success: function(triples) {
- callback(alias, method, triples);
+ callback({"alias": alias, "method": method, "triples":triples, "kind":"success"});
},
error: function(e) {
- throw "Error consuming service: " + url + " method: " + method + " parameters: " + parameters + " -> " + e;
+ console.log("Error consuming service: " + url + " method: " + method + " parameters: " + parameters + " -> " + e);
+ callback({"kind":"error", "error":e });
}
});
@@ -746,14 +944,14 @@ Plaza.ABox.TripleSpace = {
// Updated
if(event == Plaza.ABox.EVENTS.UPDATED) {
- Plaza.Services.consume(Plaza.ABox.TripleSpace._singleResourceName(name), "put", entity.value, function(alias, method, triples){
+ Plaza.Services.consume(Plaza.ABox.TripleSpace._singleResourceName(name), "put", entity.value, function(evt){
entity.dirty = false;
});
}
// Destroyed
if(event == Plaza.ABox.EVENTS.DESTROYED) {
- Plaza.Services.consume(Plaza.ABox.TripleSpace._singleResourceName(name), "delete", entity.value, function(alias, method, triples){});
+ Plaza.Services.consume(Plaza.ABox.TripleSpace._singleResourceName(name), "delete", entity.value, function(evt){});
}
});
@@ -793,30 +991,101 @@ Plaza.ABox.TripleSpace = {
};
// Load a set of instances
-Plaza.ABox.loadInstances = function(spaceId, data){
+Plaza.ABox.loadInstances = function(){
+ var spaceId = arguments[0];
+ var data = arguments[1];
+ var clbk = arguments[2]; //optional
+
+
var space = Plaza.ABox.spacesRegistry[spaceId];
var collectionResource = space["collectionResource"];
if(collectionResource != null) {
- Plaza.Services.consume(collectionResource, "get", data, function(alias, method, triples){
- var results = Plaza.JSON.fromTriples(triples);
- for (var i in results) {
- var entity = results[i];
- var found = Plaza.ABox.entitiesRegistry[entity._uri];
- if(found != null) {
- if(found.dirty == false) {
- Plaza.ABox.updateEntity(entity._uri, entity);
+ Plaza.Services.consume(collectionResource, "get", data, function(evt){
+ if(evt.kind == "error") {
+ if(clbk != null) {
+ clbk(evt);
+ }
+ } else {
+ var alias = evt.alias;
+ var method = evt.method;
+ var triples = evt.triples;
+ var uris = [];
+
+ var results = Plaza.JSON.fromTriples(triples);
+ for (var i in results) {
+ var entity = results[i];
+ uris.push(entity._uri);
+ var found = Plaza.ABox.entitiesRegistry[entity._uri];
+ if(found != null) {
+ if(found.dirty == false) {
+ Plaza.ABox.updateEntity(entity._uri, entity);
+ } else {
+ for(var p in entity) {
+ if(found.value[p] == null) {
+ found.value[p] = entity.p
+ }
+ }
+ Plaza.ABox.updateEntity(found._uri, found.value);
+ }
} else {
- //@todo merging is correct?
- for(var p in entity) {
- if(found.value[p] == null) {
- found.value[p] = entity.p
+ Plaza.ABox.registerEntity(entity._uri, entity, spaceId);
+ }
+ }
+ if(clbk != null) {
+ clbk({"uris":uris, "kind":"success"});
+ }
+ }
+ });
+ } else {
+ throw "Uknown triple space:" + spaceId;
+ }
+};
+
+// Load one instance
+Plaza.ABox.loadInstance = function(){
+ var spaceId = arguments[0];
+ var data = arguments[1];
+ var clbk = arguments[2]; //optional
+
+
+ var space = Plaza.ABox.spacesRegistry[spaceId];
+
+ var singleResource = space["singleResource"];
+ if(singleResource != null) {
+ Plaza.Services.consume(singleResource, "get", data, function(evt){
+ if(evt.kind == "error") {
+ if(clbk != null) {
+ clbk(evt);
+ }
+ } else {
+ var alias = evt.alias;
+ var method = evt.method;
+ var triples = evt.triples;
+ var uris = [];
+
+ var results = Plaza.JSON.fromTriples(triples);
+ for (var i in results) {
+ var entity = results[i];
+ uris.push(entity._uri);
+ var found = Plaza.ABox.entitiesRegistry[entity._uri];
+ if(found != null) {
+ if(found.dirty == false) {
+ Plaza.ABox.updateEntity(entity._uri, entity);
+ } else {
+ for(var p in entity) {
+ if(found.value[p] == null) {
+ found.value[p] = entity.p
+ }
}
+ Plaza.ABox.updateEntity(found._uri, found.value);
}
- Plaza.ABox.updateEntity(found._uri, found.value);
+ } else {
+ Plaza.ABox.registerEntity(entity._uri, entity, spaceId);
}
- } else {
- Plaza.ABox.registerEntity(entity._uri, entity, spaceId);
+ }
+ if(clbk != null) {
+ clbk({"uris":uris, "kind":"success"});
}
}
});
@@ -826,16 +1095,33 @@ Plaza.ABox.loadInstances = function(spaceId, data){
};
// Creates a new instance
-Plaza.ABox.createEntity = function(spaceId, data) {
+Plaza.ABox.createEntity = function() {
+ var spaceId = arguments[0];
+ var data = arguments[1];
+ var clbk = arguments[2]; //optional
+
var space = Plaza.ABox.spacesRegistry[spaceId];
var collectionResource = space["collectionResource"];
if(collectionResource != null) {
- Plaza.Services.consume(collectionResource, "post", data, function(alias, method, triples){
- var results = Plaza.JSON.fromTriples(triples);
- var entity = results[0];
-
- Plaza.ABox.registerEntity(entity._uri, entity, spaceId);
+ Plaza.Services.consume(collectionResource, "post", data, function(evt){
+ if(evt.kind == "success") {
+ var alias = evt.alias;
+ var method = evt.method;
+ var triples = evt.triples;
+
+ var results = Plaza.JSON.fromTriples(triples);
+ var entity = results[0];
+
+ Plaza.ABox.registerEntity(entity._uri, entity, spaceId);
+ if(clbk != null) {
+ clbk({"kind":"success", "uris":[entity._uri]});
+ }
+ } else {
+ if(clbk != null) {
+ clbk(evt);
+ }
+ }
});
} else {
throw "Uknown triple space:" + spaceId;
View
489 src/plaza/examples/scrummy-clone/client/css/jquery-ui.css
@@ -0,0 +1,489 @@
+/*
+* jQuery UI CSS Framework
+* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
+*/
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+* jQuery UI CSS Framework
+* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
+* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
+* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+*/
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(/images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(/images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
+.ui-widget-header a { color: #222222; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(/images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(/images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(/images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(/images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(/images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(/images/ui-icons_222222_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(/images/ui-icons_222222_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(/images/ui-icons_222222_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(/images/ui-icons_888888_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(/images/ui-icons_454545_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(/images/ui-icons_454545_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(/images/ui-icons_2e83ff_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(/images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }
+.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa url(/images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(/images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* Resizable
+----------------------------------*/
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Selectable
+----------------------------------*/
+.ui-selectable-helper { border:1px dotted black }
+/* Accordion
+----------------------------------*/
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion .ui-accordion-li-fix { display: inline; }
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+/* IE7-/Win - Fix extra vertical space in lists */
+.ui-accordion a { zoom: 1; }
+.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
+.ui-accordion .ui-accordion-content-active { display: block; }/* Autocomplete
+----------------------------------*/
+.ui-autocomplete { position: absolute; cursor: default; }
+.ui-autocomplete-loading { background: white url('/images/ui-anim_basic_16x16.gif') right center no-repeat; }
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/* Menu
+----------------------------------*/
+.ui-menu {
+ list-style:none;
+ padding: 2px;
+ margin: 0;
+ display:block;
+}
+.ui-menu .ui-menu {
+ margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+ margin:0;
+ padding: 0;
+ zoom: 1;
+ float: left;
+ clear: left;
+ width: 100%;
+}
+.ui-menu .ui-menu-item a {
+ text-decoration:none;
+ display:block;
+ padding:.2em .4em;
+ line-height:1.5;
+ zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+ font-weight: normal;
+ margin: -1px;
+}
+/* Button
+----------------------------------*/
+
+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
+.ui-button-icons-only { width: 3.4em; }
+button.ui-button-icons-only { width: 3.7em; }
+
+/*button text element */
+.ui-button .ui-button-text { display: block; line-height: 1.4; }
+.ui-button-text-only .ui-button-text { padding: .4em 1em; }
+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
+.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
+/* no icon support for input elements, provide padding by default */
+input.ui-button { padding: .4em 1em; }
+
+/*button icon element(s) */
+.ui-button-icon-only .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
+.ui-button-text-icon .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+
+/*button sets*/
+.ui-buttonset { margin-right: 7px; }
+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
+
+/* workarounds */
+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */