summaryrefslogtreecommitdiff
path: root/modules/localprint
diff options
context:
space:
mode:
Diffstat (limited to 'modules/localprint')
-rw-r--r--modules/localprint/controllers/admin_localprint.php26
-rw-r--r--modules/localprint/css/localprint_menu.css16
-rw-r--r--modules/localprint/helpers/localprint_event.php39
-rw-r--r--modules/localprint/helpers/localprint_installer.php35
-rw-r--r--modules/localprint/helpers/localprint_theme.php27
-rw-r--r--modules/localprint/images/localprint_logo.pngbin0 -> 2449 bytes
-rw-r--r--modules/localprint/js/localprint.js8
-rw-r--r--modules/localprint/module.info3
-rw-r--r--modules/localprint/views/admin_localprint.html.php4
-rw-r--r--modules/localprint/views/localprint_code.html.php9
10 files changed, 167 insertions, 0 deletions
diff --git a/modules/localprint/controllers/admin_localprint.php b/modules/localprint/controllers/admin_localprint.php
new file mode 100644
index 0000000..ba792fe
--- /dev/null
+++ b/modules/localprint/controllers/admin_localprint.php
@@ -0,0 +1,26 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class Admin_Localprint_Controller extends Admin_Controller {
+ public function index() {
+ $v = new Admin_View("admin.html");
+ $v->content = new View("admin_localprint.html");
+ print $v;
+ }
+} \ No newline at end of file
diff --git a/modules/localprint/css/localprint_menu.css b/modules/localprint/css/localprint_menu.css
new file mode 100644
index 0000000..1048d09
--- /dev/null
+++ b/modules/localprint/css/localprint_menu.css
@@ -0,0 +1,16 @@
+#g-view-menu #g-localprint-link {
+ background-image: url('../images/localprint_logo.png');
+}
+@media screen {
+ .printimage {
+ display: none;
+ }
+}
+@media print {
+ body * {
+ display: none;
+ }
+ .printimage {
+ display: block;
+ }
+} \ No newline at end of file
diff --git a/modules/localprint/helpers/localprint_event.php b/modules/localprint/helpers/localprint_event.php
new file mode 100644
index 0000000..5fd9bf2
--- /dev/null
+++ b/modules/localprint/helpers/localprint_event.php
@@ -0,0 +1,39 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class localprint_event_Core {
+ static function admin_menu($menu, $theme) {
+ $menu->get("settings_menu")
+ ->append(Menu::factory("link")
+ ->id("localprint_menu")
+ ->label(t("Local print"))
+ ->url(url::site("admin/localprint")));
+ }
+
+ static function photo_menu($menu, $theme) {
+ if (access::can("view_full", $theme->item)) {
+ $item = $theme->item();
+ $menu->append(Menu::factory("link")
+ ->id("localprint")
+ ->label(t("Print with local printer"))
+ ->url("#")
+ ->css_id("g-localprint-link"));
+ }
+ }
+}
diff --git a/modules/localprint/helpers/localprint_installer.php b/modules/localprint/helpers/localprint_installer.php
new file mode 100644
index 0000000..7d45603
--- /dev/null
+++ b/modules/localprint/helpers/localprint_installer.php
@@ -0,0 +1,35 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class localprint_installer {
+ static function install() {
+ module::set_var("localprint", "username", "");
+ module::set_version("localprint", 1);
+ }
+
+ static function upgrade($version) {
+ if ($version == 1) {
+ module::set_version("localprint", $version = 1);
+ }
+ }
+
+ static function uninstall() {
+ module::delete("localprint");
+ }
+}
diff --git a/modules/localprint/helpers/localprint_theme.php b/modules/localprint/helpers/localprint_theme.php
new file mode 100644
index 0000000..d2c29d2
--- /dev/null
+++ b/modules/localprint/helpers/localprint_theme.php
@@ -0,0 +1,27 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class localprint_theme_Core {
+ static function head($theme) {
+ $theme->css("localprint_menu.css");
+ }
+ static function photo_bottom($theme) {
+ return new View("localprint_code.html");
+ }
+}
diff --git a/modules/localprint/images/localprint_logo.png b/modules/localprint/images/localprint_logo.png
new file mode 100644
index 0000000..3022b09
--- /dev/null
+++ b/modules/localprint/images/localprint_logo.png
Binary files differ
diff --git a/modules/localprint/js/localprint.js b/modules/localprint/js/localprint.js
new file mode 100644
index 0000000..6f4ab22
--- /dev/null
+++ b/modules/localprint/js/localprint.js
@@ -0,0 +1,8 @@
+$(document).ready(function(){
+ alert('One');
+ $("#g-localprint-link").click(function() {
+ alert('The two of them');
+ $("body").append("<img src='<?= $item->file_url(true) ?>' class='printimage' >");
+ window.print();
+ });
+}); \ No newline at end of file
diff --git a/modules/localprint/module.info b/modules/localprint/module.info
new file mode 100644
index 0000000..558e3ba
--- /dev/null
+++ b/modules/localprint/module.info
@@ -0,0 +1,3 @@
+name = "Local print"
+description = "Adds a print button for users to print to a local printer."
+version = 1
diff --git a/modules/localprint/views/admin_localprint.html.php b/modules/localprint/views/admin_localprint.html.php
new file mode 100644
index 0000000..81bff35
--- /dev/null
+++ b/modules/localprint/views/admin_localprint.html.php
@@ -0,0 +1,4 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div class="g-block">
+ some stuff for the future
+</div>
diff --git a/modules/localprint/views/localprint_code.html.php b/modules/localprint/views/localprint_code.html.php
new file mode 100644
index 0000000..5e2541d
--- /dev/null
+++ b/modules/localprint/views/localprint_code.html.php
@@ -0,0 +1,9 @@
+<script language="javascript" type="text/javascript">
+$(document).ready(function(){
+ $("#g-localprint-link").click(function() {
+ $("body").append("<img src='<?= $item->file_url(true) ?>' class='printimage' >");
+ alert("Verify print settings.");
+ window.print();
+ });
+});
+</script> \ No newline at end of file