1
0

Added adim configuration for item description and image size.

This commit is contained in:
3nids 2009-10-27 11:31:41 +01:00
parent 3bda176b0d
commit 0aafd218ee
9 changed files with 176 additions and 12 deletions

View File

@ -30,7 +30,7 @@
</head>
<body class="g-fancy-iframe-body">
<div id="g-item-box">
<img src="<?=$item->file_url()?>" id="g-item-img">
<img src="<?=$item_url?>" id="g-item-img">
<?= $theme->context_menu($item, "#g-item-id-{$item->id}") ?>
</div>

View File

@ -15,6 +15,11 @@ Installation:
1. Copy the theme folder (3nids) into gallery3/themes directory.
2. Copy modules folder into gallery3 directory. It includes tagsmap and theme_3nids modules.
3. Activate tagsmap and theme_3nids module.
*********
Configuration:
Go to admin -> content -> Theme 3nids settings to configure the theme properly.
*********
Use:

View File

@ -1 +1 @@
Display item description if available
Added adim configuration for item description and image size.

View File

@ -0,0 +1,74 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Admin_theme_3nids_Controller extends Admin_Controller {
public function index() {
// Generate a new admin page.
$view = new Admin_View("admin.html");
$view->content = new View("admin_theme_3nids.html");
// Generate a form for Google Maps Settings.
$view->content->theme_form = $this->_get_3nids_form();
// Display the page.
print $view;
}
private function _get_3nids_form() {
// Make a new form for inputing information associated with google maps.
$form = new Forge("admin/theme_3nids/save3nidsprefs", "", "post",
array("id" => "gTagsMapAdminForm"));
// Input box for the Maps API Key
$form->input("description")
->label(t("item description : tags or item or parent or nothing. If item description chosen and not available, then parent description is used."))
->value(module::get_var("theme_3nids", "description"));
$form->input("photo_size")
->label(t("Photo size: resize or full."))
->value(module::get_var("theme_3nids", "photo_size"));
// Add a save button to the form.
$form->submit("SaveSettings")->value(t("Save"));
// Return the newly generated form.
return $form;
}
public function save3nidsprefs() {
// Save information associated with Google Maps to the database.
// Prevent Cross Site Request Forgery
access::verify_csrf();
// Figure out the values of the text boxes
$description = Input::instance()->post("description");
$photo_size = Input::instance()->post("photo_size");
// Save Settings.
module::set_var("theme_3nids", "description", $description);
module::set_var("theme_3nids", "photo_size", $photo_size);
// Display a success message and redirect back to the TagsMap admin page.
message::success(t("Your Settings Have Been Saved."));
url::redirect("admin/theme_3nids");
}
}

View File

@ -31,6 +31,12 @@ class Photo_3nids_Controller extends REST_Controller {
$view = new Theme_View("photo_3nids.html", "page");
$view->item = $item;
$photo_size = module::get_var("theme_3nids","photo_size");
if ($photo_size == "full"){
$view->item_url = $item->file_url();
}else{
$view->item_url = $item->resize_url();
}
print $view;
break;
}

View File

@ -30,10 +30,24 @@ class theme_3nids_Core {
$link = "";
access::required("view", $item);
if($item->description != ""){
$description = ", " . $item->description;
$photo_size = module::get_var("theme_3nids","photo_size");
if ($photo_size == "full"){
$width = $item->width;
$height = $item->height;
}else{
$description = ", " . $item->parent()->description;
$width = $item->resize_width;
$height = $item->resize_height;
}
$desriptionMode = module::get_var("theme_3nids", "description");
$description = "";
$tags = tag::item_tags($item);
if(count($tags) && $desriptionMode == "tags"){
$description = " || " . implode(", ", $tags);
}elseif($desriptionMode == "item" && $item->description != ""){
$description = " || " . $item->description;
}elseif (($desriptionMode == "parent" || $desriptionMode == "item") && $item->parent()->description != ""){
$description = " || " . $item->parent()->description;
}
$rel = "";
@ -46,9 +60,9 @@ class theme_3nids_Core {
if (module::is_active("comment") && module::is_active("theme_3nids")){
$fancymodule .= "comment::" . url::site("comments_3nids?item_id={$item->id}") . ";;comment_count::" . comment_3nids::count($item) . ";;" ;}
if ($item->is_photo()){
$link .= "<a href=\"" . url::site("photo_3nids/show/{$item->id}") ."/?w=" . $item->width . "xewx&h=" . $item->height . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $item->parent()->title . $description ."\" name=\"" . $fancymodule . " \">";
$link .= "<a href=\"" . url::site("photo_3nids/show/{$item->id}") ."/?w=" . $width . "xewx&h=" . $height . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $item->parent()->title . $description ."\" name=\"" . $fancymodule . " \">";
}else{
$link .= "<a href=\"" . url::site("movie_3nids/show/{$item->id}") . "/?w=" . strval(20+($item->width)) . "xewx&h=" . strval(50+($item->height)) . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $item->parent()->title . $description ."\" name=\"" . $fancymodule . " \">";
$link .= "<a href=\"" . url::site("movie_3nids/show/{$item->id}") . "/?w=" . strval(20+($width)) . "xewx&h=" . strval(50+($height)) . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $item->parent()->title . $description ."\" name=\"" . $fancymodule . " \">";
}
} elseif( $item->is_album() && $viewtype != "header"){
$link .= "<a href=\"" . $item->url() . "\">";
@ -63,7 +77,7 @@ class theme_3nids_Core {
}
if (($item->is_photo() || $item->is_movie()) && $displayComment==true && module::is_active("comment") && module::is_active("theme_3nids")) {
$link .= "<ul class=\"g-metadata\"><li><a href=\"" . url::site("comments_3nids?item_id={$item->id}") ."\" class=\"iframe fancyclass\">" . comment_3nids::count($item) . " " . t("comments") . "</a></li></ul>";
$link .= "<ul class=\"g-metadata\"><li><a href=\"" . url::site("comments_3nids?item_id={$item->id}") ."\" class=\"iframe fancyclass g-hidden\">" . comment_3nids::count($item) . " " . t("comments") . "</a></li></ul>";
}
}else{
$link .= "</a>";

View File

@ -0,0 +1,29 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class theme_3nids_event_Core {
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("theme_3nids")
->label(t("Theme 3nids Settings"))
->url(url::site("admin/theme_3nids")));
}
}

View File

@ -0,0 +1,25 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class theme_3nids_installer {
static function install() {
module::set_var("theme_3nids", "description", "item");
module::set_var("theme_3nids", "photo_size", "resize");
}
}

View File

@ -0,0 +1,11 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<h2>
<?= t("TagsMap Admin") ?>
</h2>
<div class="g-block">
<h3>
<?= t("3nids theme Settings") ?>
</h3>
<?= $theme_form ?>
</div>