From 58d5624e401f1c369cbbf913008775bc5a165570 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 22 Jun 2009 21:51:22 -0700 Subject: This commit moves a little further along the path: 1) moves the print button from the quick pane to thumb_bottom 2) Creates an entry into the proxy table --- modules/digibug/js/digibug.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 modules/digibug/js/digibug.js (limited to 'modules/digibug/js/digibug.js') diff --git a/modules/digibug/js/digibug.js b/modules/digibug/js/digibug.js new file mode 100644 index 00000000..f30678c0 --- /dev/null +++ b/modules/digibug/js/digibug.js @@ -0,0 +1,24 @@ +$(document).ready(function() { + $(".gDigibugPrintButton a").click(function(e) { + e.preventDefault(); + queue_print(e); + }); +}); + +function queue_print(e) { + var parent = e.currentTarget.parentNode; + $(parent).addClass("gLoadingLarge"); + $.ajax({ + type: "GET", + url: e.currentTarget.href, + dataType: "json", + success: function(data) { + $(parent).removeClass("gLoadingLarge"); + if (data.location) { + window.location = data.location; + } else if (data.reload) { + window.location.reload(); + } + } + }); +}; -- cgit v1.2.3 From 231ad4f32950f42c76c16ab453246bedea8abf2c Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 23 Jun 2009 22:13:28 -0700 Subject: This implements the Digibug printing. When a a print request is made the digibug shopping cart is opened in a new window. When the cart is emptied, the window is closed. Users can close the window by pressing the continue shopping button --- modules/digibug/controllers/digibug.php | 12 ++++--- modules/digibug/helpers/digibug_installer.php | 2 +- modules/digibug/helpers/digibug_theme.php | 1 - modules/digibug/js/digibug.js | 52 +++++++++++++++++++-------- modules/digibug/views/digibug_album.html.php | 2 +- modules/digibug/views/digibug_form.html.php | 16 +++++++++ 6 files changed, 62 insertions(+), 23 deletions(-) create mode 100644 modules/digibug/views/digibug_form.html.php (limited to 'modules/digibug/js/digibug.js') diff --git a/modules/digibug/controllers/digibug.php b/modules/digibug/controllers/digibug.php index b0807aa5..609da875 100644 --- a/modules/digibug/controllers/digibug.php +++ b/modules/digibug/controllers/digibug.php @@ -36,12 +36,13 @@ class Digibug_Controller extends Controller { $company_id = module::get_var("digibug", "company_id"); $event_id = module::get_var("digibug", "event_id"); } - $digibug_parms = array( + $v = new View("digibug_form.html"); + $v->order_parms = array( "digibug_api_version" => "100", "company_id" => $company_id, "event_id" => $event_id, "cmd" => "adding", - "return_url" => url::abs_site($this->input->get("return")), + "return_url" => url::abs_site("digibug/close_window"), "num_images" => "1", "image_1" => $url, "thumb_1" => "$url/thumb", @@ -51,9 +52,7 @@ class Digibug_Controller extends Controller { "thumb_width_1" => $item->thumb_width, "title" => $item->title); - message::success( - t("Photo '%title' was submitted for printing.", array("title" => $item->title))); - print json_encode(array("result" => "success", "reload" => 1)); + print $v; } public function print_proxy($id, $thumb=null) { @@ -90,4 +89,7 @@ class Digibug_Controller extends Controller { } } + public function close_window() { + print ""; + } } \ No newline at end of file diff --git a/modules/digibug/helpers/digibug_installer.php b/modules/digibug/helpers/digibug_installer.php index 73645eb7..0476e2cc 100644 --- a/modules/digibug/helpers/digibug_installer.php +++ b/modules/digibug/helpers/digibug_installer.php @@ -24,7 +24,7 @@ class digibug_installer { Database::instance() ->query("CREATE TABLE {proxies} ( `id` int(9) NOT NULL auto_increment, - `uuid` char(32) NOT NULL, + `uuid` char(36) NOT NULL, `item_id` int(9), PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); diff --git a/modules/digibug/helpers/digibug_theme.php b/modules/digibug/helpers/digibug_theme.php index 0fe2ce2e..e52fcc7f 100644 --- a/modules/digibug/helpers/digibug_theme.php +++ b/modules/digibug/helpers/digibug_theme.php @@ -34,7 +34,6 @@ class digibug_theme_Core { if ($theme->page_type() == "album" && $child->type == "photo") { $v = new View("digibug_album.html"); $v->id = $child->id; - $v->return = "album/{$child->parent()->id}"; $v->title = t("Print photo with Digibug"); return $v->render(); } diff --git a/modules/digibug/js/digibug.js b/modules/digibug/js/digibug.js index f30678c0..e9e8933e 100644 --- a/modules/digibug/js/digibug.js +++ b/modules/digibug/js/digibug.js @@ -5,20 +5,42 @@ $(document).ready(function() { }); }); +function popUp(url, options) { + options = $.extend({ + /* default options */ + width: 400, + height: 400, + target: 'dbPopWin', + scrollbars: 'yes', + resizable: 'no', + menuBar: 'no', + addressBar: 'yes'}, options); + + /* center the window by default. */ + if (!options.winY) { + options.winY = screen.height / 2 - options.height / 2; + }; + if (!options.winX) { + options.winX = screen.width / 2 - options.width / 2; + }; + + open( + url, + options['target'], + 'width= ' + options.width + + ',height=' + options.height + + ',top=' + options.winY + + ',left=' + options.winX + + ',scrollbars=' + options.scrollbars + + ',resizable=' + options.resizable + + ',menubar=' + options.menuBar + + ',location=' + options.addressBar + ); + + return false; + +} + function queue_print(e) { - var parent = e.currentTarget.parentNode; - $(parent).addClass("gLoadingLarge"); - $.ajax({ - type: "GET", - url: e.currentTarget.href, - dataType: "json", - success: function(data) { - $(parent).removeClass("gLoadingLarge"); - if (data.location) { - window.location = data.location; - } else if (data.reload) { - window.location.reload(); - } - } - }); + return popUp(e.currentTarget.href, { width: 800, height: 600 } ); }; diff --git a/modules/digibug/views/digibug_album.html.php b/modules/digibug/views/digibug_album.html.php index 0f1537e9..c3337324 100644 --- a/modules/digibug/views/digibug_album.html.php +++ b/modules/digibug/views/digibug_album.html.php @@ -1,7 +1,7 @@
" + href="" title=""> diff --git a/modules/digibug/views/digibug_form.html.php b/modules/digibug/views/digibug_form.html.php new file mode 100644 index 00000000..c2cd889e --- /dev/null +++ b/modules/digibug/views/digibug_form.html.php @@ -0,0 +1,16 @@ + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3