From e28c8b54bee96a970f4cccdcace04eb7f80b40aa Mon Sep 17 00:00:00 2001
From: Lahmizzar Muinela <lahmizzar@devxive.com>
Date: Thu, 25 Apr 2013 06:47:25 -0400
Subject: [PATCH] changed copyright info

---
 install.script.php |   41 ++++++++++++++++++++++++++++-------------
 1 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/install.script.php b/install.script.php
index cca5ba7..5feb97b 100644
--- a/install.script.php
+++ b/install.script.php
@@ -3,7 +3,7 @@
  * @package Projectfork
  * @subpackage Projectfork.Translations.Installer
  *
- * @copyright (C) 2006 - 2013 Projectfork Team. All rights reserved.
+ * @copyright (C) 2012 - 2013 Projectfork Translation Team. All rights reserved.
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
  * @link http://www.projectfork.net
  **/
@@ -12,6 +12,7 @@
 class pkg_projectfork_languagesInstallerScript {
 	
 	protected $name = 'lang_pf4';
+	protected $uncomplete_lang = array("cs-CZ", "da-DK", "fa-IR", "fi-FI", "pt-PT", "sk-SK", "zh-TW", "ru-PO");
 	
 	public function uninstall($parent) {
 		$languages = JFactory::getLanguage()->getKnownLanguages();
@@ -21,38 +22,52 @@
 	}
 	
 	public function preflight($type, $parent) {
+		$lang = JFactory::getLanguage();
+		$lang->load('pkg_projectfork_languages', dirname(__FILE__) . '/installer', 'en-GB', true);
+		$lang->load('pkg_projectfork_languages', dirname(__FILE__) . '/installer', $lang->getTag(), true);
+		
 		if (!in_array($type, array('install', 'update'))) return true;
 		
 		$app = JFactory::getApplication();
 		
 		// Do not install if Projectfork 4 doesn't exist.
-//		if (!defined('PF_FRAMEWORK')) {
-//			$app->enqueueMessage(sprintf ( 'Projectfork %s has not been installed, aborting!', '4.x' ), 'notice');
-//			return false;
-//		}
-		
-			// Check the installed version of PF4 and the translation, give hints and tipps to do everything right!
+		$table = JTable::getInstance('extension');
+		$id = $table->find(array('type'=>'component', 'element'=>'com_projectfork'));
+		if(!$id) {
+			$app->enqueueMessage(sprintf(JText::_('PKG_PROJECTFORK_LANGUAGES_PFNOTINSTALLED'), '4.x'), 'error');
+			return false;
+		}
 		
 		// Get list of languages to be installed. Only installs languages that are found in your system.
 		$source = $parent->getParent()->getPath('source').'/languages';
 		$languages = JFactory::getLanguage()->getKnownLanguages();
 		
 		$files = $parent->manifest->files;
+		$installed_langs_html = '<ul>';
+		
 		foreach ($languages as $language) {
 			$search = JFolder::folders($source, $language['tag']); // no .zip files use "folders" instead
 			if (empty($search)) continue;
 			
-			// Generate something like <file type="file" client="site" id="com_kunena_fi-FI">com_kunena_fi-FI_v2.0.0.zip</file>
+			// Generate something like <file type="file" id="lang_pf4_en-GB">en-GB</file>
 			$file = $files->addChild('file', array_pop($search));
 			$file->addAttribute('type', 'file');
-			$file->addAttribute('id', $this->name.'_'.$language['tag']);
-			echo sprintf('Installing language %s - %s ...', $language['tag'], $language['name']) . '<br />';
+			$file->addAttribute('id', $this->name . '_' . $language['tag']);
+			$installed_langs_html .= '<li>' . sprintf('<b>%s</b> - %s', $language['tag'], $language['name']);
+			if(in_array($language['tag'], $this->uncomplete_lang)) {
+				$installed_langs_html .= ' ... <span style="color: darkorange;">(' . sprintf(JText::_('PKG_PROJECTFORK_LANGUAGES_NOTFULL_TRANSLATED'), '<a href="https://github.com/projectfork/Translations/wiki" target="_blank">Projectfork Translations Team</a>') . ')';
+			}
+			$installed_langs_html .= '</li>';
 		}
+		$installed_langs_html .= '</ul>';
 		
 		if (empty($files)) {
-			// No packages to install: replace failure message with something that's more descriptive.
-			$app->enqueueMessage(sprintf ( 'Your site is English only. There\'s no need to install a Projectfork Language Pack!' ), 'notice');
+			// No packages to install
+			$app->enqueueMessage(sprintf(JText::_('PKG_PROJECTFORK_LANGUAGES_ENGLISH_ONLY')), 'notice');
 			return false;
+		} else {
+			// Package was installation successfull with detected languages
+			echo JText::_('PKG_PROJECTFORK_LANGUAGES_INSTALLED_DETECTED_SUCCESS') . $installed_langs_html;
 		}
 		
 		return true;
@@ -61,7 +76,7 @@
 	public function uninstallLanguage($tag, $name) {
 		$table = JTable::getInstance('extension');
 		$id = $table->find(array('type'=>'file', 'element'=>"{$this->name}_{$tag}"));
-		if (!$id) return;
+		if(!$id) return;
 		
 		$installer = new JInstaller();
 		$installer->uninstall ( 'file', $id );

--
Gitblit v1.9.1