From 625c2b3ed24b62c308788f315a51fc3580a7c93c Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 19 Jan 2013 16:24:26 +0100 Subject: [PATCH] webbuild: update to current production version providing some fixes and new features --- webbuild/html/scripts/socialbox.js | 10 +++ webbuild/html/scripts/webbuild.js | 14 ++++ webbuild/webbuild-cgi | 119 ++++++++++++++++++++-------- webbuild/webbuild-functions-private | 24 ++++-- webbuild/webbuild-sudo | 4 + 5 files changed, 128 insertions(+), 43 deletions(-) diff --git a/webbuild/html/scripts/socialbox.js b/webbuild/html/scripts/socialbox.js index 79269df..a752941 100644 --- a/webbuild/html/scripts/socialbox.js +++ b/webbuild/html/scripts/socialbox.js @@ -28,8 +28,15 @@ function socialbox_refresh_times() { } } +var socialbox_interval = null; +var socialbox_reloadtime = 15000; + function ajax_getvalues_refresh(request,user,user_email,secret) { var fromid = 0; +//alert("refresh"); + if (socialbox_interval != null) { + clearInterval(socialbox_interval); + } if (document.getElementsByName("social").length > 0) { if (document.getElementsByName("social")[0].attributes[0].name == "sid") { fromid = parseInt(document.getElementsByName("social")[0].attributes[0].value) + 1; @@ -68,8 +75,11 @@ function ajax_getvalues_refresh(request,user,user_email,secret) { $(function() { $('.scroll-pane').jScrollPane({scrollbarWidth:10}); }); // lastupdate = (+new Date()); socialbox_refresh_times(); +//alert("refreshed_times"); } + xmlhttp1.open("POST", url, true); xmlhttp1.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp1.send(request); + socialbox_interval = setInterval("ajax_getvalues_refresh(\"\",\""+user+"\",\""+user_email+"\",\""+secret+"\")",socialbox_reloadtime); } diff --git a/webbuild/html/scripts/webbuild.js b/webbuild/html/scripts/webbuild.js index 2d6d579..2f66833 100644 --- a/webbuild/html/scripts/webbuild.js +++ b/webbuild/html/scripts/webbuild.js @@ -30,3 +30,17 @@ function checkEnter(event) { } return false; } + +function replaceHTML(el, html) { + var oldEl = typeof el === "string" ? document.getElementById(el) : el; + /*@cc_on // Pure innerHTML is slightly faster in IE + oldEl.innerHTML = html; + return oldEl; + @*/ + var newEl = oldEl.cloneNode(false); + newEl.innerHTML = html; + oldEl.parentNode.replaceChild(newEl, oldEl); + /* Since we just removed the old element from the DOM, return a reference + to the new element, which can be used to restore variable references. */ + return newEl; +}; diff --git a/webbuild/webbuild-cgi b/webbuild/webbuild-cgi index e67af5d..041bc93 100755 --- a/webbuild/webbuild-cgi +++ b/webbuild/webbuild-cgi @@ -1,7 +1,7 @@ #!/bin/bash # # webbuild cgi script -# Copyright (c) 2012 by Silvan Calarco +# Copyright (c) 2012-2013 by Silvan Calarco # . /etc/sysconfig/autoport . /usr/share/autodist/webbuild-functions @@ -141,6 +141,13 @@ fi if [ "$USER" -a "$USER_ENABLED" ]; then # set user state changes + if [ "$AUTODISTCURRENT" != "" ]; then + if [ "$AUTODISTCURRENT" = "true" ]; then + set_user_state_var STATE_AUTODISTCURRENT 1 + else + set_user_state_var STATE_AUTODISTCURRENT 0 + fi + fi if [ "$ADVANCEDCONTROLSSWITCH" != "" ]; then if [ "$ADVANCEDCONTROLSSWITCH" = "true" ]; then set_user_state_var STATE_ADVANCEDCONTROLS 1 @@ -314,6 +321,7 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then # if [ -e /proc/$1 -o $5 -lt 256 ]; then numprocess=`expr $numprocess + 1` cmdline=`echo $line | sed "s|$1 $2 $3 $4 $5 $RETCODE ||"` + cmdline=`echo $cmdline | sed "s| --colors web||"` PACKAGE_ENCODED=`cgi_encodevar $4` [ $numprocess -eq 1 ] && { echo -n "
" @@ -404,12 +412,12 @@ if [ "$REQUEST" = "environmentsearch" ]; then echo -n "$WHAT_PROVIDES
" if [ "${WHAT_PROVIDES:0:10}" != "no package" ]; then for f in $WHAT_PROVIDES; do - echo -n "$f installed package info:
" + echo -n "
$f installed package info:
" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "rpm -qi $f" if [ $? -eq 0 ]; then - echo -n "$f provides:
" + echo -n "
$f provides:
" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "rpm -q $f --provides" - echo -n "$f requirements:
" + echo -n "
$f requirements:
" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "rpm -q $f --requires" fi done @@ -470,14 +478,14 @@ echo -n "" # expert mode checkbox [ "$STATE_ADVANCEDCONTROLS" ] && CHECKED="checked=checked" || CHECKED= -echo -n " Expert:Autodist:" # privacy mode checkbox [ "$STATE_PRIVACYMODE" ] && CHECKED="checked=checked" || CHECKED= -echo -n " Privacy:Privacy:" @@ -532,7 +540,7 @@ echo -n "]]>" if [ "$MAINTAINERMODE" = "true" ]; then echo -n " " -elif [ ! "$REQUEST" -o "$REQUEST" = "changeenvironment" -o "$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "prepare" ]; then +elif [ ! "$REQUEST" -o "$REQUEST" = "changeenvironment" -o "$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "prepare" -o "$REQUEST" = "reloadspec" ]; then # SPECFILES select echo -n "" + echo -n "LOGTYPE=\"+getSelectedValueById(\"autobuildedit\",-1).substring(getSelectedValueById(\"autobuildedit\",-1).indexOf(';')+1)+\"&LOGSTATUSOK=&" + echo -n "REQUEST=autobuildedit\");>" # autobuild edit select echo -n " \" onclick=" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&" - echo -n "AUTODISTCURRENT=\"+getElementById('autodistcurrentcheckbox').checked+\"&" echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById(\"autobuildedit\",1).substring(0,getSelectedValueById(\"autobuildedit\",1).indexOf(';')))+\"&" - echo -n "LOGTYPE=\"+getSelectedValueById(\"autobuildedit\",1).substring(getSelectedValueById(\"autobuildedit\",1).indexOf(';')+1)+\"&REQUEST=autobuildedit\");>" + echo -n "LOGTYPE=\"+getSelectedValueById(\"autobuildedit\",1).substring(getSelectedValueById(\"autobuildedit\",1).indexOf(';')+1)+\"&LOGSTATUSOK=&" + echo -n "REQUEST=autobuildedit\");>" # autodist current checkbox (in progress) - [ "$AUTODISTCURRENT" = "true" ] && SELECTED="checked" || SELECTED= + [ "$STATE_AUTODISTCURRENT" = "1" ] && SELECTED="checked" || SELECTED= echo -n "