From 3213970f719f7e9239dcdf2783d684902bc912fe Mon Sep 17 00:00:00 2001 From: rWatcher Date: Fri, 12 Jun 2009 15:58:54 -0400 Subject: [PATCH 01/30] Initial commit --- .../helpers/embedlinks_installer.php | 27 ++++++++ .../embedlinks/helpers/embedlinks_theme.php | 38 +++++++++++ modules/embedlinks/module.info | 3 + .../views/embedlinks_album_block.html.php | 18 ++++++ .../views/embedlinks_photo_block.html.php | 63 +++++++++++++++++++ 5 files changed, 149 insertions(+) create mode 100644 modules/embedlinks/helpers/embedlinks_installer.php create mode 100644 modules/embedlinks/helpers/embedlinks_theme.php create mode 100644 modules/embedlinks/module.info create mode 100644 modules/embedlinks/views/embedlinks_album_block.html.php create mode 100644 modules/embedlinks/views/embedlinks_photo_block.html.php diff --git a/modules/embedlinks/helpers/embedlinks_installer.php b/modules/embedlinks/helpers/embedlinks_installer.php new file mode 100644 index 00000000..f6a3d4ef --- /dev/null +++ b/modules/embedlinks/helpers/embedlinks_installer.php @@ -0,0 +1,27 @@ +item()->is_album()) { + $block = new Block(); + $block->css_id = "gMetadata"; + $block->title = t("Links"); + $block->content = new View("embedlinks_album_block.html"); + return $block; + } + } + static function photo_bottom($theme) { + $block = new Block(); + $block->css_id = "gMetadata"; + $block->title = t("Links"); + $block->content = new View("embedlinks_photo_block.html"); + return $block; + } + +} diff --git a/modules/embedlinks/module.info b/modules/embedlinks/module.info new file mode 100644 index 00000000..a1636ff9 --- /dev/null +++ b/modules/embedlinks/module.info @@ -0,0 +1,3 @@ +name = EmbedLinks +description = Display HTML code to embed links to albums/images into other web pages. +version = 1 diff --git a/modules/embedlinks/views/embedlinks_album_block.html.php b/modules/embedlinks/views/embedlinks_album_block.html.php new file mode 100644 index 00000000..e67c71c8 --- /dev/null +++ b/modules/embedlinks/views/embedlinks_album_block.html.php @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + +
diff --git a/modules/embedlinks/views/embedlinks_photo_block.html.php b/modules/embedlinks/views/embedlinks_photo_block.html.php new file mode 100644 index 00000000..be73a634 --- /dev/null +++ b/modules/embedlinks/views/embedlinks_photo_block.html.php @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
type}s/{$item->id}") ?>">Click Here" readonly>
type}s/{$item->id}") ?>">thumb_url(true) ?>">" readonly>
type}s/{$item->id}") ?>">resize_url(true) ?>">" readonly>


From 679b294c611a90c60ba3ccc38a2892de37db4bb0 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Wed, 17 Jun 2009 18:59:52 -0400 Subject: [PATCH 02/30] Initial Commit. --- modules/nobots/helpers/nobots_installer.php | 27 +++++++++++++++++++++ modules/nobots/helpers/nobots_theme.php | 25 +++++++++++++++++++ modules/nobots/module.info | 3 +++ modules/nobots/views/nobots_block.html.php | 7 ++++++ 4 files changed, 62 insertions(+) create mode 100644 modules/nobots/helpers/nobots_installer.php create mode 100644 modules/nobots/helpers/nobots_theme.php create mode 100644 modules/nobots/module.info create mode 100644 modules/nobots/views/nobots_block.html.php diff --git a/modules/nobots/helpers/nobots_installer.php b/modules/nobots/helpers/nobots_installer.php new file mode 100644 index 00000000..a01d6f8f --- /dev/null +++ b/modules/nobots/helpers/nobots_installer.php @@ -0,0 +1,27 @@ + + + + + + + From 8cf6d6a4e99f01ae9361151cd055f381b8c18693 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Sat, 20 Jun 2009 16:52:47 -0400 Subject: [PATCH 03/30] Initial Commit. --- .../-- theme files/Install.txt | 6 ++ .../ico-view-downloadfullsize.png | Bin 0 -> 3665 bytes .../controllers/admin_downloadfullsize.php | 80 ++++++++++++++++++ .../controllers/downloadfullsize.php | 28 ++++++ .../helpers/downloadfullsize_installer.php | 32 +++++++ .../helpers/downloadfullsize_menu.php | 42 +++++++++ .../helpers/downloadfullsize_theme.php | 36 ++++++++ modules/downloadfullsize/module.info | 3 + .../views/admin_downloadfullsize.html.php | 5 ++ .../views/downloadfullsize_block.html.php | 7 ++ 10 files changed, 239 insertions(+) create mode 100644 modules/downloadfullsize/-- theme files/Install.txt create mode 100644 modules/downloadfullsize/-- theme files/ico-view-downloadfullsize.png create mode 100644 modules/downloadfullsize/controllers/admin_downloadfullsize.php create mode 100644 modules/downloadfullsize/controllers/downloadfullsize.php create mode 100644 modules/downloadfullsize/helpers/downloadfullsize_installer.php create mode 100644 modules/downloadfullsize/helpers/downloadfullsize_menu.php create mode 100644 modules/downloadfullsize/helpers/downloadfullsize_theme.php create mode 100644 modules/downloadfullsize/module.info create mode 100644 modules/downloadfullsize/views/admin_downloadfullsize.html.php create mode 100644 modules/downloadfullsize/views/downloadfullsize_block.html.php diff --git a/modules/downloadfullsize/-- theme files/Install.txt b/modules/downloadfullsize/-- theme files/Install.txt new file mode 100644 index 00000000..b0b6ab7c --- /dev/null +++ b/modules/downloadfullsize/-- theme files/Install.txt @@ -0,0 +1,6 @@ +Copy "ico-view-downloadfullsize.png" into your "themes/CURRENTTHEME/images" folder. + +Edit the file "themes/CURRENTTHEME/css/screen.css" to include the following lines: +#gViewMenu #gDownloadFullsizeLink { + background-image: url('../images/ico-view-downloadfullsize.png'); +} diff --git a/modules/downloadfullsize/-- theme files/ico-view-downloadfullsize.png b/modules/downloadfullsize/-- theme files/ico-view-downloadfullsize.png new file mode 100644 index 0000000000000000000000000000000000000000..98b9f2b121c56117d2c6f713b461f174e29f368f GIT binary patch literal 3665 zcmV-X4zBTuP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z000AgNkl;AlhvA5{F$go(c+J%N=;C)6p>0FL>~lS^hHs` z2PueRD;0_$`lN^tc~JiXe^4n{kW#RsVznq3C0eCvlbBzdvYW~5J?HDgotd3YL(+O# zF89va`bYEZ%qYA}NlPT*X3j*9j8Z@>O071IAo}a{vGX zT;Z6(SUl;SNjQNKab%nN20B?52M@wi2qB0npbeoxhY^rKLM#PQ$sUa%!y7?Kh(MVG z1&GA~fD3N}0=-Mw2x^1~jf?~$0Hmrhm%R!q>q5&oMnVBZ5a$R-Bc-D35|y%yBZ5Z6 zrKcgrxJ+n~8Fq=mQ|F-8^?FU{nu+Ssn0qZ%jm)yF)oQKck}&3_9%e1pE9r8z^15CJ z<@LtkPt*RX7hb>gOKoPi?zs1#;C1L4P9*o5XxBDvfAV$8 zD2@{T=R;LS0uUrn_6!3_65*FASCmzBXdD8G%M6sZo!gSp>+7K{u4;_s_S97R$#|imI7~btrOH7v5_X*K@DCx3I8zZ>rjGe%I!7Ys}^4R0L*5GR!2i%vW)F zt^o*QfryBzmbQ-9X0v&1Bf6%)kL1!)vx*CI)`^r!c_if8Or1zPxOH%#(Kz?ZcUL`h z+d?}F9xX05RkasVg|gGR5|W_ke@P@a#qA>#e+)hSj7-n94!!Z(habGRYtN(GuDg+d z%d*XpDYk%vrkJK6T<)UoAQM)p7AzHZ|Y+_@l8SUwl44KZpM{k|eq7 j?t5O||H{zN&HoJmp2FNMfV+7L00000NkvXXu0mjf-MH~+ literal 0 HcmV?d00001 diff --git a/modules/downloadfullsize/controllers/admin_downloadfullsize.php b/modules/downloadfullsize/controllers/admin_downloadfullsize.php new file mode 100644 index 00000000..563fc7fc --- /dev/null +++ b/modules/downloadfullsize/controllers/admin_downloadfullsize.php @@ -0,0 +1,80 @@ +content = new View("admin_downloadfullsize.html"); + $view->content->downloadlinks_form = $this->_get_admin_form(); + print $view; + } + + public function saveprefs() { + // This probably does something important. + access::verify_csrf(); + + // Figure out which boxes where checked + $dlLinks_array = $_POST['DownloadLinkOptions']; + $tButton = false; + $fButton = false; + for ($i=0; $icontent = new View("admin_downloadfullsize.html"); + $view->content->downloadlinks_form = $this->_get_admin_form(); + print $view; + + } + + private function _get_admin_form() { + // Make a new Form. + $form = new Forge("admin/downloadfullsize/saveprefs", "", "post", + array("id" => "gDownloadFullsizeAdminForm")); + + // Make an array for the different types of download links. + $linkOptions["fButton"] = array("Show Floppy Disk Link", module::get_var("downloadfullsize", "fButton")); + $linkOptions["tButton"] = array("Show Text Download Text Link", module::get_var("downloadfullsize", "tButton")); + + // Setup a few checkboxes on the form. + $add_links = $form->group("DownloadLinks"); + $add_links->checklist("DownloadLinkOptions") + ->options($linkOptions); + + // Add a save button to the form. + $add_links->submit("SaveLinks")->value(t("Save")); + + // Return the newly generated form. + return $form; + } +} \ No newline at end of file diff --git a/modules/downloadfullsize/controllers/downloadfullsize.php b/modules/downloadfullsize/controllers/downloadfullsize.php new file mode 100644 index 00000000..bd7991fa --- /dev/null +++ b/modules/downloadfullsize/controllers/downloadfullsize.php @@ -0,0 +1,28 @@ +file_path()); + return ; + } +} diff --git a/modules/downloadfullsize/helpers/downloadfullsize_installer.php b/modules/downloadfullsize/helpers/downloadfullsize_installer.php new file mode 100644 index 00000000..47b7916a --- /dev/null +++ b/modules/downloadfullsize/helpers/downloadfullsize_installer.php @@ -0,0 +1,32 @@ +item)) { + if (module::get_var("downloadfullsize", "fButton")) { + $downloadLink = url::site("downloadfullsize/send/$theme->item"); + $menu + ->append(Menu::factory("link") + ->id("downloadfullsize") + ->label(t("Download Fullsize Image")) + ->url($downloadLink) + ->css_id("gDownloadFullsizeLink")); + } + } + } + static function admin($menu, $theme) { + $menu->get("settings_menu") + ->append(Menu::factory("link") + ->id("downloadfullsize") + ->label(t("Download Photo Links")) + ->url(url::site("admin/downloadfullsize"))); + } + +} diff --git a/modules/downloadfullsize/helpers/downloadfullsize_theme.php b/modules/downloadfullsize/helpers/downloadfullsize_theme.php new file mode 100644 index 00000000..450a57d0 --- /dev/null +++ b/modules/downloadfullsize/helpers/downloadfullsize_theme.php @@ -0,0 +1,36 @@ +item()->is_photo()) { + if (access::can("view_full", $theme->item)) { + if (module::get_var("downloadfullsize", "tButton")) { + $block = new Block(); + $block->css_id = "gDownloadFullsize"; + $block->title = t("Download"); + $block->content = new View("downloadfullsize_block.html"); + + $block->content->item = ORM::factory("item", 1); + + return $block; + } + } + } + } +} diff --git a/modules/downloadfullsize/module.info b/modules/downloadfullsize/module.info new file mode 100644 index 00000000..3f31f39a --- /dev/null +++ b/modules/downloadfullsize/module.info @@ -0,0 +1,3 @@ +name = DownloadFullsize +description = Displays a link to download the fullsize version of the current photo. +version = 1 diff --git a/modules/downloadfullsize/views/admin_downloadfullsize.html.php b/modules/downloadfullsize/views/admin_downloadfullsize.html.php new file mode 100644 index 00000000..d978054d --- /dev/null +++ b/modules/downloadfullsize/views/admin_downloadfullsize.html.php @@ -0,0 +1,5 @@ + +
+

