Commit 5d5a0a86 authored by Marco Mariani's avatar Marco Mariani

Merge branch 'mmariani-jslint' into slaprunner

parents 356e6558 625aa19a
......@@ -16,7 +16,7 @@ class Parser(OptionParser):
"""
def __init__(self, usage=None, version=None):
"""
Initialize all options possibles.
Initialize all possible options.
"""
OptionParser.__init__(self, usage=usage, version=version,
option_list=[
......
$(document).ready(function(){
$(".tabContents").hide(); // Hide all tab content divs by default
$(".tabContents").hide(); // Hide all tab content divs by default
var hashes = window.location.href.split('#');
var fromheight = 0;
var previoustab = null;
......@@ -18,17 +18,17 @@ $(document).ready(function(){
});
}
else{$(".tabContents:first").show(); previoustab = ".tabContents:first";} // Show the first div of tab content by default
$("#tabContaier ul li a").click(function(){ //Fire the click event
if($(this).hasClass('active')){
return false;
}
$("#tabContaier ul li a").click(function(){ //Fire the click event
if($(this).hasClass('active')){
return false;
}
fromheight = $(previoustab).height();
var activeTab = $(this).attr("href"); // Catch the click link
var activeTab = $(this).attr("href"); // Catch the click link
$("#tabContaier .tabDetails").css("height", $("#tabContaier .tabDetails").height());
$("#tabContaier ul li a").removeClass("active"); // Remove pre-highlighted link
$(this).addClass("active"); // set clicked link to highlight state
$(".tabContents").hide(); // hide currently visible tab content div
$(activeTab).fadeIn(); // show the target tab content div by matching clicked link.
$("#tabContaier ul li a").removeClass("active"); // Remove pre-highlighted link
$(this).addClass("active"); // set clicked link to highlight state
$(".tabContents").hide(); // hide currently visible tab content div
$(activeTab).fadeIn(); // show the target tab content div by matching clicked link.
var diff = fromheight - $(activeTab).height();
if (diff > 0){$("#tabContaier .tabDetails").animate({height: '-=' + diff + 'px'}, 850, 'swing', function() {
$("#tabContaier .tabDetails").css("height", "");
......@@ -39,5 +39,5 @@ $(document).ready(function(){
previoustab = activeTab;
$("#tabContaier .tabDetails").css("height", $("#tabContaier .tabDetails").height());
return false;//this reinitialize tab index when reload page
});
});
\ No newline at end of file
});
});
......@@ -30,43 +30,43 @@
$box.show();
$box.append('<div><table id="bcontent"><tr>' +
'<td valign="middle" class="logo ' + option.type + '_message"></td>' +
'<td valign="middle"><p>' + msg + '</p></td>' +
'<td valign="middle" class="b_close"><span id="pClose"></span></td></tr></table></div>');
'<td valign="middle"><p>' + msg + '</p></td>' +
'<td valign="middle" class="b_close"><span id="pClose"></span></td></tr></table></div>');
$(window).scroll(function(){
$box.animate({top:$(window).scrollTop()+"px" },{queue: false, duration: 350});
$box.animate({top:$(window).scrollTop()+"px" },{queue: false, duration: 350});
});
h = $("#bcontent").height()+5;
$("#pClose").bind("click", function() {
close();
close();
});
showBox();
if(option.duration != 0){
showDelayTimer = setTimeout(function(){
showDelayTimer = setTimeout(function(){
showDelayTimer = null;
close();
}, option.duration);
close();
}, option.duration);
}
}
function showBox(){
if(option.load){
$(window).load(function(){
$box.css('top', + ($(window).scrollTop() - h) +'px');
$box.animate({ top:"+=" + h + "px" }, "slow");
$box.animate({ top:"+=" + h + "px" }, "slow");
isShow = true;
});
});
}
else{
$box.css('top', + ($(window).scrollTop() - h) +'px');
$box.animate({ top:"+=" + h + "px" }, "slow");
$box.css('top', + ($(window).scrollTop() - h) +'px');
$box.animate({ top:"+=" + h + "px" }, "slow");
isShow = true;
}
}
function close(){
$box.animate({ top:"-=" + h + "px" }, "slow", function(){
$box.fadeOut("normal", function() {
$box.animate({ top:"-=" + h + "px" }, "slow", function(){
$box.fadeOut("normal", function() {
isShow = false;
});
});
});
}
}
});
......
$(document).ready( function() {
var send = false;
$("#update").click(function(){
var haspwd = false;
var hasAccount = !($("input#hasAccount").val() === "");
if($("input#username").val() === "" || !$("input#username").val().match(/^[\w\d\._-]+$/)){
$("#error").Popup("Invalid user name. Please check it!", {type:'alert', duration:3000});
return false;
}
else if ($("input#username").val().length <6){
$("#error").Popup("Username must have at least 6 characters", {type:'alert', duration:3000});
return false;
}
if($("input#name").val() === ""){
$("#error").Popup("Please enter your name and surname!", {type:'alert', duration:3000});
return false;
}
if(!$("input#email").val().match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)){
$("#error").Popup("Please enter a valid email adress!", {type:'alert', duration:3000});
return false;
}
if(!hasAccount && !$("input#password").val().match(/^[\w\d\._-]+$/)){
$("#error").Popup("Please enter your new password!", {type:'alert', duration:3000});
return false;
}
if ($("input#password").val() !== "" && $("input#password").val().length <6){
$("#error").Popup("The password must have at least 6 characters", {type:'alert', duration:3000});
return false;
}
if($("input#password").val() !== ""){
if($("input#password").val() === "" || !$("input#password").val().match(/^[\w\d\._-]+$/)){
$("#error").Popup("Please enter your new password!", {type:'alert', duration:3000});
return false;
}
if($("input#password").val() !== $("input#cpassword").val()){
$("#error").Popup("your password does not match!", {type:'alert', duration:3000});
return false;
}
haspwd = true;
}
if(!$("input#rcode").val().match(/^[\w\d]+$/)){
$("#error").Popup("Please enter your password recovery code.", {type:'alert', duration:3000});
return false;
}
if(send) return false;
send = true;
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + ((hasAccount)? '/updateAccount':'/configAccount'),
data: {name: $("input#name").val(), username:$("input#username").val(), email:$("input#email").val(),
password:((haspwd) ? $("input#password").val():""), rcode:$("input#rcode").val()},
success: function(data){
if(data.code ==1){
location.href = $SCRIPT_ROOT+"/"
/*jslint undef: true */
/*global $, document, window, $SCRIPT_ROOT */
/* vim: set et sts=4: */
$(document).ready(function () {
"use strict";
var send = false;
$("#update").click(function () {
var haspwd = false,
hasAccount = ($("input#hasAccount").val() !== "");
if ($("input#username").val() === "" || !$("input#username").val().match(/^[\w\d\._\-]+$/)) {
$("#error").Popup("Invalid user name. Please check it!", {type: 'alert', duration: 3000});
return false;
}
else{
$("#error").Popup(data.result, {type:'error', duration:5000});
if ($("input#username").val().length < 6) {
$("#error").Popup("Username must have at least 6 characters", {type: 'alert', duration: 3000});
return false;
}
send = false;
},
error:function(){send = false;}
if ($("input#name").val() === "") {
$("#error").Popup("Please enter your name and surname!", {type: 'alert', duration: 3000});
return false;
}
if (!$("input#email").val().match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)) {
$("#error").Popup("Please enter a valid email adress!", {type: 'alert', duration: 3000});
return false;
}
if (!hasAccount && !$("input#password").val().match(/^[\w\d\._\-]+$/)) {
$("#error").Popup("Please enter your new password!", {type: 'alert', duration: 3000});
return false;
}
if ($("input#password").val() !== "" && $("input#password").val().length < 6) {
$("#error").Popup("The password must have at least 6 characters", {type: 'alert', duration: 3000});
return false;
}
if ($("input#password").val() !== "") {
if ($("input#password").val() === "" || !$("input#password").val().match(/^[\w\d\._\-]+$/)) {
$("#error").Popup("Please enter your new password!", {type: 'alert', duration: 3000});
return false;
}
if ($("input#password").val() !== $("input#cpassword").val()) {
$("#error").Popup("your password does not match!", {type: 'alert', duration: 3000});
return false;
}
haspwd = true;
}
if (!$("input#rcode").val().match(/^[\w\d]+$/)) {
$("#error").Popup("Please enter your password recovery code.", {type: 'alert', duration: 3000});
return false;
}
if (send) {
return false;
}
send = true;
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + ((hasAccount) ? '/updateAccount' : '/configAccount'),
data: {
name: $("input#name").val(),
username: $("input#username").val(),
email: $("input#email").val(),
password: ((haspwd) ? $("input#password").val() : ""),
rcode: $("input#rcode").val()
},
success: function (data) {
if (data.code === 1) {
window.location.href = $SCRIPT_ROOT + "/";
} else {
$("#error").Popup(data.result, {type: 'error', duration: 5000});
}
send = false;
},
error: function () { send = false; }
});
return false;
});
return false;
});
});
\ No newline at end of file
});
/*jslint undef: true */
/*global $, window, $SCRIPT_ROOT */
/* vim: set et sts=4: */
/*Common javascript function*/
String.prototype.toHtmlChar = function(){
var c = {'<':'&lt;', '>':'&gt;', '&':'&amp;', '"':'&quot;', "'":'&#039;',
'#':'&#035;' };
return this.replace( /[<&>'"#]/g, function(s) { return c[s]; } );
String.prototype.toHtmlChar = function () {
"use strict";
var c = {
'<': '&lt;',
'>': '&gt;',
'&': '&amp;',
'"': '&quot;',
"'": '&#039;',
'#': '&#035;'
};
return this.replace(/[<&>'"#]/g, function (s) { return c[s]; });
};
String.prototype.trim = function () {
"use strict";
return this.replace(/^\s*/, "").replace(/\s*$/, "");
};
/****************************************/
function setInput($elt) {
if(!$elt){$elt = $('input[type="text"], input[type="password"]');}
$elt.addClass("idleField");
$elt.focus(function() {
$(this).removeClass("idleField").addClass("focusField");
if (this.value == this.defaultValue){
this.value = '';
}
if(this.value != this.defaultValue){
this.select();
}
});
$elt.blur(function() {
$(this).removeClass("focusField").addClass("idleField");
if ($.trim(this.value) === ''){
this.value = (this.defaultValue ? this.defaultValue : '');
}
});
"use strict";
if (!$elt) {
$elt = $('input[type="text"], input[type="password"]');
}
$elt.addClass("idleField");
$elt.focus(function () {
$(this).removeClass("idleField").addClass("focusField");
if (this.value === this.defaultValue) {
this.value = '';
}
if (this.value !== this.defaultValue) {
this.select();
}
});
$elt.blur(function () {
$(this).removeClass("focusField").addClass("idleField");
if ($.trim(this.value) === '') {
this.value = (this.defaultValue || '');
}
});
}
/*******************Bind remove all button*******************/
function bindRemove(){
$("a#removeSr").click(function(){
if(!window.confirm("Do you really want to remove all software release?")){
return false;
}
location.href = $SCRIPT_ROOT + '/removeSoftware';
});
$("a#removeIst").click(function(){
if(!window.confirm("Do you really want to remove all computer partition?")){
return false;
}
location.href = $SCRIPT_ROOT + '/removeInstance';
});
function bindRemove() {
"use strict";
$("a#removeSr").click(function () {
if (!window.confirm("Do you really want to remove all software release?")) {
return false;
}
window.location.href = $SCRIPT_ROOT + '/removeSoftware';
});
$("a#removeIst").click(function () {
if (!window.confirm("Do you really want to remove all computer partition?")) {
return false;
}
window.location.href = $SCRIPT_ROOT + '/removeInstance';
});
}
/**************************/
(function ($, document, window) {
"use strict";
$.extend($.fn, {
slideBox: function(state) {
if (!state) state = "hide";
var header = $("#"+$(this).attr('id')+">h2");
var box = $("#"+$(this).attr('id')+">div");
header.addClass(state);
if(state=="hide"){box.css('display', 'none');}
header.click(function(){
var state = box.css("display");
if (state == "none"){
box.slideDown("normal");
header.removeClass("hide");
header.addClass("show");
}
else{
box.slideUp("normal");
header.removeClass("show");
header.addClass("hide");
}
});
}
slideBox: function (state) {
if (!state) {
state = "hide";
}
var header = $("#" + $(this).attr('id') + ">h2"),
box = $("#" + $(this).attr('id') + ">div");
header.addClass(state);
if (state === "hide") {
box.css('display', 'none');
}
header.click(function () {
var state = box.css("display");
if (state === "none") {
box.slideDown("normal");
header.removeClass("hide");
header.addClass("show");
} else {
box.slideUp("normal");
header.removeClass("show");
header.addClass("hide");
}
});
}
});
}(jQuery, document, this));
\ No newline at end of file
}(jQuery, document, this));
/*jslint undef: true */
/*global document, escape, unescape */
/* vim: set et sts=4: */
/*Cookies Management*/
function setCookie(name,value,expires,path,domain,secure){
if (!expires){
var today = new Date();
expires = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000);
}
document.cookie = name + "=" + escape(value) +
"; expires=" + expires.toGMTString() +
((path) ? "; path=" + path : "/") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
function deleteCookie(name,path,domain) {
if (getCookie(name)) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "/") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
function setCookie(name, value, expires, path, domain, secure) {
"use strict";
if (!expires) {
var today = new Date();
expires = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000);
}
document.cookie = name + "=" + escape(value) +
"; expires=" + expires.toGMTString() +
((path) ? "; path=" + path : "/") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
function getCookie(name) {
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++){
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\s+|\s+$/g,"");
if (x==name){
var result = unescape(y);
if (result != "" && result != null){
return result;
}
return null;
"use strict";
var i,
x,
y,
result,
ARRcookies = document.cookie.split(";");
for (i = 0; i < ARRcookies.length; i += 1) {
x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
x = x.replace(/^\s+|\s+$/g, "");
if (x === name) {
result = unescape(y);
if (result !== "" && result !== null) {
return result;
}
return null;
}
}
return null;
}
function deleteCookie(name, path, domain) {
"use strict";
if (getCookie(name)) {
document.cookie = name + "=" +
(path ? "; path=" + path : "/") +
(domain ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}
return null;
}
/**************************/
$(document).ready( function() {
var editor = ace.edit("editor");
editor.setTheme("ace/theme/crimson_editor");
/*jslint undef: true */
/*global $, document, ace, $SCRIPT_ROOT */
/* vim: set et sts=4: */
var CurentMode = require("ace/mode/buildout").Mode;
editor.getSession().setMode(new CurentMode());
editor.getSession().setTabSize(2);
editor.getSession().setUseSoftTabs(true);
editor.renderer.setHScrollBarAlwaysVisible(false);
var file = $("input#profile").val();
var workdir = $("input#workdir").val();
var edit = false;
var send = false;
selectFile(file);
$(document).ready(function () {
"use strict";
$("#save").click(function(){
if(!edit){
$("#error").Popup("Can not load your file, please make sure that you have selected a Software Release", {type:'alert', duration:5000});
return false;
}
if (send) return;
send =true
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/saveFileContent',
data: {file: file, content: editor.getSession().getValue()},
success: function(data){
if(data.code == 1){
$("#error").Popup("File Saved!", {type:'confirm', duration:2000});
}
else{
$("#error").Popup(data.result, {type:'error', duration:5000});
}
send = false;
}
});
return false;
});
$("#getmd5").click(function(){
getmd5sum();
return false;
});
$("#adddevelop").click(function(){
var developList = new Array();
var i=0;
$("#plist li").each(function(index){
var elt = $(this).find("input:checkbox");
if (elt.is(":checked")){
developList[i] = workdir+"/"+elt.val();
i++;
elt.attr("checked", false);
}
});
if (developList.length > 0){setDevelop(developList);}
return false;
});
var editor, CurrentMode, file, workdir, edit, send;
function selectFile(file){
edit = false;
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/getFileContent',
data: "file=" + file,
success: function(data){
if(data.code == 1){
editor.getSession().setValue(data.result);
edit = true;
}
else{
$("#error").Popup("Can not load your file, please make sure that you have selected a Software Release", {type:'alert', duration:5000});
}
}
});
return;
}
function selectFile(file) {
edit = false;
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/getFileContent',
data: "file=" + file,
success: function (data) {
if (data.code === 1) {
editor.getSession().setValue(data.result);
edit = true;
} else {
$("#error").Popup("Can not load your file, please make sure that you have selected a Software Release",
{type: 'alert', duration: 5000});
}
}
});
return;
}
function getmd5sum(){
if (send) return;
send =true
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/getmd5sum',
data: {file: file},
success: function(data){
if(data.code == 1){
$("#md5sum").empty();
$("#md5sum").append('md5sum : <span>' + data.result + '</span>');
}
else{
$("#error").Popup(data.result, {type:'error', duration:5000});
}
send = false;
}
});
}
function setDevelop(developList){
if (developList==null || developList.length <= 0) return;
editor.navigateFileStart();
editor.find('buildout',{caseSensitive: true,wholeWord: true});
if(!editor.getSelectionRange().isEmpty()){
//editor.find("",{caseSensitive: true,wholeWord: true,regExp: true});
//if(!editor.getSelectionRange().isEmpty()){
//alert("found");
//}
//else{alert("no found");
//}
}
else{
$("#error").Popup("Can not found part [buildout]! Please make sure that you have a cfg file", {type:'alert', duration:3000});
return;
}
editor.navigateLineEnd();
$.post($SCRIPT_ROOT+"/getPath", {file:developList.join("#")}, function(data) {
if(data.code==1){
var result = data.result.split('#');
editor.insert("\ndevelop =\n\t" + result[0] + "\n");
for(var i=1; i<result.length; i++)
editor.insert("\t" + result[i] + "\n");
}
})
.error(function() { })
.complete(function(){});
editor.insert("\n");
}
});
\ No newline at end of file
function getmd5sum() {
if (send) {
return;
}
send = true;
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/getmd5sum',
data: {file: file},
success: function (data) {
if (data.code === 1) {
$("#md5sum").empty();
$("#md5sum").append('md5sum : <span>' + data.result + '</span>');
} else {
$("#error").Popup(data.result, {type: 'error', duration: 5000});
}
send = false;
}
});
}
function setDevelop(developList) {
if (developList === null || developList.length <= 0) {
return;
}
editor.navigateFileStart();
editor.find('buildout', {caseSensitive: true, wholeWord: true});
if (editor.getSelectionRange().isEmpty()) {
$("#error").Popup("Can not found part [buildout]! Please make sure that you have a cfg file",
{type: 'alert', duration: 3000});
return;
}
//else {
// //editor.find("",{caseSensitive: true,wholeWord: true,regExp: true});
// //if (!editor.getSelectionRange().isEmpty()) {
// //alert("found");
// //}
// //else{alert("no found");
// //}
//}
editor.navigateLineEnd();
$.post($SCRIPT_ROOT + "/getPath", {file: developList.join("#")}, function (data) {
if (data.code === 1) {
var i,
result = data.result.split('#');
editor.insert("\ndevelop =\n\t" + result[0] + "\n");
for (i = 1; i < result.length; i += 1) {
editor.insert("\t" + result[i] + "\n");
}
}
})
.error(function () { })
.complete(function () {});
editor.insert("\n");
}
editor = ace.edit("editor");
CurrentMode = require("ace/mode/buildout").Mode;
file = $("input#profile").val();
workdir = $("input#workdir").val();
edit = false;
send = false;
editor.setTheme("ace/theme/crimson_editor");
editor.getSession().setMode(new CurrentMode());
editor.getSession().setTabSize(2);
editor.getSession().setUseSoftTabs(true);
editor.renderer.setHScrollBarAlwaysVisible(false);
selectFile(file);
$("#save").click(function () {
if (!edit) {
$("#error").Popup("Can not load your file, please make sure that you have selected a Software Release",
{type: 'alert', duration: 5000});
return false;
}
if (send) {
return;
}
send = true;
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/saveFileContent',
data: {file: file, content: editor.getSession().getValue()},
success: function (data) {
if (data.code === 1) {
$("#error").Popup("File Saved!", {type: 'confirm', duration: 2000});
} else {
$("#error").Popup(data.result, {type: 'error', duration: 5000});
}
send = false;
}
});
return false;
});
$("#getmd5").click(function () {
getmd5sum();
return false;
});
$("#adddevelop").click(function () {
var developList = [],
i = 0;
$("#plist li").each(function (index) {
var elt = $(this).find("input:checkbox");
if (elt.is(":checked")) {
developList[i] = workdir + "/" + elt.val();
i += 1;
elt.attr("checked", false);
}
});
if (developList.length > 0) {
setDevelop(developList);
}
return false;
});
});
$(document).ready( function() {
var send = false;
var cloneRequest;
$('#fileNavigator').gsFileManager({ script: $SCRIPT_ROOT+"/fileBrowser", root: "workspace/"});
configRadio();
$("input#nothing").change(function(){
configRadio();
});
$("input#ssh").change(function(){
configRadio();
});
$("input#https").change(function(){
configRadio();
});
$("#clone").click(function(){
if(send){
cloneRequest.abort();
$("#imgwaitting").fadeOut('normal');
$("#clone").empty();
$("#clone").append("Clone");
send = false;
return;
}
var repo_url = $("input#repo").val();
var email = "";
var name = "";
/* /^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/ */
if($("input#repo").val() === '' || !repo_url.match(/^[\w\d\.\/:~@_-]+$/)){
$("#error").Popup("Invalid url for the repository", {type:'alert', duration:3000});
return false;
}
if($("input#name").val() === '' || !$("input#name").val().match(/^[\w\d\._-]+$/)){
$("#error").Popup("Invalid project name", {type:'alert', duration:3000});
return false;
}
if($("input#user").val() !== ""){
name = $("input#user").val();
}
if($("input#email").val() !== '' && $("input#email").val() !== "Enter your email adress..."){
if(!$("input#email").val().match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)){
$("#error").Popup("Please enter a valid email adress!", {type:'alert', duration:3000});
return false;
}
email = $("input#email").val();
}
if($("input#https").is(':checked')){
if($("input#username").val() == "" || !$("input#username").val().match(/^[\w\d\._-]+$/)){
$("#error").Popup("Please enter a correct username", {type:'alert', duration:3000});
return false;
}
if($("input#password").val() != ""){
if(repo_url.indexOf("https://") != -1){
repo_url = "https://" + $("input#username").val() +
":" + $("input#password").val() +
"@" + repo_url.substring(8);
}
else{
$("#error").Popup("The URL of your repository should start with 'https://'", {type:'alert', duration:3000});
return false;
}
}
else{
$("#error").Popup("Please enter your password", {type:'alert', duration:3000});
return false;
}
}
else if(repo_url.indexOf("https://") != -1){
$("#error").Popup("Please select HTTPS Security Mode for this repository", {type:'alert', duration:3000});
return false;
}
$("#imgwaitting").fadeIn('normal');
$("#clone").empty();
$("#clone").append("Stop");
send = true;
cloneRequest = $.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/cloneRepository',
data: {repo: repo_url, name: ($("input#workdir").val() + "/" +
$("input#name").val()), email:email,
user:name},
success: function(data){
if(data.code == 1){
$("#file_navigation").fadeIn('normal');
$("#error").Popup("Your repository is cloned!", {type:'confirm', duration:3000});
$("input#repo").val("Enter the url of your repository...");
$("input#name").val("Enter the project name...");
$('#fileNavigator').gsFileManager({ script: $SCRIPT_ROOT+"/fileBrowser", root: "workspace/"});
}
else{
$("#error").Popup(data.result, {type:'error'});
}
$("#imgwaitting").hide();
$("#clone").empty();
$("#clone").append("Clone");
send = false;
},
error: function(request,error) {
$("#error").Popup("unable to clone your project, please check your internet connection", {type:'error', duration:3000});
$("#imgwaitting").hide();
/*jslint undef: true */
/*global $, document, $SCRIPT_ROOT */
/* vim: set et sts=4: */
$(document).ready(function () {
"use strict";
function configRadio() {
$("#modelist li").each(function (index) {
var boxselector = "#box" + index;
if ($(this).hasClass('checked')) {
$(this).removeClass('checked');
$(boxselector).slideUp("normal");
}
if ($(this).find("input:radio").is(':checked')) {
$(this).addClass('checked');
//change content here
$(boxselector).slideDown("normal");
}
if (index !== 2) {
$("input#password").val("");
$("input#cpassword").val("");
}
});
}
var send = false,
cloneRequest;
$('#fileNavigator').gsFileManager({ script: $SCRIPT_ROOT + "/fileBrowser", root: "workspace/"});
configRadio();
$("input#nothing").change(function () {
configRadio();
});
$("input#ssh").change(function () {
configRadio();
});
$("input#https").change(function () {
configRadio();
});
$("#clone").click(function () {
if (send) {
cloneRequest.abort();
$("#imgwaitting").fadeOut('normal');
$("#clone").empty();
$("#clone").append("Clone");
send = false;
return;
}
var repo_url = $("input#repo").val(),
email = "",
name = "";
/* /^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/ */
if ($("input#repo").val() === '' || !repo_url.match(/^[\w\d\.\/:~@_\-]+$/)) {
$("#error").Popup("Invalid url for the repository", {type: 'alert', duration: 3000});
return false;
}
if ($("input#name").val() === '' || !$("input#name").val().match(/^[\w\d\._\-]+$/)) {
$("#error").Popup("Invalid project name", {type: 'alert', duration: 3000});
return false;
}
if ($("input#user").val() !== "") {
name = $("input#user").val();
}
if ($("input#email").val() !== '' && $("input#email").val() !== "Enter your email adress...") {
if (!$("input#email").val().match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)) {
$("#error").Popup("Please enter a valid email adress!", {type: 'alert', duration: 3000});
return false;
}
email = $("input#email").val();
}
if ($("input#https").is(':checked')) {
if ($("input#username").val() === "" || !$("input#username").val().match(/^[\w\d\._\-]+$/)) {
$("#error").Popup("Please enter a correct username", {type: 'alert', duration: 3000});
return false;
}
if ($("input#password").val() !== "") {
if (repo_url.indexOf("https://") !== -1) {
repo_url = "https://" + $("input#username").val() +
":" + $("input#password").val() +
"@" + repo_url.substring(8);
} else {
$("#error").Popup("The URL of your repository should start with 'https://'", {type: 'alert', duration: 3000});
return false;
}
} else {
$("#error").Popup("Please enter your password", {type: 'alert', duration: 3000});
return false;
}
} else if (repo_url.indexOf("https://") !== -1) {
$("#error").Popup("Please select HTTPS Security Mode for this repository", {type: 'alert', duration: 3000});
return false;
}
$("#imgwaitting").fadeIn('normal');
$("#clone").empty();
$("#clone").append("Clone");
}
});
return false;
});
function configRadio(){
$("#modelist li").each(function(index) {
var boxselector = "#box" + index;
if($(this).hasClass('checked')){
$(this).removeClass('checked');
$(boxselector).slideUp("normal");
}
if($(this).find("input:radio").is(':checked')){
$(this).addClass('checked');
//change content here
$(boxselector).slideDown("normal");
}
if(index != 2){
$("input#password").val("");
$("input#cpassword").val("");
}
});
}
$("#clone").append("Stop");
send = true;
cloneRequest = $.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/cloneRepository',
data: {
repo: repo_url,
name: $("input#workdir").val() + "/" + $("input#name").val(),
email: email,
user: name
},
success: function (data) {
if (data.code === 1) {
$("#file_navigation").fadeIn('normal');
$("#error").Popup("Your repository is cloned!", {type: 'confirm', duration: 3000});
$("input#repo").val("Enter the url of your repository...");
$("input#name").val("Enter the project name...");
$('#fileNavigator').gsFileManager({ script: $SCRIPT_ROOT + "/fileBrowser", root: "workspace/"});
} else {
$("#error").Popup(data.result, {type: 'error'});
}
$("#imgwaitting").hide();
$("#clone").empty();
$("#clone").append("Clone");
send = false;
},
error: function (request, error) {
$("#error").Popup("unable to clone your project, please check your internet connection", {type: 'error', duration: 3000});
$("#imgwaitting").hide();
$("#clone").empty();
$("#clone").append("Clone");
}
});
return false;
});
function selectFile(file){
//nothing
return;
}
});
\ No newline at end of file
function selectFile(file) {
//nothing
return;
}
});
$(document).ready( function() {
var editor;
var send = false;
var runnerDir = $("input#runnerdir").val();
$("#reloadfiles").click(function(){
fillContent();
});
fillContent();
/*jslint undef: true */
/*global $, document, window, $SCRIPT_ROOT, ace */
/* vim: set et sts=4: */
function fillContent(){
$('#fileNavigator').gsFileManager({ script: $SCRIPT_ROOT+"/fileBrowser", root: runnerDir});
}
$("#open").click(function(){
var elt = $("option:selected", $("#softwarelist"));
if(elt.val() === "No Software Release found"){
$("#error").Popup("Please select your Software Release", {type:'alert', duration:5000});
return false;
$(document).ready(function () {
"use strict";
var editor,
send = false,
runnerDir = $("input#runnerdir").val();
function fillContent() {
$('#fileNavigator').gsFileManager({script: $SCRIPT_ROOT + "/fileBrowser", root: runnerDir});
}
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/setCurrentProject',
data: "path=" + elt.attr('rel'),
success: function(data){
if(data.code == 1){
location.href = $SCRIPT_ROOT + '/editSoftwareProfile'
}
else{
$("#error").Popup(data.result, {type:'error', duration:5000});
}
}
});
return false;
});
$("#delete").click(function(){
if($("#softwarelist").val() === "No Software Release found"){
$("#error").Popup("Please select your Software Release", {type:'alert', duration:5000});
$("#reloadfiles").click(function () {
fillContent();
});
fillContent();
$("#open").click(function () {
var elt = $("option:selected", $("#softwarelist"));
if (elt.val() === "No Software Release found") {
$("#error").Popup("Please select your Software Release", {type: 'alert', duration: 5000});
return false;
}
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/setCurrentProject',
data: "path=" + elt.attr('rel'),
success: function (data) {
if (data.code === 1) {
window.location.href = $SCRIPT_ROOT + '/editSoftwareProfile';
} else {
$("#error").Popup(data.result, {type: 'error', duration: 5000});
}
}
});
return false;
}
if(send) return;
if(!window.confirm("Do you really want to delete this software release?")){
return;
}
send = false;
var elt = $("option:selected", $("#softwarelist"));
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/removeSoftwareDir',
data: {md5:$("#softwarelist").val(), title:elt.attr('title')},
success: function(data){
if(data.code == 1){
$("#softwarelist").empty();
for(var i=0; i<data.result.length; i++){
$("#softwarelist").append('<option value="' + data.result[i]['md5'] +
'" title="' + data.result[i]['title'] +'" rel="' +
data.result[i]['path'] +'">' + data.result[i]['title'] + '</option>');
}
if(data.result.length < 1){
$("#softwarelist").append('<option>No Software Release found</option>');
$('#fileTree').empty();
}
fillContent();
$("#error").Popup("Operation complete, Selected Software Release has been delete!", {type:'confirm', duration:5000});
}
else{
$("#error").Popup(data.result, {type:'error'});
}
send = false;
}
});
return false;
});
});
function setupEditor(){
editor = ace.edit("editor");
editor.setTheme("ace/theme/crimson_editor");
$("#delete").click(function () {
if ($("#softwarelist").val() === "No Software Release found") {
$("#error").Popup("Please select your Software Release", {type: 'alert', duration: 5000});
return false;
}
if (send) {
return;
}
if (!window.confirm("Do you really want to delete this software release?")) {
return;
}
send = false;
var elt = $("option:selected", $("#softwarelist"));
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/removeSoftwareDir',
data: {
md5: $("#softwarelist").val(),
title: elt.attr('title')
},
success: function (data) {
var i;
if (data.code === 1) {
$("#softwarelist").empty();
for (i = 0; i < data.result.length; i += 1) {
$("#softwarelist").append('<option value="' + data.result[i].md5 +
'" title="' + data.result[i].title + '" rel="' +
data.result[i].path + '">' + data.result[i].title + '</option>');
}
if (data.result.length < 1) {
$("#softwarelist").append('<option>No Software Release found</option>');
$('#fileTree').empty();
}
fillContent();
$("#error").Popup("Operation complete, Selected Software Release has been delete!",
{type: 'confirm', duration: 5000});
} else {
$("#error").Popup(data.result, {type: 'error'});
}
send = false;
}
});
return false;
});
var CurentMode = require("ace/mode/text").Mode;
editor.getSession().setMode(new CurentMode());
editor.getSession().setTabSize(2);
editor.getSession().setUseSoftTabs(true);
editor.renderer.setHScrollBarAlwaysVisible(false);
editor.setReadOnly(true);
}
});
\ No newline at end of file
function setupEditor() {
editor = ace.edit("editor");
editor.setTheme("ace/theme/crimson_editor");
var CurentMode = require("ace/mode/text").Mode;
editor.getSession().setMode(new CurentMode());
editor.getSession().setTabSize(2);
editor.getSession().setUseSoftTabs(true);
editor.renderer.setHScrollBarAlwaysVisible(false);
editor.setReadOnly(true);
}
});
$(document).ready( function() {
var send = false;
//change background
$("body").css("background", "#9C9C9C");
$("#login").click(function(){
if (send) return false;
if($("input#clogin").val() === "" || !$("input#clogin").val().match(/^[\w\d\.-]+$/)){
$("#error").Popup("Please enter a valid user name", {type:'alert', duration:3000});
return false;
}
if($("input#cpwd").val() === "" || $("input#cpwd").val() ==="******"){
$("#error").Popup("Please enter your password", {type:'alert', duration:3000});
return false;
}
send = true;
var param = {clogin:$("input#clogin").val(), cpwd:$("input#cpwd").val()};
var url = $SCRIPT_ROOT + "/doLogin";
$("#login").removeClass("button").addClass("dsblebutton");
$.post(url, param, function(data) {
if (data.code==1){
location.href = $SCRIPT_ROOT + '/';
}
else{
$("#error").Popup(data.result, {type:'alert', duration:3000});
}
})
.error(function() {
$("#error").Popup("Cannot send your account identifier please try again!!",
{type:'alert', duration:3000});})
.complete(function() {
$("#login").removeClass('dsblebutton').addClass('button');
send = false;
/*jslint undef: true */
/*global $, document, window, $SCRIPT_ROOT */
/* vim: set et sts=4: */
$(document).ready(function () {
"use strict";
var send = false;
//change background
$("body").css("background", "#9C9C9C");
$("#login").click(function () {
if (send) {
return false;
}
if ($("input#clogin").val() === "" || !$("input#clogin").val().match(/^[\w\d\.\-]+$/)) {
$("#error").Popup("Please enter a valid user name", {type: 'alert', duration: 3000});
return false;
}
if ($("input#cpwd").val() === "" || $("input#cpwd").val() === "******") {
$("#error").Popup("Please enter your password", {type: 'alert', duration: 3000});
return false;
}
send = true;
var param = { clogin: $("input#clogin").val(), cpwd: $("input#cpwd").val() },
url = $SCRIPT_ROOT + "/doLogin";
$("#login").removeClass("button").addClass("dsblebutton");
$.post(url, param, function (data) {
if (data.code === 1) {
window.location.href = $SCRIPT_ROOT + '/';
} else {
$("#error").Popup(data.result, {type: 'alert', duration: 3000});
}
})
.error(function () {
$("#error").Popup("Cannot send your account identifier please try again!!",
{type: 'alert', duration: 3000});
})
.complete(function () {
$("#login").removeClass('dsblebutton').addClass('button');
send = false;
});
return false;
});
return false;
});
});
\ No newline at end of file
});
This diff is collapsed.
$(document).ready( function() {
var method = $("input#method").val();
var workdir = $("input#workdir").val();
if (method != "file"){
script = "/openFolder";
$('#fileTree').fileTree({ root: workdir, script: $SCRIPT_ROOT + script, folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function(file) {
selectFile(file);
});
}
$("input#subfolder").val("");
$("#create").click(function(){
repo_url = $("input#software").val();
if($("input#software").val() == "" || !$("input#software").val().match(/^[\w\d._-]+$/)){
$("#error").Popup("Invalid Software name", {type:'alert', duration:3000})
return false;
}
if($("input#subfolder").val() == ""){
$("#error").Popup("Select the parent folder of your software!", {type:'alert', duration:3000})
return false;
}
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/createSoftware',
data: "folder=" + $("input#subfolder").val() + $("input#software").val(),
success: function(data){
if(data.code == 1){
location.href = $SCRIPT_ROOT + '/editSoftwareProfile'
}
else{
$("#error").Popup(data.result, {type:'error', duration:5000})
}
}
});
return false;
});
$("#open").click(function(){
$("#flash").fadeOut('normal');
$("#flash").empty();
$("#flash").fadeIn('normal');
if($("input#path").val() == ""){
$("#error").Popup("Select a valid Software Release folder!", {type:'alert', duration:3000})
return false;
}
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/setCurrentProject',
data: "path=" + $("input#path").val(),
success: function(data){
if(data.code == 1){
location.href = $SCRIPT_ROOT + '/editSoftwareProfile'
}
else{
$("#error").Popup(data.result, {type:'error', duration:5000})
}
}
});
return false;
});
function selectFile(file){
$("#info").empty();
$("input#subfolder").val(file);
path = "";
if(method == "open"){
$("#info").append("Selection: " + file);
checkFolder(file);
}
else{
if($("input#software").val() != "" && $("input#software").val().match(/^[\w\d._-]+$/)){
$("#info").append("New Software in: " + file + $("input#software").val());
}
else{
$("#info").append("Selection: " + file);
}
}
return;
}
function checkFolder(path){
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/checkFolder',
data: "path=" + path,
success: function(data){
var path = data.result;
$("input#path").val(path);
if (path != ""){
$("#check").fadeIn('normal');
}
else{
$("#check").hide();
}
}
});
return "";
}
});
\ No newline at end of file
/*jslint undef: true */
/*global $, document, window, $SCRIPT_ROOT */
/* vim: set et sts=4: */
$(document).ready(function () {
"use strict";
var method = $("input#method").val(),
workdir = $("input#workdir").val();
function checkFolder(path) {
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/checkFolder',
data: "path=" + path,
success: function (data) {
var path = data.result;
$("input#path").val(path);
if (path !== "") {
$("#check").fadeIn('normal');
} else {
$("#check").hide();
}
}
});
return "";
}
function selectFile(file) {
$("#info").empty();
$("input#subfolder").val(file);
if (method === "open") {
$("#info").append("Selection: " + file);
checkFolder(file);
} else {
if ($("input#software").val() !== "" && $("input#software").val().match(/^[\w\d._\-]+$/)) {
$("#info").append("New Software in: " + file + $("input#software").val());
} else {
$("#info").append("Selection: " + file);
}
}
return;
}
if (method !== "file") {
$('#fileTree').fileTree({root: workdir, script: $SCRIPT_ROOT + '/openFolder', folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function (file) {
selectFile(file);
});
}
$("input#subfolder").val("");
$("#create").click(function () {
if ($("input#software").val() === "" || !$("input#software").val().match(/^[\w\d._\-]+$/)) {
$("#error").Popup("Invalid Software name", {type: 'alert', duration: 3000});
return false;
}
if ($("input#subfolder").val() === "") {
$("#error").Popup("Select the parent folder of your software!", {type: 'alert', duration: 3000});
return false;
}
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/createSoftware',
data: "folder=" + $("input#subfolder").val() + $("input#software").val(),
success: function (data) {
if (data.code === 1) {
window.location.href = $SCRIPT_ROOT + '/editSoftwareProfile';
} else {
$("#error").Popup(data.result, {type: 'error', duration: 5000});
}
}
});
return false;
});
$("#open").click(function () {
$("#flash").fadeOut('normal');
$("#flash").empty();
$("#flash").fadeIn('normal');
if ($("input#path").val() === "") {
$("#error").Popup("Select a valid Software Release folder!", {type: 'alert', duration: 3000});
return false;
}
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/setCurrentProject',
data: "path=" + $("input#path").val(),
success: function (data) {
if (data.code === 1) {
window.location.href = $SCRIPT_ROOT + '/editSoftwareProfile';
} else {
$("#error").Popup(data.result, {type: 'error', duration: 5000});
}
}
});
return false;
});
});
This diff is collapsed.
$(document).ready( function() {
openedlogpage = $("input#type").val();
updatelogBox();
var state = getCookie("autoUpdate");
$("#logheader").click(function(){
setupBox();
});
$("#manual").change(function(){
setCookie("autoUpdate", "manual");
if ($("input#type").val() == "instance"){location.href = $SCRIPT_ROOT + "/viewInstanceLog";}
else{location.href = $SCRIPT_ROOT + "/viewSoftwareLog";}
});
$("#live").change(function(){
updatelogBox();$("#logconfigbox").find("input:radio").attr('checked', false);$("#live").attr('checked', true);
setSpeed(100);setCookie("autoUpdate", "live");openedlogpage = $("input#type").val();});
$("#slow").change(function(){
updatelogBox();$("#logconfigbox").find("input:radio").attr('checked', false);$("#slow").attr('checked', true);
setSpeed(2500);setCookie("autoUpdate", "slow");openedlogpage = $("input#type").val();});
if(state){
$("#"+state).attr('checked', true);
updatelogBox();
if (state == "manual"){
openedlogpage = ""; setSpeed(0);
}
else{setSpeed((state=="live")?100:2500);}
}
else{$("#slow").attr('checked', true);}
function setupBox(){
var state = $("#logconfigbox").css("display");
if (state == "none"){
$("#logconfigbox").slideDown("normal");
$("#logheader").removeClass("hide");
$("#logheader").addClass("show");
}
else{
$("#logconfigbox").slideUp("normal");
$("#logheader").removeClass("show");
$("#logheader").addClass("hide");
/*jslint undef: true */
/*global $, document, window, processState, getCookie, setCookie, setSpeed, $SCRIPT_ROOT */
/*global openedlogpage: true */
/* vim: set et sts=4: */
$(document).ready(function () {
"use strict";
function setupBox() {
var state = $("#logconfigbox").css("display");
if (state === "none") {
$("#logconfigbox").slideDown("normal");
$("#logheader").removeClass("hide");
$("#logheader").addClass("show");
} else {
$("#logconfigbox").slideUp("normal");
$("#logheader").removeClass("show");
$("#logheader").addClass("hide");
}
}
}
function updatelogBox(){
if(processState=="Stopped" || processState=="Checking" || $("#manual").is(":checked")){
$("#salpgridLog").hide();
$("#manualLog").show();
$("#manualLog")
.scrollTop($("#manualLog")[0].scrollHeight - $("#manualLog")
.height());
function updatelogBox() {
if (processState === "Stopped" || processState === "Checking" || $("#manual").is(":checked")) {
$("#salpgridLog").hide();
$("#manualLog").show();
$("#manualLog")
.scrollTop($("#manualLog")[0].scrollHeight - $("#manualLog").height());
} else {
$("#salpgridLog").show();
$("#manualLog").hide();
}
}
else{
$("#salpgridLog").show();
$("#manualLog").hide();
openedlogpage = $("input#type").val();
updatelogBox();
var state = getCookie("autoUpdate");
$("#logheader").click(function () {
setupBox();
});
$("#manual").change(function () {
setCookie("autoUpdate", "manual");
if ($("input#type").val() === "instance") {
window.location.href = $SCRIPT_ROOT + "/viewInstanceLog";
} else {
window.location.href = $SCRIPT_ROOT + "/viewSoftwareLog";
}
});
$("#live").change(function () {
updatelogBox();
$("#logconfigbox").find("input:radio").attr('checked', false);
$("#live").attr('checked', true);
setSpeed(100);
setCookie("autoUpdate", "live");
openedlogpage = $("input#type").val();
});
$("#slow").change(function () {
updatelogBox();
$("#logconfigbox").find("input:radio").attr('checked', false);
$("#slow").attr('checked', true);
setSpeed(2500);
setCookie("autoUpdate", "slow");
openedlogpage = $("input#type").val();
});
if (state) {
$("#" + state).attr('checked', true);
updatelogBox();
if (state === "manual") {
openedlogpage = "";
setSpeed(0);
} else {
setSpeed((state === "live") ? 100 : 2500);
}
} else {
$("#slow").attr('checked', true);
}
}
});
\ No newline at end of file
});
......@@ -26,7 +26,7 @@ class NetworkcacheParser(OptionParser):
"""
def __init__(self, usage=None, version=None):
"""
Initialize all options possibles.
Initialize all possible options.
"""
OptionParser.__init__(self, usage=usage, version=version,
option_list=[
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment