[caboto commit] r544 - ASSIGNED - # 236: Repeating properties per annotation

0 views
Skip to first unread message

codesite...@google.com

unread,
Jul 10, 2009, 8:54:22 AM7/10/09
to cabot...@googlegroups.com
Author: jasper....@gmail.com
Date: Fri Jul 10 05:50:19 2009
New Revision: 544

Modified:
branches/multi_valued/caboto-web/src/main/webapp/index.jsp
branches/multi_valued/caboto-web/src/main/webapp/js/annotations.js

Log:
ASSIGNED - # 236: Repeating properties per annotation
https://webfutures.ilrt.bris.ac.uk/stars/ticket/236

Modified: branches/multi_valued/caboto-web/src/main/webapp/index.jsp
==============================================================================
--- branches/multi_valued/caboto-web/src/main/webapp/index.jsp (original)
+++ branches/multi_valued/caboto-web/src/main/webapp/index.jsp Fri Jul 10
05:50:19 2009
@@ -51,8 +51,11 @@
<p>
<label><strong>Title:</strong></label><br/>
<input id="annotation-title" type="text" name="title"
size="50"/><br/>
- <label><strong>Body:</strong></label><br/>
- <textarea id="annotation-body" rows="5" cols="50"
+ <label><strong>Description:</strong></label><br/>
+ <textarea id="annotation-description1" rows="5"
cols="50"
+ name="description"></textarea><br/>
+ <label><strong>Description (repeated
field):</strong></label><br/>
+ <textarea id="annotation-description2" rows="5"
cols="50"
name="description"></textarea><br/>
<input type="radio" name="privacy" value="public"
checked="checked"> Public
<input type="radio" name="privacy" value="private">
Private

Modified: branches/multi_valued/caboto-web/src/main/webapp/js/annotations.js
==============================================================================
--- branches/multi_valued/caboto-web/src/main/webapp/js/annotations.js
(original)
+++ branches/multi_valued/caboto-web/src/main/webapp/js/annotations.js Fri
Jul 10 05:50:19 2009
@@ -85,10 +85,15 @@

function formatAnnotation(annotation, uid, admin) {

- var date = parseDate(annotation.created);
+ var date = parseDate(annotation.created);
var author = parseAuthor(annotation.author);
- var body = annotation.body.description.replace(/\n|\r/g, "<br />\n");
+// var body = annotation.body.description.replace(/\n|\r/g, "<br />\n");
var type = findType(annotation.id);
+
+ var body = "";
+ for(i=0; i<annotation.body.description.length; i++) {
+ body += annotation.body.description[i] + "<br/>";
+ }

var output = "<div class='annotation-entry'>";

@@ -121,9 +126,10 @@
if (document.getElementById('annotation-comment-form')) {
Form.Element.enable('annotation-submit');
Form.Element.clear('annotation-title');
- Form.Element.clear('annotation-body');
+ Form.Element.clear('annotation-description1');
+ Form.Element.clear('annotation-description2');
}
-
+ document.getElementById("annotation-messages").innerHTML = "";
}

/*
@@ -216,17 +222,19 @@
message += "You need to provide a title.";
}

- if (!Form.Element.present("annotation-body")) {
- message += "You need to provide a body.";
+ if (!Form.Element.present("annotation-description1")
&& !Form.Element.present("annotation-description2")) {
+ message += "You need to provide at least one description.";
} else {

- var body = Form.Element.getValue("annotation-body");
+ for(i=1;i<3;i++) {
+ var desc = Form.Element.getValue("annotation-description" + i);

- //
<http://haacked.com/archive/2004/10/25/usingregularexpressionstomatchhtml.aspx>
- var matches = body.match(/<\/?\w+((\s+\w+(\s*=\s*(?:\".*?\"|
\'.*?\'|[^\'\">\s]+))?)+\s*|\s*)\/?>/);
+ //
<http://haacked.com/archive/2004/10/25/usingregularexpressionstomatchhtml.aspx>
+ var matches = desc.match(/<\/?\w+((\s+\w+(\s*=\s*(?:\".*?\"|\'.*?\'|
[^\'\">\s]+))?)+\s*|\s*)\/?>/);

- if (matches !== null) {
- message += "It looks like you have markup in your comment -
not supported, sorry!";
+ if (matches !== null) {
+ message += "It looks like you have markup in your comment #"+i+" -
not supported, sorry!";
+ }
}
}

Reply all
Reply to author
Forward
0 new messages