From cd5c99668bf578561d978c2549330a338b775199 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 5 Aug 2009 22:32:41 -0700 Subject: Don't show the ajaxy login link in the top right corner if we're on the login page itself. --- modules/user/helpers/user_theme.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/user/helpers/user_theme.php b/modules/user/helpers/user_theme.php index c5351f8e..4218ff22 100644 --- a/modules/user/helpers/user_theme.php +++ b/modules/user/helpers/user_theme.php @@ -19,9 +19,11 @@ */ class user_theme_Core { static function header_top($theme) { - $view = new View("login.html"); - $view->user = user::active(); - return $view->render(); + if ($theme->page_type != "login") { + $view = new View("login.html"); + $view->user = user::active(); + return $view->render(); + } } static function admin_head($theme) { -- cgit v1.2.3 From d7c7a06efe0171f65c120a8cf8fe7b41382d36c9 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 6 Aug 2009 09:46:39 -0700 Subject: Remove the complicated calculation to determine the height of the micro thumb grid, by setting all the parent elements to 100% in the css and then subtract the height of the button bar --- modules/organize/css/organize.css | 11 +++++++++- modules/organize/js/organize.js | 43 ++++++++++++++++----------------------- 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'modules') diff --git a/modules/organize/css/organize.css b/modules/organize/css/organize.css index 0a23a6bf..56ecc309 100644 --- a/modules/organize/css/organize.css +++ b/modules/organize/css/organize.css @@ -7,6 +7,11 @@ #gOrganize { overflow: hidden; + height: 100%; +} + +#gOrganize #bd { + height: 100%; } #gOrganize .yui-u { @@ -22,16 +27,20 @@ width: 75%; } +#gOrganizeDetail { + height: 100%; +} + #gMessage .gInfo { font-weight: bold; padding-left: 2em; } - /******************************************************************* * Album Tree styling */ #gOrganizeTreeContainer { + height: 100%; overflow: auto; margin: 0 !important; padding: 0 !important; diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 89549954..6a65bfa2 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -1,54 +1,45 @@ (function($) { - $.fn.organize = function(options) { + $.fn.organize = function() { var size = $.getViewportSize(); var height = size.height() - 100; // Leave 50 pixels on the top and bottom of the dialog var width = size.width() - 100; // Leave 50 pixels on the left and right of the dialog - var opts = $.extend({}, $.fn.organize.defaults, {width: width, height: height}, options); return this.each(function() { $(this).click(function(event) { var href = event.target.href; - var size = $.getViewportSize(); $("body").append('
'); - $("#gOrganizeDialog").dialog(opts); + $("#gOrganizeDialog").dialog({ + autoOpen: false, + modal: true, + resizable: false, + width: width, + height: height, + position: "center", + close: function () { + $("#gOrganizeDialog").trigger("organize_close"); + $("#gOrganizeDialog").dialog("destroy").remove(); + }, + zIndex: 75 + }); $.get(href, _init); return false; }); }); }; - $.fn.organize.defaults = { - autoOpen: false, - modal: true, - resizable: false, - minWidth: 600, - minHeight: 500, - position: "center", - close: function () { - $("#gOrganizeDialog").trigger("organize_close"); - $("#gOrganizeDialog").dialog("destroy").remove(); - }, - zIndex: 75 - }; - /** * Dynamically initialize the organize dialog when it is displayed */ function _init(data) { - // Deal with ui.jquery bug: http://dev.jqueryui.com/ticket/4475 + // Deal with ui.jquery bug: http://dev.jqueryui.com/ticket/4475 (target 1.8?) $(".sf-menu li.sfHover ul").css("z-index", 70); $("#gOrganizeDialog").html(data); $("#gOrganizeDialog").dialog("open"); - var heightMicroThumbPanel = $("#gOrganizeDialog").innerHeight(); - heightMicroThumbPanel -= 2 * parseFloat($("#gOrganizeDialog").css("padding-bottom")); - heightMicroThumbPanel = Math.floor(heightMicroThumbPanel - 10 - $("#gMessage").outerHeight()); - $("#gOrganizeTreeContainer").height(heightMicroThumbPanel); - - heightMicroThumbPanel -= $("#gOrganizeEditDrawerHandle").outerHeight(); - $("#gMicroThumbPanel").height(heightMicroThumbPanel); + var height = $("#gOrganizeDetail").innerHeight(); + $("#gMicroThumbPanel").height(height - $("#gOrganizeEditDrawerHandle").outerHeight()); if ($("#gOrganizeDialog h1").length) { $("#gOrganizeDialog").dialog('option', 'title', $("#gOrganizeDialog h1:eq(0)").html()); -- cgit v1.2.3 From 7ed15ea481565b1364573a814c0529adaf9f2eb7 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 6 Aug 2009 10:03:38 -0700 Subject: Remove 6 more lines by removing the generalization of the close dialog processing --- modules/organize/js/organize.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'modules') diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 6a65bfa2..3e58f3f3 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -17,9 +17,9 @@ height: height, position: "center", close: function () { - $("#gOrganizeDialog").trigger("organize_close"); $("#gOrganizeDialog").dialog("destroy").remove(); - }, + document.location.reload(); + }, zIndex: 75 }); $.get(href, _init); @@ -47,20 +47,14 @@ $("#gOrganizeDialog").dialog('option', 'title', $("#gOrganizeDialog fieldset legend:eq(0)").html()); } - $("#gOrganizeDialog #gMicroThumbDone").click(_dialog_close); - $("#gOrganizeDialog").bind("organize_close", function(target) { - document.location.reload(); + $("#gOrganizeDialog #gMicroThumbDone").click(function(event) { + $("#gOrganizeDialog").dialog("close"); }); $(".gBranchText span").click(_collapse_or_expanded_tree); $(".gBranchText").click(_setContents); }; - function _dialog_close(event) { - event.preventDefault(); - $("#gOrganizeDialog").dialog("close"); - }; - /** * Open or close a branch. If the children is a div placeholder, replace with
    */ -- cgit v1.2.3 From 794a7a5abf38ed828329cb0023df938479e90901 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 6 Aug 2009 14:55:03 -0700 Subject: Leverage the gallery.dialog/js functionality in order to reduce duplicate code --- modules/organize/helpers/organize_event.php | 2 +- modules/organize/helpers/organize_theme.php | 7 +- modules/organize/js/organize.js | 131 +++++++++--------------- modules/organize/views/organize_dialog.html.php | 10 ++ 4 files changed, 61 insertions(+), 89 deletions(-) (limited to 'modules') diff --git a/modules/organize/helpers/organize_event.php b/modules/organize/helpers/organize_event.php index 99a28673..887d9c2d 100644 --- a/modules/organize/helpers/organize_event.php +++ b/modules/organize/helpers/organize_event.php @@ -23,7 +23,7 @@ class organize_event_Core { if ($item && access::can("edit", $item) && $item->is_album()) { $menu->get("options_menu") - ->append(Menu::factory("link") + ->append(Menu::factory("dialog") ->id("organize") ->label(t("Organize Album")) ->css_id("gOrganizeLink") diff --git a/modules/organize/helpers/organize_theme.php b/modules/organize/helpers/organize_theme.php index f01ab88b..0fd117c3 100644 --- a/modules/organize/helpers/organize_theme.php +++ b/modules/organize/helpers/organize_theme.php @@ -19,8 +19,9 @@ */ class organize_theme { static function head($theme) { - //$theme->script("organize_init.js"); - $theme->script("organize.js"); - $theme->css("organize.css"); + if (access::can("view", $theme->item()) && access::can("edit", $theme->item())) { + $theme->script("organize.js"); + $theme->css("organize.css"); + } } } diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 3e58f3f3..e4d4a9a2 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -1,91 +1,52 @@ (function($) { - $.fn.organize = function() { - var size = $.getViewportSize(); - var height = size.height() - 100; // Leave 50 pixels on the top and bottom of the dialog - var width = size.width() - 100; // Leave 50 pixels on the left and right of the dialog - return this.each(function() { - $(this).click(function(event) { - var href = event.target.href; - - $("body").append('
    '); - - $("#gOrganizeDialog").dialog({ - autoOpen: false, - modal: true, - resizable: false, - width: width, - height: height, - position: "center", - close: function () { - $("#gOrganizeDialog").dialog("destroy").remove(); - document.location.reload(); - }, - zIndex: 75 - }); - $.get(href, _init); - return false; + $.organize = { + /** + * Dynamically initialize the organize dialog when it is displayed + */ + init: function(data) { + // Deal with ui.jquery bug: http://dev.jqueryui.com/ticket/4475 (target 1.8?) + $(".sf-menu li.sfHover ul").css("z-index", 70); + + var height = $("#gOrganizeDetail").innerHeight(); + $("#gMicroThumbPanel").height(height - $("#gOrganizeEditDrawerHandle").outerHeight()); + + $("#gDialog #gMicroThumbDone").click(function(event) { + $("#gDialog").dialog("close"); + window.location.reload(); }); - }); - }; - - /** - * Dynamically initialize the organize dialog when it is displayed - */ - function _init(data) { - // Deal with ui.jquery bug: http://dev.jqueryui.com/ticket/4475 (target 1.8?) - $(".sf-menu li.sfHover ul").css("z-index", 70); - $("#gOrganizeDialog").html(data); - $("#gOrganizeDialog").dialog("open"); - - var height = $("#gOrganizeDetail").innerHeight(); - $("#gMicroThumbPanel").height(height - $("#gOrganizeEditDrawerHandle").outerHeight()); - - if ($("#gOrganizeDialog h1").length) { - $("#gOrganizeDialog").dialog('option', 'title', $("#gOrganizeDialog h1:eq(0)").html()); - } else if ($("#gOrganizeDialog fieldset legend").length) { - $("#gOrganizeDialog").dialog('option', 'title', $("#gOrganizeDialog fieldset legend:eq(0)").html()); + $(".gBranchText span").click($.organize.collapse_or_expand_tree); + $(".gBranchText").click($.organize.setContents); + }, + + /** + * Open or close a branch. If the children is a div placeholder, replace with
      + */ + collapse_or_expand_tree: function (event) { + event.stopPropagation(); + if ($(event.currentTarget).hasClass("ui-icon-minus")) { + $(event.currentTarget).removeClass("ui-icon-minus").addClass("ui-icon-plus"); + } else { + $(event.currentTarget).removeClass("ui-icon-plus").addClass("ui-icon-minus"); + } + $("#gOrganizeChildren-" + $(event.currentTarget).attr("ref")).toggle(); + }, + + /** + * When the text of a selection is clicked, then show that albums contents + */ + setContents: function(event) { + event.preventDefault(); + if ($(event.currentTarget).hasClass("gBranchSelected")) { + return; + } + var id = $(event.currentTarget).attr("ref"); + $(".gBranchSelected").removeClass("gBranchSelected"); + $("#gOrganizeBranch-" + id).addClass("gBranchSelected"); + var url = $("#gMicroThumbPanel").attr("ref").replace("__ITEM_ID__", id).replace("__OFFSET__", 0); + $.get(url, function(data) { + $("#gMicroThumbGrid").html(data); + }); } - - $("#gOrganizeDialog #gMicroThumbDone").click(function(event) { - $("#gOrganizeDialog").dialog("close"); - }); - - $(".gBranchText span").click(_collapse_or_expanded_tree); - $(".gBranchText").click(_setContents); }; - - /** - * Open or close a branch. If the children is a div placeholder, replace with
        - */ - function _collapse_or_expanded_tree(event) { - event.stopPropagation(); - if ($(event.currentTarget).hasClass("ui-icon-minus")) { - $(event.currentTarget).removeClass("ui-icon-minus").addClass("ui-icon-plus"); - } else { - $(event.currentTarget).removeClass("ui-icon-plus").addClass("ui-icon-minus"); - } - $("#gOrganizeChildren-" + $(event.currentTarget).attr("ref")).toggle(); - } - - /** - * When the text of a selection is clicked, then show that albums contents - */ - function _setContents(event) { - event.preventDefault(); - if ($(event.currentTarget).hasClass("gBranchSelected")) { - return; - } - var id = $(event.currentTarget).attr("ref"); - $(".gBranchSelected").removeClass("gBranchSelected"); - $("#gOrganizeBranch-" + id).addClass("gBranchSelected"); - var url = $("#gMicroThumbPanel").attr("ref").replace("__ITEM_ID__", id).replace("__OFFSET__", 0); - $.get(url, function(data) { - $("#gMicroThumbGrid").html(data); - }); - } })(jQuery); - -$("document").ready(function() { - $("#gOrganizeLink").organize(); -}); diff --git a/modules/organize/views/organize_dialog.html.php b/modules/organize/views/organize_dialog.html.php index 4f10297e..11ce0a37 100644 --- a/modules/organize/views/organize_dialog.html.php +++ b/modules/organize/views/organize_dialog.html.php @@ -38,3 +38,13 @@ + \ No newline at end of file -- cgit v1.2.3 From 6e4023a7207b721694403f38d6afb7a507468498 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 6 Aug 2009 16:16:11 -0700 Subject: Fix indentation. --- modules/organize/js/organize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index e4d4a9a2..4c45b007 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -12,7 +12,7 @@ $("#gDialog #gMicroThumbDone").click(function(event) { $("#gDialog").dialog("close"); - window.location.reload(); + window.location.reload(); }); $(".gBranchText span").click($.organize.collapse_or_expand_tree); -- cgit v1.2.3