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 @@
$counter+= $titles[$i][1]; ?>
- endfor ?>
+ endfor ?>
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 @@
$counter+= $titles[$i][1]; ?>
- endfor ?>
+ endfor ?>
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="= t("HTML Links") ?>"
class="gDialogLink gButtonLink ui-icon-left ui-state-default ui-corner-all">
- = t("HTML Code") ?>
+ = t("Show HTML Code") ?>
} ?>
@@ -11,6 +11,6 @@
id}") ?>" title="= t("BBCode Links") ?>"
class="gDialogLink gButtonLink ui-icon-left ui-state-default ui-corner-all">
- = t("BBCode") ?>
+ = t("Show BBCode") ?>
} ?>
\ No newline at end of file