[dw-free] Icons page: Add Manage Icons link
[commit: http://hg.dwscoalition.org/dw-free/rev/65c7cc3d2d6b]
http://bugs.dwscoalition.org/show_bug.cgi?id=4162
Add link to manage icons on journal-styled /icons page, if you can manage
icons here.
Patch by
ninetydegrees.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=4162
Add link to manage icons on journal-styled /icons page, if you can manage
icons here.
Patch by
Files modified:
- bin/upgrading/s2layers/core2.s2
- bin/upgrading/s2layers/siteviews/layout.s2
--------------------------------------------------------------------------------
diff -r 08386fb33eb6 -r 65c7cc3d2d6b bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2 Tue Jan 10 17:27:15 2012 +0800
+++ b/bin/upgrading/s2layers/core2.s2 Tue Jan 10 17:54:18 2012 +0800
@@ -289,6 +289,7 @@
function base_url () : string "Returns URL of user's journal.";
function linklist_manage_url () : string "Returns URL to user's tag management page.";
function tag_manage_url () : string "Returns URL to user's tag management page.";
+ function icon_manage_url () : string "Returns URL to user's icon management page.";
function print_interaction_links() "Print the interaction links for this user/journal.";
function as_string() : string;
function print ();
@@ -685,6 +686,8 @@
var readonly string{} sort_urls "An associative array of link for various sort orders.";
var readonly string[] sort_keyseq "A list of sort orders, indicated by key.";
+ function print_icon_manage_link
+ "Prints out a link to the icon management page, if the viewer can manage icons.";
}
class TagsPage extends Page
@@ -2579,6 +2582,11 @@
example = "Keyword Order";
}
+property string text_icon_manage {
+ des = "Text to use to link to this journal's icon management page.";
+ example = "Manage Icons";
+}
+
set text_icons_page_header = "Current Icons";
set text_icons_page_empty_header = "No Icons";
set text_icons_keywords = "Keywords:";
@@ -2589,6 +2597,7 @@
set text_icons_inactive = "Inactive";
set text_icons_sort_upload = "Upload Order";
set text_icons_sort_keyword = "Keyword Order";
+set text_icon_manage = "Manage Icons";
##===============================
## Text - tags
@@ -3354,6 +3363,12 @@
return "$*SITEROOT/manage/tags.bml?authas=$.username";
}
+function UserLite::icon_manage_url() [fixed] : string
+"Returns a link to the user's icon management page. Overriding this function is NOT RECOMMENDED. Overriding this function could prevent sitewide improvements to styles, accessibility, or other functionality from operating in your layout."
+{
+ return "$*SITEROOT/editicons?authas=$.username";
+}
+
function UserLite::as_string() [fixed] : string
"Use UserLite::print instead in most cases. Returns a DW user tag for the user. Overriding this function is NOT RECOMMENDED. Overriding this function could prevent sitewide improvements to styles, accessibility, or other functionality from operating in your layout."
{
@@ -3781,6 +3796,11 @@
print viewer_can_manage_tags() ? "<div class=\"manage-link manage-tags-link\"><a href=\"" + $p.journal->tag_manage_url() + "\">$*text_tags_manage</a></div>" : "";
}
+function IconsPage::print_icon_manage_link() "Prints out a link to the icon management page, if the viewer can manage icons."
+{
+ print ($.can_manage) ? "<div class=\"manage-link manage-icons-link\"><a href=\"" + $.journal->icon_manage_url() + "\">$*text_icon_manage</a></div>\n" : "";
+}
+
function print_list_tags(TagDetail[] tagslist, string{} opts) "Prints out a list of tags. Takes as arguments the taglist and a hash with optional arguments 'list-class' and 'item-class'. 'print_uses' option can be 'number', 'text' or 'title' to determine whether to display the uses as a number, as full text, or in the link title. It defaults to full text"
{
var string list_class = $opts{"list-class"} ? """class="$opts{"list-class"}" """ : "";
@@ -6014,8 +6034,12 @@
### IconsPage functions
function IconsPage::print_body {
- print safe "<div class='icons-container'><h2>$*text_icons_page_header</h2>\n<div class='inner'>\n";
- """<div class="sorting-options">\n<ul>""";
+ """<div class='icons-container'>\n<div class="inner">\n""";
+ """<div class="header">\n<div class="inner">\n""";
+ print safe "<h2>$*text_icons_page_header</h2>";
+ "</div>\n</div>\n";
+ """<div class="contents">\n<div class="inner">\n""";
+ """<div class="sorting-options">\n<ul>\n""";
var int sort_ct = 0;
foreach var string k ($.sort_keyseq) {
var string text = lang_icon_sortorder_title($k);
@@ -6025,15 +6049,19 @@
print safe """<li class='$k'><a href='$.sort_urls{$k}'>$text</a>""";
}
if ( (++$sort_ct) < size $.sort_keyseq) { print $*text_default_separator; }
- """</li>""";
- }
- """</ul></div>\n""";
- $.pages->print();
+ "</li>\n";
+ }
+ "</ul>\n</div>\n";
+ $.pages->print({ "class" => "icon-pages toppages" });
foreach var Icon i ($.icons) {
$i->print();
}
- $.pages->print();
- print safe "</div></div>";
+ $.pages->print({ "class" => "icon-pages bottompages" });
+ "</div>\n</div>\n";
+ """<div class="footer">\n<div class="inner">\n""";
+ $this->print_icon_manage_link();
+ "</div>\n</div>\n";
+ "</div>\n</div>\n";
}
function Icon::print {
diff -r 08386fb33eb6 -r 65c7cc3d2d6b bin/upgrading/s2layers/siteviews/layout.s2
--- a/bin/upgrading/s2layers/siteviews/layout.s2 Tue Jan 10 17:27:15 2012 +0800
+++ b/bin/upgrading/s2layers/siteviews/layout.s2 Tue Jan 10 17:54:18 2012 +0800
@@ -61,7 +61,7 @@
if ( size($.icons) == 0 ) {
"""<h1>$*text_icons_page_empty_header</h1><p>""";
if ( $.can_manage ) {
- """You don't have any icons uploaded. <a href="$*SITEROOT/editpics">Upload an icon here</a>.""";
+ "You don't have any icons uploaded. <a href=\"" + $.journal->icon_manage_url() + "\">Upload an icon here</a>.";
} else {
"""$.journal hasn't uploaded any icons. You can <a href="$*SITEROOT/manage/subscriptions/user?journal=$.journal.username">be notified</a> when $.journal uploads an icon, if you want.""";
}
@@ -71,7 +71,7 @@
print $.journal;
print ". ";
if ( $.can_manage ) {
- """Would you like to <a href="$*SITEROOT/editpics">upload a new icon or edit your icon keywords, comments, and descriptions</a>?""";
+ "Would you like to <a href=\"" + $.journal->icon_manage_url() + "\">upload a new icon or edit your icon keywords, comments, and descriptions</a>?";
} else {
"""We can <a href="$*SITEROOT/manage/tracking/user?journal=$.journal.username">notify</a> you when this account uploads a new one.""";
}
--------------------------------------------------------------------------------
