From 7fe908c50c8dbc5cc05f571dbe11d66141caacd4 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 14 Nov 2013 09:01:22 -0500
Subject: [PATCH] Cleaning up code to match coding guidelines
---
interface/web/js/scrigo.js.php | 97 ++++++++++++++++++++++++------------------------
1 files changed, 48 insertions(+), 49 deletions(-)
diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php
index 418b26b..197c46f 100644
--- a/interface/web/js/scrigo.js.php
+++ b/interface/web/js/scrigo.js.php
@@ -1,13 +1,13 @@
<?php
- session_start();
- include('../../lib/config.inc.php');
- header('Content-Type: text/javascript; charset=utf-8'); // the config file sets the content type header so we have to override it here!
- require_once('../../lib/app.inc.php');
- $lang = (isset($_SESSION['s']['language']) && $_SESSION['s']['language'] != '')?$_SESSION['s']['language']:'en';
- include_once(ISPC_ROOT_PATH.'/web/strengthmeter/lib/lang/'.$lang.'_strengthmeter.lng');
-
- $app->uses('ini_parser,getconf');
- $server_config_array = $app->getconf->get_global_config();
+session_start();
+include '../../lib/config.inc.php';
+header('Content-Type: text/javascript; charset=utf-8'); // the config file sets the content type header so we have to override it here!
+require_once '../../lib/app.inc.php';
+$lang = (isset($_SESSION['s']['language']) && $_SESSION['s']['language'] != '')?$_SESSION['s']['language']:'en';
+include_once ISPC_ROOT_PATH.'/web/strengthmeter/lib/lang/'.$lang.'_strengthmeter.lng';
+
+$app->uses('ini_parser,getconf');
+$server_config_array = $app->getconf->get_global_config();
?>
var pageFormChanged = false;
var tabChangeWarningTxt = '';
@@ -21,10 +21,10 @@
redirect = '';
function reportError(request) {
- /* Error reporting is disabled by default as some browsers like safari
- sometimes throw errors when a ajax request is delayed even if the
+ /* Error reporting is disabled by default as some browsers like safari
+ sometimes throw errors when a ajax request is delayed even if the
ajax request worked. */
-
+
/*alert(request);*/
}
@@ -39,7 +39,7 @@
if($server_config_array['misc']['use_loadindicator'] == 'y'){
?>
requestsRunning += 1;
-
+
if(requestsRunning < 2) {
var indicator = jQuery('#ajaxloader');
if(indicator.length < 1) {
@@ -49,7 +49,7 @@
var parent = jQuery('#content');
if(parent.length < 1) return;
indicatorCompleted = false;
-
+
var atx = parent.offset().left + 150; //((parent.outerWidth(true) - indicator.outerWidth(true)) / 2);
var aty = parent.offset().top + 150;
indicator.css( {'left': atx, 'top': aty } ).fadeIn('fast', function() {
@@ -84,9 +84,9 @@
}
function loadContentRefresh(pagename) {
-
+
if(document.getElementById('refreshinterval').value > 0) {
- var pageContentObject2 = jQuery.ajax({ type: "GET",
+ var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename,
data: "refresh="+document.getElementById('refreshinterval').value,
dataType: "html",
@@ -109,8 +109,8 @@
}
function capp(module, redirect) {
- var submitFormObj = jQuery.ajax({ type: "GET",
- url: "capp.php",
+ var submitFormObj = jQuery.ajax({ type: "GET",
+ url: "capp.php",
data: "mod="+module+((redirect != undefined) ? '&redirect='+redirect : ''),
dataType: "html",
beforeSend: function() {
@@ -151,12 +151,12 @@
passwordObj.focus();
return;
}
-
+
$('#dummy_username').val(userNameObj.value);
$('#dummy_passwort').val(passwordObj.value);
$('#dummy_login_form').submit();
- var submitFormObj = jQuery.ajax({ type: "POST",
+ var submitFormObj = jQuery.ajax({ type: "POST",
url: "content.php",
data: jQuery('#'+formname).serialize(),
dataType: "html",
@@ -193,11 +193,11 @@
}
document.getElementById('footer').innerHTML = 'Powered by <a href="http://www.ispconfig.org" target="_blank">ISPConfig</a>';
*/
-
+
}
function submitForm(formname,target) {
- var submitFormObj = jQuery.ajax({ type: "POST",
+ var submitFormObj = jQuery.ajax({ type: "POST",
url: target,
data: jQuery('#'+formname).serialize(),
dataType: "html",
@@ -235,7 +235,7 @@
function submitFormConfirm(formname,target,confirmation) {
var successMessage = arguments[3];
if(window.confirm(confirmation)) {
- var submitFormObj = jQuery.ajax({ type: "POST",
+ var submitFormObj = jQuery.ajax({ type: "POST",
url: target,
data: jQuery('#'+formname).serialize(),
dataType: "html",
@@ -266,10 +266,10 @@
}
}
-function submitUploadForm(formname,target) {
+function submitUploadForm(formname,target) {
var handleResponse = function(loadedFrame) {
var response, responseStr = loadedFrame.contentWindow.document.body.innerHTML;
-
+
try {
response = JSON.parse(responseStr);
} catch(e) {
@@ -285,9 +285,9 @@
msg = msg+'<div id="errorMsg">'+errormsg+'</div>';
}
return msg;
-
+
};
-
+
var frame_id = 'ajaxUploader-iframe-' + Math.round(new Date().getTime() / 1000);
jQuery('body').after('<iframe width="0" height="0" style="display:none;" name="'+frame_id+'" id="'+frame_id+'"/>');
jQuery('input[type="file"]').closest("form").attr({target: frame_id, action: target}).submit();
@@ -309,7 +309,7 @@
function loadContent(pagename) {
var params = arguments[1];
- var pageContentObject2 = jQuery.ajax({ type: "GET",
+ var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename,
data: (params ? params : null),
dataType: "html",
@@ -328,7 +328,7 @@
//var reponse = jQuery(jqXHR.responseText);
//var reponseScript = reponse.filter("script");
//jQuery.each(reponseScript, function(idx, val) { eval(val.text); } );
-
+
jQuery('#pageContent').html(jqXHR.responseText);
onAfterContentLoad();
pageFormChanged = false;
@@ -344,7 +344,7 @@
function loadInitContent() {
- var pageContentObject = jQuery.ajax({ type: "GET",
+ var pageContentObject = jQuery.ajax({ type: "GET",
url: "content.php",
data: "s_mod=login&s_pg=index",
dataType: "html",
@@ -367,7 +367,7 @@
reportError('Ajax Request was not successful. 114');
}
});
-
+
loadMenus();
keepalive();
setTimeout("setFocus()",1000);
@@ -383,7 +383,7 @@
function loadMenus() {
- var sideNavObject = jQuery.ajax({ type: "GET",
+ var sideNavObject = jQuery.ajax({ type: "GET",
url: "nav.php",
data: "nav=side",
dataType: "html",
@@ -399,8 +399,8 @@
reportError('Ajax Request was not successful. 115');
}
});
-
- var topNavObject = jQuery.ajax({ type: "GET",
+
+ var topNavObject = jQuery.ajax({ type: "GET",
url: "nav.php",
data: "nav=top",
dataType: "html",
@@ -422,7 +422,7 @@
function changeTab(tab,target,force) {
//document.forms[0].next_tab.value = tab;
document.pageForm.next_tab.value = tab;
-
+
var idel = jQuery('form#pageForm').find('[name="id"]');
var id = null;
if(idel.length > 0) id = idel.val();
@@ -448,7 +448,7 @@
}
}
}
-
+
function del_record(link,confirmation) {
if(window.confirm(confirmation)) {
loadContent(link);
@@ -462,7 +462,7 @@
}
function loadContentInto(elementid,pagename) {
- var pageContentObject2 = jQuery.ajax({ type: "GET",
+ var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename,
dataType: "html",
beforeSend: function() {
@@ -480,7 +480,7 @@
}
function loadOptionInto(elementid,pagename) {
- var pageContentObject2 = jQuery.ajax({ type: "GET",
+ var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename,
dataType: "html",
beforeSend: function() {
@@ -508,7 +508,7 @@
}
function keepalive() {
- var pageContentObject3 = jQuery.ajax({ type: "GET",
+ var pageContentObject3 = jQuery.ajax({ type: "GET",
url: "keepalive.php",
dataType: "html",
success: function(data, textStatus, jqXHR) {
@@ -563,24 +563,24 @@
pass_result(0);
return;
}
-
+
if (length < 5) {
pass_result(1);
return;
}
-
+
if (pass_contains(password, "ABCDEFGHIJKLNMOPQRSTUVWXYZ")) {
points += 1;
}
-
+
if (pass_contains(password, "0123456789")) {
points += 1;
}
-
+
if (pass_contains(password, "`~!@#$%^&*()_+|\=-[]}{';:/?.>,<\" ")) {
points += 1;
}
-
+
if (points == 0) {
if (length >= 5 && length <=6) {
pass_result(1);
@@ -671,7 +671,7 @@
var $el = jQuery('#template_additional_list ul').find('li[rel="' + tpl_id + '"]').eq(0); // only the first
var addTplText = $el.text();
$el.remove();
-
+
var oldVal = tpl_add.split('/');
var newVal = new Array();
for(var i = 0; i < oldVal.length; i++) {
@@ -695,7 +695,7 @@
}
return this;
});
-
+
var newVal = tpl_add;
var repl = new RegExp('(^|\/)' + addTplId + '(\/|$)');
newVal = newVal.replace(repl, '');
@@ -705,7 +705,7 @@
} else {
alert('no additional template selcted');
}
-
+
}
function getInternetExplorerVersion() {
@@ -796,7 +796,7 @@
var template2 = jQuery(this).siblings(':input');
template2.insertAtCaret(placeholderContentText);
});
-
+
jQuery.fn.extend({
insertAtCaret: function(myValue){
return this.each(function(i) {
@@ -823,4 +823,3 @@
})
}
});
-
--
Gitblit v1.9.1