From: <te...@us...> - 2013-07-13 02:19:01
|
Revision: 6077 http://sourceforge.net/p/web-erp/reponame/6077 Author: tehonu Date: 2013-07-13 02:18:57 +0000 (Sat, 13 Jul 2013) Log Message: ----------- Use of 3 options for $AllowCompanySelectionBox: ShowSelectionBox, ShowInputBox, Hide. Modified Paths: -------------- trunk/config.distrib.php trunk/includes/Login.php trunk/install/save.php Modified: trunk/config.distrib.php =================================================================== --- trunk/config.distrib.php 2013-07-12 14:54:12 UTC (rev 6076) +++ trunk/config.distrib.php 2013-07-13 02:18:57 UTC (rev 6077) @@ -41,12 +41,19 @@ $DBUser = 'weberp_db_user'; $DBPassword = 'weberp_db_pwd'; -//It would probably be inappropraite to allow selection of the company in a hosted envionment so this option can be turned off with this parameter -//webERP examines each of the directories under the companies directory to determine all the companies that can be logged into -//a new company directory together with the necessary subdirectories is created each time a new company is created by Z_MakeNewCompany.php -$AllowCompanySelectionBox = true; +// It would probably be inappropraite to allow selection of the company in a hosted envionment so this option can be switched to 'ShowInputBox' or 'Hide' +// depending if you allow the user to select the name of the company or must use the default one described at $DefaultCompany +// If set to 'ShowSelectionBox' webERP examines each of the directories under the companies directory to determine all the companies that can be logged into +// a new company directory together with the necessary subdirectories is created each time a new company is created by Z_MakeNewCompany.php +// It would also be inappropiate in some environments to show the name of the company (database name) --> Choose 'Hide'. +// Options: +// 'ShowSelectionBox' (default) +// 'ShowInputBox' +// 'Hide' -//If $AllowCompanySelectionBox = false above then the $DefaultCompany string is entered in the login screen as a default +$AllowCompanySelectionBox = 'ShowSelectionBox'; + +//If $AllowCompanySelectionBox is not 'ShowSelectionBox' above then the $DefaultCompany string is entered in the login screen as a default //otherwise the user is expected to know the name of the company to log into. $DefaultCompany = 'weberpdemo'; Modified: trunk/includes/Login.php =================================================================== --- trunk/includes/Login.php 2013-07-12 14:54:12 UTC (rev 6076) +++ trunk/includes/Login.php 2013-07-13 02:18:57 UTC (rev 6077) @@ -35,12 +35,18 @@ <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8');?>" method="post"> <div> <input type="hidden" name="FormID" value="<?php echo $_SESSION['FormID']; ?>" /> - <span><?php echo _('Company'); ?>:</span> - + <span> <?php - if ($AllowCompanySelectionBox == true){ + if ($AllowCompanySelectionBox == 'Hide'){ + // do not show input or selection box + echo '<input type="hidden" name="CompanyNameField" value="' . $DefaultCompany . '" />'; + } else if ($AllowCompanySelectionBox == 'ShowInputBox'){ + // show input box + echo _('Company') . '<input type="text" name="CompanyNameField" value="' . $DefaultCompany . '" />'; + }else{ + // Show selection box ($AllowCompanySelectionBox == 'ShowSelectionBox') + echo _('Company'); echo '<select name="CompanyNameField">'; - $Companies = scandir('companies/', 0); foreach ($Companies as $CompanyEntry){ if (is_dir('companies/' . $CompanyEntry) AND $CompanyEntry != '..' AND $CompanyEntry != '' AND $CompanyEntry!='.svn' AND $CompanyEntry!='.'){ @@ -52,11 +58,9 @@ } } echo '</select>'; - } else { - echo '<input type="text" name="CompanyNameField" value="' . $DefaultCompany . '" />'; - } + } ?> - + </span> <br /> <span><?php echo _('User name'); ?>:</span><br /> <input type="text" name="UserNameEntryField" maxlength="20" /><br /> Modified: trunk/install/save.php =================================================================== --- trunk/install/save.php 2013-07-12 14:54:12 UTC (rev 6076) +++ trunk/install/save.php 2013-07-13 02:18:57 UTC (rev 6077) @@ -295,7 +295,7 @@ $msg .= "// The timezone of the business - this allows the possibility of having;\n"; $msg .= "date_default_timezone_set('" . $_POST['timezone'] . "');\n"; $msg .= "putenv('TZ=" . $_POST['timezone'] . "');\n"; -$msg .= "\$AllowCompanySelectionBox = true;\n"; +$msg .= "\$AllowCompanySelectionBox = 'ShowSelectionBox' ;\n"; if ($_POST['DemoData'] ==false){ $msg .= "\$DefaultCompany = '" . $_POST['company_name']. "';\n"; } else { |