From: <rc...@us...> - 2015-01-04 21:55:06
|
Revision: 7062 http://sourceforge.net/p/web-erp/reponame/7062 Author: rchacon Date: 2015-01-04 21:54:58 +0000 (Sun, 04 Jan 2015) Log Message: ----------- In RevisionTranslations.php, add $Id, $ViewTopic, $BookMark and page_title_text. Add info to manual. Add comments to code. Modified Paths: -------------- trunk/RevisionTranslations.php trunk/doc/Change.log trunk/doc/Manual/ManualInventory.html trunk/doc/Manual/ManualSpecialUtilities.html trunk/sql/mysql/upgrade4.11-4.12.sql Modified: trunk/RevisionTranslations.php =================================================================== --- trunk/RevisionTranslations.php 2015-01-04 18:02:35 UTC (rev 7061) +++ trunk/RevisionTranslations.php 2015-01-04 21:54:58 UTC (rev 7062) @@ -1,109 +1,119 @@ -<?php - -include('includes/session.inc'); -$Title = _('Revision of Description Translations'); -include('includes/header.inc'); -include('includes/SQL_CommonFunctions.inc'); - -//update database if update pressed -if (isset($_POST['Submit'])){ - for ($i=1;$i<count($_POST);$i++){ //loop through the returned translations - - if (isset($_POST['Revised' . $i]) AND ($_POST['Revised' . $i] == '1')){ - $sqlUpdate="UPDATE stockdescriptiontranslations - SET needsrevision = '0', - descriptiontranslation = '". $_POST['DescriptionTranslation' .$i] ."', - longdescriptiontranslation = '". $_POST['LongDescriptionTranslation' .$i] ."' - WHERE stockid = '". $_POST['StockID' .$i] ."' - AND language_id = '". $_POST['LanguageID' .$i] ."'"; - $ResultUpdate = DB_Query($sqlUpdate,'', '', true); - prnMsg($_POST['StockID' .$i] . ' ' . _('descriptions') . ' ' . _('in') . ' ' . $_POST['LanguageID' .$i] . ' ' . _('have been updated'),'success'); - } - } -} - -echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; -echo '<div>'; -echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - -echo '<table class="selection"> - <tr> - <th colspan="7">' . _('Translations to revise') .'</th> - </tr>'; - -$sql = "SELECT stockdescriptiontranslations.stockid, - stockmaster.description, - stockmaster.longdescription, - stockdescriptiontranslations.language_id, - stockdescriptiontranslations.descriptiontranslation, - stockdescriptiontranslations.longdescriptiontranslation - FROM stockdescriptiontranslations, stockmaster - WHERE stockdescriptiontranslations.stockid = stockmaster.stockid - AND stockdescriptiontranslations.needsrevision = '1' - ORDER BY stockdescriptiontranslations.stockid, - stockdescriptiontranslations.language_id"; - -$result = DB_query($sql); - -echo '<tr> - <th>' . _('Code') . '</th> - <th>' . _('Language') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Long Description') . '</th> - <th>' . _('Revised?') . '</th> -</tr>'; - -$k=0; //row colour counter -$i=1; -while ($myrow=DB_fetch_array($result)) { - - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - - echo'<td>' . $myrow['stockid'] . '</td> - <td>'. $_SESSION['Language']. '</td> - <td>' . $myrow['description'] . '</td> - <td>' . $myrow['longdescription'] . '</td> - </tr>'; - - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - - echo'<td></td> - <td>' . $myrow['language_id'] . '</td>'; - - echo '<td> - <input type="text" class="text" name="DescriptionTranslation' . $i .'" maxlength="50" size="52" value="'. $myrow['descriptiontranslation'] .'" /> - </td> - <td> - <textarea name="LongDescriptionTranslation' . $i .'" cols="70" rows="5">'. $myrow['longdescriptiontranslation'] .'" </textarea></td> - </td>'; - - echo '<td><input type="checkbox" name="Revised' . $i.'" value="1" /> - </td> - </tr>'; - echo'<input type="hidden" value="' . $myrow['stockid'] . '" name="StockID' . $i . '" /> - <input type="hidden" value="' . $myrow['language_id'] . '" name="LanguageID' . $i . '" />'; - $i++; - -} //end of looping - -echo '</table> - <br /> - <div class="centre"> - <input type="submit" name="Submit" value="' . _('Update') . '" /></div> - </div> - </form>'; - -include('includes/footer.inc'); -?> +<?php +/* $Id: RevisionTranslations.php 7040 2014-12-27 15:15:29Z tehonu $*/ +/* This script is to review the item description translations. */ + +include('includes/session.inc'); + +$Title = _('Review Translated Descriptions');// Screen identificator. +$ViewTopic= 'Inventory';// Filename's id in ManualContents.php's TOC. +$BookMark = 'ReviewTranslatedDescriptions';// Anchor's id in the manual's html document. +include('includes/header.inc'); +echo '<p class="page_title_text"><img alt="" src="'.$RootPath.'/css/'.$Theme. + '/images/maintenance.png" title="' .// Title icon. + _('Review Translated Descriptions') . '" />' .// Icon title. + _('Review Translated Descriptions') . '</p>';// Page title. + +include('includes/SQL_CommonFunctions.inc'); + +//update database if update pressed +if(isset($_POST['Submit'])) { + for ($i=1;$i<count($_POST);$i++) { //loop through the returned translations + + if(isset($_POST['Revised' . $i]) AND ($_POST['Revised' . $i] == '1')) { + $sqlUpdate="UPDATE stockdescriptiontranslations + SET needsrevision = '0', + descriptiontranslation = '". $_POST['DescriptionTranslation' .$i] ."', + longdescriptiontranslation = '". $_POST['LongDescriptionTranslation' .$i] ."' + WHERE stockid = '". $_POST['StockID' .$i] ."' + AND language_id = '". $_POST['LanguageID' .$i] ."'"; + $ResultUpdate = DB_Query($sqlUpdate,'', '', true); + prnMsg($_POST['StockID' .$i] . ' ' . _('descriptions') . ' ' . _('in') . ' ' . $_POST['LanguageID' .$i] . ' ' . _('have been updated'),'success'); + } + } +} + +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<div>'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + +echo '<table class="selection"> + <tr> + <th colspan="7">' . _('Translations to revise') .'</th> + </tr>'; + +$sql = "SELECT stockdescriptiontranslations.stockid, + stockmaster.description, + stockmaster.longdescription, + stockdescriptiontranslations.language_id, + stockdescriptiontranslations.descriptiontranslation, + stockdescriptiontranslations.longdescriptiontranslation + FROM stockdescriptiontranslations, stockmaster + WHERE stockdescriptiontranslations.stockid = stockmaster.stockid + AND stockdescriptiontranslations.needsrevision = '1' + ORDER BY stockdescriptiontranslations.stockid, + stockdescriptiontranslations.language_id"; + +$result = DB_query($sql); + +echo '<tr> + <th>' . _('Code') . '</th> + <th>' . _('Language') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Long Description') . '</th> + <th>' . _('Revised?') . '</th> +</tr>'; + +$k=0; //row colour counter +$i=1; +while($myrow=DB_fetch_array($result)) { + + if($k==1) { + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + + echo '<td>' . $myrow['stockid'] . '</td> + <td>'. $_SESSION['Language']. '</td> + <td>' . $myrow['description'] . '</td> + <td>' . $myrow['longdescription'] . '</td> + </tr>'; + + if($k==1) { + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + + echo '<td></td> + <td>' . $myrow['language_id'] . '</td>'; + + echo '<td> + <input type="text" class="text" name="DescriptionTranslation' . $i .'" maxlength="50" size="52" value="'. $myrow['descriptiontranslation'] .'" /> + </td> + <td> + <textarea name="LongDescriptionTranslation' . $i .'" cols="70" rows="5">'. $myrow['longdescriptiontranslation'] .'" </textarea></td> + </td>'; + + echo '<td><input type="checkbox" name="Revised' . $i.'" value="1" /> + </td> + </tr>'; + echo '<input type="hidden" value="' . $myrow['stockid'] . '" name="StockID' . $i . '" /> + <input type="hidden" value="' . $myrow['language_id'] . '" name="LanguageID' . $i . '" />'; + $i++; + +} //end of looping + +echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="Submit" value="' . _('Update') . '" /></div> + </div> + </form>'; + +include('includes/footer.inc'); +?> \ No newline at end of file Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2015-01-04 18:02:35 UTC (rev 7061) +++ trunk/doc/Change.log 2015-01-04 21:54:58 UTC (rev 7062) @@ -1,5 +1,6 @@ webERP Change Log +04/01/15 RChacon: In RevisionTranslations.php, add $Id, $ViewTopic, $BookMark and page_title_text. Add info to manual. Add comments to code. 04/01/15 RChacon: In SystemParameters.php, remove root path to config.php and add comments. 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. Modified: trunk/doc/Manual/ManualInventory.html =================================================================== --- trunk/doc/Manual/ManualInventory.html 2015-01-04 18:02:35 UTC (rev 7061) +++ trunk/doc/Manual/ManualInventory.html 2015-01-04 21:54:58 UTC (rev 7062) @@ -296,6 +296,20 @@ <h3>Item Properties</h3> <!-- Help End: Stocks --> +<!-- Help Begin: ReviewTranslatedDescriptions --> + <div class="floatright"> + <a class="minitext" href="#top">⬆ Top</a> + </div> + + <h2><a id="ReviewTranslatedDescriptions">Review Translated Descriptions</a></h2> + + <p>This script shows items descriptions marked for review and allows to edit the translations.</p> + + <p>You can review and edit the translated short description (<i>stockdescriptiontranslations.descriptiontranslation</i> field) and the translated long description (<i>stockdescriptiontranslations.longdescriptiontranslation</i> field) that have the review flag turned on (<i>stockdescriptiontranslations.needsrevision=1</i>).</p> + + <p>See also: In <a href="ManualContents.php?ViewTopic=SpecialUtilities">Special Utilities</a>, <a href="ManualContents.php?ViewTopic=SpecialUtilities#Z_TranslateItemDescriptions">Translate Item Descriptions</a>.</p> + +<!-- Help End: ReviewTranslatedDescriptions --> <!-- Help Begin: StockCostUpdate --> <div class="floatright"> Modified: trunk/doc/Manual/ManualSpecialUtilities.html =================================================================== --- trunk/doc/Manual/ManualSpecialUtilities.html 2015-01-04 18:02:35 UTC (rev 7061) +++ trunk/doc/Manual/ManualSpecialUtilities.html 2015-01-04 21:54:58 UTC (rev 7062) @@ -52,6 +52,9 @@ <p>It requieres a Google Translator API Key (more info in <a href="https://cloud.google.com/translate/" target=_blank">https://cloud.google.com/translate/</a>) to allow automatic translations.</p> +<p>See also: In <a href="ManualContents.php?ViewTopic=Inventory">Inventory (aka "Stock")</a>, <a href="ManualContents.php? +ViewTopic=Inventory#ReviewTranslatedDescriptions">Review Translated Descriptions</a>.</p> + <h2><a id="Z_BottomUpCosts">Update costs for all BOM items, from the bottom up</a></h2> <p>.</p> Modified: trunk/sql/mysql/upgrade4.11-4.12.sql =================================================================== --- trunk/sql/mysql/upgrade4.11-4.12.sql 2015-01-04 18:02:35 UTC (rev 7061) +++ trunk/sql/mysql/upgrade4.11-4.12.sql 2015-01-04 21:54:58 UTC (rev 7062) @@ -134,13 +134,13 @@ ALTER TABLE `stockdescriptiontranslations` ADD `longdescriptiontranslation` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Item''s long description'; -- Add a field to mark if a description needs revision: ALTER TABLE `stockdescriptiontranslations` ADD `needsrevision` TINYINT(1) NOT NULL DEFAULT '0'; - -INSERT INTO `scripts` (`script` ,`pagesecurity` ,`description`) VALUES ('AutomaticTranslationDescriptions.php', '15', 'Translates via Google Translator all empty translated descriptions '); - +-- INSERT INTO `config` (`confname` ,`confvalue`) VALUES ('GoogleTranslatorAPIKey', ''); +-- Assign a Page Security value to each translation script: +INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES + ('AutomaticTranslationDescriptions.php', '15', 'Translates via Google Translator all empty translated descriptions'), + ('RevisionTranslations.php', '15', 'Human revision for automatic descriptions translations'); -INSERT INTO `scripts` (`script` ,`pagesecurity` ,`description`) VALUES ('RevisionTranslations.php', '15', 'Human revision for automatic descriptions translations'); - -- -- Insert default theme value for login screen -- |