1
0

Initial commit of the themeroller module. It takes an upload of the zip file produced by jqueryui.com/themeroller and generates a theme based on the color schema contained in the zip file. Still fairly experimental

This commit is contained in:
Tim Almdal 2010-08-06 14:29:42 -07:00
parent 1647ab4b27
commit e51496abf9
62 changed files with 3053 additions and 0 deletions

View File

@ -0,0 +1,180 @@
<?php defined("SYSPATH") or die("No direct script access.");/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 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_Themeroller_Controller extends Admin_Controller {
public function form_upload() {
$v = new View("admin_themeroller_upload.html");
list ($v->form, $v->errors) = $this->_get_upload_form();
$v->is_writable = is_writable(THEMEPATH);
$v->action = "admin/themeroller/form_create";
$submit_class = "ui-state-default ui-corner-all submit g-left";
if ($v->not_writable = !is_writable(THEMEPATH)) {
$submit_class .= " ui-state-disabled";
}
$v->submit_class = $submit_class;
$v->script_data = array(
"g3sid" => Session::instance()->id(),
"user_agent" => Input::instance()->server("HTTP_USER_AGENT"),
"csrf" => access::csrf_token());
json::reply(array("html" => (string) $v));
}
public function form_create() {
$theme_name = Session::instance()->get_once("theme_name");
json::reply(array("html" => (string) $this->_get_theme_form($theme_name)));
}
public function upload() {
access::verify_csrf();
//list ($v->form, $v->errors) = $this->_get_upload_form();
$validation = new Validation(array_merge($_POST, $_FILES));
$validation->add_rules("zip_file", "upload::valid", "upload::required", "upload::type[zip]");
$validation->add_rules("is_admin", "chars[0,1]");
$validation->add_callbacks("zip_file", array($this, "_unload_zip"));
if ($validation->validate()) {
$session = Session::instance();
$themeroller_name = $session->get("themeroller_name");
$is_admin = $validation["is_admin"];
$counter = 0;
$theme_name_generated = ($is_admin ? "admin_" : "") . $themeroller_name;
while (file_exists(THEMEPATH . "$theme_name_generated/theme.info")) {
$counter++;
$theme_name_generated = "{$theme_name_generated}_{$counter}";
}
$theme_name = strtolower(strtr($theme_name_generated, " ", "_"));
$session->set("theme_name", $theme_name);
$session->set("themeroller_is_admin", $is_admin);
print "FILEID: {$validation["zip_file"]["tmp_name"]}";
} else {
header("HTTP/1.1 400 Bad Request");
print "ERROR: " . t("Invalid zip archive");
}
}
public function create() {
access::verify_csrf();
$form = $this->_get_theme_form();
if ($form->validate()) {
$session = Session::instance();
$extract_path = $session->get_once("theme_extract_path");
$v = new View("admin_themeroller_progress.html");
$task_def = Task_Definition::factory()
->callback("themeroller_task::create_theme")
->description(t("Generate theme from a themeroller archive"))
->name(t("Generate theme"));
$v->task = task::create($task_def,
array("path" => $extract_path,
"original_name" => $form->theme->original->value,
"theme_name" => $form->theme->theme_name->value,
"display_name" => $form->theme->display_name->value,
"description" => $form->theme->description->value,
"is_admin" => $session->get("themeroller_is_admin")));
json::reply(array("html" => (string) $v));
} else {
json::reply(array("result" => "error", "html" => (string) $form));
}
}
/**
* Run the task of creating the theme
*/
static function run($task_id) {
access::verify_csrf();
$task = ORM::factory("task", $task_id);
if (!$task->loaded() || $task->owner_id != identity::active_user()->id) {
access::forbidden();
}
$task = task::run($task_id);
// Prevent the JavaScript code from breaking by forcing a period as
// decimal separator for all locales with sprintf("%F", $value).
json::reply(array("done" => (bool)$task->done,
"status" => (string)$task->status,
"percent_complete" => sprintf("%F", $task->percent_complete)));
}
static function _is_theme_defined($name) {
$theme_name = strtolower(strtr($name->value, " ", "_"));
if (file_exists(THEMEPATH . "$theme_name/theme.info")) {
$name->add_error("conflict", 1);
}
}
public function _unload_zip(Validation $post, $field) {
$zipfile = $post["zip_file"]["tmp_name"];
if (false !== ($extract_path = themeroller::extract_zip_file($zipfile))) {
$theme_name = themeroller::get_theme_name($extract_path);
if (!empty($theme_name)) {
Session::instance()->set("themeroller_name", $theme_name);
} else {
Kohana_Log::add("error", "zip file: css directory not found");
$post->add_error($field, "invalid zipfile");
}
} else {
Kohana_Log::add("error", "zip file: open failed");
$post->add_error($field, "invalid zipfile");
}
if (file_exists($zipfile)) {
unlink($zipfile);
}
}
private function _get_theme_form($theme_name=null) {
$form = new Forge("admin/themeroller/create", "", "post", array("id" => "g-themeroller-create-form"));
$form_group = $form->group("theme")->label(t("Create theme"));
$original_name = $form_group->hidden("original");
$name_field = $form_group->input("theme_name")->label(t("Theme Name"))->id("g-name")
->rules("required")
->callback("Admin_Themeroller_Controller::_is_theme_defined")
->error_messages("conflict", t("There is already a theme with that name"))
->error_messages("required", t("You must enter a theme name"));
$display_name = $form_group->input("display_name")->label(t("Display Name"))
->id("g-display-name")
->rules("required")
->error_messages("required", t("You must enter a theme display name"));
if (!empty($theme_name)) {
$name_field->value($theme_name);
$display_name->value(ucwords(t("%name theme", array("name" => $theme_name))));
$original_name->hidden("original")->value(Session::instance()->get("themeroller_name"));
}
$form_group->textarea("description")->label(t("Description"))
->id("g-description")
->rules("required")
->error_messages("required", t("You must enter a theme description name"));
$form_group->submit("")->value(t("Create"));
return $form;
}
private function _get_upload_form() {
$form = array("zip_file" => "", "is_admin" => "");
$errors = array_fill_keys(array_keys($form), "");
return array($form, $errors);
}
}

View File

@ -0,0 +1,87 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>
<? if ($page_title): ?>
<?= t("Gallery Admin: %page_title", array("page_title" => $page_title)) ?>
<? else: ?>
<?= t("Admin dashboard") ?>
<? endif ?>
</title>
<link rel="shortcut icon" href="<?= url::file("lib/images/favicon.ico") ?>" type="image/x-icon" />
<?= $theme->css("yui/reset-fonts-grids.css") ?>
<?= $theme->css("themeroller/ui.base.css") ?>
<?= $theme->css("superfish/css/superfish.css") ?>
<?= $theme->css("gallery.common.css") ?>
<?= $theme->css("screen.css") ?>
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" href="<?= $theme->url("fix-ie.css") ?>"
media="screen,print,projection" />
<![endif]-->
<?= $theme->script("jquery.js") ?>
<?= $theme->script("jquery.form.js") ?>
<?= $theme->script("jquery-ui.js") ?>
<?= $theme->script("gallery.common.js") ?>
<? /* MSG_CANCEL is required by gallery.dialog.js */ ?>
<script type="text/javascript">
var MSG_CANCEL = <?= t("Cancel")->for_js() ?>;
</script>
<?= $theme->script("gallery.ajax.js") ?>
<?= $theme->script("gallery.dialog.js") ?>
<?= $theme->script("superfish/js/superfish.js") ?>
<?= $theme->script("ui.init.js") ?>
<?= $theme->admin_head() ?>
</head>
<body <?= $theme->body_attributes() ?>>
<?= $theme->admin_page_top() ?>
<? if ($sidebar): ?>
<div id="doc3" class="yui-t5 g-view">
<? else: ?>
<div id="doc3" class="yui-t7 g-view">
<? endif; ?>
<?= $theme->site_status() ?>
<div id="g-header" class="ui-helper-clearfix">
<?= $theme->admin_header_top() ?>
<a id="g-logo" class="g-left" href="<?= item::root()->url() ?>" title="<?= t("go back to the Gallery")->for_html_attr() ?>">
&larr; <?= t("back to the ...") ?>
</a>
<?= $theme->user_menu() ?>
<!-- hide the menu until after the page has loaded, to minimize menu flicker -->
<div id="g-site-admin-menu" class="ui-helper-clearfix" style="visibility: hidden">
<?= $theme->admin_menu() ?>
</div>
<script type="text/javascript"> $(document).ready(function() { $("#g-site-admin-menu").css("visibility", "visible"); }) </script>
<?= $theme->admin_header_bottom() ?>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<div id="g-content" class="yui-g">
<?= $theme->messages() ?>
<?= $content ?>
</div>
</div>
</div>
<? if ($sidebar): ?>
<div id="g-sidebar" class="yui-b">
<?= $sidebar ?>
</div>
<? endif ?>
</div>
<div id="g-footer" class="g-inline ui-helper-clearfix">
<?= $theme->admin_footer() ?>
<div>
<?= $theme->admin_credits() ?>
</div>
</div>
</div>
<?= $theme->admin_page_bottom() ?>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? if ($anchor): ?>
<a name="<?= $anchor ?>"></a>
<? endif ?>
<div block_id="<?= $id ?>" id="<?= $css_id ?>" class="g-block ui-widget">
<div class="ui-dialog-titlebar ui-widget-header ui-helper-clearfix ui-icon-right">
<? if ($css_id != "g-block-adder"): ?>
<a href="<?= url::site("admin/dashboard/remove_block/$id?csrf=$csrf") ?>"
class="ui-dialog-titlebar-close ui-corner-all">
<span class="ui-icon ui-icon-closethick">remove</span>
</a>
<? endif ?>
<?= $title ?>
</div>
<div class="g-block-content">
<?= $content ?>
</div>
</div>

View File

