From: <rc...@us...> - 2017-04-09 20:10:25
|
Revision: 7749 http://sourceforge.net/p/web-erp/reponame/7749 Author: rchacon Date: 2017-04-09 20:10:23 +0000 (Sun, 09 Apr 2017) Log Message: ----------- In UserSettings.php, add options to turn off/on page help and field help. In WWW_Users.php, improve code and documentation. Modified Paths: -------------- trunk/UserSettings.php trunk/WWW_Users.php trunk/doc/Change.log trunk/doc/Manual/ManualGettingStarted.html Modified: trunk/UserSettings.php =================================================================== --- trunk/UserSettings.php 2017-04-02 13:36:01 UTC (rev 7748) +++ trunk/UserSettings.php 2017-04-09 20:10:23 UTC (rev 7749) @@ -18,8 +18,7 @@ _('Chinese'), _('Free Serif')); - -if (isset($_POST['Modify'])) { +if(isset($_POST['Modify'])) { // no input errors assumed initially before we test $InputError = 0; @@ -64,38 +63,38 @@ SET displayrecordsmax='" . $_POST['DisplayRecordsMax'] . "', theme='" . $_POST['Theme'] . "', language='" . $_POST['Language'] . "', - email='". $_POST['email'] ."', + email='" . $_POST['email'] . "', + showpagehelp='" . $_POST['ShowPageHelp'] . "', + showfieldhelp='" . $_POST['ShowFieldHelp'] . "', pdflanguage='" . $_POST['PDFLanguage'] . "' WHERE userid = '" . $_SESSION['UserID'] . "'"; - $ErrMsg = _('The user alterations could not be processed because'); $DbgMsg = _('The SQL that was used to update the user and failed was'); - $result = DB_query($sql, $ErrMsg, $DbgMsg); - prnMsg( _('The user settings have been updated') . '. ' . _('Be sure to remember your password for the next time you login'),'success'); } else { $sql = "UPDATE www_users - SET displayrecordsmax='" . $_POST['DisplayRecordsMax'] . "', - theme='" . $_POST['Theme'] . "', - language='" . $_POST['Language'] . "', - email='". $_POST['email'] ."', - pdflanguage='" . $_POST['PDFLanguage'] . "', - password='" . CryptPass($_POST['Password']) . "' - WHERE userid = '" . $_SESSION['UserID'] . "'"; - + SET displayrecordsmax='" . $_POST['DisplayRecordsMax'] . "', + theme='" . $_POST['Theme'] . "', + language='" . $_POST['Language'] . "', + email='" . $_POST['email'] ."', + showpagehelp='" . $_POST['ShowPageHelp'] . "', + showfieldhelp='" . $_POST['ShowFieldHelp'] . "', + pdflanguage='" . $_POST['PDFLanguage'] . "', + password='" . CryptPass($_POST['Password']) . "' + WHERE userid = '" . $_SESSION['UserID'] . "'"; $ErrMsg = _('The user alterations could not be processed because'); $DbgMsg = _('The SQL that was used to update the user and failed was'); - $result = DB_query($sql, $ErrMsg, $DbgMsg); - prnMsg(_('The user settings have been updated'),'success'); } - // update the session variables to reflect user changes on-the-fly + // Update the session variables to reflect user changes on-the-fly: $_SESSION['DisplayRecordsMax'] = $_POST['DisplayRecordsMax']; $_SESSION['Theme'] = trim($_POST['Theme']); /*already set by session.inc but for completeness */ $Theme = $_SESSION['Theme']; $_SESSION['Language'] = trim($_POST['Language']); + $_SESSION['ShowPageHelp'] = $_POST['ShowPageHelp']; + $_SESSION['ShowFieldHelp'] = $_POST['ShowFieldHelp']; $_SESSION['PDFLanguage'] = $_POST['PDFLanguage']; include ('includes/LanguageSetup.php'); // After last changes in LanguageSetup.php, is it required to update? } @@ -106,9 +105,7 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; If (!isset($_POST['DisplayRecordsMax']) OR $_POST['DisplayRecordsMax']=='') { - - $_POST['DisplayRecordsMax'] = $_SESSION['DefaultDisplayRecordsMax']; - + $_POST['DisplayRecordsMax'] = $_SESSION['DefaultDisplayRecordsMax']; } echo '<table class="selection"> @@ -185,24 +182,60 @@ <tr> <td>' . _('Email') . ':</td>'; -$sql = "SELECT email from www_users WHERE userid = '" . $_SESSION['UserID'] . "'"; +$sql = "SELECT + email, + showpagehelp, + showfieldhelp + from www_users WHERE userid = '" . $_SESSION['UserID'] . "'"; $result = DB_query($sql); $myrow = DB_fetch_array($result); + if(!isset($_POST['email'])){ $_POST['email'] = $myrow['email']; } +$_POST['ShowPageHelp'] = $myrow['showpagehelp']; +$_POST['ShowFieldHelp'] = $myrow['showfieldhelp']; echo '<td><input type="email" name="email" size="40" value="' . $_POST['email'] . '" /></td> </tr>'; +// Turn off/on page help: +echo '<tr> + <td><label for="ShowPageHelp">', _('Display page help'), ':</label></td> + <td><select id="ShowPageHelp" name="ShowPageHelp">'; +if($_POST['ShowPageHelp']==0) { + echo '<option selected="selected" value="0">', _('No'), '</option>', + '<option value="1">', _('Yes'), '</option>'; +} else { + echo '<option value="0">', _('No'), '</option>', + '<option selected="selected" value="1">', _('Yes'), '</option>'; +} +echo '</select>', + (!isset($_SESSION['ShowFieldHelp']) || $_SESSION['ShowFieldHelp'] ? _('Show page help when available') : ''), // If the parameter $_SESSION['ShowFieldHelp'] is not set OR is TRUE, shows this field help text. + '</td> + </tr>'; +// Turn off/on field help: +echo '<tr> + <td><label for="ShowFieldHelp">', _('Display field help'), ':</label></td> + <td><select id="ShowFieldHelp" name="ShowFieldHelp">'; +if($_POST['ShowFieldHelp']==0) { + echo '<option selected="selected" value="0">', _('No'), '</option>', + '<option value="1">', _('Yes'), '</option>'; +} else { + echo '<option value="0">', _('No'), '</option>', + '<option selected="selected" value="1">', _('Yes'), '</option>'; +} +echo '</select>', + (!isset($_SESSION['ShowFieldHelp']) || $_SESSION['ShowFieldHelp'] ? _('Show field help when available') : ''), // If the parameter $_SESSION['ShowFieldHelp'] is not set OR is TRUE, shows this field help text. + '</td> + </tr>'; +// PDF Language Support: if (!isset($_POST['PDFLanguage'])){ $_POST['PDFLanguage']=$_SESSION['PDFLanguage']; } - echo '<tr> <td>' . _('PDF Language Support') . ': </td> <td><select name="PDFLanguage">'; - for($i=0;$i<count($PDFLanguages);$i++){ if ($_POST['PDFLanguage']==$i){ echo '<option selected="selected" value="' . $i .'">' . $PDFLanguages[$i] . '</option>'; Modified: trunk/WWW_Users.php =================================================================== --- trunk/WWW_Users.php 2017-04-02 13:36:01 UTC (rev 7748) +++ trunk/WWW_Users.php 2017-04-09 20:10:23 UTC (rev 7749) @@ -46,10 +46,10 @@ _('Display Setup module'), _('Display Utilities module')); -$PDFLanguages = array(_('Latin Western Languages'), - _('Eastern European Russian Japanese Korean Vietnamese Hebrew Arabic Thai'), - _('Chinese'), - _('Free Serif')); +$PDFLanguages = array(_('Latin Western Languages - Times'), + _('Eastern European Russian Japanese Korean Hebrew Arabic Thai'), + _('Chinese'), + _('Free Serif')); include('includes/SQL_CommonFunctions.inc'); @@ -185,47 +185,52 @@ } elseif($InputError !=1) { - $sql = "INSERT INTO www_users (userid, - realname, - customerid, - branchcode, - supplierid, - salesman, - password, - phone, - email, - pagesize, - fullaccess, - cancreatetender, - defaultlocation, - modulesallowed, - displayrecordsmax, - theme, - language, - pdflanguage, - department) - VALUES ('" . $_POST['UserID'] . "', - '" . $_POST['RealName'] ."', - '" . $_POST['Cust'] ."', - '" . $_POST['BranchCode'] ."', - '" . $_POST['SupplierID'] ."', - '" . $_POST['Salesman'] . "', - '" . CryptPass($_POST['Password']) ."', - '" . $_POST['Phone'] . "', - '" . $_POST['Email'] ."', - '" . $_POST['PageSize'] ."', - '" . $_POST['Access'] . "', - '" . $_POST['CanCreateTender'] . "', - '" . $_POST['DefaultLocation'] ."', - '" . $ModulesAllowed . "', - '" . $_SESSION['DefaultDisplayRecordsMax'] . "', - '" . $_POST['Theme'] . "', - '". $_POST['UserLanguage'] ."', - '" . $_POST['PDFLanguage'] . "', - '" . $_POST['Department'] . "')"; + $sql = "INSERT INTO www_users ( + userid, + realname, + customerid, + branchcode, + supplierid, + salesman, + password, + phone, + email, + pagesize, + fullaccess, + cancreatetender, + defaultlocation, + modulesallowed, + showdashboard, + showpagehelp, + showfieldhelp, + displayrecordsmax, + theme, + language, + pdflanguage, + department) + VALUES ('" . $_POST['UserID'] . "', + '" . $_POST['RealName'] ."', + '" . $_POST['Cust'] ."', + '" . $_POST['BranchCode'] ."', + '" . $_POST['SupplierID'] ."', + '" . $_POST['Salesman'] . "', + '" . CryptPass($_POST['Password']) ."', + '" . $_POST['Phone'] . "', + '" . $_POST['Email'] ."', + '" . $_POST['PageSize'] ."', + '" . $_POST['Access'] . "', + '" . $_POST['CanCreateTender'] . "', + '" . $_POST['DefaultLocation'] ."', + '" . $ModulesAllowed . "', + '" . $_POST['ShowDashboard'] . "', + '" . $_POST['ShowPageHelp'] . "', + '" . $_POST['ShowFieldHelp'] . "', + '" . $_SESSION['DefaultDisplayRecordsMax'] . "', + '" . $_POST['Theme'] . "', + '". $_POST['UserLanguage'] ."', + '" . $_POST['PDFLanguage'] . "', + '" . $_POST['Department'] . "')"; prnMsg( _('A new user record has been inserted'), 'success' ); - $_SESSION['ShowPageHelp'] = $_POST['ShowPageHelp']; - $_SESSION['ShowFieldHelp'] = $_POST['ShowFieldHelp']; $LocationSql = "INSERT INTO locationusers (loccode, userid, @@ -404,30 +409,31 @@ if(isset($SelectedUser)) { //editing an existing User - $sql = "SELECT userid, - realname, - phone, - email, - customerid, - password, - branchcode, - supplierid, - salesman, - pagesize, - fullaccess, - cancreatetender, - defaultlocation, - modulesallowed, - showdashboard, - showpagehelp, - showfieldhelp, - blocked, - theme, - language, - pdflanguage, - department - FROM www_users - WHERE userid='" . $SelectedUser . "'"; + $sql = "SELECT + userid, + realname, + phone, + email, + customerid, + password, + branchcode, + supplierid, + salesman, + pagesize, + fullaccess, + cancreatetender, + defaultlocation, + modulesallowed, + showdashboard, + showpagehelp, + showfieldhelp, + blocked, + theme, + language, + pdflanguage, + department + FROM www_users + WHERE userid='" . $SelectedUser . "'"; $result = DB_query($sql); $myrow = DB_fetch_array($result); @@ -445,12 +451,12 @@ $_POST['CanCreateTender'] = $myrow['cancreatetender']; $_POST['DefaultLocation'] = $myrow['defaultlocation']; $_POST['ModulesAllowed'] = $myrow['modulesallowed']; - $_POST['Theme'] = $myrow['theme']; - $_POST['UserLanguage'] = $myrow['language']; $_POST['ShowDashboard'] = $myrow['showdashboard']; $_POST['ShowPageHelp'] = $myrow['showpagehelp']; $_POST['ShowFieldHelp'] = $myrow['showfieldhelp']; $_POST['Blocked'] = $myrow['blocked']; + $_POST['Theme'] = $myrow['theme']; + $_POST['UserLanguage'] = $myrow['language']; $_POST['PDFLanguage'] = $myrow['pdflanguage']; $_POST['Department'] = $myrow['department']; @@ -485,6 +491,9 @@ $_POST['ModulesAllowed'] .= '1'; $i++; } + $_POST['ShowDashboard'] = 0; + $_POST['ShowPageHelp'] = 1; + $_POST['ShowFieldHelp'] = 1; } if(!isset($_POST['Password'])) { @@ -718,45 +727,48 @@ $i++; }// END foreach($ModuleList as $ModuleName). +// Turn off/on dashboard after Login: echo '<tr> <td><label for="ShowDashboard">', _('Display Dashboard after Login'), ':</label></td> <td><select id="ShowDashboard" name="ShowDashboard">'; if($_POST['ShowDashboard']==0) { - echo '<option selected="selected" value="0">' . _('No') . '</option>', + echo '<option selected="selected" value="0">', _('No'), '</option>', '<option value="1">', _('Yes'), '</option>'; } else { echo '<option value="0">', _('No'), '</option>', - '<option selected="selected" value="1">' . _('Yes') . '</option>'; + '<option selected="selected" value="1">', _('Yes'), '</option>'; } echo '</select></td> </tr>'; - // Turn off/on page help: echo '<tr> <td><label for="ShowPageHelp">', _('Display page help'), ':</label></td> <td><select id="ShowPageHelp" name="ShowPageHelp">'; if($_POST['ShowPageHelp']==0) { - echo '<option selected="selected" value="0">' . _('No') . '</option>', + echo '<option selected="selected" value="0">', _('No'), '</option>', '<option value="1">', _('Yes'), '</option>'; } else { echo '<option value="0">', _('No'), '</option>', - '<option selected="selected" value="1">' . _('Yes') . '</option>'; + '<option selected="selected" value="1">', _('Yes'), '</option>'; } -echo '</select></td> +echo '</select>', + (!isset($_SESSION['ShowFieldHelp']) || $_SESSION['ShowFieldHelp'] ? _('Show page help when available') : ''), // If the parameter $_SESSION['ShowFieldHelp'] is not set OR is TRUE, shows this field help text. + '</td> </tr>'; - // Turn off/on field help: echo '<tr> <td><label for="ShowFieldHelp">', _('Display field help'), ':</label></td> <td><select id="ShowFieldHelp" name="ShowFieldHelp">'; if($_POST['ShowFieldHelp']==0) { - echo '<option selected="selected" value="0">' . _('No') . '</option>', + echo '<option selected="selected" value="0">', _('No'), '</option>', '<option value="1">', _('Yes'), '</option>'; } else { echo '<option value="0">', _('No'), '</option>', - '<option selected="selected" value="1">' . _('Yes') . '</option>'; + '<option selected="selected" value="1">', _('Yes'), '</option>'; } -echo '</select></td> +echo '</select>', + (!isset($_SESSION['ShowFieldHelp']) || $_SESSION['ShowFieldHelp'] ? _('Show field help when available') : ''), // If the parameter $_SESSION['ShowFieldHelp'] is not set OR is TRUE, shows this field help text. + '</td> </tr>'; if(!isset($_POST['PDFLanguage'])) { Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2017-04-02 13:36:01 UTC (rev 7748) +++ trunk/doc/Change.log 2017-04-09 20:10:23 UTC (rev 7749) @@ -1,5 +1,6 @@ webERP Change Log +09/4/17 RChacon: In UserSettings.php, add options to turn off/on page help and field help. In WWW_Users.php, improve code and documentation. 30/3/17 RChacon: In ManualContents.php, fix checkbox showing and do some improvements. 29/3/17 RChacon: In webERP manual, allow to use default pages if locale pages do not exist. 26/3/17 Abel World: Make degine $ReportList as an array to comply with PHP 7. Modified: trunk/doc/Manual/ManualGettingStarted.html =================================================================== --- trunk/doc/Manual/ManualGettingStarted.html 2017-04-02 13:36:01 UTC (rev 7748) +++ trunk/doc/Manual/ManualGettingStarted.html 2017-04-09 20:10:23 UTC (rev 7749) @@ -369,9 +369,16 @@ <p>To change the language displayed for a specific user - the user clicks on their name as shown on every screen at the top of the page. This brings up their user settings.</p> -<p align="center"><img src="doc/Manual/images/UserSettings.jpg"></p>webERP looks at all the directories available under webERP/locale to see which languages are installed and provides a convenient way for users to select their preferred language. In addition to selecting the language it is also necessary to select the fonts required for pdf support in the selected language. -<p> +<p align="center"><img src="doc/Manual/images/UserSettings.jpg"></p> +<p>webERP looks at all the directories available under webERP/locale to see which languages are installed and provides a convenient way for users to select their preferred language. In addition to selecting the language it is also necessary to select the fonts required for pdf support in the selected language.</p> + +<p><b>Display Dashboard after Login.</b> Select "Yes" to show the dashboard page after Login, otherwise "No" to do not. This page shows overdue customer balances, supplier invoices due within one month, bank and credit card balances, and outstanding orders. Default: no.</p> + +<p><b>Display page help.</b> Select "Yes" to show the page help when available, otherwise "No" to hide it. This help is displayed at the top of the page in a box. Default: yes.</p> + +<p><b>Display field help.</b> Select "Yes" to show the field help when available, otherwise "No" to hide it. This help is displayed next to the input field. Default: yes.</p> + <p>PDFs are produced in utf-8 character set which has 4 bytes for each character. Unfortunately, the CID fonts used in PDFs only have 2 bytes so there is required to be some mapping of CID characters to utf-8 fonts to make everything work. In practise all this means is that the correct language needs also to be selected for the PDF language.</p> <p>If you are interested in contributing a language pack to webERP - which is always very much appreciated! There are instructions for how to proceed at http://www.weberp.org/wiki/HowToTranslate</p><!-- Help End: WWW_Users --> |