summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.ant2
-rw-r--r--src/local/domain/cri.rhizi.net/types.js (renamed from src/client/model/types.js)0
-rw-r--r--src/local/domain/default.rhizi.net/types.js52
3 files changed, 54 insertions, 0 deletions
diff --git a/build.ant b/build.ant
index 6984c053..a362662f 100644
--- a/build.ant
+++ b/build.ant
@@ -95,6 +95,8 @@
<copy file="res/etc/rhizi-server.conf"
tofile="${targetDeploymentDir}/etc/rhizi-server.conf" />
+ <copy file="src/local/domain/${targetDomain}/types.js"
+ tofile="${targetDeploymentDir}/static/model/types.js" description="copy schema, rename"/>
<rsync src="res/templates/" dst="${targetDeploymentDir}/templates/" />
<rsync src="res/local/template/fragment/by-domain/${targetDomain}/" dst="${targetDeploymentDir}/templates/fragment/" />
<copy file="res/etc/user_db.db" tofile="${targetDeploymentDir}/user_db.db" failonerror="false" />
diff --git a/src/client/model/types.js b/src/local/domain/cri.rhizi.net/types.js
index 76959a83..76959a83 100644
--- a/src/client/model/types.js
+++ b/src/local/domain/cri.rhizi.net/types.js
diff --git a/src/local/domain/default.rhizi.net/types.js b/src/local/domain/default.rhizi.net/types.js
new file mode 100644
index 00000000..249f9f69
--- /dev/null
+++ b/src/local/domain/default.rhizi.net/types.js
@@ -0,0 +1,52 @@
+define(['underscore', 'util'],
+function(_, util)
+{
+
+var nodetypes,
+ type_attributes = {
+ 'person': {
+ 'title': 'Person',
+ 'attributes': ['description', 'url'],
+ },
+ 'skill': {
+ 'title': 'Skill',
+ 'attributes': ['description', 'url'],
+ }
+ },
+ all_attributes,
+ attribute_titles = {
+ 'name': 'Name',
+ 'type': 'Type',
+ 'description': 'Description',
+ 'url': 'URL',
+ };
+
+nodetypes = _.keys(type_attributes);
+
+type_attributes['_defaults'] = {
+ 'title': 'default',
+ 'attributes':['description', 'url']
+ };
+
+_.pluck(_.values(type_attributes), 'attributes').map(function (attributes) {
+ attributes.push('name');
+ attributes.push('type');
+ attributes.sort();
+ });
+
+all_attributes = _.union(_.flatten(_.pluck(_.values(type_attributes), 'attributes'))).sort();
+
+util.assert(_.isEqual(all_attributes, _.keys(attribute_titles).sort()));
+
+return (
+ {
+ nodetypes: nodetypes,
+ type_attributes: function (type) {
+ util.assert(type[0] !== '_', 'invalid type name');
+ return type_attributes[type_attributes.hasOwnProperty(type) ? type : '_defaults'].attributes;
+ },
+ all_attributes: all_attributes,
+ attribute_titles: attribute_titles,
+ });
+}
+)