Modified:
/trunk/Caboto/caboto-web/src/main/webapp/index.jsp
/trunk/Caboto/caboto-web/src/main/webapp/js/annotations.js
=======================================
--- /trunk/Caboto/caboto-web/src/main/webapp/index.jsp Fri Mar 20 03:55:59
2009
+++ /trunk/Caboto/caboto-web/src/main/webapp/index.jsp Fri Jan 15 03:38:18
2010
@@ -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
=======================================
--- /trunk/Caboto/caboto-web/src/main/webapp/js/annotations.js Fri Sep 5
14:37:58 2008
+++ /trunk/Caboto/caboto-web/src/main/webapp/js/annotations.js Fri Jan 15
03:38:18 2010
@@ -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");
-
- //
<http://haacked.com/archive/2004/10/25/usingregularexpressionstomatchhtml.aspx>
- var matches = body.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!";
+ 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 = desc.match(/<\/?\w+((\s+\w+(\s*=\s*(?:\".*?\"|\'.*?\'|
[^\'\">\s]+))?)+\s*|\s*)\/?>/);
+
+ if (matches !== null) {
+ message += "It looks like you have markup in your comment #"+i+" -
not supported, sorry!";
+ }
}
}