From 2ba8992e3d7c0b9d5f59e994968419c63a831ff5 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Thu, 4 Aug 2011 14:46:35 -0400 Subject: [PATCH] Added a toolbar icon to a dialog window that contains all link code (HTML, BBCode, URLs). --- .../controllers/admin_embedlinks.php | 19 +++++-- .../embedlinks/controllers/embedlinks.php | 47 ++++++++++-------- .../embedlinks/css/embedlinks_menu.css | 3 ++ .../embedlinks/helpers/embedlinks_block.php | 2 +- .../embedlinks/helpers/embedlinks_event.php | 39 +++++++++++++++ .../helpers/embedlinks_installer.php | 42 ++++++++++++++++ .../embedlinks/helpers/embedlinks_theme.php | 5 ++ .../embedlinks/images/ico-view-embedlinks.png | Bin 0 -> 3571 bytes 3.0/modules/embedlinks/module.info | 8 +-- .../views/embedlinks_alllinksdialog.html.php | 14 ++++++ .../views/embedlinks_photo_block.html.php | 2 +- .../views/embedlinks_sidebar.html.php | 2 +- .../controllers/admin_embedlinks.php | 19 +++++-- .../embedlinks/controllers/embedlinks.php | 47 ++++++++++-------- .../embedlinks/css/embedlinks_menu.css | 3 ++ .../embedlinks/helpers/embedlinks_block.php | 2 +- .../embedlinks/helpers/embedlinks_event.php | 39 +++++++++++++++ .../helpers/embedlinks_installer.php | 42 ++++++++++++++++ .../embedlinks/helpers/embedlinks_theme.php | 5 ++ .../embedlinks/images/ico-view-embedlinks.png | Bin 0 -> 3571 bytes 3.1/modules/embedlinks/module.info | 8 +-- .../views/embedlinks_alllinksdialog.html.php | 14 ++++++ .../views/embedlinks_photo_block.html.php | 2 +- .../views/embedlinks_sidebar.html.php | 2 +- 24 files changed, 300 insertions(+), 66 deletions(-) create mode 100644 3.0/modules/embedlinks/css/embedlinks_menu.css create mode 100644 3.0/modules/embedlinks/helpers/embedlinks_installer.php create mode 100644 3.0/modules/embedlinks/images/ico-view-embedlinks.png create mode 100644 3.0/modules/embedlinks/views/embedlinks_alllinksdialog.html.php create mode 100644 3.1/modules/embedlinks/css/embedlinks_menu.css create mode 100644 3.1/modules/embedlinks/helpers/embedlinks_installer.php create mode 100644 3.1/modules/embedlinks/images/ico-view-embedlinks.png create mode 100644 3.1/modules/embedlinks/views/embedlinks_alllinksdialog.html.php diff --git a/3.0/modules/embedlinks/controllers/admin_embedlinks.php b/3.0/modules/embedlinks/controllers/admin_embedlinks.php index f25f97e8..89d98dcd 100644 --- a/3.0/modules/embedlinks/controllers/admin_embedlinks.php +++ b/3.0/modules/embedlinks/controllers/admin_embedlinks.php @@ -39,7 +39,8 @@ class Admin_EmbedLinks_Controller extends Admin_Controller { $BBCodeButton = false; $FullURLButton = false; $InPageLinks = false; - + $ToolbarLinks = false; + for ($i = 0; $i < count($linkOpts_array); $i++) { if ($linkOpts_array[$i] == "HTMLCode") { $HTMLButton = true; @@ -55,15 +56,19 @@ class Admin_EmbedLinks_Controller extends Admin_Controller { if ($displayType_array[$i] == "InPageLinks") { $InPageLinks = true; } + if ($displayType_array[$i] == "ToolbarLinks") { + $ToolbarLinks = true; + } } - + // Save Settings. module::set_var("embedlinks", "HTMLCode", $HTMLButton); module::set_var("embedlinks", "BBCode", $BBCodeButton); module::set_var("embedlinks", "FullURL", $FullURLButton); module::set_var("embedlinks", "InPageLinks", $InPageLinks); + module::set_var("embedlinks", "ToolbarLinks", $ToolbarLinks); message::success(t("Your Selection Has Been Saved.")); - + // Load Admin page. $view = new Admin_View("admin.html"); $view->content = new View("admin_embedlinks.html"); @@ -83,7 +88,11 @@ class Admin_EmbedLinks_Controller extends Admin_Controller { // Make an array for the different methods of displaying the links. $linkDisplays["InPageLinks"] = array(t("Show Links In The Actual Page"), module::get_var("embedlinks", "InPageLinks")); - + + // Make an array for the different methods of displaying the links. + $linkDisplays["InPageLinks"] = array(t("Show Links In The Actual Page"), module::get_var("embedlinks", "InPageLinks")); + $linkDisplays["ToolbarLinks"] = array(t("Display toolbar image for HTML/BBCode/URLs links"), module::get_var("embedlinks", "ToolbarLinks")); + // Setup a few checkboxes on the form. $add_links = $form->group("EmbedLinks"); $add_links->checklist("LinkCodeTypeOptions") @@ -97,4 +106,4 @@ class Admin_EmbedLinks_Controller extends Admin_Controller { // Return the newly generated form. return $form; } -} \ No newline at end of file +} diff --git a/3.0/modules/embedlinks/controllers/embedlinks.php b/3.0/modules/embedlinks/controllers/embedlinks.php index 53db22a1..2ff53b1a 100644 --- a/3.0/modules/embedlinks/controllers/embedlinks.php +++ b/3.0/modules/embedlinks/controllers/embedlinks.php @@ -18,9 +18,15 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class EmbedLinks_Controller extends Controller { - /** - * Display the EXIF data for an item. - */ + public function showlinks($item_id) { + // Generate the Dialog Box for all HTML/BBCode/URLs available for $item. + $item = ORM::factory("item", $item_id); + access::required("view", $item); + $view = new View("embedlinks_alllinksdialog.html"); + $view->item_id = $item_id; + print $view; + } + public function showhtml($item_id) { // Generate the Dialog Box for HTML links. $item = ORM::factory("item", $item_id); @@ -31,14 +37,14 @@ class EmbedLinks_Controller extends Controller { $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); - + // If the item is a movie, don't display resize links, do display an embed link. } elseif ($item->is_movie()) { // 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) . "">"); $linkTitles[0] = array("Link To This Page:", 2); - + // 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)) { @@ -61,7 +67,7 @@ class EmbedLinks_Controller extends Controller { $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)) { @@ -71,7 +77,7 @@ class EmbedLinks_Controller extends Controller { $linkTitles[2] = array("Link To The Full Size Image:", 3); } } - + $view = new View("embedlinks_htmldialog.html"); $view->titles = $linkTitles; $view->details = $linkArray; @@ -80,22 +86,22 @@ class EmbedLinks_Controller extends Controller { public function showbbcode($item_id) { // Generate the Dialog Box for BBCode links. - $item = ORM::factory("item", $item_id); + $item = ORM::factory("item", $item_id); access::required("view", $item); - + // If the current page is an album, only display two links. 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); - + // If the item is a movie, don't display resize links. } elseif ($item->is_movie()) { // 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]"); $linkTitles[0] = array("Link To This Page:", 2); - + // 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)) { @@ -103,7 +109,7 @@ class EmbedLinks_Controller extends Controller { $linkArray[3] = array("Thumbnail:", "[url=" . $item->file_url(true) . "][img]" . $item->thumb_url(true) . "[/img][/url]"); $linkTitles[1] = array("Link To The Video File:", 2); } - + // Or else assume the item is a photo. } else { // Link to the current page. @@ -117,7 +123,7 @@ class EmbedLinks_Controller extends Controller { $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)) { @@ -127,7 +133,7 @@ class EmbedLinks_Controller extends Controller { $linkTitles[2] = array("Link To The Full Size Image:", 3); } } - + $view = new View("embedlinks_bbcodedialog.html"); $view->titles = $linkTitles; $view->details = $linkArray; @@ -136,9 +142,9 @@ class EmbedLinks_Controller extends Controller { public function showfullurl($item_id) { // Generate the Dialog Box for the URLs to the items thumb, resize and fullsize image. - $item = ORM::factory("item", $item_id); + $item = ORM::factory("item", $item_id); access::required("view", $item); - + // If the current page is an album, only display a URL and thumnail fields. if ($item->is_album()) { $linkArray[0] = array("Album URL:", url::abs_site("{$item->type}s/{$item->id}")); @@ -150,7 +156,7 @@ class EmbedLinks_Controller extends Controller { // Link to the current page. $linkArray[0] = array("This Page:", url::abs_site("{$item->type}s/{$item->id}")); $linkArray[1] = array("Thumbnail:", $item->thumb_url(true)); - + // If the visitor has suficient privlidges to see the fullsized // version of the current image, then display its URL. if (access::can("view_full", $item)) { @@ -159,14 +165,14 @@ class EmbedLinks_Controller extends Controller { } else { $linkTitles[0] = array("URLs:", 2); } - + // Or else assume the item is a photo. } else { // Link to the current page. $linkArray[0] = array("This Page:", url::abs_site("{$item->type}s/{$item->id}")); $linkArray[1] = array("Thumbnail:", $item->thumb_url(true)); $linkArray[2] = array("Resized:", $item->resize_url(true)); - + // If the visitor has suficient privlidges to see the fullsized // version of the current image, then display its URL. if (access::can("view_full", $item)) { @@ -176,11 +182,10 @@ class EmbedLinks_Controller extends Controller { $linkTitles[0] = array("URLs:", 3); } } - + $view = new View("embedlinks_fullurldialog.html"); $view->titles = $linkTitles; $view->details = $linkArray; print $view; } - } diff --git a/3.0/modules/embedlinks/css/embedlinks_menu.css b/3.0/modules/embedlinks/css/embedlinks_menu.css new file mode 100644 index 00000000..6a4af408 --- /dev/null +++ b/3.0/modules/embedlinks/css/embedlinks_menu.css @@ -0,0 +1,3 @@ +#g-view-menu #g-embedlinks-link { + background-image: url('../images/ico-view-embedlinks.png'); +} diff --git a/3.0/modules/embedlinks/helpers/embedlinks_block.php b/3.0/modules/embedlinks/helpers/embedlinks_block.php index 0985007e..4f35280d 100644 --- a/3.0/modules/embedlinks/helpers/embedlinks_block.php +++ b/3.0/modules/embedlinks/helpers/embedlinks_block.php @@ -47,7 +47,7 @@ class embedlinks_block_Core { $block->title = t("Links"); $block->content = new View("embedlinks_album_block.html"); } - break; + break; } return $block; diff --git a/3.0/modules/embedlinks/helpers/embedlinks_event.php b/3.0/modules/embedlinks/helpers/embedlinks_event.php index 69699a09..bafe383d 100644 --- a/3.0/modules/embedlinks/helpers/embedlinks_event.php +++ b/3.0/modules/embedlinks/helpers/embedlinks_event.php @@ -25,4 +25,43 @@ class embedlinks_event_Core { ->label(t("EmbedLinks")) ->url(url::site("admin/embedlinks"))); } + + static function album_menu($menu, $theme) { + // Display embedlinks toolbar icon, if the corresponding setting is enabled. + if (module::get_var("embedlinks", "ToolbarLinks") == true) { + $menu + ->append(Menu::factory("link") + ->id("embedlinks") + ->label(t("Link to this page")) + ->url(url::site("embedlinks/showlinks/" . $theme->item()->id)) + ->css_class("g-dialog-link") + ->css_id("g-embedlinks-link")); + } + } + + static function photo_menu($menu, $theme) { + // Display embedlinks toolbar icon, if the corresponding setting is enabled. + if (module::get_var("embedlinks", "ToolbarLinks") == true) { + $menu + ->append(Menu::factory("link") + ->id("embedlinks") + ->label(t("Link to this page")) + ->url(url::site("embedlinks/showlinks/" . $theme->item()->id)) + ->css_class("g-dialog-link") + ->css_id("g-embedlinks-link")); + } + } + + static function movie_menu($menu, $theme) { + // Display embedlinks toolbar icon, if the corresponding setting is enabled. + if (module::get_var("embedlinks", "ToolbarLinks") == true) { + $menu + ->append(Menu::factory("link") + ->id("embedlinks") + ->label(t("Link to this page")) + ->url(url::site("embedlinks/showlinks/" . $theme->item()->id)) + ->css_class("g-dialog-link") + ->css_id("g-embedlinks-link")); + } + } } diff --git a/3.0/modules/embedlinks/helpers/embedlinks_installer.php b/3.0/modules/embedlinks/helpers/embedlinks_installer.php new file mode 100644 index 00000000..3e98d59a --- /dev/null +++ b/3.0/modules/embedlinks/helpers/embedlinks_installer.php @@ -0,0 +1,42 @@ +css("embedlinks_menu.css"); + } + 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 diff --git a/3.0/modules/embedlinks/images/ico-view-embedlinks.png b/3.0/modules/embedlinks/images/ico-view-embedlinks.png new file mode 100644 index 0000000000000000000000000000000000000000..c5a66dd8dfc4de227c191ade9c3438569458b1c3 GIT binary patch literal 3571 zcmVKLZ*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-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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} z0009XNklXekoIO@zI;xB|GMR21st67MP z8F&5zF6K`V(T&V%2FmmmL@G9X(M*Kt%BQ zltqm~DXchFOSKl1vf_^lMFumucz0)5yaK6{=Px-B=|qf8(MZc>eqNklFq89C9lIj& zbRtGqBt)h1p=FS+NQiVI#$YBl?-m=;^`R_4DA>--`^tjJ7Yeom5M3Y27GJ&jVpR+g ziKi2NOuuV{`19{(bPs3vJjx zXz$+7Iv@kL?mH0mQ{@(VYQ}pjH$@}-a_XQhbiBJWoP9Yyx!VEJu9|BtxFME8XhUlu z;BRAM@@+i`0Iy3^EQQd9h)}I+{QfoE$rMHZJ@n8@Q*VE)?VU#Tlcjf{Cxb!hWxQ7MMm>aY4cebfEfrF$zwl! z`{~`bVJ#Q`xPt)rxJv%Z zKPBdJjIA5LL2I$zHKp>5x;yr)0{D;Y+u1V2jo~rw zjy;<#m1hEVw@j^T2cufmRz>WXR1A8DlR(8}8use;)#*j_%*(z9tlGH$jrWo<2nG z@e3lMHMOU@4QpE#+Guvu2C&ys2yM(aX|aViyd*EC&<&^fFRg_T8W`H!+mmuD;2FdX t)XXPJO;{csKvwyw^fSLdR002ovPDHLkV1lGnuEYQU literal 0 HcmV?d00001 diff --git a/3.0/modules/embedlinks/module.info b/3.0/modules/embedlinks/module.info index c5eeb06b..e6b7f8bf 100644 --- a/3.0/modules/embedlinks/module.info +++ b/3.0/modules/embedlinks/module.info @@ -1,7 +1,7 @@ name = "EmbedLinks" description = "Display BBCode and HTML code to embed links to albums/images into other web pages." -version = 1 -author_name = "" -author_url = "" +version = 2 +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" info_url = "http://codex.gallery2.org/Gallery3:Modules:embedlinks" -discuss_url = "http://gallery.menalto.com/forum_module_embedlinks" +discuss_url = "http://gallery.menalto.com/node/88322" diff --git a/3.0/modules/embedlinks/views/embedlinks_alllinksdialog.html.php b/3.0/modules/embedlinks/views/embedlinks_alllinksdialog.html.php new file mode 100644 index 00000000..a1cd4035 --- /dev/null +++ b/3.0/modules/embedlinks/views/embedlinks_alllinksdialog.html.php @@ -0,0 +1,14 @@ + + +

+ diff --git a/3.0/modules/embedlinks/views/embedlinks_photo_block.html.php b/3.0/modules/embedlinks/views/embedlinks_photo_block.html.php index 97bb51c0..ab26eb93 100644 --- a/3.0/modules/embedlinks/views/embedlinks_photo_block.html.php +++ b/3.0/modules/embedlinks/views/embedlinks_photo_block.html.php @@ -198,4 +198,4 @@ input[type="text"] { - \ No newline at end of file + diff --git a/3.0/modules/embedlinks/views/embedlinks_sidebar.html.php b/3.0/modules/embedlinks/views/embedlinks_sidebar.html.php index 21d8b7f3..0991382a 100644 --- a/3.0/modules/embedlinks/views/embedlinks_sidebar.html.php +++ b/3.0/modules/embedlinks/views/embedlinks_sidebar.html.php @@ -21,4 +21,4 @@ - \ No newline at end of file + diff --git a/3.1/modules/embedlinks/controllers/admin_embedlinks.php b/3.1/modules/embedlinks/controllers/admin_embedlinks.php index f25f97e8..89d98dcd 100644 --- a/3.1/modules/embedlinks/controllers/admin_embedlinks.php +++ b/3.1/modules/embedlinks/controllers/admin_embedlinks.php @@ -39,7 +39,8 @@ class Admin_EmbedLinks_Controller extends Admin_Controller { $BBCodeButton = false; $FullURLButton = false; $InPageLinks = false; - + $ToolbarLinks = false; + for ($i = 0; $i < count($linkOpts_array); $i++) { if ($linkOpts_array[$i] == "HTMLCode") { $HTMLButton = true; @@ -55,15 +56,19 @@ class Admin_EmbedLinks_Controller extends Admin_Controller { if ($displayType_array[$i] == "InPageLinks") { $InPageLinks = true; } + if ($displayType_array[$i] == "ToolbarLinks") { + $ToolbarLinks = true; + } } - + // Save Settings. module::set_var("embedlinks", "HTMLCode", $HTMLButton); module::set_var("embedlinks", "BBCode", $BBCodeButton); module::set_var("embedlinks", "FullURL", $FullURLButton); module::set_var("embedlinks", "InPageLinks", $InPageLinks); + module::set_var("embedlinks", "ToolbarLinks", $ToolbarLinks); message::success(t("Your Selection Has Been Saved.")); - + // Load Admin page. $view = new Admin_View("admin.html"); $view->content = new View("admin_embedlinks.html"); @@ -83,7 +88,11 @@ class Admin_EmbedLinks_Controller extends Admin_Controller { // Make an array for the different methods of displaying the links. $linkDisplays["InPageLinks"] = array(t("Show Links In The Actual Page"), module::get_var("embedlinks", "InPageLinks")); - + + // Make an array for the different methods of displaying the links. + $linkDisplays["InPageLinks"] = array(t("Show Links In The Actual Page"), module::get_var("embedlinks", "InPageLinks")); + $linkDisplays["ToolbarLinks"] = array(t("Display toolbar image for HTML/BBCode/URLs links"), module::get_var("embedlinks", "ToolbarLinks")); + // Setup a few checkboxes on the form. $add_links = $form->group("EmbedLinks"); $add_links->checklist("LinkCodeTypeOptions") @@ -97,4 +106,4 @@ class Admin_EmbedLinks_Controller extends Admin_Controller { // Return the newly generated form. return $form; } -} \ No newline at end of file +} diff --git a/3.1/modules/embedlinks/controllers/embedlinks.php b/3.1/modules/embedlinks/controllers/embedlinks.php index 53db22a1..2ff53b1a 100644 --- a/3.1/modules/embedlinks/controllers/embedlinks.php +++ b/3.1/modules/embedlinks/controllers/embedlinks.php @@ -18,9 +18,15 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class EmbedLinks_Controller extends Controller { - /** - * Display the EXIF data for an item. - */ + public function showlinks($item_id) { + // Generate the Dialog Box for all HTML/BBCode/URLs available for $item. + $item = ORM::factory("item", $item_id); + access::required("view", $item); + $view = new View("embedlinks_alllinksdialog.html"); + $view->item_id = $item_id; + print $view; + } + public function showhtml($item_id) { // Generate the Dialog Box for HTML links. $item = ORM::factory("item", $item_id); @@ -31,14 +37,14 @@ class EmbedLinks_Controller extends Controller { $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); - + // If the item is a movie, don't display resize links, do display an embed link. } elseif ($item->is_movie()) { // 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) . "">"); $linkTitles[0] = array("Link To This Page:", 2); - + // 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)) { @@ -61,7 +67,7 @@ class EmbedLinks_Controller extends Controller { $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)) { @@ -71,7 +77,7 @@ class EmbedLinks_Controller extends Controller { $linkTitles[2] = array("Link To The Full Size Image:", 3); } } - + $view = new View("embedlinks_htmldialog.html"); $view->titles = $linkTitles; $view->details = $linkArray; @@ -80,22 +86,22 @@ class EmbedLinks_Controller extends Controller { public function showbbcode($item_id) { // Generate the Dialog Box for BBCode links. - $item = ORM::factory("item", $item_id); + $item = ORM::factory("item", $item_id); access::required("view", $item); - + // If the current page is an album, only display two links. 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); - + // If the item is a movie, don't display resize links. } elseif ($item->is_movie()) { // 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]"); $linkTitles[0] = array("Link To This Page:", 2); - + // 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)) { @@ -103,7 +109,7 @@ class EmbedLinks_Controller extends Controller { $linkArray[3] = array("Thumbnail:", "[url=" . $item->file_url(true) . "][img]" . $item->thumb_url(true) . "[/img][/url]"); $linkTitles[1] = array("Link To The Video File:", 2); } - + // Or else assume the item is a photo. } else { // Link to the current page. @@ -117,7 +123,7 @@ class EmbedLinks_Controller extends Controller { $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)) { @@ -127,7 +133,7 @@ class EmbedLinks_Controller extends Controller { $linkTitles[2] = array("Link To The Full Size Image:", 3); } } - + $view = new View("embedlinks_bbcodedialog.html"); $view->titles = $linkTitles; $view->details = $linkArray; @@ -136,9 +142,9 @@ class EmbedLinks_Controller extends Controller { public function showfullurl($item_id) { // Generate the Dialog Box for the URLs to the items thumb, resize and fullsize image. - $item = ORM::factory("item", $item_id); + $item = ORM::factory("item", $item_id); access::required("view", $item); - + // If the current page is an album, only display a URL and thumnail fields. if ($item->is_album()) { $linkArray[0] = array("Album URL:", url::abs_site("{$item->type}s/{$item->id}")); @@ -150,7 +156,7 @@ class EmbedLinks_Controller extends Controller { // Link to the current page. $linkArray[0] = array("This Page:", url::abs_site("{$item->type}s/{$item->id}")); $linkArray[1] = array("Thumbnail:", $item->thumb_url(true)); - + // If the visitor has suficient privlidges to see the fullsized // version of the current image, then display its URL. if (access::can("view_full", $item)) { @@ -159,14 +165,14 @@ class EmbedLinks_Controller extends Controller { } else { $linkTitles[0] = array("URLs:", 2); } - + // Or else assume the item is a photo. } else { // Link to the current page. $linkArray[0] = array("This Page:", url::abs_site("{$item->type}s/{$item->id}")); $linkArray[1] = array("Thumbnail:", $item->thumb_url(true)); $linkArray[2] = array("Resized:", $item->resize_url(true)); - + // If the visitor has suficient privlidges to see the fullsized // version of the current image, then display its URL. if (access::can("view_full", $item)) { @@ -176,11 +182,10 @@ class EmbedLinks_Controller extends Controller { $linkTitles[0] = array("URLs:", 3); } } - + $view = new View("embedlinks_fullurldialog.html"); $view->titles = $linkTitles; $view->details = $linkArray; print $view; } - } diff --git a/3.1/modules/embedlinks/css/embedlinks_menu.css b/3.1/modules/embedlinks/css/embedlinks_menu.css new file mode 100644 index 00000000..6a4af408 --- /dev/null +++ b/3.1/modules/embedlinks/css/embedlinks_menu.css @@ -0,0 +1,3 @@ +#g-view-menu #g-embedlinks-link { + background-image: url('../images/ico-view-embedlinks.png'); +} diff --git a/3.1/modules/embedlinks/helpers/embedlinks_block.php b/3.1/modules/embedlinks/helpers/embedlinks_block.php index 0985007e..4f35280d 100644 --- a/3.1/modules/embedlinks/helpers/embedlinks_block.php +++ b/3.1/modules/embedlinks/helpers/embedlinks_block.php @@ -47,7 +47,7 @@ class embedlinks_block_Core { $block->title = t("Links"); $block->content = new View("embedlinks_album_block.html"); } - break; + break; } return $block; diff --git a/3.1/modules/embedlinks/helpers/embedlinks_event.php b/3.1/modules/embedlinks/helpers/embedlinks_event.php index 69699a09..bafe383d 100644 --- a/3.1/modules/embedlinks/helpers/embedlinks_event.php +++ b/3.1/modules/embedlinks/helpers/embedlinks_event.php @@ -25,4 +25,43 @@ class embedlinks_event_Core { ->label(t("EmbedLinks")) ->url(url::site("admin/embedlinks"))); } + + static function album_menu($menu, $theme) { + // Display embedlinks toolbar icon, if the corresponding setting is enabled. + if (module::get_var("embedlinks", "ToolbarLinks") == true) { + $menu + ->append(Menu::factory("link") + ->id("embedlinks") + ->label(t("Link to this page")) + ->url(url::site("embedlinks/showlinks/" . $theme->item()->id)) + ->css_class("g-dialog-link") + ->css_id("g-embedlinks-link")); + } + } + + static function photo_menu($menu, $theme) { + // Display embedlinks toolbar icon, if the corresponding setting is enabled. + if (module::get_var("embedlinks", "ToolbarLinks") == true) { + $menu + ->append(Menu::factory("link") + ->id("embedlinks") + ->label(t("Link to this page")) + ->url(url::site("embedlinks/showlinks/" . $theme->item()->id)) + ->css_class("g-dialog-link") + ->css_id("g-embedlinks-link")); + } + } + + static function movie_menu($menu, $theme) { + // Display embedlinks toolbar icon, if the corresponding setting is enabled. + if (module::get_var("embedlinks", "ToolbarLinks") == true) { + $menu + ->append(Menu::factory("link") + ->id("embedlinks") + ->label(t("Link to this page")) + ->url(url::site("embedlinks/showlinks/" . $theme->item()->id)) + ->css_class("g-dialog-link") + ->css_id("g-embedlinks-link")); + } + } } diff --git a/3.1/modules/embedlinks/helpers/embedlinks_installer.php b/3.1/modules/embedlinks/helpers/embedlinks_installer.php new file mode 100644 index 00000000..3e98d59a --- /dev/null +++ b/3.1/modules/embedlinks/helpers/embedlinks_installer.php @@ -0,0 +1,42 @@ +css("embedlinks_menu.css"); + } + 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 diff --git a/3.1/modules/embedlinks/images/ico-view-embedlinks.png b/3.1/modules/embedlinks/images/ico-view-embedlinks.png new file mode 100644 index 0000000000000000000000000000000000000000..c5a66dd8dfc4de227c191ade9c3438569458b1c3 GIT binary patch literal 3571 zcmVKLZ*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-r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GqBt)h1p=FS+NQiVI#$YBl?-m=;^`R_4DA>--`^tjJ7Yeom5M3Y27GJ&jVpR+g ziKi2NOuuV{`19{(bPs3vJjx zXz$+7Iv@kL?mH0mQ{@(VYQ}pjH$@}-a_XQhbiBJWoP9Yyx!VEJu9|BtxFME8XhUlu z;BRAM@@+i`0Iy3^EQQd9h)}I+{QfoE$rMHZJ@n8@Q*VE)?VU#Tlcjf{Cxb!hWxQ7MMm>aY4cebfEfrF$zwl! z`{~`bVJ#Q`xPt)rxJv%Z zKPBdJjIA5LL2I$zHKp>5x;yr)0{D;Y+u1V2jo~rw zjy;<#m1hEVw@j^T2cufmRz>WXR1A8DlR(8}8use;)#*j_%*(z9tlGH$jrWo<2nG z@e3lMHMOU@4QpE#+Guvu2C&ys2yM(aX|aViyd*EC&<&^fFRg_T8W`H!+mmuD;2FdX t)XXPJO;{csKvwyw^fSLdR002ovPDHLkV1lGnuEYQU literal 0 HcmV?d00001 diff --git a/3.1/modules/embedlinks/module.info b/3.1/modules/embedlinks/module.info index c5eeb06b..e6b7f8bf 100644 --- a/3.1/modules/embedlinks/module.info +++ b/3.1/modules/embedlinks/module.info @@ -1,7 +1,7 @@ name = "EmbedLinks" description = "Display BBCode and HTML code to embed links to albums/images into other web pages." -version = 1 -author_name = "" -author_url = "" +version = 2 +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" info_url = "http://codex.gallery2.org/Gallery3:Modules:embedlinks" -discuss_url = "http://gallery.menalto.com/forum_module_embedlinks" +discuss_url = "http://gallery.menalto.com/node/88322" diff --git a/3.1/modules/embedlinks/views/embedlinks_alllinksdialog.html.php b/3.1/modules/embedlinks/views/embedlinks_alllinksdialog.html.php new file mode 100644 index 00000000..a1cd4035 --- /dev/null +++ b/3.1/modules/embedlinks/views/embedlinks_alllinksdialog.html.php @@ -0,0 +1,14 @@ + + +

+ diff --git a/3.1/modules/embedlinks/views/embedlinks_photo_block.html.php b/3.1/modules/embedlinks/views/embedlinks_photo_block.html.php index 97bb51c0..ab26eb93 100644 --- a/3.1/modules/embedlinks/views/embedlinks_photo_block.html.php +++ b/3.1/modules/embedlinks/views/embedlinks_photo_block.html.php @@ -198,4 +198,4 @@ input[type="text"] { - \ No newline at end of file + diff --git a/3.1/modules/embedlinks/views/embedlinks_sidebar.html.php b/3.1/modules/embedlinks/views/embedlinks_sidebar.html.php index 21d8b7f3..0991382a 100644 --- a/3.1/modules/embedlinks/views/embedlinks_sidebar.html.php +++ b/3.1/modules/embedlinks/views/embedlinks_sidebar.html.php @@ -21,4 +21,4 @@ - \ No newline at end of file +