webbuild interface: small fixes for portability

This commit is contained in:
Silvan Calarco 2013-05-21 11:57:52 +02:00
parent f9a0a4f5bd
commit 035e78eba8
3 changed files with 7 additions and 9 deletions

View File

@ -1,4 +1,4 @@
var url = "/cgi-bin/webbuild.cgi" var url = "/cgi-bin/webbuild"
function socialbox_refresh_times() { function socialbox_refresh_times() {
var times = document.getElementsByName("socialtime"); var times = document.getElementsByName("socialtime");

View File

@ -98,6 +98,7 @@ function ajax_getvalues(request,confirm) {
if (!secret) { if (!secret) {
secret=getCookie("webbuild-secret"); secret=getCookie("webbuild-secret");
if (!secret) secret="";
} }
if (confirm) { if (confirm) {
document.getElementById("status").innerHTML = document.getElementById("status").innerHTML =
@ -162,7 +163,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 = "";
} }

View File

@ -50,7 +50,6 @@ if [ "$USER" ]; then
echo "USER_SECRET='$SECRET'" >> $tmpfile echo "USER_SECRET='$SECRET'" >> $tmpfile
$SUDO_WRAPPER 0 local "$USER" "" "mv $tmpfile $WEBBUILD_STATEDIR/users/$USER.conf" $SUDO_WRAPPER 0 local "$USER" "" "mv $tmpfile $WEBBUILD_STATEDIR/users/$USER.conf"
fi fi
SECRET="$USER_SECRET"
USER_ENABLED=1 USER_ENABLED=1
else else
USER_ENABLED= USER_ENABLED=
@ -78,8 +77,7 @@ elif [ "$REQUEST" != "refresh" ]; then
echo -n "<output><![CDATA[Please enter your username: <input type=text id=username>" echo -n "<output><![CDATA[Please enter your username: <input type=text id=username>"
echo -n " <input type=button value=\"Submit\" onClick=" echo -n " <input type=button value=\"Submit\" onClick="
echo -n "user=encodeURIComponent(getElementById('username').value);" echo -n "user=encodeURIComponent(getElementById('username').value);"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED\");>"
echo -n "USER=\"+encodeURIComponent(getElementById('username').value));>"
echo -n "]]></output>" echo -n "]]></output>"
echo -n "<environments> </environments>" echo -n "<environments> </environments>"
echo -n "<speccreate> </speccreate>" echo -n "<speccreate> </speccreate>"
@ -93,7 +91,7 @@ elif [ "$REQUEST" != "refresh" ]; then
exit exit
fi fi
if [ "$USER_ENABLED" != "1" ]; then if [ "$USER_ENABLED" != "1" -a "$REQUEST" != "refresh" ]; then
echo -n "<environments> </environments>" echo -n "<environments> </environments>"
echo -n "<speccreate> </speccreate>" echo -n "<speccreate> </speccreate>"
echo -n "<specedit> </specedit>" echo -n "<specedit> </specedit>"
@ -101,7 +99,7 @@ if [ "$USER_ENABLED" != "1" ]; then
echo -n "<packages> </packages>" echo -n "<packages> </packages>"
echo -n "<editcontrols> </editcontrols>" echo -n "<editcontrols> </editcontrols>"
echo -n "<editor> </editor>" echo -n "<editor> </editor>"
if [ "$USER" -a "$SECRET" ]; then if [ "$USER" ]; then
if [ "$REQUEST" = "enablerequest" ]; then if [ "$REQUEST" = "enablerequest" ]; then
echo "REQUEST_DATE=\"`date`\" REQUEST_USER=$USER REQUEST_USER_EMAIL=$USER_EMAIL REQUEST_TYPE=$REQUEST REQUEST_SECRET='$SECRET'" >> $WEBBUILD_STATEDIR/requests echo "REQUEST_DATE=\"`date`\" REQUEST_USER=$USER REQUEST_USER_EMAIL=$USER_EMAIL REQUEST_TYPE=$REQUEST REQUEST_SECRET='$SECRET'" >> $WEBBUILD_STATEDIR/requests
echo -n "<output>Your request has been submitted. Please wait for approval and retry later.</output>" echo -n "<output>Your request has been submitted. Please wait for approval and retry later.</output>"
@ -119,8 +117,8 @@ if [ "$USER_ENABLED" != "1" ]; then
# echo -n "<output>Unauthorized!</output>" # echo -n "<output>Unauthorized!</output>"
fi fi
echo -n "<operationpanel> </operationpanel>" echo -n "<operationpanel> </operationpanel>"
# echo -n "</webbuild>" echo -n "</webbuild>"
# exit exit
fi fi
if [ -e $WEBBUILD_STATEDIR/webbuild.state ]; then if [ -e $WEBBUILD_STATEDIR/webbuild.state ]; then