@ -0,0 +1,44 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? // See http://docs.kohanaphp.com/libraries/pagination ?>
<ul class="g-paginator">
<? /* @todo This message isn't easily localizable */
$from_to_msg = t2("Item %from_number of %count",
"Items %from_number - %to_number of %count",
$total_items,
array("from_number" => $current_first_item,
"to_number" => $current_last_item,
"count" => $total_items)) ?>
<li>
<? if ($first_page): ?>
<a href="<?= str_replace('{page}', 1, $url) ?>" class="g-button ui-icon-left ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-seek-first"></span><?= t("First") ?></a>
<? else: ?>
<a class="g-button ui-icon-left ui-state-disabled ui-corner-all">
<span class="ui-icon ui-icon-seek-first"></span><?= t("First") ?></a>
<? endif ?>
<? if ($previous_page): ?>
<a href="<?= str_replace('{page}', $previous_page, $url) ?>" class="g-button ui-icon-left ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-seek-prev"></span><?= t("Previous") ?></a>
<? else: ?>
<a class="g-button ui-icon-left ui-state-disabled ui-corner-all">
<span class="ui-icon ui-icon-seek-prev"></span><?= t("Previous") ?></a>
<? endif ?>
</li>
<li class="g-info"><?= $from_to_msg ?></li>
<li class="g-text-right">
<? if ($next_page): ?>
<a href="<?= str_replace('{page}', $next_page, $url) ?>" class="g-button ui-icon-right ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-seek-next"></span><?= t("Next") ?></a>
<? else: ?>
<a class="g-button ui-state-disabled ui-icon-right ui-corner-all">
<span class="ui-icon ui-icon-seek-next"></span><?= t("Next") ?></a>
<? endif ?>
<? if ($last_page): ?>
<a href="<?= str_replace('{page}', $last_page, $url) ?>" class="g-button ui-icon-right ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-seek-end"></span><?= t("Last") ?></a>
<? else: ?>
<a class="g-button ui-state-disabled ui-icon-right ui-corner-all">
<span class="ui-icon ui-icon-seek-end"></span><?= t("Last") ?></a>
<? endif ?>
</li>
</ul>

View File

@ -0,0 +1,53 @@
/**
* Fix display in IE 6, 7
*/
#g-banner {
z-index: 2;
zoom: 1;
}
#g-sidebar {
overflow: hidden;
}
#g-photo,
#g-movie {
zoom: 1;
}
#g-photo .g-context-menu,
#g-movie .g-context-menu {
width: 240px;
}
input.submit {
clear: none !important;
display: inline !important;
}
.g-short-form input[type='submit'] {
line-height: 1em;
padding: .38em .3em;
}
#g-add-tag-form input.textbox {
width: 110px !important;
}
#g-add-tag-form input[type='submit'] {
padding: .3em 0 !important;
}
#g-dialog .g-cancel {
display: inline-block !important;
float: none !important;
}
.g-paginator .g-text-right {
width: 29%;
}
.g-paginator .ui-icon-right {
width: 60px;
}

View File

@ -0,0 +1,62 @@
/**
* Initialize jQuery UI and Gallery Plugins
* @todo Move ui-corner-all assignments to theme admin views
*/
$(document).ready(function(){
// Initialize Superfish menus
$("#g-site-admin-menu .g-menu").hide().addClass("sf-menu");
$("#g-site-admin-menu .g-menu").superfish({
delay: 500,
animation: {
opacity: "show",
height: "show"
},
pathClass: "g-selected",
speed: "fast"
}).show();
// Initialize status message effects
$("#g-action-status li").gallery_show_message();
// Initialize modal dialogs
$(".g-dialog-link").gallery_dialog();
// Initialize short forms
$(".g-short-form").gallery_short_form();
// Initialize ajax links
$(".g-ajax-link").gallery_ajax();
// Initialize panels
$(".g-panel-link").gallery_panel();
if ($("#g-photo-stream").length) {
// Vertically align thumbs in photostream
$(".g-item").gallery_valign();
}
// Apply jQuery UI button css to submit inputs
$("input[type=submit]:not(.g-short-form input)").addClass("ui-state-default ui-corner-all");
// Round view menu buttons
if ($("#g-admin-comments-menu").length) {
$("#g-admin-comments-menu ul").removeClass("g-menu");
$("#g-admin-comments-menu").addClass("g-buttonset");
$("#g-admin-comments-menu a").addClass("g-button ui-state-default");
$("#g-admin-comments-menu ul li:first a").addClass("ui-corner-left");
$("#g-admin-comments-menu ul li:last a").addClass("ui-corner-right");
}
// Round corners
$(".g-selected").addClass("ui-corner-all");
$(".g-available .g-block").addClass("ui-corner-all");
$(".g-unavailable").addClass("ui-corner-all");
// Remove titles for menu options since we're displaying that text anyway
$(".sf-menu a, .sf-menu li").removeAttr("title");
// Initialize button hover effect
$.fn.gallery_hover_init();
});

View File

