<div data-role="content">
<form id="login-form">
<label for="login-form-email" >Email</label>
- <input id="login-form-email" type="email" name="email" autocomplete="on"/>
- <label for="login-form-password">Password</label>
- <input id="login-form-password" type="password" name="password"/>
+ <span style="float: left; width: 80%;">
+ <input id="login-form-email" type="email" name="email" autocomplete="on"/>
+ </span>
+ <span style="float: right;">
+ <input id="login-form-save" type="checkbox" name="save" class="custom" data-mini="true" checked/>
+ <label for="login-form-save">Save</label>
+ </span>
+ <span style="clear: both; float: left;">
+ <label for="login-form-password">Password</label>
+ </span>
+ <span style="clear: both;">
+ <input id="login-form-password" type="password" name="password"/>
+ </span>
<br/>
- <div data-role="controlgroup" data-type="horizontal">
+ <div data-role="controlgroup" data-type="horizontal" style="float: left;">
<a href="#" data-rel="back" data-role="button" data-mini="true" >Cancel</a>
<a href="#" onClick="sessionLogin()" data-role="button" data-mini="true" >Log in</a>
</div>
});
/* default distribution selection */
- $("#build-distribution-select option:eq(0)").attr("selected", "selected");
+ defualt_dist_id = buildGetCookieDistribution();
+ $("#build-distribution-select").val(defualt_dist_id);
$("#build-distribution-select").selectmenu('refresh');
// query Project list
function buildQueryProjectList() {
var distId = $("#build-distribution-select option:selected").val();
+ buildSetCookieDistribution(distId);
+
queryProjectsInDistribution( distId, function(xml) {
$("#build-git-table").empty();
$("#build-binary-table").empty();
$("#build-git-table").empty();
$("#build-binary-table").empty();
}
+
+function buildSetCookieDistribution(id)
+{
+ saveCookie("build_distribution", id, 7);
+}
+
+function buildGetCookieDistribution()
+{
+ id = getCookie("build_distribution");
+ if(id == "") {
+ id = 0;
+ }
+ return id;
+}
clearFormData('signup-form');
break;
case "login":
- clearFormData('login-form');
+ clearLoginData();
+ getUserId();
break;
case "projects":
generateNavigationBar(id);
buildClear();
jobsClear();
}
+
+function getCookie(key)
+{
+ var cook = document.cookie + ";";
+ var idx = cook.indexOf(key, 0);
+ var val = "";
+
+ if (idx != -1) {
+ cook = cook.substring(idx, cook.length);
+ begin = cook.indexOf("=", 0) + 1;
+ end = cook.indexOf(";", begin);
+ val = unescape(cook.substring(begin, end));
+ }
+
+ return val;
+}
+
+function saveCookie(key, value, expire_days)
+{
+ var today = new Date();
+ today.setDate(today.getDate() + expire_days);
+ document.cookie = key + "=" + escape(value) + "; path=/; expires=" + today.toGMTString() + ";";
+}
});
/* default distribution selection */
- $("#projects-distribution-select option:eq(0)").attr("selected", "selected");
+ defualt_dist_id = projectsGetCookieDistribution();
+ $("#projects-distribution-select").val(defualt_dist_id);
$("#projects-distribution-select").selectmenu('refresh');
$('#projects-type-select input[type="radio"]').attr("checked",false).checkboxradio("refresh");
function projectsQueryProjectListType() {
var dist_id = $("#projects-distribution-select option:selected").val();
+ projectsSetCookieDistribution(dist_id);
+
queryProjectsInfoInDistribution( dist_id, function(xml) {
$("#projects-project-list").empty();
$("#projects-project-list").empty();
}
+function projectsSetCookieDistribution(id)
+{
+ saveCookie("projects_distribution", id, 7);
+}
+
+function projectsGetCookieDistribution()
+{
+ id = getCookie("projects_distribution");
+ if(id == "") {
+ id = 0;
+ }
+ return id;
+}
sessionStorage.sessionInfoName = name;
sessionStorage.sessionInfoGroup = group;
sessionStorage.sessionInfoAdmin = admin;
+
+ saveUserId(email);
+
$.mobile.changePage("#index");
}
else
{
alert(message);
- }
+ }
});
}
+
+function clearLoginData()
+{
+ $("#login-form-email").val("");
+ $("#login-form-password").val("");
+}
+function getUserId()
+{
+ id = getCookie("user_email");
+ if(id != "") {
+ $("#login-form-email").val(id);
+ }
+}
+
+function saveUserId(id)
+{
+ if($("#login-form-save").attr("checked") == "checked") {
+ if (id != "") {
+ saveCookie("user_email", id, 7);
+ } else {
+ saveCookie("user_email", id, -1);
+ }
+ }
+ else {
+ saveCookie("user_email", id, -1);
+ }
+}