+ +
diff --git a/modules/downloadfullsize/views/downloadfullsize_block.html.php b/modules/downloadfullsize/views/downloadfullsize_block.html.php new file mode 100644 index 00000000..9ce631eb --- /dev/null +++ b/modules/downloadfullsize/views/downloadfullsize_block.html.php @@ -0,0 +1,7 @@ + + + From 5cc0a4962d0f6df50768633c5ba11c0e07bd1be0 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Sun, 21 Jun 2009 00:03:54 -0400 Subject: [PATCH 04/30] Merge Fix. --- .../controllers/admin_downloadfullsize.php | 11 ---------- .../controllers/downloadfullsize.php | 8 ------- .../helpers/downloadfullsize_installer.php | 8 ------- .../helpers/downloadfullsize_menu.php | 3 --- .../helpers/downloadfullsize_theme.php | 22 ------------------- .../views/downloadfullsize_block.html.php | 5 ----- 6 files changed, 57 deletions(-) diff --git a/modules/downloadfullsize/controllers/admin_downloadfullsize.php b/modules/downloadfullsize/controllers/admin_downloadfullsize.php index 33f8074b..1a0e9a23 100644 --- a/modules/downloadfullsize/controllers/admin_downloadfullsize.php +++ b/modules/downloadfullsize/controllers/admin_downloadfullsize.php @@ -28,16 +28,6 @@ class Admin_DownloadFullsize_Controller extends Admin_Controller { } public function saveprefs() { -<<<<<<< HEAD:modules/downloadfullsize/controllers/admin_downloadfullsize.php - // This probably does something important. - access::verify_csrf(); - - // Figure out which boxes where checked - $dlLinks_array = $_POST['DownloadLinkOptions']; - $tButton = false; - $fButton = false; - for ($i=0; $i>>>>>> gallery3-contrib/master:modules/downloadfullsize/controllers/admin_downloadfullsize.php if ($dlLinks_array[$i] == "tButton") { $tButton = true; } diff --git a/modules/downloadfullsize/controllers/downloadfullsize.php b/modules/downloadfullsize/controllers/downloadfullsize.php index c39ce271..0158790a 100644 --- a/modules/downloadfullsize/controllers/downloadfullsize.php +++ b/modules/downloadfullsize/controllers/downloadfullsize.php @@ -18,18 +18,10 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class downloadfullsize_Controller extends Controller { -<<<<<<< HEAD:modules/downloadfullsize/controllers/downloadfullsize.php - -======= ->>>>>>> gallery3-contrib/master:modules/downloadfullsize/controllers/downloadfullsize.php public function send($id) { $item = ORM::factory("item", $id); access::required("view_full", $item); download::force($item->file_path()); -<<<<<<< HEAD:modules/downloadfullsize/controllers/downloadfullsize.php - return ; -======= ->>>>>>> gallery3-contrib/master:modules/downloadfullsize/controllers/downloadfullsize.php } } diff --git a/modules/downloadfullsize/helpers/downloadfullsize_installer.php b/modules/downloadfullsize/helpers/downloadfullsize_installer.php index e799b345..fe5d74b9 100644 --- a/modules/downloadfullsize/helpers/downloadfullsize_installer.php +++ b/modules/downloadfullsize/helpers/downloadfullsize_installer.php @@ -20,19 +20,11 @@ class downloadfullsize_installer { static function install() { $version = module::get_version("downloadfullsize"); if ($version == 0) { -<<<<<<< HEAD:modules/downloadfullsize/helpers/downloadfullsize_installer.php - /* @todo Put database creation here */ -======= ->>>>>>> gallery3-contrib/master:modules/downloadfullsize/helpers/downloadfullsize_installer.php module::set_version("downloadfullsize", 1); } } static function uninstall() { -<<<<<<< HEAD:modules/downloadfullsize/helpers/downloadfullsize_installer.php - /* @todo Put database table drops here */ -======= ->>>>>>> gallery3-contrib/master:modules/downloadfullsize/helpers/downloadfullsize_installer.php module::delete("downloadfullsize"); } } diff --git a/modules/downloadfullsize/helpers/downloadfullsize_menu.php b/modules/downloadfullsize/helpers/downloadfullsize_menu.php index fbeeb47c..d7095cc5 100644 --- a/modules/downloadfullsize/helpers/downloadfullsize_menu.php +++ b/modules/downloadfullsize/helpers/downloadfullsize_menu.php @@ -31,10 +31,7 @@ class downloadfullsize_menu_Core { } } } -<<<<<<< HEAD:modules/downloadfullsize/helpers/downloadfullsize_menu.php -======= ->>>>>>> gallery3-contrib/master:modules/downloadfullsize/helpers/downloadfullsize_menu.php static function admin($menu, $theme) { $menu->get("settings_menu") ->append(Menu::factory("link") diff --git a/modules/downloadfullsize/helpers/downloadfullsize_theme.php b/modules/downloadfullsize/helpers/downloadfullsize_theme.php index 530af96d..70e4bb00 100644 --- a/modules/downloadfullsize/helpers/downloadfullsize_theme.php +++ b/modules/downloadfullsize/helpers/downloadfullsize_theme.php @@ -1,9 +1,5 @@ -<<<<<<< HEAD:modules/downloadfullsize/helpers/downloadfullsize_theme.php ->>>>>> gallery3-contrib/master:modules/downloadfullsize/helpers/downloadfullsize_theme.php * Gallery - a web based photo album viewer and editor * Copyright (C) 2000-2009 Bharat Mediratta * @@ -23,23 +19,6 @@ */ class downloadfullsize_theme { static function sidebar_blocks($theme) { -<<<<<<< HEAD:modules/downloadfullsize/helpers/downloadfullsize_theme.php - if ($theme->item()->is_photo()) { - if (access::can("view_full", $theme->item)) { - if (module::get_var("downloadfullsize", "tButton")) { - $block = new Block(); - $block->css_id = "gDownloadFullsize"; - $block->title = t("Download"); - $block->content = new View("downloadfullsize_block.html"); - - $block->content->item = ORM::factory("item", 1); - - return $block; - } - } - } - } -======= $item = $theme->item(); if ($item && $item->is_photo() && access::can("view_full", $item)) { if (module::get_var("downloadfullsize", "tButton")) { @@ -54,5 +33,4 @@ class downloadfullsize_theme { } } } ->>>>>>> gallery3-contrib/master:modules/downloadfullsize/helpers/downloadfullsize_theme.php } diff --git a/modules/downloadfullsize/views/downloadfullsize_block.html.php b/modules/downloadfullsize/views/downloadfullsize_block.html.php index f109f375..342cf336 100644 --- a/modules/downloadfullsize/views/downloadfullsize_block.html.php +++ b/modules/downloadfullsize/views/downloadfullsize_block.html.php @@ -1,12 +1,7 @@ From 9ce0916b78d0544455eb8a5845f44c2e83a004f9 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Wed, 8 Jul 2009 15:56:06 -0400 Subject: [PATCH 05/30] Initial Commit. --- .../controllers/latestupdates.php | 139 ++++++++++++++++++ .../helpers/latestupdates_installer.php | 31 ++++ .../helpers/latestupdates_theme.php | 38 +++++ modules/latestupdates/module.info | 3 + .../views/latestupdates_block.html.php | 10 ++ modules/latestupdates/views/updates.html.php | 33 +++++ 6 files changed, 254 insertions(+) create mode 100644 modules/latestupdates/controllers/latestupdates.php create mode 100644 modules/latestupdates/helpers/latestupdates_installer.php create mode 100644 modules/latestupdates/helpers/latestupdates_theme.php create mode 100644 modules/latestupdates/module.info create mode 100644 modules/latestupdates/views/latestupdates_block.html.php create mode 100644 modules/latestupdates/views/updates.html.php diff --git a/modules/latestupdates/controllers/latestupdates.php b/modules/latestupdates/controllers/latestupdates.php new file mode 100644 index 00000000..7ccd7ef1 --- /dev/null +++ b/modules/latestupdates/controllers/latestupdates.php @@ -0,0 +1,139 @@ +input->get("page", 1); + if ($page < 1) { + url::redirect("latestupdates/albums/{$item->id}"); + } + + // First item to display. + $offset = ($page - 1) * $itemsPerPage; + + // Determine the total number of items, + // for page numbering purposes. + $count = ORM::factory("item", $id) + ->viewable() + ->where("type !=", "album") + ->orderby("created", "DESC") + ->descendants() + ->count(); + + // Figure out what the highest page number is. + $max_pages = ceil($count / $itemsPerPage); + + // Don't let the visitor go past the last page. + if ($max_pages && $page > $max_pages) { + url::redirect("latestupdates/albums/{$item->id}?page=$max_pages"); + } + + // Figure out which items to display on this page. + $children = ORM::factory("item", $id) + ->viewable() + ->where("type !=", "album") + ->orderby("created", "DESC") + ->limit($itemsPerPage) + ->offset($offset) + ->descendants(); + + // Set up the previous and next page buttons. + if ($page > 1) { + $previous_page = $page - 1; + $view->previous_page_link = url::site("latestupdates/albums/{$item->id}?page={$previous_page}"); + } + if ($page < $max_pages) { + $next_page = $page + 1; + $view->next_page_link = url::site("latestupdates/albums/{$item->id}?page={$next_page}"); + } + + // Set up and display the actual page. + $template = new Theme_View("page.html", "updates"); + $template->set_global("page_size", $itemsPerPage); + $template->set_global("children_count", $count); + $template->content = new View("updates.html"); + $template->content->items = $children; + $template->content->q = count($children); + print $template; + } + + public function updates() { + // Figure out how many items to display on each page. + $itemsPerPage = module::get_var("gallery", "page_size", 9); + + // Figure out which page # the visitor is on and + // don't allow the visitor to go below page 1. + $page = $this->input->get("page", 1); + if ($page < 1) { + url::redirect("latestupdates/updates"); + } + + // First item to display. + $offset = ($page - 1) * $itemsPerPage; + + // Determine the total number of items, + // for page numbering purposes. + $count = ORM::factory("item") + ->viewable() + ->where("type !=", "album") + ->find_all() + ->count(); + + // Figure out what the highest page number is. + $max_pages = ceil($count / $itemsPerPage); + + // Don't let the visitor go past the last page. + if ($max_pages && $page > $max_pages) { + url::redirect("latestupdates/updates?page=$max_pages"); + } + + // Figure out which items to display on this page. + $items = ORM::factory("item") + ->viewable() + ->where("type !=", "album") + ->orderby("created", "DESC") + ->find_all($itemsPerPage, $offset); + + // Set up the previous and next page buttons. + if ($page > 1) { + $previous_page = $page - 1; + $view->previous_page_link = url::site("latestupdates/updates?page={$previous_page}"); + } + if ($page < $max_pages) { + $next_page = $page + 1; + $view->next_page_link = url::site("latestupdates/updates?page={$next_page}"); + } + + // Set up and display the actual page. + $template = new Theme_View("page.html", "updates"); + $template->set_global("page_size", $itemsPerPage); + $template->set_global("children_count", $count); + $template->content = new View("updates.html"); + $template->content->items = $items; + $template->content->q = count($items); + print $template; + } + +} \ No newline at end of file diff --git a/modules/latestupdates/helpers/latestupdates_installer.php b/modules/latestupdates/helpers/latestupdates_installer.php new file mode 100644 index 00000000..71284ec7 --- /dev/null +++ b/modules/latestupdates/helpers/latestupdates_installer.php @@ -0,0 +1,31 @@ +item()) { + return; + } + $albumID = $theme->item->is_album() ? $theme->item->id : $theme->item->parent_id; + + $block = new Block(); + $block->css_id = "gUpdates"; + $block->title = t("Updates"); + $block->content = new View("latestupdates_block.html"); + $block->content->updateLinks = array( + t("Entire Gallery") => url::site("latestupdates/updates"), + t("This Album") => url::site("latestupdates/albums/$albumID") + ); + return $block; + } +} diff --git a/modules/latestupdates/module.info b/modules/latestupdates/module.info new file mode 100644 index 00000000..b0a2a68e --- /dev/null +++ b/modules/latestupdates/module.info @@ -0,0 +1,3 @@ +name = LatestUpdates +description = Display recently uploaded photos and videos. +version = 1 diff --git a/modules/latestupdates/views/latestupdates_block.html.php b/modules/latestupdates/views/latestupdates_block.html.php new file mode 100644 index 00000000..5a2077f2 --- /dev/null +++ b/modules/latestupdates/views/latestupdates_block.html.php @@ -0,0 +1,10 @@ + +
    + $url): ?> +
  • + + + +
  • + +
diff --git a/modules/latestupdates/views/updates.html.php b/modules/latestupdates/views/updates.html.php new file mode 100644 index 00000000..07df61e5 --- /dev/null +++ b/modules/latestupdates/views/updates.html.php @@ -0,0 +1,33 @@ + + + +
+

+ p::clean($q)) ?> + + + pager() ?> + + +

+ + +
From 7d9ea73efc106067e0861b3ba11068cb3d449f17 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Wed, 8 Jul 2009 17:09:42 -0400 Subject: [PATCH 06/30] Only display Fullsized links if the visitor has correct privileges. --- modules/embedlinks/views/embedlinks_photo_block.html.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/embedlinks/views/embedlinks_photo_block.html.php b/modules/embedlinks/views/embedlinks_photo_block.html.php index be73a634..55e0ff19 100644 --- a/modules/embedlinks/views/embedlinks_photo_block.html.php +++ b/modules/embedlinks/views/embedlinks_photo_block.html.php @@ -20,7 +20,7 @@ type}s/{$item->id}") ?>">resize_url(true) ?>">" readonly> - +
@@ -34,6 +34,7 @@ + From d4cac030c40f30b7fd5659b46c4907b4d8857722 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Wed, 8 Jul 2009 18:08:39 -0400 Subject: [PATCH 07/30] Added BBCode support. --- .../views/embedlinks_album_block.html.php | 20 +++++- .../views/embedlinks_photo_block.html.php | 70 ++++++++++++++++++- 2 files changed, 88 insertions(+), 2 deletions(-) diff --git a/modules/embedlinks/views/embedlinks_album_block.html.php b/modules/embedlinks/views/embedlinks_album_block.html.php index e67c71c8..63ccbe4e 100644 --- a/modules/embedlinks/views/embedlinks_album_block.html.php +++ b/modules/embedlinks/views/embedlinks_album_block.html.php @@ -2,7 +2,7 @@ - + @@ -16,3 +16,21 @@ + + + + + + + + + + + + + + + + + + diff --git a/modules/embedlinks/views/embedlinks_photo_block.html.php b/modules/embedlinks/views/embedlinks_photo_block.html.php index 55e0ff19..7053dfcc 100644 --- a/modules/embedlinks/views/embedlinks_photo_block.html.php +++ b/modules/embedlinks/views/embedlinks_photo_block.html.php @@ -1,4 +1,6 @@ + +

@@ -34,12 +36,12 @@ - + @@ -62,3 +64,69 @@ + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 3df013870253c28f65158630d267ceecd45315ad Mon Sep 17 00:00:00 2001 From: rWatcher Date: Wed, 8 Jul 2009 19:26:21 -0400 Subject: [PATCH 08/30] Created and admin page to switch HTML and BBCode off and on. --- .../controllers/admin_embedlinks.php | 80 +++++++++++++++++++ .../embedlinks/helpers/embedlinks_menu.php | 28 +++++++ .../embedlinks/helpers/embedlinks_theme.php | 14 ++-- modules/embedlinks/module.info | 2 +- .../views/admin_embedlinks.html.php | 5 ++ .../views/embedlinks_album_block.html.php | 4 + .../views/embedlinks_photo_block.html.php | 15 ++-- 7 files changed, 134 insertions(+), 14 deletions(-) create mode 100644 modules/embedlinks/controllers/admin_embedlinks.php create mode 100644 modules/embedlinks/helpers/embedlinks_menu.php create mode 100644 modules/embedlinks/views/admin_embedlinks.html.php diff --git a/modules/embedlinks/controllers/admin_embedlinks.php b/modules/embedlinks/controllers/admin_embedlinks.php new file mode 100644 index 00000000..1753ec3a --- /dev/null +++ b/modules/embedlinks/controllers/admin_embedlinks.php @@ -0,0 +1,80 @@ +content = new View("admin_embedlinks.html"); + $view->content->embedlinks_form = $this->_get_admin_form(); + print $view; + } + + public function saveprefs() { + // Prevent Cross Site Request Forgery + access::verify_csrf(); + + // Figure out which boxes where checked + $linkOpts_array = Input::instance()->post("LinkCodeTypeOptions"); + $HTMLButton = false; + $BBCodeButton = false; + + for ($i = 0; $i < count($linkOpts_array); $i++) { + if ($linkOpts_array[$i] == "HTMLCode") { + $HTMLButton = true; + } + if ($linkOpts_array[$i] == "BBCode") { + $BBCodeButton = true; + } + } + + // Save Settings. + module::set_var("embedlinks", "HTMLCode", $HTMLButton); + module::set_var("embedlinks", "BBCode", $BBCodeButton); + message::success(t("Your Selection Has Been Saved.")); + + // Load Admin page. + $view = new Admin_View("admin.html"); + $view->content = new View("admin_embedlinks.html"); + $view->content->embedlinks_form = $this->_get_admin_form(); + print $view; + } + + private function _get_admin_form() { + // Make a new Form. + $form = new Forge("admin/embedlinks/saveprefs", "", "post", + array("id" => "gEmbedLinksAdminForm")); + + // Make an array for the different types of link codes. + $linkCodes["HTMLCode"] = array("Show HTML Links", module::get_var("embedlinks", "HTMLCode")); + $linkCodes["BBCode"] = array("Show BBCode Links", module::get_var("embedlinks", "BBCode")); + + // Setup a few checkboxes on the form. + $add_links = $form->group("EmbedLinks"); + $add_links->checklist("LinkCodeTypeOptions") + ->options($linkCodes); + + // Add a save button to the form. + $add_links->submit("SaveSettings")->value(t("Save")); + + // Return the newly generated form. + return $form; + } +} \ No newline at end of file diff --git a/modules/embedlinks/helpers/embedlinks_menu.php b/modules/embedlinks/helpers/embedlinks_menu.php new file mode 100644 index 00000000..64698e7f --- /dev/null +++ b/modules/embedlinks/helpers/embedlinks_menu.php @@ -0,0 +1,28 @@ +get("settings_menu") + ->append(Menu::factory("link") + ->id("embedlinks") + ->label(t("EmbedLinks")) + ->url(url::site("admin/embedlinks"))); + } +} diff --git a/modules/embedlinks/helpers/embedlinks_theme.php b/modules/embedlinks/helpers/embedlinks_theme.php index 9ded90de..cf88677b 100644 --- a/modules/embedlinks/helpers/embedlinks_theme.php +++ b/modules/embedlinks/helpers/embedlinks_theme.php @@ -27,12 +27,12 @@ class embedlinks_theme_Core { return $block; } } - static function photo_bottom($theme) { - $block = new Block(); - $block->css_id = "gMetadata"; - $block->title = t("Links"); - $block->content = new View("embedlinks_photo_block.html"); - return $block; + + static function photo_bottom($theme) { + $block = new Block(); + $block->css_id = "gMetadata"; + $block->title = t("Links"); + $block->content = new View("embedlinks_photo_block.html"); + return $block; } - } diff --git a/modules/embedlinks/module.info b/modules/embedlinks/module.info index a1636ff9..de716d1a 100644 --- a/modules/embedlinks/module.info +++ b/modules/embedlinks/module.info @@ -1,3 +1,3 @@ name = EmbedLinks -description = Display HTML code to embed links to albums/images into other web pages. +description = Display BBCode and HTML code to embed links to albums/images into other web pages. version = 1 diff --git a/modules/embedlinks/views/admin_embedlinks.html.php b/modules/embedlinks/views/admin_embedlinks.html.php new file mode 100644 index 00000000..060ded3a --- /dev/null +++ b/modules/embedlinks/views/admin_embedlinks.html.php @@ -0,0 +1,5 @@ + +
+

+ +
diff --git a/modules/embedlinks/views/embedlinks_album_block.html.php b/modules/embedlinks/views/embedlinks_album_block.html.php index 63ccbe4e..dafca2ec 100644 --- a/modules/embedlinks/views/embedlinks_album_block.html.php +++ b/modules/embedlinks/views/embedlinks_album_block.html.php @@ -1,4 +1,5 @@ + @@ -16,7 +17,9 @@ + + @@ -34,3 +37,4 @@ + diff --git a/modules/embedlinks/views/embedlinks_photo_block.html.php b/modules/embedlinks/views/embedlinks_photo_block.html.php index 7053dfcc..9d50c32a 100644 --- a/modules/embedlinks/views/embedlinks_photo_block.html.php +++ b/modules/embedlinks/views/embedlinks_photo_block.html.php @@ -1,5 +1,6 @@ - + +

@@ -24,7 +25,7 @@ - + @@ -44,7 +45,7 @@ - + @@ -64,8 +65,9 @@ + - +

@@ -90,7 +92,7 @@ - + @@ -110,7 +112,7 @@ - + @@ -130,3 +132,4 @@ + \ No newline at end of file From fe799699372627aabd65de92f9761cfaaa490f6a Mon Sep 17 00:00:00 2001 From: rWatcher Date: Wed, 8 Jul 2009 21:36:56 -0400 Subject: [PATCH 09/30] Added EXIF-style dialog boxes. --- modules/embedlinks/controllers/embedlinks.php | 89 +++++++++++++++++++ .../views/embedlinks_bbcodedialog.html.php | 24 +++++ .../views/embedlinks_htmldialog.html.php | 24 +++++ .../views/embedlinks_sidebar.html.php | 16 ++++ 4 files changed, 153 insertions(+) create mode 100644 modules/embedlinks/controllers/embedlinks.php create mode 100644 modules/embedlinks/views/embedlinks_bbcodedialog.html.php create mode 100644 modules/embedlinks/views/embedlinks_htmldialog.html.php create mode 100644 modules/embedlinks/views/embedlinks_sidebar.html.php diff --git a/modules/embedlinks/controllers/embedlinks.php b/modules/embedlinks/controllers/embedlinks.php new file mode 100644 index 00000000..09f2fba4 --- /dev/null +++ b/modules/embedlinks/controllers/embedlinks.php @@ -0,0 +1,89 @@ +is_album()) { + $linkArray[0] = array("Text:", "type}s/{$item->id}") . "">Click Here"); + $linkArray[1] = array("Thumbnail:", "type}s/{$item->id}") . "">thumb_url(true) . "">"); + $linkTitles[0] = array("Link To This Album:", 2); + } else { + $linkArray[0] = array("Text:", "type}s/{$item->id}") . "">Click Here"); + $linkArray[1] = array("Thumbnail:", "type}s/{$item->id}") . "">thumb_url(true) . "">"); + $linkArray[2] = array("Resized:", "type}s/{$item->id}") . "">resize_url(true) . "">"); + $linkTitles[0] = array("Link To This Page:", 3); + + $linkArray[3] = array("Text:", "resize_url(true) . "">Click Here"); + $linkArray[4] = array("Thumbnail:", "resize_url(true) . "">thumb_url(true) . "">"); + $linkArray[5] = array("Image:", "resize_url(true) . "">"); + $linkTitles[1] = array("Link To The Resized Image:", 3); + + if (access::can("view_full", $item)) { + $linkArray[6] = array("Text:", "file_url(true) . "">Click Here"); + $linkArray[7] = array("Thumbnail:", "file_url(true) . "">thumb_url(true) . "">"); + $linkArray[8] = array("Resized:", "file_url(true) . "">resize_url(true) . "">"); + $linkTitles[2] = array("Link To The Fullsize Image:", 3); + } + } + + $view = new View("embedlinks_htmldialog.html"); + $view->titles = $linkTitles; + $view->details = $linkArray; + print $view; + } + + public function showbbcode($item_id) { + $item = ORM::factory("item", $item_id); + access::required("view", $item); + + if ($item->is_album()) { + $linkArray[0] = array("Text:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "]Click Here[/url]"); + $linkArray[1] = array("Thumbnail:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "][img]" . $item->thumb_url(true) . "[/img][/url]"); + $linkTitles[0] = array("Link To This Album:", 2); + } else { + $linkArray[0] = array("Text:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "]Click Here[/url]"); + $linkArray[1] = array("Thumbnail:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "][img]" . $item->thumb_url(true) . "[/img][/url]"); + $linkArray[2] = array("Resized:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "][img]" . $item->resize_url(true) . "[/img][/url]"); + $linkTitles[0] = array("Link To This Page:", 3); + + $linkArray[3] = array("Text:", "[url=" . $item->resize_url(true) . "]Click Here[/url]"); + $linkArray[4] = array("Thumbnail:", "[url=" . $item->resize_url(true) . "][img]" . $item->thumb_url(true) . "[/img][/url]"); + $linkArray[5] = array("Image:", "[img]" . $item->resize_url(true) . "[/img]"); + $linkTitles[1] = array("Link To The Resized Image:", 3); + + if (access::can("view_full", $item)) { + $linkArray[6] = array("Text:", "[url=" . $item->file_url(true) . "]Click Here[/url]"); + $linkArray[7] = array("Thumbnail:", "[url=" . $item->file_url(true) . "][img]" . $item->thumb_url(true) . "[/img][/url]"); + $linkArray[8] = array("Resized:", "[url=" . $item->file_url(true) . "][img]" . $item->resize_url(true) . "[/img][/url]"); + $linkTitles[2] = array("Link To The Fullsize Image:", 3); + } + } + + $view = new View("embedlinks_bbcodedialog.html"); + $view->titles = $linkTitles; + $view->details = $linkArray; + print $view; + } +} diff --git a/modules/embedlinks/views/embedlinks_bbcodedialog.html.php b/modules/embedlinks/views/embedlinks_bbcodedialog.html.php new file mode 100644 index 00000000..af79ceb8 --- /dev/null +++ b/modules/embedlinks/views/embedlinks_bbcodedialog.html.php @@ -0,0 +1,24 @@ + + +