@ -0,0 +1,122 @@
/**
* Initialize jQuery UI and Gallery Plugins
*/
$(document).ready(function() {
// Initialize Superfish menus (hidden, then shown to address IE issue)
$("#g-site-menu .g-menu").hide().addClass("sf-menu");
$("#g-site-menu .g-menu").superfish({
delay: 500,
animation: {
opacity:'show',
height:'show'
},
pathClass: "g-selected",
speed: 'fast'
}).show();
// Initialize status message effects
$("#g-action-status li").gallery_show_message();
// Initialize dialogs
$(".g-dialog-link").gallery_dialog();
// Initialize short forms
$(".g-short-form").gallery_short_form();
// Apply jQuery UI icon, hover, and rounded corner styles
$("input[type=submit]:not(.g-short-form input)").addClass("ui-state-default ui-corner-all");
if ($("#g-view-menu").length) {
$("#g-view-menu ul").removeClass("g-menu").removeClass("sf-menu");
$("#g-view-menu a").addClass("ui-icon");
}
// Apply jQuery UI icon and hover styles to context menus
if ($(".g-context-menu").length) {
$(".g-context-menu li").addClass("ui-state-default");
$(".g-context-menu a").addClass("g-button ui-icon-left");
$(".g-context-menu a").prepend("<span class=\"ui-icon\"></span>");
$(".g-context-menu a span").each(function() {
var iconClass = $(this).parent().attr("class").match(/ui-icon-.[^\s]+/).toString();
$(this).addClass(iconClass);
});
}
// Remove titles for menu options since we're displaying that text anyway
$(".sf-menu a, .sf-menu li").removeAttr("title");
// Album and search results views
if ($("#g-album-grid").length) {
// Set equal height for album items and vertically align thumbnails/metadata
$('.g-item').equal_heights().gallery_valign();
// Initialize thumbnail hover effect
$(".g-item").hover(
function() {
// Insert a placeholder to hold the item's position in the grid
var placeHolder = $(this).clone().attr("id", "g-place-holder");
$(this).after($(placeHolder));
// Style and position the hover item
var position = $(this).position();
$(this).css("top", position.top).css("left", position.left);
$(this).addClass("g-hover-item");
// Initialize the contextual menu
$(this).gallery_context_menu();
// Set the hover item's height
$(this).height("auto");
var context_menu = $(this).find(".g-context-menu");
var adj_height = $(this).height() + context_menu.height();
if ($(this).next().height() > $(this).height()) {
$(this).height($(this).next().height());
} else if ($(this).prev().height() > $(this).height()) {
$(this).height($(this).prev().height());
} else {
$(this).height(adj_height);
}
},
function() {
// Reset item height and position
if ($(this).next().height()) {
var sib_height = $(this).next().height();
} else {
var sib_height = $(this).prev().height();
}
if ($.browser.msie && $.browser.version >= 8) {
sib_height = sib_height + 1;
}
$(this).css("height", sib_height);
$(this).css("position", "relative");
$(this).css("top", 0).css("left", 0);
// Remove the placeholder and hover class from the item
$(this).removeClass("g-hover-item");
$("#g-place-holder").remove();
}
);
}
// Photo/Item item view
if ($("#g-photo,#g-movie").length) {
// Ensure the resized image fits within its container
$("#g-photo,#g-movie").gallery_fit_photo();
// Initialize context menus
$("#g-photo,#g-movie").hover(function(){
$(this).gallery_context_menu();
});
// Add scroll effect for links to named anchors
$.localScroll({
queue: true,
duration: 1000,
hash: true
});
$(this).find(".g-dialog-link").gallery_dialog();
$(this).find(".g-ajax-link").gallery_ajax();
}
// Initialize button hover effect
$.fn.gallery_hover_init();
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 918 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 B

View File

@ -0,0 +1,42 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? // @todo Set hover on AlbumGrid list items for guest users ?>
<div id="g-info">
<?= $theme->album_top() ?>
<h1><?= html::purify($item->title) ?></h1>
<div class="g-description"><?= nl2br(html::purify($item->description)) ?></div>
</div>
<ul id="g-album-grid" class="ui-helper-clearfix">
<? if (count($children)): ?>
<? foreach ($children as $i => $child): ?>
<? $item_class = "g-photo"; ?>
<? if ($child->is_album()): ?>
<? $item_class = "g-album"; ?>
<? endif ?>
<li id="g-item-id-<?= $child->id ?>" class="g-item <?= $item_class ?>">
<?= $theme->thumb_top($child) ?>
<a href="<?= $child->url() ?>">
<?= $child->thumb_img(array("class" => "g-thumbnail")) ?>
</a>
<?= $theme->thumb_bottom($child) ?>
<?= $theme->context_menu($child, "#g-item-id-{$child->id} .g-thumbnail") ?>
<h2><span class="<?= $item_class ?>"></span>
<a href="<?= $child->url() ?>"><?= html::purify($child->title) ?></a></h2>
<ul class="g-metadata">
<?= $theme->thumb_info($child) ?>
</ul>
</li>
<? endforeach ?>
<? else: ?>
<? if ($user->admin || access::can("add", $item)): ?>
<? $addurl = url::site("uploader/index/$item->id") ?>
<li><?= t("There aren't any photos here yet! <a %attrs>Add some</a>.",
array("attrs" => html::mark_clean("href=\"$addurl\" class=\"g-dialog-link\""))) ?></li>
<? else: ?>
<li><?= t("There aren't any photos here yet!") ?></li>
<? endif; ?>
<? endif; ?>
</ul>
<?= $theme->album_bottom() ?>
<?= $theme->paginator() ?>

View File

@ -0,0 +1,10 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? if ($anchor): ?>
<a name="<?= $anchor ?>"></a>
<? endif ?>
<div id="<?= $css_id ?>" class="g-block">
<h2><?= $title ?></h2>
<div class="g-block-content">
<?= $content ?>
</div>
</div>

View File

@ -0,0 +1,29 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div id="g-album-header">
<div id="g-album-header-buttons">
<?= $theme->dynamic_top() ?>
</div>
<h1><?= html::clean($title) ?></h1>
</div>
<ul id="g-album-grid" class="ui-helper-clearfix">
<? foreach ($children as $i => $child): ?>
<li class="g-item <?= $child->is_album() ? "g-album" : "" ?>">
<?= $theme->thumb_top($child) ?>
<a href="<?= $child->url() ?>">
<img id="g-photo-id-<?= $child->id ?>" class="g-thumbnail"
alt="photo" src="<?= $child->thumb_url() ?>"
width="<?= $child->thumb_width ?>"
height="<?= $child->thumb_height ?>" />
</a>
<h2><?= html::purify($child->title) ?></h2>
<?= $theme->thumb_bottom($child) ?>
<ul class="g-metadata">
<?= $theme->thumb_info($child) ?>
</ul>
</li>
<? endforeach ?>
</ul>
<?= $theme->dynamic_bottom() ?>
<?= $theme->paginator() ?>

View File

@ -0,0 +1,19 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div id="g-item">
<?= $theme->photo_top() ?>
<?= $theme->paginator() ?>
<div id="g-movie" class="ui-helper-clearfix">
<?= $theme->resize_top($item) ?>
<?= $item->movie_img(array("class" => "g-movie", "id" => "g-item-id-{$item->id}")) ?>
<?= $theme->resize_bottom($item) ?>
</div>
<div id="g-info">
<h1><?= html::purify($item->title) ?></h1>
<div><?= nl2br(html::purify($item->description)) ?></div>
</div>
<?= $theme->photo_bottom() ?>
</div>

View File

@ -0,0 +1,6 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<ul class="g-message-block">
<li class="g-warning"><?= t("No active sidebar blocks.") ?>
<br/><a href="<?= url::site("admin/sidebar") ?>"><?= t("Add blocks") ?></a>
</li>
</ul>

View File

@ -0,0 +1,151 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>
<? if ($page_title): ?>
<?= $page_title ?>
<? else: ?>
<? if ($theme->item()): ?>
<? if ($theme->item()->is_album()): ?>
<?= t("Browse Album :: %album_title", array("album_title" => $theme->item()->title)) ?>
<? elseif ($theme->item()->is_photo()): ?>
<?= t("Photo :: %photo_title", array("photo_title" => $theme->item()->title)) ?>
<? else: ?>
<?= t("Movie :: %movie_title", array("movie_title" => $theme->item()->title)) ?>
<? endif ?>
<? elseif ($theme->tag()): ?>
<?= t("Browse Tag :: %tag_title", array("tag_title" => $theme->tag()->name)) ?>
<? else: /* Not an item, not a tag, no page_title specified. Help! */ ?>
<?= t("Gallery") ?>
<? endif ?>
<? endif ?>
</title>
<link rel="shortcut icon" href="<?= url::file("lib/images/favicon.ico") ?>" type="image/x-icon" />
<?= $theme->css("yui/reset-fonts-grids.css") ?>
<?= $theme->css("superfish/css/superfish.css") ?>
<?= $theme->css("themeroller/ui.base.css") ?>
<?= $theme->css("gallery.common.css") ?>
<?= $theme->css("screen.css") ?>
<!--[if lte IE 8]>
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
media="screen,print,projection" />
<![endif]-->
<? if ($theme->page_type == "collection"): ?>
<? if ($thumb_proportion != 1): ?>
<? $new_width = round($thumb_proportion * 213) ?>
<? $new_height = round($thumb_proportion * 240) ?>
<style type="text/css">
.g-view #g-content #g-album-grid .g-item {
width: <?= $new_width ?>px;
height: <?= $new_height ?>px;
/* <?= $thumb_proportion ?> */
}
</style>
<? endif ?>
<? endif ?>
<?= $theme->script("jquery.js") ?>
<?= $theme->script("jquery.form.js") ?>
<?= $theme->script("jquery-ui.js") ?>
<?= $theme->script("gallery.common.js") ?>
<? /* MSG_CANCEL is required by gallery.dialog.js */ ?>
<script type="text/javascript">
var MSG_CANCEL = <?= t('Cancel')->for_js() ?>;
</script>
<?= $theme->script("gallery.ajax.js") ?>
<?= $theme->script("gallery.dialog.js") ?>
<?= $theme->script("superfish/js/superfish.js") ?>
<?= $theme->script("jquery.localscroll.js") ?>
<?= $theme->script("ui.init.js") ?>
<? /* These are page specific, but if we put them before $theme->head() they get combined */ ?>
<? if ($theme->page_subtype == "photo"): ?>
<?= $theme->script("jquery.scrollTo.js") ?>
<?= $theme->script("gallery.show_full_size.js") ?>
<? elseif ($theme->page_subtype == "movie"): ?>
<?= $theme->script("flowplayer.js") ?>
<? endif ?>
<?= $theme->head() ?>
</head>
<body <?= $theme->body_attributes() ?>>
<?= $theme->page_top() ?>
<div id="doc4" class="yui-t5 g-view">
<?= $theme->site_status() ?>
<div id="g-header" class="ui-helper-clearfix">
<div id="g-banner">
<? if ($header_text = module::get_var("gallery", "header_text")): ?>
<?= $header_text ?>
<? else: ?>
<a id="g-logo" class="g-left" href="<?= item::root()->url() ?>" title="<?= t("go back to the Gallery home")->for_html_attr() ?>">
<img width="107" height="48" alt="<?= t("Gallery logo: Your photos on your web site")->for_html_attr() ?>" src="<?= url::file("lib/images/logo.png") ?>" />
</a>
<? endif ?>
<?= $theme->user_menu() ?>
<?= $theme->header_top() ?>
<!-- hide the menu until after the page has loaded, to minimize menu flicker -->
<div id="g-site-menu" style="visibility: hidden">
<?= $theme->site_menu($theme->item() ? "#g-item-id-{$theme->item()->id}" : "") ?>
</div>
<script type="text/javascript"> $(document).ready(function() { $("#g-site-menu").css("visibility", "visible"); }) </script>
<?= $theme->header_bottom() ?>
</div>
<? if ($theme->item() && !empty($parents)): ?>
<ul class="g-breadcrumbs">
<? $i = 0 ?>
<? foreach ($parents as $parent): ?>
<li<? if ($i == 0) print " class=\"g-first\"" ?>>
<!-- Adding ?show=<id> causes Gallery3 to display the page
containing that photo. For now, we just do it for
the immediate parent so that when you go back up a
level you're on the right page. -->
<a href="<?= $parent->url($parent == $theme->item()->parent() ?
"show={$theme->item()->id}" : null) ?>">
<?= html::purify(text::limit_chars($parent->title, 15)) ?>
</a>
</li>
<? $i++ ?>
<? endforeach ?>
<li class="g-active<? if ($i == 0) print " g-first" ?>">
<?= html::purify(text::limit_chars($theme->item()->title, 15)) ?>
</li>
</ul>
<? endif ?>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<div id="g-content" class="yui-g">
<?= $theme->messages() ?>
<?= $content ?>
</div>
</div>
</div>
<div id="g-sidebar" class="yui-b">
<? if ($theme->page_subtype != "login"): ?>
<?= new View("sidebar.html") ?>
<? endif ?>
</div>
</div>
<div id="g-footer" class="ui-helper-clearfix">
<?= $theme->footer() ?>
<? if ($footer_text = module::get_var("gallery", "footer_text")): ?>
<?= $footer_text ?>
<? endif ?>
<? if (module::get_var("gallery", "show_credits")): ?>
<ul id="g-credits" class="g-inline">
<?= $theme->credits() ?>
</ul>
<? endif ?>
</div>
</div>
<?= $theme->page_bottom() ?>
</body>
</html>

View File

@ -0,0 +1,87 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?
// This is a generic paginator for album, photo and movie pages. Depending on the page type,
// there are different sets of variables available. With this data, you can make a paginator
// that lets you say "You're viewing photo 5 of 35", or "You're viewing photos 10 - 18 of 37"
// for album views.
//
// Available variables for all page types:
// $page_type - "collection", "item", or "other"
// $page_subtype - "album", "movie", "photo", "tag", etc.
// $previous_page_url - the url to the previous page, if there is one
// $next_page_url - the url to the next page, if there is one
// $total - the total number of photos in this album
//
// Available for the "collection" page types:
// $page - what page number we're on
// $max_pages - the maximum page number
// $page_size - the page size
// $first_page_url - the url to the first page, or null if we're on the first page
// $last_page_url - the url to the last page, or null if we're on the last page
// $first_visible_position - the position number of the first visible photo on this page
// $last_visible_position - the position number of the last visible photo on this page
//
// Available for "item" page types:
// $position - the position number of this photo
//
?>
<ul class="g-paginator ui-helper-clearfix">
<li class="g-first">
<? if ($page_type == "collection"): ?>
<? if (isset($first_page_url)): ?>
<a href="<?= $first_page_url ?>" class="g-button ui-icon-left ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-seek-first"></span><?= t("First") ?></a>
<? else: ?>
<a class="g-button ui-icon-left ui-state-disabled ui-corner-all">
<span class="ui-icon ui-icon-seek-first"></span><?= t("First") ?></a>
<? endif ?>
<? endif ?>
<? if (isset($previous_page_url)): ?>
<a href="<?= $previous_page_url ?>" class="g-button ui-icon-left ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-seek-prev"></span><?= t("Previous") ?></a>
<? else: ?>
<a class="g-button ui-icon-left ui-state-disabled ui-corner-all">
<span class="ui-icon ui-icon-seek-prev"></span><?= t("Previous") ?></a>
<? endif ?>
</li>
<li class="g-info">
<? if ($total): ?>
<? if ($page_type == "collection"): ?>
<?= /* @todo This message isn't easily localizable */
t2("Photo %from_number of %count",
"Photos %from_number - %to_number of %count",
$total,
array("from_number" => $first_visible_position,
"to_number" => $last_visible_position,
"count" => $total)) ?>
<? else: ?>
<?= t("%position of %total", array("position" => $position, "total" => $total)) ?>
<? endif ?>
<? else: ?>
<?= t("No photos") ?>
<? endif ?>
</li>
<li class="g-text-right">
<? if (isset($next_page_url)): ?>
<a href="<?= $next_page_url ?>" class="g-button ui-icon-right ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-seek-next"></span><?= t("Next") ?></a>
<? else: ?>
<a class="g-button ui-state-disabled ui-icon-right ui-corner-all">
<span class="ui-icon ui-icon-seek-next"></span><?= t("Next") ?></a>
<? endif ?>
<? if ($page_type == "collection"): ?>
<? if (isset($last_page_url)): ?>
<a href="<?= $last_page_url ?>" class="g-button ui-icon-right ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-seek-end"></span><?= t("Last") ?></a>
<? else: ?>
<a class="g-button ui-state-disabled ui-icon-right ui-corner-all">
<span class="ui-icon ui-icon-seek-end"></span><?= t("Last") ?></a>
<? endif ?>
<? endif ?>
</li>
</ul>

