diff options
author | Yorhel <git@yorhel.nl> | 2009-09-26 10:59:18 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-09-26 10:59:18 +0200 |
commit | c160933061f58a0f64a6037c1db8b79fb725b495 (patch) | |
tree | 37e5fce3913c18504757a944c394f18b63e13e3b /static | |
parent | 836eb84c9be9197b5ca842a755051f4230df7600 (diff) |
Converted VN relations to ENUM data type and made them translatable
OK, these are actually two separate things: to make the relations
translatable they didn't necessarily have to be stored as enum, and I
could've also converted them to enum but not have it translatable.
Nevertheless, it was easier to just do both at the same time.
Also note how I used the string "$____vnrel_<rel>____$" as identifier in
the relation graphs while I could have used something a lot shorter
("$<rel>$" would have been fine, for example). This is done so that
graphviz can make some space for those relations - the long identifier
gives a slightly more realistic representation of the actual length of
the relation titles.
Diffstat (limited to 'static')
-rw-r--r-- | static/f/forms.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/static/f/forms.js b/static/f/forms.js index ce9daab5..8c3e4e8b 100644 --- a/static/f/forms.js +++ b/static/f/forms.js @@ -199,7 +199,7 @@ function relLoad() { // fetch the relation types from the add new relation selectbox l = x('relation_new').getElementsByTagName('select')[0].options; for(i=0;i<l.length;i++) - relTypes[Math.floor(l[i].value)] = l[i].text; + relTypes[l[i].value] = l[i].text; // read the current relations l = x('relations').value.split('|||'); @@ -247,7 +247,7 @@ function relAdd(rel, vid, title) { o.appendChild(t); var options = ''; - for(var i=0;i<relTypes.length;i++) + for(var i in relTypes) options += '<option value="'+i+'"'+(i == rel ? ' selected="selected"' : '')+'>'+qq(relTypes[i])+'</option>'; t = document.createElement('td'); t.className = 'tc2'; @@ -289,10 +289,11 @@ function relSerialize() { var l = x('relation_tbl').getElementsByTagName('tr'); for(i=0;i<l.length;i++) { var title = l[i].getElementsByTagName('td')[0]; + var rel = l[i].getElementsByTagName('select')[0]; title = title.innerText || title.textContent; title = title.substr(title.indexOf(':')+1); r += (r ? '|||' : '') - +l[i].getElementsByTagName('select')[0].selectedIndex + +rel.options[rel.selectedIndex].value +','+l[i].id.substr(12)+','+title; } x('relations').value = r; |