Code Cleanup, comments, etc.
Signed-off-by: Tim Almdal <tnalmdal@shaw.ca>
This commit is contained in:
parent
250c6037aa
commit
96604083ec
@ -33,8 +33,12 @@ 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") {
|
||||
@ -44,10 +48,20 @@ class Admin_EmbedLinks_Controller extends Admin_Controller {
|
||||
$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"));
|
||||
|
@ -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:", "<a href="" . url::abs_site("{$item->type}s/{$item->id}") . "">Click Here</a>");
|
||||
$linkArray[1] = array("Thumbnail:", "<a href="" . url::abs_site("{$item->type}s/{$item->id}") . ""><img src="" . $item->thumb_url(true) . ""></a>");
|
||||
$linkTitles[0] = array("Link To This Album:", 2);
|
||||
} else {
|
||||
// Link to the current page.
|
||||
$linkArray[0] = array("Text:", "<a href="" . url::abs_site("{$item->type}s/{$item->id}") . "">Click Here</a>");
|
||||
$linkArray[1] = array("Thumbnail:", "<a href="" . url::abs_site("{$item->type}s/{$item->id}") . ""><img src="" . $item->thumb_url(true) . ""></a>");
|
||||
$linkArray[2] = array("Resized:", "<a href="" . url::abs_site("{$item->type}s/{$item->id}") . ""><img src="" . $item->resize_url(true) . ""></a>");
|
||||
$linkTitles[0] = array("Link To This Page:", 3);
|
||||
|
||||
// Link to the "resized" version of the current image.
|
||||
$linkArray[3] = array("Text:", "<a href="" . $item->resize_url(true) . "">Click Here</a>");
|
||||
$linkArray[4] = array("Thumbnail:", "<a href="" . $item->resize_url(true) . ""><img src="" . $item->thumb_url(true) . ""></a>");
|
||||
$linkArray[5] = array("Image:", "<img src="" . $item->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:", "<a href="" . $item->file_url(true) . "">Click Here</a>");
|
||||
$linkArray[7] = array("Thumbnail:", "<a href="" . $item->file_url(true) . ""><img src="" . $item->thumb_url(true) . ""></a>");
|
||||
@ -55,24 +62,31 @@ class EmbedLinks_Controller extends Controller {
|
||||
}
|
||||
|
||||
public function showbbcode($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 {
|
||||
// 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]");
|
||||
|
@ -19,7 +19,9 @@
|
||||
*/
|
||||
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");
|
||||
@ -28,7 +30,24 @@ class embedlinks_theme_Core {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
// 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");
|
||||
@ -36,3 +55,4 @@ class embedlinks_theme_Core {
|
||||
return $block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
<a href="<?= url::site("embedlinks/showhtml/{$item->id}") ?>" title="<?= t("HTML Links") ?>"
|
||||
class="gDialogLink gButtonLink ui-icon-left ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-info"></span>
|
||||
<?= t("HTML Code") ?>
|
||||
<?= t("Show HTML Code") ?>
|
||||
</a><br />
|
||||
<? } ?>
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
<a href="<?= url::site("embedlinks/showbbcode/{$item->id}") ?>" title="<?= t("BBCode Links") ?>"
|
||||
class="gDialogLink gButtonLink ui-icon-left ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-info"></span>
|
||||
<?= t("BBCode") ?>
|
||||
<?= t("Show BBCode") ?>
|
||||
</a>
|
||||
<? } ?>
|
Reference in New Issue
Block a user