View File

@ -0,0 +1,38 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? if (access::can("view_full", $theme->item())): ?>
<!-- Use javascript to show the full size as an overlay on the current page -->
<script type="text/javascript">
$(document).ready(function() {
$(".g-fullsize-link").click(function() {
$.gallery_show_full_size(<?= html::js_string($theme->item()->file_url()) ?>, "<?= $theme->item()->width ?>", "<?= $theme->item()->height ?>");
return false;
});
});
</script>
<? endif ?>
<div id="g-item">
<?= $theme->photo_top() ?>
<?= $theme->paginator() ?>
<div id="g-photo">
<?= $theme->resize_top($item) ?>
<? if (access::can("view_full", $item)): ?>
<a href="<?= $item->file_url() ?>" class="g-fullsize-link" title="<?= t("View full size")->for_html_attr() ?>">
<? endif ?>
<?= $item->resize_img(array("id" => "g-item-id-{$item->id}", "class" => "g-resize")) ?>
<? if (access::can("view_full", $item)): ?>
</a>
<? endif ?>
<?= $theme->resize_bottom($item) ?>
</div>
<div id="g-info">
<h1><?= html::purify($item->title) ?></h1>
<div><?= nl2br(html::purify($item->description)) ?></div>
</div>
<?= $theme->photo_bottom() ?>
</div>

View File

@ -0,0 +1,16 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?= $theme->sidebar_top() ?>
<div id="g-view-menu" class="g-buttonset ui-helper-clearfix">
<? if ($page_subtype == "album"):?>
<?= $theme->album_menu() ?>
<? elseif ($page_subtype == "photo") : ?>
<?= $theme->photo_menu() ?>
<? elseif ($page_subtype == "movie") : ?>
<?= $theme->movie_menu() ?>
<? elseif ($page_subtype == "tag") : ?>
<?= $theme->tag_menu() ?>
<? endif ?>
</div>
<?= $theme->sidebar_blocks() ?>
<?= $theme->sidebar_bottom() ?>

View File

@ -0,0 +1,181 @@
<?php defined("SYSPATH") or die("No direct script access.");/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 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 themeroller {
static function extract_zip_file($zipfile) {
$zip = new ZipArchive();
if ($zip->open($zipfile) === true) {
$extract_path = VARPATH . trim($zipfile, "/") . ".d";
Session::instance()->set("theme_extract_path", $extract_path);
$zip->extractTo($extract_path);
$zip->close();
return $extract_path;
} else {
return false;
}
}
static function recursive_directory_delete($path) {
if (is_dir($path)) {
$objects = scandir($path);
foreach ($objects as $object) {
if ($object[0] != ".") {
$object_path = "$path/$object";
if (filetype($object_path) == "dir") {
self::recursive_directory_delete($object_path);
} else {
unlink($object_path);
}
}
}
}
}
static function get_theme_name($extract_path) {
$theme_name = null;
if ($handle = opendir($extract_path . "/css")) {
while (false !== ($file = readdir($handle))) {
if ($file[0] !== ".") {
$theme_name = basename($file);
break;
}
}
if (empty($theme_name)) {
Kohana_Log::add("error", "zip file: no theme name");
$post->add_error($field, "invalid zipfile");
}
closedir($handle);
}
return $theme_name;
}
static function get_theme_parameters($original_name, $css_path, $is_admin) {
$parameters = array();
$css_files = glob("$css_path/css/$original_name/jquery*.css");
$css_contents = file_get_contents($css_files[0]);
$parameters["colors"] = $parameters["icons"] = array();
if (preg_match("/[?|&](.*)/", $css_contents, $matches)) {
if (preg_match_all("/&{0,1}(\w+)=([a-zA-Z0-9\-_\%\.,]*)/", $matches[1], $colors, PREG_SET_ORDER)) {
foreach ($colors as $color) {
$parameters["colors"][$color[1]] = $color[2];
if (strpos($color[1], "icon") === 0) {
$parameters["icons"][] = $color[2];
}
}
}
}
$parameters["js"] = $is_admin ? glob(MODPATH . "themeroller/data/js/admin_*.js") :
glob(MODPATH . "themeroller/data/js/site_*.js");
$parameters["standard_css"] = glob(MODPATH . "themeroller/data/css/*.css");
$parameters["masks"] = glob(MODPATH . "themeroller/data/masks/images/*.png");
$parameters["icon_mask"] = MODPATH . "themeroller/data/masks/css/themeroller/ui-icons_mask_256x240.png";
$parameters["views"] = $is_admin ? glob(MODPATH . "themeroller/data/admin_views/*.html.php") :
glob(MODPATH . "themeroller/data/views/*.html.php");
$parameters["css_files"] = $css_files;
$parameters["images"] =
glob("$css_path/development-bundle/themes/$original_name/images/ui-bg*.png");
$thumb_dir = $is_admin ? "admin_thumbnail" : "site_thumbnail";
$parameters["thumbnail"] = MODPATH . "themeroller/data/masks/$thumb_dir/thumbnail.png";
$parts = glob(MODPATH . "themeroller/data/masks/$thumb_dir/thumbnail_*.png");
$parameters["thumbnail_parts"] = array();
foreach ($parts as $thumb_file) {
if (preg_match("/thumbnail_(.*)\.png$/", $thumb_file, $matches)) {
$parameters["thumbnail_parts"][] = array("file" => $thumb_file,
"color" => $parameters["colors"][$matches[1]]);
}
}
return $parameters;
}
static function generate_image($mask_file, $color, $target_dir, $replace_with="") {
$output = $target_dir . str_replace("mask", $replace_with, basename($mask_file));
$mask = imagecreatefrompng($mask_file);
$image = imagecreatetruecolor(imagesx($mask), imagesy($mask));
$icon_color = self::_rgb(hexdec($color));
$transparent = imagecolorallocatealpha($image,
$icon_color['red'], $icon_color['green'], $icon_color['blue'], 127);
imagefill($image, 0, 0, $transparent);
imagefilter($mask, IMG_FILTER_EDGEDETECT);
for ($y=0; $y < imagesy($mask); $y++) {
for ($x=0; $x < imagesx($mask); $x++) {
$pixel_color = imagecolorsforindex($mask, imagecolorat($mask, $x, $y));
$mask_color = self::_grayscale_pixel($pixel_color);
$mask_alpha = 127 - (floor($mask_color["red"] / 2) * (1 - ($pixel_color["alpha"] / 127)));
$new_color = imagecolorallocatealpha($image,
$icon_color['red'], $icon_color['green'], $icon_color['blue'], $mask_alpha);
imagesetpixel($image, $x, $y, $new_color);
}
}
imagesavealpha($image, true);
imagealphablending($image, false);
imagepng($image, $output);
imagedestroy($image);
imagedestroy($mask);
}
static function generate_thumbnail($base, $parts, $target) {
$image = imagecreatefrompng($base);
$transparent = imagecolorallocatealpha($image, 0, 0, 0, 127);
imagefill($image, 0, 0, $transparent);
$width = imagesx($image);
$height = imagesy($image);
foreach ($parts as $thumb_part) {
$color = self::_rgb(hexdec($thumb_part["color"]));
$image_part = imagecreatefrompng($thumb_part["file"]);
for ($y=0; $y < imagesy($image_part); $y++) {
for ($x=0; $x < imagesx($image_part); $x++) {
$pixel_color = imagecolorsforindex($image_part, imagecolorat($image_part, $x, $y));
$new_color = imagecolorallocatealpha($image,
$color['red'], $color['green'], $color['blue'], $pixel_color["alpha"]);
imagesetpixel($image, $x, $y, $new_color);
}
}
imagedestroy($image_part);
}
//$new_width = 200;
//$new_height = floor($height * $new_width / $width);
//$resized = imagecreatetruecolor($new_width, $new_height);
//imagecopyresampled($resized, $image, 0, 0, 0, 0,$new_width, $new_height, $width, $height);
imagesavealpha($image, true);
imagealphablending($image, false);
imagepng($image, $target);
imagedestroy($image);
}
private static function _rgb($color) {
$r = ($color >> 16) & 0xff;
$g = ($color >> 8) & 0xff;
$b = $color & 0xff;
return array("red" => $r, "green" => $g, "blue" => $b, "alpha" => 0);
}
private static function _grayscale_pixel($color) {
$gray = round(($color['red'] * 0.299) + ($color['green'] * 0.587) + ($color['blue'] * 0.114));
return array("red" => $gray, "green" => $gray, "blue" => $gray, "alpha" => 0);
}
}

View File

@ -0,0 +1,27 @@
<?php defined("SYSPATH") or die("No direct script access.");/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 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 themeroller_event {
static function admin_menu($admin_menu, $theme) {
$admin_menu->get("appearance_menu")
->append(Menu::factory("dialog")
->id("themeroller")
->label(t("Import themeroller"))
->url(url::site("admin/themeroller/form_upload")));
}
}

View File

@ -0,0 +1,35 @@
<?php defined("SYSPATH") or die("No direct script access.");/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 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 themeroller_installer {
static function install() {
$version = module::get_version("themeroller");
if ($version == 0) {
/* @todo Put database creation here */
module::set_version("themeroller", 1);
}
}
static function upgrade($version) {
}
static function uninstall() {
/* @todo Put database table drops here */
module::delete("themeroller");
}
}

View File

