Support for webbuild status page using autodist cgi

This commit is contained in:
Silvan Calarco 2014-11-23 18:16:02 +01:00
parent c62952bdae
commit 9bc3238b83
9 changed files with 151 additions and 38 deletions

9
cgi-bin/autodist Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
echo "\
Content-Type: text/xml
Pragma: no-cache
"
#curl "http://www2.openmamba.org/cgi-bin/autodist-internal.cgi?$QUERY_STRING" --stderr /dev/null
curl "http://buildvm01.openmamba.org/cgi-bin/autodist?$QUERY_STRING&FORMAT=xml" --stderr /dev/null

View File

@ -103,7 +103,7 @@ add_shortcode('openmamba_download', 'openmamba_download_func');
function openmamba_webbuild_func( $atts ) { function openmamba_webbuild_func( $atts ) {
$a = shortcode_atts( array( $a = shortcode_atts( array(
'host' => 'buildvm02' 'host' => 'buildvm01'
), $atts ); ), $atts );
print '<script>host="' . $a['host'] . '"</script>'; print '<script>host="' . $a['host'] . '"</script>';
@ -114,6 +114,19 @@ function openmamba_webbuild_func( $atts ) {
} }
add_shortcode('openmamba_webbuild', 'openmamba_webbuild_func'); add_shortcode('openmamba_webbuild', 'openmamba_webbuild_func');
function openmamba_webbuild_status_func() {
$urlargspos = strpos($_SERVER[REQUEST_URI], '?');
if ($urlargspos > 0) {
$urlargs = substr($_SERVER[REQUEST_URI], $urlargspos);
}
// print "<table width=\"100%\" style=\"border:0;\"><tr><td>";
print "<div id=\"noajax_msg\"><p>Il supporto per AJAX non è abilitato nel tuo browser. L'aggiornamento live non sarà disponibile, premi Ricarica per aggiornare la pagina.</p></div>";
print "<span class=webbuild id=\"output\">Caricamento in corso, attendere...</span>";
print "<script>webbuild_status_getvalues(\"" . $urlargs . "\");</script>";//</td></tr></table>";
}
add_shortcode('openmamba_webbuild_status', 'openmamba_webbuild_status_func');
// bbpress tag cloud // bbpress tag cloud
add_filter('widget_tag_cloud_args','set_number_tags'); add_filter('widget_tag_cloud_args','set_number_tags');
function set_number_tags($args) { function set_number_tags($args) {

View File

@ -72,7 +72,7 @@ fclose($file);
wp_head(); wp_head();
# webbuild css # webbuild css
print '<link rel="stylesheet" type="text/css" href="' . get_stylesheet_directory_uri() . '/styles/webbuild-post.css">'; print '<link rel="stylesheet" type="text/css" href="' . get_stylesheet_directory_uri() . '/styles/webbuild-post.css"/>';
?> ?>
</head> </head>
@ -81,7 +81,6 @@ print '<link rel="stylesheet" type="text/css" href="' . get_stylesheet_directory
<?php responsive_container(); // before container hook ?> <?php responsive_container(); // before container hook ?>
<div id="container" class="hfeed"> <div id="container" class="hfeed">
<span id="status" class="webbuild">Caricamento in corso, attendere...</span>
<?php responsive_header(); // before header hook ?> <?php responsive_header(); // before header hook ?>
<div class="skip-container cf"> <div class="skip-container cf">

View File

@ -6,10 +6,7 @@ a.webbuild:visited { color:#0b0600; text-decoration: none; }
a.webbuild:active { color:#0b0600; text-decoration: none; } a.webbuild:active { color:#0b0600; text-decoration: none; }
a.webbuild:hover { text-decoration: underline; } a.webbuild:hover { text-decoration: underline; }
hr { margin:0; color:black; background: #aaaaaa; } hr { margin:0; color:black; background: #aaaaaa; }
label { white-space:nowrap; text-decoration:none; font-weight:initial; }
label {
white-space:nowrap;
}
.webbuild input { .webbuild input {
font-size: 8pt; font-size: 8pt;
@ -24,6 +21,7 @@ select {
padding: 0; padding: 0;
margin: 1px; margin: 1px;
height: 1.5em; height: 1.5em;
max-width: 98%;
background-color: buttonface; background-color: buttonface;
} }

View File

@ -1,18 +1,18 @@
.boldbutton { .boldbutton {
font-weight: bold; font-weight: bold !important;
} }
.redbutton { .redbutton {
color: red; color: red !important;
} }
.redbutton[disabled] { .redbutton[disabled] {
color: lightgray; color: lightgray !important;
} }
.redboldbutton { .redboldbutton {
color: red; color: red !important;
font-weight: bold; font-weight: bold !important;
} }
.redboldbutton[disabled] { .redboldbutton[disabled] {
color: lightgray; color: lightgray !important;
} }
.screencontainer { .screencontainer {
text-align:center; text-align:center;
@ -135,8 +135,7 @@
color: #000000; color: #000000;
margin:0px; margin:0px;
} }
.webbuild td { .webbuild td { font-size: 8pt; border:0; }
font-size: 8pt;
} }
.webbuild table { font-size: 9pt; font-family: liberationsans, freesans, arial, verdana, sans-serif; background-color: rgb(255, 255, 255); } .webbuild table { font-size: 9pt; font-family: liberationsans, freesans, arial, verdana, sans-serif; background-color: rgb(255, 255, 255); }
.webbuild img { border: 0; margin: 0px; vertical-align:middle; } .webbuild img { border: 0; margin: 0px; vertical-align:middle; }
@ -306,11 +305,6 @@
margin: 0px; margin: 0px;
border:1px solid #2b6600; border:1px solid #2b6600;
} }
.socialbox div { margin-bottom:1px; }
.socialbox div { .socialbox hr { margin: 0; }
margin-bottom:1px; .downloadbox table { font-size: 9pt; border:1px solid #2b6600; margin: 4px; padding:4; background-color: #e0f2d0; }
}
.socialbox hr {
margin: 0;
}

View File

@ -21,6 +21,19 @@ Template Name: Webbuild Page (no sidebar, no title)
* @since available since Release 1.0 * @since available since Release 1.0
*/ */
print "<script>window.onbeforeunload = function (e) { e = e || window.event;
// For IE and Firefox prior to version 4
if (e) {
e.returnValue = 'La sessione di Webbuild verrà chiusa.';
}
// For Safari
return 'La sessione di Webbuild verrà chiusa.';
};
</script>
";
get_header("webbuild"); ?> get_header("webbuild"); ?>
<div id="content-full" class="grid col-940"> <div id="content-full" class="grid col-940">

70
webbuild-status-page.php Normal file
View File

@ -0,0 +1,70 @@
<?php
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) {
exit;
}
/**
* Full Content Template
*
Template Name: Webbuild Status Page (no sidebar, no title)
*
* @file webbuild-status-page.php
* @package Responsive
* @author Emil Uzelac
* @copyright 2003 - 2014 CyberChimps
* @license license.txt
* @version Release: 1.0
* @filesource wp-content/themes/responsive/webbuild-page.php
* @link http://codex.wordpress.org/Theme_Development#Pages_.28page.php.29
* @since available since Release 1.0
*/
get_header("webbuild"); ?>
<div id="content-full" class="grid col-940">
<?php if ( have_posts() ) : ?>
<?php while( have_posts() ) : the_post(); ?>
<?php get_template_part( 'loop-header', get_post_type() ); ?>
<?php responsive_entry_before(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php responsive_entry_top(); ?>
<!--?php get_template_part( 'post-meta', get_post_type() ); ?-->
<div class="post-entry">
<?php the_content( __( 'Read more &#8250;', 'responsive' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="pagination">' . __( 'Pages:', 'responsive' ), 'after' => '</div>' ) ); ?>
</div>
<!-- end of .post-entry -->
<?php get_template_part( 'post-data', get_post_type() ); ?>
<?php responsive_entry_bottom(); ?>
</div><!-- end of #post-<?php the_ID(); ?> -->
<?php responsive_entry_after(); ?>
<?php responsive_comments_before(); ?>
<?php comments_template( '', true ); ?>
<?php responsive_comments_after(); ?>
<?php
endwhile;
get_template_part( 'loop-nav', get_post_type() );
else :
get_template_part( 'loop-no-posts', get_post_type() );
endif;
?>
</div><!-- end of #content-full -->
<?php get_footer(); ?>

View File

@ -1,3 +1,4 @@
<span id="status" class="webbuild">Caricamento in corso, attendere...</span>
<span id=webbuild> <span id=webbuild>
<div class=webbuild id=container style="position:relative;width:894px;padding:0;margin:0;height:auto;top:0;left:0;"> <div class=webbuild id=container style="position:relative;width:894px;padding:0;margin:0;height:auto;top:0;left:0;">
<form id=webbuildform name=webbuild method=post> <form id=webbuildform name=webbuild method=post>

View File

@ -1,16 +1,3 @@
<script>
window.onbeforeunload = function (e) {
e = e || window.event;
// For IE and Firefox prior to version 4
if (e) {
e.returnValue = 'La sessione di Webbuild verrà chiusa.';
}
// For Safari
return 'La sessione di Webbuild verrà chiusa.';
};
</script>
<!-- styles and scripts needed by CodeMirror editor --> <!-- styles and scripts needed by CodeMirror editor -->
<script src="http://webbuild.openmamba.org/scripts/codemirror/lib/codemirror.js"></script> <script src="http://webbuild.openmamba.org/scripts/codemirror/lib/codemirror.js"></script>
<link rel="stylesheet" href="http://webbuild.openmamba.org/scripts/codemirror/lib/codemirror.css"> <link rel="stylesheet" href="http://webbuild.openmamba.org/scripts/codemirror/lib/codemirror.css">
@ -98,7 +85,7 @@ function ajax_getvalues(request,confirm) {
if (xmlhttp.responseXML == undefined) { if (xmlhttp.responseXML == undefined) {
// && xmlhttp.responseText == undefined) { // && xmlhttp.responseText == undefined) {
document.getElementById("status").innerHTML = ""; document.getElementById("status").innerHTML = "";
document.getElementById("output").innerHTML = "ERROR: there was a network connection problem."; document.getElementById("output").innerHTML = "<br>ERROR: there was a network connection problem.";
xmlhttp.abort(); xmlhttp.abort();
return; return;
} }
@ -132,7 +119,6 @@ function ajax_getvalues(request,confirm) {
} }
} }
} }
//alert("nodes done");
document.getElementById("webbuildform").disabled = false; document.getElementById("webbuildform").disabled = false;
document.getElementById("status").innerHTML = ""; document.getElementById("status").innerHTML = "";
} }
@ -217,4 +203,34 @@ function ajaxFileUpload(request)
) )
return false; return false;
} }
var webbuild_status_lastupdate = 0;
var webbuild_status_reloadtime = 60000;
function webbuild_status_getvalues() {
var url = "/cgi-bin/autodist";
var xmlhttp;
if (window.location.href.indexOf("?") > 0) url += "?"+window.location.href.replace(/.*\?/,"");
if (window.XMLHttpRequest)
xmlhttp = new XMLHttpRequest();
else if (window.ActiveXObject)
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
else
return;
document.getElementById("noajax_msg").innerHTML = "";
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState != 4)
return;
var xmldoc = xmlhttp.responseXML.documentElement;
if (xmldoc == undefined) {
return;
}
document.getElementById("output").innerHTML = xmldoc.getElementsByTagName("output")[0].childNodes[0].nodeValue;
webbuild_status_reloadtime = xmldoc.getElementsByTagName("reloadtime")[0].childNodes[0].nodeValue;
webbuild_status_lastupdate = (+new Date());
}
xmlhttp.open("GET", url, true);
xmlhttp.send(null);
setTimeout("webbuild_status_getvalues()", webbuild_status_reloadtime);
}
</script> </script>