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): ...@@ -16,7 +16,7 @@ class Parser(OptionParser):
""" """
def __init__(self, usage=None, version=None): def __init__(self, usage=None, version=None):
""" """
Initialize all options possibles. Initialize all possible options.
""" """
OptionParser.__init__(self, usage=usage, version=version, OptionParser.__init__(self, usage=usage, version=version,
option_list=[ option_list=[
......
$(document).ready(function(){ $(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 hashes = window.location.href.split('#');
var fromheight = 0; var fromheight = 0;
var previoustab = null; var previoustab = null;
...@@ -18,17 +18,17 @@ $(document).ready(function(){ ...@@ -18,17 +18,17 @@ $(document).ready(function(){
}); });
} }
else{$(".tabContents:first").show(); previoustab = ".tabContents:first";} // Show the first div of tab content by default 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 $("#tabContaier ul li a").click(function(){ //Fire the click event
if($(this).hasClass('active')){ if($(this).hasClass('active')){
return false; return false;
} }
fromheight = $(previoustab).height(); 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 .tabDetails").css("height", $("#tabContaier .tabDetails").height());
$("#tabContaier ul li a").removeClass("active"); // Remove pre-highlighted link $("#tabContaier ul li a").removeClass("active"); // Remove pre-highlighted link
$(this).addClass("active"); // set clicked link to highlight state $(this).addClass("active"); // set clicked link to highlight state
$(".tabContents").hide(); // hide currently visible tab content div $(".tabContents").hide(); // hide currently visible tab content div
$(activeTab).fadeIn(); // show the target tab content div by matching clicked link. $(activeTab).fadeIn(); // show the target tab content div by matching clicked link.
var diff = fromheight - $(activeTab).height(); var diff = fromheight - $(activeTab).height();
if (diff > 0){$("#tabContaier .tabDetails").animate({height: '-=' + diff + 'px'}, 850, 'swing', function() { if (diff > 0){$("#tabContaier .tabDetails").animate({height: '-=' + diff + 'px'}, 850, 'swing', function() {
$("#tabContaier .tabDetails").css("height", ""); $("#tabContaier .tabDetails").css("height", "");
...@@ -39,5 +39,5 @@ $(document).ready(function(){ ...@@ -39,5 +39,5 @@ $(document).ready(function(){
previoustab = activeTab; previoustab = activeTab;
$("#tabContaier .tabDetails").css("height", $("#tabContaier .tabDetails").height()); $("#tabContaier .tabDetails").css("height", $("#tabContaier .tabDetails").height());
return false;//this reinitialize tab index when reload page return false;//this reinitialize tab index when reload page
}); });
}); });
\ No newline at end of file
...@@ -30,43 +30,43 @@ ...@@ -30,43 +30,43 @@
$box.show(); $box.show();
$box.append('<div><table id="bcontent"><tr>' + $box.append('<div><table id="bcontent"><tr>' +
'<td valign="middle" class="logo ' + option.type + '_message"></td>' + '<td valign="middle" class="logo ' + option.type + '_message"></td>' +
'<td valign="middle"><p>' + msg + '</p></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" class="b_close"><span id="pClose"></span></td></tr></table></div>');
$(window).scroll(function(){ $(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; h = $("#bcontent").height()+5;
$("#pClose").bind("click", function() { $("#pClose").bind("click", function() {
close(); close();
}); });
showBox(); showBox();
if(option.duration != 0){ if(option.duration != 0){
showDelayTimer = setTimeout(function(){ showDelayTimer = setTimeout(function(){
showDelayTimer = null; showDelayTimer = null;
close(); close();
}, option.duration); }, option.duration);
} }
} }
function showBox(){ function showBox(){
if(option.load){ if(option.load){
$(window).load(function(){ $(window).load(function(){
$box.css('top', + ($(window).scrollTop() - h) +'px'); $box.css('top', + ($(window).scrollTop() - h) +'px');
$box.animate({ top:"+=" + h + "px" }, "slow"); $box.animate({ top:"+=" + h + "px" }, "slow");
isShow = true; isShow = true;
}); });
} }
else{ else{
$box.css('top', + ($(window).scrollTop() - h) +'px'); $box.css('top', + ($(window).scrollTop() - h) +'px');
$box.animate({ top:"+=" + h + "px" }, "slow"); $box.animate({ top:"+=" + h + "px" }, "slow");
isShow = true; isShow = true;
} }
} }
function close(){ function close(){
$box.animate({ top:"-=" + h + "px" }, "slow", function(){ $box.animate({ top:"-=" + h + "px" }, "slow", function(){
$box.fadeOut("normal", function() { $box.fadeOut("normal", function() {
isShow = false; isShow = false;
}); });
}); });
} }
} }
}); });
......
$(document).ready( function() { /*jslint undef: true */
var send = false; /*global $, document, window, $SCRIPT_ROOT */
$("#update").click(function(){ /* vim: set et sts=4: */
var haspwd = false;
var hasAccount = !($("input#hasAccount").val() === ""); $(document).ready(function () {
if($("input#username").val() === "" || !$("input#username").val().match(/^[\w\d\._-]+$/)){ "use strict";
$("#error").Popup("Invalid user name. Please check it!", {type:'alert', duration:3000}); var send = false;
return false; $("#update").click(function () {
} var haspwd = false,
else if ($("input#username").val().length <6){ hasAccount = ($("input#hasAccount").val() !== "");
$("#error").Popup("Username must have at least 6 characters", {type:'alert', duration:3000}); if ($("input#username").val() === "" || !$("input#username").val().match(/^[\w\d\._\-]+$/)) {
return false; $("#error").Popup("Invalid user name. Please check it!", {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+"/"
} }
else{ if ($("input#username").val().length < 6) {
$("#error").Popup(data.result, {type:'error', duration:5000}); $("#error").Popup("Username must have at least 6 characters", {type: 'alert', duration: 3000});
return false;
} }
send = false; if ($("input#name").val() === "") {
}, $("#error").Popup("Please enter your name and surname!", {type: 'alert', duration: 3000});
error:function(){send = false;} 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*/ /*Common javascript function*/
String.prototype.toHtmlChar = function(){ String.prototype.toHtmlChar = function () {
var c = {'<':'&lt;', '>':'&gt;', '&':'&amp;', '"':'&quot;', "'":'&#039;', "use strict";
'#':'&#035;' }; var c = {
return this.replace( /[<&>'"#]/g, function(s) { return c[s]; } ); '<': '&lt;',
'>': '&gt;',
'&': '&amp;',
'"': '&quot;',
"'": '&#039;',
'#': '&#035;'
};
return this.replace(/[<&>'"#]/g, function (s) { return c[s]; });
}; };
String.prototype.trim = function () { String.prototype.trim = function () {
"use strict";
return this.replace(/^\s*/, "").replace(/\s*$/, ""); return this.replace(/^\s*/, "").replace(/\s*$/, "");
}; };
/****************************************/ /****************************************/
function setInput($elt) { function setInput($elt) {
if(!$elt){$elt = $('input[type="text"], input[type="password"]');} "use strict";
$elt.addClass("idleField"); if (!$elt) {
$elt.focus(function() { $elt = $('input[type="text"], input[type="password"]');
$(this).removeClass("idleField").addClass("focusField"); }
if (this.value == this.defaultValue){ $elt.addClass("idleField");
this.value = ''; $elt.focus(function () {
} $(this).removeClass("idleField").addClass("focusField");
if(this.value != this.defaultValue){ if (this.value === this.defaultValue) {
this.select(); this.value = '';
} }
}); if (this.value !== this.defaultValue) {
$elt.blur(function() { this.select();
$(this).removeClass("focusField").addClass("idleField"); }
if ($.trim(this.value) === ''){ });
this.value = (this.defaultValue ? this.defaultValue : ''); $elt.blur(function () {
} $(this).removeClass("focusField").addClass("idleField");
}); if ($.trim(this.value) === '') {
this.value = (this.defaultValue || '');
}
});
} }
/*******************Bind remove all button*******************/ /*******************Bind remove all button*******************/
function bindRemove(){ function bindRemove() {
$("a#removeSr").click(function(){ "use strict";
if(!window.confirm("Do you really want to remove all software release?")){ $("a#removeSr").click(function () {
return false; if (!window.confirm("Do you really want to remove all software release?")) {
} return false;
location.href = $SCRIPT_ROOT + '/removeSoftware'; }
}); window.location.href = $SCRIPT_ROOT + '/removeSoftware';
$("a#removeIst").click(function(){ });
if(!window.confirm("Do you really want to remove all computer partition?")){ $("a#removeIst").click(function () {
return false; if (!window.confirm("Do you really want to remove all computer partition?")) {
} return false;
location.href = $SCRIPT_ROOT + '/removeInstance'; }
}); window.location.href = $SCRIPT_ROOT + '/removeInstance';
});
} }
/**************************/ /**************************/
(function ($, document, window) { (function ($, document, window) {
"use strict";
$.extend($.fn, { $.extend($.fn, {
slideBox: function(state) { slideBox: function (state) {
if (!state) state = "hide"; if (!state) {
var header = $("#"+$(this).attr('id')+">h2"); state = "hide";
var box = $("#"+$(this).attr('id')+">div"); }
header.addClass(state); var header = $("#" + $(this).attr('id') + ">h2"),
if(state=="hide"){box.css('display', 'none');} box = $("#" + $(this).attr('id') + ">div");
header.click(function(){ header.addClass(state);
var state = box.css("display"); if (state === "hide") {
if (state == "none"){ box.css('display', 'none');
box.slideDown("normal"); }
header.removeClass("hide"); header.click(function () {
header.addClass("show"); var state = box.css("display");
} if (state === "none") {
else{ box.slideDown("normal");
box.slideUp("normal"); header.removeClass("hide");
header.removeClass("show"); header.addClass("show");
header.addClass("hide"); } else {
} box.slideUp("normal");
}); header.removeClass("show");
} header.addClass("hide");
}
});
}
}); });
}(jQuery, document, this)); }(jQuery, document, this));
\ No newline at end of file
/*jslint undef: true */
/*global document, escape, unescape */
/* vim: set et sts=4: */
/*Cookies Management*/ /*Cookies Management*/
function setCookie(name,value,expires,path,domain,secure){ function setCookie(name, value, expires, path, domain, secure) {
if (!expires){ "use strict";
var today = new Date(); if (!expires) {
expires = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000); var today = new Date();
} expires = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000);
document.cookie = name + "=" + escape(value) + }
"; expires=" + expires.toGMTString() + document.cookie = name + "=" + escape(value) +
((path) ? "; path=" + path : "/") + "; expires=" + expires.toGMTString() +
((domain) ? "; domain=" + domain : "") + ((path) ? "; path=" + path : "/") +
((secure) ? "; secure" : ""); ((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 getCookie(name) { function getCookie(name) {
var i,x,y,ARRcookies=document.cookie.split(";"); "use strict";
for (i=0;i<ARRcookies.length;i++){ var i,
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); x,
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); y,
x=x.replace(/^\s+|\s+$/g,""); result,
if (x==name){ ARRcookies = document.cookie.split(";");
var result = unescape(y); for (i = 0; i < ARRcookies.length; i += 1) {
if (result != "" && result != null){ x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
return result; y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
} x = x.replace(/^\s+|\s+$/g, "");
return null; 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() { /*jslint undef: true */
var editor = ace.edit("editor"); /*global $, document, ace, $SCRIPT_ROOT */
editor.setTheme("ace/theme/crimson_editor"); /* 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(); $(document).ready(function () {
var workdir = $("input#workdir").val(); "use strict";
var edit = false;
var send = false;
selectFile(file);
$("#save").click(function(){ var editor, CurrentMode, file, workdir, edit, send;
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;
});
function selectFile(file){ function selectFile(file) {
edit = false; edit = false;
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: $SCRIPT_ROOT + '/getFileContent', url: $SCRIPT_ROOT + '/getFileContent',
data: "file=" + file, data: "file=" + file,
success: function(data){ success: function (data) {
if(data.code == 1){ if (data.code === 1) {
editor.getSession().setValue(data.result); editor.getSession().setValue(data.result);
edit = true; edit = true;
} } else {
else{ $("#error").Popup("Can not load your file, please make sure that you have selected a Software Release",
$("#error").Popup("Can not load your file, please make sure that you have selected a Software Release", {type:'alert', duration:5000}); {type: 'alert', duration: 5000});
} }
} }
}); });
return; return;
} }
function getmd5sum(){ function getmd5sum() {
if (send) return; if (send) {
send =true return;
$.ajax({ }
type: "POST", send = true;
url: $SCRIPT_ROOT + '/getmd5sum', $.ajax({
data: {file: file}, type: "POST",
success: function(data){ url: $SCRIPT_ROOT + '/getmd5sum',
if(data.code == 1){ data: {file: file},
$("#md5sum").empty(); success: function (data) {
$("#md5sum").append('md5sum : <span>' + data.result + '</span>'); if (data.code === 1) {
} $("#md5sum").empty();
else{ $("#md5sum").append('md5sum : <span>' + data.result + '</span>');
$("#error").Popup(data.result, {type:'error', duration:5000}); } else {
} $("#error").Popup(data.result, {type: 'error', duration: 5000});
send = false; }
} send = false;
}); }
} });
function setDevelop(developList){ }
if (developList==null || developList.length <= 0) return;
editor.navigateFileStart(); function setDevelop(developList) {
editor.find('buildout',{caseSensitive: true,wholeWord: true}); if (developList === null || developList.length <= 0) {
if(!editor.getSelectionRange().isEmpty()){ return;
//editor.find("",{caseSensitive: true,wholeWord: true,regExp: true}); }
//if(!editor.getSelectionRange().isEmpty()){ editor.navigateFileStart();
//alert("found"); editor.find('buildout', {caseSensitive: true, wholeWord: true});
//} if (editor.getSelectionRange().isEmpty()) {
//else{alert("no found"); $("#error").Popup("Can not found part [buildout]! Please make sure that you have a cfg file",
//} {type: 'alert', duration: 3000});
} return;
else{ }
$("#error").Popup("Can not found part [buildout]! Please make sure that you have a cfg file", {type:'alert', duration:3000}); //else {
return; // //editor.find("",{caseSensitive: true,wholeWord: true,regExp: true});
} // //if (!editor.getSelectionRange().isEmpty()) {
editor.navigateLineEnd(); // //alert("found");
$.post($SCRIPT_ROOT+"/getPath", {file:developList.join("#")}, function(data) { // //}
if(data.code==1){ // //else{alert("no found");
var result = data.result.split('#'); // //}
editor.insert("\ndevelop =\n\t" + result[0] + "\n"); //}
for(var i=1; i<result.length; i++) editor.navigateLineEnd();
editor.insert("\t" + result[i] + "\n"); $.post($SCRIPT_ROOT + "/getPath", {file: developList.join("#")}, function (data) {
} if (data.code === 1) {
}) var i,
.error(function() { }) result = data.result.split('#');
.complete(function(){}); editor.insert("\ndevelop =\n\t" + result[0] + "\n");
editor.insert("\n"); for (i = 1; i < result.length; i += 1) {
} editor.insert("\t" + result[i] + "\n");
}); }
\ No newline at end of file }
})
.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() { /*jslint undef: true */
var send = false; /*global $, document, $SCRIPT_ROOT */
var cloneRequest; /* vim: set et sts=4: */
$('#fileNavigator').gsFileManager({ script: $SCRIPT_ROOT+"/fileBrowser", root: "workspace/"});
configRadio();
$("input#nothing").change(function(){ $(document).ready(function () {
configRadio(); "use strict";
});
$("input#ssh").change(function(){ function configRadio() {
configRadio(); $("#modelist li").each(function (index) {
}); var boxselector = "#box" + index;
$("input#https").change(function(){ if ($(this).hasClass('checked')) {
configRadio(); $(this).removeClass('checked');
}); $(boxselector).slideUp("normal");
$("#clone").click(function(){ }
if(send){ if ($(this).find("input:radio").is(':checked')) {
cloneRequest.abort(); $(this).addClass('checked');
$("#imgwaitting").fadeOut('normal'); //change content here
$("#clone").empty(); $(boxselector).slideDown("normal");
$("#clone").append("Clone"); }
send = false; if (index !== 2) {
return; $("input#password").val("");
} $("input#cpassword").val("");
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\.\/:~@_-]+$/)){ var send = false,
$("#error").Popup("Invalid url for the repository", {type:'alert', duration:3000}); cloneRequest;
return false;
} $('#fileNavigator').gsFileManager({ script: $SCRIPT_ROOT + "/fileBrowser", root: "workspace/"});
if($("input#name").val() === '' || !$("input#name").val().match(/^[\w\d\._-]+$/)){ configRadio();
$("#error").Popup("Invalid project name", {type:'alert', duration:3000}); $("input#nothing").change(function () {
return false; configRadio();
} });
if($("input#user").val() !== ""){ $("input#ssh").change(function () {
name = $("input#user").val(); configRadio();
} });
if($("input#email").val() !== '' && $("input#email").val() !== "Enter your email adress..."){ $("input#https").change(function () {
if(!$("input#email").val().match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)){ configRadio();
$("#error").Popup("Please enter a valid email adress!", {type:'alert', duration:3000}); });
return false; $("#clone").click(function () {
} if (send) {
email = $("input#email").val(); cloneRequest.abort();
} $("#imgwaitting").fadeOut('normal');
if($("input#https").is(':checked')){ $("#clone").empty();
if($("input#username").val() == "" || !$("input#username").val().match(/^[\w\d\._-]+$/)){ $("#clone").append("Clone");
$("#error").Popup("Please enter a correct username", {type:'alert', duration:3000}); send = false;
return false; return;
} }
if($("input#password").val() != ""){ var repo_url = $("input#repo").val(),
if(repo_url.indexOf("https://") != -1){ email = "",
repo_url = "https://" + $("input#username").val() + name = "";
":" + $("input#password").val() +
"@" + repo_url.substring(8); /* /^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/ */
} if ($("input#repo").val() === '' || !repo_url.match(/^[\w\d\.\/:~@_\-]+$/)) {
else{ $("#error").Popup("Invalid url for the repository", {type: 'alert', duration: 3000});
$("#error").Popup("The URL of your repository should start with 'https://'", {type:'alert', duration:3000}); return false;
return false; }
} if ($("input#name").val() === '' || !$("input#name").val().match(/^[\w\d\._\-]+$/)) {
} $("#error").Popup("Invalid project name", {type: 'alert', duration: 3000});
else{ return false;
$("#error").Popup("Please enter your password", {type:'alert', duration:3000}); }
return false; if ($("input#user").val() !== "") {
} name = $("input#user").val();
} }
else if(repo_url.indexOf("https://") != -1){ if ($("input#email").val() !== '' && $("input#email").val() !== "Enter your email adress...") {
$("#error").Popup("Please select HTTPS Security Mode for this repository", {type:'alert', duration:3000}); if (!$("input#email").val().match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)) {
return false; $("#error").Popup("Please enter a valid email adress!", {type: 'alert', duration: 3000});
} return false;
$("#imgwaitting").fadeIn('normal'); }
$("#clone").empty(); email = $("input#email").val();
$("#clone").append("Stop"); }
send = true; if ($("input#https").is(':checked')) {
cloneRequest = $.ajax({ if ($("input#username").val() === "" || !$("input#username").val().match(/^[\w\d\._\-]+$/)) {
type: "POST", $("#error").Popup("Please enter a correct username", {type: 'alert', duration: 3000});
url: $SCRIPT_ROOT + '/cloneRepository', return false;
data: {repo: repo_url, name: ($("input#workdir").val() + "/" + }
$("input#name").val()), email:email, if ($("input#password").val() !== "") {
user:name}, if (repo_url.indexOf("https://") !== -1) {
success: function(data){ repo_url = "https://" + $("input#username").val() +
if(data.code == 1){ ":" + $("input#password").val() +
$("#file_navigation").fadeIn('normal'); "@" + repo_url.substring(8);
$("#error").Popup("Your repository is cloned!", {type:'confirm', duration:3000}); } else {
$("input#repo").val("Enter the url of your repository..."); $("#error").Popup("The URL of your repository should start with 'https://'", {type: 'alert', duration: 3000});
$("input#name").val("Enter the project name..."); return false;
$('#fileNavigator').gsFileManager({ script: $SCRIPT_ROOT+"/fileBrowser", root: "workspace/"}); }
} } else {
else{ $("#error").Popup("Please enter your password", {type: 'alert', duration: 3000});
$("#error").Popup(data.result, {type:'error'}); return false;
} }
$("#imgwaitting").hide(); } else if (repo_url.indexOf("https://") !== -1) {
$("#clone").empty(); $("#error").Popup("Please select HTTPS Security Mode for this repository", {type: 'alert', duration: 3000});
$("#clone").append("Clone"); return false;
send = false; }
}, $("#imgwaitting").fadeIn('normal');
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").empty();
$("#clone").append("Clone"); $("#clone").append("Stop");
} send = true;
}); cloneRequest = $.ajax({
return false; type: "POST",
}); url: $SCRIPT_ROOT + '/cloneRepository',
function configRadio(){ data: {
$("#modelist li").each(function(index) { repo: repo_url,
var boxselector = "#box" + index; name: $("input#workdir").val() + "/" + $("input#name").val(),
if($(this).hasClass('checked')){ email: email,
$(this).removeClass('checked'); user: name
$(boxselector).slideUp("normal"); },
} success: function (data) {
if($(this).find("input:radio").is(':checked')){ if (data.code === 1) {
$(this).addClass('checked'); $("#file_navigation").fadeIn('normal');
//change content here $("#error").Popup("Your repository is cloned!", {type: 'confirm', duration: 3000});
$(boxselector).slideDown("normal"); $("input#repo").val("Enter the url of your repository...");
} $("input#name").val("Enter the project name...");
if(index != 2){ $('#fileNavigator').gsFileManager({ script: $SCRIPT_ROOT + "/fileBrowser", root: "workspace/"});
$("input#password").val(""); } else {
$("input#cpassword").val(""); $("#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){ function selectFile(file) {
//nothing //nothing
return; return;
} }
}); });
\ No newline at end of file
$(document).ready(function() { /*jslint undef: true */
var editor; /*global $, document, window, alert, $SCRIPT_ROOT, setInput, ace */
setupFileTree(); /* vim: set et sts=4: */
$($('#slappart li')[0]).find('input:radio').attr('checked', true);
$('.menu-box-right>div').css('min-height', $('#slappart li').length * 26 + 20 + 'px');
configRadio();
var send = false;
var lastli = null;
var partitionAmount = $('input#partitionAmount').val();
$('#slappart li').each(function() {
lastli = $(this);
$(this).find('input:radio').change(function() {
configRadio();
});
});
if (lastli) {lastli.css('border-bottom', 'none');}
$('#parameterkw').slideBox('show'); $(document).ready(function () {
setupSlappart(); "use strict";
$('#reloadfiles').click(function() {
setupFileTree(); var editor,
}); send = false,
$('#refresh').click(function() { lastli = null,
if (send) return; partitionAmount = $('input#partitionAmount').val();
$('#imgwaitting').fadeIn();
$.ajax({ function setupTextarea($txt) {
type: 'GET', var size = Number($txt.attr('id').split('_')[1]),
url: $SCRIPT_ROOT + '/supervisordStatus', hiddenDiv = $(document.createElement('div')),
data: '', content = null;
success: function(data) { hiddenDiv.attr('id', 'div_' + size);
if (data.code == 1) { hiddenDiv.addClass('hiddendiv');
$('#supervisordcontent').empty(); $('div#parameterkw').append(hiddenDiv);
$('#supervisordcontent').append(data.result); $txt.keyup(function () {
} content = $txt.val().replace(/\n/g, '<br>');
$('#imgwaitting').fadeOut(); hiddenDiv.html(content);
} if (hiddenDiv.height() > $txt.height() && hiddenDiv.height() > 120) {
}); return;
return false;
});
$('#add_attribute').click(function() {
var size = Number($('#partitionParameter > tbody > tr').last().attr('id').split('_')[1]) + 1;
var row = "<tr id='row_" + size + "'><td class='first'><input type='text' name='txt_" + size + "' id='txt_" + size + "'></td>" +
"<td style='padding:6px'><textarea class='slap' id='value_" + size + "'></textarea>" +
"</td><td valign='middle'><span style='margin-left: 10px;' id='btn_" + size + "' class='close'></span></td></tr>";
$('#partitionParameter').append(row);
setInput($('input#txt_' + size));
setupTextarea($('textarea#value_' + size));
$('#btn_' + size).click(function() {
var index = $(this).attr('id').split('_')[1];
$('tr#row_' + index).remove();
});
return false;
});
$('#updateParameters').click(function() {
updateParameter();
return false;
});
$('#xmlview').click(function() {
var content = '<h2 style="color: #4c6172; font: 18px \'Helvetica Neue\', Helvetica, Arial, sans-serif;">' +
'INSTANCE PARAMETERS: Load XML file</h2><p id="xmllog" class="message"><br/></p>';
content += '<div class="main_content" style="height:230px"><pre id="editor"></pre></div>' +
'<input type=submit value="Load" id="loadxml" class="button">';
$.ajax({
type: 'GET',
url: $SCRIPT_ROOT + '/getParameterXml/xml',
success: function(data){
if(data.code == 1){
$("#inline_instance").html(content);
setupEditor(true);
$("a#inlineInstance").colorbox({inline:true, width: "600px", height: "410px", onComplete:function(){
editor.getSession().setValue(data.result);
}});
$("a#inlineInstance").click();
$("#loadxml").click(function(){
//Parse XML file
try {
var xmlDoc = $.parseXML(editor.getSession().getValue()), $xml = $(xmlDoc);
if ($xml.find('parsererror').length !== 0) {$('p#xmllog').html('Error: Invalid XML document!<br/>');return false;}
} catch (err) {
$('p#xmllog').html('Error: Invalid XML document!<br/>');return false;
}
$.ajax({
type: 'POST',
url: $SCRIPT_ROOT + '/saveParameterXml',
data: {software_type: '', parameter: editor.getSession().getValue()},
success: function(data) {
if (data.code == 1) {
location.href = $SCRIPT_ROOT + '/inspectInstance#tab3';
location.reload();
}
else {$('p#xmllog').html(data.result);}
} }
}); $txt.css('height', hiddenDiv.height() + 'px');
return false;
}); });
}
else {
$('#error').Popup(data.result, {type: 'error', duration: 5000});
}
}
});
});
//Load previous instance parameters
loadParameter();
$('a#parameterTab').click(function() {
var size = $('#partitionParameter > tbody > tr').length;
for (var i = 2; i <= size; i++) {
$('textarea#value_' + i).keyup();
} }
});
function setupFileTree(path){ function setupFileTree(path) {
var root = $("input#root").val(); var root = $("input#root").val();
if (root === '') return; if (root === '') {
if (path){ return;
root += '/' + path + '/'; }
if (path) {
root += '/' + path + '/';
} else {
root += '/';
}
$('#fileNavigator').gsFileManager({script: $SCRIPT_ROOT + "/fileBrowser", root: root});
} }
else{root += '/';}
$('#fileNavigator').gsFileManager({ script: $SCRIPT_ROOT+"/fileBrowser", root: root});
}
$("#parameter").load($SCRIPT_ROOT + '/getParameterXml'); function configRadio() {
$("#update").click(function(){ $('#slappart li').each(function () {
if($("#parameter").val() === ''){ var $radio = $(this).find('input:radio'),
$("#error").Popup("Can not save empty value!", {type:'alert', duration:3000}); boxselector = '#box' + $radio.attr('id');
if ($(this).hasClass('checked')) {
$(this).removeClass('checked');
$(boxselector).slideUp('normal');
}
if ($radio.is(':checked')) {
$(this).addClass('checked');
//change content here
$(boxselector).slideDown('normal');
}
});
} }
$.ajax({
type: 'POST', function setupSlappart() {
url: $SCRIPT_ROOT + '/saveParameterXml', var i, elt, fileId;
data: {parameter: $('#parameter').val().trim()}, for (i = 0; i < partitionAmount; i += 1) {
success: function(data) { elt = $('#slappart' + i + 'Parameter');
if (data.code == 1) { fileId = $('#slappart' + i + 'Files');
$('#error').Popup('Instance parameters updated!', {type: 'info', duration: 3000});
if (elt && elt !== undefined) {
elt.click(function () {
alert($(this).html());
});
} }
else { if (fileId && fileId !== undefined) {
$('#error').Popup(data.result, {type: 'error', duration: 5000}); fileId.click(function () {
$('#instancetabfiles').click();
setupFileTree($(this).attr('rel'));
});
} }
} }
}); }
});
function updateParameter() { function updateParameter() {
var xml = '<?xml version="1.0" encoding="utf-8"?>\n', var xml = '<?xml version="1.0" encoding="utf-8"?>\n',
software_type = '', software_type = '',
software_type_input_value = $('input#software_type').val(); software_type_input_value = $('input#software_type').val(),
if (software_type_input_value !== '' && software_type_input_value !== 'Software Type here...') { size = $('#partitionParameter > tbody > tr').length,
software_type = software_type_input_value; i;
if (software_type_input_value !== '' && software_type_input_value !== 'Software Type here...') {
software_type = software_type_input_value;
}
xml += '<instance>\n';
if (size > 1) {
for (i = 2; i <= size; i += 1) {
if ($('input#txt_' + i).val() !== '') {
xml += '<parameter id="' + $('input#txt_' + i).val() + '">' + $('textarea#value_' + i).val() + '</parameter>\n';
}
}
}
xml += '</instance>\n';
$.ajax({
type: 'POST',
url: $SCRIPT_ROOT + '/saveParameterXml',
data: {software_type: software_type, parameter: xml},
success: function (data) {
if (data.code === 1) {
$('#error').Popup('Instance parameters has been updated, please run your instance now!', {type: 'confirm', duration: 5000});
} else {
$('#error').Popup(data.result, {type: 'error', duration: 5000});
}
}
});
} }
xml += '<instance>\n';
var size = $('#partitionParameter > tbody > tr').length; function setupEditor(editable) {
if (size > 1) { editor = ace.edit('editor');
for (var i = 2; i <= size; i++) { editor.setTheme('ace/theme/crimson_editor');
if ($('input#txt_' + i).val() != '') {
xml += '<parameter id="' + $('input#txt_' + i).val() + '">' + $('textarea#value_' + i).val() + '</parameter>\n'; var CurentMode = require('ace/mode/text').Mode;
editor.getSession().setMode(new CurentMode());
editor.getSession().setTabSize(2);
editor.getSession().setUseSoftTabs(true);
editor.renderer.setHScrollBarAlwaysVisible(false);
if (!editable) {
editor.setReadOnly(true);
} }
}
} }
xml += '</instance>\n';
$.ajax({ function loadParameter() {
type: 'POST', $.ajax({
url: $SCRIPT_ROOT + '/saveParameterXml', type: 'GET',
data: {software_type: software_type, parameter: xml}, url: $SCRIPT_ROOT + '/getParameterXml/dict',
success: function(data) { success: function (data) {
if (data.code == 1) { var dict, propertie, size;
$('#error').Popup('Instance parameters has been updated, please run your instance now!', {type: 'confirm', duration: 5000}); if (data.code === 1) {
} dict = data.result.instance;
else { for (propertie in dict) {
$('#error').Popup(data.result, {type: 'error', duration: 5000}); $("#add_attribute").click();
} size = Number($("#partitionParameter > tbody > tr").last().attr('id').split('_')[1]);
$("input#txt_" + size).val(propertie);
$("textarea#value_" + size).val(dict[propertie]);
$("textarea#value_" + size).keyup();
}
} else {
$('#error').Popup(data.result, {type: 'error', duration: 5000});
}
}
});
} }
setupFileTree();
$($('#slappart li')[0]).find('input:radio').attr('checked', true);
$('.menu-box-right>div').css('min-height', $('#slappart li').length * 26 + 20 + 'px');
configRadio();
$('#slappart li').each(function () {
lastli = $(this);
$(this).find('input:radio').change(function () {
configRadio();
});
}); });
} if (lastli) {
function setupTextarea($txt) { lastli.css('border-bottom', 'none');
var size = Number($txt.attr('id').split('_')[1]); }
var hiddenDiv = $(document.createElement('div')),
content = null; $('#parameterkw').slideBox('show');
hiddenDiv.attr('id', 'div_' + size); setupSlappart();
hiddenDiv.addClass('hiddendiv'); $('#reloadfiles').click(function () {
$('div#parameterkw').append(hiddenDiv); setupFileTree();
$txt.keyup(function() {
content = $txt.val().replace(/\n/g, '<br>');
hiddenDiv.html(content);
if (hiddenDiv.height() > $txt.height() && hiddenDiv.height() > 120) {
return;
}
$txt.css('height', hiddenDiv.height() + 'px');
}); });
} $('#refresh').click(function () {
function loadParameter() { if (send) {
$.ajax({ return;
type: 'GET',
url: $SCRIPT_ROOT + '/getParameterXml/dict',
success: function(data){
if(data.code == 1){
var dict = data.result['instance'];
for (var propertie in dict){
$("#add_attribute").click();
var size = Number($("#partitionParameter > tbody > tr").last().attr('id').split('_')[1]);
$("input#txt_"+size).val(propertie);
$("textarea#value_"+size).val(dict[propertie]);
$("textarea#value_"+size).keyup();
} }
} $('#imgwaitting').fadeIn();
else { $.ajax({
$('#error').Popup(data.result, {type: 'error', duration: 5000}); type: 'GET',
} url: $SCRIPT_ROOT + '/supervisordStatus',
} data: '',
success: function (data) {
if (data.code === 1) {
$('#supervisordcontent').empty();
$('#supervisordcontent').append(data.result);
}
$('#imgwaitting').fadeOut();
}
});
return false;
});
$('#add_attribute').click(function () {
var size = Number($('#partitionParameter > tbody > tr').last().attr('id').split('_')[1]) + 1,
row = "<tr id='row_" + size + "'><td class='first'><input type='text' name='txt_" + size + "' id='txt_" + size + "'></td>" +
"<td style='padding:6px'><textarea class='slap' id='value_" + size + "'></textarea>" +
"</td><td valign='middle'><span style='margin-left: 10px;' id='btn_" + size + "' class='close'></span></td></tr>";
$('#partitionParameter').append(row);
setInput($('input#txt_' + size));
setupTextarea($('textarea#value_' + size));
$('#btn_' + size).click(function () {
var index = $(this).attr('id').split('_')[1];
$('tr#row_' + index).remove();
});
return false;
});
$('#updateParameters').click(function () {
updateParameter();
return false;
}); });
} $('#xmlview').click(function () {
function configRadio() { var content = '<h2 style="color: #4c6172; font: 18px \'Helvetica Neue\', Helvetica, Arial, sans-serif;">' +
$('#slappart li').each(function() { 'INSTANCE PARAMETERS: Load XML file</h2><p id="xmllog" class="message"><br/></p>';
var $radio = $(this).find('input:radio'); content += '<div class="main_content" style="height:230px"><pre id="editor"></pre></div>' +
var boxselector = '#box' + $radio.attr('id'); '<input type=submit value="Load" id="loadxml" class="button">';
if ($(this).hasClass('checked')) { $.ajax({
$(this).removeClass('checked'); type: 'GET',
$(boxselector).slideUp('normal'); url: $SCRIPT_ROOT + '/getParameterXml/xml',
} success: function (data) {
if ($radio.is(':checked')) { if (data.code === 1) {
$(this).addClass('checked'); $("#inline_instance").html(content);
//change content here setupEditor(true);
$(boxselector).slideDown('normal'); $("a#inlineInstance").colorbox(
{
inline: true,
width: "600px",
height: "410px",
onComplete: function () {
editor.getSession().setValue(data.result);
}
}
);
} $("a#inlineInstance").click();
$("#loadxml").click(function () {
//Parse XML file
try {
var xmlDoc = $.parseXML(editor.getSession().getValue()), $xml = $(xmlDoc);
if ($xml.find('parsererror').length !== 0) {
$('p#xmllog').html('Error: Invalid XML document!<br/>');
return false;
}
} catch (err) {
$('p#xmllog').html('Error: Invalid XML document!<br/>');
return false;
}
$.ajax({
type: 'POST',
url: $SCRIPT_ROOT + '/saveParameterXml',
data: {
software_type: '',
parameter: editor.getSession().getValue()
},
success: function (data) {
if (data.code === 1) {
window.location.href = $SCRIPT_ROOT + '/inspectInstance#tab3';
window.location.reload();
} else {
$('p#xmllog').html(data.result);
}
}
});
return false;
});
} else {
$('#error').Popup(data.result, {type: 'error', duration: 5000});
}
}
});
});
//Load previous instance parameters
loadParameter();
$('a#parameterTab').click(function () {
var i,
size = $('#partitionParameter > tbody > tr').length;
for (i = 2; i <= size; i += 1) {
$('textarea#value_' + i).keyup();
}
}); });
}
function setupBox() {
var state = $('#softwareType').css('display');
if (state == 'none') {
$('#softwareType').slideDown('normal');
$('#softwareTypeHead').removeClass('hide');
$('#softwareTypeHead').addClass('show');
}
else {
$('#softwareType').slideUp('normal');
$('#softwareTypeHead').removeClass('show');
$('#softwareTypeHead').addClass('hide');
}
}
function setupEditor(editable) {
editor = ace.edit('editor');
editor.setTheme('ace/theme/crimson_editor');
var CurentMode = require('ace/mode/text').Mode; $("#parameter").load($SCRIPT_ROOT + '/getParameterXml');
editor.getSession().setMode(new CurentMode()); $("#update").click(function () {
editor.getSession().setTabSize(2); if ($("#parameter").val() === '') {
editor.getSession().setUseSoftTabs(true); $("#error").Popup("Can not save empty value!", {type: 'alert', duration: 3000});
editor.renderer.setHScrollBarAlwaysVisible(false); }
if (!editable) {editor.setReadOnly(true);} $.ajax({
} type: 'POST',
function setupSlappart() { url: $SCRIPT_ROOT + '/saveParameterXml',
for (var i = 0; i < partitionAmount; i++) { data: {parameter: $('#parameter').val().trim()},
var elt = $('#slappart' + i + 'Parameter'); success: function (data) {
var fileId = $('#slappart' + i + 'Files'); if (data.code === 1) {
if (elt && elt !== undefined) elt.click(function() { $('#error').Popup('Instance parameters updated!', {type: 'info', duration: 3000});
alert($(this).html()); } else {
}); $('#error').Popup(data.result, {type: 'error', duration: 5000});
if (fileId && fileId !== undefined) fileId.click(function() { }
$('#instancetabfiles').click(); }
setupFileTree($(this).attr('rel')); });
}); });
function setupBox() {
var state = $('#softwareType').css('display');
if (state === 'none') {
$('#softwareType').slideDown('normal');
$('#softwareTypeHead').removeClass('hide');
$('#softwareTypeHead').addClass('show');
} else {
$('#softwareType').slideUp('normal');
$('#softwareTypeHead').removeClass('show');
$('#softwareTypeHead').addClass('hide');
}
} }
}
}); });
$(document).ready( function() { /*jslint undef: true */
var editor; /*global $, document, window, $SCRIPT_ROOT, ace */
var send = false; /* vim: set et sts=4: */
var runnerDir = $("input#runnerdir").val();
$("#reloadfiles").click(function(){
fillContent();
});
fillContent();
function fillContent(){
$('#fileNavigator').gsFileManager({ script: $SCRIPT_ROOT+"/fileBrowser", root: runnerDir});
}
$("#open").click(function(){ $(document).ready(function () {
var elt = $("option:selected", $("#softwarelist")); "use strict";
if(elt.val() === "No Software Release found"){
$("#error").Popup("Please select your Software Release", {type:'alert', duration:5000}); var editor,
return false; 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(){ $("#reloadfiles").click(function () {
if($("#softwarelist").val() === "No Software Release found"){ fillContent();
$("#error").Popup("Please select your Software Release", {type:'alert', duration:5000}); });
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; 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(){ $("#delete").click(function () {
editor = ace.edit("editor"); if ($("#softwarelist").val() === "No Software Release found") {
editor.setTheme("ace/theme/crimson_editor"); $("#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; function setupEditor() {
editor.getSession().setMode(new CurentMode()); editor = ace.edit("editor");
editor.getSession().setTabSize(2); editor.setTheme("ace/theme/crimson_editor");
editor.getSession().setUseSoftTabs(true);
editor.renderer.setHScrollBarAlwaysVisible(false); var CurentMode = require("ace/mode/text").Mode;
editor.setReadOnly(true); editor.getSession().setMode(new CurentMode());
} editor.getSession().setTabSize(2);
}); editor.getSession().setUseSoftTabs(true);
\ No newline at end of file editor.renderer.setHScrollBarAlwaysVisible(false);
editor.setReadOnly(true);
}
});
$(document).ready( function() { /*jslint undef: true */
var send = false; /*global $, document, window, $SCRIPT_ROOT */
//change background /* vim: set et sts=4: */
$("body").css("background", "#9C9C9C");
$("#login").click(function(){ $(document).ready(function () {
if (send) return false; "use strict";
if($("input#clogin").val() === "" || !$("input#clogin").val().match(/^[\w\d\.-]+$/)){
$("#error").Popup("Please enter a valid user name", {type:'alert', duration:3000}); var send = false;
return false; //change background
} $("body").css("background", "#9C9C9C");
if($("input#cpwd").val() === "" || $("input#cpwd").val() ==="******"){ $("#login").click(function () {
$("#error").Popup("Please enter your password", {type:'alert', duration:3000}); if (send) {
return false; return false;
} }
send = true; if ($("input#clogin").val() === "" || !$("input#clogin").val().match(/^[\w\d\.\-]+$/)) {
var param = {clogin:$("input#clogin").val(), cpwd:$("input#cpwd").val()}; $("#error").Popup("Please enter a valid user name", {type: 'alert', duration: 3000});
var url = $SCRIPT_ROOT + "/doLogin"; return false;
$("#login").removeClass("button").addClass("dsblebutton"); }
$.post(url, param, function(data) { if ($("input#cpwd").val() === "" || $("input#cpwd").val() === "******") {
if (data.code==1){ $("#error").Popup("Please enter your password", {type: 'alert', duration: 3000});
location.href = $SCRIPT_ROOT + '/'; return false;
} }
else{ send = true;
$("#error").Popup(data.result, {type:'alert', duration:3000}); var param = { clogin: $("input#clogin").val(), cpwd: $("input#cpwd").val() },
} url = $SCRIPT_ROOT + "/doLogin";
})
.error(function() { $("#login").removeClass("button").addClass("dsblebutton");
$("#error").Popup("Cannot send your account identifier please try again!!", $.post(url, param, function (data) {
{type:'alert', duration:3000});}) if (data.code === 1) {
.complete(function() { window.location.href = $SCRIPT_ROOT + '/';
$("#login").removeClass('dsblebutton').addClass('button'); } else {
send = false; $("#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
/*jslint undef: true */
/*global $, window, $SCRIPT_ROOT, setRunningState, setCookie, getCookie, deleteCookie */
/*global currentState: true, running: true, $current: true, processType: true, currentProcess: true */
/*global sendStop: true, processState: true, openedlogpage: true, logReadingPosition: true, speed: true */
/*global isRunning: true */
/* vim: set et sts=4: */
//Global Traitment!!! //Global Traitment!!!
var url = $SCRIPT_ROOT + "/slapgridResult"
var url = $SCRIPT_ROOT + "/slapgridResult";
var currentState = false; var currentState = false;
var running = true; var running = true;
var $current; var $current;
...@@ -10,151 +18,183 @@ var processState = "Checking"; //define slapgrid running state ...@@ -10,151 +18,183 @@ var processState = "Checking"; //define slapgrid running state
var openedlogpage = ""; //content software or instance if the current page is software or instance log, otherwise nothing var openedlogpage = ""; //content software or instance if the current page is software or instance log, otherwise nothing
var logReadingPosition = 0; var logReadingPosition = 0;
var speed = 5000; var speed = 5000;
var isRunning = function(){ var isRunning = function () {
if (running){ "use strict";
$("#error").Popup("Slapgrid is currently under execution!", {type:'alert', duration:3000}); if (running) {
} $("#error").Popup("Slapgrid is currently under execution!",
return running; {type: 'alert', duration: 3000});
} }
function setSpeed(value){ return running;
if (openedlogpage == ""){ };
speed = 5000;
} function setSpeed(value) {
else{ speed=value;} "use strict";
} if (openedlogpage === "") {
function getRunningState(){ speed = 5000;
var param = {position:logReadingPosition, log:(processState!="Checking" && openedlogpage==processType.toLowerCase())? openedlogpage:""} } else {
var jqxhr = $.post(url, param, function(data) { speed = value;
setRunningState(data)
logReadingPosition = data.content.position;
if(data.content.content != ""){
$("#salpgridLog").append(data.content.content.toHtmlChar());
$("#salpgridLog")
.scrollTop($("#salpgridLog")[0].scrollHeight - $("#salpgridLog")
.height());
}
if (running && processState=="Checking" && openedlogpage != ""){$("#salpgridLog").show();$("#manualLog").hide();}
processState = (running)?"Running":"Stopped";
})
.error(function() { clearAll(false); })
.complete(function() {
if (running){
setTimeout(function(){
getRunningState();
}, speed);
} }
});
} }
function clearAll(setStop){
currentState = false; function clearAll(setStop) {
running = setStop; "use strict";
currentState = false;
running = setStop;
} }
function bindRun(){
$("#softrun").click(function(){ function getRunningState() {
if($("#softrun").text() == "Stop"){ "use strict";
stopProcess(); var param = {
} position: logReadingPosition,
else{ log: (processState !== "Checking" && openedlogpage === processType.toLowerCase()) ? openedlogpage : ""
if(!isRunning()){ },
setCookie("slapgridCMD", "Software"); jqxhr = $.post(url, param, function (data) {
location.href = $SCRIPT_ROOT + "/viewSoftwareLog"; setRunningState(data);
} logReadingPosition = data.content.position;
} if (data.content.content !== "") {
return false; $("#salpgridLog").append(data.content.content.toHtmlChar());
}); $("#salpgridLog")
$("#instrun").click(function(){ .scrollTop($("#salpgridLog")[0].scrollHeight - $("#salpgridLog").height());
if($("#instrun").text() == "Stop"){ }
stopProcess(); if (running && processState === "Checking" && openedlogpage !== "") {
} $("#salpgridLog").show();
else{ $("#manualLog").hide();
if(!isRunning()){ }
setCookie("slapgridCMD", "Instance"); processState = running ? "Running" : "Stopped";
location.href = $SCRIPT_ROOT + "/viewInstanceLog"; })
} .error(function () {
} clearAll(false);
return false; })
}); .complete(function () {
if (running) {
setTimeout(function () {
getRunningState();
}, speed);
}
});
} }
function setRunningState(data){
if (data.result){ function stopProcess() {
if(!currentState){ "use strict";
$("#running").show(); if (sendStop) {
running = true; return;
//change run menu title and style
if(data.software){
$("#softrun").empty();
$("#softrun").append("Stop");
$("#softrun").css("color", "#0271BF");
$current = $("#softrun");
processType = "Software";
}
if(data.instance){
$("#instrun").empty();
$("#instrun").append("Stop");
$("#instrun").css("color", "#0271BF");
$current = $("#instrun");
processType = "Instance";
}
} }
} if (running) {
else{ sendStop = true;
$("#running").hide();
running = false; //nothing is currently running var urlfor = $SCRIPT_ROOT + "stopSlapgrid",
if ($current != undefined){ type = "slapgrid-sr.pid";
$current.empty();
$current.append("Run"); if ($("#instrun").text() === "Stop") {
$current.css("color", "#000"); type = "slapgrid-cp.pid";
$current = undefined; }
currentState = false; $.post(urlfor, {type: type}, function (data) {
$("#error").Popup("Slapgrid completely finish running your " + processType + " Profile", {type:'info', duration:3000}); //if (data.result) {
//$("#error").Popup("Failled to run Slapgrid", {type:'error', duration:3000}); });
//}
})
.error(function () {
$("#error").Popup("Failed to stop Slapgrid process", {type: 'error', duration: 3000});
})
.complete(function () {
sendStop = false;
processState = "Stopped";
});
} }
}
currentState = data.result;
} }
function runProcess(urlfor, data){
if(!isRunning()){ function bindRun() {
running = true; "use strict";
processState = "Running"; $("#softrun").click(function () {
currentProcess = $.post(urlfor) if ($("#softrun").text() === "Stop") {
.error(function() { stopProcess();
$("#error").Popup("Failled to run Slapgrid", {type:'error', duration:3000}); }); } else {
setRunningState(data); if (!isRunning()) {
setTimeout("getRunningState()", 6000); setCookie("slapgridCMD", "Software");
} window.location.href = $SCRIPT_ROOT + "/viewSoftwareLog";
}
}
return false;
});
$("#instrun").click(function () {
if ($("#instrun").text() === "Stop") {
stopProcess();
} else {
if (!isRunning()) {
setCookie("slapgridCMD", "Instance");
window.location.href = $SCRIPT_ROOT + "/viewInstanceLog";
}
}
return false;
});
} }
function stopProcess(){
if (sendStop) return; function setRunningState(data) {
if (running){ "use strict";
sendStop = true; if (data.result) {
var urlfor = $SCRIPT_ROOT + "stopSlapgrid" if (!currentState) {
var type = "slapgrid-sr.pid"; $("#running").show();
if($("#instrun").text() == "Stop"){ running = true;
type = "slapgrid-cp.pid"; //change run menu title and style
if (data.software) {
$("#softrun").empty();
$("#softrun").append("Stop");
$("#softrun").css("color", "#0271BF");
$current = $("#softrun");
processType = "Software";
}
if (data.instance) {
$("#instrun").empty();
$("#instrun").append("Stop");
$("#instrun").css("color", "#0271BF");
$current = $("#instrun");
processType = "Instance";
}
}
} else {
$("#running").hide();
running = false; //nothing is currently running
if ($current !== undefined) {
$current.empty();
$current.append("Run");
$current.css("color", "#000");
$current = undefined;
currentState = false;
$("#error").Popup("Slapgrid completely finish running your " + processType + " Profile", {type: 'info', duration: 3000});
}
} }
$.post(urlfor, {type:type}, function(data){ currentState = data.result;
//if (data.result){
//$("#error").Popup("Failled to run Slapgrid", {type:'error', duration:3000}); });
//}
})
.error(function() {
$("#error").Popup("Failled to stop Slapgrid process", {type:'error', duration:3000}); })
.complete(function() {sendStop = false;processState="Stopped";});
}
} }
function checkSavedCmd(){ function runProcess(urlfor, data) {
var result = getCookie("slapgridCMD"); "use strict";
if (!result) return false; if (!isRunning()) {
if (result == "Software"){ running = true;
running = false; processState = "Running";
runProcess(($SCRIPT_ROOT + "/runSoftwareProfile"), currentProcess = $.post(urlfor)
{result: true, instance:false, software:true}); .error(function () {
} $("#error").Popup("Failled to run Slapgrid", {type: 'error', duration: 3000});
else if(result == "Instance"){ });
running = false; setRunningState(data);
runProcess(($SCRIPT_ROOT + "/runInstanceProfile"), setTimeout(getRunningState, 6000);
{result: true, instance:true, software:false}); }
} }
deleteCookie("slapgridCMD");
return (result != null); function checkSavedCmd() {
} "use strict";
\ No newline at end of file var result = getCookie("slapgridCMD");
if (!result) {
return false;
}
if (result === "Software") {
running = false;
runProcess(($SCRIPT_ROOT + "/runSoftwareProfile"),
{result: true, instance: false, software: true});
} else if (result === "Instance") {
running = false;
runProcess(($SCRIPT_ROOT + "/runInstanceProfile"),
{result: true, instance: true, software: false});
}
deleteCookie("slapgridCMD");
return (result !== null);
}
$(document).ready( function() { /*jslint undef: true */
var method = $("input#method").val(); /*global $, document, window, $SCRIPT_ROOT */
var workdir = $("input#workdir").val(); /* vim: set et sts=4: */
if (method != "file"){
script = "/openFolder"; $(document).ready(function () {
$('#fileTree').fileTree({ root: workdir, script: $SCRIPT_ROOT + script, folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function(file) { "use strict";
selectFile(file);
}); var method = $("input#method").val(),
} workdir = $("input#workdir").val();
$("input#subfolder").val("");
$("#create").click(function(){ function checkFolder(path) {
repo_url = $("input#software").val(); $.ajax({
if($("input#software").val() == "" || !$("input#software").val().match(/^[\w\d._-]+$/)){ type: "POST",
$("#error").Popup("Invalid Software name", {type:'alert', duration:3000}) url: $SCRIPT_ROOT + '/checkFolder',
return false; data: "path=" + path,
} success: function (data) {
if($("input#subfolder").val() == ""){ var path = data.result;
$("#error").Popup("Select the parent folder of your software!", {type:'alert', duration:3000}) $("input#path").val(path);
return false; if (path !== "") {
} $("#check").fadeIn('normal');
$.ajax({ } else {
type: "POST", $("#check").hide();
url: $SCRIPT_ROOT + '/createSoftware', }
data: "folder=" + $("input#subfolder").val() + $("input#software").val(), }
success: function(data){ });
if(data.code == 1){ return "";
location.href = $SCRIPT_ROOT + '/editSoftwareProfile' }
}
else{ function selectFile(file) {
$("#error").Popup(data.result, {type:'error', duration:5000}) $("#info").empty();
$("input#subfolder").val(file);
} if (method === "open") {
} $("#info").append("Selection: " + file);
}); checkFolder(file);
return false; } else {
}); if ($("input#software").val() !== "" && $("input#software").val().match(/^[\w\d._\-]+$/)) {
$("#info").append("New Software in: " + file + $("input#software").val());
$("#open").click(function(){ } else {
$("#flash").fadeOut('normal'); $("#info").append("Selection: " + file);
$("#flash").empty(); }
$("#flash").fadeIn('normal'); }
if($("input#path").val() == ""){ return;
$("#error").Popup("Select a valid Software Release folder!", {type:'alert', duration:3000}) }
return false;
} if (method !== "file") {
$.ajax({ $('#fileTree').fileTree({root: workdir, script: $SCRIPT_ROOT + '/openFolder', folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function (file) {
type: "POST", selectFile(file);
url: $SCRIPT_ROOT + '/setCurrentProject', });
data: "path=" + $("input#path").val(), }
success: function(data){ $("input#subfolder").val("");
if(data.code == 1){ $("#create").click(function () {
location.href = $SCRIPT_ROOT + '/editSoftwareProfile' if ($("input#software").val() === "" || !$("input#software").val().match(/^[\w\d._\-]+$/)) {
} $("#error").Popup("Invalid Software name", {type: 'alert', duration: 3000});
else{ return false;
$("#error").Popup(data.result, {type:'error', duration:5000}) }
} if ($("input#subfolder").val() === "") {
} $("#error").Popup("Select the parent folder of your software!", {type: 'alert', duration: 3000});
}); return false;
return false; }
}); $.ajax({
type: "POST",
function selectFile(file){ url: $SCRIPT_ROOT + '/createSoftware',
$("#info").empty(); data: "folder=" + $("input#subfolder").val() + $("input#software").val(),
$("input#subfolder").val(file); success: function (data) {
path = ""; if (data.code === 1) {
if(method == "open"){ window.location.href = $SCRIPT_ROOT + '/editSoftwareProfile';
$("#info").append("Selection: " + file); } else {
checkFolder(file); $("#error").Popup(data.result, {type: 'error', duration: 5000});
} }
else{ }
if($("input#software").val() != "" && $("input#software").val().match(/^[\w\d._-]+$/)){ });
$("#info").append("New Software in: " + file + $("input#software").val()); return false;
} });
else{
$("#info").append("Selection: " + file); $("#open").click(function () {
} $("#flash").fadeOut('normal');
} $("#flash").empty();
return; $("#flash").fadeIn('normal');
} if ($("input#path").val() === "") {
$("#error").Popup("Select a valid Software Release folder!", {type: 'alert', duration: 3000});
function checkFolder(path){ return false;
$.ajax({ }
type: "POST", $.ajax({
url: $SCRIPT_ROOT + '/checkFolder', type: "POST",
data: "path=" + path, url: $SCRIPT_ROOT + '/setCurrentProject',
success: function(data){ data: "path=" + $("input#path").val(),
var path = data.result; success: function (data) {
$("input#path").val(path); if (data.code === 1) {
if (path != ""){ window.location.href = $SCRIPT_ROOT + '/editSoftwareProfile';
$("#check").fadeIn('normal'); } else {
} $("#error").Popup(data.result, {type: 'error', duration: 5000});
else{ }
$("#check").hide(); }
} });
} return false;
}); });
return ""; });
}
});
\ No newline at end of file
$(document).ready( function() { /*jslint undef: true */
var send = false; /*global $, document, $SCRIPT_ROOT */
var getStatus; /* vim: set et sts=4: */
gitStatus();
$("#project").change(function(){ $(document).ready(function () {
if (send){ "use strict";
getStatus.abort();
send=false; var send = false,
} getStatus;
gitStatus();
}); function loadBranch(branch) {
$("#activebranch").change(function(){ var i, selected;
var branch = $("#activebranch").val(); $("#activebranch").empty();
var project = $("#project").val(); for (i = 0; i < branch.length; i += 1) {
$.ajax({ selected = (branch[i].indexOf('*') === 0) ? "selected" : "";
type: "POST", $("#activebranch").append("<option value='" + branch[i] +
url: $SCRIPT_ROOT + '/changeBranch', "' " + selected + ">" + branch[i] + "</option>");
data: "project=" + $("input#workdir").val() + "/" + project + "&name=" + branch, }
success: function(data){ }
if(data.code == 1){
gitStatus(); function gitStatus() {
} var project = $("#project").val(),
else{ urldata = $("input#workdir").val() + "/" + project;
$("#error").Popup(data.result, {type:'error', duration:5000});
} $("#status").empty();
} $("#push").hide();
}); $("#flash").empty();
}); if (project === "") {
$("#addbranch").click(function(){ $("#status").append("<h2>Please select one project...</h2><br/><br/>");
checkout("1"); $("#branchlist").hide();
return false; return;
}); }
$("#docheckout").click(function(){ send = true;
checkout("0"); getStatus = $.ajax({
return false; type: "POST",
}); url: $SCRIPT_ROOT + '/getProjectStatus',
$("#commit").click(function(){ data: "project=" + urldata,
if($("input#commitmsg").val() == "" || success: function (data) {
$("input#commitmsg").val() == "Enter message..."){ var message;
$("#error").Popup("Please Enter the commit message", {type:'alert', duration:3000});
return false; if (data.code === 1) {
} $("#branchlist").show();
if (send){ $("#status").append("<h2>Your Repository status</h2>");
return false; message = data.result.split('\n').join('<br/>');
} //alert(message);
send = true; $("#status").append("<p>" + message + "</p>");
var project = $("#project").val(); if (data.dirty) {
$("#imgwaitting").fadeIn('normal'); $("#push").show();
$("#commit").empty(); $("#status").append("<br/><h2>Display Diff for current Project</h2>");
$("#commit").attr("value", "Wait..."); $("#status").append("<p style='font-size:15px;'>You have changes in your project." +
$.ajax({ " <a href='" + $SCRIPT_ROOT + "/getProjectDiff/"
type: "POST", + encodeURI(project) + "'>Watch the diff</a></p>");
url: $SCRIPT_ROOT + '/pushProjectFiles', }
data: {project: $("input#workdir").val() + "/" + project, msg: $("input#commitmsg").val()}, loadBranch(data.branch);
success: function(data){ } else {
if(data.code == 1){ $("#error").Popup(data.result, {type: 'error', duration: 5000});
if (data.result != ""){ }
$("#error").Popup(data.result, {type:'error', duration:5000}); send = false;
} }
else });
$("#error").Popup("Commit done!", {type:'confirm', duration:3000}); }
gitStatus();
} function checkout(mode) {
else{ if ($("input#branchname").val() === "" ||
$("#error").Popup(data.result, {type:'error'}); $("input#branchname").val() === "Enter the branch name...") {
} $("#error").Popup("Please Enter the branch name", {type: 'alert', duration: 3000});
$("#imgwaitting").hide() return false;
$("#commit").empty(); }
$("#commit").attr("value", "Commit"); var project = $("#project").val(),
send = false; branch = $("input#branchname").val();
} $.ajax({
}); type: "POST",
return false; url: $SCRIPT_ROOT + '/newBranch',
}); data: {project: $("input#workdir").val() + "/" + project, name: branch, create: mode},
/* success: function (data) {
$("#pullbranch").click(function(){ if (data.code === 1) {
if (send){ $("input#branchname").val("Enter the branch name...");
return false; gitStatus();
} } else {
send = true; $("#error").Popup(data.result, {type: 'error'});
var project = $("#project").val(); }
$("#pullimgwaitting").fadeIn('normal'); }
$("#pullbranch").empty(); });
$("#pullbranch").attr("value", "Wait..."); return false;
$.ajax({ }
type: "POST",
url: $SCRIPT_ROOT + '/pullProjectFiles',
data: "project=" + $("input#workdir").val() + "/" + project, gitStatus();
success: function(data){
if(data.code == 1){ $("#project").change(function () {
if (data.result != ""){ if (send) {
error(data.result); getStatus.abort();
} send = false;
else }
error("Pull done!"); gitStatus();
gitStatus(); });
} $("#activebranch").change(function () {
else{ var branch = $("#activebranch").val(),
error(data.result); project = $("#project").val();
}
$("#pullimgwaitting").hide() $.ajax({
$("#pullbranch").empty(); type: "POST",
$("#pullbranch").attr("value", "Git Pull"); url: $SCRIPT_ROOT + '/changeBranch',
send = false; data: "project=" + $("input#workdir").val() + "/" + project + "&name=" + branch,
} success: function (data) {
}); if (data.code === 1) {
return false; gitStatus();
});*/ } else {
function gitStatus(){ $("#error").Popup(data.result, {type: 'error', duration: 5000});
var project = $("#project").val(); }
$("#status").empty(); }
$("#push").hide(); });
$("#flash").empty(); });
if (project == ""){ $("#addbranch").click(function () {
$("#status").append("<h2>Please select one project...</h2><br/><br/>"); checkout("1");
$("#branchlist").hide(); return false;
return; });
} $("#docheckout").click(function () {
send = true; checkout("0");
var urldata = $("input#workdir").val() + "/" + project; return false;
getStatus = $.ajax({ });
type: "POST", $("#commit").click(function () {
url: $SCRIPT_ROOT + '/getProjectStatus', if ($("input#commitmsg").val() === "" ||
data: "project=" + urldata, $("input#commitmsg").val() === "Enter message...") {
success: function(data){ $("#error").Popup("Please Enter the commit message", {type: 'alert', duration: 3000});
if(data.code == 1){ return false;
$("#branchlist").show(); }
$("#status").append("<h2>Your Repository status</h2>"); if (send) {
message = data.result.split('\n').join('<br/>'); return false;
//alert(message); }
$("#status").append("<p>" + message + "</p>"); send = true;
if(data.dirty){ var project = $("#project").val();
$("#push").show(); $("#imgwaitting").fadeIn('normal');
$("#status").append("<br/><h2>Display Diff for current Project</h2>"); $("#commit").empty();
$("#status").append("<p style='font-size:15px;'>You have changes in your project." + $("#commit").attr("value", "Wait...");
" <a href='" + $SCRIPT_ROOT + "/getProjectDiff/" $.ajax({
+ encodeURI(project) + "'>Watch the diff</a></p>"); type: "POST",
} url: $SCRIPT_ROOT + '/pushProjectFiles',
loadBranch(data.branch); data: {project: $("input#workdir").val() + "/" + project, msg: $("input#commitmsg").val()},
} success: function (data) {
else{ if (data.code === 1) {
$("#error").Popup(data.result, {type:'error', duration:5000}); if (data.result !== "") {
} $("#error").Popup(data.result, {type: 'error', duration: 5000});
send = false; } else {
} $("#error").Popup("Commit done!", {type: 'confirm', duration: 3000});
}); }
} gitStatus();
function checkout(mode){ } else {
if($("input#branchname").val() == "" || $("#error").Popup(data.result, {type: 'error'});
$("input#branchname").val() == "Enter the branch name..."){ }
$("#error").Popup("Please Enter the branch name", {type:'alert', duration:3000}); $("#imgwaitting").hide();
return false; $("#commit").empty();
} $("#commit").attr("value", "Commit");
var project = $("#project").val(); send = false;
var branch = $("input#branchname").val(); }
$.ajax({ });
type: "POST", return false;
url: $SCRIPT_ROOT + '/newBranch', });
data: {project:$("input#workdir").val() + "/" + project, name:branch, create:mode},
success: function(data){ /*
if(data.code == 1){ $("#pullbranch").click(function (){
$("input#branchname").val("Enter the branch name..."); if (send){
gitStatus(); return false;
} }
else{ send = true;
$("#error").Popup(data.result, {type:'error'}); var project = $("#project").val();
} $("#pullimgwaitting").fadeIn('normal');
} $("#pullbranch").empty();
}); $("#pullbranch").attr("value", "Wait...");
return false; $.ajax({
} type: "POST",
function loadBranch(branch){ url: $SCRIPT_ROOT + '/pullProjectFiles',
$("#activebranch").empty(); data: "project=" + $("input#workdir").val() + "/" + project,
for(i=0; i< branch.length; i++){ success: function (data){
selected = (branch[i].indexOf('*') == 0)? "selected":""; if (data.code == 1){
$("#activebranch").append("<option value='" + branch[i] + if (data.result != ""){
"' " + selected + ">" + branch[i] + "</option>"); error(data.result);
} }
} else
}); error("Pull done!");
\ No newline at end of file gitStatus();
} else {
error(data.result);
}
$("#pullimgwaitting").hide()
$("#pullbranch").empty();
$("#pullbranch").attr("value", "Git Pull");
send = false;
}
});
return false;
});*/
});
$(document).ready( function() { /*jslint undef: true */
var editor = ace.edit("editor"); /*global $, document, $SCRIPT_ROOT, ace */
editor.setTheme("ace/theme/crimson_editor"); /*global path: true */
/* vim: set et sts=4: */
var CurentMode = require("ace/mode/text").Mode;
editor.getSession().setMode(new CurentMode());
editor.getSession().setTabSize(2);
editor.getSession().setUseSoftTabs(true);
editor.renderer.setHScrollBarAlwaysVisible(false);
var script = "/readFolder"; $(document).ready(function () {
var softwareDisplay = true; "use strict";
var Mode = function(name, desc, clazz, extensions) {
this.name = name;
this.desc = desc;
this.clazz = clazz;
this.mode = new clazz();
this.mode.name = name;
this.extRe = new RegExp("^.*\\.(" + extensions.join("|") + ")$"); var editor = ace.edit("editor"),
}; CurrentMode,
var modes = [ script = "/readFolder",
new Mode("php", "PHP",require("ace/mode/php").Mode, ["php", "in", "inc"]), softwareDisplay = true,
new Mode("python", "Python", require("ace/mode/python").Mode, ["py"]), Mode,
new Mode("buildout", "Python Buildout config", require("ace/mode/buildout").Mode, ["cfg"]) modes,
]; projectDir = $("input#project").val(),
var projectDir = $("input#project").val(); workdir = $("input#workdir").val(),
var workdir = $("input#workdir").val(); currentProject = workdir + "/" + projectDir.replace(workdir, "").split('/')[1],
var currentProject = workdir + "/" + projectDir.replace(workdir, "").split('/')[1]; send = false,
var send = false; edit = false;
var edit = false;
$('#fileTree').fileTree({ root: projectDir, script: $SCRIPT_ROOT + script, folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function(file) {
selectFile(file);
});
setDetailBox();
$("#add").click(function(){
var path = (softwareDisplay)? projectDir:currentProject;
if (send) return false;
if($("input#file").val() == "" ||
$("input#file").val() == "Enter name here..."){
$("#error").Popup("Please enter your file or folder name", {type:'alert', duration:3000});
return false;
}
if($("input#subfolder").val() != ""){
path = $("input#subfolder").val();
}
path = path + "/" + $("input#file").val();
send = true;
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/createFile',
data: "file=" + path + "&type=" + $("#type").val(),
success: function(data){
if(data.code == 1){
switchContent();
$("input#file").val("");
$("#flash").fadeOut('normal');
$("#flash").empty();
$("#info").empty();
$("#info").append("Select parent directory or nothing for root...");
$("input#subfolder").val("");
}
else{
$("#error").Popup(data.result, {type:'error', duration:5000});
}
send = false;
}
});
return false;
});
$("#save").click(function(){
if(!edit){
$("#error").Popup("Please select the file to edit", {type:'alert', duration:3000});
return false;
}
if (send) return false;
send = true;
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/saveFileContent',
data: {file: $("input#subfolder").val(), content: editor.getSession().getValue()},
success: function(data){
if(data.code == 1){
$("#error").Popup("File saved succefuly!", {type:'confirm', duration:3000});
}
else{
$("#error").Popup(data.result, {type:'error', duration:5000});
}
send = false;
}
});
return false;
});
$("#details_head").click(function(){ function setEditMode(file) {
setDetailBox(); var i,
}); CurrentMode = require("ace/mode/text").Mode;
editor.getSession().setMode(new CurrentMode());
for (i = 0; i < modes.length; i += 1) {
if (modes[i].extRe.test(file)) {
editor.getSession().setMode(modes[i].mode);
break;
}
}
}
$("#switch").click(function(){ function selectFile(file) {
softwareDisplay = !softwareDisplay; $("#info").empty();
switchContent(); $("#info").append(file);
return false; $("input#subfolder").val(file);
}); $("#md5sum").empty();
$("#getmd5").click(function(){ path = "";
getmd5sum(); send = false;
return false; edit = false;
}); if (file.substr(-1) !== "/") {
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/getFileContent',
data: {file: file},
success: function (data) {
var name, start;
if (data.code === 1) {
$("#edit_info").empty();
name = file.split('/');
if (file.length > 65) {
//substring title.
start = file.length - 65;
file = "..." + file.substring(file.indexOf("/", (start + 1)));
}
$("#edit_info").append("Current file: " + file);
$("a#option").show();
editor.getSession().setValue(data.result);
setEditMode(name[name.length - 1]);
edit = true;
} else {
$("#error").Popup(data.result, {type: 'error', duration: 5000});
}
send = false;
}
});
} else {
$("#edit_info").empty();
$("#edit_info").append("No file selected");
$("a#option").hide();
editor.getSession().setValue("");
}
return;
}
$("#clearselect").click(function(){
$("#info").empty();
$("#info").append("Select directory or nothing for root directory...");
$("input#subfolder").val("");
$("#edit_info").empty();
$("#edit_info").append("No file selected");
editor.getSession().setValue("");
$("#md5sum").empty();
$("a#option").hide();
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;
});
function getmd5sum(){ function setDetailBox() {
var file = $("input#subfolder").val(); var state = $("#details_box").css("display");
if (send) return; if (state === "none") {
send =true $("#details_box").slideDown("normal");
$.ajax({ $("#details_head").removeClass("hide");
type: "POST", $("#details_head").addClass("show");
url: $SCRIPT_ROOT + '/getmd5sum', } else {
data: {file: $("input#subfolder").val()}, $("#details_box").slideUp("normal");
success: function(data){ $("#details_head").removeClass("show");
if(data.code == 1){ $("#details_head").addClass("hide");
$("#md5sum").empty(); }
$("#md5sum").append('md5sum : <span>' + data.result + '</span>'); }
}
else{
$("#error").Popup(data.result, {type:'error', duration:5000});
}
send = false;
}
});
}
function switchContent(){ function switchContent() {
var root = projectDir; var root = projectDir;
if(!softwareDisplay){ if (!softwareDisplay) {
$("#switch").empty(); $("#switch").empty();
$("#switch").append("Switch to Software files"); $("#switch").append("Switch to Software files");
root = currentProject; root = currentProject;
} } else {
else{ $("#switch").empty();
$("#switch").empty(); $("#switch").append("Switch to Project files");
$("#switch").append("Switch to Project files"); }
} $('#fileTree').fileTree({ root: root, script: $SCRIPT_ROOT + script, folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function (file) {
$('#fileTree').fileTree({ root: root, script: $SCRIPT_ROOT + script, folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function(file) { selectFile(file);
selectFile(file); });
}); $("#info").empty();
$("#info").empty(); $("#info").append("Select directory or nothing for root directory...");
$("#info").append("Select directory or nothing for root directory..."); $("input#subfolder").val("");
$("input#subfolder").val(""); }
}
function setDetailBox(){ function getmd5sum() {
var state = $("#details_box").css("display"); var file = $("input#subfolder").val();
if (state == "none"){ if (send) {
$("#details_box").slideDown("normal"); return;
$("#details_head").removeClass("hide"); }
$("#details_head").addClass("show"); send = true;
} $.ajax({
else{ type: "POST",
$("#details_box").slideUp("normal"); url: $SCRIPT_ROOT + '/getmd5sum',
$("#details_head").removeClass("show"); data: {file: $("input#subfolder").val()},
$("#details_head").addClass("hide"); 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 selectFile(file){ function setDevelop(developList) {
$("#info").empty(); if (developList === null || developList.length <= 0) {
$("#info").append(file); return;
$("input#subfolder").val(file); }
$("#md5sum").empty(); editor.navigateFileStart();
path = ""; editor.find('buildout', {caseSensitive: true, wholeWord: true});
send = false; if (!editor.getSelectionRange().isEmpty()) {
edit = false; //editor.find("",{caseSensitive: true,wholeWord: true,regExp: true});
if(file.substr(-1) != "/"){ //if (!editor.getSelectionRange().isEmpty()) {
$.ajax({ //alert("found");
type: "POST", //}
url: $SCRIPT_ROOT + '/getFileContent', //else{alert("no found");
data: {file: file}, //}
success: function(data){ } else {
if(data.code == 1){ $("#error").Popup("Can not found part [buildout]! Please make sure that you have a cfg file", {type: 'alert', duration: 3000});
$("#edit_info").empty(); return;
var name = file.split('/'); }
if(file.length > 65){ editor.navigateLineEnd();
//substring title. $.post($SCRIPT_ROOT + "/getPath", {file: developList.join("#")}, function (data) {
var start = file.length - 65; var result, i;
file = "..." + file.substring(file.indexOf("/", (start + 1))); if (data.code === 1) {
} result = data.result.split('#');
$("#edit_info").append("Current file: " + editor.insert("\ndevelop =\n\t" + result[0] + "\n");
file); for (i = 1; i < result.length; i += 1) {
$("a#option").show(); editor.insert("\t" + result[i] + "\n");
editor.getSession().setValue(data.result); }
setEditMode(name[name.length - 1]); }
edit = true; })
} .error(function () {})
else{ .complete(function () {});
$("#error").Popup(data.result, {type:'error', duration:5000}); editor.insert("\n");
} }
send = false;
}
});
}
else{
$("#edit_info").empty();
$("#edit_info").append("No file selected");
$("a#option").hide();
editor.getSession().setValue("");
}
return;
}
function setEditMode(file){
var CurentMode = require("ace/mode/text").Mode; editor.setTheme("ace/theme/crimson_editor");
editor.getSession().setMode(new CurentMode());
for (var i=0; i< modes.length; i++){ CurrentMode = require("ace/mode/text").Mode;
if(modes[i].extRe.test(file)){ editor.getSession().setMode(new CurrentMode());
editor.getSession().setMode(modes[i].mode); editor.getSession().setTabSize(2);
set = true; editor.getSession().setUseSoftTabs(true);
break; editor.renderer.setHScrollBarAlwaysVisible(false);
}
} Mode = function (name, desc, Clazz, extensions) {
} this.name = name;
function setDevelop(developList){ this.desc = desc;
if (developList==null || developList.length <= 0) return; this.clazz = Clazz;
editor.navigateFileStart(); this.mode = new Clazz();
editor.find('buildout',{caseSensitive: true,wholeWord: true}); this.mode.name = name;
if(!editor.getSelectionRange().isEmpty()){
//editor.find("",{caseSensitive: true,wholeWord: true,regExp: true}); this.extRe = new RegExp("^.*\\.(" + extensions.join("|") + ")$");
//if(!editor.getSelectionRange().isEmpty()){ };
//alert("found"); modes = [
//} new Mode("php", "PHP", require("ace/mode/php").Mode, ["php", "in", "inc"]),
//else{alert("no found"); new Mode("python", "Python", require("ace/mode/python").Mode, ["py"]),
//} new Mode("buildout", "Python Buildout config", require("ace/mode/buildout").Mode, ["cfg"])
} ];
else{ $('#fileTree').fileTree({ root: projectDir, script: $SCRIPT_ROOT + script, folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function (file) {
$("#error").Popup("Can not found part [buildout]! Please make sure that you have a cfg file", {type:'alert', duration:3000}); selectFile(file);
return; });
} setDetailBox();
editor.navigateLineEnd(); $("#add").click(function () {
$.post($SCRIPT_ROOT+"/getPath", {file:developList.join("#")}, function(data) { var path = softwareDisplay ? projectDir : currentProject;
if(data.code==1){ if (send) {
var result = data.result.split('#'); return false;
editor.insert("\ndevelop =\n\t" + result[0] + "\n"); }
for(var i=1; i<result.length; i++) if ($("input#file").val() === "" || $("input#file").val() === "Enter name here...") {
editor.insert("\t" + result[i] + "\n"); $("#error").Popup("Please enter your file or folder name", {type: 'alert', duration: 3000});
} return false;
}) }
.error(function() { }) if ($("input#subfolder").val() !== "") {
.complete(function(){}); path = $("input#subfolder").val();
editor.insert("\n"); }
} path = path + "/" + $("input#file").val();
}); send = true;
\ No newline at end of file $.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/createFile',
data: "file=" + path + "&type=" + $("#type").val(),
success: function (data) {
if (data.code === 1) {
switchContent();
$("input#file").val("");
$("#flash").fadeOut('normal');
$("#flash").empty();
$("#info").empty();
$("#info").append("Select parent directory or nothing for root...");
$("input#subfolder").val("");
} else {
$("#error").Popup(data.result, {type: 'error', duration: 5000});
}
send = false;
}
});
return false;
});
$("#save").click(function () {
if (!edit) {
$("#error").Popup("Please select the file to edit", {type: 'alert', duration: 3000});
return false;
}
if (send) {
return false;
}
send = true;
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/saveFileContent',
data: {
file: $("input#subfolder").val(),
content: editor.getSession().getValue()
},
success: function (data) {
if (data.code === 1) {
$("#error").Popup("File saved succefuly!", {type: 'confirm', duration: 3000});
} else {
$("#error").Popup(data.result, {type: 'error', duration: 5000});
}
send = false;
}
});
return false;
});
$("#details_head").click(function () {
setDetailBox();
});
$("#switch").click(function () {
softwareDisplay = !softwareDisplay;
switchContent();
return false;
});
$("#getmd5").click(function () {
getmd5sum();
return false;
});
$("#clearselect").click(function () {
$("#info").empty();
$("#info").append("Select directory or nothing for root directory...");
$("input#subfolder").val("");
$("#edit_info").empty();
$("#edit_info").append("No file selected");
editor.getSession().setValue("");
$("#md5sum").empty();
$("a#option").hide();
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() { /*jslint undef: true */
openedlogpage = $("input#type").val(); /*global $, document, window, processState, getCookie, setCookie, setSpeed, $SCRIPT_ROOT */
updatelogBox(); /*global openedlogpage: true */
var state = getCookie("autoUpdate"); /* vim: set et sts=4: */
$("#logheader").click(function(){ $(document).ready(function () {
setupBox(); "use strict";
});
$("#manual").change(function(){ function setupBox() {
setCookie("autoUpdate", "manual"); var state = $("#logconfigbox").css("display");
if ($("input#type").val() == "instance"){location.href = $SCRIPT_ROOT + "/viewInstanceLog";} if (state === "none") {
else{location.href = $SCRIPT_ROOT + "/viewSoftwareLog";} $("#logconfigbox").slideDown("normal");
}); $("#logheader").removeClass("hide");
$("#live").change(function(){ $("#logheader").addClass("show");
updatelogBox();$("#logconfigbox").find("input:radio").attr('checked', false);$("#live").attr('checked', true); } else {
setSpeed(100);setCookie("autoUpdate", "live");openedlogpage = $("input#type").val();}); $("#logconfigbox").slideUp("normal");
$("#slow").change(function(){ $("#logheader").removeClass("show");
updatelogBox();$("#logconfigbox").find("input:radio").attr('checked', false);$("#slow").attr('checked', true); $("#logheader").addClass("hide");
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");
} }
}
function updatelogBox() {
function updatelogBox(){ if (processState === "Stopped" || processState === "Checking" || $("#manual").is(":checked")) {
if(processState=="Stopped" || processState=="Checking" || $("#manual").is(":checked")){ $("#salpgridLog").hide();
$("#salpgridLog").hide(); $("#manualLog").show();
$("#manualLog").show(); $("#manualLog")
$("#manualLog") .scrollTop($("#manualLog")[0].scrollHeight - $("#manualLog").height());
.scrollTop($("#manualLog")[0].scrollHeight - $("#manualLog") } else {
.height()); $("#salpgridLog").show();
$("#manualLog").hide();
}
} }
else{
$("#salpgridLog").show(); openedlogpage = $("input#type").val();
$("#manualLog").hide(); 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): ...@@ -26,7 +26,7 @@ class NetworkcacheParser(OptionParser):
""" """
def __init__(self, usage=None, version=None): def __init__(self, usage=None, version=None):
""" """
Initialize all options possibles. Initialize all possible options.
""" """
OptionParser.__init__(self, usage=usage, version=version, OptionParser.__init__(self, usage=usage, version=version,
option_list=[ 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