Merge branch 'master' of disposed.de:scattport

This commit is contained in:
Eike Foken
2011-08-11 02:42:36 +02:00
8 changed files with 215 additions and 130 deletions

View File

@@ -0,0 +1,61 @@
<?php
/*
* Copyright (c) 2011 Karsten Heiken <karsten@disposed.de>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* Server management.
*
* @author Karsten Heiken <karsten@disposed.de>
*/
class Servers extends CI_Controller {
/**
* Constructor.
*/
function __construct() {
parent::__construct();
$this->load->model('server');
}
/**
* List all servers.
*/
function index() {
$tpl->servers = $this->server->getAll();
$this->load->view('admin/server/list', $tpl);
}
/**
* Retrieve details of a server.
*
* @param type $server_id
*/
function detail($server_id) {
$tpl->server = $this->server->where('id', $server_id)->get();
$this->load->view('admin/server/detail', $tpl);
}
}

View File

@@ -44,28 +44,32 @@ class MY_Lang extends CI_Lang {
log_message('debug', 'Gettext Class path chosen is: ' . $this->_gettext_path); log_message('debug', 'Gettext Class path chosen is: ' . $this->_gettext_path);
$filename = $this->_gettext_path . '/' . $this->_gettext_language . '/LC_MESSAGES/' . $this->_gettext_domain . '.mo'; $filename = $this->_gettext_path . '/' . $this->_gettext_language . '/LC_MESSAGES/' . $this->_gettext_domain . '.mo';
$mtime = filemtime($filename);
$newFilename = $this->_gettext_path . '/' . $this->_gettext_language . '/LC_MESSAGES/' . $this->_gettext_domain . '_' . $mtime . '.mo'; // if there is no language file, we can't load anything
if (file_exists($filename)) {
$mtime = filemtime($filename);
if (!file_exists($newFilename)) { $newFilename = $this->_gettext_path . '/' . $this->_gettext_language . '/LC_MESSAGES/' . $this->_gettext_domain . '_' . $mtime . '.mo';
$dir = scandir(dirname($filename));
foreach ($dir as $file) { if (!file_exists($newFilename)) {
// remove all the old files $dir = scandir(dirname($filename));
if (!in_array($file, array('.', '..', $this->_gettext_domain . '.po', $this->_gettext_domain . '.mo'))) { foreach ($dir as $file) {
@unlink(dirname($filename) . '/' . $file); // remove all the old files
if (!in_array($file, array('.', '..', $this->_gettext_domain . '.po', $this->_gettext_domain . '.mo'))) {
@unlink(dirname($filename) . '/' . $file);
}
} }
@copy($filename, $newFilename);
} }
@copy($filename, $newFilename); $newDomain = $this->_gettext_domain . '_' . $mtime;
bindtextdomain($newDomain, $this->_gettext_path);
bind_textdomain_codeset($newDomain, "UTF-8");
textdomain($newDomain);
} }
$newDomain = $this->_gettext_domain . '_' . $mtime;
bindtextdomain($newDomain, $this->_gettext_path);
bind_textdomain_codeset($newDomain, "UTF-8");
textdomain($newDomain);
log_message('debug', 'The gettext domain chosen is: '. $this->_gettext_domain); log_message('debug', 'The gettext domain chosen is: '. $this->_gettext_domain);
return true; return true;

View File

@@ -0,0 +1,43 @@
<?php
/*
* Copyright (c) 2011 Karsten Heiken <karsten@disposed.de>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/*
* Headings
*/
$lang['location'] = 'Location';
$lang['owner'] = 'Owner';
$lang['actions'] = 'Actions';
$lang['technical_info'] = 'Technical information';
$lang['hardware_os'] = 'Hardware &amp; OS';
$lang['scattport_stats'] = 'ScattPort statistics';
/*
* server status
*/
$lang['busy'] = 'busy';
$lang['offline'] = 'offline';
$lang['available'] = 'available';
$lang['workload'] = 'Workload';
$lang['completed_jobs'] = 'Completed jobs';

View File

@@ -0,0 +1,35 @@
<?php $this->load->view('header'); ?>
<div id="content">
<div class="title">
<h2>Serververwaltung: <?=$server->id?></h2>
</div>
<div class="box">
<h3>Miscellaneous</h3>
<h4>Location</h4>
<p><?=nl2br($server->location)?></p>
<h4>Owner</h4>
<p><a href="#" title="Profil von Jörg Thomaschewski anzeigen">Jörg Thomaschewski</a></p>
<h3>Technical information</h3>
<h4>Hardware &amp; OS</h4>
<p>
CPU: Intel Xeon E5540, 2533 MHz<br />
Uptime: 254 Tage, 13 Stunden<br />
OS: Debian/GNU 5.0r1<br />
Workload: 2.01, 1.05, 0.85
</p>
<h4>ScattPort-Statistics</h4>
<p>
Completed jobs: 47<br />
Available programs: PYTHA, ABC, DEF
</p>
</div>
</div>
<?php $this->load->view('footer'); ?>

View File

@@ -1,35 +0,0 @@
<?php $this->load->view('header'); ?>
<div id="content">
<div class="title">
<h2>Serververwaltung</h2>
</div>
<div class="box">
<h3>SP-EMD-01</h3>
<h4>Standort</h4>
<p>Hochschule Emden, Technikum, Raum E10</p>
<h4>Besitzer</h4>
<p><a href="#" title="Profil von Jörg Thomaschewski anzeigen">Jörg Thomaschewski</a></p>
<h4>Serverinformationen</h4>
<p>
Prozessor: Intel Xeon E5540, 2533 MHz<br />
Uptime: 254 Tage, 13 Stunden<br />
Betriebssystem: Debian/GNU 5.0r1<br />
Workload: 2.01, 1.05, 0.85
</p>
<h4>ScattPort-Statistik</h4>
<p>
Durchgeführte Berechnungen: 47<br />
Verfügbare Programme: PYTHA, ABC, DEF
</p>
</div>
</div>
<?php $this->load->view('footer'); ?>

View File

@@ -3,66 +3,50 @@
<div id="content"> <div id="content">
<div class="title"> <div class="title">
<h2>Serververwaltung</h2> <h2>Server management</h2>
</div> </div>
<div class="box"> <div class="box">
<h3>Übersicht aller Server</h3> <h3>List of all available servers</h3>
<table> <table>
<thead> <thead>
<tr> <tr>
<th scope="col">Bezeichnung</th> <th scope="col">ID</th>
<th scope="col">Ort</th> <th scope="col">Location</th>
<th scope="col">Status</th> <th scope="col">Status</th>
<th scope="col">Aktion</th> <th scope="col">Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody class="tableList">
<tr class="odd"> <?
<td><a href="#"><abbr title="ScattPort Server 01, Emden">SP-EMD-01</abbr></a></td> foreach ($servers as $server):
<td><abbr title="Technikum, Raum E10">Emden, Deutschland</abbr></td> if ($server['available']) {
<td><span class="active">Idle</span></td> if ($server['workload'] > 2) {
<td><a href="#">Bearbeiten</a> | <a href="#">Entfernen</a></td> $server['class'] = "pending";
</tr> $server['status'] = 'busy';
<tr> } else {
<td><a href="#"><abbr title="ScattPort Server 02, Emden">SP-EMD-02</abbr></a></td> $server['class'] = "active";
<td><abbr title="Technikum, Raum E10">Emden, Deutschland</abbr></td> $server['status'] = 'available';
<td><span class="pending">Ausgelastet</span></td> }
<td><a href="#">Bearbeiten</a> | <a href="#">Entfernen</a></td> } else {
</tr> $server['class'] = "closed";
<tr class="odd"> $server['status'] = "offline";
<td><a href="#"><abbr title="ScattPort Server 01, Bremen">SP-HB-01</abbr></a></td> }
<td><abbr title="Rechenzentrum, Raum 42, Rack 17">Bremen, Deutschland</abbr></td> ?>
<td><span class="closed">Nicht erreichbar</span></td> <tr>
<td><a href="#">Bearbeiten</a> | <a href="#">Entfernen</a></td> <td><a href="<?= site_url('admin/servers/detail/' . $server['id']) ?>"><?= $server['id'] ?></a></td>
</tr> <td><abbr title="Technikum, Raum E10"><?= $server['location'] ?></abbr></td>
<tr> <td>
<td><a href="#"><abbr title="ScattPort Server 01, Bremen">SP-HB-02</abbr></a></td> <?
<td><abbr title="Rechenzentrum, Raum 42, Rack 17">Bremen, Deutschland</abbr></td> ?>
<td><span class="active">Idle</span></td> <span class="<?= $server['class'] ?>"><?= $server['status'] ?></span></td>
<td><a href="#">Bearbeiten</a> | <a href="#">Entfernen</a></td> <td><a href="#">Edit</a> | <a href="#">Delete</a></td>
</tr> </tr>
<tr class="odd"> <?
<td><a href="#"><abbr title="ScattPort Server 01, Bremen">SP-HB-03</abbr></a></td> endforeach;
<td><abbr title="Rechenzentrum, Raum 42, Rack 17">Bremen, Deutschland</abbr></td> ?>
<td><span class="pending">Ausgelastet</span></td> </tbody>
<td><a href="#">Bearbeiten</a> | <a href="#">Entfernen</a></td>
</tr>
</tbody>
</table> </table>
<div class="pagination">
<ul>
<li class="pages">Seite:</li>
<li>1</li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
<li>...</li>
<li><a href="#">10</a></li>
</ul>
</div>
</div> </div>
</div> </div>

View File

@@ -1,5 +1,16 @@
<div id="footer"> <div id="footer">
<span class="left"><?=anchor('', "Dashboard");?> | <a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link</a></span> <?
if($this->session->userdata('group') == 'admins'):
?>
<span class="left"><strong>Administration - </strong>
<a href="<?=site_url('admin/settings')?>">Globale Einstellungen</a> |
<a href="<?=site_url('admin/servers')?>">Berechnungsserver verwalten</a> |
<a href="<?=site_url('admin/users')?>">Benutzer verwalten</a> |
<a href="<?=site_url('admin/programs')?>">Programme verwalten</a>
</span>
<?
endif;
?>
<span class="right">© 2011 Karsten Heiken.</span> <span class="right">© 2011 Karsten Heiken.</span>
</div> </div>

View File

@@ -1,7 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head> <html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ScattPort | Dashboard</title> <title>ScattPort | Dashboard</title>
@@ -46,9 +46,9 @@
?> ?>
<li>Projekt <?=$active_project['name']?> <li>Projekt <?=$active_project['name']?>
<ul> <ul>
<li><a href="<?=site_url('/projects/detail/'.$active_project['id'])?>" title="Projektübersicht öffnen">Übersicht</a></li> <li><a href="<?=site_url('projects/detail'.$active_project['id'])?>" title="Projektübersicht öffnen">Übersicht</a></li>
<li><a href="<?=site_url('/trials/create/'.$active_project['id'])?>" title="Neuen Versuch für das Projekt &quot;<?=$active_project['name']?>&quot; anlegen">Neuer Versuch</a></li> <li><a href="<?=site_url('trials/create'.$active_project['id'])?>" title="Neuen Versuch für das Projekt &quot;<?=$active_project['name']?>&quot; anlegen">Neuer Versuch</a></li>
<li><a href="<?=site_url('/results/project/'.$active_project['id'])?>" title="Alle Ergebnisse für das Projekt &quot;<?=$active_project['name']?>&quot; öffnen">Ergebnisse</a></li> <li><a href="<?=site_url('results/project'.$active_project['id'])?>" title="Alle Ergebnisse für das Projekt &quot;<?=$active_project['name']?>&quot; öffnen">Ergebnisse</a></li>
</ul> </ul>
</li> </li>
<? <?
@@ -56,30 +56,12 @@
?> ?>
<li>Global <li>Global
<ul> <ul>
<li><a href="<?=site_url('/projects/create')?>" title="Neues Projekt anlegen">Neues Projekt</a></li> <li><a href="<?=site_url('projects/create')?>" title="Neues Projekt anlegen">Neues Projekt</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
<?
if($this->session->userdata('group') == 'admins'):
?>
<div class="navigation">
<ul>
<li>Administration
<ul>
<li><a href="<?=site_url('servers')?>" title="Manage servers">Calculation servers</a></li>
</ul>
<ul>
<li><a href="<?=site_url('users')?>" title="Manage users">Users</a></li>
</ul>
</li>
</ul>
</div>
<?
endif;
?>
<div class="title"> <div class="title">
<h2><a href="<?=site_url('projects')?>" title="Alle Projekte anzeigen">Projekte</a></h2> <h2><a href="<?=site_url('projects')?>" title="Alle Projekte anzeigen">Projekte</a></h2>
</div> </div>