From 5b2f71b890d255855be912e474593ac218fdafda Mon Sep 17 00:00:00 2001 From: hahn <hahn@AAE49.campus.unibe.ch> Date: Thu, 13 Feb 2014 15:17:27 +0100 Subject: [PATCH] - footer navigation in actions was simplified - fetch output instead of fille $sPhpOut - first ajax test --- public_html/deployment/act_accept.php | 4 +- public_html/deployment/act_build.php | 48 ++++++++++++++++++++++-- public_html/deployment/act_cleanup.php | 7 +++- public_html/deployment/act_deploy.php | 4 +- public_html/deployment/act_doc.php | 22 ++++++----- public_html/deployment/act_overview.php | 12 +++--- public_html/deployment/act_phase.php | 7 +++- public_html/deployment/act_setup.php | 4 +- public_html/deployment/inc_functions.php | 9 ----- public_html/deployment/index.php | 9 ++++- 10 files changed, 89 insertions(+), 37 deletions(-) diff --git a/public_html/deployment/act_accept.php b/public_html/deployment/act_accept.php index 2a6cffa2..21b32f5c 100644 --- a/public_html/deployment/act_accept.php +++ b/public_html/deployment/act_accept.php @@ -106,9 +106,9 @@ if (array_key_exists("confirm", $aParams)) { } -$sOut.='<hr>' . aHome() .' '. aPrjHome(); +$sOut.= '<hr>' .aPrjHome(); // -- Ausgabe -$sPhpOut=$sOut; +echo $sOut; ?> diff --git a/public_html/deployment/act_build.php b/public_html/deployment/act_build.php index f2e93148..53c57ee6 100644 --- a/public_html/deployment/act_build.php +++ b/public_html/deployment/act_build.php @@ -21,8 +21,50 @@ $oPrj = new project($aParams["prj"]); $sOut = ''; +print_r($aParams); if (array_key_exists("confirm", $aParams)) { - $sOut.=$oPrj->build(); + $sOutDir="/tmp"; // Ausgabeverzeichnis + $sTmpFile=tempnam("", $aParams["prj"]); + + $sDivname="outAjax"; + $sUrl="?" + ."&prj=".$aParams["prj"] + ."&action=".$aParams["action"] + ."&ajax=".$sTmpFile + ; + $sUrlStartAction=$sUrl."&run=1"; + + // im Hintergrund Prozess ankicken + if (array_key_exists("run", $aParams)){ + $oPrj->build($sOutDir."/".$aParams["ajax"]); + die(); + } + // im Hintergrund Prozess ankicken + if (array_key_exists("ajax", $aParams)){ + echo file_get_contents($sOutDir."/".$aParams["ajax"]); + die(); + } + $sOut.='<div id="'.$sDivname.'">Moment...</div>' + . '<script> + // init build process + $.post( "'.$sUrlStartAction.'", function( data ) { + $( ".'.$sDivname.'" ).html( data ); + }); + + function AjaxPolling(sUrl, sDivname, iRepeat){ + $.post( sUrl, function( data ) { + $("#"+sDivname ).html( data ); + }); + + if (iRepeat){ + window.settimeout("AjaxPolling( \'"+sUrl+"\', \'"+sDivname+"\', \'"+iRepeat+"\')", iRepeat); + } + } + + </script>'; + + + // $sOut.=$oPrj->build($sTmpFile); } else { $sNext = $oPrj->getNextPhase(); $aPhaseData2 = $oPrj->getPhaseInfos($sNext); @@ -96,9 +138,9 @@ if (array_key_exists("confirm", $aParams)) { } -$sOut.='<hr>' . aHome() . ' ' . aPrjHome(); +$sOut.='<hr>' . aPrjHome(); // -- Ausgabe -$sPhpOut = $sOut; +echo $sOut; ?> diff --git a/public_html/deployment/act_cleanup.php b/public_html/deployment/act_cleanup.php index fb150cb1..d78c2451 100644 --- a/public_html/deployment/act_cleanup.php +++ b/public_html/deployment/act_cleanup.php @@ -17,7 +17,7 @@ require_once("./classes/project.class.php"); $oPrj = new project($sPrj); -$sPhpOut = ' +$sOut = ' <h3>Archive Dir: ' . $aConfig['archiveDir'] . '</h3> deleted:<br> @@ -27,6 +27,9 @@ $sPhpOut = ' <h3>Builds Dir: ' . $aConfig['buildDir'] . '/[project]/</h3> <pre>' . print_r($oPrj->cleanupBuilds(), true) . '</pre> - <hr>' . aHome() .' '. aPrjHome(); + <hr>' . aPrjHome(); + +// -- Ausgabe +echo $sOut; ?> diff --git a/public_html/deployment/act_deploy.php b/public_html/deployment/act_deploy.php index 1c7fa870..1d068711 100644 --- a/public_html/deployment/act_deploy.php +++ b/public_html/deployment/act_deploy.php @@ -66,9 +66,9 @@ if (array_key_exists("confirm", $aParams)) { } -$sOut.='<hr>' . aHome() .' '. aPrjHome(); +$sOut.='<hr>' . aPrjHome(); // -- Ausgabe -$sPhpOut = $sOut; +echo $sOut; ?> diff --git a/public_html/deployment/act_doc.php b/public_html/deployment/act_doc.php index d9f78f38..0273e6f8 100644 --- a/public_html/deployment/act_doc.php +++ b/public_html/deployment/act_doc.php @@ -17,31 +17,35 @@ $aClasses=array( "formgen"=>array("name"=>"formgen", "info" => "Zeichnen von FORM Elementen"), ); -$sPhpOut=''; -$sPhpOut.='<a href="/deployment/all/doc/">Start</a> | '; +$sOut=''; +$sOut.='<a href="/deployment/all/doc/">Start</a> | '; foreach ($aClasses as $sClassfile=>$aInfos){ - $sPhpOut.='<a href="/deployment/all/doc/'.$sClassfile.'/">'.$sClassfile.'</a> | '; + $sOut.='<a href="/deployment/all/doc/'.$sClassfile.'/">'.$sClassfile.'</a> | '; } -$sPhpOut.= '<hr>'; +$sOut.= '<hr>'; if (array_key_exists("par3", $aParams)) { $sClass=$aParams["par3"]; if (!array_key_exists($sClass, $aClasses)){ - $sPhpOut.= getBox("error", "Die Doku kann nicht angezeigt werden. Eine Klasse "$sClass" ist nicht konfiguriert in ". __FILE__ ."."); + $sOut.= getBox("error", "Die Doku kann nicht angezeigt werden. Eine Klasse "$sClass" ist nicht konfiguriert in ". __FILE__ ."."); } else { require_once("./classes/$sClass.class.php"); $o=new classinfos($aClasses[$sClass]["name"]); - $sPhpOut.=$aClasses[$sClass]["info"] . $o->render(); + $sOut.=$aClasses[$sClass]["info"] . $o->render(); } } else { - $sPhpOut.='Wähle eine Klasse.<ul>'; + $sOut.='Wähle eine Klasse.<ul>'; foreach ($aClasses as $sClassfile=>$aInfos){ - $sPhpOut.='<li>' + $sOut.='<li>' . '<a href="/deployment/all/doc/'.$sClassfile.'/">'.$sClassfile.'</a>' . ' ' . $aInfos["info"] . '</li>'; } - $sPhpOut.='</ul>'; + $sOut.='</ul>'; } + +// -- Ausgabe +echo $sOut; + ?> diff --git a/public_html/deployment/act_overview.php b/public_html/deployment/act_overview.php index 6a09c182..7a53559c 100644 --- a/public_html/deployment/act_overview.php +++ b/public_html/deployment/act_overview.php @@ -19,11 +19,11 @@ if (!array_key_exists("prj", $aParams)) { require_once("./classes/projectlist.class.php"); $oPrjList = new projectlist(); - $sPhpOut = $oPrjList->renderOverview(); + $sOut = $oPrjList->renderOverview(); } else { require_once("./classes/project.class.php"); $oPrj = new project($aParams["prj"]); - $sPhpOut = ' + $sOut = ' <div class="infobox" style="float: right;"> <h3>Steckbrief</h3> ' . $oPrj->renderProjektInfos() . ' @@ -33,7 +33,7 @@ if (!array_key_exists("prj", $aParams)) { <h3>Phasen</h3>'; if ($oPrj->getActivePhases()) { - $sPhpOut.=' + $sOut.=' <div class="tabbable"> <ul class="nav nav-tabs" style="float: left; width: 50%;"> <li class="active"><a href="#tab1" data-toggle="tab">Phasen</a></li> @@ -54,10 +54,12 @@ if (!array_key_exists("prj", $aParams)) { </div> </div>'; } else { - $sPhpOut.=getBox("info", "Es wurde noch keine URL in keiner der Phasen definiert") . + $sOut.=getBox("info", "Es wurde noch keine URL in keiner der Phasen definiert") . $oPrj->renderLink("setup"); } - $sPhpOut .= '<div style="clear: both"></div><hr>' . aHome(); + $sOut .= '<div style="clear: both"></div><hr>' . aHome(); } +// +echo $sOut; ?> diff --git a/public_html/deployment/act_phase.php b/public_html/deployment/act_phase.php index 474ac7a0..b0c65546 100644 --- a/public_html/deployment/act_phase.php +++ b/public_html/deployment/act_phase.php @@ -45,17 +45,20 @@ if ($sPhase) { </tbody> </table> '; + /* if ($sFirst == $sPhase) { $sOut.='<br><h3>weitere Aktionen</h3>' . $oPrj->renderLink("build"); } + * + */ } else { $sOut.=getBox("error", 'ERROR: missing name of the phase.'); } -$sOut.='<hr>' . aHome() .' '. aPrjHome(); +$sOut.= '<hr>' .aPrjHome(); // -- Ausgabe -$sPhpOut = $sOut; +echo $sOut; ?> diff --git a/public_html/deployment/act_setup.php b/public_html/deployment/act_setup.php index a5feffe2..0da9fd01 100644 --- a/public_html/deployment/act_setup.php +++ b/public_html/deployment/act_setup.php @@ -54,8 +54,8 @@ if ($aParams["prj"] == "all") { $sOut.=$oPrj->renderProjectSetup(); } -$sOut.='<hr>' . aHome() .' '. aPrjHome(); +$sOut.='<hr>' . aPrjHome(); // -- Ausgabe -$sPhpOut = $sOut; +echo $sOut; ?> diff --git a/public_html/deployment/inc_functions.php b/public_html/deployment/inc_functions.php index d257bc96..0ca2636c 100644 --- a/public_html/deployment/inc_functions.php +++ b/public_html/deployment/inc_functions.php @@ -283,14 +283,5 @@ function enterDeployinfos() { return $sOut; } -function getChecksumDiv($sText) { - return '<div style="background: ' . getChecksumColor($sText) . '; width: 20px; height: 20px;"> </div>'; -} - -function getChecksumColor($sText) { - $sReturn = ''; - $s = md5($sText); - return "#" . substr($s, 0, 2) . substr($s, 2, 2) . substr($s, 4, 2); -} ?> diff --git a/public_html/deployment/index.php b/public_html/deployment/index.php index 4026f917..fcb9f185 100644 --- a/public_html/deployment/index.php +++ b/public_html/deployment/index.php @@ -36,7 +36,14 @@ if (array_key_exists("action", $aParams)) { // ------ action $sActionFile = __DIR__ . '/act_' . $sAction . ".php"; -include($sActionFile); + +ob_start(); +if (!@include($sActionFile)) { + include("./pages/error_404.php"); +} +$sPhpOut = ob_get_contents(); +ob_end_clean(); + // ------ Ausgabe $sPhpOut = ' -- GitLab