From 686e5021a4def89b7cbd984de5f707151e7b2e48 Mon Sep 17 00:00:00 2001
From: Lahmizzar Muinela <lahmizzar@devxive.com>
Date: Wed, 24 Apr 2013 15:33:45 -0400
Subject: [PATCH] added new installer
---
installer/language/de-DE/de-DE.pkg_projectfork_languages.ini | 15 +++++++
installer/install.html | 0
install.script.php | 54 ++++++++++++++++++++++----
installer/style.css | 0
installer/language/en-GB/en-GB.pkg_projectfork_languages.ini | 15 +++++++
pkg_projectfork_languages.xml | 2
6 files changed, 76 insertions(+), 10 deletions(-)
diff --git a/install.script.php b/install.script.php
index 5e40173..dff2045 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) 2006 - 2013 Projectfork Translation Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link http://www.projectfork.net
**/
@@ -22,6 +22,10 @@
}
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();
@@ -29,18 +33,41 @@
// Do not install if Projectfork 4 doesn't exist.
$table = JTable::getInstance('extension');
$id = $table->find(array('type'=>'component', 'element'=>'com_projectfork'));
- if(!$id) {
- $app->enqueueMessage(sprintf ( 'Projectfork %s has not been installed, aborting!', '4.x' ), 'notice');
+ if($id) {
+ $app->enqueueMessage(sprintf(JText::_('PKG_PROJECTFORK_LANGUAGES_PFNOTINSTALLED'), '4.x'), 'error');
+
+ $nopf_installed = '
+ <div style="display: inline-block;">
+ <div style="background: url(https://projectfork.net/templates/hydra/img/logo.png) no-repeat 50% 50% #698C00; height: 63px; width: 205px; border: 6px solid #567300; padding: 10px; border-top-left-radius: 5px; border-bottom-left-radius: 5px; float: left;"></div>
+ <div onclick="PFInstaller()" style="background-color: #698C00; cursor: pointer; height: 63px; border-width: 6px; border-style: solid; border-color: #567300; border-left: 0px; padding: 10px; color: white; font-size: 25px; line-height: 60px; float: left; text-indent: 0; text-align: center;">' . JText::_('PKG_PROJECTFORK_LANGUAGES_INSTALLNOW') . '</div>
+ <div onclick="PFDownload()" style="background-color: #42A9CA; cursor: pointer; height: 63px; border: 6px solid #2E88A5; padding: 10px; color: white; font-size: 25px; line-height: 60px; float: left; text-indent: 0; text-align: center;">' . JText::_('PKG_PROJECTFORK_LANGUAGES_DOWNLOAD_COMMUNITY') . '</div>
+ <div onclick="PFOrderPro()" style="background-color: #F7A700; cursor: pointer; height: 63px; border: 6px solid #BE8100; padding: 10px; color: white; font-size: 25px; line-height: 60px; float: left; text-indent: 0; text-align: center; border-top-right-radius: 5px; border-bottom-right-radius: 5px;">' . JText::_('PKG_PROJECTFORK_LANGUAGES_ORDER_PRO') . '</div>
+ </div>
+ <script type="text/javascript">
+ PFInstaller = function(pressbutton) {
+ var form = document.getElementById("adminForm");
+ form.install_url.value = "https://projectfork.net/downloads/projectfork-4/projectfork-4-4-0-0/pkgprojectfork4-0-0-zip?format=raw";
+ Joomla.submitbutton4();
+ }
+ PFDownload = function(pressbutton) {
+ window.open("https://projectfork.net","_blank");
+ }
+ PFOrderPro = function(pressbutton) {
+ window.open("https://projectfork.net/pro","_blank");
+ }
+ </script>
+ ';
+ $app->enqueueMessage($nopf_installed, 'notice');
return false;
}
-
- // TODO: Check installed version of PF4 and translations, give hints and tipps to do everything right!
// 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 = '<div style="inline-block;"><ul>';
+
foreach ($languages as $language) {
$search = JFolder::folders($source, $language['tag']); // no .zip files use "folders" instead
if (empty($search)) continue;
@@ -49,17 +76,26 @@
$file = $files->addChild('file', array_pop($search));
$file->addAttribute('type', 'file');
$file->addAttribute('id', $this->name . '_' . $language['tag']);
- echo sprintf('<b>Installing detected language:</b> %s - %s ...', $language['tag'], $language['name']);
+ $installed_langs_html .= '<li>' . sprintf('<b>%s - %s</b>', $language['tag'], $language['name']);
if(in_array($language['tag'], $this->uncomplete_lang)) {
- echo ' <span style="color: darkorange;">(This language is not full translated at this moment. Please visit our <a href="https://github.com/projectfork/Translations/wiki" target="_blank">Projectfork Translations - Project Site</a> for more Informations and how to contribute!)';
+ $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>') . ')';
}
- echo '<br />';
+ $installed_langs_html .= '</li>';
}
+ $installed_langs_html .= '</ul></div>';
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 an other Projectfork Language! If you want to install a different language, you have to install a different core language first!' ), 'notice');
+ $app->enqueueMessage(sprintf(JText::_('PKG_PROJECTFORK_LANGUAGES_ENGLISH_ONLY')), 'notice');
return false;
+ } else {
+ // Override XML-DIV-NOPF-Installer-Placeholder if PF is installed
+ $success_html_output = '<div style="display: inline-block; margin-bottom: 25px;">';
+ $success_html_output .= '<div style="background: url(https://projectfork.net/templates/hydra/img/logo.png) no-repeat 50% 50% #698C00; height: 63px; width: 205px; border: 6px solid #567300; padding: 10px; border-top-left-radius: 5px; border-bottom-left-radius: 5px; float: left;"></div>';
+ $success_html_output .= '<div style="background-color: #698C00; height: 63px; border-width: 6px; border-style: solid; border-color: #567300; border-left: 0px; padding: 10px; color: white; font-size: 25px; line-height: 60px; float: left; text-indent: 0; text-align: center; border-top-right-radius: 5px; border-bottom-right-radius: 5px;">' . JText::_('PKG_PROJECTFORK_LANGUAGES_INSTALLED_DETECTED') . '</div>';
+ $success_html_output .= '</div>';
+ echo $success_html_output;
+ echo $installed_langs_html;
}
return true;
diff --git a/installer/install.html b/installer/install.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/installer/install.html
diff --git a/installer/language/de-DE/de-DE.pkg_projectfork_languages.ini b/installer/language/de-DE/de-DE.pkg_projectfork_languages.ini
new file mode 100644
index 0000000..1767bc1
--- /dev/null
+++ b/installer/language/de-DE/de-DE.pkg_projectfork_languages.ini
@@ -0,0 +1,15 @@
+; @file $Id: de-DE.install_override.ini 201 2013-01-14 14:44:15Z lahmizzar $
+; @copyright Copyright (C) 1997 - 2012 devXive - research and development (http://www.devxive.com)
+; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
+; @note All ini files need to be saved as UTF-8 - No BOM
+
+PKG_PROJECTFORK_LANGUAGES_XML_DESC = "Sprachpaket für Projectfork 4, eine Project Management Erweiterung für Joomla!"
+PKG_PROJECTFORK_LANGUAGES_PFNOTINSTALLED = "Projectfork %s wurde nicht gefunden!"
+PKG_PROJECTFORK_LANGUAGES_PFLASTINSTALLCHECK = "Bitte die folgenden Installationsschritte prüfen um sicher zu stellen, dass die Installation fehlerfrei durchgeführt wurde."
+JLIB_INSTALLER_ABORT_PACKAGE_INSTALL_CUSTOM_INSTALL_FAILURE = "Die Installation der Projectfork Sprachpakete wurde abgebrochen. Um fortzufahren, muss Projectfork installiert sein!"
+PKG_PROJECTFORK_LANGUAGES_INSTALLNOW = "Jetzt installieren!"
+PKG_PROJECTFORK_LANGUAGES_DOWNLOAD_COMMUNITY = "Community-Version herunterladen!"
+PKG_PROJECTFORK_LANGUAGES_ORDER_PRO = "Pro-Version bestellen!"
+PKG_PROJECTFORK_LANGUAGES_NOTFULL_TRANSLATED = "Dieses Sprachpaket ist derzeit nicht vollstündig �bersetzt. Bitte besuchen sie unser %s für weitere Informationen und wie Sie sich daran beteiligen künnen!"
+PKG_PROJECTFORK_LANGUAGES_ENGLISH_ONLY = "Your site is English only. There is no need to install an other Projectfork Language! If you want to install a different language, you have to install a different core language first!"
+PKG_PROJECTFORK_LANGUAGES_INSTALLED_DETECTED = "Installiere erkannte Sprachen:"
\ No newline at end of file
diff --git a/installer/language/en-GB/en-GB.pkg_projectfork_languages.ini b/installer/language/en-GB/en-GB.pkg_projectfork_languages.ini
new file mode 100644
index 0000000..47a1287
--- /dev/null
+++ b/installer/language/en-GB/en-GB.pkg_projectfork_languages.ini
@@ -0,0 +1,15 @@
+; @file $Id: de-DE.install_override.ini 201 2013-01-14 14:44:15Z lahmizzar $
+; @copyright Copyright (C) 1997 - 2012 devXive - research and development (http://www.devxive.com)
+; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
+; @note All ini files need to be saved as UTF-8 - No BOM
+
+PKG_PROJECTFORK_LANGUAGES_XML_DESC = "Language Pack for Projectfork 4, a Project Management extension for Joomla!"
+PKG_PROJECTFORK_LANGUAGES_PFNOTINSTALLED = "Projectfork %s not found!"
+PKG_PROJECTFORK_LANGUAGES_PFLASTINSTALLCHECK = "To ensure that the installation was performed correctly, please check the following installation steps."
+JLIB_INSTALLER_ABORT_PACKAGE_INSTALL_CUSTOM_INSTALL_FAILURE = "The installation of the Projectfork Language-Package has been aborted. Please install Projectfork first!"
+PKG_PROJECTFORK_LANGUAGES_INSTALLNOW = "Install Now!"
+PKG_PROJECTFORK_LANGUAGES_DOWNLOAD_COMMUNITY = "Download Community!"
+PKG_PROJECTFORK_LANGUAGES_ORDER_PRO = "Order Pro!"
+PKG_PROJECTFORK_LANGUAGES_NOTFULL_TRANSLATED = "This language is not full translated at this moment. Please visit our %s for more Informations and how to contribute to your language!"
+PKG_PROJECTFORK_LANGUAGES_ENGLISH_ONLY = "Your site is English only. There\'s no need to install an other Projectfork Language! If you want to install a different language, you have to install a different core language first!"
+PKG_PROJECTFORK_LANGUAGES_INSTALLED_DETECTED = "Installed detected languages:"
\ No newline at end of file
diff --git a/installer/style.css b/installer/style.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/installer/style.css
diff --git a/pkg_projectfork_languages.xml b/pkg_projectfork_languages.xml
index 45382e2..f6845e9 100644
--- a/pkg_projectfork_languages.xml
+++ b/pkg_projectfork_languages.xml
@@ -10,7 +10,7 @@
<version>4.0.0</version>
<updateable>fullupdate</updateable>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
- <description>Language Pack for Projectfork 4, a Project Management extension for Joomla!</description>
+ <description></description>
<scriptfile>install.script.php</scriptfile>
<files folder="languages">
--
Gitblit v1.9.1