summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/gallery.dialog.js35
1 files changed, 24 insertions, 11 deletions
diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js
index b325fa25..ce48d995 100644
--- a/lib/gallery.dialog.js
+++ b/lib/gallery.dialog.js
@@ -5,7 +5,7 @@
function handleDialogEvent(event) {
var target = event.currentTarget;
if (!target) {
- target = event.srcElement; // IE7
+ target = event.srcElement;
}
openDialog(target);
event.preventDefault();
@@ -24,34 +24,47 @@ function openDialog(element, on_success) {
var sHref = $(element).attr("href");
var sTitle = $(element).attr("title");
var eDialog = '<div id="gDialog"></div>';
+ var dialogWidth;
$("body").append(eDialog);
+
$("#gDialog").dialog({
autoOpen: false,
autoResize: true,
- height: "auto",
- width: "auto",
modal: true,
resizable: false,
close: function (event, ui) {
$("#gDialog").dialog("destroy").remove();
}
});
+
showLoading("#gDialog");
+
$.get(sHref, function(data) {
showLoading("#gDialog");
$("#gDialog").html(data);
- var parent = $("#gDialog").parent().parent();
+ var dialogHeight = $("#gDialog").height();
+ var cssWidth = new String($("#gDialog form").css("width"));
+ var childWidth = cssWidth.replace(/[^0-9]/g,"");
+ if ($("#gDialog iframe").length) {
+ dialogWidth = $(window).width() - 100;
+ // Set the iframe width and height
+ $("#gDialog iframe").width("100%");
+ $("#gDialog iframe").height($(window).height() - 100);
+ } else if (childWidth == "" || childWidth > 300) {
+ dialogWidth = 500;
+ }
+ $("#gDialog").dialog('option', 'width', dialogWidth);
$("#gDialog").dialog("open");
- if ($("#gDialog h1").length) {
- sTitle = $("#gDialog h1:eq(0)").html();
+ // Remove titlebar for progress dialogs or set title
+ if ($("#gDialog #gProgress").length) {
+ $(".ui-dialog-titlebar").remove();
+ } else if ($("#gDialog h1").length) {
+ $("#gDialog").dialog('option', 'title', $("#gDialog h1:eq(0)").html());
} else if ($("#gDialog fieldset legend").length) {
- sTitle = $("#gDialog fieldset legend:eq(0)").html();
- }
- $("#ui-dialog-title-gDialog").html(sTitle);
- if (parent.width() < 400) {
- parent.css("width", 200);
+ $("#gDialog").dialog('option', 'title', $("#gDialog fieldset legend:eq(0)").html());
}
+
ajaxify_dialog = function() {
$("#gDialog form").ajaxForm({
dataType: "json",