[cc-commits] [SCM] GSoC 2010 Firefox Extension project (branch master) updated. 155b816be927b54d0cff8d37a4877129bf1c1066

git version control git at a7.creativecommons.org
Thu Jul 15 05:47:02 EDT 2010


The branch, master has been updated
       via  155b816be927b54d0cff8d37a4877129bf1c1066 (commit)
      from  fc90d3e98db026c7121c1db1c1378349ae4ca3be (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 155b816be927b54d0cff8d37a4877129bf1c1066
Author: Igor Lukanin <mail at igor.lukanin.name>
Date:   Thu Jul 15 15:46:54 2010 +0600

    The "Page Info" dialog update: the requirements of the license are displayed using CC API

-----------------------------------------------------------------------

Summary of changes (followed by patch):
 content/pageInfo.xul           |   46 +++++++++++++++++++++++++++-------------
 doc/FUNCSPEC                   |    7 +++++-
 doc/WEBSITES                   |    1 -
 locale/en-US/locale.properties |   21 ++++++++++++++++++
 locale/ru-RU/locale.properties |   23 ++++++++++++++++++++
 module/ccffext.js              |   10 +++++++-
 skin/pageInfo.css              |    2 +-
 7 files changed, 91 insertions(+), 19 deletions(-)

diff --git a/content/pageInfo.xul b/content/pageInfo.xul
index d195a41..e41d056 100644
--- a/content/pageInfo.xul
+++ b/content/pageInfo.xul
@@ -74,6 +74,20 @@
 
 					items = [];
 
+					var convertStrings = function(strings,part)
+					{
+						var converted = [];
+
+						for (let i = 0; i < strings.length; ++i)
+						{
+							let name = strings[i].toLowerCase().replace(/[^a-z]/g,"");
+							converted.push(ccffext.l10n.get("object.license." + part + "." + name + ".label"));
+						}
+
+						var line = converted.join(", ");
+						return line.substring(0,1).toUpperCase() + line.substring(1);
+					}
+
 					// Add new items to the list
 					for (let i = 0; i < objects.length; ++i)
 					{
@@ -135,25 +149,27 @@
 
 						const licensePermTitle = document.createElement("label");
 						licensePermTitle.setAttribute("class","line-title");
-						licensePermTitle.setAttribute("value",ccffext.l10n.get("object.license.permissions.title.label"));
+						licensePermTitle.setAttribute("value",
+						        ccffext.l10n.get("object.license.permissions.title.label"));
 						licensePermLine.appendChild(licensePermTitle);
 
 						const licensePermValue = document.createElement("label");
-						licensePermValue.setAttribute("value",(function(permissions)
-						{
-							var strings = [];
-
-							for (let i = 0; i < permissions.length; ++i)
-							{
-								let name = permissions[i].toLowerCase().replace(/[^a-z]/g,"");
-//								ccffext.log(name);
-								strings.push(ccffext.l10n.get("object.license.permissions." + name + ".label"));
-							}
-
-							var line = strings.join(", ");
-							return line.substring(0,1).toUpperCase() + line.substring(1);
-						})(license.permissions));
+						licensePermValue.setAttribute("value",convertStrings(license.permissions,"permissions"));
 						licensePermLine.appendChild(licensePermValue);
+
+						const licenseReqLine = document.createElement("hbox");
+						licenseReqLine.setAttribute("class","line");
+						topLine.appendChild(licenseReqLine);
+
+						const licenseReqTitle = document.createElement("label");
+						licenseReqTitle.setAttribute("class","line-title");
+						licenseReqTitle.setAttribute("value",
+						        ccffext.l10n.get("object.license.requirements.title.label"));
+						licenseReqLine.appendChild(licenseReqTitle);
+
+						const licenseReqValue = document.createElement("label");
+						licenseReqValue.setAttribute("value",convertStrings(license.requirements,"requirements"));
+						licenseReqLine.appendChild(licenseReqValue);
 					}
 
 					// Eventually switch to the tab
diff --git a/doc/FUNCSPEC b/doc/FUNCSPEC
index 145838e..6b3d334 100644
--- a/doc/FUNCSPEC
+++ b/doc/FUNCSPEC
@@ -1,6 +1,5 @@
 Functional and UI specification
 -------------------------------
-Last update: 2010-07-11, YEKST.
 
 Any software is made to provide ways to solve a specific problem of its end user. The "end user" is not straightly meant to be a person, but in most cases she is. So, in case of application software, the specification of functionality may be done by listing the ways the software may solve its user`s problems. In case of a browser extension, these ways are cnnected to the UI the user sees. So, lets summarize what UI elements the extension should provide:
 
@@ -45,6 +44,12 @@ The extension may use information defined by:
         + DerivativeWorks
         + HighIncomeNationUse
         + Sharing
+		+ Notice
+		+ Attribution
+		+ ShareAlike
+		+ SourceCode
+		+ Copyleft
+		+ LesserCopyleft
 	- http://purl.org/dc/elements/1.1/#
 	- http://xmlns.com/foaf/0.1/#
 
diff --git a/doc/WEBSITES b/doc/WEBSITES
index 0859dbb..aa6a5d2 100644
--- a/doc/WEBSITES
+++ b/doc/WEBSITES
@@ -1,6 +1,5 @@
 Reference websites for testing purposes
 ---------------------------------------
-Last update: 2010-07-11, YEKST.
 
 Currently the following sites are used:
 
diff --git a/locale/en-US/locale.properties b/locale/en-US/locale.properties
index e87c5b6..1f707d1 100644
--- a/locale/en-US/locale.properties
+++ b/locale/en-US/locale.properties
@@ -48,6 +48,27 @@ object.license.permissions.highincomenationuse.label=high income nation use
 # The Sharing permission of the license for the object
 object.license.permissions.sharing.label=sharing
 
+# The requirements of the license for the object
+object.license.requirements.title.label=Requirements:
+
+# The Notice requirement of the license for the object
+object.license.requirements.notice.label=notice
+
+# The Attribution requirement of the license for the object
+object.license.requirements.attribution.label=attribution
+
+# The Share Alike requirement of the license for the object
+object.license.requirements.sharealike.label=share alike
+
+# The Source Code requirement of the license for the object
+object.license.requirements.sourcecode.label=source code
+
+# The Copyleft requirement of the license for the object
+object.license.requirements.copyleft.label=copyleft
+
+# The Lesser Copyleft requirement of the license for the object
+object.license.requirements.lessercopyleft.label=lesser copyleft
+
 
 # The location bar icon
 
diff --git a/locale/ru-RU/locale.properties b/locale/ru-RU/locale.properties
index ae19b70..ba87c3e 100644
--- a/locale/ru-RU/locale.properties
+++ b/locale/ru-RU/locale.properties
@@ -48,6 +48,29 @@ object.license.permissions.highincomenationuse.label=использование
 # The Sharing permission of the license for the object
 object.license.permissions.sharing.label=платные производные работы при бесплатном распространении
 
+# The requirements of the license for the object
+object.license.requirements.title.label=Требуется:
+
+# The Notice requirement of the license for the object
+object.license.requirements.notice.label=сохранение информации о лицензии
+
+# The Attribution requirement of the license for the object
+object.license.requirements.attribution.label=указание авторства
+
+# The Share Alike requirement of the license for the object
+object.license.requirements.sharealike.label=сохранение лицензии для производных работ
+
+# The Source Code requirement of the license for the object
+object.license.requirements.sourcecode.label=предоставление исходного кода
+
+# The Copyleft requirement of the license for the object
+# TODO
+object.license.requirements.copyleft.label=copyleft
+
+# The Lesser Copyleft requirement of the license for the object
+# TODO
+object.license.requirements.lessercopyleft.label=lesser copyleft
+
 
 # The location bar icon
 
diff --git a/module/ccffext.js b/module/ccffext.js
index ceeaf25..d2b1c64 100644
--- a/module/ccffext.js
+++ b/module/ccffext.js
@@ -275,7 +275,8 @@ var ccffext =
 			{
 				name : undefined,
 				uri : undefined,
-				permissions : []
+				permissions : [],
+				requirements : []
 			};
 
 			for (let i = 0, pairs = ccffext.objects.getPairs(document,object); i < pairs.length; ++i)
@@ -310,6 +311,13 @@ var ccffext =
 						license.permissions.push(perms[i].getAttribute("rdf:resource")
 								.replace("http://creativecommons.org/ns#",""));
 					}
+
+					let reqs = doc.getElementsByTagName("requires");
+					for (let i = 0; i < reqs.length / 2; ++i)
+					{
+						license.requirements.push(reqs[i].getAttribute("rdf:resource")
+								.replace("http://creativecommons.org/ns#",""));
+					}
 				}
 			}
 
diff --git a/skin/pageInfo.css b/skin/pageInfo.css
index 9091214..334a20f 100644
--- a/skin/pageInfo.css
+++ b/skin/pageInfo.css
@@ -58,7 +58,7 @@ vbox#ccffext-objects .item label.title
 */
 vbox#ccffext-objects .item .primary
 {
-	margin-top: 5px;
+	margin-top: 6px;
 }
 
 /*


hooks/post-receive
-- 
GSoC 2010 Firefox Extension project



More information about the cc-commits mailing list