diff options
35 files changed, 1730 insertions, 1154 deletions
diff --git a/.build_number b/.build_number index 68a5d742..6d615685 100644 --- a/.build_number +++ b/.build_number @@ -3,4 +3,4 @@ ; process. You don't need to edit it. In fact.. ; ; DO NOT EDIT THIS FILE BY HAND! -build_number=128 +build_number=144 diff --git a/modules/comment/controllers/admin_manage_comments.php b/modules/comment/controllers/admin_manage_comments.php index 9bd1d7f6..72684e70 100644 --- a/modules/comment/controllers/admin_manage_comments.php +++ b/modules/comment/controllers/admin_manage_comments.php @@ -28,8 +28,10 @@ class Admin_Manage_Comments_Controller extends Admin_Controller { ->where("updated", "<", db::expr("UNIX_TIMESTAMP() - 86400 * 7")) ->execute(); - // Redirect to the appropriate queue - url::redirect("admin/manage_comments/queue/unpublished"); + $view = new Admin_View("admin.html"); + $view->content = new View("admin_manage_comments.html"); + $view->content->menu = $this->_menu($this->_counts()); + print $view; } public function menu_labels() { @@ -43,25 +45,32 @@ class Admin_Manage_Comments_Controller extends Admin_Controller { public function queue($state) { $page = max(Input::instance()->get("page"), 1); - $view = new Admin_View("admin.html"); - $view->page_title = t("Manage comments"); - $view->content = new View("admin_manage_comments.html"); - $view->content->counts = $this->_counts(); - $view->content->menu = $this->_menu($view->content->counts); - $view->content->state = $state; - $view->content->comments = ORM::factory("comment") + $view = new Gallery_View("admin_manage_comments_queue.html"); + $view->counts = $this->_counts(); + $view->menu = $this->_menu($view->counts); + $view->state = $state; + $view->comments = ORM::factory("comment") ->order_by("created", "DESC") ->order_by("id", "DESC") ->where("state", "=", $state) ->limit(self::$items_per_page) ->offset(($page - 1) * self::$items_per_page) ->find_all(); - $view->content->pager = new Pagination(); - $view->content->pager->initialize( - array("query_string" => "page", - "total_items" => $view->content->counts->$state, - "items_per_page" => self::$items_per_page, - "style" => "classic")); + + // This view is not themed so we can't use $theme->url() in the view and have to + // reproduce Gallery_View::url() logic here. + $atn = theme::$admin_theme_name; + $view->fallback_avatar_url = url::abs_file("themes/$atn/images/avatar.jpg"); + + $view->page = $page; + $view->page_type = "collection"; + $view->page_subtype = "admin_comments"; + $view->page_size = self::$items_per_page; + $view->children_count = $this->_counts()->$state; + $view->max_pages = ceil($view->children_count / $view->page_size); + + // Also we want to use $theme->paginator() so we need a dummy theme + $view->theme = $view; print $view; } diff --git a/modules/comment/views/admin_manage_comments.html.php b/modules/comment/views/admin_manage_comments.html.php index 34a28986..e3c8546c 100644 --- a/modules/comment/views/admin_manage_comments.html.php +++ b/modules/comment/views/admin_manage_comments.html.php @@ -2,200 +2,45 @@ <script type="text/javascript"> var set_state_url = <?= html::js_string(url::site("admin/manage_comments/set_state/__ID__/__STATE__?csrf=$csrf")) ?>; - function set_state(state, id) { - $.get(set_state_url.replace("__STATE__", state).replace("__ID__", id), + var set_state = function(state, id) { + $("#g-comment-" + id).fadeOut("fast", function() { + $.get(set_state_url.replace("__STATE__", state).replace("__ID__", id), {}, - function() { - $("#g-comment-" + id).slideUp(); - update_menu(); - }); + update_menu); + }); } - var delete_url = - <?= html::js_string(url::site("admin/manage_comments/delete/__ID__?csrf=$csrf")) ?>; - - function del(id) { - $.get(delete_url.replace("__ID__", id), - {}, - function() { - $("#g-comment-" + id).slideUp(); - update_menu(); - }); - } - - function update_menu() { + var update_menu = function() { $.get(<?= html::js_string(url::site("admin/manage_comments/menu_labels")) ?>, {}, function(data) { for (var i = 0; i < data.length; i++) { - $("#g-admin-comments-menu li:eq(" + i + ") a").html(data[i]); + $("#g-admin-comments ul li:eq(" + i + ") a").html(data[i]); } }, "json"); } -</script> - -<div id="g-admin-comments" class="g-block"> - <h1> <?= t("Manage comments") ?> </h1> - <div class="g-block-content"> - <!-- @todo: Highlight active menu option --> - <div id="g-admin-comments-menu" class="ui-helper-clearfix"> - <?= $menu->render() ?> - </div> - - <!-- @todo: Remove after setting active option? --> - <h2> - <? if ($state == "published"): ?> - <?= t("Approved comments") ?> - <? elseif ($state == "unpublished"): ?> - <?= t("Comments awaiting moderation") ?> - <? elseif ($state == "spam"): ?> - <?= t("Spam comments") ?> - <? elseif ($state == "deleted"): ?> - <?= t("Recently deleted comments") ?> - <? endif ?> - </h2> - - <? if ($state == "spam"): ?> - <div> - <? $spam_caught = module::get_var("comment", "spam_caught") ?> - <? if ($spam_caught > 0): ?> - <p> - <?= t2("Gallery has caught %count spam for you since you installed spam filtering.", - "Gallery has caught %count spam for you since you installed spam filtering.", - $spam_caught) ?> - </p> - <? endif ?> - <p> - <? if ($counts->spam): ?> - <?= t2("There is currently one comment in your spam queue. You can delete it with a single click, but there is no undo operation so you may want to check the message first to make sure that it really is spam.", - "There are currently %count comments in your spam queue. You can delete them all with a single click, but there is no undo operation so you may want to check the messages first to make sure that they really are spam. All spam messages will be deleted after 7 days automatically.", - $counts->spam) ?> - </p> - <p> - <a href="<?= url::site("admin/manage_comments/delete_all_spam?csrf=$csrf") ?>"> - <?= t("Delete all spam") ?> - </a> - <? else: ?> - <?= t("Your spam queue is empty!") ?> - <? endif ?> - </p> - </div> - <? endif ?> - - <? if ($state == "deleted"): ?> - <div> - <p> - <?= t("These are messages that have been recently deleted. They will be permanently erased automatically after 7 days.") ?> - </p> - </div> - <? endif ?> - - <table id="g-admin-comments-list"> - <tr> - <th> - <?= t("Author") ?> - </th> - <th> - <?= t("Comment") ?> - </th> - <th> - <?= t("Actions") ?> - </th> - </tr> - <? foreach ($comments as $comment): ?> - <tr id="g-comment-<?= $comment->id ?>" class="<?= text::alternate("g-odd", "g-even") ?>"> - <td> - <a href="#"> - <img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>" - class="g-avatar" - alt="<?= html::clean_attribute($comment->author_name()) ?>" - width="40" - height="40" /> - </a> - <p><a href="mailto:<?= html::clean_attribute($comment->author_email()) ?>" - title="<?= html::clean_attribute($comment->author_email()) ?>"> <?= html::clean($comment->author_name()) ?> </a></p> - </td> - <td> - <div class="g-right"> - <? $item = $comment->item() ?> - <div class="g-item g-photo"> - <a href="<?= $item->url() ?>"> - <? if ($item->has_thumb()): ?> - <img src="<?= $item->thumb_url() ?>" - alt="<?= html::purify($item->title)->for_html_attr() ?>" - <?= photo::img_dimensions($item->thumb_width, $item->thumb_height, 75) ?> - /> - <? else: ?> - <?= t("No thumbnail") ?> - <? endif ?> - </a> - </div> - </div> - <p><?= gallery::date($comment->created) ?></p> - <?= nl2br(html::purify($comment->text)) ?> - </td> - <td> - <ul class="g-buttonset-vertical"> - <? if ($comment->state != "unpublished"): ?> - <li> - <a href="javascript:set_state('unpublished',<?=$comment->id?>)" - class="g-button ui-state-default ui-icon-left"> - <span class="ui-icon ui-icon-check"></span> - <?= t("Unapprove") ?> - </a> - </li> - <? endif ?> - <? if ($comment->state != "published"): ?> - <li> - <a href="javascript:set_state('published',<?=$comment->id?>)" - class="g-button ui-state-default ui-icon-left"> - <span class="ui-icon ui-icon-check"></span> - <?= t("Approve") ?> - </a> - </li> - <? endif ?> - <? if ($comment->state != "spam"): ?> - <li> - <a href="javascript:set_state('spam',<?=$comment->id?>)" - class="g-button ui-state-default ui-icon-left"> - <span class="ui-icon ui-icon-cancel"></span> - <?= t("Spam") ?> - </a> - </li> - <? endif ?> - <!-- - <li> - <a href="javascript:reply(<?=$comment->id?>)" - class="g-button ui-state-default ui-icon-left"> - <span class="ui-icon ui-icon-arrowreturnthick-1-w"></span> - <?= t("Reply") ?> - </a> - </li> - <li> - <a href="javascript:Edit(<?=$comment->id?>)" - class="g-button ui-state-default ui-icon-left"> - <span class="ui-icon ui-icon-pencil"></span> - <?= t("Edit") ?> - </a> - </li> - --> - <li> - <a href="javascript:set_state('deleted',<?=$comment->id?>)" - class="g-button ui-state-default ui-icon-left"> - <span class="ui-icon ui-icon-trash"></span> - <?= t("Delete") ?> - </a> - </li> - </ul> - </td> - </tr> - <? endforeach ?> - </table> + // Paginator clicks load their href in the active tab panel + var fix_links = function() { + $(".g-paginator a, a#g-delete-all-spam").click(function(event) { + event.stopPropagation(); + $.scrollTo(0, 800, { easing: "swing" }); + $(this).parents(".ui-tabs-panel").load( + $(this).attr("href"), + function() { + fix_links(); + }); + return false; + }); + } - <div class="g-paginator"> - <?= $pager ?> - </div> + $(document).ready(function() { + $("#g-admin-comments").tabs({ + show: fix_links, + }); + }); +</script> - </div> +<div id="g-admin-comments" class="g-block"> + <?= $menu->render() ?> </div> diff --git a/modules/comment/views/admin_manage_comments_queue.html.php b/modules/comment/views/admin_manage_comments_queue.html.php new file mode 100644 index 00000000..d847d729 --- /dev/null +++ b/modules/comment/views/admin_manage_comments_queue.html.php @@ -0,0 +1,157 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div class="g-block-content"> + <? if ($state == "spam"): ?> + <div> + <? $spam_caught = module::get_var("comment", "spam_caught") ?> + <? if ($spam_caught > 0): ?> + <p> + <?= t2("Gallery has caught %count spam for you since you installed spam filtering.", + "Gallery has caught %count spam for you since you installed spam filtering.", + $spam_caught) ?> + </p> + <? endif ?> + <p> + <? if ($counts->spam): ?> + <?= t2("There is currently one comment in your spam queue. You can delete it with a single click, but there is no undo operation so you may want to check the message first to make sure that it really is spam.", + "There are currently %count comments in your spam queue. You can delete them all with a single click, but there is no undo operation so you may want to check the messages first to make sure that they really are spam. All spam messages will be deleted after 7 days automatically.", + $counts->spam) ?> + </p> + <p> + <a id="g-delete-all-spam" + href="<?= url::site("admin/manage_comments/delete_all_spam?csrf=$csrf") ?>"> + <?= t("Delete all spam") ?> + </a> + <? else: ?> + <?= t("Your spam queue is empty!") ?> + <? endif ?> + </p> + </div> + <? endif ?> + + <? if ($state == "deleted"): ?> + <div> + <p> + <?= t("These are messages that have been recently deleted. They will be permanently erased automatically after 7 days.") ?> + </p> + </div> + <? endif ?> + + <div class="g-paginator"> + <?= $theme->paginator() ?> + </div> + <table id="g-admin-comments-list"> + <tr> + <th> + <?= t("Author") ?> + </th> + <th> + <?= t("Comment") ?> + </th> + <th> + <?= t("Actions") ?> + </th> + </tr> + <? foreach ($comments as $comment): ?> + <tr id="g-comment-<?= $comment->id ?>" class="<?= text::alternate("g-odd", "g-even") ?>"> + <td> + <a href="#"> + <img src="<?= $comment->author()->avatar_url(40, $fallback_avatar_url) ?>" + class="g-avatar" + alt="<?= html::clean_attribute($comment->author_name()) ?>" + width="40" + height="40" /> + </a> + <p> + <a href="mailto:<?= html::clean_attribute($comment->author_email()) ?>" + title="<?= html::clean_attribute($comment->author_email()) ?>"> + <?= html::clean($comment->author_name()) ?> + </a> + </p> + </td> + <td> + <div class="g-right"> + <? $item = $comment->item() ?> + <div class="g-item g-photo"> + <a href="<?= $item->url() ?>"> + <? if ($item->has_thumb()): ?> + <img src="<?= $item->thumb_url() ?>" + alt="<?= html::purify($item->title)->for_html_attr() ?>" + <?= photo::img_dimensions($item->thumb_width, $item->thumb_height, 75) ?> + /> + <? else: ?> + <?= t("No thumbnail") ?> + <? endif ?> + </a> + </div> + </div> + <p><?= gallery::date($comment->created) ?></p> + <?= nl2br(html::purify($comment->text)) ?> + </td> + <td> + <ul class="g-buttonset-vertical"> + <? if ($comment->state != "unpublished" && $comment->state != "deleted"): ?> + <li> + <a href="javascript:set_state('unpublished',<?=$comment->id?>)" + class="g-button ui-state-default ui-icon-left"> + <span class="ui-icon ui-icon-check"></span> + <?= t("Unapprove") ?> + </a> + </li> + <? endif ?> + <? if ($comment->state != "published"): ?> + <li> + <a href="javascript:set_state('published',<?=$comment->id?>)" + class="g-button ui-state-default ui-icon-left"> + <span class="ui-icon ui-icon-check"></span> + <? if ($state == "deleted"): ?> + <?= t("Undelete") ?> + <? else: ?> + <?= t("Approve") ?> + <? endif ?> + </a> + </li> + <? endif ?> + <? if ($comment->state != "spam"): ?> + <li> + <a href="javascript:set_state('spam',<?=$comment->id?>)" + class="g-button ui-state-default ui-icon-left"> + <span class="ui-icon ui-icon-cancel"></span> + <?= t("Spam") ?> + </a> + </li> + <? endif ?> + <!-- + <li> + <a href="javascript:reply(<?=$comment->id?>)" + class="g-button ui-state-default ui-icon-left"> + <span class="ui-icon ui-icon-arrowreturnthick-1-w"></span> + <?= t("Reply") ?> + </a> + </li> + <li> + <a href="javascript:Edit(<?=$comment->id?>)" + class="g-button ui-state-default ui-icon-left"> + <span class="ui-icon ui-icon-pencil"></span> + <?= t("Edit") ?> + </a> + </li> + --> + <? if ($comment->state != "deleted"): ?> + <li> + <a href="javascript:set_state('deleted',<?=$comment->id?>)" + class="g-button ui-state-default ui-icon-left"> + <span class="ui-icon ui-icon-trash"></span> + <?= t("Delete") ?> + </a> + </li> + <? endif ?> + </ul> + </td> + </tr> + <? endforeach ?> + </table> + + <div class="g-paginator"> + <?= $theme->paginator() ?> + </div> +</div> diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php index cf68d911..5c4995c9 100644 --- a/modules/g2_import/controllers/admin_g2_import.php +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -100,6 +100,11 @@ class Admin_g2_import_Controller extends Admin_Controller { foreach (glob("{$path_prefix}*") as $file) { if (is_dir($file) && !is_link($file)) { $directories[] = $file; + + // If we find an embed.php, include it as well + if (file_exists("$file/embed.php")) { + $directories[] = "$file/embed.php"; + } } } diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 23fb29e5..22a054ac 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -448,49 +448,8 @@ class g2_import_Core { $album = ORM::factory("item"); $album->type = "album"; $album->parent_id = self::map($g2_album->getParentId()); - $album->name = $g2_album->getPathComponent(); - $album->title = self::_decode_html_special_chars($g2_album->getTitle()); - $album->title or $album->title = $album->name; - $album->description = self::_decode_html_special_chars(self::extract_description($g2_album)); - $album->owner_id = self::map($g2_album->getOwnerId()); - try { - $album->view_count = (int) g2(GalleryCoreApi::fetchItemViewCount($g2_album_id)); - } catch (Exception $e) { - // @todo log - $album->view_count = 0; - } - $album->created = $g2_album->getCreationTimestamp(); - - $order_map = array( - "originationTimestamp" => "captured", - "creationTimestamp" => "created", - "description" => "description", - "modificationTimestamp" => "updated", - "orderWeight" => "weight", - "pathComponent" => "name", - "summary" => "description", - "title" => "title", - "viewCount" => "view_count"); - $direction_map = array( - 1 => "ASC", - ORDER_ASCENDING => "ASC", - ORDER_DESCENDING => "DESC"); - // Only consider G2's first sort order - $g2_order = explode("|", $g2_album->getOrderBy() . ""); - $g2_order = $g2_order[0]; - if (empty($g2_order)) { - $g2_order = g2(GalleryCoreApi::getPluginParameter('module', 'core', 'default.orderBy')); - } - $g2_order_direction = explode("|", $g2_album->getOrderDirection() . ""); - $g2_order_direction = $g2_order_direction[0]; - if (empty($g2_order_direction)) { - $g2_order_direction = - g2(GalleryCoreApi::getPluginParameter('module', 'core', 'default.orderDirection')); - } - if (array_key_exists($g2_order, $order_map)) { - $album->sort_column = $order_map[$g2_order]; - $album->sort_order = $direction_map[$g2_order_direction]; - } + + g2_import::set_album_values($album, $g2_album); try { $album->save(); @@ -513,17 +472,66 @@ class g2_import_Core { } /** + * Transfer over all the values from a G2 album to a G3 album. + */ + static function set_album_values($album, $g2_album) { + $album->name = $g2_album->getPathComponent(); + $album->title = self::_decode_html_special_chars($g2_album->getTitle()); + $album->title or $album->title = $album->name; + $album->description = self::_decode_html_special_chars(self::extract_description($g2_album)); + $album->owner_id = self::map($g2_album->getOwnerId()); + try { + $album->view_count = (int) g2(GalleryCoreApi::fetchItemViewCount($g2_album_id)); + } catch (Exception $e) { + // @todo log + $album->view_count = 0; + } + $album->created = $g2_album->getCreationTimestamp(); + + $order_map = array( + "originationTimestamp" => "captured", + "creationTimestamp" => "created", + "description" => "description", + "modificationTimestamp" => "updated", + "orderWeight" => "weight", + "pathComponent" => "name", + "summary" => "description", + "title" => "title", + "viewCount" => "view_count"); + $direction_map = array( + 1 => "ASC", + ORDER_ASCENDING => "ASC", + ORDER_DESCENDING => "DESC"); + // G2 sorts can either be <sort> or <presort>|<sort>. Right now we can't + // map presorts so ignore them. + $g2_order = explode("|", $g2_album->getOrderBy() . ""); + $g2_order = end($g2_order); + if (empty($g2_order)) { + $g2_order = g2(GalleryCoreApi::getPluginParameter('module', 'core', 'default.orderBy')); + } + $g2_order_direction = explode("|", $g2_album->getOrderDirection() . ""); + $g2_order_direction = $g2_order_direction[0]; + if (empty($g2_order_direction)) { + $g2_order_direction = + g2(GalleryCoreApi::getPluginParameter('module', 'core', 'default.orderDirection')); + } + if (array_key_exists($g2_order, $order_map)) { + $album->sort_column = $order_map[$g2_order]; + $album->sort_order = $direction_map[$g2_order_direction]; + } + } + + /** * Set the highlight properly for a single album */ static function set_album_highlight(&$queue) { // Dequeue the current album and enqueue its children list($g2_album_id, $children) = each($queue); - if (empty($children)) { - return; - } unset($queue[$g2_album_id]); - foreach ($children as $key => $value) { - $queue[$key] = $value; + if (!empty($children)) { + foreach ($children as $key => $value) { + $queue[$key] = $value; + } } $messages = array(); diff --git a/modules/g2_import/helpers/g2_import_event.php b/modules/g2_import/helpers/g2_import_event.php index 0e078d08..0afa62d8 100644 --- a/modules/g2_import/helpers/g2_import_event.php +++ b/modules/g2_import/helpers/g2_import_event.php @@ -34,7 +34,7 @@ class g2_import_event_Core { ->get("settings_menu") ->append(Menu::factory("link") ->id("g2_import") - ->label(t("Gallery 2 Import")) + ->label(t("Gallery 2 import")) ->url(url::site("admin/g2_import"))); } } diff --git a/modules/g2_import/helpers/g2_import_task.php b/modules/g2_import/helpers/g2_import_task.php index 5e908676..31615a55 100644 --- a/modules/g2_import/helpers/g2_import_task.php +++ b/modules/g2_import/helpers/g2_import_task.php @@ -127,6 +127,12 @@ class g2_import_task_Core { $g2_root_id = g2(GalleryCoreApi::getDefaultAlbumId()); $tree = g2(GalleryCoreApi::fetchAlbumTree()); $task->set("queue", $queue = array($g2_root_id => $tree)); + + // Update the root album to reflect the Gallery2 root album. + $root_album = item::root(); + g2_import::set_album_values( + $root_album, g2(GalleryCoreApi::loadEntitiesById($g2_root_id))); + $root_album->save(); } $log_message = g2_import::import_album($queue); if ($log_message) { diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php index cf5e4755..9c4eb840 100644 --- a/modules/g2_import/views/admin_g2_import.html.php +++ b/modules/g2_import/views/admin_g2_import.html.php @@ -30,9 +30,13 @@ $("document").ready(function() { .tabs("select", 1) <? endif ?> ; + + // Show the tabs after the page has loaded to prevent Firefox from rendering the + // unstyled page and then flashing. + $("#g-admin-g2-import-tabs").show(); }); </script> - <div id="g-admin-g2-import-tabs" class="g-block-content"> + <div id="g-admin-g2-import-tabs" class="g-block-content" style="display: none"> <ul> <li> <a href="#g-admin-g2-import-configure"><?= t("1. Configure Gallery2 path") ?></a> @@ -112,8 +116,8 @@ $("document").ready(function() { </p> <? endif ?> </div> - <div id="g-admin-g2-import-notes"> - <ul class="enumeration"> + <div id="g-admin-g2-import-notes" class="g-text"> + <ul> <li> <?= t("Gallery 3 does not support per-user / per-item permissions. <b>Review permissions!</b>") ?> </li> diff --git a/modules/gallery/controllers/admin_theme_options.php b/modules/gallery/controllers/admin_theme_options.php index a968a56d..d9323ea0 100644 --- a/modules/gallery/controllers/admin_theme_options.php +++ b/modules/gallery/controllers/admin_theme_options.php @@ -108,7 +108,6 @@ class Admin_Theme_Options_Controller extends Admin_Controller { module::event("theme_edit_form", $form); - $group = $form->group("buttons"); $group->submit("")->value(t("Save")); return $form; } diff --git a/modules/gallery/helpers/random.php b/modules/gallery/helpers/random.php index 6016df7b..06542e8c 100644 --- a/modules/gallery/helpers/random.php +++ b/modules/gallery/helpers/random.php @@ -19,7 +19,7 @@ */ class random_Core { /** - * Return a random 32 bit hash value. + * Return a random 32 byte hash value. * @param string extra entropy data */ static function hash($entropy="") { @@ -27,14 +27,6 @@ class random_Core { } /** - * Return a random hexadecimal string of the given length. - * @param int the desired length of the string - */ - static function string($length) { - return substr(random::hash(), 0, $length); - } - - /** * Return a random floating point number between 0 and 1 */ static function percent() { diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php index 1395686c..e04b9169 100644 --- a/modules/gallery/libraries/Gallery_View.php +++ b/modules/gallery/libraries/Gallery_View.php @@ -31,6 +31,52 @@ class Gallery_View_Core extends View { } /** + * Set up the data and render a pager. + * + * See themes/wind/views/pager.html for documentation on the variables generated here. + */ + public function paginator() { + $v = new View("paginator.html"); + $v->page_type = $this->page_type; + $v->page_subtype = $this->page_subtype; + $v->first_page_url = null; + $v->previous_page_url = null; + $v->next_page_url = null; + $v->last_page_url = null; + + if ($this->page_type == "collection") { + $v->page = $this->page; + $v->max_pages = $this->max_pages; + $v->total = $this->children_count; + + if ($this->page != 1) { + $v->first_page_url = url::site(url::merge(array("page" => 1))); + $v->previous_page_url = url::site(url::merge(array("page" => $this->page - 1))); + } + + if ($this->page != $this->max_pages) { + $v->next_page_url = url::site(url::merge(array("page" => $this->page + 1))); + $v->last_page_url = url::site(url::merge(array("page" => $this->max_pages))); + } + + $v->first_visible_position = ($this->page - 1) * $this->page_size + 1; + $v->last_visible_position = min($this->page * $this->page_size, $v->total); + } else if ($this->page_type == "item") { + $v->position = $this->position; + $v->total = $this->sibling_count; + if ($this->previous_item) { + $v->previous_page_url = $this->previous_item->url(); + } + + if ($this->next_item) { + $v->next_page_url = $this->next_item->url(); + } + } + + return $v; + } + + /** * Begin gather up scripts or css files so that they can be combined into a single request. * * @param $types a comma separated list of types to combine, eg "script,css" diff --git a/modules/gallery/libraries/MY_Pagination.php b/modules/gallery/libraries/MY_Pagination.php deleted file mode 100644 index e697c0bd..00000000 --- a/modules/gallery/libraries/MY_Pagination.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access."); -/** - * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2011 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 Pagination extends Pagination_Core { - public function render($style=NULL) { - // Hide single page pagination - if ($this->auto_hide === TRUE AND $this->total_pages <= 1) { - return ""; - } - - if ($style === NULL) { - // Use default style - $style = $this->style; - } - - // Return rendered pagination view - return View::factory("pager.html", get_object_vars($this))->render(); - } -} diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 152efc37..d6834464 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -139,52 +139,6 @@ class Theme_View_Core extends Gallery_View { } /** - * Set up the data and render a pager. - * - * See themes/wind/views/pager.html for documentation on the variables generated here. - */ - public function paginator() { - $v = new View("paginator.html"); - $v->page_type = $this->page_type; - $v->page_subtype = $this->page_subtype; - $v->first_page_url = null; - $v->previous_page_url = null; - $v->next_page_url = null; - $v->last_page_url = null; - - if ($this->page_type == "collection") { - $v->page = $this->page; - $v->max_pages = $this->max_pages; - $v->total = $this->children_count; - - if ($this->page != 1) { - $v->first_page_url = url::site(url::merge(array("page" => 1))); - $v->previous_page_url = url::site(url::merge(array("page" => $this->page - 1))); - } - - if ($this->page != $this->max_pages) { - $v->next_page_url = url::site(url::merge(array("page" => $this->page + 1))); - $v->last_page_url = url::site(url::merge(array("page" => $this->max_pages))); - } - - $v->first_visible_position = ($this->page - 1) * $this->page_size + 1; - $v->last_visible_position = min($this->page * $this->page_size, $v->total); - } else if ($this->page_type == "item") { - $v->position = $this->position; - $v->total = $this->sibling_count; - if ($this->previous_item) { - $v->previous_page_url = $this->previous_item->url(); - } - - if ($this->next_item) { - $v->next_page_url = $this->next_item->url(); - } - } - - return $v; - } - - /** * Print out any site wide status information. */ public function site_status() { diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index f46db696..2a5e6894 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -336,7 +336,7 @@ class Item_Model_Core extends ORM_MPTT { // Make an url friendly slug from the name, if necessary if (empty($this->slug)) { - $this->slug = item::convert_filename_to_slug($this->name); + $this->slug = item::convert_filename_to_slug(pathinfo($this->name, PATHINFO_FILENAME)); // If the filename is all invalid characters, then the slug may be empty here. Pick a // random value. diff --git a/modules/gallery/tests/Albums_Controller_Test.php b/modules/gallery/tests/Albums_Controller_Test.php index d9983cc2..2ff017d7 100644 --- a/modules/gallery/tests/Albums_Controller_Test.php +++ b/modules/gallery/tests/Albums_Controller_Test.php @@ -31,7 +31,7 @@ class Albums_Controller_Test extends Gallery_Unit_Test_Case { $album = test::random_album(); // Randomize to avoid conflicts. - $new_name = "new_name_" . random::string(6); + $new_name = "new_name_" . test::random_string(6); $_POST["name"] = $new_name; $_POST["title"] = "new title"; diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php index 69c4bbf9..1d1ff5ce 100644 --- a/modules/gallery/tests/File_Structure_Test.php +++ b/modules/gallery/tests/File_Structure_Test.php @@ -101,6 +101,7 @@ class File_Structure_Test extends Gallery_Unit_Test_Case { $expected_4 = array("<?php defined('SYSPATH') or die('No direct script access.');\n"); } else if (strpos($path, MODPATH . "forge") === 0 || strpos($path, MODPATH . "exif/lib") === 0 || + strpos($path, MODPATH . "gallery_unit_test/vendor") === 0 || strpos($path, MODPATH . "gallery/lib/HTMLPurifier") === 0 || $path == MODPATH . "user/lib/PasswordHash.php" || $path == DOCROOT . "var/database.php") { diff --git a/modules/gallery/tests/Gallery_Filters.php b/modules/gallery/tests/Gallery_Filters.php index e0208ed3..b008b593 100644 --- a/modules/gallery/tests/Gallery_Filters.php +++ b/modules/gallery/tests/Gallery_Filters.php @@ -38,6 +38,7 @@ class GalleryCodeFilterIterator extends FilterIterator { strpos($path_name, MODPATH . "forge") !== false || strpos($path_name, MODPATH . "gallery/views/kohana_error_page.php") !== false || strpos($path_name, MODPATH . "gallery/views/kohana_profiler.php") !== false || + strpos($path_name, MODPATH . "gallery_unit_test/vendor") !== false || strpos($path_name, MODPATH . "gallery_unit_test/views/kohana_error_page.php") !== false || strpos($path_name, MODPATH . "gallery_unit_test/views/kohana_unit_test_cli.php") !== false || strpos($path_name, MODPATH . "unit_test") !== false || diff --git a/modules/gallery/tests/controller_auth_data.txt b/modules/gallery/tests/controller_auth_data.txt index f1192071..e35708c0 100644 --- a/modules/gallery/tests/controller_auth_data.txt +++ b/modules/gallery/tests/controller_auth_data.txt @@ -1,6 +1,7 @@ modules/comment/controllers/admin_manage_comments.php queue DIRTY_CSRF modules/comment/helpers/comment_rss.php feed DIRTY_AUTH modules/digibug/controllers/digibug.php print_proxy DIRTY_CSRF|DIRTY_AUTH +modules/g2_import/controllers/admin_g2_import.php autocomplete DIRTY_CSRF modules/g2_import/controllers/g2.php map DIRTY_CSRF modules/gallery/controllers/admin.php __call DIRTY_AUTH modules/gallery/controllers/albums.php index DIRTY_AUTH diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index 0c812fb4..7da79b23 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -42,7 +42,8 @@ modules/digibug/views/digibug_form.html.php 4 DIRTY form:: modules/digibug/views/digibug_form.html.php 6 DIRTY form::hidden($key,$value) modules/exif/views/exif_dialog.html.php 14 DIRTY $details[$i]["caption"] modules/exif/views/exif_dialog.html.php 21 DIRTY $details[$i]["caption"] -modules/g2_import/views/admin_g2_import.html.php 9 DIRTY $form +modules/g2_import/views/admin_g2_import.html.php 7 DIRTY_JS url::site("__ARGS__") +modules/g2_import/views/admin_g2_import.html.php 52 DIRTY $form modules/gallery/views/admin_advanced_settings.html.php 21 DIRTY_ATTR text::alternate("g-odd","g-even") modules/gallery/views/admin_advanced_settings.html.php 22 DIRTY $var->module_name modules/gallery/views/admin_block_log_entries.html.php 4 DIRTY_ATTR log::severity_class($entry->severity) @@ -77,30 +78,35 @@ modules/gallery/views/admin_languages.html.php 62 DIRTY form:: modules/gallery/views/admin_languages.html.php 63 DIRTY $display_name modules/gallery/views/admin_languages.html.php 65 DIRTY form::radio("default_locale",$code,($default_locale==$code),((isset($installed_locales[$code]))?'':'disabled="disabled"')) modules/gallery/views/admin_languages.html.php 113 DIRTY $share_translations_form -modules/gallery/views/admin_maintenance.html.php 40 DIRTY_ATTR text::alternate("g-odd","g-even") -modules/gallery/views/admin_maintenance.html.php 40 DIRTY_ATTR log::severity_class($task->severity) -modules/gallery/views/admin_maintenance.html.php 41 DIRTY_ATTR log::severity_class($task->severity) -modules/gallery/views/admin_maintenance.html.php 42 DIRTY $task->name -modules/gallery/views/admin_maintenance.html.php 45 DIRTY $task->description -modules/gallery/views/admin_maintenance.html.php 86 DIRTY_ATTR text::alternate("g-odd","g-even") -modules/gallery/views/admin_maintenance.html.php 86 DIRTY_ATTR $task->state=="stalled"?"g-warning":"" -modules/gallery/views/admin_maintenance.html.php 87 DIRTY_ATTR $task->state=="stalled"?"g-warning":"" -modules/gallery/views/admin_maintenance.html.php 88 DIRTY gallery::date_time($task->updated) -modules/gallery/views/admin_maintenance.html.php 91 DIRTY $task->name -modules/gallery/views/admin_maintenance.html.php 106 DIRTY $task->status -modules/gallery/views/admin_maintenance.html.php 162 DIRTY_ATTR text::alternate("g-odd","g-even") -modules/gallery/views/admin_maintenance.html.php 162 DIRTY_ATTR $task->state=="success"?"g-success":"g-error" -modules/gallery/views/admin_maintenance.html.php 163 DIRTY_ATTR $task->state=="success"?"g-success":"g-error" -modules/gallery/views/admin_maintenance.html.php 164 DIRTY gallery::date_time($task->updated) -modules/gallery/views/admin_maintenance.html.php 167 DIRTY $task->name -modules/gallery/views/admin_maintenance.html.php 179 DIRTY $task->status +modules/gallery/views/admin_maintenance.html.php 42 DIRTY_ATTR text::alternate("g-odd","g-even") +modules/gallery/views/admin_maintenance.html.php 42 DIRTY_ATTR log::severity_class($task->severity) +modules/gallery/views/admin_maintenance.html.php 43 DIRTY_ATTR log::severity_class($task->severity) +modules/gallery/views/admin_maintenance.html.php 44 DIRTY $task->name +modules/gallery/views/admin_maintenance.html.php 47 DIRTY $task->description +modules/gallery/views/admin_maintenance.html.php 88 DIRTY_ATTR text::alternate("g-odd","g-even") +modules/gallery/views/admin_maintenance.html.php 88 DIRTY_ATTR $task->state=="stalled"?"g-warning":"" +modules/gallery/views/admin_maintenance.html.php 89 DIRTY_ATTR $task->state=="stalled"?"g-warning":"" +modules/gallery/views/admin_maintenance.html.php 90 DIRTY gallery::date_time($task->updated) +modules/gallery/views/admin_maintenance.html.php 93 DIRTY $task->name +modules/gallery/views/admin_maintenance.html.php 108 DIRTY $task->status +modules/gallery/views/admin_maintenance.html.php 164 DIRTY_ATTR text::alternate("g-odd","g-even") +modules/gallery/views/admin_maintenance.html.php 164 DIRTY_ATTR $task->state=="success"?"g-success":"g-error" +modules/gallery/views/admin_maintenance.html.php 165 DIRTY_ATTR $task->state=="success"?"g-success":"g-error" +modules/gallery/views/admin_maintenance.html.php 166 DIRTY gallery::date_time($task->updated) +modules/gallery/views/admin_maintenance.html.php 169 DIRTY $task->name +modules/gallery/views/admin_maintenance.html.php 181 DIRTY $task->status modules/gallery/views/admin_maintenance_show_log.html.php 8 DIRTY_JS url::site("admin/maintenance/save_log/$task->id?csrf=$csrf") modules/gallery/views/admin_maintenance_show_log.html.php 13 DIRTY $task->name modules/gallery/views/admin_maintenance_task.html.php 75 DIRTY $task->name modules/gallery/views/admin_modules.html.php 51 DIRTY access::csrf_form_field() -modules/gallery/views/admin_modules.html.php 60 DIRTY_ATTR text::alternate("g-odd","g-even") -modules/gallery/views/admin_modules.html.php 63 DIRTY form::checkbox($data,'1',module::is_active($module_name)) -modules/gallery/views/admin_modules.html.php 65 DIRTY $module_info->version +modules/gallery/views/admin_modules.html.php 61 DIRTY_ATTR text::alternate("g-odd","g-even") +modules/gallery/views/admin_modules.html.php 64 DIRTY form::checkbox($data,'1',module::is_active($module_name)) +modules/gallery/views/admin_modules.html.php 66 DIRTY $module_info->version +modules/gallery/views/admin_modules.html.php 74 DIRTY_JS $module_info->author_url +modules/gallery/views/admin_modules.html.php 81 DIRTY_ATTR $module_info->author_name +modules/gallery/views/admin_modules.html.php 85 DIRTY $module_info->author_name +modules/gallery/views/admin_modules.html.php 93 DIRTY_JS $module_info->info_url +modules/gallery/views/admin_modules.html.php 106 DIRTY_JS $module_info->discuss_url modules/gallery/views/admin_modules_confirm.html.php 11 DIRTY_ATTR $css_class modules/gallery/views/admin_modules_confirm.html.php 11 DIRTY $message modules/gallery/views/admin_modules_confirm.html.php 16 DIRTY access::csrf_form_field() @@ -114,12 +120,17 @@ modules/gallery/views/admin_themes.html.php 3 DIRTY_JS url::s modules/gallery/views/admin_themes.html.php 5 DIRTY_JS $csrf modules/gallery/views/admin_themes.html.php 22 DIRTY $themes[$site]->name modules/gallery/views/admin_themes.html.php 24 DIRTY $themes[$site]->description -modules/gallery/views/admin_themes.html.php 38 DIRTY $info->name -modules/gallery/views/admin_themes.html.php 40 DIRTY $info->description -modules/gallery/views/admin_themes.html.php 60 DIRTY $themes[$admin]->name -modules/gallery/views/admin_themes.html.php 62 DIRTY $themes[$admin]->description -modules/gallery/views/admin_themes.html.php 76 DIRTY $info->name -modules/gallery/views/admin_themes.html.php 78 DIRTY $info->description +modules/gallery/views/admin_themes.html.php 39 DIRTY $info->name +modules/gallery/views/admin_themes.html.php 41 DIRTY $info->description +modules/gallery/views/admin_themes.html.php 62 DIRTY $themes[$admin]->name +modules/gallery/views/admin_themes.html.php 64 DIRTY $themes[$admin]->description +modules/gallery/views/admin_themes.html.php 79 DIRTY $info->name +modules/gallery/views/admin_themes.html.php 81 DIRTY $info->description +modules/gallery/views/admin_themes_buttonset.html.php 7 DIRTY_JS $info['author_url'] +modules/gallery/views/admin_themes_buttonset.html.php 14 DIRTY_ATTR $info['author_name'] +modules/gallery/views/admin_themes_buttonset.html.php 18 DIRTY $info['author_name'] +modules/gallery/views/admin_themes_buttonset.html.php 26 DIRTY_JS $info['info_url'] +modules/gallery/views/admin_themes_buttonset.html.php 39 DIRTY_JS $info['discuss_url'] modules/gallery/views/admin_themes_preview.html.php 8 DIRTY_ATTR $url modules/gallery/views/error_404.html.php 14 DIRTY $login_form modules/gallery/views/error_admin.html.php 178 DIRTY @gallery_block::get("platform_info") @@ -174,7 +185,8 @@ modules/gallery/views/form_uploadify.html.php 28 DIRTY_JS url::f modules/gallery/views/form_uploadify.html.php 29 DIRTY_JS url::site("uploader/add_photo/{$album->id}") modules/gallery/views/form_uploadify.html.php 33 DIRTY_JS url::file("lib/uploadify/cancel.png") modules/gallery/views/form_uploadify.html.php 34 DIRTY_JS $simultaneous_upload_limit -modules/gallery/views/form_uploadify.html.php 160 DIRTY_ATTR request::protocol() +modules/gallery/views/form_uploadify.html.php 35 DIRTY_JS $size_limit_bytes +modules/gallery/views/form_uploadify.html.php 162 DIRTY_ATTR request::protocol() modules/gallery/views/in_place_edit.html.php 2 DIRTY form::open($action,array("method"=>"post","id"=>"g-in-place-edit-form","class"=>"g-short-form")) modules/gallery/views/in_place_edit.html.php 3 DIRTY access::csrf_form_field() modules/gallery/views/in_place_edit.html.php 6 DIRTY form::input("input",$form["input"]," class=\"textbox\"") @@ -248,7 +260,7 @@ modules/gallery/views/permissions_form.html.php 80 DIRTY_JS $permi modules/gallery/views/permissions_form.html.php 80 DIRTY_JS $item->id modules/gallery/views/quick_delete_confirm.html.php 11 DIRTY $form modules/gallery/views/reauthenticate.html.php 9 DIRTY $form -modules/gallery/views/upgrade_checker_block.html.php 17 DIRTY $new_version +modules/gallery/views/upgrade_checker_block.html.php 19 DIRTY $new_version modules/gallery/views/upgrader.html.php 76 DIRTY_ATTR $done?"muted":"" modules/gallery/views/upgrader.html.php 94 DIRTY_ATTR $done?"muted":"" modules/gallery/views/upgrader.html.php 102 DIRTY_ATTR $module->version==$module->code_version?"current":"upgradeable" @@ -330,8 +342,9 @@ modules/search/views/search.html.php 27 DIRTY_ATTR $ite modules/search/views/search.html.php 28 DIRTY_JS $item->url() modules/search/views/search.html.php 29 DIRTY $item->thumb_img() modules/search/views/search.html.php 40 DIRTY $theme->paginator() -modules/server_add/views/admin_server_add.html.php 5 DIRTY $form -modules/server_add/views/admin_server_add.html.php 15 DIRTY_ATTR $id +modules/server_add/views/admin_server_add.html.php 8 DIRTY_JS url::site("__ARGS__") +modules/server_add/views/admin_server_add.html.php 19 DIRTY $form +modules/server_add/views/admin_server_add.html.php 30 DIRTY_ATTR $id modules/server_add/views/server_add_tree.html.php 20 DIRTY_ATTR is_dir($file)?"ui-icon-folder-collapsed":"ui-icon-document" modules/server_add/views/server_add_tree.html.php 21 DIRTY_ATTR is_dir($file)?"g-directory":"g-file" modules/server_add/views/server_add_tree_dialog.html.php 3 DIRTY_JS url::site("server_add/children?path=__PATH__") @@ -365,21 +378,21 @@ modules/watermark/views/admin_watermarks.html.php 20 DIRTY_ATTR $wid modules/watermark/views/admin_watermarks.html.php 20 DIRTY_ATTR $height modules/watermark/views/admin_watermarks.html.php 20 DIRTY_ATTR $url themes/admin_wind/views/admin.html.php 4 DIRTY $theme->html_attributes() -themes/admin_wind/views/admin.html.php 31 DIRTY $theme->admin_head() -themes/admin_wind/views/admin.html.php 40 DIRTY_JS $theme->url() -themes/admin_wind/views/admin.html.php 45 DIRTY $theme->get_combined("script") -themes/admin_wind/views/admin.html.php 48 DIRTY $theme->get_combined("css") -themes/admin_wind/views/admin.html.php 52 DIRTY $theme->admin_page_top() -themes/admin_wind/views/admin.html.php 60 DIRTY $theme->admin_header_top() -themes/admin_wind/views/admin.html.php 61 DIRTY_JS item::root()->url() -themes/admin_wind/views/admin.html.php 64 DIRTY $theme->user_menu() -themes/admin_wind/views/admin.html.php 67 DIRTY $theme->admin_menu() -themes/admin_wind/views/admin.html.php 70 DIRTY $theme->admin_header_bottom() -themes/admin_wind/views/admin.html.php 77 DIRTY $content -themes/admin_wind/views/admin.html.php 83 DIRTY $sidebar -themes/admin_wind/views/admin.html.php 88 DIRTY $theme->admin_footer() -themes/admin_wind/views/admin.html.php 91 DIRTY $theme->admin_credits() -themes/admin_wind/views/admin.html.php 96 DIRTY $theme->admin_page_bottom() +themes/admin_wind/views/admin.html.php 33 DIRTY $theme->admin_head() +themes/admin_wind/views/admin.html.php 42 DIRTY_JS $theme->url() +themes/admin_wind/views/admin.html.php 47 DIRTY $theme->get_combined("css") +themes/admin_wind/views/admin.html.php 50 DIRTY $theme->get_combined("script") +themes/admin_wind/views/admin.html.php 54 DIRTY $theme->admin_page_top() +themes/admin_wind/views/admin.html.php 62 DIRTY $theme->admin_header_top() +themes/admin_wind/views/admin.html.php 63 DIRTY_JS item::root()->url() +themes/admin_wind/views/admin.html.php 66 DIRTY $theme->user_menu() +themes/admin_wind/views/admin.html.php 69 DIRTY $theme->admin_menu() +themes/admin_wind/views/admin.html.php 72 DIRTY $theme->admin_header_bottom() +themes/admin_wind/views/admin.html.php 79 DIRTY $content +themes/admin_wind/views/admin.html.php 85 DIRTY $sidebar +themes/admin_wind/views/admin.html.php 90 DIRTY $theme->admin_footer() +themes/admin_wind/views/admin.html.php 93 DIRTY $theme->admin_credits() +themes/admin_wind/views/admin.html.php 98 DIRTY $theme->admin_page_bottom() themes/admin_wind/views/block.html.php 3 DIRTY_ATTR $anchor themes/admin_wind/views/block.html.php 5 DIRTY $id themes/admin_wind/views/block.html.php 5 DIRTY_ATTR $css_id @@ -414,19 +427,19 @@ themes/wind/views/page.html.php 4 DIRTY $theme themes/wind/views/page.html.php 10 DIRTY $page_title themes/wind/views/page.html.php 13 DIRTY $theme->item()->title themes/wind/views/page.html.php 17 DIRTY item::root()->title -themes/wind/views/page.html.php 31 DIRTY $new_width -themes/wind/views/page.html.php 32 DIRTY $new_height -themes/wind/views/page.html.php 33 DIRTY $thumb_proportion -themes/wind/views/page.html.php 70 DIRTY_JS $theme->url() -themes/wind/views/page.html.php 75 DIRTY $theme->get_combined("script") -themes/wind/views/page.html.php 78 DIRTY $theme->get_combined("css") -themes/wind/views/page.html.php 88 DIRTY $header_text -themes/wind/views/page.html.php 90 DIRTY_JS item::root()->url() -themes/wind/views/page.html.php 94 DIRTY $theme->user_menu() -themes/wind/views/page.html.php 115 DIRTY_JS $parent->url($parent->id==$theme->item()->parent_id?"show={$theme->item()->id}":null) -themes/wind/views/page.html.php 136 DIRTY $content -themes/wind/views/page.html.php 142 DIRTY newView("sidebar.html") -themes/wind/views/page.html.php 149 DIRTY $footer_text +themes/wind/views/page.html.php 32 DIRTY $new_width +themes/wind/views/page.html.php 33 DIRTY $new_height +themes/wind/views/page.html.php 34 DIRTY $thumb_proportion +themes/wind/views/page.html.php 71 DIRTY_JS $theme->url() +themes/wind/views/page.html.php 76 DIRTY $theme->get_combined("css") +themes/wind/views/page.html.php 79 DIRTY $theme->get_combined("script") +themes/wind/views/page.html.php 89 DIRTY $header_text +themes/wind/views/page.html.php 91 DIRTY_JS item::root()->url() +themes/wind/views/page.html.php 95 DIRTY $theme->user_menu() +themes/wind/views/page.html.php 116 DIRTY_JS $parent->url($parent->id==$theme->item()->parent_id?"show={$theme->item()->id}":null) +themes/wind/views/page.html.php 137 DIRTY $content +themes/wind/views/page.html.php 143 DIRTY newView("sidebar.html") +themes/wind/views/page.html.php 150 DIRTY $footer_text themes/wind/views/paginator.html.php 33 DIRTY_JS $first_page_url themes/wind/views/paginator.html.php 42 DIRTY_JS $previous_page_url themes/wind/views/paginator.html.php 70 DIRTY_JS $next_page_url diff --git a/modules/gallery/views/admin_block_welcome.html.php b/modules/gallery/views/admin_block_welcome.html.php index d8c96187..d3765d19 100644 --- a/modules/gallery/views/admin_block_welcome.html.php +++ b/modules/gallery/views/admin_block_welcome.html.php @@ -2,7 +2,7 @@ <p> <?= t("This is your administration dashboard and it provides a quick overview of status messages, recent updates, and frequently used options. Add or remove blocks and rearrange them to tailor to your needs. The admin menu provides quick access to all of Gallery 3's options and settings. Here are a few of the most used options to get you started.") ?> </p> -<ul> +<ul class="g-text"> <li> <?= t("General Settings - choose your <a href=\"%graphics_url\">graphics</a> and <a href=\"%language_url\">language</a> settings.", array("graphics_url" => html::mark_clean(url::site("admin/graphics")), diff --git a/modules/gallery/views/admin_themes_buttonset.html.php b/modules/gallery/views/admin_themes_buttonset.html.php index 5166f36c..bf474a26 100644 --- a/modules/gallery/views/admin_themes_buttonset.html.php +++ b/modules/gallery/views/admin_themes_buttonset.html.php @@ -1,47 +1,48 @@ - <ul class="g-buttonset"> - <li> - <a target="_blank" - <? if (isset($info['author_url'])): ?> - class="ui-state-default ui-icon ui-icon-person ui-corner-left" - href="<?= $info['author_url'] ?>" - <? else: ?> - class="ui-state-disabled ui-icon ui-icon-person ui-corner-left" - href="#" - <? endif ?> +<?php defined("SYSPATH") or die("No direct script access.") ?> +<ul class="g-buttonset"> + <li> + <a target="_blank" + <? if (isset($info['author_url'])): ?> + class="ui-state-default ui-icon ui-icon-person ui-corner-left" + href="<?= $info['author_url'] ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-person ui-corner-left" + href="#" + <? endif ?> - <? if (isset($info['author_name'])): ?> - title="<?= $info['author_name'] ?>" - <? endif ?> - > - <? if (isset($info['author_name'])): ?> - <?= $info['author_name'] ?> - <? endif ?> - </a> - </li> - <li> - <a target="_blank" - <? if (isset($info['info_url'])): ?> - class="ui-state-default ui-icon ui-icon-info" - href="<?= $info['info_url'] ?>" - <? else: ?> - class="ui-state-disabled ui-icon ui-icon-info" - href="#" - <? endif ?> - > - <?= t("info") ?> - </a> - </li> - <li> - <a target="_blank" - <? if (isset($info['discuss_url'])): ?> - class="ui-state-default ui-icon ui-icon-comment ui-corner-right" - href="<?= $info['discuss_url'] ?>" - <? else: ?> - class="ui-state-disabled ui-icon ui-icon-comment ui-corner-right" - href="#" - <? endif ?> - > - <?= t("discuss") ?> - </a> - </li> - </ul> + <? if (isset($info['author_name'])): ?> + title="<?= $info['author_name'] ?>" + <? endif ?> + > + <? if (isset($info['author_name'])): ?> + <?= $info['author_name'] ?> + <? endif ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($info['info_url'])): ?> + class="ui-state-default ui-icon ui-icon-info" + href="<?= $info['info_url'] ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-info" + href="#" + <? endif ?> + > + <?= t("info") ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($info['discuss_url'])): ?> + class="ui-state-default ui-icon ui-icon-comment ui-corner-right" + href="<?= $info['discuss_url'] ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-comment ui-corner-right" + href="#" + <? endif ?> + > + <?= t("discuss") ?> + </a> + </li> +</ul> diff --git a/modules/gallery_unit_test/helpers/test.php b/modules/gallery_unit_test/helpers/test.php index b6b0055a..633f023e 100644 --- a/modules/gallery_unit_test/helpers/test.php +++ b/modules/gallery_unit_test/helpers/test.php @@ -19,7 +19,7 @@ */ class test_Core { static function random_album_unsaved($parent=null) { - $rand = random::string(6); + $rand = test::random_string(6); $album = ORM::factory("item"); $album->type = "album"; @@ -34,7 +34,7 @@ class test_Core { } static function random_photo_unsaved($parent=null) { - $rand = random::string(6); + $rand = test::random_string(6); $photo = ORM::factory("item"); $photo->type = "photo"; $photo->parent_id = $parent ? $parent->id : 1; @@ -49,16 +49,16 @@ class test_Core { } static function random_user($password="password") { - $rand = "name_" . random::string(6); + $rand = "name_" . test::random_string(6); return identity::create_user($rand, $rand, $password, "$rand@rand.com"); } static function random_group() { - return identity::create_group(random::string(6)); + return identity::create_group(test::random_string(6)); } static function random_name($item=null) { - $rand = "name_" . random::string(6); + $rand = "name_" . test::random_string(6); if ($item && $item->is_photo()) { $rand .= ".jpg"; } @@ -77,7 +77,7 @@ class test_Core { static function random_tag() { $tag = ORM::factory("tag"); - $tag->name = random::string(6); + $tag->name = test::lorem_ipsum(rand(2, 4)); // Reload so that ORM coerces all fields into strings. return $tag->save()->reload(); @@ -88,4 +88,22 @@ class test_Core { fwrite(fopen($b_name = tempnam("/tmp", "test"), "w"), $b); return `diff $a_name $b_name`; } + + static function random_string($length) { + $buf = ""; + do { + $buf .= random::hash(); + } while (strlen($buf) < $length); + return substr($buf, 0, $length); + } + + static function lorem_ipsum($num) { + static $lorem_ipsum = null; + if (!$lorem_ipsum) { + require_once(MODPATH . "gallery_unit_test/vendor/LoremIpsum.class.php"); + $lorem_ipsum = new LoremIpsumGenerator(); + } + // skip past initial 'lorem ipsum' + return substr($lorem_ipsum->getContent($num + 2, "txt"), 13); + } } diff --git a/modules/gallery_unit_test/vendor/LoremIpsum.class.php b/modules/gallery_unit_test/vendor/LoremIpsum.class.php new file mode 100644 index 00000000..07050fe5 --- /dev/null +++ b/modules/gallery_unit_test/vendor/LoremIpsum.class.php @@ -0,0 +1,461 @@ +<?php defined("SYSPATH") or die("No direct script access."); +class LoremIpsumGenerator { + /** + * Copyright (c) 2009, Mathew Tinsley (tinsley@tinsology.net) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the organization nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MATHEW TINSLEY ''AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + private $words, $wordsPerParagraph, $wordsPerSentence; + + function __construct($wordsPer = 100) + { + $this->wordsPerParagraph = $wordsPer; + $this->wordsPerSentence = 24.460; + $this->words = array( + 'lorem', + 'ipsum', + 'dolor', + 'sit', + 'amet', + 'consectetur', + 'adipiscing', + 'elit', + 'curabitur', + 'vel', + 'hendrerit', + 'libero', + 'eleifend', + 'blandit', + 'nunc', + 'ornare', + 'odio', + 'ut', + 'orci', + 'gravida', + 'imperdiet', + 'nullam', + 'purus', + 'lacinia', + 'a', + 'pretium', + 'quis', + 'congue', + 'praesent', + 'sagittis', + 'laoreet', + 'auctor', + 'mauris', + 'non', + 'velit', + 'eros', + 'dictum', + 'proin', + 'accumsan', + 'sapien', + 'nec', + 'massa', + 'volutpat', + 'venenatis', + 'sed', + 'eu', + 'molestie', + 'lacus', + 'quisque', + 'porttitor', + 'ligula', + 'dui', + 'mollis', + 'tempus', + 'at', + 'magna', + 'vestibulum', + 'turpis', + 'ac', + 'diam', + 'tincidunt', + 'id', + 'condimentum', + 'enim', + 'sodales', + 'in', + 'hac', + 'habitasse', + 'platea', + 'dictumst', + 'aenean', + 'neque', + 'fusce', + 'augue', + 'leo', + 'eget', + 'semper', + 'mattis', + 'tortor', + 'scelerisque', + 'nulla', + 'interdum', + 'tellus', + 'malesuada', + 'rhoncus', + 'porta', + 'sem', + 'aliquet', + 'et', + 'nam', + 'suspendisse', + 'potenti', + 'vivamus', + 'luctus', + 'fringilla', + 'erat', + 'donec', + 'justo', + 'vehicula', + 'ultricies', + 'varius', + 'ante', + 'primis', + 'faucibus', + 'ultrices', + 'posuere', + 'cubilia', + 'curae', + 'etiam', + 'cursus', + 'aliquam', + 'quam', + 'dapibus', + 'nisl', + 'feugiat', + 'egestas', + 'class', + 'aptent', + 'taciti', + 'sociosqu', + 'ad', + 'litora', + 'torquent', + 'per', + 'conubia', + 'nostra', + 'inceptos', + 'himenaeos', + 'phasellus', + 'nibh', + 'pulvinar', + 'vitae', + 'urna', + 'iaculis', + 'lobortis', + 'nisi', + 'viverra', + 'arcu', + 'morbi', + 'pellentesque', + 'metus', + 'commodo', + 'ut', + 'facilisis', + 'felis', + 'tristique', + 'ullamcorper', + 'placerat', + 'aenean', + 'convallis', + 'sollicitudin', + 'integer', + 'rutrum', + 'duis', + 'est', + 'etiam', + 'bibendum', + 'donec', + 'pharetra', + 'vulputate', + 'maecenas', + 'mi', + 'fermentum', + 'consequat', + 'suscipit', + 'aliquam', + 'habitant', + 'senectus', + 'netus', + 'fames', + 'quisque', + 'euismod', + 'curabitur', + 'lectus', + 'elementum', + 'tempor', + 'risus', + 'cras' ); + } + + function getContent($count, $format = 'html', $loremipsum = true) + { + $format = strtolower($format); + + if($count <= 0) + return ''; + + switch($format) + { + case 'txt': + return $this->getText($count, $loremipsum); + case 'plain': + return $this->getPlain($count, $loremipsum); + default: + return $this->getHTML($count, $loremipsum); + } + } + + private function getWords(&$arr, $count, $loremipsum) + { + $i = 0; + if($loremipsum) + { + $i = 2; + $arr[0] = 'lorem'; + $arr[1] = 'ipsum'; + } + + for($i; $i < $count; $i++) + { + $index = array_rand($this->words); + $word = $this->words[$index]; + //echo $index . '=>' . $word . '<br />'; + + if($i > 0 && $arr[$i - 1] == $word) + $i--; + else + $arr[$i] = $word; + } + } + + private function getPlain($count, $loremipsum, $returnStr = true) + { + $words = array(); + $this->getWords($words, $count, $loremipsum); + //print_r($words); + + $delta = $count; + $curr = 0; + $sentences = array(); + while($delta > 0) + { + $senSize = $this->gaussianSentence(); + //echo $curr . '<br />'; + if(($delta - $senSize) < 4) + $senSize = $delta; + + $delta -= $senSize; + + $sentence = array(); + for($i = $curr; $i < ($curr + $senSize); $i++) + $sentence[] = $words[$i]; + + $this->punctuate($sentence); + $curr = $curr + $senSize; + $sentences[] = $sentence; + } + + if($returnStr) + { + $output = ''; + foreach($sentences as $s) + foreach($s as $w) + $output .= $w . ' '; + + return $output; + } + else + return $sentences; + } + + private function getText($count, $loremipsum) + { + $sentences = $this->getPlain($count, $loremipsum, false); + $paragraphs = $this->getParagraphArr($sentences); + + $paragraphStr = array(); + foreach($paragraphs as $p) + { + $paragraphStr[] = $this->paragraphToString($p); + } + + $paragraphStr[0] = "\t" . $paragraphStr[0]; + return implode("\n\n\t", $paragraphStr); + } + + private function getParagraphArr($sentences) + { + $wordsPer = $this->wordsPerParagraph; + $sentenceAvg = $this->wordsPerSentence; + $total = count($sentences); + + $paragraphs = array(); + $pCount = 0; + $currCount = 0; + $curr = array(); + + for($i = 0; $i < $total; $i++) + { + $s = $sentences[$i]; + $currCount += count($s); + $curr[] = $s; + if($currCount >= ($wordsPer - round($sentenceAvg / 2.00)) || $i == $total - 1) + { + $currCount = 0; + $paragraphs[] = $curr; + $curr = array(); + //print_r($paragraphs); + } + //print_r($paragraphs); + } + + return $paragraphs; + } + + private function getHTML($count, $loremipsum) + { + $sentences = $this->getPlain($count, $loremipsum, false); + $paragraphs = $this->getParagraphArr($sentences); + //print_r($paragraphs); + + $paragraphStr = array(); + foreach($paragraphs as $p) + { + $paragraphStr[] = "<p>\n" . $this->paragraphToString($p, true) . '</p>'; + } + + //add new lines for the sake of clean code + return implode("\n", $paragraphStr); + } + + private function paragraphToString($paragraph, $htmlCleanCode = false) + { + $paragraphStr = ''; + foreach($paragraph as $sentence) + { + foreach($sentence as $word) + $paragraphStr .= $word . ' '; + + if($htmlCleanCode) + $paragraphStr .= "\n"; + } + return $paragraphStr; + } + + /* + * Inserts commas and periods in the given + * word array. + */ + private function punctuate(& $sentence) + { + $count = count($sentence); + $sentence[$count - 1] = $sentence[$count - 1] . '.'; + + if($count < 4) + return $sentence; + + $commas = $this->numberOfCommas($count); + + for($i = 1; $i <= $commas; $i++) + { + $index = (int) round($i * $count / ($commas + 1)); + + if($index < ($count - 1) && $index > 0) + { + $sentence[$index] = $sentence[$index] . ','; + } + } + } + + /* + * Determines the number of commas for a + * sentence of the given length. Average and + * standard deviation are determined superficially + */ + private function numberOfCommas($len) + { + $avg = (float) log($len, 6); + $stdDev = (float) $avg / 6.000; + + return (int) round($this->gauss_ms($avg, $stdDev)); + } + + /* + * Returns a number on a gaussian distribution + * based on the average word length of an english + * sentence. + * Statistics Source: + * http://hearle.nahoo.net/Academic/Maths/Sentence.html + * Average: 24.46 + * Standard Deviation: 5.08 + */ + private function gaussianSentence() + { + $avg = (float) 24.460; + $stdDev = (float) 5.080; + + return (int) round($this->gauss_ms($avg, $stdDev)); + } + + /* + * The following three functions are used to + * compute numbers with a guassian distrobution + * Source: + * http://us.php.net/manual/en/function.rand.php#53784 + */ + private function gauss() + { // N(0,1) + // returns random number with normal distribution: + // mean=0 + // std dev=1 + + // auxilary vars + $x=$this->random_0_1(); + $y=$this->random_0_1(); + + // two independent variables with normal distribution N(0,1) + $u=sqrt(-2*log($x))*cos(2*pi()*$y); + $v=sqrt(-2*log($x))*sin(2*pi()*$y); + + // i will return only one, couse only one needed + return $u; + } + + private function gauss_ms($m=0.0,$s=1.0) + { + return $this->gauss()*$s+$m; + } + + private function random_0_1() + { + return (float)rand()/(float)getrandmax(); + } + +}
\ No newline at end of file diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php index 13e253ba..bb79e707 100644 --- a/modules/tag/models/tag.php +++ b/modules/tag/models/tag.php @@ -75,8 +75,12 @@ class Tag_Model_Core extends ORM { ->where("id", "!=", $this->id) ->find(); if ($duplicate_tag->loaded()) { - // If so, tag its items with this tag so as to merge it. - foreach ($duplicate_tag->items() as $item) { + // If so, tag its items with this tag so as to merge it + $duplicate_tag_items = ORM::factory("item") + ->join("items_tags", "items.id", "items_tags.item_id") + ->where("items_tags.tag_id", "=", $duplicate_tag->id) + ->find_all(); + foreach ($duplicate_tag_items as $item) { $this->add($item); } @@ -84,7 +88,6 @@ class Tag_Model_Core extends ORM { $duplicate_tag->delete(); } - // Figure out what items have changed in this tag for our item_related_update event below if (isset($this->object_relations["items"])) { $added = array_diff($this->changed_relations["items"], $this->object_relations["items"]); $removed = array_diff($this->object_relations["items"], $this->changed_relations["items"]); diff --git a/modules/user/controllers/admin_users.php b/modules/user/controllers/admin_users.php index a3633b52..41be6c03 100644 --- a/modules/user/controllers/admin_users.php +++ b/modules/user/controllers/admin_users.php @@ -21,6 +21,8 @@ class Admin_Users_Controller extends Admin_Controller { public function index() { $view = new Admin_View("admin.html"); $view->page_title = t("Users and groups"); + $view->page_type = "collection"; + $view->page_subtype = "admin_users"; $view->content = new View("admin_users.html"); // @todo: add this as a config option @@ -29,6 +31,12 @@ class Admin_Users_Controller extends Admin_Controller { $builder = db::build(); $user_count = $builder->from("users")->count_records(); + // Pagination info + $view->page = $page; + $view->page_size = $page_size; + $view->children_count = $user_count; + $view->max_pages = ceil($view->children_count / $view->page_size); + $view->content->pager = new Pagination(); $view->content->pager->initialize( array("query_string" => "page", diff --git a/modules/user/views/admin_users.html.php b/modules/user/views/admin_users.html.php index a7bd6b27..033c9dae 100644 --- a/modules/user/views/admin_users.html.php +++ b/modules/user/views/admin_users.html.php @@ -110,7 +110,7 @@ </table> <div class="g-paginator"> - <?= $pager ?> + <?= $theme->paginator() ?> </div> </div> diff --git a/themes/admin_wind/css/screen-rtl.css b/themes/admin_wind/css/screen-rtl.css new file mode 100644 index 00000000..5cc1b4aa --- /dev/null +++ b/themes/admin_wind/css/screen-rtl.css @@ -0,0 +1,317 @@ +/** + * Gallery 3 Admin Wind Theme Right-to-Left Screen Styles + */ + +.rtl { + direction: rtl; +} + +.rtl #g-header, +.rtl #g-content, +.rtl #g-sidebar, +.rtl #g-footer, +.rtl caption, +.rtl th, +.rtl #g-dialog, +.rtl .g-context-menu li a, +.rtl .g-message-box li, +.rtl #g-site-status li { + text-align: right; +} + +.rtl .g-text-right { + text-align: left; +} + +/* Lists ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +.g-text li, +.g-text li { + margin-right: 1em; +} + +/* Messages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +.rtl .g-error, +.rtl .g-info, +.rtl .g-success, +.rtl .g-warning, +.rtl #g-add-photos-status .g-success, +.rtl #g-add-photos-status .g-error { + background-position: center right; + padding-right: 30px !important; +} + +.rtl form li.g-error, +.rtl form li.g-info, +.rtl form li.g-success, +.rtl form li.g-warning { + padding-right: 0 !important; +} + +.rtl .g-left, +.rtl .g-inline li, +.rtl #g-content #g-album-grid .g-item, +.rtl .sf-menu li, +.rtl .g-breadcrumbs li, +.rtl .g-paginator li, +.rtl .g-buttonset li, +.rtl .ui-icon-left .ui-icon, +.rtl .g-short-form li, +.rtl form ul ul li, +.rtl input[type="submit"], +.rtl input[type="reset"], +.rtl input.checkbox, +.rtl input[type=checkbox], +.rtl input.radio, +.rtl input[type=radio] { + float: right; +} + +.rtl .g-right, +.rtl .ui-icon-right .ui-icon { + float: left; +} + +.rtl .g-inline li { + margin-right: 1em; +} + +.rtl .g-inline li.g-first { + margin-right: 0; +} + +.rtl .g-breadcrumbs li { + background: transparent url('../images/ico-separator-rtl.gif') no-repeat scroll right center; + padding: 1em 18px 1em 8px; +} + +.rtl .g-breadcrumbs .g-first { + background: none; + padding-right: 0; +} + +.rtl input.checkbox { + margin-left: .4em; +} + +.rtl #g-add-comment { + right: inherit; + left: 0; +} + +.rtl .ui-icon-left .ui-icon { + margin-left: .2em; +} + +.rtl .ui-icon-right .ui-icon { + margin-right: .2em; +} + +/* 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-left: none; + border-right:1px solid #fff; +} + +.rtl .sf-menu a.sf-with-ul { + padding-left: 2.25em; + padding-right: 1em; +} + +.rtl .sf-sub-indicator { + left: .75em !important; + right: auto; + background: url('../../../lib/superfish/images/arrows-ffffff-rtl.png') no-repeat -10px -100px; +} + +.rtl a > .sf-sub-indicator { + top: .8em; + background-position: -10px -100px; +} + +.rtl a:focus > .sf-sub-indicator, +.rtl a:hover > .sf-sub-indicator, +.rtl a:active > .sf-sub-indicator, +.rtl li:hover > a > .sf-sub-indicator, +.rtl li.sfHover > a > .sf-sub-indicator { + background-position: 0 -100px; +} + +.rtl .sf-menu ul .sf-sub-indicator { + background-position: 0 0; +} + +.rtl .sf-menu ul a > .sf-sub-indicator { + background-position: -10px 0; +} + +.rtl .sf-menu ul a:focus > .sf-sub-indicator, +.rtl .sf-menu ul a:hover > .sf-sub-indicator, +.rtl .sf-menu ul a:active > .sf-sub-indicator, +.rtl .sf-menu ul li:hover > a > .sf-sub-indicator, +.rtl .sf-menu ul li.sfHover > a > .sf-sub-indicator { + background-position: 0 0; +} + +.rtl .sf-menu li:hover ul, +.rtl .sf-menu li.sfHover ul { + right: 0; + left: auto; +} + +.rtl ul.sf-menu li li:hover ul, +.rtl ul.sf-menu li li.sfHover ul { + right: 12em; + left: auto; +} +.rtl ul.sf-menu li li li:hover ul, +.rtl ul.sf-menu li li li.sfHover ul { + right: 12em; + left: auto; +} + +.rtl .sf-shadow ul { + background: url('../../../lib/superfish/images/shadow.png') no-repeat bottom left; + padding: 0 0 9px 8px; + 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; +} + +/* RTL ThemeRoller ~~~~~~~~~~~~~~~~~~~~~~~~ */ + +.rtl .ui-dialog .ui-dialog-titlebar { + padding: 0.5em 1em 0.3em 0.3em; +} + +.rtl .ui-dialog .ui-dialog-title { + float: right; +} + +.rtl .ui-dialog .ui-dialog-titlebar-close { + left: 0.3em; + right: auto; +} + +.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-sidebar .g-block-content { + padding-left: 0em; + padding-right: 1em; +} + +.rtl .g-selected img, +.rtl .g-available .g-block img { + margin: 0 0 1em 1em; +} diff --git a/themes/admin_wind/css/screen.css b/themes/admin_wind/css/screen.css index 177eb1e6..58942387 100644 --- a/themes/admin_wind/css/screen.css +++ b/themes/admin_wind/css/screen.css @@ -12,7 +12,6 @@ * 6) Positioning and order * 7) Navigation and menus * 8) jQuery and jQuery UI - * 9) Right-to-left language styles * * @todo Review g-buttonset-vertical */ @@ -92,23 +91,20 @@ a:hover, /* Lists ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -#g-content ul li { +ul.g-text li, +.g-text ul li { list-style-type: disc; - margin-left: 1em; } -form ul li, -#g-action-status li, -#g-log-entries li, -.g-buttonset li, -.g-buttonset-vertical li, -.g-paginator li, -.ui-sortable li, -.ui-widget-header li { - list-style: none !important; - margin-left: 0 !important; +ol.g-text li, +.g-text ol li { + list-style-type: decimal; } +.g-text li, +.g-text li { + margin-left: 1em; +} /* Forms ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ @@ -899,7 +895,7 @@ button { .g-progress-bar { height: 1em; width: 100%; - margin-top: .5em; + margin: .5em 0; display: inline-block; } @@ -1060,312 +1056,3 @@ ul.sf-menu li li li.sfHover ul { #g-admin-dashboard-sidebar .ui-dialog-titlebar { padding: .2em .4em; } - -/** ******************************************************************* - * 9) Right to left styles - *********************************************************************/ - -.rtl { - direction: rtl; -} - -.rtl #g-header, -.rtl #g-content, -.rtl #g-sidebar, -.rtl #g-footer, -.rtl caption, -.rtl th, -.rtl #g-dialog, -.rtl .g-context-menu li a, -.rtl .g-message-box li, -.rtl #g-site-status li { - text-align: right; -} - -.rtl .g-text-right { - text-align: left; -} - -.rtl .g-error, -.rtl .g-info, -.rtl .g-success, -.rtl .g-warning, -.rtl #g-add-photos-status .g-success, -.rtl #g-add-photos-status .g-error { - background-position: center right; - padding-right: 30px !important; -} - -.rtl form li.g-error, -.rtl form li.g-info, -.rtl form li.g-success, -.rtl form li.g-warning { - padding-right: 0 !important; -} - -.rtl .g-left, -.rtl .g-inline li, -.rtl #g-content #g-album-grid .g-item, -.rtl .sf-menu li, -.rtl .g-breadcrumbs li, -.rtl .g-paginator li, -.rtl .g-buttonset li, -.rtl .ui-icon-left .ui-icon, -.rtl .g-short-form li, -.rtl form ul ul li, -.rtl input[type="submit"], -.rtl input[type="reset"], -.rtl input.checkbox, -.rtl input[type=checkbox], -.rtl input.radio, -.rtl input[type=radio] { - float: right; -} - -.rtl .g-right, -.rtl .ui-icon-right .ui-icon { - float: left; -} - -.rtl .g-inline li { - margin-right: 1em; -} - -.rtl .g-inline li.g-first { - margin-right: 0; -} - -.rtl .g-breadcrumbs li { - background: transparent url('../images/ico-separator-rtl.gif') no-repeat scroll right center; - padding: 1em 18px 1em 8px; -} - -.rtl .g-breadcrumbs .g-first { - background: none; - padding-right: 0; -} - -.rtl input.checkbox { - margin-left: .4em; -} - -.rtl #g-add-comment { - right: inherit; - left: 0; -} - -.rtl .ui-icon-left .ui-icon { - margin-left: .2em; -} - -.rtl .ui-icon-right .ui-icon { - margin-right: .2em; -} - -/* 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-left: none; - border-right:1px solid #fff; -} - -.rtl .sf-menu a.sf-with-ul { - padding-left: 2.25em; - padding-right: 1em; -} - -.rtl .sf-sub-indicator { - left: .75em !important; - right: auto; - background: url('../../../lib/superfish/images/arrows-ffffff-rtl.png') no-repeat -10px -100px; -} - -.rtl a > .sf-sub-indicator { - top: .8em; - background-position: -10px -100px; -} - -.rtl a:focus > .sf-sub-indicator, -.rtl a:hover > .sf-sub-indicator, -.rtl a:active > .sf-sub-indicator, -.rtl li:hover > a > .sf-sub-indicator, -.rtl li.sfHover > a > .sf-sub-indicator { - background-position: 0 -100px; -} - -.rtl .sf-menu ul .sf-sub-indicator { - background-position: 0 0; -} - -.rtl .sf-menu ul a > .sf-sub-indicator { - background-position: -10px 0; -} - -.rtl .sf-menu ul a:focus > .sf-sub-indicator, -.rtl .sf-menu ul a:hover > .sf-sub-indicator, -.rtl .sf-menu ul a:active > .sf-sub-indicator, -.rtl .sf-menu ul li:hover > a > .sf-sub-indicator, -.rtl .sf-menu ul li.sfHover > a > .sf-sub-indicator { - background-position: 0 0; -} - -.rtl .sf-menu li:hover ul, -.rtl .sf-menu li.sfHover ul { - right: 0; - left: auto; -} - -.rtl ul.sf-menu li li:hover ul, -.rtl ul.sf-menu li li.sfHover ul { - right: 12em; - left: auto; -} -.rtl ul.sf-menu li li li:hover ul, -.rtl ul.sf-menu li li li.sfHover ul { - right: 12em; - left: auto; -} - -.rtl .sf-shadow ul { - background: url('../../../lib/superfish/images/shadow.png') no-repeat bottom left; - padding: 0 0 9px 8px; - 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; -} - -/* RTL ThemeRoller ~~~~~~~~~~~~~~~~~~~~~~~~ */ - -.rtl .ui-dialog .ui-dialog-titlebar { - padding: 0.5em 1em 0.3em 0.3em; -} - -.rtl .ui-dialog .ui-dialog-title { - float: right; -} - -.rtl .ui-dialog .ui-dialog-titlebar-close { - left: 0.3em; - right: auto; -} - -.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-sidebar .g-block-content { - padding-left: 0em; - padding-right: 1em; -} - -.rtl .g-selected img, -.rtl .g-available .g-block img { - margin: 0 0 1em 1em; -} diff --git a/themes/admin_wind/views/admin.html.php b/themes/admin_wind/views/admin.html.php index 65473e57..9a149149 100644 --- a/themes/admin_wind/views/admin.html.php +++ b/themes/admin_wind/views/admin.html.php @@ -29,6 +29,7 @@ <?= $theme->script("gallery.ajax.js") ?> <?= $theme->script("gallery.dialog.js") ?> <?= $theme->script("superfish/js/superfish.js") ?> + <?= $theme->script("jquery.scrollTo.js") ?> <?= $theme->admin_head() ?> @@ -38,6 +39,9 @@ <?= $theme->css("themeroller/ui.base.css") ?> <?= $theme->css("superfish/css/superfish.css") ?> <?= $theme->css("screen.css") ?> + <? if (locales::is_rtl()): ?> + <?= $theme->css("screen-rtl.css") ?> + <? endif; ?> <!--[if lt IE 8]> <link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>" media="screen,print,projection" /> diff --git a/themes/admin_wind/views/pager.html.php b/themes/admin_wind/views/pager.html.php deleted file mode 100644 index 5fff5845..00000000 --- a/themes/admin_wind/views/pager.html.php +++ /dev/null @@ -1,44 +0,0 @@ -<?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> diff --git a/themes/admin_wind/views/paginator.html.php b/themes/admin_wind/views/paginator.html.php new file mode 100644 index 00000000..b46d9741 --- /dev/null +++ b/themes/admin_wind/views/paginator.html.php @@ -0,0 +1,88 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<? +// This is a generic paginator for admin collections. 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 +// +?> + +<? if ($total): ?> +<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("Viewing %from_number of %count", + "Viewing %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 ?> + <? 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> +<? endif ?>
\ No newline at end of file diff --git a/themes/wind/css/screen-rtl.css b/themes/wind/css/screen-rtl.css new file mode 100644 index 00000000..a4b4d48c --- /dev/null +++ b/themes/wind/css/screen-rtl.css @@ -0,0 +1,333 @@ +/** + * Gallery 3 Wind Theme Right-to-Left Screen Styles + */ + +.rtl { + direction: rtl; +} + +.rtl #g-header, +.rtl #g-content, +.rtl #g-sidebar, +.rtl #g-footer, +.rtl caption, +.rtl th, +.rtl #g-dialog, +.rtl .g-context-menu li a, +.rtl .g-message-box li, +.rtl #g-site-status li { + text-align: right; +} + +.rtl .g-text-right { + text-align: left; +} + +/* Lists ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +.g-text li, +.g-text li { + margin-right: 1em; +} + +/* Messages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +.rtl .g-error, +.rtl .g-info, +.rtl .g-success, +.rtl .g-warning, +.rtl #g-add-photos-status .g-success, +.rtl #g-add-photos-status .g-error { + background-position: center right; + padding-right: 30px !important; +} + +.rtl form li.g-error, +.rtl form li.g-info, +.rtl form li.g-success, +.rtl form li.g-warning { + padding-right: 0 !important; +} + +.rtl .g-left, +.rtl .g-inline li, +.rtl #g-content #g-album-grid .g-item, +.rtl .sf-menu li, +.rtl .g-breadcrumbs li, +.rtl .g-paginator li, +.rtl .g-buttonset li, +.rtl .ui-icon-left .ui-icon, +.rtl .g-short-form li, +.rtl form ul ul li, +.rtl input[type="submit"], +.rtl input[type="reset"], +.rtl input.checkbox, +.rtl input[type=checkbox], +.rtl input.radio, +.rtl input[type=radio] { + float: right; +} + +.rtl .g-right, +.rtl .ui-icon-right .ui-icon { + float: left; +} + +.rtl .g-inline li { + margin-right: 1em; +} + +.rtl .g-inline li.g-first { + margin-right: 0; +} + +.rtl .g-breadcrumbs li { + background: transparent url('../images/ico-separator-rtl.gif') no-repeat scroll right center; + padding: 1em 18px 1em 8px; +} + +.rtl .g-breadcrumbs .g-first { + background: none; + padding-right: 0; +} + +.rtl input.checkbox { + margin-left: .4em; +} + +.rtl #g-add-comment { + right: inherit; + left: 0; +} + +.rtl .ui-icon-left .ui-icon { + margin-left: .2em; +} + +.rtl .ui-icon-right .ui-icon { + margin-right: .2em; +} + +/* 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-left: none; + border-right:1px solid #fff; +} + +.rtl .sf-menu a.sf-with-ul { + padding-left: 2.25em; + padding-right: 1em; +} + +.rtl .sf-sub-indicator { + left: .75em !important; + right: auto; + background: url('../../../lib/superfish/images/arrows-ffffff-rtl.png') no-repeat -10px -100px; +} + +.rtl a > .sf-sub-indicator { + top: .8em; + background-position: -10px -100px; +} + +.rtl a:focus > .sf-sub-indicator, +.rtl a:hover > .sf-sub-indicator, +.rtl a:active > .sf-sub-indicator, +.rtl li:hover > a > .sf-sub-indicator, +.rtl li.sfHover > a > .sf-sub-indicator { + background-position: 0 -100px; +} + +.rtl .sf-menu ul .sf-sub-indicator { + background-position: 0 0; +} + +.rtl .sf-menu ul a > .sf-sub-indicator { + background-position: -10px 0; +} + +.rtl .sf-menu ul a:focus > .sf-sub-indicator, +.rtl .sf-menu ul a:hover > .sf-sub-indicator, +.rtl .sf-menu ul a:active > .sf-sub-indicator, +.rtl .sf-menu ul li:hover > a > .sf-sub-indicator, +.rtl .sf-menu ul li.sfHover > a > .sf-sub-indicator { + background-position: 0 0; +} + +.rtl .sf-menu li:hover ul, +.rtl .sf-menu li.sfHover ul { + right: 0; + left: auto; +} + +.rtl ul.sf-menu li li:hover ul, +.rtl ul.sf-menu li li.sfHover ul { + right: 12em; + left: auto; +} +.rtl ul.sf-menu li li li:hover ul, +.rtl ul.sf-menu li li li.sfHover ul { + right: 12em; + left: auto; +} + +.rtl .sf-shadow ul { + background: url('../../../lib/superfish/images/shadow.png') no-repeat bottom left; + padding: 0 0 9px 8px; + 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; +} + +/* RTL ThemeRoller ~~~~~~~~~~~~~~~~~~~~~~~~ */ + +.rtl .ui-dialog .ui-dialog-titlebar { + padding: 0.5em 1em 0.3em 0.3em; +} + +.rtl .ui-dialog .ui-dialog-title { + float: right; +} + +.rtl .ui-dialog .ui-dialog-titlebar-close { + left: 0.3em; + right: auto; +} + + +/* RTL paginator ~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +.rtl .g-paginator .g-info { + width: 35%; +} + +.rtl .g-paginator .g-text-right { + margin-left: 0; +} + +.rtl .g-paginator .ui-icon-seek-end { + background-position: -80px -160px; +} + +.rtl .g-paginator .ui-icon-seek-next { + background-position: -48px -160px; +} + +.rtl .g-paginator .ui-icon-seek-prev { + background-position: -32px -160px; +} + +.rtl .g-paginator .ui-icon-seek-first { + background-position: -64px -160px; +} + +.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; +} diff --git a/themes/wind/css/screen.css b/themes/wind/css/screen.css index b470ab1c..d3e0f83c 100644 --- a/themes/wind/css/screen.css +++ b/themes/wind/css/screen.css @@ -12,7 +12,6 @@ * 6) Positioning and order * 7) Navigation and menus * 8) jQuery and jQuery UI - * 9) Right-to-left language styles */ /** ******************************************************************* @@ -111,6 +110,23 @@ a:hover, padding-left: 32px; } +/* Lists ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +ul.g-text li, +.g-text ul li { + list-style-type: disc; +} + +ol.g-text li, +.g-text ol li { + list-style-type: decimal; +} + +.g-text li, +.g-text li { + margin-left: 1em; +} + /* Forms ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ form { @@ -928,7 +944,7 @@ button { .g-progress-bar { height: 1em; width: 100%; - margin-top: .5em; + margin: .5em 0; display: inline-block; } @@ -1047,328 +1063,3 @@ div#g-action-status { .ac_loading { background: white url('../images/loading-small.gif') right center no-repeat !important; } - -/** ******************************************************************* - * 9) Right to left language styles - *********************************************************************/ - -.rtl { - direction: rtl; -} - -.rtl #g-header, -.rtl #g-content, -.rtl #g-sidebar, -.rtl #g-footer, -.rtl caption, -.rtl th, -.rtl #g-dialog, -.rtl .g-context-menu li a, -.rtl .g-message-box li, -.rtl #g-site-status li { - text-align: right; -} - -.rtl .g-text-right { - text-align: left; -} - -.rtl .g-error, -.rtl .g-info, -.rtl .g-success, -.rtl .g-warning, -.rtl #g-add-photos-status .g-success, -.rtl #g-add-photos-status .g-error { - background-position: center right; - padding-right: 30px !important; -} - -.rtl form li.g-error, -.rtl form li.g-info, -.rtl form li.g-success, -.rtl form li.g-warning { - padding-right: 0 !important; -} - -.rtl .g-left, -.rtl .g-inline li, -.rtl #g-content #g-album-grid .g-item, -.rtl .sf-menu li, -.rtl .g-breadcrumbs li, -.rtl .g-paginator li, -.rtl .g-buttonset li, -.rtl .ui-icon-left .ui-icon, -.rtl .g-short-form li, -.rtl form ul ul li, -.rtl input[type="submit"], -.rtl input[type="reset"], -.rtl input.checkbox, -.rtl input[type=checkbox], -.rtl input.radio, -.rtl input[type=radio] { - float: right; -} - -.rtl .g-right, -.rtl .ui-icon-right .ui-icon { - float: left; -} - -.rtl .g-inline li { - margin-right: 1em; -} - -.rtl .g-inline li.g-first { - margin-right: 0; -} - -.rtl .g-breadcrumbs li { - background: transparent url('../images/ico-separator-rtl.gif') no-repeat scroll right center; - padding: 1em 18px 1em 8px; -} - -.rtl .g-breadcrumbs .g-first { - background: none; - padding-right: 0; -} - -.rtl input.checkbox { - margin-left: .4em; -} - -.rtl #g-add-comment { - right: inherit; - left: 0; -} - -.rtl .ui-icon-left .ui-icon { - margin-left: .2em; -} - -.rtl .ui-icon-right .ui-icon { - margin-right: .2em; -} - -/* 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-left: none; - border-right:1px solid #fff; -} - -.rtl .sf-menu a.sf-with-ul { - padding-left: 2.25em; - padding-right: 1em; -} - -.rtl .sf-sub-indicator { - left: .75em !important; - right: auto; - background: url('../../../lib/superfish/images/arrows-ffffff-rtl.png') no-repeat -10px -100px; -} - -.rtl a > .sf-sub-indicator { - top: .8em; - background-position: -10px -100px; -} - -.rtl a:focus > .sf-sub-indicator, -.rtl a:hover > .sf-sub-indicator, -.rtl a:active > .sf-sub-indicator, -.rtl li:hover > a > .sf-sub-indicator, -.rtl li.sfHover > a > .sf-sub-indicator { - background-position: 0 -100px; -} - -.rtl .sf-menu ul .sf-sub-indicator { - background-position: 0 0; -} - -.rtl .sf-menu ul a > .sf-sub-indicator { - background-position: -10px 0; -} - -.rtl .sf-menu ul a:focus > .sf-sub-indicator, -.rtl .sf-menu ul a:hover > .sf-sub-indicator, -.rtl .sf-menu ul a:active > .sf-sub-indicator, -.rtl .sf-menu ul li:hover > a > .sf-sub-indicator, -.rtl .sf-menu ul li.sfHover > a > .sf-sub-indicator { - background-position: 0 0; -} - -.rtl .sf-menu li:hover ul, -.rtl .sf-menu li.sfHover ul { - right: 0; - left: auto; -} - -.rtl ul.sf-menu li li:hover ul, -.rtl ul.sf-menu li li.sfHover ul { - right: 12em; - left: auto; -} -.rtl ul.sf-menu li li li:hover ul, -.rtl ul.sf-menu li li li.sfHover ul { - right: 12em; - left: auto; -} - -.rtl .sf-shadow ul { - background: url('../../../lib/superfish/images/shadow.png') no-repeat bottom left; - padding: 0 0 9px 8px; - 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; -} - -/* RTL ThemeRoller ~~~~~~~~~~~~~~~~~~~~~~~~ */ - -.rtl .ui-dialog .ui-dialog-titlebar { - padding: 0.5em 1em 0.3em 0.3em; -} - -.rtl .ui-dialog .ui-dialog-title { - float: right; -} - -.rtl .ui-dialog .ui-dialog-titlebar-close { - left: 0.3em; - right: auto; -} - - -/* RTL paginator ~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - -.rtl .g-paginator .g-info { - width: 35%; -} - -.rtl .g-paginator .g-text-right { - margin-left: 0; -} - -.rtl .g-paginator .ui-icon-seek-end { - background-position: -80px -160px; -} - -.rtl .g-paginator .ui-icon-seek-next { - background-position: -48px -160px; -} - -.rtl .g-paginator .ui-icon-seek-prev { - background-position: -32px -160px; -} - -.rtl .g-paginator .ui-icon-seek-first { - background-position: -64px -160px; -} - -.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; -} diff --git a/themes/wind/views/page.html.php b/themes/wind/views/page.html.php index 1c67ff9d..045e3c45 100644 --- a/themes/wind/views/page.html.php +++ b/themes/wind/views/page.html.php @@ -67,6 +67,9 @@ <?= $theme->css("superfish/css/superfish.css") ?> <?= $theme->css("themeroller/ui.base.css") ?> <?= $theme->css("screen.css") ?> + <? if (locales::is_rtl()): ?> + <?= $theme->css("screen-rtl.css") ?> + <? endif; ?> <!--[if lte IE 8]> <link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>" media="screen,print,projection" /> |