summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-11-06 22:14:32 -0800
committerTim Almdal <tnalmdal@shaw.ca>2009-11-06 22:14:32 -0800
commitc40735c922b53eb32be1ae39a030362eea52e602 (patch)
treecfe908300e98eed1e22d5ba46e2629ed40565b9a
parent44ae88e8e17713cab81a5cf08820e18896615196 (diff)
parent3e0a81a39490f58840e3144b88d9c963e69f8f79 (diff)
Merge branch 'master' into talmdal_dev
-rw-r--r--modules/gallery/css/gallery.css46
-rw-r--r--modules/gallery/helpers/gallery_event.php28
-rw-r--r--modules/gallery/helpers/gallery_theme.php8
-rw-r--r--modules/gallery/libraries/Menu.php17
-rw-r--r--modules/gallery/libraries/Theme_View.php8
-rw-r--r--modules/gallery/views/admin_maintenance_show_log.html.php2
-rw-r--r--modules/gallery/views/login.html.php26
-rw-r--r--modules/gallery/views/login_current_user.html.php11
-rw-r--r--modules/gallery/views/menu.html.php3
-rw-r--r--modules/tag/helpers/tag_theme.php1
-rw-r--r--modules/tag/js/tag.js13
-rw-r--r--modules/tag/views/tag_block.html.php17
-rw-r--r--modules/user/controllers/admin_users.php1
-rw-r--r--themes/admin_wind/css/screen.css39
-rw-r--r--themes/night_wind/views/page.html.php11
-rw-r--r--themes/wind/views/page.html.php1
16 files changed, 136 insertions, 96 deletions
diff --git a/modules/gallery/css/gallery.css b/modules/gallery/css/gallery.css
index 724c50d3..18d9a522 100644
--- a/modules/gallery/css/gallery.css
+++ b/modules/gallery/css/gallery.css
@@ -1,3 +1,15 @@
+/**
+ * Gallery 3 core module styles
+ *
+ * Sheet organization:
+ * 1) End-user
+ * 2) Admin
+ */
+
+/** *******************************************************************
+ * 1) End-user
+ **********************************************************************/
+
/* Permissions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#g-edit-permissions-form {
@@ -103,3 +115,37 @@
background-color: #cfc;
border: 1px solid #beb;
}
+
+/** *******************************************************************
+ * 2) Admin
+ **********************************************************************/
+
+.g-task-log {
+ border: 1px solid #000;
+ height: 400px;
+ margin: .6em 0;
+ overflow: auto;
+ padding: .4em
+}
+
+#g-languages-form table {
+ width: 40%;
+ margin: 0 3em 1em 0;
+}
+
+#g-languages-form input {
+ clear: both;
+}
+
+#g-translations ol {
+ margin: 0 0 1em 2em;
+}
+#g-translations ol li {
+ list-style-type: decimal;
+ line-height: 150%;
+}
+
+#g-translations .g-button {
+ padding: .5em;
+ margin-bottom: 1em;
+}
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index e3cb6a9b..43920815 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -97,6 +97,34 @@ class gallery_event_Core {
$data[] = $item->title;
}
+ static function user_menu($menu, $theme) {
+ if ($theme->page_type != "login") {
+ Kohana::log("alert", "in gallery::user_menu");
+ $user = identity::active_user();
+ if ($user->guest) {
+ $menu->append(Menu::factory("dialog")
+ ->id("user_menu_login")
+ ->css_id("g-login-link")
+ ->url(url::site("login/ajax"))
+ ->label(t("Login")));
+ } else {
+ $csrf = access::csrf_token();
+ $menu->append(Menu::factory("dialog")
+ ->id("user_menu_edit_profile")
+ ->css_id("g-user-profile-link")
+ ->view("login_current_user.html")
+ ->url(url::site("form/edit/users/{$user->id}"))
+ ->label($user->display_name()));
+ $menu->append(Menu::factory("link")
+ ->id("user_menu_logout")
+ ->css_id("g-logout-link")
+ ->url(url::site("logout?csrf=$csrf&amp;continue=" .
+ urlencode(url::current(true))))
+ ->label(t("Logout")));
+ }
+ }
+ }
+
static function site_menu($menu, $theme) {
if ($theme->page_type != "login") {
$menu->append(Menu::factory("link")
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index 0682d4ae..ab3e7eb5 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -52,14 +52,6 @@ class gallery_theme_Core {
return $buf;
}
- static function header_top($theme) {
- if ($theme->page_type != "login") {
- $view = new View("login.html");
- $view->user = identity::active_user();
- return $view->render();
- }
- }
-
static function admin_head($theme) {
$theme->css("gallery.css");
$theme->script("gallery.panel.js");
diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php
index 20405317..e2b68d1a 100644
--- a/modules/gallery/libraries/Menu.php
+++ b/modules/gallery/libraries/Menu.php
@@ -79,6 +79,15 @@ class Menu_Element {
return $this;
}
+ /**
+ * Specifiy a view for this menu item
+ * @chainable
+ */
+ public function view($view) {
+ $this->view = $view;
+ return $this;
+ }
+
}
/**
@@ -86,7 +95,7 @@ class Menu_Element {
*/
class Menu_Element_Link extends Menu_Element {
public function render() {
- $view = new View("menu_link.html");
+ $view = new View(isset($this->view) ? $this->view : "menu_link.html");
$view->menu = $this;
return $view;
}
@@ -108,7 +117,7 @@ class Menu_Element_Ajax_Link extends Menu_Element {
}
public function render() {
- $view = new View("menu_ajax_link.html");
+ $view = new View(isset($this->view) ? $this->view : "menu_ajax_link.html");
$view->menu = $this;
return $view;
}
@@ -119,7 +128,7 @@ class Menu_Element_Ajax_Link extends Menu_Element {
*/
class Menu_Element_Dialog extends Menu_Element {
public function render() {
- $view = new View("menu_dialog.html");
+ $view = new View(isset($this->view) ? $this->view : "menu_dialog.html");
$view->menu = $this;
return $view;
}
@@ -208,7 +217,7 @@ class Menu_Core extends Menu_Element {
}
public function render() {
- $view = new View("menu.html");
+ $view = new View(isset($this->view) ? $this->view : "menu.html");
$view->menu = $this;
return $view;
}
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php
index 9670313d..f8fae0f7 100644
--- a/modules/gallery/libraries/Theme_View.php
+++ b/modules/gallery/libraries/Theme_View.php
@@ -78,6 +78,14 @@ class Theme_View_Core extends Gallery_View {
return $this->page_type;
}
+ public function user_menu() {
+ $menu = Menu::factory("root")
+ ->css_id("g-login-menu")
+ ->css_class("g-inline ui-helper-clear-fix");
+ module::event("user_menu", $menu, $this);
+ return $menu->render();
+ }
+
public function site_menu() {
$menu = Menu::factory("root");
module::event("site_menu", $menu, $this);
diff --git a/modules/gallery/views/admin_maintenance_show_log.html.php b/modules/gallery/views/admin_maintenance_show_log.html.php
index e6ed97b3..ff7ac50e 100644
--- a/modules/gallery/views/admin_maintenance_show_log.html.php
+++ b/modules/gallery/views/admin_maintenance_show_log.html.php
@@ -11,7 +11,7 @@ appendTo('body').submit().remove();
</script>
<div id="g-task-log-dialog">
<h1> <?= $task->name ?> </h1>
- <div class="g-task-log">
+ <div class="g-task-log g-txt-small">
<pre><?= html::purify($task->get_log()) ?></pre>
</div>
<button id="g-close" class="ui-state-default ui-corner-all" onclick="dismiss()"><?= t("Close") ?></button>
diff --git a/modules/gallery/views/login.html.php b/modules/gallery/views/login.html.php
deleted file mode 100644
index 4c13ef4b..00000000
--- a/modules/gallery/views/login.html.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.") ?>
-<ul id="g-login-menu" class="g-inline ui-helper-clearfix">
- <? if ($user->guest): ?>
- <li class="g-first">
- <a href="<?= url::site("login/ajax") ?>"
- title="<?= t("Login to Gallery")->for_html_attr() ?>"
- id="g-login-link" class="g-dialog-link"><?= t("Login") ?></a>
- </li>
- <? else: ?>
- <li class="g-first">
- <? if (identity::is_writable()): ?>
- <?= t('Logged in as %name', array('name' => html::mark_clean(
- '<a href="' . url::site("form/edit/users/{$user->id}") .
- '" title="' . t("Edit your profile")->for_html_attr() .
- '" id="g-user-profile-link" class="g-dialog-link">' .
- html::clean($user->display_name()) . '</a>'))) ?>
- <? else: ?>
- <?= t('Logged in as %name', array('name' => html::clean($user->display_name()))) ?>
- <? endif ?>
- </li>
- <li>
- <a href="<?= url::site("logout?csrf=$csrf&amp;continue=" . urlencode(url::current(true))) ?>"
- id="g-logout-link"><?= t("Logout") ?></a>
- </li>
- <? endif ?>
-</ul>
diff --git a/modules/gallery/views/login_current_user.html.php b/modules/gallery/views/login_current_user.html.php
new file mode 100644
index 00000000..e3b3688f
--- /dev/null
+++ b/modules/gallery/views/login_current_user.html.php
@@ -0,0 +1,11 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<li>
+ <? $name = $menu->label->for_html() ?>
+ <? if (identity::is_writable()): ?>
+ <?= t("Logged in as %name", array("name" => html::mark_clean(
+ "<a href='$menu->url' title='" . t("Edit your profile")->for_html_attr() .
+ "' id='$menu->id' class='g-dialog-link'>{$name}</a>"))) ?>
+ <? else: ?>
+ <?= t("Logged in as %name", array("name" => $name)) ?>
+ <? endif ?>
+</li>
diff --git a/modules/gallery/views/menu.html.php b/modules/gallery/views/menu.html.php
index b4b38c93..cb49bcdf 100644
--- a/modules/gallery/views/menu.html.php
+++ b/modules/gallery/views/menu.html.php
@@ -1,8 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? if ($menu->elements): // Don't show the menu if it has no choices ?>
<? if ($menu->is_root): ?>
-
-<ul class="<?= $menu->css_class ?>">
+<ul <?= isset($menu->css_id) ? "id='$menu->css_id'" : "" ?> class="<?= $menu->css_class ?>">
<? foreach ($menu->elements as $element): ?>
<?= $element->render() ?>
<? endforeach ?>
diff --git a/modules/tag/helpers/tag_theme.php b/modules/tag/helpers/tag_theme.php
index 76c0ea6b..e966821a 100644
--- a/modules/tag/helpers/tag_theme.php
+++ b/modules/tag/helpers/tag_theme.php
@@ -21,7 +21,6 @@ class tag_theme_Core {
static function head($theme) {
$theme->css("jquery.autocomplete.css");
$theme->script("jquery.autocomplete.js");
- $theme->script("tag.js");
$theme->css("tag.css");
}
diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js
deleted file mode 100644
index 4760084d..00000000
--- a/modules/tag/js/tag.js
+++ /dev/null
@@ -1,13 +0,0 @@
-function ajaxify_tag_form() {
- $("#g-tag form").ajaxForm({
- dataType: "json",
- success: function(data) {
- if (data.result == "success") {
- $.get($("#g-tag-cloud").attr("title"), function(data, textStatus) {
- $("#g-tag-cloud").html(data);
- });
- }
- $("#g-tag form").resetForm();
- }
- });
-}
diff --git a/modules/tag/views/tag_block.html.php b/modules/tag/views/tag_block.html.php
index ad36b297..00b57360 100644
--- a/modules/tag/views/tag_block.html.php
+++ b/modules/tag/views/tag_block.html.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<script language="text/javascript">
+<script type="text/javascript">
$("#g-add-tag-form").ready(function() {
- var url = $("#g-tag-cloud").attr("title") + "/autocomplete";
+ var url = $("#g-tag-cloud").attr("ref") + "/autocomplete";
$("#g-add-tag-form input:text").autocomplete(
url, {
max: 30,
@@ -10,9 +10,20 @@
cacheLength: 1
}
);
+ $("#g-add-tag-form").ajaxForm({
+ dataType: "json",
+ success: function(data) {
+ if (data.result == "success") {
+ $.get($("#g-tag-cloud").attr("ref"), function(data, textStatus) {
+ $("#g-tag-cloud").html(data);
+ });
+ }
+ $("#g-add-tag-form").resetForm();
+ }
+ });
});
</script>
-<div id="g-tag-cloud" title="<?= url::site("tags") ?>">
+<div id="g-tag-cloud" ref="<?= url::site("tags") ?>">
<?= $cloud ?>
</div>
<?= $form ?> \ No newline at end of file
diff --git a/modules/user/controllers/admin_users.php b/modules/user/controllers/admin_users.php
index 54541e90..cc2d881e 100644
--- a/modules/user/controllers/admin_users.php
+++ b/modules/user/controllers/admin_users.php
@@ -383,7 +383,6 @@ class Admin_Users_Controller extends Admin_Controller {
private function _get_group_add_form_admin() {
$form = new Forge("admin/users/add_group", "", "post", array("id" => "g-add-group-form"));
- $form->set_attr('class', "g-one-quarter");
$form_group = $form->group("add_group")->label(t("Add group"));
$form_group->input("name")->label(t("Name"))->id("g-name");
$form_group->inputs["name"]->error_messages(
diff --git a/themes/admin_wind/css/screen.css b/themes/admin_wind/css/screen.css
index cd83b110..8d49a389 100644
--- a/themes/admin_wind/css/screen.css
+++ b/themes/admin_wind/css/screen.css
@@ -86,6 +86,12 @@ a:hover,
text-decoration: none;
}
+/* Forms ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
+#g-dialog form {
+ width: 270px;
+}
+
/* Tables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
table {
@@ -435,39 +441,6 @@ th {
padding: .2em .4em;
}
-/*************** STUFF THAT NEEDS A HOME ****************/
-
-.g-task-log {
- border: 1pt solid;
- font-size: .9em;
- height: 400px;
- margin: .5em 0;
- overflow: auto;
- padding: .5em
-}
-
-#g-languages-form table {
- width: 40%;
- margin: 0 3em 1em 0;
-}
-
-#g-languages-form input {
- clear: both;
-}
-
-#g-translations ol {
- margin: 0 0 1em 2em;
-}
-#g-translations ol li {
- list-style-type: decimal;
- line-height: 150%;
-}
-
-#g-translations .g-button {
- padding: .5em;
- margin-bottom: 1em;
-}
-
/** *******************************************************************
* 7) Right to left styles
*********************************************************************/
diff --git a/themes/night_wind/views/page.html.php b/themes/night_wind/views/page.html.php
index a14a3278..f41dcd27 100644
--- a/themes/night_wind/views/page.html.php
+++ b/themes/night_wind/views/page.html.php
@@ -77,14 +77,15 @@
<?= $theme->site_status() ?>
<div id="g-header" class="ui-helper-clearfix">
<div id="g-banner">
- <?= $theme->header_top() ?>
<? if ($header_text = module::get_var("gallery", "header_text")): ?>
<?= $header_text ?>
<? else: ?>
- <a id="g-logo" href="<?= item::root()->url() ?>" title="<?= t("go back to the Gallery home")->for_html_attr() ?>">
+ <a id="g-logo" class="g-left" href="<?= item::root()->url() ?>" title="<?= t("go back to the Gallery home")->for_html_attr() ?>">
<img width="107" height="48" alt="<?= t("Gallery logo: Your photos on your web site")->for_html_attr() ?>" src="<?= url::file("lib/images/logo.png") ?>" />
</a>
<? endif ?>
+ <?= $theme->user_menu() ?>
+ <?= $theme->header_top() ?>
<div id="g-site-menu">
<?= $theme->site_menu() ?>
</div>
@@ -93,8 +94,9 @@
<? if (!empty($parents)): ?>
<ul class="g-breadcrumbs">
+ <? $i = 0 ?>
<? foreach ($parents as $parent): ?>
- <li>
+ <li<? if ($i == 0) print " class=\"g-first\"" ?>>
<!-- Adding ?show=<id> causes Gallery3 to display the page
containing that photo. For now, we just do it for
the immediate parent so that when you go back up a
@@ -104,8 +106,9 @@
<?= html::purify($parent->title) ?>
</a>
</li>
+ <? $i++ ?>
<? endforeach ?>
- <li class="active"><?= html::purify($theme->item()->title) ?></li>
+ <li class="g-active"><?= html::purify($theme->item()->title) ?></li>
</ul>
<? endif ?>
</div>
diff --git a/themes/wind/views/page.html.php b/themes/wind/views/page.html.php
index a2b2fdd7..f41dcd27 100644
--- a/themes/wind/views/page.html.php
+++ b/themes/wind/views/page.html.php
@@ -84,6 +84,7 @@
<img width="107" height="48" alt="<?= t("Gallery logo: Your photos on your web site")->for_html_attr() ?>" src="<?= url::file("lib/images/logo.png") ?>" />
</a>
<? endif ?>
+ <?= $theme->user_menu() ?>
<?= $theme->header_top() ?>
<div id="g-site-menu">
<?= $theme->site_menu() ?>