From 280c0a7698f66faa55901caa5c60bdebd2cb5453 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 12 Feb 2007 09:16:39 +0000 Subject: [PATCH] Added some more setup steps git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5717 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/setup.php | 2 + html/themes/default/style.css | 10 +- setup/class_setup.inc | 10 +- setup/class_setupStep.inc | 6 +- setup/class_setupStep4.inc | 59 ++------- setup/class_setupStep5.inc | 156 ++++++++++++++++++++++- setup/class_setupStep6.inc | 130 +++++++++++++++++++ setup/class_setupStep7.inc | 56 +++++++++ setup/setup_step4.tpl | 130 ++++--------------- setup/setup_step5.tpl | 220 ++++++++++++++++++++++++++++++++ setup/setup_step6.tpl | 230 ++++++++++++++++++++++++++++++++++ setup/setup_step7.tpl | 23 ++++ 12 files changed, 872 insertions(+), 160 deletions(-) create mode 100644 setup/class_setupStep6.inc create mode 100644 setup/class_setupStep7.inc create mode 100644 setup/setup_step5.tpl create mode 100644 setup/setup_step6.tpl create mode 100644 setup/setup_step7.tpl diff --git a/html/setup.php b/html/setup.php index 37494eba1..1f3796712 100644 --- a/html/setup.php +++ b/html/setup.php @@ -32,6 +32,8 @@ require_once("../setup/class_setupStep2.inc"); require_once("../setup/class_setupStep3.inc"); require_once("../setup/class_setupStep4.inc"); require_once("../setup/class_setupStep5.inc"); +require_once("../setup/class_setupStep6.inc"); +require_once("../setup/class_setupStep7.inc"); /* Set header */ diff --git a/html/themes/default/style.css b/html/themes/default/style.css index 9b2952e10..daafeaf68 100644 --- a/html/themes/default/style.css +++ b/html/themes/default/style.css @@ -1033,7 +1033,7 @@ li.step4_name, div.step4_name { vertical-align: middle; float:left; overflow: hidden; - width:160px; + width:200px; height:2.0em; } @@ -1051,13 +1051,17 @@ li.step4_status, div.step4_status { overflow: hidden; height:2.0em; text-decoration: none; - background-color: #BBBBBB; + background-color: #DDDDDD; } ul.step4_container, div.step4_container { - border: solid 1px #CCC; + background-color: #E7E7E7; + border: solid 2px #D7D7D7; width:680px; height:2.0em; + margin-top:2px; + margin-left:2px; + margin-right:2px; float:left; } diff --git a/setup/class_setup.inc b/setup/class_setup.inc index 83812649c..8bd1e7bf1 100644 --- a/setup/class_setup.inc +++ b/setup/class_setup.inc @@ -23,7 +23,7 @@ require_once("class_setupStep.inc"); class setup extends plugin { - var $i_steps = 5; // Number of setup steps + var $i_steps = 7; // Number of setup steps var $i_current= 1; // Current step var $i_last = 1; // Last setup step; var $o_steps = array(); @@ -34,7 +34,13 @@ class setup extends plugin { for($i = 1 ; $i <= $this->i_steps; $i ++ ){ $class= "setup_step_".$i; - $this->o_steps[$i] = new $class(); + + if(class_exists($class)){ + $this->o_steps[$i] = new $class(); + }else{ + $this->o_steps[$i] = new setup_step(); + trigger_error("Try to create class '".$class."' but it is not available, possibly you have forgotten to add the include in setup.php"); + } } } diff --git a/setup/class_setupStep.inc b/setup/class_setupStep.inc index a873094e3..f69abdfa5 100644 --- a/setup/class_setupStep.inc +++ b/setup/class_setupStep.inc @@ -20,7 +20,7 @@ */ -class setup_step extends plugin +class setup_step { var $s_title = "Still undefined"; var $s_title_long = "This is a still undefined long title"; @@ -31,6 +31,10 @@ class setup_step extends plugin var $attributes = array(); + function setup_step() + { + } + function save_object() { /* Do not call plugin::save_object. This causes acl trouble */ diff --git a/setup/class_setupStep4.inc b/setup/class_setupStep4.inc index c1470837a..45603e528 100644 --- a/setup/class_setupStep4.inc +++ b/setup/class_setupStep4.inc @@ -27,35 +27,21 @@ class setup_step_4 extends setup_step var $admin = ""; var $password = ""; var $base = ""; - var $peopleou = "ou=people,"; - var $peopledn = "cn"; - var $groupou = "ou=groups,"; - var $uidbase = 1000; - var $encryption = "crypt"; - var $mail = "kolab"; - var $errors = TRUE; - - var $crypt_methods = array(); - var $mail_methods = array(); var $connect_id = FALSE; var $bind_id = FALSE; var $resolve_filter = "*"; var $resolve_user = FALSE; + var $tls = FALSE; - var $attributes = array("connection","location","admin","password","base","peopleou","peopledn","groupou", - "uidbase","encryption","mail","errors"); + var $attributes = array("connection","location","admin","password","base","tls"); function setup_step_4() { $this->s_title = _("Ldap settings"); $this->s_title_long = _("Ldap connection setup"); $this->s_info = _("This dialog allows the basic configuration of GOsa's behaviour and properties in your main configuration."); - $tmp = @passwordMethod::get_available_methods_if_not_loaded(); - $this->crypt_methods = $tmp['name']; - $tmp = $this->get_available_mail_classes(); - $this->mail_methods = $tmp['name']; } function execute() @@ -65,18 +51,15 @@ class setup_step_4 extends setup_step $smarty->assign($attr,$this->$attr); } - $smarty->assign("peopledns",array("uid","cn")); - $smarty->assign("crypt_methods",$this->crypt_methods); - $smarty->assign("mail_methods",$this->mail_methods); + /* Assign connection status */ + $smarty->assign("connection_status",$this->get_connection_status()); - + /* Handle namingContext detection */ $attr = @LDAP::get_naming_contexts($this->connection); unset($attr['count']); $smarty->assign("namingContexts",$attr); $smarty->assign("namingContextsCount",count($attr)); - - /* Assign connection status */ - $smarty->assign("connection_status",$this->get_connection_status()); + $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes"))); /* Addign resolved users */ $smarty->assign("resolve_user",$this->resolve_user); @@ -89,30 +72,6 @@ class setup_step_4 extends setup_step return($smarty -> fetch (get_template_path("../setup/setup_step4.tpl"))); } - /* Returns the classnames auf the mail classes */ - function get_available_mail_classes() - { - $dir = opendir( "../include"); - $methods = array(); - $suffix = "class_mail-methods-"; - $lensuf = strlen($suffix); - $prefix = ".inc"; - $lenpre = strlen($prefix); - $i = 0; - while (($file = readdir($dir)) !== false){ - - if(stristr($file,$suffix)) { - $lenfile = strlen($file); - $methods['name'][$i] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre); - $methods['file'][$i] = $file; - $methods[$i]['file'] = $file; - $methods[$i]['name'] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre); - $i++; - } - } - return($methods); - } - function get_connection_status() { $this->connect_id = FALSE; @@ -180,6 +139,12 @@ class setup_step_4 extends setup_step $this->resolve_user = false; } } + + if($this->bind_id){ + $this->is_completed =TRUE; + }else{ + $this->is_completed =FALSE; + } } } diff --git a/setup/class_setupStep5.inc b/setup/class_setupStep5.inc index b801d421d..b31c9d33b 100644 --- a/setup/class_setupStep5.inc +++ b/setup/class_setupStep5.inc @@ -23,17 +23,169 @@ class setup_step_5 extends setup_step { + var $peopleou = "ou=people"; + var $groupou = "ou=groups"; + var $peopledn = "cn"; + var $uidbase = 1000; + var $encryption = "crypt"; + var $mail = "none"; + var $theme = "default"; + var $errorlvl = TRUE; + var $cyrusunixstyle = FALSE; + + var $pwd_rules = array("pwminlen" => 6, + "pwminlen_active" => FALSE, + "pwdiffer" => 5, + "pwdiffer_active" => FALSE, + "externalpwdhook" => "/usr/bin/sudo myscript", + "externalpwdhook_active" => FALSE); + + var $mail_settings = array("vacationdir" => "/etc/gosa/vacation", + "vacationdir_active" => FALSE); + + var $crypt_methods = array(); + var $mail_methods = array(); + + + var $attributes = array("peopleou","groupou","peopledn","uidbase","encryption","mail","theme","errorlvl","cyrusunixstyle"); + function setup_step_5() { + $this->s_title = _("GOsa settings 1/2"); + $this->s_title_long = _("GOsa generic settings, page 1/2"); + $this->s_info = _("This dialog allows you to setup GOsa behaviour"); + $tmp = @passwordMethod::get_available_methods_if_not_loaded(); + foreach($tmp['name'] as $name){ + $this->crypt_methods[$name] = $name; + } + $tmp = $this->get_available_mail_classes(); + foreach($tmp['name'] as $name){ + $this->mail_methods[$name] = $name; + } } + function execute() { - return("plug1"); + $smarty = get_smarty(); + $smarty->assign("peopledns",array("uid","cn")); + $smarty->assign("crypt_methods",$this->crypt_methods); + $smarty->assign("mail_methods",$this->mail_methods); + $smarty->assign("themes",$this->get_themes()); + $smarty->assign("pwd_rules",$this->pwd_rules); + $smarty->assign("mail_settings",$this->mail_settings); + $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes"))); + $smarty->assign("warnings" ,$this->check()); + $smarty->assign("warnings_cnt" ,count($this->check())); + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + return($smarty -> fetch (get_template_path("../setup/setup_step5.tpl"))); + } + + + /* Returns the classnames auf the mail classes */ + function get_available_mail_classes() + { + $dir = opendir( "../include"); + $methods = array(); + $suffix = "class_mail-methods-"; + $lensuf = strlen($suffix); + $prefix = ".inc"; + $lenpre = strlen($prefix); + $i = 0; + while (($file = readdir($dir)) !== false){ + + if(stristr($file,$suffix)) { + $lenfile = strlen($file); + $methods['name'][$i] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre); + $methods['file'][$i] = $file; + $methods[$i]['file'] = $file; + $methods[$i]['name'] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre); + $i++; + } + } + return($methods); + } + + function get_themes() + { + $dir = opendir( "../ihtml/themes/"); + $themes = array(); + while (($file = readdir($dir)) !== false){ + if(is_dir("../ihtml/themes/".$file) && !preg_match("/^\./",$file)){ + $themes[$file] = $file; + } + } + return($themes); + } + + function check() + { + $message = array(); + if(!is_numeric($this->uidbase)){ + $message[] = _("Uid base must be numeric"); + } + + if(($this->pwd_rules['pwminlen_active']) && !is_numeric($this->pwd_rules['pwminlen'])){ + $message[] = _("The given password minimum length is not numeric."); + } + if(($this->pwd_rules['pwdiffer_active']) && !is_numeric($this->pwd_rules['pwdiffer'])){ + $message[] = _("The given password differ value is not numeric."); + } + return($message); + } -} + function save_object() + { + if(isset($_POST['step5_posted'])){ + + /* Get attributes */ + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = validate($_POST[$attr]); + } + } + + /* Get password settings */ + if(isset($_POST['pwdiffer_active'])){ + $this->pwd_rules['pwdiffer_active'] = TRUE; + if(isset($_POST['pwdiffer'])){ + $this->pwd_rules['pwdiffer'] = $_POST['pwdiffer']; + } + }else{ + $this->pwd_rules['pwdiffer_active'] = FALSE; + } + if(isset($_POST['pwminlen_active'])){ + $this->pwd_rules['pwminlen_active'] = TRUE; + if(isset($_POST['pwminlen'])){ + $this->pwd_rules['pwminlen'] = $_POST['pwminlen']; + } + }else{ + $this->pwd_rules['pwminlen_active'] = FALSE; + } + + /* Mail settings */ + if(isset($_POST['vacationdir_active'])){ + $this->mail_settings['vacationdir_active'] = TRUE; + if(isset($_POST['vacationdir'])){ + $this->mail_settings['vacationdir'] = $_POST['vacationdir']; + } + }else{ + $this->mail_settings['vacationdir_active'] = FALSE; + } + } + + $tmp = $this->check(); + if(count($tmp) == 0){ + $this->is_completed = TRUE; + }else{ + $this->is_completed = FALSE; + } + }// if tempalte posted +}// CLass // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/setup/class_setupStep6.inc b/setup/class_setupStep6.inc new file mode 100644 index 000000000..bd8db9ff1 --- /dev/null +++ b/setup/class_setupStep6.inc @@ -0,0 +1,130 @@ + "{%sn}-{%givenName[2-4]}", + "idgen_active" => FALSE, + "minid" => "100", + "minid_active" => FALSE, + "wws_ou" => "ou=winstations", + "wws_ou_active" => FALSE, + "snapshot_active"=> FALSE, + "snapshot_base" => "ou=snapshots,dc=server,dc=de", + "snapshot_user" => "cn=ldapadmin,dc=server,dc=de", + "snapshot_password" => "", + "snapshot_server" => "ldap://localhost:386"); + + var $samba_settings = array( "samba_sid" => "0-815-4711", + "samba_sid_active" => FALSE, + "samba_rid" => 1000, + "samba_rid_active" => FALSE); + var $attributes = array("strict","governmentmode","sambaidmapping","minid","account_expiration"); + + function setup_step_6() + { + $this->s_title = _("GOsa settings 2/2"); + $this->s_title_long = _("GOsa generic settings, page 2/2"); + $this->s_info = _("This dialog allows you to setup GOsa behaviour"); + } + + + function execute() + { + $smarty = get_smarty(); + $smarty->assign("generic_settings",$this->generic_settings); + $smarty->assign("samba_settings",$this->samba_settings); + $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes"))); + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + return($smarty -> fetch (get_template_path("../setup/setup_step6.tpl"))); + } + + function save_object() + { + if(isset($_POST['step6_posted'])){ + + /* Get attributes */ + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = validate($_POST[$attr]); + } + } + + /* Generic settings */ + if(isset($_POST['idgen_active'])){ + $this->generic_settings['idgen_active'] = TRUE; + if(isset($_POST['idgen'])){ + $this->generic_settings['idgen'] = $_POST['idgen']; + } + }else{ + $this->generic_settings['idgen_active'] = FALSE; + } + if(isset($_POST['snapshot_active'])){ + $this->generic_settings['snapshot_active'] = TRUE; + if(isset($_POST['snapshot_base'])){ + $this->generic_settings['snapshot_base'] = $_POST['snapshot_base']; + } + if(isset($_POST['snapshot_user'])){ + $this->generic_settings['snapshot_user'] = $_POST['snapshot_user']; + } + if(isset($_POST['snapshot_password'])){ + $this->generic_settings['snapshot_password'] = $_POST['snapshot_password']; + } + if(isset($_POST['snapshot_server'])){ + $this->generic_settings['snapshot_server'] = $_POST['snapshot_server']; + } + }else{ + $this->generic_settings['snapshot_active'] = FALSE; + } + + /* Samba settings */ + if(isset($_POST['samba_sid_active'])){ + $this->samba_settings['samba_sid_active'] = TRUE; + if(isset($_POST['samba_sid'])){ + $this->samba_settings['samba_sid'] = $_POST['samba_sid']; + } + }else{ + $this->samba_settings['samba_sid_active'] = FALSE; + } + if(isset($_POST['samba_rid_active'])){ + $this->samba_settings['samba_rid_active'] = TRUE; + if(isset($_POST['samba_rid'])){ + $this->samba_settings['samba_rid'] = $_POST['samba_rid']; + } + }else{ + $this->samba_settings['samba_rid_active'] = FALSE; + } + + } + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep7.inc b/setup/class_setupStep7.inc new file mode 100644 index 000000000..e5dd8e5a7 --- /dev/null +++ b/setup/class_setupStep7.inc @@ -0,0 +1,56 @@ +s_title = _("GOsa settings 1/2"); + $this->s_title_long = _("GOsa generic settings, page 1/2"); + $this->s_info = _("This dialog allows you to setup GOsa behaviour"); + } + + + function execute() + { + $smarty = get_smarty(); + return($smarty -> fetch (get_template_path("../setup/setup_step7.tpl"))); + } + + function save_object() + { + if(isset($_POST['step7_posted'])){ + + /* Get attributes */ + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = validate($_POST[$attr]); + } + } + } + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/setup_step4.tpl b/setup/setup_step4.tpl index 28258dfa8..2722d8274 100644 --- a/setup/setup_step4.tpl +++ b/setup/setup_step4.tpl @@ -1,4 +1,13 @@

{t}ldap connection{/t}

+ +
+{t}Please enter the server URI to allow the GOsa setup to connect your LDAP server (Example: ldap://your.server:389).{/t} +
+{t}Use the 'Test' button to try a connect. The status will be shown on the bottom of the page.{/t} +
+ +
+
{t}Location description{/t} @@ -55,7 +64,7 @@
{if $resolve_user} -
+
@@ -90,110 +99,21 @@
+
+
+ {t}Use tls connection{/t} +
+
+ +
+
+ {t}Infos in FAQ{/t}  + +
+
+
{t}Status{/t}: {$connection_status}
-
- -{if 1== 0} - - -
-
- {t}People storage ou{/t} -
-
- -
-
- asd -
-
- -
-
- {t}People dn attribute{/t} -
-
- -
-
- asd -
-
- -
-
- {t}Group storage ou{/t} -
-
- -
-
- asd -
-
- -
-
- {t}ID base for users/groups{/t} -
-
- -
-
- asd -
-
- -
-
- {t}Encryption algorithm{/t} -
-
- -
-
- asd -
-
- -
-
- {t}Mail method{/t} -
-
- -
-
- asd -
-
- -
-
- {t}Display PHP errors{/t} -
-
- -
-
- asd -
-
-{/if} - diff --git a/setup/setup_step5.tpl b/setup/setup_step5.tpl new file mode 100644 index 000000000..ff9814552 --- /dev/null +++ b/setup/setup_step5.tpl @@ -0,0 +1,220 @@ + +{if $warnings_cnt} +Errors: +{foreach from=$warnings item=val key=key} +
+ {$val} +{/foreach} +{/if} + +
+
+ {t}GOsa settings{/t} +
+ +
+
+ {t}GOsa theme{/t} +
+
+ +
+
+
+
+ +
+
+ {t}People dn attribute{/t} +
+
+ +
+
+
+
+ +
+
+ {t}People storage ou{/t} +
+
+ +
+
+
+
+ + +
+
+ {t}Group storage ou{/t} +
+
+ +
+
+
+
+ +
+
+ {t}ID base for users/groups{/t} +
+
+ +
+
+
+
+ +
+
+ {t}Display PHP errors{/t} +
+
+ +
+
+
+
+
+
+ {t}Password settings{/t} +
+ +
+
+ {t}Password encryption algorithm{/t} +
+
+ +
+
+
+
+ +
+
+ {t}Password restrictions{/t} +
+
+ + {if $pwd_rules.pwminlen_active == FALSE} + + {t}Password minimum length{/t} + + {else} + + {t}Password minimum length{/t} + + {/if} +
+ {if $pwd_rules.pwdiffer_active == FALSE} + + {t}Different characters from old password{/t} + + {else} + + {t}Different characters from old password{/t} + + {/if} + +
+
+ {t}Infos in FAQ{/t}  + +
+
+ +
+
+ {t}External script{/t} +
+
+ {if $pwd_rules.externalpwdhook_active == FALSE} + + + {else} + + + {/if} +
+
+ {t}Infos in FAQ{/t}  + +
+
+ +
+
+ {t}Mail settings{/t} +
+ +
+
+ {t}Mail method{/t} +
+
+ +
+
+
+
+ +
+
+ {t}Vacation templates{/t} +
+
+ {if $mail_settings.vacationdir_active == FALSE} + + + {else} + + + {/if} +
+
+ {t}Infos in FAQ{/t}  + +
+
+ +
+
+ {t}Use cyrus account style{/t} +
+
+ +
+
+ {t}Infos in FAQ{/t}  + +
+
+ + + + diff --git a/setup/setup_step6.tpl b/setup/setup_step6.tpl new file mode 100644 index 000000000..92928ecbc --- /dev/null +++ b/setup/setup_step6.tpl @@ -0,0 +1,230 @@ + +
+
+ {t}Samba settings{/t} +
+ + +
+
+ {t}Samba SID{/t} +
+
+ {if $samba_settings.samba_sid_active == FALSE} + + + {else} + + + {/if} +
+
+ {t}Infos in FAQ{/t}  + +
+
+ +
+
+ {t}RID base{/t} +
+
+ {if $samba_settings.samba_rid_active == FALSE} + + + {else} + + + {/if} +
+
+ {t}Infos in FAQ{/t}  + +
+
+
+
+ {t}Samba SID mapping{/t} +
+
+ +
+
+ {t}Infos in FAQ{/t}  + +
+
+
+
+ {t}Additional GOsa setttings{/t} +
+ +
+
+ {t}Windows workstation ou{/t} +
+
+ {if $generic_settings.minid_active == FALSE} + + + {else} + + + {/if} +
+
+ {t}Infos in FAQ{/t}  + +
+
+ +
+
+ {t}GID / UID min id{/t} +
+
+ {if $generic_settings.minid_active == FALSE} + + + {else} + + + {/if} +
+
+ {t}Infos in FAQ{/t}  + +
+
+ +
+
+ {t}Strict units{/t} +
+
+ +
+
+ {t}Infos in FAQ{/t}  + +
+
+ +
+
+ {t}Government mode{/t} +
+
+ +
+
+
+
+ + +
+
+ {t}Automatic uids{/t} +
+
+ {if $generic_settings.idgen_active == FALSE} + + + {else} + + + {/if} +
+
+ {t}Infos in FAQ{/t}  + +
+
+
+
+ {t}Use account expiration{/t} +
+
+ +
+
+ {t}Infos in FAQ{/t}  + +
+
+
+
+ {t}Enable snapshot functionality{/t} +
+
+ {if $generic_settings.snapshot_active == FALSE} + {t}Enable{/t}
+
+ {t}Base{/t}  +
+
+
+ {t}Server{/t}  +
+
+
+ {t}User{/t}  +
+
+
+ {t}Password{/t}  +
+ + {else} + {t}Enable{/t}
+
+ {t}Base{/t}  +
+
+
+ {t}Server{/t}  +
+
+
+ {t}User{/t}  +
+
+
+ {t}Password{/t}  +
+ + {/if} +
+
+ {t}Infos in FAQ{/t}  + +
+
+ + + diff --git a/setup/setup_step7.tpl b/setup/setup_step7.tpl new file mode 100644 index 000000000..7b9d2d7c6 --- /dev/null +++ b/setup/setup_step7.tpl @@ -0,0 +1,23 @@ + +
+
+ {t}GOsa settings{/t} +
+ +
+
+ {t}GOsa theme{/t} +
+
+ +
+ +
+ {t}Infos in FAQ{/t}  + +
+
+ + -- 2.30.2