@ -0,0 +1,220 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 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 themeroller_task_Core {
static function available_tasks() {
// Return empty array so nothing appears in the maintenance screen
return array();
}
static function create_theme($task) {
$mode = $task->get("mode", "init");
$start = microtime(true);
$theme_name = $task->get("theme_name");
$is_admin = $task->get("is_admin", false);
$theme_path = THEMEPATH . "$theme_name/";
$parameters = $task->get("parameters");
$completed = $task->get("completed", 0);
switch ($mode) {
case "init":
$views = glob(MODPATH . "themeroller/data/views/*.html.php");
$task->set("mode", "create_directory");
$parameters = themeroller::get_theme_parameters($task->get("original_name"),
$task->get("path"),
$is_admin);
$task->set("total_activites",
7 // number of directories to create
+ 3 // screen.css, theme.info, thumbnail
+ count($parameters["standard_css"]) // number of standard css to copy
+ count($parameters["views"]) // number of views to copy
+ count($parameters["js"]) // number of javascript files to copy
+ count($parameters["masks"]) // number of images to generate
+ count($parameters["icons"]) // number of icon images to generate
+ count($parameters["css_files"]) // number of css files
+ count($parameters["images"])); // number of image files to copy
$task->status = t("Starting up");
break;
case "create_directory":
$completed = $task->get("completed");
foreach (array("", "css", "css/themeroller", "css/themeroller/images", "images",
"js", "views") as $dir) {
$path = "{$theme_path}$dir";
$completed++;
if (!file_exists($path)) {
mkdir($path);
chmod($path, 0755);
}
}
$task->status = t("Directory created");
$task->set("mode", "copy_views");
break;
case "copy_views":
$task->status = t("Copying views");
while (!empty($parameters["views"]) && microtime(true) - $start < 1.5) {
$view = array_shift($parameters["views"]);
$target = "{$theme_path}views/" . basename($view);
if (!file_exists($target)) {
copy($view, $target);
}
$completed++;
}
if (empty($parameters["views"])){
$task->status = t("Views copied");
$task->set("mode", "copy_themeroller_images");
}
break;
case "copy_themeroller_images":
$task->status = t("Copying themeroller images");
while (!empty($parameters["images"]) && microtime(true) - $start < 1.5) {
$image = array_shift($parameters["images"]);
$target = "{$theme_path}css/themeroller/images/" . basename($image);
if (!file_exists($target)) {
copy($image, $target);
}
$completed++;
}
if (empty($parameters["views"])){
$task->status = t("Themeroller images copied");
$task->set("mode", "copy_css");
}
break;
case "copy_css":
$task->status = t("Copying themeroller css");
$target = "{$theme_path}css/themeroller/ui.base.css";
copy($parameters["css_files"][0], $target);
$completed++;
$task->status = t("Themeroller css copied");
$task->set("mode", "generate_images");
break;
case "generate_images":
$task->status = t("Generating gallery images");
$target_dir = "{$theme_path}images/";
$colors = $task->get("colors");
$image_color = $colors["iconColorHover"];
while (!empty($parameters["masks"]) && microtime(true) - $start < 1.5) {
$mask = array_shift($parameters["masks"]);
themeroller::generate_image($mask, $image_color, $target_dir);
$completed++;
}
if (empty($parameters["masks"])) {
$task->set("mode", "generate_icons");
$task->status = t("Gallery images generated");
}
break;
case "generate_icons":
$task->status = t("Generating icons");
$target_dir = "{$theme_path}css/themeroller/images/";
while (!empty($parameters["icons"]) && microtime(true) - $start < 1.5) {
$color = array_shift($parameters["icons"]);
themeroller::generate_image($parameters["icon_mask"], $color, $target_dir, $color);
$completed++;
}
if (empty($parameters["icons"])) {
$task->set("mode", "copy_standard_css");
$task->status = t("Icons generated");
}
break;
case "copy_standard_css":
$task->status = t("Copying standard css");
while (!empty($parameters["standard_css"]) && microtime(true) - $start < 1.5) {
$css = array_shift($parameters["standard_css"]);
$target = "{$theme_path}css/" . basename($css);
if (!file_exists($target)) {
copy($css, $target);
}
$completed++;
}
if (empty($parameters["standard_css"])){
$task->status = t("Standard css copied");
$task->set("mode", "copy_javascript");
}
break;
case "copy_javascript":
$task->status = t("Copying javascript");
while (!empty($parameters["js"]) && microtime(true) - $start < 1.5) {
$js = array_shift($parameters["js"]);
$target = "{$theme_path}js/" . str_replace(array("admin_", "site_"), "", basename($js));
if (!file_exists($target)) {
copy($js, $target);
}
$completed++;
}
if (empty($parameters["js"])){
$task->status = t("Javascript copied");
$task->set("mode", "generate_screen_css");
}
break;
case "generate_screen_css":
$file = "{$theme_path}/css/screen.css";
$v = new View(($is_admin ? "admin" : "site") . "_screen.css");
$v->display_name = $task->get("display_name");
foreach ($parameters["colors"] as $color => $value) {
$v->$color = $value;
}
ob_start();
print $v->render();
file_put_contents($file, ob_get_contents());
ob_end_clean();
$completed++;
$task->status = t("Screen css generated");
$task->set("mode", "generate_thumbnail");
break;
case "generate_thumbnail":
themeroller::generate_thumbnail($parameters["thumbnail"],
$parameters["thumbnail_parts"],
"{$theme_path}thumbnail.png");
$task->status = t("Thumbnail generated");
$task->set("mode", "generate_theme_info");
$completed++;
break;
case "generate_theme_info":
$file = "{$theme_path}/theme.info";
$v = new View("theme.info");
$v->display_name = $task->get("display_name");
$v->description = $task->get("description");
$v->user_name = identity::active_user()->name;
$v->is_admin = $is_admin;
ob_start();
print $v->render();
file_put_contents($file, ob_get_contents());
ob_end_clean();
$completed++;
$task->status = t("Theme info generated");
$task->set("mode", "done");
break;
case "done":
themeroller::recursive_directory_delete($task->get("path"));
$display_name = $task->get("display_name");
$task->done = true;
$task->state = "success";
$task->percent_complete = 100;
$completed = $task->get("total_activites");
message::info(t("Successfully generated: %name", array("name" => $display_name)));
}
$task->set("completed", $completed);
$task->set("parameters", $parameters);
$task->percent_complete = ($completed / $task->get("total_activites")) * 100;
}
}

View File

@ -0,0 +1,3 @@
name = "Theme generator"
description = "Use a JQuery UI theme to create a Gallery3 Theme"
version = 1

View File