+
+ + + + + + + + + + + + + + + +
diff --git a/modules/embedlinks/views/embedlinks_htmldialog.html.php b/modules/embedlinks/views/embedlinks_htmldialog.html.php new file mode 100644 index 00000000..512a6b42 --- /dev/null +++ b/modules/embedlinks/views/embedlinks_htmldialog.html.php @@ -0,0 +1,24 @@ + + +

+
+ + + + + + + + + + + + + + + +
diff --git a/modules/embedlinks/views/embedlinks_sidebar.html.php b/modules/embedlinks/views/embedlinks_sidebar.html.php new file mode 100644 index 00000000..3fb64f05 --- /dev/null +++ b/modules/embedlinks/views/embedlinks_sidebar.html.php @@ -0,0 +1,16 @@ + + +id}") ?>" title="" + class="gDialogLink gButtonLink ui-icon-left ui-state-default ui-corner-all"> + + +
+ + + +id}") ?>" title="" + class="gDialogLink gButtonLink ui-icon-left ui-state-default ui-corner-all"> + + + + \ No newline at end of file From 3d8202a5e1f5be1d0cce77c1d2b6f1d06cd3b3a7 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Sun, 12 Jul 2009 22:55:47 -0400 Subject: [PATCH 10/30] Code Cleanup, comments, etc. --- .../controllers/admin_embedlinks.php | 24 +++++++++++-- modules/embedlinks/controllers/embedlinks.php | 20 +++++++++-- .../embedlinks/helpers/embedlinks_theme.php | 34 +++++++++++++++---- .../views/embedlinks_bbcodedialog.html.php | 2 +- .../views/embedlinks_htmldialog.html.php | 2 +- .../views/embedlinks_sidebar.html.php | 4 +-- 6 files changed, 70 insertions(+), 16 deletions(-) diff --git a/modules/embedlinks/controllers/admin_embedlinks.php b/modules/embedlinks/controllers/admin_embedlinks.php index 1753ec3a..4168ef67 100644 --- a/modules/embedlinks/controllers/admin_embedlinks.php +++ b/modules/embedlinks/controllers/admin_embedlinks.php @@ -33,9 +33,13 @@ class Admin_EmbedLinks_Controller extends Admin_Controller { // Figure out which boxes where checked $linkOpts_array = Input::instance()->post("LinkCodeTypeOptions"); + $displayType_array = Input::instance()->post("LinkDisplayType"); + $HTMLButton = false; $BBCodeButton = false; - + $InPageLinks = false; + $DialogLinks = false; + for ($i = 0; $i < count($linkOpts_array); $i++) { if ($linkOpts_array[$i] == "HTMLCode") { $HTMLButton = true; @@ -43,11 +47,21 @@ class Admin_EmbedLinks_Controller extends Admin_Controller { if ($linkOpts_array[$i] == "BBCode") { $BBCodeButton = true; } + } + for ($i = 0; $i < count($displayType_array); $i++) { + if ($displayType_array[$i] == "InPageLinks") { + $InPageLinks = true; + } + if ($displayType_array[$i] == "DialogLinks") { + $DialogLinks = true; + } } - + // Save Settings. module::set_var("embedlinks", "HTMLCode", $HTMLButton); module::set_var("embedlinks", "BBCode", $BBCodeButton); + module::set_var("embedlinks", "InPageLinks", $InPageLinks); + module::set_var("embedlinks", "DialogLinks", $DialogLinks); message::success(t("Your Selection Has Been Saved.")); // Load Admin page. @@ -66,10 +80,16 @@ class Admin_EmbedLinks_Controller extends Admin_Controller { $linkCodes["HTMLCode"] = array("Show HTML Links", module::get_var("embedlinks", "HTMLCode")); $linkCodes["BBCode"] = array("Show BBCode Links", module::get_var("embedlinks", "BBCode")); + // Make an array for the different methods of displaying the links. + $linkDisplays["InPageLinks"] = array("Show Links In The Actual Page", module::get_var("embedlinks", "InPageLinks")); + $linkDisplays["DialogLinks"] = array("Show Links In a Seperate Dialog Box", module::get_var("embedlinks", "DialogLinks")); + // Setup a few checkboxes on the form. $add_links = $form->group("EmbedLinks"); $add_links->checklist("LinkCodeTypeOptions") ->options($linkCodes); + $add_links->checklist("LinkDisplayType") + ->options($linkDisplays); // Add a save button to the form. $add_links->submit("SaveSettings")->value(t("Save")); diff --git a/modules/embedlinks/controllers/embedlinks.php b/modules/embedlinks/controllers/embedlinks.php index 09f2fba4..6654302c 100644 --- a/modules/embedlinks/controllers/embedlinks.php +++ b/modules/embedlinks/controllers/embedlinks.php @@ -22,24 +22,31 @@ class EmbedLinks_Controller extends Controller { * Display the EXIF data for an item. */ public function showhtml($item_id) { + // Generate the Dialog Box for HTML links. $item = ORM::factory("item", $item_id); access::required("view", $item); + // If the current page is an album, only display two links, + // or else display many. if ($item->is_album()) { $linkArray[0] = array("Text:", "type}s/{$item->id}") . "">Click Here"); $linkArray[1] = array("Thumbnail:", "type}s/{$item->id}") . "">thumb_url(true) . "">"); $linkTitles[0] = array("Link To This Album:", 2); } else { + // Link to the current page. $linkArray[0] = array("Text:", "type}s/{$item->id}") . "">Click Here"); $linkArray[1] = array("Thumbnail:", "type}s/{$item->id}") . "">thumb_url(true) . "">"); $linkArray[2] = array("Resized:", "type}s/{$item->id}") . "">resize_url(true) . "">"); $linkTitles[0] = array("Link To This Page:", 3); + // Link to the "resized" version of the current image. $linkArray[3] = array("Text:", "resize_url(true) . "">Click Here"); $linkArray[4] = array("Thumbnail:", "resize_url(true) . "">thumb_url(true) . "">"); $linkArray[5] = array("Image:", "resize_url(true) . "">"); $linkTitles[1] = array("Link To The Resized Image:", 3); + // If the visitor has suficient privlidges to see the fullsized + // version of the current image, then display links to it. if (access::can("view_full", $item)) { $linkArray[6] = array("Text:", "file_url(true) . "">Click Here"); $linkArray[7] = array("Thumbnail:", "file_url(true) . "">thumb_url(true) . "">"); @@ -55,24 +62,31 @@ class EmbedLinks_Controller extends Controller { } public function showbbcode($item_id) { - $item = ORM::factory("item", $item_id); + // Generate the Dialog Box for BBCode links. + $item = ORM::factory("item", $item_id); access::required("view", $item); - + + // If the current page is an album, only display two links, + // or else display many. if ($item->is_album()) { $linkArray[0] = array("Text:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "]Click Here[/url]"); $linkArray[1] = array("Thumbnail:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "][img]" . $item->thumb_url(true) . "[/img][/url]"); $linkTitles[0] = array("Link To This Album:", 2); } else { - $linkArray[0] = array("Text:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "]Click Here[/url]"); + // Link to the current page. + $linkArray[0] = array("Text:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "]Click Here[/url]"); $linkArray[1] = array("Thumbnail:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "][img]" . $item->thumb_url(true) . "[/img][/url]"); $linkArray[2] = array("Resized:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "][img]" . $item->resize_url(true) . "[/img][/url]"); $linkTitles[0] = array("Link To This Page:", 3); + // Link to the "resized" version of the current image. $linkArray[3] = array("Text:", "[url=" . $item->resize_url(true) . "]Click Here[/url]"); $linkArray[4] = array("Thumbnail:", "[url=" . $item->resize_url(true) . "][img]" . $item->thumb_url(true) . "[/img][/url]"); $linkArray[5] = array("Image:", "[img]" . $item->resize_url(true) . "[/img]"); $linkTitles[1] = array("Link To The Resized Image:", 3); + // If the visitor has suficient privlidges to see the fullsized + // version of the current image, then display links to it. if (access::can("view_full", $item)) { $linkArray[6] = array("Text:", "[url=" . $item->file_url(true) . "]Click Here[/url]"); $linkArray[7] = array("Thumbnail:", "[url=" . $item->file_url(true) . "][img]" . $item->thumb_url(true) . "[/img][/url]"); diff --git a/modules/embedlinks/helpers/embedlinks_theme.php b/modules/embedlinks/helpers/embedlinks_theme.php index cf88677b..dd4d3369 100644 --- a/modules/embedlinks/helpers/embedlinks_theme.php +++ b/modules/embedlinks/helpers/embedlinks_theme.php @@ -19,20 +19,40 @@ */ class embedlinks_theme_Core { static function sidebar_blocks($theme) { - if ($theme->item()->is_album()) { + // If the current item is an album and if "In Page" links are enabled then + // display links to the current album in the theme sidebar. + if ($theme->item()->is_album() && module::get_var("embedlinks", "InPageLinks")) { $block = new Block(); $block->css_id = "gMetadata"; $block->title = t("Links"); $block->content = new View("embedlinks_album_block.html"); return $block; + } + } + + static function sidebar_bottom($theme) { + // If displaying links in a dialog box is enabled then + // insert buttons into the bottom of the side bar + // to open up the dialog window. + if (module::get_var("embedlinks", "DialogLinks")) { + $block = new Block(); + $block->css_id = "gMetadata"; + $block->title = t("Link To This Page:"); + $block->content = new View("embedlinks_sidebar.html"); + return $block; } } - static function photo_bottom($theme) { - $block = new Block(); - $block->css_id = "gMetadata"; - $block->title = t("Links"); - $block->content = new View("embedlinks_photo_block.html"); - return $block; + static function photo_bottom($theme) { + // If the current item is a photo and displaying "In Page" links + // is enabled, then insert HTML/BBCode links into the bottom + // of the page. + if (module::get_var("embedlinks", "InPageLinks")) { + $block = new Block(); + $block->css_id = "gMetadata"; + $block->title = t("Links"); + $block->content = new View("embedlinks_photo_block.html"); + return $block; + } } } diff --git a/modules/embedlinks/views/embedlinks_bbcodedialog.html.php b/modules/embedlinks/views/embedlinks_bbcodedialog.html.php index af79ceb8..43f4a72f 100644 --- a/modules/embedlinks/views/embedlinks_bbcodedialog.html.php +++ b/modules/embedlinks/views/embedlinks_bbcodedialog.html.php @@ -20,5 +20,5 @@ - + diff --git a/modules/embedlinks/views/embedlinks_htmldialog.html.php b/modules/embedlinks/views/embedlinks_htmldialog.html.php index 512a6b42..93dfacd9 100644 --- a/modules/embedlinks/views/embedlinks_htmldialog.html.php +++ b/modules/embedlinks/views/embedlinks_htmldialog.html.php @@ -20,5 +20,5 @@ - + diff --git a/modules/embedlinks/views/embedlinks_sidebar.html.php b/modules/embedlinks/views/embedlinks_sidebar.html.php index 3fb64f05..b1b6e4bb 100644 --- a/modules/embedlinks/views/embedlinks_sidebar.html.php +++ b/modules/embedlinks/views/embedlinks_sidebar.html.php @@ -3,7 +3,7 @@ id}") ?>" title="" class="gDialogLink gButtonLink ui-icon-left ui-state-default ui-corner-all"> - +
@@ -11,6 +11,6 @@ id}") ?>" title="" class="gDialogLink gButtonLink ui-icon-left ui-state-default ui-corner-all"> - + \ No newline at end of file From b82b45aca2ceebf8dea6c6485ab9a102b7abe93d Mon Sep 17 00:00:00 2001 From: rWatcher Date: Wed, 15 Jul 2009 21:21:18 -0400 Subject: [PATCH 11/30] Initial Commit. --- .../helpers/displaytags_installer.php | 27 ++++++++++++ .../displaytags/helpers/displaytags_theme.php | 41 +++++++++++++++++++ modules/displaytags/module.info | 3 ++ .../views/displaytags_block.html.php | 10 +++++ 4 files changed, 81 insertions(+) create mode 100644 modules/displaytags/helpers/displaytags_installer.php create mode 100644 modules/displaytags/helpers/displaytags_theme.php create mode 100644 modules/displaytags/module.info create mode 100644 modules/displaytags/views/displaytags_block.html.php diff --git a/modules/displaytags/helpers/displaytags_installer.php b/modules/displaytags/helpers/displaytags_installer.php new file mode 100644 index 00000000..42f58c57 --- /dev/null +++ b/modules/displaytags/helpers/displaytags_installer.php @@ -0,0 +1,27 @@ +item()) { + return; + } + + // Create an array of all the tags for the current item. + $tagsItem = ORM::factory("tag") + ->join("items_tags", "tags.id", "items_tags.tag_id") + ->where("items_tags.item_id", $theme->item->id) + ->find_all(); + + // If the current item has at least one tag, display it/them. + if (count($tagsItem) > 0) { + $block = new Block(); + $block->css_id = "gDisplayTags"; + $block->title = t("Tags"); + $block->content = new View("displaytags_block.html"); + $block->content->tags = $tagsItem; + return $block; + } + } +} diff --git a/modules/displaytags/module.info b/modules/displaytags/module.info new file mode 100644 index 00000000..b905a8e4 --- /dev/null +++ b/modules/displaytags/module.info @@ -0,0 +1,3 @@ +name = DisplayTags +description = Display all tags for the current photo/album. +version = 1 diff --git a/modules/displaytags/views/displaytags_block.html.php b/modules/displaytags/views/displaytags_block.html.php new file mode 100644 index 00000000..a003a415 --- /dev/null +++ b/modules/displaytags/views/displaytags_block.html.php @@ -0,0 +1,10 @@ + +
+ + + ">name) ?>, + + ">name) ?> + + +
From 6f93d148f553f6f76c81d09ad333170f312b0fa6 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Wed, 22 Jul 2009 16:49:46 -0400 Subject: [PATCH 12/30] Initial Commit. --- .../controllers/admin_contactowner.php | 96 +++++++++++++ .../contactowner/controllers/contactowner.php | 129 ++++++++++++++++++ .../helpers/contactowner_installer.php | 23 ++++ .../helpers/contactowner_menu.php | 28 ++++ .../helpers/contactowner_theme.php | 70 ++++++++++ modules/contactowner/module.info | 3 + .../views/admin_contactowner.html.php | 5 + .../views/contactowner_block.html.php | 15 ++ .../views/contactowner_emailform.html.php | 2 + 9 files changed, 371 insertions(+) create mode 100644 modules/contactowner/controllers/admin_contactowner.php create mode 100644 modules/contactowner/controllers/contactowner.php create mode 100644 modules/contactowner/helpers/contactowner_installer.php create mode 100644 modules/contactowner/helpers/contactowner_menu.php create mode 100644 modules/contactowner/helpers/contactowner_theme.php create mode 100644 modules/contactowner/module.info create mode 100644 modules/contactowner/views/admin_contactowner.html.php create mode 100644 modules/contactowner/views/contactowner_block.html.php create mode 100644 modules/contactowner/views/contactowner_emailform.html.php diff --git a/modules/contactowner/controllers/admin_contactowner.php b/modules/contactowner/controllers/admin_contactowner.php new file mode 100644 index 00000000..f5972c09 --- /dev/null +++ b/modules/contactowner/controllers/admin_contactowner.php @@ -0,0 +1,96 @@ +content = new View("admin_contactowner.html"); + $view->content->contactowner_form = $this->_get_admin_form(); + print $view; + } + + public function saveprefs() { + // Prevent Cross Site Request Forgery + access::verify_csrf(); + + // Figure out which boxes where checked + $linkOptions_array = Input::instance()->post("ContactOwnerLinkTypes"); + $ownerLink = false; + $userLink = false; + for ($i = 0; $i < count($linkOptions_array); $i++) { + if ($linkOptions_array[$i] == "ContactOwner") { + $ownerLink = true; + } + if ($linkOptions_array[$i] == "ContactUser") { + $userLink = true; + } + } + + // Figure out the values of the text boxes + $str_contactbutton = Input::instance()->post("owner_button_text"); + $str_contactemail = Input::instance()->post("owner_email"); + $str_contactname = Input::instance()->post("owner_name"); + + // Save Settings. + module::set_var("contactowner", "contact_owner_link", $ownerLink); + module::set_var("contactowner", "contact_user_link", $userLink); + module::set_var("contactowner", "contact_button_text", $str_contactbutton); + module::set_var("contactowner", "contact_owner_email", $str_contactemail ); + module::set_var("contactowner", "contact_owner_name", $str_contactname ); + message::success(t("Your Settings Have Been Saved.")); + + // Load Admin page. + $view = new Admin_View("admin.html"); + $view->content = new View("admin_contactowner.html"); + $view->content->contactowner_form = $this->_get_admin_form(); + print $view; + } + + private function _get_admin_form() { + // Make a new Form. + $form = new Forge("admin/contactowner/saveprefs", "", "post", + array("id" => "gContactOwnerAdminForm")); + + // Make an array for the different types of link codes. + $add_contactlinks = $form->group("contactOwnerLinks"); + $linkOptions["ContactOwner"] = array("Display Contact Site Owner Link", + module::get_var("contactowner", "contact_owner_link")); + $linkOptions["ContactUser"] = array("Display Contact Item Owner Link", + module::get_var("contactowner", "contact_user_link")); + + // Turn the array into a series of checkboxes. + $add_contactlinks->checklist("ContactOwnerLinkTypes") + ->options($linkOptions); + + // Set up some text boxes for the site owners Name, email and the + // text for the contact link. + $add_contacts = $form->group("contactOwner"); + $add_contacts->input("owner_button_text")->label(t("Contact Owner Link Text"))->value(module::get_var("contactowner", "contact_button_text")); + $add_contacts->input("owner_email")->label(t("Owner Email Address"))->value(module::get_var("contactowner", "contact_owner_email")); + $add_contacts->input("owner_name")->label(t("Owner Name"))->value(module::get_var("contactowner", "contact_owner_name")); + + // Add a save button to the form. + $add_contacts->submit("SaveSettings")->value(t("Save")); + + // Return the newly generated form. + return $form; + } +} \ No newline at end of file diff --git a/modules/contactowner/controllers/contactowner.php b/modules/contactowner/controllers/contactowner.php new file mode 100644 index 00000000..5b082a49 --- /dev/null +++ b/modules/contactowner/controllers/contactowner.php @@ -0,0 +1,129 @@ + "gContactOwnerSendForm")); + $sendmail_fields = $form->group("contactOwner"); + $sendmail_fields->input("email_to")->label(t("To:"))->value(module::get_var("contactowner", "contact_owner_name")); + $sendmail_fields->input("email_from")->label(t("From:"))->value(); + $sendmail_fields->input("email_subject")->label(t("Subject:"))->value(""); + $sendmail_fields->textarea("email_body")->label(t("Message:"))->value(""); + $sendmail_fields->hidden("email_to_id")->value("-1"); + + // Add a save button to the form. + $sendmail_fields->submit("SendMessage")->value(t("Send")); + + // Set up and display the actual page. + $template = new Theme_View("page.html", "Contact"); + $template->content = new View("contactowner_emailform.html"); + $template->content->sendmail_form = $form; + print $template; + } + + public function emailid($user_id) { + // Display a form that a vistor can use to contact a registered user. + + // If this page is disabled, show a 404 error. + if (module::get_var("contactowner", "contact_user_link") != true) { + kohana::show_404(); + } + + // Locate the record for the user specified by $user_id, + // use this to determine the user's name. + $userDetails = ORM::factory("user") + ->where("id", $user_id) + ->find_all(); + + // Make a new form with a couple of text boxes. + $form = new Forge("contactowner/sendemail", "", "post", + array("id" => "gContactOwnerSendForm")); + $sendmail_fields = $form->group("contactOwner"); + $sendmail_fields->input("email_to")->label(t("To:"))->value($userDetails[0]->name); + $sendmail_fields->input("email_from")->label(t("From:"))->value(); + $sendmail_fields->input("email_subject")->label(t("Subject:"))->value(""); + $sendmail_fields->textarea("email_body")->label(t("Message:"))->value(""); + $sendmail_fields->hidden("email_to_id")->value($user_id); + + // Add a save button to the form. + $sendmail_fields->submit("SendMessage")->value(t("Send")); + + // Set up and display the actual page. + $template = new Theme_View("page.html", "Contact"); + $template->content = new View("contactowner_emailform.html"); + $template->content->sendmail_form = $form; + print $template; + } + + public function sendemail() { + // Process the data from the form into an email, + // then send the email. + + // Copy the data from the email from into a couple of variables. + $str_emailsubject = Input::instance()->post("email_subject"); + $str_emailtoid = Input::instance()->post("email_to_id"); + $str_emailfrom = Input::instance()->post("email_from"); + $str_emailbody = Input::instance()->post("email_body"); + + // Add in some
tags to the message body where ever there are line breaks. + $str_emailbody = str_replace("\n", "
\n", $str_emailbody); + + // Gallery's Sendmail library doesn't allow for custom from addresses, + // so add the from email to the beginning of the message body instead. + $str_emailbody = "Message Sent From " . $str_emailfrom . "

\n\n" . $str_emailbody; + + // Figure out where the email is going to. + $str_emailto = ""; + if ($str_emailtoid == -1) { + // If the email id is "-1" send the message to a pre-determined + // owner email address. + $str_emailto = module::get_var("contactowner", "contact_owner_email"); + } else { + // or else grab the email from the user table. + $userDetails = ORM::factory("user") + ->where("id", $str_emailtoid) + ->find_all(); + $str_emailto = $userDetails[0]->email; + } + + // Send the email message. + Sendmail::factory() + ->to($str_emailto) + ->subject($str_emailsubject) + ->header("Mime-Version", "1.0") + ->header("Content-type", "text/html; charset=utf-8") + ->message($str_emailbody) + ->send(); + + // Display a message telling the visitor that their email has been sent. + $template = new Theme_View("page.html", "Contact"); + $template->content = new View("contactowner_emailform.html"); + $template->content->sendmail_form = t("Your Message Has Been Sent."); + print $template; + } +} diff --git a/modules/contactowner/helpers/contactowner_installer.php b/modules/contactowner/helpers/contactowner_installer.php new file mode 100644 index 00000000..4292ea34 --- /dev/null +++ b/modules/contactowner/helpers/contactowner_installer.php @@ -0,0 +1,23 @@ +get("settings_menu") + ->append(Menu::factory("link") + ->id("contactowner") + ->label(t("ContactOwner Settings")) + ->url(url::site("admin/contactowner"))); + } +} diff --git a/modules/contactowner/helpers/contactowner_theme.php b/modules/contactowner/helpers/contactowner_theme.php new file mode 100644 index 00000000..2286219b --- /dev/null +++ b/modules/contactowner/helpers/contactowner_theme.php @@ -0,0 +1,70 @@ +item()) { + return; + } + + // Locate the record for the user that created the current item. + // Their name will be displayed as part of the contact link. + $userDetails = ORM::factory("user") + ->where("id", $theme->item->owner_id) + ->find_all(); + + // Create a new block to display the links in. + $block = new Block(); + $block->css_id = "gContactOwner"; + $block->title = t("Contact:"); + $block->content = new View("contactowner_block.html"); + + // if $displayBlock is true, this block will be displayed, + // if there aren't any links to put in the block for whatever reason + // then $displayBlock will rename set to false and the + // block will not be displayed. + $displayBlock = false; + + // Figure out if the contact item owner email link should be displayed. + // only display it if the current owner has an email address and + // the option for allowing item owners to be contacted is set to true. + if ((count($userDetails) > 0) && ($userDetails[0]->email != "") && + (module::get_var("contactowner", "contact_user_link") == true)) { + $block->content->userLink = "item->owner_id) . "\">" . t("Contact") . " " . $userDetails[0]->name . ""; + $displayBlock = true; + } + + // Figure out if the contact site owner link should be displayed. + if (module::get_var("contactowner", "contact_owner_link")) { + $block->content->ownerLink = "" . t(module::get_var("contactowner", "contact_button_text")) . ""; + $displayBlock = true; + } + + if ($displayBlock) { + return $block; + } + } +} diff --git a/modules/contactowner/module.info b/modules/contactowner/module.info new file mode 100644 index 00000000..673023c3 --- /dev/null +++ b/modules/contactowner/module.info @@ -0,0 +1,3 @@ +name = ContactOwner +description = Allows visitors to send the website owner an email. +version = 1 diff --git a/modules/contactowner/views/admin_contactowner.html.php b/modules/contactowner/views/admin_contactowner.html.php new file mode 100644 index 00000000..328e5820 --- /dev/null +++ b/modules/contactowner/views/admin_contactowner.html.php @@ -0,0 +1,5 @@ + +
+

