2009/dap/ReSpec.js/js respec.js,1.65,1.66

Update of /sources/public/2009/dap/ReSpec.js/js
In directory hutz:/tmp/cvs-serv13903/d

Modified Files:
	respec.js 
Log Message:
Unified author and editor code and combined documentation to avoid replication. Added support for optional email address, and optional note following person description. 

Index: respec.js
===================================================================
RCS file: /sources/public/2009/dap/ReSpec.js/js/respec.js,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- respec.js	4 Dec 2009 18:01:58 -0000	1.65
+++ respec.js	4 Dec 2009 20:18:17 -0000	1.66
@@ -309,6 +309,48 @@
         this._insertCSS(css, false);
     },
     
+    // single function used to display people information for editors,
+    // authors, etc (fjh 2009-12-04)
+
+    showPeople: function(name, people) {
+        var header = "";
+
+        if (people.length == 0) return header;
+
+        if (people.length > 1) {
+            header += "<dt>" + name + "s:</dt>";
+        } else {
+            header += "<dt>" + name + ":</dt>";
+        }
+
+        for (var i = 0; i < people.length; i++) {
+            var pers = people[i];
+            header += "<dd>";
+            if (pers.url) {
+                header += "<a href='" + pers.url + "'>" + pers.name + "</a>";
+            } else {
+                header += pers.name;
+            }
+            if (pers.company) {
+                header += ", ";
+                if (pers.companyURL) {
+                    header += "<a href='" + pers.companyURL + "'>" +
+            pers.company + "</a>";
+                } else {
+                    header += pers.company;
+                }
+            }
+            if (pers.mailto) {
+                header += " <a href='mailto:" + pers.mailto + "'>" + pers.mailto + "</a> ";
+            }
+            if (pers.note) {
+                header += " ( " + pers.note + " )";
+            }
+            header += "</dd>";
+        }
+        return header;
+    },
+
     makeHeaders:    function () {
         var mat = (this.status2maturity[this.specStatus]) ? this.status2maturity[this.specStatus] : this.specStatus;
         var thisVersion = "http://www.w3.org/TR/" + this.publishDate.getFullYear() + "/" + mat + "-" +
@@ -339,36 +381,14 @@
             "<dt>Latest Editor's Draft:</dt><dd><a href='" + this.edDraftURI + "'>" + this.edDraftURI + "</a></dd>";
         if (this.specStatus != "FPWD")
             header += "<dt>Previous version:</dt><dd>" + prevVersion + "</dd>";
-        if (this.editors.length > 1) header += "<dt>Editors:</dt>";
-        else                         header += "<dt>Editor:</dt>";
-        for (var i = 0; i < this.editors.length; i++) {
-            var ed = this.editors[i];
-            header += "<dd>";
-            if (ed.url) header += "<a href='" + ed.url + "'>" + ed.name + "</a>";
-            else        header += ed.name;
-            if (ed.company) {
-                header += ", ";
-                if (ed.companyURL) header += "<a href='" + ed.companyURL + "'>" + ed.company + "</a>";
-                else               header += ed.company;
-            }
-            header += "</dd>";
-        }
-        if (this.authors.length > 0) {
-            if (this.authors.length > 1) header += "<dt>Authors:</dt>";
-            else                         header += "<dt>Author:</dt>";
-            for (var i = 0; i < this.authors.length; i++) {
-                var auth = this.authors[i];
-                header += "<dd>";
-                if (auth.url) header += "<a href='" + auth.url + "'>" + auth.name + "</a>";
-                else        header += auth.name;
-                if (auth.company) {
-                    header += ", ";
-                    if (auth.companyURL) header += "<a href='" + auth.companyURL + "'>" + auth.company + "</a>";
-                    else               header += auth.company;
-                }
-                header += "</dd>";
-            }
+
+
+        if(this.editors.length == 0) {
+            error("There must be at least one editor.");
         }
+        header += this.showPeople("Editor", this.editors);
+        header += this.showPeople("Author", this.authors);
+
         header += 
             "</dl><p class='copyright'><a href='http://www.w3.org/Consortium/Legal/ipr-notice#Copyright'>Copyright</a> © " + 
             this.publishDate.getFullYear() + " <a href='http://www.w3.org/'><acronym title='World Wide Web Consortium'>W3C</acronym></a><sup>®</sup> " +

Received on Friday, 4 December 2009 20:18:21 UTC