@ -0,0 +1,622 @@
/**
* Gallery 3 Admin Redmond Theme Screen Styles
*
* @requires YUI reset, font, grids CSS
*
* Sheet organization:
* 1) Basic HTML elements
* 2) Reusable content blocks
* 3) Page layout containers
* 4) Content blocks in specific layout containers
* 5) Navigation and menus
* 6) jQuery and jQuery UI
* 7) Module color overrides
* 8) States and interactions
* 9) Right-to-left language styles
*
* @todo Review g-buttonset-vertical
*/
/** *******************************************************************
* 1) Basic HTML elements
**********************************************************************/
html {
color: #2e6e9e; /* fcDefault; */
}
body, html {
background-color: #dfeffc; /* bgColorDefault */
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; /* ffDefault */
font-size: 13px/1.231; /* fsDefault/ gallery_line_height */
}
p {
margin-bottom: 1em;
}
em {
font-style: oblique;
}
h1, h2, h3, h4, h5, strong, th {
font-weight: bold;
}
h1 {
font-size: 1.7em;
}
#g-dialog h1 {
font-size: 1.1em;
}
h2 {
font-size: 1.4em;
}
#g-sidebar .g-block h2 {
font-size: 1.2em;
}
#g-sidebar .g-block li {
margin-bottom: .6em;
}
h3 {
font-size: 1.2em;
}
/* Links ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
a,
.g-menu a,
#g-dialog a,
.g-button,
.g-button:active {
color: #2e6e9e !important; /* fcDefault; */
text-decoration: none;
-moz-outline-style: none;
}
a:hover,
.g-button:hover,
a.ui-state-hover,
input.ui-state-hover,
button.ui-state-hover {
color: #1d5987 !important; /* fcHover */
text-decoration: none;
-moz-outline-style: none;
}
a:hover,
#g-dialog a:hover {
text-decoration: underline;
}
.g-menu a:hover {
text-decoration: none;
}
/* Forms ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
fieldset {
margin-bottom: 1em;
}
#g-content form ul li {
padding: .4em 0;
}
#g-dialog form {
width: 270px;
}
#g-dialog fieldset {
margin-bottom: 0;
}
/* Tables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
table {
width: 100%;
}
#g-content table {
margin: .6em 0 2em 0;
}
caption,
th {
text-align: left;
}
th,
td {
border: none;
border-bottom: 1px solid #aaaaaa; /* borderColorContent */
padding: .5em;
vertical-align: middle;
}
th {
vertical-align: bottom;
white-space: nowrap;
}
.g-even {
background-color: #fcfdfd; /* bgColorContent */
}
.g-odd {
background-color: #dfeffc; /* bgColorDefault */
}
/** *******************************************************************
* 2) Reusable content blocks
*********************************************************************/
.g-block,
#g-content #g-admin-dashboard .g-block {
border: 1px solid #aaaaaa; /* borderColorContent */
padding: 1em;
}
.g-block h2 {
padding: .3em .8em;
}
.g-block-content {
margin-top: 1em;
}
#g-content .g-block {
border: none;
padding: 0;
}
#g-sidebar .g-block-content {
padding: 0;
}
#g-content .g-selected,
#g-content .g-available .g-block {
border: 1px solid #aaaaaa; /* borderColorContent */
padding: .8em;
}
.g-selected img,
.g-available .g-block img {
float: left;
margin: 0 1em 1em 0;
}
.g-selected {
background: #f5f8f9 ; /* bgColorActive */
}
.g-available .g-installed-toolkit:hover {
cursor: pointer;
background: #fcfdfd; /* bgColorContent */
}
.g-available .g-button {
width: 96%;
}
.g-selected .g-button {
display: none;
}
.g-unavailable {
border-color: #ffffff; /* fcHeader; */;
opacity: 0.4;
}
.g-info td {
background-color: transparent;
background-image: none;
}
.g-success td {
background-color: transparent;
background-image: none;
}
.g-error td {
background-color: #cd0a0a /* borderColorError */;
color: #cd0a0a /* fcError */;
background-image: none;
}
.g-warning td {
background-color: #fcf9ce;
background-image: none;
}
.g-module-status.g-info,
#g-log-entries .g-info,
.g-module-status.g-success,
#g-log-entries .g-success {
background-color: #fcfdfd /* bgColorContent */;
}
/*** ******************************************************************
* 3) Page layout containers
*********************************************************************/
/* Header ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-header #g-login-menu {
margin-top: 1em;
float: right;
}
/* View container ~~~~~~~~~~~~~~~~~~~~~~~~ */
.g-view {
background-color: #fcfdfd; /* bgColorContent */
border: 1px solid #a6c9e2; /* borderColorContent */
border-bottom: none;
min-width: 974px !important;
}
/* Layout containers ~~~~~~~~~~~~~~~~~~~~~ */
#g-header {
background-color: #5c9ccc; /* bgColorHeader */
border-bottom: 1px solid #4297d7; /* borderColorHeader */
color: #ffffff; /* fcHeader */
font-size: .8em;
margin-bottom: 20px;
padding: 0 20px;
position: relative;
}
#g-content {
font-size: 1.1em;
padding: 0 2em;
width: 96%;
}
#g-sidebar {
background-color: #fff;
font-size: .9em;
padding: 0 20px;
width: 220px;
}
#g-footer {
background-color: #5c9ccc; /* bgColorHeader */
border-top: 1px solid #4297d7; /* borderColorHeader */
color: #ffffff; /* fcHeader */
font-size: .8em;
margin-top: 20px;
padding: 10px 20px;
}
/** *******************************************************************
* 4) Content blocks in specific layout containers
*********************************************************************/
/* Header ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-header #g-logo {
background: transparent url('../../../lib/images/logo.png') no-repeat 0 .5em;
color: #ffffff /* fcHeader */ !important;
display: block;
height: 65px;
padding-top: 5px;
width: 105px;
}
#g-header #g-logo:hover {
color: #1d5987 !important; /* fcHover */
text-decoration: none;
}
#g-content .g-block h2 {
background-color: transparent;
padding-left: 0;
}
#g-sidebar .g-block-content {
padding-left: 1em;
}
.g-block .ui-dialog-titlebar {
margin: -1em -1em 0;
}
#g-sidebar .g-block h2 {
background: none;
}
/* Photo stream ~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-photo-stream {
}
#g-photo-stream .g-block-content ul {
border-right: 1px solid #e8e8e8;
height: 135px;
overflow: auto;
overflow: -moz-scrollbars-horizontal; /* for FF */
overflow-x: scroll; /* scroll horizontal */
overflow-y: hidden; /* Hide vertical*/
}
#g-content #g-photo-stream .g-item {
background-color: #dfeffc; /* bgColorDefault */
border: 1px solid #e8e8e8;
border-right-color: #ccc;
border-bottom-color: #ccc;
float: left;
height: 90px;
overflow: hidden;
text-align: center;
width: 90px;
}
#g-content .g-item {
background-color: #dfeffc; /* bgColorDefault */
border: 1px solid #e8e8e8;
border-right-color: #ccc;
border-bottom-color: #ccc;
height: 90px;
padding: 14px 8px;
text-align: center;
width: 90px;
}
/* Graphics settings ~~~~~~~~~~~~~~~~~~~~~ */
#g-admin-graphics .g-available .g-block {
clear: none;
float: left;
margin-right: 1em;
width: 30%;
}
/* Appearance settings ~~~~~~~~~~~~~~~~~~~ */
#g-site-theme,
#g-admin-theme {
float: left;
width: 48%;
}
#g-site-theme {
margin-right: 1em;
}
/* Block admin ~~~~~~~~~~~~~~~~~~~~~~~~~ */
.g-admin-blocks-list {
float: left;
margin: 0 2em 2em 0;
width: 30%;
}
.g-admin-blocks-list div:last-child {
border: .1em solid;
height: 100%;
}
.g-admin-blocks-list ul {
height: 98%;
margin: .1em .1em;
padding: .1em;
}
.g-admin-blocks-list ul li.g-draggable {
background-color: #dfeffc; /* bgColorDefault */
margin: .5em;
padding: .3em .8em;
}
/* In-line editing ~~~~~~~~~~~~~~~~~~~~~~ */
#g-in-place-edit-message {
background-color: #fcfdfd; /* bgColorContent */
}
/* Theme options ~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-theme-options-form {
border: 1px solid #aaaaaa; /* borderColorContent */
}
#g-theme-options-form-tabs {
border: none !important;
}
#g-theme-options-form fieldset {
border: none;
}
.ui-tabs .ui-tabs-nav li a {
padding: 0 1em;
}
.ui-tabs .ui-tabs-nav li a.g-error {
background: none no-repeat scroll 0 0 transparent;
color: #cd0a0a !important; /* fcError */
}
/** *******************************************************************
* 5) Navigation and menus
*********************************************************************/
/* Site Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-site-admin-menu {
bottom: 0;
font-size: 1.2em;
left: 140px;
position: absolute;
}
#g-site-admin-menu ul {
margin-bottom: 0;
}
/** *******************************************************************
* 6) jQuery and jQuery UI
*********************************************************************/
/* Superfish menu overrides ~~~~~~~~~~~~~~ */
.sf-menu a {
border-left:1px solid #a6c9e2; /* borderColorContent */
}
.sf-menu li,
.sf-menu li li,
.sf-menu li li ul li {
background-color: #dfeffc; /* bgColorDefault */
}
.sf-menu li:hover {
background-color: #d0e5f5; /* bgColorHover */
}
.sf-menu li:hover,
.sf-menu li.sfHover,
.sf-menu a:focus,
.sf-menu a:hover,
.sf-menu a:active {
background-color: #d0e5f5 !important; /* bgColorHover */
}
.sf-sub-indicator {
background-image: url("themeroller/images/ui-icons_2e83ff_256x240.png");
height: 16px;
width: 16px;
}
a > .sf-sub-indicator {
background-position: -64px -16px !important;
top: 0.6em;
}
.sf-menu ul a > .sf-sub-indicator {
background-position: -32px -16px !important;
}
/* jQuery UI Dialog ~~~~~~~~~~~~~~~~~~~~~~ */
#g-admin-dashboard .ui-state-highlight,
#g-sidebar .ui-state-highlight {
height: 2em;
margin-bottom: 1em;
}
.g-buttonset-vertical a {
width: 8em !important;
}
#g-admin-dashboard .ui-dialog-titlebar,
#g-admin-dashboard-sidebar .ui-dialog-titlebar {
padding: .2em .4em;
}
/** *******************************************************************
* 7) Module color overrides
*********************************************************************/
/* User admin form ~~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-user-admin-list .g-admin {
color: #2e6e9e !important; /* fcDefault; */
font-weight: bold;
}
.g-group {
border: 1px solid #aaaaaa !important; /* borderColorContent */
}
.g-group h4 {
background-color: #dfeffc !important; /* bgColorDefault */
border-bottom: 1px dashed #2e6e9e !important; /* fcDefault; */
}
.g-default-group h4,
.g-default-group .g-user {
color: #2e6e9e !important; /* fcDefault; */
}
/** *******************************************************************
* 8) States and interactions
*********************************************************************/
.g-draggable:hover {
border: 1px dashed #fbec88; /* bgColorHighlight */
}
.ui-sortable .g-target,
.ui-state-highlight {
background-color: #fbec88; /* bgColorHighlight */
border: 2px dotted #fad42e; /* borderColorHighlight */
}
/** *******************************************************************
* 9) Right to left styles
*********************************************************************/
.rtl #g-content #g-album-grid .g-item,
.rtl #g-site-theme,
.rtl #g-admin-theme,
.rtl .g-selected img,
.rtl .g-available .g-block img,
.rtl #g-content #g-photo-stream .g-item,
.rtl li.g-group,
.rtl #g-server-add-admin {
float: right;
}
.rtl #g-admin-graphics .g-available .g-block {
float: right;
margin-left: 1em;
margin-right: 0em;
}
.rtl #g-site-admin-menu {
left: auto;
right: 150px;
}
.rtl #g-header #g-login-menu {
float: left;
}
.rtl #g-header #g-login-menu li {
margin-left: 0;
padding-left: 0;
padding-right: 1.2em;
}
.rtl .g-selected img,
.rtl .g-available .g-block img {
margin: 0 0 1em 1em;
}
/* RTL Superfish ~~~~~~~~~~~~~~~~~~~~~~~~~ */
.rtl .sf-menu a {
border-right:1px solid #fff;
}
.rtl .sf-sub-indicator {
background: url("themeroller/images/ui-icons_2e83ff_256x240.png") no-repeat -96px -16px; /* 8-bit indexed alpha png. IE6 gets solid image only */
}
/*** shadows for all but IE6 ***/
.rtl .sf-shadow ul {
background: url('../images/superfish-shadow.png') no-repeat bottom left;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
-moz-border-radius-topright: 0;
-moz-border-radius-bottomleft: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-moz-border-radius-topleft: 17px;
-moz-border-radius-bottomright: 17px;
-webkit-border-top-left-radius: 17px;
-webkit-border-bottom-right-radius: 17px;
border-top-left-radius: 17px;
border-bottom-right-radius: 17px;
}

View File

@ -0,0 +1,64 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script type="text/javascript">
var target_value;
var animation = null;
var delta = 1;
animate_progress_bar = function() {
var current_value = parseInt($(".g-progress-bar div").css("width").replace("%", ""));
if (target_value > current_value) {
// speed up
delta = Math.min(delta + 0.04, 3);
} else {
// slow down
delta = Math.max(delta - 0.05, 1);
}
if (target_value == 100) {
$(".g-progress-bar").progressbar("value", 100);
} else if (current_value != target_value || delta != 1) {
var new_value = Math.min(current_value + delta, target_value);
$(".g-progress-bar").progressbar("value", new_value);
animation = setTimeout(function() { animate_progress_bar(target_value); }, 100);
} else {
animation = null;
delta = 1;
}
$.fn.gallery_hover_init();
}
update = function() {
$.ajax({
url: <?= html::js_string(url::site("admin/themeroller/run/$task->id?csrf=$csrf")) ?>,
dataType: "json",
success: function(data) {
target_value = data.percent_complete;
if (!animation) {
animate_progress_bar();
}
$("#g-status").html("" + data.status);
if (data.done) {
dismiss();
} else {
setTimeout(update, 100);
}
}
});
}
$(".g-progress-bar").progressbar({value: 0});
update();
dismiss = function() {
window.location = <?= html::js_string(url::site("admin/themes")) ?>;
}
</script>
<div id="g-progress">
</div>
<h1> <?= $task->name ?> </h1>
<div class="g-progress-bar"></div>
<div id="g-status">
<?= t("Starting up...") ?>
</div>
<div class="g-text-right">
<button id="g-pause-button" class="ui-state-default ui-corner-all" onclick="dismiss()"><?= t("Pause") ?></button>
<button id="g-done-button" class="ui-state-default ui-corner-all" style="display: none" onclick="dismiss()"><?= t("Close") ?></button>
</div>
</div>

View File

