[Eis-commits] SF.net SVN: eis: [220] trunk
Status: Pre-Alpha
Brought to you by:
baslijnse
|
From: <luu...@us...> - 2007-11-08 20:18:24
|
Revision: 220
http://eis.svn.sourceforge.net/eis/?rev=220&view=rev
Author: luukvandenbroek
Date: 2007-11-08 12:18:14 -0800 (Thu, 08 Nov 2007)
Log Message:
-----------
added missing elements for server manager everything works except adding modules the element has not yet been made
Modified Paths:
--------------
trunk/cfg/applications.xml
trunk/cfg/webservices.xml
trunk/mod/eis_engine/applications/servermanager.xml
trunk/mod/eis_engine/elements/AddWebService.php
trunk/mod/eis_engine/elements/DeleteEnvironment.php
trunk/mod/eis_engine/elements/DeleteWebService.php
trunk/mod/eis_engine/elements/DisplayApplication.php
trunk/mod/eis_engine/elements/EditWebService.php
trunk/mod/eis_engine/locales/en_en/strings.xml
trunk/mod/eis_engine/services/ConfigService.php
Added Paths:
-----------
trunk/mod/eis_engine/elements/DeleteApplication.php
trunk/mod/eis_engine/elements/EditApplication.php
Modified: trunk/cfg/applications.xml
===================================================================
--- trunk/cfg/applications.xml 2007-10-13 12:06:47 UTC (rev 219)
+++ trunk/cfg/applications.xml 2007-11-08 20:18:14 UTC (rev 220)
@@ -18,10 +18,4 @@
<application>examples</application>
<environment>minimal</environment>
</application>
- <application>
- <name>test</name>
- <module>eis_engine</module>
- <application>welcome</application>
- <environment>minimal</environment>
- </application>
</applications>
Modified: trunk/cfg/webservices.xml
===================================================================
--- trunk/cfg/webservices.xml 2007-10-13 12:06:47 UTC (rev 219)
+++ trunk/cfg/webservices.xml 2007-11-08 20:18:14 UTC (rev 220)
@@ -3,7 +3,7 @@
<webservice>
<name>status</name>
<module>eis_engine</module>
- <service>StatusService</service>
+ <service>ConfigService</service>
<protocol>xml-rpc</protocol>
<environment>dev</environment>
</webservice>
Modified: trunk/mod/eis_engine/applications/servermanager.xml
===================================================================
--- trunk/mod/eis_engine/applications/servermanager.xml 2007-10-13 12:06:47 UTC (rev 219)
+++ trunk/mod/eis_engine/applications/servermanager.xml 2007-11-08 20:18:14 UTC (rev 220)
@@ -162,6 +162,30 @@
<element>DisplayApplication</element>
<area>MAIN</area>
</element>
+ <page>
+ <name>edit</name>
+ <meta><name>menu-entry</name><value>eis_engine.t.edit.application</value></meta>
+ <element>
+ <module>eis_layout</module>
+ <element>String</element>
+ <area>TITLE</area>
+ <config><name>string</name><value>eis_engine.t.edit.application</value></config>
+ </element>
+ <element>
+ <module>eis_engine</module>
+ <element>EditApplication</element>
+ <area>MAIN</area>
+ </element>
+ </page>
+ <page>
+ <name>delete</name>
+ <meta><name>menu-entry</name><value>eis_engine.t.delete.application</value></meta>
+ <element>
+ <module>eis_engine</module>
+ <element>DeleteApplication</element>
+ <area>MAIN</area>
+ </element>
+ </page>
</catchall>
</page>
<page>
Modified: trunk/mod/eis_engine/elements/AddWebService.php
===================================================================
--- trunk/mod/eis_engine/elements/AddWebService.php 2007-10-13 12:06:47 UTC (rev 219)
+++ trunk/mod/eis_engine/elements/AddWebService.php 2007-11-08 20:18:14 UTC (rev 220)
@@ -9,7 +9,7 @@
$labels = array();
$inputs = array();
- $fields = array('module','service','mountpoint','environment','default');
+ $fields = array('module','service','mountpoint','environment','protocol');
$posted = $this->e->session->get('form','page');
$vals = $sWidget->fillValues($fields,null,$posted,$args);
@@ -25,6 +25,13 @@
$labels[] = 'eis_engine.l.mountpoint';
$inputs[] = $sWidget->inputString('mountpoint', $vals['mountpoint']);
+ $labels[] = 'eis_engine.l.protocol';
+ #TODO find better way to get values for options array
+ $options = array();
+ $options[] = array('value' => 'xml-rpc', 'label' => 'xml-rpc');
+ $options[] = array('value' => 'xml-struct', 'label' => 'xml-struct');
+ $inputs[] = $sWidget->inputString('protocol',$vals['protocol'],$options);
+
$labels[] = 'eis_engine.l.environment';
$options = $sWidget->makeOptions($sConfig->listEnvironments(),'eis_engine.l.select');
$inputs[] = $sWidget->inputString('environment',$vals['environment'],$options);
@@ -48,5 +55,27 @@
print $sWidget->jsEncodeOptions($options);
}
+
+ function action_ok($form) {
+ $sConfig =& $this->e->getService('eis_engine','ConfigService');
+
+ $obj['name'] = $form['mountpoint'];
+ $obj['module'] = $form['module'];
+ $obj['service'] = $form['service'];
+ $obj['protocol'] = $form['protocol'];
+ $obj['environment'] = $form['environment'];
+
+ $sConfig->createWebService($obj);
+
+ if($sConfig->success()) {
+ $this->e->showMessage('eis_engine.m.webservice.added',array($obj['webservice'],$obj['name']));
+ $this->e->redirect($this->e->hrefParentPage());
+ } else {
+ $this->setPost($form);
+ $this->e->showServiceError($sConfig->getError());
+ $this->e->redirect($this->e->hrefCurrentPage());
+ }
+ }
+
}
?>
Added: trunk/mod/eis_engine/elements/DeleteApplication.php
===================================================================
--- trunk/mod/eis_engine/elements/DeleteApplication.php (rev 0)
+++ trunk/mod/eis_engine/elements/DeleteApplication.php 2007-11-08 20:18:14 UTC (rev 220)
@@ -0,0 +1,42 @@
+<?php
+ class eis_engine_DeleteApplication extends Element {
+
+ function view_default($args) {
+
+ $sConfig =& $this->e->getService('eis_engine','ConfigService');
+ $sWidget =& $this->e->getService('eis_widget');
+
+ $path = $this->getPath();
+ $name = $path[count($path) -2];
+ $app = $sConfig->getApplication($name);
+
+ if($app == null) {
+ $this->e->error(404);
+ }
+
+ $form = $sWidget->displayString($this->e->getString('eis_engine.q.delete.application', array($name)));
+ $form .= $sWidget->buttonSetOkCancel();
+ print $sWidget->form($form,$this->e->hrefAction('ok'));
+
+
+ }
+
+ function action_ok(){
+ $sConfig =& $this->e->getService('eis_engine','ConfigService');
+
+ $path = $this->getPath();
+ $name = $path[count($path) -2];
+
+ $sConfig->deleteApplication($name);
+
+ if($sConfig->success()) {
+ $this->e->showMessage('eis_engine.m.application.deleted',array($name));
+ $this->e->redirect($this->e->hrefParentPage(2));
+ } else {
+ $this->setPost($data);
+ $this->e->showServiceError($sConfig->getError());
+ $this->e->redirect($this->e->hrefCurrentPage());
+ }
+ }
+ }
+?>
Modified: trunk/mod/eis_engine/elements/DeleteEnvironment.php
===================================================================
--- trunk/mod/eis_engine/elements/DeleteEnvironment.php 2007-10-13 12:06:47 UTC (rev 219)
+++ trunk/mod/eis_engine/elements/DeleteEnvironment.php 2007-11-08 20:18:14 UTC (rev 220)
@@ -9,7 +9,7 @@
$path = $this->getPath();
$name = $path[count($path) -2];
$env = $sConfig->getEnvironment($name);
-
+ print_r($path);
if($env == null) {
$this->e->error(404);
}
@@ -31,7 +31,7 @@
if($sConfig->success()) {
$this->e->showMessage('eis_engine.m.environment.deleted',array($name));
- $this->e->redirect($this->e->hrefPreviousPage(2));
+ $this->e->redirect($this->e->hrefParentPage(2));
} else {
$this->setPost($data);
$this->e->showServiceError($sConfig->getError());
Modified: trunk/mod/eis_engine/elements/DeleteWebService.php
===================================================================
--- trunk/mod/eis_engine/elements/DeleteWebService.php 2007-10-13 12:06:47 UTC (rev 219)
+++ trunk/mod/eis_engine/elements/DeleteWebService.php 2007-11-08 20:18:14 UTC (rev 220)
@@ -1,7 +1,42 @@
<?php
- class eis_engine_DeleteWebService extends Element {
- function view_default($id) {
- print 'DeleteWebService';
+ class eis_engine_DeleteWebservice extends Element {
+
+ function view_default($args) {
+
+ $sConfig =& $this->e->getService('eis_engine','ConfigService');
+ $sWidget =& $this->e->getService('eis_widget');
+
+ $path = $this->getPath();
+ $name = $path[count($path) -2];
+ $ws = $sConfig->getWebService($name);
+
+ if($ws == null) {
+ $this->e->error(404);
+ }
+
+ $form = $sWidget->displayString($this->e->getString('eis_engine.q.delete.webservice', array($name)));
+ $form .= $sWidget->buttonSetOkCancel();
+ print $sWidget->form($form,$this->e->hrefAction('ok'));
+
+
}
+
+ function action_ok(){
+ $sConfig =& $this->e->getService('eis_engine','ConfigService');
+
+ $path = $this->getPath();
+ $name = $path[count($path) -2];
+
+ $sConfig->deleteWebService($name);
+
+ if($sConfig->success()) {
+ $this->e->showMessage('eis_engine.m.webservice.deleted',array($name));
+ $this->e->redirect($this->e->hrefParentPage(2));
+ } else {
+ $this->setPost($data);
+ $this->e->showServiceError($sConfig->getError());
+ $this->e->redirect($this->e->hrefCurrentPage());
+ }
+ }
}
?>
Modified: trunk/mod/eis_engine/elements/DisplayApplication.php
===================================================================
--- trunk/mod/eis_engine/elements/DisplayApplication.php 2007-10-13 12:06:47 UTC (rev 219)
+++ trunk/mod/eis_engine/elements/DisplayApplication.php 2007-11-08 20:18:14 UTC (rev 220)
@@ -31,7 +31,7 @@
$labels[] = 'eis_engine.l.name';
$inputs[] = $sWidget->displayString($app['name']);
- $labels[] = 'eis_engine.l.url';
+ $labels[] = 'eis_engine.l.mountpoint';
$inputs[] = $sWidget->displayURL($this->e->getBaseUrl().$app['name']);
$labels[] = 'eis_engine.l.module';
Added: trunk/mod/eis_engine/elements/EditApplication.php
===================================================================
--- trunk/mod/eis_engine/elements/EditApplication.php (rev 0)
+++ trunk/mod/eis_engine/elements/EditApplication.php 2007-11-08 20:18:14 UTC (rev 220)
@@ -0,0 +1,89 @@
+<?php
+ class eis_engine_EditApplication extends Element {
+ function view_default($args) {
+ $sConfig =& $this->e->getService('eis_engine','ConfigService');
+ $sModule =& $this->e->getService('eis_engine','ModuleService');
+ $sWidget =& $this->e->getService('eis_widget','MainService');
+
+ $path = $this->getPath();
+ $name = $path[count($path) -2];
+
+ $defaults = $sConfig->getApplication($name);
+ if($defaults == null) {
+ $this->e->error(404);
+ }
+
+
+ $fields = array('module','application','mountpoint','environment','default');
+ $posted = $this->e->session->get('form','page');
+ $app = $sWidget->fillValues($fields,$defaults,$posted,$args);
+
+ $labels = array();
+ $inputs = array();
+
+ $labels[] = 'eis_engine.l.name';
+ $inputs[] = $sWidget->displayString($defaults['name']);
+
+ $labels[] = 'eis_engine.l.module';
+ $options = $sWidget->makeOptions($sModule->listModules(),'eis_engine.l.select');
+ $inputs[] = $sWidget->inputString('module',$app['module'],$options);
+
+ $labels[] = 'eis_engine.l.application';
+ $options = $sWidget->makeOptions($sModule->listApplications($app['module']),'eis_engine.l.select');
+ $inputs[] = $sWidget->inputString('application',$app['application'],$options);
+
+ $labels[] = 'eis_engine.l.environment';
+ $options = $sWidget->makeOptions($sModule->listEnvironments(),'eis_engine.l.select');
+ $inputs[] = $sWidget->inputString('environment',$app['environment'],$options);
+
+ $labels[] = 'eis_engine.l.default';
+ $inputs[] = $sWidget->inputBoolean('default', $app['default']);
+
+ $form = $sWidget->formTable($labels, $inputs);
+ $form .= $sWidget->buttonSetOkCancel();
+
+ $form .= $sWidget->jsUpdateSelect('module','application',$this->e->hrefView('applicationOptions'));
+
+ print $sWidget->form($form,$this->e->hrefAction('ok'));
+ }
+
+ function view_applicationOptions($args) {
+
+ $sModule =& $this->e->getService('eis_engine','ModuleService');
+ $sWidget =& $this->e->getService('eis_widget','MainService');
+
+ $module = isset($args['module']) ? $args['module'] : null;
+
+ $apps = $sModule->listApplications($module);
+ $options = $sWidget->makeOptions($apps,'eis_engine.l.select');
+
+ print $sWidget->jsEncodeOptions($options);
+ }
+
+ function action_ok($data){
+ $sConfig =& $this->e->getService('eis_engine','ConfigService');
+
+ $path = $this->getPath();
+ $name = $path[count($path) -2];
+
+ $application = array();
+ $application['name'] = $name;
+
+ foreach($data as $k => $v){
+ $application[$k] = $v;
+ }
+
+ $sConfig->updateApplication($application);
+
+ if($sConfig->success()) {
+ $this->e->showMessage('eis_engine.m.application.updated',array($name));
+ $this->e->redirect($this->e->hrefParentPage());
+ } else {
+ $this->setPost($data);
+ $this->e->showServiceError($sConfig->getError());
+ $this->e->redirect($this->e->hrefCurrentPage());
+ }
+
+ }
+ }
+?>
Modified: trunk/mod/eis_engine/elements/EditWebService.php
===================================================================
--- trunk/mod/eis_engine/elements/EditWebService.php 2007-10-13 12:06:47 UTC (rev 219)
+++ trunk/mod/eis_engine/elements/EditWebService.php 2007-11-08 20:18:14 UTC (rev 220)
@@ -1,59 +1,92 @@
<?php
class eis_engine_EditWebService extends Element {
- function view_default($id) {
+ function view_default($args) {
+
$sConfig =& $this->e->getService('eis_engine','ConfigService');
+ $sModule =& $this->e->getService('eis_engine','ModuleService');
$sWidget =& $this->e->getService('eis_widget','MainService');
-
+
$path = $this->getPath();
- $name = $path[count($path) -2];
+ $name = $path[count($path) -2];
- $ws = $sConfig->getWebService($name);
+ $defaults = $sConfig->getWebService($name);
+ if($defaults == null) {
+ $this->e->error(404);
+ }
+
+ $fields = array('module','service','mountpoint','environment','protocol');
+ $posted = $this->e->session->get('form','page');
+ $ws = $sWidget->fillValues($fields,$defaults,$posted,$args);
- if($ws == null) {
- $this->e->error(404);
- }
-
- $form = $this->e->session->get('form','page');
-
$labels = array();
$inputs = array();
-
+
$labels[] = 'eis_engine.l.name';
- $inputs[] = $sWidget->displayString($ws['name']);
-
+ $inputs[] = $sWidget->displayString($defaults['name']);
+
$labels[] = 'eis_engine.l.module';
- $inputs[] = $sWidget->displayString($ws['module']);
+ $options = $sWidget->makeOptions($sModule->listModules(),'eis_engine.l.select');
+ $inputs[] = $sWidget->inputString('module',$ws['module'],$options);
$labels[] = 'eis_engine.l.service';
- $inputs[] = $sWidget->displayString($ws['service']);
+ $options = $sWidget->makeOptions($sModule->listServices($ws['module']),'eis_engine.l.select');
+ $inputs[] = $sWidget->inputString('service',$ws['service'],$options);
+ $labels[] = 'eis_engine.l.protocol';
+ #TODO find better way to get values for options array
$options = array();
- $environments = $sConfig->listEnvironments();
- foreach($environments as $dep) {
- $options[] = array('label' => $dep, 'value' => $dep);
- }
+ $options[] = array('value' => 'xml-rpc', 'label' => 'xml-rpc');
+ $options[] = array('value' => 'xml-struct', 'label' => 'xml-struct');
+ $inputs[] = $sWidget->inputString('protocol',$ws['protocol'],$options);
$labels[] = 'eis_engine.l.environment';
- $inputs[] = $sWidget->inputString('module',$ws['environment'], $options);
+ $options = $sWidget->makeOptions($sConfig->listEnvironments(),'eis_engine.l.select');
+ $inputs[] = $sWidget->inputString('environment',$ws['environment'],$options);
- $options = array();
- $options[] = array('label' => 'xml-rpc','value' => 'xml-rpc');
- $options[] = array('label' => 'xml-struct','value' => 'xml-struct');
-
- $labels[] = 'eis_engine.l.protocol';
- $inputs[] = $sWidget->inputString('module',$ws['protocol'], $options);
-
$form = $sWidget->formTable($labels, $inputs);
$form .= $sWidget->buttonSetOkCancel();
+ $form .= $sWidget->jsUpdateSelect('module','service',$this->e->hrefView('serviceOptions'));
+
print $sWidget->form($form,$this->e->hrefAction('ok'));
- //print $sWidget->form($form,'#');
}
+
+ function view_serviceOptions($args) {
+ $sModule =& $this->e->getService('eis_engine','ModuleService');
+ $sWidget =& $this->e->getService('eis_widget','MainService');
+
+ $module = isset($args['module']) ? $args['module'] : null;
+
+ $services = $sModule->listServices($module);
+ $options = $sWidget->makeOptions($services,'eis_engine.l.select');
+
+ print $sWidget->jsEncodeOptions($options);
+ }
+
function action_ok($form) {
- $this->e->session->set('form',$form,'page');
- $this->e->session->save();
+ $sConfig =& $this->e->getService('eis_engine','ConfigService');
- $this->e->redirect($this->e->hrefPreviousPage());
+ $path = $this->getPath();
+ $name = $path[count($path) -2];
+
+ $webservice = array();
+ $webservice['name'] = $name;
+
+ foreach($form as $k => $v){
+ $webservice[$k] = $v;
+ }
+
+ $sConfig->updateWebService($webservice);
+
+ if($sConfig->success()) {
+ $this->e->showMessage('eis_engine.m.webservice.updated',array($name));
+ $this->e->redirect($this->e->hrefParentPage());
+ } else {
+ $this->setPost($form);
+ $this->e->showServiceError($sConfig->getError());
+ $this->e->redirect($this->e->hrefCurrentPage());
+ }
}
+
}
?>
Modified: trunk/mod/eis_engine/locales/en_en/strings.xml
===================================================================
--- trunk/mod/eis_engine/locales/en_en/strings.xml 2007-10-13 12:06:47 UTC (rev 219)
+++ trunk/mod/eis_engine/locales/en_en/strings.xml 2007-11-08 20:18:14 UTC (rev 220)
@@ -94,6 +94,10 @@
<value><![CDATA[Add environment]]></value>
</string>
<string>
+ <name>t.edit.application</name>
+ <value><![CDATA[Edit application]]></value>
+ </string>
+ <string>
<name>t.edit.webservice</name>
<value><![CDATA[Edit web service]]></value>
</string>
@@ -102,6 +106,10 @@
<value><![CDATA[Edit environment]]></value>
</string>
<string>
+ <name>t.delete.application</name>
+ <value><![CDATA[Delete application]]></value>
+ </string>
+ <string>
<name>t.delete.webservice</name>
<value><![CDATA[Delete web service]]></value>
</string>
@@ -117,7 +125,6 @@
<name>l.title</name>
<value><![CDATA[Title]]></value>
</string>
-
<string>
<name>l.description</name>
<value><![CDATA[Description]]></value>
@@ -155,11 +162,6 @@
<value><![CDATA[Protocol]]></value>
</string>
<string>
- <name>l.title</name>
- <value><![CDATA[Title]]></value>
- </string>
-
- <string>
<name>l.admin</name>
<value><![CDATA[Administrator]]></value>
</string>
@@ -256,10 +258,17 @@
<value><![CDATA[Delete environment]]></value>
</string>
<string>
+ <name>q.delete.application</name>
+ <value><![CDATA[Do you really want to delete application '%s'?]]></value>
+ </string>
+ <string>
+ <name>q.delete.webservice</name>
+ <value><![CDATA[Do you really want to delete webservice '%s'?]]></value>
+ </string>
+ <string>
<name>q.delete.environment</name>
<value><![CDATA[Do you really want to delete environment '%s'?]]></value>
</string>
-
<string>
<name>e.illegalformat.name</name>
<value><![CDATA[A name can contain only letters, digits, dashes and underscores.]]></value>
@@ -281,6 +290,14 @@
<value><![CDATA[Please select an application]]></value>
</string>
<string>
+ <name>e.missing.service</name>
+ <value><![CDATA[Please select a service]]></value>
+ </string>
+ <string>
+ <name>e.missing.protocol</name>
+ <value><![CDATA[Please select a protocol]]></value>
+ </string>
+ <string>
<name>e.missing.mountpoint</name>
<value><![CDATA[Please enter a mountpoint]]></value>
</string>
@@ -305,6 +322,35 @@
<value><![CDATA[Successfully added application '%s' at '%s'.]]></value>
</string>
<string>
+ <name>m.application.updated</name>
+ <value><![CDATA[Successfully updated application '%s'.]]></value>
+ </string>
+ <string>
+ <name>m.application.deleted</name>
+ <value><![CDATA[Successfully deleted application '%s'.]]></value>
+ </string>
+ <string>
+ <name>m.webservice.added</name>
+ <value><![CDATA[Successfully added webservice '%s' at '%s'.]]></value>
+ </string>
+ <string>
+ <name>m.webservice.updated</name>
+ <value><![CDATA[Successfully updated webservice '%s'.]]></value>
+ </string>
+ <string>
+ <name>m.webservice.deleted</name>
+ <value><![CDATA[Successfully deleted webservice '%s'.]]></value>
+ </string>
+
+ <string>
+ <name>e.webservice.duplicate.mountpoint</name>
+ <value><![CDATA[Another webservice is already running at '%s'.]]></value>
+ </string>
+ <string>
+ <name>e.webservice.nonexistent.mountpoint</name>
+ <value><![CDATA[There is no webservice at '%s'.]]></value>
+ </string>
+ <string>
<name>e.environment.duplicate.name</name>
<value><![CDATA[Another environment is already known as '%s'.]]></value>
</string>
Modified: trunk/mod/eis_engine/services/ConfigService.php
===================================================================
--- trunk/mod/eis_engine/services/ConfigService.php 2007-10-13 12:06:47 UTC (rev 219)
+++ trunk/mod/eis_engine/services/ConfigService.php 2007-11-08 20:18:14 UTC (rev 220)
@@ -76,9 +76,28 @@
}
function updateApplication($obj) {
+ if(!$this->verifyApplication($obj)) {
+ return 0;
+ }
+ $applications = $this->_loadApplications();
+ foreach($applications as $k => $application) {
+ if($application['name'] == $obj['name']) {
+ $applications[$k] = $obj;
+ }
+ }
+
+ $this->_saveApplications($applications);
+
}
function deleteApplication($id) {
+ $applications = $this->_loadApplications();
+ foreach($applications as $k => $application) {
+ if($application['name'] == $id) {
+ unset($applications[$k]);
+ }
+ }
+ $this->_saveApplications($applications);
}
function getDefaultApplication() {
@@ -89,16 +108,25 @@
return $str->getValue($doc,'default');
}
- function getWebServices() {
+ function _loadWebServices() {
$str = new XmlStruct();
$doc = $str->decodeFile('cfg/webservices.xml');
$doc = $str->getValue($doc,'webservices');
return $str->getArray($doc,'webservice');
}
+ function _saveWebServices($webservices) {
+ $doc = array('webservices' => array('webservice' => $webservices));
+ $str = new XmlStruct();
+ $str->encodeFile($doc, 'cfg/webservices.xml');
+ }
+ function getWebServices() {
+ return $this->_loadWebServices();
+ }
+
function getWebService($id) {
- $services = $this->getWebServices();
+ $services = $this->_loadWebServices();
foreach($services as $service) {
if($service['name'] == $id) {
return $service;
@@ -108,12 +136,85 @@
}
function createWebService($obj) {
+ if(!$this->verifyWebService($obj,true)) {
+ return 0;
+ }
+
+ $webservices = $this->_loadWebServices();
+ $webservices[] = $obj;
+ $this->_saveWebServices($webservices);
}
+
function updateWebService($obj) {
+ if(!$this->verifyWebService($obj)) {
+ return 0;
+ }
+
+ $webservices = $this->_loadWebServices();
+ foreach($webservices as $k => $webservice) {
+ if($webservice['name'] == $obj['name']) {
+ $webservices[$k] = $obj;
+ }
+ }
+
+ $this->_saveWebServices($webservices);
+
}
+
function deleteWebService($id) {
+ $webservices = $this->_loadWebServices();
+ foreach($webservices as $k => $webservice) {
+ if($webservice['name'] == $id) {
+ unset($webservices[$k]);
+ }
+ }
+ $this->_saveWebServices($webservices);
}
+ function verifyWebService($obj, $new = false) {
+ if(!isset($obj['module']) || $obj['module'] == '') {
+ $this->setError(0,'eis_engine.e.missing.module');
+ return false;
+ }
+ if(!isset($obj['service']) || $obj['service'] == '') {
+ $this->setError(0,'eis_engine.e.missing.service');
+ return false;
+ }
+ if(!isset($obj['protocol']) || $obj['protocol'] == '') {
+ $this->setError(0,'eis_engine.e.missing.protocol');
+ return false;
+ }
+
+ if(!isset($obj['name']) || $obj['name'] == '') {
+ $this->setError(0,'eis_engine.e.missing.mountpoint');
+ return false;
+ } else {
+ //Check format of mountpoint
+ if(!ereg("^[a-zA-Z0-9_\-]+$",$obj['name'])) {
+ $this->setError(0,'eis_engine.e.illegalformat.mountpoint');
+ return false;
+ } else {
+ //Check if the application is already
+ if($this->getWebService($obj['name']) != null) {
+ if($new) {
+ $this->setError(0,'eis_engine.e.webservice.duplicate.mountpoint',array($obj['name']));
+ return false;
+ }
+ } else {
+ if(!$new) {
+ $this->setError(0,'eis_engine.e.webservice.nonexistent.mountpoint',array($obj['name']));
+ return false;
+ }
+ }
+ }
+ }
+ if(!isset($obj['environment']) || $obj['environment'] == '') {
+ $this->setError(0,'eis_engine.e.missing.environment');
+ return false;
+ }
+ return true;
+ }
+
function _loadEnvironments() {
$str = new XmlStruct();
$doc = $str->decodeFile('cfg/environments.xml');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|