|
From: <rc...@us...> - 2015-01-02 00:53:22
|
Revision: 7056
http://sourceforge.net/p/web-erp/reponame/7056
Author: rchacon
Date: 2015-01-02 00:53:14 +0000 (Fri, 02 Jan 2015)
Log Message:
-----------
Move default theme from session.inc to config.php. Add the ability to change the default theme in SystemParameters.php.
Modified Paths:
--------------
trunk/SystemParameters.php
trunk/config.distrib.php
trunk/doc/Change.log
trunk/includes/session.inc
trunk/install/index.php
trunk/sql/mysql/upgrade4.11-4.12.sql
Modified: trunk/SystemParameters.php
===================================================================
--- trunk/SystemParameters.php 2015-01-01 11:37:29 UTC (rev 7055)
+++ trunk/SystemParameters.php 2015-01-02 00:53:14 UTC (rev 7056)
@@ -107,7 +107,7 @@
prnMsg(_('The Quality ProdSpec Text may not contain single quotes and may not be longer than 5000 chars'),'error');
} elseif (mb_strstr($_POST['X_QualityCOAText'], "'") OR mb_strlen($_POST['X_QualityCOAText']) > 5000) {
$InputError = 1;
- prnMsg(_('The Quality COA Text may not contain single quotes and may not be longer than 5000 chars'),'error');
+ prnMsg(_('The Quality COA Text may not contain single quotes and may not be longer than 5000 chars'),'error');
}
if ($InputError !=1){
@@ -117,6 +117,27 @@
if ($_SESSION['DefaultDateFormat'] != $_POST['X_DefaultDateFormat'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_DefaultDateFormat']."' WHERE confname = 'DefaultDateFormat'";
}
+ if ($_SESSION['DefaultTheme'] != $_POST['X_DefaultTheme'] ) {// If not equal, update the default theme (login window).
+ $sql[] = "UPDATE config SET confvalue = '".$_POST['X_DefaultTheme']."' WHERE confname = 'DefaultTheme'";
+ // BEGIN Update config.php:
+ $FileName = $RootPath . 'config.php';
+ $fhandle = fopen($FileName,"r");
+ if($fhandle) {
+ $content = fread($fhandle,filesize($FileName));
+ $content = str_replace(" ;", ";", $content);// Clean space before end-of-php-line.
+ $content = str_replace("'".$_SESSION['DefaultTheme']."';", "'".$_POST['X_DefaultTheme']."';", $content);
+ $fhandle = fopen($FileName,"w");
+ if(!fwrite($fhandle,$content)) {
+ prnMsg(_("Cannot write to the configuration file").' '.$FileName,'error');
+ } else {
+ prnMsg(_("The configuration file was updated"),'info');
+ }
+ fclose($fhandle);
+ } else {
+ prnMsg(_("Cannot open the configuration file").' '.$FileName,'error');
+ }
+ // END Update config.php.
+ }
if ($_SESSION['PastDueDays1'] != $_POST['X_PastDueDays1'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_PastDueDays1']."' WHERE confname = 'PastDueDays1'";
}
@@ -404,6 +425,23 @@
</select></td>
<td>' . _('The default date format for entry of dates and display.') . '</td></tr>';
+// DefaultTheme:
+echo '<tr style="outline: 1px solid"><td>' . _('Default Theme') . ':</td>
+ <td><select name="X_DefaultTheme">';
+$ThemeDirectories = scandir('css/');// List directories inside ~/css. Each diretory is a theme.
+foreach($ThemeDirectories as $ThemeName) {
+ if(is_dir('css/'.$ThemeName) AND $ThemeName!='.' AND $ThemeName!='..' AND $ThemeName!='.svn') {
+ echo '<option';
+ if($_SESSION['DefaultTheme'] == $ThemeName) {
+ echo ' selected="selected"';
+ }
+ echo ' value="'.$ThemeName.'">'.$ThemeName.'</option>';
+ }
+}
+echo '</select></td>
+ <td>' . _("The default theme to use for the login screen and the setup of new users. The users' theme selection will override it.") . '</td></tr>';
+
+// ---------- New section:
echo '<tr><th colspan="3">' . _('Accounts Receivable/Payable Settings') . '</th></tr>';
// PastDueDays1
@@ -489,11 +527,11 @@
<td>' . _('Select the languages in which translations of the item description will be maintained. The default language is excluded.') . '</td>
</tr>';
-// Google Translator API Key
+// Google Translator API Key
echo '<tr style="outline: 1px solid"><td>' . _('Google Translator API Key') . ':</td>
<td><input type="text" name="X_GoogleTranslatorAPIKey" size="25" maxlength="50" value="' . $_SESSION['GoogleTranslatorAPIKey'] . '" /></td>
<td>' . _('Google Translator API Key to allow automatic translations. More info at https://cloud.google.com/translate/') . '</td></tr>';
-
+
//'RequirePickingNote'
echo '<tr style="outline: 1px solid"><td>' . _('A picking note must be produced before an order can be delivered') . ':</td>
<td><select name="X_RequirePickingNote">
@@ -1205,4 +1243,4 @@
</form>';
include('includes/footer.inc');
-?>
\ No newline at end of file
+?>
Modified: trunk/config.distrib.php
===================================================================
--- trunk/config.distrib.php 2015-01-01 11:37:29 UTC (rev 7055)
+++ trunk/config.distrib.php 2015-01-02 00:53:14 UTC (rev 7056)
@@ -5,10 +5,14 @@
// User configurable variables
//---------------------------------------------------
-//DefaultLanguage to use for the login screen and the setup of new users
+// Default language to use for the login screen and the setup of new users.
//The users' language selection will override
-$DefaultLanguage ='en_GB.utf8';
+$DefaultLanguage = 'en_GB.utf8';
+// Default theme to use for the login screen and the setup of new users.
+//The users' theme selection will override
+$DefaultTheme = 'xenos';
+
// Whether to display the demo login and password or not on the login screen
$AllowDemoMode = True;
@@ -106,4 +110,4 @@
//error_reporting (-1);
/*Make sure there is nothing - not even spaces after this last ?> */
-?>
\ No newline at end of file
+?>
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log 2015-01-01 11:37:29 UTC (rev 7055)
+++ trunk/doc/Change.log 2015-01-02 00:53:14 UTC (rev 7056)
@@ -1,5 +1,6 @@
webERP Change Log
+01/01/15 RChacon: Move default theme from session.inc to config.php. Add the ability to change the default theme in SystemParameters.php.
01/01/15 Exson: Make StockCategories.php strict sql mode compatible.
28/12/14 RChacon: Standardise labels and texts in Prices_Customer.php SpecialOrder.php and WWW_Access.php. Add $ViewTopic and $BookMark to WWW_Access.php
28/12/14 RChacon: Add comments, variables to link to the manual and titles in Z_CurrencyDebtorsBalances.php and Z_CurrencySuppliersBalances.php.
Modified: trunk/includes/session.inc
===================================================================
--- trunk/includes/session.inc 2015-01-01 11:37:29 UTC (rev 7055)
+++ trunk/includes/session.inc 2015-01-02 00:53:14 UTC (rev 7056)
@@ -102,7 +102,7 @@
}
/* Need to set the theme to make login screen nice */
- $Theme = (isset($_SESSION['Theme'])) ? $_SESSION['Theme'] : 'xenos';
+ $Theme = (isset($_SESSION['Theme'])) ? $_SESSION['Theme'] : $DefaultTheme;
switch ($rc) {
case UL_OK; //user logged in successfully
include($PathPrefix . 'includes/LanguageSetup.php'); //set up the language
@@ -146,8 +146,8 @@
} elseif (isset($_SESSION['Theme'])) {
$Theme = $_SESSION['Theme'];
} else {
- $Theme = 'xenos';
- $_SESSION['Theme'] = 'xenos';
+ $Theme = $DefaultTheme;
+ $_SESSION['Theme'] = '$DefaultTheme';
}
@@ -255,4 +255,4 @@
exit;
}
}
-?>
\ No newline at end of file
+?>
Modified: trunk/install/index.php
===================================================================
--- trunk/install/index.php 2015-01-01 11:37:29 UTC (rev 7055)
+++ trunk/install/index.php 2015-01-02 00:53:14 UTC (rev 7056)
@@ -150,8 +150,9 @@
$PathPrefix = '../';//To make the LanguageSetup.php script run properly
include('../includes/LanguageSetup.php');
include('../includes/MiscFunctions.php');
- //prevent the installation file from running again
+ $DefaultTheme = 'xenos';
+ // Prevent the installation file from running again:
if(file_exists('../config.php') or file_exists('../Config.php')){
prnMsg(_('It seems that the system has been already installed. If you want to install again, please remove the config.php file first'),'error');
exit;
@@ -344,8 +345,10 @@
$msg = "<?php\n\n";
$msg .= "// User configurable variables\n";
$msg .= "//---------------------------------------------------\n\n";
- $msg .= "//DefaultLanguage to use for the login screen and the setup of new users.\n";
+ $msg .= "// Default language to use for the login screen and the setup of new users.\n";
$msg .= "\$DefaultLanguage = '" . $UserLanguage . "';\n\n";
+ $msg .= "// Default theme to use for the login screen and the setup of new users.\n";
+ $msg .= "\$DefaultTheme = '" . $DefaultTheme . "';\n\n";
$msg .= "// Whether to display the demo login and password or not on the login screen\n";
$msg .= "\$AllowDemoMode = FALSE;\n\n";
$msg .= "// Connection information for the database\n";
Modified: trunk/sql/mysql/upgrade4.11-4.12.sql
===================================================================
--- trunk/sql/mysql/upgrade4.11-4.12.sql 2015-01-01 11:37:29 UTC (rev 7055)
+++ trunk/sql/mysql/upgrade4.11-4.12.sql 2015-01-02 00:53:14 UTC (rev 7056)
@@ -141,5 +141,10 @@
INSERT INTO `scripts` (`script` ,`pagesecurity` ,`description`) VALUES ('RevisionTranslations.php', '15', 'Human revision for automatic descriptions translations');
+--
+-- Insert default theme value for login screen
+--
+INSERT INTO `verdoram_erp`.`config` (`confname`, `confvalue`) VALUES ('DefaultTheme', 'xenos');
+
UPDATE config SET confvalue='4.12' WHERE confname='VersionNumber';
|