summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Geiger2011-09-14 15:36:52 +0200
committerBjörn Geiger2011-09-14 15:36:52 +0200
commit4c427f61c44f3d712c12cabf01361dc835103f5b (patch)
tree91969e3df5229aa7020adb712c064f660064fd18
parentMerge branch 'master' of git.openslx.org:lsfks/projekte/poolctrl (diff)
downloadpoolctrl-4c427f61c44f3d712c12cabf01361dc835103f5b.tar.gz
poolctrl-4c427f61c44f3d712c12cabf01361dc835103f5b.tar.xz
poolctrl-4c427f61c44f3d712c12cabf01361dc835103f5b.zip
showRepots korrigiert
-rwxr-xr-xapplication/configs/application.ini.dist1
-rwxr-xr-xapplication/controllers/EventController.php27
-rwxr-xr-xapplication/models/EventreportMapper.php2
-rwxr-xr-xapplication/views/scripts/event/showreports.phtml11
-rwxr-xr-xinstall.sh6
5 files changed, 38 insertions, 9 deletions
diff --git a/application/configs/application.ini.dist b/application/configs/application.ini.dist
index edbd635..3b56d48 100755
--- a/application/configs/application.ini.dist
+++ b/application/configs/application.ini.dist
@@ -32,6 +32,7 @@ pbs2.getperson = /resource/getperson/apikey/
pbs2.getmembership = /resource/getmembership/apikey/
pbs2.getgroup = /resource/getgroup/apikey/
pbs2.getrole = /resource/getrole/apikey/
+pbs2.getclient = /resource/getclient/apikey/
poolctrl.host =
poolctrl.runevent = /event/run/apikey/
poolctrl.reportevent = /event/report/apikey/
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index 6c51789..1ed503b 100755
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -247,6 +247,7 @@ class EventController extends Zend_Controller_Action
echo "Message: " . $e->getMessage() . "<br/>";
return;
}
+ $event->setID($eventID);
if($event->getImmediate()) {
$this->runEvent($event, $this->userIDsNamespace['apikey']);
}
@@ -851,6 +852,7 @@ class EventController extends Zend_Controller_Action
$eventreport = new Application_Model_Eventreport();
$eventreport->setEventID($event->getID());
$eventreport->setResult($eventResult->$resultShortcutName);
+ $eventreport->setCreated(time());
if($eventResult->$resultShortcutName == "failed") {
$eventreport->setErrors(json_encode($eventResult->$errorsName));
}
@@ -958,7 +960,7 @@ class EventController extends Zend_Controller_Action
$event = new Application_Model_Event();
$this->eventMapper->find($eventID, $event);
$eventreportMapper = new Application_Model_EventreportMapper();
- $reportlist = $eventreportMapper->findBy(array("eventID" => $eventID), false, array('created' => 'ASC'));
+ $reportlist = $eventreportMapper->findBy(array("eventID" => $eventID), false, array('created' => 'DESC'));
$eventtypeMapper = new Application_Model_EventtypeMapper();
$eventtypes = array();
$result = $eventtypeMapper->fetchAll();
@@ -972,16 +974,35 @@ class EventController extends Zend_Controller_Action
$reportlist[$i]->setType($reportType);
}
+ $clientRequest = "poolid=" . $event->getPbs_poolID();
+ $clientApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getclient'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $clientRequest);
+ $clientXMLString = $clientApiResult['http-body'];
+ if(strlen($clientXMLString) > 0) {
+ $clientXML = new SimpleXMLElement($clientXMLString);
+ foreach($clientXML->clientlist->client as $clientNew) {
+ $client = new Application_Model_Client();
+ $client->setID(sprintf("%s", $clientNew->clientID));
+ $client->setCreated(sprintf("%s", $clientNew->created));
+ $client->setGroupID(sprintf("%s", $clientNew->groupid));
+ $client->setHardwarehash(sprintf("%s", $clientNew->location));
+ $client->setIp(sprintf("%s", $clientNew->ip));
+ $client->setIp6(sprintf("%s", $clientNew->ip6));
+ $client->setMacadress(sprintf("%s", $clientNew->macadress));
+ $clients[$client->getID()] = $client;
+ }
+ }
+
$this->view->eventTitle = $event->getTitle();
+ $this->view->clients = $clients;
$this->view->reportlist = $reportlist;
-
+
// Pagination
$pagination = new Poolctrl_Pagination();
$pagination->setPerPage(5);
$pagination->setElement($this->view->reportlist);
$pagination->setRequestPage($this->_request->getParam('page'));
$pagination->setPageUrl('/event/showreports/eventID/' . $eventID);
-
+
$this->view->reportlist = $pagination->getElements();
$this->view->pagination = $pagination->pagination();
} else {
diff --git a/application/models/EventreportMapper.php b/application/models/EventreportMapper.php
index b5f405e..98651c9 100755
--- a/application/models/EventreportMapper.php
+++ b/application/models/EventreportMapper.php
@@ -84,7 +84,7 @@ class Application_Model_EventreportMapper
public function save(Application_Model_Eventreport $eventreport)
{
- $data = array('reportID'=> $eventreport->getID() ,'eventID'=> $eventreport->getEventID() ,'result'=> $eventreport->getResult(), 'errors' => $eventreport->getErrors(), 'type' => $eventreport->geType(), 'created' => $eventreport->getCreated() );
+ $data = array('reportID'=> $eventreport->getID() ,'eventID'=> $eventreport->getEventID() ,'result'=> $eventreport->getResult(), 'errors' => $eventreport->getErrors(), 'type' => $eventreport->getType(), 'created' => $eventreport->getCreated() );
if (null === ($id = $eventreport->getID()) ) {
unset($data['reportID']);
return $this->getDbTable()->insert($data);
diff --git a/application/views/scripts/event/showreports.phtml b/application/views/scripts/event/showreports.phtml
index 7f5065a..136d006 100755
--- a/application/views/scripts/event/showreports.phtml
+++ b/application/views/scripts/event/showreports.phtml
@@ -26,9 +26,16 @@ if(count($this->reportlist) > 0) {
<div class='details dispnone'>
<label>Finished:</label>
<div class='item'><?php echo date("m/d/Y H:i", $report->getCreated());?>&nbsp;</div>
- <?php if($report->getErrors()) { ?>
+ <?php if($report->getErrors()) {
+ $errors = json_decode($report->getErrors());
+ if(count($errors) > 0) {
+ $errorString = "";
+ foreach($errors as $k => $error) {
+ $errorString .= "Client " . $k . " (" . $this->clients[$k]->getIp() . "): " . $error . "<br />";
+ } ?>
<label>Errors:</label>
- <div class='item'><?php echo $report->getErrors(); ?>&nbsp;</div>
+ <div class='item'><?php echo $errorString; ?>&nbsp;</div>
+ <?php } ?>
<?php } ?>
</div>
</div>
diff --git a/install.sh b/install.sh
index 99d4a1a..c9b1d07 100755
--- a/install.sh
+++ b/install.sh
@@ -15,7 +15,7 @@ echo "Copying to /var/www/"
sourceDir=$(readlink -f $(dirname $(readlink -f $0)))
echo -n "enter vhost name: "
read vhost_name
-sed -e "35s/\$/$vhost_name/" -i $targetDir/application/configs/application.ini
+sed -e "36s/\$/$vhost_name/" -i $targetDir/application/configs/application.ini
targetDir="/var/www/$vhost_name"
mkdir -p $targetDir
cp -R $sourceDir/* $targetDir
@@ -72,12 +72,12 @@ sed -e "21s/\$/$pbs2_host/" -i $targetDir/application/configs/application.ini
echo -n "Please enter host of gearman server [localhost]: "
read gearman_server_host
[ "x" = "x$gearman_server_host" ] && gearman_server_host="localhost"
-sed -e "38s/\$/$gearman_server_host/" -i $targetDir/application/configs/application.ini
+sed -e "39s/\$/$gearman_server_host/" -i $targetDir/application/configs/application.ini
echo -n "Please enter port of gearman server [4730]: "
read gearman_server_port
[ "x" = "x$gearman_server_port" ] && gearman_server_port="4730"
-sed -e "39s/\$/$gearman_server_port/" -i $targetDir/application/configs/application.ini
+sed -e "40s/\$/$gearman_server_port/" -i $targetDir/application/configs/application.ini
echo "Create database and tables"
cat $targetDir/setup/poolctrl.sql | sed -e "s,##poolctrl##,$db_name," > /tmp/poolctrl.sql