@ -0,0 +1,65 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script type="text/javascript" src="<?= url::file("lib/swfobject.js") ?>"></script>
<script type="text/javascript" src="<?= url::file("lib/uploadify/jquery.uploadify.min.js") ?>"></script>
<script type="text/javascript">
$("#g-admin-themeroller").ready(function() {
$("#g-themeroller-zip").uploadify({
'uploader' : '<?= url::file("lib/uploadify/uploadify.swf") ?>',
'script' : '<?= url::site("admin/themeroller/upload") ?>',
'cancelImg' : '<?= url::file("lib/uploadify/cancel.png") ?>',
'fileExt' : '*.zip',
scriptData : <?= json_encode($script_data) ?>,
'fileDesc' : <?= t("Archive file")->for_js() ?>,
'auto' : true,
'multi' : false,
fileDataName : 'zip_file',
'wmode' : 'transparent',
hideButton: true, /* should be true */
onComplete : function(event, queueID, fileObj, response, data) {
$("#g-themeroller-form").submit();
return false;
}
});
$("#g-themeroller-is-admin").change(function(event) {
var scriptData = $("#g-themeroller-zip").uploadifySettings("scriptData");
scriptData.is_admin = $(this).is(":checked") ? 1 : 0;
$("#g-themeroller-zip").uploadifySettings("scriptData", scriptData);
});
$("#g-themeroller-zipUploader").css({height: '40px', width: '70px', position: 'absolute'});
});
</script>
<div id="g-admin-themeroller">
<h1><?= t("Upload themeroller archive") ?></h1>
<?= form::open($action, array("method" => "get", "id" => "g-themeroller-form")) ?>
<fieldset>
<ul>
<li><?= access::csrf_form_field() ?></li>
<? if (!$is_writable): ?>
<li class="g-error">
<?= t("The theme directory is not writable. Please ensure that it is writable by the web server") ?>
</li>
<? endif ?>
<li><span><?= t("Upload and generate theme") ?></span></li>
<li>
<?= form::checkbox(array("name" => "is_admin",
"id" => "g-themeroller-is-admin")) ?>
<?= form::label("is_admin", t("Generate an admin theme")) ?>
</li>
<li>
<?= form::upload(array("name" => "zip_file",
"id" => "g-themeroller-zip",
"accept" => "application/zip, multipart/x-zip")) ?>
<span style="z-index: 1">
<button type="submit"
id="g-generate-theme"
class="<?= $submit_class ?>"
<? if ($not_writable): ?> disabled<? endif ?>>
<?= t("Upload") ?>
</button>
</span>
</li>
</ul>
</fieldset>
</form>
</div>

View File

