http://www.atutor.ca/atutor/mantis/view.php?id=4440
authorCindy Li <cli@ocad.ca>
Fri, 30 Jul 2010 15:12:32 +0000 (15:12 -0000)
committerCindy Li <cli@ocad.ca>
Fri, 30 Jul 2010 15:12:32 +0000 (15:12 -0000)
docs/include/classes/DAO/LanguagesDAO.class.php
docs/include/classes/Language/LanguageEditor.class.php
docs/include/classes/Language/LanguageManager.class.php
docs/language/index_inline_editor_submit.php

index c1a3ea3..74be470 100644 (file)
@@ -75,13 +75,12 @@ class LanguagesDAO extends DAO {
        * Update the given field with the given value by language_code and charset
        * @access  public
        * @param   $langCode
-       *          $charset
        *          $fieldName
        *          $fieldValue
        * @return  true / false
        * @author  Cindy Qi Li
        */
-       function UpdateField($langCode, $charset, $fieldName, $fieldValue)
+       function UpdateField($langCode, $fieldName, $fieldValue)
        {
                global $addslashes;
                
@@ -90,8 +89,7 @@ class LanguagesDAO extends DAO {
                
                $sql = "UPDATE ".TABLE_PREFIX."languages 
                           SET ".$fieldName."='".$addslashes($fieldValue)."'
-                        WHERE language_code = '".$langCode."'
-                          AND charset = '".$charset."'";
+                        WHERE language_code = '".$langCode."'";
                return $this->execute($sql);
        }
 
index a1feade..92b91ed 100644 (file)
@@ -266,7 +266,7 @@ class LanguageEditor extends Language {
                }
                $sql_dump = substr($sql_dump, 0, -3) . ";";
 
-               $readme = 'This is an AContent  language pack. Use the administrator Language section to import this language pack or manually import the contents of the SQL file into your [table_prefix]language_text table, where `table_prefix` should be replaced with your correct AContent  table prefix as defined in ./include/config.inc.php .';
+               $readme = 'This is an AContent language pack. Use the administrator Language section to import this language pack or manually import the contents of the SQL file into your [table_prefix]language_text table, where `table_prefix` should be replaced with your correct AContent  table prefix as defined in ./include/config.inc.php .';
 
                require(TR_INCLUDE_PATH . 'classes/zipfile.class.php');
                $zipfile = new zipfile();
@@ -281,7 +281,7 @@ class LanguageEditor extends Language {
                } else {
                        $version = str_replace('.','_',VERSION);
 
-                       $zipfile->send_file('AContent _' . $version . '_' . $this->code);
+                       $zipfile->send_file('AContent_' . $version . '_' . $this->code);
                }
        }
 
index 95fdf75..96d3964 100644 (file)
@@ -269,7 +269,8 @@ class LanguageManager {
        function import($filename) {
                require_once(TR_INCLUDE_PATH . 'lib/pclzip.lib.php');
                require_once(TR_INCLUDE_PATH . 'classes/Language/LanguageParser.class.php');
-
+               require_once(TR_INCLUDE_PATH . 'classes/DAO/LanguagesDAO.class.php');
+               
                global $languageManager, $msg;
 
                $import_path = TR_CONTENT_DIR . 'import/';
@@ -285,12 +286,15 @@ class LanguageManager {
                $languageParser->parse($language_xml);
                $languageEditor =& $languageParser->getLanguageEditor(0);
 
-               if ($languageManager->exists($languageEditor->getCode())) {
+               $lang_code = $languageEditor->getCode();
+               if ($languageManager->exists($lang_code)) {
                        $msg->addError('LANG_EXISTS');
                }
 
                if (!$msg->containsErrors()) {
                        $languageEditor->import($import_path . 'language_text.sql');
+                       $languagesDAO = new LanguagesDAO();
+                       $languagesDAO->UpdateField($lang_code, "status", TR_STATUS_ENABLED);
                        $msg->addFeedback('IMPORT_LANG_SUCCESS');
                        
                        $version_in_pack = $languageEditor->getTransformableVersion();
index 3c644c6..0e34593 100644 (file)
@@ -26,7 +26,7 @@ if (isset($_POST['field']) && isset($_POST['value']) && $_POST['value'] <> '')
 \r
        // Format of $_POST['field']: [fieldName]|[language_code]|[charset]\r
        $pieces = explode(':', $_POST['field']);\r
-       $languagesDAO->UpdateField($pieces[1], $pieces[2], $pieces[0], $_POST['value']);\r
+       $languagesDAO->UpdateField($pieces[1], $pieces[0], $_POST['value']);\r
        $rtn['status'] = 'success';\r
        $rtn['success'][] = _AT('TR_FEEDBACK_ACTION_COMPLETED_SUCCESSFULLY');\r
 }\r