cpack_repository/commit

ADDED: Date of last submission to cpack table

authorJan Wielemaker
Tue Jan 25 16:27:12 2011 +0100
committerJan Wielemaker
Tue Jan 25 16:27:12 2011 +0100
commit76bc4999c4ec2d7c9d8849f59244b4afe538f67f
tree6f828b740889ae8d1f1526492bc09de097327205
parenta188b853551658b16d708f14faff9acc51e7723d
Diff style: patch stat
diff --git a/applications/cpack_home.pl b/applications/cpack_home.pl
index 4655a6d..a5bdb62 100644
--- a/applications/cpack_home.pl
+++ b/applications/cpack_home.pl
@@ -42,7 +42,7 @@
 cpack_home(Request) :-
 	http_parameters(Request,
 			[ sort_by(By,
-				  [ oneof([status,name,title,type,author]),
+				  [ oneof([status,name,title,type,author,date]),
 				    default(name),
 				    description('Sort table by this key')
 				  ])
diff --git a/applications/cpack_submit.pl b/applications/cpack_submit.pl
index 026edae..4d265cb 100644
--- a/applications/cpack_submit.pl
+++ b/applications/cpack_submit.pl
@@ -166,7 +166,7 @@ cpack_my_packages(Request) :-
 list_packages(Request, Options) :-
 	http_parameters(Request,
 			[ sort_by(By,
-				  [ oneof([status,name,title,type,author]),
+				  [ oneof([status,name,title,type,author,date]),
 				    default(name),
 				    description('Sort table by this key')
 				  ])
diff --git a/components/cpack.pl b/components/cpack.pl
index 2524e42..503206e 100644
--- a/components/cpack.pl
+++ b/components/cpack.pl
@@ -75,8 +75,10 @@ cliopatria:list_resource(Pack) -->
 
 %%	package_table(Options)// is det.
 %
-%	Emit a table that describes Packages.   Options is currently not
-%	used.
+%	Emit a table that describes Packages.   Options supported:
+%
+%	    * sort_by(Column)
+%	    Sort table by given column.
 
 package_table(Options) -->
 	{ option(sort_by(By), Options, name),
@@ -89,7 +91,8 @@ package_table(Options) -->
 			  \sort_th(name,   By, 'Name'),
 			  \sort_th(title,  By, 'Title'),
 			  \sort_th(type,   By, 'Type'),
-			  \sort_th(author, By, 'Author')
+			  \sort_th(author, By, 'Author'),
+			  \sort_th(date,   By, 'Date')
 			])
 		   | \package_rows(Packages, 1, Options)
 		   ])).
@@ -117,7 +120,9 @@ package_row(Package, _Options) -->
 	       td(class(type),
 		  div(\cpack_prop(Package, rdf:type))),
 	       td(class(author),
-		  div(\cpack_prop(Package, cpack:author)))
+		  div(\cpack_prop(Package, cpack:author))),
+	       td(class(date),
+		  div(\cpack_prop(Package, cpack:submittedDate)))
 	     ]).
 
 
@@ -162,6 +167,11 @@ cpack_sort_key(author, Pack, Key) :-
 	    ;   Key = Author
 	    )
 	;   Key = ''
+	).
+cpack_sort_key(date, Pack, Key) :-
+	(   rdf_has(Pack, cpack:submittedDate, Key)
+	->  true
+	;   Key = ''
 	).
 
 
diff --git a/web/css/cpack.css b/web/css/cpack.css
index f92bb5e..7562840 100644
--- a/web/css/cpack.css
+++ b/web/css/cpack.css
@@ -20,6 +20,11 @@ div.cpack td.author div
   text-overflow: ellipsis;
 }
 
+div.cpack td.date div
+{ font-family: monospace;
+  font-size: 80%;
+}
+
 
 /* Package page */