Version Notes
# Installation
We STRONGLY recommend installing and testing the plugin in a test environment before going live. Please back up your database before installing.
Further information can be found at http://eurotext.screenstepslive.com/s/translationmanager
# Update
Only install once all ongoing projects have been completed / successfully imported.
We STRONGLY recommend installing and testing the update in a test environment before going live. Please back up your database before installing.
Further information can be found at http://eurotext.screenstepslive.com/s/translationmanager
# General terms & conditions for Eurotext AG software applications
http://eurotext.de/en/contact/terms-and-conditions/
---------------------------
## Version 3.2.13 - 2017-02-09
### IMPROVED
- Updated translation
## Version 3.2.12 - 2017-01-17
### NEW
- Complete refactoring of the source code
- Completely revamped user interface
- Magento Grid introduced to the selection dialogs
- New category tree navigation for product selection
- You can now view the selections even after exporting
- Select multiple products in a text field by comma-separated SKU lists
- New: email templates from the database can now be translated as well
- Enhanced compatibility with third-party plugins and processes
- Improved performance and stability when exporting and importing
- The debug mode has been revised and updated with options to retain export packages on the server when they cannot be sent to Eurotext
- Improved checks and enhanced compatibility when creating zip files
- New: If an export fails, the untransferred ZIP file is copied to var/export/
- Enhanced checks of various system components (rights, directories, modules) to guarantee the stability of the plugin.
- Improved behavior when importing translations into source-language content that has already been deleted, including lists of non-imported content in import dialog and logging.
- Completely revised documentation (http://eurotext.screenstepslive.com/s/translationmanager/m/translationmanager-magento19)
### FIXED
- Image labels were not being exported
- Fixed a rights administration bug which occurred after updating to Magento 1.14 EE/1.9 CE
- Language files were being exported from the wrong source language
- The language file of custom themes (translate.csv) was not being exported
- General improvements to the export format
- General improvements to user registration
- General improvements to ZIP file creation
- Improved security for database write access
- Improved logging in standard mode and debug mode
### REMOVED
- Removed the feature to automatically export untranslated content
## Version 1.1.2.2
### NEW
- Translate your custom category attributes: export your custom attributes
## Version 1.1.2.1
### FIXED
- Duplicate URL key error during import fixed
## Version 1.1.2.0
### NEW
- Revamped DEBUG mode. Can now be activated in the back end (System -> Configuration -> Developer -> Log)
- Log file created in /var/log/eurotext.log, critical errors saved in eurotext_fatal.log even when DEBUG mode is deactivated
- Base directory changed from /eurotext to /var/eurotext
- Added logging for FTP check in DEBUG mode
### FIXED
- Various improvements to the usability of Magento directories
## Version 1.1.1.0
### FIXED
- Now only the selected language files will be exported
- Small bug fixes
## Version 1.1.0.0
### NEW
- Translate your custom product attributes: export your custom attributes
- Backup: in the event of transfer errors to the Eurotext server, data packages are saved to /var/export.
### FIXED
- Bug fixes and security updates
- Improved software performance and stability
## Version 1.0.0.9
### FIXED
- The Stock Availability will now be displayed for 'virtual' products/main products according to the setup in the back end
## Version 1.0.0.8
### NEW
- You can now filter the product selection by product type
## Version 1.0.0.7
### FIXED
- JavaScript error fixed
- The update script now works in a more tolerant manner
## Version 1.0.0.6
### NEW
- Two additional filters (status and stock availability) are now available in the product selection
- Static blocks can now be exported and imported. The static blocks are displayed with the CMS page selection
## Version 1.0.0.5
### NEW
- More project information is now displayed in the comment field of the control.xml
- The last action in a project can now be 'undone'
### FIXED
- The correct plugin version is now shown in the control.xml
## Version 1.0.0.4
### FIXED
- The module now exports attributes even if there is no name available for the source storeview. It simply exports the admin default text.
## Version 1.0.0.3
### FIXED
- The URL key will only be set in the target storeview (based on the product/category name) if there was previously no value there (i.e. "Use default values" was enabled). Previously, the URL key was set if the value was empty or equal to the default value
The "Use default values" setting is no longer lost in fields that are not present in the translation files.
## Version 1.0.0.2
### FIXED
- Imports would fail if product images, for which translations had been generated, were deleted in the Magento back end between import and export
- Product images missing from the import are now simply skipped
## Version 1.0.0.1
### NEW
- The product selection has been expanded to include an option to filter by categories, allowing for quick translations of entire categories
### FIXED
- URL fields not included in an export were being reset to their default values during import, instead of being generated based on the (translated) names
## Version 1.0.0.0
- Release Version 1.0.0.0
Release Info
Developer | Eurotext AG |
Extension | eurotext_translationMANAGER |
Version | 3.2.13 |
Comparing to | |
See all releases |
Code changes from version 1.1.2.2 to 3.2.13
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Export/Overview.php +28 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Grid/OverwriteCheckboxRenderer.php +11 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Grid/Renderer/Checkbox.php +17 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Grid/Renderer/StoreviewWithLocale.php +18 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Import/Overview.php +36 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project.php +14 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit.php +58 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Form.php +28 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Categories.php +168 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/CmsBlock.php +104 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/CmsPage.php +108 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Emails/Note.php +16 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Grid/Massaction.php +58 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Main.php +273 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Main/Single.php +45 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Main/Uploader.php +31 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Products.php +321 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Products/CategoryTree.php +38 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Products/CategoryTreeAjax.php +25 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Products/Script.php +53 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/TransactionEmailFiles.php +155 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/TransactionEmailsDatabase.php +78 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/TranslateFiles.php +157 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tabs.php +84 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Grid.php +90 -0
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Grid/Renderer/StoreviewWithLocale.php +18 -0
- app/code/community/Eurotext/TranslationManager/Block/Projects.php +0 -158
- app/code/community/Eurotext/TranslationManager/Block/Register.php +0 -39
- app/code/community/Eurotext/TranslationManager/Block/Response/Ajax.php +27 -4
- app/code/community/Eurotext/TranslationManager/Block/Selectcategories.php +0 -139
- app/code/community/Eurotext/TranslationManager/Block/Selectcmspages.php +0 -116
- app/code/community/Eurotext/TranslationManager/Block/Selectemails.php +0 -81
- app/code/community/Eurotext/TranslationManager/Block/Selectlangfiles.php +0 -65
- app/code/community/Eurotext/TranslationManager/Block/Selectproducts.php +0 -329
- app/code/community/Eurotext/TranslationManager/Block/Settings.php +0 -34
- app/code/community/Eurotext/TranslationManager/Block/Status.php +270 -0
- app/code/community/Eurotext/TranslationManager/Block/System/Config/Form/Field/Registration/Status.php +38 -0
- app/code/community/Eurotext/TranslationManager/Block/System/Config/Form/Field/Text.php +15 -0
- app/code/community/Eurotext/TranslationManager/Exception/FtpException.php +6 -0
- app/code/community/Eurotext/TranslationManager/Helper/Category.php +24 -0
- app/code/community/Eurotext/TranslationManager/Helper/Config.php +271 -0
- app/code/community/Eurotext/TranslationManager/Helper/Data.php +82 -524
- app/code/community/Eurotext/TranslationManager/Helper/Eurotext.php +167 -228
- app/code/community/Eurotext/TranslationManager/Helper/Filesystem.php +102 -0
- app/code/community/Eurotext/TranslationManager/Helper/Project.php +35 -0
- app/code/community/Eurotext/TranslationManager/Helper/String.php +13 -0
- app/code/community/Eurotext/TranslationManager/Helper/Xml.php +29 -0
- app/code/community/Eurotext/TranslationManager/Model/Catalog/Product/Attribute/Backend/Media/OnlyStoreValues.php +12 -0
- app/code/community/Eurotext/TranslationManager/Model/Controller/Exception.php +12 -0
- app/code/community/Eurotext/TranslationManager/Model/Eav/Attribute/Label.php +11 -0
- app/code/community/Eurotext/TranslationManager/Model/Eav/Attribute/Option/Value.php +9 -0
- app/code/community/Eurotext/TranslationManager/Model/EurotextLanguages.php +146 -0
- app/code/community/Eurotext/TranslationManager/Model/Export/Project.php +300 -0
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/Attribute.php +123 -0
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/Category.php +293 -0
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/CmsBlock.php +201 -0
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/CmsPage.php +197 -0
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/CreateControlFile.php +309 -0
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/EmailDatabaseTemplates.php +167 -0
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/EmailFileTemplates.php +223 -0
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/Exporter.php +8 -0
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/FtpUpload.php +262 -0
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/LocaleCsvFiles.php +232 -0
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/Product.php +452 -0
- app/code/community/Eurotext/TranslationManager/Model/Extractor.php +60 -0
- app/code/community/Eurotext/TranslationManager/Model/Factory.php +35 -0
- app/code/community/Eurotext/TranslationManager/Model/Import/Project.php +188 -0
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/Attributes.php +78 -0
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/Categories.php +118 -0
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/CmsBlocks.php +141 -0
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/CmsPages.php +129 -0
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/CollectSkipped.php +25 -0
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/EmailTemplates.php +127 -0
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/Exception/MissingEntity.php +29 -0
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/Importer.php +16 -0
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/LocaleCsvFiles.php +171 -0
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/Product.php +335 -0
- app/code/community/Eurotext/TranslationManager/Model/Import/Queue.php +44 -0
- app/code/community/Eurotext/TranslationManager/Model/Import/Validator.php +80 -0
- app/code/community/Eurotext/TranslationManager/Model/Observer.php +268 -0
- app/code/community/Eurotext/TranslationManager/Model/ProductLoader.php +41 -0
- app/code/community/Eurotext/TranslationManager/Model/Project.php +346 -0
- app/code/community/Eurotext/TranslationManager/Model/Project/Category.php +11 -0
- app/code/community/Eurotext/TranslationManager/Model/Project/Cmsblock.php +11 -0
- app/code/community/Eurotext/TranslationManager/Model/Project/Cmspage.php +11 -0
- app/code/community/Eurotext/TranslationManager/Model/Project/Csv.php +9 -0
- app/code/community/Eurotext/TranslationManager/Model/Project/EmailtemplateDatabase.php +11 -0
- app/code/community/Eurotext/TranslationManager/Model/Project/EmailtemplateFile.php +19 -0
- app/code/community/Eurotext/TranslationManager/Model/Project/Import.php +30 -0
- app/code/community/Eurotext/TranslationManager/Model/Project/Product.php +11 -0
- app/code/community/Eurotext/TranslationManager/Model/Project/Source/Status.php +30 -0
- app/code/community/Eurotext/TranslationManager/Model/Renderer/Filesystem.php +15 -0
- app/code/community/Eurotext/TranslationManager/Model/Renderer/Filesystem/RelativeToAppDirectory.php +19 -0
- app/code/community/Eurotext/TranslationManager/Model/Renderer/Filesystem/RelativeToLocaleTemplateDirectory.php +21 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Catalog/Product/Attribute/Backend/Media/OnlyStoreValues.php +38 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Catalog/Product/Option/Title.php +26 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Catalog/Product/Option/Type/Title.php +25 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Csv/Collection.php +100 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Eav/Attribute/Label.php +9 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Eav/Attribute/Label/Collection.php +11 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Eav/Attribute/Option/Value.php +9 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Eav/Attribute/Option/Value/Collection.php +28 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Emailtemplate/Filesystem/Collection.php +41 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Filesystem/Collection.php +42 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project.php +187 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/Category.php +11 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/Category/Collection.php +12 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/Cmsblock.php +11 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/Cmsblock/Collection.php +12 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/Cmspage.php +11 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/Cmspage/Collection.php +12 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/Collection.php +12 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/Csv.php +9 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/Csv/Collection.php +9 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/EmailtemplateDatabase.php +11 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/EmailtemplateDatabase/Collection.php +11 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/EmailtemplateFile.php +9 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/EmailtemplateFile/Collection.php +10 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/Import.php +20 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/Import/Collection.php +10 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/Product.php +11 -0
- app/code/community/Eurotext/TranslationManager/Model/Resource/Project/Product/Collection.php +10 -0
- app/code/community/Eurotext/TranslationManager/Model/Source/StoreViewWithLocale.php +29 -0
- app/code/community/Eurotext/TranslationManager/Model/System/Config/Source/Salutation.php +17 -0
- app/code/community/Eurotext/TranslationManager/Model/Updater/MediaGalleryValue.php +22 -0
- app/code/community/Eurotext/TranslationManager/Model/Xml/Import/Cms/Block.php +6 -0
- app/code/community/Eurotext/TranslationManager/Model/Xml/Import/Cms/BlockReader.php +63 -0
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/HelpController.php +18 -0
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/Project/ExportController.php +67 -0
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/Project/ImportController.php +387 -0
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/ProjectController.php +462 -0
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/StatusController.php +36 -0
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/Translationmanager/HelpController.php +0 -17
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/Translationmanager/ProjectsController.php +0 -3240
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/Translationmanager/RegisterController.php +0 -230
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/Translationmanager/SelectcategoriesController.php +0 -134
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/Translationmanager/SelectcmspagesController.php +0 -123
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/Translationmanager/SelectemailsController.php +0 -88
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/Translationmanager/SelectlangfilesController.php +0 -89
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/Translationmanager/SelectproductsController.php +0 -224
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/Translationmanager/SettingsController.php +0 -72
- app/code/community/Eurotext/TranslationManager/data/eurotext_translationmanager_setup/data-install-3.0.0.php +5 -0
- app/code/community/Eurotext/TranslationManager/data/eurotext_translationmanager_setup/data-upgrade-1.2.0.4-1.2.1.php +17 -0
- app/code/community/Eurotext/TranslationManager/data/eurotext_translationmanager_setup/data-upgrade-1.2.1-1.2.2.php +28 -0
- app/code/community/Eurotext/TranslationManager/data/eurotext_translationmanager_setup/data-upgrade-3.1.1-3.1.2.php +29 -0
- app/code/community/Eurotext/TranslationManager/etc/adminhtml.xml +25 -16
- app/code/community/Eurotext/TranslationManager/etc/config.xml +104 -20
- app/code/community/Eurotext/TranslationManager/etc/jstranslator.xml +31 -19
- app/code/community/Eurotext/TranslationManager/etc/system.xml +249 -3
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/install-3.0.0.php +455 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-1.1.2.1-1.2.0.0.php +58 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-1.2.0.0-1.2.0.1.php +41 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-1.2.0.1-1.2.0.2.php +40 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-1.2.0.2-1.2.0.3.php +62 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-1.2.1-1.2.2.php +17 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-1.2.2-2.0.0.php +18 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-2.0.0-2.0.1.php +18 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-2.0.1-2.0.2.php +20 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-2.0.10-3.0.0.php +85 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-2.0.3-2.0.4.php +11 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-2.0.4-2.0.5.php +11 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-2.0.5-2.0.6.php +27 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-2.0.6-2.0.7.php +26 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-2.0.7-2.0.8.php +18 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-2.0.8-2.0.9.php +20 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-2.0.9-2.0.10.php +13 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-3.0.0-3.0.1.php +34 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-3.0.1-3.0.2.php +10 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-3.0.2-3.1.1.php +23 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-3.1.5-3.1.6.php +19 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-3.1.6-3.1.7.php +14 -0
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-3.1.7-3.1.8.php +60 -0
- app/code/community/Eurotext/Uploader/Block/Abstract.php +234 -0
- app/code/community/Eurotext/Uploader/Block/Single.php +28 -0
- app/code/community/Eurotext/Uploader/Helper/Data.php +6 -0
- app/code/community/Eurotext/Uploader/Helper/File.php +728 -0
- app/code/community/Eurotext/Uploader/Model/Config/Abstract.php +50 -0
- app/code/community/Eurotext/Uploader/Model/Config/Browsebutton.php +39 -0
- app/code/community/Eurotext/Uploader/Model/Config/Misc.php +21 -0
- app/code/community/Eurotext/Uploader/Model/Config/Uploader.php +97 -0
- app/code/community/Eurotext/Uploader/etc/config.xml +25 -0
- app/code/community/Eurotext/Uploader/etc/jstranslator.xml +19 -0
- app/design/adminhtml/base/default/layout/eurotext/translationmanager.xml +250 -83
- app/design/adminhtml/base/default/template/eurotext/translationmanager/export/overview.phtml +16 -0
- app/design/adminhtml/base/default/template/eurotext/translationmanager/help.phtml +84 -84
- app/design/adminhtml/base/default/template/eurotext/translationmanager/import/overview.phtml +63 -0
- app/design/adminhtml/base/default/template/eurotext/translationmanager/project/email/note.phtml +22 -0
- app/design/adminhtml/base/default/template/eurotext/translationmanager/project/products/bulk_sku.phtml +9 -0
- app/design/adminhtml/base/default/template/eurotext/translationmanager/project/products/category_tree.phtml +157 -0
- app/design/adminhtml/base/default/template/eurotext/translationmanager/project/products/script.phtml +9 -0
- app/design/adminhtml/base/default/template/eurotext/translationmanager/projects.phtml +0 -392
- app/design/adminhtml/base/default/template/eurotext/translationmanager/register.phtml +0 -344
- app/design/adminhtml/base/default/template/eurotext/translationmanager/selectcategories.phtml +0 -130
- app/design/adminhtml/base/default/template/eurotext/translationmanager/selectcmspages.phtml +0 -169
- app/design/adminhtml/base/default/template/eurotext/translationmanager/selectemails.phtml +0 -113
- app/design/adminhtml/base/default/template/eurotext/translationmanager/selectlangfiles.phtml +0 -129
- app/design/adminhtml/base/default/template/eurotext/translationmanager/selectproducts.phtml +0 -351
- app/design/adminhtml/base/default/template/eurotext/translationmanager/settings.phtml +0 -202
- app/etc/modules/Eurotext_TranslationManager.xml +4 -2
- app/locale/de_DE/Eurotext_TranslationManager.csv +181 -221
- app/locale/de_DE/Eurotext_Uploader.csv +10 -0
- app/locale/en_US/Eurotext_TranslationManager.csv +169 -214
- app/locale/en_US/Eurotext_Uploader.csv +10 -0
- js/eurotext/uploader/flow.min.js +2 -0
- js/eurotext/uploader/fusty-flow-factory.js +14 -0
- js/eurotext/uploader/fusty-flow.js +429 -0
- js/eurotext/uploader/instance.js +509 -0
- package.xml +132 -83
- skin/adminhtml/base/default/eurotext/translationmanager/css/help.css +17 -0
- skin/adminhtml/base/default/eurotext/translationmanager/css/project.css +133 -0
- skin/adminhtml/base/default/eurotext/translationmanager/css/status.css +22 -0
- skin/adminhtml/base/default/eurotext/translationmanager/css/styles.css +0 -206
- skin/adminhtml/base/default/eurotext/translationmanager/js/eurotext-jquery-1.9.1.js +0 -404
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Export_Overview extends Mage_Adminhtml_Block_Template
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @return int
|
7 |
+
*/
|
8 |
+
public function getProjectId()
|
9 |
+
{
|
10 |
+
return Mage::registry('project')->getId();
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function getExportUrl()
|
17 |
+
{
|
18 |
+
return $this->getUrl('*/eurotext_project_export/export');
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function getSuccessUrl()
|
25 |
+
{
|
26 |
+
return $this->getUrl('*/eurotext_project/edit', ['project_id' => $this->getProjectId()]);
|
27 |
+
}
|
28 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
trait Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Grid_OverwriteCheckboxRenderer
|
4 |
+
{
|
5 |
+
public function getColumnRenderers()
|
6 |
+
{
|
7 |
+
return [
|
8 |
+
'checkbox' => 'eurotext_translationmanager/adminhtml_eurotext_grid_renderer_checkbox',
|
9 |
+
];
|
10 |
+
}
|
11 |
+
}
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Grid_Renderer_Checkbox
|
4 |
+
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Checkbox
|
5 |
+
{
|
6 |
+
public function getDisabled()
|
7 |
+
{
|
8 |
+
/** @var $project Eurotext_TranslationManager_Model_Project */
|
9 |
+
$project = Mage::registry('project');
|
10 |
+
|
11 |
+
if (!$project->isEditable()) {
|
12 |
+
return 'disabled="disabled"';
|
13 |
+
}
|
14 |
+
|
15 |
+
return '';
|
16 |
+
}
|
17 |
+
}
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Grid_Renderer_StoreviewWithLocale extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
4 |
+
{
|
5 |
+
public function render(Varien_Object $row)
|
6 |
+
{
|
7 |
+
$storeId = $row->getData($this->getColumn()->getIndex());
|
8 |
+
try {
|
9 |
+
$store = Mage::app()->getStore($storeId);
|
10 |
+
|
11 |
+
return sprintf('%s (%s)', $store->getName(), Mage::getStoreConfig('general/locale/code', $store));
|
12 |
+
} catch (Mage_Core_Model_Store_Exception $e) {
|
13 |
+
// store not found (happens if $storeId = -1)
|
14 |
+
}
|
15 |
+
|
16 |
+
return '';
|
17 |
+
}
|
18 |
+
}
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Import_Overview extends Mage_Adminhtml_Block_Template
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @return int
|
7 |
+
*/
|
8 |
+
public function getProjectId()
|
9 |
+
{
|
10 |
+
return Mage::registry('project')->getId();
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function getSuccessUrl()
|
17 |
+
{
|
18 |
+
return $this->getUrl('*/eurotext_project/edit', ['project_id' => $this->getProjectId()]);
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function getAddFilesToImportQueueUrl()
|
25 |
+
{
|
26 |
+
return $this->getUrl('*/*/addFilesToImportQueue');
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
public function getProcessFilesFromQueueUrl()
|
33 |
+
{
|
34 |
+
return $this->getUrl('*/*/processFilesFromQueue');
|
35 |
+
}
|
36 |
+
}
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project
|
4 |
+
extends Mage_Adminhtml_Block_Widget_Grid_Container
|
5 |
+
{
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
$this->_blockGroup = 'eurotext_translationmanager';
|
9 |
+
$this->_controller = 'adminhtml_eurotext_project';
|
10 |
+
$this->_headerText = $this->__('Projects');
|
11 |
+
|
12 |
+
parent::__construct();
|
13 |
+
}
|
14 |
+
}
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit
|
4 |
+
extends Mage_Adminhtml_Block_Widget_Form_Container
|
5 |
+
{
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
/** @var $project Eurotext_TranslationManager_Model_Project */
|
9 |
+
$project = Mage::registry('project');
|
10 |
+
$this->_objectId = 'project_id';
|
11 |
+
|
12 |
+
parent::__construct();
|
13 |
+
|
14 |
+
$this->_controller = 'adminhtml_eurotext_project';
|
15 |
+
$this->_blockGroup = 'eurotext_translationmanager';
|
16 |
+
|
17 |
+
$this->_updateButton('save', 'label', Mage::helper('eurotext_translationmanager')->__('Save Project'));
|
18 |
+
|
19 |
+
$projectId = $project->getId();
|
20 |
+
|
21 |
+
$exportUrl = $this->getUrl('*/eurotext_project_export', ['project_id' => $projectId]);
|
22 |
+
if (!$project->isObjectNew()) {
|
23 |
+
$this->_addButton(
|
24 |
+
'export',
|
25 |
+
[
|
26 |
+
'label' => $this->__('Export to Eurotext AG'),
|
27 |
+
'onclick' => "setLocation('$exportUrl')",
|
28 |
+
'class' => 'go export',
|
29 |
+
'id' => 'export_button'
|
30 |
+
]
|
31 |
+
);
|
32 |
+
}
|
33 |
+
|
34 |
+
if (!$project->isEditable()) {
|
35 |
+
$this->_removeButton('save');
|
36 |
+
$this->_removeButton('export');
|
37 |
+
$this->_removeButton('reset');
|
38 |
+
|
39 |
+
$url = $this->getUrl('*/eurotext_project/reset', ['project_id' => $projectId]);
|
40 |
+
$this->_addButton(
|
41 |
+
'step_back',
|
42 |
+
[
|
43 |
+
'label' => $this->__('Reset to last status'),
|
44 |
+
'onclick' => "setLocation('$url');",
|
45 |
+
'class' => 'cancel'
|
46 |
+
]
|
47 |
+
);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @return string
|
53 |
+
*/
|
54 |
+
public function getHeaderText()
|
55 |
+
{
|
56 |
+
return Mage::helper('eurotext_translationmanager')->__('New project');
|
57 |
+
}
|
58 |
+
}
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('edit_form');
|
10 |
+
$this->setTitle($this->__('Project Information'));
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _prepareForm()
|
14 |
+
{
|
15 |
+
$form = new Varien_Data_Form(
|
16 |
+
[
|
17 |
+
'id' => 'edit_form',
|
18 |
+
'action' => $this->getUrl('*/*/save'),
|
19 |
+
'method' => 'post',
|
20 |
+
'enctype' => 'multipart/form-data'
|
21 |
+
]
|
22 |
+
);
|
23 |
+
$form->setUseContainer(true);
|
24 |
+
$this->setForm($form);
|
25 |
+
|
26 |
+
return parent::_prepareForm();
|
27 |
+
}
|
28 |
+
}
|
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method int[] getSelectedCategories()
|
5 |
+
* @method setSelectedCategories(int[] $ids)
|
6 |
+
* @method setUseAjax(boolean $useAjax)
|
7 |
+
*/
|
8 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Categories
|
9 |
+
extends Mage_Adminhtml_Block_Widget_Grid
|
10 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
11 |
+
{
|
12 |
+
use Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Grid_OverwriteCheckboxRenderer;
|
13 |
+
|
14 |
+
public function __construct(array $attributes)
|
15 |
+
{
|
16 |
+
parent::__construct($attributes);
|
17 |
+
$this->setId('categoryGrid');
|
18 |
+
$this->setDefaultSort('entity_id');
|
19 |
+
$this->setDefaultDir('DESC');
|
20 |
+
$this->setSaveParametersInSession(true);
|
21 |
+
$this->setUseAjax(true);
|
22 |
+
$this->setVarNameFilter('category_filter');
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function _prepareCollection()
|
26 |
+
{
|
27 |
+
$collection = Mage::getResourceModel('catalog/category_collection');
|
28 |
+
$collection->addAttributeToSelect(['name', 'is_active']);
|
29 |
+
$collection->addFieldToFilter('path', ['neq' => '1']);
|
30 |
+
$collection->setLoadProductCount(true);
|
31 |
+
$this->setCollection($collection);
|
32 |
+
|
33 |
+
return parent::_prepareCollection();
|
34 |
+
}
|
35 |
+
|
36 |
+
protected function _prepareColumns()
|
37 |
+
{
|
38 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
39 |
+
$project = Mage::registry('project');
|
40 |
+
|
41 |
+
$this->addColumn(
|
42 |
+
'categories',
|
43 |
+
[
|
44 |
+
'header_css_class' => 'a-center',
|
45 |
+
'type' => 'checkbox',
|
46 |
+
'name' => 'categories',
|
47 |
+
'values' => $this->_getSelectedCategories(),
|
48 |
+
'align' => 'center',
|
49 |
+
'index' => 'entity_id',
|
50 |
+
'use_index' => true,
|
51 |
+
'filter' => false,
|
52 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : ''
|
53 |
+
]
|
54 |
+
);
|
55 |
+
|
56 |
+
$this->addColumn(
|
57 |
+
'entity_id',
|
58 |
+
[
|
59 |
+
'header' => $this->__('ID'),
|
60 |
+
'width' => '50px',
|
61 |
+
'type' => 'number',
|
62 |
+
'index' => 'entity_id',
|
63 |
+
]
|
64 |
+
);
|
65 |
+
|
66 |
+
$this->addColumn(
|
67 |
+
'name',
|
68 |
+
[
|
69 |
+
'header' => $this->__('Name'),
|
70 |
+
'index' => 'name',
|
71 |
+
]
|
72 |
+
);
|
73 |
+
|
74 |
+
$sourceBoolean = Mage::getSingleton('eav/entity_attribute_source_boolean');
|
75 |
+
$this->addColumn(
|
76 |
+
'is_active',
|
77 |
+
[
|
78 |
+
'header' => $this->__('Active'),
|
79 |
+
'width' => '70px',
|
80 |
+
'index' => 'is_active',
|
81 |
+
'type' => 'options',
|
82 |
+
'options' => $sourceBoolean->getOptionArray(),
|
83 |
+
]
|
84 |
+
);
|
85 |
+
|
86 |
+
$this->addColumn(
|
87 |
+
'product_count',
|
88 |
+
[
|
89 |
+
'header' => $this->__('Product Count'),
|
90 |
+
'width' => '30px',
|
91 |
+
'index' => 'product_count',
|
92 |
+
'type' => 'int',
|
93 |
+
'sortable' => false,
|
94 |
+
'filter' => false,
|
95 |
+
]
|
96 |
+
);
|
97 |
+
|
98 |
+
return parent::_prepareColumns();
|
99 |
+
}
|
100 |
+
|
101 |
+
public function _getSelectedCategories()
|
102 |
+
{
|
103 |
+
$products = $this->getSelectedCategories();
|
104 |
+
if (!is_array($products)) {
|
105 |
+
$products = $this->getSelectedCategoriesFromDatabase();
|
106 |
+
}
|
107 |
+
|
108 |
+
return $products;
|
109 |
+
}
|
110 |
+
|
111 |
+
private function getSelectedCategoriesFromDatabase()
|
112 |
+
{
|
113 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
114 |
+
$project = Mage::registry('project');
|
115 |
+
|
116 |
+
return $project->getCategories();
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* @return string
|
121 |
+
*/
|
122 |
+
public function getTabLabel()
|
123 |
+
{
|
124 |
+
return $this->__('Categories');
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* @return string
|
129 |
+
*/
|
130 |
+
public function getTabTitle()
|
131 |
+
{
|
132 |
+
return $this->getTabLabel();
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* @return boolean
|
137 |
+
*/
|
138 |
+
public function canShowTab()
|
139 |
+
{
|
140 |
+
return true;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* @return boolean
|
145 |
+
*/
|
146 |
+
public function isHidden()
|
147 |
+
{
|
148 |
+
return !$this->canShowTab();
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* @param Varien_Object $item
|
153 |
+
* @return bool
|
154 |
+
*/
|
155 |
+
public function getMultipleRows($item)
|
156 |
+
{
|
157 |
+
return false;
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* @return string
|
162 |
+
*/
|
163 |
+
public function getGridUrl()
|
164 |
+
{
|
165 |
+
return $this->getUrl('*/*/categoriesgrid', ['_current' => true]);
|
166 |
+
}
|
167 |
+
|
168 |
+
}
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method setSelectedCmsBlocks(int[] $ids)
|
5 |
+
* @method int[] getSelectedCmsBlocks()
|
6 |
+
* @method setUseAjax(boolean $useAjax)
|
7 |
+
*/
|
8 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_CmsBlock
|
9 |
+
extends Mage_Adminhtml_Block_Cms_Block_Grid
|
10 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
11 |
+
{
|
12 |
+
use Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Grid_OverwriteCheckboxRenderer;
|
13 |
+
|
14 |
+
public function __construct()
|
15 |
+
{
|
16 |
+
parent::__construct();
|
17 |
+
$this->setSaveParametersInSession(true);
|
18 |
+
$this->setUseAjax(true);
|
19 |
+
$this->setVarNameFilter('cmsblock_filter');
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function _prepareColumns()
|
23 |
+
{
|
24 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
25 |
+
$project = Mage::registry('project');
|
26 |
+
|
27 |
+
$this->addColumn(
|
28 |
+
'blocks',
|
29 |
+
[
|
30 |
+
'header_css_class' => 'a-center',
|
31 |
+
'type' => 'checkbox',
|
32 |
+
'name' => 'blocks',
|
33 |
+
'values' => $this->_getSelectedCmsBlocks(),
|
34 |
+
'align' => 'center',
|
35 |
+
'index' => 'block_id',
|
36 |
+
'use_index' => true,
|
37 |
+
'filter' => false,
|
38 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
39 |
+
]
|
40 |
+
);
|
41 |
+
|
42 |
+
return parent::_prepareColumns();
|
43 |
+
}
|
44 |
+
|
45 |
+
public function _getSelectedCmsBlocks()
|
46 |
+
{
|
47 |
+
$products = $this->getSelectedCmsBlocks();
|
48 |
+
if (!is_array($products)) {
|
49 |
+
$products = $this->getSelectedCmsBlocksFromDatabase();
|
50 |
+
}
|
51 |
+
|
52 |
+
return $products;
|
53 |
+
}
|
54 |
+
|
55 |
+
private function getSelectedCmsBlocksFromDatabase()
|
56 |
+
{
|
57 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
58 |
+
$project = Mage::registry('project');
|
59 |
+
|
60 |
+
return $project->getBlocks();
|
61 |
+
}
|
62 |
+
|
63 |
+
public function getGridUrl()
|
64 |
+
{
|
65 |
+
return $this->getUrl('*/*/cmsblocksgrid', ['_current' => true]);
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getRowUrl($row)
|
69 |
+
{
|
70 |
+
return null;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* @return string
|
75 |
+
*/
|
76 |
+
public function getTabLabel()
|
77 |
+
{
|
78 |
+
return $this->__('CMS Blocks');
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @return string
|
83 |
+
*/
|
84 |
+
public function getTabTitle()
|
85 |
+
{
|
86 |
+
return $this->getTabLabel();
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @return boolean
|
91 |
+
*/
|
92 |
+
public function canShowTab()
|
93 |
+
{
|
94 |
+
return true;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* @return boolean
|
99 |
+
*/
|
100 |
+
public function isHidden()
|
101 |
+
{
|
102 |
+
return !$this->canShowTab();
|
103 |
+
}
|
104 |
+
}
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method int[] getSelectedCmsPages()
|
5 |
+
* @method setSelectedCmsPages(int[] $ids)
|
6 |
+
* @method setUseAjax(boolean $useAjax)
|
7 |
+
*/
|
8 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_CmsPage
|
9 |
+
extends Mage_Adminhtml_Block_Cms_Page_Grid
|
10 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
11 |
+
{
|
12 |
+
use Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Grid_OverwriteCheckboxRenderer;
|
13 |
+
|
14 |
+
public function __construct()
|
15 |
+
{
|
16 |
+
parent::__construct();
|
17 |
+
$this->setSaveParametersInSession(true);
|
18 |
+
$this->setUseAjax(true);
|
19 |
+
$this->setVarNameFilter('cmspage_filter');
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function _prepareColumns()
|
23 |
+
{
|
24 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
25 |
+
$project = Mage::registry('project');
|
26 |
+
|
27 |
+
$this->addColumn(
|
28 |
+
'pages',
|
29 |
+
[
|
30 |
+
'header_css_class' => 'a-center',
|
31 |
+
'type' => 'checkbox',
|
32 |
+
'name' => 'pages',
|
33 |
+
'values' => $this->getSelectedCmsPages(),
|
34 |
+
'align' => 'center',
|
35 |
+
'index' => 'page_id',
|
36 |
+
'use_index' => true,
|
37 |
+
'filter' => false,
|
38 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
39 |
+
]
|
40 |
+
);
|
41 |
+
|
42 |
+
parent::_prepareColumns();
|
43 |
+
|
44 |
+
$this->removeColumn('page_actions');
|
45 |
+
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function _getSelectedCmsPages()
|
50 |
+
{
|
51 |
+
$products = $this->getSelectedCmsPages();
|
52 |
+
if (!is_array($products)) {
|
53 |
+
$products = $this->getSelectedCmsPagesFromDatabase();
|
54 |
+
}
|
55 |
+
|
56 |
+
return $products;
|
57 |
+
}
|
58 |
+
|
59 |
+
private function getSelectedCmsPagesFromDatabase()
|
60 |
+
{
|
61 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
62 |
+
$project = Mage::registry('project');
|
63 |
+
|
64 |
+
return $project->getPages();
|
65 |
+
}
|
66 |
+
|
67 |
+
public function getGridUrl()
|
68 |
+
{
|
69 |
+
return $this->getUrl('*/*/cmspagesgrid', ['_current' => true]);
|
70 |
+
}
|
71 |
+
|
72 |
+
public function getRowUrl($row)
|
73 |
+
{
|
74 |
+
return null;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* @return string
|
79 |
+
*/
|
80 |
+
public function getTabLabel()
|
81 |
+
{
|
82 |
+
return $this->__('CMS Pages');
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* @return string
|
87 |
+
*/
|
88 |
+
public function getTabTitle()
|
89 |
+
{
|
90 |
+
return $this->getTabLabel();
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* @return boolean
|
95 |
+
*/
|
96 |
+
public function canShowTab()
|
97 |
+
{
|
98 |
+
return true;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* @return boolean
|
103 |
+
*/
|
104 |
+
public function isHidden()
|
105 |
+
{
|
106 |
+
return !$this->canShowTab();
|
107 |
+
}
|
108 |
+
}
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Emails_Note
|
4 |
+
extends Mage_Adminhtml_Block_Template
|
5 |
+
{
|
6 |
+
/**
|
7 |
+
* @return string
|
8 |
+
*/
|
9 |
+
public function getLanguageFromProject()
|
10 |
+
{
|
11 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
12 |
+
$project = Mage::registry('project');
|
13 |
+
|
14 |
+
return $project->getStoreviewDstLocale();
|
15 |
+
}
|
16 |
+
}
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Grid_Massaction
|
4 |
+
extends Mage_Adminhtml_Block_Widget_Grid_Massaction
|
5 |
+
{
|
6 |
+
/**
|
7 |
+
* @return string
|
8 |
+
*/
|
9 |
+
public function getJavaScript()
|
10 |
+
{
|
11 |
+
return " {$this->getJsObjectName()} = new varienGridMassaction('{$this->getHtmlId()}', "
|
12 |
+
. "{$this->getGridJsObjectName()}, '{$this->getSelectedJson()}'"
|
13 |
+
. ", '{$this->getFormFieldNameInternal()}', '{$this->getFormFieldName()}');"
|
14 |
+
. "{$this->getJsObjectName()}.setItems({$this->getItemsJson()}); "
|
15 |
+
. "{$this->getJsObjectName()}.setGridIds('{$this->getGridIdsJson()}');"
|
16 |
+
. ($this->getUseAjax() ? "{$this->getJsObjectName()}.setUseAjax(true);" : '')
|
17 |
+
. ($this->getUseSelectAll() ? "{$this->getJsObjectName()}.setUseSelectAll(true);" : '')
|
18 |
+
. "{$this->getJsObjectName()}.errorText = '{$this->getErrorText()}';";
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Retrieve JSON string of selected checkboxes
|
23 |
+
*
|
24 |
+
* @return string
|
25 |
+
*/
|
26 |
+
public function getSelectedJson()
|
27 |
+
{
|
28 |
+
$internalField = $this->getRequest()->getParam($this->getFormFieldNameInternal());
|
29 |
+
$selected = array_merge(
|
30 |
+
is_array($internalField) ? $internalField : [],
|
31 |
+
$this->getParentBlock()->getSelected()
|
32 |
+
);
|
33 |
+
if ($selected) {
|
34 |
+
return join(',', $selected);
|
35 |
+
} else {
|
36 |
+
return '';
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Retrieve array of selected checkboxes
|
42 |
+
*
|
43 |
+
* @return array
|
44 |
+
*/
|
45 |
+
public function getSelected()
|
46 |
+
{
|
47 |
+
$internalField = $this->getRequest()->getParam($this->getFormFieldNameInternal());
|
48 |
+
$selected = $internalField . implode(',', $this->getParentBlock()->getSelected());
|
49 |
+
|
50 |
+
if ($selected) {
|
51 |
+
$selected = explode(',', $selected);
|
52 |
+
|
53 |
+
return $selected;
|
54 |
+
} else {
|
55 |
+
return [];
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method setTitle(string $title)
|
5 |
+
*/
|
6 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Main
|
7 |
+
extends Mage_Adminhtml_Block_Widget_Form
|
8 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
9 |
+
{
|
10 |
+
public function _construct()
|
11 |
+
{
|
12 |
+
parent::_construct();
|
13 |
+
$this->setId('project_id');
|
14 |
+
$this->setTitle(Mage::helper('eurotext_translationmanager')->__('Project Information'));
|
15 |
+
}
|
16 |
+
|
17 |
+
protected function _prepareForm()
|
18 |
+
{
|
19 |
+
$helper = Mage::helper('eurotext_translationmanager');
|
20 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
21 |
+
$project = Mage::registry('project');
|
22 |
+
|
23 |
+
$form = new Varien_Data_Form(
|
24 |
+
[
|
25 |
+
'id' => 'edit_form',
|
26 |
+
'action' => $this->getUrl('*/*/save'),
|
27 |
+
'method' => 'post',
|
28 |
+
]
|
29 |
+
);
|
30 |
+
|
31 |
+
$form->setHtmtIdPrefix('project_');
|
32 |
+
|
33 |
+
if ($project->isTranslationImportable()) {
|
34 |
+
$fieldset = $form->addFieldset('translation', ['legend' => $helper->__('Import translations')]);
|
35 |
+
$fieldset->addType(
|
36 |
+
'uploader',
|
37 |
+
Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Main_Uploader::class
|
38 |
+
);
|
39 |
+
$fieldset->addField(
|
40 |
+
'translation_file',
|
41 |
+
'uploader',
|
42 |
+
[
|
43 |
+
'name' => 'translation_file',
|
44 |
+
'comment' => $helper->__('Import the ZIP file containing the finished translations here.'),
|
45 |
+
'label' => $helper->__('Translation'),
|
46 |
+
'class' => 'required-entry',
|
47 |
+
]
|
48 |
+
);
|
49 |
+
}
|
50 |
+
|
51 |
+
$fieldset = $form->addFieldset('project', ['legend' => $helper->__('Project Information')]);
|
52 |
+
|
53 |
+
$fieldset->addField(
|
54 |
+
'project_name',
|
55 |
+
'text',
|
56 |
+
[
|
57 |
+
'name' => 'project_name',
|
58 |
+
'label' => $helper->__('Name'),
|
59 |
+
'class' => 'required-entry',
|
60 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
61 |
+
]
|
62 |
+
);
|
63 |
+
|
64 |
+
if (!$project->isObjectNew()) {
|
65 |
+
$fieldset->addField(
|
66 |
+
'id',
|
67 |
+
'hidden',
|
68 |
+
[
|
69 |
+
'name' => 'id',
|
70 |
+
'class' => 'required-entry',
|
71 |
+
]
|
72 |
+
);
|
73 |
+
}
|
74 |
+
|
75 |
+
$fieldset->addField(
|
76 |
+
'storeview_src',
|
77 |
+
'select',
|
78 |
+
[
|
79 |
+
'name' => 'storeview_src',
|
80 |
+
'label' => $helper->__('Source StoreView'),
|
81 |
+
'values' => Mage::getModel('eurotext_translationmanager/source_storeViewWithLocale')->toOptionArray(),
|
82 |
+
'class' => 'required-entry',
|
83 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
84 |
+
]
|
85 |
+
);
|
86 |
+
|
87 |
+
$fieldset->addField(
|
88 |
+
'storeview_dst',
|
89 |
+
'select',
|
90 |
+
[
|
91 |
+
'name' => 'storeview_dst',
|
92 |
+
'label' => $helper->__('Target StoreView'),
|
93 |
+
'values' => Mage::getModel('eurotext_translationmanager/source_storeViewWithLocale')->toOptionArray(),
|
94 |
+
'class' => 'validate-storeview-different required-entry',
|
95 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
96 |
+
]
|
97 |
+
);
|
98 |
+
|
99 |
+
$fieldset->addField(
|
100 |
+
'customer_comment',
|
101 |
+
'textarea',
|
102 |
+
[
|
103 |
+
'name' => 'customer_comment',
|
104 |
+
'label' => $helper->__('Comment'),
|
105 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
106 |
+
]
|
107 |
+
);
|
108 |
+
|
109 |
+
$fieldset = $form->addFieldset(
|
110 |
+
'exported_data',
|
111 |
+
[
|
112 |
+
'legend' => $helper->__('Exported data'),
|
113 |
+
]
|
114 |
+
);
|
115 |
+
|
116 |
+
$fieldset->addField(
|
117 |
+
'comment',
|
118 |
+
'note',
|
119 |
+
[
|
120 |
+
'text' => '<b>' . $helper->__('Only data is exported, which is not translated yet.') . '</b>',
|
121 |
+
]
|
122 |
+
);
|
123 |
+
|
124 |
+
$fieldset->addField('productmode_hidden', 'hidden', ['name' => 'productmode', 'value' => 0]);
|
125 |
+
$fieldset->addField(
|
126 |
+
'productmode',
|
127 |
+
'checkbox',
|
128 |
+
[
|
129 |
+
'name' => 'productmode',
|
130 |
+
'label' => $helper->__('Products'),
|
131 |
+
'value' => 1,
|
132 |
+
'checked' => $project->getProductmode(),
|
133 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
134 |
+
'onclick' => 'this.value = this.checked ? 1 : 0;',
|
135 |
+
]
|
136 |
+
);
|
137 |
+
|
138 |
+
$fieldset->addField('categorymode_hidden', 'hidden', ['name' => 'categorymode', 'value' => 0]);
|
139 |
+
$fieldset->addField(
|
140 |
+
'categorymode',
|
141 |
+
'checkbox',
|
142 |
+
[
|
143 |
+
'name' => 'categorymode',
|
144 |
+
'label' => $helper->__('Categories'),
|
145 |
+
'value' => 1,
|
146 |
+
'checked' => $project->getCategorymode(),
|
147 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
148 |
+
'onclick' => 'this.value = this.checked ? 1 : 0;',
|
149 |
+
]
|
150 |
+
);
|
151 |
+
|
152 |
+
$fieldset->addField('cmsmode_hidden', 'hidden', ['name' => 'cmsmode', 'value' => 0]);
|
153 |
+
$fieldset->addField(
|
154 |
+
'cmsmode',
|
155 |
+
'checkbox',
|
156 |
+
[
|
157 |
+
'name' => 'cmsmode',
|
158 |
+
'label' => $helper->__('CMS Pages and Blocks'),
|
159 |
+
'value' => 1,
|
160 |
+
'checked' => $project->getCmsmode(),
|
161 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
162 |
+
'onclick' => 'this.value = this.checked ? 1 : 0;',
|
163 |
+
]
|
164 |
+
);
|
165 |
+
|
166 |
+
$fieldset->addField('templatemode_hidden', 'hidden', ['name' => 'templatemode', 'value' => 0]);
|
167 |
+
$fieldset->addField(
|
168 |
+
'templatemode',
|
169 |
+
'checkbox',
|
170 |
+
[
|
171 |
+
'name' => 'templatemode',
|
172 |
+
'label' => $helper->__('Email Templates'),
|
173 |
+
'value' => 1,
|
174 |
+
'checked' => $project->getTemplatemode(),
|
175 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
176 |
+
'onclick' => 'this.value = this.checked ? 1 : 0;',
|
177 |
+
]
|
178 |
+
);
|
179 |
+
|
180 |
+
$fieldset->addField('langfilesmode_hidden', 'hidden', ['name' => 'langfilesmode', 'value' => 0]);
|
181 |
+
$fieldset->addField(
|
182 |
+
'langfilesmode',
|
183 |
+
'checkbox',
|
184 |
+
[
|
185 |
+
'name' => 'langfilesmode',
|
186 |
+
'label' => $helper->__('Translation files'),
|
187 |
+
'value' => 1,
|
188 |
+
'checked' => $project->getLangfilesmode(),
|
189 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
190 |
+
'onclick' => 'this.value = this.checked ? 1 : 0;',
|
191 |
+
]
|
192 |
+
);
|
193 |
+
|
194 |
+
$fieldset->addField('export_attributes_hidden', 'hidden', ['name' => 'export_attributes', 'value' => 0]);
|
195 |
+
$fieldset->addField(
|
196 |
+
'export_attributes',
|
197 |
+
'checkbox',
|
198 |
+
[
|
199 |
+
'name' => 'export_attributes',
|
200 |
+
'label' => $helper->__('Attributes and attribute options'),
|
201 |
+
'value' => 1,
|
202 |
+
'checked' => $project->getExportAttributes(),
|
203 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
204 |
+
'onclick' => 'this.value = this.checked ? 1 : 0;',
|
205 |
+
]
|
206 |
+
);
|
207 |
+
|
208 |
+
$fieldset->addField('export_urlkeys_hidden', 'hidden', ['name' => 'export_urlkeys', 'value' => 0]);
|
209 |
+
$fieldset->addField(
|
210 |
+
'export_urlkeys',
|
211 |
+
'checkbox',
|
212 |
+
[
|
213 |
+
'name' => 'export_urlkeys',
|
214 |
+
'label' => $helper->__('URL keys'),
|
215 |
+
'value' => 1,
|
216 |
+
'checked' => $project->getExportUrlkeys(),
|
217 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
218 |
+
'onclick' => 'this.value = this.checked ? 1 : 0;',
|
219 |
+
]
|
220 |
+
);
|
221 |
+
|
222 |
+
$fieldset->addField('export_seo_hidden', 'hidden', ['name' => 'export_seo', 'value' => 0]);
|
223 |
+
$fieldset->addField(
|
224 |
+
'export_seo',
|
225 |
+
'checkbox',
|
226 |
+
[
|
227 |
+
'name' => 'export_seo',
|
228 |
+
'label' => $helper->__('SEO content'),
|
229 |
+
'value' => 1,
|
230 |
+
'checked' => $project->getExportSeo(),
|
231 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
232 |
+
'onclick' => 'this.value = this.checked ? 1 : 0;',
|
233 |
+
]
|
234 |
+
);
|
235 |
+
|
236 |
+
$this->setForm($form);
|
237 |
+
$form->setValues($project->getData());
|
238 |
+
|
239 |
+
return parent::_prepareForm();
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* @return string
|
244 |
+
*/
|
245 |
+
public function getTabLabel()
|
246 |
+
{
|
247 |
+
return $this->__('Project Details');
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* @return string
|
252 |
+
*/
|
253 |
+
public function getTabTitle()
|
254 |
+
{
|
255 |
+
return $this->getTabLabel();
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* @return boolean
|
260 |
+
*/
|
261 |
+
public function canShowTab()
|
262 |
+
{
|
263 |
+
return true;
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* @return boolean
|
268 |
+
*/
|
269 |
+
public function isHidden()
|
270 |
+
{
|
271 |
+
return !$this->canShowTab();
|
272 |
+
}
|
273 |
+
}
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Main_Single
|
4 |
+
extends Eurotext_Uploader_Block_Single
|
5 |
+
{
|
6 |
+
const DEFAULT_UPLOAD_BUTTON_ID_SUFFIX = 'upload';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @return $this
|
10 |
+
*/
|
11 |
+
protected function _prepareLayout()
|
12 |
+
{
|
13 |
+
parent::_prepareLayout();
|
14 |
+
|
15 |
+
$this->setChild(
|
16 |
+
'upload_button',
|
17 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
18 |
+
->addData(
|
19 |
+
[
|
20 |
+
'id' => $this->getElementId(self::DEFAULT_UPLOAD_BUTTON_ID_SUFFIX),
|
21 |
+
'label' => Mage::helper('eurotext_uploader')->__('Upload file'),
|
22 |
+
'type' => 'button',
|
23 |
+
]
|
24 |
+
)
|
25 |
+
);
|
26 |
+
|
27 |
+
$this->_addElementIdsMapping(
|
28 |
+
[
|
29 |
+
'upload' => $this->_prepareElementsIds([self::DEFAULT_UPLOAD_BUTTON_ID_SUFFIX])
|
30 |
+
]
|
31 |
+
);
|
32 |
+
|
33 |
+
return $this;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Get upload button html
|
38 |
+
*
|
39 |
+
* @return string
|
40 |
+
*/
|
41 |
+
public function getUploadButtonHtml()
|
42 |
+
{
|
43 |
+
return $this->getChildHtml('upload_button');
|
44 |
+
}
|
45 |
+
}
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Main_Uploader
|
4 |
+
extends Varien_Data_Form_Element_Abstract
|
5 |
+
{
|
6 |
+
/**
|
7 |
+
* @return string
|
8 |
+
*/
|
9 |
+
public function getElementHtml()
|
10 |
+
{
|
11 |
+
/** @var Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Main_Single $uploader */
|
12 |
+
$uploader = Mage::app()
|
13 |
+
->getLayout()
|
14 |
+
->createBlock('eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_main_single');
|
15 |
+
|
16 |
+
/** @var $config Eurotext_Uploader_Model_Config_Uploader */
|
17 |
+
$config = $uploader->getUploaderConfig();
|
18 |
+
$config->setTarget(Mage_Adminhtml_Helper_Data::getUrl('*/eurotext_project_import/import'));
|
19 |
+
$config->setFileParameterName('translation_file');
|
20 |
+
$config->setQuery(
|
21 |
+
[
|
22 |
+
'form_key' => Mage::getSingleton('core/session')->getFormKey(),
|
23 |
+
'project_id' => Mage::registry('project')->getId(),
|
24 |
+
]
|
25 |
+
);
|
26 |
+
|
27 |
+
return $uploader->toHtml();
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
}
|
@@ -0,0 +1,321 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method int[] getSelectedProducts()
|
5 |
+
* @method setSelectedProducts(int[] $ids)
|
6 |
+
* @method Mage_Catalog_Model_Resource_Product_Collection getCollection()
|
7 |
+
* @method setSelected(int[] $ids)
|
8 |
+
*/
|
9 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Products
|
10 |
+
extends Mage_Adminhtml_Block_Catalog_Product_Grid
|
11 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
12 |
+
{
|
13 |
+
use Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Grid_OverwriteCheckboxRenderer;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var string
|
17 |
+
*/
|
18 |
+
protected $_massactionBlockName = 'eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_grid_massaction';
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
protected $_massactionIdField = 'products';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @return string
|
27 |
+
*/
|
28 |
+
public function getMainButtonsHtml()
|
29 |
+
{
|
30 |
+
$html = $this->getChildHtml('add_bulk_skus');
|
31 |
+
$html .= parent::getMainButtonsHtml();
|
32 |
+
|
33 |
+
return $html;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @return int[]
|
38 |
+
*/
|
39 |
+
public function _getSelectedProducts()
|
40 |
+
{
|
41 |
+
$products = $this->getSelectedProducts();
|
42 |
+
if (!is_array($products)) {
|
43 |
+
$products = $this->getSelectedProductsFromDatabase();
|
44 |
+
}
|
45 |
+
|
46 |
+
return $products;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @return string
|
51 |
+
*/
|
52 |
+
public function getGridUrl()
|
53 |
+
{
|
54 |
+
return $this->getUrl('*/*/productsgrid', ['_current' => true]);
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @param $row
|
59 |
+
* @return null
|
60 |
+
*/
|
61 |
+
public function getRowUrl($row)
|
62 |
+
{
|
63 |
+
return null;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public function getTabLabel()
|
70 |
+
{
|
71 |
+
return $this->__('Products');
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @return string
|
76 |
+
*/
|
77 |
+
public function getTabTitle()
|
78 |
+
{
|
79 |
+
return $this->getTabLabel();
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* @return boolean
|
84 |
+
*/
|
85 |
+
public function canShowTab()
|
86 |
+
{
|
87 |
+
return true;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @return boolean
|
92 |
+
*/
|
93 |
+
public function isHidden()
|
94 |
+
{
|
95 |
+
return !$this->canShowTab();
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* @return $this
|
100 |
+
*/
|
101 |
+
protected function _prepareLayout()
|
102 |
+
{
|
103 |
+
$this->setChild(
|
104 |
+
'add_bulk_skus',
|
105 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
106 |
+
->setData(
|
107 |
+
[
|
108 |
+
'label' => Mage::helper('adminhtml')->__('Add Bulk Skus'),
|
109 |
+
'onclick' => 'Effect.toggle(\'bulk_sku\', \'blind\')',
|
110 |
+
'class' => 'go'
|
111 |
+
]
|
112 |
+
)
|
113 |
+
);
|
114 |
+
|
115 |
+
/** @var Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Products $thisBlock */
|
116 |
+
$thisBlock = parent::_prepareLayout();
|
117 |
+
|
118 |
+
return $thisBlock;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* @return $this
|
123 |
+
*/
|
124 |
+
protected function _prepareColumns()
|
125 |
+
{
|
126 |
+
parent::_prepareColumns();
|
127 |
+
$this->_rssLists = [];
|
128 |
+
$this->removeColumn('action');
|
129 |
+
$this->removeColumn('websites');
|
130 |
+
if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
|
131 |
+
$this->removeColumn('qty');
|
132 |
+
$this->addColumn(
|
133 |
+
'is_in_stock',
|
134 |
+
[
|
135 |
+
'header' => $this->__('Stock Availability'),
|
136 |
+
'width' => '50px',
|
137 |
+
'type' => 'options',
|
138 |
+
'index' => 'is_in_stock',
|
139 |
+
'options' => [
|
140 |
+
Mage_CatalogInventory_Model_Stock::STOCK_IN_STOCK => $this->__('In Stock'),
|
141 |
+
Mage_CatalogInventory_Model_Stock::STOCK_OUT_OF_STOCK => $this->__('Out of Stock'),
|
142 |
+
]
|
143 |
+
]
|
144 |
+
);
|
145 |
+
}
|
146 |
+
$this->removeColumn('price');
|
147 |
+
|
148 |
+
return $this;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* @return $this
|
153 |
+
*/
|
154 |
+
protected function _prepareCollection()
|
155 |
+
{
|
156 |
+
$collection = $this->createCollection();
|
157 |
+
|
158 |
+
$store = $this->_getStore();
|
159 |
+
/** @var Mage_Catalog_Model_Resource_Product_Collection $collection */
|
160 |
+
$collection->addAttributeToSelect('sku')
|
161 |
+
->addAttributeToSelect('name')
|
162 |
+
->addAttributeToSelect('attribute_set_id')
|
163 |
+
->addAttributeToSelect('type_id');
|
164 |
+
|
165 |
+
if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
|
166 |
+
$collection->joinField(
|
167 |
+
'qty',
|
168 |
+
'cataloginventory/stock_item',
|
169 |
+
'qty',
|
170 |
+
'product_id=entity_id',
|
171 |
+
'{{table}}.stock_id=1',
|
172 |
+
'left'
|
173 |
+
);
|
174 |
+
|
175 |
+
$collection->joinField(
|
176 |
+
'is_in_stock',
|
177 |
+
'cataloginventory/stock_item',
|
178 |
+
'is_in_stock',
|
179 |
+
'product_id=entity_id',
|
180 |
+
'{{table}}.stock_id=1',
|
181 |
+
'left'
|
182 |
+
);
|
183 |
+
}
|
184 |
+
if ($store->getId()) {
|
185 |
+
//$collection->setStoreId($store->getId());
|
186 |
+
$adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
|
187 |
+
$collection->addStoreFilter($store);
|
188 |
+
$collection->joinAttribute(
|
189 |
+
'name',
|
190 |
+
'catalog_product/name',
|
191 |
+
'entity_id',
|
192 |
+
null,
|
193 |
+
'inner',
|
194 |
+
$adminStore
|
195 |
+
);
|
196 |
+
$collection->joinAttribute(
|
197 |
+
'custom_name',
|
198 |
+
'catalog_product/name',
|
199 |
+
'entity_id',
|
200 |
+
null,
|
201 |
+
'inner',
|
202 |
+
$store->getId()
|
203 |
+
);
|
204 |
+
$collection->joinAttribute(
|
205 |
+
'status',
|
206 |
+
'catalog_product/status',
|
207 |
+
'entity_id',
|
208 |
+
null,
|
209 |
+
'inner',
|
210 |
+
$store->getId()
|
211 |
+
);
|
212 |
+
$collection->joinAttribute(
|
213 |
+
'visibility',
|
214 |
+
'catalog_product/visibility',
|
215 |
+
'entity_id',
|
216 |
+
null,
|
217 |
+
'inner',
|
218 |
+
$store->getId()
|
219 |
+
);
|
220 |
+
$collection->joinAttribute(
|
221 |
+
'price',
|
222 |
+
'catalog_product/price',
|
223 |
+
'entity_id',
|
224 |
+
null,
|
225 |
+
'left',
|
226 |
+
$store->getId()
|
227 |
+
);
|
228 |
+
} else {
|
229 |
+
$collection->addAttributeToSelect('price');
|
230 |
+
$collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
|
231 |
+
$collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
|
232 |
+
}
|
233 |
+
|
234 |
+
$this->setCollection($collection);
|
235 |
+
|
236 |
+
Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
|
237 |
+
$this->getCollection()->addWebsiteNamesToResult();
|
238 |
+
|
239 |
+
return $this;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* @return $this
|
244 |
+
*/
|
245 |
+
protected function _prepareMassaction()
|
246 |
+
{
|
247 |
+
parent::_prepareMassaction();
|
248 |
+
|
249 |
+
$this->getMassactionBlock()->removeItem('status');
|
250 |
+
$this->getMassactionBlock()->removeItem('attributes');
|
251 |
+
$this->getMassactionBlock()->setFormFieldName('products');
|
252 |
+
|
253 |
+
return $this;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* @param Mage_Adminhtml_Block_Widget_Grid_Column $column
|
258 |
+
* @return $this
|
259 |
+
*/
|
260 |
+
protected function _addColumnFilterToCollection($column)
|
261 |
+
{
|
262 |
+
if ($column->getId() == 'products') {
|
263 |
+
$productIds = $this->_getSelectedProducts();
|
264 |
+
if (empty($productIds)) {
|
265 |
+
$productIds = 0;
|
266 |
+
}
|
267 |
+
if ($column->getFilter()->getValue()) {
|
268 |
+
$this->getCollection()->addFieldToFilter('entity_id', ['in' => $productIds]);
|
269 |
+
} else {
|
270 |
+
if ($productIds) {
|
271 |
+
$this->getCollection()->addFieldToFilter('entity_id', ['nin' => $productIds]);
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
return $this;
|
276 |
+
}
|
277 |
+
|
278 |
+
parent::_addColumnFilterToCollection($column);
|
279 |
+
|
280 |
+
return $this;
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* @return int[]
|
285 |
+
*/
|
286 |
+
private function getSelectedProductsFromDatabase()
|
287 |
+
{
|
288 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
289 |
+
$project = Mage::registry('project');
|
290 |
+
|
291 |
+
return $project->getProducts();
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* @return Mage_Catalog_Model_Resource_Product_Collection
|
296 |
+
*/
|
297 |
+
private function createCollection()
|
298 |
+
{
|
299 |
+
$collection = Mage::getModel('catalog/product')->getCollection();
|
300 |
+
|
301 |
+
$category = Mage::getModel('catalog/category')->load($this->getRequest()->getParam('category_id'));
|
302 |
+
if (!$category->isObjectNew()) {
|
303 |
+
if (!$category->getIsAnchor()) {
|
304 |
+
$collection = $category->getProductCollection();
|
305 |
+
|
306 |
+
return $collection;
|
307 |
+
} else {
|
308 |
+
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
|
309 |
+
->addPathFilter("^{$category->getPath()}/[0-9]*$");
|
310 |
+
$categories = $categoryCollection->getAllIds();
|
311 |
+
$categories[] = $category->getId();
|
312 |
+
$collection->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id')
|
313 |
+
->addAttributeToFilter('category_id', ['in' => $categories]);
|
314 |
+
|
315 |
+
return $collection;
|
316 |
+
}
|
317 |
+
}
|
318 |
+
|
319 |
+
return $collection;
|
320 |
+
}
|
321 |
+
}
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Products_CategoryTree
|
4 |
+
extends Mage_Adminhtml_Block_Catalog_Category_Checkboxes_Tree
|
5 |
+
{
|
6 |
+
protected function _getNodeJson($node, $level = 1)
|
7 |
+
{
|
8 |
+
$item = [];
|
9 |
+
$item['text'] = $this->escapeHtml($node->getName());
|
10 |
+
|
11 |
+
if ($this->_withProductCount) {
|
12 |
+
$item['text'] .= ' (' . $node->getProductCount() . ')';
|
13 |
+
}
|
14 |
+
$item['id'] = $node->getId();
|
15 |
+
$item['path'] = $node->getData('path');
|
16 |
+
$item['cls'] = 'category-' . $node->getId() . ' folder ' . ($node->getIsActive(
|
17 |
+
) ? 'active-category' : 'no-active-category');
|
18 |
+
$item['allowDrop'] = false;
|
19 |
+
$item['allowDrag'] = false;
|
20 |
+
|
21 |
+
if ($node->hasChildren()) {
|
22 |
+
$item['children'] = [];
|
23 |
+
foreach ($node->getChildren() as $child) {
|
24 |
+
$item['children'][] = $this->_getNodeJson($child, $level + 1);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
if (empty($item['children']) && (int)$node->getChildrenCount() > 0) {
|
29 |
+
$item['children'] = [];
|
30 |
+
}
|
31 |
+
|
32 |
+
if (!empty($item['children'])) {
|
33 |
+
$item['expanded'] = true;
|
34 |
+
}
|
35 |
+
|
36 |
+
return $item;
|
37 |
+
}
|
38 |
+
}
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Products_CategoryTreeAjax extends
|
4 |
+
Mage_Adminhtml_Block_Catalog_Category_Widget_Chooser
|
5 |
+
{
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->_withProductCount = true;
|
10 |
+
}
|
11 |
+
|
12 |
+
|
13 |
+
protected function _getNodeJson($node, $level = 0)
|
14 |
+
{
|
15 |
+
$item = parent::_getNodeJson($node, $level);
|
16 |
+
if (in_array($node->getId(), $this->getSelectedCategories())) {
|
17 |
+
$item['checked'] = true;
|
18 |
+
}
|
19 |
+
$item['is_anchor'] = (int)$node->getIsAnchor();
|
20 |
+
$item['url_key'] = $node->getData('url_key');
|
21 |
+
$item['cls'] .= $item['cls'] . ' category-' . $node->getId();
|
22 |
+
|
23 |
+
return $item;
|
24 |
+
}
|
25 |
+
}
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method int[] getSelectedProducts()
|
5 |
+
* @method setSelectedProducts(int[] $products)
|
6 |
+
*/
|
7 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Products_Script
|
8 |
+
extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* @var int[]
|
12 |
+
*/
|
13 |
+
private $productWithCategories;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var int[]
|
17 |
+
*/
|
18 |
+
private $categoryWithProducts;
|
19 |
+
|
20 |
+
public function getCategoriesForProducts()
|
21 |
+
{
|
22 |
+
$this->createRelations();
|
23 |
+
|
24 |
+
return $this->productWithCategories;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getProductForCategoriesFromProducts()
|
28 |
+
{
|
29 |
+
$this->createRelations();
|
30 |
+
|
31 |
+
return $this->categoryWithProducts;
|
32 |
+
}
|
33 |
+
|
34 |
+
private function createRelations()
|
35 |
+
{
|
36 |
+
if ($this->productWithCategories !== null) {
|
37 |
+
return;
|
38 |
+
}
|
39 |
+
$products = Mage::getModel('catalog/product_api_v2')->items(
|
40 |
+
['product_id' => ['in' => $this->getSelectedProducts()]]
|
41 |
+
);
|
42 |
+
|
43 |
+
$this->productWithCategories = [];
|
44 |
+
$this->categoryWithProducts = [];
|
45 |
+
|
46 |
+
foreach ($products as $p) {
|
47 |
+
$this->productWithCategories[$p['product_id']] = $p['category_ids'];
|
48 |
+
foreach ($p['category_ids'] as $c) {
|
49 |
+
$this->categoryWithProducts[$c][] = $p['product_id'];
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method string[] getSelectedTransactionEmailFiles()
|
5 |
+
* @method setSelectedTransactionEmailFiles(string[] $files)
|
6 |
+
* @method setUseAjax(boolean $useAjax)
|
7 |
+
*/
|
8 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_TransactionEmailFiles
|
9 |
+
extends Mage_Adminhtml_Block_Widget_Grid
|
10 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
11 |
+
{
|
12 |
+
use Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Grid_OverwriteCheckboxRenderer;
|
13 |
+
|
14 |
+
public function __construct()
|
15 |
+
{
|
16 |
+
parent::__construct();
|
17 |
+
$this->setId('transactionEmailFilesGrid');
|
18 |
+
$this->setSaveParametersInSession(true);
|
19 |
+
$this->setUseAjax(true);
|
20 |
+
$this->setVarNameFilter('transactionEmails_filter');
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @return $this
|
25 |
+
*/
|
26 |
+
protected function _prepareCollection()
|
27 |
+
{
|
28 |
+
$collection = Mage::getResourceModel('eurotext_translationmanager/emailtemplate_filesystem_collection');
|
29 |
+
$renderer = Mage::getModel('eurotext_translationmanager/renderer_filesystem_relativeToLocaleTemplateDirectory');
|
30 |
+
$collection->addRenderer($renderer);
|
31 |
+
|
32 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
33 |
+
$project = Mage::registry('project');
|
34 |
+
$collection->setLanguage($project->getStoreviewSrcLocale());
|
35 |
+
$this->setCollection($collection);
|
36 |
+
|
37 |
+
/** @var self $collection */
|
38 |
+
$collection = parent::_prepareCollection();
|
39 |
+
|
40 |
+
return $collection;
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @return $this
|
45 |
+
*/
|
46 |
+
protected function _prepareColumns()
|
47 |
+
{
|
48 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
49 |
+
$project = Mage::registry('project');
|
50 |
+
|
51 |
+
$this->addColumn(
|
52 |
+
'translateFiles',
|
53 |
+
[
|
54 |
+
'header_css_class' => 'a-center',
|
55 |
+
'type' => 'checkbox',
|
56 |
+
'name' => 'transactionEmails',
|
57 |
+
'values' => $this->_getSelectedTransactionEmailFiles(),
|
58 |
+
'align' => 'center',
|
59 |
+
'index' => 'relativeToLocaleTemplate',
|
60 |
+
'use_index' => true,
|
61 |
+
'filter' => false,
|
62 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
63 |
+
]
|
64 |
+
);
|
65 |
+
|
66 |
+
$this->addColumn(
|
67 |
+
'relativeToLocaleTemplate',
|
68 |
+
[
|
69 |
+
'header' => Mage::helper('cms')->__('Filename'),
|
70 |
+
'align' => 'left',
|
71 |
+
'index' => 'relativeToLocaleTemplate',
|
72 |
+
'use_index' => true,
|
73 |
+
]
|
74 |
+
);
|
75 |
+
|
76 |
+
parent::_prepareColumns();
|
77 |
+
|
78 |
+
$this->removeColumn('action');
|
79 |
+
|
80 |
+
return $this;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* @return string[]
|
85 |
+
*/
|
86 |
+
public function _getSelectedTransactionEmailFiles()
|
87 |
+
{
|
88 |
+
$translateFiles = $this->getSelectedTransactionEmailFiles();
|
89 |
+
if (!is_array($translateFiles)) {
|
90 |
+
$translateFiles = $this->getSelectedTransactionEmailFilesFromDatabase();
|
91 |
+
}
|
92 |
+
|
93 |
+
return $translateFiles;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* @return string[]
|
98 |
+
*/
|
99 |
+
private function getSelectedTransactionEmailFilesFromDatabase()
|
100 |
+
{
|
101 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
102 |
+
$project = Mage::registry('project');
|
103 |
+
|
104 |
+
return $project->getTransactionEmailFiles();
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* @return string
|
109 |
+
*/
|
110 |
+
public function getGridUrl()
|
111 |
+
{
|
112 |
+
return $this->getUrl('*/*/transactionEmailFilesGrid', ['_current' => true]);
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* @param $row
|
117 |
+
* @return null
|
118 |
+
*/
|
119 |
+
public function getRowUrl($row)
|
120 |
+
{
|
121 |
+
return null;
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* @return string
|
126 |
+
*/
|
127 |
+
public function getTabLabel()
|
128 |
+
{
|
129 |
+
return $this->__('Transaction Email Files');
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* @return string
|
134 |
+
*/
|
135 |
+
public function getTabTitle()
|
136 |
+
{
|
137 |
+
return $this->getTabLabel();
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* @return boolean
|
142 |
+
*/
|
143 |
+
public function canShowTab()
|
144 |
+
{
|
145 |
+
return true;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* @return boolean
|
150 |
+
*/
|
151 |
+
public function isHidden()
|
152 |
+
{
|
153 |
+
return !$this->canShowTab();
|
154 |
+
}
|
155 |
+
}
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method int[] getSelectedTransactionEmailDatabase()
|
5 |
+
* @method setSelectedTransactionEmailDatabase(int[] $ids)
|
6 |
+
* @method setUseAjax(boolean $useAjax)
|
7 |
+
*/
|
8 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_TransactionEmailsDatabase
|
9 |
+
extends Mage_Adminhtml_Block_System_Email_Template_Grid
|
10 |
+
{
|
11 |
+
use Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Grid_OverwriteCheckboxRenderer;
|
12 |
+
|
13 |
+
public function __construct()
|
14 |
+
{
|
15 |
+
parent::__construct();
|
16 |
+
$this->setId('transactionEmailsFromDatabaseGrid');
|
17 |
+
$this->setSaveParametersInSession(true);
|
18 |
+
$this->setUseAjax(true);
|
19 |
+
$this->setVarNameFilter('transactionEmailsFromDatabase_filter');
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function _prepareColumns()
|
23 |
+
{
|
24 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
25 |
+
$project = Mage::registry('project');
|
26 |
+
|
27 |
+
$this->addColumn(
|
28 |
+
'translateFiles',
|
29 |
+
[
|
30 |
+
'header_css_class' => 'a-center',
|
31 |
+
'type' => 'checkbox',
|
32 |
+
'name' => 'transactionEmailsDatabase',
|
33 |
+
'values' => $this->_getSelectedTransactionEmailsDatabase(),
|
34 |
+
'align' => 'center',
|
35 |
+
'index' => 'template_id',
|
36 |
+
'use_index' => true,
|
37 |
+
'filter' => false,
|
38 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
39 |
+
]
|
40 |
+
);
|
41 |
+
|
42 |
+
parent::_prepareColumns();
|
43 |
+
|
44 |
+
$this->removeColumn('action');
|
45 |
+
$this->removeColumn('modified_at');
|
46 |
+
$this->removeColumn('added_at');
|
47 |
+
|
48 |
+
return $this;
|
49 |
+
}
|
50 |
+
|
51 |
+
public function _getSelectedTransactionEmailsDatabase()
|
52 |
+
{
|
53 |
+
$translateFiles = $this->getSelectedTransactionEmailDatabase();
|
54 |
+
if (!is_array($translateFiles)) {
|
55 |
+
$translateFiles = $this->getSelectedTransactionEmailsFromDatabase();
|
56 |
+
}
|
57 |
+
|
58 |
+
return $translateFiles;
|
59 |
+
}
|
60 |
+
|
61 |
+
private function getSelectedTransactionEmailsFromDatabase()
|
62 |
+
{
|
63 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
64 |
+
$project = Mage::registry('project');
|
65 |
+
|
66 |
+
return $project->getTransactionEmailDatabase();
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getGridUrl()
|
70 |
+
{
|
71 |
+
return $this->getUrl('*/*/transactionmailsDatabaseGrid', ['_current' => true]);
|
72 |
+
}
|
73 |
+
|
74 |
+
public function getRowUrl($row)
|
75 |
+
{
|
76 |
+
return null;
|
77 |
+
}
|
78 |
+
}
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method string[] getSelectedTranslateFiles()
|
5 |
+
* @method setSelectedTranslateFiles(string[] $files)
|
6 |
+
* @method setUseAjax(boolean $useAjax)
|
7 |
+
*/
|
8 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_TranslateFiles
|
9 |
+
extends Mage_Adminhtml_Block_Widget_Grid
|
10 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
11 |
+
{
|
12 |
+
use Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Grid_OverwriteCheckboxRenderer;
|
13 |
+
|
14 |
+
public function __construct()
|
15 |
+
{
|
16 |
+
parent::__construct();
|
17 |
+
$this->setId('translateFilesGrid');
|
18 |
+
$this->setDefaultSort('basename');
|
19 |
+
$this->setDefaultDir('ASC');
|
20 |
+
$this->setSaveParametersInSession(true);
|
21 |
+
$this->setUseAjax(true);
|
22 |
+
$this->setVarNameFilter('transactionFiles_filter');
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function _prepareColumns()
|
26 |
+
{
|
27 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
28 |
+
$project = Mage::registry('project');
|
29 |
+
|
30 |
+
$this->addColumn(
|
31 |
+
'translateFiles',
|
32 |
+
[
|
33 |
+
'header_css_class' => 'a-center',
|
34 |
+
'type' => 'checkbox',
|
35 |
+
'name' => 'translateFiles',
|
36 |
+
'values' => $this->_getSelectedTranslateFiles(),
|
37 |
+
'align' => 'center',
|
38 |
+
'index' => 'relativeToApp',
|
39 |
+
'use_index' => true,
|
40 |
+
'filter' => false,
|
41 |
+
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
42 |
+
]
|
43 |
+
);
|
44 |
+
|
45 |
+
$this->addColumn(
|
46 |
+
'relativeToApp',
|
47 |
+
[
|
48 |
+
'header' => Mage::helper('cms')->__('Filename'),
|
49 |
+
'align' => 'left',
|
50 |
+
'index' => 'relativeToApp',
|
51 |
+
'use_index' => true,
|
52 |
+
]
|
53 |
+
);
|
54 |
+
|
55 |
+
$this->addColumn(
|
56 |
+
'basename',
|
57 |
+
[
|
58 |
+
'header' => Mage::helper('cms')->__('Basename'),
|
59 |
+
'align' => 'left',
|
60 |
+
'index' => 'basename',
|
61 |
+
]
|
62 |
+
);
|
63 |
+
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
|
67 |
+
protected function _prepareCollection()
|
68 |
+
{
|
69 |
+
$collection = Mage::getModel('eurotext_translationmanager/resource_csv_collection');
|
70 |
+
$renderer = Mage::getModel('eurotext_translationmanager/renderer_filesystem_relativeToAppDirectory');
|
71 |
+
$collection->addRenderer($renderer);
|
72 |
+
|
73 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
74 |
+
$project = Mage::registry('project');
|
75 |
+
$srcLocale = $project->getStoreviewSrcLocale();
|
76 |
+
$store = $project->getStoreviewSrc();
|
77 |
+
$collection->setTargetPathByLanguageAndStore($srcLocale, $store);
|
78 |
+
$localePath = dirname(
|
79 |
+
Mage::getModel('core/design_package')
|
80 |
+
->setStore($project->getStoreviewSrc())
|
81 |
+
->getLocaleFileName('translate.csv')
|
82 |
+
);
|
83 |
+
|
84 |
+
$collection->addTargetDir(Mage::getBaseDir('locale') . DS . $srcLocale);
|
85 |
+
if (is_dir($localePath)) {
|
86 |
+
$collection->addTargetDir($localePath);
|
87 |
+
}
|
88 |
+
|
89 |
+
$this->setCollection($collection);
|
90 |
+
|
91 |
+
return parent::_prepareCollection();
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* @return string[]
|
96 |
+
*/
|
97 |
+
public function _getSelectedTranslateFiles()
|
98 |
+
{
|
99 |
+
$translateFiles = $this->getSelectedTranslateFiles();
|
100 |
+
if (!is_array($translateFiles)) {
|
101 |
+
$translateFiles = $this->getSelectedTranslateFilesFromDatabase();
|
102 |
+
}
|
103 |
+
|
104 |
+
return $translateFiles;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* @return string[]
|
109 |
+
*/
|
110 |
+
private function getSelectedTranslateFilesFromDatabase()
|
111 |
+
{
|
112 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
113 |
+
$project = Mage::registry('project');
|
114 |
+
|
115 |
+
return $project->getTranslationFiles();
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* @return string
|
120 |
+
*/
|
121 |
+
public function getGridUrl()
|
122 |
+
{
|
123 |
+
return $this->getUrl('*/*/translatefilesgrid', ['_current' => true]);
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* @return string
|
128 |
+
*/
|
129 |
+
public function getTabLabel()
|
130 |
+
{
|
131 |
+
return $this->__('Translation files');
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* @return string
|
136 |
+
*/
|
137 |
+
public function getTabTitle()
|
138 |
+
{
|
139 |
+
return $this->getTabLabel();
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* @return boolean
|
144 |
+
*/
|
145 |
+
public function canShowTab()
|
146 |
+
{
|
147 |
+
return true;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* @return boolean
|
152 |
+
*/
|
153 |
+
public function isHidden()
|
154 |
+
{
|
155 |
+
return !$this->canShowTab();
|
156 |
+
}
|
157 |
+
}
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('project_tabs');
|
9 |
+
$this->setDestElementId('edit_form');
|
10 |
+
$this->setTitle(Mage::helper('eurotext_translationmanager')->__('Manage project'));
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _beforeToHtml()
|
14 |
+
{
|
15 |
+
$this->addTab('main_section', [
|
16 |
+
'label' => $this->__('Project Information'),
|
17 |
+
'title' => $this->__('Project Information'),
|
18 |
+
'content' => $this->getLayout()->createBlock('eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_main')->toHtml(),
|
19 |
+
]);
|
20 |
+
|
21 |
+
|
22 |
+
$this->addTab(
|
23 |
+
'products_section',
|
24 |
+
[
|
25 |
+
'label' => $this->__('Products'),
|
26 |
+
'title' => $this->__('Products'),
|
27 |
+
'url' => $this->getUrl('*/*/productsTab', ['_current' => true]),
|
28 |
+
'class' => 'ajax'
|
29 |
+
]
|
30 |
+
);
|
31 |
+
|
32 |
+
$this->addTab(
|
33 |
+
'categories_section',
|
34 |
+
[
|
35 |
+
'label' => $this->__('Categories'),
|
36 |
+
'title' => $this->__('Categories'),
|
37 |
+
'url' => $this->getUrl('*/*/categoriesTab', ['_current' => true]),
|
38 |
+
'class' => 'ajax'
|
39 |
+
]
|
40 |
+
);
|
41 |
+
|
42 |
+
$this->addTab(
|
43 |
+
'cms_block_section',
|
44 |
+
[
|
45 |
+
'label' => $this->__('CMS Blocks'),
|
46 |
+
'title' => $this->__('CMS Blocks'),
|
47 |
+
'url' => $this->getUrl('*/*/cmsBlocksTab', ['_current' => true]),
|
48 |
+
'class' => 'ajax'
|
49 |
+
]
|
50 |
+
);
|
51 |
+
|
52 |
+
$this->addTab(
|
53 |
+
'cms_page_section',
|
54 |
+
[
|
55 |
+
'label' => $this->__('CMS Pages'),
|
56 |
+
'title' => $this->__('CMS Pages'),
|
57 |
+
'url' => $this->getUrl('*/*/cmsPagesTab', ['_current' => true]),
|
58 |
+
'class' => 'ajax'
|
59 |
+
]
|
60 |
+
);
|
61 |
+
|
62 |
+
$this->addTab(
|
63 |
+
'transaction_email_section',
|
64 |
+
[
|
65 |
+
'label' => $this->__('Transactional Emails'),
|
66 |
+
'title' => $this->__('Transactional Emails'),
|
67 |
+
'url' => $this->getUrl('*/*/transactionEmailFilesTab', ['_current' => true]),
|
68 |
+
'class' => 'ajax'
|
69 |
+
]
|
70 |
+
);
|
71 |
+
|
72 |
+
$this->addTab(
|
73 |
+
'translate_file_section',
|
74 |
+
[
|
75 |
+
'label' => $this->__('Translation files'),
|
76 |
+
'title' => $this->__('Translation files'),
|
77 |
+
'url' => $this->getUrl('*/*/translateFilesTab', ['_current' => true]),
|
78 |
+
'class' => 'ajax'
|
79 |
+
]
|
80 |
+
);
|
81 |
+
|
82 |
+
return parent::_beforeToHtml();
|
83 |
+
}
|
84 |
+
}
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('projectGrid');
|
9 |
+
$this->setDefaultSort('id');
|
10 |
+
$this->setDefaultDir('DESC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
$this->setVarNameFilter('project_filter');
|
13 |
+
$this->setPagerVisibility(false);
|
14 |
+
$this->setDefaultLimit(1000);
|
15 |
+
}
|
16 |
+
|
17 |
+
protected function _prepareCollection()
|
18 |
+
{
|
19 |
+
/** @var Eurotext_TranslationManager_Model_Resource_Project_Collection $collection */
|
20 |
+
$collection = Mage::getResourceModel('eurotext_translationmanager/project_collection');
|
21 |
+
$this->setCollection($collection);
|
22 |
+
|
23 |
+
parent::_prepareCollection();
|
24 |
+
|
25 |
+
return $this;
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function _prepareColumns()
|
29 |
+
{
|
30 |
+
$this->addColumn('updated_at', [
|
31 |
+
'header' => Mage::helper('eurotext_translationmanager')->__('updated_at'),
|
32 |
+
'width' => '50px',
|
33 |
+
'type' => 'date',
|
34 |
+
'index' => 'updated_at',
|
35 |
+
]);
|
36 |
+
|
37 |
+
$this->addColumn('id', [
|
38 |
+
'header' => Mage::helper('eurotext_translationmanager')->__('ID'),
|
39 |
+
'width' => '50px',
|
40 |
+
'type' => 'number',
|
41 |
+
'index' => 'id',
|
42 |
+
]);
|
43 |
+
|
44 |
+
$this->addColumn('project_name', [
|
45 |
+
'header' => Mage::helper('eurotext_translationmanager')->__('Name'),
|
46 |
+
'index' => 'project_name',
|
47 |
+
]);
|
48 |
+
|
49 |
+
$this->addColumn('storeview_src', [
|
50 |
+
'header' => Mage::helper('eurotext_translationmanager')->__('Source StoreView'),
|
51 |
+
'index' => 'storeview_src',
|
52 |
+
'renderer' => 'eurotext_translationmanager/adminhtml_eurotext_grid_renderer_storeviewWithLocale',
|
53 |
+
'filter' => false,
|
54 |
+
'sortable' => false,
|
55 |
+
]);
|
56 |
+
|
57 |
+
$this->addColumn('storeview_dst', [
|
58 |
+
'header' => Mage::helper('eurotext_translationmanager')->__('Target StoreView'),
|
59 |
+
'index' => 'storeview_dst',
|
60 |
+
'renderer' => 'eurotext_translationmanager/adminhtml_eurotext_grid_renderer_storeviewWithLocale',
|
61 |
+
'filter' => false,
|
62 |
+
'sortable' => false,
|
63 |
+
]);
|
64 |
+
|
65 |
+
$this->addColumn('project_status', [
|
66 |
+
'type' => 'options',
|
67 |
+
'header' => Mage::helper('eurotext_translationmanager')->__('Status'),
|
68 |
+
'index' => 'project_status',
|
69 |
+
'options' => Mage::getModel('eurotext_translationmanager/project_source_status')->toArray(),
|
70 |
+
]);
|
71 |
+
|
72 |
+
$this->addColumn('updated_at', [
|
73 |
+
'header' => Mage::helper('eurotext_translationmanager')->__('updated_at'),
|
74 |
+
'width' => '50px',
|
75 |
+
'type' => 'date',
|
76 |
+
'index' => 'updated_at',
|
77 |
+
]);
|
78 |
+
|
79 |
+
return parent::_prepareColumns();
|
80 |
+
}
|
81 |
+
|
82 |
+
public function getRowUrl($row)
|
83 |
+
{
|
84 |
+
return $this->getUrl('*/*/edit', [
|
85 |
+
'store' => $this->getRequest()->getParam('store'),
|
86 |
+
'project_id' => $row->getId()
|
87 |
+
]
|
88 |
+
);
|
89 |
+
}
|
90 |
+
}
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_Adminhtml_Grid_Renderer_StoreviewWithLocale extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
4 |
+
{
|
5 |
+
public function render(Varien_Object $row)
|
6 |
+
{
|
7 |
+
$storeId = $row->getData($this->getColumn()->getIndex());
|
8 |
+
try {
|
9 |
+
$store = Mage::app()->getStore($storeId);
|
10 |
+
|
11 |
+
return sprintf('%s (%s)', $store->getName(), Mage::getStoreConfig('general/locale/code', $store));
|
12 |
+
} catch (Mage_Core_Model_Store_Exception $e) {
|
13 |
+
// store not found (happens if $storeId = -1)
|
14 |
+
}
|
15 |
+
|
16 |
+
return '';
|
17 |
+
}
|
18 |
+
}
|
@@ -1,158 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Block_Projects extends Mage_Adminhtml_Block_Template
|
4 |
-
{
|
5 |
-
public function getSelectUrl($selectType, $project_id)
|
6 |
-
{
|
7 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_'.$selectType.'/index/',array('id' => $project_id));
|
8 |
-
}
|
9 |
-
|
10 |
-
public function getNewProjectUrl()
|
11 |
-
{
|
12 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_projects/addproject');
|
13 |
-
}
|
14 |
-
|
15 |
-
public function getSaveProjectUrl()
|
16 |
-
{
|
17 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_projects/saveproject');
|
18 |
-
}
|
19 |
-
|
20 |
-
public function getProjectUrl($project_id)
|
21 |
-
{
|
22 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_projects/index/id/'.intval($project_id));
|
23 |
-
}
|
24 |
-
|
25 |
-
public function getProjectDeleteUrl($project_id)
|
26 |
-
{
|
27 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_projects/delete/id/'.$project_id);
|
28 |
-
}
|
29 |
-
|
30 |
-
public function getProjectResetUrl($project_id)
|
31 |
-
{
|
32 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_projects/reset/id/'.$project_id);
|
33 |
-
}
|
34 |
-
|
35 |
-
public function getAjaxImportStepUrl()
|
36 |
-
{
|
37 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_projects/importstep');
|
38 |
-
}
|
39 |
-
|
40 |
-
public function getUploadUrl()
|
41 |
-
{
|
42 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_projects/upload');
|
43 |
-
}
|
44 |
-
|
45 |
-
public function getPostBackUrl2()
|
46 |
-
{
|
47 |
-
// Postback-URL für Projekt-Einstellungen
|
48 |
-
return ""; //return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_export/save');
|
49 |
-
}
|
50 |
-
|
51 |
-
public function getAjaxExportUrl()
|
52 |
-
{
|
53 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_projects/ajaxexport');
|
54 |
-
}
|
55 |
-
|
56 |
-
public function getProjects()
|
57 |
-
{
|
58 |
-
$tableName = Mage::getSingleton('core/resource')->getTableName('eurotext_translationmanager/project');
|
59 |
-
|
60 |
-
$dbres = Mage::getSingleton('core/resource');
|
61 |
-
$dbr=$dbres->getConnection('core_read');
|
62 |
-
|
63 |
-
$projects=$dbr->fetchAll("SELECT * FROM `".$tableName."` WHERE deleted=false ORDER BY id ASC");
|
64 |
-
|
65 |
-
return $projects;
|
66 |
-
}
|
67 |
-
|
68 |
-
public function getSelectedProjectId()
|
69 |
-
{
|
70 |
-
return intval(Mage::app()->getRequest()->getParam('id',-1));
|
71 |
-
}
|
72 |
-
|
73 |
-
public function getSelectedProject()
|
74 |
-
{
|
75 |
-
$id=$this->getSelectedProjectId();
|
76 |
-
|
77 |
-
$tableName = Mage::getSingleton('core/resource')->getTableName('eurotext_translationmanager/project');
|
78 |
-
|
79 |
-
$dbres = Mage::getSingleton('core/resource');
|
80 |
-
$dbr=$dbres->getConnection('core_read');
|
81 |
-
|
82 |
-
$projects=$dbr->fetchAll("SELECT * FROM `".$tableName."` WHERE id=".$id);
|
83 |
-
|
84 |
-
return $projects[0];
|
85 |
-
}
|
86 |
-
|
87 |
-
public function GetCheckedStr($val)
|
88 |
-
{
|
89 |
-
if (($val=="1") || ($val==true))
|
90 |
-
{
|
91 |
-
return "checked='checked'";
|
92 |
-
}
|
93 |
-
|
94 |
-
return "";
|
95 |
-
}
|
96 |
-
|
97 |
-
public function getStatusText($status_id)
|
98 |
-
{
|
99 |
-
if ($status_id==0)
|
100 |
-
{
|
101 |
-
return $this->__("New");
|
102 |
-
}
|
103 |
-
else if ($status_id==1)
|
104 |
-
{
|
105 |
-
return $this->__("In progress");
|
106 |
-
}
|
107 |
-
else if ($status_id==2)
|
108 |
-
{
|
109 |
-
return $this->__("In progress");
|
110 |
-
}
|
111 |
-
else if ($status_id==3)
|
112 |
-
{
|
113 |
-
return $this->__("Loaded");
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
public function getStoreviewTitle($store_id)
|
118 |
-
{
|
119 |
-
if ($store_id<0)
|
120 |
-
{
|
121 |
-
return $this->__("Not yet selected");
|
122 |
-
}
|
123 |
-
|
124 |
-
try
|
125 |
-
{
|
126 |
-
$store=Mage::app()->getStore($store_id);
|
127 |
-
$locale_code=Mage::getStoreConfig('general/locale/code', $store->getId());
|
128 |
-
return $store->getName()." (".$locale_code.")";
|
129 |
-
}
|
130 |
-
catch(Exception $e)
|
131 |
-
{
|
132 |
-
return $this->__("A storeview does not exist (anymore)")." (ID: '".$store_id."')";
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
public function getSpracheSelect($selectName, $selectedId,$disabledStr)
|
137 |
-
{
|
138 |
-
$html="<select ".$disabledStr." id='".$selectName."' autocomplete='off'>";
|
139 |
-
$html.="<option value='-1'>".$this->__("-- Select storeview --")."</option>";
|
140 |
-
|
141 |
-
$stores=Mage::app()->getStores();
|
142 |
-
foreach($stores as $store)
|
143 |
-
{
|
144 |
-
$locale_code=Mage::getStoreConfig('general/locale/code', $store->getId());
|
145 |
-
|
146 |
-
$selAttr="";
|
147 |
-
if ($store->getId()==$selectedId)
|
148 |
-
{
|
149 |
-
$selAttr="selected='selected'";
|
150 |
-
}
|
151 |
-
|
152 |
-
$html.="<option value='".$store->getId()."' ".$selAttr.">".$store->getName()." (".$locale_code.")</option>";
|
153 |
-
}
|
154 |
-
$html.="</select>";
|
155 |
-
|
156 |
-
return $html;
|
157 |
-
}
|
158 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,39 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Block_Register extends Mage_Adminhtml_Block_Template
|
4 |
-
{
|
5 |
-
public function getModuleVersion()
|
6 |
-
{
|
7 |
-
return (string) Mage::getConfig()->getNode()->modules->Eurotext_TranslationManager->version;
|
8 |
-
}
|
9 |
-
|
10 |
-
public function getPostBackUrl()
|
11 |
-
{
|
12 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_register/save');
|
13 |
-
}
|
14 |
-
|
15 |
-
// returns "saved", if the email was sent
|
16 |
-
public function getMessage()
|
17 |
-
{
|
18 |
-
if ($this->isSaved())
|
19 |
-
{
|
20 |
-
return $this->__("Last save").": ".$this->getSetting("register_mailsent_date","?");
|
21 |
-
}
|
22 |
-
else
|
23 |
-
{
|
24 |
-
return $this->__("Not yet saved");
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
-
// returns true, if the registration data was sent previously
|
29 |
-
public function isSaved()
|
30 |
-
{
|
31 |
-
return ($this->getSetting("register_mailsent","0")=="1");
|
32 |
-
}
|
33 |
-
|
34 |
-
public function getSetting($key)
|
35 |
-
{
|
36 |
-
$helper=Mage::helper('eurotext_translationmanager');
|
37 |
-
return $helper->getSetting($key,"");
|
38 |
-
}
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,9 +1,32 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
public function returnJson()
|
|
|
6 |
return $this->toJson($this->getResponseArray());
|
7 |
}
|
8 |
-
|
9 |
-
}
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* @method setStatusCode(string $code)
|
5 |
+
* @method string getStatusCode()
|
6 |
+
* @method setStatusMsg(string $msg)
|
7 |
+
* @method string getStatusMsg()
|
8 |
+
* @method setOffset(int $offset)
|
9 |
+
* @method int getOffset()
|
10 |
+
* @method setStep(int $step)
|
11 |
+
* @method int getStep()
|
12 |
+
* @method setFinished(bool $finished)
|
13 |
+
* @method bool getFinished()
|
14 |
+
* @method setText(string $text)
|
15 |
+
* @method mixed[] getResponseArray()
|
16 |
+
*/
|
17 |
+
class Eurotext_TranslationManager_Block_Response_Ajax extends Mage_Adminhtml_Block_Abstract
|
18 |
+
{
|
19 |
+
protected function _construct()
|
20 |
+
{
|
21 |
+
parent::_construct();
|
22 |
+
$this->setFinished(false);
|
23 |
+
$this->setOffset(0);
|
24 |
+
$this->setStep(0);
|
25 |
+
}
|
26 |
+
|
27 |
|
28 |
+
public function returnJson()
|
29 |
+
{
|
30 |
return $this->toJson($this->getResponseArray());
|
31 |
}
|
32 |
+
}
|
|
@@ -1,139 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Block_Selectcategories extends Mage_Adminhtml_Block_Template
|
4 |
-
{
|
5 |
-
private function getTableName($tblName)
|
6 |
-
{
|
7 |
-
return Mage::getSingleton('core/resource')->getTableName($tblName);
|
8 |
-
}
|
9 |
-
|
10 |
-
private function getProjectId()
|
11 |
-
{
|
12 |
-
return intval($this->getRequest()->getParam("id"));
|
13 |
-
}
|
14 |
-
|
15 |
-
public function getSelectCategoriesUrl()
|
16 |
-
{
|
17 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_selectcategories/index',array('id' => $this->getProjectId()));
|
18 |
-
}
|
19 |
-
|
20 |
-
public function getSelectCategoriesSaveUrl()
|
21 |
-
{
|
22 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_selectcategories/save',array('id' => $this->getProjectId()));
|
23 |
-
}
|
24 |
-
|
25 |
-
public function getProject()
|
26 |
-
{
|
27 |
-
$id=$this->getProjectId();
|
28 |
-
|
29 |
-
$tableName = Mage::getSingleton('core/resource')->getTableName('eurotext_translationmanager/project');
|
30 |
-
|
31 |
-
$dbres = Mage::getSingleton('core/resource');
|
32 |
-
$dbr=$dbres->getConnection('core_read');
|
33 |
-
|
34 |
-
$projects=$dbr->fetchAll("SELECT * FROM `".$tableName."` WHERE id=".$id);
|
35 |
-
|
36 |
-
return $projects[0];
|
37 |
-
}
|
38 |
-
|
39 |
-
public function getRootCategory()
|
40 |
-
{
|
41 |
-
$project=$this->getProject();
|
42 |
-
$store=Mage::app()->getStore($project['storeview_src']);
|
43 |
-
$rootCategoryId=$store->getRootCategoryId();
|
44 |
-
|
45 |
-
$rootCategory=Mage::getModel("catalog/category")->load($rootCategoryId);
|
46 |
-
return $rootCategory;
|
47 |
-
}
|
48 |
-
|
49 |
-
public function getOpenedPathIds()
|
50 |
-
{
|
51 |
-
return array();
|
52 |
-
}
|
53 |
-
|
54 |
-
public function getSelectedCategoryIds()
|
55 |
-
{
|
56 |
-
$dbres = Mage::getSingleton('core/resource');
|
57 |
-
$dbr=$dbres->getConnection('core_read');
|
58 |
-
|
59 |
-
$rv=array();
|
60 |
-
|
61 |
-
$selectedCategories=$dbr->fetchAll("SELECT category_id FROM `".$this->getTableName('eurotext_project_categories')."` WHERE project_id=?",array($this->getProjectId()));
|
62 |
-
foreach($selectedCategories as $selectedCategory)
|
63 |
-
{
|
64 |
-
array_push($rv,$selectedCategory['category_id']);
|
65 |
-
}
|
66 |
-
|
67 |
-
return $rv;
|
68 |
-
}
|
69 |
-
|
70 |
-
public function getSearchResult()
|
71 |
-
{
|
72 |
-
$pagesize=20;
|
73 |
-
|
74 |
-
$rv=array();
|
75 |
-
$rv['find']=trim($this->getRequest()->getParam("find"));
|
76 |
-
$page_current=intval($this->getRequest()->getParam("page"));
|
77 |
-
|
78 |
-
$dbres = Mage::getSingleton('core/resource');
|
79 |
-
$dbr=$dbres->getConnection('core_read');
|
80 |
-
|
81 |
-
$eavAttribute = Mage::getModel('eav/entity_attribute');
|
82 |
-
$name_id = $eavAttribute->getIdByCode('catalog_category', 'name');
|
83 |
-
|
84 |
-
$findme="%".$rv['find']."%";
|
85 |
-
|
86 |
-
$sql="SELECT a.store_id, a.value as article_name, e.sku, e.entity_id FROM `".$this->getTableName('catalog_product_entity_varchar')."` a, `".$this->getTableName('catalog_product_entity')."` e WHERE (a.entity_id=e.entity_id) AND a.store_id=0 AND (a.attribute_id=?) AND ((UPPER(e.sku) LIKE ?) OR (UPPER(a.value) LIKE ?)) ORDER BY article_name ASC, e.entity_id ASC";
|
87 |
-
$allProducts=$dbr->fetchAll($sql,array($name_id,$findme,$findme));
|
88 |
-
|
89 |
-
$pageCount=intval(count($allProducts)/$pagesize);
|
90 |
-
if (($pageCount*$pagesize)<count($allProducts))
|
91 |
-
{
|
92 |
-
$pageCount++;
|
93 |
-
}
|
94 |
-
$rv['page_last']=$pageCount;
|
95 |
-
|
96 |
-
if ($page_current>$pageCount)
|
97 |
-
{
|
98 |
-
$page_current=$pageCount;
|
99 |
-
}
|
100 |
-
if ($page_current<1)
|
101 |
-
{
|
102 |
-
$page_current=1;
|
103 |
-
}
|
104 |
-
|
105 |
-
if ($pageCount<1)
|
106 |
-
{
|
107 |
-
$pageCount=1;
|
108 |
-
}
|
109 |
-
|
110 |
-
// Result-Array:
|
111 |
-
$resultProducts=array();
|
112 |
-
$ofs_start=($page_current-1)*$pageCount;
|
113 |
-
$ofs_end=$ofs_start+$pagesize;
|
114 |
-
if ($ofs_end>=count($allProducts))
|
115 |
-
{
|
116 |
-
$ofs_end=count($allProducts)-1;
|
117 |
-
}
|
118 |
-
|
119 |
-
for ($i=$ofs_start; $i<=$ofs_end; $i++)
|
120 |
-
{
|
121 |
-
$prod=$allProducts[$i];
|
122 |
-
$prod['checked']=false;
|
123 |
-
|
124 |
-
// Already selected?
|
125 |
-
$sql="SELECT product_id FROM `".$this->getTableName('eurotext_project_products')."` p WHERE (p.project_id=?) AND (p.product_id=?)";
|
126 |
-
$selProducts=$dbr->fetchAll($sql,array($this->getProjectId(),$prod['entity_id']));
|
127 |
-
$prod['checked']=(count($selProducts)>0);
|
128 |
-
|
129 |
-
array_push($resultProducts,$prod);
|
130 |
-
}
|
131 |
-
|
132 |
-
$rv['page_current']=$page_current;
|
133 |
-
$rv['page_last']=$pageCount;
|
134 |
-
$rv['result_count']=count($allProducts);
|
135 |
-
$rv['products']=$resultProducts;
|
136 |
-
|
137 |
-
return $rv;
|
138 |
-
}
|
139 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,116 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Block_Selectcmspages extends Mage_Adminhtml_Block_Template
|
4 |
-
{
|
5 |
-
private function getTableName($tblName)
|
6 |
-
{
|
7 |
-
return Mage::getSingleton('core/resource')->getTableName($tblName);
|
8 |
-
}
|
9 |
-
|
10 |
-
private function getProjectId()
|
11 |
-
{
|
12 |
-
return intval($this->getRequest()->getParam("id"));
|
13 |
-
}
|
14 |
-
|
15 |
-
public function getSelectCmsPagesUrl()
|
16 |
-
{
|
17 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_selectcmspages/index',array('id' => $this->getProjectId()));
|
18 |
-
}
|
19 |
-
|
20 |
-
public function getSelectCmsPagesSaveUrl()
|
21 |
-
{
|
22 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_selectcmspages/save',array('id' => $this->getProjectId()));
|
23 |
-
}
|
24 |
-
|
25 |
-
public function getProject()
|
26 |
-
{
|
27 |
-
$id=$this->getProjectId();
|
28 |
-
|
29 |
-
$tableName = Mage::getSingleton('core/resource')->getTableName('eurotext_translationmanager/project');
|
30 |
-
|
31 |
-
$dbres = Mage::getSingleton('core/resource');
|
32 |
-
$dbr=$dbres->getConnection('core_read');
|
33 |
-
|
34 |
-
$projects=$dbr->fetchAll("SELECT * FROM `".$tableName."` WHERE id=".$id);
|
35 |
-
|
36 |
-
return $projects[0];
|
37 |
-
}
|
38 |
-
|
39 |
-
public function getCMSPages()
|
40 |
-
{
|
41 |
-
$dbres = Mage::getSingleton('core/resource');
|
42 |
-
$dbr=$dbres->getConnection('core_read');
|
43 |
-
|
44 |
-
$project=$this->getProject();
|
45 |
-
$storeview_src=$project['storeview_src'];
|
46 |
-
|
47 |
-
$rv=array();
|
48 |
-
$selectedCMSPages=array();
|
49 |
-
|
50 |
-
$selectedPageIds=$dbr->fetchAll("SELECT page_id FROM `".$this->getTableName('eurotext_project_cmspages')."` WHERE project_id=?",array($this->getProjectId()));
|
51 |
-
foreach($selectedPageIds as $selectedPageId)
|
52 |
-
{
|
53 |
-
array_push($selectedCMSPages,$selectedPageId['page_id']);
|
54 |
-
}
|
55 |
-
|
56 |
-
// cms-pages:
|
57 |
-
$mPages=$dbr->fetchAll("SELECT * FROM `".$this->getTableName('cms_page')."` ORDER BY title ASC");
|
58 |
-
foreach($mPages as $mPage)
|
59 |
-
{
|
60 |
-
// Is this CMS-Page activated for the source storeview?
|
61 |
-
$storeCount=intval($dbr->fetchOne("SELECT COUNT(*) FROM `".$this->getTableName('cms_page_store')."` WHERE page_id=".$mPage['page_id']." AND (store_id=0 OR store_id=?)",array($storeview_src)));
|
62 |
-
if ($storeCount>0) // Has activated store
|
63 |
-
{
|
64 |
-
$page=array();
|
65 |
-
$page['page_id']=$mPage['page_id'];
|
66 |
-
$page['title']=$mPage['title'];
|
67 |
-
$page['checked']=in_array($mPage['page_id'],$selectedCMSPages);
|
68 |
-
$page['identifier']=$mPage['identifier'];
|
69 |
-
$page['type']=$this->__("CMS-Page");
|
70 |
-
|
71 |
-
array_push($rv,$page);
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
return $rv;
|
76 |
-
}
|
77 |
-
|
78 |
-
public function getCMSBlocks()
|
79 |
-
{
|
80 |
-
$dbres = Mage::getSingleton('core/resource');
|
81 |
-
$dbr=$dbres->getConnection('core_read');
|
82 |
-
|
83 |
-
$project=$this->getProject();
|
84 |
-
$storeview_src=$project['storeview_src'];
|
85 |
-
|
86 |
-
$rv=array();
|
87 |
-
$selectedCMSBlocks=array();
|
88 |
-
|
89 |
-
$selectedBlockIds=$dbr->fetchAll("SELECT block_id FROM `".$this->getTableName('eurotext_project_cmsblocks')."` WHERE project_id=?",array($this->getProjectId()));
|
90 |
-
foreach($selectedBlockIds as $selectedBlockId)
|
91 |
-
{
|
92 |
-
array_push($selectedCMSBlocks,$selectedBlockId['block_id']);
|
93 |
-
}
|
94 |
-
|
95 |
-
// static blocks:
|
96 |
-
$mPages=$dbr->fetchAll("SELECT * FROM `".$this->getTableName('cms_block')."` ORDER BY title ASC");
|
97 |
-
foreach($mPages as $mPage)
|
98 |
-
{
|
99 |
-
// Is this CMS-Block activated for the source storeview?
|
100 |
-
$storeCount=intval($dbr->fetchOne("SELECT COUNT(*) FROM `".$this->getTableName('cms_block_store')."` WHERE block_id=".$mPage['block_id']." AND (store_id=0 OR store_id=?)",array($storeview_src)));
|
101 |
-
if ($storeCount>0) // Has activated store
|
102 |
-
{
|
103 |
-
$page=array();
|
104 |
-
$page['block_id']=$mPage['block_id'];
|
105 |
-
$page['title']=$mPage['title'];
|
106 |
-
$page['checked']=in_array($mPage['block_id'],$selectedCMSBlocks);
|
107 |
-
$page['identifier']=$mPage['identifier'];
|
108 |
-
$page['type']=$this->__("CMS-Block");
|
109 |
-
|
110 |
-
array_push($rv,$page);
|
111 |
-
}
|
112 |
-
}
|
113 |
-
|
114 |
-
return $rv;
|
115 |
-
}
|
116 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,81 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Block_Selectemails extends Mage_Adminhtml_Block_Template
|
4 |
-
{
|
5 |
-
private function getTableName($tblName)
|
6 |
-
{
|
7 |
-
return Mage::getSingleton('core/resource')->getTableName($tblName);
|
8 |
-
}
|
9 |
-
|
10 |
-
private function getProjectId()
|
11 |
-
{
|
12 |
-
return intval($this->getRequest()->getParam("id"));
|
13 |
-
}
|
14 |
-
|
15 |
-
public function getSelectEmailsUrl()
|
16 |
-
{
|
17 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_selectemails/index',array('id' => $this->getProjectId()));
|
18 |
-
}
|
19 |
-
|
20 |
-
public function getSelectEmailsSaveUrl()
|
21 |
-
{
|
22 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_selectemails/save',array('id' => $this->getProjectId()));
|
23 |
-
}
|
24 |
-
|
25 |
-
public function getProject()
|
26 |
-
{
|
27 |
-
$id=$this->getProjectId();
|
28 |
-
|
29 |
-
$tableName = Mage::getSingleton('core/resource')->getTableName('eurotext_translationmanager/project');
|
30 |
-
|
31 |
-
$dbres = Mage::getSingleton('core/resource');
|
32 |
-
$dbr=$dbres->getConnection('core_read');
|
33 |
-
|
34 |
-
$projects=$dbr->fetchAll("SELECT * FROM `".$tableName."` WHERE id=".$id);
|
35 |
-
|
36 |
-
$project=$projects[0];
|
37 |
-
|
38 |
-
// storeview_src_locale:
|
39 |
-
$project['storeview_src_locale']="en_US";
|
40 |
-
if ($project['storeview_src']>=0)
|
41 |
-
{
|
42 |
-
$project['storeview_src_locale']=Mage::getStoreConfig('general/locale/code', $project['storeview_src']);
|
43 |
-
}
|
44 |
-
|
45 |
-
// storeview_dst_locale:
|
46 |
-
$project['storeview_dst_locale']="en_US";
|
47 |
-
if ($project['storeview_dst']>=0)
|
48 |
-
{
|
49 |
-
$project['storeview_dst_locale']=Mage::getStoreConfig('general/locale/code', $project['storeview_dst']);
|
50 |
-
}
|
51 |
-
|
52 |
-
return $project;
|
53 |
-
}
|
54 |
-
|
55 |
-
public function getEMailTemplates()
|
56 |
-
{
|
57 |
-
$dbres = Mage::getSingleton('core/resource');
|
58 |
-
$dbr=$dbres->getConnection('core_read');
|
59 |
-
|
60 |
-
$project=$this->getProject();
|
61 |
-
$storeview_src=$project['storeview_src'];
|
62 |
-
|
63 |
-
$rv=array();
|
64 |
-
|
65 |
-
$helper=Mage::helper('eurotext_translationmanager');
|
66 |
-
$helper->ajaxexportAction_CollectEMailTemplates($project);
|
67 |
-
|
68 |
-
$langfiles=$dbr->fetchAll("SELECT file_hash, filename, translate_flag FROM `".$this->getTableName('eurotext_emailtemplates')."` WHERE project_id=".$project['id']." AND locale_dst='".$project['storeview_src_locale']."' ORDER BY filename ASC");
|
69 |
-
foreach($langfiles as $langfile)
|
70 |
-
{
|
71 |
-
$rvItem=array();
|
72 |
-
$rvItem['file_hash']=$langfile['file_hash'];
|
73 |
-
$rvItem['filename']=$langfile['filename'];
|
74 |
-
$rvItem['checked']=((intval($langfile['translate_flag']))>0);
|
75 |
-
|
76 |
-
array_push($rv,$rvItem);
|
77 |
-
}
|
78 |
-
|
79 |
-
return $rv;
|
80 |
-
}
|
81 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,65 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Block_Selectlangfiles extends Mage_Adminhtml_Block_Template
|
4 |
-
{
|
5 |
-
private function getTableName($tblName)
|
6 |
-
{
|
7 |
-
return Mage::getSingleton('core/resource')->getTableName($tblName);
|
8 |
-
}
|
9 |
-
|
10 |
-
private function getProjectId()
|
11 |
-
{
|
12 |
-
return intval($this->getRequest()->getParam("id"));
|
13 |
-
}
|
14 |
-
|
15 |
-
public function getSelectLangfilesUrl()
|
16 |
-
{
|
17 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_selectlangfiles/index',array('id' => $this->getProjectId()));
|
18 |
-
}
|
19 |
-
|
20 |
-
public function getSelectLangfilesSaveUrl()
|
21 |
-
{
|
22 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_selectlangfiles/save',array('id' => $this->getProjectId()));
|
23 |
-
}
|
24 |
-
|
25 |
-
public function getProject()
|
26 |
-
{
|
27 |
-
$id=$this->getProjectId();
|
28 |
-
|
29 |
-
$tableName = Mage::getSingleton('core/resource')->getTableName('eurotext_translationmanager/project');
|
30 |
-
|
31 |
-
$dbres = Mage::getSingleton('core/resource');
|
32 |
-
$dbr=$dbres->getConnection('core_read');
|
33 |
-
|
34 |
-
$projects=$dbr->fetchAll("SELECT * FROM `".$tableName."` WHERE id=".$id);
|
35 |
-
|
36 |
-
return $projects[0];
|
37 |
-
}
|
38 |
-
|
39 |
-
public function getLangfiles()
|
40 |
-
{
|
41 |
-
$dbres = Mage::getSingleton('core/resource');
|
42 |
-
$dbr=$dbres->getConnection('core_read');
|
43 |
-
|
44 |
-
$project=$this->getProject();
|
45 |
-
$storeview_src=$project['storeview_src'];
|
46 |
-
|
47 |
-
$rv=array();
|
48 |
-
|
49 |
-
$projectsController=Mage::helper('eurotext_translationmanager');
|
50 |
-
$projectsController->ajaxexportAction_CollectLangfiles($project);
|
51 |
-
|
52 |
-
$langfiles=$dbr->fetchAll("SELECT line_hash, filename, translate_flag FROM `".$this->getTableName('eurotext_csv')."` WHERE locale_dst='en_US' AND project_id=".$project['id']." ORDER BY filename ASC");
|
53 |
-
foreach($langfiles as $langfile)
|
54 |
-
{
|
55 |
-
$rvItem=array();
|
56 |
-
$rvItem['line_hash']=$langfile['line_hash'];
|
57 |
-
$rvItem['filename']=$langfile['filename'];
|
58 |
-
$rvItem['checked']=((intval($langfile['translate_flag']))>0);
|
59 |
-
|
60 |
-
array_push($rv,$rvItem);
|
61 |
-
}
|
62 |
-
|
63 |
-
return $rv;
|
64 |
-
}
|
65 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,329 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Block_Selectproducts extends Mage_Adminhtml_Block_Template
|
4 |
-
{
|
5 |
-
public function updateFilterData()
|
6 |
-
{
|
7 |
-
if ($this->getRequest()->getParam("status")!="")
|
8 |
-
{
|
9 |
-
$filter_status=intval($this->getRequest()->getParam("status"));
|
10 |
-
$filter_stock=intval($this->getRequest()->getParam("stock"));
|
11 |
-
$filter_product_type=$this->getRequest()->getParam("producttype");
|
12 |
-
$project_id=$this->getProjectId();
|
13 |
-
|
14 |
-
$dbres = Mage::getSingleton('core/resource');
|
15 |
-
$dbw=$dbres->getConnection('core_write');
|
16 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_project')."` SET filter_status=?, filter_stock=?, filter_product_type=? WHERE id=?;",array($filter_status,$filter_stock,$filter_product_type,$project_id));
|
17 |
-
}
|
18 |
-
}
|
19 |
-
|
20 |
-
private function getProjectId()
|
21 |
-
{
|
22 |
-
return intval($this->getRequest()->getParam("id"));
|
23 |
-
}
|
24 |
-
|
25 |
-
public function getSelectProductsUrl()
|
26 |
-
{
|
27 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_selectproducts/index',array('id' => $this->getProjectId()));
|
28 |
-
}
|
29 |
-
|
30 |
-
public function getSelectProductsSaveUrl()
|
31 |
-
{
|
32 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_selectproducts/save'); //,array('id' => $this->getProjectId()));
|
33 |
-
}
|
34 |
-
|
35 |
-
private function getTableName($tblName)
|
36 |
-
{
|
37 |
-
return Mage::getSingleton('core/resource')->getTableName($tblName);
|
38 |
-
}
|
39 |
-
|
40 |
-
public function getOpenCatIds()
|
41 |
-
{
|
42 |
-
// Parse catids (list of open categories)
|
43 |
-
$open_catids_str=$this->getRequest()->getParam("catids");
|
44 |
-
|
45 |
-
$open_catids_list=explode(",",$open_catids_str);
|
46 |
-
$open_catids=array();
|
47 |
-
foreach($open_catids_list as $opencatid)
|
48 |
-
{
|
49 |
-
$cat_id=intval($opencatid); // prevent non-numeric ids
|
50 |
-
array_push($open_catids,$cat_id);
|
51 |
-
}
|
52 |
-
array_push($open_catids,1); // root-category is always open
|
53 |
-
$open_catids=array_unique($open_catids);
|
54 |
-
|
55 |
-
return $open_catids;
|
56 |
-
}
|
57 |
-
|
58 |
-
public function getCategoryTreeHTML()
|
59 |
-
{
|
60 |
-
$pagesize=20;
|
61 |
-
|
62 |
-
$dbres = Mage::getSingleton('core/resource');
|
63 |
-
$dbr=$dbres->getConnection('core_read');
|
64 |
-
|
65 |
-
$rv=array();
|
66 |
-
$rv['find']=trim($this->getRequest()->getParam("find"));
|
67 |
-
$page_current=intval($this->getRequest()->getParam("page"));
|
68 |
-
|
69 |
-
$pagesize=intval($this->getRequest()->getParam("pagesize"));
|
70 |
-
if ($pagesize<20)
|
71 |
-
{
|
72 |
-
$pagesize=20;
|
73 |
-
}
|
74 |
-
|
75 |
-
$helper=Mage::helper('eurotext_translationmanager');
|
76 |
-
|
77 |
-
$open_catids=$this->getOpenCatIds();
|
78 |
-
$root=$helper->getCategoryTree(1,$open_catids);
|
79 |
-
$baselink=$this->getSelectProductsUrl()."find/".urlencode($rv['find'])."/pagesize/".$pagesize;
|
80 |
-
|
81 |
-
$current_path=array();
|
82 |
-
$project_id=$this->getProjectId();
|
83 |
-
|
84 |
-
return $this->getCategoryTreeHTMLInternal($dbr,$project_id,$root,-1,$open_catids,$current_path,$baselink);
|
85 |
-
}
|
86 |
-
|
87 |
-
private function getCategoryTreeHTMLInternal($dbr, $project_id, $treeNode, $lvl, $open_catids, $current_path, $baselink)
|
88 |
-
{
|
89 |
-
|
90 |
-
$rv = '';
|
91 |
-
$_lvl=max(0,$lvl);
|
92 |
-
$marginLeft=($_lvl)*22;
|
93 |
-
|
94 |
-
$current_path_new=array_merge(array(),$current_path);
|
95 |
-
array_push($current_path_new,$treeNode['id']);
|
96 |
-
$current_path_new=array_unique($current_path_new);
|
97 |
-
|
98 |
-
$showChildren=false;
|
99 |
-
$isSelected=in_array($treeNode['id'],$open_catids);
|
100 |
-
|
101 |
-
$cssClass="eurotext_category_none";
|
102 |
-
if ($treeNode['hasChildren'])
|
103 |
-
{
|
104 |
-
if ($isSelected)
|
105 |
-
{
|
106 |
-
$showChildren=true;
|
107 |
-
$cssClass="eurotext_category_minus";
|
108 |
-
}
|
109 |
-
else
|
110 |
-
{
|
111 |
-
$cssClass="eurotext_category_plus id_".$treeNode['id']." path_".implode("_",$open_catids);
|
112 |
-
}
|
113 |
-
}
|
114 |
-
if ($treeNode['id']==1)
|
115 |
-
{
|
116 |
-
$cssClass="eurotext_category_none"; // no 'open'-icon on root-category
|
117 |
-
}
|
118 |
-
|
119 |
-
$linkStyle="color:black;text-decoration:none;padding:2px;";
|
120 |
-
if ($isSelected)
|
121 |
-
{
|
122 |
-
if ( ($treeNode['id']==1) && (count($open_catids)>1))
|
123 |
-
{
|
124 |
-
// Ignore selection on root category
|
125 |
-
}
|
126 |
-
else
|
127 |
-
{
|
128 |
-
$linkStyle="color:black;text-decoration:none;background-color: rgb(245, 214, 199);padding:2px;";
|
129 |
-
}
|
130 |
-
}
|
131 |
-
|
132 |
-
// Determine category state:
|
133 |
-
$categoryState=Mage::helper('eurotext_translationmanager')->getTreeNodeTranslationState($dbr,$treeNode['id'],$project_id);
|
134 |
-
|
135 |
-
$checkedStr="";
|
136 |
-
if ($categoryState=="checked")
|
137 |
-
{
|
138 |
-
$checkedStr="checked='checked'";
|
139 |
-
}
|
140 |
-
|
141 |
-
|
142 |
-
$rv .= "<table style='margin-left:".$marginLeft."px;'> \r\n";
|
143 |
-
$rv .= " <tr> \r\n";
|
144 |
-
$rv .= " <td><div class='".$cssClass."'></div></td> \r\n"; // Icon
|
145 |
-
$rv .= " <td><input type='checkbox' autocomplete='off' x-state='".$categoryState."' x-catid='".$treeNode['id']."' class='eurotext_catsel' id='eurotext_catsel_".$treeNode['id']."' ".$checkedStr." /> </td> \r\n";
|
146 |
-
$rv .= " <td><a style='".$linkStyle."' href='".$baselink."/catids/".implode(",",$current_path_new)."'>".htmlentities($treeNode['name'])."</a></td> \r\n";
|
147 |
-
$rv .= " </tr> \r\n";
|
148 |
-
$rv .= "</table> \r\n";
|
149 |
-
|
150 |
-
if ($categoryState=="indeterminate")
|
151 |
-
{
|
152 |
-
$rv .= "<script>document.getElementById('eurotext_catsel_".$treeNode['id']."').indeterminate = true;</script> \r\n";
|
153 |
-
}
|
154 |
-
|
155 |
-
if ($showChildren)
|
156 |
-
{
|
157 |
-
foreach($treeNode['childs'] as $child)
|
158 |
-
{
|
159 |
-
$rv .= $this->getCategoryTreeHTMLInternal($dbr,$project_id,$child,($lvl+1),$open_catids,$current_path_new,$baselink);
|
160 |
-
}
|
161 |
-
}
|
162 |
-
|
163 |
-
return $rv;
|
164 |
-
|
165 |
-
}
|
166 |
-
|
167 |
-
private $filterDataRead=false;
|
168 |
-
private $filter_status=1;
|
169 |
-
private $filter_stock=1;
|
170 |
-
private $filter_product_type="";
|
171 |
-
|
172 |
-
private function readFilterData()
|
173 |
-
{
|
174 |
-
if ($this->filterDataRead)
|
175 |
-
{
|
176 |
-
return;
|
177 |
-
}
|
178 |
-
|
179 |
-
$dbres = Mage::getSingleton('core/resource');
|
180 |
-
$dbr=$dbres->getConnection('core_read');
|
181 |
-
|
182 |
-
$project_id=$this->getProjectId();
|
183 |
-
|
184 |
-
$allProducts=$dbr->fetchAll("SELECT filter_status, filter_stock, filter_product_type FROM `".$this->getTableName('eurotext_project')."` WHERE id=?",array($project_id));
|
185 |
-
foreach($allProducts as $row)
|
186 |
-
{
|
187 |
-
$this->filter_status=$row['filter_status'];
|
188 |
-
$this->filter_stock=$row['filter_stock'];
|
189 |
-
$this->filter_product_type=$row['filter_product_type'];
|
190 |
-
}
|
191 |
-
|
192 |
-
$this->filterDataRead=true;
|
193 |
-
}
|
194 |
-
|
195 |
-
public function getFilterStatus()
|
196 |
-
{
|
197 |
-
$this->readFilterData();
|
198 |
-
|
199 |
-
return $this->filter_status;
|
200 |
-
}
|
201 |
-
|
202 |
-
public function getFilterStock()
|
203 |
-
{
|
204 |
-
$this->readFilterData();
|
205 |
-
|
206 |
-
return $this->filter_stock;
|
207 |
-
}
|
208 |
-
|
209 |
-
public function getFilterProductType()
|
210 |
-
{
|
211 |
-
$this->readFilterData();
|
212 |
-
|
213 |
-
$tmp=$this->filter_product_type;
|
214 |
-
|
215 |
-
$validProductTypes=array("simple","grouped","configurable","virtual","bundle","downloadable");
|
216 |
-
if (in_array($tmp,$validProductTypes))
|
217 |
-
{
|
218 |
-
return $tmp;
|
219 |
-
}
|
220 |
-
else
|
221 |
-
{
|
222 |
-
return "";
|
223 |
-
}
|
224 |
-
}
|
225 |
-
|
226 |
-
public function getSearchResult()
|
227 |
-
{
|
228 |
-
$pagesize=20;
|
229 |
-
|
230 |
-
$rv=array();
|
231 |
-
$rv['find']=trim($this->getRequest()->getParam("find"));
|
232 |
-
$page_current=intval($this->getRequest()->getParam("page"));
|
233 |
-
|
234 |
-
$pagesize=intval($this->getRequest()->getParam("pagesize"));
|
235 |
-
if ($pagesize<20)
|
236 |
-
{
|
237 |
-
$pagesize=20;
|
238 |
-
}
|
239 |
-
|
240 |
-
$dbres = Mage::getSingleton('core/resource');
|
241 |
-
$dbr=$dbres->getConnection('core_read');
|
242 |
-
|
243 |
-
$eavAttribute = Mage::getModel('eav/entity_attribute');
|
244 |
-
$name_id = $eavAttribute->getIdByCode('catalog_product', 'name');
|
245 |
-
|
246 |
-
$attr_status_id=$eavAttribute->getIdByCode('catalog_product', 'status');
|
247 |
-
|
248 |
-
$findme="%".$rv['find']."%";
|
249 |
-
|
250 |
-
$sql_categoryfilter="";
|
251 |
-
$open_catids=$this->getOpenCatIds();
|
252 |
-
if (count($open_catids)>0)
|
253 |
-
{
|
254 |
-
$selected_catid=$open_catids[count($open_catids)-1]; // Last ID is the selected category
|
255 |
-
if ($selected_catid>1) // root-category has id 1
|
256 |
-
{
|
257 |
-
$search_catids=Mage::helper('eurotext_translationmanager')->getAllSubCategories($selected_catid); // Get the IDs of all children (direct+indirect)
|
258 |
-
array_push($search_catids,$selected_catid); // add selected category to list
|
259 |
-
|
260 |
-
// Filter to products which are assigned to any category in $search_catids:
|
261 |
-
$sql_categoryfilter=" AND e.entity_id IN (SELECT cat.product_id FROM catalog_category_product cat WHERE cat.category_id IN (".implode(",",$search_catids)."))";
|
262 |
-
}
|
263 |
-
}
|
264 |
-
|
265 |
-
$sql_stockfilter=" AND e.entity_id IN (SELECT stock.product_id FROM cataloginventory_stock_item stock WHERE stock.is_in_stock=".$this->getFilterStock().")";
|
266 |
-
$sql_statusfilter=" AND e.entity_id IN (SELECT pstatus.entity_id FROM catalog_product_entity_int pstatus WHERE pstatus.attribute_id=".$attr_status_id." AND pstatus.value=".$this->getFilterStatus().")";
|
267 |
-
|
268 |
-
if ($this->getFilterProductType()!=="")
|
269 |
-
{
|
270 |
-
$sql_statusfilter.=" AND e.type_id='".$this->getFilterProductType()."'";
|
271 |
-
}
|
272 |
-
|
273 |
-
$sql="SELECT a.store_id, a.value as article_name, e.sku, e.entity_id FROM `".$this->getTableName('catalog_product_entity_varchar')."` a, `".$this->getTableName('catalog_product_entity')."` e WHERE (a.entity_id=e.entity_id) AND a.store_id=0 AND (a.attribute_id=?) AND ((UPPER(e.sku) LIKE ?) OR (UPPER(a.value) LIKE ?)) $sql_categoryfilter $sql_stockfilter $sql_statusfilter ORDER BY article_name ASC, e.entity_id ASC";
|
274 |
-
|
275 |
-
//echo $sql;
|
276 |
-
$allProducts=$dbr->fetchAll($sql,array($name_id,$findme,$findme));
|
277 |
-
|
278 |
-
$pageCount=intval(count($allProducts)/$pagesize);
|
279 |
-
if (($pageCount*$pagesize)<count($allProducts))
|
280 |
-
{
|
281 |
-
$pageCount++;
|
282 |
-
}
|
283 |
-
$rv['page_last']=$pageCount;
|
284 |
-
|
285 |
-
if ($page_current>$pageCount)
|
286 |
-
{
|
287 |
-
$page_current=$pageCount;
|
288 |
-
}
|
289 |
-
if ($page_current<1)
|
290 |
-
{
|
291 |
-
$page_current=1;
|
292 |
-
}
|
293 |
-
|
294 |
-
if ($pageCount<1)
|
295 |
-
{
|
296 |
-
$pageCount=1;
|
297 |
-
}
|
298 |
-
|
299 |
-
// Result-Array:
|
300 |
-
$resultProducts=array();
|
301 |
-
$ofs_start=($page_current-1)*$pageCount;
|
302 |
-
$ofs_end=$ofs_start+$pagesize;
|
303 |
-
if ($ofs_end>=count($allProducts))
|
304 |
-
{
|
305 |
-
$ofs_end=count($allProducts)-1;
|
306 |
-
}
|
307 |
-
|
308 |
-
for ($i=$ofs_start; $i<=$ofs_end; $i++)
|
309 |
-
{
|
310 |
-
$prod=$allProducts[$i];
|
311 |
-
$prod['checked']=false;
|
312 |
-
|
313 |
-
// Already selected?
|
314 |
-
$sql="SELECT product_id FROM `".$this->getTableName('eurotext_project_products')."` p WHERE (p.project_id=?) AND (p.product_id=?)";
|
315 |
-
$selProducts=$dbr->fetchAll($sql,array($this->getProjectId(),$prod['entity_id']));
|
316 |
-
$prod['checked']=(count($selProducts)>0);
|
317 |
-
|
318 |
-
array_push($resultProducts,$prod);
|
319 |
-
}
|
320 |
-
|
321 |
-
$rv['page_current']=$page_current;
|
322 |
-
$rv['page_last']=$pageCount;
|
323 |
-
$rv['page_size']=$pagesize;
|
324 |
-
$rv['result_count']=count($allProducts);
|
325 |
-
$rv['products']=$resultProducts;
|
326 |
-
|
327 |
-
return $rv;
|
328 |
-
}
|
329 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,34 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Block_Settings extends Mage_Adminhtml_Block_Template
|
4 |
-
{
|
5 |
-
public function getSaveUrl()
|
6 |
-
{
|
7 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_settings/save');
|
8 |
-
}
|
9 |
-
|
10 |
-
public function getUpgradeScopeUrl()
|
11 |
-
{
|
12 |
-
return Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_settings/upgradescope');
|
13 |
-
}
|
14 |
-
|
15 |
-
public function getStoreviews()
|
16 |
-
{
|
17 |
-
$array_stores=array();
|
18 |
-
|
19 |
-
$stores=Mage::app()->getStores();
|
20 |
-
foreach($stores as $store)
|
21 |
-
{
|
22 |
-
$array_store=array();
|
23 |
-
$array_store['store_id']=$store->getId();
|
24 |
-
$array_store['name']=$store->getName();
|
25 |
-
$array_store['code']=$store->getCode();
|
26 |
-
$array_store['locale']=Mage::getStoreConfig('general/locale/code', $store->getId());
|
27 |
-
|
28 |
-
array_push($array_stores,$array_store);
|
29 |
-
}
|
30 |
-
|
31 |
-
return $array_stores;
|
32 |
-
}
|
33 |
-
|
34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method setTitle(string $title)
|
5 |
+
*/
|
6 |
+
class Eurotext_TranslationManager_Block_Status extends Mage_Adminhtml_Block_Widget_Form
|
7 |
+
{
|
8 |
+
private $testVarSubdirectories = [];
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var Varien_Data_Form
|
12 |
+
*/
|
13 |
+
private $form;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var Eurotext_TranslationManager_Helper_Data
|
17 |
+
*/
|
18 |
+
private $helper;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var Eurotext_TranslationManager_Helper_Config
|
22 |
+
*/
|
23 |
+
private $configHelper;
|
24 |
+
|
25 |
+
protected function _construct()
|
26 |
+
{
|
27 |
+
$this->testVarSubdirectories = [
|
28 |
+
'Import' => Mage::getBaseDir('tmp') . '/eurotext',
|
29 |
+
// \Eurotext_TranslationManager_Adminhtml_Eurotext_Project_ImportController::getTempDirectory
|
30 |
+
'Export' => Mage::getBaseDir('var') . '/eurotext/projects'
|
31 |
+
// \Eurotext_TranslationManager_Helper_Filesystem::createProjectExportDirectory
|
32 |
+
];
|
33 |
+
$this->helper = Mage::helper('eurotext_translationmanager');
|
34 |
+
$this->configHelper = Mage::helper('eurotext_translationmanager/config');
|
35 |
+
parent::_construct();
|
36 |
+
$this->setId('project_id');
|
37 |
+
$this->setTitle(Mage::helper('eurotext_translationmanager')->__('Project Information'));
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function _prepareForm()
|
41 |
+
{
|
42 |
+
$this->form = new Varien_Data_Form(['id' => 'status_form']);
|
43 |
+
|
44 |
+
$this->addStatus();
|
45 |
+
$this->addLanguages();
|
46 |
+
$this->addRequirements();
|
47 |
+
$this->addDirectoryRights();
|
48 |
+
$this->setForm($this->form);
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @return string
|
53 |
+
*/
|
54 |
+
private function getUpgradeScopeUrl()
|
55 |
+
{
|
56 |
+
return Mage::helper('adminhtml')->getUrl('*/eurotext_status/upgradescope');
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @return bool
|
61 |
+
*/
|
62 |
+
private function isCustomerIdSet()
|
63 |
+
{
|
64 |
+
return (bool)$this->configHelper->getCustomerId();
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @return string[]
|
69 |
+
*/
|
70 |
+
private function getLanguagesInStores()
|
71 |
+
{
|
72 |
+
$languages = [];
|
73 |
+
foreach (Mage::app()->getStores() as $store) {
|
74 |
+
/** @var Mage_Core_Model_Store $store */
|
75 |
+
$locale = Mage::getStoreConfig('general/locale/code', $store->getId());
|
76 |
+
$localeInfo = $this->helper->getLocaleInfoByMagentoLocale($locale);
|
77 |
+
$languages[] =
|
78 |
+
[
|
79 |
+
'store_id' => $store->getId(),
|
80 |
+
'name' => $store->getName(),
|
81 |
+
'code' => $store->getCode(),
|
82 |
+
'locale' => $locale,
|
83 |
+
'language_name' => $localeInfo['lang_name'],
|
84 |
+
'et_locale' => $localeInfo['locale_eurotext'],
|
85 |
+
];
|
86 |
+
}
|
87 |
+
|
88 |
+
return $languages;
|
89 |
+
}
|
90 |
+
|
91 |
+
private function addRequirements()
|
92 |
+
{
|
93 |
+
$fieldset = $this->form->addFieldset('requirements', ['legend' => $this->__('System requirements')]);
|
94 |
+
|
95 |
+
$requirements = [
|
96 |
+
'module_version' => [
|
97 |
+
'name' => $this->__('Plugin version'),
|
98 |
+
'value_now' => $this->configHelper->getModuleVersion(),
|
99 |
+
'value_required' => "—",
|
100 |
+
],
|
101 |
+
'php_version' => [
|
102 |
+
'name' => $this->__('PHP version'),
|
103 |
+
'value_now' => PHP_VERSION,
|
104 |
+
'value_required' => "> 5.5.0",
|
105 |
+
],
|
106 |
+
'ftp_extension' => [
|
107 |
+
'name' => $this->__('FTP-Extension'),
|
108 |
+
'value_now' => extension_loaded('ftp') ? $this->__("Installed") : $this->__("Missing"),
|
109 |
+
'value_required' => $this->__("Installed"),
|
110 |
+
],
|
111 |
+
'zip_extension' => [
|
112 |
+
'name' => $this->__('ZIP-Extension'),
|
113 |
+
'value_now' => extension_loaded('zip') ? $this->__("Installed") : $this->__("Missing"),
|
114 |
+
'value_required' => $this->__("Installed"),
|
115 |
+
],
|
116 |
+
'max_execution_time' => [
|
117 |
+
'name' => $this->__("Value for 'max_execution_time'"),
|
118 |
+
'value_now' => ini_get('max_execution_time'),
|
119 |
+
'value_required' => $this->__('Higher is better (Zero is infinite)'),
|
120 |
+
|
121 |
+
]
|
122 |
+
];
|
123 |
+
|
124 |
+
foreach ($requirements as $name => $req) {
|
125 |
+
$fieldset->addField(
|
126 |
+
$name,
|
127 |
+
'note',
|
128 |
+
[
|
129 |
+
'label' => $req['name'],
|
130 |
+
'text' => sprintf('%s (%s)', $req['value_now'], $req['value_required']),
|
131 |
+
]
|
132 |
+
);
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
private function addLanguages()
|
137 |
+
{
|
138 |
+
$fieldset = $this->form->addFieldset('language_settings', ['legend' => $this->__('Languages in Stores')]);
|
139 |
+
|
140 |
+
foreach ($this->getLanguagesInStores() as $store) {
|
141 |
+
$fieldset->addField(
|
142 |
+
'languages_' . $store['store_id'],
|
143 |
+
'note',
|
144 |
+
[
|
145 |
+
'label' => $store['name'] . ' (' . $store['locale'] . ')',
|
146 |
+
'text' => $store['language_name'] . ': ' . $store['et_locale'],
|
147 |
+
]
|
148 |
+
);
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
private function addStatus()
|
153 |
+
{
|
154 |
+
$fieldset = $this->form->addFieldset('status', ['legend' => $this->__('Status')]);
|
155 |
+
|
156 |
+
if (!$this->configHelper->isEmailSent()) {
|
157 |
+
$fieldset->addField(
|
158 |
+
'register_email',
|
159 |
+
'note',
|
160 |
+
[
|
161 |
+
'label' => $this->__('Registration'),
|
162 |
+
'text' => $this->__(
|
163 |
+
'You need to register first. Please go to <a href="%s">Registration</a> first and submit your information.',
|
164 |
+
Mage::helper('adminhtml')->getUrl('adminhtml/system_config/edit/', ['section' => 'eurotext'])
|
165 |
+
),
|
166 |
+
]
|
167 |
+
);
|
168 |
+
}
|
169 |
+
|
170 |
+
if (!$this->isCustomerIdSet()) {
|
171 |
+
$fieldset->addField(
|
172 |
+
'customer_id_set',
|
173 |
+
'note',
|
174 |
+
[
|
175 |
+
'label' => $this->__('Login Credentials'),
|
176 |
+
'text' => $this->__(
|
177 |
+
'You need to provide your login credentials first. Please go to <a href="%s">Settings</a> first and submit your information.',
|
178 |
+
Mage::helper('adminhtml')->getUrl('adminhtml/system_config/edit/', ['section' => 'eurotext'])
|
179 |
+
),
|
180 |
+
]
|
181 |
+
);
|
182 |
+
}
|
183 |
+
|
184 |
+
try {
|
185 |
+
Mage::getModel('eurotext_translationmanager/export_project_ftpUpload')->validateFtpConnection();
|
186 |
+
$ftpMessage = $this->__('FTP Upload successfully tested.');
|
187 |
+
} catch (Eurotext_TranslationManager_Exception_FtpException $e) {
|
188 |
+
$ftpMessage = $this->__($e->getMessage());
|
189 |
+
}
|
190 |
+
|
191 |
+
$fieldset->addField(
|
192 |
+
'ftp_problem',
|
193 |
+
'note',
|
194 |
+
[
|
195 |
+
'label' => $this->__('FTP Status'),
|
196 |
+
'text' => $ftpMessage,
|
197 |
+
]
|
198 |
+
);
|
199 |
+
|
200 |
+
if ($this->helper->urlKeyScopeIsGlobal()) {
|
201 |
+
$fieldset->addField(
|
202 |
+
'url_key_scope',
|
203 |
+
'note',
|
204 |
+
[
|
205 |
+
'label' => $this->__('Catalog URL key scope'),
|
206 |
+
'text' => $this->__(
|
207 |
+
'Currently your Magento installation is not capable to save translated URL keys for products and categories.'
|
208 |
+
),
|
209 |
+
]
|
210 |
+
);
|
211 |
+
$fieldset->addField(
|
212 |
+
'url_key_scope_link',
|
213 |
+
'link',
|
214 |
+
[
|
215 |
+
'label' => $this->__('Change URL key scope'),
|
216 |
+
'value' => $this->__(
|
217 |
+
'Click here to change the scope of URL keys to enable translation of URL keys for products and categories. (Attention: This cannot be undone!)'
|
218 |
+
),
|
219 |
+
'href' => $this->getUpgradeScopeUrl(),
|
220 |
+
]
|
221 |
+
);
|
222 |
+
} else {
|
223 |
+
$ftpMessage = $this->__(
|
224 |
+
"Your Magento installation allows the translation of URLs of categories and products."
|
225 |
+
);
|
226 |
+
$fieldset->addField(
|
227 |
+
'url_key_scope',
|
228 |
+
'note',
|
229 |
+
[
|
230 |
+
'label' => $this->__('Catalog URL key scope'),
|
231 |
+
'text' => $ftpMessage,
|
232 |
+
]
|
233 |
+
);
|
234 |
+
}
|
235 |
+
}
|
236 |
+
|
237 |
+
private function addDirectoryRights()
|
238 |
+
{
|
239 |
+
$fieldset = $this->form->addFieldset('directories', ['legend' => $this->__('Directory permissions')]);
|
240 |
+
|
241 |
+
foreach ($this->testVarSubdirectories as $type => $dir) {
|
242 |
+
if ($this->checkDirectory($dir)) {
|
243 |
+
$text = $this->__('Directory "%s" is writeable.', $dir);
|
244 |
+
} else {
|
245 |
+
$text = $this->__('Directory "%s" is not writeable.', $dir);
|
246 |
+
}
|
247 |
+
|
248 |
+
$fieldset->addField(
|
249 |
+
$type,
|
250 |
+
'note',
|
251 |
+
[
|
252 |
+
'label' => $this->__(str_replace('_', ' ', $type)),
|
253 |
+
'text' => $text,
|
254 |
+
]
|
255 |
+
);
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* @param string $dir
|
261 |
+
*/
|
262 |
+
private function checkDirectory($dir)
|
263 |
+
{
|
264 |
+
if (!is_dir($dir)) {
|
265 |
+
mkdir($dir, 0777, true);
|
266 |
+
}
|
267 |
+
|
268 |
+
return is_dir_writeable($dir);
|
269 |
+
}
|
270 |
+
}
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_System_Config_Form_Field_Registration_Status
|
4 |
+
extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
|
5 |
+
{
|
6 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
7 |
+
{
|
8 |
+
/** @var Eurotext_TranslationManager_Helper_Config $helper */
|
9 |
+
$helper = Mage::helper('eurotext_translationmanager/config');
|
10 |
+
if ($helper->isEmailSent()) {
|
11 |
+
$html = sprintf(
|
12 |
+
'<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5">%s</td></tr>',
|
13 |
+
$element->getHtmlId(),
|
14 |
+
$this->__('Your registration has been last saved at: %s', $helper->getEmailSentDate())
|
15 |
+
);
|
16 |
+
} else {
|
17 |
+
$html = sprintf(
|
18 |
+
'<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4>%s</h4><br>%s</td></tr>',
|
19 |
+
$element->getHtmlId(),
|
20 |
+
$this->__('Notice'),
|
21 |
+
$this->__(
|
22 |
+
'Before you can use our translation portal you must register with our service.'
|
23 |
+
) . '<br><br>' .
|
24 |
+
$this->__(
|
25 |
+
'This information is your personal access data for the Eurotext AG translation portal.<br/>Registration is free of charge. You will receive your personal access information within 24 hours (weekdays).'
|
26 |
+
) . '<br><br>' .
|
27 |
+
$this->__('Please enter all requested information!') . '<br><br>' .
|
28 |
+
'<b>' . $this->__('Important') . ':</b><br>' .
|
29 |
+
$this->__(
|
30 |
+
'Any information you provide is voluntary. Your data will be used for the purpose of logging in to the translation portal and for project processing in your dealings with Eurotext AG only. Your information will not be forwarded to third parties. You can request a deletion of your information at any time by sending an email to <a href="mailto:%1$s">%1$s</a>.',
|
31 |
+
'datenschutz@eurotext.de'
|
32 |
+
)
|
33 |
+
);
|
34 |
+
}
|
35 |
+
|
36 |
+
return $html;
|
37 |
+
}
|
38 |
+
}
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Block_System_Config_Form_Field_Text
|
4 |
+
extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
|
5 |
+
{
|
6 |
+
|
7 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
8 |
+
{
|
9 |
+
|
10 |
+
|
11 |
+
return sprintf('<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5">%s</td></tr>',
|
12 |
+
$element->getHtmlId(),
|
13 |
+
$this->__((string)$element->getFieldConfig()->text));
|
14 |
+
}
|
15 |
+
}
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Exception_FtpException extends Exception
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Helper_Category
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @param int[] $categoryIds
|
7 |
+
* @return int[]
|
8 |
+
*/
|
9 |
+
public function getProductIdsByCategoryIds($categoryIds)
|
10 |
+
{
|
11 |
+
$productCollection = Mage::getResourceModel('catalog/product_collection')
|
12 |
+
->joinField(
|
13 |
+
'category_id',
|
14 |
+
'catalog/category_product',
|
15 |
+
'category_id',
|
16 |
+
'product_id = entity_id',
|
17 |
+
null,
|
18 |
+
'left'
|
19 |
+
)
|
20 |
+
->addAttributeToFilter('category_id', ['in' => $categoryIds]);
|
21 |
+
|
22 |
+
return $productCollection->getAllIds();
|
23 |
+
}
|
24 |
+
}
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Helper_Config
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var int
|
7 |
+
*/
|
8 |
+
private $exportProductsMinPerFile = 6;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var int
|
12 |
+
*/
|
13 |
+
private $exportCategoriesMinPerFile = 6;
|
14 |
+
|
15 |
+
const EUROTEXT_CONFIG_REGISTER_EMAILSENT = 'eurotext/config/register_emailsent';
|
16 |
+
const EUROTEXT_CONFIG_REGISTER_EMAILSENT_DATE = 'eurotext/config/register_emailsent_date';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @return string
|
20 |
+
*/
|
21 |
+
public function getEmailSentDate()
|
22 |
+
{
|
23 |
+
return Mage::getStoreConfig(self::EUROTEXT_CONFIG_REGISTER_EMAILSENT_DATE);
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @return bool
|
28 |
+
*/
|
29 |
+
public function isEmailSent()
|
30 |
+
{
|
31 |
+
return Mage::getStoreConfigFlag(self::EUROTEXT_CONFIG_REGISTER_EMAILSENT);
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @return string
|
36 |
+
*/
|
37 |
+
public function getSalutation()
|
38 |
+
{
|
39 |
+
return Mage::getStoreConfig('eurotext/config/register_salutation');
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @return string
|
44 |
+
*/
|
45 |
+
public function getCompany()
|
46 |
+
{
|
47 |
+
return Mage::getStoreConfig('eurotext/config/register_company');
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @return string
|
52 |
+
*/
|
53 |
+
public function getFirstName()
|
54 |
+
{
|
55 |
+
return Mage::getStoreConfig('eurotext/config/register_firstname');
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @return string
|
60 |
+
*/
|
61 |
+
public function getLastName()
|
62 |
+
{
|
63 |
+
return Mage::getStoreConfig('eurotext/config/register_lastname');
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public function getName()
|
70 |
+
{
|
71 |
+
return $this->getFirstName() . ' ' . $this->getLastName();
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @return string
|
76 |
+
*/
|
77 |
+
public function getStreet()
|
78 |
+
{
|
79 |
+
return Mage::getStoreConfig('eurotext/config/register_street');
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* @return string
|
84 |
+
*/
|
85 |
+
public function getZip()
|
86 |
+
{
|
87 |
+
return Mage::getStoreConfig('eurotext/config/register_zip');
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @return string
|
92 |
+
*/
|
93 |
+
public function getCity()
|
94 |
+
{
|
95 |
+
return Mage::getStoreConfig('eurotext/config/register_city');
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* @return string
|
100 |
+
*/
|
101 |
+
public function getCountry()
|
102 |
+
{
|
103 |
+
return Mage::getStoreConfig('eurotext/config/register_country');
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @return string
|
108 |
+
*/
|
109 |
+
public function getEmail()
|
110 |
+
{
|
111 |
+
return Mage::getStoreConfig('eurotext/config/register_email');
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* @return string
|
116 |
+
*/
|
117 |
+
public function getTelephone()
|
118 |
+
{
|
119 |
+
return Mage::getStoreConfig('eurotext/config/register_telephone');
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* @return string
|
124 |
+
*/
|
125 |
+
public function getCustomerId()
|
126 |
+
{
|
127 |
+
return (int)Mage::getStoreConfig('eurotext/user_settings/customerid');
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @return string
|
132 |
+
*/
|
133 |
+
public function getFtpUsername()
|
134 |
+
{
|
135 |
+
return Mage::getStoreConfig('eurotext/user_settings/ftp_username');
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* @return string
|
140 |
+
*/
|
141 |
+
public function getFtpPassword()
|
142 |
+
{
|
143 |
+
return Mage::getStoreConfig('eurotext/user_settings/ftp_password');
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* @return int
|
148 |
+
*/
|
149 |
+
public function getCategoriesPerFile()
|
150 |
+
{
|
151 |
+
$catPerFile = (int)Mage::getStoreConfig('eurotext/export_settings/categories_per_file');
|
152 |
+
|
153 |
+
return $catPerFile > 0 ? max($catPerFile, $this->exportCategoriesMinPerFile) : 20;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* @return int
|
158 |
+
*/
|
159 |
+
public function getCmsPagePerFile()
|
160 |
+
{
|
161 |
+
$cmsEntitiesPerFile = (int)Mage::getStoreConfig('eurotext/export_settings/cmspages_per_file');
|
162 |
+
|
163 |
+
return $cmsEntitiesPerFile > 0 ? $cmsEntitiesPerFile : 20;
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* @return int
|
168 |
+
*/
|
169 |
+
public function getProductsPerFile()
|
170 |
+
{
|
171 |
+
$productsPerFile = (int)Mage::getStoreConfig('eurotext/export_settings/products_per_file');
|
172 |
+
|
173 |
+
return $productsPerFile > 0 ? max($productsPerFile, $this->exportProductsMinPerFile) : 20;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @return string
|
178 |
+
*/
|
179 |
+
public function getShopname()
|
180 |
+
{
|
181 |
+
return Mage::getStoreConfig('eurotext/config/register_shopname');
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* @return string
|
186 |
+
*/
|
187 |
+
public function getUrl()
|
188 |
+
{
|
189 |
+
return Mage::getStoreConfig('eurotext/config/register_url');
|
190 |
+
}
|
191 |
+
|
192 |
+
public function setEmailSent()
|
193 |
+
{
|
194 |
+
Mage::getConfig()->saveConfig(self::EUROTEXT_CONFIG_REGISTER_EMAILSENT, 1);
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* @param string $date
|
199 |
+
*/
|
200 |
+
public function setEmailSentDate($date)
|
201 |
+
{
|
202 |
+
Mage::getConfig()->saveConfig(self::EUROTEXT_CONFIG_REGISTER_EMAILSENT_DATE, $date);
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* @return string[]
|
207 |
+
*/
|
208 |
+
public function getRegistrationSettings()
|
209 |
+
{
|
210 |
+
return [
|
211 |
+
'register_shopname' => $this->getShopname(),
|
212 |
+
'register_url' => $this->getUrl(),
|
213 |
+
'register_email' => $this->getEmail(),
|
214 |
+
'register_salutation' => $this->getSalutation(),
|
215 |
+
'register_firstname' => $this->getFirstName(),
|
216 |
+
'register_lastname' => $this->getLastName(),
|
217 |
+
'register_company' => $this->getCompany(),
|
218 |
+
'register_street' => $this->getStreet(),
|
219 |
+
'register_zip' => $this->getZip(),
|
220 |
+
'register_city' => $this->getCity(),
|
221 |
+
'register_country' => $this->getCountry(),
|
222 |
+
'register_telephone' => $this->getTelephone(),
|
223 |
+
];
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* @return bool
|
228 |
+
*/
|
229 |
+
public function isDebugMode()
|
230 |
+
{
|
231 |
+
return Mage::getStoreConfigFlag('dev/log/ettm_debug');
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* @return bool
|
236 |
+
*/
|
237 |
+
public function isFtpUploadDisabled()
|
238 |
+
{
|
239 |
+
/*
|
240 |
+
* debug on, ftp on = upload on
|
241 |
+
* debug on, ftp off = upload off
|
242 |
+
* debug off, ftp on = upload on
|
243 |
+
* debug off, ftp off = upload on
|
244 |
+
*/
|
245 |
+
return $this->isDebugMode() && !Mage::getStoreConfigFlag('dev/log/ettm_ftp');
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* @return string
|
250 |
+
*/
|
251 |
+
public function getModuleVersion()
|
252 |
+
{
|
253 |
+
return (string)Mage::getConfig()->getNode()->modules->Eurotext_TranslationManager->version;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* @return string[]
|
258 |
+
*/
|
259 |
+
public function getCustomProductAttributesForExport()
|
260 |
+
{
|
261 |
+
return array_keys(Mage::getStoreConfig('eurotext/translation_manager/custom_product_attributes') ?: []);
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* @return string[]
|
266 |
+
*/
|
267 |
+
public function getCustomCategoryAttributesForExport()
|
268 |
+
{
|
269 |
+
return array_keys(Mage::getStoreConfig('eurotext/translation_manager/custom_category_attributes') ?: []);
|
270 |
+
}
|
271 |
+
}
|
@@ -1,566 +1,124 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
*/
|
4 |
class Eurotext_TranslationManager_Helper_Data extends Mage_Core_Helper_Abstract
|
5 |
{
|
6 |
-
|
7 |
-
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
private $exportProducts_minPerFile=6;
|
15 |
-
private $exportCategories_minPerFile=6;
|
16 |
|
17 |
-
|
18 |
-
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
public function getExportCategoriesMinPerFile()
|
26 |
-
{
|
27 |
-
return $this->exportCategories_minPerFile;
|
28 |
-
}
|
29 |
-
|
30 |
-
public function getDebugMode()
|
31 |
-
{
|
32 |
-
return Mage::getStoreConfigFlag(self::XML_PATH_EUROTEXT_DEBUGMODE);
|
33 |
-
}
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
}
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
}
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
$tbl_eav_attribute = Mage::getSingleton('core/resource')->getTableName('eav_attribute');
|
52 |
-
$tbl_catalog_eav_attribute = Mage::getSingleton('core/resource')->getTableName('catalog_eav_attribute');
|
53 |
-
|
54 |
-
$dbres = Mage::getSingleton('core/resource');
|
55 |
-
$dbr=$dbres->getConnection('core_read');
|
56 |
-
|
57 |
-
$result=$dbr->fetchAll("SELECT v.is_global, a.attribute_id, a.attribute_code FROM `".$tbl_eav_attribute."` a, `".$tbl_catalog_eav_attribute."` v WHERE (a.attribute_id=v.attribute_id) AND ((a.attribute_code='url_key') OR (a.attribute_code='url_path'))");
|
58 |
-
foreach($result as $row)
|
59 |
-
{
|
60 |
-
if ($row['is_global']>0)
|
61 |
-
{
|
62 |
-
return true;
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
return false;
|
67 |
-
}
|
68 |
|
69 |
/**
|
70 |
-
*
|
71 |
-
*
|
72 |
-
* else will create an increment
|
73 |
*
|
74 |
-
* @
|
75 |
*/
|
76 |
-
public function
|
77 |
{
|
78 |
-
|
79 |
-
|
80 |
-
} else {
|
81 |
-
return $url . '-1';
|
82 |
-
}
|
83 |
-
}
|
84 |
-
|
85 |
-
public function getLocaleInfoByMagentoLocale($locale)
|
86 |
-
{
|
87 |
-
$backendLocale = Mage::app()->getLocale()->getLocaleCode();
|
88 |
-
|
89 |
-
$rv=array();
|
90 |
-
$rv['locale']=$locale;
|
91 |
-
$rv['locale_eurotext']="-";
|
92 |
-
$rv['lang_name']=$this->__("Unsupported language");
|
93 |
-
$rv['supported']=false;
|
94 |
-
|
95 |
-
$dbres = Mage::getSingleton('core/resource');
|
96 |
-
$dbr= $dbres->getConnection('core_read');
|
97 |
-
|
98 |
-
$tbl_eurotext_languages = Mage::getSingleton('core/resource')->getTableName('eurotext_languages');
|
99 |
-
|
100 |
-
// Try current backend language first:
|
101 |
-
$localeInfos=$dbr->fetchAll("SELECT * FROM `".$tbl_eurotext_languages."` WHERE UPPER(locale_magento)=?",array(strtoupper($locale)));
|
102 |
-
if (count($localeInfos)>0)
|
103 |
-
{
|
104 |
-
$localeInfo=$localeInfos[0];
|
105 |
-
$rv['lang_name']=$localeInfo['lang_name'];
|
106 |
-
$rv['locale_eurotext']=$localeInfo['locale_eurotext'];
|
107 |
-
$rv['supported']=true;
|
108 |
-
|
109 |
-
return $rv;
|
110 |
-
}
|
111 |
-
|
112 |
-
return $rv;
|
113 |
-
}
|
114 |
-
|
115 |
-
public function getLocaleInfoByEurotextLocale($locale)
|
116 |
-
{
|
117 |
-
$backendLocale = Mage::app()->getLocale()->getLocaleCode();
|
118 |
-
|
119 |
-
$rv=array();
|
120 |
-
$rv['locale']=$locale;
|
121 |
-
$rv['locale_eurotext']=$locale;
|
122 |
-
$rv['lang_name']=$this->__("Unsupported language");
|
123 |
-
$rv['supported']=false;
|
124 |
-
|
125 |
-
$dbres = Mage::getSingleton('core/resource');
|
126 |
-
$dbr= $dbres->getConnection('core_read');
|
127 |
-
|
128 |
-
$tbl_eurotext_languages = Mage::getSingleton('core/resource')->getTableName('eurotext_languages');
|
129 |
-
|
130 |
-
// Try current backend language first:
|
131 |
-
$localeInfos=$dbr->fetchAll("SELECT * FROM `".$tbl_eurotext_languages."` WHERE UPPER(locale_eurotext)=?",array(strtoupper($locale)));
|
132 |
-
if (count($localeInfos)>0)
|
133 |
-
{
|
134 |
-
$localeInfo=$localeInfos[0];
|
135 |
-
$rv['locale']=$localeInfo['locale_magento'];
|
136 |
-
$rv['lang_name']=$localeInfo['lang_name'];
|
137 |
-
$rv['locale_eurotext']=$localeInfo['locale_eurotext'];
|
138 |
-
$rv['supported']=true;
|
139 |
-
|
140 |
-
return $rv;
|
141 |
-
}
|
142 |
-
|
143 |
-
return $rv;
|
144 |
-
}
|
145 |
-
|
146 |
-
|
147 |
-
public function getRegistrationRecipient()
|
148 |
-
{
|
149 |
-
$rv=array();
|
150 |
-
|
151 |
-
if ($this->getDebugMode())
|
152 |
-
{
|
153 |
-
$rv["email"]=$this->debug_registration_email;
|
154 |
-
$rv["name"]=$this->debug_registration_email_name;
|
155 |
-
}
|
156 |
-
else
|
157 |
-
{
|
158 |
-
$rv["email"]=$this->live_registration_email;
|
159 |
-
$rv["name"]=$this->live_registration_email_name;
|
160 |
-
}
|
161 |
-
|
162 |
-
return $rv;
|
163 |
-
}
|
164 |
-
|
165 |
-
public function getHelpUrl()
|
166 |
-
{
|
167 |
-
return $this->help_url;
|
168 |
-
}
|
169 |
-
|
170 |
-
public function saveSetting($key, $val)
|
171 |
-
{
|
172 |
-
$dbres = Mage::getSingleton('core/resource');
|
173 |
-
$dbw= $dbres->getConnection('core_write');
|
174 |
-
|
175 |
-
$tbl_eurotext_config = Mage::getSingleton('core/resource')->getTableName('eurotext_config');
|
176 |
|
177 |
-
$
|
178 |
-
|
179 |
-
|
180 |
-
$dbw->query("UPDATE `".$tbl_eurotext_config."` SET config_value=? WHERE config_key=?;",array($val,$key));
|
181 |
-
}
|
182 |
-
|
183 |
-
public function log($message, $level = Zend_Log::DEBUG){
|
184 |
-
if($this->getDebugMode()) {
|
185 |
-
Mage::log($message, $level, 'eurotext.log', true);
|
186 |
-
} elseif ($level < Zend_Log::ERR) {
|
187 |
-
Mage::log($message, $level, 'eurotext_fatal.log', true);
|
188 |
}
|
189 |
-
}
|
190 |
-
|
191 |
-
public function openFtpConnection()
|
192 |
-
{
|
193 |
-
if (!function_exists("ftp_connect")) {
|
194 |
-
$this->log('There is no FTP Client available: ftp_connect does not exist.', Zend_Log::CRIT);
|
195 |
-
|
196 |
-
return false;
|
197 |
}
|
198 |
-
|
199 |
-
|
200 |
-
$ftp_host=$this->live_ftp_host;
|
201 |
-
$ftp_port=$this->live_ftp_port;
|
202 |
|
203 |
-
|
204 |
-
|
205 |
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
{
|
210 |
-
$helper=Mage::helper('eurotext_translationmanager');
|
211 |
-
$et_username=$helper->getSetting("eurotext_username","");
|
212 |
-
$et_password=Mage::helper('core')->decrypt($helper->getSetting("eurotext_password",""));
|
213 |
-
|
214 |
-
$ftp_username=$et_username;
|
215 |
-
$ftp_password=$et_password;
|
216 |
-
|
217 |
-
|
218 |
-
$rv=array();
|
219 |
-
$rv['ok']=false;
|
220 |
-
$rv['statusmessage']="Unknown error";
|
221 |
-
|
222 |
-
if (trim($ftp_username)=="")
|
223 |
-
{
|
224 |
-
$this->log('Login data is not set.', Zend_Log::ERR);
|
225 |
-
$rv['statusmessage']="<span class='et_error'>".$this->__("There seems to be a problem with your login data. Please check username and password!")."</span>";
|
226 |
-
}
|
227 |
-
else
|
228 |
-
{
|
229 |
-
$ftpConn=$this->openFtpConnection();
|
230 |
-
if ($ftpConn===false)
|
231 |
-
{
|
232 |
-
// Could not connect to host
|
233 |
-
$this->log('Could not connect to Translation Portal Server.', Zend_Log::ERR);
|
234 |
-
$rv['statusmessage']="<span class='et_error'>".$this->__("Could not connect to server. Could be a temporary error or firewall problem. You could also check for a new module version.")."</span>";
|
235 |
-
}
|
236 |
-
else
|
237 |
-
{
|
238 |
-
// Login:
|
239 |
-
if (@ftp_login($ftpConn,$ftp_username,$ftp_password))
|
240 |
-
{
|
241 |
-
$this->log('Translation Portal Server successfully connected.', Zend_Log::INFO);
|
242 |
-
$rv['statusmessage']="<span class='et_ok'>".$this->__("Translation portal successfully connected!")."</span>";
|
243 |
-
$rv['ok']=true;
|
244 |
-
}
|
245 |
-
else
|
246 |
-
{
|
247 |
-
$this->log('Could not login to Translation Portal Server.', Zend_Log::ERR);
|
248 |
-
$rv['statusmessage']="<span class='et_error'>".$this->__("There seems to be a problem with your login data. Please check username and password!")."</span>";
|
249 |
-
}
|
250 |
-
|
251 |
-
ftp_close($ftpConn);
|
252 |
-
}
|
253 |
-
}
|
254 |
-
|
255 |
-
return $rv;
|
256 |
-
}
|
257 |
-
|
258 |
-
public function getSetting($key, $defaultValue="")
|
259 |
-
{
|
260 |
-
$dbres = Mage::getSingleton('core/resource');
|
261 |
-
$dbr= $dbres->getConnection('core_read');
|
262 |
-
|
263 |
-
$tbl_eurotext_config = Mage::getSingleton('core/resource')->getTableName('eurotext_config');
|
264 |
-
|
265 |
-
$result=$dbr->fetchOne("SELECT config_value FROM `".$tbl_eurotext_config."` WHERE config_key=?;",array($key));
|
266 |
-
if ($result!==false)
|
267 |
-
{
|
268 |
-
return $result;
|
269 |
-
}
|
270 |
-
else
|
271 |
-
{
|
272 |
-
return $defaultValue;
|
273 |
-
}
|
274 |
-
}
|
275 |
-
|
276 |
-
public function ajaxexportAction_CollectLangfiles($project)
|
277 |
-
{
|
278 |
-
$dbres = Mage::getSingleton('core/resource');
|
279 |
-
$dbw=$dbres->getConnection('core_write');
|
280 |
-
|
281 |
-
$project_id = $this->sanitize($project['id']);
|
282 |
-
|
283 |
-
$dbw->query("UPDATE `".$this->getTableName("eurotext_csv")."` SET deleteflag=1 WHERE project_id=".$project_id);
|
284 |
-
|
285 |
-
$base_dir=Mage::getBaseDir('app');
|
286 |
-
$this->ajaxexportAction_CollectLangfiles2($dbw,$project,$base_dir);
|
287 |
-
|
288 |
-
$dbw->query("DELETE FROM `".$this->getTableName("eurotext_csv")."` WHERE deleteflag=1 AND project_id=".$project_id);
|
289 |
-
}
|
290 |
-
|
291 |
-
public function ajaxexportAction_CollectLangfilesLocaleCSV($dbw,$project,$locale,$localeFolder)
|
292 |
-
{
|
293 |
-
|
294 |
-
$project_id = intval($this->sanitize($project['id']));
|
295 |
-
|
296 |
-
$pathNames=scandir($localeFolder);
|
297 |
-
foreach($pathNames as $path)
|
298 |
-
{
|
299 |
-
$full_path=$localeFolder.DS.$path;
|
300 |
-
if ((is_file($full_path)) && (stripos($path,".csv")!==false))
|
301 |
-
{
|
302 |
-
$base_dir=Mage::getBaseDir('app');
|
303 |
-
$filename=substr($full_path,strlen($base_dir));
|
304 |
-
|
305 |
-
$line_hash=sha1($project_id."_".$filename);
|
306 |
-
$dbw->query("INSERT IGNORE INTO `".$this->getTableName('eurotext_csv')."` (line_hash,project_id,filename,locale_dst) VALUES (?,?,?,?);",array($line_hash,$project_id,$filename,$locale));
|
307 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_csv')."` SET deleteflag=0 WHERE line_hash=?;",array($line_hash));
|
308 |
-
}
|
309 |
-
}
|
310 |
-
}
|
311 |
-
|
312 |
-
public function ajaxexportAction_CollectLangfilesLocale($dbw,$project,$localeFolder)
|
313 |
-
{
|
314 |
-
$pathNames=scandir($localeFolder);
|
315 |
-
foreach($pathNames as $path)
|
316 |
-
{
|
317 |
-
$full_path=$localeFolder.DS.$path;
|
318 |
-
if (($path==".") || ($path==".."))
|
319 |
-
{
|
320 |
-
// Ignore
|
321 |
-
}
|
322 |
-
elseif (is_dir($full_path))
|
323 |
-
{
|
324 |
-
$this->ajaxexportAction_CollectLangfilesLocaleCSV($dbw,$project,$path,$full_path);
|
325 |
-
}
|
326 |
-
}
|
327 |
-
}
|
328 |
-
|
329 |
-
public function ajaxexportAction_CollectLangfiles2($dbw,$project,$curdir)
|
330 |
-
{
|
331 |
-
$pathNames=scandir($curdir);
|
332 |
-
foreach($pathNames as $path)
|
333 |
-
{
|
334 |
-
$full_path=$curdir.DS.$path;
|
335 |
-
if (($path==".") || ($path==".."))
|
336 |
-
{
|
337 |
-
// Ignore
|
338 |
-
}
|
339 |
-
elseif (is_dir($full_path))
|
340 |
-
{
|
341 |
-
if ($path=="locale")
|
342 |
-
{
|
343 |
-
$this->ajaxexportAction_CollectLangfilesLocale($dbw,$project,$full_path);
|
344 |
-
}
|
345 |
-
else
|
346 |
-
{
|
347 |
-
$this->ajaxexportAction_CollectLangfiles2($dbw,$project,$full_path);
|
348 |
-
}
|
349 |
-
}
|
350 |
-
}
|
351 |
-
}
|
352 |
-
|
353 |
-
public function ajaxexportAction_CollectEMailTemplates2($helper, $dbw, $project, $locale, $localeFolder)
|
354 |
-
{
|
355 |
-
$project_id = intval($this->sanitize($project['id']));
|
356 |
-
|
357 |
-
$templates=$helper->getDirectoryContent($localeFolder,true,true,false);
|
358 |
-
foreach($templates as $template)
|
359 |
-
{
|
360 |
-
$filename=$template['full_path'];
|
361 |
-
if ($helper->endsWith(strtolower($filename),".html"))
|
362 |
-
{
|
363 |
-
$short_filename=substr($filename,strlen($localeFolder));
|
364 |
-
$short_filename=substr($filename,strlen($localeFolder));
|
365 |
-
|
366 |
-
$file_hash=sha1($project_id."_".$locale."_".$short_filename);
|
367 |
-
|
368 |
-
$dbw->query("INSERT IGNORE INTO `".$this->getTableName('eurotext_emailtemplates')."` (file_hash,project_id,filename,locale_dst) VALUES (?,?,?,?);",array($file_hash,$project_id,$short_filename,$locale));
|
369 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_emailtemplates')."` SET deleteflag=0 WHERE file_hash=?;",array($file_hash));
|
370 |
-
}
|
371 |
-
}
|
372 |
-
}
|
373 |
-
|
374 |
-
public function ajaxexportAction_CollectEMailTemplates($project)
|
375 |
-
{
|
376 |
-
$dbres = Mage::getSingleton('core/resource');
|
377 |
-
$dbw=$dbres->getConnection('core_write');
|
378 |
-
|
379 |
-
$project_id = intval($this->sanitize($project['id']));
|
380 |
-
|
381 |
-
$dbw->query("UPDATE `".$this->getTableName("eurotext_emailtemplates")."` SET deleteflag=1 WHERE project_id=".$project_id);
|
382 |
-
|
383 |
-
$baseLocaleFolder=Mage::getBaseDir('locale');
|
384 |
-
|
385 |
-
$helper_et=Mage::helper('eurotext_translationmanager/eurotext');
|
386 |
-
$localeFolders=$helper_et->getDirectoryContent($baseLocaleFolder,false,false,true);
|
387 |
-
foreach($localeFolders as $localeFolder)
|
388 |
-
{
|
389 |
-
$templateFolder=$localeFolder['full_path'].DS."template";
|
390 |
-
if (is_dir($templateFolder))
|
391 |
-
{
|
392 |
-
$this->ajaxexportAction_CollectEMailTemplates2($helper_et, $dbw,$project, $localeFolder['name'], $templateFolder);
|
393 |
-
}
|
394 |
-
}
|
395 |
-
|
396 |
-
$dbw->query("DELETE FROM `".$this->getTableName("eurotext_emailtemplates")."` WHERE deleteflag=1 AND project_id=".$project_id);
|
397 |
-
}
|
398 |
-
|
399 |
-
private function getTableName($tblName)
|
400 |
-
{
|
401 |
-
return Mage::getSingleton('core/resource')->getTableName($tblName);
|
402 |
-
}
|
403 |
-
|
404 |
-
// Gets an array with the ids of all children of $cat_id
|
405 |
-
public function getAllSubCategories($cat_id, $recurse=true)
|
406 |
-
{
|
407 |
-
$rv=array();
|
408 |
-
|
409 |
-
$_cat=Mage::getModel("catalog/category")->load($cat_id);
|
410 |
-
|
411 |
-
$subcat_ids_str=$_cat->getChildren();
|
412 |
-
|
413 |
-
// Free memory:
|
414 |
-
unset($_cat);
|
415 |
-
$_cat=null;
|
416 |
-
|
417 |
-
$subcat_ids=array();
|
418 |
-
if (strlen($subcat_ids_str)>0)
|
419 |
-
{
|
420 |
-
$subcat_ids=explode(",",$subcat_ids_str);
|
421 |
-
|
422 |
-
$rv=array_merge($rv,$subcat_ids);
|
423 |
-
|
424 |
-
if ($recurse)
|
425 |
-
{
|
426 |
-
foreach($subcat_ids as $subcat_id)
|
427 |
-
{
|
428 |
-
$rv=array_merge($rv,Mage::helper('eurotext_translationmanager')->getAllSubCategories($subcat_id,true));
|
429 |
-
}
|
430 |
}
|
431 |
}
|
432 |
|
433 |
-
return
|
434 |
}
|
435 |
|
436 |
-
|
437 |
-
|
|
|
|
|
|
|
438 |
{
|
439 |
-
$
|
440 |
-
|
441 |
-
$_cat=Mage::getModel("catalog/category")->load($cat_id);
|
442 |
-
|
443 |
-
$node['childs']=array();
|
444 |
-
$node['hasChildren']=false;
|
445 |
|
446 |
-
|
447 |
-
{
|
448 |
-
$node['id']=1;
|
449 |
-
$node['name']=$this->__("(All products)"); // ." (".$cat_id.")";
|
450 |
-
}
|
451 |
-
else
|
452 |
-
{
|
453 |
-
$node['id']=$cat_id;
|
454 |
-
$node['name']=$_cat->getName(); // ." (".$cat_id.")";
|
455 |
-
}
|
456 |
-
|
457 |
-
// get children ids (comma-seperated list as string)
|
458 |
-
$subcat_ids_str=$_cat->getChildren();
|
459 |
-
|
460 |
-
// Free memory:
|
461 |
-
unset($_cat);
|
462 |
-
$_cat=null;
|
463 |
-
|
464 |
-
$subcat_ids=array();
|
465 |
-
if (strlen($subcat_ids_str)>0)
|
466 |
-
{
|
467 |
-
$subcat_ids=explode(",",$subcat_ids_str);
|
468 |
-
}
|
469 |
-
|
470 |
-
if (count($subcat_ids)>0)
|
471 |
-
{
|
472 |
-
$node['hasChildren']=true;
|
473 |
-
|
474 |
-
if (in_array($cat_id, $open_catids))
|
475 |
-
{
|
476 |
-
// Load sub categories:
|
477 |
-
foreach($subcat_ids as $subcat_id)
|
478 |
-
{
|
479 |
-
$childItem=$this->getCategoryTree($subcat_id,$open_catids);
|
480 |
-
array_push($node['childs'],$childItem);
|
481 |
-
}
|
482 |
-
}
|
483 |
-
}
|
484 |
-
|
485 |
-
return $node;
|
486 |
}
|
487 |
|
488 |
-
|
|
|
|
|
|
|
|
|
489 |
{
|
490 |
-
$
|
491 |
-
|
492 |
-
$search_catids=Mage::helper('eurotext_translationmanager')->getAllSubCategories($cat_id); // Get the IDs of all children (direct+indirect)
|
493 |
-
array_push($search_catids,$cat_id); // add selected category to list
|
494 |
-
|
495 |
-
// Filter to products which are assigned to any category in $search_catids:
|
496 |
-
$sql_categoryfilter=" AND e.entity_id IN (SELECT cat.product_id FROM catalog_category_product cat WHERE cat.category_id IN (".implode(",",$search_catids)."))";
|
497 |
|
498 |
-
$
|
499 |
-
$res1=$dbr->fetchAll($sql1);
|
500 |
-
|
501 |
-
$rv=array();
|
502 |
-
for($i=0; $i<count($res1); $i++)
|
503 |
-
{
|
504 |
-
array_push($rv,$res1[$i]['entity_id']);
|
505 |
-
}
|
506 |
-
|
507 |
-
return $rv;
|
508 |
}
|
509 |
|
510 |
-
|
511 |
-
// checked: all products of the category are selected for translation
|
512 |
-
// indeterminate: some products of the category are selected for translation
|
513 |
-
// unchecked: no products are selected for translation
|
514 |
-
public function getTreeNodeTranslationState($dbr,$cat_id, $project_id)
|
515 |
{
|
516 |
-
$
|
|
|
|
|
|
|
517 |
|
518 |
-
|
519 |
-
array_push($search_catids,$cat_id); // add selected category to list
|
520 |
-
|
521 |
-
// Filter to products which are assigned to any category in $search_catids:
|
522 |
-
if ($cat_id>1)
|
523 |
-
{
|
524 |
-
$sql_categoryfilter=" AND e.entity_id IN (SELECT cat.product_id FROM catalog_category_product cat WHERE cat.category_id IN (".implode(",",$search_catids)."))";
|
525 |
}
|
526 |
|
527 |
-
$
|
528 |
-
|
529 |
-
//die($sql1);
|
530 |
-
$res1=$dbr->fetchAll($sql1);
|
531 |
-
$translatedProducts=$res1[0]['cnt'];
|
532 |
|
533 |
-
$
|
534 |
-
|
535 |
-
$res2=$dbr->fetchAll($sql2);
|
536 |
-
$allProducts=$res2[0]['cnt'];
|
537 |
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
}
|
542 |
-
else if ($translatedProducts==$allProducts)
|
543 |
-
{
|
544 |
-
return "checked";
|
545 |
-
}
|
546 |
-
else if ($translatedProducts==0)
|
547 |
-
{
|
548 |
-
return "unchecked";
|
549 |
-
}
|
550 |
-
else if ($translatedProducts<$allProducts)
|
551 |
-
{
|
552 |
-
return "indeterminate";
|
553 |
-
}
|
554 |
-
else
|
555 |
-
{
|
556 |
-
return "unchecked";
|
557 |
-
}
|
558 |
}
|
559 |
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
}
|
566 |
}
|
1 |
<?php
|
2 |
+
|
|
|
3 |
class Eurotext_TranslationManager_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
{
|
5 |
+
/**
|
6 |
+
* @var string
|
7 |
+
*/
|
8 |
+
private $helpUrl = "http://www.eurotext.de";
|
9 |
|
10 |
+
/**
|
11 |
+
* @var string
|
12 |
+
*/
|
13 |
+
private $liveRegistrationEmail = "magento@eurotext.de";
|
|
|
|
|
|
|
14 |
|
15 |
+
/**
|
16 |
+
* @var string
|
17 |
+
*/
|
18 |
+
private $liveRegistrationEmailName = "Eurotext Magento (Live)";
|
19 |
|
20 |
+
/**
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
private $debugRegistrationEmail = "debug@eurotext.de";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
/**
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
private $debugRegistrationEmailName = "Eurotext Magento (Debug)";
|
|
|
29 |
|
30 |
+
/**
|
31 |
+
* @var Eurotext_TranslationManager_Helper_Config
|
32 |
+
*/
|
33 |
+
private $configHelper;
|
|
|
34 |
|
35 |
+
public function __construct()
|
36 |
+
{
|
37 |
+
$this->configHelper = Mage::helper('eurotext_translationmanager/config');
|
38 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
/**
|
41 |
+
* Prüft, ob der URL-Key von Produkt/Kategorie auf "global" statt "storeview" steht
|
42 |
+
* Liefert true, zurück wenn mindestens ein Scope NICHT(!) auf "storeview" steht
|
|
|
43 |
*
|
44 |
+
* @return bool
|
45 |
*/
|
46 |
+
public function urlKeyScopeIsGlobal()
|
47 |
{
|
48 |
+
$categoryAttributes = Mage::getResourceModel('catalog/category_attribute_collection')
|
49 |
+
->addFieldToFilter('attribute_code', ['in' => ['url_key', 'url_path']]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
+
foreach ($categoryAttributes as $attribute) {
|
52 |
+
if ($attribute->getIsGlobal() != Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL) {
|
53 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
|
|
|
|
|
|
|
|
56 |
|
57 |
+
$productAttributes = Mage::getResourceModel('catalog/product_attribute_collection')
|
58 |
+
->addFieldToFilter('attribute_code', ['in' => ['url_key', 'url_path']]);
|
59 |
|
60 |
+
foreach ($productAttributes as $attribute) {
|
61 |
+
if ($attribute->getIsGlobal() != Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL) {
|
62 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
}
|
65 |
|
66 |
+
return true;
|
67 |
}
|
68 |
|
69 |
+
/**
|
70 |
+
* @param string $locale
|
71 |
+
* @return string[]
|
72 |
+
*/
|
73 |
+
public function getLocaleInfoByMagentoLocale($locale)
|
74 |
{
|
75 |
+
$languages = Mage::getModel('eurotext_translationmanager/eurotextLanguages');
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
+
return $languages->getInfoByMageLocale($locale);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
|
80 |
+
/**
|
81 |
+
* @param string $locale
|
82 |
+
* @return string[]
|
83 |
+
*/
|
84 |
+
public function getLocaleInfoByEurotextLocale($locale)
|
85 |
{
|
86 |
+
$languages = Mage::getModel('eurotext_translationmanager/eurotextLanguages');
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
+
return $languages->getInfoByEurotext($locale);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
|
91 |
+
public function getRegistrationRecipient()
|
|
|
|
|
|
|
|
|
92 |
{
|
93 |
+
$recipient = [];
|
94 |
+
if ($this->configHelper->isDebugMode()) {
|
95 |
+
$recipient["email"] = $this->debugRegistrationEmail;
|
96 |
+
$recipient["name"] = $this->debugRegistrationEmailName;
|
97 |
|
98 |
+
return $recipient;
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
|
101 |
+
$recipient["email"] = $this->liveRegistrationEmail;
|
102 |
+
$recipient["name"] = $this->liveRegistrationEmailName;
|
|
|
|
|
|
|
103 |
|
104 |
+
return $recipient;
|
105 |
+
}
|
|
|
|
|
106 |
|
107 |
+
public function getHelpUrl()
|
108 |
+
{
|
109 |
+
return $this->helpUrl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
}
|
111 |
|
112 |
+
/**
|
113 |
+
* @param string $message
|
114 |
+
* @param int $level
|
115 |
+
*/
|
116 |
+
public function log($message, $level = Zend_Log::DEBUG)
|
117 |
+
{
|
118 |
+
if ($this->configHelper->isDebugMode()) {
|
119 |
+
Mage::log($message, $level, 'eurotext.log', true);
|
120 |
+
} elseif ($level < Zend_Log::ERR) {
|
121 |
+
Mage::log($message, $level, 'eurotext_fatal.log', true);
|
122 |
+
}
|
123 |
}
|
124 |
}
|
@@ -1,247 +1,186 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
// allow utf8-detection: öäü€
|
4 |
-
|
5 |
-
// Helper Functions
|
6 |
class Eurotext_TranslationManager_Helper_Eurotext extends Mage_Core_Helper_Abstract
|
7 |
-
{
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
|
14 |
-
$absolutes =
|
15 |
foreach ($parts as $part) {
|
16 |
-
if ('.' == $part)
|
|
|
|
|
17 |
if ('..' == $part) {
|
18 |
array_pop($absolutes);
|
19 |
} else {
|
20 |
$absolutes[] = $part;
|
21 |
}
|
22 |
}
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
else
|
72 |
-
{
|
73 |
-
$str2.="-";
|
74 |
-
}
|
75 |
-
}
|
76 |
-
|
77 |
-
while(stripos($str2,"--")!==false)
|
78 |
-
{
|
79 |
-
$str2=str_replace("--","-",$str2);
|
80 |
-
}
|
81 |
-
|
82 |
-
while(stripos($str2,"..")!==false)
|
83 |
-
{
|
84 |
-
$str2=str_replace("..",".",$str2);
|
85 |
-
}
|
86 |
-
|
87 |
-
return $str2;
|
88 |
-
}
|
89 |
-
|
90 |
-
// Tests if $haystack ends with $needle
|
91 |
-
public function endsWith($haystack, $needle)
|
92 |
-
{
|
93 |
-
if (strlen($haystack)>=strlen($needle))
|
94 |
-
{
|
95 |
-
$lastOfHaystack=substr($haystack,-strlen($needle));
|
96 |
-
return ($lastOfHaystack==$needle);
|
97 |
-
}
|
98 |
-
|
99 |
-
return false;
|
100 |
-
}
|
101 |
-
|
102 |
-
public function removeTrailingDirectorySeparator($path)
|
103 |
-
{
|
104 |
-
if ($this->endsWith($path,DIRECTORY_SEPARATOR))
|
105 |
-
{
|
106 |
-
return substr($path,0,strlen($path)-1);
|
107 |
-
}
|
108 |
-
|
109 |
-
return $path;
|
110 |
-
}
|
111 |
-
|
112 |
-
public function compareFileItems($a, $b)
|
113 |
-
{
|
114 |
-
return strcmp($a['full_path'],$b['full_path']);
|
115 |
-
}
|
116 |
-
|
117 |
-
public function getDirectoryContent($directory, $recurse=false, $enumerateFiles=true, $enumerateDirs=true, $sortResult=true)
|
118 |
-
{
|
119 |
-
$result=array();
|
120 |
-
|
121 |
-
$dirpath=$this->removeTrailingDirectorySeparator($directory);
|
122 |
-
|
123 |
-
$dir=opendir($dirpath);
|
124 |
-
if ($dir)
|
125 |
-
{
|
126 |
-
while (false !== ($item = readdir($dir)))
|
127 |
-
{
|
128 |
-
$full_path=$dirpath.DIRECTORY_SEPARATOR.$item;
|
129 |
-
if ( ($item==".") || ($item=="..") )
|
130 |
-
{
|
131 |
-
// Skip
|
132 |
-
}
|
133 |
-
elseif ( (is_file($full_path)) && ($enumerateFiles) )
|
134 |
-
{
|
135 |
-
$rvItem=array();
|
136 |
-
$rvItem['full_path']=$full_path;
|
137 |
-
$rvItem['name']=$item;
|
138 |
-
$rvItem['type']="file";
|
139 |
-
array_push($result,$rvItem);
|
140 |
-
}
|
141 |
-
elseif (is_dir($full_path))
|
142 |
-
{
|
143 |
-
if ($enumerateDirs)
|
144 |
-
{
|
145 |
-
$rvItem=array();
|
146 |
-
$rvItem['full_path']=$full_path;
|
147 |
-
$rvItem['name']=$item;
|
148 |
-
$rvItem['type']="dir";
|
149 |
-
array_push($result,$rvItem);
|
150 |
-
}
|
151 |
-
|
152 |
-
if ($recurse)
|
153 |
-
{
|
154 |
-
$subresult=$this->getDirectoryContent($full_path,$recurse,$enumerateFiles, $enumerateDirs, false);
|
155 |
-
$result=array_merge($result,$subresult);
|
156 |
-
}
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
closedir($dir);
|
161 |
-
}
|
162 |
-
|
163 |
-
if ($sortResult)
|
164 |
-
{
|
165 |
-
usort($result, array($this, "compareFileItems"));
|
166 |
-
}
|
167 |
-
|
168 |
-
return $result;
|
169 |
-
}
|
170 |
-
|
171 |
-
public function extractZip($zipFile, $dstDirectory)
|
172 |
-
{
|
173 |
-
$dirpath=$this->removeTrailingDirectorySeparator($dstDirectory);
|
174 |
-
|
175 |
-
$zip = new ZipArchive;
|
176 |
-
if ($zip->open($zipFile)!==true)
|
177 |
-
{
|
178 |
-
return false;
|
179 |
-
}
|
180 |
-
|
181 |
-
$rv=true;
|
182 |
-
|
183 |
-
if (!$zip->extractTo($dirpath))
|
184 |
-
{
|
185 |
-
$rv=false;
|
186 |
-
}
|
187 |
-
|
188 |
-
$zip->close();
|
189 |
-
|
190 |
-
return $rv;
|
191 |
-
}
|
192 |
-
|
193 |
-
public function zipFolder($directory, $zipFile, $comment="")
|
194 |
-
{
|
195 |
|
196 |
$helper = Mage::helper('eurotext_translationmanager');
|
197 |
-
|
198 |
-
{
|
199 |
$helper->log('ZipArchive Class does not exist!', Zend_Log::CRIT);
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
|
|
205 |
|
206 |
$mode = file_exists($zipFile) ? ZipArchive::OVERWRITE : ZipArchive::CREATE;
|
207 |
|
208 |
$zip = new ZipArchive;
|
209 |
-
$zipOpeningResult = $zip->open($zipFile
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
$helper->log('
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
3 |
class Eurotext_TranslationManager_Helper_Eurotext extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
// Like realpath, but also works on non-existing paths
|
6 |
+
// Source: http://de2.php.net/manual/de/function.realpath.php#84012
|
7 |
+
public function getDirectoryFromPath($path)
|
8 |
+
{
|
9 |
+
$rpath = $this->getAbsolutePath($path);
|
10 |
+
$lastSep = strrpos($rpath, DIRECTORY_SEPARATOR);
|
11 |
+
if ($lastSep >= 0) {
|
12 |
+
return substr($rpath, 0, $lastSep);
|
13 |
+
} else {
|
14 |
+
return $path;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
// Extract directory-part of path
|
19 |
+
// "/foo/bar/filename.dat" => "/foo/bar"
|
20 |
+
// "/foo/bar/" => "/foo/bar"
|
21 |
+
// "/foo/bar" => "/foo"
|
22 |
+
|
23 |
+
public function getAbsolutePath($path)
|
24 |
+
{
|
25 |
+
$path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path);
|
26 |
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
|
27 |
+
$absolutes = [];
|
28 |
foreach ($parts as $part) {
|
29 |
+
if ('.' == $part) {
|
30 |
+
continue;
|
31 |
+
}
|
32 |
if ('..' == $part) {
|
33 |
array_pop($absolutes);
|
34 |
} else {
|
35 |
$absolutes[] = $part;
|
36 |
}
|
37 |
}
|
38 |
+
|
39 |
+
return DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $absolutes);
|
40 |
+
}
|
41 |
+
|
42 |
+
// Tests if $haystack ends with $needle
|
43 |
+
public function compareFileItems($a, $b)
|
44 |
+
{
|
45 |
+
return strcmp($a['full_path'], $b['full_path']);
|
46 |
+
}
|
47 |
+
|
48 |
+
public function extractZip($zipFile, $dstDirectory)
|
49 |
+
{
|
50 |
+
$dirpath = $this->removeTrailingDirectorySeparator($dstDirectory);
|
51 |
+
|
52 |
+
$zip = new ZipArchive;
|
53 |
+
if ($zip->open($zipFile) !== true) {
|
54 |
+
return false;
|
55 |
+
}
|
56 |
+
|
57 |
+
$rv = true;
|
58 |
+
|
59 |
+
if (!$zip->extractTo($dirpath)) {
|
60 |
+
$rv = false;
|
61 |
+
}
|
62 |
+
|
63 |
+
$zip->close();
|
64 |
+
|
65 |
+
return $rv;
|
66 |
+
}
|
67 |
+
|
68 |
+
public function removeTrailingDirectorySeparator($path)
|
69 |
+
{
|
70 |
+
return rtrim($path, DS);
|
71 |
+
}
|
72 |
+
|
73 |
+
public function endsWith($haystack, $needle)
|
74 |
+
{
|
75 |
+
if (strlen($haystack) >= strlen($needle)) {
|
76 |
+
$lastOfHaystack = substr($haystack, -strlen($needle));
|
77 |
+
|
78 |
+
return ($lastOfHaystack == $needle);
|
79 |
+
}
|
80 |
+
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function zipFolder($directory, $zipFile, $comment = "")
|
85 |
+
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
$helper = Mage::helper('eurotext_translationmanager');
|
88 |
+
if (!class_exists("ZipArchive")) {
|
|
|
89 |
$helper->log('ZipArchive Class does not exist!', Zend_Log::CRIT);
|
90 |
+
|
91 |
+
return false;
|
92 |
+
}
|
93 |
+
|
94 |
+
$dirpath = $this->removeTrailingDirectorySeparator($directory);
|
95 |
+
$items = $this->getDirectoryContent($dirpath, true);
|
96 |
|
97 |
$mode = file_exists($zipFile) ? ZipArchive::OVERWRITE : ZipArchive::CREATE;
|
98 |
|
99 |
$zip = new ZipArchive;
|
100 |
+
$zipOpeningResult = $zip->open($zipFile, $mode);
|
101 |
+
|
102 |
+
if ($zipOpeningResult !== true) {
|
103 |
+
$helper->log('Could not open ZIP Archive at ' . $zipFile . '!', Zend_Log::CRIT);
|
104 |
+
$helper->log('Reason: ' . print_r($zipOpeningResult, 1), Zend_Log::CRIT);
|
105 |
+
|
106 |
+
return false;
|
107 |
+
}
|
108 |
+
|
109 |
+
if ($comment != "") {
|
110 |
+
$zip->setArchiveComment($comment);
|
111 |
+
}
|
112 |
+
|
113 |
+
foreach ($items as $item) {
|
114 |
+
if ($item['full_path'] == $zipFile) {
|
115 |
+
// Skip
|
116 |
+
} else {
|
117 |
+
$inZipPath = substr($item['full_path'], strlen($dirpath) + 1);
|
118 |
+
|
119 |
+
if ($item['type'] == "dir") {
|
120 |
+
$zip->addEmptyDir($inZipPath);
|
121 |
+
} else {
|
122 |
+
$zip->addFile($item['full_path'], $inZipPath);
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
$zip->close();
|
128 |
+
|
129 |
+
return true;
|
130 |
+
}
|
131 |
+
|
132 |
+
public function getDirectoryContent(
|
133 |
+
$directory,
|
134 |
+
$recurse = false,
|
135 |
+
$enumerateFiles = true,
|
136 |
+
$enumerateDirs = true,
|
137 |
+
$sortResult = true
|
138 |
+
) {
|
139 |
+
$result = [];
|
140 |
+
|
141 |
+
$dirpath = $this->removeTrailingDirectorySeparator($directory);
|
142 |
+
|
143 |
+
$dir = opendir($dirpath);
|
144 |
+
if ($dir) {
|
145 |
+
while (false !== ($item = readdir($dir))) {
|
146 |
+
$full_path = $dirpath . DIRECTORY_SEPARATOR . $item;
|
147 |
+
if (($item == ".") || ($item == "..")) {
|
148 |
+
// Skip
|
149 |
+
} elseif ((is_file($full_path)) && ($enumerateFiles)) {
|
150 |
+
$rvItem = [];
|
151 |
+
$rvItem['full_path'] = $full_path;
|
152 |
+
$rvItem['name'] = $item;
|
153 |
+
$rvItem['type'] = "file";
|
154 |
+
array_push($result, $rvItem);
|
155 |
+
} elseif (is_dir($full_path)) {
|
156 |
+
if ($enumerateDirs) {
|
157 |
+
$rvItem = [];
|
158 |
+
$rvItem['full_path'] = $full_path;
|
159 |
+
$rvItem['name'] = $item;
|
160 |
+
$rvItem['type'] = "dir";
|
161 |
+
array_push($result, $rvItem);
|
162 |
+
}
|
163 |
+
|
164 |
+
if ($recurse) {
|
165 |
+
$subresult = $this->getDirectoryContent(
|
166 |
+
$full_path,
|
167 |
+
$recurse,
|
168 |
+
$enumerateFiles,
|
169 |
+
$enumerateDirs,
|
170 |
+
false
|
171 |
+
);
|
172 |
+
$result = array_merge($result, $subresult);
|
173 |
+
}
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
closedir($dir);
|
178 |
+
}
|
179 |
+
|
180 |
+
if ($sortResult) {
|
181 |
+
usort($result, [$this, "compareFileItems"]);
|
182 |
+
}
|
183 |
+
|
184 |
+
return $result;
|
185 |
+
}
|
186 |
}
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Helper_Filesystem
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
7 |
+
* @param string $subdir
|
8 |
+
* @return string
|
9 |
+
*/
|
10 |
+
public function getXmlSubdirectoryAndMakeSureItExists(Eurotext_TranslationManager_Model_Project $project, $subdir)
|
11 |
+
{
|
12 |
+
$xmlDir = $this->getExportXMLPath($project);
|
13 |
+
$xmlDir .= DS . $subdir;
|
14 |
+
if (!is_dir($xmlDir)) {
|
15 |
+
mkdir($xmlDir, 0777, true);
|
16 |
+
|
17 |
+
return $xmlDir;
|
18 |
+
}
|
19 |
+
|
20 |
+
return $xmlDir;
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
25 |
+
* @return string
|
26 |
+
*/
|
27 |
+
public function getExportXMLPath(Eurotext_TranslationManager_Model_Project $project)
|
28 |
+
{
|
29 |
+
$dir = Mage::getBaseDir('var') . '/eurotext';
|
30 |
+
$this->tryCreateEurotextVarDirectory($dir);
|
31 |
+
$this->createHtaccessFile($dir);
|
32 |
+
$dir = $this->createProjectExportDirectory($project, $dir);
|
33 |
+
|
34 |
+
return $dir;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @param string $dir
|
39 |
+
*/
|
40 |
+
private function createHtaccessFile($dir)
|
41 |
+
{
|
42 |
+
$htaccessFilename = $dir . DS . ".htaccess";
|
43 |
+
if (!is_file($htaccessFilename)) {
|
44 |
+
file_put_contents($htaccessFilename, "# Eurotext Export folder\nOrder Deny,Allow\nDeny From All");
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
50 |
+
* @param string $dir
|
51 |
+
* @return string
|
52 |
+
*/
|
53 |
+
private function createProjectExportDirectory(Eurotext_TranslationManager_Model_Project $project, $dir)
|
54 |
+
{
|
55 |
+
$dir .= DS . "projects/{$project->getId()}/export";
|
56 |
+
if (!is_dir($dir)) {
|
57 |
+
mkdir($dir, 0777, true);
|
58 |
+
|
59 |
+
return $dir;
|
60 |
+
}
|
61 |
+
|
62 |
+
return $dir;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* @param string $dir
|
67 |
+
*/
|
68 |
+
private function tryCreateEurotextVarDirectory($dir)
|
69 |
+
{
|
70 |
+
if (!is_dir($dir)) {
|
71 |
+
if (!mkdir($dir, 0777, true)) {
|
72 |
+
Mage::helper('eurotext_translationmanager')
|
73 |
+
->log('Working directory could not be created in ' . Mage::getBaseDir('var'), Zend_Log::CRIT);
|
74 |
+
throw new Magento_Exception('Eurotext working directory could not be created.');
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* @param string $filename
|
81 |
+
* @return string
|
82 |
+
*/
|
83 |
+
public function getFilenameSafeString($filename)
|
84 |
+
{
|
85 |
+
$filename = trim(strtolower($filename));
|
86 |
+
$filename = preg_replace('#[^a-z0-9-_.]#', '-', $filename);
|
87 |
+
|
88 |
+
do {
|
89 |
+
$filename = str_replace(['..', '--'], ['.', '-'], $filename, $replaced);
|
90 |
+
} while ($replaced);
|
91 |
+
|
92 |
+
return $filename;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* @param string $dir
|
97 |
+
*/
|
98 |
+
public function deleteDirectoryRecursively($dir)
|
99 |
+
{
|
100 |
+
mageDelTree($dir);
|
101 |
+
}
|
102 |
+
}
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Helper_Project
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @param int $id
|
7 |
+
* @return Eurotext_TranslationManager_Model_Project
|
8 |
+
*/
|
9 |
+
public function getProject($id)
|
10 |
+
{
|
11 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
12 |
+
$project = Mage::getModel('eurotext_translationmanager/project')->load($id);
|
13 |
+
if ($project->isObjectNew()) {
|
14 |
+
Mage::throwException(sprintf('Project with ID "%s" not found.', $id));
|
15 |
+
}
|
16 |
+
|
17 |
+
$project->setData('storeview_src_locale', Eurotext_TranslationManager_Model_Project::DEFAULT_SRC_LOCALE);
|
18 |
+
if ($project->getStoreviewSrc() >= 0) {
|
19 |
+
$project->setData(
|
20 |
+
'storeview_src_locale',
|
21 |
+
Mage::getStoreConfig('general/locale/code', $project->getStoreviewSrc())
|
22 |
+
);
|
23 |
+
}
|
24 |
+
|
25 |
+
$project->setData('storeview_dst_locale', Eurotext_TranslationManager_Model_Project::DEFAULT_DST_LOCALE);
|
26 |
+
if ($project->getStoreviewDst() >= 0) {
|
27 |
+
$project->setData(
|
28 |
+
'storeview_dst_locale',
|
29 |
+
Mage::getStoreConfig('general/locale/code', $project->getStoreviewDst())
|
30 |
+
);
|
31 |
+
}
|
32 |
+
|
33 |
+
return $project;
|
34 |
+
}
|
35 |
+
}
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Helper_String
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @param string $content
|
7 |
+
* @return string
|
8 |
+
*/
|
9 |
+
public function replaceMagentoBlockDirectives($content)
|
10 |
+
{
|
11 |
+
return preg_replace('#\{{2}((.*?) (.*?=)"(.*?)"\s*)\}{2}#', '{{$2 $3\'$4\'}}', $content);
|
12 |
+
}
|
13 |
+
}
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Helper_Xml
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @param DOMDocument $doc
|
7 |
+
* @param DOMNode $xmlNode
|
8 |
+
* @param string $textContent
|
9 |
+
*/
|
10 |
+
public function appendTextChild(DOMDocument $doc, DOMNode $xmlNode, $textContent)
|
11 |
+
{
|
12 |
+
$this->doc = $xmlNode->ownerDocument;
|
13 |
+
$textContent = Mage::helper('eurotext_translationmanager/string')->replaceMagentoBlockDirectives($textContent);
|
14 |
+
$xmlNode->appendChild($doc->createCDATASection($textContent));
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @param DOMDocument $doc
|
19 |
+
* @param string $nodeName
|
20 |
+
* @param string $value
|
21 |
+
* @param DOMElement $nodeToAppend
|
22 |
+
*/
|
23 |
+
public function appendTextNode(DOMDocument $doc, $nodeName, $value, $nodeToAppend)
|
24 |
+
{
|
25 |
+
$newNode = $doc->createElement($nodeName);
|
26 |
+
$this->appendTextChild($doc, $newNode, $value);
|
27 |
+
$nodeToAppend->appendChild($newNode);
|
28 |
+
}
|
29 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Catalog_Product_Attribute_Backend_Media_OnlyStoreValues
|
4 |
+
extends Mage_Catalog_Model_Product_Attribute_Backend_Media
|
5 |
+
{
|
6 |
+
protected function _getResource()
|
7 |
+
{
|
8 |
+
return Mage::getResourceSingleton(
|
9 |
+
'eurotext_translationmanager/catalog_product_attribute_backend_media_onlyStoreValues'
|
10 |
+
);
|
11 |
+
}
|
12 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Controller_Exception extends Mage_Core_Controller_Varien_Exception
|
4 |
+
{
|
5 |
+
public function prepareRedirect($path, $arguments = [])
|
6 |
+
{
|
7 |
+
$this->_resultCallback = self::RESULT_REDIRECT;
|
8 |
+
$this->_resultCallbackParams = [$path, $arguments];
|
9 |
+
|
10 |
+
return $this;
|
11 |
+
}
|
12 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Eav_Attribute_Label extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/eav_attribute_label');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Eav_Attribute_Option_Value extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('eurotext_translationmanager/eav_attribute_option_value');
|
8 |
+
}
|
9 |
+
}
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_EurotextLanguages
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var string[]
|
7 |
+
*/
|
8 |
+
private $supportedLanguages = [
|
9 |
+
'af_ZA' => 'afr',
|
10 |
+
'sq_AL' => 'alb',
|
11 |
+
'ar_DZ' => 'ar-dz',
|
12 |
+
'ar_EG' => 'ar-eg',
|
13 |
+
'ar_KW' => 'ar-kw',
|
14 |
+
'ar_MA' => 'ar-ma',
|
15 |
+
'ar_SA' => 'ar-sa',
|
16 |
+
'az_AZ' => 'aze',
|
17 |
+
'be_BY' => 'bel',
|
18 |
+
'bg_BG' => 'bg',
|
19 |
+
'bs_BA' => 'bos',
|
20 |
+
'ca_ES' => 'cat',
|
21 |
+
'cs_CZ' => 'cz-cz',
|
22 |
+
'da_DK' => 'da',
|
23 |
+
'de_AT' => 'de-at',
|
24 |
+
'de_CH' => 'de-ch',
|
25 |
+
'de_DE' => 'de-de',
|
26 |
+
'el_GR' => 'el',
|
27 |
+
'en_AU' => 'en-au',
|
28 |
+
'en_CA' => 'en-ca',
|
29 |
+
'en_GB' => 'en-gb',
|
30 |
+
'en_IE' => 'en-ie',
|
31 |
+
'en_NZ' => 'en-nz',
|
32 |
+
'en_US' => 'en-us',
|
33 |
+
'es_AR' => 'es-ar',
|
34 |
+
'es_CL' => 'es-cl',
|
35 |
+
'es_CO' => 'es-co',
|
36 |
+
'es_CR' => 'es-cr',
|
37 |
+
'es_ES' => 'es-es',
|
38 |
+
'es_MX' => 'es-mx',
|
39 |
+
'es_PA' => 'es-pa',
|
40 |
+
'es_PE' => 'es-pe',
|
41 |
+
'es_VE' => 'es-ve',
|
42 |
+
'et_EE' => 'et',
|
43 |
+
'fi_FI' => 'fi-fi',
|
44 |
+
'fr_CA' => 'fr-ca',
|
45 |
+
'fr_FR' => 'fr-fr',
|
46 |
+
'gl_ES' => 'glg',
|
47 |
+
'gu_IN' => 'guj',
|
48 |
+
'he_IL' => 'he',
|
49 |
+
'hi_IN' => 'hin',
|
50 |
+
'hr_HR' => 'hr',
|
51 |
+
'hu_HU' => 'hu',
|
52 |
+
'is_IS' => 'ice',
|
53 |
+
'id_ID' => 'ind',
|
54 |
+
'it_CH' => 'it-ch',
|
55 |
+
'it_IT' => 'it-it',
|
56 |
+
'ja_JP' => 'ja',
|
57 |
+
'ko_KR' => 'ko-kr',
|
58 |
+
'lt_LT' => 'lt-lt',
|
59 |
+
'lv_LV' => 'lv',
|
60 |
+
'mk_MK' => 'mk',
|
61 |
+
'ms_MY' => 'msa',
|
62 |
+
'nl_NL' => 'nl-nl',
|
63 |
+
'nb_NO' => 'no-nb',
|
64 |
+
'nn_NO' => 'no-nn',
|
65 |
+
'pl_PL' => 'pl',
|
66 |
+
'pt_BR' => 'pt-br',
|
67 |
+
'pt_PT' => 'pt-pt',
|
68 |
+
'ro_RO' => 'ro-ro',
|
69 |
+
'ru_RU' => 'ru-ru',
|
70 |
+
'sk_SK' => 'sk',
|
71 |
+
'sl_SI' => 'sl',
|
72 |
+
'sr_RS' => 'sr',
|
73 |
+
'sv_SE' => 'sv-se',
|
74 |
+
'th_TH' => 'th',
|
75 |
+
'tr_TR' => 'tr',
|
76 |
+
'uk_UA' => 'uk',
|
77 |
+
'vi_VN' => 'vn',
|
78 |
+
'cy_GB' => 'wel',
|
79 |
+
'zh_CN' => 'zh-cn',
|
80 |
+
'zh_HK' => 'zh-hk',
|
81 |
+
'zh_TW' => 'zh-tw',
|
82 |
+
];
|
83 |
+
|
84 |
+
private $fromMagentoLocale;
|
85 |
+
private $fromEurotext;
|
86 |
+
|
87 |
+
private function generateSupportedLanguages()
|
88 |
+
{
|
89 |
+
if ($this->fromMagentoLocale !== null) {
|
90 |
+
return;
|
91 |
+
}
|
92 |
+
|
93 |
+
$languages = Mage::getModel('adminhtml/system_config_source_locale')->toOptionArray();
|
94 |
+
$this->fromMagentoLocale = [];
|
95 |
+
$this->fromEurotext = [];
|
96 |
+
|
97 |
+
foreach ($languages as $lang) {
|
98 |
+
if (isset($this->supportedLanguages[$lang['value']])) {
|
99 |
+
$this->fromMagentoLocale[$lang['value']] = [
|
100 |
+
'locale' => $lang['value'],
|
101 |
+
'locale_eurotext' => $this->supportedLanguages[$lang['value']],
|
102 |
+
'lang_name' => $lang['label'],
|
103 |
+
'supported' => true,
|
104 |
+
];
|
105 |
+
$this->fromEurotext[$this->supportedLanguages[$lang['value']]] = [
|
106 |
+
'locale' => $lang['value'],
|
107 |
+
'locale_eurotext' => $this->supportedLanguages[$lang['value']],
|
108 |
+
'lang_name' => $lang['label'],
|
109 |
+
'supported' => true,
|
110 |
+
];
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
public function getInfoByMageLocale($locale)
|
116 |
+
{
|
117 |
+
$this->generateSupportedLanguages();
|
118 |
+
|
119 |
+
if (isset($this->fromMagentoLocale[$locale])) {
|
120 |
+
return $this->fromMagentoLocale[$locale];
|
121 |
+
}
|
122 |
+
|
123 |
+
return [
|
124 |
+
'locale' => $locale,
|
125 |
+
'locale_eurotext' => "-",
|
126 |
+
'lang_name' => Mage::helper('eurotext_translationmanager')->__("Unsupported language"),
|
127 |
+
'supported' => false,
|
128 |
+
];
|
129 |
+
}
|
130 |
+
|
131 |
+
public function getInfoByEurotext($locale)
|
132 |
+
{
|
133 |
+
$this->generateSupportedLanguages();
|
134 |
+
|
135 |
+
if (isset($this->fromEurotext[$locale])) {
|
136 |
+
return $this->fromEurotext[$locale];
|
137 |
+
}
|
138 |
+
|
139 |
+
return [
|
140 |
+
'locale' => $locale,
|
141 |
+
'locale_eurotext' => "-",
|
142 |
+
'lang_name' => Mage::helper('eurotext_translationmanager')->__("Unsupported language"),
|
143 |
+
'supported' => false,
|
144 |
+
];
|
145 |
+
}
|
146 |
+
}
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Export_Project
|
4 |
+
{
|
5 |
+
const STEP_START = 0;
|
6 |
+
const STEP_BUILD_LANGXML = 1;
|
7 |
+
const STEP_COLLECT_PRODUCTS = 2;
|
8 |
+
const STEP_COLLECT_CATEGORIES = 3;
|
9 |
+
const STEP_COLLECT_CMSPAGES = 4;
|
10 |
+
const STEP_COLLECT_CMSBLOCKS = 5;
|
11 |
+
const STEP_EXPORT_ATTRIBUTES = 6;
|
12 |
+
const STEP_COLLECT_TEMPLATES_FILES = 7;
|
13 |
+
const STEP_COLLECT_TEMPLATES_DATABASE = 8;
|
14 |
+
const STEP_GENERATE_CONTROL_FILE = 9;
|
15 |
+
const STEP_COMPRESS_FILES = 10;
|
16 |
+
const STEP_TRANSMIT_ARCHIVE = 11;
|
17 |
+
const STEP_DONE = 12;
|
18 |
+
/**
|
19 |
+
* @var Eurotext_TranslationManager_Helper_Data
|
20 |
+
*/
|
21 |
+
private $helper;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var Eurotext_TranslationManager_Helper_Config
|
25 |
+
*/
|
26 |
+
private $configHelper;
|
27 |
+
|
28 |
+
public function __construct()
|
29 |
+
{
|
30 |
+
$this->helper = Mage::helper('eurotext_translationmanager');
|
31 |
+
$this->configHelper = Mage::helper('eurotext_translationmanager/config');
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @param int $step
|
37 |
+
* @param Eurotext_TranslationManager_Block_Response_Ajax $block
|
38 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
39 |
+
* @param int $offset
|
40 |
+
*/
|
41 |
+
public function export(
|
42 |
+
$step,
|
43 |
+
Eurotext_TranslationManager_Block_Response_Ajax $block,
|
44 |
+
Eurotext_TranslationManager_Model_Project $project,
|
45 |
+
$offset
|
46 |
+
) {
|
47 |
+
// steps:
|
48 |
+
// -------------------------------------------------------------------------------------
|
49 |
+
// 0: Jump to step 4, if language files is not selected for export
|
50 |
+
// 1: Find language *.csv files and write found filenames to eurotext_csv
|
51 |
+
// 2: For each offset import one *.csv file to eurotext_csv_data
|
52 |
+
// 3: For each offset find missing translations for one *.csv and generate xml files
|
53 |
+
// -------------------------------------------------------------------------------------
|
54 |
+
// 4: Jump to step 5, if product files were selected manually
|
55 |
+
// For each offset: Find missing translations for one product
|
56 |
+
// 5: Jump to step 6, if category files where selected manually
|
57 |
+
// For each offset: Find missing translations for one category
|
58 |
+
|
59 |
+
if ($step == self::STEP_START) {
|
60 |
+
$this->cleanupProjectExportDirectory($project);
|
61 |
+
|
62 |
+
Mage::getModel('eurotext_translationmanager/export_project_ftpUpload')
|
63 |
+
->validateFtpConnection();
|
64 |
+
$this->setDataOnStatusBlock(
|
65 |
+
$block,
|
66 |
+
['offset' => 1, 'step' => self::STEP_BUILD_LANGXML, 'status_msg' => '']
|
67 |
+
);
|
68 |
+
} elseif ($step == self::STEP_BUILD_LANGXML) {
|
69 |
+
$rvSub = $this->ajaxexportAction_BuildLangXML($project, $offset);
|
70 |
+
$this->setDataOnStatusBlock($block, $rvSub);
|
71 |
+
} elseif ($step == self::STEP_COLLECT_PRODUCTS) {
|
72 |
+
$rvSub = $this->ajaxexportAction_CollectProducts($project, $offset);
|
73 |
+
$this->setDataOnStatusBlock($block, $rvSub);
|
74 |
+
} elseif ($step == self::STEP_COLLECT_CATEGORIES) {
|
75 |
+
$rvSub = $this->ajaxexportAction_CollectCategories($project, $offset);
|
76 |
+
$this->setDataOnStatusBlock($block, $rvSub);
|
77 |
+
} elseif ($step == self::STEP_COLLECT_CMSPAGES) {
|
78 |
+
$rvSub = $this->ajaxexportAction_CollectCMSPages($project, $offset);
|
79 |
+
$this->setDataOnStatusBlock($block, $rvSub);
|
80 |
+
} elseif ($step == self::STEP_COLLECT_CMSBLOCKS) {
|
81 |
+
$rvSub = $this->ajaxexportAction_CollectCMSBlocks($project, $offset);
|
82 |
+
$this->setDataOnStatusBlock($block, $rvSub);
|
83 |
+
} elseif ($step == self::STEP_COLLECT_TEMPLATES_FILES) {
|
84 |
+
$rvSub = $this->ajaxexportAction_CollectTemplatesFromFiles($project);
|
85 |
+
$this->setDataOnStatusBlock($block, $rvSub);
|
86 |
+
} elseif ($step == self::STEP_COLLECT_TEMPLATES_DATABASE) {
|
87 |
+
$rvSub = $this->ajaxexportAction_CollectTemplatesFromDatabase($project, $offset);
|
88 |
+
$this->setDataOnStatusBlock($block, $rvSub);
|
89 |
+
} elseif ($step == self::STEP_EXPORT_ATTRIBUTES) {
|
90 |
+
$rvSub = $this->ajaxexportAction_ExportAttributes($project);
|
91 |
+
$this->setDataOnStatusBlock($block, $rvSub);
|
92 |
+
} elseif ($step == self::STEP_GENERATE_CONTROL_FILE) {
|
93 |
+
$this->ajaxexportAction_GenerateControlFile($project);
|
94 |
+
$block->setStep(self::STEP_COMPRESS_FILES);
|
95 |
+
$block->setStatusMsg($this->helper->__("Generating ZIP archive"));
|
96 |
+
} elseif ($step == self::STEP_COMPRESS_FILES) {
|
97 |
+
$this->ajaxexportAction_CompressFiles($project);
|
98 |
+
$block->setStep(self::STEP_TRANSMIT_ARCHIVE);
|
99 |
+
$block->setStatusMsg($this->helper->__("Sending data"));
|
100 |
+
} elseif ($step == self::STEP_TRANSMIT_ARCHIVE) {
|
101 |
+
$this->ajaxexportAction_TransmitArchive($project);
|
102 |
+
$block->setStep(self::STEP_DONE);
|
103 |
+
$block->setStatusMsg($this->helper->__("Data sent."));
|
104 |
+
} else {
|
105 |
+
$block->setStep(self::STEP_DONE);
|
106 |
+
$block->setStatusMsg($this->helper->__("Export done."));
|
107 |
+
$block->setStatusCode('success');
|
108 |
+
$block->setFinished(true);
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
114 |
+
* @param int $offset
|
115 |
+
* @return mixed[]
|
116 |
+
*/
|
117 |
+
private function ajaxexportAction_BuildLangXML(Eurotext_TranslationManager_Model_Project $project, $offset)
|
118 |
+
{
|
119 |
+
return Mage::getModel('eurotext_translationmanager/export_project_localeCsvFiles')
|
120 |
+
->process($project, $offset);
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* @return Eurotext_TranslationManager_Helper_Eurotext
|
125 |
+
*/
|
126 |
+
private function getEurotextHelper()
|
127 |
+
{
|
128 |
+
return Mage::helper('eurotext_translationmanager/eurotext');
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
133 |
+
* @param int $offset
|
134 |
+
* @return mixed[]
|
135 |
+
*/
|
136 |
+
private function ajaxexportAction_CollectProducts(Eurotext_TranslationManager_Model_Project $project, $offset)
|
137 |
+
{
|
138 |
+
return Mage::getModel('eurotext_translationmanager/export_project_product')->process($project, $offset);
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
143 |
+
* @param int $offset
|
144 |
+
* @return mixed[]
|
145 |
+
*/
|
146 |
+
private function ajaxexportAction_CollectCategories(Eurotext_TranslationManager_Model_Project $project, $offset)
|
147 |
+
{
|
148 |
+
return Mage::getModel('eurotext_translationmanager/export_project_category')->process($project, $offset);
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
153 |
+
* @param int $offset
|
154 |
+
* @return mixed[]
|
155 |
+
*/
|
156 |
+
private function ajaxexportAction_CollectCMSPages(Eurotext_TranslationManager_Model_Project $project, $offset)
|
157 |
+
{
|
158 |
+
return Mage::getModel('eurotext_translationmanager/export_project_cmsPage')->process($project, $offset);
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
163 |
+
* @param int $offset
|
164 |
+
* @return mixed[]
|
165 |
+
*/
|
166 |
+
private function ajaxexportAction_CollectCMSBlocks(Eurotext_TranslationManager_Model_Project $project, $offset)
|
167 |
+
{
|
168 |
+
return Mage::getModel('eurotext_translationmanager/export_project_cmsBlock')->process($project, $offset);
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
173 |
+
* @return mixed[]
|
174 |
+
*/
|
175 |
+
private function ajaxexportAction_CollectTemplatesFromFiles(Eurotext_TranslationManager_Model_Project $project)
|
176 |
+
{
|
177 |
+
return Mage::getModel('eurotext_translationmanager/export_project_emailFileTemplates')
|
178 |
+
->process($project);
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
183 |
+
* @param int $offset
|
184 |
+
* @return mixed[]
|
185 |
+
*/
|
186 |
+
private function ajaxexportAction_CollectTemplatesFromDatabase(
|
187 |
+
Eurotext_TranslationManager_Model_Project $project,
|
188 |
+
$offset
|
189 |
+
) {
|
190 |
+
return Mage::getModel('eurotext_translationmanager/export_project_emailDatabaseTemplates')
|
191 |
+
->process($project, $offset);
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
196 |
+
* @return mixed[]
|
197 |
+
*/
|
198 |
+
private function ajaxexportAction_ExportAttributes(Eurotext_TranslationManager_Model_Project $project)
|
199 |
+
{
|
200 |
+
return Mage::getModel('eurotext_translationmanager/export_project_attribute')->process($project);
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
205 |
+
* @return mixed[]
|
206 |
+
*/
|
207 |
+
private function ajaxexportAction_GenerateControlFile(Eurotext_TranslationManager_Model_Project $project)
|
208 |
+
{
|
209 |
+
return Mage::getModel('eurotext_translationmanager/export_project_createControlFile')->create($project);
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
214 |
+
* @return mixed[]
|
215 |
+
*/
|
216 |
+
private function ajaxexportAction_CompressFiles(Eurotext_TranslationManager_Model_Project $project)
|
217 |
+
{
|
218 |
+
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')->getExportXMLPath($project);
|
219 |
+
$this->getEurotextHelper()
|
220 |
+
->zipFolder($xmlDir, $this->getProjectZipFilename($project), "Created by Eurotext Magento Module");
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
225 |
+
* @return string
|
226 |
+
*/
|
227 |
+
private function getProjectZipFilename(Eurotext_TranslationManager_Model_Project $project)
|
228 |
+
{
|
229 |
+
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')->getExportXMLPath($project);
|
230 |
+
|
231 |
+
if ($project->getZipFilename() != "") {
|
232 |
+
return $xmlDir . DS . $project->getZipFilename();
|
233 |
+
}
|
234 |
+
|
235 |
+
$filename = $this->generateZipFilename($project);
|
236 |
+
|
237 |
+
return "$xmlDir/$filename";
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
242 |
+
*/
|
243 |
+
private function ajaxexportAction_TransmitArchive(Eurotext_TranslationManager_Model_Project $project)
|
244 |
+
{
|
245 |
+
return Mage::getModel('eurotext_translationmanager/export_project_ftpUpload')
|
246 |
+
->upload($project, $this->getProjectZipFilename($project));
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* @param Eurotext_TranslationManager_Block_Response_Ajax $block
|
251 |
+
* @param mixed [] $rvSub
|
252 |
+
*/
|
253 |
+
private function setDataOnStatusBlock(Eurotext_TranslationManager_Block_Response_Ajax $block, $rvSub)
|
254 |
+
{
|
255 |
+
$block->setStep($rvSub['step']);
|
256 |
+
$block->setOffset($rvSub['offset']);
|
257 |
+
$block->setStatusMsg($rvSub['status_msg']);
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
262 |
+
*/
|
263 |
+
private function resetProjectZipFilename(Eurotext_TranslationManager_Model_Project $project)
|
264 |
+
{
|
265 |
+
$project->setZipFilename('');
|
266 |
+
$project->save();
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
271 |
+
* @return string
|
272 |
+
*/
|
273 |
+
private function generateZipFilename(Eurotext_TranslationManager_Model_Project $project)
|
274 |
+
{
|
275 |
+
$filename = sprintf(
|
276 |
+
"ET-%s-%s-%s.zip",
|
277 |
+
Mage::helper('eurotext_translationmanager/filesystem')
|
278 |
+
->getFilenameSafeString($this->configHelper->getShopname()),
|
279 |
+
Mage::helper('eurotext_translationmanager/filesystem')
|
280 |
+
->getFilenameSafeString($this->configHelper->getCustomerId()),
|
281 |
+
date("Y-m-d_H-i-s_T")
|
282 |
+
);
|
283 |
+
|
284 |
+
$project->setZipFilename($filename);
|
285 |
+
$project->save();
|
286 |
+
|
287 |
+
return $filename;
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
292 |
+
*/
|
293 |
+
private function cleanupProjectExportDirectory(Eurotext_TranslationManager_Model_Project $project)
|
294 |
+
{
|
295 |
+
$filesystemHelper = Mage::helper('eurotext_translationmanager/filesystem');
|
296 |
+
$xmlPath = $filesystemHelper->getExportXMLPath($project);
|
297 |
+
$filesystemHelper->deleteDirectoryRecursively($xmlPath);
|
298 |
+
$this->resetProjectZipFilename($project);
|
299 |
+
}
|
300 |
+
}
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Eurotext_TranslationManager_Model_Export_Project as ProjectExporter;
|
4 |
+
|
5 |
+
class Eurotext_TranslationManager_Model_Export_Project_Attribute
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* @var DOMDocument
|
9 |
+
*/
|
10 |
+
private $doc;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @var DOMElement
|
14 |
+
*/
|
15 |
+
private $nodeAttributes;
|
16 |
+
|
17 |
+
public function __construct()
|
18 |
+
{
|
19 |
+
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
20 |
+
$this->doc->formatOutput = true;
|
21 |
+
|
22 |
+
$this->nodeAttributes = $this->doc->createElement("attributes");
|
23 |
+
$this->doc->appendChild($this->nodeAttributes);
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
public function process(Eurotext_TranslationManager_Model_Project $project)
|
28 |
+
{
|
29 |
+
if (!$project->isExportingAttributes()) {
|
30 |
+
return [
|
31 |
+
'status_msg' => Mage::helper('eurotext_translationmanager')->__('Attributes not exported.'),
|
32 |
+
'step' => ProjectExporter::STEP_GENERATE_CONTROL_FILE,
|
33 |
+
'offset' => 1,
|
34 |
+
];
|
35 |
+
}
|
36 |
+
|
37 |
+
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
|
38 |
+
->addStoreLabel($project->getStoreviewSrc())
|
39 |
+
->addFieldToFilter('is_user_defined', 1);
|
40 |
+
|
41 |
+
foreach ($attributes as $a) {
|
42 |
+
$comment = $a->getFrontendLabel() == $a->getStoreLabel() ? "(default label)" : "(src-storeview label)";
|
43 |
+
|
44 |
+
$nodeAttribute = $this->doc->createElement("attribute");
|
45 |
+
$this->nodeAttributes->appendChild($nodeAttribute);
|
46 |
+
|
47 |
+
$optionId = $this->doc->createAttribute("id");
|
48 |
+
$optionId->value = $a->getId();
|
49 |
+
$nodeAttribute->appendChild($optionId);
|
50 |
+
|
51 |
+
$comment .= " attribute_code='" . $a['attribute_code'] . "', entity_type_id: " . $a['entity_type_id'];
|
52 |
+
$nodeAttributeComment = $this->doc->createComment($comment);
|
53 |
+
$nodeAttribute->appendChild($nodeAttributeComment);
|
54 |
+
|
55 |
+
$nodeName = $this->doc->createElement("AttributeName");
|
56 |
+
Mage::helper('eurotext_translationmanager/xml')
|
57 |
+
->appendTextChild($this->doc, $nodeName, $a->getStoreLabel());
|
58 |
+
|
59 |
+
$attrTranslate = $this->doc->createAttribute("translate");
|
60 |
+
$attrTranslate->value = "1";
|
61 |
+
$nodeName->appendChild($attrTranslate);
|
62 |
+
|
63 |
+
$nodeAttribute->appendChild($nodeName);
|
64 |
+
|
65 |
+
/** @var Eurotext_TranslationManager_Model_Resource_Eav_Attribute_Option_Value_Collection $optionCollection */
|
66 |
+
$optionCollection = Mage::getResourceModel(
|
67 |
+
'eurotext_translationmanager/eav_attribute_option_value_collection'
|
68 |
+
);
|
69 |
+
$optionCollection->filterByAttribute($a->getId());
|
70 |
+
$optionCollection->joinStoreLabel($project->getStoreviewSrc());
|
71 |
+
$optionCollection->addOrder('sort_order ASC, main_table.option_id', 'ASC');
|
72 |
+
|
73 |
+
if ($optionCollection->count()) {
|
74 |
+
$nodeOptions = $this->doc->createElement("options");
|
75 |
+
$nodeAttribute->appendChild($nodeOptions);
|
76 |
+
foreach ($optionCollection as $optionValue) {
|
77 |
+
$defaultValue = $optionValue->getValue();
|
78 |
+
$storeValue = $optionValue->getStoreValue();
|
79 |
+
|
80 |
+
$nodeOption = $this->doc->createElement("option");
|
81 |
+
$nodeOptions->appendChild($nodeOption);
|
82 |
+
|
83 |
+
$optionId = $this->doc->createAttribute("id");
|
84 |
+
$optionId->value = $optionValue->getOptionId();
|
85 |
+
$nodeOption->appendChild($optionId);
|
86 |
+
|
87 |
+
$optionComment = empty($storeValue) || $defaultValue == $storeValue ? "(has default label)" : "(has src-storeview label)";
|
88 |
+
|
89 |
+
$nodeAttributeOptionComment = $this->doc->createComment($optionComment);
|
90 |
+
$nodeOption->appendChild($nodeAttributeOptionComment);
|
91 |
+
|
92 |
+
$nodeName = $this->doc->createElement("OptionName");
|
93 |
+
Mage::helper('eurotext_translationmanager/xml')
|
94 |
+
->appendTextChild($this->doc, $nodeName, $storeValue ?: $defaultValue);
|
95 |
+
|
96 |
+
$attrTranslate = $this->doc->createAttribute("translate");
|
97 |
+
$attrTranslate->value = "1";
|
98 |
+
$nodeName->appendChild($attrTranslate);
|
99 |
+
|
100 |
+
$nodeOption->appendChild($nodeName);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
if ($this->nodeAttributes->hasChildNodes()) {
|
106 |
+
$subdir = 'attributes';
|
107 |
+
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')->getXmlSubdirectoryAndMakeSureItExists(
|
108 |
+
$project,
|
109 |
+
$subdir
|
110 |
+
);
|
111 |
+
|
112 |
+
$xml_filename = $xmlDir . DS . "attributes.xml";
|
113 |
+
|
114 |
+
$this->doc->save($xml_filename);
|
115 |
+
}
|
116 |
+
|
117 |
+
return [
|
118 |
+
'status_msg' => Mage::helper('eurotext_translationmanager')->__("Exported attributes."),
|
119 |
+
'step' => ProjectExporter::STEP_GENERATE_CONTROL_FILE,
|
120 |
+
'offset' => 1,
|
121 |
+
];
|
122 |
+
}
|
123 |
+
}
|
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Export_Project_Category
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var DOMDocument
|
7 |
+
*/
|
8 |
+
private $doc;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var string[]
|
12 |
+
*/
|
13 |
+
private $attributesToExportAlwaysWithMapping = [
|
14 |
+
'name' => 'Title',
|
15 |
+
'description' => 'Longdesc',
|
16 |
+
'short_description' => 'Shortdesc',
|
17 |
+
|
18 |
+
];
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var string[]
|
22 |
+
*/
|
23 |
+
private $seoAttributesWithMapping = [
|
24 |
+
'meta_title' => 'SeoTitle',
|
25 |
+
'meta_description' => 'SeoDescription',
|
26 |
+
'meta_keywords' => 'SeoKeywords'
|
27 |
+
];
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var Eurotext_TranslationManager_Helper_Data
|
31 |
+
*/
|
32 |
+
private $helper;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @var Eurotext_TranslationManager_Helper_Config
|
36 |
+
*/
|
37 |
+
private $configHelper;
|
38 |
+
|
39 |
+
public function __construct()
|
40 |
+
{
|
41 |
+
$this->helper = Mage::helper('eurotext_translationmanager');
|
42 |
+
$this->configHelper = Mage::helper('eurotext_translationmanager/config');
|
43 |
+
|
44 |
+
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
45 |
+
$this->doc->formatOutput = true;
|
46 |
+
}
|
47 |
+
|
48 |
+
public function process(Eurotext_TranslationManager_Model_Project $project, $page)
|
49 |
+
{
|
50 |
+
/** @var Mage_Core_Model_App_Emulation $emulator */
|
51 |
+
$emulator = Mage::getModel('core/app_emulation');
|
52 |
+
$emulation = $emulator->startEnvironmentEmulation($project->getStoreviewSrc());
|
53 |
+
|
54 |
+
$project->addAllRelationalData();
|
55 |
+
|
56 |
+
$maxItems = $this->configHelper->getCategoriesPerFile();
|
57 |
+
|
58 |
+
$manualSelected = false;
|
59 |
+
|
60 |
+
$categorySrcCollection = $this->getCategoryCollectionFor($project->getStoreviewSrc(), $page, $maxItems);
|
61 |
+
$categoryDstCollection = $this->getCategoryCollectionFor($project->getStoreviewDst(), $page, $maxItems);
|
62 |
+
|
63 |
+
if (!$project->isExportingAllCategories()) {
|
64 |
+
$manualSelected = true;
|
65 |
+
$categorySrcCollection->addIdFilter($project->getCategories());
|
66 |
+
$categoryDstCollection->addIdFilter($project->getCategories());
|
67 |
+
}
|
68 |
+
|
69 |
+
if ((!count($project->getCategories()) && !$project->isExportingAllCategories()) ||
|
70 |
+
$page > $categorySrcCollection->getLastPageNumber()
|
71 |
+
) {
|
72 |
+
$emulator->stopEnvironmentEmulation($emulation);
|
73 |
+
|
74 |
+
return [
|
75 |
+
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_COLLECT_CMSPAGES,
|
76 |
+
'offset' => 1,
|
77 |
+
'status_msg' => $this->helper->__("Exported categories."),
|
78 |
+
];
|
79 |
+
}
|
80 |
+
|
81 |
+
$cats = $this->doc->createElement("categories");
|
82 |
+
$this->doc->appendChild($cats);
|
83 |
+
|
84 |
+
$statusMessage = sprintf(
|
85 |
+
Mage::helper('eurotext_translationmanager')->__("Batch %s / %s Categories:"),
|
86 |
+
$page,
|
87 |
+
$categorySrcCollection->getLastPageNumber()
|
88 |
+
);
|
89 |
+
|
90 |
+
foreach ($categorySrcCollection as $catSrc) {
|
91 |
+
/** @var Mage_Catalog_Model_Category $catSrc */
|
92 |
+
/** @var Mage_Catalog_Model_Category $catDst */
|
93 |
+
$catDst = $categoryDstCollection->getItemById($catSrc->getId());
|
94 |
+
|
95 |
+
$statusMessage .= "\n<br />- " . $catSrc->getName();
|
96 |
+
|
97 |
+
$catNode = $this->doc->createElement("category");
|
98 |
+
|
99 |
+
$this->createDefaultAttributeNodes($catNode, $catDst, $catSrc, $manualSelected);
|
100 |
+
$this->createCustomCategoryAttributeNodes($catNode, $catDst, $catSrc, $manualSelected);
|
101 |
+
|
102 |
+
if ($project->isExportingUrlKeys()) {
|
103 |
+
$this->createUrlKeyNode($catSrc, $catDst, $manualSelected, $catNode);
|
104 |
+
}
|
105 |
+
|
106 |
+
if ($project->isExportingMetaAttributes()) {
|
107 |
+
$this->createSeoNodes($catSrc, $catDst, $manualSelected, $catNode);
|
108 |
+
}
|
109 |
+
|
110 |
+
if ($catNode->hasChildNodes()) {
|
111 |
+
$this->createIdNode($catNode, $catSrc);
|
112 |
+
$this->createUrlNode($catNode, $catSrc);
|
113 |
+
$cats->appendChild($catNode);
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
if($cats->hasChildNodes()){
|
118 |
+
|
119 |
+
$subdir = 'categories';
|
120 |
+
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')->getXmlSubdirectoryAndMakeSureItExists(
|
121 |
+
$project,
|
122 |
+
$subdir
|
123 |
+
);
|
124 |
+
|
125 |
+
$xmlFilename = $xmlDir . DS . "cat" . $page . ".xml";
|
126 |
+
$this->doc->save($xmlFilename);
|
127 |
+
}
|
128 |
+
$emulator->stopEnvironmentEmulation($emulation);
|
129 |
+
|
130 |
+
return [
|
131 |
+
'status_msg' => $statusMessage,
|
132 |
+
'offset' => $page + 1,
|
133 |
+
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_COLLECT_CATEGORIES,
|
134 |
+
];
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* @param int $storeId
|
139 |
+
* @param int $page
|
140 |
+
* @param int $maxItems
|
141 |
+
* @return Mage_Catalog_Model_Resource_Category_Collection
|
142 |
+
*/
|
143 |
+
private function getCategoryCollectionFor($storeId, $page, $maxItems)
|
144 |
+
{
|
145 |
+
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
|
146 |
+
->setStore($storeId)
|
147 |
+
->setStoreId($storeId)
|
148 |
+
->addAttributeToSelect(
|
149 |
+
[
|
150 |
+
'url_path', 'url_key', 'request_path', 'description', 'short_description', 'meta_title',
|
151 |
+
'meta_description', 'meta_keywords', 'name'
|
152 |
+
]
|
153 |
+
)
|
154 |
+
->addAttributeToSelect($this->configHelper->getCustomCategoryAttributesForExport());
|
155 |
+
|
156 |
+
$categoryCollection->setPage($page, $maxItems);
|
157 |
+
|
158 |
+
return $categoryCollection;
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* @param DOMElement $catNode
|
163 |
+
* @param Mage_Catalog_Model_Category $catSrc
|
164 |
+
*/
|
165 |
+
private function createIdNode($catNode,$catSrc)
|
166 |
+
{
|
167 |
+
$nodeId = $this->doc->createElement("Id");
|
168 |
+
$nodeId->appendChild($this->doc->createTextNode($catSrc->getId()));
|
169 |
+
|
170 |
+
$firstChildNode = $catNode->childNodes->item(0);
|
171 |
+
$catNode->insertBefore($nodeId, $firstChildNode);
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* @param Mage_Catalog_Model_Category $catSrc
|
176 |
+
* @param DOMElement $catNode
|
177 |
+
*/
|
178 |
+
private function createUrlNode($catNode, $catSrc)
|
179 |
+
{
|
180 |
+
$nodeUrl = $this->doc->createElement("Url");
|
181 |
+
$nodeUrl->appendChild($this->doc->createTextNode($catSrc->getUrl()));
|
182 |
+
|
183 |
+
$secondChildNode = $catNode->childNodes->item(1);
|
184 |
+
$catNode->insertBefore($nodeUrl, $secondChildNode);
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* @param DOMElement $catNode
|
189 |
+
* @param Mage_Catalog_Model_Category $catDst
|
190 |
+
* @param Mage_Catalog_Model_Category $catSrc
|
191 |
+
* @param bool $manualSelected
|
192 |
+
*/
|
193 |
+
private function createDefaultAttributeNodes(
|
194 |
+
DOMElement $catNode,
|
195 |
+
Mage_Catalog_Model_Category $catDst,
|
196 |
+
Mage_Catalog_Model_Category $catSrc,
|
197 |
+
$manualSelected
|
198 |
+
) {
|
199 |
+
foreach ($this->attributesToExportAlwaysWithMapping as $attr => $nodeName) {
|
200 |
+
$valueSrc = $catSrc->getDataUsingMethod($attr);
|
201 |
+
$valueDst = $catDst->getDataUsingMethod($attr);
|
202 |
+
|
203 |
+
if ($valueSrc != "" && ($valueSrc == $valueDst || $valueDst == "" || $manualSelected)) {
|
204 |
+
$item = $this->doc->createElement($nodeName);
|
205 |
+
Mage::helper('eurotext_translationmanager/xml')->appendTextChild($this->doc, $item, $valueSrc);
|
206 |
+
$catNode->appendChild($item);
|
207 |
+
}
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* @param DOMElement $catNode
|
213 |
+
* @param Mage_Catalog_Model_Category $catSrc
|
214 |
+
*/
|
215 |
+
private function createCustomCategoryAttributeNodes(
|
216 |
+
DOMElement $catNode,
|
217 |
+
Mage_Catalog_Model_Category $catDst,
|
218 |
+
Mage_Catalog_Model_Category $catSrc,
|
219 |
+
$manualSelected
|
220 |
+
) {
|
221 |
+
if (!$this->configHelper->getCustomCategoryAttributesForExport()) {
|
222 |
+
return;
|
223 |
+
}
|
224 |
+
$nodeCustomCategoryAttributes = $this->doc->createElement('custom_attributes');
|
225 |
+
|
226 |
+
foreach ($this->configHelper->getCustomCategoryAttributesForExport() as $customCategoryAttribute) {
|
227 |
+
$valueSrc = $catSrc->getDataUsingMethod($customCategoryAttribute);
|
228 |
+
$valueDst = $catDst->getDataUsingMethod($customCategoryAttribute);
|
229 |
+
|
230 |
+
if ($valueSrc != "" && ($valueSrc == $valueDst || $valueDst == "" || $manualSelected)) {
|
231 |
+
Mage::helper('eurotext_translationmanager/xml')->appendTextNode(
|
232 |
+
$this->doc,
|
233 |
+
(string)$customCategoryAttribute,
|
234 |
+
$valueSrc,
|
235 |
+
$nodeCustomCategoryAttributes
|
236 |
+
);
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
if($nodeCustomCategoryAttributes->hasChildNodes()){
|
241 |
+
$catNode->appendChild($nodeCustomCategoryAttributes);
|
242 |
+
}
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* @param Mage_Catalog_Model_Category $catSrc
|
247 |
+
* @param Mage_Catalog_Model_Category $catDst
|
248 |
+
* @param bool $manualSelected
|
249 |
+
* @param DOMElement $catNode
|
250 |
+
*/
|
251 |
+
private function createUrlKeyNode(
|
252 |
+
Mage_Catalog_Model_Category $catSrc,
|
253 |
+
Mage_Catalog_Model_Category $catDst,
|
254 |
+
$manualSelected,
|
255 |
+
DOMElement $catNode
|
256 |
+
) {
|
257 |
+
$srcUrlKey = $catSrc->getUrlKey();
|
258 |
+
$dstUrlKey = $catDst->getUrlKey();
|
259 |
+
if ($srcUrlKey != "" && (($srcUrlKey == $dstUrlKey) || ($dstUrlKey == "") || ($manualSelected))) {
|
260 |
+
$item = $this->doc->createElement("UrlKey");
|
261 |
+
Mage::helper('eurotext_translationmanager/xml')->appendTextChild(
|
262 |
+
$this->doc,
|
263 |
+
$item,
|
264 |
+
$srcUrlKey
|
265 |
+
);
|
266 |
+
$catNode->appendChild($item);
|
267 |
+
}
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* @param Mage_Catalog_Model_Category $catSrc
|
272 |
+
* @param Mage_Catalog_Model_Category $catDst
|
273 |
+
* @param bool $manualSelected
|
274 |
+
* @param DOMElement $catNode
|
275 |
+
*/
|
276 |
+
private function createSeoNodes(
|
277 |
+
Mage_Catalog_Model_Category $catSrc,
|
278 |
+
Mage_Catalog_Model_Category $catDst,
|
279 |
+
$manualSelected,
|
280 |
+
DOMElement $catNode
|
281 |
+
) {
|
282 |
+
foreach ($this->seoAttributesWithMapping as $attr => $nodeName) {
|
283 |
+
$valueSrc = $catSrc->getDataUsingMethod($attr);
|
284 |
+
$valueDst = $catDst->getDataUsingMethod($attr);
|
285 |
+
|
286 |
+
if ($valueSrc != "" && ($valueSrc == $valueDst || $valueDst == "" || $manualSelected)) {
|
287 |
+
$item = $this->doc->createElement($nodeName);
|
288 |
+
Mage::helper('eurotext_translationmanager/xml')->appendTextChild($this->doc, $item, $valueSrc);
|
289 |
+
$catNode->appendChild($item);
|
290 |
+
}
|
291 |
+
}
|
292 |
+
}
|
293 |
+
}
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Eurotext_TranslationManager_Model_Export_Project as ProjectExporter;
|
4 |
+
|
5 |
+
class Eurotext_TranslationManager_Model_Export_Project_CmsBlock
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* @var string[]
|
9 |
+
*/
|
10 |
+
private $attributes = [
|
11 |
+
'title' => 'Title',
|
12 |
+
'content' => 'Content',
|
13 |
+
'content_heading' => 'ContentHeading',
|
14 |
+
];
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var string[]
|
18 |
+
*/
|
19 |
+
private $metAttributes = [
|
20 |
+
'meta_keywords' => 'SeoKeywords',
|
21 |
+
'meta_description' => 'SeoDescription',
|
22 |
+
];
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var DOMDocument
|
26 |
+
*/
|
27 |
+
private $doc;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var DOMElement
|
31 |
+
*/
|
32 |
+
private $cmsSiteNode;
|
33 |
+
|
34 |
+
public function __construct()
|
35 |
+
{
|
36 |
+
$this->createNewDOMDocument();
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
41 |
+
* @param int $offset
|
42 |
+
* @return string[]
|
43 |
+
*/
|
44 |
+
public function process(Eurotext_TranslationManager_Model_Project $project, $offset)
|
45 |
+
{
|
46 |
+
$project->addAllRelationalData();
|
47 |
+
$helper = Mage::helper('eurotext_translationmanager');
|
48 |
+
|
49 |
+
$manualSelected = false;
|
50 |
+
|
51 |
+
/** @var Mage_Cms_Model_Resource_Block_Collection $blockSrcCollection */
|
52 |
+
$blockSrcCollection = $this->getCmsBlockCollectionFor($project->getStoreviewSrc());
|
53 |
+
/** @var Mage_Cms_Model_Resource_Block_Collection $blockDstCollection */
|
54 |
+
$blockDstCollection = $this->getCmsBlockCollectionFor($project->getStoreviewDst());
|
55 |
+
|
56 |
+
if (!$project->isExportingAllCmsContent()) {
|
57 |
+
$blockSrcCollection->addFieldToFilter('main_table.block_id', ['in' => $project->getBlocks()]);
|
58 |
+
$blockDstCollection->addFieldToFilter('main_table.block_id', ['in' => $project->getBlocks()]);
|
59 |
+
$manualSelected = true;
|
60 |
+
}
|
61 |
+
|
62 |
+
if ((!$project->isExportingAllCmsContent() && !count($project->getBlocks()))
|
63 |
+
|| $offset > $blockSrcCollection->getLastPageNumber()
|
64 |
+
) {
|
65 |
+
return [
|
66 |
+
'status_msg' => $helper->__("Exported CMS Blocks."),
|
67 |
+
'step' => ProjectExporter::STEP_COLLECT_TEMPLATES_FILES,
|
68 |
+
'offset' => 0,
|
69 |
+
];
|
70 |
+
}
|
71 |
+
|
72 |
+
$statusMessage = sprintf(
|
73 |
+
Mage::helper('eurotext_translationmanager')->__("Batch %s / %s CMS Blocks:"),
|
74 |
+
$offset + 1,
|
75 |
+
$blockSrcCollection->getLastPageNumber()
|
76 |
+
);
|
77 |
+
|
78 |
+
foreach ($blockSrcCollection as $blockSrc) {
|
79 |
+
/** @var $blockSrc Mage_Cms_Model_Block */
|
80 |
+
$statusMessage .= "\n<br />- " . $blockSrc->getIdentifier();
|
81 |
+
/** @var $blockDst Mage_Cms_Model_Block */
|
82 |
+
$blockDst = clone $blockSrc;
|
83 |
+
|
84 |
+
$identifier = $blockSrc->getIdentifier();
|
85 |
+
/** @var Mage_Cms_Model_Block $matchingPage */
|
86 |
+
$matchingPage = Mage::getResourceModel('cms/block_collection')
|
87 |
+
->addStoreFilter($project->getStoreDst())
|
88 |
+
->addFieldToFilter('identifier', $identifier)
|
89 |
+
->getFirstItem();
|
90 |
+
|
91 |
+
if (!$matchingPage->isObjectNew()) {
|
92 |
+
$blockDst = $matchingPage;
|
93 |
+
}
|
94 |
+
|
95 |
+
$this->addBasicInformation($project, $blockSrc, $blockDst);
|
96 |
+
|
97 |
+
foreach ($this->attributes as $attr => $nodeName) {
|
98 |
+
$this->addAttributeToXml($attr, $nodeName, $blockSrc, $blockDst, $manualSelected);
|
99 |
+
}
|
100 |
+
|
101 |
+
if ($project->isExportingMetaAttributes()) {
|
102 |
+
foreach ($this->metAttributes as $attr => $nodeName) {
|
103 |
+
$this->addAttributeToXml($attr, $nodeName, $blockSrc, $blockDst, $manualSelected);
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
$this->writeXmlToFile($project, $blockSrc);
|
108 |
+
$this->createNewDOMDocument();
|
109 |
+
}
|
110 |
+
|
111 |
+
return [
|
112 |
+
"status_msg" => $statusMessage,
|
113 |
+
"offset" => ($offset + 1),
|
114 |
+
"step" => ProjectExporter::STEP_COLLECT_CMSBLOCKS,
|
115 |
+
];
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* @param string $nodeName
|
120 |
+
* @param string $value
|
121 |
+
* @return DOMElement
|
122 |
+
*/
|
123 |
+
private function addNodeToBlockNode($nodeName, $value)
|
124 |
+
{
|
125 |
+
$item = $this->doc->createElement($nodeName);
|
126 |
+
$item->appendChild($this->doc->createTextNode($value));
|
127 |
+
$this->cmsSiteNode->appendChild($item);
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @param string $attr
|
132 |
+
* @param string $nodeName
|
133 |
+
* @param Mage_Cms_Model_Block $blockSrc
|
134 |
+
* @param Mage_Cms_Model_Block $blockDst
|
135 |
+
* @param bool $manualSelected
|
136 |
+
*/
|
137 |
+
private function addAttributeToXml($attr, $nodeName, $blockSrc, $blockDst, $manualSelected)
|
138 |
+
{
|
139 |
+
$srcValue = $blockSrc->getDataUsingMethod($attr);
|
140 |
+
$dstValue = $blockDst->getDataUsingMethod($attr);
|
141 |
+
if ($srcValue != "" && (($srcValue == $dstValue) || ($dstValue == "") || ($manualSelected))) {
|
142 |
+
$item = $this->doc->createElement($nodeName);
|
143 |
+
Mage::helper('eurotext_translationmanager/xml')
|
144 |
+
->appendTextChild($this->doc, $item, $srcValue);
|
145 |
+
$this->cmsSiteNode->appendChild($item);
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
151 |
+
* @param Mage_Cms_Model_Block $block
|
152 |
+
*/
|
153 |
+
private function writeXmlToFile(Eurotext_TranslationManager_Model_Project $project, $block)
|
154 |
+
{
|
155 |
+
if ($this->cmsSiteNode->hasChildNodes()) {
|
156 |
+
$subdir = 'cms-sites';
|
157 |
+
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')
|
158 |
+
->getXmlSubdirectoryAndMakeSureItExists($project, $subdir);
|
159 |
+
|
160 |
+
$identifier = Mage::helper('eurotext_translationmanager/filesystem')
|
161 |
+
->getFilenameSafeString($block->getIdentifier());
|
162 |
+
$xmlFilename = "$xmlDir/cmsblock-{$identifier}-{$block->getId()}.xml";
|
163 |
+
|
164 |
+
$this->doc->save($xmlFilename);
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
170 |
+
* @param Mage_Cms_Model_Block $blockSrc
|
171 |
+
* @param Mage_Cms_Model_Block $blockDst
|
172 |
+
*/
|
173 |
+
private function addBasicInformation(Eurotext_TranslationManager_Model_Project $project, $blockSrc, $blockDst)
|
174 |
+
{
|
175 |
+
$this->addNodeToBlockNode("Id", $blockSrc->getId());
|
176 |
+
$this->addNodeToBlockNode("StoreviewSrc", $project->getStoreviewSrc());
|
177 |
+
$this->addNodeToBlockNode("StoreviewDst", $project->getStoreviewDst());
|
178 |
+
$this->addNodeToBlockNode("PageIdDst", $blockDst->getId() != $blockSrc->getId() ? $blockDst->getId() : -1);
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* @param int $storeId
|
183 |
+
* @return Mage_Cms_Model_Resource_Block_Collection
|
184 |
+
*/
|
185 |
+
private function getCmsBlockCollectionFor($storeId)
|
186 |
+
{
|
187 |
+
return Mage::getResourceModel('cms/block_collection')
|
188 |
+
->addStoreFilter($storeId)
|
189 |
+
->addOrder('block_id');
|
190 |
+
}
|
191 |
+
|
192 |
+
private function createNewDOMDocument()
|
193 |
+
{
|
194 |
+
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
195 |
+
$this->doc->formatOutput = true;
|
196 |
+
$cmsSites = $this->doc->createElement("cms-sites");
|
197 |
+
$this->doc->appendChild($cmsSites);
|
198 |
+
$this->cmsSiteNode = $this->doc->createElement("cms-site");
|
199 |
+
$cmsSites->appendChild($this->cmsSiteNode);
|
200 |
+
}
|
201 |
+
}
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Eurotext_TranslationManager_Model_Export_Project as ProjectExporter;
|
4 |
+
|
5 |
+
class Eurotext_TranslationManager_Model_Export_Project_CmsPage
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* @var string[]
|
9 |
+
*/
|
10 |
+
private $attributes = [
|
11 |
+
'title' => 'Title',
|
12 |
+
'content' => 'Content',
|
13 |
+
'content_heading' => 'ContentHeading',
|
14 |
+
];
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var string[]
|
18 |
+
*/
|
19 |
+
private $metAttributes = [
|
20 |
+
'meta_keywords' => 'SeoKeywords',
|
21 |
+
'meta_description' => 'SeoDescription',
|
22 |
+
];
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var DOMDocument
|
26 |
+
*/
|
27 |
+
private $doc;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var DOMElement
|
31 |
+
*/
|
32 |
+
private $cmsSiteNode;
|
33 |
+
|
34 |
+
public function __construct()
|
35 |
+
{
|
36 |
+
$this->createNewDOMDocument();
|
37 |
+
}
|
38 |
+
|
39 |
+
public function process(Eurotext_TranslationManager_Model_Project $project, $offset)
|
40 |
+
{
|
41 |
+
$project->addAllRelationalData();
|
42 |
+
$helper = Mage::helper('eurotext_translationmanager');
|
43 |
+
|
44 |
+
$manualSelected = false;
|
45 |
+
|
46 |
+
/** @var Mage_Cms_Model_Resource_page_Collection $pageSrcCollection */
|
47 |
+
$pageSrcCollection = $this->getCmsPageCollectionFor($project->getStoreviewSrc());
|
48 |
+
/** @var Mage_Cms_Model_Resource_page_Collection $pageDstCollection */
|
49 |
+
$pageDstCollection = $this->getCmsPageCollectionFor($project->getStoreviewDst());
|
50 |
+
|
51 |
+
if (!$project->isExportingAllCmsContent()) {
|
52 |
+
$pageSrcCollection->addFieldToFilter('main_table.page_id', ['in' => $project->getPages()]);
|
53 |
+
$pageDstCollection->addFieldToFilter('main_table.page_id', ['in' => $project->getPages()]);
|
54 |
+
$manualSelected = true;
|
55 |
+
}
|
56 |
+
|
57 |
+
if ((!$project->isExportingAllCmsContent() && !count($project->getPages()))
|
58 |
+
|| $offset > $pageSrcCollection->getLastPageNumber()
|
59 |
+
) {
|
60 |
+
return [
|
61 |
+
'status_msg' => $helper->__("Exported CMS Pages."),
|
62 |
+
'step' => ProjectExporter::STEP_COLLECT_CMSBLOCKS,
|
63 |
+
'offset' => 1,
|
64 |
+
];
|
65 |
+
}
|
66 |
+
|
67 |
+
$statusMessage = sprintf(
|
68 |
+
Mage::helper('eurotext_translationmanager')->__("Batch %s / %s CMS Pages:"),
|
69 |
+
$offset + 1,
|
70 |
+
$pageSrcCollection->getLastPageNumber()
|
71 |
+
);
|
72 |
+
foreach ($pageSrcCollection as $pageSrc) {
|
73 |
+
$statusMessage .= "\n<br />- " . $pageSrc->getIdentifier();
|
74 |
+
/** @var $pageSrc Mage_Cms_Model_Page */
|
75 |
+
/** @var $pageDst Mage_Cms_Model_Page */
|
76 |
+
$pageDst = clone $pageSrc;
|
77 |
+
|
78 |
+
$identifier = $pageSrc->getIdentifier();
|
79 |
+
/** @var Mage_Cms_Model_Page $matchingPage */
|
80 |
+
$matchingPage = Mage::getResourceModel('cms/page_collection')
|
81 |
+
->addStoreFilter($project->getStoreviewDst())
|
82 |
+
->addFieldToFilter('identifier', $identifier)
|
83 |
+
->getFirstItem();
|
84 |
+
|
85 |
+
if (!$matchingPage->isObjectNew()) {
|
86 |
+
$pageDst = $matchingPage;
|
87 |
+
}
|
88 |
+
|
89 |
+
$this->addBasicInformation($project, $pageSrc, $pageDst);
|
90 |
+
|
91 |
+
foreach ($this->attributes as $attr => $nodeName) {
|
92 |
+
$this->addAttributeToXml($attr, $nodeName, $pageSrc, $pageDst, $manualSelected);
|
93 |
+
}
|
94 |
+
|
95 |
+
if ($project->isExportingMetaAttributes()) {
|
96 |
+
foreach ($this->metAttributes as $attr => $nodeName) {
|
97 |
+
$this->addAttributeToXml($attr, $nodeName, $pageSrc, $pageDst, $manualSelected);
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
$this->writeXmlToFile($project, $pageSrc);
|
102 |
+
$this->createNewDOMDocument();
|
103 |
+
}
|
104 |
+
|
105 |
+
return [
|
106 |
+
'step' => ProjectExporter::STEP_COLLECT_CMSPAGES,
|
107 |
+
'offset' => $offset + 1,
|
108 |
+
'status_msg' => $statusMessage,
|
109 |
+
];
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @param string $nodeName
|
114 |
+
* @param string $value
|
115 |
+
*/
|
116 |
+
private function addNodeTopageNode($nodeName, $value)
|
117 |
+
{
|
118 |
+
$item = $this->doc->createElement($nodeName);
|
119 |
+
$item->appendChild($this->doc->createTextNode($value));
|
120 |
+
$this->cmsSiteNode->appendChild($item);
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* @param string $attr
|
125 |
+
* @param string $nodeName
|
126 |
+
* @param Mage_Cms_Model_Page $pageSrc
|
127 |
+
* @param Mage_Cms_Model_Page $pageDst
|
128 |
+
* @param bool $manualSelected
|
129 |
+
*/
|
130 |
+
private function addAttributeToXml($attr, $nodeName, $pageSrc, $pageDst, $manualSelected)
|
131 |
+
{
|
132 |
+
$srcValue = $pageSrc->getDataUsingMethod($attr);
|
133 |
+
$dstValue = $pageDst->getDataUsingMethod($attr);
|
134 |
+
if ($srcValue != "" && (($srcValue == $dstValue) || ($dstValue == "") || ($manualSelected))) {
|
135 |
+
$item = $this->doc->createElement($nodeName);
|
136 |
+
Mage::helper('eurotext_translationmanager/xml')
|
137 |
+
->appendTextChild($this->doc, $item, $srcValue);
|
138 |
+
$this->cmsSiteNode->appendChild($item);
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
144 |
+
* @param Mage_Cms_Model_Page $page
|
145 |
+
*/
|
146 |
+
private function writeXmlToFile(Eurotext_TranslationManager_Model_Project $project, $page)
|
147 |
+
{
|
148 |
+
if ($this->cmsSiteNode->hasChildNodes()) {
|
149 |
+
$subdir = 'cms-sites';
|
150 |
+
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')
|
151 |
+
->getXmlSubdirectoryAndMakeSureItExists($project, $subdir);
|
152 |
+
|
153 |
+
$identifier = Mage::helper('eurotext_translationmanager/filesystem')
|
154 |
+
->getFilenameSafeString($page->getIdentifier());
|
155 |
+
|
156 |
+
$xmlFilename = "$xmlDir/cms-" . Mage::helper('eurotext_translationmanager/filesystem')
|
157 |
+
->getFilenameSafeString($identifier) . "-" . $page->getId() . ".xml";
|
158 |
+
|
159 |
+
$this->doc->save($xmlFilename);
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
165 |
+
* @param Mage_Cms_Model_Page $pageSrc
|
166 |
+
* @param Mage_Cms_Model_Page $pageDst
|
167 |
+
*/
|
168 |
+
private function addBasicInformation(Eurotext_TranslationManager_Model_Project $project, $pageSrc, $pageDst)
|
169 |
+
{
|
170 |
+
$this->addNodeTopageNode("Id", $pageSrc->getId());
|
171 |
+
$this->addNodeTopageNode("StoreviewSrc", $project->getStoreviewSrc());
|
172 |
+
$this->addNodeTopageNode("StoreviewDst", $project->getStoreviewDst());
|
173 |
+
$this->addNodeTopageNode("PageIdDst", $pageDst->getId() != $pageSrc->getId() ? $pageDst->getId() : -1);
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @param int $storeId
|
178 |
+
*
|
179 |
+
* @return Mage_Cms_Model_Resource_page_Collection
|
180 |
+
*/
|
181 |
+
private function getCmsPageCollectionFor($storeId)
|
182 |
+
{
|
183 |
+
return Mage::getResourceModel('cms/page_collection')
|
184 |
+
->addStoreFilter($storeId)
|
185 |
+
->addOrder('page_id');
|
186 |
+
}
|
187 |
+
|
188 |
+
private function createNewDOMDocument()
|
189 |
+
{
|
190 |
+
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
191 |
+
$this->doc->formatOutput = true;
|
192 |
+
$cmsSites = $this->doc->createElement("cms-sites");
|
193 |
+
$this->doc->appendChild($cmsSites);
|
194 |
+
$this->cmsSiteNode = $this->doc->createElement("cms-site");
|
195 |
+
$cmsSites->appendChild($this->cmsSiteNode);
|
196 |
+
}
|
197 |
+
}
|
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Export_Project_CreateControlFile
|
4 |
+
{
|
5 |
+
private $languageCombinationNode;
|
6 |
+
/**
|
7 |
+
* @var string
|
8 |
+
*/
|
9 |
+
private $currentDirectory;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @var DOMDocument
|
13 |
+
*/
|
14 |
+
private $doc;
|
15 |
+
/**
|
16 |
+
* @var DOMElement
|
17 |
+
*/
|
18 |
+
private $requestNode;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var DOMElement
|
22 |
+
*/
|
23 |
+
private $generalNode;
|
24 |
+
|
25 |
+
private $allowedDirectories = [
|
26 |
+
'framework',
|
27 |
+
'articles',
|
28 |
+
'attributes',
|
29 |
+
'categories',
|
30 |
+
'cms-sites',
|
31 |
+
'emailtemplates'
|
32 |
+
];
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @var Eurotext_TranslationManager_Helper_Data
|
36 |
+
*/
|
37 |
+
private $helper;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @var Eurotext_TranslationManager_Helper_Eurotext
|
41 |
+
*/
|
42 |
+
private $etHelper;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @var Eurotext_TranslationManager_Helper_Config
|
46 |
+
*/
|
47 |
+
private $configHelper;
|
48 |
+
|
49 |
+
public function __construct()
|
50 |
+
{
|
51 |
+
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
52 |
+
$this->doc->formatOutput = true;
|
53 |
+
$this->requestNode = $this->doc->createElement("Request");
|
54 |
+
$this->doc->appendChild($this->requestNode);
|
55 |
+
$this->generalNode = $this->doc->createElement("General");
|
56 |
+
$this->requestNode->appendChild($this->generalNode);
|
57 |
+
$this->languageCombinationNode = $this->doc->createElement("LanguageCombinations");
|
58 |
+
$this->requestNode->appendChild($this->languageCombinationNode);
|
59 |
+
|
60 |
+
$this->helper = Mage::helper('eurotext_translationmanager');
|
61 |
+
$this->etHelper = Mage::helper('eurotext_translationmanager/eurotext');
|
62 |
+
$this->configHelper = Mage::helper('eurotext_translationmanager/config');
|
63 |
+
}
|
64 |
+
|
65 |
+
public function create(Eurotext_TranslationManager_Model_Project $project)
|
66 |
+
{
|
67 |
+
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')->getExportXMLPath($project);
|
68 |
+
|
69 |
+
$this->addGeneralNode($project);
|
70 |
+
$this->addLanguageCombinations($project, $xmlDir);
|
71 |
+
$this->writeXml($xmlDir);
|
72 |
+
}
|
73 |
+
|
74 |
+
private function addGeneralNode(Eurotext_TranslationManager_Model_Project $project)
|
75 |
+
{
|
76 |
+
$this->addCustomerContact();
|
77 |
+
$this->addCustomerEmail();
|
78 |
+
$this->addCustomerId();
|
79 |
+
$this->addProjectName($project);
|
80 |
+
$this->addDescription($project);
|
81 |
+
$this->addDeadline();
|
82 |
+
$this->addTarget();
|
83 |
+
}
|
84 |
+
|
85 |
+
private function addCustomerContact()
|
86 |
+
{
|
87 |
+
$nodeCustomerContact = $this->doc->createElement("CustomerContact");
|
88 |
+
$nodeCustomerContact->appendChild($this->doc->createTextNode($this->configHelper->getName()));
|
89 |
+
$this->generalNode->appendChild($nodeCustomerContact);
|
90 |
+
}
|
91 |
+
|
92 |
+
private function addCustomerEmail()
|
93 |
+
{
|
94 |
+
$nodeCustomerEmail = $this->doc->createElement("CustomerMail");
|
95 |
+
$nodeCustomerEmail->appendChild($this->doc->createTextNode($this->configHelper->getEmail()));
|
96 |
+
$this->generalNode->appendChild($nodeCustomerEmail);
|
97 |
+
}
|
98 |
+
|
99 |
+
private function addCustomerId()
|
100 |
+
{
|
101 |
+
$customerId = $this->doc->createElement("CustomerID_of_Supplier");
|
102 |
+
$customerId->appendChild($this->doc->createTextNode($this->configHelper->getCustomerId()));
|
103 |
+
$this->generalNode->appendChild($customerId);
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
108 |
+
*/
|
109 |
+
private function addProjectName(Eurotext_TranslationManager_Model_Project $project)
|
110 |
+
{
|
111 |
+
$nodeProjectName = $this->doc->createElement("ProjectName");
|
112 |
+
$nodeProjectName->appendChild($this->doc->createTextNode($project->getProjectName()));
|
113 |
+
$this->generalNode->appendChild($nodeProjectName);
|
114 |
+
}
|
115 |
+
|
116 |
+
private function addDeadline()
|
117 |
+
{
|
118 |
+
$nodeDeadline = $this->doc->createElement("Deadline");
|
119 |
+
$this->generalNode->appendChild($nodeDeadline);
|
120 |
+
}
|
121 |
+
|
122 |
+
private function addTarget()
|
123 |
+
{
|
124 |
+
$nodeTargetProject = $this->doc->createElement("TargetProject");
|
125 |
+
$nodeTargetProject->appendChild($this->doc->createTextNode("Quote"));
|
126 |
+
$this->generalNode->appendChild($nodeTargetProject);
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
131 |
+
*/
|
132 |
+
private function addDescription(Eurotext_TranslationManager_Model_Project $project)
|
133 |
+
{
|
134 |
+
$moduleVersion = $this->configHelper->getModuleVersion();
|
135 |
+
|
136 |
+
$srcName = Mage::getModel('core/store')->load($project->getStoreviewSrc())->getName();
|
137 |
+
$dstName = Mage::getModel('core/store')->load($project->getStoreviewDst())->getName();
|
138 |
+
|
139 |
+
$description = '';
|
140 |
+
|
141 |
+
if ($project->getCustomerComment()) {
|
142 |
+
$description .= <<<COMMENT
|
143 |
+
HINWEIS DES KUNDEN:
|
144 |
+
##########
|
145 |
+
{$project->getCustomerComment()}
|
146 |
+
##########
|
147 |
+
|
148 |
+
COMMENT;
|
149 |
+
|
150 |
+
}
|
151 |
+
|
152 |
+
$description .= sprintf(
|
153 |
+
Eurotext_TranslationManager_Model_Project::INFORMATION_PATTERN,
|
154 |
+
$project->getId(),
|
155 |
+
$moduleVersion
|
156 |
+
);
|
157 |
+
$description .= "\n\nSrc-Storeview: '" . $srcName . "' (" . $project->getStoreviewSrcLocale() . ")\n";
|
158 |
+
$description .= "Dst-Storeview: '" . $dstName . "' (" . $project->getStoreviewDstLocale() . ")\n";
|
159 |
+
$description .= "Export SEO content: " . ($project->isExportingMetaAttributes() ? "Yes" : "No") . "\n";
|
160 |
+
$description .= "Export attributes and attribute options? ";
|
161 |
+
$description .= ($project->isExportingAttributes() ? "Yes" : "No") . "\n";
|
162 |
+
$description .= "Export URL keys? " . ($project->isExportingUrlKeys() ? "Yes" : "No");
|
163 |
+
|
164 |
+
$nodeDescription = $this->doc->createElement("Description");
|
165 |
+
$nodeDescription->appendChild($this->doc->createTextNode($description));
|
166 |
+
$this->generalNode->appendChild($nodeDescription);
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* @param string $directory
|
171 |
+
*/
|
172 |
+
private function validateDirectory($directory)
|
173 |
+
{
|
174 |
+
if (!in_array($directory, $this->allowedDirectories)) {
|
175 |
+
throw new Exception(sprintf('Directory found, but not allowed: %s', $directory));
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
181 |
+
* @param string $xmlDir
|
182 |
+
*/
|
183 |
+
private function addLanguageCombinations(Eurotext_TranslationManager_Model_Project $project, $xmlDir)
|
184 |
+
{
|
185 |
+
$allFiles = $this->getFilesToZip($xmlDir);
|
186 |
+
|
187 |
+
$nodeLanguageCombination = null;
|
188 |
+
foreach ($allFiles as $file) {
|
189 |
+
$directory = strtok($file, '/');
|
190 |
+
$this->validateDirectory($directory);
|
191 |
+
if ($this->isDirectoryChanged($directory)) {
|
192 |
+
if ($nodeLanguageCombination) {
|
193 |
+
$this->languageCombinationNode->appendChild($nodeLanguageCombination);
|
194 |
+
}
|
195 |
+
$nodeLanguageCombination = $this->createLanguageCombination($project);
|
196 |
+
}
|
197 |
+
|
198 |
+
$this->addFileTo($nodeLanguageCombination, $file, $xmlDir);
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* @param string $xmlDir
|
204 |
+
*/
|
205 |
+
private function writeXml($xmlDir)
|
206 |
+
{
|
207 |
+
$xmlFilename = $xmlDir . DS . "control.xml";
|
208 |
+
$this->doc->save($xmlFilename);
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* @param string $directory
|
213 |
+
* @return bool
|
214 |
+
*/
|
215 |
+
private function isDirectoryChanged($directory)
|
216 |
+
{
|
217 |
+
if ($this->currentDirectory !== $directory) {
|
218 |
+
$this->currentDirectory = $directory;
|
219 |
+
|
220 |
+
return true;
|
221 |
+
}
|
222 |
+
|
223 |
+
return false;
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* @param string $locale
|
228 |
+
* @return array
|
229 |
+
*/
|
230 |
+
private function getEurotextLocale($locale)
|
231 |
+
{
|
232 |
+
$eurotextLocale = $this->helper->getLocaleInfoByMagentoLocale($locale);
|
233 |
+
if ($eurotextLocale['supported'] == false) {
|
234 |
+
throw new Exception('Locale is not supported by Eurotext.');
|
235 |
+
}
|
236 |
+
|
237 |
+
return $eurotextLocale;
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
242 |
+
* @return DOMElement
|
243 |
+
*/
|
244 |
+
private function createLanguageCombination(Eurotext_TranslationManager_Model_Project $project)
|
245 |
+
{
|
246 |
+
$nodeLanguageCombination = $this->doc->createElement("LanguageCombination");
|
247 |
+
$source = $this->doc->createAttribute("source");
|
248 |
+
|
249 |
+
$etLocalesrc = $this->getEurotextLocale($project->getStoreviewSrcLocale());
|
250 |
+
$source->value = $etLocalesrc['locale_eurotext'];
|
251 |
+
$nodeLanguageCombination->appendChild($source);
|
252 |
+
|
253 |
+
$etLocaleDst = $this->getEurotextLocale($project->getStoreviewDstLocale());
|
254 |
+
$target = $this->doc->createAttribute("target");
|
255 |
+
$target->value = $etLocaleDst['locale_eurotext'];
|
256 |
+
|
257 |
+
$nodeLanguageCombination->appendChild($target);
|
258 |
+
|
259 |
+
$this->languageCombinationNode->appendChild($nodeLanguageCombination);
|
260 |
+
|
261 |
+
return $nodeLanguageCombination;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* @param string $xmlDir
|
266 |
+
* @return array
|
267 |
+
*/
|
268 |
+
private function getFilesToZip($xmlDir)
|
269 |
+
{
|
270 |
+
$files = iterator_to_array(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($xmlDir)));
|
271 |
+
|
272 |
+
$directoryFiltered = array_filter(
|
273 |
+
$files,
|
274 |
+
function (SplFileInfo $entry) {
|
275 |
+
return $entry->isFile();
|
276 |
+
}
|
277 |
+
);
|
278 |
+
$allFilesWithoutXmlDir = array_map(
|
279 |
+
function (SplFileInfo $entry) use ($xmlDir) {
|
280 |
+
return str_replace($xmlDir . '/', '', $entry->getRealPath());
|
281 |
+
},
|
282 |
+
$directoryFiltered
|
283 |
+
);
|
284 |
+
|
285 |
+
return $allFilesWithoutXmlDir;
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* @param DOMElement $nodeLanguageCombination
|
290 |
+
* @param string $file
|
291 |
+
* @param string $xmlDir
|
292 |
+
*/
|
293 |
+
private function addFileTo($nodeLanguageCombination, $file, $xmlDir)
|
294 |
+
{
|
295 |
+
$absoluteFile = $xmlDir . '/' . $file;
|
296 |
+
|
297 |
+
$nodeUploadedFile = $this->doc->createElement("uploadedFile");
|
298 |
+
$nodeLanguageCombination->appendChild($nodeUploadedFile);
|
299 |
+
|
300 |
+
$attrfileName = $this->doc->createAttribute("fileName");
|
301 |
+
$attrfileName->value = $file;
|
302 |
+
$nodeUploadedFile->appendChild($attrfileName);
|
303 |
+
|
304 |
+
|
305 |
+
$attrsize = $this->doc->createAttribute("size");
|
306 |
+
$attrsize->value = filesize($absoluteFile);
|
307 |
+
$nodeUploadedFile->appendChild($attrsize);
|
308 |
+
}
|
309 |
+
}
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Export_Project_EmailDatabaseTemplates
|
4 |
+
{
|
5 |
+
const PREG_XML_PATH = '#/config/sections/([_a-zA-Z]*)/groups/([_a-zA-Z]*)/fields/([_a-zA-Z]*)/source_model#';
|
6 |
+
const PAGE_SIZE = 20;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @var Eurotext_TranslationManager_Model_Project
|
10 |
+
*/
|
11 |
+
private $project;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var int
|
15 |
+
*/
|
16 |
+
private $offset;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
private $xmlDir;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var string[]
|
25 |
+
*/
|
26 |
+
private $emailConfigPaths;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
30 |
+
* @param int $offset
|
31 |
+
* @return mixed[]
|
32 |
+
*/
|
33 |
+
public function process(Eurotext_TranslationManager_Model_Project $project, $offset)
|
34 |
+
{
|
35 |
+
$this->project = $project;
|
36 |
+
$this->offset = $offset;
|
37 |
+
$this->project->addAllRelationalData();
|
38 |
+
|
39 |
+
/** @var $templateCollection Mage_Core_Model_Resource_Email_Template_Collection */
|
40 |
+
$templateCollection = Mage::getResourceModel('core/email_template_collection');
|
41 |
+
$templateCollection->setPageSize(self::PAGE_SIZE);
|
42 |
+
$templateCollection->setCurPage($this->offset);
|
43 |
+
|
44 |
+
if (!$this->project->isExportingAllEmailTemplates()) {
|
45 |
+
$templateCollection->addFieldToFilter(
|
46 |
+
'template_id',
|
47 |
+
['in' => $this->project->getTransactionEmailDatabase()]
|
48 |
+
);
|
49 |
+
}
|
50 |
+
|
51 |
+
if (!$templateCollection->getSize()) {
|
52 |
+
return [
|
53 |
+
'status_msg' => $this->getHelper()->__("No Email Templates from the database exported"),
|
54 |
+
'offset' => 1,
|
55 |
+
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_EXPORT_ATTRIBUTES,
|
56 |
+
];
|
57 |
+
}
|
58 |
+
|
59 |
+
if ($templateCollection->getLastPageNumber() < $this->offset) {
|
60 |
+
return [
|
61 |
+
'status_msg' => $this->getHelper()->__("All Email-Database-Templates exported"),
|
62 |
+
'offset' => 1,
|
63 |
+
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_EXPORT_ATTRIBUTES,
|
64 |
+
];
|
65 |
+
}
|
66 |
+
|
67 |
+
$this->xmlDir = Mage::helper('eurotext_translationmanager/filesystem')
|
68 |
+
->getXmlSubdirectoryAndMakeSureItExists($project, 'emailtemplates');
|
69 |
+
|
70 |
+
$this->writeXml($templateCollection);
|
71 |
+
|
72 |
+
return [
|
73 |
+
'status_msg' => $this->getHelper()->__("%s Email-Database-Templates exported", $templateCollection->getSize()),
|
74 |
+
'offset' => $this->offset + 1,
|
75 |
+
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_EXPORT_ATTRIBUTES,
|
76 |
+
];
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* @return Eurotext_TranslationManager_Helper_Data
|
81 |
+
*/
|
82 |
+
private function getHelper()
|
83 |
+
{
|
84 |
+
return Mage::helper('eurotext_translationmanager');
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @param Mage_Core_Model_Resource_Email_Template_Collection $templateCollection
|
89 |
+
*/
|
90 |
+
private function writeXml($templateCollection)
|
91 |
+
{
|
92 |
+
$i = 1;
|
93 |
+
foreach ($templateCollection as $t) {
|
94 |
+
$xmlWriter = new XMLWriter();
|
95 |
+
$xmlWriter->openMemory();
|
96 |
+
$xmlWriter->startDocument('1.0', 'UTF-8');
|
97 |
+
$xmlWriter->startElement('emails');
|
98 |
+
|
99 |
+
$xmlWriter->startElement('email');
|
100 |
+
$xmlWriter->writeElement('Id', $t->getId());
|
101 |
+
$xmlWriter->writeElement('StoreviewSrc', $this->project->getStoreviewSrc());
|
102 |
+
$xmlWriter->writeElement('StoreviewDst', $this->project->getStoreviewDst());
|
103 |
+
foreach ($this->getPathsForTemplate($t->getId()) as $path) {
|
104 |
+
$xmlWriter->writeElement('Path', $path);
|
105 |
+
}
|
106 |
+
$xmlWriter->writeElement('Database', 'config_path');
|
107 |
+
$type = $t->getType() == \Mage_Core_Model_Template::TYPE_HTML ? 'html' : 'plaintext';
|
108 |
+
$xmlWriter->writeElement('Type', $type);
|
109 |
+
$xmlWriter->startElement('Styles');
|
110 |
+
$xmlWriter->writeCdata($t->getTemplateStyles());
|
111 |
+
$xmlWriter->endElement(); // Styles
|
112 |
+
$xmlWriter->startElement('Subject');
|
113 |
+
$xmlWriter->writeCdata($t->getTemplateSubject());
|
114 |
+
$xmlWriter->endElement(); // Subject
|
115 |
+
$xmlWriter->startElement('Text');
|
116 |
+
$xmlWriter->writeCdata(
|
117 |
+
Mage::helper('eurotext_translationmanager/string')
|
118 |
+
->replaceMagentoBlockDirectives($t->getTemplateText())
|
119 |
+
);
|
120 |
+
$xmlWriter->endElement(); // Text
|
121 |
+
$xmlWriter->endElement(); // email
|
122 |
+
|
123 |
+
$xmlWriter->endElement(); // emails
|
124 |
+
|
125 |
+
file_put_contents(
|
126 |
+
sprintf($this->xmlDir . '/emailtemplates-db-%s.xml', ($this->offset * self::PAGE_SIZE) + $i++),
|
127 |
+
$xmlWriter->flush()
|
128 |
+
);
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
private function getPathsForTemplate($id)
|
133 |
+
{
|
134 |
+
$this->collectEmailConfigurationPaths();
|
135 |
+
|
136 |
+
$setPaths = [];
|
137 |
+
foreach ($this->emailConfigPaths as $path) {
|
138 |
+
if (Mage::getStoreConfig($path, $this->project->getStoreviewSrc()) == $id) {
|
139 |
+
$setPaths[] = $path;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
return $setPaths;
|
144 |
+
}
|
145 |
+
|
146 |
+
private function collectEmailConfigurationPaths()
|
147 |
+
{
|
148 |
+
if ($this->emailConfigPaths === null) {
|
149 |
+
$this->emailConfigPaths = [];
|
150 |
+
|
151 |
+
$config = Mage::getConfig()->loadModulesConfiguration('system.xml')->applyExtends();
|
152 |
+
$dom = new DOMDocument();
|
153 |
+
$dom->loadXML($config->getXmlString());
|
154 |
+
|
155 |
+
$xpath = new DOMXPath($dom);
|
156 |
+
$allEmails = $xpath->evaluate('//source_model[text()=\'adminhtml/system_config_source_email_template\']');
|
157 |
+
foreach ($allEmails as $sourceModelNode) {
|
158 |
+
/** @var DOMNode $sourceModelNode $ */
|
159 |
+
$emailPath = $sourceModelNode->getNodePath();
|
160 |
+
if (preg_match(self::PREG_XML_PATH, $emailPath, $matches)) {
|
161 |
+
unset($matches[0]);
|
162 |
+
$this->emailConfigPaths[] = implode('/', $matches);
|
163 |
+
}
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Export_Project_EmailFileTemplates
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var bool
|
7 |
+
*/
|
8 |
+
private $filesManuallySelected = false;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var string
|
12 |
+
*/
|
13 |
+
private $xmlDir;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var Eurotext_TranslationManager_Model_Project
|
17 |
+
*/
|
18 |
+
private $project;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var mixed[]
|
22 |
+
*/
|
23 |
+
private $emailPaths;
|
24 |
+
|
25 |
+
/** @var int */
|
26 |
+
private $exportedTemplateFiles = 0;
|
27 |
+
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
31 |
+
* @return mixed[]
|
32 |
+
*/
|
33 |
+
public function process(Eurotext_TranslationManager_Model_Project $project)
|
34 |
+
{
|
35 |
+
$this->project = $project;
|
36 |
+
$emailTemplates = $this->createTemplateCollection($project);
|
37 |
+
$this->filterTemplatesByProjectSetting($project, $emailTemplates);
|
38 |
+
|
39 |
+
$numberOfEmailTemplatesExported = $emailTemplates->count();
|
40 |
+
|
41 |
+
if (!$numberOfEmailTemplatesExported) {
|
42 |
+
return [
|
43 |
+
'status_msg' => $this->getHelper()->__("No Email-File-Templates exported"),
|
44 |
+
'offset' => 1,
|
45 |
+
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_COLLECT_TEMPLATES_DATABASE,
|
46 |
+
];
|
47 |
+
}
|
48 |
+
|
49 |
+
$this->xmlDir = Mage::helper('eurotext_translationmanager/filesystem')
|
50 |
+
->getXmlSubdirectoryAndMakeSureItExists($project, 'emailtemplates');
|
51 |
+
|
52 |
+
$this->collectEmailTemplatesFromConfig();
|
53 |
+
$this->writeXml($emailTemplates, $project);
|
54 |
+
|
55 |
+
return [
|
56 |
+
'status_msg' => $this->getHelper()->__("Exported %s Email Templates", $this->exportedTemplateFiles),
|
57 |
+
'offset' => 1,
|
58 |
+
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_COLLECT_TEMPLATES_DATABASE,
|
59 |
+
];
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @param Varien_Data_Collection $templateCollection
|
64 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
65 |
+
*/
|
66 |
+
private function writeXml(
|
67 |
+
Varien_Data_Collection $templateCollection,
|
68 |
+
Eurotext_TranslationManager_Model_Project $project
|
69 |
+
) {
|
70 |
+
$i = 1;
|
71 |
+
foreach ($templateCollection as $template) {
|
72 |
+
$xmlWriter = new XMLWriter();
|
73 |
+
$xmlWriter->openMemory();
|
74 |
+
$xmlWriter->startDocument('1.0', 'UTF-8');
|
75 |
+
$xmlWriter->startElement('emails');
|
76 |
+
|
77 |
+
/** @var Varien_Object $template */
|
78 |
+
$relativeFilePath = $template->getData('relativeToLocaleTemplate');
|
79 |
+
$fileInConfigXml = substr($relativeFilePath, strlen('/email/'));
|
80 |
+
|
81 |
+
$baseLocale = Mage::getBaseDir('locale');
|
82 |
+
$filenameSrc = $baseLocale . "/{$project->getStoreviewSrcLocale()}/template$relativeFilePath";
|
83 |
+
$filenameDst = $baseLocale . "/{$project->getStoreviewDstLocale()}/template$relativeFilePath";
|
84 |
+
|
85 |
+
if (!$this->isTranslationNeeded($filenameDst) || !isset($this->emailPaths[$fileInConfigXml])) {
|
86 |
+
continue;
|
87 |
+
}
|
88 |
+
$this->exportedTemplateFiles++;
|
89 |
+
|
90 |
+
$info = $this->parseTemplate($filenameSrc);
|
91 |
+
|
92 |
+
$xmlWriter->startElement('email');
|
93 |
+
$xmlWriter->writeElement('Id', 0);
|
94 |
+
$xmlWriter->writeElement('StoreviewSrc', $this->project->getStoreviewSrc());
|
95 |
+
$xmlWriter->writeElement('StoreviewDst', $this->project->getStoreviewDst());
|
96 |
+
$xmlWriter->writeElement('Path', $relativeFilePath);
|
97 |
+
$xmlWriter->writeElement('Database', 'false');
|
98 |
+
$type = $this->emailPaths[$fileInConfigXml]['type'];
|
99 |
+
$xmlWriter->writeElement('Type', $type);
|
100 |
+
$xmlWriter->startElement('Styles');
|
101 |
+
$xmlWriter->writeCdata($info['styles']);
|
102 |
+
$xmlWriter->endElement(); // Styles
|
103 |
+
$xmlWriter->startElement('Subject');
|
104 |
+
$xmlWriter->writeCdata($info['subject']);
|
105 |
+
$xmlWriter->endElement(); // Subject
|
106 |
+
$xmlWriter->startElement('Text');
|
107 |
+
$xmlWriter->writeCdata($info['text']);
|
108 |
+
$xmlWriter->endElement(); // Text
|
109 |
+
$xmlWriter->endElement(); // email
|
110 |
+
|
111 |
+
$xmlWriter->endElement(); // emails
|
112 |
+
|
113 |
+
file_put_contents($this->xmlDir . "/emailtemplates-file-$i.xml", $xmlWriter->flush());
|
114 |
+
$i++;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* @param string $file
|
120 |
+
* @return string[]
|
121 |
+
*/
|
122 |
+
private function parseTemplate($file)
|
123 |
+
{
|
124 |
+
$content = file_get_contents($file);
|
125 |
+
|
126 |
+
preg_match('#<!--@subject(.*?)@-->#s', $content, $matches);
|
127 |
+
$info['subject'] = trim(isset($matches[1]) ? $matches[1] : '');
|
128 |
+
|
129 |
+
preg_match('#<!--@vars(.*?)@-->#s', $content, $matches);
|
130 |
+
$info['vars'] = trim(isset($matches[1]) ? $matches[1] : '');
|
131 |
+
|
132 |
+
preg_match('#<!--@styles(.*?)@-->#s', $content, $matches);
|
133 |
+
$info['styles'] = trim(isset($matches[1]) ? $matches[1] : '');
|
134 |
+
|
135 |
+
$info['text'] = Mage::helper('eurotext_translationmanager/string')
|
136 |
+
->replaceMagentoBlockDirectives(trim(preg_replace('#<!--@.*?@-->#s', '', $content)));
|
137 |
+
|
138 |
+
return $info;
|
139 |
+
}
|
140 |
+
|
141 |
+
private function collectEmailTemplatesFromConfig()
|
142 |
+
{
|
143 |
+
if ($this->emailPaths !== null) {
|
144 |
+
return;
|
145 |
+
}
|
146 |
+
|
147 |
+
$this->emailPaths = [];
|
148 |
+
|
149 |
+
$allEmails = Mage::getConfig()->getNode('global/template/email');
|
150 |
+
foreach ($allEmails->children() as $emailNode) {
|
151 |
+
$this->emailPaths[(string)$emailNode->file] = [
|
152 |
+
'label' => (string)$emailNode->label,
|
153 |
+
'file' => (string)$emailNode->file,
|
154 |
+
'type' => (string)$emailNode->type,
|
155 |
+
];
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* @return Eurotext_TranslationManager_Helper_Data
|
161 |
+
*/
|
162 |
+
private function getHelper()
|
163 |
+
{
|
164 |
+
return Mage::helper('eurotext_translationmanager');
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
169 |
+
* @return Eurotext_TranslationManager_Model_Resource_Emailtemplate_Filesystem_Collection
|
170 |
+
*/
|
171 |
+
private function createTemplateCollection(Eurotext_TranslationManager_Model_Project $project)
|
172 |
+
{
|
173 |
+
/** @var Eurotext_TranslationManager_Model_Resource_Emailtemplate_Filesystem_Collection $emailTemplates */
|
174 |
+
$renderer = Mage::getModel('eurotext_translationmanager/renderer_filesystem_relativeToLocaleTemplateDirectory');
|
175 |
+
$emailTemplates = Mage::getResourceModel('eurotext_translationmanager/emailtemplate_filesystem_collection')
|
176 |
+
->setLanguage($project->getStoreviewSrcLocale());
|
177 |
+
$emailTemplates->addRenderer($renderer);
|
178 |
+
|
179 |
+
return $emailTemplates;
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
184 |
+
* @param Eurotext_TranslationManager_Model_Resource_Emailtemplate_Filesystem_Collection $emailTemplates
|
185 |
+
*/
|
186 |
+
private function filterTemplatesByProjectSetting(
|
187 |
+
Eurotext_TranslationManager_Model_Project $project,
|
188 |
+
$emailTemplates
|
189 |
+
) {
|
190 |
+
if (!$project->isExportingAllEmailTemplates()) {
|
191 |
+
$this->filesManuallySelected = true;
|
192 |
+
$this->filterTemplatesByProject($project, $emailTemplates);
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
198 |
+
* @param Eurotext_TranslationManager_Model_Resource_Emailtemplate_Filesystem_Collection $emailTemplates
|
199 |
+
*/
|
200 |
+
private function filterTemplatesByProject(Eurotext_TranslationManager_Model_Project $project, $emailTemplates)
|
201 |
+
{
|
202 |
+
$filenames = Mage::getResourceModel('eurotext_translationmanager/project_emailtemplateFile_collection')
|
203 |
+
->addFieldToFilter('project_id', $project->getId())->getColumnValues('filename');
|
204 |
+
|
205 |
+
$emailTemplatesWithBasePath = array_map(
|
206 |
+
function ($template) use ($project) {
|
207 |
+
return Mage::getBaseDir('locale') . "/{$project->getStoreviewSrcLocale()}/template" . $template;
|
208 |
+
},
|
209 |
+
$filenames
|
210 |
+
);
|
211 |
+
|
212 |
+
$emailTemplates->addFieldToFilter('filename', ['in' => $emailTemplatesWithBasePath]);
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* @param string $destination
|
217 |
+
* @return bool
|
218 |
+
*/
|
219 |
+
private function isTranslationNeeded($destination)
|
220 |
+
{
|
221 |
+
return $this->filesManuallySelected || !file_exists($destination);
|
222 |
+
}
|
223 |
+
}
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
interface Eurotext_TranslationManager_Model_Export_Project_Exporter
|
4 |
+
{
|
5 |
+
public function process(Eurotext_TranslationManager_Model_Project $project, $exportBaseDir);
|
6 |
+
|
7 |
+
public function getExportSubDirectory();
|
8 |
+
}
|
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Export_Project_FtpUpload
|
4 |
+
{
|
5 |
+
const FTP_HOST = "eurotext-services.de";
|
6 |
+
const FTP_PORT = 21;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @var Eurotext_TranslationManager_Model_Project
|
10 |
+
*/
|
11 |
+
private $project;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var Eurotext_TranslationManager_Helper_Data
|
15 |
+
*/
|
16 |
+
private $helper;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
private $ftpUsername;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
private $ftpPassword;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
private $fallbackFilename;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var resource
|
35 |
+
*/
|
36 |
+
private $ftpConnection;
|
37 |
+
|
38 |
+
public function __construct()
|
39 |
+
{
|
40 |
+
$this->helper = Mage::helper('eurotext_translationmanager');
|
41 |
+
$this->configHelper = Mage::helper('eurotext_translationmanager/config');
|
42 |
+
|
43 |
+
$this->ftpUsername = $this->configHelper->getFtpUsername();
|
44 |
+
$this->ftpPassword = $this->configHelper->getFtpPassword();
|
45 |
+
}
|
46 |
+
|
47 |
+
public function upload(Eurotext_TranslationManager_Model_Project $project, $zipFile)
|
48 |
+
{
|
49 |
+
$this->project = $project;
|
50 |
+
$this->fallbackFilename = Mage::getBaseDir('export') . DS . $this->project->getData('zip_filename');
|
51 |
+
|
52 |
+
if (!$this->isUploadToEurotextEnabled()) {
|
53 |
+
$this->helper->log(
|
54 |
+
'File was not transmitted, FTP Upload is disabled in System > Configuration > Developer > Log',
|
55 |
+
Zend_Log::ERR
|
56 |
+
);
|
57 |
+
$this->createFallbackFile($zipFile);
|
58 |
+
$this->clearProjectFolder();
|
59 |
+
$this->updateProjectStatus();
|
60 |
+
|
61 |
+
return;
|
62 |
+
}
|
63 |
+
|
64 |
+
$uploadSuccess = $this->uploadZipFileToEurotext($zipFile);
|
65 |
+
|
66 |
+
if ((false === $uploadSuccess || true === $this->configHelper->isDebugMode())) {
|
67 |
+
$this->createFallbackFile($zipFile);
|
68 |
+
}
|
69 |
+
|
70 |
+
$this->clearProjectFolder();
|
71 |
+
$this->updateProjectStatus();
|
72 |
+
}
|
73 |
+
|
74 |
+
public function validateFtpConnection()
|
75 |
+
{
|
76 |
+
if (!$this->isUploadToEurotextEnabled()) {
|
77 |
+
return;
|
78 |
+
}
|
79 |
+
try {
|
80 |
+
$this->validateUsername();
|
81 |
+
$this->validateFtpConnectExists();
|
82 |
+
$this->validateFtpConnectIsEnabled();
|
83 |
+
|
84 |
+
$this->openFtpConnection();
|
85 |
+
|
86 |
+
$this->helper->log('Translation Portal Server successfully connected.', Zend_Log::INFO);
|
87 |
+
|
88 |
+
} catch (Eurotext_TranslationManager_Exception_FtpException $e) {
|
89 |
+
if ($this->ftpConnection) {
|
90 |
+
ftp_close($this->ftpConnection);
|
91 |
+
}
|
92 |
+
|
93 |
+
$this->helper->log('Could not login to Translation Portal Server.', Zend_Log::ERR);
|
94 |
+
|
95 |
+
throw new Eurotext_TranslationManager_Exception_FtpException(
|
96 |
+
'Archive could not be transmitted. Please use the debug info in var/log/eurotext_fatal.log'
|
97 |
+
. "\n\n" . $e->getMessage()
|
98 |
+
);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
private function openFtpConnection()
|
103 |
+
{
|
104 |
+
$this->ftpConnection = @ftp_connect(self::FTP_HOST, self::FTP_PORT, 30);
|
105 |
+
if (!@ftp_login($this->ftpConnection, $this->ftpUsername, $this->ftpPassword)) {
|
106 |
+
throw new Eurotext_TranslationManager_Exception_FtpException(
|
107 |
+
'Could not login to Translation Portal Server.'
|
108 |
+
);
|
109 |
+
}
|
110 |
+
$this->validateFtpConnectWorks();
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* @return bool
|
115 |
+
*/
|
116 |
+
private function isUploadToEurotextEnabled()
|
117 |
+
{
|
118 |
+
return !$this->configHelper->isFtpUploadDisabled();
|
119 |
+
}
|
120 |
+
|
121 |
+
private function clearProjectFolder()
|
122 |
+
{
|
123 |
+
$xmlPath = Mage::helper('eurotext_translationmanager/filesystem')->getExportXMLPath($this->project);
|
124 |
+
Mage::helper('eurotext_translationmanager/filesystem')->deleteDirectoryRecursively($xmlPath);
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* @param string $zipFile
|
129 |
+
*/
|
130 |
+
private function createFallbackFile($zipFile)
|
131 |
+
{
|
132 |
+
if (!copy($zipFile, $this->fallbackFilename)) {
|
133 |
+
$message = sprintf('Could not copy the project data file to %s', $this->fallbackFilename);
|
134 |
+
$this->helper->log($message, Zend_Log::ERR);
|
135 |
+
throw new Exception($message);
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
private function updateProjectStatus()
|
140 |
+
{
|
141 |
+
$this->project->setProjectStatus(Eurotext_TranslationManager_Model_Project::STATUS_EXPORTED_TO_EUROTEXT);
|
142 |
+
$this->project->save();
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* @param string $functionName
|
147 |
+
* @return bool
|
148 |
+
*/
|
149 |
+
private function isFunctionEnabled($functionName)
|
150 |
+
{
|
151 |
+
$disabled = explode(',', ini_get('disable_functions'));
|
152 |
+
|
153 |
+
return !in_array($functionName, $disabled);
|
154 |
+
}
|
155 |
+
|
156 |
+
private function validateUsername()
|
157 |
+
{
|
158 |
+
if (trim($this->ftpUsername) == "") {
|
159 |
+
$this->helper->log('Login data is not set.', Zend_Log::ERR);
|
160 |
+
throw new Eurotext_TranslationManager_Exception_FtpException(
|
161 |
+
$this->helper->__(
|
162 |
+
"There seems to be a problem with your login data. Please check username and password!"
|
163 |
+
)
|
164 |
+
);
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
private function validateFtpConnectExists()
|
169 |
+
{
|
170 |
+
if (!function_exists("ftp_connect")) {
|
171 |
+
$this->helper->log('There is no FTP Client available: ftp_connect does not exist.', Zend_Log::CRIT);
|
172 |
+
throw new Eurotext_TranslationManager_Exception_FtpException(
|
173 |
+
$this->helper->__(
|
174 |
+
"There is no FTP Client available: ftp_connect does not exist."
|
175 |
+
)
|
176 |
+
);
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
private function validateFtpConnectIsEnabled()
|
181 |
+
{
|
182 |
+
if (!$this->isFunctionEnabled('ftp_connect')) {
|
183 |
+
$this->helper->log('There is no FTP Client available: ftp_connect is disabled in PHP.', Zend_Log::CRIT);
|
184 |
+
throw new Eurotext_TranslationManager_Exception_FtpException(
|
185 |
+
$this->helper->__(
|
186 |
+
"There is no FTP Client available: ftp_connect is disabled in PHP."
|
187 |
+
)
|
188 |
+
);
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
private function validateFtpConnectWorks()
|
193 |
+
{
|
194 |
+
if ($this->ftpConnection === false) {
|
195 |
+
$this->helper->log('Could not connect to Translation Portal Server.', Zend_Log::ERR);
|
196 |
+
throw new Eurotext_TranslationManager_Exception_FtpException(
|
197 |
+
$this->helper->__(
|
198 |
+
"Could not connect to server. Could be a temporary error or firewall problem. You could also check for a new module version. It might be a problem with your login data, too. Please check username and password!"
|
199 |
+
)
|
200 |
+
);
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
private function cleanupFtp()
|
205 |
+
{
|
206 |
+
@ftp_delete($this->ftpConnection, $this->project->getData('zip_filename'));
|
207 |
+
@ftp_delete($this->ftpConnection, $this->project->getData('zip_filename') . ".uploading");
|
208 |
+
}
|
209 |
+
|
210 |
+
private function setupFtpSettings()
|
211 |
+
{
|
212 |
+
ftp_pasv($this->ftpConnection, true);
|
213 |
+
ftp_chdir($this->ftpConnection, "/");
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* @param string $zipFile
|
218 |
+
*/
|
219 |
+
private function uploadZipWithUploadingExtension($zipFile)
|
220 |
+
{
|
221 |
+
if (ftp_put($this->ftpConnection, $this->project->getZipFilename() . ".uploading", $zipFile, FTP_BINARY)) {
|
222 |
+
$this->helper->log(
|
223 |
+
'File was successfully uploaded to ' . $this->project->getZipFilename() . '.uploading',
|
224 |
+
Zend_Log::INFO
|
225 |
+
);
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* @return bool
|
231 |
+
*/
|
232 |
+
private function removeUploadingExtension()
|
233 |
+
{
|
234 |
+
$filename = $this->project->getZipFilename();
|
235 |
+
$uploadSuccess = ftp_rename($this->ftpConnection, $filename . ".uploading", $filename);
|
236 |
+
if ($uploadSuccess) {
|
237 |
+
$this->helper->log('File was successfully renamed to ' . $filename, Zend_Log::INFO);
|
238 |
+
}
|
239 |
+
|
240 |
+
return $uploadSuccess;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* @param string $zipFile
|
245 |
+
* @return bool
|
246 |
+
*/
|
247 |
+
private function uploadZipFileToEurotext($zipFile)
|
248 |
+
{
|
249 |
+
$this->validateFtpConnection();
|
250 |
+
|
251 |
+
$this->openFtpConnection();
|
252 |
+
|
253 |
+
$this->setupFtpSettings();
|
254 |
+
$this->cleanupFtp();
|
255 |
+
$this->uploadZipWithUploadingExtension($zipFile);
|
256 |
+
$uploadSuccess = $this->removeUploadingExtension();
|
257 |
+
|
258 |
+
ftp_close($this->ftpConnection);
|
259 |
+
|
260 |
+
return $uploadSuccess;
|
261 |
+
}
|
262 |
+
}
|
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Eurotext_TranslationManager_Model_Export_Project as ExportProject;
|
4 |
+
|
5 |
+
class Eurotext_TranslationManager_Model_Export_Project_LocaleCsvFiles
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* @var Varien_File_Csv
|
9 |
+
*/
|
10 |
+
private $csvReader;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @var DOMDocument
|
14 |
+
*/
|
15 |
+
private $doc;
|
16 |
+
|
17 |
+
public function __construct()
|
18 |
+
{
|
19 |
+
$this->csvReader = new Varien_File_Csv();
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
24 |
+
* @param int $offset
|
25 |
+
* @return array
|
26 |
+
*/
|
27 |
+
public function process(Eurotext_TranslationManager_Model_Project $project, $offset)
|
28 |
+
{
|
29 |
+
/** @var Mage_Core_Model_Abstract $csv */
|
30 |
+
$csvCollection = Mage::getResourceModel('eurotext_translationmanager/csv_collection')
|
31 |
+
->filterByProject($project);
|
32 |
+
|
33 |
+
$csv = $csvCollection->getItemById($offset);
|
34 |
+
$count = $csvCollection->count();
|
35 |
+
if (!$csv) {
|
36 |
+
return [
|
37 |
+
"status_msg" => $this->getHelper()->__("Exported language files."),
|
38 |
+
'step' => ExportProject::STEP_COLLECT_PRODUCTS,
|
39 |
+
'offset' => 1,
|
40 |
+
];
|
41 |
+
}
|
42 |
+
|
43 |
+
$xmlDir = $this->createSubdirectory($project);
|
44 |
+
|
45 |
+
$filenameSrc = $csv->getData('filename');
|
46 |
+
$filenameEn = preg_replace('#/[a-z]{2}_[A-Z]{2}/#', '/en_US/', $filenameSrc);
|
47 |
+
$filenameDst = preg_replace('#/[a-z]{2}_[A-Z]{2}/#', "/{$project->getStoreviewDstLocale()}/", $filenameSrc);
|
48 |
+
|
49 |
+
$statusMessage = $this->getHelper()->__("Batch %s / %s CSV File: %s", $offset + 1, $count, $filenameSrc);
|
50 |
+
|
51 |
+
$srcCsvFilename = basename($filenameEn);
|
52 |
+
$xmlFilename = $this->createFilenameFromCsvFilename($srcCsvFilename, $xmlDir);
|
53 |
+
|
54 |
+
$xmlFile = $this->createXml($this->removeBasePathFrom($filenameSrc), $this->removeBasePathFrom($filenameDst));
|
55 |
+
|
56 |
+
$itemCount = 0;
|
57 |
+
$csvDataSrc = $this->readCsvIntoArray($filenameSrc);
|
58 |
+
$csvDataDst = $this->readCsvIntoArray($filenameDst);
|
59 |
+
$csvDataEn = $this->readCsvIntoArray($filenameEn);
|
60 |
+
|
61 |
+
foreach ($csvDataSrc as $txtSrc) {
|
62 |
+
$itemCount++;
|
63 |
+
|
64 |
+
$txtEn = isset($csvDataEn[$txtSrc]) ? $csvDataEn[$txtSrc] : '';
|
65 |
+
$txtDst = isset($csvDataDst[$txtSrc]) ? $csvDataDst[$txtSrc] : '';
|
66 |
+
|
67 |
+
$this->createLine($project, $itemCount, $xmlFile, $txtEn, $txtDst, $txtSrc);
|
68 |
+
}
|
69 |
+
|
70 |
+
if ($itemCount) {
|
71 |
+
$this->doc->save($xmlFilename);
|
72 |
+
}
|
73 |
+
|
74 |
+
return [
|
75 |
+
'step' => ExportProject::STEP_BUILD_LANGXML,
|
76 |
+
'offset' => $offset + 1,
|
77 |
+
'status_msg' => $statusMessage,
|
78 |
+
];
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @return Eurotext_TranslationManager_Helper_Data
|
83 |
+
*/
|
84 |
+
private function getHelper()
|
85 |
+
{
|
86 |
+
return Mage::helper('eurotext_translationmanager');
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param string $srcCsvFilename
|
91 |
+
* @param string $xmlDir
|
92 |
+
* @return string
|
93 |
+
*/
|
94 |
+
private function createFilenameFromCsvFilename($srcCsvFilename, $xmlDir)
|
95 |
+
{
|
96 |
+
|
97 |
+
$xmlFilename = Mage::helper('eurotext_translationmanager/filesystem')
|
98 |
+
->getFilenameSafeString($srcCsvFilename);
|
99 |
+
$xmlFilename = pathinfo($xmlFilename, PATHINFO_FILENAME);
|
100 |
+
|
101 |
+
return "$xmlDir/$xmlFilename.xml";
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* @param string $filenameSrc
|
106 |
+
* @param string $filenameDst
|
107 |
+
* @return DOMNode
|
108 |
+
*/
|
109 |
+
private function createXml($filenameSrc, $filenameDst)
|
110 |
+
{
|
111 |
+
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
112 |
+
$this->doc->formatOutput = true;
|
113 |
+
$translation = $this->doc->createElement("translation");
|
114 |
+
|
115 |
+
$this->writeAttribute($translation, 'src_filename', $filenameSrc);
|
116 |
+
$this->writeAttribute($translation, 'dst_filename', $filenameDst);
|
117 |
+
|
118 |
+
$this->doc->appendChild($translation);
|
119 |
+
|
120 |
+
return $translation;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* @param int $itemCount
|
125 |
+
* @param string $txtEn
|
126 |
+
* @param DOMNOde $lineExport
|
127 |
+
*/
|
128 |
+
private function createLineContextNode($itemCount, $txtEn, $locale, DOMNode $lineExport)
|
129 |
+
{
|
130 |
+
$lineContext = $this->doc->createElement("line-context");
|
131 |
+
$this->writeAttribute($lineContext, 'num', $itemCount);
|
132 |
+
$this->writeAttribute($lineContext, 'context', 'yes');
|
133 |
+
$this->writeAttribute($lineContext, 'locale', $locale);
|
134 |
+
|
135 |
+
Mage::helper('eurotext_translationmanager/xml')->appendTextChild($this->doc, $lineContext, $txtEn);
|
136 |
+
$lineExport->appendChild($lineContext);
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* @param DOMNode $node
|
141 |
+
* @param string $name
|
142 |
+
* @param string $value
|
143 |
+
*/
|
144 |
+
private function writeAttribute(DOMNode $node, $name, $value)
|
145 |
+
{
|
146 |
+
$lineIndex = $this->doc->createAttribute($name);
|
147 |
+
$lineIndex->value = $value;
|
148 |
+
$node->appendChild($lineIndex);
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
153 |
+
* @param int $itemCount
|
154 |
+
* @param string $txtSrc
|
155 |
+
* @param DOMNode $lineExport
|
156 |
+
*/
|
157 |
+
private function createLineNode(
|
158 |
+
Eurotext_TranslationManager_Model_Project $project,
|
159 |
+
$itemCount,
|
160 |
+
$txtSrc,
|
161 |
+
$lineExport
|
162 |
+
) {
|
163 |
+
$lineContext = $this->doc->createElement("line");
|
164 |
+
$this->writeAttribute($lineContext, 'num', $itemCount);
|
165 |
+
$this->writeAttribute($lineContext, 'locale-src', $project->getStoreviewSrcLocale());
|
166 |
+
$this->writeAttribute($lineContext, 'locale-dst', $project->getStoreviewDstLocale());
|
167 |
+
Mage::helper('eurotext_translationmanager/xml')->appendTextChild($this->doc, $lineContext, $txtSrc);
|
168 |
+
$lineExport->appendChild($lineContext);
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
173 |
+
* @param int $itemCount
|
174 |
+
* @param DOMNode $translation
|
175 |
+
* @param string $txtEn
|
176 |
+
* @param string $txtDst
|
177 |
+
* @param string $txtSrc
|
178 |
+
*/
|
179 |
+
private function createLine(
|
180 |
+
Eurotext_TranslationManager_Model_Project $project,
|
181 |
+
$itemCount,
|
182 |
+
$translation,
|
183 |
+
$txtEn,
|
184 |
+
$txtDst,
|
185 |
+
$txtSrc
|
186 |
+
) {
|
187 |
+
$comment = $this->doc->createComment("Line " . $itemCount);
|
188 |
+
$translation->appendChild($comment);
|
189 |
+
|
190 |
+
$lineExport = $this->doc->createElement("line" . $itemCount);
|
191 |
+
$translation->appendChild($lineExport);
|
192 |
+
|
193 |
+
$this->createLineContextNode($itemCount, $txtEn, 'en_US', $lineExport);
|
194 |
+
$this->createLineContextNode($itemCount, $txtDst, $project->getStoreviewDstLocale(), $lineExport);
|
195 |
+
$this->createLineNode($project, $itemCount, $txtSrc, $lineExport);
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* @param string $filenameSrc
|
200 |
+
* @return array
|
201 |
+
*/
|
202 |
+
private function readCsvIntoArray($filenameSrc)
|
203 |
+
{
|
204 |
+
try {
|
205 |
+
return $this->csvReader->getDataPairs($filenameSrc);
|
206 |
+
} catch (Exception $e) {
|
207 |
+
return [];
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* @param string $path
|
213 |
+
* @return string
|
214 |
+
*/
|
215 |
+
private function removeBasePathFrom($path)
|
216 |
+
{
|
217 |
+
return str_replace(Mage::getBaseDir('app'), '', $path);
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
222 |
+
* @return string
|
223 |
+
*/
|
224 |
+
private function createSubdirectory(Eurotext_TranslationManager_Model_Project $project)
|
225 |
+
{
|
226 |
+
$subdir = "framework";
|
227 |
+
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')
|
228 |
+
->getXmlSubdirectoryAndMakeSureItExists($project, $subdir);
|
229 |
+
|
230 |
+
return $xmlDir;
|
231 |
+
}
|
232 |
+
}
|
@@ -0,0 +1,452 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Eurotext_TranslationManager_Model_Export_Project as ProjectExporter;
|
4 |
+
|
5 |
+
class Eurotext_TranslationManager_Model_Export_Project_Product
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* @var string[]
|
9 |
+
*/
|
10 |
+
private $seoAttributes = [
|
11 |
+
'meta_title' => 'SeoTitle',
|
12 |
+
'meta_description' => 'SeoDescription',
|
13 |
+
'meta_keyword' => 'SeoKeywords',
|
14 |
+
];
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var string[]
|
18 |
+
*/
|
19 |
+
private $attributesToExportAlways = [
|
20 |
+
'name' => 'Title',
|
21 |
+
'description' => 'Longdesc',
|
22 |
+
'short_description' => 'Shortdesc',
|
23 |
+
];
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @var DOMDocument
|
27 |
+
*/
|
28 |
+
private $doc;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @var DOMElement
|
32 |
+
*/
|
33 |
+
private $articlesNode;
|
34 |
+
/**
|
35 |
+
* @var DOMElement
|
36 |
+
*/
|
37 |
+
private $nodeArticle;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @var Eurotext_TranslationManager_Helper_Data
|
41 |
+
*/
|
42 |
+
private $helper;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @var Eurotext_TranslationManager_Helper_Config
|
46 |
+
*/
|
47 |
+
private $configHelper;
|
48 |
+
|
49 |
+
public function __construct()
|
50 |
+
{
|
51 |
+
$this->helper = Mage::helper('eurotext_translationmanager');
|
52 |
+
$this->configHelper = Mage::helper('eurotext_translationmanager/config');
|
53 |
+
|
54 |
+
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
55 |
+
$this->doc->formatOutput = true;
|
56 |
+
|
57 |
+
$this->articlesNode = $this->doc->createElement('articles');
|
58 |
+
$this->doc->appendChild($this->articlesNode);
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
63 |
+
* @param int $page
|
64 |
+
* @return string[]
|
65 |
+
*/
|
66 |
+
public function process(Eurotext_TranslationManager_Model_Project $project, $page)
|
67 |
+
{
|
68 |
+
/** @var Mage_Core_Model_App_Emulation $emulator */
|
69 |
+
$emulator = Mage::getModel('core/app_emulation');
|
70 |
+
$emulation = $emulator->startEnvironmentEmulation($project->getStoreviewSrc());
|
71 |
+
|
72 |
+
$project->addAllRelationalData();
|
73 |
+
|
74 |
+
$maxItems = $this->configHelper->getProductsPerFile();
|
75 |
+
|
76 |
+
$manualSelected = false;
|
77 |
+
|
78 |
+
/** @var Mage_Catalog_Model_Resource_Product_Collection $productCollectionSrc */
|
79 |
+
$productCollectionSrc = $this->getProductCollectionFor($project->getStoreviewSrc(), $page, $maxItems);
|
80 |
+
$productCollectionDst = $this->getProductCollectionFor($project->getStoreviewDst(), $page, $maxItems);
|
81 |
+
|
82 |
+
if (!$project->isExportingAllProducts()) {
|
83 |
+
$manualSelected = true;
|
84 |
+
|
85 |
+
$productCollectionSrc->addIdFilter($project->getProducts());
|
86 |
+
$productCollectionDst->addIdFilter($project->getProducts());
|
87 |
+
}
|
88 |
+
|
89 |
+
if ((!count($project->getProducts()) && !$project->isExportingAllProducts()) ||
|
90 |
+
$page > $productCollectionSrc->getLastPageNumber()
|
91 |
+
) {
|
92 |
+
$emulator->stopEnvironmentEmulation($emulation);
|
93 |
+
|
94 |
+
return [
|
95 |
+
'status_msg' => $this->helper->__('Exported products.'),
|
96 |
+
'step' => ProjectExporter::STEP_COLLECT_CATEGORIES,
|
97 |
+
'offset' => 1,
|
98 |
+
];
|
99 |
+
}
|
100 |
+
|
101 |
+
$productCollectionSrc->addOptionsToResult();
|
102 |
+
$productCollectionDst->addOptionsToResult();
|
103 |
+
|
104 |
+
$galleryBackendModel = $productCollectionSrc->getResource()->getAttribute('media_gallery')->getBackend();
|
105 |
+
/** @var Eurotext_TranslationManager_Model_Catalog_Product_Attribute_Backend_Media_OnlyStoreValues $galleryBackendModelForOnlyStoreValues */
|
106 |
+
$galleryBackendModelForOnlyStoreValues = Mage::getModel(
|
107 |
+
'eurotext_translationmanager/catalog_product_attribute_backend_media_onlyStoreValues'
|
108 |
+
);
|
109 |
+
|
110 |
+
$statusMessage = Mage::helper('eurotext_translationmanager')->__("Batch %s / %s Products:",
|
111 |
+
$page,
|
112 |
+
$productCollectionSrc->getLastPageNumber());
|
113 |
+
|
114 |
+
foreach ($productCollectionSrc as $productSrc) {
|
115 |
+
$this->nodeArticle = $this->doc->createElement("article");
|
116 |
+
$statusMessage .= "\n<br />- " . $productSrc->getSku();
|
117 |
+
/** @var Mage_Catalog_Model_Product $productDst */
|
118 |
+
$productDst = $productCollectionDst->getItemById($productSrc->getId());
|
119 |
+
|
120 |
+
$galleryBackendModel->afterLoad($productSrc);
|
121 |
+
$galleryBackendModelForOnlyStoreValues
|
122 |
+
->setAttribute($productCollectionSrc->getResource()->getAttribute('media_gallery'))
|
123 |
+
->afterLoad($productDst);
|
124 |
+
|
125 |
+
$this->exportDefaultAttributes($productSrc, $productDst, $manualSelected);
|
126 |
+
$this->exportCustomProductAttributes($productSrc, $productDst, $manualSelected);
|
127 |
+
$this->exportImageLabels($productSrc, $productDst, $manualSelected);
|
128 |
+
$this->exportOptions($productSrc);
|
129 |
+
$this->exportUrlKeys($project, $productSrc, $productDst, $manualSelected);
|
130 |
+
$this->exportMetaAttributes($project, $productSrc, $productDst, $manualSelected);
|
131 |
+
|
132 |
+
if ($this->nodeArticle->hasChildNodes()) {
|
133 |
+
$firstChildNode = $this->nodeArticle->childNodes->item(0);
|
134 |
+
|
135 |
+
$nodeArticleId = $this->doc->createElement("Id");
|
136 |
+
$nodeArticleId->appendChild($this->doc->createTextNode($productSrc->getId()));
|
137 |
+
$this->nodeArticle->insertBefore($nodeArticleId, $firstChildNode);
|
138 |
+
|
139 |
+
$nodeProductUrl = $this->doc->createElement('Url');
|
140 |
+
$nodeProductUrl->appendChild($this->doc->createTextNode($productSrc->getProductUrl()));
|
141 |
+
$this->nodeArticle->insertBefore($nodeProductUrl, $firstChildNode);
|
142 |
+
|
143 |
+
$this->articlesNode->appendChild($this->nodeArticle);
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
if($this->articlesNode->hasChildNodes()){
|
148 |
+
$subdir = "articles";
|
149 |
+
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')
|
150 |
+
->getXmlSubdirectoryAndMakeSureItExists($project, $subdir);
|
151 |
+
|
152 |
+
$this->doc->save($xmlDir . DS . "a" . ((int)($page)) . ".xml");
|
153 |
+
}
|
154 |
+
$emulator->stopEnvironmentEmulation($emulation);
|
155 |
+
|
156 |
+
return [
|
157 |
+
"offset" => $page + 1,
|
158 |
+
"step" => ProjectExporter::STEP_COLLECT_PRODUCTS,
|
159 |
+
"status_msg" => $statusMessage,
|
160 |
+
];
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* @param int $storeId
|
165 |
+
* @param int $offset
|
166 |
+
* @param int $pageSize
|
167 |
+
* @return Mage_Catalog_Model_Resource_Product_Collection
|
168 |
+
*/
|
169 |
+
private function getProductCollectionFor($storeId, $offset, $pageSize)
|
170 |
+
{
|
171 |
+
/** @var Mage_Catalog_Model_Resource_Product_Collection $productCollection */
|
172 |
+
$productCollection = Mage::getResourceModel('catalog/product_collection')
|
173 |
+
->setStore($storeId)
|
174 |
+
->setStoreId($storeId);
|
175 |
+
$productCollection->addUrlRewrite()
|
176 |
+
->addAttributeToSelect(
|
177 |
+
array_merge(
|
178 |
+
[
|
179 |
+
'name', 'description', 'short_description', 'request_path', 'url_key', 'url_path', 'meta_title',
|
180 |
+
'meta_keyword', 'meta_description'
|
181 |
+
],
|
182 |
+
$this->configHelper->getCustomProductAttributesForExport()
|
183 |
+
)
|
184 |
+
)
|
185 |
+
->setPage($offset, $pageSize)
|
186 |
+
->addOrder('entity_id');
|
187 |
+
|
188 |
+
return $productCollection;
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* @param Mage_Catalog_Model_Product $productSrc
|
193 |
+
* @param Mage_Catalog_Model_Product $productDst
|
194 |
+
* @param bool $manualSelected
|
195 |
+
*/
|
196 |
+
private function exportImageLabels($productSrc, $productDst, $manualSelected)
|
197 |
+
{
|
198 |
+
$imagesOrig = [];
|
199 |
+
$imagesOrigUrl = [];
|
200 |
+
$imagesDstDisabled = [];
|
201 |
+
$imagesDstPosition = [];
|
202 |
+
|
203 |
+
$imagesDstLabel = [];
|
204 |
+
|
205 |
+
foreach ($productSrc->getMediaGallery()['images'] as $image) {
|
206 |
+
$imgValueId = $image['value_id'];
|
207 |
+
$imgValue = $image['file'];
|
208 |
+
$imgLabel = $image['label'] ?: $image['label_default'];
|
209 |
+
$imagesDstDisabled[$imgValueId] = $image['disabled'];
|
210 |
+
$imagesDstPosition[$imgValueId] = $image['position'];
|
211 |
+
|
212 |
+
$imagesOrig[$imgValueId] = $imgLabel;
|
213 |
+
$imagesOrigUrl[$imgValueId] = $imgValue;
|
214 |
+
}
|
215 |
+
|
216 |
+
foreach ($productDst->getMediaGallery()['images'] as $image) {
|
217 |
+
$imgValueId = $image['value_id'];
|
218 |
+
$imagesDstDisabled[$imgValueId] = $image['disabled'];
|
219 |
+
$imagesDstPosition[$imgValueId] = $image['position'];
|
220 |
+
|
221 |
+
$imagesDstLabel[$imgValueId] = $image['label'];
|
222 |
+
}
|
223 |
+
|
224 |
+
$hasImages = false;
|
225 |
+
$imagesNode = $this->doc->createElement("Images");
|
226 |
+
|
227 |
+
foreach ($imagesOrig as $imgValueId => $imgLabel) {
|
228 |
+
if (!array_key_exists($imgValueId, $imagesDstLabel)) {
|
229 |
+
$imagesDstLabel[$imgValueId] = "";
|
230 |
+
}
|
231 |
+
|
232 |
+
$needsUpdate = $manualSelected;
|
233 |
+
if (strlen(trim($imagesDstLabel[$imgValueId])) == 0) {
|
234 |
+
$needsUpdate = true;
|
235 |
+
}
|
236 |
+
|
237 |
+
if ($needsUpdate && strlen(trim($imgLabel))) {
|
238 |
+
$hasImages = true;
|
239 |
+
$imageNode = $this->doc->createElement("Image");
|
240 |
+
$imagesNode->appendChild($imageNode);
|
241 |
+
|
242 |
+
$imageNodeId = $this->doc->createAttribute("value_id");
|
243 |
+
$imageNodeId->value = $imgValueId;
|
244 |
+
$imageNode->appendChild($imageNodeId);
|
245 |
+
|
246 |
+
$imageNodePosition = $this->doc->createAttribute("position");
|
247 |
+
$imageNodePosition->value = $imagesDstPosition[$imgValueId];
|
248 |
+
$imageNode->appendChild($imageNodePosition);
|
249 |
+
|
250 |
+
$imageNodeDisabled = $this->doc->createAttribute("disabled");
|
251 |
+
$imageNodeDisabled->value = $imagesDstDisabled[$imgValueId];
|
252 |
+
$imageNode->appendChild($imageNodeDisabled);
|
253 |
+
|
254 |
+
// URL:
|
255 |
+
$imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) .
|
256 |
+
"catalog/product" . $imagesOrigUrl[$imgValueId];
|
257 |
+
|
258 |
+
$imageNodeUrl = $this->doc->createElement("Url");
|
259 |
+
Mage::helper('eurotext_translationmanager/xml')
|
260 |
+
->appendTextChild($this->doc, $imageNodeUrl, $imgUrl);
|
261 |
+
$imageNode->appendChild($imageNodeUrl);
|
262 |
+
|
263 |
+
// Label:
|
264 |
+
$labelNode = $this->doc->createElement("Label");
|
265 |
+
Mage::helper('eurotext_translationmanager/xml')
|
266 |
+
->appendTextChild($this->doc, $labelNode, $imgLabel);
|
267 |
+
$imageNode->appendChild($labelNode);
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
+
if ($hasImages) {
|
272 |
+
$this->nodeArticle->appendChild($imagesNode);
|
273 |
+
}
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* @param Mage_Catalog_Model_Product $productSrc
|
278 |
+
* @param Mage_Catalog_Model_Product $productDst
|
279 |
+
* @param boolean $manualSelected
|
280 |
+
*/
|
281 |
+
private function exportCustomProductAttributes($productSrc, $productDst, $manualSelected)
|
282 |
+
{
|
283 |
+
if (!$this->configHelper->getCustomProductAttributesForExport()) {
|
284 |
+
return;
|
285 |
+
}
|
286 |
+
|
287 |
+
$nodeCustomProductAttributes = $this->doc->createElement('custom_attributes');
|
288 |
+
foreach ($this->configHelper->getCustomProductAttributesForExport() as $customProductAttribute) {
|
289 |
+
$srcValue = $productSrc->getDataUsingMethod($customProductAttribute);
|
290 |
+
$dstValue = $productDst->getDataUsingMethod($customProductAttribute);
|
291 |
+
if ($srcValue && ($srcValue == $dstValue || $dstValue == "" || $manualSelected)) {
|
292 |
+
Mage::helper('eurotext_translationmanager/xml')->appendTextNode(
|
293 |
+
$this->doc,
|
294 |
+
(string)$customProductAttribute,
|
295 |
+
(string)$srcValue,
|
296 |
+
$nodeCustomProductAttributes
|
297 |
+
);
|
298 |
+
}
|
299 |
+
}
|
300 |
+
|
301 |
+
if($nodeCustomProductAttributes->hasChildNodes()) {
|
302 |
+
$this->nodeArticle->appendChild($nodeCustomProductAttributes);
|
303 |
+
}
|
304 |
+
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* @param Mage_Catalog_Model_Product $productSrc
|
309 |
+
* @param Mage_Catalog_Model_Product $productDst
|
310 |
+
* @param bool $manualSelected
|
311 |
+
*/
|
312 |
+
private function exportDefaultAttributes($productSrc, $productDst, $manualSelected)
|
313 |
+
{
|
314 |
+
$xmlHelper = Mage::helper('eurotext_translationmanager/xml');
|
315 |
+
foreach ($this->attributesToExportAlways as $attribute => $xmlNode) {
|
316 |
+
$srcValue = $productSrc->getDataUsingMethod($attribute);
|
317 |
+
$dstValue = $productDst->getDataUsingMethod($attribute);
|
318 |
+
if ($srcValue && ($srcValue == $dstValue || $dstValue == "" || $manualSelected)) {
|
319 |
+
$xmlHelper->appendTextNode($this->doc, $xmlNode, $srcValue, $this->nodeArticle);
|
320 |
+
}
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* @param Mage_Catalog_Model_Product $product
|
326 |
+
*/
|
327 |
+
private function exportOptions($product)
|
328 |
+
{
|
329 |
+
$optionsNode = $this->doc->createElement("Options");
|
330 |
+
|
331 |
+
$options = $product->getOptions();
|
332 |
+
usort(
|
333 |
+
$options,
|
334 |
+
function (Varien_Object $a, Varien_Object $b) {
|
335 |
+
return $b->getId() - $a->getId();
|
336 |
+
}
|
337 |
+
);
|
338 |
+
|
339 |
+
if (!$options) {
|
340 |
+
return;
|
341 |
+
}
|
342 |
+
|
343 |
+
foreach ($options as $_option) {
|
344 |
+
/** @var Mage_Catalog_Model_Product_Option $_option */
|
345 |
+
$optionNode = $this->doc->createElement("Option");
|
346 |
+
|
347 |
+
$optionNodeIdAttribute = $this->doc->createAttribute("Id");
|
348 |
+
$optionNodeIdAttribute->value = $_option->getId();
|
349 |
+
$optionNode->appendChild($optionNodeIdAttribute);
|
350 |
+
|
351 |
+
$_optionTitle = $_option->getTitle();
|
352 |
+
if (!$_optionTitle) {
|
353 |
+
continue;
|
354 |
+
}
|
355 |
+
$optionsNode->appendChild($optionNode);
|
356 |
+
|
357 |
+
$optionsNodeTitle = $this->doc->createElement("Title");
|
358 |
+
Mage::helper('eurotext_translationmanager/xml')
|
359 |
+
->appendTextChild($this->doc, $optionsNodeTitle, $_optionTitle);
|
360 |
+
$optionNode->appendChild($optionsNodeTitle);
|
361 |
+
|
362 |
+
// Values:
|
363 |
+
$_values = $_option->getValues();
|
364 |
+
if (!$_values) {
|
365 |
+
continue;
|
366 |
+
}
|
367 |
+
$valuesNode = $this->doc->createElement("Values");
|
368 |
+
|
369 |
+
foreach ($_values as $_value) {
|
370 |
+
$_valueTitle = $_value->getTitle();
|
371 |
+
if (!$_valueTitle) {
|
372 |
+
continue;
|
373 |
+
}
|
374 |
+
$_valueId = $_value->getId();
|
375 |
+
|
376 |
+
$valueNode = $this->doc->createElement("Value");
|
377 |
+
|
378 |
+
$valueNodeIdAttribute = $this->doc->createAttribute("Id");
|
379 |
+
$valueNodeIdAttribute->value = $_valueId;
|
380 |
+
$valueNode->appendChild($valueNodeIdAttribute);
|
381 |
+
|
382 |
+
$valueNodeTitle = $this->doc->createElement("Title");
|
383 |
+
Mage::helper('eurotext_translationmanager/xml')
|
384 |
+
->appendTextChild($this->doc, $valueNodeTitle, $_valueTitle);
|
385 |
+
$valueNode->appendChild($valueNodeTitle);
|
386 |
+
|
387 |
+
$valuesNode->appendChild($valueNode);
|
388 |
+
}
|
389 |
+
if ($valuesNode->hasChildNodes()) {
|
390 |
+
$optionNode->appendChild($valuesNode);
|
391 |
+
}
|
392 |
+
}
|
393 |
+
|
394 |
+
if ($optionsNode->hasChildNodes()) {
|
395 |
+
$this->nodeArticle->appendChild($optionsNode);
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
/**
|
400 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
401 |
+
* @param Mage_Catalog_Model_Product $productSrc
|
402 |
+
* @param Mage_Catalog_Model_Product $productDst
|
403 |
+
* @param bool $manualSelected
|
404 |
+
*/
|
405 |
+
private function exportUrlKeys(
|
406 |
+
Eurotext_TranslationManager_Model_Project $project,
|
407 |
+
Mage_Catalog_Model_Product $productSrc,
|
408 |
+
Mage_Catalog_Model_Product $productDst,
|
409 |
+
$manualSelected
|
410 |
+
) {
|
411 |
+
if (!$project->isExportingUrlKeys()) {
|
412 |
+
return;
|
413 |
+
}
|
414 |
+
$valueSrc = $productSrc->getUrlKey();
|
415 |
+
$valueDst = $productDst->getUrlKey();
|
416 |
+
if ($valueSrc != "" && ($valueSrc == $valueDst || $valueDst == "" || $manualSelected)) {
|
417 |
+
$item = $this->doc->createElement("UrlKey");
|
418 |
+
Mage::helper('eurotext_translationmanager/xml')
|
419 |
+
->appendTextChild($this->doc, $item, $productSrc->getUrlKey());
|
420 |
+
$this->nodeArticle->appendChild($item);
|
421 |
+
|
422 |
+
}
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
427 |
+
* @param Mage_Catalog_Model_Product $productSrc
|
428 |
+
* @param Mage_Catalog_Model_Product $productDst
|
429 |
+
* @param bool $manualSelected
|
430 |
+
*/
|
431 |
+
private function exportMetaAttributes(
|
432 |
+
Eurotext_TranslationManager_Model_Project $project,
|
433 |
+
Mage_Catalog_Model_Product $productSrc,
|
434 |
+
Mage_Catalog_Model_Product $productDst,
|
435 |
+
$manualSelected
|
436 |
+
) {
|
437 |
+
if (!$project->isExportingMetaAttributes()) {
|
438 |
+
return;
|
439 |
+
}
|
440 |
+
|
441 |
+
foreach ($this->seoAttributes as $attribute => $xmlNode) {
|
442 |
+
$srcValue = $productSrc->getDataUsingMethod($attribute);
|
443 |
+
$dstValue = $productDst->getDataUsingMethod($attribute);
|
444 |
+
if ($srcValue && ($srcValue == $dstValue || $dstValue == "" || $manualSelected)) {
|
445 |
+
$item = $this->doc->createElement($xmlNode);
|
446 |
+
Mage::helper('eurotext_translationmanager/xml')
|
447 |
+
->appendTextChild($this->doc, $item, $srcValue);
|
448 |
+
$this->nodeArticle->appendChild($item);
|
449 |
+
}
|
450 |
+
}
|
451 |
+
}
|
452 |
+
}
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Extractor
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var ZipArchive
|
7 |
+
*/
|
8 |
+
private $zip;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param string $file
|
12 |
+
* @param string $intoDirectory
|
13 |
+
*/
|
14 |
+
public function extract($file, $intoDirectory)
|
15 |
+
{
|
16 |
+
$this->zip = new ZipArchive();
|
17 |
+
if ($errorCode = $this->zip->open($file) !== true) {
|
18 |
+
throw new Exception($this->handleErrorCode($errorCode));
|
19 |
+
}
|
20 |
+
|
21 |
+
if (!$this->zip->extractTo($intoDirectory)) {
|
22 |
+
throw new Exception(sprintf('Zipfile %s can\'t be extracted.', $file));
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @param int $errorCode
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
private function handleErrorCode($errorCode)
|
31 |
+
{
|
32 |
+
switch ($errorCode) {
|
33 |
+
case ZipArchive::ER_EXISTS:
|
34 |
+
return 'File already exists.';
|
35 |
+
case ZipArchive::ER_INCONS:
|
36 |
+
return 'Zip archive inconsistent.';
|
37 |
+
case ZipArchive::ER_INVAL:
|
38 |
+
return 'Invalid argument.';
|
39 |
+
case ZipArchive::ER_MEMORY:
|
40 |
+
return 'Malloc failure.';
|
41 |
+
case ZipArchive::ER_NOENT:
|
42 |
+
return 'No such file.';
|
43 |
+
case ZipArchive::ER_NOZIP:
|
44 |
+
return 'Not a zip archive.';
|
45 |
+
case ZipArchive::ER_OPEN :
|
46 |
+
return 'Can\'t open file . ';
|
47 |
+
case ZipArchive::ER_READ :
|
48 |
+
return 'Read error . ';
|
49 |
+
case ZipArchive::ER_SEEK :
|
50 |
+
return 'Seek error . ';
|
51 |
+
}
|
52 |
+
|
53 |
+
return 'Unknown error.';
|
54 |
+
}
|
55 |
+
|
56 |
+
function __destruct()
|
57 |
+
{
|
58 |
+
$this->zip->close();
|
59 |
+
}
|
60 |
+
}
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Factory
|
4 |
+
{
|
5 |
+
private $mediaGalleryUpdater;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* @return Eurotext_TranslationManager_Model_Updater_MediaGalleryValue
|
9 |
+
*/
|
10 |
+
public function getMediaGalleryValueUpdate()
|
11 |
+
{
|
12 |
+
if (null === $this->mediaGalleryUpdater) {
|
13 |
+
$this->mediaGalleryUpdater = Mage::getModel('eurotext_translationmanager/updater_mediaGalleryValue');
|
14 |
+
}
|
15 |
+
|
16 |
+
return $this->mediaGalleryUpdater;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getProductLoader()
|
20 |
+
{
|
21 |
+
return Mage::getModel('eurotext_translationmanager/productLoader');
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @return Eurotext_TranslationManager_Model_Import_Project_Product
|
26 |
+
*/
|
27 |
+
public function getImportProduct()
|
28 |
+
{
|
29 |
+
return new Eurotext_TranslationManager_Model_Import_Project_Product(
|
30 |
+
Mage::helper('eurotext_translationmanager'),
|
31 |
+
Mage::helper('eurotext_translationmanager/config'),
|
32 |
+
$this
|
33 |
+
);
|
34 |
+
}
|
35 |
+
}
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Import_Project
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Varien_Db_Adapter_Interface
|
7 |
+
*/
|
8 |
+
private $writeConnection;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var mixed[]
|
12 |
+
*/
|
13 |
+
private $skippedEntities = [];
|
14 |
+
|
15 |
+
public function __construct()
|
16 |
+
{
|
17 |
+
$this->writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function import(
|
21 |
+
Eurotext_TranslationManager_Model_Project $project
|
22 |
+
) {
|
23 |
+
$tmpdir = $this->getTempDir();
|
24 |
+
|
25 |
+
/** @var Eurotext_TranslationManager_Model_Resource_Project_Import_Collection $importFiles */
|
26 |
+
$importFiles = Mage::getResourceModel('eurotext_translationmanager/project_import_collection');
|
27 |
+
$importFiles->addFieldToFilter('project_id', $project->getId())->setPageSize(1);
|
28 |
+
|
29 |
+
/** @var Eurotext_TranslationManager_Model_Project_Import $importFile */
|
30 |
+
$fileCollection = Mage::getResourceModel('eurotext_translationmanager/project_import_collection')
|
31 |
+
->addFieldToFilter('project_id', $project->getId())
|
32 |
+
->addFieldToFilter('is_imported', 0)
|
33 |
+
->setPageSize(1);
|
34 |
+
|
35 |
+
$importFile = $fileCollection->getFirstItem();
|
36 |
+
|
37 |
+
if ($importFile->isObjectNew()) {
|
38 |
+
$project->setProjectStatus(Eurotext_TranslationManager_Model_Project::STATUS_DONE)->save();
|
39 |
+
|
40 |
+
return;
|
41 |
+
}
|
42 |
+
|
43 |
+
$filename = $importFile->getFilename();
|
44 |
+
$fullFilename = $tmpdir . DIRECTORY_SEPARATOR . $filename;
|
45 |
+
|
46 |
+
if (stripos($filename, "cms-sites" . DS . "cms-") === 0) {
|
47 |
+
$this->importstepActionImportCMS($fullFilename, $project);
|
48 |
+
} elseif (stripos($filename, "cms-sites" . DS . "cmsblock-") === 0) {
|
49 |
+
$this->importstepActionImportBlocks($fullFilename, $project);
|
50 |
+
} elseif (stripos($filename, "articles" . DS) === 0) {
|
51 |
+
$this->importstepActionImportArticle($fullFilename, $project);
|
52 |
+
} elseif (stripos($filename, "categories" . DS) === 0) {
|
53 |
+
$this->importstepActionImportCategory($fullFilename, $project);
|
54 |
+
} elseif (stripos($filename, "framework" . DS) === 0) {
|
55 |
+
$this->importstepActionImportTranslation($fullFilename);
|
56 |
+
} elseif (stripos($filename, "attributes" . DS) === 0) {
|
57 |
+
$this->importstepActionImportAttributes($fullFilename, $project);
|
58 |
+
} elseif (stripos($filename, "emailtemplates" . DS) === 0) {
|
59 |
+
$this->importstepActionImportTemplates($fullFilename, $project);
|
60 |
+
}
|
61 |
+
|
62 |
+
$importFile->setIsImported(1);
|
63 |
+
$importFile->save();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
private function getTempDir()
|
70 |
+
{
|
71 |
+
$dir = Mage::getBaseDir('tmp');
|
72 |
+
$dir .= DS . "eurotext";
|
73 |
+
if (!is_dir($dir)) {
|
74 |
+
if (!mkdir($dir)) {
|
75 |
+
Mage::helper('eurotext_translationmanager')->log(
|
76 |
+
'Temporary directory could not be created in ' . Mage::getBaseDir('var'),
|
77 |
+
Zend_Log::CRIT
|
78 |
+
);
|
79 |
+
throw new Magento_Exception('Eurotext temporary directory could not be created.');
|
80 |
+
}
|
81 |
+
}
|
82 |
+
$htaccessFilename = $dir . DS . ".htaccess";
|
83 |
+
if (!is_file($htaccessFilename)) {
|
84 |
+
file_put_contents($htaccessFilename, "# Eurotext Temp folder\r\nOrder Deny,Allow\r\nDeny From All");
|
85 |
+
}
|
86 |
+
|
87 |
+
return $dir;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @param string $fullFilename
|
92 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
93 |
+
*/
|
94 |
+
private function importstepActionImportCMS($fullFilename, Eurotext_TranslationManager_Model_Project $project)
|
95 |
+
{
|
96 |
+
$importer = Mage::getModel('eurotext_translationmanager/import_project_cmsPages');
|
97 |
+
$importer->import($fullFilename, $project);
|
98 |
+
$this->addSkippedEntities('cms pages', $importer->getSkippedEntities());
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* @param string $filename
|
103 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
104 |
+
*/
|
105 |
+
private function importstepActionImportBlocks($filename, Eurotext_TranslationManager_Model_Project $project)
|
106 |
+
{
|
107 |
+
$importer = Mage::getModel('eurotext_translationmanager/import_project_cmsBlocks');
|
108 |
+
$importer->import($filename, $project);
|
109 |
+
$this->addSkippedEntities('cms blocks', $importer->getSkippedEntities());
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @param string $fullFilename
|
114 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
115 |
+
*/
|
116 |
+
private function importstepActionImportArticle($fullFilename, Eurotext_TranslationManager_Model_Project $project)
|
117 |
+
{
|
118 |
+
|
119 |
+
$factory = Mage::getModel('eurotext_translationmanager/factory');
|
120 |
+
$importer = $factory->getImportProduct();
|
121 |
+
$importer->import($fullFilename, $project);
|
122 |
+
$this->addSkippedEntities('products', $importer->getSkippedEntities());
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* @param string $filename
|
127 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
128 |
+
*/
|
129 |
+
private function importstepActionImportCategory($filename, Eurotext_TranslationManager_Model_Project $project)
|
130 |
+
{
|
131 |
+
$importer = Mage::getModel('eurotext_translationmanager/import_project_categories');
|
132 |
+
$importer->import($filename, $project);
|
133 |
+
$this->addSkippedEntities('categories', $importer->getSkippedEntities());
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* @param string $fullFilename
|
138 |
+
*/
|
139 |
+
private function importstepActionImportTranslation($fullFilename)
|
140 |
+
{
|
141 |
+
Mage::getModel('eurotext_translationmanager/import_project_localeCsvFiles')->import($fullFilename);
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @param string $fullFilename
|
146 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
147 |
+
*/
|
148 |
+
private function importstepActionImportAttributes(
|
149 |
+
$fullFilename,
|
150 |
+
Eurotext_TranslationManager_Model_Project $project
|
151 |
+
) {
|
152 |
+
$importer = Mage::getModel('eurotext_translationmanager/import_project_attributes');
|
153 |
+
$importer->import($fullFilename, $project);
|
154 |
+
$this->addSkippedEntities('attributes', $importer->getSkippedEntities());
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* @param string $fullFilename
|
159 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
160 |
+
*/
|
161 |
+
private function importstepActionImportTemplates($fullFilename, Eurotext_TranslationManager_Model_Project $project)
|
162 |
+
{
|
163 |
+
$importer = Mage::getModel('eurotext_translationmanager/import_project_emailTemplates');
|
164 |
+
$importer->import($fullFilename, $project);
|
165 |
+
$this->addSkippedEntities('email templates', $importer->getSkippedEntities());
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* @return mixed[]
|
170 |
+
*/
|
171 |
+
public function getSkippedEntities()
|
172 |
+
{
|
173 |
+
return $this->skippedEntities;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @param string $type
|
178 |
+
* @param int[]|string[] $entities
|
179 |
+
*/
|
180 |
+
private function addSkippedEntities($type, $entities)
|
181 |
+
{
|
182 |
+
if (isset($this->skippedEntities[$type])) {
|
183 |
+
$this->skippedEntities[$type] = array_merge($this->skippedEntities[$type], $entities);
|
184 |
+
} else {
|
185 |
+
$this->skippedEntities[$type] = $entities;
|
186 |
+
}
|
187 |
+
}
|
188 |
+
}
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Import_Project_Attributes
|
4 |
+
implements Eurotext_TranslationManager_Model_Import_Project_Importer
|
5 |
+
{
|
6 |
+
use Eurotext_TranslationManager_Model_Import_Project_CollectSkipped;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @param string $filename
|
10 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
11 |
+
*/
|
12 |
+
public function import($filename, Eurotext_TranslationManager_Model_Project $project)
|
13 |
+
{
|
14 |
+
$doc = new DOMDocument();
|
15 |
+
$doc->load($filename);
|
16 |
+
|
17 |
+
foreach ($doc->getElementsByTagName("attribute") as $attribute) {
|
18 |
+
$this->importAttribute($project, $attribute);
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
24 |
+
* @param DOMElement $attribute
|
25 |
+
*/
|
26 |
+
private function importAttribute(Eurotext_TranslationManager_Model_Project $project, DOMElement $attribute)
|
27 |
+
{
|
28 |
+
/** @var Eurotext_TranslationManager_Model_Eav_Attribute_Label $eavLabel */
|
29 |
+
$eavLabel = Mage::getResourceModel('eurotext_translationmanager/eav_attribute_label_collection')
|
30 |
+
->addFieldToFilter('attribute_id', $attribute->getAttribute("id"))
|
31 |
+
->addFieldToFilter('store_id', $project->getStoreviewDst())
|
32 |
+
->getFirstItem();
|
33 |
+
|
34 |
+
$eavLabel->addData(
|
35 |
+
[
|
36 |
+
'attribute_id' => intval($attribute->getAttribute("id")),
|
37 |
+
'store_id' => $project->getStoreviewDst(),
|
38 |
+
'value' => $attribute->getElementsByTagName("AttributeName")[0]->textContent,
|
39 |
+
]
|
40 |
+
);
|
41 |
+
$eavLabel->save();
|
42 |
+
|
43 |
+
$this->importOptions($project, $attribute);
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
48 |
+
* @param DOMElement $attribute
|
49 |
+
*/
|
50 |
+
private function importOptions(Eurotext_TranslationManager_Model_Project $project, DOMElement $attribute)
|
51 |
+
{
|
52 |
+
foreach ($attribute->getElementsByTagName("option") as $option) {
|
53 |
+
$this->importOption($project, $option);
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
59 |
+
* @param DOMElement $option
|
60 |
+
*/
|
61 |
+
private function importOption(Eurotext_TranslationManager_Model_Project $project, DOMElement $option)
|
62 |
+
{
|
63 |
+
$value = Mage::getResourceModel('eurotext_translationmanager/eav_attribute_option_value_collection')
|
64 |
+
->addFieldToFilter('option_id', $option->getAttribute("id"))
|
65 |
+
->addFieldToFilter('store_id', $project->getStoreviewDst())
|
66 |
+
->getFirstItem();
|
67 |
+
|
68 |
+
$value->addData(
|
69 |
+
[
|
70 |
+
'option_id' => intval($option->getAttribute("id")),
|
71 |
+
'store_id' => $project->getStoreviewDst(),
|
72 |
+
'value' => $option->getElementsByTagName("OptionName")[0]->textContent,
|
73 |
+
]
|
74 |
+
);
|
75 |
+
|
76 |
+
$value->save();
|
77 |
+
}
|
78 |
+
}
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Import_Project_Categories
|
4 |
+
implements Eurotext_TranslationManager_Model_Import_Project_Importer
|
5 |
+
{
|
6 |
+
use Eurotext_TranslationManager_Model_Import_Project_CollectSkipped;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @var string[]
|
10 |
+
*/
|
11 |
+
private $categoryMapping = [
|
12 |
+
'Title' => 'name',
|
13 |
+
'Longdesc' => 'description',
|
14 |
+
'SeoTitle' => 'meta_title',
|
15 |
+
'SeoDescription' => 'meta_description',
|
16 |
+
'SeoKeywords' => 'meta_keywords',
|
17 |
+
'UrlKey' => 'url_key',
|
18 |
+
];
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var Eurotext_TranslationManager_Helper_Config
|
22 |
+
*/
|
23 |
+
private $configHelper;
|
24 |
+
|
25 |
+
public function __construct()
|
26 |
+
{
|
27 |
+
$this->configHelper = Mage::helper('eurotext_translationmanager/config');
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @param string $filename
|
32 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
33 |
+
*/
|
34 |
+
public function import($filename, Eurotext_TranslationManager_Model_Project $project)
|
35 |
+
{
|
36 |
+
$doc = new DOMDocument();
|
37 |
+
$doc->load($filename);
|
38 |
+
$categories = $doc->getElementsByTagName("category");
|
39 |
+
foreach ($categories as $categoryNode) {
|
40 |
+
$fieldNodes = $categoryNode->childNodes;
|
41 |
+
$id = 0;
|
42 |
+
$fields = [];
|
43 |
+
|
44 |
+
foreach ($fieldNodes as $fieldNode) {
|
45 |
+
$nodeName = trim($fieldNode->nodeName);
|
46 |
+
$nodeContent = trim($fieldNode->textContent);
|
47 |
+
|
48 |
+
if ($nodeName != "") {
|
49 |
+
if ($nodeName == "Id") {
|
50 |
+
$id = intval($nodeContent);
|
51 |
+
}
|
52 |
+
if ('custom_attributes' == $nodeName) {
|
53 |
+
$fields[$nodeName] = $fieldNode;
|
54 |
+
} else {
|
55 |
+
$fields[$nodeName] = $nodeContent;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
if ($id <= 0) {
|
61 |
+
$this->addSkipped($id);
|
62 |
+
continue;
|
63 |
+
}
|
64 |
+
/** @var Mage_Catalog_Model_Category $category */
|
65 |
+
$category = Mage::getModel('catalog/category')->load($id)->setStoreId($project->getStoreviewDst());
|
66 |
+
|
67 |
+
$hasUrlKey = false;
|
68 |
+
|
69 |
+
foreach ($fields as $key => $value) {
|
70 |
+
if (isset($this->categoryMapping[$key])) {
|
71 |
+
$category->setDataUsingMethod($this->categoryMapping[$key], $value);
|
72 |
+
}
|
73 |
+
if ($key == 'UrlKey') {
|
74 |
+
$hasUrlKey = true;
|
75 |
+
}
|
76 |
+
if ('custom_attributes' == $key) {
|
77 |
+
$this->processCustomCategoryAttributesOn($category, $value);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
if (!$hasUrlKey) {
|
82 |
+
// Check if urlkey is already set:
|
83 |
+
$urlKey = Mage::getResourceModel('catalog/category')
|
84 |
+
->getAttributeRawValue($id, "url_key", $project->getStoreviewDst());
|
85 |
+
|
86 |
+
if (!$urlKey) {
|
87 |
+
// setting null will force magento to generate the urlkey using the product-name
|
88 |
+
$category->setData('url_key', null);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
$category->save();
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* @param Mage_Catalog_Model_Category $category
|
98 |
+
* @param DOMElement $value
|
99 |
+
*/
|
100 |
+
private function processCustomCategoryAttributesOn($category, $value)
|
101 |
+
{
|
102 |
+
$customCategoryAttributes = $this->configHelper->getCustomCategoryAttributesForExport();
|
103 |
+
|
104 |
+
// value doesn't contain a text value as usual
|
105 |
+
// only for custom_category_attributes key it's the node object
|
106 |
+
$customCategoryAttributesNodes = $value->childNodes;
|
107 |
+
|
108 |
+
foreach ($customCategoryAttributesNodes as $customCategoryAttributesNode) {
|
109 |
+
$custom_category_attribute_key = trim($customCategoryAttributesNode->nodeName);
|
110 |
+
$custom_category_attribute_value = trim($customCategoryAttributesNode->textContent);
|
111 |
+
if (in_array($custom_category_attribute_key, $customCategoryAttributes, false)) {
|
112 |
+
$category->setDataUsingMethod(
|
113 |
+
$custom_category_attribute_key,
|
114 |
+
$custom_category_attribute_value);
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Import_Project_CmsBlocks
|
4 |
+
implements Eurotext_TranslationManager_Model_Import_Project_Importer
|
5 |
+
{
|
6 |
+
use Eurotext_TranslationManager_Model_Import_Project_CollectSkipped;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @var string[]
|
10 |
+
*/
|
11 |
+
private $cmsBlockMapping = [
|
12 |
+
'Title' => 'title',
|
13 |
+
'Content' => 'content',
|
14 |
+
];
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @param string $filename
|
18 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
19 |
+
*/
|
20 |
+
public function import($filename, Eurotext_TranslationManager_Model_Project $project)
|
21 |
+
{
|
22 |
+
$doc = new DOMDocument();
|
23 |
+
$doc->load($filename);
|
24 |
+
$cmsSites = $doc->getElementsByTagName("cms-site");
|
25 |
+
foreach ($cmsSites as $cmsSite) {
|
26 |
+
try {
|
27 |
+
$this->importBlock($cmsSite, $project);
|
28 |
+
} catch (Eurotext_TranslationManager_Model_Import_Project_Exception_MissingEntity $e) {
|
29 |
+
$this->addSkipped($e->getSkippedEntity());
|
30 |
+
}
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @param Mage_Cms_Model_Block $blockSrc
|
36 |
+
* @param int $storeviewDst
|
37 |
+
* @param Mage_Cms_Model_Block $block
|
38 |
+
*/
|
39 |
+
private function copyDataFromSourceBlock(Mage_Cms_Model_Block $blockSrc, $storeviewDst, Mage_Cms_Model_Block $block)
|
40 |
+
{
|
41 |
+
$block->addData(
|
42 |
+
[
|
43 |
+
'title' => $blockSrc->getTitle(),
|
44 |
+
'root_template' => $blockSrc->getRootTemplate(),
|
45 |
+
'meta_keywords' => $blockSrc->getMetaKeywords(),
|
46 |
+
'meta_description' => $blockSrc->getMetaDescription(),
|
47 |
+
'identifier' => $blockSrc->getIdentifier(),
|
48 |
+
'content_heading' => $blockSrc->getContentHeading(),
|
49 |
+
'stores' => [$storeviewDst],
|
50 |
+
'content' => $blockSrc->getContent(),
|
51 |
+
]
|
52 |
+
);
|
53 |
+
}
|
54 |
+
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @param Mage_Cms_Model_Block $blockSrc
|
58 |
+
* @param int $storeviewDst
|
59 |
+
*/
|
60 |
+
private function removeStoreViewFromSourceBlock(Mage_Cms_Model_Block $blockSrc, $storeviewDst)
|
61 |
+
{
|
62 |
+
/** @var $srcStoreviewIds int[] */
|
63 |
+
$srcStoreviewIds = $blockSrc->getStoreId();
|
64 |
+
if (!is_array($srcStoreviewIds)) {
|
65 |
+
return;
|
66 |
+
}
|
67 |
+
|
68 |
+
if (in_array(Mage_Core_Model_App::ADMIN_STORE_ID, $srcStoreviewIds)) {
|
69 |
+
$srcStoreviewIds = array_keys(Mage::app()->getStores());
|
70 |
+
}
|
71 |
+
|
72 |
+
$srcStoreviewIds = array_diff($srcStoreviewIds, [$storeviewDst]);
|
73 |
+
|
74 |
+
$blockSrc->setStores($srcStoreviewIds);
|
75 |
+
$blockSrc->save();
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* @param DOMElement $cmsSite
|
80 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
81 |
+
*/
|
82 |
+
private function importBlock(DOMElement $cmsSite, Eurotext_TranslationManager_Model_Project $project)
|
83 |
+
{
|
84 |
+
$fieldNodes = $cmsSite->childNodes;
|
85 |
+
|
86 |
+
$id = 0;
|
87 |
+
$fields = [];
|
88 |
+
$StoreviewDst = -1;
|
89 |
+
|
90 |
+
foreach ($fieldNodes as $fieldNode) {
|
91 |
+
$nodeName = trim($fieldNode->nodeName);
|
92 |
+
$nodeContent = trim($fieldNode->textContent);
|
93 |
+
|
94 |
+
if ($nodeName != "") {
|
95 |
+
if ($nodeName == "Id") {
|
96 |
+
$id = intval($nodeContent);
|
97 |
+
} elseif ($nodeName == "StoreviewDst") {
|
98 |
+
$StoreviewDst = intval($nodeContent);
|
99 |
+
} else {
|
100 |
+
$fields[$nodeName] = $nodeContent;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
if ($id > 0) {
|
106 |
+
$blockDst = null;
|
107 |
+
/** @var $blockSrc Mage_Cms_Model_Block */
|
108 |
+
$blockSrc = Mage::getModel('cms/block')->load($id);
|
109 |
+
|
110 |
+
if ($blockSrc->isObjectNew()) {
|
111 |
+
throw new Eurotext_TranslationManager_Model_Import_Project_Exception_MissingEntity(
|
112 |
+
sprintf('Block with id "%s" not found.', $id),
|
113 |
+
0,
|
114 |
+
null,
|
115 |
+
$id
|
116 |
+
);
|
117 |
+
}
|
118 |
+
|
119 |
+
$this->removeStoreViewFromSourceBlock($blockSrc, $StoreviewDst);
|
120 |
+
|
121 |
+
$identifier = $blockSrc->getIdentifier();
|
122 |
+
|
123 |
+
/** @var Mage_Cms_Model_Block $block */
|
124 |
+
$block = Mage::getResourceModel('cms/block_collection')
|
125 |
+
->addStoreFilter($project->getStoreviewDst(), false)
|
126 |
+
->addFieldToFilter('identifier', $identifier)
|
127 |
+
->addOrder('block_id', 'ASC')
|
128 |
+
->getFirstItem();
|
129 |
+
|
130 |
+
$this->copyDataFromSourceBlock($blockSrc, $StoreviewDst, $block);
|
131 |
+
|
132 |
+
foreach ($fields as $key => $value) {
|
133 |
+
if (isset($this->cmsBlockMapping[$key])) {
|
134 |
+
$block->setDataUsingMethod($this->cmsBlockMapping[$key], $value);
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
$block->save();
|
139 |
+
}
|
140 |
+
}
|
141 |
+
}
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Import_Project_CmsPages
|
4 |
+
implements Eurotext_TranslationManager_Model_Import_Project_Importer
|
5 |
+
{
|
6 |
+
use Eurotext_TranslationManager_Model_Import_Project_CollectSkipped;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @param string $fullFilename
|
10 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
11 |
+
*/
|
12 |
+
public function import($fullFilename, Eurotext_TranslationManager_Model_Project $project)
|
13 |
+
{
|
14 |
+
$doc = new DOMDocument();
|
15 |
+
$doc->load($fullFilename);
|
16 |
+
$cmsSites = $doc->getElementsByTagName("cms-site");
|
17 |
+
foreach ($cmsSites as $cmsSite) {
|
18 |
+
try {
|
19 |
+
$this->importPage($cmsSite, $project, $fullFilename);
|
20 |
+
} catch (Eurotext_TranslationManager_Model_Import_Project_Exception_MissingEntity $e) {
|
21 |
+
$this->addSkipped($e->getSkippedEntity());
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @param Mage_Cms_Model_Page $pageSrc
|
28 |
+
* @param int $storeviewDst
|
29 |
+
*/
|
30 |
+
private function removeDestinationStoreViewFromSourcePage(Mage_Cms_Model_Page $pageSrc, $storeviewDst)
|
31 |
+
{
|
32 |
+
/** @var $srcStoreviewIds int[] */
|
33 |
+
$srcStoreviewIds = $pageSrc->getStoreId();
|
34 |
+
if (in_array(Mage_Core_Model_App::ADMIN_STORE_ID, $srcStoreviewIds)) {
|
35 |
+
$srcStoreviewIds = array_keys(Mage::app()->getStores());
|
36 |
+
}
|
37 |
+
|
38 |
+
// Remove destination storeview:
|
39 |
+
$srcStoreviewIds = array_diff($srcStoreviewIds, [$storeviewDst]);
|
40 |
+
|
41 |
+
$pageSrc->setStoreId($srcStoreviewIds);
|
42 |
+
$pageSrc->save();
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @param DOMDocument $cmsSite
|
47 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
48 |
+
* @param $fullFilename
|
49 |
+
* @throws Exception
|
50 |
+
*/
|
51 |
+
private function importPage(DOMElement $cmsSite, Eurotext_TranslationManager_Model_Project $project, $fullFilename)
|
52 |
+
{
|
53 |
+
/** @var $cmsSite DOMNode */
|
54 |
+
$fieldNodes = $cmsSite->childNodes;
|
55 |
+
|
56 |
+
$id = 0;
|
57 |
+
$fields = [];
|
58 |
+
$storeviewDst = $project->getStoreviewDst();
|
59 |
+
|
60 |
+
foreach ($fieldNodes as $fieldNode) {
|
61 |
+
/** @var $fieldNode DOMNode */
|
62 |
+
/** @var $nodeName string */
|
63 |
+
$nodeName = trim($fieldNode->nodeName);
|
64 |
+
$nodeContent = trim($fieldNode->textContent);
|
65 |
+
|
66 |
+
if ($nodeName != "") {
|
67 |
+
if ($nodeName == "Id") {
|
68 |
+
$id = intval($nodeContent);
|
69 |
+
} else {
|
70 |
+
$fields[$nodeName] = $nodeContent;
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
if ($id <= 0) {
|
76 |
+
throw new Exception(
|
77 |
+
sprintf('ID of CMS page couldn\'t be read from file "%s". Value read "%s"'),
|
78 |
+
$fullFilename,
|
79 |
+
$id
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
/** @var $pageSrc Mage_Cms_Model_Page */
|
84 |
+
$pageSrc = Mage::getModel('cms/page')->load($id);
|
85 |
+
if ($pageSrc->isObjectNew()) {
|
86 |
+
throw new Eurotext_TranslationManager_Model_Import_Project_Exception_MissingEntity(
|
87 |
+
sprintf('CMS page with id "%s" not found.', $id),
|
88 |
+
0,
|
89 |
+
null,
|
90 |
+
$id
|
91 |
+
);
|
92 |
+
}
|
93 |
+
$this->removeDestinationStoreViewFromSourcePage($pageSrc, $storeviewDst);
|
94 |
+
|
95 |
+
$identifier = $pageSrc->getIdentifier();
|
96 |
+
// Find matching page:
|
97 |
+
$pageDst = $this->findMatchingPage($project, $identifier);
|
98 |
+
|
99 |
+
$contentHeading = isset($fields['ContentHeading']) ? $fields['ContentHeading'] : $pageSrc->getContentHeading();
|
100 |
+
$pageData = [
|
101 |
+
'title' => isset($fields['Title']) ? $fields['Title'] : $pageSrc->getTitle(),
|
102 |
+
'root_template' => $pageSrc->getRootTemplate(),
|
103 |
+
'meta_keywords' => $pageSrc->getMetaKeywords(),
|
104 |
+
'meta_description' => $pageSrc->getMetaDescription(),
|
105 |
+
'identifier' => $pageSrc->getIdentifier(),
|
106 |
+
'content_heading' => $contentHeading,
|
107 |
+
'stores' => [$storeviewDst],
|
108 |
+
'content' => isset($fields['Content']) ? $fields['Content'] : $pageSrc->getContent(),
|
109 |
+
];
|
110 |
+
$pageDst->addData($pageData);
|
111 |
+
|
112 |
+
$pageDst->save();
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
117 |
+
* @param string $identifier
|
118 |
+
* @return Mage_Cms_Model_Page
|
119 |
+
*/
|
120 |
+
private function findMatchingPage(Eurotext_TranslationManager_Model_Project $project, $identifier)
|
121 |
+
{
|
122 |
+
$pageDst = Mage::getResourceModel('cms/page_collection')
|
123 |
+
->addStoreFilter($project->getStoreviewDst(), false)
|
124 |
+
->addFieldToFilter('identifier', $identifier)
|
125 |
+
->getFirstItem();
|
126 |
+
|
127 |
+
return $pageDst;
|
128 |
+
}
|
129 |
+
}
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
trait Eurotext_TranslationManager_Model_Import_Project_CollectSkipped
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var string[]|int[]
|
7 |
+
*/
|
8 |
+
private $skipped;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param string|int $skipped
|
12 |
+
*/
|
13 |
+
public function addSkipped($skipped)
|
14 |
+
{
|
15 |
+
$this->skipped[] = $skipped;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @return int[]|string[]
|
20 |
+
*/
|
21 |
+
public function getSkippedEntities()
|
22 |
+
{
|
23 |
+
return $this->skipped;
|
24 |
+
}
|
25 |
+
}
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Import_Project_EmailTemplates
|
4 |
+
implements Eurotext_TranslationManager_Model_Import_Project_Importer
|
5 |
+
{
|
6 |
+
use Eurotext_TranslationManager_Model_Import_Project_CollectSkipped;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @var string[]
|
10 |
+
*/
|
11 |
+
private $mapping = [
|
12 |
+
'template_text' => 'Text',
|
13 |
+
'template_styles' => 'Styles',
|
14 |
+
'template_subject' => 'Subject',
|
15 |
+
];
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
19 |
+
* @param string $file
|
20 |
+
*/
|
21 |
+
public function import($file, Eurotext_TranslationManager_Model_Project $project)
|
22 |
+
{
|
23 |
+
$sxml = simplexml_load_file($file);
|
24 |
+
foreach ($sxml->xpath('//email') as $templateNode) {
|
25 |
+
$this->importTemplate($project, $templateNode);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
31 |
+
* @param SimpleXMLElement $templateNode
|
32 |
+
*/
|
33 |
+
private function importTemplate(Eurotext_TranslationManager_Model_Project $project, SimpleXMLElement $templateNode)
|
34 |
+
{
|
35 |
+
if ('false' === (string)$templateNode->Database) {
|
36 |
+
$this->importEmailFileTemplate($project, $templateNode);
|
37 |
+
} else {
|
38 |
+
$this->importEmailDatabaseTemplate($project, $templateNode);
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
44 |
+
* @param SimpleXMLElement $templateNode
|
45 |
+
*/
|
46 |
+
private function importEmailDatabaseTemplate(
|
47 |
+
Eurotext_TranslationManager_Model_Project $project,
|
48 |
+
SimpleXMLElement $templateNode
|
49 |
+
) {
|
50 |
+
try {
|
51 |
+
$template = $this->createTemplate($templateNode, $project);
|
52 |
+
$this->updateEmailConfig($templateNode, $template);
|
53 |
+
$this->clearCache();
|
54 |
+
} catch (Eurotext_TranslationManager_Model_Import_Project_Exception_MissingEntity $e) {
|
55 |
+
$this->addSkipped($e->getSkippedEntity());
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @param SimpleXMLElement $templateNode
|
61 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
62 |
+
* @return Mage_Core_Model_Email_Template
|
63 |
+
*/
|
64 |
+
private function createTemplate($templateNode, Eurotext_TranslationManager_Model_Project $project)
|
65 |
+
{
|
66 |
+
/** @var Mage_Core_Model_Email_Template $template */
|
67 |
+
$templateId = (int)$templateNode->Id;
|
68 |
+
$template = Mage::getModel('core/email_template')->load($templateId);
|
69 |
+
if ($template->isObjectNew()) {
|
70 |
+
throw new Eurotext_TranslationManager_Model_Import_Project_Exception_MissingEntity(
|
71 |
+
sprintf('Template with id "%s" can\'t be cloned, it is missing.', $templateId), 0, null, $templateId
|
72 |
+
);
|
73 |
+
}
|
74 |
+
$template->setId(null);
|
75 |
+
foreach ($this->mapping as $magento => $eurotext) {
|
76 |
+
$template->setDataUsingMethod($magento, (string)$templateNode->{$eurotext});
|
77 |
+
}
|
78 |
+
$template->setTemplateCode(sprintf('[%s] %s', $project->getStoreviewDstLocale(), $template->getTemplateCode()));
|
79 |
+
$template->save();
|
80 |
+
|
81 |
+
return $template;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* @param SimpleXMLElement $templateNode
|
86 |
+
* @param Mage_Core_Model_Email_Template $template
|
87 |
+
*/
|
88 |
+
private function updateEmailConfig($templateNode, $template)
|
89 |
+
{
|
90 |
+
/** @var $configPaths SimpleXMLElement */
|
91 |
+
$configPaths = $templateNode->Path;
|
92 |
+
for ($i = 0; $i < $configPaths->count(); $i++) {
|
93 |
+
$path = $configPaths[$i];
|
94 |
+
$scope = Mage_Adminhtml_Block_System_Config_Form::SCOPE_STORES;
|
95 |
+
Mage::getConfig()->saveConfig((string)$path, $template->getId(), $scope, (int)$templateNode->StoreviewDst);
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
private function clearCache()
|
100 |
+
{
|
101 |
+
Mage::getConfig()->reinit();
|
102 |
+
Mage::app()->reinitStores();
|
103 |
+
}
|
104 |
+
|
105 |
+
private function importEmailFileTemplate(
|
106 |
+
Eurotext_TranslationManager_Model_Project $project,
|
107 |
+
SimpleXMLElement $templateNode
|
108 |
+
) {
|
109 |
+
$path = (string)$templateNode->Path;
|
110 |
+
$text = (string)$templateNode->Text;
|
111 |
+
$subject = (string)$templateNode->Subject;
|
112 |
+
$styles = (string)$templateNode->Styles;
|
113 |
+
|
114 |
+
$html = <<<HTML
|
115 |
+
<!--@subject $subject @-->
|
116 |
+
<!--@styles $styles@-->
|
117 |
+
$text
|
118 |
+
|
119 |
+
HTML;
|
120 |
+
$file = Mage::getBaseDir('app') . '/locale/' . $project->getStoreviewDstLocale() . '/template' . $path;
|
121 |
+
$dir = dirname($file);
|
122 |
+
if (!is_dir($dir)) {
|
123 |
+
mkdir($dir, 0777, true);
|
124 |
+
}
|
125 |
+
file_put_contents($file, $html);
|
126 |
+
}
|
127 |
+
}
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Import_Project_Exception_MissingEntity extends Mage_Core_Exception
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var string|int
|
7 |
+
*/
|
8 |
+
private $skippedEntity;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param string $message
|
12 |
+
* @param int $code
|
13 |
+
* @param Exception|null $previous
|
14 |
+
* @param string|int $skippedEntity
|
15 |
+
*/
|
16 |
+
public function __construct($message, $code, $previous, $skippedEntity)
|
17 |
+
{
|
18 |
+
parent::__construct($message, $code, $previous);
|
19 |
+
$this->skippedEntity = $skippedEntity;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @return int|string
|
24 |
+
*/
|
25 |
+
public function getSkippedEntity()
|
26 |
+
{
|
27 |
+
return $this->skippedEntity;
|
28 |
+
}
|
29 |
+
}
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
interface Eurotext_TranslationManager_Model_Import_Project_Importer
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @param string $filename
|
7 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
8 |
+
* @return void
|
9 |
+
*/
|
10 |
+
public function import($filename, Eurotext_TranslationManager_Model_Project $project);
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @return string[]|int[]
|
14 |
+
*/
|
15 |
+
public function getSkippedEntities();
|
16 |
+
}
|
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Import_Project_LocaleCsvFiles
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Varien_File_Csv
|
7 |
+
*/
|
8 |
+
private $csvHelper;
|
9 |
+
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->csvHelper = new Varien_File_Csv();
|
13 |
+
}
|
14 |
+
|
15 |
+
public function import($filename)
|
16 |
+
{
|
17 |
+
$doc = $this->createDomDocument($filename);
|
18 |
+
$destinationFile = $this->getDestinationFile($doc);
|
19 |
+
|
20 |
+
$translations = $this->readCsvIntoArray($destinationFile);
|
21 |
+
$translations = $this->readNewTranslationsFromXml($doc, $filename, $translations);
|
22 |
+
|
23 |
+
$this->createCsvDirectory($destinationFile);
|
24 |
+
$this->writeTranslationToCsv($translations, $destinationFile);
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param $path
|
29 |
+
*/
|
30 |
+
private function createCsvDirectory($path)
|
31 |
+
{
|
32 |
+
$csvDirectory = dirname($path);
|
33 |
+
if (!is_dir($csvDirectory)) {
|
34 |
+
mkdir($csvDirectory, 0777, true);
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @param string $csv
|
40 |
+
* @return string[]
|
41 |
+
*/
|
42 |
+
private function readCsvIntoArray($csv)
|
43 |
+
{
|
44 |
+
if (!is_file($csv)) {
|
45 |
+
return [];
|
46 |
+
}
|
47 |
+
|
48 |
+
return $this->csvHelper->getDataPairs($csv);
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @param DOMDocument $doc
|
53 |
+
* @param string $path
|
54 |
+
* @param string[] $translations
|
55 |
+
* @return string[]
|
56 |
+
*/
|
57 |
+
private function readNewTranslationsFromXml($doc, $path, $translations)
|
58 |
+
{
|
59 |
+
/** @var $newTranslations DOMNode */
|
60 |
+
$newTranslations = $doc->getElementsByTagName("translation")[0];
|
61 |
+
|
62 |
+
foreach ($newTranslations->childNodes as $line) {
|
63 |
+
$originalString = null;
|
64 |
+
$translatedString = null;
|
65 |
+
if (!($line instanceof DOMElement)) {
|
66 |
+
continue;
|
67 |
+
}
|
68 |
+
foreach ($line->childNodes as $content) {
|
69 |
+
if (!($line instanceof DOMElement)) {
|
70 |
+
continue;
|
71 |
+
}
|
72 |
+
if ($this->nodeContainsOrigString($content)) {
|
73 |
+
$originalString = (string)$content->textContent;
|
74 |
+
}
|
75 |
+
if ($this->nodeContainsTranslation($content)) {
|
76 |
+
$translatedString = (string)$content->textContent;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
$this->validateTranslation($path, $originalString, $translatedString);
|
80 |
+
$translations[$originalString] = $translatedString;
|
81 |
+
}
|
82 |
+
|
83 |
+
return $translations;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
*
|
88 |
+
* @param string[] $translations
|
89 |
+
* @param string $csvFile
|
90 |
+
*/
|
91 |
+
private function writeTranslationToCsv($translations, $csvFile)
|
92 |
+
{
|
93 |
+
$translations = $this->fixCsvDataFormat($translations);
|
94 |
+
$this->csvHelper->saveData($csvFile, $translations);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* @param DOMElement $content
|
99 |
+
* @return bool
|
100 |
+
*/
|
101 |
+
private function nodeContainsOrigString($content)
|
102 |
+
{
|
103 |
+
return $content->nodeName == 'line-context' && $content->getAttribute('locale') == 'en_US';
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @param DOMNode $content
|
108 |
+
* @return bool
|
109 |
+
*/
|
110 |
+
private function nodeContainsTranslation($content)
|
111 |
+
{
|
112 |
+
return $content->nodeName == 'line';
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* @param string $path
|
117 |
+
* @param string $originalString
|
118 |
+
* @param string $translatedString
|
119 |
+
*/
|
120 |
+
private function validateTranslation($path, $originalString, $translatedString)
|
121 |
+
{
|
122 |
+
if ($originalString === null || $translatedString === null) {
|
123 |
+
throw new Exception(
|
124 |
+
sprintf('Something went wrong while reading CSV translation data from "%s"', $path)
|
125 |
+
);
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* @param DOMDocument $doc
|
131 |
+
* @return string
|
132 |
+
*/
|
133 |
+
private function getDestinationFile($doc)
|
134 |
+
{
|
135 |
+
/** @var DOMElement $node */
|
136 |
+
$node = $doc->getElementsByTagName('translation')[0];
|
137 |
+
$relativeDestinationFile = $node->getAttribute('dst_filename');
|
138 |
+
$destinationFile = Mage::getBaseDir('app') . $relativeDestinationFile;
|
139 |
+
|
140 |
+
return $destinationFile;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* @param string $filename
|
145 |
+
* @return DOMDocument
|
146 |
+
*/
|
147 |
+
private function createDomDocument($filename)
|
148 |
+
{
|
149 |
+
$doc = new DOMDocument();
|
150 |
+
$doc->load($filename);
|
151 |
+
|
152 |
+
return $doc;
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* @param string[] $translations
|
157 |
+
* @return string[]
|
158 |
+
*/
|
159 |
+
private function fixCsvDataFormat($translations)
|
160 |
+
{
|
161 |
+
$translations = array_map(
|
162 |
+
function ($orig, $translation) {
|
163 |
+
return [$orig, $translation];
|
164 |
+
},
|
165 |
+
array_keys($translations),
|
166 |
+
$translations
|
167 |
+
);
|
168 |
+
|
169 |
+
return $translations;
|
170 |
+
}
|
171 |
+
}
|
@@ -0,0 +1,335 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Import_Project_Product
|
4 |
+
implements Eurotext_TranslationManager_Model_Import_Project_Importer
|
5 |
+
{
|
6 |
+
use Eurotext_TranslationManager_Model_Import_Project_CollectSkipped;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @var string[]
|
10 |
+
*/
|
11 |
+
private $eurotextToMagentoMappingForSimpleAttributes = [
|
12 |
+
'Title' => 'name',
|
13 |
+
'Longdesc' => 'description',
|
14 |
+
'Shortdesc' => 'short_description',
|
15 |
+
'SeoTitle' => 'meta_title',
|
16 |
+
'SeoDescription' => 'meta_description',
|
17 |
+
'SeoKeywords' => 'meta_keyword',
|
18 |
+
];
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var string[]
|
22 |
+
*/
|
23 |
+
private $ignoreFields = ["#text", "Url"];
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @var mixed[]
|
27 |
+
*/
|
28 |
+
private $project;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @var DOMDocument
|
32 |
+
*/
|
33 |
+
private $domDocument;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @var Eurotext_TranslationManager_Helper_Data
|
37 |
+
*/
|
38 |
+
private $helper;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @var Eurotext_TranslationManager_Helper_Config
|
42 |
+
*/
|
43 |
+
private $configHelper;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @var Eurotext_TranslationManager_Model_ProductLoader
|
47 |
+
*/
|
48 |
+
private $productLoader;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @var Eurotext_TranslationManager_Model_Factory
|
52 |
+
*/
|
53 |
+
private $factory;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @param Eurotext_TranslationManager_Helper_Data $helper
|
57 |
+
* @param Eurotext_TranslationManager_Helper_Config $configHelper
|
58 |
+
* @param Eurotext_TranslationManager_Model_Factory $factory
|
59 |
+
*/
|
60 |
+
public function __construct(
|
61 |
+
Eurotext_TranslationManager_Helper_Data $helper,
|
62 |
+
Eurotext_TranslationManager_Helper_Config $configHelper,
|
63 |
+
Eurotext_TranslationManager_Model_Factory $factory
|
64 |
+
) {
|
65 |
+
$this->helper = $helper;
|
66 |
+
$this->factory = $factory;
|
67 |
+
$this->productLoader = $this->factory->getProductLoader();
|
68 |
+
$this->configHelper = $configHelper;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @param string $filename
|
73 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
74 |
+
*/
|
75 |
+
public function import($filename, Eurotext_TranslationManager_Model_Project $project)
|
76 |
+
{
|
77 |
+
$this->project = $project;
|
78 |
+
$this->domDocument = new DOMDocument();
|
79 |
+
$this->domDocument->load($filename);
|
80 |
+
|
81 |
+
$this->helper->log('=== Importing Products ===');
|
82 |
+
|
83 |
+
/** @var $article DOMElement */
|
84 |
+
foreach ($this->domDocument->getElementsByTagName("article") as $article) {
|
85 |
+
try {
|
86 |
+
$product = $this->productLoader->load(
|
87 |
+
$this->getProductIdFromXml($article),
|
88 |
+
$this->getStoreId()
|
89 |
+
);
|
90 |
+
Mage::dispatchEvent(
|
91 |
+
'eurotext_product_import_translate_before',
|
92 |
+
['product' => $product, 'translation' => $article]
|
93 |
+
);
|
94 |
+
$this->updateProductTranslation($article, $product);
|
95 |
+
Mage::dispatchEvent(
|
96 |
+
'eurotext_product_import_save_before',
|
97 |
+
['product' => $product, 'translation' => $article]
|
98 |
+
);
|
99 |
+
$product->save();
|
100 |
+
Mage::dispatchEvent(
|
101 |
+
'eurotext_product_import_save_after',
|
102 |
+
['product' => $product, 'translation' => $article]
|
103 |
+
);
|
104 |
+
$this->helper->log('== Product has been saved ==');
|
105 |
+
} catch (Eurotext_TranslationManager_Model_Import_Project_Exception_MissingEntity $e) {
|
106 |
+
$this->addSkipped($e->getSkippedEntity());
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* @param DOMElement $article
|
113 |
+
*
|
114 |
+
* @return int
|
115 |
+
*/
|
116 |
+
private function getProductIdFromXml($article)
|
117 |
+
{
|
118 |
+
return (int)$article->getElementsByTagName('Id')->item(0)->textContent;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* @return int
|
123 |
+
*/
|
124 |
+
private function getStoreId()
|
125 |
+
{
|
126 |
+
return (int)$this->project['storeview_dst'];
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* @param DOMElement $article
|
131 |
+
* @param Mage_Catalog_Model_Product $product
|
132 |
+
*/
|
133 |
+
private function updateProductTranslation(DOMElement $article, Mage_Catalog_Model_Product $product)
|
134 |
+
{
|
135 |
+
$fieldNodes = $article->childNodes;
|
136 |
+
$id = 0;
|
137 |
+
$fields = [];
|
138 |
+
|
139 |
+
foreach ($fieldNodes as $fieldNode) {
|
140 |
+
$nodeName = trim($fieldNode->nodeName);
|
141 |
+
$nodeContent = trim($fieldNode->textContent);
|
142 |
+
|
143 |
+
if ($nodeName != "") {
|
144 |
+
if ($nodeName == "Id") {
|
145 |
+
$id = intval($nodeContent);
|
146 |
+
} else {
|
147 |
+
if ('custom_attributes' == $nodeName) {
|
148 |
+
$fields[$nodeName] = $fieldNode;
|
149 |
+
} else {
|
150 |
+
$fields[$nodeName] = $nodeContent;
|
151 |
+
}
|
152 |
+
}
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
$this->helper->log("Saving Product (ID $id) for StoreID: {$this->getStoreId()}");
|
157 |
+
|
158 |
+
foreach ($fields as $key => $value) {
|
159 |
+
if (array_key_exists($key, $this->eurotextToMagentoMappingForSimpleAttributes)) {
|
160 |
+
$product->setDataUsingMethod($this->eurotextToMagentoMappingForSimpleAttributes[$key], $value);
|
161 |
+
continue;
|
162 |
+
}
|
163 |
+
if ($key == 'UrlKey') {
|
164 |
+
$productId = $product->getId();
|
165 |
+
$value = $this->fixEeCoreBugAndGenerateUniqueUrlKey($value, $productId);
|
166 |
+
$product->setDataUsingMethod('url_key', $value);
|
167 |
+
continue;
|
168 |
+
}
|
169 |
+
if ($key == "Images") {
|
170 |
+
$this->processProductImages($article, $product);
|
171 |
+
continue;
|
172 |
+
}
|
173 |
+
if ($key == "Options") {
|
174 |
+
$this->processOptionsForProduct($article);
|
175 |
+
continue;
|
176 |
+
}
|
177 |
+
if ('custom_attributes' == $key) {
|
178 |
+
$this->processCustomProductAttributesOn($product, $value);
|
179 |
+
continue;
|
180 |
+
}
|
181 |
+
if (!in_array($key, $this->ignoreFields)) {
|
182 |
+
$this->helper->log(
|
183 |
+
'Unknown Field: ' . $key,
|
184 |
+
Zend_Log::EMERG
|
185 |
+
);
|
186 |
+
throw new Mage_Exception('Unknown Field: ' . $key);
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* @param DOMElement $article
|
193 |
+
* @param Mage_Catalog_Model_Product $product
|
194 |
+
*/
|
195 |
+
private function processProductImages(DOMElement $article, Mage_Catalog_Model_Product $product)
|
196 |
+
{
|
197 |
+
|
198 |
+
$imageNodes = $article->getElementsByTagName("Image");
|
199 |
+
|
200 |
+
if($imageNodes->length){
|
201 |
+
$product->getMediaGalleryImages();
|
202 |
+
}
|
203 |
+
|
204 |
+
foreach ($imageNodes as $imageNode) {
|
205 |
+
/** @var $imageNode DomElement */
|
206 |
+
$imgValueId = intval($imageNode->getAttributeNode("value_id")->value);
|
207 |
+
$imgPosition = intval($imageNode->getAttributeNode("position")->value);
|
208 |
+
$imgDisabled = intval($imageNode->getAttributeNode("disabled")->value);
|
209 |
+
|
210 |
+
$labelNodes = $imageNode->getElementsByTagName("Label");
|
211 |
+
$imgLabel = '';
|
212 |
+
foreach ($labelNodes as $labelNode) {
|
213 |
+
$imgLabel = trim($labelNode->textContent);
|
214 |
+
}
|
215 |
+
|
216 |
+
$this->factory->getMediaGalleryValueUpdate()
|
217 |
+
->update($product, $imgValueId, $imgLabel, $imgPosition, $imgDisabled);
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* @param DOMElement $article
|
223 |
+
*/
|
224 |
+
private function processOptionsForProduct($article)
|
225 |
+
{
|
226 |
+
$optionNodes = $article->getElementsByTagName("Option");
|
227 |
+
foreach ($optionNodes as $optionNode) {
|
228 |
+
/** @var $optionNode DOMElement */
|
229 |
+
$optionId = intval($optionNode->getAttributeNode("Id")->value);
|
230 |
+
$title = trim($this->getXMLChildNodeText($optionNode, "Title", ""));
|
231 |
+
if ($title) {
|
232 |
+
Mage::getResourceModel('eurotext_translationmanager/catalog_product_option_title')
|
233 |
+
->updateTitleForStore($optionId, $title, $this->getStoreId());
|
234 |
+
}
|
235 |
+
|
236 |
+
$OptionValueNodes = $article->getElementsByTagName("Value");
|
237 |
+
foreach ($OptionValueNodes as $OptionValueNode) {
|
238 |
+
$optionValueId = intval($OptionValueNode->getAttributeNode("Id")->value);
|
239 |
+
$optionValueTitle = trim($this->getXMLChildNodeText($OptionValueNode, "Title", ""));
|
240 |
+
|
241 |
+
if ($optionValueTitle) {
|
242 |
+
Mage::getResourceModel('eurotext_translationmanager/catalog_product_option_type_title')
|
243 |
+
->updateTitleForStore($optionValueId, $optionValueTitle, $this->getStoreId());
|
244 |
+
}
|
245 |
+
}
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* @param DOMElement $element
|
251 |
+
* @param string $childnodeName
|
252 |
+
* @param string $defaultValue
|
253 |
+
*
|
254 |
+
* @return string
|
255 |
+
*/
|
256 |
+
private function getXMLChildNodeText(DOMElement $element, $childnodeName, $defaultValue = "")
|
257 |
+
{
|
258 |
+
$childNode = $this->getXMLChildNode($element, $childnodeName);
|
259 |
+
if ($childNode == null) {
|
260 |
+
return $defaultValue;
|
261 |
+
}
|
262 |
+
|
263 |
+
/** @var $childNode DOMElement */
|
264 |
+
return $childNode->textContent;
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* @param DOMElement $element
|
269 |
+
* @param string $childnodeName
|
270 |
+
*
|
271 |
+
* @return DOMElement
|
272 |
+
*/
|
273 |
+
private function getXMLChildNode($element, $childnodeName)
|
274 |
+
{
|
275 |
+
$childNodes = $element->childNodes;
|
276 |
+
foreach ($childNodes as $childNode) {
|
277 |
+
if ($childNode->nodeType == XML_ELEMENT_NODE) {
|
278 |
+
if ($childNode->tagName == $childnodeName) {
|
279 |
+
return $childNode;
|
280 |
+
}
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
return null;
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* @param Mage_Catalog_Model_Product $product
|
289 |
+
* @param DOMElement $value
|
290 |
+
*/
|
291 |
+
private function processCustomProductAttributesOn($product, $value)
|
292 |
+
{
|
293 |
+
$customProductAttributes = $this->configHelper->getCustomProductAttributesForExport();
|
294 |
+
|
295 |
+
// value doesn't contain a text value as usual
|
296 |
+
// only for custom_product_attributes key it's the node object
|
297 |
+
$customProductAttributesNodes = $value->childNodes;
|
298 |
+
|
299 |
+
foreach ($customProductAttributesNodes as $customProductAttributesNode) {
|
300 |
+
$custom_product_attribute_key = trim($customProductAttributesNode->nodeName);
|
301 |
+
$custom_product_attribute_value = trim($customProductAttributesNode->textContent);
|
302 |
+
if (in_array($custom_product_attribute_key, $customProductAttributes)) {
|
303 |
+
$product->setDataUsingMethod(
|
304 |
+
$custom_product_attribute_key,
|
305 |
+
$custom_product_attribute_value
|
306 |
+
);
|
307 |
+
}
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* @param string $origUrlKey
|
313 |
+
* @param int $productId
|
314 |
+
* @return string
|
315 |
+
*/
|
316 |
+
private function fixEeCoreBugAndGenerateUniqueUrlKey($origUrlKey, $productId)
|
317 |
+
{
|
318 |
+
$urlKey = $origUrlKey;
|
319 |
+
if (preg_match("#^(.*)(-\d+)$#", $origUrlKey, $matches)) {
|
320 |
+
$urlKey = $matches[1];
|
321 |
+
}
|
322 |
+
$urlKeys = Mage::getResourceModel('catalog/product_collection')
|
323 |
+
->addAttributeToFilter('url_key', ['regexp' => "^$urlKey(-\d+)?$"])
|
324 |
+
->addIdFilter($productId, true)
|
325 |
+
->getColumnValues('url_key');
|
326 |
+
if (!in_array($origUrlKey, $urlKeys)) {
|
327 |
+
return $origUrlKey;
|
328 |
+
}
|
329 |
+
natsort($urlKeys);
|
330 |
+
$greatestUrlKey = end($urlKeys);
|
331 |
+
$greatestNumber = str_replace($urlKey . '-', '', $greatestUrlKey);
|
332 |
+
|
333 |
+
return $urlKey . '-' . ($greatestNumber + 1);
|
334 |
+
}
|
335 |
+
}
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Import_Queue
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var int
|
7 |
+
*/
|
8 |
+
private $filesAddedToTheQueue = 0;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
12 |
+
*/
|
13 |
+
public function cleanUpQueueFor($project)
|
14 |
+
{
|
15 |
+
Mage::getModel('eurotext_translationmanager/project_import')->deleteByProjectId($project->getId());
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @param string $controlFile
|
20 |
+
*/
|
21 |
+
public function addControlXmlToQueue(Eurotext_TranslationManager_Model_Project $project, $controlFile)
|
22 |
+
{
|
23 |
+
|
24 |
+
$xml = simplexml_load_file($controlFile);
|
25 |
+
foreach ($xml->xpath('//uploadedFile') as $fileNode) {
|
26 |
+
/** @var $import Eurotext_TranslationManager_Model_Project_Import */
|
27 |
+
$import = Mage::getModel('eurotext_translationmanager/project_import');
|
28 |
+
$import->setProjectId($project->getId());
|
29 |
+
$import->setFilename((string)$fileNode['fileName']);
|
30 |
+
$import->setStoreviewDst($project->getStoreviewDst());
|
31 |
+
$import->setIsImported(0);
|
32 |
+
$import->save();
|
33 |
+
$this->filesAddedToTheQueue++;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @return int
|
39 |
+
*/
|
40 |
+
public function getFilesAddedToTheQueue()
|
41 |
+
{
|
42 |
+
return $this->filesAddedToTheQueue;
|
43 |
+
}
|
44 |
+
}
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Import_Validator
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @param int $projectId
|
7 |
+
* @param string $controlFile
|
8 |
+
*/
|
9 |
+
public function validate($projectId, $controlFile)
|
10 |
+
{
|
11 |
+
$this->validateControlFileExists($controlFile);
|
12 |
+
|
13 |
+
$projectIdFromXml = $this->getProjectIdFromXml($controlFile);
|
14 |
+
$this->compareProjectIdWithXml($projectId, $projectIdFromXml);
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @param string $controlFile
|
19 |
+
*/
|
20 |
+
private function validateControlFileExists($controlFile)
|
21 |
+
{
|
22 |
+
if (!file_exists($controlFile)) {
|
23 |
+
Mage::throwException('ZIP did not countain a control.xml file');
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param int $projectIdFromXml
|
29 |
+
*/
|
30 |
+
private function validateProjectIdFromXml($projectIdFromXml)
|
31 |
+
{
|
32 |
+
if (!ctype_digit($projectIdFromXml)) {
|
33 |
+
Mage::throwException(
|
34 |
+
Mage::helper('eurotext_translationmanager')->__(
|
35 |
+
"Could not read project-id from Description-Field in control.xml"
|
36 |
+
)
|
37 |
+
);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @param string $projectId
|
43 |
+
* @param string $projectIdFromXml
|
44 |
+
*/
|
45 |
+
private function compareProjectIdWithXml($projectId, $projectIdFromXml)
|
46 |
+
{
|
47 |
+
if ($projectId != $projectIdFromXml) {
|
48 |
+
Mage::throwException(
|
49 |
+
Mage::helper('eurotext_translationmanager')->__(
|
50 |
+
'Project id from XML "%s" and from importing project "%s" do not match, please import zip file to correct project.',
|
51 |
+
$projectIdFromXml,
|
52 |
+
$projectId
|
53 |
+
)
|
54 |
+
);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @param string $controlFile
|
60 |
+
* @return int
|
61 |
+
*/
|
62 |
+
private function getProjectIdFromXml($controlFile)
|
63 |
+
{
|
64 |
+
$doc = new DOMDocument();
|
65 |
+
$doc->load($controlFile);
|
66 |
+
$nodes = $doc->getElementsByTagName("Description");
|
67 |
+
$projectIdFromXml = null;
|
68 |
+
foreach ($nodes as $node) {
|
69 |
+
$description = $node->textContent;
|
70 |
+
$pattern = Eurotext_TranslationManager_Model_Project::INFORMATION_PATTERN;
|
71 |
+
$regexPattern = str_replace('%s', '(.*)', $pattern);
|
72 |
+
preg_match('#' . $regexPattern . '#', $description, $matches);
|
73 |
+
$projectIdFromXml = isset($matches[1]) ? $matches[1] : null;
|
74 |
+
}
|
75 |
+
|
76 |
+
$this->validateProjectIdFromXml($projectIdFromXml);
|
77 |
+
|
78 |
+
return $projectIdFromXml;
|
79 |
+
}
|
80 |
+
}
|
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Observer
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var bool
|
7 |
+
*/
|
8 |
+
private $alreadyRegistered;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var string
|
12 |
+
*/
|
13 |
+
private $subject = "Magento translationMANAGER: Registrierung";
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var string[]
|
17 |
+
*/
|
18 |
+
private $registrationLabel = [
|
19 |
+
'register_shopname' => 'Shopname',
|
20 |
+
'register_url' => 'Shop URL',
|
21 |
+
'register_email' => 'eEmail-Adresse',
|
22 |
+
'register_salutation' => 'Anrede',
|
23 |
+
'register_firstname' => 'Vorname',
|
24 |
+
'register_lastname' => 'Nachname',
|
25 |
+
'register_company' => 'Firma',
|
26 |
+
'register_street' => 'Strasse',
|
27 |
+
'register_zip' => 'PLZ',
|
28 |
+
'register_city' => 'Stadt',
|
29 |
+
'register_country' => 'Land',
|
30 |
+
'register_telephone' => 'Tel-Nr.',
|
31 |
+
];
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var Eurotext_TranslationManager_Helper_Data
|
35 |
+
*/
|
36 |
+
private $helper;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @var Eurotext_TranslationManager_Helper_Config
|
40 |
+
*/
|
41 |
+
private $configHelper;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
private $mailBody;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @var bool
|
50 |
+
*/
|
51 |
+
private $debugNoticeShown = false;
|
52 |
+
|
53 |
+
public function __construct()
|
54 |
+
{
|
55 |
+
$this->configHelper = Mage::helper('eurotext_translationmanager/config');
|
56 |
+
$this->helper = Mage::helper('eurotext_translationmanager');
|
57 |
+
}
|
58 |
+
|
59 |
+
public function outputDebugNotice(Varien_Event_Observer $observer)
|
60 |
+
{
|
61 |
+
if ($this->debugNoticeShown) {
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
|
65 |
+
if (strpos($observer->getControllerAction()->getFullActionName(), 'eurotext') !== false) {
|
66 |
+
$messages = [];
|
67 |
+
if ($this->configHelper->isDebugMode()) {
|
68 |
+
$messages[] = Mage::getSingleton('core/message')->notice(
|
69 |
+
$this->helper->__('Eurotext AG translationMANAGER: Debug mode enabled!')
|
70 |
+
);
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
if ($this->configHelper->isFtpUploadDisabled()) {
|
75 |
+
$messages[] = Mage::getSingleton('core/message')->notice(
|
76 |
+
$this->helper->__('Eurotext AG translationMANAGER: FTP Upload disabled!')
|
77 |
+
);
|
78 |
+
}
|
79 |
+
Mage::getSingleton('adminhtml/session')->addUniqueMessages($messages);
|
80 |
+
$this->debugNoticeShown = true;
|
81 |
+
}
|
82 |
+
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* @param Varien_Event_Observer $observer
|
87 |
+
*/
|
88 |
+
public function modelConfigDataSaveBefore(Varien_Event_Observer $observer)
|
89 |
+
{
|
90 |
+
$this->alreadyRegistered = $this->configHelper->isEmailSent();
|
91 |
+
|
92 |
+
$section = $observer->getObject()->getSection();
|
93 |
+
if ($section != 'eurotext') {
|
94 |
+
return;
|
95 |
+
}
|
96 |
+
|
97 |
+
$this->sendRegisterMailToEurotext($observer);
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* @param Varien_Event_Observer $observer
|
102 |
+
*/
|
103 |
+
private function sendRegisterMailToEurotext(Varien_Event_Observer $observer)
|
104 |
+
{
|
105 |
+
$groups = $observer->getObject()->getGroups();
|
106 |
+
$newValues = $changes = [];
|
107 |
+
|
108 |
+
foreach ($groups['config']['fields'] as $key => $data) {
|
109 |
+
$newValues[$key] = $data['value'];
|
110 |
+
}
|
111 |
+
$prevValues = $this->configHelper->getRegistrationSettings();
|
112 |
+
|
113 |
+
if ($this->alreadyRegistered) {
|
114 |
+
$changes = array_diff_assoc($prevValues, $newValues);
|
115 |
+
}
|
116 |
+
|
117 |
+
/** Wir steigen aus, wenn keine Email geschickt werden muss. */
|
118 |
+
if ($this->alreadyRegistered === true && empty($changes)) {
|
119 |
+
return;
|
120 |
+
}
|
121 |
+
|
122 |
+
$this->composeEmail($changes, $newValues, $prevValues);
|
123 |
+
|
124 |
+
$this->sendEmail();
|
125 |
+
$this->mailBody = '';
|
126 |
+
|
127 |
+
if (!$this->alreadyRegistered) {
|
128 |
+
$this->updateConfig();
|
129 |
+
}
|
130 |
+
|
131 |
+
Mage::getSingleton('adminhtml/session')
|
132 |
+
->addSuccess($this->helper->__('Your registration data has been saved and submitted.'));
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* @param string[] $changes
|
137 |
+
* @param string[] $newValues
|
138 |
+
* @param string[] $prevValues
|
139 |
+
*/
|
140 |
+
private function composeEmail($changes, $newValues, $prevValues)
|
141 |
+
{
|
142 |
+
$this->addLineHtml("Hallo,");
|
143 |
+
$this->addLineHtml("Ein Kunde hat sich via Magento-Modul neu registriert");
|
144 |
+
if ($this->alreadyRegistered) {
|
145 |
+
$this->subject = "Update - Ein Magento translationMANAGER-Kunde hat seine Registrierungsdaten geändert";
|
146 |
+
|
147 |
+
if (!empty($changes)) {
|
148 |
+
$this->addChangesToEmailBody($changes, $newValues, $prevValues);
|
149 |
+
}
|
150 |
+
} else {
|
151 |
+
$this->addHorizontalRuler();
|
152 |
+
$this->addNewValuesToEmailBody($newValues);
|
153 |
+
|
154 |
+
}
|
155 |
+
$this->addHorizontalRuler();
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* @param string $line
|
160 |
+
*/
|
161 |
+
private function addLineHtml($line)
|
162 |
+
{
|
163 |
+
$line = htmlentities($line);
|
164 |
+
|
165 |
+
return $this->addLine("<div>$line</div>");
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* @param string $line
|
170 |
+
*/
|
171 |
+
private function addLine($line)
|
172 |
+
{
|
173 |
+
$this->mailBody = $this->mailBody . $line . "\r\n";
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @param string[] $changes
|
178 |
+
* @param string[] $newValues
|
179 |
+
* @param string[] $prevValues
|
180 |
+
*/
|
181 |
+
private function addChangesToEmailBody($changes, $newValues, $prevValues)
|
182 |
+
{
|
183 |
+
$this->addLineHtml("Ein Kunde hat im Magento-Modul seine Kontaktdaten geändert:");
|
184 |
+
|
185 |
+
$customerId = $this->configHelper->getCustomerId();
|
186 |
+
|
187 |
+
if ($customerId) {
|
188 |
+
$this->addLineHtml("Kundennummer: " . $customerId);
|
189 |
+
} else {
|
190 |
+
$this->addLineHtml("Bisher hat der Kunde keine gültige Kundennummer eingetragen.");
|
191 |
+
}
|
192 |
+
|
193 |
+
$this->addHorizontalRuler();
|
194 |
+
|
195 |
+
foreach ($changes as $key => $value) {
|
196 |
+
$this->addLineHtml(
|
197 |
+
sprintf(
|
198 |
+
'%s: %s --- war bisher: %s',
|
199 |
+
$this->registrationLabel[$key],
|
200 |
+
$newValues[$key],
|
201 |
+
$prevValues[$key]
|
202 |
+
)
|
203 |
+
);
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
private function addHorizontalRuler()
|
208 |
+
{
|
209 |
+
$this->addLine("<hr size='1' color='black'>");
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* @param string[] $newValues
|
214 |
+
*/
|
215 |
+
private function addNewValuesToEmailBody($newValues)
|
216 |
+
{
|
217 |
+
foreach ($newValues as $key => $value) {
|
218 |
+
$this->addLineHtml(
|
219 |
+
sprintf('%s: %s', $this->registrationLabel[$key], $value)
|
220 |
+
);
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
private function sendEmail()
|
225 |
+
{
|
226 |
+
$senderEmail = Mage::getStoreConfig('trans_email/ident_general/email');
|
227 |
+
$senderName = Mage::getStoreConfig('trans_email/ident_general/name');
|
228 |
+
$recipient = $this->helper->getRegistrationRecipient();
|
229 |
+
|
230 |
+
/** @var $mail Mage_Core_Model_Email */
|
231 |
+
$mail = Mage::getModel('core/email');
|
232 |
+
$mail->setFromName($senderName);
|
233 |
+
$mail->setFromEmail($senderEmail);
|
234 |
+
$mail->setToName($recipient['name']);
|
235 |
+
$mail->setToEmail($recipient['email']);
|
236 |
+
$mail->setType('html');
|
237 |
+
$mail->setBody(utf8_decode($this->mailBody));
|
238 |
+
$mail->setSubject(utf8_decode($this->subject));
|
239 |
+
|
240 |
+
$mail->send();
|
241 |
+
}
|
242 |
+
|
243 |
+
private function updateConfig()
|
244 |
+
{
|
245 |
+
$this->configHelper->setEmailSent();
|
246 |
+
$this->configHelper->setEmailSentDate(date("d.m.Y H:i:s (T)"));
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* @param Varien_Event_Observer $observer
|
251 |
+
*/
|
252 |
+
public function adminSystemConfigSectionSaveAfter(Varien_Event_Observer $observer)
|
253 |
+
{
|
254 |
+
$section = $observer->getSection();
|
255 |
+
if ($section != 'eurotext') {
|
256 |
+
return;
|
257 |
+
}
|
258 |
+
|
259 |
+
try {
|
260 |
+
Mage::getModel('eurotext_translationmanager/export_project_ftpUpload')
|
261 |
+
->validateFtpConnection();
|
262 |
+
} catch (Eurotext_TranslationManager_Exception_FtpException $e) {
|
263 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
264 |
+
Mage::helper('eurotext_translationmanager')->__('FTP test failed! Please check your connection credentials.')
|
265 |
+
);
|
266 |
+
}
|
267 |
+
}
|
268 |
+
}
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_ProductLoader
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @param int $productId
|
7 |
+
* @param int $storeId
|
8 |
+
*
|
9 |
+
* @return Mage_Catalog_Model_Product
|
10 |
+
*/
|
11 |
+
public function load($productId, $storeId)
|
12 |
+
{
|
13 |
+
if (!is_int($productId) || $productId <= 0) {
|
14 |
+
if (is_string($productId) || is_int($productId)) {
|
15 |
+
Mage::log("Wrong Product (ID: $productId)");
|
16 |
+
Mage::throwException(
|
17 |
+
Mage::helper('eurotext_translationmanager')->__("Wrong Product ID '%s'", $productId)
|
18 |
+
);
|
19 |
+
}
|
20 |
+
Mage::log("Wrong Product (ID: <no int>)");
|
21 |
+
Mage::throwException(
|
22 |
+
Mage::helper('eurotext_translationmanager')->__("Wrong Product ID '<no int>'", $productId)
|
23 |
+
);
|
24 |
+
}
|
25 |
+
|
26 |
+
/** @var Mage_Catalog_Model_Product $product */
|
27 |
+
$product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($productId);
|
28 |
+
|
29 |
+
if ($product->isObjectNew()) {
|
30 |
+
throw new Eurotext_TranslationManager_Model_Import_Project_Exception_MissingEntity(
|
31 |
+
sprintf('Product with id "%s" doesn\'t exist (anymore).', $productId),
|
32 |
+
0,
|
33 |
+
null,
|
34 |
+
$productId
|
35 |
+
);
|
36 |
+
}
|
37 |
+
$product->setUrlKey(false);
|
38 |
+
|
39 |
+
return $product;
|
40 |
+
}
|
41 |
+
}
|
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method int getId()
|
5 |
+
* @method bool getDeleted()
|
6 |
+
* @method int getCreateId()
|
7 |
+
* @method string getProjectName()
|
8 |
+
* @method int getUpatedAt()
|
9 |
+
* @method int getStoreviewSrc()
|
10 |
+
* @method int getStoreviewDst()
|
11 |
+
* @method int getProjectStatus()
|
12 |
+
* @method int getLangfilesmode()
|
13 |
+
* @method int getExportSeo()
|
14 |
+
* @method int getProductmode()
|
15 |
+
* @method int getCategorymode()
|
16 |
+
* @method int getCmsmode()
|
17 |
+
* @method string getZipFilename()
|
18 |
+
* @method int getExportAttributes()
|
19 |
+
* @method int getTemplatemode()
|
20 |
+
* @method int getExportUrlkeys()
|
21 |
+
* @method int getFilterStatus()
|
22 |
+
* @method int getFilterStock()
|
23 |
+
* @method int getFilterProductTyp()
|
24 |
+
* @method int getCreatedAt()
|
25 |
+
* @method setId(int $id)
|
26 |
+
* @method setDeleted(bool $deleted)
|
27 |
+
* @method setCreateId(int $created)
|
28 |
+
* @method setUpatedAt(int $timestamp)
|
29 |
+
* @method setLangfilesmode(int $mode)
|
30 |
+
* @method setExportSeo(int $seo)
|
31 |
+
* @method setProductmode(int $mode)
|
32 |
+
* @method setCategorymode(int $mode)
|
33 |
+
* @method setCmsmode(int $mode)
|
34 |
+
* @method setZipFilename(string $name)
|
35 |
+
* @method setExportAttributes(int $attributes)
|
36 |
+
* @method setTemplatemode(int $mode)
|
37 |
+
* @method setExportUrlkeys(int $keys)
|
38 |
+
* @method setFilterStatus(int $status)
|
39 |
+
* @method setFilterStock(int $stock)
|
40 |
+
* @method setFilterProductTyp(int $type)
|
41 |
+
* @method setCreatedAt(int $created)
|
42 |
+
* @method setStoreviewSrcLocale(string $locale)
|
43 |
+
* @method setStoreviewDstLocale(string $locale)
|
44 |
+
* @method string getStoreviewSrcLocale()
|
45 |
+
* @method string getStoreviewDstLocale()
|
46 |
+
* @method string getCustomerComment()
|
47 |
+
* @method setCustomerComment(string $comment)
|
48 |
+
*
|
49 |
+
* @method setCategories(int[] $categories)
|
50 |
+
* @method setProducts(int[] $products)
|
51 |
+
* @method setBlocks(int[] $blocks)
|
52 |
+
* @method setPages(int[] $pages)
|
53 |
+
* @method setTranslationFiles(string[] $files)
|
54 |
+
* @method setTransactionEmailFiles(string[] $mails)
|
55 |
+
* @method setTransactionEmailDatabase(string[] $mails)
|
56 |
+
*
|
57 |
+
* @method int[] getCategories() - init with addAllRelationalData
|
58 |
+
* @method int[] getProducts() - init with addAllRelationalData
|
59 |
+
* @method int[] getBlocks() - init with addAllRelationalData
|
60 |
+
* @method int[] getPages() - init with addAllRelationalData
|
61 |
+
* @method string[] getTranslationFiles() - init with addAllRelationalData
|
62 |
+
* @method string[] getTransactionEmailFiles() - init with addAllRelationalData
|
63 |
+
* @method string[] getTransactionEmailDatabase() - init with addAllRelationalData
|
64 |
+
*/
|
65 |
+
class Eurotext_TranslationManager_Model_Project extends Mage_Core_Model_Abstract
|
66 |
+
{
|
67 |
+
const STATUS_NEW = 0;
|
68 |
+
const STATUS_EXPORTED_TO_EUROTEXT = 1;
|
69 |
+
const STATUS_IMPORT_TRANSLATIONS_INTO_QUEUE = 2;
|
70 |
+
const STATUS_DONE = 3;
|
71 |
+
|
72 |
+
const DEFAULT_SRC_LOCALE = 'en_US';
|
73 |
+
const DEFAULT_DST_LOCALE = 'en_US';
|
74 |
+
|
75 |
+
const UNDEFINED_STORE = -1;
|
76 |
+
|
77 |
+
const INFORMATION_PATTERN = 'Magento-Project-Id: %s, Module-Version: %s';
|
78 |
+
|
79 |
+
/**
|
80 |
+
* @var string[]
|
81 |
+
*/
|
82 |
+
private $precheckedEmailTemplateFiles = [
|
83 |
+
'/email/html/footer.html',
|
84 |
+
'/email/html/header.html'
|
85 |
+
];
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @var bool
|
89 |
+
*/
|
90 |
+
private $additionalRelationsLoaded = false;
|
91 |
+
|
92 |
+
protected function _construct()
|
93 |
+
{
|
94 |
+
$this->_init('eurotext_translationmanager/project');
|
95 |
+
$this->setTransactionEmailFiles($this->precheckedEmailTemplateFiles);
|
96 |
+
}
|
97 |
+
|
98 |
+
public function reset()
|
99 |
+
{
|
100 |
+
switch ($this->getProjectStatus()) {
|
101 |
+
case self::STATUS_NEW:
|
102 |
+
return;
|
103 |
+
case self::STATUS_EXPORTED_TO_EUROTEXT:
|
104 |
+
$this->setProjectStatus(self::STATUS_NEW);
|
105 |
+
|
106 |
+
return;
|
107 |
+
case self::STATUS_IMPORT_TRANSLATIONS_INTO_QUEUE:
|
108 |
+
case self::STATUS_DONE:
|
109 |
+
$this->setProjectStatus(self::STATUS_EXPORTED_TO_EUROTEXT);
|
110 |
+
|
111 |
+
return;
|
112 |
+
default:
|
113 |
+
Mage::throwException('Project is in an undefined status.');
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* @return bool
|
119 |
+
*/
|
120 |
+
public function isEditable()
|
121 |
+
{
|
122 |
+
return $this->getProjectStatus() == self::STATUS_NEW;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* @return bool
|
127 |
+
*/
|
128 |
+
public function isExportable()
|
129 |
+
{
|
130 |
+
return $this->isEditable();
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* @return bool
|
135 |
+
*/
|
136 |
+
public function isImportFileLoaded()
|
137 |
+
{
|
138 |
+
return $this->getProjectStatus() == self::STATUS_IMPORT_TRANSLATIONS_INTO_QUEUE;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* @return bool
|
143 |
+
*/
|
144 |
+
public function isTranslationImportable()
|
145 |
+
{
|
146 |
+
return $this->getProjectStatus() == self::STATUS_EXPORTED_TO_EUROTEXT;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @param string $name
|
151 |
+
* @return $this
|
152 |
+
*/
|
153 |
+
public function setProjectName($name)
|
154 |
+
{
|
155 |
+
if (!is_string($name)) {
|
156 |
+
Mage::throwException('Project name must be string.');
|
157 |
+
}
|
158 |
+
if ($name === '') {
|
159 |
+
Mage::throwException('Project name can not be empty');
|
160 |
+
}
|
161 |
+
$this->setData('project_name', htmlspecialchars(trim(strip_tags($name))));
|
162 |
+
|
163 |
+
return $this;
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* @param int $source
|
168 |
+
* @return $this
|
169 |
+
*/
|
170 |
+
public function setStoreviewSrc($source)
|
171 |
+
{
|
172 |
+
$source = (int)$source;
|
173 |
+
if ($source === 0) {
|
174 |
+
Mage::throwException('Please define store view source');
|
175 |
+
}
|
176 |
+
|
177 |
+
if ($source === $this->getStoreviewDst()) {
|
178 |
+
Mage::throwException('Please select different Storeviews for Source and Destination!');
|
179 |
+
}
|
180 |
+
$this->setData('storeview_src', $source);
|
181 |
+
|
182 |
+
return $this;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* @return Mage_Core_Model_Store
|
187 |
+
*/
|
188 |
+
public function getStoreSrc()
|
189 |
+
{
|
190 |
+
return Mage::app()->getStore($this->getStoreviewSrc());
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* @return Mage_Core_Model_Store
|
195 |
+
*/
|
196 |
+
public function getStoreDst()
|
197 |
+
{
|
198 |
+
return Mage::app()->getStore($this->getStoreviewDst());
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* @param int $destination
|
203 |
+
* @return $this
|
204 |
+
*/
|
205 |
+
public function setStoreviewDst($destination)
|
206 |
+
{
|
207 |
+
$destination = (int)$destination;
|
208 |
+
if ($destination === 0) {
|
209 |
+
Mage::throwException('Please define store view destination');
|
210 |
+
}
|
211 |
+
|
212 |
+
if ($destination === $this->getStoreviewSrc()) {
|
213 |
+
Mage::throwException('Please select different store views for source and destination!');
|
214 |
+
}
|
215 |
+
$this->setData('storeview_dst', $destination);
|
216 |
+
|
217 |
+
return $this;
|
218 |
+
}
|
219 |
+
|
220 |
+
public function addAllRelationalData()
|
221 |
+
{
|
222 |
+
if (!$this->additionalRelationsLoaded) {
|
223 |
+
$this->additionalRelationsLoaded = true;
|
224 |
+
$this->getResource()->addAllRelationalData($this);
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* @return bool
|
230 |
+
*/
|
231 |
+
public function isDone()
|
232 |
+
{
|
233 |
+
return $this->getProjectStatus() == self::STATUS_DONE;
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* @return Eurotext_TranslationManager_Model_Project
|
238 |
+
*/
|
239 |
+
protected function _beforeSave()
|
240 |
+
{
|
241 |
+
if ($this->getStoreviewDst() == $this->getStoreviewSrc()) {
|
242 |
+
Mage::throwException(
|
243 |
+
Mage::helper('eurotext_translationmanager')->__('Please choose two different store views.')
|
244 |
+
);
|
245 |
+
}
|
246 |
+
|
247 |
+
return $this;
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* @return Eurotext_TranslationManager_Model_Project
|
252 |
+
*/
|
253 |
+
protected function _afterLoad()
|
254 |
+
{
|
255 |
+
$this->setStoreviewSrcLocale(self::DEFAULT_SRC_LOCALE);
|
256 |
+
$this->setStoreviewDstLocale(self::DEFAULT_SRC_LOCALE);
|
257 |
+
if ($this->getStoreviewSrc() != self::UNDEFINED_STORE) {
|
258 |
+
$this->setStoreviewSrcLocale(Mage::getStoreConfig('general/locale/code', $this->getStoreviewSrc()));
|
259 |
+
}
|
260 |
+
|
261 |
+
if ($this->getStoreviewDst() != self::UNDEFINED_STORE) {
|
262 |
+
$this->setStoreviewDstLocale(Mage::getStoreConfig('general/locale/code', $this->getStoreviewDst()));
|
263 |
+
}
|
264 |
+
|
265 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
266 |
+
$project = parent::_afterLoad();
|
267 |
+
|
268 |
+
return $project;
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* @return bool
|
273 |
+
*/
|
274 |
+
public function isExportingAllCategories()
|
275 |
+
{
|
276 |
+
return (bool)$this->getCategorymode();
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* @return bool
|
281 |
+
*/
|
282 |
+
public function isExportingAllProducts()
|
283 |
+
{
|
284 |
+
return (bool)$this->getProductmode();
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* @return bool
|
289 |
+
*/
|
290 |
+
public function isExportingAllEmailTemplates()
|
291 |
+
{
|
292 |
+
return (bool)$this->getTemplatemode();
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* @return bool
|
297 |
+
*/
|
298 |
+
public function isExportingAllCmsContent()
|
299 |
+
{
|
300 |
+
return (bool)$this->getCmsmode();
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* @return bool
|
305 |
+
*/
|
306 |
+
public function isExportingAllLanguageFiles()
|
307 |
+
{
|
308 |
+
return (bool)$this->getLangfilesmode();
|
309 |
+
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* @return bool
|
313 |
+
*/
|
314 |
+
public function isExportingAttributes()
|
315 |
+
{
|
316 |
+
return (bool)$this->getExportAttributes();
|
317 |
+
}
|
318 |
+
|
319 |
+
/**
|
320 |
+
* @return bool
|
321 |
+
*/
|
322 |
+
public function isExportingMetaAttributes()
|
323 |
+
{
|
324 |
+
return (bool)$this->getExportSeo();
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* @return bool
|
329 |
+
*/
|
330 |
+
public function isExportingUrlKeys()
|
331 |
+
{
|
332 |
+
return (bool)$this->getExportUrlkeys();
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* @param int $status
|
337 |
+
* @return $this
|
338 |
+
*/
|
339 |
+
public function setProjectStatus($status)
|
340 |
+
{
|
341 |
+
$status = max($status, self::STATUS_NEW);
|
342 |
+
$this->setData('project_status', $status);
|
343 |
+
|
344 |
+
return $this;
|
345 |
+
}
|
346 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Project_Category extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_category');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Project_Cmsblock extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_cmsblock');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Project_Cmspage extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_cmspage');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Project_Csv extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('eurotext_translationmanager/project_csv');
|
8 |
+
}
|
9 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Project_EmailtemplateDatabase extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_emailtemplateDatabase');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method string getFilename()
|
5 |
+
* @method int getProjectId()
|
6 |
+
* @method string getCreatedAt()
|
7 |
+
* @method int getProjectEmailtemplatesId()
|
8 |
+
* @method $this setFilename(string $filename)
|
9 |
+
* @method $this setProjectId(int $projectId)
|
10 |
+
* @method $this setCreatedAt(string $createdAtDate)
|
11 |
+
* @method $this setProjectEmailtemplatesId(int $projectEmailTemplateId)
|
12 |
+
*/
|
13 |
+
class Eurotext_TranslationManager_Model_Project_EmailtemplateFile extends Mage_Core_Model_Abstract
|
14 |
+
{
|
15 |
+
protected function _construct()
|
16 |
+
{
|
17 |
+
$this->_init('eurotext_translationmanager/project_emailtemplateFile');
|
18 |
+
}
|
19 |
+
}
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method Eurotext_TranslationManager_Model_Import setProjectId(int $projectId)
|
5 |
+
* @method Eurotext_TranslationManager_Model_Import setFilename(string $filename)
|
6 |
+
* @method Eurotext_TranslationManager_Model_Import setStoreviewDst(int $storeviewDst)
|
7 |
+
* @method Eurotext_TranslationManager_Model_Import setNum(int $num)
|
8 |
+
* @method Eurotext_TranslationManager_Model_Import setIsImported(int $isImported)
|
9 |
+
* @method int getProjectId()
|
10 |
+
* @method string getFilename()
|
11 |
+
* @method int getStoreviewDst()
|
12 |
+
* @method int getNum()
|
13 |
+
* @method int getIsImported()
|
14 |
+
* @method Eurotext_TranslationManager_Model_Resource_Project_Import getResource()
|
15 |
+
*/
|
16 |
+
class Eurotext_TranslationManager_Model_Project_Import extends Mage_Core_Model_Abstract
|
17 |
+
{
|
18 |
+
protected function _construct()
|
19 |
+
{
|
20 |
+
$this->_init('eurotext_translationmanager/project_import');
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @param int $id
|
25 |
+
*/
|
26 |
+
public function deleteByProjectId($id)
|
27 |
+
{
|
28 |
+
$this->getResource()->deleteByProjectId($id);
|
29 |
+
}
|
30 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Project_Product extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_product');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Project_Source_Status extends Mage_Adminhtml_Model_System_Config_Source_Yesno
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @return array
|
7 |
+
*/
|
8 |
+
public function toOptionArray()
|
9 |
+
{
|
10 |
+
$options = [];
|
11 |
+
foreach ($this->toArray() as $value => $label) {
|
12 |
+
$options[] = ['value' => $value, 'label' => $label];
|
13 |
+
}
|
14 |
+
|
15 |
+
return $options;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @return array
|
20 |
+
*/
|
21 |
+
public function toArray()
|
22 |
+
{
|
23 |
+
return [
|
24 |
+
Eurotext_TranslationManager_Model_Project::STATUS_NEW => Mage::helper('eurotext_translationmanager')->__('New'),
|
25 |
+
Eurotext_TranslationManager_Model_Project::STATUS_EXPORTED_TO_EUROTEXT => Mage::helper('eurotext_translationmanager')->__('Exported'),
|
26 |
+
Eurotext_TranslationManager_Model_Project::STATUS_IMPORT_TRANSLATIONS_INTO_QUEUE => Mage::helper('eurotext_translationmanager')->__('In progress'),
|
27 |
+
Eurotext_TranslationManager_Model_Project::STATUS_DONE => Mage::helper('eurotext_translationmanager')->__('Loaded'),
|
28 |
+
];
|
29 |
+
}
|
30 |
+
}
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
interface Eurotext_TranslationManager_Model_Renderer_Filesystem
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @return string
|
7 |
+
*/
|
8 |
+
public function getKey();
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param string $filename
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
public function render($filename);
|
15 |
+
}
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Renderer_Filesystem_RelativeToAppDirectory implements Eurotext_TranslationManager_Model_Renderer_Filesystem
|
4 |
+
{
|
5 |
+
public function render($filename)
|
6 |
+
{
|
7 |
+
$appDir = Mage::getBaseDir('app');
|
8 |
+
|
9 |
+
return str_replace($appDir, '', $filename);
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function getKey()
|
16 |
+
{
|
17 |
+
return 'relativeToApp';
|
18 |
+
}
|
19 |
+
}
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Renderer_Filesystem_RelativeToLocaleTemplateDirectory implements Eurotext_TranslationManager_Model_Renderer_Filesystem
|
4 |
+
{
|
5 |
+
public function render($filename)
|
6 |
+
{
|
7 |
+
$appDir = Mage::getBaseDir('locale');
|
8 |
+
$path = str_replace($appDir, '', $filename);
|
9 |
+
|
10 |
+
// remove first characters which are like 'en_US/template'
|
11 |
+
return substr($path, strlen('/en_US/template'));
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
public function getKey()
|
18 |
+
{
|
19 |
+
return 'relativeToLocaleTemplate';
|
20 |
+
}
|
21 |
+
}
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Catalog_Product_Attribute_Backend_Media_OnlyStoreValues
|
4 |
+
extends Mage_Catalog_Model_Resource_Product_Attribute_Backend_Media
|
5 |
+
{
|
6 |
+
protected function _getLoadGallerySelect(array $productIds, $storeId, $attributeId)
|
7 |
+
{
|
8 |
+
$adapter = $this->_getReadAdapter();
|
9 |
+
|
10 |
+
$positionCheckSql = $adapter->getCheckSql('value.position IS NULL', 'default_value.position', 'value.position');
|
11 |
+
|
12 |
+
// Select gallery images for product
|
13 |
+
$select = $adapter->select()
|
14 |
+
->from(
|
15 |
+
['main' => $this->getMainTable()],
|
16 |
+
['value_id', 'value AS file', 'product_id' => 'entity_id']
|
17 |
+
)
|
18 |
+
->joinLeft(
|
19 |
+
['value' => $this->getTable(self::GALLERY_VALUE_TABLE)],
|
20 |
+
$adapter->quoteInto('main.value_id = value.value_id AND value.store_id = ?', (int)$storeId),
|
21 |
+
['label', 'position', 'disabled']
|
22 |
+
)
|
23 |
+
->joinLeft( // Joining default values
|
24 |
+
['default_value' => $this->getTable(self::GALLERY_VALUE_TABLE)],
|
25 |
+
'main.value_id = default_value.value_id AND default_value.store_id = 0',
|
26 |
+
[
|
27 |
+
'position_default' => 'position',
|
28 |
+
'disabled_default' => 'disabled'
|
29 |
+
]
|
30 |
+
)
|
31 |
+
->where('main.attribute_id = ?', $attributeId)
|
32 |
+
->where('main.entity_id in (?)', $productIds)
|
33 |
+
->order($positionCheckSql . ' ' . Varien_Db_Select::SQL_ASC);
|
34 |
+
|
35 |
+
return $select;
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Catalog_Product_Option_Title
|
4 |
+
extends Mage_Core_Model_Resource_Db_Abstract
|
5 |
+
{
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('catalog/product_option_title', 'option_title_id');
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @param int $optionId
|
13 |
+
* @param string $title
|
14 |
+
* @param int $storeId
|
15 |
+
*/
|
16 |
+
public function updateTitleForStore($optionId, $title, $storeId)
|
17 |
+
{
|
18 |
+
$this->_getConnection('catalog_write')->query(
|
19 |
+
"INSERT INTO
|
20 |
+
{$this->getMainTable()}
|
21 |
+
(option_id, store_id, title) VALUES (:optionId, :storeId, :title)
|
22 |
+
ON DUPLICATE KEY UPDATE title=:title;",
|
23 |
+
[':optionId' => $optionId, ':storeId' => $storeId, ':title' => $title]
|
24 |
+
);
|
25 |
+
}
|
26 |
+
}
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Catalog_Product_Option_Type_Title extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('catalog/product_option_type_title', 'option_type_title_id');
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param int $optionId
|
12 |
+
* @param string $title
|
13 |
+
* @param int $storeId
|
14 |
+
*/
|
15 |
+
public function updateTitleForStore($optionId, $title, $storeId)
|
16 |
+
{
|
17 |
+
$this->_getConnection('catalog_write')->query(
|
18 |
+
"INSERT INTO
|
19 |
+
{$this->getMainTable()}
|
20 |
+
(option_type_id, store_id, title) VALUES (:optionId, :storeId, :title)
|
21 |
+
ON DUPLICATE KEY UPDATE title=:title;",
|
22 |
+
[':optionId' => $optionId, ':storeId' => $storeId, ':title' => $title]
|
23 |
+
);
|
24 |
+
}
|
25 |
+
}
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Csv_Collection
|
4 |
+
extends Eurotext_TranslationManager_Model_Resource_Filesystem_Collection
|
5 |
+
{
|
6 |
+
/**
|
7 |
+
* @var string
|
8 |
+
*/
|
9 |
+
private $language;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
13 |
+
* @return $this
|
14 |
+
*/
|
15 |
+
public function filterByProject(Eurotext_TranslationManager_Model_Project $project)
|
16 |
+
{
|
17 |
+
if (!$project->getLangfilesmode()) {
|
18 |
+
$project->addAllRelationalData();
|
19 |
+
|
20 |
+
$localeFilesWithBasePath = array_map(
|
21 |
+
function ($fileWithoutBasePath) {
|
22 |
+
return Mage::getBaseDir('app') . $fileWithoutBasePath;
|
23 |
+
},
|
24 |
+
$project->getTranslationFiles()
|
25 |
+
);
|
26 |
+
|
27 |
+
$this->addFieldToFilter(
|
28 |
+
'filename',
|
29 |
+
[
|
30 |
+
'in' => $localeFilesWithBasePath
|
31 |
+
]
|
32 |
+
);
|
33 |
+
}
|
34 |
+
|
35 |
+
$this->setTargetPathByLanguageAndStore($project->getStoreviewSrcLocale(), $project->getStoreviewSrc());
|
36 |
+
|
37 |
+
return $this;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @param bool $printQuery
|
42 |
+
* @param bool $logQuery
|
43 |
+
* @return $this
|
44 |
+
*/
|
45 |
+
public function loadData($printQuery = false, $logQuery = false)
|
46 |
+
{
|
47 |
+
if (!$this->getLanguage()) {
|
48 |
+
Mage::throwException('Please set language before loading!');
|
49 |
+
}
|
50 |
+
|
51 |
+
$this->setFilesFilter('#^[a-zA-Z0-9_]+\.csv$#');
|
52 |
+
$this->setDisallowedFilesFilter(false);
|
53 |
+
/** @var Eurotext_TranslationManager_Model_Resource_Csv_Collection $collection */
|
54 |
+
$collection = parent::loadData($printQuery, $logQuery);
|
55 |
+
|
56 |
+
return $collection;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
private function getLanguage()
|
63 |
+
{
|
64 |
+
return $this->language;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @param string $language
|
69 |
+
* @return $this
|
70 |
+
*/
|
71 |
+
public function setTargetPathByLanguageAndStore($language, $store)
|
72 |
+
{
|
73 |
+
$this->language = $language;
|
74 |
+
|
75 |
+
$localePath = dirname(
|
76 |
+
Mage::getModel('core/design_package')
|
77 |
+
->setStore($store)
|
78 |
+
->getLocaleFileName('translate.csv')
|
79 |
+
);
|
80 |
+
|
81 |
+
$this->addTargetDir(Mage::getBaseDir('locale') . DS . $language);
|
82 |
+
if (is_dir($localePath)) {
|
83 |
+
$this->addTargetDir($localePath);
|
84 |
+
}
|
85 |
+
|
86 |
+
return $this;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param int $size
|
91 |
+
* @return $this
|
92 |
+
*/
|
93 |
+
public function setPageSize($size)
|
94 |
+
{
|
95 |
+
/** @var $thisCollection $this */
|
96 |
+
$thisCollection = parent::setPageSize($size + 1);
|
97 |
+
|
98 |
+
return $thisCollection;
|
99 |
+
}
|
100 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Eav_Attribute_Label extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('eav/attribute_label', 'attribute_label_id');
|
8 |
+
}
|
9 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Eav_Attribute_Label_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/eav_attribute_label');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Eav_Attribute_Option_Value extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('eav/attribute_option_value', 'value_id');
|
8 |
+
}
|
9 |
+
}
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Eav_Attribute_Option_Value_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('eurotext_translationmanager/eav_attribute_option_value');
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param int $id
|
12 |
+
*/
|
13 |
+
public function filterByAttribute($id)
|
14 |
+
{
|
15 |
+
$this->join(['option_table' => 'eav/attribute_option'], 'option_table.option_id=main_table.option_id', '');
|
16 |
+
$this->addFieldToFilter('option_table.attribute_id', $id);
|
17 |
+
}
|
18 |
+
|
19 |
+
public function joinStoreLabel($storeId)
|
20 |
+
{
|
21 |
+
$this->addFieldToFilter('main_table.store_id', Mage_Core_Model_App::ADMIN_STORE_ID);
|
22 |
+
$this->getSelect()->joinLeft(
|
23 |
+
['store_label' => $this->getMainTable()],
|
24 |
+
"main_table.option_id = store_label.option_id AND store_label.store_id = $storeId",
|
25 |
+
['store_value' => 'store_label.value']
|
26 |
+
);
|
27 |
+
}
|
28 |
+
}
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Emailtemplate_Filesystem_Collection
|
4 |
+
extends Eurotext_TranslationManager_Model_Resource_Filesystem_Collection
|
5 |
+
{
|
6 |
+
/**
|
7 |
+
* @var string
|
8 |
+
*/
|
9 |
+
private $language;
|
10 |
+
|
11 |
+
protected $_allowedFilesMask = '/^[\S0-9\.\-\_]+\.[a-z0-9]+$/i';
|
12 |
+
|
13 |
+
public function loadData($printQuery = false, $logQuery = false)
|
14 |
+
{
|
15 |
+
if (!$this->getLanguage()) {
|
16 |
+
Mage::throwException('Please set language before loading!');
|
17 |
+
}
|
18 |
+
$this->addTargetDir(Mage::getBaseDir('locale') . '/' . $this->getLanguage() . '/template');
|
19 |
+
|
20 |
+
return parent::loadData($printQuery, $logQuery);
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @return string
|
25 |
+
*/
|
26 |
+
public function getLanguage()
|
27 |
+
{
|
28 |
+
return $this->language;
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @param string $language
|
33 |
+
* @return $this
|
34 |
+
*/
|
35 |
+
public function setLanguage($language)
|
36 |
+
{
|
37 |
+
$this->language = $language;
|
38 |
+
|
39 |
+
return $this;
|
40 |
+
}
|
41 |
+
}
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Filesystem_Collection extends Varien_Data_Collection_Filesystem
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Eurotext_TranslationManager_Model_Renderer_Filesystem[]
|
7 |
+
*/
|
8 |
+
private $renderers;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param Eurotext_TranslationManager_Model_Renderer_Filesystem $renderer
|
12 |
+
* @return $this
|
13 |
+
*/
|
14 |
+
public function addRenderer(Eurotext_TranslationManager_Model_Renderer_Filesystem $renderer)
|
15 |
+
{
|
16 |
+
$this->renderers[] = $renderer;
|
17 |
+
|
18 |
+
return $this;
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param string $filename
|
23 |
+
* @return string[]
|
24 |
+
*/
|
25 |
+
protected function _generateRow($filename)
|
26 |
+
{
|
27 |
+
$file = [
|
28 |
+
'filename' => $filename,
|
29 |
+
'basename' => basename($filename),
|
30 |
+
];
|
31 |
+
|
32 |
+
if (!count($this->renderers)) {
|
33 |
+
return $file;
|
34 |
+
}
|
35 |
+
|
36 |
+
foreach ($this->renderers as $renderer) {
|
37 |
+
$file[$renderer->getKey()] = $renderer->render($filename);
|
38 |
+
}
|
39 |
+
|
40 |
+
return $file;
|
41 |
+
}
|
42 |
+
}
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var mixed[]
|
7 |
+
*/
|
8 |
+
private $relations = [
|
9 |
+
'products' => [
|
10 |
+
'relation' => 'products',
|
11 |
+
'table' => 'eurotext_translationmanager/project_products',
|
12 |
+
'valueColumn' => 'product_id',
|
13 |
+
],
|
14 |
+
'categories' => [
|
15 |
+
'relation' => 'categories',
|
16 |
+
'table' => 'eurotext_translationmanager/project_categories',
|
17 |
+
'valueColumn' => 'category_id',
|
18 |
+
],
|
19 |
+
'blocks' => [
|
20 |
+
'relation' => 'blocks',
|
21 |
+
'table' => 'eurotext_translationmanager/project_cmsblocks',
|
22 |
+
'valueColumn' => 'block_id',
|
23 |
+
],
|
24 |
+
'pages' => [
|
25 |
+
'relation' => 'pages',
|
26 |
+
'table' => 'eurotext_translationmanager/project_cmspages',
|
27 |
+
'valueColumn' => 'page_id',
|
28 |
+
],
|
29 |
+
'translation_files' => [
|
30 |
+
'relation' => 'translation_files',
|
31 |
+
'table' => 'eurotext_translationmanager/project_csv',
|
32 |
+
'valueColumn' => 'filename',
|
33 |
+
],
|
34 |
+
'transaction_email_files' => [
|
35 |
+
'relation' => 'transaction_email_files',
|
36 |
+
'table' => 'eurotext_translationmanager/project_emailtemplate_files',
|
37 |
+
'valueColumn' => 'filename',
|
38 |
+
],
|
39 |
+
'transaction_email_database' => [
|
40 |
+
'relation' => 'transaction_email_database',
|
41 |
+
'table' => 'eurotext_translationmanager/project_emailtemplate_database',
|
42 |
+
'valueColumn' => 'emailtemplate_id',
|
43 |
+
],
|
44 |
+
];
|
45 |
+
|
46 |
+
protected function _construct()
|
47 |
+
{
|
48 |
+
$this->_init('eurotext_translationmanager/project', 'id');
|
49 |
+
}
|
50 |
+
|
51 |
+
public function addAllRelationalData(Eurotext_TranslationManager_Model_Project $project)
|
52 |
+
{
|
53 |
+
if ($project->isObjectNew()) {
|
54 |
+
$this->setRelationsWithEmptyArray($project);
|
55 |
+
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
+
$selects = [];
|
60 |
+
foreach ($this->relations as $relation) {
|
61 |
+
$selects[] = $this->buildQueryForRelation($project, $relation);
|
62 |
+
}
|
63 |
+
|
64 |
+
$queryToIncreaseGroupConcat = 'SET SESSION group_concat_max_len = 100000;';
|
65 |
+
// TODO query einzeln machen, prüfen ob funktioniert, wenn nicht => Error in critical log und Info an Kunden
|
66 |
+
$mainSelect = $this->getReadConnection()->select();
|
67 |
+
$mainSelect->union($selects);
|
68 |
+
$mainSelect = $queryToIncreaseGroupConcat . (string)$mainSelect;
|
69 |
+
|
70 |
+
/** @var $results Varien_Db_Statement_Pdo_Mysql[] */
|
71 |
+
$results = $this->_getWriteAdapter()->multiQuery($mainSelect);
|
72 |
+
|
73 |
+
$this->addRelationDataToProject($project, $results[1]->fetchAll());
|
74 |
+
}
|
75 |
+
|
76 |
+
protected function _afterSave(Mage_Core_Model_Abstract $project)
|
77 |
+
{
|
78 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
79 |
+
foreach ($this->relations as $name => $info) {
|
80 |
+
$this->saveDifferenceFor($name, $project);
|
81 |
+
}
|
82 |
+
|
83 |
+
return parent::_afterSave($project);
|
84 |
+
}
|
85 |
+
|
86 |
+
private function saveDifferenceFor($relation, Eurotext_TranslationManager_Model_Project $project)
|
87 |
+
{
|
88 |
+
$origData = $project->getOrigData($relation) ?: [];
|
89 |
+
$newData = $project->getData($relation);
|
90 |
+
|
91 |
+
if (!is_array($origData) || !is_array($newData)) {
|
92 |
+
return;
|
93 |
+
}
|
94 |
+
|
95 |
+
$relationInfo = $this->relations[$relation];
|
96 |
+
|
97 |
+
$toDelete = array_unique(array_diff($origData, $newData));
|
98 |
+
if ($toDelete) {
|
99 |
+
$this->deleteRelations($toDelete, $project, $relationInfo);
|
100 |
+
}
|
101 |
+
|
102 |
+
$toAdd = array_unique(array_diff($newData, $origData));
|
103 |
+
if ($toAdd) {
|
104 |
+
$this->addRelations($toAdd, $project, $relationInfo);
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* @param mixed[] $toDelete
|
110 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
111 |
+
* @param string[] $tableData
|
112 |
+
*/
|
113 |
+
private function deleteRelations($toDelete, Eurotext_TranslationManager_Model_Project $project, array $tableData)
|
114 |
+
{
|
115 |
+
$adapter = $this->_getWriteAdapter();
|
116 |
+
$where = $adapter->quoteInto($tableData['valueColumn'] . ' IN (?) ', $toDelete);
|
117 |
+
$where .= $adapter->quoteInto('AND project_id = ?', $project->getId());
|
118 |
+
$adapter->delete($this->getTable($tableData['table']), $where);
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* @param mixed[] $toAdd
|
123 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
124 |
+
* @param string[] $tableData
|
125 |
+
*/
|
126 |
+
private function addRelations($toAdd, Eurotext_TranslationManager_Model_Project $project, array $tableData)
|
127 |
+
{
|
128 |
+
$columnToFill = $tableData['valueColumn'];
|
129 |
+
|
130 |
+
$valuesToSave = array_map(
|
131 |
+
function ($value) use ($project, $columnToFill) {
|
132 |
+
return [
|
133 |
+
'project_id' => $project->getId(),
|
134 |
+
$columnToFill => $value,
|
135 |
+
];
|
136 |
+
},
|
137 |
+
$toAdd
|
138 |
+
);
|
139 |
+
$this->_getWriteAdapter()->insertMultiple($this->getTable($tableData['table']), $valuesToSave);
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
144 |
+
* @param string $relation
|
145 |
+
* @return Zend_Db_Select
|
146 |
+
*/
|
147 |
+
private function buildQueryForRelation(Eurotext_TranslationManager_Model_Project $project, $relation)
|
148 |
+
{
|
149 |
+
$select = $this->getReadConnection()->select();
|
150 |
+
$select->from(
|
151 |
+
$this->getTable($relation['table']),
|
152 |
+
new Zend_Db_Expr(
|
153 |
+
"'{$relation['relation']}' AS 'relation', GROUP_CONCAT(`{$relation['valueColumn']}`) AS 'ids'"
|
154 |
+
)
|
155 |
+
);
|
156 |
+
$select->where('project_id = ?', $project->getId());
|
157 |
+
|
158 |
+
return $select;
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
163 |
+
* @param mixed[] $result
|
164 |
+
*/
|
165 |
+
private function addRelationDataToProject(Eurotext_TranslationManager_Model_Project $project, $result)
|
166 |
+
{
|
167 |
+
foreach ($result as $row) {
|
168 |
+
$project->setData($row['relation'], []);
|
169 |
+
$project->setOrigData($row['relation'], []);
|
170 |
+
if ($row['ids']) {
|
171 |
+
$project->setData($row['relation'], explode(',', $row['ids']));
|
172 |
+
$project->setOrigData($row['relation'], explode(',', $row['ids']));
|
173 |
+
}
|
174 |
+
}
|
175 |
+
$project->setDataChanges(false);
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
180 |
+
*/
|
181 |
+
private function setRelationsWithEmptyArray(Eurotext_TranslationManager_Model_Project $project)
|
182 |
+
{
|
183 |
+
foreach ($this->relations as $relation) {
|
184 |
+
$project->setData($relation['relation'], []);
|
185 |
+
}
|
186 |
+
}
|
187 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_Category extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_categories', 'project_category_id');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_Category_Collection
|
4 |
+
extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
5 |
+
{
|
6 |
+
|
7 |
+
protected function _construct()
|
8 |
+
{
|
9 |
+
$this->_init('eurotext_translationmanager/project_category');
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_Cmsblock extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_cmsblocks', 'project_cmsblock_id');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_Cmsblock_Collection
|
4 |
+
extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
5 |
+
{
|
6 |
+
|
7 |
+
protected function _construct()
|
8 |
+
{
|
9 |
+
$this->_init('eurotext_translationmanager/project_cmsblock');
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_Cmspage extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_cmspages', 'project_cmspage_id');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_Cmspage_Collection
|
4 |
+
extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
5 |
+
{
|
6 |
+
|
7 |
+
protected function _construct()
|
8 |
+
{
|
9 |
+
$this->_init('eurotext_translationmanager/project_cmspage');
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_Collection
|
4 |
+
extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
5 |
+
{
|
6 |
+
|
7 |
+
protected function _construct()
|
8 |
+
{
|
9 |
+
$this->_init('eurotext_translationmanager/project');
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_Csv extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('eurotext_translationmanager/project_csv', 'line_hash');
|
8 |
+
}
|
9 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_Csv_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('eurotext_translationmanager/project_csv');
|
8 |
+
}
|
9 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_EmailtemplateDatabase extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_emailtemplate_database', 'emailtemplate_database_id');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_EmailtemplateDatabase_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_emailtemplateDatabase');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_EmailtemplateFile extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('eurotext_translationmanager/project_emailtemplate_files', 'project_emailtemplates_id');
|
8 |
+
}
|
9 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_EmailtemplateFile_Collection
|
4 |
+
extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
5 |
+
{
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_emailtemplateFile');
|
9 |
+
}
|
10 |
+
}
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_Import extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('eurotext_translationmanager/project_import', 'import_id');
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @param int $id
|
12 |
+
*/
|
13 |
+
public function deleteByProjectId($id)
|
14 |
+
{
|
15 |
+
$this->_getConnection('core_write')->delete(
|
16 |
+
$this->getMainTable(),
|
17 |
+
$this->getReadConnection()->quoteInto('project_id = ?', $id)
|
18 |
+
);
|
19 |
+
}
|
20 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_Import_Collection
|
4 |
+
extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
5 |
+
{
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_import');
|
9 |
+
}
|
10 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_Product extends Mage_Core_Model_Resource_Db_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_products', 'project_product_id');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Resource_Project_Product_Collection
|
4 |
+
extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
5 |
+
{
|
6 |
+
protected function _construct()
|
7 |
+
{
|
8 |
+
$this->_init('eurotext_translationmanager/project_product');
|
9 |
+
}
|
10 |
+
}
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Source_StoreViewWithLocale
|
4 |
+
{
|
5 |
+
private $options = [];
|
6 |
+
|
7 |
+
public function toOptionArray()
|
8 |
+
{
|
9 |
+
if ($this->options) {
|
10 |
+
return $this->options;
|
11 |
+
}
|
12 |
+
$stores = Mage::getResourceModel('core/store_collection')
|
13 |
+
->load();
|
14 |
+
|
15 |
+
$options = [];
|
16 |
+
|
17 |
+
foreach ($stores as $store) {
|
18 |
+
$language = Mage::getStoreConfig('general/locale/code', $store);
|
19 |
+
$options[] =
|
20 |
+
[
|
21 |
+
'label' => sprintf('%s (%s)', $store->getName(), $language),
|
22 |
+
'value' => $store->getId()
|
23 |
+
];
|
24 |
+
}
|
25 |
+
$this->options = $options;
|
26 |
+
|
27 |
+
return $this->options;
|
28 |
+
}
|
29 |
+
}
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_System_Config_Source_Salutation
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @return mixed∆[]
|
7 |
+
*/
|
8 |
+
public function toOptionArray()
|
9 |
+
{
|
10 |
+
$helper = Mage::helper('eurotext_translationmanager');
|
11 |
+
|
12 |
+
return [
|
13 |
+
['value' => 'MR', 'label' => $helper->__('Mr.')],
|
14 |
+
['value' => 'MRS', 'label' => $helper->__('Mrs.')],
|
15 |
+
];
|
16 |
+
}
|
17 |
+
}
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Updater_MediaGalleryValue
|
4 |
+
{
|
5 |
+
public function update(Mage_Catalog_Model_Product $product, $imgValueId, $imgLabel, $imgPosition, $imgDisabled)
|
6 |
+
{
|
7 |
+
$attributes = $product->getTypeInstance(true)->getSetAttributes($product);
|
8 |
+
$images = $product->getMediaGalleryImages();
|
9 |
+
$mediaGalleryBackendModel = $attributes['media_gallery']->getBackend();
|
10 |
+
$image = $images->getItemById($imgValueId);
|
11 |
+
if (!$image) {
|
12 |
+
return;
|
13 |
+
}
|
14 |
+
/** @var Mage_Catalog_Model_Product_Attribute_Backend_Media $mediaGalleryBackendModel */
|
15 |
+
$mediaGalleryBackendModel->updateImage(
|
16 |
+
$product,
|
17 |
+
$image->getFile(),
|
18 |
+
['label' => $imgLabel, 'position' => $imgPosition, 'disabled' => $imgDisabled]
|
19 |
+
);
|
20 |
+
|
21 |
+
}
|
22 |
+
}
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Xml_Import_Cms_Block extends Varien_Object
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Model_Xml_Import_Cms_BlockReader implements IteratorAggregate
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var SimpleXMLElement
|
7 |
+
*/
|
8 |
+
private $domDocument;
|
9 |
+
|
10 |
+
private $intNodes = array(
|
11 |
+
'StoreviewSrc',
|
12 |
+
'StoreviewDst',
|
13 |
+
'Id',
|
14 |
+
);
|
15 |
+
|
16 |
+
public function __construct($xmlFile)
|
17 |
+
{
|
18 |
+
$xmlFile = array_pop($xmlFile);
|
19 |
+
if (!is_file($xmlFile)) {
|
20 |
+
Mage::throwException(sprintf('XML file with name "%s" not found.', $xmlFile));
|
21 |
+
}
|
22 |
+
$this->domDocument = new DOMDocument();
|
23 |
+
$this->domDocument->loadXML(file_get_contents($xmlFile));
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @return Eurotext_TranslationManager_Model_Xml_Import_Cms_Block[]
|
28 |
+
*/
|
29 |
+
private function getCmsBlocks()
|
30 |
+
{
|
31 |
+
|
32 |
+
$xmlBlocks = $this->domDocument->getElementsByTagName('cms-site');
|
33 |
+
$blocks = array();
|
34 |
+
/** @var $xmlBlock DOMElement */
|
35 |
+
foreach ($xmlBlocks as $xmlBlock) {
|
36 |
+
$block = Mage::getModel('eurotext_translationmanager/xml_import_cms_block');
|
37 |
+
/** @var $node DOMElement */
|
38 |
+
foreach ($xmlBlock->childNodes as $node) {
|
39 |
+
if ($node->nodeType != XML_ELEMENT_NODE) {
|
40 |
+
continue;
|
41 |
+
}
|
42 |
+
|
43 |
+
$nodeName = $node->nodeName;
|
44 |
+
$nodeValue = (string)$node->textContent;
|
45 |
+
|
46 |
+
if (in_array($nodeName, $this->intNodes)) {
|
47 |
+
$block->$nodeName = (int)$nodeValue;
|
48 |
+
} else {
|
49 |
+
$block->$nodeName = $nodeValue;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
$blocks[] = $block;
|
54 |
+
}
|
55 |
+
|
56 |
+
return $blocks;
|
57 |
+
}
|
58 |
+
|
59 |
+
public function getIterator()
|
60 |
+
{
|
61 |
+
return new ArrayIterator($this->getCmsBlocks());
|
62 |
+
}
|
63 |
+
}
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Adminhtml_Eurotext_HelpController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
$this->loadLayout();
|
8 |
+
$this->renderLayout();
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @return bool
|
13 |
+
*/
|
14 |
+
protected function _isAllowed()
|
15 |
+
{
|
16 |
+
return Mage::getSingleton('admin/session')->isAllowed('eurotext_translationmanager/help');
|
17 |
+
}
|
18 |
+
}
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Adminhtml_Eurotext_Project_ExportController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
try {
|
8 |
+
$project = $this->getProject($this->getRequest()->getParam('project_id'));
|
9 |
+
if (!$project->isExportable()) {
|
10 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
11 |
+
$this->__('Project was already exported! Can\'t export it again.')
|
12 |
+
);
|
13 |
+
$this->_redirect('*/eurotext_project/edit', ['project_id' => $project->getId()]);
|
14 |
+
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
Mage::register('project', $project);
|
18 |
+
} catch (Mage_Core_Exception $e) {
|
19 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
20 |
+
$this->_redirect('*/eurotext_project/index');
|
21 |
+
|
22 |
+
return;
|
23 |
+
}
|
24 |
+
|
25 |
+
$this->loadLayout();
|
26 |
+
$this->renderLayout();
|
27 |
+
}
|
28 |
+
|
29 |
+
public function exportAction()
|
30 |
+
{
|
31 |
+
$this->loadLayout('adminhtml_eurotext_translationmanager_ajax');
|
32 |
+
|
33 |
+
$response = $this->getResponse();
|
34 |
+
$response->setHeader('Content-type', 'application/json', true);
|
35 |
+
|
36 |
+
/** @var $block Eurotext_TranslationManager_Block_Response_Ajax */
|
37 |
+
$block = $this->getLayout()->getBlock('et.tm.response.ajax');
|
38 |
+
|
39 |
+
$request = $this->getRequest();
|
40 |
+
$step = intval($request->getParam("step"));
|
41 |
+
$offset = intval($request->getParam("offset"));
|
42 |
+
$project_id = intval($request->getParam("project_id"));
|
43 |
+
|
44 |
+
$project = $this->getProject($project_id);
|
45 |
+
|
46 |
+
$block->setStatusMsg($this->__("Please wait …"));
|
47 |
+
$block->setStatusCode("ok");
|
48 |
+
$block->setStep($step);
|
49 |
+
$block->setFinished(false);
|
50 |
+
try {
|
51 |
+
Mage::getModel('eurotext_translationmanager/export_project')->export($step, $block, $project, $offset);
|
52 |
+
} catch (Exception $e) {
|
53 |
+
$block->setStatusCode("error");
|
54 |
+
$block->setStatusMsg($e->getMessage());
|
55 |
+
}
|
56 |
+
$response->setBody($block->toJson());
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @param int $projectId
|
61 |
+
* @return Eurotext_TranslationManager_Model_Project
|
62 |
+
*/
|
63 |
+
private function getProject($projectId)
|
64 |
+
{
|
65 |
+
return Mage::helper('eurotext_translationmanager/project')->getProject($projectId);
|
66 |
+
}
|
67 |
+
}
|
@@ -0,0 +1,387 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Adminhtml_Eurotext_Project_ImportController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Eurotext_TranslationManager_Helper_Data
|
7 |
+
*/
|
8 |
+
private $helper;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var Eurotext_TranslationManager_Helper_Eurotext
|
12 |
+
*/
|
13 |
+
private $eurotextHelper;
|
14 |
+
|
15 |
+
protected function _construct()
|
16 |
+
{
|
17 |
+
parent::_construct();
|
18 |
+
$this->helper = Mage::helper('eurotext_translationmanager');
|
19 |
+
$this->eurotextHelper = Mage::helper('eurotext_translationmanager/eurotext');
|
20 |
+
}
|
21 |
+
|
22 |
+
public function importAction()
|
23 |
+
{
|
24 |
+
try {
|
25 |
+
$tmpDir = $this->getTempDirectory();
|
26 |
+
$this->cleanUp($tmpDir);
|
27 |
+
|
28 |
+
$filename = $this->checkAndMoveZipFileInto($tmpDir);
|
29 |
+
$this->saveFilenameToSession($filename);
|
30 |
+
$this->saveProjectIdToSession();
|
31 |
+
$this->getResponse()->setBody(
|
32 |
+
Mage::helper('core')->jsonEncode(
|
33 |
+
array_merge(
|
34 |
+
$_REQUEST,
|
35 |
+
['importExtractUrl' => $this->getUrl('*/eurotext_project_import/importExtract')]
|
36 |
+
)
|
37 |
+
)
|
38 |
+
);
|
39 |
+
|
40 |
+
return;
|
41 |
+
} catch (Exception $e) {
|
42 |
+
$message = $this->getHelper()->__("Error Message: %s", $e->getMessage());
|
43 |
+
$this->setWarningAndRedirect($message);
|
44 |
+
|
45 |
+
return;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
public function importExtractAction()
|
50 |
+
{
|
51 |
+
$tmpdir = $this->getTempDirectory();
|
52 |
+
try {
|
53 |
+
$zipFilename = $this->getFilenameFromSession();
|
54 |
+
if (!$zipFilename) {
|
55 |
+
$this->setWarningAndRedirect(
|
56 |
+
$this->getHelper()->__('ZIP File not found for project %s', $this->getProjectIdFromSession())
|
57 |
+
);
|
58 |
+
|
59 |
+
return;
|
60 |
+
}
|
61 |
+
Mage::getModel('eurotext_translationmanager/extractor')->extract($zipFilename, $tmpdir);
|
62 |
+
$project = Mage::getModel('eurotext_translationmanager/project');
|
63 |
+
$project->load($this->getProjectIdFromSession());
|
64 |
+
$project->setProjectStatus(
|
65 |
+
Eurotext_TranslationManager_Model_Project::STATUS_IMPORT_TRANSLATIONS_INTO_QUEUE
|
66 |
+
);
|
67 |
+
$project->save();
|
68 |
+
$this->_redirect('*/*/importParse');
|
69 |
+
|
70 |
+
return;
|
71 |
+
} catch (Exception $e) {
|
72 |
+
$this->setWarningAndRedirect(
|
73 |
+
$this->getHelper()->__(
|
74 |
+
'ZIP File "%s" could not be extracted for project %s',
|
75 |
+
$e->getMessage(),
|
76 |
+
$this->getProjectIdFromSession()
|
77 |
+
)
|
78 |
+
);
|
79 |
+
|
80 |
+
return;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
public function importParseAction()
|
85 |
+
{
|
86 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
87 |
+
$project = Mage::getModel('eurotext_translationmanager/project')->load($this->getProjectIdFromSession());
|
88 |
+
Mage::register('project', $project);
|
89 |
+
|
90 |
+
if (!$project->isImportFileLoaded()) {
|
91 |
+
$session = Mage::getSingleton('adminhtml/session');
|
92 |
+
if ($project->isDone()) {
|
93 |
+
$session->addError($this->getHelper()->__('Project already imported. Can\'t import again.'));
|
94 |
+
} elseif ($project->isExportable()) {
|
95 |
+
$session->addError($this->getHelper()->__('Project was not exported yet, please export first!'));
|
96 |
+
}
|
97 |
+
$this->_redirect('*/eurotext_project/edit', ['project_id' => $project->getId()]);
|
98 |
+
|
99 |
+
return;
|
100 |
+
}
|
101 |
+
$this->loadLayout();
|
102 |
+
$this->renderLayout();
|
103 |
+
}
|
104 |
+
|
105 |
+
public function addFilesToImportQueueAction()
|
106 |
+
{
|
107 |
+
$this->getResponse()->setHeader('Content-type', 'application/json', true);
|
108 |
+
|
109 |
+
$controlFile = $this->getTempDirectory() . DIRECTORY_SEPARATOR . "control.xml";
|
110 |
+
$projectId = $this->getProjectIdFromSession();
|
111 |
+
try {
|
112 |
+
Mage::getModel('eurotext_translationmanager/import_validator')->validate($projectId, $controlFile);
|
113 |
+
} catch (Exception $e) {
|
114 |
+
$message = $e->getMessage();
|
115 |
+
$this->setAjaxError($message);
|
116 |
+
|
117 |
+
return;
|
118 |
+
}
|
119 |
+
|
120 |
+
$project = $this->getProject($projectId);
|
121 |
+
|
122 |
+
/** @var $queue Eurotext_TranslationManager_Model_Import_Queue */
|
123 |
+
$queue = Mage::getModel('eurotext_translationmanager/import_queue');
|
124 |
+
|
125 |
+
$queue->cleanUpQueueFor($project);
|
126 |
+
$this->resetProcessedFiles();
|
127 |
+
$queue->addControlXmlToQueue($project, $controlFile);
|
128 |
+
|
129 |
+
$filesAddedToTheQueue = $queue->getFilesAddedToTheQueue();
|
130 |
+
|
131 |
+
$this->setFilesAddedToQueueOnSession($filesAddedToTheQueue);
|
132 |
+
$message = $this->getHelper()->__('Added %s files to the import queue.', $filesAddedToTheQueue);
|
133 |
+
|
134 |
+
$this->addNoteToResponse($message);
|
135 |
+
}
|
136 |
+
|
137 |
+
public function processFilesFromQueueAction()
|
138 |
+
{
|
139 |
+
$this->getResponse()->setHeader('Content-type', 'application/json', true);
|
140 |
+
try {
|
141 |
+
$project = $this->getProject($this->getProjectIdFromSession());
|
142 |
+
$importer = Mage::getModel('eurotext_translationmanager/import_project');
|
143 |
+
$importer->import($project);
|
144 |
+
$skipped = $importer->getSkippedEntities();
|
145 |
+
|
146 |
+
$this->logSkippedEntities($skipped);
|
147 |
+
$filesProcessed = $this->getAndIncreaseFilesProcessed();
|
148 |
+
$filesAddedToQueueFromSession = $this->getFilesAddedToQueueFromSession();
|
149 |
+
|
150 |
+
$message = $this->getHelper()->__(
|
151 |
+
'File %s processed of %s.',
|
152 |
+
$filesProcessed,
|
153 |
+
$filesAddedToQueueFromSession
|
154 |
+
);
|
155 |
+
|
156 |
+
if (count(array_filter($skipped))) {
|
157 |
+
$message = $this->getHelper()->__(
|
158 |
+
'File %s processed of %s. Skipped %s: IDs %s (because they were deleted since export)',
|
159 |
+
$filesProcessed,
|
160 |
+
$filesAddedToQueueFromSession,
|
161 |
+
$this->getHelper()->__(key($skipped)),
|
162 |
+
current($skipped) ? implode(', ', current($skipped)) : $this->getHelper()->__('none')
|
163 |
+
);
|
164 |
+
}
|
165 |
+
|
166 |
+
$this->addNoteToResponse($message);
|
167 |
+
|
168 |
+
if ($project->isDone()) {
|
169 |
+
$this->getResponse()->setBody(
|
170 |
+
json_encode(
|
171 |
+
[
|
172 |
+
'class' => 'success', 'message' => 'Finished loading language files.',
|
173 |
+
'continueImport' => false,
|
174 |
+
]
|
175 |
+
)
|
176 |
+
);
|
177 |
+
}
|
178 |
+
} catch (Exception $e) {
|
179 |
+
$this->setAjaxError($e->getMessage());
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* @param string $directory
|
185 |
+
*/
|
186 |
+
public function cleanUp($directory)
|
187 |
+
{
|
188 |
+
Mage::helper('eurotext_translationmanager/filesystem')->deleteDirectoryRecursively($directory);
|
189 |
+
$this->createDirectory($directory);
|
190 |
+
$this->createHtaccessFile($directory);
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* @return Eurotext_TranslationManager_Helper_Eurotext
|
195 |
+
*/
|
196 |
+
protected function getEurotextHelper()
|
197 |
+
{
|
198 |
+
return $this->eurotextHelper;
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* @return string
|
203 |
+
*/
|
204 |
+
private function getTempDirectory()
|
205 |
+
{
|
206 |
+
$dir = Mage::getBaseDir('tmp') . '/eurotext';
|
207 |
+
|
208 |
+
return $dir;
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* @param string $dir
|
213 |
+
*/
|
214 |
+
private function createDirectory($dir)
|
215 |
+
{
|
216 |
+
if (is_dir($dir)) {
|
217 |
+
return;
|
218 |
+
}
|
219 |
+
|
220 |
+
if (!mkdir($dir)) {
|
221 |
+
$baseDir = Mage::getBaseDir('var');
|
222 |
+
$this->getHelper()->log('Temporary directory could not be created in ' . $baseDir, Zend_Log::CRIT);
|
223 |
+
throw new Magento_Exception('Eurotext temporary directory could not be created.');
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* @return Eurotext_TranslationManager_Helper_Data
|
229 |
+
*/
|
230 |
+
private function getHelper()
|
231 |
+
{
|
232 |
+
return $this->helper;
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* @param string $dir
|
237 |
+
*/
|
238 |
+
private function createHtaccessFile($dir)
|
239 |
+
{
|
240 |
+
$htaccessFilename = $dir . DS . ".htaccess";
|
241 |
+
if (!is_file($htaccessFilename)) {
|
242 |
+
file_put_contents($htaccessFilename, "# Eurotext Temp folder\r\nOrder Deny,Allow\r\nDeny From All");
|
243 |
+
}
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* @param string $tmpDir
|
248 |
+
*
|
249 |
+
* @return string
|
250 |
+
*/
|
251 |
+
private function checkAndMoveZipFileInto($tmpDir)
|
252 |
+
{
|
253 |
+
$uploader = new Varien_File_Uploader('translation_file');
|
254 |
+
$uploader->setAllowedExtensions(['zip']);
|
255 |
+
$uploader->setAllowCreateFolders(true);
|
256 |
+
$uploader->setAllowRenameFiles(false);
|
257 |
+
$uploader->setFilesDispersion(false);
|
258 |
+
$uploader->save($tmpDir, $uploader->getUploadedFileName()); //save the file on the specified path
|
259 |
+
|
260 |
+
return $tmpDir . DS . $uploader->getUploadedFileName();
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* @param string $filename
|
265 |
+
*/
|
266 |
+
private function saveFilenameToSession($filename)
|
267 |
+
{
|
268 |
+
Mage::getSingleton('adminhtml/session')->setData('import_filename', $filename);
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* @param string $message
|
273 |
+
*/
|
274 |
+
private function setWarningAndRedirect($message)
|
275 |
+
{
|
276 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
277 |
+
$this->_redirect('*/eurotext_project/index');
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
* @return string
|
282 |
+
*/
|
283 |
+
private function getFilenameFromSession()
|
284 |
+
{
|
285 |
+
return Mage::getSingleton('adminhtml/session')->getData('import_filename');
|
286 |
+
}
|
287 |
+
|
288 |
+
private function saveProjectIdToSession()
|
289 |
+
{
|
290 |
+
Mage::getSingleton('adminhtml/session')->setData('project_id', $this->getRequest()->getParam('project_id'));
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* @return int
|
295 |
+
*/
|
296 |
+
private function getProjectIdFromSession()
|
297 |
+
{
|
298 |
+
return Mage::getSingleton('adminhtml/session')->getData('project_id');
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* @param $message
|
303 |
+
*/
|
304 |
+
private function setAjaxError($message)
|
305 |
+
{
|
306 |
+
$this->getResponse()->setHttpResponseCode(400);
|
307 |
+
$this->getResponse()->setBody(
|
308 |
+
json_encode(['class' => 'error', 'message' => $this->getHelper()->__($message), 'continueImport' => false])
|
309 |
+
);
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* @param int $projectId
|
314 |
+
*
|
315 |
+
* @return Eurotext_TranslationManager_Model_Project
|
316 |
+
*/
|
317 |
+
private function getProject($projectId)
|
318 |
+
{
|
319 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
320 |
+
$project = Mage::getModel('eurotext_translationmanager/project')->load($projectId);
|
321 |
+
|
322 |
+
return $project;
|
323 |
+
}
|
324 |
+
|
325 |
+
/**
|
326 |
+
* @param $message
|
327 |
+
*/
|
328 |
+
private function addNoteToResponse($message)
|
329 |
+
{
|
330 |
+
$this->getResponse()->setBody(
|
331 |
+
json_encode(['class' => 'ok', 'message' => $message, 'continueImport' => true])
|
332 |
+
);
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* @param int $filesAddedToTheQueue
|
337 |
+
*/
|
338 |
+
private function setFilesAddedToQueueOnSession($filesAddedToTheQueue)
|
339 |
+
{
|
340 |
+
Mage::getSingleton('adminhtml/session')->setData('import_files', $filesAddedToTheQueue);
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* @return int
|
345 |
+
*/
|
346 |
+
private function getFilesAddedToQueueFromSession()
|
347 |
+
{
|
348 |
+
return Mage::getSingleton('adminhtml/session')->getData('import_files');
|
349 |
+
}
|
350 |
+
|
351 |
+
/**
|
352 |
+
* @return int
|
353 |
+
*/
|
354 |
+
private function getAndIncreaseFilesProcessed()
|
355 |
+
{
|
356 |
+
$session = Mage::getSingleton('adminhtml/session');
|
357 |
+
/** @var $processed int */
|
358 |
+
$processed = $session->getData('processed_files');
|
359 |
+
$session->setData('processed_files', ++$processed);
|
360 |
+
|
361 |
+
return $processed;
|
362 |
+
}
|
363 |
+
|
364 |
+
private function resetProcessedFiles()
|
365 |
+
{
|
366 |
+
$session = Mage::getSingleton('adminhtml/session');
|
367 |
+
$session->setData('processed_files', 0);
|
368 |
+
}
|
369 |
+
|
370 |
+
/**
|
371 |
+
* @param mixed[] $skipped
|
372 |
+
*/
|
373 |
+
private function logSkippedEntities($skipped)
|
374 |
+
{
|
375 |
+
foreach ($skipped as $entity => $ids) {
|
376 |
+
if (!$ids) {
|
377 |
+
continue;
|
378 |
+
}
|
379 |
+
Mage::log(
|
380 |
+
sprintf('Entity %s could not be updated: %s', $entity, implode(', ', $ids)),
|
381 |
+
Zend_Log::WARN,
|
382 |
+
'eurotext_previously_deleted.log',
|
383 |
+
true
|
384 |
+
);
|
385 |
+
}
|
386 |
+
}
|
387 |
+
}
|
@@ -0,0 +1,462 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Adminhtml_Eurotext_ProjectController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
public function categoriesGridAction()
|
6 |
+
{
|
7 |
+
$this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
8 |
+
|
9 |
+
$categories = $this->getRequest()->getPost('categories', null);
|
10 |
+
$this->renderCategoryGrid($categories);
|
11 |
+
}
|
12 |
+
|
13 |
+
public function categoriesJsonAction()
|
14 |
+
{
|
15 |
+
/** @noinspection PhpAssignmentInConditionInspection */
|
16 |
+
if ($categoryId = (int)$this->getRequest()->getPost('id')) {
|
17 |
+
|
18 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
19 |
+
if ($category->getId()) {
|
20 |
+
Mage::register('category', $category);
|
21 |
+
Mage::register('current_category', $category);
|
22 |
+
}
|
23 |
+
$this->getResponse()->setBody(
|
24 |
+
$this->_getCategoryTreeBlock()->getTreeJson($category)
|
25 |
+
);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
public function categoriesTabAction()
|
30 |
+
{
|
31 |
+
$project = $this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
32 |
+
|
33 |
+
$this->renderCategoryGrid($project->getCategories());
|
34 |
+
}
|
35 |
+
|
36 |
+
public function cmsBlocksGridAction()
|
37 |
+
{
|
38 |
+
$this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
39 |
+
|
40 |
+
$cmsBlocks = $this->getRequest()->getPost('cmsBlocks', null);
|
41 |
+
$this->renderCmsBlockGrid($cmsBlocks);
|
42 |
+
}
|
43 |
+
|
44 |
+
public function cmsBlocksTabAction()
|
45 |
+
{
|
46 |
+
$project = $this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
47 |
+
|
48 |
+
$this->renderCmsBlockGrid($project->getBlocks());
|
49 |
+
}
|
50 |
+
|
51 |
+
public function cmsPagesGridAction()
|
52 |
+
{
|
53 |
+
$this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
54 |
+
|
55 |
+
$cmsPages = $this->getRequest()->getPost('cmsPages', null);
|
56 |
+
$this->renderCmsPageGrid($cmsPages);
|
57 |
+
}
|
58 |
+
|
59 |
+
public function cmsPagesTabAction()
|
60 |
+
{
|
61 |
+
$project = $this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
62 |
+
|
63 |
+
$this->renderCmsPageGrid($project->getPages());
|
64 |
+
}
|
65 |
+
|
66 |
+
public function deleteAction()
|
67 |
+
{
|
68 |
+
|
69 |
+
/** @noinspection PhpAssignmentInConditionInspection */
|
70 |
+
if ($id = $this->getRequest()->getParam('project_id')) {
|
71 |
+
/** @var $id int */
|
72 |
+
try {
|
73 |
+
|
74 |
+
$model = Mage::getModel('eurotext_translationmanager/project');
|
75 |
+
$model->load($id);
|
76 |
+
if (!$model->getId()) {
|
77 |
+
Mage::throwException($this->getHelper()->__('Unable to find a project with id "%s" to delete.', $id));
|
78 |
+
}
|
79 |
+
$model->delete();
|
80 |
+
|
81 |
+
$this->_getSession()->addSuccess(
|
82 |
+
$this->getHelper()->__('The project with id "%s" has been deleted.', $id)
|
83 |
+
);
|
84 |
+
|
85 |
+
$this->_redirect('*/*/');
|
86 |
+
|
87 |
+
return;
|
88 |
+
} catch (Mage_Core_Exception $e) {
|
89 |
+
$this->_getSession()->addError($e->getMessage());
|
90 |
+
} catch (Exception $e) {
|
91 |
+
$this->_getSession()->addError(
|
92 |
+
$this->getHelper()->__(
|
93 |
+
'An error occurred while deleting project data with id "%s". Please review log and try again.',
|
94 |
+
$id
|
95 |
+
)
|
96 |
+
);
|
97 |
+
Mage::logException($e);
|
98 |
+
}
|
99 |
+
// redirect to edit form
|
100 |
+
$this->_redirect('*/*/', ['project_id' => $id]);
|
101 |
+
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
// display error message
|
105 |
+
$this->_getSession()->addError(
|
106 |
+
$this->getHelper()->__('Unable to find a project with id "%s" to delete.', $id)
|
107 |
+
);
|
108 |
+
// go to grid
|
109 |
+
$this->_redirect('*/*/');
|
110 |
+
}
|
111 |
+
|
112 |
+
public function editAction()
|
113 |
+
{
|
114 |
+
/** @var $project Eurotext_TranslationManager_Model_Project */
|
115 |
+
$project = $this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
116 |
+
if (!$project->isEditable()) {
|
117 |
+
$this->getSession()->addNotice($this->getHelper()->__('Project "%s" was exported. You can\'t edit it anymore.', $project->getProjectName()));
|
118 |
+
}
|
119 |
+
$this->loadLayout();
|
120 |
+
$this->renderLayout();
|
121 |
+
}
|
122 |
+
|
123 |
+
public function indexAction()
|
124 |
+
{
|
125 |
+
$this->loadLayout();
|
126 |
+
$this->renderLayout();
|
127 |
+
}
|
128 |
+
|
129 |
+
public function newAction()
|
130 |
+
{
|
131 |
+
$this->_forward('edit');
|
132 |
+
}
|
133 |
+
|
134 |
+
public function productsGridAction()
|
135 |
+
{
|
136 |
+
$this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
137 |
+
|
138 |
+
$products = $this->getRequest()->getPost('products', []);
|
139 |
+
$categories = $this->getRequest()->getPost('categories', []);
|
140 |
+
$this->renderProductGridAndCategoryTree($products, $categories);
|
141 |
+
}
|
142 |
+
|
143 |
+
public function productsTabAction()
|
144 |
+
{
|
145 |
+
$project = $this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
146 |
+
|
147 |
+
$this->renderProductGridAndCategoryTree($project->getProducts(), []);
|
148 |
+
}
|
149 |
+
|
150 |
+
public function resetAction()
|
151 |
+
{
|
152 |
+
$project = $this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
153 |
+
$project->reset();
|
154 |
+
$project->save();
|
155 |
+
$this->_redirect('*/*/edit', ['project_id' => $project->getId()]);
|
156 |
+
}
|
157 |
+
|
158 |
+
public function saveAction()
|
159 |
+
{
|
160 |
+
$project = $this->loadAndRegisterProject($this->getRequest()->getParam('id'));
|
161 |
+
if ($project->isEditable()) {
|
162 |
+
$this->saveProject($project);
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
public function transactionEmailFilesGridAction()
|
167 |
+
{
|
168 |
+
$this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
169 |
+
|
170 |
+
$this->loadLayout();
|
171 |
+
|
172 |
+
$transactionEmailFiles = $this->getRequest()->getPost('transactionEmailFiles', null);
|
173 |
+
$this->renderTransactionEmailFilesGrid($transactionEmailFiles);
|
174 |
+
|
175 |
+
$this->renderLayout();
|
176 |
+
}
|
177 |
+
|
178 |
+
public function transactionEmailFilesTabAction()
|
179 |
+
{
|
180 |
+
$this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
181 |
+
|
182 |
+
$this->loadLayout();
|
183 |
+
|
184 |
+
$transactionEmailDatabase = $this->getRequest()->getPost('transactionEmailsDatabase', null);
|
185 |
+
$this->renderTransactionEmailDatabaseGrid($transactionEmailDatabase);
|
186 |
+
|
187 |
+
$transactionEmailFiles = $this->getRequest()->getPost('transactionEmailFiles', null);
|
188 |
+
$this->renderTransactionEmailFilesGrid($transactionEmailFiles);
|
189 |
+
|
190 |
+
$this->renderLayout();
|
191 |
+
}
|
192 |
+
|
193 |
+
public function transactionmailsDatabaseGridAction()
|
194 |
+
{
|
195 |
+
$this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
196 |
+
|
197 |
+
$this->loadLayout();
|
198 |
+
|
199 |
+
$transactionEmailFiles = $this->getRequest()->getPost('transactionEmailsDatabase', null);
|
200 |
+
$this->renderTransactionEmailDatabaseGrid($transactionEmailFiles);
|
201 |
+
$this->renderLayout();
|
202 |
+
}
|
203 |
+
|
204 |
+
public function translateFilesGridAction()
|
205 |
+
{
|
206 |
+
$this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
207 |
+
|
208 |
+
$translateFiles = $this->getRequest()->getPost('translateFiles', null);
|
209 |
+
$this->renderTranslateFileGrid($translateFiles);
|
210 |
+
}
|
211 |
+
|
212 |
+
public function translateFilesTabAction()
|
213 |
+
{
|
214 |
+
$project = $this->loadAndRegisterProject($this->getRequest()->getParam('project_id'));
|
215 |
+
|
216 |
+
$this->renderTranslateFileGrid($project->getTranslationFiles());
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* @return bool
|
221 |
+
*/
|
222 |
+
protected function _isAllowed()
|
223 |
+
{
|
224 |
+
return Mage::getSingleton('admin/session')
|
225 |
+
->isAllowed('eurotext_translationmanager/export');
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* @return Mage_Adminhtml_Block_Catalog_Category_Widget_Chooser
|
230 |
+
*/
|
231 |
+
private function _getCategoryTreeBlock()
|
232 |
+
{
|
233 |
+
return $this->getLayout()->createBlock(
|
234 |
+
'eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_products_categoryTreeAjax',
|
235 |
+
'',
|
236 |
+
[
|
237 |
+
'id' => $this->getRequest()->getParam('uniq_id'),
|
238 |
+
'use_massaction' => $this->getRequest()->getParam('use_massaction', false)
|
239 |
+
]
|
240 |
+
);
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* @param int[] $categories
|
245 |
+
*/
|
246 |
+
private function renderCategoryGrid($categories)
|
247 |
+
{
|
248 |
+
/** @var Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Categories $categoryGrid */
|
249 |
+
$categoryGrid = $this->loadLayout()->getLayout()->getBlock('project_edit.project.tab.categories');
|
250 |
+
$categoryGrid->setSelectedCategories($categories);
|
251 |
+
|
252 |
+
$this->renderLayout();
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* @param int[] $cmsBlocks
|
257 |
+
*/
|
258 |
+
private function renderCmsBlockGrid($cmsBlocks)
|
259 |
+
{
|
260 |
+
/** @var Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_CmsBlock $cmsBlockGrid */
|
261 |
+
$cmsBlockGrid = $this->loadLayout()->getLayout()->getBlock('project_edit.project.tab.cmsblocks');
|
262 |
+
$cmsBlockGrid->setSelectedCmsBlocks($cmsBlocks);
|
263 |
+
|
264 |
+
$this->renderLayout();
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* @param int[] $products
|
269 |
+
*/
|
270 |
+
private function renderProductGridAndCategoryTree($products, $categories)
|
271 |
+
{
|
272 |
+
$this->loadLayout();
|
273 |
+
|
274 |
+
$products = array_unique(
|
275 |
+
array_merge(
|
276 |
+
Mage::helper('eurotext_translationmanager/category')->getProductIdsByCategoryIds($categories),
|
277 |
+
is_array($products) ? $products : []
|
278 |
+
)
|
279 |
+
);
|
280 |
+
|
281 |
+
/** @var Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Products_Script $scriptBlock */
|
282 |
+
$scriptBlock = $this->getLayout()->getBlock('project.edit.project.tab.products.script');
|
283 |
+
if ($scriptBlock) {
|
284 |
+
$scriptBlock->setSelectedProducts(array_combine($products, $products));
|
285 |
+
}
|
286 |
+
|
287 |
+
/** @var Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Products $productGrid */
|
288 |
+
$productGrid = $this->getLayout()->getBlock('project_edit.project.tab.products');
|
289 |
+
$productGrid->setSelected($products);
|
290 |
+
$productGrid->setSelectedProducts($products);
|
291 |
+
|
292 |
+
/** @var Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Products_CategoryTree|Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Products_CategoryTreeAjax $categoryTree */
|
293 |
+
$categoryTree = $this->getLayout()->getBlock('project.edit.project.tab.products.categry_tree');
|
294 |
+
if ($categoryTree) {
|
295 |
+
$categoryTree->setCategoryIds([]);
|
296 |
+
}
|
297 |
+
|
298 |
+
$this->renderLayout();
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* @param int[] $cmsPages
|
303 |
+
*/
|
304 |
+
private function renderCmsPageGrid($cmsPages)
|
305 |
+
{
|
306 |
+
$this->loadLayout();
|
307 |
+
/** @var Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_CmsPage $block */
|
308 |
+
$block = $this->loadLayout()->getLayout()->getBlock('project_edit.project.tab.cmspages');
|
309 |
+
$block->setSelectedCmsPages($cmsPages);
|
310 |
+
|
311 |
+
$this->renderLayout();
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* @param string[] $transactionEmailFiles
|
316 |
+
*/
|
317 |
+
private function renderTransactionEmailFilesGrid($transactionEmailFiles)
|
318 |
+
{
|
319 |
+
/** @var Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_TransactionEmailFiles $block */
|
320 |
+
$block = $this->getLayout()->getBlock('project_edit.project.tab.transactionemailfiles');
|
321 |
+
$block->setSelectedTransactionEmailFiles($transactionEmailFiles);
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* @param int[] $transactionEmailsDatabase
|
326 |
+
*/
|
327 |
+
private function renderTransactionEmailDatabaseGrid($transactionEmailsDatabase)
|
328 |
+
{
|
329 |
+
/** @var Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_TransactionEmailsDatabase $block */
|
330 |
+
$block = $this->getLayout()->getBlock('project_edit.project.tab.transactionemailsdatabase');
|
331 |
+
$block->setSelectedTransactionEmailDatabase($transactionEmailsDatabase);
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* @param string[] $translateFiles
|
336 |
+
*/
|
337 |
+
private function renderTranslateFileGrid($translateFiles)
|
338 |
+
{
|
339 |
+
$this->loadLayout();
|
340 |
+
/** @var Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_TranslateFiles $block */
|
341 |
+
$block = $this->getLayout()->getBlock('project_edit.project.tab.translatefiles');
|
342 |
+
$block->setSelectedTranslateFiles($translateFiles);
|
343 |
+
|
344 |
+
$this->renderLayout();
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* @param int $projectId
|
349 |
+
* @return Eurotext_TranslationManager_Model_Project
|
350 |
+
*/
|
351 |
+
private function loadAndRegisterProject($projectId)
|
352 |
+
{
|
353 |
+
/** @var Eurotext_TranslationManager_Model_Project $project */
|
354 |
+
$project = Mage::getModel('eurotext_translationmanager/project')->load($projectId);
|
355 |
+
if ($projectId !== null) {
|
356 |
+
$project->addAllRelationalData();
|
357 |
+
}
|
358 |
+
|
359 |
+
Mage::register('project', $project);
|
360 |
+
|
361 |
+
return $project;
|
362 |
+
}
|
363 |
+
|
364 |
+
/**
|
365 |
+
* @return Mage_Adminhtml_Model_Session
|
366 |
+
*/
|
367 |
+
private function getSession()
|
368 |
+
{
|
369 |
+
return Mage::getModel('adminhtml/session');
|
370 |
+
}
|
371 |
+
|
372 |
+
/**
|
373 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
374 |
+
*/
|
375 |
+
private function saveProject(Eurotext_TranslationManager_Model_Project $project)
|
376 |
+
{
|
377 |
+
$project->addData($this->getRequest()->getParams());
|
378 |
+
/** @noinspection PhpAssignmentInConditionInspection */
|
379 |
+
if ($productIds = $this->getRequest()->getParam('product_ids', null)) {
|
380 |
+
$productIds = Mage::helper('adminhtml/js')->decodeGridSerializedInput($productIds);
|
381 |
+
$project->setProducts($productIds);
|
382 |
+
}
|
383 |
+
$this->addProductsBySku($project, $productIds);
|
384 |
+
/** @noinspection PhpAssignmentInConditionInspection */
|
385 |
+
if ($categoryIds = $this->getRequest()->getParam('category_ids', null)) {
|
386 |
+
$categoryIds = Mage::helper('adminhtml/js')->decodeGridSerializedInput($categoryIds);
|
387 |
+
$project->setCategories($categoryIds);
|
388 |
+
}
|
389 |
+
/** @noinspection PhpAssignmentInConditionInspection */
|
390 |
+
if ($cmsBlockIds = $this->getRequest()->getParam('cmsBlock_ids', null)) {
|
391 |
+
$cmsBlockIds = Mage::helper('adminhtml/js')->decodeGridSerializedInput($cmsBlockIds);
|
392 |
+
$project->setBlocks($cmsBlockIds);
|
393 |
+
}
|
394 |
+
/** @noinspection PhpAssignmentInConditionInspection */
|
395 |
+
if ($cmsPageIds = $this->getRequest()->getParam('cmsPage_ids', null)) {
|
396 |
+
$cmsPageIds = Mage::helper('adminhtml/js')->decodeGridSerializedInput($cmsPageIds);
|
397 |
+
$project->setPages($cmsPageIds);
|
398 |
+
}
|
399 |
+
/** @noinspection PhpAssignmentInConditionInspection */
|
400 |
+
if ($transactionEmailFilesFilenames = $this->getRequest()->getParam('transactionEmailFile_ids', null)) {
|
401 |
+
$transactionEmailFilesFilenames = array_filter(explode('&', $transactionEmailFilesFilenames));
|
402 |
+
$project->setTransactionEmailFiles($transactionEmailFilesFilenames);
|
403 |
+
}
|
404 |
+
/** @noinspection PhpAssignmentInConditionInspection */
|
405 |
+
if ($mailDatabaseIds = $this->getRequest()->getParam('transactionEmailDatabase_ids', null)) {
|
406 |
+
$mailDatabaseIds = Mage::helper('adminhtml/js')->decodeGridSerializedInput($mailDatabaseIds);
|
407 |
+
$project->setTransactionEmailDatabase($mailDatabaseIds);
|
408 |
+
}
|
409 |
+
/** @noinspection PhpAssignmentInConditionInspection */
|
410 |
+
if ($translationFileFilenames = $this->getRequest()->getParam('translateFiles_ids', null)) {
|
411 |
+
$translationFileFilenames = array_filter(explode('&', $translationFileFilenames));
|
412 |
+
$project->setTranslationFiles($translationFileFilenames);
|
413 |
+
}
|
414 |
+
|
415 |
+
$project->save();
|
416 |
+
$this->getSession()->addSuccess(
|
417 |
+
$this->getHelper()->__('Project "%s" saved with ID "%s".', $project->getProjectName(), $project->getId())
|
418 |
+
);
|
419 |
+
$this->_redirect('*/*/edit', ['project_id' => $project->getId()]);
|
420 |
+
}
|
421 |
+
|
422 |
+
/**
|
423 |
+
* @return Eurotext_TranslationManager_Helper_Data
|
424 |
+
*/
|
425 |
+
private function getHelper()
|
426 |
+
{
|
427 |
+
return Mage::helper('eurotext_translationmanager');
|
428 |
+
}
|
429 |
+
|
430 |
+
/**
|
431 |
+
* @param string $skus
|
432 |
+
* @return string[]
|
433 |
+
*/
|
434 |
+
private function getBulkProducts($skus)
|
435 |
+
{
|
436 |
+
$output = preg_split("#(\n|,|;)#", $skus);
|
437 |
+
|
438 |
+
return array_filter(array_map('trim', $output));
|
439 |
+
}
|
440 |
+
|
441 |
+
/**
|
442 |
+
* @param Eurotext_TranslationManager_Model_Project $project
|
443 |
+
* @param int[] $productIds
|
444 |
+
*/
|
445 |
+
private function addProductsBySku(Eurotext_TranslationManager_Model_Project $project, $productIds)
|
446 |
+
{
|
447 |
+
$skus = $this->getBulkProducts($this->getRequest()->getParam('bulk_sku'));
|
448 |
+
if ($skus) {
|
449 |
+
$productIds = $project->getProducts() ?: [];
|
450 |
+
$project->setProducts(
|
451 |
+
array_filter(
|
452 |
+
array_merge(
|
453 |
+
$productIds,
|
454 |
+
Mage::getResourceModel('catalog/product_collection')
|
455 |
+
->addAttributeToFilter('sku', ['in', $skus])
|
456 |
+
->getAllIds()
|
457 |
+
)
|
458 |
+
)
|
459 |
+
);
|
460 |
+
}
|
461 |
+
}
|
462 |
+
}
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_TranslationManager_Adminhtml_Eurotext_StatusController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
$this->loadLayout();
|
8 |
+
$this->renderLayout();
|
9 |
+
}
|
10 |
+
|
11 |
+
public function upgradescopeAction()
|
12 |
+
{
|
13 |
+
$this->updateScopeFor('product');
|
14 |
+
$this->updateScopeFor('category');
|
15 |
+
|
16 |
+
$this->_redirect('*/*/index');
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _isAllowed()
|
20 |
+
{
|
21 |
+
return Mage::getSingleton('admin/session')
|
22 |
+
->isAllowed('eurotext_translationmanager/status');
|
23 |
+
}
|
24 |
+
|
25 |
+
private function updateScopeFor($type)
|
26 |
+
{
|
27 |
+
/** @var Mage_Catalog_Model_Resource_Product_Attribute_Collection|Mage_Catalog_Model_Resource_Category_Attribute_Collection $productUrlAttributes */
|
28 |
+
$productUrlAttributes = Mage::getResourceModel("catalog/{$type}_attribute_collection")
|
29 |
+
->addFieldToFilter('attribute_code', ['in' => ['url_key', 'url_path']]);
|
30 |
+
foreach ($productUrlAttributes as $a) {
|
31 |
+
$a->setIsGlobal(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE);
|
32 |
+
$a->save();
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
36 |
+
}
|
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Adminhtml_Eurotext_Translationmanager_HelpController extends Mage_Adminhtml_Controller_Action
|
4 |
-
{
|
5 |
-
protected function _isAllowed()
|
6 |
-
{
|
7 |
-
return Mage::getSingleton('admin/session')
|
8 |
-
->isAllowed('eurotext_translationmanager/help');
|
9 |
-
}
|
10 |
-
|
11 |
-
|
12 |
-
public function indexAction()
|
13 |
-
{
|
14 |
-
$this->loadLayout();
|
15 |
-
$this->renderLayout();
|
16 |
-
}
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,3240 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Adminhtml_Eurotext_Translationmanager_ProjectsController extends Mage_Adminhtml_Controller_Action
|
4 |
-
{
|
5 |
-
/** @var Eurotext_TranslationManager_Helper_Data */
|
6 |
-
protected $helper = false;
|
7 |
-
/** @var Eurotext_TranslationManager_Helper_Eurotext */
|
8 |
-
protected $eurotextHelper = false;
|
9 |
-
|
10 |
-
protected function _isAllowed()
|
11 |
-
{
|
12 |
-
return Mage::getSingleton('admin/session')
|
13 |
-
->isAllowed('eurotext_translationmanager/export');
|
14 |
-
}
|
15 |
-
|
16 |
-
protected function _construct(){
|
17 |
-
$this->helper = Mage::helper('eurotext_translationmanager');
|
18 |
-
$this->eurotextHelper = Mage::helper('eurotext_translationmanager/eurotext');
|
19 |
-
}
|
20 |
-
|
21 |
-
protected function getHelper(){
|
22 |
-
return $this->helper;
|
23 |
-
}
|
24 |
-
|
25 |
-
protected function getEurotextHelper(){
|
26 |
-
return $this->eurotextHelper;
|
27 |
-
}
|
28 |
-
|
29 |
-
public function getModuleVersion()
|
30 |
-
{
|
31 |
-
return (string) Mage::getConfig()->getNode('modules/Eurotext_TranslationManager/version');
|
32 |
-
}
|
33 |
-
|
34 |
-
protected function _initAction()
|
35 |
-
{
|
36 |
-
$this->loadLayout()
|
37 |
-
// Make the active menu match the menu config nodes (without 'children' inbetween)
|
38 |
-
->_setActiveMenu('eurotext_translationmanager_projects/export')
|
39 |
-
->_title('Eurotext')->_title($this->__('Export'))
|
40 |
-
->_addBreadcrumb('Eurotext', $this->__('Export'));
|
41 |
-
|
42 |
-
return $this;
|
43 |
-
}
|
44 |
-
|
45 |
-
public function indexAction()
|
46 |
-
{
|
47 |
-
$this->loadLayout();
|
48 |
-
$this->renderLayout();
|
49 |
-
}
|
50 |
-
|
51 |
-
public function addprojectAction()
|
52 |
-
{
|
53 |
-
// Create new project:
|
54 |
-
$tableName = Mage::getSingleton('core/resource')->getTableName('eurotext_translationmanager/project');
|
55 |
-
|
56 |
-
$dbres = Mage::getSingleton('core/resource');
|
57 |
-
$dbw=$dbres->getConnection('core_write');
|
58 |
-
|
59 |
-
$create_id=rand();
|
60 |
-
|
61 |
-
$dbw->query("INSERT INTO `".$tableName."` (create_id,project_name,last_update) VALUES (?,?,NOW());",array($create_id,$this->__("New Project")));
|
62 |
-
$project_id=$dbw->fetchOne("SELECT id FROM `".$tableName."` WHERE create_id=".$create_id);
|
63 |
-
|
64 |
-
$url=Mage::helper('adminhtml')->getUrl('*/*/index', array('id' => $project_id));
|
65 |
-
$this->_redirectUrl($url);
|
66 |
-
}
|
67 |
-
|
68 |
-
public function deleteAction()
|
69 |
-
{
|
70 |
-
$project_id=intval(Mage::app()->getRequest()->getParam('id',-1));
|
71 |
-
|
72 |
-
$dbres = Mage::getSingleton('core/resource');
|
73 |
-
$dbw=$dbres->getConnection('core_write');
|
74 |
-
|
75 |
-
$dbw->query("DELETE FROM `".Mage::getSingleton('core/resource')->getTableName('eurotext_project')."` WHERE id=?;",array($project_id));
|
76 |
-
$dbw->query("DELETE FROM `".Mage::getSingleton('core/resource')->getTableName('eurotext_csv')."` WHERE project_id=?;",array($project_id));
|
77 |
-
$dbw->query("DELETE FROM `".Mage::getSingleton('core/resource')->getTableName('eurotext_csv_data')."` WHERE project_id=?;",array($project_id));
|
78 |
-
$dbw->query("DELETE FROM `".Mage::getSingleton('core/resource')->getTableName('eurotext_emailtemplates')."` WHERE project_id=?;",array($project_id));
|
79 |
-
$dbw->query("DELETE FROM `".Mage::getSingleton('core/resource')->getTableName('eurotext_import')."` WHERE project_id=?;",array($project_id));
|
80 |
-
$dbw->query("DELETE FROM `".Mage::getSingleton('core/resource')->getTableName('eurotext_project_categories')."` WHERE project_id=?;",array($project_id));
|
81 |
-
$dbw->query("DELETE FROM `".Mage::getSingleton('core/resource')->getTableName('eurotext_project_cmspages')."` WHERE project_id=?;",array($project_id));
|
82 |
-
$dbw->query("DELETE FROM `".Mage::getSingleton('core/resource')->getTableName('eurotext_project_cmsblocks')."` WHERE project_id=?;",array($project_id));
|
83 |
-
$dbw->query("DELETE FROM `".Mage::getSingleton('core/resource')->getTableName('eurotext_project_products')."` WHERE project_id=?;",array($project_id));
|
84 |
-
|
85 |
-
$url=Mage::helper('adminhtml')->getUrl('*/*/index', array('id' => '-1'));
|
86 |
-
$this->_redirectUrl($url);
|
87 |
-
}
|
88 |
-
|
89 |
-
public function resetAction()
|
90 |
-
{
|
91 |
-
$project_id=intval(Mage::app()->getRequest()->getParam('id',-1));
|
92 |
-
|
93 |
-
$dbres = Mage::getSingleton('core/resource');
|
94 |
-
$dbw=$dbres->getConnection('core_write');
|
95 |
-
|
96 |
-
$dbw->query("UPDATE `".Mage::getSingleton('core/resource')->getTableName('eurotext_project')."` SET project_status=(project_status-1) WHERE project_status>0 AND id=?;",array($project_id));
|
97 |
-
|
98 |
-
$url=Mage::helper('adminhtml')->getUrl('*/*/index', array('id' => $project_id));
|
99 |
-
$this->_redirectUrl($url);
|
100 |
-
}
|
101 |
-
|
102 |
-
public function saveprojectAction()
|
103 |
-
{
|
104 |
-
$this->loadLayout('adminhtml_eurotext_translationmanager_ajax');
|
105 |
-
$block = $this->getLayout()->getBlock('et.tm.response.ajax');
|
106 |
-
|
107 |
-
$block->setStatusCode('ok');
|
108 |
-
$block->setStatusMsg($this->__("Saved Project!"));
|
109 |
-
|
110 |
-
// Update project:
|
111 |
-
try
|
112 |
-
{
|
113 |
-
$project_id=intval(Mage::app()->getRequest()->getParam('id',-1));
|
114 |
-
$project_name=$this->getHelper()->sanitize(Mage::app()->getRequest()->getParam('project_name'));
|
115 |
-
$storeview_src=intval(Mage::app()->getRequest()->getParam('storeview_src',-1));
|
116 |
-
$storeview_dst=intval(Mage::app()->getRequest()->getParam('storeview_dst',-1));
|
117 |
-
$export_seo=intval(Mage::app()->getRequest()->getParam('export_seo',1));
|
118 |
-
$export_attributes=intval(Mage::app()->getRequest()->getParam('export_attributes',1));
|
119 |
-
$export_urlkeys=intval(Mage::app()->getRequest()->getParam('export_urlkeys',0));
|
120 |
-
$productmode=intval(Mage::app()->getRequest()->getParam('productmode',0));
|
121 |
-
$categorymode=intval(Mage::app()->getRequest()->getParam('categorymode',0));
|
122 |
-
$cmsmode=intval(Mage::app()->getRequest()->getParam('cmsmode',0));
|
123 |
-
$langfilesmode=intval(Mage::app()->getRequest()->getParam('langfilesmode',0));
|
124 |
-
$templatemode=intval(Mage::app()->getRequest()->getParam('templatemode',0));
|
125 |
-
|
126 |
-
$tableName = Mage::getSingleton('core/resource')->getTableName('eurotext_translationmanager/project');
|
127 |
-
|
128 |
-
$dbres = Mage::getSingleton('core/resource');
|
129 |
-
$dbw=$dbres->getConnection('core_write');
|
130 |
-
|
131 |
-
if (strlen($project_name)==0)
|
132 |
-
{
|
133 |
-
$block->setStatusCode('error');
|
134 |
-
$block->setStatusMsg($this->__("Please enter project name!"));
|
135 |
-
}
|
136 |
-
|
137 |
-
if ($storeview_src<0)
|
138 |
-
{
|
139 |
-
$block->setStatusCode('error');
|
140 |
-
$block->setStatusMsg($this->__("Please select Source Storeview!"));
|
141 |
-
}
|
142 |
-
elseif ($storeview_dst<0)
|
143 |
-
{
|
144 |
-
$block->setStatusCode('error');
|
145 |
-
$block->setStatusMsg($this->__("Please select Destination Storeview!"));
|
146 |
-
}
|
147 |
-
elseif ($storeview_dst==$storeview_src)
|
148 |
-
{
|
149 |
-
$block->setStatusCode('error');
|
150 |
-
$block->setStatusMsg($this->__("Please select different Storeviews for Source and Destination!"));
|
151 |
-
}
|
152 |
-
|
153 |
-
if($block->getStatusCode() == 'ok'){
|
154 |
-
$dbw->query("UPDATE `".$tableName."` SET create_id=-1, last_update=NOW(), project_name=?, storeview_src=?, storeview_dst=?, export_seo=?, export_attributes=?, productmode=?, categorymode=?, cmsmode=?, langfilesmode=?, templatemode=?, export_urlkeys=? WHERE id=".$project_id, array($project_name,$storeview_src,$storeview_dst,$export_seo,$export_attributes,$productmode,$categorymode,$cmsmode,$langfilesmode,$templatemode,$export_urlkeys));
|
155 |
-
}
|
156 |
-
}
|
157 |
-
catch(Exception $e)
|
158 |
-
{
|
159 |
-
$block->setStatusCode('error');
|
160 |
-
$block->setStatusMsg($e->getMessage());
|
161 |
-
}
|
162 |
-
|
163 |
-
$this->renderLayout();
|
164 |
-
|
165 |
-
}
|
166 |
-
|
167 |
-
private function getProject($project_id)
|
168 |
-
{
|
169 |
-
$tableName = Mage::getSingleton('core/resource')->getTableName('eurotext_translationmanager/project');
|
170 |
-
|
171 |
-
$dbres = Mage::getSingleton('core/resource');
|
172 |
-
$dbr=$dbres->getConnection('core_read');
|
173 |
-
|
174 |
-
$projects=$dbr->fetchAll("SELECT * FROM `".$tableName."` WHERE id=".$project_id);
|
175 |
-
|
176 |
-
$project=$projects[0];
|
177 |
-
|
178 |
-
// storeview_src_locale:
|
179 |
-
$project['storeview_src_locale']="en_US";
|
180 |
-
if ($project['storeview_src']>=0)
|
181 |
-
{
|
182 |
-
$project['storeview_src_locale']=Mage::getStoreConfig('general/locale/code', $project['storeview_src']);
|
183 |
-
}
|
184 |
-
|
185 |
-
// storeview_dst_locale:
|
186 |
-
$project['storeview_dst_locale']="en_US";
|
187 |
-
if ($project['storeview_dst']>=0)
|
188 |
-
{
|
189 |
-
$project['storeview_dst_locale']=Mage::getStoreConfig('general/locale/code', $project['storeview_dst']);
|
190 |
-
}
|
191 |
-
|
192 |
-
return $project;
|
193 |
-
}
|
194 |
-
|
195 |
-
private function getTableName($tblName)
|
196 |
-
{
|
197 |
-
return Mage::getSingleton('core/resource')->getTableName($tblName);
|
198 |
-
}
|
199 |
-
|
200 |
-
public function ajaxexportAction_CollectLangfiles($project)
|
201 |
-
{
|
202 |
-
$helper=$this->getHelper();
|
203 |
-
$helper->ajaxexportAction_CollectLangfiles($project);
|
204 |
-
}
|
205 |
-
|
206 |
-
public function ajaxexportAction_ImportLangfiles($project,$offset)
|
207 |
-
{
|
208 |
-
|
209 |
-
$dbres = Mage::getSingleton('core/resource');
|
210 |
-
$dbw=$dbres->getConnection('core_write');
|
211 |
-
$dbr=$dbres->getConnection('core_read');
|
212 |
-
|
213 |
-
$rv=array();
|
214 |
-
$rv['offset']=-1;
|
215 |
-
$rv['status_msg']=$this->__("Finished loading language files.");
|
216 |
-
|
217 |
-
$addWhere="";
|
218 |
-
if ($project['langfilesmode']==0)
|
219 |
-
{
|
220 |
-
$addWhere=" AND translate_flag=1";
|
221 |
-
}
|
222 |
-
|
223 |
-
if ($offset==0)
|
224 |
-
{
|
225 |
-
$dbw->query("DELETE FROM `".$this->getTableName('eurotext_csv_data')."` WHERE project_id=?;",array($project['id']));
|
226 |
-
}
|
227 |
-
|
228 |
-
$cnt=intval($dbr->fetchOne("SELECT COUNT(*) cnt FROM `".$this->getTableName('eurotext_csv')."` WHERE project_id=".$project['id'].$addWhere));
|
229 |
-
|
230 |
-
$rows=$dbr->fetchAll("SELECT * FROM `".$this->getTableName('eurotext_csv')."` WHERE project_id=".$project['id'].$addWhere." ORDER BY filename ASC, line_hash ASC LIMIT $offset,1");
|
231 |
-
if (count($rows) > 0)
|
232 |
-
{
|
233 |
-
$row=$rows[0];
|
234 |
-
|
235 |
-
$filename=$row['filename'];
|
236 |
-
$locale=$row['locale_dst'];
|
237 |
-
$rv['status_msg']=$this->__("Analysing")." ".($offset+1)."/".$cnt.": '".$filename."'";
|
238 |
-
|
239 |
-
$full_path=Mage::getBaseDir('app').$filename;
|
240 |
-
|
241 |
-
// Read CSV:
|
242 |
-
$fp=fopen($full_path,"r");
|
243 |
-
$lineIndex=1;
|
244 |
-
do
|
245 |
-
{
|
246 |
-
$fields=fgetcsv($fp,0,",","\"");
|
247 |
-
if ($fields!==false)
|
248 |
-
{
|
249 |
-
if (count($fields)==2)
|
250 |
-
{
|
251 |
-
$line_hash=sha1($project['id']."_".$filename."_".$fields[0]);
|
252 |
-
$dbw->query("INSERT IGNORE INTO `".$this->getTableName('eurotext_csv_data')."` (line_hash,project_id,filename,locale_dst,text_src,text_src_hash,text_dst,csvline) VALUES (?,?,?,?,?,?,?,?);",array($line_hash,$project['id'],$filename,$locale,$fields[0],sha1($fields[0]),$fields[1],$lineIndex));
|
253 |
-
}
|
254 |
-
}
|
255 |
-
|
256 |
-
$lineIndex++;
|
257 |
-
}
|
258 |
-
while($fields!==false);
|
259 |
-
fclose($fp);
|
260 |
-
|
261 |
-
$rv['offset']=$offset+1;
|
262 |
-
}
|
263 |
-
|
264 |
-
return $rv;
|
265 |
-
}
|
266 |
-
|
267 |
-
public function getImportXMLPath($project)
|
268 |
-
{
|
269 |
-
return $this->getProjectXMLPath($project,"import");
|
270 |
-
}
|
271 |
-
|
272 |
-
public function getExportXMLPath($project)
|
273 |
-
{
|
274 |
-
return $this->getProjectXMLPath($project,"export");
|
275 |
-
}
|
276 |
-
|
277 |
-
private function getProjectXMLPath($project,$folder)
|
278 |
-
{
|
279 |
-
$dir=Mage::getBaseDir('var');
|
280 |
-
$dir.=DS."eurotext";
|
281 |
-
if (!is_dir($dir))
|
282 |
-
{
|
283 |
-
if(!mkdir($dir)){
|
284 |
-
$this->getHelper()->log('Working directory could not be created in '.Mage::getBaseDir('var'), Zend_Log::CRIT);
|
285 |
-
throw new Magento_Exception('Eurotext working directory could not be created.');
|
286 |
-
}
|
287 |
-
}
|
288 |
-
|
289 |
-
$htaccessFilename=$dir.DS.".htaccess";
|
290 |
-
if (!is_file($htaccessFilename))
|
291 |
-
{
|
292 |
-
file_put_contents($htaccessFilename,"# Eurotext Export folder\r\nOrder Deny,Allow\r\nDeny From All");
|
293 |
-
}
|
294 |
-
|
295 |
-
$dir.=DS."projects";
|
296 |
-
if (!is_dir($dir))
|
297 |
-
{
|
298 |
-
mkdir($dir);
|
299 |
-
}
|
300 |
-
|
301 |
-
$dir.=DS.$project['id'];
|
302 |
-
if (!is_dir($dir))
|
303 |
-
{
|
304 |
-
mkdir($dir);
|
305 |
-
}
|
306 |
-
|
307 |
-
$dir.=DS.$folder;
|
308 |
-
if (!is_dir($dir))
|
309 |
-
{
|
310 |
-
mkdir($dir);
|
311 |
-
}
|
312 |
-
|
313 |
-
return $dir;
|
314 |
-
}
|
315 |
-
|
316 |
-
private function getTempDir()
|
317 |
-
{
|
318 |
-
$dir=Mage::getBaseDir('tmp');
|
319 |
-
$dir.=DS."eurotext";
|
320 |
-
if (!is_dir($dir))
|
321 |
-
{
|
322 |
-
if(!mkdir($dir)){
|
323 |
-
$this->getHelper()->log('Temporary directory could not be created in '.Mage::getBaseDir('var'), Zend_Log::CRIT);
|
324 |
-
throw new Magento_Exception('Eurotext temporary directory could not be created.');
|
325 |
-
}
|
326 |
-
}
|
327 |
-
$htaccessFilename=$dir.DS.".htaccess";
|
328 |
-
if (!is_file($htaccessFilename))
|
329 |
-
{
|
330 |
-
file_put_contents($htaccessFilename,"# Eurotext Temp folder\r\nOrder Deny,Allow\r\nDeny From All");
|
331 |
-
}
|
332 |
-
|
333 |
-
return $dir;
|
334 |
-
}
|
335 |
-
|
336 |
-
public function ajaxexportAction_BuildLangXML($project, $offset)
|
337 |
-
{
|
338 |
-
$rv=array();
|
339 |
-
$rv["status_msg"]=$this->__("Generating language files...");
|
340 |
-
$rv["offset"]=$offset;
|
341 |
-
$rv["step"]=$this->STEP_BUILD_LANGXML;
|
342 |
-
|
343 |
-
$dbres = Mage::getSingleton('core/resource');
|
344 |
-
$dbw=$dbres->getConnection('core_write');
|
345 |
-
$dbr=$dbres->getConnection('core_read');
|
346 |
-
|
347 |
-
$xmlDir=$this->getExportXMLPath($project);
|
348 |
-
$xmlDir.=DS."framework";
|
349 |
-
if (!is_dir($xmlDir))
|
350 |
-
{
|
351 |
-
mkdir($xmlDir);
|
352 |
-
}
|
353 |
-
|
354 |
-
$cnt=count($dbr->fetchAll("SELECT filename FROM `".$this->getTableName('eurotext_csv')."` WHERE project_id=".$project['id']." GROUP BY filename"));
|
355 |
-
|
356 |
-
$rows=$dbr->fetchAll("SELECT filename FROM `".$this->getTableName('eurotext_csv')."` WHERE project_id=".$project['id']." GROUP BY filename ORDER BY filename ASC LIMIT ".$offset.",1");
|
357 |
-
if (count($rows)>0)
|
358 |
-
{
|
359 |
-
$row=$rows[0];
|
360 |
-
|
361 |
-
$en_filename=$row['filename'];
|
362 |
-
$dst_filename=str_replace("en_US",$project['storeview_dst_locale'],$en_filename);
|
363 |
-
$src_filename=str_replace("en_US",$project['storeview_src_locale'],$en_filename);
|
364 |
-
|
365 |
-
$rv["status_msg"]=$this->__("Analyzing")." ".($offset+1)."/".$cnt." '".$en_filename."'";
|
366 |
-
|
367 |
-
$short_filename=$this->getEurotextHelper()->GetFilenameFromPath($en_filename);
|
368 |
-
$short_filename_safe=$this->getEurotextHelper()->GetFilenameSafeString($short_filename);
|
369 |
-
$short_filename_safe=str_replace(".csv","",$short_filename_safe);
|
370 |
-
|
371 |
-
$xml_filename=$xmlDir.DS.$short_filename_safe."_".sha1($en_filename).".xml";
|
372 |
-
|
373 |
-
$doc = new DOMDocument('1.0', 'UTF-8');
|
374 |
-
$doc->formatOutput = true;
|
375 |
-
$translation = $doc->createElement( "translation" );
|
376 |
-
|
377 |
-
$translationAttr1=$doc->createAttribute("src_filename");
|
378 |
-
$translationAttr1->value=$src_filename;
|
379 |
-
$translation->appendChild($translationAttr1);
|
380 |
-
|
381 |
-
$translationAttr2=$doc->createAttribute("dst_filename");
|
382 |
-
$translationAttr2->value=$dst_filename;
|
383 |
-
$translation->appendChild($translationAttr2);
|
384 |
-
|
385 |
-
$doc->appendChild($translation);
|
386 |
-
|
387 |
-
$itemCount=0;
|
388 |
-
|
389 |
-
$tbl=$this->getTableName('eurotext_csv_data');
|
390 |
-
|
391 |
-
$sql="SELECT text_src FROM `".$tbl."` WHERE project_id=? AND (filename=? OR filename=? OR filename=?) GROUP BY text_src";
|
392 |
-
$srcLines=$dbr->fetchAll($sql,array($project['id'],$src_filename,$dst_filename,$en_filename));
|
393 |
-
foreach($srcLines as $srcLine)
|
394 |
-
{
|
395 |
-
$txt_en=$srcLine['text_src'];
|
396 |
-
$txt_src="";
|
397 |
-
$txt_dst="";
|
398 |
-
|
399 |
-
// Src-Sprache lesen, falls vorhanden:
|
400 |
-
if ($project['storeview_src_locale']=="en_US")
|
401 |
-
{
|
402 |
-
$txt_src=$txt_en;
|
403 |
-
}
|
404 |
-
else
|
405 |
-
{
|
406 |
-
$tmpData=$dbr->fetchAll("SELECT text_dst, csvline FROM `".$tbl."` WHERE project_id=? AND text_src=? AND filename=? AND locale_dst=?",array($project['id'],$txt_en,$src_filename,$project['storeview_src_locale']));
|
407 |
-
foreach($tmpData as $tmpLine)
|
408 |
-
{
|
409 |
-
$txt_src=$tmpLine['text_dst'];
|
410 |
-
}
|
411 |
-
}
|
412 |
-
|
413 |
-
// Dst-Sprache lesen, falls vorhanden:
|
414 |
-
$tmpData=$dbr->fetchAll("SELECT text_dst, csvline FROM `".$tbl."` WHERE project_id=? AND text_src=? AND filename=? AND locale_dst=?",array($project['id'],$txt_en,$dst_filename,$project['storeview_dst_locale']));
|
415 |
-
foreach($tmpData as $tmpLine)
|
416 |
-
{
|
417 |
-
$txt_dst=$tmpLine['text_dst'];
|
418 |
-
}
|
419 |
-
|
420 |
-
if (true)
|
421 |
-
{
|
422 |
-
// Needs to be translated:
|
423 |
-
$itemCount++;
|
424 |
-
|
425 |
-
// Add comment as separator:
|
426 |
-
$comment=$doc->createComment("Line ".$itemCount);
|
427 |
-
$translation->appendChild($comment);
|
428 |
-
|
429 |
-
{
|
430 |
-
$lineExport=$doc->createElement("line".$itemCount);
|
431 |
-
$translation->appendChild($lineExport);
|
432 |
-
|
433 |
-
// context
|
434 |
-
{
|
435 |
-
$line=$doc->createElement("line-context");
|
436 |
-
{
|
437 |
-
$lineIndex=$doc->createAttribute("num");
|
438 |
-
$lineIndex->value=$itemCount;
|
439 |
-
$line->appendChild($lineIndex);
|
440 |
-
}
|
441 |
-
{
|
442 |
-
$srchashAttribute=$doc->createAttribute("srchash");
|
443 |
-
$srchashAttribute->value=sha1($txt_en);
|
444 |
-
$line->appendChild($srchashAttribute);
|
445 |
-
}
|
446 |
-
{
|
447 |
-
$contextAttribute=$doc->createAttribute("context");
|
448 |
-
$contextAttribute->value="yes";
|
449 |
-
$line->appendChild($contextAttribute);
|
450 |
-
}
|
451 |
-
|
452 |
-
{
|
453 |
-
$contextAttribute=$doc->createAttribute("locale");
|
454 |
-
$contextAttribute->value="en_US";
|
455 |
-
$line->appendChild($contextAttribute);
|
456 |
-
}
|
457 |
-
|
458 |
-
$this->appendTextChild($line,$txt_en);
|
459 |
-
$lineExport->appendChild($line);
|
460 |
-
}
|
461 |
-
|
462 |
-
// context
|
463 |
-
{
|
464 |
-
$line=$doc->createElement("line-context");
|
465 |
-
{
|
466 |
-
$lineIndex=$doc->createAttribute("num");
|
467 |
-
$lineIndex->value=$itemCount;
|
468 |
-
$line->appendChild($lineIndex);
|
469 |
-
}
|
470 |
-
{
|
471 |
-
$srchashAttribute=$doc->createAttribute("srchash");
|
472 |
-
$srchashAttribute->value=sha1($txt_en);
|
473 |
-
$line->appendChild($srchashAttribute);
|
474 |
-
}
|
475 |
-
{
|
476 |
-
$contextAttribute=$doc->createAttribute("context");
|
477 |
-
$contextAttribute->value="yes";
|
478 |
-
$line->appendChild($contextAttribute);
|
479 |
-
}
|
480 |
-
{
|
481 |
-
$contextAttribute=$doc->createAttribute("locale");
|
482 |
-
$contextAttribute->value=$project['storeview_dst_locale'];
|
483 |
-
$line->appendChild($contextAttribute);
|
484 |
-
}
|
485 |
-
$this->appendTextChild($line,$txt_dst);
|
486 |
-
$lineExport->appendChild($line);
|
487 |
-
}
|
488 |
-
|
489 |
-
// content
|
490 |
-
{
|
491 |
-
|
492 |
-
$line=$doc->createElement("line");
|
493 |
-
{
|
494 |
-
$lineIndex=$doc->createAttribute("num");
|
495 |
-
$lineIndex->value=$itemCount;
|
496 |
-
$line->appendChild($lineIndex);
|
497 |
-
}
|
498 |
-
{
|
499 |
-
$srchashAttribute=$doc->createAttribute("srchash");
|
500 |
-
$srchashAttribute->value=sha1($txt_en);
|
501 |
-
$line->appendChild($srchashAttribute);
|
502 |
-
}
|
503 |
-
{
|
504 |
-
$contextAttribute=$doc->createAttribute("locale-src");
|
505 |
-
$contextAttribute->value=$project['storeview_src_locale'];
|
506 |
-
$line->appendChild($contextAttribute);
|
507 |
-
}
|
508 |
-
{
|
509 |
-
$contextAttribute=$doc->createAttribute("locale-dst");
|
510 |
-
$contextAttribute->value=$project['storeview_dst_locale'];
|
511 |
-
$line->appendChild($contextAttribute);
|
512 |
-
}
|
513 |
-
$this->appendTextChild($line,$txt_src);
|
514 |
-
$lineExport->appendChild($line);
|
515 |
-
}
|
516 |
-
}
|
517 |
-
}
|
518 |
-
}
|
519 |
-
|
520 |
-
if ($itemCount>0)
|
521 |
-
{
|
522 |
-
$doc->save($xml_filename);
|
523 |
-
}
|
524 |
-
|
525 |
-
$rv['offset']=($offset+1);
|
526 |
-
}
|
527 |
-
else
|
528 |
-
{
|
529 |
-
$rv['step']=$this->STEP_COLLECT_PRODUCTS;
|
530 |
-
$rv['offset']=0;
|
531 |
-
}
|
532 |
-
|
533 |
-
return $rv;
|
534 |
-
}
|
535 |
-
|
536 |
-
private function appendTextChild($xmlNode, $textContent)
|
537 |
-
{
|
538 |
-
$doc=$xmlNode->ownerDocument;
|
539 |
-
|
540 |
-
$needsCDATA = true; preg_match('/[<>&]/', $textContent);
|
541 |
-
|
542 |
-
if ($needsCDATA)
|
543 |
-
{
|
544 |
-
$xmlNode->appendChild($doc->createCDATASection($textContent));
|
545 |
-
}
|
546 |
-
else
|
547 |
-
{
|
548 |
-
$xmlNode->appendChild($doc->createTextNode($textContent));
|
549 |
-
}
|
550 |
-
}
|
551 |
-
|
552 |
-
public function ajaxexportAction_CollectProducts($project, $offset)
|
553 |
-
{
|
554 |
-
$rv=array();
|
555 |
-
$rv["status_msg"]=$this->__("Checking Product")."...";
|
556 |
-
$rv["offset"]=$offset;
|
557 |
-
$rv["step"]=$this->STEP_COLLECT_PRODUCTS;
|
558 |
-
|
559 |
-
$helper=$this->getHelper();
|
560 |
-
$maxItems=intval($helper->getSetting("et_products_per_file",20));
|
561 |
-
if ($maxItems<1) { $maxItems=20; }
|
562 |
-
|
563 |
-
$dbres = Mage::getSingleton('core/resource');
|
564 |
-
$dbw=$dbres->getConnection('core_write');
|
565 |
-
$dbr=$dbres->getConnection('core_read');
|
566 |
-
|
567 |
-
$product_id=-1;
|
568 |
-
|
569 |
-
$manualSelected=false;
|
570 |
-
|
571 |
-
if ($project['productmode']==1)
|
572 |
-
{
|
573 |
-
$cnt=intval($dbr->fetchOne("SELECT COUNT(*) cnt FROM `".$this->getTableName('catalog_product_entity')."`"));
|
574 |
-
|
575 |
-
$rows=$dbr->fetchAll("SELECT entity_id, sku FROM `".$this->getTableName('catalog_product_entity')."` ORDER BY sku ASC, entity_id ASC LIMIT $offset,$maxItems");
|
576 |
-
}
|
577 |
-
else
|
578 |
-
{
|
579 |
-
$manualSelected=true;
|
580 |
-
|
581 |
-
$cnt=intval($dbr->fetchOne("SELECT COUNT(*) cnt FROM `".$this->getTableName('eurotext_project_products')."` WHERE project_id=?",array($project['id'])));
|
582 |
-
|
583 |
-
$rows=$dbr->fetchAll("SELECT e.entity_id, e.sku FROM `".$this->getTableName('catalog_product_entity')."` e, `".$this->getTableName('eurotext_project_products')."` p WHERE (e.entity_id=p.product_id) AND project_id=".$project['id']." ORDER BY e.sku ASC, e.entity_id ASC LIMIT $offset,$maxItems");
|
584 |
-
}
|
585 |
-
|
586 |
-
$doc = new DOMDocument('1.0', 'UTF-8');
|
587 |
-
$doc->formatOutput = true;
|
588 |
-
|
589 |
-
$nodeArticles=$doc->createElement("articles");
|
590 |
-
$doc->appendChild($nodeArticles);
|
591 |
-
|
592 |
-
$itemsFound=false;
|
593 |
-
foreach($rows as $row)
|
594 |
-
{
|
595 |
-
$itemsFound=true;
|
596 |
-
|
597 |
-
$product_id=intval($row['entity_id']);
|
598 |
-
$sku=$row['sku'];
|
599 |
-
|
600 |
-
$rv["status_msg"]="(".($offset+1)." / ".$cnt.") ".$this->__("Checking Product")." '".$sku."'...";
|
601 |
-
|
602 |
-
// Compare languages:
|
603 |
-
$productSrc = Mage::getModel('catalog/product')->setStoreId($project['storeview_src'])->load($product_id);
|
604 |
-
$productDst = Mage::getModel('catalog/product')->setStoreId($project['storeview_dst'])->load($product_id);
|
605 |
-
|
606 |
-
$hasChangedProperty=false;
|
607 |
-
|
608 |
-
$nodeArticle = $doc->createElement("article");
|
609 |
-
|
610 |
-
{
|
611 |
-
$nodeArticleId = $doc->createElement("Id");
|
612 |
-
$nodeArticleId->appendChild($doc->createTextNode($product_id));
|
613 |
-
$nodeArticle->appendChild($nodeArticleId);
|
614 |
-
}
|
615 |
-
|
616 |
-
{
|
617 |
-
$nodeArticleUrl = $doc->createElement("Url");
|
618 |
-
$this->appendTextChild($nodeArticleUrl,$productSrc->getProductUrl());
|
619 |
-
$nodeArticle->appendChild($nodeArticleUrl);
|
620 |
-
}
|
621 |
-
|
622 |
-
// Name:
|
623 |
-
if ($productSrc->getName()!="")
|
624 |
-
{
|
625 |
-
if ( ($productSrc->getName()==$productDst->getName()) || ($productDst->getName()=="") || ($manualSelected))
|
626 |
-
{
|
627 |
-
$hasChangedProperty=true;
|
628 |
-
|
629 |
-
$item=$doc->createElement("Title");
|
630 |
-
$this->appendTextChild($item,$productSrc->getName());
|
631 |
-
$nodeArticle->appendChild($item);
|
632 |
-
}
|
633 |
-
}
|
634 |
-
|
635 |
-
// Description:
|
636 |
-
if ($productSrc->getDescription()!="")
|
637 |
-
{
|
638 |
-
if ( ($productSrc->getDescription()==$productDst->getDescription()) || ($productDst->getDescription()=="") || ($manualSelected))
|
639 |
-
{
|
640 |
-
$hasChangedProperty=true;
|
641 |
-
|
642 |
-
$item=$doc->createElement("Longdesc");
|
643 |
-
$this->appendTextChild($item,$productSrc->getDescription());
|
644 |
-
$nodeArticle->appendChild($item);
|
645 |
-
}
|
646 |
-
}
|
647 |
-
|
648 |
-
// Short-Description:
|
649 |
-
if ($productSrc->getShortDescription()!="")
|
650 |
-
{
|
651 |
-
if ( ($productSrc->getShortDescription()==$productDst->getShortDescription()) || ($productDst->getShortDescription()=="") || ($manualSelected))
|
652 |
-
{
|
653 |
-
$hasChangedProperty=true;
|
654 |
-
|
655 |
-
$item=$doc->createElement("Shortdesc");
|
656 |
-
$this->appendTextChild($item,$productSrc->getShortDescription());
|
657 |
-
$nodeArticle->appendChild($item);
|
658 |
-
}
|
659 |
-
}
|
660 |
-
|
661 |
-
// Custom Attributes through config xml
|
662 |
-
if($custom_attributes = Mage::helper('eurotext_translationmanager')->getCustomProductAttributesForExport()){
|
663 |
-
$hasChangedProperty = true;
|
664 |
-
$nodeCustomAttributes = $doc->createElement('custom_attributes');
|
665 |
-
// Custom Attribute Mapping is not yet used nor implemented
|
666 |
-
foreach($custom_attributes as $custom_attribute => $custom_attribute_mapping){
|
667 |
-
$item = $doc->createElement((string) $custom_attribute);
|
668 |
-
$this->appendTextChild($item, (string) $productSrc->getData($custom_attribute));
|
669 |
-
$nodeCustomAttributes->appendChild($item);
|
670 |
-
}
|
671 |
-
$nodeArticle->appendChild($nodeCustomAttributes);
|
672 |
-
}
|
673 |
-
|
674 |
-
// Images:
|
675 |
-
{
|
676 |
-
$images_orig=array();
|
677 |
-
$images_orig_url=array();
|
678 |
-
$images_dst_disabled=array();
|
679 |
-
$images_dst_position=array();
|
680 |
-
|
681 |
-
$images_dstLabel=array();
|
682 |
-
|
683 |
-
$rows=$dbr->fetchAll("SELECT g.value_id, g.value, v.store_id, v.label, v.disabled, position FROM `".$this->getTableName('catalog_product_entity_media_gallery')."` g, `".$this->getTableName('catalog_product_entity_media_gallery_value')."` v WHERE (v.value_id=g.value_id) AND g.entity_id=".$product_id." ORDER BY v.store_id ASC");
|
684 |
-
foreach($rows as $row)
|
685 |
-
{
|
686 |
-
$img_store_id=$row['store_id'];
|
687 |
-
$img_value_id=$row['value_id'];
|
688 |
-
$img_value=$row['value'];
|
689 |
-
$img_label=$row['label'];
|
690 |
-
$img_disabled=$row['disabled'];
|
691 |
-
$img_position=$row['position'];
|
692 |
-
|
693 |
-
$images_dst_disabled[$img_value_id]=$img_disabled;
|
694 |
-
$images_dst_position[$img_value_id]=$img_position;
|
695 |
-
|
696 |
-
if (($img_store_id==0) || ($img_store_id==$project['storeview_src']))
|
697 |
-
{
|
698 |
-
$images_orig[$img_value_id]=$img_label;
|
699 |
-
$images_orig_url[$img_value_id]=$img_value;
|
700 |
-
}
|
701 |
-
|
702 |
-
if ($img_store_id==$project['storeview_dst'])
|
703 |
-
{
|
704 |
-
$images_dstLabel[$img_value_id]=$img_label;
|
705 |
-
}
|
706 |
-
}
|
707 |
-
|
708 |
-
$hasImages=false;
|
709 |
-
$imagesNode=$doc->createElement("Images");
|
710 |
-
|
711 |
-
foreach($images_orig as $img_value_id => $img_label)
|
712 |
-
{
|
713 |
-
if(!array_key_exists($img_value_id,$images_dstLabel))
|
714 |
-
{
|
715 |
-
$images_dstLabel[$img_value_id]="";
|
716 |
-
}
|
717 |
-
|
718 |
-
$needsUpdate=$manualSelected;
|
719 |
-
if (strlen(trim($images_dstLabel[$img_value_id]))==0)
|
720 |
-
{
|
721 |
-
$needsUpdate=true;
|
722 |
-
}
|
723 |
-
|
724 |
-
if ($needsUpdate)
|
725 |
-
{
|
726 |
-
if (strlen(trim($img_label))>0)
|
727 |
-
{
|
728 |
-
$hasImages=true;
|
729 |
-
$hasChangedProperty=true;
|
730 |
-
|
731 |
-
$imageNode=$doc->createElement("Image");
|
732 |
-
$imagesNode->appendChild($imageNode);
|
733 |
-
|
734 |
-
$imageNodeId=$doc->createAttribute("value_id");
|
735 |
-
$imageNodeId->value=$img_value_id;
|
736 |
-
$imageNode->appendChild($imageNodeId);
|
737 |
-
|
738 |
-
$imageNodePosition=$doc->createAttribute("position");
|
739 |
-
$imageNodePosition->value=$images_dst_position[$img_value_id];
|
740 |
-
$imageNode->appendChild($imageNodePosition);
|
741 |
-
|
742 |
-
$imageNodeDisabled=$doc->createAttribute("disabled");
|
743 |
-
$imageNodeDisabled->value=$images_dst_disabled[$img_value_id];
|
744 |
-
$imageNode->appendChild($imageNodeDisabled);
|
745 |
-
|
746 |
-
// URL:
|
747 |
-
$img_url=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."catalog/product".$images_orig_url[$img_value_id];
|
748 |
-
|
749 |
-
$imageNodeUrl=$doc->createElement("Url");
|
750 |
-
$this->appendTextChild($imageNodeUrl,$img_url);
|
751 |
-
$imageNode->appendChild($imageNodeUrl);
|
752 |
-
|
753 |
-
// Label:
|
754 |
-
$labelNode=$doc->createElement("Label");
|
755 |
-
$this->appendTextChild($labelNode,$img_label);
|
756 |
-
$imageNode->appendChild($labelNode);
|
757 |
-
}
|
758 |
-
}
|
759 |
-
}
|
760 |
-
|
761 |
-
if ($hasImages)
|
762 |
-
{
|
763 |
-
$nodeArticle->appendChild($imagesNode);
|
764 |
-
}
|
765 |
-
}
|
766 |
-
|
767 |
-
// Options:
|
768 |
-
{
|
769 |
-
$optionsNode=$doc->createElement("Options");
|
770 |
-
$hasOptions=false;
|
771 |
-
|
772 |
-
$_options=$productSrc->getOptions();
|
773 |
-
if ($_options!==false)
|
774 |
-
{
|
775 |
-
foreach($_options as $_option)
|
776 |
-
/** @var Mage_Catalog_Model_Product_Option $_option */
|
777 |
-
{
|
778 |
-
$optionNode=$doc->createElement("Option");
|
779 |
-
|
780 |
-
$optionNodeIdAttribute=$doc->createAttribute("Id");
|
781 |
-
$optionNodeIdAttribute->value=$_option->getId();
|
782 |
-
$optionNode->appendChild($optionNodeIdAttribute);
|
783 |
-
|
784 |
-
$_optionTitle=$_option->getTitle();
|
785 |
-
if ($_optionTitle!==null)
|
786 |
-
{
|
787 |
-
$optionsNode->appendChild($optionNode);
|
788 |
-
$hasOptions=true;
|
789 |
-
|
790 |
-
$optionsNodeTitle=$doc->createElement("Title");
|
791 |
-
$this->appendTextChild($optionsNodeTitle,$_optionTitle);
|
792 |
-
$optionNode->appendChild($optionsNodeTitle);
|
793 |
-
|
794 |
-
// Values:
|
795 |
-
$hasValues=false;
|
796 |
-
$_values=$_option->getValues();
|
797 |
-
if ($_values!==null)
|
798 |
-
{
|
799 |
-
$valuesNode=$doc->createElement("Values");
|
800 |
-
|
801 |
-
foreach($_values as $_value)
|
802 |
-
{
|
803 |
-
$_valueTitle=$_value->getTitle();
|
804 |
-
if ($_valueTitle!==null)
|
805 |
-
{
|
806 |
-
$_valueId=$_value->getId();
|
807 |
-
|
808 |
-
$valueNode=$doc->createElement("Value");
|
809 |
-
|
810 |
-
$valueNodeIdAttribute=$doc->createAttribute("Id");
|
811 |
-
$valueNodeIdAttribute->value=$_valueId;
|
812 |
-
$valueNode->appendChild($valueNodeIdAttribute);
|
813 |
-
|
814 |
-
$valueNodeTitle=$doc->createElement("Title");
|
815 |
-
$this->appendTextChild($valueNodeTitle,$_valueTitle);
|
816 |
-
$valueNode->appendChild($valueNodeTitle);
|
817 |
-
|
818 |
-
$valuesNode->appendChild($valueNode);
|
819 |
-
|
820 |
-
$hasValues=true;
|
821 |
-
}
|
822 |
-
}
|
823 |
-
}
|
824 |
-
if ($hasValues)
|
825 |
-
{
|
826 |
-
$optionNode->appendChild($valuesNode);
|
827 |
-
}
|
828 |
-
}
|
829 |
-
}
|
830 |
-
}
|
831 |
-
|
832 |
-
if ($hasOptions)
|
833 |
-
{
|
834 |
-
$nodeArticle->appendChild($optionsNode);
|
835 |
-
}
|
836 |
-
}
|
837 |
-
|
838 |
-
if ($project['export_urlkeys']=="1")
|
839 |
-
{
|
840 |
-
// URL-Key:
|
841 |
-
if ($productSrc->getUrlKey()!="")
|
842 |
-
{
|
843 |
-
if ( ($productSrc->getUrlKey()==$productDst->getUrlKey()) || ($productDst->getUrlKey()=="") || ($manualSelected))
|
844 |
-
{
|
845 |
-
$hasChangedProperty=true;
|
846 |
-
|
847 |
-
$item=$doc->createElement("UrlKey");
|
848 |
-
$this->appendTextChild($item,$productSrc->getUrlKey());
|
849 |
-
$nodeArticle->appendChild($item);
|
850 |
-
}
|
851 |
-
}
|
852 |
-
}
|
853 |
-
|
854 |
-
if ($project['export_seo']=="1")
|
855 |
-
{
|
856 |
-
// Meta-Title:
|
857 |
-
if ($productSrc->getMetaTitle()!="")
|
858 |
-
{
|
859 |
-
if ( ($productSrc->getMetaTitle()==$productDst->getMetaTitle()) || ($productDst->getMetaTitle()=="") || ($manualSelected))
|
860 |
-
{
|
861 |
-
$hasChangedProperty=true;
|
862 |
-
|
863 |
-
$item=$doc->createElement("SeoTitle");
|
864 |
-
$this->appendTextChild($item,$productSrc->getMetaTitle());
|
865 |
-
$nodeArticle->appendChild($item);
|
866 |
-
}
|
867 |
-
}
|
868 |
-
|
869 |
-
// Meta-Description:
|
870 |
-
if ($productSrc->getMetaDescription()!="")
|
871 |
-
{
|
872 |
-
if ( ($productSrc->getMetaDescription()==$productDst->getMetaDescription()) || ($productDst->getMetaDescription()=="") || ($manualSelected))
|
873 |
-
{
|
874 |
-
$hasChangedProperty=true;
|
875 |
-
|
876 |
-
$item=$doc->createElement("SeoDescription");
|
877 |
-
$this->appendTextChild($item,$productSrc->getMetaDescription());
|
878 |
-
$nodeArticle->appendChild($item);
|
879 |
-
}
|
880 |
-
}
|
881 |
-
|
882 |
-
// Meta-Keywords:
|
883 |
-
if ($productSrc->getMetaKeyword()!="")
|
884 |
-
{
|
885 |
-
if ( ($productSrc->getMetaKeyword()==$productDst->getMetaKeyword()) || ($productDst->getMetaKeyword()=="") || ($manualSelected))
|
886 |
-
{
|
887 |
-
$hasChangedProperty=true;
|
888 |
-
|
889 |
-
$item=$doc->createElement("SeoKeywords");
|
890 |
-
$this->appendTextChild($item,$productSrc->getMetaKeyword());
|
891 |
-
$nodeArticle->appendChild($item);
|
892 |
-
}
|
893 |
-
}
|
894 |
-
}
|
895 |
-
|
896 |
-
if ($hasChangedProperty)
|
897 |
-
{
|
898 |
-
$nodeArticles->appendChild($nodeArticle);
|
899 |
-
}
|
900 |
-
|
901 |
-
$rv["offset"]=($offset+$maxItems);
|
902 |
-
}
|
903 |
-
|
904 |
-
if ($itemsFound)
|
905 |
-
{
|
906 |
-
$xmlDir=$this->getExportXMLPath($project);
|
907 |
-
$xmlDir.=DS."articles";
|
908 |
-
if (!is_dir($xmlDir))
|
909 |
-
{
|
910 |
-
mkdir($xmlDir);
|
911 |
-
}
|
912 |
-
|
913 |
-
$fileNum=($offset / $maxItems)+1;
|
914 |
-
$fileNum=intval($fileNum);
|
915 |
-
|
916 |
-
$xmlFilename=$xmlDir.DS."a".$fileNum.".xml";
|
917 |
-
|
918 |
-
$doc->save($xmlFilename);
|
919 |
-
}
|
920 |
-
else
|
921 |
-
{
|
922 |
-
// no further product found, go to next step:
|
923 |
-
$rv['step']=$this->STEP_COLLECT_CATEGORIES;
|
924 |
-
$rv["offset"]=0;
|
925 |
-
}
|
926 |
-
|
927 |
-
return $rv;
|
928 |
-
}
|
929 |
-
|
930 |
-
public function ajaxexportAction_CollectCMSPages($project, $offset)
|
931 |
-
{
|
932 |
-
$rv=array();
|
933 |
-
$rv["status_msg"]=$this->__("Checking CMS-Pages")."...";
|
934 |
-
$rv["offset"]=$offset;
|
935 |
-
$rv["step"]=$this->STEP_COLLECT_CMSPAGES;
|
936 |
-
|
937 |
-
$dbres = Mage::getSingleton('core/resource');
|
938 |
-
$dbw=$dbres->getConnection('core_write');
|
939 |
-
$dbr=$dbres->getConnection('core_read');
|
940 |
-
|
941 |
-
$page_id=-1;
|
942 |
-
|
943 |
-
$manualSelected=false;
|
944 |
-
|
945 |
-
if ($project['cmsmode']==1)
|
946 |
-
{
|
947 |
-
$cnt=intval($dbr->fetchOne("SELECT COUNT(*) cnt FROM `".$this->getTableName('cms_page')."` p, `".$this->getTableName('cms_page_store')."` s WHERE (s.page_id=p.page_id) AND ((s.store_id=0) OR (s.store_id=".$project['storeview_src']."))"));
|
948 |
-
|
949 |
-
// Pages:
|
950 |
-
$rows=$dbr->fetchAll("SELECT p.page_id, p.title FROM `".$this->getTableName('cms_page')."` p, `".$this->getTableName('cms_page_store')."` s WHERE (s.page_id=p.page_id) AND ((s.store_id=0) OR (s.store_id=".$project['storeview_src'].")) ORDER BY page_id ASC LIMIT $offset,1");
|
951 |
-
if (count($rows)>0)
|
952 |
-
{
|
953 |
-
$page_id=intval($rows[0]['page_id']);
|
954 |
-
$title=$rows[0]['title'];
|
955 |
-
|
956 |
-
$rv["status_msg"]="(".($offset+1)." / ".$cnt.") ".$this->__("Checking CMS-Page")." '".$title."'...";
|
957 |
-
}
|
958 |
-
}
|
959 |
-
else
|
960 |
-
{
|
961 |
-
$manualSelected=true;
|
962 |
-
|
963 |
-
$cnt=intval($dbr->fetchOne("SELECT COUNT(*) cnt FROM `".$this->getTableName('eurotext_project_cmspages')."` WHERE project_id=".$project['id']));
|
964 |
-
|
965 |
-
$rows=$dbr->fetchAll("SELECT p.page_id, p.title FROM `".$this->getTableName('cms_page')."` p, `".$this->getTableName('eurotext_project_cmspages')."` e WHERE (e.page_id=p.page_id) AND project_id=".$project['id']." ORDER BY p.page_id ASC LIMIT $offset,1");
|
966 |
-
if (count($rows)>0)
|
967 |
-
{
|
968 |
-
$page_id=intval($rows[0]['page_id']);
|
969 |
-
$title=$rows[0]['title'];
|
970 |
-
|
971 |
-
$rv["status_msg"]="(".($offset+1)." / ".$cnt.") ".$this->__("CMS-Page")." '".$title."'...";
|
972 |
-
}
|
973 |
-
}
|
974 |
-
|
975 |
-
if ($page_id>0)
|
976 |
-
{
|
977 |
-
// Compare languages:
|
978 |
-
$pageSrc = Mage::getModel('cms/page')->load($page_id);
|
979 |
-
$pageDst = Mage::getModel('cms/page')->load($page_id);
|
980 |
-
|
981 |
-
$page_id_dst=-1;
|
982 |
-
|
983 |
-
$identifier=$pageSrc->getIdentifier();
|
984 |
-
// Find matching page:
|
985 |
-
$matchingPages=$dbr->fetchAll("SELECT p.page_id FROM `".$this->getTableName('cms_page')."` p, `".$this->getTableName('cms_page_store')."` s WHERE (p.page_id=s.page_id) AND UPPER(p.identifier)=? AND s.store_id>0 AND s.store_id=? ORDER BY p.page_id ASC",array($identifier,$project['storeview_dst']));
|
986 |
-
if (count($matchingPages)>0)
|
987 |
-
{
|
988 |
-
$matchingPage=$matchingPages[0];
|
989 |
-
$page_id_dst=$matchingPage['page_id'];
|
990 |
-
|
991 |
-
$pageDst = Mage::getModel('cms/page')->load($page_id_dst);
|
992 |
-
}
|
993 |
-
|
994 |
-
$hasChangedProperty=false;
|
995 |
-
|
996 |
-
$doc = new DOMDocument('1.0', 'UTF-8');
|
997 |
-
$doc->formatOutput = true;
|
998 |
-
$cmsSites=$doc->createElement("cms-sites");
|
999 |
-
$doc->appendChild($cmsSites);
|
1000 |
-
$cmsSite = $doc->createElement("cms-site");
|
1001 |
-
$cmsSites->appendChild($cmsSite);
|
1002 |
-
|
1003 |
-
// ID:
|
1004 |
-
{
|
1005 |
-
$item=$doc->createElement("Id");
|
1006 |
-
$item->appendChild($doc->createTextNode($page_id));
|
1007 |
-
$cmsSite->appendChild($item);
|
1008 |
-
}
|
1009 |
-
|
1010 |
-
// Storeview_src:
|
1011 |
-
{
|
1012 |
-
$item=$doc->createElement("StoreviewSrc");
|
1013 |
-
$item->appendChild($doc->createTextNode($project['storeview_src']));
|
1014 |
-
$cmsSite->appendChild($item);
|
1015 |
-
}
|
1016 |
-
|
1017 |
-
// Storeview_dst:
|
1018 |
-
{
|
1019 |
-
$item=$doc->createElement("StoreviewDst");
|
1020 |
-
$item->appendChild($doc->createTextNode($project['storeview_dst']));
|
1021 |
-
$cmsSite->appendChild($item);
|
1022 |
-
}
|
1023 |
-
|
1024 |
-
// page_id_dst:
|
1025 |
-
{
|
1026 |
-
$item=$doc->createElement("PageIdDst");
|
1027 |
-
$item->appendChild($doc->createTextNode($page_id_dst));
|
1028 |
-
$cmsSite->appendChild($item);
|
1029 |
-
}
|
1030 |
-
|
1031 |
-
// Title:
|
1032 |
-
if ($pageSrc->getTitle()!="")
|
1033 |
-
{
|
1034 |
-
if ( ($pageSrc->getTitle()==$pageDst->getTitle()) || ($pageDst->getTitle()=="") || ($manualSelected))
|
1035 |
-
{
|
1036 |
-
$hasChangedProperty=true;
|
1037 |
-
|
1038 |
-
$item=$doc->createElement("Title");
|
1039 |
-
$this->appendTextChild($item,$pageSrc->getTitle());
|
1040 |
-
$cmsSite->appendChild($item);
|
1041 |
-
}
|
1042 |
-
}
|
1043 |
-
|
1044 |
-
// Content:
|
1045 |
-
if ($pageSrc->getContent()!="")
|
1046 |
-
{
|
1047 |
-
if ( ($pageSrc->getContent()==$pageDst->getContent()) || ($pageDst->getContent()=="") || ($manualSelected))
|
1048 |
-
{
|
1049 |
-
$hasChangedProperty=true;
|
1050 |
-
|
1051 |
-
$item=$doc->createElement("Content");
|
1052 |
-
$this->appendTextChild($item,$pageSrc->getContent());
|
1053 |
-
$cmsSite->appendChild($item);
|
1054 |
-
}
|
1055 |
-
}
|
1056 |
-
|
1057 |
-
// Content-Heading:
|
1058 |
-
if ($pageSrc->getContentHeading()!="")
|
1059 |
-
{
|
1060 |
-
if ( ($pageSrc->getContentHeading()==$pageDst->getContentHeading()) || ($pageDst->getContentHeading()=="") || ($manualSelected))
|
1061 |
-
{
|
1062 |
-
$hasChangedProperty=true;
|
1063 |
-
|
1064 |
-
$item=$doc->createElement("ContentHeading");
|
1065 |
-
$this->appendTextChild($item,$pageSrc->getContentHeading());
|
1066 |
-
$cmsSite->appendChild($item);
|
1067 |
-
}
|
1068 |
-
}
|
1069 |
-
|
1070 |
-
if ($project['export_seo']=="1")
|
1071 |
-
{
|
1072 |
-
// Meta-Keywords
|
1073 |
-
if ($pageSrc->getMetaKeywords()!="")
|
1074 |
-
{
|
1075 |
-
if ( ($pageSrc->getMetaKeywords()==$pageDst->getMetaKeywords()) || ($pageDst->getMetaKeywords()=="") || ($manualSelected))
|
1076 |
-
{
|
1077 |
-
$hasChangedProperty=true;
|
1078 |
-
|
1079 |
-
$item=$doc->createElement("SeoKeywords");
|
1080 |
-
$this->appendTextChild($item,$pageSrc->getMetaKeywords());
|
1081 |
-
$cmsSite->appendChild($item);
|
1082 |
-
}
|
1083 |
-
}
|
1084 |
-
|
1085 |
-
// Meta-Description:
|
1086 |
-
if ($pageSrc->getMetaDescription()!="")
|
1087 |
-
{
|
1088 |
-
if ( ($pageSrc->getMetaDescription()==$pageDst->getMetaDescription()) || ($pageDst->getMetaDescription()=="") || ($manualSelected))
|
1089 |
-
{
|
1090 |
-
$hasChangedProperty=true;
|
1091 |
-
|
1092 |
-
$item=$doc->createElement("SeoDescription");
|
1093 |
-
$this->appendTextChild($item,$pageSrc->getMetaDescription());
|
1094 |
-
$cmsSite->appendChild($item);
|
1095 |
-
}
|
1096 |
-
}
|
1097 |
-
}
|
1098 |
-
|
1099 |
-
if ($hasChangedProperty)
|
1100 |
-
{
|
1101 |
-
$xmlDir=$this->getExportXMLPath($project);
|
1102 |
-
$xmlDir.=DS."cms-sites";
|
1103 |
-
if (!is_dir($xmlDir))
|
1104 |
-
{
|
1105 |
-
mkdir($xmlDir);
|
1106 |
-
}
|
1107 |
-
|
1108 |
-
$xmlFilename=$xmlDir.DS."cms-".$this->getEurotextHelper()->GetFilenameSafeString($identifier)."-".$page_id.".xml";
|
1109 |
-
|
1110 |
-
$doc->save($xmlFilename);
|
1111 |
-
}
|
1112 |
-
|
1113 |
-
$rv["offset"]=($offset+1);
|
1114 |
-
}
|
1115 |
-
else
|
1116 |
-
{
|
1117 |
-
// no further cms-page found, go to next step:
|
1118 |
-
$rv['step']=$this->STEP_COLLECT_CMSBLOCKS;
|
1119 |
-
$rv["offset"]=0;
|
1120 |
-
}
|
1121 |
-
|
1122 |
-
return $rv;
|
1123 |
-
}
|
1124 |
-
|
1125 |
-
public function ajaxexportAction_CollectCMSBlocks($project, $offset)
|
1126 |
-
{
|
1127 |
-
$rv=array();
|
1128 |
-
$rv["status_msg"]=$this->__("Checking CMS-Blocks")."...";
|
1129 |
-
$rv["offset"]=$offset;
|
1130 |
-
$rv["step"]=$this->STEP_COLLECT_CMSBLOCKS;
|
1131 |
-
|
1132 |
-
$dbres = Mage::getSingleton('core/resource');
|
1133 |
-
$dbw=$dbres->getConnection('core_write');
|
1134 |
-
$dbr=$dbres->getConnection('core_read');
|
1135 |
-
|
1136 |
-
$block_id=-1;
|
1137 |
-
|
1138 |
-
$manualSelected=false;
|
1139 |
-
|
1140 |
-
if ($project['cmsmode']==1)
|
1141 |
-
{
|
1142 |
-
$cnt=intval($dbr->fetchOne("SELECT COUNT(*) cnt FROM `".$this->getTableName('cms_block')."` p, `".$this->getTableName('cms_block_store')."` s WHERE (s.block_id=p.block_id) AND ((s.store_id=0) OR (s.store_id=".$project['storeview_src']."))"));
|
1143 |
-
|
1144 |
-
// Blocks:
|
1145 |
-
$rows=$dbr->fetchAll("SELECT p.block_id, p.title FROM `".$this->getTableName('cms_block')."` p, `".$this->getTableName('cms_block_store')."` s WHERE (s.block_id=p.block_id) AND ((s.store_id=0) OR (s.store_id=".$project['storeview_src'].")) ORDER BY block_id ASC LIMIT $offset,1");
|
1146 |
-
if (count($rows)>0)
|
1147 |
-
{
|
1148 |
-
$block_id=intval($rows[0]['block_id']);
|
1149 |
-
$title=$rows[0]['title'];
|
1150 |
-
|
1151 |
-
$rv["status_msg"]="(".($offset+1)." / ".$cnt.") ".$this->__("Checking CMS-Block")." '".$title."'...";
|
1152 |
-
}
|
1153 |
-
}
|
1154 |
-
else
|
1155 |
-
{
|
1156 |
-
$manualSelected=true;
|
1157 |
-
|
1158 |
-
$cnt=intval($dbr->fetchOne("SELECT COUNT(*) cnt FROM `".$this->getTableName('eurotext_project_cmsblocks')."` WHERE project_id=".$project['id']));
|
1159 |
-
|
1160 |
-
$rows=$dbr->fetchAll("SELECT p.block_id, p.title FROM `".$this->getTableName('cms_block')."` p, `".$this->getTableName('eurotext_project_cmsblocks')."` e WHERE (e.block_id=p.block_id) AND project_id=".$project['id']." ORDER BY p.block_id ASC LIMIT $offset,1");
|
1161 |
-
if (count($rows)>0)
|
1162 |
-
{
|
1163 |
-
$block_id=intval($rows[0]['block_id']);
|
1164 |
-
$title=$rows[0]['title'];
|
1165 |
-
|
1166 |
-
$rv["status_msg"]="(".($offset+1)." / ".$cnt.") ".$this->__("Checking CMS-Block")." '".$title."'...";
|
1167 |
-
}
|
1168 |
-
}
|
1169 |
-
|
1170 |
-
if ($block_id>0)
|
1171 |
-
{
|
1172 |
-
// Compare languages:
|
1173 |
-
$blockSrc = Mage::getModel('cms/block')->load($block_id);
|
1174 |
-
$blockDst = Mage::getModel('cms/block')->load($block_id);
|
1175 |
-
|
1176 |
-
$block_id_dst=-1;
|
1177 |
-
|
1178 |
-
$identifier=$blockSrc->getIdentifier();
|
1179 |
-
// Find matching block:
|
1180 |
-
$matchingPages=$dbr->fetchAll("SELECT p.block_id FROM `".$this->getTableName('cms_block')."` p, `".$this->getTableName('cms_block_store')."` s WHERE (p.block_id=s.block_id) AND UPPER(p.identifier)=? AND s.store_id>0 AND s.store_id=? ORDER BY p.block_id ASC",array($identifier,$project['storeview_dst']));
|
1181 |
-
if (count($matchingPages)>0)
|
1182 |
-
{
|
1183 |
-
$matchingPage=$matchingPages[0];
|
1184 |
-
$block_id_dst=$matchingPage['block_id'];
|
1185 |
-
|
1186 |
-
$blockDst = Mage::getModel('cms/block')->load($block_id_dst);
|
1187 |
-
}
|
1188 |
-
|
1189 |
-
$hasChangedProperty=false;
|
1190 |
-
|
1191 |
-
$doc = new DOMDocument('1.0', 'UTF-8');
|
1192 |
-
$doc->formatOutput = true;
|
1193 |
-
$cmsSites=$doc->createElement("cms-sites");
|
1194 |
-
$doc->appendChild($cmsSites);
|
1195 |
-
$cmsSite = $doc->createElement("cms-site");
|
1196 |
-
$cmsSites->appendChild($cmsSite);
|
1197 |
-
|
1198 |
-
// ID:
|
1199 |
-
{
|
1200 |
-
$item=$doc->createElement("Id");
|
1201 |
-
$item->appendChild($doc->createTextNode($block_id));
|
1202 |
-
$cmsSite->appendChild($item);
|
1203 |
-
}
|
1204 |
-
|
1205 |
-
// Storeview_src:
|
1206 |
-
{
|
1207 |
-
$item=$doc->createElement("StoreviewSrc");
|
1208 |
-
$item->appendChild($doc->createTextNode($project['storeview_src']));
|
1209 |
-
$cmsSite->appendChild($item);
|
1210 |
-
}
|
1211 |
-
|
1212 |
-
// Storeview_dst:
|
1213 |
-
{
|
1214 |
-
$item=$doc->createElement("StoreviewDst");
|
1215 |
-
$item->appendChild($doc->createTextNode($project['storeview_dst']));
|
1216 |
-
$cmsSite->appendChild($item);
|
1217 |
-
}
|
1218 |
-
|
1219 |
-
// block_id_dst:
|
1220 |
-
{
|
1221 |
-
$item=$doc->createElement("PageIdDst");
|
1222 |
-
$item->appendChild($doc->createTextNode($block_id_dst));
|
1223 |
-
$cmsSite->appendChild($item);
|
1224 |
-
}
|
1225 |
-
|
1226 |
-
// Title:
|
1227 |
-
if ($blockSrc->getTitle()!="")
|
1228 |
-
{
|
1229 |
-
if ( ($blockSrc->getTitle()==$blockDst->getTitle()) || ($blockDst->getTitle()=="") || ($manualSelected))
|
1230 |
-
{
|
1231 |
-
$hasChangedProperty=true;
|
1232 |
-
|
1233 |
-
$item=$doc->createElement("Title");
|
1234 |
-
$this->appendTextChild($item,$blockSrc->getTitle());
|
1235 |
-
$cmsSite->appendChild($item);
|
1236 |
-
}
|
1237 |
-
}
|
1238 |
-
|
1239 |
-
// Content:
|
1240 |
-
if ($blockSrc->getContent()!="")
|
1241 |
-
{
|
1242 |
-
if ( ($blockSrc->getContent()==$blockDst->getContent()) || ($blockDst->getContent()=="") || ($manualSelected))
|
1243 |
-
{
|
1244 |
-
$hasChangedProperty=true;
|
1245 |
-
|
1246 |
-
$item=$doc->createElement("Content");
|
1247 |
-
$this->appendTextChild($item,$blockSrc->getContent());
|
1248 |
-
$cmsSite->appendChild($item);
|
1249 |
-
}
|
1250 |
-
}
|
1251 |
-
|
1252 |
-
// Content-Heading:
|
1253 |
-
if ($blockSrc->getContentHeading()!="")
|
1254 |
-
{
|
1255 |
-
if ( ($blockSrc->getContentHeading()==$blockDst->getContentHeading()) || ($blockDst->getContentHeading()=="") || ($manualSelected))
|
1256 |
-
{
|
1257 |
-
$hasChangedProperty=true;
|
1258 |
-
|
1259 |
-
$item=$doc->createElement("ContentHeading");
|
1260 |
-
$this->appendTextChild($item,$blockSrc->getContentHeading());
|
1261 |
-
$cmsSite->appendChild($item);
|
1262 |
-
}
|
1263 |
-
}
|
1264 |
-
|
1265 |
-
if ($project['export_seo']=="1")
|
1266 |
-
{
|
1267 |
-
// Meta-Keywords
|
1268 |
-
if ($blockSrc->getMetaKeywords()!="")
|
1269 |
-
{
|
1270 |
-
if ( ($blockSrc->getMetaKeywords()==$blockDst->getMetaKeywords()) || ($blockDst->getMetaKeywords()=="") || ($manualSelected))
|
1271 |
-
{
|
1272 |
-
$hasChangedProperty=true;
|
1273 |
-
|
1274 |
-
$item=$doc->createElement("SeoKeywords");
|
1275 |
-
$this->appendTextChild($item,$blockSrc->getMetaKeywords());
|
1276 |
-
$cmsSite->appendChild($item);
|
1277 |
-
}
|
1278 |
-
}
|
1279 |
-
|
1280 |
-
// Meta-Description:
|
1281 |
-
if ($blockSrc->getMetaDescription()!="")
|
1282 |
-
{
|
1283 |
-
if ( ($blockSrc->getMetaDescription()==$blockDst->getMetaDescription()) || ($blockDst->getMetaDescription()=="") || ($manualSelected))
|
1284 |
-
{
|
1285 |
-
$hasChangedProperty=true;
|
1286 |
-
|
1287 |
-
$item=$doc->createElement("SeoDescription");
|
1288 |
-
$this->appendTextChild($item,$blockSrc->getMetaDescription());
|
1289 |
-
$cmsSite->appendChild($item);
|
1290 |
-
}
|
1291 |
-
}
|
1292 |
-
}
|
1293 |
-
|
1294 |
-
if ($hasChangedProperty)
|
1295 |
-
{
|
1296 |
-
$xmlDir=$this->getExportXMLPath($project);
|
1297 |
-
$xmlDir.=DS."cms-sites";
|
1298 |
-
if (!is_dir($xmlDir))
|
1299 |
-
{
|
1300 |
-
mkdir($xmlDir);
|
1301 |
-
}
|
1302 |
-
|
1303 |
-
$xmlFilename=$xmlDir.DS."cmsblock-".$this->getEurotextHelper()->GetFilenameSafeString($identifier)."-".$block_id.".xml";
|
1304 |
-
|
1305 |
-
$doc->save($xmlFilename);
|
1306 |
-
}
|
1307 |
-
|
1308 |
-
$rv["offset"]=($offset+1);
|
1309 |
-
}
|
1310 |
-
else
|
1311 |
-
{
|
1312 |
-
// no further cms-block found, go to next step:
|
1313 |
-
$rv['step']=$this->STEP_COLLECT_TEMPLATES;
|
1314 |
-
$rv["offset"]=0;
|
1315 |
-
}
|
1316 |
-
|
1317 |
-
return $rv;
|
1318 |
-
}
|
1319 |
-
|
1320 |
-
public function ajaxexportAction_CollectTemplates($project, $offset)
|
1321 |
-
{
|
1322 |
-
$rv=array();
|
1323 |
-
$rv["status_msg"]=$this->__("Checking eMail-Templates")."...";
|
1324 |
-
$rv["offset"]=$offset;
|
1325 |
-
$rv["step"]=$this->STEP_COLLECT_TEMPLATES;
|
1326 |
-
|
1327 |
-
$dbres = Mage::getSingleton('core/resource');
|
1328 |
-
$dbw=$dbres->getConnection('core_write');
|
1329 |
-
$dbr=$dbres->getConnection('core_read');
|
1330 |
-
|
1331 |
-
$manualSelected=false;
|
1332 |
-
|
1333 |
-
if ($offset==0)
|
1334 |
-
{
|
1335 |
-
$helper=$this->getHelper();
|
1336 |
-
$helper->ajaxexportAction_CollectEMailTemplates($project);
|
1337 |
-
}
|
1338 |
-
|
1339 |
-
$sql_cnt="SELECT COUNT(*) cnt FROM `".$this->getTableName('eurotext_emailtemplates')."` WHERE deleteflag=0 AND project_id=".$project['id']." AND locale_dst='".$project['storeview_src_locale']."'";
|
1340 |
-
$sql_fetch="SELECT * FROM `".$this->getTableName('eurotext_emailtemplates')."` WHERE deleteflag=0 AND project_id=".$project['id']." AND locale_dst='".$project['storeview_src_locale']."'";
|
1341 |
-
|
1342 |
-
if ($project['templatemode']==0)
|
1343 |
-
{
|
1344 |
-
$manualSelected=true;
|
1345 |
-
|
1346 |
-
$sql_cnt.=" AND translate_flag=1";
|
1347 |
-
$sql_fetch.=" AND translate_flag=1";
|
1348 |
-
}
|
1349 |
-
|
1350 |
-
$sql_fetch.=" ORDER BY filename ASC, file_hash ASC LIMIT $offset,1";
|
1351 |
-
|
1352 |
-
$cnt=intval($dbr->fetchOne($sql_cnt));
|
1353 |
-
|
1354 |
-
$rows=$dbr->fetchAll($sql_fetch);
|
1355 |
-
if (count($rows)>0)
|
1356 |
-
{
|
1357 |
-
$filename=$rows[0]['filename'];
|
1358 |
-
$locale_dst=$rows[0]['locale_dst'];
|
1359 |
-
|
1360 |
-
$rv["status_msg"]="(".($offset+1)." / ".$cnt.") ".$this->__("Checking eMail-Template")." '".$filename."'...";
|
1361 |
-
|
1362 |
-
$xmlDir=$this->getExportXMLPath($project);
|
1363 |
-
$xmlDir.=DS."emailtemplates";
|
1364 |
-
if (!is_dir($xmlDir))
|
1365 |
-
{
|
1366 |
-
mkdir($xmlDir);
|
1367 |
-
}
|
1368 |
-
|
1369 |
-
$baseLocaleFolder=Mage::getBaseDir('locale');
|
1370 |
-
|
1371 |
-
$src_filename=$baseLocaleFolder.DS.$locale_dst.DS."template".$filename;
|
1372 |
-
$dst_filename=$baseLocaleFolder.DS.$project['storeview_dst_locale'].DS."template".$filename;
|
1373 |
-
|
1374 |
-
if ((!$manualSelected) && (file_exists($dst_filename)))
|
1375 |
-
{
|
1376 |
-
// "Datei schon übersetzt!"
|
1377 |
-
}
|
1378 |
-
else
|
1379 |
-
{
|
1380 |
-
$copyto_filename=$xmlDir.$filename;
|
1381 |
-
$copyto_path=$this->getEurotextHelper()->GetDirectoryFromPath($copyto_filename);
|
1382 |
-
if (!is_dir($copyto_path))
|
1383 |
-
{
|
1384 |
-
mkdir($copyto_path,0777,true);
|
1385 |
-
}
|
1386 |
-
|
1387 |
-
copy($src_filename,$copyto_filename);
|
1388 |
-
}
|
1389 |
-
|
1390 |
-
$rv["offset"]=($offset+1);
|
1391 |
-
}
|
1392 |
-
else
|
1393 |
-
{
|
1394 |
-
// no further cms-page found, go to next step:
|
1395 |
-
$rv['step']=$this->STEP_EXPORT_ATTRIBUTES;
|
1396 |
-
$rv["offset"]=0;
|
1397 |
-
}
|
1398 |
-
|
1399 |
-
return $rv;
|
1400 |
-
}
|
1401 |
-
|
1402 |
-
public function getProjectZipFilename($project)
|
1403 |
-
{
|
1404 |
-
$xmlDir=$this->getExportXMLPath($project);
|
1405 |
-
|
1406 |
-
if ($project['zip_filename']!="")
|
1407 |
-
{
|
1408 |
-
return $xmlDir.DS.$project['zip_filename'];
|
1409 |
-
}
|
1410 |
-
|
1411 |
-
$helper=$this->getHelper();
|
1412 |
-
|
1413 |
-
$shopName=$this->getEurotextHelper()->GetFilenameSafeString($helper->getSetting("register_shopname","shop"));
|
1414 |
-
$customer_id = $this->getEurotextHelper()->GetFilenameSafeString($helper->getSetting('eurotext_customerid','no-customerid'));
|
1415 |
-
$filename="ET-".$customer_id.'-'.$shopName.'-'.date("Y-m-d_h-i-s").'_'.date_default_timezone_get().".zip";
|
1416 |
-
|
1417 |
-
$dbres = Mage::getSingleton('core/resource');
|
1418 |
-
$dbw=$dbres->getConnection('core_write');
|
1419 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_project')."` SET zip_filename=? WHERE id=?",array($filename,$project['id']));
|
1420 |
-
|
1421 |
-
$project['zip_filename']=$filename;
|
1422 |
-
|
1423 |
-
return $xmlDir.DIRECTORY_SEPARATOR."".$filename;
|
1424 |
-
}
|
1425 |
-
|
1426 |
-
public function ajaxexportAction_GenerateControlFile($project)
|
1427 |
-
{
|
1428 |
-
$xmlDir=$this->getExportXMLPath($project);
|
1429 |
-
|
1430 |
-
$helper=$this->getHelper();
|
1431 |
-
$register_fname=$helper->getSetting("register_fname","");
|
1432 |
-
$register_lname=$helper->getSetting("register_lname","");
|
1433 |
-
$register_company=$helper->getSetting("register_company","");
|
1434 |
-
$register_email=$helper->getSetting("register_email","");
|
1435 |
-
$eurotext_customerid=$helper->getSetting("eurotext_customerid","");
|
1436 |
-
|
1437 |
-
$doc = new DOMDocument('1.0', 'UTF-8');
|
1438 |
-
$doc->formatOutput = true;
|
1439 |
-
|
1440 |
-
// utf8-detection comment:
|
1441 |
-
$defComment=$doc->createComment("allow utf8-detection: öäü€");
|
1442 |
-
$doc->appendChild($defComment);
|
1443 |
-
|
1444 |
-
$nodeRequest = $doc->createElement("Request");
|
1445 |
-
$doc->appendChild($nodeRequest);
|
1446 |
-
{
|
1447 |
-
$nodeGeneral = $doc->createElement("General");
|
1448 |
-
$nodeRequest->appendChild($nodeGeneral);
|
1449 |
-
{
|
1450 |
-
$nodeCustomerContact= $doc->createElement("CustomerContact");
|
1451 |
-
$nodeCustomerContact->appendChild($doc->createTextNode($register_fname." ".$register_lname));
|
1452 |
-
$nodeGeneral->appendChild($nodeCustomerContact);
|
1453 |
-
|
1454 |
-
$nodeCustomerMail= $doc->createElement("CustomerMail");
|
1455 |
-
$nodeCustomerMail->appendChild($doc->createTextNode($register_email));
|
1456 |
-
$nodeGeneral->appendChild($nodeCustomerMail);
|
1457 |
-
|
1458 |
-
$nodeCustomerID_of_Supplier= $doc->createElement("CustomerID_of_Supplier");
|
1459 |
-
$nodeCustomerID_of_Supplier->appendChild($doc->createTextNode($eurotext_customerid));
|
1460 |
-
$nodeGeneral->appendChild($nodeCustomerID_of_Supplier);
|
1461 |
-
|
1462 |
-
$nodeProjectName= $doc->createElement("ProjectName");
|
1463 |
-
$nodeProjectName->appendChild($doc->createTextNode($project['project_name']));
|
1464 |
-
$nodeGeneral->appendChild($nodeProjectName);
|
1465 |
-
|
1466 |
-
$moduleVersion=$this->getModuleVersion();
|
1467 |
-
|
1468 |
-
$src_name=Mage::getModel('core/store')->load($project['storeview_src'])->getName();
|
1469 |
-
$dst_name=Mage::getModel('core/store')->load($project['storeview_dst'])->getName();
|
1470 |
-
|
1471 |
-
$commentText="Magento-Project-Id: ".$project['id'].", Module-Version: $moduleVersion\n\n";
|
1472 |
-
$commentText.="Src-Storeview: '".$src_name."' (".$project['storeview_src_locale'].")\n";
|
1473 |
-
$commentText.="Dst-Storeview: '".$dst_name."' (".$project['storeview_dst_locale'].")\n";
|
1474 |
-
$commentText.="Export SEO content: ".($project['export_seo'] ? "Yes" : "No")."\n";
|
1475 |
-
$commentText.="Export attributes and attribute options? ".($project['export_attributes'] ? "Yes" : "No")."\n";
|
1476 |
-
$commentText.="Export URL keys? ".($project['export_urlkeys'] ? "Yes" : "No");
|
1477 |
-
|
1478 |
-
$nodeDescription= $doc->createElement("Description");
|
1479 |
-
$nodeDescription->appendChild($doc->createTextNode($commentText));
|
1480 |
-
$nodeGeneral->appendChild($nodeDescription);
|
1481 |
-
|
1482 |
-
$nodeDeadline= $doc->createElement("Deadline");
|
1483 |
-
$nodeGeneral->appendChild($nodeDeadline);
|
1484 |
-
|
1485 |
-
$nodeTargetProject= $doc->createElement("TargetProject");
|
1486 |
-
$nodeTargetProject->appendChild($doc->createTextNode("Quote"));
|
1487 |
-
$nodeGeneral->appendChild($nodeTargetProject);
|
1488 |
-
}
|
1489 |
-
|
1490 |
-
$nodeLanguageCombinations= $doc->createElement("LanguageCombinations");
|
1491 |
-
$nodeRequest->appendChild($nodeLanguageCombinations);
|
1492 |
-
|
1493 |
-
$locale_dst=$project['storeview_dst_locale'];
|
1494 |
-
$locale_src=$project['storeview_src_locale'];
|
1495 |
-
|
1496 |
-
// Shop-Translations:
|
1497 |
-
$allFiles=$this->getEurotextHelper()->getDirectoryContent($xmlDir,true,true,false);
|
1498 |
-
$frameworkFiles=array();
|
1499 |
-
$articlesFiles=array();
|
1500 |
-
$attributesFiles=array();
|
1501 |
-
$categoriesFiles=array();
|
1502 |
-
$cmsFiles=array();
|
1503 |
-
$emailtemplatesFiles=array();
|
1504 |
-
|
1505 |
-
foreach($allFiles as $file)
|
1506 |
-
{
|
1507 |
-
if (stripos($file['full_path'],DS."framework".DS)!==false)
|
1508 |
-
{
|
1509 |
-
array_push($frameworkFiles,$file);
|
1510 |
-
}
|
1511 |
-
elseif (stripos($file['full_path'],DS."articles".DS)!==false)
|
1512 |
-
{
|
1513 |
-
array_push($articlesFiles,$file);
|
1514 |
-
}
|
1515 |
-
elseif (stripos($file['full_path'],DS."attributes".DS)!==false)
|
1516 |
-
{
|
1517 |
-
array_push($attributesFiles,$file);
|
1518 |
-
}
|
1519 |
-
elseif (stripos($file['full_path'],DS."categories".DS)!==false)
|
1520 |
-
{
|
1521 |
-
array_push($categoriesFiles,$file);
|
1522 |
-
}
|
1523 |
-
elseif (stripos($file['full_path'],DS."cms-sites".DS)!==false)
|
1524 |
-
{
|
1525 |
-
array_push($cmsFiles,$file);
|
1526 |
-
}
|
1527 |
-
elseif (stripos($file['full_path'],DS."emailtemplates".DS)!==false)
|
1528 |
-
{
|
1529 |
-
array_push($emailtemplatesFiles,$file);
|
1530 |
-
}
|
1531 |
-
else
|
1532 |
-
{
|
1533 |
-
$rv=array();
|
1534 |
-
$rv['status_code']="error";
|
1535 |
-
$rv['status_msg']="Unknown file: '".$file['full_path']."'";
|
1536 |
-
|
1537 |
-
Mage::app()->getResponse()->clearBody();
|
1538 |
-
Mage::app()->getResponse()->setBody(json_encode($rv));
|
1539 |
-
Mage::app()->getResponse()->sendResponse();
|
1540 |
-
|
1541 |
-
// @todo Hässlicher Magento Hack, da man die Ausgabe anders nicht abbrechen kann
|
1542 |
-
exit();
|
1543 |
-
|
1544 |
-
}
|
1545 |
-
}
|
1546 |
-
|
1547 |
-
$fileGroups=array();
|
1548 |
-
array_push($fileGroups,$frameworkFiles);
|
1549 |
-
array_push($fileGroups,$articlesFiles);
|
1550 |
-
array_push($fileGroups,$attributesFiles);
|
1551 |
-
array_push($fileGroups,$categoriesFiles);
|
1552 |
-
array_push($fileGroups,$cmsFiles);
|
1553 |
-
array_push($fileGroups,$emailtemplatesFiles);
|
1554 |
-
|
1555 |
-
foreach($fileGroups as $fileGroup)
|
1556 |
-
{
|
1557 |
-
if (count($fileGroup)>0)
|
1558 |
-
{
|
1559 |
-
$nodeLanguageCombination=$doc->createElement("LanguageCombination");
|
1560 |
-
{
|
1561 |
-
$source=$doc->createAttribute("source");
|
1562 |
-
|
1563 |
-
$eurotext_locale_src=$helper->getLocaleInfoByMagentoLocale($locale_src);
|
1564 |
-
if ($eurotext_locale_src['supported']==false)
|
1565 |
-
{
|
1566 |
-
die("Sprache wird durch Eurotext nicht unterstützt: '".$locale_src."'");
|
1567 |
-
}
|
1568 |
-
|
1569 |
-
$source->value=$eurotext_locale_src['locale_eurotext'];
|
1570 |
-
$nodeLanguageCombination->appendChild($source);
|
1571 |
-
}
|
1572 |
-
{
|
1573 |
-
$eurotext_locale_dst=$helper->getLocaleInfoByMagentoLocale($locale_dst);
|
1574 |
-
if ($eurotext_locale_dst['supported']==false)
|
1575 |
-
{
|
1576 |
-
die("Sprache wird durch Eurotext nicht unterstützt: '".$locale_dst."'");
|
1577 |
-
}
|
1578 |
-
|
1579 |
-
$target=$doc->createAttribute("target");
|
1580 |
-
$target->value=$eurotext_locale_dst['locale_eurotext'];
|
1581 |
-
$nodeLanguageCombination->appendChild($target);
|
1582 |
-
}
|
1583 |
-
$nodeLanguageCombinations->appendChild($nodeLanguageCombination);
|
1584 |
-
|
1585 |
-
foreach($fileGroup as $otherFile)
|
1586 |
-
{
|
1587 |
-
$relative_filename=substr($otherFile['full_path'],strlen($xmlDir)+1);
|
1588 |
-
$fsize=filesize($otherFile['full_path']);
|
1589 |
-
|
1590 |
-
$nodeUploadedFile=$doc->createElement("uploadedFile");
|
1591 |
-
$nodeLanguageCombination->appendChild($nodeUploadedFile);
|
1592 |
-
{
|
1593 |
-
$attrfileName=$doc->createAttribute("fileName");
|
1594 |
-
$attrfileName->value=$relative_filename;
|
1595 |
-
$nodeUploadedFile->appendChild($attrfileName);
|
1596 |
-
}
|
1597 |
-
{
|
1598 |
-
$attrsize=$doc->createAttribute("size");
|
1599 |
-
$attrsize->value=$fsize;
|
1600 |
-
$nodeUploadedFile->appendChild($attrsize);
|
1601 |
-
}
|
1602 |
-
}
|
1603 |
-
}
|
1604 |
-
}
|
1605 |
-
}
|
1606 |
-
|
1607 |
-
$xmlFilename=$xmlDir.DS."control.xml";
|
1608 |
-
$doc->save($xmlFilename);
|
1609 |
-
}
|
1610 |
-
|
1611 |
-
public function ajaxexportAction_CompressFiles($project)
|
1612 |
-
{
|
1613 |
-
$xmlDir=$this->getExportXMLPath($project);
|
1614 |
-
$genZip=$this->getEurotextHelper()->zipFolder($xmlDir,$this->getProjectZipFilename($project),"Created by Eurotext Magento Module");
|
1615 |
-
}
|
1616 |
-
|
1617 |
-
public function ajaxexportAction_TransmitArchive($project)
|
1618 |
-
{
|
1619 |
-
$zipFile=$this->getProjectZipFilename($project);
|
1620 |
-
$helper=$this->getHelper();
|
1621 |
-
$fallback_filename=Mage::getBaseDir('export').DS.$project['zip_filename'];
|
1622 |
-
$ftp_upload_successful = false;
|
1623 |
-
|
1624 |
-
$ftp_username=$helper->getSetting("eurotext_username","");
|
1625 |
-
$ftp_password=Mage::helper('core')->decrypt($helper->getSetting("eurotext_password",""));
|
1626 |
-
|
1627 |
-
$testResult=$helper->testFtpConnection();
|
1628 |
-
|
1629 |
-
if ($testResult['ok']!=true)
|
1630 |
-
{
|
1631 |
-
die("Archive could not be transmitted. Please use the debug info in var/log/eurotext_fatal.log");
|
1632 |
-
}
|
1633 |
-
else {
|
1634 |
-
if($ftpConn = $helper->openFtpConnection()) {
|
1635 |
-
if (@ftp_login($ftpConn, $ftp_username, $ftp_password)) {
|
1636 |
-
// Switch to Passive-Mode:
|
1637 |
-
ftp_pasv($ftpConn, true);
|
1638 |
-
|
1639 |
-
ftp_chdir($ftpConn, "/");
|
1640 |
-
|
1641 |
-
// Delete old files with same name
|
1642 |
-
@ftp_delete($ftpConn, $project['zip_filename']);
|
1643 |
-
@ftp_delete($ftpConn, $project['zip_filename'] . ".uploading");
|
1644 |
-
|
1645 |
-
// Upload with .uploading extension
|
1646 |
-
if(ftp_put($ftpConn, $project['zip_filename'] . ".uploading", $zipFile, FTP_BINARY)) {
|
1647 |
-
$helper->log('File was successfully uploaded to ' . $project['zip_filename'].'.uploading', Zend_Log::INFO);
|
1648 |
-
}
|
1649 |
-
|
1650 |
-
// Remove .uploading extension
|
1651 |
-
if (ftp_rename($ftpConn, $project['zip_filename'] . ".uploading", $project['zip_filename'])) {
|
1652 |
-
$ftp_upload_successful = true;
|
1653 |
-
$helper->log('File was successfully renamed to ' . $project['zip_filename'], Zend_Log::INFO);
|
1654 |
-
}
|
1655 |
-
} else {
|
1656 |
-
$helper->log('Could not login to Translation Portal Server.', Zend_Log::ERR);
|
1657 |
-
}
|
1658 |
-
|
1659 |
-
ftp_close($ftpConn);
|
1660 |
-
}
|
1661 |
-
}
|
1662 |
-
|
1663 |
-
if(false === $ftp_upload_successful || true === $helper->getDebugMode())
|
1664 |
-
{
|
1665 |
-
if(false === copy($zipFile,$fallback_filename)) {
|
1666 |
-
$helper->log('Could not copy the project data file to '.$fallback_filename, Zend_Log::ERR);
|
1667 |
-
}
|
1668 |
-
}
|
1669 |
-
|
1670 |
-
// Clear project folder:
|
1671 |
-
$xmlPath=$this->getExportXMLPath($project);
|
1672 |
-
$this->deleteDirectoryRecursive($xmlPath);
|
1673 |
-
|
1674 |
-
$this->updateProjectState($project['id'],1); // 1 = Processing
|
1675 |
-
}
|
1676 |
-
|
1677 |
-
public function ajaxexportAction_CollectCategories($project, $offset)
|
1678 |
-
{
|
1679 |
-
$rv=array();
|
1680 |
-
$rv["status_msg"]=$this->__("Checking category")."...";
|
1681 |
-
$rv["offset"]=$offset;
|
1682 |
-
$rv["step"]=$this->STEP_COLLECT_CATEGORIES;
|
1683 |
-
|
1684 |
-
$dbres = Mage::getSingleton('core/resource');
|
1685 |
-
$dbw=$dbres->getConnection('core_write');
|
1686 |
-
$dbr=$dbres->getConnection('core_read');
|
1687 |
-
|
1688 |
-
$cat_id=-1;
|
1689 |
-
|
1690 |
-
$helper=$this->getHelper();
|
1691 |
-
$maxItems=intval($helper->getSetting("et_categories_per_file",20));
|
1692 |
-
if ($maxItems<1) { $maxItems=20; }
|
1693 |
-
|
1694 |
-
$manualSelected=false;
|
1695 |
-
|
1696 |
-
if ($project['categorymode']==1)
|
1697 |
-
{
|
1698 |
-
if ($offset==0)
|
1699 |
-
{
|
1700 |
-
// Reset table:
|
1701 |
-
//$dbw->query("DELETE FROM eurotext_project_products WHERE project_id=?;",array($project['id']));
|
1702 |
-
}
|
1703 |
-
|
1704 |
-
$cnt=intval($dbr->fetchOne("SELECT COUNT(*) cnt FROM `".$this->getTableName('catalog_category_entity')."`"));
|
1705 |
-
|
1706 |
-
$rows=$dbr->fetchAll("SELECT entity_id FROM `".$this->getTableName('catalog_category_entity')."` ORDER BY entity_id ASC LIMIT $offset,$maxItems");
|
1707 |
-
}
|
1708 |
-
else
|
1709 |
-
{
|
1710 |
-
$cnt=intval($dbr->fetchOne("SELECT COUNT(*) cnt FROM `".$this->getTableName('catalog_category_entity')."` e, `".$this->getTableName('eurotext_project_categories')."` p WHERE (e.entity_id=p.category_id) AND project_id=".$project['id']));
|
1711 |
-
|
1712 |
-
$manualSelected=true;
|
1713 |
-
$rows=$dbr->fetchAll("SELECT e.entity_id FROM `".$this->getTableName('catalog_category_entity')."` e, `".$this->getTableName('eurotext_project_categories')."` p WHERE (e.entity_id=p.category_id) AND project_id=".$project['id']." ORDER BY e.entity_id ASC LIMIT $offset,$maxItems");
|
1714 |
-
}
|
1715 |
-
|
1716 |
-
$itemsFound=false;
|
1717 |
-
|
1718 |
-
$doc = new DOMDocument('1.0', 'UTF-8');
|
1719 |
-
$doc->formatOutput = true;
|
1720 |
-
|
1721 |
-
$cats = $doc->createElement("categories");
|
1722 |
-
$doc->appendChild($cats);
|
1723 |
-
|
1724 |
-
foreach($rows as $row)
|
1725 |
-
{
|
1726 |
-
$itemsFound=true;
|
1727 |
-
|
1728 |
-
$cat_id=intval($row['entity_id']);
|
1729 |
-
$rv["status_msg"]="(".($offset+1)." / ".$cnt.") ".$this->__("Checking category")." ID=".$cat_id;
|
1730 |
-
|
1731 |
-
// Compare languages:
|
1732 |
-
$catSrc = Mage::getModel('catalog/category')->setStoreId($project['storeview_src'])->load($cat_id);
|
1733 |
-
$catDst = Mage::getModel('catalog/category')->setStoreId($project['storeview_dst'])->load($cat_id);
|
1734 |
-
|
1735 |
-
$hasChangedProperty=false;
|
1736 |
-
|
1737 |
-
$cat = $doc->createElement("category");
|
1738 |
-
|
1739 |
-
$nodeId = $doc->createElement("Id");
|
1740 |
-
$nodeId->appendChild($doc->createTextNode($cat_id));
|
1741 |
-
$cat->appendChild($nodeId);
|
1742 |
-
|
1743 |
-
$nodeUrl = $doc->createElement("Url");
|
1744 |
-
$this->appendTextChild($nodeUrl,$catSrc->getUrl());
|
1745 |
-
$cat->appendChild($nodeUrl);
|
1746 |
-
|
1747 |
-
// Name:
|
1748 |
-
if ($catSrc->getName()!="")
|
1749 |
-
{
|
1750 |
-
if ( ($catSrc->getName()==$catDst->getName()) || ($catDst->getName()=="") || ($manualSelected))
|
1751 |
-
{
|
1752 |
-
$hasChangedProperty=true;
|
1753 |
-
|
1754 |
-
$item=$doc->createElement("Title");
|
1755 |
-
$this->appendTextChild($item,$catSrc->getName());
|
1756 |
-
$cat->appendChild($item);
|
1757 |
-
}
|
1758 |
-
}
|
1759 |
-
|
1760 |
-
// Description:
|
1761 |
-
if ($catSrc->getDescription()!="")
|
1762 |
-
{
|
1763 |
-
if ( ($catSrc->getDescription()==$catDst->getDescription()) || ($catDst->getDescription()=="") || ($manualSelected))
|
1764 |
-
{
|
1765 |
-
$hasChangedProperty=true;
|
1766 |
-
|
1767 |
-
$item=$doc->createElement("Longdesc");
|
1768 |
-
$this->appendTextChild($item,$catSrc->getDescription());
|
1769 |
-
$cat->appendChild($item);
|
1770 |
-
}
|
1771 |
-
}
|
1772 |
-
|
1773 |
-
// Short-Description:
|
1774 |
-
if ($catSrc->getShortDescription()!="")
|
1775 |
-
{
|
1776 |
-
if ( ($catSrc->getShortDescription()==$catDst->getShortDescription()) || ($catDst->getShortDescription()=="") || ($manualSelected))
|
1777 |
-
{
|
1778 |
-
$hasChangedProperty=true;
|
1779 |
-
|
1780 |
-
$item=$doc->createElement("Shortdesc");
|
1781 |
-
$this->appendTextChild($item,$catSrc->getShortDescription());
|
1782 |
-
$cat->appendChild($item);
|
1783 |
-
}
|
1784 |
-
}
|
1785 |
-
|
1786 |
-
// Custom Attributes through config xml
|
1787 |
-
if($custom_attributes = Mage::helper('eurotext_translationmanager')->getCustomCategoryAttributesForExport()){
|
1788 |
-
$hasChangedProperty = true;
|
1789 |
-
$nodeCustomAttributes = $doc->createElement('custom_attributes');
|
1790 |
-
// Custom Attribute Mapping is not yet used nor implemented
|
1791 |
-
foreach($custom_attributes as $custom_attribute => $custom_attribute_mapping){
|
1792 |
-
$item = $doc->createElement((string) $custom_attribute);
|
1793 |
-
$this->appendTextChild($item, (string) $catSrc->getData($custom_attribute));
|
1794 |
-
$nodeCustomAttributes->appendChild($item);
|
1795 |
-
}
|
1796 |
-
$cat->appendChild($nodeCustomAttributes);
|
1797 |
-
}
|
1798 |
-
|
1799 |
-
if ($project['export_urlkeys']=="1")
|
1800 |
-
{
|
1801 |
-
// URL-Key:
|
1802 |
-
if ($catSrc->getUrlKey()!="")
|
1803 |
-
{
|
1804 |
-
if ( ($catSrc->getUrlKey()==$catDst->getUrlKey()) || ($catDst->getUrlKey()=="") || ($manualSelected))
|
1805 |
-
{
|
1806 |
-
$hasChangedProperty=true;
|
1807 |
-
|
1808 |
-
$item=$doc->createElement("UrlKey");
|
1809 |
-
$this->appendTextChild($item,$catSrc->getUrlKey());
|
1810 |
-
$cat->appendChild($item);
|
1811 |
-
}
|
1812 |
-
}
|
1813 |
-
}
|
1814 |
-
|
1815 |
-
if ($project['export_seo']=="1")
|
1816 |
-
{
|
1817 |
-
// Meta-Title:
|
1818 |
-
if ($catSrc->getMetaTitle()!="")
|
1819 |
-
{
|
1820 |
-
if ( ($catSrc->getMetaTitle()==$catDst->getMetaTitle()) || ($catDst->getMetaTitle()=="") || ($manualSelected))
|
1821 |
-
{
|
1822 |
-
$hasChangedProperty=true;
|
1823 |
-
|
1824 |
-
$item=$doc->createElement("SeoTitle");
|
1825 |
-
$this->appendTextChild($item,$catSrc->getMetaTitle());
|
1826 |
-
$cat->appendChild($item);
|
1827 |
-
}
|
1828 |
-
}
|
1829 |
-
|
1830 |
-
// Meta-Description:
|
1831 |
-
if ($catSrc->getMetaDescription()!="")
|
1832 |
-
{
|
1833 |
-
if ( ($catSrc->getMetaDescription()==$catDst->getMetaDescription()) || ($catDst->getMetaDescription()=="") || ($manualSelected))
|
1834 |
-
{
|
1835 |
-
$hasChangedProperty=true;
|
1836 |
-
|
1837 |
-
$item=$doc->createElement("SeoDescription");
|
1838 |
-
$this->appendTextChild($item,$catSrc->getMetaDescription());
|
1839 |
-
$cat->appendChild($item);
|
1840 |
-
}
|
1841 |
-
}
|
1842 |
-
|
1843 |
-
// Meta-Keywords:
|
1844 |
-
if ($catSrc->getMetaKeywords()!="")
|
1845 |
-
{
|
1846 |
-
if ( ($catSrc->getMetaKeywords()==$catDst->getMetaKeywords()) || ($catDst->getMetaKeywords()=="") || ($manualSelected))
|
1847 |
-
{
|
1848 |
-
$hasChangedProperty=true;
|
1849 |
-
|
1850 |
-
$item=$doc->createElement("SeoKeywords");
|
1851 |
-
$this->appendTextChild($item,$catSrc->getMetaKeywords());
|
1852 |
-
$cat->appendChild($item);
|
1853 |
-
}
|
1854 |
-
}
|
1855 |
-
}
|
1856 |
-
|
1857 |
-
if ($hasChangedProperty)
|
1858 |
-
{
|
1859 |
-
$cats->appendChild($cat);
|
1860 |
-
}
|
1861 |
-
|
1862 |
-
$rv["offset"]=($offset+$maxItems);
|
1863 |
-
}
|
1864 |
-
|
1865 |
-
if ($itemsFound)
|
1866 |
-
{
|
1867 |
-
$xmlDir=$this->getExportXMLPath($project);
|
1868 |
-
$xmlDir.=DS."categories";
|
1869 |
-
if (!is_dir($xmlDir))
|
1870 |
-
{
|
1871 |
-
mkdir($xmlDir);
|
1872 |
-
}
|
1873 |
-
|
1874 |
-
$fileNum=($offset/$maxItems)+1;
|
1875 |
-
$fileNum=intval($fileNum);
|
1876 |
-
|
1877 |
-
$xmlFilename=$xmlDir.DS."cat".$fileNum.".xml";
|
1878 |
-
|
1879 |
-
$doc->save($xmlFilename);
|
1880 |
-
}
|
1881 |
-
else
|
1882 |
-
{
|
1883 |
-
// no further cat found, go to next step:
|
1884 |
-
$rv['step']=$this->STEP_COLLECT_CMSPAGES;
|
1885 |
-
$rv["offset"]=0;
|
1886 |
-
}
|
1887 |
-
|
1888 |
-
return $rv;
|
1889 |
-
}
|
1890 |
-
|
1891 |
-
public function deleteDirectoryRecursive($dir)
|
1892 |
-
{
|
1893 |
-
foreach(glob($dir . DS.'*') as $file)
|
1894 |
-
{
|
1895 |
-
if(is_dir($file))
|
1896 |
-
{
|
1897 |
-
$this->deleteDirectoryRecursive($file);
|
1898 |
-
}
|
1899 |
-
else
|
1900 |
-
{
|
1901 |
-
unlink($file);
|
1902 |
-
}
|
1903 |
-
}
|
1904 |
-
rmdir($dir);
|
1905 |
-
}
|
1906 |
-
|
1907 |
-
public function ajaxexportAction_ExportAttributes($project, $offset)
|
1908 |
-
{
|
1909 |
-
$rv=array();
|
1910 |
-
$rv["status_msg"]=$this->__("Checking attributes")."...";
|
1911 |
-
$rv["offset"]=$offset;
|
1912 |
-
$rv["step"]=$this->STEP_EXPORT_ATTRIBUTES;
|
1913 |
-
|
1914 |
-
$dbres = Mage::getSingleton('core/resource');
|
1915 |
-
$dbr=$dbres->getConnection('core_read');
|
1916 |
-
|
1917 |
-
if ($project['export_attributes']==1)
|
1918 |
-
{
|
1919 |
-
$foundItems=0;
|
1920 |
-
|
1921 |
-
$doc = new DOMDocument('1.0', 'UTF-8');
|
1922 |
-
$doc->formatOutput = true;
|
1923 |
-
|
1924 |
-
$defComment=$doc->createComment("allow utf8-detection: öäü€");
|
1925 |
-
$doc->appendChild($defComment);
|
1926 |
-
|
1927 |
-
$nodeAttributes = $doc->createElement("attributes");
|
1928 |
-
$doc->appendChild($nodeAttributes);
|
1929 |
-
|
1930 |
-
// eav_attribute_label (min 1.4)
|
1931 |
-
|
1932 |
-
$attributesResult=$dbr->fetchAll("SELECT a.attribute_id, a.frontend_label, attribute_code, entity_type_id FROM `".$this->getTableName('eav_attribute')."` a WHERE is_user_defined=1");
|
1933 |
-
foreach($attributesResult as $attributeResult)
|
1934 |
-
{
|
1935 |
-
$foundItems++;
|
1936 |
-
|
1937 |
-
$src_val=$attributeResult['frontend_label'];
|
1938 |
-
$attribute_id=$attributeResult['attribute_id'];
|
1939 |
-
|
1940 |
-
$attribute_comment="(has no label)";
|
1941 |
-
|
1942 |
-
// Default Text available?
|
1943 |
-
$attributeDefaultTextResults=$dbr->fetchAll("SELECT `value` FROM `".$this->getTableName('eav_attribute_label')."` WHERE attribute_id=".$attribute_id." AND store_id=0");
|
1944 |
-
foreach($attributeDefaultTextResults as $attributeDefaultTextResult)
|
1945 |
-
{
|
1946 |
-
$src_val=$attributeDefaultTextResult['value'];
|
1947 |
-
$attribute_comment="(default label)";
|
1948 |
-
}
|
1949 |
-
|
1950 |
-
// Source Storeview-Text available?
|
1951 |
-
$attributeDefaultTextResults=$dbr->fetchAll("SELECT `value` FROM `".$this->getTableName('eav_attribute_label')."` WHERE attribute_id=".$attribute_id." AND store_id=".intval($project['storeview_src']));
|
1952 |
-
foreach($attributeDefaultTextResults as $attributeDefaultTextResult)
|
1953 |
-
{
|
1954 |
-
$src_val=$attributeDefaultTextResult['value'];
|
1955 |
-
$attribute_comment="(src-storeview label)";
|
1956 |
-
}
|
1957 |
-
|
1958 |
-
$nodeAttribute = $doc->createElement("attribute");
|
1959 |
-
$nodeAttributes->appendChild($nodeAttribute);
|
1960 |
-
|
1961 |
-
$attrId=$doc->createAttribute("id");
|
1962 |
-
$attrId->value=$attribute_id;
|
1963 |
-
$nodeAttribute->appendChild($attrId);
|
1964 |
-
|
1965 |
-
$attribute_comment.=" attribute_code='".$attributeResult['attribute_code']."', entity_type_id: ".$attributeResult['entity_type_id'];
|
1966 |
-
$nodeAttributeComment=$doc->createComment($attribute_comment);
|
1967 |
-
$nodeAttribute->appendChild($nodeAttributeComment);
|
1968 |
-
|
1969 |
-
$nodeName = $doc->createElement("AttributeName");
|
1970 |
-
$this->appendTextChild($nodeName,$src_val);
|
1971 |
-
|
1972 |
-
$attrTranslate=$doc->createAttribute("translate");
|
1973 |
-
$attrTranslate->value="1";
|
1974 |
-
$nodeName->appendChild($attrTranslate);
|
1975 |
-
|
1976 |
-
$nodeAttribute->appendChild($nodeName);
|
1977 |
-
|
1978 |
-
// Options:
|
1979 |
-
$attributeOptionsResult=$dbr->fetchAll("SELECT option_id FROM ".$this->getTableName('eav_attribute_option')." WHERE attribute_id=".$attribute_id." ORDER BY sort_order ASC, option_id ASC");
|
1980 |
-
if (count($attributeOptionsResult)>0)
|
1981 |
-
{
|
1982 |
-
$nodeOptions = $doc->createElement("options");
|
1983 |
-
$nodeAttribute->appendChild($nodeOptions);
|
1984 |
-
|
1985 |
-
foreach($attributeOptionsResult as $attributeOptionResult)
|
1986 |
-
{
|
1987 |
-
$nodeOption = $doc->createElement("option");
|
1988 |
-
$nodeOptions->appendChild($nodeOption);
|
1989 |
-
|
1990 |
-
$attrId=$doc->createAttribute("id");
|
1991 |
-
$attrId->value=$attributeOptionResult['option_id'];
|
1992 |
-
$nodeOption->appendChild($attrId);
|
1993 |
-
|
1994 |
-
$option_comment="(has no label)";
|
1995 |
-
|
1996 |
-
// Default Text available?
|
1997 |
-
$attributeOptionDefaultTextResults=$dbr->fetchAll("SELECT `value` FROM `".$this->getTableName('eav_attribute_option_value')."` WHERE option_id=".$attributeOptionResult['option_id']." AND store_id=0");
|
1998 |
-
foreach($attributeOptionDefaultTextResults as $attributeOptionDefaultTextResult)
|
1999 |
-
{
|
2000 |
-
$src_val=$attributeOptionDefaultTextResult['value'];
|
2001 |
-
$option_comment="(has default label)";
|
2002 |
-
}
|
2003 |
-
|
2004 |
-
// Source Storeview-Text available?
|
2005 |
-
$attributeOptionDefaultTextResults=$dbr->fetchAll("SELECT `value` FROM `".$this->getTableName('eav_attribute_option_value')."` WHERE option_id=".$attributeOptionResult['option_id']." AND store_id=".intval($project['storeview_src']));
|
2006 |
-
foreach($attributeOptionDefaultTextResults as $attributeOptionDefaultTextResult)
|
2007 |
-
{
|
2008 |
-
$src_val=$attributeOptionDefaultTextResult['value'];
|
2009 |
-
$option_comment="(has src-storeview label)";
|
2010 |
-
}
|
2011 |
-
|
2012 |
-
$nodeAttributeOptionComment=$doc->createComment($option_comment);
|
2013 |
-
$nodeOption->appendChild($nodeAttributeOptionComment);
|
2014 |
-
|
2015 |
-
$nodeName = $doc->createElement("OptionName");
|
2016 |
-
$this->appendTextChild($nodeName,$src_val);
|
2017 |
-
|
2018 |
-
$attrTranslate=$doc->createAttribute("translate");
|
2019 |
-
$attrTranslate->value="1";
|
2020 |
-
$nodeName->appendChild($attrTranslate);
|
2021 |
-
|
2022 |
-
$nodeOption->appendChild($nodeName);
|
2023 |
-
}
|
2024 |
-
}
|
2025 |
-
}
|
2026 |
-
|
2027 |
-
if ($foundItems>0)
|
2028 |
-
{
|
2029 |
-
$xmlDir=$this->getExportXMLPath($project);
|
2030 |
-
$xmlDir.=DS."attributes";
|
2031 |
-
if (!is_dir($xmlDir))
|
2032 |
-
{
|
2033 |
-
mkdir($xmlDir);
|
2034 |
-
}
|
2035 |
-
|
2036 |
-
$xml_filename=$xmlDir.DS."attributes.xml";
|
2037 |
-
|
2038 |
-
$doc->save($xml_filename);
|
2039 |
-
}
|
2040 |
-
}
|
2041 |
-
|
2042 |
-
$rv["step"]=$this->STEP_GENERATE_CONTROL_FILE;
|
2043 |
-
$rv["offset"]=0;
|
2044 |
-
|
2045 |
-
return $rv;
|
2046 |
-
}
|
2047 |
-
|
2048 |
-
private $STEP_START=0;
|
2049 |
-
private $STEP_COLLECT_LANGFILES=1;
|
2050 |
-
private $STEP_IMPORT_LANGFILES=2;
|
2051 |
-
private $STEP_BUILD_LANGXML=3;
|
2052 |
-
private $STEP_COLLECT_PRODUCTS=4;
|
2053 |
-
private $STEP_COLLECT_CATEGORIES=5;
|
2054 |
-
private $STEP_COLLECT_CMSPAGES=6;
|
2055 |
-
private $STEP_COLLECT_CMSBLOCKS=7;
|
2056 |
-
private $STEP_EXPORT_ATTRIBUTES=8;
|
2057 |
-
private $STEP_GENERATE_CONTROL_FILE=9;
|
2058 |
-
private $STEP_COMPRESS_FILES=10;
|
2059 |
-
private $STEP_TRANSMIT_ARCHIVE=11;
|
2060 |
-
private $STEP_DONE=12;
|
2061 |
-
private $STEP_COLLECT_TEMPLATES=13;
|
2062 |
-
|
2063 |
-
public function ajaxexportAction()
|
2064 |
-
{
|
2065 |
-
$this->loadLayout('adminhtml_eurotext_translationmanager_ajax');
|
2066 |
-
$block = $this->getLayout()->getBlock('et.tm.response.ajax');
|
2067 |
-
|
2068 |
-
$request=$this->getRequest();
|
2069 |
-
$step=intval($request->getParam("step"));
|
2070 |
-
$offset=intval($request->getParam("offset"));
|
2071 |
-
$project_id=intval($request->getParam("project_id"));
|
2072 |
-
|
2073 |
-
$project=$this->getProject($project_id);
|
2074 |
-
|
2075 |
-
// Defaults:
|
2076 |
-
$block->setStatus_code("ok");
|
2077 |
-
$block->setStatusMsg($this->__("Please wait")."...");
|
2078 |
-
$block->setOffset($offset);
|
2079 |
-
$block->setStep($step);
|
2080 |
-
$block->setFinished(0);
|
2081 |
-
|
2082 |
-
// steps:
|
2083 |
-
// -------------------------------------------------------------------------------------
|
2084 |
-
// 0: Jump to step 4, if language files is not selected for export
|
2085 |
-
// 1: Find language *.csv files and write found filenames to eurotext_csv
|
2086 |
-
// 2: For each offset import one *.csv file to eurotext_csv_data
|
2087 |
-
// 3: For each offset find missing translations for one *.csv and generate xml files
|
2088 |
-
// -------------------------------------------------------------------------------------
|
2089 |
-
// 4: Jump to step 5, if product files were selected manually
|
2090 |
-
// For each offset: Find missing translations for one product
|
2091 |
-
// 5: Jump to step 6, if category files where selected manually
|
2092 |
-
// For each offset: Find missing translations for one category
|
2093 |
-
|
2094 |
-
if ($step==$this->STEP_START)
|
2095 |
-
{
|
2096 |
-
// Clear project folder:
|
2097 |
-
$xmlPath=$this->getExportXMLPath($project);
|
2098 |
-
$this->deleteDirectoryRecursive($xmlPath);
|
2099 |
-
|
2100 |
-
$helper=$this->getHelper();
|
2101 |
-
$testResult=$helper->testFtpConnection();
|
2102 |
-
|
2103 |
-
if ($testResult['ok']!=true)
|
2104 |
-
{
|
2105 |
-
$block->setStatus_code("error");
|
2106 |
-
$block->setStatusMsg($testResult['statusmessage']);
|
2107 |
-
}
|
2108 |
-
else
|
2109 |
-
{
|
2110 |
-
if ($project['langfilesmode']==1)
|
2111 |
-
{
|
2112 |
-
// Search for missing translations:
|
2113 |
-
$block->setStep($this->STEP_COLLECT_LANGFILES);
|
2114 |
-
}
|
2115 |
-
else
|
2116 |
-
{
|
2117 |
-
$dbres = Mage::getSingleton('core/resource');
|
2118 |
-
$dbr=$dbres->getConnection('core_read');
|
2119 |
-
|
2120 |
-
$cnt=intval($dbr->fetchOne("SELECT COUNT(*) cnt FROM `".$this->getTableName('eurotext_csv')."` WHERE project_id=".$project['id']." AND translate_flag=1 AND locale_dst='en_US'"));
|
2121 |
-
if ($cnt>0)
|
2122 |
-
{
|
2123 |
-
// Customer has selected translation files:
|
2124 |
-
$block->setStep($this->STEP_COLLECT_LANGFILES);
|
2125 |
-
}
|
2126 |
-
else
|
2127 |
-
{
|
2128 |
-
$block->setStep($this->STEP_COLLECT_PRODUCTS);
|
2129 |
-
}
|
2130 |
-
}
|
2131 |
-
}
|
2132 |
-
}
|
2133 |
-
elseif ($step==$this->STEP_COLLECT_LANGFILES)
|
2134 |
-
{
|
2135 |
-
$this->ajaxexportAction_CollectLangfiles($project);
|
2136 |
-
$block->setStep($this->STEP_IMPORT_LANGFILES);
|
2137 |
-
$block->setOffset(0);
|
2138 |
-
}
|
2139 |
-
elseif ($step==$this->STEP_IMPORT_LANGFILES)
|
2140 |
-
{
|
2141 |
-
$rvSub=$this->ajaxexportAction_ImportLangfiles($project,$offset);
|
2142 |
-
if ($rvSub['offset']>=0)
|
2143 |
-
{
|
2144 |
-
$block->setStep($this->STEP_IMPORT_LANGFILES);
|
2145 |
-
$block->setStatusMsg($rvSub['status_msg']);
|
2146 |
-
$block->setOffset($rvSub['offset']);
|
2147 |
-
}
|
2148 |
-
else
|
2149 |
-
{
|
2150 |
-
$block->setStep($this->STEP_BUILD_LANGXML);
|
2151 |
-
$block->setOffset(0);
|
2152 |
-
$block->setStatusMsg($this->__("Generating Language files")."...");
|
2153 |
-
}
|
2154 |
-
}
|
2155 |
-
elseif ($step==$this->STEP_BUILD_LANGXML)
|
2156 |
-
{
|
2157 |
-
$rvSub=$this->ajaxexportAction_BuildLangXML($project,$offset);
|
2158 |
-
$block->setStep($rvSub['step']);
|
2159 |
-
$block->setOffset($rvSub['offset']);
|
2160 |
-
$block->setStatusMsg($rvSub['status_msg']);
|
2161 |
-
}
|
2162 |
-
elseif ($step==$this->STEP_COLLECT_PRODUCTS)
|
2163 |
-
{
|
2164 |
-
$rvSub=$this->ajaxexportAction_CollectProducts($project,$offset);
|
2165 |
-
$block->setStep($rvSub['step']);
|
2166 |
-
$block->setOffset($rvSub['offset']);
|
2167 |
-
$block->setStatusMsg($rvSub['status_msg']);
|
2168 |
-
}
|
2169 |
-
elseif ($step==$this->STEP_COLLECT_CATEGORIES)
|
2170 |
-
{
|
2171 |
-
$rvSub=$this->ajaxexportAction_CollectCategories($project,$offset);
|
2172 |
-
$block->setStep($rvSub['step']);
|
2173 |
-
$block->setOffset($rvSub['offset']);
|
2174 |
-
$block->setStatusMsg($rvSub['status_msg']);
|
2175 |
-
}
|
2176 |
-
elseif ($step==$this->STEP_COLLECT_CMSPAGES)
|
2177 |
-
{
|
2178 |
-
$rvSub=$this->ajaxexportAction_CollectCMSPages($project,$offset);
|
2179 |
-
$block->setStep($rvSub['step']);
|
2180 |
-
$block->setOffset($rvSub['offset']);
|
2181 |
-
$block->setStatusMsg($rvSub['status_msg']);
|
2182 |
-
}
|
2183 |
-
elseif ($step==$this->STEP_COLLECT_CMSBLOCKS)
|
2184 |
-
{
|
2185 |
-
$rvSub=$this->ajaxexportAction_CollectCMSBlocks($project,$offset);
|
2186 |
-
$block->setStep($rvSub['step']);
|
2187 |
-
$block->setOffset($rvSub['offset']);
|
2188 |
-
$block->setStatusMsg($rvSub['status_msg']);
|
2189 |
-
}
|
2190 |
-
elseif ($step==$this->STEP_COLLECT_TEMPLATES)
|
2191 |
-
{
|
2192 |
-
$rvSub=$this->ajaxexportAction_CollectTemplates($project,$offset);
|
2193 |
-
$block->setStep($rvSub['step']);
|
2194 |
-
$block->setOffset($rvSub['offset']);
|
2195 |
-
$block->setStatusMsg($rvSub['status_msg']);
|
2196 |
-
}
|
2197 |
-
elseif ($step==$this->STEP_EXPORT_ATTRIBUTES)
|
2198 |
-
{
|
2199 |
-
$rvSub=$this->ajaxexportAction_ExportAttributes($project,$offset);
|
2200 |
-
$block->setStep($rvSub['step']);
|
2201 |
-
$block->setOffset($rvSub['offset']);
|
2202 |
-
$block->setStatusMsg($rvSub['status_msg']);
|
2203 |
-
}
|
2204 |
-
elseif ($step==$this->STEP_GENERATE_CONTROL_FILE)
|
2205 |
-
{
|
2206 |
-
$this->ajaxexportAction_GenerateControlFile($project);
|
2207 |
-
$block->setStep($this->STEP_COMPRESS_FILES);
|
2208 |
-
$block->setStatusMsg($this->__("Generating ZIP-Archive"));
|
2209 |
-
}
|
2210 |
-
elseif ($step==$this->STEP_COMPRESS_FILES)
|
2211 |
-
{
|
2212 |
-
$this->ajaxexportAction_CompressFiles($project);
|
2213 |
-
|
2214 |
-
$block->setStep($this->STEP_TRANSMIT_ARCHIVE);
|
2215 |
-
$block->setStatusMsg($this->__("Sending data"));
|
2216 |
-
}
|
2217 |
-
elseif ($step==$this->STEP_TRANSMIT_ARCHIVE)
|
2218 |
-
{
|
2219 |
-
$this->ajaxexportAction_TransmitArchive($project);
|
2220 |
-
$block->setStep($this->STEP_DONE);
|
2221 |
-
$block->setStatusMsg($this->__("Done"));
|
2222 |
-
}
|
2223 |
-
else
|
2224 |
-
{
|
2225 |
-
$block->setStep($this->STEP_DONE);
|
2226 |
-
$block->setStatusMsg($this->__("Done"));
|
2227 |
-
$block->setFinished("1");
|
2228 |
-
}
|
2229 |
-
|
2230 |
-
$this->renderLayout();
|
2231 |
-
}
|
2232 |
-
|
2233 |
-
public function importextractAction()
|
2234 |
-
{
|
2235 |
-
$zipFound = false;
|
2236 |
-
$tmpdir=$this->getTempDir();
|
2237 |
-
$files=$this->getEurotextHelper()->getDirectoryContent($tmpdir, false, true, false, false);
|
2238 |
-
foreach($files as $file)
|
2239 |
-
{
|
2240 |
-
$filename=$file['full_path'];
|
2241 |
-
if ($this->getEurotextHelper()->endsWith(strtoupper($filename),".ZIP"))
|
2242 |
-
{
|
2243 |
-
// Extract file:
|
2244 |
-
if(!$this->getEurotextHelper()->extractZip($filename,$tmpdir)){
|
2245 |
-
$this->getHelper()->log('ZIP File could not be extracted', Zend_Log::CRIT);
|
2246 |
-
}
|
2247 |
-
$zipFound = true;
|
2248 |
-
}
|
2249 |
-
}
|
2250 |
-
|
2251 |
-
$this->getHelper()->log('ZIP File could '.($zipFound ? '' : 'not').' be found.');
|
2252 |
-
$import_url=Mage::helper('adminhtml')->getUrl('*/*/importparse');
|
2253 |
-
$this->_redirectUrl($import_url);
|
2254 |
-
}
|
2255 |
-
|
2256 |
-
public function importparseAction()
|
2257 |
-
{
|
2258 |
-
$tmpdir=$this->getTempDir();
|
2259 |
-
$controlFile=$tmpdir.DIRECTORY_SEPARATOR."control.xml";
|
2260 |
-
|
2261 |
-
if (!file_exists($controlFile))
|
2262 |
-
{
|
2263 |
-
$this->getHelper()->log('ZIP did not countain a control.xml file');
|
2264 |
-
Mage::throwException($this->__("Fehler: Die ZIP-Datei enthaelt keine control.xml"));
|
2265 |
-
}
|
2266 |
-
|
2267 |
-
$project_id=-1;
|
2268 |
-
|
2269 |
-
$doc = new DOMDocument();
|
2270 |
-
$doc->load($controlFile);
|
2271 |
-
$nodes=$doc->getElementsByTagName("Description");
|
2272 |
-
foreach($nodes as $node)
|
2273 |
-
{
|
2274 |
-
$description=$node->textContent;
|
2275 |
-
$pos1=stripos($description,"Magento-Project-Id: ");
|
2276 |
-
if ($pos1>=0)
|
2277 |
-
{
|
2278 |
-
$pos1+=strlen("Magento-Project-Id: ");
|
2279 |
-
|
2280 |
-
$pos2=stripos($description,",",$pos1);
|
2281 |
-
if ($pos2>$pos1)
|
2282 |
-
{
|
2283 |
-
$project_id_str=trim(substr($description,$pos1,($pos2-$pos1)));
|
2284 |
-
$project_id=intval($project_id_str);
|
2285 |
-
}
|
2286 |
-
}
|
2287 |
-
}
|
2288 |
-
|
2289 |
-
if ($project_id<=0)
|
2290 |
-
{
|
2291 |
-
Mage::throwException($this->__("Could not read project-id from Description-Field in control.xml"));
|
2292 |
-
}
|
2293 |
-
|
2294 |
-
$this->getHelper()->log('ZIP contains Data for Project ID '.$project_id);
|
2295 |
-
|
2296 |
-
$dbres = Mage::getSingleton('core/resource');
|
2297 |
-
$dbw=$dbres->getConnection('core_write');
|
2298 |
-
|
2299 |
-
// Remove old entries:
|
2300 |
-
$dbw->query("DELETE FROM `".$this->getTableName('eurotext_import')."` WHERE project_id=".$project_id);
|
2301 |
-
|
2302 |
-
$project=$this->getProject($project_id);
|
2303 |
-
$storeview_dst=$project['storeview_dst'];
|
2304 |
-
|
2305 |
-
$filenames=array();
|
2306 |
-
|
2307 |
-
$uploadedFiles=$doc->getElementsByTagName("uploadedFile");
|
2308 |
-
foreach($uploadedFiles as $uploadedFile)
|
2309 |
-
{
|
2310 |
-
$filename="";
|
2311 |
-
foreach ($uploadedFile->attributes as $attrName => $attrNode)
|
2312 |
-
{
|
2313 |
-
if ($attrName=="fileName")
|
2314 |
-
{
|
2315 |
-
$filename=$attrNode->textContent;
|
2316 |
-
}
|
2317 |
-
}
|
2318 |
-
if ($filename!="")
|
2319 |
-
{
|
2320 |
-
$filenames[]=$filename;
|
2321 |
-
}
|
2322 |
-
}
|
2323 |
-
|
2324 |
-
sort($filenames);
|
2325 |
-
|
2326 |
-
$num=0;
|
2327 |
-
foreach($filenames as $filename)
|
2328 |
-
{
|
2329 |
-
$num++;
|
2330 |
-
$dbw->query("INSERT INTO `".$this->getTableName('eurotext_import')."` (project_id,filename,storeview_dst,is_imported,num) VALUES (?,?,?,?,?);",array($project_id,$filename,$storeview_dst,'0',$num));
|
2331 |
-
}
|
2332 |
-
|
2333 |
-
$this->updateProjectState($project_id,2); // 2 = Processing (2)
|
2334 |
-
|
2335 |
-
$import_url=Mage::helper('adminhtml')->getUrl('*/*/index',array('id'=>$project_id));
|
2336 |
-
$this->_redirectUrl($import_url);
|
2337 |
-
}
|
2338 |
-
|
2339 |
-
public function importstepAction()
|
2340 |
-
{
|
2341 |
-
$this->loadLayout('adminhtml_eurotext_translationmanager_ajax');
|
2342 |
-
$block = $this->getLayout()->getBlock('et.tm.response.ajax');
|
2343 |
-
|
2344 |
-
$request=$this->getRequest();
|
2345 |
-
$offset=intval($request->getParam("offset"));
|
2346 |
-
$project_id=intval($request->getParam("project_id"));
|
2347 |
-
$project=$this->getProject($project_id);
|
2348 |
-
|
2349 |
-
$dbres = Mage::getSingleton('core/resource');
|
2350 |
-
$dbr=$dbres->getConnection('core_read');
|
2351 |
-
|
2352 |
-
$finished=0;
|
2353 |
-
$status_msg="";
|
2354 |
-
|
2355 |
-
$tmpdir=$this->getTempDir();
|
2356 |
-
|
2357 |
-
$itemCount=intval($dbr->fetchOne("SELECT COUNT(*) FROM `".$this->getTableName('eurotext_import')."` WHERE project_id=?",array($project_id)));
|
2358 |
-
|
2359 |
-
$nextItems=$dbr->fetchAll("SELECT * FROM `".$this->getTableName('eurotext_import')."` WHERE project_id=? ORDER BY num ASC, filename ASC LIMIT $offset,1",array($project_id));
|
2360 |
-
if (count($nextItems)>0)
|
2361 |
-
{
|
2362 |
-
$nextItem=$nextItems[0];
|
2363 |
-
$filename=$nextItem['filename'];
|
2364 |
-
|
2365 |
-
$full_filename=$tmpdir.DIRECTORY_SEPARATOR.$filename;
|
2366 |
-
|
2367 |
-
if (stripos($filename,"cms-sites".DS."cms-")===0)
|
2368 |
-
{
|
2369 |
-
$this->importstepAction_ImportCMS($nextItem,$full_filename,$project,$dbr);
|
2370 |
-
}
|
2371 |
-
else if (stripos($filename,"cms-sites".DS."cmsblock-")===0)
|
2372 |
-
{
|
2373 |
-
$this->importstepAction_ImportBlocks($nextItem,$full_filename,$project,$dbr);
|
2374 |
-
}
|
2375 |
-
elseif (stripos($filename,"articles".DS)===0)
|
2376 |
-
{
|
2377 |
-
$this->importstepAction_ImportArticle($nextItem,$full_filename,$project);
|
2378 |
-
}
|
2379 |
-
elseif (stripos($filename,"categories".DS)===0)
|
2380 |
-
{
|
2381 |
-
$this->importstepAction_ImportCategory($nextItem,$full_filename,$project);
|
2382 |
-
}
|
2383 |
-
elseif(stripos($filename,"framework".DS)===0)
|
2384 |
-
{
|
2385 |
-
$this->importstepAction_ImportTranslation($nextItem,$full_filename,$project,$dbr);
|
2386 |
-
}
|
2387 |
-
elseif(stripos($filename,"attributes".DS)===0)
|
2388 |
-
{
|
2389 |
-
$this->importstepAction_ImportAttributes($nextItem,$full_filename,$project,$dbr);
|
2390 |
-
}
|
2391 |
-
elseif(stripos($filename,"emailtemplates".DS)===0)
|
2392 |
-
{
|
2393 |
-
$this->importstepAction_ImportTemplates($nextItem,$full_filename,$project,$dbr);
|
2394 |
-
}
|
2395 |
-
|
2396 |
-
$status_msg="[".($offset+1)." / ".$itemCount."] ".$this->__("Processing File")." '".$filename."'";
|
2397 |
-
}
|
2398 |
-
else
|
2399 |
-
{
|
2400 |
-
$this->updateProjectState($project_id,3); // 3 = Imported
|
2401 |
-
|
2402 |
-
$finished=1;
|
2403 |
-
$status_msg=$this->__("Done");
|
2404 |
-
}
|
2405 |
-
|
2406 |
-
$block->setStatusMsg($status_msg);
|
2407 |
-
$block->setStatus_code("ok");
|
2408 |
-
$block->setFinished($finished);
|
2409 |
-
$block->setOffset(($offset+1));
|
2410 |
-
|
2411 |
-
$this->renderLayout();
|
2412 |
-
|
2413 |
-
}
|
2414 |
-
|
2415 |
-
private function updateProjectState($project_id, $newStatusId)
|
2416 |
-
{
|
2417 |
-
$dbres = Mage::getSingleton('core/resource');
|
2418 |
-
$dbw=$dbres->getConnection('core_write');
|
2419 |
-
|
2420 |
-
// Update state:
|
2421 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_project')."` SET project_status=? WHERE id=?",array($newStatusId,$project_id));
|
2422 |
-
}
|
2423 |
-
|
2424 |
-
private function getXMLChildNode($element,$childnodeName)
|
2425 |
-
{
|
2426 |
-
$childNodes=$element->childNodes;
|
2427 |
-
foreach($childNodes as $childNode)
|
2428 |
-
{
|
2429 |
-
if ($childNode->nodeType==XML_ELEMENT_NODE)
|
2430 |
-
{
|
2431 |
-
if ($childNode->tagName==$childnodeName)
|
2432 |
-
{
|
2433 |
-
return $childNode;
|
2434 |
-
}
|
2435 |
-
}
|
2436 |
-
}
|
2437 |
-
|
2438 |
-
return null;
|
2439 |
-
}
|
2440 |
-
|
2441 |
-
private function getXMLChildNodeText($element,$childnodeName,$defaultValue="")
|
2442 |
-
{
|
2443 |
-
$childNode=$this->getXMLChildNode($element,$childnodeName);
|
2444 |
-
if ($childNode==null)
|
2445 |
-
{
|
2446 |
-
return $defaultValue;
|
2447 |
-
}
|
2448 |
-
|
2449 |
-
return $childNode->textContent;
|
2450 |
-
}
|
2451 |
-
|
2452 |
-
public function importstepAction_ImportArticle($item,$full_filename,$project)
|
2453 |
-
{
|
2454 |
-
$this->getHelper()->log('=== Importing Products ===');
|
2455 |
-
|
2456 |
-
$dbres = Mage::getSingleton('core/resource');
|
2457 |
-
$dbw=$dbres->getConnection('core_write');
|
2458 |
-
$dbr=$dbres->getConnection("core_read");
|
2459 |
-
|
2460 |
-
$eavAttribute = Mage::getModel('eav/entity_attribute');
|
2461 |
-
$urlkey_attribute_id = $eavAttribute->getIdByCode('catalog_product', 'url_key');
|
2462 |
-
|
2463 |
-
$dst_store_id=$project['storeview_dst'];
|
2464 |
-
|
2465 |
-
$doc = new DOMDocument();
|
2466 |
-
$doc->load($full_filename);
|
2467 |
-
$articles=$doc->getElementsByTagName("article");
|
2468 |
-
foreach($articles as $article)
|
2469 |
-
{
|
2470 |
-
$fieldNodes=$article->childNodes;
|
2471 |
-
|
2472 |
-
$Id=0;
|
2473 |
-
$fields=array();
|
2474 |
-
|
2475 |
-
foreach($fieldNodes as $fieldNode)
|
2476 |
-
{
|
2477 |
-
$nodeName=trim($fieldNode->nodeName);
|
2478 |
-
$nodeContent=trim($fieldNode->textContent);
|
2479 |
-
|
2480 |
-
if ($nodeName!="")
|
2481 |
-
{
|
2482 |
-
if ($nodeName=="Id")
|
2483 |
-
{
|
2484 |
-
$Id=intval($nodeContent);
|
2485 |
-
}
|
2486 |
-
else if('custom_attributes' == $nodeName){
|
2487 |
-
$fields[$nodeName]=$fieldNode;
|
2488 |
-
}
|
2489 |
-
else
|
2490 |
-
{
|
2491 |
-
$fields[$nodeName]=$nodeContent;
|
2492 |
-
}
|
2493 |
-
}
|
2494 |
-
}
|
2495 |
-
|
2496 |
-
if ($Id>0)
|
2497 |
-
{
|
2498 |
-
/** @var Mage_Core_Model_Product $productDst */
|
2499 |
-
$productDst = Mage::getModel('catalog/product')->load($Id)->setStoreId($project['storeview_dst']);
|
2500 |
-
$this->getHelper()->log('Saving Product (ID '.$Id.') for StoreID: '.$project['storeview_dst']);
|
2501 |
-
|
2502 |
-
// Ignore fields:
|
2503 |
-
$ignoreFields=array("#text","Url");
|
2504 |
-
|
2505 |
-
$hasUrlKey=false;
|
2506 |
-
|
2507 |
-
foreach ($fields as $key => $value)
|
2508 |
-
{
|
2509 |
-
if ($key=="Title")
|
2510 |
-
{
|
2511 |
-
$productDst->setName($value);
|
2512 |
-
}
|
2513 |
-
else if ($key=="Longdesc")
|
2514 |
-
{
|
2515 |
-
$productDst->setDescription($value);
|
2516 |
-
}
|
2517 |
-
else if ($key == "UrlKey") {
|
2518 |
-
$urlProductCheck=Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter('url_key', array('eq', $value));
|
2519 |
-
if ($urlProductCheck->count() > 0) {
|
2520 |
-
Mage::log($this->getHelper()->__('Changed duplicate URL Key'), Zend_Log::INFO, 'eurotext_urlkey_changes.log', true);
|
2521 |
-
Mage::log($this->getHelper()->__(' from "%s"', $value), Zend_Log::INFO, 'eurotext_urlkey_changes.log', true);
|
2522 |
-
|
2523 |
-
$value = $this->getHelper()->getUniqueUrl($value);
|
2524 |
-
|
2525 |
-
Mage::log($this->getHelper()->__(' to "%s"', $value), Zend_Log::INFO, 'eurotext_urlkey_changes.log', true);
|
2526 |
-
|
2527 |
-
}
|
2528 |
-
$productDst->setUrlKey($value);
|
2529 |
-
$hasUrlKey = true;
|
2530 |
-
}
|
2531 |
-
else if ($key=="Shortdesc")
|
2532 |
-
{
|
2533 |
-
$productDst->setShortDescription($value);
|
2534 |
-
}
|
2535 |
-
else if ($key=="SeoTitle")
|
2536 |
-
{
|
2537 |
-
$productDst->setMetaTitle($value);
|
2538 |
-
}
|
2539 |
-
else if ($key=="SeoDescription")
|
2540 |
-
{
|
2541 |
-
$productDst->setMetaDescription($value);
|
2542 |
-
}
|
2543 |
-
else if ($key=="SeoKeywords")
|
2544 |
-
{
|
2545 |
-
$productDst->setMetaKeyword($value);
|
2546 |
-
}
|
2547 |
-
else if ($key=="Images")
|
2548 |
-
{
|
2549 |
-
$imageNodes=$article->getElementsByTagName("Image");
|
2550 |
-
foreach($imageNodes as $imageNode)
|
2551 |
-
{
|
2552 |
-
$img_value_id=intval($imageNode->getAttributeNode("value_id")->value);
|
2553 |
-
$img_position=intval($imageNode->getAttributeNode("position")->value);
|
2554 |
-
$img_disabled=intval($imageNode->getAttributeNode("disabled")->value);
|
2555 |
-
|
2556 |
-
$labelNodes=$imageNode->getElementsByTagName("Label");
|
2557 |
-
foreach($labelNodes as $labelNode)
|
2558 |
-
{
|
2559 |
-
$img_label=trim($labelNode->textContent);
|
2560 |
-
|
2561 |
-
try
|
2562 |
-
{
|
2563 |
-
$dbw->query("INSERT IGNORE INTO `".$this->getTableName('catalog_product_entity_media_gallery_value')."` (value_id,store_id,label,position,disabled) VALUES (?,?,?,?,?);",array($img_value_id,$dst_store_id,$img_label,$img_position,$img_disabled));
|
2564 |
-
$dbw->query("UPDATE `".$this->getTableName('catalog_product_entity_media_gallery_value')."` SET label=? WHERE value_id=? AND store_id=?;",array($img_label,$img_value_id,$dst_store_id));
|
2565 |
-
}
|
2566 |
-
catch(Exception $e)
|
2567 |
-
{
|
2568 |
-
// Exception might occur, if the image was deleted between export and import
|
2569 |
-
// due to foreign-key checks
|
2570 |
-
}
|
2571 |
-
}
|
2572 |
-
}
|
2573 |
-
}
|
2574 |
-
else if ($key=="Options")
|
2575 |
-
{
|
2576 |
-
$optionNodes=$article->getElementsByTagName("Option");
|
2577 |
-
foreach($optionNodes as $optionNode)
|
2578 |
-
{
|
2579 |
-
// Id:
|
2580 |
-
$option_id=intval($optionNode->getAttributeNode("Id")->value);
|
2581 |
-
|
2582 |
-
// Title:
|
2583 |
-
$option_title=trim($this->getXMLChildNodeText($optionNode,"Title",""));
|
2584 |
-
if (strlen($option_title)>0)
|
2585 |
-
{
|
2586 |
-
// Update Title:
|
2587 |
-
$dbw->query("INSERT IGNORE INTO `".$this->getTableName('catalog_product_option_title')."` (option_id,store_id,title) VALUES (?,?,?);",array($option_id,$dst_store_id,$option_title));
|
2588 |
-
$dbw->query("UPDATE `".$this->getTableName('catalog_product_option_title')."` SET title=? WHERE option_id=? AND store_id=?;",array($option_title,$option_id,$dst_store_id));
|
2589 |
-
}
|
2590 |
-
|
2591 |
-
$OptionValueNodes=$article->getElementsByTagName("Value");
|
2592 |
-
foreach($OptionValueNodes as $OptionValueNode)
|
2593 |
-
{
|
2594 |
-
$option_value_id=intval($OptionValueNode->getAttributeNode("Id")->value);
|
2595 |
-
$option_value_title=trim($this->getXMLChildNodeText($OptionValueNode,"Title",""));
|
2596 |
-
|
2597 |
-
if (strlen($option_value_title)>0)
|
2598 |
-
{
|
2599 |
-
// Update Title:
|
2600 |
-
$dbw->query("INSERT IGNORE INTO `".$this->getTableName('catalog_product_option_type_title')."` (option_type_id,store_id,title) VALUES (?,?,?);",array($option_value_id,$dst_store_id,$option_value_title));
|
2601 |
-
$dbw->query("UPDATE `".$this->getTableName('catalog_product_option_type_title')."` SET title=? WHERE option_type_id=? AND store_id=?;",array($option_value_title,$option_value_id,$dst_store_id));
|
2602 |
-
}
|
2603 |
-
}
|
2604 |
-
}
|
2605 |
-
|
2606 |
-
//echo "Options translated";
|
2607 |
-
//die();
|
2608 |
-
}
|
2609 |
-
else
|
2610 |
-
{
|
2611 |
-
if('custom_attributes' == $key){
|
2612 |
-
$custom_attributes = Mage::helper('eurotext_translationmanager')->getCustomProductAttributesForExport();
|
2613 |
-
|
2614 |
-
// value doesn't contain a text value as usual
|
2615 |
-
// only for custom_attributes key it's the node object
|
2616 |
-
$customAttributesNodes=$value->childNodes;
|
2617 |
-
|
2618 |
-
foreach ($customAttributesNodes as $customAttributesNode) {
|
2619 |
-
$custom_attribute_key = trim($customAttributesNode->nodeName);
|
2620 |
-
$custom_attribute_value = trim($customAttributesNode->textContent);
|
2621 |
-
if (array_key_exists($custom_attribute_key, $custom_attributes)) {
|
2622 |
-
$productDst->setDataUsingMethod($custom_attribute_key, $custom_attribute_value);
|
2623 |
-
}
|
2624 |
-
}
|
2625 |
-
}
|
2626 |
-
else if (!in_array($key,$ignoreFields))
|
2627 |
-
{
|
2628 |
-
$this->getHelper()->log('Unknown Field: '.$key, Zend_Log::EMERG);
|
2629 |
-
throw new Mage_Exception('Unknown Field: '.$key);
|
2630 |
-
}
|
2631 |
-
}
|
2632 |
-
}
|
2633 |
-
|
2634 |
-
if (!$hasUrlKey)
|
2635 |
-
{
|
2636 |
-
$productDst->setUrlKey(false);
|
2637 |
-
}
|
2638 |
-
$productDst->save();
|
2639 |
-
$this->getHelper()->log('== Product has been saved ==');
|
2640 |
-
}
|
2641 |
-
else
|
2642 |
-
{
|
2643 |
-
$this->getHelper()->log('Wrong Product (ID: '.$Id.')');
|
2644 |
-
Mage::throwException($this->__("Wrong Product ID '%s'", $Id));
|
2645 |
-
}
|
2646 |
-
}
|
2647 |
-
}
|
2648 |
-
|
2649 |
-
public function importstepAction_ImportCategory($item,$full_filename,$project)
|
2650 |
-
{
|
2651 |
-
$dbres = Mage::getSingleton('core/resource');
|
2652 |
-
$dbr=$dbres->getConnection("core_read");
|
2653 |
-
|
2654 |
-
$eavAttribute = Mage::getModel('eav/entity_attribute');
|
2655 |
-
$urlkey_attribute_id = $eavAttribute->getIdByCode('catalog_category', 'url_key');
|
2656 |
-
|
2657 |
-
$doc = new DOMDocument();
|
2658 |
-
$doc->load($full_filename);
|
2659 |
-
$categories=$doc->getElementsByTagName("category");
|
2660 |
-
foreach($categories as $category)
|
2661 |
-
{
|
2662 |
-
$fieldNodes=$category->childNodes;
|
2663 |
-
|
2664 |
-
$Id=0;
|
2665 |
-
$fields=array();
|
2666 |
-
|
2667 |
-
foreach($fieldNodes as $fieldNode)
|
2668 |
-
{
|
2669 |
-
$nodeName=trim($fieldNode->nodeName);
|
2670 |
-
$nodeContent=trim($fieldNode->textContent);
|
2671 |
-
|
2672 |
-
if ($nodeName!="")
|
2673 |
-
{
|
2674 |
-
if ($nodeName=="Id")
|
2675 |
-
{
|
2676 |
-
$Id=intval($nodeContent);
|
2677 |
-
}
|
2678 |
-
else
|
2679 |
-
{
|
2680 |
-
$fields[$nodeName]=$nodeContent;
|
2681 |
-
}
|
2682 |
-
}
|
2683 |
-
}
|
2684 |
-
|
2685 |
-
if ($Id>0)
|
2686 |
-
{
|
2687 |
-
$catDst = Mage::getModel('catalog/category')->load($Id)->setStoreId($project['storeview_dst']);
|
2688 |
-
|
2689 |
-
$hasUrlKey=false;
|
2690 |
-
|
2691 |
-
foreach ($fields as $key => $value)
|
2692 |
-
{
|
2693 |
-
if ($key=="Title")
|
2694 |
-
{
|
2695 |
-
$catDst->setName($value);
|
2696 |
-
}
|
2697 |
-
else if ($key=="Longdesc")
|
2698 |
-
{
|
2699 |
-
$catDst->setDescription($value);
|
2700 |
-
}
|
2701 |
-
else if ($key=="Shortdesc")
|
2702 |
-
{
|
2703 |
-
$catDst->setShortDescription($value);
|
2704 |
-
}
|
2705 |
-
else if ($key=="SeoTitle")
|
2706 |
-
{
|
2707 |
-
$catDst->setMetaTitle($value);
|
2708 |
-
}
|
2709 |
-
else if ($key=="SeoDescription")
|
2710 |
-
{
|
2711 |
-
$catDst->setMetaDescription($value);
|
2712 |
-
}
|
2713 |
-
else if ($key=="SeoKeywords")
|
2714 |
-
{
|
2715 |
-
$catDst->setMetaKeywords($value);
|
2716 |
-
}
|
2717 |
-
else if ($key=="UrlKey")
|
2718 |
-
{
|
2719 |
-
$catDst->setUrlKey($value);
|
2720 |
-
$hasUrlKey=true;
|
2721 |
-
}
|
2722 |
-
if('custom_attributes' == $key){
|
2723 |
-
$custom_attributes = Mage::helper('eurotext_translationmanager')->getCustomCategoryAttributesForExport();
|
2724 |
-
|
2725 |
-
// value doesn't contain a text value as usual
|
2726 |
-
// only for custom_attributes key it's the node object
|
2727 |
-
$customAttributesNodes=$value->childNodes;
|
2728 |
-
|
2729 |
-
foreach ($customAttributesNodes as $customAttributesNode) {
|
2730 |
-
$custom_attribute_key = trim($customAttributesNode->nodeName);
|
2731 |
-
$custom_attribute_value = trim($customAttributesNode->textContent);
|
2732 |
-
if (array_key_exists($custom_attribute_key, $custom_attributes)) {
|
2733 |
-
$catDst->setDataUsingMethod($custom_attribute_key, $custom_attribute_value);
|
2734 |
-
}
|
2735 |
-
}
|
2736 |
-
}
|
2737 |
-
}
|
2738 |
-
|
2739 |
-
if (!$hasUrlKey)
|
2740 |
-
{
|
2741 |
-
// Check if urlkey is already set:
|
2742 |
-
$res=$dbr->fetchAll("SELECT value FROM ".$this->getTableName('catalog_category_entity_varchar')." WHERE entity_id=".$Id." AND store_id=".$project['storeview_dst']." AND attribute_id=".$urlkey_attribute_id);
|
2743 |
-
if (count($res)==0) // Currently using default storeview value
|
2744 |
-
{
|
2745 |
-
// setting null will force magento to generate the urlkey using the product-name
|
2746 |
-
$catDst->setUrlKey(null);
|
2747 |
-
}
|
2748 |
-
}
|
2749 |
-
|
2750 |
-
$catDst->save();
|
2751 |
-
}
|
2752 |
-
else
|
2753 |
-
{
|
2754 |
-
Mage::throwException($this->__("Wrong Category ID '%s'", $Id));
|
2755 |
-
}
|
2756 |
-
}
|
2757 |
-
}
|
2758 |
-
|
2759 |
-
public function importstepAction_ImportCMS($item,$full_filename,$project,$dbr)
|
2760 |
-
{
|
2761 |
-
$doc = new DOMDocument();
|
2762 |
-
$doc->load($full_filename);
|
2763 |
-
$cmsSites=$doc->getElementsByTagName("cms-site");
|
2764 |
-
foreach($cmsSites as $cmsSite)
|
2765 |
-
{
|
2766 |
-
$fieldNodes=$cmsSite->childNodes;
|
2767 |
-
|
2768 |
-
$Id=0;
|
2769 |
-
$fields=array();
|
2770 |
-
$StoreviewSrc=-1;
|
2771 |
-
$StoreviewDst=-1;
|
2772 |
-
|
2773 |
-
foreach($fieldNodes as $fieldNode)
|
2774 |
-
{
|
2775 |
-
$nodeName=trim($fieldNode->nodeName);
|
2776 |
-
$nodeContent=trim($fieldNode->textContent);
|
2777 |
-
|
2778 |
-
if ($nodeName!="")
|
2779 |
-
{
|
2780 |
-
if ($nodeName=="Id")
|
2781 |
-
{
|
2782 |
-
$Id=intval($nodeContent);
|
2783 |
-
}
|
2784 |
-
elseif ($nodeName=="StoreviewSrc")
|
2785 |
-
{
|
2786 |
-
$StoreviewSrc=intval($nodeContent);
|
2787 |
-
}
|
2788 |
-
elseif ($nodeName=="StoreviewDst")
|
2789 |
-
{
|
2790 |
-
$StoreviewDst=intval($nodeContent);
|
2791 |
-
}
|
2792 |
-
else
|
2793 |
-
{
|
2794 |
-
$fields[$nodeName]=$nodeContent;
|
2795 |
-
}
|
2796 |
-
}
|
2797 |
-
}
|
2798 |
-
|
2799 |
-
if ($Id>0)
|
2800 |
-
{
|
2801 |
-
$pageDst = null;
|
2802 |
-
$pageSrc=Mage::getModel('cms/page')->load($Id);
|
2803 |
-
|
2804 |
-
// Remove dst-storeview from source cms-page:
|
2805 |
-
$srcStoreviewIds=$pageSrc->getStoreId();
|
2806 |
-
if (in_array(0,$srcStoreviewIds))
|
2807 |
-
{
|
2808 |
-
// Resolve store_id=0 ("all storeviews"):
|
2809 |
-
$srcStore=Mage::getModel("core/store")->load($StoreviewSrc);
|
2810 |
-
$srcWebsite=$srcStore->getWebsite();
|
2811 |
-
$srcWebsiteStoreIds=$srcWebsite->getStoreIds();
|
2812 |
-
foreach($srcWebsiteStoreIds as $srcWebsiteStoreId)
|
2813 |
-
{
|
2814 |
-
$srcStoreviewIds[]=$srcWebsiteStoreId;
|
2815 |
-
}
|
2816 |
-
}
|
2817 |
-
$srcStoreviewIds=array_unique($srcStoreviewIds);
|
2818 |
-
// Remove destination storeview:
|
2819 |
-
$srcStoreviewIds=array_diff($srcStoreviewIds,array(0,$StoreviewDst));
|
2820 |
-
|
2821 |
-
$pageSrc->setStoreId($srcStoreviewIds);
|
2822 |
-
$pageSrc->save();
|
2823 |
-
|
2824 |
-
$identifier=$pageSrc->getIdentifier();
|
2825 |
-
// Find matching page:
|
2826 |
-
$matchingPages=$dbr->fetchAll("SELECT p.page_id FROM `".$this->getTableName('cms_page')."` p, `".$this->getTableName('cms_page_store')."` s WHERE (p.page_id=s.page_id) AND UPPER(p.identifier)=? AND s.store_id>0 AND s.store_id=? ORDER BY p.page_id ASC",array($identifier,$project['storeview_dst']));
|
2827 |
-
if (count($matchingPages)>0)
|
2828 |
-
{
|
2829 |
-
$matchingPage=$matchingPages[0];
|
2830 |
-
$page_id_dst=$matchingPage['page_id'];
|
2831 |
-
|
2832 |
-
$pageDst = Mage::getModel('cms/page')->load($page_id_dst);
|
2833 |
-
}
|
2834 |
-
else
|
2835 |
-
{
|
2836 |
-
// Destination CMS-Page does not exist yet, and needs to be created (clone source cms page)
|
2837 |
-
$pageData = array(
|
2838 |
-
'title' => $pageSrc->getTitle(),
|
2839 |
-
'root_template' => $pageSrc->getRootTemplate(),
|
2840 |
-
'meta_keywords' => $pageSrc->getMetaKeywords(),
|
2841 |
-
'meta_description' => $pageSrc->getMetaDescription(),
|
2842 |
-
'identifier' => $pageSrc->getIdentifier(),
|
2843 |
-
'content_heading' => $pageSrc->getContentHeading(),
|
2844 |
-
'stores' => array($StoreviewDst),
|
2845 |
-
'content' => $pageSrc->getContent()
|
2846 |
-
);
|
2847 |
-
$pageDst=Mage::getModel('cms/page')->setData($pageData)->save();
|
2848 |
-
}
|
2849 |
-
|
2850 |
-
$pageDst->setStoreId(array($StoreviewDst));
|
2851 |
-
|
2852 |
-
foreach ($fields as $key => $value)
|
2853 |
-
{
|
2854 |
-
if ($key=="Title")
|
2855 |
-
{
|
2856 |
-
$pageDst->setTitle($value);
|
2857 |
-
}
|
2858 |
-
elseif($key=="Content")
|
2859 |
-
{
|
2860 |
-
$pageDst->setContent($value);
|
2861 |
-
}
|
2862 |
-
elseif($key=="ContentHeading")
|
2863 |
-
{
|
2864 |
-
$pageDst->setContentHeading($value);
|
2865 |
-
}
|
2866 |
-
elseif($key=="SeoKeywords")
|
2867 |
-
{
|
2868 |
-
$pageDst->setMetaKeywords($value);
|
2869 |
-
}
|
2870 |
-
elseif($key=="SeoDescription")
|
2871 |
-
{
|
2872 |
-
$pageDst->setMetaDescription($value);
|
2873 |
-
}
|
2874 |
-
}
|
2875 |
-
|
2876 |
-
$pageDst->save();
|
2877 |
-
}
|
2878 |
-
}
|
2879 |
-
}
|
2880 |
-
|
2881 |
-
public function importstepAction_ImportBlocks($item,$full_filename,$project,$dbr)
|
2882 |
-
{
|
2883 |
-
$doc = new DOMDocument();
|
2884 |
-
$doc->load($full_filename);
|
2885 |
-
$cmsSites=$doc->getElementsByTagName("cms-site");
|
2886 |
-
foreach($cmsSites as $cmsSite)
|
2887 |
-
{
|
2888 |
-
$fieldNodes=$cmsSite->childNodes;
|
2889 |
-
|
2890 |
-
$Id=0;
|
2891 |
-
$fields=array();
|
2892 |
-
$StoreviewSrc=-1;
|
2893 |
-
$StoreviewDst=-1;
|
2894 |
-
|
2895 |
-
foreach($fieldNodes as $fieldNode)
|
2896 |
-
{
|
2897 |
-
$nodeName=trim($fieldNode->nodeName);
|
2898 |
-
$nodeContent=trim($fieldNode->textContent);
|
2899 |
-
|
2900 |
-
if ($nodeName!="")
|
2901 |
-
{
|
2902 |
-
if ($nodeName=="Id")
|
2903 |
-
{
|
2904 |
-
$Id=intval($nodeContent);
|
2905 |
-
}
|
2906 |
-
elseif ($nodeName=="StoreviewSrc")
|
2907 |
-
{
|
2908 |
-
$StoreviewSrc=intval($nodeContent);
|
2909 |
-
}
|
2910 |
-
elseif ($nodeName=="StoreviewDst")
|
2911 |
-
{
|
2912 |
-
$StoreviewDst=intval($nodeContent);
|
2913 |
-
}
|
2914 |
-
else
|
2915 |
-
{
|
2916 |
-
$fields[$nodeName]=$nodeContent;
|
2917 |
-
}
|
2918 |
-
}
|
2919 |
-
}
|
2920 |
-
|
2921 |
-
if ($Id>0)
|
2922 |
-
{
|
2923 |
-
$blockDst = null;
|
2924 |
-
$blockSrc=Mage::getModel('cms/block')->load($Id);
|
2925 |
-
|
2926 |
-
// Remove dst-storeview from source cms-block:
|
2927 |
-
$srcStoreviewIds=$blockSrc->getStoreId();
|
2928 |
-
if (in_array(0,$srcStoreviewIds))
|
2929 |
-
{
|
2930 |
-
// Resolve store_id=0 ("all storeviews"):
|
2931 |
-
$srcStore=Mage::getModel("core/store")->load($StoreviewSrc);
|
2932 |
-
$srcWebsite=$srcStore->getWebsite();
|
2933 |
-
$srcWebsiteStoreIds=$srcWebsite->getStoreIds();
|
2934 |
-
foreach($srcWebsiteStoreIds as $srcWebsiteStoreId)
|
2935 |
-
{
|
2936 |
-
$srcStoreviewIds[]=$srcWebsiteStoreId;
|
2937 |
-
}
|
2938 |
-
}
|
2939 |
-
$srcStoreviewIds=array_unique($srcStoreviewIds);
|
2940 |
-
// Remove destination storeview:
|
2941 |
-
$srcStoreviewIds=array_diff($srcStoreviewIds,array(0,$StoreviewDst));
|
2942 |
-
|
2943 |
-
$blockSrc->setStoreId($srcStoreviewIds);
|
2944 |
-
$blockSrc->save();
|
2945 |
-
|
2946 |
-
$identifier=$blockSrc->getIdentifier();
|
2947 |
-
// Find matching block:
|
2948 |
-
$matchingPages=$dbr->fetchAll("SELECT p.block_id FROM `".$this->getTableName('cms_block')."` p, `".$this->getTableName('cms_block_store')."` s WHERE (p.block_id=s.block_id) AND UPPER(p.identifier)=? AND s.store_id>0 AND s.store_id=? ORDER BY p.block_id ASC",array($identifier,$project['storeview_dst']));
|
2949 |
-
if (count($matchingPages)>0)
|
2950 |
-
{
|
2951 |
-
$matchingPage=$matchingPages[0];
|
2952 |
-
$block_id_dst=$matchingPage['block_id'];
|
2953 |
-
|
2954 |
-
$blockDst = Mage::getModel('cms/block')->load($block_id_dst);
|
2955 |
-
}
|
2956 |
-
else
|
2957 |
-
{
|
2958 |
-
// Destination CMS-Page does not exist yet, and needs to be created (clone source cms block)
|
2959 |
-
$blockData = array(
|
2960 |
-
'title' => $blockSrc->getTitle(),
|
2961 |
-
'root_template' => $blockSrc->getRootTemplate(),
|
2962 |
-
'meta_keywords' => $blockSrc->getMetaKeywords(),
|
2963 |
-
'meta_description' => $blockSrc->getMetaDescription(),
|
2964 |
-
'identifier' => $blockSrc->getIdentifier(),
|
2965 |
-
'content_heading' => $blockSrc->getContentHeading(),
|
2966 |
-
'stores' => array($StoreviewDst),
|
2967 |
-
'content' => $blockSrc->getContent()
|
2968 |
-
);
|
2969 |
-
$blockDst=Mage::getModel('cms/block')->setData($blockData)->save();
|
2970 |
-
}
|
2971 |
-
|
2972 |
-
$blockDst->setStoreId(array($StoreviewDst));
|
2973 |
-
|
2974 |
-
foreach ($fields as $key => $value)
|
2975 |
-
{
|
2976 |
-
if ($key=="Title")
|
2977 |
-
{
|
2978 |
-
$blockDst->setTitle($value);
|
2979 |
-
}
|
2980 |
-
elseif($key=="Content")
|
2981 |
-
{
|
2982 |
-
$blockDst->setContent($value);
|
2983 |
-
}
|
2984 |
-
elseif($key=="ContentHeading")
|
2985 |
-
{
|
2986 |
-
$blockDst->setContentHeading($value);
|
2987 |
-
}
|
2988 |
-
elseif($key=="SeoKeywords")
|
2989 |
-
{
|
2990 |
-
$blockDst->setMetaKeywords($value);
|
2991 |
-
}
|
2992 |
-
elseif($key=="SeoDescription")
|
2993 |
-
{
|
2994 |
-
$blockDst->setMetaDescription($value);
|
2995 |
-
}
|
2996 |
-
}
|
2997 |
-
|
2998 |
-
$blockDst->save();
|
2999 |
-
}
|
3000 |
-
}
|
3001 |
-
}
|
3002 |
-
|
3003 |
-
public function importstepAction_ImportAttributes($item,$full_filename,$project,$dbr)
|
3004 |
-
{
|
3005 |
-
$doc = new DOMDocument();
|
3006 |
-
$doc->load($full_filename);
|
3007 |
-
$attributes=$doc->getElementsByTagName("attribute");
|
3008 |
-
|
3009 |
-
$dbres = Mage::getSingleton('core/resource');
|
3010 |
-
$dbw=$dbres->getConnection('core_write');
|
3011 |
-
$dbr=$dbres->getConnection('core_read');
|
3012 |
-
|
3013 |
-
foreach($attributes as $attribute)
|
3014 |
-
{
|
3015 |
-
$attribute_id=intval($attribute->getAttribute("id"));
|
3016 |
-
$attributeName="";
|
3017 |
-
|
3018 |
-
$attributeNameNodes=$attribute->getElementsByTagName("AttributeName");
|
3019 |
-
foreach($attributeNameNodes as $attributeNameNode)
|
3020 |
-
{
|
3021 |
-
$attributeName=$attributeNameNode->textContent;
|
3022 |
-
}
|
3023 |
-
|
3024 |
-
// Update attribute label:
|
3025 |
-
$qResult=$dbr->fetchAll("SELECT attribute_label_id FROM `".$this->getTableName('eav_attribute_label')."` WHERE attribute_id=".$attribute_id." AND store_id=".$project['storeview_dst']);
|
3026 |
-
if (count($qResult)>0)
|
3027 |
-
{
|
3028 |
-
// Update:
|
3029 |
-
$dbw->query("UPDATE `".$this->getTableName('eav_attribute_label')."` SET `value`=? WHERE attribute_id=".$attribute_id." AND store_id=".$project['storeview_dst'],array($attributeName));
|
3030 |
-
}
|
3031 |
-
else
|
3032 |
-
{
|
3033 |
-
// Insert:
|
3034 |
-
$dbw->query("INSERT INTO `".$this->getTableName('eav_attribute_label')."` (attribute_id,store_id,`value`) VALUES (?,?,?)",array($attribute_id,$project['storeview_dst'],$attributeName));
|
3035 |
-
}
|
3036 |
-
|
3037 |
-
$options=$attribute->getElementsByTagName("option");
|
3038 |
-
foreach($options as $option)
|
3039 |
-
{
|
3040 |
-
$option_id=intval($option->getAttribute("id"));
|
3041 |
-
$optionName="";
|
3042 |
-
|
3043 |
-
$optionNameNodes=$option->getElementsByTagName("OptionName");
|
3044 |
-
foreach($optionNameNodes as $optionNameNode)
|
3045 |
-
{
|
3046 |
-
$optionName=$optionNameNode->textContent;
|
3047 |
-
}
|
3048 |
-
|
3049 |
-
// Update attribute label:
|
3050 |
-
$qResult=$dbr->fetchAll("SELECT value_id FROM `".$this->getTableName('eav_attribute_option_value')."` WHERE option_id=".$option_id." AND store_id=".$project['storeview_dst']);
|
3051 |
-
if (count($qResult)>0)
|
3052 |
-
{
|
3053 |
-
// Update:
|
3054 |
-
$dbw->query("UPDATE `".$this->getTableName('eav_attribute_option_value')."` SET `value`=? WHERE option_id=".$option_id." AND store_id=".$project['storeview_dst'],array($optionName));
|
3055 |
-
}
|
3056 |
-
else
|
3057 |
-
{
|
3058 |
-
// Insert:
|
3059 |
-
$dbw->query("INSERT INTO `".$this->getTableName('eav_attribute_option_value')."` (option_id,store_id,`value`) VALUES (?,?,?)",array($option_id,$project['storeview_dst'],$optionName));
|
3060 |
-
}
|
3061 |
-
}
|
3062 |
-
}
|
3063 |
-
}
|
3064 |
-
|
3065 |
-
public function importstepAction_ImportTemplates($item,$full_filename,$project,$dbr)
|
3066 |
-
{
|
3067 |
-
$abc=array();
|
3068 |
-
$abc['item']=$item;
|
3069 |
-
$abc['full_filename']=$full_filename;
|
3070 |
-
|
3071 |
-
$filename=$item['filename'];
|
3072 |
-
$filename=substr($filename,strlen("emailtemplates"));
|
3073 |
-
|
3074 |
-
$baseLocaleFolder=Mage::getBaseDir('locale');
|
3075 |
-
|
3076 |
-
$dst_filename=$baseLocaleFolder.DS.$project['storeview_dst_locale'].DS."template".$filename;
|
3077 |
-
$dst_directory=$this->getEurotextHelper()->GetDirectoryFromPath($dst_filename);
|
3078 |
-
if (!is_dir($dst_directory))
|
3079 |
-
{
|
3080 |
-
mkdir($dst_directory,0777,true);
|
3081 |
-
}
|
3082 |
-
|
3083 |
-
copy($full_filename,$dst_filename);
|
3084 |
-
}
|
3085 |
-
|
3086 |
-
public function importstepAction_ImportTranslation($item,$full_filename,$project,$dbr)
|
3087 |
-
{
|
3088 |
-
$doc = new DOMDocument();
|
3089 |
-
$doc->load($full_filename);
|
3090 |
-
$translations=$doc->getElementsByTagName("translation");
|
3091 |
-
foreach($translations as $translation)
|
3092 |
-
{
|
3093 |
-
$src_filename=$translation->getAttribute("src_filename");
|
3094 |
-
$dst_filename=$translation->getAttribute("dst_filename");
|
3095 |
-
|
3096 |
-
$translationDict=array();
|
3097 |
-
|
3098 |
-
$idx=0;
|
3099 |
-
$foundRow=true;
|
3100 |
-
while($foundRow)
|
3101 |
-
{
|
3102 |
-
$idx++;
|
3103 |
-
$lineName="line".$idx;
|
3104 |
-
|
3105 |
-
$foundRow=false;
|
3106 |
-
$sublines=$translation->getElementsByTagName($lineName);
|
3107 |
-
foreach($sublines as $subline)
|
3108 |
-
{
|
3109 |
-
$foundRow=true;
|
3110 |
-
|
3111 |
-
$lines=$subline->getElementsByTagName("line");
|
3112 |
-
foreach($lines as $line)
|
3113 |
-
{
|
3114 |
-
$srchash=$line->getAttribute("srchash");
|
3115 |
-
$text_translated=$line->textContent;
|
3116 |
-
|
3117 |
-
// Get original line:
|
3118 |
-
$origLines=$dbr->fetchAll("SELECT text_src FROM `".$this->getTableName('eurotext_csv_data')."` WHERE text_src_hash=?",array($srchash));
|
3119 |
-
if (count($origLines)>0)
|
3120 |
-
{
|
3121 |
-
$origLine=$origLines[0];
|
3122 |
-
$text_original=$origLine['text_src'];
|
3123 |
-
|
3124 |
-
$translationDict[$text_original]=$text_translated;
|
3125 |
-
}
|
3126 |
-
}
|
3127 |
-
}
|
3128 |
-
}
|
3129 |
-
|
3130 |
-
$full_path=Mage::getBaseDir('app').$dst_filename;
|
3131 |
-
|
3132 |
-
// Create Backup:
|
3133 |
-
if (is_file($full_path))
|
3134 |
-
{
|
3135 |
-
$backup_path=$this->getProjectXMLPath($project,"backup").$dst_filename;
|
3136 |
-
$backup_dir=$this->getEurotextHelper()->GetDirectoryFromPath($backup_path);
|
3137 |
-
if (!is_dir($backup_dir))
|
3138 |
-
{
|
3139 |
-
mkdir($backup_dir,0777,true);
|
3140 |
-
}
|
3141 |
-
if (!is_file($backup_path))
|
3142 |
-
{
|
3143 |
-
copy($full_path,$backup_path);
|
3144 |
-
}
|
3145 |
-
}
|
3146 |
-
|
3147 |
-
// Read destination csv:
|
3148 |
-
if (is_file($full_path))
|
3149 |
-
{
|
3150 |
-
$fp=fopen($full_path,"r");
|
3151 |
-
$lineIndex=0;
|
3152 |
-
do
|
3153 |
-
{
|
3154 |
-
$fields=fgetcsv($fp,0,",","\"");
|
3155 |
-
if ($fields!==false)
|
3156 |
-
{
|
3157 |
-
if (count($fields)==2)
|
3158 |
-
{
|
3159 |
-
if (array_key_exists($fields[0],$translationDict))
|
3160 |
-
{
|
3161 |
-
// Skip
|
3162 |
-
}
|
3163 |
-
else
|
3164 |
-
{
|
3165 |
-
// Add item:
|
3166 |
-
$translationDict[$fields[0]]=$fields[1];
|
3167 |
-
}
|
3168 |
-
}
|
3169 |
-
}
|
3170 |
-
|
3171 |
-
$lineIndex++;
|
3172 |
-
}
|
3173 |
-
while($fields!==false);
|
3174 |
-
fclose($fp);
|
3175 |
-
}
|
3176 |
-
|
3177 |
-
// Create folder, if not exists:
|
3178 |
-
$full_path_dir=$this->getEurotextHelper()->GetDirectoryFromPath($full_path);
|
3179 |
-
if (!is_dir($full_path_dir))
|
3180 |
-
{
|
3181 |
-
mkdir($full_path_dir,0777,true);
|
3182 |
-
}
|
3183 |
-
|
3184 |
-
// Write new file:
|
3185 |
-
{
|
3186 |
-
$wp=fopen($full_path,"w");
|
3187 |
-
{
|
3188 |
-
foreach($translationDict as $key => $val)
|
3189 |
-
{
|
3190 |
-
$fields=array($key,$val);
|
3191 |
-
fputcsv($wp,$fields,",","\"");
|
3192 |
-
}
|
3193 |
-
}
|
3194 |
-
fclose($wp);
|
3195 |
-
}
|
3196 |
-
}
|
3197 |
-
}
|
3198 |
-
|
3199 |
-
public function uploadAction()
|
3200 |
-
{
|
3201 |
-
|
3202 |
-
// Clear tmp folder:
|
3203 |
-
$tmpdir=$this->getTempDir();
|
3204 |
-
$this->deleteDirectoryRecursive($tmpdir);
|
3205 |
-
$tmpdir=$this->getTempDir();
|
3206 |
-
|
3207 |
-
if(isset($_FILES['zipfile']['name']) && $_FILES['zipfile']['name'] != '')
|
3208 |
-
{
|
3209 |
-
try
|
3210 |
-
{
|
3211 |
-
$fname = $_FILES['zipfile']['name']; //file name
|
3212 |
-
$uploader = new Varien_File_Uploader('zipfile'); //load class
|
3213 |
-
$uploader->setAllowedExtensions(array('zip'));
|
3214 |
-
$uploader->setAllowCreateFolders(true); //for creating the directory if not exists
|
3215 |
-
$uploader->setAllowRenameFiles(false); //if true, uploaded file's name will be changed, if file with the same name already exists directory.
|
3216 |
-
$uploader->setFilesDispersion(false);
|
3217 |
-
$uploader->save($tmpdir,$fname); //save the file on the specified path
|
3218 |
-
|
3219 |
-
$import_url=Mage::helper('adminhtml')->getUrl('*/*/importextract');
|
3220 |
-
$this->_redirectUrl($import_url);
|
3221 |
-
}
|
3222 |
-
catch (Exception $e)
|
3223 |
-
{
|
3224 |
-
$this->loadLayout('adminhtml_eurotext_translationmanager_text');
|
3225 |
-
$block = $this->getLayout()->getBlock('et.tm.response.text');
|
3226 |
-
|
3227 |
-
$block->setText($this->__("Error Message").': '.$e->getMessage());
|
3228 |
-
$this->renderLayout();
|
3229 |
-
}
|
3230 |
-
}
|
3231 |
-
else
|
3232 |
-
{
|
3233 |
-
$this->loadLayout('adminhtml_eurotext_translationmanager_text');
|
3234 |
-
$block = $this->getLayout()->getBlock('et.tm.response.text');
|
3235 |
-
|
3236 |
-
$block->setText($this->__("No file given."));
|
3237 |
-
$this->renderLayout();
|
3238 |
-
}
|
3239 |
-
}
|
3240 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,230 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Adminhtml_Eurotext_Translationmanager_RegisterController extends Mage_Adminhtml_Controller_Action
|
4 |
-
{
|
5 |
-
|
6 |
-
protected $helper = false;
|
7 |
-
|
8 |
-
protected function _isAllowed()
|
9 |
-
{
|
10 |
-
return Mage::getSingleton('admin/session')
|
11 |
-
->isAllowed('eurotext_translationmanager/register');
|
12 |
-
}
|
13 |
-
|
14 |
-
|
15 |
-
protected function _construct(){
|
16 |
-
$this->helper = Mage::helper('eurotext_translationmanager');
|
17 |
-
}
|
18 |
-
|
19 |
-
protected function getHelper(){
|
20 |
-
return $this->helper;
|
21 |
-
}
|
22 |
-
|
23 |
-
public function indexAction()
|
24 |
-
{
|
25 |
-
$this->loadLayout();
|
26 |
-
$this->renderLayout();
|
27 |
-
}
|
28 |
-
|
29 |
-
public function addLine(&$str, $line)
|
30 |
-
{
|
31 |
-
$str=$str."".$line."\r\n";
|
32 |
-
return $str;
|
33 |
-
}
|
34 |
-
|
35 |
-
public function addLineHtml(&$str, $line)
|
36 |
-
{
|
37 |
-
$str2="<div>";
|
38 |
-
$str2.=$line;
|
39 |
-
$str2.="</div>";
|
40 |
-
|
41 |
-
return $this->addLine($str,$str2);
|
42 |
-
}
|
43 |
-
|
44 |
-
public function htmlencode($str)
|
45 |
-
{
|
46 |
-
return htmlentities($str,ENT_QUOTES,'UTF-8');
|
47 |
-
}
|
48 |
-
|
49 |
-
public function AnredeAufDeutsch($anrede)
|
50 |
-
{
|
51 |
-
if ($anrede=="MR") { return "Herr"; }
|
52 |
-
if ($anrede=="MRS") { return "Frau"; }
|
53 |
-
|
54 |
-
return $anrede;
|
55 |
-
}
|
56 |
-
|
57 |
-
public function saveAction()
|
58 |
-
{
|
59 |
-
/** @var Eurotext_TranslationManager_Helper_Data $helper */
|
60 |
-
$helper=$this->getHelper();
|
61 |
-
$request=$this->getRequest();
|
62 |
-
|
63 |
-
$prev_register_shopname = $helper->getSetting("register_shopname","");
|
64 |
-
$prev_register_url = $helper->getSetting("register_url","");
|
65 |
-
$prev_register_email = $helper->getSetting("register_email","");
|
66 |
-
$prev_register_sal = $helper->getSetting("register_sal","");
|
67 |
-
$prev_register_fname = $helper->getSetting("register_fname","");
|
68 |
-
$prev_register_lname = $helper->getSetting("register_lname","");
|
69 |
-
$prev_register_company = $helper->getSetting("register_company","");
|
70 |
-
$prev_register_street = $helper->getSetting("register_street","");
|
71 |
-
$prev_register_hnumber = $helper->getSetting("register_hnumber","");
|
72 |
-
$prev_register_zip = $helper->getSetting("register_zip","");
|
73 |
-
$prev_register_city = $helper->getSetting("register_city","");
|
74 |
-
$prev_register_country = $helper->getSetting("register_country","");
|
75 |
-
$prev_register_telefon = $helper->getSetting("register_telefon","");
|
76 |
-
|
77 |
-
$new_register_shopname = $request->getParam("register_shopname");
|
78 |
-
$new_register_url = $request->getParam("register_url");
|
79 |
-
$new_register_email = $request->getParam("register_email");
|
80 |
-
$new_register_sal = $request->getParam("register_sal");
|
81 |
-
$new_register_fname = $request->getParam("register_fname");
|
82 |
-
$new_register_lname = $request->getParam("register_lname");
|
83 |
-
$new_register_company = $request->getParam("register_company");
|
84 |
-
$new_register_street = $request->getParam("register_street");
|
85 |
-
$new_register_hnumber = $request->getParam("register_hnumber");
|
86 |
-
$new_register_zip = $request->getParam("register_zip");
|
87 |
-
$new_register_city = $request->getParam("register_city");
|
88 |
-
$new_register_country = $request->getParam("register_country");
|
89 |
-
$new_register_telefon = $request->getParam("register_telefon");
|
90 |
-
|
91 |
-
// Save settings:
|
92 |
-
$helper->saveSetting("register_shopname", $request->getParam("register_shopname"));
|
93 |
-
$helper->saveSetting("register_url", $request->getParam("register_url"));
|
94 |
-
$helper->saveSetting("register_email", $request->getParam("register_email"));
|
95 |
-
$helper->saveSetting("register_sal", $request->getParam("register_sal"));
|
96 |
-
$helper->saveSetting("register_fname", $request->getParam("register_fname"));
|
97 |
-
$helper->saveSetting("register_lname", $request->getParam("register_lname"));
|
98 |
-
$helper->saveSetting("register_shopname", $request->getParam("register_shopname"));
|
99 |
-
$helper->saveSetting("register_company", $request->getParam("register_company"));
|
100 |
-
$helper->saveSetting("register_street", $request->getParam("register_street"));
|
101 |
-
$helper->saveSetting("register_hnumber", $request->getParam("register_hnumber"));
|
102 |
-
$helper->saveSetting("register_zip", $request->getParam("register_zip"));
|
103 |
-
$helper->saveSetting("register_city", $request->getParam("register_city"));
|
104 |
-
$helper->saveSetting("register_country", $request->getParam("register_country"));
|
105 |
-
$helper->saveSetting("register_telefon", $request->getParam("register_telefon"));
|
106 |
-
|
107 |
-
$register_mailsent=$helper->getSetting("register_mailsent", "0");
|
108 |
-
|
109 |
-
$email_body="";
|
110 |
-
$this->addLine($email_body,"<div>Hallo,</div>");
|
111 |
-
if ($register_mailsent=="1")
|
112 |
-
{
|
113 |
-
$this->addLine($email_body,"<div>".$this->htmlencode("Ein Kunde hat im Magento-Modul seine Kontaktdaten geändert:")."</div>");
|
114 |
-
}
|
115 |
-
else
|
116 |
-
{
|
117 |
-
$this->addLine($email_body,"<div>".$this->htmlencode("Ein Kunde hat sich via Magento-Modul neu registriert")."</div>");
|
118 |
-
}
|
119 |
-
|
120 |
-
$this->addLine($email_body,"<div>Kundennummer: ".$this->htmlencode($helper->getSetting("eurotext_customerid",""))."</div>");
|
121 |
-
$this->addLine($email_body,"<div>Benutzername: ".$this->htmlencode($helper->getSetting("eurotext_username",""))."</div>");
|
122 |
-
|
123 |
-
$fieldItems=array();
|
124 |
-
$fieldItems[0]['title']='Shopname';
|
125 |
-
$fieldItems[0]['new']=$new_register_shopname;
|
126 |
-
$fieldItems[0]['prev']=$prev_register_shopname;
|
127 |
-
|
128 |
-
$fieldItems[1]['title']='Shop URL';
|
129 |
-
$fieldItems[1]['new']=$new_register_url;
|
130 |
-
$fieldItems[1]['prev']=$prev_register_url;
|
131 |
-
|
132 |
-
$fieldItems[2]['title']='eMail-Adresse';
|
133 |
-
$fieldItems[2]['new']=$new_register_email;
|
134 |
-
$fieldItems[2]['prev']=$prev_register_email;
|
135 |
-
|
136 |
-
$fieldItems[3]['title']='Anrede';
|
137 |
-
$fieldItems[3]['new']=$this->AnredeAufDeutsch($new_register_sal);
|
138 |
-
$fieldItems[3]['prev']=$this->AnredeAufDeutsch($prev_register_sal);
|
139 |
-
|
140 |
-
$fieldItems[4]['title']='Vorname';
|
141 |
-
$fieldItems[4]['new']=$new_register_fname;
|
142 |
-
$fieldItems[4]['prev']=$prev_register_fname;
|
143 |
-
|
144 |
-
$fieldItems[5]['title']='Nachname';
|
145 |
-
$fieldItems[5]['new']=$new_register_lname;
|
146 |
-
$fieldItems[5]['prev']=$prev_register_lname;
|
147 |
-
|
148 |
-
$fieldItems[6]['title']='Firma';
|
149 |
-
$fieldItems[6]['new']=$new_register_company;
|
150 |
-
$fieldItems[6]['prev']=$prev_register_company;
|
151 |
-
|
152 |
-
$fieldItems[7]['title']='Strasse';
|
153 |
-
$fieldItems[7]['new']=$new_register_street;
|
154 |
-
$fieldItems[7]['prev']=$prev_register_street;
|
155 |
-
|
156 |
-
$fieldItems[8]['title']='Hausnr';
|
157 |
-
$fieldItems[8]['new']=$new_register_hnumber;
|
158 |
-
$fieldItems[8]['prev']=$prev_register_hnumber;
|
159 |
-
|
160 |
-
$fieldItems[9]['title']='PLZ';
|
161 |
-
$fieldItems[9]['new']=$new_register_zip;
|
162 |
-
$fieldItems[9]['prev']=$prev_register_zip;
|
163 |
-
|
164 |
-
$fieldItems[10]['title']='Stadt';
|
165 |
-
$fieldItems[10]['new']=$new_register_city;
|
166 |
-
$fieldItems[10]['prev']=$prev_register_city;
|
167 |
-
|
168 |
-
$fieldItems[11]['title']='Land';
|
169 |
-
$fieldItems[11]['new']=$new_register_country;
|
170 |
-
$fieldItems[11]['prev']=$prev_register_country;
|
171 |
-
|
172 |
-
$fieldItems[12]['title']='Tel-Nr';
|
173 |
-
$fieldItems[12]['new']=$new_register_telefon;
|
174 |
-
$fieldItems[12]['prev']=$prev_register_telefon;
|
175 |
-
|
176 |
-
$this->addLine($email_body,"<hr size=1 color=black>");
|
177 |
-
|
178 |
-
for($i=0; $i<count($fieldItems); $i++)
|
179 |
-
{
|
180 |
-
$item=$fieldItems[$i];
|
181 |
-
|
182 |
-
$hasChanged=($item['new']!=$item['prev']);
|
183 |
-
|
184 |
-
$line=$this->htmlencode($item['title']);
|
185 |
-
$line.=": ";
|
186 |
-
$line.=$this->htmlencode($item['new']);
|
187 |
-
$line.=" (";
|
188 |
-
if ($hasChanged)
|
189 |
-
{
|
190 |
-
$line.="<span style='color:red;font-weight:bold;'>";
|
191 |
-
}
|
192 |
-
$line.=$this->htmlencode($item['prev']);
|
193 |
-
if ($hasChanged)
|
194 |
-
{
|
195 |
-
$line.="</span>";
|
196 |
-
}
|
197 |
-
$line.=")";
|
198 |
-
|
199 |
-
$this->addLineHtml($email_body,$line);
|
200 |
-
}
|
201 |
-
|
202 |
-
// Send email:
|
203 |
-
$helper=$this->getHelper();
|
204 |
-
$sender_email=Mage::getStoreConfig('trans_email/ident_general/email');
|
205 |
-
$sender_name=Mage::getStoreConfig('trans_email/ident_general/name');
|
206 |
-
$recipient=$helper->getRegistrationRecipient();
|
207 |
-
|
208 |
-
$mail = new Zend_Mail('UTF-8');
|
209 |
-
$mail->setBodyHtml($email_body);
|
210 |
-
$mail->setFrom($sender_email,$sender_name);
|
211 |
-
$mail->addTo($recipient['email'],$recipient['name']);
|
212 |
-
|
213 |
-
if ($register_mailsent=="1")
|
214 |
-
{
|
215 |
-
$mail->setSubject("Update - Ein Magento translationMANAGER-Kunde hat seine Registrierungsdaten geändert");
|
216 |
-
}
|
217 |
-
else
|
218 |
-
{
|
219 |
-
$mail->setSubject("Magento translationMANAGER: Registrierung");
|
220 |
-
}
|
221 |
-
$mail->send();
|
222 |
-
|
223 |
-
// Registration done:
|
224 |
-
$helper->saveSetting("register_mailsent_date", date("d.m.Y H:i:s")." (".date_default_timezone_get().")");
|
225 |
-
$helper->saveSetting("register_mailsent", "1");
|
226 |
-
|
227 |
-
$url=Mage::helper('adminhtml')->getUrl('*/*/index',array('saved' => true));
|
228 |
-
$this->_redirectUrl($url);
|
229 |
-
}
|
230 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,134 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Adminhtml_Eurotext_Translationmanager_SelectcategoriesController extends Mage_Adminhtml_Controller_Action
|
4 |
-
{
|
5 |
-
private function getTableName($tblName)
|
6 |
-
{
|
7 |
-
return Mage::getSingleton('core/resource')->getTableName($tblName);
|
8 |
-
}
|
9 |
-
|
10 |
-
public function indexAction()
|
11 |
-
{
|
12 |
-
$this->loadLayout();
|
13 |
-
$this->renderLayout();
|
14 |
-
}
|
15 |
-
|
16 |
-
private function getAllChildCategoryIds($cat_id)
|
17 |
-
{
|
18 |
-
$rv=array();
|
19 |
-
|
20 |
-
array_push($rv,$cat_id);
|
21 |
-
|
22 |
-
$category=Mage::getModel('catalog/category')->load($cat_id);
|
23 |
-
$childs=$category->getChildrenCategories();
|
24 |
-
if ($childs!=null)
|
25 |
-
{
|
26 |
-
foreach($childs as $child)
|
27 |
-
{
|
28 |
-
$rvSub=$this->getAllChildCategoryIds($child->getId());
|
29 |
-
|
30 |
-
$rv=array_merge($rv,$rvSub);
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
$rv=array_unique($rv);
|
35 |
-
|
36 |
-
return $rv;
|
37 |
-
}
|
38 |
-
|
39 |
-
public function saveAction()
|
40 |
-
{
|
41 |
-
|
42 |
-
$this->loadLayout('adminhtml_eurotext_translationmanager_text');
|
43 |
-
$block = $this->getLayout()->getBlock('et.tm.response.text');
|
44 |
-
|
45 |
-
$project_id=intval($this->getRequest()->getParam("project_id"));
|
46 |
-
$cnt=intval($this->getRequest()->getParam("cnt"));
|
47 |
-
$selectAction=$this->getRequest()->getParam("select");
|
48 |
-
|
49 |
-
$dbres = Mage::getSingleton('core/resource');
|
50 |
-
$dbr=$dbres->getConnection('core_read');
|
51 |
-
$dbw=$dbres->getConnection('core_write');
|
52 |
-
|
53 |
-
for($i=0; $i<$cnt; $i++)
|
54 |
-
{
|
55 |
-
$category_id=$this->getRequest()->getParam("category_id_".$i);
|
56 |
-
$set=$this->getRequest()->getParam("set_".$i);
|
57 |
-
|
58 |
-
if ($category_id>0)
|
59 |
-
{
|
60 |
-
$cat_ids=$this->getAllChildCategoryIds($category_id);
|
61 |
-
|
62 |
-
foreach($cat_ids as $cat_id)
|
63 |
-
{
|
64 |
-
if ($set=="enabled")
|
65 |
-
{
|
66 |
-
$time_added=time();
|
67 |
-
|
68 |
-
$dbw->query("INSERT IGNORE INTO `".$this->getTableName('eurotext_project_categories')."` (category_id,project_id) VALUES (?,?);",array($cat_id,$project_id));
|
69 |
-
|
70 |
-
// Update timestamp:
|
71 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_project_categories')."` SET time_added=? WHERE category_id=? AND project_id=?;",array($time_added,$cat_id,$project_id));
|
72 |
-
}
|
73 |
-
else
|
74 |
-
{
|
75 |
-
$dbw->query("DELETE FROM `".$this->getTableName('eurotext_project_categories')."` WHERE category_id=? AND project_id=?;",array($cat_id,$project_id));
|
76 |
-
}
|
77 |
-
}
|
78 |
-
}
|
79 |
-
}
|
80 |
-
|
81 |
-
if ($selectAction=="all")
|
82 |
-
{
|
83 |
-
$time_added=time();
|
84 |
-
|
85 |
-
$allCategoryIds=$this->getAllCategoryIds();
|
86 |
-
|
87 |
-
foreach($allCategoryIds as $category_id)
|
88 |
-
{
|
89 |
-
$dbw->query("INSERT IGNORE INTO `".$this->getTableName('eurotext_project_categories')."` (category_id,project_id) VALUES (?,?);",array($category_id,$project_id));
|
90 |
-
}
|
91 |
-
|
92 |
-
// Update timestamp:
|
93 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_project_categories')."` SET time_added=? WHERE project_id=?;",array($time_added,$project_id));
|
94 |
-
}
|
95 |
-
else if ($selectAction=="none")
|
96 |
-
{
|
97 |
-
$dbw->query("DELETE FROM `".$this->getTableName('eurotext_project_categories')."` WHERE project_id=?;",array($project_id));
|
98 |
-
}
|
99 |
-
|
100 |
-
// get result list:
|
101 |
-
$eavAttribute = Mage::getModel('eav/entity_attribute');
|
102 |
-
$name_id = $eavAttribute->getIdByCode('catalog_category', 'name');
|
103 |
-
|
104 |
-
$sql="SELECT e.entity_id FROM `".$this->getTableName('catalog_category_entity_varchar')."` a, `".$this->getTableName('catalog_category_entity')."` e, `".$this->getTableName('eurotext_project_categories')."` p WHERE (a.store_id=0) AND (a.entity_id=e.entity_id) AND (a.attribute_id=?) AND (p.category_id=e.entity_id) AND (p.project_id=?) ORDER BY time_added DESC, a.value ASC, e.entity_id ASC";
|
105 |
-
$categories=$dbr->fetchAll($sql,array($name_id,$project_id));
|
106 |
-
|
107 |
-
$rv = '';
|
108 |
-
|
109 |
-
// Results:
|
110 |
-
$rv .= "<table cellpadding=0 cellspacing=0>";
|
111 |
-
$rv .= "<tr>";
|
112 |
-
$rv .= " <td class='et_th'>".$this->__("Translate")."</td>";
|
113 |
-
$rv .= " <td class='et_th'>".$this->__("Designation")."</td>";
|
114 |
-
$rv .= " <td class='et_th'> </td>";
|
115 |
-
$rv .= "</tr>";
|
116 |
-
|
117 |
-
foreach($categories as $category_id)
|
118 |
-
{
|
119 |
-
$category=Mage::getModel("catalog/category")->load($category_id);
|
120 |
-
|
121 |
-
$rv .= "<tr>";
|
122 |
-
$rv .= " <td class='et_tc'><input type='checkbox' id='et_selcategory2_".$category->getId()."' class='et_selcategory et_selcategory_".$category->getId()."' checked='checked' onchange=\"eurotext_selectcategory('2','".$category->getId()."')\" /></td>";
|
123 |
-
$rv .= " <td class='et_tc'>".$category->getName()."</td>";
|
124 |
-
$rv .= " <td class='et_tc'> </td>";
|
125 |
-
$rv .= "</tr>";
|
126 |
-
}
|
127 |
-
|
128 |
-
$rv .= "</table>";
|
129 |
-
|
130 |
-
|
131 |
-
$block->setText($rv);
|
132 |
-
$this->renderLayout();
|
133 |
-
}
|
134 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,123 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Adminhtml_Eurotext_Translationmanager_SelectcmspagesController extends Mage_Adminhtml_Controller_Action
|
4 |
-
{
|
5 |
-
private function getTableName($tblName)
|
6 |
-
{
|
7 |
-
return Mage::getSingleton('core/resource')->getTableName($tblName);
|
8 |
-
}
|
9 |
-
|
10 |
-
public function indexAction()
|
11 |
-
{
|
12 |
-
$this->loadLayout();
|
13 |
-
$this->renderLayout();
|
14 |
-
}
|
15 |
-
|
16 |
-
public function saveAction()
|
17 |
-
{
|
18 |
-
$this->loadLayout('adminhtml_eurotext_translationmanager_text');
|
19 |
-
$block = $this->getLayout()->getBlock('et.tm.response.text');
|
20 |
-
|
21 |
-
|
22 |
-
$rv = '';
|
23 |
-
|
24 |
-
$project_id=intval($this->getRequest()->getParam("project_id"));
|
25 |
-
$cnt_pages=intval($this->getRequest()->getParam("cnt_pages"));
|
26 |
-
$cnt_blocks=intval($this->getRequest()->getParam("cnt_blocks"));
|
27 |
-
$selectAction=$this->getRequest()->getParam("select");
|
28 |
-
|
29 |
-
$dbres = Mage::getSingleton('core/resource');
|
30 |
-
$dbr=$dbres->getConnection('core_read');
|
31 |
-
$dbw=$dbres->getConnection('core_write');
|
32 |
-
|
33 |
-
for($i=0; $i<$cnt_pages; $i++)
|
34 |
-
{
|
35 |
-
$page_id=intval($this->getRequest()->getParam("page_id_".$i));
|
36 |
-
$set=$this->getRequest()->getParam("setpage_".$i);
|
37 |
-
|
38 |
-
if ($page_id>0)
|
39 |
-
{
|
40 |
-
if ($set=="enabled")
|
41 |
-
{
|
42 |
-
$time_added=time();
|
43 |
-
|
44 |
-
$dbw->query("INSERT IGNORE INTO `".$this->getTableName('eurotext_project_cmspages')."` (page_id,project_id) VALUES (?,?);",array($page_id,$project_id));
|
45 |
-
|
46 |
-
// Update timestamp:
|
47 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_project_cmspages')."` SET time_added=? WHERE page_id=? AND project_id=?;",array($time_added,$page_id,$project_id));
|
48 |
-
}
|
49 |
-
else
|
50 |
-
{
|
51 |
-
$dbw->query("DELETE FROM `".$this->getTableName('eurotext_project_cmspages')."` WHERE page_id=? AND project_id=?;",array($page_id,$project_id));
|
52 |
-
}
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
for($i=0; $i<$cnt_blocks; $i++)
|
57 |
-
{
|
58 |
-
$block_id=intval($this->getRequest()->getParam("block_id_".$i));
|
59 |
-
$set=$this->getRequest()->getParam("setblock_".$i);
|
60 |
-
|
61 |
-
if ($block_id>0)
|
62 |
-
{
|
63 |
-
if ($set=="enabled")
|
64 |
-
{
|
65 |
-
$time_added=time();
|
66 |
-
|
67 |
-
$dbw->query("INSERT IGNORE INTO `".$this->getTableName('eurotext_project_cmsblocks')."` (block_id,project_id) VALUES (?,?);",array($block_id,$project_id));
|
68 |
-
|
69 |
-
// Update timestamp:
|
70 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_project_cmsblocks')."` SET time_added=? WHERE block_id=? AND project_id=?;",array($time_added,$block_id,$project_id));
|
71 |
-
}
|
72 |
-
else
|
73 |
-
{
|
74 |
-
$dbw->query("DELETE FROM `".$this->getTableName('eurotext_project_cmsblocks')."` WHERE block_id=? AND project_id=?;",array($block_id,$project_id));
|
75 |
-
}
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
if ($selectAction=="none")
|
80 |
-
{
|
81 |
-
$dbw->query("DELETE FROM `".$this->getTableName('eurotext_project_cmspages')."` WHERE project_id=?;",array($project_id));
|
82 |
-
$dbw->query("DELETE FROM `".$this->getTableName('eurotext_project_cmsblocks')."` WHERE project_id=?;",array($project_id));
|
83 |
-
}
|
84 |
-
|
85 |
-
// Results:
|
86 |
-
$rv .= "<table cellpadding=0 cellspacing=0>";
|
87 |
-
$rv .= "<tr>";
|
88 |
-
$rv .= " <td class='et_th'>".$this->__("Translate")."</td>";
|
89 |
-
$rv .= " <td class='et_th'>".$this->__("Designation")."</td>";
|
90 |
-
$rv .= " <td class='et_th'> </td>";
|
91 |
-
$rv .= "</tr>";
|
92 |
-
|
93 |
-
// get result list:
|
94 |
-
$sql="SELECT c.* FROM `".$this->getTableName('cms_page')."` c, `".$this->getTableName('eurotext_project_cmspages')."` p WHERE (c.page_id=p.page_id) AND (p.project_id=?) ORDER BY time_added DESC, c.title ASC, c.page_id ASC";
|
95 |
-
$cms_pages=$dbr->fetchAll($sql,array($project_id));
|
96 |
-
foreach($cms_pages as $cms_page)
|
97 |
-
{
|
98 |
-
$rv .= "<tr>";
|
99 |
-
$rv .= " <td class='et_tc'><input type='checkbox' id='et_selpage2_".$cms_page['page_id']."' class='et_selcmspage et_selcmspage_".$cms_page['page_id']."' checked='checked' onchange=\"eurotext_selectcmspage('2','".$cms_page['page_id']."')\" /></td>";
|
100 |
-
$rv .= " <td class='et_tc'>".$cms_page['title']."</td>";
|
101 |
-
$rv .= " <td class='et_tc'> </td>";
|
102 |
-
$rv .= "</tr>";
|
103 |
-
}
|
104 |
-
|
105 |
-
// get result list:
|
106 |
-
$sql="SELECT c.* FROM `".$this->getTableName('cms_block')."` c, `".$this->getTableName('eurotext_project_cmsblocks')."` p WHERE (c.block_id=p.block_id) AND (p.project_id=?) ORDER BY time_added DESC, c.title ASC, c.block_id ASC";
|
107 |
-
$cms_blocks=$dbr->fetchAll($sql,array($project_id));
|
108 |
-
foreach($cms_blocks as $cms_block)
|
109 |
-
{
|
110 |
-
$rv .= "<tr>";
|
111 |
-
$rv .= " <td class='et_tc'><input type='checkbox' id='et_selblock2_".$cms_block['block_id']."' class='et_selcmsblock et_selcmsblock_".$cms_block['block_id']."' checked='checked' onchange=\"eurotext_selectcmsblock('2','".$cms_block['block_id']."')\" /></td>";
|
112 |
-
$rv .= " <td class='et_tc'>".$cms_block['title']."</td>";
|
113 |
-
$rv .= " <td class='et_tc'> </td>";
|
114 |
-
$rv .= "</tr>";
|
115 |
-
}
|
116 |
-
|
117 |
-
$rv .= "</table>";
|
118 |
-
|
119 |
-
$block->setText($rv);
|
120 |
-
$this->renderLayout();
|
121 |
-
|
122 |
-
}
|
123 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,88 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Adminhtml_Eurotext_Translationmanager_SelectemailsController extends Mage_Adminhtml_Controller_Action
|
4 |
-
{
|
5 |
-
private function getTableName($tblName)
|
6 |
-
{
|
7 |
-
return Mage::getSingleton('core/resource')->getTableName($tblName);
|
8 |
-
}
|
9 |
-
|
10 |
-
public function indexAction()
|
11 |
-
{
|
12 |
-
$this->loadLayout();
|
13 |
-
$this->renderLayout();
|
14 |
-
}
|
15 |
-
|
16 |
-
public function saveAction()
|
17 |
-
{
|
18 |
-
|
19 |
-
$this->loadLayout('adminhtml_eurotext_translationmanager_text');
|
20 |
-
$block = $this->getLayout()->getBlock('et.tm.response.text');
|
21 |
-
|
22 |
-
|
23 |
-
$project_id=intval($this->getRequest()->getParam("project_id"));
|
24 |
-
$cnt=intval($this->getRequest()->getParam("cnt"));
|
25 |
-
$selectAction=$this->getRequest()->getParam("select");
|
26 |
-
|
27 |
-
$dbres = Mage::getSingleton('core/resource');
|
28 |
-
$dbr=$dbres->getConnection('core_read');
|
29 |
-
$dbw=$dbres->getConnection('core_write');
|
30 |
-
|
31 |
-
for($i=0; $i<$cnt; $i++)
|
32 |
-
{
|
33 |
-
$file_hash=$this->getRequest()->getParam("file_hash_".$i);
|
34 |
-
$set=$this->getRequest()->getParam("set_".$i);
|
35 |
-
|
36 |
-
if ($file_hash!="")
|
37 |
-
{
|
38 |
-
$dbw=$dbres->getConnection('core_write');
|
39 |
-
|
40 |
-
$translate_flag=0;
|
41 |
-
|
42 |
-
if ($set=="enabled")
|
43 |
-
{
|
44 |
-
$translate_flag=1;
|
45 |
-
}
|
46 |
-
|
47 |
-
$time_added=time();
|
48 |
-
|
49 |
-
// Update:
|
50 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_emailtemplates')."` SET translate_flag=?, time_added=? WHERE file_hash=? AND project_id=?;",array($translate_flag,$time_added,$file_hash,$project_id));
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
if ($selectAction=="none")
|
55 |
-
{
|
56 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_emailtemplates')."` SET translate_flag=0 WHERE project_id=?;",array($project_id));
|
57 |
-
}
|
58 |
-
|
59 |
-
// get result list:
|
60 |
-
$sql="SELECT * FROM `".$this->getTableName('eurotext_emailtemplates')."` WHERE project_id=? AND translate_flag=1 ORDER BY time_added DESC, filename ASC";
|
61 |
-
$emails=$dbr->fetchAll($sql,array($project_id));
|
62 |
-
|
63 |
-
$rv = '';
|
64 |
-
|
65 |
-
// Results:
|
66 |
-
$rv .= "<table cellpadding=0 cellspacing=0>";
|
67 |
-
$rv .= "<tr>";
|
68 |
-
$rv .= " <td class='et_th'>".$this->__("Translate")."</td>";
|
69 |
-
$rv .= " <td class='et_th'>".$this->__("Filename")."</td>";
|
70 |
-
$rv .= " <td class='et_th'> </td>";
|
71 |
-
$rv .= "</tr>";
|
72 |
-
|
73 |
-
foreach($emails as $email)
|
74 |
-
{
|
75 |
-
$rv .= "<tr>";
|
76 |
-
$rv .= " <td class='et_tc'><input type='checkbox' id='et_selemail2_".$email['file_hash']."' class='et_selemail et_selemail_".$email['file_hash']."' checked='checked' onchange=\"eurotext_selectemail('2','".$email['file_hash']."')\" /></td>";
|
77 |
-
$rv .= " <td class='et_tc'>".$email['filename']."</td>";
|
78 |
-
$rv .= " <td class='et_tc'> </td>";
|
79 |
-
$rv .= "</tr>";
|
80 |
-
}
|
81 |
-
|
82 |
-
$rv .= "</table>";
|
83 |
-
|
84 |
-
$block->setText($rv);
|
85 |
-
$this->renderLayout();
|
86 |
-
|
87 |
-
}
|
88 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Adminhtml_Eurotext_Translationmanager_SelectlangfilesController extends Mage_Adminhtml_Controller_Action
|
4 |
-
{
|
5 |
-
private function getTableName($tblName)
|
6 |
-
{
|
7 |
-
return Mage::getSingleton('core/resource')->getTableName($tblName);
|
8 |
-
}
|
9 |
-
|
10 |
-
public function indexAction()
|
11 |
-
{
|
12 |
-
$this->loadLayout();
|
13 |
-
$this->renderLayout();
|
14 |
-
}
|
15 |
-
|
16 |
-
public function saveAction()
|
17 |
-
{
|
18 |
-
|
19 |
-
$this->loadLayout('adminhtml_eurotext_translationmanager_text');
|
20 |
-
$block = $this->getLayout()->getBlock('et.tm.response.text');
|
21 |
-
|
22 |
-
|
23 |
-
$project_id=intval($this->getRequest()->getParam("project_id"));
|
24 |
-
$cnt=intval($this->getRequest()->getParam("cnt"));
|
25 |
-
$selectAction=$this->getRequest()->getParam("select");
|
26 |
-
|
27 |
-
$dbres = Mage::getSingleton('core/resource');
|
28 |
-
$dbr=$dbres->getConnection('core_read');
|
29 |
-
$dbw=$dbres->getConnection('core_write');
|
30 |
-
|
31 |
-
for($i=0; $i<$cnt; $i++)
|
32 |
-
{
|
33 |
-
$line_hash=$this->getRequest()->getParam("langfile_linehash_".$i);
|
34 |
-
$set=$this->getRequest()->getParam("set_".$i);
|
35 |
-
|
36 |
-
if ($line_hash!="")
|
37 |
-
{
|
38 |
-
$translate_flag=0;
|
39 |
-
|
40 |
-
if ($set=="enabled")
|
41 |
-
{
|
42 |
-
$translate_flag=1;
|
43 |
-
}
|
44 |
-
|
45 |
-
$time_added=time();
|
46 |
-
|
47 |
-
// Update:
|
48 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_csv')."` SET translate_flag=?, time_added=? WHERE line_hash=? AND project_id=?;",array($translate_flag,$time_added,$line_hash,$project_id));
|
49 |
-
}
|
50 |
-
}
|
51 |
-
|
52 |
-
if ($selectAction=="all")
|
53 |
-
{
|
54 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_csv')."` SET translate_flag=1 WHERE project_id=?;",array($project_id));
|
55 |
-
}
|
56 |
-
else if ($selectAction=="none")
|
57 |
-
{
|
58 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_csv')."` SET translate_flag=0 WHERE project_id=?;",array($project_id));
|
59 |
-
}
|
60 |
-
|
61 |
-
// get result list:
|
62 |
-
$sql="SELECT * FROM `".$this->getTableName('eurotext_csv')."` WHERE project_id=? AND translate_flag=1 ORDER BY time_added DESC, filename ASC";
|
63 |
-
$langfiles=$dbr->fetchAll($sql,array($project_id));
|
64 |
-
|
65 |
-
$rv = '';
|
66 |
-
|
67 |
-
// Results:
|
68 |
-
$rv .= "<table cellpadding=0 cellspacing=0>";
|
69 |
-
$rv .= "<tr>";
|
70 |
-
$rv .= " <td class='et_th'>".$this->__("Translate")."</td>";
|
71 |
-
$rv .= " <td class='et_th'>".$this->__("Filename")."</td>";
|
72 |
-
$rv .= " <td class='et_th'> </td>";
|
73 |
-
$rv .= "</tr>";
|
74 |
-
|
75 |
-
foreach($langfiles as $langfile)
|
76 |
-
{
|
77 |
-
$rv .= "<tr>";
|
78 |
-
$rv .= " <td class='et_tc'><input type='checkbox' id='et_sellangfile2_".$langfile['line_hash']."' class='et_sellangfile et_sellangfile_".$langfile['line_hash']."' checked='checked' onchange=\"eurotext_selectlangfile('2','".$langfile['line_hash']."')\" /></td>";
|
79 |
-
$rv .= " <td class='et_tc'>".$langfile['filename']."</td>";
|
80 |
-
$rv .= " <td class='et_tc'> </td>";
|
81 |
-
$rv .= "</tr>";
|
82 |
-
}
|
83 |
-
|
84 |
-
$rv .= "</table>";
|
85 |
-
|
86 |
-
$block->setText($rv);
|
87 |
-
$this->renderLayout();
|
88 |
-
}
|
89 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,224 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Adminhtml_Eurotext_Translationmanager_SelectproductsController extends Mage_Adminhtml_Controller_Action
|
4 |
-
{
|
5 |
-
public function indexAction()
|
6 |
-
{
|
7 |
-
$this->loadLayout();
|
8 |
-
$this->renderLayout();
|
9 |
-
}
|
10 |
-
|
11 |
-
private function getTableName($tblName)
|
12 |
-
{
|
13 |
-
return Mage::getSingleton('core/resource')->getTableName($tblName);
|
14 |
-
}
|
15 |
-
|
16 |
-
public function getAllProductIds()
|
17 |
-
{
|
18 |
-
$dbres = Mage::getSingleton('core/resource');
|
19 |
-
$dbr=$dbres->getConnection('core_read');
|
20 |
-
|
21 |
-
$eavAttribute = Mage::getModel('eav/entity_attribute');
|
22 |
-
$name_id = $eavAttribute->getIdByCode('catalog_product', 'name');
|
23 |
-
|
24 |
-
$open_catids=$this->getOpenCatIds();
|
25 |
-
$sql_categoryfilter="";
|
26 |
-
if (count($open_catids)>0)
|
27 |
-
{
|
28 |
-
$selected_catid=$open_catids[count($open_catids)-1]; // Last ID is the selected category
|
29 |
-
if ($selected_catid>1) // root-category has id 1
|
30 |
-
{
|
31 |
-
$search_catids=Mage::helper('eurotext_translationmanager')->getAllSubCategories($selected_catid); // Get the IDs of all children (direct+indirect)
|
32 |
-
array_push($search_catids,$selected_catid); // add selected category to list
|
33 |
-
|
34 |
-
// Filter to products which are assigned to any category in $search_catids:
|
35 |
-
$sql_categoryfilter=" AND e.entity_id IN (SELECT cat.product_id FROM ".$this->getTableName('catalog_category_product')." cat WHERE cat.category_id IN (".implode(",",$search_catids)."))";
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
$sql="SELECT e.entity_id FROM `".$this->getTableName('catalog_product_entity')."` e WHERE (1=1)".$sql_categoryfilter;
|
40 |
-
$allProducts=$dbr->fetchAll($sql);
|
41 |
-
|
42 |
-
$productIds=array();
|
43 |
-
for($i=0; $i<count($allProducts); $i++)
|
44 |
-
{
|
45 |
-
array_push($productIds,$allProducts[$i]['entity_id']);
|
46 |
-
}
|
47 |
-
|
48 |
-
return $productIds;
|
49 |
-
}
|
50 |
-
|
51 |
-
public function getOpenCatIds()
|
52 |
-
{
|
53 |
-
// Parse catids (list of open categories)
|
54 |
-
$open_catids_str=$this->getRequest()->getParam("catids");
|
55 |
-
|
56 |
-
$open_catids_list=explode(",",$open_catids_str);
|
57 |
-
$open_catids=array();
|
58 |
-
foreach($open_catids_list as $opencatid)
|
59 |
-
{
|
60 |
-
$cat_id=intval($opencatid); // prevent non-numeric ids
|
61 |
-
array_push($open_catids,$cat_id);
|
62 |
-
}
|
63 |
-
array_push($open_catids,1); // root-category is always open
|
64 |
-
$open_catids=array_unique($open_catids);
|
65 |
-
|
66 |
-
return $open_catids;
|
67 |
-
}
|
68 |
-
|
69 |
-
public function saveAction()
|
70 |
-
{
|
71 |
-
|
72 |
-
$this->loadLayout('adminhtml_eurotext_translationmanager_ajax');
|
73 |
-
$block = $this->getLayout()->getBlock('et.tm.response.ajax');
|
74 |
-
|
75 |
-
|
76 |
-
$helper=Mage::helper('eurotext_translationmanager');
|
77 |
-
|
78 |
-
$project_id=intval($this->getRequest()->getParam("project_id"));
|
79 |
-
$cnt=intval($this->getRequest()->getParam("cnt"));
|
80 |
-
$selectAction=$this->getRequest()->getParam("select");
|
81 |
-
$catid=$this->getRequest()->getParam("catid");
|
82 |
-
|
83 |
-
$dbres = Mage::getSingleton('core/resource');
|
84 |
-
$dbr=$dbres->getConnection('core_read');
|
85 |
-
$dbw=$dbres->getConnection('core_write');
|
86 |
-
$time_added=time();
|
87 |
-
|
88 |
-
for($i=0; $i<$cnt; $i++)
|
89 |
-
{
|
90 |
-
$product_id=$this->getRequest()->getParam("product_id_".$i);
|
91 |
-
$set=$this->getRequest()->getParam("set_".$i);
|
92 |
-
if ($product_id>0)
|
93 |
-
{
|
94 |
-
if ($set=="enabled")
|
95 |
-
{
|
96 |
-
$dbw->query("INSERT IGNORE INTO `".$this->getTableName('eurotext_project_products')."` (product_id,project_id) VALUES (?,?);",array($product_id,$project_id));
|
97 |
-
|
98 |
-
// Update timestamp:
|
99 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_project_products')."` SET time_added=? WHERE product_id=? AND project_id=?;",array($time_added,$product_id,$project_id));
|
100 |
-
}
|
101 |
-
else
|
102 |
-
{
|
103 |
-
$dbw->query("DELETE FROM `".$this->getTableName('eurotext_project_products')."` WHERE product_id=? AND project_id=?;",array($product_id,$project_id));
|
104 |
-
}
|
105 |
-
}
|
106 |
-
}
|
107 |
-
|
108 |
-
if ($selectAction=="setcat")
|
109 |
-
{
|
110 |
-
$touched_product_ids=$helper->getCategoryProducts($dbr,$catid);
|
111 |
-
|
112 |
-
foreach($touched_product_ids as $product_id)
|
113 |
-
{
|
114 |
-
$dbw->query("INSERT IGNORE INTO `".$this->getTableName('eurotext_project_products')."` (product_id,project_id) VALUES (?,?);",array($product_id,$project_id));
|
115 |
-
// Update timestamp:
|
116 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_project_products')."` SET time_added=? WHERE product_id=? AND project_id=?;",array($time_added,$product_id,$project_id));
|
117 |
-
}
|
118 |
-
}
|
119 |
-
else if ($selectAction=="unsetcat")
|
120 |
-
{
|
121 |
-
$touched_product_ids=$helper->getCategoryProducts($dbr,$catid);
|
122 |
-
|
123 |
-
foreach($touched_product_ids as $product_id)
|
124 |
-
{
|
125 |
-
$dbw->query("DELETE FROM `".$this->getTableName('eurotext_project_products')."` WHERE product_id=? AND project_id=?;",array($product_id,$project_id));
|
126 |
-
}
|
127 |
-
}
|
128 |
-
|
129 |
-
if ($selectAction=="all")
|
130 |
-
{
|
131 |
-
$time_added=time();
|
132 |
-
|
133 |
-
$allProductIds=$this->getAllProductIds();
|
134 |
-
|
135 |
-
foreach($allProductIds as $product_id)
|
136 |
-
{
|
137 |
-
$dbw->query("INSERT IGNORE INTO `".$this->getTableName('eurotext_project_products')."` (product_id,project_id) VALUES (?,?);",array($product_id,$project_id));
|
138 |
-
}
|
139 |
-
|
140 |
-
// Update timestamp:
|
141 |
-
$dbw->query("UPDATE `".$this->getTableName('eurotext_project_products')."` SET time_added=? WHERE project_id=?;",array($time_added,$project_id));
|
142 |
-
}
|
143 |
-
else if ($selectAction=="none")
|
144 |
-
{
|
145 |
-
$allProductIds=$this->getAllProductIds();
|
146 |
-
|
147 |
-
foreach($allProductIds as $product_id)
|
148 |
-
{
|
149 |
-
$dbw->query("DELETE FROM `".$this->getTableName('eurotext_project_products')."` WHERE project_id=? AND product_id=?;",array($project_id,$product_id));
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
// get result list:
|
154 |
-
$eavAttribute = Mage::getModel('eav/entity_attribute');
|
155 |
-
$name_id = $eavAttribute->getIdByCode('catalog_product', 'name');
|
156 |
-
|
157 |
-
$sql="SELECT a.store_id, a.value as article_name, e.sku, e.entity_id FROM `".$this->getTableName('catalog_product_entity_varchar')."` a, `".$this->getTableName('catalog_product_entity')."` e, `".$this->getTableName('eurotext_project_products')."` p WHERE (a.entity_id=e.entity_id) AND (a.attribute_id=?) AND a.store_id=0 AND (p.product_id=e.entity_id) AND (p.project_id=?) ORDER BY time_added DESC, article_name ASC, e.entity_id ASC";
|
158 |
-
$products=$dbr->fetchAll($sql,array($name_id,$project_id));
|
159 |
-
|
160 |
-
$product_ids=array();
|
161 |
-
|
162 |
-
$returnBody="";
|
163 |
-
|
164 |
-
// Results:
|
165 |
-
$returnBody.="<table cellpadding=0 cellspacing=0>";
|
166 |
-
$returnBody.="<tr>";
|
167 |
-
$returnBody.=" <td class='et_th'>".$this->__("Translate")."</td>";
|
168 |
-
$returnBody.=" <td class='et_th'>".$this->__("SKU")."</td>";
|
169 |
-
$returnBody.=" <td class='et_th'>".$this->__("Designation")."</td>";
|
170 |
-
$returnBody.=" <td class='et_th'> </td>";
|
171 |
-
$returnBody.="</tr>";
|
172 |
-
|
173 |
-
$alt=0;
|
174 |
-
|
175 |
-
foreach($products as $product)
|
176 |
-
{
|
177 |
-
array_push($product_ids,$product['entity_id']);
|
178 |
-
|
179 |
-
$alt=1-$alt;
|
180 |
-
$returnBody.="<tr>";
|
181 |
-
$returnBody.=" <td class='et_tc eurotext2_r".$alt."'><input type='checkbox' id='et_selproduct2_".$product['entity_id']."' class='et_selproduct et_selproduct_".$product['entity_id']."' checked='checked' onchange=\"eurotext_selectproduct('2','".$product['entity_id']."')\" /></td>";
|
182 |
-
$returnBody.=" <td class='et_tc eurotext2_r".$alt."'>".$product['sku']."</td>"; // (ID: ".$product['entity_id'].")
|
183 |
-
$returnBody.=" <td class='et_tc eurotext2_r".$alt."'>".$product['article_name']."</td>";
|
184 |
-
$returnBody.=" <td class='et_tc eurotext2_r".$alt."'> </td>";
|
185 |
-
$returnBody.="</tr>";
|
186 |
-
}
|
187 |
-
|
188 |
-
$returnBody.="</table>";
|
189 |
-
|
190 |
-
// Determine category state: $categories
|
191 |
-
$open_catids=$this->getOpenCatIds();
|
192 |
-
|
193 |
-
$rootcat=$helper->getCategoryTree(1,$open_catids);
|
194 |
-
$categories=array();
|
195 |
-
$this->checkCategoryState($dbr,$rootcat,$project_id,$categories);
|
196 |
-
|
197 |
-
$block->setHtmldata($returnBody);
|
198 |
-
$block->setProducts($product_ids);
|
199 |
-
$block->setCategories($categories);
|
200 |
-
$block->setDebug($open_catids);
|
201 |
-
|
202 |
-
$this->getResponse()->setHeader('Content-type', 'application/json', true);
|
203 |
-
$this->renderLayout();
|
204 |
-
|
205 |
-
}
|
206 |
-
|
207 |
-
private function checkCategoryState($dbr,$cat,$project_id, &$categoryDict)
|
208 |
-
{
|
209 |
-
$categoryState=Mage::helper('eurotext_translationmanager')->getTreeNodeTranslationState($dbr,$cat['id'],$project_id);
|
210 |
-
|
211 |
-
|
212 |
-
$catitem=array();
|
213 |
-
$catitem['id']=$cat['id'];
|
214 |
-
$catitem['checked']=($categoryState=="checked");
|
215 |
-
$catitem['indeterminate']=($categoryState=="indeterminate");
|
216 |
-
|
217 |
-
array_push($categoryDict,$catitem);
|
218 |
-
|
219 |
-
foreach($cat['childs'] as $child)
|
220 |
-
{
|
221 |
-
$this->checkCategoryState($dbr,$child,$project_id,$categoryDict);
|
222 |
-
}
|
223 |
-
}
|
224 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,72 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Eurotext_TranslationManager_Adminhtml_Eurotext_Translationmanager_SettingsController extends Mage_Adminhtml_Controller_Action
|
4 |
-
{
|
5 |
-
|
6 |
-
|
7 |
-
protected function _isAllowed()
|
8 |
-
{
|
9 |
-
return Mage::getSingleton('admin/session')
|
10 |
-
->isAllowed('eurotext_translationmanager/settings');
|
11 |
-
}
|
12 |
-
|
13 |
-
|
14 |
-
public function indexAction()
|
15 |
-
{
|
16 |
-
$this->loadLayout();
|
17 |
-
$this->renderLayout();
|
18 |
-
}
|
19 |
-
|
20 |
-
public function upgradescopeAction()
|
21 |
-
{
|
22 |
-
$is_global=0;
|
23 |
-
|
24 |
-
$tbl_eav_attribute = Mage::getSingleton('core/resource')->getTableName('eav_attribute');
|
25 |
-
$tbl_catalog_eav_attribute = Mage::getSingleton('core/resource')->getTableName('catalog_eav_attribute');
|
26 |
-
|
27 |
-
$dbres = Mage::getSingleton('core/resource');
|
28 |
-
$dbr=$dbres->getConnection('core_read');
|
29 |
-
$dbw=$dbres->getConnection('core_write');
|
30 |
-
|
31 |
-
$result=$dbr->fetchAll("SELECT v.is_global, a.attribute_id, a.attribute_code FROM `".$tbl_eav_attribute."` a, `".$tbl_catalog_eav_attribute."` v WHERE (v.is_global!=".$is_global.") AND (a.attribute_id=v.attribute_id) AND ((a.attribute_code='url_key') OR (a.attribute_code='url_path'))");
|
32 |
-
foreach($result as $row)
|
33 |
-
{
|
34 |
-
$dbw->query("UPDATE `".$tbl_catalog_eav_attribute."` SET is_global=".$is_global." WHERE attribute_id=".$row['attribute_id']);
|
35 |
-
}
|
36 |
-
|
37 |
-
$url=Mage::helper('adminhtml')->getUrl('*/*/index');
|
38 |
-
$this->_redirectUrl($url);
|
39 |
-
}
|
40 |
-
|
41 |
-
public function saveAction()
|
42 |
-
{
|
43 |
-
$helper=Mage::helper('eurotext_translationmanager');
|
44 |
-
$request=$this->getRequest();
|
45 |
-
|
46 |
-
$helper->saveSetting("eurotext_username",$request->getParam("username"));
|
47 |
-
$helper->saveSetting("eurotext_password",Mage::helper('core')->encrypt($request->getParam("password")));
|
48 |
-
$helper->saveSetting("eurotext_customerid",$request->getParam("customerid"));
|
49 |
-
|
50 |
-
$et_products_per_file=intval($request->getParam("et_products_per_file"));
|
51 |
-
if ($et_products_per_file<$helper->getExportProductsMinPerFile())
|
52 |
-
{
|
53 |
-
$et_products_per_file=$helper->getExportProductsMinPerFile();
|
54 |
-
}
|
55 |
-
|
56 |
-
$et_categories_per_file=intval($request->getParam("et_categories_per_file"));
|
57 |
-
if ($et_categories_per_file<$helper->getExportCategoriesMinPerFile())
|
58 |
-
{
|
59 |
-
$et_categories_per_file=$helper->getExportCategoriesMinPerFile();
|
60 |
-
}
|
61 |
-
|
62 |
-
$et_cmspages_per_file=intval($request->getParam("et_cmspages_per_file"));
|
63 |
-
if ($et_cmspages_per_file<1)
|
64 |
-
{
|
65 |
-
$et_cmspages_per_file=20;
|
66 |
-
}
|
67 |
-
|
68 |
-
$helper->saveSetting("et_products_per_file",$et_products_per_file);
|
69 |
-
$helper->saveSetting("et_categories_per_file",$et_categories_per_file);
|
70 |
-
$helper->saveSetting("et_cmspages_per_file",$et_cmspages_per_file);
|
71 |
-
}
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var Eurotext_TranslationManager_Model_Resource_Setup $installer */
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
// intenionally left empty
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var Eurotext_TranslationManager_Model_Resource_Setup $installer */
|
4 |
+
$installer = $this;
|
5 |
+
|
6 |
+
$connection = $installer->getConnection();
|
7 |
+
|
8 |
+
$xmlPrefix = 'eurotext/config/';
|
9 |
+
|
10 |
+
$eurotextConfigTable = $connection->getTableName('eurotext_config');
|
11 |
+
$select = $connection->select()->from($eurotextConfigTable);
|
12 |
+
$rows = $connection->fetchAssoc($select);
|
13 |
+
foreach ($rows as $key => $data) {
|
14 |
+
Mage::getConfig()->saveConfig($xmlPrefix . $key, $data['config_value']);
|
15 |
+
}
|
16 |
+
|
17 |
+
$connection->dropTable($eurotextConfigTable);
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var Eurotext_TranslationManager_Model_Resource_Setup $installer */
|
4 |
+
$installer = $this;
|
5 |
+
|
6 |
+
$installer->startSetup();
|
7 |
+
|
8 |
+
$hnumber = Mage::getStoreConfig('eurotext/config/register_hnumber', 0);
|
9 |
+
if ($hnumber) {
|
10 |
+
$street = trim(Mage::getStoreConfig('eurotext/config/register_street', 0));
|
11 |
+
$installer->setConfigData('eurotext/config/register_street', trim($street . ' ' . $hnumber));
|
12 |
+
$installer->deleteConfigData('eurotext/config/register_hnumber');
|
13 |
+
}
|
14 |
+
|
15 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
16 |
+
Mage::app()->getLocale()->setLocaleCode('de_DE');
|
17 |
+
$countries = Mage::getResourceModel('directory/country_collection')
|
18 |
+
->loadData()
|
19 |
+
->toOptionArray();
|
20 |
+
$current_registration_country = Mage::getStoreConfig('eurotext/config/register_country', 0);
|
21 |
+
foreach ($countries as $country) {
|
22 |
+
if ($country['label'] == $current_registration_country) {
|
23 |
+
$installer->setConfigData('eurotext/config/register_country', $country['value']);
|
24 |
+
}
|
25 |
+
}
|
26 |
+
Mage::app()->getLocale()->setLocaleCode($locale);
|
27 |
+
|
28 |
+
$installer->endSetup();
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var Eurotext_TranslationManager_Model_Resource_Setup $installer */
|
4 |
+
$installer = $this;
|
5 |
+
|
6 |
+
$installer->startSetup();
|
7 |
+
|
8 |
+
$mapping = [
|
9 |
+
'eurotext/config/eurotext_customerid' => 'eurotext/user_settings/customerid',
|
10 |
+
'eurotext/config/eurotext_username' => 'eurotext/user_settings/ftp_username',
|
11 |
+
'eurotext/config/eurotext_password' => 'eurotext/user_settings/ftp_password',
|
12 |
+
'eurotext/config/et_categories_per_file' => 'eurotext/export_settings/categories_per_file',
|
13 |
+
'eurotext/config/et_cmspages_per_file' => 'eurotext/export_settings/cmspages_per_file',
|
14 |
+
'eurotext/config/et_products_per_file' => 'eurotext/export_settings/products_per_file',
|
15 |
+
'eurotext/config/register_sal' => 'eurotext/config/register_salutation',
|
16 |
+
'eurotext/config/register_fname' => 'eurotext/config/register_firstname',
|
17 |
+
'eurotext/config/register_lname' => 'eurotext/config/register_lastname',
|
18 |
+
'eurotext/config/register_telefon' => 'eurotext/config/register_telephone',
|
19 |
+
];
|
20 |
+
|
21 |
+
foreach ($mapping as $oldPath => $newPath) {
|
22 |
+
if (!Mage::getStoreConfig($oldPath)) {
|
23 |
+
continue;
|
24 |
+
}
|
25 |
+
$installer->setConfigData($newPath, Mage::getStoreConfig($oldPath));
|
26 |
+
$installer->deleteConfigData($oldPath);
|
27 |
+
}
|
28 |
+
|
29 |
+
$installer->endSetup();
|
@@ -6,24 +6,25 @@
|
|
6 |
<sort_order>70</sort_order>
|
7 |
<children>
|
8 |
<register translate="title" module="eurotext_translationmanager">
|
9 |
-
<title>Registration</title>
|
10 |
<sort_order>10</sort_order>
|
11 |
-
<action>adminhtml/
|
|
|
12 |
</register>
|
13 |
-
<
|
14 |
-
<title>
|
15 |
<sort_order>20</sort_order>
|
16 |
-
<action>adminhtml/
|
17 |
-
</
|
18 |
<export translate="title" module="eurotext_translationmanager">
|
19 |
<title>Projects</title>
|
20 |
<sort_order>30</sort_order>
|
21 |
-
<action>adminhtml/
|
22 |
</export>
|
23 |
<help translate="title" module="eurotext_translationmanager">
|
24 |
<title>Help</title>
|
25 |
<sort_order>40</sort_order>
|
26 |
-
<action>adminhtml/
|
27 |
</help>
|
28 |
</children>
|
29 |
</eurotext_translationmanager>
|
@@ -32,17 +33,13 @@
|
|
32 |
<resources>
|
33 |
<admin>
|
34 |
<children>
|
35 |
-
<eurotext_translationmanager module="eurotext_translationmanager">
|
36 |
<title>Eurotext - translationMANAGER</title>
|
37 |
<children>
|
38 |
-
<
|
39 |
-
<title>
|
40 |
-
<sort_order>10</sort_order>
|
41 |
-
</register>
|
42 |
-
<settings translate="title" module="eurotext_translationmanager">
|
43 |
-
<title>Settings</title>
|
44 |
<sort_order>20</sort_order>
|
45 |
-
</
|
46 |
<export translate="title" module="eurotext_translationmanager">
|
47 |
<title>Projects</title>
|
48 |
<sort_order>30</sort_order>
|
@@ -53,6 +50,18 @@
|
|
53 |
</help>
|
54 |
</children>
|
55 |
</eurotext_translationmanager>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
</children>
|
57 |
</admin>
|
58 |
</resources>
|
6 |
<sort_order>70</sort_order>
|
7 |
<children>
|
8 |
<register translate="title" module="eurotext_translationmanager">
|
9 |
+
<title>Registration/Settings</title>
|
10 |
<sort_order>10</sort_order>
|
11 |
+
<action>adminhtml/system_config/edit/section/eurotext</action>
|
12 |
+
<resource>system/config/eurotext</resource>
|
13 |
</register>
|
14 |
+
<status translate="title" module="eurotext_translationmanager">
|
15 |
+
<title>System Status</title>
|
16 |
<sort_order>20</sort_order>
|
17 |
+
<action>adminhtml/eurotext_status</action>
|
18 |
+
</status>
|
19 |
<export translate="title" module="eurotext_translationmanager">
|
20 |
<title>Projects</title>
|
21 |
<sort_order>30</sort_order>
|
22 |
+
<action>adminhtml/eurotext_project</action>
|
23 |
</export>
|
24 |
<help translate="title" module="eurotext_translationmanager">
|
25 |
<title>Help</title>
|
26 |
<sort_order>40</sort_order>
|
27 |
+
<action>adminhtml/eurotext_help</action>
|
28 |
</help>
|
29 |
</children>
|
30 |
</eurotext_translationmanager>
|
33 |
<resources>
|
34 |
<admin>
|
35 |
<children>
|
36 |
+
<eurotext_translationmanager module="eurotext_translationmanager" translate="title">
|
37 |
<title>Eurotext - translationMANAGER</title>
|
38 |
<children>
|
39 |
+
<status translate="title" module="eurotext_translationmanager">
|
40 |
+
<title>Status</title>
|
|
|
|
|
|
|
|
|
41 |
<sort_order>20</sort_order>
|
42 |
+
</status>
|
43 |
<export translate="title" module="eurotext_translationmanager">
|
44 |
<title>Projects</title>
|
45 |
<sort_order>30</sort_order>
|
50 |
</help>
|
51 |
</children>
|
52 |
</eurotext_translationmanager>
|
53 |
+
<system>
|
54 |
+
<children>
|
55 |
+
<config>
|
56 |
+
<children>
|
57 |
+
<eurotext translate="title" module="eurotext_translationmanager">
|
58 |
+
<title>Eurotext Settings</title>
|
59 |
+
<sort_order>100</sort_order>
|
60 |
+
</eurotext>
|
61 |
+
</children>
|
62 |
+
</config>
|
63 |
+
</children>
|
64 |
+
</system>
|
65 |
</children>
|
66 |
</admin>
|
67 |
</resources>
|
@@ -2,20 +2,10 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Eurotext_TranslationManager>
|
5 |
-
<version>
|
6 |
</Eurotext_TranslationManager>
|
7 |
</modules>
|
8 |
<global>
|
9 |
-
<models>
|
10 |
-
<eurotext_translationmanager>
|
11 |
-
<class>Eurotext_TranslationManager_Model</class>
|
12 |
-
</eurotext_translationmanager>
|
13 |
-
</models>
|
14 |
-
<helpers>
|
15 |
-
<eurotext_translationmanager>
|
16 |
-
<class>Eurotext_TranslationManager_Helper</class>
|
17 |
-
</eurotext_translationmanager>
|
18 |
-
</helpers>
|
19 |
<models>
|
20 |
<eurotext_translationmanager>
|
21 |
<class>Eurotext_TranslationManager_Model</class>
|
@@ -27,38 +17,119 @@
|
|
27 |
<project>
|
28 |
<table>eurotext_project</table>
|
29 |
</project>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
</entities>
|
31 |
</eurotext_translationmanager_resource>
|
32 |
</models>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
<resources>
|
34 |
<eurotext_translationmanager_setup>
|
35 |
<setup>
|
36 |
<module>Eurotext_TranslationManager</module>
|
37 |
<class>Eurotext_TranslationManager_Model_Resource_Setup</class>
|
38 |
</setup>
|
39 |
-
<connection>
|
40 |
-
<use>core_setup</use>
|
41 |
-
</connection>
|
42 |
</eurotext_translationmanager_setup>
|
43 |
</resources>
|
44 |
-
<blocks>
|
45 |
-
<eurotext_translationmanager>
|
46 |
-
<class>Eurotext_TranslationManager_Block</class>
|
47 |
-
</eurotext_translationmanager>
|
48 |
-
</blocks>
|
49 |
</global>
|
50 |
<admin>
|
51 |
<routers>
|
52 |
<adminhtml>
|
53 |
<args>
|
54 |
<modules>
|
55 |
-
<eurotext_translationmanager
|
|
|
56 |
</modules>
|
57 |
</args>
|
58 |
</adminhtml>
|
59 |
</routers>
|
60 |
</admin>
|
61 |
<adminhtml>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
<translate>
|
63 |
<modules>
|
64 |
<Eurotext_TranslationManager>
|
@@ -76,4 +147,17 @@
|
|
76 |
</updates>
|
77 |
</layout>
|
78 |
</adminhtml>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Eurotext_TranslationManager>
|
5 |
+
<version>3.2.13</version>
|
6 |
</Eurotext_TranslationManager>
|
7 |
</modules>
|
8 |
<global>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
<models>
|
10 |
<eurotext_translationmanager>
|
11 |
<class>Eurotext_TranslationManager_Model</class>
|
17 |
<project>
|
18 |
<table>eurotext_project</table>
|
19 |
</project>
|
20 |
+
<project_categories>
|
21 |
+
<table>eurotext_project_categories</table>
|
22 |
+
</project_categories>
|
23 |
+
<project_cmsblocks>
|
24 |
+
<table>eurotext_project_cmsblocks</table>
|
25 |
+
</project_cmsblocks>
|
26 |
+
<project_cmspages>
|
27 |
+
<table>eurotext_project_cmspages</table>
|
28 |
+
</project_cmspages>
|
29 |
+
<project_products>
|
30 |
+
<table>eurotext_project_products</table>
|
31 |
+
</project_products>
|
32 |
+
<project_import>
|
33 |
+
<table>eurotext_project_import</table>
|
34 |
+
</project_import>
|
35 |
+
<project_emailtemplates>
|
36 |
+
<table>eurotext_project_emailtemplates</table>
|
37 |
+
</project_emailtemplates>
|
38 |
+
<project_emailtemplate_files>
|
39 |
+
<table>eurotext_project_emailtemplate_files</table>
|
40 |
+
</project_emailtemplate_files>
|
41 |
+
<project_emailtemplate_database>
|
42 |
+
<table>eurotext_project_emailtemplate_database</table>
|
43 |
+
</project_emailtemplate_database>
|
44 |
+
<project_csv>
|
45 |
+
<table>eurotext_project_csv</table>
|
46 |
+
</project_csv>
|
47 |
+
|
48 |
+
<project_csv_data>
|
49 |
+
<!-- deprecated but can't delete, because then the sql scripts will fail -->
|
50 |
+
<table>eurotext_project_csv_data</table>
|
51 |
+
</project_csv_data>
|
52 |
+
<csv>
|
53 |
+
<!-- deprecated but can't delete, because then the sql scripts will fail -->
|
54 |
+
<table>eurotext_csv</table>
|
55 |
+
</csv>
|
56 |
+
<csv_data>
|
57 |
+
<!-- deprecated but can't delete, because then the sql scripts will fail -->
|
58 |
+
<table>eurotext_csv_data</table>
|
59 |
+
</csv_data>
|
60 |
+
<emailtemplates>
|
61 |
+
<!-- deprecated but can't delete, because then the sql scripts will fail -->
|
62 |
+
<table>eurotext_emailtemplates</table>
|
63 |
+
</emailtemplates>
|
64 |
+
<import>
|
65 |
+
<!-- deprecated but can't delete, because then the sql scripts will fail -->
|
66 |
+
<table>eurotext_import</table>
|
67 |
+
</import>
|
68 |
+
<languages>
|
69 |
+
<!-- deprecated but can't delete, because then the sql scripts will fail -->
|
70 |
+
<table>eurotext_languages</table>
|
71 |
+
</languages>
|
72 |
</entities>
|
73 |
</eurotext_translationmanager_resource>
|
74 |
</models>
|
75 |
+
<blocks>
|
76 |
+
<eurotext_translationmanager>
|
77 |
+
<class>Eurotext_TranslationManager_Block</class>
|
78 |
+
</eurotext_translationmanager>
|
79 |
+
</blocks>
|
80 |
+
<helpers>
|
81 |
+
<eurotext_translationmanager>
|
82 |
+
<class>Eurotext_TranslationManager_Helper</class>
|
83 |
+
</eurotext_translationmanager>
|
84 |
+
</helpers>
|
85 |
<resources>
|
86 |
<eurotext_translationmanager_setup>
|
87 |
<setup>
|
88 |
<module>Eurotext_TranslationManager</module>
|
89 |
<class>Eurotext_TranslationManager_Model_Resource_Setup</class>
|
90 |
</setup>
|
|
|
|
|
|
|
91 |
</eurotext_translationmanager_setup>
|
92 |
</resources>
|
|
|
|
|
|
|
|
|
|
|
93 |
</global>
|
94 |
<admin>
|
95 |
<routers>
|
96 |
<adminhtml>
|
97 |
<args>
|
98 |
<modules>
|
99 |
+
<eurotext_translationmanager
|
100 |
+
before="Mage_Adminhtml">Eurotext_TranslationManager_Adminhtml</eurotext_translationmanager>
|
101 |
</modules>
|
102 |
</args>
|
103 |
</adminhtml>
|
104 |
</routers>
|
105 |
</admin>
|
106 |
<adminhtml>
|
107 |
+
<events>
|
108 |
+
<model_config_data_save_before>
|
109 |
+
<observers>
|
110 |
+
<eurotext_translationmanager>
|
111 |
+
<class>eurotext_translationmanager/observer</class>
|
112 |
+
<method>modelConfigDataSaveBefore</method>
|
113 |
+
</eurotext_translationmanager>
|
114 |
+
</observers>
|
115 |
+
</model_config_data_save_before>
|
116 |
+
<admin_system_config_section_save_after>
|
117 |
+
<observers>
|
118 |
+
<eurotext_translationmanager>
|
119 |
+
<class>eurotext_translationmanager/observer</class>
|
120 |
+
<method>adminSystemConfigSectionSaveAfter</method>
|
121 |
+
</eurotext_translationmanager>
|
122 |
+
</observers>
|
123 |
+
</admin_system_config_section_save_after>
|
124 |
+
<controller_action_predispatch>
|
125 |
+
<observers>
|
126 |
+
<eurotext_translationmanager>
|
127 |
+
<class>eurotext_translationmanager/observer</class>
|
128 |
+
<method>outputDebugNotice</method>
|
129 |
+
</eurotext_translationmanager>
|
130 |
+
</observers>
|
131 |
+
</controller_action_predispatch>
|
132 |
+
</events>
|
133 |
<translate>
|
134 |
<modules>
|
135 |
<Eurotext_TranslationManager>
|
147 |
</updates>
|
148 |
</layout>
|
149 |
</adminhtml>
|
150 |
+
<default>
|
151 |
+
<eurotext>
|
152 |
+
<user_settings>
|
153 |
+
<ftp_password backend_model="adminhtml/system_config_backend_encrypted"/>
|
154 |
+
</user_settings>
|
155 |
+
</eurotext>
|
156 |
+
<dev>
|
157 |
+
<log>
|
158 |
+
<ettm_debug>0</ettm_debug>
|
159 |
+
<ettm_ftp>1</ettm_ftp>
|
160 |
+
</log>
|
161 |
+
</dev>
|
162 |
+
</default>
|
163 |
</config>
|
@@ -1,36 +1,48 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<jstranslator>
|
3 |
<msg1 translate="message" module="eurotext_translationmanager">
|
4 |
-
<message>Processing - please wait
|
5 |
</msg1>
|
6 |
-
|
7 |
-
<message>Loading - please wait
|
8 |
</msg2>
|
9 |
-
|
10 |
<message>Please wait - this may take a while</message>
|
11 |
</msg3>
|
12 |
-
|
13 |
<message>Please wait - saving project settings</message>
|
14 |
</msg4>
|
15 |
-
|
16 |
<message>Please wait</message>
|
17 |
</msg5>
|
18 |
-
|
19 |
<message>Unable to save project settings</message>
|
20 |
</msg6>
|
21 |
-
|
22 |
<message>Save project</message>
|
23 |
</msg7>
|
24 |
-
|
25 |
<message>Try again</message>
|
26 |
</msg8>
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?xml version="1.0"?>
|
2 |
<jstranslator>
|
3 |
<msg1 translate="message" module="eurotext_translationmanager">
|
4 |
+
<message>Processing - please wait…</message>
|
5 |
</msg1>
|
6 |
+
<msg2 translate="message" module="eurotext_translationmanager">
|
7 |
+
<message>Loading - please wait…</message>
|
8 |
</msg2>
|
9 |
+
<msg3 translate="message" module="eurotext_translationmanager">
|
10 |
<message>Please wait - this may take a while</message>
|
11 |
</msg3>
|
12 |
+
<msg4 translate="message" module="eurotext_translationmanager">
|
13 |
<message>Please wait - saving project settings</message>
|
14 |
</msg4>
|
15 |
+
<msg5 translate="message" module="eurotext_translationmanager">
|
16 |
<message>Please wait</message>
|
17 |
</msg5>
|
18 |
+
<msg6 translate="message" module="eurotext_translationmanager">
|
19 |
<message>Unable to save project settings</message>
|
20 |
</msg6>
|
21 |
+
<msg7 translate="message" module="eurotext_translationmanager">
|
22 |
<message>Save project</message>
|
23 |
</msg7>
|
24 |
+
<msg8 translate="message" module="eurotext_translationmanager">
|
25 |
<message>Try again</message>
|
26 |
</msg8>
|
27 |
+
<msg9 translate="message" module="eurotext_translationmanager">
|
28 |
+
<message>No file was selected, or the file selected is not a ZIP file</message>
|
29 |
+
</msg9>
|
30 |
+
<msg10 translate="message" module="eurotext_translationmanager">
|
31 |
+
<message>Do you really want to delete this project?</message>
|
32 |
+
</msg10>
|
33 |
+
<msg11 translate="message" module="eurotext_translationmanager">
|
34 |
+
<message>Do you really want to reset this project?</message>
|
35 |
+
</msg11>
|
36 |
+
<msg12 translate="message" module="eurotext_translationmanager">
|
37 |
+
<message>Something went wrong while importing: #{error}. Please try again.</message>
|
38 |
+
</msg12>
|
39 |
+
<msg13 translate="message" module="eurotext_translationmanager">
|
40 |
+
<message>Export done.</message>
|
41 |
+
</msg13>
|
42 |
+
<msg14 translate="message" module="eurotext_translationmanager">
|
43 |
+
<message>Please wait …</message>
|
44 |
+
</msg14>
|
45 |
+
<msg15 translate="message" module="eurotext_translationmanager">
|
46 |
+
<message>Please save the project before exporting it!</message>
|
47 |
+
</msg15>
|
48 |
+
</jstranslator>
|
@@ -1,13 +1,247 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<sections>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
<dev>
|
5 |
<groups>
|
6 |
<log>
|
7 |
<fields>
|
8 |
<ettm_head>
|
9 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
10 |
-
<label>Eurotext translationMANAGER</label>
|
11 |
<show_in_default>1</show_in_default>
|
12 |
<show_in_website>0</show_in_website>
|
13 |
<show_in_store>0</show_in_store>
|
@@ -23,10 +257,22 @@
|
|
23 |
<show_in_store>0</show_in_store>
|
24 |
<sort_order>110</sort_order>
|
25 |
</ettm_debug>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
</fields>
|
27 |
</log>
|
28 |
-
|
29 |
</groups>
|
30 |
</dev>
|
31 |
</sections>
|
32 |
-
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<sections>
|
4 |
+
<eurotext translate="label" module="eurotext_translationmanager">
|
5 |
+
<tab>catalog</tab>
|
6 |
+
<label>Eurotext AG translationMANAGER</label>
|
7 |
+
<show_in_default>1</show_in_default>
|
8 |
+
<show_in_website>0</show_in_website>
|
9 |
+
<show_in_store>0</show_in_store>
|
10 |
+
<sort_order>500</sort_order>
|
11 |
+
<groups>
|
12 |
+
<config translate="label" module="eurotext_translationmanager">
|
13 |
+
<label>Registration</label>
|
14 |
+
<show_in_default>1</show_in_default>
|
15 |
+
<show_in_website>0</show_in_website>
|
16 |
+
<show_in_store>0</show_in_store>
|
17 |
+
<sort_order>100</sort_order>
|
18 |
+
<expanded>1</expanded>
|
19 |
+
<fields>
|
20 |
+
<register_status>
|
21 |
+
<frontend_model>eurotext_translationmanager/system_config_form_field_registration_status</frontend_model>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>0</show_in_website>
|
24 |
+
<show_in_store>0</show_in_store>
|
25 |
+
<sort_order>50</sort_order>
|
26 |
+
</register_status>
|
27 |
+
<ettm_head_shop>
|
28 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
29 |
+
<label>Shop data</label>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>0</show_in_website>
|
32 |
+
<show_in_store>0</show_in_store>
|
33 |
+
<sort_order>75</sort_order>
|
34 |
+
</ettm_head_shop>
|
35 |
+
<register_shopname translate="label" module="eurotext_translationmanager">
|
36 |
+
<label>Shop name</label>
|
37 |
+
<frontend_type>text</frontend_type>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>0</show_in_website>
|
40 |
+
<show_in_store>0</show_in_store>
|
41 |
+
<sort_order>100</sort_order>
|
42 |
+
<validate>required-entry</validate>
|
43 |
+
</register_shopname>
|
44 |
+
<register_url translate="label comment" module="eurotext_translationmanager">
|
45 |
+
<label>Shop URL</label>
|
46 |
+
<frontend_type>text</frontend_type>
|
47 |
+
<show_in_default>1</show_in_default>
|
48 |
+
<show_in_website>0</show_in_website>
|
49 |
+
<show_in_store>0</show_in_store>
|
50 |
+
<sort_order>150</sort_order>
|
51 |
+
<comment>starting with http:// or https://</comment>
|
52 |
+
<validate>validate-url required-entry</validate>
|
53 |
+
</register_url>
|
54 |
+
<ettm_head_contact>
|
55 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
56 |
+
<label>Contact data</label>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>0</show_in_website>
|
59 |
+
<show_in_store>0</show_in_store>
|
60 |
+
<sort_order>175</sort_order>
|
61 |
+
<validate>required-entry</validate>
|
62 |
+
</ettm_head_contact>
|
63 |
+
<register_company translate="label" module="eurotext_translationmanager">
|
64 |
+
<label>Company</label>
|
65 |
+
<frontend_type>text</frontend_type>
|
66 |
+
<show_in_default>1</show_in_default>
|
67 |
+
<show_in_website>0</show_in_website>
|
68 |
+
<show_in_store>0</show_in_store>
|
69 |
+
<sort_order>200</sort_order>
|
70 |
+
<validate>required-entry</validate>
|
71 |
+
</register_company>
|
72 |
+
<register_salutation translate="label" module="eurotext_translationmanager">
|
73 |
+
<label>Salutation</label>
|
74 |
+
<frontend_type>select</frontend_type>
|
75 |
+
<source_model>eurotext_translationmanager/system_config_source_salutation</source_model>
|
76 |
+
<show_in_default>1</show_in_default>
|
77 |
+
<show_in_website>0</show_in_website>
|
78 |
+
<show_in_store>0</show_in_store>
|
79 |
+
<sort_order>300</sort_order>
|
80 |
+
<validate>required-entry</validate>
|
81 |
+
</register_salutation>
|
82 |
+
<register_firstname translate="label" module="eurotext_translationmanager">
|
83 |
+
<label>First name</label>
|
84 |
+
<frontend_type>text</frontend_type>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>0</show_in_website>
|
87 |
+
<show_in_store>0</show_in_store>
|
88 |
+
<sort_order>400</sort_order>
|
89 |
+
<validate>required-entry</validate>
|
90 |
+
</register_firstname>
|
91 |
+
<register_lastname translate="label" module="eurotext_translationmanager">
|
92 |
+
<label>Last name</label>
|
93 |
+
<frontend_type>text</frontend_type>
|
94 |
+
<show_in_default>1</show_in_default>
|
95 |
+
<show_in_website>0</show_in_website>
|
96 |
+
<show_in_store>0</show_in_store>
|
97 |
+
<sort_order>500</sort_order>
|
98 |
+
<validate>required-entry</validate>
|
99 |
+
</register_lastname>
|
100 |
+
<register_street translate="label" module="eurotext_translationmanager">
|
101 |
+
<label>Street</label>
|
102 |
+
<frontend_type>text</frontend_type>
|
103 |
+
<show_in_default>1</show_in_default>
|
104 |
+
<show_in_website>0</show_in_website>
|
105 |
+
<show_in_store>0</show_in_store>
|
106 |
+
<sort_order>600</sort_order>
|
107 |
+
<validate>required-entry</validate>
|
108 |
+
</register_street>
|
109 |
+
<register_zip translate="label" module="eurotext_translationmanager">
|
110 |
+
<label>ZIP Code</label>
|
111 |
+
<frontend_type>text</frontend_type>
|
112 |
+
<show_in_default>1</show_in_default>
|
113 |
+
<show_in_website>0</show_in_website>
|
114 |
+
<show_in_store>0</show_in_store>
|
115 |
+
<sort_order>800</sort_order>
|
116 |
+
<validate>required-entry</validate>
|
117 |
+
</register_zip>
|
118 |
+
<register_city translate="label" module="eurotext_translationmanager">
|
119 |
+
<label>City</label>
|
120 |
+
<frontend_type>text</frontend_type>
|
121 |
+
<show_in_default>1</show_in_default>
|
122 |
+
<show_in_website>0</show_in_website>
|
123 |
+
<show_in_store>0</show_in_store>
|
124 |
+
<sort_order>900</sort_order>
|
125 |
+
<validate>required-entry</validate>
|
126 |
+
</register_city>
|
127 |
+
<register_country translate="label" module="eurotext_translationmanager">
|
128 |
+
<label>Country</label>
|
129 |
+
<frontend_type>select</frontend_type>
|
130 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
131 |
+
<show_in_default>1</show_in_default>
|
132 |
+
<show_in_website>0</show_in_website>
|
133 |
+
<show_in_store>0</show_in_store>
|
134 |
+
<sort_order>1000</sort_order>
|
135 |
+
<validate>required-entry</validate>
|
136 |
+
</register_country>
|
137 |
+
<register_email translate="label" module="eurotext_translationmanager">
|
138 |
+
<label>Email Address</label>
|
139 |
+
<frontend_type>text</frontend_type>
|
140 |
+
<show_in_default>1</show_in_default>
|
141 |
+
<show_in_website>0</show_in_website>
|
142 |
+
<show_in_store>0</show_in_store>
|
143 |
+
<sort_order>1000</sort_order>
|
144 |
+
<validate>validate-email required-entry</validate>
|
145 |
+
</register_email>
|
146 |
+
<register_telephone translate="label" module="eurotext_translationmanager">
|
147 |
+
<label>Phone</label>
|
148 |
+
<frontend_type>text</frontend_type>
|
149 |
+
<show_in_default>1</show_in_default>
|
150 |
+
<show_in_website>0</show_in_website>
|
151 |
+
<show_in_store>0</show_in_store>
|
152 |
+
<sort_order>1200</sort_order>
|
153 |
+
<validate>required-entry</validate>
|
154 |
+
</register_telephone>
|
155 |
+
</fields>
|
156 |
+
</config>
|
157 |
+
<user_settings translate="label" module="eurotext_translationmanager">
|
158 |
+
<label>Connection credentials</label>
|
159 |
+
<show_in_default>1</show_in_default>
|
160 |
+
<show_in_website>0</show_in_website>
|
161 |
+
<show_in_store>0</show_in_store>
|
162 |
+
<sort_order>200</sort_order>
|
163 |
+
<fields>
|
164 |
+
<customerid translate="label" module="eurotext_translationmanager">
|
165 |
+
<label>Customer ID</label>
|
166 |
+
<sort_order>100</sort_order>
|
167 |
+
<frontend_type>text</frontend_type>
|
168 |
+
<show_in_default>1</show_in_default>
|
169 |
+
<show_in_website>0</show_in_website>
|
170 |
+
<show_in_store>0</show_in_store>
|
171 |
+
<validate>validate-digits</validate>
|
172 |
+
</customerid>
|
173 |
+
<ftp_username translate="label" module="eurotext_translationmanager">
|
174 |
+
<label>User name</label>
|
175 |
+
<sort_order>200</sort_order>
|
176 |
+
<frontend_type>text</frontend_type>
|
177 |
+
<show_in_default>1</show_in_default>
|
178 |
+
<show_in_website>0</show_in_website>
|
179 |
+
<show_in_store>0</show_in_store>
|
180 |
+
</ftp_username>
|
181 |
+
<ftp_password translate="label" module="eurotext_translationmanager">
|
182 |
+
<label>Password</label>
|
183 |
+
<sort_order>300</sort_order>
|
184 |
+
<frontend_type>password</frontend_type>
|
185 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
186 |
+
<show_in_default>1</show_in_default>
|
187 |
+
<show_in_website>0</show_in_website>
|
188 |
+
<show_in_store>0</show_in_store>
|
189 |
+
</ftp_password>
|
190 |
+
</fields>
|
191 |
+
</user_settings>
|
192 |
+
<export_settings translate="label" module="eurotext_translationmanager">
|
193 |
+
<label>Export</label>
|
194 |
+
<show_in_default>1</show_in_default>
|
195 |
+
<show_in_website>0</show_in_website>
|
196 |
+
<show_in_store>0</show_in_store>
|
197 |
+
<sort_order>300</sort_order>
|
198 |
+
<fields>
|
199 |
+
<ettm_export_information translate="text" module="eurotext_translationmanager">
|
200 |
+
<frontend_model>eurotext_translationmanager/system_config_form_field_text</frontend_model>
|
201 |
+
<text>The number of entries per file heavily depends on your systems resources. You should decrease these numbers if your system fails to compile the files. The minimum number of entries per file is 6.</text>
|
202 |
+
<show_in_default>1</show_in_default>
|
203 |
+
<show_in_website>0</show_in_website>
|
204 |
+
<show_in_store>0</show_in_store>
|
205 |
+
<sort_order>100</sort_order>
|
206 |
+
</ettm_export_information>
|
207 |
+
<categories_per_file translate="label comment" module="eurotext_translationmanager">
|
208 |
+
<label>Categories per file</label><comment>Leave empty for default value: 20</comment>
|
209 |
+
<frontend_type>text</frontend_type>
|
210 |
+
<show_in_default>1</show_in_default>
|
211 |
+
<show_in_website>0</show_in_website>
|
212 |
+
<show_in_store>0</show_in_store>
|
213 |
+
<validate>validate-digits validate-digits-range-6-500</validate>
|
214 |
+
<sort_order>200</sort_order>
|
215 |
+
</categories_per_file>
|
216 |
+
<cmspages_per_file translate="label comment" module="eurotext_translationmanager">
|
217 |
+
<label>CMS Pages per file</label><comment>Leave empty for default value: 20</comment>
|
218 |
+
<frontend_type>text</frontend_type>
|
219 |
+
<show_in_default>1</show_in_default>
|
220 |
+
<show_in_website>0</show_in_website>
|
221 |
+
<show_in_store>0</show_in_store>
|
222 |
+
<validate>validate-digits validate-digits-range-6-500</validate>
|
223 |
+
<sort_order>300</sort_order>
|
224 |
+
</cmspages_per_file>
|
225 |
+
<products_per_file translate="label comment" module="eurotext_translationmanager">
|
226 |
+
<label>Products per file</label><comment>Leave empty for default value: 20</comment>
|
227 |
+
<frontend_type>text</frontend_type>
|
228 |
+
<show_in_default>1</show_in_default>
|
229 |
+
<show_in_website>0</show_in_website>
|
230 |
+
<show_in_store>0</show_in_store>
|
231 |
+
<validate>validate-digits validate-digits-range-6-500</validate>
|
232 |
+
<sort_order>400</sort_order>
|
233 |
+
</products_per_file>
|
234 |
+
</fields>
|
235 |
+
</export_settings>
|
236 |
+
</groups>
|
237 |
+
</eurotext>
|
238 |
<dev>
|
239 |
<groups>
|
240 |
<log>
|
241 |
<fields>
|
242 |
<ettm_head>
|
243 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
244 |
+
<label>Eurotext AG translationMANAGER</label>
|
245 |
<show_in_default>1</show_in_default>
|
246 |
<show_in_website>0</show_in_website>
|
247 |
<show_in_store>0</show_in_store>
|
257 |
<show_in_store>0</show_in_store>
|
258 |
<sort_order>110</sort_order>
|
259 |
</ettm_debug>
|
260 |
+
<ettm_ftp translate="comment label">
|
261 |
+
<frontend_type>select</frontend_type>
|
262 |
+
<label>Enable FTP Upload</label>
|
263 |
+
<comment>Enables FTP Upload of Project Files</comment>
|
264 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
265 |
+
<depends>
|
266 |
+
<ettm_debug>1</ettm_debug>
|
267 |
+
</depends>
|
268 |
+
<show_in_default>1</show_in_default>
|
269 |
+
<show_in_website>0</show_in_website>
|
270 |
+
<show_in_store>0</show_in_store>
|
271 |
+
<sort_order>120</sort_order>
|
272 |
+
</ettm_ftp>
|
273 |
</fields>
|
274 |
</log>
|
|
|
275 |
</groups>
|
276 |
</dev>
|
277 |
</sections>
|
278 |
+
</config>
|
@@ -0,0 +1,455 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var Mage_Core_Model_Resource_Setup $this */
|
4 |
+
|
5 |
+
$this->startSetup();
|
6 |
+
|
7 |
+
$con = $this->getConnection();
|
8 |
+
|
9 |
+
$import = $con->newTable($this->getTable('eurotext_translationmanager/project_import'))
|
10 |
+
->addColumn(
|
11 |
+
'import_id',
|
12 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
13 |
+
10,
|
14 |
+
['primary' => true, 'unsigned' => true, 'nullable' => false, 'auto_increment' => true,],
|
15 |
+
'Primary key'
|
16 |
+
)
|
17 |
+
->addColumn('project_id', Varien_Db_Ddl_Table::TYPE_BIGINT, 20, ['nullable' => false], 'FK on project')
|
18 |
+
->addColumn('filename', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, [], 'Filename of import file')
|
19 |
+
->addColumn(
|
20 |
+
'storeview_dst',
|
21 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
22 |
+
null,
|
23 |
+
[
|
24 |
+
'unsigned' => true,
|
25 |
+
'nullable' => false,
|
26 |
+
],
|
27 |
+
'Store Id'
|
28 |
+
)
|
29 |
+
->addColumn(
|
30 |
+
'num',
|
31 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
32 |
+
11,
|
33 |
+
['nullable' => false, 'default' => -1],
|
34 |
+
'File number of import'
|
35 |
+
)
|
36 |
+
->addColumn(
|
37 |
+
'is_imported',
|
38 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
39 |
+
6,
|
40 |
+
[
|
41 |
+
'nullable' => false,
|
42 |
+
'default' => 0,
|
43 |
+
]
|
44 |
+
)
|
45 |
+
->addColumn(
|
46 |
+
'created_at',
|
47 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
48 |
+
null,
|
49 |
+
['default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT],
|
50 |
+
'Created at'
|
51 |
+
);
|
52 |
+
$con->createTable($import);
|
53 |
+
|
54 |
+
$project = $con->newTable($this->getTable('eurotext_translationmanager/project'))
|
55 |
+
->addColumn(
|
56 |
+
'id',
|
57 |
+
Varien_Db_Ddl_Table::TYPE_BIGINT,
|
58 |
+
20,
|
59 |
+
['primary' => true, 'unsigned' => true, 'nullable' => false, 'auto_increment' => true,],
|
60 |
+
'Project ID'
|
61 |
+
)
|
62 |
+
->addColumn('project_name', Varien_Db_Ddl_Table::TYPE_TEXT, null, ['nullable' => false], 'Project name')
|
63 |
+
->addColumn(
|
64 |
+
'updated_at',
|
65 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
66 |
+
null,
|
67 |
+
['default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT_UPDATE],
|
68 |
+
'Last Update'
|
69 |
+
)
|
70 |
+
->addColumn(
|
71 |
+
'storeview_src',
|
72 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
73 |
+
11,
|
74 |
+
['nullable' => false, 'default' => -1],
|
75 |
+
'Source Storeview'
|
76 |
+
)
|
77 |
+
->addColumn(
|
78 |
+
'storeview_dst',
|
79 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
80 |
+
11,
|
81 |
+
['nullable' => false, 'default' => -1],
|
82 |
+
'Destination Storeview'
|
83 |
+
)
|
84 |
+
->addColumn(
|
85 |
+
'project_status',
|
86 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
87 |
+
11,
|
88 |
+
['nullable' => false, 'default' => 0],
|
89 |
+
'Status'
|
90 |
+
)
|
91 |
+
->addColumn(
|
92 |
+
'langfilesmode',
|
93 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
94 |
+
6,
|
95 |
+
['nullable' => false, 'default' => 0],
|
96 |
+
'Export all languagefiles'
|
97 |
+
)
|
98 |
+
->addColumn(
|
99 |
+
'export_seo',
|
100 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
101 |
+
6,
|
102 |
+
['nullable' => false, 'default' => 1],
|
103 |
+
'Export SEO informations'
|
104 |
+
)
|
105 |
+
->addColumn(
|
106 |
+
'productmode',
|
107 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
108 |
+
6,
|
109 |
+
['nullable' => false, 'default' => 0],
|
110 |
+
'0=Selected Products, 1=All Products without translation'
|
111 |
+
)
|
112 |
+
->addColumn(
|
113 |
+
'categorymode',
|
114 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
115 |
+
6,
|
116 |
+
['nullable' => false, 'default' => 0],
|
117 |
+
'0=Selected Categories, 1=All Categories without translation'
|
118 |
+
)
|
119 |
+
->addColumn(
|
120 |
+
'cmsmode',
|
121 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
122 |
+
6,
|
123 |
+
['nullable' => false, 'default' => 0],
|
124 |
+
'0=Selected CMS-Pages, 1 = All missing CMS-Pages'
|
125 |
+
)
|
126 |
+
->addColumn(
|
127 |
+
'zip_filename',
|
128 |
+
Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
129 |
+
255,
|
130 |
+
['nullable' => false, 'default' => ''],
|
131 |
+
'Filename exported zipfile'
|
132 |
+
)
|
133 |
+
->addColumn(
|
134 |
+
'export_attributes',
|
135 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
136 |
+
6,
|
137 |
+
['nullable' => false, 'default' => 0],
|
138 |
+
'Export EAV attributes'
|
139 |
+
)
|
140 |
+
->addColumn(
|
141 |
+
'templatemode',
|
142 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
143 |
+
6,
|
144 |
+
['nullable' => false, 'default' => 0],
|
145 |
+
'0=selected email templates, 1=All missing email templates'
|
146 |
+
)
|
147 |
+
->addColumn(
|
148 |
+
'export_urlkeys',
|
149 |
+
Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
150 |
+
6,
|
151 |
+
['nullable' => false, 'default' => 0],
|
152 |
+
'Export URL keys'
|
153 |
+
)
|
154 |
+
->addColumn(
|
155 |
+
'created_at',
|
156 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
157 |
+
null,
|
158 |
+
[],
|
159 |
+
'Created at'
|
160 |
+
);
|
161 |
+
|
162 |
+
|
163 |
+
$con->createTable($project);
|
164 |
+
|
165 |
+
$projectCategories = $con->newTable($this->getTable("eurotext_translationmanager/project_categories"))
|
166 |
+
->addColumn(
|
167 |
+
'project_category_id',
|
168 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
169 |
+
10,
|
170 |
+
['primary' => true, 'unsigned' => true, 'nullable' => false, 'auto_increment' => true],
|
171 |
+
'Primary key'
|
172 |
+
)
|
173 |
+
->addColumn('project_id', Varien_Db_Ddl_Table::TYPE_BIGINT, 20, ['nullable' => false], 'FK on project')
|
174 |
+
->addColumn(
|
175 |
+
'category_id',
|
176 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
177 |
+
null,
|
178 |
+
[
|
179 |
+
'unsigned' => true,
|
180 |
+
'nullable' => false,
|
181 |
+
],
|
182 |
+
'Category ID'
|
183 |
+
)
|
184 |
+
->addColumn(
|
185 |
+
'created_at',
|
186 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
187 |
+
null,
|
188 |
+
['default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT],
|
189 |
+
'Created at'
|
190 |
+
);
|
191 |
+
|
192 |
+
$con->createTable($projectCategories);
|
193 |
+
|
194 |
+
$projectCmsBlocks = $con->newTable($this->getTable('eurotext_translationmanager/project_cmsblocks'))
|
195 |
+
->addColumn(
|
196 |
+
'project_cmsblock_id',
|
197 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
198 |
+
10,
|
199 |
+
['primary' => true, 'unsigned' => true, 'nullable' => false, 'auto_increment' => true],
|
200 |
+
'Primary key'
|
201 |
+
)
|
202 |
+
->addColumn('project_id', Varien_Db_Ddl_Table::TYPE_BIGINT, 20, ['nullable' => false], 'FK on project')
|
203 |
+
->addColumn(
|
204 |
+
'block_id',
|
205 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
206 |
+
null,
|
207 |
+
[
|
208 |
+
'unsigned' => true,
|
209 |
+
'nullable' => false,
|
210 |
+
],
|
211 |
+
'Block ID'
|
212 |
+
)
|
213 |
+
->addColumn(
|
214 |
+
'created_at',
|
215 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
216 |
+
null,
|
217 |
+
['default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT],
|
218 |
+
'Created at'
|
219 |
+
);
|
220 |
+
|
221 |
+
$con->createTable($projectCmsBlocks);
|
222 |
+
|
223 |
+
$projectCmsPages = $con->newTable($this->getTable('eurotext_translationmanager/project_cmspages'))
|
224 |
+
->addColumn(
|
225 |
+
'project_cmspage_id',
|
226 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
227 |
+
10,
|
228 |
+
['primary' => true, 'unsigned' => true, 'nullable' => false, 'auto_increment' => true],
|
229 |
+
'Primary key'
|
230 |
+
)
|
231 |
+
->addColumn('project_id', Varien_Db_Ddl_Table::TYPE_BIGINT, 20, ['nullable' => false], 'FK on project')
|
232 |
+
->addColumn(
|
233 |
+
'page_id',
|
234 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
235 |
+
null,
|
236 |
+
[
|
237 |
+
'unsigned' => true,
|
238 |
+
'nullable' => false,
|
239 |
+
],
|
240 |
+
'Page ID'
|
241 |
+
)
|
242 |
+
->addColumn(
|
243 |
+
'created_at',
|
244 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
245 |
+
null,
|
246 |
+
['default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT],
|
247 |
+
'Created at'
|
248 |
+
);
|
249 |
+
|
250 |
+
$con->createTable($projectCmsPages);
|
251 |
+
|
252 |
+
$projectEmailtemplates = $con->newTable($this->getTable('eurotext_translationmanager/project_emailtemplates'))
|
253 |
+
->addColumn(
|
254 |
+
'project_emailtemplates_id',
|
255 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
256 |
+
10,
|
257 |
+
['primary' => true, 'unsigned' => true, 'nullable' => false, 'auto_increment' => true],
|
258 |
+
'Primary key'
|
259 |
+
)
|
260 |
+
->addColumn('project_id', Varien_Db_Ddl_Table::TYPE_BIGINT, 20, ['nullable' => false], 'FK on project')
|
261 |
+
->addColumn('filename', Varien_Db_Ddl_Table::TYPE_TEXT, null, [], 'filename of csv')
|
262 |
+
->addColumn(
|
263 |
+
'created_at',
|
264 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
265 |
+
null,
|
266 |
+
['default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT],
|
267 |
+
'Created at'
|
268 |
+
);
|
269 |
+
|
270 |
+
$con->createTable($projectEmailtemplates);
|
271 |
+
|
272 |
+
$projectProducts = $con->newTable($this->getTable('eurotext_translationmanager/project_products'))
|
273 |
+
->addColumn(
|
274 |
+
'project_product_id',
|
275 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
276 |
+
10,
|
277 |
+
['primary' => true, 'unsigned' => true, 'nullable' => false, 'auto_increment' => true],
|
278 |
+
'Primary key'
|
279 |
+
)
|
280 |
+
->addColumn('project_id', Varien_Db_Ddl_Table::TYPE_BIGINT, 20, ['nullable' => false], 'FK on project')
|
281 |
+
->addColumn(
|
282 |
+
'product_id',
|
283 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
284 |
+
null,
|
285 |
+
[
|
286 |
+
'unsigned' => true,
|
287 |
+
'nullable' => false,
|
288 |
+
],
|
289 |
+
'Product ID'
|
290 |
+
)
|
291 |
+
->addColumn(
|
292 |
+
'created_at',
|
293 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
294 |
+
null,
|
295 |
+
['default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT],
|
296 |
+
'Created at'
|
297 |
+
);
|
298 |
+
|
299 |
+
|
300 |
+
$con->createTable($projectProducts);
|
301 |
+
|
302 |
+
$projectCsv = $con->newTable($this->getTable('eurotext_translationmanager/project_csv'))
|
303 |
+
->addColumn(
|
304 |
+
'project_csv_id',
|
305 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
306 |
+
10,
|
307 |
+
['primary' => true, 'unsigned' => true, 'nullable' => false, 'auto_increment' => true],
|
308 |
+
'Primary key'
|
309 |
+
)
|
310 |
+
->addColumn('project_id', Varien_Db_Ddl_Table::TYPE_BIGINT, 20, ['nullable' => false], 'FK on project')
|
311 |
+
->addColumn('filename', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, [], 'Filename to export')
|
312 |
+
->addColumn(
|
313 |
+
'created_at',
|
314 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
315 |
+
null,
|
316 |
+
['default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT],
|
317 |
+
'Created at'
|
318 |
+
);
|
319 |
+
|
320 |
+
$con->createTable($projectCsv);
|
321 |
+
|
322 |
+
$tableName = $this->getTable('eurotext_translationmanager/project_import');
|
323 |
+
$this->getConnection()->addIndex(
|
324 |
+
$tableName,
|
325 |
+
$this->getConnection()->getIndexName(
|
326 |
+
$tableName,
|
327 |
+
['project_id', 'filename'],
|
328 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
329 |
+
),
|
330 |
+
['project_id', 'filename'],
|
331 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
332 |
+
);
|
333 |
+
|
334 |
+
$tableName = $this->getTable('eurotext_translationmanager/project_categories');
|
335 |
+
$this->getConnection()->addIndex(
|
336 |
+
$tableName,
|
337 |
+
$this->getConnection()->getIndexName(
|
338 |
+
$tableName,
|
339 |
+
['project_id', 'category_id'],
|
340 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
341 |
+
),
|
342 |
+
['project_id', 'category_id'],
|
343 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
344 |
+
);
|
345 |
+
|
346 |
+
$tablesToPutFkOn = [
|
347 |
+
'eurotext_translationmanager/project_csv',
|
348 |
+
'eurotext_translationmanager/project_emailtemplates',
|
349 |
+
'eurotext_translationmanager/project_import',
|
350 |
+
'eurotext_translationmanager/project_categories',
|
351 |
+
'eurotext_translationmanager/project_cmsblocks',
|
352 |
+
'eurotext_translationmanager/project_cmspages',
|
353 |
+
'eurotext_translationmanager/project_products',
|
354 |
+
];
|
355 |
+
|
356 |
+
$projectTableName = $this->getTable('eurotext_translationmanager/project');
|
357 |
+
$this->getConnection()->changeColumn(
|
358 |
+
$projectTableName,
|
359 |
+
'id',
|
360 |
+
'id',
|
361 |
+
['type' => Varien_Db_Ddl_Table::TYPE_BIGINT, 'auto_increment' => true, 'unsigned' => false]
|
362 |
+
);
|
363 |
+
|
364 |
+
foreach ($tablesToPutFkOn as $table) {
|
365 |
+
$tableName = $this->getTable($table);
|
366 |
+
$this->getConnection()->addForeignKey(
|
367 |
+
$this->getConnection()->getForeignKeyName(
|
368 |
+
$tableName,
|
369 |
+
'project_id',
|
370 |
+
$projectTableName,
|
371 |
+
'id'
|
372 |
+
),
|
373 |
+
$tableName,
|
374 |
+
'project_id',
|
375 |
+
$projectTableName,
|
376 |
+
'id'
|
377 |
+
);
|
378 |
+
}
|
379 |
+
|
380 |
+
$tables = [
|
381 |
+
'eurotext_translationmanager/project_cmsblocks' => ['project_cmsblock_id', 'block_id'],
|
382 |
+
'eurotext_translationmanager/project_cmspages' => ['project_cmspage_id', 'page_id'],
|
383 |
+
'eurotext_translationmanager/project_products' => ['project_product_id', 'product_id'],
|
384 |
+
];
|
385 |
+
|
386 |
+
foreach ($tables as $table => $columnNames) {
|
387 |
+
$tableName = $this->getTable($table);
|
388 |
+
$this->getConnection()->addIndex(
|
389 |
+
$tableName,
|
390 |
+
$this->getConnection()->getIndexName(
|
391 |
+
$tableName,
|
392 |
+
['project_id', $columnNames[1]],
|
393 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
394 |
+
),
|
395 |
+
['project_id', $columnNames[1]],
|
396 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
397 |
+
);
|
398 |
+
}
|
399 |
+
|
400 |
+
$foreignKeys = [
|
401 |
+
[
|
402 |
+
'eurotext_translationmanager/project_cmsblocks',
|
403 |
+
'block_id',
|
404 |
+
'cms/block',
|
405 |
+
'block_id',
|
406 |
+
],
|
407 |
+
[
|
408 |
+
'eurotext_translationmanager/project_cmspages',
|
409 |
+
'page_id',
|
410 |
+
'cms/page',
|
411 |
+
'page_id',
|
412 |
+
],
|
413 |
+
[
|
414 |
+
'eurotext_translationmanager/project_products',
|
415 |
+
'product_id',
|
416 |
+
'catalog/product',
|
417 |
+
'entity_id',
|
418 |
+
],
|
419 |
+
[
|
420 |
+
'eurotext_translationmanager/project_categories',
|
421 |
+
'category_id',
|
422 |
+
'catalog/category',
|
423 |
+
'entity_id',
|
424 |
+
],
|
425 |
+
];
|
426 |
+
|
427 |
+
foreach ($foreignKeys as $keyData) {
|
428 |
+
$this->getConnection()->changeColumn(
|
429 |
+
$this->getTable($keyData[0]),
|
430 |
+
$keyData[1],
|
431 |
+
$keyData[1],
|
432 |
+
[
|
433 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
434 |
+
'unsigned' => true,
|
435 |
+
'nullable' => false,
|
436 |
+
'comment' => 'Entity ID',
|
437 |
+
]
|
438 |
+
);
|
439 |
+
|
440 |
+
|
441 |
+
$this->getConnection()->addForeignKey(
|
442 |
+
$this->getFkName(
|
443 |
+
$this->getTable($keyData[0]),
|
444 |
+
$keyData[1],
|
445 |
+
$this->getTable($keyData[2]),
|
446 |
+
$keyData[3]
|
447 |
+
),
|
448 |
+
$this->getTable($keyData[0]),
|
449 |
+
$keyData[1],
|
450 |
+
$this->getTable($keyData[2]),
|
451 |
+
$keyData[3]
|
452 |
+
);
|
453 |
+
}
|
454 |
+
|
455 |
+
$this->getConnection()->dropTable($this->getTable('eurotext_translationmanager/project_csv_data'));
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var Eurotext_TranslationManager_Model_Resource_Setup $this */
|
4 |
+
|
5 |
+
$this->startSetup();
|
6 |
+
|
7 |
+
$tableName = $this->getTable('eurotext_translationmanager/import');
|
8 |
+
|
9 |
+
$this->getConnection()->dropIndex($tableName, 'pk');
|
10 |
+
$this->getConnection()->addIndex(
|
11 |
+
$tableName,
|
12 |
+
$this->getConnection()->getIndexName(
|
13 |
+
$tableName,
|
14 |
+
array('project_id', 'filename'),
|
15 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
16 |
+
),
|
17 |
+
array('project_id', 'filename'),
|
18 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
19 |
+
);
|
20 |
+
|
21 |
+
$this->getConnection()->addColumn(
|
22 |
+
$tableName,
|
23 |
+
'import_id',
|
24 |
+
array(
|
25 |
+
'primary' => true,
|
26 |
+
'comment' => 'Primary key',
|
27 |
+
'unsigned' => true,
|
28 |
+
'identity' => true,
|
29 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
$tableName = $this->getTable('eurotext_translationmanager/project_categories');
|
34 |
+
$this->getConnection()->dropIndex($tableName, 'PRIMARY');
|
35 |
+
$this->getConnection()->addIndex(
|
36 |
+
$tableName,
|
37 |
+
$this->getConnection()->getIndexName(
|
38 |
+
$tableName,
|
39 |
+
array('project_id', 'category_id'),
|
40 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
41 |
+
),
|
42 |
+
array('project_id', 'category_id'),
|
43 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
44 |
+
);
|
45 |
+
|
46 |
+
$this->getConnection()->addColumn(
|
47 |
+
$tableName,
|
48 |
+
'project_category_id',
|
49 |
+
array(
|
50 |
+
'primary' => true,
|
51 |
+
'comment' => 'Primary key',
|
52 |
+
'unsigned' => true,
|
53 |
+
'identity' => true,
|
54 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
55 |
+
)
|
56 |
+
);
|
57 |
+
|
58 |
+
$this->endSetup();
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var Eurotext_TranslationManager_Model_Resource_Setup $this */
|
4 |
+
|
5 |
+
$this->startSetup();
|
6 |
+
|
7 |
+
$tablesToPutFkOn = array(
|
8 |
+
'eurotext_translationmanager/csv',
|
9 |
+
'eurotext_translationmanager/csv_data',
|
10 |
+
'eurotext_translationmanager/emailtemplates',
|
11 |
+
'eurotext_translationmanager/import',
|
12 |
+
'eurotext_translationmanager/project_categories',
|
13 |
+
'eurotext_translationmanager/project_cmsblocks',
|
14 |
+
'eurotext_translationmanager/project_cmspages',
|
15 |
+
'eurotext_translationmanager/project_products',
|
16 |
+
);
|
17 |
+
|
18 |
+
$projectTableName = $this->getTable('eurotext_translationmanager/project');
|
19 |
+
$this->getConnection()->changeColumn(
|
20 |
+
$projectTableName,
|
21 |
+
'id',
|
22 |
+
'id',
|
23 |
+
array('type' => Varien_Db_Ddl_Table::TYPE_BIGINT, 'auto_increment' => true, 'unsigned' => false)
|
24 |
+
);
|
25 |
+
foreach ($tablesToPutFkOn as $table) {
|
26 |
+
$tableName = $this->getTable($table);
|
27 |
+
$this->getConnection()->addForeignKey(
|
28 |
+
$this->getConnection()->getForeignKeyName(
|
29 |
+
$tableName,
|
30 |
+
'project_id',
|
31 |
+
$projectTableName,
|
32 |
+
'id'
|
33 |
+
),
|
34 |
+
$tableName,
|
35 |
+
'project_id',
|
36 |
+
$projectTableName,
|
37 |
+
'id'
|
38 |
+
);
|
39 |
+
}
|
40 |
+
|
41 |
+
$this->endSetup();
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var Eurotext_TranslationManager_Model_Resource_Setup $this */
|
4 |
+
|
5 |
+
$this->startSetup();
|
6 |
+
|
7 |
+
$tables = array(
|
8 |
+
'eurotext_translationmanager/project_cmsblocks' => array('project_cmsblock_id', 'block_id'),
|
9 |
+
'eurotext_translationmanager/project_cmspages' => array('project_cmspage_id', 'page_id'),
|
10 |
+
'eurotext_translationmanager/project_products' => array('project_product_id', 'product_id'),
|
11 |
+
);
|
12 |
+
|
13 |
+
foreach ($tables as $table => $columnNames) {
|
14 |
+
$tableName = $this->getTable($table);
|
15 |
+
$this->getConnection()->dropIndex($tableName, 'PRIMARY');
|
16 |
+
$this->getConnection()->addIndex(
|
17 |
+
$tableName,
|
18 |
+
$this->getConnection()->getIndexName(
|
19 |
+
$tableName,
|
20 |
+
array('project_id', $columnNames[1]),
|
21 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
22 |
+
),
|
23 |
+
array('project_id', $columnNames[1]),
|
24 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
25 |
+
);
|
26 |
+
|
27 |
+
$this->getConnection()->addColumn(
|
28 |
+
$tableName,
|
29 |
+
$columnNames[0],
|
30 |
+
array(
|
31 |
+
'primary' => true,
|
32 |
+
'comment' => 'Primary key',
|
33 |
+
'unsigned' => true,
|
34 |
+
'identity' => true,
|
35 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
36 |
+
)
|
37 |
+
);
|
38 |
+
}
|
39 |
+
|
40 |
+
$this->endSetup();
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var Eurotext_TranslationManager_Model_Resource_Setup $this */
|
4 |
+
|
5 |
+
$this->startSetup();
|
6 |
+
|
7 |
+
$foreignKeys = array(
|
8 |
+
array(
|
9 |
+
'eurotext_translationmanager/project_cmsblocks',
|
10 |
+
'block_id',
|
11 |
+
'cms/block',
|
12 |
+
'block_id',
|
13 |
+
),
|
14 |
+
array(
|
15 |
+
'eurotext_translationmanager/project_cmspages',
|
16 |
+
'page_id',
|
17 |
+
'cms/page',
|
18 |
+
'page_id',
|
19 |
+
),
|
20 |
+
array(
|
21 |
+
'eurotext_translationmanager/project_products',
|
22 |
+
'product_id',
|
23 |
+
'catalog/product',
|
24 |
+
'entity_id',
|
25 |
+
),
|
26 |
+
array(
|
27 |
+
'eurotext_translationmanager/project_categories',
|
28 |
+
'category_id',
|
29 |
+
'catalog/category',
|
30 |
+
'entity_id',
|
31 |
+
),
|
32 |
+
);
|
33 |
+
|
34 |
+
foreach ($foreignKeys as $keyData) {
|
35 |
+
$this->getConnection()->changeColumn(
|
36 |
+
$this->getTable($keyData[0]),
|
37 |
+
$keyData[1],
|
38 |
+
$keyData[1],
|
39 |
+
array(
|
40 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
41 |
+
'unsigned' => true,
|
42 |
+
'nullable' => false,
|
43 |
+
'comment' => 'Entity ID',
|
44 |
+
)
|
45 |
+
);
|
46 |
+
|
47 |
+
|
48 |
+
$this->getConnection()->addForeignKey(
|
49 |
+
$this->getFkName(
|
50 |
+
$this->getTable($keyData[0]),
|
51 |
+
$keyData[1],
|
52 |
+
$this->getTable($keyData[2]),
|
53 |
+
$keyData[3]
|
54 |
+
),
|
55 |
+
$this->getTable($keyData[0]),
|
56 |
+
$keyData[1],
|
57 |
+
$this->getTable($keyData[2]),
|
58 |
+
$keyData[3]
|
59 |
+
);
|
60 |
+
}
|
61 |
+
|
62 |
+
$this->endSetup();
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this Eurotext_TranslationManager_Model_Resource_Setup */
|
3 |
+
|
4 |
+
$this->startSetup();
|
5 |
+
|
6 |
+
$this->getConnection()->addColumn(
|
7 |
+
$this->getTable('eurotext_translationmanager/project'),
|
8 |
+
'created_at',
|
9 |
+
array(
|
10 |
+
'default' => '0000-00-00 00:00:00',
|
11 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
12 |
+
'comment' => 'Created At',
|
13 |
+
'nullable' => false,
|
14 |
+
)
|
15 |
+
);
|
16 |
+
|
17 |
+
$this->endSetup();
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this Eurotext_TranslationManager_Model_Resource_Setup */
|
3 |
+
|
4 |
+
$this->startSetup();
|
5 |
+
|
6 |
+
$this->getConnection()->changeColumn(
|
7 |
+
$this->getTable('eurotext_translationmanager/project'),
|
8 |
+
'last_update',
|
9 |
+
'updated_at',
|
10 |
+
array(
|
11 |
+
'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT_UPDATE,
|
12 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
13 |
+
'comment' => 'Last Update',
|
14 |
+
'nullable' => false,
|
15 |
+
)
|
16 |
+
);
|
17 |
+
|
18 |
+
$this->endSetup();
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this Eurotext_TranslationManager_Model_Resource_Setup */
|
3 |
+
|
4 |
+
$this->startSetup();
|
5 |
+
|
6 |
+
$this->getConnection()->changeColumn(
|
7 |
+
$this->getTable('eurotext_translationmanager/project'),
|
8 |
+
'updated_at',
|
9 |
+
'updated_at',
|
10 |
+
array(
|
11 |
+
'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT_UPDATE,
|
12 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
13 |
+
'comment' => 'Last Update',
|
14 |
+
'nullable' => false,
|
15 |
+
)
|
16 |
+
);
|
17 |
+
|
18 |
+
$this->endSetup();
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this Eurotext_TranslationManager_Model_Resource_Setup */
|
3 |
+
|
4 |
+
$this->startSetup();
|
5 |
+
|
6 |
+
$this->getConnection()->changeColumn(
|
7 |
+
$this->getTable('eurotext_translationmanager/project'),
|
8 |
+
'id',
|
9 |
+
'id',
|
10 |
+
array(
|
11 |
+
'type' => Varien_Db_Ddl_Table::TYPE_BIGINT,
|
12 |
+
'comment' => 'Project ID',
|
13 |
+
'primary' => true,
|
14 |
+
'auto_increment' => true,
|
15 |
+
'nullable' => false,
|
16 |
+
'unsigned' => false,
|
17 |
+
)
|
18 |
+
);
|
19 |
+
|
20 |
+
$this->endSetup();
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this Eurotext_TranslationManager_Model_Resource_Setup */
|
3 |
+
|
4 |
+
$this->startSetup();
|
5 |
+
|
6 |
+
$connection = $this->getConnection();
|
7 |
+
|
8 |
+
$connection->modifyColumn(
|
9 |
+
$this->getTable('eurotext_translationmanager/project'),
|
10 |
+
'created_at',
|
11 |
+
[
|
12 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
13 |
+
'length' => null,
|
14 |
+
'comment' => 'Created at'
|
15 |
+
]
|
16 |
+
);
|
17 |
+
|
18 |
+
$connection->modifyColumn(
|
19 |
+
$this->getTable('eurotext_translationmanager/project'),
|
20 |
+
'updated_at',
|
21 |
+
[
|
22 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
23 |
+
'length' => null,
|
24 |
+
'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT_UPDATE,
|
25 |
+
'comment' => 'Last Update'
|
26 |
+
]
|
27 |
+
);
|
28 |
+
|
29 |
+
$connection->modifyColumn(
|
30 |
+
$this->getTable('eurotext_translationmanager/project'),
|
31 |
+
'templatemode',
|
32 |
+
[
|
33 |
+
'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
34 |
+
'length' => 6,
|
35 |
+
'nullable' => false,
|
36 |
+
'default' => 0,
|
37 |
+
'comment' => '0=selected email templates, 1=All missing email templates'
|
38 |
+
]
|
39 |
+
);
|
40 |
+
|
41 |
+
$connection->modifyColumn(
|
42 |
+
$this->getTable('eurotext_translationmanager/project_csv'),
|
43 |
+
'filename',
|
44 |
+
[
|
45 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
46 |
+
'length' => 255,
|
47 |
+
'comment' => 'Filename to export'
|
48 |
+
]
|
49 |
+
);
|
50 |
+
|
51 |
+
$connection->modifyColumn(
|
52 |
+
$this->getTable('eurotext_translationmanager/project_emailtemplates'),
|
53 |
+
'filename',
|
54 |
+
[
|
55 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
56 |
+
'length' => 1500,
|
57 |
+
'comment' => 'filename of csv'
|
58 |
+
]
|
59 |
+
);
|
60 |
+
|
61 |
+
$connection->modifyColumn(
|
62 |
+
$this->getTable('eurotext_translationmanager/project_emailtemplates'),
|
63 |
+
'project_id',
|
64 |
+
[
|
65 |
+
'type' => Varien_Db_Ddl_Table::TYPE_BIGINT,
|
66 |
+
'length' => 20,
|
67 |
+
'nullable' => false,
|
68 |
+
'comment' => 'FK on project',
|
69 |
+
]
|
70 |
+
);
|
71 |
+
|
72 |
+
$connection->addColumn(
|
73 |
+
$this->getTable('eurotext_translationmanager/project_import'),
|
74 |
+
'created_at',
|
75 |
+
[
|
76 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
77 |
+
'length' => null,
|
78 |
+
'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT,
|
79 |
+
'comment' => 'Created at'
|
80 |
+
]
|
81 |
+
);
|
82 |
+
|
83 |
+
$connection->dropTable($this->getTable('eurotext_translationmanager/project_csv_data'));
|
84 |
+
|
85 |
+
$this->endSetup();
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this Eurotext_TranslationManager_Model_Resource_Setup */
|
3 |
+
|
4 |
+
$this->startSetup();
|
5 |
+
|
6 |
+
$this->getConnection()->renameTable(
|
7 |
+
$this->getTable('eurotext_translationmanager/csv'),
|
8 |
+
$this->getTable('eurotext_translationmanager/project_csv')
|
9 |
+
);
|
10 |
+
|
11 |
+
$this->endSetup();
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this Eurotext_TranslationManager_Model_Resource_Setup */
|
3 |
+
|
4 |
+
$this->startSetup();
|
5 |
+
|
6 |
+
$this->getConnection()->renameTable(
|
7 |
+
$this->getTable('eurotext_translationmanager/emailtemplates'),
|
8 |
+
$this->getTable('eurotext_translationmanager/project_emailtemplates')
|
9 |
+
);
|
10 |
+
|
11 |
+
$this->endSetup();
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this Eurotext_TranslationManager_Model_Resource_Setup */
|
3 |
+
|
4 |
+
$this->startSetup();
|
5 |
+
$tables = [
|
6 |
+
'eurotext_translationmanager/project_products',
|
7 |
+
'eurotext_translationmanager/project_categories',
|
8 |
+
'eurotext_translationmanager/project_cmsblocks',
|
9 |
+
'eurotext_translationmanager/project_cmspages',
|
10 |
+
'eurotext_translationmanager/project_csv',
|
11 |
+
'eurotext_translationmanager/project_emailtemplates',
|
12 |
+
];
|
13 |
+
|
14 |
+
foreach ($tables as $table) {
|
15 |
+
$table = $this->getTable($table);
|
16 |
+
$this->getConnection()->dropColumn($table, 'time_added');
|
17 |
+
$this->getConnection()->addColumn(
|
18 |
+
$table,
|
19 |
+
'created_at',
|
20 |
+
[
|
21 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
22 |
+
'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT,
|
23 |
+
'comment' => 'Creation Time',
|
24 |
+
]
|
25 |
+
);
|
26 |
+
}
|
27 |
+
$this->endSetup();
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this Eurotext_TranslationManager_Model_Resource_Setup */
|
3 |
+
|
4 |
+
$this->startSetup();
|
5 |
+
$tables = [
|
6 |
+
'eurotext_translationmanager/project_csv' => 'project_csv_id',
|
7 |
+
'eurotext_translationmanager/project_emailtemplates' => 'project_emailtemplates_id',
|
8 |
+
];
|
9 |
+
|
10 |
+
foreach ($tables as $table => $newPrimary) {
|
11 |
+
$tableName = $this->getTable($table);
|
12 |
+
$this->getConnection()->dropIndex($tableName, 'PRIMARY');
|
13 |
+
|
14 |
+
$this->getConnection()->addColumn(
|
15 |
+
$tableName,
|
16 |
+
$newPrimary,
|
17 |
+
[
|
18 |
+
'primary' => true,
|
19 |
+
'comment' => 'Primary key',
|
20 |
+
'unsigned' => true,
|
21 |
+
'identity' => true,
|
22 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
23 |
+
]
|
24 |
+
);
|
25 |
+
}
|
26 |
+
$this->endSetup();
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this Eurotext_TranslationManager_Model_Resource_Setup */
|
3 |
+
|
4 |
+
$this->startSetup();
|
5 |
+
$tables = [
|
6 |
+
'eurotext_translationmanager/project_csv',
|
7 |
+
'eurotext_translationmanager/project_emailtemplates',
|
8 |
+
];
|
9 |
+
|
10 |
+
foreach ($tables as $table) {
|
11 |
+
$tableName = $this->getTable($table);
|
12 |
+
$this->getConnection()->dropColumn($tableName, 'file_hash');
|
13 |
+
$this->getConnection()->dropColumn($tableName, 'line_hash');
|
14 |
+
$this->getConnection()->dropColumn($tableName, 'translate_flag');
|
15 |
+
$this->getConnection()->dropColumn($tableName, 'deleteflag');
|
16 |
+
$this->getConnection()->dropColumn($tableName, 'locale_dst');
|
17 |
+
}
|
18 |
+
$this->endSetup();
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this Eurotext_TranslationManager_Model_Resource_Setup */
|
3 |
+
|
4 |
+
$this->startSetup();
|
5 |
+
|
6 |
+
$con = $this->getConnection();
|
7 |
+
$con->renameTable(
|
8 |
+
$this->getTable('eurotext_translationmanager/csv_data'),
|
9 |
+
$this->getTable('eurotext_translationmanager/project_csv_data')
|
10 |
+
);
|
11 |
+
|
12 |
+
$dropColumns = [
|
13 |
+
'create_id', 'deleted', 'filter_status', 'filter_stock', 'filter_product_type'
|
14 |
+
];
|
15 |
+
|
16 |
+
foreach ($dropColumns as $c) {
|
17 |
+
$con->dropColumn($this->getTable('eurotext_translationmanager/project'), $c);
|
18 |
+
}
|
19 |
+
|
20 |
+
$this->endSetup();
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/** @var $this Eurotext_TranslationManager_Model_Resource_Setup */
|
3 |
+
|
4 |
+
$this->startSetup();
|
5 |
+
|
6 |
+
$con = $this->getConnection();
|
7 |
+
|
8 |
+
$con->dropTable($this->getTable('eurotext_translationmanager/languages'));
|
9 |
+
$con->renameTable(
|
10 |
+
$this->getTable('eurotext_translationmanager/import'),
|
11 |
+
$this->getTable('eurotext_translationmanager/project_import')
|
12 |
+
);
|
13 |
+
$this->endSetup();
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var $this Mage_Core_Model_Resource_Setup */
|
4 |
+
|
5 |
+
$this->startSetup();
|
6 |
+
|
7 |
+
$connection = $this->getConnection();
|
8 |
+
$connection
|
9 |
+
->addColumn(
|
10 |
+
$this->getTable('eurotext_translationmanager/project_import'),
|
11 |
+
'storeview_dst',
|
12 |
+
[
|
13 |
+
'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
14 |
+
'length' => null,
|
15 |
+
'unsigned' => true,
|
16 |
+
'nullable' => false,
|
17 |
+
'comment' => 'storeview destination'
|
18 |
+
]
|
19 |
+
);
|
20 |
+
|
21 |
+
$connection->addForeignKey(
|
22 |
+
$this->getFkName(
|
23 |
+
$this->getTable('eurotext_translationmanager/project_import'),
|
24 |
+
'storeview_dst',
|
25 |
+
$this->getTable('core/store'),
|
26 |
+
'store_id'
|
27 |
+
),
|
28 |
+
$this->getTable('eurotext_translationmanager/project_import'),
|
29 |
+
'storeview_dst',
|
30 |
+
$this->getTable('core/store'),
|
31 |
+
'store_id'
|
32 |
+
);
|
33 |
+
|
34 |
+
$this->endSetup();
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var $this Mage_Core_Model_Resource_Setup */
|
4 |
+
|
5 |
+
$this->startSetup();
|
6 |
+
|
7 |
+
$connection = $this->getConnection();
|
8 |
+
$connection->dropColumn($this->getTable('eurotext_translationmanager/project_import'), 'num');
|
9 |
+
|
10 |
+
$this->endSetup();
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var $this Mage_Core_Model_Resource_Setup */
|
4 |
+
|
5 |
+
$this->startSetup();
|
6 |
+
|
7 |
+
$connection = $this->getConnection();
|
8 |
+
$connection->changeColumn(
|
9 |
+
$this->getTable('eurotext_translationmanager/project_emailtemplates'),
|
10 |
+
'project_emailtemplates_id',
|
11 |
+
'project_emailtemplate_id',
|
12 |
+
[
|
13 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
14 |
+
'length' => 10,
|
15 |
+
'primary' => true,
|
16 |
+
'unsigned' => true,
|
17 |
+
'nullable' => false,
|
18 |
+
'auto_increment' => true,
|
19 |
+
'comment' => 'Primary key',
|
20 |
+
]
|
21 |
+
);
|
22 |
+
|
23 |
+
$this->endSetup();
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var $this Mage_Core_Model_Resource_Setup */
|
4 |
+
|
5 |
+
$this->startSetup();
|
6 |
+
|
7 |
+
$connection = $this->getConnection();
|
8 |
+
|
9 |
+
$connection->addColumn(
|
10 |
+
$this->getTable('eurotext_translationmanager/project'),
|
11 |
+
'customer_comment',
|
12 |
+
[
|
13 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
14 |
+
'nullable' => true,
|
15 |
+
'comment' => 'Customer comment',
|
16 |
+
]
|
17 |
+
);
|
18 |
+
|
19 |
+
$this->endSetup();
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var $this Mage_Core_Model_Resource_Setup */
|
4 |
+
|
5 |
+
$this->startSetup();
|
6 |
+
|
7 |
+
$connection = $this->getConnection();
|
8 |
+
|
9 |
+
$connection->renameTable(
|
10 |
+
$this->getTable('eurotext_translationmanager/project_emailtemplates'),
|
11 |
+
$this->getTable('eurotext_translationmanager/project_emailtemplate_files')
|
12 |
+
);
|
13 |
+
|
14 |
+
$this->endSetup();
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var $this Mage_Core_Model_Resource_Setup */
|
4 |
+
|
5 |
+
$this->startSetup();
|
6 |
+
|
7 |
+
$connection = $this->getConnection();
|
8 |
+
|
9 |
+
$emailTemplateDatabase = $connection->newTable(
|
10 |
+
$this->getTable('eurotext_translationmanager/project_emailtemplate_database')
|
11 |
+
)
|
12 |
+
->addColumn(
|
13 |
+
'emailtemplate_database_id',
|
14 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
15 |
+
10,
|
16 |
+
['primary' => true, 'unsigned' => true, 'nullable' => false, 'auto_increment' => true],
|
17 |
+
'Primary key'
|
18 |
+
)
|
19 |
+
->addColumn('project_id', Varien_Db_Ddl_Table::TYPE_BIGINT, 20, ['nullable' => false], 'FK on project')
|
20 |
+
->addColumn(
|
21 |
+
'emailtemplate_id',
|
22 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
23 |
+
null,
|
24 |
+
[
|
25 |
+
'unsigned' => true,
|
26 |
+
'nullable' => false,
|
27 |
+
],
|
28 |
+
'Emailtemplate ID'
|
29 |
+
)
|
30 |
+
->addColumn(
|
31 |
+
'created_at',
|
32 |
+
Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
|
33 |
+
null,
|
34 |
+
['default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT],
|
35 |
+
'Created at'
|
36 |
+
)->addForeignKey(
|
37 |
+
$this->getFkName(
|
38 |
+
$this->getTable('eurotext_translationmanager/project_emailtemplate_database'),
|
39 |
+
'project_id',
|
40 |
+
$this->getTable('eurotext_translationmanager/project'),
|
41 |
+
'id'
|
42 |
+
),
|
43 |
+
'project_id',
|
44 |
+
$this->getTable('eurotext_translationmanager/project'),
|
45 |
+
'id'
|
46 |
+
)->addForeignKey(
|
47 |
+
$this->getFkName(
|
48 |
+
$this->getTable('eurotext_translationmanager/project_emailtemplate_database'),
|
49 |
+
'emailtemplate_id',
|
50 |
+
$this->getTable('core/email_template'),
|
51 |
+
'template_id'
|
52 |
+
),
|
53 |
+
'emailtemplate_id',
|
54 |
+
$this->getTable('core/email_template'),
|
55 |
+
'template_id'
|
56 |
+
);
|
57 |
+
|
58 |
+
$connection->createTable($emailTemplateDatabase);
|
59 |
+
|
60 |
+
$this->endSetup();
|
@@ -0,0 +1,234 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Eurotext_Uploader_Block_Abstract extends Mage_Adminhtml_Block_Widget
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Template used for uploader
|
7 |
+
*
|
8 |
+
* @var string
|
9 |
+
*/
|
10 |
+
protected $_template = 'eurotext/uploader/media/uploader.phtml';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @var Eurotext_Uploader_Model_Config_Misc
|
14 |
+
*/
|
15 |
+
protected $_misc;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var Eurotext_Uploader_Model_Config_Uploader
|
19 |
+
*/
|
20 |
+
protected $_uploaderConfig;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var Eurotext_Uploader_Model_Config_Browsebutton
|
24 |
+
*/
|
25 |
+
protected $_browseButtonConfig;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var Eurotext_Uploader_Model_Config_Misc
|
29 |
+
*/
|
30 |
+
protected $_miscConfig;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var array
|
34 |
+
*/
|
35 |
+
protected $_idsMapping = [];
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Default browse button ID suffix
|
39 |
+
*/
|
40 |
+
const DEFAULT_BROWSE_BUTTON_ID_SUFFIX = 'browse';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Constructor for uploader block
|
44 |
+
*
|
45 |
+
* @see https://github.com/flowjs/flow.js/tree/v2.9.0#configuration
|
46 |
+
* @description Set unique id for block
|
47 |
+
*/
|
48 |
+
public function __construct()
|
49 |
+
{
|
50 |
+
parent::__construct();
|
51 |
+
$this->setId($this->getId() . '_Uploader');
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Helper for file manipulation
|
56 |
+
*
|
57 |
+
* @return Eurotext_Uploader_Helper_File
|
58 |
+
*/
|
59 |
+
protected function _getHelper()
|
60 |
+
{
|
61 |
+
return Mage::helper('eurotext_uploader/file');
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @return string
|
66 |
+
*/
|
67 |
+
public function getJsonConfig()
|
68 |
+
{
|
69 |
+
return $this->helper('core')->jsonEncode(
|
70 |
+
[
|
71 |
+
'uploaderConfig' => $this->getUploaderConfig()->getData(),
|
72 |
+
'elementIds' => $this->_getElementIdsMapping(),
|
73 |
+
'browseConfig' => $this->getButtonConfig()->getData(),
|
74 |
+
'miscConfig' => $this->getMiscConfig()->getData(),
|
75 |
+
]
|
76 |
+
);
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Get mapping of ids for front-end use
|
81 |
+
*
|
82 |
+
* @return array
|
83 |
+
*/
|
84 |
+
protected function _getElementIdsMapping()
|
85 |
+
{
|
86 |
+
return $this->_idsMapping;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Add mapping ids for front-end use
|
91 |
+
*
|
92 |
+
* @param array $additionalButtons
|
93 |
+
* @return $this
|
94 |
+
*/
|
95 |
+
protected function _addElementIdsMapping($additionalButtons = [])
|
96 |
+
{
|
97 |
+
$this->_idsMapping = array_merge($this->_idsMapping, $additionalButtons);
|
98 |
+
|
99 |
+
return $this;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Prepare layout, create buttons, set front-end elements ids
|
104 |
+
*
|
105 |
+
* @return Mage_Core_Block_Abstract
|
106 |
+
*/
|
107 |
+
protected function _prepareLayout()
|
108 |
+
{
|
109 |
+
$this->setChild(
|
110 |
+
'browse_button',
|
111 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
112 |
+
->addData(
|
113 |
+
[
|
114 |
+
// Workaround for IE9
|
115 |
+
'before_html' => sprintf(
|
116 |
+
'<div style="display:inline-block;" id="%s">',
|
117 |
+
$this->getElementId(self::DEFAULT_BROWSE_BUTTON_ID_SUFFIX)
|
118 |
+
),
|
119 |
+
'after_html' => '</div>',
|
120 |
+
'id' => $this->getElementId(self::DEFAULT_BROWSE_BUTTON_ID_SUFFIX . '_button'),
|
121 |
+
'label' => Mage::helper('eurotext_uploader')->__('Browse Files…'),
|
122 |
+
'type' => 'button',
|
123 |
+
]
|
124 |
+
)
|
125 |
+
);
|
126 |
+
|
127 |
+
$this->setChild(
|
128 |
+
'delete_button',
|
129 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
130 |
+
->addData(
|
131 |
+
[
|
132 |
+
'id' => '{{id}}',
|
133 |
+
'class' => 'delete',
|
134 |
+
'type' => 'button',
|
135 |
+
'label' => Mage::helper('eurotext_uploader')->__('Remove')
|
136 |
+
]
|
137 |
+
)
|
138 |
+
);
|
139 |
+
|
140 |
+
$this->_addElementIdsMapping(
|
141 |
+
[
|
142 |
+
'container' => $this->getHtmlId(),
|
143 |
+
'templateFile' => $this->getElementId('template'),
|
144 |
+
'browse' => $this->_prepareElementsIds([self::DEFAULT_BROWSE_BUTTON_ID_SUFFIX])
|
145 |
+
]
|
146 |
+
);
|
147 |
+
|
148 |
+
return parent::_prepareLayout();
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Get browse button html
|
153 |
+
*
|
154 |
+
* @return string
|
155 |
+
*/
|
156 |
+
public function getBrowseButtonHtml()
|
157 |
+
{
|
158 |
+
return $this->getChildHtml('browse_button');
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Get delete button html
|
163 |
+
*
|
164 |
+
* @return string
|
165 |
+
*/
|
166 |
+
public function getDeleteButtonHtml()
|
167 |
+
{
|
168 |
+
return $this->getChildHtml('delete_button');
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Get uploader misc settings
|
173 |
+
*
|
174 |
+
* @return Eurotext_Uploader_Model_Config_Misc
|
175 |
+
*/
|
176 |
+
public function getMiscConfig()
|
177 |
+
{
|
178 |
+
if (is_null($this->_miscConfig)) {
|
179 |
+
$this->_miscConfig = Mage::getModel('eurotext_uploader/config_misc');
|
180 |
+
}
|
181 |
+
|
182 |
+
return $this->_miscConfig;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Get uploader general settings
|
187 |
+
*
|
188 |
+
* @return Eurotext_Uploader_Model_Config_Uploader
|
189 |
+
*/
|
190 |
+
public function getUploaderConfig()
|
191 |
+
{
|
192 |
+
if (is_null($this->_uploaderConfig)) {
|
193 |
+
$this->_uploaderConfig = Mage::getModel('eurotext_uploader/config_uploader');
|
194 |
+
}
|
195 |
+
|
196 |
+
return $this->_uploaderConfig;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Get browse button settings
|
201 |
+
*
|
202 |
+
* @return Eurotext_Uploader_Model_Config_Browsebutton
|
203 |
+
*/
|
204 |
+
public function getButtonConfig()
|
205 |
+
{
|
206 |
+
if (is_null($this->_browseButtonConfig)) {
|
207 |
+
$this->_browseButtonConfig = Mage::getModel('eurotext_uploader/config_browsebutton');
|
208 |
+
}
|
209 |
+
|
210 |
+
return $this->_browseButtonConfig;
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Get button unique id
|
215 |
+
*
|
216 |
+
* @param string $suffix
|
217 |
+
* @return string
|
218 |
+
*/
|
219 |
+
public function getElementId($suffix)
|
220 |
+
{
|
221 |
+
return $this->getHtmlId() . '-' . $suffix;
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Prepare actual elements ids from suffixes
|
226 |
+
*
|
227 |
+
* @param array $targets $type => array($idsSuffixes)
|
228 |
+
* @return array $type => array($htmlIds)
|
229 |
+
*/
|
230 |
+
protected function _prepareElementsIds($targets)
|
231 |
+
{
|
232 |
+
return array_map([$this, 'getElementId'], array_unique(array_values($targets)));
|
233 |
+
}
|
234 |
+
}
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_Uploader_Block_Single extends Eurotext_Uploader_Block_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Prepare layout, change button and set front-end element ids mapping
|
7 |
+
*
|
8 |
+
* @return Mage_Core_Block_Abstract
|
9 |
+
*/
|
10 |
+
protected function _prepareLayout()
|
11 |
+
{
|
12 |
+
parent::_prepareLayout();
|
13 |
+
$this->getChild('browse_button')->setLabel(Mage::helper('eurotext_uploader')->__('…'));
|
14 |
+
|
15 |
+
return $this;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Constructor for single uploader block
|
20 |
+
*/
|
21 |
+
public function __construct()
|
22 |
+
{
|
23 |
+
parent::__construct();
|
24 |
+
|
25 |
+
$this->getUploaderConfig()->setSingleFile(true);
|
26 |
+
$this->getButtonConfig()->setSingleFile(true);
|
27 |
+
}
|
28 |
+
}
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_Uploader_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
@@ -0,0 +1,728 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eurotext_Uploader_Helper_File extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* List of pre-defined MIME types
|
7 |
+
*
|
8 |
+
* @var array
|
9 |
+
*/
|
10 |
+
protected $_mimeTypes =
|
11 |
+
[
|
12 |
+
'x123' => 'application/vnd.lotus-1-2-3',
|
13 |
+
'x3dml' => 'text/vnd.in3d.3dml',
|
14 |
+
'x3g2' => 'video/3gpp2',
|
15 |
+
'x3gp' => 'video/3gpp',
|
16 |
+
'xace' => 'application/x-ace-compressed',
|
17 |
+
'xacu' => 'application/vnd.acucobol',
|
18 |
+
'xaep' => 'application/vnd.audiograph',
|
19 |
+
'xai' => 'application/postscript',
|
20 |
+
'xaif' => 'audio/x-aiff',
|
21 |
+
|
22 |
+
'xaifc' => 'audio/x-aiff',
|
23 |
+
'xaiff' => 'audio/x-aiff',
|
24 |
+
'xami' => 'application/vnd.amiga.ami',
|
25 |
+
'xapr' => 'application/vnd.lotus-approach',
|
26 |
+
'xasf' => 'video/x-ms-asf',
|
27 |
+
'xaso' => 'application/vnd.accpac.simply.aso',
|
28 |
+
'xasx' => 'video/x-ms-asf',
|
29 |
+
'xatom' => 'application/atom+xml',
|
30 |
+
'xatomcat' => 'application/atomcat+xml',
|
31 |
+
|
32 |
+
'xatomsvc' => 'application/atomsvc+xml',
|
33 |
+
'xatx' => 'application/vnd.antix.game-component',
|
34 |
+
'xau' => 'audio/basic',
|
35 |
+
'xavi' => 'video/x-msvideo',
|
36 |
+
'xbat' => 'application/x-msdownload',
|
37 |
+
'xbcpio' => 'application/x-bcpio',
|
38 |
+
'xbdm' => 'application/vnd.syncml.dm+wbxml',
|
39 |
+
'xbh2' => 'application/vnd.fujitsu.oasysprs',
|
40 |
+
'xbmi' => 'application/vnd.bmi',
|
41 |
+
|
42 |
+
'xbmp' => 'ieurotext/bmp',
|
43 |
+
'xbox' => 'application/vnd.previewsystems.box',
|
44 |
+
'xboz' => 'application/x-bzip2',
|
45 |
+
'xbtif' => 'ieurotext/prs.btif',
|
46 |
+
'xbz' => 'application/x-bzip',
|
47 |
+
'xbz2' => 'application/x-bzip2',
|
48 |
+
'xcab' => 'application/vnd.ms-cab-compressed',
|
49 |
+
'xccxml' => 'application/ccxml+xml',
|
50 |
+
'xcdbcmsg' => 'application/vnd.contact.cmsg',
|
51 |
+
|
52 |
+
'xcdkey' => 'application/vnd.mediastation.cdkey',
|
53 |
+
'xcdx' => 'chemical/x-cdx',
|
54 |
+
'xcdxml' => 'application/vnd.chemdraw+xml',
|
55 |
+
'xcdy' => 'application/vnd.cinderella',
|
56 |
+
'xcer' => 'application/pkix-cert',
|
57 |
+
'xcgm' => 'ieurotext/cgm',
|
58 |
+
'xchat' => 'application/x-chat',
|
59 |
+
'xchm' => 'application/vnd.ms-htmlhelp',
|
60 |
+
'xchrt' => 'application/vnd.kde.kchart',
|
61 |
+
|
62 |
+
'xcif' => 'chemical/x-cif',
|
63 |
+
'xcii' => 'application/vnd.anser-web-certificate-issue-initiation',
|
64 |
+
'xcil' => 'application/vnd.ms-artgalry',
|
65 |
+
'xcla' => 'application/vnd.claymore',
|
66 |
+
'xclkk' => 'application/vnd.crick.clicker.keyboard',
|
67 |
+
'xclkp' => 'application/vnd.crick.clicker.palette',
|
68 |
+
'xclkt' => 'application/vnd.crick.clicker.template',
|
69 |
+
'xclkw' => 'application/vnd.crick.clicker.wordbank',
|
70 |
+
'xclkx' => 'application/vnd.crick.clicker',
|
71 |
+
|
72 |
+
'xclp' => 'application/x-msclip',
|
73 |
+
'xcmc' => 'application/vnd.cosmocaller',
|
74 |
+
'xcmdf' => 'chemical/x-cmdf',
|
75 |
+
'xcml' => 'chemical/x-cml',
|
76 |
+
'xcmp' => 'application/vnd.yellowriver-custom-menu',
|
77 |
+
'xcmx' => 'ieurotext/x-cmx',
|
78 |
+
'xcom' => 'application/x-msdownload',
|
79 |
+
'xconf' => 'text/plain',
|
80 |
+
'xcpio' => 'application/x-cpio',
|
81 |
+
|
82 |
+
'xcpt' => 'application/mac-compactpro',
|
83 |
+
'xcrd' => 'application/x-mscardfile',
|
84 |
+
'xcrl' => 'application/pkix-crl',
|
85 |
+
'xcrt' => 'application/x-x509-ca-cert',
|
86 |
+
'xcsh' => 'application/x-csh',
|
87 |
+
'xcsml' => 'chemical/x-csml',
|
88 |
+
'xcss' => 'text/css',
|
89 |
+
'xcsv' => 'text/csv',
|
90 |
+
'xcurl' => 'application/vnd.curl',
|
91 |
+
|
92 |
+
'xcww' => 'application/prs.cww',
|
93 |
+
'xdaf' => 'application/vnd.mobius.daf',
|
94 |
+
'xdavmount' => 'application/davmount+xml',
|
95 |
+
'xdd2' => 'application/vnd.oma.dd2+xml',
|
96 |
+
'xddd' => 'application/vnd.fujixerox.ddd',
|
97 |
+
'xdef' => 'text/plain',
|
98 |
+
'xder' => 'application/x-x509-ca-cert',
|
99 |
+
'xdfac' => 'application/vnd.dreamfactory',
|
100 |
+
'xdis' => 'application/vnd.mobius.dis',
|
101 |
+
|
102 |
+
'xdjv' => 'ieurotext/vnd.djvu',
|
103 |
+
'xdjvu' => 'ieurotext/vnd.djvu',
|
104 |
+
'xdll' => 'application/x-msdownload',
|
105 |
+
'xdna' => 'application/vnd.dna',
|
106 |
+
'xdoc' => 'application/msword',
|
107 |
+
'xdot' => 'application/msword',
|
108 |
+
'xdp' => 'application/vnd.osgi.dp',
|
109 |
+
'xdpg' => 'application/vnd.dpgraph',
|
110 |
+
'xdsc' => 'text/prs.lines.tag',
|
111 |
+
|
112 |
+
'xdtd' => 'application/xml-dtd',
|
113 |
+
'xdvi' => 'application/x-dvi',
|
114 |
+
'xdwf' => 'model/vnd.dwf',
|
115 |
+
'xdwg' => 'ieurotext/vnd.dwg',
|
116 |
+
'xdxf' => 'ieurotext/vnd.dxf',
|
117 |
+
'xdxp' => 'application/vnd.spotfire.dxp',
|
118 |
+
'xecelp4800' => 'audio/vnd.nuera.ecelp4800',
|
119 |
+
'xecelp7470' => 'audio/vnd.nuera.ecelp7470',
|
120 |
+
'xecelp9600' => 'audio/vnd.nuera.ecelp9600',
|
121 |
+
|
122 |
+
'xecma' => 'application/ecmascript',
|
123 |
+
'xedm' => 'application/vnd.novadigm.edm',
|
124 |
+
'xedx' => 'application/vnd.novadigm.edx',
|
125 |
+
'xefif' => 'application/vnd.picsel',
|
126 |
+
'xei6' => 'application/vnd.pg.osasli',
|
127 |
+
'xeml' => 'message/rfc822',
|
128 |
+
'xeol' => 'audio/vnd.digital-winds',
|
129 |
+
'xeot' => 'application/vnd.ms-fontobject',
|
130 |
+
'xeps' => 'application/postscript',
|
131 |
+
|
132 |
+
'xesf' => 'application/vnd.epson.esf',
|
133 |
+
'xetx' => 'text/x-setext',
|
134 |
+
'xexe' => 'application/x-msdownload',
|
135 |
+
'xext' => 'application/vnd.novadigm.ext',
|
136 |
+
'xez' => 'application/andrew-inset',
|
137 |
+
'xez2' => 'application/vnd.ezpix-album',
|
138 |
+
'xez3' => 'application/vnd.ezpix-package',
|
139 |
+
'xfbs' => 'ieurotext/vnd.fastbidsheet',
|
140 |
+
'xfdf' => 'application/vnd.fdf',
|
141 |
+
|
142 |
+
'xfe_launch' => 'application/vnd.denovo.fcselayout-link',
|
143 |
+
'xfg5' => 'application/vnd.fujitsu.oasysgp',
|
144 |
+
'xfli' => 'video/x-fli',
|
145 |
+
'xflo' => 'application/vnd.micrografx.flo',
|
146 |
+
'xflw' => 'application/vnd.kde.kivio',
|
147 |
+
'xflx' => 'text/vnd.fmi.flexstor',
|
148 |
+
'xfly' => 'text/vnd.fly',
|
149 |
+
'xfnc' => 'application/vnd.frogans.fnc',
|
150 |
+
'xfpx' => 'ieurotext/vnd.fpx',
|
151 |
+
|
152 |
+
'xfsc' => 'application/vnd.fsc.weblaunch',
|
153 |
+
'xfst' => 'ieurotext/vnd.fst',
|
154 |
+
'xftc' => 'application/vnd.fluxtime.clip',
|
155 |
+
'xfti' => 'application/vnd.anser-web-funds-transfer-initiation',
|
156 |
+
'xfvt' => 'video/vnd.fvt',
|
157 |
+
'xfzs' => 'application/vnd.fuzzysheet',
|
158 |
+
'xg3' => 'ieurotext/g3fax',
|
159 |
+
'xgac' => 'application/vnd.groove-account',
|
160 |
+
'xgdl' => 'model/vnd.gdl',
|
161 |
+
|
162 |
+
'xghf' => 'application/vnd.groove-help',
|
163 |
+
'xgif' => 'ieurotext/gif',
|
164 |
+
'xgim' => 'application/vnd.groove-identity-message',
|
165 |
+
'xgph' => 'application/vnd.flographit',
|
166 |
+
'xgram' => 'application/srgs',
|
167 |
+
'xgrv' => 'application/vnd.groove-injector',
|
168 |
+
'xgrxml' => 'application/srgs+xml',
|
169 |
+
'xgtar' => 'application/x-gtar',
|
170 |
+
'xgtm' => 'application/vnd.groove-tool-message',
|
171 |
+
|
172 |
+
'xsvg' => 'ieurotext/svg+xml',
|
173 |
+
|
174 |
+
'xgtw' => 'model/vnd.gtw',
|
175 |
+
'xh261' => 'video/h261',
|
176 |
+
'xh263' => 'video/h263',
|
177 |
+
'xh264' => 'video/h264',
|
178 |
+
'xhbci' => 'application/vnd.hbci',
|
179 |
+
'xhdf' => 'application/x-hdf',
|
180 |
+
'xhlp' => 'application/winhlp',
|
181 |
+
'xhpgl' => 'application/vnd.hp-hpgl',
|
182 |
+
'xhpid' => 'application/vnd.hp-hpid',
|
183 |
+
|
184 |
+
'xhps' => 'application/vnd.hp-hps',
|
185 |
+
'xhqx' => 'application/mac-binhex40',
|
186 |
+
'xhtke' => 'application/vnd.kenameaapp',
|
187 |
+
'xhtm' => 'text/html',
|
188 |
+
'xhtml' => 'text/html',
|
189 |
+
'xhvd' => 'application/vnd.yamaha.hv-dic',
|
190 |
+
'xhvp' => 'application/vnd.yamaha.hv-voice',
|
191 |
+
'xhvs' => 'application/vnd.yamaha.hv-script',
|
192 |
+
'xice' => '#x-conference/x-cooltalk',
|
193 |
+
|
194 |
+
'xico' => 'ieurotext/x-icon',
|
195 |
+
'xics' => 'text/calendar',
|
196 |
+
'xief' => 'ieurotext/ief',
|
197 |
+
'xifb' => 'text/calendar',
|
198 |
+
'xifm' => 'application/vnd.shana.informed.formdata',
|
199 |
+
'xigl' => 'application/vnd.igloader',
|
200 |
+
'xigx' => 'application/vnd.micrografx.igx',
|
201 |
+
'xiif' => 'application/vnd.shana.informed.interchange',
|
202 |
+
'ximp' => 'application/vnd.accpac.simply.imp',
|
203 |
+
|
204 |
+
'xims' => 'application/vnd.ms-ims',
|
205 |
+
'xin' => 'text/plain',
|
206 |
+
'xipk' => 'application/vnd.shana.informed.package',
|
207 |
+
'xirm' => 'application/vnd.ibm.rights-management',
|
208 |
+
'xirp' => 'application/vnd.irepository.package+xml',
|
209 |
+
'xitp' => 'application/vnd.shana.informed.formtemplate',
|
210 |
+
'xivp' => 'application/vnd.immervision-ivp',
|
211 |
+
'xivu' => 'application/vnd.immervision-ivu',
|
212 |
+
'xjad' => 'text/vnd.sun.j2me.app-descriptor',
|
213 |
+
|
214 |
+
'xjam' => 'application/vnd.jam',
|
215 |
+
'xjava' => 'text/x-java-source',
|
216 |
+
'xjisp' => 'application/vnd.jisp',
|
217 |
+
'xjlt' => 'application/vnd.hp-jlyt',
|
218 |
+
'xjoda' => 'application/vnd.joost.joda-archive',
|
219 |
+
'xjpe' => 'ieurotext/jpeg',
|
220 |
+
'xjpeg' => 'ieurotext/jpeg',
|
221 |
+
'xjpg' => 'ieurotext/jpeg',
|
222 |
+
'xjpgm' => 'video/jpm',
|
223 |
+
|
224 |
+
'xjpgv' => 'video/jpeg',
|
225 |
+
'xjpm' => 'video/jpm',
|
226 |
+
'xjs' => 'application/javascript',
|
227 |
+
'xjson' => 'application/json',
|
228 |
+
'xkar' => 'audio/midi',
|
229 |
+
'xkarbon' => 'application/vnd.kde.karbon',
|
230 |
+
'xkfo' => 'application/vnd.kde.kformula',
|
231 |
+
'xkia' => 'application/vnd.kidspiration',
|
232 |
+
'xkml' => 'application/vnd.google-earth.kml+xml',
|
233 |
+
|
234 |
+
'xkmz' => 'application/vnd.google-earth.kmz',
|
235 |
+
'xkon' => 'application/vnd.kde.kontour',
|
236 |
+
'xksp' => 'application/vnd.kde.kspread',
|
237 |
+
'xlatex' => 'application/x-latex',
|
238 |
+
'xlbd' => 'application/vnd.llamagraphics.life-balance.desktop',
|
239 |
+
'xlbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml',
|
240 |
+
'xles' => 'application/vnd.hhe.lesson-player',
|
241 |
+
'xlist' => 'text/plain',
|
242 |
+
'xlog' => 'text/plain',
|
243 |
+
|
244 |
+
'xlrm' => 'application/vnd.ms-lrm',
|
245 |
+
'xltf' => 'application/vnd.frogans.ltf',
|
246 |
+
'xlvp' => 'audio/vnd.lucent.voice',
|
247 |
+
'xlwp' => 'application/vnd.lotus-wordpro',
|
248 |
+
'xm13' => 'application/x-msmediaview',
|
249 |
+
'xm14' => 'application/x-msmediaview',
|
250 |
+
'xm1v' => 'video/mpeg',
|
251 |
+
'xm2a' => 'audio/mpeg',
|
252 |
+
'xm3a' => 'audio/mpeg',
|
253 |
+
|
254 |
+
'xm3u' => 'audio/x-mpegurl',
|
255 |
+
'xm4u' => 'video/vnd.mpegurl',
|
256 |
+
'xmag' => 'application/vnd.ecowin.chart',
|
257 |
+
'xmathml' => 'application/mathml+xml',
|
258 |
+
'xmbk' => 'application/vnd.mobius.mbk',
|
259 |
+
'xmbox' => 'application/mbox',
|
260 |
+
'xmc1' => 'application/vnd.medcalcdata',
|
261 |
+
'xmcd' => 'application/vnd.mcd',
|
262 |
+
'xmdb' => 'application/x-msaccess',
|
263 |
+
|
264 |
+
'xmdi' => 'ieurotext/vnd.ms-modi',
|
265 |
+
'xmesh' => 'model/mesh',
|
266 |
+
'xmfm' => 'application/vnd.mfmp',
|
267 |
+
'xmgz' => 'application/vnd.proteus.magazine',
|
268 |
+
'xmid' => 'audio/midi',
|
269 |
+
'xmidi' => 'audio/midi',
|
270 |
+
'xmif' => 'application/vnd.mif',
|
271 |
+
'xmime' => 'message/rfc822',
|
272 |
+
'xmj2' => 'video/mj2',
|
273 |
+
|
274 |
+
'xmjp2' => 'video/mj2',
|
275 |
+
'xmlp' => 'application/vnd.dolby.mlp',
|
276 |
+
'xmmd' => 'application/vnd.chipnuts.karaoke-mmd',
|
277 |
+
'xmmf' => 'application/vnd.smaf',
|
278 |
+
'xmmr' => 'ieurotext/vnd.fujixerox.edmics-mmr',
|
279 |
+
'xmny' => 'application/x-msmoney',
|
280 |
+
'xmov' => 'video/quicktime',
|
281 |
+
'xmovie' => 'video/x-sgi-movie',
|
282 |
+
'xmp2' => 'audio/mpeg',
|
283 |
+
|
284 |
+
'xmp2a' => 'audio/mpeg',
|
285 |
+
'xmp3' => 'audio/mpeg',
|
286 |
+
'xmp4' => 'video/mp4',
|
287 |
+
'xmp4a' => 'audio/mp4',
|
288 |
+
'xmp4s' => 'application/mp4',
|
289 |
+
'xmp4v' => 'video/mp4',
|
290 |
+
'xmpc' => 'application/vnd.mophun.certificate',
|
291 |
+
'xmpe' => 'video/mpeg',
|
292 |
+
'xmpeg' => 'video/mpeg',
|
293 |
+
|
294 |
+
'xmpg' => 'video/mpeg',
|
295 |
+
'xmpg4' => 'video/mp4',
|
296 |
+
'xmpga' => 'audio/mpeg',
|
297 |
+
'xmpkg' => 'application/vnd.apple.installer+xml',
|
298 |
+
'xmpm' => 'application/vnd.blueice.multipass',
|
299 |
+
'xmpn' => 'application/vnd.mophun.application',
|
300 |
+
'xmpp' => 'application/vnd.ms-project',
|
301 |
+
'xmpt' => 'application/vnd.ms-project',
|
302 |
+
'xmpy' => 'application/vnd.ibm.minipay',
|
303 |
+
|
304 |
+
'xmqy' => 'application/vnd.mobius.mqy',
|
305 |
+
'xmrc' => 'application/marc',
|
306 |
+
'xmscml' => 'application/mediaservercontrol+xml',
|
307 |
+
'xmseq' => 'application/vnd.mseq',
|
308 |
+
'xmsf' => 'application/vnd.epson.msf',
|
309 |
+
'xmsh' => 'model/mesh',
|
310 |
+
'xmsi' => 'application/x-msdownload',
|
311 |
+
'xmsl' => 'application/vnd.mobius.msl',
|
312 |
+
'xmsty' => 'application/vnd.muvee.style',
|
313 |
+
|
314 |
+
'xmts' => 'model/vnd.mts',
|
315 |
+
'xmus' => 'application/vnd.musician',
|
316 |
+
'xmvb' => 'application/x-msmediaview',
|
317 |
+
'xmwf' => 'application/vnd.mfer',
|
318 |
+
'xmxf' => 'application/mxf',
|
319 |
+
'xmxl' => 'application/vnd.recordare.musicxml',
|
320 |
+
'xmxml' => 'application/xv+xml',
|
321 |
+
'xmxs' => 'application/vnd.triscape.mxs',
|
322 |
+
'xmxu' => 'video/vnd.mpegurl',
|
323 |
+
|
324 |
+
'xn-gage' => 'application/vnd.nokia.n-gage.symbian.install',
|
325 |
+
'xngdat' => 'application/vnd.nokia.n-gage.data',
|
326 |
+
'xnlu' => 'application/vnd.neurolanguage.nlu',
|
327 |
+
'xnml' => 'application/vnd.enliven',
|
328 |
+
'xnnd' => 'application/vnd.noblenet-directory',
|
329 |
+
'xnns' => 'application/vnd.noblenet-sealer',
|
330 |
+
'xnnw' => 'application/vnd.noblenet-web',
|
331 |
+
'xnpx' => 'ieurotext/vnd.net-fpx',
|
332 |
+
'xnsf' => 'application/vnd.lotus-notes',
|
333 |
+
|
334 |
+
'xoa2' => 'application/vnd.fujitsu.oasys2',
|
335 |
+
'xoa3' => 'application/vnd.fujitsu.oasys3',
|
336 |
+
'xoas' => 'application/vnd.fujitsu.oasys',
|
337 |
+
'xobd' => 'application/x-msbinder',
|
338 |
+
'xoda' => 'application/oda',
|
339 |
+
'xodc' => 'application/vnd.oasis.opendocument.chart',
|
340 |
+
'xodf' => 'application/vnd.oasis.opendocument.formula',
|
341 |
+
'xodg' => 'application/vnd.oasis.opendocument.graphics',
|
342 |
+
'xodi' => 'application/vnd.oasis.opendocument.ieurotext',
|
343 |
+
|
344 |
+
'xodp' => 'application/vnd.oasis.opendocument.presentation',
|
345 |
+
'xods' => 'application/vnd.oasis.opendocument.spreadsheet',
|
346 |
+
'xodt' => 'application/vnd.oasis.opendocument.text',
|
347 |
+
'xogg' => 'application/ogg',
|
348 |
+
'xoprc' => 'application/vnd.palm',
|
349 |
+
'xorg' => 'application/vnd.lotus-organizer',
|
350 |
+
'xotc' => 'application/vnd.oasis.opendocument.chart-template',
|
351 |
+
'xotf' => 'application/vnd.oasis.opendocument.formula-template',
|
352 |
+
'xotg' => 'application/vnd.oasis.opendocument.graphics-template',
|
353 |
+
|
354 |
+
'xoth' => 'application/vnd.oasis.opendocument.text-web',
|
355 |
+
'xoti' => 'application/vnd.oasis.opendocument.ieurotext-template',
|
356 |
+
'xotm' => 'application/vnd.oasis.opendocument.text-master',
|
357 |
+
'xots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
|
358 |
+
'xott' => 'application/vnd.oasis.opendocument.text-template',
|
359 |
+
'xoxt' => 'application/vnd.openofficeorg.extension',
|
360 |
+
'xp10' => 'application/pkcs10',
|
361 |
+
'xp7r' => 'application/x-pkcs7-certreqresp',
|
362 |
+
'xp7s' => 'application/pkcs7-signature',
|
363 |
+
|
364 |
+
'xpbd' => 'application/vnd.powerbuilder6',
|
365 |
+
'xpbm' => 'ieurotext/x-portable-bitmap',
|
366 |
+
'xpcl' => 'application/vnd.hp-pcl',
|
367 |
+
'xpclxl' => 'application/vnd.hp-pclxl',
|
368 |
+
'xpct' => 'ieurotext/x-pict',
|
369 |
+
'xpcx' => 'ieurotext/x-pcx',
|
370 |
+
'xpdb' => 'chemical/x-pdb',
|
371 |
+
'xpdf' => 'application/pdf',
|
372 |
+
'xpfr' => 'application/font-tdpfr',
|
373 |
+
|
374 |
+
'xpgm' => 'ieurotext/x-portable-graymap',
|
375 |
+
'xpgn' => 'application/x-chess-pgn',
|
376 |
+
'xpgp' => 'application/pgp-encrypted',
|
377 |
+
'xpic' => 'ieurotext/x-pict',
|
378 |
+
'xpki' => 'application/pkixcmp',
|
379 |
+
'xpkipath' => 'application/pkix-pkipath',
|
380 |
+
'xplb' => 'application/vnd.3gpp.pic-bw-large',
|
381 |
+
'xplc' => 'application/vnd.mobius.plc',
|
382 |
+
'xplf' => 'application/vnd.pocketlearn',
|
383 |
+
|
384 |
+
'xpls' => 'application/pls+xml',
|
385 |
+
'xpml' => 'application/vnd.ctc-posml',
|
386 |
+
'xpng' => 'ieurotext/png',
|
387 |
+
'xpnm' => 'ieurotext/x-portable-anymap',
|
388 |
+
'xportpkg' => 'application/vnd.macports.portpkg',
|
389 |
+
'xpot' => 'application/vnd.ms-powerpoint',
|
390 |
+
'xppd' => 'application/vnd.cups-ppd',
|
391 |
+
'xppm' => 'ieurotext/x-portable-pixmap',
|
392 |
+
'xpps' => 'application/vnd.ms-powerpoint',
|
393 |
+
|
394 |
+
'xppt' => 'application/vnd.ms-powerpoint',
|
395 |
+
'xpqa' => 'application/vnd.palm',
|
396 |
+
'xprc' => 'application/vnd.palm',
|
397 |
+
'xpre' => 'application/vnd.lotus-freelance',
|
398 |
+
'xprf' => 'application/pics-rules',
|
399 |
+
'xps' => 'application/postscript',
|
400 |
+
'xpsb' => 'application/vnd.3gpp.pic-bw-small',
|
401 |
+
'xpsd' => 'ieurotext/vnd.adobe.photoshop',
|
402 |
+
'xptid' => 'application/vnd.pvi.ptid1',
|
403 |
+
|
404 |
+
'xpub' => 'application/x-mspublisher',
|
405 |
+
'xpvb' => 'application/vnd.3gpp.pic-bw-var',
|
406 |
+
'xpwn' => 'application/vnd.3m.post-it-notes',
|
407 |
+
'xqam' => 'application/vnd.epson.quickanime',
|
408 |
+
'xqbo' => 'application/vnd.intu.qbo',
|
409 |
+
'xqfx' => 'application/vnd.intu.qfx',
|
410 |
+
'xqps' => 'application/vnd.publishare-delta-tree',
|
411 |
+
'xqt' => 'video/quicktime',
|
412 |
+
'xra' => 'audio/x-pn-realaudio',
|
413 |
+
|
414 |
+
'xram' => 'audio/x-pn-realaudio',
|
415 |
+
'xrar' => 'application/x-rar-compressed',
|
416 |
+
'xras' => 'ieurotext/x-cmu-raster',
|
417 |
+
'xrcprofile' => 'application/vnd.ipunplugged.rcprofile',
|
418 |
+
'xrdf' => 'application/rdf+xml',
|
419 |
+
'xrdz' => 'application/vnd.data-vision.rdz',
|
420 |
+
'xrep' => 'application/vnd.businessobjects',
|
421 |
+
'xrgb' => 'ieurotext/x-rgb',
|
422 |
+
'xrif' => 'application/reginfo+xml',
|
423 |
+
|
424 |
+
'xrl' => 'application/resource-lists+xml',
|
425 |
+
'xrlc' => 'ieurotext/vnd.fujixerox.edmics-rlc',
|
426 |
+
'xrm' => 'application/vnd.rn-realmedia',
|
427 |
+
'xrmi' => 'audio/midi',
|
428 |
+
'xrmp' => 'audio/x-pn-realaudio-plugin',
|
429 |
+
'xrms' => 'application/vnd.jcp.javame.midlet-rms',
|
430 |
+
'xrnc' => 'application/relax-ng-compact-syntax',
|
431 |
+
'xrpss' => 'application/vnd.nokia.radio-presets',
|
432 |
+
'xrpst' => 'application/vnd.nokia.radio-preset',
|
433 |
+
|
434 |
+
'xrq' => 'application/sparql-query',
|
435 |
+
'xrs' => 'application/rls-services+xml',
|
436 |
+
'xrsd' => 'application/rsd+xml',
|
437 |
+
'xrss' => 'application/rss+xml',
|
438 |
+
'xrtf' => 'application/rtf',
|
439 |
+
'xrtx' => 'text/richtext',
|
440 |
+
'xsaf' => 'application/vnd.yamaha.smaf-audio',
|
441 |
+
'xsbml' => 'application/sbml+xml',
|
442 |
+
'xsc' => 'application/vnd.ibm.secure-container',
|
443 |
+
|
444 |
+
'xscd' => 'application/x-msschedule',
|
445 |
+
'xscm' => 'application/vnd.lotus-screencam',
|
446 |
+
'xscq' => 'application/scvp-cv-request',
|
447 |
+
'xscs' => 'application/scvp-cv-response',
|
448 |
+
'xsdp' => 'application/sdp',
|
449 |
+
'xsee' => 'application/vnd.seemail',
|
450 |
+
'xsema' => 'application/vnd.sema',
|
451 |
+
'xsemd' => 'application/vnd.semd',
|
452 |
+
'xsemf' => 'application/vnd.semf',
|
453 |
+
|
454 |
+
'xsetpay' => 'application/set-payment-initiation',
|
455 |
+
'xsetreg' => 'application/set-registration-initiation',
|
456 |
+
'xsfs' => 'application/vnd.spotfire.sfs',
|
457 |
+
'xsgm' => 'text/sgml',
|
458 |
+
'xsgml' => 'text/sgml',
|
459 |
+
'xsh' => 'application/x-sh',
|
460 |
+
'xshar' => 'application/x-shar',
|
461 |
+
'xshf' => 'application/shf+xml',
|
462 |
+
'xsilo' => 'model/mesh',
|
463 |
+
|
464 |
+
'xsit' => 'application/x-stuffit',
|
465 |
+
'xsitx' => 'application/x-stuffitx',
|
466 |
+
'xslt' => 'application/vnd.epson.salt',
|
467 |
+
'xsnd' => 'audio/basic',
|
468 |
+
'xspf' => 'application/vnd.yamaha.smaf-phrase',
|
469 |
+
'xspl' => 'application/x-futuresplash',
|
470 |
+
'xspot' => 'text/vnd.in3d.spot',
|
471 |
+
'xspp' => 'application/scvp-vp-response',
|
472 |
+
'xspq' => 'application/scvp-vp-request',
|
473 |
+
|
474 |
+
'xsrc' => 'application/x-wais-source',
|
475 |
+
'xsrx' => 'application/sparql-results+xml',
|
476 |
+
'xssf' => 'application/vnd.epson.ssf',
|
477 |
+
'xssml' => 'application/ssml+xml',
|
478 |
+
'xstf' => 'application/vnd.wt.stf',
|
479 |
+
'xstk' => 'application/hyperstudio',
|
480 |
+
'xstr' => 'application/vnd.pg.format',
|
481 |
+
'xsus' => 'application/vnd.sus-calendar',
|
482 |
+
'xsusp' => 'application/vnd.sus-calendar',
|
483 |
+
|
484 |
+
'xsv4cpio' => 'application/x-sv4cpio',
|
485 |
+
'xsv4crc' => 'application/x-sv4crc',
|
486 |
+
'xsvd' => 'application/vnd.svd',
|
487 |
+
'xswf' => 'application/x-shockwave-flash',
|
488 |
+
'xtao' => 'application/vnd.tao.intent-module-archive',
|
489 |
+
'xtar' => 'application/x-tar',
|
490 |
+
'xtcap' => 'application/vnd.3gpp2.tcap',
|
491 |
+
'xtcl' => 'application/x-tcl',
|
492 |
+
'xtex' => 'application/x-tex',
|
493 |
+
|
494 |
+
'xtext' => 'text/plain',
|
495 |
+
'xtif' => 'ieurotext/tiff',
|
496 |
+
'xtiff' => 'ieurotext/tiff',
|
497 |
+
'xtmo' => 'application/vnd.tmobile-livetv',
|
498 |
+
'xtorrent' => 'application/x-bittorrent',
|
499 |
+
'xtpl' => 'application/vnd.groove-tool-template',
|
500 |
+
'xtpt' => 'application/vnd.trid.tpt',
|
501 |
+
'xtra' => 'application/vnd.trueapp',
|
502 |
+
'xtrm' => 'application/x-msterminal',
|
503 |
+
|
504 |
+
'xtsv' => 'text/tab-separated-values',
|
505 |
+
'xtxd' => 'application/vnd.genomatix.tuxedo',
|
506 |
+
'xtxf' => 'application/vnd.mobius.txf',
|
507 |
+
'xtxt' => 'text/plain',
|
508 |
+
'xumj' => 'application/vnd.umajin',
|
509 |
+
'xunityweb' => 'application/vnd.unity',
|
510 |
+
'xuoml' => 'application/vnd.uoml+xml',
|
511 |
+
'xuri' => 'text/uri-list',
|
512 |
+
'xuris' => 'text/uri-list',
|
513 |
+
|
514 |
+
'xurls' => 'text/uri-list',
|
515 |
+
'xustar' => 'application/x-ustar',
|
516 |
+
'xutz' => 'application/vnd.uiq.theme',
|
517 |
+
'xuu' => 'text/x-uuencode',
|
518 |
+
'xvcd' => 'application/x-cdlink',
|
519 |
+
'xvcf' => 'text/x-vcard',
|
520 |
+
'xvcg' => 'application/vnd.groove-vcard',
|
521 |
+
'xvcs' => 'text/x-vcalendar',
|
522 |
+
'xvcx' => 'application/vnd.vcx',
|
523 |
+
|
524 |
+
'xvis' => 'application/vnd.visionary',
|
525 |
+
'xviv' => 'video/vnd.vivo',
|
526 |
+
'xvrml' => 'model/vrml',
|
527 |
+
'xvsd' => 'application/vnd.visio',
|
528 |
+
'xvsf' => 'application/vnd.vsf',
|
529 |
+
'xvss' => 'application/vnd.visio',
|
530 |
+
'xvst' => 'application/vnd.visio',
|
531 |
+
'xvsw' => 'application/vnd.visio',
|
532 |
+
'xvtu' => 'model/vnd.vtu',
|
533 |
+
|
534 |
+
'xvxml' => 'application/voicexml+xml',
|
535 |
+
'xwav' => 'audio/x-wav',
|
536 |
+
'xwax' => 'audio/x-ms-wax',
|
537 |
+
'xwbmp' => 'ieurotext/vnd.wap.wbmp',
|
538 |
+
'xwbs' => 'application/vnd.criticaltools.wbs+xml',
|
539 |
+
'xwbxml' => 'application/vnd.wap.wbxml',
|
540 |
+
'xwcm' => 'application/vnd.ms-works',
|
541 |
+
'xwdb' => 'application/vnd.ms-works',
|
542 |
+
'xwks' => 'application/vnd.ms-works',
|
543 |
+
|
544 |
+
'xwm' => 'video/x-ms-wm',
|
545 |
+
'xwma' => 'audio/x-ms-wma',
|
546 |
+
'xwmd' => 'application/x-ms-wmd',
|
547 |
+
'xwmf' => 'application/x-msmetafile',
|
548 |
+
'xwml' => 'text/vnd.wap.wml',
|
549 |
+
'xwmlc' => 'application/vnd.wap.wmlc',
|
550 |
+
'xwmls' => 'text/vnd.wap.wmlscript',
|
551 |
+
'xwmlsc' => 'application/vnd.wap.wmlscriptc',
|
552 |
+
'xwmv' => 'video/x-ms-wmv',
|
553 |
+
|
554 |
+
'xwmx' => 'video/x-ms-wmx',
|
555 |
+
'xwmz' => 'application/x-ms-wmz',
|
556 |
+
'xwpd' => 'application/vnd.wordperfect',
|
557 |
+
'xwpl' => 'application/vnd.ms-wpl',
|
558 |
+
'xwps' => 'application/vnd.ms-works',
|
559 |
+
'xwqd' => 'application/vnd.wqd',
|
560 |
+
'xwri' => 'application/x-mswrite',
|
561 |
+
'xwrl' => 'model/vrml',
|
562 |
+
'xwsdl' => 'application/wsdl+xml',
|
563 |
+
|
564 |
+
'xwspolicy' => 'application/wspolicy+xml',
|
565 |
+
'xwtb' => 'application/vnd.webturbo',
|
566 |
+
'xwvx' => 'video/x-ms-wvx',
|
567 |
+
'xx3d' => 'application/vnd.hzn-3d-crossword',
|
568 |
+
'xxar' => 'application/vnd.xara',
|
569 |
+
'xxbd' => 'application/vnd.fujixerox.docuworks.binder',
|
570 |
+
'xxbm' => 'ieurotext/x-xbitmap',
|
571 |
+
'xxdm' => 'application/vnd.syncml.dm+xml',
|
572 |
+
'xxdp' => 'application/vnd.adobe.xdp+xml',
|
573 |
+
|
574 |
+
'xxdw' => 'application/vnd.fujixerox.docuworks',
|
575 |
+
'xxenc' => 'application/xenc+xml',
|
576 |
+
'xxfdf' => 'application/vnd.adobe.xfdf',
|
577 |
+
'xxfdl' => 'application/vnd.xfdl',
|
578 |
+
'xxht' => 'application/xhtml+xml',
|
579 |
+
'xxhtml' => 'application/xhtml+xml',
|
580 |
+
'xxhvml' => 'application/xv+xml',
|
581 |
+
'xxif' => 'ieurotext/vnd.xiff',
|
582 |
+
'xxla' => 'application/vnd.ms-excel',
|
583 |
+
|
584 |
+
'xxlc' => 'application/vnd.ms-excel',
|
585 |
+
'xxlm' => 'application/vnd.ms-excel',
|
586 |
+
'xxls' => 'application/vnd.ms-excel',
|
587 |
+
'xxlt' => 'application/vnd.ms-excel',
|
588 |
+
'xxlw' => 'application/vnd.ms-excel',
|
589 |
+
'xxml' => 'application/xml',
|
590 |
+
'xxo' => 'application/vnd.olpc-sugar',
|
591 |
+
'xxop' => 'application/xop+xml',
|
592 |
+
'xxpm' => 'ieurotext/x-xpixmap',
|
593 |
+
|
594 |
+
'xxpr' => 'application/vnd.is-xpr',
|
595 |
+
'xxps' => 'application/vnd.ms-xpsdocument',
|
596 |
+
'xxsl' => 'application/xml',
|
597 |
+
'xxslt' => 'application/xslt+xml',
|
598 |
+
'xxsm' => 'application/vnd.syncml+xml',
|
599 |
+
'xxspf' => 'application/xspf+xml',
|
600 |
+
'xxul' => 'application/vnd.mozilla.xul+xml',
|
601 |
+
'xxvm' => 'application/xv+xml',
|
602 |
+
'xxvml' => 'application/xv+xml',
|
603 |
+
|
604 |
+
'xxwd' => 'ieurotext/x-xwindowdump',
|
605 |
+
'xxyz' => 'chemical/x-xyz',
|
606 |
+
'xzaz' => 'application/vnd.zzazz.deck+xml',
|
607 |
+
'xzip' => 'application/zip',
|
608 |
+
'xzmm' => 'application/vnd.handheld-entertainment+xml',
|
609 |
+
];
|
610 |
+
|
611 |
+
/**
|
612 |
+
* Extend list of MIME types if needed from config
|
613 |
+
*/
|
614 |
+
public function __construct()
|
615 |
+
{
|
616 |
+
$nodes = Mage::getConfig()->getNode('global/mime/types');
|
617 |
+
if ($nodes) {
|
618 |
+
$nodes = (array)$nodes;
|
619 |
+
foreach ($nodes as $key => $value) {
|
620 |
+
$this->_mimeTypes[$key] = $value;
|
621 |
+
}
|
622 |
+
}
|
623 |
+
}
|
624 |
+
|
625 |
+
/**
|
626 |
+
* Get MIME type by file extension from list of pre-defined MIME types
|
627 |
+
*
|
628 |
+
* @param $ext
|
629 |
+
* @return string
|
630 |
+
*/
|
631 |
+
public function getMimeTypeByExtension($ext)
|
632 |
+
{
|
633 |
+
$type = 'x' . $ext;
|
634 |
+
if (isset($this->_mimeTypes[$type])) {
|
635 |
+
return $this->_mimeTypes[$type];
|
636 |
+
}
|
637 |
+
|
638 |
+
return 'application/octet-stream';
|
639 |
+
}
|
640 |
+
|
641 |
+
/**
|
642 |
+
* Get all MIME Types
|
643 |
+
*
|
644 |
+
* @return array
|
645 |
+
*/
|
646 |
+
public function getMimeTypes()
|
647 |
+
{
|
648 |
+
return $this->_mimeTypes;
|
649 |
+
}
|
650 |
+
|
651 |
+
/**
|
652 |
+
* Get array of MIME types associated with given file extension
|
653 |
+
*
|
654 |
+
* @param array|string $extensionsList
|
655 |
+
* @return array
|
656 |
+
*/
|
657 |
+
public function getMimeTypeFromExtensionList($extensionsList)
|
658 |
+
{
|
659 |
+
if (is_string($extensionsList)) {
|
660 |
+
$extensionsList = array_map('trim', explode(',', $extensionsList));
|
661 |
+
}
|
662 |
+
|
663 |
+
return array_map([$this, 'getMimeTypeByExtension'], $extensionsList);
|
664 |
+
}
|
665 |
+
|
666 |
+
/**
|
667 |
+
* Get post_max_size server setting
|
668 |
+
*
|
669 |
+
* @return string
|
670 |
+
*/
|
671 |
+
public function getPostMaxSize()
|
672 |
+
{
|
673 |
+
return ini_get('post_max_size');
|
674 |
+
}
|
675 |
+
|
676 |
+
/**
|
677 |
+
* Get upload_max_filesize server setting
|
678 |
+
*
|
679 |
+
* @return string
|
680 |
+
*/
|
681 |
+
public function getUploadMaxSize()
|
682 |
+
{
|
683 |
+
return ini_get('upload_max_filesize');
|
684 |
+
}
|
685 |
+
|
686 |
+
/**
|
687 |
+
* Get max upload size
|
688 |
+
*
|
689 |
+
* @return mixed
|
690 |
+
*/
|
691 |
+
public function getDataMaxSize()
|
692 |
+
{
|
693 |
+
return min($this->getPostMaxSize(), $this->getUploadMaxSize());
|
694 |
+
}
|
695 |
+
|
696 |
+
/**
|
697 |
+
* Get maximum upload size in bytes
|
698 |
+
*
|
699 |
+
* @return int
|
700 |
+
*/
|
701 |
+
public function getDataMaxSizeInBytes()
|
702 |
+
{
|
703 |
+
$iniSize = $this->getDataMaxSize();
|
704 |
+
$size = substr($iniSize, 0, strlen($iniSize) - 1);
|
705 |
+
$parsedSize = 0;
|
706 |
+
switch (strtolower(substr($iniSize, strlen($iniSize) - 1))) {
|
707 |
+
case 't':
|
708 |
+
$parsedSize = $size * (1024 * 1024 * 1024 * 1024);
|
709 |
+
break;
|
710 |
+
case 'g':
|
711 |
+
$parsedSize = $size * (1024 * 1024 * 1024);
|
712 |
+
break;
|
713 |
+
case 'm':
|
714 |
+
$parsedSize = $size * (1024 * 1024);
|
715 |
+
break;
|
716 |
+
case 'k':
|
717 |
+
$parsedSize = $size * 1024;
|
718 |
+
break;
|
719 |
+
case 'b':
|
720 |
+
default:
|
721 |
+
$parsedSize = $size;
|
722 |
+
break;
|
723 |
+
}
|
724 |
+
|
725 |
+
return (int)$parsedSize;
|
726 |
+
}
|
727 |
+
|
728 |
+
}
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Eurotext_Uploader_Model_Config_Abstract extends Varien_Object
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get file helper
|
7 |
+
*
|
8 |
+
* @return Eurotext_Uploader_Helper_File
|
9 |
+
*/
|
10 |
+
protected function _getHelper()
|
11 |
+
{
|
12 |
+
return Mage::helper('eurotext_uploader/file');
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Set/Get attribute wrapper
|
17 |
+
* Also set data in cameCase for config values
|
18 |
+
*
|
19 |
+
* @param string $method
|
20 |
+
* @param array $args
|
21 |
+
* @return bool|mixed|Varien_Object
|
22 |
+
* @throws Varien_Exception
|
23 |
+
*/
|
24 |
+
public function __call($method, $args)
|
25 |
+
{
|
26 |
+
$key = lcfirst($this->_camelize(substr($method, 3)));
|
27 |
+
switch (substr($method, 0, 3)) {
|
28 |
+
case 'get' :
|
29 |
+
$data = $this->getData($key, isset($args[0]) ? $args[0] : null);
|
30 |
+
|
31 |
+
return $data;
|
32 |
+
|
33 |
+
case 'set' :
|
34 |
+
$result = $this->setData($key, isset($args[0]) ? $args[0] : null);
|
35 |
+
|
36 |
+
return $result;
|
37 |
+
|
38 |
+
case 'uns' :
|
39 |
+
$result = $this->unsetData($key);
|
40 |
+
|
41 |
+
return $result;
|
42 |
+
|
43 |
+
case 'has' :
|
44 |
+
return isset($this->_data[$key]);
|
45 |
+
}
|
46 |
+
throw new Varien_Exception(
|
47 |
+
"Invalid method " . get_class($this) . "::" . $method . "(" . print_r($args, 1) . ")"
|
48 |
+
);
|
49 |
+
}
|
50 |
+
}
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @method Eurotext_Uploader_Model_Config_Browsebutton setDomNodes(array $domNodesIds)
|
4 |
+
* Array of element browse buttons ids
|
5 |
+
* @method Eurotext_Uploader_Model_Config_Browsebutton setIsDirectory(bool $isDirectory)
|
6 |
+
* Pass in true to allow directories to be selected (Google Chrome only)
|
7 |
+
* @method Eurotext_Uploader_Model_Config_Browsebutton setSingleFile(bool $isSingleFile)
|
8 |
+
* To prevent multiple file uploads set this to true.
|
9 |
+
* Also look at config parameter singleFile (Eurotext_Uploader_Model_Config_Uploader setSingleFile())
|
10 |
+
* @method Eurotext_Uploader_Model_Config_Browsebutton setAttributes(array $attributes)
|
11 |
+
* Pass object of keys and values to set custom attributes on input fields.
|
12 |
+
* @see http://www.w3.org/TR/html-markup/input.file.html#input.file-attributes
|
13 |
+
*/
|
14 |
+
class Eurotext_Uploader_Model_Config_Browsebutton extends Eurotext_Uploader_Model_Config_Abstract
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* Set params for browse button
|
18 |
+
*/
|
19 |
+
protected function _construct()
|
20 |
+
{
|
21 |
+
$this->setIsDirectory(false);
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Get MIME types from files extensions
|
26 |
+
*
|
27 |
+
* @param string|array $exts
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
public function getMimeTypesByExtensions($exts)
|
31 |
+
{
|
32 |
+
$mimes = array_unique($this->_getHelper()->getMimeTypeFromExtensionList($exts));
|
33 |
+
|
34 |
+
// Not include general file type
|
35 |
+
unset($mimes['application/octet-stream']);
|
36 |
+
|
37 |
+
return implode(',', $mimes);
|
38 |
+
}
|
39 |
+
}
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method Eurotext_Uploader_Model_Config_Misc setMaxSizePlural (string $sizePlural) Set plural info about max upload size
|
5 |
+
* @method Eurotext_Uploader_Model_Config_Misc setMaxSizeInBytes (int $sizeInBytes) Set max upload size in bytes
|
6 |
+
* @method Eurotext_Uploader_Model_Config_Misc setReplaceBrowseWithRemove (bool $replaceBrowseWithRemove)
|
7 |
+
* Replace browse button with remove
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
class Eurotext_Uploader_Model_Config_Misc extends Eurotext_Uploader_Model_Config_Abstract
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Prepare misc params
|
14 |
+
*/
|
15 |
+
protected function _construct()
|
16 |
+
{
|
17 |
+
$this
|
18 |
+
->setMaxSizeInBytes($this->_getHelper()->getDataMaxSizeInBytes())
|
19 |
+
->setMaxSizePlural($this->_getHelper()->getDataMaxSize());
|
20 |
+
}
|
21 |
+
}
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setTarget(string $url)
|
5 |
+
* The target URL for the multipart POST request.
|
6 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setSingleFile(bool $isSingleFile)
|
7 |
+
* Enable single file upload.
|
8 |
+
* Once one file is uploaded, second file will overtake existing one, first one will be canceled.
|
9 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setChunkSize(int $chunkSize) The size in bytes of each uploaded chunk of data.
|
10 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setForceChunkSize(bool $forceChunkSize)
|
11 |
+
* Force all chunks to be less or equal than chunkSize.
|
12 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setSimultaneousUploads(int $amountOfSimultaneousUploads)
|
13 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setFileParameterName(string $fileUploadParam)
|
14 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setQuery(array $additionalQuery)
|
15 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setHeaders(array $headers)
|
16 |
+
* Extra headers to include in the multipart POST with data.
|
17 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setWithCredentials(bool $isCORS)
|
18 |
+
* Standard CORS requests do not send or set any cookies by default.
|
19 |
+
* In order to include cookies as part of the request, you need to set the withCredentials property to true.
|
20 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setMethod(string $sendMethod)
|
21 |
+
* Method to use when POSTing chunks to the server. Defaults to "multipart"
|
22 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setTestMethod(string $testMethod) Defaults to "GET"
|
23 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setUploadMethod(string $uploadMethod) Defaults to "POST"
|
24 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setAllowDuplicateUploads(bool $allowDuplicateUploads)
|
25 |
+
* Once a file is uploaded, allow reupload of the same file. By default, if a file is already uploaded,
|
26 |
+
* it will be skipped unless the file is removed from the existing Flow object.
|
27 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setPrioritizeFirstAndLastChunk(bool $prioritizeFirstAndLastChunk)
|
28 |
+
* This can be handy if you can determine if a file is valid for your service from only the first or last chunk.
|
29 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setTestChunks(bool $prioritizeFirstAndLastChunk)
|
30 |
+
* Make a GET request to the server for each chunks to see if it already exists.
|
31 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setPreprocess(bool $prioritizeFirstAndLastChunk)
|
32 |
+
* Optional function to process each chunk before testing & sending.
|
33 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setInitFileFn(string $function)
|
34 |
+
* Optional function to initialize the fileObject (js).
|
35 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setReadFileFn(string $function)
|
36 |
+
* Optional function wrapping reading operation from the original file.
|
37 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setGenerateUniqueIdentifier(string $function)
|
38 |
+
* Override the function that generates unique identifiers for each file. Defaults to "null"
|
39 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setMaxChunkRetries(int $maxChunkRetries) Defaults to 0
|
40 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setChunkRetryInterval(int $chunkRetryInterval) Defaults to "undefined"
|
41 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setProgressCallbacksInterval(int $progressCallbacksInterval)
|
42 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setSpeedSmoothingFactor(int $speedSmoothingFactor)
|
43 |
+
* Used for calculating average upload speed. Number from 1 to 0.
|
44 |
+
* Set to 1 and average upload speed wil be equal to current upload speed.
|
45 |
+
* For longer file uploads it is better set this number to 0.02,
|
46 |
+
* because time remaining estimation will be more accurate.
|
47 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setSuccessStatuses(array $successStatuses)
|
48 |
+
* Response is success if response status is in this list
|
49 |
+
* @method Eurotext_Uploader_Model_Config_Uploader setPermanentErrors(array $permanentErrors)
|
50 |
+
* Response fails if response status is in this list
|
51 |
+
*/
|
52 |
+
class Eurotext_Uploader_Model_Config_Uploader extends Eurotext_Uploader_Model_Config_Abstract
|
53 |
+
{
|
54 |
+
/**
|
55 |
+
* Type of upload
|
56 |
+
*/
|
57 |
+
const UPLOAD_TYPE = 'multipart';
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Test chunks on resumable uploads
|
61 |
+
*/
|
62 |
+
const TEST_CHUNKS = false;
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Used for calculating average upload speed.
|
66 |
+
*/
|
67 |
+
const SMOOTH_UPLOAD_FACTOR = 0.02;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Progress check interval
|
71 |
+
*/
|
72 |
+
const PROGRESS_CALLBACK_INTERVAL = 0;
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Set default values for uploader
|
76 |
+
*/
|
77 |
+
protected function _construct()
|
78 |
+
{
|
79 |
+
$this
|
80 |
+
->setChunkSize($this->_getHelper()->getDataMaxSizeInBytes())
|
81 |
+
->setWithCredentials(false)
|
82 |
+
->setForceChunkSize(false)
|
83 |
+
->setQuery(
|
84 |
+
[
|
85 |
+
'form_key' => Mage::getSingleton('core/session')->getFormKey()
|
86 |
+
]
|
87 |
+
)
|
88 |
+
->setMethod(self::UPLOAD_TYPE)
|
89 |
+
->setAllowDuplicateUploads(true)
|
90 |
+
->setPrioritizeFirstAndLastChunk(false)
|
91 |
+
->setTestChunks(self::TEST_CHUNKS)
|
92 |
+
->setSpeedSmoothingFactor(self::SMOOTH_UPLOAD_FACTOR)
|
93 |
+
->setProgressCallbacksInterval(self::PROGRESS_CALLBACK_INTERVAL)
|
94 |
+
->setSuccessStatuses([200, 201, 202])
|
95 |
+
->setPermanentErrors([404, 415, 500, 501]);
|
96 |
+
}
|
97 |
+
}
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Eurotext_Uploader>
|
5 |
+
<version>0.1.1</version>
|
6 |
+
</Eurotext_Uploader>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<eurotext_uploader>
|
11 |
+
<class>Eurotext_Uploader_Block</class>
|
12 |
+
</eurotext_uploader>
|
13 |
+
</blocks>
|
14 |
+
<helpers>
|
15 |
+
<eurotext_uploader>
|
16 |
+
<class>Eurotext_Uploader_Helper</class>
|
17 |
+
</eurotext_uploader>
|
18 |
+
</helpers>
|
19 |
+
<models>
|
20 |
+
<eurotext_uploader>
|
21 |
+
<class>Eurotext_Uploader_Model</class>
|
22 |
+
</eurotext_uploader>
|
23 |
+
</models>
|
24 |
+
</global>
|
25 |
+
</config>
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<jstranslator>
|
3 |
+
<uploader-exceed_max-1 translate="message" module="eurotext_uploader">
|
4 |
+
<message>Maximum allowed file size for upload is</message>
|
5 |
+
</uploader-exceed_max-1>
|
6 |
+
<uploader-exceed_max-2 translate="message" module="eurotext_uploader">
|
7 |
+
<message>Please check your server PHP settings.</message>
|
8 |
+
</uploader-exceed_max-2>
|
9 |
+
<uploader-tab-change-event-confirm translate="message" module="eurotext_uploader">
|
10 |
+
<message>There are files that were selected but not uploaded yet. After switching to another tab your selections will be lost. Do you wish to proceed?</message>
|
11 |
+
</uploader-tab-change-event-confirm>
|
12 |
+
<uploader-complete-event-text translate="message" module="eurotext_uploader">
|
13 |
+
<message>Complete</message>
|
14 |
+
</uploader-complete-event-text>
|
15 |
+
<uploader-uploading-progress translate="message" module="eurotext_uploader">
|
16 |
+
<message>Uploading…</message>
|
17 |
+
</uploader-uploading-progress>
|
18 |
+
</jstranslator>
|
19 |
+
|
@@ -1,6 +1,5 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout>
|
3 |
-
|
4 |
<eurotext_prepare_popup>
|
5 |
<reference name="root">
|
6 |
<action method="setTemplate">
|
@@ -11,118 +10,286 @@
|
|
11 |
<remove name="footer"/>
|
12 |
</eurotext_prepare_popup>
|
13 |
|
14 |
-
<
|
15 |
<reference name="head">
|
16 |
-
<action method="addItem">
|
17 |
-
<type>skin_css</type>
|
18 |
-
<name>eurotext/translationmanager/css/styles.css</name>
|
19 |
-
<params/>
|
20 |
-
</action>
|
21 |
<action method="addItem">
|
22 |
<type>skin_js</type>
|
23 |
-
<name>eurotext/translationmanager/js/
|
24 |
-
<params/>
|
25 |
-
</action>
|
26 |
-
<action method="addItem">
|
27 |
-
<type>skin_js</type>
|
28 |
-
<name>eurotext/translationmanager/js/eurotext.js</name>
|
29 |
-
<params/>
|
30 |
</action>
|
31 |
</reference>
|
32 |
-
</
|
33 |
|
34 |
<!--
|
35 |
-
|
36 |
LAYOUT AREA FOR VISIBLE BACKEND PAGES
|
37 |
-
|
38 |
-->
|
39 |
-
<adminhtml_eurotext_translationmanager_register_index>
|
40 |
-
<update handle="eurotext_add_css"/>
|
41 |
-
<reference name="content">
|
42 |
-
<block type="eurotext_translationmanager/register" name="et.tm.register"
|
43 |
-
template="eurotext/translationmanager/register.phtml"/>
|
44 |
-
</reference>
|
45 |
-
</adminhtml_eurotext_translationmanager_register_index>
|
46 |
|
47 |
-
<
|
48 |
-
<update handle="eurotext_add_css"/>
|
49 |
<reference name="content">
|
50 |
-
<block type="eurotext_translationmanager/
|
51 |
-
template="eurotext/translationmanager/settings.phtml"/>
|
52 |
</reference>
|
53 |
-
</
|
54 |
|
55 |
-
<
|
56 |
-
<update handle="eurotext_add_css"/>
|
57 |
<reference name="content">
|
58 |
-
<block
|
59 |
-
|
60 |
</reference>
|
61 |
-
</
|
62 |
|
63 |
-
<
|
64 |
-
<
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
</reference>
|
69 |
-
|
70 |
-
|
71 |
-
<adminhtml_eurotext_translationmanager_selectproducts_index>
|
72 |
-
<update handle="eurotext_add_css"/>
|
73 |
-
<update handle="eurotext_prepare_popup"/>
|
74 |
-
<reference name="content">
|
75 |
-
<block type="eurotext_translationmanager/selectproducts" name="et.tm.selectproducts"
|
76 |
-
template="eurotext/translationmanager/selectproducts.phtml"/>
|
77 |
</reference>
|
78 |
-
</adminhtml_eurotext_translationmanager_selectproducts_index>
|
79 |
-
|
80 |
-
<adminhtml_eurotext_translationmanager_selectcategories_index>
|
81 |
-
<update handle="eurotext_add_css"/>
|
82 |
-
<update handle="eurotext_prepare_popup"/>
|
83 |
<reference name="content">
|
84 |
-
<block
|
85 |
-
template="eurotext/translationmanager/selectcategories.phtml"/>
|
86 |
</reference>
|
87 |
-
</
|
88 |
|
89 |
-
<
|
90 |
-
<
|
91 |
-
|
92 |
-
|
93 |
-
<block
|
94 |
-
template="eurotext/translationmanager/
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
-
<
|
99 |
-
<
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
-
<
|
108 |
-
<
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
<reference name="content">
|
111 |
-
<block type="eurotext_translationmanager/
|
112 |
-
template="eurotext/translationmanager/
|
113 |
</reference>
|
114 |
-
</
|
115 |
-
|
116 |
|
117 |
<!--
|
118 |
-
|
119 |
LAYOUT AREA FOR AJAX REQUESTS
|
120 |
-
|
121 |
-->
|
122 |
<adminhtml_eurotext_translationmanager_ajax>
|
123 |
-
<block type="eurotext_translationmanager/response_ajax" output="toJson" name="et.tm.response.ajax"
|
124 |
</adminhtml_eurotext_translationmanager_ajax>
|
|
|
125 |
<adminhtml_eurotext_translationmanager_text>
|
126 |
-
<block type="core/text" output="toHtml" name="et.tm.response.text"
|
127 |
</adminhtml_eurotext_translationmanager_text>
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout>
|
|
|
3 |
<eurotext_prepare_popup>
|
4 |
<reference name="root">
|
5 |
<action method="setTemplate">
|
10 |
<remove name="footer"/>
|
11 |
</eurotext_prepare_popup>
|
12 |
|
13 |
+
<adminhtml_system_config_edit>
|
14 |
<reference name="head">
|
|
|
|
|
|
|
|
|
|
|
15 |
<action method="addItem">
|
16 |
<type>skin_js</type>
|
17 |
+
<name>eurotext/translationmanager/js/system_config.js</name>
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
</action>
|
19 |
</reference>
|
20 |
+
</adminhtml_system_config_edit>
|
21 |
|
22 |
<!--
|
|
|
23 |
LAYOUT AREA FOR VISIBLE BACKEND PAGES
|
|
|
24 |
-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
<adminhtml_eurotext_status_index>
|
|
|
27 |
<reference name="content">
|
28 |
+
<block type="eurotext_translationmanager/status" name="et.tm.status"/>
|
|
|
29 |
</reference>
|
30 |
+
</adminhtml_eurotext_status_index>
|
31 |
|
32 |
+
<adminhtml_eurotext_project_index>
|
|
|
33 |
<reference name="content">
|
34 |
+
<block name="et.tm.projects.grid" as="project.grid.container"
|
35 |
+
type="eurotext_translationmanager/adminhtml_eurotext_project"/>
|
36 |
</reference>
|
37 |
+
</adminhtml_eurotext_project_index>
|
38 |
|
39 |
+
<adminhtml_eurotext_project_edit>
|
40 |
+
<reference name="head">
|
41 |
+
<action method="setCanLoadExtJs">
|
42 |
+
<value>1</value>
|
43 |
+
</action>
|
44 |
+
<action method="addJs"><name>eurotext/uploader/flow.min.js</name></action>
|
45 |
+
<action method="addJs"><name>eurotext/uploader/fusty-flow.js</name></action>
|
46 |
+
<action method="addJs"><name>eurotext/uploader/fusty-flow-factory.js</name></action>
|
47 |
+
<action method="addJs"><name>eurotext/uploader/instance.js</name></action>
|
48 |
+
<action method="addItem">
|
49 |
+
<type>skin_css</type>
|
50 |
+
<name>eurotext/translationmanager/css/project.css</name>
|
51 |
+
<params/>
|
52 |
+
</action>
|
53 |
+
<action method="addItem">
|
54 |
+
<type>skin_js</type>
|
55 |
+
<name>eurotext/translationmanager/js/eurotext_project.js</name>
|
56 |
+
</action>
|
57 |
</reference>
|
58 |
+
<reference name="left">
|
59 |
+
<block type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tabs" name="project_edit.tabs"/>
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
</reference>
|
|
|
|
|
|
|
|
|
|
|
61 |
<reference name="content">
|
62 |
+
<block name="project_edit" type="eurotext_translationmanager/adminhtml_eurotext_project_edit"/>
|
|
|
63 |
</reference>
|
64 |
+
</adminhtml_eurotext_project_edit>
|
65 |
|
66 |
+
<adminhtml_eurotext_project_productstab>
|
67 |
+
<block type="core/text_list" name="root" output="toHtml">
|
68 |
+
<block name="project_edit.project.tab.products"
|
69 |
+
type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_products"/>
|
70 |
+
<block name="project.edit.project.tab.products.categry_tree"
|
71 |
+
template="eurotext/translationmanager/project/products/category_tree.phtml"
|
72 |
+
type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_products_categoryTree">
|
73 |
+
<action method="setJsFormObject">
|
74 |
+
<form>editForm</form>
|
75 |
+
</action>
|
76 |
+
</block>
|
77 |
+
<block type="adminhtml/template" name="project.edit.project.tab.products.bulk_sku"
|
78 |
+
template="eurotext/translationmanager/project/products/bulk_sku.phtml"/>
|
79 |
+
<block type="adminhtml/widget_grid_serializer" name="project_edit.project.tab.products.serializer">
|
80 |
+
<action method="initSerializerBlock">
|
81 |
+
<grid_block_name>project_edit.project.tab.products</grid_block_name>
|
82 |
+
<data_callback>_getSelectedProducts</data_callback>
|
83 |
+
<hidden_input_name>product_ids</hidden_input_name>
|
84 |
+
<reload_param_name>products</reload_param_name>
|
85 |
+
</action>
|
86 |
+
</block>
|
87 |
+
</block>
|
88 |
+
</adminhtml_eurotext_project_productstab>
|
89 |
|
90 |
+
<adminhtml_eurotext_project_productsgrid>
|
91 |
+
<block type="core/text_list" name="root" output="toHtml">
|
92 |
+
<block name="project.edit.project.tab.products.script"
|
93 |
+
template="eurotext/translationmanager/project/products/script.phtml"
|
94 |
+
type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_products_script"/>
|
95 |
+
<block type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_products"
|
96 |
+
name="project_edit.project.tab.products"/>
|
97 |
+
</block>
|
98 |
+
</adminhtml_eurotext_project_productsgrid>
|
99 |
+
|
100 |
+
<adminhtml_eurotext_project_categoriestab>
|
101 |
+
<block type="core/text_list" name="root" output="toHtml">
|
102 |
+
<block name="project_edit.project.tab.categories"
|
103 |
+
type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_categories"/>
|
104 |
+
<block type="adminhtml/widget_grid_serializer" name="project_edit.project.tab.categories.serializer">
|
105 |
+
<action method="initSerializerBlock">
|
106 |
+
<grid_block_name>project_edit.project.tab.categories</grid_block_name>
|
107 |
+
<data_callback>_getSelectedCategories</data_callback>
|
108 |
+
<hidden_input_name>category_ids</hidden_input_name>
|
109 |
+
<reload_param_name>categories</reload_param_name>
|
110 |
+
</action>
|
111 |
+
</block>
|
112 |
+
</block>
|
113 |
+
</adminhtml_eurotext_project_categoriestab>
|
114 |
+
|
115 |
+
<adminhtml_eurotext_project_categoriesgrid>
|
116 |
+
<block type="core/text_list" name="root" output="toHtml">
|
117 |
+
<block type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_categories"
|
118 |
+
name="project_edit.project.tab.categories"/>
|
119 |
+
</block>
|
120 |
+
</adminhtml_eurotext_project_categoriesgrid>
|
121 |
+
|
122 |
+
<adminhtml_eurotext_project_cmsblockstab>
|
123 |
+
<block type="core/text_list" name="root" output="toHtml">
|
124 |
+
<block name="project_edit.project.tab.cmsblocks"
|
125 |
+
type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_cmsBlock"/>
|
126 |
+
<block type="adminhtml/widget_grid_serializer" name="project_edit.project.tab.cmsblocks.serializer">
|
127 |
+
<action method="initSerializerBlock">
|
128 |
+
<grid_block_name>project_edit.project.tab.cmsblocks</grid_block_name>
|
129 |
+
<data_callback>_getSelectedCmsBlocks</data_callback>
|
130 |
+
<hidden_input_name>cmsBlock_ids</hidden_input_name>
|
131 |
+
<reload_param_name>cmsBlocks</reload_param_name>
|
132 |
+
</action>
|
133 |
+
</block>
|
134 |
+
</block>
|
135 |
+
</adminhtml_eurotext_project_cmsblockstab>
|
136 |
+
|
137 |
+
<adminhtml_eurotext_project_cmsblocksgrid>
|
138 |
+
<block type="core/text_list" name="root" output="toHtml">
|
139 |
+
<block type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_cmsBlock"
|
140 |
+
name="project_edit.project.tab.cmsblocks"/>
|
141 |
+
</block>
|
142 |
+
</adminhtml_eurotext_project_cmsblocksgrid>
|
143 |
+
|
144 |
+
<adminhtml_eurotext_project_cmspagestab>
|
145 |
+
<block type="core/text_list" name="root" output="toHtml">
|
146 |
+
<block name="project_edit.project.tab.cmspages"
|
147 |
+
type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_cmsPage"/>
|
148 |
+
<block type="adminhtml/widget_grid_serializer" name="project_edit.project.tab.cmspages.serializer">
|
149 |
+
<action method="initSerializerBlock">
|
150 |
+
<grid_block_name>project_edit.project.tab.cmspages</grid_block_name>
|
151 |
+
<data_callback>_getSelectedCmsPages</data_callback>
|
152 |
+
<hidden_input_name>cmsPage_ids</hidden_input_name>
|
153 |
+
<reload_param_name>cmsPages</reload_param_name>
|
154 |
+
</action>
|
155 |
+
</block>
|
156 |
+
</block>
|
157 |
+
</adminhtml_eurotext_project_cmspagestab>
|
158 |
+
|
159 |
+
<adminhtml_eurotext_project_cmspagesgrid>
|
160 |
+
<block type="core/text_list" name="root" output="toHtml">
|
161 |
+
<block type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_cmsPage"
|
162 |
+
name="project_edit.project.tab.cmspages"/>
|
163 |
+
</block>
|
164 |
+
</adminhtml_eurotext_project_cmspagesgrid>
|
165 |
|
166 |
+
<adminhtml_eurotext_project_transactionemailfilestab>
|
167 |
+
<block type="core/text_list" name="root" output="toHtml">
|
168 |
+
<block type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_emails_note"
|
169 |
+
template="eurotext/translationmanager/project/email/note.phtml"
|
170 |
+
name="project_edit.project.tab.transactionemailfiles.note"/>
|
171 |
+
<block type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_transactionEmailFiles"
|
172 |
+
name="project_edit.project.tab.transactionemailfiles"/>
|
173 |
+
<block type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_transactionEmailsDatabase"
|
174 |
+
name="project_edit.project.tab.transactionemailsdatabase"/>
|
175 |
+
<block type="adminhtml/widget_grid_serializer"
|
176 |
+
name="project_edit.project.tab.transactionemailfiles.serializer">
|
177 |
+
<action method="initSerializerBlock">
|
178 |
+
<grid_block_name>project_edit.project.tab.transactionemailfiles</grid_block_name>
|
179 |
+
<data_callback>_getSelectedTransactionEmailFiles</data_callback>
|
180 |
+
<hidden_input_name>transactionEmailFile_ids</hidden_input_name>
|
181 |
+
<reload_param_name>transactionEmailFiles</reload_param_name>
|
182 |
+
</action>
|
183 |
+
</block>
|
184 |
+
<block type="adminhtml/widget_grid_serializer"
|
185 |
+
name="project_edit.project.tab.transactionemailsdatabase.serializer">
|
186 |
+
<action method="initSerializerBlock">
|
187 |
+
<grid_block_name>project_edit.project.tab.transactionemailsdatabase</grid_block_name>
|
188 |
+
<data_callback>_getSelectedTransactionEmailsDatabase</data_callback>
|
189 |
+
<hidden_input_name>transactionEmailDatabase_ids</hidden_input_name>
|
190 |
+
<reload_param_name>transactionEmailsDatabase</reload_param_name>
|
191 |
+
</action>
|
192 |
+
</block>
|
193 |
+
</block>
|
194 |
+
</adminhtml_eurotext_project_transactionemailfilestab>
|
195 |
+
|
196 |
+
<adminhtml_eurotext_project_transactionemailfilesgrid>
|
197 |
+
<block type="core/text_list" name="root" output="toHtml">
|
198 |
+
<block type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_transactionEmailFiles"
|
199 |
+
name="project_edit.project.tab.transactionemailfiles"/>
|
200 |
+
</block>
|
201 |
+
</adminhtml_eurotext_project_transactionemailfilesgrid>
|
202 |
+
|
203 |
+
<adminhtml_eurotext_project_transactionemailsdatabasegrid>
|
204 |
+
<block type="core/text_list" name="root" output="toHtml">
|
205 |
+
<block type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_transactionEmailsDatabase"
|
206 |
+
name="project_edit.project.tab.transactionemailsdatabase"/>
|
207 |
+
</block>
|
208 |
+
</adminhtml_eurotext_project_transactionemailsdatabasegrid>
|
209 |
+
|
210 |
+
<adminhtml_eurotext_project_translatefilestab>
|
211 |
+
<block type="core/text_list" name="root" output="toHtml">
|
212 |
+
<block type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_translateFiles"
|
213 |
+
name="project_edit.project.tab.translatefiles"/>
|
214 |
+
<block type="adminhtml/widget_grid_serializer" name="project_edit.project.tab.translatefiles.serializer">
|
215 |
+
<action method="initSerializerBlock">
|
216 |
+
<grid_block_name>project_edit.project.tab.translatefiles</grid_block_name>
|
217 |
+
<data_callback>_getSelectedTranslateFiles</data_callback>
|
218 |
+
<hidden_input_name>translateFiles_ids</hidden_input_name>
|
219 |
+
<reload_param_name>translateFiles</reload_param_name>
|
220 |
+
</action>
|
221 |
+
</block>
|
222 |
+
</block>
|
223 |
+
</adminhtml_eurotext_project_translatefilestab>
|
224 |
+
|
225 |
+
<adminhtml_eurotext_project_translatefilesgrid>
|
226 |
+
<block type="core/text_list" name="root" output="toHtml">
|
227 |
+
<block type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_translateFiles"
|
228 |
+
name="project_edit.project.tab.translatefiles"/>
|
229 |
+
</block>
|
230 |
+
</adminhtml_eurotext_project_translatefilesgrid>
|
231 |
+
|
232 |
+
<adminhtml_eurotext_project_grid>
|
233 |
+
<block type="core/text_list" name="root" output="toHtml">
|
234 |
+
<block type="eurotext_translationmanager/adminhtml_eurotext_project_edit_tab_products"
|
235 |
+
name="project_edit.project.tab.products"/>
|
236 |
+
</block>
|
237 |
+
</adminhtml_eurotext_project_grid>
|
238 |
+
|
239 |
+
<adminhtml_eurotext_help_index>
|
240 |
+
<reference name="head">
|
241 |
+
<action method="addItem">
|
242 |
+
<type>skin_css</type>
|
243 |
+
<name>eurotext/translationmanager/css/help.css</name>
|
244 |
+
<params/>
|
245 |
+
</action>
|
246 |
+
</reference>
|
247 |
<reference name="content">
|
248 |
+
<block type="eurotext_translationmanager/help" name="et.tm.help"
|
249 |
+
template="eurotext/translationmanager/help.phtml"/>
|
250 |
</reference>
|
251 |
+
</adminhtml_eurotext_help_index>
|
|
|
252 |
|
253 |
<!--
|
|
|
254 |
LAYOUT AREA FOR AJAX REQUESTS
|
|
|
255 |
-->
|
256 |
<adminhtml_eurotext_translationmanager_ajax>
|
257 |
+
<block type="eurotext_translationmanager/response_ajax" output="toJson" name="et.tm.response.ajax"/>
|
258 |
</adminhtml_eurotext_translationmanager_ajax>
|
259 |
+
|
260 |
<adminhtml_eurotext_translationmanager_text>
|
261 |
+
<block type="core/text" output="toHtml" name="et.tm.response.text"/>
|
262 |
</adminhtml_eurotext_translationmanager_text>
|
263 |
+
|
264 |
+
<adminhtml_eurotext_project_import_importparse>
|
265 |
+
<reference name="head">
|
266 |
+
<action method="addItem">
|
267 |
+
<type>skin_css</type>
|
268 |
+
<name>eurotext/translationmanager/css/status.css</name>
|
269 |
+
<params/>
|
270 |
+
</action>
|
271 |
+
</reference>
|
272 |
+
<reference name="content">
|
273 |
+
<block name="et.import.status" type="eurotext_translationmanager/adminhtml_eurotext_import_overview"
|
274 |
+
template="eurotext/translationmanager/import/overview.phtml"/>
|
275 |
+
</reference>
|
276 |
+
</adminhtml_eurotext_project_import_importparse>
|
277 |
+
|
278 |
+
<adminhtml_eurotext_project_export_index>
|
279 |
+
<reference name="head">
|
280 |
+
<action method="addItem">
|
281 |
+
<type>skin_css</type>
|
282 |
+
<name>eurotext/translationmanager/css/status.css</name>
|
283 |
+
<params/>
|
284 |
+
</action>
|
285 |
+
<action method="addItem">
|
286 |
+
<type>skin_js</type>
|
287 |
+
<name>eurotext/translationmanager/js/export.js</name>
|
288 |
+
</action>
|
289 |
+
</reference>
|
290 |
+
<reference name="content">
|
291 |
+
<block name="et.export.overview" type="eurotext_translationmanager/adminhtml_eurotext_export_overview"
|
292 |
+
template="eurotext/translationmanager/export/overview.phtml"/>
|
293 |
+
</reference>
|
294 |
+
</adminhtml_eurotext_project_export_index>
|
295 |
+
</layout>
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php /** @var Eurotext_TranslationManager_Block_Adminhtml_Export_Overview $this */ ?>
|
2 |
+
<script type="text/javascript">
|
3 |
+
var exportUrl = '<?php echo $this->getExportUrl(); ?>';
|
4 |
+
var successUrl = '<?php echo $this->getSuccessUrl(); ?>';
|
5 |
+
var formKey = "<?php echo $this->getFormKey();?>";
|
6 |
+
exportProject(exportUrl, successUrl, formKey, <?php echo $this->getProjectId(); ?>, 0, 0)
|
7 |
+
</script>
|
8 |
+
|
9 |
+
<ul class="eurotext_export_status">
|
10 |
+
<li class="ok">
|
11 |
+
<?php echo $this->__("Starting profile execution, please wait …"); ?>
|
12 |
+
</li>
|
13 |
+
<li class="error">
|
14 |
+
<?php echo $this->__("Warning: Please do not close the window during exporting data"); ?>
|
15 |
+
</li>
|
16 |
+
</ul>
|
@@ -1,88 +1,88 @@
|
|
1 |
-
<?php
|
2 |
-
// utf8-detection: öäü€
|
3 |
-
?>
|
4 |
-
|
5 |
<table cellspacing="0" cellpadding="0" width="100%" height="100%" border="0">
|
6 |
-
<tr>
|
7 |
-
<td class="edittext">
|
8 |
-
<table width="900" border="0">
|
9 |
<tr>
|
10 |
-
<td
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
</td>
|
12 |
</tr>
|
13 |
-
|
14 |
-
|
15 |
-
<div style="font-weight:bold;font-size:12pt; margin-top:25px;"><?php echo $this->__("translationMANAGER Quick Start Guide"); ?></div>
|
16 |
-
<div><?php echo $this->__("Here you will find a list of the settings required for operating the Eurotext interface"); ?></div>
|
17 |
-
|
18 |
-
<div style="margin-top:15px;margin-left:20px;">
|
19 |
-
<div style="font-weight:bold;font-size:11pt;"><?php echo $this->__("Registration"); ?></div>
|
20 |
-
<div><?php echo $this->__("Make sure to complete the registration process and enter your access information before submitting your first translation project. Fill out all fields of the registration form and click <b><i>Save and send</i>.</b> Eurotext will send you your login details within 24 hours (weekdays). Enter that information in the menu item <b><i>Settings</i></b>."); ?></div>
|
21 |
-
</div>
|
22 |
-
|
23 |
-
<div style="margin-top:15px;margin-left:20px;">
|
24 |
-
<div style="font-weight:bold;font-size:11pt;"><?php echo $this->__("Settings"); ?></div>
|
25 |
-
<div><?php echo $this->__('You will receive your login details from your customer service representative at Eurotext AG as soon as you have completed your registration. Please enter your user name, password and customer number in "Settings".<br/><span style="font-style:italic;"><span style="color:red;">Important:</span> Ensure that a storeview for the target language was created in the shop before exporting the text for translation, and that the storeview settings have the correct language settings</span>'); ?></div>
|
26 |
-
</div>
|
27 |
-
|
28 |
-
<div style="margin-top:15px;margin-left:20px;">
|
29 |
-
<div style="font-weight:bold;font-size:11pt;"><?php echo $this->__("Projects"); ?></div>
|
30 |
-
<div><?php echo $this->__("Create a new project for each translation order."); ?></div>
|
31 |
-
<ul style="margin-left:20px;">
|
32 |
-
<li style="list-style-type:disc;"><?php echo $this->__("Each project must have a name assigned (we recommend something unique and identifiable)."); ?></li>
|
33 |
-
<li style="list-style-type:disc;"><?php echo $this->__("Specify a <b>Source Storeview</b> and <b>Target Storeview</b> for the requested translation."); ?></li>
|
34 |
-
</ul>
|
35 |
-
|
36 |
-
<div style="margin-top:10px;"><?php echo $this->__("Select the products, categories, CMS pages, or email templates you need translated"); ?>:</div>
|
37 |
-
<ul style="margin-left:20px;">
|
38 |
-
<li style="list-style-type:disc;"><?php echo $this->__("Products, categories, CMS pages, or email templates can be selected individually (<b>Select […]</b>), or alternatively:"); ?></li>
|
39 |
-
<li style="list-style-type:disc;"><?php echo $this->__("<b>Select all [...] without existing translation:</b> The module will automatically select all Products, categories, CMS pages and email templates for which no translated text exists in the target language."); ?><br/><?php echo $this->__("<i><span style='color:red;'>Important:</span> All previous assignments will be deleted!</i>"); ?></li>
|
40 |
-
</ul>
|
41 |
-
|
42 |
-
<div style="margin-top:10px;"><?php echo $this->__("Clicking <b>Select language files</b> will allow you to manually select specific shop system texts in the selection window for translation."); ?></div>
|
43 |
-
|
44 |
-
<div style="margin-top:10px;"><?php echo $this->__("Clicking <b>Select all language files without existing translation</b> will automatically select all files and check for missing translations. All entries without an existing translation will be exported."); ?></div>
|
45 |
-
<div><?php echo $this->__("<i><span style='color:red;'>Important:</span> We recommend using this setting only for the initial translation of a new online shop, as it will trigger a translation of ALL language files for the selected target language!</i>"); ?></div>
|
46 |
-
|
47 |
-
<div style="margin-top:10px;"><?php echo $this->__("Select the check box <b>Export SEO content?</b> if you would like to have the SEO content (e.g. keywords, search terms, meta tags, etc.) translated."); ?></div>
|
48 |
-
|
49 |
-
<div style="margin-top:10px;"><?php echo $this->__("Select the check box <b>Export attributes and attribute options?</b> if you would like to have the product attributes and associated values translated."); ?></div>
|
50 |
-
|
51 |
-
<div style="margin-top:10px;"><?php echo $this->__("Select the check box <b>Export URL keys?</b> if you would like to have URLs of products and categories translated."); ?></div>
|
52 |
-
|
53 |
-
<div style="margin-top:20px;"><?php echo $this->__("Clicking the button <b>Request your free quote now</b> will transmit your texts for translation to the translation portal, and you will receive a detailed quote for your translation project within the next 24 hours (weekdays)."); ?>
|
54 |
-
|
55 |
-
<div style="margin-top:10px;"><?php echo $this->__("Your Eurotext customer service representative will send you your translations in a zip file. This zip file can be uploaded and imported to he relevant project."); ?></div>
|
56 |
-
|
57 |
-
<div style="margin-top:10px;"><?php echo $this->__("<b>Please note:</b> For safety reasons, we recommend importing to a staging system first. Make sure to backup all your data before importing."); ?></div>
|
58 |
-
|
59 |
-
<div style="margin-top:10px;"><?php echo $this->__("Please read the translationMANAGER documentation for more information."); ?></div>
|
60 |
-
|
61 |
-
<div> </div>
|
62 |
-
<div style="border:1px solid black;padding:20px;display:inline-block;">
|
63 |
-
<table width="900" border="0">
|
64 |
-
<tr>
|
65 |
-
<td width="445" class="edittext"><p align="left"><strong><?php echo $this->__("Contact"); ?> Eurotext AG </strong></td>
|
66 |
-
</tr>
|
67 |
-
<tr>
|
68 |
-
<td height="135" class="edittext">
|
69 |
-
<p class="edittext" align="left">
|
70 |
-
<span class="logo_eurotext"></span><br>
|
71 |
-
Eurotext AG<br>
|
72 |
-
Schürerstraße 3<br>
|
73 |
-
97080 Würzburg<br>
|
74 |
-
Deutschland<br><br>
|
75 |
-
<?php echo $this->__("Phone"); ?>: +49 (0)931 35 40 50<br>
|
76 |
-
<?php echo $this->__("Telefax"); ?>: +49 (0)931 35 40 580<br>
|
77 |
-
E-Mail: <a href="mailto:>info@eurotext.de">info@eurotext.de</a><br>
|
78 |
-
Web: <a href="http://www.eurotext.de" target="_blank">www.eurotext.de</a>
|
79 |
-
</p>
|
80 |
-
<p class="edittext" align="left"> </p>
|
81 |
-
</td>
|
82 |
-
</tr>
|
83 |
-
</table>
|
84 |
-
</div>
|
85 |
-
|
86 |
-
</td>
|
87 |
-
</tr>
|
88 |
-
</table>
|
|
|
|
|
|
|
|
|
1 |
<table cellspacing="0" cellpadding="0" width="100%" height="100%" border="0">
|
|
|
|
|
|
|
2 |
<tr>
|
3 |
+
<td class="edittext">
|
4 |
+
<table width="900" border="0">
|
5 |
+
<tr>
|
6 |
+
<td width="900" class="edittext">
|
7 |
+
<a href="http://www.eurotext.de/" target="_blank"><span class="eurotext_logo"></span></a></td>
|
8 |
+
</td>
|
9 |
+
</tr>
|
10 |
+
</table>
|
11 |
+
|
12 |
+
<div style="font-weight:bold;font-size:12pt; margin-top:25px;"><?php echo $this->__("translationMANAGER Quick Start Guide"); ?></div>
|
13 |
+
<div><?php echo $this->__("Here you will find a list of settings required for operating the Eurotext interface"); ?></div>
|
14 |
+
|
15 |
+
<div style="margin-top:15px;margin-left:20px;">
|
16 |
+
<div style="font-weight:bold;font-size:11pt;"><?php echo $this->__("Registration"); ?></div>
|
17 |
+
<div><?php echo $this->__("Make sure to complete the registration process and enter your access information before submitting your first translation project. Fill out all fields of the registration form and click <b><i>Save and send</i> </b>. Eurotext will send your connection credentials."); ?></div>
|
18 |
+
</div>
|
19 |
+
|
20 |
+
<div style="margin-top:15px;margin-left:20px;">
|
21 |
+
<div style="font-weight:bold;font-size:11pt;"><?php echo $this->__("Settings"); ?></div>
|
22 |
+
<div><?php echo $this->__('You will receive your connection credentials from your customer service representative at Eurotext AG as soon as you have completed your registration. Please enter your user name, password and customer number in "Settings".<br/><span style="font-style:italic;"><sp'); ?></div>
|
23 |
+
</div>
|
24 |
+
|
25 |
+
<div style="margin-top:15px;margin-left:20px;">
|
26 |
+
<div style="font-weight:bold;font-size:11pt;"><?php echo $this->__("Projects"); ?></div>
|
27 |
+
<div><?php echo $this->__("Create a new project for each translation order."); ?></div>
|
28 |
+
<ul style="margin-left:20px;">
|
29 |
+
<li style="list-style-type:disc;"><?php echo $this->__("Each project must have a name assigned (we recommend something unique and distinguishable)."); ?></li>
|
30 |
+
<li style="list-style-type:disc;"><?php echo $this->__("Specify a <b>Source StoreView</b> and <b>Target StoreView</b> for the requested translation."); ?></li>
|
31 |
+
</ul>
|
32 |
+
|
33 |
+
<div style="margin-top:10px;"><?php echo $this->__("Select the products, categories, CMS Pages or Email Templates you need translated"); ?>:</div>
|
34 |
+
<ul style="margin-left:20px;">
|
35 |
+
<li style="list-style-type:disc;"><?php echo $this->__("Products, categories, CMS Pages, or Email Templates can be selected individually (<b>Select […]</b>), or alternatively:"); ?></li>
|
36 |
+
<li style="list-style-type:disc;"><?php echo $this->__("<b>Select all [...] without existing translation:</b> The plugin will automatically select all products, categories, CMS pages and email templates for which no translated text exists in the target language."); ?>
|
37 |
+
<br/><?php echo $this->__("<i><span style='color:red;'>Important:</span> All previous assignments will be deleted!</i>"); ?>
|
38 |
+
</li>
|
39 |
+
</ul>
|
40 |
+
|
41 |
+
<div style="margin-top:10px;"><?php echo $this->__("Clicking <b>Select language files</b> will allow you to manually select specific shop system texts in the selection window for translation."); ?></div>
|
42 |
+
|
43 |
+
<div style="margin-top:10px;"><?php echo $this->__("Clicking <b>Select all entries in language files without existing translations</b> will automatically select all files and check for missing translations. All entries without an existing translation will be exported."); ?></div>
|
44 |
+
<div><?php echo $this->__("<i><span style='color:red;'>Important:</span> We recommend using this setting only for the initial translation of a new online shop, as it will trigger a translation of ALL language files for the selected target language!</i>"); ?></div>
|
45 |
+
|
46 |
+
<div style="margin-top:10px;"><?php echo $this->__("Select the check box <b>Export SEO content?</b> if you would like to have the SEO content (e.g. keywords, search terms, meta tags, etc.) translated."); ?></div>
|
47 |
+
|
48 |
+
<div style="margin-top:10px;"><?php echo $this->__("Select the check box <b>Export attributes and attribute options?</b> if you would like to have the product attributes and associated values translated."); ?></div>
|
49 |
+
|
50 |
+
<div style="margin-top:10px;"><?php echo $this->__("Select the check box <b>Export URL keys?</b> if you would like to have URLs of products and categories translated."); ?></div>
|
51 |
+
|
52 |
+
<div style="margin-top:20px;"><?php echo $this->__("Clicking the button <b>Request free quotation now</b> will transmit your texts for translation to the translation portal, and you will receive a detailed quote for your translation project within the next 24 hours (weekdays)."); ?>
|
53 |
+
|
54 |
+
<div style="margin-top:10px;"><?php echo $this->__("Your Eurotext customer service representative will send your translations in a ZIP file. This zip file can be uploaded and imported to the relevant project."); ?></div>
|
55 |
+
|
56 |
+
<div style="margin-top:10px;"><?php echo $this->__("<b>Please note:</b> For safety reasons, we recommend testing the import on a staging system first. Make sure to back up all your data before importing."); ?></div>
|
57 |
+
|
58 |
+
<div style="margin-top:10px;"><?php echo $this->__("Please read the translationMANAGER documentation for more information."); ?></div>
|
59 |
+
|
60 |
+
<div> </div>
|
61 |
+
<div style="border:1px solid black;padding:20px;display:inline-block;">
|
62 |
+
<table width="900" border="0">
|
63 |
+
<tr>
|
64 |
+
<td width="445" class="edittext"><p align="left">
|
65 |
+
<strong><?php echo $this->__("Contact"); ?> Eurotext AG </strong></td>
|
66 |
+
</tr>
|
67 |
+
<tr>
|
68 |
+
<td height="135" class="edittext">
|
69 |
+
<p class="edittext" align="left">
|
70 |
+
<span class="logo_eurotext"></span><br>
|
71 |
+
Eurotext AG<br>
|
72 |
+
Schürerstraße 3<br>
|
73 |
+
97080 Würzburg<br>
|
74 |
+
Deutschland<br><br>
|
75 |
+
<?php echo $this->__("Phone"); ?>: +49 (0)931 35 40 50<br>
|
76 |
+
<?php echo $this->__("Telefax"); ?>: +49 (0)931 35 40 580<br>
|
77 |
+
E-Mail: <a href="mailto:>info@eurotext.de">info@eurotext.de</a><br>
|
78 |
+
Web: <a href="http://www.eurotext.de" target="_blank">www.eurotext.de</a>
|
79 |
+
</p>
|
80 |
+
<p class="edittext" align="left"> </p>
|
81 |
+
</td>
|
82 |
+
</tr>
|
83 |
+
</table>
|
84 |
+
</div>
|
85 |
+
|
86 |
</td>
|
87 |
</tr>
|
88 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php /** @var $this Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Import_Overview */ ?>
|
2 |
+
<script>
|
3 |
+
document.observe('dom:loaded', function () {
|
4 |
+
|
5 |
+
function addEntryToList(message, cssClass) {
|
6 |
+
cssClass = typeof cssClass !== 'undefined' ? cssClass : '';
|
7 |
+
|
8 |
+
var li = new Template('<li class="#{cssClass}">#{message}</li>');
|
9 |
+
$('import-status').insert({
|
10 |
+
bottom: li.evaluate({cssClass: cssClass, message: message})
|
11 |
+
});
|
12 |
+
}
|
13 |
+
|
14 |
+
function processImportFile() {
|
15 |
+
if (continueImport) {
|
16 |
+
new Ajax.Request(url, {
|
17 |
+
onSuccess: function (response) {
|
18 |
+
addEntryToList(response.responseJSON.message, response.responseJSON.class);
|
19 |
+
continueImport = response.responseJSON.continueImport;
|
20 |
+
processImportFile();
|
21 |
+
if (!continueImport) {
|
22 |
+
var text = Translator.translate('Back to Project');
|
23 |
+
var button = '<button type="button" onclick="location.href=\'' + successUrl + '\'" style=""><span><span>' + text + '</span></span></button>';
|
24 |
+
$('import-status').insert({bottom: '<li class="success">' + button + '</li>'})
|
25 |
+
}
|
26 |
+
},
|
27 |
+
onFailure: function (response) {
|
28 |
+
if (response.responseJSON == null) {
|
29 |
+
addEntryToList(Translator.translate('Something went wrong while importing, please try again.'));
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
addEntryToList(response.responseJSON.message, response.responseJSON.class);
|
33 |
+
continueImport = false;
|
34 |
+
},
|
35 |
+
onException: function (request, exception) {
|
36 |
+
addEntryToList(
|
37 |
+
new Template(
|
38 |
+
Translator.translate('Something went wrong while importing: "#{error}". Please try again.')
|
39 |
+
).evaluate({error: exception.message})
|
40 |
+
);
|
41 |
+
continueImport = false;
|
42 |
+
}
|
43 |
+
});
|
44 |
+
url = processFilesFromQueueUrl;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
var url = '<?php echo $this->getAddFilesToImportQueueUrl(); ?>';
|
49 |
+
var processFilesFromQueueUrl = '<?php echo $this->getProcessFilesFromQueueUrl(); ?>';
|
50 |
+
var continueImport = true;
|
51 |
+
var successUrl = '<?php echo $this->getSuccessUrl(); ?>';
|
52 |
+
|
53 |
+
processImportFile();
|
54 |
+
});
|
55 |
+
</script>
|
56 |
+
<ul class="eurotext_import_status" id="import-status">
|
57 |
+
<li class="ok"><?php echo $this->__('Your data are imported, please stay tuned. '); ?></li>
|
58 |
+
<li class="error">
|
59 |
+
<?php echo $this->__(
|
60 |
+
'This process may take a few minutes depending on project size. Please wait until a message is displayed that the import has been completed.'
|
61 |
+
); ?>
|
62 |
+
</li>
|
63 |
+
</ul>
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php /** @var Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Emails_Note $this */ ?>
|
2 |
+
<ul class="messages">
|
3 |
+
<li class="notice-msg">
|
4 |
+
<ul>
|
5 |
+
<li>
|
6 |
+
<span>
|
7 |
+
<?php echo $this->__(
|
8 |
+
'To translate the Email Templates, we need to translate header.phtml and footer.phtml. We have prechecked these two files for you! If you do not want these files translated, please uncheck them.'
|
9 |
+
); ?>
|
10 |
+
</span>
|
11 |
+
</li>
|
12 |
+
<li>
|
13 |
+
<span>
|
14 |
+
<?php echo $this->__(
|
15 |
+
'Email Templates which origin from a file are written back to a file after translation. Email Templates from the database are written back to the database with the language prefix "[%s]".',
|
16 |
+
$this->getLanguageFromProject()
|
17 |
+
); ?>
|
18 |
+
</span>
|
19 |
+
</li>
|
20 |
+
</ul>
|
21 |
+
</li>
|
22 |
+
</ul>
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="bulk_sku form-list" id="bulk_sku" style="display: none;">
|
2 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Bulk add products by sku'); ?></h4>
|
3 |
+
<textarea class="input-text" name="bulk_sku" id="bulk_sku"></textarea><br/>
|
4 |
+
<p class="note">
|
5 |
+
<span>
|
6 |
+
<?php echo $this->__('Please enter a list of comma separated SKUs to select all appropriate products.'); ?>
|
7 |
+
</span>
|
8 |
+
</p>
|
9 |
+
</div>
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php /** @var Eurotext_TranslationManager_Model_Project $project */ ?>
|
2 |
+
<?php $project = Mage::registry('project'); ?>
|
3 |
+
<?php $disabled = $project->isEditable() ? 'false' : 'true'; ?>
|
4 |
+
<?php $_divId = 'tree-div_' . time() ?>
|
5 |
+
<div id="<?php echo $_divId ?>" class="tree"></div>
|
6 |
+
|
7 |
+
<script type="text/javascript">
|
8 |
+
//# sourceURL=category_tree.phtml
|
9 |
+
//<![CDATA[
|
10 |
+
|
11 |
+
var tree;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Fix ext compatibility with prototype 1.6
|
15 |
+
*/
|
16 |
+
Ext.lib.Event.getTarget = function (e) {
|
17 |
+
var ee = e.browserEvent || e;
|
18 |
+
return ee.target ? Event.element(ee) : null;
|
19 |
+
};
|
20 |
+
|
21 |
+
Ext.tree.TreePanel.Enhanced = function (el, config) {
|
22 |
+
Ext.tree.TreePanel.Enhanced.superclass.constructor.call(this, el, config);
|
23 |
+
};
|
24 |
+
|
25 |
+
Ext.extend(Ext.tree.TreePanel.Enhanced, Ext.tree.TreePanel, {
|
26 |
+
|
27 |
+
loadTree: function (config, firstLoad) {
|
28 |
+
var parameters = config['parameters'];
|
29 |
+
var data = config['data'];
|
30 |
+
|
31 |
+
if ((typeof parameters['root_visible']) != 'undefined') {
|
32 |
+
this.rootVisible = parameters['root_visible'] * 1;
|
33 |
+
}
|
34 |
+
|
35 |
+
var root = new Ext.tree.TreeNode(parameters);
|
36 |
+
|
37 |
+
this.setRootNode(root);
|
38 |
+
|
39 |
+
if (firstLoad) {
|
40 |
+
this.addListener('click', this.categoryClick.createDelegate(this));
|
41 |
+
}
|
42 |
+
|
43 |
+
this.loader.buildCategoryTree(root, data);
|
44 |
+
this.el.dom.innerHTML = '';
|
45 |
+
// render the tree
|
46 |
+
this.render();
|
47 |
+
},
|
48 |
+
|
49 |
+
categoryClick: function (node, e) {
|
50 |
+
productGridJsObject.reloadParams.category_id = node.id;
|
51 |
+
if (!Ajax.activeRequestCount) {
|
52 |
+
productGridJsObject.reload();
|
53 |
+
}
|
54 |
+
}
|
55 |
+
});
|
56 |
+
|
57 |
+
Ext.onReady(function () {
|
58 |
+
var categoryLoader = new Ext.tree.TreeLoader({
|
59 |
+
dataUrl: '<?php echo $this->getLoadTreeUrl() ?>'
|
60 |
+
});
|
61 |
+
|
62 |
+
categoryLoader.createNode = function (config) {
|
63 |
+
config.uiProvider = Ext.tree.TreeNodeUI;
|
64 |
+
var node;
|
65 |
+
if (config.children && !config.children.length) {
|
66 |
+
delete(config.children);
|
67 |
+
node = new Ext.tree.AsyncTreeNode(config);
|
68 |
+
} else {
|
69 |
+
node = new Ext.tree.TreeNode(config);
|
70 |
+
}
|
71 |
+
node.disabled = <?php echo $disabled; ?>;
|
72 |
+
return node;
|
73 |
+
};
|
74 |
+
|
75 |
+
categoryLoader.buildCategoryTree = function (parent, config) {
|
76 |
+
if (!config) return null;
|
77 |
+
|
78 |
+
if (parent && config && config.length) {
|
79 |
+
for (var i = 0; i < config.length; i++) {
|
80 |
+
config[i].uiProvider = Ext.tree.TreeNodeUI;
|
81 |
+
var node;
|
82 |
+
var _node = Object.clone(config[i]);
|
83 |
+
if (_node.children && !_node.children.length) {
|
84 |
+
delete(_node.children);
|
85 |
+
node = new Ext.tree.AsyncTreeNode(_node);
|
86 |
+
} else {
|
87 |
+
node = new Ext.tree.TreeNode(config[i]);
|
88 |
+
}
|
89 |
+
node.disabled = <?php echo $disabled; ?>;
|
90 |
+
parent.appendChild(node);
|
91 |
+
node.loader = node.getOwnerTree().loader;
|
92 |
+
if (_node.children) {
|
93 |
+
this.buildCategoryTree(node, _node.children);
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
};
|
98 |
+
|
99 |
+
categoryLoader.buildHash = function (node) {
|
100 |
+
var hash = this.toArray(node.attributes);
|
101 |
+
|
102 |
+
if (node.childNodes.length > 0 || (node.loaded == false && node.loading == false)) {
|
103 |
+
hash['children'] = [];
|
104 |
+
|
105 |
+
for (var i = 0, len = node.childNodes.length; i < len; i++) {
|
106 |
+
if (!hash['children']) {
|
107 |
+
hash['children'] = [];
|
108 |
+
}
|
109 |
+
hash['children'].push(this.buildHash(node.childNodes[i]));
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
return hash;
|
114 |
+
};
|
115 |
+
|
116 |
+
categoryLoader.toArray = function (attributes) {
|
117 |
+
var data = {};
|
118 |
+
for (var key in attributes) {
|
119 |
+
data[key] = attributes[key];
|
120 |
+
}
|
121 |
+
|
122 |
+
return data;
|
123 |
+
};
|
124 |
+
|
125 |
+
categoryLoader.on("beforeload", function (treeLoader, node) {
|
126 |
+
treeLoader.baseParams.id = node.attributes.id;
|
127 |
+
});
|
128 |
+
|
129 |
+
categoryLoader.on("load", function (treeLoader, node, config) {
|
130 |
+
varienWindowOnload();
|
131 |
+
});
|
132 |
+
|
133 |
+
tree = new Ext.tree.TreePanel.Enhanced('<?php echo $_divId ?>', {
|
134 |
+
animate: false,
|
135 |
+
loader: categoryLoader,
|
136 |
+
enableDD: false,
|
137 |
+
containerScroll: true,
|
138 |
+
rootVisible: '<?php echo $this->getRoot()->getIsVisible() ?>',
|
139 |
+
useAjax: <?php echo $this->getUseAjax() ?>,
|
140 |
+
currentNodeId: <?php echo (int)$this->getCategoryId() ?>,
|
141 |
+
addNodeTo: false
|
142 |
+
});
|
143 |
+
|
144 |
+
// set the root node
|
145 |
+
var parameters = {
|
146 |
+
text: '<?php echo htmlentities($this->getRoot()->getName()) ?>',
|
147 |
+
draggable: false,
|
148 |
+
allowDrop: <?php if ($this->getRoot()->getIsVisible()): ?>true<?php else : ?>false<?php endif; ?>,
|
149 |
+
id: <?php echo (int)$this->getRoot()->getId() ?>,
|
150 |
+
expanded: <?php echo (int)$this->getIsWasExpanded() ?>,
|
151 |
+
category_id: <?php echo (int)$this->getCategoryId() ?>
|
152 |
+
};
|
153 |
+
|
154 |
+
tree.loadTree({parameters: parameters, data:<?php echo $this->getTreeJson() ?>}, true);
|
155 |
+
});
|
156 |
+
//]]>
|
157 |
+
</script>
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script>
|
2 |
+
//# sourceURL=script.phtml
|
3 |
+
|
4 |
+
<?php if(!$this->getRequest()->getParam('category_id')): ?>
|
5 |
+
$$('.x-tree-selected').each(function (elem) {
|
6 |
+
elem.removeClassName('x-tree-selected')
|
7 |
+
});
|
8 |
+
<?php endif; ?>
|
9 |
+
</script>
|
@@ -1,392 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// utf8-detection: öäü€
|
3 |
-
|
4 |
-
$helper=Mage::helper('eurotext_translationmanager');
|
5 |
-
|
6 |
-
?>
|
7 |
-
|
8 |
-
<div class="content-header">
|
9 |
-
<table cellspacing="0">
|
10 |
-
<tbody><tr>
|
11 |
-
<td style="width:50%;"><h3 class="icon-head head-products">translationMANAGER <?php echo $this->__("Projects"); ?></h3></td>
|
12 |
-
<td class="a-right">
|
13 |
-
<button id="eurotext_newproject" title="New project" type="button" class="scalable add" onclick="setLocation('<?php echo $this->getNewProjectUrl(); ?>')" style=""><span><?php echo $this->__("New project"); ?></span></button>
|
14 |
-
</td>
|
15 |
-
</tr>
|
16 |
-
</tbody></table>
|
17 |
-
</div>
|
18 |
-
|
19 |
-
<div class="grid">
|
20 |
-
<div class="hor-scroll">
|
21 |
-
<table cellspacing="0" class="data" id="projectsGrid_table">
|
22 |
-
<colgroup>
|
23 |
-
<col width="140" class="a-center" />
|
24 |
-
<col width="60" />
|
25 |
-
</colgroup>
|
26 |
-
<thead>
|
27 |
-
<tr class="headings">
|
28 |
-
<th><a href="#" name="name" title="asc" class="not-sort"><span class="sort-title"><?php echo $this->__("Last update"); ?></span></a></th>
|
29 |
-
<th><span class="nobr"><a href="#" name="entity_id" title="asc" class="sort-title"><span class="sort-title"><?php echo $this->__("ID"); ?></span></a></th>
|
30 |
-
<th><a href="#" name="name" title="asc" class="not-sort"><span class="sort-title"><?php echo $this->__("Project name"); ?></span></a></th>
|
31 |
-
<th><a href="#" name="name" title="asc" class="not-sort"><span class="sort-title"><?php echo $this->__("Source storeview"); ?></span></a></th>
|
32 |
-
<th><a href="#" name="name" title="asc" class="not-sort"><span class="sort-title"><?php echo $this->__("Target storeview"); ?></span></a></th>
|
33 |
-
<th><a href="#" name="name" title="asc" class="not-sort"><span class="sort-title"><?php echo $this->__("Status"); ?></span></a></th>
|
34 |
-
<th class="no-link last"><span class="nobr"><?php echo $this->__("Action"); ?></span></th>
|
35 |
-
</tr>
|
36 |
-
<!--<tr class="filter">
|
37 |
-
<th><span class="timestamp"><input type="text" id="last_update" value="" class="input-text no-changes"></span></th>
|
38 |
-
<th><span class="number"><input type="text" id="id" value="" class="input-text no-changes"></span></th>
|
39 |
-
<th><span class="text"><input type="text" id="project_name" value="" class="input-text no-changes"></span></th>
|
40 |
-
<th><span class="text">
|
41 |
-
<select id="storeview_src" class="input-text no-changes">
|
42 |
-
<option value="-1">-- Choose Filter --</option>
|
43 |
-
<option value="0">xxx</option>
|
44 |
-
<option value="1">yyy</option>
|
45 |
-
</select>
|
46 |
-
</span></th>
|
47 |
-
<th><span class="text">
|
48 |
-
<select id="storeview_dst" class="input-text no-changes">
|
49 |
-
<option value="-1">-- Choose Filter --</option>
|
50 |
-
<option value="0">xxx</option>
|
51 |
-
<option value="1">yyy</option>
|
52 |
-
</select>
|
53 |
-
</span></th>
|
54 |
-
<th><span class="text">
|
55 |
-
<select id="project_status" class="input-text no-changes">
|
56 |
-
<option value="-1">Show All</option>
|
57 |
-
<option value="1">New</option>
|
58 |
-
<option value="2">In progress</option>
|
59 |
-
</select>
|
60 |
-
</span></th>
|
61 |
-
<th class=" no-link last"> </th>
|
62 |
-
</tr>-->
|
63 |
-
</thead>
|
64 |
-
<tbody>
|
65 |
-
<?php
|
66 |
-
$projects=$this->getProjects();
|
67 |
-
if (count($projects)==0)
|
68 |
-
{
|
69 |
-
?>
|
70 |
-
<tr class="even pointer">
|
71 |
-
<td colspan="7">- <?php echo $this->__("No projects created"); ?> -</td>
|
72 |
-
</tr>
|
73 |
-
<?php
|
74 |
-
}
|
75 |
-
else
|
76 |
-
{
|
77 |
-
$alt=0;
|
78 |
-
foreach($projects as $project)
|
79 |
-
{
|
80 |
-
$alt=1-$alt;
|
81 |
-
$trClass="even pointer";
|
82 |
-
if ($alt==1)
|
83 |
-
{
|
84 |
-
$trClass="odd pointer";
|
85 |
-
}
|
86 |
-
|
87 |
-
if ($project['id']==$this->getSelectedProjectId())
|
88 |
-
{
|
89 |
-
$trClass="selected_project pointer";
|
90 |
-
}
|
91 |
-
|
92 |
-
$row_url=$this->getProjectUrl($project['id']);
|
93 |
-
|
94 |
-
echo "<tr title='".$row_url."' class='".$trClass."'>";
|
95 |
-
{
|
96 |
-
echo "<td>".$project['last_update']."</td>";
|
97 |
-
echo "<td>".$project['id']."</td>";
|
98 |
-
echo "<td>".$this->htmlEscape($project['project_name'])."</td>";
|
99 |
-
echo "<td>".$this->getStoreviewTitle($project['storeview_src'])."</td>";
|
100 |
-
echo "<td>".$this->getStoreviewTitle($project['storeview_dst'])."</td>";
|
101 |
-
echo "<td>".$this->getStatusText($project['project_status'])."</td>";
|
102 |
-
echo "<td>";
|
103 |
-
|
104 |
-
if ($project['project_status']==0) // new
|
105 |
-
{
|
106 |
-
echo "<a href='".$row_url."'>".$this->__("Edit")."</a>";
|
107 |
-
}
|
108 |
-
else if ($project['project_status']==1) // in_progress
|
109 |
-
{
|
110 |
-
echo "<a href='".$row_url."'>".$this->__("Import")."</a>";
|
111 |
-
}
|
112 |
-
else if ($project['project_status']==2) // in_progress
|
113 |
-
{
|
114 |
-
echo "<a href='".$row_url."'>".$this->__("Import")."</a>";
|
115 |
-
}
|
116 |
-
else if ($project['project_status']==3) // done
|
117 |
-
{
|
118 |
-
echo "<a href='".$row_url."'>".$this->__("Loaded")."</a>";
|
119 |
-
}
|
120 |
-
|
121 |
-
$rowdel_url=$this->getProjectDeleteUrl($project['id']);
|
122 |
-
echo " <a href='".$rowdel_url."' onclick='return eurotext_confirmdelete()'>".$this->__("Delete")."</a>";
|
123 |
-
|
124 |
-
if ($project['project_status']>0)
|
125 |
-
{
|
126 |
-
$rowreset_url=$this->getProjectResetUrl($project['id']);
|
127 |
-
echo " <a href='".$rowreset_url."' onclick='return eurotext_confirmreset()'>".$this->__("Reset")."</a>";
|
128 |
-
}
|
129 |
-
|
130 |
-
echo "<input type='hidden' id='dummyinput_".$project['id']."' value='1' />"; // magento's grid needs this
|
131 |
-
echo "</td>";
|
132 |
-
}
|
133 |
-
echo "</tr>";
|
134 |
-
}
|
135 |
-
}
|
136 |
-
?>
|
137 |
-
</tbody>
|
138 |
-
</table>
|
139 |
-
</div>
|
140 |
-
</div>
|
141 |
-
|
142 |
-
<script type="text/javascript">
|
143 |
-
eurotextGridJsObject = new varienGrid('projectsGrid', '', 'page', 'sort', 'dir', 'product_filter');
|
144 |
-
eurotextGridJsObject.useAjax = '1';
|
145 |
-
eurotextGridJsObject.rowClickCallback = openGridRow;
|
146 |
-
</script>
|
147 |
-
|
148 |
-
<hr size="1" color="black" style="margin:20px;" />
|
149 |
-
|
150 |
-
<?php
|
151 |
-
$project_id=$this->getSelectedProjectId();
|
152 |
-
if ($project_id>0)
|
153 |
-
{
|
154 |
-
$project=$this->getSelectedProject();
|
155 |
-
|
156 |
-
echo "<script>";
|
157 |
-
echo "var eurotext_project_saveurl='".$this->getSaveProjectUrl()."';";
|
158 |
-
echo "var eurotext_project_sendurl='".$this->getAjaxExportUrl()."';";
|
159 |
-
echo "var eurotext_project_importstepurl='".$this->getAjaxImportStepUrl()."';";
|
160 |
-
echo "var eurotext_project_id=".$project['id'].";";
|
161 |
-
echo "var eurotext_formkey='".Mage::getSingleton('core/session')->getFormKey()."'";
|
162 |
-
echo "</script>";
|
163 |
-
|
164 |
-
$uploadboxTitle=$this->__("Quote request");
|
165 |
-
|
166 |
-
$disabledStr="";
|
167 |
-
$cannotChangeInfo="";
|
168 |
-
if ($project['project_status']>0)
|
169 |
-
{
|
170 |
-
$uploadboxTitle=$this->__("Import translations");
|
171 |
-
|
172 |
-
$disabledStr=" disabled='disabled'";
|
173 |
-
$cannotChangeInfo="<span style='font-size:10pt;color:red;font-weight:bold;'>".$this->__("Already submitted. Project settings can no longer be edited.")."</span>";
|
174 |
-
}
|
175 |
-
|
176 |
-
$canExportUrlKeysStyle="";
|
177 |
-
if($helper->urlKeyScopeIsGlobal())
|
178 |
-
{
|
179 |
-
$canExportUrlKeysStyle="disabled='disabled' style='color:gray;'";
|
180 |
-
$project['export_urlkeys']=false;
|
181 |
-
}
|
182 |
-
?>
|
183 |
-
<div class="project_settings">
|
184 |
-
|
185 |
-
<div id="seite_links" style="display:inline-block;margin-right:10px;">
|
186 |
-
<div class="grid eurotext_grid">
|
187 |
-
<table class="data" cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
188 |
-
<tr class="headings">
|
189 |
-
<td colspan="4" class="eurotext_head2"><?php echo $this->__("Project settings"); ?> '<?php echo $this->htmlEscape($project['project_name']); ?>' (Nr <?php echo $project_id; ?>) <?php echo $cannotChangeInfo; ?></td>
|
190 |
-
</tr>
|
191 |
-
<tr class="headings">
|
192 |
-
<td class="eurotext_head"><?php echo $this->__("Action"); ?></td>
|
193 |
-
<td class="eurotext_head"> </td>
|
194 |
-
<td class="eurotext_head"><?php echo $this->__("Note"); ?></td>
|
195 |
-
<td class="eurotext_head"><?php echo $uploadboxTitle; ?></td>
|
196 |
-
</tr>
|
197 |
-
<tr>
|
198 |
-
<td class="eurotext_td"><?php echo $this->__("Project name"); ?></td>
|
199 |
-
<td>
|
200 |
-
<input <?php echo $disabledStr; ?> type="text" class="editinput" size="50" maxlength="255" autocomplete="off" id="form_project_name" value="<?php echo $this->htmlEscape($project['project_name']); ?>" >
|
201 |
-
</td>
|
202 |
-
<td><?php echo $this->__("Create a unique project name here. This will allow you better recognize your various projects later."); ?></td>
|
203 |
-
<td rowspan="10" style="background-color:#FAFAFA;">
|
204 |
-
<!-- Anfang rechte Seite -->
|
205 |
-
<div class="seite_rechts" style="display:inline-block;">
|
206 |
-
|
207 |
-
<?php
|
208 |
-
if ($project['project_status']==0)
|
209 |
-
{
|
210 |
-
?>
|
211 |
-
|
212 |
-
<div style="margin:10px;border:2px dashed black; padding:10px;display:inline-block; background-color:#F7C27E;">
|
213 |
-
<table cellspacing="0" cellpadding="0" border="0" style="border:0px;">
|
214 |
-
<tr style="border:0px;">
|
215 |
-
<td style="border:0px;background-color:#F7C27E;"><?php echo $this->__("Select product texts, category texts, or CMS pages for translation."); ?><br><br>
|
216 |
-
<?php echo $this->__("Clicking the button below will transmit the selected texts to the translation portal, and you will receive a detailed quote for the translation of your texts within 24h (weekdays)."); ?><br><br>
|
217 |
-
<?php echo $this->__("This process may take a few minutes depending on project size. Please wait until a message is displayed that the import has been completed."); ?></td>
|
218 |
-
</tr>
|
219 |
-
<tr style="border:0px;">
|
220 |
-
<td style="border:0px;background-color:#F7C27E;">
|
221 |
-
<input id="eurotext_angebot_btt" class="et_btt" type="button" name="save" value=" <?php echo $this->__("Request your free quote now"); ?> " onClick="return eurotext_sendproject()" /><br>
|
222 |
-
</td>
|
223 |
-
</tr>
|
224 |
-
<tr style="border:0px;">
|
225 |
-
<td style="border:0px;background-color:#F7C27E;"><span id="eurotext_sendprogress"></span></td>
|
226 |
-
</tr>
|
227 |
-
</table>
|
228 |
-
</div>
|
229 |
-
|
230 |
-
<?php
|
231 |
-
}
|
232 |
-
|
233 |
-
if ($project['project_status']==1)
|
234 |
-
{
|
235 |
-
?>
|
236 |
-
|
237 |
-
<div style="margin:10px;border:2px dashed black; padding:10px;display:inline-block;background-color:#F7C27E;">
|
238 |
-
<form id="zipfile_form" action="<?php echo $this->getUploadUrl(); ?>" method="post" enctype="multipart/form-data">
|
239 |
-
<input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
|
240 |
-
<table cellspacing="0" cellpadding="0" border="0" style="border:0px;">
|
241 |
-
<tr>
|
242 |
-
<td style="border:0px;background-color:#F7C27E;">
|
243 |
-
<div><?php echo $this->__("Import the *.zip file containing the finished translations here"); ?>:</div>
|
244 |
-
<div><input type="file" accept="application/zip" name="zipfile" id="zipfile" /></div>
|
245 |
-
</td>
|
246 |
-
</tr>
|
247 |
-
<tr height="10">
|
248 |
-
<td style="border:0px;background-color:#F7C27E;"> </td>
|
249 |
-
</tr>
|
250 |
-
<tr>
|
251 |
-
<td style="border:0px;background-color:#F7C27E;text-align:center;">
|
252 |
-
<a class="et_btt" href="#" onclick="return eurotext_uploadzip()"><?php echo $this->__("Import translations now"); ?></a>
|
253 |
-
</td>
|
254 |
-
</tr>
|
255 |
-
</table>
|
256 |
-
|
257 |
-
<?php
|
258 |
-
if ($helper->getDebugMode())
|
259 |
-
{
|
260 |
-
$zip_url=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)."var/export/".$project['zip_filename'];
|
261 |
-
echo '<div> </div>';
|
262 |
-
echo '<div>(Debug) Vom Modul erstellte *.zip-Datei: <a href="'.$zip_url.'">'.$project['zip_filename'].'</a></div>';
|
263 |
-
}
|
264 |
-
?>
|
265 |
-
|
266 |
-
</form>
|
267 |
-
</div>
|
268 |
-
|
269 |
-
<?php
|
270 |
-
}
|
271 |
-
|
272 |
-
if ($project['project_status']==2)
|
273 |
-
{
|
274 |
-
?>
|
275 |
-
|
276 |
-
<div style="margin:10px;border:2px dashed black; padding:10px;display:inline-block;background-color:#F7C27E;">
|
277 |
-
<table cellspacing="0" cellpadding="0" border="0" style="border:0px;">
|
278 |
-
<tr>
|
279 |
-
<td style="border:0px;background-color:#F7C27E;">
|
280 |
-
<div><?php echo $this->__("The *.zip-File was extracted. Click “Begin import” to upload the translations."); ?></div>
|
281 |
-
<div><?php echo $this->__("We recommend creating a backup before importing."); ?></div>
|
282 |
-
</td>
|
283 |
-
</tr>
|
284 |
-
<tr height="10">
|
285 |
-
<td style="border:0px;background-color:#F7C27E;"> </td>
|
286 |
-
</tr>
|
287 |
-
<tr>
|
288 |
-
<td style="border:0px;background-color:#F7C27E;text-align:center;">
|
289 |
-
<a class="et_btt" id="eurotext_importbtt" href="#" onclick="return eurotext_startimport()"><?php echo $this->__("Begin import"); ?></a>
|
290 |
-
</td>
|
291 |
-
</tr>
|
292 |
-
<tr>
|
293 |
-
<td style="border:0px;background-color:#F7C27E;"><span id="eurotext_importprogress"></span></td>
|
294 |
-
</tr>
|
295 |
-
</table>
|
296 |
-
</div>
|
297 |
-
|
298 |
-
<?php
|
299 |
-
}
|
300 |
-
?>
|
301 |
-
</div>
|
302 |
-
<!-- Ende rechte Seite -->
|
303 |
-
</td>
|
304 |
-
</tr>
|
305 |
-
<tr>
|
306 |
-
<td>Storeview</td>
|
307 |
-
<td class="eurotext_td">
|
308 |
-
<div><?php echo $this->__("Source storeview"); ?></div>
|
309 |
-
<div><?php echo $this->getSpracheSelect('form_storeview_src',$project['storeview_src'],$disabledStr); ?></div>
|
310 |
-
<div> </div>
|
311 |
-
<div><?php echo $this->__("Target storeview"); ?></div>
|
312 |
-
<div><?php echo $this->getSpracheSelect('form_storeview_dst',$project['storeview_dst'],$disabledStr); ?></div>
|
313 |
-
</td>
|
314 |
-
<td><?php echo $this->__("Specify the source language (source storeview) and the target language (target storeview).<br/>The language of the current storeview is shown in brackets. You can amend the language setting in Magento if the language shown is incorrect:<br/>System -> Configuration, then select “Storeview” at the top left. Set the correct language via General -> Locale Options (here you can also double-check all other language/country settings for your shop)"); ?></td>
|
315 |
-
</tr>
|
316 |
-
<tr>
|
317 |
-
<td style="text-align:center;">
|
318 |
-
<input <?php echo $disabledStr; ?> class="et_btt" type="button" value="<?php echo $this->__("Select products"); ?>" class="eurotext_td" onclick="return eurotext_select('<?php echo $this->getSelectUrl('selectproducts',$project_id); ?>','<?php echo $project_id; ?>','form_productmode')">
|
319 |
-
</td>
|
320 |
-
<td><?php echo $this->__("or"); ?> <input <?php echo $disabledStr; ?> class="eurotext_td" type="checkbox" id="form_productmode" value='1' <?php echo $this->GetCheckedStr($project['productmode']); ?>> <?php echo $this->__("Select all products without existing translations"); ?></td>
|
321 |
-
<td><?php echo $this->__("Selecting this check box will assign all items for which no text has been created in the target language.<br><b>Important: All previous assignments will be cancelled!</b>"); ?></b></td>
|
322 |
-
</tr>
|
323 |
-
<tr>
|
324 |
-
<td style="text-align:center;">
|
325 |
-
<input <?php echo $disabledStr; ?> type="button" value="<?php echo $this->__("Select categories"); ?>" class="et_btt" onclick="return eurotext_select('<?php echo $this->getSelectUrl('selectcategories',$project_id); ?>','<?php echo $project_id; ?>','form_categorymode')" >
|
326 |
-
</td>
|
327 |
-
<td><?php echo $this->__("or"); ?> <input <?php echo $disabledStr; ?> class="eurotext_td" type="checkbox" id="form_categorymode" autocomplete="off" value='1' <?php echo $this->GetCheckedStr($project['categorymode']); ?>> <?php echo $this->__("Select all categories without existing translations"); ?></td>
|
328 |
-
<td><?php echo $this->__("Selecting this check box will assign all categories for which no texts have been created in the target language.<br/><b>Important: All previous assignments will be cancelled!</b>"); ?></td>
|
329 |
-
</tr>
|
330 |
-
<tr>
|
331 |
-
<td style="text-align:center;">
|
332 |
-
<input <?php echo $disabledStr; ?> type="button" value="<?php echo $this->__("Select CMS pages"); ?>" class="et_btt" onclick="return eurotext_select('<?php echo $this->getSelectUrl('selectcmspages',$project_id); ?>','<?php echo $project_id; ?>','form_cmsmode')" >
|
333 |
-
</td>
|
334 |
-
<td><?php echo $this->__("or"); ?> <input <?php echo $disabledStr; ?> class="eurotext_td" type="checkbox" id="form_cmsmode" autocomplete="off" value='1' <?php echo $this->GetCheckedStr($project['cmsmode']); ?>> <?php echo $this->__("Select all CMS pages without existing translations"); ?></td>
|
335 |
-
<td><?php echo $this->__("Selecting this check box will assign all CMS pages without existing target language translations.<br/><b>Important: All previous assignments will be cancelled!</b>"); ?></td>
|
336 |
-
</tr>
|
337 |
-
<tr>
|
338 |
-
<td style="text-align:center;">
|
339 |
-
<input <?php echo $disabledStr; ?> type="button" value="<?php echo $this->__("Select email templates"); ?>" class="et_btt" onclick="return eurotext_select('<?php echo $this->getSelectUrl('selectemails',$project_id); ?>','<?php echo $project_id; ?>','form_templatemode')" >
|
340 |
-
</td>
|
341 |
-
<td><?php echo $this->__("or"); ?> <input <?php echo $disabledStr; ?> class="eurotext_td" type="checkbox" id="form_templatemode" autocomplete="off" value='1' <?php echo $this->GetCheckedStr($project['templatemode']); ?>> <?php echo $this->__("Select all email templates without existing translations"); ?></td>
|
342 |
-
<td><?php echo $this->__("Selecting this check box will export all email templates without a counterpart in the target language.<br><b>Important: All previous assignments will be cancelled!</b>"); ?></td>
|
343 |
-
</tr>
|
344 |
-
<tr>
|
345 |
-
<td style="text-align:center;">
|
346 |
-
<input <?php echo $disabledStr; ?> type="button" value="<?php echo $this->__("Select language files"); ?>" class="et_btt" onclick="return eurotext_select('<?php echo $this->getSelectUrl('selectlangfiles',$project_id); ?>','<?php echo $project_id; ?>','form_langfilesmode')" >
|
347 |
-
</td>
|
348 |
-
<td><?php echo $this->__("or"); ?> <input <?php echo $disabledStr; ?> class="eurotext_td" type="checkbox" id="form_langfilesmode" autocomplete="off" value='1' <?php echo $this->GetCheckedStr($project['langfilesmode']); ?>> <?php echo $this->__("Select all entries in language files without existing translations"); ?></td>
|
349 |
-
<td><?php echo $this->__("Selecting this check box will trigger a check of all language files for missing translations. All entries without an existing translation will be exported.<br><b>Important: All previous assignments will be cancelled!</b>"); ?></td>
|
350 |
-
</tr>
|
351 |
-
<tr>
|
352 |
-
<td><?php echo $this->__("Additional settings"); ?></td>
|
353 |
-
<td>
|
354 |
-
<div><input <?php echo $disabledStr; ?> class="eurotext_td" type="checkbox" id="form_export_seo" autocomplete="off" value='1' <?php echo $this->GetCheckedStr($project['export_seo']); ?>> 1) <?php echo $this->__("Export SEO content?"); ?></div>
|
355 |
-
<div> </div>
|
356 |
-
<div><input <?php echo $disabledStr; ?> class="eurotext_td" type="checkbox" id="form_export_attributes" autocomplete="off" value='1' <?php echo $this->GetCheckedStr($project['export_attributes']); ?>> 2) <?php echo $this->__("Export attributes und attribute options?"); ?></div>
|
357 |
-
<div> </div>
|
358 |
-
<div <?php echo $canExportUrlKeysStyle; ?>><input <?php echo $canExportUrlKeysStyle; ?> <?php echo $disabledStr; ?> class="eurotext_td" type="checkbox" id="form_export_urlkeys" autocomplete="off" value='1' <?php echo $this->GetCheckedStr($project['export_urlkeys']); ?>> 3) <?php echo $this->__("Export URL keys?"); ?></div>
|
359 |
-
</td>
|
360 |
-
<td>
|
361 |
-
<div>1) <?php echo $this->__("Select this check box if you wish to translate your SEO content (keywords, meta tags, etc.)."); ?></div>
|
362 |
-
<div> </div>
|
363 |
-
<div>2) <?php echo $this->__("Select this check box if you wish to translate product attributes and associated values."); ?></div>
|
364 |
-
<div> </div>
|
365 |
-
<div <?php echo $canExportUrlKeysStyle; ?>>3) <?php echo $this->__("Select this check box if you wish to translate product and category URLs"); ?></div>
|
366 |
-
</td>
|
367 |
-
</tr>
|
368 |
-
</table>
|
369 |
-
</div>
|
370 |
-
</div>
|
371 |
-
|
372 |
-
<div style="margin-top:20px;">
|
373 |
-
<input <?php echo $disabledStr; ?> type="submit" class="et_btt" id="btt_saveproject" value=" <?php echo $this->__("Save"); ?> " onclick="return eurotext_saveproject(eurotext_reloadpage)">
|
374 |
-
<br><span id="eurotext_saving"></span>
|
375 |
-
</div>
|
376 |
-
|
377 |
-
<!-- Ende linke Seite -->
|
378 |
-
</td>
|
379 |
-
<td>
|
380 |
-
|
381 |
-
</td>
|
382 |
-
</tr>
|
383 |
-
</table>
|
384 |
-
</div>
|
385 |
-
<?php
|
386 |
-
}
|
387 |
-
?>
|
388 |
-
|
389 |
-
<div> </div>
|
390 |
-
<div class="actions">
|
391 |
-
<ul><li><a class="firstitem" id="btn.help" href="<?php echo Mage::helper('adminhtml')->getUrl('*/eurotext_translationmanager_help/index'); ?>" target="_blank"><?php echo $this->__("Open help"); ?></a></li></ul>
|
392 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,344 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// utf8-detection: öäü€
|
3 |
-
|
4 |
-
?>
|
5 |
-
|
6 |
-
<form id="et_form" action="<?php echo $this->getPostBackUrl(); ?>" method="get">
|
7 |
-
<div class="eurotext_confighead"><?php echo $this->__("Please enter your contact information here"); ?></div>
|
8 |
-
<div class="eurotext_config">
|
9 |
-
<table width="98%" class="form">
|
10 |
-
<tr>
|
11 |
-
<td colspan="2" class="eurotext_edittext"><?php echo $this->__("This information is your personal access data for the Eurotext AG translation portal.<br/>Registration is free of charge. You will receive your personal access information within 24 hours (weekdays)."); ?></td>
|
12 |
-
</tr>
|
13 |
-
</table>
|
14 |
-
<table class="form">
|
15 |
-
<tr>
|
16 |
-
<td class="eurotext_edittext"><label><?php echo $this->__("Shop Name"); ?>: </label></td>
|
17 |
-
<td class="eurotext_edittext"><input disabled="disabled" id="et_register_shopname" type="text" name="register_shopname" size="95"
|
18 |
-
class="defaultcontent"
|
19 |
-
value="<?php echo $this->getSetting("register_shopname"); ?>" >
|
20 |
-
</td>
|
21 |
-
</tr>
|
22 |
-
<tr>
|
23 |
-
<td class="eurotext_edittext"><label><?php echo $this->__("Shop URL"); ?>: </label></td>
|
24 |
-
<td class="eurotext_edittext"><input disabled="disabled" id="et_register_shopurl" type="text" name="register_url" size="95"
|
25 |
-
class="defaultcontent"
|
26 |
-
value="<?php echo $this->getSetting("register_url"); ?>" >
|
27 |
-
</td>
|
28 |
-
</tr>
|
29 |
-
<tr>
|
30 |
-
<td class="eurotext_edittext"><label><?php echo $this->__("eMail Address"); ?>: </label></td>
|
31 |
-
<td class="eurotext_edittext"><input disabled="disabled" id="et_register_email" type="text" name="register_email" size="95"
|
32 |
-
class="defaultcontent"
|
33 |
-
value="<?php echo $this->getSetting("register_email"); ?>" >
|
34 |
-
</td>
|
35 |
-
</tr>
|
36 |
-
<tr>
|
37 |
-
<td class="eurotext_edittext"><label><?php echo $this->__("Salutation"); ?>: </label></td>
|
38 |
-
<td class="eurotext_edittext">
|
39 |
-
<select disabled="disabled" name="register_sal" id="register_sal" >
|
40 |
-
<option value="MR" <?php if ($this->getSetting("register_sal")=="MR") { echo " selected='selected'"; } ?>><?php echo $this->__("Mr."); ?></option>
|
41 |
-
<option value="MRS" <?php if ($this->getSetting("register_sal")=="MRS") { echo " selected='selected'"; } ?>><?php echo $this->__("Ms."); ?></option>
|
42 |
-
</select>
|
43 |
-
</td>
|
44 |
-
</tr>
|
45 |
-
<tr>
|
46 |
-
<td class="eurotext_edittext"><label><?php echo $this->__("First Name"); ?>: </label></td>
|
47 |
-
<td class="eurotext_edittext"><input disabled="disabled" id="et_register_firstname" type="text" name="register_fname" size="95"
|
48 |
-
class="defaultcontent"
|
49 |
-
value="<?php echo $this->getSetting("register_fname"); ?>" >
|
50 |
-
</td>
|
51 |
-
</tr>
|
52 |
-
<tr>
|
53 |
-
<td class="eurotext_edittext"><label><?php echo $this->__("Last Name"); ?>: </label></td>
|
54 |
-
<td class="eurotext_edittext"><input disabled="disabled" id="et_register_lastname" type="text" name="register_lname" size="95"
|
55 |
-
class="defaultcontent"
|
56 |
-
value="<?php echo $this->getSetting("register_lname"); ?>" >
|
57 |
-
</td>
|
58 |
-
</tr>
|
59 |
-
<tr>
|
60 |
-
<td class="eurotext_edittext"><label><?php echo $this->__("Company"); ?>: </label></td>
|
61 |
-
<td class="eurotext_edittext"><input disabled="disabled" id="et_register_company" type="text" name="register_company" size="95"
|
62 |
-
class="defaultcontent"
|
63 |
-
value="<?php echo $this->getSetting("register_company"); ?>" >
|
64 |
-
</td>
|
65 |
-
</tr>
|
66 |
-
<tr>
|
67 |
-
<td class="eurotext_edittext"><label><?php echo $this->__("Street"); ?> / <?php echo $this->__("House No"); ?>: </label></td>
|
68 |
-
<td class="eurotext_edittext"><input disabled="disabled" id="et_register_street" type="text" name="register_street" size="83"
|
69 |
-
class="defaultcontent" value="<?php echo $this->getSetting("register_street"); ?>" >
|
70 |
-
<input disabled="disabled" id="et_register_hnumber" type="text" name="register_hnumber" size="8"
|
71 |
-
class="defaultcontent" value="<?php echo $this->getSetting("register_hnumber"); ?>" >
|
72 |
-
</td>
|
73 |
-
</tr>
|
74 |
-
<tr>
|
75 |
-
<td class="eurotext_edittext"><label><?php echo $this->__("Zip"); ?> / <?php echo $this->__("City"); ?>: </label></td>
|
76 |
-
<td class="eurotext_edittext"><input disabled="disabled" id="et_register_zip" type="text" name="register_zip" size="8"
|
77 |
-
class="defaultcontent" value="<?php echo $this->getSetting("register_zip"); ?>" >
|
78 |
-
<input disabled="disabled" id="et_register_city" type="text" name="register_city" size="83"
|
79 |
-
class="defaultcontent" value="<?php echo $this->getSetting("register_city"); ?>">
|
80 |
-
</td>
|
81 |
-
</tr>
|
82 |
-
<tr>
|
83 |
-
<td class="eurotext_edittext"><label><?php echo $this->__("Country"); ?> </label></td>
|
84 |
-
<td class="eurotext_edittext">
|
85 |
-
<select disabled="disabled" name="register_country" id="register_country" >
|
86 |
-
<option value="Deutschland">Deutschland</option>
|
87 |
-
<option value="Österreich">Österreich</option>
|
88 |
-
<option value="Schweiz">Schweiz</option>
|
89 |
-
<option value="Afghanistan">Afghanistan</option>
|
90 |
-
<option value="Ägypten">Ägypten</option>
|
91 |
-
<option value="Albanien">Albanien</option>
|
92 |
-
<option value="Algerien">Algerien</option>
|
93 |
-
<option value="Andorra">Andorra</option>
|
94 |
-
<option value="Angola">Angola</option>
|
95 |
-
<option value="Antigua und Barbuda">Antigua und Barbuda</option>
|
96 |
-
<option value="Äquatorialguinea">Äquatorialguinea</option>
|
97 |
-
<option value="Argentinien">Argentinien</option>
|
98 |
-
<option value="Armenien">Armenien</option>
|
99 |
-
<option value="Aserbaidschan">Aserbaidschan</option>
|
100 |
-
<option value="Äthiopien">Äthiopien</option>
|
101 |
-
<option value="Australien">Australien</option>
|
102 |
-
<option value="Bahamas">Bahamas</option>
|
103 |
-
<option value="Bahrain">Bahrain</option>
|
104 |
-
<option value="Bangladesch">Bangladesch</option>
|
105 |
-
<option value="Barbados">Barbados</option>
|
106 |
-
<option value="Weißrussland">Weißrussland</option>
|
107 |
-
<option value="Belgien">Belgien</option>
|
108 |
-
<option value="Belize">Belize</option>
|
109 |
-
<option value="Benin">Benin</option>
|
110 |
-
<option value="Bhutan">Bhutan</option>
|
111 |
-
<option value="Bolivien">Bolivien</option>
|
112 |
-
<option value="Bosnien-Herzegowina">Bosnien-Herzegowina</option>
|
113 |
-
<option value="Botsuana">Botsuana</option>
|
114 |
-
<option value="Brasilien">Brasilien</option>
|
115 |
-
<option value="Brunei Darussalam">Brunei Darussalam</option>
|
116 |
-
<option value="Bulgarien">Bulgarien</option>
|
117 |
-
<option value="Burkina Faso">Burkina Faso</option>
|
118 |
-
<option value="Burundi">Burundi</option>
|
119 |
-
<option value="Cayman Islands">Cayman Islands</option>
|
120 |
-
<option value="Chile">Chile</option>
|
121 |
-
<option value="China">China</option>
|
122 |
-
<option value="Cookinseln">Cookinseln</option>
|
123 |
-
<option value="Costa Rica">Costa Rica</option>
|
124 |
-
<option value="Elfenbeinküste">Elfenbeinküste</option>
|
125 |
-
<option value="Dänemark">Dänemark</option>
|
126 |
-
<option value="Dominica">Dominica</option>
|
127 |
-
<option value="Dominikanische Republik">Dominikanische Republik</option>
|
128 |
-
<option value="Dschamahirija">Dschamahirija</option>
|
129 |
-
<option value="Dschibuti">Dschibuti</option>
|
130 |
-
<option value="Ecuador">Ecuador</option>
|
131 |
-
<option value="El Salvador">El Salvador</option>
|
132 |
-
<option value="England">England</option>
|
133 |
-
<option value="Eritrea">Eritrea</option>
|
134 |
-
<option value="Estland">Estland</option>
|
135 |
-
<option value="Fidschi">Fidschi</option>
|
136 |
-
<option value="Finnland">Finnland</option>
|
137 |
-
<option value="Frankreich">Frankreich</option>
|
138 |
-
<option value="Gabon">Gabon</option>
|
139 |
-
<option value="Gambia">Gambia</option>
|
140 |
-
<option value="Georgien">Georgien</option>
|
141 |
-
<option value="Ghana">Ghana</option>
|
142 |
-
<option value="Grenada">Grenada</option>
|
143 |
-
<option value="Griechenland">Griechenland</option>
|
144 |
-
<option value="Guatemala">Guatemala</option>
|
145 |
-
<option value="Guinea">Guinea</option>
|
146 |
-
<option value="Guinea-Bissau">Guinea-Bissau</option>
|
147 |
-
<option value="Guyana">Guyana</option>
|
148 |
-
<option value="Haiti">Haiti</option>
|
149 |
-
<option value="Heiliger Stuhl">Heiliger Stuhl</option>
|
150 |
-
<option value="Honduras">Honduras</option>
|
151 |
-
<option value="Indien">Indien</option>
|
152 |
-
<option value="Indonesien">Indonesien</option>
|
153 |
-
<option value="Irak">Irak</option>
|
154 |
-
<option value="Iran">Iran</option>
|
155 |
-
<option value="Irland">Irland</option>
|
156 |
-
<option value="Island">Island</option>
|
157 |
-
<option value="Israel">Israel</option>
|
158 |
-
<option value="Italien">Italien</option>
|
159 |
-
<option value="Jamaika">Jamaika</option>
|
160 |
-
<option value="Japan">Japan</option>
|
161 |
-
<option value="Jemen">Jemen</option>
|
162 |
-
<option value="Jordanien">Jordanien</option>
|
163 |
-
<option value="Jugoslawien">Jugoslawien</option>
|
164 |
-
<option value="Kambodscha">Kambodscha</option>
|
165 |
-
<option value="Kamerun">Kamerun</option>
|
166 |
-
<option value="Kanada">Kanada</option>
|
167 |
-
<option value="Kap Verde">Kap Verde</option>
|
168 |
-
<option value="Kasachstan">Kasachstan</option>
|
169 |
-
<option value="Katar">Katar</option>
|
170 |
-
<option value="Kenia">Kenia</option>
|
171 |
-
<option value="Kirgisistan">Kirgisistan</option>
|
172 |
-
<option value="Kiribati">Kiribati</option>
|
173 |
-
<option value="Kolumbien">Kolumbien</option>
|
174 |
-
<option value="Komoren">Komoren</option>
|
175 |
-
<option value="Kongo">Kongo</option>
|
176 |
-
<option value="Kongo, Dem. Republik">Kongo, Dem. Republik</option>
|
177 |
-
<option value="Korea, Dem. Volksrep.">Korea, Dem. Volksrep.</option>
|
178 |
-
<option value="Korea, Republik">Korea, Republik</option>
|
179 |
-
<option value="Kosovo">Kosovo</option>
|
180 |
-
<option value="Kroatien">Kroatien</option>
|
181 |
-
<option value="Kuba">Kuba</option>
|
182 |
-
<option value="Kuwait">Kuwait</option>
|
183 |
-
<option value="Laos">Laos</option>
|
184 |
-
<option value="Lesotho">Lesotho</option>
|
185 |
-
<option value="Lettland">Lettland</option>
|
186 |
-
<option value="Libanon">Libanon</option>
|
187 |
-
<option value="Liberia">Liberia</option>
|
188 |
-
<option value="Libysch-Arabische">Libysch-Arabische</option>
|
189 |
-
<option value="Liechtenstein">Liechtenstein</option>
|
190 |
-
<option value="Litauen">Litauen</option>
|
191 |
-
<option value="Luxemburg">Luxemburg</option>
|
192 |
-
<option value="Madagaskar">Madagaskar</option>
|
193 |
-
<option value="Malawi">Malawi</option>
|
194 |
-
<option value="Malaysia">Malaysia</option>
|
195 |
-
<option value="Malediven">Malediven</option>
|
196 |
-
<option value="Mali">Mali</option>
|
197 |
-
<option value="Malta">Malta</option>
|
198 |
-
<option value="Marokko">Marokko</option>
|
199 |
-
<option value="Marshallinseln">Marshallinseln</option>
|
200 |
-
<option value="Mauretanien">Mauretanien</option>
|
201 |
-
<option value="Mauritius">Mauritius</option>
|
202 |
-
<option value="Mazedonien">Mazedonien</option>
|
203 |
-
<option value="Mexiko">Mexiko</option>
|
204 |
-
<option value="Mikronesien">Mikronesien</option>
|
205 |
-
<option value="Moldau">Moldau</option>
|
206 |
-
<option value="Monaco">Monaco</option>
|
207 |
-
<option value="Mongolei">Mongolei</option>
|
208 |
-
<option value="Mosambik">Mosambik</option>
|
209 |
-
<option value="Myanmar">Myanmar</option>
|
210 |
-
<option value="Namibia">Namibia</option>
|
211 |
-
<option value="Nauru">Nauru</option>
|
212 |
-
<option value="Nepal">Nepal</option>
|
213 |
-
<option value="Neuseeland">Neuseeland</option>
|
214 |
-
<option value="Nicaragua">Nicaragua</option>
|
215 |
-
<option value="Niederlande">Niederlande</option>
|
216 |
-
<option value="Niger">Niger</option>
|
217 |
-
<option value="Nigeria">Nigeria</option>
|
218 |
-
<option value="Niue">Niue</option>
|
219 |
-
<option value="Norwegen">Norwegen</option>
|
220 |
-
<option value="Oman">Oman</option>
|
221 |
-
<option value="Osttimor">Osttimor</option>
|
222 |
-
<option value="Pakistan">Pakistan</option>
|
223 |
-
<option value="Palau">Palau</option>
|
224 |
-
<option value="Palestina">Palestina</option>
|
225 |
-
<option value="Panama">Panama</option>
|
226 |
-
<option value="Papua-Neuguinea">Papua-Neuguinea</option>
|
227 |
-
<option value="Paraguay">Paraguay</option>
|
228 |
-
<option value="Peru">Peru</option>
|
229 |
-
<option value="Philippinen">Philippinen</option>
|
230 |
-
<option value="Polen">Polen</option>
|
231 |
-
<option value="Portugal">Portugal</option>
|
232 |
-
<option value="Ruanda">Ruanda</option>
|
233 |
-
<option value="Rumänien">Rumänien</option>
|
234 |
-
<option value="Russische Föderation">Russische Föderation</option>
|
235 |
-
<option value="Salomonen">Salomonen</option>
|
236 |
-
<option value="Sambia">Sambia</option>
|
237 |
-
<option value="Samoa">Samoa</option>
|
238 |
-
<option value="San Marino">San Marino</option>
|
239 |
-
<option value="São Tomé und Príncipe">São Tomé und Príncipe</option>
|
240 |
-
<option value="Saudi-Arabien">Saudi-Arabien</option>
|
241 |
-
<option value="Schweden">Schweden</option>
|
242 |
-
<option value="Senegal">Senegal</option>
|
243 |
-
<option value="Serbien">Serbien</option>
|
244 |
-
<option value="Seychellen">Seychellen</option>
|
245 |
-
<option value="Sierra Leone">Sierra Leone</option>
|
246 |
-
<option value="Simbabwe">Simbabwe</option>
|
247 |
-
<option value="Singapur">Singapur</option>
|
248 |
-
<option value="Slowakei">Slowakei</option>
|
249 |
-
<option value="Slowenien">Slowenien</option>
|
250 |
-
<option value="Somalia">Somalia</option>
|
251 |
-
<option value="Spanien">Spanien</option>
|
252 |
-
<option value="Sri Lanka">Sri Lanka</option>
|
253 |
-
<option value="St. Kitts und Nevis">St. Kitts und Nevis</option>
|
254 |
-
<option value="St. Lucia">St. Lucia</option>
|
255 |
-
<option value="St. Vincent / Grenadinen">St. Vincent / Grenadinen</option>
|
256 |
-
<option value="Südafrika">Südafrika</option>
|
257 |
-
<option value="Sudan">Sudan</option>
|
258 |
-
<option value="Suriname">Suriname</option>
|
259 |
-
<option value="Swasiland">Swasiland</option>
|
260 |
-
<option value="Syrien">Syrien</option>
|
261 |
-
<option value="Tadschikistan">Tadschikistan</option>
|
262 |
-
<option value="Taiwan">Taiwan</option>
|
263 |
-
<option value="Tansania">Tansania</option>
|
264 |
-
<option value="Thailand">Thailand</option>
|
265 |
-
<option value="Togo">Togo</option>
|
266 |
-
<option value="Tonga">Tonga</option>
|
267 |
-
<option value="Trinidad und Tobago">Trinidad und Tobago</option>
|
268 |
-
<option value="Tschad">Tschad</option>
|
269 |
-
<option value="Tschechische Republik">Tschechische Republik</option>
|
270 |
-
<option value="Tunesien">Tunesien</option>
|
271 |
-
<option value="Türkei">Türkei</option>
|
272 |
-
<option value="Turkmenistan">Turkmenistan</option>
|
273 |
-
<option value="Tuvalu">Tuvalu</option>
|
274 |
-
<option value="Uganda">Uganda</option>
|
275 |
-
<option value="Ukraine">Ukraine</option>
|
276 |
-
<option value="Ungarn">Ungarn</option>
|
277 |
-
<option value="Uruguay">Uruguay</option>
|
278 |
-
<option value="USA">USA</option>
|
279 |
-
<option value="Usbekistan">Usbekistan</option>
|
280 |
-
<option value="Vanuatu">Vanuatu</option>
|
281 |
-
<option value="Vatikanstadt">Vatikanstadt</option>
|
282 |
-
<option value="Venezuela">Venezuela</option>
|
283 |
-
<option value="Vereinigte Arabische Emirate">Vereinigte Arabische Emirate</option>
|
284 |
-
<option value="Vereinigtes Königreich">Vereinigtes Königreich</option>
|
285 |
-
<option value="Vietnam">Vietnam</option>
|
286 |
-
<option value="Zentralafrikanische Republik">Zentralafrikanische Republik</option>
|
287 |
-
<option value="Zypern">Zypern</option>
|
288 |
-
</select>
|
289 |
-
|
290 |
-
<script>
|
291 |
-
jQuery(document).ready(function()
|
292 |
-
{
|
293 |
-
var selCountry="<?php echo $this->getSetting("register_country"); ?>";
|
294 |
-
jQuery("#register_country").val(selCountry);
|
295 |
-
});
|
296 |
-
</script>
|
297 |
-
</td>
|
298 |
-
</tr>
|
299 |
-
<tr>
|
300 |
-
<td class="eurotext_edittext"><label><?php echo $this->__("Phone"); ?>: </label></td>
|
301 |
-
<td class="eurotext_edittext"><input disabled="disabled" id="et_register_tel" type="text" name="register_telefon" size=95
|
302 |
-
class="defaultcontent"
|
303 |
-
value="<?php echo $this->getSetting("register_telefon"); ?>">
|
304 |
-
</td>
|
305 |
-
</tr>
|
306 |
-
<tr>
|
307 |
-
<td class="eurotext_edittext" colspan="2" style="padding-left:8px;"><br><?php echo $this->__("Please enter all requested information!"); ?><br><br><b><?php echo $this->__("Important"); ?>:</b><br><?php echo $this->__("Any information you provide is voluntary. Your data will be used for the purpose of logging in to the translation portal and for project processing in your dealings with Eurotext AG only. Your information will not be forwarded to third parties. You can request a deletion of your information at any time by sending an email to <a href='mailto:datenschutz@eurotext.de'>privacy@eurotext.de</a>."); ?></td>
|
308 |
-
</tr>
|
309 |
-
</table>
|
310 |
-
</div>
|
311 |
-
</div>
|
312 |
-
|
313 |
-
<div style="margin-top:20px;">
|
314 |
-
<table cellpadding="0" cellspacing="0" style="width:100%;">
|
315 |
-
<tr>
|
316 |
-
<td class="eurotext_edittext">
|
317 |
-
<span class="btn">
|
318 |
-
<input class="et_btt" disabled="disabled" type="submit" class="btn" id="register_submit" value=" <?php echo $this->__("Save and send"); ?> ">
|
319 |
-
</span>
|
320 |
-
<span class="btn" style="margin-left:230px;">
|
321 |
-
<input class="et_btt" style="display:none;" id="register_change" type="submit" onclick="return eurotext_unlock2()" value=" <?php echo $this->__("Edit information"); ?> ">
|
322 |
-
</span>
|
323 |
-
</td>
|
324 |
-
<td style="text-align:right;"><?php echo $this->__("Module-Version"); ?>: <?php echo $this->getModuleVersion(); ?></td>
|
325 |
-
</tr>
|
326 |
-
<tr>
|
327 |
-
<td colspan="2" class="eurotext_edittext" id="et_statusmsg"><?php echo $this->getMessage(); ?></td>
|
328 |
-
</tr>
|
329 |
-
</table>
|
330 |
-
</div>
|
331 |
-
|
332 |
-
<?php
|
333 |
-
if ($this->isSaved()==false)
|
334 |
-
{
|
335 |
-
// eMail was never send, unlock fields:
|
336 |
-
echo "<script>eurotext_unlock();</script>";
|
337 |
-
}
|
338 |
-
else
|
339 |
-
{
|
340 |
-
// Enable 'Edit information' button
|
341 |
-
echo "<script>jQuery('#register_change').show();</script>";
|
342 |
-
}
|
343 |
-
?>
|
344 |
-
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,130 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// allow utf8-detection: öäü€
|
3 |
-
|
4 |
-
global $visibleCatIds;
|
5 |
-
$visibleCatIds=array();
|
6 |
-
|
7 |
-
?>
|
8 |
-
|
9 |
-
<div class="eurotext_layertitle"><?php echo $this->__("Select categories"); ?></div>
|
10 |
-
<div class="eurotext_layerstrip"></div>
|
11 |
-
|
12 |
-
<table cellpadding="0" cellspacing="0" style="width:100%;border:1px solid #E6E6E6;">
|
13 |
-
<tr>
|
14 |
-
<td class="eurotext_layercellheader"><?php echo $this->__("Select categories"); ?></td>
|
15 |
-
<td class="eurotext_layercellheader" style="border-left:1px solid #E6E6E6;"><?php echo $this->__("Selected categories"); ?></td>
|
16 |
-
</tr>
|
17 |
-
<tr>
|
18 |
-
<td style="width:50%;vertical-align:top;">
|
19 |
-
<div style="margin:20px;">
|
20 |
-
<?php
|
21 |
-
|
22 |
-
function drawCategory($category, $openedPathIds, $selectedCategoryIds, $level)
|
23 |
-
{
|
24 |
-
global $visibleCatIds;
|
25 |
-
|
26 |
-
$category_id=$category->getId();
|
27 |
-
|
28 |
-
$checkStr="";
|
29 |
-
if (in_array($category_id,$selectedCategoryIds))
|
30 |
-
{
|
31 |
-
$checkStr="checked='checked'";
|
32 |
-
}
|
33 |
-
|
34 |
-
array_push($visibleCatIds,$category_id);
|
35 |
-
|
36 |
-
echo "<table cellpadding=0 cellspacing=0>";
|
37 |
-
echo "<tr>";
|
38 |
-
echo " <td class='et_tc'> </td>";
|
39 |
-
echo " <td class='et_tc'><input ".$checkStr." type='checkbox' id='et_selcategory1_".$category_id."' class='et_selcategoryitem et_selcategory_".$category_id."' onchange=\"eurotext_selectcategory('1','".$category_id."')\" /></td>";
|
40 |
-
echo " <td class='et_tc'>";
|
41 |
-
echo " <div>".$category->getName()."</div>";
|
42 |
-
|
43 |
-
{
|
44 |
-
echo " <div>";
|
45 |
-
$childs=$category->getChildrenCategories();
|
46 |
-
if ($childs!=null)
|
47 |
-
{
|
48 |
-
foreach($childs as $child)
|
49 |
-
{
|
50 |
-
drawCategory($child, $openedPathIds, $selectedCategoryIds, ($level+1));
|
51 |
-
}
|
52 |
-
}
|
53 |
-
echo " </div>";
|
54 |
-
}
|
55 |
-
|
56 |
-
echo " </td>";
|
57 |
-
echo "</tr>";
|
58 |
-
echo "</table>";
|
59 |
-
|
60 |
-
}
|
61 |
-
|
62 |
-
$root=$this->getRootCategory();
|
63 |
-
$openedPathIds=$this->getOpenedPathIds();
|
64 |
-
$selectedCategoryIds=$this->getSelectedCategoryIds();
|
65 |
-
|
66 |
-
drawCategory($root,$openedPathIds,$selectedCategoryIds,0);
|
67 |
-
?>
|
68 |
-
</div>
|
69 |
-
|
70 |
-
<?php
|
71 |
-
echo "<div style='margin:20px;'>";
|
72 |
-
//echo "<div><a href='#' class='eurotext_selectcategories_allvisible'>".$this->__("Select all categories displayed")."</a></div>";
|
73 |
-
echo "<div><a href='#' class='eurotext_selectcategories_all'>".$this->__("Select all categories")."</a></div>";
|
74 |
-
echo "<div><a href='#' class='eurotext_selectcategories_none'>".$this->__("No selection")."</a></div>";
|
75 |
-
echo "</div>";
|
76 |
-
?>
|
77 |
-
|
78 |
-
</td>
|
79 |
-
<td style="vertical-align:top;background-color:#F2F2F2;">
|
80 |
-
<div style="margin:20px;">
|
81 |
-
<div id="et_saveinfo"><?php $this->__("Loading - please wait..."); ?></div>
|
82 |
-
<div id="selectedcategories_result"></div>
|
83 |
-
</div>
|
84 |
-
</td>
|
85 |
-
</tr>
|
86 |
-
</table>
|
87 |
-
<div style="text-align:center;margin-top:10px;"><a href="#" onclick="return eurotext_closeme()" class="et_btt"><?php echo $this->__("Save"); ?></a></div>
|
88 |
-
<div> </div>
|
89 |
-
|
90 |
-
<script>
|
91 |
-
var eurotext_selectcategories_url="<?php echo $this->getSelectCategoriesUrl(); ?>";
|
92 |
-
var eurotext_selectcategories_saveurl="<?php echo $this->getSelectCategoriesSaveUrl(); ?>";
|
93 |
-
var eurotext_formkey="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>";
|
94 |
-
var eurotext_projectid="<?php echo $this->getRequest()->getParam("id"); ?>";
|
95 |
-
|
96 |
-
jQuery(document).ready(function()
|
97 |
-
{
|
98 |
-
eurotext_selectedcategories_send(new Array(),true,null);
|
99 |
-
|
100 |
-
jQuery(".eurotext_selectcategories_all").click(function()
|
101 |
-
{
|
102 |
-
var postdata=new Array();
|
103 |
-
|
104 |
-
<?php
|
105 |
-
echo "postdata['cnt']=".count($visibleCatIds).";";
|
106 |
-
for($i=0; $i<count($visibleCatIds); $i++)
|
107 |
-
{
|
108 |
-
echo "postdata['category_id_".$i."']=".$visibleCatIds[$i].";";
|
109 |
-
echo "postdata['set_".$i."']='enabled';";
|
110 |
-
}
|
111 |
-
?>
|
112 |
-
|
113 |
-
jQuery(".et_selcategoryitem").attr("checked","checked");
|
114 |
-
|
115 |
-
eurotext_selectedcategories_send(postdata,true,null);
|
116 |
-
});
|
117 |
-
|
118 |
-
jQuery(".eurotext_selectcategories_none").click(function()
|
119 |
-
{
|
120 |
-
var postdata=new Array();
|
121 |
-
postdata['cnt']=0;
|
122 |
-
postdata['select']='none';
|
123 |
-
|
124 |
-
jQuery(".et_selcategoryitem").attr("checked",false);
|
125 |
-
|
126 |
-
eurotext_selectedcategories_send(postdata,true,null);
|
127 |
-
});
|
128 |
-
|
129 |
-
});
|
130 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,169 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// allow utf8-detection: öäü€
|
3 |
-
|
4 |
-
$visibleCMSPages=array();
|
5 |
-
$visibleCMSBlocks=array();
|
6 |
-
?>
|
7 |
-
|
8 |
-
<div class="eurotext_layertitle"><?php echo $this->__("Select CMS pages/blocks"); ?></div>
|
9 |
-
<div class="eurotext_layerstrip"></div>
|
10 |
-
|
11 |
-
<table cellpadding="0" cellspacing="0" style="width:100%;border:1px solid #E6E6E6;">
|
12 |
-
<tr>
|
13 |
-
<td class="eurotext_layercellheader"><?php echo $this->__("Select CMS pages/blocks"); ?></td>
|
14 |
-
<td class="eurotext_layercellheader" style="border-left:1px solid #E6E6E6;"><?php echo $this->__("Selected CMS pages/blocks"); ?></td>
|
15 |
-
</tr>
|
16 |
-
<tr>
|
17 |
-
<td style="width:50%;vertical-align:top;">
|
18 |
-
<div style="margin:20px;">
|
19 |
-
<?php
|
20 |
-
// Results:
|
21 |
-
echo "<table cellpadding=0 cellspacing=0>";
|
22 |
-
echo "<tr>";
|
23 |
-
echo " <td class='et_th'>".$this->__("Translate")."</td>";
|
24 |
-
echo " <td class='et_th'>".$this->__("Designation")."</td>";
|
25 |
-
echo " <td class='et_th'>".$this->__("Identifier")."</td>";
|
26 |
-
echo " <td class='et_th'>".$this->__("CMS-Type")."</td>";
|
27 |
-
echo " <td class='et_th'> </td>";
|
28 |
-
echo "</tr>";
|
29 |
-
|
30 |
-
$pages=$this->getCMSPages();
|
31 |
-
foreach($pages as $page)
|
32 |
-
{
|
33 |
-
$checkStr="";
|
34 |
-
if ($page['checked'])
|
35 |
-
{
|
36 |
-
$checkStr="checked='checked'";
|
37 |
-
}
|
38 |
-
|
39 |
-
array_push($visibleCMSPages,$page['page_id']);
|
40 |
-
|
41 |
-
echo "<tr>";
|
42 |
-
echo " <td class='et_tc'><input ".$checkStr." type='checkbox' id='et_selcmspage1_".$page['page_id']."' class='et_selcmspage et_selcmspage_".$page['page_id']."' onchange=\"eurotext_selectcmspage('1','".$page['page_id']."')\" /></td>";
|
43 |
-
echo " <td class='et_tc'>".$page['title']."</td>";
|
44 |
-
echo " <td class='et_tc'>".$page['identifier']."</td>";
|
45 |
-
echo " <td class='et_tc' style='white-space:pre;'>".$page['type']."</td>";
|
46 |
-
echo " <td class='et_tc'> </td>";
|
47 |
-
echo "</tr>";
|
48 |
-
}
|
49 |
-
|
50 |
-
$blocks=$this->getCMSBlocks();
|
51 |
-
foreach($blocks as $block)
|
52 |
-
{
|
53 |
-
$checkStr="";
|
54 |
-
if ($block['checked'])
|
55 |
-
{
|
56 |
-
$checkStr="checked='checked'";
|
57 |
-
}
|
58 |
-
|
59 |
-
array_push($visibleCMSBlocks,$block['block_id']);
|
60 |
-
|
61 |
-
echo "<tr>";
|
62 |
-
echo " <td class='et_tc'><input ".$checkStr." type='checkbox' id='et_selcmsblock1_".$block['block_id']."' class='et_selcmsblock et_selcmsblock_".$block['block_id']."' onchange=\"eurotext_selectcmsblock('1','".$block['block_id']."')\" /></td>";
|
63 |
-
echo " <td class='et_tc'>".$block['title']."</td>";
|
64 |
-
echo " <td class='et_tc'>".$block['identifier']."</td>";
|
65 |
-
echo " <td class='et_tc' style='white-space:pre;'>".$block['type']."</td>";
|
66 |
-
echo " <td class='et_tc'> </td>";
|
67 |
-
echo "</tr>";
|
68 |
-
}
|
69 |
-
|
70 |
-
echo "</table>";
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
?>
|
75 |
-
</div>
|
76 |
-
<?php
|
77 |
-
echo "<div style='margin:20px;'>";
|
78 |
-
//echo "<div><a href='#' class='eurotext_selectcmspages_allvisible'>".$this->__("Select all CMS pages displayed")."</a></div>";
|
79 |
-
echo "<div><a href='#' class='eurotext_selectcmspages_all'>".$this->__("Select all CMS pages/blocks")."</a></div>";
|
80 |
-
echo "<div><a href='#' class='eurotext_selectcmspages_none'>".$this->__("No selection")."</a></div>";
|
81 |
-
echo "</div>";
|
82 |
-
?>
|
83 |
-
</td>
|
84 |
-
<td style="vertical-align:top;background-color:#F2F2F2;">
|
85 |
-
<div style="margin:20px;">
|
86 |
-
<div id="et_saveinfo"><?php $this->__("Loading - please wait..."); ?></div>
|
87 |
-
<div id="selectedcmspages_result"></div>
|
88 |
-
</div>
|
89 |
-
</td>
|
90 |
-
</tr>
|
91 |
-
</table>
|
92 |
-
<div style="text-align:center;margin-top:10px;"><a href="#" onclick="return eurotext_closeme()" class="et_btt"><?php echo $this->__("Save"); ?></a></div>
|
93 |
-
<div> </div>
|
94 |
-
|
95 |
-
<script>
|
96 |
-
var eurotext_selectcmspages_url="<?php echo $this->getSelectCmsPagesUrl(); ?>";
|
97 |
-
var eurotext_selectcmspages_saveurl="<?php echo $this->getSelectCmsPagesSaveUrl(); ?>";
|
98 |
-
var eurotext_formkey="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>";
|
99 |
-
var eurotext_projectid="<?php echo $this->getRequest()->getParam("id"); ?>";
|
100 |
-
|
101 |
-
jQuery(document).ready(function()
|
102 |
-
{
|
103 |
-
eurotext_selectedcmspages_send(new Array(),null);
|
104 |
-
|
105 |
-
jQuery(".eurotext_selectcmspages_allvisible").click(function()
|
106 |
-
{
|
107 |
-
var postdata=new Array();
|
108 |
-
|
109 |
-
<?php
|
110 |
-
echo "postdata['cnt_pages']=".count($visibleCMSPages).";";
|
111 |
-
for($i=0; $i<count($visibleCMSPages); $i++)
|
112 |
-
{
|
113 |
-
echo "postdata['page_id_".$i."']=".$visibleCMSPages[$i].";";
|
114 |
-
echo "postdata['setpage_".$i."']='enabled';";
|
115 |
-
}
|
116 |
-
|
117 |
-
echo "postdata['cnt_blocks']=".count($visibleCMSBlocks).";";
|
118 |
-
for($i=0; $i<count($visibleCMSBlocks); $i++)
|
119 |
-
{
|
120 |
-
echo "postdata['block_id_".$i."']=".$visibleCMSBlocks[$i].";";
|
121 |
-
echo "postdata['setblock_".$i."']='enabled';";
|
122 |
-
}
|
123 |
-
?>
|
124 |
-
|
125 |
-
jQuery(".et_selcmspage").setPropAndAttr("checked","checked");
|
126 |
-
jQuery(".et_selcmsblock").setPropAndAttr("checked","checked");
|
127 |
-
|
128 |
-
eurotext_selectedcmspages_send(postdata,null);
|
129 |
-
});
|
130 |
-
|
131 |
-
jQuery(".eurotext_selectcmspages_all").click(function()
|
132 |
-
{
|
133 |
-
var postdata=new Array();
|
134 |
-
|
135 |
-
<?php
|
136 |
-
echo "postdata['cnt_pages']=".count($visibleCMSPages).";";
|
137 |
-
for($i=0; $i<count($visibleCMSPages); $i++)
|
138 |
-
{
|
139 |
-
echo "postdata['page_id_".$i."']=".$visibleCMSPages[$i].";";
|
140 |
-
echo "postdata['setpage_".$i."']='enabled';";
|
141 |
-
}
|
142 |
-
|
143 |
-
echo "postdata['cnt_blocks']=".count($visibleCMSBlocks).";";
|
144 |
-
for($i=0; $i<count($visibleCMSBlocks); $i++)
|
145 |
-
{
|
146 |
-
echo "postdata['block_id_".$i."']=".$visibleCMSBlocks[$i].";";
|
147 |
-
echo "postdata['setblock_".$i."']='enabled';";
|
148 |
-
}
|
149 |
-
?>
|
150 |
-
|
151 |
-
jQuery(".et_selcmspage").setPropAndAttr("checked","checked");
|
152 |
-
jQuery(".et_selcmsblock").setPropAndAttr("checked","checked");
|
153 |
-
eurotext_selectedcmspages_send(postdata,null);
|
154 |
-
});
|
155 |
-
|
156 |
-
jQuery(".eurotext_selectcmspages_none").click(function()
|
157 |
-
{
|
158 |
-
var postdata=new Array();
|
159 |
-
postdata['cnt_pages']=0;
|
160 |
-
postdata['cnt_blocks']=0;
|
161 |
-
postdata['select']='none';
|
162 |
-
|
163 |
-
jQuery(".et_selcmspage").setPropAndAttr("checked",false);
|
164 |
-
jQuery(".et_selcmsblock").setPropAndAttr("checked",false);
|
165 |
-
|
166 |
-
eurotext_selectedcmspages_send(postdata,null);
|
167 |
-
});
|
168 |
-
});
|
169 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,113 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// allow utf8-detection: öäü€
|
3 |
-
|
4 |
-
$visibleEmailTemplates=array();
|
5 |
-
?>
|
6 |
-
|
7 |
-
<div class="eurotext_layertitle"><?php echo $this->__("Add eMail-Template"); ?></div>
|
8 |
-
<div class="eurotext_layerstrip"></div>
|
9 |
-
|
10 |
-
<table cellpadding="0" cellspacing="0" style="width:100%;border:1px solid #E6E6E6;">
|
11 |
-
<tr>
|
12 |
-
<td class="eurotext_layercellheader"><?php echo $this->__("Select email templates"); ?></td>
|
13 |
-
<td class="eurotext_layercellheader" style="border-left:1px solid #E6E6E6;"><?php echo $this->__("Selected eMail-Templates"); ?></td>
|
14 |
-
</tr>
|
15 |
-
<tr>
|
16 |
-
<td style="width:50%;vertical-align:top;">
|
17 |
-
<div style="margin:20px;">
|
18 |
-
<?php
|
19 |
-
$emailTemplates=$this->getEMailTemplates();
|
20 |
-
|
21 |
-
// Results:
|
22 |
-
echo "<table cellpadding=0 cellspacing=0>";
|
23 |
-
echo "<tr>";
|
24 |
-
echo " <td class='et_th'>".$this->__("Translate")."</td>";
|
25 |
-
echo " <td class='et_th'>".$this->__("Filename")."</td>";
|
26 |
-
echo " <td class='et_th'> </td>";
|
27 |
-
echo "</tr>";
|
28 |
-
|
29 |
-
foreach($emailTemplates as $emailTemplate)
|
30 |
-
{
|
31 |
-
$checkStr="";
|
32 |
-
if ($emailTemplate['checked'])
|
33 |
-
{
|
34 |
-
$checkStr="checked='checked'";
|
35 |
-
}
|
36 |
-
|
37 |
-
array_push($visibleEmailTemplates,$emailTemplate['file_hash']);
|
38 |
-
|
39 |
-
echo "<tr>";
|
40 |
-
echo " <td class='et_tc'><input ".$checkStr." type='checkbox' id='et_selemail1_".$emailTemplate['file_hash']."' class='et_selemail et_selemail_".$emailTemplate['file_hash']."' onchange=\"eurotext_selectemail('1','".$emailTemplate['file_hash']."')\" /></td>";
|
41 |
-
echo " <td class='et_tc'>".$emailTemplate['filename']."</td>";
|
42 |
-
echo " <td class='et_tc'> </td>";
|
43 |
-
echo "</tr>";
|
44 |
-
}
|
45 |
-
echo "</table>";
|
46 |
-
?>
|
47 |
-
</div>
|
48 |
-
<?php
|
49 |
-
echo "<div style='margin:20px;'>";
|
50 |
-
//echo "<div><a href='#' class='eurotext_selectemails_allvisible'>".$this->__("Select all email templates displayed")."</a></div>";
|
51 |
-
echo "<div><a href='#' class='eurotext_selectemails_all'>".$this->__("Select all email templates")."</a></div>";
|
52 |
-
echo "<div><a href='#' class='eurotext_selectemails_none'>".$this->__("No selection")."</a></div>";
|
53 |
-
echo "</div>";
|
54 |
-
?>
|
55 |
-
</td>
|
56 |
-
<td style="vertical-align:top;background-color:#F2F2F2;">
|
57 |
-
<div style="margin:20px;">
|
58 |
-
<div id="et_saveinfo"><?php $this->__("Loading - please wait..."); ?></div>
|
59 |
-
<div id="selectedemails_result"></div>
|
60 |
-
</div>
|
61 |
-
</td>
|
62 |
-
</tr>
|
63 |
-
</table>
|
64 |
-
<div style="text-align:center;margin-top:10px;"><a href="#" onclick="return eurotext_closeme()" class="et_btt"><?php echo $this->__("Save"); ?></a></div>
|
65 |
-
<div> </div>
|
66 |
-
|
67 |
-
<script>
|
68 |
-
var eurotext_selectemails_url="<?php echo $this->getSelectEMailsUrl(); ?>";
|
69 |
-
var eurotext_selectemails_saveurl="<?php echo $this->getSelectEMailsSaveUrl(); ?>";
|
70 |
-
var eurotext_formkey="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>";
|
71 |
-
var eurotext_projectid="<?php echo $this->getRequest()->getParam("id"); ?>";
|
72 |
-
|
73 |
-
jQuery(document).ready(function()
|
74 |
-
{
|
75 |
-
eurotext_selectedemails_send(new Array(),null);
|
76 |
-
|
77 |
-
jQuery(".eurotext_selectemails_all").click(function()
|
78 |
-
{
|
79 |
-
var postdata=new Array();
|
80 |
-
|
81 |
-
<?php
|
82 |
-
echo "postdata['cnt']=".count($visibleEmailTemplates).";";
|
83 |
-
for($i=0; $i<count($visibleEmailTemplates); $i++)
|
84 |
-
{
|
85 |
-
echo "postdata['file_hash_".$i."']='".$visibleEmailTemplates[$i]."';\r\n";
|
86 |
-
echo "postdata['set_".$i."']='enabled';\r\n";
|
87 |
-
}
|
88 |
-
?>
|
89 |
-
|
90 |
-
jQuery(".et_selemail").attr("checked","checked");
|
91 |
-
jQuery(".et_selemail").prop("checked",true); // for some reason Chrome ignores the line above (but works on every other page) ;/
|
92 |
-
|
93 |
-
eurotext_selectedemails_send(postdata,null);
|
94 |
-
|
95 |
-
return false;
|
96 |
-
});
|
97 |
-
|
98 |
-
jQuery(".eurotext_selectemails_none").click(function()
|
99 |
-
{
|
100 |
-
var postdata=new Array();
|
101 |
-
postdata['cnt']=0;
|
102 |
-
postdata['select']='none';
|
103 |
-
|
104 |
-
eurotext_selectemails_ignore=true;
|
105 |
-
|
106 |
-
jQuery(".et_selemail").attr("checked",false);
|
107 |
-
|
108 |
-
eurotext_selectedemails_send(postdata,null);
|
109 |
-
|
110 |
-
return false;
|
111 |
-
});
|
112 |
-
});
|
113 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,129 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// allow utf8-detection: öäü€
|
3 |
-
|
4 |
-
$visibleLangfiles=array();
|
5 |
-
?>
|
6 |
-
|
7 |
-
<div class="eurotext_layertitle"><?php echo $this->__("Select language files"); ?></div>
|
8 |
-
<div class="eurotext_layerstrip"></div>
|
9 |
-
|
10 |
-
<table cellpadding="0" cellspacing="0" style="width:100%;border:1px solid #E6E6E6;">
|
11 |
-
<tr>
|
12 |
-
<td class="eurotext_layercellheader"><?php echo $this->__("Select language files"); ?></td>
|
13 |
-
<td class="eurotext_layercellheader" style="border-left:1px solid #E6E6E6;"><?php echo $this->__("Selected language files"); ?></td>
|
14 |
-
</tr>
|
15 |
-
<tr>
|
16 |
-
<td style="width:50%;vertical-align:top;">
|
17 |
-
<div style="margin:20px;">
|
18 |
-
<?php
|
19 |
-
$langfiles=$this->getLangfiles();
|
20 |
-
|
21 |
-
// Results:
|
22 |
-
echo "<table cellpadding=0 cellspacing=0>";
|
23 |
-
echo "<tr>";
|
24 |
-
echo " <td class='et_th'>".$this->__("Translate")."</td>";
|
25 |
-
echo " <td class='et_th'>".$this->__("Filename")."</td>";
|
26 |
-
echo " <td class='et_th'> </td>";
|
27 |
-
echo "</tr>";
|
28 |
-
|
29 |
-
foreach($langfiles as $langfile)
|
30 |
-
{
|
31 |
-
$checkStr="";
|
32 |
-
if ($langfile['checked'])
|
33 |
-
{
|
34 |
-
$checkStr="checked='checked'";
|
35 |
-
}
|
36 |
-
|
37 |
-
array_push($visibleLangfiles,$langfile['line_hash']);
|
38 |
-
|
39 |
-
echo "<tr>";
|
40 |
-
echo " <td class='et_tc'><input ".$checkStr." type='checkbox' id='et_sellangfile1_".$langfile['line_hash']."' class='et_sellangfile et_sellangfile_".$langfile['line_hash']."' onchange=\"eurotext_selectlangfile('1','".$langfile['line_hash']."')\" /></td>";
|
41 |
-
echo " <td class='et_tc'>".$langfile['filename']."</td>";
|
42 |
-
echo " <td class='et_tc'> </td>";
|
43 |
-
echo "</tr>";
|
44 |
-
}
|
45 |
-
echo "</table>";
|
46 |
-
|
47 |
-
?>
|
48 |
-
</div>
|
49 |
-
<?php
|
50 |
-
echo "<div style='margin:20px;'>";
|
51 |
-
echo "<div><a href='#' class='eurotext_selectlangfiles_allvisible'>".$this->__("Select all language files displayed")."</a></div>";
|
52 |
-
echo "<div><a href='#' class='eurotext_selectlangfiles_all'>".$this->__("Select all language files")."</a></div>";
|
53 |
-
echo "<div><a href='#' class='eurotext_selectlangfiles_none'>".$this->__("No selection")."</a></div>";
|
54 |
-
echo "</div>";
|
55 |
-
?>
|
56 |
-
</td>
|
57 |
-
<td style="vertical-align:top;background-color:#F2F2F2;">
|
58 |
-
<div style="margin:20px;">
|
59 |
-
<div id="et_saveinfo"><?php $this->__("Loading - please wait..."); ?></div>
|
60 |
-
<div id="selectedlangfiles_result"></div>
|
61 |
-
</div>
|
62 |
-
</td>
|
63 |
-
</tr>
|
64 |
-
</table>
|
65 |
-
<div style="text-align:center;margin-top:10px;"><a href="#" onclick="return eurotext_closeme()" class="et_btt"><?php echo $this->__("Save"); ?></a></div>
|
66 |
-
<div> </div>
|
67 |
-
|
68 |
-
<script>
|
69 |
-
var eurotext_selectlangfiles_url="<?php echo $this->getSelectLangfilesUrl(); ?>";
|
70 |
-
var eurotext_selectlangfiles_saveurl="<?php echo $this->getSelectLangfilesSaveUrl(); ?>";
|
71 |
-
var eurotext_formkey="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>";
|
72 |
-
var eurotext_projectid="<?php echo $this->getRequest()->getParam("id"); ?>";
|
73 |
-
|
74 |
-
jQuery(document).ready(function()
|
75 |
-
{
|
76 |
-
eurotext_selectedlangfiles_send(new Array(),null);
|
77 |
-
|
78 |
-
jQuery(".eurotext_selectlangfiles_allvisible").click(function()
|
79 |
-
{
|
80 |
-
var postdata=new Array();
|
81 |
-
|
82 |
-
<?php
|
83 |
-
echo "postdata['cnt']=".count($visibleLangfiles).";";
|
84 |
-
for($i=0; $i<count($visibleLangfiles); $i++)
|
85 |
-
{
|
86 |
-
echo "postdata['langfile_linehash_".$i."']='".$visibleLangfiles[$i]."';\r\n";
|
87 |
-
echo "postdata['set_".$i."']='enabled';\r\n";
|
88 |
-
}
|
89 |
-
?>
|
90 |
-
|
91 |
-
jQuery(".et_sellangfile").attr("checked","checked");
|
92 |
-
|
93 |
-
eurotext_selectedlangfiles_send(postdata,null);
|
94 |
-
|
95 |
-
return false;
|
96 |
-
});
|
97 |
-
|
98 |
-
jQuery(".eurotext_selectlangfiles_all").click(function()
|
99 |
-
{
|
100 |
-
var postdata=new Array();
|
101 |
-
|
102 |
-
<?php
|
103 |
-
echo "postdata['cnt']=".count($visibleLangfiles).";";
|
104 |
-
for($i=0; $i<count($visibleLangfiles); $i++)
|
105 |
-
{
|
106 |
-
echo "postdata['langfile_linehash_".$i."']='".$visibleLangfiles[$i]."';\r\n";
|
107 |
-
echo "postdata['set_".$i."']='enabled';\r\n";
|
108 |
-
}
|
109 |
-
?>
|
110 |
-
|
111 |
-
jQuery(".et_sellangfile").attr("checked","checked");
|
112 |
-
|
113 |
-
eurotext_selectedlangfiles_send(postdata,null);
|
114 |
-
|
115 |
-
return false;
|
116 |
-
});
|
117 |
-
|
118 |
-
jQuery(".eurotext_selectlangfiles_none").click(function()
|
119 |
-
{
|
120 |
-
var postdata=new Array();
|
121 |
-
postdata['cnt']=0;
|
122 |
-
postdata['select']='none';
|
123 |
-
|
124 |
-
jQuery(".et_selproductitem").attr("checked",false);
|
125 |
-
|
126 |
-
eurotext_selectedlangfiles_send(postdata,null);
|
127 |
-
});
|
128 |
-
});
|
129 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,351 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// allow utf8-detection: öäü€
|
3 |
-
|
4 |
-
function selected_str($curval,$checkval)
|
5 |
-
{
|
6 |
-
if ($curval==$checkval)
|
7 |
-
{
|
8 |
-
return "selected='selected'";
|
9 |
-
}
|
10 |
-
|
11 |
-
return "";
|
12 |
-
}
|
13 |
-
|
14 |
-
$visibleProductIds=array();
|
15 |
-
$page_size=20;
|
16 |
-
$current_page=1;
|
17 |
-
|
18 |
-
$this->updateFilterData();
|
19 |
-
|
20 |
-
$val_filter_status=$this->getFilterStatus();
|
21 |
-
$val_filter_stock=$this->getFilterStock();
|
22 |
-
$val_filter_product_type=$this->getFilterProductType();
|
23 |
-
|
24 |
-
?>
|
25 |
-
|
26 |
-
<div class="eurotext_layertitle"><?php echo $this->__("Select products"); ?></div>
|
27 |
-
<div class="eurotext_layerstrip"></div>
|
28 |
-
|
29 |
-
<table cellpadding="0" cellspacing="0" style="width:100%;border:1px solid #E6E6E6;">
|
30 |
-
<tr>
|
31 |
-
<td class="eurotext_layercellheader"><?php echo $this->__("Filter"); ?></td>
|
32 |
-
<td class="eurotext_layercellheader" style="border-left:1px solid #E6E6E6;"><?php echo $this->__("Select products"); ?></td>
|
33 |
-
<td class="eurotext_layercellheader" style="border-left:2px solid #E6E6E6;"><?php echo $this->__("Selected products"); ?></td>
|
34 |
-
</tr>
|
35 |
-
<tr>
|
36 |
-
<td style="vertical-align:top;min-width:250px;">
|
37 |
-
|
38 |
-
<div style="margin:10px;">
|
39 |
-
<table>
|
40 |
-
<tr>
|
41 |
-
<td><?php echo $this->__("Status"); ?>: </td>
|
42 |
-
<td><select autocomplete="off" id="filter_status">
|
43 |
-
<option value="1" <?php if ($val_filter_status==1) { echo "selected='selected'"; } ?>><?php echo $this->__("Enabled"); ?></option>
|
44 |
-
<option value="2" <?php if ($val_filter_status==2) { echo "selected='selected'"; } ?>><?php echo $this->__("Disabled"); ?></option>
|
45 |
-
</select></td>
|
46 |
-
</tr>
|
47 |
-
<tr>
|
48 |
-
<td><?php echo $this->__("Stock Availability"); ?>: </td>
|
49 |
-
<td><select autocomplete="off" id="filter_stock">
|
50 |
-
<option value="1" <?php if ($val_filter_stock==1) { echo "selected='selected'"; } ?>><?php echo $this->__("In Stock"); ?></option>
|
51 |
-
<option value="0" <?php if ($val_filter_stock==0) { echo "selected='selected'"; } ?>><?php echo $this->__("Out of Stock"); ?></option>
|
52 |
-
</select></td>
|
53 |
-
</tr>
|
54 |
-
<tr>
|
55 |
-
<td><?php echo $this->__("Product Type"); ?>: </td>
|
56 |
-
<td><select autocomplete="off" id="filter_product_type">
|
57 |
-
<option value="" <?php if ($val_filter_product_type=='') { echo "selected='selected'"; } ?>><?php echo $this->__("Show all"); ?></option>
|
58 |
-
<option value="simple" <?php if ($val_filter_product_type=='simple') { echo "selected='selected'"; } ?>><?php echo $this->__("Simple Product"); ?></option>
|
59 |
-
<option value="grouped" <?php if ($val_filter_product_type=='grouped') { echo "selected='selected'"; } ?>><?php echo $this->__("Grouped Product"); ?></option>
|
60 |
-
<option value="configurable" <?php if ($val_filter_product_type=='configurable') { echo "selected='selected'"; } ?>><?php echo $this->__("Configurable Product"); ?></option>
|
61 |
-
<option value="virtual" <?php if ($val_filter_product_type=='virtual') { echo "selected='selected'"; } ?>><?php echo $this->__("Virtual Product"); ?></option>
|
62 |
-
<option value="bundle" <?php if ($val_filter_product_type=='bundle') { echo "selected='selected'"; } ?>><?php echo $this->__("Bundle Product"); ?></option>
|
63 |
-
<option value="downloadable" <?php if ($val_filter_product_type=='downloadable') { echo "selected='selected'"; } ?>><?php echo $this->__("Downloadable Product"); ?></option>
|
64 |
-
</select></td>
|
65 |
-
</tr>
|
66 |
-
</table>
|
67 |
-
</div>
|
68 |
-
|
69 |
-
|
70 |
-
<table style="border-spacing:0px;margin-top:15px;width:100%;">
|
71 |
-
<tr>
|
72 |
-
<td class="eurotext_layercellheader"><?php echo $this->__("Category filter"); ?></td>
|
73 |
-
</tr>
|
74 |
-
</table>
|
75 |
-
<div style="margin:10px;">
|
76 |
-
<?php echo $this->getCategoryTreeHTML(); ?>
|
77 |
-
</div>
|
78 |
-
</td>
|
79 |
-
<td style="vertical-align:top;">
|
80 |
-
|
81 |
-
<div style="margin:15px;">
|
82 |
-
|
83 |
-
<?php
|
84 |
-
$result=$this->getSearchResult();
|
85 |
-
?>
|
86 |
-
|
87 |
-
<div style="margin:10px;padding:10px;">
|
88 |
-
<table cellpadding="0" cellspacing="0">
|
89 |
-
<tr>
|
90 |
-
<td><input type="text" id="find_products" style="min-width:250px;" value="<?php echo htmlentities($result['find'],ENT_COMPAT,'UTF-8'); ?>" placeholder="<?php echo $this->__("Enter designation or SKU"); ?>" /></td>
|
91 |
-
<td> <a href="#" onclick="return eurotext_findproducts()"><span class="eurotext_findbtt"></span></a></td>
|
92 |
-
</tr>
|
93 |
-
</table>
|
94 |
-
</div>
|
95 |
-
|
96 |
-
<!-- Search result -->
|
97 |
-
<?php
|
98 |
-
if ($result['result_count']>0)
|
99 |
-
{
|
100 |
-
$pager="";
|
101 |
-
|
102 |
-
$current_page=$result['page_current'];
|
103 |
-
$page_size=$result['page_size'];
|
104 |
-
|
105 |
-
$prev_page=($current_page-1);
|
106 |
-
$pager_prevpage="";
|
107 |
-
if ($prev_page<1)
|
108 |
-
{
|
109 |
-
$pager_prevpage="<span class='eurotext_back_disabled'></span>";
|
110 |
-
}
|
111 |
-
else
|
112 |
-
{
|
113 |
-
$page_url=$this->getSelectProductsUrl()."page/".$prev_page."/find/".urlencode($result['find'])."/pagesize/".$page_size."/catids/".implode(",",$this->getOpenCatIds());
|
114 |
-
$pager_prevpage="<a href='".$page_url."'><span class='eurotext_back_enabled'></span></a>";
|
115 |
-
}
|
116 |
-
|
117 |
-
$next_page=($current_page+1);
|
118 |
-
$pager_nextpage="";
|
119 |
-
if ($next_page>$result['page_last'])
|
120 |
-
{
|
121 |
-
$pager_nextpage="<span class='eurotext_next_disabled'></span>";
|
122 |
-
}
|
123 |
-
else
|
124 |
-
{
|
125 |
-
$page_url=$this->getSelectProductsUrl()."page/".$next_page."/find/".urlencode($result['find'])."/pagesize/".$page_size."/catids/".implode(",",$this->getOpenCatIds());
|
126 |
-
$pager_nextpage="<a href='".$page_url."'><span class='eurotext_next_enabled'></span></a>";
|
127 |
-
}
|
128 |
-
|
129 |
-
$maxSeiten="";
|
130 |
-
if ($result['page_last']==1)
|
131 |
-
{
|
132 |
-
$maxSeiten="von 1 Seite";
|
133 |
-
}
|
134 |
-
else
|
135 |
-
{
|
136 |
-
$maxSeiten="von ".$result['page_last']." Seiten";
|
137 |
-
}
|
138 |
-
|
139 |
-
$pager="<table cellpadding=0 cellspacing=0 style='margin:15px;'>";
|
140 |
-
$pager.=" <tr>";
|
141 |
-
$pager.=" <td class='eurotext_vcenter'>".$this->__("Page")." </td>";
|
142 |
-
$pager.=" <td> </td>";
|
143 |
-
$pager.=" <td class='eurotext_vcenter'>$pager_prevpage </td>";
|
144 |
-
$pager.=" <td> </td>";
|
145 |
-
$pager.=" <td class='eurotext_vcenter'><input style='text-align:center;width:35px;' type='text' class='eurotext_page' value='$current_page' autocomplete='off' /> </td>";
|
146 |
-
$pager.=" <td> </td>";
|
147 |
-
$pager.=" <td class='eurotext_vcenter'>$pager_nextpage </td>";
|
148 |
-
$pager.=" <td> </td>";
|
149 |
-
$pager.=" <td class='eurotext_vcenter'> $maxSeiten</td>";
|
150 |
-
$pager.=" <td style='width:30px;'> </td>";
|
151 |
-
$pager.=" <td class='eurotext_vcenter'>";
|
152 |
-
$pager.=" <select class='eurotext_pagesize'>";
|
153 |
-
$pager.=" <option value='20' ".selected_str($page_size,20).">20</option>";
|
154 |
-
$pager.=" <option value='30' ".selected_str($page_size,30).">30</option>";
|
155 |
-
$pager.=" <option value='50' ".selected_str($page_size,50).">50</option>";
|
156 |
-
$pager.=" <option value='100' ".selected_str($page_size,100).">100</option>";
|
157 |
-
$pager.=" <option value='200' ".selected_str($page_size,200).">200</option>";
|
158 |
-
$pager.=" </select>";
|
159 |
-
$pager.=" </td>";
|
160 |
-
$pager.=" <td> </td>";
|
161 |
-
$pager.=" <td class='eurotext_vcenter'>".$this->__('Per Page')."</td>";
|
162 |
-
$pager.=" </tr>";
|
163 |
-
$pager.="</table>";
|
164 |
-
|
165 |
-
echo $pager;
|
166 |
-
|
167 |
-
// Results:
|
168 |
-
echo "<table cellpadding=0 cellspacing=0>";
|
169 |
-
echo "<tr>";
|
170 |
-
echo " <td class='et_th'>".$this->__("Translate")."</td>";
|
171 |
-
echo " <td class='et_th'>".$this->__("SKU")."</td>";
|
172 |
-
echo " <td class='et_th'>".$this->__("Designation")."</td>";
|
173 |
-
echo " <td class='et_th'> </td>";
|
174 |
-
echo "</tr>";
|
175 |
-
|
176 |
-
$products=$result['products'];
|
177 |
-
|
178 |
-
$alt=0;
|
179 |
-
foreach($products as $product)
|
180 |
-
{
|
181 |
-
$checkStr="";
|
182 |
-
if ($product['checked'])
|
183 |
-
{
|
184 |
-
$checkStr="checked='checked'";
|
185 |
-
}
|
186 |
-
|
187 |
-
$alt=1-$alt;
|
188 |
-
|
189 |
-
// Remember visible products:
|
190 |
-
array_push($visibleProductIds,$product['entity_id']);
|
191 |
-
|
192 |
-
echo "<tr>";
|
193 |
-
echo " <td class='et_tc eurotext_r".$alt."'><input autocomplete='off' ".$checkStr." type='checkbox' id='et_selproduct1_".$product['entity_id']."' class='et_selproductitem et_selproduct_".$product['entity_id']."' onchange=\"eurotext_selectproduct('1','".$product['entity_id']."')\" /></td>";
|
194 |
-
echo " <td class='et_tc eurotext_r".$alt."'>".$product['sku']."</td>"; // (ID: ".$product['entity_id'].")
|
195 |
-
echo " <td class='et_tc eurotext_r".$alt."'>".$product['article_name']."</td>";
|
196 |
-
echo " <td class='et_tc eurotext_r".$alt."'> </td>";
|
197 |
-
echo "</tr>";
|
198 |
-
}
|
199 |
-
|
200 |
-
echo "</table>";
|
201 |
-
|
202 |
-
echo $pager;
|
203 |
-
|
204 |
-
echo "<div>";
|
205 |
-
echo "<div><a href='#' class='eurotext_selectproducts_allvisible'>".$this->__("Select all products displayed")."</a></div>";
|
206 |
-
echo "<div><a href='#' class='eurotext_selectproducts_all'>".$this->__("Select all products in this category")."</a></div>";
|
207 |
-
echo "<div><a href='#' class='eurotext_selectproducts_none'>".$this->__("No selection")."</a></div>";
|
208 |
-
echo "</div>";
|
209 |
-
}
|
210 |
-
else
|
211 |
-
{
|
212 |
-
echo $this->__("No result");
|
213 |
-
}
|
214 |
-
|
215 |
-
?>
|
216 |
-
</div>
|
217 |
-
|
218 |
-
</td>
|
219 |
-
<td style="vertical-align:top;background-color:#F2F2F2;">
|
220 |
-
<div style="margin:20px;">
|
221 |
-
<div id="et_saveinfo"><?php $this->__("Loading - Please wait")."..."; ?></div>
|
222 |
-
<div id="selectedproducts_result"></div>
|
223 |
-
</div>
|
224 |
-
</td>
|
225 |
-
</tr>
|
226 |
-
</table>
|
227 |
-
<div style="text-align:center;margin-top:10px;"><a href="#" onclick="return eurotext_closeme()" class="et_btt"><?php echo $this->__("Save"); ?></a></div>
|
228 |
-
<div> </div>
|
229 |
-
|
230 |
-
<script>
|
231 |
-
var eurotext_selectproducts_url="<?php echo $this->getSelectProductsUrl(); ?>";
|
232 |
-
var eurotext_selectproducts_saveurl="<?php echo $this->getSelectProductsSaveUrl(); ?>";
|
233 |
-
var eurotext_pagesize="<?php echo $page_size; ?>";
|
234 |
-
var eurotext_page="<?php echo $current_page; ?>";
|
235 |
-
var eurotext_catids="<?php echo implode(",",$this->getOpenCatIds()); ?>";
|
236 |
-
var eurotext_formkey="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>";
|
237 |
-
var eurotext_projectid="<?php echo $this->getRequest()->getParam("id"); ?>";
|
238 |
-
jQuery(document).ready(function()
|
239 |
-
{
|
240 |
-
eurotext_selectedproducts_send(new Array(),null);
|
241 |
-
|
242 |
-
jQuery("#filter_status").change(function()
|
243 |
-
{
|
244 |
-
eurotext_findproducts();
|
245 |
-
|
246 |
-
return false;
|
247 |
-
});
|
248 |
-
|
249 |
-
jQuery("#filter_stock").change(function()
|
250 |
-
{
|
251 |
-
eurotext_findproducts();
|
252 |
-
|
253 |
-
return false;
|
254 |
-
});
|
255 |
-
|
256 |
-
jQuery("#filter_product_type").change(function()
|
257 |
-
{
|
258 |
-
eurotext_findproducts();
|
259 |
-
|
260 |
-
return false;
|
261 |
-
});
|
262 |
-
|
263 |
-
|
264 |
-
jQuery(".eurotext_catsel").click(function()
|
265 |
-
{
|
266 |
-
var catid=jQuery(this).attr("x-catid");
|
267 |
-
var catstate=jQuery(this).attr("x-state");
|
268 |
-
|
269 |
-
postdata=new Array();
|
270 |
-
postdata['catid']=catid;
|
271 |
-
|
272 |
-
if (catstate=="checked")
|
273 |
-
{
|
274 |
-
postdata['select']='unsetcat';
|
275 |
-
}
|
276 |
-
else
|
277 |
-
{
|
278 |
-
postdata['select']='setcat';
|
279 |
-
}
|
280 |
-
|
281 |
-
eurotext_selectedproducts_send(postdata,null);
|
282 |
-
});
|
283 |
-
|
284 |
-
jQuery(".eurotext_selectproducts_allvisible").click(function()
|
285 |
-
{
|
286 |
-
var postdata=new Array();
|
287 |
-
|
288 |
-
<?php
|
289 |
-
echo "postdata['cnt']=".count($visibleProductIds).";";
|
290 |
-
for($i=0; $i<count($visibleProductIds); $i++)
|
291 |
-
{
|
292 |
-
echo "postdata['product_id_".$i."']=".$visibleProductIds[$i].";";
|
293 |
-
echo "postdata['set_".$i."']='enabled';";
|
294 |
-
}
|
295 |
-
?>
|
296 |
-
|
297 |
-
jQuery(".et_selproductitem").attr("checked","checked");
|
298 |
-
|
299 |
-
eurotext_selectedproducts_send(postdata,null);
|
300 |
-
});
|
301 |
-
|
302 |
-
jQuery(".eurotext_selectproducts_all").click(function()
|
303 |
-
{
|
304 |
-
var postdata=new Array();
|
305 |
-
|
306 |
-
var postdata=new Array();
|
307 |
-
postdata['cnt']=0;
|
308 |
-
postdata['select']='all';
|
309 |
-
|
310 |
-
jQuery(".et_selproductitem").attr("checked","checked");
|
311 |
-
|
312 |
-
eurotext_selectedproducts_send(postdata,null);
|
313 |
-
});
|
314 |
-
|
315 |
-
jQuery(".eurotext_selectproducts_none").click(function()
|
316 |
-
{
|
317 |
-
var postdata=new Array();
|
318 |
-
postdata['cnt']=0;
|
319 |
-
postdata['select']='none';
|
320 |
-
|
321 |
-
jQuery(".et_selproductitem").attr("checked",false);
|
322 |
-
|
323 |
-
eurotext_selectedproducts_send(postdata,null);
|
324 |
-
});
|
325 |
-
|
326 |
-
jQuery('#find_products').keypress(function (e)
|
327 |
-
{
|
328 |
-
if (e.which == 13)
|
329 |
-
{
|
330 |
-
e.preventDefault();
|
331 |
-
eurotext_findproducts();
|
332 |
-
}
|
333 |
-
});
|
334 |
-
|
335 |
-
jQuery('.eurotext_page').keypress(function (e)
|
336 |
-
{
|
337 |
-
eurotext_page=jQuery(this).val();
|
338 |
-
if (e.which == 13)
|
339 |
-
{
|
340 |
-
e.preventDefault();
|
341 |
-
eurotext_findproducts();
|
342 |
-
}
|
343 |
-
});
|
344 |
-
|
345 |
-
jQuery('.eurotext_pagesize').change(function (e)
|
346 |
-
{
|
347 |
-
eurotext_pagesize=jQuery(this).val();
|
348 |
-
eurotext_findproducts();
|
349 |
-
});
|
350 |
-
});
|
351 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,202 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// allow utf8-detection: öäü€
|
3 |
-
|
4 |
-
// Read Settings:
|
5 |
-
$helper=Mage::helper('eurotext_translationmanager');;
|
6 |
-
$et_username=$helper->getSetting("eurotext_username");
|
7 |
-
$et_password=Mage::helper('core')->decrypt($helper->getSetting("eurotext_password"));
|
8 |
-
$et_customerid=$helper->getSetting("eurotext_customerid");
|
9 |
-
|
10 |
-
$et_products_per_file=$helper->getSetting("et_products_per_file","20");
|
11 |
-
$et_categories_per_file=$helper->getSetting("et_categories_per_file","20");
|
12 |
-
$et_cmspages_per_file=$helper->getSetting("et_cmspages_per_file","20");
|
13 |
-
|
14 |
-
// Test ftp login:
|
15 |
-
$statusMessage="";
|
16 |
-
if (trim($et_username)!="")
|
17 |
-
{
|
18 |
-
$rv=$helper->testFtpConnection();
|
19 |
-
$statusMessage=$rv['statusmessage'];
|
20 |
-
}
|
21 |
-
|
22 |
-
if ($helper->getDebugMode())
|
23 |
-
{
|
24 |
-
echo '<div style="background-color:red;padding:3px;color:white;">Debug-Mode is active!</div>';
|
25 |
-
}
|
26 |
-
|
27 |
-
|
28 |
-
echo "<script type='text/javascript'>";
|
29 |
-
echo "var eurotext_saveurl='".$this->getSaveUrl()."';";
|
30 |
-
echo "var eurotext_formkey='".Mage::getSingleton('core/session')->getFormKey()."';";
|
31 |
-
echo "</script>";
|
32 |
-
|
33 |
-
?>
|
34 |
-
|
35 |
-
<div class="eurotext_confighead"><?php echo $this->__("Settings"); ?></div>
|
36 |
-
<div class="eurotext_config">
|
37 |
-
<div style="padding:10px;">
|
38 |
-
<table cellpadding="0" cellspacing="0">
|
39 |
-
<tr>
|
40 |
-
<td class="eurotext_edittext"><?php echo $this->__("User name"); ?>:</td>
|
41 |
-
<td class="eurotext_edittext"> </td>
|
42 |
-
<td class="eurotext_edittext"><input type="text" id="et_username" value="<?php echo $et_username; ?>" autocomplete="off" /></td>
|
43 |
-
<td class="eurotext_edittext"></td>
|
44 |
-
</tr>
|
45 |
-
<tr>
|
46 |
-
<td class="eurotext_edittext"><?php echo $this->__("Password"); ?>:</td>
|
47 |
-
<td class="eurotext_edittext"> </td>
|
48 |
-
<td class="eurotext_edittext"><input type="password" id="et_password" value="<?php echo $et_password; ?>" autocomplete="off" /></td>
|
49 |
-
<td class="eurotext_edittext"></td>
|
50 |
-
</tr>
|
51 |
-
<tr>
|
52 |
-
<td class="eurotext_edittext"><?php echo $this->__("Customer ID"); ?>:</td>
|
53 |
-
<td class="eurotext_edittext"> </td>
|
54 |
-
<td class="eurotext_edittext"><input type="text" id="et_customerid" value="<?php echo $et_customerid; ?>" autocomplete="off" /></td>
|
55 |
-
<td class="eurotext_edittext"></td>
|
56 |
-
</tr>
|
57 |
-
<tr>
|
58 |
-
<td class="eurotext_edittext" colspan="4"> </td>
|
59 |
-
</tr>
|
60 |
-
<tr>
|
61 |
-
<td class="eurotext_edittext"><?php echo $this->__("Products per file"); ?>:</td>
|
62 |
-
<td class="eurotext_edittext"> </td>
|
63 |
-
<td class="eurotext_edittext"><input type="number" id="et_products_per_file" value="<?php echo $et_products_per_file; ?>" autocomplete="off" /></td>
|
64 |
-
<td class="eurotext_edittext">(<?php echo $this->__("Minimum"); ?>: <?php echo $helper->getExportProductsMinPerFile(); ?>)</td>
|
65 |
-
</tr>
|
66 |
-
<tr>
|
67 |
-
<td class="eurotext_edittext"><?php echo $this->__("Categories per file"); ?>:</td>
|
68 |
-
<td class="eurotext_edittext"> </td>
|
69 |
-
<td class="eurotext_edittext"><input type="number" id="et_categories_per_file" value="<?php echo $et_categories_per_file; ?>" autocomplete="off" /></td>
|
70 |
-
<td class="eurotext_edittext">(<?php echo $this->__("Minimum"); ?>: <?php echo $helper->getExportCategoriesMinPerFile(); ?>)</td>
|
71 |
-
</tr>
|
72 |
-
<!-- <tr>
|
73 |
-
<td class="eurotext_edittext"><?php echo $this->__("CMS pages per file"); ?>:</td>
|
74 |
-
<td class="eurotext_edittext"> </td>
|
75 |
-
<td class="eurotext_edittext"><input type="number" id="et_cmspages_per_file" value="<?php echo $et_cmspages_per_file; ?>" autocomplete="off" /></td>
|
76 |
-
<td class="eurotext_edittext"><img title="" src="" /></td>
|
77 |
-
</tr>-->
|
78 |
-
<tr>
|
79 |
-
<td class="eurotext_edittext" colspan="4"> </td>
|
80 |
-
</tr>
|
81 |
-
<tr>
|
82 |
-
<td class="eurotext_edittext" colspan="4" style="text-align:center;"><a id="eurotext_savebtt" href="#" onclick="return eurotext_savesettings()" class="et_btt"><?php echo $this->__("Save"); ?></a></td>
|
83 |
-
</tr>
|
84 |
-
</table>
|
85 |
-
|
86 |
-
<div> </div>
|
87 |
-
<div><?php echo $statusMessage; ?></div>
|
88 |
-
|
89 |
-
<?php if ($helper->urlKeyScopeIsGlobal())
|
90 |
-
{
|
91 |
-
?>
|
92 |
-
<div style="margin-top:20px;">
|
93 |
-
<?php echo $this->__('Currently your Magento installation is not capable to save translated url keys for products and categories.'); ?><br>
|
94 |
-
<a href="<?php echo $this->getUpgradeScopeUrl(); ?>"><?php echo $this->__('Click here to change the scope of url keys to enable translation of url keys for products and categories. (Attention: This can not be undone!)'); ?></a>
|
95 |
-
</div>
|
96 |
-
<?php
|
97 |
-
}
|
98 |
-
else
|
99 |
-
{
|
100 |
-
?>
|
101 |
-
<div style="margin-top:20px;">
|
102 |
-
<?php echo $this->__("Your Magento installation allows the translation of URLs of categories and products."); ?></a>
|
103 |
-
</div>
|
104 |
-
<?php
|
105 |
-
}
|
106 |
-
?>
|
107 |
-
</div>
|
108 |
-
</div>
|
109 |
-
|
110 |
-
<div> </div>
|
111 |
-
|
112 |
-
<div class="eurotext_confighead"><?php echo $this->__("Language settings"); ?></div>
|
113 |
-
<div class="eurotext_config">
|
114 |
-
<div style="padding:10px;">
|
115 |
-
<table cellpadding="0" cellspacing="0">
|
116 |
-
<tr>
|
117 |
-
<td class='et_th' colspan="2"><?php echo $this->__("Your Magento languages"); ?>:</td>
|
118 |
-
<td class='et_th'> </td>
|
119 |
-
<td class='et_th'> </td>
|
120 |
-
<td class='et_th'> </td>
|
121 |
-
<td class='et_th' colspan="2"><?php echo $this->__("Language of the translation portal"); ?>:</td>
|
122 |
-
</tr>
|
123 |
-
<?php
|
124 |
-
$stores=$this->getStoreviews();
|
125 |
-
foreach($stores as $store)
|
126 |
-
{
|
127 |
-
$localeInfo=$helper->getLocaleInfoByMagentoLocale($store['locale']);
|
128 |
-
|
129 |
-
echo "<tr>";
|
130 |
-
echo "<td class='et_tc'>".$store['name']."</td>";
|
131 |
-
echo "<td class='et_tc'>".$store['locale']."</td>";
|
132 |
-
echo "<td class='et_tc'> </td>";
|
133 |
-
echo "<td class='et_tc'><----></td>";
|
134 |
-
echo "<td class='et_tc'> </td>";
|
135 |
-
echo "<td class='et_tc'>".$localeInfo['lang_name']."</td>";
|
136 |
-
echo "<td class='et_tc'>".$localeInfo['locale_eurotext']."</td>";
|
137 |
-
echo "</tr>";
|
138 |
-
}
|
139 |
-
?>
|
140 |
-
</table>
|
141 |
-
</div>
|
142 |
-
</div>
|
143 |
-
|
144 |
-
<div> </div>
|
145 |
-
|
146 |
-
<div class="eurotext_confighead"><?php echo $this->__("System requirements"); ?>:</div>
|
147 |
-
<div class="eurotext_config">
|
148 |
-
<div style="padding:10px;">
|
149 |
-
<?php
|
150 |
-
|
151 |
-
$items=array();
|
152 |
-
|
153 |
-
{
|
154 |
-
$item=array();
|
155 |
-
$item['name']="PHP-Version";
|
156 |
-
$item['ok']=(version_compare(PHP_VERSION, '5.2.0') >= 0); // min 5.2.0
|
157 |
-
$item['value_now']=PHP_VERSION;
|
158 |
-
$item['value_required']="min 5.2.0";
|
159 |
-
array_push($items,$item);
|
160 |
-
}
|
161 |
-
|
162 |
-
{
|
163 |
-
$item=array();
|
164 |
-
$item['name']="FTP-Extension";
|
165 |
-
$item['ok']=function_exists("ftp_connect");
|
166 |
-
$item['value_now']=function_exists("ftp_connect") ? $this->__("Installed") : $this->__("Missing");
|
167 |
-
$item['value_required']=$this->__("Installed");
|
168 |
-
array_push($items,$item);
|
169 |
-
}
|
170 |
-
|
171 |
-
{
|
172 |
-
$item=array();
|
173 |
-
$item['name']="ZIP-Extension";
|
174 |
-
$item['ok']=class_exists("ZIPArchive");
|
175 |
-
$item['value_now']=class_exists("ZIPArchive") ? $this->__("Installed") : $this->__("Missing");
|
176 |
-
$item['value_required']=$this->__("Installed");
|
177 |
-
array_push($items,$item);
|
178 |
-
}
|
179 |
-
|
180 |
-
echo "<table cellpadding=0 cellspacing=0>";
|
181 |
-
{
|
182 |
-
echo "<tr>";
|
183 |
-
echo " <td class='et_th'>".$this->__("Designation")."</td>";
|
184 |
-
echo " <td class='et_th'>".$this->__("Current value")."</td>";
|
185 |
-
echo " <td class='et_th'>".$this->__("Required value")."</td>";
|
186 |
-
echo "</tr>";
|
187 |
-
}
|
188 |
-
foreach($items as $item)
|
189 |
-
{
|
190 |
-
echo "<tr>";
|
191 |
-
echo " <td class='et_tc'>".$item['name']."</td>";
|
192 |
-
echo " <td class='et_tc'>".$item['value_now']."</td>";
|
193 |
-
echo " <td class='et_tc'>".$item['value_required']."</td>";
|
194 |
-
echo "</tr>";
|
195 |
-
}
|
196 |
-
echo "</table>";
|
197 |
-
|
198 |
-
echo "<div style='margin-top:20px;'>".$this->__("Current value for 'max_execution_time'").": ".ini_get("max_execution_time")."s</div>";
|
199 |
-
|
200 |
-
?>
|
201 |
-
</div>
|
202 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,11 +1,13 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<!--
|
3 |
-
-->
|
4 |
<config>
|
5 |
<modules>
|
6 |
<Eurotext_TranslationManager>
|
7 |
<active>true</active>
|
8 |
<codePool>community</codePool>
|
9 |
</Eurotext_TranslationManager>
|
|
|
|
|
|
|
|
|
10 |
</modules>
|
11 |
</config>
|
1 |
<?xml version="1.0"?>
|
|
|
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Eurotext_TranslationManager>
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
</Eurotext_TranslationManager>
|
8 |
+
<Eurotext_Uploader>
|
9 |
+
<active>true</active>
|
10 |
+
<codePool>community</codePool>
|
11 |
+
</Eurotext_Uploader>
|
12 |
</modules>
|
13 |
</config>
|
@@ -1,223 +1,183 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
"<
|
4 |
-
"<b>Select all [...] without existing translation:</b> The module will automatically select all Products, categories, CMS pages and email templates for which no translated text exists in the target language.","<b>Alle [...] ohne vorhandene Übersetzung auswählen:</b> Das Modul wählt für Sie automatisch alle Artikel, Kategorien, CMS-Seiten und/oder E-Mail-Vorlagen aus, für die noch keine Texte in der Zielsprache existieren."
|
5 |
-
<i><span style='color:red;'>Important:</span> All previous assignments will be deleted!</i>,<i><span style='color:red;'>Achtung:</span> Alle vorherigen Zuordnungen werden dadurch gelöscht!</i>
|
6 |
"<i><span style='color:red;'>Important:</span> We recommend using this setting only for the initial translation of a new online shop, as it will trigger a translation of ALL language files for the selected target language!</i>","<i><span style='color:red;'>Achtung:</span> Diese Einstellung empfiehlt sich nur bei der ersten Übersetzung neuer Onlineshops, denn hier werden ALLE Sprachdateien der gewählten Zielsprache neu übersetzt!</i>"
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
"
|
37 |
-
"
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
Generating
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
Import,
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
"
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
Processing File,Verarbeite Datei
|
132 |
-
Product Type,Artikel-Art
|
133 |
-
Products per file,Artikel pro Datei
|
134 |
-
"Products, categories, CMS pages, or email templates can be selected individually (<b>Select […]</b>), or alternatively:","Die Artikel, Kategorien, CMS-Seiten und/oder E-Mail-Vorlagen können individuell ausgewählt werden (Klick auf <b>[…] auswählen</b>) oder"
|
135 |
-
Project name,Projektname
|
136 |
-
Project settings,Projekt-Einstellungen
|
137 |
-
Projects,Projekte
|
138 |
-
Quote request,Angebot anfordern
|
139 |
-
Registration,Registrierung
|
140 |
-
Request your free quote now,Jetzt kostenloses Angebot anfordern
|
141 |
-
Required value,Benötigter Wert
|
142 |
-
Reset,Zurücksetzen
|
143 |
-
SKU,Artikelnr
|
144 |
-
Salutation,Anrede
|
145 |
-
Save,Speichern
|
146 |
-
Save and send,Senden und Speichern
|
147 |
-
Save project,Projekt speichern
|
148 |
-
Saved Project!,Projekt gespeichert!
|
149 |
-
Select CMS pages,CMS-Seiten auswählen
|
150 |
-
Select CMS pages/blocks,CMS-Seiten/-Blöcke auswählen
|
151 |
-
Select all CMS pages displayed,Alle angezeigten CMS-Seiten auswählen
|
152 |
-
Select all CMS pages without existing translations,Alle CMS-Seiten ohne vorhandene Übersetzung auswählen
|
153 |
-
Select all CMS pages/blocks,Alle CMS-Seiten/-Blöcke auswählen
|
154 |
-
Select all categories,Alle Kategorien auswählen
|
155 |
-
Select all categories displayed,Alle angezeigten Kategorien auswählen
|
156 |
-
Select all categories without existing translations,Alle Kategorien ohne vorhandene Übersetzung auswählen
|
157 |
-
Select all email templates,Alle E-Mail-Vorlagen auswählen
|
158 |
-
Select all email templates displayed,Alle angezeigten E-Mail-Vorlagen auswählen
|
159 |
-
Select all email templates without existing translations,Alle E-Mail-Templates ohne vorhandene Übersetzung auswählen
|
160 |
-
Select all entries in language files without existing translations,Alle Einträge in Sprachdateien ohne vorhandene Übersetzung auswählen
|
161 |
-
Select all language files,Alle Sprachdateien auswählen
|
162 |
-
Select all language files displayed,Alle angezeigten Sprachdateien auswählen
|
163 |
-
Select all products displayed,Alle angezeigten Artikel auswählen
|
164 |
-
Select all products in this category,Alle Artikel dieser Kategorie auswählen
|
165 |
-
Select all products without existing translations,Alle Artikel ohne vorhandene Übersetzung auswählen
|
166 |
-
Select categories,Kategorien auswählen
|
167 |
-
Select email templates,E-Mail-Vorlagen auswählen
|
168 |
-
Select language files,Sprachdateien wählen
|
169 |
-
"Select product texts, category texts, or CMS pages for translation.","Wählen Sie Artikeltexte, Kategorietexte oder CMS-Seiten für die Übersetzung aus."
|
170 |
-
Select products,Artikel auswählen
|
171 |
"Select the check box <b>Export SEO content?</b> if you would like to have the SEO content (e.g. keywords, search terms, meta tags, etc.) translated.","Aktivieren Sie die Checkbox <b>SEO-Inhalte exportieren?</b>, falls Sie auch die SEO-Inhalte (z.B. Keywords, Suchbegriffe, Meta-Tags, etc.) übersetzen lassen wollen."
|
172 |
-
Select the check box <b>Export URL keys?</b> if you would like to have URLs of products and categories translated
|
173 |
-
Select the
|
174 |
-
"Select
|
175 |
-
|
176 |
-
|
177 |
-
"
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
"
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
"
|
217 |
-
|
218 |
-
|
219 |
-
Your
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
|
|
|
1 |
+
"<b>Please note:</b> For safety reasons, we recommend testing the import on a staging system first. Make sure to back up all your data before importing.","<b>Bitte beachten Sie:</b> Aus Sicherheitsgründen sollte der erste Import in einem Testsystem (Staging) durchgeführt werden. Erstellen Sie vor dem Import ein Backup Ihrer Daten."
|
2 |
+
"<b>Select all [...] without existing translation:</b> The plugin will automatically select all products, categories, CMS pages and email templates for which no translated text exists in the target language.","<b>Alle [...] ohne vorhandene Übersetzung auswählen:</b> Das Plugin wählt für Sie automatisch alle Artikel, Kategorien, CMS-Seiten und/oder E-Mail-Vorlagen aus, für die noch keine Texte in der Zielsprache existieren."
|
3 |
+
"<i><span style='color:red;'>Important:</span> All previous assignments will be deleted!</i>","<i><span style='color:red;'>Achtung:</span> Alle vorherigen Zuordnungen werden dadurch gelöscht!</i>"
|
|
|
|
|
4 |
"<i><span style='color:red;'>Important:</span> We recommend using this setting only for the initial translation of a new online shop, as it will trigger a translation of ALL language files for the selected target language!</i>","<i><span style='color:red;'>Achtung:</span> Diese Einstellung empfiehlt sich nur bei der ersten Übersetzung neuer Onlineshops, denn hier werden ALLE Sprachdateien der gewählten Zielsprache neu übersetzt!</i>"
|
5 |
+
"Actions","Aktionen"
|
6 |
+
"Active","Aktiv"
|
7 |
+
"New","Neu"
|
8 |
+
"Added %s files to the import queue.","%s Dateien der Import-Warteschlange hinzugefügt."
|
9 |
+
"Attributes and attribute options","Attribute und Attribut-Optionen"
|
10 |
+
"Back","Zurück"
|
11 |
+
"Batch %s / %s Categories:","Batch %s / %s Kategorien:"
|
12 |
+
"Batch %s / %s CMS Blocks:","Batch %s / %s CMS-Blöcke:"
|
13 |
+
"Batch %s / %s CMS Pages:","Batch %s / %s CMS-Seiten:"
|
14 |
+
"Batch %s / %s CSV File: %s","Batch %s / %s CSV-Datei: %s"
|
15 |
+
"Batch %s / %s Products:","Batch %s / %s Artikel:"
|
16 |
+
"Catalog URL key scope","Katalog URL Key Umfang"
|
17 |
+
"Categories per file","Kategorien pro Datei"
|
18 |
+
"Categories","Kategorien"
|
19 |
+
"Change URL key scope","URL Key Umfang ändern"
|
20 |
+
"City","Stadt"
|
21 |
+
"Click here to change the scope of URL keys to enable translation of URL keys for products and categories. (Attention: This cannot be undone!)","Klicken Sie hier, um den Umfang der URL-Keys zu ändern, damit die URL-Keys für Artikel und Kategorien übersetzt werden können. (Achtung: Dies kann nicht mehr rückgängig gemacht werden!)"
|
22 |
+
"Clicking <b>Select all entries in language files without existing translations</b> will automatically select all files and check for missing translations. All entries without an existing translation will be exported.","Mit Klick auf <b>Alle Einträge in Sprachdateien ohne vorhandene Übersetzung auswählen</b> werden alle Sprachdateien eingelesen und nach fehlenden Übersetzungen überprüft. Alle Einträge ohne Übersetzung werden exportiert."
|
23 |
+
"Clicking <b>Select language files</b> will allow you to manually select specific shop system texts in the selection window for translation.","Mit Klick auf <b>Sprachdateien auswählen</b> können Sie die für die Übersetzung bestimmten Shop-Systemtexte im Auswahlfenster manuell zuordnen."
|
24 |
+
"Clicking the button <b>Request free quotation now</b> will transmit your texts for translation to the translation portal, and you will receive a detailed quote for your translation project within the next 24 hours (weekdays).","Durch Klick auf den Button <b>Jetzt kostenloses Angebot anfordern</b> werden die zu übersetzenden Texte an das Übersetzungsportal übermittelt und Sie erhalten innerhalb von 24 Stunden (werktags) ein detailliertes Angebot für die Übersetzung Ihrer Texte."
|
25 |
+
"CMS Blocks","CMS-Blöcke"
|
26 |
+
"CMS Pages and Blocks","CMS-Seiten und -Blöcke"
|
27 |
+
"CMS Pages per file","CMS-Seiten pro Datei"
|
28 |
+
"CMS Pages","CMS-Seiten"
|
29 |
+
"Comment","Kommentar"
|
30 |
+
"Company","Firma"
|
31 |
+
"Connection credentials","Verbindungseinstellungen"
|
32 |
+
"Contact data","Kontaktdaten"
|
33 |
+
"Contact","Kontakt"
|
34 |
+
"Country","Land"
|
35 |
+
"Create a new project for each translation order.","Legen Sie für jeden Übersetzungsauftrag ein Projekt an."
|
36 |
+
"Currently your Magento installation is not capable to save translated URL keys for products and categories.","Ihre Magento-Installation ist aktuell nicht in der Lage, übersetzte URL-Keys für Artikel und Kategorien zu speichern."
|
37 |
+
"Customer ID","Kundennummer"
|
38 |
+
"Data sent.","Daten gesendet."
|
39 |
+
"Directory ""%s"" is not writeable.","Verzeichnis ""%s"" ist nicht beschreibbar."
|
40 |
+
"Directory ""%s"" is writeable.","Verzeichnis ""%s"" ist beschreibbar."
|
41 |
+
"Directory permissions","Verzeichnisberechtigungen"
|
42 |
+
"Do you really want to delete this project?","Wollen Sie dieses Projekt wirklich löschen?"
|
43 |
+
"Do you really want to reset this project?","Wollen Sie dieses Projekt wirklich zurücksetzen?"
|
44 |
+
"Each project must have a name assigned (we recommend something unique and distinguishable).","Vergeben Sie dem Projekt einen Namen (es empfiehlt sich hier einen aussagekräftigen Namen zu wählen)."
|
45 |
+
"Email Address","E-Mail-Adresse"
|
46 |
+
"Email Templates","E-Mail-Vorlagen"
|
47 |
+
"Eurotext AG translationMANAGER: Debug mode enabled!","Eurotext AG translatationMANAGER: Debug Modus aktiv!"
|
48 |
+
"Eurotext AG translationMANAGER: FTP Upload disabled!","Eurotext AG translatationMANAGER: FTP Upload ist deaktiviert!"
|
49 |
+
"Eurotext AG translationMANAGER","Eurotext AG translatationMANAGER"
|
50 |
+
"Export done.","Export abgeschlossen."
|
51 |
+
"Export to Eurotext AG","Export an Eurotext AG"
|
52 |
+
"Export","Export"
|
53 |
+
"Exported %s Email Templates","%s E-Mail-Vorlagen exportiert"
|
54 |
+
"Exported attributes.","Exportierte Attribute."
|
55 |
+
"Exported categories.","Exportierte Kategorien."
|
56 |
+
"Exported CMS Blocks.","Exportierte CMS-Blöcke."
|
57 |
+
"Exported CMS Pages.","Exportierte CMS-Seiten."
|
58 |
+
"Exported data","Exportierte Daten"
|
59 |
+
"Exported language files.","Exportierte Sprachdateien."
|
60 |
+
"Exported products.","Exportierte Artikel."
|
61 |
+
"Exported","Exportierte"
|
62 |
+
"File %s processed of %s.","Datei %s von %s verarbeitet."
|
63 |
+
"First name","Vorname"
|
64 |
+
"FTP Status","FTP Status"
|
65 |
+
"FTP test failed! Please check your connection credentials.","FTP Test fehlgeschlagen! Bitte prüfen Sie Ihre Zugangsdaten."
|
66 |
+
"FTP Upload successfully tested.","FTP Upload erfolgreich getestet."
|
67 |
+
"FTP-Extension","FTP-Extension"
|
68 |
+
"Generating ZIP archive","Erzeuge ZIP-Archiv"
|
69 |
+
"Next page","Nächste Seite"
|
70 |
+
"Go to previous page","Vorherige Seite"
|
71 |
+
"Help","Hilfe"
|
72 |
+
"Here you will find a list of settings required for operating the Eurotext interface","Hier finden Sie eine Auflistung der für den Betrieb der Eurotext-Schnittstelle notwendigen Einstellungen"
|
73 |
+
"Higher is better (Zero is infinite)","Je höher desto besser (Null ist unendlich)"
|
74 |
+
"ID","ID"
|
75 |
+
"Import the ZIP file containing the finished translations here.","Die ZIP-Datei mit den fertigen Übersetzungen können Sie hier importieren."
|
76 |
+
"Import translations","Übersetzungen importieren"
|
77 |
+
"Import","Import"
|
78 |
+
"In progress","In Bearbeitung"
|
79 |
+
"In Stock","Auf Lager"
|
80 |
+
"Installed","Installiert"
|
81 |
+
"Items selected","Ausgewählte Einträge"
|
82 |
+
"Languages in Stores","Sprachen in Stores"
|
83 |
+
"Last name","Nachname"
|
84 |
+
"Leave empty for default value: 20","Leer lassen für Standardwert: 20"
|
85 |
+
"Loaded","Geladen"
|
86 |
+
"Loading - please wait...","Lade - Einen Moment..."
|
87 |
+
"Make sure to complete the registration process and enter your access information before submitting your first translation project. Fill out all fields of the registration form and click <b><i>Save and send</i> </b>. Eurotext will send your connection cred","Vor dem ersten Übersetzungsprojekt müssen Sie den Registrierungsprozess abgeschlossen und die Zugangsdaten eingetragen haben. Füllen Sie bitte alle Felder des Registrierungsformulars aus und klicken Sie auf <b><i>Speichern und Senden</i> </b>. Eurotext wi"
|
88 |
+
"Manage project","Projekt verwalten"
|
89 |
+
"Missing","Fehlend"
|
90 |
+
"Plugin version","Plugin-Version"
|
91 |
+
"Mr.","Herr"
|
92 |
+
"Mrs.","Frau"
|
93 |
+
"Name","Name"
|
94 |
+
"New project","Neues Projekt"
|
95 |
+
"New","Neu"
|
96 |
+
"Next page","Nächste Seite"
|
97 |
+
"No Email Templates from the database exported","Es wurden keine E-Mail-Vorlagen aus der Datenbank exportiert"
|
98 |
+
"No file was selected, or the file selected is not a ZIP file","Es wurde keine Datei ausgewählt oder die Datei ist keine ZIP-Datei"
|
99 |
+
"of %s pages","von %s Seiten"
|
100 |
+
"Only data is exported, which is not translated yet.","Es wurden nur Daten exportiert, für die noch keine Übersetzung vorliegt."
|
101 |
+
"Out of Stock","Nicht auf Lager"
|
102 |
+
"Page","Seite"
|
103 |
+
"Password","Passwort"
|
104 |
+
"per page","pro Seite"
|
105 |
+
"Phone","Telefon"
|
106 |
+
"PHP version","PHP Version"
|
107 |
+
"Please read the translationMANAGER documentation for more information.","Für weitere Informationen, lesen Sie bitte die translationMANAGER Dokumentation."
|
108 |
+
"Please save the project before exporting it!","Bitte speichern Sie das Projekt vor dem Export!"
|
109 |
+
"Please wait - saving project settings","Einen Moment - Speichere Projekteinstellungen"
|
110 |
+
"Please wait - this may take a while","Einen Moment - Dies kann etwas dauern"
|
111 |
+
"Please wait...","Bitte warten..."
|
112 |
+
"Please wait","Bitte warten"
|
113 |
+
"Processing - please wait…","Arbeite - Einen Moment..."
|
114 |
+
"Product Count","Artikelanzahl"
|
115 |
+
"Products per file","Artikel pro Datei"
|
116 |
+
"Products, categories, CMS Pages, or Email Templates can be selected individually (<b>Select […]</b>), or alternatively:","Die Artikel, Kategorien, CMS-Seiten und/oder E-Mail-Vorlagen können individuell ausgewählt werden (Klick auf <b>[…] auswählen</b>) oder:"
|
117 |
+
"Products","Artikel"
|
118 |
+
"Project ""%s"" saved with ID ""%s“.","Projekt ""%s"" mit ID ""%s"" gespeichert."
|
119 |
+
"Project ""%s"" was exported. You can't edit it anymore.","Projekt ""%s"" wurde exportiert. Sie können es nicht mehr bearbeiten."
|
120 |
+
"Project Information","Projektinformation"
|
121 |
+
"Projects","Projekte"
|
122 |
+
"Registration","Registrierung"
|
123 |
+
"Registration/Settings","Registrierung/Einstellungen"
|
124 |
+
"Reset to last status","Projekt auf letzten Status zurücksetzen"
|
125 |
+
"Salutation","Anrede"
|
126 |
+
"Save project","Projekt speichern"
|
127 |
+
"Select All","Alle wählen"
|
128 |
+
"Select the check box <b>Export attributes and attribute options?</b> if you would like to have the product attributes and associated values translated.","Aktivieren Sie die Checkbox <b>Attribute und Attribut-Optionen exportieren?</b> falls Sie Artikelattribute und die dazugehörigen Werte übersetzen lassen möchten."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
"Select the check box <b>Export SEO content?</b> if you would like to have the SEO content (e.g. keywords, search terms, meta tags, etc.) translated.","Aktivieren Sie die Checkbox <b>SEO-Inhalte exportieren?</b>, falls Sie auch die SEO-Inhalte (z.B. Keywords, Suchbegriffe, Meta-Tags, etc.) übersetzen lassen wollen."
|
130 |
+
"Select the check box <b>Export URL keys?</b> if you would like to have URLs of products and categories translated.","Aktivieren Sie die Checkbox <b>URL-Keys exportieren?</b> falls Sie die URLs von Artikeln und Kategorien übersetzen lassen möchten."
|
131 |
+
"Select the products, categories, CMS Pages or Email Templates you need translated","Wählen Sie die Artikel, Kategorien, CMS-Seiten und/oder E-Mail-Vorlagen aus, die Sie übersetzen lassen wollen"
|
132 |
+
"Select visible","Sichtbare auswählen"
|
133 |
+
"Sending data","Sende Daten"
|
134 |
+
"SEO content","SEO Inhalte"
|
135 |
+
"Settings","Einstellungen"
|
136 |
+
"Shop data","Shop-Daten"
|
137 |
+
"Shop name","Shopname"
|
138 |
+
"Shop URL","Shop-URL"
|
139 |
+
"Something went wrong while importing: #{error}. Please try again.","Beim Import ist ein Fehler aufgetreten: #{error}. Bitte versuchen Sie es erneut."
|
140 |
+
"Source StoreView","Ausgangs-StoreView"
|
141 |
+
"Specify a <b>Source StoreView</b> and <b>Target StoreView</b> for the requested translation.","Legen Sie den <b>Ausgangs-</b> und <b>Ziel-StoreView</b> für die gewünschte Übersetzung fest."
|
142 |
+
"Starting profile execution, please wait …","Starte Profilausführung, bitte warten…"
|
143 |
+
"starting with http:// or https://","mit http:// oder https:// beginnend"
|
144 |
+
"Status","Status"
|
145 |
+
"Stock Availability","Lagerbestand"
|
146 |
+
"Street","Straße"
|
147 |
+
"Submit","Absenden"
|
148 |
+
"System requirements","Systemvoraussetzungen"
|
149 |
+
"System Status","System-Status"
|
150 |
+
"Target StoreView","Ziel-StoreView"
|
151 |
+
"Telefax","Fax"
|
152 |
+
"Email Templates which origin from a file are written back to a file after translation. Email Templates from the database are written back to the database with the language prefix ""[%s]"".","E-Mail-Vorlagen aus Dateien werden nach der Übersetzung in Dateien zurück geschrieben. E-Mail-Vorlagen aus der Datenbank werden mit dem Präfix ""[%s]“ in die Datenbank zurückgeschrieben."
|
153 |
+
"The information in this tab has been changed.","Die Informationen in dieser Registerkarte wurden geändert."
|
154 |
+
"The number of entries per file heavily depends on your systems resources. You should decrease these numbers if your system fails to compile the files. The minimum number of entries per file is 6.","Die Anzahl an Einträgen pro Datei hängt stark von den Systemressourcen ab. Sie sollten die Anzahl verringern, wenn das System nicht in der Lage ist, die Dateien zu erstellen. Die Mindestanzahl an Einträgen pro Datei ist 6."
|
155 |
+
"This process may take a few minutes depending on project size. Please wait until a message is displayed that the import has been completed.","Dieser Vorgang kann je nach Projektgröße mehrere Minuten dauern. Brechen Sie den Vorgang nicht ab und warten Sie, bis der Abschluss des Imports bestätigt wird."
|
156 |
+
"This tab contains invalid data. Please solve the problem before saving.","Diese Registerkarte enthält ungültige Daten. Bitte beheben Sie dieses Problem bevor Sie speichern."
|
157 |
+
"To translate the Email Templates, we need to translate header.phtml and footer.phtml. We have prechecked these two files for you! If you do not want these files translated, please uncheck them.","Um die E-Mail-Vorlagen komplett zu übersetzen, sollten auch die Dateien header.phtml und footer.phtml übersetzt werden. Diese beiden Dateien wurden bereits vorausgewählt! Falls Sie diese Dateien nicht übersetzen möchten, deaktivieren Sie diese einfach wie"
|
158 |
+
"Total %d records found","Insgesamt %d Einträge gefunden"
|
159 |
+
"Transactional Emails","Transaktions-E-Mails"
|
160 |
+
"Translation files","Sprachdateien"
|
161 |
+
"Translation files","Sprachdateien"
|
162 |
+
"Translation","Übersetzung"
|
163 |
+
"translationMANAGER Quick Start Guide","translationMANAGER Schnellstart-Anleitung"
|
164 |
+
"translationMANAGER","translationMANAGER"
|
165 |
+
"Try again","Nochmal versuchen"
|
166 |
+
"Unable to save project settings","Projekteinstellungen konnten nicht gespeichert werden"
|
167 |
+
"Unselect all","Alle abwählen"
|
168 |
+
"Unselect visible","Sichtbare abwählen"
|
169 |
+
"untranslated_string","untranslated_string"
|
170 |
+
"updated_at","updated_at"
|
171 |
+
"URL keys","URL Keys"
|
172 |
+
"User name","Benutzername"
|
173 |
+
"Value for 'max_execution_time'","Wert von 'max_execution_time'"
|
174 |
+
"View","Ansicht"
|
175 |
+
"Warning: Please do not close the window during exporting data","Warnung: Bitte schließen Sie das Fenster nicht während des Export-Vorgangs"
|
176 |
+
"You will receive your connection credentials from your customer service representative at Eurotext AG as soon as you have completed your registration. Please enter your user name, password and customer number in ""Settings"".<br/><span style=""font-style:ita","Sie erhalten Ihre Zugangsdaten von Ihrem Kundenbetreuer der Eurotext AG im Anschluss an Ihre erfolgreiche Registrierung. Bitte tragen Sie im Menüpunkt „Einstellungen“ Ihren Benutzernamen, Ihr Passwort und Ihre Kundennummer ein.<br/><span style=""font-style"
|
177 |
+
"Your data are imported, please stay tuned. ","Ihre Daten wurden importiert, bitte warten. "
|
178 |
+
"Your Eurotext customer service representative will send your translations in a ZIP file. This zip file can be uploaded and imported to the relevant project.","Sie erhalten die Übersetzungen von Ihrem Eurotext-Kundenbetreuer in einer ZIP-Datei. Die ZIP-Datei kann im jeweiligen Projekt hochgeladen und importiert werden."
|
179 |
+
"Your Magento installation allows the translation of URLs of categories and products.","Ihre Magento-Installation erlaubt die Übersetzung der URLs von Kategorien und Artikeln."
|
180 |
+
"Your registration data has been saved and submitted.","Ihre Registrierungsdaten wurden gespeichert und gesendet."
|
181 |
+
"Your registration has been last saved at: %s","Letzte Änderung Ihrer Registrierungsdaten: %s"
|
182 |
+
"ZIP-Extension","ZIP-Extension"
|
183 |
+
"ZIP Code","PLZ"
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"…","…"
|
2 |
+
"Browse Files…","Dateien durchsuchen…"
|
3 |
+
"Complete","Vollständig"
|
4 |
+
"Maximum allowed file size for upload is","Die maximale Dateigröße für den Upload ist"
|
5 |
+
"Please check your server PHP settings.","Bitte prüfen Sie Ihre Server PHP-Einstellungen."
|
6 |
+
"Remove","Entfernen"
|
7 |
+
"There are files that were selected but not uploaded yet. After switching to another tab your selections will be lost. Do you wish to proceed?","Es wurden Dateien zum Hochladen ausgewählt, jedoch noch nicht hochgeladen. Wenn Sie in eine andere Registerkarte wechseln, wird Ihre Auswahl gelöscht. Möchten Sie fortfahren?"
|
8 |
+
"untranslated_string","untranslated_string"
|
9 |
+
"Upload file","Datei hochladen"
|
10 |
+
"Uploading …","Lädt hoch…"
|
@@ -1,227 +1,182 @@
|
|
1 |
-
"
|
2 |
-
"
|
3 |
-
"Reset","Reset"
|
4 |
-
"There seems to be a problem with your login data. Please check username and password!","There seems to be a problem with your login data. Please check username and password!"
|
5 |
-
"Here you will find a list of the settings required for operating the Eurotext interface","Here you will find a list of the settings required for operating the Eurotext interface"
|
6 |
-
"Please deactivate your popup blocker for the Magento backend.","Please deactivate your popup blocker for the Magento backend."
|
7 |
-
"E-Mail-Address","E-Mail-Address"
|
8 |
-
"No","No"
|
9 |
-
"Select the check box <b>Export URL keys?</b> if you would like to have URLs of products and categories translated.","Select the check box <b>Export URL keys?</b> if you would like to have URLs of products and categories translated."
|
10 |
-
"Select the check box <b>Export attributes and attribute options?</b> if you would like to have the product attributes and associated values translated.","Select the check box <b>Export attributes and attribute options?</b> if you would like to have the product attributes and associated values translated."
|
11 |
-
"Select the check box <b>Export SEO content?</b> if you would like to have the SEO content (e.g. keywords, search terms, meta tags, etc.) translated.","Select the check box <b>Export SEO content?</b> if you would like to have the SEO content (e.g. keywords, search terms, meta tags, etc.) translated."
|
12 |
-
"Please read the translationMANAGER documentation for more information.","Please read the translationMANAGER documentation for more information."
|
13 |
-
"<b>Please note:</b> For safety reasons, we recommend importing to a staging system first. Make sure to backup all your data before importing.","<b>Please note:</b> For safety reasons, we recommend importing to a staging system first. Make sure to backup all your data before importing."
|
14 |
-
"translationMANAGER Quick Start Guide","translationMANAGER Quick Start Guide"
|
15 |
-
"Your Eurotext customer service representative will send you your translations in a zip file. This zip file can be uploaded and imported to the relevant project.","Your Eurotext customer service representative will send you your translations in a zip file. This zip file can be uploaded and imported to the relevant project."
|
16 |
-
"Clicking the button <b>Request your free quote now</b> will transmit your texts for translation to the translation portal, and you will receive a detailed quote for your translation project within the next 24 hours (weekdays).","Clicking the button <b>Request your free quote now</b> will transmit your texts for translation to the translation portal, and you will receive a detailed quote for your translation project within the next 24 hours (weekdays)."
|
17 |
-
"Here you will find a list of required settings for running translationMANAGER.","Here you will find a list of required settings for running translationMANAGER."
|
18 |
-
"Make sure to complete the registration process and enter your access information before submitting your first translation project. Fill out all fields of the registration form and click <b><i>Save and send</i>.</b> Eurotext will send you your login details within 24 hours (weekdays). Enter that information in the menu item <b><i>Settings</i></b>.","Make sure to complete the registration process and enter your access information before submitting your first translation project. Fill out all fields of the registration form and click <b><i>Save and send</i>.</b> Eurotext will send you your login details within 24 hours (weekdays). Enter that information in the menu item <b><i>Settings</i></b>."
|
19 |
-
"You will receive your login details from your customer service representative at Eurotext AG as soon as you have completed your registration. Please enter your user name, password and customer number in ""Settings"".<br/><span style='font-style:italic;'><span style='color:red;'>Important:</span> Ensure that a storeview for the target language was created in the shop before exporting the text for translation, and that the storeview settings have the correct language settings</span>","You will receive your login details from your customer service representative at Eurotext AG as soon as you have completed your registration. Please enter your user name, password and customer number in ""Settings"".<br/><span style='font-style:italic;'><span style='color:red;'>Important:</span> Ensure that a storeview for the target language was created in the shop before exporting the text for translation, and that the storeview settings have the correct language settings</span>"
|
20 |
-
"Create a new project for each translation order.","Create a new project for each translation order."
|
21 |
-
"Each project must have a name assigned (we recommend something unique and identifiable).","Each project must have a name assigned (we recommend something unique and identifiable)."
|
22 |
-
"Specify a <b>Source Storeview</b> and <b>Target Storeview</b> for the requested translation.","Specify a <b>Source Storeview</b> and <b>Target Storeview</b> for the requested translation."
|
23 |
-
"Select the products, categories, CMS pages, or email templates you need translated","Select the products, categories, CMS pages, or email templates you need translated"
|
24 |
-
"Products, categories, CMS pages, or email templates can be selected individually (<b>Select […]</b>), or alternatively:","Products, categories, CMS pages, or email templates can be selected individually (<b>Select […]</b>), or alternatively:"
|
25 |
-
"<b>Select all [...] without existing translation:</b> The module will automatically select all items, categories, CMS pages and email templates for which no translated text exists in the target language.","<b>Select all [...] without existing translation:</b> The module will automatically select all items, categories, CMS pages and email templates for which no translated text exists in the target language."
|
26 |
-
"<i><span style='color:red;'>Important:</span> All previous assignments will be deleted!</i>","<i><span style='color:red;'>Important:</span> All previous assignments will be deleted!</i>"
|
27 |
-
"Clicking <b>Select language files</b> will allow you to manually select specific shop system texts in the selection window for translation.","Clicking <b>Select language files</b> will allow you to manually select specific shop system texts in the selection window for translation."
|
28 |
-
"Clicking <b>Select all language files without existing translation</b> will automatically select all files and check for missing translations. All entries without an existing translation will be exported.","Clicking <b>Select all language files without existing translation</b> will automatically select all files and check for missing translations. All entries without an existing translation will be exported."
|
29 |
-
"<i><span style='color:red;'>Important:</span> We recommend using this setting only for the initial translation of a new online shop, as it will trigger a translation of ALL language files for the selected target language!</i>","<i><span style='color:red;'>Important:</span> We recommend using this setting only for the initial translation of a new online shop, as it will trigger a translation of ALL language files for the selected target language!</i>"
|
30 |
-
"This information is your personal access data for the Eurotext AG translation portal.<br/>Registration is free of charge. You will receive your personal access information within 24 hours (weekdays).","This information is your personal access data for the Eurotext AG translation portal.<br/>Registration is free of charge. You will receive your personal access information within 24 hours (weekdays)."
|
31 |
-
"Select the check box <b>Export URL keys?</b> if you would like to have URLs of products and categories translated.","Select the check box <b>Export URL keys?</b> if you would like to have URLs of products and categories translated."
|
32 |
-
"Select the check box <b>Export attributes and attribute options?</b> if you would like to have the product attributes and associated values translated.","Select the check box <b>Export attributes and attribute options?</b> if you would like to have the product attributes and associated values translated."
|
33 |
-
"Select the check box <b>Export SEO content?</b> if you would like to have the SEO content (e.g. keywords, search terms, meta tags, etc.) translated.","Select the check box <b>Export SEO content?</b> if you would like to have the SEO content (e.g. keywords, search terms, meta tags, etc.) translated."
|
34 |
-
"Please read the translationMANAGER documentation for more information.","Please read the translationMANAGER documentation for more information."
|
35 |
-
"<b>Please note:</b> For safety reasons, we recommend importing to a staging system first. Make sure to backup all your data before importing.","<b>Please note:</b> For safety reasons, we recommend importing to a staging system first. Make sure to backup all your data before importing."
|
36 |
-
"translationMANAGER Quick Start Guide","translationMANAGER Quick Start Guide"
|
37 |
-
"Your Eurotext customer service representative will send you your translations in a zip file. This zip file can be uploaded and imported to the relevant project.","Your Eurotext customer service representative will send you your translations in a zip file. This zip file can be uploaded and imported to the relevant project."
|
38 |
-
"Clicking the button <b>Request your free quote now</b> will transmit your texts for translation to the translation portal, and you will receive a detailed quote for your translation project within the next 24 hours (weekdays).","Clicking the button <b>Request your free quote now</b> will transmit your texts for translation to the translation portal, and you will receive a detailed quote for your translation project within the next 24 hours (weekdays)."
|
39 |
-
"Here you will find a list of required settings for running translationMANAGER.","Here you will find a list of required settings for running translationMANAGER."
|
40 |
-
"Make sure to complete the registration process and enter your access information before submitting your first translation project. Fill out all fields of the registration form and click <b><i>Save and send</i>.</b> Eurotext will send you your login details within 24 hours (weekdays). Enter that information in the menu item <b><i>Settings</i></b>.","Make sure to complete the registration process and enter your access information before submitting your first translation project. Fill out all fields of the registration form and click <b><i>Save and send</i>.</b> Eurotext will send you your login details within 24 hours (weekdays). Enter that information in the menu item <b><i>Settings</i></b>."
|
41 |
-
"You will receive your login details from your customer service representative at Eurotext AG as soon as you have completed your registration. Please enter your user name, password and customer number in ""Settings"".<br/><span style='font-style:italic;'><span style='color:red;'>Important:</span> Ensure that a storeview for the target language was created in the shop before exporting the text for translation, and that the storeview settings have the correct language settings</span>","You will receive your login details from your customer service representative at Eurotext AG as soon as you have completed your registration. Please enter your user name, password and customer number in ""Settings"".<br/><span style='font-style:italic;'><span style='color:red;'>Important:</span> Ensure that a storeview for the target language was created in the shop before exporting the text for translation, and that the storeview settings have the correct language settings</span>"
|
42 |
-
"Create a new project for each translation order.","Create a new project for each translation order."
|
43 |
-
"Each project must have a name assigned (we recommend something unique and identifiable).","Each project must have a name assigned (we recommend something unique and identifiable)."
|
44 |
-
"Specify a <b>Source Storeview</b> and <b>Target Storeview</b> for the requested translation.","Specify a <b>Source Storeview</b> and <b>Target Storeview</b> for the requested translation."
|
45 |
-
"Select the items, categories, CMS pages, or email templates you need translated","Select the items, categories, CMS pages, or email templates you need translated"
|
46 |
-
"Items, categories, CMS pages, or email templates can be selected individually (<b>Select […]</b>), or alternatively:","Items, categories, CMS pages, or email templates can be selected individually (<b>Select […]</b>), or alternatively:"
|
47 |
-
"<b>Select all [...] without existing translation:</b> The module will automatically select all Products, categories, CMS pages and email templates for which no translated text exists in the target language.","<b>Select all [...] without existing translation:</b> The module will automatically select all Products, categories, CMS pages and email templates for which no translated text exists in the target language."
|
48 |
"<i><span style='color:red;'>Important:</span> All previous assignments will be deleted!</i>","<i><span style='color:red;'>Important:</span> All previous assignments will be deleted!</i>"
|
49 |
-
"Clicking <b>Select language files</b> will allow you to manually select specific shop system texts in the selection window for translation.","Clicking <b>Select language files</b> will allow you to manually select specific shop system texts in the selection window for translation."
|
50 |
-
"Clicking <b>Select all language files without existing translation</b> will automatically select all files and check for missing translations. All entries without an existing translation will be exported.","Clicking <b>Select all language files without existing translation</b> will automatically select all files and check for missing translations. All entries without an existing translation will be exported."
|
51 |
"<i><span style='color:red;'>Important:</span> We recommend using this setting only for the initial translation of a new online shop, as it will trigger a translation of ALL language files for the selected target language!</i>","<i><span style='color:red;'>Important:</span> We recommend using this setting only for the initial translation of a new online shop, as it will trigger a translation of ALL language files for the selected target language!</i>"
|
52 |
-
"
|
53 |
-
"
|
54 |
-
"
|
55 |
-
"
|
56 |
-
"
|
57 |
-
"
|
58 |
-
"
|
59 |
-
"
|
60 |
-
"
|
61 |
-
"
|
62 |
-
"
|
63 |
-
"
|
64 |
-
"
|
65 |
-
"
|
66 |
-
"Note","Note"
|
67 |
-
"Action","Action"
|
68 |
-
"Select language files","Select language files"
|
69 |
-
"Select email templates","Select email templates"
|
70 |
-
"Select CMS pages","Select CMS pages"
|
71 |
-
"Selecting this check box will assign all CMS pages without existing target language translations.<br/><b>Important: All previous assignments will be cancelled!</b>","Selecting this check box will assign all CMS pages without existing target language translations.<br/><b>Important: All previous assignments will be cancelled!</b>"
|
72 |
-
"Select all categories without existing translations","Select all categories without existing translations"
|
73 |
-
"Select all CMS pages without existing translations","Select all CMS pages without existing translations"
|
74 |
-
"Select all email templates without existing translations","Select all email templates without existing translations"
|
75 |
-
"Select all entries in language files without existing translations","Select all entries in language files without existing translations"
|
76 |
-
"Export SEO content?","Export SEO content?"
|
77 |
-
"Export attributes und attribute options?","Export attributes und attribute options?"
|
78 |
-
"Export URL keys?","Export URL keys?"
|
79 |
-
"Select categories","Select categories"
|
80 |
-
"Selecting this check box will trigger a check of all language files for missing translations. All entries without an existing translation will be exported.<br><b>Important: All previous assignments will be cancelled!</b>","Selecting this check box will trigger a check of all language files for missing translations. All entries without an existing translation will be exported.<br><b>Important: All previous assignments will be cancelled!</b>"
|
81 |
-
"Selecting this check box will export all email templates without a counterpart in the target language.<br><b>Important: All previous assignments will be cancelled!</b>","Selecting this check box will export all email templates without a counterpart in the target language.<br><b>Important: All previous assignments will be cancelled!</b>"
|
82 |
-
"Selecting this check box will assign all categories for which no texts have been created in the target language.<br/><b>Important: All previous assignments will be cancelled!</b>","Selecting this check box will assign all categories for which no texts have been created in the target language.<br/><b>Important: All previous assignments will be cancelled!</b>"
|
83 |
-
"or","or"
|
84 |
-
"Select all products without existing translations","Select all products without existing translations"
|
85 |
-
"Selecting this check box will assign all items for which no text has been created in the target language.<br><b>Important: All previous assignments will be cancelled!</b>","Selecting this check box will assign all items for which no text has been created in the target language.<br><b>Important: All previous assignments will be cancelled!</b>"
|
86 |
-
"Select products","Select products"
|
87 |
-
"Target storeview","Target storeview"
|
88 |
-
"Source storeview","Source storeview"
|
89 |
-
"Specify the source language (source storeview) and the target language (target storeview).<br/>The language of the current storeview is shown in brackets. You can amend the language setting in Magento if the language shown is incorrect:<br/>System -> Configuration, then select ""Storeview"" at the top left. Set the correct language via General -> Locale Options (here you can also double-check all other language/country settings for your shop)","Specify the source language (source storeview) and the target language (target storeview).<br/>The language of the current storeview is shown in brackets. You can amend the language setting in Magento if the language shown is incorrect:<br/>System -> Configuration, then select ""Storeview"" at the top left. Set the correct language via General -> Locale Options (here you can also double-check all other language/country settings for your shop)"
|
90 |
-
"Create a unique project name here. This will allow you better recognize your various projects later.","Create a unique project name here. This will allow you better recognize your various projects later."
|
91 |
-
"Project name","Project name"
|
92 |
-
"Import translations","Import translations"
|
93 |
-
"Delete","Delete"
|
94 |
-
"Your Magento installation allows the translation of URLs of categories and products.","Your Magento installation allows the translation of URLs of categories and products."
|
95 |
-
"Customer ID","Customer ID"
|
96 |
-
"Settings","Settings"
|
97 |
-
"Edit information","Edit information"
|
98 |
-
"Save and send","Save and send"
|
99 |
-
"Shop URL","Shop URL"
|
100 |
-
"Mr.","Mr."
|
101 |
-
"Ms.","Ms."
|
102 |
-
"Any information you provide is voluntary. Your data will be used for the purpose of logging in to the translation portal and for project processing in your dealings with Eurotext AG only. Your information will not be forwarded to third parties. You can request a deletion of your information at any time by sending an email to <a href='mailto:datenschutz@eurotext.de'>privacy@eurotext.de</a>.","Any information you provide is voluntary. Your data will be used for the purpose of logging in to the translation portal and for project processing in your dealings with Eurotext AG only. Your information will not be forwarded to third parties. You can request a deletion of your information at any time by sending an email to <a href='mailto:datenschutz@eurotext.de'>privacy@eurotext.de</a>."
|
103 |
-
"Important","Important"
|
104 |
-
"Please enter all requested information!","Please enter all requested information!"
|
105 |
"City","City"
|
106 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
"Company","Company"
|
108 |
-
"
|
109 |
-
"
|
|
|
110 |
"Country","Country"
|
111 |
-
"
|
112 |
-
"
|
113 |
-
"
|
114 |
-
"
|
115 |
-
"
|
116 |
-
"
|
117 |
-
"
|
118 |
-
"
|
119 |
-
"
|
120 |
-
"
|
121 |
-
"
|
122 |
-
"
|
123 |
-
"
|
124 |
-
"
|
125 |
-
"
|
126 |
-
"
|
127 |
-
"
|
128 |
-
"
|
129 |
-
"
|
130 |
-
"
|
131 |
-
"
|
132 |
-
"
|
133 |
-
"
|
134 |
-
"
|
135 |
-
"
|
136 |
-
"
|
137 |
-
"
|
138 |
-
"
|
139 |
-
"
|
140 |
-
"
|
141 |
-
"
|
142 |
-
"
|
143 |
-
"
|
144 |
-
"Saved","Saved"
|
145 |
-
"Please wait","Please wait"
|
146 |
-
"System requirements","System requirements"
|
147 |
-
"Designation","Designation"
|
148 |
-
"Current value","Current value"
|
149 |
-
"Required value","Required value"
|
150 |
-
"Unsupported language","Unsupported language"
|
151 |
-
"Registration","Registration"
|
152 |
-
"Importing","Importing"
|
153 |
-
"Edit","Edit"
|
154 |
-
"Please wait - saving project settings","Please wait - saving project settings"
|
155 |
-
"Please wait - this may take a while","Please wait - this may take a while"
|
156 |
-
"Last update","Last update"
|
157 |
-
"Project name","Project name"
|
158 |
-
"Source storeview","Source storeview"
|
159 |
-
"Status","Status"
|
160 |
-
"Action","Action"
|
161 |
-
"Checking category","Checking category"
|
162 |
-
"Checking email templates","Checking email templates"
|
163 |
-
"Checking attributes","Checking attributes"
|
164 |
-
"Analyzing","Analyzing"
|
165 |
-
"Searching language files","Searching language files"
|
166 |
-
"Generating language files","Generating language files"
|
167 |
"Generating ZIP archive","Generating ZIP archive"
|
168 |
-
"
|
169 |
-
"
|
170 |
-
"
|
171 |
-
"
|
172 |
-
"
|
173 |
-
"
|
174 |
-
"
|
175 |
-
"
|
176 |
-
"Please select source storeview!","Please select source storeview!"
|
177 |
-
"Please select target storeview!","Please select target storeview!"
|
178 |
-
"Source and target storeviews must not be the same!","Source and target storeviews must not be the same!"
|
179 |
-
"Language file import completed.","Language file import completed."
|
180 |
-
"Checking CMS page","Checking CMS page"
|
181 |
-
"Checking Product","Checking product"
|
182 |
-
"Checking category","Checking category"
|
183 |
-
"Not yet selected","Not yet selected"
|
184 |
-
"In progress","In progress"
|
185 |
"Import","Import"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
"Loaded","Loaded"
|
187 |
-
"Already submitted. Project settings can no longer be edited.","Already submitted. Project settings can no longer be edited."
|
188 |
-
"Begin import","Begin import"
|
189 |
-
"Processing - please wait...","Processing - please wait..."
|
190 |
"Loading - please wait...","Loading - please wait..."
|
191 |
-
"
|
192 |
-
"
|
193 |
-
"Translation portal successfully connected!","Translation portal successfully connected!"
|
194 |
-
"Not yet saved","Not yet saved"
|
195 |
-
"Last save","Last save"
|
196 |
-
"New project","New project"
|
197 |
-
"-- Select storeview --","-- Select storeview --"
|
198 |
-
"Select products","Select products"
|
199 |
-
"Find","Find"
|
200 |
-
"Find products","Find products"
|
201 |
-
"Enter designation or SKU","Enter designation or SKU"
|
202 |
-
"Page","Page"
|
203 |
-
"No result","No result"
|
204 |
-
"Selected products","Selected products"
|
205 |
-
"Translate","Translate"
|
206 |
-
"Select categories","Select categories"
|
207 |
-
"Selected categories","Selected categories"
|
208 |
-
"Select CMS pages","Select CMS pages"
|
209 |
-
"Selected CMS pages","Selected CMS pages"
|
210 |
-
"Installed","Installed"
|
211 |
"Missing","Missing"
|
212 |
-
"
|
213 |
-
"
|
214 |
-
"
|
|
|
|
|
215 |
"New","New"
|
216 |
-
"
|
217 |
-
"
|
218 |
-
"
|
219 |
-
"
|
220 |
-
"
|
221 |
-
"
|
222 |
-
"
|
223 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
"Please wait","Please wait"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
"Status","Status"
|
226 |
-
"
|
227 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"<b>Please note:</b> For safety reasons, we recommend testing the import on a staging system first. Make sure to back up all your data before importing.","<b>Please note:</b> For safety reasons, we recommend testing the import on a staging system first. Make sure to back up all your data before importing."
|
2 |
+
"<b>Select all [...] without existing translation:</b> The plugin will automatically select all products, categories, CMS pages and email templates for which no translated text exists in the target language.","<b>Select all [...] without existing translation:</b> The plugin will automatically select all products, categories, CMS pages and email templates for which no translated text exists in the target language."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
"<i><span style='color:red;'>Important:</span> All previous assignments will be deleted!</i>","<i><span style='color:red;'>Important:</span> All previous assignments will be deleted!</i>"
|
|
|
|
|
4 |
"<i><span style='color:red;'>Important:</span> We recommend using this setting only for the initial translation of a new online shop, as it will trigger a translation of ALL language files for the selected target language!</i>","<i><span style='color:red;'>Important:</span> We recommend using this setting only for the initial translation of a new online shop, as it will trigger a translation of ALL language files for the selected target language!</i>"
|
5 |
+
"Actions","Actions"
|
6 |
+
"Active","Active"
|
7 |
+
"Added %s files to the import queue.","Added %s files to the import queue."
|
8 |
+
"Attributes and attribute options","Attributes and attribute options"
|
9 |
+
"Back","Back"
|
10 |
+
"Batch %s / %s Categories:","Batch %s / %s Categories:"
|
11 |
+
"Batch %s / %s CMS Blocks:","Batch %s / %s CMS Blocks:"
|
12 |
+
"Batch %s / %s CMS Pages:","Batch %s / %s CMS Pages:"
|
13 |
+
"Batch %s / %s CSV File: %s","Batch %s / %s CSV File: %s"
|
14 |
+
"Batch %s / %s Products:","Batch %s / %s Products:"
|
15 |
+
"Catalog URL key scope","Catalog URL key scope"
|
16 |
+
"Categories per file","Categories per file"
|
17 |
+
"Categories","Categories"
|
18 |
+
"Change URL key scope","Change URL key scope"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
"City","City"
|
20 |
+
"Click here to change the scope of URL keys to enable translation of URL keys for products and categories. (Attention: This cannot be undone!)","Click here to change the scope of URL keys to enable translation of URL keys for products and categories. (Attention: This cannot be undone!)"
|
21 |
+
"Clicking <b>Select all entries in language files without existing translations</b> will automatically select all files and check for missing translations. All entries without an existing translation will be exported.","Clicking <b>Select all entries in language files without existing translations</b> will automatically select all files and check for missing translations. All entries without an existing translation will be exported."
|
22 |
+
"Clicking <b>Select language files</b> will allow you to manually select specific shop system texts in the selection window for translation.","Clicking <b>Select language files</b> will allow you to manually select specific shop system texts in the selection window for translation."
|
23 |
+
"Clicking the button <b>Request free quotation now</b> will transmit your texts for translation to the translation portal, and you will receive a detailed quote for your translation project within the next 24 hours (weekdays).","Clicking the button <b>Request free quotation now</b> will transmit your texts for translation to the translation portal, and you will receive a detailed quote for your translation project within the next 24 hours (weekdays)."
|
24 |
+
"CMS Blocks","CMS Blocks"
|
25 |
+
"CMS Pages and Blocks","CMS Pages and Blocks"
|
26 |
+
"CMS Pages per file","CMS Pages per file"
|
27 |
+
"CMS Pages","CMS Pages"
|
28 |
+
"Comment","Comment"
|
29 |
"Company","Company"
|
30 |
+
"Connection credentials","Connection credentials"
|
31 |
+
"Contact data","Contact data"
|
32 |
+
"Contact","Contact"
|
33 |
"Country","Country"
|
34 |
+
"Create a new project for each translation order.","Create a new project for each translation order."
|
35 |
+
"Currently your Magento installation is not capable to save translated URL keys for products and categories.","Currently your Magento installation is not capable to save translated URL keys for products and categories."
|
36 |
+
"Customer ID","Customer ID"
|
37 |
+
"Data sent.","Data sent."
|
38 |
+
"Directory ""%s"" is not writeable.","Directory ""%s"" is not writeable."
|
39 |
+
"Directory ""%s"" is writeable.","Directory ""%s"" is writeable."
|
40 |
+
"Directory permissions","Directory permissions"
|
41 |
+
"Do you really want to delete this project?","Do you really want to delete this project?"
|
42 |
+
"Do you really want to reset this project?","Do you really want to reset this project?"
|
43 |
+
"Each project must have a name assigned (we recommend something unique and distinguishable).","Each project must have a name assigned (we recommend something unique and distinguishable)."
|
44 |
+
"Email Address","Email Address"
|
45 |
+
"Email Templates","Email Templates"
|
46 |
+
"Eurotext AG translationMANAGER: Debug mode enabled!","Eurotext AG translationMANAGER: Debug mode enabled!"
|
47 |
+
"Eurotext AG translationMANAGER: FTP Upload disabled!","Eurotext AG translationMANAGER: FTP Upload disabled!"
|
48 |
+
"Eurotext AG translationMANAGER","Eurotext AG translationMANAGER"
|
49 |
+
"Export done.","Export done."
|
50 |
+
"Export to Eurotext AG","Export to Eurotext AG"
|
51 |
+
"Export","Export"
|
52 |
+
"Exported %s Email Templates","Exported %s Email Templates"
|
53 |
+
"Exported attributes.","Exported attributes."
|
54 |
+
"Exported categories.","Exported categories."
|
55 |
+
"Exported CMS Blocks.","Exported CMS Blocks."
|
56 |
+
"Exported CMS Pages.","Exported CMS Pages."
|
57 |
+
"Exported data","Exported data"
|
58 |
+
"Exported language files.","Exported language files."
|
59 |
+
"Exported products.","Exported products."
|
60 |
+
"Exported","Exported"
|
61 |
+
"File %s processed of %s.","File %s processed of %s."
|
62 |
+
"First name","First name"
|
63 |
+
"FTP Status","FTP Status"
|
64 |
+
"FTP test failed! Please check your connection credentials.","FTP test failed! Please check your connection credentials."
|
65 |
+
"FTP Upload successfully tested.","FTP Upload successfully tested."
|
66 |
+
"FTP-Extension","FTP-Extension"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
"Generating ZIP archive","Generating ZIP archive"
|
68 |
+
"Next page","Next page"
|
69 |
+
"Go to previous page","Go to previous page"
|
70 |
+
"Help","Help"
|
71 |
+
"Here you will find a list of settings required for operating the Eurotext interface","Here you will find a list of settings required for operating the Eurotext interface"
|
72 |
+
"Higher is better (Zero is infinite)","Higher is better (Zero is infinite)"
|
73 |
+
"ID","ID"
|
74 |
+
"Import the ZIP file containing the finished translations here.","Import the ZIP file containing the finished translations here."
|
75 |
+
"Import translations","Import translations"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
"Import","Import"
|
77 |
+
"In progress","In progress"
|
78 |
+
"In Stock","In Stock"
|
79 |
+
"Installed","Installed"
|
80 |
+
"Items selected","Items selected"
|
81 |
+
"Languages in Stores","Languages in Stores"
|
82 |
+
"Last name","Last name"
|
83 |
+
"Leave empty for default value: 20","Leave empty for default value: 20"
|
84 |
"Loaded","Loaded"
|
|
|
|
|
|
|
85 |
"Loading - please wait...","Loading - please wait..."
|
86 |
+
"Make sure to complete the registration process and enter your access information before submitting your first translation project. Fill out all fields of the registration form and click <b><i>Save and send</i> </b>. Eurotext will send your connection credentials.","Make sure to complete the registration process and enter your access information before submitting your first translation project. Fill out all fields of the registration form and click <b><i>Save and send</i> </b>. Eurotext will send your connection credentials."
|
87 |
+
"Manage project","Manage project"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
"Missing","Missing"
|
89 |
+
"Plugin version","Plugin version"
|
90 |
+
"Mr.","Mr."
|
91 |
+
"Mrs.","Mrs."
|
92 |
+
"Name","Name"
|
93 |
+
"New project","New project"
|
94 |
"New","New"
|
95 |
+
"Next page","Next page"
|
96 |
+
"No Email Templates from the database exported","No Email Templates from the database exported"
|
97 |
+
"No file was selected, or the file selected is not a ZIP file","No file was selected, or the file selected is not a ZIP file"
|
98 |
+
"of %s pages","of %s pages"
|
99 |
+
"Only data is exported, which is not translated yet.","Only data is exported, which is not translated yet."
|
100 |
+
"Out of Stock","Out of Stock"
|
101 |
+
"Page","Page"
|
102 |
+
"Password","Password"
|
103 |
+
"per page","per page"
|
104 |
+
"Phone","Phone"
|
105 |
+
"PHP version","PHP version"
|
106 |
+
"Please read the translationMANAGER documentation for more information.","Please read the translationMANAGER documentation for more information."
|
107 |
+
"Please save the project before exporting it!","Please save the project before exporting it!"
|
108 |
+
"Please wait - saving project settings","Please wait - saving project settings"
|
109 |
+
"Please wait - this may take a while","Please wait - this may take a while"
|
110 |
+
"Please wait...","Please wait..."
|
111 |
"Please wait","Please wait"
|
112 |
+
"Processing - please wait…","Processing - please wait…"
|
113 |
+
"Product Count","Product Count"
|
114 |
+
"Products per file","Products per file"
|
115 |
+
"Products, categories, CMS Pages, or Email Templates can be selected individually (<b>Select […]</b>), or alternatively:","Products, categories, CMS Pages, or Email Templates can be selected individually (<b>Select […]</b>), or alternatively:"
|
116 |
+
"Products","Products"
|
117 |
+
"Project ""%s"" saved with ID ""%s“.","Project ""%s"" saved with ID ""%s“."
|
118 |
+
"Project ""%s"" was exported. You can't edit it anymore.","Project ""%s"" was exported. You can't edit it anymore."
|
119 |
+
"Project Information","Project Information"
|
120 |
+
"Projects","Projects"
|
121 |
+
"Registration","Registration"
|
122 |
+
"Registration/Settings","Registration/Settings"
|
123 |
+
"Reset to last status","Reset to last status"
|
124 |
+
"Salutation","Salutation"
|
125 |
+
"Save project","Save project"
|
126 |
+
"Select All","Select All"
|
127 |
+
"Select the check box <b>Export attributes and attribute options?</b> if you would like to have the product attributes and associated values translated.","Select the check box <b>Export attributes and attribute options?</b> if you would like to have the product attributes and associated values translated."
|
128 |
+
"Select the check box <b>Export SEO content?</b> if you would like to have the SEO content (e.g. keywords, search terms, meta tags, etc.) translated.","Select the check box <b>Export SEO content?</b> if you would like to have the SEO content (e.g. keywords, search terms, meta tags, etc.) translated."
|
129 |
+
"Select the check box <b>Export URL keys?</b> if you would like to have URLs of products and categories translated.","Select the check box <b>Export URL keys?</b> if you would like to have URLs of products and categories translated."
|
130 |
+
"Select the products, categories, CMS Pages or Email Templates you need translated","Select the products, categories, CMS Pages or Email Templates you need translated"
|
131 |
+
"Select visible","Select visible"
|
132 |
+
"Sending data","Sending data"
|
133 |
+
"SEO content","SEO content"
|
134 |
+
"Settings","Settings"
|
135 |
+
"Shop data","Shop data"
|
136 |
+
"Shop name","Shop name"
|
137 |
+
"Shop URL","Shop URL"
|
138 |
+
"Something went wrong while importing: #{error}. Please try again.","Something went wrong while importing: #{error}. Please try again."
|
139 |
+
"Source StoreView","Source StoreView"
|
140 |
+
"Specify a <b>Source StoreView</b> and <b>Target StoreView</b> for the requested translation.","Specify a <b>Source StoreView</b> and <b>Target StoreView</b> for the requested translation."
|
141 |
+
"Starting profile execution, please wait …","Starting profile execution, please wait …"
|
142 |
+
"starting with http:// or https://","starting with http:// or https://"
|
143 |
"Status","Status"
|
144 |
+
"Stock Availability","Stock Availability"
|
145 |
+
"Street","Street"
|
146 |
+
"Submit","Submit"
|
147 |
+
"System requirements","System requirements"
|
148 |
+
"System Status","System Status"
|
149 |
+
"Target StoreView","Target StoreView"
|
150 |
+
"Telefax","Telefax"
|
151 |
+
"Email Templates which origin from a file are written back to a file after translation. Email Templates from the database are written back to the database with the language prefix ""[%s]"".","Email Templates which origin from a file are written back to a file after translation. Email Templates from the database are written back to the database with the language prefix ""[%s]""."
|
152 |
+
"The information in this tab has been changed.","The information in this tab has been changed."
|
153 |
+
"The number of entries per file heavily depends on your systems resources. You should decrease these numbers if your system fails to compile the files. The minimum number of entries per file is 6.","The number of entries per file heavily depends on your systems resources. You should decrease these numbers if your system fails to compile the files. The minimum number of entries per file is 6."
|
154 |
+
"This process may take a few minutes depending on project size. Please wait until a message is displayed that the import has been completed.","This process may take a few minutes depending on project size. Please wait until a message is displayed that the import has been completed."
|
155 |
+
"This tab contains invalid data. Please solve the problem before saving.","This tab contains invalid data. Please solve the problem before saving."
|
156 |
+
"To translate the Email Templates, we need to translate header.phtml and footer.phtml. We have prechecked these two files for you! If you do not want these files translated, please uncheck them.","To translate the Email Templates, we need to translate header.phtml and footer.phtml. We have prechecked these two files for you! If you do not want these files translated, please uncheck them."
|
157 |
+
"Total %d records found","Total %d records found"
|
158 |
+
"Transactional Emails","Transactional Emails"
|
159 |
+
"Translation files","Translation files"
|
160 |
+
"Translation files","Translation files"
|
161 |
+
"Translation","Translation"
|
162 |
+
"translationMANAGER Quick Start Guide","translationMANAGER Quick Start Guide"
|
163 |
+
"translationMANAGER","translationMANAGER"
|
164 |
+
"Try again","Try again"
|
165 |
+
"Unable to save project settings","Unable to save project settings"
|
166 |
+
"Unselect all","Unselect all"
|
167 |
+
"Unselect visible","Unselect visible"
|
168 |
+
"untranslated_string","untranslated_string"
|
169 |
+
"updated_at","updated_at"
|
170 |
+
"URL keys","URL keys"
|
171 |
+
"User name","User name"
|
172 |
+
"Value for 'max_execution_time'","Value for 'max_execution_time'"
|
173 |
+
"View","View"
|
174 |
+
"Warning: Please do not close the window during exporting data","Warning: Please do not close the window during exporting data"
|
175 |
+
"You will receive your connection credentials from your customer service representative at Eurotext AG as soon as you have completed your registration. Please enter your user name, password and customer number in ""Settings"".<br/><span style=""font-style:italic;""><sp","You will receive your connection credentials from your customer service representative at Eurotext AG as soon as you have completed your registration. Please enter your user name, password and customer number in ""Settings"".<br/><span style=""font-style:italic;""><sp"
|
176 |
+
"Your data are imported, please stay tuned. ","Your data are imported, please stay tuned. "
|
177 |
+
"Your Eurotext customer service representative will send your translations in a ZIP file. This zip file can be uploaded and imported to the relevant project.","Your Eurotext customer service representative will send your translations in a ZIP file. This zip file can be uploaded and imported to the relevant project."
|
178 |
+
"Your Magento installation allows the translation of URLs of categories and products.","Your Magento installation allows the translation of URLs of categories and products."
|
179 |
+
"Your registration data has been saved and submitted.","Your registration data has been saved and submitted."
|
180 |
+
"Your registration has been last saved at: %s","Your registration has been last saved at: %s"
|
181 |
+
"ZIP-Extension","ZIP-Extension"
|
182 |
+
"ZIP Code","ZIP Code"
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"…","…"
|
2 |
+
"Browse Files…","Browse Files…"
|
3 |
+
"Complete","Complete"
|
4 |
+
"Maximum allowed file size for upload is","Maximum allowed file size for upload is"
|
5 |
+
"Please check your server PHP settings.","Please check your server PHP settings."
|
6 |
+
"Remove","Remove"
|
7 |
+
"There are files that were selected but not uploaded yet. After switching to another tab your selections will be lost. Do you wish to proceed?","There are files that were selected but not uploaded yet. After switching to another tab your selections will be lost. Do you wish to proceed?"
|
8 |
+
"untranslated_string","untranslated_string"
|
9 |
+
"Upload file","Upload file"
|
10 |
+
"Uploading …","Uploading …"
|
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
/*! flow.js 2.9.0 */
|
2 |
+
!function(a,b,c){"use strict";function d(b){if(this.support=!("undefined"==typeof File||"undefined"==typeof Blob||"undefined"==typeof FileList||!Blob.prototype.slice&&!Blob.prototype.webkitSlice&&!Blob.prototype.mozSlice),this.support){this.supportDirectory=/WebKit/.test(a.navigator.userAgent),this.files=[],this.defaults={chunkSize:1048576,forceChunkSize:!1,simultaneousUploads:3,singleFile:!1,fileParameterName:"file",progressCallbacksInterval:500,speedSmoothingFactor:.1,query:{},headers:{},withCredentials:!1,preprocess:null,method:"multipart",testMethod:"GET",uploadMethod:"POST",prioritizeFirstAndLastChunk:!1,target:"/",testChunks:!0,generateUniqueIdentifier:null,maxChunkRetries:0,chunkRetryInterval:null,permanentErrors:[404,415,500,501],successStatuses:[200,201,202],onDropStopPropagation:!1},this.opts={},this.events={};var c=this;this.onDrop=function(a){c.opts.onDropStopPropagation&&a.stopPropagation(),a.preventDefault();var b=a.dataTransfer;b.items&&b.items[0]&&b.items[0].webkitGetAsEntry?c.webkitReadDataTransfer(a):c.addFiles(b.files,a)},this.preventEvent=function(a){a.preventDefault()},this.opts=d.extend({},this.defaults,b||{})}}function e(a,b){this.flowObj=a,this.file=b,this.name=b.fileName||b.name,this.size=b.size,this.relativePath=b.relativePath||b.webkitRelativePath||this.name,this.uniqueIdentifier=a.generateUniqueIdentifier(b),this.chunks=[],this.paused=!1,this.error=!1,this.averageSpeed=0,this.currentSpeed=0,this._lastProgressCallback=Date.now(),this._prevUploadedSize=0,this._prevProgress=0,this.bootstrap()}function f(a,b,c){this.flowObj=a,this.fileObj=b,this.fileObjSize=b.size,this.offset=c,this.tested=!1,this.retries=0,this.pendingRetry=!1,this.preprocessState=0,this.loaded=0,this.total=0;var d=this.flowObj.opts.chunkSize;this.startByte=this.offset*d,this.endByte=Math.min(this.fileObjSize,(this.offset+1)*d),this.xhr=null,this.fileObjSize-this.endByte<d&&!this.flowObj.opts.forceChunkSize&&(this.endByte=this.fileObjSize);var e=this;this.event=function(a,b){b=Array.prototype.slice.call(arguments),b.unshift(e),e.fileObj.chunkEvent.apply(e.fileObj,b)},this.progressHandler=function(a){a.lengthComputable&&(e.loaded=a.loaded,e.total=a.total),e.event("progress",a)},this.testHandler=function(){var a=e.status(!0);"error"===a?(e.event(a,e.message()),e.flowObj.uploadNextChunk()):"success"===a?(e.tested=!0,e.event(a,e.message()),e.flowObj.uploadNextChunk()):e.fileObj.paused||(e.tested=!0,e.send())},this.doneHandler=function(){var a=e.status();if("success"===a||"error"===a)e.event(a,e.message()),e.flowObj.uploadNextChunk();else{e.event("retry",e.message()),e.pendingRetry=!0,e.abort(),e.retries++;var b=e.flowObj.opts.chunkRetryInterval;null!==b?setTimeout(function(){e.send()},b):e.send()}}}function g(a,b){var c=a.indexOf(b);c>-1&&a.splice(c,1)}function h(a,b){return"function"==typeof a&&(b=Array.prototype.slice.call(arguments),a=a.apply(null,b.slice(1))),a}function i(a,b){setTimeout(a.bind(b),0)}function j(a){return k(arguments,function(b){b!==a&&k(b,function(b,c){a[c]=b})}),a}function k(a,b,c){if(a){var d;if("undefined"!=typeof a.length){for(d=0;d<a.length;d++)if(b.call(c,a[d],d)===!1)return}else for(d in a)if(a.hasOwnProperty(d)&&b.call(c,a[d],d)===!1)return}}var l=a.navigator.msPointerEnabled;d.prototype={on:function(a,b){a=a.toLowerCase(),this.events.hasOwnProperty(a)||(this.events[a]=[]),this.events[a].push(b)},off:function(a,b){a!==c?(a=a.toLowerCase(),b!==c?this.events.hasOwnProperty(a)&&g(this.events[a],b):delete this.events[a]):this.events={}},fire:function(a,b){b=Array.prototype.slice.call(arguments),a=a.toLowerCase();var c=!1;return this.events.hasOwnProperty(a)&&k(this.events[a],function(a){c=a.apply(this,b.slice(1))===!1||c},this),"catchall"!=a&&(b.unshift("catchAll"),c=this.fire.apply(this,b)===!1||c),!c},webkitReadDataTransfer:function(a){function b(a){g+=a.length,k(a,function(a){if(a.isFile){var e=a.fullPath;a.file(function(a){c(a,e)},d)}else a.isDirectory&&a.createReader().readEntries(b,d)}),e()}function c(a,b){a.relativePath=b.substring(1),h.push(a),e()}function d(a){throw a}function e(){0==--g&&f.addFiles(h,a)}var f=this,g=a.dataTransfer.items.length,h=[];k(a.dataTransfer.items,function(a){var f=a.webkitGetAsEntry();return f?void(f.isFile?c(a.getAsFile(),f.fullPath):f.createReader().readEntries(b,d)):void e()})},generateUniqueIdentifier:function(a){var b=this.opts.generateUniqueIdentifier;if("function"==typeof b)return b(a);var c=a.relativePath||a.webkitRelativePath||a.fileName||a.name;return a.size+"-"+c.replace(/[^0-9a-zA-Z_-]/gim,"")},uploadNextChunk:function(a){var b=!1;if(this.opts.prioritizeFirstAndLastChunk&&(k(this.files,function(a){return!a.paused&&a.chunks.length&&"pending"===a.chunks[0].status()&&0===a.chunks[0].preprocessState?(a.chunks[0].send(),b=!0,!1):!a.paused&&a.chunks.length>1&&"pending"===a.chunks[a.chunks.length-1].status()&&0===a.chunks[0].preprocessState?(a.chunks[a.chunks.length-1].send(),b=!0,!1):void 0}),b))return b;if(k(this.files,function(a){return a.paused||k(a.chunks,function(a){return"pending"===a.status()&&0===a.preprocessState?(a.send(),b=!0,!1):void 0}),b?!1:void 0}),b)return!0;var c=!1;return k(this.files,function(a){return a.isComplete()?void 0:(c=!0,!1)}),c||a||i(function(){this.fire("complete")},this),!1},assignBrowse:function(a,c,d,e){"undefined"==typeof a.length&&(a=[a]),k(a,function(a){var f;"INPUT"===a.tagName&&"file"===a.type?f=a:(f=b.createElement("input"),f.setAttribute("type","file"),j(f.style,{visibility:"hidden",position:"absolute"}),a.appendChild(f),a.addEventListener("click",function(){f.click()},!1)),this.opts.singleFile||d||f.setAttribute("multiple","multiple"),c&&f.setAttribute("webkitdirectory","webkitdirectory"),k(e,function(a,b){f.setAttribute(b,a)});var g=this;f.addEventListener("change",function(a){g.addFiles(a.target.files,a),a.target.value=""},!1)},this)},assignDrop:function(a){"undefined"==typeof a.length&&(a=[a]),k(a,function(a){a.addEventListener("dragover",this.preventEvent,!1),a.addEventListener("dragenter",this.preventEvent,!1),a.addEventListener("drop",this.onDrop,!1)},this)},unAssignDrop:function(a){"undefined"==typeof a.length&&(a=[a]),k(a,function(a){a.removeEventListener("dragover",this.preventEvent),a.removeEventListener("dragenter",this.preventEvent),a.removeEventListener("drop",this.onDrop)},this)},isUploading:function(){var a=!1;return k(this.files,function(b){return b.isUploading()?(a=!0,!1):void 0}),a},_shouldUploadNext:function(){var a=0,b=!0,c=this.opts.simultaneousUploads;return k(this.files,function(d){k(d.chunks,function(d){return"uploading"===d.status()&&(a++,a>=c)?(b=!1,!1):void 0})}),b&&a},upload:function(){var a=this._shouldUploadNext();if(a!==!1){this.fire("uploadStart");for(var b=!1,c=1;c<=this.opts.simultaneousUploads-a;c++)b=this.uploadNextChunk(!0)||b;b||i(function(){this.fire("complete")},this)}},resume:function(){k(this.files,function(a){a.resume()})},pause:function(){k(this.files,function(a){a.pause()})},cancel:function(){for(var a=this.files.length-1;a>=0;a--)this.files[a].cancel()},progress:function(){var a=0,b=0;return k(this.files,function(c){a+=c.progress()*c.size,b+=c.size}),b>0?a/b:0},addFile:function(a,b){this.addFiles([a],b)},addFiles:function(a,b){var c=[];k(a,function(a){if((!l||l&&a.size>0)&&(a.size%4096!==0||"."!==a.name&&"."!==a.fileName)&&!this.getFromUniqueIdentifier(this.generateUniqueIdentifier(a))){var d=new e(this,a);this.fire("fileAdded",d,b)&&c.push(d)}},this),this.fire("filesAdded",c,b)&&k(c,function(a){this.opts.singleFile&&this.files.length>0&&this.removeFile(this.files[0]),this.files.push(a)},this),this.fire("filesSubmitted",c,b)},removeFile:function(a){for(var b=this.files.length-1;b>=0;b--)this.files[b]===a&&(this.files.splice(b,1),a.abort())},getFromUniqueIdentifier:function(a){var b=!1;return k(this.files,function(c){c.uniqueIdentifier===a&&(b=c)}),b},getSize:function(){var a=0;return k(this.files,function(b){a+=b.size}),a},sizeUploaded:function(){var a=0;return k(this.files,function(b){a+=b.sizeUploaded()}),a},timeRemaining:function(){var a=0,b=0;return k(this.files,function(c){c.paused||c.error||(a+=c.size-c.sizeUploaded(),b+=c.averageSpeed)}),a&&!b?Number.POSITIVE_INFINITY:a||b?Math.floor(a/b):0}},e.prototype={measureSpeed:function(){var a=Date.now()-this._lastProgressCallback;if(a){var b=this.flowObj.opts.speedSmoothingFactor,c=this.sizeUploaded();this.currentSpeed=Math.max((c-this._prevUploadedSize)/a*1e3,0),this.averageSpeed=b*this.currentSpeed+(1-b)*this.averageSpeed,this._prevUploadedSize=c}},chunkEvent:function(a,b,c){switch(b){case"progress":if(Date.now()-this._lastProgressCallback<this.flowObj.opts.progressCallbacksInterval)break;this.measureSpeed(),this.flowObj.fire("fileProgress",this,a),this.flowObj.fire("progress"),this._lastProgressCallback=Date.now();break;case"error":this.error=!0,this.abort(!0),this.flowObj.fire("fileError",this,c,a),this.flowObj.fire("error",c,this,a);break;case"success":if(this.error)return;this.measureSpeed(),this.flowObj.fire("fileProgress",this,a),this.flowObj.fire("progress"),this._lastProgressCallback=Date.now(),this.isComplete()&&(this.currentSpeed=0,this.averageSpeed=0,this.flowObj.fire("fileSuccess",this,c,a));break;case"retry":this.flowObj.fire("fileRetry",this,a)}},pause:function(){this.paused=!0,this.abort()},resume:function(){this.paused=!1,this.flowObj.upload()},abort:function(a){this.currentSpeed=0,this.averageSpeed=0;var b=this.chunks;a&&(this.chunks=[]),k(b,function(a){"uploading"===a.status()&&(a.abort(),this.flowObj.uploadNextChunk())},this)},cancel:function(){this.flowObj.removeFile(this)},retry:function(){this.bootstrap(),this.flowObj.upload()},bootstrap:function(){this.abort(!0),this.error=!1,this._prevProgress=0;for(var a=this.flowObj.opts.forceChunkSize?Math.ceil:Math.floor,b=Math.max(a(this.file.size/this.flowObj.opts.chunkSize),1),c=0;b>c;c++)this.chunks.push(new f(this.flowObj,this,c))},progress:function(){if(this.error)return 1;if(1===this.chunks.length)return this._prevProgress=Math.max(this._prevProgress,this.chunks[0].progress()),this._prevProgress;var a=0;k(this.chunks,function(b){a+=b.progress()*(b.endByte-b.startByte)});var b=a/this.size;return this._prevProgress=Math.max(this._prevProgress,b>.9999?1:b),this._prevProgress},isUploading:function(){var a=!1;return k(this.chunks,function(b){return"uploading"===b.status()?(a=!0,!1):void 0}),a},isComplete:function(){var a=!1;return k(this.chunks,function(b){var c=b.status();return"pending"===c||"uploading"===c||1===b.preprocessState?(a=!0,!1):void 0}),!a},sizeUploaded:function(){var a=0;return k(this.chunks,function(b){a+=b.sizeUploaded()}),a},timeRemaining:function(){if(this.paused||this.error)return 0;var a=this.size-this.sizeUploaded();return a&&!this.averageSpeed?Number.POSITIVE_INFINITY:a||this.averageSpeed?Math.floor(a/this.averageSpeed):0},getType:function(){return this.file.type&&this.file.type.split("/")[1]},getExtension:function(){return this.name.substr((~-this.name.lastIndexOf(".")>>>0)+2).toLowerCase()}},f.prototype={getParams:function(){return{flowChunkNumber:this.offset+1,flowChunkSize:this.flowObj.opts.chunkSize,flowCurrentChunkSize:this.endByte-this.startByte,flowTotalSize:this.fileObjSize,flowIdentifier:this.fileObj.uniqueIdentifier,flowFilename:this.fileObj.name,flowRelativePath:this.fileObj.relativePath,flowTotalChunks:this.fileObj.chunks.length}},getTarget:function(a,b){return a+=a.indexOf("?")<0?"?":"&",a+b.join("&")},test:function(){this.xhr=new XMLHttpRequest,this.xhr.addEventListener("load",this.testHandler,!1),this.xhr.addEventListener("error",this.testHandler,!1);var a=h(this.flowObj.opts.testMethod,this.fileObj,this),b=this.prepareXhrRequest(a,!0);this.xhr.send(b)},preprocessFinished:function(){this.preprocessState=2,this.send()},send:function(){var a=this.flowObj.opts.preprocess;if("function"==typeof a)switch(this.preprocessState){case 0:return this.preprocessState=1,void a(this);case 1:return}if(this.flowObj.opts.testChunks&&!this.tested)return void this.test();this.loaded=0,this.total=0,this.pendingRetry=!1;var b=this.fileObj.file.slice?"slice":this.fileObj.file.mozSlice?"mozSlice":this.fileObj.file.webkitSlice?"webkitSlice":"slice",c=this.fileObj.file[b](this.startByte,this.endByte,this.fileObj.file.type);this.xhr=new XMLHttpRequest,this.xhr.upload.addEventListener("progress",this.progressHandler,!1),this.xhr.addEventListener("load",this.doneHandler,!1),this.xhr.addEventListener("error",this.doneHandler,!1);var d=h(this.flowObj.opts.uploadMethod,this.fileObj,this),e=this.prepareXhrRequest(d,!1,this.flowObj.opts.method,c);this.xhr.send(e)},abort:function(){var a=this.xhr;this.xhr=null,a&&a.abort()},status:function(a){return this.pendingRetry||1===this.preprocessState?"uploading":this.xhr?this.xhr.readyState<4?"uploading":this.flowObj.opts.successStatuses.indexOf(this.xhr.status)>-1?"success":this.flowObj.opts.permanentErrors.indexOf(this.xhr.status)>-1||!a&&this.retries>=this.flowObj.opts.maxChunkRetries?"error":(this.abort(),"pending"):"pending"},message:function(){return this.xhr?this.xhr.responseText:""},progress:function(){if(this.pendingRetry)return 0;var a=this.status();return"success"===a||"error"===a?1:"pending"===a?0:this.total>0?this.loaded/this.total:0},sizeUploaded:function(){var a=this.endByte-this.startByte;return"success"!==this.status()&&(a=this.progress()*a),a},prepareXhrRequest:function(a,b,c,d){var e=h(this.flowObj.opts.query,this.fileObj,this,b);e=j(this.getParams(),e);var f=h(this.flowObj.opts.target,this.fileObj,this,b),g=null;if("GET"===a||"octet"===c){var i=[];k(e,function(a,b){i.push([encodeURIComponent(b),encodeURIComponent(a)].join("="))}),f=this.getTarget(f,i),g=d||null}else g=new FormData,k(e,function(a,b){g.append(b,a)}),g.append(this.flowObj.opts.fileParameterName,d,this.fileObj.file.name);return this.xhr.open(a,f,!0),this.xhr.withCredentials=this.flowObj.opts.withCredentials,k(h(this.flowObj.opts.headers,this.fileObj,this,b),function(a,b){this.xhr.setRequestHeader(b,a)},this),g}},d.evalOpts=h,d.extend=j,d.each=k,d.FlowFile=e,d.FlowChunk=f,d.version="2.9.0","object"==typeof module&&module&&"object"==typeof module.exports?module.exports=d:(a.Flow=d,"function"==typeof define&&define.amd&&define("flow",[],function(){return d}))}(window,document);
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function (Flow, FustyFlow, window) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
var fustyFlowFactory = function (opts) {
|
5 |
+
var flow = new Flow(opts);
|
6 |
+
if (flow.support) {
|
7 |
+
return flow;
|
8 |
+
}
|
9 |
+
return new FustyFlow(opts);
|
10 |
+
}
|
11 |
+
|
12 |
+
window.fustyFlowFactory = fustyFlowFactory;
|
13 |
+
|
14 |
+
})(window.Flow, window.FustyFlow, window);
|
@@ -0,0 +1,429 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function (Flow, window, document, undefined) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
var extend = Flow.extend;
|
5 |
+
var each = Flow.each;
|
6 |
+
|
7 |
+
function addEvent(element, type, handler) {
|
8 |
+
if (element.addEventListener) {
|
9 |
+
element.addEventListener(type, handler, false);
|
10 |
+
} else if (element.attachEvent) {
|
11 |
+
element.attachEvent("on" + type, handler);
|
12 |
+
} else {
|
13 |
+
element["on" + type] = handler;
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
function removeEvent(element, type, handler) {
|
18 |
+
if (element.removeEventListener) {
|
19 |
+
element.removeEventListener(type, handler, false);
|
20 |
+
} else if (element.detachEvent) {
|
21 |
+
element.detachEvent("on" + type, handler);
|
22 |
+
} else {
|
23 |
+
element["on" + type] = null;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
function removeElement(element) {
|
28 |
+
element.parentNode.removeChild(element);
|
29 |
+
}
|
30 |
+
|
31 |
+
function isFunction(functionToCheck) {
|
32 |
+
var getType = {};
|
33 |
+
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Not resumable file upload library, for IE7-IE9 browsers
|
38 |
+
* @name FustyFlow
|
39 |
+
* @param [opts]
|
40 |
+
* @param {bool} [opts.singleFile]
|
41 |
+
* @param {string} [opts.fileParameterName]
|
42 |
+
* @param {Object|Function} [opts.query]
|
43 |
+
* @param {Object} [opts.headers]
|
44 |
+
* @param {string} [opts.target]
|
45 |
+
* @param {Function} [opts.generateUniqueIdentifier]
|
46 |
+
* @param {bool} [opts.matchJSON]
|
47 |
+
* @constructor
|
48 |
+
*/
|
49 |
+
function FustyFlow(opts) {
|
50 |
+
// Shortcut of "r instanceof Flow"
|
51 |
+
this.support = false;
|
52 |
+
|
53 |
+
this.files = [];
|
54 |
+
this.events = [];
|
55 |
+
this.defaults = {
|
56 |
+
simultaneousUploads: 3,
|
57 |
+
fileParameterName: 'file',
|
58 |
+
query: {},
|
59 |
+
target: '/',
|
60 |
+
generateUniqueIdentifier: null,
|
61 |
+
matchJSON: false
|
62 |
+
};
|
63 |
+
|
64 |
+
var $ = this;
|
65 |
+
|
66 |
+
this.inputChangeEvent = function (event) {
|
67 |
+
var input = event.target || event.srcElement;
|
68 |
+
removeEvent(input, 'change', $.inputChangeEvent);
|
69 |
+
var newClone = input.cloneNode(false);
|
70 |
+
// change current input with new one
|
71 |
+
input.parentNode.replaceChild(newClone, input);
|
72 |
+
// old input will be attached to hidden form
|
73 |
+
$.addFile(input, event);
|
74 |
+
// reset new input
|
75 |
+
newClone.value = '';
|
76 |
+
addEvent(newClone, 'change', $.inputChangeEvent);
|
77 |
+
};
|
78 |
+
|
79 |
+
this.opts = Flow.extend({}, this.defaults, opts || {});
|
80 |
+
}
|
81 |
+
|
82 |
+
FustyFlow.prototype = {
|
83 |
+
on: Flow.prototype.on,
|
84 |
+
off: Flow.prototype.off,
|
85 |
+
fire: Flow.prototype.fire,
|
86 |
+
cancel: Flow.prototype.cancel,
|
87 |
+
assignBrowse: function (domNodes) {
|
88 |
+
if (typeof domNodes.length == 'undefined') {
|
89 |
+
domNodes = [domNodes];
|
90 |
+
}
|
91 |
+
each(domNodes, function (domNode) {
|
92 |
+
var input;
|
93 |
+
if (domNode.tagName === 'INPUT' && domNode.type === 'file') {
|
94 |
+
input = domNode;
|
95 |
+
} else {
|
96 |
+
input = document.createElement('input');
|
97 |
+
input.setAttribute('type', 'file');
|
98 |
+
|
99 |
+
extend(domNode.style, {
|
100 |
+
display: 'inline-block',
|
101 |
+
position: 'relative',
|
102 |
+
overflow: 'hidden',
|
103 |
+
verticalAlign: 'top'
|
104 |
+
});
|
105 |
+
|
106 |
+
extend(input.style, {
|
107 |
+
position: 'absolute',
|
108 |
+
top: 0,
|
109 |
+
right: 0,
|
110 |
+
fontFamily: 'Arial',
|
111 |
+
// 4 persons reported this, the max values that worked for them were 243, 236, 236, 118
|
112 |
+
fontSize: '118px',
|
113 |
+
margin: 0,
|
114 |
+
padding: 0,
|
115 |
+
opacity: 0,
|
116 |
+
filter: 'alpha(opacity=0)',
|
117 |
+
cursor: 'pointer'
|
118 |
+
});
|
119 |
+
|
120 |
+
domNode.appendChild(input);
|
121 |
+
}
|
122 |
+
// When new files are added, simply append them to the overall list
|
123 |
+
addEvent(input, 'change', this.inputChangeEvent);
|
124 |
+
}, this);
|
125 |
+
},
|
126 |
+
assignDrop: function () {
|
127 |
+
// not supported
|
128 |
+
},
|
129 |
+
unAssignDrop: function () {
|
130 |
+
// not supported
|
131 |
+
},
|
132 |
+
isUploading: function () {
|
133 |
+
var uploading = false;
|
134 |
+
each(this.files, function (file) {
|
135 |
+
if (file.isUploading()) {
|
136 |
+
uploading = true;
|
137 |
+
return false;
|
138 |
+
}
|
139 |
+
});
|
140 |
+
return uploading;
|
141 |
+
},
|
142 |
+
upload: function () {
|
143 |
+
// Kick off the queue
|
144 |
+
var files = 0;
|
145 |
+
each(this.files, function (file) {
|
146 |
+
if (file.progress() == 1 || file.isPaused()) {
|
147 |
+
return;
|
148 |
+
}
|
149 |
+
if (file.isUploading()) {
|
150 |
+
files++;
|
151 |
+
return;
|
152 |
+
}
|
153 |
+
if (files++ >= this.opts.simultaneousUploads) {
|
154 |
+
return false;
|
155 |
+
}
|
156 |
+
if (files == 1) {
|
157 |
+
this.fire('uploadStart');
|
158 |
+
}
|
159 |
+
file.send();
|
160 |
+
}, this);
|
161 |
+
if (!files) {
|
162 |
+
this.fire('complete');
|
163 |
+
}
|
164 |
+
},
|
165 |
+
pause: function () {
|
166 |
+
each(this.files, function (file) {
|
167 |
+
file.pause();
|
168 |
+
});
|
169 |
+
},
|
170 |
+
resume: function () {
|
171 |
+
each(this.files, function (file) {
|
172 |
+
file.resume();
|
173 |
+
});
|
174 |
+
},
|
175 |
+
progress: function () {
|
176 |
+
var totalDone = 0;
|
177 |
+
var totalFiles = 0;
|
178 |
+
each(this.files, function (file) {
|
179 |
+
totalDone += file.progress();
|
180 |
+
totalFiles++;
|
181 |
+
});
|
182 |
+
return totalFiles > 0 ? totalDone / totalFiles : 0;
|
183 |
+
},
|
184 |
+
addFiles: function (elementsList, event) {
|
185 |
+
var files = [];
|
186 |
+
each(elementsList, function (element) {
|
187 |
+
// is domElement ?
|
188 |
+
if (element.nodeType === 1 && element.value) {
|
189 |
+
var f = new FustyFlowFile(this, element);
|
190 |
+
if (this.fire('fileAdded', f, event)) {
|
191 |
+
files.push(f);
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}, this);
|
195 |
+
if (this.fire('filesAdded', files, event)) {
|
196 |
+
each(files, function (file) {
|
197 |
+
if (this.opts.singleFile && this.files.length > 0) {
|
198 |
+
this.removeFile(this.files[0]);
|
199 |
+
}
|
200 |
+
this.files.push(file);
|
201 |
+
}, this);
|
202 |
+
}
|
203 |
+
this.fire('filesSubmitted', files, event);
|
204 |
+
},
|
205 |
+
addFile: function (file, event) {
|
206 |
+
this.addFiles([file], event);
|
207 |
+
},
|
208 |
+
generateUniqueIdentifier: function (element) {
|
209 |
+
var custom = this.opts.generateUniqueIdentifier;
|
210 |
+
if (typeof custom === 'function') {
|
211 |
+
return custom(element);
|
212 |
+
}
|
213 |
+
return 'xxxxxxxx-xxxx-yxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
214 |
+
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
215 |
+
return v.toString(16);
|
216 |
+
});
|
217 |
+
},
|
218 |
+
getFromUniqueIdentifier: function (uniqueIdentifier) {
|
219 |
+
var ret = false;
|
220 |
+
each(this.files, function (f) {
|
221 |
+
if (f.uniqueIdentifier == uniqueIdentifier) ret = f;
|
222 |
+
});
|
223 |
+
return ret;
|
224 |
+
},
|
225 |
+
removeFile: function (file) {
|
226 |
+
for (var i = this.files.length - 1; i >= 0; i--) {
|
227 |
+
if (this.files[i] === file) {
|
228 |
+
this.files.splice(i, 1);
|
229 |
+
}
|
230 |
+
}
|
231 |
+
},
|
232 |
+
getSize: function () {
|
233 |
+
// undefined
|
234 |
+
},
|
235 |
+
timeRemaining: function () {
|
236 |
+
// undefined
|
237 |
+
},
|
238 |
+
sizeUploaded: function () {
|
239 |
+
// undefined
|
240 |
+
}
|
241 |
+
};
|
242 |
+
|
243 |
+
function FustyFlowFile(flowObj, element) {
|
244 |
+
this.flowObj = flowObj;
|
245 |
+
this.element = element;
|
246 |
+
this.name = element.value && element.value.replace(/.*(\/|\\)/, "");
|
247 |
+
this.relativePath = this.name;
|
248 |
+
this.uniqueIdentifier = flowObj.generateUniqueIdentifier(element);
|
249 |
+
this.iFrame = null;
|
250 |
+
|
251 |
+
this.finished = false;
|
252 |
+
this.error = false;
|
253 |
+
this.paused = false;
|
254 |
+
|
255 |
+
var $ = this;
|
256 |
+
this.iFrameLoaded = function (event) {
|
257 |
+
// when we remove iframe from dom
|
258 |
+
// the request stops, but in IE load
|
259 |
+
// event fires
|
260 |
+
if (!$.iFrame || !$.iFrame.parentNode) {
|
261 |
+
return;
|
262 |
+
}
|
263 |
+
$.finished = true;
|
264 |
+
try {
|
265 |
+
// fixing Opera 10.53
|
266 |
+
if ($.iFrame.contentDocument &&
|
267 |
+
$.iFrame.contentDocument.body &&
|
268 |
+
$.iFrame.contentDocument.body.innerHTML == "false") {
|
269 |
+
// In Opera event is fired second time
|
270 |
+
// when body.innerHTML changed from false
|
271 |
+
// to server response approx. after 1 sec
|
272 |
+
// when we upload file with iframe
|
273 |
+
return;
|
274 |
+
}
|
275 |
+
} catch (error) {
|
276 |
+
//IE may throw an "access is denied" error when attempting to access contentDocument
|
277 |
+
$.error = true;
|
278 |
+
$.abort();
|
279 |
+
$.flowObj.fire('fileError', $, error);
|
280 |
+
return;
|
281 |
+
}
|
282 |
+
// iframe.contentWindow.document - for IE<7
|
283 |
+
var doc = $.iFrame.contentDocument || $.iFrame.contentWindow.document;
|
284 |
+
var innerHtml = doc.body.innerHTML;
|
285 |
+
if ($.flowObj.opts.matchJSON) {
|
286 |
+
innerHtml = /(\{.*\})/.exec(innerHtml)[0];
|
287 |
+
}
|
288 |
+
|
289 |
+
$.abort();
|
290 |
+
$.flowObj.fire('fileSuccess', $, innerHtml);
|
291 |
+
$.flowObj.upload();
|
292 |
+
};
|
293 |
+
this.bootstrap();
|
294 |
+
}
|
295 |
+
|
296 |
+
FustyFlowFile.prototype = {
|
297 |
+
getExtension: Flow.FlowFile.prototype.getExtension,
|
298 |
+
getType: function () {
|
299 |
+
// undefined
|
300 |
+
},
|
301 |
+
send: function () {
|
302 |
+
if (this.finished) {
|
303 |
+
return;
|
304 |
+
}
|
305 |
+
var o = this.flowObj.opts;
|
306 |
+
var form = this.createForm();
|
307 |
+
var params = o.query;
|
308 |
+
if (isFunction(params)) {
|
309 |
+
params = params(this);
|
310 |
+
}
|
311 |
+
params[o.fileParameterName] = this.element;
|
312 |
+
params['flowFilename'] = this.name;
|
313 |
+
params['flowRelativePath'] = this.relativePath;
|
314 |
+
params['flowIdentifier'] = this.uniqueIdentifier;
|
315 |
+
|
316 |
+
this.addFormParams(form, params);
|
317 |
+
addEvent(this.iFrame, 'load', this.iFrameLoaded);
|
318 |
+
form.submit();
|
319 |
+
removeElement(form);
|
320 |
+
},
|
321 |
+
abort: function (noupload) {
|
322 |
+
if (this.iFrame) {
|
323 |
+
this.iFrame.setAttribute('src', 'java' + String.fromCharCode(115) + 'cript:false;');
|
324 |
+
removeElement(this.iFrame);
|
325 |
+
this.iFrame = null;
|
326 |
+
!noupload && this.flowObj.upload();
|
327 |
+
}
|
328 |
+
},
|
329 |
+
cancel: function () {
|
330 |
+
this.flowObj.removeFile(this);
|
331 |
+
this.abort();
|
332 |
+
},
|
333 |
+
retry: function () {
|
334 |
+
this.bootstrap();
|
335 |
+
this.flowObj.upload();
|
336 |
+
},
|
337 |
+
bootstrap: function () {
|
338 |
+
this.abort(true);
|
339 |
+
this.finished = false;
|
340 |
+
this.error = false;
|
341 |
+
},
|
342 |
+
timeRemaining: function () {
|
343 |
+
// undefined
|
344 |
+
},
|
345 |
+
sizeUploaded: function () {
|
346 |
+
// undefined
|
347 |
+
},
|
348 |
+
resume: function () {
|
349 |
+
this.paused = false;
|
350 |
+
this.flowObj.upload();
|
351 |
+
},
|
352 |
+
pause: function () {
|
353 |
+
this.paused = true;
|
354 |
+
this.abort();
|
355 |
+
},
|
356 |
+
isUploading: function () {
|
357 |
+
return this.iFrame !== null;
|
358 |
+
},
|
359 |
+
isPaused: function () {
|
360 |
+
return this.paused;
|
361 |
+
},
|
362 |
+
isComplete: function () {
|
363 |
+
return this.progress() === 1;
|
364 |
+
},
|
365 |
+
progress: function () {
|
366 |
+
if (this.error) {
|
367 |
+
return 1;
|
368 |
+
}
|
369 |
+
return this.finished ? 1 : 0;
|
370 |
+
},
|
371 |
+
|
372 |
+
createIframe: function () {
|
373 |
+
var iFrame = (/MSIE (6|7|8)/).test(navigator.userAgent) ?
|
374 |
+
document.createElement('<iframe name="' + this.uniqueIdentifier + '_iframe' + '">') :
|
375 |
+
document.createElement('iframe');
|
376 |
+
|
377 |
+
iFrame.setAttribute('id', this.uniqueIdentifier + '_iframe_id');
|
378 |
+
iFrame.setAttribute('name', this.uniqueIdentifier + '_iframe');
|
379 |
+
iFrame.style.display = 'none';
|
380 |
+
document.body.appendChild(iFrame);
|
381 |
+
return iFrame;
|
382 |
+
},
|
383 |
+
createForm: function() {
|
384 |
+
var target = this.flowObj.opts.target;
|
385 |
+
if (typeof target === "function") {
|
386 |
+
target = target.apply(null);
|
387 |
+
}
|
388 |
+
|
389 |
+
var form = document.createElement('form');
|
390 |
+
form.encoding = "multipart/form-data";
|
391 |
+
form.method = "POST";
|
392 |
+
form.setAttribute('action', target);
|
393 |
+
if (!this.iFrame) {
|
394 |
+
this.iFrame = this.createIframe();
|
395 |
+
}
|
396 |
+
form.setAttribute('target', this.iFrame.name);
|
397 |
+
form.style.display = 'none';
|
398 |
+
document.body.appendChild(form);
|
399 |
+
return form;
|
400 |
+
},
|
401 |
+
addFormParams: function(form, params) {
|
402 |
+
var input;
|
403 |
+
each(params, function (value, key) {
|
404 |
+
if (value && value.nodeType === 1) {
|
405 |
+
input = value;
|
406 |
+
} else {
|
407 |
+
input = document.createElement('input');
|
408 |
+
input.setAttribute('value', value);
|
409 |
+
}
|
410 |
+
input.setAttribute('name', key);
|
411 |
+
form.appendChild(input);
|
412 |
+
});
|
413 |
+
}
|
414 |
+
};
|
415 |
+
|
416 |
+
FustyFlow.FustyFlowFile = FustyFlowFile;
|
417 |
+
|
418 |
+
if (typeof module !== 'undefined') {
|
419 |
+
module.exports = FustyFlow;
|
420 |
+
} else if (typeof define === "function" && define.amd) {
|
421 |
+
// AMD/requirejs: Define the module
|
422 |
+
define(function(){
|
423 |
+
return FustyFlow;
|
424 |
+
});
|
425 |
+
} else {
|
426 |
+
window.FustyFlow = FustyFlow;
|
427 |
+
}
|
428 |
+
})(window.Flow, window, document);
|
429 |
+
|
@@ -0,0 +1,509 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Magento
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
7 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/afl-3.0.php
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@magento.com so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
+
* versions in the future. If you wish to customize Magento for your
|
18 |
+
* needs please refer to http://www.magento.com for more information.
|
19 |
+
*
|
20 |
+
* @category Mage
|
21 |
+
* @package Mage_Adminhtml
|
22 |
+
* @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
*/
|
25 |
+
|
26 |
+
(function(flowFactory, window, document) {
|
27 |
+
'use strict';
|
28 |
+
window.Uploader = Class.create({
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @type {Boolean} Are we in debug mode?
|
32 |
+
*/
|
33 |
+
debug: false,
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @constant
|
37 |
+
* @type {String} templatePattern
|
38 |
+
*/
|
39 |
+
templatePattern: /(^|.|\r|\n)({{(\w+)}})/,
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @type {JSON} Array of elements ids to instantiate DOM collection
|
43 |
+
*/
|
44 |
+
elementsIds: [],
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @type {Array.<HTMLElement>} List of elements ids across all uploader functionality
|
48 |
+
*/
|
49 |
+
elements: [],
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @type {(FustyFlow|Flow)} Uploader object instance
|
53 |
+
*/
|
54 |
+
uploader: {},
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @type {JSON} General Uploader config
|
58 |
+
*/
|
59 |
+
uploaderConfig: {},
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @type {JSON} browseConfig General Uploader config
|
63 |
+
*/
|
64 |
+
browseConfig: {},
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @type {JSON} Misc settings to manipulate Uploader
|
68 |
+
*/
|
69 |
+
miscConfig: {},
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @type {Array.<String>} Sizes in plural
|
73 |
+
*/
|
74 |
+
sizesPlural: ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
|
75 |
+
|
76 |
+
/**
|
77 |
+
* @type {Number} Precision of calculation during convetion to human readable size format
|
78 |
+
*/
|
79 |
+
sizePrecisionDefault: 3,
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @type {Number} Unit type conversion kib or kb, etc
|
83 |
+
*/
|
84 |
+
sizeUnitType: 1024,
|
85 |
+
|
86 |
+
/**
|
87 |
+
* @type {String} Default delete button selector
|
88 |
+
*/
|
89 |
+
deleteButtonSelector: '.delete',
|
90 |
+
|
91 |
+
/**
|
92 |
+
* @type {Number} Timeout of completion handler
|
93 |
+
*/
|
94 |
+
onCompleteTimeout: 1000,
|
95 |
+
|
96 |
+
/**
|
97 |
+
* @type {(null|Array.<FlowFile>)} Files array stored for success event
|
98 |
+
*/
|
99 |
+
files: null,
|
100 |
+
|
101 |
+
|
102 |
+
/**
|
103 |
+
* @name Uploader
|
104 |
+
*
|
105 |
+
* @param {JSON} config
|
106 |
+
*
|
107 |
+
* @constructor
|
108 |
+
*/
|
109 |
+
initialize: function(config) {
|
110 |
+
this.elementsIds = config.elementIds;
|
111 |
+
this.elements = this.getElements(this.elementsIds);
|
112 |
+
|
113 |
+
this.uploaderConfig = config.uploaderConfig;
|
114 |
+
this.browseConfig = config.browseConfig;
|
115 |
+
this.miscConfig = config.miscConfig;
|
116 |
+
|
117 |
+
this.uploader = flowFactory(this.uploaderConfig);
|
118 |
+
|
119 |
+
this.attachEvents();
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Bridging functions to retain functionality of existing modules
|
123 |
+
*/
|
124 |
+
this.formatSize = this._getPluralSize.bind(this);
|
125 |
+
this.upload = this.onUploadClick.bind(this);
|
126 |
+
this.onContainerHideBefore = this.onTabChange.bind(this);
|
127 |
+
},
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Array of strings containing elements ids
|
131 |
+
*
|
132 |
+
* @param {JSON.<string, Array.<string>>} ids as JSON map,
|
133 |
+
* {<type> => ['id1', 'id2'...], <type2>...}
|
134 |
+
* @returns {Array.<HTMLElement>} An array of DOM elements
|
135 |
+
*/
|
136 |
+
getElements: function (ids) {
|
137 |
+
/** @type {Hash} idsHash */
|
138 |
+
var idsHash = $H(ids);
|
139 |
+
|
140 |
+
idsHash.each(function (id) {
|
141 |
+
var result = this.getElementsByIds(id.value);
|
142 |
+
|
143 |
+
idsHash.set(id.key, result);
|
144 |
+
}.bind(this));
|
145 |
+
|
146 |
+
return idsHash.toObject();
|
147 |
+
},
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Get HTMLElement from hash values
|
151 |
+
*
|
152 |
+
* @param {(Array|String)}ids
|
153 |
+
* @returns {(Array.<HTMLElement>|HTMLElement)}
|
154 |
+
*/
|
155 |
+
getElementsByIds: function (ids) {
|
156 |
+
var result = [];
|
157 |
+
if(ids && Object.isArray(ids)) {
|
158 |
+
ids.each(function(fromId) {
|
159 |
+
var DOMElement = $(fromId);
|
160 |
+
|
161 |
+
if (DOMElement) {
|
162 |
+
// Add it only if it's valid HTMLElement, otherwise skip.
|
163 |
+
result.push(DOMElement);
|
164 |
+
}
|
165 |
+
});
|
166 |
+
} else {
|
167 |
+
result = $(ids);
|
168 |
+
}
|
169 |
+
|
170 |
+
return result;
|
171 |
+
},
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Attach all types of events
|
175 |
+
*/
|
176 |
+
attachEvents: function() {
|
177 |
+
this.assignBrowse();
|
178 |
+
|
179 |
+
this.uploader.on('filesSubmitted', this.onFilesSubmitted.bind(this));
|
180 |
+
|
181 |
+
this.uploader.on('uploadStart', this.onUploadStart.bind(this));
|
182 |
+
|
183 |
+
this.uploader.on('fileSuccess', this.onFileSuccess.bind(this));
|
184 |
+
this.uploader.on('complete', this.onSuccess.bind(this));
|
185 |
+
|
186 |
+
if(this.elements.container && !this.elements.delete) {
|
187 |
+
this.elements.container.on('click', this.deleteButtonSelector, this.onDeleteClick.bind(this));
|
188 |
+
} else {
|
189 |
+
if(this.elements.delete) {
|
190 |
+
this.elements.delete.on('click', Event.fire.bind(this, document, 'upload:simulateDelete', {
|
191 |
+
containerId: this.elementsIds.container
|
192 |
+
}));
|
193 |
+
}
|
194 |
+
}
|
195 |
+
if(this.elements.upload) {
|
196 |
+
this.elements.upload.invoke('on', 'click', this.onUploadClick.bind(this));
|
197 |
+
}
|
198 |
+
if(this.debug) {
|
199 |
+
this.uploader.on('catchAll', this.onCatchAll.bind(this));
|
200 |
+
}
|
201 |
+
},
|
202 |
+
|
203 |
+
onTabChange: function (successFunc) {
|
204 |
+
if(this.uploader.files.length && !Object.isArray(this.files)) {
|
205 |
+
if(confirm(
|
206 |
+
this._translate('There are files that were selected but not uploaded yet. After switching to another tab your selections will be lost. Do you wish to continue ?')
|
207 |
+
)
|
208 |
+
) {
|
209 |
+
if(Object.isFunction(successFunc)) {
|
210 |
+
successFunc();
|
211 |
+
} else {
|
212 |
+
this._handleDelete(this.uploader.files);
|
213 |
+
document.fire('uploader:fileError', {
|
214 |
+
containerId: this.elementsIds.container
|
215 |
+
});
|
216 |
+
}
|
217 |
+
} else {
|
218 |
+
return 'cannotchange';
|
219 |
+
}
|
220 |
+
}
|
221 |
+
},
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Assign browse buttons to appropriate targets
|
225 |
+
*/
|
226 |
+
assignBrowse: function() {
|
227 |
+
if (this.elements.browse && this.elements.browse.length) {
|
228 |
+
this.uploader.assignBrowse(
|
229 |
+
this.elements.browse,
|
230 |
+
this.browseConfig.isDirectory || false,
|
231 |
+
this.browseConfig.singleFile || false,
|
232 |
+
this.browseConfig.attributes || {}
|
233 |
+
);
|
234 |
+
}
|
235 |
+
},
|
236 |
+
|
237 |
+
/**
|
238 |
+
* @event
|
239 |
+
* @param {Array.<FlowFile>} files
|
240 |
+
*/
|
241 |
+
onFilesSubmitted: function (files) {
|
242 |
+
files.filter(function (file) {
|
243 |
+
if(this._checkFileSize(file)) {
|
244 |
+
alert(
|
245 |
+
this._translate('Maximum allowed file size for upload is') +
|
246 |
+
" " + this.miscConfig.maxSizePlural + "\n" +
|
247 |
+
this._translate('Please check your server PHP settings.')
|
248 |
+
);
|
249 |
+
file.cancel();
|
250 |
+
return false;
|
251 |
+
}
|
252 |
+
return true;
|
253 |
+
}.bind(this)).each(function (file) {
|
254 |
+
this._handleUpdateFile(file);
|
255 |
+
}.bind(this));
|
256 |
+
},
|
257 |
+
|
258 |
+
_handleUpdateFile: function (file) {
|
259 |
+
var replaceBrowseWithRemove = this.miscConfig.replaceBrowseWithRemove;
|
260 |
+
if(replaceBrowseWithRemove) {
|
261 |
+
document.fire('uploader:simulateNewUpload', { containerId: this.elementsIds.container });
|
262 |
+
}
|
263 |
+
this.elements.container
|
264 |
+
[replaceBrowseWithRemove ? 'update':'insert'](this._renderFromTemplate(
|
265 |
+
this.elements.templateFile,
|
266 |
+
{
|
267 |
+
name: file.name,
|
268 |
+
size: file.size ? '(' + this._getPluralSize(file.size) + ')' : '',
|
269 |
+
id: file.uniqueIdentifier
|
270 |
+
}
|
271 |
+
)
|
272 |
+
);
|
273 |
+
},
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Upload button is being pressed
|
277 |
+
*
|
278 |
+
* @event
|
279 |
+
*/
|
280 |
+
onUploadStart: function () {
|
281 |
+
document.fire('uploader:start', { files: this.files });
|
282 |
+
var files = this.uploader.files;
|
283 |
+
|
284 |
+
files.each(function (file) {
|
285 |
+
var id = file.uniqueIdentifier;
|
286 |
+
|
287 |
+
this._getFileContainerById(id)
|
288 |
+
.removeClassName('new')
|
289 |
+
.removeClassName('error')
|
290 |
+
.addClassName('progress');
|
291 |
+
this._getProgressTextById(id).update(this._translate('Uploading …'));
|
292 |
+
|
293 |
+
var deleteButton = this._getDeleteButtonById(id);
|
294 |
+
if(deleteButton) {
|
295 |
+
this._getDeleteButtonById(id).hide();
|
296 |
+
}
|
297 |
+
}.bind(this));
|
298 |
+
|
299 |
+
this.files = this.uploader.files;
|
300 |
+
},
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Get file-line container by id
|
304 |
+
*
|
305 |
+
* @param {String} id
|
306 |
+
* @returns {HTMLElement}
|
307 |
+
* @private
|
308 |
+
*/
|
309 |
+
_getFileContainerById: function (id) {
|
310 |
+
return $(id + '-container');
|
311 |
+
},
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Get text update container
|
315 |
+
*
|
316 |
+
* @param id
|
317 |
+
* @returns {*}
|
318 |
+
* @private
|
319 |
+
*/
|
320 |
+
_getProgressTextById: function (id) {
|
321 |
+
return this._getFileContainerById(id).down('.progress-text');
|
322 |
+
},
|
323 |
+
|
324 |
+
_getDeleteButtonById: function(id) {
|
325 |
+
return this._getFileContainerById(id).down('.delete');
|
326 |
+
},
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Handle delete button click
|
330 |
+
*
|
331 |
+
* @event
|
332 |
+
* @param {Event} e
|
333 |
+
*/
|
334 |
+
onDeleteClick: function (e) {
|
335 |
+
var element = Event.findElement(e);
|
336 |
+
var id = element.id;
|
337 |
+
if(!id) {
|
338 |
+
id = element.up(this.deleteButtonSelector).id;
|
339 |
+
}
|
340 |
+
this._handleDelete([this.uploader.getFromUniqueIdentifier(id)]);
|
341 |
+
},
|
342 |
+
|
343 |
+
/**
|
344 |
+
* Complete handler of uploading process
|
345 |
+
*
|
346 |
+
* @event
|
347 |
+
*/
|
348 |
+
onSuccess: function () {
|
349 |
+
document.fire('uploader:success', { files: this.files });
|
350 |
+
this.files = null;
|
351 |
+
},
|
352 |
+
|
353 |
+
/**
|
354 |
+
* Successfully uploaded file, notify about that other components, handle deletion from queue
|
355 |
+
*
|
356 |
+
* @param {FlowFile} file
|
357 |
+
* @param {JSON} response
|
358 |
+
*/
|
359 |
+
onFileSuccess: function (file, response) {
|
360 |
+
response = response.evalJSON();
|
361 |
+
var id = file.uniqueIdentifier;
|
362 |
+
var error = response.error;
|
363 |
+
this._getFileContainerById(id)
|
364 |
+
.removeClassName('progress')
|
365 |
+
.addClassName(error ? 'error': 'complete')
|
366 |
+
;
|
367 |
+
this._getProgressTextById(id).update(this._translate(
|
368 |
+
error ? this._XSSFilter(error) :'Complete'
|
369 |
+
));
|
370 |
+
|
371 |
+
setTimeout(function() {
|
372 |
+
if(!error) {
|
373 |
+
document.fire('uploader:fileSuccess', {
|
374 |
+
response: Object.toJSON(response),
|
375 |
+
containerId: this.elementsIds.container
|
376 |
+
});
|
377 |
+
} else {
|
378 |
+
document.fire('uploader:fileError', {
|
379 |
+
containerId: this.elementsIds.container
|
380 |
+
});
|
381 |
+
}
|
382 |
+
this._handleDelete([file]);
|
383 |
+
}.bind(this) , !error ? this.onCompleteTimeout: this.onCompleteTimeout * 3);
|
384 |
+
},
|
385 |
+
|
386 |
+
/**
|
387 |
+
* Upload button click event
|
388 |
+
*
|
389 |
+
* @event
|
390 |
+
*/
|
391 |
+
onUploadClick: function () {
|
392 |
+
try {
|
393 |
+
this.uploader.upload();
|
394 |
+
} catch(e) {
|
395 |
+
if(console) {
|
396 |
+
console.error(e);
|
397 |
+
}
|
398 |
+
}
|
399 |
+
},
|
400 |
+
|
401 |
+
/**
|
402 |
+
* Event for debugging purposes
|
403 |
+
*
|
404 |
+
* @event
|
405 |
+
*/
|
406 |
+
onCatchAll: function () {
|
407 |
+
if(console.group && console.groupEnd && console.trace) {
|
408 |
+
var args = [].splice.call(arguments, 1);
|
409 |
+
console.group();
|
410 |
+
console.info(arguments[0]);
|
411 |
+
console.log("Uploader Instance:", this);
|
412 |
+
console.log("Event Arguments:", args);
|
413 |
+
console.trace();
|
414 |
+
console.groupEnd();
|
415 |
+
} else {
|
416 |
+
console.log(this, arguments);
|
417 |
+
}
|
418 |
+
},
|
419 |
+
|
420 |
+
/**
|
421 |
+
* Handle deletition of files
|
422 |
+
* @param {Array.<FlowFile>} files
|
423 |
+
* @private
|
424 |
+
*/
|
425 |
+
_handleDelete: function (files) {
|
426 |
+
files.each(function (file) {
|
427 |
+
file.cancel();
|
428 |
+
var container = $(file.uniqueIdentifier + '-container');
|
429 |
+
if(container) {
|
430 |
+
container.remove();
|
431 |
+
}
|
432 |
+
}.bind(this));
|
433 |
+
},
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Check whenever file size exceeded permitted amount
|
437 |
+
*
|
438 |
+
* @param {FlowFile} file
|
439 |
+
* @returns {boolean}
|
440 |
+
* @private
|
441 |
+
*/
|
442 |
+
_checkFileSize: function (file) {
|
443 |
+
return file.size > this.miscConfig.maxSizeInBytes;
|
444 |
+
},
|
445 |
+
|
446 |
+
/**
|
447 |
+
* Make a translation of string
|
448 |
+
*
|
449 |
+
* @param {String} text
|
450 |
+
* @returns {String}
|
451 |
+
* @private
|
452 |
+
*/
|
453 |
+
_translate: function (text) {
|
454 |
+
try {
|
455 |
+
return Translator.translate(text);
|
456 |
+
}
|
457 |
+
catch(e){
|
458 |
+
return text;
|
459 |
+
}
|
460 |
+
},
|
461 |
+
|
462 |
+
/**
|
463 |
+
* Render from given template and given variables to assign
|
464 |
+
*
|
465 |
+
* @param {HTMLElement} template
|
466 |
+
* @param {JSON} vars
|
467 |
+
* @returns {String}
|
468 |
+
* @private
|
469 |
+
*/
|
470 |
+
_renderFromTemplate: function (template, vars) {
|
471 |
+
var t = new Template(this._XSSFilter(template.innerHTML), this.templatePattern);
|
472 |
+
return t.evaluate(vars);
|
473 |
+
},
|
474 |
+
|
475 |
+
/**
|
476 |
+
* Format size with precision
|
477 |
+
*
|
478 |
+
* @param {Number} sizeInBytes
|
479 |
+
* @param {Number} [precision]
|
480 |
+
* @returns {String}
|
481 |
+
* @private
|
482 |
+
*/
|
483 |
+
_getPluralSize: function (sizeInBytes, precision) {
|
484 |
+
if(sizeInBytes == 0) {
|
485 |
+
return 0 + this.sizesPlural[0];
|
486 |
+
}
|
487 |
+
var dm = (precision || this.sizePrecisionDefault) + 1;
|
488 |
+
var i = Math.floor(Math.log(sizeInBytes) / Math.log(this.sizeUnitType));
|
489 |
+
|
490 |
+
return (sizeInBytes / Math.pow(this.sizeUnitType, i)).toPrecision(dm) + ' ' + this.sizesPlural[i];
|
491 |
+
},
|
492 |
+
|
493 |
+
/**
|
494 |
+
* Purify template string to prevent XSS attacks
|
495 |
+
*
|
496 |
+
* @param {String} str
|
497 |
+
* @returns {String}
|
498 |
+
* @private
|
499 |
+
*/
|
500 |
+
_XSSFilter: function (str) {
|
501 |
+
return str
|
502 |
+
.stripScripts()
|
503 |
+
// Remove inline event handlers like onclick, onload, etc
|
504 |
+
.replace(/(on[a-z]+=["][^"]+["])(?=[^>]*>)/img, '')
|
505 |
+
.replace(/(on[a-z]+=['][^']+['])(?=[^>]*>)/img, '')
|
506 |
+
;
|
507 |
+
}
|
508 |
+
});
|
509 |
+
})(fustyFlowFactory, window, document);
|
@@ -1,9 +1,9 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>eurotext_translationMANAGER</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Start your translation projects with native translation professionals.</summary>
|
@@ -12,87 +12,136 @@
|
|
12 |
Our translations are created where our customers have their marketplace. We absolutely emphasize that our over 4,000 professional translators create translations only into the language they grew up with. That is how we will always be able to guarantee that the translations are not only correct and authentic, but that they also take into account regional and cultural peculiarities.
|
13 |

|
14 |
A good translation must be more than just linguistically correct; it must comply with technical guidelines to ensure an optimized workflow across all instances of the quality assurance process, the elimination of errors, and keeping costs low. That is why we offer periodic workshops for our professional translators to support them in their daily work.</description>
|
15 |
-
<notes
|
16 |
-
|
17 |
-
|
18 |
-

|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-

|
23 |
-
|
24 |
-
|
25 |
-
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
-
|
31 |
-

|
32 |
-
Version
|
33 |
-
|
34 |
-
-
|
35 |
-
-
|
36 |
-

|
37 |
-
|
38 |
-
|
39 |
-
-
|
40 |
-
-
|
41 |
-
-
|
42 |
-
-
|
43 |
-

|
44 |
-
|
45 |
-
|
46 |
-
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-

|
52 |
-
|
53 |
-
|
54 |
-
-
|
55 |
-
-
|
56 |
-

|
57 |
-
|
58 |
-
|
59 |
-
-
|
60 |
-
|
61 |
-

|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
-
|
67 |
-

|
68 |
-
Version 1.
|
69 |
-
|
70 |
-
-
|
71 |
-
|
72 |
-

|
73 |
-
|
74 |
-
|
75 |
-
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
-
|
80 |
-
|
81 |
-

|
82 |
-
|
83 |
-
|
84 |
-
-
|
85 |
-
|
86 |
-

|
87 |
-
|
88 |
-
|
89 |
-
-
|
90 |
-
|
91 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
<authors><author><name>Eurotext AG</name><user>eurotext</user><email>info@eurotext.de</email></author></authors>
|
93 |
-
<date>
|
94 |
-
<time>
|
95 |
-
<contents><target name="magecommunity"><dir name="Eurotext"><dir name="TranslationManager"><dir name="Block"><file name="Help.php" hash="ca61b416958f9a5304a94a9ce69df7da"/><file name="Projects.php" hash="ce7c629995f4c977d5bed0c91659961c"/><file name="Register.php" hash="1fb433fe50938c92b848ddbb8b6568e9"/><dir name="Response"><file name="Ajax.php" hash="54b099def382c680ca5e06be65aaa8e7"/></dir><file name="Selectcategories.php" hash="26572a232119318b324c6173e09c248d"/><file name="Selectcmspages.php" hash="0b91f0c03677b44b4c9b8c8243c18fd2"/><file name="Selectemails.php" hash="45f64f329f2b0f158a2d8e33a1ad8310"/><file name="Selectlangfiles.php" hash="2fdaca1539e88fbc4f44116a9453abc2"/><file name="Selectproducts.php" hash="d3d74ab6393d6521cc0b46523f8e882b"/><file name="Settings.php" hash="4e5bc502fd871664ca56f2a6851f01a7"/></dir><dir name="Helper"><file name="Data.php" hash="48331ebc701a0e6cbf00b6da56660717"/><file name="Eurotext.php" hash="8b6b610dbd3f63257ce44bceeb0743e1"/></dir><dir name="Model"><dir name="Resource"><file name="Setup.php" hash="992b5dbedd9dc6d669ff7a7949c790ab"/></dir><file name=".DS_Store" hash="7c3522d12f27b1bc414fac586a4b971f"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Eurotext"><dir name="Translationmanager"><file name="HelpController.php" hash="2073b9b65b11df0e31157128af9d47c0"/><file name="ProjectsController.php" hash="dd9148ba09b929295a810e69e2948636"/><file name="RegisterController.php" hash="6d610017c92deba24e65223fb5fd9c54"/><file name="SelectcategoriesController.php" hash="79a4c379f47f9d353e850d5afaa321f2"/><file name="SelectcmspagesController.php" hash="c65ee51e92b29c0322c0924fa6ca9dac"/><file name="SelectemailsController.php" hash="e8b2bdd15cdae614012bc05abdd81d63"/><file name="SelectlangfilesController.php" hash="5df24ee920c75cf4a530611481826b50"/><file name="SelectproductsController.php" hash="c75d91b8706f25e9e4bb47f3843f5e3d"/><file name="SettingsController.php" hash="9f3916cfa1e9ffe8ba82955c9f48c58a"/></dir><file name=".DS_Store" hash="be9480710cd7aa8bcc8ca162bbe60791"/></dir><file name=".DS_Store" hash="af0a7d68dfc1505f5fd04c55baff3727"/></dir><file name=".DS_Store" hash="9d6e9b7cea3d170ee9c8cfccccc4ee80"/></dir><dir name="etc"><file name="adminhtml.xml" hash="a7235397925e4a68962ceaf8bd498c8c"/><file name="config.xml" hash="d78d111c2b25a56153bc9e2bb3b6da97"/><file name="jstranslator.xml" hash="5a9f0af14a162abf86bc2f2afad5f841"/><file name="system.xml" hash="6fc0f8c314886f0cb3671db6efdaa7f6"/></dir><dir name="sql"><dir name="eurotext_translationmanager_setup"><file name="mysql4-install-1.0.0.0.php" hash="e18c0008fdf86231a2b9fc5fdaf772f6"/><file name="mysql4-upgrade-1.0.0.5-1.0.0.6.php" hash="ea4e8bfeb96b41454a6270fc679a97fc"/><file name="mysql4-upgrade-1.0.0.7-1.0.0.8.php" hash="b610342ad985cd23f823cb05048c172d"/></dir></dir><file name=".DS_Store" hash="a747456783fab7a1190bb4bb3c45424a"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="layout"><dir name="eurotext"><file name="translationmanager.xml" hash="3a44d296d48ae2b34424ec2a61b7434f"/></dir></dir><dir name="template"><dir name="eurotext"><dir name="translationmanager"><file name="help.phtml" hash="a3b027449fb83c4c6fbc563d8ed23e93"/><file name="projects.phtml" hash="a42131faebe288458943a8efc7b00665"/><file name="register.phtml" hash="a3f8f80005c2d2991571f2dab9634cf5"/><file name="selectcategories.phtml" hash="885c57925f375c8b6b32ec986bb58de2"/><file name="selectcmspages.phtml" hash="616ae977dd80b588084b061862f05095"/><file name="selectemails.phtml" hash="a5c31d90157f73ff702f92af35b323df"/><file name="selectlangfiles.phtml" hash="a121b4a5c0a40474260a9c94947100c0"/><file name="selectproducts.phtml" hash="4c54a9d4ea954711812896279337dd6c"/><file name="settings.phtml" hash="845d24724446ec369b95c605fa1e5189"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Eurotext_TranslationManager.csv" hash="8b76eae9c7f6318779e19ce2050365cb"/></dir><dir name="de_DE"><file name="Eurotext_TranslationManager.csv" hash="bdcdf13c3490d89fa92779fbc42465da"/></dir></target><target name="mageetc"><dir name="modules"><file name="Eurotext_TranslationManager.xml" hash="c07fa4fd43f46687c594e3ecd76b72c9"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="eurotext"><dir name="translationmanager"><dir name="css"><file name="styles.css" hash="ca6ddd95cc42d1a802aaa1fa85d401a5"/></dir><dir name="images"><file name="btt_suche.png" hash="9b74d62b9840cafb6990352c52a39458"/><file name="cat-minus.png" hash="d092af81ca37c821e13f27cc9bc44378"/><file name="cat-none.png" hash="88805f6b1ed90aa66db3cc6f89c83db0"/><file name="cat-plus.png" hash="16d73e360bebbeb16c4115ceea771b56"/><file name="eurotext_logo.png" hash="87120ee2d376e3195e2e7cd8b9661ba7"/><file name="eurotext_table_head.png" hash="36583e9470155c585304e305133e13ec"/><file name="logo_dixeno.png" hash="dd23f387d0eee8a9494724a470d8742e"/><file name="logo_eurotext.png" hash="7a8627f728f203823fbee1575d223131"/><file name="pager_arrow_left.gif" hash="6e44f608dac8eb8be1d1ebee5a3285aa"/><file name="pager_arrow_left_off.gif" hash="30f5e56195ab3546b36f4016db5254be"/><file name="pager_arrow_right.gif" hash="cc79526156b7e0c8abce61fad3d53f77"/><file name="pager_arrow_right_off.gif" hash="f01b7dad9acf0180b5c62edbd7ea9939"/></dir><dir name="js"><file name="eurotext-jquery-1.9.1.js" hash="345bf9214f44da83c245ef933035937d"/><file name="eurotext.js" hash="7fa29d5a26baa83adccbe1c082e362a6"/></dir></dir></dir></dir></dir></dir></target></contents>
|
96 |
<compatible/>
|
97 |
-
<dependencies><required><php><min>5.
|
98 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>eurotext_translationMANAGER</name>
|
4 |
+
<version>3.2.13</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="https://eurotext-ecommerce.com/agb/">Nutzungsbedingungen für Softwareanwendungen der Eurotext AG</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Start your translation projects with native translation professionals.</summary>
|
12 |
Our translations are created where our customers have their marketplace. We absolutely emphasize that our over 4,000 professional translators create translations only into the language they grew up with. That is how we will always be able to guarantee that the translations are not only correct and authentic, but that they also take into account regional and cultural peculiarities.
|
13 |

|
14 |
A good translation must be more than just linguistically correct; it must comply with technical guidelines to ensure an optimized workflow across all instances of the quality assurance process, the elimination of errors, and keeping costs low. That is why we offer periodic workshops for our professional translators to support them in their daily work.</description>
|
15 |
+
<notes># Installation
|
16 |
+
We STRONGLY recommend installing and testing the plugin in a test environment before going live. Please back up your database before installing.
|
17 |
+
Further information can be found at http://eurotext.screenstepslive.com/s/translationmanager
|
18 |
+

|
19 |
+
# Update
|
20 |
+
Only install once all ongoing projects have been completed / successfully imported. 
|
21 |
+
We STRONGLY recommend installing and testing the update in a test environment before going live. Please back up your database before installing.
|
22 |
+
Further information can be found at http://eurotext.screenstepslive.com/s/translationmanager
|
23 |
+

|
24 |
+
# General terms & conditions for Eurotext AG software applications
|
25 |
+
http://eurotext.de/en/contact/terms-and-conditions/
|
26 |
+

|
27 |
+
---------------------------
|
28 |
+
## Version 3.2.13 - 2017-02-09
|
29 |
+
### IMPROVED
|
30 |
+
- Updated translation
|
31 |
+

|
32 |
+
## Version 3.2.12 - 2017-01-17
|
33 |
+
### NEW
|
34 |
+
- Complete refactoring of the source code
|
35 |
+
- Completely revamped user interface
|
36 |
+
- Magento Grid introduced to the selection dialogs
|
37 |
+
- New category tree navigation for product selection
|
38 |
+
- You can now view the selections even after exporting
|
39 |
+
- Select multiple products in a text field by comma-separated SKU lists
|
40 |
+
- New: email templates from the database can now be translated as well
|
41 |
+
- Enhanced compatibility with third-party plugins and processes
|
42 |
+
- Improved performance and stability when exporting and importing
|
43 |
+
- The debug mode has been revised and updated with options to retain export packages on the server when they cannot be sent to Eurotext
|
44 |
+
- Improved checks and enhanced compatibility when creating zip files
|
45 |
+
- New: If an export fails, the untransferred ZIP file is copied to var/export/
|
46 |
+
- Enhanced checks of various system components (rights, directories, modules) to guarantee the stability of the plugin.
|
47 |
+
- Improved behavior when importing translations into source-language content that has already been deleted, including lists of non-imported content in import dialog and logging.
|
48 |
+
- Completely revised documentation (http://eurotext.screenstepslive.com/s/translationmanager/m/translationmanager-magento19)
|
49 |
+

|
50 |
+
### FIXED
|
51 |
+
- Image labels were not being exported
|
52 |
+
- Fixed a rights administration bug which occurred after updating to Magento 1.14 EE/1.9 CE
|
53 |
+
- Language files were being exported from the wrong source language
|
54 |
+
- The language file of custom themes (translate.csv) was not being exported
|
55 |
+
- General improvements to the export format
|
56 |
+
- General improvements to user registration
|
57 |
+
- General improvements to ZIP file creation
|
58 |
+
- Improved security for database write access
|
59 |
+
- Improved logging in standard mode and debug mode
|
60 |
+

|
61 |
+
### REMOVED
|
62 |
+
- Removed the feature to automatically export untranslated content
|
63 |
+

|
64 |
+
## Version 1.1.2.2
|
65 |
+
### NEW
|
66 |
+
- Translate your custom category attributes: export your custom attributes
|
67 |
+

|
68 |
+
## Version 1.1.2.1
|
69 |
+
### FIXED
|
70 |
+
- Duplicate URL key error during import fixed
|
71 |
+

|
72 |
+
## Version 1.1.2.0
|
73 |
+
### NEW
|
74 |
+
- Revamped DEBUG mode. Can now be activated in the back end (System -> Configuration -> Developer -> Log)
|
75 |
+
- Log file created in /var/log/eurotext.log, critical errors saved in eurotext_fatal.log even when DEBUG mode is deactivated
|
76 |
+
- Base directory changed from /eurotext to /var/eurotext
|
77 |
+
- Added logging for FTP check in DEBUG mode
|
78 |
+
### FIXED
|
79 |
+
- Various improvements to the usability of Magento directories
|
80 |
+

|
81 |
+
## Version 1.1.1.0
|
82 |
+
### FIXED
|
83 |
+
- Now only the selected language files will be exported
|
84 |
+
- Small bug fixes
|
85 |
+

|
86 |
+
## Version 1.1.0.0
|
87 |
+
### NEW
|
88 |
+
- Translate your custom product attributes: export your custom attributes
|
89 |
+
- Backup: in the event of transfer errors to the Eurotext server, data packages are saved to /var/export.
|
90 |
+
### FIXED
|
91 |
+
- Bug fixes and security updates
|
92 |
+
- Improved software performance and stability
|
93 |
+

|
94 |
+
## Version 1.0.0.9
|
95 |
+
### FIXED
|
96 |
+
- The Stock Availability will now be displayed for 'virtual' products/main products according to the setup in the back end
|
97 |
+

|
98 |
+
## Version 1.0.0.8
|
99 |
+
### NEW
|
100 |
+
- You can now filter the product selection by product type
|
101 |
+

|
102 |
+
## Version 1.0.0.7
|
103 |
+
### FIXED
|
104 |
+
- JavaScript error fixed
|
105 |
+
- The update script now works in a more tolerant manner
|
106 |
+

|
107 |
+
## Version 1.0.0.6
|
108 |
+
### NEW
|
109 |
+
- Two additional filters (status and stock availability) are now available in the product selection
|
110 |
+
- Static blocks can now be exported and imported. The static blocks are displayed with the CMS page selection
|
111 |
+

|
112 |
+
## Version 1.0.0.5
|
113 |
+
### NEW
|
114 |
+
- More project information is now displayed in the comment field of the control.xml
|
115 |
+
- The last action in a project can now be 'undone'
|
116 |
+
### FIXED
|
117 |
+
- The correct plugin version is now shown in the control.xml
|
118 |
+

|
119 |
+
## Version 1.0.0.4
|
120 |
+
### FIXED
|
121 |
+
- The module now exports attributes even if there is no name available for the source storeview. It simply exports the admin default text.
|
122 |
+

|
123 |
+
## Version 1.0.0.3
|
124 |
+
### FIXED
|
125 |
+
- The URL key will only be set in the target storeview (based on the product/category name) if there was previously no value there (i.e. "Use default values" was enabled). Previously, the URL key was set if the value was empty or equal to the default value
|
126 |
+
The "Use default values" setting is no longer lost in fields that are not present in the translation files.
|
127 |
+

|
128 |
+
## Version 1.0.0.2
|
129 |
+
### FIXED
|
130 |
+
- Imports would fail if product images, for which translations had been generated, were deleted in the Magento back end between import and export
|
131 |
+
- Product images missing from the import are now simply skipped
|
132 |
+

|
133 |
+
## Version 1.0.0.1
|
134 |
+
### NEW
|
135 |
+
- The product selection has been expanded to include an option to filter by categories, allowing for quick translations of entire categories
|
136 |
+
### FIXED
|
137 |
+
- URL fields not included in an export were being reset to their default values during import, instead of being generated based on the (translated) names
|
138 |
+

|
139 |
+
## Version 1.0.0.0
|
140 |
+
- Release Version 1.0.0.0</notes>
|
141 |
<authors><author><name>Eurotext AG</name><user>eurotext</user><email>info@eurotext.de</email></author></authors>
|
142 |
+
<date>2017-02-09</date>
|
143 |
+
<time>14:43:38</time>
|
144 |
+
<contents><target name="magecommunity"><dir name="Eurotext"><dir name="TranslationManager"><dir name="Block"><dir name="Adminhtml"><dir name="Eurotext"><dir name="Export"><file name="Overview.php" hash="fefd3dc416377f0796233d4ae4a5629b"/></dir><dir name="Grid"><file name="OverwriteCheckboxRenderer.php" hash="602066f890b3ac64a6916161b1c658c3"/><dir name="Renderer"><file name="Checkbox.php" hash="c1f85f5830ff53322dab7a5c1d508072"/><file name="StoreviewWithLocale.php" hash="9b9ca817cd22834274d47f1609feec1e"/></dir></dir><dir name="Import"><file name="Overview.php" hash="f57e709deabcea28c7c9b91130adfb40"/></dir><dir name="Project"><dir name="Edit"><file name="Form.php" hash="5fd8a6e124a3ad3f70a67f166eec0473"/><dir name="Tab"><file name="Categories.php" hash="cff581961884ee839a4dff23c512cb61"/><file name="CmsBlock.php" hash="f0207afed8f58cf715d3ef5b91432b1a"/><file name="CmsPage.php" hash="e1cbffb562cbd97eeba4addc1eef131e"/><dir name="Emails"><file name="Note.php" hash="f0491208842f17d8cb73ec849542f31f"/></dir><dir name="Grid"><file name="Massaction.php" hash="ff9d8bd50174022256b619ee10a9b257"/></dir><dir name="Main"><file name="Single.php" hash="44eb8988afe846e83ff944233fc16764"/><file name="Uploader.php" hash="2a7b906a104315c60189133a40a619c3"/></dir><file name="Main.php" hash="0b7ef2ae66647807f12dd5b5409c7a1c"/><dir name="Products"><file name="CategoryTree.php" hash="8f30da7c0c9d4c55958b83d46c61c220"/><file name="CategoryTreeAjax.php" hash="2bded6c1ae27c34407592bd68fecf944"/><file name="Script.php" hash="d352799ffe1174b0e962f419abd726bb"/></dir><file name="Products.php" hash="042edeadf4ded7a825fe8d6437c32dc9"/><file name="TransactionEmailFiles.php" hash="2dc4c29f6aa7397b888a7c3cb896681d"/><file name="TransactionEmailsDatabase.php" hash="bdf80aae0f475f119317531c7f8c7b7e"/><file name="TranslateFiles.php" hash="6e0c8a2fa3968aa7bdaa439ff5e4d774"/></dir><file name="Tabs.php" hash="7d2b96b63e1099e7221c8d78cf798e3e"/></dir><file name="Edit.php" hash="2501621acc283552519d8b4fe852acf2"/><file name="Grid.php" hash="2f5e6308b7189f0471c55813e00a3a6a"/></dir><file name="Project.php" hash="ff6bb0a8ac38ad3cf2f0c29d549b840c"/></dir><dir name="Grid"><dir name="Renderer"><file name="StoreviewWithLocale.php" hash="a651d215586f38e58fe8c0a7da3aaa8d"/></dir></dir></dir><file name="Help.php" hash="ca61b416958f9a5304a94a9ce69df7da"/><dir name="Response"><file name="Ajax.php" hash="59613d25a1ffc960cc7a3ae29d24e6ec"/></dir><file name="Status.php" hash="194ab3a64321820d47dd67ea554da443"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><dir name="Registration"><file name="Status.php" hash="4f8317f73c695e5af3ee0dfeeb4196ee"/></dir><file name="Text.php" hash="f5fb0b1cf7e3d794a398ede74cf17133"/></dir></dir></dir></dir></dir><dir name="Exception"><file name="FtpException.php" hash="60c1ff48c554f9532eb8d332317d215d"/></dir><dir name="Helper"><file name="Category.php" hash="70cd77b9e06caf7ea3a4486815d64836"/><file name="Config.php" hash="35dbc25466bf03a3046317d6f0891447"/><file name="Data.php" hash="7c7506faca62fa0b9e3e7f3d6c769496"/><file name="Eurotext.php" hash="19ac23de2dd3fdd3ce0e135ffe54fab8"/><file name="Filesystem.php" hash="d37c92b4938501ee81d6b32ec7d91714"/><file name="Project.php" hash="01c2204aafbec11cd07520d430da5b91"/><file name="String.php" hash="dffd96b1157655c01e092d60a0435e99"/><file name="Xml.php" hash="5523724d86ee6f78a79266f8b565e4be"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><dir name="Attribute"><dir name="Backend"><dir name="Media"><file name="OnlyStoreValues.php" hash="ed8ea13152310f8e3ae0df3dfe4fc38c"/></dir></dir></dir></dir></dir><dir name="Controller"><file name="Exception.php" hash="d8ac30e2db57fd25bf1c848425741acd"/></dir><dir name="Eav"><dir name="Attribute"><file name="Label.php" hash="3cc63ed47cdcc3cda59f4d9d93518150"/><dir name="Option"><file name="Value.php" hash="69ec30b12d3724365473b5510da664cd"/></dir></dir></dir><file name="EurotextLanguages.php" hash="b6155eff058695a9560026d9a7be1437"/><dir name="Export"><dir name="Project"><file name="Attribute.php" hash="42d57aa5042088ad80c5be9729acf641"/><file name="Category.php" hash="79a75d998ba28b11206c5405d833e1a1"/><file name="CmsBlock.php" hash="bde0f2b4c333c009d82547948681d0f6"/><file name="CmsPage.php" hash="c9681ac67b4411bc931e03c59211aa11"/><file name="CreateControlFile.php" hash="96922fda3795907275f4e90b4ccddf8e"/><file name="EmailDatabaseTemplates.php" hash="1cef5afc1a58cfd5fa4854920d6888a6"/><file name="EmailFileTemplates.php" hash="ab03745086ef685d030468680764d6f0"/><file name="Exporter.php" hash="451fb2d540fcf210c4de0014961c0eb9"/><file name="FtpUpload.php" hash="597867b37fe1f9404d36eadb722771b0"/><file name="LocaleCsvFiles.php" hash="a2639285003c163a75d073a41719cc9c"/><file name="Product.php" hash="9ed99268cad5a133c356a161a0f924a6"/></dir><file name="Project.php" hash="6fdabca975ad27260f785020aca43507"/></dir><file name="Extractor.php" hash="295dc4980b02098229e142d9a3d82943"/><file name="Factory.php" hash="433a4237864b60ba71ff3af1f85feff6"/><dir name="Import"><dir name="Project"><file name="Attributes.php" hash="b07af08e4caa8b206a383d611e072703"/><file name="Categories.php" hash="c899d9a8c585ac6beb13cb72efc7260a"/><file name="CmsBlocks.php" hash="8b57bb27f9f285bf396b694477c44014"/><file name="CmsPages.php" hash="3248407e6068180c426fb95a1e66ad4c"/><file name="CollectSkipped.php" hash="3efd27b15b46b2befdcd01f8e03b17e7"/><file name="EmailTemplates.php" hash="e9ec9c1b931833e3c7406b16a49d7d33"/><dir name="Exception"><file name="MissingEntity.php" hash="55c8d26331cf9e7090c6fec482cf3b3e"/></dir><file name="Importer.php" hash="2ecac21104fab2e7929932d12cc5b799"/><file name="LocaleCsvFiles.php" hash="02e8c48751d9a1eb5f1ffcd4ee6df08c"/><file name="Product.php" hash="1d20211d1b1c4f69871c57c275af95a5"/></dir><file name="Project.php" hash="c5c42ae3e5ed21317737b3866cb27d06"/><file name="Queue.php" hash="53ea466669ff85174b1070c72916721e"/><file name="Validator.php" hash="36974520d15dcbf3a91a10d07eb77716"/></dir><file name="Observer.php" hash="80b098635238d9660d07982d9567546c"/><file name="ProductLoader.php" hash="e0aa3b1e40815a819c72bc25378077a9"/><dir name="Project"><file name="Category.php" hash="8dd0af28d2889d8eb5ea4aa5fb7b2b5b"/><file name="Cmsblock.php" hash="2b0c4601a0021d5f7d06f98e2b7ab0e2"/><file name="Cmspage.php" hash="3a5642ff3770b3ad09424880b20949c9"/><file name="Csv.php" hash="4fd06e795a31a53ef4fc5106c0ffa28c"/><file name="EmailtemplateDatabase.php" hash="c6978dfc5846d3f470e0b8536178f344"/><file name="EmailtemplateFile.php" hash="c0ba504eaf050ad39acd6e90f47854f3"/><file name="Import.php" hash="a8ef441cd37ee562d8b38755359cd694"/><file name="Product.php" hash="8b5e14407f1449d3df0204274d03320a"/><dir name="Source"><file name="Status.php" hash="6890bab36d251ee47ca2836fbeb41603"/></dir></dir><file name="Project.php" hash="11b850459010c099e7d2ac43756d99cb"/><dir name="Renderer"><dir name="Filesystem"><file name="RelativeToAppDirectory.php" hash="725289dc9ed79898eab27b2ccb5c6d91"/><file name="RelativeToLocaleTemplateDirectory.php" hash="14f6a546f84a48d822179bb353b46351"/></dir><file name="Filesystem.php" hash="5c56c1e04db25584ac6a1ad48c0d4a9d"/></dir><dir name="Resource"><dir name="Catalog"><dir name="Product"><dir name="Attribute"><dir name="Backend"><dir name="Media"><file name="OnlyStoreValues.php" hash="ae4d43376d24cbae4ed19632794f51ba"/></dir></dir></dir><dir name="Option"><file name="Title.php" hash="ee3eabb5995eb327e2de31b248e285be"/><dir name="Type"><file name="Title.php" hash="c49656683099b75ccd6642c61d7a22bc"/></dir></dir></dir></dir><dir name="Csv"><file name="Collection.php" hash="90163f2d6454efd100d48d720a33d4ef"/></dir><dir name="Eav"><dir name="Attribute"><dir name="Label"><file name="Collection.php" hash="6eff56981825b462b78897a1dd0f7248"/></dir><file name="Label.php" hash="65ba1673abc5ed1731d0e911b9b5e4b7"/><dir name="Option"><dir name="Value"><file name="Collection.php" hash="23ebc81f087b31723b175ae46e7eb4e2"/></dir><file name="Value.php" hash="3352674505656df6d51774444ab59fa5"/></dir></dir></dir><dir name="Emailtemplate"><dir name="Filesystem"><file name="Collection.php" hash="a8f0dc8367a2ee12846d89b272037db1"/></dir></dir><dir name="Filesystem"><file name="Collection.php" hash="8b84ee3193ad45484c251336d64cf71c"/></dir><dir name="Project"><dir name="Category"><file name="Collection.php" hash="134968856c66296fe418151a7dfdc8a5"/></dir><file name="Category.php" hash="55d87ff56d171e1daf4f42a2b8808d1b"/><dir name="Cmsblock"><file name="Collection.php" hash="d126952fba4c57de3277ac83bbafe61b"/></dir><file name="Cmsblock.php" hash="05e85b8142a95424ddd45884999a6c6c"/><dir name="Cmspage"><file name="Collection.php" hash="7fd97c6a893d2e365e1035e934f5be5d"/></dir><file name="Cmspage.php" hash="58e59ec888b52973b01b98e0fc19f50f"/><file name="Collection.php" hash="0b068f00639795627c7e2576ca3feaa4"/><dir name="Csv"><file name="Collection.php" hash="0d10dfdedae29b70f1fc2e3b19f160e4"/></dir><file name="Csv.php" hash="f283f1bd37fecb222bedf46d9cde3f18"/><dir name="EmailtemplateDatabase"><file name="Collection.php" hash="e63d7568db40281040ef984326100658"/></dir><file name="EmailtemplateDatabase.php" hash="eb787be577d4341d5324d159f9a66afd"/><dir name="EmailtemplateFile"><file name="Collection.php" hash="8d83aa3abce2e076d387ac3ba3a12cb3"/></dir><file name="EmailtemplateFile.php" hash="43d1baa459bf00fead85fa9e22979502"/><dir name="Import"><file name="Collection.php" hash="7ac0c91738130e32b97e4dc3f7ae6e68"/></dir><file name="Import.php" hash="9d71d42dfc91c16fa83a26ae76b79339"/><dir name="Product"><file name="Collection.php" hash="cafc0c7dbda6f9733a7dbf158a03c88b"/></dir><file name="Product.php" hash="8fbd6ffee43f8094c90d52f97e425d50"/></dir><file name="Project.php" hash="d964e9890f77119ceb343692d98a27d7"/><file name="Setup.php" hash="992b5dbedd9dc6d669ff7a7949c790ab"/></dir><dir name="Source"><file name="StoreViewWithLocale.php" hash="a97b6ef2d0521da72fcad45c7ab8b1df"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Salutation.php" hash="1de509321f9050e3f4c30c004e9b0310"/></dir></dir></dir><dir name="Updater"><file name="MediaGalleryValue.php" hash="8c38ccb08dab63701882e4dbf79f0bc7"/></dir><dir name="Xml"><dir name="Import"><dir name="Cms"><file name="Block.php" hash="ee5853195c38dcc699a663bbe70a510e"/><file name="BlockReader.php" hash="ec3d5fe50d778602c4417b6f645fb048"/></dir></dir></dir><file name=".DS_Store" hash="7c3522d12f27b1bc414fac586a4b971f"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Eurotext"><file name="HelpController.php" hash="cf5a275aef3ed8d5b57cecf7e336fc9d"/><dir name="Project"><file name="ExportController.php" hash="52f796f6aeed83dc90e4a5d2281f17a9"/><file name="ImportController.php" hash="413b7c3ba87a65b7f54fd40f1eea627a"/></dir><file name="ProjectController.php" hash="c0fa1e9b0d924d438c9d6f51a141c33d"/><file name="StatusController.php" hash="fa4bad31a7259d73eb4e8d63f8a8baad"/><file name=".DS_Store" hash="be9480710cd7aa8bcc8ca162bbe60791"/></dir><file name=".DS_Store" hash="af0a7d68dfc1505f5fd04c55baff3727"/></dir><file name=".DS_Store" hash="9d6e9b7cea3d170ee9c8cfccccc4ee80"/></dir><dir name="data"><dir name="eurotext_translationmanager_setup"><file name="data-install-3.0.0.php" hash="fa9de480b2d6d32ec1530c51914607d7"/><file name="data-upgrade-1.2.0.4-1.2.1.php" hash="40c403ee7e379d83e3f76ce1d6809b4e"/><file name="data-upgrade-1.2.1-1.2.2.php" hash="d6a7a1c4e525f552cc463393398737e1"/><file name="data-upgrade-3.1.1-3.1.2.php" hash="ea833f0234b35f910623f0434d78e8e9"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="af3f9f6b2b6ed681f4ebe8651ae4ad33"/><file name="config.xml" hash="2447d712b30ddd1950fcf99e4f611bb1"/><file name="jstranslator.xml" hash="96c99f45202c522b98b01e792308954b"/><file name="system.xml" hash="30c104492c31a647fe7d05af8a7ec52a"/></dir><dir name="sql"><dir name="eurotext_translationmanager_setup"><file name="install-3.0.0.php" hash="c249a9897d9259b70e6c2a816fb4e6be"/><file name="mysql4-install-1.0.0.0.php" hash="e18c0008fdf86231a2b9fc5fdaf772f6"/><file name="mysql4-upgrade-1.0.0.5-1.0.0.6.php" hash="ea4e8bfeb96b41454a6270fc679a97fc"/><file name="mysql4-upgrade-1.0.0.7-1.0.0.8.php" hash="b610342ad985cd23f823cb05048c172d"/><file name="upgrade-1.1.2.1-1.2.0.0.php" hash="cad08b1c61ec678d3848bc708d9abb93"/><file name="upgrade-1.2.0.0-1.2.0.1.php" hash="84fd2540a1f49e6389ff020c8e5af26a"/><file name="upgrade-1.2.0.1-1.2.0.2.php" hash="e4f0ac1f302b04d51b8e055a015f266e"/><file name="upgrade-1.2.0.2-1.2.0.3.php" hash="dab9799a3641756c414be9c24da50ed2"/><file name="upgrade-1.2.1-1.2.2.php" hash="eede73761bed1bfdb89fd401be2bb73f"/><file name="upgrade-1.2.2-2.0.0.php" hash="776bc7ea41553eca877799bcc1a6c0f5"/><file name="upgrade-2.0.0-2.0.1.php" hash="0e82e6faa5ad98c0c7ab54f7fa9dbd3d"/><file name="upgrade-2.0.1-2.0.2.php" hash="4dbb0a871107c8d73dbcef9d1283291f"/><file name="upgrade-2.0.10-3.0.0.php" hash="3c247bf1573b192c431fecf1a97ea41e"/><file name="upgrade-2.0.3-2.0.4.php" hash="808861b1ef6079517feb94ae9afb7bc4"/><file name="upgrade-2.0.4-2.0.5.php" hash="29082ded381bd975bf8e9de9ee1aab74"/><file name="upgrade-2.0.5-2.0.6.php" hash="be2d23c6c0b877db0ac3bfa75a15b3c2"/><file name="upgrade-2.0.6-2.0.7.php" hash="4a789cf110e0e98270e635a7df85706e"/><file name="upgrade-2.0.7-2.0.8.php" hash="64a538428c0ebadcbb942a218814411a"/><file name="upgrade-2.0.8-2.0.9.php" hash="f2fd21608a2b91aeed69a28a1fb22b7a"/><file name="upgrade-2.0.9-2.0.10.php" hash="99d8c357714dfad0c44878a19ced4bab"/><file name="upgrade-3.0.0-3.0.1.php" hash="8a1ba3c8d8ca015c9e47d075ecea63dc"/><file name="upgrade-3.0.1-3.0.2.php" hash="9a6333481ccf99cbc851ae904067d91a"/><file name="upgrade-3.0.2-3.1.1.php" hash="656613ebca52ae1581d41cc2cdf58d83"/><file name="upgrade-3.1.5-3.1.6.php" hash="529cb0c4c7f7f5f3b15e53dcc025c0f7"/><file name="upgrade-3.1.6-3.1.7.php" hash="a3e58f601ca6fbf534bb14d031c19d39"/><file name="upgrade-3.1.7-3.1.8.php" hash="937e0052ee352a2f0fd1f548d65e61ef"/></dir></dir><file name=".DS_Store" hash="a747456783fab7a1190bb4bb3c45424a"/></dir><dir name="Uploader"><dir name="Block"><file name="Abstract.php" hash="38144e4e5c93520084c8cd6d81a47213"/><file name="Single.php" hash="98267d16076c3d556fb60d36c4e98252"/></dir><dir name="Helper"><file name="Data.php" hash="c142374acaef347046b43812adf919bf"/><file name="File.php" hash="1d25808dcc375cd85b35a77b111e744b"/></dir><dir name="Model"><dir name="Config"><file name="Abstract.php" hash="5b76430dd931628c2aaac0f698536186"/><file name="Browsebutton.php" hash="bce1ef6db09e535473c085dd6b5f580c"/><file name="Misc.php" hash="e0a89ff017cd74531448f9f295bb327b"/><file name="Uploader.php" hash="41152324c956fbe9cc9473044c139201"/></dir></dir><dir name="etc"><file name="config.xml" hash="a76f635b80aa9f9ad87fba966d560e11"/><file name="jstranslator.xml" hash="5de25b97a70ec60134a47c3c6bc9212a"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="layout"><dir name="eurotext"><file name="translationmanager.xml" hash="fe0cacbe5fedd5ac0abccb3009879d1a"/></dir></dir><dir name="template"><dir name="eurotext"><dir name="translationmanager"><dir name="export"><file name="overview.phtml" hash="9327bb36242c985b60db163953563c67"/></dir><file name="help.phtml" hash="1d8d1d32744bc6db2d26b2b0fa2394fe"/><dir name="import"><file name="overview.phtml" hash="6c90bdd842e3b03c8697c337b388e798"/></dir><dir name="project"><dir name="email"><file name="note.phtml" hash="f39644edf9dc77c92206961f46dc08b8"/></dir><dir name="products"><file name="bulk_sku.phtml" hash="d150c3b522378c2810947b8f877eccef"/><file name="category_tree.phtml" hash="02d25a4b18772ac2541f7be067ed1c0f"/><file name="script.phtml" hash="44956e903e1f2751da6d6464214b047f"/></dir></dir></dir><file name="uploader" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Eurotext_TranslationManager.csv" hash="dd91805d1358e4eb64969d321e558f7b"/><file name="Eurotext_Uploader.csv" hash="52a262b495f24074825b07a15080e264"/></dir><dir name="de_DE"><file name="Eurotext_TranslationManager.csv" hash="259290a914e033ac623e8018ad3051fa"/><file name="Eurotext_Uploader.csv" hash="0009959270fc7f3d5256250c97f5b4c8"/></dir></target><target name="mageetc"><dir name="modules"><file name="Eurotext_TranslationManager.xml" hash="0eb43d3e4d41bebb069074d1d9eed7df"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="eurotext"><dir name="translationmanager"><dir name="css"><file name="help.css" hash="38e92dee1ed607b981203e315eb26c86"/><file name="project.css" hash="4a959f8858e91c2b1b49e3ca927b9447"/><file name="status.css" hash="893a736b4a043eb5b801d7a639d92d03"/></dir><dir name="images"><file name="btt_suche.png" hash="9b74d62b9840cafb6990352c52a39458"/><file name="cat-minus.png" hash="d092af81ca37c821e13f27cc9bc44378"/><file name="cat-none.png" hash="88805f6b1ed90aa66db3cc6f89c83db0"/><file name="cat-plus.png" hash="16d73e360bebbeb16c4115ceea771b56"/><file name="eurotext_logo.png" hash="87120ee2d376e3195e2e7cd8b9661ba7"/><file name="eurotext_table_head.png" hash="36583e9470155c585304e305133e13ec"/><file name="logo_dixeno.png" hash="dd23f387d0eee8a9494724a470d8742e"/><file name="logo_eurotext.png" hash="7a8627f728f203823fbee1575d223131"/><file name="pager_arrow_left.gif" hash="6e44f608dac8eb8be1d1ebee5a3285aa"/><file name="pager_arrow_left_off.gif" hash="30f5e56195ab3546b36f4016db5254be"/><file name="pager_arrow_right.gif" hash="cc79526156b7e0c8abce61fad3d53f77"/><file name="pager_arrow_right_off.gif" hash="f01b7dad9acf0180b5c62edbd7ea9939"/></dir><dir name="js"><file name="eurotext_project.js" hash="9812165e4e8193a227503583d8423331"/><file name="export.js" hash="78b560ca40a66a6180a4ad8bb7dad933"/><file name="system_config.js" hash="d773e2a2896b917ca4f793da3fb4f9d3"/></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="eurotext"><dir name="uploader"><file name="flow.min.js" hash="a82a557db407b53d5909fa4e1833a596"/><file name="fusty-flow-factory.js" hash="b3f49be0f28be74e8b8bb76496c52bc3"/><file name="fusty-flow.js" hash="302f440908837093fd4e9b6e76ec01e0"/><file name="instance.js" hash="3a4f8bbbb500a1224eba194f93afe437"/></dir></dir></dir></target></contents>
|
145 |
<compatible/>
|
146 |
+
<dependencies><required><php><min>5.5.0</min><max>7.0.0</max></php></required></dependencies>
|
147 |
</package>
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.eurotext_logo {
|
2 |
+
background: url('../images/eurotext_logo.png');
|
3 |
+
width: 453px;
|
4 |
+
height: 69px;
|
5 |
+
display: inline-block;
|
6 |
+
}
|
7 |
+
|
8 |
+
.logo_eurotext {
|
9 |
+
background: url('../images/logo_eurotext.png');
|
10 |
+
width: 244px;
|
11 |
+
height: 69px;
|
12 |
+
display: inline-block;
|
13 |
+
}
|
14 |
+
|
15 |
+
.eurotext_grid table td {
|
16 |
+
padding: 15px;
|
17 |
+
}
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#project_tabs_products_section_content .tree {
|
2 |
+
width: 20%;
|
3 |
+
margin-top: 33px;
|
4 |
+
}
|
5 |
+
|
6 |
+
#project_tabs_products_section_content #productGrid {
|
7 |
+
width: 80%;
|
8 |
+
float: right;
|
9 |
+
}
|
10 |
+
|
11 |
+
.tree .incomplete a span {
|
12 |
+
color: lightgrey;
|
13 |
+
}
|
14 |
+
|
15 |
+
div#project_tabs_transaction_email_section_content > div {
|
16 |
+
float: left;
|
17 |
+
width: 49.5%;
|
18 |
+
}
|
19 |
+
|
20 |
+
div#project_tabs_transaction_email_section_content > div:nth-child(2) {
|
21 |
+
margin-right: 1%;
|
22 |
+
}
|
23 |
+
|
24 |
+
.bulk_sku.bulk_sku {
|
25 |
+
width: 20%;
|
26 |
+
margin-top: 4px;
|
27 |
+
}
|
28 |
+
|
29 |
+
.bulk_sku textarea {
|
30 |
+
max-width: 80%;
|
31 |
+
width: 80%;
|
32 |
+
resize: none;
|
33 |
+
height: 40em;
|
34 |
+
}
|
35 |
+
|
36 |
+
/* Files Uploader */
|
37 |
+
.files .flex,
|
38 |
+
.files-wide .flex {
|
39 |
+
float: right !important;
|
40 |
+
position: static !important;
|
41 |
+
}
|
42 |
+
|
43 |
+
.files .uploader,
|
44 |
+
.files-wide .uploader {
|
45 |
+
float: left;
|
46 |
+
overflow: hidden;
|
47 |
+
}
|
48 |
+
|
49 |
+
.files .uploader {
|
50 |
+
width: 100px;
|
51 |
+
}
|
52 |
+
|
53 |
+
.files-wide .uploader {
|
54 |
+
width: 260px;
|
55 |
+
}
|
56 |
+
|
57 |
+
.files .uploader .file-row-info,
|
58 |
+
.files-wide .uploader .file-row-info,
|
59 |
+
.files .uploader .file-row-narrow,
|
60 |
+
.files-wide .uploader .file-row-narrow {
|
61 |
+
margin: 0 !important;
|
62 |
+
}
|
63 |
+
|
64 |
+
/** Media Library **/
|
65 |
+
.uploader {
|
66 |
+
margin-top: -10px;;
|
67 |
+
}
|
68 |
+
|
69 |
+
.uploader .file-row {
|
70 |
+
width: 600px;
|
71 |
+
padding: 0.5em 0.6em;
|
72 |
+
margin: 0.5em 0.6em;
|
73 |
+
border: 1px solid #ccc;
|
74 |
+
background-color: #f9f9f9; /*vertical-align:middle;*/
|
75 |
+
}
|
76 |
+
|
77 |
+
.uploader .file-row-narrow {
|
78 |
+
width: auto;
|
79 |
+
margin: 0 0 2px 40px;
|
80 |
+
}
|
81 |
+
|
82 |
+
.uploader .file-row .file-info {
|
83 |
+
float: left;
|
84 |
+
margin-left: 14px;
|
85 |
+
margin-top: 2px;
|
86 |
+
}
|
87 |
+
|
88 |
+
/*.uploader .file-row .file-info-name { with: 80%; overflow: hidden; }
|
89 |
+
.uploader .file-row .file-info-size { width: 20%; }*/
|
90 |
+
.uploader .file-row-info {
|
91 |
+
margin: 0 0 0 10px;
|
92 |
+
}
|
93 |
+
|
94 |
+
.uploader .file-row-info .file-info-name {
|
95 |
+
font-weight: bold;
|
96 |
+
}
|
97 |
+
|
98 |
+
.uploader .file-row .progress-text {
|
99 |
+
float: right;
|
100 |
+
font-weight: bold;
|
101 |
+
}
|
102 |
+
|
103 |
+
.uploader .file-row .delete-button {
|
104 |
+
float: right;
|
105 |
+
}
|
106 |
+
|
107 |
+
.uploader .progress {
|
108 |
+
border: 1px solid #f0e6b7;
|
109 |
+
background-color: #feffcc;
|
110 |
+
}
|
111 |
+
|
112 |
+
.uploader .error {
|
113 |
+
border: 1px solid #aa1717;
|
114 |
+
background-color: #ffe6de;
|
115 |
+
}
|
116 |
+
|
117 |
+
.uploader .error .progress-text {
|
118 |
+
padding-right: 10px;
|
119 |
+
}
|
120 |
+
|
121 |
+
.uploader .complete {
|
122 |
+
border: 1px solid #90c898;
|
123 |
+
background-color: #e5ffed;
|
124 |
+
}
|
125 |
+
|
126 |
+
.uploader .buttons {
|
127 |
+
margin-top: 7px;
|
128 |
+
margin-left: 14px;
|
129 |
+
}
|
130 |
+
|
131 |
+
#productGrid_massaction-form {
|
132 |
+
display: none;
|
133 |
+
}
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.eurotext_export_status li,
|
2 |
+
.eurotext_import_status li {
|
3 |
+
background: no-repeat 4px 5px;
|
4 |
+
padding: 5px 5px 5px 27px;
|
5 |
+
border: 1px solid #ccc;
|
6 |
+
margin: 2px;
|
7 |
+
}
|
8 |
+
|
9 |
+
.eurotext_export_status .ok,
|
10 |
+
.eurotext_import_status .ok {
|
11 |
+
background: url("../../../../../default/default/images/fam_bullet_success.gif") no-repeat 4px 5px;
|
12 |
+
}
|
13 |
+
|
14 |
+
.eurotext_export_status .error,
|
15 |
+
.eurotext_import_status .error {
|
16 |
+
background: #FFD url("../../../../../default/default/images/fam_bullet_error.gif") no-repeat 4px 5px;
|
17 |
+
}
|
18 |
+
|
19 |
+
.eurotext_export_status .success,
|
20 |
+
.eurotext_import_status .success {
|
21 |
+
background: #DDF url("../../../../../default/default/images/fam_bullet_success.gif") no-repeat 4px 5px;
|
22 |
+
}
|
@@ -1,206 +0,0 @@
|
|
1 |
-
.eurotext_td { padding-right:20px; }
|
2 |
-
.et_tdc { text-align:center;vertical-align:top; }
|
3 |
-
.et_toptd { vertical-align:top; }
|
4 |
-
.et_infobox { color:gray; font-style:italic; }
|
5 |
-
.et_btt
|
6 |
-
{
|
7 |
-
-moz-border-radius:3px 3px 3px 3px;
|
8 |
-
-webkit-border-radius:3px 3px 3px 3px;
|
9 |
-
border-radius:3px 3px 3px 3px;
|
10 |
-
background:-moz-linear-gradient(center top , #FFFFFF, #EFEFEF) repeat scroll 0 0 #F6F6F6;
|
11 |
-
background:-webkit-gradient(linear,center top, center bottom, from(#FFFFFF), to(#EFEFEF));
|
12 |
-
border:1px solid #CCCCCC;
|
13 |
-
cursor:pointer;
|
14 |
-
overflow:visible;
|
15 |
-
display:inline-block;
|
16 |
-
padding-left:10px;
|
17 |
-
padding-right:10px;
|
18 |
-
padding-top:5px;
|
19 |
-
padding-bottom:5px;
|
20 |
-
vertical-align:middle;
|
21 |
-
white-space:nowrap;
|
22 |
-
text-decoration:none
|
23 |
-
}
|
24 |
-
|
25 |
-
.eurotext_category_plus
|
26 |
-
{
|
27 |
-
background:url('../images/cat-plus.png');
|
28 |
-
width:16px;
|
29 |
-
height:18px;
|
30 |
-
}
|
31 |
-
|
32 |
-
.eurotext_category_minus
|
33 |
-
{
|
34 |
-
background:url('../images/cat-minus.png');
|
35 |
-
width:16px;
|
36 |
-
height:18px;
|
37 |
-
}
|
38 |
-
|
39 |
-
.eurotext_category_none
|
40 |
-
{
|
41 |
-
background:url('../images/cat-none.png');
|
42 |
-
width:16px;
|
43 |
-
height:18px;
|
44 |
-
}
|
45 |
-
|
46 |
-
.eurotext_config
|
47 |
-
{
|
48 |
-
background:#FAFAFA;
|
49 |
-
border:2px solid #A3B8BF;
|
50 |
-
border-top:0px;
|
51 |
-
}
|
52 |
-
.eurotext_confighead
|
53 |
-
{
|
54 |
-
background:#6f8992; padding:2px 10px;
|
55 |
-
color:white;
|
56 |
-
font-weight:bold;
|
57 |
-
}
|
58 |
-
|
59 |
-
.eurotext_toptd
|
60 |
-
{
|
61 |
-
vertical-align:top;
|
62 |
-
}
|
63 |
-
|
64 |
-
.eurotext_edittext
|
65 |
-
{
|
66 |
-
padding:5px;
|
67 |
-
}
|
68 |
-
|
69 |
-
.eurotext_logo
|
70 |
-
{
|
71 |
-
background:url('../images/eurotext_logo.png'); width:453px; height:69px; display:inline-block;
|
72 |
-
}
|
73 |
-
|
74 |
-
.logo_eurotext
|
75 |
-
{
|
76 |
-
background:url('../images/logo_eurotext.png'); width:244px; height:69px; display:inline-block;
|
77 |
-
}
|
78 |
-
|
79 |
-
|
80 |
-
tr.selected_project { background:#F6C27E !important; }
|
81 |
-
|
82 |
-
.et_error { font-weight:bold; color:red; }
|
83 |
-
.et_ok { font-weight:bold; color:green; }
|
84 |
-
.et_th { padding-right:10px; font-weight:bold; }
|
85 |
-
.et_tc { padding-right:10px; }
|
86 |
-
.et_header { font-size:11pt; font-weight:bold; margin-bottom:10px; }
|
87 |
-
|
88 |
-
.eurotext_grid table td
|
89 |
-
{
|
90 |
-
padding:15px;
|
91 |
-
}
|
92 |
-
|
93 |
-
.eurotext_head
|
94 |
-
{
|
95 |
-
padding: 2px 4px 2px 14px !important; font-weight:bold !important;
|
96 |
-
}
|
97 |
-
|
98 |
-
.eurotext_head2
|
99 |
-
{
|
100 |
-
padding: 10px !important;
|
101 |
-
font-weight:bold !important;
|
102 |
-
font-size:12pt !important;
|
103 |
-
|
104 |
-
background: #ebebeb; /* Old browsers */
|
105 |
-
background: -moz-linear-gradient(top, #ebebeb 0%, #a5a5a5 93%, #a5a5a5 100%); /* FF3.6+ */
|
106 |
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ebebeb), color-stop(93%,#a5a5a5), color-stop(100%,#a5a5a5)); /* Chrome,Safari4+ */
|
107 |
-
background: -webkit-linear-gradient(top, #ebebeb 0%,#a5a5a5 93%,#a5a5a5 100%); /* Chrome10+,Safari5.1+ */
|
108 |
-
background: -o-linear-gradient(top, #ebebeb 0%,#a5a5a5 93%,#a5a5a5 100%); /* Opera 11.10+ */
|
109 |
-
background: -ms-linear-gradient(top, #ebebeb 0%,#a5a5a5 93%,#a5a5a5 100%); /* IE10+ */
|
110 |
-
background: linear-gradient(to bottom, #ebebeb 0%,#a5a5a5 93%,#a5a5a5 100%); /* W3C */
|
111 |
-
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ebebeb', endColorstr='#a5a5a5',GradientType=0 ); /* IE6-9 */
|
112 |
-
}
|
113 |
-
|
114 |
-
.eurotext_layertitle
|
115 |
-
{
|
116 |
-
font-size:11pt;
|
117 |
-
color:#F59200;
|
118 |
-
font-weight:bold;
|
119 |
-
}
|
120 |
-
|
121 |
-
.eurotext_layerstrip
|
122 |
-
{
|
123 |
-
border-top:6px #DFDFDF solid;
|
124 |
-
margin-bottom:15px;
|
125 |
-
}
|
126 |
-
|
127 |
-
.eurotext_layercellheader
|
128 |
-
{
|
129 |
-
background-color:#6E8992;
|
130 |
-
color:white;
|
131 |
-
font-weight:bold;
|
132 |
-
padding:3px;
|
133 |
-
}
|
134 |
-
|
135 |
-
.eurotext_back_disabled
|
136 |
-
{
|
137 |
-
background:url('../images/pager_arrow_left_off.gif');
|
138 |
-
width:13px;
|
139 |
-
height:13px;
|
140 |
-
display:inline-block;
|
141 |
-
vertical-align:middle;
|
142 |
-
}
|
143 |
-
|
144 |
-
.eurotext_back_enabled
|
145 |
-
{
|
146 |
-
background:url('../images/pager_arrow_left.gif');
|
147 |
-
width:13px;
|
148 |
-
height:13px;
|
149 |
-
display:inline-block;
|
150 |
-
vertical-align:middle;
|
151 |
-
}
|
152 |
-
|
153 |
-
.eurotext_next_disabled
|
154 |
-
{
|
155 |
-
background:url('../images/pager_arrow_right_off.gif');
|
156 |
-
width:13px;
|
157 |
-
height:13px;
|
158 |
-
display:inline-block;
|
159 |
-
vertical-align:middle;
|
160 |
-
}
|
161 |
-
|
162 |
-
.eurotext_next_enabled
|
163 |
-
{
|
164 |
-
background:url('../images/pager_arrow_right.gif');
|
165 |
-
width:13px;
|
166 |
-
height:13px;
|
167 |
-
display:inline-block;
|
168 |
-
vertical-align:middle;
|
169 |
-
}
|
170 |
-
|
171 |
-
.eurotext_r1
|
172 |
-
{
|
173 |
-
background-color:#F6F6F6;
|
174 |
-
padding:4px;
|
175 |
-
}
|
176 |
-
|
177 |
-
.eurotext_r0
|
178 |
-
{
|
179 |
-
background-color:#FFFFFF;
|
180 |
-
padding:4px;
|
181 |
-
}
|
182 |
-
|
183 |
-
.eurotext2_r1
|
184 |
-
{
|
185 |
-
background-color:#F2F2F2;
|
186 |
-
padding:4px;
|
187 |
-
}
|
188 |
-
|
189 |
-
.eurotext2_r0
|
190 |
-
{
|
191 |
-
background-color:#EAEAEA;
|
192 |
-
padding:4px;
|
193 |
-
}
|
194 |
-
|
195 |
-
.eurotext_vcenter
|
196 |
-
{
|
197 |
-
vertical-align:middle;
|
198 |
-
}
|
199 |
-
|
200 |
-
.eurotext_findbtt
|
201 |
-
{
|
202 |
-
background:url('../images/btt_suche.png');
|
203 |
-
width:52px;
|
204 |
-
height:21px;
|
205 |
-
display:inline-block;
|
206 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,9597 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* jQuery JavaScript Library v1.9.1
|
3 |
-
* http://jquery.com/
|
4 |
-
*
|
5 |
-
* Includes Sizzle.js
|
6 |
-
* http://sizzlejs.com/
|
7 |
-
*
|
8 |
-
* Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
|
9 |
-
* Released under the MIT license
|
10 |
-
* http://jquery.org/license
|
11 |
-
*
|
12 |
-
* Date: 2013-2-4
|
13 |
-
*/
|
14 |
-
(function( window, undefined ) {
|
15 |
-
|
16 |
-
// Can't do this because several apps including ASP.NET trace
|
17 |
-
// the stack via arguments.caller.callee and Firefox dies if
|
18 |
-
// you try to trace through "use strict" call chains. (#13335)
|
19 |
-
// Support: Firefox 18+
|
20 |
-
//"use strict";
|
21 |
-
var
|
22 |
-
// The deferred used on DOM ready
|
23 |
-
readyList,
|
24 |
-
|
25 |
-
// A central reference to the root jQuery(document)
|
26 |
-
rootjQuery,
|
27 |
-
|
28 |
-
// Support: IE<9
|
29 |
-
// For `typeof node.method` instead of `node.method !== undefined`
|
30 |
-
core_strundefined = typeof undefined,
|
31 |
-
|
32 |
-
// Use the correct document accordingly with window argument (sandbox)
|
33 |
-
document = window.document,
|
34 |
-
location = window.location,
|
35 |
-
|
36 |
-
// Map over jQuery in case of overwrite
|
37 |
-
_jQuery = window.jQuery,
|
38 |
-
|
39 |
-
// Map over the $ in case of overwrite
|
40 |
-
_$ = window.$,
|
41 |
-
|
42 |
-
// [[Class]] -> type pairs
|
43 |
-
class2type = {},
|
44 |
-
|
45 |
-
// List of deleted data cache ids, so we can reuse them
|
46 |
-
core_deletedIds = [],
|
47 |
-
|
48 |
-
core_version = "1.9.1",
|
49 |
-
|
50 |
-
// Save a reference to some core methods
|
51 |
-
core_concat = core_deletedIds.concat,
|
52 |
-
core_push = core_deletedIds.push,
|
53 |
-
core_slice = core_deletedIds.slice,
|
54 |
-
core_indexOf = core_deletedIds.indexOf,
|
55 |
-
core_toString = class2type.toString,
|
56 |
-
core_hasOwn = class2type.hasOwnProperty,
|
57 |
-
core_trim = core_version.trim,
|
58 |
-
|
59 |
-
// Define a local copy of jQuery
|
60 |
-
jQuery = function( selector, context ) {
|
61 |
-
// The jQuery object is actually just the init constructor 'enhanced'
|
62 |
-
return new jQuery.fn.init( selector, context, rootjQuery );
|
63 |
-
},
|
64 |
-
|
65 |
-
// Used for matching numbers
|
66 |
-
core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
|
67 |
-
|
68 |
-
// Used for splitting on whitespace
|
69 |
-
core_rnotwhite = /\S+/g,
|
70 |
-
|
71 |
-
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
|
72 |
-
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
73 |
-
|
74 |
-
// A simple way to check for HTML strings
|
75 |
-
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
|
76 |
-
// Strict HTML recognition (#11290: must start with <)
|
77 |
-
rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
|
78 |
-
|
79 |
-
// Match a standalone tag
|
80 |
-
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
|
81 |
-
|
82 |
-
// JSON RegExp
|
83 |
-
rvalidchars = /^[\],:{}\s]*$/,
|
84 |
-
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
|
85 |
-
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
|
86 |
-
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
|
87 |
-
|
88 |
-
// Matches dashed string for camelizing
|
89 |
-
rmsPrefix = /^-ms-/,
|
90 |
-
rdashAlpha = /-([\da-z])/gi,
|
91 |
-
|
92 |
-
// Used by jQuery.camelCase as callback to replace()
|
93 |
-
fcamelCase = function( all, letter ) {
|
94 |
-
return letter.toUpperCase();
|
95 |
-
},
|
96 |
-
|
97 |
-
// The ready event handler
|
98 |
-
completed = function( event ) {
|
99 |
-
|
100 |
-
// readyState === "complete" is good enough for us to call the dom ready in oldIE
|
101 |
-
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
|
102 |
-
detach();
|
103 |
-
jQuery.ready();
|
104 |
-
}
|
105 |
-
},
|
106 |
-
// Clean-up method for dom ready events
|
107 |
-
detach = function() {
|
108 |
-
if ( document.addEventListener ) {
|
109 |
-
document.removeEventListener( "DOMContentLoaded", completed, false );
|
110 |
-
window.removeEventListener( "load", completed, false );
|
111 |
-
|
112 |
-
} else {
|
113 |
-
document.detachEvent( "onreadystatechange", completed );
|
114 |
-
window.detachEvent( "onload", completed );
|
115 |
-
}
|
116 |
-
};
|
117 |
-
|
118 |
-
jQuery.fn = jQuery.prototype = {
|
119 |
-
// The current version of jQuery being used
|
120 |
-
jquery: core_version,
|
121 |
-
|
122 |
-
constructor: jQuery,
|
123 |
-
init: function( selector, context, rootjQuery ) {
|
124 |
-
var match, elem;
|
125 |
-
|
126 |
-
// HANDLE: $(""), $(null), $(undefined), $(false)
|
127 |
-
if ( !selector ) {
|
128 |
-
return this;
|
129 |
-
}
|
130 |
-
|
131 |
-
// Handle HTML strings
|
132 |
-
if ( typeof selector === "string" ) {
|
133 |
-
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
|
134 |
-
// Assume that strings that start and end with <> are HTML and skip the regex check
|
135 |
-
match = [ null, selector, null ];
|
136 |
-
|
137 |
-
} else {
|
138 |
-
match = rquickExpr.exec( selector );
|
139 |
-
}
|
140 |
-
|
141 |
-
// Match html or make sure no context is specified for #id
|
142 |
-
if ( match && (match[1] || !context) ) {
|
143 |
-
|
144 |
-
// HANDLE: $(html) -> $(array)
|
145 |
-
if ( match[1] ) {
|
146 |
-
context = context instanceof jQuery ? context[0] : context;
|
147 |
-
|
148 |
-
// scripts is true for back-compat
|
149 |
-
jQuery.merge( this, jQuery.parseHTML(
|
150 |
-
match[1],
|
151 |
-
context && context.nodeType ? context.ownerDocument || context : document,
|
152 |
-
true
|
153 |
-
) );
|
154 |
-
|
155 |
-
// HANDLE: $(html, props)
|
156 |
-
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
|
157 |
-
for ( match in context ) {
|
158 |
-
// Properties of context are called as methods if possible
|
159 |
-
if ( jQuery.isFunction( this[ match ] ) ) {
|
160 |
-
this[ match ]( context[ match ] );
|
161 |
-
|
162 |
-
// ...and otherwise set as attributes
|
163 |
-
} else {
|
164 |
-
this.attr( match, context[ match ] );
|
165 |
-
}
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
return this;
|
170 |
-
|
171 |
-
// HANDLE: $(#id)
|
172 |
-
} else {
|
173 |
-
elem = document.getElementById( match[2] );
|
174 |
-
|
175 |
-
// Check parentNode to catch when Blackberry 4.6 returns
|
176 |
-
// nodes that are no longer in the document #6963
|
177 |
-
if ( elem && elem.parentNode ) {
|
178 |
-
// Handle the case where IE and Opera return items
|
179 |
-
// by name instead of ID
|
180 |
-
if ( elem.id !== match[2] ) {
|
181 |
-
return rootjQuery.find( selector );
|
182 |
-
}
|
183 |
-
|
184 |
-
// Otherwise, we inject the element directly into the jQuery object
|
185 |
-
this.length = 1;
|
186 |
-
this[0] = elem;
|
187 |
-
}
|
188 |
-
|
189 |
-
this.context = document;
|
190 |
-
this.selector = selector;
|
191 |
-
return this;
|
192 |
-
}
|
193 |
-
|
194 |
-
// HANDLE: $(expr, $(...))
|
195 |
-
} else if ( !context || context.jquery ) {
|
196 |
-
return ( context || rootjQuery ).find( selector );
|
197 |
-
|
198 |
-
// HANDLE: $(expr, context)
|
199 |
-
// (which is just equivalent to: $(context).find(expr)
|
200 |
-
} else {
|
201 |
-
return this.constructor( context ).find( selector );
|
202 |
-
}
|
203 |
-
|
204 |
-
// HANDLE: $(DOMElement)
|
205 |
-
} else if ( selector.nodeType ) {
|
206 |
-
this.context = this[0] = selector;
|
207 |
-
this.length = 1;
|
208 |
-
return this;
|
209 |
-
|
210 |
-
// HANDLE: $(function)
|
211 |
-
// Shortcut for document ready
|
212 |
-
} else if ( jQuery.isFunction( selector ) ) {
|
213 |
-
return rootjQuery.ready( selector );
|
214 |
-
}
|
215 |
-
|
216 |
-
if ( selector.selector !== undefined ) {
|
217 |
-
this.selector = selector.selector;
|
218 |
-
this.context = selector.context;
|
219 |
-
}
|
220 |
-
|
221 |
-
return jQuery.makeArray( selector, this );
|
222 |
-
},
|
223 |
-
|
224 |
-
// Start with an empty selector
|
225 |
-
selector: "",
|
226 |
-
|
227 |
-
// The default length of a jQuery object is 0
|
228 |
-
length: 0,
|
229 |
-
|
230 |
-
// The number of elements contained in the matched element set
|
231 |
-
size: function() {
|
232 |
-
return this.length;
|
233 |
-
},
|
234 |
-
|
235 |
-
toArray: function() {
|
236 |
-
return core_slice.call( this );
|
237 |
-
},
|
238 |
-
|
239 |
-
// Get the Nth element in the matched element set OR
|
240 |
-
// Get the whole matched element set as a clean array
|
241 |
-
get: function( num ) {
|
242 |
-
return num == null ?
|
243 |
-
|
244 |
-
// Return a 'clean' array
|
245 |
-
this.toArray() :
|
246 |
-
|
247 |
-
// Return just the object
|
248 |
-
( num < 0 ? this[ this.length + num ] : this[ num ] );
|
249 |
-
},
|
250 |
-
|
251 |
-
// Take an array of elements and push it onto the stack
|
252 |
-
// (returning the new matched element set)
|
253 |
-
pushStack: function( elems ) {
|
254 |
-
|
255 |
-
// Build a new jQuery matched element set
|
256 |
-
var ret = jQuery.merge( this.constructor(), elems );
|
257 |
-
|
258 |
-
// Add the old object onto the stack (as a reference)
|
259 |
-
ret.prevObject = this;
|
260 |
-
ret.context = this.context;
|
261 |
-
|
262 |
-
// Return the newly-formed element set
|
263 |
-
return ret;
|
264 |
-
},
|
265 |
-
|
266 |
-
// Execute a callback for every element in the matched set.
|
267 |
-
// (You can seed the arguments with an array of args, but this is
|
268 |
-
// only used internally.)
|
269 |
-
each: function( callback, args ) {
|
270 |
-
return jQuery.each( this, callback, args );
|
271 |
-
},
|
272 |
-
|
273 |
-
ready: function( fn ) {
|
274 |
-
// Add the callback
|
275 |
-
jQuery.ready.promise().done( fn );
|
276 |
-
|
277 |
-
return this;
|
278 |
-
},
|
279 |
-
|
280 |
-
slice: function() {
|
281 |
-
return this.pushStack( core_slice.apply( this, arguments ) );
|
282 |
-
},
|
283 |
-
|
284 |
-
first: function() {
|
285 |
-
return this.eq( 0 );
|
286 |
-
},
|
287 |
-
|
288 |
-
last: function() {
|
289 |
-
return this.eq( -1 );
|
290 |
-
},
|
291 |
-
|
292 |
-
eq: function( i ) {
|
293 |
-
var len = this.length,
|
294 |
-
j = +i + ( i < 0 ? len : 0 );
|
295 |
-
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
|
296 |
-
},
|
297 |
-
|
298 |
-
map: function( callback ) {
|
299 |
-
return this.pushStack( jQuery.map(this, function( elem, i ) {
|
300 |
-
return callback.call( elem, i, elem );
|
301 |
-
}));
|
302 |
-
},
|
303 |
-
|
304 |
-
end: function() {
|
305 |
-
return this.prevObject || this.constructor(null);
|
306 |
-
},
|
307 |
-
|
308 |
-
// For internal use only.
|
309 |
-
// Behaves like an Array's method, not like a jQuery method.
|
310 |
-
push: core_push,
|
311 |
-
sort: [].sort,
|
312 |
-
splice: [].splice
|
313 |
-
};
|
314 |
-
|
315 |
-
// Give the init function the jQuery prototype for later instantiation
|
316 |
-
jQuery.fn.init.prototype = jQuery.fn;
|
317 |
-
|
318 |
-
jQuery.extend = jQuery.fn.extend = function() {
|
319 |
-
var src, copyIsArray, copy, name, options, clone,
|
320 |
-
target = arguments[0] || {},
|
321 |
-
i = 1,
|
322 |
-
length = arguments.length,
|
323 |
-
deep = false;
|
324 |
-
|
325 |
-
// Handle a deep copy situation
|
326 |
-
if ( typeof target === "boolean" ) {
|
327 |
-
deep = target;
|
328 |
-
target = arguments[1] || {};
|
329 |
-
// skip the boolean and the target
|
330 |
-
i = 2;
|
331 |
-
}
|
332 |
-
|
333 |
-
// Handle case when target is a string or something (possible in deep copy)
|
334 |
-
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
|
335 |
-
target = {};
|
336 |
-
}
|
337 |
-
|
338 |
-
// extend jQuery itself if only one argument is passed
|
339 |
-
if ( length === i ) {
|
340 |
-
target = this;
|
341 |
-
--i;
|
342 |
-
}
|
343 |
-
|
344 |
-
for ( ; i < length; i++ ) {
|
345 |
-
// Only deal with non-null/undefined values
|
346 |
-
if ( (options = arguments[ i ]) != null ) {
|
347 |
-
// Extend the base object
|
348 |
-
for ( name in options ) {
|
349 |
-
src = target[ name ];
|
350 |
-
copy = options[ name ];
|
351 |
-
|
352 |
-
// Prevent never-ending loop
|
353 |
-
if ( target === copy ) {
|
354 |
-
continue;
|
355 |
-
}
|
356 |
-
|
357 |
-
// Recurse if we're merging plain objects or arrays
|
358 |
-
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
|
359 |
-
if ( copyIsArray ) {
|
360 |
-
copyIsArray = false;
|
361 |
-
clone = src && jQuery.isArray(src) ? src : [];
|
362 |
-
|
363 |
-
} else {
|
364 |
-
clone = src && jQuery.isPlainObject(src) ? src : {};
|
365 |
-
}
|
366 |
-
|
367 |
-
// Never move original objects, clone them
|
368 |
-
target[ name ] = jQuery.extend( deep, clone, copy );
|
369 |
-
|
370 |
-
// Don't bring in undefined values
|
371 |
-
} else if ( copy !== undefined ) {
|
372 |
-
target[ name ] = copy;
|
373 |
-
}
|
374 |
-
}
|
375 |
-
}
|
376 |
-
}
|
377 |
-
|
378 |
-
// Return the modified object
|
379 |
-
return target;
|
380 |
-
};
|
381 |
-
|
382 |
-
jQuery.extend({
|
383 |
-
noConflict: function( deep ) {
|
384 |
-
if ( window.$ === jQuery ) {
|
385 |
-
window.$ = _$;
|
386 |
-
}
|
387 |
-
|
388 |
-
if ( deep && window.jQuery === jQuery ) {
|
389 |
-
window.jQuery = _jQuery;
|
390 |
-
}
|
391 |
-
|
392 |
-
return jQuery;
|
393 |
-
},
|
394 |
-
|
395 |
-
// Is the DOM ready to be used? Set to true once it occurs.
|
396 |
-
isReady: false,
|
397 |
-
|
398 |
-
// A counter to track how many items to wait for before
|
399 |
-
// the ready event fires. See #6781
|
400 |
-
readyWait: 1,
|
401 |
-
|
402 |
-
// Hold (or release) the ready event
|
403 |
-
holdReady: function( hold ) {
|
404 |
-
if ( hold ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|