summaryrefslogtreecommitdiffstats
path: root/public_html
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-09-27 09:25:14 +0200
committerAleksander Machniak <alec@alec.pl>2012-09-27 09:25:14 +0200
commit71fe77ab8367cb4473e6bac7d8f002f82a121b99 (patch)
tree3e8ca4b5efe38bc08fa6d6a7ef53a258f27c5388 /public_html
parent987a93aec322f7b8171d8f492a01dc7de5ae011c (diff)
downloadwebadmin-71fe77ab8367cb4473e6bac7d8f002f82a121b99.tar.gz
Integrate hosted/signup with core, fix Smarty cache issue (#1044)
Diffstat (limited to 'public_html')
-rw-r--r--public_html/index.php2
-rw-r--r--public_html/js/kolab_hosted.js120
-rw-r--r--public_html/skins/default/hosted.css45
-rw-r--r--public_html/skins/default/images/logo_kolab.pngbin0 -> 17755 bytes
-rw-r--r--public_html/skins/default/templates/signup.html32
-rw-r--r--public_html/skins/default/templates/signup_footer.html1
-rw-r--r--public_html/skins/default/ui.js2
-rw-r--r--public_html/skins/kolabsys/hosted.css26
l---------public_html/skins/kolabsys/style.css1
-rw-r--r--public_html/skins/kolabsys/templates/signup.html20
l---------public_html/skins/kolabsys/ui.js1
l---------public_html/skins/minimal/hosted.css1
l---------public_html/skins/minimal/style.css1
-rw-r--r--public_html/skins/minimal/templates/signup.html23
-rw-r--r--public_html/skins/minimal/templates/signup_footer.html1
l---------public_html/skins/minimal/ui.js1
16 files changed, 275 insertions, 2 deletions
diff --git a/public_html/index.php b/public_html/index.php
index 3e78361..1f9f1ed 100644
--- a/public_html/index.php
+++ b/public_html/index.php
@@ -29,7 +29,7 @@ require_once '../lib/functions.php';
// starting task
$task = kolab_utils::get_input('task', kolab_utils::REQUEST_GET);
-if (!$task) {
+if (!$task || $task == 'signup') {
$task = 'main';
}
diff --git a/public_html/js/kolab_hosted.js b/public_html/js/kolab_hosted.js
new file mode 100644
index 0000000..9f717ae
--- /dev/null
+++ b/public_html/js/kolab_hosted.js
@@ -0,0 +1,120 @@
+/*
+ +--------------------------------------------------------------------------+
+ | This file is part of the Kolab Web Admin Panel |
+ | |
+ | Copyright (C) 2011-2012, Kolab Systems AG |
+ | |
+ | This program is free software: you can redistribute it and/or modify |
+ | it under the terms of the GNU Affero General Public License as published |
+ | by the Free Software Foundation, either version 3 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 Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public License |
+ | along with kadm program. If not, see <http://www.gnu.org/licenses/> |
+ +--------------------------------------------------------------------------+
+ | Author: Torsten Grote <grote@kolabsys.com> |
+ +--------------------------------------------------------------------------+
+*/
+
+// overwrite user_save() function
+kadm.user_save = function(reload, section)
+{
+ var data = kadm.serialize_form('#'+this.env.form_id);
+
+ // check email address
+ if(typeof data.mailalternateaddress != 'undefined' && !isValidEmailAddress(data.mailalternateaddress)) {
+ kadm.display_message('signup.wrongmailalternateaddress', 'error');
+ kadm.form_value_error('mailalternateaddress');
+ return;
+ }
+
+ if (!kadm.check_required_fields(data)) {
+ kadm.display_message('form.required.empty', 'error');
+ return;
+ }
+
+ // check password
+ if (data.userpassword != data.userpassword2) {
+ kadm.display_message('user.password.mismatch', 'error');
+ kadm.form_value_error('userpassword2');
+ return;
+ }
+ delete data['userpassword2'];
+
+ kadm.http_post('signup.add_user', {data: data});
+};
+
+kadm.change_user_type = function()
+{
+ var data = kadm.serialize_form('#'+this.env.form_id);
+
+ kadm.http_post('signup.default', {data: data});
+};
+
+kadm.check_user_availability = function()
+{
+ // get form data and build new email address
+ var data = kadm.serialize_form('#signup-form');
+ var mail = data['uid'] + '@' + data['domain'];
+
+ if(isValidEmailAddress(mail)) {
+ // update future mail form field
+ $('input[name="mail"]').val(mail);
+
+ // check if user with that email address already exists
+ kadm.http_post('signup.check_user', {data: data});
+ } else {
+ kadm.update_user_info('signup.wronguid', 'uid');
+ }
+};
+
+kadm.update_user_info = function(msg, part)
+{
+ var span_id = 'availability';
+ if(!part.localeCompare('userpassword')) {
+ span_id = 'pass_match';
+ }
+
+ if (msg) {
+ msg = kadm.t(msg);
+ }
+
+ // display message next to form field
+ if($('span[id="'+span_id+'"]').length) {
+ // update existing span area
+ $('span[id="'+span_id+'"]').html(msg);
+ }
+ else {
+ // add span area and add message
+ $('input[name="'+part+'"]').after(' <span id="'+span_id+'" class="form_error">' + msg + '</span>');
+ }
+
+ // enable/disable button
+ if(msg == '') {
+ $('input[type="button"]').removeAttr("disabled");
+ } else {
+ $('input[type="button"]').attr("disabled", "disabled");
+ }
+};
+
+
+function password_match()
+{
+ if($('input[name="userpassword"]').val().localeCompare($('input[name="userpassword2"]').val())) {
+ kadm.update_user_info('user.password.mismatch', 'userpassword');
+ }
+ else {
+ kadm.update_user_info('', 'userpassword');
+ }
+}
+
+// TODO use form.validate api call for that
+function isValidEmailAddress(emailAddress) {
+ var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
+ return pattern.test(emailAddress);
+};
diff --git a/public_html/skins/default/hosted.css b/public_html/skins/default/hosted.css
new file mode 100644
index 0000000..694d19d
--- /dev/null
+++ b/public_html/skins/default/hosted.css
@@ -0,0 +1,45 @@
+body {
+ background: #f0f0f0;
+ text-align: center;
+}
+
+#bodybox {
+ display: inline-block;
+ width: 900px;
+ text-align: left;
+}
+
+#logo {
+ width: 462px;
+ height: 100px;
+ position: relative;
+ margin: 10px;
+ cursor: default;
+ background: url(images/logo_kolab.png) 0 0 no-repeat;
+}
+
+#content {
+ padding: 15px;
+}
+
+#taskcontent {
+ display: inline-block;
+ margin-top: 10px;
+ text-align: center;
+}
+
+form#signup-form {
+ padding-top: 10px;
+}
+
+td.label {
+ vertical-align: top;
+}
+
+table.form td {
+ text-align: left;
+}
+
+#footer {
+ text-align: center;
+}
diff --git a/public_html/skins/default/images/logo_kolab.png b/public_html/skins/default/images/logo_kolab.png
new file mode 100644
index 0000000..0c06ff1
--- /dev/null
+++ b/public_html/skins/default/images/logo_kolab.png
Binary files differ
diff --git a/public_html/skins/default/templates/signup.html b/public_html/skins/default/templates/signup.html
new file mode 100644
index 0000000..66a649a
--- /dev/null
+++ b/public_html/skins/default/templates/signup.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8" />
+ <title>{$engine->translate('signup.headline')}</title>
+ <link rel="stylesheet" href="{$skin_path}style.css" />
+ <link rel="stylesheet" href="{$skin_path}hosted.css" />
+ <link rel="shortcut icon" type="image/png" href="{$skin_path}images/favicon.png" />
+ <script src="js/jquery.min.js"></script>
+ <script src="js/kolab_admin.js"></script>
+ <script type="text/javascript" src="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
+ <script src="js/kolab_hosted.js"></script>
+ <script src="{$skin_path}ui.js"></script>
+</head>
+<body>
+ <div id="bodybox">
+ <div id="logo"></div>
+ <div id="content">
+ <div id="task_content" class="signup">
+ <h1>{$engine->translate('signup.headline')}</h1>
+ <p>{$engine->translate('signup.intro1')}</p>
+ <p>{$engine->translate('signup.intro2')}</p>
+ <div id="taskcontent" class="signup">{$form}</div>
+ </div>
+ </div>
+ <div id="footer">
+ {include file="signup_footer.html"}
+ </div>
+ </div>
+{$script}
+</body>
+</html>
diff --git a/public_html/skins/default/templates/signup_footer.html b/public_html/skins/default/templates/signup_footer.html
new file mode 100644
index 0000000..24d972d
--- /dev/null
+++ b/public_html/skins/default/templates/signup_footer.html
@@ -0,0 +1 @@
+{$engine->translate('signup.footer')}
diff --git a/public_html/skins/default/ui.js b/public_html/skins/default/ui.js
index c0dc901..45bfd51 100644
--- a/public_html/skins/default/ui.js
+++ b/public_html/skins/default/ui.js
@@ -153,7 +153,7 @@ function ui_resize()
var h = $('#content').height();
// resize UI elements
if (h - 22 > 380) {
- $('#taskcontent').css({'min-height': h - 22});
+ $('#taskcontent:not(.signup)').css({'min-height': h - 22});
}
};
diff --git a/public_html/skins/kolabsys/hosted.css b/public_html/skins/kolabsys/hosted.css
new file mode 100644
index 0000000..427d57d
--- /dev/null
+++ b/public_html/skins/kolabsys/hosted.css
@@ -0,0 +1,26 @@
+body {
+ background: #F3F3F3;
+ text-align: center;
+}
+
+#taskcontent {
+ width: 680px;
+ min-height: 100px;
+ max-height: 460px;
+}
+
+form#signup-form {
+ padding-top: 10px;
+}
+
+td.value input {
+ width: 250px;
+}
+
+td.label {
+ vertical-align: top;
+}
+
+table.form td {
+ text-align: left;
+}
diff --git a/public_html/skins/kolabsys/style.css b/public_html/skins/kolabsys/style.css
new file mode 120000
index 0000000..2bc3133
--- /dev/null
+++ b/public_html/skins/kolabsys/style.css
@@ -0,0 +1 @@
+../default/style.css \ No newline at end of file
diff --git a/public_html/skins/kolabsys/templates/signup.html b/public_html/skins/kolabsys/templates/signup.html
new file mode 100644
index 0000000..7c756ae
--- /dev/null
+++ b/public_html/skins/kolabsys/templates/signup.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8" />
+ <title>Sign Up For Hosted Kolab</title>
+ <link rel="stylesheet" href="{$skin_path}style.css" />
+ <link rel="stylesheet" href="{$skin_path}hosted.css" />
+ <link rel="shortcut icon" type="image/png" href="{$skin_path}images/favicon.png" />
+ <script src="js/jquery.min.js"></script>
+ <script src="js/kolab_admin.js"></script>
+ <script type="text/javascript" src="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
+ <script src="js/kolab_hosted.js"></script>
+ <script src="{$skin_path}ui.js"></script>
+</head>
+<body>
+ <div id="taskcontent" class="signup">{$form}</div>
+
+ {$script}
+</body>
+</html>
diff --git a/public_html/skins/kolabsys/ui.js b/public_html/skins/kolabsys/ui.js
new file mode 120000
index 0000000..b845f3f
--- /dev/null
+++ b/public_html/skins/kolabsys/ui.js
@@ -0,0 +1 @@
+../default/ui.js \ No newline at end of file
diff --git a/public_html/skins/minimal/hosted.css b/public_html/skins/minimal/hosted.css
new file mode 120000
index 0000000..a66df34
--- /dev/null
+++ b/public_html/skins/minimal/hosted.css
@@ -0,0 +1 @@
+../default/hosted.css \ No newline at end of file
diff --git a/public_html/skins/minimal/style.css b/public_html/skins/minimal/style.css
new file mode 120000
index 0000000..2bc3133
--- /dev/null
+++ b/public_html/skins/minimal/style.css
@@ -0,0 +1 @@
+../default/style.css \ No newline at end of file
diff --git a/public_html/skins/minimal/templates/signup.html b/public_html/skins/minimal/templates/signup.html
new file mode 100644
index 0000000..ccf16b8
--- /dev/null
+++ b/public_html/skins/minimal/templates/signup.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8" />
+ <title>Sign Up For Hosted Kolab</title>
+ <link rel="stylesheet" href="{$skin_path}style.css" />
+ <link rel="stylesheet" href="{$skin_path}hosted.css" />
+ <link rel="shortcut icon" type="image/png" href="{$skin_path}images/favicon.png" />
+ <script src="js/jquery.min.js"></script>
+ <script src="js/kolab_admin.js"></script>
+ <script type="text/javascript" src="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
+ <script src="js/kolab_hosted.js"></script>
+ <script src="{$skin_path}ui.js"></script>
+</head>
+<body>
+ <div id="taskcontent" class="signup">{$form}</div>
+
+ <div id="footer">
+ {include file="signup_footer.html"}
+ </div>
+{$script}
+</body>
+</html>
diff --git a/public_html/skins/minimal/templates/signup_footer.html b/public_html/skins/minimal/templates/signup_footer.html
new file mode 100644
index 0000000..4b6bac5
--- /dev/null
+++ b/public_html/skins/minimal/templates/signup_footer.html
@@ -0,0 +1 @@
+This is a service offered by <a href="http://kolabsys.com">Kolab Systems</a>.
diff --git a/public_html/skins/minimal/ui.js b/public_html/skins/minimal/ui.js
new file mode 120000
index 0000000..b845f3f
--- /dev/null
+++ b/public_html/skins/minimal/ui.js
@@ -0,0 +1 @@
+../default/ui.js \ No newline at end of file