community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1681816 - /comdev/projects.apache.org/site/js/projects.js
Date Tue, 26 May 2015 19:09:45 GMT
Author: hboutemy
Date: Tue May 26 19:09:45 2015
New Revision: 1681816

URL: http://svn.apache.org/r1681816
Log:
create minimal projects info for committees without any project's DOAP

Modified:
    comdev/projects.apache.org/site/js/projects.js

Modified: comdev/projects.apache.org/site/js/projects.js
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/site/js/projects.js?rev=1681816&r1=1681815&r2=1681816&view=diff
==============================================================================
--- comdev/projects.apache.org/site/js/projects.js (original)
+++ comdev/projects.apache.org/site/js/projects.js Tue May 26 19:09:45 2015
@@ -256,20 +256,18 @@ function appendLiInnerHTML(ul,html) {
 
 function renderProjectPage(project, projectId) {
     var obj = document.getElementById('contents');
-    var isCommittee = false;
 
     if ((!project || !project.name) && projects[projectId]) {
+        // no DOAP file but known project: podling (loaded from podlings.json)
         project = projects[projectId];
     }
-    if (committees[projectId]) {
-        isCommittee = true;
-    }
-    if ((!project || !project.name) && (!isCommittee)) {
+    if (!project || !project.name) {
         obj.innerHTML = "<h2>Sorry, I don't have any information available about this
project</h2>";
         return;
     }
 
-    var isIncubating = project && (project.podling || (project.name && project.name.match(/incubating/i)));
+    fixProjectName(project);
+    var isIncubating = project && (project.podling || (project.pmc == 'incubator'));
 
     // Rerig the unix name and committee id
     var unixgroup = projectId.split("-")[0];
@@ -279,9 +277,10 @@ function renderProjectPage(project, proj
     if (project && project.pmc == "attic") {
         unixgroup = "attic";
     }
-    var committeeId = unixgroup;
+    var committeeId = isIncubating ? 'incubator' : unixgroup;
     if (!committees[unixgroup]) {
-        // one committee has a unix group that is different from committee id: webservices
(group=ws), see parsecommittees.py#group_ids
+        // at least one committee has a unix group that is different from committee id: webservices
(group=ws), see parsecommittees.py#group_ids
+        // search instead of hard-coding the currently known case
         for (p in committees) {
             if (committees[p].group == unixgroup) {
                 committeeId = p;
@@ -289,10 +288,6 @@ function renderProjectPage(project, proj
             }
         }
     }
-    if (isIncubating) {
-        committeeId = 'incubator';
-        project.pmc = committeeId;
-    }
     var committee = committees[committeeId];
 
     // Start by splitting the name, thus fetching the root name of the project, and not the
sub-project.
@@ -310,34 +305,13 @@ function renderProjectPage(project, proj
     }
 
     // Title + description
-    var pt = "";
-    if (isIncubating) {
-        pt = "Incubating";
-    } else if (project && !committeesByName[project.name] && committees[project.pmc])
{
-        pt = (project.pmc == "attic") ? "in the Attic" : ""
-    } else {
-        isCommittee = true
-    }
-    var name = (project && project.name) ? project.name : committee.name;
-    if (!name.match(/incubating/i) && pt != "") {
-        name +=  " (" + pt + ")";
-    }
-    obj.innerHTML = "<h1>" + name + " <font size='-1'>(a project managed by <a
href='committee.html?" + committeeId + "'>" + committee.name + " Committee</a>)</font></h1>";
+    obj.innerHTML = "<h1>" + project.name + " <font size='-1'>(a project managed
by <a href='committee.html?" + committeeId + "'>" + committee.name + " Committee</a>)</font></h1>";
 
     // project description
     appendElementWithInnerHTML(obj,'p',description.replace(/([^\r\n]+)\r?\n\r?\n/g,function(a)
{ return "<p>"+a+"</p>"}));
 
     var ul = document.createElement('ul');
 
-    // TLP Owner?
-    if (project.pmc) {
-        if (project.pmc.match(/http:\/\/([a-z0-9]+)/i)) {
-            project.pmc = project.pmc.match(/http:\/\/([a-z0-9]+)/i)[1];
-        }
-    } else {
-        project.pmc = committeeId;
-    }
-
     // Base data
     appendElementWithInnerHTML(obj,'h4',"Project base data:");
 
@@ -353,15 +327,15 @@ function renderProjectPage(project, proj
     }
 
     // Website
-    if (project.homepage && ((project.homepage != committee.homepage) &&
!isCommittee )) {
+    if (project.homepage) {
 	appendLiInnerHTML(ul, "<b>Website:</b> <a href='" + project.homepage + "'
target='_blank'>" + project.homepage + "</a>");
     }
     if (isIncubating) {
         appendLiInnerHTML(ul, "<b>Project status:</b> <span class='ppodling'>Incubating</span>");
     } else if (committeeId != 'attic') {
-	    appendLiInnerHTML(ul, "<b>Project status:</b> <span class='pactive'>Active</span>");
+        appendLiInnerHTML(ul, "<b>Project status:</b> <span class='pactive'>Active</span>");
     } else {
-	    appendLiInnerHTML(ul, "<b>Project status:</b> <span class='pretired'>Retired</span>");
+        appendLiInnerHTML(ul, "<b>Project status:</b> <span class='pretired'>Retired</span>");
     }
 
     // Committers
@@ -377,6 +351,8 @@ function renderProjectPage(project, proj
     // doap/rdf
     if (project.doap) {
 	appendLiInnerHTML(ul, "<b>Project data file:</b> <a href='" + project.doap
+ "' target='_blank'>DOAP RDF Source</a>");
+    } else {
+        appendLiInnerHTML(ul, "<b>Project data file:</b> no <a href='https://projects.apache.org/create.html'>DOAP
file</a> available");
     }
     // maintainer
     if (project.maintainer && project.maintainer.Person && project.maintainer.Person.mbox)
{
@@ -1346,30 +1322,51 @@ function weaveById(list,mapById) {
     }
 }
 
+function fixProjectName(project) {
+    // fix attic and incubator project names if necessary
+    if (project.pmc == "attic") {
+        project.name += " (in the Attic)";
+    } else if ((project.pmc == "incubator") && !project.name.match(/incubating/i))
{
+        project.name += " (Incubating)";
+    }
+    return project;
+}
+
 // Add content by id to projects
 function weaveInProjects(json) {
     for (p in json) {
-        var project = json[p];
-        // fix attic and incubator project names if necessary
-        if (project.pmc == "attic") {
-            project.name += " (in the Attic)";
-        } else if ((project.pmc == "incubator") && !project.name.match(/incubating/i))
{
-            project.name += " (Incubating)";
-        }
-        projects[p] = project;
+        projects[p] = fixProjectName(json[p]);
     }
 }
 
 function weaveInRetiredCommittees(json) {
     weaveById(json, retiredCommittees);
+    var p;
+    var projectsPmcs = {};
+    for (p in projects) {
+        projectsPmcs[projects[p].pmc] = p;
+    }
+    var c;
+    for (c in committees) {
+        c = committees[c];
+        if (!projectsPmcs[c.id] && c.id != 'attic') {
+            // no DOAP file written by the PMC: creating default content
+            projects[c.id] = {
+                'name': c.name,
+                'homepage': c.homepage,
+                'pmc': c.id
+            }
+        }
+    }
 }
 
 function setCommittees(json, state) {
     weaveById(json, committees);
-    for (p in json) {
-        p = json[p];
+    var c;
+    for (c in json) {
+        c = json[c];
         // committeesByName = { name -> committee }
-        committeesByName[p.name] = p;
+        committeesByName[c.name] = c;
     }
     if (state) {
         state();



Mime
View raw message