webbuild: fix file upload

This commit is contained in:
Silvan Calarco 2015-04-18 14:59:11 +02:00
parent c211d764be
commit df488c625c
2 changed files with 22 additions and 22 deletions

View File

@ -48,23 +48,25 @@ print "<script>";
print "var user = \"" . wp_get_current_user()->user_login . "\";"; print "var user = \"" . wp_get_current_user()->user_login . "\";";
print "var user_email = \"" . wp_get_current_user()->user_email . "\";"; print "var user_email = \"" . wp_get_current_user()->user_email . "\";";
print "var secret = \"" . wp_get_current_user()->user_pass . "\";"; print "var secret = \"" . wp_get_current_user()->user_pass . "\";";
print "</script>"; print "</script>" . PHP_EOL;
print '<link rel="shortcut icon" type="image/x-icon" href="' . get_stylesheet_directory_uri() . '/images/webbuild.ico" />'; print '<link rel="shortcut icon" type="image/x-icon" href="' . get_stylesheet_directory_uri() . '/images/webbuild.ico" />' . PHP_EOL;
# styles needed by jScrollPane # styles needed by jScrollPane
print '<link type="text/css" href="' . get_stylesheet_directory_uri() . '/scripts/jquery.jscrollpane.css" rel="stylesheet" media="all" >'; print '<link type="text/css" href="' . get_stylesheet_directory_uri() . '/scripts/jquery.jscrollpane.css" rel="stylesheet" media="all" >' . PHP_EOL;
# jQuery # jQuery
print '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/scripts/jquery.js"></script>'; print '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/scripts/jquery.js"></script>' . PHP_EOL;
# the mousewheel plugin - optional to provide mousewheel suppor # the mousewheel plugin - optional to provide mousewheel suppor
print '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/scripts/jquery.mousewheel.js"></script>'; print '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/scripts/jquery.mousewheel.js"></script>' . PHP_EOL;
# the jScrollPane script # the jScrollPane script
print '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/scripts/jquery.jscrollpane.min.js"></script>'; print '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/scripts/jquery.jscrollpane.min.js"></script>' . PHP_EOL;
# webbuild css # webbuild css
print '<link rel="stylesheet" type="text/css" href="' . get_stylesheet_directory_uri() . '/styles/webbuild.css">'; print '<link rel="stylesheet" type="text/css" href="' . get_stylesheet_directory_uri() . '/styles/webbuild.css">' . PHP_EOL;
# socialbox # socialbox
print '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/scripts/socialbox.js"></script>'; print '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/scripts/socialbox.js"></script>' . PHP_EOL;
# webbuild
#print '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/scripts/webbuild.js"></script>';
# distroquery # distroquery
print '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/scripts/distroquery.js"></script>'; print '<script type="text/javascript" src="' . get_stylesheet_directory_uri() . '/scripts/distroquery.js"></script>' . PHP_EOL;
$file = fopen(get_stylesheet_directory() . "/webbuild.js.inc", "r"); $file = fopen(get_stylesheet_directory() . "/webbuild.js.inc", "r");
print fread($file, 20000); print fread($file, 20000);

View File

@ -36,18 +36,17 @@ function editorChanged() {
} }
function ajax_getvalues(request,confirm) { function ajax_getvalues(request,confirm) {
var url = "/cgi-bin/webbuild.cgi"; var url;
// limit to this function the scope of xmlhttp to avoid sockets left pending // limit to this function the scope of xmlhttp to avoid sockets left pending
var xmlhttp; var xmlhttp;
if (host != undefined) { if (host != undefined) {
webbuildhost=host; webbuildhost=host;
} else { } else {
webbuildhost="buildvm01"; alert("ERROR: webbuildhost is not defined!");
return;
} }
if (typeof webbuildhost != 'undefined' && webbuildhost != "") {
url = "/cgi-bin/webbuild-" + webbuildhost + ".cgi"; url = "/cgi-bin/webbuild-" + webbuildhost + ".cgi";
}
if (confirm) { if (confirm) {
document.getElementById("status").innerHTML = document.getElementById("status").innerHTML =
@ -159,17 +158,16 @@ function ajax_getvalues(request,confirm) {
// ajaxFileUpload // ajaxFileUpload
function ajaxFileUpload(request) function ajaxFileUpload(request)
{ {
/* $("#loading") if (host != undefined) {
.ajaxStart(function(){ webbuildhost=host;
$(this).show(); } else {
}) alert("Error: webbuildhost undefined!");
.ajaxComplete(function(){ return;
$(this).hide(); }
});*/
$.ajaxFileUpload $.ajaxFileUpload
( (
{ {
url:'/cgi-bin/webbuild.cgi', url:'/cgi-bin/webbuild-' + webbuildhost + '.cgi',
secureuri:false, secureuri:false,
fileElementId:'fileToUpload', fileElementId:'fileToUpload',
dataType: 'xml', dataType: 'xml',