summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/Bootstrap.php57
-rw-r--r--application/configs/application.ini30
-rw-r--r--application/configs/db.sql83
-rw-r--r--application/controllers/ErrorController.php31
-rw-r--r--application/controllers/IndexController.php66
-rw-r--r--application/layouts/layout.phtml56
-rw-r--r--application/models/Bootmedia.php8
-rw-r--r--application/models/Kernels.php8
-rw-r--r--application/models/Menuassignmentbm.php8
-rw-r--r--application/models/Menuassignmentip.php8
-rw-r--r--application/models/Menuassignments.php8
-rw-r--r--application/models/Menuentries.php8
-rw-r--r--application/models/Menus.php8
-rw-r--r--application/models/Sources.php8
-rw-r--r--application/models/Systems.php7
-rw-r--r--application/modules/backend/controllers/BootmediaController.php53
-rw-r--r--application/modules/backend/controllers/JsonController.php84
-rw-r--r--application/modules/backend/controllers/MenuController.php210
-rw-r--r--application/modules/backend/controllers/MkisoController.php283
-rw-r--r--application/modules/backend/controllers/SystemController.php273
-rw-r--r--application/modules/backend/controllers/UserController.php18
-rw-r--r--application/modules/backend/views/scripts/bootmedia/index.phtml1
-rw-r--r--application/modules/backend/views/scripts/bootmedia/list.phtml20
-rw-r--r--application/modules/backend/views/scripts/menu/index.phtml1
-rw-r--r--application/modules/backend/views/scripts/menu/list.phtml15
-rw-r--r--application/modules/backend/views/scripts/menu/listassignments.phtml18
-rw-r--r--application/modules/backend/views/scripts/menu/listentries.phtml19
-rw-r--r--application/modules/backend/views/scripts/mkiso/index.phtml1
-rw-r--r--application/modules/backend/views/scripts/system/add.phtml1
-rw-r--r--application/modules/backend/views/scripts/system/addkernel.phtml0
-rw-r--r--application/modules/backend/views/scripts/system/index.phtml1
-rw-r--r--application/modules/backend/views/scripts/system/sync.phtml0
-rw-r--r--application/modules/backend/views/scripts/system/updateinitramfs.phtml0
-rw-r--r--application/modules/backend/views/scripts/system/updatekernel.phtml0
-rw-r--r--application/modules/backend/views/scripts/user/index.phtml1
-rw-r--r--application/modules/bootloader/controllers/EnvController.php218
-rw-r--r--application/modules/bootloader/controllers/IndexController.php29
-rw-r--r--application/modules/bootloader/views/scripts/env/bootmenu.dialog7
-rw-r--r--application/modules/bootloader/views/scripts/env/prebootInit.sh71
-rw-r--r--application/modules/bootloader/views/scripts/index/index.phtml0
-rw-r--r--application/modules/ui/controllers/DialogController.php53
-rw-r--r--application/modules/ui/controllers/SubpageController.php60
-rw-r--r--application/modules/ui/views/scripts/dialog/bootmedia.create.phtml18
-rw-r--r--application/modules/ui/views/scripts/dialog/bootmedia.progress.phtml17
-rw-r--r--application/modules/ui/views/scripts/dialog/get.phtml2
-rw-r--r--application/modules/ui/views/scripts/dialog/menu.create.phtml14
-rw-r--r--application/modules/ui/views/scripts/dialog/menu.createassignment.phtml22
-rw-r--r--application/modules/ui/views/scripts/dialog/menu.createentry.phtml18
-rw-r--r--application/modules/ui/views/scripts/dialog/menu.createentry2.phtml20
-rw-r--r--application/modules/ui/views/scripts/subpage/bootmedia.actionmenu.phtml2
-rw-r--r--application/modules/ui/views/scripts/subpage/bootmedia.list.phtml5
-rw-r--r--application/modules/ui/views/scripts/subpage/get.phtml2
-rw-r--r--application/modules/ui/views/scripts/subpage/menu.actionmenu-entries.phtml3
-rw-r--r--application/modules/ui/views/scripts/subpage/menu.actionmenu-menuassignment.phtml1
-rw-r--r--application/modules/ui/views/scripts/subpage/menu.actionmenu.phtml1
-rw-r--r--application/modules/ui/views/scripts/subpage/menu.assignmentlist.phtml5
-rw-r--r--application/modules/ui/views/scripts/subpage/menu.entrylist.phtml5
-rw-r--r--application/modules/ui/views/scripts/subpage/menu.list.phtml5
-rw-r--r--application/views/helpers/BaseUrl.php10
-rw-r--r--application/views/scripts/error/error.phtml28
-rw-r--r--application/views/scripts/index/bootmedia.phtml13
-rw-r--r--application/views/scripts/index/index.phtml3
-rw-r--r--application/views/scripts/index/menu.phtml13
-rw-r--r--application/views/scripts/index/menuassignment.phtml13
64 files changed, 2051 insertions, 0 deletions
diff --git a/application/Bootstrap.php b/application/Bootstrap.php
new file mode 100644
index 0000000..35400b1
--- /dev/null
+++ b/application/Bootstrap.php
@@ -0,0 +1,57 @@
+<?php
+
+class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
+{
+ protected function _initAutoload()
+ {
+ $moduleLoader = new Zend_Application_Module_Autoloader(
+ array(
+ 'namespace' => '',
+ 'basePath' => APPLICATION_PATH
+ )
+ );
+ return $moduleLoader;
+ }
+
+ protected function _initDbSetup()
+ {
+ $logger = new Zend_Log();
+ $w = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/debug.log');
+
+ $logger->addWriter($w);
+
+ $this->bootstrap('Db');
+ $db = $this->getResource('Db');
+ $tables = $db->listTables();
+ if(empty($tables)) {
+ $sql = file_get_contents(APPLICATION_PATH . '/configs/db.sql');
+ $logger->info("Setup DB");
+ $sqlcommands = explode(";\n",$sql);
+ try{
+ foreach($sqlcommands as $s) {
+ $db->getConnection()->exec($s);
+ }
+ }
+ catch (Exception $e) {
+ $logger->warn($e->getMessage());
+ }
+ } else {
+ $logger->info("Skip DB setup");
+
+ }
+ return;
+ }
+
+ public function _initViewHelpers()
+ {
+ $this->bootstrap('layout');
+ $layout = $this->getResource('layout');
+ $view = $layout->getView();
+ $view->doctype('XHTML1_STRICT');
+ $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
+ $view->headTitle()->setSeparator(' :: ');
+ $view->headTitle('OpenSLX PBS');
+ }
+
+}
+
diff --git a/application/configs/application.ini b/application/configs/application.ini
new file mode 100644
index 0000000..3e2230b
--- /dev/null
+++ b/application/configs/application.ini
@@ -0,0 +1,30 @@
+[production]
+phpSettings.display_startup_errors = 0
+phpSettings.display_errors = 0
+includePaths.library = APPLICATION_PATH "/../library"
+bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
+bootstrap.class = "Bootstrap"
+resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
+resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
+resources.frontController.defaultControllerName = "index"
+resources.frontController.defaultAction = "index"
+resources.modules[] = "backend"
+resources.db.adapter = PDO_SQLITE;
+resources.db.params.dbname = APPLICATION_PATH "/../data/db/pbs.db"
+resources.db.isDefaultTableAdapter = true
+
+resources.layout.layoutpath = APPLICATION_PATH "/layouts"
+
+[staging : production]
+resources.db.params.dbname = APPLICATION_PATH "/../data/db/pbs.db"
+
+
+[testing : production]
+resources.db.params.dbname = APPLICATION_PATH "/../data/db/pbs.testing.db"
+phpSettings.display_startup_errors = 1
+phpSettings.display_errors = 1
+
+[development : production]
+resource.db.params.dbname = APPLICATION_PATH "/../data/db/pbs.development.db"
+phpSettings.display_startup_errors = 1
+phpSettings.display_errors = 1
diff --git a/application/configs/db.sql b/application/configs/db.sql
new file mode 100644
index 0000000..48efbe3
--- /dev/null
+++ b/application/configs/db.sql
@@ -0,0 +1,83 @@
+CREATE TABLE pbs (
+ id INTEGER PRIMARY KEY,
+ attribute TEXT,
+ val TEXT
+);
+
+INSERT INTO pbs (attribute, val) VALUES ("version", "0.1");
+INSERT INTO pbs (attribute, val) VALUES ("location", "http://pbs.lan/");
+INSERT INTO pbs (attribute, val) VALUES ("uclibrootfs-version", "1");
+
+CREATE TABLE systems (
+ id INTEGER PRIMARY KEY,
+ external_id TEXT,
+ append TEXT,
+ description TEXT,
+ initrd TEXT,
+ kernel TEXT,
+ name TEXT,
+ source TEXT
+);
+
+CREATE TABLE sources (
+ ip TEXT PRIMARY KEY,
+ version TEXT,
+ lastdemux TEXT,
+ description TEXT
+);
+
+CREATE TABLE kernels (
+ id INTEGER PRIMARY KEY,
+ kernel TEXT,
+ kernel_md5 TEXT,
+ initramfs_md5 TEXT
+);
+
+CREATE TABLE bootmedia (
+ id INTEGER PRIMARY KEY,
+ kernel TEXT,
+ name TEXT,
+ identifier TEXT,
+ description TEXT,
+ created TEXT,
+ theme TEXT,
+ mediatype TEXT
+);
+
+CREATE TABLE menus (
+ id INTEGER PRIMARY KEY,
+ name TEXT,
+ description TEXT,
+ theme TEXT
+);
+
+CREATE TABLE menu_entries (
+ id INTEGER PRIMARY KEY,
+ menu_id INTEGER,
+ entry_order INTEGER,
+ system_id INTEGER,
+ overwrite_caption INTEGER,
+ overwrite_append INTEGER,
+ alternative_caption TEXT,
+ alternative_append TEXT
+);
+
+CREATE TABLE menu_assignments (
+ id INTEGER PRIMARY KEY,
+ name TEXT,
+ menu_id INTEGER
+);
+
+CREATE TABLE menu_assignment_iprules (
+ id INTEGER PRIMARY KEY,
+ menu_assignment_rule INTEGER,
+ ip TEXT,
+ netmask TEXT
+);
+
+CREATE TABLE menu_assignment_bmrules (
+ id INTEGER PRIMARY KEY,
+ menu_assignment_rule INTEGER,
+ bootmedia_id INTEGER
+);
+
diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php
new file mode 100644
index 0000000..8fec924
--- /dev/null
+++ b/application/controllers/ErrorController.php
@@ -0,0 +1,31 @@
+<?php
+
+class ErrorController extends Zend_Controller_Action
+{
+
+ public function errorAction()
+ {
+ $errors = $this->_getParam('error_handler');
+
+ switch ($errors->type) {
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
+
+ // 404 error -- controller or action not found
+ $this->getResponse()->setHttpResponseCode(404);
+ $this->view->message = 'Page not found';
+ break;
+ default:
+ // application error
+ $this->getResponse()->setHttpResponseCode(500);
+ $this->view->message = 'Application error';
+ break;
+ }
+
+ $this->view->exception = $errors->exception;
+ $this->view->request = $errors->request;
+ }
+
+
+}
+
diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php
new file mode 100644
index 0000000..333b38e
--- /dev/null
+++ b/application/controllers/IndexController.php
@@ -0,0 +1,66 @@
+<?php
+
+class IndexController extends Zend_Controller_Action
+{
+
+ public function init()
+ {
+ $burl = $this->view->baseUrl();
+ $v = $this->view;
+
+ $v->headLink()
+ ->prependStylesheet($burl .'/styles/site.css')
+ ->appendStylesheet($burl.'/styles/smoothness/jquery-ui-1.7.2.custom.css');
+ $v->headScript()
+ ->setFile($burl.'/js/jquery-1.3.2.min.js')
+ ->appendFile($burl.'/js/jquery-ui-1.7.2.custom.min.js')
+ ->appendFile($burl.'/js/pbs.js');
+
+ $v->menubar = array(
+ "Home" => "/",
+ "Bootmedia" => "/index/bootmedia",
+ "Menus" => "/index/menu",
+ "Menu Assignment" => "/index/menuassignment",
+ "Systeminfo" => "/index/sysinfo"
+ );
+ }
+
+ public function indexAction()
+ {
+ $this->view->title = "Home";
+ $this->view->headTitle($this->view->title, 'APPEND');
+ }
+
+ public function menuAction()
+ {
+ $this->view->title = "Menus";
+ $this->view->headTitle($this->view->title, 'APPEND');
+
+ }
+
+ public function bootmediaAction()
+ {
+ $this->view->title = "Bootmedia";
+ $this->view->headTitle($this->view->title, 'APPEND');
+
+ }
+
+ public function menuassignmentAction()
+ {
+ $this->view->title = "Menu Assignment";
+ $this->view->headTitle($this->view->title, 'APPEND');
+
+ }
+
+ public function sysinfoAction()
+ {
+ $this->view->title = "System Information";
+ $this->view->headTitle($this->view->title, 'APPEND');
+
+ }
+
+
+}
+
+
+
diff --git a/application/layouts/layout.phtml b/application/layouts/layout.phtml
new file mode 100644
index 0000000..45552f3
--- /dev/null
+++ b/application/layouts/layout.phtml
@@ -0,0 +1,56 @@
+<?= $this->doctype() ?>
+<html xmlns="http://www.w3c.org/1999/xhtml" xml:lang="de" lang="de">
+<head>
+<?= $this->headMeta() ?>
+<?= $this->headTitle() ?>
+<?= $this->headLink() ?>
+<?= $this->headScript() ?>
+</head>
+<body>
+<div id="wrapper">
+<div id="header-container">
+<div id="header-background">
+<img src="/images/bg_title3.png"/>
+<div id="header-logo">
+<img src="/images/logo.png" />
+</div>
+</div>
+<div id="top-menu">
+<ul>
+<li><a href="http://openslx.org">OpenSLX</a> |</li>
+<li><a href="http://labs.openslx.org">OpenSLX Labs</a> |</li>
+<li><a href="http://blog.openslx.org">Blog</a></li>
+</ul>
+</div>
+<div id="header-centerbox">
+<h1>:: <?= $this->escape($this->title) ?> ::</h1>
+<div id="header-menubar">
+<? if (!empty($this->menubar)) :?>
+<? $num = count($this->menubar); ?>
+<ul>
+<? foreach ($this->menubar as $title => $link) : ?>
+ <li><a href="<?= $link ?>"><?= $title ?></a></li>
+<? endforeach; ?>
+</ul>
+<? endif;?>
+</div>
+</div>
+</div>
+<div id="content">
+<div id="content-centerbox">
+<?= $this->layout()->content ?>
+</div>
+</div>
+<div id="footer">
+<div id="footer-centerbox">
+<center>
+<p>OpenSLX PBS Version 0.1</p>
+<p class="copyright">Copyright © 2009 - S.Schmelzer // OpenSLX GmbH<br/>
+This application is free software distributed under the GPL version 2.<br/>
+</p>
+</center>
+</div>
+</div>
+</div>
+</body>
+</html>
diff --git a/application/models/Bootmedia.php b/application/models/Bootmedia.php
new file mode 100644
index 0000000..b9e806f
--- /dev/null
+++ b/application/models/Bootmedia.php
@@ -0,0 +1,8 @@
+<?php
+
+class Model_Bootmedia extends Zend_Db_Table_Abstract
+{
+ protected $_name = 'bootmedia';
+
+}
+
diff --git a/application/models/Kernels.php b/application/models/Kernels.php
new file mode 100644
index 0000000..45f0a42
--- /dev/null
+++ b/application/models/Kernels.php
@@ -0,0 +1,8 @@
+<?php
+
+class Model_Kernels extends Zend_Db_Table_Abstract
+{
+ protected $_name = 'kernels';
+
+}
+
diff --git a/application/models/Menuassignmentbm.php b/application/models/Menuassignmentbm.php
new file mode 100644
index 0000000..589ba0e
--- /dev/null
+++ b/application/models/Menuassignmentbm.php
@@ -0,0 +1,8 @@
+<?php
+
+class Model_Menuassignmentbm extends Zend_Db_Table_Abstract
+{
+ protected $_name = 'menu_assignment_bmrules';
+
+}
+
diff --git a/application/models/Menuassignmentip.php b/application/models/Menuassignmentip.php
new file mode 100644
index 0000000..24aa91c
--- /dev/null
+++ b/application/models/Menuassignmentip.php
@@ -0,0 +1,8 @@
+<?php
+
+class Model_Menuassignmentip extends Zend_Db_Table_Abstract
+{
+ protected $_name = 'menu_assignment_iprules';
+
+}
+
diff --git a/application/models/Menuassignments.php b/application/models/Menuassignments.php
new file mode 100644
index 0000000..6030ece
--- /dev/null
+++ b/application/models/Menuassignments.php
@@ -0,0 +1,8 @@
+<?php
+
+class Model_Menuassignments extends Zend_Db_Table_Abstract
+{
+ protected $_name = 'menu_assignments';
+
+}
+
diff --git a/application/models/Menuentries.php b/application/models/Menuentries.php
new file mode 100644
index 0000000..306a838
--- /dev/null
+++ b/application/models/Menuentries.php
@@ -0,0 +1,8 @@
+<?php
+
+class Model_Menuentries extends Zend_Db_Table_Abstract
+{
+ protected $_name = 'menu_entries';
+
+}
+
diff --git a/application/models/Menus.php b/application/models/Menus.php
new file mode 100644
index 0000000..31bc75d
--- /dev/null
+++ b/application/models/Menus.php
@@ -0,0 +1,8 @@
+<?php
+
+class Model_Menus extends Zend_Db_Table_Abstract
+{
+ protected $_name = 'menus';
+
+}
+
diff --git a/application/models/Sources.php b/application/models/Sources.php
new file mode 100644
index 0000000..7fe4926
--- /dev/null
+++ b/application/models/Sources.php
@@ -0,0 +1,8 @@
+<?php
+
+class Model_Sources extends Zend_Db_Table_Abstract
+{
+ protected $_name = 'sources';
+
+}
+
diff --git a/application/models/Systems.php b/application/models/Systems.php
new file mode 100644
index 0000000..dd31af5
--- /dev/null
+++ b/application/models/Systems.php
@@ -0,0 +1,7 @@
+<?php
+
+class Model_Systems extends Zend_Db_Table_Abstract
+{
+ protected $_name = 'systems';
+
+}
diff --git a/application/modules/backend/controllers/BootmediaController.php b/application/modules/backend/controllers/BootmediaController.php
new file mode 100644
index 0000000..1e0de8c
--- /dev/null
+++ b/application/modules/backend/controllers/BootmediaController.php
@@ -0,0 +1,53 @@
+<?php
+
+class Backend_BootmediaController extends Zend_Controller_Action
+{
+ private $_mbootmedia;
+ private $_logger;
+
+ public function init()
+ {
+ $this->_helper->layout->disableLayout();
+ #$this->_helper->viewRenderer->setNoRender();
+
+ $this->_mbootmedia = new Model_Bootmedia();
+
+
+ $this->_logger = new Zend_Log();
+ $w = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/debug.log');
+
+ $this->_logger->addWriter($w);
+ }
+
+ public function indexAction()
+ {
+ // action body
+ }
+
+ public function delAction()
+ {
+ $this->_helper->viewRenderer->setNoRender();
+
+ $id = $this->getRequest()->getParam("id");
+
+ $w = $this->_mbootmedia->getAdapter()->quoteInto('id = ?', $id);
+ $this->_mbootmedia->delete($w);
+ }
+
+ public function listAction()
+ {
+ $data = $this->_mbootmedia->fetchAll()->toArray();
+ $this->view->listdata = $data;
+ }
+
+
+}
+
+
+
+
+
+
+
+
+
diff --git a/application/modules/backend/controllers/JsonController.php b/application/modules/backend/controllers/JsonController.php
new file mode 100644
index 0000000..61da947
--- /dev/null
+++ b/application/modules/backend/controllers/JsonController.php
@@ -0,0 +1,84 @@
+<?php
+
+class Backend_JsonController extends Zend_Controller_Action
+{
+ private $_mkernel;
+ private $_msources;
+ private $_msystems;
+ private $_mbootmedia;
+ private $_mmenus;
+ private $_logger;
+
+ public function init()
+ {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $this->_mkernels = new Model_Kernels();
+ $this->_mmenus = new Model_Menus();
+ $this->_msources = new Model_Sources();
+ $this->_msystems = new Model_Systems();
+ $this->_mbootmedia = new Model_Bootmedia();
+
+
+ $this->_logger = new Zend_Log();
+ $w = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/debug.log');
+
+ $this->_logger->addWriter($w);
+ }
+
+ public function indexAction()
+ {
+ // action body
+ }
+
+ public function kernelAction()
+ {
+ $kernels = $this->_mkernels->fetchAll()->toArray();
+ echo (json_encode($kernels));
+ }
+
+ public function menuAction()
+ {
+ $menus = $this->_mmenus->fetchAll()->toArray();
+ echo (json_encode($menus));
+ }
+
+ public function bootmediaAction()
+ {
+ $bootmedia= $this->_mbootmedia->fetchAll()->toArray();
+ echo (json_encode($bootmedia));
+ }
+
+ public function sourcesAction()
+ {
+ $sources = $this->_msources->fetchAll()->toArray();
+ echo (json_encode($sources));
+
+ }
+
+ public function systemsAction()
+ {
+ $ip = $this->getRequest()->getParam('ip');
+ if (!empty($ip)) {
+ $s = $this->_msystems->select();
+ $s->where('source = ?', $ip);
+ $systems = $this->_msystems->fetchAll($s)->toArray();
+ } else {
+ $systems = $this->_msystems->fetchAll()->toArray();
+ }
+ echo (json_encode($systems));
+ }
+
+
+
+}
+
+
+
+
+
+
+
+
+
diff --git a/application/modules/backend/controllers/MenuController.php b/application/modules/backend/controllers/MenuController.php
new file mode 100644
index 0000000..f8c6a7f
--- /dev/null
+++ b/application/modules/backend/controllers/MenuController.php
@@ -0,0 +1,210 @@
+<?php
+
+class Backend_MenuController extends Zend_Controller_Action
+{
+ private $_mmenus;
+ private $_mmenu_entries;
+ private $_mmenu_assignments;
+ private $_mmenu_assignment_iprules;
+ private $_mmenu_assignment_bmrules;
+
+ private $_logger;
+
+ public function init()
+ {
+ $this->_helper->layout->disableLayout();
+ #$this->_helper->viewRenderer->setNoRender();
+
+ $this->_mmenus = new Model_Menus();
+ $this->_mmenu_entries = new Model_Menuentries();
+ $this->_mmenu_assignments = new Model_Menuassignments();
+ $this->_mmenu_assignment_iprules = new Model_Menuassignmentip();
+ $this->_mmenu_assignment_bmrules = new Model_Menuassignmentbm();
+
+
+ $this->_logger = new Zend_Log();
+ $w = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/debug.log');
+
+ $this->_logger->addWriter($w);
+ }
+
+ public function indexAction()
+ {
+ // action body
+ }
+
+ public function listentriesAction()
+ {
+ $mid = $this->getRequest()->getParam('id');
+ $s = $this->_mmenu_entries->select(Zend_Db_Table::SELECT_WITH_FROM_PART);
+ $s->setIntegrityCheck(false)
+ ->where('menu_id = ?', $mid)
+ ->joinLeft(array('s' => 'systems'), 's.id = menu_entries.system_id',
+ array('s_name' => 'name',
+ 's_external_id' => 'external_id',
+ 's_source' => 'source'))
+ ->order('entry_order');
+ $data = $this->_mmenu_entries->fetchAll($s)->toArray();
+ $this->view->listdata = $data;
+ }
+
+ public function listAction()
+ {
+ $data = $this->_mmenus->fetchAll()->toArray();
+ $this->view->listdata = $data;
+ }
+
+ public function addAction()
+ {
+ $this->_helper->viewRenderer->setNoRender();
+ $name = $this->getRequest()->getParam("name");
+ $description = $this->getRequest()->getParam("description");
+
+ #TODO: make themes selectable
+ $db_data = array(
+ "name" => $name,
+ "description" => $description,
+ "theme" => "openslx"
+ );
+
+ $this->_mmenus->insert($db_data);
+
+ }
+
+ public function delAction()
+ {
+ $this->_helper->viewRenderer->setNoRender();
+
+ $id = $this->getRequest()->getParam("id");
+
+ $w = $this->_mmenus->getAdapter()->quoteInto('id = ?', $id);
+ $this->_mmenus->delete($w);
+
+ $w = $this->_mmenu_entries->getAdapter()->quoteInto('menu_id = ?', $id);
+ $this->_mmenu_entries->delete($w);
+
+ }
+
+ public function addentryAction()
+ {
+ $this->_helper->viewRenderer->setNoRender();
+
+ $menu = $this->getRequest()->getParam("menu");
+ $system = $this->getRequest()->getParam("system");
+ $altCaptionSet = $this->getRequest()->getParam("altCaptionSet");
+ $altCaption = ($altCaptionSet) ? $this->getRequest()->getParam("altCaption") : null;
+ $altAppendSet = $this->getRequest()->getParam("altAppendSet");
+ $altAppend = ($altAppendSet) ? $this->getRequest()->getParam("altAppend") : null;
+
+ $db_data = array(
+ "menu_id" => $menu,
+ "system_id" => $system,
+ "overwrite_caption" => $altCaptionSet,
+ "overwrite_append" => $altAppendSet,
+ "alternative_caption" => $altCaption,
+ "alternative_append" => $altAppend
+ );
+
+ $this->_mmenu_entries->insert($db_data);
+
+ }
+
+ public function saveentryorderAction() {
+ $this->_helper->viewRenderer->setNoRender();
+ $data = $this->getRequest()->getParam("data");
+
+ $data = explode(';', $data);
+ foreach ($data as $d) {
+ if (!empty($d)) {
+ list($id, $order) = explode(':', $d);
+ $db_data = array(
+ 'entry_order' => $order
+ );
+ $w = $this->_mmenu_entries->getAdapter()->quoteInto('id = ?', $id);
+ $this->_mmenu_entries->update($db_data, $w);
+ }
+ }
+
+ }
+
+ public function delentryAction()
+ {
+ $this->_helper->viewRenderer->setNoRender();
+
+ $id = $this->getRequest()->getParam("id");
+
+ $w = $this->_mmenu_entries->getAdapter()->quoteInto('id = ?', $id);
+ $this->_mmenu_entries->delete($w);
+ }
+
+ public function listassignmentsAction()
+ {
+ $l = $this->_logger;
+ $s = $this->_mmenu_assignments->select(Zend_Db_Table::SELECT_WITH_FROM_PART);
+ $s->setIntegrityCheck(false)
+ ->joinLeft(array('m' => 'menus'), 'm.id = menu_assignments.menu_id',
+ array('m_name' => 'name'))
+ ->joinLeft(array('i' => 'menu_assignment_iprules'), 'i.menu_assignment_rule = menu_assignments.id',
+ array('i_ip' => 'ip',
+ 'i_netmask' => 'netmask'))
+ ->joinLeft(array('b' => 'menu_assignment_bmrules'), 'b.menu_assignment_rule = menu_assignments.id',
+ array('b_bootmedia_id' => 'bootmedia_id'))
+ ->joinLeft(array('bm' => 'bootmedia'), 'bm.id = b.bootmedia_id',
+ array('b_name' => 'name'))
+ ->order(array('menu_id', 'i_netmask', 'b_bootmedia'));
+ $l->info('[menucontroller] '. $s->assemble());
+ $data = $this->_mmenu_assignments->fetchAll($s)->toArray();
+ $this->view->listdata = $data;
+ }
+
+ public function addassignmentAction()
+ {
+ $this->_helper->viewRenderer->setNoRender();
+
+ $name = $this->getRequest()->getParam("name");
+ $menu = $this->getRequest()->getParam("menu");
+ $bootmedia = $this->getRequest()->getParam("bootmedia");
+ $ip = $this->getRequest()->getParam("ip");
+
+ if (empty($ip) || !strpos($ip, "/")) {
+ $ip = ""; $netmask="";
+ } else {
+ list($ip, $netmask) = explode("/", $ip);
+ }
+
+ $db_data = array(
+ 'name' => $name,
+ 'menu_id' => $menu
+ );
+
+ $id = (int)$this->_mmenu_assignments->insert($db_data);
+
+ if ($bootmedia != "all") {
+ $db_data = array (
+ 'menu_assignment_rule' => $id,
+ 'bootmedia_id' => $bootmedia
+ );
+ $this->_mmenu_assignment_bmrules->insert($db_data);
+ }
+
+ if (!empty($ip)) {
+ $db_data = array (
+ 'menu_assignment_rule' => $id,
+ 'ip' => $ip,
+ 'netmask' => $netmask
+ );
+ $this->_mmenu_assignment_iprules->insert($db_data);
+ }
+
+ }
+
+}
+
+
+
+
+
+
+
+
+
diff --git a/application/modules/backend/controllers/MkisoController.php b/application/modules/backend/controllers/MkisoController.php
new file mode 100644
index 0000000..b0b4fd5
--- /dev/null
+++ b/application/modules/backend/controllers/MkisoController.php
@@ -0,0 +1,283 @@
+<?php
+
+class Backend_MkisoController extends Zend_Controller_Action
+{
+ private $_mkernel;
+ private $_msources;
+ private $_mbootmedia;
+ private $_logger;
+
+ private function smartCopy($source, $dest, $folderPermission=0755,$filePermission=0644){
+ $result=false;
+
+ if (is_file($source)) { # $source is file
+ if(is_dir($dest)) { # $dest is folder
+ if ($dest[strlen($dest)-1]!='/') # add '/' if necessary
+ $__dest=$dest."/";
+ $__dest .= basename($source);
+ }
+ else { # $dest is (new) filename
+ $__dest=$dest;
+ }
+ $result=copy($source, $__dest);
+ chmod($__dest,$filePermission);
+ }
+ elseif(is_dir($source)) { # $source is dir
+ if(!is_dir($dest)) { # dest-dir not there yet, create it
+ @mkdir($dest,$folderPermission);
+ chmod($dest,$folderPermission);
+ }
+ if ($source[strlen($source)-1]!='/') # add '/' if necessary
+ $source=$source."/";
+ if ($dest[strlen($dest)-1]!='/') # add '/' if necessary
+ $dest=$dest."/";
+
+ # find all elements in $source
+ $result = true; # in case this dir is empty it would otherwise return false
+ $dirHandle=opendir($source);
+ while($file=readdir($dirHandle)) { # note that $file can also be a folder
+ if($file!="." && $file!="..") { # filter starting elements and pass the rest to this function again
+ # echo "$source$file ||| $dest$file<br />\n";
+ $result=smartCopy($source.$file, $dest.$file, $folderPermission, $filePermission);
+ }
+ }
+ closedir($dirHandle);
+ }
+ else {
+ $result=false;
+ }
+ return $result;
+ }
+
+ public function init()
+ {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $this->_mkernels = new Model_Kernels();
+ $this->_msources = new Model_Sources();
+ $this->_mbootmedia = new Model_Bootmedia();
+
+
+ $this->_logger = new Zend_Log();
+ $w = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/debug.log');
+
+ $this->_logger->addWriter($w);
+ }
+
+ private function delTree($dir) {
+ $files = glob( $dir . '*', GLOB_MARK );
+ foreach( $files as $file ){
+ if( substr( $file, -1 ) == '/' )
+ $this->delTree( $file );
+ else
+ unlink( $file );
+ }
+
+ if (is_dir($dir)) rmdir( $dir );
+
+ }
+
+ public function indexAction()
+ {
+
+ }
+
+ public function prepareAction() {
+ $l = $this->_logger;
+
+ $kernel = $this->getRequest()->getParam('kernel');
+ $name = $this->getRequest()->getParam('name');
+ $description = $this->getRequest()->getParam('description');
+ $identifier = dechex(mktime());
+
+ $tmppath = APPLICATION_PATH . "/../data/tmp";
+ $cdpath = $tmppath . "/cd";
+ $isoDir = "$cdpath/iso/isolinux";
+ $syslinuxpath = APPLICATION_PATH . "/../data/syslinux";
+
+
+ if (!is_dir($isoDir))
+ mkdir($isoDir, 0777, true);
+ $files = array('LICENSE', 'README.iso', 'vesamenu.c32', 'isolinux.bin');
+ foreach ($files as $f) copy ($syslinuxpath . "/$f", $isoDir . "/$f");
+ $l->info("copy syslinux files to tmp");
+
+ if ($kernel != "auto") {
+ $s = $this->_mkernels->select();
+ $s->where("kernel = ?", $kernel);
+ $r = $this->_mkernels->fetchAll($s)->toArray();
+ }
+
+ #TODO: fetch newest kernel or let user select kernel
+ if ($kernel == "auto" || empty($r)){
+ #TODO: build in some ordering to get the newest kernel..
+ #$s = $this->_mkernels->select();
+ $r = $this->_mkernels->fetchAll()->toArray();
+ }
+
+ $r = $r[0];
+
+ $kernel = $r['kernel'];
+ $kernelpath = APPLICATION_PATH . "/../data/kernels/$kernel";
+
+ $files = array('vmlinuz', 'initramfs');
+ foreach ($files as $f) copy ($kernelpath . "/$f", $isoDir . "/$f");
+ $l->info("copy kernel/initramfs to tmp");
+
+ $isolinuxConfig = "DEFAULT vesamenu.c32\n";
+ $isolinuxConfig .= "PROMPT 0\n";
+ $isolinuxConfig .= "TIMEOUT 100\n";
+ $isolinuxConfig .= file_get_contents($syslinuxpath . "/themes/openslx/theme.conf");
+
+ copy($syslinuxpath . "/themes/openslx/openslx.png", $isoDir . "/openslx.png");
+
+
+ $isolinuxConfig .= '
+MENU TITLE Welcome to OpenSLX PreBoot ISO/CD (Mini Linux/Kexec)
+LABEL SLXSTDBOOT
+ MENU LABEL OpenSLX PreBoot - Stateless Netboot Linux ...
+ MENU DEFAULT
+ KERNEL vmlinuz
+ APPEND initrd=initramfs vga=0x317 pbsId='.$identifier.'
+ TEXT HELP
+ Use this (default) entry if you have configured your client.
+ You have chance to edit the kernel commandline by hitting
+ the TAB key (e.g. for adding debug=3 to it for bug hunting).
+ ENDTEXT
+LABEL LOCALBOOT
+ MENU LABEL Boot locally (skip OpenSLX PreBoot) ...
+ LOCALBOOT -1
+ TEXT HELP
+ Gets you out of here by booting from next device in BIOS
+ boot order.
+ ENDTEXT';
+
+ file_put_contents($isoDir . "/isolinux.cfg", $isolinuxConfig);
+
+ $return = array(
+ "kernel" => $kernel,
+ "name" => $name,
+ "description" => $description,
+ "identifier" => $identifier,
+ "progress" => "30",
+ "progressmsg" => "creating iso",
+ "error" => false,
+ "errormsg" => ""
+ );
+
+ echo(json_encode($return));
+
+ }
+
+ public function createisoAction() {
+ $l = $this->_logger;
+
+ $kernel = $this->getRequest()->getParam('kernel');
+ $name = $this->getRequest()->getParam('name');
+ $description = $this->getRequest()->getParam('description');
+ $identifier = $this->getRequest()->getParam('identifier');
+
+ $tmppath = APPLICATION_PATH . "/../data/tmp";
+ $cdpath = $tmppath . "/cd";
+
+ $mkisofsCmd = 'mkisofs \
+ -o %s \
+ -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 \
+ -r -J -l -boot-info-table -joliet-long \
+ -publisher "OpenSLX Project - http://www.openslx.org" \
+ -p "OpenSLX Project - openslx-devel@openslx.org" \
+ -V "OpenSLX BootISO" \
+ -volset "OpenSLX Project - PreBoot ISO/CD for non PXE/TFTP start of a Linux Stateless Client" \
+ -c isolinux/boot.cat "%s/iso"';
+
+ $outDir = APPLICATION_PATH . "/../public/isos/$identifier";
+ if (!is_dir($outDir))
+ mkdir($outDir, 0777, true);
+
+ $iso = $outDir . "/openslx.iso";
+ $isolog = $outDir . "/openslx.iso.log";
+ $mkisofsCmd = sprintf ($mkisofsCmd, $iso, $cdpath);
+ $output = array();
+ $returnval = null;
+ exec($mkisofsCmd, $output, $returnval);
+
+ $l->info(print_r($output,true));
+
+ $return = array(
+ "kernel" => $kernel,
+ "name" => $name,
+ "description" => $description,
+ "identifier" => $identifier,
+ "progress" => "60",
+ "progressmsg" => "cleaning up",
+ "error" => false,
+ "errormsg" => ""
+ );
+
+ echo(json_encode($return));
+
+ }
+
+ public function cleanupAction() {
+ $l = $this->_logger;
+
+ $kernel = $this->getRequest()->getParam('kernel');
+ $name = $this->getRequest()->getParam('name');
+ $description = $this->getRequest()->getParam('description');
+ $identifier = $this->getRequest()->getParam('identifier');
+
+ $tmppath = APPLICATION_PATH . "/../data/tmp";
+ $cdpath = $tmppath . "/cd";
+
+ $this->delTree($cdpath);
+
+ $return = array(
+ "kernel" => $kernel,
+ "name" => $name,
+ "description" => $description,
+ "identifier" => $identifier,
+ "progress" => "80",
+ "progressmsg" => "update DB",
+ "error" => false,
+ "errormsg" => ""
+ );
+
+ echo(json_encode($return));
+ }
+
+ public function dbAction() {
+
+ $kernel = $this->getRequest()->getParam('kernel');
+ $name = $this->getRequest()->getParam('name');
+ $description = $this->getRequest()->getParam('description');
+ $identifier = $this->getRequest()->getParam('identifier');
+
+ $db_data = array(
+ kernel => $kernel,
+ name => $name,
+ identifier => $identifier,
+ description => $description,
+ theme => "openslx",
+ created => mktime(),
+ mediatype => "cd"
+ );
+
+ $this->_mbootmedia->insert($db_data);
+
+ $return = array(
+ "kernel" => $kernel,
+ "name" => $name,
+ "description" => $description,
+ "identifier" => $identifier,
+ "progress" => "80",
+ "progressmsg" => "update DB",
+ "error" => false,
+ "errormsg" => ""
+ );
+ echo(json_encode(array("progress" => "100", "progressmsg" => "FINISHED!")));
+ }
+
+
+
+}
diff --git a/application/modules/backend/controllers/SystemController.php b/application/modules/backend/controllers/SystemController.php
new file mode 100644
index 0000000..a13ed2a
--- /dev/null
+++ b/application/modules/backend/controllers/SystemController.php
@@ -0,0 +1,273 @@
+<?php
+
+class Backend_SystemController extends Zend_Controller_Action
+{
+
+ private $_msystems;
+ private $_mkernel;
+ private $_logger;
+
+ public function init()
+ {
+ $this->_helper->layout->disableLayout();
+ $this->_msystems = new Model_Systems();
+ $this->_mkernels = new Model_Kernels();
+ $this->_msources = new Model_Sources();
+
+
+ $this->_logger = new Zend_Log();
+ $w = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/debug.log');
+
+ $this->_logger->addWriter($w);
+ }
+
+ public function indexAction()
+ {
+ // action body
+ }
+
+ public function updateinitramfsAction()
+ {
+ // we don't need any view for json output
+ $this->_helper->viewRenderer->setNoRender();
+
+ $l = $this->_logger;
+ $adapter = new Zend_File_Transfer_Adapter_Http();
+ $kernel = $this->getRequest()->getParam('kernel');
+
+ $s = $this->_mkernels->select();
+ $s->where('kernel=?', $data['kernel']);
+ $r = $this->_mkernels->fetchAll($s)->toArray();
+
+ $id = $r[0]['id'];
+
+ #TODO: bild in more checks
+ $targetpath = APPLICATION_PATH . "/../data/kernels/$kernel/";
+
+ if (!is_dir($targetpath))
+ mkdir($targetpath, 0777, true);
+
+ $adapter->setDestination($targetpath);
+
+ #todo add to db
+
+ if (!$adapter->receive()) {
+ $messages = $adapter->getMessages();
+ foreach ($messages as $m) {
+ $l->crit($m);
+ }
+ } else {
+ $db_data = array(
+ 'initramfs_md5' => $adapter->getHash('md5', 'initramfsFile')
+ );
+ $w = $this->_mkernels->getAdapter()->quoteInto('id = ?', $id);
+ $this->_mkernels->update($db_data, $w);
+ $l->info(sprintf(
+ "updated initramfs with following md5s:\n\tinitramfs:\t%s",
+ $adapter->getHash('md5', 'initramfsFile')
+ ));
+ }
+ }
+
+ public function updatekernelAction()
+ {
+ // we don't need any view for json output
+ $this->_helper->viewRenderer->setNoRender();
+
+ $l = $this->_logger;
+ $adapter = new Zend_File_Transfer_Adapter_Http();
+ $kernel = $this->getRequest()->getParam('kernel');
+
+ $s = $this->_mkernels->select();
+ $s->where('kernel=?', $data['kernel']);
+ $r = $this->_mkernels->fetchAll($s)->toArray();
+
+ $id = $r[0]['id'];
+
+ #TODO: bild in more checks
+ $targetpath = APPLICATION_PATH . "/../data/kernels/$kernel/";
+
+ if (!is_dir($targetpath))
+ mkdir($targetpath, 0777, true);
+
+ $adapter->setDestination($targetpath);
+
+ #todo add to db
+
+ if (!$adapter->receive()) {
+ $messages = $adapter->getMessages();
+ foreach ($messages as $m) {
+ $l->crit($m);
+ }
+ } else {
+ $db_data = array(
+ 'kernel_md5' => $adapter->getHash('md5', 'kernelFile')
+ );
+ $w = $this->_mkernels->getAdapter()->quoteInto('id = ?', $id);
+ $this->_mkernels->update($db_data, $w);
+ $l->info(sprintf(
+ "updated kernel with following md5s:\n\tkernel:\t%s",
+ $adapter->getHash('md5', 'kernelFile')
+ ));
+ }
+ }
+
+ public function addkernelAction()
+ {
+ // we don't need any view for json output
+ $this->_helper->viewRenderer->setNoRender();
+
+ $l = $this->_logger;
+ $adapter = new Zend_File_Transfer_Adapter_Http();
+ $kernel = $this->getRequest()->getParam('kernel');
+
+ #TODO: bild in more checks
+ $targetpath = APPLICATION_PATH . "/../data/kernels/$kernel/";
+
+ if (!is_dir($targetpath))
+ mkdir($targetpath, 0777, true);
+
+ $adapter->setDestination($targetpath);
+
+ #todo add to db
+
+ if (!$adapter->receive()) {
+ $messages = $adapter->getMessages();
+ foreach ($messages as $m) {
+ $l->crit($m);
+ }
+ } else {
+ $db_data = array(
+ 'kernel' => $kernel,
+ 'kernel_md5' => $adapter->getHash('md5', 'kernelFile'),
+ 'initramfs_md5' => $adapter->getHash('md5', 'initramfsFile')
+ );
+ $this->_mkernels->insert($db_data);
+ $l->info(sprintf(
+ "added kernel/initramfs with following md5s:\n\tkernel:\t\t%s\n\tinitramfs:\t%s",
+ $adapter->getHash('md5', 'kernelFile'),
+ $adapter->getHash('md5', 'initramfsFile')
+ ));
+ }
+ }
+
+ public function syncAction()
+ {
+ $l = $this->_logger;
+
+ // we don't need any view for json output
+ $this->_helper->viewRenderer->setNoRender();
+
+ // get data from slxconfig-demuxer
+ $data = $this->getRequest()->getParam('data');
+ $data = json_decode(stripslashes($data), true);
+
+ if (empty($data)) return;
+
+ $source = $this->getRequest()->getServer('REMOTE_ADDR');
+
+ // compare md5sums with old values from db
+ $s = $this->_mkernels->select();
+ $s->where('kernel=?', $data['kernel']);
+ $r = $this->_mkernels->fetchAll($s)->toArray();
+
+ $response = array();
+ if (empty($r)) {
+ $response['getKernel'] = "fresh";
+ $response['getInitramfs'] = "fresh";
+ $l->info("request new kernel/initramfs pair");
+ } else {
+ $r = $r[0];
+ if ($data['kernel_md5'] == $r['kernel_md5']) {
+ $response['getKernel'] = "no";
+ $l->info("kernel is still up to date");
+ } else {
+ $response['getKernel'] = "update";
+ $l->info("request updated kernel");
+ }
+ if ($data['initramfs_md5'] == $r['initramfs_md5']) {
+ $response['getInitramfs'] = "no";
+ $l->info("initramfs is still up to date");
+ } else {
+ $response['getInitramfs'] = "update";
+ $l->info("request updated initramfs");
+ }
+ }
+
+ echo(json_encode($response));
+
+ // add systems to db..
+ if (!empty($data['systems'])) {
+ $s = $this->_msystems->select();
+ $s->where('source=?', $source);
+ $r = $this->_msystems->fetchAll($s)->toArray();
+ $externalIDs = array();
+ if (!empty($r)) {
+ foreach ($r as $r_) {
+ $externalIDs[] = $r_['external_id'];
+ }
+ }
+
+ foreach ($data['systems'] as $d) {
+ if (in_array($d['external-id'],$externalIDs)) {
+ $db_data = array(
+ 'name' => $d["label"],
+ 'external_id' => $d["external-id"],
+ 'description' => $d["description"],
+ 'kernel' => $d['vendor-os']['name'] . "/" . basename($d["kernel-file"]),
+ 'initrd' => $d['vendor-os']['name'] . "/" .$d["initramfs-name"],
+ 'append' => $d["append"],
+ 'source' => $source
+ );
+ $w[] = $this->_msystems->getAdapter()
+ ->quoteInto('external_id = ?', $d["external-id"]);
+ $w[] = $this->_msystems->getAdapter()
+ ->quoteInto('source = ?', $source);
+
+ $this->_msystems->update($db_data, $w);
+ $l->info(sprintf("updated system: %s", $d["external-id"]));
+ } else {
+ $db_data = array(
+ 'name' => $d["label"],
+ 'external_id' => $d["external-id"],
+ 'description' => $d["description"],
+ 'kernel' => $d['vendor-os']['name'] . "/" . basename($d["kernel-file"]),
+ 'initrd' => $d['vendor-os']['name'] . "/" .$d["initramfs-name"],
+ 'append' => $d["append"],
+ 'source' => $source
+ );
+ $this->_msystems->insert($db_data);
+ $l->info(sprintf("added system: %s", $d["external-id"]));
+ }
+ }
+ }
+
+ // add / modify systems table
+ $s = $this->_msources->select();
+ $s->where('ip=?', $source);
+ $r = $this->_msources->fetchAll($s)->toArray();
+
+ if (!empty($r)) {
+ $db_data = array(
+ 'version' => $data['slxinfo'],
+ 'lastdemux' => mktime()
+ );
+ $w = $this->_msources->getAdapter()->quoteInto('ip = ?', $source);
+ $this->_msources->update($db_data, $w);
+ } else {
+ $db_data = array(
+ 'ip' => $source,
+ 'version' => $data['slxinfo'],
+ 'lastdemux' => mktime()
+ );
+ $this->_msources->insert($db_data);
+ }
+
+
+ }
+
+
+}
+
+
+
diff --git a/application/modules/backend/controllers/UserController.php b/application/modules/backend/controllers/UserController.php
new file mode 100644
index 0000000..a7a90c2
--- /dev/null
+++ b/application/modules/backend/controllers/UserController.php
@@ -0,0 +1,18 @@
+<?php
+
+class Backend_UserController extends Zend_Controller_Action
+{
+
+ public function init()
+ {
+ /* Initialize action controller here */
+ }
+
+ public function indexAction()
+ {
+ // action body
+ }
+
+
+}
+
diff --git a/application/modules/backend/views/scripts/bootmedia/index.phtml b/application/modules/backend/views/scripts/bootmedia/index.phtml
new file mode 100644
index 0000000..2bd3dd3
--- /dev/null
+++ b/application/modules/backend/views/scripts/bootmedia/index.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>bootmedia</b> and script/action name <b>index</b></center> \ No newline at end of file
diff --git a/application/modules/backend/views/scripts/bootmedia/list.phtml b/application/modules/backend/views/scripts/bootmedia/list.phtml
new file mode 100644
index 0000000..8d441c9
--- /dev/null
+++ b/application/modules/backend/views/scripts/bootmedia/list.phtml
@@ -0,0 +1,20 @@
+<? if (!empty($this->listdata)): ?>
+<? foreach ($this->listdata as $l): ?>
+<div id="bootmedia-item-<?= $l['id'] ?>" class="bootmedia-item ui-corner-all">
+<h3><?= $l['name'] ?></h3>
+<p class="shortinfo">
+kernel: <?= $l['kernel'] ?><br/>
+created: <?= date("r",$l['created']) ?><br/>
+</p>
+<p class="description">
+<b>Description: </b>
+<?= $l['description'] ?>
+</p>
+<p class="list-context-menu">
+<a href="javascript:bootmediaDelete(<?= $l['id'] ?>)" class="ui-corner-all">Delete</a>
+<a href="javascript:bootmediaEdit(<?= $l['id'] ?>)" class="ui-corner-all">Edit</a>
+<a href="/isos/<?= $l['identifier'] ?>/openslx.iso" class="ui-corner-all">Download</a>
+</p>
+</div>
+<? endforeach;?>
+<? endif;?> \ No newline at end of file
diff --git a/application/modules/backend/views/scripts/menu/index.phtml b/application/modules/backend/views/scripts/menu/index.phtml
new file mode 100644
index 0000000..2bd3dd3
--- /dev/null
+++ b/application/modules/backend/views/scripts/menu/index.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>bootmedia</b> and script/action name <b>index</b></center> \ No newline at end of file
diff --git a/application/modules/backend/views/scripts/menu/list.phtml b/application/modules/backend/views/scripts/menu/list.phtml
new file mode 100644
index 0000000..e28e54e
--- /dev/null
+++ b/application/modules/backend/views/scripts/menu/list.phtml
@@ -0,0 +1,15 @@
+<? if (!empty($this->listdata)): ?>
+<? foreach ($this->listdata as $l): ?>
+<div id="menu-item-<?= $l['id'] ?>" class="menu-item ui-corner-all">
+<h3><?= $l['name'] ?></h3>
+<p class="description">
+<?= $l['description'] ?>
+</p>
+<p class="list-context-menu">
+<a href="javascript:menuDelete(<?= $l['id'] ?>)" class="ui-corner-all">Delete</a>
+<a href="javascript:menuEdit(<?= $l['id'] ?>)" class="ui-corner-all">Edit Metadata</a>
+<a href="javascript:menuEditentries(<?= $l['id'] ?>)" class="ui-corner-all">Edit Entries</a>
+</p>
+</div>
+<? endforeach;?>
+<? endif;?> \ No newline at end of file
diff --git a/application/modules/backend/views/scripts/menu/listassignments.phtml b/application/modules/backend/views/scripts/menu/listassignments.phtml
new file mode 100644
index 0000000..2ca982b
--- /dev/null
+++ b/application/modules/backend/views/scripts/menu/listassignments.phtml
@@ -0,0 +1,18 @@
+<? if (!empty($this->listdata)): ?>
+<? foreach ($this->listdata as $l): ?>
+<li id="menuassignment-item-<?= $l['id'] ?>" class="menuassignment-item ui-corner-all">
+<p class="list-caption no-padding">
+<b><?= $l['name'] ?></b><br/>
+[Bootmedia: <?= empty($l['b_bootmedia_id'])? 'All':$l['b_name'] ?>]
+<? if ($l['i_ip']): ?>
+&nbsp; + &nbsp; [IP range: <?= $l['i_ip'] ?>/<?= $l['i_netmask'] ?>]
+<? endif;?>
+&nbsp; &rArr; &nbsp; <?= $l['m_name'] ?>
+</p>
+<p class="list-context-menu no-padding">
+<a href="javascript:menuAssignmentDelete(<?= $l['id'] ?>)" class="ui-corner-all">Delete</a>
+<a href="javascript:menuAssignmentEdit(<?= $l['id'] ?>)" class="ui-corner-all">Edit</a>
+</p>
+</li>
+<? endforeach;?>
+<? endif;?> \ No newline at end of file
diff --git a/application/modules/backend/views/scripts/menu/listentries.phtml b/application/modules/backend/views/scripts/menu/listentries.phtml
new file mode 100644
index 0000000..4d8431e
--- /dev/null
+++ b/application/modules/backend/views/scripts/menu/listentries.phtml
@@ -0,0 +1,19 @@
+<? if (!empty($this->listdata)): ?>
+<? foreach ($this->listdata as $l): ?>
+<li id="menuentries-item-<?= $l['id'] ?>" class="menuentries-item ui-corner-all">
+<span class="menuentries-item-id-value" style="display:none;"><?= $l['id'] ?></span>
+<div class="sortHandle ui-state-default ui-corner-all" ><span class="ui-icon ui-icon-arrow-4"></span></div>
+<p class="list-caption no-padding">
+<? if ($l['overwrite_caption']): ?>
+<b><?= $l['alternative_caption'] ?></b> (<?= $l['s_source'] ?>/<?= $l['s_external_id'] ?>)
+<? else: ?>
+<b><?= $l['s_name'] ?></b> (<?= $l['s_source'] ?>/<?= $l['s_external_id'] ?>)
+<? endif;?>
+</p>
+<p class="list-context-menu no-padding">
+<a href="javascript:menuEntryDelete(<?= $l['id'] ?>)" class="ui-corner-all">Delete</a>
+<a href="javascript:menuEntryEdit(<?= $l['id'] ?>)" class="ui-corner-all">Edit</a>
+</p>
+</li>
+<? endforeach;?>
+<? endif;?> \ No newline at end of file
diff --git a/application/modules/backend/views/scripts/mkiso/index.phtml b/application/modules/backend/views/scripts/mkiso/index.phtml
new file mode 100644
index 0000000..2bd3dd3
--- /dev/null
+++ b/application/modules/backend/views/scripts/mkiso/index.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>bootmedia</b> and script/action name <b>index</b></center> \ No newline at end of file
diff --git a/application/modules/backend/views/scripts/system/add.phtml b/application/modules/backend/views/scripts/system/add.phtml
new file mode 100644
index 0000000..f09beb8
--- /dev/null
+++ b/application/modules/backend/views/scripts/system/add.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>system</b> and script/action name <b>add</b></center> \ No newline at end of file
diff --git a/application/modules/backend/views/scripts/system/addkernel.phtml b/application/modules/backend/views/scripts/system/addkernel.phtml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application/modules/backend/views/scripts/system/addkernel.phtml
diff --git a/application/modules/backend/views/scripts/system/index.phtml b/application/modules/backend/views/scripts/system/index.phtml
new file mode 100644
index 0000000..690f955
--- /dev/null
+++ b/application/modules/backend/views/scripts/system/index.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>system</b> and script/action name <b>index</b></center> \ No newline at end of file
diff --git a/application/modules/backend/views/scripts/system/sync.phtml b/application/modules/backend/views/scripts/system/sync.phtml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application/modules/backend/views/scripts/system/sync.phtml
diff --git a/application/modules/backend/views/scripts/system/updateinitramfs.phtml b/application/modules/backend/views/scripts/system/updateinitramfs.phtml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application/modules/backend/views/scripts/system/updateinitramfs.phtml
diff --git a/application/modules/backend/views/scripts/system/updatekernel.phtml b/application/modules/backend/views/scripts/system/updatekernel.phtml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application/modules/backend/views/scripts/system/updatekernel.phtml
diff --git a/application/modules/backend/views/scripts/user/index.phtml b/application/modules/backend/views/scripts/user/index.phtml
new file mode 100644
index 0000000..c04cb93
--- /dev/null
+++ b/application/modules/backend/views/scripts/user/index.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>user</b> and script/action name <b>index</b></center> \ No newline at end of file
diff --git a/application/modules/bootloader/controllers/EnvController.php b/application/modules/bootloader/controllers/EnvController.php
new file mode 100644
index 0000000..aba575b
--- /dev/null
+++ b/application/modules/bootloader/controllers/EnvController.php
@@ -0,0 +1,218 @@
+<?php
+
+class Bootloader_EnvController extends Zend_Controller_Action
+{
+
+ private $_mmenus;
+ private $_mmenu_entries;
+ private $_mmenu_assignments;
+ private $_mmenu_assignment_iprules;
+ private $_mmenu_assignment_bmrules;
+
+
+ public function init()
+ {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ }
+
+ public function indexAction()
+ {
+ }
+
+ function _ip_netmask_check ($ip, $net, $mask) {
+
+ if (empty($net) OR empty($mask)) return false;
+
+ $ip_net = ip2long ($net);
+ $ip_mask = ~((1 << (32 - $mask)) - 1);
+
+ $ip_ip = ip2long ($ip);
+
+ $ip_ip_net = $ip_ip & $ip_mask;
+
+ return ($ip_ip_net == $ip_net);
+ }
+
+ public function getmenuAction() {
+
+ $mid = $this->getRequest()->getParam('formedia');
+
+ $this->_mmenus = new Model_Menus();
+ $this->_mmenu_entries = new Model_Menuentries();
+ $this->_mmenu_assignments = new Model_Menuassignments();
+ $this->_mmenu_assignment_iprules = new Model_Menuassignmentip();
+ $this->_mmenu_assignment_bmrules = new Model_Menuassignmentbm();
+
+ $s = $this->_mmenu_assignments->select(Zend_Db_Table::SELECT_WITH_FROM_PART);
+ $s->setIntegrityCheck(false)
+ ->joinLeft(array('m' => 'menus'), 'm.id = menu_assignments.menu_id',
+ array('m_name' => 'name'))
+ ->joinLeft(array('i' => 'menu_assignment_iprules'), 'i.menu_assignment_rule = menu_assignments.id',
+ array('i_ip' => 'ip',
+ 'i_netmask' => 'netmask'))
+ ->joinLeft(array('b' => 'menu_assignment_bmrules'), 'b.menu_assignment_rule = menu_assignments.id',
+ array('b_bootmedia_id' => 'bootmedia_id'))
+ ->joinLeft(array('bm' => 'bootmedia'), 'bm.id = b.bootmedia_id',
+ array('b_name' => 'name',
+ 'b_identifier' => 'identifier'))
+ ->order(array('menu_id', 'i_netmask', 'b_bootmedia'));
+ $data = $this->_mmenu_assignments->fetchAll($s)->toArray();
+
+ foreach ($data as $d) {
+ if ($this->_ip_netmask_check($_SERVER['REMOTE_ADDR'], $d['i_ip'], $d['i_netmask'])) {
+ if ($pbs_id == $d['b_identifier']) $r[4][] = $d['menu_id'];
+ else $r[3][] = $d['menu_id'];
+ } else {
+ if ($pbs_id == $d['b_identifier']) $r[2][] = $d['menu_id'];
+ else $r[1][] = $d['menu_id'];
+ }
+ }
+
+ for ($i = 4; $i>0; $i--) {
+ if (!empty($r[$i])) {
+ $r = array_shift($r[$i]);
+ break;
+ }
+ }
+
+ $s = $this->_mmenu_entries->select(Zend_Db_Table::SELECT_WITH_FROM_PART);
+ $s->setIntegrityCheck(false)
+ ->where('menu_id = ?', $r)
+ ->joinLeft(array('s' => 'systems'), 's.id = menu_entries.system_id',
+ array('s_name' => 'name',
+ 's_append' => 'append',
+ 's_external_id' => 'external_id',
+ 's_source' => 'source'))
+ ->order('entry_order');
+ $data = $this->_mmenu_entries->fetchAll($s)->toArray();
+
+
+ $r = array();
+ $c = 1;
+ $mapping = "\n case $(cat result) in ";
+ foreach ($data as $d) {
+ $r[] = "$c \"" . (($d['overwrite_caption'] == 1)? $d['alternative_caption'] : $d['s_name']) . "\"";
+ $m = "\n %s)";
+ $m .= "\n echo \"systemid=%s\" >> /tmp/boot";
+ $m .= "\n echo \"systemname=\\\"%s\\\"\" >> /tmp/boot";
+ $m .= "\n echo \"sysname=%s\" >> /tmp/boot";
+ $m .= "\n echo \"syssource=%s\" >> /tmp/boot";
+ $m .= "\n echo \"append=%s\" >> /tmp/boot";
+ $m .= "\n ;;";
+ $mapping .= sprintf($m,
+ $c,
+ $d['id'],
+ (($d['overwrite_caption'] == 1)? $d['alternative_caption'] : $d['s_name']),
+ $d['s_external_id'],
+ $d['s_source'],
+ (($d['overwrite_append'] == 1)? $d['alternative_append'] : $d['s_append'])
+ );
+ $c++;
+ }
+ $mapping .= "\n esac";
+
+ $entryCount = count($r);
+ $entries = implode(" ", $r);
+
+ $v = $this->view;
+ $v->bootmenu = "$entryCount $entries";
+ $v->bootmenu_mapping = $mapping;
+ echo $v->render('env/bootmenu.dialog');
+ }
+
+ public function getinitAction() {
+
+ $mid = $this->getRequest()->getParam('formedia');
+
+ $v = $this->view;
+ #$v->dialog = "/bin/sh";
+ echo $v->render('env/prebootInit.sh');
+ }
+
+ public function getkernelAction() {
+ $sid = $this->getRequest()->getParam('forsystem');
+ $s = new Model_Systems();
+
+ $d = $s->find($sid)->toArray();
+ $d = $d[0];
+
+
+ $cmd = "atftp %s -g -r %s -l /tmp/vmlinuz";
+ $cmd = sprintf($cmd, $d['source'], $d['kernel']);
+
+ $output = array();
+ $returnval = null;
+ exec($cmd, $output, $returnval);
+
+ $file = "/tmp/vmlinuz";
+
+ header("Content-Type: application/octet-stream");
+ header("Content-Transfer-Encoding: binary");
+ header("Content-Length: " . (string)filesize($file));
+ header('Content-Disposition: attachment; filename="vmlinuz"');
+
+ readfile($file);
+ }
+
+ public function getinitramfsAction() {
+ $sid = $this->getRequest()->getParam('forsystem');
+ $s = new Model_Systems();
+
+ $d = $s->find($sid)->toArray();
+ $d = $d[0];
+
+ $cmd = "atftp %s -g -r %s -l /tmp/initramfs";
+ $cmd = sprintf($cmd, $d['source'], $d['initrd']);
+
+ $output = array();
+ $returnval = null;
+ exec($cmd, $output, $returnval);
+
+ $file = "/tmp/initramfs";
+
+ header("Content-Type: application/octet-stream");
+ header("Content-Transfer-Encoding: binary");
+ header("Content-Length: " . (string)filesize($file));
+ header('Content-Disposition: attachment; filename="initramfs"');
+
+ readfile($file);
+ }
+
+ public function getccAction() {
+ $sid = $this->getRequest()->getParam('forsystem');
+ $s = new Model_Systems();
+
+ $d = $s->find($sid)->toArray();
+ $d = $d[0];
+
+ $file = "/tmp/initramfs.".mktime();
+
+ $cmd = "atftp %s -g -r %s -l $file";
+ $cmd = sprintf($cmd, $d['source'], $d['external_id']);
+
+ $output = array();
+ $returnval = null;
+ exec($cmd, $output, $returnval);
+
+
+ header("Content-Type: application/octet-stream");
+ header("Content-Transfer-Encoding: binary");
+ header("Content-Length: " . (string)filesize($file));
+ header('Content-Disposition: attachment; filename="initramfs"');
+
+ readfile($file);
+ }
+
+ public function __call($a, $b)
+ {
+ var_dump($a,$b);
+ }
+
+
+
+}
+
+
+
diff --git a/application/modules/bootloader/controllers/IndexController.php b/application/modules/bootloader/controllers/IndexController.php
new file mode 100644
index 0000000..7a2fcea
--- /dev/null
+++ b/application/modules/bootloader/controllers/IndexController.php
@@ -0,0 +1,29 @@
+<?php
+
+class Bootloader_IndexController extends Zend_Controller_Action
+{
+
+ public function init()
+ {
+ }
+
+ public function indexAction()
+ {
+ }
+
+ public function getinitAction() {
+ echo "#!/bin/sh";
+
+ }
+
+ public function __call()
+ {
+
+ }
+
+
+
+}
+
+
+
diff --git a/application/modules/bootloader/views/scripts/env/bootmenu.dialog b/application/modules/bootloader/views/scripts/env/bootmenu.dialog
new file mode 100644
index 0000000..7cbf43e
--- /dev/null
+++ b/application/modules/bootloader/views/scripts/env/bootmenu.dialog
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+while [ "x$(cat result)" = "x" ] ; do
+ dialog --no-cancel --menu "OpenSLX Boot Menu" 20 65 <?= $this->bootmenu ?> 2>result
+done
+
+<?= $this->bootmenu_mapping ?> \ No newline at end of file
diff --git a/application/modules/bootloader/views/scripts/env/prebootInit.sh b/application/modules/bootloader/views/scripts/env/prebootInit.sh
new file mode 100644
index 0000000..acf8f33
--- /dev/null
+++ b/application/modules/bootloader/views/scripts/env/prebootInit.sh
@@ -0,0 +1,71 @@
+#!/bin/ash
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# preboot script for user interaction with OpenSLX preloading environment for
+# Linux stateless clients (fetched by Preboot init over the net)
+
+# get configuration
+. /etc/initramfs-setup
+. /etc/pbs.conf
+. ./preboot-scripts/dialog.functions
+
+# bring the mac address into the standard format 01-<MAC>
+client=$(echo 01-$macaddr|sed "s/:/-/g")
+
+# check if already a configuration is available to decide if user interaction
+# is required (path is to be fixed)
+#wget -q -O /tmp/have-user-config "$boot_uri/users.pl?user=${client}"
+#have_user_config=$(cat /tmp/have-user-config);
+
+#if [ "x1" == "x$have_user_config" ]; then
+# wget -q -O /tmp/oldconfig "$boot_uri/users.pl?user=${client}&action=read"
+# . /tmp/oldconfig
+# menu_oldconfig $oldconfig
+#else
+# menu_firststart
+#fi
+#rm result;
+
+# Switch here for several boot TYPE=fastboot/directkiosk/cfgkiosk/slxconfig
+# fastboot - no interaction use system from client config
+# directkiosk - start the default slx system into kiosk (using vmchooser)
+# cfgkiosk - offer the user changes to his kiosk system (GUI environment)
+# slxconfig - offer the user set of configuration options, like setting a non-
+# priviledged user, root password, standard gui, plugins to activate ...
+
+wget -q -O /preboot/bootmenu.dialog ${boot_uri}bootloader/env/getmenu/formedia/$pbs_id
+
+# we expect to have a system selection dialog file in /preboot/bootmenu.dialog
+chmod u+x /preboot/bootmenu.dialog
+/preboot/bootmenu.dialog
+
+. /tmp/boot
+
+
+# fetch kernel and initramfs of selected system
+dialog --infobox "Loading kernel of ${systemname} ..." 3 65
+#ddownload ${boot_uri}bootloader/env/getkernel/forsystem/$systemid "Kernel" /tmp/kernel
+wget -q -O /tmp/kernel ${boot_uri}bootloader/env/getkernel/forsystem/$systemid
+dialog --infobox "Loading initial ramfs of ${systemname} ..." 3 65
+#ddownload ${boot_uri}bootloader/env/getinitramfs/forsystem/$systemid "Initramfs" /tmp/initramfs
+wget -q -O /tmp/initramfs ${boot_uri}bootloader/env/getinitramfs/forsystem/$systemid
+
+# read primary IP configuration to pass it on (behaviour like IPAPPEND=1 of
+# PXElinux)
+. /tmp/ipstuff
+
+[ "x$DEBUGLEVEL" != x0 ] && { clear; ash; }
+
+# start the new kernel with initialramfs and composed cmdline
+dialog --infobox "Booting OpenSLX client $label ... (be patient this could take some time)" 3 69
+kexec -l /tmp/kernel --initrd=/tmp/initramfs \
+ --append="$append file=http://${syssource}/pbs/client-config/${sysname}/pbs.tgz $quiet ip=$ip:$siaddr:$router:$subnet:$dnssrv $debug" 2>/dev/null
+kexec -e >/dev/null 2>&1
diff --git a/application/modules/bootloader/views/scripts/index/index.phtml b/application/modules/bootloader/views/scripts/index/index.phtml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application/modules/bootloader/views/scripts/index/index.phtml
diff --git a/application/modules/ui/controllers/DialogController.php b/application/modules/ui/controllers/DialogController.php
new file mode 100644
index 0000000..6bba3f8
--- /dev/null
+++ b/application/modules/ui/controllers/DialogController.php
@@ -0,0 +1,53 @@
+<?php
+
+class Ui_DialogController extends Zend_Controller_Action
+{
+ private $_mkernel;
+ private $_msources;
+ private $_mbootmedia;
+ private $_logger;
+
+
+ public function init()
+ {
+ $this->_helper->layout->disableLayout();
+ #$this->_helper->viewRenderer->setNoRender();
+
+ $this->_mkernels = new Model_Kernels();
+ $this->_msources = new Model_Sources();
+ $this->_mbootmedia = new Model_Bootmedia();
+
+
+ $this->_logger = new Zend_Log();
+ $w = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/debug.log');
+
+ $this->_logger->addWriter($w);
+ }
+
+ public function indexAction()
+ {
+
+ }
+
+ public function getAction()
+ {
+ $dialog = $this->getRequest()->getParam('bootmedia');
+
+ if (!empty($dialog)) {
+ if (in_array($dialog, array('create', 'progress')))
+ $this->view->dialog =
+ $this->view->render("dialog/bootmedia.$dialog.phtml");
+ }
+
+ $dialog = $this->getRequest()->getParam('menu');
+
+ if (!empty($dialog)) {
+ if (in_array($dialog, array('create', 'createentry', 'createassignment', 'createentry2', 'progress')))
+ $this->view->dialog =
+ $this->view->render("dialog/menu.$dialog.phtml");
+ }
+ }
+
+
+
+}
diff --git a/application/modules/ui/controllers/SubpageController.php b/application/modules/ui/controllers/SubpageController.php
new file mode 100644
index 0000000..51fadd3
--- /dev/null
+++ b/application/modules/ui/controllers/SubpageController.php
@@ -0,0 +1,60 @@
+<?php
+
+class Ui_SubpageController extends Zend_Controller_Action
+{
+ private $_mkernel;
+ private $_msources;
+ private $_mbootmedia;
+ private $_mmenus;
+ private $_logger;
+
+
+ public function init()
+ {
+ $this->_helper->layout->disableLayout();
+ #$this->_helper->viewRenderer->setNoRender();
+
+ $this->_mkernels = new Model_Kernels();
+ $this->_msources = new Model_Sources();
+ $this->_mbootmedia = new Model_Bootmedia();
+ $this->_mmenus = new Model_Menus();
+
+
+ $this->_logger = new Zend_Log();
+ $w = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/debug.log');
+
+ $this->_logger->addWriter($w);
+ }
+
+ public function indexAction()
+ {
+
+ }
+
+ public function getAction()
+ {
+ $subpage = $this->getRequest()->getParam('bootmedia');
+
+ if (!empty($subpage)) {
+ if (in_array($subpage, array('actionmenu', 'list')))
+ $this->view->subpage =
+ $this->view->render("subpage/bootmedia.$subpage.phtml");
+ }
+
+ $subpage = $this->getRequest()->getParam('menu');
+
+ if (!empty($subpage)) {
+ if (in_array($subpage, array('actionmenu','actionmenu-entries','actionmenu-menuassignment', 'list', 'entrylist', 'assignmentlist')))
+ if ($subpage == 'entrylist') {
+ $r = $this->_mmenus->find($this->getRequest()->getParam('id'));
+ $this->view->currentMenu = $r[0];
+ }
+ $this->view->subpage =
+ $this->view->render("subpage/menu.$subpage.phtml");
+ }
+
+ }
+
+
+
+}
diff --git a/application/modules/ui/views/scripts/dialog/bootmedia.create.phtml b/application/modules/ui/views/scripts/dialog/bootmedia.create.phtml
new file mode 100644
index 0000000..44e7569
--- /dev/null
+++ b/application/modules/ui/views/scripts/dialog/bootmedia.create.phtml
@@ -0,0 +1,18 @@
+<div id="dialog-bootmedia-create" title="Create new ISO">
+ <p id="dialog-bootmedia-create-validateTips" class="validateTips">
+ Enter meta data for the image and select the kernel version it should be based on..
+ </p>
+
+ <form>
+ <fieldset>
+ <label for="name">Name</label>
+ <input type="text" name="name" id="name" class="dialog-form ui-widget-content ui-corner-all" />
+ <label for="kernel">Kernel</label>
+ <select size="1" name="kernel" id="kernel" class="dialog-form ui-widget-content ui-corner-all">
+ <option value="auto">let the system choose..</option>
+ </select>
+ <label for="description">Description</label>
+ <textarea name="description" id="description" class="dialog-form ui-widget-content ui-corner-all"></textarea>
+ </fieldset>
+ </form>
+</div>
diff --git a/application/modules/ui/views/scripts/dialog/bootmedia.progress.phtml b/application/modules/ui/views/scripts/dialog/bootmedia.progress.phtml
new file mode 100644
index 0000000..9550248
--- /dev/null
+++ b/application/modules/ui/views/scripts/dialog/bootmedia.progress.phtml
@@ -0,0 +1,17 @@
+<style type="text/css">
+ #progress-text { font-style: italic;}
+ #progressbar {margin: 10px;}
+ #progress-buttonbar {text-align:center; margin-top:16px;}
+</style>
+
+<div id="dialog-bootmedia-progress" title="Building Image ..">
+
+ <div id="progressbar"></div>
+ <center>
+ <p id="progress-text">Prepareing ISO..</p>
+ </center>
+ <p id="progress-buttonbar">
+ <button id="dialog-bootmedia-progress-exit" class="ui-button" type="button" disabled="disabled">Close</button>
+ </p>
+
+</div>
diff --git a/application/modules/ui/views/scripts/dialog/get.phtml b/application/modules/ui/views/scripts/dialog/get.phtml
new file mode 100644
index 0000000..4f1ea39
--- /dev/null
+++ b/application/modules/ui/views/scripts/dialog/get.phtml
@@ -0,0 +1,2 @@
+<!-- Ajax Dialog -->
+<?= $this->dialog ?> \ No newline at end of file
diff --git a/application/modules/ui/views/scripts/dialog/menu.create.phtml b/application/modules/ui/views/scripts/dialog/menu.create.phtml
new file mode 100644
index 0000000..56f2d7f
--- /dev/null
+++ b/application/modules/ui/views/scripts/dialog/menu.create.phtml
@@ -0,0 +1,14 @@
+<div id="dialog-menu-create" title="Create new Menu">
+ <p id="dialog-menu-create-validateTips" class="validateTips">
+ Enter meta data for the menu..
+ </p>
+
+ <form>
+ <fieldset>
+ <label for="dialog-menu-create-name">Name</label>
+ <input type="text" name="name" id="dialog-menu-create-name" class="dialog-form ui-widget-content ui-corner-all" />
+ <label for="dialog-menu-create-description">Description</label>
+ <textarea name="description" id="dialog-menu-create-description" class="dialog-form ui-widget-content ui-corner-all"></textarea>
+ </fieldset>
+ </form>
+</div>
diff --git a/application/modules/ui/views/scripts/dialog/menu.createassignment.phtml b/application/modules/ui/views/scripts/dialog/menu.createassignment.phtml
new file mode 100644
index 0000000..d16b215
--- /dev/null
+++ b/application/modules/ui/views/scripts/dialog/menu.createassignment.phtml
@@ -0,0 +1,22 @@
+<div id="dialog-menu-createassignment" title="Create new Menu Assignment rule">
+ <p id="dialog-menu-createassignment-validateTips" class="validateTips">
+ Enter meta data for the menu..
+ </p>
+
+ <form>
+ <fieldset>
+ <label for="dialog-menu-createassignment-name">Name</label>
+ <input type="text" name="name" id="dialog-menu-createassignment-name" class="dialog-form ui-widget-content ui-corner-all" />
+ <label for="menu">Menu</label>
+ <select size="1" name="menu" id="dialog-menu-createassignment-menu" disabled="disabled" class="dialog-form ui-widget-content ui-corner-all">
+ <option value="none" class="menu-defaultentry">select menu</option>
+ </select>
+ <label for="bootmedia">Bootmedia</label>
+ <select size="1" name="bootmedia" id="dialog-menu-createassignment-bootmedia" disabled="disabled" class="dialog-form ui-widget-content ui-corner-all">
+ <option value="all" class="bootmedia-defaultentry">all known bootmedia..</option>
+ </select>
+ <label for="dialog-menu-createassignment-ip">IP with netmask (format x.x.x.x/x) *optional</label>
+ <input type="text" name="ip" id="dialog-menu-createassignment-ip" class="dialog-form ui-widget-content ui-corner-all" />
+ </fieldset>
+ </form>
+</div>
diff --git a/application/modules/ui/views/scripts/dialog/menu.createentry.phtml b/application/modules/ui/views/scripts/dialog/menu.createentry.phtml
new file mode 100644
index 0000000..326b41f
--- /dev/null
+++ b/application/modules/ui/views/scripts/dialog/menu.createentry.phtml
@@ -0,0 +1,18 @@
+<div id="dialog-menu-createentry" title="Create new menu entry">
+ <p id="dialog-menu-createentry-validateTips" class="validateTips">
+ <b>Step 1:</b> Select source OpenSLX installation and system you want to create a menu entry for..
+ </p>
+
+ <form>
+ <fieldset>
+ <label for="source">Source</label>
+ <select size="1" name="source" id="dialog-menu-createentry-source" disabled="disabled" class="dialog-form ui-widget-content ui-corner-all">
+ <option value="none" class="source-defaultentry">select source</option>
+ </select>
+ <label for="system">System</label>
+ <select size="1" name="system" id="dialog-menu-createentry-system" disabled="disabled" class="dialog-form ui-widget-content ui-corner-all">
+ <option value="none" class="system-defaultentry">select source fist..</option>
+ </select>
+ </fieldset>
+ </form>
+</div>
diff --git a/application/modules/ui/views/scripts/dialog/menu.createentry2.phtml b/application/modules/ui/views/scripts/dialog/menu.createentry2.phtml
new file mode 100644
index 0000000..f9fdac9
--- /dev/null
+++ b/application/modules/ui/views/scripts/dialog/menu.createentry2.phtml
@@ -0,0 +1,20 @@
+<div id="dialog-menu-createentry2" title="Create new menu entry">
+ <p id="dialog-menu-createentry2-validateTips" class="validateTips">
+ <b>Step 2:</b> Modify append and caption if necessary ..
+ </p>
+
+ <form>
+ <fieldset>
+ <label for="caption">Caption</label>
+ <input type="radio" name="alternative-caption" value="0" checked="checked" class="dialog-radio dialog-form ui-widget-content"/> system default: <span id="default-caption"> </span><br/>
+ <input type="radio" name="alternative-caption" value="1" class="dialog-radio dialog-form ui-widget-content"/> alternative caption (only for this menu entry)<br/>
+ <input type="text" name="caption" id="dialog-menu-createentry2-caption" class="dialog-input-indent dialog-form ui-widget-content ui-corner-all" />
+
+ <label for="append">Append</label>
+ <input type="radio" name="alternative-append" value="0" checked="checked" class="dialog-radio dialog-form ui-widget-content"/> system default: <span id="default-append"> </span><br/>
+ <input type="radio" name="alternative-append" value="1" class="dialog-radio dialog-form ui-widget-content"/> alternative append line (only for this menu entry)<br/>
+ <input type="text" name="append" id="dialog-menu-createentry2-append" class="dialog-input-indent dialog-form ui-widget-content ui-corner-all" />
+ <input type="hidden" name="system" id="dialog-menu-createentry2-system" value="" />
+ </fieldset>
+ </form>
+</div>
diff --git a/application/modules/ui/views/scripts/subpage/bootmedia.actionmenu.phtml b/application/modules/ui/views/scripts/subpage/bootmedia.actionmenu.phtml
new file mode 100644
index 0000000..a7b2c10
--- /dev/null
+++ b/application/modules/ui/views/scripts/subpage/bootmedia.actionmenu.phtml
@@ -0,0 +1,2 @@
+<button id="bootmedia-create-button" type="button" class="ui-corner-all action-button"><span class="ui-icon ui-icon-plusthick"></span>Create new CDROM</button>
+<button id="bootmedia-statistics-button" type="button" class="ui-corner-all action-button" disabled="disabled"><span class="ui-icon ui-icon-note"></span>Media Statistics</button>
diff --git a/application/modules/ui/views/scripts/subpage/bootmedia.list.phtml b/application/modules/ui/views/scripts/subpage/bootmedia.list.phtml
new file mode 100644
index 0000000..288cedb
--- /dev/null
+++ b/application/modules/ui/views/scripts/subpage/bootmedia.list.phtml
@@ -0,0 +1,5 @@
+<h2>Available Bootmedia</h2>
+<br/>
+<div id="bootmedia-list-content">
+
+</div>
diff --git a/application/modules/ui/views/scripts/subpage/get.phtml b/application/modules/ui/views/scripts/subpage/get.phtml
new file mode 100644
index 0000000..69ec5e8
--- /dev/null
+++ b/application/modules/ui/views/scripts/subpage/get.phtml
@@ -0,0 +1,2 @@
+<!-- Ajax Subpage -->
+<?= $this->subpage ?> \ No newline at end of file
diff --git a/application/modules/ui/views/scripts/subpage/menu.actionmenu-entries.phtml b/application/modules/ui/views/scripts/subpage/menu.actionmenu-entries.phtml
new file mode 100644
index 0000000..5241042
--- /dev/null
+++ b/application/modules/ui/views/scripts/subpage/menu.actionmenu-entries.phtml
@@ -0,0 +1,3 @@
+<button id="menu-list-button" type="button" class="ui-corner-all action-button"><span class="ui-icon ui-icon-home"></span>List Menus</button>
+<button id="menu-createentry-button" type="button" class="ui-corner-all action-button"><span class="ui-icon ui-icon-plusthick"></span>Create Entry</button>
+<button id="menu-arrangeentries-button" type="button" class="ui-corner-all action-button"><span class="ui-icon ui-icon-refresh"></span>Save Entry Order</button>
diff --git a/application/modules/ui/views/scripts/subpage/menu.actionmenu-menuassignment.phtml b/application/modules/ui/views/scripts/subpage/menu.actionmenu-menuassignment.phtml
new file mode 100644
index 0000000..13f905c
--- /dev/null
+++ b/application/modules/ui/views/scripts/subpage/menu.actionmenu-menuassignment.phtml
@@ -0,0 +1 @@
+<button id="menuassignment-create-button" type="button" class="ui-corner-all action-button"><span class="ui-icon ui-icon-plusthick"></span>Create new ruleset</button>
diff --git a/application/modules/ui/views/scripts/subpage/menu.actionmenu.phtml b/application/modules/ui/views/scripts/subpage/menu.actionmenu.phtml
new file mode 100644
index 0000000..c0742e3
--- /dev/null
+++ b/application/modules/ui/views/scripts/subpage/menu.actionmenu.phtml
@@ -0,0 +1 @@
+<button id="menu-create-button" type="button" class="ui-corner-all action-button"><span class="ui-icon ui-icon-plusthick"></span>Create Menu</button>
diff --git a/application/modules/ui/views/scripts/subpage/menu.assignmentlist.phtml b/application/modules/ui/views/scripts/subpage/menu.assignmentlist.phtml
new file mode 100644
index 0000000..0e27b73
--- /dev/null
+++ b/application/modules/ui/views/scripts/subpage/menu.assignmentlist.phtml
@@ -0,0 +1,5 @@
+<h2>Menu Assignment Rules</h2>
+<br/>
+<ul id="menuassignment-list-content">
+
+</u>
diff --git a/application/modules/ui/views/scripts/subpage/menu.entrylist.phtml b/application/modules/ui/views/scripts/subpage/menu.entrylist.phtml
new file mode 100644
index 0000000..f919375
--- /dev/null
+++ b/application/modules/ui/views/scripts/subpage/menu.entrylist.phtml
@@ -0,0 +1,5 @@
+<h2>Menu: <?= $this->currentMenu['name'] ?></h2>
+<br/>
+<ul id="menuentries-list-content">
+
+</u>
diff --git a/application/modules/ui/views/scripts/subpage/menu.list.phtml b/application/modules/ui/views/scripts/subpage/menu.list.phtml
new file mode 100644
index 0000000..ac4d42f
--- /dev/null
+++ b/application/modules/ui/views/scripts/subpage/menu.list.phtml
@@ -0,0 +1,5 @@
+<h2>Available Menus</h2>
+<br/>
+<div id="menu-list-content">
+
+</div>
diff --git a/application/views/helpers/BaseUrl.php b/application/views/helpers/BaseUrl.php
new file mode 100644
index 0000000..c8e9007
--- /dev/null
+++ b/application/views/helpers/BaseUrl.php
@@ -0,0 +1,10 @@
+<?php
+
+class Zend_View_Helper_BaseUrl
+{
+ function baseUrl()
+ {
+ $fc = Zend_Controller_Front::getInstance();
+ return $fc->getBaseUrl();
+ }
+} \ No newline at end of file
diff --git a/application/views/scripts/error/error.phtml b/application/views/scripts/error/error.phtml
new file mode 100644
index 0000000..1782039
--- /dev/null
+++ b/application/views/scripts/error/error.phtml
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>Zend Framework Default Application</title>
+</head>
+<body>
+ <h1>An error occurred</h1>
+ <h2><?php echo $this->message ?></h2>
+
+ <?php if ('development' == APPLICATION_ENV): ?>
+
+ <h3>Exception information:</h3>
+ <p>
+ <b>Message:</b> <?php echo $this->exception->getMessage() ?>
+ </p>
+
+ <h3>Stack trace:</h3>
+ <pre><?php echo $this->exception->getTraceAsString() ?>
+ </pre>
+
+ <h3>Request Parameters:</h3>
+ <pre><?php echo var_export($this->request->getParams(), true) ?>
+ </pre>
+ <?php endif ?>
+
+</body>
+</html>
diff --git a/application/views/scripts/index/bootmedia.phtml b/application/views/scripts/index/bootmedia.phtml
new file mode 100644
index 0000000..aad361f
--- /dev/null
+++ b/application/views/scripts/index/bootmedia.phtml
@@ -0,0 +1,13 @@
+<div id="action-menu" class="ui-state-default ui-corner-all"></div>
+
+<div id="main">
+</div>
+
+<div id="dialog-anchor">
+</div>
+
+<script>
+$(document).ready(function () {
+ bootmedia();
+});
+</script>
diff --git a/application/views/scripts/index/index.phtml b/application/views/scripts/index/index.phtml
new file mode 100644
index 0000000..93914d0
--- /dev/null
+++ b/application/views/scripts/index/index.phtml
@@ -0,0 +1,3 @@
+<div id="main">
+some content
+</div> \ No newline at end of file
diff --git a/application/views/scripts/index/menu.phtml b/application/views/scripts/index/menu.phtml
new file mode 100644
index 0000000..14eedc7
--- /dev/null
+++ b/application/views/scripts/index/menu.phtml
@@ -0,0 +1,13 @@
+<div id="action-menu" class="ui-state-default ui-corner-all"></div>
+
+<div id="main">
+</div>
+
+<div id="dialog-anchor">
+</div>
+
+<script>
+$(document).ready(function () {
+ menu();
+});
+</script>
diff --git a/application/views/scripts/index/menuassignment.phtml b/application/views/scripts/index/menuassignment.phtml
new file mode 100644
index 0000000..56cb99d
--- /dev/null
+++ b/application/views/scripts/index/menuassignment.phtml
@@ -0,0 +1,13 @@
+<div id="action-menu" class="ui-state-default ui-corner-all"></div>
+
+<div id="main">
+</div>
+
+<div id="dialog-anchor">
+</div>
+
+<script>
+$(document).ready(function () {
+ menuAssignment();
+});
+</script>