+ +
diff --git a/modules/contactowner/views/contactowner_block.html.php b/modules/contactowner/views/contactowner_block.html.php new file mode 100644 index 00000000..c113564b --- /dev/null +++ b/modules/contactowner/views/contactowner_block.html.php @@ -0,0 +1,15 @@ + +
    + +
  • + +
  • + + +
  • + +
  • + + +
+ diff --git a/modules/contactowner/views/contactowner_emailform.html.php b/modules/contactowner/views/contactowner_emailform.html.php new file mode 100644 index 00000000..61873e91 --- /dev/null +++ b/modules/contactowner/views/contactowner_emailform.html.php @@ -0,0 +1,2 @@ + + From 3f7f556a414dc6d5e97171819d2e06da78ed9a14 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Wed, 22 Jul 2009 19:48:13 -0400 Subject: [PATCH 13/30] Initial Commit --- .../phpmailer/controllers/admin_phpmailer.php | 93 +++++++++++++ .../phpmailer/helpers/phpmailer_installer.php | 27 ++++ modules/phpmailer/helpers/phpmailer_menu.php | 28 ++++ modules/phpmailer/libraries/Sendmail.php | 126 ++++++++++++++++++ modules/phpmailer/module.info | 3 + .../phpmailer/views/admin_phpmailer.html.php | 5 + 6 files changed, 282 insertions(+) create mode 100644 modules/phpmailer/controllers/admin_phpmailer.php create mode 100644 modules/phpmailer/helpers/phpmailer_installer.php create mode 100644 modules/phpmailer/helpers/phpmailer_menu.php create mode 100644 modules/phpmailer/libraries/Sendmail.php create mode 100644 modules/phpmailer/module.info create mode 100644 modules/phpmailer/views/admin_phpmailer.html.php diff --git a/modules/phpmailer/controllers/admin_phpmailer.php b/modules/phpmailer/controllers/admin_phpmailer.php new file mode 100644 index 00000000..ae68a20a --- /dev/null +++ b/modules/phpmailer/controllers/admin_phpmailer.php @@ -0,0 +1,93 @@ +content = new View("admin_phpmailer.html"); + $view->content->phpmailer_form = $this->_get_admin_form(); + print $view; + } + + public function saveprefs() { + // Prevent Cross Site Request Forgery + access::verify_csrf(); + + // Figure out the values of the text boxes + $str_phpmailer_path = Input::instance()->post("phpmailer_path"); + $str_phpmailer_from_addr = Input::instance()->post("phpmailer_from_address"); + $str_phpmailer_from_name = Input::instance()->post("phpmailer_from_name"); + $str_smtp_server = Input::instance()->post("phpmailer_smtp_server"); + $str_smtp_login = Input::instance()->post("phpmailer_smtp_login"); + $str_smtp_pass = Input::instance()->post("phpmailer_smtp_password"); + + // Save Settings. + module::set_var("phpmailer", "phpmailer_path", $str_phpmailer_path); + module::set_var("phpmailer", "phpmailer_from_address", $str_phpmailer_from_addr); + module::set_var("phpmailer", "phpmailer_from_name", $str_phpmailer_from_name); + module::set_var("phpmailer", "smtp_server", $str_smtp_server); + module::set_var("phpmailer", "smtp_login", $str_smtp_login); + module::set_var("phpmailer", "smtp_password", $str_smtp_pass); + message::success(t("Your Settings Have Been Saved.")); + + // Load Admin page. + $view = new Admin_View("admin.html"); + $view->content = new View("admin_phpmailer.html"); + $view->content->phpmailer_form = $this->_get_admin_form(); + print $view; + } + + private function _get_admin_form() { + // Make a new Form. + $form = new Forge("admin/phpmailer/saveprefs", "", "post", + array("id" => "gPHPMailerAdminForm")); + + // Create the input boxes for the PHPMailer Settings + $phpmailerGroup = $form->group("PHPMailerSettings"); + $phpmailerGroup->input("phpmailer_path") + ->label(t("Location of PHPMailer Class")) + ->value(module::get_var("phpmailer", "phpmailer_path")); + $phpmailerGroup->input("phpmailer_from_address") + ->label(t("From Email Address")) + ->value(module::get_var("phpmailer", "phpmailer_from_address")); + $phpmailerGroup->input("phpmailer_from_name") + ->label(t("From Name")) + ->value(module::get_var("phpmailer", "phpmailer_from_name")); + + // Create the input boxes for the SMTP server settings + $phpmailerSMTP = $form->group("PHPMailerSMTPSettings"); + $phpmailerSMTP->input("phpmailer_smtp_server") + ->label(t("SMTP Server Address")) + ->value(module::get_var("phpmailer", "smtp_server")); + $phpmailerSMTP->input("phpmailer_smtp_login") + ->label(t("SMTP Login Name")) + ->value(module::get_var("phpmailer", "smtp_login")); + $phpmailerSMTP->input("phpmailer_smtp_password") + ->label(t("SMTP Password")) + ->value(module::get_var("phpmailer", "smtp_password")); + + // Add a save button to the form. + $form->submit("SaveSettings")->value(t("Save")); + + // Return the newly generated form. + return $form; + } +} \ No newline at end of file diff --git a/modules/phpmailer/helpers/phpmailer_installer.php b/modules/phpmailer/helpers/phpmailer_installer.php new file mode 100644 index 00000000..2c264f68 --- /dev/null +++ b/modules/phpmailer/helpers/phpmailer_installer.php @@ -0,0 +1,27 @@ +get("settings_menu") + ->append(Menu::factory("link") + ->id("phpmailer") + ->label(t("PHPMailer Settings")) + ->url(url::site("admin/phpmailer"))); + } +} diff --git a/modules/phpmailer/libraries/Sendmail.php b/modules/phpmailer/libraries/Sendmail.php new file mode 100644 index 00000000..8332b659 --- /dev/null +++ b/modules/phpmailer/libraries/Sendmail.php @@ -0,0 +1,126 @@ +headers = array(); + $config = Kohana::config("sendmail"); + foreach ($config as $key => $value) { + $this->$key($value); + } + } + + public function __get($key) { + return null; + } + + public function __call($key, $value) { + switch ($key) { + case "to": + $this->to = is_array($value[0]) ? $value[0] : array($value[0]); + break; + case "header": + if (count($value) != 2) { + throw new Exception("@todo INVALID_HEADER_PARAMETERS"); + } + $this->headers[$value[0]] = $value[1]; + break; + case "from": + $this->headers["From"] = $value[0]; + break; + case "reply_to": + $this->headers["Reply-To"] = $value[0]; + break; + default: + $this->$key = $value[0]; + } + return $this; + } + + public function send() { + if (empty($this->to)) { + throw new Exception("@todo TO_IS_REQUIRED_FOR_MAIL"); + } + $to = implode(", ", $this->to); + $headers = array(); + foreach ($this->headers as $key => $value) { + $key = ucfirst($key); + $headers[] = "$key: $value"; + } + + // The docs say headers should be separated by \r\n, but occasionaly that doesn't work and you + // need to use a single \n. This can be set in config/sendmail.php + $headers = implode($this->header_separator, $headers); + $message = wordwrap($this->message, $this->line_length, "\n"); + if (!$this->mail($to, $this->subject, $message, $headers)) { + Kohana::log("error", wordwrap("Sending mail failed:\nTo: $to\n $this->subject\n" . + "Headers: $headers\n $this->message")); + throw new Exception("@todo SEND_MAIL_FAILED"); + } + return $this; + } + + public function mail($to, $subject, $message, $headers) { + // This function is completely different from the original + // Gallery Sendmail script. Outside of this function, + // no other changes were made. + + require(module::get_var("phpmailer", "phpmailer_path")); + $mail = new PHPMailer(); + + $mail->IsSMTP(); + $mail->Host = module::get_var("phpmailer", "smtp_server"); + + if (module::get_var("phpmailer", "smtp_login") != "") { + $mail->SMTPAuth = true; + $mail->Username = module::get_var("phpmailer", "smtp_login"); + $mail->Password = module::get_var("phpmailer", "smtp_password"); + } else { + $mail->SMTPAuth = false; + } + + $mail->From = module::get_var("phpmailer", "phpmailer_from_address"); + $mail->FromName = module::get_var("phpmailer", "phpmailer_from_name"); + $mail->AddAddress($to); + $mail->IsHTML(true); + $mail->Subject = $subject; + $mail->Body = $message; + + if ($mail->Send()) { + return true; + } else { + return false; + } + } +} \ No newline at end of file diff --git a/modules/phpmailer/module.info b/modules/phpmailer/module.info new file mode 100644 index 00000000..5c5b5b98 --- /dev/null +++ b/modules/phpmailer/module.info @@ -0,0 +1,3 @@ +name = PHPMailer +description = Use PHPMailer when sending email messages. +version = 1 diff --git a/modules/phpmailer/views/admin_phpmailer.html.php b/modules/phpmailer/views/admin_phpmailer.html.php new file mode 100644 index 00000000..04a0b6f5 --- /dev/null +++ b/modules/phpmailer/views/admin_phpmailer.html.php @@ -0,0 +1,5 @@ + +
+

+ +
From 843acb58995395ae45fa3048a8c92cf85424c7ce Mon Sep 17 00:00:00 2001 From: rWatcher Date: Wed, 22 Jul 2009 22:17:57 -0400 Subject: [PATCH 14/30] Use email of current logged in user for from line, also messed around with the line break code. --- modules/contactowner/controllers/contactowner.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/contactowner/controllers/contactowner.php b/modules/contactowner/controllers/contactowner.php index 5b082a49..845454a5 100644 --- a/modules/contactowner/controllers/contactowner.php +++ b/modules/contactowner/controllers/contactowner.php @@ -25,13 +25,13 @@ class ContactOwner_Controller extends Controller { if (module::get_var("contactowner", "contact_owner_link") != true) { kohana::show_404(); } - + // Make a new form with a couple of text boxes. $form = new Forge("contactowner/sendemail", "", "post", array("id" => "gContactOwnerSendForm")); $sendmail_fields = $form->group("contactOwner"); $sendmail_fields->input("email_to")->label(t("To:"))->value(module::get_var("contactowner", "contact_owner_name")); - $sendmail_fields->input("email_from")->label(t("From:"))->value(); + $sendmail_fields->input("email_from")->label(t("From:"))->value(user::active()->email); $sendmail_fields->input("email_subject")->label(t("Subject:"))->value(""); $sendmail_fields->textarea("email_body")->label(t("Message:"))->value(""); $sendmail_fields->hidden("email_to_id")->value("-1"); @@ -65,7 +65,7 @@ class ContactOwner_Controller extends Controller { array("id" => "gContactOwnerSendForm")); $sendmail_fields = $form->group("contactOwner"); $sendmail_fields->input("email_to")->label(t("To:"))->value($userDetails[0]->name); - $sendmail_fields->input("email_from")->label(t("From:"))->value(); + $sendmail_fields->input("email_from")->label(t("From:"))->value(user::active()->email); $sendmail_fields->input("email_subject")->label(t("Subject:"))->value(""); $sendmail_fields->textarea("email_body")->label(t("Message:"))->value(""); $sendmail_fields->hidden("email_to_id")->value($user_id); @@ -91,11 +91,11 @@ class ContactOwner_Controller extends Controller { $str_emailbody = Input::instance()->post("email_body"); // Add in some
tags to the message body where ever there are line breaks. - $str_emailbody = str_replace("\n", "
\n", $str_emailbody); + $str_emailbody = str_replace("\n", "\n
", $str_emailbody); // Gallery's Sendmail library doesn't allow for custom from addresses, // so add the from email to the beginning of the message body instead. - $str_emailbody = "Message Sent From " . $str_emailfrom . "

\n\n" . $str_emailbody; + $str_emailbody = "Message Sent From " . $str_emailfrom . "\r\n\r\n

" . $str_emailbody; // Figure out where the email is going to. $str_emailto = ""; From 60244af49b9e62c38890804c1739382d32d8b5e6 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Thu, 23 Jul 2009 22:21:49 -0400 Subject: [PATCH 15/30] Initial Commit (WARNING Still a work in progress) --- modules/tagsmap/controllers/admin_tagsmap.php | 147 ++++++++++++++++++ modules/tagsmap/controllers/tagsmap.php | 41 +++++ modules/tagsmap/helpers/tagsmap_installer.php | 42 +++++ modules/tagsmap/helpers/tagsmap_menu.php | 28 ++++ modules/tagsmap/helpers/tagsmap_theme.php | 38 +++++ modules/tagsmap/models/tags_gps.php | 21 +++ modules/tagsmap/module.info | 3 + modules/tagsmap/views/admin_tagsmap.html.php | 59 +++++++ .../tagsmap/views/admin_tagsmap_edit.html.php | 6 + modules/tagsmap/views/tagsmap_block.html.php | 7 + .../tagsmap/views/tagsmap_googlemap.html.php | 57 +++++++ 11 files changed, 449 insertions(+) create mode 100644 modules/tagsmap/controllers/admin_tagsmap.php create mode 100644 modules/tagsmap/controllers/tagsmap.php create mode 100644 modules/tagsmap/helpers/tagsmap_installer.php create mode 100644 modules/tagsmap/helpers/tagsmap_menu.php create mode 100644 modules/tagsmap/helpers/tagsmap_theme.php create mode 100644 modules/tagsmap/models/tags_gps.php create mode 100644 modules/tagsmap/module.info create mode 100644 modules/tagsmap/views/admin_tagsmap.html.php create mode 100644 modules/tagsmap/views/admin_tagsmap_edit.html.php create mode 100644 modules/tagsmap/views/tagsmap_block.html.php create mode 100644 modules/tagsmap/views/tagsmap_googlemap.html.php diff --git a/modules/tagsmap/controllers/admin_tagsmap.php b/modules/tagsmap/controllers/admin_tagsmap.php new file mode 100644 index 00000000..17677fd4 --- /dev/null +++ b/modules/tagsmap/controllers/admin_tagsmap.php @@ -0,0 +1,147 @@ +content = new View("admin_tagsmap.html"); + + // Generate a form for Google Maps Settings. + $view->content->googlemaps_form = $this->_get_googlemaps_form(); + + // Generate a list of tags to display. + $query = ORM::factory("tag"); + $view->content->tags = $query->orderby("name", "ASC")->find_all(); + + // Display the page. + print $view; + } + + public function edit_gps($tag_id) { + // Generate a new admin page to edit the tag specified by $tag_id. + $view = new Admin_View("admin.html"); + $view->content = new View("admin_tagsmap_edit.html"); + $view->content->tagsmapedit_form = $this->_get_tagsgpsedit_form($tag_id); + + print $view; + } + + private function _get_tagsgpsedit_form($tag_id) { + // Make a new Form. + $form = new Forge("admin/tagsmap/savegps", "", "post", + array("id" => "gTagsMapAdminForm")); + + // Add a few input boxes for GPS and Description + $tagsgps_group = $form->group("TagsMapGPS"); + $tagsgps_group->hidden("tag_id")->value($tag_id); + $tagsgps_group->input("gps_latitude")->label(t("Latitude"))->value(); + $tagsgps_group->input("gps_longitude")->label(t("Longitude"))->value(); + $tagsgps_group->textarea("gps_description")->label(t("Description"))->value(); + + // Add a save button to the form. + $tagsgps_group->submit("SaveGPS")->value(t("Save")); + + // Return the newly generated form. + return $form; + } + + public function savegps() { + // Save the GPS coordinates to the database. + + // Prevent Cross Site Request Forgery + access::verify_csrf(); + + // Figure out the values of the text boxes + $str_tagid = Input::instance()->post("tag_id"); + $str_latitude = Input::instance()->post("gps_latitude"); + $str_longitude = Input::instance()->post("gps_longitude"); + $str_description = Input::instance()->post("gps_description"); + + // Save to database. + $newgps = ORM::factory("tags_gps"); + $newgps->tag_id = $str_tagid; + $newgps->latitude = $str_latitude; + $newgps->longitude = $str_longitude; + $newgps->description = $str_description; + $newgps->save(); + + // Redirect back to the main screen and display a "success" message. + message::success(t("Your Settings Have Been Saved.")); + url::redirect("admin/tagsmap"); + } + + private function _get_googlemaps_form() { + // Make a new Form. + $form = new Forge("admin/tagsmap/savemapprefs", "", "post", + array("id" => "gTagsMapAdminForm")); + + // Input box for the Maps API Key + $googlemap_group = $form->group("GoogleMapsKey"); + $googlemap_group->input("google_api_key") + ->label(t("Google Maps API Key")) + ->value(module::get_var("tagsmap", "googlemap_api_key")); + + // Input boxes for the Maps starting location and zoom. + $startingmap_group = $form->group("GoogleMapsPos"); + $startingmap_group->input("google_starting_latitude") + ->label(t("Starting Latitude")) + ->value(module::get_var("tagsmap", "googlemap_latitude")); + $startingmap_group->input("google_starting_longitude") + ->label(t("Starting Longitude")) + ->value(module::get_var("tagsmap", "googlemap_longitude")); + $startingmap_group->input("google_default_zoom") + ->label(t("Default Zoom Level")) + ->value(module::get_var("tagsmap", "googlemap_zoom")); + $startingmap_group->input("google_default_type") + ->label(t("Default Map Type") . " (G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP, G_PHYSICAL_MAP, G_SATELLITE_3D_MAP)") + ->value(module::get_var("tagsmap", "googlemap_type")); + + // Add a save button to the form. + $form->submit("SaveSettings")->value(t("Save")); + + // Return the newly generated form. + return $form; + + } + + public function savemapprefs() { + // Prevent Cross Site Request Forgery + access::verify_csrf(); + + // Figure out the values of the text boxes + $str_googlekey = Input::instance()->post("google_api_key"); + $str_googlelatitude = Input::instance()->post("google_starting_latitude"); + $str_googlelongitude = Input::instance()->post("google_starting_longitude"); + $str_googlezoom = Input::instance()->post("google_default_zoom"); + $str_googlemaptype = Input::instance()->post("google_default_type"); + + // Save Settings. + module::set_var("tagsmap", "googlemap_api_key", $str_googlekey); + module::set_var("tagsmap", "googlemap_latitude", $str_googlelatitude); + module::set_var("tagsmap", "googlemap_longitude", $str_googlelongitude); + module::set_var("tagsmap", "googlemap_zoom", $str_googlezoom); + module::set_var("tagsmap", "googlemap_type", $str_googlemaptype); + message::success(t("Your Settings Have Been Saved.")); + + // Redirect back to the TagsMap admin page. + url::redirect("admin/tagsmap"); + } +} \ No newline at end of file diff --git a/modules/tagsmap/controllers/tagsmap.php b/modules/tagsmap/controllers/tagsmap.php new file mode 100644 index 00000000..88f0527d --- /dev/null +++ b/modules/tagsmap/controllers/tagsmap.php @@ -0,0 +1,41 @@ +content = new View("tagsmap_googlemap.html"); + + // Generate a list of GPS coordinates. + $tagsGPS = ORM::factory("tags_gps")->find_all(); + $template->content->tags_gps = $tagsGPS; + + // Load in module preferences. + $template->content->google_map_key = module::get_var("tagsmap", "googlemap_api_key"); + $template->content->google_map_latitude = module::get_var("tagsmap", "googlemap_latitude"); + $template->content->google_map_longitude = module::get_var("tagsmap", "googlemap_longitude"); + $template->content->google_map_zoom = module::get_var("tagsmap", "googlemap_zoom"); + $template->content->google_map_type = module::get_var("tagsmap", "googlemap_type"); + + print $template; + } +} diff --git a/modules/tagsmap/helpers/tagsmap_installer.php b/modules/tagsmap/helpers/tagsmap_installer.php new file mode 100644 index 00000000..f984f7c9 --- /dev/null +++ b/modules/tagsmap/helpers/tagsmap_installer.php @@ -0,0 +1,42 @@ +query("CREATE TABLE IF NOT EXISTS {tags_gpses} ( + `id` int(9) NOT NULL auto_increment, + `tag_id` int(9) NOT NULL, + `latitude` varchar(128) NOT NULL, + `longitude` varchar(128) NOT NULL, + `description` varchar(2048) default NULL, + PRIMARY KEY (`id`), + KEY(`tag_id`, `id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + module::set_version("tagsmap", 1); + } + + static function uninstall() { + $db = Database::instance(); + $db->query("DROP TABLE IF EXISTS {tags_gpses};"); + module::delete("tagsmap"); + } +} diff --git a/modules/tagsmap/helpers/tagsmap_menu.php b/modules/tagsmap/helpers/tagsmap_menu.php new file mode 100644 index 00000000..51fd041d --- /dev/null +++ b/modules/tagsmap/helpers/tagsmap_menu.php @@ -0,0 +1,28 @@ +get("content_menu") + ->append(Menu::factory("link") + ->id("tagsmap") + ->label(t("TagsMap Settings")) + ->url(url::site("admin/tagsmap"))); + } +} diff --git a/modules/tagsmap/helpers/tagsmap_theme.php b/modules/tagsmap/helpers/tagsmap_theme.php new file mode 100644 index 00000000..5f3fb1e7 --- /dev/null +++ b/modules/tagsmap/helpers/tagsmap_theme.php @@ -0,0 +1,38 @@ +item()) { + return; + } + + // Create a new block to display the link in. + $block = new Block(); + $block->css_id = "gTagsMap"; + $block->title = t("Map:"); + $block->content = new View("tagsmap_block.html"); + + return $block; + } +} diff --git a/modules/tagsmap/models/tags_gps.php b/modules/tagsmap/models/tags_gps.php new file mode 100644 index 00000000..c9fda760 --- /dev/null +++ b/modules/tagsmap/models/tags_gps.php @@ -0,0 +1,21 @@ + +

+ +

+
+

+ +

+
You may sign up for a Google Maps API key here.

+ +
+ +
+

+ +

+ count()/5 ?> + + + + + + + + +
+ count()) ?> +
+ $tag): ?> + name, 0, 1)) ?> + + + +
    + + $tags_per_column): /* new column */ ?> +
+ + + + + +
    + + +
  • + name) ?> + (count ?>) + + id") ?>"> + +
  • + + + + +
+
+
diff --git a/modules/tagsmap/views/admin_tagsmap_edit.html.php b/modules/tagsmap/views/admin_tagsmap_edit.html.php new file mode 100644 index 00000000..da0df96c --- /dev/null +++ b/modules/tagsmap/views/admin_tagsmap_edit.html.php @@ -0,0 +1,6 @@ + +
+

+ +
+ diff --git a/modules/tagsmap/views/tagsmap_block.html.php b/modules/tagsmap/views/tagsmap_block.html.php new file mode 100644 index 00000000..812352c9 --- /dev/null +++ b/modules/tagsmap/views/tagsmap_block.html.php @@ -0,0 +1,7 @@ + + diff --git a/modules/tagsmap/views/tagsmap_googlemap.html.php b/modules/tagsmap/views/tagsmap_googlemap.html.php new file mode 100644 index 00000000..66461998 --- /dev/null +++ b/modules/tagsmap/views/tagsmap_googlemap.html.php @@ -0,0 +1,57 @@ + + + + + + +Load Map + +
+ + +
From b1a55e2fc10db2c70a2a20470c623b592f9bd1e0 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Thu, 23 Jul 2009 23:37:56 -0400 Subject: [PATCH 16/30] Editing of existing GPS coordinates is now possible. --- modules/tagsmap/controllers/admin_tagsmap.php | 41 +++++++++++++++---- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/modules/tagsmap/controllers/admin_tagsmap.php b/modules/tagsmap/controllers/admin_tagsmap.php index 17677fd4..f4ffeb6b 100644 --- a/modules/tagsmap/controllers/admin_tagsmap.php +++ b/modules/tagsmap/controllers/admin_tagsmap.php @@ -52,9 +52,19 @@ class Admin_TagsMap_Controller extends Admin_Controller { // Add a few input boxes for GPS and Description $tagsgps_group = $form->group("TagsMapGPS"); $tagsgps_group->hidden("tag_id")->value($tag_id); - $tagsgps_group->input("gps_latitude")->label(t("Latitude"))->value(); - $tagsgps_group->input("gps_longitude")->label(t("Longitude"))->value(); - $tagsgps_group->textarea("gps_description")->label(t("Description"))->value(); + // Check and see if this ID already has GPS data. + $existingGPS = ORM::factory("tags_gps") + ->where("tag_id", $tag_id) + ->find_all(); + if (count($existingGPS) == 0) { + $tagsgps_group->input("gps_latitude")->label(t("Latitude"))->value(); + $tagsgps_group->input("gps_longitude")->label(t("Longitude"))->value(); + $tagsgps_group->textarea("gps_description")->label(t("Description"))->value(); + } else { + $tagsgps_group->input("gps_latitude")->label(t("Latitude"))->value($existingGPS[0]->latitude); + $tagsgps_group->input("gps_longitude")->label(t("Longitude"))->value($existingGPS[0]->longitude); + $tagsgps_group->textarea("gps_description")->label(t("Description"))->value($existingGPS[0]->description); + } // Add a save button to the form. $tagsgps_group->submit("SaveGPS")->value(t("Save")); @@ -76,12 +86,25 @@ class Admin_TagsMap_Controller extends Admin_Controller { $str_description = Input::instance()->post("gps_description"); // Save to database. - $newgps = ORM::factory("tags_gps"); - $newgps->tag_id = $str_tagid; - $newgps->latitude = $str_latitude; - $newgps->longitude = $str_longitude; - $newgps->description = $str_description; - $newgps->save(); + // Check and see if this ID already has GPS data. + $existingGPS = ORM::factory("tags_gps") + ->where("tag_id", $str_tagid) + ->find_all(); + if (count($existingGPS) == 0) { + $newgps = ORM::factory("tags_gps"); + $newgps->tag_id = $str_tagid; + $newgps->latitude = $str_latitude; + $newgps->longitude = $str_longitude; + $newgps->description = $str_description; + $newgps->save(); + } else { + $updatedGPS = ORM::factory("tags_gps", $existingGPS[0]->id); + $updatedGPS->tag_id = $str_tagid; + $updatedGPS->latitude = $str_latitude; + $updatedGPS->longitude = $str_longitude; + $updatedGPS->description = $str_description; + $updatedGPS->save(); + } // Redirect back to the main screen and display a "success" message. message::success(t("Your Settings Have Been Saved.")); From d711c84876187b2c16111b2459ed600d75dfb33a Mon Sep 17 00:00:00 2001 From: rWatcher Date: Fri, 24 Jul 2009 01:37:59 -0400 Subject: [PATCH 17/30] Auto-load the google map fix. --- modules/tagsmap/views/tagsmap_googlemap.html.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/tagsmap/views/tagsmap_googlemap.html.php b/modules/tagsmap/views/tagsmap_googlemap.html.php index 66461998..ebf399cd 100644 --- a/modules/tagsmap/views/tagsmap_googlemap.html.php +++ b/modules/tagsmap/views/tagsmap_googlemap.html.php @@ -1,10 +1,10 @@ - + + + -Load Map -
From 9511f75ac34774b3330c580a7b98d6539d45d1c9 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Fri, 24 Jul 2009 15:27:15 -0400 Subject: [PATCH 18/30] Added a delete button to the admin page. --- modules/tagsmap/controllers/admin_tagsmap.php | 13 +++++++++++++ modules/tagsmap/views/admin_tagsmap.html.php | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/modules/tagsmap/controllers/admin_tagsmap.php b/modules/tagsmap/controllers/admin_tagsmap.php index f4ffeb6b..561bcee9 100644 --- a/modules/tagsmap/controllers/admin_tagsmap.php +++ b/modules/tagsmap/controllers/admin_tagsmap.php @@ -44,6 +44,19 @@ class Admin_TagsMap_Controller extends Admin_Controller { print $view; } + public function delete_gps($tag_id) { + // Delete the GSP data associated with a tag. + + // Delete the record. + ORM::factory("tags_gps") + ->where("tag_id", $tag_id) + ->delete_all(); + + // Redirect back to the main screen and display a "success" message. + message::success(t("Your Settings Have Been Saved.")); + url::redirect("admin/tagsmap"); + } + private function _get_tagsgpsedit_form($tag_id) { // Make a new Form. $form = new Forge("admin/tagsmap/savegps", "", "post", diff --git a/modules/tagsmap/views/admin_tagsmap.html.php b/modules/tagsmap/views/admin_tagsmap.html.php index 305e5ba3..7412d6ee 100644 --- a/modules/tagsmap/views/admin_tagsmap.html.php +++ b/modules/tagsmap/views/admin_tagsmap.html.php @@ -46,6 +46,18 @@ (count ?>) id") ?>"> +where("tag_id", $tag->id) + ->find_all(); + if (count($existingGPS) > 0) { +?> + | id") ?>"> + + From 10f5fd22caedf03c257f1e23ea4bf4ee0f9a57c6 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Sat, 25 Jul 2009 00:34:05 -0400 Subject: [PATCH 19/30] Require Tags module. --- modules/tagsmap/helpers/tagsmap_event.php | 32 +++++++++++++++++++ modules/tagsmap/helpers/tagsmap_installer.php | 4 +++ 2 files changed, 36 insertions(+) create mode 100644 modules/tagsmap/helpers/tagsmap_event.php diff --git a/modules/tagsmap/helpers/tagsmap_event.php b/modules/tagsmap/helpers/tagsmap_event.php new file mode 100644 index 00000000..c752993b --- /dev/null +++ b/modules/tagsmap/helpers/tagsmap_event.php @@ -0,0 +1,32 @@ +deactivate)) { + site_status::warning( + t("The TagsMap module requires the Tags module. " . + "Activate the Tags module now", + array("url" => url::site("admin/modules"))), + "tagsmap_needs_tag"); + } else { + site_status::clear("tagsmap_needs_tag"); + } + } +} \ No newline at end of file diff --git a/modules/tagsmap/helpers/tagsmap_installer.php b/modules/tagsmap/helpers/tagsmap_installer.php index f984f7c9..8a46def5 100644 --- a/modules/tagsmap/helpers/tagsmap_installer.php +++ b/modules/tagsmap/helpers/tagsmap_installer.php @@ -34,6 +34,10 @@ class tagsmap_installer { module::set_version("tagsmap", 1); } + static function deactivate() { + site_status::clear("tagsmap_needs_tag"); + } + static function uninstall() { $db = Database::instance(); $db->query("DROP TABLE IF EXISTS {tags_gpses};"); From bf66e8403aae0406a743a77bd4d65bb44d6169f1 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Sat, 25 Jul 2009 00:58:31 -0400 Subject: [PATCH 20/30] Added a confirmation screen to the delete button. --- modules/tagsmap/controllers/admin_tagsmap.php | 10 ++++++++++ modules/tagsmap/views/admin_tagsmap.html.php | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/tagsmap/controllers/admin_tagsmap.php b/modules/tagsmap/controllers/admin_tagsmap.php index 561bcee9..e7c0711a 100644 --- a/modules/tagsmap/controllers/admin_tagsmap.php +++ b/modules/tagsmap/controllers/admin_tagsmap.php @@ -44,6 +44,16 @@ class Admin_TagsMap_Controller extends Admin_Controller { print $view; } + public function confirm_delete_gps($tag_id) { + // Make sure the user meant to hit the delete button. + // Make a new Form. + $view = new Admin_View("admin.html"); + $view->content = new View("admin_tagsmap_delete.html"); + $view->content->tag_id = $tag_id; + print $view; + + } + public function delete_gps($tag_id) { // Delete the GSP data associated with a tag. diff --git a/modules/tagsmap/views/admin_tagsmap.html.php b/modules/tagsmap/views/admin_tagsmap.html.php index 7412d6ee..a3208e75 100644 --- a/modules/tagsmap/views/admin_tagsmap.html.php +++ b/modules/tagsmap/views/admin_tagsmap.html.php @@ -53,7 +53,7 @@ ->find_all(); if (count($existingGPS) > 0) { ?> - | id") ?>"> + | id") ?>"> Date: Sat, 25 Jul 2009 01:17:24 -0400 Subject: [PATCH 21/30] Code cleanups, etc. --- modules/tagsmap/controllers/admin_tagsmap.php | 25 ++++++++++--------- modules/tagsmap/helpers/tagsmap_event.php | 2 ++ modules/tagsmap/helpers/tagsmap_installer.php | 4 ++- modules/tagsmap/helpers/tagsmap_menu.php | 1 + modules/tagsmap/views/admin_tagsmap.html.php | 23 ++++++++--------- .../tagsmap/views/tagsmap_googlemap.html.php | 9 +++---- 6 files changed, 33 insertions(+), 31 deletions(-) diff --git a/modules/tagsmap/controllers/admin_tagsmap.php b/modules/tagsmap/controllers/admin_tagsmap.php index e7c0711a..6bbe3056 100644 --- a/modules/tagsmap/controllers/admin_tagsmap.php +++ b/modules/tagsmap/controllers/admin_tagsmap.php @@ -36,22 +36,19 @@ class Admin_TagsMap_Controller extends Admin_Controller { } public function edit_gps($tag_id) { - // Generate a new admin page to edit the tag specified by $tag_id. + // Generate a new admin page to edit gps data for the tag specified by $tag_id. $view = new Admin_View("admin.html"); $view->content = new View("admin_tagsmap_edit.html"); $view->content->tagsmapedit_form = $this->_get_tagsgpsedit_form($tag_id); - print $view; } public function confirm_delete_gps($tag_id) { // Make sure the user meant to hit the delete button. - // Make a new Form. $view = new Admin_View("admin.html"); $view->content = new View("admin_tagsmap_delete.html"); $view->content->tag_id = $tag_id; print $view; - } public function delete_gps($tag_id) { @@ -68,14 +65,16 @@ class Admin_TagsMap_Controller extends Admin_Controller { } private function _get_tagsgpsedit_form($tag_id) { - // Make a new Form. + // Make a new form for editing GPS data associated with a tag ($tag_id). $form = new Forge("admin/tagsmap/savegps", "", "post", array("id" => "gTagsMapAdminForm")); // Add a few input boxes for GPS and Description $tagsgps_group = $form->group("TagsMapGPS"); $tagsgps_group->hidden("tag_id")->value($tag_id); - // Check and see if this ID already has GPS data. + + // Check and see if this ID already has GPS data, then create + // input boxes to either update it or enter in new information. $existingGPS = ORM::factory("tags_gps") ->where("tag_id", $tag_id) ->find_all(); @@ -109,7 +108,8 @@ class Admin_TagsMap_Controller extends Admin_Controller { $str_description = Input::instance()->post("gps_description"); // Save to database. - // Check and see if this ID already has GPS data. + // Check and see if this ID already has GPS data, + // Update it if it does, create a new record if it doesn't. $existingGPS = ORM::factory("tags_gps") ->where("tag_id", $str_tagid) ->find_all(); @@ -135,7 +135,7 @@ class Admin_TagsMap_Controller extends Admin_Controller { } private function _get_googlemaps_form() { - // Make a new Form. + // Make a new form for inputing information associated with google maps. $form = new Forge("admin/tagsmap/savemapprefs", "", "post", array("id" => "gTagsMapAdminForm")); @@ -145,7 +145,7 @@ class Admin_TagsMap_Controller extends Admin_Controller { ->label(t("Google Maps API Key")) ->value(module::get_var("tagsmap", "googlemap_api_key")); - // Input boxes for the Maps starting location and zoom. + // Input boxes for the Maps starting location map type and zoom. $startingmap_group = $form->group("GoogleMapsPos"); $startingmap_group->input("google_starting_latitude") ->label(t("Starting Latitude")) @@ -165,10 +165,11 @@ class Admin_TagsMap_Controller extends Admin_Controller { // Return the newly generated form. return $form; - } public function savemapprefs() { + // Save information associated with Google Maps to the database. + // Prevent Cross Site Request Forgery access::verify_csrf(); @@ -185,9 +186,9 @@ class Admin_TagsMap_Controller extends Admin_Controller { module::set_var("tagsmap", "googlemap_longitude", $str_googlelongitude); module::set_var("tagsmap", "googlemap_zoom", $str_googlezoom); module::set_var("tagsmap", "googlemap_type", $str_googlemaptype); - message::success(t("Your Settings Have Been Saved.")); - // Redirect back to the TagsMap admin page. + // Display a success message and redirect back to the TagsMap admin page. + message::success(t("Your Settings Have Been Saved.")); url::redirect("admin/tagsmap"); } } \ No newline at end of file diff --git a/modules/tagsmap/helpers/tagsmap_event.php b/modules/tagsmap/helpers/tagsmap_event.php index c752993b..eb1afc9a 100644 --- a/modules/tagsmap/helpers/tagsmap_event.php +++ b/modules/tagsmap/helpers/tagsmap_event.php @@ -19,6 +19,8 @@ */ class tagsmap_event_Core { static function module_change($changes) { + // See if the Tags module is installed, + // tell the user to install it if it isn't. if (!module::is_active("tag") || in_array("tag", $changes->deactivate)) { site_status::warning( t("The TagsMap module requires the Tags module. " . diff --git a/modules/tagsmap/helpers/tagsmap_installer.php b/modules/tagsmap/helpers/tagsmap_installer.php index 8a46def5..5fd7b754 100644 --- a/modules/tagsmap/helpers/tagsmap_installer.php +++ b/modules/tagsmap/helpers/tagsmap_installer.php @@ -19,8 +19,8 @@ */ class tagsmap_installer { static function install() { + // Create a table to store GPS data in. $db = Database::instance(); - $db->query("CREATE TABLE IF NOT EXISTS {tags_gpses} ( `id` int(9) NOT NULL auto_increment, `tag_id` int(9) NOT NULL, @@ -31,6 +31,7 @@ class tagsmap_installer { KEY(`tag_id`, `id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + // Set the module's version number. module::set_version("tagsmap", 1); } @@ -39,6 +40,7 @@ class tagsmap_installer { } static function uninstall() { + // Delete the GPS table before uninstalling. $db = Database::instance(); $db->query("DROP TABLE IF EXISTS {tags_gpses};"); module::delete("tagsmap"); diff --git a/modules/tagsmap/helpers/tagsmap_menu.php b/modules/tagsmap/helpers/tagsmap_menu.php index 51fd041d..3d9c92bb 100644 --- a/modules/tagsmap/helpers/tagsmap_menu.php +++ b/modules/tagsmap/helpers/tagsmap_menu.php @@ -19,6 +19,7 @@ */ class tagsmap_menu_Core { static function admin($menu, $theme) { + // Add a link to the TagsMap admin page to the Content menu. $menu->get("content_menu") ->append(Menu::factory("link") ->id("tagsmap") diff --git a/modules/tagsmap/views/admin_tagsmap.html.php b/modules/tagsmap/views/admin_tagsmap.html.php index a3208e75..c8226af9 100644 --- a/modules/tagsmap/views/admin_tagsmap.html.php +++ b/modules/tagsmap/views/admin_tagsmap.html.php @@ -46,19 +46,18 @@ (count ?>) id") ?>"> -where("tag_id", $tag->id) - ->find_all(); - if (count($existingGPS) > 0) { -?> - | id") ?>"> - - + where("tag_id", $tag->id) + ->find_all(); + if (count($existingGPS) > 0) { + ?> + | id") ?>"> + diff --git a/modules/tagsmap/views/tagsmap_googlemap.html.php b/modules/tagsmap/views/tagsmap_googlemap.html.php index ebf399cd..93d6d3ba 100644 --- a/modules/tagsmap/views/tagsmap_googlemap.html.php +++ b/modules/tagsmap/views/tagsmap_googlemap.html.php @@ -3,7 +3,7 @@ -
- - +

From 0fe270bd237f16c688eb0ff21d2ed876c71c44dc Mon Sep 17 00:00:00 2001 From: rWatcher Date: Sat, 25 Jul 2009 01:18:29 -0400 Subject: [PATCH 22/30] Confirmation message for the delete link. --- modules/tagsmap/views/admin_tagsmap_delete.html.php | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 modules/tagsmap/views/admin_tagsmap_delete.html.php diff --git a/modules/tagsmap/views/admin_tagsmap_delete.html.php b/modules/tagsmap/views/admin_tagsmap_delete.html.php new file mode 100644 index 00000000..34f1b7fb --- /dev/null +++ b/modules/tagsmap/views/admin_tagsmap_delete.html.php @@ -0,0 +1,9 @@ + +
+

+
+">Delete +">Cancel + +
+ From 9fccd596c976c34ee38a445d355ead02a99c2e19 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Sat, 25 Jul 2009 14:03:16 -0400 Subject: [PATCH 23/30] Fixed input box sizes and added javascript select code. --- .../views/embedlinks_album_block.html.php | 13 ++++-- .../views/embedlinks_bbcodedialog.html.php | 16 ++++---- .../views/embedlinks_htmldialog.html.php | 16 ++++---- .../views/embedlinks_photo_block.html.php | 41 +++++++++++-------- 4 files changed, 48 insertions(+), 38 deletions(-) diff --git a/modules/embedlinks/views/embedlinks_album_block.html.php b/modules/embedlinks/views/embedlinks_album_block.html.php index dafca2ec..210b13bd 100644 --- a/modules/embedlinks/views/embedlinks_album_block.html.php +++ b/modules/embedlinks/views/embedlinks_album_block.html.php @@ -1,4 +1,9 @@ + @@ -8,12 +13,12 @@ - + - + @@ -28,12 +33,12 @@ - + type}s/{$item->id}") ?>]Click Here[/url]" /> - + type}s/{$item->id}") ?>][img]thumb_url(true) ?>[/img][/url]" /> diff --git a/modules/embedlinks/views/embedlinks_bbcodedialog.html.php b/modules/embedlinks/views/embedlinks_bbcodedialog.html.php index 43f4a72f..ea83bb0f 100644 --- a/modules/embedlinks/views/embedlinks_bbcodedialog.html.php +++ b/modules/embedlinks/views/embedlinks_bbcodedialog.html.php @@ -1,20 +1,20 @@

-
+
- - + + - - + + diff --git a/modules/embedlinks/views/embedlinks_htmldialog.html.php b/modules/embedlinks/views/embedlinks_htmldialog.html.php index 93dfacd9..2524648a 100644 --- a/modules/embedlinks/views/embedlinks_htmldialog.html.php +++ b/modules/embedlinks/views/embedlinks_htmldialog.html.php @@ -1,20 +1,20 @@

-
+
-
- + + - - + + diff --git a/modules/embedlinks/views/embedlinks_photo_block.html.php b/modules/embedlinks/views/embedlinks_photo_block.html.php index 9d50c32a..08a9b387 100644 --- a/modules/embedlinks/views/embedlinks_photo_block.html.php +++ b/modules/embedlinks/views/embedlinks_photo_block.html.php @@ -1,4 +1,9 @@ +

@@ -10,17 +15,17 @@ - + - + - + @@ -30,17 +35,17 @@ - + - + - + @@ -50,17 +55,17 @@ - + - + - + @@ -77,17 +82,17 @@ - + - + - + @@ -97,17 +102,17 @@ - + - + - + @@ -117,17 +122,17 @@ - + - + - + From 035134f428b99ca0a1fcfb2493ba39a67b6193e3 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Sun, 26 Jul 2009 00:32:55 -0400 Subject: [PATCH 24/30] Fix for google earth plugin. --- modules/tagsmap/views/tagsmap_googlemap.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tagsmap/views/tagsmap_googlemap.html.php b/modules/tagsmap/views/tagsmap_googlemap.html.php index 93d6d3ba..1b7f3298 100644 --- a/modules/tagsmap/views/tagsmap_googlemap.html.php +++ b/modules/tagsmap/views/tagsmap_googlemap.html.php @@ -3,7 +3,7 @@ - -
-
+ +
+ + +

+ "> + +

+ From e410a2cbd84fd65971b804053486e390aa44efeb Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 29 Jul 2009 18:00:23 -0700 Subject: [PATCH 27/30] Fold code from xxx_menu helpers into xxx_event to match a recent API change. --- ...towner_menu.php => contactowner_event.php} | 4 +-- ...developer_menu.php => developer_event.php} | 4 +-- ...ze_menu.php => downloadfullsize_event.php} | 6 ++-- .../{dynamic_menu.php => dynamic_event.php} | 4 +-- ...bedlinks_menu.php => embedlinks_event.php} | 4 +-- ...cs_menu.php => google_analytics_event.php} | 4 +-- ...phpmailer_menu.php => phpmailer_event.php} | 4 +-- modules/tagsmap/helpers/tagsmap_event.php | 11 ++++++- modules/tagsmap/helpers/tagsmap_menu.php | 29 ------------------- 9 files changed, 25 insertions(+), 45 deletions(-) rename modules/contactowner/helpers/{contactowner_menu.php => contactowner_event.php} (93%) rename modules/developer/helpers/{developer_menu.php => developer_event.php} (97%) rename modules/downloadfullsize/helpers/{downloadfullsize_menu.php => downloadfullsize_event.php} (92%) rename modules/dynamic/helpers/{dynamic_menu.php => dynamic_event.php} (93%) rename modules/embedlinks/helpers/{embedlinks_menu.php => embedlinks_event.php} (93%) rename modules/google_analytics/helpers/{google_analytics_menu.php => google_analytics_event.php} (93%) rename modules/phpmailer/helpers/{phpmailer_menu.php => phpmailer_event.php} (93%) delete mode 100644 modules/tagsmap/helpers/tagsmap_menu.php diff --git a/modules/contactowner/helpers/contactowner_menu.php b/modules/contactowner/helpers/contactowner_event.php similarity index 93% rename from modules/contactowner/helpers/contactowner_menu.php rename to modules/contactowner/helpers/contactowner_event.php index 3a00bf1e..6ebfccd9 100644 --- a/modules/contactowner/helpers/contactowner_menu.php +++ b/modules/contactowner/helpers/contactowner_event.php @@ -17,8 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class contactowner_menu_Core { - static function admin($menu, $theme) { +class contactowner_event_Core { + static function admin_menu($menu, $theme) { $menu->get("settings_menu") ->append(Menu::factory("link") ->id("contactowner") diff --git a/modules/developer/helpers/developer_menu.php b/modules/developer/helpers/developer_event.php similarity index 97% rename from modules/developer/helpers/developer_menu.php rename to modules/developer/helpers/developer_event.php index e5a39b5c..0e3ed49d 100644 --- a/modules/developer/helpers/developer_menu.php +++ b/modules/developer/helpers/developer_event.php @@ -17,8 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class developer_menu_Core { - static function admin($menu, $theme) { +class developer_event_Core { + static function admin_menu($menu, $theme) { $developer_menu = Menu::factory("submenu") ->id("developer_menu") ->label(t("Developer Tools")); diff --git a/modules/downloadfullsize/helpers/downloadfullsize_menu.php b/modules/downloadfullsize/helpers/downloadfullsize_event.php similarity index 92% rename from modules/downloadfullsize/helpers/downloadfullsize_menu.php rename to modules/downloadfullsize/helpers/downloadfullsize_event.php index d7095cc5..99bf42bd 100644 --- a/modules/downloadfullsize/helpers/downloadfullsize_menu.php +++ b/modules/downloadfullsize/helpers/downloadfullsize_event.php @@ -17,8 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class downloadfullsize_menu_Core { - static function photo($menu, $theme) { +class downloadfullsize_event_Core { + static function photo_menu($menu, $theme) { if (access::can("view_full", $theme->item)) { if (module::get_var("downloadfullsize", "fButton")) { $downloadLink = url::site("downloadfullsize/send/$theme->item"); @@ -32,7 +32,7 @@ class downloadfullsize_menu_Core { } } - static function admin($menu, $theme) { + static function admin_menu($menu, $theme) { $menu->get("settings_menu") ->append(Menu::factory("link") ->id("downloadfullsize") diff --git a/modules/dynamic/helpers/dynamic_menu.php b/modules/dynamic/helpers/dynamic_event.php similarity index 93% rename from modules/dynamic/helpers/dynamic_menu.php rename to modules/dynamic/helpers/dynamic_event.php index b2c73d6f..d03943a2 100644 --- a/modules/dynamic/helpers/dynamic_menu.php +++ b/modules/dynamic/helpers/dynamic_event.php @@ -16,8 +16,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class dynamic_menu { - static function admin($menu, $theme) { +class dynamic_event_Core { + static function admin_menu($menu, $theme) { $menu->get("content_menu") ->append(Menu::factory("link") ->id("dynamic_menu") diff --git a/modules/embedlinks/helpers/embedlinks_menu.php b/modules/embedlinks/helpers/embedlinks_event.php similarity index 93% rename from modules/embedlinks/helpers/embedlinks_menu.php rename to modules/embedlinks/helpers/embedlinks_event.php index 64698e7f..83b461e1 100644 --- a/modules/embedlinks/helpers/embedlinks_menu.php +++ b/modules/embedlinks/helpers/embedlinks_event.php @@ -17,8 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class embedlinks_menu_Core { - static function admin($menu, $theme) { +class embedlinks_event_Core { + static function admin_menu($menu, $theme) { $menu->get("settings_menu") ->append(Menu::factory("link") ->id("embedlinks") diff --git a/modules/google_analytics/helpers/google_analytics_menu.php b/modules/google_analytics/helpers/google_analytics_event.php similarity index 93% rename from modules/google_analytics/helpers/google_analytics_menu.php rename to modules/google_analytics/helpers/google_analytics_event.php index 203af868..e1f2b146 100644 --- a/modules/google_analytics/helpers/google_analytics_menu.php +++ b/modules/google_analytics/helpers/google_analytics_event.php @@ -17,8 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class google_analytics_menu { - static function admin($menu, $theme) { +class google_analytics_event_Core { + static function admin_menu($menu, $theme) { $menu->get("settings_menu") ->append(Menu::factory("link") ->id("google_analytics_menu") diff --git a/modules/phpmailer/helpers/phpmailer_menu.php b/modules/phpmailer/helpers/phpmailer_event.php similarity index 93% rename from modules/phpmailer/helpers/phpmailer_menu.php rename to modules/phpmailer/helpers/phpmailer_event.php index 55e5280f..e5de5170 100644 --- a/modules/phpmailer/helpers/phpmailer_menu.php +++ b/modules/phpmailer/helpers/phpmailer_event.php @@ -17,8 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class phpmailer_menu_Core { - static function admin($menu, $theme) { +class phpmailer_event_Core { + static function admin_menu($menu, $theme) { $menu->get("settings_menu") ->append(Menu::factory("link") ->id("phpmailer") diff --git a/modules/tagsmap/helpers/tagsmap_event.php b/modules/tagsmap/helpers/tagsmap_event.php index eb1afc9a..27b47ca6 100644 --- a/modules/tagsmap/helpers/tagsmap_event.php +++ b/modules/tagsmap/helpers/tagsmap_event.php @@ -19,7 +19,7 @@ */ class tagsmap_event_Core { static function module_change($changes) { - // See if the Tags module is installed, + // See if the Tags module is installed, // tell the user to install it if it isn't. if (!module::is_active("tag") || in_array("tag", $changes->deactivate)) { site_status::warning( @@ -31,4 +31,13 @@ class tagsmap_event_Core { site_status::clear("tagsmap_needs_tag"); } } + + static function admin_menu($menu, $theme) { + // Add a link to the TagsMap admin page to the Content menu. + $menu->get("content_menu") + ->append(Menu::factory("link") + ->id("tagsmap") + ->label(t("TagsMap Settings")) + ->url(url::site("admin/tagsmap"))); + } } \ No newline at end of file diff --git a/modules/tagsmap/helpers/tagsmap_menu.php b/modules/tagsmap/helpers/tagsmap_menu.php deleted file mode 100644 index 3d9c92bb..00000000 --- a/modules/tagsmap/helpers/tagsmap_menu.php +++ /dev/null @@ -1,29 +0,0 @@ -get("content_menu") - ->append(Menu::factory("link") - ->id("tagsmap") - ->label(t("TagsMap Settings")) - ->url(url::site("admin/tagsmap"))); - } -} From c7fcf14df405769c1b6afe812b46747c97e31314 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Thu, 30 Jul 2009 00:27:16 -0400 Subject: [PATCH 28/30] Initial Commit of KeepOriginal. --- .../keeporiginal/controllers/keeporiginal.php | 55 +++ modules/keeporiginal/helpers/graphics.php | 418 ++++++++++++++++++ .../helpers/keeporiginal_event.php | 46 ++ .../helpers/keeporiginal_installer.php | 29 ++ .../helpers/keeporiginal_menu.php | 38 ++ modules/keeporiginal/module.info | 3 + 6 files changed, 589 insertions(+) create mode 100644 modules/keeporiginal/controllers/keeporiginal.php create mode 100644 modules/keeporiginal/helpers/graphics.php create mode 100644 modules/keeporiginal/helpers/keeporiginal_event.php create mode 100644 modules/keeporiginal/helpers/keeporiginal_installer.php create mode 100644 modules/keeporiginal/helpers/keeporiginal_menu.php create mode 100644 modules/keeporiginal/module.info diff --git a/modules/keeporiginal/controllers/keeporiginal.php b/modules/keeporiginal/controllers/keeporiginal.php new file mode 100644 index 00000000..8c567d2f --- /dev/null +++ b/modules/keeporiginal/controllers/keeporiginal.php @@ -0,0 +1,55 @@ +file_path()); + + if ($item->is_photo() && file_exists($original_image)) { + + unlink($item->file_path()); + rename($original_image, $item->file_path()); + + $item_data = model_cache::get("item", $id); + $item_data->resize_dirty= 1; + $item_data->thumb_dirty= 1; + $item_data->save(); + + graphics::generate($item_data); + + $parent = $item_data->parent(); + if ($parent->album_cover_item_id == $item_data->id) { + copy($item_data->thumb_path(), $parent->thumb_path()); + $parent->thumb_width = $item_data->thumb_width; + $parent->thumb_height = $item_data->thumb_height; + $parent->save(); + } + + message::success(t("Your Original Image Has Been Restored.")); + url::redirect($item->url()); + + } + } +} diff --git a/modules/keeporiginal/helpers/graphics.php b/modules/keeporiginal/helpers/graphics.php new file mode 100644 index 00000000..fa65c962 --- /dev/null +++ b/modules/keeporiginal/helpers/graphics.php @@ -0,0 +1,418 @@ + 200, "height" => 200, "master" => Image::AUTO), 100); + * + * Specifies that "gallery" is adding a rule to resize thumbnails down to a max of 200px on + * the longest side. The gallery module adds default rules at a priority of 100. You can set + * higher and lower priorities to perform operations before or after this fires. + * + * @param string $module_name the module that added the rule + * @param string $target the target for this operation ("thumb" or "resize") + * @param string $operation the name of the operation + * @param array $args arguments to the operation + * @param integer $priority the priority for this rule (lower priorities are run first) + */ + static function add_rule($module_name, $target, $operation, $args, $priority) { + $rule = ORM::factory("graphics_rule"); + $rule->module_name = $module_name; + $rule->target = $target; + $rule->operation = $operation; + $rule->priority = $priority; + $rule->args = serialize($args); + $rule->active = true; + $rule->save(); + + self::mark_dirty($target == "thumb", $target == "resize"); + } + + /** + * Remove any matching graphics rules + * @param string $module_name the module that added the rule + * @param string $target the target for this operation ("thumb" or "resize") + * @param string $operation the name of the operation + */ + static function remove_rule($module_name, $target, $operation) { + ORM::factory("graphics_rule") + ->where("module_name", $module_name) + ->where("target", $target) + ->where("operation", $operation) + ->delete_all(); + + self::mark_dirty($target == "thumb", $target == "resize"); + } + + /** + * Remove all rules for this module + * @param string $module_name + */ + static function remove_rules($module_name) { + $status = Database::instance()->delete("graphics_rules", array("module_name" => $module_name)); + if (count($status)) { + self::mark_dirty(true, true); + } + } + + /** + * Activate the rules for this module, typically done when the module itself is deactivated. + * Note that this does not mark images as dirty so that if you deactivate and reactivate a + * module it won't cause all of your images to suddenly require a rebuild. + */ + static function activate_rules($module_name) { + Database::instance() + ->update("graphics_rules",array("active" => true), array("module_name" => $module_name)); + } + + /** + * Deactivate the rules for this module, typically done when the module itself is deactivated. + * Note that this does not mark images as dirty so that if you deactivate and reactivate a + * module it won't cause all of your images to suddenly require a rebuild. + */ + static function deactivate_rules($module_name) { + Database::instance() + ->update("graphics_rules",array("active" => false), array("module_name" => $module_name)); + } + + /** + * Rebuild the thumb and resize for the given item. + * @param Item_Model $item + * @return true on successful generation + */ + static function generate($item) { + if ($item->is_album()) { + if (!$cover = $item->album_cover()) { + return false; + } + $input_file = $cover->file_path(); + $input_item = $cover; + } else { + $input_file = $item->file_path(); + $input_item = $item; + } + + if ($item->thumb_dirty) { + $ops["thumb"] = $item->thumb_path(); + } + if ($item->resize_dirty && !$item->is_album() && !$item->is_movie()) { + $ops["resize"] = $item->resize_path(); + } + + if (empty($ops)) { + $item->thumb_dirty = 0; + $item->resize_dirty = 0; + $item->save(); + return true; + } + + try { + foreach ($ops as $target => $output_file) { + if ($input_item->is_movie()) { + // Convert the movie to a JPG first + $output_file = preg_replace("/...$/", "jpg", $output_file); + try { + movie::extract_frame($input_file, $output_file); + } catch (Exception $e) { + // Assuming this is MISSING_FFMPEG for now + copy(MODPATH . "gallery/images/missing_movie.png", $output_file); + } + $working_file = $output_file; + } else { + $working_file = $input_file; + } + + foreach (ORM::factory("graphics_rule") + ->where("target", $target) + ->where("active", true) + ->orderby("priority", "asc") + ->find_all() as $rule) { + $args = array($working_file, $output_file, unserialize($rule->args)); + call_user_func_array(array("graphics", $rule->operation), $args); + $working_file = $output_file; + } + } + + if (!empty($ops["thumb"])) { + $dims = getimagesize($item->thumb_path()); + $item->thumb_width = $dims[0]; + $item->thumb_height = $dims[1]; + $item->thumb_dirty = 0; + } + + if (!empty($ops["resize"])) { + $dims = getimagesize($item->resize_path()); + $item->resize_width = $dims[0]; + $item->resize_height = $dims[1]; + $item->resize_dirty = 0; + } + $item->save(); + } catch (Exception $e) { + // Something went wrong rebuilding the image. Leave it dirty and move on. + // @todo we should handle this better. + Kohana::log("error", "Caught exception rebuilding image: {$item->title}\n" . + $e->getMessage() . "\n" . $e->getTraceAsString()); + return false; + } + + return true; + } + + /** + * Resize an image. Valid options are width, height and master. Master is one of the Image + * master dimension constants. + * + * @param string $input_file + * @param string $output_file + * @param array $options + */ + static function resize($input_file, $output_file, $options) { + if (!self::$init) { + self::init_toolkit(); + } + + if (@filesize($input_file) == 0) { + throw new Exception("@todo EMPTY_INPUT_FILE"); + } + + $dims = getimagesize($input_file); + if (max($dims[0], $dims[1]) < min($options["width"], $options["height"])) { + // Image would get upscaled; do nothing + copy($input_file, $output_file); + } else { + Image::factory($input_file) + ->resize($options["width"], $options["height"], $options["master"]) + ->quality(module::get_var("gallery", "image_quality")) + ->save($output_file); + } + } + + /** + * Rotate an image. Valid options are degrees + * + * @param string $input_file + * @param string $output_file + * @param array $options + */ + static function rotate($input_file, $output_file, $options) { + if (!self::$init) { + self::init_toolkit(); + } + + // BEGIN rWatcher MOD: + if (strncmp($input_file, VARPATH . "albums/", strlen(VARPATH . "albums/")) == 0) { + $temp_path = str_replace(VARPATH . "albums/", "", $input_file); + $original_image = VARPATH . "original/" . $temp_path; + $individual_dirs = split("[/\]", $temp_path); + if (!file_exists($original_image)) { + $new_img_path = VARPATH . "original/"; + for($i = 0; $i < count($individual_dirs)-1; $i++) { + $new_img_path = $new_img_path . "/" . $individual_dirs[$i]; + if(!file_exists($new_img_path)) { + @mkdir($new_img_path); + } + } + copy($input_file, $original_image); + } + } + // END rWatcher MOD. + + Image::factory($input_file) + ->quality(module::get_var("gallery", "image_quality")) + ->rotate($options["degrees"]) + ->save($output_file); + } + + /** + * Overlay an image on top of the input file. + * + * Valid options are: file, mime_type, position, transparency_percent, padding + * + * Valid positions: northwest, north, northeast, + * west, center, east, + * southwest, south, southeast + * + * padding is in pixels + * + * @param string $input_file + * @param string $output_file + * @param array $options + */ + static function composite($input_file, $output_file, $options) { + if (!self::$init) { + self::init_toolkit(); + } + + list ($width, $height) = getimagesize($input_file); + list ($w_width, $w_height) = getimagesize($options["file"]); + + $pad = isset($options["padding"]) ? $options["padding"] : 10; + $top = $pad; + $left = $pad; + $y_center = max($height / 2 - $w_height / 2, $pad); + $x_center = max($width / 2 - $w_width / 2, $pad); + $bottom = max($height - $w_height - $pad, $pad); + $right = max($width - $w_width - $pad, $pad); + + switch ($options["position"]) { + case "northwest": $x = $left; $y = $top; break; + case "north": $x = $x_center; $y = $top; break; + case "northeast": $x = $right; $y = $top; break; + case "west": $x = $left; $y = $y_center; break; + case "center": $x = $x_center; $y = $y_center; break; + case "east": $x = $right; $y = $y_center; break; + case "southwest": $x = $left; $y = $bottom; break; + case "south": $x = $x_center; $y = $bottom; break; + case "southeast": $x = $right; $y = $bottom; break; + } + + Image::factory($input_file) + ->composite($options["file"], $x, $y, $options["transparency"]) + ->quality(module::get_var("gallery", "image_quality")) + ->save($output_file); + } + + /** + * Return a query result that locates all items with dirty images. + * @return Database_Result Query result + */ + static function find_dirty_images_query() { + return Database::instance()->query( + "SELECT `id` FROM {items} " . + "WHERE ((`thumb_dirty` = 1 AND (`type` <> 'album' OR `album_cover_item_id` IS NOT NULL))" . + " OR (`resize_dirty` = 1 AND `type` = 'photo')) " . + " AND `id` != 1"); + } + + /** + * Mark thumbnails and resizes as dirty. They will have to be rebuilt. + */ + static function mark_dirty($thumbs, $resizes) { + if ($thumbs || $resizes) { + $db = Database::instance(); + $fields = array(); + if ($thumbs) { + $fields["thumb_dirty"] = 1; + } + if ($resizes) { + $fields["resize_dirty"] = 1; + } + $db->update("items", $fields, true); + } + + $count = self::find_dirty_images_query()->count(); + if ($count) { + site_status::warning( + t2("One of your photos is out of date. Click here to fix it", + "%count of your photos are out of date. Click here to fix them", + $count, + array("attrs" => sprintf( + 'href="%s" class="gDialogLink"', + url::site("admin/maintenance/start/gallery_task::rebuild_dirty_images?csrf=__CSRF__")))), + "graphics_dirty"); + } + } + + /** + * Detect which graphics toolkits are available on this system. Return an array of key value + * pairs where the key is one of gd, imagemagick, graphicsmagick and the value is information + * about that toolkit. For GD we return the version string, and for ImageMagick and + * GraphicsMagick we return the path to the directory containing the appropriate binaries. + */ + static function detect_toolkits() { + $gd = function_exists("gd_info") ? gd_info() : array(); + $exec = function_exists("exec"); + if (!isset($gd["GD Version"])) { + $gd["GD Version"] = false; + } + putenv("PATH=" . getenv("PATH") . ":/usr/local/bin:/opt/local/bin:/opt/bin"); + return array("gd" => $gd, + "imagemagick" => $exec ? dirname(exec("which convert")) : false, + "graphicsmagick" => $exec ? dirname(exec("which gm")) : false); + } + + /** + * This needs to be run once, after the initial install, to choose a graphics toolkit. + */ + static function choose_default_toolkit() { + // Detect a graphics toolkit + $toolkits = graphics::detect_toolkits(); + foreach (array("imagemagick", "graphicsmagick", "gd") as $tk) { + if ($toolkits[$tk]) { + module::set_var("gallery", "graphics_toolkit", $tk); + module::set_var("gallery", "graphics_toolkit_path", $tk == "gd" ? "" : $toolkits[$tk]); + break; + } + } + if (!module::get_var("gallery", "graphics_toolkit")) { + site_status::warning( + t("Graphics toolkit missing! Please choose a toolkit", + array("url" => url::site("admin/graphics"))), + "missing_graphics_toolkit"); + } + } + + /** + * Choose which driver the Kohana Image library uses. + */ + static function init_toolkit() { + switch(module::get_var("gallery", "graphics_toolkit")) { + case "gd": + Kohana::config_set("image.driver", "GD"); + break; + + case "imagemagick": + Kohana::config_set("image.driver", "ImageMagick"); + Kohana::config_set( + "image.params.directory", module::get_var("gallery", "graphics_toolkit_path")); + break; + + case "graphicsmagick": + Kohana::config_set("image.driver", "GraphicsMagick"); + Kohana::config_set( + "image.params.directory", module::get_var("gallery", "graphics_toolkit_path")); + break; + } + + self::$init = 1; + } + + /** + * Verify that a specific graphics function is available with the active toolkit. + * @param string $func (eg rotate, resize) + * @return boolean + */ + static function can($func) { + if (module::get_var("gallery", "graphics_toolkit") == "gd" && + $func == "rotate" && + !function_exists("imagerotate")) { + return false; + } + + return true; + } +} diff --git a/modules/keeporiginal/helpers/keeporiginal_event.php b/modules/keeporiginal/helpers/keeporiginal_event.php new file mode 100644 index 00000000..bc456183 --- /dev/null +++ b/modules/keeporiginal/helpers/keeporiginal_event.php @@ -0,0 +1,46 @@ +is_photo()) { + $original_file = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path()); + if (file_exists($original_file)) { + unlink($original_file); + } + } + if ($item->is_album()) { + $original_file = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path()); + if (file_exists($original_file)) { + @dir::unlink($original_file); + } + } + } + static function item_updated($old, $new) { + if ($old->is_photo() || $old->is_album()) { + if ($old->file_path() != $new->file_path()) { + $old_original = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $old->file_path()); + $new_original = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $new->file_path()); + if (file_exists($old_original)) { + rename($old_original, $new_original); + } + } + } + } +} \ No newline at end of file diff --git a/modules/keeporiginal/helpers/keeporiginal_installer.php b/modules/keeporiginal/helpers/keeporiginal_installer.php new file mode 100644 index 00000000..e4a0c8b3 --- /dev/null +++ b/modules/keeporiginal/helpers/keeporiginal_installer.php @@ -0,0 +1,29 @@ +item(); + + if ((access::can("view", $item)) && (access::can("edit", $item))) { + $original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path()); + + if ($item->is_photo() && file_exists($original_image)) { + $menu->get("options_menu") + ->append(Menu::factory("link") + ->id("restore") + ->label("Restore Original") + ->css_id("gKeepOriginalLink") + ->url(url::site("keeporiginal/restore/" . $item->id))); + } + } + } +} diff --git a/modules/keeporiginal/module.info b/modules/keeporiginal/module.info new file mode 100644 index 00000000..8dfc3723 --- /dev/null +++ b/modules/keeporiginal/module.info @@ -0,0 +1,3 @@ +name = Keep Original +description = Make a copy of the original photo before editing it. +version = 1 From 3d72faca19d4e23c2bdfc070658e17c9b0e23780 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Thu, 30 Jul 2009 00:48:59 -0400 Subject: [PATCH 29/30] Code comments. --- modules/keeporiginal/controllers/keeporiginal.php | 13 ++++++++++--- modules/keeporiginal/helpers/graphics.php | 5 +++++ modules/keeporiginal/helpers/keeporiginal_event.php | 8 ++++++++ modules/keeporiginal/helpers/keeporiginal_menu.php | 2 +- modules/keeporiginal/module.info | 2 +- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/modules/keeporiginal/controllers/keeporiginal.php b/modules/keeporiginal/controllers/keeporiginal.php index 8c567d2f..b364db75 100644 --- a/modules/keeporiginal/controllers/keeporiginal.php +++ b/modules/keeporiginal/controllers/keeporiginal.php @@ -20,25 +20,32 @@ class keeporiginal_Controller extends Controller { public function restore($id) { + // Allow the user to restore the original photo. + + // Make sure the current user has suficient access to view and edit the item. $item = ORM::factory("item", $id); - access::required("view", $item); access::required("edit", $item); + // Figure out where the original was stashed at. $original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path()); + // Make sure the current item is a photo and that an original exists. if ($item->is_photo() && file_exists($original_image)) { + // Delete the modified version and move the original over in place of it. unlink($item->file_path()); rename($original_image, $item->file_path()); + // Re-generate the items resize and thumbnail. $item_data = model_cache::get("item", $id); $item_data->resize_dirty= 1; $item_data->thumb_dirty= 1; $item_data->save(); - graphics::generate($item_data); + // If the item is the thumbnail for the parent album, + // fix the parent's thumbnail as well. $parent = $item_data->parent(); if ($parent->album_cover_item_id == $item_data->id) { copy($item_data->thumb_path(), $parent->thumb_path()); @@ -47,9 +54,9 @@ class keeporiginal_Controller extends Controller { $parent->save(); } + // Display a success message and redirect to the items page. message::success(t("Your Original Image Has Been Restored.")); url::redirect($item->url()); - } } } diff --git a/modules/keeporiginal/helpers/graphics.php b/modules/keeporiginal/helpers/graphics.php index fa65c962..6f22d23e 100644 --- a/modules/keeporiginal/helpers/graphics.php +++ b/modules/keeporiginal/helpers/graphics.php @@ -224,10 +224,15 @@ class graphics_Core { } // BEGIN rWatcher MOD: + // If $input_file is located in VARPATH/albums/ then assume its a fullsize photo. if (strncmp($input_file, VARPATH . "albums/", strlen(VARPATH . "albums/")) == 0) { + // Figure out where the original copy should be stashed at. $temp_path = str_replace(VARPATH . "albums/", "", $input_file); $original_image = VARPATH . "original/" . $temp_path; $individual_dirs = split("[/\]", $temp_path); + // If any original file does not already exist, then create a folder structure + // similar to that found in VARPATH/albums/ and copy the photo over before + // rotating it. if (!file_exists($original_image)) { $new_img_path = VARPATH . "original/"; for($i = 0; $i < count($individual_dirs)-1; $i++) { diff --git a/modules/keeporiginal/helpers/keeporiginal_event.php b/modules/keeporiginal/helpers/keeporiginal_event.php index bc456183..1d4e717b 100644 --- a/modules/keeporiginal/helpers/keeporiginal_event.php +++ b/modules/keeporiginal/helpers/keeporiginal_event.php @@ -19,12 +19,16 @@ */ class keeporiginal_event_Core { static function item_before_delete($item) { + // If deleting a photo, make sure the original is deleted as well, if it exists. if ($item->is_photo()) { $original_file = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path()); if (file_exists($original_file)) { unlink($original_file); } } + + // When deleting an album, make sure its corresponding location in + // VARPATH/original/ is deleted as well, if it exists. if ($item->is_album()) { $original_file = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path()); if (file_exists($original_file)) { @@ -32,7 +36,11 @@ class keeporiginal_event_Core { } } } + static function item_updated($old, $new) { + // When updating an item, check and see if the file name is being changed. + // If so, check for and modify any corresponding file/folder in + // VARPATH/original/ as well. if ($old->is_photo() || $old->is_album()) { if ($old->file_path() != $new->file_path()) { $old_original = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $old->file_path()); diff --git a/modules/keeporiginal/helpers/keeporiginal_menu.php b/modules/keeporiginal/helpers/keeporiginal_menu.php index 11329828..7f88f9d4 100644 --- a/modules/keeporiginal/helpers/keeporiginal_menu.php +++ b/modules/keeporiginal/helpers/keeporiginal_menu.php @@ -19,7 +19,7 @@ */ class keeporiginal_menu_Core { static function site($menu, $theme) { - + // Create a menu option to restore the original photo. $item = $theme->item(); if ((access::can("view", $item)) && (access::can("edit", $item))) { diff --git a/modules/keeporiginal/module.info b/modules/keeporiginal/module.info index 8dfc3723..855294b9 100644 --- a/modules/keeporiginal/module.info +++ b/modules/keeporiginal/module.info @@ -1,3 +1,3 @@ name = Keep Original -description = Make a copy of the original photo before editing it. +description = Make a copy of the original photo before rotating it. version = 1 From 23bbc1680981d46f8e9c880a430934d488152a22 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 30 Jul 2009 10:34:00 -0700 Subject: [PATCH 30/30] Move keeporiginal menu code into keeporiginal_event --- .../helpers/keeporiginal_event.php | 28 +++++++++++--- .../helpers/keeporiginal_menu.php | 38 ------------------- 2 files changed, 23 insertions(+), 43 deletions(-) delete mode 100644 modules/keeporiginal/helpers/keeporiginal_menu.php diff --git a/modules/keeporiginal/helpers/keeporiginal_event.php b/modules/keeporiginal/helpers/keeporiginal_event.php index 1d4e717b..3228c6f2 100644 --- a/modules/keeporiginal/helpers/keeporiginal_event.php +++ b/modules/keeporiginal/helpers/keeporiginal_event.php @@ -26,9 +26,9 @@ class keeporiginal_event_Core { unlink($original_file); } } - - // When deleting an album, make sure its corresponding location in - // VARPATH/original/ is deleted as well, if it exists. + + // When deleting an album, make sure its corresponding location in + // VARPATH/original/ is deleted as well, if it exists. if ($item->is_album()) { $original_file = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path()); if (file_exists($original_file)) { @@ -36,10 +36,10 @@ class keeporiginal_event_Core { } } } - + static function item_updated($old, $new) { // When updating an item, check and see if the file name is being changed. - // If so, check for and modify any corresponding file/folder in + // If so, check for and modify any corresponding file/folder in // VARPATH/original/ as well. if ($old->is_photo() || $old->is_album()) { if ($old->file_path() != $new->file_path()) { @@ -51,4 +51,22 @@ class keeporiginal_event_Core { } } } + + static function site_menu($menu, $theme) { + // Create a menu option to restore the original photo. + $item = $theme->item(); + + if ((access::can("view", $item)) && (access::can("edit", $item))) { + $original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path()); + + if ($item->is_photo() && file_exists($original_image)) { + $menu->get("options_menu") + ->append(Menu::factory("link") + ->id("restore") + ->label("Restore Original") + ->css_id("gKeepOriginalLink") + ->url(url::site("keeporiginal/restore/" . $item->id))); + } + } + } } \ No newline at end of file diff --git a/modules/keeporiginal/helpers/keeporiginal_menu.php b/modules/keeporiginal/helpers/keeporiginal_menu.php deleted file mode 100644 index 7f88f9d4..00000000 --- a/modules/keeporiginal/helpers/keeporiginal_menu.php +++ /dev/null @@ -1,38 +0,0 @@ -item(); - - if ((access::can("view", $item)) && (access::can("edit", $item))) { - $original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path()); - - if ($item->is_photo() && file_exists($original_image)) { - $menu->get("options_menu") - ->append(Menu::factory("link") - ->id("restore") - ->label("Restore Original") - ->css_id("gKeepOriginalLink") - ->url(url::site("keeporiginal/restore/" . $item->id))); - } - } - } -}
type}s/{$item->id}") ?>">Click Here" readonly>type}s/{$item->id}") ?>">Click Here" onclick="this.focus(); this.select();" readonly>
type}s/{$item->id}") ?>">thumb_url(true) ?>">" readonly>type}s/{$item->id}") ?>">thumb_url(true) ?>">" onclick="this.focus(); this.select();" readonly>
type}s/{$item->id}") ?>">resize_url(true) ?>">" readonly>type}s/{$item->id}") ?>">resize_url(true) ?>">" onclick="this.focus(); this.select();" readonly>
type}s/{$item->id}") ?>]Click Here[/url]" readonly>type}s/{$item->id}") ?>]Click Here[/url]" onclick="this.focus(); this.select();" readonly>
type}s/{$item->id}") ?>][img]thumb_url(true) ?>[/img][/url]" readonly>type}s/{$item->id}") ?>][img]thumb_url(true) ?>[/img][/url]" onclick="this.focus(); this.select();" readonly>
type}s/{$item->id}") ?>][img]resize_url(true) ?>[/img][/url]" readonly>type}s/{$item->id}") ?>][img]resize_url(true) ?>[/img][/url]" onclick="this.focus(); this.select();" readonly>