summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 15c264d)
raw | patch | inline | side by side (parent: 15c264d)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 3 Jun 2008 13:22:42 +0000 (13:22 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 3 Jun 2008 13:22:42 +0000 (13:22 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11176 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/apache2/admin/systems/services/apache2/class_apacheUtils.inc b/gosa-plugins/apache2/admin/systems/services/apache2/class_apacheUtils.inc
index a9538f3517c9df64a470f0a90eef3ce62bfeecfc..5439cac35a04a0af1817a52c04fe01849a810029 100644 (file)
/* This function returns the vhost entries specified for given host
*/
- function getVhostEntries($config,$HostDn,$silent = false)
+ public static function getVhostEntries($config,$HostDn,$silent = false)
{
$ldap = $config->get_ldap_link();
* - rename, if a dn must be renamed, for example, the apacheServerName has changed
* - add, if there is a new vhost entries created
*/
- function getVhostEntriesDiff($config,$newVhosts,$HostDn)
+ public static function getVhostEntriesDiff($config,$newVhosts,$HostDn)
{
$oldVhosts = apacheUtils::getVhostEntries($config,$HostDn,true);
/* Simple is domain check, it checks if the given string looks like "string.string.string"
or string.string */
- function GetVhostsDomain($str)
+ public static function GetVhostsDomain($str)
{
return(preg_match("/[^\.\/]+\.[^\.\/]+$/",$str));
}
diff --git a/gosa-plugins/apache2/admin/systems/services/apache2/class_servApacheEditVhost.inc b/gosa-plugins/apache2/admin/systems/services/apache2/class_servApacheEditVhost.inc
index 64045327a618cb79e2e428517ac54fa280435c81..60d64b9c58b43bd2a14271ffeccab317000c472e 100644 (file)
if(isset($_POST['SaveVhostEntryChanges'])){
$this->dialog->save_object();
if(count($this->dialog->check())){
- $msgs = $this->dialog->check();
- foreach($msgs as $msg){
- print_red($msg);
- }
+ msg_dialog::displayChecks($this->dialog->check());
}else{
$this->dialog->save();
$this->dialog = false;
/* Set apacheServerNames without server suffix */
$smarty->assign("apacheServerName",$this->apacheServerName);
- $div = new DivSelectBox("apacheServerAlias");
+ $div = new divSelectBox("apacheServerAlias");
$div->setHeight(120);
$recs = $this->apacheServerAlias;
$smarty->assign("apacheScriptAlias", $div->DrawList());
/* Display template */
- $display.= $smarty->fetch(get_template_path('servApacheVhostEdit.tpl', TRUE));
+ $display.= $smarty->fetch(get_template_path('servApacheVhostEdit.tpl', TRUE, dirname(__FILE__)));
return($display);
}
$message[] =sprintf(_("Please choose a valid Virtual Host Name."));
}
- if(!is_path($this->apacheDocumentRoot) || empty($this->apacheDocumentRoot)){
+ if(!tests::is_path($this->apacheDocumentRoot) || empty($this->apacheDocumentRoot)){
$message[] = _("Please choose a valid Path as Virtual Host Document Root.");
}
- if(!is_email($this->apacheServerAdmin) || empty($this->apacheServerAdmin)){
+ if(!tests::is_email($this->apacheServerAdmin) || empty($this->apacheServerAdmin)){
$message[] = _("Please choose a valid Email Account as Admin Mail address.");
}
diff --git a/gosa-plugins/apache2/admin/systems/services/apache2/class_servApacheVhost.inc b/gosa-plugins/apache2/admin/systems/services/apache2/class_servApacheVhost.inc
index 868c7a8134162204922e1efe558d27b6e61e6e96..3cb51cd74385f7f415ff25205296434eaf00e0e2 100644 (file)
var $objectclasses = array("whatever");
var $RecordTypes = array();
- var $Vhosts = array();
+ var $Vhosts = array();
var $dialog = NULL;
-
var $orig_dn = "";
var $APACHEinitially_was_account;
$this->is_account = true;
}
$this->APACHEinitially_was_account = $this->is_account;
+
+ /* Set service name */
+ $this->DisplayName = _("Apache service");
}
$smarty= get_smarty();
$display= "";
- /* Do we need to flip is_account state?
- */
- if (isset($_POST['modify_state'])){
-
- /* Only change account state if allowed */
- if($this->is_account && $this->acl == "#all#"){
- $this->is_account= !$this->is_account;
- $this->is_modified = true;
- }elseif(!$this->is_account && chkacl($this->acl,"create") == ""){
- $this->is_account= !$this->is_account;
- $this->is_modified = true;
- }
- }
-
- if ($this->is_account){
- $display= $this->show_header(_("Remove Apache service"),
- _("This server has Apache features enabled. You can disable them by clicking below."));
- } else {
- $display= $this->show_header(_("Add Apache service"),
- _("This server has Apache features disabled. You can enable them by clicking below."));
- return ($display);
- }
-
/* Edited or Added vhost
*/
if((isset($_POST['SaveVhostChanges'])) && is_object($this->dialog)){
/* Check for errors
*/
if(count($this->dialog->check())){
- foreach($this->dialog->check() as $msgs){
- print_red($msgs);
- }
+ msg_dialog::displayChecks($this->dialog->check());
}else{
/* add new/edited vhost
*/
/* Add empty new vhost
*/
- if(isset($_POST['AddVhost']) && chkacl($this->acl,"servapache") == ""){
+ if(isset($_POST['AddVhost']) && $this->acl_is_writeable("VirtualHosts")){
$this->dialog = new servapacheVhostEdit($this->config,$this->dn);
}
//user_error(print_r($this->Vhosts,true));
/* check all post for edit request
*/
- if(preg_match("/^editVhost_/",$name)&&!$once && chkacl($this->acl,"servapache") == ""){
+ if(preg_match("/^editVhost_/",$name)&& !$once && $this->acl_is_writeable("VirtualHosts")){
$once =true;
$tmp = preg_replace("/^editVhost_/","",$name);
$tmp = base64_decode(preg_replace("/_.*$/","",$tmp));
/* check posts for delete vhost
*/
- if(preg_match("/^delVhost_/",$name)&&!$once && chkacl($this->acl,"servapache") == ""){
+ if(preg_match("/^delVhost_/",$name)&&!$once && $this->acl_is_writeable("VirtualHosts")){
$once =true;
$tmp = preg_replace("/^delVhost_/","",$name);
array("string" => str_replace("%s",base64_encode($vhost),$editImg))
));
}
-
- $smarty->assign("servapacheACL",chkacl($this->acl,"servapache"));
+
+
+ /* Assign ACL to smarty
+ */
+ $info = $this->plInfo();
+ foreach($info['plProvidedAcls'] as $name => $desc){
+ $smarty->assign($name."ACL",$this->getacl($name));
+ }
+
/* Display template
*/
$smarty->assign("VhostList",$VhostList->DrawList());
- $display.= $smarty->fetch(get_template_path('servApacheVhost.tpl', TRUE));
+ $display.= $smarty->fetch(get_template_path('servApacheVhost.tpl', TRUE , dirname(__FILE__)));
return($display);
}
}
$tmp = apacheUtils::getVhostEntriesDiff($this->config,$this->Vhosts,$old_dn);
+ print_a($tmp);
/* Updated vhost entries if reverser or forward name has changed
* Must be done before moving entries, else the given dn is invalid
foreach($tmp['vhostUpdates'] as $dn => $attrs){
$ldap->cd($dn);
$ldap->modify($attrs);
- show_ldap_error("Vhost:".$ldap->get_error(), _("Updating Apache service failed"));
+
+ if (!$ldap->success()){
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
+ }
}
}
foreach($tmp['del'] as $dn => $del){
$ldap->cd($dn);
$ldap->rmdir_recursive($dn);
- show_ldap_error($ldap->get_error(), _("Removing Apache entries failed"));
+ if (!$ldap->success()){
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
+ }
}
/* move follwoing entries
$ldap->cd($dn);
$ldap->add($attrs);
}
- show_ldap_error($ldap->get_error(), _("Saving apache entries failed"));
+ if (!$ldap->success()){
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_ADD, get_class()));
+ }
}
}
+
+
+ /*! \brief Returns the required information about this plugin for the
+ service list
+ @return Array With information for the service plugin.
+ */
+ function getListEntry()
+ {
+ $fields = goService::getListEntry();
+ $fields['Message'] = _("Apache service");
+ $fields['AllowEdit'] = false;
+ return($fields);
+ }
+
+
+ /* \brief Return plugin information used by the ACL handling.
+ @return Array ACL infos.
+ */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Apache service"),
+ "plDescription" => _("Apache virtual host service")." ("._("Services").")",
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 88,
+ "plSection" => array("administration"),
+ "plCategory" => array("server"),
+
+ "plProvidedAcls"=> array(
+ "VirtualHost" => _("Virtual hosts"))
+ ));
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
diff --git a/gosa-plugins/apache2/admin/systems/services/apache2/servApacheVhost.tpl b/gosa-plugins/apache2/admin/systems/services/apache2/servApacheVhost.tpl
index a1449753b2b3f736bd88b340c33dfaf531e2e284..30385f9bf0b9106435080a1f5e5757e9eb993e21 100644 (file)
<tr>
<td style="width:100%;vertical-align:top;">
{$VhostList}
- <input type="submit" name="AddVhost" value="{t}Add{/t}" {$servapacheACL}>
+
+ {render acl=$VirtualHostACL}
+ <input type="submit" name="AddVhost" value="{t}Add{/t}">
+ {/render}
</td>
</tr>
</table>
document.mainform.AddVhost.focus();
-->
</script>
+<input type="hidden" name="servapache" value="1">
+
+<p class="seperator"> </p>
+<br>
+<div style="width:100%; text-align:right;">
+ <input type='submit' name='SaveService' value='{msgPool type=saveButton}'>
+
+ <input type='submit' name='CancelService' value='{msgPool type=cancelButton}'>
+</div>
+