@ -0,0 +1,864 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
/**
* Gallery 3 <?= $display_name ?> Screen Styles
*
* @requires YUI reset, font, grids CSS
*
* Sheet organization:
* 1) Font sizes, base HTML elements
* 2) Reusable content blocks
* 3) Page layout containers
* 4) Content blocks in specific layout containers
* 5) Navigation and menus
* 6) jQuery and jQuery UI
* 7) Forms
* 8) States and interactions
* 9) Right-to-left language styles
*/
/** *******************************************************************
* 1) Font sizes, base HTML elements
**********************************************************************/
html {
color: #<?= $fcDefault ?>;
}
body, html {
background-color: #<?= $bgColorDefault ?>;
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; /* ffDefault */
font-size: 13px/1.231; /* fsDefault/ gallery_line_height */
}
p {
margin-bottom: 1em;
}
em {
font-style: oblique;
}
h1, h2, h3, h4, h5, strong, th {
font-weight: bold;
}
h1 {
font-size: 1.7em;
}
#g-dialog h1 {
font-size: 1.1em;
}
h2 {
font-size: 1.4em;
}
#g-sidebar .g-block h2 {
font-size: 1.2em;
}
#g-sidebar .g-block li {
margin-bottom: .6em;
}
#g-content,
#g-site-menu,
h3 {
font-size: 1.2em;
}
#g-sidebar,
.g-breadcrumbs {
font-size: .9em;
}
#g-banner,
#g-footer,
.g-message {
font-size: .8em;
}
#g-album-grid .g-item,
#g-item #g-photo,
#g-item #g-movie {
font-size: .7em;
}
/* Links ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
a,
.g-menu a,
#g-dialog a,
.g-button,
.g-button:active {
color: #<?= $fcDefault ?> !important; /* fcDefault; */
cursor: pointer !important;
text-decoration: none;
-moz-outline-style: none;
}
a:hover,
.g-button:hover,
a.ui-state-hover,
input.ui-state-hover,
button.ui-state-hover {
color: #<?= $fcHover ?> !important; /* fcHover */
text-decoration: none;
-moz-outline-style: none;
}
a:hover,
#g-dialog a:hover {
text-decoration: underline;
}
.g-menu a:hover {
text-decoration: none;
}
#g-dialog #g-action-status li {
width: 400px;
white-space: normal;
padding-left: 32px;
}
/* Tables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
table {
width: 100%;
}
#g-content table {
margin: 1em 0;
}
caption,
th {
text-align: left;
}
th,
td {
border: none;
border-bottom: 1px solid #<?= $borderColorContent ?>;
padding: .5em;
}
td {
vertical-align: top;
}
.g-even {
background-color: #<?= $bgColorContent ?>;
}
.g-odd {
background-color: #<?= $bgColorDefault ?>;
}
/** *******************************************************************
* 2) Reusable content blocks
*********************************************************************/
.g-block h2 {
background-color: #<?= $bgColorDefault ?>;
padding: .3em .8em;
}
.g-block-content {
margin-top: 1em;
}
/*** ******************************************************************
* 3) Page layout containers
*********************************************************************/
/* View container ~~~~~~~~~~~~~~~~~~~~~~~~ */
.g-view {
background-color: #<?= $bgColorContent ?>;
border: 1px solid #<?= $borderColorContent ?>;
border-bottom: none;
}
/* Layout containers ~~~~~~~~~~~~~~~~~~~~~ */
#g-header {
margin-bottom: 1em;
}
#g-banner {
background-color: #<?= $bgColorHeader ?>;
border-bottom: 1px solid #<?= $borderColorHeader ?>;
color: #<?= $fcHeader?>;
min-height: 5em;
padding: 1em 20px;
position: relative;
}
#g-content {
padding-left: 20px;
position: relative;
width: 696px;
}
#g-sidebar {
padding: 0 20px;
width: 220px;
}
#g-footer {
background-color: #<?= $bgColorHeader ?>;
border-top: 1px solid #<?= $borderColorHeader ?>;
margin-top: 20px;
padding: 10px 20px;
color: #<?= $fcHeader?>;
}
/* Status and validation messages ~~~~ */
.g-message-block {
border: 1px solid #<?= $borderColorContent ?>;
}
#g-site-status li {
border-bottom: 1px solid #<?= $borderColorContent ?>;
}
/* Breadcrumbs ~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
.g-breadcrumbs li {
background: transparent url('../images/ico-separator.png') no-repeat scroll left center;
}
.g-breadcrumbs .g-first {
background: none;
}
/* Pagination ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
.g-paginator {
}
.g-paginator li {
}
.g-paginator .g-info {
background: none;
}
/* Dialogs and panels ~~~~~~~~~~~~~~~~~~ */
#g-dialog {
text-align: left;
}
#g-dialog legend {
display: none;
}
#g-dialog .g-cancel {
margin: .4em 1em;
}
#g-panel {
display: none;
padding: 1em;
}
/* Inline layout ~~~~~~~~~~ */
.g-inline li {
float: left;
margin-left: 1.8em;
padding-left: 0 !important;
}
.g-inline li.g-first {
margin-left: 0;
}
/** *******************************************************************
* 4) Content blocks in specific layout containers
*********************************************************************/
/* Header ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-banner #g-quick-search-form {
clear: right;
float: right;
margin-top: 1em;
}
#g-banner #g-quick-search-form input[type='text'] {
width: 17em;
}
#g-content .g-block h2 {
background-color: transparent;
padding-left: 0;
}
/* Sidebar ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-sidebar .g-block-content {
padding-left: 1em;
}
#g-sidebar #g-image-block {
overflow: hidden;
}
/* Album content ~~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-content #g-album-grid {
margin: 1em 0;
position: relative;
z-index: 1;
}
#g-content #g-album-grid .g-item {
background-color: #<?= $bgColorContent ?>;
border: 1px solid #<?= $bgColorContent ?>;
float: left;
padding: .6em 8px;
position: relative;
text-align: center;
width: 213px;
z-index: 1;
}
#g-content #g-album-grid .g-item h2 {
margin: 5px 0;
}
#g-content .g-photo h2,
#g-content .g-item .g-metadata {
display: none;
margin-bottom: .6em;
}
#g-content #g-album-grid .g-album {
background-color: #<?= $bgColorDefault ?>;
}
#g-content #g-album-grid .g-album h2 span.g-album {
background: transparent url('../images/ico-album.png') no-repeat top left;
display: inline-block;
height: 16px;
margin-right: 5px;
width: 16px;
}
#g-content #g-album-grid .g-hover-item {
border: 1px solid #<?= $borderColorContent ?>;
position: absolute !important;
z-index: 1000 !important;
}
#g-content .g-hover-item h2,
#g-content .g-hover-item .g-metadata {
display: block;
}
#g-content #g-album-grid #g-place-holder {
position: relative;
visibility: hidden;
z-index: 1;
}
/* Search results ~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-content #g-search-results {
margin-top: 1em;
padding-top: 1em;
}
/* Individual photo content ~~~~~~~~~~~~~~ */
#g-item {
position: relative;
width: 100%;
}
#g-item #g-photo,
#g-item #g-movie {
padding: 2.2em 0;
position: relative;
}
#g-item img.g-resize,
#g-item a.g-movie {
display: block;
margin: 0 auto;
}
/* Footer content ~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-footer #g-credits li {
padding-right: 1.2em;
}
/* In-line editing ~~~~~~~~~~~~~~~~~~~~~~ */
#g-in-place-edit-message {
background-color: #<?= $bgColorContent ?>;
}
/** *******************************************************************
* 5) Navigation and menus
*********************************************************************/
/* Login menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-banner #g-login-menu {
color: #<?= $fcHeader ?>;
float: right;
}
#g-banner #g-login-menu li {
padding-left: 1.2em;
}
/* Site Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-site-menu {
bottom: 0;
left: 140px;
position: absolute;
}
#g-site-menu ul {
margin-bottom: 0 !important;
}
/* Context Menu ~~~~~~~~~~~~~~~~~~~~~~~~~ */
.g-context-menu {
background-color: #<?= $bgColorContent ?>;
bottom: 0;
left: 0;
position: absolute;
}
.g-item .g-context-menu {
display: none;
margin-top: 2em;
width: 100%;
}
#g-item .g-context-menu ul {
display: none;
}
.g-context-menu li {
border-left: none;
border-right: none;
border-bottom: none;
}
.g-context-menu li a {
display: block;
line-height: 1.6em;
}
.g-hover-item .g-context-menu {
display: block;
}
.g-hover-item .g-context-menu li {
text-align: left;
}
.g-hover-item .g-context-menu a:hover {
text-decoration: none;
}
/* View Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-view-menu {
margin-bottom: 1em;
}
#g-view-menu a {
background-repeat: no-repeat;
background-position: 50% 50%;
height: 28px !important;
width: 43px !important;
}
#g-view-menu #g-slideshow-link {
background-image: url('../images/ico-view-slideshow.png');
}
#g-view-menu .g-fullsize-link {
background-image: url('../images/ico-view-fullsize.png');
}
#g-view-menu #g-comments-link {
background-image: url('../images/ico-view-comments.png');
}
#g-view-menu #g-print-digibug-link {
background-image: url('../images/ico-print.png');
}
/** *******************************************************************
* 6) jQuery and jQuery UI
*********************************************************************/
/* jQuery UI Dialog ~~~~~~~~~~~~~~~~~~~~~~ */
.ui-widget-overlay {
background: #<?= $bgColorOverlay ?>;
opacity: .7;
}
/* Rotate icon, ThemeRoller only provides one of these */
.ui-icon-rotate-ccw {
background-position: -192px -64px;
}
.ui-icon-rotate-cw {
background-position: -208px -64px;
}
/* Superfish menu overrides ~~~~~~~~~~~~~~ */
.sf-menu a {
border-left:1px solid #<?= $borderColorContent ?>;
}
.sf-menu li,
.sf-menu li li,
.sf-menu li li ul li {
background-color: #<?= $bgColorDefault ?>;
}
.sf-menu li:hover {
background-color: #<?= $bgColorHover ?>;
}
.sf-menu li:hover,
.sf-menu li.sfHover,
.sf-menu a:focus,
.sf-menu a:hover,
.sf-menu a:active {
background-color: #<?= $bgColorHover ?> !important;
}
.sf-sub-indicator {
background-image: url("themeroller/images/ui-icons_2e83ff_256x240.png");
height: 16px;
width: 16px;
}
a > .sf-sub-indicator {
background-position: -64px -16px !important;
top: 0.6em;
}
.sf-menu ul a > .sf-sub-indicator {
background-position: -32px -16px !important;
}
/** *******************************************************************
* 7) Forms
*********************************************************************/
fieldset {
border: 1px solid #<?= $borderColorContent ?>;
}
legend {
font-weight: bold;
color: #<?= $fcDefault ?>;
}
input.textbox,
input[type="text"],
input[type="password"],
textarea {
border: 1px solid #<?= $borderColorActive ?>;
border-top-color: #<?= $borderColorContent ?>;
border-left-color: #<?= $borderColorContent ?>;
color: #<?= $fcContent ?>;
}
input:focus,
input.textbox:focus,
input[type=text]:focus,
textarea:focus,
option:focus {
background-color: #<?= $bgColorActive ?>;
color: #<?= $fcContent ?>;
}
/* Forms in dialogs and panels ~~~~~~~~~ */
label,
input[readonly] {
background-color: #<?= $bgColorContent ?>;
color: #<?= $fcDefault ?>; /* fcDefault; */
}
/* Short forms ~~~~~~~~~~~~~~~~~~~~~~~ */
.g-short-form .textbox,
.g-short-form input[type=text] {
color: #<?= $fcContent ?>;
}
.g-short-form .textbox.g-error {
border: 1px solid #<?= $borderColorError ?>;
color: #<?= $fcError ?>;
}
/** *******************************************************************
* 8) States and interactions
*********************************************************************/
.g-active,
.g-enabled,
.g-available,
.g-selected,
.g-highlight {
font-weight: bold;
}
.g-inactive,
.g-disabled,
.g-unavailable,
.g-uneditable,
.g-locked,
.g-deselected,
.g-understate {
color: #<?= $borderColorContent ?>;
font-weight: normal;
}
.g-editable:hover {
background-color: #<?= $bgColorActive ?>;
}
form li.g-error,
form li.g-info,
form li.g-success,
form li.g-warning {
background-image: none;
}
form.g-error input[type="text"],
li.g-error input[type="text"],
form.g-error input[type="password"],
li.g-error input[type="password"],
form.g-error input[type="checkbox"],
li.g-error input[type="checkbox"],
form.g-error input[type="radio"],
li.g-error input[type="radio"],
form.g-error textarea,
li.g-error textarea,
form.g-error select,
li.g-error select {
border: 2px solid #<?= $fcError ?>;
}
.g-error,
.g-denied,
tr.g-error td.g-error,
#g-add-photos-status .g-error {
background: #<?= $borderColorError ?> url('../images/ico-error.png') no-repeat .4em 50%;
color: #<?= $fcError ?>;
}
.g-info {
background: #<?= $bgColorContent ?> url('../images/ico-info.png') no-repeat .4em 50%;
}
.g-success,
.g-allowed,
#g-add-photos-status .g-success {
background: #<?= $bgColorContent ?> url('../images/ico-success.png') no-repeat .4em 50%;
}
tr.g-success {
background-image: none;
}
tr.g-success td.g-success {
background-image: url('../images/ico-success.png');
}
.g-warning,
tr.g-warning td.g-warning {
background: #<?= $bgColorHighlight ?> url('../images/ico-warning.png') no-repeat .4em 50%;
}
form .g-error {
background-color: #<?= $bgColorError ?>;
}
.g-default {
background-color: #<?= $bgColorDefault ?>;
font-weight: bold;
}
.g-draggable:hover {
border: 1px dashed #<?= $bgColorHighlight ?>;
}
.ui-sortable .g-target,
.ui-state-highlight {
background-color: #<?= $bgColorHighlight ?>;
border: 2px dotted #<?= $borderColorHighlight ?>;
}
/* Ajax loading indicator ~~~~~~~~~~~~~~~~ */
.g-loading-large,
.g-dialog-loading-large {
background: #<?= $bgColorContent ?> url('../images/loading-large.gif') no-repeat center center !important;
}
.g-loading-small {
background: #<?= $bgColorContent ?> url('../images/loading-small.gif') no-repeat center center !important;
}
/** *******************************************************************
* 9) Right to left language styles
*********************************************************************/
.rtl #g-header #g-login-menu,
.rtl #g-header #g-quick-search-form {
clear: left;
float: left;
}
.rtl #g-header #g-login-menu li {
margin-left: 0;
padding-left: 0;
padding-right: 1.2em;
}
.rtl #g-site-menu {
left: auto;
right: 150px;
}
.rtl #g-view-menu #g-slideshow-link {
background-image: url('../images/ico-view-slideshow-rtl.png');
}
.rtl #g-sidebar .g-block-content {
padding-right: 1em;
padding-left: 0;
}
.rtl #g-footer #g-credits li {
padding-left: 1.2em !important;
padding-right: 0;
}
.rtl .g-breadcrumbs li {
background: transparent url('../images/ico-separator-rtl.png') no-repeat scroll right center;
}
.rtl .g-breadcrumbs .g-first {
background: none;
}
/* RTL Corner radius ~~~~~~~~~~~~~~~~~~~~~~ */
.rtl .g-buttonset .ui-corner-tl {
-moz-border-radius-topleft: 0;
-webkit-border-top-left-radius: 0;
border-top-left-radius: 0;
-moz-border-radius-topright: 5px !important;
-webkit-border-top-right-radius: 5px !important;
border-top-right-radius: 5px !important;
}
.rtl .g-buttonset .ui-corner-tr {
-moz-border-radius-topright: 0;
-webkit-border-top-right-radius: 0;
border-top-right-radius: 0;
-moz-border-radius-topleft: 5px !important;
-webkit-border-top-left-radius: 5px !important;
border-top-left-radius: 5px !important;
}
.rtl .g-buttonset .ui-corner-bl {
-moz-border-radius-bottomleft: 0;
-webkit-border-bottom-left-radius: 0;
border-bottom-left-radius: 0;
-moz-border-radius-bottomright: 5px !important;
-webkit-border-bottom-right-radius: 5px !important;
border-bottom-right-radius: 5px !important;
}
.rtl .g-buttonset .ui-corner-br {
-moz-border-radius-bottomright: 0;
-webkit-border-bottom-right-radius: 0;
border-bottom-right-radius: 0;
-moz-border-radius-bottomleft: 5px !important;
-webkit-border-bottom-left-radius: 5px !important;
border-bottom-left-radius: 5px !important;
}
.rtl .g-buttonset .ui-corner-right,
.rtl .ui-progressbar .ui-corner-right {
-moz-border-radius-topright: 0;
-webkit-border-top-right-radius: 0;
border-top-right-radius: 0;
-moz-border-radius-topleft: 5px !important;
-webkit-border-top-left-radius: 5px !important;
border-top-left-radius: 5px !important;
-moz-border-radius-bottomright: 0;
-webkit-border-bottom-right-radius: 0;
border-bottom-right-radius: 0;
-moz-border-radius-bottomleft: 5px !important;
-webkit-border-bottom-left-radius: 5px !important;
border-bottom-left-radius: 5px !important;
}
.rtl .g-buttonset .ui-corner-left,
.rtl .ui-progressbar .ui-corner-left {
-moz-border-radius-topleft: 0;
-webkit-border-top-left-radius: 0;
border-top-left-radius: 0;
-moz-border-radius-topright: 5px !important;
-webkit-border-top-right-radius: 5px !important;
border-top-right-radius: 5px !important;
-moz-border-radius-bottomleft: 0;
-webkit-border-bottom-left-radius: 0;
border-bottom-left-radius: 0;
-moz-border-radius-bottomright: 5px !important;
-webkit-border-bottom-right-radius: 5px !important;
border-bottom-right-radius: 5px !important;
}
/* RTL Superfish ~~~~~~~~~~~~~~~~~~~~~~~~~ */
.rtl .sf-menu a {
border-right:1px solid #<?= $borderColorHighlight ?>;
}
.rtl .sf-sub-indicator {
background: url("themeroller/images/ui-icons_2e83ff_256x240.png") no-repeat -96px -16px; /* 8-bit indexed alpha png. IE6 gets solid image only */
}
/*** shadows for all but IE6 ***/
.rtl .sf-shadow ul {
background: url('../images/superfish-shadow.png') no-repeat bottom left;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
-moz-border-radius-topright: 0;
-moz-border-radius-bottomleft: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-moz-border-radius-topleft: 17px;
-moz-border-radius-bottomright: 17px;
-webkit-border-top-left-radius: 17px;
-webkit-border-bottom-right-radius: 17px;
border-top-left-radius: 17px;
border-bottom-right-radius: 17px;
}

View File

@ -0,0 +1,8 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
name = "<?= $display_name ?>"
description = "<?= $description ?>"
version = 1
author = "<?= $user_name ?>"
site = "<?= !$is_admin ? 1 : 0?>"
admin = "<?= $is_admin ? 1 : 0?>"