summaryrefslogtreecommitdiff
path: root/themes/default
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default')
-rw-r--r--themes/default/css/screen.css84
-rw-r--r--themes/default/js/user.js79
-rw-r--r--themes/default/views/form.html.php54
-rw-r--r--themes/default/views/header.html.php40
-rw-r--r--themes/default/views/page.html.php3
5 files changed, 136 insertions, 124 deletions
diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css
index 5261706a..eeb4eeb9 100644
--- a/themes/default/css/screen.css
+++ b/themes/default/css/screen.css
@@ -576,7 +576,7 @@ table.gMetadata td.toggle {
/**
** *******************************************************************
- * 8) Forms (general and specific)
+ * 8) Forms (general and specific)
** *******************************************************************
*/
@@ -596,15 +596,15 @@ label {
cursor: help;
}
-input[type="text"],
+input[type="text"],
input[type="password"],
-textarea,
-select {
+textarea,
+select {
}
-input[type="text"],
-input[type="password"],
-textarea,
+input[type="text"],
+input[type="password"],
+textarea,
.gValidationRule {
width: 40%;
}
@@ -645,7 +645,7 @@ optgroup {
select {
}
-textarea {
+textarea {
width: 99%;
height: 12em;
}
@@ -655,16 +655,16 @@ button {
/* ~~~~~~~~~ Form layout ~~~~~~~~~~ */
-form ul, form li {
- list-style: none !important;
+form ul, form li {
+ list-style: none !important;
}
-form ul {
- margin: 0;
+form ul {
+ margin: 0;
padding: 0;
}
-form li {
- margin-top: .5em;
+form li {
+ margin-top: .5em;
padding: .3em 1.5em .3em 1em;
}
@@ -676,16 +676,16 @@ form ul ul li {
float: left;
}
-input,
+input,
textarea {
- display: block;
+ display: block;
clear: both;
}
/* ~~~~~~~~~ Inline fieldsets ~~~~~~~~~~ */
.gInline li {
- float: left;
+ float: left;
margin: 0;
padding: .3em .5em .4em;
text-align: left;
@@ -694,7 +694,7 @@ textarea {
.gInline input {
}
-.gInline input[type="Submit"] {
+.gInline input[type="Submit"] {
margin-top: 1em;
}
@@ -702,16 +702,16 @@ textarea {
margin-top: 0;
}
-.gInline input[type="text"],
-.gInline input[type="password"],
-.gInline textarea,
-.gInline .gValidationRule {
+.gInline input[type="text"],
+.gInline input[type="password"],
+.gInline textarea,
+.gInline .gValidationRule {
width: 10em;
}
-input:focus,
-textarea:focus,
-option:focus {
+input:focus,
+textarea:focus,
+option:focus {
background-color: #ffc;
}
@@ -720,13 +720,13 @@ option:focus {
.gRequired {
}
-ul.gError,
-li.gError {
+ul.gError,
+li.gError {
background-color: #ffdcdc;
}
-.gError label,
-.gValidationRule {
+.gError label,
+.gValidationRule {
color: red;
}
@@ -735,24 +735,24 @@ li.gError {
margin-top: .5em;
}
-form.gError input[type="text"],
-li.gError input[type="text"],
-form.gError input[type="password"],
-li.gError input[type="password"],
-form.gError input[type="checkbox"],
-li.gError input[type="checkbox"],
-form.gError input[type="radio"],
-li.gError input[type="radio"],
-form.gError textarea,
-li.gError textarea,
-form.gError select,
-li.gError select {
+form.gError input[type="text"],
+li.gError input[type="text"],
+form.gError input[type="password"],
+li.gError input[type="password"],
+form.gError input[type="checkbox"],
+li.gError input[type="checkbox"],
+form.gError input[type="radio"],
+li.gError input[type="radio"],
+form.gError textarea,
+li.gError textarea,
+form.gError select,
+li.gError select {
border: 2px solid red;
}
/* ~~~~~~~~ form font size ~~~~~~ */
-#gHeader form, #gSidebar form {
+#gHeader form, #gSidebar form {
font-size: .9em;
}
diff --git a/themes/default/js/user.js b/themes/default/js/user.js
index b389a67e..42ab1aa7 100644
--- a/themes/default/js/user.js
+++ b/themes/default/js/user.js
@@ -1,66 +1,29 @@
-$(document).ready(function() {
- $("#gLoginForm").submit(function() {
- process_login();
- return false;
- });
- $("#gLogoutLink").click(function() {
- process_logout();
- return false;
- });
-});
-
-function show_form(formName) {
- $(formName + "Link").css({display: "none"});
- $(formName + "Text").css({display: "inline"});
- $(formName + "Close").css({display: "inline"});
- var url = $(formName + "Form").attr("formSrc");
- $.get(url, null, function(data, textStatus) {
- $(formName + "Form").html(data);
- $(formName + "Form").css({display: "block"});
+function show_login(url) {
+ $("#gLoginLink").hide();
+ $("#gLoginClose").show();
+ $.get(url, function(data) {
+ $("#gLoginFormContainer").html(data);
+ ajaxify_login_form();
});
}
-function hide_form(formName) {
- $(formName + "Link").css({display: "inline"});
- $(formName + "Form").css({display: "none"});
- $(formName + "Form").html("");
- $(formName + "Text").css({display: "none"});
- $(formName + "Close").css({display: "none"});
-}
-
-function process_login() {
- $.ajax({
- url: $("#gLogin").attr("action"),
- type: "POST",
- data: $("#gLogin").serialize(),
- dataType: "json",
- error: function(XMLHttpRequest, textStatus, errorThrown) {
- alert("textStatus: " + textStatus + "\nerrorThrown: " + errorThrown);
- },
- success: function(data, textStatus) {
- if (data.error_message != "") {
- $("#gLoginMessage").html(data.error_message);
- $("#gLoginMessage").css({display: "block"});
- $("#gLogin").addClass("gError");
- } else {
+function ajaxify_login_form() {
+ $("form#gLogin").ajaxForm({
+ target: "#gLoginFormContainer",
+ success: function(responseText, statusText) {
+ if (!responseText) {
window.location.reload();
+ } else {
+ ajaxify_login_form();
}
- }
+ },
});
}
-function process_logout() {
- $.ajax({
- url: $("#gLogoutLink").attr("href"),
- type: "GET",
- dataType: "json",
- error: function(XMLHttpRequest, textStatus, errorThrown) {
- alert("textStatus: " + textStatus + "\nerrorThrown: " + errorThrown);
- },
- success: function(data, textStatus) {
- if (data.logout) {
- window.location.reload();
- }
- }
- });
-} \ No newline at end of file
+function close_login() {
+ $("#gLogin").remove();
+ $("#gLoginClose").hide();
+ $("#gLoginLink").show();
+ $("input#gUsername").val("");
+ $("input#gPassword").val("");
+}
diff --git a/themes/default/views/form.html.php b/themes/default/views/form.html.php
new file mode 100644
index 00000000..bc8d1339
--- /dev/null
+++ b/themes/default/views/form.html.php
@@ -0,0 +1,54 @@
+<?
+print($open);
+
+// Not sure what to do with these, but at least show that we received them.
+if ($class) {
+ print "<!-- unused class in form.html.php: $class -->";
+}
+if ($title) {
+ print "<!-- unused title in form.html.php: $title -->";
+}
+
+function DrawForm($inputs, $level=1) {
+ $error_messages = array();
+ $prefix = str_repeat(" ", $level);
+
+ foreach ($inputs as $input) {
+ if ($input->type == 'group') {
+ print "$prefix<fieldset>\n";
+ print "$prefix <legend>$input->name</legend>\n";
+ print "$prefix <ul>\n";
+ DrawForm($input->inputs, $level + 2);
+ print "$prefix </ul>\n";
+ print "$prefix</fieldset>\n";
+ } else {
+ if ($input->error_messages()) {
+ $error_messages = array_merge($error_messages, $input->error_messages());
+ print "$prefix<li class=\"gError\">\n";
+ } else {
+ print "$prefix<li>\n";
+ }
+ if ($input->label()) {
+ print $prefix . " " . $input->label() . "\n";
+ }
+ print $prefix . " " . $input->render() . "\n";
+ print "$prefix</li>\n";
+ if ($input->message()) {
+ print "$prefix<li>\n";
+ print $prefix . " " . $input->message() . "\n";
+ print "$prefix</li>\n";
+ }
+ }
+ }
+ if ($error_messages) {
+ print "$prefix <div class=\"gStatus gError\">\n";
+ foreach ($error_messages as $message) {
+ print "<p class=\"gError\">$message<p>";
+ }
+ print "$prefix </div>\n";
+ }
+}
+DrawForm($inputs);
+
+print($close);
+?>
diff --git a/themes/default/views/header.html.php b/themes/default/views/header.html.php
index 24dd9331..8cba82ba 100644
--- a/themes/default/views/header.html.php
+++ b/themes/default/views/header.html.php
@@ -2,31 +2,25 @@
<img id="gLogo" alt="<?= _("Logo") ?>" src="<?= $theme->url("images/logo.png") ?>" />
<h1><?= $item->title_edit ?></h1>
-<div id="gLoginMenu">
+<ul id="gLoginMenu">
<? if ($user): ?>
- <a href="<?= url::site("user/update")?>"><?= _("Modify Profile") ?></a>
- | <a href="<?= url::site("logout")?>" id="gLogoutLink"><?= _("Logout") ?></a>
+ <a href="<?= url::site("user/update")?>"><?= _("Modify Profile") ?></a>
+ | <a href="<?= url::site("logout?continue=" . url::current(true)) ?>" id="gLogoutLink">
+ <?= _("Logout") ?>
+ </a>
<? else: ?>
- <a href="#"><?=_("Recover password") ?></a>
- <span id="gUserLink" >
- | <a href="javascript:show_form('#gUser')"><?= _("Register") ?></a>
- </span>
- <span id="gUserLinkText" class="gDisplayNone">
- | <?= _("Register") ?>
- </span>
- <span id="gLoginLink">
- | <a href="javascript:show_form('#gLogin')"><?= _("Login") ?></a>
- </span>
- <span id="gLoginText" class="gDisplayNone">
- | <?= _("Login") ?>
- </span>
- <span id="gLoginClose" class="gDisplayNone">
- | <a href="javascript:hide_form('#gLogin')">X</a>
- </span>
+ <span id="gLoginLink">
+ <a href="javascript:show_login('<?= url::site("login") ?>')">
+ <?= _("Login") ?>
+ </a>
+ </span>
+ <span id="gLoginClose" class="gDisplayNone">
+ <?= _("Login") ?> | <a href="javascript:close_login()">X</a>
+ </span>
+ <div id="gLoginFormContainer"></div>
<? endif; ?>
- <span id="gUserForm" class="gDisplayNone" formSrc="<?= url::site("user/dispatch/") ?>"></span>
- <span id="gLoginForm" class="gDisplayNone" formSrc="<?= url::site("login") ?>"></span>
-</div>
+</ul>
+
<ul id="gSiteMenu">
<li><a href="<?= url::base() ?>"><?= _("HOME") ?></a></li>
<li><a class="active" href="<?= url::site("album/1") ?>"><?= _("BROWSE") ?></a></li>
@@ -38,7 +32,7 @@
<form id="gSearchForm" class="gInline">
<ul class="gNoLabels">
<li><input type="text" value="<?= _("Search Gallery ...") ?>"/></li>
- <li><input type="submit" value="search" /></li>
+ <li><input type="submit" value="<?= _("search") ?>" /></li>
</ul>
</form>
diff --git a/themes/default/views/page.html.php b/themes/default/views/page.html.php
index 18dd735c..c6addf98 100644
--- a/themes/default/views/page.html.php
+++ b/themes/default/views/page.html.php
@@ -9,10 +9,11 @@
media="screen,print,projection" />
<link rel="stylesheet" type="text/css" href="<?= url::file("lib/yui/base-min.css") ?>"
media="screen,print,projection" />
- <link rel="stylesheet" type="text/css" href="<?= $theme->url("css/screen.css") ?>"
+ <link rel="stylesheet" type="text/css" href="<?= $theme->url("css/screen.css") ?>"
media="screen,print,projection" />
<script src="<?= url::file("lib/jquery.js") ?>" type="text/javascript"></script>
<script src="<?= url::file("lib/jquery.jeditable.js") ?>" type="text/javascript"></script>
+ <script src="<?= url::file("lib/jquery.form.js") ?>" type="text/javascript"></script>
<script src="<?= $theme->url("js/user.js") ?>" type="text/javascript"></script>
</head>