[pLog-svn] r6236 - in plog/trunk: class/action/admin class/locale config templates/admin

mark at devel.lifetype.net mark at devel.lifetype.net
Sat Mar 15 07:04:42 EDT 2008


Author: mark
Date: 2008-03-15 07:04:42 -0400 (Sat, 15 Mar 2008)
New Revision: 6236

Modified:
   plog/trunk/class/action/admin/adminscanlocalesaction.class.php
   plog/trunk/class/locale/locales.class.php
   plog/trunk/config/config.properties.php
   plog/trunk/templates/admin/sitelocales.template
Log:
Ajaxlize scanLocales done!

Modified: plog/trunk/class/action/admin/adminscanlocalesaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminscanlocalesaction.class.php	2008-03-15 10:14:24 UTC (rev 6235)
+++ plog/trunk/class/action/admin/adminscanlocalesaction.class.php	2008-03-15 11:04:42 UTC (rev 6236)
@@ -37,14 +37,11 @@
 			$newLocaleCodes = $f->find();
 
 			// success message
-			$successMessage = "";
+			$this->_message = "";
 
-			// set up the view
-			$this->_view = new AdminSiteLocalesListView( $this->_blogInfo );
-
 			// if there are no new locales, there's no point in doing anything!
 			if( count( $newLocaleCodes ) == 0 ) {
-				$this->_view->setErrorMessage( $this->_locale->tr("error_no_new_locales_found" ));
+				$this->_message = $this->_locale->tr("error_no_new_locales_found" );
 				return false;
 			}
 
@@ -53,21 +50,45 @@
 				$res = $locales->addLocale( $newLocaleCode );
 
 				// and create a success message
-				$successMessage .= $this->_locale->pr("locale_added_ok", $newLocaleCode)."<br/>";
+				$this->_message .= $this->_locale->pr("locale_added_ok", $newLocaleCode)."<br/>";
 			}
 
-			if( $successMessage != "" ) $this->_view->setSuccessMessage( $successMessage );
-
 			return true;
         }
 
+        /**
+         * Carries out the specified action
+         */
         function perform()
         {
-           	$result = $this->_performScanLocales();
+ 		    $this->_view = new AdminSiteLocalesListView( $this->_blogInfo );
 
-			$this->setCommonData();
+			$result = $this->_performScanLocales();
 
-            return $result;
+            if( !$result ) {
+				// set an error message
+                $this->_view->setErrorMessage( $this->_message);
+            }
+			else {
+				// or success
+				$this->_view->setSuccessMessage( $this->_message );
+			}
+
+            $this->setCommonData();
+
+            return true;
         }
+
+		function performAjax()
+		{
+			$result = $this->_performScanLocales();
+
+			$this->_view = new AdminAjaxView( $this->_blogInfo );
+
+			$this->_view->setSuccess( $result );
+			$this->_view->setMessage( $this->_message );
+
+			return( true );
+		}
     }
 ?>

Modified: plog/trunk/class/locale/locales.class.php
===================================================================
--- plog/trunk/class/locale/locales.class.php	2008-03-15 10:14:24 UTC (rev 6235)
+++ plog/trunk/class/locale/locales.class.php	2008-03-15 11:04:42 UTC (rev 6236)
@@ -362,10 +362,13 @@
             if( $this->isValidLocale( $localeCode ))
             	return true;
 
+            // make sure that the blog locale file exists and can be read and give up if not so
             $fileName = $this->getLocaleFilename( $localeCode );
+            if( !File::isReadable( $fileName ))
+            	return false;
 
-            // make sure that the file exists and can be read and
-            // give up if not so
+            // make sure that the admin locale file exists and can be read and give up if not so
+			$fileName = $this->getAdminLocaleFilename( $localeCode );
             if( !File::isReadable( $fileName ))
             	return false;
 

Modified: plog/trunk/config/config.properties.php
===================================================================
--- plog/trunk/config/config.properties.php	2008-03-15 10:14:24 UTC (rev 6235)
+++ plog/trunk/config/config.properties.php	2008-03-15 11:04:42 UTC (rev 6236)
@@ -26,10 +26,10 @@
 #   (note, if upgrading between minor releases:
 #   1.0 to 1.0.1, etc. you shouldn't run the wizard)
 
-$config['db_host'] = '';
-$config['db_username'] = '';
+$config['db_host'] = 'localhost';
+$config['db_username'] = 'root';
 $config['db_password'] = '';
-$config['db_database'] = '';
+$config['db_database'] = 'lifetype20';
 $config['db_driver'] = '';
 $config["db_persistent"] = true;
 $config['db_character_set'] = '';
@@ -41,7 +41,7 @@
 # coexist in the same unique database. If you change this after the initial configuration done
 # with the installation wizard, please make sure that you also rename the tables.
 #
-$config['db_prefix'] = '';
+$config['db_prefix'] = 'lt_';
 
 #
 # This array is used to pass driver-specific parameters. Currently the only supported

Modified: plog/trunk/templates/admin/sitelocales.template
===================================================================
--- plog/trunk/templates/admin/sitelocales.template	2008-03-15 10:14:24 UTC (rev 6235)
+++ plog/trunk/templates/admin/sitelocales.template	2008-03-15 11:04:42 UTC (rev 6236)
@@ -8,7 +8,7 @@
   </div>
   <div id="list_action_bar">
     {check_perms adminperm=add_locale}
-      <input type="submit" name="scanLocales" value="{$locale->tr("scan_locales")}" />
+      <input type="button" name="scanLocales" value="{$locale->tr("scan_locales")}" onClick="Lifetype.Forms.performUrl('?op=scanLocales');return(false)"/>
     {/check_perms}  
     {check_perms adminperm=update_locale}
       <input type="submit" name="delete" value="{$locale->tr("delete")}" class="submit" />



More information about the pLog-svn mailing list