290 lines
10 KiB
PHP
290 lines
10 KiB
PHP
|
<!--#set var="title" value="Interfaccia Web per lo sviluppo di openmamba" -->
|
||
|
<!--#set var="description" value="Crea e modifica RPM dal web con autodist" -->
|
||
|
<!--#set var="keywords" value="openmamba,autodist,autospec,makedist,ftbfs,sviluppatori,patch" -->
|
||
|
<!--#include virtual="/header.html" -->
|
||
|
<?php
|
||
|
if ( bb_is_user_logged_in() ) :
|
||
|
?>
|
||
|
<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>
|
||
|
<?php
|
||
|
endif;
|
||
|
?>
|
||
|
|
||
|
<!-- styles and scripts needed by CodeMirror editor -->
|
||
|
<script src="/scripts/codemirror/lib/codemirror.js"></script>
|
||
|
<link rel="stylesheet" href="/scripts/codemirror/lib/codemirror.css">
|
||
|
<script src="/scripts/codemirror/mode/rpm/spec/spec.js"></script>
|
||
|
<link rel="stylesheet" href="/scripts/codemirror/mode/rpm/spec/spec.css">
|
||
|
<script src="/scripts/codemirror/lib/util/search.js"></script>
|
||
|
<script src="/scripts/codemirror/lib/util/searchcursor.js"></script>
|
||
|
<script src="/scripts/codemirror/lib/util/dialog.js"></script>
|
||
|
<link rel="stylesheet" href="/scripts/codemirror/lib/util/dialog.css">
|
||
|
<script src="/scripts/webbuild/webbuild.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
<!--
|
||
|
var user = "<?php printf(__('%1$s'), bb_get_current_user_info( 'name' )); ?>";
|
||
|
var user_email = "<?php printf(__('%1$s'), bb_get_current_user_info( 'email' )); ?>";
|
||
|
var secret = "<?php
|
||
|
$user = $wp_users_object->get_user( bb_get_current_user_info( 'name' ), array( 'by' => 'login' ) );
|
||
|
printf(__('%1$s'), $user->user_pass); ?>";
|
||
|
var lastupdate = 0;
|
||
|
var reloadtime = 15000;
|
||
|
var editor;
|
||
|
var xmlhttp;
|
||
|
|
||
|
function clearid(id) {
|
||
|
document.getElementById(id).innerHTML = '';
|
||
|
xmlhttp.abort();
|
||
|
}
|
||
|
|
||
|
function editorChanged() {
|
||
|
if (document.getElementById('savebutton') != undefined)
|
||
|
document.getElementById('savebutton').disabled=false;
|
||
|
if (document.getElementById('sendrecreatesrpm') != undefined)
|
||
|
document.getElementById('sendrecreatesrpm').checked=true;
|
||
|
}
|
||
|
|
||
|
function ajax_getvalues(request,confirm) {
|
||
|
webbuildhost=document.getElementById("webbuildhost").value;
|
||
|
var url = "/cgi-bin/webbuild.cgi"
|
||
|
var xmlhttp;
|
||
|
if (typeof webbuildhost != 'undefined' && webbuildhost != "") {
|
||
|
url = "/cgi-bin/webbuild-" + webbuildhost + ".cgi";
|
||
|
}
|
||
|
|
||
|
if (confirm) {
|
||
|
document.getElementById("status").innerHTML =
|
||
|
'<div class=screencontainer><div class=opaquebackground></div>'+
|
||
|
'<div class=questionbox><div style="overflow:auto;max-height:200px;">'+decodeURIComponent(confirm)+'</div>'+
|
||
|
'<br><a href=# onclick=ajax_getvalues("'+request+'")>YES</a> <a href=# onclick=clearid("status")>NO</a></div></div>';
|
||
|
return;
|
||
|
}
|
||
|
document.getElementById("webbuildform").disabled = true;
|
||
|
|
||
|
if (request != "")
|
||
|
request=request+"&USER="+user+"&USER_EMAIL="+user_email+"&SECRET="+encodeURIComponent(secret);
|
||
|
else
|
||
|
request="USER="+user+"&USER_EMAIL="+user_email+"&SECRET="+encodeURIComponent(secret);
|
||
|
if (window.location.href.indexOf('?') > 0)
|
||
|
url = 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 = "";
|
||
|
|
||
|
document.getElementById("status").innerHTML =
|
||
|
'<div class=opaquebackground>'+
|
||
|
'<div style="text-align:left;color:white;position:absolute;left:0;top:0;" id=matrix class=matrix></div>'+
|
||
|
'<div style="position:absolute;left:50%;top:50%;"><img src="/images/wait.gif" title="Attendi..."</div>'+
|
||
|
'<div style="position:fixed;left:95%;top:95%;color:red;"><a href="javascript:clearid(\'status\');">[x] Close</a></div>'+
|
||
|
'</div>';
|
||
|
|
||
|
xmlhttp.onreadystatechange = function() {
|
||
|
if (xmlhttp.readyState < 4)
|
||
|
return;
|
||
|
if (xmlhttp.responseXML == undefined && xmlhttp.responseText == undefined) {
|
||
|
document.getElementById("status").innerHTML = "";
|
||
|
document.getElementById("output").innerHTML = "ERROR: there was a network connection problem." + xmlhttp.readyState + " " + xmlhttp.status;
|
||
|
xmlhttp.abort();
|
||
|
return;
|
||
|
}
|
||
|
var xmldoc = xmlhttp.responseXML.documentElement;
|
||
|
if (xmldoc == undefined) {
|
||
|
return;
|
||
|
}
|
||
|
var nodes = xmldoc.childNodes;
|
||
|
for (var i = 0; i < nodes.length; i++) {
|
||
|
if (nodes[i].nodeName == "title") {
|
||
|
document.title = nodes[i].childNodes[0].nodeValue;
|
||
|
} else if (document.getElementById(nodes[i].nodeName) != undefined) {
|
||
|
// var node = document.getElementById(nodes[i].nodeName)
|
||
|
//alert("replace " + node.nodeValue + "with " + nodes[i].childNodes[0].nodeValue);
|
||
|
// node = replaceHTML(node, nodes[i].childNodes[0].nodeValue);
|
||
|
$("#"+nodes[i].nodeName).html(nodes[i].childNodes[0].nodeValue);
|
||
|
spectext = document.getElementById("spectext");
|
||
|
if ((nodes[i].nodeName == "editor") && (spectext != undefined) && (spectext.parentNode != undefined))
|
||
|
{
|
||
|
editor = CodeMirror.fromTextArea(spectext,
|
||
|
{ lineNumbers: true,
|
||
|
tabSize: 4,
|
||
|
indentUnit: 4,
|
||
|
indentWithTabs: true,
|
||
|
onChange: function() { editorChanged(); }
|
||
|
});
|
||
|
} else if ((nodes[i].nodeName == "output") && (document.getElementById("outputbottom") != undefined)) {
|
||
|
document.getElementById("outputbottom").scrollTop = document.getElementById("outputbottom").scrollHeight;
|
||
|
} else if ((nodes[i].nodeName == "processes")) {
|
||
|
$(function() { $('.scroll-pane3').jScrollPane({scrollbarWidth:10}); });
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
//alert("nodes done");
|
||
|
document.getElementById("webbuildform").disabled = false;
|
||
|
document.getElementById("status").innerHTML = "";
|
||
|
}
|
||
|
|
||
|
xmlhttp.onprogress = function() {
|
||
|
var end = 0,to;
|
||
|
// save responseText length when entering the function
|
||
|
to = this.responseText.length - 1;
|
||
|
if (start < 0) {
|
||
|
start = this.responseText.substring(0,to).indexOf("<!-- SCROLL -->");
|
||
|
if (start >= 0) start+=15;
|
||
|
}
|
||
|
if (start >= 0) {
|
||
|
end = this.responseText.substring(start+currpos-15,to).indexOf("<!-- ENDSCROLL -->");
|
||
|
if (end >= 0) to = end;
|
||
|
if (to > start) {
|
||
|
var customscroll = document.getElementById("matrix").scrollTop <
|
||
|
(document.getElementById("matrix").scrollHeight - document.getElementById("matrix").clientHeight);
|
||
|
document.getElementById("matrix").innerHTML =
|
||
|
"<div id=matrixoutput><pre>" + this.responseText.substring(start,to).replace("</pre>","</pre>") + "</pre></div>";
|
||
|
currpos = document.getElementById("matrixoutput").innerHTML.length;
|
||
|
if (!customscroll)
|
||
|
document.getElementById("matrix").scrollTop = document.getElementById("matrix").scrollHeight;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
xmlhttp.open("POST", url, true);
|
||
|
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
|
||
|
xmlhttp.send(request);
|
||
|
// setTimeout(function() { alert ("Timeout expired"); xmlhttp.abort(); }, 600000);
|
||
|
|
||
|
var currpos = 0, start = -1;
|
||
|
|
||
|
}
|
||
|
|
||
|
//-->
|
||
|
// ajaxFileUpload
|
||
|
function ajaxFileUpload(request)
|
||
|
{
|
||
|
/* $("#loading")
|
||
|
.ajaxStart(function(){
|
||
|
$(this).show();
|
||
|
})
|
||
|
.ajaxComplete(function(){
|
||
|
$(this).hide();
|
||
|
});*/
|
||
|
$.ajaxFileUpload
|
||
|
(
|
||
|
{
|
||
|
url:'/cgi-bin/webbuild.cgi',
|
||
|
secureuri:false,
|
||
|
fileElementId:'fileToUpload',
|
||
|
dataType: 'xml',
|
||
|
beforeSend:function()
|
||
|
{
|
||
|
$("#loading").show();
|
||
|
},
|
||
|
complete:function()
|
||
|
{
|
||
|
$("#loading").hide();
|
||
|
},
|
||
|
success: function (data, status)
|
||
|
{
|
||
|
ajax_getvalues(request);
|
||
|
if(typeof(data.error) != 'undefined')
|
||
|
{
|
||
|
if(data.error != '')
|
||
|
{
|
||
|
alert(data.error);
|
||
|
}else
|
||
|
{
|
||
|
alert(data.msg);
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
error: function (data, status, e)
|
||
|
{
|
||
|
alert(e);
|
||
|
}
|
||
|
}
|
||
|
)
|
||
|
return false;
|
||
|
}
|
||
|
</script>
|
||
|
<table width="100%"><tr><td>
|
||
|
<tr><td valign="middle">
|
||
|
<br><br>
|
||
|
<table align="center"><tr>
|
||
|
<td><img src="/images/packages_gr.png" alt="sviluppo di openmamba" width=24 height=24></td>
|
||
|
<td class="toptitle">Sviluppo di openmamba</td>
|
||
|
</tr></table>
|
||
|
</td></tr>
|
||
|
<tr><td>
|
||
|
<?php
|
||
|
if ( bb_is_user_logged_in() ) :
|
||
|
?>
|
||
|
|
||
|
<span class=webbuild>
|
||
|
<div id=container style="position:relative;width:894px;height:auto;top:0;left:0;">
|
||
|
<form id=webbuildform name=webbuild method=post>
|
||
|
Build host: <select id="webbuildhost" onchange='ajax_getvalues("","");' >
|
||
|
<option value="tao">i586 (tao)</option>
|
||
|
<option value="buildvm01">x86_64 (buildvm01)</option>
|
||
|
<option value="buildvm02">i586 (buildvm02)</option>
|
||
|
<option value="webbuild-arm">arm (webbuild-arm)</option>
|
||
|
</select>
|
||
|
|
||
|
<span id="searchbox"></span>
|
||
|
|
||
|
<div style="position:relative;top:-30px;left:0;width:100%;height:100%;">
|
||
|
<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>
|
||
|
<span id="status">Caricamento in corso, attendere...</span>
|
||
|
<span id="topcontrols"></span><span id="environments"></span><span id="specedit"></span>
|
||
|
<br><span id="repositories"></span>
|
||
|
<span id="packages"></span>
|
||
|
<span id="operations"></span>
|
||
|
<br><span id="speccreate"></span>
|
||
|
<hr>
|
||
|
<div style="position:relative;float:left;width:686px;padding:0;margin:1px;">
|
||
|
<div class="processes"><div class="scroll-pane3"><span id="processes"></span></div></div><br>
|
||
|
<div><span id="editor"></span></div>
|
||
|
<span id="editcontrols"></span>
|
||
|
<span id="showlogcontrols"></span>
|
||
|
<span id="output"></span>
|
||
|
</div>
|
||
|
<div style="position:relative;float:right;width:200px;padding:0;margin:1px;">
|
||
|
<div class="socialbox"><div class="scroll-pane"><span id="socialbox"></span></div></div>
|
||
|
<span id="operationpanel" style="margin:0;"></span>
|
||
|
<span id="chatpanel"></span>
|
||
|
</div>
|
||
|
<div style="clear:both"></div>
|
||
|
<span id="window"></span>
|
||
|
</form>
|
||
|
</div>
|
||
|
</span>
|
||
|
|
||
|
<script>
|
||
|
ajax_getvalues("","");
|
||
|
ajax_getvalues_refresh("",user,user_email,encodeURIComponent(secret));
|
||
|
//setInterval("ajax_getvalues_refresh(\"\",user,user_email,encodeURIComponent(secret))",0);
|
||
|
</script>
|
||
|
<?php
|
||
|
else:
|
||
|
?>
|
||
|
<center><h2>Per usare questo servizio è necessario effettuare il login.</h2></center>
|
||
|
<br><br><br><br><br><br>
|
||
|
<?php
|
||
|
endif;
|
||
|
?>
|
||
|
</td></tr>
|
||
|
</table>
|
||
|
<!--#include virtual="/footer.html" -->
|