Version Notes
This is a stable version.
Download this release
Release Info
| Developer | pureimagination |
| Extension | PI_Oopsprofile |
| Version | 0.2.0 |
| Comparing to | |
| See all releases | |
Version 0.2.0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile.php +46 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit.php +68 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Form.php +58 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Tab/General.php +228 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Tab/Profilefilter.php +28 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Tab/Profiletemplate.php +12 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Tab/Profileway.php +13 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Tab/Run.php +56 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Tabs.php +64 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Grid.php +151 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/Renderer/Parsetype.php +20 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/Renderer/Way.php +24 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/Run.php +200 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/System/Config/Cron/Schedule.php +190 -0
- app/code/community/PI/Oopsprofile/Block/Adminhtml/System/Convert/Gui/Grid.php +67 -0
- app/code/community/PI/Oopsprofile/Block/Rule/Conditions.php +46 -0
- app/code/community/PI/Oopsprofile/Helper/Data.php +185 -0
- app/code/community/PI/Oopsprofile/Helper/Mail.php +63 -0
- app/code/community/PI/Oopsprofile/Helper/Table.php +255 -0
- app/code/community/PI/Oopsprofile/Model/Convert/Adapter/Api.php +71 -0
- app/code/community/PI/Oopsprofile/Model/Convert/Adapter/Http.php +73 -0
- app/code/community/PI/Oopsprofile/Model/Convert/Adapter/Io.php +434 -0
- app/code/community/PI/Oopsprofile/Model/Convert/Adapter/Mail.php +279 -0
- app/code/community/PI/Oopsprofile/Model/Convert/Parser/Csv.php +206 -0
- app/code/community/PI/Oopsprofile/Model/Convert/Parser/Txt.php +6 -0
- app/code/community/PI/Oopsprofile/Model/Createapiobserver.php +89 -0
- app/code/community/PI/Oopsprofile/Model/CronObserver.php +310 -0
- app/code/community/PI/Oopsprofile/Model/Customergroup/Convert/Adapter/Customergroup.php +103 -0
- app/code/community/PI/Oopsprofile/Model/Customergroup/Convert/Parser/Customergroup.php +47 -0
- app/code/community/PI/Oopsprofile/Model/Dataflow/Batch/Io.php +22 -0
- app/code/community/PI/Oopsprofile/Model/Dataflow/Convert/Mapper/Column.php +114 -0
- app/code/community/PI/Oopsprofile/Model/Dataflow/Profile.php +783 -0
- app/code/community/PI/Oopsprofile/Model/Dataflow/Profile/History.php +28 -0
- app/code/community/PI/Oopsprofile/Model/Mail.php +54 -0
- app/code/community/PI/Oopsprofile/Model/Mysql4/Oopsprofile.php +10 -0
- app/code/community/PI/Oopsprofile/Model/Mysql4/Oopsprofile/Collection.php +10 -0
- app/code/community/PI/Oopsprofile/Model/Oopsprofile.php +26 -0
- app/code/community/PI/Oopsprofile/Model/Oopsprofileapi.php +167 -0
- app/code/community/PI/Oopsprofile/Model/Product/Convert/Adapter/Product.php +2168 -0
- app/code/community/PI/Oopsprofile/Model/Product/Convert/Parser/Product.php +864 -0
- app/code/community/PI/Oopsprofile/Model/Rule.php +62 -0
- app/code/community/PI/Oopsprofile/Model/Rule/Condition/Combine.php +34 -0
- app/code/community/PI/Oopsprofile/Model/Rule/Condition/Product.php +17 -0
- app/code/community/PI/Oopsprofile/Model/Varien/Io/Sftp.php +15 -0
- app/code/community/PI/Oopsprofile/controllers/Adminhtml/OopsprofileController.php +550 -0
- app/code/community/PI/Oopsprofile/controllers/ApiController.php +214 -0
- app/code/community/PI/Oopsprofile/controllers/OopsprofileController.php +88 -0
- app/code/community/PI/Oopsprofile/etc/adminhtml.xml +35 -0
- app/code/community/PI/Oopsprofile/etc/config.xml +162 -0
- app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-install-0.1.0.php +16 -0
- app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.0-0.1.1.php +17 -0
- app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.1-0.1.2.php +21 -0
- app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.2-0.1.3.php +15 -0
- app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.3-0.1.4.php +17 -0
- app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.4-0.1.5.php +13 -0
- app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.5-0.1.6.php +19 -0
- app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.6-0.1.7.php +17 -0
- app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.7-0.1.8.php +20 -0
- app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.8-0.1.9.php +15 -0
- app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.9-0.2.0.php +15 -0
- app/design/adminhtml/default/default/layout/oopsprofile.xml +47 -0
- app/design/adminhtml/default/default/template/oopsprofile/general.phtml +417 -0
- app/design/adminhtml/default/default/template/oopsprofile/process.phtml +206 -0
- app/design/adminhtml/default/default/template/oopsprofile/profilefilter.phtml +156 -0
- app/design/adminhtml/default/default/template/oopsprofile/profiletemplate.phtml +127 -0
- app/design/adminhtml/default/default/template/oopsprofile/profileway.phtml +91 -0
- app/design/adminhtml/default/default/template/oopsprofile/run.phtml +60 -0
- app/etc/modules/PI_Oopsprofile.xml +9 -0
- package.xml +20 -0
- skin/adminhtml/default/default/oopsprofile/css/jquery-ui-1.8.12.custom.css +578 -0
- skin/adminhtml/default/default/oopsprofile/css/jquery.checkboxtree.css +12 -0
- skin/adminhtml/default/default/oopsprofile/css/oopsprofile.css +33 -0
- skin/adminhtml/default/default/oopsprofile/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- skin/adminhtml/default/default/oopsprofile/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- skin/adminhtml/default/default/oopsprofile/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- skin/adminhtml/default/default/oopsprofile/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- skin/adminhtml/default/default/oopsprofile/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- skin/adminhtml/default/default/oopsprofile/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- skin/adminhtml/default/default/oopsprofile/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- skin/adminhtml/default/default/oopsprofile/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- skin/adminhtml/default/default/oopsprofile/images/ui-icons_222222_256x240.png +0 -0
- skin/adminhtml/default/default/oopsprofile/images/ui-icons_2e83ff_256x240.png +0 -0
- skin/adminhtml/default/default/oopsprofile/images/ui-icons_454545_256x240.png +0 -0
- skin/adminhtml/default/default/oopsprofile/images/ui-icons_888888_256x240.png +0 -0
- skin/adminhtml/default/default/oopsprofile/images/ui-icons_cd0a0a_256x240.png +0 -0
- skin/adminhtml/default/default/oopsprofile/js/jquery-1.4.4.js +7180 -0
- skin/adminhtml/default/default/oopsprofile/js/jquery-ui-1.8.12.custom.min.js +783 -0
- skin/adminhtml/default/default/oopsprofile/js/jquery.checkboxtree.js +628 -0
app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile.php
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Adminhtml
|
| 23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Adminhtml convert profiles list block
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Adminhtml
|
| 32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
+
*/
|
| 34 |
+
|
| 35 |
+
class PI_Oopsprofile_Block_Adminhtml_Oopsprofile extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 36 |
+
{
|
| 37 |
+
public function __construct()
|
| 38 |
+
{
|
| 39 |
+
$this->_controller = 'adminhtml_oopsprofile';
|
| 40 |
+
$this->_blockGroup = 'oopsprofile';
|
| 41 |
+
$this->_headerText = Mage::helper('adminhtml')->__('Profiles');
|
| 42 |
+
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add New Profile');
|
| 43 |
+
|
| 44 |
+
parent::__construct();
|
| 45 |
+
}
|
| 46 |
+
}
|
app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit.php
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Adminhtml
|
| 23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Convert profile edit block
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Adminhtml
|
| 32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
+
*/
|
| 34 |
+
class PI_Oopsprofile_Block_Adminhtml_Oopsprofile_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
| 35 |
+
{
|
| 36 |
+
public function __construct()
|
| 37 |
+
{
|
| 38 |
+
$this->_objectId = 'id';
|
| 39 |
+
$this->_controller = 'adminhtml_oopsprofile';
|
| 40 |
+
$this->_blockGroup = 'oopsprofile';
|
| 41 |
+
|
| 42 |
+
parent::__construct();
|
| 43 |
+
|
| 44 |
+
$this->_updateButton('save', 'label', Mage::helper('adminhtml')->__('Save Profile'));
|
| 45 |
+
$this->_updateButton('delete', 'label', Mage::helper('adminhtml')->__('Delete Profile'));
|
| 46 |
+
$this->_addButton('savecontinue', array(
|
| 47 |
+
'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
|
| 48 |
+
'onclick' => "$('edit_form').action += 'continue/true/'; editForm.submit();",
|
| 49 |
+
'class' => 'save',
|
| 50 |
+
), -100);
|
| 51 |
+
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
public function getProfileId()
|
| 55 |
+
{
|
| 56 |
+
return Mage::registry('current_convert_profile')->getId();
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
public function getHeaderText()
|
| 60 |
+
{
|
| 61 |
+
if (Mage::registry('current_convert_profile')->getId()) {
|
| 62 |
+
return $this->escapeHtml(Mage::registry('current_convert_profile')->getName());
|
| 63 |
+
}
|
| 64 |
+
else {
|
| 65 |
+
return Mage::helper('adminhtml')->__('New Profile');
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
}
|
app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Form.php
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Adminhtml
|
| 23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Adminhtml convert profile edit form block
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Adminhtml
|
| 32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
+
*/
|
| 34 |
+
|
| 35 |
+
class PI_Oopsprofile_Block_Adminhtml_Oopsprofile_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 36 |
+
{
|
| 37 |
+
protected function _prepareForm()
|
| 38 |
+
{
|
| 39 |
+
$form = new Varien_Data_Form(array('id' => 'edit_form',
|
| 40 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
| 41 |
+
'method' => 'post',
|
| 42 |
+
'enctype' => 'multipart/form-data')
|
| 43 |
+
);
|
| 44 |
+
|
| 45 |
+
$model = Mage::registry('current_convert_profile');
|
| 46 |
+
|
| 47 |
+
if ($model->getId()) {
|
| 48 |
+
$form->addField('profile_id', 'hidden', array(
|
| 49 |
+
'name' => 'profile_id',
|
| 50 |
+
));
|
| 51 |
+
$form->setValues($model->getData());
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
$form->setUseContainer(true);
|
| 55 |
+
$this->setForm($form);
|
| 56 |
+
return parent::_prepareForm();
|
| 57 |
+
}
|
| 58 |
+
}
|
app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Tab/General.php
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|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
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Oopsprofile_Block_Adminhtml_Oopsprofile_Edit_Tab_General extends Mage_Adminhtml_Block_Widget_Container
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
protected $_storeModel;
|
| 6 |
+
protected $_attributes;
|
| 7 |
+
protected $_addMapButtonHtml;
|
| 8 |
+
protected $_removeMapButtonHtml;
|
| 9 |
+
protected $_shortDateFormat;
|
| 10 |
+
|
| 11 |
+
public function __construct()
|
| 12 |
+
{
|
| 13 |
+
parent::__construct();
|
| 14 |
+
$this->setTemplate('oopsprofile/general.phtml');
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
protected function _prepareLayout()
|
| 18 |
+
{
|
| 19 |
+
if ($head = $this->getLayout()->getBlock('head')) {
|
| 20 |
+
$head->setCanLoadCalendarJs(true);
|
| 21 |
+
}
|
| 22 |
+
return $this;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
public function getOopsSelected($key, $value)
|
| 26 |
+
{
|
| 27 |
+
return $this->getOopsData($key)==$value ? 'selected="selected"' : '';
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
public function getOopsData($key)
|
| 31 |
+
{
|
| 32 |
+
$oopsData = Mage::registry('current_convert_oopsprofile');
|
| 33 |
+
return $oopsData[$key];
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
public function getAttributes($entityType)
|
| 37 |
+
{
|
| 38 |
+
if (!isset($this->_attributes[$entityType])) {
|
| 39 |
+
switch ($entityType) {
|
| 40 |
+
case 'product':
|
| 41 |
+
$attributes = Mage::getSingleton('catalog/convert_parser_product')
|
| 42 |
+
->getExternalAttributes();
|
| 43 |
+
break;
|
| 44 |
+
|
| 45 |
+
case 'customer':
|
| 46 |
+
$attributes = Mage::getSingleton('customer/convert_parser_customer')
|
| 47 |
+
->getExternalAttributes();
|
| 48 |
+
break;
|
| 49 |
+
case 'order':
|
| 50 |
+
$attributes = Mage::helper('oopsprofile/table')->getOrderFields();
|
| 51 |
+
break;
|
| 52 |
+
case 'invoice':
|
| 53 |
+
$attributes = Mage::helper('oopsprofile/table')->getInvoiceFields();
|
| 54 |
+
break;
|
| 55 |
+
case 'shipment':
|
| 56 |
+
$attributes = Mage::helper('oopsprofile/table')->getShipmentFields();
|
| 57 |
+
break;
|
| 58 |
+
case 'creditmemo':
|
| 59 |
+
$attributes = Mage::helper('oopsprofile/table')->getCreditmemoFields();
|
| 60 |
+
break;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
array_splice($attributes, 0, 0, array(''=>$this->__('Choose an attribute')));
|
| 64 |
+
$this->_attributes[$entityType] = $attributes;
|
| 65 |
+
}
|
| 66 |
+
return $this->_attributes[$entityType];
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
public function getValue($key, $default='', $defaultNew = null)
|
| 70 |
+
{
|
| 71 |
+
if (null !== $defaultNew) {
|
| 72 |
+
if (0 == $this->getProfileId()) {
|
| 73 |
+
$default = $defaultNew;
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
$value = $this->getData($key);
|
| 78 |
+
return $this->escapeHtml(strlen($value) > 0 ? $value : $default);
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
public function getSelected($key, $value)
|
| 82 |
+
{
|
| 83 |
+
return $this->getData($key)==$value ? 'selected="selected"' : '';
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
public function getChecked($key)
|
| 87 |
+
{
|
| 88 |
+
return $this->getData($key) ? 'checked="checked"' : '';
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
public function getMappings($entityType)
|
| 92 |
+
{
|
| 93 |
+
$maps = $this->getData('gui_data/map/'.$entityType.'/db');
|
| 94 |
+
return $maps ? $maps : array();
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
public function getAddMapButtonHtml()
|
| 98 |
+
{
|
| 99 |
+
if (!$this->_addMapButtonHtml) {
|
| 100 |
+
$this->_addMapButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')
|
| 101 |
+
->setClass('add')->setLabel($this->__('Add Field Mapping'))
|
| 102 |
+
->setOnClick("addFieldMapping()")->toHtml();
|
| 103 |
+
}
|
| 104 |
+
return $this->_addMapButtonHtml;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
public function getRemoveMapButtonHtml()
|
| 108 |
+
{
|
| 109 |
+
if (!$this->_removeMapButtonHtml) {
|
| 110 |
+
$this->_removeMapButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')
|
| 111 |
+
->setClass('delete')->setLabel($this->__('Remove'))
|
| 112 |
+
->setOnClick("removeFieldMapping(this)")->toHtml();
|
| 113 |
+
}
|
| 114 |
+
return $this->_removeMapButtonHtml;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
public function getProductTypeFilterOptions()
|
| 118 |
+
{
|
| 119 |
+
$options = Mage::getSingleton('catalog/product_type')->getOptionArray();
|
| 120 |
+
array_splice($options, 0, 0, array(''=>$this->__('Any Type')));
|
| 121 |
+
return $options;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
public function getProductAttributeSetFilterOptions()
|
| 125 |
+
{
|
| 126 |
+
$options = Mage::getResourceModel('eav/entity_attribute_set_collection')
|
| 127 |
+
->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
|
| 128 |
+
->load()
|
| 129 |
+
->toOptionHash();
|
| 130 |
+
|
| 131 |
+
$opt = array();
|
| 132 |
+
$opt = array(''=>$this->__('Any Attribute Set'));
|
| 133 |
+
if ($options) foreach($options as $index => $value) {
|
| 134 |
+
$opt[$index] = $value;
|
| 135 |
+
}
|
| 136 |
+
//array_slice($options, 0, 0, array(''=>$this->__('Any Attribute Set')));
|
| 137 |
+
return $opt;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
public function getProductVisibilityFilterOptions()
|
| 141 |
+
{
|
| 142 |
+
$options = Mage::getSingleton('catalog/product_visibility')->getOptionArray();
|
| 143 |
+
|
| 144 |
+
array_splice($options, 0, 0, array(''=>$this->__('Any Visibility')));
|
| 145 |
+
return $options;
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
public function getProductStatusFilterOptions()
|
| 149 |
+
{
|
| 150 |
+
$options = Mage::getSingleton('catalog/product_status')->getOptionArray();
|
| 151 |
+
|
| 152 |
+
array_splice($options, 0, 0, array(''=>$this->__('Any Status')));
|
| 153 |
+
return $options;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
public function getStoreFilterOptions()
|
| 157 |
+
{
|
| 158 |
+
if (!$this->_filterStores) {
|
| 159 |
+
#$this->_filterStores = array(''=>$this->__('Any Store'));
|
| 160 |
+
$this->_filterStores = array();
|
| 161 |
+
foreach (Mage::getConfig()->getNode('stores')->children() as $storeNode) {
|
| 162 |
+
if ($storeNode->getName()==='default') {
|
| 163 |
+
//continue;
|
| 164 |
+
}
|
| 165 |
+
$this->_filterStores[$storeNode->getName()] = (string)$storeNode->system->store->name;
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
return $this->_filterStores;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
public function getCustomerGroupFilterOptions()
|
| 172 |
+
{
|
| 173 |
+
$options = Mage::getResourceModel('customer/group_collection')
|
| 174 |
+
->addFieldToFilter('customer_group_id', array('gt'=>0))
|
| 175 |
+
->load()
|
| 176 |
+
->toOptionHash();
|
| 177 |
+
|
| 178 |
+
array_splice($options, 0, 0, array(''=>$this->__('Any Group')));
|
| 179 |
+
return $options;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
public function getCountryFilterOptions()
|
| 183 |
+
{
|
| 184 |
+
$options = Mage::getResourceModel('directory/country_collection')
|
| 185 |
+
->load()->toOptionArray(false);
|
| 186 |
+
array_unshift($options, array('value'=>'', 'label'=>Mage::helper('adminhtml')->__('All countries')));
|
| 187 |
+
return $options;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
/**
|
| 191 |
+
* Retrieve system store model
|
| 192 |
+
*
|
| 193 |
+
* @return Mage_Adminhtml_Model_System_Store
|
| 194 |
+
*/
|
| 195 |
+
protected function _getStoreModel() {
|
| 196 |
+
if (is_null($this->_storeModel)) {
|
| 197 |
+
$this->_storeModel = Mage::getSingleton('adminhtml/system_store');
|
| 198 |
+
}
|
| 199 |
+
return $this->_storeModel;
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
public function getWebsiteCollection()
|
| 203 |
+
{
|
| 204 |
+
return $this->_getStoreModel()->getWebsiteCollection();
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
public function getGroupCollection()
|
| 208 |
+
{
|
| 209 |
+
return $this->_getStoreModel()->getGroupCollection();
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
public function getStoreCollection()
|
| 213 |
+
{
|
| 214 |
+
return $this->_getStoreModel()->getStoreCollection();
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
public function getShortDateFormat()
|
| 218 |
+
{
|
| 219 |
+
if (!$this->_shortDateFormat) {
|
| 220 |
+
$this->_shortDateFormat = Mage::app()->getLocale()->getDateStrFormat(
|
| 221 |
+
Mage_Core_Model_Locale::FORMAT_TYPE_SHORT
|
| 222 |
+
);
|
| 223 |
+
}
|
| 224 |
+
return $this->_shortDateFormat;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
}
|
| 228 |
+
|
app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Tab/Profilefilter.php
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Oopsprofile_Block_Adminhtml_Oopsprofile_Edit_Tab_Profilefilter extends PI_Oopsprofile_Block_Adminhtml_Oopsprofile_Edit_Tab_General
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
public function __construct()
|
| 6 |
+
{
|
| 7 |
+
parent::__construct();
|
| 8 |
+
$this->setTemplate('oopsprofile/profilefilter.phtml');
|
| 9 |
+
$this->setData(Mage::registry('current_convert_profile')->getData());
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
public function getMultipleSelect($data,$value)
|
| 13 |
+
{
|
| 14 |
+
$selected = $this->getData($data);
|
| 15 |
+
if(!empty($selected))
|
| 16 |
+
{
|
| 17 |
+
if (in_array($value, $selected, true)) {
|
| 18 |
+
return 'selected="selected"';
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
else
|
| 22 |
+
{
|
| 23 |
+
return '';
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
return '';
|
| 27 |
+
}
|
| 28 |
+
}
|
app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Tab/Profiletemplate.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Oopsprofile_Block_Adminhtml_Oopsprofile_Edit_Tab_Profiletemplate extends PI_Oopsprofile_Block_Adminhtml_Oopsprofile_Edit_Tab_General
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
public function __construct()
|
| 6 |
+
{
|
| 7 |
+
parent::__construct();
|
| 8 |
+
$this->setTemplate('oopsprofile/profiletemplate.phtml');
|
| 9 |
+
$this->setData(Mage::registry('current_convert_profile')->getData());
|
| 10 |
+
}
|
| 11 |
+
}
|
| 12 |
+
|
app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Tab/Profileway.php
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Block_Adminhtml_Oopsprofile_Edit_Tab_Profileway extends PI_Oopsprofile_Block_Adminhtml_Oopsprofile_Edit_Tab_General
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
public function __construct()
|
| 7 |
+
{
|
| 8 |
+
parent::__construct();
|
| 9 |
+
$this->setTemplate('oopsprofile/profileway.phtml');
|
| 10 |
+
$this->setData(Mage::registry('current_convert_profile')->getData());
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
+
|
app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Tab/Run.php
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Block_Adminhtml_Oopsprofile_Edit_Tab_Run extends Mage_Adminhtml_Block_Template
|
| 4 |
+
{
|
| 5 |
+
public function __construct()
|
| 6 |
+
{
|
| 7 |
+
parent::__construct();
|
| 8 |
+
$this->setTemplate('oopsprofile/run.phtml');
|
| 9 |
+
$this->setData(Mage::registry('current_convert_profile')->getData());
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
public function getRunButtonHtml()
|
| 13 |
+
{
|
| 14 |
+
$html = '';
|
| 15 |
+
|
| 16 |
+
$html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')
|
| 17 |
+
->setClass('save')->setLabel($this->__('Run Profile in Popup'))
|
| 18 |
+
->setOnClick('runProfile(true)')
|
| 19 |
+
->toHtml();
|
| 20 |
+
|
| 21 |
+
return $html;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
public function getProfileId()
|
| 25 |
+
{
|
| 26 |
+
return Mage::registry('current_convert_profile')->getId();
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
public function getImportedFiles()
|
| 30 |
+
{
|
| 31 |
+
$files = array();
|
| 32 |
+
$path = Mage::app()->getConfig()->getTempVarDir().'/import';
|
| 33 |
+
if (!is_readable($path)) {
|
| 34 |
+
return $files;
|
| 35 |
+
}
|
| 36 |
+
$dir = dir($path);
|
| 37 |
+
while (false !== ($entry = $dir->read())) {
|
| 38 |
+
if($entry != '.'
|
| 39 |
+
&& $entry != '..'
|
| 40 |
+
&& in_array(strtolower(substr($entry, strrpos($entry, '.')+1)), array($this->getParseType())))
|
| 41 |
+
{
|
| 42 |
+
$files[] = $entry;
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
sort($files);
|
| 46 |
+
$dir->close();
|
| 47 |
+
return $files;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
public function getParseType()
|
| 51 |
+
{
|
| 52 |
+
$data = Mage::registry('current_convert_profile')->getGuiData();
|
| 53 |
+
if ($data)
|
| 54 |
+
return $data['parse']['type'];
|
| 55 |
+
}
|
| 56 |
+
}
|
app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Edit/Tabs.php
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Block_Adminhtml_Oopsprofile_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
| 4 |
+
{
|
| 5 |
+
public function __construct()
|
| 6 |
+
{
|
| 7 |
+
parent::__construct();
|
| 8 |
+
$this->setId('convert_profile_tabs');
|
| 9 |
+
$this->setDestElementId('edit_form');
|
| 10 |
+
$this->setTitle(Mage::helper('adminhtml')->__('Import/Export Profile'));
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
protected function _beforeToHtml()
|
| 14 |
+
{
|
| 15 |
+
$profile = Mage::registry('current_convert_profile');
|
| 16 |
+
|
| 17 |
+
$wizardBlock = $this->getLayout()->createBlock('oopsprofile/adminhtml_oopsprofile_edit_tab_general');
|
| 18 |
+
$wizardBlock->addData($profile->getData());
|
| 19 |
+
|
| 20 |
+
$new = !$profile->getId();
|
| 21 |
+
|
| 22 |
+
$this->addTab('wizard', array(
|
| 23 |
+
'label' => Mage::helper('adminhtml')->__('General Information'),
|
| 24 |
+
'content' => $wizardBlock->toHtml(),
|
| 25 |
+
'active' => true,
|
| 26 |
+
));
|
| 27 |
+
|
| 28 |
+
$this->addTab('profileway', array(
|
| 29 |
+
'label' => Mage::helper('adminhtml')->__('Import/Export Way'),
|
| 30 |
+
'content' => $this->getLayout()->createBlock('oopsprofile/adminhtml_oopsprofile_edit_tab_profileway')->toHtml(),
|
| 31 |
+
));
|
| 32 |
+
|
| 33 |
+
$this->addTab('profiletemplate', array(
|
| 34 |
+
'label' => Mage::helper('adminhtml')->__('Format and Fields'),
|
| 35 |
+
'content' => $this->getLayout()->createBlock('oopsprofile/adminhtml_oopsprofile_edit_tab_profiletemplate')->toHtml(),
|
| 36 |
+
));
|
| 37 |
+
|
| 38 |
+
$this->addTab('profilefilter', array(
|
| 39 |
+
'label' => Mage::helper('adminhtml')->__('Apply Filters'),
|
| 40 |
+
'content' => $this->getLayout()->createBlock('oopsprofile/adminhtml_oopsprofile_edit_tab_profilefilter')->toHtml(),
|
| 41 |
+
));
|
| 42 |
+
|
| 43 |
+
if (!$new) {
|
| 44 |
+
|
| 45 |
+
$this->addTab('view', array(
|
| 46 |
+
'label' => Mage::helper('adminhtml')->__('Profile Actions XML'),
|
| 47 |
+
'content' => $this->getLayout()->createBlock('adminhtml/system_convert_gui_edit_tab_view')->initForm()->toHtml(),
|
| 48 |
+
));
|
| 49 |
+
|
| 50 |
+
$this->addTab('run', array(
|
| 51 |
+
'label' => Mage::helper('adminhtml')->__('Run Profile'),
|
| 52 |
+
'content' => $this->getLayout()->createBlock('oopsprofile/adminhtml_oopsprofile_edit_tab_run')->toHtml(),
|
| 53 |
+
));
|
| 54 |
+
|
| 55 |
+
$this->addTab('history', array(
|
| 56 |
+
'label' => Mage::helper('adminhtml')->__('Profile History'),
|
| 57 |
+
'content' => $this->getLayout()->createBlock('adminhtml/system_convert_profile_edit_tab_history')->toHtml(),
|
| 58 |
+
));
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
return parent::_beforeToHtml();
|
| 63 |
+
}
|
| 64 |
+
}
|
app/code/community/PI/Oopsprofile/Block/Adminhtml/Oopsprofile/Grid.php
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
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
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Adminhtml
|
| 23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Convert profiles grid
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Adminhtml
|
| 32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
+
*/
|
| 34 |
+
class PI_Oopsprofile_Block_Adminhtml_Oopsprofile_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 35 |
+
{
|
| 36 |
+
|
| 37 |
+
public function __construct()
|
| 38 |
+
{
|
| 39 |
+
parent::__construct();
|
| 40 |
+
$this->setId('convertProfileGrid');
|
| 41 |
+
$this->setDefaultSort('oops_profile_id');
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
protected function _prepareCollection()
|
| 45 |
+
{
|
| 46 |
+
/*$collection = Mage::getResourceModel('dataflow/profile_collection')
|
| 47 |
+
->addFieldToFilter('entity_type', array('notnull'=>''));*/
|
| 48 |
+
|
| 49 |
+
$resource = Mage::getSingleton('core/resource');
|
| 50 |
+
$dataflowTable = $resource->getTableName('dataflow_profile');
|
| 51 |
+
|
| 52 |
+
$collection = Mage::getResourceModel('oopsprofile/oopsprofile_collection');
|
| 53 |
+
$collection->getSelect()->joinLeft( array('dataflow'=>$dataflowTable),
|
| 54 |
+
'main_table.dataflow_profile_id = dataflow.profile_id');
|
| 55 |
+
|
| 56 |
+
//echo '<pre>';print_r($collection->getData());exit;
|
| 57 |
+
|
| 58 |
+
$this->setCollection($collection);
|
| 59 |
+
|
| 60 |
+
return parent::_prepareCollection();
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
protected function _prepareColumns()
|
| 64 |
+
{
|
| 65 |
+
$entityArray = array('product'=>'Products', 'customer'=>'Customers','customergroup'=>'Customer Group','order'=>'Order','shipment'=>'Shipment','invoice'=>'Invoice','creditmemo'=>'Creditmemo');
|
| 66 |
+
|
| 67 |
+
$this->addColumn('oops_profile_id', array(
|
| 68 |
+
'header' => Mage::helper('adminhtml')->__('ID'),
|
| 69 |
+
'width' => '50px',
|
| 70 |
+
'index' => 'oops_profile_id',
|
| 71 |
+
));
|
| 72 |
+
$this->addColumn('name', array(
|
| 73 |
+
'header' => Mage::helper('adminhtml')->__('Profile Name'),
|
| 74 |
+
'index' => 'name',
|
| 75 |
+
));
|
| 76 |
+
$this->addColumn('direction', array(
|
| 77 |
+
'header' => Mage::helper('adminhtml')->__('Profile Direction'),
|
| 78 |
+
'index' => 'direction',
|
| 79 |
+
'type' => 'options',
|
| 80 |
+
'options' => array('import'=>'Import', 'export'=>'Export'),
|
| 81 |
+
'width' => '120px',
|
| 82 |
+
));
|
| 83 |
+
$this->addColumn('entity_type', array(
|
| 84 |
+
'header' => Mage::helper('adminhtml')->__('Entity Type'),
|
| 85 |
+
'index' => 'entity_type',
|
| 86 |
+
'type' => 'options',
|
| 87 |
+
'options' => $entityArray,
|
| 88 |
+
'width' => '120px',
|
| 89 |
+
));
|
| 90 |
+
|
| 91 |
+
/*$this->addColumn('store_id', array(
|
| 92 |
+
'header' => Mage::helper('adminhtml')->__('Store'),
|
| 93 |
+
'type' => 'options',
|
| 94 |
+
'align' => 'center',
|
| 95 |
+
'index' => 'store_id',
|
| 96 |
+
'type' => 'store',
|
| 97 |
+
'width' => '200px',
|
| 98 |
+
));*/
|
| 99 |
+
|
| 100 |
+
$this->addColumn('data_transfer', array(
|
| 101 |
+
'header' => Mage::helper('adminhtml')->__('Profile Way'),
|
| 102 |
+
'index' => 'data_transfer',
|
| 103 |
+
'width' => '120px',
|
| 104 |
+
'renderer' => new PI_Oopsprofile_Block_Adminhtml_Renderer_Way,
|
| 105 |
+
));
|
| 106 |
+
|
| 107 |
+
$this->addColumn('parse_type', array(
|
| 108 |
+
'header' => Mage::helper('adminhtml')->__('Data Format Type'),
|
| 109 |
+
'index' => 'oops_profile_id',
|
| 110 |
+
'width' => '120px',
|
| 111 |
+
'renderer' => new PI_Oopsprofile_Block_Adminhtml_Renderer_Parsetype,
|
| 112 |
+
));
|
| 113 |
+
|
| 114 |
+
$this->addColumn('created_at', array(
|
| 115 |
+
'header' => Mage::helper('adminhtml')->__('Created At'),
|
| 116 |
+
'type' => 'datetime',
|
| 117 |
+
'align' => 'center',
|
| 118 |
+
'index' => 'created_at',
|
| 119 |
+
));
|
| 120 |
+
$this->addColumn('updated_at', array(
|
| 121 |
+
'header' => Mage::helper('adminhtml')->__('Updated At'),
|
| 122 |
+
'type' => 'datetime',
|
| 123 |
+
'align' => 'center',
|
| 124 |
+
'index' => 'updated_at',
|
| 125 |
+
));
|
| 126 |
+
|
| 127 |
+
$this->addColumn('action', array(
|
| 128 |
+
'header' => Mage::helper('adminhtml')->__('Action'),
|
| 129 |
+
'width' => '60px',
|
| 130 |
+
'align' => 'center',
|
| 131 |
+
'sortable' => false,
|
| 132 |
+
'filter' => false,
|
| 133 |
+
'type' => 'action',
|
| 134 |
+
'actions' => array(
|
| 135 |
+
array(
|
| 136 |
+
'url' => $this->getUrl('*/*/edit') . 'id/$profile_id',
|
| 137 |
+
'caption' => Mage::helper('adminhtml')->__('Edit')
|
| 138 |
+
)
|
| 139 |
+
)
|
| 140 |
+
));
|
| 141 |
+
|
| 142 |
+
return parent::_prepareColumns();
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
public function getRowUrl($row)
|
| 146 |
+
{
|
| 147 |
+
return $this->getUrl('*/*/edit', array('id'=>$row->getDataflowProfileId()));
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
}
|
| 151 |
+
|
app/code/community/PI/Oopsprofile/Block/Adminhtml/Renderer/Parsetype.php
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Oopsprofile_Block_Adminhtml_Renderer_Parsetype extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
| 3 |
+
{
|
| 4 |
+
public function render(Varien_Object $row)
|
| 5 |
+
{
|
| 6 |
+
//print_r($row->getData($this->getColumn()->getIndex()));
|
| 7 |
+
$data = $row->getData($this->getColumn()->getIndex());
|
| 8 |
+
|
| 9 |
+
if($data == "")
|
| 10 |
+
{
|
| 11 |
+
return "";
|
| 12 |
+
}
|
| 13 |
+
else
|
| 14 |
+
{
|
| 15 |
+
$guidData = unserialize($row->getGuiData());
|
| 16 |
+
return $guidData['parse']['type'];
|
| 17 |
+
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
}
|
app/code/community/PI/Oopsprofile/Block/Adminhtml/Renderer/Way.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Oopsprofile_Block_Adminhtml_Renderer_Way extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
| 3 |
+
{
|
| 4 |
+
public function render(Varien_Object $row)
|
| 5 |
+
{
|
| 6 |
+
//print_r($row->getData($this->getColumn()->getIndex()));
|
| 7 |
+
$data = $row->getData($this->getColumn()->getIndex());
|
| 8 |
+
|
| 9 |
+
if($data == "")
|
| 10 |
+
{
|
| 11 |
+
return "";
|
| 12 |
+
}
|
| 13 |
+
else
|
| 14 |
+
{
|
| 15 |
+
$dataTransfer = $row->getDataTransfer();
|
| 16 |
+
if($row->getDataTransfer() == 'file')
|
| 17 |
+
{
|
| 18 |
+
$guidData = unserialize($row->getGuiData());
|
| 19 |
+
return $guidData['file']['type'];
|
| 20 |
+
}
|
| 21 |
+
return $row->getDataTransfer();
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
}
|
app/code/community/PI/Oopsprofile/Block/Adminhtml/Run.php
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
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|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Adminhtml
|
| 23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Convert profiles run block
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Adminhtml
|
| 32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
+
*/
|
| 34 |
+
class PI_Oopsprofile_Block_Adminhtml_Run extends Mage_Adminhtml_Block_Abstract
|
| 35 |
+
{
|
| 36 |
+
/**
|
| 37 |
+
* Flag for batch model
|
| 38 |
+
* @var boolean
|
| 39 |
+
*/
|
| 40 |
+
protected $_batchModelPrepared = false;
|
| 41 |
+
/**
|
| 42 |
+
* Batch model instance
|
| 43 |
+
* @var Mage_Dataflow_Model_Batch
|
| 44 |
+
*/
|
| 45 |
+
protected $_batchModel = null;
|
| 46 |
+
/**
|
| 47 |
+
* Preparing batch model (initialization)
|
| 48 |
+
* @return Mage_Adminhtml_Block_System_Convert_Profile_Run
|
| 49 |
+
*/
|
| 50 |
+
protected function _prepareBatchModel()
|
| 51 |
+
{
|
| 52 |
+
if ($this->_batchModelPrepared) {
|
| 53 |
+
return $this;
|
| 54 |
+
}
|
| 55 |
+
$this->setShowFinished(true);
|
| 56 |
+
$batchModel = Mage::getSingleton('dataflow/batch');
|
| 57 |
+
$this->_batchModel = $batchModel;
|
| 58 |
+
if ($batchModel->getId()) {
|
| 59 |
+
if ($batchModel->getAdapter()) {
|
| 60 |
+
$this->setBatchModelHasAdapter(true);
|
| 61 |
+
$numberOfRecords = $this->getProfile()->getData('gui_data/import/number_of_records');
|
| 62 |
+
if (!$numberOfRecords) {
|
| 63 |
+
$batchParams = $batchModel->getParams();
|
| 64 |
+
$numberOfRecords = isset($batchParams['number_of_records']) ? $batchParams['number_of_records'] : 1;
|
| 65 |
+
}
|
| 66 |
+
$this->setNumberOfRecords($numberOfRecords);
|
| 67 |
+
$this->setShowFinished(false);
|
| 68 |
+
$batchImportModel = $batchModel->getBatchImportModel();
|
| 69 |
+
$importIds = $batchImportModel->getIdCollection();
|
| 70 |
+
$this->setBatchItemsCount(count($importIds));
|
| 71 |
+
$this->setBatchConfig(
|
| 72 |
+
array(
|
| 73 |
+
'styles' => array(
|
| 74 |
+
'error' => array(
|
| 75 |
+
'icon' => Mage::getDesign()->getSkinUrl('images/error_msg_icon.gif'),
|
| 76 |
+
'bg' => '#FDD'
|
| 77 |
+
),
|
| 78 |
+
'message' => array(
|
| 79 |
+
'icon' => Mage::getDesign()->getSkinUrl('images/fam_bullet_success.gif'),
|
| 80 |
+
'bg' => '#DDF'
|
| 81 |
+
),
|
| 82 |
+
'loader' => Mage::getDesign()->getSkinUrl('images/ajax-loader.gif')
|
| 83 |
+
),
|
| 84 |
+
'template' => '<li style="#{style}" id="#{id}">'
|
| 85 |
+
. '<img id="#{id}_img" src="#{image}" class="v-middle" style="margin-right:5px"/>'
|
| 86 |
+
. '<span id="#{id}_status" class="text">#{text}</span>'
|
| 87 |
+
. '</li>',
|
| 88 |
+
'text' => $this->__('Processed <strong>%s%% %s/%d</strong> records', '#{percent}', '#{updated}', $this->getBatchItemsCount()),
|
| 89 |
+
'successText' => $this->__('Imported <strong>%s</strong> records', '#{updated}')
|
| 90 |
+
)
|
| 91 |
+
);
|
| 92 |
+
$jsonIds = array_chunk($importIds, $numberOfRecords);
|
| 93 |
+
$importData = array();
|
| 94 |
+
foreach ($jsonIds as $part => $ids) {
|
| 95 |
+
$importData[] = array(
|
| 96 |
+
'batch_id' => $batchModel->getId(),
|
| 97 |
+
'rows[]' => $ids
|
| 98 |
+
);
|
| 99 |
+
}
|
| 100 |
+
$this->setImportData($importData);
|
| 101 |
+
} else {
|
| 102 |
+
$this->setBatchModelHasAdapter(false);
|
| 103 |
+
$batchModel->delete();
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
$this->_batchModelPrepared = true;
|
| 107 |
+
return $this;
|
| 108 |
+
}
|
| 109 |
+
/**
|
| 110 |
+
* Return a batch model instance
|
| 111 |
+
* @return Mage_Dataflow_Model_Batch
|
| 112 |
+
*/
|
| 113 |
+
protected function _getBatchModel()
|
| 114 |
+
{
|
| 115 |
+
return $this->_batchModel;
|
| 116 |
+
}
|
| 117 |
+
/**
|
| 118 |
+
* Return a batch model config JSON
|
| 119 |
+
* @return string
|
| 120 |
+
*/
|
| 121 |
+
public function getBatchConfigJson()
|
| 122 |
+
{
|
| 123 |
+
return Mage::helper('core')->jsonEncode(
|
| 124 |
+
$this->getBatchConfig()
|
| 125 |
+
);
|
| 126 |
+
}
|
| 127 |
+
/**
|
| 128 |
+
* Encoding to JSON
|
| 129 |
+
* @param string $source
|
| 130 |
+
* @return string JSON
|
| 131 |
+
*/
|
| 132 |
+
public function jsonEncode($source)
|
| 133 |
+
{
|
| 134 |
+
return Mage::helper('core')->jsonEncode($source);
|
| 135 |
+
}
|
| 136 |
+
/**
|
| 137 |
+
* Get a profile
|
| 138 |
+
* @return object
|
| 139 |
+
*/
|
| 140 |
+
public function getProfile()
|
| 141 |
+
{
|
| 142 |
+
return Mage::registry('current_convert_profile');
|
| 143 |
+
}
|
| 144 |
+
/**
|
| 145 |
+
* Generating form key
|
| 146 |
+
* @return string
|
| 147 |
+
*/
|
| 148 |
+
public function getFormKey()
|
| 149 |
+
{
|
| 150 |
+
return Mage::getSingleton('core/session')->getFormKey();
|
| 151 |
+
}
|
| 152 |
+
/**
|
| 153 |
+
* Return batch model and initialize it if need
|
| 154 |
+
* @return Mage_Dataflow_Model_Batch
|
| 155 |
+
*/
|
| 156 |
+
public function getBatchModel()
|
| 157 |
+
{
|
| 158 |
+
return $this->_prepareBatchModel()
|
| 159 |
+
->_getBatchModel();
|
| 160 |
+
}
|
| 161 |
+
/**
|
| 162 |
+
* Generating exceptions data
|
| 163 |
+
* @return array
|
| 164 |
+
*/
|
| 165 |
+
public function getExceptions()
|
| 166 |
+
{
|
| 167 |
+
if (!is_null(parent::getExceptions()))
|
| 168 |
+
return parent::getExceptions();
|
| 169 |
+
$exceptions = array();
|
| 170 |
+
$this->getProfile()->run();
|
| 171 |
+
foreach ($this->getProfile()->getExceptions() as $e) {
|
| 172 |
+
switch ($e->getLevel()) {
|
| 173 |
+
case Varien_Convert_Exception::FATAL:
|
| 174 |
+
$img = 'error_msg_icon.gif';
|
| 175 |
+
$liStyle = 'background-color:#FBB; ';
|
| 176 |
+
break;
|
| 177 |
+
case Varien_Convert_Exception::ERROR:
|
| 178 |
+
$img = 'error_msg_icon.gif';
|
| 179 |
+
$liStyle = 'background-color:#FDD; ';
|
| 180 |
+
break;
|
| 181 |
+
case Varien_Convert_Exception::WARNING:
|
| 182 |
+
$img = 'fam_bullet_error.gif';
|
| 183 |
+
$liStyle = 'background-color:#FFD; ';
|
| 184 |
+
break;
|
| 185 |
+
case Varien_Convert_Exception::NOTICE:
|
| 186 |
+
$img = 'fam_bullet_success.gif';
|
| 187 |
+
$liStyle = 'background-color:#DDF; ';
|
| 188 |
+
break;
|
| 189 |
+
}
|
| 190 |
+
$exceptions[] = array(
|
| 191 |
+
"style" => $liStyle,
|
| 192 |
+
"src" => Mage::getDesign()->getSkinUrl('images/'.$img),
|
| 193 |
+
"message" => $e->getMessage(),
|
| 194 |
+
"position" => $e->getPosition()
|
| 195 |
+
);
|
| 196 |
+
}
|
| 197 |
+
parent::setExceptions($exceptions);
|
| 198 |
+
return $exceptions;
|
| 199 |
+
}
|
| 200 |
+
}
|
app/code/community/PI/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|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Block_Adminhtml_System_Config_Cron_Schedule extends Mage_Adminhtml_Block_Widget_Form{
|
| 4 |
+
|
| 5 |
+
protected function _prepareForm(){
|
| 6 |
+
|
| 7 |
+
$profile = Mage::registry('current_convert_profile');
|
| 8 |
+
$oopsprofile = Mage::registry('current_convert_oopsprofile');
|
| 9 |
+
|
| 10 |
+
$freqSource = Mage::getModel('adminhtml/system_config_source_cron_frequency');
|
| 11 |
+
$freqSourceOptions = $freqSource->toOptionArray();
|
| 12 |
+
array_unshift($freqSourceOptions, array(
|
| 13 |
+
'label' => Mage::helper('oopsprofile')->__('Please Select'),
|
| 14 |
+
'value' => ''
|
| 15 |
+
)
|
| 16 |
+
);
|
| 17 |
+
|
| 18 |
+
$cronExprKeyPath = 'crontab/jobs/oopsprofile_cron_' . $profile->getId() . '_schedule/cron_expr';
|
| 19 |
+
$cronModelKeyPath = 'crontab/jobs/oopsprofile_cron_' . $profile->getId() . '_run/model';
|
| 20 |
+
|
| 21 |
+
try {
|
| 22 |
+
$cronExprValue = Mage::getModel('core/config_data')->load($cronExprKeyPath, 'path');
|
| 23 |
+
$cronModelValue = Mage::getModel('core/config_data')->load($cronModelKeyPath, 'path');
|
| 24 |
+
|
| 25 |
+
}
|
| 26 |
+
catch (Exception $e) {
|
| 27 |
+
Mage::throwException(Mage::helper('adminhtml')->__('Cron expression no more exist in system for this profile'));
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
$form = new Varien_Data_Form();
|
| 31 |
+
|
| 32 |
+
$fieldset = $form->addFieldset('schedule_run', array('legend'=>Mage::helper('catalog')->__(' Cron Schedule')));
|
| 33 |
+
|
| 34 |
+
if(Mage::helper('oopsprofile/cron')->isHeartbeatCheckDisabled() == 0){
|
| 35 |
+
|
| 36 |
+
/***Check if master cron is configured**/
|
| 37 |
+
$heartbeatStatus = Mage::helper('oopsprofile/cron')->checkHeartbeat();
|
| 38 |
+
if(is_array($heartbeatStatus) && !empty($heartbeatStatus)){
|
| 39 |
+
|
| 40 |
+
if($heartbeatStatus['status'] == 0){
|
| 41 |
+
$cronStatusElement = $fieldset->addField('cron_heartbeat_status', 'textarea', array(
|
| 42 |
+
'label'=> 'Master Cron Status',
|
| 43 |
+
'readonly' => true,
|
| 44 |
+
'rows'=> 2,
|
| 45 |
+
'cols'=> 3,
|
| 46 |
+
'title'=> Mage::helper('oopsprofile')->__('Master Cron Status'),
|
| 47 |
+
'class'=> 'beating'
|
| 48 |
+
));
|
| 49 |
+
}else{
|
| 50 |
+
$cronStatusElement = $fieldset->addField('cron_heartbeat_status', 'textarea', array(
|
| 51 |
+
'label'=> 'Master Cron Status',
|
| 52 |
+
'title'=> Mage::helper('oopsprofile')->__('Master Cron Status'),
|
| 53 |
+
'class'=> 'dead',
|
| 54 |
+
'readonly' => true,
|
| 55 |
+
));
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
$oopsprofile->setData('cron_heartbeat_status', $heartbeatStatus['msg']);
|
| 59 |
+
}
|
| 60 |
+
/****Ends****/
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
$cronEnabledElement = $fieldset->addField('cron_enabled', 'select', array(
|
| 65 |
+
'label'=> Mage::helper('oopsprofile')->__('Enable Cron'),
|
| 66 |
+
'title'=> Mage::helper('oopsprofile')->__('Enable Cron'),
|
| 67 |
+
'name'=>'cron_enabled',
|
| 68 |
+
'values' => array(
|
| 69 |
+
0 => Mage::helper('oopsprofile')->__('No'),
|
| 70 |
+
1 => Mage::helper('oopsprofile')->__('Yes')
|
| 71 |
+
),
|
| 72 |
+
'onchange' => 'hideShowCronSchedule(this);',
|
| 73 |
+
));
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
$cronFrequencyElement = $fieldset->addField('cron_frequency', 'select', array(
|
| 78 |
+
'label' => Mage::helper('oopsprofile')->__('Cron Frequency'),
|
| 79 |
+
'title' => Mage::helper('oopsprofile')->__('Cron Frequency'),
|
| 80 |
+
'name' =>'cron_frequency',
|
| 81 |
+
'class' =>'cron_frequency',
|
| 82 |
+
'values'=> $freqSourceOptions
|
| 83 |
+
));
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
$timeElement = $fieldset->addField('cron_start_time', 'time', array(
|
| 87 |
+
'label'=> Mage::helper('oopsprofile')->__('Cron Start Time'),
|
| 88 |
+
'title'=> Mage::helper('oopsprofile')->__('Cron Start Time'),
|
| 89 |
+
'name'=>'cron_start_time',
|
| 90 |
+
'class'=>'cron_start_time'
|
| 91 |
+
));
|
| 92 |
+
|
| 93 |
+
$expertModeElement = $fieldset->addField('cron_expert_mode', 'checkbox', array(
|
| 94 |
+
'label'=> Mage::helper('oopsprofile')->__('Schedule in Expert Mode'),
|
| 95 |
+
'title'=> Mage::helper('oopsprofile')->__('Manually Enter Cron Expression'),
|
| 96 |
+
'name'=>'cron_expert_mode',
|
| 97 |
+
'class'=>'cron_expert_mode',
|
| 98 |
+
'onchange'=> 'hideShowCronExprField(this);',
|
| 99 |
+
'checked'=> $oopsprofile->getData('cron_expert_mode') ? true: false,
|
| 100 |
+
'note'=> Mage::helper('oopsprofile')->__('Manually Enter Cron Expression.'),
|
| 101 |
+
));
|
| 102 |
+
|
| 103 |
+
$oopsprofile->setData('cron_expert_mode', 1);
|
| 104 |
+
|
| 105 |
+
$cronExprElement = $fieldset->addField('cron_expression', 'text', array(
|
| 106 |
+
'label'=> Mage::helper('oopsprofile')->__('Cron Expression'),
|
| 107 |
+
'title'=> Mage::helper('oopsprofile')->__('Cron Expression'),
|
| 108 |
+
'name'=>'cron_expression',
|
| 109 |
+
'class'=>'cron_expression',
|
| 110 |
+
'note'=> Mage::helper('oopsprofile')->__('Ex. * 2 * * *(every night at 2pm) <strong>|</strong> Seperate characters by space. <strong>|</strong> Frequency must be enough to get the task completed.'),
|
| 111 |
+
));
|
| 112 |
+
|
| 113 |
+
if($oopsprofile->getData('cron_enabled')){
|
| 114 |
+
if($oopsprofile->getData('cron_expert_mode') != 1){
|
| 115 |
+
$cronFrequencyElement->setRequired(true);
|
| 116 |
+
$timeElement->setRequired(true);
|
| 117 |
+
}else{
|
| 118 |
+
$cronExprElement->setRequired(true);
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
$cronExprElement->setAfterElementHtml(
|
| 123 |
+
'<script type="text/javascript">'
|
| 124 |
+
. '//<![CDATA[
|
| 125 |
+
function hideShowCronExprField(element){
|
| 126 |
+
|
| 127 |
+
if (element.checked) {
|
| 128 |
+
$("cron_expression").up("tr").show();
|
| 129 |
+
$("cron_frequency").disabled = true;
|
| 130 |
+
$("cron_frequency").removeClassName("required-entry");
|
| 131 |
+
$("cron_expression").addClassName("required-entry");
|
| 132 |
+
$$(".cron_start_time").each(function(em){
|
| 133 |
+
em.disabled = true;
|
| 134 |
+
});
|
| 135 |
+
} else {
|
| 136 |
+
$("cron_expression").up("tr").hide();
|
| 137 |
+
$("cron_frequency").disabled = false;
|
| 138 |
+
if($("cron_enabled").value == 1){
|
| 139 |
+
console.log("required entry added");
|
| 140 |
+
$("cron_frequency").addClassName("required-entry");
|
| 141 |
+
}
|
| 142 |
+
$("cron_expression").removeClassName("required-entry");
|
| 143 |
+
$$(".cron_start_time").each(function(em){
|
| 144 |
+
em.disabled = false;
|
| 145 |
+
});
|
| 146 |
+
}
|
| 147 |
+
return true;
|
| 148 |
+
}'
|
| 149 |
+
|
| 150 |
+
. 'document.observe("dom:loaded", hideShowCronExprField($("cron_expert_mode")));'
|
| 151 |
+
. '//]]> '
|
| 152 |
+
. '</script>'
|
| 153 |
+
);
|
| 154 |
+
|
| 155 |
+
$timeElement->setAfterElementHtml(
|
| 156 |
+
'<script type="text/javascript">'
|
| 157 |
+
. '//<![CDATA[
|
| 158 |
+
function hideShowCronSchedule(element){
|
| 159 |
+
console.log(element.value);
|
| 160 |
+
if (element.value == 1) {
|
| 161 |
+
$("cron_frequency").up("tr").show();
|
| 162 |
+
$("cron_frequency").addClassName("required-entry");
|
| 163 |
+
$$(".cron_start_time").each(function(em){
|
| 164 |
+
em.up("tr").show();
|
| 165 |
+
//em.addClassName("required-entry");
|
| 166 |
+
});
|
| 167 |
+
|
| 168 |
+
} else {
|
| 169 |
+
$("cron_frequency").removeClassName("required-entry");
|
| 170 |
+
$("cron_frequency").up("tr").hide();
|
| 171 |
+
$$(".cron_start_time").each(function(em){
|
| 172 |
+
em.up("tr").hide();
|
| 173 |
+
//em.removeClassName("required-entry");
|
| 174 |
+
});
|
| 175 |
+
|
| 176 |
+
}
|
| 177 |
+
return true;
|
| 178 |
+
}'
|
| 179 |
+
|
| 180 |
+
. 'document.observe("dom:loaded", hideShowCronSchedule($("cron_enabled")));'
|
| 181 |
+
. '//]]> '
|
| 182 |
+
. '</script>'
|
| 183 |
+
);
|
| 184 |
+
|
| 185 |
+
$form->setValues($oopsprofile->getData());
|
| 186 |
+
$this->setForm($form);
|
| 187 |
+
|
| 188 |
+
return parent::_prepareForm();
|
| 189 |
+
}
|
| 190 |
+
}
|
app/code/community/PI/Oopsprofile/Block/Adminhtml/System/Convert/Gui/Grid.php
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Oopsprofile_Block_Adminhtml_System_Convert_Gui_Grid extends Mage_Adminhtml_Block_System_Convert_Gui_Grid
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
protected function _widgetprepareCollection()
|
| 6 |
+
{
|
| 7 |
+
if ($this->getCollection()) {
|
| 8 |
+
|
| 9 |
+
$this->_preparePage();
|
| 10 |
+
|
| 11 |
+
$columnId = $this->getParam($this->getVarNameSort(), $this->_defaultSort);
|
| 12 |
+
$dir = $this->getParam($this->getVarNameDir(), $this->_defaultDir);
|
| 13 |
+
$filter = $this->getParam($this->getVarNameFilter(), null);
|
| 14 |
+
|
| 15 |
+
if (is_null($filter)) {
|
| 16 |
+
$filter = $this->_defaultFilter;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
if (is_string($filter)) {
|
| 20 |
+
$data = $this->helper('adminhtml')->prepareFilterString($filter);
|
| 21 |
+
$this->_setFilterValues($data);
|
| 22 |
+
}
|
| 23 |
+
else if ($filter && is_array($filter)) {
|
| 24 |
+
$this->_setFilterValues($filter);
|
| 25 |
+
}
|
| 26 |
+
else if(0 !== sizeof($this->_defaultFilter)) {
|
| 27 |
+
$this->_setFilterValues($this->_defaultFilter);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
if (isset($this->_columns[$columnId]) && $this->_columns[$columnId]->getIndex()) {
|
| 31 |
+
$dir = (strtolower($dir)=='desc') ? 'desc' : 'asc';
|
| 32 |
+
$this->_columns[$columnId]->setDir($dir);
|
| 33 |
+
$this->_setCollectionOrder($this->_columns[$columnId]);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
if (!$this->_isExport) {
|
| 37 |
+
$this->getCollection()->load();
|
| 38 |
+
$this->_afterLoadCollection();
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
return $this;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
protected function _prepareCollection()
|
| 46 |
+
{
|
| 47 |
+
|
| 48 |
+
$resource = Mage::getSingleton('core/resource');
|
| 49 |
+
$oopsdataflowTable = $resource->getTableName('oopsprofile/oopsprofile');
|
| 50 |
+
|
| 51 |
+
$oopsProfileIds = Mage::getResourceModel('oopsprofile/oopsprofile_collection')->getData();
|
| 52 |
+
$ids = array();
|
| 53 |
+
foreach($oopsProfileIds as $oopsProfileId)
|
| 54 |
+
{
|
| 55 |
+
$ids[] = $oopsProfileId['dataflow_profile_id'];
|
| 56 |
+
}
|
| 57 |
+
//print_r($ids);exit;
|
| 58 |
+
|
| 59 |
+
$collection = Mage::getResourceModel('dataflow/profile_collection')
|
| 60 |
+
->addFieldToFilter('entity_type', array('notnull'=>''))
|
| 61 |
+
->addFieldToFilter('profile_id', array('nin'=>$ids));
|
| 62 |
+
|
| 63 |
+
$this->setCollection($collection);
|
| 64 |
+
|
| 65 |
+
return $this->_widgetprepareCollection();
|
| 66 |
+
}
|
| 67 |
+
}
|
app/code/community/PI/Oopsprofile/Block/Rule/Conditions.php
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Rule
|
| 23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class PI_Oopsprofile_Block_Rule_Conditions implements Varien_Data_Form_Element_Renderer_Interface
|
| 29 |
+
{
|
| 30 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 31 |
+
{
|
| 32 |
+
$ruleClass = get_class($element->getRule());
|
| 33 |
+
$RuleCombine = get_class(Mage::getModel('oopsprofile/rule_condition_combine'));
|
| 34 |
+
if($ruleClass === $RuleCombine)
|
| 35 |
+
{
|
| 36 |
+
$ruleModel = Mage::getModel('oopsprofile/rule');
|
| 37 |
+
|
| 38 |
+
return $ruleModel->getConditions()->asHtmlRecursive();
|
| 39 |
+
|
| 40 |
+
}
|
| 41 |
+
if ($element->getRule() && $element->getRule()->getConditions()) {
|
| 42 |
+
return $element->getRule()->getConditions()->asHtmlRecursive();
|
| 43 |
+
}
|
| 44 |
+
return '';
|
| 45 |
+
}
|
| 46 |
+
}
|
app/code/community/PI/Oopsprofile/Helper/Data.php
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
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â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Helper_Data extends Mage_Core_Helper_Abstract
|
| 4 |
+
{
|
| 5 |
+
/**Run Profile On the basis of profile id**/
|
| 6 |
+
public function RunOopsProfile($profileId)
|
| 7 |
+
{
|
| 8 |
+
|
| 9 |
+
if ($profileId) {
|
| 10 |
+
$profile = Mage::getModel('dataflow/profile')->load($profileId);
|
| 11 |
+
//$profile->load($profileId);
|
| 12 |
+
$id = $profile->getId();
|
| 13 |
+
if (empty($id))//if profile not exist
|
| 14 |
+
{
|
| 15 |
+
return;
|
| 16 |
+
}
|
| 17 |
+
else
|
| 18 |
+
{
|
| 19 |
+
$oopsprofile = Mage::getModel('oopsprofile/oopsprofile')
|
| 20 |
+
->getCollection()
|
| 21 |
+
->addFieldToFilter('profile_enable','1')
|
| 22 |
+
->addFieldToFilter('dataflow_profile_id',$id)
|
| 23 |
+
->getFirstItem();
|
| 24 |
+
$enable = $oopsprofile->getProfileEnable();
|
| 25 |
+
if($enable == 1)//if profile is disable
|
| 26 |
+
{
|
| 27 |
+
return;
|
| 28 |
+
}
|
| 29 |
+
else
|
| 30 |
+
{
|
| 31 |
+
Mage::register('current_convert_profile', $profile);
|
| 32 |
+
$profile->run();
|
| 33 |
+
Mage::unregister('current_convert_profile');
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
return;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
public function entityTypeArray()
|
| 42 |
+
{
|
| 43 |
+
$arr['product'] = 'Products';
|
| 44 |
+
$arr['customer'] = 'Customers';
|
| 45 |
+
return $arr;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
public function entityAttrTypeArray()
|
| 49 |
+
{
|
| 50 |
+
$arr = array( 'product',
|
| 51 |
+
'customer',
|
| 52 |
+
);
|
| 53 |
+
return $arr;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
public function wayTypeArray()
|
| 57 |
+
{
|
| 58 |
+
$arr['file'] = 'Local Server';
|
| 59 |
+
$arr['http'] = 'Http Server';
|
| 60 |
+
return $arr;
|
| 61 |
+
}
|
| 62 |
+
public function formatTypeArray()
|
| 63 |
+
{
|
| 64 |
+
|
| 65 |
+
$arr['csv'] = 'CSV';
|
| 66 |
+
$arr['txt'] = 'TXT';
|
| 67 |
+
|
| 68 |
+
return $arr;
|
| 69 |
+
}
|
| 70 |
+
public function delimiterTypeArray()
|
| 71 |
+
{
|
| 72 |
+
|
| 73 |
+
$arr[','] = 'Comma';
|
| 74 |
+
$arr['\t'] = 'Tab';
|
| 75 |
+
$arr[':'] = 'Colon';
|
| 76 |
+
$arr[' '] = 'Space';
|
| 77 |
+
$arr['|'] = 'Vertical Pipe';
|
| 78 |
+
$arr[';'] = 'Semicolon';
|
| 79 |
+
|
| 80 |
+
return $arr;
|
| 81 |
+
}
|
| 82 |
+
public function enclosureTypeArray()
|
| 83 |
+
{
|
| 84 |
+
|
| 85 |
+
$arr['"'] = '"';
|
| 86 |
+
$arr["'"] = "'";
|
| 87 |
+
|
| 88 |
+
return $arr;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
/**Fetch Product's attributes**/
|
| 92 |
+
public function getProductAttributeData()
|
| 93 |
+
{
|
| 94 |
+
$productAttrs = Mage::getResourceModel('catalog/product_attribute_collection')->getData();
|
| 95 |
+
foreach($productAttrs as $productAttr)
|
| 96 |
+
{
|
| 97 |
+
if($productAttr['frontend_label']!='')
|
| 98 |
+
{
|
| 99 |
+
$attr[$productAttr['attribute_code']] = $productAttr['frontend_label'];
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
$attr['url_path'] = 'Url Path';
|
| 103 |
+
return $attr;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
/**Fetch Product's stock fields**/
|
| 107 |
+
public function getStockFieldsArray()
|
| 108 |
+
{
|
| 109 |
+
$colData='';
|
| 110 |
+
$resource = Mage::getSingleton('core/resource');
|
| 111 |
+
$stockTable = $resource->getTableName('cataloginventory_stock_item');
|
| 112 |
+
$read = $resource->getConnection('core_read');
|
| 113 |
+
$query = 'show columns from '.$stockTable;
|
| 114 |
+
$fields = $read->fetchAll($query);
|
| 115 |
+
$unsetKeys = array(
|
| 116 |
+
'item_id',
|
| 117 |
+
'product_id',
|
| 118 |
+
'stock_id',
|
| 119 |
+
);
|
| 120 |
+
foreach($fields as $field)
|
| 121 |
+
{
|
| 122 |
+
$colName = $field['Field'];
|
| 123 |
+
$value = ucwords(implode(' ',explode('_',$colName)));
|
| 124 |
+
//$colData['inventory_'.$colName]=$value;
|
| 125 |
+
$colData[$colName]=$value;
|
| 126 |
+
if(in_array($colName,$unsetKeys))
|
| 127 |
+
{
|
| 128 |
+
unset($colData[$colName]);
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
return $colData;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
/**Fetch Dataflow profile id and name**/
|
| 138 |
+
public function getProfileArray()
|
| 139 |
+
{
|
| 140 |
+
|
| 141 |
+
$profileArray = array();
|
| 142 |
+
$OopsDataProfileIds = array();
|
| 143 |
+
|
| 144 |
+
$oopsProfiles = Mage::getModel('oopsprofile/oopsprofile')
|
| 145 |
+
->getCollection()
|
| 146 |
+
->setOrder('oops_profile_id');
|
| 147 |
+
|
| 148 |
+
$profileArray[0] = '--Select a profile--';
|
| 149 |
+
foreach($oopsProfiles as $oopsprofile)
|
| 150 |
+
{
|
| 151 |
+
$profile = '';
|
| 152 |
+
$OopsDataProfileIds = $oopsprofile->getDataflowProfileId();
|
| 153 |
+
$profile = Mage::getModel('dataflow/profile')->getCollection()
|
| 154 |
+
->addFieldToFilter('profile_id',$OopsDataProfileIds)
|
| 155 |
+
->addFieldToFilter('entity_type','product')
|
| 156 |
+
->getFirstItem();
|
| 157 |
+
if($profile->getId())
|
| 158 |
+
{
|
| 159 |
+
$profileArray[$profile->getId()] = $profile->getName();
|
| 160 |
+
}
|
| 161 |
+
else
|
| 162 |
+
{
|
| 163 |
+
continue;
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
return $profileArray;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
/**Fetch Category Mapping id and name**/
|
| 171 |
+
public function getMappingArray()
|
| 172 |
+
{
|
| 173 |
+
$mappings = Mage::getModel('oopsprofile/mapping')->getCollection();
|
| 174 |
+
|
| 175 |
+
$mappingArray = array();
|
| 176 |
+
|
| 177 |
+
$mappingArray[0] = '--Select a mapping--';
|
| 178 |
+
foreach($mappings as $mapping)
|
| 179 |
+
{
|
| 180 |
+
$mappingArray[$mapping->getId()] = $mapping->getCategoryMapName();
|
| 181 |
+
}
|
| 182 |
+
return $mappingArray;
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
}
|
app/code/community/PI/Oopsprofile/Helper/Mail.php
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Helper_Mail extends Mage_Core_Helper_Abstract {
|
| 4 |
+
|
| 5 |
+
protected function _saveAttachment($attachment, $path, $file) {
|
| 6 |
+
|
| 7 |
+
//try{
|
| 8 |
+
|
| 9 |
+
$io = new Varien_Io_File();
|
| 10 |
+
$io->setAllowCreateFolders(true);
|
| 11 |
+
$io->open(array('path' => $path));
|
| 12 |
+
$io->streamOpen($file, 'w+');
|
| 13 |
+
$io->streamLock(true);
|
| 14 |
+
|
| 15 |
+
if ($attachment['encoding'] == 'base64') {
|
| 16 |
+
$fileContent = base64_decode($attachment['content']);
|
| 17 |
+
} else {
|
| 18 |
+
$fileContent = $attachment['content'];
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
$io->streamWrite($fileContent);
|
| 22 |
+
$io->close();
|
| 23 |
+
//}catch(Exception $e){
|
| 24 |
+
//}
|
| 25 |
+
|
| 26 |
+
return $this;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
public function getFileNameWithPrefix($attachmentName) {
|
| 30 |
+
|
| 31 |
+
$storeId = Mage::app()->getStore()->getId();
|
| 32 |
+
//Get the timestamp
|
| 33 |
+
$filePrefix = 'oops_' . Mage::app()->getLocale()->storeTimeStamp($storeId);
|
| 34 |
+
|
| 35 |
+
return $filePrefix . '_' . $attachmentName;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/*
|
| 39 |
+
* Save attachments to var/attachments
|
| 40 |
+
*/
|
| 41 |
+
|
| 42 |
+
public function _saveAllAttachments($allAttachments, $path) {
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
$files = array();
|
| 46 |
+
if (substr($path, -1) != DS) {
|
| 47 |
+
$path .= DS;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
//$path = Mage::getBaseDir('var') . DS . 'import' . DS . 'attachments' . DS;
|
| 51 |
+
|
| 52 |
+
foreach ($allAttachments as $msgId => $attachments) {
|
| 53 |
+
foreach ($attachments as $attachment) {
|
| 54 |
+
$filename = $this->getFileNameWithPrefix($attachment['filename']);
|
| 55 |
+
$this->_saveAttachment($attachment, $path, $filename);
|
| 56 |
+
$files[] = $filename;
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
return $files;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
}
|
app/code/community/PI/Oopsprofile/Helper/Table.php
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|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Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Helper_Table extends Mage_Core_Helper_Abstract
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
//return column names of table
|
| 9 |
+
protected function getTableColumns($Table,$prefix = '')
|
| 10 |
+
{
|
| 11 |
+
$orderTable = Mage::getSingleton('core/resource')->getTableName($Table);
|
| 12 |
+
|
| 13 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
| 14 |
+
|
| 15 |
+
$columnsDeatil = $read->describeTable($orderTable);//column descriptions for a table
|
| 16 |
+
|
| 17 |
+
$columns = array_keys($columnsDeatil);//fetch array keys
|
| 18 |
+
|
| 19 |
+
if($prefix!='')
|
| 20 |
+
{
|
| 21 |
+
foreach($columns as $col)
|
| 22 |
+
{
|
| 23 |
+
$newcol[] = $prefix.$col;
|
| 24 |
+
}
|
| 25 |
+
$columns = $newcol;
|
| 26 |
+
}
|
| 27 |
+
$columns = array_combine($columns, $columns);//assign array values to its keys
|
| 28 |
+
|
| 29 |
+
return $columns;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
** Return order field names **
|
| 34 |
+
**/
|
| 35 |
+
public function getOrderFields()
|
| 36 |
+
{
|
| 37 |
+
|
| 38 |
+
//fetch columns from order table
|
| 39 |
+
$orderColumns = $this->getTableColumns('sales/order');
|
| 40 |
+
|
| 41 |
+
$unsetOrderKeys = array('protect_code',
|
| 42 |
+
'remote_ip',
|
| 43 |
+
'x_forwarded_for',
|
| 44 |
+
'edit_increment',
|
| 45 |
+
'email_sent',
|
| 46 |
+
'forced_shipment_with_incoice',
|
| 47 |
+
'payment_authorization_amount',
|
| 48 |
+
'payment_authorization_expiration',
|
| 49 |
+
'forced_do_shipment_with_invoice',
|
| 50 |
+
'base_shipping_hidden_tax_amount',
|
| 51 |
+
'store_name'
|
| 52 |
+
);
|
| 53 |
+
|
| 54 |
+
foreach($unsetOrderKeys as $unsetOrderKey)
|
| 55 |
+
{
|
| 56 |
+
unset($orderColumns[$unsetOrderKey]);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
//columns for billing and shipping address
|
| 60 |
+
|
| 61 |
+
$orderColumns['orderbilling_region_id'] = 'orderbilling_region_id';
|
| 62 |
+
$orderColumns['orderbilling_region'] = 'orderbilling_region';
|
| 63 |
+
$orderColumns['orderbilling_postcode'] = 'orderbilling_postcode';
|
| 64 |
+
$orderColumns['orderbilling_street'] = 'orderbilling_street';
|
| 65 |
+
$orderColumns['orderbilling_city'] = 'orderbilling_city';
|
| 66 |
+
$orderColumns['orderbilling_country_id'] = 'orderbilling_country_id';
|
| 67 |
+
$orderColumns['orderbilling_prefix'] = 'orderbilling_prefix';
|
| 68 |
+
$orderColumns['orderbilling_firstname'] = 'orderbilling_firstname';
|
| 69 |
+
$orderColumns['orderbilling_middlename'] = 'orderbilling_middlename';
|
| 70 |
+
$orderColumns['orderbilling_lastname'] = 'orderbilling_lastname';
|
| 71 |
+
$orderColumns['orderbilling_suffix'] = 'orderbilling_suffix';
|
| 72 |
+
$orderColumns['orderbilling_email'] = 'orderbilling_email';
|
| 73 |
+
$orderColumns['orderbilling_telephone'] = 'orderbilling_telephone';
|
| 74 |
+
|
| 75 |
+
$orderColumns['ordershipping_region_id'] = 'ordershipping_region_id';
|
| 76 |
+
$orderColumns['ordershipping_region'] = 'ordershipping_region';
|
| 77 |
+
$orderColumns['ordershipping_postcode'] = 'ordershipping_postcode';
|
| 78 |
+
$orderColumns['ordershipping_street'] = 'ordershipping_street';
|
| 79 |
+
$orderColumns['ordershipping_city'] = 'ordershipping_city';
|
| 80 |
+
$orderColumns['ordershipping_country_id'] = 'ordershipping_country_id';
|
| 81 |
+
$orderColumns['ordershipping_prefix'] = 'ordershipping_prefix';
|
| 82 |
+
$orderColumns['ordershipping_firstname'] = 'ordershipping_firstname';
|
| 83 |
+
$orderColumns['ordershipping_middlename'] = 'ordershipping_middlename';
|
| 84 |
+
$orderColumns['ordershipping_lastname'] = 'ordershipping_lastname';
|
| 85 |
+
$orderColumns['ordershipping_suffix'] = 'ordershipping_suffix';
|
| 86 |
+
$orderColumns['ordershipping_email'] = 'ordershipping_email';
|
| 87 |
+
$orderColumns['ordershipping_telephone'] = 'ordershipping_telephone';
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
//column for order payment
|
| 91 |
+
$orderColumns['orderpayment_method'] = 'orderpayment_method';
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
//column for comments
|
| 95 |
+
$orderColumns['comment_data'] = 'comment_data';
|
| 96 |
+
|
| 97 |
+
//fetch column for order items
|
| 98 |
+
$itemColumns = $this->getTableColumns('sales/order_item','orderitem_');
|
| 99 |
+
|
| 100 |
+
$unsetItemKeys = array('orderitem_item_id',
|
| 101 |
+
'orderitem_order_id',
|
| 102 |
+
'orderitem_store_id',
|
| 103 |
+
'orderitem_created_at',
|
| 104 |
+
'orderitem_updated_at',
|
| 105 |
+
'orderitem_applied_rule_ids',
|
| 106 |
+
'orderitem_additional_data',
|
| 107 |
+
'orderitem_is_virtual'
|
| 108 |
+
);
|
| 109 |
+
foreach($unsetItemKeys as $unsetItemKey)
|
| 110 |
+
{
|
| 111 |
+
unset($itemColumns[$unsetItemKey]);
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
$orderColumns = array_merge($orderColumns,$itemColumns);
|
| 115 |
+
|
| 116 |
+
return $orderColumns;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
/**
|
| 121 |
+
** Return Invoice field names **
|
| 122 |
+
**/
|
| 123 |
+
public function getInvoiceFields()
|
| 124 |
+
{
|
| 125 |
+
//fetch columns from invoice table
|
| 126 |
+
$invoiceColumns = $this->getTableColumns('sales/invoice');
|
| 127 |
+
|
| 128 |
+
foreach($invoiceColumns as $key=>$value)
|
| 129 |
+
{
|
| 130 |
+
if($key=='increment_id')
|
| 131 |
+
{
|
| 132 |
+
$invoiceColumns['invoice_increment_id']='invoice_increment_id';
|
| 133 |
+
unset($invoiceColumns['increment_id']);
|
| 134 |
+
break;
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
//column for comments
|
| 139 |
+
$invoiceColumns['comment_data'] = 'comment_data';
|
| 140 |
+
|
| 141 |
+
//column for grid data
|
| 142 |
+
$invoiceColumns['order_increment_id'] = 'order_increment_id';
|
| 143 |
+
$invoiceColumns['invoicegrid_order_created_at'] = 'invoicegrid_order_created_at';
|
| 144 |
+
$invoiceColumns['invoicegrid_billing_name'] = 'invoicegrid_billing_name';
|
| 145 |
+
|
| 146 |
+
//fetch columns for items
|
| 147 |
+
$itemColumns = $this->getTableColumns('sales/invoice_item','invoiceitem_');
|
| 148 |
+
|
| 149 |
+
$unsetItemKeys = array('invoiceitem_entity_id',
|
| 150 |
+
'invoiceitem_parent_id',
|
| 151 |
+
'invoiceitem_order_item_id'
|
| 152 |
+
);
|
| 153 |
+
|
| 154 |
+
foreach($unsetItemKeys as $unsetItemKey)
|
| 155 |
+
{
|
| 156 |
+
unset($itemColumns[$unsetItemKey]);
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
$invoiceColumns = array_merge($invoiceColumns,$itemColumns);
|
| 160 |
+
|
| 161 |
+
return $invoiceColumns;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
/**
|
| 165 |
+
** Return Shipment field names **
|
| 166 |
+
**/
|
| 167 |
+
public function getShipmentFields()
|
| 168 |
+
{
|
| 169 |
+
//fetch columns from shipment table
|
| 170 |
+
$shipmentColumns = $this->getTableColumns('sales/shipment');
|
| 171 |
+
|
| 172 |
+
foreach($shipmentColumns as $key=>$value)
|
| 173 |
+
{
|
| 174 |
+
if($key=='increment_id')
|
| 175 |
+
{
|
| 176 |
+
$shipmentColumns['shipment_increment_id']='shipment_increment_id';
|
| 177 |
+
unset($shipmentColumns['increment_id']);
|
| 178 |
+
break;
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
//column for comments
|
| 183 |
+
$shipmentColumns['comment_data'] = 'comment_data';
|
| 184 |
+
|
| 185 |
+
//column for track data
|
| 186 |
+
$shipmentColumns['track_data'] = 'track_data';
|
| 187 |
+
|
| 188 |
+
//column for grid data
|
| 189 |
+
$shipmentColumns['order_increment_id'] = 'order_increment_id';
|
| 190 |
+
$shipmentColumns['shipmentgrid_order_created_at'] = 'shipmentgrid_order_created_at';
|
| 191 |
+
$shipmentColumns['shipmentgrid_shipping_name'] = 'shipmentgrid_shipping_name';
|
| 192 |
+
|
| 193 |
+
//fetch columns for items
|
| 194 |
+
$itemColumns = $this->getTableColumns('sales/shipment_item','shipmentitem_');
|
| 195 |
+
|
| 196 |
+
$unsetItemKeys = array('shipmentitem_entity_id',
|
| 197 |
+
'shipmentitem_parent_id',
|
| 198 |
+
'shipmentitem_order_item_id'
|
| 199 |
+
);
|
| 200 |
+
|
| 201 |
+
foreach($unsetItemKeys as $unsetItemKey)
|
| 202 |
+
{
|
| 203 |
+
unset($itemColumns[$unsetItemKey]);
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
$shipmentColumns = array_merge($shipmentColumns,$itemColumns);
|
| 207 |
+
|
| 208 |
+
return $shipmentColumns;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
/**
|
| 213 |
+
** Return Creditmemo field names **
|
| 214 |
+
**/
|
| 215 |
+
public function getCreditmemoFields()
|
| 216 |
+
{
|
| 217 |
+
//fetch columns from creditmemo table
|
| 218 |
+
$creditmemoColumns = $this->getTableColumns('sales/creditmemo');
|
| 219 |
+
|
| 220 |
+
foreach($creditmemoColumns as $key=>$value)
|
| 221 |
+
{
|
| 222 |
+
if($key=='increment_id')
|
| 223 |
+
{
|
| 224 |
+
$creditmemoColumns['creditmemo_increment_id']='creditmemo_increment_id';
|
| 225 |
+
unset($creditmemoColumns['increment_id']);
|
| 226 |
+
break;
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
//column for comments
|
| 231 |
+
$creditmemoColumns['comment_data'] = 'comment_data';
|
| 232 |
+
|
| 233 |
+
//column for grid data
|
| 234 |
+
$creditmemoColumns['order_increment_id'] = 'order_increment_id';
|
| 235 |
+
$creditmemoColumns['creditmemogrid_order_created_at'] = 'creditmemogrid_order_created_at';
|
| 236 |
+
$creditmemoColumns['creditmemogrid_billing_name'] = 'creditmemogrid_billing_name';
|
| 237 |
+
|
| 238 |
+
//fetch columns for items
|
| 239 |
+
$itemColumns = $this->getTableColumns('sales/creditmemo_item','creditmemoitem_');
|
| 240 |
+
|
| 241 |
+
$unsetItemKeys = array('creditmemoitem_entity_id',
|
| 242 |
+
'creditmemoitem_parent_id',
|
| 243 |
+
'creditmemoitem_order_item_id'
|
| 244 |
+
);
|
| 245 |
+
|
| 246 |
+
foreach($unsetItemKeys as $unsetItemKey)
|
| 247 |
+
{
|
| 248 |
+
unset($itemColumns[$unsetItemKey]);
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
$creditmemoColumns = array_merge($creditmemoColumns,$itemColumns);
|
| 252 |
+
|
| 253 |
+
return $creditmemoColumns;
|
| 254 |
+
}
|
| 255 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Convert/Adapter/Api.php
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Convert_Adapter_Api extends Mage_Dataflow_Model_Convert_Adapter_Abstract
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* @return Varien_Io_File
|
| 8 |
+
*/
|
| 9 |
+
public function getResource($forWrite = false)
|
| 10 |
+
{
|
| 11 |
+
if (!$this->_resource) {
|
| 12 |
+
$className = 'Varien_Io_File';
|
| 13 |
+
|
| 14 |
+
$this->_resource = new $className();
|
| 15 |
+
|
| 16 |
+
}
|
| 17 |
+
return $this->_resource;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
public function load()
|
| 21 |
+
{
|
| 22 |
+
//$resultxml = $this->connecttoApi();
|
| 23 |
+
|
| 24 |
+
return $this;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
public function save()
|
| 28 |
+
{
|
| 29 |
+
if (!$this->getResource(true)) {
|
| 30 |
+
return $this;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
$fileformat = 'xml';
|
| 34 |
+
|
| 35 |
+
$batchModel = Mage::getSingleton('dataflow/batch');
|
| 36 |
+
|
| 37 |
+
$dataFile = $batchModel->getIoAdapter()->getFile(true);
|
| 38 |
+
|
| 39 |
+
$path = 'apiexport';
|
| 40 |
+
|
| 41 |
+
//create path if not exist
|
| 42 |
+
if (!file_exists($path)) {
|
| 43 |
+
mkdir($path, 0777, true);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
$profile = Mage::registry('current_convert_profile');//current profile
|
| 49 |
+
|
| 50 |
+
$oopsprofile = Mage::getModel('oopsprofile/oopsprofile')
|
| 51 |
+
->getCollection()
|
| 52 |
+
->addFieldToFilter('dataflow_profile_id',$profile->getId())
|
| 53 |
+
->getFirstItem();
|
| 54 |
+
|
| 55 |
+
$filename = $path.'/export_'.$this->getVar('entitytype').'_'.$oopsprofile->getId().'.'.$fileformat;
|
| 56 |
+
|
| 57 |
+
$result = $this->getResource()->write($filename, $dataFile, 0777);
|
| 58 |
+
|
| 59 |
+
if (false === $result) {
|
| 60 |
+
$message = Mage::helper('dataflow')->__('Could not save file: %s.', $filename);
|
| 61 |
+
Mage::throwException($message);
|
| 62 |
+
} else {
|
| 63 |
+
$message = Mage::helper('dataflow')->__('Saved successfully: "%s" [%d byte(s)].', $filename, $batchModel->getIoAdapter()->getFileSize());
|
| 64 |
+
if ($this->getVar('link')) {
|
| 65 |
+
$message .= Mage::helper('dataflow')->__('<a href="%s" target="_blank">Link</a>', $this->getVar('link'));
|
| 66 |
+
}
|
| 67 |
+
$this->addException($message);
|
| 68 |
+
}
|
| 69 |
+
return $this;
|
| 70 |
+
}
|
| 71 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Convert/Adapter/Http.php
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Convert_Adapter_Http extends Mage_Dataflow_Model_Convert_Adapter_Http
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* @return Varien_Io_File
|
| 8 |
+
*/
|
| 9 |
+
public function getResource($forWrite = false)
|
| 10 |
+
{
|
| 11 |
+
if (!$this->_resource) {
|
| 12 |
+
$className = 'Varien_Io_File';
|
| 13 |
+
|
| 14 |
+
$this->_resource = new $className();
|
| 15 |
+
|
| 16 |
+
}
|
| 17 |
+
return $this->_resource;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Save result to destination file from temporary
|
| 23 |
+
*
|
| 24 |
+
* @return PI_Oopsprofile_Model_Convert_Adapter_Io
|
| 25 |
+
*/
|
| 26 |
+
public function save()
|
| 27 |
+
{
|
| 28 |
+
if (!$this->getResource(true)) {
|
| 29 |
+
return $this;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
$fileformat = $this->getVar('fileformat');
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
/***
|
| 36 |
+
**** Code if format is xls or xlsx
|
| 37 |
+
***/
|
| 38 |
+
if($fileformat=='xls' || $fileformat=='xlsx')
|
| 39 |
+
{
|
| 40 |
+
return $this;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
$batchModel = Mage::getSingleton('dataflow/batch');
|
| 45 |
+
|
| 46 |
+
$dataFile = $batchModel->getIoAdapter()->getFile(true);
|
| 47 |
+
|
| 48 |
+
$path = 'httpexport';
|
| 49 |
+
|
| 50 |
+
//create path if not exist
|
| 51 |
+
if (!file_exists($path)) {
|
| 52 |
+
mkdir($path, 0777, true);
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
$profile = Mage::registry('current_convert_profile');//current profile
|
| 56 |
+
|
| 57 |
+
$filename = $path.'/export_'.$this->getVar('entitytype').'_'.$profile->getId().'.'.$fileformat;
|
| 58 |
+
|
| 59 |
+
$result = $this->getResource()->write($filename, $dataFile, 0777);
|
| 60 |
+
|
| 61 |
+
if (false === $result) {
|
| 62 |
+
$message = Mage::helper('dataflow')->__('Could not save file: %s.', $filename);
|
| 63 |
+
Mage::throwException($message);
|
| 64 |
+
} else {
|
| 65 |
+
$message = Mage::helper('dataflow')->__('Saved successfully: "%s" [%d byte(s)].', $filename, $batchModel->getIoAdapter()->getFileSize());
|
| 66 |
+
if ($this->getVar('link')) {
|
| 67 |
+
$message .= Mage::helper('dataflow')->__('<a href="%s" target="_blank">Link</a>', $this->getVar('link'));
|
| 68 |
+
}
|
| 69 |
+
$this->addException($message);
|
| 70 |
+
}
|
| 71 |
+
return $this;
|
| 72 |
+
}
|
| 73 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Convert/Adapter/Io.php
ADDED
|
@@ -0,0 +1,434 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
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
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Oopsprofile_Model_Convert_Adapter_Io extends Mage_Dataflow_Model_Convert_Adapter_Io
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* @return Varien_Io_Abstract or PI_Oopsprofile_Model_Varien_Io_sftp in case of sftp
|
| 8 |
+
*/
|
| 9 |
+
public function getResource($forWrite = false)
|
| 10 |
+
{
|
| 11 |
+
if (!$this->_resource) {
|
| 12 |
+
$type = $this->getVar('type', 'file');
|
| 13 |
+
$className = 'Varien_Io_' . ucwords($type);
|
| 14 |
+
if($this->getVar('type')=='sftp')
|
| 15 |
+
{
|
| 16 |
+
$className = 'PI_Oopsprofile_Model_Varien_Io_sftp';
|
| 17 |
+
}
|
| 18 |
+
$this->_resource = new $className();
|
| 19 |
+
|
| 20 |
+
$isError = false;
|
| 21 |
+
|
| 22 |
+
$ioConfig = $this->getVars();
|
| 23 |
+
switch ($this->getVar('type', 'file')) {
|
| 24 |
+
case 'file':
|
| 25 |
+
//validate export/import path
|
| 26 |
+
$path = rtrim($ioConfig['path'], '\\/')
|
| 27 |
+
. DS . $ioConfig['filename'];
|
| 28 |
+
/** @var $validator Mage_Core_Model_File_Validator_AvailablePath */
|
| 29 |
+
$validator = Mage::getModel('core/file_validator_availablePath');
|
| 30 |
+
$validator->setPaths( Mage::getStoreConfig(self::XML_PATH_EXPORT_LOCAL_VALID_PATH) );
|
| 31 |
+
if (!$validator->isValid($path)) {
|
| 32 |
+
foreach ($validator->getMessages() as $message) {
|
| 33 |
+
Mage::throwException($message);
|
| 34 |
+
return false;
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
if (preg_match('#^' . preg_quote(DS, '#').'#', $this->getVar('path')) ||
|
| 39 |
+
preg_match('#^[a-z]:' . preg_quote(DS, '#') . '#i', $this->getVar('path'))) {
|
| 40 |
+
|
| 41 |
+
$path = $this->_resource->getCleanPath($this->getVar('path'));
|
| 42 |
+
} else {
|
| 43 |
+
$baseDir = Mage::getBaseDir();
|
| 44 |
+
$path = $this->_resource->getCleanPath($baseDir . DS . trim($this->getVar('path'), DS));
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
$this->_resource->checkAndCreateFolder($path);
|
| 48 |
+
|
| 49 |
+
$realPath = realpath($path);
|
| 50 |
+
|
| 51 |
+
if (!$isError && $realPath === false) {
|
| 52 |
+
$message = Mage::helper('dataflow')->__('The destination folder "%s" does not exist or there is no access to create it.', $ioConfig['path']);
|
| 53 |
+
Mage::throwException($message);
|
| 54 |
+
} elseif (!$isError && !is_dir($realPath)) {
|
| 55 |
+
$message = Mage::helper('dataflow')->__('Destination folder "%s" is not a directory.', $realPath);
|
| 56 |
+
Mage::throwException($message);
|
| 57 |
+
} elseif (!$isError) {
|
| 58 |
+
if ($forWrite && !is_writeable($realPath)) {
|
| 59 |
+
$message = Mage::helper('dataflow')->__('Destination folder "%s" is not writable.', $realPath);
|
| 60 |
+
Mage::throwException($message);
|
| 61 |
+
} else {
|
| 62 |
+
$ioConfig['path'] = rtrim($realPath, DS);
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
break;
|
| 66 |
+
default:
|
| 67 |
+
$ioConfig['path'] = rtrim($this->getVar('path'), '/');
|
| 68 |
+
break;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
if ($isError) {
|
| 72 |
+
return false;
|
| 73 |
+
}
|
| 74 |
+
try {
|
| 75 |
+
$this->_resource->open($ioConfig);
|
| 76 |
+
} catch (Exception $e) {
|
| 77 |
+
$message = Mage::helper('dataflow')->__('An error occurred while opening file: "%s".', $e->getMessage());
|
| 78 |
+
Mage::throwException($message);
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
return $this->_resource;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
/**
|
| 85 |
+
* Load data
|
| 86 |
+
*
|
| 87 |
+
* @return PI_Oopsprofile_Model_Convert_Adapter_Io
|
| 88 |
+
*/
|
| 89 |
+
public function load()
|
| 90 |
+
{
|
| 91 |
+
if (!$this->getResource()) {
|
| 92 |
+
return $this;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
$result = '';
|
| 96 |
+
|
| 97 |
+
$filename = '';
|
| 98 |
+
$fileformat = $this->getVar('fileformat');
|
| 99 |
+
|
| 100 |
+
$batchModel = Mage::getSingleton('dataflow/batch');
|
| 101 |
+
$destFile = $batchModel->getIoAdapter()->getFile(true);
|
| 102 |
+
$filename = $this->getVar('filename');
|
| 103 |
+
|
| 104 |
+
if($this->getVar('path') && $fileformat=='xml')
|
| 105 |
+
{
|
| 106 |
+
$filename = $this->getVar('path').'/'.$filename;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
if($fileformat=='xml' || $fileformat=='xls' || $fileformat=='xlsx')
|
| 110 |
+
{
|
| 111 |
+
if($this->getVar('type')=='sftp')
|
| 112 |
+
{
|
| 113 |
+
$filename = $this->saveOnLocalFromSftp();//copy file from ftp to local server
|
| 114 |
+
}
|
| 115 |
+
else if($this->getVar('type')=='ftp')
|
| 116 |
+
{
|
| 117 |
+
$filename = $this->saveOnLocalFromFtp();//copy file from ftp to local server
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
else
|
| 121 |
+
{
|
| 122 |
+
|
| 123 |
+
if($this->getVar('path') && $this->getVar('type')=='sftp')
|
| 124 |
+
{
|
| 125 |
+
$filename = $this->getVar('path').'/'.$filename;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
$result = $this->getResource()->read($filename, $destFile);
|
| 129 |
+
|
| 130 |
+
$filename = $this->getResource()->pwd() . '/' . $this->getVar('filename');
|
| 131 |
+
|
| 132 |
+
if (false === $result) {
|
| 133 |
+
$message = Mage::helper('dataflow')->__('Could not load file: "%s".', $filename);
|
| 134 |
+
Mage::throwException($message);
|
| 135 |
+
} else {
|
| 136 |
+
$message = Mage::helper('dataflow')->__('Loaded successfully: "%s".', $filename);
|
| 137 |
+
$this->addException($message);
|
| 138 |
+
}
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
Mage::register('filename_with_path',$filename);// set file name with path
|
| 142 |
+
|
| 143 |
+
$this->setData($result);
|
| 144 |
+
return $this;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
/**
|
| 149 |
+
* Save result to destination file from temporary
|
| 150 |
+
*
|
| 151 |
+
* @return PI_Oopsprofile_Model_Convert_Adapter_Io
|
| 152 |
+
*/
|
| 153 |
+
public function save()
|
| 154 |
+
{
|
| 155 |
+
if (!$this->getResource(true)) {
|
| 156 |
+
return $this;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
$fileformat = $this->getVar('fileformat');
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
/***
|
| 163 |
+
**** Code if format is xls or xlsx
|
| 164 |
+
***/
|
| 165 |
+
if($fileformat=='xls' || $fileformat=='xlsx')
|
| 166 |
+
{
|
| 167 |
+
if($this->getVar('type')=='ftp')
|
| 168 |
+
{
|
| 169 |
+
$this->saveOnFtp();//copy local Excel file from temp folder(var/export/ftp) to remote server
|
| 170 |
+
}
|
| 171 |
+
if($this->getVar('type')=='sftp')
|
| 172 |
+
{
|
| 173 |
+
$file = 'var/export/ftp/export_file.'.$this->getVar('fileformat');//temp file path on local server
|
| 174 |
+
$remote_file = $this->getVar('filename');
|
| 175 |
+
if($this->getVar('path'))
|
| 176 |
+
{
|
| 177 |
+
$remote_file = $this->getVar('path').'/'.$remote_file;
|
| 178 |
+
}
|
| 179 |
+
$result = $this->getResource()->write($remote_file, $file);
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
return $this;
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
$batchModel = Mage::getSingleton('dataflow/batch');
|
| 187 |
+
|
| 188 |
+
$dataFile = $batchModel->getIoAdapter()->getFile(true);
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
$filename = $this->getVar('filename');
|
| 192 |
+
|
| 193 |
+
if($this->getVar('path') && $this->getVar('type')=='sftp')
|
| 194 |
+
{
|
| 195 |
+
$filename = $this->getVar('path').'/'.$filename;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
/**
|
| 201 |
+
* Save products separately in case of all formats except xls and xlsx
|
| 202 |
+
**/
|
| 203 |
+
$profileId = Mage::registry('current_convert_profile')->getId();
|
| 204 |
+
|
| 205 |
+
$entityType = Mage::registry('current_convert_profile')->getEntityType();
|
| 206 |
+
|
| 207 |
+
$oopprofile = Mage::getModel('oopsprofile/oopsprofile')->getCollection()
|
| 208 |
+
->addFieldToFilter('dataflow_profile_id',$profileId)
|
| 209 |
+
->getFirstItem();
|
| 210 |
+
|
| 211 |
+
$saveMultipleCopies = $oopprofile->getSaveProductsSeparately();
|
| 212 |
+
if($saveMultipleCopies==1 && $entityType=='product')//if "Save Products Separately" enable
|
| 213 |
+
{
|
| 214 |
+
$batchId = $batchModel->getId();
|
| 215 |
+
|
| 216 |
+
//$i = 1;
|
| 217 |
+
$fileName = $filename;
|
| 218 |
+
foreach(glob('var/tmp/batch_'.$batchId.'*.tmp') as $dataFileName)
|
| 219 |
+
{
|
| 220 |
+
$dFile1 = explode('.',$dataFileName);
|
| 221 |
+
$dFile2 = explode('_',$dFile1[0]);
|
| 222 |
+
$id = $dFile2[count($dFile2)-1];
|
| 223 |
+
|
| 224 |
+
$filename = '';
|
| 225 |
+
$explodedata = explode('.',$fileName);
|
| 226 |
+
$Name = $explodedata[0].'_'.$id;
|
| 227 |
+
$filename = $Name.'.'.$explodedata[1];
|
| 228 |
+
$result = $this->getResource()->write($filename, $dataFileName, 0777);
|
| 229 |
+
if (false === $result) {
|
| 230 |
+
$message = Mage::helper('dataflow')->__('Could not save file: %s.', $filename);
|
| 231 |
+
Mage::throwException($message);
|
| 232 |
+
} else {
|
| 233 |
+
|
| 234 |
+
/**
|
| 235 |
+
* Save Local copies in case of all formats except xls and xlsx
|
| 236 |
+
**/
|
| 237 |
+
$profileId = Mage::registry('current_convert_profile')->getId();
|
| 238 |
+
|
| 239 |
+
$oopprofile = Mage::getModel('oopsprofile/oopsprofile')->getCollection()
|
| 240 |
+
->addFieldToFilter('dataflow_profile_id',$profileId)
|
| 241 |
+
->getFirstItem();
|
| 242 |
+
|
| 243 |
+
$saveLocalCopies = $oopprofile->getSaveLocalCopy();
|
| 244 |
+
|
| 245 |
+
if($saveLocalCopies)//save if "save local copies" enable
|
| 246 |
+
{
|
| 247 |
+
$localpath = 'oopsprofile/'.$oopprofile->getId();
|
| 248 |
+
//create path if not exist
|
| 249 |
+
if (!file_exists($localpath)) {
|
| 250 |
+
mkdir($localpath, 0777, true);
|
| 251 |
+
}
|
| 252 |
+
$fileWithPath = $localpath.'/'.$filename;
|
| 253 |
+
|
| 254 |
+
$localResource = new Varien_Io_File();
|
| 255 |
+
|
| 256 |
+
$localResource->write($fileWithPath, $dataFileName, 0777);
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
$message = Mage::helper('dataflow')->__('Saved successfully: "%s" [%d byte(s)].', $filename, $batchModel->getIoAdapter()->getFileSize());
|
| 262 |
+
if ($this->getVar('link')) {
|
| 263 |
+
$message .= Mage::helper('dataflow')->__('<a href="%s" target="_blank">Link</a>', $this->getVar('link'));
|
| 264 |
+
}
|
| 265 |
+
$this->addException($message);
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
}
|
| 269 |
+
else
|
| 270 |
+
{
|
| 271 |
+
|
| 272 |
+
$result = $this->getResource()->write($filename, $dataFile, 0777);
|
| 273 |
+
|
| 274 |
+
if (false === $result) {
|
| 275 |
+
$message = Mage::helper('dataflow')->__('Could not save file: %s.', $filename);
|
| 276 |
+
Mage::throwException($message);
|
| 277 |
+
} else {
|
| 278 |
+
|
| 279 |
+
/**
|
| 280 |
+
* Save Local copies in case of all formats except xls and xlsx
|
| 281 |
+
**/
|
| 282 |
+
$profileId = Mage::registry('current_convert_profile')->getId();
|
| 283 |
+
|
| 284 |
+
$oopprofile = Mage::getModel('oopsprofile/oopsprofile')->getCollection()
|
| 285 |
+
->addFieldToFilter('dataflow_profile_id',$profileId)
|
| 286 |
+
->getFirstItem();
|
| 287 |
+
|
| 288 |
+
$saveLocalCopies = $oopprofile->getSaveLocalCopy();
|
| 289 |
+
|
| 290 |
+
if($saveLocalCopies)//save if "save local copies" enable
|
| 291 |
+
{
|
| 292 |
+
$localpath = 'oopsprofile/'.$oopprofile->getId();
|
| 293 |
+
//create path if not exist
|
| 294 |
+
if (!file_exists($localpath)) {
|
| 295 |
+
mkdir($localpath, 0777, true);
|
| 296 |
+
}
|
| 297 |
+
$fileWithPath = $localpath.'/'.$this->getVar('filename');
|
| 298 |
+
|
| 299 |
+
$localResource = new Varien_Io_File();
|
| 300 |
+
|
| 301 |
+
$localResource->write($fileWithPath, $dataFile, 0777);
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
|
| 306 |
+
$message = Mage::helper('dataflow')->__('Saved successfully: "%s" [%d byte(s)].', $filename, $batchModel->getIoAdapter()->getFileSize());
|
| 307 |
+
if ($this->getVar('link')) {
|
| 308 |
+
$message .= Mage::helper('dataflow')->__('<a href="%s" target="_blank">Link</a>', $this->getVar('link'));
|
| 309 |
+
}
|
| 310 |
+
$this->addException($message);
|
| 311 |
+
}
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
return $this;
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
public function saveOnFtp()
|
| 319 |
+
{
|
| 320 |
+
$file = 'var/export/ftp/export_file.'.$this->getVar('fileformat');//temp file path on local server
|
| 321 |
+
$remote_file = $this->getVar('filename');
|
| 322 |
+
|
| 323 |
+
// set up basic connection
|
| 324 |
+
$conn_id = ftp_connect($this->getVar('host'));
|
| 325 |
+
|
| 326 |
+
// login with username and password
|
| 327 |
+
$login_result = ftp_login($conn_id, $this->getVar('user'), $this->getVar('password'));
|
| 328 |
+
|
| 329 |
+
if($this->getVar('file_mode')==2)
|
| 330 |
+
{
|
| 331 |
+
$fileMode = FTP_BINARY;
|
| 332 |
+
}
|
| 333 |
+
else
|
| 334 |
+
{
|
| 335 |
+
$fileMode = FTP_ASCII;
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
|
| 339 |
+
if($this->getVar('path'))
|
| 340 |
+
{
|
| 341 |
+
$remote_file = $this->getVar('path').'/'.$remote_file;
|
| 342 |
+
//ftp_chdir($conn_id, $this->getVar('path'));
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
// upload a file
|
| 346 |
+
if (ftp_put($conn_id, $remote_file, $file, $fileMode)) {
|
| 347 |
+
$message = Mage::helper('dataflow')->__('successfully uploaded '). $remote_file;
|
| 348 |
+
$this->addException($message);
|
| 349 |
+
} else {
|
| 350 |
+
$message = Mage::helper('dataflow')->__('There was a problem while uploading '). $remote_file;
|
| 351 |
+
Mage::throwException($message);
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
// close the connection and the file handler
|
| 355 |
+
ftp_close($conn_id);
|
| 356 |
+
|
| 357 |
+
return $this;
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
public function saveOnLocalFromFtp()
|
| 361 |
+
{
|
| 362 |
+
$path = 'var/import/ftp';
|
| 363 |
+
$file = $path.'/import_file.'.$this->getVar('fileformat');//temp file path on local server
|
| 364 |
+
$remote_file = $this->getVar('filename');
|
| 365 |
+
|
| 366 |
+
//create path if not exist
|
| 367 |
+
if (!file_exists($path)) {
|
| 368 |
+
mkdir($path, 0777, true);
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
// set up basic connection
|
| 372 |
+
$conn_id = ftp_connect($this->getVar('host'));
|
| 373 |
+
|
| 374 |
+
// login with username and password
|
| 375 |
+
$login_result = ftp_login($conn_id, $this->getVar('user'), $this->getVar('password'));
|
| 376 |
+
|
| 377 |
+
if($this->getVar('file_mode')==2)
|
| 378 |
+
{
|
| 379 |
+
$fileMode = FTP_BINARY;
|
| 380 |
+
}
|
| 381 |
+
else
|
| 382 |
+
{
|
| 383 |
+
$fileMode = FTP_ASCII;
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
|
| 387 |
+
if($this->getVar('path'))
|
| 388 |
+
{
|
| 389 |
+
$remote_file = $this->getVar('path').'/'.$remote_file;
|
| 390 |
+
//ftp_chdir($conn_id, $this->getVar('path'));
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
// upload a file
|
| 394 |
+
if (ftp_get($conn_id, $file,$remote_file, $fileMode)) {
|
| 395 |
+
$message = Mage::helper('dataflow')->__('successfully loaded '). $remote_file;
|
| 396 |
+
$this->addException($message);
|
| 397 |
+
} else {
|
| 398 |
+
$message = Mage::helper('dataflow')->__('There was a problem while loading '). $remote_file;
|
| 399 |
+
Mage::throwException($message);
|
| 400 |
+
}
|
| 401 |
+
// close the connection and the file handler
|
| 402 |
+
ftp_close($conn_id);
|
| 403 |
+
|
| 404 |
+
return $file;
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
public function saveOnLocalFromSftp()
|
| 408 |
+
{
|
| 409 |
+
$path = 'var/import/ftp';
|
| 410 |
+
$file = $path.'/import_file.'.$this->getVar('fileformat');//temp file path on local server
|
| 411 |
+
$remote_file = $this->getVar('filename');
|
| 412 |
+
|
| 413 |
+
//create path if not exist
|
| 414 |
+
if (!file_exists($path)) {
|
| 415 |
+
mkdir($path, 0777, true);
|
| 416 |
+
}
|
| 417 |
+
if($this->getVar('path'))
|
| 418 |
+
{
|
| 419 |
+
$remote_file = $this->getVar('path').'/'.$remote_file;
|
| 420 |
+
}
|
| 421 |
+
$result = $this->getResource()->read($remote_file,$file);
|
| 422 |
+
|
| 423 |
+
// upload a file
|
| 424 |
+
if ($result===false) {
|
| 425 |
+
$message = Mage::helper('dataflow')->__('There was a problem while loading '). $remote_file;
|
| 426 |
+
Mage::throwException($message);
|
| 427 |
+
} else {
|
| 428 |
+
$message = Mage::helper('dataflow')->__('successfully loaded '). $remote_file;
|
| 429 |
+
$this->addException($message);
|
| 430 |
+
}
|
| 431 |
+
return $file;
|
| 432 |
+
|
| 433 |
+
}
|
| 434 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Convert/Adapter/Mail.php
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â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|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Convert_Adapter_Mail extends Mage_Dataflow_Model_Convert_Adapter_Io {
|
| 4 |
+
const DEFAULT_PROTOCOL = 'IMAP';
|
| 5 |
+
const DEFAULT_HOST = '127.0.0.1';
|
| 6 |
+
const DEFAULT_IMAP_PORT = 143;
|
| 7 |
+
const IMAP_SSL_PORT = 993;
|
| 8 |
+
|
| 9 |
+
const GOOGLE_IMAP_SERVICE = 'imap.gmail.com';
|
| 10 |
+
protected $_encryptionTypes = array(
|
| 11 |
+
'TLS',
|
| 12 |
+
'SSL',
|
| 13 |
+
);
|
| 14 |
+
|
| 15 |
+
const DEFAULT_ATTACHMENT_SUBJECT = 'attachment';
|
| 16 |
+
const DEFAULT_ATTACHMENT_SAVE_PATH = 'var/import/attachments';
|
| 17 |
+
|
| 18 |
+
protected function readAccessTokenByService($service, $profileId) {
|
| 19 |
+
|
| 20 |
+
$tokenName = 'oops_' . $profileId . '_mail.tmp';
|
| 21 |
+
$tokenPath = Mage::getBaseDir('var') . DS . 'token';
|
| 22 |
+
|
| 23 |
+
$io = new Varien_Io_File();
|
| 24 |
+
$io->open(array('path' => $tokenPath));
|
| 25 |
+
$content = $io->read($tokenName);
|
| 26 |
+
$io->close();
|
| 27 |
+
return json_decode($content, true);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
protected function _constructAuthString($username, $token) {
|
| 31 |
+
|
| 32 |
+
$accessToken = null;
|
| 33 |
+
if (false === strpos($username, '@gmail.com')) {
|
| 34 |
+
$email = $username . '@gmail.com';
|
| 35 |
+
} else {
|
| 36 |
+
$email = $username;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
if (isset($token['access_token'])) {
|
| 40 |
+
$accessToken = $token['access_token'];
|
| 41 |
+
}
|
| 42 |
+
if ($accessToken) {
|
| 43 |
+
return base64_encode("user=$email\1auth=Bearer $accessToken\1\1");
|
| 44 |
+
}
|
| 45 |
+
return false;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
protected function _sendAuthenticationRequest($imap, $username, $tokenData) {
|
| 49 |
+
|
| 50 |
+
if ($authString = $this->_constructAuthString($username, $tokenData)) {
|
| 51 |
+
$authenticateParams = array('XOAUTH2', $authString);
|
| 52 |
+
$imap->sendRequest('AUTHENTICATE', $authenticateParams); //send request
|
| 53 |
+
while (true) {
|
| 54 |
+
$response = "";
|
| 55 |
+
$is_plus = $imap->readLine($response, '+', true);
|
| 56 |
+
if ($is_plus) {
|
| 57 |
+
$errorMsg = sprintf("got an extra server challenge: %s", $response);
|
| 58 |
+
Mage::log($errorMsg);
|
| 59 |
+
// Send empty client response.
|
| 60 |
+
$imap->sendRequest('');
|
| 61 |
+
} else {
|
| 62 |
+
if (preg_match('/^NO /i', $response) ||
|
| 63 |
+
preg_match('/^BAD /i', $response)) {
|
| 64 |
+
//error_log("got failure response: $response");
|
| 65 |
+
$errorMsg = sprintf("got failure response: %s", $response);
|
| 66 |
+
Mage::log($errorMsg);
|
| 67 |
+
return false;
|
| 68 |
+
} else if (preg_match("/^OK /i", $response)) {
|
| 69 |
+
return true;
|
| 70 |
+
} else {
|
| 71 |
+
Mage::log('Some untagged response, such as CAPABILITY');
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
protected function _buildProtocolConfig(&$config, $vars){
|
| 79 |
+
|
| 80 |
+
$config['encryption'] = false; //overrided in case of a service provider like 'Gmail'
|
| 81 |
+
|
| 82 |
+
if (isset($vars['host'])) {
|
| 83 |
+
$config['host'] = $vars['host'];
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
if (isset($vars['port'])) {
|
| 87 |
+
$config['port'] = $vars['port'];
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
if (isset($vars['encryption'])) {
|
| 91 |
+
$config['ssl'] = $vars['encryption'];
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
if (isset($vars['username'])) {
|
| 95 |
+
$config['user'] = $vars['username'];
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
if (isset($vars['password'])) {
|
| 99 |
+
$config['password'] = $vars['password'];
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
if (isset($vars['service_provider']) && $vars['service_provider'] == 'gmail') {
|
| 103 |
+
$config['encryption'] = true;
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
/*
|
| 108 |
+
* Return the storage object
|
| 109 |
+
*/
|
| 110 |
+
|
| 111 |
+
public function getMailResource() {
|
| 112 |
+
|
| 113 |
+
$mailStorage = null;
|
| 114 |
+
$protocolConfig = array();
|
| 115 |
+
|
| 116 |
+
$protocol = strtoupper($this->getVar('protocol', self::DEFAULT_PROTOCOL));
|
| 117 |
+
|
| 118 |
+
$host = $this->getVar('host', self::DEFAULT_HOST);
|
| 119 |
+
$port = $this->getVar('port');
|
| 120 |
+
$pswd = $this->getVar('password');
|
| 121 |
+
$username = $this->getVar('username');
|
| 122 |
+
$encryption = $this->getVar('encryption');
|
| 123 |
+
$serviceProvider = $this->getVar('service_provider', null);
|
| 124 |
+
|
| 125 |
+
$currentProfile = Mage::app()->getRequest()->getParam('id');
|
| 126 |
+
|
| 127 |
+
//updates the $protocolConfig by reference
|
| 128 |
+
$this->_buildProtocolConfig($protocolConfig, $this->getVars());
|
| 129 |
+
|
| 130 |
+
switch ($protocol) {
|
| 131 |
+
case 'POP3'://not implemented
|
| 132 |
+
default:
|
| 133 |
+
if ($serviceProvider) {
|
| 134 |
+
switch ($serviceProvider) {
|
| 135 |
+
case 'gmail':
|
| 136 |
+
//connect google imap service args => array('host'=> value,'port'=> value,'ssl'=> true)
|
| 137 |
+
$imap = Mage::getModel('oopsprofile/mail_protocol_imap', $protocolConfig);
|
| 138 |
+
|
| 139 |
+
/* read the current profile access token
|
| 140 |
+
* if not available display message to generate one using allow acess
|
| 141 |
+
*/
|
| 142 |
+
$tokenData = $this->readAccessTokenByService($serviceProvider, $currentProfile);
|
| 143 |
+
//validate token with gmail
|
| 144 |
+
$isTokenOk = $this->_sendAuthenticationRequest($imap, $username, $tokenData);
|
| 145 |
+
if(true === $isTokenOk){
|
| 146 |
+
$mailStorage = Mage::getModel('oopsprofile/mail_storage_imap', $imap);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
}
|
| 150 |
+
}else{
|
| 151 |
+
|
| 152 |
+
//Attempt to open imap connection using array('host', 'port', 'username', 'password', 'ssl')
|
| 153 |
+
//print_r($protocolConfig);exit;
|
| 154 |
+
$mailStorage = Mage::getModel('oopsprofile/mail_storage_imap', $protocolConfig);
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
return $mailStorage;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
/*
|
| 165 |
+
* Fetch Attachment
|
| 166 |
+
*/
|
| 167 |
+
|
| 168 |
+
public function load() {
|
| 169 |
+
|
| 170 |
+
$savedAttachments = array();
|
| 171 |
+
|
| 172 |
+
if (!$mailStorage = $this->getMailResource()) {
|
| 173 |
+
$message = Mage::helper('oopsprofile')->__('Could not connect to the Mail server.');
|
| 174 |
+
Mage::throwException($message);
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
$attachmentSubject = $this->getVar('mailsubject', self::DEFAULT_ATTACHMENT_SUBJECT);
|
| 178 |
+
$attachmentSavePath = $this->getVar('attachmentsavepath', self::DEFAULT_ATTACHMENT_SAVE_PATH);
|
| 179 |
+
$checkOnlyNewFlag = $this->getVar('checkonlynewmsgs', false); //only scan msgs with RECENT FLAG
|
| 180 |
+
$deleteAttachmentFlag = $this->getVar('deleteattachment', false); //delete mails after fetching the attachments
|
| 181 |
+
//try{
|
| 182 |
+
//Attachments will be saved locally as per given subject to the path provided
|
| 183 |
+
$savedAttachments = $mailStorage->fetchNSaveAttachmentsToImport(
|
| 184 |
+
$attachmentSubject, $attachmentSavePath, $checkOnlyNewFlag, $deleteAttachmentFlag
|
| 185 |
+
);
|
| 186 |
+
//}catch(Exception $e){
|
| 187 |
+
// Mage::log($e);
|
| 188 |
+
//}
|
| 189 |
+
|
| 190 |
+
/*
|
| 191 |
+
* Set vars to $this as if they were defined in the xml
|
| 192 |
+
*/
|
| 193 |
+
//echo 'helooo';exit;
|
| 194 |
+
//print_r($savedAttachments);exit;
|
| 195 |
+
|
| 196 |
+
if (!empty($savedAttachments)) {
|
| 197 |
+
foreach ($savedAttachments as $file) {
|
| 198 |
+
$this->setVar('filename', $file);
|
| 199 |
+
$this->setVar('path', $attachmentSavePath);
|
| 200 |
+
$this->setVar('type', 'file');
|
| 201 |
+
}
|
| 202 |
+
} else {
|
| 203 |
+
$message = Mage::helper('oopsprofile')->__('Failed to fetch attachments from the mail server OR No attachments found on server.');
|
| 204 |
+
Mage::throwException($message);
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
if (!$this->getResource()) {
|
| 208 |
+
return $this;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
$batchModel = Mage::getSingleton('dataflow/batch');
|
| 212 |
+
$destFile = $batchModel->getIoAdapter()->getFile(true);
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
$result = $this->getResource()->read($this->getVar('filename'), $destFile);
|
| 216 |
+
$filename = $this->getResource()->pwd() . '/' . $this->getVar('filename');
|
| 217 |
+
if (false === $result) {
|
| 218 |
+
$message = Mage::helper('dataflow')->__('Could not load file: "%s".', $filename);
|
| 219 |
+
Mage::throwException($message);
|
| 220 |
+
} else {
|
| 221 |
+
$message = Mage::helper('dataflow')->__('Loaded successfully: "%s".', $filename);
|
| 222 |
+
$this->addException($message);
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
$this->setData($result);
|
| 226 |
+
return $this;
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
/**
|
| 230 |
+
* Save result to destination file from temporary
|
| 231 |
+
*
|
| 232 |
+
* @return Mage_Dataflow_Model_Convert_Adapter_Io
|
| 233 |
+
*/
|
| 234 |
+
public function save() {
|
| 235 |
+
|
| 236 |
+
$helper = Mage::helper('oopsprofile/mail');
|
| 237 |
+
|
| 238 |
+
$attachmentSubject = $this->getVar('mailsubject', self::DEFAULT_ATTACHMENT_SUBJECT);
|
| 239 |
+
$attachmentSavePath = $this->getVar('attachmentsavepath', self::DEFAULT_ATTACHMENT_SAVE_PATH);
|
| 240 |
+
$checkOnlyNewFlag = $this->getVar('checkonlynewmsgs', false); //only scan msgs with RECENT FLAG
|
| 241 |
+
$deleteAttachmentFlag = $this->getVar('deleteattachment', false); //delete mails after fetching the attachments
|
| 242 |
+
|
| 243 |
+
$this->setVar('path', $attachmentSavePath);
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
if (!$this->getResource(true)) {
|
| 247 |
+
return $this;
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
$batchModel = Mage::getSingleton('dataflow/batch');
|
| 251 |
+
|
| 252 |
+
$dataFile = $batchModel->getIoAdapter()->getFile(true);
|
| 253 |
+
|
| 254 |
+
$filename = $this->getVar('filename');
|
| 255 |
+
|
| 256 |
+
$result = $this->getResource()->write($filename, $dataFile, 0777);
|
| 257 |
+
|
| 258 |
+
//attach the file as attachment and email it
|
| 259 |
+
$mail = Mage::getModel('oopsprofile/mail');
|
| 260 |
+
$mail->sendMailWithAttachment($this->getVars());
|
| 261 |
+
|
| 262 |
+
if ($result === true) {
|
| 263 |
+
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
if (false === $result) {
|
| 267 |
+
$message = Mage::helper('dataflow')->__('Could not save file: %s.', $filename);
|
| 268 |
+
Mage::throwException($message);
|
| 269 |
+
} else {
|
| 270 |
+
$message = Mage::helper('dataflow')->__('Saved successfully: "%s" [%d byte(s)].', $filename, $batchModel->getIoAdapter()->getFileSize());
|
| 271 |
+
if ($this->getVar('link')) {
|
| 272 |
+
$message .= Mage::helper('dataflow')->__('<a href="%s" target="_blank">Link</a>', $this->getVar('link'));
|
| 273 |
+
}
|
| 274 |
+
$this->addException($message);
|
| 275 |
+
}
|
| 276 |
+
return $this;
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Convert/Parser/Csv.php
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
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
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Convert_Parser_Csv extends Mage_Dataflow_Model_Convert_Parser_Csv
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* Read data collection and write to temporary file
|
| 8 |
+
*
|
| 9 |
+
* @return PI_Oopsprofile_Model_Convert_Parser_Csv
|
| 10 |
+
*/
|
| 11 |
+
public function unparse()
|
| 12 |
+
{
|
| 13 |
+
$batchExport = $this->getBatchExportModel()
|
| 14 |
+
->setBatchId($this->getBatchModel()->getId());
|
| 15 |
+
$fieldList = $this->getBatchModel()->getFieldList();
|
| 16 |
+
$batchExportIds = $batchExport->getIdCollection();
|
| 17 |
+
|
| 18 |
+
$io = $this->getBatchModel()->getIoAdapter();
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Save products separately
|
| 24 |
+
**/
|
| 25 |
+
$profileId = Mage::registry('current_convert_profile')->getId();
|
| 26 |
+
|
| 27 |
+
$entityType = Mage::registry('current_convert_profile')->getEntityType();
|
| 28 |
+
|
| 29 |
+
$oopprofile = Mage::getModel('oopsprofile/oopsprofile')->getCollection()
|
| 30 |
+
->addFieldToFilter('dataflow_profile_id',$profileId)
|
| 31 |
+
->getFirstItem();
|
| 32 |
+
|
| 33 |
+
$saveMultipleCopies = $oopprofile->getSaveProductsSeparately();
|
| 34 |
+
if($saveMultipleCopies==1 && $entityType=='product')//if "Save Products Separately" enable
|
| 35 |
+
{
|
| 36 |
+
|
| 37 |
+
if (!$batchExportIds) {
|
| 38 |
+
$io->write("");
|
| 39 |
+
$io->close();
|
| 40 |
+
return $this;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
$i=1;
|
| 44 |
+
foreach ($batchExportIds as $batchExportId) {
|
| 45 |
+
|
| 46 |
+
$io->openMulty($i++);
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
if ($this->getVar('fieldnames')) {
|
| 50 |
+
$csvData = $this->getCsvString($fieldList);
|
| 51 |
+
$io->write($csvData);
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
$csvData = array();
|
| 55 |
+
$batchExport->load($batchExportId);
|
| 56 |
+
$row = $batchExport->getBatchData();
|
| 57 |
+
|
| 58 |
+
foreach ($fieldList as $field) {
|
| 59 |
+
$csvData[] = isset($row[$field]) ? $row[$field] : '';
|
| 60 |
+
}
|
| 61 |
+
$csvData = $this->getCsvString($csvData);
|
| 62 |
+
$io->write($csvData);
|
| 63 |
+
$io->close();
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
else
|
| 67 |
+
{
|
| 68 |
+
$io->open();
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
if (!$batchExportIds) {
|
| 72 |
+
$io->write("");
|
| 73 |
+
$io->close();
|
| 74 |
+
return $this;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
if ($this->getVar('fieldnames')) {
|
| 78 |
+
$csvData = $this->getCsvString($fieldList);
|
| 79 |
+
$io->write($csvData);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
foreach ($batchExportIds as $batchExportId) {
|
| 83 |
+
$csvData = array();
|
| 84 |
+
$batchExport->load($batchExportId);
|
| 85 |
+
$row = $batchExport->getBatchData();
|
| 86 |
+
|
| 87 |
+
foreach ($fieldList as $field) {
|
| 88 |
+
$csvData[] = isset($row[$field]) ? $row[$field] : '';
|
| 89 |
+
}
|
| 90 |
+
$csvData = $this->getCsvString($csvData);
|
| 91 |
+
$io->write($csvData);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
$io->close();
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
return $this;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
public function parse()
|
| 102 |
+
{
|
| 103 |
+
// fixed for multibyte characters
|
| 104 |
+
setlocale(LC_ALL, Mage::app()->getLocale()->getLocaleCode().'.UTF-8');
|
| 105 |
+
|
| 106 |
+
$fDel = $this->getVar('delimiter', ',');
|
| 107 |
+
$fEnc = $this->getVar('enclose', '"');
|
| 108 |
+
if ($fDel == '\t') {
|
| 109 |
+
$fDel = "\t";
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
$adapterName = $this->getVar('adapter', null);
|
| 113 |
+
$adapterMethod = $this->getVar('method', 'saveRow');
|
| 114 |
+
|
| 115 |
+
if (!$adapterName || !$adapterMethod) {
|
| 116 |
+
$message = Mage::helper('dataflow')->__('Please declare "adapter" and "method" nodes first.');
|
| 117 |
+
$this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL);
|
| 118 |
+
return $this;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
try {
|
| 122 |
+
$adapter = Mage::getModel($adapterName);
|
| 123 |
+
}
|
| 124 |
+
catch (Exception $e) {
|
| 125 |
+
$message = Mage::helper('dataflow')->__('Declared adapter %s was not found.', $adapterName);
|
| 126 |
+
$this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL);
|
| 127 |
+
return $this;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
if (!method_exists($adapter, $adapterMethod)) {
|
| 131 |
+
$message = Mage::helper('dataflow')->__('Method "%s" not defined in adapter %s.', $adapterMethod, $adapterName);
|
| 132 |
+
$this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL);
|
| 133 |
+
return $this;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
$batchModel = $this->getBatchModel();
|
| 137 |
+
$batchIoAdapter = $this->getBatchModel()->getIoAdapter();
|
| 138 |
+
|
| 139 |
+
if (Mage::app()->getRequest()->getParam('files')) {
|
| 140 |
+
$file = Mage::app()->getConfig()->getTempVarDir().'/import/'
|
| 141 |
+
. urldecode(Mage::app()->getRequest()->getParam('files'));
|
| 142 |
+
$this->_copy($file);
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
$batchIoAdapter->open(false);
|
| 146 |
+
|
| 147 |
+
$isFieldNames = $this->getVar('fieldnames', '') == 'true' ? true : false;
|
| 148 |
+
if (!$isFieldNames && is_array($this->getVar('map'))) {
|
| 149 |
+
$fieldNames = $this->getVar('map');
|
| 150 |
+
}
|
| 151 |
+
else {
|
| 152 |
+
|
| 153 |
+
$fieldNames = array();
|
| 154 |
+
foreach ($batchIoAdapter->read(true, $fDel, $fEnc) as $v) {
|
| 155 |
+
$fieldNames[$v] = $v;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
if(is_array($this->getVar('map')))
|
| 159 |
+
{
|
| 160 |
+
$mappedfields = $this->getVar('map');
|
| 161 |
+
|
| 162 |
+
$fieldNames = array_merge($fieldNames,$mappedfields);
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
//echo '<pre>';print_r($fieldNames);exit;
|
| 169 |
+
|
| 170 |
+
$countRows = 0;
|
| 171 |
+
while (($csvData = $batchIoAdapter->read(true, $fDel, $fEnc)) !== false) {
|
| 172 |
+
if (count($csvData) == 1 && $csvData[0] === null) {
|
| 173 |
+
continue;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
$itemData = array();
|
| 178 |
+
$countRows ++; $i = 0;
|
| 179 |
+
foreach ($fieldNames as $field) {
|
| 180 |
+
$itemData[$field] = isset($csvData[$i]) ? $csvData[$i] : null;
|
| 181 |
+
$i ++;
|
| 182 |
+
}
|
| 183 |
+
//echo '<pre>';print_r($itemData);
|
| 184 |
+
$batchImportModel = $this->getBatchImportModel()
|
| 185 |
+
->setId(null)
|
| 186 |
+
->setBatchId($this->getBatchModel()->getId())
|
| 187 |
+
->setBatchData($itemData)
|
| 188 |
+
->setStatus(1)
|
| 189 |
+
->save();
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
$this->addException(Mage::helper('dataflow')->__('Found %d rows.', $countRows));
|
| 194 |
+
$this->addException(Mage::helper('dataflow')->__('Starting %s :: %s', $adapterName, $adapterMethod));
|
| 195 |
+
|
| 196 |
+
$batchModel->setParams($this->getVars())
|
| 197 |
+
->setAdapter($adapterName)
|
| 198 |
+
->save();
|
| 199 |
+
|
| 200 |
+
//$adapter->$adapterMethod();
|
| 201 |
+
|
| 202 |
+
return $this;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
}
|
| 206 |
+
?>
|
app/code/community/PI/Oopsprofile/Model/Convert/Parser/Txt.php
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Convert_Parser_Txt extends PI_Oopsprofile_Model_Convert_Parser_Csv
|
| 4 |
+
{
|
| 5 |
+
}
|
| 6 |
+
?>
|
app/code/community/PI/Oopsprofile/Model/Createapiobserver.php
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Oopsprofile_Model_Createapiobserver
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
public function createapi()
|
| 6 |
+
{
|
| 7 |
+
|
| 8 |
+
try
|
| 9 |
+
{
|
| 10 |
+
$apiUserModel = Mage::getModel('api/user');
|
| 11 |
+
|
| 12 |
+
$apiId = $apiUserModel->getCollection()->addFieldToFilter('username','OopsProfileUser')->getFirstItem()->getId();
|
| 13 |
+
if($apiId=='')//if api user is not exist
|
| 14 |
+
{
|
| 15 |
+
$apiRoleId = $this->createApiRole();
|
| 16 |
+
|
| 17 |
+
$this->craeteApiUser($apiUserModel,$apiRoleId);
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
catch(Exception $e)
|
| 21 |
+
{
|
| 22 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
//code to create role with their resources
|
| 28 |
+
protected function createApiRole()
|
| 29 |
+
{
|
| 30 |
+
|
| 31 |
+
//assign resources to role
|
| 32 |
+
$resource = array('_root_',
|
| 33 |
+
'oopsprofile',
|
| 34 |
+
'oopsprofile/exportproductdata',
|
| 35 |
+
'oopsprofile/exportcustomerdata',
|
| 36 |
+
'oopsprofile/exportcustomergroupdata',
|
| 37 |
+
'oopsprofile/exportorderdata',
|
| 38 |
+
'oopsprofile/exportshipmentdata',
|
| 39 |
+
'oopsprofile/exportinvoicedata',
|
| 40 |
+
'oopsprofile/exportcreditmemodata'
|
| 41 |
+
);
|
| 42 |
+
|
| 43 |
+
$roleModel = Mage::getModel('api/roles');
|
| 44 |
+
|
| 45 |
+
$roleId = $roleModel->getCollection()->addFieldToFilter('role_name','OopsRole')->getFirstItem()->getId();
|
| 46 |
+
|
| 47 |
+
if($roleId=='')//if role id is not exist
|
| 48 |
+
{
|
| 49 |
+
|
| 50 |
+
//create new Role
|
| 51 |
+
$role = $roleModel
|
| 52 |
+
->setName('OopsRole')
|
| 53 |
+
->setPid(0)
|
| 54 |
+
->setRoleType('G')
|
| 55 |
+
->save(); //save in api_role
|
| 56 |
+
|
| 57 |
+
Mage::getModel("api/rules")
|
| 58 |
+
->setRoleId($role->getId())
|
| 59 |
+
->setResources($resource)
|
| 60 |
+
->saveRel(); //save resources in api_rule and assign it to a role
|
| 61 |
+
|
| 62 |
+
return $role->getId();
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
return $this;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
//create api user with their role
|
| 69 |
+
protected function craeteApiUser($apiUserModel,$apiRoleId)
|
| 70 |
+
{
|
| 71 |
+
$userRoles = array ($apiRoleId);
|
| 72 |
+
|
| 73 |
+
$data['username'] = 'OopsProfileUser';
|
| 74 |
+
$data['firstname'] = 'profile';
|
| 75 |
+
$data['lastname'] = 'user';
|
| 76 |
+
$data['api_key'] = 'oopsprofileapikey';
|
| 77 |
+
$data['is_active'] = 1;
|
| 78 |
+
$data['email'] = 'profileemail@email.com';
|
| 79 |
+
|
| 80 |
+
$apiUserModel->setData($data)->save();//save data in api_user
|
| 81 |
+
|
| 82 |
+
$role = $apiUserModel->setRoleIds($userRoles)
|
| 83 |
+
->setRoleUserId($apiUserModel->getUserId())
|
| 84 |
+
->saveRelations(); // save data in api_role and assign role to user
|
| 85 |
+
|
| 86 |
+
return $this;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
}
|
app/code/community/PI/Oopsprofile/Model/CronObserver.php
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
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|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Oopsprofile_Model_CronObserver extends Varien_Object{
|
| 3 |
+
|
| 4 |
+
const CRON_MODEL_PATH = 'crontab/jobs/oopsprofile_cron/run/model';
|
| 5 |
+
const PROFILE_JOB_CODE_PREFIX = 'oopsprofile_cron_';
|
| 6 |
+
const OOPS_PROFILE_LOG_FILE = 'oops.log';
|
| 7 |
+
|
| 8 |
+
/*
|
| 9 |
+
* Save Cron Schedule to Core_Config_Data
|
| 10 |
+
*/
|
| 11 |
+
public function saveCronSchedule($observer){
|
| 12 |
+
|
| 13 |
+
$oopsprofile = $observer->getEvent()->getOopsprofile();
|
| 14 |
+
|
| 15 |
+
$cronExprKeyPath = 'crontab/jobs/oopsprofile_cron_' . $oopsprofile->getId() . '/schedule/cron_expr';
|
| 16 |
+
$cronModelKeyPath = 'crontab/jobs/oopsprofile_cron_' . $oopsprofile->getId() . '/run/model';
|
| 17 |
+
// 0 means profile is enabled
|
| 18 |
+
$isEnabled = $oopsprofile->getData('profile_enable') == 0;
|
| 19 |
+
|
| 20 |
+
if($oopsprofile->getData('cron_enabled') == 1 && $isEnabled){
|
| 21 |
+
|
| 22 |
+
$cronExprString = '';
|
| 23 |
+
$time = '';
|
| 24 |
+
$frequency = '';
|
| 25 |
+
|
| 26 |
+
$frequencyDaily = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_DAILY;
|
| 27 |
+
$frequencyWeekly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY;
|
| 28 |
+
$frequencyMonthly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY;
|
| 29 |
+
|
| 30 |
+
$time = $oopsprofile->getData('cron_start_time');
|
| 31 |
+
$frequency = $oopsprofile->getData('cron_frequency');
|
| 32 |
+
|
| 33 |
+
$isExpertMode = $oopsprofile->getData('cron_expert_mode');
|
| 34 |
+
|
| 35 |
+
if($time && $frequency || $isExpertMode){
|
| 36 |
+
|
| 37 |
+
$cronDayOfWeek = date('N');
|
| 38 |
+
$cronExprArray = array(
|
| 39 |
+
intval($time[1]), # Minute
|
| 40 |
+
intval($time[0]), # Hour
|
| 41 |
+
($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month
|
| 42 |
+
'*', # Month of the Year
|
| 43 |
+
($frequency == $frequencyWeekly) ? '1' : '*', # Day of the Week
|
| 44 |
+
);
|
| 45 |
+
$cronExprString = join(' ', $cronExprArray);
|
| 46 |
+
|
| 47 |
+
$cronModelValue = 'oopsprofile/cronObserver::runProfile';
|
| 48 |
+
|
| 49 |
+
if($isExpertMode){
|
| 50 |
+
$cronExprString = $oopsprofile->getData('cron_expression');
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
try {
|
| 54 |
+
Mage::getModel('core/config_data')
|
| 55 |
+
->load($cronExprKeyPath, 'path')
|
| 56 |
+
->setValue($cronExprString)
|
| 57 |
+
->setPath($cronExprKeyPath)
|
| 58 |
+
->save();
|
| 59 |
+
|
| 60 |
+
Mage::getModel('core/config_data')
|
| 61 |
+
->load($cronModelKeyPath, 'path')
|
| 62 |
+
->setValue($cronModelValue)
|
| 63 |
+
->setPath($cronModelKeyPath)
|
| 64 |
+
->save();
|
| 65 |
+
}catch (Exception $e) {
|
| 66 |
+
Mage::throwException(Mage::helper('adminhtml')->__('Unable to save the cron expression.'));
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
}else{
|
| 71 |
+
try {
|
| 72 |
+
$configExpr = Mage::getModel('core/config_data')->load($cronExprKeyPath, 'path');
|
| 73 |
+
if($configExpr){
|
| 74 |
+
$configExpr->delete();
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
$configModel = Mage::getModel('core/config_data')->load($cronModelKeyPath, 'path');
|
| 78 |
+
if($configModel){
|
| 79 |
+
$configModel->delete();
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
}catch (Exception $e) {
|
| 83 |
+
Mage::throwException(Mage::helper('adminhtml')->__('Unable to save the cron expression.'));
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
if($isEnabled!=1)
|
| 88 |
+
{
|
| 89 |
+
$msg = Mage::helper('oopsprofile')->__('You can shedule the cron after enabling the profile');
|
| 90 |
+
Mage::getSingleton('adminhtml/session')->addNotice($msg);
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
return $this;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
/*
|
| 98 |
+
* Save Oops Cron Schedule to Core_Config_Data
|
| 99 |
+
*/
|
| 100 |
+
public function saveOopsCronSchedule($observer){
|
| 101 |
+
|
| 102 |
+
$oopsprofile = $observer->getEvent()->getOopsprofile();
|
| 103 |
+
|
| 104 |
+
$cronExprKeyPath = 'crontab/jobs/oopsprofile_cron_' . $oopsprofile->getId() . '/schedule/cron_expr';
|
| 105 |
+
$cronModelKeyPath = 'crontab/jobs/oopsprofile_cron_' . $oopsprofile->getId() . '/run/model';
|
| 106 |
+
// 0 means profile is enabled
|
| 107 |
+
$isEnabled = $oopsprofile->getData('profile_enable') == 0;
|
| 108 |
+
|
| 109 |
+
if($oopsprofile->getData('cron_enabled') == 1 && $isEnabled){
|
| 110 |
+
|
| 111 |
+
$cronExprString = $oopsprofile->getData('cron_expression');
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
$cronModelValue = 'oopsprofile/cronObserver::runProfile';
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
try {
|
| 118 |
+
Mage::getModel('core/config_data')
|
| 119 |
+
->load($cronExprKeyPath, 'path')
|
| 120 |
+
->setValue($cronExprString)
|
| 121 |
+
->setPath($cronExprKeyPath)
|
| 122 |
+
->save();
|
| 123 |
+
|
| 124 |
+
Mage::getModel('core/config_data')
|
| 125 |
+
->load($cronModelKeyPath, 'path')
|
| 126 |
+
->setValue($cronModelValue)
|
| 127 |
+
->setPath($cronModelKeyPath)
|
| 128 |
+
->save();
|
| 129 |
+
}catch (Exception $e) {
|
| 130 |
+
Mage::throwException(Mage::helper('adminhtml')->__('Unable to save the cron expression.'));
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
}else{
|
| 135 |
+
try {
|
| 136 |
+
$configExpr = Mage::getModel('core/config_data')->load($cronExprKeyPath, 'path');
|
| 137 |
+
if($configExpr){
|
| 138 |
+
$configExpr->delete();
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
$configModel = Mage::getModel('core/config_data')->load($cronModelKeyPath, 'path');
|
| 142 |
+
if($configModel){
|
| 143 |
+
$configModel->delete();
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
}catch (Exception $e) {
|
| 147 |
+
Mage::throwException(Mage::helper('adminhtml')->__('Unable to save the cron expression.'));
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
if($isEnabled!=1)
|
| 152 |
+
{
|
| 153 |
+
$msg = Mage::helper('oopsprofile')->__('You can shedule the cron after enabling the profile');
|
| 154 |
+
Mage::getSingleton('adminhtml/session')->addNotice($msg);
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
return $this;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
/*
|
| 161 |
+
* delete cron schedule from core_config_data when related oopsprofile is deleted
|
| 162 |
+
**/
|
| 163 |
+
public function deleteCronSchedule($observer){
|
| 164 |
+
|
| 165 |
+
$oopsprofile = $observer->getEvent()->getOopsprofile();
|
| 166 |
+
|
| 167 |
+
//$oopsProfileId = $oopsprofile->getId();
|
| 168 |
+
|
| 169 |
+
//if($oopsprofile->getData('cron_enabled') == 1){
|
| 170 |
+
$cronExprKeyPath = 'crontab/jobs/oopsprofile_cron_' . $oopsprofile->getId() . '/schedule/cron_expr';
|
| 171 |
+
$cronModelKeyPath = 'crontab/jobs/oopsprofile_cron_' . $oopsprofile->getId() . '/run/model';
|
| 172 |
+
|
| 173 |
+
try{
|
| 174 |
+
$configExpr = Mage::getModel('core/config_data')->load($cronExprKeyPath, 'path');
|
| 175 |
+
$configExpr->delete();
|
| 176 |
+
|
| 177 |
+
$configModel = Mage::getModel('core/config_data')->load($cronModelKeyPath, 'path');
|
| 178 |
+
$configModel->delete();
|
| 179 |
+
|
| 180 |
+
}catch (Exception $e) {
|
| 181 |
+
Mage::throwException(Mage::helper('adminhtml')->__('Unable to delete the cron expression.'));
|
| 182 |
+
}
|
| 183 |
+
//}
|
| 184 |
+
|
| 185 |
+
return $this;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
protected function _initOopsProfile($id){
|
| 193 |
+
|
| 194 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
| 195 |
+
|
| 196 |
+
$userModel = Mage::getModel('admin/user');
|
| 197 |
+
$userModel->setUserId(0);
|
| 198 |
+
Mage::getSingleton('admin/session')->setUser($userModel);
|
| 199 |
+
|
| 200 |
+
$oopsprofile = Mage::getModel('oopsprofile/oopsprofile')->load($id);
|
| 201 |
+
|
| 202 |
+
$dataflowProfileId = $oopsprofile->getData('dataflow_profile_id');
|
| 203 |
+
$dataflowProfile = Mage::getModel('dataflow/profile')->load($dataflowProfileId);
|
| 204 |
+
if (!$dataflowProfile->getId()) {
|
| 205 |
+
Mage::log('ERROR: Incorrect profile id', null, self::OOPS_PROFILE_LOG_FILE);
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
Mage::unregister('current_convert_profile');
|
| 209 |
+
Mage::unregister('current_convert_oopsprofile');
|
| 210 |
+
|
| 211 |
+
//Mage::register('current_convert_profile', $dataflowProfile);
|
| 212 |
+
Mage::register('current_convert_oopsprofile', $oopsprofile);
|
| 213 |
+
|
| 214 |
+
return $dataflowProfile;
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
/*Run Oopsprofile Via Cron*/
|
| 218 |
+
public function runProfile($schedule){
|
| 219 |
+
|
| 220 |
+
$jobCode = $schedule->getData('job_code');
|
| 221 |
+
$pos = strpos((string)$jobCode, self::PROFILE_JOB_CODE_PREFIX);
|
| 222 |
+
$strLen = strlen(self::PROFILE_JOB_CODE_PREFIX);
|
| 223 |
+
|
| 224 |
+
$logFileName = self::OOPS_PROFILE_LOG_FILE;
|
| 225 |
+
|
| 226 |
+
//Re-confirm that its a oops profile
|
| 227 |
+
if(substr($jobCode, 0,$strLen) == self::PROFILE_JOB_CODE_PREFIX){
|
| 228 |
+
|
| 229 |
+
$profileId = substr($jobCode, $strLen);
|
| 230 |
+
|
| 231 |
+
//load & set oopsprofile & dataflow profile to registry
|
| 232 |
+
$profile = $this->_initOopsProfile($profileId);
|
| 233 |
+
|
| 234 |
+
Mage::log('Oopsprofile:: ' . $profileId . ' Started.', null, $logFileName);
|
| 235 |
+
|
| 236 |
+
//try{
|
| 237 |
+
|
| 238 |
+
Mage::log('Is Cron Disabled:: '. Mage::registry('current_convert_oopsprofile')->getData('cron_enable'), null, $logFileName);
|
| 239 |
+
if(Mage::registry('current_convert_oopsprofile')->getData('cron_enable') == 1){
|
| 240 |
+
Mage::log('Halting Execution:: profile disabled.', null, $logFileName);
|
| 241 |
+
return false;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
//$profile = Mage::registry('current_convert_profile');
|
| 245 |
+
$profile->run();
|
| 246 |
+
|
| 247 |
+
$batchModel = Mage::getSingleton('dataflow/batch');
|
| 248 |
+
if ($batchModel->getId()) {
|
| 249 |
+
if ($batchModel->getAdapter()) {
|
| 250 |
+
|
| 251 |
+
$batchId = $batchModel->getId();
|
| 252 |
+
$batchImportModel = $batchModel->getBatchImportModel();
|
| 253 |
+
$importIds = $batchImportModel->getIdCollection();
|
| 254 |
+
|
| 255 |
+
Mage::log('Ids to import::', null, $logFileName);
|
| 256 |
+
Mage::log($importIds, null, $logFileName);
|
| 257 |
+
|
| 258 |
+
$batchModel = Mage::getModel('dataflow/batch')->load($batchId);
|
| 259 |
+
$adapter = Mage::getModel($batchModel->getAdapter());
|
| 260 |
+
|
| 261 |
+
$recordCount = 0;
|
| 262 |
+
foreach ($importIds as $importId) {
|
| 263 |
+
|
| 264 |
+
$recordCount++;
|
| 265 |
+
try{
|
| 266 |
+
|
| 267 |
+
$batchImportModel->load($importId);
|
| 268 |
+
if (!$batchImportModel->getId()) {
|
| 269 |
+
$errors[] = Mage::helper('dataflow')->__('Skip undefined row');
|
| 270 |
+
continue;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
$importData = $batchImportModel->getBatchData();
|
| 274 |
+
try {
|
| 275 |
+
$adapter->saveRow($importData);
|
| 276 |
+
} catch (Exception $e) {
|
| 277 |
+
Mage::log($e->getMessage(),null,$logFileName);
|
| 278 |
+
continue;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
if ($recordCount%20 == 0) {
|
| 282 |
+
Mage::log($recordCount . ' - Completed!!',null,$logFileName);
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
} catch(Exception $ex) {
|
| 286 |
+
Mage::log('Record# ' . $recordCount . ' - SKU = ' . $importData['sku']. ' - Error - ' . $ex->getMessage(),null,$logFileName);
|
| 287 |
+
}
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
if(!empty($errors)){
|
| 291 |
+
Mage::log('Rows Skipped::', null, $logFileName);
|
| 292 |
+
Mage::log($errors, null, $logFileName);
|
| 293 |
+
}
|
| 294 |
+
} else {
|
| 295 |
+
Mage::log('setBatchModelHasAdapter::false', null, $logFileName);
|
| 296 |
+
Mage::log('Export '.$profileId.' Complete. BatchID: '.$batchModel->getId(), null, $logFileName);
|
| 297 |
+
$batchModel->delete();
|
| 298 |
+
}
|
| 299 |
+
}
|
| 300 |
+
//}catch(Exception $e){
|
| 301 |
+
// Mage::log($e, null, $logFileName);
|
| 302 |
+
//}
|
| 303 |
+
}
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
public function heartbeat($observer){
|
| 307 |
+
return true;
|
| 308 |
+
}
|
| 309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php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Customergroup_Convert_Adapter_Customergroup
|
| 4 |
+
extends Mage_Eav_Model_Convert_Adapter_Entity
|
| 5 |
+
{
|
| 6 |
+
public function load()
|
| 7 |
+
{
|
| 8 |
+
try
|
| 9 |
+
{
|
| 10 |
+
$collection = $this->getCustomerGroupModel()
|
| 11 |
+
->getCollection();
|
| 12 |
+
$entityIds = $collection->getAllIds();
|
| 13 |
+
$message = Mage::helper('eav')->__("Loaded %d records", count($entityIds));
|
| 14 |
+
$this->addException($message);
|
| 15 |
+
}
|
| 16 |
+
catch (Varien_Convert_Exception $e) {
|
| 17 |
+
throw $e;
|
| 18 |
+
}
|
| 19 |
+
catch (Exception $e) {
|
| 20 |
+
$message = Mage::helper('eav')->__('Problem loading the collection, aborting. Error: %s', $e->getMessage());
|
| 21 |
+
$this->addException($message, Varien_Convert_Exception::FATAL);
|
| 22 |
+
}
|
| 23 |
+
/**
|
| 24 |
+
* Set collection ids
|
| 25 |
+
*/
|
| 26 |
+
$this->setData($entityIds);
|
| 27 |
+
return $this;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
public function parse()
|
| 31 |
+
{
|
| 32 |
+
$batchModel = Mage::getSingleton('dataflow/batch');
|
| 33 |
+
/* @var $batchModel Mage_Dataflow_Model_Batch */
|
| 34 |
+
|
| 35 |
+
$batchImportModel = $batchModel->getBatchImportModel();
|
| 36 |
+
$importIds = $batchImportModel->getIdCollection();
|
| 37 |
+
|
| 38 |
+
foreach ($importIds as $importId) {
|
| 39 |
+
$batchImportModel->load($importId);
|
| 40 |
+
$importData = $batchImportModel->getBatchData();
|
| 41 |
+
|
| 42 |
+
$this->saveRow($importData);
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/*
|
| 47 |
+
* saveRow function for saving each customer group
|
| 48 |
+
*
|
| 49 |
+
* params args array
|
| 50 |
+
* return array
|
| 51 |
+
*/
|
| 52 |
+
public function saveRow($importData)
|
| 53 |
+
{
|
| 54 |
+
try
|
| 55 |
+
{
|
| 56 |
+
$taxClassModel = Mage::getModel('tax/class');
|
| 57 |
+
$taxClassIds = $taxClassModel->getCollection()->getAllIds();
|
| 58 |
+
$customergroup = $this->getCustomerGroupModel();
|
| 59 |
+
|
| 60 |
+
if(!empty($importData))
|
| 61 |
+
{
|
| 62 |
+
if(array_search($importData['tax_class_id'],$taxClassIds))
|
| 63 |
+
{
|
| 64 |
+
$customergroup->setTaxClassId($importData['tax_class_id'])->setCustomerGroupCode($importData['customer_group_code']);
|
| 65 |
+
$groupId = $customergroup->getCollection()->addFieldToFilter('customer_group_code',$importData['customer_group_code'])->getFirstItem()->getId();
|
| 66 |
+
if(!empty($groupId))
|
| 67 |
+
{
|
| 68 |
+
$customergroup->setId($groupId);
|
| 69 |
+
}
|
| 70 |
+
else
|
| 71 |
+
{
|
| 72 |
+
$customergroup->setId(null);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
$customergroup->save();
|
| 76 |
+
}
|
| 77 |
+
else
|
| 78 |
+
{
|
| 79 |
+
$message = Mage::helper('oopsprofile')->__('tax_class_id %s is not exist',$importData['tax_class_id']);
|
| 80 |
+
Mage::throwException($message);
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
else
|
| 84 |
+
{
|
| 85 |
+
$message = Mage::helper('oopsprofile')->__('There is no row to import');
|
| 86 |
+
Mage::throwException($message);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
}
|
| 91 |
+
catch (Varien_Convert_Exception $e)
|
| 92 |
+
{
|
| 93 |
+
throw $e;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
return $this;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
public function getCustomerGroupModel()
|
| 100 |
+
{
|
| 101 |
+
return Mage::getModel('customer/group');
|
| 102 |
+
}
|
| 103 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Customergroup/Convert/Parser/Customergroup.php
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Customergroup_Convert_Parser_Customergroup
|
| 4 |
+
extends Mage_Eav_Model_Convert_Parser_Abstract
|
| 5 |
+
{
|
| 6 |
+
|
| 7 |
+
/**
|
| 8 |
+
* Function must be provided but has no meaning here.
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
public function parse()
|
| 12 |
+
{
|
| 13 |
+
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
public function unparse()
|
| 17 |
+
{
|
| 18 |
+
try
|
| 19 |
+
{
|
| 20 |
+
$entityIds = $this->getData();
|
| 21 |
+
foreach ($entityIds as $entityId)
|
| 22 |
+
{
|
| 23 |
+
$customergroup = Mage::getModel('customer/group')
|
| 24 |
+
->load($entityId)->getData();
|
| 25 |
+
|
| 26 |
+
//echo '<pre>';print_r($customergroup);exit;
|
| 27 |
+
unset($customergroup['customer_group_id']);
|
| 28 |
+
|
| 29 |
+
$batchExport = $this->getBatchExportModel()
|
| 30 |
+
->setId(null)
|
| 31 |
+
->setBatchId($this->getBatchModel()->getId())
|
| 32 |
+
->setBatchData($customergroup)
|
| 33 |
+
->setStatus(1)
|
| 34 |
+
->save();
|
| 35 |
+
|
| 36 |
+
//parse field list data to batch model
|
| 37 |
+
$this->getBatchModel()->parseFieldList($customergroup);
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
catch (Varien_Convert_Exception $e) {
|
| 41 |
+
throw $e;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
return $this;
|
| 45 |
+
|
| 46 |
+
}
|
| 47 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Dataflow/Batch/Io.php
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Oopsprofile_Model_Dataflow_Batch_Io extends Mage_Dataflow_Model_Batch_Io
|
| 3 |
+
{
|
| 4 |
+
public function openMulty($id,$write = true)
|
| 5 |
+
{
|
| 6 |
+
$mode = $write ? 'w+' : 'r+';
|
| 7 |
+
$ioConfig = array(
|
| 8 |
+
'path' => $this->getPath()
|
| 9 |
+
);
|
| 10 |
+
$this->getIoAdapter()->setAllowCreateFolders(true);
|
| 11 |
+
$this->getIoAdapter()->open($ioConfig);
|
| 12 |
+
$explodedata = explode('.',$this->getFile());
|
| 13 |
+
$Name = $explodedata[0].'_'.$id;
|
| 14 |
+
$fileName = $Name.'.'.$explodedata[1];
|
| 15 |
+
$this->getIoAdapter()->streamOpen($fileName, $mode);
|
| 16 |
+
|
| 17 |
+
$this->_fileSize = 0;
|
| 18 |
+
|
| 19 |
+
return $this;
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
?>
|
app/code/community/PI/Oopsprofile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
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Dataflow_Convert_Mapper_Column extends Mage_Dataflow_Model_Convert_Mapper_Column
|
| 4 |
+
{
|
| 5 |
+
public function map()
|
| 6 |
+
{
|
| 7 |
+
|
| 8 |
+
$batchModel = $this->getBatchModel();
|
| 9 |
+
$batchExport = $this->getBatchExportModel();
|
| 10 |
+
|
| 11 |
+
$batchExportIds = $batchExport
|
| 12 |
+
->setBatchId($this->getBatchModel()->getId())
|
| 13 |
+
->getIdCollection();
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
if ($this->getVar('map') && is_array($this->getVar('map'))) {
|
| 17 |
+
$attributesToSelect = $this->getVar('map');
|
| 18 |
+
}
|
| 19 |
+
else {
|
| 20 |
+
$attributesToSelect = array();
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
/**Fetch category mapping detail**/
|
| 25 |
+
$profileId = Mage::registry('current_convert_profile')->getId();
|
| 26 |
+
|
| 27 |
+
$oopsrofile = Mage::getModel('oopsprofile/oopsprofile')->getCollection()
|
| 28 |
+
->addFieldToFilter('dataflow_profile_id',$profileId)
|
| 29 |
+
->getFirstItem();
|
| 30 |
+
$selectedProfile = $oopsrofile->getProfileTemplate();
|
| 31 |
+
|
| 32 |
+
$tempModel = Mage::getModel('oopsprofile/template')->load($selectedProfile);
|
| 33 |
+
|
| 34 |
+
$categoryMapping = $tempModel->getCategoryMapping();
|
| 35 |
+
|
| 36 |
+
$mappingDetail = '';
|
| 37 |
+
|
| 38 |
+
if($categoryMapping!='')
|
| 39 |
+
{
|
| 40 |
+
$categoryMappingModel = Mage::getModel('oopsprofile/mapping')->load($categoryMapping);
|
| 41 |
+
$mappingDetail = unserialize($categoryMappingModel->getMappingDetail());
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
//print_r($categoryMapping);
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
foreach ($batchExportIds as $batchExportId) {
|
| 48 |
+
$batchExport = $this->getBatchExportModel()->load($batchExportId);
|
| 49 |
+
$row = $batchExport->getBatchData();
|
| 50 |
+
|
| 51 |
+
$newRow = array();
|
| 52 |
+
|
| 53 |
+
foreach($row as $field => $value)
|
| 54 |
+
{
|
| 55 |
+
|
| 56 |
+
if($field == 'category_ids' && $value!='')
|
| 57 |
+
{
|
| 58 |
+
$value = $this->_fetchCategoryNames($value,$mappingDetail);
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
if(!empty($attributesToSelect[$field])) //apply field mapping
|
| 62 |
+
{
|
| 63 |
+
$newRow[$attributesToSelect[$field]] = $value;
|
| 64 |
+
}
|
| 65 |
+
else
|
| 66 |
+
{
|
| 67 |
+
$newRow[$field] = $value;
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
$batchExport->setBatchData($newRow)
|
| 72 |
+
->setStatus(2)
|
| 73 |
+
->save();
|
| 74 |
+
$this->getBatchModel()->parseFieldList($batchExport->getBatchData());
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
//exit;
|
| 78 |
+
|
| 79 |
+
return $this;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
protected function _fetchCategoryNames($category_ids,$mappingDetail)
|
| 83 |
+
{
|
| 84 |
+
$category_ids = explode(',',$category_ids);
|
| 85 |
+
$categoryCollection = Mage::getModel('catalog/category')->getCollection()
|
| 86 |
+
->addAttributeToSelect('name')
|
| 87 |
+
->addAttributeToFilter('entity_id',array('in'=>array($category_ids)));
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
$categoryName = array();
|
| 91 |
+
foreach($categoryCollection as $category)
|
| 92 |
+
{
|
| 93 |
+
|
| 94 |
+
if(!empty($mappingDetail))
|
| 95 |
+
{
|
| 96 |
+
if(!empty($mappingDetail[$category->getId()]))
|
| 97 |
+
{
|
| 98 |
+
$categoryName[] = $mappingDetail[$category->getId()];
|
| 99 |
+
}
|
| 100 |
+
else
|
| 101 |
+
{
|
| 102 |
+
$categoryName[] = $category->getName();
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
else
|
| 106 |
+
{
|
| 107 |
+
$categoryName[] = $category->getName();
|
| 108 |
+
}
|
| 109 |
+
}
|
| 110 |
+
$categoryName = implode(',',$categoryName);
|
| 111 |
+
//echo '<pre>';print_r($categoryName);
|
| 112 |
+
return $categoryName;
|
| 113 |
+
}
|
| 114 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Dataflow/Profile.php
ADDED
|
@@ -0,0 +1,783 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
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
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Dataflow_Profile extends Mage_Dataflow_Model_Profile {
|
| 4 |
+
|
| 5 |
+
protected function _beforeSave() {
|
| 6 |
+
$data = $this->getData();
|
| 7 |
+
if(!empty($data['oops_profile']))
|
| 8 |
+
{
|
| 9 |
+
if ($data['oops_profile']) {//saving data for oops profile
|
| 10 |
+
$this->_oopsbeforeSave();
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
+
else
|
| 14 |
+
{
|
| 15 |
+
parent::_beforeSave();
|
| 16 |
+
}
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
**** Upload File On Basis of Profile Way ****
|
| 21 |
+
**/
|
| 22 |
+
protected function uploadImportFile($_files,$selectedFormat,$guiDataFile)
|
| 23 |
+
{
|
| 24 |
+
$profileWay = $guiDataFile['type'];
|
| 25 |
+
$fileName = $guiDataFile['filename'];
|
| 26 |
+
$filePath = $guiDataFile['path'];
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
$uplodedInfo = array();
|
| 30 |
+
|
| 31 |
+
/* Get the uploaded file information */
|
| 32 |
+
$name_of_uploaded_file = basename($_files['uploaded_file']['name']);
|
| 33 |
+
|
| 34 |
+
$type_of_uploaded_file = substr($name_of_uploaded_file, strrpos($name_of_uploaded_file, '.') + 1);
|
| 35 |
+
|
| 36 |
+
$size_of_uploaded_file = $_files["uploaded_file"]["size"] / 1024; //size in KBs
|
| 37 |
+
|
| 38 |
+
//Settings
|
| 39 |
+
$max_allowed_file_size = 1000; // size in KB
|
| 40 |
+
$allowed_extensions = array($selectedFormat);
|
| 41 |
+
|
| 42 |
+
if ($size_of_uploaded_file > $max_allowed_file_size)
|
| 43 |
+
{
|
| 44 |
+
$errors = Mage::helper('oopsprofile')->__("Size of uploded file should be less than $max_allowed_file_size KB");
|
| 45 |
+
Mage::throwException($errors);
|
| 46 |
+
}
|
| 47 |
+
if(!in_array($type_of_uploaded_file, $allowed_extensions))
|
| 48 |
+
{
|
| 49 |
+
$errors = Mage::helper('oopsprofile')->__("The uploaded file type $type_of_uploaded_file is not allowed for current profile");
|
| 50 |
+
Mage::throwException($errors);
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
if($fileName=='')//if filename is not defined
|
| 54 |
+
{
|
| 55 |
+
$fileName = $name_of_uploaded_file;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
//create path if not exist
|
| 59 |
+
if (!file_exists($filePath) && $filePath!='') {
|
| 60 |
+
mkdir($filePath, 0777, true);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
$tmp_path = $_files["uploaded_file"]["tmp_name"];
|
| 64 |
+
|
| 65 |
+
$fileWithPath = $filePath.'/'.$fileName;
|
| 66 |
+
|
| 67 |
+
if (is_uploaded_file($tmp_path))
|
| 68 |
+
{
|
| 69 |
+
switch($profileWay)
|
| 70 |
+
{
|
| 71 |
+
case 'file':
|
| 72 |
+
$localResource = new Varien_Io_File();
|
| 73 |
+
$localResource->write($fileWithPath, $tmp_path, 0777);
|
| 74 |
+
break;
|
| 75 |
+
case 'ftp':
|
| 76 |
+
case 'sftp':
|
| 77 |
+
$this->saveOnFtp($tmp_path,$fileName,$guiDataFile);
|
| 78 |
+
break;
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
$uplodedInfo['filename'] = $fileName;
|
| 83 |
+
|
| 84 |
+
return $uplodedInfo;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
Upload File on Ftp
|
| 90 |
+
**/
|
| 91 |
+
public function saveOnFtp($tmp_path,$fileName,$guiDataFile)
|
| 92 |
+
{
|
| 93 |
+
$file = $tmp_path;//temp file path on local server
|
| 94 |
+
$remote_file = $fileName;
|
| 95 |
+
|
| 96 |
+
// set up basic connection
|
| 97 |
+
$conn_id = ftp_connect($guiDataFile['host']);
|
| 98 |
+
|
| 99 |
+
// login with username and password
|
| 100 |
+
$login_result = ftp_login($conn_id, $guiDataFile['user'], $guiDataFile['password']);
|
| 101 |
+
|
| 102 |
+
if($guiDataFile['file_mode']==2)
|
| 103 |
+
{
|
| 104 |
+
$fileMode = FTP_BINARY;
|
| 105 |
+
}
|
| 106 |
+
else
|
| 107 |
+
{
|
| 108 |
+
$fileMode = FTP_ASCII;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
if($guiDataFile['path'])
|
| 113 |
+
{
|
| 114 |
+
$remote_file = $guiDataFile['path'].'/'.$remote_file;
|
| 115 |
+
$this->make_directory($conn_id, $guiDataFile['path']);
|
| 116 |
+
}
|
| 117 |
+
else
|
| 118 |
+
{
|
| 119 |
+
$remote_file = $remote_file;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
// upload a file
|
| 123 |
+
if (!ftp_put($conn_id, $remote_file, $file, $fileMode))
|
| 124 |
+
{
|
| 125 |
+
$message = Mage::helper('dataflow')->__('There was a problem while uploading '). $fileName;
|
| 126 |
+
Mage::throwException($message);
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
// close the connection and the file handler
|
| 130 |
+
ftp_close($conn_id);
|
| 131 |
+
|
| 132 |
+
return $this;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
/**
|
| 136 |
+
Recursively create directory on ftp
|
| 137 |
+
**/
|
| 138 |
+
public function make_directory($ftp_stream, $dir)
|
| 139 |
+
{
|
| 140 |
+
//if directory already exists or can be immediately created return true
|
| 141 |
+
if ($this->ftp_is_dir($ftp_stream, $dir) || @ftp_mkdir($ftp_stream, $dir))
|
| 142 |
+
return true;
|
| 143 |
+
|
| 144 |
+
//otherwise recursively try to make the directory
|
| 145 |
+
if (!$this->make_directory($ftp_stream, dirname($dir)))
|
| 146 |
+
return false;
|
| 147 |
+
|
| 148 |
+
// final step to create the directory
|
| 149 |
+
return ftp_mkdir($ftp_stream, $dir);
|
| 150 |
+
}
|
| 151 |
+
public function ftp_is_dir($ftp_stream, $dir)
|
| 152 |
+
{
|
| 153 |
+
// get current directory
|
| 154 |
+
$original_directory = ftp_pwd($ftp_stream);
|
| 155 |
+
|
| 156 |
+
if ( @ftp_chdir( $ftp_stream, $dir ) )
|
| 157 |
+
{
|
| 158 |
+
// If it is a directory, then change the directory back to the original directory
|
| 159 |
+
ftp_chdir( $ftp_stream, $original_directory );
|
| 160 |
+
return true;
|
| 161 |
+
}
|
| 162 |
+
else
|
| 163 |
+
{
|
| 164 |
+
return false;
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
protected function _oopsbeforeSave() {
|
| 173 |
+
if (!$this->getId()) {
|
| 174 |
+
$this->isObjectNew(true);
|
| 175 |
+
}
|
| 176 |
+
$actionsXML = $this->getData('actions_xml');
|
| 177 |
+
if (strlen($actionsXML) < 0 &&
|
| 178 |
+
@simplexml_load_string('<data>' . $actionsXML . '</data>', null, LIBXML_NOERROR) === false) {
|
| 179 |
+
Mage::throwException(Mage::helper('dataflow')->__("Actions XML is not valid."));
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
if (is_array($this->getGuiData())) {
|
| 183 |
+
$data = $this->getData();
|
| 184 |
+
//echo '<pre>';print_r($data);exit;
|
| 185 |
+
$guiData = $this->getGuiData();
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
/**
|
| 189 |
+
**** Apply Selected file format ****
|
| 190 |
+
**/
|
| 191 |
+
$guiFileName = explode('.',$guiData['file']['filename']);
|
| 192 |
+
$guiFileFormat='';
|
| 193 |
+
if(count($guiFileName)>1)//if file name has format
|
| 194 |
+
{
|
| 195 |
+
$guiFileFormat = array_pop($guiFileName);//fetch the format(fetch the last word of string and remove it from array)
|
| 196 |
+
}
|
| 197 |
+
$orgFileFormat = $guiData['parse']['type'];//selected file format
|
| 198 |
+
|
| 199 |
+
if($guiFileFormat != $orgFileFormat)//match file format
|
| 200 |
+
{
|
| 201 |
+
$guiData['file']['filename'] = implode('.',$guiFileName).'.'.$orgFileFormat;//add selected file format in file name
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
$charSingleList = array('\\', '/', '.', '!', '@', '#', '$', '%', '&', '*', '~', '^');
|
| 208 |
+
if (isset($teguiData['file']['type']) && $guiData['file']['type'] == 'file') {
|
| 209 |
+
if (empty($guiData['file']['path'])
|
| 210 |
+
|| (strlen($guiData['file']['path']) == 1
|
| 211 |
+
&& in_array($guiData['file']['path'], $charSingleList))) {
|
| 212 |
+
$guiData['file']['path'] = self::DEFAULT_EXPORT_PATH;
|
| 213 |
+
}
|
| 214 |
+
if (empty($guiData['file']['filename'])) {
|
| 215 |
+
$guiData['file']['filename'] = self::DEFAULT_EXPORT_FILENAME . $data['entity_type']
|
| 216 |
+
. '.' . $guiData['parse']['type'];
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
//validate export available path
|
| 220 |
+
$path = rtrim($guiData['file']['path'], '\\/')
|
| 221 |
+
. DS . $guiData['file']['filename'];
|
| 222 |
+
/** @var $validator Mage_Core_Model_File_Validator_AvailablePath */
|
| 223 |
+
$validator = Mage::getModel('core/file_validator_availablePath');
|
| 224 |
+
/** @var $helperImportExport Mage_ImportExport_Helper_Data */
|
| 225 |
+
$helperImportExport = Mage::helper('importexport');
|
| 226 |
+
$validator->setPaths($helperImportExport->getLocalValidPaths());
|
| 227 |
+
//echo $path;exit;
|
| 228 |
+
if (!$validator->isValid($path)) {
|
| 229 |
+
foreach ($validator->getMessages() as $message) {
|
| 230 |
+
Mage::throwException($message);
|
| 231 |
+
}
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
/**
|
| 236 |
+
**** If uploading a file and data transfer ways are "local/ftp/sftp" ****
|
| 237 |
+
**/
|
| 238 |
+
if($this->getDirection()=='import' && !empty($_FILES))
|
| 239 |
+
{
|
| 240 |
+
if($_FILES["uploaded_file"]['name']!='')
|
| 241 |
+
{
|
| 242 |
+
$uploadedData = $this->uploadImportFile($_FILES,$guiData['parse']['type'],$guiData['file']);
|
| 243 |
+
$guiData['file']['filename'] = $uploadedData['filename'];
|
| 244 |
+
}
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
$this->setGuiData($guiData);
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
if(isset($guiData['file']['type']) && ($guiData['file']['type'] == 'ftp' || $guiData['file']['type'] == 'sftp'))
|
| 251 |
+
{
|
| 252 |
+
|
| 253 |
+
/**
|
| 254 |
+
**** If uploading a file and data transfer ways are "local/ftp/sftp" ****
|
| 255 |
+
**/
|
| 256 |
+
if($this->getDirection()=='import' && !empty($_FILES))
|
| 257 |
+
{
|
| 258 |
+
if($_FILES["uploaded_file"]['name']!='')
|
| 259 |
+
{
|
| 260 |
+
$uploadedData = $this->uploadImportFile($_FILES,$guiData['parse']['type'],$guiData['file']);
|
| 261 |
+
$guiData['file']['filename'] = $uploadedData['filename'];
|
| 262 |
+
}
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
$this->setGuiData($guiData);
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
//generate and save the access token
|
| 269 |
+
$this->generateAuthUrlByService($guiData);
|
| 270 |
+
|
| 271 |
+
$this->_parseOopsGuiData();
|
| 272 |
+
|
| 273 |
+
$this->setGuiData(serialize($this->getGuiData()));
|
| 274 |
+
//echo '<pre>';print_r($guiData);exit;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
if ($this->_getResource()->isProfileExists($this->getName(), $this->getId())) {
|
| 278 |
+
Mage::throwException(Mage::helper('dataflow')->__("Profile with the same name already exists."));
|
| 279 |
+
}
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
protected function _saveAuthUrlToTable($service, $url){
|
| 283 |
+
$oopsProfile = Mage::getModel('oopsprofile/oopsprofile')->loadByProfile($this);
|
| 284 |
+
$oopsProfile->setServiceType($service)->setOauthUrl($url)->setIsTokenAvailable(0)->save();
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
/*
|
| 288 |
+
* generate the oAuth token by service
|
| 289 |
+
*/
|
| 290 |
+
protected function generateAuthUrlByService($guiData) {
|
| 291 |
+
|
| 292 |
+
$service = isset($guiData['email']['service_provider']) ? $guiData['email']['service_provider'] : null;
|
| 293 |
+
|
| 294 |
+
if (!is_null($service)) {
|
| 295 |
+
|
| 296 |
+
$path = Mage::getBaseDir('var') . DS . $service;
|
| 297 |
+
$file = 'oops_profile_mail_client.tmp';
|
| 298 |
+
|
| 299 |
+
switch ($service) {
|
| 300 |
+
case 'gmail':
|
| 301 |
+
|
| 302 |
+
$client = Mage::getSingleton('oopsprofile/mail_google_client');
|
| 303 |
+
|
| 304 |
+
$client->setClientId($guiData['email'][$service]['client_id']);
|
| 305 |
+
$client->setClientSecret($guiData['email'][$service]['client_secret']);
|
| 306 |
+
$client->setRedirectUri($guiData['email'][$service]['redirect_uri']);
|
| 307 |
+
$client->setDeveloperKey($guiData['email'][$service]['developer_key']);
|
| 308 |
+
|
| 309 |
+
$client->setScopes("https://mail.google.com/");
|
| 310 |
+
|
| 311 |
+
$authUrl = $client->createAuthUrl();
|
| 312 |
+
|
| 313 |
+
$io = new Varien_Io_File();
|
| 314 |
+
$io->setAllowCreateFolders(true);
|
| 315 |
+
$io->open(array('path' => $path));
|
| 316 |
+
$io->streamOpen($file, 'w');
|
| 317 |
+
$io->streamLock(true);
|
| 318 |
+
$guiData['profile_id'] = $this->getId();
|
| 319 |
+
$io->streamWrite(serialize($guiData));
|
| 320 |
+
$io->close();
|
| 321 |
+
|
| 322 |
+
$this->_saveAuthUrlToTable($service, $authUrl);
|
| 323 |
+
}
|
| 324 |
+
}
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
protected function _parseOopsGuiData() {
|
| 328 |
+
|
| 329 |
+
$nl = "\r\n";
|
| 330 |
+
$import = $this->getDirection() === 'import';
|
| 331 |
+
$p = $this->getGuiData();
|
| 332 |
+
|
| 333 |
+
$data = $this->getData();
|
| 334 |
+
|
| 335 |
+
//$profileTemplate = $data['profile_template'];
|
| 336 |
+
//$profileTemplate = $p['profile_template'];
|
| 337 |
+
$profileTemplate='';
|
| 338 |
+
|
| 339 |
+
$applyTemplate = false;
|
| 340 |
+
$tempMappingXml = '';
|
| 341 |
+
$tempDataXml = '';
|
| 342 |
+
|
| 343 |
+
if($profileTemplate!=0 && $this->getEntityType() == 'product')//if predefind template is selected
|
| 344 |
+
{
|
| 345 |
+
$applyTemplate = true;
|
| 346 |
+
|
| 347 |
+
$tempMappingXml = $p['field_mapping_xml'];
|
| 348 |
+
|
| 349 |
+
$tempDataXml = $p['data_format_xml'];
|
| 350 |
+
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
//parent::_parseGuiData();
|
| 356 |
+
switch ($this->getDataTransfer()) {
|
| 357 |
+
case 'email':
|
| 358 |
+
$setXml = $this->generateEmailXML($nl, $import, $p);
|
| 359 |
+
break;
|
| 360 |
+
case 'file':
|
| 361 |
+
$setXml = $this->generateFileXML($nl, $import, $p);
|
| 362 |
+
break;
|
| 363 |
+
case 'http':
|
| 364 |
+
$setXml = $this->generateHttpXML($nl, $import, $p);
|
| 365 |
+
break;
|
| 366 |
+
case 'api':
|
| 367 |
+
$setXml = $this->generateApiXML($nl, $import, $p);
|
| 368 |
+
break;
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
|
| 372 |
+
if ($import) {
|
| 373 |
+
$setXml .= '<var name="format"><![CDATA[' . $p['parse']['type'] . ']]></var>' . $nl;
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
$setXml .= '</action>' . $nl . $nl;
|
| 377 |
+
|
| 378 |
+
|
| 379 |
+
if($this->getDataTransfer()=='api')
|
| 380 |
+
{
|
| 381 |
+
$p['parse']['type'] = 'xml';
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
switch ($p['parse']['type']) {
|
| 385 |
+
case 'csv':
|
| 386 |
+
$parseXml = '<action type="oopsprofile/convert_parser_csv" method="'
|
| 387 |
+
. ($import ? 'parse' : 'unparse') . '">' . $nl;
|
| 388 |
+
|
| 389 |
+
if($applyTemplate)//if predefind template is selected
|
| 390 |
+
{
|
| 391 |
+
$parseXml .= $tempDataXml;
|
| 392 |
+
}
|
| 393 |
+
else
|
| 394 |
+
{
|
| 395 |
+
$parseXml .= ' <var name="delimiter"><![CDATA['
|
| 396 |
+
. $p['parse']['csv']['delimiter'] . ']]></var>' . $nl;
|
| 397 |
+
$parseXml .= ' <var name="enclose"><![CDATA['
|
| 398 |
+
. $p['parse']['csv']['enclose'] . ']]></var>' . $nl;
|
| 399 |
+
}
|
| 400 |
+
break;
|
| 401 |
+
case 'txt':
|
| 402 |
+
$parseXml = '<action type="oopsprofile/convert_parser_txt" method="'
|
| 403 |
+
. ($import ? 'parse' : 'unparse') . '">' . $nl;
|
| 404 |
+
if($applyTemplate)//if predefind template is selected
|
| 405 |
+
{
|
| 406 |
+
$parseXml .= $tempDataXml;
|
| 407 |
+
}
|
| 408 |
+
else
|
| 409 |
+
{
|
| 410 |
+
$parseXml .= ' <var name="delimiter"><![CDATA['
|
| 411 |
+
. $p['parse']['txt']['delimiter'] . ']]></var>' . $nl;
|
| 412 |
+
$parseXml .= ' <var name="enclose"><![CDATA['
|
| 413 |
+
. $p['parse']['txt']['enclose'] . ']]></var>' . $nl;
|
| 414 |
+
}
|
| 415 |
+
break;
|
| 416 |
+
case 'xml':
|
| 417 |
+
$parseXml = '<action type="oopsprofile/convert_parser_xml" method="'
|
| 418 |
+
. ($import ? 'parse' : 'unparse') . '">' . $nl;
|
| 419 |
+
|
| 420 |
+
$parseXml .= ' <var name="entity_type">'. $this->getEntityType() .'</var>' . $nl;
|
| 421 |
+
|
| 422 |
+
$parseXml .= ' <var name="profile_template">'. $profileTemplate .'</var>' . $nl;
|
| 423 |
+
|
| 424 |
+
if($import && $this->getDataTransfer()=='api')
|
| 425 |
+
{
|
| 426 |
+
$parseXml .= ' <var name="data_transfer">api</var>' . $nl;
|
| 427 |
+
$parseXml .= ' <var name="apiurl">'. $p['api']['url'] .'</var>' . $nl;
|
| 428 |
+
$parseXml .= ' <var name="apikey">'. $p['api']['key'] .'</var>' . $nl;
|
| 429 |
+
$parseXml .= ' <var name="apiuser">'. $p['api']['user'] .'</var>' . $nl;
|
| 430 |
+
$parseXml .= ' <var name="apimethod">'. $p['api']['method'] .'</var>' . $nl;
|
| 431 |
+
$parseXml .= ' <var name="apiprofileId">'. $p['api']['profileId'] .'</var>' . $nl;
|
| 432 |
+
}
|
| 433 |
+
break;
|
| 434 |
+
case 'xls':
|
| 435 |
+
$parseXml = '<action type="oopsprofile/convert_parser_xls" method="'
|
| 436 |
+
. ($import ? 'parse' : 'unparse') . '">' . $nl;
|
| 437 |
+
|
| 438 |
+
if($this->getDataTransfer()=='file')
|
| 439 |
+
{
|
| 440 |
+
$parseXml .= ' <var name="path">' . $p['file']['path'] . '</var>' . $nl;
|
| 441 |
+
$parseXml .= ' <var name="filename"><![CDATA[' . $p['file']['filename'] . ']]></var>' . $nl;
|
| 442 |
+
$parseXml .= ' <var name="filetype">' . $p['file']['type'] . '</var>' . $nl;
|
| 443 |
+
|
| 444 |
+
}
|
| 445 |
+
if($this->getDataTransfer()=='http')
|
| 446 |
+
{
|
| 447 |
+
$parseXml .= ' <var name="filetype">http</var>' . $nl;
|
| 448 |
+
$parseXml .= ' <var name="entitytype">'.$this->getEntityType().'</var>' . $nl;
|
| 449 |
+
}
|
| 450 |
+
if($applyTemplate)//if predefind template is selected
|
| 451 |
+
{
|
| 452 |
+
$parseXml .= $tempDataXml;
|
| 453 |
+
}
|
| 454 |
+
break;
|
| 455 |
+
case 'xlsx':
|
| 456 |
+
$parseXml = '<action type="oopsprofile/convert_parser_xlsx" method="'
|
| 457 |
+
. ($import ? 'parse' : 'unparse') . '">' . $nl;
|
| 458 |
+
|
| 459 |
+
if($this->getDataTransfer()=='file')
|
| 460 |
+
{
|
| 461 |
+
$parseXml .= ' <var name="path">' . $p['file']['path'] . '</var>' . $nl;
|
| 462 |
+
$parseXml .= ' <var name="filename"><![CDATA[' . $p['file']['filename'] . ']]></var>' . $nl;
|
| 463 |
+
$parseXml .= ' <var name="filetype">' . $p['file']['type'] . '</var>' . $nl;
|
| 464 |
+
}
|
| 465 |
+
if($this->getDataTransfer()=='http')
|
| 466 |
+
{
|
| 467 |
+
$parseXml .= ' <var name="filetype">http</var>' . $nl;
|
| 468 |
+
$parseXml .= ' <var name="entitytype">'.$this->getEntityType().'</var>' . $nl;
|
| 469 |
+
}
|
| 470 |
+
if($applyTemplate)//if predefind template is selected
|
| 471 |
+
{
|
| 472 |
+
$parseXml .= $tempDataXml;
|
| 473 |
+
}
|
| 474 |
+
break;
|
| 475 |
+
}
|
| 476 |
+
if(!$applyTemplate)//if predefind template is not selected
|
| 477 |
+
{
|
| 478 |
+
$parseXml .= ' <var name="fieldnames">' . $p['parse']['fieldnames'] . '</var>' . $nl;
|
| 479 |
+
}
|
| 480 |
+
$parseXmlInter = $parseXml;
|
| 481 |
+
$parseXml .= '</action>' . $nl . $nl;
|
| 482 |
+
|
| 483 |
+
|
| 484 |
+
$mapXml = '';
|
| 485 |
+
|
| 486 |
+
if (isset($p['map']) && is_array($p['map'])) {
|
| 487 |
+
foreach ($p['map'] as $side => $fields) {
|
| 488 |
+
if (!is_array($fields)) {
|
| 489 |
+
continue;
|
| 490 |
+
}
|
| 491 |
+
foreach ($fields['db'] as $i => $k) {
|
| 492 |
+
if ($k == '' || $k == '0') {
|
| 493 |
+
unset($p['map'][$side]['db'][$i]); //DB FIELD
|
| 494 |
+
unset($p['map'][$side]['file'][$i]); //MAPPING FIELD
|
| 495 |
+
}
|
| 496 |
+
}
|
| 497 |
+
}
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
if($applyTemplate)//if predefind template is selected
|
| 501 |
+
{
|
| 502 |
+
|
| 503 |
+
$tempMappingData = unserialize($tempMappingXml);
|
| 504 |
+
$parseXmlInter .= ' <var name="map">' . $nl;
|
| 505 |
+
$mapXml .= '<action type="oopsprofile/dataflow_convert_mapper_column" method="map">' . $nl;
|
| 506 |
+
$mapXml .= ' <var name="map">' . $nl;
|
| 507 |
+
if($tempMappingXml!='')
|
| 508 |
+
{
|
| 509 |
+
foreach ($tempMappingData as $key => $value) {
|
| 510 |
+
$mapXml .= ' <map name="' . $key . '"><![CDATA[' . $value . ']]></map>' . $nl;
|
| 511 |
+
$parseXmlInter .= ' <map name="' . $value . '"><![CDATA[' . $key . ']]></map>' . $nl;
|
| 512 |
+
}
|
| 513 |
+
}
|
| 514 |
+
$mapXml .= ' </var>' . $nl;
|
| 515 |
+
$parseXmlInter .= ' </var>' . $nl;
|
| 516 |
+
$mapXml .= '</action>' . $nl . $nl;
|
| 517 |
+
|
| 518 |
+
}
|
| 519 |
+
else
|
| 520 |
+
{
|
| 521 |
+
$enable = '';
|
| 522 |
+
if($this->getEnableContent()!=NULL)
|
| 523 |
+
{
|
| 524 |
+
$enable = $this->getEnableContent();
|
| 525 |
+
}
|
| 526 |
+
else //saving from outside
|
| 527 |
+
{
|
| 528 |
+
$DataflowId = $this->getProfileId();
|
| 529 |
+
$oopsProfile = Mage::getModel('oopsprofile/oopsprofile')->getCollection()
|
| 530 |
+
->addFieldToFilter('dataflow_profile_id',$DataflowId)
|
| 531 |
+
->getFirstItem();
|
| 532 |
+
$enable = $oopsProfile->getEnableContent();
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
|
| 536 |
+
if($p['parse']['type'] == 'xml' && $enable == 1)
|
| 537 |
+
{
|
| 538 |
+
$mapXml .= '<action type="oopsprofile/dataflow_convert_mapper_column" method="map">' . $nl;
|
| 539 |
+
$mapXml .= '</action>' . $nl . $nl;
|
| 540 |
+
}
|
| 541 |
+
else
|
| 542 |
+
{
|
| 543 |
+
|
| 544 |
+
/**Apply Mapping**/
|
| 545 |
+
if($this->getEntityType()!='customergroup')
|
| 546 |
+
{
|
| 547 |
+
$mapXml .= '<action type="dataflow/convert_mapper_column" method="map">' . $nl;
|
| 548 |
+
$map = $p['map'][$this->getEntityType()];
|
| 549 |
+
if (sizeof($map['db']) > 0) {
|
| 550 |
+
$from = $map[$import ? 'file' : 'db'];
|
| 551 |
+
$to = $map[$import ? 'db' : 'file'];
|
| 552 |
+
$mapXml .= ' <var name="map">' . $nl;
|
| 553 |
+
$parseXmlInter .= ' <var name="map">' . $nl;
|
| 554 |
+
foreach ($from as $i => $f) {
|
| 555 |
+
$mapXml .= ' <map name="' . $f . '"><![CDATA[' . $to[$i] . ']]></map>' . $nl;
|
| 556 |
+
$parseXmlInter .= ' <map name="' . $f . '"><![CDATA[' . $to[$i] . ']]></map>' . $nl;
|
| 557 |
+
}
|
| 558 |
+
$mapXml .= ' </var>' . $nl;
|
| 559 |
+
$parseXmlInter .= ' </var>' . $nl;
|
| 560 |
+
}
|
| 561 |
+
if ($p['map']['only_specified']) {
|
| 562 |
+
$mapXml .= ' <var name="_only_specified">' . $p['map']['only_specified'] . '</var>' . $nl;
|
| 563 |
+
//$mapXml .= ' <var name="map">' . $nl;
|
| 564 |
+
$parseXmlInter .= ' <var name="_only_specified">' . $p['map']['only_specified'] . '</var>' . $nl;
|
| 565 |
+
}
|
| 566 |
+
$mapXml .= '</action>' . $nl . $nl;
|
| 567 |
+
}
|
| 568 |
+
}
|
| 569 |
+
}
|
| 570 |
+
|
| 571 |
+
$parsers = array(
|
| 572 |
+
'product' => 'oopsprofile/product_convert_parser_product',
|
| 573 |
+
'customer' => 'customer/convert_parser_customer',
|
| 574 |
+
'customergroup' => 'oopsprofile/customergroup_convert_parser_customergroup',
|
| 575 |
+
'order' => 'oopsprofile/order_convert_parser_order',
|
| 576 |
+
'shipment' => 'oopsprofile/shipment_convert_parser_shipment',
|
| 577 |
+
'invoice' => 'oopsprofile/invoice_convert_parser_invoice',
|
| 578 |
+
'creditmemo' => 'oopsprofile/creditmemo_convert_parser_creditmemo',
|
| 579 |
+
);
|
| 580 |
+
|
| 581 |
+
if ($import) {
|
| 582 |
+
|
| 583 |
+
$parseXmlInter .= ' <var name="store"><![CDATA[' . $this->getStoreId() . ']]></var>' . $nl;
|
| 584 |
+
} else {
|
| 585 |
+
$parseDataXml = '<action type="' . $parsers[$this->getEntityType()] . '" method="unparse">' . $nl;
|
| 586 |
+
$parseDataXml .= ' <var name="store"><![CDATA[' . $this->getStoreId() . ']]></var>' . $nl;
|
| 587 |
+
if (isset($p['export']['add_url_field'])) {
|
| 588 |
+
$parseDataXml .= ' <var name="url_field"><![CDATA['
|
| 589 |
+
. $p['export']['add_url_field'] . ']]></var>' . $nl;
|
| 590 |
+
}
|
| 591 |
+
$parseDataXml .= '</action>' . $nl . $nl;
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
|
| 595 |
+
|
| 596 |
+
$adapters = array(
|
| 597 |
+
'product' => 'oopsprofile/product_convert_adapter_product',
|
| 598 |
+
'customer' => 'customer/convert_adapter_customer',
|
| 599 |
+
'customergroup' => 'oopsprofile/customergroup_convert_adapter_customergroup',
|
| 600 |
+
'order' => 'oopsprofile/order_convert_adapter_order',
|
| 601 |
+
'shipment' => 'oopsprofile/shipment_convert_adapter_shipment',
|
| 602 |
+
'invoice' => 'oopsprofile/invoice_convert_adapter_invoice',
|
| 603 |
+
'creditmemo' => 'oopsprofile/creditmemo_convert_adapter_creditmemo',
|
| 604 |
+
);
|
| 605 |
+
|
| 606 |
+
if ($import) {
|
| 607 |
+
$entityXml = '<action type="' . $adapters[$this->getEntityType()] . '" method="save">' . $nl;
|
| 608 |
+
$entityXml .= ' <var name="store"><![CDATA[' . $this->getStoreId() . ']]></var>' . $nl;
|
| 609 |
+
$entityXml .= '</action>' . $nl . $nl;
|
| 610 |
+
} else {
|
| 611 |
+
$entityXml = '<action type="' . $adapters[$this->getEntityType()] . '" method="load">' . $nl;
|
| 612 |
+
$entityXml .= ' <var name="store"><![CDATA[' . $this->getStoreId() . ']]></var>' . $nl;
|
| 613 |
+
if($p['filter']['fromdate']!='')
|
| 614 |
+
{
|
| 615 |
+
$entityXml .= ' <var name="fromdate">' . $p['filter']['fromdate'] . '</var>' . $nl;
|
| 616 |
+
}
|
| 617 |
+
if($p['filter']['todate']!='')
|
| 618 |
+
{
|
| 619 |
+
$entityXml .= ' <var name="todate">' . $p['filter']['todate'] . '</var>' . $nl;
|
| 620 |
+
}
|
| 621 |
+
if(!empty($p['filter']['hiddentype']))
|
| 622 |
+
{
|
| 623 |
+
$filters = $p['filter']['hiddentype'];
|
| 624 |
+
$count = count($filters);
|
| 625 |
+
$i = 1;
|
| 626 |
+
$entityXml .= ' <var name="hiddentype">';
|
| 627 |
+
foreach($filters as $filter)
|
| 628 |
+
{
|
| 629 |
+
$entityXml .= $filter ;
|
| 630 |
+
if($count != $i++)
|
| 631 |
+
{
|
| 632 |
+
$entityXml .= ',' ;
|
| 633 |
+
}
|
| 634 |
+
}
|
| 635 |
+
$entityXml .= '</var>' . $nl;
|
| 636 |
+
}
|
| 637 |
+
$entityXml .= '</action>' . $nl . $nl;
|
| 638 |
+
}
|
| 639 |
+
|
| 640 |
+
// Need to rewrite the whole xml action format
|
| 641 |
+
if ($import) {
|
| 642 |
+
|
| 643 |
+
$xml = $setXml;
|
| 644 |
+
$xml .= $parseXmlInter;
|
| 645 |
+
|
| 646 |
+
$xml .= ' <var name="root_catalog_id"></var>' . $nl;
|
| 647 |
+
$xml .= ' <var name="reimport_images"><![CDATA[true]]></var>' . $nl;
|
| 648 |
+
$xml .= ' <var name="deleteall_andreimport_images"><![CDATA[true]]></var>' . $nl;
|
| 649 |
+
$xml .= ' <var name="exclude_images"><![CDATA[false]]></var>' . $nl;
|
| 650 |
+
$xml .= ' <var name="exclude_gallery_images"><![CDATA[false]]></var>' . $nl;
|
| 651 |
+
$xml .= ' <var name="append_tier_prices"><![CDATA[true]]></var>' . $nl;
|
| 652 |
+
$xml .= ' <var name="append_group_prices"><![CDATA[false]]></var>' . $nl;
|
| 653 |
+
$xml .= ' <var name="append_categories"><![CDATA[false]]></var>' . $nl;
|
| 654 |
+
|
| 655 |
+
|
| 656 |
+
$xml .= ' <var name="adapter">' . $adapters[$this->getEntityType()] . '</var>' . $nl;
|
| 657 |
+
$xml .= ' <var name="method">parse</var>' . $nl;
|
| 658 |
+
$xml .= '</action>';
|
| 659 |
+
} else {
|
| 660 |
+
$xml = $entityXml . $parseDataXml . $mapXml . $parseXml . $setXml;
|
| 661 |
+
}
|
| 662 |
+
|
| 663 |
+
$this->setGuiData($p);
|
| 664 |
+
$this->setActionsXml($xml);
|
| 665 |
+
|
| 666 |
+
/* echo "<pre>" . print_r($p,1) . "</pre>";
|
| 667 |
+
echo "<xmp>" . $xml . "</xmp>";
|
| 668 |
+
die; */
|
| 669 |
+
return $this;
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
+
protected function generateApiXML($nl, $import, $p) {
|
| 673 |
+
$apiXml = '<action type="oopsprofile/convert_adapter_api" method="'
|
| 674 |
+
. ($import ? 'load' : 'save') . '">' . $nl;
|
| 675 |
+
|
| 676 |
+
$apiXml .= ' <var name="entitytype">'. $this->getEntityType() .'</var>' . $nl;
|
| 677 |
+
|
| 678 |
+
return $apiXml;
|
| 679 |
+
}
|
| 680 |
+
|
| 681 |
+
protected function generateHttpXML($nl, $import, $p) {
|
| 682 |
+
$httpXml = '<action type="oopsprofile/convert_adapter_http" method="'
|
| 683 |
+
. ($import ? 'load' : 'save') . '">' . $nl;
|
| 684 |
+
|
| 685 |
+
$httpXml .= ' <var name="fileformat">' . $p['parse']['type'] . '</var>' . $nl;
|
| 686 |
+
$httpXml .= ' <var name="entitytype">'. $this->getEntityType() .'</var>' . $nl;
|
| 687 |
+
|
| 688 |
+
return $httpXml;
|
| 689 |
+
}
|
| 690 |
+
|
| 691 |
+
protected function generateEmailXML($nl, $import, $p) {
|
| 692 |
+
|
| 693 |
+
$fileName = Mage::helper('oopsprofile/mail')->getFileNameWithPrefix($p['email']['mailsubject']);
|
| 694 |
+
|
| 695 |
+
$emailXml = '<action type="oopsprofile/convert_adapter_mail" method="'. ($import ? 'load' : 'save') . '">' . $nl;
|
| 696 |
+
|
| 697 |
+
if(isset($p['email']['service_provider']) && $p['email']['service_provider'] != null){
|
| 698 |
+
|
| 699 |
+
$emailXml .= ' <var name="service_provider">' . $p['email']['service_provider'] . '</var>' . $nl;
|
| 700 |
+
$emailXml .= ' <var name="' . $p['email']['service_provider'] . '_client_id"><![CDATA[' . $p['email'][$p['email']['service_provider']]['client_id'] . ']]></var>' . $nl;
|
| 701 |
+
$emailXml .= ' <var name="' . $p['email']['service_provider'] . '_client_secret"><![CDATA[' . $p['email'][$p['email']['service_provider']]['client_secret'] . ']]></var>' . $nl;
|
| 702 |
+
$emailXml .= ' <var name="' . $p['email']['service_provider'] . '_redirect_uri"><![CDATA[' . $p['email'][$p['email']['service_provider']]['redirect_uri'] . ']]></var>' . $nl;
|
| 703 |
+
$emailXml .= ' <var name="' . $p['email']['service_provider'] . '_developer_key"><![CDATA[' . $p['email'][$p['email']['service_provider']]['developer_key'] . ']]></var>' . $nl;
|
| 704 |
+
}
|
| 705 |
+
|
| 706 |
+
$emailXml .= ' <var name="host">' . $p['email']['host'] . '</var>' . $nl;
|
| 707 |
+
$emailXml .= ' <var name="port">' . $p['email']['port'] . '</var>' . $nl;
|
| 708 |
+
$emailXml .= ' <var name="username"><![CDATA[' . $p['email']['username'] . ']]></var>' . $nl;
|
| 709 |
+
$emailXml .= ' <var name="password"><![CDATA[' . $p['email']['pass'] . ']]></var>' . $nl;
|
| 710 |
+
$emailXml .= ' <var name="mailsubject"><![CDATA[' . $p['email']['mailsubject'] . ']]></var>' . $nl;
|
| 711 |
+
$emailXml .= ' <var name="emailto"><![CDATA[' . $p['email']['sendto'] . ']]></var>' . $nl;
|
| 712 |
+
$emailXml .= ' <var name="attachmentsavepath"><![CDATA[' . $p['email']['attachmentsavepath'] . ']]></var>' . $nl;
|
| 713 |
+
$emailXml .= ' <var name="deleteattachment"></var>' . $nl;
|
| 714 |
+
$emailXml .= ' <var name="checkonlynewmsgs"></var>' . $nl;
|
| 715 |
+
if (!$import) {
|
| 716 |
+
$emailXml .= ' <var name="filename">' . $fileName . '.' . $p['parse']['type'] . '</var>' . $nl;
|
| 717 |
+
}
|
| 718 |
+
|
| 719 |
+
|
| 720 |
+
return $emailXml;
|
| 721 |
+
}
|
| 722 |
+
|
| 723 |
+
protected function generateFileXML($nl, $import, $p) {
|
| 724 |
+
|
| 725 |
+
//if($p['parse']['type']=='xml' || $p['parse']['type']=='xls' || $p['parse']['type']=='xlsx')
|
| 726 |
+
//{
|
| 727 |
+
$fileXml = '<action type="oopsprofile/convert_adapter_io" method="'
|
| 728 |
+
. ($import ? 'load' : 'save') . '">' . $nl;
|
| 729 |
+
/* }
|
| 730 |
+
else
|
| 731 |
+
{
|
| 732 |
+
$fileXml = '<action type="dataflow/convert_adapter_io" method="'
|
| 733 |
+
. ($import ? 'load' : 'save') . '">' . $nl;
|
| 734 |
+
}*/
|
| 735 |
+
|
| 736 |
+
$fileXml .= ' <var name="fileformat">' . $p['parse']['type'] . '</var>' . $nl;
|
| 737 |
+
|
| 738 |
+
|
| 739 |
+
$fileXml .= ' <var name="type">' . $p['file']['type'] . '</var>' . $nl;
|
| 740 |
+
$fileXml .= ' <var name="path">' . $p['file']['path'] . '</var>' . $nl;
|
| 741 |
+
$fileXml .= ' <var name="filename"><![CDATA[' . $p['file']['filename'] . ']]></var>' . $nl;
|
| 742 |
+
if ($p['file']['type'] === 'ftp') {
|
| 743 |
+
$hostArr = explode(':', $p['file']['host']);
|
| 744 |
+
$fileXml .= ' <var name="host"><![CDATA[' . $hostArr[0] . ']]></var>' . $nl;
|
| 745 |
+
if (isset($hostArr[1])) {
|
| 746 |
+
$fileXml .= ' <var name="port"><![CDATA[' . $hostArr[1] . ']]></var>' . $nl;
|
| 747 |
+
}
|
| 748 |
+
if (!empty($p['file']['passive'])) {
|
| 749 |
+
$fileXml .= ' <var name="passive">true</var>' . $nl;
|
| 750 |
+
}
|
| 751 |
+
if ((!empty($p['file']['file_mode']))
|
| 752 |
+
&& ($p['file']['file_mode'] == FTP_ASCII || $p['file']['file_mode'] == FTP_BINARY)
|
| 753 |
+
) {
|
| 754 |
+
$fileXml .= ' <var name="file_mode">' . $p['file']['file_mode'] . '</var>' . $nl;
|
| 755 |
+
}
|
| 756 |
+
if (!empty($p['file']['user'])) {
|
| 757 |
+
$fileXml .= ' <var name="user"><![CDATA[' . $p['file']['user'] . ']]></var>' . $nl;
|
| 758 |
+
}
|
| 759 |
+
if (!empty($p['file']['password'])) {
|
| 760 |
+
$fileXml .= ' <var name="password"><![CDATA[' . $p['file']['password'] . ']]></var>' . $nl;
|
| 761 |
+
}
|
| 762 |
+
}
|
| 763 |
+
|
| 764 |
+
if ($p['file']['type'] === 'sftp') {
|
| 765 |
+
$hostArr = explode(':', $p['file']['host']);
|
| 766 |
+
$fileXml .= ' <var name="host"><![CDATA[' . $hostArr[0] . ']]></var>' . $nl;
|
| 767 |
+
if (isset($hostArr[1])) {
|
| 768 |
+
$fileXml .= ' <var name="port"><![CDATA[' . $hostArr[1] . ']]></var>' . $nl;
|
| 769 |
+
}
|
| 770 |
+
if (!empty($p['file']['user'])) {
|
| 771 |
+
$fileXml .= ' <var name="username"><![CDATA[' . $p['file']['user'] . ']]></var>' . $nl;
|
| 772 |
+
}
|
| 773 |
+
if (!empty($p['file']['password'])) {
|
| 774 |
+
$fileXml .= ' <var name="password"><![CDATA[' . $p['file']['password'] . ']]></var>' . $nl;
|
| 775 |
+
}
|
| 776 |
+
}
|
| 777 |
+
|
| 778 |
+
|
| 779 |
+
return $fileXml;
|
| 780 |
+
}
|
| 781 |
+
|
| 782 |
+
}
|
| 783 |
+
|
app/code/community/PI/Oopsprofile/Model/Dataflow/Profile/History.php
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Oopsprofile_Model_Dataflow_Profile_History extends Mage_Dataflow_Model_Profile_History
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
protected function _beforeSave()
|
| 6 |
+
{
|
| 7 |
+
if (!$this->getProfileId()) {
|
| 8 |
+
$profile = Mage::registry('current_convert_profile');
|
| 9 |
+
if ($profile) {
|
| 10 |
+
$this->setProfileId($profile->getId());
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
//set current user id
|
| 15 |
+
$adminUserId = Mage::getSingleton('admin/session')->getUser()->getId();
|
| 16 |
+
if(!empty($adminUserId))
|
| 17 |
+
{
|
| 18 |
+
$this->setUserId($adminUserId);
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
if(!$this->hasData('user_id')) {
|
| 22 |
+
$this->setUserId(0);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
parent::_beforeSave();
|
| 26 |
+
return $this;
|
| 27 |
+
}
|
| 28 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Mail.php
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Mail extends Zend_Mail{
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
public function sendMailWithAttachment($config){
|
| 9 |
+
|
| 10 |
+
$filename = $config['filename'];
|
| 11 |
+
$filepath = $config['path'];
|
| 12 |
+
$storeId = Mage::app()->getStore()->getId();
|
| 13 |
+
|
| 14 |
+
$timestamp = Mage::app()->getLocale()->storeDate($storeId);
|
| 15 |
+
|
| 16 |
+
$mailTo = explode(',', $config['emailto']);
|
| 17 |
+
if(!empty($mailTo)){
|
| 18 |
+
$serviceProvider = isset($config['service_provider']) ? $config['service_provider'] : null;
|
| 19 |
+
switch($serviceProvider){
|
| 20 |
+
case 'gmail':
|
| 21 |
+
$email = $config['username']. '@' .'gmail.com';
|
| 22 |
+
break;
|
| 23 |
+
default:
|
| 24 |
+
$email = $config['username'];
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
$this->addTo($mailTo);
|
| 28 |
+
$this->setFrom($email);
|
| 29 |
+
$this->setSubject($config['mailsubject']);
|
| 30 |
+
$this->setBodyHtml(sprintf('File generated at: %s </br> Filename: %s', $timestamp, $filename));
|
| 31 |
+
$this->addFileAsAttachment($filename, $filepath);
|
| 32 |
+
try{
|
| 33 |
+
$this->send();
|
| 34 |
+
}catch(Exception $e){
|
| 35 |
+
Mage::log($e);
|
| 36 |
+
Mage::throwException($e->getMessage());
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
protected function addFileAsAttachment($filename, $filepath){
|
| 42 |
+
|
| 43 |
+
$fullPath = $filepath . DS . $filename ;
|
| 44 |
+
$filedata = file_get_contents($fullPath);
|
| 45 |
+
$this->createAttachment(
|
| 46 |
+
$filedata,
|
| 47 |
+
Zend_Mime::TYPE_OCTETSTREAM,
|
| 48 |
+
Zend_Mime::DISPOSITION_ATTACHMENT,
|
| 49 |
+
Zend_Mime::ENCODING_BASE64,
|
| 50 |
+
$filename
|
| 51 |
+
);
|
| 52 |
+
return $this;
|
| 53 |
+
}
|
| 54 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Mysql4/Oopsprofile.php
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Mysql4_Oopsprofile extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
// Note that the oops_profile_id refers to the key field in your database table.
|
| 8 |
+
$this->_init('oopsprofile/oopsprofile', 'oops_profile_id');
|
| 9 |
+
}
|
| 10 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Mysql4/Oopsprofile/Collection.php
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Mysql4_Oopsprofile_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('oopsprofile/oopsprofile');
|
| 9 |
+
}
|
| 10 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Oopsprofile.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Oopsprofile extends Mage_Core_Model_Abstract
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
protected $_eventPrefix = 'oopsprofile_profile';
|
| 7 |
+
protected $_eventObject = 'oopsprofile';
|
| 8 |
+
|
| 9 |
+
public function _construct(){
|
| 10 |
+
parent::_construct();
|
| 11 |
+
$this->_init('oopsprofile/oopsprofile');
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
public function loadByProfile($profile){
|
| 16 |
+
|
| 17 |
+
if(is_numeric($profile)){
|
| 18 |
+
$profile = Mage::getModel('dataflow/profile')->load($profile);
|
| 19 |
+
}
|
| 20 |
+
$collection = Mage::getResourceModel('oopsprofile/oopsprofile_collection');
|
| 21 |
+
$collection->addFieldToFilter('dataflow_profile_id', $profile->getId());
|
| 22 |
+
|
| 23 |
+
$oopsProfile = $collection->getFirstItem();
|
| 24 |
+
return $oopsProfile;
|
| 25 |
+
}
|
| 26 |
+
}
|
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Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Oopsprofile_Model_Oopsprofileapi extends Mage_Api_Model_Resource_Abstract
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
public function exportproductdata($request)
|
| 6 |
+
{
|
| 7 |
+
try
|
| 8 |
+
{
|
| 9 |
+
$filename = Mage::getBaseDir().'/apiexport/export_product_'.$request['profileid'].'.xml';
|
| 10 |
+
if(glob($filename))
|
| 11 |
+
{
|
| 12 |
+
$xmlInstance = new Varien_Simplexml_Config($filename);
|
| 13 |
+
$xml = $xmlInstance->getNode()->asNiceXml();
|
| 14 |
+
return $xml;
|
| 15 |
+
}
|
| 16 |
+
else
|
| 17 |
+
{
|
| 18 |
+
return "<error>".Mage::helper('oopsprofile')->__('No Data Exist For Current Details')."</error>";
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
catch (Exception $e)
|
| 23 |
+
{
|
| 24 |
+
// fault with the code tag data_invalid
|
| 25 |
+
$this->_fault('data_invalid', $e->getMessage());
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
public function exportcustomerdata($request)
|
| 29 |
+
{
|
| 30 |
+
try
|
| 31 |
+
{
|
| 32 |
+
$filename = Mage::getBaseDir().'/apiexport/export_customer_'.$request['profileid'].'.xml';
|
| 33 |
+
if(glob($filename))
|
| 34 |
+
{
|
| 35 |
+
$xmlInstance = new Varien_Simplexml_Config($filename);
|
| 36 |
+
$xml = $xmlInstance->getNode()->asNiceXml();
|
| 37 |
+
return $xml;
|
| 38 |
+
}
|
| 39 |
+
else
|
| 40 |
+
{
|
| 41 |
+
return "<error>".Mage::helper('oopsprofile')->__('No Data Exist For Current Details')."</error>";
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
catch (Exception $e)
|
| 46 |
+
{
|
| 47 |
+
// fault with the code tag data_invalid
|
| 48 |
+
$this->_fault('data_invalid', $e->getMessage());
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
public function exportcustomergroupdata($request)
|
| 52 |
+
{
|
| 53 |
+
try
|
| 54 |
+
{
|
| 55 |
+
$filename = Mage::getBaseDir().'/apiexport/export_customergroup_'.$request['profileid'].'.xml';
|
| 56 |
+
if(glob($filename))
|
| 57 |
+
{
|
| 58 |
+
$xmlInstance = new Varien_Simplexml_Config($filename);
|
| 59 |
+
$xml = $xmlInstance->getNode()->asNiceXml();
|
| 60 |
+
return $xml;
|
| 61 |
+
}
|
| 62 |
+
else
|
| 63 |
+
{
|
| 64 |
+
return "<error>".Mage::helper('oopsprofile')->__('No Data Exist For Current Details')."</error>";
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
catch (Exception $e)
|
| 69 |
+
{
|
| 70 |
+
// fault with the code tag data_invalid
|
| 71 |
+
$this->_fault('data_invalid', $e->getMessage());
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
public function exportorderdata($request)
|
| 75 |
+
{
|
| 76 |
+
try
|
| 77 |
+
{
|
| 78 |
+
$filename = Mage::getBaseDir().'/apiexport/export_order_'.$request['profileid'].'.xml';
|
| 79 |
+
if(glob($filename))
|
| 80 |
+
{
|
| 81 |
+
$xmlInstance = new Varien_Simplexml_Config($filename);
|
| 82 |
+
$xml = $xmlInstance->getNode()->asNiceXml();
|
| 83 |
+
return $xml;
|
| 84 |
+
}
|
| 85 |
+
else
|
| 86 |
+
{
|
| 87 |
+
return "<error>".Mage::helper('oopsprofile')->__('No Data Exist For Current Details')."</error>";
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
catch (Exception $e)
|
| 92 |
+
{
|
| 93 |
+
// fault with the code tag data_invalid
|
| 94 |
+
$this->_fault('data_invalid', $e->getMessage());
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
public function exportshipmentdata($request)
|
| 98 |
+
{
|
| 99 |
+
try
|
| 100 |
+
{
|
| 101 |
+
$filename = Mage::getBaseDir().'/apiexport/export_shipment_'.$request['profileid'].'.xml';
|
| 102 |
+
if(glob($filename))
|
| 103 |
+
{
|
| 104 |
+
$xmlInstance = new Varien_Simplexml_Config($filename);
|
| 105 |
+
$xml = $xmlInstance->getNode()->asNiceXml();
|
| 106 |
+
return $xml;
|
| 107 |
+
}
|
| 108 |
+
else
|
| 109 |
+
{
|
| 110 |
+
return "<error>".Mage::helper('oopsprofile')->__('No Data Exist For Current Details')."</error>";
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
catch (Exception $e)
|
| 115 |
+
{
|
| 116 |
+
// fault with the code tag data_invalid
|
| 117 |
+
$this->_fault('data_invalid', $e->getMessage());
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
public function exportinvoicedata($request)
|
| 121 |
+
{
|
| 122 |
+
try
|
| 123 |
+
{
|
| 124 |
+
$filename = Mage::getBaseDir().'/apiexport/export_invoice_'.$request['profileid'].'.xml';
|
| 125 |
+
if(glob($filename))
|
| 126 |
+
{
|
| 127 |
+
$xmlInstance = new Varien_Simplexml_Config($filename);
|
| 128 |
+
$xml = $xmlInstance->getNode()->asNiceXml();
|
| 129 |
+
return $xml;
|
| 130 |
+
}
|
| 131 |
+
else
|
| 132 |
+
{
|
| 133 |
+
return "<error>".Mage::helper('oopsprofile')->__('No Data Exist For Current Details')."</error>";
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
catch (Exception $e)
|
| 138 |
+
{
|
| 139 |
+
// fault with the code tag data_invalid
|
| 140 |
+
$this->_fault('data_invalid', $e->getMessage());
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
public function exportcreditmemodata($request)
|
| 144 |
+
{
|
| 145 |
+
try
|
| 146 |
+
{
|
| 147 |
+
$filename = Mage::getBaseDir().'/apiexport/export_creditmemo_'.$request['profileid'].'.xml';
|
| 148 |
+
if(glob($filename))
|
| 149 |
+
{
|
| 150 |
+
$xmlInstance = new Varien_Simplexml_Config($filename);
|
| 151 |
+
$xml = $xmlInstance->getNode()->asNiceXml();
|
| 152 |
+
return $xml;
|
| 153 |
+
}
|
| 154 |
+
else
|
| 155 |
+
{
|
| 156 |
+
return "<error>".Mage::helper('oopsprofile')->__('No Data Exist For Current Details')."</error>";
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
catch (Exception $e)
|
| 161 |
+
{
|
| 162 |
+
// fault with the code tag data_invalid
|
| 163 |
+
$this->_fault('data_invalid', $e->getMessage());
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Product/Convert/Adapter/Product.php
ADDED
|
@@ -0,0 +1,2168 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â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
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the EULA
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://www.commercethemes.com/LICENSE-M1.txt
|
| 12 |
+
*
|
| 13 |
+
* @category Product
|
| 14 |
+
* @package Productimport
|
| 15 |
+
* @copyright Copyright (c) 2003-2009 CommerceThemes @ InterSEC Solutions LLC. (http://www.commercethemes.com)
|
| 16 |
+
* @license http://www.commercethemes.com/LICENSE-M1.txt
|
| 17 |
+
*/
|
| 18 |
+
|
| 19 |
+
class PI_Oopsprofile_Model_Product_Convert_Adapter_Product
|
| 20 |
+
extends Mage_Catalog_Model_Convert_Adapter_Product
|
| 21 |
+
{
|
| 22 |
+
/**
|
| 23 |
+
* Affected entity ids
|
| 24 |
+
*
|
| 25 |
+
* @var array
|
| 26 |
+
*/
|
| 27 |
+
protected $_affectedEntityIds = array();
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Store affected entity ids
|
| 31 |
+
*
|
| 32 |
+
* @param int|array $ids
|
| 33 |
+
* @return Mage_Catalog_Model_Convert_Adapter_Product
|
| 34 |
+
*/
|
| 35 |
+
protected function _addAffectedEntityIds($ids)
|
| 36 |
+
{
|
| 37 |
+
if (is_array($ids)) {
|
| 38 |
+
foreach ($ids as $id) {
|
| 39 |
+
$this->_addAffectedEntityIds($id);
|
| 40 |
+
}
|
| 41 |
+
} else {
|
| 42 |
+
$this->_affectedEntityIds[] = $ids;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
return $this;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
protected function _defaultFilterOnProduct()
|
| 49 |
+
{
|
| 50 |
+
$attrFilterArray = array();
|
| 51 |
+
$attrFilterArray ['name'] = 'like';
|
| 52 |
+
$attrFilterArray ['sku'] = 'startsWith';
|
| 53 |
+
$attrFilterArray ['type'] = 'eq';
|
| 54 |
+
$attrFilterArray ['attribute_set'] = 'eq';
|
| 55 |
+
$attrFilterArray ['visibility'] = 'eq';
|
| 56 |
+
$attrFilterArray ['status'] = 'eq';
|
| 57 |
+
$attrFilterArray ['price'] = 'fromTo';
|
| 58 |
+
$attrFilterArray ['qty'] = 'fromTo';
|
| 59 |
+
$attrFilterArray ['store_id'] = 'eq';
|
| 60 |
+
|
| 61 |
+
$attrToDb = array(
|
| 62 |
+
'type' => 'type_id',
|
| 63 |
+
'attribute_set' => 'attribute_set_id'
|
| 64 |
+
);
|
| 65 |
+
|
| 66 |
+
$filters = $this->_parseVars();
|
| 67 |
+
|
| 68 |
+
if ($qty = $this->getFieldValue($filters, 'qty')) {
|
| 69 |
+
$qtyFrom = isset($qty['from']) ? (float) $qty['from'] : 0;
|
| 70 |
+
$qtyTo = isset($qty['to']) ? (float) $qty['to'] : 0;
|
| 71 |
+
|
| 72 |
+
$qtyAttr = array();
|
| 73 |
+
$qtyAttr['alias'] = 'qty';
|
| 74 |
+
$qtyAttr['attribute'] = 'cataloginventory/stock_item';
|
| 75 |
+
$qtyAttr['field'] = 'qty';
|
| 76 |
+
$qtyAttr['bind'] = 'product_id=entity_id';
|
| 77 |
+
$qtyAttr['cond'] = "{{table}}.qty between '{$qtyFrom}' AND '{$qtyTo}'";
|
| 78 |
+
$qtyAttr['joinType'] = 'inner';
|
| 79 |
+
|
| 80 |
+
$this->setJoinField($qtyAttr);
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
parent::setFilter($attrFilterArray, $attrToDb);
|
| 84 |
+
|
| 85 |
+
if ($price = $this->getFieldValue($filters, 'price')) {
|
| 86 |
+
$this->_filter[] = array(
|
| 87 |
+
'attribute' => 'price',
|
| 88 |
+
'from' => $price['from'],
|
| 89 |
+
'to' => $price['to']
|
| 90 |
+
);
|
| 91 |
+
$this->setJoinAttr(array(
|
| 92 |
+
'alias' => 'price',
|
| 93 |
+
'attribute' => 'catalog_product/price',
|
| 94 |
+
'bind' => 'entity_id',
|
| 95 |
+
'joinType' => 'LEFT'
|
| 96 |
+
));
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
protected function _applyDateFilterOnExport()
|
| 101 |
+
{
|
| 102 |
+
|
| 103 |
+
/**
|
| 104 |
+
* Apply Installation Date Filter
|
| 105 |
+
**/
|
| 106 |
+
$profileId = Mage::registry('current_convert_profile')->getId();
|
| 107 |
+
|
| 108 |
+
$oopprofile = Mage::getModel('oopsprofile/oopsprofile')->getCollection()
|
| 109 |
+
->addFieldToFilter('dataflow_profile_id',$profileId)
|
| 110 |
+
->getFirstItem();
|
| 111 |
+
|
| 112 |
+
$AlreadyDone = $oopprofile->getProductsAllreadyDone();
|
| 113 |
+
|
| 114 |
+
if(!$AlreadyDone)
|
| 115 |
+
{
|
| 116 |
+
if(Mage::getStoreConfigFlag('oopsprofile/installation/date'))
|
| 117 |
+
{
|
| 118 |
+
$installationDate = Mage::getStoreConfig('oopsprofile/installation/date');
|
| 119 |
+
|
| 120 |
+
$this->_filter[] = array(
|
| 121 |
+
'attribute' => 'created_at',
|
| 122 |
+
'from' => $installationDate
|
| 123 |
+
);
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
/**
|
| 130 |
+
* Apply date from and to filter
|
| 131 |
+
**/
|
| 132 |
+
|
| 133 |
+
if($this->getVar('fromdate')!='')
|
| 134 |
+
{
|
| 135 |
+
|
| 136 |
+
$fromDate = Mage::app()->getLocale()->date()
|
| 137 |
+
->setDate($this->getVar('fromdate'))
|
| 138 |
+
->setTime('00:00:00')
|
| 139 |
+
->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
|
| 140 |
+
|
| 141 |
+
$this->_filter[] = array(
|
| 142 |
+
'attribute' => 'created_at',
|
| 143 |
+
'from' => $fromDate
|
| 144 |
+
);
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
if($this->getVar('todate')!='')
|
| 150 |
+
{
|
| 151 |
+
|
| 152 |
+
$toDate = Mage::app()->getLocale()->date()
|
| 153 |
+
->setDate($this->getVar('todate'))
|
| 154 |
+
->setTime('23:59:59')
|
| 155 |
+
->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
|
| 156 |
+
|
| 157 |
+
$this->_filter[] = array(
|
| 158 |
+
'attribute' => 'created_at',
|
| 159 |
+
'to' => $toDate
|
| 160 |
+
);
|
| 161 |
+
}
|
| 162 |
+
return $this;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
protected function _applyProductFilterOnExport()
|
| 166 |
+
{
|
| 167 |
+
//echo $this->getVar('hiddentype');exit;
|
| 168 |
+
$hiddenProductTypes = explode(',',$this->getVar('hiddentype'));
|
| 169 |
+
if($this->getVar('hiddentype')!='')
|
| 170 |
+
{
|
| 171 |
+
$this->_filter[] = array(
|
| 172 |
+
'attribute' => 'type_id',
|
| 173 |
+
'nin' => $hiddenProductTypes
|
| 174 |
+
);
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
protected function fetchConditionArray()
|
| 180 |
+
{
|
| 181 |
+
$profile = Mage::registry('current_convert_profile');
|
| 182 |
+
|
| 183 |
+
$ruleCollection = Mage::getModel('oopsprofile/oopsprofile')
|
| 184 |
+
->getCollection()
|
| 185 |
+
->addFieldToFilter('dataflow_profile_id ',$profile->getId())
|
| 186 |
+
->getFirstItem();
|
| 187 |
+
|
| 188 |
+
$conditions = $ruleCollection->getConditionsSerialized();
|
| 189 |
+
if (!empty($conditions)) {
|
| 190 |
+
$conditions = unserialize($conditions);
|
| 191 |
+
}
|
| 192 |
+
// echo '<pre>';print_r($conditions);
|
| 193 |
+
|
| 194 |
+
// exit;
|
| 195 |
+
|
| 196 |
+
return $conditions;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
protected function applySubCondition($conditins,$aggregator,$sql)
|
| 200 |
+
{
|
| 201 |
+
$resource = Mage::getSingleton('core/resource');
|
| 202 |
+
$productCategoryTable = $resource->getTableName('catalog/category_product');
|
| 203 |
+
|
| 204 |
+
if(!empty($conditins))
|
| 205 |
+
{
|
| 206 |
+
$aggregator = $aggregator;
|
| 207 |
+
$i=0;
|
| 208 |
+
if($aggregator=='all')
|
| 209 |
+
{
|
| 210 |
+
$sqlcond = 'and';
|
| 211 |
+
}
|
| 212 |
+
else
|
| 213 |
+
{
|
| 214 |
+
$sqlcond = 'or';
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
//$sql = $sql.' where ';
|
| 218 |
+
$count = count($conditins);
|
| 219 |
+
foreach($conditins as $con)
|
| 220 |
+
{
|
| 221 |
+
$i++;
|
| 222 |
+
$sql = $sql.'(';
|
| 223 |
+
if(!empty($con['conditions']))
|
| 224 |
+
{
|
| 225 |
+
$this->applySubCondition($con['conditions'],$con['aggregator'],$sql);
|
| 226 |
+
}
|
| 227 |
+
else
|
| 228 |
+
{
|
| 229 |
+
$attribute = $con['attribute'];
|
| 230 |
+
|
| 231 |
+
$operator = $con['operator'];
|
| 232 |
+
$value = $con['value'];
|
| 233 |
+
|
| 234 |
+
$Optval = $this->fetchOperator($operator,$value);
|
| 235 |
+
$operator = $Optval['operator'];
|
| 236 |
+
$value = $Optval['value'];
|
| 237 |
+
|
| 238 |
+
if($attribute=='category_ids')
|
| 239 |
+
{
|
| 240 |
+
$sql = $sql.'entity_id in (select product_id from '.$productCategoryTable.' where category_id '.$operator.' '.$value.')';
|
| 241 |
+
}
|
| 242 |
+
else
|
| 243 |
+
{
|
| 244 |
+
$sql = $sql.$attribute.' '.$operator.' '.$value;
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
$sql = $sql.') ';
|
| 248 |
+
if($count!=$i)
|
| 249 |
+
{
|
| 250 |
+
$sql = $sql.$sqlcond.' ';
|
| 251 |
+
}
|
| 252 |
+
}
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
return $sql;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
protected function fetchOperator($operator,$value)
|
| 259 |
+
{
|
| 260 |
+
$opt = array();
|
| 261 |
+
$opt['value'] = "'".$value."'";
|
| 262 |
+
$opt['operator'] = $operator;
|
| 263 |
+
switch ($operator){
|
| 264 |
+
case '==':
|
| 265 |
+
$opt['operator'] = '=';
|
| 266 |
+
break;
|
| 267 |
+
case '!=':
|
| 268 |
+
$operator = '!=';
|
| 269 |
+
break;
|
| 270 |
+
case '{}':
|
| 271 |
+
$opt['operator'] = 'like';
|
| 272 |
+
$opt['value'] = "'%".$value."%'";
|
| 273 |
+
break;
|
| 274 |
+
case '!{}':
|
| 275 |
+
$opt['operator'] = 'not like';
|
| 276 |
+
$opt['value'] = "'%".$value."%'";
|
| 277 |
+
break;
|
| 278 |
+
case '()':
|
| 279 |
+
$opt['operator'] = 'in';
|
| 280 |
+
$opt['value'] = '('.$opt['value'].')';
|
| 281 |
+
break;
|
| 282 |
+
case '!()':
|
| 283 |
+
$opt['operator'] = 'not in';
|
| 284 |
+
$opt['value'] = '('.$opt['value'].')';
|
| 285 |
+
break;
|
| 286 |
+
}
|
| 287 |
+
return $opt;
|
| 288 |
+
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
public function load()
|
| 293 |
+
{
|
| 294 |
+
$this->_defaultFilterOnProduct();
|
| 295 |
+
|
| 296 |
+
$this->_applyDateFilterOnExport();
|
| 297 |
+
|
| 298 |
+
$this->_applyProductFilterOnExport();
|
| 299 |
+
|
| 300 |
+
$this->loadEntityIds();
|
| 301 |
+
|
| 302 |
+
//return parent::load();
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
protected function loadEntityIds()
|
| 306 |
+
{
|
| 307 |
+
if (!($entityType = $this->getVar('entity_type'))
|
| 308 |
+
|| !(Mage::getResourceSingleton($entityType) instanceof Mage_Eav_Model_Entity_Interface)) {
|
| 309 |
+
$this->addException(Mage::helper('eav')->__('Invalid entity specified'), Varien_Convert_Exception::FATAL);
|
| 310 |
+
}
|
| 311 |
+
try {
|
| 312 |
+
$collection = $this->_getCollectionForLoad($entityType);
|
| 313 |
+
|
| 314 |
+
if (isset($this->_joinAttr) && is_array($this->_joinAttr)) {
|
| 315 |
+
foreach ($this->_joinAttr as $val) {
|
| 316 |
+
// print_r($val);
|
| 317 |
+
|
| 318 |
+
$collection->joinAttribute(
|
| 319 |
+
$val['alias'],
|
| 320 |
+
$val['attribute'],
|
| 321 |
+
$val['bind'],
|
| 322 |
+
null,
|
| 323 |
+
strtolower($val['joinType']),
|
| 324 |
+
$val['storeId']
|
| 325 |
+
);
|
| 326 |
+
}
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
$filterQuery = $this->getFilter();
|
| 330 |
+
if (is_array($filterQuery)) {
|
| 331 |
+
foreach ($filterQuery as $val) {
|
| 332 |
+
$collection->addFieldToFilter(array($val));
|
| 333 |
+
}
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
$joinFields = $this->_joinField;
|
| 337 |
+
if (isset($joinFields) && is_array($joinFields)) {
|
| 338 |
+
foreach ($joinFields as $field) {
|
| 339 |
+
// print_r($field);
|
| 340 |
+
$collection->joinField(
|
| 341 |
+
$field['alias'],
|
| 342 |
+
$field['attribute'],
|
| 343 |
+
$field['field'],
|
| 344 |
+
$field['bind'],
|
| 345 |
+
$field['cond'],
|
| 346 |
+
$field['joinType']);
|
| 347 |
+
}
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
/**
|
| 351 |
+
* Load collection ids
|
| 352 |
+
*/
|
| 353 |
+
$entityIds = $collection->getAllIds();
|
| 354 |
+
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
/*****
|
| 360 |
+
*** Appy Rule Filter
|
| 361 |
+
*****/
|
| 362 |
+
|
| 363 |
+
$ruleConditions = $this->fetchConditionArray();
|
| 364 |
+
if(!empty($ruleConditions['conditions']))
|
| 365 |
+
{
|
| 366 |
+
|
| 367 |
+
$conditins = $ruleConditions['conditions'];
|
| 368 |
+
//echo '<pre>';print_r($ruleConditions);
|
| 369 |
+
if(!empty($conditins))
|
| 370 |
+
{
|
| 371 |
+
$sql = $collection->getSelectSql();
|
| 372 |
+
|
| 373 |
+
|
| 374 |
+
$resource = Mage::getSingleton('core/resource');
|
| 375 |
+
$productCategoryTable = $resource->getTableName('catalog/category_product');
|
| 376 |
+
|
| 377 |
+
//Add category id(category_id) in collection
|
| 378 |
+
//$collection->joinField('category_id',$productCategoryTable,'category_id','product_id=entity_id',null,'left');
|
| 379 |
+
|
| 380 |
+
|
| 381 |
+
$aggregator = $ruleConditions['aggregator'];
|
| 382 |
+
$i=0;
|
| 383 |
+
if($aggregator=='all')
|
| 384 |
+
{
|
| 385 |
+
$sqlcond = 'and';
|
| 386 |
+
}
|
| 387 |
+
else
|
| 388 |
+
{
|
| 389 |
+
$sqlcond = 'or';
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
|
| 393 |
+
//echo stripos($sql,'where');
|
| 394 |
+
if(stripos($sql,'where')!='')
|
| 395 |
+
{
|
| 396 |
+
$sql = $sql.' and ';
|
| 397 |
+
}
|
| 398 |
+
else
|
| 399 |
+
{
|
| 400 |
+
$sql = $sql.' where ';
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
|
| 404 |
+
$count = count($conditins);
|
| 405 |
+
foreach($conditins as $con)
|
| 406 |
+
{
|
| 407 |
+
$i++;
|
| 408 |
+
$sql = $sql.'(';
|
| 409 |
+
if(!empty($con['conditions']))
|
| 410 |
+
{
|
| 411 |
+
$sql = $this->applySubCondition($con['conditions'],$con['aggregator'],$sql);
|
| 412 |
+
}
|
| 413 |
+
else
|
| 414 |
+
{
|
| 415 |
+
$attribute = $con['attribute'];
|
| 416 |
+
$operator = $con['operator'];
|
| 417 |
+
$value = $con['value'];
|
| 418 |
+
|
| 419 |
+
$Optval = $this->fetchOperator($operator,$value);
|
| 420 |
+
$operator = $Optval['operator'];
|
| 421 |
+
$value = $Optval['value'];
|
| 422 |
+
|
| 423 |
+
if($attribute=='category_ids')
|
| 424 |
+
{
|
| 425 |
+
$sql = $sql.'entity_id in (select product_id from '.$productCategoryTable.' where category_id '.$operator.' '.$value.')';
|
| 426 |
+
}
|
| 427 |
+
else
|
| 428 |
+
{
|
| 429 |
+
$sql = $sql.$attribute.' '.$operator.' '.$value;
|
| 430 |
+
}
|
| 431 |
+
}
|
| 432 |
+
$sql = $sql.') ';
|
| 433 |
+
if($count!=$i)
|
| 434 |
+
{
|
| 435 |
+
$sql = $sql.$sqlcond.' ';
|
| 436 |
+
}
|
| 437 |
+
}
|
| 438 |
+
}
|
| 439 |
+
//echo $sql;
|
| 440 |
+
//exit;
|
| 441 |
+
|
| 442 |
+
if(!empty($sql))
|
| 443 |
+
{
|
| 444 |
+
$read = $resource->getConnection('core_read');
|
| 445 |
+
$fields = $read->fetchCol($sql);
|
| 446 |
+
|
| 447 |
+
$entityIds = $fields;
|
| 448 |
+
|
| 449 |
+
//echo '<pre>';print_r($fields);
|
| 450 |
+
}
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
|
| 454 |
+
|
| 455 |
+
//exit;
|
| 456 |
+
//echo '<pre>';print_r($collection->getData());
|
| 457 |
+
|
| 458 |
+
|
| 459 |
+
|
| 460 |
+
$message = Mage::helper('eav')->__("Loaded %d records", count($entityIds));
|
| 461 |
+
$this->addException($message);
|
| 462 |
+
}
|
| 463 |
+
catch (Varien_Convert_Exception $e) {
|
| 464 |
+
throw $e;
|
| 465 |
+
}
|
| 466 |
+
catch (Exception $e) {
|
| 467 |
+
$message = Mage::helper('eav')->__('Problem loading the collection, aborting. Error: %s', $e->getMessage());
|
| 468 |
+
$this->addException($message, Varien_Convert_Exception::FATAL);
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
/**
|
| 472 |
+
* Set collection ids
|
| 473 |
+
*/
|
| 474 |
+
$this->setData($entityIds);
|
| 475 |
+
return $this;
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
|
| 479 |
+
/**
|
| 480 |
+
* Save product (import)
|
| 481 |
+
*
|
| 482 |
+
* @param array $importData
|
| 483 |
+
* @throws Mage_Core_Exception
|
| 484 |
+
* @return bool
|
| 485 |
+
*/
|
| 486 |
+
public function saveRow( array $importData )
|
| 487 |
+
{
|
| 488 |
+
#$product = $this -> getProductModel();
|
| 489 |
+
$product = $this->getProductModel()
|
| 490 |
+
->reset();
|
| 491 |
+
#$product -> setData( array() );
|
| 492 |
+
|
| 493 |
+
#if ( $stockItem = $product -> getStockItem() ) {
|
| 494 |
+
#$stockItem -> setData( array() );
|
| 495 |
+
#}
|
| 496 |
+
|
| 497 |
+
if (empty($importData['store'])) {
|
| 498 |
+
if (!is_null($this->getBatchParams('store'))) {
|
| 499 |
+
$store = $this->getStoreById($this->getBatchParams('store'));
|
| 500 |
+
} else {
|
| 501 |
+
$message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'store');
|
| 502 |
+
Mage::throwException($message);
|
| 503 |
+
Mage::log(sprintf('Skip import row, required field "store" not defined', $message), null,'ce_product_import_export_errors.log');
|
| 504 |
+
}
|
| 505 |
+
}
|
| 506 |
+
else {
|
| 507 |
+
$store = $this->getStoreByCode($importData['store']);
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
if ($store === false) {
|
| 511 |
+
$message = Mage::helper('catalog')->__('Skip import row, store "%s" field not exists', $importData['store']);
|
| 512 |
+
Mage::throwException($message);
|
| 513 |
+
Mage::log(sprintf('Skip import row, store "'.$importData['store'].'" field not exists', $message), null,'ce_product_import_export_errors.log');
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
if (empty($importData['sku'])) {
|
| 517 |
+
$message = Mage::helper('catalog')->__('Skip import row, required field "%s" not defined', 'sku');
|
| 518 |
+
Mage::throwException($message);
|
| 519 |
+
Mage::log(sprintf('Skip import row, required field "sku" not defined', $message), null,'ce_product_import_export_errors.log');
|
| 520 |
+
}
|
| 521 |
+
$product->setStoreId($store->getId());
|
| 522 |
+
$productId = $product->getIdBySku($importData['sku']);
|
| 523 |
+
|
| 524 |
+
$iscustomoptions = "false"; //sets currentcustomoptionstofalse
|
| 525 |
+
$iscustomoptionsrequired = "false";
|
| 526 |
+
$finalsuperattributepricing = "";
|
| 527 |
+
$finalgroup_price_price = "";
|
| 528 |
+
$finalsuperattributetype = $importData['type'];
|
| 529 |
+
if (isset($importData['super_attribute_pricing']) && $importData['super_attribute_pricing'] !="") {
|
| 530 |
+
$finalsuperattributepricing = $importData['super_attribute_pricing'];
|
| 531 |
+
}
|
| 532 |
+
if (isset($importData['group_price_price']) && $importData['group_price_price'] !="") {
|
| 533 |
+
$finalgroup_price_price = $importData['group_price_price'];
|
| 534 |
+
}
|
| 535 |
+
$new = true; // fix for duplicating attributes error
|
| 536 |
+
|
| 537 |
+
if ($productId) {
|
| 538 |
+
$product->load($productId);
|
| 539 |
+
$new = false; // fix for duplicating attributes error
|
| 540 |
+
}
|
| 541 |
+
else {
|
| 542 |
+
$productTypes = $this->getProductTypes();
|
| 543 |
+
$productAttributeSets = $this->getProductAttributeSets();
|
| 544 |
+
|
| 545 |
+
/**
|
| 546 |
+
* Check product define type
|
| 547 |
+
*/
|
| 548 |
+
if (empty($importData['type']) || !isset($productTypes[strtolower($importData['type'])])) {
|
| 549 |
+
$value = isset($importData['type']) ? $importData['type'] : '';
|
| 550 |
+
$message = Mage::helper('catalog')->__('Skip import row, is not valid value "%s" for field "%s"', $value, 'type');
|
| 551 |
+
Mage::throwException($message);
|
| 552 |
+
Mage::log(sprintf('Skip import row, is not valid value "'.$value.'" for field type', $message), null,'ce_product_import_export_errors.log');
|
| 553 |
+
}
|
| 554 |
+
$product->setTypeId($productTypes[strtolower($importData['type'])]);
|
| 555 |
+
/**
|
| 556 |
+
* Check product define attribute set
|
| 557 |
+
*/
|
| 558 |
+
if (empty($importData['attribute_set']) || !isset($productAttributeSets[$importData['attribute_set']])) {
|
| 559 |
+
$value = isset($importData['attribute_set']) ? $importData['attribute_set'] : '';
|
| 560 |
+
$message = Mage::helper('catalog')->__('Skip import row, is not valid value "%s" for field "%s"', $value, 'attribute_set');
|
| 561 |
+
Mage::throwException($message);
|
| 562 |
+
Mage::log(sprintf('Skip import row, is not valid value "'.$value.'" for field attribute_set', $message), null,'ce_product_import_export_errors.log');
|
| 563 |
+
}
|
| 564 |
+
$product->setAttributeSetId($productAttributeSets[$importData['attribute_set']]);
|
| 565 |
+
|
| 566 |
+
foreach ($this->_requiredFields as $field) {
|
| 567 |
+
$attribute = $this->getAttribute($field);
|
| 568 |
+
if (!isset($importData[$field]) && $attribute && $attribute->getIsRequired()) {
|
| 569 |
+
$message = Mage::helper('catalog')->__('Skip import row, required field "%s" for new products not defined', $field);
|
| 570 |
+
Mage::throwException($message);
|
| 571 |
+
}
|
| 572 |
+
}
|
| 573 |
+
}
|
| 574 |
+
|
| 575 |
+
$this->setProductTypeInstance($product);
|
| 576 |
+
|
| 577 |
+
// delete disabled products
|
| 578 |
+
// note "Disabled text should be converted to handle multi-lanugage values aka age::helper('catalog')->__(''); type deal
|
| 579 |
+
|
| 580 |
+
if ( $importData['status'] == 'Delete' || $importData['status'] == 'delete' ) {
|
| 581 |
+
$product = Mage :: getSingleton( 'catalog/product' ) -> load( $productId );
|
| 582 |
+
$this -> _removeFile( Mage :: getSingleton( 'catalog/product_media_config' ) -> getMediaPath( $product -> getData( 'image' ) ) );
|
| 583 |
+
$this -> _removeFile( Mage :: getSingleton( 'catalog/product_media_config' ) -> getMediaPath( $product -> getData( 'small_image' ) ) );
|
| 584 |
+
$this -> _removeFile( Mage :: getSingleton( 'catalog/product_media_config' ) -> getMediaPath( $product -> getData( 'thumbnail' ) ) );
|
| 585 |
+
$media_gallery = $product -> getData( 'media_gallery' );
|
| 586 |
+
foreach ( $media_gallery['images'] as $image ) {
|
| 587 |
+
$this -> _removeFile( Mage :: getSingleton( 'catalog/product_media_config' ) -> getMediaPath( $image['file'] ) );
|
| 588 |
+
}
|
| 589 |
+
$product -> delete();
|
| 590 |
+
return true;
|
| 591 |
+
}
|
| 592 |
+
|
| 593 |
+
|
| 594 |
+
$currentproducttype = $importData['type'];
|
| 595 |
+
|
| 596 |
+
if ($importData['type'] == 'configurable') {
|
| 597 |
+
|
| 598 |
+
$product->setCanSaveConfigurableAttributes(true);
|
| 599 |
+
$configAttributeCodes = $this->userCSVDataAsArray($importData['config_attributes']);
|
| 600 |
+
$usingAttributeIds = array();
|
| 601 |
+
|
| 602 |
+
/***
|
| 603 |
+
* Check the product's super attributes (see catalog_product_super_attribute table), and make a determination that way.
|
| 604 |
+
**/
|
| 605 |
+
$cspa = $product->getTypeInstance()->getConfigurableAttributesAsArray($product);
|
| 606 |
+
$attr_codes = array();
|
| 607 |
+
if(isset($cspa) && !empty($cspa)){ //found attributes
|
| 608 |
+
foreach($cspa as $cs_attr){
|
| 609 |
+
//$attr_codes[$cs_attr['attribute_id']] = $cs_attr['attribute_code'];
|
| 610 |
+
$attr_codes[] = $cs_attr['attribute_id'];
|
| 611 |
+
}
|
| 612 |
+
}
|
| 613 |
+
|
| 614 |
+
|
| 615 |
+
foreach($configAttributeCodes as $attributeCode) {
|
| 616 |
+
$attribute = $product->getResource()->getAttribute($attributeCode);
|
| 617 |
+
if ($product->getTypeInstance()->canUseAttribute($attribute)) {
|
| 618 |
+
//if (!in_array($attributeCode,$attr_codes)) { // fix for duplicating attributes error
|
| 619 |
+
if ($new) { // fix for duplicating attributes error // <---------- this must be true to fill $usingAttributes
|
| 620 |
+
$usingAttributeIds[] = $attribute->getAttributeId();
|
| 621 |
+
}
|
| 622 |
+
}
|
| 623 |
+
}
|
| 624 |
+
if (!empty($usingAttributeIds)) {
|
| 625 |
+
$product->getTypeInstance()->setUsedProductAttributeIds($usingAttributeIds);
|
| 626 |
+
$updateconfigurablearray = array();
|
| 627 |
+
$insidearraycount=0;
|
| 628 |
+
$finalarraytoimport = $product->getTypeInstance()->getConfigurableAttributesAsArray();
|
| 629 |
+
$updateconfigurablearray = $product->getTypeInstance()->getConfigurableAttributesAsArray();
|
| 630 |
+
|
| 631 |
+
foreach($updateconfigurablearray as $eacharrayvalue) {
|
| 632 |
+
if($this->getBatchParams('configurable_use_default') != "") {
|
| 633 |
+
$finalarraytoimport[$insidearraycount]['use_default'] = $this->getBatchParams('configurable_use_default'); //added in 1.5.x
|
| 634 |
+
//<var name="configurable_use_default"><![CDATA[1]]></var>
|
| 635 |
+
}
|
| 636 |
+
$finalarraytoimport[$insidearraycount]['label'] = $eacharrayvalue['frontend_label'];
|
| 637 |
+
#$finalarraytoimport[$insidearraycount]['values'] = array( );
|
| 638 |
+
#$attribute = Mage::getModel('catalog/product_type_configurable_attribute')->setProductAttribute($eacharrayvalue['attribute_id']);
|
| 639 |
+
#$attribute->setStoreLabel($eacharrayvalue['frontend_label']);
|
| 640 |
+
#print_r($attribute->getStoreLabel());
|
| 641 |
+
$insidearraycount+=1;
|
| 642 |
+
}
|
| 643 |
+
$product->setConfigurableAttributesData($finalarraytoimport);
|
| 644 |
+
$product->setCanSaveConfigurableAttributes(true);
|
| 645 |
+
$product->setCanSaveCustomOptions(true);
|
| 646 |
+
}
|
| 647 |
+
if (isset($importData['associated'])) {
|
| 648 |
+
$product->setConfigurableProductsData($this->skusToIds($importData['associated'], $product));
|
| 649 |
+
}
|
| 650 |
+
}
|
| 651 |
+
//THIS IS FOR DOWNLOADABLE PRODUCTS
|
| 652 |
+
if ($importData['type'] == 'downloadable' && $importData['downloadable_options'] != "") {
|
| 653 |
+
if ($new) {
|
| 654 |
+
$downloadableitems = array();
|
| 655 |
+
$filearrayforimport = array();
|
| 656 |
+
$filenameforsamplearrayforimport = array();
|
| 657 |
+
#$filenameforsamplearrayforimport = "";
|
| 658 |
+
$downloadableitemsoptionscount=0;
|
| 659 |
+
//THIS IS FOR DOWNLOADABLE OPTIONS
|
| 660 |
+
$commadelimiteddata = explode('|',$importData['downloadable_options']);
|
| 661 |
+
foreach ($commadelimiteddata as $data) {
|
| 662 |
+
$configBundleOptionsCodes = $this->userCSVDataAsArray($data);
|
| 663 |
+
|
| 664 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['is_delete'] = 0;
|
| 665 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['link_id'] = 0;
|
| 666 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['title'] = $configBundleOptionsCodes[0];
|
| 667 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['price'] = $configBundleOptionsCodes[1];
|
| 668 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['number_of_downloads'] = $configBundleOptionsCodes[2];
|
| 669 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['is_shareable'] = 2;
|
| 670 |
+
if(isset($configBundleOptionsCodes[6])) {
|
| 671 |
+
#$downloadableitems['link'][$downloadableitemsoptionscount]['sample'] = '';
|
| 672 |
+
if($configBundleOptionsCodes[3] == "file") {
|
| 673 |
+
#$filenameforsamplearrayforimport = $configBundleOptionsCodes[6];
|
| 674 |
+
if(isset($configBundleOptionsCodes[7])) {
|
| 675 |
+
$sampleproductitle = $configBundleOptionsCodes[7];
|
| 676 |
+
} else {
|
| 677 |
+
$sampleproductitle = $configBundleOptionsCodes[0];
|
| 678 |
+
}
|
| 679 |
+
$filenameforsamplearrayforimport[] = array('file' => ''.$configBundleOptionsCodes[6].'' , 'name' => ''.$sampleproductitle.'' , 'price' => ''.$configBundleOptionsCodes[1].'');
|
| 680 |
+
//Create and send the JSON structure instead of the file name
|
| 681 |
+
$tempSampleFile = '[{"file": "'.$configBundleOptionsCodes[6].'", "status": "new"}]';
|
| 682 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['sample'] = array('file' => ''.$tempSampleFile.'', 'type' => 'file', 'url' => '');
|
| 683 |
+
|
| 684 |
+
//$downloadableitems['link'][$downloadableitemsoptionscount]['sample'] = array('file' => ''.$configBundleOptionsCodes[6].'', 'type' => 'file', 'url' => '');
|
| 685 |
+
} else {
|
| 686 |
+
|
| 687 |
+
if(isset($configBundleOptionsCodes[7])) {
|
| 688 |
+
$sampleproductitle = $configBundleOptionsCodes[7];
|
| 689 |
+
} else {
|
| 690 |
+
$sampleproductitle = $configBundleOptionsCodes[0];
|
| 691 |
+
}
|
| 692 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['sample'] = array('name' => ''.$sampleproductitle.'','file' => '[]', 'type' => 'url', 'url' => ''.$configBundleOptionsCodes[6].'');
|
| 693 |
+
}
|
| 694 |
+
} else {
|
| 695 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['sample'] = '';
|
| 696 |
+
}
|
| 697 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['file'] = '';
|
| 698 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['type'] = $configBundleOptionsCodes[3];
|
| 699 |
+
#$downloadableitems['link'][$downloadableitemsoptionscount]['link_url'] = $configBundleOptionsCodes[4];
|
| 700 |
+
if($configBundleOptionsCodes[3] == "file") {
|
| 701 |
+
#$filearrayforimport = array('file' => 'media/import/mypdf.pdf' , 'name' => 'asdad.txt', 'size' => '316', 'status' => 'old');
|
| 702 |
+
#$document_directory = Mage :: getBaseDir( 'media' ) . DS . 'import' . DS;
|
| 703 |
+
#echo "DIRECTORY: " . $document_directory;
|
| 704 |
+
#$filearrayforimport = '[{"file": "/home/discou33/public_html/media/import/mypdf.pdf", "name": "mypdf.pdf", "status": "new"}]';
|
| 705 |
+
#$filearrayforimport = '[{"file": "mypdf.pdf", "name": "quickstart.pdf", "size": 324075, "status": "new"}]';
|
| 706 |
+
$filearrayforimport[] = array('file' => ''.$configBundleOptionsCodes[4].'' , 'name' => ''.$configBundleOptionsCodes[0].'' , 'price' => ''.$configBundleOptionsCodes[1].'');
|
| 707 |
+
|
| 708 |
+
if(isset($configBundleOptionsCodes[8])) {
|
| 709 |
+
if($configBundleOptionsCodes[8] == 0) {
|
| 710 |
+
$linkspurchasedstatus = 0;
|
| 711 |
+
$linkspurchasedstatustext = false;
|
| 712 |
+
} else {
|
| 713 |
+
$linkspurchasedstatus = 1;
|
| 714 |
+
$linkspurchasedstatustext = true;
|
| 715 |
+
}
|
| 716 |
+
$product->setLinksPurchasedSeparately($linkspurchasedstatus);
|
| 717 |
+
$product->setLinksPurchasedSeparately($linkspurchasedstatustext);
|
| 718 |
+
}
|
| 719 |
+
|
| 720 |
+
|
| 721 |
+
#$product->setLinksPurchasedSeparately(0);
|
| 722 |
+
#$product->setLinksPurchasedSeparately(false);
|
| 723 |
+
|
| 724 |
+
#$files = Zend_Json::decode($filearrayforimport);
|
| 725 |
+
#$files = "mypdf.pdf";
|
| 726 |
+
|
| 727 |
+
#$downloadableitems['link'][$downloadableitemsoptionscount]['file'] = $filearrayforimport;
|
| 728 |
+
} else if($configBundleOptionsCodes[3] == "url") {
|
| 729 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['link_url'] = $configBundleOptionsCodes[4];
|
| 730 |
+
}
|
| 731 |
+
if(isset($configBundleOptionsCodes[5])) {
|
| 732 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['sort_order'] = $configBundleOptionsCodes[5];
|
| 733 |
+
} else {
|
| 734 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['sort_order'] = 0;
|
| 735 |
+
}
|
| 736 |
+
$product->setDownloadableData($downloadableitems);
|
| 737 |
+
$downloadableitemsoptionscount+=1;
|
| 738 |
+
}
|
| 739 |
+
#print_r($downloadableitems);
|
| 740 |
+
} else {
|
| 741 |
+
//first delete all links then we update
|
| 742 |
+
$download_info=Mage::getModel('downloadable/product_type');
|
| 743 |
+
$download_info->setProduct($product);
|
| 744 |
+
if ($download_info->hasLinks()) {
|
| 745 |
+
$_links=$download_info->getLinks();
|
| 746 |
+
foreach ($_links as $_link) {
|
| 747 |
+
$_link->delete();
|
| 748 |
+
}
|
| 749 |
+
}
|
| 750 |
+
|
| 751 |
+
//begin update
|
| 752 |
+
$downloadableitems = array();
|
| 753 |
+
$filearrayforimport = array();
|
| 754 |
+
//$filenameforsamplearrayforimport = "";
|
| 755 |
+
$filenameforsamplearrayforimport = array(); //bug fix
|
| 756 |
+
$downloadableitemsoptionscount=0;
|
| 757 |
+
//THIS IS FOR DOWNLOADABLE OPTIONS
|
| 758 |
+
$commadelimiteddata = explode('|',$importData['downloadable_options']);
|
| 759 |
+
foreach ($commadelimiteddata as $data) {
|
| 760 |
+
$configBundleOptionsCodes = $this->userCSVDataAsArray($data);
|
| 761 |
+
|
| 762 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['is_delete'] = 0;
|
| 763 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['link_id'] = 0;
|
| 764 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['title'] = $configBundleOptionsCodes[0];
|
| 765 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['price'] = $configBundleOptionsCodes[1];
|
| 766 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['number_of_downloads'] = $configBundleOptionsCodes[2];
|
| 767 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['is_shareable'] = 2;
|
| 768 |
+
if(isset($configBundleOptionsCodes[6])) {
|
| 769 |
+
#$downloadableitems['link'][$downloadableitemsoptionscount]['sample'] = '';
|
| 770 |
+
if($configBundleOptionsCodes[3] == "file") {
|
| 771 |
+
#$filenameforsamplearrayforimport = $configBundleOptionsCodes[6];
|
| 772 |
+
if(isset($configBundleOptionsCodes[7])) {
|
| 773 |
+
$sampleproductitle = $configBundleOptionsCodes[7];
|
| 774 |
+
} else {
|
| 775 |
+
$sampleproductitle = $configBundleOptionsCodes[0];
|
| 776 |
+
}
|
| 777 |
+
$filenameforsamplearrayforimport[] = array('file' => ''.$configBundleOptionsCodes[6].'' , 'name' => ''.$sampleproductitle.'' , 'price' => ''.$configBundleOptionsCodes[1].'');
|
| 778 |
+
//Create and send the JSON structure instead of the file name
|
| 779 |
+
$tempSampleFile = '[{"file": "'.$configBundleOptionsCodes[6].'", "status": "new"}]';
|
| 780 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['sample'] = array('file' => ''.$tempSampleFile.'', 'type' => 'file', 'url' => '');
|
| 781 |
+
//$downloadableitems['link'][$downloadableitemsoptionscount]['sample'] = array('file' => ''.$configBundleOptionsCodes[6].'', 'type' => 'file', 'url' => '');
|
| 782 |
+
} else {
|
| 783 |
+
if(isset($configBundleOptionsCodes[7])) {
|
| 784 |
+
$sampleproductitle = $configBundleOptionsCodes[7];
|
| 785 |
+
} else {
|
| 786 |
+
$sampleproductitle = $configBundleOptionsCodes[0];
|
| 787 |
+
}
|
| 788 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['sample'] = array('name' => ''.$sampleproductitle.'', 'file' => '[]', 'type' => 'url', 'url' => ''.$configBundleOptionsCodes[6].'');
|
| 789 |
+
}
|
| 790 |
+
} else {
|
| 791 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['sample'] = '';
|
| 792 |
+
}
|
| 793 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['file'] = '';
|
| 794 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['type'] = $configBundleOptionsCodes[3];
|
| 795 |
+
#$downloadableitems['link'][$downloadableitemsoptionscount]['link_url'] = $configBundleOptionsCodes[4];
|
| 796 |
+
if($configBundleOptionsCodes[3] == "file") {
|
| 797 |
+
#$filearrayforimport = array('file' => 'media/import/mypdf.pdf' , 'name' => 'asdad.txt', 'size' => '316', 'status' => 'old');
|
| 798 |
+
#$document_directory = Mage :: getBaseDir( 'media' ) . DS . 'import' . DS;
|
| 799 |
+
#echo "DIRECTORY: " . $document_directory;
|
| 800 |
+
#$filearrayforimport = '[{"file": "/home/discou33/public_html/media/import/mypdf.pdf", "name": "mypdf.pdf", "status": "new"}]';
|
| 801 |
+
#$filearrayforimport = '[{"file": "mypdf.pdf", "name": "quickstart.pdf", "size": 324075, "status": "new"}]';
|
| 802 |
+
#echo "FILE: " . $configBundleOptionsCodes[4];
|
| 803 |
+
$filearrayforimport[] = array('file' => ''.$configBundleOptionsCodes[4].'' , 'name' => ''.$configBundleOptionsCodes[0].'' , 'price' => ''.$configBundleOptionsCodes[1].'');
|
| 804 |
+
|
| 805 |
+
if(isset($configBundleOptionsCodes[8])) {
|
| 806 |
+
if($configBundleOptionsCodes[8] == 0) {
|
| 807 |
+
$linkspurchasedstatus = 0;
|
| 808 |
+
$linkspurchasedstatustext = false;
|
| 809 |
+
} else {
|
| 810 |
+
$linkspurchasedstatus = 1;
|
| 811 |
+
$linkspurchasedstatustext = true;
|
| 812 |
+
}
|
| 813 |
+
$product->setLinksPurchasedSeparately($linkspurchasedstatus);
|
| 814 |
+
$product->setLinksPurchasedSeparately($linkspurchasedstatustext);
|
| 815 |
+
}
|
| 816 |
+
|
| 817 |
+
|
| 818 |
+
#$product->setLinksPurchasedSeparately(0);
|
| 819 |
+
#$product->setLinksPurchasedSeparately(false);
|
| 820 |
+
|
| 821 |
+
#$files = Zend_Json::decode($filearrayforimport);
|
| 822 |
+
#$files = "mypdf.pdf";
|
| 823 |
+
|
| 824 |
+
#$downloadableitems['link'][$downloadableitemsoptionscount]['file'] = $filearrayforimport;
|
| 825 |
+
} else if($configBundleOptionsCodes[3] == "url") {
|
| 826 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['link_url'] = $configBundleOptionsCodes[4];
|
| 827 |
+
}
|
| 828 |
+
|
| 829 |
+
if(isset($configBundleOptionsCodes[5])) {
|
| 830 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['sort_order'] = $configBundleOptionsCodes[5];
|
| 831 |
+
} else {
|
| 832 |
+
$downloadableitems['link'][$downloadableitemsoptionscount]['sort_order'] = 0;
|
| 833 |
+
}
|
| 834 |
+
$product->setDownloadableData($downloadableitems);
|
| 835 |
+
$downloadableitemsoptionscount+=1;
|
| 836 |
+
}
|
| 837 |
+
|
| 838 |
+
}
|
| 839 |
+
}
|
| 840 |
+
//THIS IS FOR BUNDLE PRODUCTS
|
| 841 |
+
if ($importData['type'] == 'bundle') {
|
| 842 |
+
if ($new) {
|
| 843 |
+
$optionscount=0;
|
| 844 |
+
$items = array();
|
| 845 |
+
//THIS IS FOR BUNDLE OPTIONS
|
| 846 |
+
$commadelimiteddata = explode('|',$importData['bundle_options']);
|
| 847 |
+
foreach ($commadelimiteddata as $data) {
|
| 848 |
+
$configBundleOptionsCodes = $this->userCSVDataAsArray($data);
|
| 849 |
+
$titlebundleselection = ucfirst(str_replace('_',' ',$configBundleOptionsCodes[0]));
|
| 850 |
+
$items[$optionscount]['title'] = $titlebundleselection;
|
| 851 |
+
$items[$optionscount]['type'] = $configBundleOptionsCodes[1];
|
| 852 |
+
$items[$optionscount]['required'] = $configBundleOptionsCodes[2];
|
| 853 |
+
$items[$optionscount]['position'] = $configBundleOptionsCodes[3];
|
| 854 |
+
$items[$optionscount]['delete'] = 0;
|
| 855 |
+
$optionscount+=1;
|
| 856 |
+
|
| 857 |
+
|
| 858 |
+
if ($items) {
|
| 859 |
+
$product->setBundleOptionsData($items);
|
| 860 |
+
}
|
| 861 |
+
$options_id = $product->getOptionId();
|
| 862 |
+
$selections = array();
|
| 863 |
+
$bundleConfigData = array();
|
| 864 |
+
$optionscountselection=0;
|
| 865 |
+
//THIS IS FOR BUNDLE SELECTIONS
|
| 866 |
+
$commadelimiteddataselections = explode('|',$importData['bundle_selections']);
|
| 867 |
+
foreach ($commadelimiteddataselections as $selection) {
|
| 868 |
+
$configBundleSelectionCodes = $this->userCSVDataAsArray($selection);
|
| 869 |
+
$selectionscount=0;
|
| 870 |
+
foreach ($configBundleSelectionCodes as $selectionItem) {
|
| 871 |
+
$bundleConfigData = explode(':',$selectionItem);
|
| 872 |
+
$selections[$optionscountselection][$selectionscount]['option_id'] = $options_id;
|
| 873 |
+
$selections[$optionscountselection][$selectionscount]['product_id'] = $product->getIdBySku($bundleConfigData[0]);
|
| 874 |
+
$selections[$optionscountselection][$selectionscount]['selection_price_type'] = $bundleConfigData[1];
|
| 875 |
+
$selections[$optionscountselection][$selectionscount]['selection_price_value'] = $bundleConfigData[2];
|
| 876 |
+
$selections[$optionscountselection][$selectionscount]['is_default'] = $bundleConfigData[3];
|
| 877 |
+
if(isset($bundleConfigData) && isset($bundleConfigData[4]) && $bundleConfigData[4] != '') {
|
| 878 |
+
$selections[$optionscountselection][$selectionscount]['selection_qty'] = $bundleConfigData[4];
|
| 879 |
+
$selections[$optionscountselection][$selectionscount]['selection_can_change_qty'] = $bundleConfigData[5];
|
| 880 |
+
}
|
| 881 |
+
if(isset($bundleConfigData) && isset($bundleConfigData[6]) && $bundleConfigData[6] != '') {
|
| 882 |
+
$selections[$optionscountselection][$selectionscount]['position'] = $bundleConfigData[6];
|
| 883 |
+
}
|
| 884 |
+
$selections[$optionscountselection][$selectionscount]['delete'] = 0;
|
| 885 |
+
$selectionscount+=1;
|
| 886 |
+
}
|
| 887 |
+
$optionscountselection+=1;
|
| 888 |
+
}
|
| 889 |
+
if ($selections) {
|
| 890 |
+
$product->setBundleSelectionsData($selections);
|
| 891 |
+
}
|
| 892 |
+
|
| 893 |
+
}
|
| 894 |
+
|
| 895 |
+
|
| 896 |
+
if ($product->getPriceType() == '0') {
|
| 897 |
+
$product->setCanSaveCustomOptions(true);
|
| 898 |
+
if ($customOptions = $product->getProductOptions()) {
|
| 899 |
+
foreach ($customOptions as $key => $customOption) {
|
| 900 |
+
$customOptions[$key]['is_delete'] = 1;
|
| 901 |
+
}
|
| 902 |
+
$product->setProductOptions($customOptions);
|
| 903 |
+
}
|
| 904 |
+
}
|
| 905 |
+
|
| 906 |
+
$product->setCanSaveBundleSelections();
|
| 907 |
+
}
|
| 908 |
+
}
|
| 909 |
+
if ( isset( $importData['related'] ) ) {
|
| 910 |
+
$pos = strpos($importData['related'], ":");
|
| 911 |
+
if ($pos !== false) {
|
| 912 |
+
$linkIds = $this -> skusToIdswithPosition( $importData['related'], $product );
|
| 913 |
+
} else {
|
| 914 |
+
$linkIds = $this -> skusToIds( $importData['related'], $product );
|
| 915 |
+
}
|
| 916 |
+
if ( !empty( $linkIds ) ) {
|
| 917 |
+
$product -> setRelatedLinkData( $linkIds );
|
| 918 |
+
}
|
| 919 |
+
}
|
| 920 |
+
|
| 921 |
+
if ( isset( $importData['upsell'] ) ) {
|
| 922 |
+
$pos = strpos($importData['upsell'], ":");
|
| 923 |
+
if ($pos !== false) {
|
| 924 |
+
$linkIds = $this -> skusToIdswithPosition( $importData['upsell'], $product );
|
| 925 |
+
} else {
|
| 926 |
+
$linkIds = $this -> skusToIds( $importData['upsell'], $product );
|
| 927 |
+
}
|
| 928 |
+
if ( !empty( $linkIds ) ) {
|
| 929 |
+
$product -> setUpSellLinkData( $linkIds );
|
| 930 |
+
}
|
| 931 |
+
}
|
| 932 |
+
|
| 933 |
+
if ( isset( $importData['crosssell'] ) ) {
|
| 934 |
+
$pos = strpos($importData['crosssell'], ":");
|
| 935 |
+
if ($pos !== false) {
|
| 936 |
+
$linkIds = $this -> skusToIdswithPosition( $importData['crosssell'], $product );
|
| 937 |
+
} else {
|
| 938 |
+
$linkIds = $this -> skusToIds( $importData['crosssell'], $product );
|
| 939 |
+
}
|
| 940 |
+
if ( !empty( $linkIds ) ) {
|
| 941 |
+
$product -> setCrossSellLinkData( $linkIds );
|
| 942 |
+
}
|
| 943 |
+
}
|
| 944 |
+
/*
|
| 945 |
+
if ( isset( $importData['grouped'] ) ) {
|
| 946 |
+
$linkIds = $this -> skusToIds( $importData['grouped'], $product );
|
| 947 |
+
if ( !empty( $linkIds ) ) {
|
| 948 |
+
$product -> setGroupedLinkData( $linkIds );
|
| 949 |
+
}
|
| 950 |
+
}
|
| 951 |
+
*/
|
| 952 |
+
/* MODDED TO ALLOW FOR GROUP POSITION AS WELL AND SHOULD WORK IF NO POSITION IS SET AS WELL CAN COMBO */
|
| 953 |
+
if ( isset( $importData['grouped'] ) && $importData['grouped'] != "" ) {
|
| 954 |
+
|
| 955 |
+
$finalIDssthatneedtobeconvertedto=array();
|
| 956 |
+
$finalskusthatneedtobeconvertedtoID="";
|
| 957 |
+
$groupedpositioncounter=0;
|
| 958 |
+
$finalskusforarraytoexplode = explode(",",$importData['grouped']);
|
| 959 |
+
foreach($finalskusforarraytoexplode as $productskuexploded)
|
| 960 |
+
{
|
| 961 |
+
$pos = strpos($productskuexploded, ":");
|
| 962 |
+
if ($pos !== false) {
|
| 963 |
+
//if( isset($finalidsforarraytoexplode[1]) ) {
|
| 964 |
+
$finalidsforarraytoexplode = explode(":",$productskuexploded);
|
| 965 |
+
$finalIDssthatneedtobeconvertedto[$groupedpositioncounter]['position'] = $finalidsforarraytoexplode[0];
|
| 966 |
+
$finalIDssthatneedtobeconvertedto[$groupedpositioncounter]['sku'] = $finalidsforarraytoexplode[1];
|
| 967 |
+
if ($finalidsforarraytoexplode[2]) {
|
| 968 |
+
$finalIDssthatneedtobeconvertedto[$groupedpositioncounter]['qty'] = $finalidsforarraytoexplode[2];
|
| 969 |
+
}
|
| 970 |
+
$finalskusthatneedtobeconvertedtoID .= $finalidsforarraytoexplode[1] . ",";
|
| 971 |
+
} else {
|
| 972 |
+
$finalskusthatneedtobeconvertedtoID .= $productskuexploded . ",";
|
| 973 |
+
}
|
| 974 |
+
$groupedpositioncounter++;
|
| 975 |
+
}
|
| 976 |
+
$linkIds = $this -> skusToIds( $finalskusthatneedtobeconvertedtoID, $product );
|
| 977 |
+
if ( !empty( $linkIds ) ) {
|
| 978 |
+
$product -> setGroupedLinkData( $linkIds );
|
| 979 |
+
}
|
| 980 |
+
}
|
| 981 |
+
|
| 982 |
+
/**
|
| 983 |
+
Assign product to category by "Category Name"
|
| 984 |
+
**/
|
| 985 |
+
/*
|
| 986 |
+
if(isset( $importData['category_names'] ))
|
| 987 |
+
{
|
| 988 |
+
$catsarray = explode(",",$importData['category_names']);
|
| 989 |
+
$catsarray = Mage::getModel('catalog/category')
|
| 990 |
+
->getCollection()
|
| 991 |
+
->addAttributeToSelect('name')
|
| 992 |
+
->addAttributeToFilter('name',array('in' => $catsarray))
|
| 993 |
+
->getAllIds();
|
| 994 |
+
|
| 995 |
+
$product -> setCategoryIds($catsarray);
|
| 996 |
+
}*/
|
| 997 |
+
|
| 998 |
+
/**
|
| 999 |
+
Assign
|
| 1000 |
+
product to category by "Category Ids"
|
| 1001 |
+
**/
|
| 1002 |
+
if ( isset( $importData['category_ids'] ) )
|
| 1003 |
+
{
|
| 1004 |
+
|
| 1005 |
+
/**Fetch category mapping detail**/
|
| 1006 |
+
$profileId = Mage::getSingleton('core/session')->getTemplateProfileId();
|
| 1007 |
+
|
| 1008 |
+
$oopsrofile = Mage::getModel('oopsprofile/oopsprofile')->getCollection()
|
| 1009 |
+
->addFieldToFilter('dataflow_profile_id',$profileId)
|
| 1010 |
+
->getFirstItem();
|
| 1011 |
+
//$selectedProfile = $oopsrofile->getProfileTemplate();
|
| 1012 |
+
|
| 1013 |
+
//$tempModel = Mage::getModel('oopsprofile/template')->load($selectedProfile);
|
| 1014 |
+
|
| 1015 |
+
//$categoryMapping = $tempModel->getCategoryMapping();
|
| 1016 |
+
$categoryMapping = '';
|
| 1017 |
+
|
| 1018 |
+
$mappingDetail = '';
|
| 1019 |
+
|
| 1020 |
+
if($categoryMapping!='')//if category mapping exist
|
| 1021 |
+
{
|
| 1022 |
+
$categoryMappingModel = Mage::getModel('oopsprofile/mapping')->load($categoryMapping);
|
| 1023 |
+
$mappingDetail = unserialize($categoryMappingModel->getMappingDetail());
|
| 1024 |
+
|
| 1025 |
+
$catsarray = explode(",",$importData['category_ids']);
|
| 1026 |
+
|
| 1027 |
+
$result = array_intersect($mappingDetail, $catsarray);
|
| 1028 |
+
|
| 1029 |
+
$catIds = array_keys($result);
|
| 1030 |
+
|
| 1031 |
+
$product -> setCategoryIds( $catIds );
|
| 1032 |
+
|
| 1033 |
+
}
|
| 1034 |
+
else
|
| 1035 |
+
{
|
| 1036 |
+
|
| 1037 |
+
#keeps existing category_ids and adds new ones to them
|
| 1038 |
+
if($this->getBatchParams('append_categories') == "true") {
|
| 1039 |
+
$cats = $product->getCategoryIds();
|
| 1040 |
+
$catsarray = explode(",",$importData['category_ids']);
|
| 1041 |
+
$finalcatsimport = array_merge($cats, $catsarray);
|
| 1042 |
+
$product -> setCategoryIds( $finalcatsimport );
|
| 1043 |
+
} else {
|
| 1044 |
+
$catsarray = explode(",",$importData['category_ids']);//convert in array form
|
| 1045 |
+
$product -> setCategoryIds($catsarray);
|
| 1046 |
+
}
|
| 1047 |
+
}
|
| 1048 |
+
}
|
| 1049 |
+
|
| 1050 |
+
|
| 1051 |
+
if( isset($importData['tier_prices']) && !empty($importData['tier_prices']) ) {
|
| 1052 |
+
$this->_editTierPrices($product, $importData['tier_prices'], $store);
|
| 1053 |
+
}
|
| 1054 |
+
|
| 1055 |
+
|
| 1056 |
+
if ( isset( $importData['categories'] ) && $importData['categories'] !="" ) {
|
| 1057 |
+
if (!empty($importData['store'])) {
|
| 1058 |
+
$cat_store = $this -> _stores[$importData['store']];
|
| 1059 |
+
} else {
|
| 1060 |
+
$message = Mage :: helper( 'catalog' ) -> __( 'Skip import row, required field "store" for new products not defined', $field );
|
| 1061 |
+
Mage :: throwException( $message );
|
| 1062 |
+
}
|
| 1063 |
+
$categoryIds = $this -> _addCategories( $importData['categories'], $cat_store );
|
| 1064 |
+
if ( $categoryIds ) {
|
| 1065 |
+
#keeps existing category_ids and adds new ones to them
|
| 1066 |
+
if($this->getBatchParams('append_categories') == "true") {
|
| 1067 |
+
$cats = $product->getCategoryIds();
|
| 1068 |
+
$catsarray = explode(",",$categoryIds);
|
| 1069 |
+
$finalcatsimport = array_merge($cats, $catsarray);
|
| 1070 |
+
$product -> setCategoryIds( $finalcatsimport );
|
| 1071 |
+
} else {
|
| 1072 |
+
$product -> setCategoryIds( $categoryIds );
|
| 1073 |
+
}
|
| 1074 |
+
}
|
| 1075 |
+
}
|
| 1076 |
+
|
| 1077 |
+
foreach ( $this -> _ignoreFields as $field ) {
|
| 1078 |
+
if ( isset( $importData[$field] ) ) {
|
| 1079 |
+
unset( $importData[$field] );
|
| 1080 |
+
}
|
| 1081 |
+
}
|
| 1082 |
+
|
| 1083 |
+
if ($store->getId() != 0) {
|
| 1084 |
+
$websiteIds = $product->getWebsiteIds();
|
| 1085 |
+
if (!is_array($websiteIds)) {
|
| 1086 |
+
$websiteIds = array();
|
| 1087 |
+
}
|
| 1088 |
+
if (!in_array($store->getWebsiteId(), $websiteIds)) {
|
| 1089 |
+
$websiteIds[] = $store->getWebsiteId();
|
| 1090 |
+
}
|
| 1091 |
+
$product->setWebsiteIds($websiteIds);
|
| 1092 |
+
}
|
| 1093 |
+
|
| 1094 |
+
if ( isset( $importData['websites'] ) ) {
|
| 1095 |
+
$websiteIds = $product -> getWebsiteIds();
|
| 1096 |
+
if ( !is_array( $websiteIds ) ) {
|
| 1097 |
+
$websiteIds = array();
|
| 1098 |
+
}
|
| 1099 |
+
$websiteCodes = explode( ',', $importData['websites'] );
|
| 1100 |
+
foreach ( $websiteCodes as $websiteCode ) {
|
| 1101 |
+
try {
|
| 1102 |
+
$website = Mage :: app() -> getWebsite( trim( $websiteCode ) );
|
| 1103 |
+
if ( !in_array( $website -> getId(), $websiteIds ) ) {
|
| 1104 |
+
$websiteIds[] = $website -> getId();
|
| 1105 |
+
}
|
| 1106 |
+
}
|
| 1107 |
+
catch ( Exception $e ) {
|
| 1108 |
+
}
|
| 1109 |
+
}
|
| 1110 |
+
$product -> setWebsiteIds( $websiteIds );
|
| 1111 |
+
unset( $websiteIds );
|
| 1112 |
+
}
|
| 1113 |
+
|
| 1114 |
+
$custom_options = array();
|
| 1115 |
+
|
| 1116 |
+
foreach ( $importData as $field => $value ) {
|
| 1117 |
+
//SEEMS TO BE CONFLICTING ISSUES WITH THESE 2 CHOICES AND DOESNT SEEM TO REQUIRE THIS IN ALL THE TESTING SO LEAVING COMMENTED
|
| 1118 |
+
//if ( in_array( $field, $this -> _inventoryFields ) ) {
|
| 1119 |
+
//continue;
|
| 1120 |
+
//}
|
| 1121 |
+
/*
|
| 1122 |
+
if (in_array($field, $this->_inventorySimpleFields))
|
| 1123 |
+
{
|
| 1124 |
+
continue;
|
| 1125 |
+
}
|
| 1126 |
+
*/
|
| 1127 |
+
if ( in_array( $field, $this -> _imageFields ) ) {
|
| 1128 |
+
continue;
|
| 1129 |
+
}
|
| 1130 |
+
|
| 1131 |
+
$attribute = $this -> getAttribute( $field );
|
| 1132 |
+
if ( !$attribute ) {
|
| 1133 |
+
/* CUSTOM OPTION CODE */
|
| 1134 |
+
if(strpos($field,':')!==FALSE && strlen($value)) {
|
| 1135 |
+
$values=explode('|',$value);
|
| 1136 |
+
if(count($values)>0) {
|
| 1137 |
+
$iscustomoptions = "true";
|
| 1138 |
+
|
| 1139 |
+
foreach($values as $v) {
|
| 1140 |
+
$parts = explode(':',$v);
|
| 1141 |
+
$title = $parts[0];
|
| 1142 |
+
}
|
| 1143 |
+
//RANDOM ISSUE HERE SOMETIMES WITH TITLES OF LAST ITEM IN DROPDOWN SHOWING AS TITLE MIGHT NEED TO SEPERATE TITLE variables
|
| 1144 |
+
@list($title,$type,$is_required,$sort_order) = explode(':',$field);
|
| 1145 |
+
$title2 = ucfirst(str_replace('_',' ',$title));
|
| 1146 |
+
$custom_options[] = array(
|
| 1147 |
+
'is_delete'=>0,
|
| 1148 |
+
'title'=>$title2,
|
| 1149 |
+
'previous_group'=>'',
|
| 1150 |
+
'previous_type'=>'',
|
| 1151 |
+
'type'=>$type,
|
| 1152 |
+
'is_require'=>$is_required,
|
| 1153 |
+
'sort_order'=>$sort_order,
|
| 1154 |
+
'values'=>array()
|
| 1155 |
+
);
|
| 1156 |
+
if($is_required ==1) {
|
| 1157 |
+
$iscustomoptionsrequired = "true";
|
| 1158 |
+
}
|
| 1159 |
+
foreach($values as $v) {
|
| 1160 |
+
$parts = explode(':',$v);
|
| 1161 |
+
$title = $parts[0];
|
| 1162 |
+
if(count($parts)>1) {
|
| 1163 |
+
$price_type = $parts[1];
|
| 1164 |
+
} else {
|
| 1165 |
+
$price_type = 'fixed';
|
| 1166 |
+
}
|
| 1167 |
+
if(count($parts)>2) {
|
| 1168 |
+
$price = $parts[2];
|
| 1169 |
+
} else {
|
| 1170 |
+
$price =0;
|
| 1171 |
+
}
|
| 1172 |
+
if(count($parts)>3) {
|
| 1173 |
+
$sku = $parts[3];
|
| 1174 |
+
} else {
|
| 1175 |
+
$sku='';
|
| 1176 |
+
}
|
| 1177 |
+
if(count($parts)>4) {
|
| 1178 |
+
$sort_order = $parts[4];
|
| 1179 |
+
} else {
|
| 1180 |
+
$sort_order = 0;
|
| 1181 |
+
}
|
| 1182 |
+
if(count($parts)>5) {
|
| 1183 |
+
$max_characters = $parts[5];
|
| 1184 |
+
} else {
|
| 1185 |
+
$max_characters = '';
|
| 1186 |
+
}
|
| 1187 |
+
if(count($parts)>6) {
|
| 1188 |
+
$file_extension = $parts[6];
|
| 1189 |
+
} else {
|
| 1190 |
+
$file_extension = '';
|
| 1191 |
+
}
|
| 1192 |
+
if(count($parts)>7) {
|
| 1193 |
+
$image_size_x = $parts[7];
|
| 1194 |
+
} else {
|
| 1195 |
+
$image_size_x = '';
|
| 1196 |
+
}
|
| 1197 |
+
if(count($parts)>8) {
|
| 1198 |
+
$image_size_y = $parts[8];
|
| 1199 |
+
} else {
|
| 1200 |
+
$image_size_y = '';
|
| 1201 |
+
}
|
| 1202 |
+
switch($type) {
|
| 1203 |
+
case 'file':
|
| 1204 |
+
/* TODO */
|
| 1205 |
+
$custom_options[count($custom_options) - 1]['price_type'] = $price_type;
|
| 1206 |
+
$custom_options[count($custom_options) - 1]['price'] = $price;
|
| 1207 |
+
$custom_options[count($custom_options) - 1]['sku'] = $sku;
|
| 1208 |
+
$custom_options[count($custom_options) - 1]['file_extension'] = $file_extension;
|
| 1209 |
+
$custom_options[count($custom_options) - 1]['image_size_x'] = $image_size_x;
|
| 1210 |
+
$custom_options[count($custom_options) - 1]['image_size_y'] = $image_size_y;
|
| 1211 |
+
break;
|
| 1212 |
+
|
| 1213 |
+
case 'field':
|
| 1214 |
+
$custom_options[count($custom_options) - 1]['max_characters'] = $max_characters;
|
| 1215 |
+
case 'area':
|
| 1216 |
+
$custom_options[count($custom_options) - 1]['max_characters'] = $max_characters;
|
| 1217 |
+
/* NO BREAK */
|
| 1218 |
+
|
| 1219 |
+
case 'date':
|
| 1220 |
+
case 'date_time':
|
| 1221 |
+
case 'time':
|
| 1222 |
+
$custom_options[count($custom_options) - 1]['price_type'] = $price_type;
|
| 1223 |
+
$custom_options[count($custom_options) - 1]['price'] = $price;
|
| 1224 |
+
$custom_options[count($custom_options) - 1]['sku'] = $sku;
|
| 1225 |
+
break;
|
| 1226 |
+
|
| 1227 |
+
case 'drop_down':
|
| 1228 |
+
case 'radio':
|
| 1229 |
+
case 'checkbox':
|
| 1230 |
+
case 'multiple':
|
| 1231 |
+
default:
|
| 1232 |
+
$custom_options[count($custom_options) - 1]['values'][]=array(
|
| 1233 |
+
'is_delete'=>0,
|
| 1234 |
+
'title'=>$title,
|
| 1235 |
+
'option_type_id'=>-1,
|
| 1236 |
+
'price_type'=>$price_type,
|
| 1237 |
+
'price'=>$price,
|
| 1238 |
+
'sku'=>$sku,
|
| 1239 |
+
'sort_order'=>$sort_order,
|
| 1240 |
+
'max_characters'=>$max_characters,
|
| 1241 |
+
);
|
| 1242 |
+
break;
|
| 1243 |
+
}
|
| 1244 |
+
}
|
| 1245 |
+
}
|
| 1246 |
+
}
|
| 1247 |
+
/* END CUSTOM OPTION CODE */
|
| 1248 |
+
continue;
|
| 1249 |
+
}
|
| 1250 |
+
|
| 1251 |
+
$isArray = false;
|
| 1252 |
+
$setValue = $value;
|
| 1253 |
+
|
| 1254 |
+
if ( $attribute -> getFrontendInput() == 'multiselect' ) {
|
| 1255 |
+
$value = explode( self :: MULTI_DELIMITER, $value );
|
| 1256 |
+
$isArray = true;
|
| 1257 |
+
$setValue = array();
|
| 1258 |
+
}
|
| 1259 |
+
|
| 1260 |
+
if ( $value && $attribute -> getBackendType() == 'decimal' ) {
|
| 1261 |
+
//$setValue = $this -> getNumber( $value );
|
| 1262 |
+
$setValue = $value ;
|
| 1263 |
+
}
|
| 1264 |
+
|
| 1265 |
+
if ( $attribute -> usesSource() ) {
|
| 1266 |
+
$options = $attribute -> getSource() -> getAllOptions( false );
|
| 1267 |
+
|
| 1268 |
+
if ($isArray) {
|
| 1269 |
+
foreach ($options as $item) {
|
| 1270 |
+
if (in_array($item['label'], $value)) {
|
| 1271 |
+
$setValue[] = $item['value'];
|
| 1272 |
+
}
|
| 1273 |
+
}
|
| 1274 |
+
} else {
|
| 1275 |
+
$setValue = false;
|
| 1276 |
+
foreach ($options as $item) {
|
| 1277 |
+
if (is_array($item['value'])) {
|
| 1278 |
+
foreach ($item['value'] as $subValue) {
|
| 1279 |
+
if (isset($subValue['value']) && $subValue['value'] == $value) {
|
| 1280 |
+
$setValue = $value;
|
| 1281 |
+
}
|
| 1282 |
+
}
|
| 1283 |
+
} else if ($item['label'] == $value) {
|
| 1284 |
+
$setValue = $item['value'];
|
| 1285 |
+
}
|
| 1286 |
+
}
|
| 1287 |
+
}
|
| 1288 |
+
}
|
| 1289 |
+
|
| 1290 |
+
#$product -> setData( $field, $setValue );
|
| 1291 |
+
//FIX FOR WHEN IMAGES LOOSE RADIO BUTTON SETTINGS
|
| 1292 |
+
if($new || $this->getBatchParams('reimport_images') == "true") {
|
| 1293 |
+
$product -> setData( $field, $setValue );
|
| 1294 |
+
} else {
|
| 1295 |
+
if (!in_array($field, array('image', 'thumbnail', 'small_image', 'gallery'))) {
|
| 1296 |
+
$product->setData($field, $setValue);
|
| 1297 |
+
}
|
| 1298 |
+
}
|
| 1299 |
+
}
|
| 1300 |
+
|
| 1301 |
+
if ( !$product -> getVisibility() ) {
|
| 1302 |
+
$product -> setVisibility( Mage_Catalog_Model_Product_Visibility :: VISIBILITY_NOT_VISIBLE );
|
| 1303 |
+
}
|
| 1304 |
+
|
| 1305 |
+
$stockData = array();
|
| 1306 |
+
$inventoryFields = isset($this->_inventoryFieldsProductTypes[$product->getTypeId()])
|
| 1307 |
+
? $this->_inventoryFieldsProductTypes[$product->getTypeId()]
|
| 1308 |
+
: array();
|
| 1309 |
+
|
| 1310 |
+
foreach ( $inventoryFields as $field ) {
|
| 1311 |
+
if ( isset( $importData[$field] ) ) {
|
| 1312 |
+
if ( in_array( $field, $this -> _toNumber ) ) {
|
| 1313 |
+
//$stockData[$field] = $this -> getNumber( $importData[$field] );
|
| 1314 |
+
$stockData[$field] = $importData[$field] ;
|
| 1315 |
+
}
|
| 1316 |
+
else {
|
| 1317 |
+
$stockData[$field] = $importData[$field];
|
| 1318 |
+
}
|
| 1319 |
+
}
|
| 1320 |
+
}
|
| 1321 |
+
$product -> setStockData( $stockData );
|
| 1322 |
+
|
| 1323 |
+
if(!isset($importData["image"]))
|
| 1324 |
+
{
|
| 1325 |
+
$importData["image"] = '';
|
| 1326 |
+
}
|
| 1327 |
+
if(!isset($importData["small_image"]))
|
| 1328 |
+
{
|
| 1329 |
+
$importData["small_image"] = '';
|
| 1330 |
+
}
|
| 1331 |
+
if(!isset($importData["thumbnail"]))
|
| 1332 |
+
{
|
| 1333 |
+
$importData["thumbnail"] = '';
|
| 1334 |
+
}
|
| 1335 |
+
|
| 1336 |
+
if($new || $this->getBatchParams('reimport_images') == "true") { //starts CHECK FOR IF REIMPORTING IMAGES TO PRODUCTS IS TRUE
|
| 1337 |
+
//this is a check if we want to delete all images before import of images from csv
|
| 1338 |
+
if($this->getBatchParams('deleteall_andreimport_images') == "true" && $importData["image"] != "" && $importData["small_image"] != "" && $importData["thumbnail"] != "") {
|
| 1339 |
+
$attributes = $product->getTypeInstance()->getSetAttributes();
|
| 1340 |
+
if (isset($attributes['media_gallery'])) {
|
| 1341 |
+
$gallery = $attributes['media_gallery'];
|
| 1342 |
+
//Get the images
|
| 1343 |
+
$galleryData = $product->getMediaGallery();
|
| 1344 |
+
if(!empty($galleryData)) {
|
| 1345 |
+
foreach($galleryData['images'] as $image){
|
| 1346 |
+
//If image exists
|
| 1347 |
+
if ($gallery->getBackend()->getImage($product, $image['file'])) {
|
| 1348 |
+
$gallery->getBackend()->removeImage($product, $image['file']);
|
| 1349 |
+
//if ( file_exists(Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product' . $image['file'] ) ) {
|
| 1350 |
+
if ( file_exists( $image['file'] ) ) {
|
| 1351 |
+
$ext = substr(strrchr($image['file'], '.'), 1);
|
| 1352 |
+
//if( strlen( $ext ) == 3 ) { //maybe needs to be 3
|
| 1353 |
+
if( strlen( $ext ) == 4 ) {
|
| 1354 |
+
unlink (Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product' . $image['file']);
|
| 1355 |
+
}
|
| 1356 |
+
}
|
| 1357 |
+
}
|
| 1358 |
+
}
|
| 1359 |
+
}
|
| 1360 |
+
}
|
| 1361 |
+
}
|
| 1362 |
+
if($importData["image"] != "" || $importData["small_image"] != "" || $importData["thumbnail"] != "" ) {
|
| 1363 |
+
$mediaGalleryBackendModel = $this->getAttribute('media_gallery')->getBackend();
|
| 1364 |
+
|
| 1365 |
+
$arrayToMassAdd = array();
|
| 1366 |
+
|
| 1367 |
+
foreach ($product->getMediaAttributes() as $mediaAttributeCode => $mediaAttribute) {
|
| 1368 |
+
if (isset($importData[$mediaAttributeCode])) {
|
| 1369 |
+
$file = $importData[$mediaAttributeCode];
|
| 1370 |
+
if(file_exists(Mage :: getBaseDir( 'media' ) . DS . 'import' . $file)){
|
| 1371 |
+
if (trim($file) && !$mediaGalleryBackendModel->getImage($product, $file)) {
|
| 1372 |
+
$arrayToMassAdd[] = array('file' => trim($file), 'mediaAttribute' => $mediaAttributeCode);
|
| 1373 |
+
}
|
| 1374 |
+
}
|
| 1375 |
+
}
|
| 1376 |
+
}
|
| 1377 |
+
|
| 1378 |
+
if($this->getBatchParams('exclude_images') == "true") {
|
| 1379 |
+
#$product -> addImageToMediaGallery( Mage :: getBaseDir( 'media' ) . DS . 'import/' . $file, $fields, false );
|
| 1380 |
+
$addedFilesCorrespondence = $mediaGalleryBackendModel->addImagesWithDifferentMediaAttributes($product, $arrayToMassAdd, Mage::getBaseDir('media') . DS . 'import', false);
|
| 1381 |
+
} else {
|
| 1382 |
+
#$product -> addImageToMediaGallery( Mage :: getBaseDir( 'media' ) . DS . 'import/' . $file, $fields, false, false );
|
| 1383 |
+
$addedFilesCorrespondence = $mediaGalleryBackendModel->addImagesWithDifferentMediaAttributes($product, $arrayToMassAdd, Mage::getBaseDir('media') . DS . 'import', false, false);
|
| 1384 |
+
}
|
| 1385 |
+
|
| 1386 |
+
foreach ($product->getMediaAttributes() as $mediaAttributeCode => $mediaAttribute) {
|
| 1387 |
+
$addedFile = '';
|
| 1388 |
+
if (isset($importData[$mediaAttributeCode . '_label'])) {
|
| 1389 |
+
$fileLabel = trim($importData[$mediaAttributeCode . '_label']);
|
| 1390 |
+
if (isset($importData[$mediaAttributeCode])) {
|
| 1391 |
+
$keyInAddedFile = array_search($importData[$mediaAttributeCode],
|
| 1392 |
+
$addedFilesCorrespondence['alreadyAddedFiles']);
|
| 1393 |
+
if ($keyInAddedFile !== false) {
|
| 1394 |
+
$addedFile = $addedFilesCorrespondence['alreadyAddedFilesNames'][$keyInAddedFile];
|
| 1395 |
+
}
|
| 1396 |
+
}
|
| 1397 |
+
|
| 1398 |
+
if (!$addedFile) {
|
| 1399 |
+
$addedFile = $product->getData($mediaAttributeCode);
|
| 1400 |
+
}
|
| 1401 |
+
if ($fileLabel && $addedFile) {
|
| 1402 |
+
$mediaGalleryBackendModel->updateImage($product, $addedFile, array('label' => $fileLabel));
|
| 1403 |
+
}
|
| 1404 |
+
}
|
| 1405 |
+
}
|
| 1406 |
+
|
| 1407 |
+
} //end check on empty values
|
| 1408 |
+
|
| 1409 |
+
if ( !empty( $importData['gallery'] ) ) {
|
| 1410 |
+
$galleryData = explode( ',', $importData["gallery"] );
|
| 1411 |
+
foreach( $galleryData as $gallery_img ) {
|
| 1412 |
+
try {
|
| 1413 |
+
//FIX STOPS INSERT OF DUPLICATE IMAGE INTO GALLERY FROM SMALL/MAIN/THUMB WHEN TRANSFERING FROM OLDER TO NEWER INSTALLS THIS COULD OCCUR
|
| 1414 |
+
#if(trim($gallery_img) != $importData["image"] || trim($gallery_img) != $importData["small_image"] || trim($gallery_img) != $importData["thumbnail"])
|
| 1415 |
+
#{
|
| 1416 |
+
if($this->getBatchParams('exclude_gallery_images') == "true") {
|
| 1417 |
+
$product -> addImageToMediaGallery( Mage :: getBaseDir( 'media' ) . DS . 'import' . $gallery_img, null, false, true );
|
| 1418 |
+
} else {
|
| 1419 |
+
$product -> addImageToMediaGallery( Mage :: getBaseDir( 'media' ) . DS . 'import' . $gallery_img, null, false, false );
|
| 1420 |
+
}
|
| 1421 |
+
#}
|
| 1422 |
+
}
|
| 1423 |
+
catch ( Exception $e ) {
|
| 1424 |
+
Mage::log(sprintf('failed to import gallery images: %s', $e->getMessage()), null,'ce_product_import_export_errors.log');
|
| 1425 |
+
}
|
| 1426 |
+
}
|
| 1427 |
+
}
|
| 1428 |
+
|
| 1429 |
+
|
| 1430 |
+
#} // this ends check if enabled
|
| 1431 |
+
} // this else is for check for if we can reimport products
|
| 1432 |
+
$product -> setIsMassupdate( true );
|
| 1433 |
+
$product -> setExcludeUrlRewrite( true );
|
| 1434 |
+
//PATCH FOR Fatal error: Call to a member function getStoreId() on a non-object in D:\web\magento\app\code\core\Mage\Bundle\Model\Selection.php on line 52
|
| 1435 |
+
if (!Mage::registry('product')) {
|
| 1436 |
+
Mage::register('product', Mage::getModel('catalog/product')->setStoreId(0));
|
| 1437 |
+
//Mage::register('product', $product); maybe this is needed for when importing multi-store bundle vs above
|
| 1438 |
+
}
|
| 1439 |
+
$product -> save();
|
| 1440 |
+
|
| 1441 |
+
// Store affected products ids
|
| 1442 |
+
$this->_addAffectedEntityIds($product->getId());
|
| 1443 |
+
|
| 1444 |
+
if ( isset( $importData['product_tags'] ) && $importData['product_tags'] !="" ) {
|
| 1445 |
+
|
| 1446 |
+
#$configProductTags = $this->userCSVDataAsArray($importData['product_tags']);
|
| 1447 |
+
$configProductTags = explode(',', $importData['product_tags']);
|
| 1448 |
+
|
| 1449 |
+
#foreach ($commadelimiteddata as $dataseperated) {
|
| 1450 |
+
if(!empty($configProductTags)) {
|
| 1451 |
+
foreach ($configProductTags as $tagName) {
|
| 1452 |
+
try {
|
| 1453 |
+
$commadelimiteddata = explode(':',$tagName);
|
| 1454 |
+
|
| 1455 |
+
$tagName = $commadelimiteddata[1];
|
| 1456 |
+
$tagModel = Mage::getModel('tag/tag');
|
| 1457 |
+
$result = $tagModel->loadByName($tagName);
|
| 1458 |
+
#echo $result;
|
| 1459 |
+
#echo "PRODID: " . $product -> getIdBySku( $importData['sku'] ) . " Name: " . $tagName;
|
| 1460 |
+
$tagModel->setName($tagName)
|
| 1461 |
+
->setStoreId($importData['store'])
|
| 1462 |
+
->setStatus($tagModel->getApprovedStatus())
|
| 1463 |
+
->save();
|
| 1464 |
+
|
| 1465 |
+
$tagRelationModel = Mage::getModel('tag/tag_relation');
|
| 1466 |
+
/*$tagRelationModel->loadByTagCustomer($product -> getIdBySku( $importData['sku'] ), $tagModel->getId(), '13194', Mage::app()->getStore()->getId());*/
|
| 1467 |
+
if(isset($importData['customerID'])) {
|
| 1468 |
+
if($importData['customerID'] != "NULL") {
|
| 1469 |
+
$tagRelationModel->setTagId($tagModel->getId())
|
| 1470 |
+
->setCustomerId(trim($commadelimiteddata[0]))
|
| 1471 |
+
->setProductId($product -> getIdBySku( $importData['sku'] ))
|
| 1472 |
+
->setStoreId($importData['store'])
|
| 1473 |
+
->setCreatedAt( now() )
|
| 1474 |
+
->setActive(1)
|
| 1475 |
+
->save();
|
| 1476 |
+
} else {
|
| 1477 |
+
#echo "HERE";
|
| 1478 |
+
$data['tag_id'] = $tagModel->getId();
|
| 1479 |
+
$data['name'] = trim($tagName);
|
| 1480 |
+
$data['status'] = $tagModel->getApprovedStatus();
|
| 1481 |
+
$data['first_customer_id'] = "0";
|
| 1482 |
+
$data['first_store_id'] = "0";
|
| 1483 |
+
$data['visible_in_store_ids'] = array();
|
| 1484 |
+
$data['store_id'] = "1";
|
| 1485 |
+
$data['base_popularity'] = (isset($importData['base_popularity'])) ? $importData['base_popularity'] : 0;
|
| 1486 |
+
$data['store'] = $importData['store'];
|
| 1487 |
+
$tagModel2 = Mage::getModel('tag/tag');
|
| 1488 |
+
$tagModel2->addData($data);
|
| 1489 |
+
$productIds[] = $product->getIdBySku($importData['sku']);
|
| 1490 |
+
#print_r($productIds);
|
| 1491 |
+
#print_r($tagModel2);
|
| 1492 |
+
$tagRelationModel2 = Mage::getModel('tag/tag_relation');
|
| 1493 |
+
$tagRelationModel2->addRelations($tagModel2, $productIds);
|
| 1494 |
+
$tagModel2->save();
|
| 1495 |
+
$tagModel2->aggregate();
|
| 1496 |
+
}
|
| 1497 |
+
} else {
|
| 1498 |
+
$data['tag_id'] = $tagModel->getId();
|
| 1499 |
+
$data['name'] = trim($tagName);
|
| 1500 |
+
$data['status'] = $tagModel->getApprovedStatus();
|
| 1501 |
+
$data['first_customer_id'] = "0";
|
| 1502 |
+
$data['first_store_id'] = "0";
|
| 1503 |
+
$data['visible_in_store_ids'] = array();
|
| 1504 |
+
$data['store_id'] = "1";
|
| 1505 |
+
$data['base_popularity'] = (isset($importData['base_popularity'])) ? $importData['base_popularity'] : 0;
|
| 1506 |
+
$data['store'] = $importData['store'];
|
| 1507 |
+
$tagModel2 = Mage::getModel('tag/tag');
|
| 1508 |
+
$tagModel2->addData($data);
|
| 1509 |
+
$productIds[] = $product->getIdBySku($importData['sku']);
|
| 1510 |
+
#print_r($productIds);
|
| 1511 |
+
#print_r($tagModel2);
|
| 1512 |
+
$tagRelationModel2 = Mage::getModel('tag/tag_relation');
|
| 1513 |
+
$tagRelationModel2->addRelations($tagModel2, $productIds);
|
| 1514 |
+
$tagModel2->save();
|
| 1515 |
+
$tagModel2->aggregate();
|
| 1516 |
+
}
|
| 1517 |
+
$tagModel->aggregate();
|
| 1518 |
+
}
|
| 1519 |
+
catch ( Exception $e ) {
|
| 1520 |
+
Mage::log(sprintf('failed to import product tags: %s', $e->getMessage()), null,'ce_product_import_export_errors.log');
|
| 1521 |
+
}
|
| 1522 |
+
}
|
| 1523 |
+
}//check is array is not empty
|
| 1524 |
+
}
|
| 1525 |
+
|
| 1526 |
+
|
| 1527 |
+
|
| 1528 |
+
/* Add the custom options specified in the CSV import file */
|
| 1529 |
+
if(count($custom_options)) {
|
| 1530 |
+
|
| 1531 |
+
/* Remove existing custom options attached to the product */
|
| 1532 |
+
foreach ($product->getOptions() as $o) {
|
| 1533 |
+
$o->getValueInstance()->deleteValue($o->getId());
|
| 1534 |
+
$o->deletePrices($o->getId());
|
| 1535 |
+
$o->deleteTitles($o->getId());
|
| 1536 |
+
$o->delete();
|
| 1537 |
+
}
|
| 1538 |
+
foreach($custom_options as $option) {
|
| 1539 |
+
try {
|
| 1540 |
+
$opt = Mage::getModel('catalog/product_option');
|
| 1541 |
+
$opt->setProduct($product);
|
| 1542 |
+
$opt->addOption($option);
|
| 1543 |
+
$opt->saveOptions();
|
| 1544 |
+
}
|
| 1545 |
+
catch (Exception $e) {
|
| 1546 |
+
Mage::log(sprintf('failed to import custom options: %s', $e->getMessage()), null,'ce_product_import_export_errors.log');
|
| 1547 |
+
}
|
| 1548 |
+
}
|
| 1549 |
+
}
|
| 1550 |
+
|
| 1551 |
+
if($iscustomoptions == "true") {
|
| 1552 |
+
######### CUSTOM QUERY FIX FOR DISAPPEARING OPTIONS #################
|
| 1553 |
+
// fetch write database connection that is used in Mage_Core module
|
| 1554 |
+
/*
|
| 1555 |
+
if($currentproducttype == "simple") {
|
| 1556 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1557 |
+
$fixOptions = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 1558 |
+
// now $write is an instance of Zend_Db_Adapter_Abstract
|
| 1559 |
+
$fixOptions->query("UPDATE ".$prefix."catalog_product_entity SET has_options = 1 WHERE type_id = 'simple' AND entity_id IN (SELECT distinct(product_id) FROM ".$prefix."catalog_product_option)");
|
| 1560 |
+
|
| 1561 |
+
} else if ($currentproducttype == "configurable") {
|
| 1562 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1563 |
+
$fixOptions = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 1564 |
+
// now $write is an instance of Zend_Db_Adapter_Abstract
|
| 1565 |
+
$fixOptions->query("UPDATE ".$prefix."catalog_product_entity SET has_options = 1 WHERE type_id = 'configurable' AND entity_id IN (SELECT distinct(product_id) FROM ".$prefix."catalog_product_option)");
|
| 1566 |
+
}
|
| 1567 |
+
*/
|
| 1568 |
+
|
| 1569 |
+
######### CUSTOM QUERY FIX FOR DISAPPEARING OPTIONS #################
|
| 1570 |
+
// fetch write database connection that is used in Mage_Core module
|
| 1571 |
+
if($productId == "") {
|
| 1572 |
+
$productId = $product->getId();
|
| 1573 |
+
}
|
| 1574 |
+
if($currentproducttype == "simple") {
|
| 1575 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1576 |
+
$fixOptions = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 1577 |
+
// now $write is an instance of Zend_Db_Adapter_Abstract
|
| 1578 |
+
if($iscustomoptionsrequired == "true") {
|
| 1579 |
+
$fixOptions->query("UPDATE ".$prefix."catalog_product_entity SET required_options = 1 WHERE has_options = 1 AND type_id = 'simple' AND entity_id = '".$productId."'");
|
| 1580 |
+
} else {
|
| 1581 |
+
$fixOptions->query("UPDATE ".$prefix."catalog_product_entity SET has_options = 1 WHERE has_options = 0 AND type_id = 'simple' AND entity_id = '".$productId."'");
|
| 1582 |
+
}
|
| 1583 |
+
} else if ($currentproducttype == "configurable") {
|
| 1584 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1585 |
+
$fixOptions = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 1586 |
+
// now $write is an instance of Zend_Db_Adapter_Abstract
|
| 1587 |
+
|
| 1588 |
+
if($iscustomoptionsrequired == "true") {
|
| 1589 |
+
$fixOptions->query("UPDATE ".$prefix."catalog_product_entity SET required_options = 1 WHERE has_options = 1 AND type_id = 'configurable' AND entity_id = '".$productId."'");
|
| 1590 |
+
|
| 1591 |
+
} else {
|
| 1592 |
+
$fixOptions->query("UPDATE ".$prefix."catalog_product_entity SET has_options = 1 WHERE has_options = 0 AND type_id = 'configurable' AND entity_id = '".$productId."'");
|
| 1593 |
+
}
|
| 1594 |
+
}
|
| 1595 |
+
}
|
| 1596 |
+
|
| 1597 |
+
|
| 1598 |
+
|
| 1599 |
+
/* DOWNLOADBLE PRODUCT FILE METHOD START */
|
| 1600 |
+
#print_r($filearrayforimport);
|
| 1601 |
+
if(isset($filearrayforimport)) {
|
| 1602 |
+
$filecounterinternall=1;
|
| 1603 |
+
foreach($filearrayforimport as $fileinfo) {
|
| 1604 |
+
$document_directory = Mage :: getBaseDir( 'media' ) . DS . 'import' . DS;
|
| 1605 |
+
$files = $fileinfo['file'];
|
| 1606 |
+
#echo "FILE: " . $fileinfo['file'];
|
| 1607 |
+
#echo "ID: " . $product->getId();
|
| 1608 |
+
$resource = Mage::getSingleton('core/resource');
|
| 1609 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1610 |
+
$write = $resource->getConnection('core_write');
|
| 1611 |
+
$read = $resource->getConnection('core_read');
|
| 1612 |
+
$select_qry =$read->query("SHOW TABLE STATUS LIKE '".$prefix."downloadable_link' ");
|
| 1613 |
+
$row = $select_qry->fetch();
|
| 1614 |
+
$next_id = $row['Auto_increment'];
|
| 1615 |
+
|
| 1616 |
+
$okvalueformodelID = $next_id - $filecounterinternall;
|
| 1617 |
+
#echo "next_id: " . $okvalueformodelID;
|
| 1618 |
+
$linkModel = Mage::getModel('downloadable/link')->load($okvalueformodelID);
|
| 1619 |
+
|
| 1620 |
+
$link_file = $document_directory . $files;
|
| 1621 |
+
|
| 1622 |
+
$file = realpath($link_file);
|
| 1623 |
+
|
| 1624 |
+
if (!$file || !file_exists($file)) {
|
| 1625 |
+
Mage::throwException(Mage::helper('catalog')->__('Link file '.$file.' not exists'));
|
| 1626 |
+
}
|
| 1627 |
+
$pathinfo = pathinfo($file);
|
| 1628 |
+
|
| 1629 |
+
|
| 1630 |
+
$linkfile = Varien_File_Uploader::getCorrectFileName($pathinfo['basename']);
|
| 1631 |
+
$dispretionPath = Varien_File_Uploader::getDispretionPath($linkfile);
|
| 1632 |
+
$linkfile = $dispretionPath . DS . $linkfile;
|
| 1633 |
+
|
| 1634 |
+
$linkfile = $dispretionPath . DS
|
| 1635 |
+
. Varien_File_Uploader::getNewFileName(Mage_Downloadable_Model_Link::getBasePath().DS.$linkfile);
|
| 1636 |
+
|
| 1637 |
+
$ioAdapter = new Varien_Io_File();
|
| 1638 |
+
$ioAdapter->setAllowCreateFolders(true);
|
| 1639 |
+
$distanationDirectory = dirname(Mage_Downloadable_Model_Link::getBasePath().DS.$linkfile);
|
| 1640 |
+
|
| 1641 |
+
|
| 1642 |
+
try {
|
| 1643 |
+
$ioAdapter->open(array(
|
| 1644 |
+
'path'=>$distanationDirectory
|
| 1645 |
+
));
|
| 1646 |
+
|
| 1647 |
+
$ioAdapter->cp($file, Mage_Downloadable_Model_Link::getBasePath().DS.$linkfile);
|
| 1648 |
+
$ioAdapter->chmod(Mage_Downloadable_Model_Link::getBasePath().DS.$linkfile, 0777);
|
| 1649 |
+
|
| 1650 |
+
}
|
| 1651 |
+
catch (Exception $e) {
|
| 1652 |
+
Mage::throwException(Mage::helper('catalog')->__('Failed to move file: %s', $e->getMessage()));
|
| 1653 |
+
Mage::log(sprintf('failed to move file: %s', $e->getMessage()), null,'ce_product_import_export_errors.log');
|
| 1654 |
+
}
|
| 1655 |
+
|
| 1656 |
+
$linkfile = str_replace(DS, '/', $linkfile);
|
| 1657 |
+
|
| 1658 |
+
#echo "SET: " . $linkfile;
|
| 1659 |
+
$linkModel->setLinkFile($linkfile);
|
| 1660 |
+
$linkModel->save();
|
| 1661 |
+
|
| 1662 |
+
$intesdf = $next_id - $filecounterinternall;
|
| 1663 |
+
$write->query("UPDATE `".$prefix."downloadable_link_title` SET title = \"".addslashes($fileinfo['name'])."\" WHERE link_id = '".$intesdf."'");
|
| 1664 |
+
$write->query("UPDATE `".$prefix."downloadable_link_price` SET price = '".$fileinfo['price']."' WHERE link_id = '".$intesdf."'");
|
| 1665 |
+
#$product->setLinksPurchasedSeparately(false);
|
| 1666 |
+
#$product->setLinksPurchasedSeparately(0);
|
| 1667 |
+
$filecounterinternall++;
|
| 1668 |
+
}
|
| 1669 |
+
}
|
| 1670 |
+
/* END DOWNLOADBLE METHOD */
|
| 1671 |
+
|
| 1672 |
+
/* SAMPLE FILE DOWNLOADBLE PRODUCT SAMPLE FILE METHOD START */
|
| 1673 |
+
#print_r($filenameforsamplearrayforimport);
|
| 1674 |
+
if(isset($filenameforsamplearrayforimport)) {
|
| 1675 |
+
$filecounterinternall=1;
|
| 1676 |
+
foreach($filenameforsamplearrayforimport as $fileinfo) {
|
| 1677 |
+
$document_directory = Mage :: getBaseDir( 'media' ) . DS . 'import';
|
| 1678 |
+
$samplefiles = $fileinfo['file'];
|
| 1679 |
+
#print_r($filenameforsamplearrayforimport);
|
| 1680 |
+
#echo "ID: " . $fileinfo['name'] ."<br/>";
|
| 1681 |
+
$resource = Mage::getSingleton('core/resource');
|
| 1682 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1683 |
+
$write = $resource->getConnection('core_write');
|
| 1684 |
+
$read = $resource->getConnection('core_read');
|
| 1685 |
+
$select_qry =$read->query("SHOW TABLE STATUS LIKE '".$prefix."downloadable_link' ");
|
| 1686 |
+
$row = $select_qry->fetch();
|
| 1687 |
+
$next_id = $row['Auto_increment'];
|
| 1688 |
+
|
| 1689 |
+
$okvalueformodelID = $next_id - $filecounterinternall;
|
| 1690 |
+
#echo "next_id: " . $okvalueformodelID."<br/>";
|
| 1691 |
+
$linkSampleModel = Mage::getModel('downloadable/link')->load($okvalueformodelID);
|
| 1692 |
+
$link_sample_file = $document_directory . $samplefiles;
|
| 1693 |
+
|
| 1694 |
+
$file = realpath($link_sample_file);
|
| 1695 |
+
|
| 1696 |
+
if (!$file || !file_exists($file)) {
|
| 1697 |
+
Mage::throwException(Mage::helper('catalog')->__('Link sample file '.$file.' not exists'));
|
| 1698 |
+
Mage::log(sprintf('downloadable product sample file '.$file.' link does not exist: %s', $e->getMessage()), null,'ce_product_import_export_errors.log');
|
| 1699 |
+
}
|
| 1700 |
+
$pathinfo = pathinfo($file);
|
| 1701 |
+
$linksamplefile = Varien_File_Uploader::getCorrectFileName($pathinfo['basename']);
|
| 1702 |
+
$dispretionPath = Varien_File_Uploader::getDispretionPath($linksamplefile);
|
| 1703 |
+
$linksamplefile = $dispretionPath . DS . $linksamplefile;
|
| 1704 |
+
$linksamplefile = $dispretionPath . DS . Varien_File_Uploader::getNewFileName(Mage_Downloadable_Model_Link::getBaseSamplePath().DS.$linksamplefile);
|
| 1705 |
+
|
| 1706 |
+
$ioAdapter = new Varien_Io_File();
|
| 1707 |
+
$ioAdapter->setAllowCreateFolders(true);
|
| 1708 |
+
$distanationDirectory = dirname(Mage_Downloadable_Model_Link::getBaseSamplePath().DS.$linksamplefile);
|
| 1709 |
+
|
| 1710 |
+
try {
|
| 1711 |
+
$ioAdapter->open(array(
|
| 1712 |
+
'path'=>$distanationDirectory
|
| 1713 |
+
));
|
| 1714 |
+
|
| 1715 |
+
$ioAdapter->cp($file, Mage_Downloadable_Model_Link::getBaseSamplePath().$linksamplefile);
|
| 1716 |
+
$ioAdapter->chmod(Mage_Downloadable_Model_Link::getBaseSamplePath().$linksamplefile, 0777);
|
| 1717 |
+
|
| 1718 |
+
}
|
| 1719 |
+
catch (Exception $e) {
|
| 1720 |
+
Mage::throwException(Mage::helper('catalog')->__('Failed to move sample file: %s', $e->getMessage()));
|
| 1721 |
+
Mage::log(sprintf('Failed to move sample file: %s', $e->getMessage()), null,'ce_product_import_export_errors.log');
|
| 1722 |
+
}
|
| 1723 |
+
|
| 1724 |
+
$linksamplefile = str_replace(DS, '/', $linksamplefile);
|
| 1725 |
+
$linkSampleModel->setSampleFile($linksamplefile);
|
| 1726 |
+
$linkSampleModel->save();
|
| 1727 |
+
|
| 1728 |
+
#$intesdf = $next_id-1;
|
| 1729 |
+
$intesdf = $next_id - $filecounterinternall;
|
| 1730 |
+
$write->query("UPDATE `".$prefix."downloadable_link_title` SET title = \"".addslashes($fileinfo['name'])."\" WHERE link_id = '".$intesdf."'");
|
| 1731 |
+
$write->query("UPDATE `".$prefix."downloadable_link_price` SET price = '".$fileinfo['price']."' WHERE link_id = '".$intesdf."'");
|
| 1732 |
+
$filecounterinternall++;
|
| 1733 |
+
}
|
| 1734 |
+
}
|
| 1735 |
+
/* END SAMPLE FILE DOWNLOADBLE METHOD */
|
| 1736 |
+
/* START OF SUPER ATTRIBUTE PRICING */
|
| 1737 |
+
|
| 1738 |
+
|
| 1739 |
+
if ($finalsuperattributetype == 'configurable') {
|
| 1740 |
+
if ($finalsuperattributepricing != "") {
|
| 1741 |
+
|
| 1742 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 1743 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
| 1744 |
+
$superProduct = Mage :: getModel ( 'catalog/product' )-> load ( $product -> getId ());
|
| 1745 |
+
$superArray = $superProduct -> getTypeInstance ()-> getConfigurableAttributesAsArray ();
|
| 1746 |
+
|
| 1747 |
+
#print_r($superArray);
|
| 1748 |
+
|
| 1749 |
+
$SuperAttributePricingData = array();
|
| 1750 |
+
$FinalSuperAttributeData = array();
|
| 1751 |
+
$SuperAttributePricingData = explode('|',$finalsuperattributepricing);
|
| 1752 |
+
|
| 1753 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1754 |
+
foreach( $superArray AS $key => $val ) {
|
| 1755 |
+
#$x = 0 ;
|
| 1756 |
+
foreach( $val[ 'values' ] AS $keyValues => $valValues ) {
|
| 1757 |
+
|
| 1758 |
+
|
| 1759 |
+
foreach($SuperAttributePricingData as $singleattributeData) {
|
| 1760 |
+
$FinalSuperAttributeData = explode(':',$singleattributeData);
|
| 1761 |
+
|
| 1762 |
+
if($FinalSuperAttributeData[0] == $superArray[$key][ 'values' ][$keyValues][ 'label' ]) {
|
| 1763 |
+
if($new) {
|
| 1764 |
+
$insertPrice='INSERT into '.$prefix.'catalog_product_super_attribute_pricing (product_super_attribute_id, value_index, is_percent, pricing_value) VALUES
|
| 1765 |
+
("'.$superArray[$key][ 'values' ][$keyValues][ 'product_super_attribute_id' ].'", "'.$superArray[$key][ 'values' ][$keyValues][ 'value_index' ].'", "'.$FinalSuperAttributeData[2].'", "'.$FinalSuperAttributeData[1].'");';
|
| 1766 |
+
#echo "SQL2: " . $insertPrice;
|
| 1767 |
+
$adapter->query($insertPrice);
|
| 1768 |
+
} else {
|
| 1769 |
+
if($FinalSuperAttributeData[1] != "") {
|
| 1770 |
+
|
| 1771 |
+
|
| 1772 |
+
$finalpriceforupdate = $FinalSuperAttributeData[1];
|
| 1773 |
+
|
| 1774 |
+
$select_qry2 = $read->query("SELECT value_id FROM ".$prefix."catalog_product_super_attribute_pricing WHERE product_super_attribute_id = '".$superArray[$key][ 'values' ][$keyValues][ 'product_super_attribute_id' ]."' AND value_index = '".$superArray[$key][ 'values' ][$keyValues][ 'value_index' ]."'");
|
| 1775 |
+
$newrowItemId2 = $select_qry2->fetch();
|
| 1776 |
+
$db_product_id = $newrowItemId2['value_id'];
|
| 1777 |
+
if($db_product_id == "") {
|
| 1778 |
+
$insertPrice='INSERT into '.$prefix.'catalog_product_super_attribute_pricing (product_super_attribute_id, value_index, is_percent, pricing_value) VALUES
|
| 1779 |
+
("'.$superArray[$key][ 'values' ][$keyValues][ 'product_super_attribute_id' ].'", "'.$superArray[$key][ 'values' ][$keyValues][ 'value_index' ].'", "'.$FinalSuperAttributeData[2].'", "'.$FinalSuperAttributeData[1].'");';
|
| 1780 |
+
#echo "SQL2: " . $insertPrice;
|
| 1781 |
+
$adapter->query($insertPrice);
|
| 1782 |
+
|
| 1783 |
+
} else {
|
| 1784 |
+
$updatePrice="UPDATE ".$prefix."catalog_product_super_attribute_pricing SET pricing_value = '".$finalpriceforupdate."' WHERE value_id = '".$db_product_id."'";
|
| 1785 |
+
#echo "SQL UPDATE: " . $updatePrice;
|
| 1786 |
+
$adapter->query($updatePrice);
|
| 1787 |
+
}
|
| 1788 |
+
}
|
| 1789 |
+
|
| 1790 |
+
|
| 1791 |
+
}
|
| 1792 |
+
}
|
| 1793 |
+
}
|
| 1794 |
+
}
|
| 1795 |
+
}
|
| 1796 |
+
}
|
| 1797 |
+
}
|
| 1798 |
+
/* END OF SUPER ATTRIBUTE PRICING */
|
| 1799 |
+
/* START OF GROUPED POSITION */
|
| 1800 |
+
if ($finalsuperattributetype == 'grouped') {
|
| 1801 |
+
#print_r($finalIDssthatneedtobeconvertedto);
|
| 1802 |
+
foreach($finalIDssthatneedtobeconvertedto as $data_product_position_id)
|
| 1803 |
+
{
|
| 1804 |
+
$resource = Mage::getSingleton('core/resource');
|
| 1805 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1806 |
+
$read = $resource->getConnection('core_read');
|
| 1807 |
+
$write = $resource->getConnection('core_write');
|
| 1808 |
+
$data_productID = ( int )$product -> getIdBySku( $data_product_position_id['sku'] );
|
| 1809 |
+
#$data_productID = (int)$product->getId();
|
| 1810 |
+
|
| 1811 |
+
$select_qry3 = $read->query("SELECT link_type_id FROM ".$prefix."catalog_product_link_type WHERE code = 'super'");
|
| 1812 |
+
$newrowItemId3 = $select_qry3->fetch();
|
| 1813 |
+
$link_type_id = $newrowItemId3['link_type_id'];
|
| 1814 |
+
|
| 1815 |
+
$select_qry_catalog_product_link = "SELECT link_id FROM ".$prefix."catalog_product_link WHERE linked_product_id = '" . trim($data_productID) . "' AND link_type_id = '".$link_type_id."'";
|
| 1816 |
+
|
| 1817 |
+
#echo "T: SELECT link_id FROM ".$prefix."catalog_product_link WHERE linked_product_id= '". trim($data_productID) . "'";
|
| 1818 |
+
$catalog_product_link_rows = $read->fetchAll($select_qry_catalog_product_link);
|
| 1819 |
+
foreach($catalog_product_link_rows as $data_catalog_product_link)
|
| 1820 |
+
{
|
| 1821 |
+
$write->query("UPDATE ".$prefix."catalog_product_link_attribute_int SET value = '" . $data_product_position_id['position'] . "' WHERE link_id = '". $data_catalog_product_link['link_id'] . "'");
|
| 1822 |
+
|
| 1823 |
+
$select_qry2 = $read->query("SELECT value_id FROM ".$prefix."catalog_product_link_attribute_decimal WHERE link_id = '".$data_catalog_product_link['link_id']."'");
|
| 1824 |
+
|
| 1825 |
+
$select_qry4 = $read->query("SELECT product_link_attribute_id FROM ".$prefix."catalog_product_link_attribute WHERE product_link_attribute_code = 'qty' AND link_type_id = '".$link_type_id."'");
|
| 1826 |
+
|
| 1827 |
+
$newrowItemId2 = $select_qry2->fetch();
|
| 1828 |
+
$newrowItemId4 = $select_qry4->fetch();
|
| 1829 |
+
|
| 1830 |
+
$db_product_id = $newrowItemId2['value_id'];
|
| 1831 |
+
$product_link_attribute_id = $newrowItemId4['product_link_attribute_id'];
|
| 1832 |
+
|
| 1833 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 1834 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
| 1835 |
+
|
| 1836 |
+
if(isset($data_product_position_id['qty'])) {
|
| 1837 |
+
if($db_product_id == "") {
|
| 1838 |
+
$insertPrice='INSERT into '.$prefix.'catalog_product_link_attribute_decimal (product_link_attribute_id, link_id, value) VALUES
|
| 1839 |
+
("'.$product_link_attribute_id.'", "'.$data_catalog_product_link['link_id'].'", "'.$data_product_position_id['qty'].'");';
|
| 1840 |
+
#echo "SQL2: " . $insertPrice;
|
| 1841 |
+
$adapter->query($insertPrice);
|
| 1842 |
+
|
| 1843 |
+
} else {
|
| 1844 |
+
$updatePrice="UPDATE ".$prefix."catalog_product_link_attribute_decimal SET value = '" . $data_product_position_id['qty'] . "' WHERE link_id = '". $data_catalog_product_link['link_id'] . "'";
|
| 1845 |
+
#echo "SQL UPDATE: " . $updatePrice;
|
| 1846 |
+
$adapter->query($updatePrice);
|
| 1847 |
+
}
|
| 1848 |
+
}
|
| 1849 |
+
}
|
| 1850 |
+
}
|
| 1851 |
+
}
|
| 1852 |
+
/* END OF GROUPED POSITION */
|
| 1853 |
+
/* START OF GROUPED PRICINGPRICING 1.7.x beta rc1 */
|
| 1854 |
+
#if ($finalsuperattributetype == 'grouped') {
|
| 1855 |
+
if ($finalgroup_price_price != "") {
|
| 1856 |
+
$resource = Mage::getSingleton('core/resource');
|
| 1857 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 1858 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
| 1859 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1860 |
+
|
| 1861 |
+
if($this->getBatchParams('append_group_prices') != "true") {
|
| 1862 |
+
//delete existing group prices
|
| 1863 |
+
$select_qry2 = $read->query("DELETE FROM ".$resource->getTableName('catalog/product_attribute_group_price')." WHERE entity_id = '".$product->getId()."'");
|
| 1864 |
+
}
|
| 1865 |
+
$groupedProductModel = Mage::getModel('catalog/product')->load($product->getId());
|
| 1866 |
+
if($finalgroup_price_price != "delete") {
|
| 1867 |
+
$group_price_priceData = explode('|',$finalgroup_price_price);
|
| 1868 |
+
|
| 1869 |
+
foreach($group_price_priceData as $singleattributeData) {
|
| 1870 |
+
$FinalGroupedPriceData = explode('=',$singleattributeData);
|
| 1871 |
+
|
| 1872 |
+
if($FinalGroupedPriceData[0] != "") {
|
| 1873 |
+
if($new) {
|
| 1874 |
+
#echo "SQL2: ";
|
| 1875 |
+
$insertPrice='INSERT into '.$resource->getTableName('catalog/product_attribute_group_price').' (entity_id,all_groups,customer_group_id,value,website_id) VALUES ("'.$product->getId().'","0","'.$FinalGroupedPriceData[0].'","'.$FinalGroupedPriceData[1].'","0");';
|
| 1876 |
+
$adapter->query($insertPrice);
|
| 1877 |
+
|
| 1878 |
+
} else {
|
| 1879 |
+
#echo "SQL UPDATE: " . $updatePrice;
|
| 1880 |
+
$select_qry2 = $read->query("SELECT value_id FROM ".$resource->getTableName('catalog/product_attribute_group_price')." WHERE value = '".$FinalGroupedPriceData[1]."' AND customer_group_id = '".$FinalGroupedPriceData[0]."' AND entity_id = '".$product->getId()."'");
|
| 1881 |
+
$newrowItemId2 = $select_qry2->fetch();
|
| 1882 |
+
$db_product_id = $newrowItemId2['value_id'];
|
| 1883 |
+
if($db_product_id == "") {
|
| 1884 |
+
$insertPrice='INSERT into '.$resource->getTableName('catalog/product_attribute_group_price').' (entity_id,all_groups,customer_group_id,value,website_id) VALUES ("'.$product->getId().'","0","'.$FinalGroupedPriceData[0].'","'.$FinalGroupedPriceData[1].'","0");';
|
| 1885 |
+
#echo "INSERT SQL2: " . $insertPrice;
|
| 1886 |
+
$adapter->query($insertPrice);
|
| 1887 |
+
|
| 1888 |
+
} else {
|
| 1889 |
+
#echo "VALUE ID: " . $db_product_id;
|
| 1890 |
+
#echo "SQL UPDATE2: ";
|
| 1891 |
+
|
| 1892 |
+
$updatePrice="UPDATE ".$resource->getTableName('catalog/product_attribute_group_price')." SET customer_group_id = '".$FinalGroupedPriceData[0]."', value = '".$FinalGroupedPriceData[1]."' WHERE value_id = '".$db_product_id."'";
|
| 1893 |
+
$adapter->query($updatePrice);
|
| 1894 |
+
}
|
| 1895 |
+
}
|
| 1896 |
+
}
|
| 1897 |
+
}
|
| 1898 |
+
}
|
| 1899 |
+
}
|
| 1900 |
+
#}
|
| 1901 |
+
/* END OF GROUPED PRICING PRICING */
|
| 1902 |
+
/* ADDED FIX FOR IMAGE LABELS */
|
| 1903 |
+
|
| 1904 |
+
if(isset($imagelabeldataforimport)) {
|
| 1905 |
+
|
| 1906 |
+
#echo "PROD ID: " . $product->getId() . "<br/>";
|
| 1907 |
+
#echo "LABELS: " . $imagelabeldataforimport . "<br/>";
|
| 1908 |
+
$resource = Mage::getSingleton('core/resource');
|
| 1909 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1910 |
+
$prefixlabels = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1911 |
+
$readlabels = $resource->getConnection('core_read');
|
| 1912 |
+
$writelabels = $resource->getConnection('core_write');
|
| 1913 |
+
$select_qry_labels =$readlabels->query("SELECT value_id FROM ".$prefixlabels."catalog_product_entity_media_gallery WHERE entity_id = '". $product->getId() ."'");
|
| 1914 |
+
$row_labels = $select_qry_labels->fetch();
|
| 1915 |
+
$value_id = $row_labels['value_id'];
|
| 1916 |
+
// now $write label to db
|
| 1917 |
+
$writelabels->query("UPDATE ".$prefix."catalog_product_entity_media_gallery_value SET label = '".$imagelabeldataforimport."' WHERE value_id = '".$value_id."'");
|
| 1918 |
+
//this is for if you have flat product catalog enabled.. need to write values to both places
|
| 1919 |
+
#$writelabels->query("UPDATE ".$prefix."catalog_product_flat_1 SET image_label = '".$imagelabeldataforimport."' WHERE entity_id = '". $product->getId() ."'");
|
| 1920 |
+
#$writelabels->query("UPDATE ".$prefix."catalog_product_flat_1 SET image_label = '".$imagelabeldataforimport."' WHERE entity_id = '". $product->getId() ."'");
|
| 1921 |
+
#SELECT attribute_id FROM ".$prefixlabels."eav_attribute WHERE attribute_code = 'image_label';
|
| 1922 |
+
#$writelabels->query("UPDATE ".$prefix."catalog_product_entity_varchar SET value = '".$imagelabeldataforimport."' WHERE entity_id = '". $product->getId() ."' AND attribute_id = 101");
|
| 1923 |
+
|
| 1924 |
+
}
|
| 1925 |
+
if(isset($smallimagelabeldataforimport)) {
|
| 1926 |
+
|
| 1927 |
+
#echo "PROD ID: " . $product->getId() . "<br/>";
|
| 1928 |
+
#echo "LABELS: " . $smallimagelabeldataforimport . "<br/>";
|
| 1929 |
+
$resource = Mage::getSingleton('core/resource');
|
| 1930 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1931 |
+
$prefixlabels = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1932 |
+
$readlabels = $resource->getConnection('core_read');
|
| 1933 |
+
$writelabels = $resource->getConnection('core_write');
|
| 1934 |
+
$select_qry_labels =$readlabels->query("SELECT value_id FROM ".$prefixlabels."catalog_product_entity_media_gallery WHERE entity_id = '". $product->getId() ."'");
|
| 1935 |
+
$row_labels = $select_qry_labels->fetch();
|
| 1936 |
+
$value_id = $row_labels['value_id']+1;
|
| 1937 |
+
// now $write label to db
|
| 1938 |
+
$writelabels->query("UPDATE ".$prefix."catalog_product_entity_media_gallery_value SET label = '".$smallimagelabeldataforimport."' WHERE value_id = '".$value_id."'");
|
| 1939 |
+
|
| 1940 |
+
}
|
| 1941 |
+
if(isset($thumbnailimagelabeldataforimport)) {
|
| 1942 |
+
|
| 1943 |
+
#echo "PROD ID: " . $product->getId() . "<br/>";
|
| 1944 |
+
#echo "LABELS: " . $smallimagelabeldataforimport . "<br/>";
|
| 1945 |
+
$resource = Mage::getSingleton('core/resource');
|
| 1946 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1947 |
+
$prefixlabels = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 1948 |
+
$readlabels = $resource->getConnection('core_read');
|
| 1949 |
+
$writelabels = $resource->getConnection('core_write');
|
| 1950 |
+
$select_qry_labels =$readlabels->query("SELECT value_id FROM ".$prefixlabels."catalog_product_entity_media_gallery WHERE entity_id = '". $product->getId() ."'");
|
| 1951 |
+
$row_labels = $select_qry_labels->fetch();
|
| 1952 |
+
$value_id = $row_labels['value_id']+2;
|
| 1953 |
+
// now $write label to db
|
| 1954 |
+
$writelabels->query("UPDATE ".$prefix."catalog_product_entity_media_gallery_value SET label = '".$thumbnailimagelabeldataforimport."' WHERE value_id = '".$value_id."'");
|
| 1955 |
+
|
| 1956 |
+
}
|
| 1957 |
+
|
| 1958 |
+
/* END FIX FOR IMAGE LABLES */
|
| 1959 |
+
return true;
|
| 1960 |
+
}
|
| 1961 |
+
/**
|
| 1962 |
+
* Edit tier prices
|
| 1963 |
+
*
|
| 1964 |
+
* Uses a pipe-delimited string of qty:price to set tiers for the product row and appends.
|
| 1965 |
+
* Removes if REMOVE is present.
|
| 1966 |
+
*
|
| 1967 |
+
* @todo Prevent duplicate tiers (by qty) being set
|
| 1968 |
+
* @internal Magento will save duplicate tiers; no enforcing unique tiers by qty, so we have to do this manually
|
| 1969 |
+
* @param Mage_Catalog_Model_Product $product Current product row
|
| 1970 |
+
* @param string $tier_prices_field Pipe-separated in the form of qty:price (e.g. 0=250=12.75|0=500=12.00)
|
| 1971 |
+
*/
|
| 1972 |
+
private function _editTierPrices(&$product, $tier_prices_field = false, $store)
|
| 1973 |
+
{
|
| 1974 |
+
if (($tier_prices_field) && !empty($tier_prices_field)) {
|
| 1975 |
+
|
| 1976 |
+
if(trim($tier_prices_field) == 'REMOVE'){
|
| 1977 |
+
|
| 1978 |
+
$product->setTierPrice(array());
|
| 1979 |
+
|
| 1980 |
+
} else {
|
| 1981 |
+
|
| 1982 |
+
|
| 1983 |
+
if($this->getBatchParams('append_tier_prices') == "true") {
|
| 1984 |
+
//get current product tier prices
|
| 1985 |
+
$existing_tps = $product->getTierPrice();
|
| 1986 |
+
} else {
|
| 1987 |
+
$existing_tps = array();
|
| 1988 |
+
}
|
| 1989 |
+
|
| 1990 |
+
$etp_lookup = array();
|
| 1991 |
+
//make a lookup array to prevent dup tiers by qty
|
| 1992 |
+
foreach($existing_tps as $key => $etp){
|
| 1993 |
+
$etp_lookup[intval($etp['price_qty'])] = $key;
|
| 1994 |
+
}
|
| 1995 |
+
|
| 1996 |
+
//parse incoming tier prices string
|
| 1997 |
+
$incoming_tierps = explode('|',$tier_prices_field);
|
| 1998 |
+
$tps_toAdd = array();
|
| 1999 |
+
$tierpricecount=0;
|
| 2000 |
+
foreach($incoming_tierps as $tier_str){
|
| 2001 |
+
//echo "t: " . $tier_str;
|
| 2002 |
+
if (empty($tier_str)) continue;
|
| 2003 |
+
|
| 2004 |
+
$tmp = array();
|
| 2005 |
+
$tmp = explode('=',$tier_str);
|
| 2006 |
+
|
| 2007 |
+
if ($tmp[1] == 0 && $tmp[2] == 0) continue;
|
| 2008 |
+
//echo ('adding tier');
|
| 2009 |
+
//print_r($tmp);
|
| 2010 |
+
$tps_toAdd[$tierpricecount] = array(
|
| 2011 |
+
'website_id' => 0, // !!!! this is hard-coded for now
|
| 2012 |
+
#'website_id' => $tmp[0], // !!!! this is hard-coded for now
|
| 2013 |
+
#'website_id' => $store->getWebsiteId(),
|
| 2014 |
+
'cust_group' => $tmp[0], // !!! so is this
|
| 2015 |
+
'price_qty' => $tmp[1],
|
| 2016 |
+
'price' => $tmp[2],
|
| 2017 |
+
'delete' => ''
|
| 2018 |
+
);
|
| 2019 |
+
|
| 2020 |
+
//drop any existing tier values by qty
|
| 2021 |
+
if(isset($etp_lookup[intval($tmp[1])])){
|
| 2022 |
+
unset($existing_tps[$etp_lookup[intval($tmp[1])]]);
|
| 2023 |
+
}
|
| 2024 |
+
$tierpricecount++;
|
| 2025 |
+
}
|
| 2026 |
+
|
| 2027 |
+
//combine array
|
| 2028 |
+
$tps_toAdd = array_merge($existing_tps, $tps_toAdd);
|
| 2029 |
+
|
| 2030 |
+
//print_r($tps_toAdd);
|
| 2031 |
+
//save it
|
| 2032 |
+
$product->setTierPrice($tps_toAdd);
|
| 2033 |
+
}
|
| 2034 |
+
|
| 2035 |
+
}
|
| 2036 |
+
}
|
| 2037 |
+
|
| 2038 |
+
|
| 2039 |
+
protected function userCSVDataAsArray( $data )
|
| 2040 |
+
{
|
| 2041 |
+
return explode( ',', str_replace( " ", " ", $data ) );
|
| 2042 |
+
}
|
| 2043 |
+
|
| 2044 |
+
protected function skusToIds( $userData, $product )
|
| 2045 |
+
{
|
| 2046 |
+
$productIds = array();
|
| 2047 |
+
foreach ( $this -> userCSVDataAsArray( $userData ) as $oneSku ) {
|
| 2048 |
+
if ( ( $a_sku = ( int )$product -> getIdBySku( $oneSku ) ) > 0 ) {
|
| 2049 |
+
parse_str( "position=", $productIds[$a_sku] );
|
| 2050 |
+
}
|
| 2051 |
+
}
|
| 2052 |
+
return $productIds;
|
| 2053 |
+
}
|
| 2054 |
+
|
| 2055 |
+
|
| 2056 |
+
protected function skusToIdswithPosition( $userData, $product )
|
| 2057 |
+
{
|
| 2058 |
+
|
| 2059 |
+
$productIds = array();
|
| 2060 |
+
foreach ( $this -> userCSVDataAsArray( $userData ) as $oneSku ) {
|
| 2061 |
+
$oneSkuexploded = explode(':', $oneSku);
|
| 2062 |
+
if($oneSkuexploded[0] !="" && $oneSkuexploded[1] !="") {
|
| 2063 |
+
$final_position_value = $oneSkuexploded[0];
|
| 2064 |
+
} else {
|
| 2065 |
+
$final_position_value = "";
|
| 2066 |
+
}
|
| 2067 |
+
if($oneSkuexploded[1] !="") {
|
| 2068 |
+
$final_sku_value = $oneSkuexploded[1];
|
| 2069 |
+
} else {
|
| 2070 |
+
$final_sku_value = $oneSku;
|
| 2071 |
+
}
|
| 2072 |
+
if ( ( $a_sku = ( int )$product -> getIdBySku( $final_sku_value ) ) > 0 ) {
|
| 2073 |
+
parse_str( "position=".$final_position_value."", $productIds[$a_sku] );
|
| 2074 |
+
}
|
| 2075 |
+
}
|
| 2076 |
+
return $productIds;
|
| 2077 |
+
}
|
| 2078 |
+
protected $_categoryCache = array();
|
| 2079 |
+
protected function _addCategories($categories, $store)
|
| 2080 |
+
{
|
| 2081 |
+
// $rootId = $store->getRootCategoryId();
|
| 2082 |
+
// $rootId = Mage::app()->getStore()->getRootCategoryId();
|
| 2083 |
+
//$rootId = 2; // our store's root category id
|
| 2084 |
+
$delimitertouse = $this->getBatchParams('categorydelimiter');
|
| 2085 |
+
if($this->getBatchParams('root_catalog_id') != "") {
|
| 2086 |
+
$rootId = $this->getBatchParams('root_catalog_id');
|
| 2087 |
+
} else {
|
| 2088 |
+
$rootId = 2;
|
| 2089 |
+
}
|
| 2090 |
+
if (!$rootId) {
|
| 2091 |
+
return array();
|
| 2092 |
+
}
|
| 2093 |
+
$rootPath = '1/'.$rootId;
|
| 2094 |
+
if (empty($this->_categoryCache[$store->getId()])) {
|
| 2095 |
+
$collection = Mage::getModel('catalog/category')->getCollection()
|
| 2096 |
+
->setStore($store)
|
| 2097 |
+
->addAttributeToSelect('name');
|
| 2098 |
+
$collection->getSelect()->where("path like '".$rootPath."/%'");
|
| 2099 |
+
|
| 2100 |
+
foreach ($collection as $cat) {
|
| 2101 |
+
$pathArr = explode('/', $cat->getPath());
|
| 2102 |
+
$namePath = '';
|
| 2103 |
+
for ($i=2, $l=sizeof($pathArr); $i<$l; $i++) {
|
| 2104 |
+
//if(!is_null($collection->getItemById($pathArr[$i]))) { }
|
| 2105 |
+
$name = $collection->getItemById($pathArr[$i])->getName();
|
| 2106 |
+
$namePath .= (empty($namePath) ? '' : '/').trim($name);
|
| 2107 |
+
}
|
| 2108 |
+
$cat->setNamePath($namePath);
|
| 2109 |
+
}
|
| 2110 |
+
|
| 2111 |
+
$cache = array();
|
| 2112 |
+
foreach ($collection as $cat) {
|
| 2113 |
+
$cache[strtolower($cat->getNamePath())] = $cat;
|
| 2114 |
+
$cat->unsNamePath();
|
| 2115 |
+
}
|
| 2116 |
+
$this->_categoryCache[$store->getId()] = $cache;
|
| 2117 |
+
}
|
| 2118 |
+
$cache =& $this->_categoryCache[$store->getId()];
|
| 2119 |
+
|
| 2120 |
+
$catIds = array();
|
| 2121 |
+
//->setIsAnchor(1)
|
| 2122 |
+
//Delimiter is ' , ' so people can use ', ' in multiple categorynames
|
| 2123 |
+
$cat_details = explode(' , ', $categories);
|
| 2124 |
+
foreach ($cat_details as $categoryPathStr) {
|
| 2125 |
+
//Remove this line if your using ^ vs / as delimiter for categories.. fix for cat names with / in them
|
| 2126 |
+
$categoryPathStr = preg_replace('#\s*/\s*#', '/', trim($categoryPathStr));
|
| 2127 |
+
if (!empty($cache[$categoryPathStr])) {
|
| 2128 |
+
$catIds[] = $cache[$categoryPathStr]->getId();
|
| 2129 |
+
continue;
|
| 2130 |
+
}
|
| 2131 |
+
$path = $rootPath;
|
| 2132 |
+
$namePath = '';
|
| 2133 |
+
#foreach (explode($delimitertouse, $categoryPathStr) as $catName) {
|
| 2134 |
+
$catPathStr = explode('/', $categoryPathStr);
|
| 2135 |
+
foreach ($catPathStr as $catName) {
|
| 2136 |
+
$namePath .= (empty($namePath) ? '' : '/').strtolower($catName);
|
| 2137 |
+
if (empty($cache[$namePath])) {
|
| 2138 |
+
$cat = Mage::getModel('catalog/category')
|
| 2139 |
+
->setStoreId($store->getId())
|
| 2140 |
+
->setPath($path)
|
| 2141 |
+
->setName($catName)
|
| 2142 |
+
->setIsActive(1)
|
| 2143 |
+
->save();
|
| 2144 |
+
$cache[$namePath] = $cat;
|
| 2145 |
+
}
|
| 2146 |
+
$catId = $cache[$namePath]->getId();
|
| 2147 |
+
$path .= '/'.$catId;
|
| 2148 |
+
}
|
| 2149 |
+
if ($catId) {
|
| 2150 |
+
$catIds[] = $catId;
|
| 2151 |
+
}
|
| 2152 |
+
}
|
| 2153 |
+
return join(',', $catIds);
|
| 2154 |
+
}
|
| 2155 |
+
|
| 2156 |
+
protected function _removeFile( $file )
|
| 2157 |
+
{
|
| 2158 |
+
if ( file_exists( $file ) ) {
|
| 2159 |
+
$ext = substr(strrchr($file, '.'), 1);
|
| 2160 |
+
if( strlen( $ext ) == 4 ) {
|
| 2161 |
+
if ( unlink( $file ) ) {
|
| 2162 |
+
return true;
|
| 2163 |
+
}
|
| 2164 |
+
}
|
| 2165 |
+
}
|
| 2166 |
+
return false;
|
| 2167 |
+
}
|
| 2168 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Product/Convert/Parser/Product.php
ADDED
|
@@ -0,0 +1,864 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
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|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class PI_Oopsprofile_Model_Product_Convert_Parser_Product
|
| 5 |
+
extends Mage_Eav_Model_Convert_Parser_Abstract
|
| 6 |
+
{
|
| 7 |
+
const MULTI_DELIMITER = ' , ';
|
| 8 |
+
protected $_resource;
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Product collections per store
|
| 12 |
+
*
|
| 13 |
+
* @var array
|
| 14 |
+
*/
|
| 15 |
+
protected $_collections;
|
| 16 |
+
|
| 17 |
+
protected $_productTypes = array(
|
| 18 |
+
'simple'=>'Simple',
|
| 19 |
+
'bundle'=>'Bundle',
|
| 20 |
+
'configurable'=>'Configurable',
|
| 21 |
+
'grouped'=>'Grouped',
|
| 22 |
+
'virtual'=>'Virtual',
|
| 23 |
+
);
|
| 24 |
+
|
| 25 |
+
protected $_inventoryFields = array();
|
| 26 |
+
|
| 27 |
+
protected $_imageFields = array();
|
| 28 |
+
|
| 29 |
+
protected $_systemFields = array();
|
| 30 |
+
protected $_internalFields = array();
|
| 31 |
+
protected $_externalFields = array();
|
| 32 |
+
|
| 33 |
+
protected $_inventoryItems = array();
|
| 34 |
+
|
| 35 |
+
protected $_productModel;
|
| 36 |
+
|
| 37 |
+
protected $_setInstances = array();
|
| 38 |
+
|
| 39 |
+
protected $_store;
|
| 40 |
+
protected $_storeId;
|
| 41 |
+
protected $_attributes = array();
|
| 42 |
+
|
| 43 |
+
public function __construct()
|
| 44 |
+
{
|
| 45 |
+
foreach (Mage::getConfig()->getFieldset('catalog_product_dataflow', 'admin') as $code=>$node) {
|
| 46 |
+
if ($node->is('inventory')) {
|
| 47 |
+
$this->_inventoryFields[] = $code;
|
| 48 |
+
if ($node->is('use_config')) {
|
| 49 |
+
$this->_inventoryFields[] = 'use_config_'.$code;
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
if ($node->is('internal')) {
|
| 53 |
+
$this->_internalFields[] = $code;
|
| 54 |
+
}
|
| 55 |
+
if ($node->is('system')) {
|
| 56 |
+
$this->_systemFields[] = $code;
|
| 57 |
+
}
|
| 58 |
+
if ($node->is('external')) {
|
| 59 |
+
$this->_externalFields[$code] = $code;
|
| 60 |
+
}
|
| 61 |
+
if ($node->is('img')) {
|
| 62 |
+
$this->_imageFields[] = $code;
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* @return Mage_Catalog_Model_Mysql4_Convert
|
| 69 |
+
*/
|
| 70 |
+
public function getResource()
|
| 71 |
+
{
|
| 72 |
+
if (!$this->_resource) {
|
| 73 |
+
$this->_resource = Mage::getResourceSingleton('catalog_entity/convert');
|
| 74 |
+
#->loadStores()
|
| 75 |
+
#->loadProducts()
|
| 76 |
+
#->loadAttributeSets()
|
| 77 |
+
#->loadAttributeOptions();
|
| 78 |
+
}
|
| 79 |
+
return $this->_resource;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
public function getCollection($storeId)
|
| 83 |
+
{
|
| 84 |
+
if (!isset($this->_collections[$storeId])) {
|
| 85 |
+
$this->_collections[$storeId] = Mage::getResourceModel('catalog/product_collection');
|
| 86 |
+
$this->_collections[$storeId]->getEntity()->setStore($storeId);
|
| 87 |
+
}
|
| 88 |
+
return $this->_collections[$storeId];
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
/**
|
| 92 |
+
* Retrieve product type options
|
| 93 |
+
*
|
| 94 |
+
* @return array
|
| 95 |
+
*/
|
| 96 |
+
public function getProductTypes()
|
| 97 |
+
{
|
| 98 |
+
if (is_null($this->_productTypes)) {
|
| 99 |
+
$this->_productTypes = Mage::getSingleton('catalog/product_type')
|
| 100 |
+
->getOptionArray();
|
| 101 |
+
}
|
| 102 |
+
return $this->_productTypes;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
/**
|
| 106 |
+
* Retrieve Product type name by code
|
| 107 |
+
*
|
| 108 |
+
* @param string $code
|
| 109 |
+
* @return string
|
| 110 |
+
*/
|
| 111 |
+
public function getProductTypeName($code)
|
| 112 |
+
{
|
| 113 |
+
$productTypes = $this->getProductTypes();
|
| 114 |
+
if (isset($productTypes[$code])) {
|
| 115 |
+
return $productTypes[$code];
|
| 116 |
+
}
|
| 117 |
+
return false;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
/**
|
| 121 |
+
* Retrieve product type code by name
|
| 122 |
+
*
|
| 123 |
+
* @param string $name
|
| 124 |
+
* @return string
|
| 125 |
+
*/
|
| 126 |
+
public function getProductTypeId($name)
|
| 127 |
+
{
|
| 128 |
+
$productTypes = $this->getProductTypes();
|
| 129 |
+
if ($code = array_search($name, $productTypes)) {
|
| 130 |
+
return $code;
|
| 131 |
+
}
|
| 132 |
+
return false;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
/**
|
| 136 |
+
* Retrieve product model cache
|
| 137 |
+
*
|
| 138 |
+
* @return Mage_Catalog_Model_Product
|
| 139 |
+
*/
|
| 140 |
+
public function getProductModel()
|
| 141 |
+
{
|
| 142 |
+
if (is_null($this->_productModel)) {
|
| 143 |
+
$productModel = Mage::getModel('catalog/product');
|
| 144 |
+
$this->_productModel = Mage::objects()->save($productModel);
|
| 145 |
+
}
|
| 146 |
+
return Mage::objects()->load($this->_productModel);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/**
|
| 150 |
+
* Retrieve current store model
|
| 151 |
+
*
|
| 152 |
+
* @return Mage_Core_Model_Store
|
| 153 |
+
*/
|
| 154 |
+
public function getStore()
|
| 155 |
+
{
|
| 156 |
+
if (is_null($this->_store)) {
|
| 157 |
+
try {
|
| 158 |
+
$store = Mage::app()->getStore($this->getVar('store'));
|
| 159 |
+
}
|
| 160 |
+
catch (Exception $e) {
|
| 161 |
+
$this->addException(Mage::helper('catalog')->__('Invalid store specified'), Varien_Convert_Exception::FATAL);
|
| 162 |
+
throw $e;
|
| 163 |
+
}
|
| 164 |
+
$this->_store = $store;
|
| 165 |
+
}
|
| 166 |
+
return $this->_store;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
/**
|
| 170 |
+
* Retrieve store ID
|
| 171 |
+
*
|
| 172 |
+
* @return int
|
| 173 |
+
*/
|
| 174 |
+
public function getStoreId()
|
| 175 |
+
{
|
| 176 |
+
if (is_null($this->_storeId)) {
|
| 177 |
+
$this->_storeId = $this->getStore()->getId();
|
| 178 |
+
}
|
| 179 |
+
return $this->_storeId;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/**
|
| 183 |
+
* ReDefine Product Type Instance to Product
|
| 184 |
+
*
|
| 185 |
+
* @param Mage_Catalog_Model_Product $product
|
| 186 |
+
* @return Mage_Catalog_Model_Convert_Adapter_Product
|
| 187 |
+
*/
|
| 188 |
+
public function setProductTypeInstance(Mage_Catalog_Model_Product $product)
|
| 189 |
+
{
|
| 190 |
+
$type = $product->getTypeId();
|
| 191 |
+
if (!isset($this->_productTypeInstances[$type])) {
|
| 192 |
+
$this->_productTypeInstances[$type] = Mage::getSingleton('catalog/product_type')
|
| 193 |
+
->factory($product, true);
|
| 194 |
+
}
|
| 195 |
+
$product->setTypeInstance($this->_productTypeInstances[$type], true);
|
| 196 |
+
return $this;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
public function getAttributeSetInstance()
|
| 200 |
+
{
|
| 201 |
+
$productType = $this->getProductModel()->getType();
|
| 202 |
+
$attributeSetId = $this->getProductModel()->getAttributeSetId();
|
| 203 |
+
|
| 204 |
+
if (!isset($this->_setInstances[$productType][$attributeSetId])) {
|
| 205 |
+
$this->_setInstances[$productType][$attributeSetId] =
|
| 206 |
+
Mage::getSingleton('catalog/product_type')->factory($this->getProductModel());
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
return $this->_setInstances[$productType][$attributeSetId];
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
/**
|
| 213 |
+
* Retrieve eav entity attribute model
|
| 214 |
+
*
|
| 215 |
+
* @param string $code
|
| 216 |
+
* @return Mage_Eav_Model_Entity_Attribute
|
| 217 |
+
*/
|
| 218 |
+
public function getAttribute($code)
|
| 219 |
+
{
|
| 220 |
+
if (!isset($this->_attributes[$code])) {
|
| 221 |
+
$this->_attributes[$code] = $this->getProductModel()->getResource()->getAttribute($code);
|
| 222 |
+
}
|
| 223 |
+
return $this->_attributes[$code];
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
/**
|
| 227 |
+
* @deprecated not used anymore
|
| 228 |
+
*/
|
| 229 |
+
public function parse()
|
| 230 |
+
{
|
| 231 |
+
$data = $this->getData();
|
| 232 |
+
|
| 233 |
+
$entityTypeId = Mage::getSingleton('eav/config')->getEntityType('catalog_product')->getId();
|
| 234 |
+
|
| 235 |
+
$result = array();
|
| 236 |
+
$inventoryFields = array();
|
| 237 |
+
foreach ($data as $i=>$row) {
|
| 238 |
+
$this->setPosition('Line: '.($i+1));
|
| 239 |
+
try {
|
| 240 |
+
// validate SKU
|
| 241 |
+
if (empty($row['sku'])) {
|
| 242 |
+
$this->addException(Mage::helper('catalog')->__('Missing SKU, skipping the record'), Mage_Dataflow_Model_Convert_Exception::ERROR);
|
| 243 |
+
continue;
|
| 244 |
+
}
|
| 245 |
+
$this->setPosition('Line: '.($i+1).', SKU: '.$row['sku']);
|
| 246 |
+
|
| 247 |
+
// try to get entity_id by sku if not set
|
| 248 |
+
if (empty($row['entity_id'])) {
|
| 249 |
+
$row['entity_id'] = $this->getResource()->getProductIdBySku($row['sku']);
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
// if attribute_set not set use default
|
| 253 |
+
if (empty($row['attribute_set'])) {
|
| 254 |
+
$row['attribute_set'] = 'Default';
|
| 255 |
+
}
|
| 256 |
+
// get attribute_set_id, if not throw error
|
| 257 |
+
$row['attribute_set_id'] = $this->getAttributeSetId($entityTypeId, $row['attribute_set']);
|
| 258 |
+
if (!$row['attribute_set_id']) {
|
| 259 |
+
$this->addException(Mage::helper('catalog')->__("Invalid attribute set specified, skipping the record"), Mage_Dataflow_Model_Convert_Exception::ERROR);
|
| 260 |
+
continue;
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
if (empty($row['type'])) {
|
| 264 |
+
$row['type'] = 'Simple';
|
| 265 |
+
}
|
| 266 |
+
// get product type_id, if not throw error
|
| 267 |
+
$row['type_id'] = $this->getProductTypeId($row['type']);
|
| 268 |
+
if (!$row['type_id']) {
|
| 269 |
+
$this->addException(Mage::helper('catalog')->__("Invalid product type specified, skipping the record"), Mage_Dataflow_Model_Convert_Exception::ERROR);
|
| 270 |
+
continue;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
// get store ids
|
| 274 |
+
$storeIds = $this->getStoreIds(isset($row['store']) ? $row['store'] : $this->getVar('store'));
|
| 275 |
+
if (!$storeIds) {
|
| 276 |
+
$this->addException(Mage::helper('catalog')->__("Invalid store specified, skipping the record"), Mage_Dataflow_Model_Convert_Exception::ERROR);
|
| 277 |
+
continue;
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
// import data
|
| 281 |
+
$rowError = false;
|
| 282 |
+
foreach ($storeIds as $storeId) {
|
| 283 |
+
$collection = $this->getCollection($storeId);
|
| 284 |
+
$entity = $collection->getEntity();
|
| 285 |
+
|
| 286 |
+
$model = Mage::getModel('catalog/product');
|
| 287 |
+
$model->setStoreId($storeId);
|
| 288 |
+
if (!empty($row['entity_id'])) {
|
| 289 |
+
$model->load($row['entity_id']);
|
| 290 |
+
}
|
| 291 |
+
foreach ($row as $field=>$value) {
|
| 292 |
+
$attribute = $entity->getAttribute($field);
|
| 293 |
+
|
| 294 |
+
if (!$attribute) {
|
| 295 |
+
//$inventoryFields[$row['sku']][$field] = $value;
|
| 296 |
+
|
| 297 |
+
if (in_array($field, $this->_inventoryFields)) {
|
| 298 |
+
$inventoryFields[$row['sku']][$field] = $value;
|
| 299 |
+
}
|
| 300 |
+
continue;
|
| 301 |
+
#$this->addException(Mage::helper('catalog')->__("Unknown attribute: %s", $field), Mage_Dataflow_Model_Convert_Exception::ERROR);
|
| 302 |
+
}
|
| 303 |
+
if ($attribute->usesSource()) {
|
| 304 |
+
$source = $attribute->getSource();
|
| 305 |
+
$optionId = $this->getSourceOptionId($source, $value);
|
| 306 |
+
if (is_null($optionId)) {
|
| 307 |
+
$rowError = true;
|
| 308 |
+
$this->addException(Mage::helper('catalog')->__("Invalid attribute option specified for attribute %s (%s), skipping the record", $field, $value), Mage_Dataflow_Model_Convert_Exception::ERROR);
|
| 309 |
+
continue;
|
| 310 |
+
}
|
| 311 |
+
$value = $optionId;
|
| 312 |
+
}
|
| 313 |
+
$model->setData($field, $value);
|
| 314 |
+
|
| 315 |
+
}//foreach ($row as $field=>$value)
|
| 316 |
+
|
| 317 |
+
//echo 'Before **********************<br/><pre>';
|
| 318 |
+
//print_r($model->getData());
|
| 319 |
+
if (!$rowError) {
|
| 320 |
+
$collection->addItem($model);
|
| 321 |
+
}
|
| 322 |
+
unset($model);
|
| 323 |
+
} //foreach ($storeIds as $storeId)
|
| 324 |
+
} catch (Exception $e) {
|
| 325 |
+
if (!$e instanceof Mage_Dataflow_Model_Convert_Exception) {
|
| 326 |
+
$this->addException(Mage::helper('catalog')->__("Error during retrieval of option value: %s", $e->getMessage()), Mage_Dataflow_Model_Convert_Exception::FATAL);
|
| 327 |
+
}
|
| 328 |
+
}
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
// set importinted to adaptor
|
| 332 |
+
if (sizeof($inventoryFields) > 0) {
|
| 333 |
+
Mage::register('current_imported_inventory', $inventoryFields);
|
| 334 |
+
//$this->setInventoryItems($inventoryFields);
|
| 335 |
+
} // end setting imported to adaptor
|
| 336 |
+
|
| 337 |
+
$this->setData($this->_collections);
|
| 338 |
+
return $this;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
public function setInventoryItems($items)
|
| 342 |
+
{
|
| 343 |
+
$this->_inventoryItems = $items;
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
public function getInventoryItems()
|
| 347 |
+
{
|
| 348 |
+
return $this->_inventoryItems;
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
/**
|
| 352 |
+
* Unparse (prepare data) loaded products
|
| 353 |
+
*
|
| 354 |
+
* @return Mage_Catalog_Model_Convert_Parser_Product
|
| 355 |
+
*/
|
| 356 |
+
public function unparse()
|
| 357 |
+
{
|
| 358 |
+
$entityIds = $this->getData();
|
| 359 |
+
//$recordlimitstart = $this->getVar('recordlimitstart');
|
| 360 |
+
//$recordlimitend = $this->getVar('recordlimitend');
|
| 361 |
+
$overallcount = 1;
|
| 362 |
+
#array_reverse($entityIds);
|
| 363 |
+
foreach ($entityIds as $i => $entityId) {
|
| 364 |
+
if ($overallcount) {
|
| 365 |
+
$product = $this->getProductModel()
|
| 366 |
+
->reset()
|
| 367 |
+
->setStoreId($this->getStoreId())
|
| 368 |
+
->load($entityId);
|
| 369 |
+
$this->setProductTypeInstance($product);
|
| 370 |
+
/* @var $product Mage_Catalog_Model_Product */
|
| 371 |
+
|
| 372 |
+
$position = Mage::helper('catalog')->__('Line %d, SKU: %s', ($i+1), $product->getSku());
|
| 373 |
+
$this->setPosition($position);
|
| 374 |
+
|
| 375 |
+
$row = array(
|
| 376 |
+
'store' => $this->getStore()->getCode(),
|
| 377 |
+
'websites' => '',
|
| 378 |
+
'attribute_set' => $this->getAttributeSetName($product->getEntityTypeId(), $product->getAttributeSetId()),
|
| 379 |
+
'type' => $product->getTypeId(),
|
| 380 |
+
'category_ids' => join(',', $product->getCategoryIds())
|
| 381 |
+
);
|
| 382 |
+
|
| 383 |
+
if ($this->getStore()->getCode() == Mage_Core_Model_Store::ADMIN_CODE) {
|
| 384 |
+
$websiteCodes = array();
|
| 385 |
+
foreach ($product->getWebsiteIds() as $websiteId) {
|
| 386 |
+
$websiteCode = Mage::app()->getWebsite($websiteId)->getCode();
|
| 387 |
+
$websiteCodes[$websiteCode] = $websiteCode;
|
| 388 |
+
}
|
| 389 |
+
$row['websites'] = join(',', $websiteCodes);
|
| 390 |
+
}
|
| 391 |
+
else {
|
| 392 |
+
$row['websites'] = $this->getStore()->getWebsite()->getCode();
|
| 393 |
+
if ($this->getVar('url_field')) {
|
| 394 |
+
$row['url'] = $product->getProductUrl(false);
|
| 395 |
+
}
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
foreach ($product->getData() as $field => $value) {
|
| 399 |
+
if (in_array($field, $this->_systemFields) || is_object($value)) {
|
| 400 |
+
continue;
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
$attribute = $this->getAttribute($field);
|
| 404 |
+
if (!$attribute) {
|
| 405 |
+
continue;
|
| 406 |
+
}
|
| 407 |
+
#print_r($attribute);
|
| 408 |
+
if ($attribute->usesSource()) {
|
| 409 |
+
|
| 410 |
+
$finalproductattributes = "";
|
| 411 |
+
$row['config_attributes'] = '';
|
| 412 |
+
if($product->getTypeId() == "configurable") {
|
| 413 |
+
$cProduct = Mage::getModel('catalog/product')->load($product->getId());
|
| 414 |
+
//check if product is a configurable type or not
|
| 415 |
+
if ($cProduct->getData('type_id') == "configurable")
|
| 416 |
+
{
|
| 417 |
+
//get the configurable data from the product
|
| 418 |
+
$config = $cProduct->getTypeInstance(true);
|
| 419 |
+
//loop through the attributes
|
| 420 |
+
foreach($config->getConfigurableAttributesAsArray($cProduct) as $attributes)
|
| 421 |
+
{
|
| 422 |
+
#$finalproductattributes .= $attributes["label"] . ",";
|
| 423 |
+
$finalproductattributes .= $attributes['attribute_code'] . ",";
|
| 424 |
+
|
| 425 |
+
}
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
}
|
| 429 |
+
$row['config_attributes'] = substr_replace($finalproductattributes,"",-1);
|
| 430 |
+
if (is_object($attribute->usesSource())) {
|
| 431 |
+
$option = $attribute->getSource()->getOptionText($value);
|
| 432 |
+
} else if ($field != "meta_robots" && $field != "canonical_url"){ //3rd party patch here for these fields.. attribute non-object error
|
| 433 |
+
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
|
| 434 |
+
->setEntityTypeFilter($product->getResource()->getTypeId())
|
| 435 |
+
->addFieldToFilter('attribute_code', $field);
|
| 436 |
+
$attribute = $attributes->getFirstItem()->setEntity($product->getResource());
|
| 437 |
+
#echo "FIELD: " . $field . "<br/>";
|
| 438 |
+
#echo "VALUE: " . $attribute->getSource()->getOptionText($value). "<br/>";
|
| 439 |
+
$option = $attribute->getSource()->getOptionText($value);
|
| 440 |
+
#exit;
|
| 441 |
+
} else {
|
| 442 |
+
$option ="";
|
| 443 |
+
}
|
| 444 |
+
if ($value && empty($option) && $field != "meta_robots") {
|
| 445 |
+
$message = Mage::helper('catalog')->__("Invalid option id specified for %s (%s), skipping the record", $field, $value);
|
| 446 |
+
#$this->addException($message, Mage_Dataflow_Model_Convert_Exception::ERROR);
|
| 447 |
+
continue;
|
| 448 |
+
}
|
| 449 |
+
if (is_array($option)) {
|
| 450 |
+
$value = join(self::MULTI_DELIMITER, $option);
|
| 451 |
+
} else {
|
| 452 |
+
$value = $option;
|
| 453 |
+
}
|
| 454 |
+
unset($option);
|
| 455 |
+
}
|
| 456 |
+
elseif (is_array($value)) {
|
| 457 |
+
continue;
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
$row[$field] = $value;
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
|
| 464 |
+
if ($stockItem = $product->getStockItem()) {
|
| 465 |
+
foreach ($stockItem->getData() as $field => $value) {
|
| 466 |
+
if (in_array($field, $this->_systemFields) || is_object($value)) {
|
| 467 |
+
continue;
|
| 468 |
+
}
|
| 469 |
+
$row[$field] = $value;
|
| 470 |
+
}
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
foreach ($this->_imageFields as $field) {
|
| 474 |
+
if (isset($row[$field]) && $row[$field] == 'no_selection') {
|
| 475 |
+
$row[$field] = null;
|
| 476 |
+
}
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
#$row['product_id'] = $product->getId();
|
| 480 |
+
if($this->getVar('export_category_paths') == "true") {
|
| 481 |
+
|
| 482 |
+
/* ADDITIONAL CATEGORY ID EXPORT FOR 1.4 ONLY [START] */
|
| 483 |
+
$finalcategoryIds = "";
|
| 484 |
+
$resource = Mage::getSingleton('core/resource');
|
| 485 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 486 |
+
$read = $resource->getConnection('core_read');
|
| 487 |
+
$select_qryvalues2 = $read->query("SELECT category_id FROM `".$prefix."catalog_category_product` WHERE product_id = '".$product->getId()."'");
|
| 488 |
+
foreach($select_qryvalues2->fetchAll() as $datavalues2)
|
| 489 |
+
{
|
| 490 |
+
$finalcategoryIds .= $datavalues2['category_id'] . ",";
|
| 491 |
+
}
|
| 492 |
+
$row['categorys_ids'] = substr_replace($finalcategoryIds,"",-1);
|
| 493 |
+
/* ADDITIONAL CATEGORY ID EXPORT FOR 1.4 ONLY [END] */
|
| 494 |
+
|
| 495 |
+
/* PRODUCT CATEGORIES EXPORT START */
|
| 496 |
+
#print_r($row['categorys_ids']);
|
| 497 |
+
if($row['categorys_ids'] != "") {
|
| 498 |
+
$finalimportofcategories = "";
|
| 499 |
+
$okforallcategoriesnow = "";
|
| 500 |
+
$finalvcategoriesproductoptions1 = "";
|
| 501 |
+
$finalvcategoriesproductoptions2 = "";
|
| 502 |
+
$finalvcategoriesproductoptions2before = "";
|
| 503 |
+
foreach(explode(',',$row['categorys_ids']) as $productcategoryId)
|
| 504 |
+
{
|
| 505 |
+
$cat = Mage::getModel('catalog/category')->load($productcategoryId);
|
| 506 |
+
$finalvcategoriesproductoptions1 = $cat->getName();
|
| 507 |
+
$subcatsforreverse = $cat->getParentIds();
|
| 508 |
+
$subcats = array_shift($subcatsforreverse);
|
| 509 |
+
$subcats1 = array_shift($subcatsforreverse);
|
| 510 |
+
#print_r($subcatsforreverse);
|
| 511 |
+
$finalvcategoriesproductoptions2before = "";
|
| 512 |
+
foreach($subcatsforreverse as $subcatsproductcategoryId)
|
| 513 |
+
{
|
| 514 |
+
$subcat = Mage::getModel('catalog/category')->load($subcatsproductcategoryId);
|
| 515 |
+
#echo "CAT1: " . $subcat->getName() . "<br/>";
|
| 516 |
+
$finalvcategoriesproductoptions2before .= $subcat->getName() . "/";
|
| 517 |
+
$subsubcats = $subcat->getChildren();
|
| 518 |
+
}
|
| 519 |
+
$finalimportofcategories .= $finalvcategoriesproductoptions2before .
|
| 520 |
+
$finalvcategoriesproductoptions1 . " , ";
|
| 521 |
+
}
|
| 522 |
+
$okforallcategoriesnow = substr_replace($finalimportofcategories,"",-3);
|
| 523 |
+
$row['categories'] = $okforallcategoriesnow;
|
| 524 |
+
|
| 525 |
+
}
|
| 526 |
+
/* PRODUCT CATEGORIES EXPORT END */
|
| 527 |
+
|
| 528 |
+
} else {
|
| 529 |
+
|
| 530 |
+
/* ADDITIONAL CATEGORY ID EXPORT FOR 1.4 ONLY [START] */
|
| 531 |
+
$finalcategoryIds = "";
|
| 532 |
+
$resource = Mage::getSingleton('core/resource');
|
| 533 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 534 |
+
$read = $resource->getConnection('core_read');
|
| 535 |
+
$select_qryvalues2 = $read->query("SELECT category_id FROM `".$prefix."catalog_category_product` WHERE product_id = '".$product->getId()."'");
|
| 536 |
+
foreach($select_qryvalues2->fetchAll() as $datavalues2)
|
| 537 |
+
{
|
| 538 |
+
$finalcategoryIds .= $datavalues2['category_id'] . ",";
|
| 539 |
+
}
|
| 540 |
+
$row['category_ids'] = substr_replace($finalcategoryIds,"",-1);
|
| 541 |
+
/* ADDITIONAL CATEGORY ID EXPORT FOR 1.4 ONLY [END] */
|
| 542 |
+
|
| 543 |
+
}
|
| 544 |
+
/* ADDITIONAL IMAGE EXPORT FOR 1.4 ONLY [START] */
|
| 545 |
+
$finalgalleryimages = "";
|
| 546 |
+
$galleryImagesModel = Mage::getModel('catalog/product')->load($product->getId())->getMediaGalleryImages();
|
| 547 |
+
|
| 548 |
+
if (count($galleryImagesModel) > 0) {
|
| 549 |
+
foreach ($galleryImagesModel as $_image) {
|
| 550 |
+
$finalgalleryimages .= $_image->getFile() . ",";
|
| 551 |
+
//$finalgalleryimages .= $_image['file'] . ", ";
|
| 552 |
+
//$finalgallerylabels .= $_image['label'] . ", ";
|
| 553 |
+
}
|
| 554 |
+
}
|
| 555 |
+
$row['gallery'] = substr_replace($finalgalleryimages,"",-1);
|
| 556 |
+
#print_r($galleryImagesModel);
|
| 557 |
+
/* ADDITIONAL IMAGE EXPORT FOR 1.4 ONLY [END] */
|
| 558 |
+
|
| 559 |
+
$row['related'] = "";
|
| 560 |
+
$incoming_RelatedProducts = $product->getRelatedProducts();
|
| 561 |
+
foreach($incoming_RelatedProducts as $relatedproducts_str){
|
| 562 |
+
#print_r($relatedproducts_str);
|
| 563 |
+
#echo "SKU: " . $relatedproducts_str->getSku();
|
| 564 |
+
if($this->getVar('export_related_position') == "true") {
|
| 565 |
+
$row['related'] .= $relatedproducts_str['position'] .":". $relatedproducts_str->getSku() . ",";
|
| 566 |
+
} else {
|
| 567 |
+
$row['related'] .= $relatedproducts_str->getSku() . ",";
|
| 568 |
+
}
|
| 569 |
+
}
|
| 570 |
+
|
| 571 |
+
$row['upsell'] = "";
|
| 572 |
+
$incoming_UpSellProducts = $product->getUpSellProducts();
|
| 573 |
+
foreach($incoming_UpSellProducts as $UpSellproducts_str){
|
| 574 |
+
#print_r($relatedproducts_str);
|
| 575 |
+
#echo "SKU: " . $UpSellproducts_str->getSku();
|
| 576 |
+
if($this->getVar('export_upsell_position') == "true") {
|
| 577 |
+
$row['upsell'] .= $UpSellproducts_str['position'] .":". $UpSellproducts_str->getSku() . ",";
|
| 578 |
+
} else {
|
| 579 |
+
$row['upsell'] .= $UpSellproducts_str->getSku() . ",";
|
| 580 |
+
}
|
| 581 |
+
}
|
| 582 |
+
|
| 583 |
+
$row['crosssell'] = "";
|
| 584 |
+
$incoming_CrossSellProducts = $product->getCrossSellProducts ();
|
| 585 |
+
foreach($incoming_CrossSellProducts as $CrossSellproducts_str){
|
| 586 |
+
#print_r($relatedproducts_str);
|
| 587 |
+
#echo "SKU: " . $CrossSellproducts_str->getSku();
|
| 588 |
+
if($this->getVar('export_upsell_position') == "true") {
|
| 589 |
+
#echo "SKU crosssell: " . $CrossSellproducts_str['position'] . " -- " . $CrossSellproducts_str->getSku();
|
| 590 |
+
$row['crosssell'] .= $CrossSellproducts_str['position'] .":". $CrossSellproducts_str->getSku() . ",";
|
| 591 |
+
} else {
|
| 592 |
+
$row['crosssell'] .= $CrossSellproducts_str->getSku() . ",";
|
| 593 |
+
}
|
| 594 |
+
}
|
| 595 |
+
|
| 596 |
+
/* EXPORTS TIER PRICING */
|
| 597 |
+
#print_r($product->getTierPrice());
|
| 598 |
+
$row['tier_prices'] = "";
|
| 599 |
+
#$incoming_tierps = $product->getTierPrice();
|
| 600 |
+
$incoming_tierps = $product->getData('tier_price');
|
| 601 |
+
if(is_array($incoming_tierps)) {
|
| 602 |
+
foreach($incoming_tierps as $tier_str){
|
| 603 |
+
#print_r($tier_str);
|
| 604 |
+
$row['tier_prices'] .= $tier_str['cust_group'] . "=" . round($tier_str['price_qty']) . "=" . $tier_str['price'] . "|";
|
| 605 |
+
}
|
| 606 |
+
}
|
| 607 |
+
/* EXPORTS ASSOICATED CONFIGURABLE SKUS */
|
| 608 |
+
$row['associated'] = '';
|
| 609 |
+
if($product->getTypeId() == "configurable") {
|
| 610 |
+
$associatedProducts = Mage::getSingleton('catalog/product_type')->factory($product)->getUsedProducts($product);
|
| 611 |
+
#print_r($associatedProducts->getUsedProducts($product));
|
| 612 |
+
#echo "ID: " . $product2->getId();
|
| 613 |
+
foreach($associatedProducts as $associatedProduct) {
|
| 614 |
+
$row['associated'] .= $associatedProduct->getSku() . ",";
|
| 615 |
+
}
|
| 616 |
+
}
|
| 617 |
+
|
| 618 |
+
/* EXPORTS ASSOICATED BUNDLE SKUS */
|
| 619 |
+
$row['bundle_options'] = '';
|
| 620 |
+
if($product->getTypeId() == "bundle") {
|
| 621 |
+
$finalbundleoptions = "";
|
| 622 |
+
$finalbundleselectionoptions = "";
|
| 623 |
+
$finalbundleselectionoptionssorting = "";
|
| 624 |
+
$optionModel = Mage::getModel('bundle/option')->getResourceCollection()->setProductIdFilter($product->getId());
|
| 625 |
+
|
| 626 |
+
foreach($optionModel as $eachOption) {
|
| 627 |
+
$resource = Mage::getSingleton('core/resource');
|
| 628 |
+
$OptiondataDB = $resource->getConnection('catalog_write');
|
| 629 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 630 |
+
|
| 631 |
+
$selectOptionID = "SELECT title FROM ".$prefix."catalog_product_bundle_option_value WHERE option_id = ".$eachOption->getData('option_id')."";
|
| 632 |
+
$Optiondatarows = $OptiondataDB->fetchAll($selectOptionID);
|
| 633 |
+
foreach($Optiondatarows as $Option_row)
|
| 634 |
+
{
|
| 635 |
+
$finaltitle = str_replace(' ','_',$Option_row['title']);
|
| 636 |
+
}
|
| 637 |
+
$finalbundleoptions .= $finaltitle . "," . $eachOption->getData('type') . "," . $eachOption->getData('required') . "," . $eachOption->getData('position') . "|";
|
| 638 |
+
|
| 639 |
+
|
| 640 |
+
$selectionModel = Mage::getModel('bundle/selection')->setOptionId($eachOption->getData('option_id'))->getResourceCollection();
|
| 641 |
+
#print_r($selectionModel->getData());
|
| 642 |
+
foreach($selectionModel as $eachselectionOption) {
|
| 643 |
+
#echo "t: " . $eachselectionOption->getData('selection_price_type');
|
| 644 |
+
if($eachselectionOption->getData('option_id') == $eachOption->getData('option_id')) {
|
| 645 |
+
$finalbundleselectionoptionssorting .= $eachselectionOption->getData('sku') . ":" . $eachselectionOption->getData('selection_price_type') . ":" . $eachselectionOption->getData('selection_price_value') . ":" . $eachselectionOption->getData('is_default') . ":" . $eachselectionOption->getData('selection_qty') . ":" . $eachselectionOption->getData('selection_can_change_qty'). ":" . $eachselectionOption->getData('position') . ",";
|
| 646 |
+
}
|
| 647 |
+
}
|
| 648 |
+
$finalbundleselectionoptionssorting = substr_replace($finalbundleselectionoptionssorting,"",-1);
|
| 649 |
+
$finalbundleselectionoptionssorting .= "|";
|
| 650 |
+
$finalbundleselectionoptions = substr_replace($finalbundleselectionoptionssorting,"",-1);
|
| 651 |
+
}
|
| 652 |
+
$row['bundle_options'] = substr_replace($finalbundleoptions,"",-1);
|
| 653 |
+
$row['bundle_selections'] = substr_replace($finalbundleselectionoptions,"",-1);
|
| 654 |
+
}
|
| 655 |
+
|
| 656 |
+
|
| 657 |
+
/* EXPORTS ASSOICATED GROUPED SKUS */
|
| 658 |
+
$row['grouped'] = '';
|
| 659 |
+
if($product->getTypeId() == "grouped") {
|
| 660 |
+
$associatedProducts = Mage::getSingleton('catalog/product_type')->factory($product)->getAssociatedProducts($product);
|
| 661 |
+
foreach($associatedProducts as $associatedProduct) {
|
| 662 |
+
if($this->getVar('export_grouped_position') == "true") {
|
| 663 |
+
$row['grouped'] .= $associatedProduct->getPosition() . ":" . $associatedProduct->getSku() . ":" . $associatedProduct->getQty() . ",";
|
| 664 |
+
} else {
|
| 665 |
+
$row['grouped'] .= $associatedProduct->getSku() . ",";
|
| 666 |
+
}
|
| 667 |
+
}
|
| 668 |
+
}
|
| 669 |
+
|
| 670 |
+
/*EXPORTS GROUPED PRICES 1.7.x beta rc1 */
|
| 671 |
+
|
| 672 |
+
$resource = Mage::getSingleton('core/resource');
|
| 673 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 674 |
+
$read = $resource->getConnection('core_read');
|
| 675 |
+
$finalgrouped_prices_info="";
|
| 676 |
+
$select_qry_grouped_pricing = "SELECT * FROM ".$resource->getTableName('catalog/product_attribute_group_price')." WHERE entity_id = '".$product->getId()."'";
|
| 677 |
+
$rows = $read->fetchAll($select_qry_grouped_pricing);
|
| 678 |
+
|
| 679 |
+
if(!empty($rows)) {
|
| 680 |
+
foreach($rows as $groupRow)
|
| 681 |
+
{
|
| 682 |
+
#print_r($groupRow);
|
| 683 |
+
#echo "ID: " . $groupRow['customer_group_id'];
|
| 684 |
+
$finalgrouped_prices_info .= $groupRow['customer_group_id'] . "=" . $groupRow['value'] . "|";
|
| 685 |
+
#$row['group_price_customer_group'] = $groupRow['all_groups'];
|
| 686 |
+
#$row['group_price_website'] = $groupRow['website_id'];
|
| 687 |
+
}
|
| 688 |
+
}
|
| 689 |
+
$row['group_price_price'] = '';
|
| 690 |
+
$row['group_price_price'] = substr_replace($finalgrouped_prices_info,"",-1);
|
| 691 |
+
|
| 692 |
+
/* EXPORTS DOWNLOADABLE OPTIONS */
|
| 693 |
+
$row['downloadable_options'] = '';
|
| 694 |
+
$finaldownloabledproductoptions = "";
|
| 695 |
+
if($product->getTypeId() == "downloadable") {
|
| 696 |
+
|
| 697 |
+
$_linkCollection = Mage::getModel('downloadable/link')->getCollection()
|
| 698 |
+
->addProductToFilter($product->getId())
|
| 699 |
+
->addTitleToResult($product->getStoreId())
|
| 700 |
+
->addPriceToResult($product->getStore()->getWebsiteId());
|
| 701 |
+
|
| 702 |
+
foreach ($_linkCollection as $link) {
|
| 703 |
+
/* @var Mage_Downloadable_Model_Link $link */
|
| 704 |
+
#print_r($link);
|
| 705 |
+
#Main file,0.00,3,file,/test.mp3,/sample.mp
|
| 706 |
+
if($link->getLinkUrl() !="" && $link->getSampleUrl() !="") {
|
| 707 |
+
$finaldownloabledproductoptions .= $link->getTitle() . "," . $link->getPrice() . "," . $link->getNumberOfDownloads() . "," . $link->getLinkType() . "," . $link->getLinkUrl() . "," . $link->getSampleUrl() . "|";
|
| 708 |
+
} else if($link->getLinkUrl() !="") {
|
| 709 |
+
$finaldownloabledproductoptions .= $link->getTitle() . "," . $link->getPrice() . "," . $link->getNumberOfDownloads() . "," . $link->getLinkType() . "," . $link->getLinkUrl() . "|";
|
| 710 |
+
} else if($link->getLinkFile() !="" && $link->getSampleFile() !="") {
|
| 711 |
+
$finaldownloabledproductoptions .= $link->getTitle() . "," . $link->getPrice() . "," . $link->getNumberOfDownloads() . "," . $link->getLinkType() . "," . $link->getLinkFile() . "," . $link->getSampleFile() . "|";
|
| 712 |
+
} else {
|
| 713 |
+
$finaldownloabledproductoptions .= $link->getTitle() . "," . $link->getPrice() . "," . $link->getNumberOfDownloads() . "," . $link->getLinkType() . "," . $link->getLinkFile() . "|";
|
| 714 |
+
}
|
| 715 |
+
}
|
| 716 |
+
$row['downloadable_options'] = substr_replace($finaldownloabledproductoptions,"",-1);
|
| 717 |
+
|
| 718 |
+
}
|
| 719 |
+
|
| 720 |
+
/* EXPORTS SUPER ATTRIBUTE PRICING [START] */
|
| 721 |
+
$row['super_attribute_pricing'] = "";
|
| 722 |
+
$finalsuper_attribute_pricing_product_options = "";
|
| 723 |
+
$resource = Mage::getSingleton('core/resource');
|
| 724 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 725 |
+
$read = $resource->getConnection('core_read');
|
| 726 |
+
|
| 727 |
+
if($product->getTypeId() == "configurable") {
|
| 728 |
+
$cProduct = Mage::getModel('catalog/product')->load($product->getId());
|
| 729 |
+
//check if product is a configurable type or not
|
| 730 |
+
if ($cProduct->getData('type_id') == "configurable")
|
| 731 |
+
{
|
| 732 |
+
//get the configurable data from the product
|
| 733 |
+
$config = $cProduct->getTypeInstance(true);
|
| 734 |
+
//loop through the attributes
|
| 735 |
+
foreach($config->getConfigurableAttributesAsArray($cProduct) as $attributes)
|
| 736 |
+
{
|
| 737 |
+
#print_r($attributes);
|
| 738 |
+
#$finalproductattributes .= $attributes["label"] . ",";
|
| 739 |
+
foreach($attributes['values'] as $attributedata)
|
| 740 |
+
{
|
| 741 |
+
$select_qry_for_super_attribute_pricing = "SELECT * FROM `".$prefix."catalog_product_super_attribute_pricing` WHERE ".$prefix."catalog_product_super_attribute_pricing.product_super_attribute_id = '".$attributedata['product_super_attribute_id']."' AND ".$prefix."catalog_product_super_attribute_pricing.value_index = '".$attributedata['value_index']."'";
|
| 742 |
+
#echo "SQL: " . $select_qry_for_super_attribute_pricing;
|
| 743 |
+
$rows = $read->fetchAll($select_qry_for_super_attribute_pricing);
|
| 744 |
+
|
| 745 |
+
if(!empty($rows)) {
|
| 746 |
+
foreach($rows as $data_sap)
|
| 747 |
+
{
|
| 748 |
+
//[value_id] => 4 [product_super_attribute_id] => 3 [value_index] => 39 [is_percent] => 0 [pricing_value] => 1.0000
|
| 749 |
+
#print_r($data_sap);
|
| 750 |
+
$finalsuper_attribute_pricing_product_options .= $attributedata['label'] . ":" . $data_sap['pricing_value'] . ":" . $data_sap['is_percent'] . "|";
|
| 751 |
+
}
|
| 752 |
+
} else {
|
| 753 |
+
$finalsuper_attribute_pricing_product_options .= $attributedata['label'] . ":" . $attributedata['pricing_value'] . ":" . $attributedata['is_percent'] . "|";
|
| 754 |
+
}
|
| 755 |
+
}
|
| 756 |
+
}
|
| 757 |
+
}
|
| 758 |
+
|
| 759 |
+
}
|
| 760 |
+
$row['super_attribute_pricing'] = substr_replace($finalsuper_attribute_pricing_product_options,"",-1);
|
| 761 |
+
/* EXPORTS SUPER ATTRIBUTE PRICING [END] */
|
| 762 |
+
|
| 763 |
+
/* EXPORTS PRODUCT TAGS START*/
|
| 764 |
+
$row['product_tags'] = '';
|
| 765 |
+
$producttagcustomerID="";
|
| 766 |
+
$all_tags="";
|
| 767 |
+
$resource = Mage::getSingleton('core/resource');
|
| 768 |
+
$read = $resource->getConnection('catalog_read');
|
| 769 |
+
$prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
|
| 770 |
+
|
| 771 |
+
$select = "SELECT customer_id FROM `".$prefix."tag_relation` WHERE product_id = " . $product->getId() . " LIMIT 1";
|
| 772 |
+
|
| 773 |
+
$rows = $read->fetchAll($select);
|
| 774 |
+
foreach($rows as $row1)
|
| 775 |
+
{
|
| 776 |
+
$producttagcustomerID = $row1['customer_id'];
|
| 777 |
+
}
|
| 778 |
+
|
| 779 |
+
$tagsCollection = Mage::getModel('tag/tag')->getResourceCollection();
|
| 780 |
+
$tagsCollection->addPopularity()
|
| 781 |
+
->addProductFilter($product->getId())
|
| 782 |
+
->setActiveFilter();
|
| 783 |
+
#print_r($tagsCollection);
|
| 784 |
+
foreach( $tagsCollection as $_tag ) {
|
| 785 |
+
#print_r($_tag->getData());
|
| 786 |
+
$all_tags .= $producttagcustomerID . ":".str_replace(" ","_", $_tag->getData('name')) . ", ";
|
| 787 |
+
}
|
| 788 |
+
#$row['product_tags'] = $all_tags;
|
| 789 |
+
$row['product_tags'] = substr_replace($all_tags,"",-2);
|
| 790 |
+
|
| 791 |
+
|
| 792 |
+
/* EXPORT PRODUCT TAGS END */
|
| 793 |
+
/* EXPORTS CUSTOM OPTIONS */
|
| 794 |
+
#print_r($product->getOptions());
|
| 795 |
+
foreach ($product->getOptions() as $o) {
|
| 796 |
+
#print_r($o->getData());
|
| 797 |
+
#echo "CUSTOM OPTIONS NAME: " . $o->getData('title') . ":" . $o->getData('type') . ":" . $o->getData('is_require') . ":". $o->getData('sort_order');
|
| 798 |
+
$customoptionvalues = "";
|
| 799 |
+
$customoptionstitle = $o->getData('title') . ":" . $o->getData('type') . ":" . $o->getData('is_require') . ":". $o->getData('sort_order');
|
| 800 |
+
if($o->getData('type')=="checkbox" || $o->getData('type')=="drop_down" || $o->getData('type')=="radio" || $o->getData('type')=="multiple") {
|
| 801 |
+
foreach ( $o->getValues() as $oValues ) {
|
| 802 |
+
if($oValues->getData('price_type')=="") { $price_type = "fixed"; } else { $price_type = $oValues->getData('price_type'); }
|
| 803 |
+
if($oValues->getData('price')=="") { $price = "0.0000"; } else { $price = $oValues->getData('price'); }
|
| 804 |
+
if($oValues->getData('sku')=="") { $sku = " "; } else { $sku = $oValues->getData('sku'); }
|
| 805 |
+
if($oValues->getData('sort_order')=="") { $sort_order = "0"; } else { $sort_order = $oValues->getData('sort_order'); }
|
| 806 |
+
if($oValues->getData('max_characters')=="") { $max_characters = "0"; } else { $max_characters = $oValues->getData('max_characters'); }
|
| 807 |
+
|
| 808 |
+
$customoptionvalues .= $oValues->getData('title') . ":" . $price_type . ":" . $price . ":" . $sku . ":" . $sort_order . ":" . $max_characters . "|";
|
| 809 |
+
|
| 810 |
+
}
|
| 811 |
+
} else {
|
| 812 |
+
#print_r($o->getData());
|
| 813 |
+
if($o->getData('price_type')=="") { $price_type = "fixed"; } else { $price_type = $o->getData('price_type'); }
|
| 814 |
+
if($o->getData('price')=="") { $price = "0.0000"; } else { $price = $o->getData('price'); }
|
| 815 |
+
if($o->getData('sku')=="") { $sku = " "; } else { $sku = $o->getData('sku'); }
|
| 816 |
+
if($o->getData('sort_order')=="") { $sort_order = "0"; } else { $sort_order = $o->getData('sort_order'); }
|
| 817 |
+
if($o->getData('max_characters')=="") { $max_characters = "0"; } else { $max_characters = $o->getData('max_characters'); }
|
| 818 |
+
|
| 819 |
+
$customoptionvalues .= $o->getData('title') . ":" . $price_type . ":" . $price . ":" . $sku . ":" . $sort_order . ":" . $max_characters . "|";
|
| 820 |
+
}
|
| 821 |
+
$row[$customoptionstitle] = substr_replace($customoptionvalues,"",-1);
|
| 822 |
+
}
|
| 823 |
+
|
| 824 |
+
$batchExport = $this->getBatchExportModel()
|
| 825 |
+
->setId(null)
|
| 826 |
+
->setBatchId($this->getBatchModel()->getId())
|
| 827 |
+
->setBatchData($row)
|
| 828 |
+
->setStatus(1)
|
| 829 |
+
->save();
|
| 830 |
+
} #ends check on count of orders being exported
|
| 831 |
+
$overallcount+=1;
|
| 832 |
+
}
|
| 833 |
+
|
| 834 |
+
return $this;
|
| 835 |
+
}
|
| 836 |
+
|
| 837 |
+
/**
|
| 838 |
+
* Retrieve accessible external product attributes
|
| 839 |
+
*
|
| 840 |
+
* @return array
|
| 841 |
+
*/
|
| 842 |
+
public function getExternalAttributes()
|
| 843 |
+
{
|
| 844 |
+
$entityTypeId = Mage::getSingleton('eav/config')->getEntityType('catalog_product')->getId();
|
| 845 |
+
$productAttributes = Mage::getResourceModel('catalog/product_attribute_collection')
|
| 846 |
+
->load();
|
| 847 |
+
|
| 848 |
+
$attributes = $this->_externalFields;
|
| 849 |
+
|
| 850 |
+
foreach ($productAttributes as $attr) {
|
| 851 |
+
$code = $attr->getAttributeCode();
|
| 852 |
+
if (in_array($code, $this->_internalFields) || $attr->getFrontendInput() == 'hidden') {
|
| 853 |
+
continue;
|
| 854 |
+
}
|
| 855 |
+
$attributes[$code] = $code;
|
| 856 |
+
}
|
| 857 |
+
|
| 858 |
+
foreach ($this->_inventoryFields as $field) {
|
| 859 |
+
$attributes[$field] = $field;
|
| 860 |
+
}
|
| 861 |
+
|
| 862 |
+
return $attributes;
|
| 863 |
+
}
|
| 864 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Rule.php
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Rule extends Mage_Rule_Model_Abstract
|
| 4 |
+
{
|
| 5 |
+
/**
|
| 6 |
+
* Getter for rule combine conditions instance
|
| 7 |
+
*
|
| 8 |
+
* @return PI_Oopsprofile_Model_Rule_Condition_Combine
|
| 9 |
+
*/
|
| 10 |
+
public function getConditionsInstance()
|
| 11 |
+
{
|
| 12 |
+
return Mage::getModel('oopsprofile/rule_condition_combine');
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
public function getConditions()
|
| 16 |
+
{
|
| 17 |
+
$profile = Mage::registry('current_convert_profile');
|
| 18 |
+
|
| 19 |
+
$ruleCollection = Mage::getModel('oopsprofile/oopsprofile')
|
| 20 |
+
->getCollection()
|
| 21 |
+
->addFieldToFilter('dataflow_profile_id ',$profile->getId())
|
| 22 |
+
->getFirstItem();
|
| 23 |
+
|
| 24 |
+
if (empty($this->_conditions)) {
|
| 25 |
+
$this->_resetConditions();
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
// Load rule conditions if it is applicable
|
| 29 |
+
if ($ruleCollection->hasConditionsSerialized()) {
|
| 30 |
+
$conditions = $ruleCollection->getConditionsSerialized();
|
| 31 |
+
if (!empty($conditions)) {
|
| 32 |
+
$conditions = unserialize($conditions);
|
| 33 |
+
if (is_array($conditions) && !empty($conditions)) {
|
| 34 |
+
$this->_conditions->loadArray($conditions);
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
$this->unsConditionsSerialized();
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
return $this->_conditions;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
public function loadPost(array $data)
|
| 44 |
+
{
|
| 45 |
+
$arr = $this->_convertFlatToRecursive($data);
|
| 46 |
+
if (isset($arr['conditions'])) {
|
| 47 |
+
$this->getConditions()->setConditions(array())->loadArray($arr['conditions'][1]);
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
return $arr;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Getter for rule actions collection instance
|
| 55 |
+
*
|
| 56 |
+
* @return Mage_Rule_Model_Action_Collection
|
| 57 |
+
*/
|
| 58 |
+
public function getActionsInstance()
|
| 59 |
+
{
|
| 60 |
+
return '';
|
| 61 |
+
}
|
| 62 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Rule/Condition/Combine.php
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Rule_Condition_Combine extends Mage_Rule_Model_Condition_Combine
|
| 4 |
+
{
|
| 5 |
+
public function __construct()
|
| 6 |
+
{
|
| 7 |
+
parent::__construct();
|
| 8 |
+
$this->setType('oopsprofile/rule_condition_combine');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
public function getNewChildSelectOptions()
|
| 12 |
+
{
|
| 13 |
+
$productCondition = Mage::getModel('oopsprofile/rule_condition_product');
|
| 14 |
+
$productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption();
|
| 15 |
+
$attributes = array();
|
| 16 |
+
foreach ($productAttributes as $code=>$label) {
|
| 17 |
+
$attributes[] = array('value'=>'oopsprofile/rule_condition_product|'.$code, 'label'=>$label);
|
| 18 |
+
}
|
| 19 |
+
$conditions = parent::getNewChildSelectOptions();
|
| 20 |
+
$conditions = array_merge_recursive($conditions, array(
|
| 21 |
+
array('value'=>'oopsprofile/rule_condition_combine', 'label'=>Mage::helper('oopsprofile')->__('Conditions Combination')),
|
| 22 |
+
array('label'=>Mage::helper('oopsprofile')->__('Product Attribute'), 'value'=>$attributes),
|
| 23 |
+
));
|
| 24 |
+
return $conditions;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
public function collectValidatedAttributes($productCollection)
|
| 28 |
+
{
|
| 29 |
+
foreach ($this->getConditions() as $condition) {
|
| 30 |
+
$condition->collectValidatedAttributes($productCollection);
|
| 31 |
+
}
|
| 32 |
+
return $this;
|
| 33 |
+
}
|
| 34 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Rule/Condition/Product.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Model_Rule_Condition_Product extends Mage_Rule_Model_Condition_Product_Abstract
|
| 4 |
+
{
|
| 5 |
+
/**
|
| 6 |
+
* Add special attributes
|
| 7 |
+
*
|
| 8 |
+
* @param array $attributes
|
| 9 |
+
*/
|
| 10 |
+
protected function _addSpecialAttributes(array &$attributes)
|
| 11 |
+
{
|
| 12 |
+
$attributes['attribute_set_id'] = Mage::helper('catalogrule')->__('Attribute Set');
|
| 13 |
+
$attributes['category_ids'] = Mage::helper('catalogrule')->__('Category');
|
| 14 |
+
//$attributes['sku'] = Mage::helper('catalogrule')->__('Sku');
|
| 15 |
+
//$attributes['entity_id'] = Mage::helper('catalogrule')->__('Id');
|
| 16 |
+
}
|
| 17 |
+
}
|
app/code/community/PI/Oopsprofile/Model/Varien/Io/Sftp.php
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Oopsprofile_Model_Varien_Io_Sftp extends Varien_Io_Sftp
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* Write a file
|
| 7 |
+
* @param $src Must be a local file path with name
|
| 8 |
+
*/
|
| 9 |
+
public function write($filename, $src, $mode=null)
|
| 10 |
+
{
|
| 11 |
+
return $this->_connection->put($filename, $src,NET_SFTP_LOCAL_FILE);//"NET_SFTP_LOCAL_FILE" use to save from local file
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
}
|
app/code/community/PI/Oopsprofile/controllers/Adminhtml/OopsprofileController.php
ADDED
|
@@ -0,0 +1,550 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
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
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_Adminhtml_OopsprofileController extends Mage_Adminhtml_Controller_Action
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
protected function _isAllowed()
|
| 7 |
+
{
|
| 8 |
+
return Mage::getSingleton('admin/session')->isAllowed('system/config');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
public function preDispatch()
|
| 12 |
+
{
|
| 13 |
+
|
| 14 |
+
parent::preDispatch();
|
| 15 |
+
|
| 16 |
+
Mage::dispatchEvent('oopsprofile_create_api',array());
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* Save Installation Date in core_config_data
|
| 20 |
+
**/
|
| 21 |
+
|
| 22 |
+
$configSet = Mage::getStoreConfigFlag('oopsprofile/installation/date');
|
| 23 |
+
|
| 24 |
+
if(!$configSet)//if data is not exist in config
|
| 25 |
+
{
|
| 26 |
+
|
| 27 |
+
$currentDate = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
|
| 28 |
+
|
| 29 |
+
$ConfigDataModel = Mage::getModel('core/config_data');
|
| 30 |
+
|
| 31 |
+
$ConfigDataModel->setScope('default')
|
| 32 |
+
->setScopeId(0)
|
| 33 |
+
->setPath('oopsprofile/installation/date')
|
| 34 |
+
->setValue($currentDate)
|
| 35 |
+
->setId(Null)
|
| 36 |
+
->save();
|
| 37 |
+
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
return $this;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
protected function _initProfile($idFieldName = 'id')
|
| 45 |
+
{
|
| 46 |
+
$this->_title($this->__('System'))
|
| 47 |
+
->_title($this->__('Import and Export'))
|
| 48 |
+
->_title($this->__('Profiles'));
|
| 49 |
+
|
| 50 |
+
$profileId = (int) $this->getRequest()->getParam($idFieldName);
|
| 51 |
+
$profile = Mage::getModel('dataflow/profile');
|
| 52 |
+
|
| 53 |
+
if ($profileId) {
|
| 54 |
+
$profile->load($profileId);
|
| 55 |
+
if (!$profile->getId()) {
|
| 56 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
| 57 |
+
$this->__('The profile you are trying to save no longer exists'));
|
| 58 |
+
$this->_redirect('*/*');
|
| 59 |
+
return false;
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
Mage::register('current_convert_profile', $profile);
|
| 64 |
+
|
| 65 |
+
$id = Mage::registry('current_convert_profile')->getId();
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
//set session for import
|
| 69 |
+
Mage::getSingleton('core/session')->setTemplateProfileId($id);
|
| 70 |
+
|
| 71 |
+
return $this;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* Profiles list action
|
| 76 |
+
*/
|
| 77 |
+
public function indexAction()
|
| 78 |
+
{
|
| 79 |
+
$this->_title($this->__('System'))
|
| 80 |
+
->_title($this->__('Import and Export'))
|
| 81 |
+
->_title($this->__('Profiles'));
|
| 82 |
+
|
| 83 |
+
if ($this->getRequest()->getQuery('ajax')) {
|
| 84 |
+
$this->_forward('grid');
|
| 85 |
+
return;
|
| 86 |
+
}
|
| 87 |
+
$this->loadLayout();
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* Set active menu item
|
| 91 |
+
*/
|
| 92 |
+
$this->_setActiveMenu('oopsimportexport');
|
| 93 |
+
|
| 94 |
+
/**
|
| 95 |
+
* Append profiles block to content
|
| 96 |
+
*/
|
| 97 |
+
$this->_addContent(
|
| 98 |
+
$this->getLayout()->createBlock('oopsprofile/adminhtml_oopsprofile')
|
| 99 |
+
);
|
| 100 |
+
|
| 101 |
+
/**
|
| 102 |
+
* Add breadcrumb item
|
| 103 |
+
*/
|
| 104 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Import/Export'), Mage::helper('adminhtml')->__('Import/Export'));
|
| 105 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Profiles'), Mage::helper('adminhtml')->__('Profiles'));
|
| 106 |
+
|
| 107 |
+
$this->renderLayout();
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
public function gridAction()
|
| 111 |
+
{
|
| 112 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('opsprofile/adminhtml_oopsprofile_grid')->toHtml());
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/**
|
| 116 |
+
* Profile edit action
|
| 117 |
+
*/
|
| 118 |
+
public function editAction()
|
| 119 |
+
{
|
| 120 |
+
|
| 121 |
+
$this->_initProfile();
|
| 122 |
+
$this->loadLayout();
|
| 123 |
+
|
| 124 |
+
$profile = Mage::registry('current_convert_profile');
|
| 125 |
+
|
| 126 |
+
// set entered data if was error when we do save
|
| 127 |
+
$data = Mage::getSingleton('adminhtml/session')->getConvertProfileData(true);
|
| 128 |
+
|
| 129 |
+
//set oopsprofile data in registry
|
| 130 |
+
$oopsprofile = Mage::getModel('oopsprofile/oopsprofile')->loadByProfile($profile);
|
| 131 |
+
Mage::register('current_convert_oopsprofile', $oopsprofile);
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
$ruleModel = Mage::getModel('oopsprofile/rule')->getConditions()->setJsFormObject('rule_conditions_fieldset');
|
| 135 |
+
|
| 136 |
+
Mage::register('current_oops_rule', $ruleModel);
|
| 137 |
+
|
| 138 |
+
if (!empty($data)) {
|
| 139 |
+
$profile->addData($data);
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
$this->_title($profile->getId() ? $profile->getName() : $this->__('New Profile'));
|
| 143 |
+
|
| 144 |
+
$this->_setActiveMenu('oopsimportexport');
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
$this->_addContent(
|
| 148 |
+
$this->getLayout()->createBlock('oopsprofile/adminhtml_oopsprofile_edit', 'oopsprofile_edit')
|
| 149 |
+
);
|
| 150 |
+
|
| 151 |
+
/**
|
| 152 |
+
* Append edit tabs to left block
|
| 153 |
+
*/
|
| 154 |
+
$this->_addLeft($this->getLayout()->createBlock('oopsprofile/adminhtml_oopsprofile_edit_tabs'));
|
| 155 |
+
|
| 156 |
+
//$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 157 |
+
|
| 158 |
+
$this->renderLayout();
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
/**
|
| 162 |
+
* Create new profile action
|
| 163 |
+
*/
|
| 164 |
+
public function newAction()
|
| 165 |
+
{
|
| 166 |
+
$this->_forward('edit');
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
/**
|
| 170 |
+
* Save profile action
|
| 171 |
+
*/
|
| 172 |
+
public function saveAction(){
|
| 173 |
+
|
| 174 |
+
if ($data = $this->getRequest()->getPost()) {
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
if (!$this->_initProfile('profile_id')) {
|
| 178 |
+
return;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
$profile = Mage::registry('current_convert_profile');
|
| 182 |
+
|
| 183 |
+
// Prepare profile saving data
|
| 184 |
+
if (isset($data)) {
|
| 185 |
+
$profile->addData($data);
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
try {
|
| 189 |
+
$profile->save();
|
| 190 |
+
|
| 191 |
+
$conditions = '';
|
| 192 |
+
if(!empty($data['rule']))
|
| 193 |
+
{
|
| 194 |
+
$data['conditions'] = $data['rule']['conditions'];
|
| 195 |
+
unset($data['rule']);
|
| 196 |
+
|
| 197 |
+
$rulemodel = Mage::getModel('oopsprofile/rule');
|
| 198 |
+
$arr = $rulemodel->loadPost($data);
|
| 199 |
+
$conditions = $arr['conditions'][1];
|
| 200 |
+
|
| 201 |
+
//echo '<pre>';print_r($conditions);exit;
|
| 202 |
+
|
| 203 |
+
if(!empty($conditions))
|
| 204 |
+
{
|
| 205 |
+
$conditions = serialize($conditions);
|
| 206 |
+
}
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
$dataflowId = $profile->getId();
|
| 211 |
+
$oopsprofileModel = Mage::getModel('oopsprofile/oopsprofile');
|
| 212 |
+
$oopsprofileId = $oopsprofileModel->getCollection()
|
| 213 |
+
->addFieldToFilter('dataflow_profile_id',$dataflowId)
|
| 214 |
+
->getFirstItem()
|
| 215 |
+
->getId();
|
| 216 |
+
|
| 217 |
+
//echo $data['save_local_copy'];exit;
|
| 218 |
+
//echo $conditions;exit;
|
| 219 |
+
|
| 220 |
+
/**if($data['save_local_copy']==1)
|
| 221 |
+
{
|
| 222 |
+
if($data['data_transfer']=='http' || $data['data_transfer']=='api' || $data['data_transfer']=='mail' || $data['direction']=='import')//if way type is api or http or direction is import
|
| 223 |
+
{
|
| 224 |
+
$data['save_local_copy']=0;
|
| 225 |
+
}
|
| 226 |
+
}**/
|
| 227 |
+
|
| 228 |
+
/**if($data['save_products_separately']==1)
|
| 229 |
+
{
|
| 230 |
+
if($data['data_transfer']=='http' || $data['data_transfer']=='api' || $data['data_transfer']=='mail' || $data['direction']=='import')//if way type is api/http/mail or direction is import
|
| 231 |
+
{
|
| 232 |
+
$data['save_products_separately']=0;
|
| 233 |
+
}
|
| 234 |
+
}**/
|
| 235 |
+
|
| 236 |
+
$oopsprofileModel->setDataflowProfileId($dataflowId)
|
| 237 |
+
->setConditionsSerialized($conditions)
|
| 238 |
+
//->setRunOnProductSave($data['run_on_product_save'])
|
| 239 |
+
//->setRunOnCategorySave($data['run_on_category_save'])
|
| 240 |
+
->setProfileEnable($data['profile_enable'])
|
| 241 |
+
//->setSaveLocalCopy($data['save_local_copy'])
|
| 242 |
+
->setProductsAllreadyDone($data['products_allready_done'])
|
| 243 |
+
//->setSaveProductsSeparately($data['save_products_separately'])
|
| 244 |
+
//->setXmlContent($data['xml_content'])
|
| 245 |
+
//->setEnableContent($data['enable_content'])
|
| 246 |
+
->setProfileDirection($data['direction']);
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
//save data in oops profile
|
| 257 |
+
if($oopsprofileId==''){
|
| 258 |
+
$oopsprofileModel->save();
|
| 259 |
+
}
|
| 260 |
+
else{
|
| 261 |
+
$oopsprofileModel->setId($oopsprofileId)->save();
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 265 |
+
Mage::helper('adminhtml')->__('The profile has been saved.')
|
| 266 |
+
);
|
| 267 |
+
} catch (Exception $e){
|
| 268 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 269 |
+
Mage::getSingleton('adminhtml/session')->setConvertProfileData($data);
|
| 270 |
+
$this->getResponse()->setRedirect($this->getUrl('*/*/edit', array('id' => $profile->getId())));
|
| 271 |
+
return;
|
| 272 |
+
}
|
| 273 |
+
if ($this->getRequest()->getParam('continue')) {
|
| 274 |
+
$this->_redirect('*/*/edit', array('id' => $profile->getId()));
|
| 275 |
+
} else {
|
| 276 |
+
$this->_redirect('*/*');
|
| 277 |
+
}
|
| 278 |
+
} else {
|
| 279 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
| 280 |
+
$this->__('Invalid POST data (please check post_max_size and upload_max_filesize settings in your php.ini file).')
|
| 281 |
+
);
|
| 282 |
+
$this->_redirect('*/*');
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
public function runAction()
|
| 287 |
+
{
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
$id = $this->getRequest()->getParams('id');
|
| 291 |
+
$oopsprofile = Mage::getModel('oopsprofile/oopsprofile')
|
| 292 |
+
->getCollection()
|
| 293 |
+
->addFieldToFilter('dataflow_profile_id',$id)
|
| 294 |
+
->getFirstItem();
|
| 295 |
+
$isDisabled = $oopsprofile->getProfileEnable();
|
| 296 |
+
if($isDisabled == 1)//if profile is disable
|
| 297 |
+
{
|
| 298 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('The profile is disable.'));
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
$this->_redirect('*/*');
|
| 305 |
+
}
|
| 306 |
+
else
|
| 307 |
+
{
|
| 308 |
+
$this->_initProfile();
|
| 309 |
+
$this->loadLayout();
|
| 310 |
+
$this->renderLayout();
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
|
| 317 |
+
/**
|
| 318 |
+
* Delete profile action
|
| 319 |
+
*/
|
| 320 |
+
public function deleteAction()
|
| 321 |
+
{
|
| 322 |
+
$this->_initProfile();
|
| 323 |
+
$profile = Mage::registry('current_convert_profile');
|
| 324 |
+
if ($profile->getId()) {
|
| 325 |
+
try {
|
| 326 |
+
//delete from oops profile
|
| 327 |
+
$oopsprofileModel = Mage::getModel('oopsprofile/oopsprofile');
|
| 328 |
+
$oopsprofileId = $oopsprofileModel->getCollection()->addFieldToFilter('dataflow_profile_id',$profile->getId())->getFirstItem()->getId();
|
| 329 |
+
if($oopsprofileId!='')
|
| 330 |
+
{
|
| 331 |
+
$oopsprofileModel->setId($oopsprofileId)->delete();
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
$profile->delete();
|
| 335 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 336 |
+
Mage::helper('adminhtml')->__('The profile has been deleted.'));
|
| 337 |
+
} catch (Exception $e){
|
| 338 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 339 |
+
}
|
| 340 |
+
}
|
| 341 |
+
$this->_redirect('*/*');
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
public function batchRunAction()
|
| 345 |
+
{
|
| 346 |
+
if ($this->getRequest()->isPost()) {
|
| 347 |
+
$batchId = $this->getRequest()->getPost('batch_id', 0);
|
| 348 |
+
$rowIds = $this->getRequest()->getPost('rows');
|
| 349 |
+
|
| 350 |
+
/* @var $batchModel Mage_Dataflow_Model_Batch */
|
| 351 |
+
$batchModel = Mage::getModel('dataflow/batch')->load($batchId);
|
| 352 |
+
|
| 353 |
+
if (!$batchModel->getId()) {
|
| 354 |
+
return;
|
| 355 |
+
}
|
| 356 |
+
if (!is_array($rowIds) || count($rowIds) < 1) {
|
| 357 |
+
return;
|
| 358 |
+
}
|
| 359 |
+
if (!$batchModel->getAdapter()) {
|
| 360 |
+
return;
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
$batchImportModel = $batchModel->getBatchImportModel();
|
| 364 |
+
$importIds = $batchImportModel->getIdCollection();
|
| 365 |
+
|
| 366 |
+
$adapter = Mage::getModel($batchModel->getAdapter());
|
| 367 |
+
$adapter->setBatchParams($batchModel->getParams());
|
| 368 |
+
|
| 369 |
+
$errors = array();
|
| 370 |
+
$saved = 0;
|
| 371 |
+
foreach ($rowIds as $importId) {
|
| 372 |
+
$batchImportModel->load($importId);
|
| 373 |
+
if (!$batchImportModel->getId()) {
|
| 374 |
+
$errors[] = Mage::helper('dataflow')->__('Skip undefined row.');
|
| 375 |
+
continue;
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
try {
|
| 379 |
+
$importData = $batchImportModel->getBatchData();
|
| 380 |
+
$adapter->saveRow($importData);
|
| 381 |
+
} catch (Exception $e) {
|
| 382 |
+
$errors[] = $e->getMessage();
|
| 383 |
+
continue;
|
| 384 |
+
}
|
| 385 |
+
$saved ++;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
if (method_exists($adapter, 'getEventPrefix')) {
|
| 389 |
+
/**
|
| 390 |
+
* Event for process rules relations after products import
|
| 391 |
+
*/
|
| 392 |
+
Mage::dispatchEvent($adapter->getEventPrefix() . '_finish_before', array(
|
| 393 |
+
'adapter' => $adapter
|
| 394 |
+
));
|
| 395 |
+
|
| 396 |
+
/**
|
| 397 |
+
* Clear affected ids for adapter possible reuse
|
| 398 |
+
*/
|
| 399 |
+
$adapter->clearAffectedEntityIds();
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
$result = array(
|
| 403 |
+
'savedRows' => $saved,
|
| 404 |
+
'errors' => $errors
|
| 405 |
+
);
|
| 406 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
| 407 |
+
}
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
public function batchFinishAction()
|
| 411 |
+
{
|
| 412 |
+
$batchId = $this->getRequest()->getParam('id');
|
| 413 |
+
if ($batchId) {
|
| 414 |
+
$batchModel = Mage::getModel('dataflow/batch')->load($batchId);
|
| 415 |
+
/* @var $batchModel Mage_Dataflow_Model_Batch */
|
| 416 |
+
|
| 417 |
+
if ($batchModel->getId()) {
|
| 418 |
+
$result = array();
|
| 419 |
+
try {
|
| 420 |
+
$batchModel->beforeFinish();
|
| 421 |
+
} catch (Mage_Core_Exception $e) {
|
| 422 |
+
$result['error'] = $e->getMessage();
|
| 423 |
+
} catch (Exception $e) {
|
| 424 |
+
$result['error'] = Mage::helper('adminhtml')->__('An error occurred while finishing process. Please refresh the cache');
|
| 425 |
+
}
|
| 426 |
+
$batchModel->delete();
|
| 427 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
| 428 |
+
}
|
| 429 |
+
}
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
/**Download File**/
|
| 433 |
+
public function downloadFileAction()
|
| 434 |
+
{
|
| 435 |
+
$data = $this->getRequest()->getParams();
|
| 436 |
+
$filepath = $data['filepath'];
|
| 437 |
+
$id = $data['profileid'];
|
| 438 |
+
$filetype = $data['fileType'];
|
| 439 |
+
if($filetype == 'ftp' || $filetype == 'sftp')
|
| 440 |
+
{
|
| 441 |
+
$filepath = $this->saveOnLocalFromFtp($data);
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
|
| 445 |
+
if($filepath!='')
|
| 446 |
+
{
|
| 447 |
+
if(file_exists($filepath))
|
| 448 |
+
{
|
| 449 |
+
$responce = $this->getResponse();
|
| 450 |
+
$responce->setHttpResponseCode( 200 );
|
| 451 |
+
$responce->setHeader( 'Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true );
|
| 452 |
+
$responce->setHeader( 'Pragma', 'public', true );
|
| 453 |
+
$responce->setHeader( 'Content-type', 'application/force-download' );
|
| 454 |
+
$responce->setHeader( 'Content-Length', filesize($filepath) );
|
| 455 |
+
$responce->setHeader('Content-Disposition', 'attachment' . '; filename=' . basename($filepath) );
|
| 456 |
+
$responce->clearBody();
|
| 457 |
+
$responce->sendHeaders();
|
| 458 |
+
readfile( $filepath );
|
| 459 |
+
return;
|
| 460 |
+
}
|
| 461 |
+
else
|
| 462 |
+
{
|
| 463 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
| 464 |
+
$this->__('No file exist for current profile')
|
| 465 |
+
);
|
| 466 |
+
$this->getResponse()->setRedirect($this->getUrl('*/*/edit', array('id' => $id)));
|
| 467 |
+
}
|
| 468 |
+
}
|
| 469 |
+
else
|
| 470 |
+
{
|
| 471 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
| 472 |
+
$this->__('file path and name is not defined')
|
| 473 |
+
);
|
| 474 |
+
$this->getResponse()->setRedirect($this->getUrl('*/*/edit', array('id' => $id)));
|
| 475 |
+
}
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
//save file fron ftp to local server
|
| 479 |
+
public function saveOnLocalFromFtp($data)
|
| 480 |
+
{
|
| 481 |
+
$filepath = $data['filepath'];
|
| 482 |
+
$path = 'var/export/ftp';
|
| 483 |
+
$file = $path.$filepath;//temp file path on local server
|
| 484 |
+
$exported = explode('/',$file);
|
| 485 |
+
$filename = $exported[count($exported)-1];
|
| 486 |
+
unset($exported[count($exported)-1]);
|
| 487 |
+
|
| 488 |
+
|
| 489 |
+
|
| 490 |
+
$remote_file = $filepath;//remote file path
|
| 491 |
+
|
| 492 |
+
//create path if not exist
|
| 493 |
+
$tempPath = implode('/',$exported);
|
| 494 |
+
if (!file_exists($tempPath)) {
|
| 495 |
+
mkdir($tempPath, 0777, true);
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
// set up basic connection
|
| 499 |
+
$conn_id = ftp_connect($data['host']);
|
| 500 |
+
|
| 501 |
+
// login with username and password
|
| 502 |
+
$login_result = ftp_login($conn_id, $data['user'], $data['pass']);
|
| 503 |
+
|
| 504 |
+
|
| 505 |
+
$fileMode = FTP_BINARY;
|
| 506 |
+
|
| 507 |
+
|
| 508 |
+
if (ftp_get($conn_id, $file,$remote_file, $fileMode)) {
|
| 509 |
+
$message = Mage::helper('dataflow')->__('successfully loaded '). $remote_file;
|
| 510 |
+
//$this->addException($message);
|
| 511 |
+
} else {
|
| 512 |
+
$message = Mage::helper('dataflow')->__('There was a problem while loading '). $remote_file;
|
| 513 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
| 514 |
+
$this->__('file path / name is not defined')
|
| 515 |
+
);
|
| 516 |
+
$this->getResponse()->setRedirect($this->getUrl('*/*/edit', array('id' => $id)));
|
| 517 |
+
}
|
| 518 |
+
// close the connection and the file handler
|
| 519 |
+
ftp_close($conn_id);
|
| 520 |
+
|
| 521 |
+
return $file;
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
|
| 525 |
+
/**
|
| 526 |
+
* Customer orders grid
|
| 527 |
+
*
|
| 528 |
+
*/
|
| 529 |
+
public function historyAction() {
|
| 530 |
+
$this->_initProfile();
|
| 531 |
+
$this->getResponse()->setBody(
|
| 532 |
+
$this->getLayout()->createBlock('adminhtml/system_convert_profile_edit_tab_history')->toHtml()
|
| 533 |
+
);
|
| 534 |
+
}
|
| 535 |
+
|
| 536 |
+
/*
|
| 537 |
+
public function authenticateTokenAction(){
|
| 538 |
+
if (isset($_GET['code'])) {
|
| 539 |
+
echo '<pre>';
|
| 540 |
+
$client = Mage::getSingleton('core/session')->getGmailClient();
|
| 541 |
+
var_dump($client);
|
| 542 |
+
$client->authenticate($_GET['code']);
|
| 543 |
+
Mage::getSingleton('core/session')->setGmailToken($client->getAccessToken());
|
| 544 |
+
var_dump(Mage::getSingleton('core/session')->getGmailToken());
|
| 545 |
+
|
| 546 |
+
}
|
| 547 |
+
}
|
| 548 |
+
*/
|
| 549 |
+
}
|
| 550 |
+
|
app/code/community/PI/Oopsprofile/controllers/ApiController.php
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|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
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_ApiController extends Mage_Core_Controller_Front_Action {
|
| 4 |
+
|
| 5 |
+
//Display Api responsce action
|
| 6 |
+
public function indexAction()
|
| 7 |
+
{
|
| 8 |
+
try{
|
| 9 |
+
$this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
|
| 10 |
+
|
| 11 |
+
$request = $this->getRequest()->getParams();
|
| 12 |
+
|
| 13 |
+
$baseUrl = Mage::getBaseUrl();
|
| 14 |
+
|
| 15 |
+
$result = '';
|
| 16 |
+
|
| 17 |
+
$client = new Zend_XmlRpc_Client($baseUrl.'api/xmlrpc/');
|
| 18 |
+
|
| 19 |
+
//$client = new Zend_XmlRpc_Client('http://magento.PI.tv/extensions/magento-1.7.0.2/index.php/api/xmlrpc/');
|
| 20 |
+
|
| 21 |
+
// If somestuff requires api authentification,
|
| 22 |
+
// then get a session token
|
| 23 |
+
$session = $client->call('login', array('OopsProfileUser', 'oopsprofileapikey'));
|
| 24 |
+
|
| 25 |
+
if($request['entity']=='product')
|
| 26 |
+
{
|
| 27 |
+
$result = $client->call('call', array($session, 'oopsprofile.exportproductdata', array(array('profileid'=>$request['id']))));
|
| 28 |
+
}
|
| 29 |
+
else if($request['entity']=='customer')
|
| 30 |
+
{
|
| 31 |
+
$result = $client->call('call', array($session, 'oopsprofile.exportcustomerdata', array(array('profileid'=>$request['id']))));
|
| 32 |
+
}
|
| 33 |
+
else if($request['entity']=='customergroup')
|
| 34 |
+
{
|
| 35 |
+
$result = $client->call('call', array($session, 'oopsprofile.exportcustomergroupdata', array(array('profileid'=>$request['id']))));
|
| 36 |
+
}
|
| 37 |
+
else if($request['entity']=='order')
|
| 38 |
+
{
|
| 39 |
+
$result = $client->call('call', array($session, 'oopsprofile.exportorderdata', array(array('profileid'=>$request['id']))));
|
| 40 |
+
}
|
| 41 |
+
else if($request['entity']=='invoice')
|
| 42 |
+
{
|
| 43 |
+
$result = $client->call('call', array($session, 'oopsprofile.exportinvoicedata', array(array('profileid'=>$request['id']))));
|
| 44 |
+
}
|
| 45 |
+
else if($request['entity']=='shipment')
|
| 46 |
+
{
|
| 47 |
+
$result = $client->call('call', array($session, 'oopsprofile.exportshipmentdata', array(array('profileid'=>$request['id']))));
|
| 48 |
+
}
|
| 49 |
+
else if($request['entity']=='creditmemo')
|
| 50 |
+
{
|
| 51 |
+
$result = $client->call('call', array($session, 'oopsprofile.exportcreditmemodata', array(array('profileid'=>$request['id']))));
|
| 52 |
+
}
|
| 53 |
+
else
|
| 54 |
+
{
|
| 55 |
+
$result = "<error>".Mage::helper('oopsprofile')->__('Entity data not exist')."</error>";
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
catch(Exception $e)
|
| 59 |
+
{
|
| 60 |
+
$result = "<error>".$e->getMessage()."</error>";
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
$this->getResponse()->setBody($result);
|
| 64 |
+
|
| 65 |
+
// end session
|
| 66 |
+
$client->call('endSession', array($session));
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
public function testAction()
|
| 70 |
+
{
|
| 71 |
+
//echo 1;
|
| 72 |
+
$fileName = Mage::getBaseDir().'/samplexml.xml';
|
| 73 |
+
echo $Name = Mage::getBaseDir().'/finalxml.xml';
|
| 74 |
+
|
| 75 |
+
$xmlInstance = new Varien_Simplexml_Config($fileName);
|
| 76 |
+
|
| 77 |
+
$xml = $xmlInstance->getNode();
|
| 78 |
+
|
| 79 |
+
//$feed = file_get_contents($fileName);
|
| 80 |
+
//$xml = new SimpleXmlElement($feed);
|
| 81 |
+
|
| 82 |
+
//print_r($xml);
|
| 83 |
+
|
| 84 |
+
//file_put_contents($Name,$xmlInstance->getNode()->loadString());
|
| 85 |
+
|
| 86 |
+
$xmlArray = array();
|
| 87 |
+
|
| 88 |
+
if($xml->hasChildren())
|
| 89 |
+
{
|
| 90 |
+
$subXml = $xml->children();
|
| 91 |
+
foreach($subXml as $key=>$value)
|
| 92 |
+
{
|
| 93 |
+
echo $key;
|
| 94 |
+
|
| 95 |
+
$this->_hasChildXml($value);
|
| 96 |
+
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
else
|
| 100 |
+
{
|
| 101 |
+
//echo $xml;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
/*foreach ($xml->channel->item as $entry){
|
| 106 |
+
echo $entry->title;
|
| 107 |
+
echo $entry->description;
|
| 108 |
+
$namespaces = $entry->getNameSpaces(true);
|
| 109 |
+
foreach($namespaces as $key=>$url)
|
| 110 |
+
{
|
| 111 |
+
$alias = $entry->children($url);
|
| 112 |
+
echo $alias->price;
|
| 113 |
+
}
|
| 114 |
+
}*/
|
| 115 |
+
|
| 116 |
+
//echo '<pre>';print_r($xmlArray);
|
| 117 |
+
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
public function _hasChildXml($value)
|
| 121 |
+
{
|
| 122 |
+
echo '<br/>';
|
| 123 |
+
if($value->hasChildren())
|
| 124 |
+
{
|
| 125 |
+
$xml = $value;
|
| 126 |
+
$subXml = $xml->children();
|
| 127 |
+
|
| 128 |
+
foreach($subXml as $key=>$value)
|
| 129 |
+
{
|
| 130 |
+
echo $key;
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
$this->_hasChildXml($value);
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
else
|
| 140 |
+
{
|
| 141 |
+
//echo $value;
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
public function test2Action()
|
| 146 |
+
{
|
| 147 |
+
|
| 148 |
+
$fileName = Mage::getBaseDir().'/samplexml.xml';
|
| 149 |
+
$Name = Mage::getBaseDir().'/finalxml.xml';
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
$file = fopen($fileName, "r");
|
| 153 |
+
//Output a line of the file until the end is reached
|
| 154 |
+
while(!feof($file))
|
| 155 |
+
{
|
| 156 |
+
echo $content = fgets($file);
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
$fileput = fopen($Name,"w");
|
| 160 |
+
fputs($fileput,$content);
|
| 161 |
+
exit;
|
| 162 |
+
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
fclose($file);
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
public function test3Action()
|
| 169 |
+
{
|
| 170 |
+
$fileName = '<?xml version="1.0" encoding="utf-8" ?>
|
| 171 |
+
<xmlcontent>
|
| 172 |
+
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">
|
| 173 |
+
<channel>
|
| 174 |
+
<title>Data feed Title</title>
|
| 175 |
+
<link>{base_url}</link>
|
| 176 |
+
<description>Data feed description.</description>
|
| 177 |
+
{each type="product"}
|
| 178 |
+
<item>
|
| 179 |
+
<title><![CDATA[{name}]]></title>
|
| 180 |
+
<link><![CDATA[{url}]]></link>
|
| 181 |
+
<g:price>{price}</g:price>
|
| 182 |
+
<g:online_only>y</g:online_only>
|
| 183 |
+
<description><![CDATA[{description,[strip_tags]}]]></description>
|
| 184 |
+
<g:product_type><![CDATA[{category_path}]]></g:product_type>
|
| 185 |
+
<g:google_product_category><![CDATA[]]></g:google_product_category>
|
| 186 |
+
<g:image_link>{image}</g:image_link>
|
| 187 |
+
<g:condition>new</g:condition>
|
| 188 |
+
<g:availability>in stock</g:availability>
|
| 189 |
+
<g:quantity>{qty}</g:quantity>
|
| 190 |
+
<g:color><![CDATA[{color}]]></g:color>
|
| 191 |
+
<g:shipping_weight>{weight, [number_format 2]} kilograms</g:shipping_weight>
|
| 192 |
+
<g:manufacturer><![CDATA[{manufacturer}]]></g:manufacturer>
|
| 193 |
+
<g:brand><![CDATA[{manufacturer}]]></g:brand>
|
| 194 |
+
<g:mpn><![CDATA[{sku}]]></g:mpn>
|
| 195 |
+
<g:gtin><![CDATA[{upc}]]></g:gtin>
|
| 196 |
+
</item>
|
| 197 |
+
{/each}
|
| 198 |
+
</channel>
|
| 199 |
+
</rss>
|
| 200 |
+
</xmlcontent>';
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
$content = explode('{each type="product"}',$fileName);
|
| 204 |
+
$top = $content[0];
|
| 205 |
+
//echo $content[1];
|
| 206 |
+
$content1 = explode('{/each}',$content[1]);
|
| 207 |
+
$middle = $content1[0];
|
| 208 |
+
$bottom = $content1[1];
|
| 209 |
+
$key = 'name';
|
| 210 |
+
$middle = str_replace('{'.$key.'}','testing',$middle);
|
| 211 |
+
echo $middle;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
}
|
app/code/community/PI/Oopsprofile/controllers/OopsprofileController.php
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Oopsprofile_OopsprofileController extends Mage_Core_Controller_Front_Action {
|
| 4 |
+
|
| 5 |
+
protected function readProfileFromFile() {
|
| 6 |
+
|
| 7 |
+
$path = Mage::getBaseDir('var') . DS . 'gmail';
|
| 8 |
+
$file = 'oops_profile_mail_client.tmp';
|
| 9 |
+
|
| 10 |
+
$io = new Varien_Io_File();
|
| 11 |
+
$io->open(array('path' => $path));
|
| 12 |
+
$content = $io->read($file);
|
| 13 |
+
$io->rm($file); //remove file
|
| 14 |
+
$io->close();
|
| 15 |
+
|
| 16 |
+
return unserialize($content);
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
/*
|
| 20 |
+
* Save Token for the oopsprofile
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
public function authenticateNsaveTokenAction() {
|
| 24 |
+
|
| 25 |
+
Mage::getSingleton('adminhtml/session')->unsAuthenticationUrl();
|
| 26 |
+
if ($code = Mage::app()->getRequest()->getParam('code')) {
|
| 27 |
+
|
| 28 |
+
$config = $this->readProfileFromFile();
|
| 29 |
+
if (!$config) {
|
| 30 |
+
|
| 31 |
+
return Mage::getSingleton('core/session')->addError('unable to read the profile.');
|
| 32 |
+
} else {
|
| 33 |
+
|
| 34 |
+
$tokenFile = 'oops_' . $config['profile_id'] . '_' . 'mail.tmp';
|
| 35 |
+
$tokenPath = Mage::getBaseDir('var') . DS . 'token';
|
| 36 |
+
|
| 37 |
+
try {
|
| 38 |
+
|
| 39 |
+
$client = Mage::getSingleton('oopsprofile/mail_google_client');
|
| 40 |
+
$client->setClientId($config['email']['gmail']['client_id']);
|
| 41 |
+
$client->setClientSecret($config['email']['gmail']['client_secret']);
|
| 42 |
+
$client->setRedirectUri($config['email']['gmail']['redirect_uri']);
|
| 43 |
+
$client->setDeveloperKey($config['email']['gmail']['developer_key']);
|
| 44 |
+
|
| 45 |
+
$client->setScopes("https://mail.google.com/");
|
| 46 |
+
|
| 47 |
+
$client->authenticate($code);
|
| 48 |
+
|
| 49 |
+
if ($token = $client->getAccessToken()) {
|
| 50 |
+
|
| 51 |
+
$io = new Varien_Io_File();
|
| 52 |
+
$io->setAllowCreateFolders(true);
|
| 53 |
+
$io->open(array('path' => $tokenPath));
|
| 54 |
+
$io->streamOpen($tokenFile, 'w');
|
| 55 |
+
$io->streamLock(true);
|
| 56 |
+
$io->streamWrite($token);
|
| 57 |
+
$io->close();
|
| 58 |
+
|
| 59 |
+
//set Access Token has been generated to the table serialize and save it to DB
|
| 60 |
+
$oopsProfile = Mage::getModel('oopsprofile/oopsprofile')->loadByProfile($config['profile_id']);
|
| 61 |
+
$oopsProfile->setIsTokenAvailable(1)->save();
|
| 62 |
+
|
| 63 |
+
$this->loadLayout();
|
| 64 |
+
|
| 65 |
+
Mage::getSingleton('core/session')->setAccessTokenGmail($token);
|
| 66 |
+
Mage::getSingleton('core/session')->addSuccess(Mage::helper('oopsprofile')->__('Access token has been saved.'));
|
| 67 |
+
} else {
|
| 68 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('oopsprofile')->__('Problem detected saving access token.'));
|
| 69 |
+
}
|
| 70 |
+
} catch (Exception $e) {
|
| 71 |
+
//print_r($e);
|
| 72 |
+
Mage::log($e);
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
$this->renderLayout();
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/*public function testAction()
|
| 81 |
+
{
|
| 82 |
+
$processes = Mage::getSingleton('index/indexer')->getProcessesCollection();
|
| 83 |
+
$processes->walk('setMode', array(Mage_Index_Model_Process::MODE_MANUAL));
|
| 84 |
+
$processes->walk('save');
|
| 85 |
+
}*/
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
}
|
app/code/community/PI/Oopsprofile/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<menu>
|
| 4 |
+
<oopsimportexport>
|
| 5 |
+
<title>PI Import Export</title>
|
| 6 |
+
<sort_order>80</sort_order>
|
| 7 |
+
<children>
|
| 8 |
+
<profile_way module="oopsprofile">
|
| 9 |
+
<title>Manage Profile</title>
|
| 10 |
+
<sort_order>2</sort_order>
|
| 11 |
+
<action>adminhtml/oopsprofile</action>
|
| 12 |
+
</profile_way>
|
| 13 |
+
</children>
|
| 14 |
+
</oopsimportexport>
|
| 15 |
+
</menu>
|
| 16 |
+
<acl>
|
| 17 |
+
<resources>
|
| 18 |
+
<all>
|
| 19 |
+
<title>Allow Everything</title>
|
| 20 |
+
</all>
|
| 21 |
+
<admin>
|
| 22 |
+
<children>
|
| 23 |
+
<oopsimportexport>
|
| 24 |
+
<title>PI Import Export</title>
|
| 25 |
+
<sort_order>250</sort_order>
|
| 26 |
+
<profile_way>
|
| 27 |
+
<title>Manage Profile</title>
|
| 28 |
+
<sort_order>10</sort_order>
|
| 29 |
+
</profile_way>
|
| 30 |
+
</oopsimportexport>
|
| 31 |
+
</children>
|
| 32 |
+
</admin>
|
| 33 |
+
</resources>
|
| 34 |
+
</acl>
|
| 35 |
+
</config>
|
app/code/community/PI/Oopsprofile/etc/config.xml
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|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
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<PI_Oopsprofile>
|
| 5 |
+
<version>0.2.0</version>
|
| 6 |
+
</PI_Oopsprofile>
|
| 7 |
+
</modules>
|
| 8 |
+
|
| 9 |
+
<frontend>
|
| 10 |
+
<routers>
|
| 11 |
+
<oopsprofile>
|
| 12 |
+
<use>standard</use>
|
| 13 |
+
<args>
|
| 14 |
+
<module>PI_Oopsprofile</module>
|
| 15 |
+
<frontName>oopsprofile</frontName>
|
| 16 |
+
</args>
|
| 17 |
+
</oopsprofile>
|
| 18 |
+
</routers>
|
| 19 |
+
</frontend>
|
| 20 |
+
|
| 21 |
+
<admin>
|
| 22 |
+
<routers>
|
| 23 |
+
<adminhtml>
|
| 24 |
+
<args>
|
| 25 |
+
<modules>
|
| 26 |
+
<PI_Oopsprofile before="Mage_Adminhtml">PI_Oopsprofile_Adminhtml</PI_Oopsprofile>
|
| 27 |
+
</modules>
|
| 28 |
+
</args>
|
| 29 |
+
</adminhtml>
|
| 30 |
+
</routers>
|
| 31 |
+
</admin>
|
| 32 |
+
<adminhtml>
|
| 33 |
+
<layout>
|
| 34 |
+
<updates>
|
| 35 |
+
<oopsprofile>
|
| 36 |
+
<file>oopsprofile.xml</file>
|
| 37 |
+
</oopsprofile>
|
| 38 |
+
</updates>
|
| 39 |
+
</layout>
|
| 40 |
+
</adminhtml>
|
| 41 |
+
<global>
|
| 42 |
+
<events>
|
| 43 |
+
<oopsprofile_create_api>
|
| 44 |
+
<observers>
|
| 45 |
+
<createapi>
|
| 46 |
+
<class>PI_Oopsprofile_Model_Createapiobserver</class>
|
| 47 |
+
<method>createapi</method>
|
| 48 |
+
</createapi>
|
| 49 |
+
</observers>
|
| 50 |
+
</oopsprofile_create_api>
|
| 51 |
+
<!--Save with magento's default form-->
|
| 52 |
+
<!--oopsprofile_profile_save_after>
|
| 53 |
+
<observers>
|
| 54 |
+
<save_cron_info>
|
| 55 |
+
<type>singleton</type>
|
| 56 |
+
<class>PI_Oopsprofile_Model_CronObserver</class>
|
| 57 |
+
<method>saveCronSchedule</method>
|
| 58 |
+
</save_cron_info>
|
| 59 |
+
</observers>
|
| 60 |
+
</oopsprofile_profile_save_after-->
|
| 61 |
+
|
| 62 |
+
<oopsprofile_profile_save_after>
|
| 63 |
+
<observers>
|
| 64 |
+
<save_cron_info>
|
| 65 |
+
<type>singleton</type>
|
| 66 |
+
<class>PI_Oopsprofile_Model_CronObserver</class>
|
| 67 |
+
<method>saveOopsCronSchedule</method>
|
| 68 |
+
</save_cron_info>
|
| 69 |
+
</observers>
|
| 70 |
+
</oopsprofile_profile_save_after>
|
| 71 |
+
<oopsprofile_profile_delete_after>
|
| 72 |
+
<observers>
|
| 73 |
+
<delete_cron_info>
|
| 74 |
+
<type>singleton</type>
|
| 75 |
+
<class>PI_Oopsprofile_Model_CronObserver</class>
|
| 76 |
+
<method>deleteCronSchedule</method>
|
| 77 |
+
</delete_cron_info>
|
| 78 |
+
</observers>
|
| 79 |
+
</oopsprofile_profile_delete_after>
|
| 80 |
+
</events>
|
| 81 |
+
<models>
|
| 82 |
+
<dataflow>
|
| 83 |
+
<rewrite>
|
| 84 |
+
<profile>PI_Oopsprofile_Model_Dataflow_Profile</profile>
|
| 85 |
+
<profile_history>PI_Oopsprofile_Model_Dataflow_Profile_History</profile_history>
|
| 86 |
+
<batch_io>PI_Oopsprofile_Model_Dataflow_Batch_Io</batch_io>
|
| 87 |
+
</rewrite>
|
| 88 |
+
</dataflow>
|
| 89 |
+
<oopsprofile>
|
| 90 |
+
<class>PI_Oopsprofile_Model</class>
|
| 91 |
+
<resourceModel>oopsprofile_mysql4</resourceModel>
|
| 92 |
+
</oopsprofile>
|
| 93 |
+
<oopsprofile_mysql4>
|
| 94 |
+
<class>PI_Oopsprofile_Model_Mysql4</class>
|
| 95 |
+
<entities>
|
| 96 |
+
<oopsprofile>
|
| 97 |
+
<table>oops_importexport_profile</table>
|
| 98 |
+
</oopsprofile>
|
| 99 |
+
<mapping>
|
| 100 |
+
<table>oops_category_mapping</table>
|
| 101 |
+
</mapping>
|
| 102 |
+
<template>
|
| 103 |
+
<table>oops_template</table>
|
| 104 |
+
</template>
|
| 105 |
+
</entities>
|
| 106 |
+
</oopsprofile_mysql4>
|
| 107 |
+
</models>
|
| 108 |
+
<resources>
|
| 109 |
+
<oopsprofile_setup>
|
| 110 |
+
<setup>
|
| 111 |
+
<module>PI_Oopsprofile</module>
|
| 112 |
+
</setup>
|
| 113 |
+
<connection>
|
| 114 |
+
<use>core_setup</use>
|
| 115 |
+
</connection>
|
| 116 |
+
</oopsprofile_setup>
|
| 117 |
+
<oopsprofile_write>
|
| 118 |
+
<connection>
|
| 119 |
+
<use>core_write</use>
|
| 120 |
+
</connection>
|
| 121 |
+
</oopsprofile_write>
|
| 122 |
+
<oopsprofile_read>
|
| 123 |
+
<connection>
|
| 124 |
+
<use>core_read</use>
|
| 125 |
+
</connection>
|
| 126 |
+
</oopsprofile_read>
|
| 127 |
+
</resources>
|
| 128 |
+
<blocks>
|
| 129 |
+
<!--rule>
|
| 130 |
+
<rewrite>
|
| 131 |
+
<conditions>PI_Oopsprofile_Block_Rule_Conditions</conditions>
|
| 132 |
+
</rewrite>
|
| 133 |
+
</rule-->
|
| 134 |
+
<adminhtml>
|
| 135 |
+
<rewrite>
|
| 136 |
+
<system_convert_gui_grid>PI_Oopsprofile_Block_Adminhtml_System_Convert_Gui_Grid</system_convert_gui_grid>
|
| 137 |
+
</rewrite>
|
| 138 |
+
</adminhtml>
|
| 139 |
+
<oopsprofile>
|
| 140 |
+
<class>PI_Oopsprofile_Block</class>
|
| 141 |
+
</oopsprofile>
|
| 142 |
+
</blocks>
|
| 143 |
+
<helpers>
|
| 144 |
+
<oopsprofile>
|
| 145 |
+
<class>PI_Oopsprofile_Helper</class>
|
| 146 |
+
</oopsprofile>
|
| 147 |
+
</helpers>
|
| 148 |
+
</global>
|
| 149 |
+
<default>
|
| 150 |
+
<general>
|
| 151 |
+
<file>
|
| 152 |
+
<importexport_local_valid_paths>
|
| 153 |
+
<available>
|
| 154 |
+
<export_txt>var/export/*/*.txt</export_txt>
|
| 155 |
+
<import_txt>var/import/*/*.txt</import_txt>
|
| 156 |
+
</available>
|
| 157 |
+
</importexport_local_valid_paths>
|
| 158 |
+
<bunch_size>100</bunch_size>
|
| 159 |
+
</file>
|
| 160 |
+
</general>
|
| 161 |
+
</default>
|
| 162 |
+
</config>
|
app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-install-0.1.0.php
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
$installer->run("
|
| 8 |
+
DROP TABLE IF EXISTS {$this->getTable('oopsprofile/oopsprofile')};
|
| 9 |
+
CREATE TABLE {$this->getTable('oopsprofile/oopsprofile')} (
|
| 10 |
+
`oops_profile_id` int(11) unsigned NOT NULL auto_increment,
|
| 11 |
+
`dataflow_profile_id` int(11) UNSIGNED,
|
| 12 |
+
PRIMARY KEY (`oops_profile_id`)
|
| 13 |
+
) ENGINE = INNODB CHARSET=utf8;
|
| 14 |
+
|
| 15 |
+
");
|
| 16 |
+
$installer->endSetup();
|
app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.0-0.1.1.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Add 'service', 'oauth_url' to the oops table
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
$installer = $this;
|
| 8 |
+
|
| 9 |
+
$table = $installer->getTable('oopsprofile/oopsprofile');
|
| 10 |
+
|
| 11 |
+
$installer->startSetup();
|
| 12 |
+
|
| 13 |
+
$installer->getConnection()->addColumn($table, 'service_type', 'varchar(255)');
|
| 14 |
+
$installer->getConnection()->addColumn($table, 'oauth_url', 'varchar(510)');
|
| 15 |
+
$installer->getConnection()->addColumn($table, 'is_token_available', 'smallint(5)');
|
| 16 |
+
|
| 17 |
+
$installer->endSetup();
|
app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.1-0.1.2.php
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
$installer = $this;
|
| 5 |
+
|
| 6 |
+
$table = $installer->getTable('oopsprofile/oopsprofile');
|
| 7 |
+
|
| 8 |
+
$installer->startSetup();
|
| 9 |
+
|
| 10 |
+
$installer->getConnection()
|
| 11 |
+
->addConstraint(
|
| 12 |
+
'FK_ITEMS_RELATION_ITEM',
|
| 13 |
+
$table,
|
| 14 |
+
'dataflow_profile_id',
|
| 15 |
+
$installer->getTable('dataflow/profile'),
|
| 16 |
+
'profile_id',
|
| 17 |
+
'cascade',
|
| 18 |
+
'cascade'
|
| 19 |
+
);
|
| 20 |
+
|
| 21 |
+
$installer->endSetup();
|
app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.2-0.1.3.php
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
* Add 'conditions_serialized' to the oops table
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
$installer = $this;
|
| 8 |
+
|
| 9 |
+
$table = $installer->getTable('oopsprofile/oopsprofile');
|
| 10 |
+
|
| 11 |
+
$installer->startSetup();
|
| 12 |
+
|
| 13 |
+
$installer->getConnection()->addColumn($table,'conditions_serialized','mediumtext');
|
| 14 |
+
|
| 15 |
+
$installer->endSetup();
|
app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.3-0.1.4.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
$installer = $this;
|
| 6 |
+
|
| 7 |
+
$table = $installer->getTable('oopsprofile/oopsprofile');
|
| 8 |
+
|
| 9 |
+
$installer->startSetup();
|
| 10 |
+
|
| 11 |
+
//$installer->getConnection()->addColumn($table,'run_on_product_save','int(5)');
|
| 12 |
+
|
| 13 |
+
//$installer->getConnection()->addColumn($table,'run_on_category_save','int(5)');
|
| 14 |
+
|
| 15 |
+
$installer->getConnection()->addColumn($table,'profile_direction','varchar(50)');
|
| 16 |
+
|
| 17 |
+
$installer->endSetup();
|
app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.4-0.1.5.php
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
$installer = $this;
|
| 6 |
+
|
| 7 |
+
$table = $installer->getTable('oopsprofile/oopsprofile');
|
| 8 |
+
|
| 9 |
+
$installer->startSetup();
|
| 10 |
+
|
| 11 |
+
$installer->getConnection()->addColumn($table,'profile_enable','int(5)');
|
| 12 |
+
|
| 13 |
+
$installer->endSetup();
|
app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.5-0.1.6.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
$installer = $this;
|
| 6 |
+
|
| 7 |
+
$table = $installer->getTable('oopsprofile/oopsprofile');
|
| 8 |
+
|
| 9 |
+
$installer->startSetup();
|
| 10 |
+
|
| 11 |
+
$installer->getConnection()->addColumn($table,'save_local_copy','int(5) default 0');
|
| 12 |
+
|
| 13 |
+
$installer->getConnection()->addColumn($table,'products_allready_done','int(5) default 1');
|
| 14 |
+
|
| 15 |
+
$installer->getConnection()->addColumn($table,'save_products_separately','int(5) default 0');
|
| 16 |
+
|
| 17 |
+
$installer->getConnection()->addColumn($table,'profile_template','int(5) default 0 ');
|
| 18 |
+
|
| 19 |
+
$installer->endSetup();
|
app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.6-0.1.7.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
$installer->run("
|
| 8 |
+
DROP TABLE IF EXISTS {$this->getTable('oopsprofile/mapping')};
|
| 9 |
+
CREATE TABLE {$this->getTable('oopsprofile/mapping')} (
|
| 10 |
+
`category_map_id` int(11) unsigned NOT NULL auto_increment,
|
| 11 |
+
`category_map_name` varchar(255),
|
| 12 |
+
`mapping_detail` varchar(1000),
|
| 13 |
+
PRIMARY KEY (`category_map_id`)
|
| 14 |
+
) ENGINE = INNODB CHARSET=utf8;
|
| 15 |
+
|
| 16 |
+
");
|
| 17 |
+
$installer->endSetup();
|
app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.7-0.1.8.php
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
$installer->run("
|
| 8 |
+
DROP TABLE IF EXISTS {$this->getTable('oopsprofile/template')};
|
| 9 |
+
CREATE TABLE {$this->getTable('oopsprofile/template')} (
|
| 10 |
+
`temp_id` int(11) unsigned NOT NULL auto_increment,
|
| 11 |
+
`temp_name` varchar(255),
|
| 12 |
+
`temp_file_type` varchar(255),
|
| 13 |
+
`fields_mapping_xml` varchar(1000),
|
| 14 |
+
`data_format_xml` varchar(500),
|
| 15 |
+
`gui_data` varchar(5000),
|
| 16 |
+
PRIMARY KEY (`temp_id`)
|
| 17 |
+
) ENGINE = INNODB CHARSET=utf8;
|
| 18 |
+
|
| 19 |
+
");
|
| 20 |
+
$installer->endSetup();
|
app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.8-0.1.9.php
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
$installer = $this;
|
| 6 |
+
|
| 7 |
+
$table = $installer->getTable('oopsprofile/template');
|
| 8 |
+
|
| 9 |
+
$installer->startSetup();
|
| 10 |
+
|
| 11 |
+
$installer->getConnection()->addColumn($table,'selected_profile','int(5) default 0 ');
|
| 12 |
+
|
| 13 |
+
$installer->getConnection()->addColumn($table,'category_mapping','int(5) default 0 ');
|
| 14 |
+
|
| 15 |
+
$installer->endSetup();
|
app/code/community/PI/Oopsprofile/sql/oopsprofile_setup/mysql4-upgrade-0.1.9-0.2.0.php
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
$installer = $this;
|
| 6 |
+
|
| 7 |
+
$table = $installer->getTable('oopsprofile/oopsprofile');
|
| 8 |
+
|
| 9 |
+
$installer->startSetup();
|
| 10 |
+
|
| 11 |
+
$installer->getConnection()->addColumn($table,'xml_content','varchar(10000) default "" ');
|
| 12 |
+
|
| 13 |
+
$installer->getConnection()->addColumn($table,'enable_content','int(5) default 0');
|
| 14 |
+
|
| 15 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/oopsprofile.xml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout>
|
| 3 |
+
<adminhtml_oopsprofile_run>
|
| 4 |
+
<remove name="root"/>
|
| 5 |
+
<block type="adminhtml/page" name="convert_root" output="toHtml" template="page.phtml">
|
| 6 |
+
<block type="adminhtml/page_head" name="convert_root_head" as="head" template="page/head.phtml">
|
| 7 |
+
<action method="addJs"><script>prototype/prototype.js</script></action>
|
| 8 |
+
<action method="addJs"><script>prototype/validation.js</script></action>
|
| 9 |
+
<action method="addJs"><script>varien/js.js</script></action>
|
| 10 |
+
<action method="addJs"><script>mage/translate.js</script></action>
|
| 11 |
+
<action method="addJs"><script>mage/adminhtml/tools.js</script></action>
|
| 12 |
+
</block>
|
| 13 |
+
<block type="oopsprofile/adminhtml_run" name="oopsprofile_run" template="oopsprofile/process.phtml" output="toHtml"/>
|
| 14 |
+
</block>
|
| 15 |
+
</adminhtml_oopsprofile_run>
|
| 16 |
+
<adminhtml_oopsprofile_edit>
|
| 17 |
+
<reference name="head">
|
| 18 |
+
<action method="setCanLoadExtJs"><flag>1</flag></action>
|
| 19 |
+
<action method="setCanLoadRulesJs"><flag>1</flag></action>
|
| 20 |
+
<action method="addItem"><type>skin_css</type><name>oopsprofile/css/oopsprofile.css</name></action>
|
| 21 |
+
</reference>
|
| 22 |
+
</adminhtml_oopsprofile_edit>
|
| 23 |
+
<adminhtml_mapping_edit>
|
| 24 |
+
<reference name="head">
|
| 25 |
+
<action method="addItem"><type>skin_css</type><name>oopsprofile/css/oopsprofile.css</name></action>
|
| 26 |
+
<action method="addItem"><type>skin_js</type><name>oopsprofile/js/jquery-1.4.4.js</name></action>
|
| 27 |
+
<action method="addItem"><type>skin_css</type><name>oopsprofile/css/jquery-ui-1.8.12.custom.css</name></action>
|
| 28 |
+
<action method="addItem"><type>skin_css</type><name>oopsprofile/css/jquery.checkboxtree.css</name></action>
|
| 29 |
+
<action method="addItem"><type>skin_js</type><name>oopsprofile/js/jquery-ui-1.8.12.custom.min.js</name></action>
|
| 30 |
+
<action method="addItem"><type>skin_js</type><name>oopsprofile/js/jquery.checkboxtree.js</name></action>
|
| 31 |
+
</reference>
|
| 32 |
+
</adminhtml_mapping_edit>
|
| 33 |
+
|
| 34 |
+
<adminhtml_template_run>
|
| 35 |
+
<remove name="root"/>
|
| 36 |
+
<block type="adminhtml/page" name="convert_root" output="toHtml" template="page.phtml">
|
| 37 |
+
<block type="adminhtml/page_head" name="convert_root_head" as="head" template="page/head.phtml">
|
| 38 |
+
<action method="addJs"><script>prototype/prototype.js</script></action>
|
| 39 |
+
<action method="addJs"><script>prototype/validation.js</script></action>
|
| 40 |
+
<action method="addJs"><script>varien/js.js</script></action>
|
| 41 |
+
<action method="addJs"><script>mage/translate.js</script></action>
|
| 42 |
+
<action method="addJs"><script>mage/adminhtml/tools.js</script></action>
|
| 43 |
+
</block>
|
| 44 |
+
<block type="oopsprofile/adminhtml_run" name="oopsprofile_run" template="oopsprofile/process.phtml" output="toHtml"/>
|
| 45 |
+
</block>
|
| 46 |
+
</adminhtml_template_run>
|
| 47 |
+
</layout>
|
app/design/adminhtml/default/default/template/oopsprofile/general.phtml
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|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|
Â
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @methods
|
| 4 |
+
* - getValue($key, $default)
|
| 5 |
+
* - getSelected($key, $value)
|
| 6 |
+
* - getChecked($key)
|
| 7 |
+
* - getAttributes()
|
| 8 |
+
* - getMappings()
|
| 9 |
+
* - getAddMapButtonHtml()
|
| 10 |
+
* - getRemoveMapButtonHtml()
|
| 11 |
+
*/
|
| 12 |
+
?>
|
| 13 |
+
|
| 14 |
+
<script type="text/javascript">
|
| 15 |
+
//<![CDATA[
|
| 16 |
+
var profileImportOnly = ['profile_number_of_records', 'profile_decimal_separator'];
|
| 17 |
+
var check=0;
|
| 18 |
+
function showOption(select)
|
| 19 |
+
{
|
| 20 |
+
select = $(select);
|
| 21 |
+
for (var i = 0, l = select.options.length; i<l; i++) {
|
| 22 |
+
$$('.'+select.id+'_'+select.options[i].value).each(function (el) {
|
| 23 |
+
el.style.display = select.selectedIndex==i ? '' : 'none';
|
| 24 |
+
});
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
var Selectedvalue = select.value;
|
| 28 |
+
|
| 29 |
+
var selectDataFormat = document.getElementById("parse_type");
|
| 30 |
+
var selectProfileWay=document.getElementById("profile_data_transfer");
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
if(selectDataFormat.value!='')
|
| 34 |
+
{
|
| 35 |
+
displayFirstRowSelect(selectDataFormat.value);
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
var entityType = $('profile_entity_type').value;
|
| 39 |
+
|
| 40 |
+
if(Selectedvalue=='import' || Selectedvalue=='export')
|
| 41 |
+
{
|
| 42 |
+
displayBasedOnProfileDirection(Selectedvalue);
|
| 43 |
+
//displayBasedOnEntity(entityType);
|
| 44 |
+
}
|
| 45 |
+
if(Selectedvalue=='import' || Selectedvalue=='export' || entityType!='')
|
| 46 |
+
{
|
| 47 |
+
//displayBasedOnProfileDirection(Selectedvalue);
|
| 48 |
+
displayBasedOnEntity(entityType);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
var wayType = $('profile_data_transfer').value;
|
| 52 |
+
if(wayType!='')
|
| 53 |
+
{
|
| 54 |
+
displyBasedOnWayType(wayType);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
if(selectProfileWay.value!='')
|
| 59 |
+
{
|
| 60 |
+
displayBasedOnWay(selectProfileWay.value);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
/**Check xml content is enable or not(in case of export && product)**/
|
| 65 |
+
//var isContent = $('enable_content').value;
|
| 66 |
+
var direction = $('profile_direction').value;
|
| 67 |
+
var format = $('parse_type').value;
|
| 68 |
+
/**if(direction == 'export' && entityType=='product' && format == 'xml')
|
| 69 |
+
{
|
| 70 |
+
//$('parse_type_xml').show();
|
| 71 |
+
}
|
| 72 |
+
else
|
| 73 |
+
{
|
| 74 |
+
//$('parse_type_xml').hide();
|
| 75 |
+
$('enable_content').value = 0;
|
| 76 |
+
}
|
| 77 |
+
if(isContent == 1)
|
| 78 |
+
{
|
| 79 |
+
$('xml_content_row').show();
|
| 80 |
+
//$('product_attr_xml_parsing').show();
|
| 81 |
+
}
|
| 82 |
+
else
|
| 83 |
+
{
|
| 84 |
+
$('xml_content_row').hide();
|
| 85 |
+
//$('product_attr_xml_parsing').hide();
|
| 86 |
+
$('enable_content').value = 0;
|
| 87 |
+
}**/
|
| 88 |
+
|
| 89 |
+
//display attribute for xml format
|
| 90 |
+
//var Productattr = $('product_attrs').value;
|
| 91 |
+
var Productattr = '';
|
| 92 |
+
|
| 93 |
+
if(Productattr!='')
|
| 94 |
+
{
|
| 95 |
+
|
| 96 |
+
//$('display_att_field').innerHTML = '{'+Productattr+'}';
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
function displyBasedOnWayType(wayType)
|
| 101 |
+
{
|
| 102 |
+
var entityType = $('profile_entity_type').value;
|
| 103 |
+
|
| 104 |
+
var direction = $('profile_direction').value;
|
| 105 |
+
|
| 106 |
+
if(wayType=='api' || wayType=='http' || wayType=='mail')
|
| 107 |
+
{
|
| 108 |
+
//Element.hide($('save_local_copy_row'));
|
| 109 |
+
|
| 110 |
+
//Element.hide($('save_products_separately_row'));
|
| 111 |
+
|
| 112 |
+
if(entityType!='product' && entityType!='customer' && wayType=='api')
|
| 113 |
+
{
|
| 114 |
+
Element.hide($('convert_profile_tabs_profiletemplate'));
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
}
|
| 118 |
+
else
|
| 119 |
+
{
|
| 120 |
+
if(entityType=='product' && direction=='export')
|
| 121 |
+
{
|
| 122 |
+
//Element.show($('save_products_separately_row'));
|
| 123 |
+
}
|
| 124 |
+
else
|
| 125 |
+
{
|
| 126 |
+
//Element.hide($('save_products_separately_row'));
|
| 127 |
+
}
|
| 128 |
+
if(direction=='export')
|
| 129 |
+
{
|
| 130 |
+
//Element.show($('save_local_copy_row'));
|
| 131 |
+
}
|
| 132 |
+
Element.show($('convert_profile_tabs_profiletemplate'));
|
| 133 |
+
}
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
function displayBasedOnEntity(entityType)
|
| 137 |
+
{
|
| 138 |
+
var direction = $('profile_direction').value;
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
if(entityType=='product' || entityType=='customer')
|
| 143 |
+
{
|
| 144 |
+
Element.show($('__fieldmapping'));
|
| 145 |
+
if(direction=='export')
|
| 146 |
+
{
|
| 147 |
+
Element.show($('profile_direction_export_row'));
|
| 148 |
+
}
|
| 149 |
+
if(entityType=='product' && direction=='export')
|
| 150 |
+
{
|
| 151 |
+
Element.show($('convert_profile_tabs_profilefilter'));
|
| 152 |
+
Element.show($('filters-for-product'));
|
| 153 |
+
|
| 154 |
+
Element.show($('products_allready_done_row'));
|
| 155 |
+
|
| 156 |
+
}
|
| 157 |
+
else
|
| 158 |
+
{
|
| 159 |
+
Element.hide($('products_allready_done_row'));
|
| 160 |
+
Element.hide($('convert_profile_tabs_profilefilter'));
|
| 161 |
+
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
else
|
| 165 |
+
{
|
| 166 |
+
|
| 167 |
+
if(entityType!='customergroup' && direction=='export')
|
| 168 |
+
{
|
| 169 |
+
Element.show($('convert_profile_tabs_profilefilter'));
|
| 170 |
+
}
|
| 171 |
+
else
|
| 172 |
+
{
|
| 173 |
+
Element.hide($('convert_profile_tabs_profilefilter'));
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
if(entityType=='customergroup')
|
| 177 |
+
{
|
| 178 |
+
Element.hide($('__fieldmapping'));
|
| 179 |
+
Element.hide($('profile_direction_export_row'));
|
| 180 |
+
}
|
| 181 |
+
else
|
| 182 |
+
{
|
| 183 |
+
Element.show($('__fieldmapping'));
|
| 184 |
+
if(direction=='export')
|
| 185 |
+
{
|
| 186 |
+
Element.show($('profile_direction_export_row'));
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
Element.hide($('filters-for-product'));
|
| 191 |
+
Element.hide($('products_allready_done_row'));
|
| 192 |
+
}
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
function displayBasedOnWay(value)
|
| 196 |
+
{
|
| 197 |
+
|
| 198 |
+
var selectDataFormat=document.getElementById("parse_type");
|
| 199 |
+
var selectedProfileDirection=document.getElementById("profile_direction");
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
if(value == 'api')
|
| 204 |
+
{
|
| 205 |
+
Element.hide($('parse_type_row'));
|
| 206 |
+
Element.hide($('parse_type_csv'));//if we add a new profile with api
|
| 207 |
+
if(selectedProfileDirection.value=='export')
|
| 208 |
+
{
|
| 209 |
+
Element.hide($('first-row-display-row1'));
|
| 210 |
+
Element.hide($('first-row-display-row2'));
|
| 211 |
+
Element.show($('data-format-display-div'));
|
| 212 |
+
}
|
| 213 |
+
else
|
| 214 |
+
{
|
| 215 |
+
Element.hide($('data-format-display-div'));
|
| 216 |
+
}
|
| 217 |
+
}
|
| 218 |
+
else
|
| 219 |
+
{
|
| 220 |
+
Element.show($('data-format-display-div'));
|
| 221 |
+
Element.show($('first-row-display-row1'));
|
| 222 |
+
Element.show($('first-row-display-row2'));
|
| 223 |
+
Element.show($('parse_type_row'));
|
| 224 |
+
if(selectDataFormat.value=='csv')
|
| 225 |
+
{
|
| 226 |
+
Element.show($('parse_type_csv'));//if we add a new profile with api
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
function addFieldMapping()
|
| 233 |
+
{
|
| 234 |
+
var entityType = $('profile_entity_type').value;
|
| 235 |
+
Element.insert($('map_container_'+entityType), {bottom: $('map_template_'+entityType).innerHTML});
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
function removeFieldMapping(button)
|
| 239 |
+
{
|
| 240 |
+
Element.remove(button.parentNode);
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
function setMapFileField(select)
|
| 244 |
+
{
|
| 245 |
+
select.parentNode.getElementsByTagName('input')[0].value = select.value;
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
function exportUrlField()
|
| 249 |
+
{
|
| 250 |
+
var urlFieldEl = $('profile_add_url_field').up();
|
| 251 |
+
var entityType = $('profile_entity_type').value;
|
| 252 |
+
var direction = $('profile_direction').value;
|
| 253 |
+
var storeId = $('profile_store_id').value;
|
| 254 |
+
|
| 255 |
+
if (entityType == 'product' && direction == 'export' && storeId > 0) {
|
| 256 |
+
urlFieldEl.show();
|
| 257 |
+
}
|
| 258 |
+
else {
|
| 259 |
+
urlFieldEl.hide();
|
| 260 |
+
}
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
function changeEntityType()
|
| 264 |
+
{
|
| 265 |
+
changeDirection();
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
function changeDirection()
|
| 270 |
+
{
|
| 271 |
+
|
| 272 |
+
if ($('profile_direction').value == 'import') {
|
| 273 |
+
profileImportOnly.each(function(id){if ($(id))$(id).up(1).show();});
|
| 274 |
+
}
|
| 275 |
+
else {
|
| 276 |
+
profileImportOnly.each(function(id){if ($(id))$(id).up(1).hide();});
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
function displayFirstRowSelect(value)
|
| 282 |
+
{
|
| 283 |
+
if(value=='xml')
|
| 284 |
+
{
|
| 285 |
+
Element.hide($('first-row-display-select'));
|
| 286 |
+
}
|
| 287 |
+
else
|
| 288 |
+
{
|
| 289 |
+
Element.show($('first-row-display-select'));
|
| 290 |
+
}
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
function displayBasedOnProfileDirection(value)
|
| 294 |
+
{
|
| 295 |
+
var selectobject=document.getElementById("profile_data_transfer");
|
| 296 |
+
if(value=='import')
|
| 297 |
+
{
|
| 298 |
+
selectobject.remove(2);
|
| 299 |
+
check=1;
|
| 300 |
+
|
| 301 |
+
}
|
| 302 |
+
else
|
| 303 |
+
{
|
| 304 |
+
|
| 305 |
+
var entityType = $('profile_entity_type').value;
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
if(check==1)
|
| 309 |
+
{
|
| 310 |
+
var option = document.createElement("option");
|
| 311 |
+
option.text = "Http Server";
|
| 312 |
+
option.value = "http";
|
| 313 |
+
selectobject.add(option,selectobject[2]);
|
| 314 |
+
check=0;
|
| 315 |
+
}
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
function updateRun(select)
|
| 321 |
+
{
|
| 322 |
+
if ($('file_list') != null){
|
| 323 |
+
$('file_list').hide();
|
| 324 |
+
}
|
| 325 |
+
var formatType = document.getElementById('parse_type').value;
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
var profileDirection = document.getElementById('profile_direction').value;
|
| 329 |
+
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
Event.observe(window, 'load', function(){
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
/**Check for Selected Template**/
|
| 336 |
+
//var selectedTemp = $('oops_profile_temp_id').value;
|
| 337 |
+
var selectedTemp = '';
|
| 338 |
+
var format = $('parse_type').value;
|
| 339 |
+
if(selectedTemp!=0 && format!='xml')
|
| 340 |
+
{
|
| 341 |
+
//$('data-format-predefined-div').show();
|
| 342 |
+
$('data-format-and-fields').hide();
|
| 343 |
+
}
|
| 344 |
+
else
|
| 345 |
+
{
|
| 346 |
+
if(selectedTemp!=0 && format=='xml')
|
| 347 |
+
{
|
| 348 |
+
//$('data-format-predefined-div').show();
|
| 349 |
+
$('data-format-and-fields').show();
|
| 350 |
+
}
|
| 351 |
+
else
|
| 352 |
+
{
|
| 353 |
+
//$('data-format-predefined-div').hide();
|
| 354 |
+
$('data-format-and-fields').show();
|
| 355 |
+
}
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
|
| 360 |
+
var entityType = $('profile_entity_type').value;
|
| 361 |
+
displayBasedOnEntity(entityType);
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
if($('profile_data_transfer')) {
|
| 365 |
+
updateRun('profile_data_transfer');
|
| 366 |
+
}
|
| 367 |
+
});
|
| 368 |
+
//]]>
|
| 369 |
+
</script>
|
| 370 |
+
|
| 371 |
+
<div id="profile-generator" class="entry-edit profile-generator">
|
| 372 |
+
<div class="entry-edit-head">
|
| 373 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__("Profile Information") ?></h4>
|
| 374 |
+
</div>
|
| 375 |
+
<fieldset>
|
| 376 |
+
<legend><?php echo $this->__("Profile Information") ?></legend>
|
| 377 |
+
<span class="no-display"><input type="hidden" name="oops_profile" value="1"></span>
|
| 378 |
+
<span class="field-row">
|
| 379 |
+
<label for="profile_name"><?php echo $this->__("Name:") ?> <span class="required">*</span></label>
|
| 380 |
+
<input class="required-entry required-entry input-text" id="profile_name" name="name" value="<?php echo $this->getValue('name') ?>"/>
|
| 381 |
+
</span>
|
| 382 |
+
<span class="field-row">
|
| 383 |
+
<label for="profile_entity_type"><?php echo $this->__("Entity type:") ?></label>
|
| 384 |
+
<?php $oopsentityTypes = Mage::helper('oopsprofile')->entityTypeArray()?>
|
| 385 |
+
<select id="profile_entity_type" name="entity_type" onchange="showOption(this);changeEntityType();" class="option-control">
|
| 386 |
+
<?php foreach($oopsentityTypes as $key=>$value):?>
|
| 387 |
+
<option value="<?php echo $key?>" <?php echo $this->getSelected('entity_type', $key) ?>><?php echo $value ?></option>
|
| 388 |
+
<?php endforeach;?>
|
| 389 |
+
</select>
|
| 390 |
+
</span>
|
| 391 |
+
<span class="field-row">
|
| 392 |
+
<label for="profile_direction"><?php echo $this->__("Direction:") ?></label>
|
| 393 |
+
<select id="profile_direction" name="direction" onchange="showOption(this);changeDirection();" class="option-control">
|
| 394 |
+
<option value="import" <?php echo $this->getSelected('direction', 'import') ?>><?php echo $this->__("Import") ?></option>
|
| 395 |
+
<option value="export" <?php echo $this->getSelected('direction', 'export') ?>><?php echo $this->__("Export") ?></option>
|
| 396 |
+
</select>
|
| 397 |
+
</span>
|
| 398 |
+
<span class="field-row" id="profile_enable_row">
|
| 399 |
+
<label for="profile_enable"><?php echo $this->__("Disable Profile:") ?></label>
|
| 400 |
+
<select id="profile_enable" name="profile_enable" onchange="showOption(this);" class="option-control">
|
| 401 |
+
<option value="0" <?php echo $this->getOopsSelected('profile_enable', '0') ?>><?php echo $this->__("No") ?></option>
|
| 402 |
+
<option value="1" <?php echo $this->getOopsSelected('profile_enable', '1') ?>><?php echo $this->__("Yes") ?></option>
|
| 403 |
+
</select>
|
| 404 |
+
</span>
|
| 405 |
+
<span class="field-row profile_direction_export" id="products_allready_done_row">
|
| 406 |
+
<label for="products_allready_done"><?php echo $this->__("Considerate Products already done:") ?></label>
|
| 407 |
+
<select id="products_allready_done" name="products_allready_done" onchange="showOption(this);" class="option-control">
|
| 408 |
+
<option value="1" <?php echo $this->getOopsSelected('products_allready_done', '1') ?>><?php echo $this->__("Yes") ?></option>
|
| 409 |
+
<option value="0" <?php echo $this->getOopsSelected('products_allready_done', '0') ?>><?php echo $this->__("No") ?></option>
|
| 410 |
+
</select>
|
| 411 |
+
<small>
|
| 412 |
+
<?php echo $this->__(" (considerate just new products or considerate all products after installation of extension)") ?>
|
| 413 |
+
</small>
|
| 414 |
+
</span>
|
| 415 |
+
</fieldset>
|
| 416 |
+
|
| 417 |
+
</div>
|
app/design/adminhtml/default/default/template/oopsprofile/process.phtml
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
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â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category design
|
| 22 |
+
* @package default_default
|
| 23 |
+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
?>
|
| 27 |
+
|
| 28 |
+
<style type="text/css" >
|
| 29 |
+
ul { list-style-type:none; padding:0; margin:0; }
|
| 30 |
+
li { margin-left:0; border:1px solid #ccc; margin:2px; padding:2px 2px 2px 2px; font:normal 12px sans-serif; }
|
| 31 |
+
img { margin-right:5px; }
|
| 32 |
+
</style>
|
| 33 |
+
<script type="text/javascript">
|
| 34 |
+
var FORM_KEY = "<?php echo $this->getFormKey();?>";
|
| 35 |
+
</script>
|
| 36 |
+
<ul>
|
| 37 |
+
<li>
|
| 38 |
+
<?php if ($this->getProfile()->getId()):?>
|
| 39 |
+
<img src="<?php echo $this->getSkinUrl('images/note_msg_icon.gif')?>" class="v-middle" style="margin-right:5px"/>
|
| 40 |
+
<?php echo $this->__("Starting profile execution, please wait...");?>
|
| 41 |
+
</li>
|
| 42 |
+
<li style="background-color:#FFD;">
|
| 43 |
+
<img src="<?php echo $this->getSkinUrl('images/fam_bullet_error.gif');?>" class="v-middle" style="margin-right:5px"/>
|
| 44 |
+
<?php echo $this->__("Warning: Please do not close the window during importing/exporting data");?>
|
| 45 |
+
<?php else:?>
|
| 46 |
+
<img src="<?php echo $this->getSkinUrl('images/error_msg_icon.gif');?>" class="v-middle" style="margin-right:5px"/>
|
| 47 |
+
<?php echo $this->__("No profile loaded...");?>
|
| 48 |
+
<?php endif;?>
|
| 49 |
+
</li>
|
| 50 |
+
</ul>
|
| 51 |
+
|
| 52 |
+
<?php if ($this->getProfile()->getId()):?>
|
| 53 |
+
<ul id="profileRows">
|
| 54 |
+
<?php foreach ($this->getExceptions() as $exceptionInfo):?>
|
| 55 |
+
<li style="<?php echo $exceptionInfo['style'];?>">
|
| 56 |
+
<img src="<?php echo $exceptionInfo['src'];?>" class="v-middle"/>
|
| 57 |
+
<?php echo $exceptionInfo['message'];?>
|
| 58 |
+
<?php if ($exceptionInfo['position']):?>
|
| 59 |
+
<small>(<?php echo $exceptionInfo['position'];?>)</small>
|
| 60 |
+
<?php endif;?>
|
| 61 |
+
</li>
|
| 62 |
+
<?php endforeach;?>
|
| 63 |
+
<?php if($this->getProfile()->getEntityType() == 'product' && $this->getProfile()->getDirection() == 'import'):?>
|
| 64 |
+
<li id="liBeforeFinish" style="background-color:#FFD; display:none;">
|
| 65 |
+
<img src="<?php echo $this->getSkinUrl('images/fam_bullet_error.gif');?>" class="v-middle" style="margin-right:5px"/>
|
| 66 |
+
<?php echo $this->__("Please wait while the indexes are being refreshed.");?>
|
| 67 |
+
<img id="before-finish-wait-img" src="<?php echo $this->getSkinUrl('images/rule-ajax-loader.gif');?>" class="v-middle" style="margin-right:5px"/>
|
| 68 |
+
</li>
|
| 69 |
+
<?php endif;?>
|
| 70 |
+
<li id="liFinished" style="display:none;">
|
| 71 |
+
<img src="<?php echo $this->getSkinUrl('images/note_msg_icon.gif');?>" class="v-middle" style="margin-right:5px"/>
|
| 72 |
+
<?php echo $this->__("Finished profile execution.");?>
|
| 73 |
+
</li>
|
| 74 |
+
</ul>
|
| 75 |
+
<?php if ($batchId = $this->getBatchModel()->getId()):?>
|
| 76 |
+
<?php if ($this->getBatchModelHasAdapter()):?>
|
| 77 |
+
<script type="text/javascript">
|
| 78 |
+
var countOfStartedProfiles = 0;
|
| 79 |
+
var countOfUpdated = 0;
|
| 80 |
+
var countOfError = 0;
|
| 81 |
+
var importData = [];
|
| 82 |
+
var totalRecords = <?php echo $this->getBatchItemsCount();?>;
|
| 83 |
+
var config= <?php echo $this->getBatchConfigJson();?>;
|
| 84 |
+
</script>
|
| 85 |
+
<script type="text/javascript">
|
| 86 |
+
function addImportData(data) {
|
| 87 |
+
importData.push(data);
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
function execImportData() {
|
| 91 |
+
if (importData.length == 0) {
|
| 92 |
+
$("updatedRows_img").src = config.styles.message.icon;
|
| 93 |
+
$("updatedRows").style.backgroundColor = config.styles.message.bg;
|
| 94 |
+
Element.insert($("liFinished"), {before: config.tpl.evaluate({
|
| 95 |
+
style: "background-color:"+config.styles.message.bg,
|
| 96 |
+
image: config.styles.message.icon,
|
| 97 |
+
text: config.tplSccTxt.evaluate({updated:(countOfUpdated-countOfError)}),
|
| 98 |
+
id: "updatedFinish"
|
| 99 |
+
})});
|
| 100 |
+
|
| 101 |
+
if ($("liBeforeFinish")) {
|
| 102 |
+
Element.insert($("liFinished"), {before: $("liBeforeFinish")});
|
| 103 |
+
$("liBeforeFinish").show();
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
new Ajax.Request("<?php echo $this->getUrl('*/*/batchFinish', array('id' => $batchId));?>", {
|
| 107 |
+
method: "post",
|
| 108 |
+
parameters: {form_key: FORM_KEY},
|
| 109 |
+
onComplete: function(transport) {
|
| 110 |
+
if (transport.responseText.isJSON()) {
|
| 111 |
+
var response = transport.responseText.evalJSON();
|
| 112 |
+
if (response.error) {
|
| 113 |
+
Element.insert($("liFinished"), {before: config.tpl.evaluate({
|
| 114 |
+
style: "background-color:"+config.styles.error.bg,
|
| 115 |
+
image: config.styles.error.icon,
|
| 116 |
+
text: response.error.escapeHTML(),
|
| 117 |
+
id: "error-finish"
|
| 118 |
+
})});
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
if ($("before-finish-wait-img")) {
|
| 123 |
+
$("before-finish-wait-img").hide();
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
$('liFinished').show();
|
| 127 |
+
}
|
| 128 |
+
});
|
| 129 |
+
} else {
|
| 130 |
+
sendImportData(importData.shift());
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
function sendImportData(data) {
|
| 135 |
+
if (!config.tpl) {
|
| 136 |
+
config.tpl = new Template(config.template);
|
| 137 |
+
config.tplTxt = new Template(config.text);
|
| 138 |
+
config.tplSccTxt = new Template(config.successText);
|
| 139 |
+
}
|
| 140 |
+
if (!$("updatedRows")) {
|
| 141 |
+
Element.insert($("liFinished"), {before: config.tpl.evaluate({
|
| 142 |
+
style: "background-color: #FFD;",
|
| 143 |
+
image: config.styles.loader,
|
| 144 |
+
text: config.tplTxt.evaluate({updated:countOfUpdated, percent:getPercent()}),
|
| 145 |
+
id: "updatedRows"
|
| 146 |
+
})});
|
| 147 |
+
}
|
| 148 |
+
countOfStartedProfiles++;
|
| 149 |
+
if (!data.form_key) {
|
| 150 |
+
data.form_key = FORM_KEY;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
new Ajax.Request("<?php echo $this->getUrl('*/*/batchRun');?>", {
|
| 154 |
+
method: "post",
|
| 155 |
+
parameters: data,
|
| 156 |
+
onSuccess: function(transport) {
|
| 157 |
+
countOfStartedProfiles --;
|
| 158 |
+
countOfUpdated += data["rows[]"].length;
|
| 159 |
+
if (transport.responseText.isJSON()) {
|
| 160 |
+
addProfileRow(transport.responseText.evalJSON());
|
| 161 |
+
} else {
|
| 162 |
+
Element.insert($("updatedRows"), {before: config.tpl.evaluate({
|
| 163 |
+
style: "background-color:"+config.styles.error.bg,
|
| 164 |
+
image: config.styles.error.icon,
|
| 165 |
+
text: transport.responseText.escapeHTML(),
|
| 166 |
+
id: "error-" + countOfStartedProfiles
|
| 167 |
+
})});
|
| 168 |
+
countOfError += data["rows[]"].length;
|
| 169 |
+
}
|
| 170 |
+
execImportData();
|
| 171 |
+
}
|
| 172 |
+
});
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
function getPercent() {
|
| 176 |
+
return Math.ceil((countOfUpdated/totalRecords)*1000)/10;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
function addProfileRow(data) {
|
| 180 |
+
if (data.errors.length > 0) {
|
| 181 |
+
for (var i=0, length=data.errors.length; i<length; i++) {
|
| 182 |
+
Element.insert($("updatedRows"), {before: config.tpl.evaluate({
|
| 183 |
+
style: "background-color:"+config.styles.error.bg,
|
| 184 |
+
image: config.styles.error.icon,
|
| 185 |
+
text: data.errors[i],
|
| 186 |
+
id: "id-" + (countOfUpdated + i + 1)
|
| 187 |
+
})});
|
| 188 |
+
countOfError ++;
|
| 189 |
+
}
|
| 190 |
+
}
|
| 191 |
+
$("updatedRows_status").update(config.tplTxt.evaluate({updated:countOfUpdated, percent:getPercent()}));
|
| 192 |
+
}
|
| 193 |
+
</script>
|
| 194 |
+
<?php $importData = $this->getImportData();?>
|
| 195 |
+
<script type="text/javascript">
|
| 196 |
+
<?php foreach ($importData as $importValue):?>
|
| 197 |
+
addImportData(<?php echo $this->jsonEncode($importValue);?>);
|
| 198 |
+
<?php endforeach;?>
|
| 199 |
+
execImportData();
|
| 200 |
+
</script>
|
| 201 |
+
<?php endif;?>
|
| 202 |
+
<?php endif;?>
|
| 203 |
+
<?php if ($this->getShowFinished()):?>
|
| 204 |
+
<script type="text/javascript">$('liFinished').show();</script>
|
| 205 |
+
<?php endif;?>
|
| 206 |
+
<?php endif;?>
|
app/design/adminhtml/default/default/template/oopsprofile/profilefilter.phtml
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<div class="entry-edit profile-generator oopsprofile-generator">
|
| 2 |
+
<div class="entry-edit-head">
|
| 3 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__("Profile Filters") ?></h4>
|
| 4 |
+
</div>
|
| 5 |
+
<fieldset>
|
| 6 |
+
<legend><?php echo $this->__("Profile Filters") ?></legend>
|
| 7 |
+
<span class="field-row">
|
| 8 |
+
<label for="profile_store_id"><?php echo $this->__("Store:") ?></label>
|
| 9 |
+
<span class="with-tip">
|
| 10 |
+
<select id="profile_store_id" name="store_id" onchange="exportUrlField();">
|
| 11 |
+
<option value="0"><?php echo $this->__('Default (Admin) Values') ?></option>
|
| 12 |
+
<?php foreach ($this->getWebsiteCollection() as $_website): ?>
|
| 13 |
+
<?php $_websiteShow=false; ?>
|
| 14 |
+
<?php foreach ($this->getGroupCollection() as $_group): ?>
|
| 15 |
+
<?php if ($_website->getId() != $_group->getWebsiteId()) continue; ?>
|
| 16 |
+
<?php $_groupShow=false; ?>
|
| 17 |
+
<?php foreach ($this->getStoreCollection() as $_store): ?>
|
| 18 |
+
<?php if ($_group->getId() != $_store->getGroupId()) continue; ?>
|
| 19 |
+
<?php if (!$_websiteShow): ?>
|
| 20 |
+
<?php $_websiteShow=true; ?>
|
| 21 |
+
<optgroup label="<?php echo $_website->getName() ?>"></optgroup>
|
| 22 |
+
<?php endif; ?>
|
| 23 |
+
<?php if (!$_groupShow): ?>
|
| 24 |
+
<?php $_groupShow=true; ?>
|
| 25 |
+
<optgroup label=" <?php echo $_group->getName() ?>">
|
| 26 |
+
<?php endif; ?>
|
| 27 |
+
<option value="<?php echo $_store->getId() ?>" <?php echo $this->getSelected('store_id', $_store->getId()) ?>> <?php echo $_store->getName() ?></option>
|
| 28 |
+
<?php endforeach; ?>
|
| 29 |
+
<?php if ($_groupShow): ?>
|
| 30 |
+
</optgroup>
|
| 31 |
+
<?php endif; ?>
|
| 32 |
+
<?php endforeach; ?>
|
| 33 |
+
<?php endforeach; ?>
|
| 34 |
+
</select>
|
| 35 |
+
<small class="profile_direction_import profile_entity_type_product">
|
| 36 |
+
<?php echo $this->__("(Products will be added/updated to this store if 'store' column is blank or missing in the import file.)") ?>
|
| 37 |
+
</small>
|
| 38 |
+
</span>
|
| 39 |
+
</span>
|
| 40 |
+
<div id="filters-for-product">
|
| 41 |
+
<span class="field-row profile_direction_export">
|
| 42 |
+
<label for="filter_fromdate_img"><?php echo $this->__("Export Product from date") ?></label>
|
| 43 |
+
<span class="with-tip">
|
| 44 |
+
<input class="input-text" id="filter_fromdate" name="gui_data[filter][fromdate]" value="<?php echo $this->getValue('gui_data/filter/fromdate') ?>"/>
|
| 45 |
+
<img style="" title="Select Date" id="filter_fromdate_img" class="v-middle" alt="" src="<?php echo $this->getSkinUrl('images/grid-cal.gif');?> "/>
|
| 46 |
+
</span>
|
| 47 |
+
<script type="text/javascript">
|
| 48 |
+
    //<![CDATA[
|
| 49 |
+
        Calendar.setup({
|
| 50 |
+
            inputField: "filter_fromdate",
|
| 51 |
+
ifFormat: "%m/%e/%Y",
|
| 52 |
+
showsTime: false,
|
| 53 |
+
button: "filter_fromdate_img",
|
| 54 |
+
align: "Bl",
|
| 55 |
+
singleClick : true
|
| 56 |
+
        });
|
| 57 |
+
    //]]>
|
| 58 |
+
    </script>
|
| 59 |
+
</span>
|
| 60 |
+
<span class="field-row profile_direction_export">
|
| 61 |
+
<label for="filter_todate_img"><?php echo $this->__("Export Product to date") ?></label>
|
| 62 |
+
<span class="with-tip">
|
| 63 |
+
<input class="input-text" id="filter_todate" name="gui_data[filter][todate]" value="<?php echo $this->getValue('gui_data/filter/todate') ?>"/>
|
| 64 |
+
<img style="" title="Select Date" id="filter_todate_img" class="v-middle" alt="" src="<?php echo $this->getSkinUrl('images/grid-cal.gif');?> "/>
|
| 65 |
+
</span>
|
| 66 |
+
<script type="text/javascript">
|
| 67 |
+
    //<![CDATA[
|
| 68 |
+
        Calendar.setup({
|
| 69 |
+
            inputField: "filter_todate",
|
| 70 |
+
ifFormat: "%m/%e/%Y",
|
| 71 |
+
showsTime: false,
|
| 72 |
+
button: "filter_todate_img",
|
| 73 |
+
align: "Bl",
|
| 74 |
+
singleClick : true
|
| 75 |
+
        });
|
| 76 |
+
    //]]>
|
| 77 |
+
    </script>
|
| 78 |
+
</span>
|
| 79 |
+
<?php $productTypes = Mage::getModel('catalog/product_type')->getOptionArray();?>
|
| 80 |
+
<span class="field-row profile_direction_export">
|
| 81 |
+
<label for="filter_todate_img"><?php echo $this->__("Hidden Product Types") ?></label>
|
| 82 |
+
<span class="with-tip">
|
| 83 |
+
<select id="profile_data_transfer" name="gui_data[filter][hiddentype][]" onchange="showOption(this);updateRun(this)" class="option-control" multiple="multiple">
|
| 84 |
+
<?php foreach($productTypes as $key=>$value):?>
|
| 85 |
+
<option value="<?php echo $key?>" <?php echo $this->getMultipleSelect('gui_data/filter/hiddentype',$key);?>><?php echo $value ?></option>
|
| 86 |
+
<?php endforeach;?>
|
| 87 |
+
<option value=""></option>
|
| 88 |
+
</select>
|
| 89 |
+
<small>
|
| 90 |
+
<?php echo $this->__("(Selected product types won't be exported)") ?>
|
| 91 |
+
</small>
|
| 92 |
+
</span>
|
| 93 |
+
</span>
|
| 94 |
+
</div>
|
| 95 |
+
</fieldset>
|
| 96 |
+
</div>
|
| 97 |
+
|
| 98 |
+
<script type="text/javascript">
|
| 99 |
+
//<![CDATA[
|
| 100 |
+
$$('.option-control').each(showOption);
|
| 101 |
+
changeEntityType();
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
function showFeildMapping() {
|
| 105 |
+
var direction = $('profile_direction').options[$('profile_direction').options.selectedIndex].value;
|
| 106 |
+
var value = $('parse_fieldnames').options[$('parse_fieldnames').options.selectedIndex].value;
|
| 107 |
+
var map = $('map_only_specified').options[$('map_only_specified').options.selectedIndex].value;
|
| 108 |
+
|
| 109 |
+
if (direction == 'export') {
|
| 110 |
+
if (map) {
|
| 111 |
+
Element.show($('__fieldmapping'));
|
| 112 |
+
} else {
|
| 113 |
+
deleteAllAddedMappingFields();
|
| 114 |
+
Element.hide($('__fieldmapping'));
|
| 115 |
+
}
|
| 116 |
+
} else {
|
| 117 |
+
if (value) {
|
| 118 |
+
Element.hide($('__fieldmapping'));
|
| 119 |
+
deleteAllAddedMappingFields();
|
| 120 |
+
} else {
|
| 121 |
+
Element.show($('__fieldmapping'));
|
| 122 |
+
}
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
function deleteAllAddedMappingFields()
|
| 128 |
+
{
|
| 129 |
+
var type = $('profile_entity_type').options[$('profile_entity_type').options.selectedIndex].value;
|
| 130 |
+
|
| 131 |
+
var elems = $('map_container_'+type).childElements();
|
| 132 |
+
if (elems.length > 0) for (var idx in elems) {
|
| 133 |
+
if (elems[idx] != undefined && elems[idx].tagName != undefined) {
|
| 134 |
+
elems[idx].remove();
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
var direction = $('profile_direction').options[$('profile_direction').options.selectedIndex].value;
|
| 139 |
+
if (direction == 'import') {
|
| 140 |
+
//if ($('parse_fieldnames').options[$('parse_fieldnames').options.selectedIndex].value) {
|
| 141 |
+
// Element.hide($('__fieldmapping'));
|
| 142 |
+
// deleteAllAddedMappingFields();
|
| 143 |
+
// } else {
|
| 144 |
+
Element.show($('__fieldmapping'));
|
| 145 |
+
//}
|
| 146 |
+
} else {
|
| 147 |
+
var map = $('map_only_specified').options[$('map_only_specified').options.selectedIndex].value;
|
| 148 |
+
if (map) {
|
| 149 |
+
Element.show($('__fieldmapping'));
|
| 150 |
+
} else {
|
| 151 |
+
deleteAllAddedMappingFields();
|
| 152 |
+
Element.hide($('__fieldmapping'));
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
//]]>
|
| 156 |
+
</script>
|
app/design/adminhtml/default/default/template/oopsprofile/profiletemplate.phtml
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?php
|
| 2 |
+
$delimiterTypes = Mage::helper('oopsprofile')->delimiterTypeArray();
|
| 3 |
+
$enclosureTypes = Mage::helper('oopsprofile')->enclosureTypeArray();
|
| 4 |
+
?>
|
| 5 |
+
|
| 6 |
+
<div id="data-format-and-fields">
|
| 7 |
+
<div id="data-format-display-div">
|
| 8 |
+
<div class="entry-edit-head">
|
| 9 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__("Data Format") ?></h4>
|
| 10 |
+
</div>
|
| 11 |
+
<fieldset>
|
| 12 |
+
<legend><?php echo $this->__("Data Format") ?></legend>
|
| 13 |
+
<span class="field-row" id="parse_type_row">
|
| 14 |
+
<label for="parse_type"><?php echo $this->__("Type:") ?></label>
|
| 15 |
+
<?php $formatTypes = Mage::helper('oopsprofile')->formatTypeArray()?>
|
| 16 |
+
<select id="parse_type" name="gui_data[parse][type]" onchange="showOption(this);" class="option-control" style="width:207px;">
|
| 17 |
+
<?php foreach($formatTypes as $key=>$value):?>
|
| 18 |
+
<option value="<?php echo $key?>" <?php echo $this->getSelected('gui_data/parse/type', $key) ?>><?php echo $value ?></option>
|
| 19 |
+
<?php endforeach;?>
|
| 20 |
+
</select>
|
| 21 |
+
</span>
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
<div class="parse_type_csv" id="parse_type_csv">
|
| 25 |
+
<span class="field-row">
|
| 26 |
+
<label for="parse_delimiter"><?php echo $this->__("Value Delimiter:") ?></label>
|
| 27 |
+
<select id="parse_delimiter" name="gui_data[parse][csv][delimiter]" onchange="showOption(this)" class="option-control" style="width:207px;">
|
| 28 |
+
<?php foreach($delimiterTypes as $key=>$value):?>
|
| 29 |
+
<option value="<?php echo $key?>" <?php echo $this->getSelected('gui_data/parse/csv/delimiter', $key) ?>><?php echo $value ?></option>
|
| 30 |
+
<?php endforeach;?>
|
| 31 |
+
</select>
|
| 32 |
+
</span>
|
| 33 |
+
<span class="field-row">
|
| 34 |
+
<label for="parse_enclose"><?php echo $this->__("Enclose Values In:") ?></label>
|
| 35 |
+
<select id="parse_enclose" name="gui_data[parse][csv][enclose]" onchange="showOption(this)" class="option-control" style="width:207px;">
|
| 36 |
+
<option value='"' <?php echo $this->getSelected('gui_data/parse/csv/enclose', '"') ?>><?php echo '"' ?></option>
|
| 37 |
+
<option value="'" <?php echo $this->getSelected('gui_data/parse/csv/enclose', "'") ?>><?php echo "'" ?></option>
|
| 38 |
+
</select>
|
| 39 |
+
</span>
|
| 40 |
+
</div>
|
| 41 |
+
<div class="parse_type_txt">
|
| 42 |
+
<span class="field-row">
|
| 43 |
+
<label for="parse_delimiter"><?php echo $this->__("Value Delimiter:") ?></label>
|
| 44 |
+
<select id="parse_delimiter" name="gui_data[parse][txt][delimiter]" onchange="showOption(this)" class="option-control" style="width:207px;">
|
| 45 |
+
<?php foreach($delimiterTypes as $key=>$value):?>
|
| 46 |
+
<option value="<?php echo $key?>" <?php echo $this->getSelected('gui_data/parse/txt/delimiter', $key) ?>><?php echo $value ?></option>
|
| 47 |
+
<?php endforeach;?>
|
| 48 |
+
</select>
|
| 49 |
+
</span>
|
| 50 |
+
<span class="field-row">
|
| 51 |
+
<label for="parse_enclose"><?php echo $this->__("Enclose Values In:") ?></label>
|
| 52 |
+
<select id="parse_enclose" name="gui_data[parse][txt][enclose]" onchange="showOption(this)" class="option-control" style="width:207px;">
|
| 53 |
+
<option value='"' <?php echo $this->getSelected('gui_data/parse/txt/enclose', '"') ?>><?php echo '"' ?></option>
|
| 54 |
+
<option value="'" <?php echo $this->getSelected('gui_data/parse/txt/enclose', "'") ?>><?php echo "'" ?></option>
|
| 55 |
+
</select>
|
| 56 |
+
</span>
|
| 57 |
+
</div>
|
| 58 |
+
<span class="field-row" id="first-row-display-select">
|
| 59 |
+
<label for="parse_fieldnames" id="first-row-display-row1"><?php echo $this->__("Original Magento attribute names in first row:") ?></label>
|
| 60 |
+
<span class="with-tip" id="first-row-display-row2">
|
| 61 |
+
<select id="parse_fieldnames" name="gui_data[parse][fieldnames]" onchange="showFeildMapping();showOption(this)" class="option-control" style="width:207px;">
|
| 62 |
+
<option value="" <?php echo $this->getSelected('gui_data/parse/fieldnames', false) ?>><?php echo $this->__("No") ?></option>
|
| 63 |
+
<option value="true" <?php echo $this->getSelected('gui_data/parse/fieldnames', true) ?>><?php echo $this->__("Yes") ?></option>
|
| 64 |
+
</select>
|
| 65 |
+
<small class="profile_direction_import">
|
| 66 |
+
<span class="parse_fieldnames_">
|
| 67 |
+
<?php echo $this->__("(When 'No', only mapped fields will be imported. When mapping, use 'column1', 'column2', etc.)") ?>
|
| 68 |
+
</span>
|
| 69 |
+
</small>
|
| 70 |
+
</span>
|
| 71 |
+
</span>
|
| 72 |
+
<div class="profile_direction_export" id="profile_direction_export_row">
|
| 73 |
+
<span class="field-row">
|
| 74 |
+
<label for="map_only_specified"><?php echo $this->__("Export:") ?></label>
|
| 75 |
+
<select id="map_only_specified" name="gui_data[map][only_specified]" onchange="showFeildMapping();showOption(this)">
|
| 76 |
+
<option value="" <?php echo $this->getSelected('gui_data/map/only_specified', false) ?>><?php echo $this->__("All fields") ?></option>
|
| 77 |
+
<option value="true" <?php echo $this->getSelected('gui_data/map/only_specified', true) ?>><?php echo $this->__("Only mapped fields") ?></option>
|
| 78 |
+
</select>
|
| 79 |
+
</span>
|
| 80 |
+
</div>
|
| 81 |
+
</fieldset>
|
| 82 |
+
</div>
|
| 83 |
+
|
| 84 |
+
<div id="__fieldmapping">
|
| 85 |
+
<div class="entry-edit-head">
|
| 86 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__("Field Mapping") ?></h4>
|
| 87 |
+
</div>
|
| 88 |
+
<fieldset>
|
| 89 |
+
<legend><?php echo $this->__("Field Mapping") ?></legend>
|
| 90 |
+
<?php $oopsentityAttrTypes = Mage::helper('oopsprofile')->entityAttrTypeArray()?>
|
| 91 |
+
<?php foreach ($oopsentityAttrTypes as $_entityType): ?>
|
| 92 |
+
<div class="profile_entity_type_<?php echo $_entityType ?>">
|
| 93 |
+
<div id="map_template_<?php echo $_entityType ?>" style="display:none">
|
| 94 |
+
<span class="field-row">
|
| 95 |
+
<?php echo $this->__("In Database:") ?> <select name="gui_data[map][<?php echo $_entityType ?>][db][]" onchange="setMapFileField(this)">
|
| 96 |
+
<?php
|
| 97 |
+
$fieldMappingInDatabase = $this->getAttributes($_entityType);
|
| 98 |
+
asort($fieldMappingInDatabase);
|
| 99 |
+
foreach ($fieldMappingInDatabase as $_value=>$_label): ?>
|
| 100 |
+
<option value="<?php echo $_value ?>"><?php echo $_label ?></option>
|
| 101 |
+
<?php endforeach ?>
|
| 102 |
+
</select>
|
| 103 |
+
<-->
|
| 104 |
+
<?php echo $this->__("In File:") ?> <input class="input-text" name="gui_data[map][<?php echo $_entityType ?>][file][]"/>
|
| 105 |
+
<?php echo $this->getRemoveMapButtonHtml() ?>
|
| 106 |
+
</span>
|
| 107 |
+
</div>
|
| 108 |
+
<div id="map_container_<?php echo $_entityType ?>">
|
| 109 |
+
<?php foreach ($this->getMappings($_entityType) as $_i=>$_dbField): ?>
|
| 110 |
+
<span class="field-row">
|
| 111 |
+
<?php echo $this->__("In Database:") ?> <select name="gui_data[map][<?php echo $_entityType ?>][db][]">
|
| 112 |
+
<?php foreach ($this->getAttributes($_entityType) as $_value=>$_label): ?>
|
| 113 |
+
<option value="<?php echo $_value ?>" <?php echo $this->getSelected('gui_data/map/'.$_entityType.'/db/'.$_i, $_value) ?>><?php echo $_label ?></option>
|
| 114 |
+
<?php endforeach ?>
|
| 115 |
+
</select>
|
| 116 |
+
<-->
|
| 117 |
+
<?php echo $this->__("In File:") ?> <input class="input-text" name="gui_data[map][<?php echo $_entityType ?>][file][]" value="<?php echo $this->getValue('gui_data/map/'.$_entityType.'/file/'.$_i) ?>"/>
|
| 118 |
+
<?php echo $this->getRemoveMapButtonHtml() ?>
|
| 119 |
+
</span>
|
| 120 |
+
<?php endforeach ?>
|
| 121 |
+
</div>
|
| 122 |
+
</div>
|
| 123 |
+
<?php endforeach ?>
|
| 124 |
+
<?php echo $this->getAddMapButtonHtml() ?>
|
| 125 |
+
</fieldset>
|
| 126 |
+
</div>
|
| 127 |
+
</div>
|
app/design/adminhtml/default/default/template/oopsprofile/profileway.phtml
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
|
| 2 |
+
<style type="text/css">
|
| 3 |
+
.full-width{
|
| 4 |
+
width:100% !important;
|
| 5 |
+
}
|
| 6 |
+
</style>
|
| 7 |
+
|
| 8 |
+
<?php
|
| 9 |
+
$profile = Mage::registry('current_convert_profile');
|
| 10 |
+
$oopsProfile = Mage::getModel('oopsprofile/oopsprofile')->loadByProfile($profile);
|
| 11 |
+
$isTokenAvailable = $oopsProfile->getIsTokenAvailable();
|
| 12 |
+
$authUrl = $oopsProfile->getOauthUrl();
|
| 13 |
+
?>
|
| 14 |
+
|
| 15 |
+
<div class="entry-edit profile-generator oopsprofile-generator">
|
| 16 |
+
<div class="entry-edit-head">
|
| 17 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__("File Information") ?></h4>
|
| 18 |
+
</div>
|
| 19 |
+
<fieldset>
|
| 20 |
+
<legend><?php echo $this->__("File Information") ?></legend>
|
| 21 |
+
<span class="field-row">
|
| 22 |
+
<label for="profile_data_transfer"><?php echo $this->__("Profile Way:") ?></label>
|
| 23 |
+
<?php $wayTypes = Mage::helper('oopsprofile')->wayTypeArray()?>
|
| 24 |
+
<select id="profile_data_transfer" name="data_transfer" onchange="showOption(this);updateRun(this)" class="option-control">
|
| 25 |
+
<?php foreach($wayTypes as $waykey=>$wayvalue):?>
|
| 26 |
+
<option value="<?php echo $waykey?>" <?php echo $this->getSelected('data_transfer', $waykey) ?>><?php echo $wayvalue ?></option>
|
| 27 |
+
<?php endforeach;?>
|
| 28 |
+
</select>
|
| 29 |
+
</span>
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
<?php
|
| 33 |
+
$id = $profile->getId();//Current Profile Id
|
| 34 |
+
$format = $this->getValue('gui_data/parse/type');
|
| 35 |
+
$entityType = $this->getValue('entity_type');
|
| 36 |
+
?>
|
| 37 |
+
|
| 38 |
+
<?php $exportFile = Mage::getBaseDir().'/httpexport/export_'.$entityType.'_'.$id.'.'.$format;?>
|
| 39 |
+
|
| 40 |
+
<!--If profile way is Http-->
|
| 41 |
+
<div class="profile_data_transfer_http" style="display:none;">
|
| 42 |
+
<span class="field-row">
|
| 43 |
+
<label for="file_type"><?php echo $this->__("Export Data:") ?></label>
|
| 44 |
+
<?php if(glob($exportFile)):?>
|
| 45 |
+
<a target ="_blank" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).'httpexport/export_'.$entityType.'_'.$id.'.'.$format?>"><?php echo $this->__('Click to export')?></a>
|
| 46 |
+
<?php else:?>
|
| 47 |
+
<small>
|
| 48 |
+
<?php echo $this->__('(First you need to save and run the profile in order to export it)') ?>
|
| 49 |
+
</small>
|
| 50 |
+
<?php endif;?>
|
| 51 |
+
</span>
|
| 52 |
+
<span class="field-row">
|
| 53 |
+
<?php if(glob($exportFile)):?>
|
| 54 |
+
<small>
|
| 55 |
+
<?php echo $this->__('(First you need to save and run the profile in order to export new data)') ?>
|
| 56 |
+
</small>
|
| 57 |
+
<?php endif;?>
|
| 58 |
+
</span>
|
| 59 |
+
</div>
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
<!--File Type Local/FTP/SFTP-->
|
| 63 |
+
<div class="profile_data_transfer_file">
|
| 64 |
+
<span class="field-row">
|
| 65 |
+
<label for="file_type"><?php echo $this->__("Type:") ?></label>
|
| 66 |
+
<select id="file_type" name="gui_data[file][type]" onchange="showOption(this)" class="option-control">
|
| 67 |
+
<option value="file" <?php echo $this->getSelected('gui_data/file/type', 'file') ?>><?php echo $this->__("Local Server") ?></option>
|
| 68 |
+
<!--option value="ftp" <?php //echo $this->getSelected('gui_data/file/type', 'ftp') ?>><?php echo $this->__("Remote FTP") ?></option>
|
| 69 |
+
<option value="sftp" <?php //echo $this->getSelected('gui_data/file/type', 'sftp') ?>><?php echo $this->__("Remote SFTP") ?></option-->
|
| 70 |
+
</select>
|
| 71 |
+
</span>
|
| 72 |
+
<span class="field-row">
|
| 73 |
+
<label for="file_filename"><?php echo $this->__("File name:") ?></label>
|
| 74 |
+
<input class="input-text" id="file_filename" name="gui_data[file][filename]" value="<?php echo $this->getValue('gui_data/file/filename') ?>"/>
|
| 75 |
+
</span>
|
| 76 |
+
<span class="field-row">
|
| 77 |
+
<label for="file_path"><?php echo $this->__("Path:") ?></label>
|
| 78 |
+
<span class="with-tip">
|
| 79 |
+
<input class="input-text" id="file_path" name="gui_data[file][path]" value="<?php echo $this->getValue('gui_data/file/path') ?>"/>
|
| 80 |
+
<small class="file_type_file">
|
| 81 |
+
<?php echo $this->__('(For Type "Local Server" need to use relative path to Magento install var/export or var/import, e.g. var/export, var/import, var/export/some/dir, var/import/some/dir)') ?>
|
| 82 |
+
</small>
|
| 83 |
+
</span>
|
| 84 |
+
</span>
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
</div>
|
| 89 |
+
|
| 90 |
+
</fieldset>
|
| 91 |
+
</div>
|
app/design/adminhtml/default/default/template/oopsprofile/run.phtml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<script type="text/javascript">
|
| 2 |
+
function runProfile(popup)
|
| 3 |
+
{
|
| 4 |
+
var url = "<?php echo $this->getUrl('*/*/run', array('id'=>$this->getProfileId())) ?>";
|
| 5 |
+
if ($('profile_direction') != undefined
|
| 6 |
+
&& $('profile_data_transfer') != undefined
|
| 7 |
+
&& getDirection() == 'import' && getTransferType() == 'interactive') {
|
| 8 |
+
var file = getSelectedFiles();
|
| 9 |
+
if (file == '') {
|
| 10 |
+
alert('Please select imported files');
|
| 11 |
+
$('file_list').show();
|
| 12 |
+
return false;
|
| 13 |
+
}
|
| 14 |
+
url += 'files/' + file + '/';
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
if (!popup) {
|
| 18 |
+
$('run_iframe').style.display = 'block';
|
| 19 |
+
$('run_iframe').src = url;
|
| 20 |
+
} else {
|
| 21 |
+
window.open(url);
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
function getDirection()
|
| 26 |
+
{
|
| 27 |
+
return $('profile_direction').options[$('profile_direction').options.selectedIndex].value;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
function getSelectedFiles()
|
| 31 |
+
{
|
| 32 |
+
return $('files').options[$('files').options.selectedIndex].value;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
function getTransferType()
|
| 36 |
+
{
|
| 37 |
+
return $('profile_data_transfer').options[$('profile_data_transfer').options.selectedIndex].value;
|
| 38 |
+
}
|
| 39 |
+
</script>
|
| 40 |
+
<ul class="messages">
|
| 41 |
+
<li class="notice-msg">
|
| 42 |
+
<ul>
|
| 43 |
+
<li><?php echo $this->__('Please make sure that your changes were saved before running the profile.') ?></li>
|
| 44 |
+
</ul>
|
| 45 |
+
</li>
|
| 46 |
+
</ul>
|
| 47 |
+
<div id="file_list" style="display: none;">
|
| 48 |
+
<select id="files" name="files">
|
| 49 |
+
<option value="">Select a file</option>
|
| 50 |
+
<?php if ($files = $this->getImportedFiles()) :
|
| 51 |
+
foreach ($files as $file) : ?>
|
| 52 |
+
<option value=<?php echo $file ?>><?php echo $file ?></option>
|
| 53 |
+
<?php endforeach;
|
| 54 |
+
endif; ?>
|
| 55 |
+
</select>
|
| 56 |
+
<br />
|
| 57 |
+
</div>
|
| 58 |
+
|
| 59 |
+
<?php echo $this->getRunButtonHtml() ?><br/>
|
| 60 |
+
<iframe id="run_iframe" src="<?php echo $this->getJsUrl() ?>blank.html" frameborder=0 style="display:none; width:100%; height:400px;"></iframe>
|
app/etc/modules/PI_Oopsprofile.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?xml version='1.0'?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<PI_Oopsprofile>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</PI_Oopsprofile>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>PI_Oopsprofile</name>
|
| 4 |
+
<version>0.2.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>This extension is used for import/export products and customers.</summary>
|
| 10 |
+
<description>You can import/export the product and customer, you can modify already created products and customers.
|
| 11 |
+

|
| 12 |
+
You can apply multiple filters on import/export.</description>
|
| 13 |
+
<notes>This is a stable version.</notes>
|
| 14 |
+
<authors><author><name>pureimagination</name><user>pureimagination</user><email>johncarter15oct@gmail.com</email></author></authors>
|
| 15 |
+
<date>2015-06-30</date>
|
| 16 |
+
<time>16:49:25</time>
|
| 17 |
+
<contents><target name="magecommunity"><dir name="PI"><dir name="Oopsprofile"><dir name="Block"><dir name="Adminhtml"><dir name="Oopsprofile"><dir name="Edit"><file name="Form.php" hash="534d9238c1c1169f171cefc143cd532c"/><dir name="Tab"><file name="General.php" hash="a1490439063558339421fed71ca163d8"/><file name="Profilefilter.php" hash="c9a9ebba4f6d4c536fe75b4e50f37aa0"/><file name="Profiletemplate.php" hash="0b7fd1d437c667b5550b6fc608021c15"/><file name="Profileway.php" hash="94661a0e5563310ffe00940bb347a37d"/><file name="Run.php" hash="9c381f19c551e4825dc7876e41f358b3"/></dir><file name="Tabs.php" hash="61acb9c7f53ad676064c652ecf67a600"/></dir><file name="Edit.php" hash="c0c72bdd839637dafcde6cc6255e60bd"/><file name="Grid.php" hash="3bd2003dbbb6f335a2f668e0ce0868f9"/></dir><file name="Oopsprofile.php" hash="d261d42999938b0bed5af86ddaa9d5a9"/><dir name="Renderer"><file name="Parsetype.php" hash="3e0ec2054c70150c865e72a81d4d54a8"/><file name="Way.php" hash="e9b03cdd37a1982c418f3fb5fa8a5ce2"/></dir><file name="Run.php" hash="8dc6268ca9f17c39aa54bd7378610288"/><dir name="System"><dir name="Config"><dir name="Cron"><file name="Schedule.php" hash="ee849230bf2a8d21b7baa6c76e535f73"/></dir></dir><dir name="Convert"><dir name="Gui"><file name="Grid.php" hash="1cd93532ba131ea2d72695857756ca4f"/></dir></dir></dir></dir><dir name="Rule"><file name="Conditions.php" hash="50a80dafc55faddd1f50702eba273d8f"/></dir></dir><dir name="Helper"><file name="Data.php" hash="47d64850728e40b32e421e7b9ad00075"/><file name="Mail.php" hash="930ec7a8d31dd295679260a1e983ad2b"/><file name="Table.php" hash="c4467fce95a28214bc257576f1ce1515"/></dir><dir name="Model"><dir name="Convert"><dir name="Adapter"><file name="Api.php" hash="20c81eae28079f6a9d32f5e7e98d12d7"/><file name="Http.php" hash="63f90085688f6efc703a9ce9ef9a467a"/><file name="Io.php" hash="1c521a8a9557e06b057f7c4a279b6165"/><file name="Mail.php" hash="1796baf8c8599ab15d92bd08c7c50645"/></dir><dir name="Parser"><file name="Csv.php" hash="f6c2094d2675fa6d0ce62be18592b4ea"/><file name="Txt.php" hash="efba02ca7438a4cdbbbf1f990352a65b"/></dir></dir><file name="Createapiobserver.php" hash="835f37d42809b38e18e414a44526caed"/><file name="CronObserver.php" hash="feeaf7562b492fd67762fcd27796b301"/><dir name="Customergroup"><dir name="Convert"><dir name="Adapter"><file name="Customergroup.php" hash="36dfc61af8bb5d684c7f56ea86191207"/></dir><dir name="Parser"><file name="Customergroup.php" hash="708f6e767a0b5166fd92e9b47453e811"/></dir></dir></dir><dir name="Dataflow"><dir name="Batch"><file name="Io.php" hash="5cd25bb53453a892b85163a16797ec55"/></dir><dir name="Convert"><dir name="Mapper"><file name="Column.php" hash="6762f0c5c9e8683bc374646d9e4ea1f4"/></dir></dir><dir name="Profile"><file name="History.php" hash="3637b0b9618bfdaf62f52f487ee407ee"/></dir><file name="Profile.php" hash="cb00b63b2246abd68d56c1e6a24b394d"/></dir><file name="Mail.php" hash="c54b158ac4fa37725561f272ce2a5abc"/><dir name="Mysql4"><dir name="Oopsprofile"><file name="Collection.php" hash="a1237c9b3c43dd479010db3e00e699f6"/></dir><file name="Oopsprofile.php" hash="f153b86e7299cbf680bd6870e2c1f757"/></dir><file name="Oopsprofile.php" hash="e95d66ebafedeb5235ff0687c151a2c4"/><file name="Oopsprofileapi.php" hash="fffd75599d5489ab091def50d586d5cb"/><dir name="Product"><dir name="Convert"><dir name="Adapter"><file name="Product.php" hash="06d71f01d5c9d5d744e6e227791fb902"/></dir><dir name="Parser"><file name="Product.php" hash="e15fc0158a0416a5872ed14eef7742c4"/></dir></dir></dir><dir name="Rule"><dir name="Condition"><file name="Combine.php" hash="57bb6de822f5b99838cd125cd296c24a"/><file name="Product.php" hash="a00b80416c8023540216ba6024b0db95"/></dir></dir><file name="Rule.php" hash="1d9ee949e5d40eb6b93233a9ea45e8d7"/><dir name="Varien"><dir name="Io"><file name="Sftp.php" hash="cc52ff838ee5b053db26ceeef31af2e1"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="OopsprofileController.php" hash="9c7f1fce3d4629cff921798ca133047a"/></dir><file name="ApiController.php" hash="7bb98fe7ad90cf37112ba291a84f5174"/><file name="OopsprofileController.php" hash="ea9099c36c8f11cfe9a44c207c71832e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7b73ae59d4ede142d27b350a15629dd3"/><file name="config.xml" hash="9e9252241529e8a515e1d73f0e6b7572"/></dir><dir name="sql"><dir name="oopsprofile_setup"><file name="mysql4-install-0.1.0.php" hash="476db9cbc5d76bdc3c072e5c853b539c"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="9e452cf7dd0f468643593bddf3a9b763"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="3fb8f054e4ca4a866119a7e0ea7dfafc"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="d0a6719a71595a9608a3c3ab01b70864"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="bd64dd63493d3942ad8d2e0dd196ef35"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="e60deecbe99c6b6358fd5df3b3fbe4c4"/><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="fb2f0c979bd33031e1aa0e88d952a752"/><file name="mysql4-upgrade-0.1.6-0.1.7.php" hash="962bed7a1700bbc67450b701ada2a727"/><file name="mysql4-upgrade-0.1.7-0.1.8.php" hash="3109963b5b9f41ce7e504dc4e243aa48"/><file name="mysql4-upgrade-0.1.8-0.1.9.php" hash="fde1ca360448f9b59e51d55318dbce5d"/><file name="mysql4-upgrade-0.1.9-0.2.0.php" hash="1a95e7320b6bb2403d7df877b0b9eddb"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PI_Oopsprofile.xml" hash="bad7e8d5c5ddd0ff923477c902ed45df"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="oopsprofile.xml" hash="1366038b071066dd8a84d49b0a9873d4"/></dir><dir name="template"><dir name="oopsprofile"><file name="general.phtml" hash="067de0749f31aa072d5e0feee4d3fb38"/><file name="process.phtml" hash="f7de91b086c11d8be57e263d545475d6"/><file name="profilefilter.phtml" hash="c00fd9c9267e6bcb748474fb0a57ce80"/><file name="profiletemplate.phtml" hash="20af0543349b3be20ca51018b03e68bb"/><file name="profileway.phtml" hash="5e23c614d141f993450a86a4ab67b947"/><file name="run.phtml" hash="8491131da271e47548965cd690177be2"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="oopsprofile"><dir name="css"><file name="jquery-ui-1.8.12.custom.css" hash="f3ccac687d0596fdd2b49c095b77e3db"/><file name="jquery.checkboxtree.css" hash="6a1d1006d5a32d35428e0cfbaf68928b"/><file name="oopsprofile.css" hash="6bd27abb355a93489d220f2757798c6b"/></dir><dir name="images"><file name="ui-bg_flat_0_aaaaaa_40x100.png" hash="2a44fbdb7360c60122bcf6dcef0387d8"/><file name="ui-bg_flat_75_ffffff_40x100.png" hash="8692e6efddf882acbff144c38ea7dfdf"/><file name="ui-bg_glass_55_fbf9ee_1x400.png" hash="f8f4558e0b92ff2cd6136781533902ec"/><file name="ui-bg_glass_65_ffffff_1x400.png" hash="e5a8f32e28fd5c27bf0fed33c8a8b9b5"/><file name="ui-bg_glass_75_dadada_1x400.png" hash="c12c6510dad3ebfa64c8a30e959a2469"/><file name="ui-bg_glass_75_e6e6e6_1x400.png" hash="f4254356c2a8c9a383205ef2c4de22c4"/><file name="ui-bg_glass_95_fef1ec_1x400.png" hash="5a3be2d8fff8324d59aec3df7b0a0c83"/><file name="ui-bg_highlight-soft_75_cccccc_1x100.png" hash="72c593d16e998952cd8d798fee33c6f3"/><file name="ui-icons_222222_256x240.png" hash="ebe6b6902a408fbf9cac6379a1477525"/><file name="ui-icons_2e83ff_256x240.png" hash="2b99a5e48d3c3957d03027d36a25e8bb"/><file name="ui-icons_454545_256x240.png" hash="119dd0c2e94ad689de873ef39fd43e6e"/><file name="ui-icons_888888_256x240.png" hash="9c46d7cab43e22a14bad26d2d4806d80"/><file name="ui-icons_cd0a0a_256x240.png" hash="3e450c2a2c66328d9498e7001ad7197c"/></dir><dir name="js"><file name="jquery-1.4.4.js" hash="30c7c15a666b9f75a9f58478608fc7e4"/><file name="jquery-ui-1.8.12.custom.min.js" hash="8bd7da990811d5b776243a81cac3d848"/><file name="jquery.checkboxtree.js" hash="0dcb00d6af53617f9d9e0f69028228af"/></dir></dir></dir></dir></dir></target></contents>
|
| 18 |
+
<compatible/>
|
| 19 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 20 |
+
</package>
|
skin/adminhtml/default/default/oopsprofile/css/jquery-ui-1.8.12.custom.css
ADDED
|
@@ -0,0 +1,578 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|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Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
/*
|
| 2 |
+
* jQuery UI CSS Framework 1.8.12
|
| 3 |
+
*
|
| 4 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 6 |
+
* http://jquery.org/license
|
| 7 |
+
*
|
| 8 |
+
* http://docs.jquery.com/UI/Theming/API
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
/* Layout helpers
|
| 12 |
+
----------------------------------*/
|
| 13 |
+
.ui-helper-hidden { display: none; }
|
| 14 |
+
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
|
| 15 |
+
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
| 16 |
+
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
| 17 |
+
.ui-helper-clearfix { display: inline-block; }
|
| 18 |
+
/* required comment for clearfix to work in Opera \*/
|
| 19 |
+
* html .ui-helper-clearfix { height:1%; }
|
| 20 |
+
.ui-helper-clearfix { display:block; }
|
| 21 |
+
/* end clearfix */
|
| 22 |
+
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
/* Interaction Cues
|
| 26 |
+
----------------------------------*/
|
| 27 |
+
.ui-state-disabled { cursor: default !important; }
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
/* Icons
|
| 31 |
+
----------------------------------*/
|
| 32 |
+
|
| 33 |
+
/* states and images */
|
| 34 |
+
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
/* Misc visuals
|
| 38 |
+
----------------------------------*/
|
| 39 |
+
|
| 40 |
+
/* Overlays */
|
| 41 |
+
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
/*
|
| 45 |
+
* jQuery UI CSS Framework 1.8.12
|
| 46 |
+
*
|
| 47 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 48 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 49 |
+
* http://jquery.org/license
|
| 50 |
+
*
|
| 51 |
+
* http://docs.jquery.com/UI/Theming/API
|
| 52 |
+
*
|
| 53 |
+
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
|
| 54 |
+
*/
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
/* Component containers
|
| 58 |
+
----------------------------------*/
|
| 59 |
+
.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
|
| 60 |
+
.ui-widget .ui-widget { font-size: 1em; }
|
| 61 |
+
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
|
| 62 |
+
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(../images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
|
| 63 |
+
.ui-widget-content a { color: #222222; }
|
| 64 |
+
.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(../images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
|
| 65 |
+
.ui-widget-header a { color: #222222; }
|
| 66 |
+
|
| 67 |
+
/* Interaction states
|
| 68 |
+
----------------------------------*/
|
| 69 |
+
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(../images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
|
| 70 |
+
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
|
| 71 |
+
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(../images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
|
| 72 |
+
.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
|
| 73 |
+
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(../images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
|
| 74 |
+
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
|
| 75 |
+
.ui-widget :active { outline: none; }
|
| 76 |
+
|
| 77 |
+
/* Interaction Cues
|
| 78 |
+
----------------------------------*/
|
| 79 |
+
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(../images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
|
| 80 |
+
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
|
| 81 |
+
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(../images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
|
| 82 |
+
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
|
| 83 |
+
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
|
| 84 |
+
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
|
| 85 |
+
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
| 86 |
+
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
| 87 |
+
|
| 88 |
+
/* Icons
|
| 89 |
+
----------------------------------*/
|
| 90 |
+
|
| 91 |
+
/* states and images */
|
| 92 |
+
.ui-icon { width: 16px; height: 16px; background-image: url(../images/ui-icons_222222_256x240.png); }
|
| 93 |
+
.ui-widget-content .ui-icon {background-image: url(../images/ui-icons_222222_256x240.png); }
|
| 94 |
+
.ui-widget-header .ui-icon {background-image: url(../images/ui-icons_222222_256x240.png); }
|
| 95 |
+
.ui-state-default .ui-icon { background-image: url(../images/ui-icons_888888_256x240.png); }
|
| 96 |
+
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(../images/ui-icons_454545_256x240.png); }
|
| 97 |
+
.ui-state-active .ui-icon {background-image: url(../images/ui-icons_454545_256x240.png); }
|
| 98 |
+
.ui-state-highlight .ui-icon {background-image: url(../images/ui-icons_2e83ff_256x240.png); }
|
| 99 |
+
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(../images/ui-icons_cd0a0a_256x240.png); }
|
| 100 |
+
|
| 101 |
+
/* positioning */
|
| 102 |
+
.ui-icon-carat-1-n { background-position: 0 0; }
|
| 103 |
+
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
| 104 |
+
.ui-icon-carat-1-e { background-position: -32px 0; }
|
| 105 |
+
.ui-icon-carat-1-se { background-position: -48px 0; }
|
| 106 |
+
.ui-icon-carat-1-s { background-position: -64px 0; }
|
| 107 |
+
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
| 108 |
+
.ui-icon-carat-1-w { background-position: -96px 0; }
|
| 109 |
+
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
| 110 |
+
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
| 111 |
+
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
| 112 |
+
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
| 113 |
+
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
| 114 |
+
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
| 115 |
+
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
| 116 |
+
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
| 117 |
+
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
| 118 |
+
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
| 119 |
+
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
| 120 |
+
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
| 121 |
+
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
| 122 |
+
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
| 123 |
+
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
| 124 |
+
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
| 125 |
+
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
| 126 |
+
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
| 127 |
+
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
| 128 |
+
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
| 129 |
+
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
| 130 |
+
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
| 131 |
+
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
| 132 |
+
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
| 133 |
+
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
| 134 |
+
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
| 135 |
+
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
| 136 |
+
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
| 137 |
+
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
| 138 |
+
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
| 139 |
+
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
| 140 |
+
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
| 141 |
+
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
| 142 |
+
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
| 143 |
+
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
| 144 |
+
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
| 145 |
+
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
| 146 |
+
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
| 147 |
+
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
| 148 |
+
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
| 149 |
+
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
| 150 |
+
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
| 151 |
+
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
| 152 |
+
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
| 153 |
+
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
| 154 |
+
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
| 155 |
+
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
| 156 |
+
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
| 157 |
+
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
| 158 |
+
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
| 159 |
+
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
| 160 |
+
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
| 161 |
+
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
| 162 |
+
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
| 163 |
+
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
| 164 |
+
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
| 165 |
+
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
| 166 |
+
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
| 167 |
+
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
| 168 |
+
.ui-icon-extlink { background-position: -32px -80px; }
|
| 169 |
+
.ui-icon-newwin { background-position: -48px -80px; }
|
| 170 |
+
.ui-icon-refresh { background-position: -64px -80px; }
|
| 171 |
+
.ui-icon-shuffle { background-position: -80px -80px; }
|
| 172 |
+
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
| 173 |
+
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
| 174 |
+
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
| 175 |
+
.ui-icon-folder-open { background-position: -16px -96px; }
|
| 176 |
+
.ui-icon-document { background-position: -32px -96px; }
|
| 177 |
+
.ui-icon-document-b { background-position: -48px -96px; }
|
| 178 |
+
.ui-icon-note { background-position: -64px -96px; }
|
| 179 |
+
.ui-icon-mail-closed { background-position: -80px -96px; }
|
| 180 |
+
.ui-icon-mail-open { background-position: -96px -96px; }
|
| 181 |
+
.ui-icon-suitcase { background-position: -112px -96px; }
|
| 182 |
+
.ui-icon-comment { background-position: -128px -96px; }
|
| 183 |
+
.ui-icon-person { background-position: -144px -96px; }
|
| 184 |
+
.ui-icon-print { background-position: -160px -96px; }
|
| 185 |
+
.ui-icon-trash { background-position: -176px -96px; }
|
| 186 |
+
.ui-icon-locked { background-position: -192px -96px; }
|
| 187 |
+
.ui-icon-unlocked { background-position: -208px -96px; }
|
| 188 |
+
.ui-icon-bookmark { background-position: -224px -96px; }
|
| 189 |
+
.ui-icon-tag { background-position: -240px -96px; }
|
| 190 |
+
.ui-icon-home { background-position: 0 -112px; }
|
| 191 |
+
.ui-icon-flag { background-position: -16px -112px; }
|
| 192 |
+
.ui-icon-calendar { background-position: -32px -112px; }
|
| 193 |
+
.ui-icon-cart { background-position: -48px -112px; }
|
| 194 |
+
.ui-icon-pencil { background-position: -64px -112px; }
|
| 195 |
+
.ui-icon-clock { background-position: -80px -112px; }
|
| 196 |
+
.ui-icon-disk { background-position: -96px -112px; }
|
| 197 |
+
.ui-icon-calculator { background-position: -112px -112px; }
|
| 198 |
+
.ui-icon-zoomin { background-position: -128px -112px; }
|
| 199 |
+
.ui-icon-zoomout { background-position: -144px -112px; }
|
| 200 |
+
.ui-icon-search { background-position: -160px -112px; }
|
| 201 |
+
.ui-icon-wrench { background-position: -176px -112px; }
|
| 202 |
+
.ui-icon-gear { background-position: -192px -112px; }
|
| 203 |
+
.ui-icon-heart { background-position: -208px -112px; }
|
| 204 |
+
.ui-icon-star { background-position: -224px -112px; }
|
| 205 |
+
.ui-icon-link { background-position: -240px -112px; }
|
| 206 |
+
.ui-icon-cancel { background-position: 0 -128px; }
|
| 207 |
+
.ui-icon-plus { background-position: -16px -128px; }
|
| 208 |
+
.ui-icon-plusthick { background-position: -32px -128px; }
|
| 209 |
+
.ui-icon-minus { background-position: -48px -128px; }
|
| 210 |
+
.ui-icon-minusthick { background-position: -64px -128px; }
|
| 211 |
+
.ui-icon-close { background-position: -80px -128px; }
|
| 212 |
+
.ui-icon-closethick { background-position: -96px -128px; }
|
| 213 |
+
.ui-icon-key { background-position: -112px -128px; }
|
| 214 |
+
.ui-icon-lightbulb { background-position: -128px -128px; }
|
| 215 |
+
.ui-icon-scissors { background-position: -144px -128px; }
|
| 216 |
+
.ui-icon-clipboard { background-position: -160px -128px; }
|
| 217 |
+
.ui-icon-copy { background-position: -176px -128px; }
|
| 218 |
+
.ui-icon-contact { background-position: -192px -128px; }
|
| 219 |
+
.ui-icon-image { background-position: -208px -128px; }
|
| 220 |
+
.ui-icon-video { background-position: -224px -128px; }
|
| 221 |
+
.ui-icon-script { background-position: -240px -128px; }
|
| 222 |
+
.ui-icon-alert { background-position: 0 -144px; }
|
| 223 |
+
.ui-icon-info { background-position: -16px -144px; }
|
| 224 |
+
.ui-icon-notice { background-position: -32px -144px; }
|
| 225 |
+
.ui-icon-help { background-position: -48px -144px; }
|
| 226 |
+
.ui-icon-check { background-position: -64px -144px; }
|
| 227 |
+
.ui-icon-bullet { background-position: -80px -144px; }
|
| 228 |
+
.ui-icon-radio-off { background-position: -96px -144px; }
|
| 229 |
+
.ui-icon-radio-on { background-position: -112px -144px; }
|
| 230 |
+
.ui-icon-pin-w { background-position: -128px -144px; }
|
| 231 |
+
.ui-icon-pin-s { background-position: -144px -144px; }
|
| 232 |
+
.ui-icon-play { background-position: 0 -160px; }
|
| 233 |
+
.ui-icon-pause { background-position: -16px -160px; }
|
| 234 |
+
.ui-icon-seek-next { background-position: -32px -160px; }
|
| 235 |
+
.ui-icon-seek-prev { background-position: -48px -160px; }
|
| 236 |
+
.ui-icon-seek-end { background-position: -64px -160px; }
|
| 237 |
+
.ui-icon-seek-start { background-position: -80px -160px; }
|
| 238 |
+
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
|
| 239 |
+
.ui-icon-seek-first { background-position: -80px -160px; }
|
| 240 |
+
.ui-icon-stop { background-position: -96px -160px; }
|
| 241 |
+
.ui-icon-eject { background-position: -112px -160px; }
|
| 242 |
+
.ui-icon-volume-off { background-position: -128px -160px; }
|
| 243 |
+
.ui-icon-volume-on { background-position: -144px -160px; }
|
| 244 |
+
.ui-icon-power { background-position: 0 -176px; }
|
| 245 |
+
.ui-icon-signal-diag { background-position: -16px -176px; }
|
| 246 |
+
.ui-icon-signal { background-position: -32px -176px; }
|
| 247 |
+
.ui-icon-battery-0 { background-position: -48px -176px; }
|
| 248 |
+
.ui-icon-battery-1 { background-position: -64px -176px; }
|
| 249 |
+
.ui-icon-battery-2 { background-position: -80px -176px; }
|
| 250 |
+
.ui-icon-battery-3 { background-position: -96px -176px; }
|
| 251 |
+
.ui-icon-circle-plus { background-position: 0 -192px; }
|
| 252 |
+
.ui-icon-circle-minus { background-position: -16px -192px; }
|
| 253 |
+
.ui-icon-circle-close { background-position: -32px -192px; }
|
| 254 |
+
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
| 255 |
+
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
| 256 |
+
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
| 257 |
+
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
| 258 |
+
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
| 259 |
+
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
| 260 |
+
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
| 261 |
+
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
| 262 |
+
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
| 263 |
+
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
| 264 |
+
.ui-icon-circle-check { background-position: -208px -192px; }
|
| 265 |
+
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
| 266 |
+
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
| 267 |
+
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
| 268 |
+
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
| 269 |
+
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
| 270 |
+
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
| 271 |
+
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
| 272 |
+
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
| 273 |
+
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
| 274 |
+
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
| 275 |
+
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
| 276 |
+
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
| 277 |
+
|
| 278 |
+
|
| 279 |
+
/* Misc visuals
|
| 280 |
+
----------------------------------*/
|
| 281 |
+
|
| 282 |
+
/* Corner radius */
|
| 283 |
+
.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }
|
| 284 |
+
.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
|
| 285 |
+
.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
|
| 286 |
+
.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
|
| 287 |
+
.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
|
| 288 |
+
.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
|
| 289 |
+
.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
|
| 290 |
+
.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
|
| 291 |
+
.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
|
| 292 |
+
|
| 293 |
+
/* Overlays */
|
| 294 |
+
.ui-widget-overlay { background: #aaaaaa url(../images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
|
| 295 |
+
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(../images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
|
| 296 |
+
* jQuery UI Resizable 1.8.12
|
| 297 |
+
*
|
| 298 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 299 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 300 |
+
* http://jquery.org/license
|
| 301 |
+
*
|
| 302 |
+
* http://docs.jquery.com/UI/Resizable#theming
|
| 303 |
+
*/
|
| 304 |
+
.ui-resizable { position: relative;}
|
| 305 |
+
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;
|
| 306 |
+
/* http://bugs.jqueryui.com/ticket/7233
|
| 307 |
+
- Resizable: resizable handles fail to work in IE if transparent and content overlaps
|
| 308 |
+
*/
|
| 309 |
+
background-image:url(data:);
|
| 310 |
+
}
|
| 311 |
+
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
|
| 312 |
+
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
|
| 313 |
+
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
|
| 314 |
+
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
|
| 315 |
+
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
|
| 316 |
+
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
|
| 317 |
+
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
|
| 318 |
+
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
|
| 319 |
+
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
|
| 320 |
+
* jQuery UI Selectable 1.8.12
|
| 321 |
+
*
|
| 322 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 323 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 324 |
+
* http://jquery.org/license
|
| 325 |
+
*
|
| 326 |
+
* http://docs.jquery.com/UI/Selectable#theming
|
| 327 |
+
*/
|
| 328 |
+
.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
|
| 329 |
+
/*
|
| 330 |
+
* jQuery UI Accordion 1.8.12
|
| 331 |
+
*
|
| 332 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 333 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 334 |
+
* http://jquery.org/license
|
| 335 |
+
*
|
| 336 |
+
* http://docs.jquery.com/UI/Accordion#theming
|
| 337 |
+
*/
|
| 338 |
+
/* IE/Win - Fix animation bug - #4615 */
|
| 339 |
+
.ui-accordion { width: 100%; }
|
| 340 |
+
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
|
| 341 |
+
.ui-accordion .ui-accordion-li-fix { display: inline; }
|
| 342 |
+
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
|
| 343 |
+
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
|
| 344 |
+
.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
|
| 345 |
+
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
|
| 346 |
+
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
|
| 347 |
+
.ui-accordion .ui-accordion-content-active { display: block; }
|
| 348 |
+
/*
|
| 349 |
+
* jQuery UI Autocomplete 1.8.12
|
| 350 |
+
*
|
| 351 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 352 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 353 |
+
* http://jquery.org/license
|
| 354 |
+
*
|
| 355 |
+
* http://docs.jquery.com/UI/Autocomplete#theming
|
| 356 |
+
*/
|
| 357 |
+
.ui-autocomplete { position: absolute; cursor: default; }
|
| 358 |
+
|
| 359 |
+
/* workarounds */
|
| 360 |
+
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
|
| 361 |
+
|
| 362 |
+
/*
|
| 363 |
+
* jQuery UI Menu 1.8.12
|
| 364 |
+
*
|
| 365 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
| 366 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 367 |
+
* http://jquery.org/license
|
| 368 |
+
*
|
| 369 |
+
* http://docs.jquery.com/UI/Menu#theming
|
| 370 |
+
*/
|
| 371 |
+
.ui-menu {
|
| 372 |
+
list-style:none;
|
| 373 |
+
padding: 2px;
|
| 374 |
+
margin: 0;
|
| 375 |
+
display:block;
|
| 376 |
+
float: left;
|
| 377 |
+
}
|
| 378 |
+
.ui-menu .ui-menu {
|
| 379 |
+
margin-top: -3px;
|
| 380 |
+
}
|
| 381 |
+
.ui-menu .ui-menu-item {
|
| 382 |
+
margin:0;
|
| 383 |
+
padding: 0;
|
| 384 |
+
zoom: 1;
|
| 385 |
+
float: left;
|
| 386 |
+
clear: left;
|
| 387 |
+
width: 100%;
|
| 388 |
+
}
|
| 389 |
+
.ui-menu .ui-menu-item a {
|
| 390 |
+
text-decoration:none;
|
| 391 |
+
display:block;
|
| 392 |
+
padding:.2em .4em;
|
| 393 |
+
line-height:1.5;
|
| 394 |
+
zoom:1;
|
| 395 |
+
}
|
| 396 |
+
.ui-menu .ui-menu-item a.ui-state-hover,
|
| 397 |
+
.ui-menu .ui-menu-item a.ui-state-active {
|
| 398 |
+
font-weight: normal;
|
| 399 |
+
margin: -1px;
|
| 400 |
+
}
|
| 401 |
+
/*
|
| 402 |
+
* jQuery UI Button 1.8.12
|
| 403 |
+
*
|
| 404 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 405 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 406 |
+
* http://jquery.org/license
|
| 407 |
+
*
|
| 408 |
+
* http://docs.jquery.com/UI/Button#theming
|
| 409 |
+
*/
|
| 410 |
+
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
|
| 411 |
+
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
|
| 412 |
+
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
|
| 413 |
+
.ui-button-icons-only { width: 3.4em; }
|
| 414 |
+
button.ui-button-icons-only { width: 3.7em; }
|
| 415 |
+
|
| 416 |
+
/*button text element */
|
| 417 |
+
.ui-button .ui-button-text { display: block; line-height: 1.4; }
|
| 418 |
+
.ui-button-text-only .ui-button-text { padding: .4em 1em; }
|
| 419 |
+
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
|
| 420 |
+
.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
|
| 421 |
+
.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
|
| 422 |
+
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
|
| 423 |
+
/* no icon support for input elements, provide padding by default */
|
| 424 |
+
input.ui-button { padding: .4em 1em; }
|
| 425 |
+
|
| 426 |
+
/*button icon element(s) */
|
| 427 |
+
.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
|
| 428 |
+
.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
|
| 429 |
+
.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
|
| 430 |
+
.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
| 431 |
+
.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
| 432 |
+
|
| 433 |
+
/*button sets*/
|
| 434 |
+
.ui-buttonset { margin-right: 7px; }
|
| 435 |
+
.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
|
| 436 |
+
|
| 437 |
+
/* workarounds */
|
| 438 |
+
button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
|
| 439 |
+
/*
|
| 440 |
+
* jQuery UI Dialog 1.8.12
|
| 441 |
+
*
|
| 442 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 443 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 444 |
+
* http://jquery.org/license
|
| 445 |
+
*
|
| 446 |
+
* http://docs.jquery.com/UI/Dialog#theming
|
| 447 |
+
*/
|
| 448 |
+
.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
|
| 449 |
+
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
|
| 450 |
+
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
|
| 451 |
+
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
|
| 452 |
+
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
|
| 453 |
+
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
|
| 454 |
+
.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
|
| 455 |
+
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
|
| 456 |
+
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
|
| 457 |
+
.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
|
| 458 |
+
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
|
| 459 |
+
.ui-draggable .ui-dialog-titlebar { cursor: move; }
|
| 460 |
+
/*
|
| 461 |
+
* jQuery UI Slider 1.8.12
|
| 462 |
+
*
|
| 463 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 464 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 465 |
+
* http://jquery.org/license
|
| 466 |
+
*
|
| 467 |
+
* http://docs.jquery.com/UI/Slider#theming
|
| 468 |
+
*/
|
| 469 |
+
.ui-slider { position: relative; text-align: left; }
|
| 470 |
+
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
|
| 471 |
+
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
|
| 472 |
+
|
| 473 |
+
.ui-slider-horizontal { height: .8em; }
|
| 474 |
+
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
|
| 475 |
+
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
|
| 476 |
+
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
|
| 477 |
+
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
|
| 478 |
+
|
| 479 |
+
.ui-slider-vertical { width: .8em; height: 100px; }
|
| 480 |
+
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
|
| 481 |
+
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
|
| 482 |
+
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
|
| 483 |
+
.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
|
| 484 |
+
* jQuery UI Tabs 1.8.12
|
| 485 |
+
*
|
| 486 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 487 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 488 |
+
* http://jquery.org/license
|
| 489 |
+
*
|
| 490 |
+
* http://docs.jquery.com/UI/Tabs#theming
|
| 491 |
+
*/
|
| 492 |
+
.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
|
| 493 |
+
.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
|
| 494 |
+
.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
|
| 495 |
+
.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
|
| 496 |
+
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
|
| 497 |
+
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
|
| 498 |
+
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
|
| 499 |
+
.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
|
| 500 |
+
.ui-tabs .ui-tabs-hide { display: none !important; }
|
| 501 |
+
/*
|
| 502 |
+
* jQuery UI Datepicker 1.8.12
|
| 503 |
+
*
|
| 504 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 505 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 506 |
+
* http://jquery.org/license
|
| 507 |
+
*
|
| 508 |
+
* http://docs.jquery.com/UI/Datepicker#theming
|
| 509 |
+
*/
|
| 510 |
+
.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
|
| 511 |
+
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
|
| 512 |
+
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
|
| 513 |
+
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
|
| 514 |
+
.ui-datepicker .ui-datepicker-prev { left:2px; }
|
| 515 |
+
.ui-datepicker .ui-datepicker-next { right:2px; }
|
| 516 |
+
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
|
| 517 |
+
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
|
| 518 |
+
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
|
| 519 |
+
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
|
| 520 |
+
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
|
| 521 |
+
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
|
| 522 |
+
.ui-datepicker select.ui-datepicker-month,
|
| 523 |
+
.ui-datepicker select.ui-datepicker-year { width: 49%;}
|
| 524 |
+
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
|
| 525 |
+
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
|
| 526 |
+
.ui-datepicker td { border: 0; padding: 1px; }
|
| 527 |
+
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
|
| 528 |
+
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
|
| 529 |
+
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
|
| 530 |
+
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
|
| 531 |
+
|
| 532 |
+
/* with multiple calendars */
|
| 533 |
+
.ui-datepicker.ui-datepicker-multi { width:auto; }
|
| 534 |
+
.ui-datepicker-multi .ui-datepicker-group { float:left; }
|
| 535 |
+
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
|
| 536 |
+
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
|
| 537 |
+
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
|
| 538 |
+
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
|
| 539 |
+
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
|
| 540 |
+
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
|
| 541 |
+
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
|
| 542 |
+
.ui-datepicker-row-break { clear:both; width:100%; }
|
| 543 |
+
|
| 544 |
+
/* RTL support */
|
| 545 |
+
.ui-datepicker-rtl { direction: rtl; }
|
| 546 |
+
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
|
| 547 |
+
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
|
| 548 |
+
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
|
| 549 |
+
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
|
| 550 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
|
| 551 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
|
| 552 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
|
| 553 |
+
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
|
| 554 |
+
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
| 555 |
+
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
| 556 |
+
|
| 557 |
+
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
|
| 558 |
+
.ui-datepicker-cover {
|
| 559 |
+
display: none; /*sorry for IE5*/
|
| 560 |
+
display/**/: block; /*sorry for IE5*/
|
| 561 |
+
position: absolute; /*must have*/
|
| 562 |
+
z-index: -1; /*must have*/
|
| 563 |
+
filter: mask(); /*must have*/
|
| 564 |
+
top: -4px; /*must have*/
|
| 565 |
+
left: -4px; /*must have*/
|
| 566 |
+
width: 200px; /*must have*/
|
| 567 |
+
height: 200px; /*must have*/
|
| 568 |
+
}/*
|
| 569 |
+
* jQuery UI Progressbar 1.8.12
|
| 570 |
+
*
|
| 571 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 572 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 573 |
+
* http://jquery.org/license
|
| 574 |
+
*
|
| 575 |
+
* http://docs.jquery.com/UI/Progressbar#theming
|
| 576 |
+
*/
|
| 577 |
+
.ui-progressbar { height:2em; text-align: left; }
|
| 578 |
+
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
|
skin/adminhtml/default/default/oopsprofile/css/jquery.checkboxtree.css
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
.ui-widget-daredevel-checkboxTree li {
|
| 2 |
+
list-style-type: none;
|
| 3 |
+
position: relative;
|
| 4 |
+
left:25px;
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
.ui-widget-daredevel-checkboxTree li span {
|
| 8 |
+
cursor: default;
|
| 9 |
+
position: absolute;
|
| 10 |
+
top: 1px;
|
| 11 |
+
left: -16px;
|
| 12 |
+
}
|
skin/adminhtml/default/default/oopsprofile/css/oopsprofile.css
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
/**Oops profile**/
|
| 2 |
+
.oopsprofile-generator select { width:207px; }
|
| 3 |
+
.oopsprofile-generator input.input-text { width:200px; }
|
| 4 |
+
|
| 5 |
+
.oopsprofile-generator .field-row button.delete {vertical-align:middle; }
|
| 6 |
+
.oopsprofile-generator fieldset button.add {display:inline; margin:0; }
|
| 7 |
+
|
| 8 |
+
/**category Mapping**/
|
| 9 |
+
.category-mapping.entry-edit .field-row label{width:240px;}
|
| 10 |
+
.category-mapping.entry-edit .field-row input.input-text{width:205px;}
|
| 11 |
+
|
| 12 |
+
.category-mapping.entry-edit ul.ui-widget{float:left;width:100%;}
|
| 13 |
+
.category-mapping.entry-edit ul.ui-widget li{float:left;width:95%;}
|
| 14 |
+
.category-mapping.entry-edit ul{float:left;width:100%;background:#f0f0f0;}
|
| 15 |
+
.category-mapping.entry-edit ul li{float:left;width:95%;margin:0;}
|
| 16 |
+
.category-mapping.entry-edit .category-mapping{float:left;width:95%;border:1px solid #cccccc;padding:2px;margin:1px 0;}
|
| 17 |
+
.category-mapping.entry-edit .category-name{float:left;width:20%;}
|
| 18 |
+
.category-mapping.entry-edit .category-map{float:left;width:80%;}
|
| 19 |
+
|
| 20 |
+
.category-mapping.entry-edit .category-map input{
|
| 21 |
+
float:left;
|
| 22 |
+
width: 350px;
|
| 23 |
+
border: 1px solid #DDDDDD;
|
| 24 |
+
background: #F6F6F6;
|
| 25 |
+
padding: 1px 3px 1px 3px;
|
| 26 |
+
color: #2f2f2f;
|
| 27 |
+
font-size: 12px;
|
| 28 |
+
}
|
| 29 |
+
.category-mapping.entry-edit .category-map input:focus,.category-mapping.entry-edit .category-map input:hover{
|
| 30 |
+
background: #fff;
|
| 31 |
+
border-color: #aaa #c8c8c8 #c8c8c8 #aaa;
|
| 32 |
+
}
|
| 33 |
+
|
skin/adminhtml/default/default/oopsprofile/images/ui-bg_flat_0_aaaaaa_40x100.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/oopsprofile/images/ui-bg_flat_75_ffffff_40x100.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/oopsprofile/images/ui-bg_glass_55_fbf9ee_1x400.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/oopsprofile/images/ui-bg_glass_65_ffffff_1x400.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/oopsprofile/images/ui-bg_glass_75_dadada_1x400.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/oopsprofile/images/ui-bg_glass_75_e6e6e6_1x400.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/oopsprofile/images/ui-bg_glass_95_fef1ec_1x400.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/oopsprofile/images/ui-bg_highlight-soft_75_cccccc_1x100.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/oopsprofile/images/ui-icons_222222_256x240.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/oopsprofile/images/ui-icons_2e83ff_256x240.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/oopsprofile/images/ui-icons_454545_256x240.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/oopsprofile/images/ui-icons_888888_256x240.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/oopsprofile/images/ui-icons_cd0a0a_256x240.png
ADDED
|
Binary file
|
skin/adminhtml/default/default/oopsprofile/js/jquery-1.4.4.js
ADDED
|
@@ -0,0 +1,7180 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
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|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
/*!
|
| 2 |
+
* jQuery JavaScript Library v1.4.4
|
| 3 |
+
* http://jquery.com/
|
| 4 |
+
*
|
| 5 |
+
* Copyright 2010, John Resig
|
| 6 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 7 |
+
* http://jquery.org/license
|
| 8 |
+
*
|
| 9 |
+
* Includes Sizzle.js
|
| 10 |
+
* http://sizzlejs.com/
|
| 11 |
+
* Copyright 2010, The Dojo Foundation
|
| 12 |
+
* Released under the MIT, BSD, and GPL Licenses.
|
| 13 |
+
*
|
| 14 |
+
* Date: Thu Nov 11 19:04:53 2010 -0500
|
| 15 |
+
*/
|
| 16 |
+
(function( window, undefined ) {
|
| 17 |
+
|
| 18 |
+
// Use the correct document accordingly with window argument (sandbox)
|
| 19 |
+
var document = window.document;
|
| 20 |
+
var jQuery = (function() {
|
| 21 |
+
|
| 22 |
+
// Define a local copy of jQuery
|
| 23 |
+
var jQuery = function( selector, context ) {
|
| 24 |
+
// The jQuery object is actually just the init constructor 'enhanced'
|
| 25 |
+
return new jQuery.fn.init( selector, context );
|
| 26 |
+
},
|
| 27 |
+
|
| 28 |
+
// Map over jQuery in case of overwrite
|
| 29 |
+
_jQuery = window.jQuery,
|
| 30 |
+
|
| 31 |
+
// Map over the $ in case of overwrite
|
| 32 |
+
_$ = window.$,
|
| 33 |
+
|
| 34 |
+
// A central reference to the root jQuery(document)
|
| 35 |
+
rootjQuery,
|
| 36 |
+
|
| 37 |
+
// A simple way to check for HTML strings or ID strings
|
| 38 |
+
// (both of which we optimize for)
|
| 39 |
+
quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
|
| 40 |
+
|
| 41 |
+
// Is it a simple selector
|
| 42 |
+
isSimple = /^.[^:#\[\.,]*$/,
|
| 43 |
+
|
| 44 |
+
// Check if a string has a non-whitespace character in it
|
| 45 |
+
rnotwhite = /\S/,
|
| 46 |
+
rwhite = /\s/,
|
| 47 |
+
|
| 48 |
+
// Used for trimming whitespace
|
| 49 |
+
trimLeft = /^\s+/,
|
| 50 |
+
trimRight = /\s+$/,
|
| 51 |
+
|
| 52 |
+
// Check for non-word characters
|
| 53 |
+
rnonword = /\W/,
|
| 54 |
+
|
| 55 |
+
// Check for digits
|
| 56 |
+
rdigit = /\d/,
|
| 57 |
+
|
| 58 |
+
// Match a standalone tag
|
| 59 |
+
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
|
| 60 |
+
|
| 61 |
+
// JSON RegExp
|
| 62 |
+
rvalidchars = /^[\],:{}\s]*$/,
|
| 63 |
+
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
|
| 64 |
+
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
|
| 65 |
+
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
|
| 66 |
+
|
| 67 |
+
// Useragent RegExp
|
| 68 |
+
rwebkit = /(webkit)[ \/]([\w.]+)/,
|
| 69 |
+
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
|
| 70 |
+
rmsie = /(msie) ([\w.]+)/,
|
| 71 |
+
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
|
| 72 |
+
|
| 73 |
+
// Keep a UserAgent string for use with jQuery.browser
|
| 74 |
+
userAgent = navigator.userAgent,
|
| 75 |
+
|
| 76 |
+
// For matching the engine and version of the browser
|
| 77 |
+
browserMatch,
|
| 78 |
+
|
| 79 |
+
// Has the ready events already been bound?
|
| 80 |
+
readyBound = false,
|
| 81 |
+
|
| 82 |
+
// The functions to execute on DOM ready
|
| 83 |
+
readyList = [],
|
| 84 |
+
|
| 85 |
+
// The ready event handler
|
| 86 |
+
DOMContentLoaded,
|
| 87 |
+
|
| 88 |
+
// Save a reference to some core methods
|
| 89 |
+
toString = Object.prototype.toString,
|
| 90 |
+
hasOwn = Object.prototype.hasOwnProperty,
|
| 91 |
+
push = Array.prototype.push,
|
| 92 |
+
slice = Array.prototype.slice,
|
| 93 |
+
trim = String.prototype.trim,
|
| 94 |
+
indexOf = Array.prototype.indexOf,
|
| 95 |
+
|
| 96 |
+
// [[Class]] -> type pairs
|
| 97 |
+
class2type = {};
|
| 98 |
+
|
| 99 |
+
jQuery.fn = jQuery.prototype = {
|
| 100 |
+
init: function( selector, context ) {
|
| 101 |
+
var match, elem, ret, doc;
|
| 102 |
+
|
| 103 |
+
// Handle $(""), $(null), or $(undefined)
|
| 104 |
+
if ( !selector ) {
|
| 105 |
+
return this;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
// Handle $(DOMElement)
|
| 109 |
+
if ( selector.nodeType ) {
|
| 110 |
+
this.context = this[0] = selector;
|
| 111 |
+
this.length = 1;
|
| 112 |
+
return this;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
// The body element only exists once, optimize finding it
|
| 116 |
+
if ( selector === "body" && !context && document.body ) {
|
| 117 |
+
this.context = document;
|
| 118 |
+
this[0] = document.body;
|
| 119 |
+
this.selector = "body";
|
| 120 |
+
this.length = 1;
|
| 121 |
+
return this;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
// Handle HTML strings
|
| 125 |
+
if ( typeof selector === "string" ) {
|
| 126 |
+
// Are we dealing with HTML string or an ID?
|
| 127 |
+
match = quickExpr.exec( selector );
|
| 128 |
+
|
| 129 |
+
// Verify a match, and that no context was specified for #id
|
| 130 |
+
if ( match && (match[1] || !context) ) {
|
| 131 |
+
|
| 132 |
+
// HANDLE: $(html) -> $(array)
|
| 133 |
+
if ( match[1] ) {
|
| 134 |
+
doc = (context ? context.ownerDocument || context : document);
|
| 135 |
+
|
| 136 |
+
// If a single string is passed in and it's a single tag
|
| 137 |
+
// just do a createElement and skip the rest
|
| 138 |
+
ret = rsingleTag.exec( selector );
|
| 139 |
+
|
| 140 |
+
if ( ret ) {
|
| 141 |
+
if ( jQuery.isPlainObject( context ) ) {
|
| 142 |
+
selector = [ document.createElement( ret[1] ) ];
|
| 143 |
+
jQuery.fn.attr.call( selector, context, true );
|
| 144 |
+
|
| 145 |
+
} else {
|
| 146 |
+
selector = [ doc.createElement( ret[1] ) ];
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
} else {
|
| 150 |
+
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
|
| 151 |
+
selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
return jQuery.merge( this, selector );
|
| 155 |
+
|
| 156 |
+
// HANDLE: $("#id")
|
| 157 |
+
} else {
|
| 158 |
+
elem = document.getElementById( match[2] );
|
| 159 |
+
|
| 160 |
+
// Check parentNode to catch when Blackberry 4.6 returns
|
| 161 |
+
// nodes that are no longer in the document #6963
|
| 162 |
+
if ( elem && elem.parentNode ) {
|
| 163 |
+
// Handle the case where IE and Opera return items
|
| 164 |
+
// by name instead of ID
|
| 165 |
+
if ( elem.id !== match[2] ) {
|
| 166 |
+
return rootjQuery.find( selector );
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
// Otherwise, we inject the element directly into the jQuery object
|
| 170 |
+
this.length = 1;
|
| 171 |
+
this[0] = elem;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
this.context = document;
|
| 175 |
+
this.selector = selector;
|
| 176 |
+
return this;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
// HANDLE: $("TAG")
|
| 180 |
+
} else if ( !context && !rnonword.test( selector ) ) {
|
| 181 |
+
this.selector = selector;
|
| 182 |
+
this.context = document;
|
| 183 |
+
selector = document.getElementsByTagName( selector );
|
| 184 |
+
return jQuery.merge( this, selector );
|
| 185 |
+
|
| 186 |
+
// HANDLE: $(expr, $(...))
|
| 187 |
+
} else if ( !context || context.jquery ) {
|
| 188 |
+
return (context || rootjQuery).find( selector );
|
| 189 |
+
|
| 190 |
+
// HANDLE: $(expr, context)
|
| 191 |
+
// (which is just equivalent to: $(context).find(expr)
|
| 192 |
+
} else {
|
| 193 |
+
return jQuery( context ).find( selector );
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
// HANDLE: $(function)
|
| 197 |
+
// Shortcut for document ready
|
| 198 |
+
} else if ( jQuery.isFunction( selector ) ) {
|
| 199 |
+
return rootjQuery.ready( selector );
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
if (selector.selector !== undefined) {
|
| 203 |
+
this.selector = selector.selector;
|
| 204 |
+
this.context = selector.context;
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
return jQuery.makeArray( selector, this );
|
| 208 |
+
},
|
| 209 |
+
|
| 210 |
+
// Start with an empty selector
|
| 211 |
+
selector: "",
|
| 212 |
+
|
| 213 |
+
// The current version of jQuery being used
|
| 214 |
+
jquery: "1.4.4",
|
| 215 |
+
|
| 216 |
+
// The default length of a jQuery object is 0
|
| 217 |
+
length: 0,
|
| 218 |
+
|
| 219 |
+
// The number of elements contained in the matched element set
|
| 220 |
+
size: function() {
|
| 221 |
+
return this.length;
|
| 222 |
+
},
|
| 223 |
+
|
| 224 |
+
toArray: function() {
|
| 225 |
+
return slice.call( this, 0 );
|
| 226 |
+
},
|
| 227 |
+
|
| 228 |
+
// Get the Nth element in the matched element set OR
|
| 229 |
+
// Get the whole matched element set as a clean array
|
| 230 |
+
get: function( num ) {
|
| 231 |
+
return num == null ?
|
| 232 |
+
|
| 233 |
+
// Return a 'clean' array
|
| 234 |
+
this.toArray() :
|
| 235 |
+
|
| 236 |
+
// Return just the object
|
| 237 |
+
( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
|
| 238 |
+
},
|
| 239 |
+
|
| 240 |
+
// Take an array of elements and push it onto the stack
|
| 241 |
+
// (returning the new matched element set)
|
| 242 |
+
pushStack: function( elems, name, selector ) {
|
| 243 |
+
// Build a new jQuery matched element set
|
| 244 |
+
var ret = jQuery();
|
| 245 |
+
|
| 246 |
+
if ( jQuery.isArray( elems ) ) {
|
| 247 |
+
push.apply( ret, elems );
|
| 248 |
+
|
| 249 |
+
} else {
|
| 250 |
+
jQuery.merge( ret, elems );
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
// Add the old object onto the stack (as a reference)
|
| 254 |
+
ret.prevObject = this;
|
| 255 |
+
|
| 256 |
+
ret.context = this.context;
|
| 257 |
+
|
| 258 |
+
if ( name === "find" ) {
|
| 259 |
+
ret.selector = this.selector + (this.selector ? " " : "") + selector;
|
| 260 |
+
} else if ( name ) {
|
| 261 |
+
ret.selector = this.selector + "." + name + "(" + selector + ")";
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
// Return the newly-formed element set
|
| 265 |
+
return ret;
|
| 266 |
+
},
|
| 267 |
+
|
| 268 |
+
// Execute a callback for every element in the matched set.
|
| 269 |
+
// (You can seed the arguments with an array of args, but this is
|
| 270 |
+
// only used internally.)
|
| 271 |
+
each: function( callback, args ) {
|
| 272 |
+
return jQuery.each( this, callback, args );
|
| 273 |
+
},
|
| 274 |
+
|
| 275 |
+
ready: function( fn ) {
|
| 276 |
+
// Attach the listeners
|
| 277 |
+
jQuery.bindReady();
|
| 278 |
+
|
| 279 |
+
// If the DOM is already ready
|
| 280 |
+
if ( jQuery.isReady ) {
|
| 281 |
+
// Execute the function immediately
|
| 282 |
+
fn.call( document, jQuery );
|
| 283 |
+
|
| 284 |
+
// Otherwise, remember the function for later
|
| 285 |
+
} else if ( readyList ) {
|
| 286 |
+
// Add the function to the wait list
|
| 287 |
+
readyList.push( fn );
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
return this;
|
| 291 |
+
},
|
| 292 |
+
|
| 293 |
+
eq: function( i ) {
|
| 294 |
+
return i === -1 ?
|
| 295 |
+
this.slice( i ) :
|
| 296 |
+
this.slice( i, +i + 1 );
|
| 297 |
+
},
|
| 298 |
+
|
| 299 |
+
first: function() {
|
| 300 |
+
return this.eq( 0 );
|
| 301 |
+
},
|
| 302 |
+
|
| 303 |
+
last: function() {
|
| 304 |
+
return this.eq( -1 );
|
| 305 |
+
},
|
| 306 |
+
|
| 307 |
+
slice: function() {
|
| 308 |
+
return this.pushStack( slice.apply( this, arguments ),
|
| 309 |
+
"slice", slice.call(arguments).join(",") );
|
| 310 |
+
},
|
| 311 |
+
|
| 312 |
+
map: function( callback ) {
|
| 313 |
+
return this.pushStack( jQuery.map(this, function( elem, i ) {
|
| 314 |
+
return callback.call( elem, i, elem );
|
| 315 |
+
}));
|
| 316 |
+
},
|
| 317 |
+
|
| 318 |
+
end: function() {
|
| 319 |
+
return this.prevObject || jQuery(null);
|
| 320 |
+
},
|
| 321 |
+
|
| 322 |
+
// For internal use only.
|
| 323 |
+
// Behaves like an Array's method, not like a jQuery method.
|
| 324 |
+
push: push,
|
| 325 |
+
sort: [].sort,
|
| 326 |
+
splice: [].splice
|
| 327 |
+
};
|
| 328 |
+
|
| 329 |
+
// Give the init function the jQuery prototype for later instantiation
|
| 330 |
+
jQuery.fn.init.prototype = jQuery.fn;
|
| 331 |
+
|
| 332 |
+
jQuery.extend = jQuery.fn.extend = function() {
|
| 333 |
+
var options, name, src, copy, copyIsArray, clone,
|
| 334 |
+
target = arguments[0] || {},
|
| 335 |
+
i = 1,
|
| 336 |
+
length = arguments.length,
|
| 337 |
+
deep = false;
|
| 338 |
+
|
| 339 |
+
// Handle a deep copy situation
|
| 340 |
+
if ( typeof target === "boolean" ) {
|
| 341 |
+
deep = target;
|
| 342 |
+
target = arguments[1] || {};
|
| 343 |
+
// skip the boolean and the target
|
| 344 |
+
i = 2;
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
// Handle case when target is a string or something (possible in deep copy)
|
| 348 |
+
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
|
| 349 |
+
target = {};
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
// extend jQuery itself if only one argument is passed
|
| 353 |
+
if ( length === i ) {
|
| 354 |
+
target = this;
|
| 355 |
+
--i;
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
for ( ; i < length; i++ ) {
|
| 359 |
+
// Only deal with non-null/undefined values
|
| 360 |
+
if ( (options = arguments[ i ]) != null ) {
|
| 361 |
+
// Extend the base object
|
| 362 |
+
for ( name in options ) {
|
| 363 |
+
src = target[ name ];
|
| 364 |
+
copy = options[ name ];
|
| 365 |
+
|
| 366 |
+
// Prevent never-ending loop
|
| 367 |
+
if ( target === copy ) {
|
| 368 |
+
continue;
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
// Recurse if we're merging plain objects or arrays
|
| 372 |
+
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
|
| 373 |
+
if ( copyIsArray ) {
|
| 374 |
+
copyIsArray = false;
|
| 375 |
+
clone = src && jQuery.isArray(src) ? src : [];
|
| 376 |
+
|
| 377 |
+
} else {
|
| 378 |
+
clone = src && jQuery.isPlainObject(src) ? src : {};
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
// Never move original objects, clone them
|
| 382 |
+
target[ name ] = jQuery.extend( deep, clone, copy );
|
| 383 |
+
|
| 384 |
+
// Don't bring in undefined values
|
| 385 |
+
} else if ( copy !== undefined ) {
|
| 386 |
+
target[ name ] = copy;
|
| 387 |
+
}
|
| 388 |
+
}
|
| 389 |
+
}
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
// Return the modified object
|
| 393 |
+
return target;
|
| 394 |
+
};
|
| 395 |
+
|
| 396 |
+
jQuery.extend({
|
| 397 |
+
noConflict: function( deep ) {
|
| 398 |
+
window.$ = _$;
|
| 399 |
+
|
| 400 |
+
if ( deep ) {
|
| 401 |
+
window.jQuery = _jQuery;
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
return jQuery;
|
| 405 |
+
},
|
| 406 |
+
|
| 407 |
+
// Is the DOM ready to be used? Set to true once it occurs.
|
| 408 |
+
isReady: false,
|
| 409 |
+
|
| 410 |
+
// A counter to track how many items to wait for before
|
| 411 |
+
// the ready event fires. See #6781
|
| 412 |
+
readyWait: 1,
|
| 413 |
+
|
| 414 |
+
// Handle when the DOM is ready
|
| 415 |
+
ready: function( wait ) {
|
| 416 |
+
// A third-party is pushing the ready event forwards
|
| 417 |
+
if ( wait === true ) {
|
| 418 |
+
jQuery.readyWait--;
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
// Make sure that the DOM is not already loaded
|
| 422 |
+
if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
|
| 423 |
+
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
|
| 424 |
+
if ( !document.body ) {
|
| 425 |
+
return setTimeout( jQuery.ready, 1 );
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
// Remember that the DOM is ready
|
| 429 |
+
jQuery.isReady = true;
|
| 430 |
+
|
| 431 |
+
// If a normal DOM Ready event fired, decrement, and wait if need be
|
| 432 |
+
if ( wait !== true && --jQuery.readyWait > 0 ) {
|
| 433 |
+
return;
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
// If there are functions bound, to execute
|
| 437 |
+
if ( readyList ) {
|
| 438 |
+
// Execute all of them
|
| 439 |
+
var fn,
|
| 440 |
+
i = 0,
|
| 441 |
+
ready = readyList;
|
| 442 |
+
|
| 443 |
+
// Reset the list of functions
|
| 444 |
+
readyList = null;
|
| 445 |
+
|
| 446 |
+
while ( (fn = ready[ i++ ]) ) {
|
| 447 |
+
fn.call( document, jQuery );
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
// Trigger any bound ready events
|
| 451 |
+
if ( jQuery.fn.trigger ) {
|
| 452 |
+
jQuery( document ).trigger( "ready" ).unbind( "ready" );
|
| 453 |
+
}
|
| 454 |
+
}
|
| 455 |
+
}
|
| 456 |
+
},
|
| 457 |
+
|
| 458 |
+
bindReady: function() {
|
| 459 |
+
if ( readyBound ) {
|
| 460 |
+
return;
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
readyBound = true;
|
| 464 |
+
|
| 465 |
+
// Catch cases where $(document).ready() is called after the
|
| 466 |
+
// browser event has already occurred.
|
| 467 |
+
if ( document.readyState === "complete" ) {
|
| 468 |
+
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
| 469 |
+
return setTimeout( jQuery.ready, 1 );
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
// Mozilla, Opera and webkit nightlies currently support this event
|
| 473 |
+
if ( document.addEventListener ) {
|
| 474 |
+
// Use the handy event callback
|
| 475 |
+
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
|
| 476 |
+
|
| 477 |
+
// A fallback to window.onload, that will always work
|
| 478 |
+
window.addEventListener( "load", jQuery.ready, false );
|
| 479 |
+
|
| 480 |
+
// If IE event model is used
|
| 481 |
+
} else if ( document.attachEvent ) {
|
| 482 |
+
// ensure firing before onload,
|
| 483 |
+
// maybe late but safe also for iframes
|
| 484 |
+
document.attachEvent("onreadystatechange", DOMContentLoaded);
|
| 485 |
+
|
| 486 |
+
// A fallback to window.onload, that will always work
|
| 487 |
+
window.attachEvent( "onload", jQuery.ready );
|
| 488 |
+
|
| 489 |
+
// If IE and not a frame
|
| 490 |
+
// continually check to see if the document is ready
|
| 491 |
+
var toplevel = false;
|
| 492 |
+
|
| 493 |
+
try {
|
| 494 |
+
toplevel = window.frameElement == null;
|
| 495 |
+
} catch(e) {}
|
| 496 |
+
|
| 497 |
+
if ( document.documentElement.doScroll && toplevel ) {
|
| 498 |
+
doScrollCheck();
|
| 499 |
+
}
|
| 500 |
+
}
|
| 501 |
+
},
|
| 502 |
+
|
| 503 |
+
// See test/unit/core.js for details concerning isFunction.
|
| 504 |
+
// Since version 1.3, DOM methods and functions like alert
|
| 505 |
+
// aren't supported. They return false on IE (#2968).
|
| 506 |
+
isFunction: function( obj ) {
|
| 507 |
+
return jQuery.type(obj) === "function";
|
| 508 |
+
},
|
| 509 |
+
|
| 510 |
+
isArray: Array.isArray || function( obj ) {
|
| 511 |
+
return jQuery.type(obj) === "array";
|
| 512 |
+
},
|
| 513 |
+
|
| 514 |
+
// A crude way of determining if an object is a window
|
| 515 |
+
isWindow: function( obj ) {
|
| 516 |
+
return obj && typeof obj === "object" && "setInterval" in obj;
|
| 517 |
+
},
|
| 518 |
+
|
| 519 |
+
isNaN: function( obj ) {
|
| 520 |
+
return obj == null || !rdigit.test( obj ) || isNaN( obj );
|
| 521 |
+
},
|
| 522 |
+
|
| 523 |
+
type: function( obj ) {
|
| 524 |
+
return obj == null ?
|
| 525 |
+
String( obj ) :
|
| 526 |
+
class2type[ toString.call(obj) ] || "object";
|
| 527 |
+
},
|
| 528 |
+
|
| 529 |
+
isPlainObject: function( obj ) {
|
| 530 |
+
// Must be an Object.
|
| 531 |
+
// Because of IE, we also have to check the presence of the constructor property.
|
| 532 |
+
// Make sure that DOM nodes and window objects don't pass through, as well
|
| 533 |
+
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
|
| 534 |
+
return false;
|
| 535 |
+
}
|
| 536 |
+
|
| 537 |
+
// Not own constructor property must be Object
|
| 538 |
+
if ( obj.constructor &&
|
| 539 |
+
!hasOwn.call(obj, "constructor") &&
|
| 540 |
+
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
|
| 541 |
+
return false;
|
| 542 |
+
}
|
| 543 |
+
|
| 544 |
+
// Own properties are enumerated firstly, so to speed up,
|
| 545 |
+
// if last one is own, then all properties are own.
|
| 546 |
+
|
| 547 |
+
var key;
|
| 548 |
+
for ( key in obj ) {}
|
| 549 |
+
|
| 550 |
+
return key === undefined || hasOwn.call( obj, key );
|
| 551 |
+
},
|
| 552 |
+
|
| 553 |
+
isEmptyObject: function( obj ) {
|
| 554 |
+
for ( var name in obj ) {
|
| 555 |
+
return false;
|
| 556 |
+
}
|
| 557 |
+
return true;
|
| 558 |
+
},
|
| 559 |
+
|
| 560 |
+
error: function( msg ) {
|
| 561 |
+
throw msg;
|
| 562 |
+
},
|
| 563 |
+
|
| 564 |
+
parseJSON: function( data ) {
|
| 565 |
+
if ( typeof data !== "string" || !data ) {
|
| 566 |
+
return null;
|
| 567 |
+
}
|
| 568 |
+
|
| 569 |
+
// Make sure leading/trailing whitespace is removed (IE can't handle it)
|
| 570 |
+
data = jQuery.trim( data );
|
| 571 |
+
|
| 572 |
+
// Make sure the incoming data is actual JSON
|
| 573 |
+
// Logic borrowed from http://json.org/json2.js
|
| 574 |
+
if ( rvalidchars.test(data.replace(rvalidescape, "@")
|
| 575 |
+
.replace(rvalidtokens, "]")
|
| 576 |
+
.replace(rvalidbraces, "")) ) {
|
| 577 |
+
|
| 578 |
+
// Try to use the native JSON parser first
|
| 579 |
+
return window.JSON && window.JSON.parse ?
|
| 580 |
+
window.JSON.parse( data ) :
|
| 581 |
+
(new Function("return " + data))();
|
| 582 |
+
|
| 583 |
+
} else {
|
| 584 |
+
jQuery.error( "Invalid JSON: " + data );
|
| 585 |
+
}
|
| 586 |
+
},
|
| 587 |
+
|
| 588 |
+
noop: function() {},
|
| 589 |
+
|
| 590 |
+
// Evalulates a script in a global context
|
| 591 |
+
globalEval: function( data ) {
|
| 592 |
+
if ( data && rnotwhite.test(data) ) {
|
| 593 |
+
// Inspired by code by Andrea Giammarchi
|
| 594 |
+
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
|
| 595 |
+
var head = document.getElementsByTagName("head")[0] || document.documentElement,
|
| 596 |
+
script = document.createElement("script");
|
| 597 |
+
|
| 598 |
+
script.type = "text/javascript";
|
| 599 |
+
|
| 600 |
+
if ( jQuery.support.scriptEval ) {
|
| 601 |
+
script.appendChild( document.createTextNode( data ) );
|
| 602 |
+
} else {
|
| 603 |
+
script.text = data;
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
|
| 607 |
+
// This arises when a base node is used (#2709).
|
| 608 |
+
head.insertBefore( script, head.firstChild );
|
| 609 |
+
head.removeChild( script );
|
| 610 |
+
}
|
| 611 |
+
},
|
| 612 |
+
|
| 613 |
+
nodeName: function( elem, name ) {
|
| 614 |
+
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
|
| 615 |
+
},
|
| 616 |
+
|
| 617 |
+
// args is for internal usage only
|
| 618 |
+
each: function( object, callback, args ) {
|
| 619 |
+
var name, i = 0,
|
| 620 |
+
length = object.length,
|
| 621 |
+
isObj = length === undefined || jQuery.isFunction(object);
|
| 622 |
+
|
| 623 |
+
if ( args ) {
|
| 624 |
+
if ( isObj ) {
|
| 625 |
+
for ( name in object ) {
|
| 626 |
+
if ( callback.apply( object[ name ], args ) === false ) {
|
| 627 |
+
break;
|
| 628 |
+
}
|
| 629 |
+
}
|
| 630 |
+
} else {
|
| 631 |
+
for ( ; i < length; ) {
|
| 632 |
+
if ( callback.apply( object[ i++ ], args ) === false ) {
|
| 633 |
+
break;
|
| 634 |
+
}
|
| 635 |
+
}
|
| 636 |
+
}
|
| 637 |
+
|
| 638 |
+
// A special, fast, case for the most common use of each
|
| 639 |
+
} else {
|
| 640 |
+
if ( isObj ) {
|
| 641 |
+
for ( name in object ) {
|
| 642 |
+
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
|
| 643 |
+
break;
|
| 644 |
+
}
|
| 645 |
+
}
|
| 646 |
+
} else {
|
| 647 |
+
for ( var value = object[0];
|
| 648 |
+
i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
|
| 649 |
+
}
|
| 650 |
+
}
|
| 651 |
+
|
| 652 |
+
return object;
|
| 653 |
+
},
|
| 654 |
+
|
| 655 |
+
// Use native String.trim function wherever possible
|
| 656 |
+
trim: trim ?
|
| 657 |
+
function( text ) {
|
| 658 |
+
return text == null ?
|
| 659 |
+
"" :
|
| 660 |
+
trim.call( text );
|
| 661 |
+
} :
|
| 662 |
+
|
| 663 |
+
// Otherwise use our own trimming functionality
|
| 664 |
+
function( text ) {
|
| 665 |
+
return text == null ?
|
| 666 |
+
"" :
|
| 667 |
+
text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
|
| 668 |
+
},
|
| 669 |
+
|
| 670 |
+
// results is for internal usage only
|
| 671 |
+
makeArray: function( array, results ) {
|
| 672 |
+
var ret = results || [];
|
| 673 |
+
|
| 674 |
+
if ( array != null ) {
|
| 675 |
+
// The window, strings (and functions) also have 'length'
|
| 676 |
+
// The extra typeof function check is to prevent crashes
|
| 677 |
+
// in Safari 2 (See: #3039)
|
| 678 |
+
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
|
| 679 |
+
var type = jQuery.type(array);
|
| 680 |
+
|
| 681 |
+
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
|
| 682 |
+
push.call( ret, array );
|
| 683 |
+
} else {
|
| 684 |
+
jQuery.merge( ret, array );
|
| 685 |
+
}
|
| 686 |
+
}
|
| 687 |
+
|
| 688 |
+
return ret;
|
| 689 |
+
},
|
| 690 |
+
|
| 691 |
+
inArray: function( elem, array ) {
|
| 692 |
+
if ( array.indexOf ) {
|
| 693 |
+
return array.indexOf( elem );
|
| 694 |
+
}
|
| 695 |
+
|
| 696 |
+
for ( var i = 0, length = array.length; i < length; i++ ) {
|
| 697 |
+
if ( array[ i ] === elem ) {
|
| 698 |
+
return i;
|
| 699 |
+
}
|
| 700 |
+
}
|
| 701 |
+
|
| 702 |
+
return -1;
|
| 703 |
+
},
|
| 704 |
+
|
| 705 |
+
merge: function( first, second ) {
|
| 706 |
+
var i = first.length,
|
| 707 |
+
j = 0;
|
| 708 |
+
|
| 709 |
+
if ( typeof second.length === "number" ) {
|
| 710 |
+
for ( var l = second.length; j < l; j++ ) {
|
| 711 |
+
first[ i++ ] = second[ j ];
|
| 712 |
+
}
|
| 713 |
+
|
| 714 |
+
} else {
|
| 715 |
+
while ( second[j] !== undefined ) {
|
| 716 |
+
first[ i++ ] = second[ j++ ];
|
| 717 |
+
}
|
| 718 |
+
}
|
| 719 |
+
|
| 720 |
+
first.length = i;
|
| 721 |
+
|
| 722 |
+
return first;
|
| 723 |
+
},
|
| 724 |
+
|
| 725 |
+
grep: function( elems, callback, inv ) {
|
| 726 |
+
var ret = [], retVal;
|
| 727 |
+
inv = !!inv;
|
| 728 |
+
|
| 729 |
+
// Go through the array, only saving the items
|
| 730 |
+
// that pass the validator function
|
| 731 |
+
for ( var i = 0, length = elems.length; i < length; i++ ) {
|
| 732 |
+
retVal = !!callback( elems[ i ], i );
|
| 733 |
+
if ( inv !== retVal ) {
|
| 734 |
+
ret.push( elems[ i ] );
|
| 735 |
+
}
|
| 736 |
+
}
|
| 737 |
+
|
| 738 |
+
return ret;
|
| 739 |
+
},
|
| 740 |
+
|
| 741 |
+
// arg is for internal usage only
|
| 742 |
+
map: function( elems, callback, arg ) {
|
| 743 |
+
var ret = [], value;
|
| 744 |
+
|
| 745 |
+
// Go through the array, translating each of the items to their
|
| 746 |
+
// new value (or values).
|
| 747 |
+
for ( var i = 0, length = elems.length; i < length; i++ ) {
|
| 748 |
+
value = callback( elems[ i ], i, arg );
|
| 749 |
+
|
| 750 |
+
if ( value != null ) {
|
| 751 |
+
ret[ ret.length ] = value;
|
| 752 |
+
}
|
| 753 |
+
}
|
| 754 |
+
|
| 755 |
+
return ret.concat.apply( [], ret );
|
| 756 |
+
},
|
| 757 |
+
|
| 758 |
+
// A global GUID counter for objects
|
| 759 |
+
guid: 1,
|
| 760 |
+
|
| 761 |
+
proxy: function( fn, proxy, thisObject ) {
|
| 762 |
+
if ( arguments.length === 2 ) {
|
| 763 |
+
if ( typeof proxy === "string" ) {
|
| 764 |
+
thisObject = fn;
|
| 765 |
+
fn = thisObject[ proxy ];
|
| 766 |
+
proxy = undefined;
|
| 767 |
+
|
| 768 |
+
} else if ( proxy && !jQuery.isFunction( proxy ) ) {
|
| 769 |
+
thisObject = proxy;
|
| 770 |
+
proxy = undefined;
|
| 771 |
+
}
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
if ( !proxy && fn ) {
|
| 775 |
+
proxy = function() {
|
| 776 |
+
return fn.apply( thisObject || this, arguments );
|
| 777 |
+
};
|
| 778 |
+
}
|
| 779 |
+
|
| 780 |
+
// Set the guid of unique handler to the same of original handler, so it can be removed
|
| 781 |
+
if ( fn ) {
|
| 782 |
+
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
|
| 783 |
+
}
|
| 784 |
+
|
| 785 |
+
// So proxy can be declared as an argument
|
| 786 |
+
return proxy;
|
| 787 |
+
},
|
| 788 |
+
|
| 789 |
+
// Mutifunctional method to get and set values to a collection
|
| 790 |
+
// The value/s can be optionally by executed if its a function
|
| 791 |
+
access: function( elems, key, value, exec, fn, pass ) {
|
| 792 |
+
var length = elems.length;
|
| 793 |
+
|
| 794 |
+
// Setting many attributes
|
| 795 |
+
if ( typeof key === "object" ) {
|
| 796 |
+
for ( var k in key ) {
|
| 797 |
+
jQuery.access( elems, k, key[k], exec, fn, value );
|
| 798 |
+
}
|
| 799 |
+
return elems;
|
| 800 |
+
}
|
| 801 |
+
|
| 802 |
+
// Setting one attribute
|
| 803 |
+
if ( value !== undefined ) {
|
| 804 |
+
// Optionally, function values get executed if exec is true
|
| 805 |
+
exec = !pass && exec && jQuery.isFunction(value);
|
| 806 |
+
|
| 807 |
+
for ( var i = 0; i < length; i++ ) {
|
| 808 |
+
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
|
| 809 |
+
}
|
| 810 |
+
|
| 811 |
+
return elems;
|
| 812 |
+
}
|
| 813 |
+
|
| 814 |
+
// Getting an attribute
|
| 815 |
+
return length ? fn( elems[0], key ) : undefined;
|
| 816 |
+
},
|
| 817 |
+
|
| 818 |
+
now: function() {
|
| 819 |
+
return (new Date()).getTime();
|
| 820 |
+
},
|
| 821 |
+
|
| 822 |
+
// Use of jQuery.browser is frowned upon.
|
| 823 |
+
// More details: http://docs.jquery.com/Utilities/jQuery.browser
|
| 824 |
+
uaMatch: function( ua ) {
|
| 825 |
+
ua = ua.toLowerCase();
|
| 826 |
+
|
| 827 |
+
var match = rwebkit.exec( ua ) ||
|
| 828 |
+
ropera.exec( ua ) ||
|
| 829 |
+
rmsie.exec( ua ) ||
|
| 830 |
+
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
|
| 831 |
+
[];
|
| 832 |
+
|
| 833 |
+
return { browser: match[1] || "", version: match[2] || "0" };
|
| 834 |
+
},
|
| 835 |
+
|
| 836 |
+
browser: {}
|
| 837 |
+
});
|
| 838 |
+
|
| 839 |
+
// Populate the class2type map
|
| 840 |
+
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
|
| 841 |
+
class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
| 842 |
+
});
|
| 843 |
+
|
| 844 |
+
browserMatch = jQuery.uaMatch( userAgent );
|
| 845 |
+
if ( browserMatch.browser ) {
|
| 846 |
+
jQuery.browser[ browserMatch.browser ] = true;
|
| 847 |
+
jQuery.browser.version = browserMatch.version;
|
| 848 |
+
}
|
| 849 |
+
|
| 850 |
+
// Deprecated, use jQuery.browser.webkit instead
|
| 851 |
+
if ( jQuery.browser.webkit ) {
|
| 852 |
+
jQuery.browser.safari = true;
|
| 853 |
+
}
|
| 854 |
+
|
| 855 |
+
if ( indexOf ) {
|
| 856 |
+
jQuery.inArray = function( elem, array ) {
|
| 857 |
+
return indexOf.call( array, elem );
|
| 858 |
+
};
|
| 859 |
+
}
|
| 860 |
+
|
| 861 |
+
// Verify that \s matches non-breaking spaces
|
| 862 |
+
// (IE fails on this test)
|
| 863 |
+
if ( !rwhite.test( "\xA0" ) ) {
|
| 864 |
+
trimLeft = /^[\s\xA0]+/;
|
| 865 |
+
trimRight = /[\s\xA0]+$/;
|
| 866 |
+
}
|
| 867 |
+
|
| 868 |
+
// All jQuery objects should point back to these
|
| 869 |
+
rootjQuery = jQuery(document);
|
| 870 |
+
|
| 871 |
+
// Cleanup functions for the document ready method
|
| 872 |
+
if ( document.addEventListener ) {
|
| 873 |
+
DOMContentLoaded = function() {
|
| 874 |
+
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
|
| 875 |
+
jQuery.ready();
|
| 876 |
+
};
|
| 877 |
+
|
| 878 |
+
} else if ( document.attachEvent ) {
|
| 879 |
+
DOMContentLoaded = function() {
|
| 880 |
+
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
|
| 881 |
+
if ( document.readyState === "complete" ) {
|
| 882 |
+
document.detachEvent( "onreadystatechange", DOMContentLoaded );
|
| 883 |
+
jQuery.ready();
|
| 884 |
+
}
|
| 885 |
+
};
|
| 886 |
+
}
|
| 887 |
+
|
| 888 |
+
// The DOM ready check for Internet Explorer
|
| 889 |
+
function doScrollCheck() {
|
| 890 |
+
if ( jQuery.isReady ) {
|
| 891 |
+
return;
|
| 892 |
+
}
|
| 893 |
+
|
| 894 |
+
try {
|
| 895 |
+
// If IE is used, use the trick by Diego Perini
|
| 896 |
+
// http://javascript.nwbox.com/IEContentLoaded/
|
| 897 |
+
document.documentElement.doScroll("left");
|
| 898 |
+
} catch(e) {
|
| 899 |
+
setTimeout( doScrollCheck, 1 );
|
| 900 |
+
return;
|
| 901 |
+
}
|
| 902 |
+
|
| 903 |
+
// and execute any waiting functions
|
| 904 |
+
jQuery.ready();
|
| 905 |
+
}
|
| 906 |
+
|
| 907 |
+
// Expose jQuery to the global object
|
| 908 |
+
return (window.jQuery = window.$ = jQuery);
|
| 909 |
+
|
| 910 |
+
})();
|
| 911 |
+
|
| 912 |
+
|
| 913 |
+
(function() {
|
| 914 |
+
|
| 915 |
+
jQuery.support = {};
|
| 916 |
+
|
| 917 |
+
var root = document.documentElement,
|
| 918 |
+
script = document.createElement("script"),
|
| 919 |
+
div = document.createElement("div"),
|
| 920 |
+
id = "script" + jQuery.now();
|
| 921 |
+
|
| 922 |
+
div.style.display = "none";
|
| 923 |
+
div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
|
| 924 |
+
|
| 925 |
+
var all = div.getElementsByTagName("*"),
|
| 926 |
+
a = div.getElementsByTagName("a")[0],
|
| 927 |
+
select = document.createElement("select"),
|
| 928 |
+
opt = select.appendChild( document.createElement("option") );
|
| 929 |
+
|
| 930 |
+
// Can't get basic test support
|
| 931 |
+
if ( !all || !all.length || !a ) {
|
| 932 |
+
return;
|
| 933 |
+
}
|
| 934 |
+
|
| 935 |
+
jQuery.support = {
|
| 936 |
+
// IE strips leading whitespace when .innerHTML is used
|
| 937 |
+
leadingWhitespace: div.firstChild.nodeType === 3,
|
| 938 |
+
|
| 939 |
+
// Make sure that tbody elements aren't automatically inserted
|
| 940 |
+
// IE will insert them into empty tables
|
| 941 |
+
tbody: !div.getElementsByTagName("tbody").length,
|
| 942 |
+
|
| 943 |
+
// Make sure that link elements get serialized correctly by innerHTML
|
| 944 |
+
// This requires a wrapper element in IE
|
| 945 |
+
htmlSerialize: !!div.getElementsByTagName("link").length,
|
| 946 |
+
|
| 947 |
+
// Get the style information from getAttribute
|
| 948 |
+
// (IE uses .cssText insted)
|
| 949 |
+
style: /red/.test( a.getAttribute("style") ),
|
| 950 |
+
|
| 951 |
+
// Make sure that URLs aren't manipulated
|
| 952 |
+
// (IE normalizes it by default)
|
| 953 |
+
hrefNormalized: a.getAttribute("href") === "/a",
|
| 954 |
+
|
| 955 |
+
// Make sure that element opacity exists
|
| 956 |
+
// (IE uses filter instead)
|
| 957 |
+
// Use a regex to work around a WebKit issue. See #5145
|
| 958 |
+
opacity: /^0.55$/.test( a.style.opacity ),
|
| 959 |
+
|
| 960 |
+
// Verify style float existence
|
| 961 |
+
// (IE uses styleFloat instead of cssFloat)
|
| 962 |
+
cssFloat: !!a.style.cssFloat,
|
| 963 |
+
|
| 964 |
+
// Make sure that if no value is specified for a checkbox
|
| 965 |
+
// that it defaults to "on".
|
| 966 |
+
// (WebKit defaults to "" instead)
|
| 967 |
+
checkOn: div.getElementsByTagName("input")[0].value === "on",
|
| 968 |
+
|
| 969 |
+
// Make sure that a selected-by-default option has a working selected property.
|
| 970 |
+
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
|
| 971 |
+
optSelected: opt.selected,
|
| 972 |
+
|
| 973 |
+
// Will be defined later
|
| 974 |
+
deleteExpando: true,
|
| 975 |
+
optDisabled: false,
|
| 976 |
+
checkClone: false,
|
| 977 |
+
scriptEval: false,
|
| 978 |
+
noCloneEvent: true,
|
| 979 |
+
boxModel: null,
|
| 980 |
+
inlineBlockNeedsLayout: false,
|
| 981 |
+
shrinkWrapBlocks: false,
|
| 982 |
+
reliableHiddenOffsets: true
|
| 983 |
+
};
|
| 984 |
+
|
| 985 |
+
// Make sure that the options inside disabled selects aren't marked as disabled
|
| 986 |
+
// (WebKit marks them as diabled)
|
| 987 |
+
select.disabled = true;
|
| 988 |
+
jQuery.support.optDisabled = !opt.disabled;
|
| 989 |
+
|
| 990 |
+
script.type = "text/javascript";
|
| 991 |
+
try {
|
| 992 |
+
script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
|
| 993 |
+
} catch(e) {}
|
| 994 |
+
|
| 995 |
+
root.insertBefore( script, root.firstChild );
|
| 996 |
+
|
| 997 |
+
// Make sure that the execution of code works by injecting a script
|
| 998 |
+
// tag with appendChild/createTextNode
|
| 999 |
+
// (IE doesn't support this, fails, and uses .text instead)
|
| 1000 |
+
if ( window[ id ] ) {
|
| 1001 |
+
jQuery.support.scriptEval = true;
|
| 1002 |
+
delete window[ id ];
|
| 1003 |
+
}
|
| 1004 |
+
|
| 1005 |
+
// Test to see if it's possible to delete an expando from an element
|
| 1006 |
+
// Fails in Internet Explorer
|
| 1007 |
+
try {
|
| 1008 |
+
delete script.test;
|
| 1009 |
+
|
| 1010 |
+
} catch(e) {
|
| 1011 |
+
jQuery.support.deleteExpando = false;
|
| 1012 |
+
}
|
| 1013 |
+
|
| 1014 |
+
root.removeChild( script );
|
| 1015 |
+
|
| 1016 |
+
if ( div.attachEvent && div.fireEvent ) {
|
| 1017 |
+
div.attachEvent("onclick", function click() {
|
| 1018 |
+
// Cloning a node shouldn't copy over any
|
| 1019 |
+
// bound event handlers (IE does this)
|
| 1020 |
+
jQuery.support.noCloneEvent = false;
|
| 1021 |
+
div.detachEvent("onclick", click);
|
| 1022 |
+
});
|
| 1023 |
+
div.cloneNode(true).fireEvent("onclick");
|
| 1024 |
+
}
|
| 1025 |
+
|
| 1026 |
+
div = document.createElement("div");
|
| 1027 |
+
div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
|
| 1028 |
+
|
| 1029 |
+
var fragment = document.createDocumentFragment();
|
| 1030 |
+
fragment.appendChild( div.firstChild );
|
| 1031 |
+
|
| 1032 |
+
// WebKit doesn't clone checked state correctly in fragments
|
| 1033 |
+
jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
|
| 1034 |
+
|
| 1035 |
+
// Figure out if the W3C box model works as expected
|
| 1036 |
+
// document.body must exist before we can do this
|
| 1037 |
+
jQuery(function() {
|
| 1038 |
+
var div = document.createElement("div");
|
| 1039 |
+
div.style.width = div.style.paddingLeft = "1px";
|
| 1040 |
+
|
| 1041 |
+
document.body.appendChild( div );
|
| 1042 |
+
jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
|
| 1043 |
+
|
| 1044 |
+
if ( "zoom" in div.style ) {
|
| 1045 |
+
// Check if natively block-level elements act like inline-block
|
| 1046 |
+
// elements when setting their display to 'inline' and giving
|
| 1047 |
+
// them layout
|
| 1048 |
+
// (IE < 8 does this)
|
| 1049 |
+
div.style.display = "inline";
|
| 1050 |
+
div.style.zoom = 1;
|
| 1051 |
+
jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
|
| 1052 |
+
|
| 1053 |
+
// Check if elements with layout shrink-wrap their children
|
| 1054 |
+
// (IE 6 does this)
|
| 1055 |
+
div.style.display = "";
|
| 1056 |
+
div.innerHTML = "<div style='width:4px;'></div>";
|
| 1057 |
+
jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
|
| 1058 |
+
}
|
| 1059 |
+
|
| 1060 |
+
div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
|
| 1061 |
+
var tds = div.getElementsByTagName("td");
|
| 1062 |
+
|
| 1063 |
+
// Check if table cells still have offsetWidth/Height when they are set
|
| 1064 |
+
// to display:none and there are still other visible table cells in a
|
| 1065 |
+
// table row; if so, offsetWidth/Height are not reliable for use when
|
| 1066 |
+
// determining if an element has been hidden directly using
|
| 1067 |
+
// display:none (it is still safe to use offsets if a parent element is
|
| 1068 |
+
// hidden; don safety goggles and see bug #4512 for more information).
|
| 1069 |
+
// (only IE 8 fails this test)
|
| 1070 |
+
jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
|
| 1071 |
+
|
| 1072 |
+
tds[0].style.display = "";
|
| 1073 |
+
tds[1].style.display = "none";
|
| 1074 |
+
|
| 1075 |
+
// Check if empty table cells still have offsetWidth/Height
|
| 1076 |
+
// (IE < 8 fail this test)
|
| 1077 |
+
jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
|
| 1078 |
+
div.innerHTML = "";
|
| 1079 |
+
|
| 1080 |
+
document.body.removeChild( div ).style.display = "none";
|
| 1081 |
+
div = tds = null;
|
| 1082 |
+
});
|
| 1083 |
+
|
| 1084 |
+
// Technique from Juriy Zaytsev
|
| 1085 |
+
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
|
| 1086 |
+
var eventSupported = function( eventName ) {
|
| 1087 |
+
var el = document.createElement("div");
|
| 1088 |
+
eventName = "on" + eventName;
|
| 1089 |
+
|
| 1090 |
+
var isSupported = (eventName in el);
|
| 1091 |
+
if ( !isSupported ) {
|
| 1092 |
+
el.setAttribute(eventName, "return;");
|
| 1093 |
+
isSupported = typeof el[eventName] === "function";
|
| 1094 |
+
}
|
| 1095 |
+
el = null;
|
| 1096 |
+
|
| 1097 |
+
return isSupported;
|
| 1098 |
+
};
|
| 1099 |
+
|
| 1100 |
+
jQuery.support.submitBubbles = eventSupported("submit");
|
| 1101 |
+
jQuery.support.changeBubbles = eventSupported("change");
|
| 1102 |
+
|
| 1103 |
+
// release memory in IE
|
| 1104 |
+
root = script = div = all = a = null;
|
| 1105 |
+
})();
|
| 1106 |
+
|
| 1107 |
+
|
| 1108 |
+
|
| 1109 |
+
var windowData = {},
|
| 1110 |
+
rbrace = /^(?:\{.*\}|\[.*\])$/;
|
| 1111 |
+
|
| 1112 |
+
jQuery.extend({
|
| 1113 |
+
cache: {},
|
| 1114 |
+
|
| 1115 |
+
// Please use with caution
|
| 1116 |
+
uuid: 0,
|
| 1117 |
+
|
| 1118 |
+
// Unique for each copy of jQuery on the page
|
| 1119 |
+
expando: "jQuery" + jQuery.now(),
|
| 1120 |
+
|
| 1121 |
+
// The following elements throw uncatchable exceptions if you
|
| 1122 |
+
// attempt to add expando properties to them.
|
| 1123 |
+
noData: {
|
| 1124 |
+
"embed": true,
|
| 1125 |
+
// Ban all objects except for Flash (which handle expandos)
|
| 1126 |
+
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
|
| 1127 |
+
"applet": true
|
| 1128 |
+
},
|
| 1129 |
+
|
| 1130 |
+
data: function( elem, name, data ) {
|
| 1131 |
+
if ( !jQuery.acceptData( elem ) ) {
|
| 1132 |
+
return;
|
| 1133 |
+
}
|
| 1134 |
+
|
| 1135 |
+
elem = elem == window ?
|
| 1136 |
+
windowData :
|
| 1137 |
+
elem;
|
| 1138 |
+
|
| 1139 |
+
var isNode = elem.nodeType,
|
| 1140 |
+
id = isNode ? elem[ jQuery.expando ] : null,
|
| 1141 |
+
cache = jQuery.cache, thisCache;
|
| 1142 |
+
|
| 1143 |
+
if ( isNode && !id && typeof name === "string" && data === undefined ) {
|
| 1144 |
+
return;
|
| 1145 |
+
}
|
| 1146 |
+
|
| 1147 |
+
// Get the data from the object directly
|
| 1148 |
+
if ( !isNode ) {
|
| 1149 |
+
cache = elem;
|
| 1150 |
+
|
| 1151 |
+
// Compute a unique ID for the element
|
| 1152 |
+
} else if ( !id ) {
|
| 1153 |
+
elem[ jQuery.expando ] = id = ++jQuery.uuid;
|
| 1154 |
+
}
|
| 1155 |
+
|
| 1156 |
+
// Avoid generating a new cache unless none exists and we
|
| 1157 |
+
// want to manipulate it.
|
| 1158 |
+
if ( typeof name === "object" ) {
|
| 1159 |
+
if ( isNode ) {
|
| 1160 |
+
cache[ id ] = jQuery.extend(cache[ id ], name);
|
| 1161 |
+
|
| 1162 |
+
} else {
|
| 1163 |
+
jQuery.extend( cache, name );
|
| 1164 |
+
}
|
| 1165 |
+
|
| 1166 |
+
} else if ( isNode && !cache[ id ] ) {
|
| 1167 |
+
cache[ id ] = {};
|
| 1168 |
+
}
|
| 1169 |
+
|
| 1170 |
+
thisCache = isNode ? cache[ id ] : cache;
|
| 1171 |
+
|
| 1172 |
+
// Prevent overriding the named cache with undefined values
|
| 1173 |
+
if ( data !== undefined ) {
|
| 1174 |
+
thisCache[ name ] = data;
|
| 1175 |
+
}
|
| 1176 |
+
|
| 1177 |
+
return typeof name === "string" ? thisCache[ name ] : thisCache;
|
| 1178 |
+
},
|
| 1179 |
+
|
| 1180 |
+
removeData: function( elem, name ) {
|
| 1181 |
+
if ( !jQuery.acceptData( elem ) ) {
|
| 1182 |
+
return;
|
| 1183 |
+
}
|
| 1184 |
+
|
| 1185 |
+
elem = elem == window ?
|
| 1186 |
+
windowData :
|
| 1187 |
+
elem;
|
| 1188 |
+
|
| 1189 |
+
var isNode = elem.nodeType,
|
| 1190 |
+
id = isNode ? elem[ jQuery.expando ] : elem,
|
| 1191 |
+
cache = jQuery.cache,
|
| 1192 |
+
thisCache = isNode ? cache[ id ] : id;
|
| 1193 |
+
|
| 1194 |
+
// If we want to remove a specific section of the element's data
|
| 1195 |
+
if ( name ) {
|
| 1196 |
+
if ( thisCache ) {
|
| 1197 |
+
// Remove the section of cache data
|
| 1198 |
+
delete thisCache[ name ];
|
| 1199 |
+
|
| 1200 |
+
// If we've removed all the data, remove the element's cache
|
| 1201 |
+
if ( isNode && jQuery.isEmptyObject(thisCache) ) {
|
| 1202 |
+
jQuery.removeData( elem );
|
| 1203 |
+
}
|
| 1204 |
+
}
|
| 1205 |
+
|
| 1206 |
+
// Otherwise, we want to remove all of the element's data
|
| 1207 |
+
} else {
|
| 1208 |
+
if ( isNode && jQuery.support.deleteExpando ) {
|
| 1209 |
+
delete elem[ jQuery.expando ];
|
| 1210 |
+
|
| 1211 |
+
} else if ( elem.removeAttribute ) {
|
| 1212 |
+
elem.removeAttribute( jQuery.expando );
|
| 1213 |
+
|
| 1214 |
+
// Completely remove the data cache
|
| 1215 |
+
} else if ( isNode ) {
|
| 1216 |
+
delete cache[ id ];
|
| 1217 |
+
|
| 1218 |
+
// Remove all fields from the object
|
| 1219 |
+
} else {
|
| 1220 |
+
for ( var n in elem ) {
|
| 1221 |
+
delete elem[ n ];
|
| 1222 |
+
}
|
| 1223 |
+
}
|
| 1224 |
+
}
|
| 1225 |
+
},
|
| 1226 |
+
|
| 1227 |
+
// A method for determining if a DOM node can handle the data expando
|
| 1228 |
+
acceptData: function( elem ) {
|
| 1229 |
+
if ( elem.nodeName ) {
|
| 1230 |
+
var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
|
| 1231 |
+
|
| 1232 |
+
if ( match ) {
|
| 1233 |
+
return !(match === true || elem.getAttribute("classid") !== match);
|
| 1234 |
+
}
|
| 1235 |
+
}
|
| 1236 |
+
|
| 1237 |
+
return true;
|
| 1238 |
+
}
|
| 1239 |
+
});
|
| 1240 |
+
|
| 1241 |
+
jQuery.fn.extend({
|
| 1242 |
+
data: function( key, value ) {
|
| 1243 |
+
var data = null;
|
| 1244 |
+
|
| 1245 |
+
if ( typeof key === "undefined" ) {
|
| 1246 |
+
if ( this.length ) {
|
| 1247 |
+
var attr = this[0].attributes, name;
|
| 1248 |
+
data = jQuery.data( this[0] );
|
| 1249 |
+
|
| 1250 |
+
for ( var i = 0, l = attr.length; i < l; i++ ) {
|
| 1251 |
+
name = attr[i].name;
|
| 1252 |
+
|
| 1253 |
+
if ( name.indexOf( "data-" ) === 0 ) {
|
| 1254 |
+
name = name.substr( 5 );
|
| 1255 |
+
dataAttr( this[0], name, data[ name ] );
|
| 1256 |
+
}
|
| 1257 |
+
}
|
| 1258 |
+
}
|
| 1259 |
+
|
| 1260 |
+
return data;
|
| 1261 |
+
|
| 1262 |
+
} else if ( typeof key === "object" ) {
|
| 1263 |
+
return this.each(function() {
|
| 1264 |
+
jQuery.data( this, key );
|
| 1265 |
+
});
|
| 1266 |
+
}
|
| 1267 |
+
|
| 1268 |
+
var parts = key.split(".");
|
| 1269 |
+
parts[1] = parts[1] ? "." + parts[1] : "";
|
| 1270 |
+
|
| 1271 |
+
if ( value === undefined ) {
|
| 1272 |
+
data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
|
| 1273 |
+
|
| 1274 |
+
// Try to fetch any internally stored data first
|
| 1275 |
+
if ( data === undefined && this.length ) {
|
| 1276 |
+
data = jQuery.data( this[0], key );
|
| 1277 |
+
data = dataAttr( this[0], key, data );
|
| 1278 |
+
}
|
| 1279 |
+
|
| 1280 |
+
return data === undefined && parts[1] ?
|
| 1281 |
+
this.data( parts[0] ) :
|
| 1282 |
+
data;
|
| 1283 |
+
|
| 1284 |
+
} else {
|
| 1285 |
+
return this.each(function() {
|
| 1286 |
+
var $this = jQuery( this ),
|
| 1287 |
+
args = [ parts[0], value ];
|
| 1288 |
+
|
| 1289 |
+
$this.triggerHandler( "setData" + parts[1] + "!", args );
|
| 1290 |
+
jQuery.data( this, key, value );
|
| 1291 |
+
$this.triggerHandler( "changeData" + parts[1] + "!", args );
|
| 1292 |
+
});
|
| 1293 |
+
}
|
| 1294 |
+
},
|
| 1295 |
+
|
| 1296 |
+
removeData: function( key ) {
|
| 1297 |
+
return this.each(function() {
|
| 1298 |
+
jQuery.removeData( this, key );
|
| 1299 |
+
});
|
| 1300 |
+
}
|
| 1301 |
+
});
|
| 1302 |
+
|
| 1303 |
+
function dataAttr( elem, key, data ) {
|
| 1304 |
+
// If nothing was found internally, try to fetch any
|
| 1305 |
+
// data from the HTML5 data-* attribute
|
| 1306 |
+
if ( data === undefined && elem.nodeType === 1 ) {
|
| 1307 |
+
data = elem.getAttribute( "data-" + key );
|
| 1308 |
+
|
| 1309 |
+
if ( typeof data === "string" ) {
|
| 1310 |
+
try {
|
| 1311 |
+
data = data === "true" ? true :
|
| 1312 |
+
data === "false" ? false :
|
| 1313 |
+
data === "null" ? null :
|
| 1314 |
+
!jQuery.isNaN( data ) ? parseFloat( data ) :
|
| 1315 |
+
rbrace.test( data ) ? jQuery.parseJSON( data ) :
|
| 1316 |
+
data;
|
| 1317 |
+
} catch( e ) {}
|
| 1318 |
+
|
| 1319 |
+
// Make sure we set the data so it isn't changed later
|
| 1320 |
+
jQuery.data( elem, key, data );
|
| 1321 |
+
|
| 1322 |
+
} else {
|
| 1323 |
+
data = undefined;
|
| 1324 |
+
}
|
| 1325 |
+
}
|
| 1326 |
+
|
| 1327 |
+
return data;
|
| 1328 |
+
}
|
| 1329 |
+
|
| 1330 |
+
|
| 1331 |
+
|
| 1332 |
+
|
| 1333 |
+
jQuery.extend({
|
| 1334 |
+
queue: function( elem, type, data ) {
|
| 1335 |
+
if ( !elem ) {
|
| 1336 |
+
return;
|
| 1337 |
+
}
|
| 1338 |
+
|
| 1339 |
+
type = (type || "fx") + "queue";
|
| 1340 |
+
var q = jQuery.data( elem, type );
|
| 1341 |
+
|
| 1342 |
+
// Speed up dequeue by getting out quickly if this is just a lookup
|
| 1343 |
+
if ( !data ) {
|
| 1344 |
+
return q || [];
|
| 1345 |
+
}
|
| 1346 |
+
|
| 1347 |
+
if ( !q || jQuery.isArray(data) ) {
|
| 1348 |
+
q = jQuery.data( elem, type, jQuery.makeArray(data) );
|
| 1349 |
+
|
| 1350 |
+
} else {
|
| 1351 |
+
q.push( data );
|
| 1352 |
+
}
|
| 1353 |
+
|
| 1354 |
+
return q;
|
| 1355 |
+
},
|
| 1356 |
+
|
| 1357 |
+
dequeue: function( elem, type ) {
|
| 1358 |
+
type = type || "fx";
|
| 1359 |
+
|
| 1360 |
+
var queue = jQuery.queue( elem, type ),
|
| 1361 |
+
fn = queue.shift();
|
| 1362 |
+
|
| 1363 |
+
// If the fx queue is dequeued, always remove the progress sentinel
|
| 1364 |
+
if ( fn === "inprogress" ) {
|
| 1365 |
+
fn = queue.shift();
|
| 1366 |
+
}
|
| 1367 |
+
|
| 1368 |
+
if ( fn ) {
|
| 1369 |
+
// Add a progress sentinel to prevent the fx queue from being
|
| 1370 |
+
// automatically dequeued
|
| 1371 |
+
if ( type === "fx" ) {
|
| 1372 |
+
queue.unshift("inprogress");
|
| 1373 |
+
}
|
| 1374 |
+
|
| 1375 |
+
fn.call(elem, function() {
|
| 1376 |
+
jQuery.dequeue(elem, type);
|
| 1377 |
+
});
|
| 1378 |
+
}
|
| 1379 |
+
}
|
| 1380 |
+
});
|
| 1381 |
+
|
| 1382 |
+
jQuery.fn.extend({
|
| 1383 |
+
queue: function( type, data ) {
|
| 1384 |
+
if ( typeof type !== "string" ) {
|
| 1385 |
+
data = type;
|
| 1386 |
+
type = "fx";
|
| 1387 |
+
}
|
| 1388 |
+
|
| 1389 |
+
if ( data === undefined ) {
|
| 1390 |
+
return jQuery.queue( this[0], type );
|
| 1391 |
+
}
|
| 1392 |
+
return this.each(function( i ) {
|
| 1393 |
+
var queue = jQuery.queue( this, type, data );
|
| 1394 |
+
|
| 1395 |
+
if ( type === "fx" && queue[0] !== "inprogress" ) {
|
| 1396 |
+
jQuery.dequeue( this, type );
|
| 1397 |
+
}
|
| 1398 |
+
});
|
| 1399 |
+
},
|
| 1400 |
+
dequeue: function( type ) {
|
| 1401 |
+
return this.each(function() {
|
| 1402 |
+
jQuery.dequeue( this, type );
|
| 1403 |
+
});
|
| 1404 |
+
},
|
| 1405 |
+
|
| 1406 |
+
// Based off of the plugin by Clint Helfers, with permission.
|
| 1407 |
+
// http://blindsignals.com/index.php/2009/07/jquery-delay/
|
| 1408 |
+
delay: function( time, type ) {
|
| 1409 |
+
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
|
| 1410 |
+
type = type || "fx";
|
| 1411 |
+
|
| 1412 |
+
return this.queue( type, function() {
|
| 1413 |
+
var elem = this;
|
| 1414 |
+
setTimeout(function() {
|
| 1415 |
+
jQuery.dequeue( elem, type );
|
| 1416 |
+
}, time );
|
| 1417 |
+
});
|
| 1418 |
+
},
|
| 1419 |
+
|
| 1420 |
+
clearQueue: function( type ) {
|
| 1421 |
+
return this.queue( type || "fx", [] );
|
| 1422 |
+
}
|
| 1423 |
+
});
|
| 1424 |
+
|
| 1425 |
+
|
| 1426 |
+
|
| 1427 |
+
|
| 1428 |
+
var rclass = /[\n\t]/g,
|
| 1429 |
+
rspaces = /\s+/,
|
| 1430 |
+
rreturn = /\r/g,
|
| 1431 |
+
rspecialurl = /^(?:href|src|style)$/,
|
| 1432 |
+
rtype = /^(?:button|input)$/i,
|
| 1433 |
+
rfocusable = /^(?:button|input|object|select|textarea)$/i,
|
| 1434 |
+
rclickable = /^a(?:rea)?$/i,
|
| 1435 |
+
rradiocheck = /^(?:radio|checkbox)$/i;
|
| 1436 |
+
|
| 1437 |
+
jQuery.props = {
|
| 1438 |
+
"for": "htmlFor",
|
| 1439 |
+
"class": "className",
|
| 1440 |
+
readonly: "readOnly",
|
| 1441 |
+
maxlength: "maxLength",
|
| 1442 |
+
cellspacing: "cellSpacing",
|
| 1443 |
+
rowspan: "rowSpan",
|
| 1444 |
+
colspan: "colSpan",
|
| 1445 |
+
tabindex: "tabIndex",
|
| 1446 |
+
usemap: "useMap",
|
| 1447 |
+
frameborder: "frameBorder"
|
| 1448 |
+
};
|
| 1449 |
+
|
| 1450 |
+
jQuery.fn.extend({
|
| 1451 |
+
attr: function( name, value ) {
|
| 1452 |
+
return jQuery.access( this, name, value, true, jQuery.attr );
|
| 1453 |
+
},
|
| 1454 |
+
|
| 1455 |
+
removeAttr: function( name, fn ) {
|
| 1456 |
+
return this.each(function(){
|
| 1457 |
+
jQuery.attr( this, name, "" );
|
| 1458 |
+
if ( this.nodeType === 1 ) {
|
| 1459 |
+
this.removeAttribute( name );
|
| 1460 |
+
}
|
| 1461 |
+
});
|
| 1462 |
+
},
|
| 1463 |
+
|
| 1464 |
+
addClass: function( value ) {
|
| 1465 |
+
if ( jQuery.isFunction(value) ) {
|
| 1466 |
+
return this.each(function(i) {
|
| 1467 |
+
var self = jQuery(this);
|
| 1468 |
+
self.addClass( value.call(this, i, self.attr("class")) );
|
| 1469 |
+
});
|
| 1470 |
+
}
|
| 1471 |
+
|
| 1472 |
+
if ( value && typeof value === "string" ) {
|
| 1473 |
+
var classNames = (value || "").split( rspaces );
|
| 1474 |
+
|
| 1475 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
| 1476 |
+
var elem = this[i];
|
| 1477 |
+
|
| 1478 |
+
if ( elem.nodeType === 1 ) {
|
| 1479 |
+
if ( !elem.className ) {
|
| 1480 |
+
elem.className = value;
|
| 1481 |
+
|
| 1482 |
+
} else {
|
| 1483 |
+
var className = " " + elem.className + " ",
|
| 1484 |
+
setClass = elem.className;
|
| 1485 |
+
|
| 1486 |
+
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
|
| 1487 |
+
if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
|
| 1488 |
+
setClass += " " + classNames[c];
|
| 1489 |
+
}
|
| 1490 |
+
}
|
| 1491 |
+
elem.className = jQuery.trim( setClass );
|
| 1492 |
+
}
|
| 1493 |
+
}
|
| 1494 |
+
}
|
| 1495 |
+
}
|
| 1496 |
+
|
| 1497 |
+
return this;
|
| 1498 |
+
},
|
| 1499 |
+
|
| 1500 |
+
removeClass: function( value ) {
|
| 1501 |
+
if ( jQuery.isFunction(value) ) {
|
| 1502 |
+
return this.each(function(i) {
|
| 1503 |
+
var self = jQuery(this);
|
| 1504 |
+
self.removeClass( value.call(this, i, self.attr("class")) );
|
| 1505 |
+
});
|
| 1506 |
+
}
|
| 1507 |
+
|
| 1508 |
+
if ( (value && typeof value === "string") || value === undefined ) {
|
| 1509 |
+
var classNames = (value || "").split( rspaces );
|
| 1510 |
+
|
| 1511 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
| 1512 |
+
var elem = this[i];
|
| 1513 |
+
|
| 1514 |
+
if ( elem.nodeType === 1 && elem.className ) {
|
| 1515 |
+
if ( value ) {
|
| 1516 |
+
var className = (" " + elem.className + " ").replace(rclass, " ");
|
| 1517 |
+
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
|
| 1518 |
+
className = className.replace(" " + classNames[c] + " ", " ");
|
| 1519 |
+
}
|
| 1520 |
+
elem.className = jQuery.trim( className );
|
| 1521 |
+
|
| 1522 |
+
} else {
|
| 1523 |
+
elem.className = "";
|
| 1524 |
+
}
|
| 1525 |
+
}
|
| 1526 |
+
}
|
| 1527 |
+
}
|
| 1528 |
+
|
| 1529 |
+
return this;
|
| 1530 |
+
},
|
| 1531 |
+
|
| 1532 |
+
toggleClass: function( value, stateVal ) {
|
| 1533 |
+
var type = typeof value,
|
| 1534 |
+
isBool = typeof stateVal === "boolean";
|
| 1535 |
+
|
| 1536 |
+
if ( jQuery.isFunction( value ) ) {
|
| 1537 |
+
return this.each(function(i) {
|
| 1538 |
+
var self = jQuery(this);
|
| 1539 |
+
self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
|
| 1540 |
+
});
|
| 1541 |
+
}
|
| 1542 |
+
|
| 1543 |
+
return this.each(function() {
|
| 1544 |
+
if ( type === "string" ) {
|
| 1545 |
+
// toggle individual class names
|
| 1546 |
+
var className,
|
| 1547 |
+
i = 0,
|
| 1548 |
+
self = jQuery( this ),
|
| 1549 |
+
state = stateVal,
|
| 1550 |
+
classNames = value.split( rspaces );
|
| 1551 |
+
|
| 1552 |
+
while ( (className = classNames[ i++ ]) ) {
|
| 1553 |
+
// check each className given, space seperated list
|
| 1554 |
+
state = isBool ? state : !self.hasClass( className );
|
| 1555 |
+
self[ state ? "addClass" : "removeClass" ]( className );
|
| 1556 |
+
}
|
| 1557 |
+
|
| 1558 |
+
} else if ( type === "undefined" || type === "boolean" ) {
|
| 1559 |
+
if ( this.className ) {
|
| 1560 |
+
// store className if set
|
| 1561 |
+
jQuery.data( this, "__className__", this.className );
|
| 1562 |
+
}
|
| 1563 |
+
|
| 1564 |
+
// toggle whole className
|
| 1565 |
+
this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
|
| 1566 |
+
}
|
| 1567 |
+
});
|
| 1568 |
+
},
|
| 1569 |
+
|
| 1570 |
+
hasClass: function( selector ) {
|
| 1571 |
+
var className = " " + selector + " ";
|
| 1572 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
| 1573 |
+
if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
|
| 1574 |
+
return true;
|
| 1575 |
+
}
|
| 1576 |
+
}
|
| 1577 |
+
|
| 1578 |
+
return false;
|
| 1579 |
+
},
|
| 1580 |
+
|
| 1581 |
+
val: function( value ) {
|
| 1582 |
+
if ( !arguments.length ) {
|
| 1583 |
+
var elem = this[0];
|
| 1584 |
+
|
| 1585 |
+
if ( elem ) {
|
| 1586 |
+
if ( jQuery.nodeName( elem, "option" ) ) {
|
| 1587 |
+
// attributes.value is undefined in Blackberry 4.7 but
|
| 1588 |
+
// uses .value. See #6932
|
| 1589 |
+
var val = elem.attributes.value;
|
| 1590 |
+
return !val || val.specified ? elem.value : elem.text;
|
| 1591 |
+
}
|
| 1592 |
+
|
| 1593 |
+
// We need to handle select boxes special
|
| 1594 |
+
if ( jQuery.nodeName( elem, "select" ) ) {
|
| 1595 |
+
var index = elem.selectedIndex,
|
| 1596 |
+
values = [],
|
| 1597 |
+
options = elem.options,
|
| 1598 |
+
one = elem.type === "select-one";
|
| 1599 |
+
|
| 1600 |
+
// Nothing was selected
|
| 1601 |
+
if ( index < 0 ) {
|
| 1602 |
+
return null;
|
| 1603 |
+
}
|
| 1604 |
+
|
| 1605 |
+
// Loop through all the selected options
|
| 1606 |
+
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
|
| 1607 |
+
var option = options[ i ];
|
| 1608 |
+
|
| 1609 |
+
// Don't return options that are disabled or in a disabled optgroup
|
| 1610 |
+
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
|
| 1611 |
+
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
|
| 1612 |
+
|
| 1613 |
+
// Get the specific value for the option
|
| 1614 |
+
value = jQuery(option).val();
|
| 1615 |
+
|
| 1616 |
+
// We don't need an array for one selects
|
| 1617 |
+
if ( one ) {
|
| 1618 |
+
return value;
|
| 1619 |
+
}
|
| 1620 |
+
|
| 1621 |
+
// Multi-Selects return an array
|
| 1622 |
+
values.push( value );
|
| 1623 |
+
}
|
| 1624 |
+
}
|
| 1625 |
+
|
| 1626 |
+
return values;
|
| 1627 |
+
}
|
| 1628 |
+
|
| 1629 |
+
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
|
| 1630 |
+
if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
|
| 1631 |
+
return elem.getAttribute("value") === null ? "on" : elem.value;
|
| 1632 |
+
}
|
| 1633 |
+
|
| 1634 |
+
|
| 1635 |
+
// Everything else, we just grab the value
|
| 1636 |
+
return (elem.value || "").replace(rreturn, "");
|
| 1637 |
+
|
| 1638 |
+
}
|
| 1639 |
+
|
| 1640 |
+
return undefined;
|
| 1641 |
+
}
|
| 1642 |
+
|
| 1643 |
+
var isFunction = jQuery.isFunction(value);
|
| 1644 |
+
|
| 1645 |
+
return this.each(function(i) {
|
| 1646 |
+
var self = jQuery(this), val = value;
|
| 1647 |
+
|
| 1648 |
+
if ( this.nodeType !== 1 ) {
|
| 1649 |
+
return;
|
| 1650 |
+
}
|
| 1651 |
+
|
| 1652 |
+
if ( isFunction ) {
|
| 1653 |
+
val = value.call(this, i, self.val());
|
| 1654 |
+
}
|
| 1655 |
+
|
| 1656 |
+
// Treat null/undefined as ""; convert numbers to string
|
| 1657 |
+
if ( val == null ) {
|
| 1658 |
+
val = "";
|
| 1659 |
+
} else if ( typeof val === "number" ) {
|
| 1660 |
+
val += "";
|
| 1661 |
+
} else if ( jQuery.isArray(val) ) {
|
| 1662 |
+
val = jQuery.map(val, function (value) {
|
| 1663 |
+
return value == null ? "" : value + "";
|
| 1664 |
+
});
|
| 1665 |
+
}
|
| 1666 |
+
|
| 1667 |
+
if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
|
| 1668 |
+
this.checked = jQuery.inArray( self.val(), val ) >= 0;
|
| 1669 |
+
|
| 1670 |
+
} else if ( jQuery.nodeName( this, "select" ) ) {
|
| 1671 |
+
var values = jQuery.makeArray(val);
|
| 1672 |
+
|
| 1673 |
+
jQuery( "option", this ).each(function() {
|
| 1674 |
+
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
|
| 1675 |
+
});
|
| 1676 |
+
|
| 1677 |
+
if ( !values.length ) {
|
| 1678 |
+
this.selectedIndex = -1;
|
| 1679 |
+
}
|
| 1680 |
+
|
| 1681 |
+
} else {
|
| 1682 |
+
this.value = val;
|
| 1683 |
+
}
|
| 1684 |
+
});
|
| 1685 |
+
}
|
| 1686 |
+
});
|
| 1687 |
+
|
| 1688 |
+
jQuery.extend({
|
| 1689 |
+
attrFn: {
|
| 1690 |
+
val: true,
|
| 1691 |
+
css: true,
|
| 1692 |
+
html: true,
|
| 1693 |
+
text: true,
|
| 1694 |
+
data: true,
|
| 1695 |
+
width: true,
|
| 1696 |
+
height: true,
|
| 1697 |
+
offset: true
|
| 1698 |
+
},
|
| 1699 |
+
|
| 1700 |
+
attr: function( elem, name, value, pass ) {
|
| 1701 |
+
// don't set attributes on text and comment nodes
|
| 1702 |
+
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
|
| 1703 |
+
return undefined;
|
| 1704 |
+
}
|
| 1705 |
+
|
| 1706 |
+
if ( pass && name in jQuery.attrFn ) {
|
| 1707 |
+
return jQuery(elem)[name](value);
|
| 1708 |
+
}
|
| 1709 |
+
|
| 1710 |
+
var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
|
| 1711 |
+
// Whether we are setting (or getting)
|
| 1712 |
+
set = value !== undefined;
|
| 1713 |
+
|
| 1714 |
+
// Try to normalize/fix the name
|
| 1715 |
+
name = notxml && jQuery.props[ name ] || name;
|
| 1716 |
+
|
| 1717 |
+
// These attributes require special treatment
|
| 1718 |
+
var special = rspecialurl.test( name );
|
| 1719 |
+
|
| 1720 |
+
// Safari mis-reports the default selected property of an option
|
| 1721 |
+
// Accessing the parent's selectedIndex property fixes it
|
| 1722 |
+
if ( name === "selected" && !jQuery.support.optSelected ) {
|
| 1723 |
+
var parent = elem.parentNode;
|
| 1724 |
+
if ( parent ) {
|
| 1725 |
+
parent.selectedIndex;
|
| 1726 |
+
|
| 1727 |
+
// Make sure that it also works with optgroups, see #5701
|
| 1728 |
+
if ( parent.parentNode ) {
|
| 1729 |
+
parent.parentNode.selectedIndex;
|
| 1730 |
+
}
|
| 1731 |
+
}
|
| 1732 |
+
}
|
| 1733 |
+
|
| 1734 |
+
// If applicable, access the attribute via the DOM 0 way
|
| 1735 |
+
// 'in' checks fail in Blackberry 4.7 #6931
|
| 1736 |
+
if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
|
| 1737 |
+
if ( set ) {
|
| 1738 |
+
// We can't allow the type property to be changed (since it causes problems in IE)
|
| 1739 |
+
if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
|
| 1740 |
+
jQuery.error( "type property can't be changed" );
|
| 1741 |
+
}
|
| 1742 |
+
|
| 1743 |
+
if ( value === null ) {
|
| 1744 |
+
if ( elem.nodeType === 1 ) {
|
| 1745 |
+
elem.removeAttribute( name );
|
| 1746 |
+
}
|
| 1747 |
+
|
| 1748 |
+
} else {
|
| 1749 |
+
elem[ name ] = value;
|
| 1750 |
+
}
|
| 1751 |
+
}
|
| 1752 |
+
|
| 1753 |
+
// browsers index elements by id/name on forms, give priority to attributes.
|
| 1754 |
+
if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
|
| 1755 |
+
return elem.getAttributeNode( name ).nodeValue;
|
| 1756 |
+
}
|
| 1757 |
+
|
| 1758 |
+
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
|
| 1759 |
+
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
| 1760 |
+
if ( name === "tabIndex" ) {
|
| 1761 |
+
var attributeNode = elem.getAttributeNode( "tabIndex" );
|
| 1762 |
+
|
| 1763 |
+
return attributeNode && attributeNode.specified ?
|
| 1764 |
+
attributeNode.value :
|
| 1765 |
+
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
|
| 1766 |
+
0 :
|
| 1767 |
+
undefined;
|
| 1768 |
+
}
|
| 1769 |
+
|
| 1770 |
+
return elem[ name ];
|
| 1771 |
+
}
|
| 1772 |
+
|
| 1773 |
+
if ( !jQuery.support.style && notxml && name === "style" ) {
|
| 1774 |
+
if ( set ) {
|
| 1775 |
+
elem.style.cssText = "" + value;
|
| 1776 |
+
}
|
| 1777 |
+
|
| 1778 |
+
return elem.style.cssText;
|
| 1779 |
+
}
|
| 1780 |
+
|
| 1781 |
+
if ( set ) {
|
| 1782 |
+
// convert the value to a string (all browsers do this but IE) see #1070
|
| 1783 |
+
elem.setAttribute( name, "" + value );
|
| 1784 |
+
}
|
| 1785 |
+
|
| 1786 |
+
// Ensure that missing attributes return undefined
|
| 1787 |
+
// Blackberry 4.7 returns "" from getAttribute #6938
|
| 1788 |
+
if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
|
| 1789 |
+
return undefined;
|
| 1790 |
+
}
|
| 1791 |
+
|
| 1792 |
+
var attr = !jQuery.support.hrefNormalized && notxml && special ?
|
| 1793 |
+
// Some attributes require a special call on IE
|
| 1794 |
+
elem.getAttribute( name, 2 ) :
|
| 1795 |
+
elem.getAttribute( name );
|
| 1796 |
+
|
| 1797 |
+
// Non-existent attributes return null, we normalize to undefined
|
| 1798 |
+
return attr === null ? undefined : attr;
|
| 1799 |
+
}
|
| 1800 |
+
});
|
| 1801 |
+
|
| 1802 |
+
|
| 1803 |
+
|
| 1804 |
+
|
| 1805 |
+
var rnamespaces = /\.(.*)$/,
|
| 1806 |
+
rformElems = /^(?:textarea|input|select)$/i,
|
| 1807 |
+
rperiod = /\./g,
|
| 1808 |
+
rspace = / /g,
|
| 1809 |
+
rescape = /[^\w\s.|`]/g,
|
| 1810 |
+
fcleanup = function( nm ) {
|
| 1811 |
+
return nm.replace(rescape, "\\$&");
|
| 1812 |
+
},
|
| 1813 |
+
focusCounts = { focusin: 0, focusout: 0 };
|
| 1814 |
+
|
| 1815 |
+
/*
|
| 1816 |
+
* A number of helper functions used for managing events.
|
| 1817 |
+
* Many of the ideas behind this code originated from
|
| 1818 |
+
* Dean Edwards' addEvent library.
|
| 1819 |
+
*/
|
| 1820 |
+
jQuery.event = {
|
| 1821 |
+
|
| 1822 |
+
// Bind an event to an element
|
| 1823 |
+
// Original by Dean Edwards
|
| 1824 |
+
add: function( elem, types, handler, data ) {
|
| 1825 |
+
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
|
| 1826 |
+
return;
|
| 1827 |
+
}
|
| 1828 |
+
|
| 1829 |
+
// For whatever reason, IE has trouble passing the window object
|
| 1830 |
+
// around, causing it to be cloned in the process
|
| 1831 |
+
if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
|
| 1832 |
+
elem = window;
|
| 1833 |
+
}
|
| 1834 |
+
|
| 1835 |
+
if ( handler === false ) {
|
| 1836 |
+
handler = returnFalse;
|
| 1837 |
+
} else if ( !handler ) {
|
| 1838 |
+
// Fixes bug #7229. Fix recommended by jdalton
|
| 1839 |
+
return;
|
| 1840 |
+
}
|
| 1841 |
+
|
| 1842 |
+
var handleObjIn, handleObj;
|
| 1843 |
+
|
| 1844 |
+
if ( handler.handler ) {
|
| 1845 |
+
handleObjIn = handler;
|
| 1846 |
+
handler = handleObjIn.handler;
|
| 1847 |
+
}
|
| 1848 |
+
|
| 1849 |
+
// Make sure that the function being executed has a unique ID
|
| 1850 |
+
if ( !handler.guid ) {
|
| 1851 |
+
handler.guid = jQuery.guid++;
|
| 1852 |
+
}
|
| 1853 |
+
|
| 1854 |
+
// Init the element's event structure
|
| 1855 |
+
var elemData = jQuery.data( elem );
|
| 1856 |
+
|
| 1857 |
+
// If no elemData is found then we must be trying to bind to one of the
|
| 1858 |
+
// banned noData elements
|
| 1859 |
+
if ( !elemData ) {
|
| 1860 |
+
return;
|
| 1861 |
+
}
|
| 1862 |
+
|
| 1863 |
+
// Use a key less likely to result in collisions for plain JS objects.
|
| 1864 |
+
// Fixes bug #7150.
|
| 1865 |
+
var eventKey = elem.nodeType ? "events" : "__events__",
|
| 1866 |
+
events = elemData[ eventKey ],
|
| 1867 |
+
eventHandle = elemData.handle;
|
| 1868 |
+
|
| 1869 |
+
if ( typeof events === "function" ) {
|
| 1870 |
+
// On plain objects events is a fn that holds the the data
|
| 1871 |
+
// which prevents this data from being JSON serialized
|
| 1872 |
+
// the function does not need to be called, it just contains the data
|
| 1873 |
+
eventHandle = events.handle;
|
| 1874 |
+
events = events.events;
|
| 1875 |
+
|
| 1876 |
+
} else if ( !events ) {
|
| 1877 |
+
if ( !elem.nodeType ) {
|
| 1878 |
+
// On plain objects, create a fn that acts as the holder
|
| 1879 |
+
// of the values to avoid JSON serialization of event data
|
| 1880 |
+
elemData[ eventKey ] = elemData = function(){};
|
| 1881 |
+
}
|
| 1882 |
+
|
| 1883 |
+
elemData.events = events = {};
|
| 1884 |
+
}
|
| 1885 |
+
|
| 1886 |
+
if ( !eventHandle ) {
|
| 1887 |
+
elemData.handle = eventHandle = function() {
|
| 1888 |
+
// Handle the second event of a trigger and when
|
| 1889 |
+
// an event is called after a page has unloaded
|
| 1890 |
+
return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
|
| 1891 |
+
jQuery.event.handle.apply( eventHandle.elem, arguments ) :
|
| 1892 |
+
undefined;
|
| 1893 |
+
};
|
| 1894 |
+
}
|
| 1895 |
+
|
| 1896 |
+
// Add elem as a property of the handle function
|
| 1897 |
+
// This is to prevent a memory leak with non-native events in IE.
|
| 1898 |
+
eventHandle.elem = elem;
|
| 1899 |
+
|
| 1900 |
+
// Handle multiple events separated by a space
|
| 1901 |
+
// jQuery(...).bind("mouseover mouseout", fn);
|
| 1902 |
+
types = types.split(" ");
|
| 1903 |
+
|
| 1904 |
+
var type, i = 0, namespaces;
|
| 1905 |
+
|
| 1906 |
+
while ( (type = types[ i++ ]) ) {
|
| 1907 |
+
handleObj = handleObjIn ?
|
| 1908 |
+
jQuery.extend({}, handleObjIn) :
|
| 1909 |
+
{ handler: handler, data: data };
|
| 1910 |
+
|
| 1911 |
+
// Namespaced event handlers
|
| 1912 |
+
if ( type.indexOf(".") > -1 ) {
|
| 1913 |
+
namespaces = type.split(".");
|
| 1914 |
+
type = namespaces.shift();
|
| 1915 |
+
handleObj.namespace = namespaces.slice(0).sort().join(".");
|
| 1916 |
+
|
| 1917 |
+
} else {
|
| 1918 |
+
namespaces = [];
|
| 1919 |
+
handleObj.namespace = "";
|
| 1920 |
+
}
|
| 1921 |
+
|
| 1922 |
+
handleObj.type = type;
|
| 1923 |
+
if ( !handleObj.guid ) {
|
| 1924 |
+
handleObj.guid = handler.guid;
|
| 1925 |
+
}
|
| 1926 |
+
|
| 1927 |
+
// Get the current list of functions bound to this event
|
| 1928 |
+
var handlers = events[ type ],
|
| 1929 |
+
special = jQuery.event.special[ type ] || {};
|
| 1930 |
+
|
| 1931 |
+
// Init the event handler queue
|
| 1932 |
+
if ( !handlers ) {
|
| 1933 |
+
handlers = events[ type ] = [];
|
| 1934 |
+
|
| 1935 |
+
// Check for a special event handler
|
| 1936 |
+
// Only use addEventListener/attachEvent if the special
|
| 1937 |
+
// events handler returns false
|
| 1938 |
+
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
|
| 1939 |
+
// Bind the global event handler to the element
|
| 1940 |
+
if ( elem.addEventListener ) {
|
| 1941 |
+
elem.addEventListener( type, eventHandle, false );
|
| 1942 |
+
|
| 1943 |
+
} else if ( elem.attachEvent ) {
|
| 1944 |
+
elem.attachEvent( "on" + type, eventHandle );
|
| 1945 |
+
}
|
| 1946 |
+
}
|
| 1947 |
+
}
|
| 1948 |
+
|
| 1949 |
+
if ( special.add ) {
|
| 1950 |
+
special.add.call( elem, handleObj );
|
| 1951 |
+
|
| 1952 |
+
if ( !handleObj.handler.guid ) {
|
| 1953 |
+
handleObj.handler.guid = handler.guid;
|
| 1954 |
+
}
|
| 1955 |
+
}
|
| 1956 |
+
|
| 1957 |
+
// Add the function to the element's handler list
|
| 1958 |
+
handlers.push( handleObj );
|
| 1959 |
+
|
| 1960 |
+
// Keep track of which events have been used, for global triggering
|
| 1961 |
+
jQuery.event.global[ type ] = true;
|
| 1962 |
+
}
|
| 1963 |
+
|
| 1964 |
+
// Nullify elem to prevent memory leaks in IE
|
| 1965 |
+
elem = null;
|
| 1966 |
+
},
|
| 1967 |
+
|
| 1968 |
+
global: {},
|
| 1969 |
+
|
| 1970 |
+
// Detach an event or set of events from an element
|
| 1971 |
+
remove: function( elem, types, handler, pos ) {
|
| 1972 |
+
// don't do events on text and comment nodes
|
| 1973 |
+
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
|
| 1974 |
+
return;
|
| 1975 |
+
}
|
| 1976 |
+
|
| 1977 |
+
if ( handler === false ) {
|
| 1978 |
+
handler = returnFalse;
|
| 1979 |
+
}
|
| 1980 |
+
|
| 1981 |
+
var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
|
| 1982 |
+
eventKey = elem.nodeType ? "events" : "__events__",
|
| 1983 |
+
elemData = jQuery.data( elem ),
|
| 1984 |
+
events = elemData && elemData[ eventKey ];
|
| 1985 |
+
|
| 1986 |
+
if ( !elemData || !events ) {
|
| 1987 |
+
return;
|
| 1988 |
+
}
|
| 1989 |
+
|
| 1990 |
+
if ( typeof events === "function" ) {
|
| 1991 |
+
elemData = events;
|
| 1992 |
+
events = events.events;
|
| 1993 |
+
}
|
| 1994 |
+
|
| 1995 |
+
// types is actually an event object here
|
| 1996 |
+
if ( types && types.type ) {
|
| 1997 |
+
handler = types.handler;
|
| 1998 |
+
types = types.type;
|
| 1999 |
+
}
|
| 2000 |
+
|
| 2001 |
+
// Unbind all events for the element
|
| 2002 |
+
if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
|
| 2003 |
+
types = types || "";
|
| 2004 |
+
|
| 2005 |
+
for ( type in events ) {
|
| 2006 |
+
jQuery.event.remove( elem, type + types );
|
| 2007 |
+
}
|
| 2008 |
+
|
| 2009 |
+
return;
|
| 2010 |
+
}
|
| 2011 |
+
|
| 2012 |
+
// Handle multiple events separated by a space
|
| 2013 |
+
// jQuery(...).unbind("mouseover mouseout", fn);
|
| 2014 |
+
types = types.split(" ");
|
| 2015 |
+
|
| 2016 |
+
while ( (type = types[ i++ ]) ) {
|
| 2017 |
+
origType = type;
|
| 2018 |
+
handleObj = null;
|
| 2019 |
+
all = type.indexOf(".") < 0;
|
| 2020 |
+
namespaces = [];
|
| 2021 |
+
|
| 2022 |
+
if ( !all ) {
|
| 2023 |
+
// Namespaced event handlers
|
| 2024 |
+
namespaces = type.split(".");
|
| 2025 |
+
type = namespaces.shift();
|
| 2026 |
+
|
| 2027 |
+
namespace = new RegExp("(^|\\.)" +
|
| 2028 |
+
jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
|
| 2029 |
+
}
|
| 2030 |
+
|
| 2031 |
+
eventType = events[ type ];
|
| 2032 |
+
|
| 2033 |
+
if ( !eventType ) {
|
| 2034 |
+
continue;
|
| 2035 |
+
}
|
| 2036 |
+
|
| 2037 |
+
if ( !handler ) {
|
| 2038 |
+
for ( j = 0; j < eventType.length; j++ ) {
|
| 2039 |
+
handleObj = eventType[ j ];
|
| 2040 |
+
|
| 2041 |
+
if ( all || namespace.test( handleObj.namespace ) ) {
|
| 2042 |
+
jQuery.event.remove( elem, origType, handleObj.handler, j );
|
| 2043 |
+
eventType.splice( j--, 1 );
|
| 2044 |
+
}
|
| 2045 |
+
}
|
| 2046 |
+
|
| 2047 |
+
continue;
|
| 2048 |
+
}
|
| 2049 |
+
|
| 2050 |
+
special = jQuery.event.special[ type ] || {};
|
| 2051 |
+
|
| 2052 |
+
for ( j = pos || 0; j < eventType.length; j++ ) {
|
| 2053 |
+
handleObj = eventType[ j ];
|
| 2054 |
+
|
| 2055 |
+
if ( handler.guid === handleObj.guid ) {
|
| 2056 |
+
// remove the given handler for the given type
|
| 2057 |
+
if ( all || namespace.test( handleObj.namespace ) ) {
|
| 2058 |
+
if ( pos == null ) {
|
| 2059 |
+
eventType.splice( j--, 1 );
|
| 2060 |
+
}
|
| 2061 |
+
|
| 2062 |
+
if ( special.remove ) {
|
| 2063 |
+
special.remove.call( elem, handleObj );
|
| 2064 |
+
}
|
| 2065 |
+
}
|
| 2066 |
+
|
| 2067 |
+
if ( pos != null ) {
|
| 2068 |
+
break;
|
| 2069 |
+
}
|
| 2070 |
+
}
|
| 2071 |
+
}
|
| 2072 |
+
|
| 2073 |
+
// remove generic event handler if no more handlers exist
|
| 2074 |
+
if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
|
| 2075 |
+
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
|
| 2076 |
+
jQuery.removeEvent( elem, type, elemData.handle );
|
| 2077 |
+
}
|
| 2078 |
+
|
| 2079 |
+
ret = null;
|
| 2080 |
+
delete events[ type ];
|
| 2081 |
+
}
|
| 2082 |
+
}
|
| 2083 |
+
|
| 2084 |
+
// Remove the expando if it's no longer used
|
| 2085 |
+
if ( jQuery.isEmptyObject( events ) ) {
|
| 2086 |
+
var handle = elemData.handle;
|
| 2087 |
+
if ( handle ) {
|
| 2088 |
+
handle.elem = null;
|
| 2089 |
+
}
|
| 2090 |
+
|
| 2091 |
+
delete elemData.events;
|
| 2092 |
+
delete elemData.handle;
|
| 2093 |
+
|
| 2094 |
+
if ( typeof elemData === "function" ) {
|
| 2095 |
+
jQuery.removeData( elem, eventKey );
|
| 2096 |
+
|
| 2097 |
+
} else if ( jQuery.isEmptyObject( elemData ) ) {
|
| 2098 |
+
jQuery.removeData( elem );
|
| 2099 |
+
}
|
| 2100 |
+
}
|
| 2101 |
+
},
|
| 2102 |
+
|
| 2103 |
+
// bubbling is internal
|
| 2104 |
+
trigger: function( event, data, elem /*, bubbling */ ) {
|
| 2105 |
+
// Event object or event type
|
| 2106 |
+
var type = event.type || event,
|
| 2107 |
+
bubbling = arguments[3];
|
| 2108 |
+
|
| 2109 |
+
if ( !bubbling ) {
|
| 2110 |
+
event = typeof event === "object" ?
|
| 2111 |
+
// jQuery.Event object
|
| 2112 |
+
event[ jQuery.expando ] ? event :
|
| 2113 |
+
// Object literal
|
| 2114 |
+
jQuery.extend( jQuery.Event(type), event ) :
|
| 2115 |
+
// Just the event type (string)
|
| 2116 |
+
jQuery.Event(type);
|
| 2117 |
+
|
| 2118 |
+
if ( type.indexOf("!") >= 0 ) {
|
| 2119 |
+
event.type = type = type.slice(0, -1);
|
| 2120 |
+
event.exclusive = true;
|
| 2121 |
+
}
|
| 2122 |
+
|
| 2123 |
+
// Handle a global trigger
|
| 2124 |
+
if ( !elem ) {
|
| 2125 |
+
// Don't bubble custom events when global (to avoid too much overhead)
|
| 2126 |
+
event.stopPropagation();
|
| 2127 |
+
|
| 2128 |
+
// Only trigger if we've ever bound an event for it
|
| 2129 |
+
if ( jQuery.event.global[ type ] ) {
|
| 2130 |
+
jQuery.each( jQuery.cache, function() {
|
| 2131 |
+
if ( this.events && this.events[type] ) {
|
| 2132 |
+
jQuery.event.trigger( event, data, this.handle.elem );
|
| 2133 |
+
}
|
| 2134 |
+
});
|
| 2135 |
+
}
|
| 2136 |
+
}
|
| 2137 |
+
|
| 2138 |
+
// Handle triggering a single element
|
| 2139 |
+
|
| 2140 |
+
// don't do events on text and comment nodes
|
| 2141 |
+
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
|
| 2142 |
+
return undefined;
|
| 2143 |
+
}
|
| 2144 |
+
|
| 2145 |
+
// Clean up in case it is reused
|
| 2146 |
+
event.result = undefined;
|
| 2147 |
+
event.target = elem;
|
| 2148 |
+
|
| 2149 |
+
// Clone the incoming data, if any
|
| 2150 |
+
data = jQuery.makeArray( data );
|
| 2151 |
+
data.unshift( event );
|
| 2152 |
+
}
|
| 2153 |
+
|
| 2154 |
+
event.currentTarget = elem;
|
| 2155 |
+
|
| 2156 |
+
// Trigger the event, it is assumed that "handle" is a function
|
| 2157 |
+
var handle = elem.nodeType ?
|
| 2158 |
+
jQuery.data( elem, "handle" ) :
|
| 2159 |
+
(jQuery.data( elem, "__events__" ) || {}).handle;
|
| 2160 |
+
|
| 2161 |
+
if ( handle ) {
|
| 2162 |
+
handle.apply( elem, data );
|
| 2163 |
+
}
|
| 2164 |
+
|
| 2165 |
+
var parent = elem.parentNode || elem.ownerDocument;
|
| 2166 |
+
|
| 2167 |
+
// Trigger an inline bound script
|
| 2168 |
+
try {
|
| 2169 |
+
if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
|
| 2170 |
+
if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
|
| 2171 |
+
event.result = false;
|
| 2172 |
+
event.preventDefault();
|
| 2173 |
+
}
|
| 2174 |
+
}
|
| 2175 |
+
|
| 2176 |
+
// prevent IE from throwing an error for some elements with some event types, see #3533
|
| 2177 |
+
} catch (inlineError) {}
|
| 2178 |
+
|
| 2179 |
+
if ( !event.isPropagationStopped() && parent ) {
|
| 2180 |
+
jQuery.event.trigger( event, data, parent, true );
|
| 2181 |
+
|
| 2182 |
+
} else if ( !event.isDefaultPrevented() ) {
|
| 2183 |
+
var old,
|
| 2184 |
+
target = event.target,
|
| 2185 |
+
targetType = type.replace( rnamespaces, "" ),
|
| 2186 |
+
isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
|
| 2187 |
+
special = jQuery.event.special[ targetType ] || {};
|
| 2188 |
+
|
| 2189 |
+
if ( (!special._default || special._default.call( elem, event ) === false) &&
|
| 2190 |
+
!isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
|
| 2191 |
+
|
| 2192 |
+
try {
|
| 2193 |
+
if ( target[ targetType ] ) {
|
| 2194 |
+
// Make sure that we don't accidentally re-trigger the onFOO events
|
| 2195 |
+
old = target[ "on" + targetType ];
|
| 2196 |
+
|
| 2197 |
+
if ( old ) {
|
| 2198 |
+
target[ "on" + targetType ] = null;
|
| 2199 |
+
}
|
| 2200 |
+
|
| 2201 |
+
jQuery.event.triggered = true;
|
| 2202 |
+
target[ targetType ]();
|
| 2203 |
+
}
|
| 2204 |
+
|
| 2205 |
+
// prevent IE from throwing an error for some elements with some event types, see #3533
|
| 2206 |
+
} catch (triggerError) {}
|
| 2207 |
+
|
| 2208 |
+
if ( old ) {
|
| 2209 |
+
target[ "on" + targetType ] = old;
|
| 2210 |
+
}
|
| 2211 |
+
|
| 2212 |
+
jQuery.event.triggered = false;
|
| 2213 |
+
}
|
| 2214 |
+
}
|
| 2215 |
+
},
|
| 2216 |
+
|
| 2217 |
+
handle: function( event ) {
|
| 2218 |
+
var all, handlers, namespaces, namespace_re, events,
|
| 2219 |
+
namespace_sort = [],
|
| 2220 |
+
args = jQuery.makeArray( arguments );
|
| 2221 |
+
|
| 2222 |
+
event = args[0] = jQuery.event.fix( event || window.event );
|
| 2223 |
+
event.currentTarget = this;
|
| 2224 |
+
|
| 2225 |
+
// Namespaced event handlers
|
| 2226 |
+
all = event.type.indexOf(".") < 0 && !event.exclusive;
|
| 2227 |
+
|
| 2228 |
+
if ( !all ) {
|
| 2229 |
+
namespaces = event.type.split(".");
|
| 2230 |
+
event.type = namespaces.shift();
|
| 2231 |
+
namespace_sort = namespaces.slice(0).sort();
|
| 2232 |
+
namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
|
| 2233 |
+
}
|
| 2234 |
+
|
| 2235 |
+
event.namespace = event.namespace || namespace_sort.join(".");
|
| 2236 |
+
|
| 2237 |
+
events = jQuery.data(this, this.nodeType ? "events" : "__events__");
|
| 2238 |
+
|
| 2239 |
+
if ( typeof events === "function" ) {
|
| 2240 |
+
events = events.events;
|
| 2241 |
+
}
|
| 2242 |
+
|
| 2243 |
+
handlers = (events || {})[ event.type ];
|
| 2244 |
+
|
| 2245 |
+
if ( events && handlers ) {
|
| 2246 |
+
// Clone the handlers to prevent manipulation
|
| 2247 |
+
handlers = handlers.slice(0);
|
| 2248 |
+
|
| 2249 |
+
for ( var j = 0, l = handlers.length; j < l; j++ ) {
|
| 2250 |
+
var handleObj = handlers[ j ];
|
| 2251 |
+
|
| 2252 |
+
// Filter the functions by class
|
| 2253 |
+
if ( all || namespace_re.test( handleObj.namespace ) ) {
|
| 2254 |
+
// Pass in a reference to the handler function itself
|
| 2255 |
+
// So that we can later remove it
|
| 2256 |
+
event.handler = handleObj.handler;
|
| 2257 |
+
event.data = handleObj.data;
|
| 2258 |
+
event.handleObj = handleObj;
|
| 2259 |
+
|
| 2260 |
+
var ret = handleObj.handler.apply( this, args );
|
| 2261 |
+
|
| 2262 |
+
if ( ret !== undefined ) {
|
| 2263 |
+
event.result = ret;
|
| 2264 |
+
if ( ret === false ) {
|
| 2265 |
+
event.preventDefault();
|
| 2266 |
+
event.stopPropagation();
|
| 2267 |
+
}
|
| 2268 |
+
}
|
| 2269 |
+
|
| 2270 |
+
if ( event.isImmediatePropagationStopped() ) {
|
| 2271 |
+
break;
|
| 2272 |
+
}
|
| 2273 |
+
}
|
| 2274 |
+
}
|
| 2275 |
+
}
|
| 2276 |
+
|
| 2277 |
+
return event.result;
|
| 2278 |
+
},
|
| 2279 |
+
|
| 2280 |
+
props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
|
| 2281 |
+
|
| 2282 |
+
fix: function( event ) {
|
| 2283 |
+
if ( event[ jQuery.expando ] ) {
|
| 2284 |
+
return event;
|
| 2285 |
+
}
|
| 2286 |
+
|
| 2287 |
+
// store a copy of the original event object
|
| 2288 |
+
// and "clone" to set read-only properties
|
| 2289 |
+
var originalEvent = event;
|
| 2290 |
+
event = jQuery.Event( originalEvent );
|
| 2291 |
+
|
| 2292 |
+
for ( var i = this.props.length, prop; i; ) {
|
| 2293 |
+
prop = this.props[ --i ];
|
| 2294 |
+
event[ prop ] = originalEvent[ prop ];
|
| 2295 |
+
}
|
| 2296 |
+
|
| 2297 |
+
// Fix target property, if necessary
|
| 2298 |
+
if ( !event.target ) {
|
| 2299 |
+
// Fixes #1925 where srcElement might not be defined either
|
| 2300 |
+
event.target = event.srcElement || document;
|
| 2301 |
+
}
|
| 2302 |
+
|
| 2303 |
+
// check if target is a textnode (safari)
|
| 2304 |
+
if ( event.target.nodeType === 3 ) {
|
| 2305 |
+
event.target = event.target.parentNode;
|
| 2306 |
+
}
|
| 2307 |
+
|
| 2308 |
+
// Add relatedTarget, if necessary
|
| 2309 |
+
if ( !event.relatedTarget && event.fromElement ) {
|
| 2310 |
+
event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
|
| 2311 |
+
}
|
| 2312 |
+
|
| 2313 |
+
// Calculate pageX/Y if missing and clientX/Y available
|
| 2314 |
+
if ( event.pageX == null && event.clientX != null ) {
|
| 2315 |
+
var doc = document.documentElement,
|
| 2316 |
+
body = document.body;
|
| 2317 |
+
|
| 2318 |
+
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
|
| 2319 |
+
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
|
| 2320 |
+
}
|
| 2321 |
+
|
| 2322 |
+
// Add which for key events
|
| 2323 |
+
if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
|
| 2324 |
+
event.which = event.charCode != null ? event.charCode : event.keyCode;
|
| 2325 |
+
}
|
| 2326 |
+
|
| 2327 |
+
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
|
| 2328 |
+
if ( !event.metaKey && event.ctrlKey ) {
|
| 2329 |
+
event.metaKey = event.ctrlKey;
|
| 2330 |
+
}
|
| 2331 |
+
|
| 2332 |
+
// Add which for click: 1 === left; 2 === middle; 3 === right
|
| 2333 |
+
// Note: button is not normalized, so don't use it
|
| 2334 |
+
if ( !event.which && event.button !== undefined ) {
|
| 2335 |
+
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
|
| 2336 |
+
}
|
| 2337 |
+
|
| 2338 |
+
return event;
|
| 2339 |
+
},
|
| 2340 |
+
|
| 2341 |
+
// Deprecated, use jQuery.guid instead
|
| 2342 |
+
guid: 1E8,
|
| 2343 |
+
|
| 2344 |
+
// Deprecated, use jQuery.proxy instead
|
| 2345 |
+
proxy: jQuery.proxy,
|
| 2346 |
+
|
| 2347 |
+
special: {
|
| 2348 |
+
ready: {
|
| 2349 |
+
// Make sure the ready event is setup
|
| 2350 |
+
setup: jQuery.bindReady,
|
| 2351 |
+
teardown: jQuery.noop
|
| 2352 |
+
},
|
| 2353 |
+
|
| 2354 |
+
live: {
|
| 2355 |
+
add: function( handleObj ) {
|
| 2356 |
+
jQuery.event.add( this,
|
| 2357 |
+
liveConvert( handleObj.origType, handleObj.selector ),
|
| 2358 |
+
jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
|
| 2359 |
+
},
|
| 2360 |
+
|
| 2361 |
+
remove: function( handleObj ) {
|
| 2362 |
+
jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
|
| 2363 |
+
}
|
| 2364 |
+
},
|
| 2365 |
+
|
| 2366 |
+
beforeunload: {
|
| 2367 |
+
setup: function( data, namespaces, eventHandle ) {
|
| 2368 |
+
// We only want to do this special case on windows
|
| 2369 |
+
if ( jQuery.isWindow( this ) ) {
|
| 2370 |
+
this.onbeforeunload = eventHandle;
|
| 2371 |
+
}
|
| 2372 |
+
},
|
| 2373 |
+
|
| 2374 |
+
teardown: function( namespaces, eventHandle ) {
|
| 2375 |
+
if ( this.onbeforeunload === eventHandle ) {
|
| 2376 |
+
this.onbeforeunload = null;
|
| 2377 |
+
}
|
| 2378 |
+
}
|
| 2379 |
+
}
|
| 2380 |
+
}
|
| 2381 |
+
};
|
| 2382 |
+
|
| 2383 |
+
jQuery.removeEvent = document.removeEventListener ?
|
| 2384 |
+
function( elem, type, handle ) {
|
| 2385 |
+
if ( elem.removeEventListener ) {
|
| 2386 |
+
elem.removeEventListener( type, handle, false );
|
| 2387 |
+
}
|
| 2388 |
+
} :
|
| 2389 |
+
function( elem, type, handle ) {
|
| 2390 |
+
if ( elem.detachEvent ) {
|
| 2391 |
+
elem.detachEvent( "on" + type, handle );
|
| 2392 |
+
}
|
| 2393 |
+
};
|
| 2394 |
+
|
| 2395 |
+
jQuery.Event = function( src ) {
|
| 2396 |
+
// Allow instantiation without the 'new' keyword
|
| 2397 |
+
if ( !this.preventDefault ) {
|
| 2398 |
+
return new jQuery.Event( src );
|
| 2399 |
+
}
|
| 2400 |
+
|
| 2401 |
+
// Event object
|
| 2402 |
+
if ( src && src.type ) {
|
| 2403 |
+
this.originalEvent = src;
|
| 2404 |
+
this.type = src.type;
|
| 2405 |
+
// Event type
|
| 2406 |
+
} else {
|
| 2407 |
+
this.type = src;
|
| 2408 |
+
}
|
| 2409 |
+
|
| 2410 |
+
// timeStamp is buggy for some events on Firefox(#3843)
|
| 2411 |
+
// So we won't rely on the native value
|
| 2412 |
+
this.timeStamp = jQuery.now();
|
| 2413 |
+
|
| 2414 |
+
// Mark it as fixed
|
| 2415 |
+
this[ jQuery.expando ] = true;
|
| 2416 |
+
};
|
| 2417 |
+
|
| 2418 |
+
function returnFalse() {
|
| 2419 |
+
return false;
|
| 2420 |
+
}
|
| 2421 |
+
function returnTrue() {
|
| 2422 |
+
return true;
|
| 2423 |
+
}
|
| 2424 |
+
|
| 2425 |
+
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
|
| 2426 |
+
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
|
| 2427 |
+
jQuery.Event.prototype = {
|
| 2428 |
+
preventDefault: function() {
|
| 2429 |
+
this.isDefaultPrevented = returnTrue;
|
| 2430 |
+
|
| 2431 |
+
var e = this.originalEvent;
|
| 2432 |
+
if ( !e ) {
|
| 2433 |
+
return;
|
| 2434 |
+
}
|
| 2435 |
+
|
| 2436 |
+
// if preventDefault exists run it on the original event
|
| 2437 |
+
if ( e.preventDefault ) {
|
| 2438 |
+
e.preventDefault();
|
| 2439 |
+
|
| 2440 |
+
// otherwise set the returnValue property of the original event to false (IE)
|
| 2441 |
+
} else {
|
| 2442 |
+
e.returnValue = false;
|
| 2443 |
+
}
|
| 2444 |
+
},
|
| 2445 |
+
stopPropagation: function() {
|
| 2446 |
+
this.isPropagationStopped = returnTrue;
|
| 2447 |
+
|
| 2448 |
+
var e = this.originalEvent;
|
| 2449 |
+
if ( !e ) {
|
| 2450 |
+
return;
|
| 2451 |
+
}
|
| 2452 |
+
// if stopPropagation exists run it on the original event
|
| 2453 |
+
if ( e.stopPropagation ) {
|
| 2454 |
+
e.stopPropagation();
|
| 2455 |
+
}
|
| 2456 |
+
// otherwise set the cancelBubble property of the original event to true (IE)
|
| 2457 |
+
e.cancelBubble = true;
|
| 2458 |
+
},
|
| 2459 |
+
stopImmediatePropagation: function() {
|
| 2460 |
+
this.isImmediatePropagationStopped = returnTrue;
|
| 2461 |
+
this.stopPropagation();
|
| 2462 |
+
},
|
| 2463 |
+
isDefaultPrevented: returnFalse,
|
| 2464 |
+
isPropagationStopped: returnFalse,
|
| 2465 |
+
isImmediatePropagationStopped: returnFalse
|
| 2466 |
+
};
|
| 2467 |
+
|
| 2468 |
+
// Checks if an event happened on an element within another element
|
| 2469 |
+
// Used in jQuery.event.special.mouseenter and mouseleave handlers
|
| 2470 |
+
var withinElement = function( event ) {
|
| 2471 |
+
// Check if mouse(over|out) are still within the same parent element
|
| 2472 |
+
var parent = event.relatedTarget;
|
| 2473 |
+
|
| 2474 |
+
// Firefox sometimes assigns relatedTarget a XUL element
|
| 2475 |
+
// which we cannot access the parentNode property of
|
| 2476 |
+
try {
|
| 2477 |
+
// Traverse up the tree
|
| 2478 |
+
while ( parent && parent !== this ) {
|
| 2479 |
+
parent = parent.parentNode;
|
| 2480 |
+
}
|
| 2481 |
+
|
| 2482 |
+
if ( parent !== this ) {
|
| 2483 |
+
// set the correct event type
|
| 2484 |
+
event.type = event.data;
|
| 2485 |
+
|
| 2486 |
+
// handle event if we actually just moused on to a non sub-element
|
| 2487 |
+
jQuery.event.handle.apply( this, arguments );
|
| 2488 |
+
}
|
| 2489 |
+
|
| 2490 |
+
// assuming we've left the element since we most likely mousedover a xul element
|
| 2491 |
+
} catch(e) { }
|
| 2492 |
+
},
|
| 2493 |
+
|
| 2494 |
+
// In case of event delegation, we only need to rename the event.type,
|
| 2495 |
+
// liveHandler will take care of the rest.
|
| 2496 |
+
delegate = function( event ) {
|
| 2497 |
+
event.type = event.data;
|
| 2498 |
+
jQuery.event.handle.apply( this, arguments );
|
| 2499 |
+
};
|
| 2500 |
+
|
| 2501 |
+
// Create mouseenter and mouseleave events
|
| 2502 |
+
jQuery.each({
|
| 2503 |
+
mouseenter: "mouseover",
|
| 2504 |
+
mouseleave: "mouseout"
|
| 2505 |
+
}, function( orig, fix ) {
|
| 2506 |
+
jQuery.event.special[ orig ] = {
|
| 2507 |
+
setup: function( data ) {
|
| 2508 |
+
jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
|
| 2509 |
+
},
|
| 2510 |
+
teardown: function( data ) {
|
| 2511 |
+
jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
|
| 2512 |
+
}
|
| 2513 |
+
};
|
| 2514 |
+
});
|
| 2515 |
+
|
| 2516 |
+
// submit delegation
|
| 2517 |
+
if ( !jQuery.support.submitBubbles ) {
|
| 2518 |
+
|
| 2519 |
+
jQuery.event.special.submit = {
|
| 2520 |
+
setup: function( data, namespaces ) {
|
| 2521 |
+
if ( this.nodeName.toLowerCase() !== "form" ) {
|
| 2522 |
+
jQuery.event.add(this, "click.specialSubmit", function( e ) {
|
| 2523 |
+
var elem = e.target,
|
| 2524 |
+
type = elem.type;
|
| 2525 |
+
|
| 2526 |
+
if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
|
| 2527 |
+
e.liveFired = undefined;
|
| 2528 |
+
return trigger( "submit", this, arguments );
|
| 2529 |
+
}
|
| 2530 |
+
});
|
| 2531 |
+
|
| 2532 |
+
jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
|
| 2533 |
+
var elem = e.target,
|
| 2534 |
+
type = elem.type;
|
| 2535 |
+
|
| 2536 |
+
if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
|
| 2537 |
+
e.liveFired = undefined;
|
| 2538 |
+
return trigger( "submit", this, arguments );
|
| 2539 |
+
}
|
| 2540 |
+
});
|
| 2541 |
+
|
| 2542 |
+
} else {
|
| 2543 |
+
return false;
|
| 2544 |
+
}
|
| 2545 |
+
},
|
| 2546 |
+
|
| 2547 |
+
teardown: function( namespaces ) {
|
| 2548 |
+
jQuery.event.remove( this, ".specialSubmit" );
|
| 2549 |
+
}
|
| 2550 |
+
};
|
| 2551 |
+
|
| 2552 |
+
}
|
| 2553 |
+
|
| 2554 |
+
// change delegation, happens here so we have bind.
|
| 2555 |
+
if ( !jQuery.support.changeBubbles ) {
|
| 2556 |
+
|
| 2557 |
+
var changeFilters,
|
| 2558 |
+
|
| 2559 |
+
getVal = function( elem ) {
|
| 2560 |
+
var type = elem.type, val = elem.value;
|
| 2561 |
+
|
| 2562 |
+
if ( type === "radio" || type === "checkbox" ) {
|
| 2563 |
+
val = elem.checked;
|
| 2564 |
+
|
| 2565 |
+
} else if ( type === "select-multiple" ) {
|
| 2566 |
+
val = elem.selectedIndex > -1 ?
|
| 2567 |
+
jQuery.map( elem.options, function( elem ) {
|
| 2568 |
+
return elem.selected;
|
| 2569 |
+
}).join("-") :
|
| 2570 |
+
"";
|
| 2571 |
+
|
| 2572 |
+
} else if ( elem.nodeName.toLowerCase() === "select" ) {
|
| 2573 |
+
val = elem.selectedIndex;
|
| 2574 |
+
}
|
| 2575 |
+
|
| 2576 |
+
return val;
|
| 2577 |
+
},
|
| 2578 |
+
|
| 2579 |
+
testChange = function testChange( e ) {
|
| 2580 |
+
var elem = e.target, data, val;
|
| 2581 |
+
|
| 2582 |
+
if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
|
| 2583 |
+
return;
|
| 2584 |
+
}
|
| 2585 |
+
|
| 2586 |
+
data = jQuery.data( elem, "_change_data" );
|
| 2587 |
+
val = getVal(elem);
|
| 2588 |
+
|
| 2589 |
+
// the current data will be also retrieved by beforeactivate
|
| 2590 |
+
if ( e.type !== "focusout" || elem.type !== "radio" ) {
|
| 2591 |
+
jQuery.data( elem, "_change_data", val );
|
| 2592 |
+
}
|
| 2593 |
+
|
| 2594 |
+
if ( data === undefined || val === data ) {
|
| 2595 |
+
return;
|
| 2596 |
+
}
|
| 2597 |
+
|
| 2598 |
+
if ( data != null || val ) {
|
| 2599 |
+
e.type = "change";
|
| 2600 |
+
e.liveFired = undefined;
|
| 2601 |
+
return jQuery.event.trigger( e, arguments[1], elem );
|
| 2602 |
+
}
|
| 2603 |
+
};
|
| 2604 |
+
|
| 2605 |
+
jQuery.event.special.change = {
|
| 2606 |
+
filters: {
|
| 2607 |
+
focusout: testChange,
|
| 2608 |
+
|
| 2609 |
+
beforedeactivate: testChange,
|
| 2610 |
+
|
| 2611 |
+
click: function( e ) {
|
| 2612 |
+
var elem = e.target, type = elem.type;
|
| 2613 |
+
|
| 2614 |
+
if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
|
| 2615 |
+
return testChange.call( this, e );
|
| 2616 |
+
}
|
| 2617 |
+
},
|
| 2618 |
+
|
| 2619 |
+
// Change has to be called before submit
|
| 2620 |
+
// Keydown will be called before keypress, which is used in submit-event delegation
|
| 2621 |
+
keydown: function( e ) {
|
| 2622 |
+
var elem = e.target, type = elem.type;
|
| 2623 |
+
|
| 2624 |
+
if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
|
| 2625 |
+
(e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
|
| 2626 |
+
type === "select-multiple" ) {
|
| 2627 |
+
return testChange.call( this, e );
|
| 2628 |
+
}
|
| 2629 |
+
},
|
| 2630 |
+
|
| 2631 |
+
// Beforeactivate happens also before the previous element is blurred
|
| 2632 |
+
// with this event you can't trigger a change event, but you can store
|
| 2633 |
+
// information
|
| 2634 |
+
beforeactivate: function( e ) {
|
| 2635 |
+
var elem = e.target;
|
| 2636 |
+
jQuery.data( elem, "_change_data", getVal(elem) );
|
| 2637 |
+
}
|
| 2638 |
+
},
|
| 2639 |
+
|
| 2640 |
+
setup: function( data, namespaces ) {
|
| 2641 |
+
if ( this.type === "file" ) {
|
| 2642 |
+
return false;
|
| 2643 |
+
}
|
| 2644 |
+
|
| 2645 |
+
for ( var type in changeFilters ) {
|
| 2646 |
+
jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
|
| 2647 |
+
}
|
| 2648 |
+
|
| 2649 |
+
return rformElems.test( this.nodeName );
|
| 2650 |
+
},
|
| 2651 |
+
|
| 2652 |
+
teardown: function( namespaces ) {
|
| 2653 |
+
jQuery.event.remove( this, ".specialChange" );
|
| 2654 |
+
|
| 2655 |
+
return rformElems.test( this.nodeName );
|
| 2656 |
+
}
|
| 2657 |
+
};
|
| 2658 |
+
|
| 2659 |
+
changeFilters = jQuery.event.special.change.filters;
|
| 2660 |
+
|
| 2661 |
+
// Handle when the input is .focus()'d
|
| 2662 |
+
changeFilters.focus = changeFilters.beforeactivate;
|
| 2663 |
+
}
|
| 2664 |
+
|
| 2665 |
+
function trigger( type, elem, args ) {
|
| 2666 |
+
args[0].type = type;
|
| 2667 |
+
return jQuery.event.handle.apply( elem, args );
|
| 2668 |
+
}
|
| 2669 |
+
|
| 2670 |
+
// Create "bubbling" focus and blur events
|
| 2671 |
+
if ( document.addEventListener ) {
|
| 2672 |
+
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
|
| 2673 |
+
jQuery.event.special[ fix ] = {
|
| 2674 |
+
setup: function() {
|
| 2675 |
+
if ( focusCounts[fix]++ === 0 ) {
|
| 2676 |
+
document.addEventListener( orig, handler, true );
|
| 2677 |
+
}
|
| 2678 |
+
},
|
| 2679 |
+
teardown: function() {
|
| 2680 |
+
if ( --focusCounts[fix] === 0 ) {
|
| 2681 |
+
document.removeEventListener( orig, handler, true );
|
| 2682 |
+
}
|
| 2683 |
+
}
|
| 2684 |
+
};
|
| 2685 |
+
|
| 2686 |
+
function handler( e ) {
|
| 2687 |
+
e = jQuery.event.fix( e );
|
| 2688 |
+
e.type = fix;
|
| 2689 |
+
return jQuery.event.trigger( e, null, e.target );
|
| 2690 |
+
}
|
| 2691 |
+
});
|
| 2692 |
+
}
|
| 2693 |
+
|
| 2694 |
+
jQuery.each(["bind", "one"], function( i, name ) {
|
| 2695 |
+
jQuery.fn[ name ] = function( type, data, fn ) {
|
| 2696 |
+
// Handle object literals
|
| 2697 |
+
if ( typeof type === "object" ) {
|
| 2698 |
+
for ( var key in type ) {
|
| 2699 |
+
this[ name ](key, data, type[key], fn);
|
| 2700 |
+
}
|
| 2701 |
+
return this;
|
| 2702 |
+
}
|
| 2703 |
+
|
| 2704 |
+
if ( jQuery.isFunction( data ) || data === false ) {
|
| 2705 |
+
fn = data;
|
| 2706 |
+
data = undefined;
|
| 2707 |
+
}
|
| 2708 |
+
|
| 2709 |
+
var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
|
| 2710 |
+
jQuery( this ).unbind( event, handler );
|
| 2711 |
+
return fn.apply( this, arguments );
|
| 2712 |
+
}) : fn;
|
| 2713 |
+
|
| 2714 |
+
if ( type === "unload" && name !== "one" ) {
|
| 2715 |
+
this.one( type, data, fn );
|
| 2716 |
+
|
| 2717 |
+
} else {
|
| 2718 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
| 2719 |
+
jQuery.event.add( this[i], type, handler, data );
|
| 2720 |
+
}
|
| 2721 |
+
}
|
| 2722 |
+
|
| 2723 |
+
return this;
|
| 2724 |
+
};
|
| 2725 |
+
});
|
| 2726 |
+
|
| 2727 |
+
jQuery.fn.extend({
|
| 2728 |
+
unbind: function( type, fn ) {
|
| 2729 |
+
// Handle object literals
|
| 2730 |
+
if ( typeof type === "object" && !type.preventDefault ) {
|
| 2731 |
+
for ( var key in type ) {
|
| 2732 |
+
this.unbind(key, type[key]);
|
| 2733 |
+
}
|
| 2734 |
+
|
| 2735 |
+
} else {
|
| 2736 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
| 2737 |
+
jQuery.event.remove( this[i], type, fn );
|
| 2738 |
+
}
|
| 2739 |
+
}
|
| 2740 |
+
|
| 2741 |
+
return this;
|
| 2742 |
+
},
|
| 2743 |
+
|
| 2744 |
+
delegate: function( selector, types, data, fn ) {
|
| 2745 |
+
return this.live( types, data, fn, selector );
|
| 2746 |
+
},
|
| 2747 |
+
|
| 2748 |
+
undelegate: function( selector, types, fn ) {
|
| 2749 |
+
if ( arguments.length === 0 ) {
|
| 2750 |
+
return this.unbind( "live" );
|
| 2751 |
+
|
| 2752 |
+
} else {
|
| 2753 |
+
return this.die( types, null, fn, selector );
|
| 2754 |
+
}
|
| 2755 |
+
},
|
| 2756 |
+
|
| 2757 |
+
trigger: function( type, data ) {
|
| 2758 |
+
return this.each(function() {
|
| 2759 |
+
jQuery.event.trigger( type, data, this );
|
| 2760 |
+
});
|
| 2761 |
+
},
|
| 2762 |
+
|
| 2763 |
+
triggerHandler: function( type, data ) {
|
| 2764 |
+
if ( this[0] ) {
|
| 2765 |
+
var event = jQuery.Event( type );
|
| 2766 |
+
event.preventDefault();
|
| 2767 |
+
event.stopPropagation();
|
| 2768 |
+
jQuery.event.trigger( event, data, this[0] );
|
| 2769 |
+
return event.result;
|
| 2770 |
+
}
|
| 2771 |
+
},
|
| 2772 |
+
|
| 2773 |
+
toggle: function( fn ) {
|
| 2774 |
+
// Save reference to arguments for access in closure
|
| 2775 |
+
var args = arguments,
|
| 2776 |
+
i = 1;
|
| 2777 |
+
|
| 2778 |
+
// link all the functions, so any of them can unbind this click handler
|
| 2779 |
+
while ( i < args.length ) {
|
| 2780 |
+
jQuery.proxy( fn, args[ i++ ] );
|
| 2781 |
+
}
|
| 2782 |
+
|
| 2783 |
+
return this.click( jQuery.proxy( fn, function( event ) {
|
| 2784 |
+
// Figure out which function to execute
|
| 2785 |
+
var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
|
| 2786 |
+
jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
|
| 2787 |
+
|
| 2788 |
+
// Make sure that clicks stop
|
| 2789 |
+
event.preventDefault();
|
| 2790 |
+
|
| 2791 |
+
// and execute the function
|
| 2792 |
+
return args[ lastToggle ].apply( this, arguments ) || false;
|
| 2793 |
+
}));
|
| 2794 |
+
},
|
| 2795 |
+
|
| 2796 |
+
hover: function( fnOver, fnOut ) {
|
| 2797 |
+
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
|
| 2798 |
+
}
|
| 2799 |
+
});
|
| 2800 |
+
|
| 2801 |
+
var liveMap = {
|
| 2802 |
+
focus: "focusin",
|
| 2803 |
+
blur: "focusout",
|
| 2804 |
+
mouseenter: "mouseover",
|
| 2805 |
+
mouseleave: "mouseout"
|
| 2806 |
+
};
|
| 2807 |
+
|
| 2808 |
+
jQuery.each(["live", "die"], function( i, name ) {
|
| 2809 |
+
jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
|
| 2810 |
+
var type, i = 0, match, namespaces, preType,
|
| 2811 |
+
selector = origSelector || this.selector,
|
| 2812 |
+
context = origSelector ? this : jQuery( this.context );
|
| 2813 |
+
|
| 2814 |
+
if ( typeof types === "object" && !types.preventDefault ) {
|
| 2815 |
+
for ( var key in types ) {
|
| 2816 |
+
context[ name ]( key, data, types[key], selector );
|
| 2817 |
+
}
|
| 2818 |
+
|
| 2819 |
+
return this;
|
| 2820 |
+
}
|
| 2821 |
+
|
| 2822 |
+
if ( jQuery.isFunction( data ) ) {
|
| 2823 |
+
fn = data;
|
| 2824 |
+
data = undefined;
|
| 2825 |
+
}
|
| 2826 |
+
|
| 2827 |
+
types = (types || "").split(" ");
|
| 2828 |
+
|
| 2829 |
+
while ( (type = types[ i++ ]) != null ) {
|
| 2830 |
+
match = rnamespaces.exec( type );
|
| 2831 |
+
namespaces = "";
|
| 2832 |
+
|
| 2833 |
+
if ( match ) {
|
| 2834 |
+
namespaces = match[0];
|
| 2835 |
+
type = type.replace( rnamespaces, "" );
|
| 2836 |
+
}
|
| 2837 |
+
|
| 2838 |
+
if ( type === "hover" ) {
|
| 2839 |
+
types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
|
| 2840 |
+
continue;
|
| 2841 |
+
}
|
| 2842 |
+
|
| 2843 |
+
preType = type;
|
| 2844 |
+
|
| 2845 |
+
if ( type === "focus" || type === "blur" ) {
|
| 2846 |
+
types.push( liveMap[ type ] + namespaces );
|
| 2847 |
+
type = type + namespaces;
|
| 2848 |
+
|
| 2849 |
+
} else {
|
| 2850 |
+
type = (liveMap[ type ] || type) + namespaces;
|
| 2851 |
+
}
|
| 2852 |
+
|
| 2853 |
+
if ( name === "live" ) {
|
| 2854 |
+
// bind live handler
|
| 2855 |
+
for ( var j = 0, l = context.length; j < l; j++ ) {
|
| 2856 |
+
jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
|
| 2857 |
+
{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
|
| 2858 |
+
}
|
| 2859 |
+
|
| 2860 |
+
} else {
|
| 2861 |
+
// unbind live handler
|
| 2862 |
+
context.unbind( "live." + liveConvert( type, selector ), fn );
|
| 2863 |
+
}
|
| 2864 |
+
}
|
| 2865 |
+
|
| 2866 |
+
return this;
|
| 2867 |
+
};
|
| 2868 |
+
});
|
| 2869 |
+
|
| 2870 |
+
function liveHandler( event ) {
|
| 2871 |
+
var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
|
| 2872 |
+
elems = [],
|
| 2873 |
+
selectors = [],
|
| 2874 |
+
events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
|
| 2875 |
+
|
| 2876 |
+
if ( typeof events === "function" ) {
|
| 2877 |
+
events = events.events;
|
| 2878 |
+
}
|
| 2879 |
+
|
| 2880 |
+
// Make sure we avoid non-left-click bubbling in Firefox (#3861)
|
| 2881 |
+
if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
|
| 2882 |
+
return;
|
| 2883 |
+
}
|
| 2884 |
+
|
| 2885 |
+
if ( event.namespace ) {
|
| 2886 |
+
namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
|
| 2887 |
+
}
|
| 2888 |
+
|
| 2889 |
+
event.liveFired = this;
|
| 2890 |
+
|
| 2891 |
+
var live = events.live.slice(0);
|
| 2892 |
+
|
| 2893 |
+
for ( j = 0; j < live.length; j++ ) {
|
| 2894 |
+
handleObj = live[j];
|
| 2895 |
+
|
| 2896 |
+
if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
|
| 2897 |
+
selectors.push( handleObj.selector );
|
| 2898 |
+
|
| 2899 |
+
} else {
|
| 2900 |
+
live.splice( j--, 1 );
|
| 2901 |
+
}
|
| 2902 |
+
}
|
| 2903 |
+
|
| 2904 |
+
match = jQuery( event.target ).closest( selectors, event.currentTarget );
|
| 2905 |
+
|
| 2906 |
+
for ( i = 0, l = match.length; i < l; i++ ) {
|
| 2907 |
+
close = match[i];
|
| 2908 |
+
|
| 2909 |
+
for ( j = 0; j < live.length; j++ ) {
|
| 2910 |
+
handleObj = live[j];
|
| 2911 |
+
|
| 2912 |
+
if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
|
| 2913 |
+
elem = close.elem;
|
| 2914 |
+
related = null;
|
| 2915 |
+
|
| 2916 |
+
// Those two events require additional checking
|
| 2917 |
+
if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
|
| 2918 |
+
event.type = handleObj.preType;
|
| 2919 |
+
related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
|
| 2920 |
+
}
|
| 2921 |
+
|
| 2922 |
+
if ( !related || related !== elem ) {
|
| 2923 |
+
elems.push({ elem: elem, handleObj: handleObj, level: close.level });
|
| 2924 |
+
}
|
| 2925 |
+
}
|
| 2926 |
+
}
|
| 2927 |
+
}
|
| 2928 |
+
|
| 2929 |
+
for ( i = 0, l = elems.length; i < l; i++ ) {
|
| 2930 |
+
match = elems[i];
|
| 2931 |
+
|
| 2932 |
+
if ( maxLevel && match.level > maxLevel ) {
|
| 2933 |
+
break;
|
| 2934 |
+
}
|
| 2935 |
+
|
| 2936 |
+
event.currentTarget = match.elem;
|
| 2937 |
+
event.data = match.handleObj.data;
|
| 2938 |
+
event.handleObj = match.handleObj;
|
| 2939 |
+
|
| 2940 |
+
ret = match.handleObj.origHandler.apply( match.elem, arguments );
|
| 2941 |
+
|
| 2942 |
+
if ( ret === false || event.isPropagationStopped() ) {
|
| 2943 |
+
maxLevel = match.level;
|
| 2944 |
+
|
| 2945 |
+
if ( ret === false ) {
|
| 2946 |
+
stop = false;
|
| 2947 |
+
}
|
| 2948 |
+
if ( event.isImmediatePropagationStopped() ) {
|
| 2949 |
+
break;
|
| 2950 |
+
}
|
| 2951 |
+
}
|
| 2952 |
+
}
|
| 2953 |
+
|
| 2954 |
+
return stop;
|
| 2955 |
+
}
|
| 2956 |
+
|
| 2957 |
+
function liveConvert( type, selector ) {
|
| 2958 |
+
return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
|
| 2959 |
+
}
|
| 2960 |
+
|
| 2961 |
+
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
|
| 2962 |
+
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
|
| 2963 |
+
"change select submit keydown keypress keyup error").split(" "), function( i, name ) {
|
| 2964 |
+
|
| 2965 |
+
// Handle event binding
|
| 2966 |
+
jQuery.fn[ name ] = function( data, fn ) {
|
| 2967 |
+
if ( fn == null ) {
|
| 2968 |
+
fn = data;
|
| 2969 |
+
data = null;
|
| 2970 |
+
}
|
| 2971 |
+
|
| 2972 |
+
return arguments.length > 0 ?
|
| 2973 |
+
this.bind( name, data, fn ) :
|
| 2974 |
+
this.trigger( name );
|
| 2975 |
+
};
|
| 2976 |
+
|
| 2977 |
+
if ( jQuery.attrFn ) {
|
| 2978 |
+
jQuery.attrFn[ name ] = true;
|
| 2979 |
+
}
|
| 2980 |
+
});
|
| 2981 |
+
|
| 2982 |
+
// Prevent memory leaks in IE
|
| 2983 |
+
// Window isn't included so as not to unbind existing unload events
|
| 2984 |
+
// More info:
|
| 2985 |
+
// - http://isaacschlueter.com/2006/10/msie-memory-leaks/
|
| 2986 |
+
if ( window.attachEvent && !window.addEventListener ) {
|
| 2987 |
+
jQuery(window).bind("unload", function() {
|
| 2988 |
+
for ( var id in jQuery.cache ) {
|
| 2989 |
+
if ( jQuery.cache[ id ].handle ) {
|
| 2990 |
+
// Try/Catch is to handle iframes being unloaded, see #4280
|
| 2991 |
+
try {
|
| 2992 |
+
jQuery.event.remove( jQuery.cache[ id ].handle.elem );
|
| 2993 |
+
} catch(e) {}
|
| 2994 |
+
}
|
| 2995 |
+
}
|
| 2996 |
+
});
|
| 2997 |
+
}
|
| 2998 |
+
|
| 2999 |
+
|
| 3000 |
+
/*!
|
| 3001 |
+
* Sizzle CSS Selector Engine - v1.0
|
| 3002 |
+
* Copyright 2009, The Dojo Foundation
|
| 3003 |
+
* Released under the MIT, BSD, and GPL Licenses.
|
| 3004 |
+
* More information: http://sizzlejs.com/
|
| 3005 |
+
*/
|
| 3006 |
+
(function(){
|
| 3007 |
+
|
| 3008 |
+
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
|
| 3009 |
+
done = 0,
|
| 3010 |
+
toString = Object.prototype.toString,
|
| 3011 |
+
hasDuplicate = false,
|
| 3012 |
+
baseHasDuplicate = true;
|
| 3013 |
+
|
| 3014 |
+
// Here we check if the JavaScript engine is using some sort of
|
| 3015 |
+
// optimization where it does not always call our comparision
|
| 3016 |
+
// function. If that is the case, discard the hasDuplicate value.
|
| 3017 |
+
// Thus far that includes Google Chrome.
|
| 3018 |
+
[0, 0].sort(function() {
|
| 3019 |
+
baseHasDuplicate = false;
|
| 3020 |
+
return 0;
|
| 3021 |
+
});
|
| 3022 |
+
|
| 3023 |
+
var Sizzle = function( selector, context, results, seed ) {
|
| 3024 |
+
results = results || [];
|
| 3025 |
+
context = context || document;
|
| 3026 |
+
|
| 3027 |
+
var origContext = context;
|
| 3028 |
+
|
| 3029 |
+
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
|
| 3030 |
+
return [];
|
| 3031 |
+
}
|
| 3032 |
+
|
| 3033 |
+
if ( !selector || typeof selector !== "string" ) {
|
| 3034 |
+
return results;
|
| 3035 |
+
}
|
| 3036 |
+
|
| 3037 |
+
var m, set, checkSet, extra, ret, cur, pop, i,
|
| 3038 |
+
prune = true,
|
| 3039 |
+
contextXML = Sizzle.isXML( context ),
|
| 3040 |
+
parts = [],
|
| 3041 |
+
soFar = selector;
|
| 3042 |
+
|
| 3043 |
+
// Reset the position of the chunker regexp (start from head)
|
| 3044 |
+
do {
|
| 3045 |
+
chunker.exec( "" );
|
| 3046 |
+
m = chunker.exec( soFar );
|
| 3047 |
+
|
| 3048 |
+
if ( m ) {
|
| 3049 |
+
soFar = m[3];
|
| 3050 |
+
|
| 3051 |
+
parts.push( m[1] );
|
| 3052 |
+
|
| 3053 |
+
if ( m[2] ) {
|
| 3054 |
+
extra = m[3];
|
| 3055 |
+
break;
|
| 3056 |
+
}
|
| 3057 |
+
}
|
| 3058 |
+
} while ( m );
|
| 3059 |
+
|
| 3060 |
+
if ( parts.length > 1 && origPOS.exec( selector ) ) {
|
| 3061 |
+
|
| 3062 |
+
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
|
| 3063 |
+
set = posProcess( parts[0] + parts[1], context );
|
| 3064 |
+
|
| 3065 |
+
} else {
|
| 3066 |
+
set = Expr.relative[ parts[0] ] ?
|
| 3067 |
+
[ context ] :
|
| 3068 |
+
Sizzle( parts.shift(), context );
|
| 3069 |
+
|
| 3070 |
+
while ( parts.length ) {
|
| 3071 |
+
selector = parts.shift();
|
| 3072 |
+
|
| 3073 |
+
if ( Expr.relative[ selector ] ) {
|
| 3074 |
+
selector += parts.shift();
|
| 3075 |
+
}
|
| 3076 |
+
|
| 3077 |
+
set = posProcess( selector, set );
|
| 3078 |
+
}
|
| 3079 |
+
}
|
| 3080 |
+
|
| 3081 |
+
} else {
|
| 3082 |
+
// Take a shortcut and set the context if the root selector is an ID
|
| 3083 |
+
// (but not if it'll be faster if the inner selector is an ID)
|
| 3084 |
+
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
|
| 3085 |
+
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
|
| 3086 |
+
|
| 3087 |
+
ret = Sizzle.find( parts.shift(), context, contextXML );
|
| 3088 |
+
context = ret.expr ?
|
| 3089 |
+
Sizzle.filter( ret.expr, ret.set )[0] :
|
| 3090 |
+
ret.set[0];
|
| 3091 |
+
}
|
| 3092 |
+
|
| 3093 |
+
if ( context ) {
|
| 3094 |
+
ret = seed ?
|
| 3095 |
+
{ expr: parts.pop(), set: makeArray(seed) } :
|
| 3096 |
+
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
|
| 3097 |
+
|
| 3098 |
+
set = ret.expr ?
|
| 3099 |
+
Sizzle.filter( ret.expr, ret.set ) :
|
| 3100 |
+
ret.set;
|
| 3101 |
+
|
| 3102 |
+
if ( parts.length > 0 ) {
|
| 3103 |
+
checkSet = makeArray( set );
|
| 3104 |
+
|
| 3105 |
+
} else {
|
| 3106 |
+
prune = false;
|
| 3107 |
+
}
|
| 3108 |
+
|
| 3109 |
+
while ( parts.length ) {
|
| 3110 |
+
cur = parts.pop();
|
| 3111 |
+
pop = cur;
|
| 3112 |
+
|
| 3113 |
+
if ( !Expr.relative[ cur ] ) {
|
| 3114 |
+
cur = "";
|
| 3115 |
+
} else {
|
| 3116 |
+
pop = parts.pop();
|
| 3117 |
+
}
|
| 3118 |
+
|
| 3119 |
+
if ( pop == null ) {
|
| 3120 |
+
pop = context;
|
| 3121 |
+
}
|
| 3122 |
+
|
| 3123 |
+
Expr.relative[ cur ]( checkSet, pop, contextXML );
|
| 3124 |
+
}
|
| 3125 |
+
|
| 3126 |
+
} else {
|
| 3127 |
+
checkSet = parts = [];
|
| 3128 |
+
}
|
| 3129 |
+
}
|
| 3130 |
+
|
| 3131 |
+
if ( !checkSet ) {
|
| 3132 |
+
checkSet = set;
|
| 3133 |
+
}
|
| 3134 |
+
|
| 3135 |
+
if ( !checkSet ) {
|
| 3136 |
+
Sizzle.error( cur || selector );
|
| 3137 |
+
}
|
| 3138 |
+
|
| 3139 |
+
if ( toString.call(checkSet) === "[object Array]" ) {
|
| 3140 |
+
if ( !prune ) {
|
| 3141 |
+
results.push.apply( results, checkSet );
|
| 3142 |
+
|
| 3143 |
+
} else if ( context && context.nodeType === 1 ) {
|
| 3144 |
+
for ( i = 0; checkSet[i] != null; i++ ) {
|
| 3145 |
+
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
|
| 3146 |
+
results.push( set[i] );
|
| 3147 |
+
}
|
| 3148 |
+
}
|
| 3149 |
+
|
| 3150 |
+
} else {
|
| 3151 |
+
for ( i = 0; checkSet[i] != null; i++ ) {
|
| 3152 |
+
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
|
| 3153 |
+
results.push( set[i] );
|
| 3154 |
+
}
|
| 3155 |
+
}
|
| 3156 |
+
}
|
| 3157 |
+
|
| 3158 |
+
} else {
|
| 3159 |
+
makeArray( checkSet, results );
|
| 3160 |
+
}
|
| 3161 |
+
|
| 3162 |
+
if ( extra ) {
|
| 3163 |
+
Sizzle( extra, origContext, results, seed );
|
| 3164 |
+
Sizzle.uniqueSort( results );
|
| 3165 |
+
}
|
| 3166 |
+
|
| 3167 |
+
return results;
|
| 3168 |
+
};
|
| 3169 |
+
|
| 3170 |
+
Sizzle.uniqueSort = function( results ) {
|
| 3171 |
+
if ( sortOrder ) {
|
| 3172 |
+
hasDuplicate = baseHasDuplicate;
|
| 3173 |
+
results.sort( sortOrder );
|
| 3174 |
+
|
| 3175 |
+
if ( hasDuplicate ) {
|
| 3176 |
+
for ( var i = 1; i < results.length; i++ ) {
|
| 3177 |
+
if ( results[i] === results[ i - 1 ] ) {
|
| 3178 |
+
results.splice( i--, 1 );
|
| 3179 |
+
}
|
| 3180 |
+
}
|
| 3181 |
+
}
|
| 3182 |
+
}
|
| 3183 |
+
|
| 3184 |
+
return results;
|
| 3185 |
+
};
|
| 3186 |
+
|
| 3187 |
+
Sizzle.matches = function( expr, set ) {
|
| 3188 |
+
return Sizzle( expr, null, null, set );
|
| 3189 |
+
};
|
| 3190 |
+
|
| 3191 |
+
Sizzle.matchesSelector = function( node, expr ) {
|
| 3192 |
+
return Sizzle( expr, null, null, [node] ).length > 0;
|
| 3193 |
+
};
|
| 3194 |
+
|
| 3195 |
+
Sizzle.find = function( expr, context, isXML ) {
|
| 3196 |
+
var set;
|
| 3197 |
+
|
| 3198 |
+
if ( !expr ) {
|
| 3199 |
+
return [];
|
| 3200 |
+
}
|
| 3201 |
+
|
| 3202 |
+
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
|
| 3203 |
+
var match,
|
| 3204 |
+
type = Expr.order[i];
|
| 3205 |
+
|
| 3206 |
+
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
|
| 3207 |
+
var left = match[1];
|
| 3208 |
+
match.splice( 1, 1 );
|
| 3209 |
+
|
| 3210 |
+
if ( left.substr( left.length - 1 ) !== "\\" ) {
|
| 3211 |
+
match[1] = (match[1] || "").replace(/\\/g, "");
|
| 3212 |
+
set = Expr.find[ type ]( match, context, isXML );
|
| 3213 |
+
|
| 3214 |
+
if ( set != null ) {
|
| 3215 |
+
expr = expr.replace( Expr.match[ type ], "" );
|
| 3216 |
+
break;
|
| 3217 |
+
}
|
| 3218 |
+
}
|
| 3219 |
+
}
|
| 3220 |
+
}
|
| 3221 |
+
|
| 3222 |
+
if ( !set ) {
|
| 3223 |
+
set = context.getElementsByTagName( "*" );
|
| 3224 |
+
}
|
| 3225 |
+
|
| 3226 |
+
return { set: set, expr: expr };
|
| 3227 |
+
};
|
| 3228 |
+
|
| 3229 |
+
Sizzle.filter = function( expr, set, inplace, not ) {
|
| 3230 |
+
var match, anyFound,
|
| 3231 |
+
old = expr,
|
| 3232 |
+
result = [],
|
| 3233 |
+
curLoop = set,
|
| 3234 |
+
isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
|
| 3235 |
+
|
| 3236 |
+
while ( expr && set.length ) {
|
| 3237 |
+
for ( var type in Expr.filter ) {
|
| 3238 |
+
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
|
| 3239 |
+
var found, item,
|
| 3240 |
+
filter = Expr.filter[ type ],
|
| 3241 |
+
left = match[1];
|
| 3242 |
+
|
| 3243 |
+
anyFound = false;
|
| 3244 |
+
|
| 3245 |
+
match.splice(1,1);
|
| 3246 |
+
|
| 3247 |
+
if ( left.substr( left.length - 1 ) === "\\" ) {
|
| 3248 |
+
continue;
|
| 3249 |
+
}
|
| 3250 |
+
|
| 3251 |
+
if ( curLoop === result ) {
|
| 3252 |
+
result = [];
|
| 3253 |
+
}
|
| 3254 |
+
|
| 3255 |
+
if ( Expr.preFilter[ type ] ) {
|
| 3256 |
+
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
|
| 3257 |
+
|
| 3258 |
+
if ( !match ) {
|
| 3259 |
+
anyFound = found = true;
|
| 3260 |
+
|
| 3261 |
+
} else if ( match === true ) {
|
| 3262 |
+
continue;
|
| 3263 |
+
}
|
| 3264 |
+
}
|
| 3265 |
+
|
| 3266 |
+
if ( match ) {
|
| 3267 |
+
for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
|
| 3268 |
+
if ( item ) {
|
| 3269 |
+
found = filter( item, match, i, curLoop );
|
| 3270 |
+
var pass = not ^ !!found;
|
| 3271 |
+
|
| 3272 |
+
if ( inplace && found != null ) {
|
| 3273 |
+
if ( pass ) {
|
| 3274 |
+
anyFound = true;
|
| 3275 |
+
|
| 3276 |
+
} else {
|
| 3277 |
+
curLoop[i] = false;
|
| 3278 |
+
}
|
| 3279 |
+
|
| 3280 |
+
} else if ( pass ) {
|
| 3281 |
+
result.push( item );
|
| 3282 |
+
anyFound = true;
|
| 3283 |
+
}
|
| 3284 |
+
}
|
| 3285 |
+
}
|
| 3286 |
+
}
|
| 3287 |
+
|
| 3288 |
+
if ( found !== undefined ) {
|
| 3289 |
+
if ( !inplace ) {
|
| 3290 |
+
curLoop = result;
|
| 3291 |
+
}
|
| 3292 |
+
|
| 3293 |
+
expr = expr.replace( Expr.match[ type ], "" );
|
| 3294 |
+
|
| 3295 |
+
if ( !anyFound ) {
|
| 3296 |
+
return [];
|
| 3297 |
+
}
|
| 3298 |
+
|
| 3299 |
+
break;
|
| 3300 |
+
}
|
| 3301 |
+
}
|
| 3302 |
+
}
|
| 3303 |
+
|
| 3304 |
+
// Improper expression
|
| 3305 |
+
if ( expr === old ) {
|
| 3306 |
+
if ( anyFound == null ) {
|
| 3307 |
+
Sizzle.error( expr );
|
| 3308 |
+
|
| 3309 |
+
} else {
|
| 3310 |
+
break;
|
| 3311 |
+
}
|
| 3312 |
+
}
|
| 3313 |
+
|
| 3314 |
+
old = expr;
|
| 3315 |
+
}
|
| 3316 |
+
|
| 3317 |
+
return curLoop;
|
| 3318 |
+
};
|
| 3319 |
+
|
| 3320 |
+
Sizzle.error = function( msg ) {
|
| 3321 |
+
throw "Syntax error, unrecognized expression: " + msg;
|
| 3322 |
+
};
|
| 3323 |
+
|
| 3324 |
+
var Expr = Sizzle.selectors = {
|
| 3325 |
+
order: [ "ID", "NAME", "TAG" ],
|
| 3326 |
+
|
| 3327 |
+
match: {
|
| 3328 |
+
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
|
| 3329 |
+
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
|
| 3330 |
+
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
|
| 3331 |
+
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
|
| 3332 |
+
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
|
| 3333 |
+
CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
|
| 3334 |
+
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
|
| 3335 |
+
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
|
| 3336 |
+
},
|
| 3337 |
+
|
| 3338 |
+
leftMatch: {},
|
| 3339 |
+
|
| 3340 |
+
attrMap: {
|
| 3341 |
+
"class": "className",
|
| 3342 |
+
"for": "htmlFor"
|
| 3343 |
+
},
|
| 3344 |
+
|
| 3345 |
+
attrHandle: {
|
| 3346 |
+
href: function( elem ) {
|
| 3347 |
+
return elem.getAttribute( "href" );
|
| 3348 |
+
}
|
| 3349 |
+
},
|
| 3350 |
+
|
| 3351 |
+
relative: {
|
| 3352 |
+
"+": function(checkSet, part){
|
| 3353 |
+
var isPartStr = typeof part === "string",
|
| 3354 |
+
isTag = isPartStr && !/\W/.test( part ),
|
| 3355 |
+
isPartStrNotTag = isPartStr && !isTag;
|
| 3356 |
+
|
| 3357 |
+
if ( isTag ) {
|
| 3358 |
+
part = part.toLowerCase();
|
| 3359 |
+
}
|
| 3360 |
+
|
| 3361 |
+
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
|
| 3362 |
+
if ( (elem = checkSet[i]) ) {
|
| 3363 |
+
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
|
| 3364 |
+
|
| 3365 |
+
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
|
| 3366 |
+
elem || false :
|
| 3367 |
+
elem === part;
|
| 3368 |
+
}
|
| 3369 |
+
}
|
| 3370 |
+
|
| 3371 |
+
if ( isPartStrNotTag ) {
|
| 3372 |
+
Sizzle.filter( part, checkSet, true );
|
| 3373 |
+
}
|
| 3374 |
+
},
|
| 3375 |
+
|
| 3376 |
+
">": function( checkSet, part ) {
|
| 3377 |
+
var elem,
|
| 3378 |
+
isPartStr = typeof part === "string",
|
| 3379 |
+
i = 0,
|
| 3380 |
+
l = checkSet.length;
|
| 3381 |
+
|
| 3382 |
+
if ( isPartStr && !/\W/.test( part ) ) {
|
| 3383 |
+
part = part.toLowerCase();
|
| 3384 |
+
|
| 3385 |
+
for ( ; i < l; i++ ) {
|
| 3386 |
+
elem = checkSet[i];
|
| 3387 |
+
|
| 3388 |
+
if ( elem ) {
|
| 3389 |
+
var parent = elem.parentNode;
|
| 3390 |
+
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
|
| 3391 |
+
}
|
| 3392 |
+
}
|
| 3393 |
+
|
| 3394 |
+
} else {
|
| 3395 |
+
for ( ; i < l; i++ ) {
|
| 3396 |
+
elem = checkSet[i];
|
| 3397 |
+
|
| 3398 |
+
if ( elem ) {
|
| 3399 |
+
checkSet[i] = isPartStr ?
|
| 3400 |
+
elem.parentNode :
|
| 3401 |
+
elem.parentNode === part;
|
| 3402 |
+
}
|
| 3403 |
+
}
|
| 3404 |
+
|
| 3405 |
+
if ( isPartStr ) {
|
| 3406 |
+
Sizzle.filter( part, checkSet, true );
|
| 3407 |
+
}
|
| 3408 |
+
}
|
| 3409 |
+
},
|
| 3410 |
+
|
| 3411 |
+
"": function(checkSet, part, isXML){
|
| 3412 |
+
var nodeCheck,
|
| 3413 |
+
doneName = done++,
|
| 3414 |
+
checkFn = dirCheck;
|
| 3415 |
+
|
| 3416 |
+
if ( typeof part === "string" && !/\W/.test(part) ) {
|
| 3417 |
+
part = part.toLowerCase();
|
| 3418 |
+
nodeCheck = part;
|
| 3419 |
+
checkFn = dirNodeCheck;
|
| 3420 |
+
}
|
| 3421 |
+
|
| 3422 |
+
checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
|
| 3423 |
+
},
|
| 3424 |
+
|
| 3425 |
+
"~": function( checkSet, part, isXML ) {
|
| 3426 |
+
var nodeCheck,
|
| 3427 |
+
doneName = done++,
|
| 3428 |
+
checkFn = dirCheck;
|
| 3429 |
+
|
| 3430 |
+
if ( typeof part === "string" && !/\W/.test( part ) ) {
|
| 3431 |
+
part = part.toLowerCase();
|
| 3432 |
+
nodeCheck = part;
|
| 3433 |
+
checkFn = dirNodeCheck;
|
| 3434 |
+
}
|
| 3435 |
+
|
| 3436 |
+
checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
|
| 3437 |
+
}
|
| 3438 |
+
},
|
| 3439 |
+
|
| 3440 |
+
find: {
|
| 3441 |
+
ID: function( match, context, isXML ) {
|
| 3442 |
+
if ( typeof context.getElementById !== "undefined" && !isXML ) {
|
| 3443 |
+
var m = context.getElementById(match[1]);
|
| 3444 |
+
// Check parentNode to catch when Blackberry 4.6 returns
|
| 3445 |
+
// nodes that are no longer in the document #6963
|
| 3446 |
+
return m && m.parentNode ? [m] : [];
|
| 3447 |
+
}
|
| 3448 |
+
},
|
| 3449 |
+
|
| 3450 |
+
NAME: function( match, context ) {
|
| 3451 |
+
if ( typeof context.getElementsByName !== "undefined" ) {
|
| 3452 |
+
var ret = [],
|
| 3453 |
+
results = context.getElementsByName( match[1] );
|
| 3454 |
+
|
| 3455 |
+
for ( var i = 0, l = results.length; i < l; i++ ) {
|
| 3456 |
+
if ( results[i].getAttribute("name") === match[1] ) {
|
| 3457 |
+
ret.push( results[i] );
|
| 3458 |
+
}
|
| 3459 |
+
}
|
| 3460 |
+
|
| 3461 |
+
return ret.length === 0 ? null : ret;
|
| 3462 |
+
}
|
| 3463 |
+
},
|
| 3464 |
+
|
| 3465 |
+
TAG: function( match, context ) {
|
| 3466 |
+
return context.getElementsByTagName( match[1] );
|
| 3467 |
+
}
|
| 3468 |
+
},
|
| 3469 |
+
preFilter: {
|
| 3470 |
+
CLASS: function( match, curLoop, inplace, result, not, isXML ) {
|
| 3471 |
+
match = " " + match[1].replace(/\\/g, "") + " ";
|
| 3472 |
+
|
| 3473 |
+
if ( isXML ) {
|
| 3474 |
+
return match;
|
| 3475 |
+
}
|
| 3476 |
+
|
| 3477 |
+
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
|
| 3478 |
+
if ( elem ) {
|
| 3479 |
+
if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
|
| 3480 |
+
if ( !inplace ) {
|
| 3481 |
+
result.push( elem );
|
| 3482 |
+
}
|
| 3483 |
+
|
| 3484 |
+
} else if ( inplace ) {
|
| 3485 |
+
curLoop[i] = false;
|
| 3486 |
+
}
|
| 3487 |
+
}
|
| 3488 |
+
}
|
| 3489 |
+
|
| 3490 |
+
return false;
|
| 3491 |
+
},
|
| 3492 |
+
|
| 3493 |
+
ID: function( match ) {
|
| 3494 |
+
return match[1].replace(/\\/g, "");
|
| 3495 |
+
},
|
| 3496 |
+
|
| 3497 |
+
TAG: function( match, curLoop ) {
|
| 3498 |
+
return match[1].toLowerCase();
|
| 3499 |
+
},
|
| 3500 |
+
|
| 3501 |
+
CHILD: function( match ) {
|
| 3502 |
+
if ( match[1] === "nth" ) {
|
| 3503 |
+
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
|
| 3504 |
+
var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
|
| 3505 |
+
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
|
| 3506 |
+
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
|
| 3507 |
+
|
| 3508 |
+
// calculate the numbers (first)n+(last) including if they are negative
|
| 3509 |
+
match[2] = (test[1] + (test[2] || 1)) - 0;
|
| 3510 |
+
match[3] = test[3] - 0;
|
| 3511 |
+
}
|
| 3512 |
+
|
| 3513 |
+
// TODO: Move to normal caching system
|
| 3514 |
+
match[0] = done++;
|
| 3515 |
+
|
| 3516 |
+
return match;
|
| 3517 |
+
},
|
| 3518 |
+
|
| 3519 |
+
ATTR: function( match, curLoop, inplace, result, not, isXML ) {
|
| 3520 |
+
var name = match[1].replace(/\\/g, "");
|
| 3521 |
+
|
| 3522 |
+
if ( !isXML && Expr.attrMap[name] ) {
|
| 3523 |
+
match[1] = Expr.attrMap[name];
|
| 3524 |
+
}
|
| 3525 |
+
|
| 3526 |
+
if ( match[2] === "~=" ) {
|
| 3527 |
+
match[4] = " " + match[4] + " ";
|
| 3528 |
+
}
|
| 3529 |
+
|
| 3530 |
+
return match;
|
| 3531 |
+
},
|
| 3532 |
+
|
| 3533 |
+
PSEUDO: function( match, curLoop, inplace, result, not ) {
|
| 3534 |
+
if ( match[1] === "not" ) {
|
| 3535 |
+
// If we're dealing with a complex expression, or a simple one
|
| 3536 |
+
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
|
| 3537 |
+
match[3] = Sizzle(match[3], null, null, curLoop);
|
| 3538 |
+
|
| 3539 |
+
} else {
|
| 3540 |
+
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
|
| 3541 |
+
|
| 3542 |
+
if ( !inplace ) {
|
| 3543 |
+
result.push.apply( result, ret );
|
| 3544 |
+
}
|
| 3545 |
+
|
| 3546 |
+
return false;
|
| 3547 |
+
}
|
| 3548 |
+
|
| 3549 |
+
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
|
| 3550 |
+
return true;
|
| 3551 |
+
}
|
| 3552 |
+
|
| 3553 |
+
return match;
|
| 3554 |
+
},
|
| 3555 |
+
|
| 3556 |
+
POS: function( match ) {
|
| 3557 |
+
match.unshift( true );
|
| 3558 |
+
|
| 3559 |
+
return match;
|
| 3560 |
+
}
|
| 3561 |
+
},
|
| 3562 |
+
|
| 3563 |
+
filters: {
|
| 3564 |
+
enabled: function( elem ) {
|
| 3565 |
+
return elem.disabled === false && elem.type !== "hidden";
|
| 3566 |
+
},
|
| 3567 |
+
|
| 3568 |
+
disabled: function( elem ) {
|
| 3569 |
+
return elem.disabled === true;
|
| 3570 |
+
},
|
| 3571 |
+
|
| 3572 |
+
checked: function( elem ) {
|
| 3573 |
+
return elem.checked === true;
|
| 3574 |
+
},
|
| 3575 |
+
|
| 3576 |
+
selected: function( elem ) {
|
| 3577 |
+
// Accessing this property makes selected-by-default
|
| 3578 |
+
// options in Safari work properly
|
| 3579 |
+
elem.parentNode.selectedIndex;
|
| 3580 |
+
|
| 3581 |
+
return elem.selected === true;
|
| 3582 |
+
},
|
| 3583 |
+
|
| 3584 |
+
parent: function( elem ) {
|
| 3585 |
+
return !!elem.firstChild;
|
| 3586 |
+
},
|
| 3587 |
+
|
| 3588 |
+
empty: function( elem ) {
|
| 3589 |
+
return !elem.firstChild;
|
| 3590 |
+
},
|
| 3591 |
+
|
| 3592 |
+
has: function( elem, i, match ) {
|
| 3593 |
+
return !!Sizzle( match[3], elem ).length;
|
| 3594 |
+
},
|
| 3595 |
+
|
| 3596 |
+
header: function( elem ) {
|
| 3597 |
+
return (/h\d/i).test( elem.nodeName );
|
| 3598 |
+
},
|
| 3599 |
+
|
| 3600 |
+
text: function( elem ) {
|
| 3601 |
+
return "text" === elem.type;
|
| 3602 |
+
},
|
| 3603 |
+
radio: function( elem ) {
|
| 3604 |
+
return "radio" === elem.type;
|
| 3605 |
+
},
|
| 3606 |
+
|
| 3607 |
+
checkbox: function( elem ) {
|
| 3608 |
+
return "checkbox" === elem.type;
|
| 3609 |
+
},
|
| 3610 |
+
|
| 3611 |
+
file: function( elem ) {
|
| 3612 |
+
return "file" === elem.type;
|
| 3613 |
+
},
|
| 3614 |
+
password: function( elem ) {
|
| 3615 |
+
return "password" === elem.type;
|
| 3616 |
+
},
|
| 3617 |
+
|
| 3618 |
+
submit: function( elem ) {
|
| 3619 |
+
return "submit" === elem.type;
|
| 3620 |
+
},
|
| 3621 |
+
|
| 3622 |
+
image: function( elem ) {
|
| 3623 |
+
return "image" === elem.type;
|
| 3624 |
+
},
|
| 3625 |
+
|
| 3626 |
+
reset: function( elem ) {
|
| 3627 |
+
return "reset" === elem.type;
|
| 3628 |
+
},
|
| 3629 |
+
|
| 3630 |
+
button: function( elem ) {
|
| 3631 |
+
return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
|
| 3632 |
+
},
|
| 3633 |
+
|
| 3634 |
+
input: function( elem ) {
|
| 3635 |
+
return (/input|select|textarea|button/i).test( elem.nodeName );
|
| 3636 |
+
}
|
| 3637 |
+
},
|
| 3638 |
+
setFilters: {
|
| 3639 |
+
first: function( elem, i ) {
|
| 3640 |
+
return i === 0;
|
| 3641 |
+
},
|
| 3642 |
+
|
| 3643 |
+
last: function( elem, i, match, array ) {
|
| 3644 |
+
return i === array.length - 1;
|
| 3645 |
+
},
|
| 3646 |
+
|
| 3647 |
+
even: function( elem, i ) {
|
| 3648 |
+
return i % 2 === 0;
|
| 3649 |
+
},
|
| 3650 |
+
|
| 3651 |
+
odd: function( elem, i ) {
|
| 3652 |
+
return i % 2 === 1;
|
| 3653 |
+
},
|
| 3654 |
+
|
| 3655 |
+
lt: function( elem, i, match ) {
|
| 3656 |
+
return i < match[3] - 0;
|
| 3657 |
+
},
|
| 3658 |
+
|
| 3659 |
+
gt: function( elem, i, match ) {
|
| 3660 |
+
return i > match[3] - 0;
|
| 3661 |
+
},
|
| 3662 |
+
|
| 3663 |
+
nth: function( elem, i, match ) {
|
| 3664 |
+
return match[3] - 0 === i;
|
| 3665 |
+
},
|
| 3666 |
+
|
| 3667 |
+
eq: function( elem, i, match ) {
|
| 3668 |
+
return match[3] - 0 === i;
|
| 3669 |
+
}
|
| 3670 |
+
},
|
| 3671 |
+
filter: {
|
| 3672 |
+
PSEUDO: function( elem, match, i, array ) {
|
| 3673 |
+
var name = match[1],
|
| 3674 |
+
filter = Expr.filters[ name ];
|
| 3675 |
+
|
| 3676 |
+
if ( filter ) {
|
| 3677 |
+
return filter( elem, i, match, array );
|
| 3678 |
+
|
| 3679 |
+
} else if ( name === "contains" ) {
|
| 3680 |
+
return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
|
| 3681 |
+
|
| 3682 |
+
} else if ( name === "not" ) {
|
| 3683 |
+
var not = match[3];
|
| 3684 |
+
|
| 3685 |
+
for ( var j = 0, l = not.length; j < l; j++ ) {
|
| 3686 |
+
if ( not[j] === elem ) {
|
| 3687 |
+
return false;
|
| 3688 |
+
}
|
| 3689 |
+
}
|
| 3690 |
+
|
| 3691 |
+
return true;
|
| 3692 |
+
|
| 3693 |
+
} else {
|
| 3694 |
+
Sizzle.error( "Syntax error, unrecognized expression: " + name );
|
| 3695 |
+
}
|
| 3696 |
+
},
|
| 3697 |
+
|
| 3698 |
+
CHILD: function( elem, match ) {
|
| 3699 |
+
var type = match[1],
|
| 3700 |
+
node = elem;
|
| 3701 |
+
|
| 3702 |
+
switch ( type ) {
|
| 3703 |
+
case "only":
|
| 3704 |
+
case "first":
|
| 3705 |
+
while ( (node = node.previousSibling) ) {
|
| 3706 |
+
if ( node.nodeType === 1 ) {
|
| 3707 |
+
return false;
|
| 3708 |
+
}
|
| 3709 |
+
}
|
| 3710 |
+
|
| 3711 |
+
if ( type === "first" ) {
|
| 3712 |
+
return true;
|
| 3713 |
+
}
|
| 3714 |
+
|
| 3715 |
+
node = elem;
|
| 3716 |
+
|
| 3717 |
+
case "last":
|
| 3718 |
+
while ( (node = node.nextSibling) ) {
|
| 3719 |
+
if ( node.nodeType === 1 ) {
|
| 3720 |
+
return false;
|
| 3721 |
+
}
|
| 3722 |
+
}
|
| 3723 |
+
|
| 3724 |
+
return true;
|
| 3725 |
+
|
| 3726 |
+
case "nth":
|
| 3727 |
+
var first = match[2],
|
| 3728 |
+
last = match[3];
|
| 3729 |
+
|
| 3730 |
+
if ( first === 1 && last === 0 ) {
|
| 3731 |
+
return true;
|
| 3732 |
+
}
|
| 3733 |
+
|
| 3734 |
+
var doneName = match[0],
|
| 3735 |
+
parent = elem.parentNode;
|
| 3736 |
+
|
| 3737 |
+
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
|
| 3738 |
+
var count = 0;
|
| 3739 |
+
|
| 3740 |
+
for ( node = parent.firstChild; node; node = node.nextSibling ) {
|
| 3741 |
+
if ( node.nodeType === 1 ) {
|
| 3742 |
+
node.nodeIndex = ++count;
|
| 3743 |
+
}
|
| 3744 |
+
}
|
| 3745 |
+
|
| 3746 |
+
parent.sizcache = doneName;
|
| 3747 |
+
}
|
| 3748 |
+
|
| 3749 |
+
var diff = elem.nodeIndex - last;
|
| 3750 |
+
|
| 3751 |
+
if ( first === 0 ) {
|
| 3752 |
+
return diff === 0;
|
| 3753 |
+
|
| 3754 |
+
} else {
|
| 3755 |
+
return ( diff % first === 0 && diff / first >= 0 );
|
| 3756 |
+
}
|
| 3757 |
+
}
|
| 3758 |
+
},
|
| 3759 |
+
|
| 3760 |
+
ID: function( elem, match ) {
|
| 3761 |
+
return elem.nodeType === 1 && elem.getAttribute("id") === match;
|
| 3762 |
+
},
|
| 3763 |
+
|
| 3764 |
+
TAG: function( elem, match ) {
|
| 3765 |
+
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
|
| 3766 |
+
},
|
| 3767 |
+
|
| 3768 |
+
CLASS: function( elem, match ) {
|
| 3769 |
+
return (" " + (elem.className || elem.getAttribute("class")) + " ")
|
| 3770 |
+
.indexOf( match ) > -1;
|
| 3771 |
+
},
|
| 3772 |
+
|
| 3773 |
+
ATTR: function( elem, match ) {
|
| 3774 |
+
var name = match[1],
|
| 3775 |
+
result = Expr.attrHandle[ name ] ?
|
| 3776 |
+
Expr.attrHandle[ name ]( elem ) :
|
| 3777 |
+
elem[ name ] != null ?
|
| 3778 |
+
elem[ name ] :
|
| 3779 |
+
elem.getAttribute( name ),
|
| 3780 |
+
value = result + "",
|
| 3781 |
+
type = match[2],
|
| 3782 |
+
check = match[4];
|
| 3783 |
+
|
| 3784 |
+
return result == null ?
|
| 3785 |
+
type === "!=" :
|
| 3786 |
+
type === "=" ?
|
| 3787 |
+
value === check :
|
| 3788 |
+
type === "*=" ?
|
| 3789 |
+
value.indexOf(check) >= 0 :
|
| 3790 |
+
type === "~=" ?
|
| 3791 |
+
(" " + value + " ").indexOf(check) >= 0 :
|
| 3792 |
+
!check ?
|
| 3793 |
+
value && result !== false :
|
| 3794 |
+
type === "!=" ?
|
| 3795 |
+
value !== check :
|
| 3796 |
+
type === "^=" ?
|
| 3797 |
+
value.indexOf(check) === 0 :
|
| 3798 |
+
type === "$=" ?
|
| 3799 |
+
value.substr(value.length - check.length) === check :
|
| 3800 |
+
type === "|=" ?
|
| 3801 |
+
value === check || value.substr(0, check.length + 1) === check + "-" :
|
| 3802 |
+
false;
|
| 3803 |
+
},
|
| 3804 |
+
|
| 3805 |
+
POS: function( elem, match, i, array ) {
|
| 3806 |
+
var name = match[2],
|
| 3807 |
+
filter = Expr.setFilters[ name ];
|
| 3808 |
+
|
| 3809 |
+
if ( filter ) {
|
| 3810 |
+
return filter( elem, i, match, array );
|
| 3811 |
+
}
|
| 3812 |
+
}
|
| 3813 |
+
}
|
| 3814 |
+
};
|
| 3815 |
+
|
| 3816 |
+
var origPOS = Expr.match.POS,
|
| 3817 |
+
fescape = function(all, num){
|
| 3818 |
+
return "\\" + (num - 0 + 1);
|
| 3819 |
+
};
|
| 3820 |
+
|
| 3821 |
+
for ( var type in Expr.match ) {
|
| 3822 |
+
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
|
| 3823 |
+
Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
|
| 3824 |
+
}
|
| 3825 |
+
|
| 3826 |
+
var makeArray = function( array, results ) {
|
| 3827 |
+
array = Array.prototype.slice.call( array, 0 );
|
| 3828 |
+
|
| 3829 |
+
if ( results ) {
|
| 3830 |
+
results.push.apply( results, array );
|
| 3831 |
+
return results;
|
| 3832 |
+
}
|
| 3833 |
+
|
| 3834 |
+
return array;
|
| 3835 |
+
};
|
| 3836 |
+
|
| 3837 |
+
// Perform a simple check to determine if the browser is capable of
|
| 3838 |
+
// converting a NodeList to an array using builtin methods.
|
| 3839 |
+
// Also verifies that the returned array holds DOM nodes
|
| 3840 |
+
// (which is not the case in the Blackberry browser)
|
| 3841 |
+
try {
|
| 3842 |
+
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
|
| 3843 |
+
|
| 3844 |
+
// Provide a fallback method if it does not work
|
| 3845 |
+
} catch( e ) {
|
| 3846 |
+
makeArray = function( array, results ) {
|
| 3847 |
+
var i = 0,
|
| 3848 |
+
ret = results || [];
|
| 3849 |
+
|
| 3850 |
+
if ( toString.call(array) === "[object Array]" ) {
|
| 3851 |
+
Array.prototype.push.apply( ret, array );
|
| 3852 |
+
|
| 3853 |
+
} else {
|
| 3854 |
+
if ( typeof array.length === "number" ) {
|
| 3855 |
+
for ( var l = array.length; i < l; i++ ) {
|
| 3856 |
+
ret.push( array[i] );
|
| 3857 |
+
}
|
| 3858 |
+
|
| 3859 |
+
} else {
|
| 3860 |
+
for ( ; array[i]; i++ ) {
|
| 3861 |
+
ret.push( array[i] );
|
| 3862 |
+
}
|
| 3863 |
+
}
|
| 3864 |
+
}
|
| 3865 |
+
|
| 3866 |
+
return ret;
|
| 3867 |
+
};
|
| 3868 |
+
}
|
| 3869 |
+
|
| 3870 |
+
var sortOrder, siblingCheck;
|
| 3871 |
+
|
| 3872 |
+
if ( document.documentElement.compareDocumentPosition ) {
|
| 3873 |
+
sortOrder = function( a, b ) {
|
| 3874 |
+
if ( a === b ) {
|
| 3875 |
+
hasDuplicate = true;
|
| 3876 |
+
return 0;
|
| 3877 |
+
}
|
| 3878 |
+
|
| 3879 |
+
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
|
| 3880 |
+
return a.compareDocumentPosition ? -1 : 1;
|
| 3881 |
+
}
|
| 3882 |
+
|
| 3883 |
+
return a.compareDocumentPosition(b) & 4 ? -1 : 1;
|
| 3884 |
+
};
|
| 3885 |
+
|
| 3886 |
+
} else {
|
| 3887 |
+
sortOrder = function( a, b ) {
|
| 3888 |
+
var al, bl,
|
| 3889 |
+
ap = [],
|
| 3890 |
+
bp = [],
|
| 3891 |
+
aup = a.parentNode,
|
| 3892 |
+
bup = b.parentNode,
|
| 3893 |
+
cur = aup;
|
| 3894 |
+
|
| 3895 |
+
// The nodes are identical, we can exit early
|
| 3896 |
+
if ( a === b ) {
|
| 3897 |
+
hasDuplicate = true;
|
| 3898 |
+
return 0;
|
| 3899 |
+
|
| 3900 |
+
// If the nodes are siblings (or identical) we can do a quick check
|
| 3901 |
+
} else if ( aup === bup ) {
|
| 3902 |
+
return siblingCheck( a, b );
|
| 3903 |
+
|
| 3904 |
+
// If no parents were found then the nodes are disconnected
|
| 3905 |
+
} else if ( !aup ) {
|
| 3906 |
+
return -1;
|
| 3907 |
+
|
| 3908 |
+
} else if ( !bup ) {
|
| 3909 |
+
return 1;
|
| 3910 |
+
}
|
| 3911 |
+
|
| 3912 |
+
// Otherwise they're somewhere else in the tree so we need
|
| 3913 |
+
// to build up a full list of the parentNodes for comparison
|
| 3914 |
+
while ( cur ) {
|
| 3915 |
+
ap.unshift( cur );
|
| 3916 |
+
cur = cur.parentNode;
|
| 3917 |
+
}
|
| 3918 |
+
|
| 3919 |
+
cur = bup;
|
| 3920 |
+
|
| 3921 |
+
while ( cur ) {
|
| 3922 |
+
bp.unshift( cur );
|
| 3923 |
+
cur = cur.parentNode;
|
| 3924 |
+
}
|
| 3925 |
+
|
| 3926 |
+
al = ap.length;
|
| 3927 |
+
bl = bp.length;
|
| 3928 |
+
|
| 3929 |
+
// Start walking down the tree looking for a discrepancy
|
| 3930 |
+
for ( var i = 0; i < al && i < bl; i++ ) {
|
| 3931 |
+
if ( ap[i] !== bp[i] ) {
|
| 3932 |
+
return siblingCheck( ap[i], bp[i] );
|
| 3933 |
+
}
|
| 3934 |
+
}
|
| 3935 |
+
|
| 3936 |
+
// We ended someplace up the tree so do a sibling check
|
| 3937 |
+
return i === al ?
|
| 3938 |
+
siblingCheck( a, bp[i], -1 ) :
|
| 3939 |
+
siblingCheck( ap[i], b, 1 );
|
| 3940 |
+
};
|
| 3941 |
+
|
| 3942 |
+
siblingCheck = function( a, b, ret ) {
|
| 3943 |
+
if ( a === b ) {
|
| 3944 |
+
return ret;
|
| 3945 |
+
}
|
| 3946 |
+
|
| 3947 |
+
var cur = a.nextSibling;
|
| 3948 |
+
|
| 3949 |
+
while ( cur ) {
|
| 3950 |
+
if ( cur === b ) {
|
| 3951 |
+
return -1;
|
| 3952 |
+
}
|
| 3953 |
+
|
| 3954 |
+
cur = cur.nextSibling;
|
| 3955 |
+
}
|
| 3956 |
+
|
| 3957 |
+
return 1;
|
| 3958 |
+
};
|
| 3959 |
+
}
|
| 3960 |
+
|
| 3961 |
+
// Utility function for retreiving the text value of an array of DOM nodes
|
| 3962 |
+
Sizzle.getText = function( elems ) {
|
| 3963 |
+
var ret = "", elem;
|
| 3964 |
+
|
| 3965 |
+
for ( var i = 0; elems[i]; i++ ) {
|
| 3966 |
+
elem = elems[i];
|
| 3967 |
+
|
| 3968 |
+
// Get the text from text nodes and CDATA nodes
|
| 3969 |
+
if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
|
| 3970 |
+
ret += elem.nodeValue;
|
| 3971 |
+
|
| 3972 |
+
// Traverse everything else, except comment nodes
|
| 3973 |
+
} else if ( elem.nodeType !== 8 ) {
|
| 3974 |
+
ret += Sizzle.getText( elem.childNodes );
|
| 3975 |
+
}
|
| 3976 |
+
}
|
| 3977 |
+
|
| 3978 |
+
return ret;
|
| 3979 |
+
};
|
| 3980 |
+
|
| 3981 |
+
// Check to see if the browser returns elements by name when
|
| 3982 |
+
// querying by getElementById (and provide a workaround)
|
| 3983 |
+
(function(){
|
| 3984 |
+
// We're going to inject a fake input element with a specified name
|
| 3985 |
+
var form = document.createElement("div"),
|
| 3986 |
+
id = "script" + (new Date()).getTime(),
|
| 3987 |
+
root = document.documentElement;
|
| 3988 |
+
|
| 3989 |
+
form.innerHTML = "<a name='" + id + "'/>";
|
| 3990 |
+
|
| 3991 |
+
// Inject it into the root element, check its status, and remove it quickly
|
| 3992 |
+
root.insertBefore( form, root.firstChild );
|
| 3993 |
+
|
| 3994 |
+
// The workaround has to do additional checks after a getElementById
|
| 3995 |
+
// Which slows things down for other browsers (hence the branching)
|
| 3996 |
+
if ( document.getElementById( id ) ) {
|
| 3997 |
+
Expr.find.ID = function( match, context, isXML ) {
|
| 3998 |
+
if ( typeof context.getElementById !== "undefined" && !isXML ) {
|
| 3999 |
+
var m = context.getElementById(match[1]);
|
| 4000 |
+
|
| 4001 |
+
return m ?
|
| 4002 |
+
m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
|
| 4003 |
+
[m] :
|
| 4004 |
+
undefined :
|
| 4005 |
+
[];
|
| 4006 |
+
}
|
| 4007 |
+
};
|
| 4008 |
+
|
| 4009 |
+
Expr.filter.ID = function( elem, match ) {
|
| 4010 |
+
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
|
| 4011 |
+
|
| 4012 |
+
return elem.nodeType === 1 && node && node.nodeValue === match;
|
| 4013 |
+
};
|
| 4014 |
+
}
|
| 4015 |
+
|
| 4016 |
+
root.removeChild( form );
|
| 4017 |
+
|
| 4018 |
+
// release memory in IE
|
| 4019 |
+
root = form = null;
|
| 4020 |
+
})();
|
| 4021 |
+
|
| 4022 |
+
(function(){
|
| 4023 |
+
// Check to see if the browser returns only elements
|
| 4024 |
+
// when doing getElementsByTagName("*")
|
| 4025 |
+
|
| 4026 |
+
// Create a fake element
|
| 4027 |
+
var div = document.createElement("div");
|
| 4028 |
+
div.appendChild( document.createComment("") );
|
| 4029 |
+
|
| 4030 |
+
// Make sure no comments are found
|
| 4031 |
+
if ( div.getElementsByTagName("*").length > 0 ) {
|
| 4032 |
+
Expr.find.TAG = function( match, context ) {
|
| 4033 |
+
var results = context.getElementsByTagName( match[1] );
|
| 4034 |
+
|
| 4035 |
+
// Filter out possible comments
|
| 4036 |
+
if ( match[1] === "*" ) {
|
| 4037 |
+
var tmp = [];
|
| 4038 |
+
|
| 4039 |
+
for ( var i = 0; results[i]; i++ ) {
|
| 4040 |
+
if ( results[i].nodeType === 1 ) {
|
| 4041 |
+
tmp.push( results[i] );
|
| 4042 |
+
}
|
| 4043 |
+
}
|
| 4044 |
+
|
| 4045 |
+
results = tmp;
|
| 4046 |
+
}
|
| 4047 |
+
|
| 4048 |
+
return results;
|
| 4049 |
+
};
|
| 4050 |
+
}
|
| 4051 |
+
|
| 4052 |
+
// Check to see if an attribute returns normalized href attributes
|
| 4053 |
+
div.innerHTML = "<a href='#'></a>";
|
| 4054 |
+
|
| 4055 |
+
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
|
| 4056 |
+
div.firstChild.getAttribute("href") !== "#" ) {
|
| 4057 |
+
|
| 4058 |
+
Expr.attrHandle.href = function( elem ) {
|
| 4059 |
+
return elem.getAttribute( "href", 2 );
|
| 4060 |
+
};
|
| 4061 |
+
}
|
| 4062 |
+
|
| 4063 |
+
// release memory in IE
|
| 4064 |
+
div = null;
|
| 4065 |
+
})();
|
| 4066 |
+
|
| 4067 |
+
if ( document.querySelectorAll ) {
|
| 4068 |
+
(function(){
|
| 4069 |
+
var oldSizzle = Sizzle,
|
| 4070 |
+
div = document.createElement("div"),
|
| 4071 |
+
id = "__sizzle__";
|
| 4072 |
+
|
| 4073 |
+
div.innerHTML = "<p class='TEST'></p>";
|
| 4074 |
+
|
| 4075 |
+
// Safari can't handle uppercase or unicode characters when
|
| 4076 |
+
// in quirks mode.
|
| 4077 |
+
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
|
| 4078 |
+
return;
|
| 4079 |
+
}
|
| 4080 |
+
|
| 4081 |
+
Sizzle = function( query, context, extra, seed ) {
|
| 4082 |
+
context = context || document;
|
| 4083 |
+
|
| 4084 |
+
// Make sure that attribute selectors are quoted
|
| 4085 |
+
query = query.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
|
| 4086 |
+
|
| 4087 |
+
// Only use querySelectorAll on non-XML documents
|
| 4088 |
+
// (ID selectors don't work in non-HTML documents)
|
| 4089 |
+
if ( !seed && !Sizzle.isXML(context) ) {
|
| 4090 |
+
if ( context.nodeType === 9 ) {
|
| 4091 |
+
try {
|
| 4092 |
+
return makeArray( context.querySelectorAll(query), extra );
|
| 4093 |
+
} catch(qsaError) {}
|
| 4094 |
+
|
| 4095 |
+
// qSA works strangely on Element-rooted queries
|
| 4096 |
+
// We can work around this by specifying an extra ID on the root
|
| 4097 |
+
// and working up from there (Thanks to Andrew Dupont for the technique)
|
| 4098 |
+
// IE 8 doesn't work on object elements
|
| 4099 |
+
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
|
| 4100 |
+
var old = context.getAttribute( "id" ),
|
| 4101 |
+
nid = old || id;
|
| 4102 |
+
|
| 4103 |
+
if ( !old ) {
|
| 4104 |
+
context.setAttribute( "id", nid );
|
| 4105 |
+
}
|
| 4106 |
+
|
| 4107 |
+
try {
|
| 4108 |
+
return makeArray( context.querySelectorAll( "#" + nid + " " + query ), extra );
|
| 4109 |
+
|
| 4110 |
+
} catch(pseudoError) {
|
| 4111 |
+
} finally {
|
| 4112 |
+
if ( !old ) {
|
| 4113 |
+
context.removeAttribute( "id" );
|
| 4114 |
+
}
|
| 4115 |
+
}
|
| 4116 |
+
}
|
| 4117 |
+
}
|
| 4118 |
+
|
| 4119 |
+
return oldSizzle(query, context, extra, seed);
|
| 4120 |
+
};
|
| 4121 |
+
|
| 4122 |
+
for ( var prop in oldSizzle ) {
|
| 4123 |
+
Sizzle[ prop ] = oldSizzle[ prop ];
|
| 4124 |
+
}
|
| 4125 |
+
|
| 4126 |
+
// release memory in IE
|
| 4127 |
+
div = null;
|
| 4128 |
+
})();
|
| 4129 |
+
}
|
| 4130 |
+
|
| 4131 |
+
(function(){
|
| 4132 |
+
var html = document.documentElement,
|
| 4133 |
+
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
|
| 4134 |
+
pseudoWorks = false;
|
| 4135 |
+
|
| 4136 |
+
try {
|
| 4137 |
+
// This should fail with an exception
|
| 4138 |
+
// Gecko does not error, returns false instead
|
| 4139 |
+
matches.call( document.documentElement, "[test!='']:sizzle" );
|
| 4140 |
+
|
| 4141 |
+
} catch( pseudoError ) {
|
| 4142 |
+
pseudoWorks = true;
|
| 4143 |
+
}
|
| 4144 |
+
|
| 4145 |
+
if ( matches ) {
|
| 4146 |
+
Sizzle.matchesSelector = function( node, expr ) {
|
| 4147 |
+
// Make sure that attribute selectors are quoted
|
| 4148 |
+
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
|
| 4149 |
+
|
| 4150 |
+
if ( !Sizzle.isXML( node ) ) {
|
| 4151 |
+
try {
|
| 4152 |
+
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
|
| 4153 |
+
return matches.call( node, expr );
|
| 4154 |
+
}
|
| 4155 |
+
} catch(e) {}
|
| 4156 |
+
}
|
| 4157 |
+
|
| 4158 |
+
return Sizzle(expr, null, null, [node]).length > 0;
|
| 4159 |
+
};
|
| 4160 |
+
}
|
| 4161 |
+
})();
|
| 4162 |
+
|
| 4163 |
+
(function(){
|
| 4164 |
+
var div = document.createElement("div");
|
| 4165 |
+
|
| 4166 |
+
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
|
| 4167 |
+
|
| 4168 |
+
// Opera can't find a second classname (in 9.6)
|
| 4169 |
+
// Also, make sure that getElementsByClassName actually exists
|
| 4170 |
+
if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
|
| 4171 |
+
return;
|
| 4172 |
+
}
|
| 4173 |
+
|
| 4174 |
+
// Safari caches class attributes, doesn't catch changes (in 3.2)
|
| 4175 |
+
div.lastChild.className = "e";
|
| 4176 |
+
|
| 4177 |
+
if ( div.getElementsByClassName("e").length === 1 ) {
|
| 4178 |
+
return;
|
| 4179 |
+
}
|
| 4180 |
+
|
| 4181 |
+
Expr.order.splice(1, 0, "CLASS");
|
| 4182 |
+
Expr.find.CLASS = function( match, context, isXML ) {
|
| 4183 |
+
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
|
| 4184 |
+
return context.getElementsByClassName(match[1]);
|
| 4185 |
+
}
|
| 4186 |
+
};
|
| 4187 |
+
|
| 4188 |
+
// release memory in IE
|
| 4189 |
+
div = null;
|
| 4190 |
+
})();
|
| 4191 |
+
|
| 4192 |
+
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
|
| 4193 |
+
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
|
| 4194 |
+
var elem = checkSet[i];
|
| 4195 |
+
|
| 4196 |
+
if ( elem ) {
|
| 4197 |
+
var match = false;
|
| 4198 |
+
|
| 4199 |
+
elem = elem[dir];
|
| 4200 |
+
|
| 4201 |
+
while ( elem ) {
|
| 4202 |
+
if ( elem.sizcache === doneName ) {
|
| 4203 |
+
match = checkSet[elem.sizset];
|
| 4204 |
+
break;
|
| 4205 |
+
}
|
| 4206 |
+
|
| 4207 |
+
if ( elem.nodeType === 1 && !isXML ){
|
| 4208 |
+
elem.sizcache = doneName;
|
| 4209 |
+
elem.sizset = i;
|
| 4210 |
+
}
|
| 4211 |
+
|
| 4212 |
+
if ( elem.nodeName.toLowerCase() === cur ) {
|
| 4213 |
+
match = elem;
|
| 4214 |
+
break;
|
| 4215 |
+
}
|
| 4216 |
+
|
| 4217 |
+
elem = elem[dir];
|
| 4218 |
+
}
|
| 4219 |
+
|
| 4220 |
+
checkSet[i] = match;
|
| 4221 |
+
}
|
| 4222 |
+
}
|
| 4223 |
+
}
|
| 4224 |
+
|
| 4225 |
+
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
|
| 4226 |
+
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
|
| 4227 |
+
var elem = checkSet[i];
|
| 4228 |
+
|
| 4229 |
+
if ( elem ) {
|
| 4230 |
+
var match = false;
|
| 4231 |
+
|
| 4232 |
+
elem = elem[dir];
|
| 4233 |
+
|
| 4234 |
+
while ( elem ) {
|
| 4235 |
+
if ( elem.sizcache === doneName ) {
|
| 4236 |
+
match = checkSet[elem.sizset];
|
| 4237 |
+
break;
|
| 4238 |
+
}
|
| 4239 |
+
|
| 4240 |
+
if ( elem.nodeType === 1 ) {
|
| 4241 |
+
if ( !isXML ) {
|
| 4242 |
+
elem.sizcache = doneName;
|
| 4243 |
+
elem.sizset = i;
|
| 4244 |
+
}
|
| 4245 |
+
|
| 4246 |
+
if ( typeof cur !== "string" ) {
|
| 4247 |
+
if ( elem === cur ) {
|
| 4248 |
+
match = true;
|
| 4249 |
+
break;
|
| 4250 |
+
}
|
| 4251 |
+
|
| 4252 |
+
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
|
| 4253 |
+
match = elem;
|
| 4254 |
+
break;
|
| 4255 |
+
}
|
| 4256 |
+
}
|
| 4257 |
+
|
| 4258 |
+
elem = elem[dir];
|
| 4259 |
+
}
|
| 4260 |
+
|
| 4261 |
+
checkSet[i] = match;
|
| 4262 |
+
}
|
| 4263 |
+
}
|
| 4264 |
+
}
|
| 4265 |
+
|
| 4266 |
+
if ( document.documentElement.contains ) {
|
| 4267 |
+
Sizzle.contains = function( a, b ) {
|
| 4268 |
+
return a !== b && (a.contains ? a.contains(b) : true);
|
| 4269 |
+
};
|
| 4270 |
+
|
| 4271 |
+
} else if ( document.documentElement.compareDocumentPosition ) {
|
| 4272 |
+
Sizzle.contains = function( a, b ) {
|
| 4273 |
+
return !!(a.compareDocumentPosition(b) & 16);
|
| 4274 |
+
};
|
| 4275 |
+
|
| 4276 |
+
} else {
|
| 4277 |
+
Sizzle.contains = function() {
|
| 4278 |
+
return false;
|
| 4279 |
+
};
|
| 4280 |
+
}
|
| 4281 |
+
|
| 4282 |
+
Sizzle.isXML = function( elem ) {
|
| 4283 |
+
// documentElement is verified for cases where it doesn't yet exist
|
| 4284 |
+
// (such as loading iframes in IE - #4833)
|
| 4285 |
+
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
|
| 4286 |
+
|
| 4287 |
+
return documentElement ? documentElement.nodeName !== "HTML" : false;
|
| 4288 |
+
};
|
| 4289 |
+
|
| 4290 |
+
var posProcess = function( selector, context ) {
|
| 4291 |
+
var match,
|
| 4292 |
+
tmpSet = [],
|
| 4293 |
+
later = "",
|
| 4294 |
+
root = context.nodeType ? [context] : context;
|
| 4295 |
+
|
| 4296 |
+
// Position selectors must be done after the filter
|
| 4297 |
+
// And so must :not(positional) so we move all PSEUDOs to the end
|
| 4298 |
+
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
|
| 4299 |
+
later += match[0];
|
| 4300 |
+
selector = selector.replace( Expr.match.PSEUDO, "" );
|
| 4301 |
+
}
|
| 4302 |
+
|
| 4303 |
+
selector = Expr.relative[selector] ? selector + "*" : selector;
|
| 4304 |
+
|
| 4305 |
+
for ( var i = 0, l = root.length; i < l; i++ ) {
|
| 4306 |
+
Sizzle( selector, root[i], tmpSet );
|
| 4307 |
+
}
|
| 4308 |
+
|
| 4309 |
+
return Sizzle.filter( later, tmpSet );
|
| 4310 |
+
};
|
| 4311 |
+
|
| 4312 |
+
// EXPOSE
|
| 4313 |
+
jQuery.find = Sizzle;
|
| 4314 |
+
jQuery.expr = Sizzle.selectors;
|
| 4315 |
+
jQuery.expr[":"] = jQuery.expr.filters;
|
| 4316 |
+
jQuery.unique = Sizzle.uniqueSort;
|
| 4317 |
+
jQuery.text = Sizzle.getText;
|
| 4318 |
+
jQuery.isXMLDoc = Sizzle.isXML;
|
| 4319 |
+
jQuery.contains = Sizzle.contains;
|
| 4320 |
+
|
| 4321 |
+
|
| 4322 |
+
})();
|
| 4323 |
+
|
| 4324 |
+
|
| 4325 |
+
var runtil = /Until$/,
|
| 4326 |
+
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
|
| 4327 |
+
// Note: This RegExp should be improved, or likely pulled from Sizzle
|
| 4328 |
+
rmultiselector = /,/,
|
| 4329 |
+
isSimple = /^.[^:#\[\.,]*$/,
|
| 4330 |
+
slice = Array.prototype.slice,
|
| 4331 |
+
POS = jQuery.expr.match.POS;
|
| 4332 |
+
|
| 4333 |
+
jQuery.fn.extend({
|
| 4334 |
+
find: function( selector ) {
|
| 4335 |
+
var ret = this.pushStack( "", "find", selector ),
|
| 4336 |
+
length = 0;
|
| 4337 |
+
|
| 4338 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
| 4339 |
+
length = ret.length;
|
| 4340 |
+
jQuery.find( selector, this[i], ret );
|
| 4341 |
+
|
| 4342 |
+
if ( i > 0 ) {
|
| 4343 |
+
// Make sure that the results are unique
|
| 4344 |
+
for ( var n = length; n < ret.length; n++ ) {
|
| 4345 |
+
for ( var r = 0; r < length; r++ ) {
|
| 4346 |
+
if ( ret[r] === ret[n] ) {
|
| 4347 |
+
ret.splice(n--, 1);
|
| 4348 |
+
break;
|
| 4349 |
+
}
|
| 4350 |
+
}
|
| 4351 |
+
}
|
| 4352 |
+
}
|
| 4353 |
+
}
|
| 4354 |
+
|
| 4355 |
+
return ret;
|
| 4356 |
+
},
|
| 4357 |
+
|
| 4358 |
+
has: function( target ) {
|
| 4359 |
+
var targets = jQuery( target );
|
| 4360 |
+
return this.filter(function() {
|
| 4361 |
+
for ( var i = 0, l = targets.length; i < l; i++ ) {
|
| 4362 |
+
if ( jQuery.contains( this, targets[i] ) ) {
|
| 4363 |
+
return true;
|
| 4364 |
+
}
|
| 4365 |
+
}
|
| 4366 |
+
});
|
| 4367 |
+
},
|
| 4368 |
+
|
| 4369 |
+
not: function( selector ) {
|
| 4370 |
+
return this.pushStack( winnow(this, selector, false), "not", selector);
|
| 4371 |
+
},
|
| 4372 |
+
|
| 4373 |
+
filter: function( selector ) {
|
| 4374 |
+
return this.pushStack( winnow(this, selector, true), "filter", selector );
|
| 4375 |
+
},
|
| 4376 |
+
|
| 4377 |
+
is: function( selector ) {
|
| 4378 |
+
return !!selector && jQuery.filter( selector, this ).length > 0;
|
| 4379 |
+
},
|
| 4380 |
+
|
| 4381 |
+
closest: function( selectors, context ) {
|
| 4382 |
+
var ret = [], i, l, cur = this[0];
|
| 4383 |
+
|
| 4384 |
+
if ( jQuery.isArray( selectors ) ) {
|
| 4385 |
+
var match, selector,
|
| 4386 |
+
matches = {},
|
| 4387 |
+
level = 1;
|
| 4388 |
+
|
| 4389 |
+
if ( cur && selectors.length ) {
|
| 4390 |
+
for ( i = 0, l = selectors.length; i < l; i++ ) {
|
| 4391 |
+
selector = selectors[i];
|
| 4392 |
+
|
| 4393 |
+
if ( !matches[selector] ) {
|
| 4394 |
+
matches[selector] = jQuery.expr.match.POS.test( selector ) ?
|
| 4395 |
+
jQuery( selector, context || this.context ) :
|
| 4396 |
+
selector;
|
| 4397 |
+
}
|
| 4398 |
+
}
|
| 4399 |
+
|
| 4400 |
+
while ( cur && cur.ownerDocument && cur !== context ) {
|
| 4401 |
+
for ( selector in matches ) {
|
| 4402 |
+
match = matches[selector];
|
| 4403 |
+
|
| 4404 |
+
if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
|
| 4405 |
+
ret.push({ selector: selector, elem: cur, level: level });
|
| 4406 |
+
}
|
| 4407 |
+
}
|
| 4408 |
+
|
| 4409 |
+
cur = cur.parentNode;
|
| 4410 |
+
level++;
|
| 4411 |
+
}
|
| 4412 |
+
}
|
| 4413 |
+
|
| 4414 |
+
return ret;
|
| 4415 |
+
}
|
| 4416 |
+
|
| 4417 |
+
var pos = POS.test( selectors ) ?
|
| 4418 |
+
jQuery( selectors, context || this.context ) : null;
|
| 4419 |
+
|
| 4420 |
+
for ( i = 0, l = this.length; i < l; i++ ) {
|
| 4421 |
+
cur = this[i];
|
| 4422 |
+
|
| 4423 |
+
while ( cur ) {
|
| 4424 |
+
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
|
| 4425 |
+
ret.push( cur );
|
| 4426 |
+
break;
|
| 4427 |
+
|
| 4428 |
+
} else {
|
| 4429 |
+
cur = cur.parentNode;
|
| 4430 |
+
if ( !cur || !cur.ownerDocument || cur === context ) {
|
| 4431 |
+
break;
|
| 4432 |
+
}
|
| 4433 |
+
}
|
| 4434 |
+
}
|
| 4435 |
+
}
|
| 4436 |
+
|
| 4437 |
+
ret = ret.length > 1 ? jQuery.unique(ret) : ret;
|
| 4438 |
+
|
| 4439 |
+
return this.pushStack( ret, "closest", selectors );
|
| 4440 |
+
},
|
| 4441 |
+
|
| 4442 |
+
// Determine the position of an element within
|
| 4443 |
+
// the matched set of elements
|
| 4444 |
+
index: function( elem ) {
|
| 4445 |
+
if ( !elem || typeof elem === "string" ) {
|
| 4446 |
+
return jQuery.inArray( this[0],
|
| 4447 |
+
// If it receives a string, the selector is used
|
| 4448 |
+
// If it receives nothing, the siblings are used
|
| 4449 |
+
elem ? jQuery( elem ) : this.parent().children() );
|
| 4450 |
+
}
|
| 4451 |
+
// Locate the position of the desired element
|
| 4452 |
+
return jQuery.inArray(
|
| 4453 |
+
// If it receives a jQuery object, the first element is used
|
| 4454 |
+
elem.jquery ? elem[0] : elem, this );
|
| 4455 |
+
},
|
| 4456 |
+
|
| 4457 |
+
add: function( selector, context ) {
|
| 4458 |
+
var set = typeof selector === "string" ?
|
| 4459 |
+
jQuery( selector, context || this.context ) :
|
| 4460 |
+
jQuery.makeArray( selector ),
|
| 4461 |
+
all = jQuery.merge( this.get(), set );
|
| 4462 |
+
|
| 4463 |
+
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
|
| 4464 |
+
all :
|
| 4465 |
+
jQuery.unique( all ) );
|
| 4466 |
+
},
|
| 4467 |
+
|
| 4468 |
+
andSelf: function() {
|
| 4469 |
+
return this.add( this.prevObject );
|
| 4470 |
+
}
|
| 4471 |
+
});
|
| 4472 |
+
|
| 4473 |
+
// A painfully simple check to see if an element is disconnected
|
| 4474 |
+
// from a document (should be improved, where feasible).
|
| 4475 |
+
function isDisconnected( node ) {
|
| 4476 |
+
return !node || !node.parentNode || node.parentNode.nodeType === 11;
|
| 4477 |
+
}
|
| 4478 |
+
|
| 4479 |
+
jQuery.each({
|
| 4480 |
+
parent: function( elem ) {
|
| 4481 |
+
var parent = elem.parentNode;
|
| 4482 |
+
return parent && parent.nodeType !== 11 ? parent : null;
|
| 4483 |
+
},
|
| 4484 |
+
parents: function( elem ) {
|
| 4485 |
+
return jQuery.dir( elem, "parentNode" );
|
| 4486 |
+
},
|
| 4487 |
+
parentsUntil: function( elem, i, until ) {
|
| 4488 |
+
return jQuery.dir( elem, "parentNode", until );
|
| 4489 |
+
},
|
| 4490 |
+
next: function( elem ) {
|
| 4491 |
+
return jQuery.nth( elem, 2, "nextSibling" );
|
| 4492 |
+
},
|
| 4493 |
+
prev: function( elem ) {
|
| 4494 |
+
return jQuery.nth( elem, 2, "previousSibling" );
|
| 4495 |
+
},
|
| 4496 |
+
nextAll: function( elem ) {
|
| 4497 |
+
return jQuery.dir( elem, "nextSibling" );
|
| 4498 |
+
},
|
| 4499 |
+
prevAll: function( elem ) {
|
| 4500 |
+
return jQuery.dir( elem, "previousSibling" );
|
| 4501 |
+
},
|
| 4502 |
+
nextUntil: function( elem, i, until ) {
|
| 4503 |
+
return jQuery.dir( elem, "nextSibling", until );
|
| 4504 |
+
},
|
| 4505 |
+
prevUntil: function( elem, i, until ) {
|
| 4506 |
+
return jQuery.dir( elem, "previousSibling", until );
|
| 4507 |
+
},
|
| 4508 |
+
siblings: function( elem ) {
|
| 4509 |
+
return jQuery.sibling( elem.parentNode.firstChild, elem );
|
| 4510 |
+
},
|
| 4511 |
+
children: function( elem ) {
|
| 4512 |
+
return jQuery.sibling( elem.firstChild );
|
| 4513 |
+
},
|
| 4514 |
+
contents: function( elem ) {
|
| 4515 |
+
return jQuery.nodeName( elem, "iframe" ) ?
|
| 4516 |
+
elem.contentDocument || elem.contentWindow.document :
|
| 4517 |
+
jQuery.makeArray( elem.childNodes );
|
| 4518 |
+
}
|
| 4519 |
+
}, function( name, fn ) {
|
| 4520 |
+
jQuery.fn[ name ] = function( until, selector ) {
|
| 4521 |
+
var ret = jQuery.map( this, fn, until );
|
| 4522 |
+
|
| 4523 |
+
if ( !runtil.test( name ) ) {
|
| 4524 |
+
selector = until;
|
| 4525 |
+
}
|
| 4526 |
+
|
| 4527 |
+
if ( selector && typeof selector === "string" ) {
|
| 4528 |
+
ret = jQuery.filter( selector, ret );
|
| 4529 |
+
}
|
| 4530 |
+
|
| 4531 |
+
ret = this.length > 1 ? jQuery.unique( ret ) : ret;
|
| 4532 |
+
|
| 4533 |
+
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
|
| 4534 |
+
ret = ret.reverse();
|
| 4535 |
+
}
|
| 4536 |
+
|
| 4537 |
+
return this.pushStack( ret, name, slice.call(arguments).join(",") );
|
| 4538 |
+
};
|
| 4539 |
+
});
|
| 4540 |
+
|
| 4541 |
+
jQuery.extend({
|
| 4542 |
+
filter: function( expr, elems, not ) {
|
| 4543 |
+
if ( not ) {
|
| 4544 |
+
expr = ":not(" + expr + ")";
|
| 4545 |
+
}
|
| 4546 |
+
|
| 4547 |
+
return elems.length === 1 ?
|
| 4548 |
+
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
|
| 4549 |
+
jQuery.find.matches(expr, elems);
|
| 4550 |
+
},
|
| 4551 |
+
|
| 4552 |
+
dir: function( elem, dir, until ) {
|
| 4553 |
+
var matched = [],
|
| 4554 |
+
cur = elem[ dir ];
|
| 4555 |
+
|
| 4556 |
+
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
|
| 4557 |
+
if ( cur.nodeType === 1 ) {
|
| 4558 |
+
matched.push( cur );
|
| 4559 |
+
}
|
| 4560 |
+
cur = cur[dir];
|
| 4561 |
+
}
|
| 4562 |
+
return matched;
|
| 4563 |
+
},
|
| 4564 |
+
|
| 4565 |
+
nth: function( cur, result, dir, elem ) {
|
| 4566 |
+
result = result || 1;
|
| 4567 |
+
var num = 0;
|
| 4568 |
+
|
| 4569 |
+
for ( ; cur; cur = cur[dir] ) {
|
| 4570 |
+
if ( cur.nodeType === 1 && ++num === result ) {
|
| 4571 |
+
break;
|
| 4572 |
+
}
|
| 4573 |
+
}
|
| 4574 |
+
|
| 4575 |
+
return cur;
|
| 4576 |
+
},
|
| 4577 |
+
|
| 4578 |
+
sibling: function( n, elem ) {
|
| 4579 |
+
var r = [];
|
| 4580 |
+
|
| 4581 |
+
for ( ; n; n = n.nextSibling ) {
|
| 4582 |
+
if ( n.nodeType === 1 && n !== elem ) {
|
| 4583 |
+
r.push( n );
|
| 4584 |
+
}
|
| 4585 |
+
}
|
| 4586 |
+
|
| 4587 |
+
return r;
|
| 4588 |
+
}
|
| 4589 |
+
});
|
| 4590 |
+
|
| 4591 |
+
// Implement the identical functionality for filter and not
|
| 4592 |
+
function winnow( elements, qualifier, keep ) {
|
| 4593 |
+
if ( jQuery.isFunction( qualifier ) ) {
|
| 4594 |
+
return jQuery.grep(elements, function( elem, i ) {
|
| 4595 |
+
var retVal = !!qualifier.call( elem, i, elem );
|
| 4596 |
+
return retVal === keep;
|
| 4597 |
+
});
|
| 4598 |
+
|
| 4599 |
+
} else if ( qualifier.nodeType ) {
|
| 4600 |
+
return jQuery.grep(elements, function( elem, i ) {
|
| 4601 |
+
return (elem === qualifier) === keep;
|
| 4602 |
+
});
|
| 4603 |
+
|
| 4604 |
+
} else if ( typeof qualifier === "string" ) {
|
| 4605 |
+
var filtered = jQuery.grep(elements, function( elem ) {
|
| 4606 |
+
return elem.nodeType === 1;
|
| 4607 |
+
});
|
| 4608 |
+
|
| 4609 |
+
if ( isSimple.test( qualifier ) ) {
|
| 4610 |
+
return jQuery.filter(qualifier, filtered, !keep);
|
| 4611 |
+
} else {
|
| 4612 |
+
qualifier = jQuery.filter( qualifier, filtered );
|
| 4613 |
+
}
|
| 4614 |
+
}
|
| 4615 |
+
|
| 4616 |
+
return jQuery.grep(elements, function( elem, i ) {
|
| 4617 |
+
return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
|
| 4618 |
+
});
|
| 4619 |
+
}
|
| 4620 |
+
|
| 4621 |
+
|
| 4622 |
+
|
| 4623 |
+
|
| 4624 |
+
var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
|
| 4625 |
+
rleadingWhitespace = /^\s+/,
|
| 4626 |
+
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
|
| 4627 |
+
rtagName = /<([\w:]+)/,
|
| 4628 |
+
rtbody = /<tbody/i,
|
| 4629 |
+
rhtml = /<|&#?\w+;/,
|
| 4630 |
+
rnocache = /<(?:script|object|embed|option|style)/i,
|
| 4631 |
+
// checked="checked" or checked (html5)
|
| 4632 |
+
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
|
| 4633 |
+
raction = /\=([^="'>\s]+\/)>/g,
|
| 4634 |
+
wrapMap = {
|
| 4635 |
+
option: [ 1, "<select multiple='multiple'>", "</select>" ],
|
| 4636 |
+
legend: [ 1, "<fieldset>", "</fieldset>" ],
|
| 4637 |
+
thead: [ 1, "<table>", "</table>" ],
|
| 4638 |
+
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
|
| 4639 |
+
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
|
| 4640 |
+
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
|
| 4641 |
+
area: [ 1, "<map>", "</map>" ],
|
| 4642 |
+
_default: [ 0, "", "" ]
|
| 4643 |
+
};
|
| 4644 |
+
|
| 4645 |
+
wrapMap.optgroup = wrapMap.option;
|
| 4646 |
+
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
|
| 4647 |
+
wrapMap.th = wrapMap.td;
|
| 4648 |
+
|
| 4649 |
+
// IE can't serialize <link> and <script> tags normally
|
| 4650 |
+
if ( !jQuery.support.htmlSerialize ) {
|
| 4651 |
+
wrapMap._default = [ 1, "div<div>", "</div>" ];
|
| 4652 |
+
}
|
| 4653 |
+
|
| 4654 |
+
jQuery.fn.extend({
|
| 4655 |
+
text: function( text ) {
|
| 4656 |
+
if ( jQuery.isFunction(text) ) {
|
| 4657 |
+
return this.each(function(i) {
|
| 4658 |
+
var self = jQuery( this );
|
| 4659 |
+
|
| 4660 |
+
self.text( text.call(this, i, self.text()) );
|
| 4661 |
+
});
|
| 4662 |
+
}
|
| 4663 |
+
|
| 4664 |
+
if ( typeof text !== "object" && text !== undefined ) {
|
| 4665 |
+
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
|
| 4666 |
+
}
|
| 4667 |
+
|
| 4668 |
+
return jQuery.text( this );
|
| 4669 |
+
},
|
| 4670 |
+
|
| 4671 |
+
wrapAll: function( html ) {
|
| 4672 |
+
if ( jQuery.isFunction( html ) ) {
|
| 4673 |
+
return this.each(function(i) {
|
| 4674 |
+
jQuery(this).wrapAll( html.call(this, i) );
|
| 4675 |
+
});
|
| 4676 |
+
}
|
| 4677 |
+
|
| 4678 |
+
if ( this[0] ) {
|
| 4679 |
+
// The elements to wrap the target around
|
| 4680 |
+
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
|
| 4681 |
+
|
| 4682 |
+
if ( this[0].parentNode ) {
|
| 4683 |
+
wrap.insertBefore( this[0] );
|
| 4684 |
+
}
|
| 4685 |
+
|
| 4686 |
+
wrap.map(function() {
|
| 4687 |
+
var elem = this;
|
| 4688 |
+
|
| 4689 |
+
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
|
| 4690 |
+
elem = elem.firstChild;
|
| 4691 |
+
}
|
| 4692 |
+
|
| 4693 |
+
return elem;
|
| 4694 |
+
}).append(this);
|
| 4695 |
+
}
|
| 4696 |
+
|
| 4697 |
+
return this;
|
| 4698 |
+
},
|
| 4699 |
+
|
| 4700 |
+
wrapInner: function( html ) {
|
| 4701 |
+
if ( jQuery.isFunction( html ) ) {
|
| 4702 |
+
return this.each(function(i) {
|
| 4703 |
+
jQuery(this).wrapInner( html.call(this, i) );
|
| 4704 |
+
});
|
| 4705 |
+
}
|
| 4706 |
+
|
| 4707 |
+
return this.each(function() {
|
| 4708 |
+
var self = jQuery( this ),
|
| 4709 |
+
contents = self.contents();
|
| 4710 |
+
|
| 4711 |
+
if ( contents.length ) {
|
| 4712 |
+
contents.wrapAll( html );
|
| 4713 |
+
|
| 4714 |
+
} else {
|
| 4715 |
+
self.append( html );
|
| 4716 |
+
}
|
| 4717 |
+
});
|
| 4718 |
+
},
|
| 4719 |
+
|
| 4720 |
+
wrap: function( html ) {
|
| 4721 |
+
return this.each(function() {
|
| 4722 |
+
jQuery( this ).wrapAll( html );
|
| 4723 |
+
});
|
| 4724 |
+
},
|
| 4725 |
+
|
| 4726 |
+
unwrap: function() {
|
| 4727 |
+
return this.parent().each(function() {
|
| 4728 |
+
if ( !jQuery.nodeName( this, "body" ) ) {
|
| 4729 |
+
jQuery( this ).replaceWith( this.childNodes );
|
| 4730 |
+
}
|
| 4731 |
+
}).end();
|
| 4732 |
+
},
|
| 4733 |
+
|
| 4734 |
+
append: function() {
|
| 4735 |
+
return this.domManip(arguments, true, function( elem ) {
|
| 4736 |
+
if ( this.nodeType === 1 ) {
|
| 4737 |
+
this.appendChild( elem );
|
| 4738 |
+
}
|
| 4739 |
+
});
|
| 4740 |
+
},
|
| 4741 |
+
|
| 4742 |
+
prepend: function() {
|
| 4743 |
+
return this.domManip(arguments, true, function( elem ) {
|
| 4744 |
+
if ( this.nodeType === 1 ) {
|
| 4745 |
+
this.insertBefore( elem, this.firstChild );
|
| 4746 |
+
}
|
| 4747 |
+
});
|
| 4748 |
+
},
|
| 4749 |
+
|
| 4750 |
+
before: function() {
|
| 4751 |
+
if ( this[0] && this[0].parentNode ) {
|
| 4752 |
+
return this.domManip(arguments, false, function( elem ) {
|
| 4753 |
+
this.parentNode.insertBefore( elem, this );
|
| 4754 |
+
});
|
| 4755 |
+
} else if ( arguments.length ) {
|
| 4756 |
+
var set = jQuery(arguments[0]);
|
| 4757 |
+
set.push.apply( set, this.toArray() );
|
| 4758 |
+
return this.pushStack( set, "before", arguments );
|
| 4759 |
+
}
|
| 4760 |
+
},
|
| 4761 |
+
|
| 4762 |
+
after: function() {
|
| 4763 |
+
if ( this[0] && this[0].parentNode ) {
|
| 4764 |
+
return this.domManip(arguments, false, function( elem ) {
|
| 4765 |
+
this.parentNode.insertBefore( elem, this.nextSibling );
|
| 4766 |
+
});
|
| 4767 |
+
} else if ( arguments.length ) {
|
| 4768 |
+
var set = this.pushStack( this, "after", arguments );
|
| 4769 |
+
set.push.apply( set, jQuery(arguments[0]).toArray() );
|
| 4770 |
+
return set;
|
| 4771 |
+
}
|
| 4772 |
+
},
|
| 4773 |
+
|
| 4774 |
+
// keepData is for internal use only--do not document
|
| 4775 |
+
remove: function( selector, keepData ) {
|
| 4776 |
+
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
|
| 4777 |
+
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
|
| 4778 |
+
if ( !keepData && elem.nodeType === 1 ) {
|
| 4779 |
+
jQuery.cleanData( elem.getElementsByTagName("*") );
|
| 4780 |
+
jQuery.cleanData( [ elem ] );
|
| 4781 |
+
}
|
| 4782 |
+
|
| 4783 |
+
if ( elem.parentNode ) {
|
| 4784 |
+
elem.parentNode.removeChild( elem );
|
| 4785 |
+
}
|
| 4786 |
+
}
|
| 4787 |
+
}
|
| 4788 |
+
|
| 4789 |
+
return this;
|
| 4790 |
+
},
|
| 4791 |
+
|
| 4792 |
+
empty: function() {
|
| 4793 |
+
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
|
| 4794 |
+
// Remove element nodes and prevent memory leaks
|
| 4795 |
+
if ( elem.nodeType === 1 ) {
|
| 4796 |
+
jQuery.cleanData( elem.getElementsByTagName("*") );
|
| 4797 |
+
}
|
| 4798 |
+
|
| 4799 |
+
// Remove any remaining nodes
|
| 4800 |
+
while ( elem.firstChild ) {
|
| 4801 |
+
elem.removeChild( elem.firstChild );
|
| 4802 |
+
}
|
| 4803 |
+
}
|
| 4804 |
+
|
| 4805 |
+
return this;
|
| 4806 |
+
},
|
| 4807 |
+
|
| 4808 |
+
clone: function( events ) {
|
| 4809 |
+
// Do the clone
|
| 4810 |
+
var ret = this.map(function() {
|
| 4811 |
+
if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
|
| 4812 |
+
// IE copies events bound via attachEvent when
|
| 4813 |
+
// using cloneNode. Calling detachEvent on the
|
| 4814 |
+
// clone will also remove the events from the orignal
|
| 4815 |
+
// In order to get around this, we use innerHTML.
|
| 4816 |
+
// Unfortunately, this means some modifications to
|
| 4817 |
+
// attributes in IE that are actually only stored
|
| 4818 |
+
// as properties will not be copied (such as the
|
| 4819 |
+
// the name attribute on an input).
|
| 4820 |
+
var html = this.outerHTML,
|
| 4821 |
+
ownerDocument = this.ownerDocument;
|
| 4822 |
+
|
| 4823 |
+
if ( !html ) {
|
| 4824 |
+
var div = ownerDocument.createElement("div");
|
| 4825 |
+
div.appendChild( this.cloneNode(true) );
|
| 4826 |
+
html = div.innerHTML;
|
| 4827 |
+
}
|
| 4828 |
+
|
| 4829 |
+
return jQuery.clean([html.replace(rinlinejQuery, "")
|
| 4830 |
+
// Handle the case in IE 8 where action=/test/> self-closes a tag
|
| 4831 |
+
.replace(raction, '="$1">')
|
| 4832 |
+
.replace(rleadingWhitespace, "")], ownerDocument)[0];
|
| 4833 |
+
} else {
|
| 4834 |
+
return this.cloneNode(true);
|
| 4835 |
+
}
|
| 4836 |
+
});
|
| 4837 |
+
|
| 4838 |
+
// Copy the events from the original to the clone
|
| 4839 |
+
if ( events === true ) {
|
| 4840 |
+
cloneCopyEvent( this, ret );
|
| 4841 |
+
cloneCopyEvent( this.find("*"), ret.find("*") );
|
| 4842 |
+
}
|
| 4843 |
+
|
| 4844 |
+
// Return the cloned set
|
| 4845 |
+
return ret;
|
| 4846 |
+
},
|
| 4847 |
+
|
| 4848 |
+
html: function( value ) {
|
| 4849 |
+
if ( value === undefined ) {
|
| 4850 |
+
return this[0] && this[0].nodeType === 1 ?
|
| 4851 |
+
this[0].innerHTML.replace(rinlinejQuery, "") :
|
| 4852 |
+
null;
|
| 4853 |
+
|
| 4854 |
+
// See if we can take a shortcut and just use innerHTML
|
| 4855 |
+
} else if ( typeof value === "string" && !rnocache.test( value ) &&
|
| 4856 |
+
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
|
| 4857 |
+
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
|
| 4858 |
+
|
| 4859 |
+
value = value.replace(rxhtmlTag, "<$1></$2>");
|
| 4860 |
+
|
| 4861 |
+
try {
|
| 4862 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
| 4863 |
+
// Remove element nodes and prevent memory leaks
|
| 4864 |
+
if ( this[i].nodeType === 1 ) {
|
| 4865 |
+
jQuery.cleanData( this[i].getElementsByTagName("*") );
|
| 4866 |
+
this[i].innerHTML = value;
|
| 4867 |
+
}
|
| 4868 |
+
}
|
| 4869 |
+
|
| 4870 |
+
// If using innerHTML throws an exception, use the fallback method
|
| 4871 |
+
} catch(e) {
|
| 4872 |
+
this.empty().append( value );
|
| 4873 |
+
}
|
| 4874 |
+
|
| 4875 |
+
} else if ( jQuery.isFunction( value ) ) {
|
| 4876 |
+
this.each(function(i){
|
| 4877 |
+
var self = jQuery( this );
|
| 4878 |
+
|
| 4879 |
+
self.html( value.call(this, i, self.html()) );
|
| 4880 |
+
});
|
| 4881 |
+
|
| 4882 |
+
} else {
|
| 4883 |
+
this.empty().append( value );
|
| 4884 |
+
}
|
| 4885 |
+
|
| 4886 |
+
return this;
|
| 4887 |
+
},
|
| 4888 |
+
|
| 4889 |
+
replaceWith: function( value ) {
|
| 4890 |
+
if ( this[0] && this[0].parentNode ) {
|
| 4891 |
+
// Make sure that the elements are removed from the DOM before they are inserted
|
| 4892 |
+
// this can help fix replacing a parent with child elements
|
| 4893 |
+
if ( jQuery.isFunction( value ) ) {
|
| 4894 |
+
return this.each(function(i) {
|
| 4895 |
+
var self = jQuery(this), old = self.html();
|
| 4896 |
+
self.replaceWith( value.call( this, i, old ) );
|
| 4897 |
+
});
|
| 4898 |
+
}
|
| 4899 |
+
|
| 4900 |
+
if ( typeof value !== "string" ) {
|
| 4901 |
+
value = jQuery( value ).detach();
|
| 4902 |
+
}
|
| 4903 |
+
|
| 4904 |
+
return this.each(function() {
|
| 4905 |
+
var next = this.nextSibling,
|
| 4906 |
+
parent = this.parentNode;
|
| 4907 |
+
|
| 4908 |
+
jQuery( this ).remove();
|
| 4909 |
+
|
| 4910 |
+
if ( next ) {
|
| 4911 |
+
jQuery(next).before( value );
|
| 4912 |
+
} else {
|
| 4913 |
+
jQuery(parent).append( value );
|
| 4914 |
+
}
|
| 4915 |
+
});
|
| 4916 |
+
} else {
|
| 4917 |
+
return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
|
| 4918 |
+
}
|
| 4919 |
+
},
|
| 4920 |
+
|
| 4921 |
+
detach: function( selector ) {
|
| 4922 |
+
return this.remove( selector, true );
|
| 4923 |
+
},
|
| 4924 |
+
|
| 4925 |
+
domManip: function( args, table, callback ) {
|
| 4926 |
+
var results, first, fragment, parent,
|
| 4927 |
+
value = args[0],
|
| 4928 |
+
scripts = [];
|
| 4929 |
+
|
| 4930 |
+
// We can't cloneNode fragments that contain checked, in WebKit
|
| 4931 |
+
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
|
| 4932 |
+
return this.each(function() {
|
| 4933 |
+
jQuery(this).domManip( args, table, callback, true );
|
| 4934 |
+
});
|
| 4935 |
+
}
|
| 4936 |
+
|
| 4937 |
+
if ( jQuery.isFunction(value) ) {
|
| 4938 |
+
return this.each(function(i) {
|
| 4939 |
+
var self = jQuery(this);
|
| 4940 |
+
args[0] = value.call(this, i, table ? self.html() : undefined);
|
| 4941 |
+
self.domManip( args, table, callback );
|
| 4942 |
+
});
|
| 4943 |
+
}
|
| 4944 |
+
|
| 4945 |
+
if ( this[0] ) {
|
| 4946 |
+
parent = value && value.parentNode;
|
| 4947 |
+
|
| 4948 |
+
// If we're in a fragment, just use that instead of building a new one
|
| 4949 |
+
if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
|
| 4950 |
+
results = { fragment: parent };
|
| 4951 |
+
|
| 4952 |
+
} else {
|
| 4953 |
+
results = jQuery.buildFragment( args, this, scripts );
|
| 4954 |
+
}
|
| 4955 |
+
|
| 4956 |
+
fragment = results.fragment;
|
| 4957 |
+
|
| 4958 |
+
if ( fragment.childNodes.length === 1 ) {
|
| 4959 |
+
first = fragment = fragment.firstChild;
|
| 4960 |
+
} else {
|
| 4961 |
+
first = fragment.firstChild;
|
| 4962 |
+
}
|
| 4963 |
+
|
| 4964 |
+
if ( first ) {
|
| 4965 |
+
table = table && jQuery.nodeName( first, "tr" );
|
| 4966 |
+
|
| 4967 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
| 4968 |
+
callback.call(
|
| 4969 |
+
table ?
|
| 4970 |
+
root(this[i], first) :
|
| 4971 |
+
this[i],
|
| 4972 |
+
i > 0 || results.cacheable || this.length > 1 ?
|
| 4973 |
+
fragment.cloneNode(true) :
|
| 4974 |
+
fragment
|
| 4975 |
+
);
|
| 4976 |
+
}
|
| 4977 |
+
}
|
| 4978 |
+
|
| 4979 |
+
if ( scripts.length ) {
|
| 4980 |
+
jQuery.each( scripts, evalScript );
|
| 4981 |
+
}
|
| 4982 |
+
}
|
| 4983 |
+
|
| 4984 |
+
return this;
|
| 4985 |
+
}
|
| 4986 |
+
});
|
| 4987 |
+
|
| 4988 |
+
function root( elem, cur ) {
|
| 4989 |
+
return jQuery.nodeName(elem, "table") ?
|
| 4990 |
+
(elem.getElementsByTagName("tbody")[0] ||
|
| 4991 |
+
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
|
| 4992 |
+
elem;
|
| 4993 |
+
}
|
| 4994 |
+
|
| 4995 |
+
function cloneCopyEvent(orig, ret) {
|
| 4996 |
+
var i = 0;
|
| 4997 |
+
|
| 4998 |
+
ret.each(function() {
|
| 4999 |
+
if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
|
| 5000 |
+
return;
|
| 5001 |
+
}
|
| 5002 |
+
|
| 5003 |
+
var oldData = jQuery.data( orig[i++] ),
|
| 5004 |
+
curData = jQuery.data( this, oldData ),
|
| 5005 |
+
events = oldData && oldData.events;
|
| 5006 |
+
|
| 5007 |
+
if ( events ) {
|
| 5008 |
+
delete curData.handle;
|
| 5009 |
+
curData.events = {};
|
| 5010 |
+
|
| 5011 |
+
for ( var type in events ) {
|
| 5012 |
+
for ( var handler in events[ type ] ) {
|
| 5013 |
+
jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
|
| 5014 |
+
}
|
| 5015 |
+
}
|
| 5016 |
+
}
|
| 5017 |
+
});
|
| 5018 |
+
}
|
| 5019 |
+
|
| 5020 |
+
jQuery.buildFragment = function( args, nodes, scripts ) {
|
| 5021 |
+
var fragment, cacheable, cacheresults,
|
| 5022 |
+
doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
|
| 5023 |
+
|
| 5024 |
+
// Only cache "small" (1/2 KB) strings that are associated with the main document
|
| 5025 |
+
// Cloning options loses the selected state, so don't cache them
|
| 5026 |
+
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
|
| 5027 |
+
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
|
| 5028 |
+
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
|
| 5029 |
+
!rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
|
| 5030 |
+
|
| 5031 |
+
cacheable = true;
|
| 5032 |
+
cacheresults = jQuery.fragments[ args[0] ];
|
| 5033 |
+
if ( cacheresults ) {
|
| 5034 |
+
if ( cacheresults !== 1 ) {
|
| 5035 |
+
fragment = cacheresults;
|
| 5036 |
+
}
|
| 5037 |
+
}
|
| 5038 |
+
}
|
| 5039 |
+
|
| 5040 |
+
if ( !fragment ) {
|
| 5041 |
+
fragment = doc.createDocumentFragment();
|
| 5042 |
+
jQuery.clean( args, doc, fragment, scripts );
|
| 5043 |
+
}
|
| 5044 |
+
|
| 5045 |
+
if ( cacheable ) {
|
| 5046 |
+
jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
|
| 5047 |
+
}
|
| 5048 |
+
|
| 5049 |
+
return { fragment: fragment, cacheable: cacheable };
|
| 5050 |
+
};
|
| 5051 |
+
|
| 5052 |
+
jQuery.fragments = {};
|
| 5053 |
+
|
| 5054 |
+
jQuery.each({
|
| 5055 |
+
appendTo: "append",
|
| 5056 |
+
prependTo: "prepend",
|
| 5057 |
+
insertBefore: "before",
|
| 5058 |
+
insertAfter: "after",
|
| 5059 |
+
replaceAll: "replaceWith"
|
| 5060 |
+
}, function( name, original ) {
|
| 5061 |
+
jQuery.fn[ name ] = function( selector ) {
|
| 5062 |
+
var ret = [],
|
| 5063 |
+
insert = jQuery( selector ),
|
| 5064 |
+
parent = this.length === 1 && this[0].parentNode;
|
| 5065 |
+
|
| 5066 |
+
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
|
| 5067 |
+
insert[ original ]( this[0] );
|
| 5068 |
+
return this;
|
| 5069 |
+
|
| 5070 |
+
} else {
|
| 5071 |
+
for ( var i = 0, l = insert.length; i < l; i++ ) {
|
| 5072 |
+
var elems = (i > 0 ? this.clone(true) : this).get();
|
| 5073 |
+
jQuery( insert[i] )[ original ]( elems );
|
| 5074 |
+
ret = ret.concat( elems );
|
| 5075 |
+
}
|
| 5076 |
+
|
| 5077 |
+
return this.pushStack( ret, name, insert.selector );
|
| 5078 |
+
}
|
| 5079 |
+
};
|
| 5080 |
+
});
|
| 5081 |
+
|
| 5082 |
+
jQuery.extend({
|
| 5083 |
+
clean: function( elems, context, fragment, scripts ) {
|
| 5084 |
+
context = context || document;
|
| 5085 |
+
|
| 5086 |
+
// !context.createElement fails in IE with an error but returns typeof 'object'
|
| 5087 |
+
if ( typeof context.createElement === "undefined" ) {
|
| 5088 |
+
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
|
| 5089 |
+
}
|
| 5090 |
+
|
| 5091 |
+
var ret = [];
|
| 5092 |
+
|
| 5093 |
+
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
| 5094 |
+
if ( typeof elem === "number" ) {
|
| 5095 |
+
elem += "";
|
| 5096 |
+
}
|
| 5097 |
+
|
| 5098 |
+
if ( !elem ) {
|
| 5099 |
+
continue;
|
| 5100 |
+
}
|
| 5101 |
+
|
| 5102 |
+
// Convert html string into DOM nodes
|
| 5103 |
+
if ( typeof elem === "string" && !rhtml.test( elem ) ) {
|
| 5104 |
+
elem = context.createTextNode( elem );
|
| 5105 |
+
|
| 5106 |
+
} else if ( typeof elem === "string" ) {
|
| 5107 |
+
// Fix "XHTML"-style tags in all browsers
|
| 5108 |
+
elem = elem.replace(rxhtmlTag, "<$1></$2>");
|
| 5109 |
+
|
| 5110 |
+
// Trim whitespace, otherwise indexOf won't work as expected
|
| 5111 |
+
var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
|
| 5112 |
+
wrap = wrapMap[ tag ] || wrapMap._default,
|
| 5113 |
+
depth = wrap[0],
|
| 5114 |
+
div = context.createElement("div");
|
| 5115 |
+
|
| 5116 |
+
// Go to html and back, then peel off extra wrappers
|
| 5117 |
+
div.innerHTML = wrap[1] + elem + wrap[2];
|
| 5118 |
+
|
| 5119 |
+
// Move to the right depth
|
| 5120 |
+
while ( depth-- ) {
|
| 5121 |
+
div = div.lastChild;
|
| 5122 |
+
}
|
| 5123 |
+
|
| 5124 |
+
// Remove IE's autoinserted <tbody> from table fragments
|
| 5125 |
+
if ( !jQuery.support.tbody ) {
|
| 5126 |
+
|
| 5127 |
+
// String was a <table>, *may* have spurious <tbody>
|
| 5128 |
+
var hasBody = rtbody.test(elem),
|
| 5129 |
+
tbody = tag === "table" && !hasBody ?
|
| 5130 |
+
div.firstChild && div.firstChild.childNodes :
|
| 5131 |
+
|
| 5132 |
+
// String was a bare <thead> or <tfoot>
|
| 5133 |
+
wrap[1] === "<table>" && !hasBody ?
|
| 5134 |
+
div.childNodes :
|
| 5135 |
+
[];
|
| 5136 |
+
|
| 5137 |
+
for ( var j = tbody.length - 1; j >= 0 ; --j ) {
|
| 5138 |
+
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
|
| 5139 |
+
tbody[ j ].parentNode.removeChild( tbody[ j ] );
|
| 5140 |
+
}
|
| 5141 |
+
}
|
| 5142 |
+
|
| 5143 |
+
}
|
| 5144 |
+
|
| 5145 |
+
// IE completely kills leading whitespace when innerHTML is used
|
| 5146 |
+
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
|
| 5147 |
+
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
|
| 5148 |
+
}
|
| 5149 |
+
|
| 5150 |
+
elem = div.childNodes;
|
| 5151 |
+
}
|
| 5152 |
+
|
| 5153 |
+
if ( elem.nodeType ) {
|
| 5154 |
+
ret.push( elem );
|
| 5155 |
+
} else {
|
| 5156 |
+
ret = jQuery.merge( ret, elem );
|
| 5157 |
+
}
|
| 5158 |
+
}
|
| 5159 |
+
|
| 5160 |
+
if ( fragment ) {
|
| 5161 |
+
for ( i = 0; ret[i]; i++ ) {
|
| 5162 |
+
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
|
| 5163 |
+
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
|
| 5164 |
+
|
| 5165 |
+
} else {
|
| 5166 |
+
if ( ret[i].nodeType === 1 ) {
|
| 5167 |
+
ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
|
| 5168 |
+
}
|
| 5169 |
+
fragment.appendChild( ret[i] );
|
| 5170 |
+
}
|
| 5171 |
+
}
|
| 5172 |
+
}
|
| 5173 |
+
|
| 5174 |
+
return ret;
|
| 5175 |
+
},
|
| 5176 |
+
|
| 5177 |
+
cleanData: function( elems ) {
|
| 5178 |
+
var data, id, cache = jQuery.cache,
|
| 5179 |
+
special = jQuery.event.special,
|
| 5180 |
+
deleteExpando = jQuery.support.deleteExpando;
|
| 5181 |
+
|
| 5182 |
+
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
| 5183 |
+
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
|
| 5184 |
+
continue;
|
| 5185 |
+
}
|
| 5186 |
+
|
| 5187 |
+
id = elem[ jQuery.expando ];
|
| 5188 |
+
|
| 5189 |
+
if ( id ) {
|
| 5190 |
+
data = cache[ id ];
|
| 5191 |
+
|
| 5192 |
+
if ( data && data.events ) {
|
| 5193 |
+
for ( var type in data.events ) {
|
| 5194 |
+
if ( special[ type ] ) {
|
| 5195 |
+
jQuery.event.remove( elem, type );
|
| 5196 |
+
|
| 5197 |
+
} else {
|
| 5198 |
+
jQuery.removeEvent( elem, type, data.handle );
|
| 5199 |
+
}
|
| 5200 |
+
}
|
| 5201 |
+
}
|
| 5202 |
+
|
| 5203 |
+
if ( deleteExpando ) {
|
| 5204 |
+
delete elem[ jQuery.expando ];
|
| 5205 |
+
|
| 5206 |
+
} else if ( elem.removeAttribute ) {
|
| 5207 |
+
elem.removeAttribute( jQuery.expando );
|
| 5208 |
+
}
|
| 5209 |
+
|
| 5210 |
+
delete cache[ id ];
|
| 5211 |
+
}
|
| 5212 |
+
}
|
| 5213 |
+
}
|
| 5214 |
+
});
|
| 5215 |
+
|
| 5216 |
+
function evalScript( i, elem ) {
|
| 5217 |
+
if ( elem.src ) {
|
| 5218 |
+
jQuery.ajax({
|
| 5219 |
+
url: elem.src,
|
| 5220 |
+
async: false,
|
| 5221 |
+
dataType: "script"
|
| 5222 |
+
});
|
| 5223 |
+
} else {
|
| 5224 |
+
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
|
| 5225 |
+
}
|
| 5226 |
+
|
| 5227 |
+
if ( elem.parentNode ) {
|
| 5228 |
+
elem.parentNode.removeChild( elem );
|
| 5229 |
+
}
|
| 5230 |
+
}
|
| 5231 |
+
|
| 5232 |
+
|
| 5233 |
+
|
| 5234 |
+
|
| 5235 |
+
var ralpha = /alpha\([^)]*\)/i,
|
| 5236 |
+
ropacity = /opacity=([^)]*)/,
|
| 5237 |
+
rdashAlpha = /-([a-z])/ig,
|
| 5238 |
+
rupper = /([A-Z])/g,
|
| 5239 |
+
rnumpx = /^-?\d+(?:px)?$/i,
|
| 5240 |
+
rnum = /^-?\d/,
|
| 5241 |
+
|
| 5242 |
+
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
|
| 5243 |
+
cssWidth = [ "Left", "Right" ],
|
| 5244 |
+
cssHeight = [ "Top", "Bottom" ],
|
| 5245 |
+
curCSS,
|
| 5246 |
+
|
| 5247 |
+
getComputedStyle,
|
| 5248 |
+
currentStyle,
|
| 5249 |
+
|
| 5250 |
+
fcamelCase = function( all, letter ) {
|
| 5251 |
+
return letter.toUpperCase();
|
| 5252 |
+
};
|
| 5253 |
+
|
| 5254 |
+
jQuery.fn.css = function( name, value ) {
|
| 5255 |
+
// Setting 'undefined' is a no-op
|
| 5256 |
+
if ( arguments.length === 2 && value === undefined ) {
|
| 5257 |
+
return this;
|
| 5258 |
+
}
|
| 5259 |
+
|
| 5260 |
+
return jQuery.access( this, name, value, true, function( elem, name, value ) {
|
| 5261 |
+
return value !== undefined ?
|
| 5262 |
+
jQuery.style( elem, name, value ) :
|
| 5263 |
+
jQuery.css( elem, name );
|
| 5264 |
+
});
|
| 5265 |
+
};
|
| 5266 |
+
|
| 5267 |
+
jQuery.extend({
|
| 5268 |
+
// Add in style property hooks for overriding the default
|
| 5269 |
+
// behavior of getting and setting a style property
|
| 5270 |
+
cssHooks: {
|
| 5271 |
+
opacity: {
|
| 5272 |
+
get: function( elem, computed ) {
|
| 5273 |
+
if ( computed ) {
|
| 5274 |
+
// We should always get a number back from opacity
|
| 5275 |
+
var ret = curCSS( elem, "opacity", "opacity" );
|
| 5276 |
+
return ret === "" ? "1" : ret;
|
| 5277 |
+
|
| 5278 |
+
} else {
|
| 5279 |
+
return elem.style.opacity;
|
| 5280 |
+
}
|
| 5281 |
+
}
|
| 5282 |
+
}
|
| 5283 |
+
},
|
| 5284 |
+
|
| 5285 |
+
// Exclude the following css properties to add px
|
| 5286 |
+
cssNumber: {
|
| 5287 |
+
"zIndex": true,
|
| 5288 |
+
"fontWeight": true,
|
| 5289 |
+
"opacity": true,
|
| 5290 |
+
"zoom": true,
|
| 5291 |
+
"lineHeight": true
|
| 5292 |
+
},
|
| 5293 |
+
|
| 5294 |
+
// Add in properties whose names you wish to fix before
|
| 5295 |
+
// setting or getting the value
|
| 5296 |
+
cssProps: {
|
| 5297 |
+
// normalize float css property
|
| 5298 |
+
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
|
| 5299 |
+
},
|
| 5300 |
+
|
| 5301 |
+
// Get and set the style property on a DOM Node
|
| 5302 |
+
style: function( elem, name, value, extra ) {
|
| 5303 |
+
// Don't set styles on text and comment nodes
|
| 5304 |
+
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
|
| 5305 |
+
return;
|
| 5306 |
+
}
|
| 5307 |
+
|
| 5308 |
+
// Make sure that we're working with the right name
|
| 5309 |
+
var ret, origName = jQuery.camelCase( name ),
|
| 5310 |
+
style = elem.style, hooks = jQuery.cssHooks[ origName ];
|
| 5311 |
+
|
| 5312 |
+
name = jQuery.cssProps[ origName ] || origName;
|
| 5313 |
+
|
| 5314 |
+
// Check if we're setting a value
|
| 5315 |
+
if ( value !== undefined ) {
|
| 5316 |
+
// Make sure that NaN and null values aren't set. See: #7116
|
| 5317 |
+
if ( typeof value === "number" && isNaN( value ) || value == null ) {
|
| 5318 |
+
return;
|
| 5319 |
+
}
|
| 5320 |
+
|
| 5321 |
+
// If a number was passed in, add 'px' to the (except for certain CSS properties)
|
| 5322 |
+
if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
|
| 5323 |
+
value += "px";
|
| 5324 |
+
}
|
| 5325 |
+
|
| 5326 |
+
// If a hook was provided, use that value, otherwise just set the specified value
|
| 5327 |
+
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
|
| 5328 |
+
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
|
| 5329 |
+
// Fixes bug #5509
|
| 5330 |
+
try {
|
| 5331 |
+
style[ name ] = value;
|
| 5332 |
+
} catch(e) {}
|
| 5333 |
+
}
|
| 5334 |
+
|
| 5335 |
+
} else {
|
| 5336 |
+
// If a hook was provided get the non-computed value from there
|
| 5337 |
+
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
|
| 5338 |
+
return ret;
|
| 5339 |
+
}
|
| 5340 |
+
|
| 5341 |
+
// Otherwise just get the value from the style object
|
| 5342 |
+
return style[ name ];
|
| 5343 |
+
}
|
| 5344 |
+
},
|
| 5345 |
+
|
| 5346 |
+
css: function( elem, name, extra ) {
|
| 5347 |
+
// Make sure that we're working with the right name
|
| 5348 |
+
var ret, origName = jQuery.camelCase( name ),
|
| 5349 |
+
hooks = jQuery.cssHooks[ origName ];
|
| 5350 |
+
|
| 5351 |
+
name = jQuery.cssProps[ origName ] || origName;
|
| 5352 |
+
|
| 5353 |
+
// If a hook was provided get the computed value from there
|
| 5354 |
+
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
|
| 5355 |
+
return ret;
|
| 5356 |
+
|
| 5357 |
+
// Otherwise, if a way to get the computed value exists, use that
|
| 5358 |
+
} else if ( curCSS ) {
|
| 5359 |
+
return curCSS( elem, name, origName );
|
| 5360 |
+
}
|
| 5361 |
+
},
|
| 5362 |
+
|
| 5363 |
+
// A method for quickly swapping in/out CSS properties to get correct calculations
|
| 5364 |
+
swap: function( elem, options, callback ) {
|
| 5365 |
+
var old = {};
|
| 5366 |
+
|
| 5367 |
+
// Remember the old values, and insert the new ones
|
| 5368 |
+
for ( var name in options ) {
|
| 5369 |
+
old[ name ] = elem.style[ name ];
|
| 5370 |
+
elem.style[ name ] = options[ name ];
|
| 5371 |
+
}
|
| 5372 |
+
|
| 5373 |
+
callback.call( elem );
|
| 5374 |
+
|
| 5375 |
+
// Revert the old values
|
| 5376 |
+
for ( name in options ) {
|
| 5377 |
+
elem.style[ name ] = old[ name ];
|
| 5378 |
+
}
|
| 5379 |
+
},
|
| 5380 |
+
|
| 5381 |
+
camelCase: function( string ) {
|
| 5382 |
+
return string.replace( rdashAlpha, fcamelCase );
|
| 5383 |
+
}
|
| 5384 |
+
});
|
| 5385 |
+
|
| 5386 |
+
// DEPRECATED, Use jQuery.css() instead
|
| 5387 |
+
jQuery.curCSS = jQuery.css;
|
| 5388 |
+
|
| 5389 |
+
jQuery.each(["height", "width"], function( i, name ) {
|
| 5390 |
+
jQuery.cssHooks[ name ] = {
|
| 5391 |
+
get: function( elem, computed, extra ) {
|
| 5392 |
+
var val;
|
| 5393 |
+
|
| 5394 |
+
if ( computed ) {
|
| 5395 |
+
if ( elem.offsetWidth !== 0 ) {
|
| 5396 |
+
val = getWH( elem, name, extra );
|
| 5397 |
+
|
| 5398 |
+
} else {
|
| 5399 |
+
jQuery.swap( elem, cssShow, function() {
|
| 5400 |
+
val = getWH( elem, name, extra );
|
| 5401 |
+
});
|
| 5402 |
+
}
|
| 5403 |
+
|
| 5404 |
+
if ( val <= 0 ) {
|
| 5405 |
+
val = curCSS( elem, name, name );
|
| 5406 |
+
|
| 5407 |
+
if ( val === "0px" && currentStyle ) {
|
| 5408 |
+
val = currentStyle( elem, name, name );
|
| 5409 |
+
}
|
| 5410 |
+
|
| 5411 |
+
if ( val != null ) {
|
| 5412 |
+
// Should return "auto" instead of 0, use 0 for
|
| 5413 |
+
// temporary backwards-compat
|
| 5414 |
+
return val === "" || val === "auto" ? "0px" : val;
|
| 5415 |
+
}
|
| 5416 |
+
}
|
| 5417 |
+
|
| 5418 |
+
if ( val < 0 || val == null ) {
|
| 5419 |
+
val = elem.style[ name ];
|
| 5420 |
+
|
| 5421 |
+
// Should return "auto" instead of 0, use 0 for
|
| 5422 |
+
// temporary backwards-compat
|
| 5423 |
+
return val === "" || val === "auto" ? "0px" : val;
|
| 5424 |
+
}
|
| 5425 |
+
|
| 5426 |
+
return typeof val === "string" ? val : val + "px";
|
| 5427 |
+
}
|
| 5428 |
+
},
|
| 5429 |
+
|
| 5430 |
+
set: function( elem, value ) {
|
| 5431 |
+
if ( rnumpx.test( value ) ) {
|
| 5432 |
+
// ignore negative width and height values #1599
|
| 5433 |
+
value = parseFloat(value);
|
| 5434 |
+
|
| 5435 |
+
if ( value >= 0 ) {
|
| 5436 |
+
return value + "px";
|
| 5437 |
+
}
|
| 5438 |
+
|
| 5439 |
+
} else {
|
| 5440 |
+
return value;
|
| 5441 |
+
}
|
| 5442 |
+
}
|
| 5443 |
+
};
|
| 5444 |
+
});
|
| 5445 |
+
|
| 5446 |
+
if ( !jQuery.support.opacity ) {
|
| 5447 |
+
jQuery.cssHooks.opacity = {
|
| 5448 |
+
get: function( elem, computed ) {
|
| 5449 |
+
// IE uses filters for opacity
|
| 5450 |
+
return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
|
| 5451 |
+
(parseFloat(RegExp.$1) / 100) + "" :
|
| 5452 |
+
computed ? "1" : "";
|
| 5453 |
+
},
|
| 5454 |
+
|
| 5455 |
+
set: function( elem, value ) {
|
| 5456 |
+
var style = elem.style;
|
| 5457 |
+
|
| 5458 |
+
// IE has trouble with opacity if it does not have layout
|
| 5459 |
+
// Force it by setting the zoom level
|
| 5460 |
+
style.zoom = 1;
|
| 5461 |
+
|
| 5462 |
+
// Set the alpha filter to set the opacity
|
| 5463 |
+
var opacity = jQuery.isNaN(value) ?
|
| 5464 |
+
"" :
|
| 5465 |
+
"alpha(opacity=" + value * 100 + ")",
|
| 5466 |
+
filter = style.filter || "";
|
| 5467 |
+
|
| 5468 |
+
style.filter = ralpha.test(filter) ?
|
| 5469 |
+
filter.replace(ralpha, opacity) :
|
| 5470 |
+
style.filter + ' ' + opacity;
|
| 5471 |
+
}
|
| 5472 |
+
};
|
| 5473 |
+
}
|
| 5474 |
+
|
| 5475 |
+
if ( document.defaultView && document.defaultView.getComputedStyle ) {
|
| 5476 |
+
getComputedStyle = function( elem, newName, name ) {
|
| 5477 |
+
var ret, defaultView, computedStyle;
|
| 5478 |
+
|
| 5479 |
+
name = name.replace( rupper, "-$1" ).toLowerCase();
|
| 5480 |
+
|
| 5481 |
+
if ( !(defaultView = elem.ownerDocument.defaultView) ) {
|
| 5482 |
+
return undefined;
|
| 5483 |
+
}
|
| 5484 |
+
|
| 5485 |
+
if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
|
| 5486 |
+
ret = computedStyle.getPropertyValue( name );
|
| 5487 |
+
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
|
| 5488 |
+
ret = jQuery.style( elem, name );
|
| 5489 |
+
}
|
| 5490 |
+
}
|
| 5491 |
+
|
| 5492 |
+
return ret;
|
| 5493 |
+
};
|
| 5494 |
+
}
|
| 5495 |
+
|
| 5496 |
+
if ( document.documentElement.currentStyle ) {
|
| 5497 |
+
currentStyle = function( elem, name ) {
|
| 5498 |
+
var left, rsLeft,
|
| 5499 |
+
ret = elem.currentStyle && elem.currentStyle[ name ],
|
| 5500 |
+
style = elem.style;
|
| 5501 |
+
|
| 5502 |
+
// From the awesome hack by Dean Edwards
|
| 5503 |
+
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
|
| 5504 |
+
|
| 5505 |
+
// If we're not dealing with a regular pixel number
|
| 5506 |
+
// but a number that has a weird ending, we need to convert it to pixels
|
| 5507 |
+
if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
|
| 5508 |
+
// Remember the original values
|
| 5509 |
+
left = style.left;
|
| 5510 |
+
rsLeft = elem.runtimeStyle.left;
|
| 5511 |
+
|
| 5512 |
+
// Put in the new values to get a computed value out
|
| 5513 |
+
elem.runtimeStyle.left = elem.currentStyle.left;
|
| 5514 |
+
style.left = name === "fontSize" ? "1em" : (ret || 0);
|
| 5515 |
+
ret = style.pixelLeft + "px";
|
| 5516 |
+
|
| 5517 |
+
// Revert the changed values
|
| 5518 |
+
style.left = left;
|
| 5519 |
+
elem.runtimeStyle.left = rsLeft;
|
| 5520 |
+
}
|
| 5521 |
+
|
| 5522 |
+
return ret === "" ? "auto" : ret;
|
| 5523 |
+
};
|
| 5524 |
+
}
|
| 5525 |
+
|
| 5526 |
+
curCSS = getComputedStyle || currentStyle;
|
| 5527 |
+
|
| 5528 |
+
function getWH( elem, name, extra ) {
|
| 5529 |
+
var which = name === "width" ? cssWidth : cssHeight,
|
| 5530 |
+
val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
|
| 5531 |
+
|
| 5532 |
+
if ( extra === "border" ) {
|
| 5533 |
+
return val;
|
| 5534 |
+
}
|
| 5535 |
+
|
| 5536 |
+
jQuery.each( which, function() {
|
| 5537 |
+
if ( !extra ) {
|
| 5538 |
+
val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
|
| 5539 |
+
}
|
| 5540 |
+
|
| 5541 |
+
if ( extra === "margin" ) {
|
| 5542 |
+
val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
|
| 5543 |
+
|
| 5544 |
+
} else {
|
| 5545 |
+
val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
|
| 5546 |
+
}
|
| 5547 |
+
});
|
| 5548 |
+
|
| 5549 |
+
return val;
|
| 5550 |
+
}
|
| 5551 |
+
|
| 5552 |
+
if ( jQuery.expr && jQuery.expr.filters ) {
|
| 5553 |
+
jQuery.expr.filters.hidden = function( elem ) {
|
| 5554 |
+
var width = elem.offsetWidth,
|
| 5555 |
+
height = elem.offsetHeight;
|
| 5556 |
+
|
| 5557 |
+
return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
|
| 5558 |
+
};
|
| 5559 |
+
|
| 5560 |
+
jQuery.expr.filters.visible = function( elem ) {
|
| 5561 |
+
return !jQuery.expr.filters.hidden( elem );
|
| 5562 |
+
};
|
| 5563 |
+
}
|
| 5564 |
+
|
| 5565 |
+
|
| 5566 |
+
|
| 5567 |
+
|
| 5568 |
+
var jsc = jQuery.now(),
|
| 5569 |
+
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
| 5570 |
+
rselectTextarea = /^(?:select|textarea)/i,
|
| 5571 |
+
rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
|
| 5572 |
+
rnoContent = /^(?:GET|HEAD)$/,
|
| 5573 |
+
rbracket = /\[\]$/,
|
| 5574 |
+
jsre = /\=\?(&|$)/,
|
| 5575 |
+
rquery = /\?/,
|
| 5576 |
+
rts = /([?&])_=[^&]*/,
|
| 5577 |
+
rurl = /^(\w+:)?\/\/([^\/?#]+)/,
|
| 5578 |
+
r20 = /%20/g,
|
| 5579 |
+
rhash = /#.*$/,
|
| 5580 |
+
|
| 5581 |
+
// Keep a copy of the old load method
|
| 5582 |
+
_load = jQuery.fn.load;
|
| 5583 |
+
|
| 5584 |
+
jQuery.fn.extend({
|
| 5585 |
+
load: function( url, params, callback ) {
|
| 5586 |
+
if ( typeof url !== "string" && _load ) {
|
| 5587 |
+
return _load.apply( this, arguments );
|
| 5588 |
+
|
| 5589 |
+
// Don't do a request if no elements are being requested
|
| 5590 |
+
} else if ( !this.length ) {
|
| 5591 |
+
return this;
|
| 5592 |
+
}
|
| 5593 |
+
|
| 5594 |
+
var off = url.indexOf(" ");
|
| 5595 |
+
if ( off >= 0 ) {
|
| 5596 |
+
var selector = url.slice(off, url.length);
|
| 5597 |
+
url = url.slice(0, off);
|
| 5598 |
+
}
|
| 5599 |
+
|
| 5600 |
+
// Default to a GET request
|
| 5601 |
+
var type = "GET";
|
| 5602 |
+
|
| 5603 |
+
// If the second parameter was provided
|
| 5604 |
+
if ( params ) {
|
| 5605 |
+
// If it's a function
|
| 5606 |
+
if ( jQuery.isFunction( params ) ) {
|
| 5607 |
+
// We assume that it's the callback
|
| 5608 |
+
callback = params;
|
| 5609 |
+
params = null;
|
| 5610 |
+
|
| 5611 |
+
// Otherwise, build a param string
|
| 5612 |
+
} else if ( typeof params === "object" ) {
|
| 5613 |
+
params = jQuery.param( params, jQuery.ajaxSettings.traditional );
|
| 5614 |
+
type = "POST";
|
| 5615 |
+
}
|
| 5616 |
+
}
|
| 5617 |
+
|
| 5618 |
+
var self = this;
|
| 5619 |
+
|
| 5620 |
+
// Request the remote document
|
| 5621 |
+
jQuery.ajax({
|
| 5622 |
+
url: url,
|
| 5623 |
+
type: type,
|
| 5624 |
+
dataType: "html",
|
| 5625 |
+
data: params,
|
| 5626 |
+
complete: function( res, status ) {
|
| 5627 |
+
// If successful, inject the HTML into all the matched elements
|
| 5628 |
+
if ( status === "success" || status === "notmodified" ) {
|
| 5629 |
+
// See if a selector was specified
|
| 5630 |
+
self.html( selector ?
|
| 5631 |
+
// Create a dummy div to hold the results
|
| 5632 |
+
jQuery("<div>")
|
| 5633 |
+
// inject the contents of the document in, removing the scripts
|
| 5634 |
+
// to avoid any 'Permission Denied' errors in IE
|
| 5635 |
+
.append(res.responseText.replace(rscript, ""))
|
| 5636 |
+
|
| 5637 |
+
// Locate the specified elements
|
| 5638 |
+
.find(selector) :
|
| 5639 |
+
|
| 5640 |
+
// If not, just inject the full result
|
| 5641 |
+
res.responseText );
|
| 5642 |
+
}
|
| 5643 |
+
|
| 5644 |
+
if ( callback ) {
|
| 5645 |
+
self.each( callback, [res.responseText, status, res] );
|
| 5646 |
+
}
|
| 5647 |
+
}
|
| 5648 |
+
});
|
| 5649 |
+
|
| 5650 |
+
return this;
|
| 5651 |
+
},
|
| 5652 |
+
|
| 5653 |
+
serialize: function() {
|
| 5654 |
+
return jQuery.param(this.serializeArray());
|
| 5655 |
+
},
|
| 5656 |
+
|
| 5657 |
+
serializeArray: function() {
|
| 5658 |
+
return this.map(function() {
|
| 5659 |
+
return this.elements ? jQuery.makeArray(this.elements) : this;
|
| 5660 |
+
})
|
| 5661 |
+
.filter(function() {
|
| 5662 |
+
return this.name && !this.disabled &&
|
| 5663 |
+
(this.checked || rselectTextarea.test(this.nodeName) ||
|
| 5664 |
+
rinput.test(this.type));
|
| 5665 |
+
})
|
| 5666 |
+
.map(function( i, elem ) {
|
| 5667 |
+
var val = jQuery(this).val();
|
| 5668 |
+
|
| 5669 |
+
return val == null ?
|
| 5670 |
+
null :
|
| 5671 |
+
jQuery.isArray(val) ?
|
| 5672 |
+
jQuery.map( val, function( val, i ) {
|
| 5673 |
+
return { name: elem.name, value: val };
|
| 5674 |
+
}) :
|
| 5675 |
+
{ name: elem.name, value: val };
|
| 5676 |
+
}).get();
|
| 5677 |
+
}
|
| 5678 |
+
});
|
| 5679 |
+
|
| 5680 |
+
// Attach a bunch of functions for handling common AJAX events
|
| 5681 |
+
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
|
| 5682 |
+
jQuery.fn[o] = function( f ) {
|
| 5683 |
+
return this.bind(o, f);
|
| 5684 |
+
};
|
| 5685 |
+
});
|
| 5686 |
+
|
| 5687 |
+
jQuery.extend({
|
| 5688 |
+
get: function( url, data, callback, type ) {
|
| 5689 |
+
// shift arguments if data argument was omited
|
| 5690 |
+
if ( jQuery.isFunction( data ) ) {
|
| 5691 |
+
type = type || callback;
|
| 5692 |
+
callback = data;
|
| 5693 |
+
data = null;
|
| 5694 |
+
}
|
| 5695 |
+
|
| 5696 |
+
return jQuery.ajax({
|
| 5697 |
+
type: "GET",
|
| 5698 |
+
url: url,
|
| 5699 |
+
data: data,
|
| 5700 |
+
success: callback,
|
| 5701 |
+
dataType: type
|
| 5702 |
+
});
|
| 5703 |
+
},
|
| 5704 |
+
|
| 5705 |
+
getScript: function( url, callback ) {
|
| 5706 |
+
return jQuery.get(url, null, callback, "script");
|
| 5707 |
+
},
|
| 5708 |
+
|
| 5709 |
+
getJSON: function( url, data, callback ) {
|
| 5710 |
+
return jQuery.get(url, data, callback, "json");
|
| 5711 |
+
},
|
| 5712 |
+
|
| 5713 |
+
post: function( url, data, callback, type ) {
|
| 5714 |
+
// shift arguments if data argument was omited
|
| 5715 |
+
if ( jQuery.isFunction( data ) ) {
|
| 5716 |
+
type = type || callback;
|
| 5717 |
+
callback = data;
|
| 5718 |
+
data = {};
|
| 5719 |
+
}
|
| 5720 |
+
|
| 5721 |
+
return jQuery.ajax({
|
| 5722 |
+
type: "POST",
|
| 5723 |
+
url: url,
|
| 5724 |
+
data: data,
|
| 5725 |
+
success: callback,
|
| 5726 |
+
dataType: type
|
| 5727 |
+
});
|
| 5728 |
+
},
|
| 5729 |
+
|
| 5730 |
+
ajaxSetup: function( settings ) {
|
| 5731 |
+
jQuery.extend( jQuery.ajaxSettings, settings );
|
| 5732 |
+
},
|
| 5733 |
+
|
| 5734 |
+
ajaxSettings: {
|
| 5735 |
+
url: location.href,
|
| 5736 |
+
global: true,
|
| 5737 |
+
type: "GET",
|
| 5738 |
+
contentType: "application/x-www-form-urlencoded",
|
| 5739 |
+
processData: true,
|
| 5740 |
+
async: true,
|
| 5741 |
+
/*
|
| 5742 |
+
timeout: 0,
|
| 5743 |
+
data: null,
|
| 5744 |
+
username: null,
|
| 5745 |
+
password: null,
|
| 5746 |
+
traditional: false,
|
| 5747 |
+
*/
|
| 5748 |
+
// This function can be overriden by calling jQuery.ajaxSetup
|
| 5749 |
+
xhr: function() {
|
| 5750 |
+
return new window.XMLHttpRequest();
|
| 5751 |
+
},
|
| 5752 |
+
accepts: {
|
| 5753 |
+
xml: "application/xml, text/xml",
|
| 5754 |
+
html: "text/html",
|
| 5755 |
+
script: "text/javascript, application/javascript",
|
| 5756 |
+
json: "application/json, text/javascript",
|
| 5757 |
+
text: "text/plain",
|
| 5758 |
+
_default: "*/*"
|
| 5759 |
+
}
|
| 5760 |
+
},
|
| 5761 |
+
|
| 5762 |
+
ajax: function( origSettings ) {
|
| 5763 |
+
var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
|
| 5764 |
+
jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
|
| 5765 |
+
|
| 5766 |
+
s.url = s.url.replace( rhash, "" );
|
| 5767 |
+
|
| 5768 |
+
// Use original (not extended) context object if it was provided
|
| 5769 |
+
s.context = origSettings && origSettings.context != null ? origSettings.context : s;
|
| 5770 |
+
|
| 5771 |
+
// convert data if not already a string
|
| 5772 |
+
if ( s.data && s.processData && typeof s.data !== "string" ) {
|
| 5773 |
+
s.data = jQuery.param( s.data, s.traditional );
|
| 5774 |
+
}
|
| 5775 |
+
|
| 5776 |
+
// Handle JSONP Parameter Callbacks
|
| 5777 |
+
if ( s.dataType === "jsonp" ) {
|
| 5778 |
+
if ( type === "GET" ) {
|
| 5779 |
+
if ( !jsre.test( s.url ) ) {
|
| 5780 |
+
s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
|
| 5781 |
+
}
|
| 5782 |
+
} else if ( !s.data || !jsre.test(s.data) ) {
|
| 5783 |
+
s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
|
| 5784 |
+
}
|
| 5785 |
+
s.dataType = "json";
|
| 5786 |
+
}
|
| 5787 |
+
|
| 5788 |
+
// Build temporary JSONP function
|
| 5789 |
+
if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
|
| 5790 |
+
jsonp = s.jsonpCallback || ("jsonp" + jsc++);
|
| 5791 |
+
|
| 5792 |
+
// Replace the =? sequence both in the query string and the data
|
| 5793 |
+
if ( s.data ) {
|
| 5794 |
+
s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
|
| 5795 |
+
}
|
| 5796 |
+
|
| 5797 |
+
s.url = s.url.replace(jsre, "=" + jsonp + "$1");
|
| 5798 |
+
|
| 5799 |
+
// We need to make sure
|
| 5800 |
+
// that a JSONP style response is executed properly
|
| 5801 |
+
s.dataType = "script";
|
| 5802 |
+
|
| 5803 |
+
// Handle JSONP-style loading
|
| 5804 |
+
var customJsonp = window[ jsonp ];
|
| 5805 |
+
|
| 5806 |
+
window[ jsonp ] = function( tmp ) {
|
| 5807 |
+
if ( jQuery.isFunction( customJsonp ) ) {
|
| 5808 |
+
customJsonp( tmp );
|
| 5809 |
+
|
| 5810 |
+
} else {
|
| 5811 |
+
// Garbage collect
|
| 5812 |
+
window[ jsonp ] = undefined;
|
| 5813 |
+
|
| 5814 |
+
try {
|
| 5815 |
+
delete window[ jsonp ];
|
| 5816 |
+
} catch( jsonpError ) {}
|
| 5817 |
+
}
|
| 5818 |
+
|
| 5819 |
+
data = tmp;
|
| 5820 |
+
jQuery.handleSuccess( s, xhr, status, data );
|
| 5821 |
+
jQuery.handleComplete( s, xhr, status, data );
|
| 5822 |
+
|
| 5823 |
+
if ( head ) {
|
| 5824 |
+
head.removeChild( script );
|
| 5825 |
+
}
|
| 5826 |
+
};
|
| 5827 |
+
}
|
| 5828 |
+
|
| 5829 |
+
if ( s.dataType === "script" && s.cache === null ) {
|
| 5830 |
+
s.cache = false;
|
| 5831 |
+
}
|
| 5832 |
+
|
| 5833 |
+
if ( s.cache === false && noContent ) {
|
| 5834 |
+
var ts = jQuery.now();
|
| 5835 |
+
|
| 5836 |
+
// try replacing _= if it is there
|
| 5837 |
+
var ret = s.url.replace(rts, "$1_=" + ts);
|
| 5838 |
+
|
| 5839 |
+
// if nothing was replaced, add timestamp to the end
|
| 5840 |
+
s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
|
| 5841 |
+
}
|
| 5842 |
+
|
| 5843 |
+
// If data is available, append data to url for GET/HEAD requests
|
| 5844 |
+
if ( s.data && noContent ) {
|
| 5845 |
+
s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
|
| 5846 |
+
}
|
| 5847 |
+
|
| 5848 |
+
// Watch for a new set of requests
|
| 5849 |
+
if ( s.global && jQuery.active++ === 0 ) {
|
| 5850 |
+
jQuery.event.trigger( "ajaxStart" );
|
| 5851 |
+
}
|
| 5852 |
+
|
| 5853 |
+
// Matches an absolute URL, and saves the domain
|
| 5854 |
+
var parts = rurl.exec( s.url ),
|
| 5855 |
+
remote = parts && (parts[1] && parts[1].toLowerCase() !== location.protocol || parts[2].toLowerCase() !== location.host);
|
| 5856 |
+
|
| 5857 |
+
// If we're requesting a remote document
|
| 5858 |
+
// and trying to load JSON or Script with a GET
|
| 5859 |
+
if ( s.dataType === "script" && type === "GET" && remote ) {
|
| 5860 |
+
var head = document.getElementsByTagName("head")[0] || document.documentElement;
|
| 5861 |
+
var script = document.createElement("script");
|
| 5862 |
+
if ( s.scriptCharset ) {
|
| 5863 |
+
script.charset = s.scriptCharset;
|
| 5864 |
+
}
|
| 5865 |
+
script.src = s.url;
|
| 5866 |
+
|
| 5867 |
+
// Handle Script loading
|
| 5868 |
+
if ( !jsonp ) {
|
| 5869 |
+
var done = false;
|
| 5870 |
+
|
| 5871 |
+
// Attach handlers for all browsers
|
| 5872 |
+
script.onload = script.onreadystatechange = function() {
|
| 5873 |
+
if ( !done && (!this.readyState ||
|
| 5874 |
+
this.readyState === "loaded" || this.readyState === "complete") ) {
|
| 5875 |
+
done = true;
|
| 5876 |
+
jQuery.handleSuccess( s, xhr, status, data );
|
| 5877 |
+
jQuery.handleComplete( s, xhr, status, data );
|
| 5878 |
+
|
| 5879 |
+
// Handle memory leak in IE
|
| 5880 |
+
script.onload = script.onreadystatechange = null;
|
| 5881 |
+
if ( head && script.parentNode ) {
|
| 5882 |
+
head.removeChild( script );
|
| 5883 |
+
}
|
| 5884 |
+
}
|
| 5885 |
+
};
|
| 5886 |
+
}
|
| 5887 |
+
|
| 5888 |
+
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
|
| 5889 |
+
// This arises when a base node is used (#2709 and #4378).
|
| 5890 |
+
head.insertBefore( script, head.firstChild );
|
| 5891 |
+
|
| 5892 |
+
// We handle everything using the script element injection
|
| 5893 |
+
return undefined;
|
| 5894 |
+
}
|
| 5895 |
+
|
| 5896 |
+
var requestDone = false;
|
| 5897 |
+
|
| 5898 |
+
// Create the request object
|
| 5899 |
+
var xhr = s.xhr();
|
| 5900 |
+
|
| 5901 |
+
if ( !xhr ) {
|
| 5902 |
+
return;
|
| 5903 |
+
}
|
| 5904 |
+
|
| 5905 |
+
// Open the socket
|
| 5906 |
+
// Passing null username, generates a login popup on Opera (#2865)
|
| 5907 |
+
if ( s.username ) {
|
| 5908 |
+
xhr.open(type, s.url, s.async, s.username, s.password);
|
| 5909 |
+
} else {
|
| 5910 |
+
xhr.open(type, s.url, s.async);
|
| 5911 |
+
}
|
| 5912 |
+
|
| 5913 |
+
// Need an extra try/catch for cross domain requests in Firefox 3
|
| 5914 |
+
try {
|
| 5915 |
+
// Set content-type if data specified and content-body is valid for this type
|
| 5916 |
+
if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
|
| 5917 |
+
xhr.setRequestHeader("Content-Type", s.contentType);
|
| 5918 |
+
}
|
| 5919 |
+
|
| 5920 |
+
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
| 5921 |
+
if ( s.ifModified ) {
|
| 5922 |
+
if ( jQuery.lastModified[s.url] ) {
|
| 5923 |
+
xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
|
| 5924 |
+
}
|
| 5925 |
+
|
| 5926 |
+
if ( jQuery.etag[s.url] ) {
|
| 5927 |
+
xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
|
| 5928 |
+
}
|
| 5929 |
+
}
|
| 5930 |
+
|
| 5931 |
+
// Set header so the called script knows that it's an XMLHttpRequest
|
| 5932 |
+
// Only send the header if it's not a remote XHR
|
| 5933 |
+
if ( !remote ) {
|
| 5934 |
+
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
| 5935 |
+
}
|
| 5936 |
+
|
| 5937 |
+
// Set the Accepts header for the server, depending on the dataType
|
| 5938 |
+
xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
|
| 5939 |
+
s.accepts[ s.dataType ] + ", */*; q=0.01" :
|
| 5940 |
+
s.accepts._default );
|
| 5941 |
+
} catch( headerError ) {}
|
| 5942 |
+
|
| 5943 |
+
// Allow custom headers/mimetypes and early abort
|
| 5944 |
+
if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
|
| 5945 |
+
// Handle the global AJAX counter
|
| 5946 |
+
if ( s.global && jQuery.active-- === 1 ) {
|
| 5947 |
+
jQuery.event.trigger( "ajaxStop" );
|
| 5948 |
+
}
|
| 5949 |
+
|
| 5950 |
+
// close opended socket
|
| 5951 |
+
xhr.abort();
|
| 5952 |
+
return false;
|
| 5953 |
+
}
|
| 5954 |
+
|
| 5955 |
+
if ( s.global ) {
|
| 5956 |
+
jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
|
| 5957 |
+
}
|
| 5958 |
+
|
| 5959 |
+
// Wait for a response to come back
|
| 5960 |
+
var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
|
| 5961 |
+
// The request was aborted
|
| 5962 |
+
if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
|
| 5963 |
+
// Opera doesn't call onreadystatechange before this point
|
| 5964 |
+
// so we simulate the call
|
| 5965 |
+
if ( !requestDone ) {
|
| 5966 |
+
jQuery.handleComplete( s, xhr, status, data );
|
| 5967 |
+
}
|
| 5968 |
+
|
| 5969 |
+
requestDone = true;
|
| 5970 |
+
if ( xhr ) {
|
| 5971 |
+
xhr.onreadystatechange = jQuery.noop;
|
| 5972 |
+
}
|
| 5973 |
+
|
| 5974 |
+
// The transfer is complete and the data is available, or the request timed out
|
| 5975 |
+
} else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
|
| 5976 |
+
requestDone = true;
|
| 5977 |
+
xhr.onreadystatechange = jQuery.noop;
|
| 5978 |
+
|
| 5979 |
+
status = isTimeout === "timeout" ?
|
| 5980 |
+
"timeout" :
|
| 5981 |
+
!jQuery.httpSuccess( xhr ) ?
|
| 5982 |
+
"error" :
|
| 5983 |
+
s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
|
| 5984 |
+
"notmodified" :
|
| 5985 |
+
"success";
|
| 5986 |
+
|
| 5987 |
+
var errMsg;
|
| 5988 |
+
|
| 5989 |
+
if ( status === "success" ) {
|
| 5990 |
+
// Watch for, and catch, XML document parse errors
|
| 5991 |
+
try {
|
| 5992 |
+
// process the data (runs the xml through httpData regardless of callback)
|
| 5993 |
+
data = jQuery.httpData( xhr, s.dataType, s );
|
| 5994 |
+
} catch( parserError ) {
|
| 5995 |
+
status = "parsererror";
|
| 5996 |
+
errMsg = parserError;
|
| 5997 |
+
}
|
| 5998 |
+
}
|
| 5999 |
+
|
| 6000 |
+
// Make sure that the request was successful or notmodified
|
| 6001 |
+
if ( status === "success" || status === "notmodified" ) {
|
| 6002 |
+
// JSONP handles its own success callback
|
| 6003 |
+
if ( !jsonp ) {
|
| 6004 |
+
jQuery.handleSuccess( s, xhr, status, data );
|
| 6005 |
+
}
|
| 6006 |
+
} else {
|
| 6007 |
+
jQuery.handleError( s, xhr, status, errMsg );
|
| 6008 |
+
}
|
| 6009 |
+
|
| 6010 |
+
// Fire the complete handlers
|
| 6011 |
+
if ( !jsonp ) {
|
| 6012 |
+
jQuery.handleComplete( s, xhr, status, data );
|
| 6013 |
+
}
|
| 6014 |
+
|
| 6015 |
+
if ( isTimeout === "timeout" ) {
|
| 6016 |
+
xhr.abort();
|
| 6017 |
+
}
|
| 6018 |
+
|
| 6019 |
+
// Stop memory leaks
|
| 6020 |
+
if ( s.async ) {
|
| 6021 |
+
xhr = null;
|
| 6022 |
+
}
|
| 6023 |
+
}
|
| 6024 |
+
};
|
| 6025 |
+
|
| 6026 |
+
// Override the abort handler, if we can (IE 6 doesn't allow it, but that's OK)
|
| 6027 |
+
// Opera doesn't fire onreadystatechange at all on abort
|
| 6028 |
+
try {
|
| 6029 |
+
var oldAbort = xhr.abort;
|
| 6030 |
+
xhr.abort = function() {
|
| 6031 |
+
if ( xhr ) {
|
| 6032 |
+
// oldAbort has no call property in IE7 so
|
| 6033 |
+
// just do it this way, which works in all
|
| 6034 |
+
// browsers
|
| 6035 |
+
Function.prototype.call.call( oldAbort, xhr );
|
| 6036 |
+
}
|
| 6037 |
+
|
| 6038 |
+
onreadystatechange( "abort" );
|
| 6039 |
+
};
|
| 6040 |
+
} catch( abortError ) {}
|
| 6041 |
+
|
| 6042 |
+
// Timeout checker
|
| 6043 |
+
if ( s.async && s.timeout > 0 ) {
|
| 6044 |
+
setTimeout(function() {
|
| 6045 |
+
// Check to see if the request is still happening
|
| 6046 |
+
if ( xhr && !requestDone ) {
|
| 6047 |
+
onreadystatechange( "timeout" );
|
| 6048 |
+
}
|
| 6049 |
+
}, s.timeout);
|
| 6050 |
+
}
|
| 6051 |
+
|
| 6052 |
+
// Send the data
|
| 6053 |
+
try {
|
| 6054 |
+
xhr.send( noContent || s.data == null ? null : s.data );
|
| 6055 |
+
|
| 6056 |
+
} catch( sendError ) {
|
| 6057 |
+
jQuery.handleError( s, xhr, null, sendError );
|
| 6058 |
+
|
| 6059 |
+
// Fire the complete handlers
|
| 6060 |
+
jQuery.handleComplete( s, xhr, status, data );
|
| 6061 |
+
}
|
| 6062 |
+
|
| 6063 |
+
// firefox 1.5 doesn't fire statechange for sync requests
|
| 6064 |
+
if ( !s.async ) {
|
| 6065 |
+
onreadystatechange();
|
| 6066 |
+
}
|
| 6067 |
+
|
| 6068 |
+
// return XMLHttpRequest to allow aborting the request etc.
|
| 6069 |
+
return xhr;
|
| 6070 |
+
},
|
| 6071 |
+
|
| 6072 |
+
// Serialize an array of form elements or a set of
|
| 6073 |
+
// key/values into a query string
|
| 6074 |
+
param: function( a, traditional ) {
|
| 6075 |
+
var s = [],
|
| 6076 |
+
add = function( key, value ) {
|
| 6077 |
+
// If value is a function, invoke it and return its value
|
| 6078 |
+
value = jQuery.isFunction(value) ? value() : value;
|
| 6079 |
+
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
|
| 6080 |
+
};
|
| 6081 |
+
|
| 6082 |
+
// Set traditional to true for jQuery <= 1.3.2 behavior.
|
| 6083 |
+
if ( traditional === undefined ) {
|
| 6084 |
+
traditional = jQuery.ajaxSettings.traditional;
|
| 6085 |
+
}
|
| 6086 |
+
|
| 6087 |
+
// If an array was passed in, assume that it is an array of form elements.
|
| 6088 |
+
if ( jQuery.isArray(a) || a.jquery ) {
|
| 6089 |
+
// Serialize the form elements
|
| 6090 |
+
jQuery.each( a, function() {
|
| 6091 |
+
add( this.name, this.value );
|
| 6092 |
+
});
|
| 6093 |
+
|
| 6094 |
+
} else {
|
| 6095 |
+
// If traditional, encode the "old" way (the way 1.3.2 or older
|
| 6096 |
+
// did it), otherwise encode params recursively.
|
| 6097 |
+
for ( var prefix in a ) {
|
| 6098 |
+
buildParams( prefix, a[prefix], traditional, add );
|
| 6099 |
+
}
|
| 6100 |
+
}
|
| 6101 |
+
|
| 6102 |
+
// Return the resulting serialization
|
| 6103 |
+
return s.join("&").replace(r20, "+");
|
| 6104 |
+
}
|
| 6105 |
+
});
|
| 6106 |
+
|
| 6107 |
+
function buildParams( prefix, obj, traditional, add ) {
|
| 6108 |
+
if ( jQuery.isArray(obj) && obj.length ) {
|
| 6109 |
+
// Serialize array item.
|
| 6110 |
+
jQuery.each( obj, function( i, v ) {
|
| 6111 |
+
if ( traditional || rbracket.test( prefix ) ) {
|
| 6112 |
+
// Treat each array item as a scalar.
|
| 6113 |
+
add( prefix, v );
|
| 6114 |
+
|
| 6115 |
+
} else {
|
| 6116 |
+
// If array item is non-scalar (array or object), encode its
|
| 6117 |
+
// numeric index to resolve deserialization ambiguity issues.
|
| 6118 |
+
// Note that rack (as of 1.0.0) can't currently deserialize
|
| 6119 |
+
// nested arrays properly, and attempting to do so may cause
|
| 6120 |
+
// a server error. Possible fixes are to modify rack's
|
| 6121 |
+
// deserialization algorithm or to provide an option or flag
|
| 6122 |
+
// to force array serialization to be shallow.
|
| 6123 |
+
buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
|
| 6124 |
+
}
|
| 6125 |
+
});
|
| 6126 |
+
|
| 6127 |
+
} else if ( !traditional && obj != null && typeof obj === "object" ) {
|
| 6128 |
+
if ( jQuery.isEmptyObject( obj ) ) {
|
| 6129 |
+
add( prefix, "" );
|
| 6130 |
+
|
| 6131 |
+
// Serialize object item.
|
| 6132 |
+
} else {
|
| 6133 |
+
jQuery.each( obj, function( k, v ) {
|
| 6134 |
+
buildParams( prefix + "[" + k + "]", v, traditional, add );
|
| 6135 |
+
});
|
| 6136 |
+
}
|
| 6137 |
+
|
| 6138 |
+
} else {
|
| 6139 |
+
// Serialize scalar item.
|
| 6140 |
+
add( prefix, obj );
|
| 6141 |
+
}
|
| 6142 |
+
}
|
| 6143 |
+
|
| 6144 |
+
// This is still on the jQuery object... for now
|
| 6145 |
+
// Want to move this to jQuery.ajax some day
|
| 6146 |
+
jQuery.extend({
|
| 6147 |
+
|
| 6148 |
+
// Counter for holding the number of active queries
|
| 6149 |
+
active: 0,
|
| 6150 |
+
|
| 6151 |
+
// Last-Modified header cache for next request
|
| 6152 |
+
lastModified: {},
|
| 6153 |
+
etag: {},
|
| 6154 |
+
|
| 6155 |
+
handleError: function( s, xhr, status, e ) {
|
| 6156 |
+
// If a local callback was specified, fire it
|
| 6157 |
+
if ( s.error ) {
|
| 6158 |
+
s.error.call( s.context, xhr, status, e );
|
| 6159 |
+
}
|
| 6160 |
+
|
| 6161 |
+
// Fire the global callback
|
| 6162 |
+
if ( s.global ) {
|
| 6163 |
+
jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
|
| 6164 |
+
}
|
| 6165 |
+
},
|
| 6166 |
+
|
| 6167 |
+
handleSuccess: function( s, xhr, status, data ) {
|
| 6168 |
+
// If a local callback was specified, fire it and pass it the data
|
| 6169 |
+
if ( s.success ) {
|
| 6170 |
+
s.success.call( s.context, data, status, xhr );
|
| 6171 |
+
}
|
| 6172 |
+
|
| 6173 |
+
// Fire the global callback
|
| 6174 |
+
if ( s.global ) {
|
| 6175 |
+
jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
|
| 6176 |
+
}
|
| 6177 |
+
},
|
| 6178 |
+
|
| 6179 |
+
handleComplete: function( s, xhr, status ) {
|
| 6180 |
+
// Process result
|
| 6181 |
+
if ( s.complete ) {
|
| 6182 |
+
s.complete.call( s.context, xhr, status );
|
| 6183 |
+
}
|
| 6184 |
+
|
| 6185 |
+
// The request was completed
|
| 6186 |
+
if ( s.global ) {
|
| 6187 |
+
jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
|
| 6188 |
+
}
|
| 6189 |
+
|
| 6190 |
+
// Handle the global AJAX counter
|
| 6191 |
+
if ( s.global && jQuery.active-- === 1 ) {
|
| 6192 |
+
jQuery.event.trigger( "ajaxStop" );
|
| 6193 |
+
}
|
| 6194 |
+
},
|
| 6195 |
+
|
| 6196 |
+
triggerGlobal: function( s, type, args ) {
|
| 6197 |
+
(s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
|
| 6198 |
+
},
|
| 6199 |
+
|
| 6200 |
+
// Determines if an XMLHttpRequest was successful or not
|
| 6201 |
+
httpSuccess: function( xhr ) {
|
| 6202 |
+
try {
|
| 6203 |
+
// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
|
| 6204 |
+
return !xhr.status && location.protocol === "file:" ||
|
| 6205 |
+
xhr.status >= 200 && xhr.status < 300 ||
|
| 6206 |
+
xhr.status === 304 || xhr.status === 1223;
|
| 6207 |
+
} catch(e) {}
|
| 6208 |
+
|
| 6209 |
+
return false;
|
| 6210 |
+
},
|
| 6211 |
+
|
| 6212 |
+
// Determines if an XMLHttpRequest returns NotModified
|
| 6213 |
+
httpNotModified: function( xhr, url ) {
|
| 6214 |
+
var lastModified = xhr.getResponseHeader("Last-Modified"),
|
| 6215 |
+
etag = xhr.getResponseHeader("Etag");
|
| 6216 |
+
|
| 6217 |
+
if ( lastModified ) {
|
| 6218 |
+
jQuery.lastModified[url] = lastModified;
|
| 6219 |
+
}
|
| 6220 |
+
|
| 6221 |
+
if ( etag ) {
|
| 6222 |
+
jQuery.etag[url] = etag;
|
| 6223 |
+
}
|
| 6224 |
+
|
| 6225 |
+
return xhr.status === 304;
|
| 6226 |
+
},
|
| 6227 |
+
|
| 6228 |
+
httpData: function( xhr, type, s ) {
|
| 6229 |
+
var ct = xhr.getResponseHeader("content-type") || "",
|
| 6230 |
+
xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
|
| 6231 |
+
data = xml ? xhr.responseXML : xhr.responseText;
|
| 6232 |
+
|
| 6233 |
+
if ( xml && data.documentElement.nodeName === "parsererror" ) {
|
| 6234 |
+
jQuery.error( "parsererror" );
|
| 6235 |
+
}
|
| 6236 |
+
|
| 6237 |
+
// Allow a pre-filtering function to sanitize the response
|
| 6238 |
+
// s is checked to keep backwards compatibility
|
| 6239 |
+
if ( s && s.dataFilter ) {
|
| 6240 |
+
data = s.dataFilter( data, type );
|
| 6241 |
+
}
|
| 6242 |
+
|
| 6243 |
+
// The filter can actually parse the response
|
| 6244 |
+
if ( typeof data === "string" ) {
|
| 6245 |
+
// Get the JavaScript object, if JSON is used.
|
| 6246 |
+
if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
|
| 6247 |
+
data = jQuery.parseJSON( data );
|
| 6248 |
+
|
| 6249 |
+
// If the type is "script", eval it in global context
|
| 6250 |
+
} else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
|
| 6251 |
+
jQuery.globalEval( data );
|
| 6252 |
+
}
|
| 6253 |
+
}
|
| 6254 |
+
|
| 6255 |
+
return data;
|
| 6256 |
+
}
|
| 6257 |
+
|
| 6258 |
+
});
|
| 6259 |
+
|
| 6260 |
+
/*
|
| 6261 |
+
* Create the request object; Microsoft failed to properly
|
| 6262 |
+
* implement the XMLHttpRequest in IE7 (can't request local files),
|
| 6263 |
+
* so we use the ActiveXObject when it is available
|
| 6264 |
+
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
|
| 6265 |
+
* we need a fallback.
|
| 6266 |
+
*/
|
| 6267 |
+
if ( window.ActiveXObject ) {
|
| 6268 |
+
jQuery.ajaxSettings.xhr = function() {
|
| 6269 |
+
if ( window.location.protocol !== "file:" ) {
|
| 6270 |
+
try {
|
| 6271 |
+
return new window.XMLHttpRequest();
|
| 6272 |
+
} catch(xhrError) {}
|
| 6273 |
+
}
|
| 6274 |
+
|
| 6275 |
+
try {
|
| 6276 |
+
return new window.ActiveXObject("Microsoft.XMLHTTP");
|
| 6277 |
+
} catch(activeError) {}
|
| 6278 |
+
};
|
| 6279 |
+
}
|
| 6280 |
+
|
| 6281 |
+
// Does this browser support XHR requests?
|
| 6282 |
+
jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
|
| 6283 |
+
|
| 6284 |
+
|
| 6285 |
+
|
| 6286 |
+
|
| 6287 |
+
var elemdisplay = {},
|
| 6288 |
+
rfxtypes = /^(?:toggle|show|hide)$/,
|
| 6289 |
+
rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
|
| 6290 |
+
timerId,
|
| 6291 |
+
fxAttrs = [
|
| 6292 |
+
// height animations
|
| 6293 |
+
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
|
| 6294 |
+
// width animations
|
| 6295 |
+
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
|
| 6296 |
+
// opacity animations
|
| 6297 |
+
[ "opacity" ]
|
| 6298 |
+
];
|
| 6299 |
+
|
| 6300 |
+
jQuery.fn.extend({
|
| 6301 |
+
show: function( speed, easing, callback ) {
|
| 6302 |
+
var elem, display;
|
| 6303 |
+
|
| 6304 |
+
if ( speed || speed === 0 ) {
|
| 6305 |
+
return this.animate( genFx("show", 3), speed, easing, callback);
|
| 6306 |
+
|
| 6307 |
+
} else {
|
| 6308 |
+
for ( var i = 0, j = this.length; i < j; i++ ) {
|
| 6309 |
+
elem = this[i];
|
| 6310 |
+
display = elem.style.display;
|
| 6311 |
+
|
| 6312 |
+
// Reset the inline display of this element to learn if it is
|
| 6313 |
+
// being hidden by cascaded rules or not
|
| 6314 |
+
if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
|
| 6315 |
+
display = elem.style.display = "";
|
| 6316 |
+
}
|
| 6317 |
+
|
| 6318 |
+
// Set elements which have been overridden with display: none
|
| 6319 |
+
// in a stylesheet to whatever the default browser style is
|
| 6320 |
+
// for such an element
|
| 6321 |
+
if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
|
| 6322 |
+
jQuery.data(elem, "olddisplay", defaultDisplay(elem.nodeName));
|
| 6323 |
+
}
|
| 6324 |
+
}
|
| 6325 |
+
|
| 6326 |
+
// Set the display of most of the elements in a second loop
|
| 6327 |
+
// to avoid the constant reflow
|
| 6328 |
+
for ( i = 0; i < j; i++ ) {
|
| 6329 |
+
elem = this[i];
|
| 6330 |
+
display = elem.style.display;
|
| 6331 |
+
|
| 6332 |
+
if ( display === "" || display === "none" ) {
|
| 6333 |
+
elem.style.display = jQuery.data(elem, "olddisplay") || "";
|
| 6334 |
+
}
|
| 6335 |
+
}
|
| 6336 |
+
|
| 6337 |
+
return this;
|
| 6338 |
+
}
|
| 6339 |
+
},
|
| 6340 |
+
|
| 6341 |
+
hide: function( speed, easing, callback ) {
|
| 6342 |
+
if ( speed || speed === 0 ) {
|
| 6343 |
+
return this.animate( genFx("hide", 3), speed, easing, callback);
|
| 6344 |
+
|
| 6345 |
+
} else {
|
| 6346 |
+
for ( var i = 0, j = this.length; i < j; i++ ) {
|
| 6347 |
+
var display = jQuery.css( this[i], "display" );
|
| 6348 |
+
|
| 6349 |
+
if ( display !== "none" ) {
|
| 6350 |
+
jQuery.data( this[i], "olddisplay", display );
|
| 6351 |
+
}
|
| 6352 |
+
}
|
| 6353 |
+
|
| 6354 |
+
// Set the display of the elements in a second loop
|
| 6355 |
+
// to avoid the constant reflow
|
| 6356 |
+
for ( i = 0; i < j; i++ ) {
|
| 6357 |
+
this[i].style.display = "none";
|
| 6358 |
+
}
|
| 6359 |
+
|
| 6360 |
+
return this;
|
| 6361 |
+
}
|
| 6362 |
+
},
|
| 6363 |
+
|
| 6364 |
+
// Save the old toggle function
|
| 6365 |
+
_toggle: jQuery.fn.toggle,
|
| 6366 |
+
|
| 6367 |
+
toggle: function( fn, fn2, callback ) {
|
| 6368 |
+
var bool = typeof fn === "boolean";
|
| 6369 |
+
|
| 6370 |
+
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
|
| 6371 |
+
this._toggle.apply( this, arguments );
|
| 6372 |
+
|
| 6373 |
+
} else if ( fn == null || bool ) {
|
| 6374 |
+
this.each(function() {
|
| 6375 |
+
var state = bool ? fn : jQuery(this).is(":hidden");
|
| 6376 |
+
jQuery(this)[ state ? "show" : "hide" ]();
|
| 6377 |
+
});
|
| 6378 |
+
|
| 6379 |
+
} else {
|
| 6380 |
+
this.animate(genFx("toggle", 3), fn, fn2, callback);
|
| 6381 |
+
}
|
| 6382 |
+
|
| 6383 |
+
return this;
|
| 6384 |
+
},
|
| 6385 |
+
|
| 6386 |
+
fadeTo: function( speed, to, easing, callback ) {
|
| 6387 |
+
return this.filter(":hidden").css("opacity", 0).show().end()
|
| 6388 |
+
.animate({opacity: to}, speed, easing, callback);
|
| 6389 |
+
},
|
| 6390 |
+
|
| 6391 |
+
animate: function( prop, speed, easing, callback ) {
|
| 6392 |
+
var optall = jQuery.speed(speed, easing, callback);
|
| 6393 |
+
|
| 6394 |
+
if ( jQuery.isEmptyObject( prop ) ) {
|
| 6395 |
+
return this.each( optall.complete );
|
| 6396 |
+
}
|
| 6397 |
+
|
| 6398 |
+
return this[ optall.queue === false ? "each" : "queue" ](function() {
|
| 6399 |
+
// XXX 'this' does not always have a nodeName when running the
|
| 6400 |
+
// test suite
|
| 6401 |
+
|
| 6402 |
+
var opt = jQuery.extend({}, optall), p,
|
| 6403 |
+
isElement = this.nodeType === 1,
|
| 6404 |
+
hidden = isElement && jQuery(this).is(":hidden"),
|
| 6405 |
+
self = this;
|
| 6406 |
+
|
| 6407 |
+
for ( p in prop ) {
|
| 6408 |
+
var name = jQuery.camelCase( p );
|
| 6409 |
+
|
| 6410 |
+
if ( p !== name ) {
|
| 6411 |
+
prop[ name ] = prop[ p ];
|
| 6412 |
+
delete prop[ p ];
|
| 6413 |
+
p = name;
|
| 6414 |
+
}
|
| 6415 |
+
|
| 6416 |
+
if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
|
| 6417 |
+
return opt.complete.call(this);
|
| 6418 |
+
}
|
| 6419 |
+
|
| 6420 |
+
if ( isElement && ( p === "height" || p === "width" ) ) {
|
| 6421 |
+
// Make sure that nothing sneaks out
|
| 6422 |
+
// Record all 3 overflow attributes because IE does not
|
| 6423 |
+
// change the overflow attribute when overflowX and
|
| 6424 |
+
// overflowY are set to the same value
|
| 6425 |
+
opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
|
| 6426 |
+
|
| 6427 |
+
// Set display property to inline-block for height/width
|
| 6428 |
+
// animations on inline elements that are having width/height
|
| 6429 |
+
// animated
|
| 6430 |
+
if ( jQuery.css( this, "display" ) === "inline" &&
|
| 6431 |
+
jQuery.css( this, "float" ) === "none" ) {
|
| 6432 |
+
if ( !jQuery.support.inlineBlockNeedsLayout ) {
|
| 6433 |
+
this.style.display = "inline-block";
|
| 6434 |
+
|
| 6435 |
+
} else {
|
| 6436 |
+
var display = defaultDisplay(this.nodeName);
|
| 6437 |
+
|
| 6438 |
+
// inline-level elements accept inline-block;
|
| 6439 |
+
// block-level elements need to be inline with layout
|
| 6440 |
+
if ( display === "inline" ) {
|
| 6441 |
+
this.style.display = "inline-block";
|
| 6442 |
+
|
| 6443 |
+
} else {
|
| 6444 |
+
this.style.display = "inline";
|
| 6445 |
+
this.style.zoom = 1;
|
| 6446 |
+
}
|
| 6447 |
+
}
|
| 6448 |
+
}
|
| 6449 |
+
}
|
| 6450 |
+
|
| 6451 |
+
if ( jQuery.isArray( prop[p] ) ) {
|
| 6452 |
+
// Create (if needed) and add to specialEasing
|
| 6453 |
+
(opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
|
| 6454 |
+
prop[p] = prop[p][0];
|
| 6455 |
+
}
|
| 6456 |
+
}
|
| 6457 |
+
|
| 6458 |
+
if ( opt.overflow != null ) {
|
| 6459 |
+
this.style.overflow = "hidden";
|
| 6460 |
+
}
|
| 6461 |
+
|
| 6462 |
+
opt.curAnim = jQuery.extend({}, prop);
|
| 6463 |
+
|
| 6464 |
+
jQuery.each( prop, function( name, val ) {
|
| 6465 |
+
var e = new jQuery.fx( self, opt, name );
|
| 6466 |
+
|
| 6467 |
+
if ( rfxtypes.test(val) ) {
|
| 6468 |
+
e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
|
| 6469 |
+
|
| 6470 |
+
} else {
|
| 6471 |
+
var parts = rfxnum.exec(val),
|
| 6472 |
+
start = e.cur() || 0;
|
| 6473 |
+
|
| 6474 |
+
if ( parts ) {
|
| 6475 |
+
var end = parseFloat( parts[2] ),
|
| 6476 |
+
unit = parts[3] || "px";
|
| 6477 |
+
|
| 6478 |
+
// We need to compute starting value
|
| 6479 |
+
if ( unit !== "px" ) {
|
| 6480 |
+
jQuery.style( self, name, (end || 1) + unit);
|
| 6481 |
+
start = ((end || 1) / e.cur()) * start;
|
| 6482 |
+
jQuery.style( self, name, start + unit);
|
| 6483 |
+
}
|
| 6484 |
+
|
| 6485 |
+
// If a +=/-= token was provided, we're doing a relative animation
|
| 6486 |
+
if ( parts[1] ) {
|
| 6487 |
+
end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
|
| 6488 |
+
}
|
| 6489 |
+
|
| 6490 |
+
e.custom( start, end, unit );
|
| 6491 |
+
|
| 6492 |
+
} else {
|
| 6493 |
+
e.custom( start, val, "" );
|
| 6494 |
+
}
|
| 6495 |
+
}
|
| 6496 |
+
});
|
| 6497 |
+
|
| 6498 |
+
// For JS strict compliance
|
| 6499 |
+
return true;
|
| 6500 |
+
});
|
| 6501 |
+
},
|
| 6502 |
+
|
| 6503 |
+
stop: function( clearQueue, gotoEnd ) {
|
| 6504 |
+
var timers = jQuery.timers;
|
| 6505 |
+
|
| 6506 |
+
if ( clearQueue ) {
|
| 6507 |
+
this.queue([]);
|
| 6508 |
+
}
|
| 6509 |
+
|
| 6510 |
+
this.each(function() {
|
| 6511 |
+
// go in reverse order so anything added to the queue during the loop is ignored
|
| 6512 |
+
for ( var i = timers.length - 1; i >= 0; i-- ) {
|
| 6513 |
+
if ( timers[i].elem === this ) {
|
| 6514 |
+
if (gotoEnd) {
|
| 6515 |
+
// force the next step to be the last
|
| 6516 |
+
timers[i](true);
|
| 6517 |
+
}
|
| 6518 |
+
|
| 6519 |
+
timers.splice(i, 1);
|
| 6520 |
+
}
|
| 6521 |
+
}
|
| 6522 |
+
});
|
| 6523 |
+
|
| 6524 |
+
// start the next in the queue if the last step wasn't forced
|
| 6525 |
+
if ( !gotoEnd ) {
|
| 6526 |
+
this.dequeue();
|
| 6527 |
+
}
|
| 6528 |
+
|
| 6529 |
+
return this;
|
| 6530 |
+
}
|
| 6531 |
+
|
| 6532 |
+
});
|
| 6533 |
+
|
| 6534 |
+
function genFx( type, num ) {
|
| 6535 |
+
var obj = {};
|
| 6536 |
+
|
| 6537 |
+
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
|
| 6538 |
+
obj[ this ] = type;
|
| 6539 |
+
});
|
| 6540 |
+
|
| 6541 |
+
return obj;
|
| 6542 |
+
}
|
| 6543 |
+
|
| 6544 |
+
// Generate shortcuts for custom animations
|
| 6545 |
+
jQuery.each({
|
| 6546 |
+
slideDown: genFx("show", 1),
|
| 6547 |
+
slideUp: genFx("hide", 1),
|
| 6548 |
+
slideToggle: genFx("toggle", 1),
|
| 6549 |
+
fadeIn: { opacity: "show" },
|
| 6550 |
+
fadeOut: { opacity: "hide" },
|
| 6551 |
+
fadeToggle: { opacity: "toggle" }
|
| 6552 |
+
}, function( name, props ) {
|
| 6553 |
+
jQuery.fn[ name ] = function( speed, easing, callback ) {
|
| 6554 |
+
return this.animate( props, speed, easing, callback );
|
| 6555 |
+
};
|
| 6556 |
+
});
|
| 6557 |
+
|
| 6558 |
+
jQuery.extend({
|
| 6559 |
+
speed: function( speed, easing, fn ) {
|
| 6560 |
+
var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
|
| 6561 |
+
complete: fn || !fn && easing ||
|
| 6562 |
+
jQuery.isFunction( speed ) && speed,
|
| 6563 |
+
duration: speed,
|
| 6564 |
+
easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
|
| 6565 |
+
};
|
| 6566 |
+
|
| 6567 |
+
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
|
| 6568 |
+
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
|
| 6569 |
+
|
| 6570 |
+
// Queueing
|
| 6571 |
+
opt.old = opt.complete;
|
| 6572 |
+
opt.complete = function() {
|
| 6573 |
+
if ( opt.queue !== false ) {
|
| 6574 |
+
jQuery(this).dequeue();
|
| 6575 |
+
}
|
| 6576 |
+
if ( jQuery.isFunction( opt.old ) ) {
|
| 6577 |
+
opt.old.call( this );
|
| 6578 |
+
}
|
| 6579 |
+
};
|
| 6580 |
+
|
| 6581 |
+
return opt;
|
| 6582 |
+
},
|
| 6583 |
+
|
| 6584 |
+
easing: {
|
| 6585 |
+
linear: function( p, n, firstNum, diff ) {
|
| 6586 |
+
return firstNum + diff * p;
|
| 6587 |
+
},
|
| 6588 |
+
swing: function( p, n, firstNum, diff ) {
|
| 6589 |
+
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
|
| 6590 |
+
}
|
| 6591 |
+
},
|
| 6592 |
+
|
| 6593 |
+
timers: [],
|
| 6594 |
+
|
| 6595 |
+
fx: function( elem, options, prop ) {
|
| 6596 |
+
this.options = options;
|
| 6597 |
+
this.elem = elem;
|
| 6598 |
+
this.prop = prop;
|
| 6599 |
+
|
| 6600 |
+
if ( !options.orig ) {
|
| 6601 |
+
options.orig = {};
|
| 6602 |
+
}
|
| 6603 |
+
}
|
| 6604 |
+
|
| 6605 |
+
});
|
| 6606 |
+
|
| 6607 |
+
jQuery.fx.prototype = {
|
| 6608 |
+
// Simple function for setting a style value
|
| 6609 |
+
update: function() {
|
| 6610 |
+
if ( this.options.step ) {
|
| 6611 |
+
this.options.step.call( this.elem, this.now, this );
|
| 6612 |
+
}
|
| 6613 |
+
|
| 6614 |
+
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
|
| 6615 |
+
},
|
| 6616 |
+
|
| 6617 |
+
// Get the current size
|
| 6618 |
+
cur: function() {
|
| 6619 |
+
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
|
| 6620 |
+
return this.elem[ this.prop ];
|
| 6621 |
+
}
|
| 6622 |
+
|
| 6623 |
+
var r = parseFloat( jQuery.css( this.elem, this.prop ) );
|
| 6624 |
+
return r && r > -10000 ? r : 0;
|
| 6625 |
+
},
|
| 6626 |
+
|
| 6627 |
+
// Start an animation from one number to another
|
| 6628 |
+
custom: function( from, to, unit ) {
|
| 6629 |
+
var self = this,
|
| 6630 |
+
fx = jQuery.fx;
|
| 6631 |
+
|
| 6632 |
+
this.startTime = jQuery.now();
|
| 6633 |
+
this.start = from;
|
| 6634 |
+
this.end = to;
|
| 6635 |
+
this.unit = unit || this.unit || "px";
|
| 6636 |
+
this.now = this.start;
|
| 6637 |
+
this.pos = this.state = 0;
|
| 6638 |
+
|
| 6639 |
+
function t( gotoEnd ) {
|
| 6640 |
+
return self.step(gotoEnd);
|
| 6641 |
+
}
|
| 6642 |
+
|
| 6643 |
+
t.elem = this.elem;
|
| 6644 |
+
|
| 6645 |
+
if ( t() && jQuery.timers.push(t) && !timerId ) {
|
| 6646 |
+
timerId = setInterval(fx.tick, fx.interval);
|
| 6647 |
+
}
|
| 6648 |
+
},
|
| 6649 |
+
|
| 6650 |
+
// Simple 'show' function
|
| 6651 |
+
show: function() {
|
| 6652 |
+
// Remember where we started, so that we can go back to it later
|
| 6653 |
+
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
|
| 6654 |
+
this.options.show = true;
|
| 6655 |
+
|
| 6656 |
+
// Begin the animation
|
| 6657 |
+
// Make sure that we start at a small width/height to avoid any
|
| 6658 |
+
// flash of content
|
| 6659 |
+
this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
|
| 6660 |
+
|
| 6661 |
+
// Start by showing the element
|
| 6662 |
+
jQuery( this.elem ).show();
|
| 6663 |
+
},
|
| 6664 |
+
|
| 6665 |
+
// Simple 'hide' function
|
| 6666 |
+
hide: function() {
|
| 6667 |
+
// Remember where we started, so that we can go back to it later
|
| 6668 |
+
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
|
| 6669 |
+
this.options.hide = true;
|
| 6670 |
+
|
| 6671 |
+
// Begin the animation
|
| 6672 |
+
this.custom(this.cur(), 0);
|
| 6673 |
+
},
|
| 6674 |
+
|
| 6675 |
+
// Each step of an animation
|
| 6676 |
+
step: function( gotoEnd ) {
|
| 6677 |
+
var t = jQuery.now(), done = true;
|
| 6678 |
+
|
| 6679 |
+
if ( gotoEnd || t >= this.options.duration + this.startTime ) {
|
| 6680 |
+
this.now = this.end;
|
| 6681 |
+
this.pos = this.state = 1;
|
| 6682 |
+
this.update();
|
| 6683 |
+
|
| 6684 |
+
this.options.curAnim[ this.prop ] = true;
|
| 6685 |
+
|
| 6686 |
+
for ( var i in this.options.curAnim ) {
|
| 6687 |
+
if ( this.options.curAnim[i] !== true ) {
|
| 6688 |
+
done = false;
|
| 6689 |
+
}
|
| 6690 |
+
}
|
| 6691 |
+
|
| 6692 |
+
if ( done ) {
|
| 6693 |
+
// Reset the overflow
|
| 6694 |
+
if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
|
| 6695 |
+
var elem = this.elem,
|
| 6696 |
+
options = this.options;
|
| 6697 |
+
|
| 6698 |
+
jQuery.each( [ "", "X", "Y" ], function (index, value) {
|
| 6699 |
+
elem.style[ "overflow" + value ] = options.overflow[index];
|
| 6700 |
+
} );
|
| 6701 |
+
}
|
| 6702 |
+
|
| 6703 |
+
// Hide the element if the "hide" operation was done
|
| 6704 |
+
if ( this.options.hide ) {
|
| 6705 |
+
jQuery(this.elem).hide();
|
| 6706 |
+
}
|
| 6707 |
+
|
| 6708 |
+
// Reset the properties, if the item has been hidden or shown
|
| 6709 |
+
if ( this.options.hide || this.options.show ) {
|
| 6710 |
+
for ( var p in this.options.curAnim ) {
|
| 6711 |
+
jQuery.style( this.elem, p, this.options.orig[p] );
|
| 6712 |
+
}
|
| 6713 |
+
}
|
| 6714 |
+
|
| 6715 |
+
// Execute the complete function
|
| 6716 |
+
this.options.complete.call( this.elem );
|
| 6717 |
+
}
|
| 6718 |
+
|
| 6719 |
+
return false;
|
| 6720 |
+
|
| 6721 |
+
} else {
|
| 6722 |
+
var n = t - this.startTime;
|
| 6723 |
+
this.state = n / this.options.duration;
|
| 6724 |
+
|
| 6725 |
+
// Perform the easing function, defaults to swing
|
| 6726 |
+
var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
|
| 6727 |
+
var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
|
| 6728 |
+
this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
|
| 6729 |
+
this.now = this.start + ((this.end - this.start) * this.pos);
|
| 6730 |
+
|
| 6731 |
+
// Perform the next step of the animation
|
| 6732 |
+
this.update();
|
| 6733 |
+
}
|
| 6734 |
+
|
| 6735 |
+
return true;
|
| 6736 |
+
}
|
| 6737 |
+
};
|
| 6738 |
+
|
| 6739 |
+
jQuery.extend( jQuery.fx, {
|
| 6740 |
+
tick: function() {
|
| 6741 |
+
var timers = jQuery.timers;
|
| 6742 |
+
|
| 6743 |
+
for ( var i = 0; i < timers.length; i++ ) {
|
| 6744 |
+
if ( !timers[i]() ) {
|
| 6745 |
+
timers.splice(i--, 1);
|
| 6746 |
+
}
|
| 6747 |
+
}
|
| 6748 |
+
|
| 6749 |
+
if ( !timers.length ) {
|
| 6750 |
+
jQuery.fx.stop();
|
| 6751 |
+
}
|
| 6752 |
+
},
|
| 6753 |
+
|
| 6754 |
+
interval: 13,
|
| 6755 |
+
|
| 6756 |
+
stop: function() {
|
| 6757 |
+
clearInterval( timerId );
|
| 6758 |
+
timerId = null;
|
| 6759 |
+
},
|
| 6760 |
+
|
| 6761 |
+
speeds: {
|
| 6762 |
+
slow: 600,
|
| 6763 |
+
fast: 200,
|
| 6764 |
+
// Default speed
|
| 6765 |
+
_default: 400
|
| 6766 |
+
},
|
| 6767 |
+
|
| 6768 |
+
step: {
|
| 6769 |
+
opacity: function( fx ) {
|
| 6770 |
+
jQuery.style( fx.elem, "opacity", fx.now );
|
| 6771 |
+
},
|
| 6772 |
+
|
| 6773 |
+
_default: function( fx ) {
|
| 6774 |
+
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
|
| 6775 |
+
fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
|
| 6776 |
+
} else {
|
| 6777 |
+
fx.elem[ fx.prop ] = fx.now;
|
| 6778 |
+
}
|
| 6779 |
+
}
|
| 6780 |
+
}
|
| 6781 |
+
});
|
| 6782 |
+
|
| 6783 |
+
if ( jQuery.expr && jQuery.expr.filters ) {
|
| 6784 |
+
jQuery.expr.filters.animated = function( elem ) {
|
| 6785 |
+
return jQuery.grep(jQuery.timers, function( fn ) {
|
| 6786 |
+
return elem === fn.elem;
|
| 6787 |
+
}).length;
|
| 6788 |
+
};
|
| 6789 |
+
}
|
| 6790 |
+
|
| 6791 |
+
function defaultDisplay( nodeName ) {
|
| 6792 |
+
if ( !elemdisplay[ nodeName ] ) {
|
| 6793 |
+
var elem = jQuery("<" + nodeName + ">").appendTo("body"),
|
| 6794 |
+
display = elem.css("display");
|
| 6795 |
+
|
| 6796 |
+
elem.remove();
|
| 6797 |
+
|
| 6798 |
+
if ( display === "none" || display === "" ) {
|
| 6799 |
+
display = "block";
|
| 6800 |
+
}
|
| 6801 |
+
|
| 6802 |
+
elemdisplay[ nodeName ] = display;
|
| 6803 |
+
}
|
| 6804 |
+
|
| 6805 |
+
return elemdisplay[ nodeName ];
|
| 6806 |
+
}
|
| 6807 |
+
|
| 6808 |
+
|
| 6809 |
+
|
| 6810 |
+
|
| 6811 |
+
var rtable = /^t(?:able|d|h)$/i,
|
| 6812 |
+
rroot = /^(?:body|html)$/i;
|
| 6813 |
+
|
| 6814 |
+
if ( "getBoundingClientRect" in document.documentElement ) {
|
| 6815 |
+
jQuery.fn.offset = function( options ) {
|
| 6816 |
+
var elem = this[0], box;
|
| 6817 |
+
|
| 6818 |
+
if ( options ) {
|
| 6819 |
+
return this.each(function( i ) {
|
| 6820 |
+
jQuery.offset.setOffset( this, options, i );
|
| 6821 |
+
});
|
| 6822 |
+
}
|
| 6823 |
+
|
| 6824 |
+
if ( !elem || !elem.ownerDocument ) {
|
| 6825 |
+
return null;
|
| 6826 |
+
}
|
| 6827 |
+
|
| 6828 |
+
if ( elem === elem.ownerDocument.body ) {
|
| 6829 |
+
return jQuery.offset.bodyOffset( elem );
|
| 6830 |
+
}
|
| 6831 |
+
|
| 6832 |
+
try {
|
| 6833 |
+
box = elem.getBoundingClientRect();
|
| 6834 |
+
} catch(e) {}
|
| 6835 |
+
|
| 6836 |
+
var doc = elem.ownerDocument,
|
| 6837 |
+
docElem = doc.documentElement;
|
| 6838 |
+
|
| 6839 |
+
// Make sure we're not dealing with a disconnected DOM node
|
| 6840 |
+
if ( !box || !jQuery.contains( docElem, elem ) ) {
|
| 6841 |
+
return box || { top: 0, left: 0 };
|
| 6842 |
+
}
|
| 6843 |
+
|
| 6844 |
+
var body = doc.body,
|
| 6845 |
+
win = getWindow(doc),
|
| 6846 |
+
clientTop = docElem.clientTop || body.clientTop || 0,
|
| 6847 |
+
clientLeft = docElem.clientLeft || body.clientLeft || 0,
|
| 6848 |
+
scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
|
| 6849 |
+
scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
|
| 6850 |
+
top = box.top + scrollTop - clientTop,
|
| 6851 |
+
left = box.left + scrollLeft - clientLeft;
|
| 6852 |
+
|
| 6853 |
+
return { top: top, left: left };
|
| 6854 |
+
};
|
| 6855 |
+
|
| 6856 |
+
} else {
|
| 6857 |
+
jQuery.fn.offset = function( options ) {
|
| 6858 |
+
var elem = this[0];
|
| 6859 |
+
|
| 6860 |
+
if ( options ) {
|
| 6861 |
+
return this.each(function( i ) {
|
| 6862 |
+
jQuery.offset.setOffset( this, options, i );
|
| 6863 |
+
});
|
| 6864 |
+
}
|
| 6865 |
+
|
| 6866 |
+
if ( !elem || !elem.ownerDocument ) {
|
| 6867 |
+
return null;
|
| 6868 |
+
}
|
| 6869 |
+
|
| 6870 |
+
if ( elem === elem.ownerDocument.body ) {
|
| 6871 |
+
return jQuery.offset.bodyOffset( elem );
|
| 6872 |
+
}
|
| 6873 |
+
|
| 6874 |
+
jQuery.offset.initialize();
|
| 6875 |
+
|
| 6876 |
+
var computedStyle,
|
| 6877 |
+
offsetParent = elem.offsetParent,
|
| 6878 |
+
prevOffsetParent = elem,
|
| 6879 |
+
doc = elem.ownerDocument,
|
| 6880 |
+
docElem = doc.documentElement,
|
| 6881 |
+
body = doc.body,
|
| 6882 |
+
defaultView = doc.defaultView,
|
| 6883 |
+
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
|
| 6884 |
+
top = elem.offsetTop,
|
| 6885 |
+
left = elem.offsetLeft;
|
| 6886 |
+
|
| 6887 |
+
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
|
| 6888 |
+
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
|
| 6889 |
+
break;
|
| 6890 |
+
}
|
| 6891 |
+
|
| 6892 |
+
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
|
| 6893 |
+
top -= elem.scrollTop;
|
| 6894 |
+
left -= elem.scrollLeft;
|
| 6895 |
+
|
| 6896 |
+
if ( elem === offsetParent ) {
|
| 6897 |
+
top += elem.offsetTop;
|
| 6898 |
+
left += elem.offsetLeft;
|
| 6899 |
+
|
| 6900 |
+
if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
|
| 6901 |
+
top += parseFloat( computedStyle.borderTopWidth ) || 0;
|
| 6902 |
+
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
|
| 6903 |
+
}
|
| 6904 |
+
|
| 6905 |
+
prevOffsetParent = offsetParent;
|
| 6906 |
+
offsetParent = elem.offsetParent;
|
| 6907 |
+
}
|
| 6908 |
+
|
| 6909 |
+
if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
|
| 6910 |
+
top += parseFloat( computedStyle.borderTopWidth ) || 0;
|
| 6911 |
+
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
|
| 6912 |
+
}
|
| 6913 |
+
|
| 6914 |
+
prevComputedStyle = computedStyle;
|
| 6915 |
+
}
|
| 6916 |
+
|
| 6917 |
+
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
|
| 6918 |
+
top += body.offsetTop;
|
| 6919 |
+
left += body.offsetLeft;
|
| 6920 |
+
}
|
| 6921 |
+
|
| 6922 |
+
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
|
| 6923 |
+
top += Math.max( docElem.scrollTop, body.scrollTop );
|
| 6924 |
+
left += Math.max( docElem.scrollLeft, body.scrollLeft );
|
| 6925 |
+
}
|
| 6926 |
+
|
| 6927 |
+
return { top: top, left: left };
|
| 6928 |
+
};
|
| 6929 |
+
}
|
| 6930 |
+
|
| 6931 |
+
jQuery.offset = {
|
| 6932 |
+
initialize: function() {
|
| 6933 |
+
var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
|
| 6934 |
+
html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
|
| 6935 |
+
|
| 6936 |
+
jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
|
| 6937 |
+
|
| 6938 |
+
container.innerHTML = html;
|
| 6939 |
+
body.insertBefore( container, body.firstChild );
|
| 6940 |
+
innerDiv = container.firstChild;
|
| 6941 |
+
checkDiv = innerDiv.firstChild;
|
| 6942 |
+
td = innerDiv.nextSibling.firstChild.firstChild;
|
| 6943 |
+
|
| 6944 |
+
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
|
| 6945 |
+
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
|
| 6946 |
+
|
| 6947 |
+
checkDiv.style.position = "fixed";
|
| 6948 |
+
checkDiv.style.top = "20px";
|
| 6949 |
+
|
| 6950 |
+
// safari subtracts parent border width here which is 5px
|
| 6951 |
+
this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
|
| 6952 |
+
checkDiv.style.position = checkDiv.style.top = "";
|
| 6953 |
+
|
| 6954 |
+
innerDiv.style.overflow = "hidden";
|
| 6955 |
+
innerDiv.style.position = "relative";
|
| 6956 |
+
|
| 6957 |
+
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
|
| 6958 |
+
|
| 6959 |
+
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
|
| 6960 |
+
|
| 6961 |
+
body.removeChild( container );
|
| 6962 |
+
body = container = innerDiv = checkDiv = table = td = null;
|
| 6963 |
+
jQuery.offset.initialize = jQuery.noop;
|
| 6964 |
+
},
|
| 6965 |
+
|
| 6966 |
+
bodyOffset: function( body ) {
|
| 6967 |
+
var top = body.offsetTop,
|
| 6968 |
+
left = body.offsetLeft;
|
| 6969 |
+
|
| 6970 |
+
jQuery.offset.initialize();
|
| 6971 |
+
|
| 6972 |
+
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
|
| 6973 |
+
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
|
| 6974 |
+
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
|
| 6975 |
+
}
|
| 6976 |
+
|
| 6977 |
+
return { top: top, left: left };
|
| 6978 |
+
},
|
| 6979 |
+
|
| 6980 |
+
setOffset: function( elem, options, i ) {
|
| 6981 |
+
var position = jQuery.css( elem, "position" );
|
| 6982 |
+
|
| 6983 |
+
// set position first, in-case top/left are set even on static elem
|
| 6984 |
+
if ( position === "static" ) {
|
| 6985 |
+
elem.style.position = "relative";
|
| 6986 |
+
}
|
| 6987 |
+
|
| 6988 |
+
var curElem = jQuery( elem ),
|
| 6989 |
+
curOffset = curElem.offset(),
|
| 6990 |
+
curCSSTop = jQuery.css( elem, "top" ),
|
| 6991 |
+
curCSSLeft = jQuery.css( elem, "left" ),
|
| 6992 |
+
calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
|
| 6993 |
+
props = {}, curPosition = {}, curTop, curLeft;
|
| 6994 |
+
|
| 6995 |
+
// need to be able to calculate position if either top or left is auto and position is absolute
|
| 6996 |
+
if ( calculatePosition ) {
|
| 6997 |
+
curPosition = curElem.position();
|
| 6998 |
+
}
|
| 6999 |
+
|
| 7000 |
+
curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
|
| 7001 |
+
curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
|
| 7002 |
+
|
| 7003 |
+
if ( jQuery.isFunction( options ) ) {
|
| 7004 |
+
options = options.call( elem, i, curOffset );
|
| 7005 |
+
}
|
| 7006 |
+
|
| 7007 |
+
if (options.top != null) {
|
| 7008 |
+
props.top = (options.top - curOffset.top) + curTop;
|
| 7009 |
+
}
|
| 7010 |
+
if (options.left != null) {
|
| 7011 |
+
props.left = (options.left - curOffset.left) + curLeft;
|
| 7012 |
+
}
|
| 7013 |
+
|
| 7014 |
+
if ( "using" in options ) {
|
| 7015 |
+
options.using.call( elem, props );
|
| 7016 |
+
} else {
|
| 7017 |
+
curElem.css( props );
|
| 7018 |
+
}
|
| 7019 |
+
}
|
| 7020 |
+
};
|
| 7021 |
+
|
| 7022 |
+
|
| 7023 |
+
jQuery.fn.extend({
|
| 7024 |
+
position: function() {
|
| 7025 |
+
if ( !this[0] ) {
|
| 7026 |
+
return null;
|
| 7027 |
+
}
|
| 7028 |
+
|
| 7029 |
+
var elem = this[0],
|
| 7030 |
+
|
| 7031 |
+
// Get *real* offsetParent
|
| 7032 |
+
offsetParent = this.offsetParent(),
|
| 7033 |
+
|
| 7034 |
+
// Get correct offsets
|
| 7035 |
+
offset = this.offset(),
|
| 7036 |
+
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
|
| 7037 |
+
|
| 7038 |
+
// Subtract element margins
|
| 7039 |
+
// note: when an element has margin: auto the offsetLeft and marginLeft
|
| 7040 |
+
// are the same in Safari causing offset.left to incorrectly be 0
|
| 7041 |
+
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
|
| 7042 |
+
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
|
| 7043 |
+
|
| 7044 |
+
// Add offsetParent borders
|
| 7045 |
+
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
|
| 7046 |
+
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
|
| 7047 |
+
|
| 7048 |
+
// Subtract the two offsets
|
| 7049 |
+
return {
|
| 7050 |
+
top: offset.top - parentOffset.top,
|
| 7051 |
+
left: offset.left - parentOffset.left
|
| 7052 |
+
};
|
| 7053 |
+
},
|
| 7054 |
+
|
| 7055 |
+
offsetParent: function() {
|
| 7056 |
+
return this.map(function() {
|
| 7057 |
+
var offsetParent = this.offsetParent || document.body;
|
| 7058 |
+
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
|
| 7059 |
+
offsetParent = offsetParent.offsetParent;
|
| 7060 |
+
}
|
| 7061 |
+
return offsetParent;
|
| 7062 |
+
});
|
| 7063 |
+
}
|
| 7064 |
+
});
|
| 7065 |
+
|
| 7066 |
+
|
| 7067 |
+
// Create scrollLeft and scrollTop methods
|
| 7068 |
+
jQuery.each( ["Left", "Top"], function( i, name ) {
|
| 7069 |
+
var method = "scroll" + name;
|
| 7070 |
+
|
| 7071 |
+
jQuery.fn[ method ] = function(val) {
|
| 7072 |
+
var elem = this[0], win;
|
| 7073 |
+
|
| 7074 |
+
if ( !elem ) {
|
| 7075 |
+
return null;
|
| 7076 |
+
}
|
| 7077 |
+
|
| 7078 |
+
if ( val !== undefined ) {
|
| 7079 |
+
// Set the scroll offset
|
| 7080 |
+
return this.each(function() {
|
| 7081 |
+
win = getWindow( this );
|
| 7082 |
+
|
| 7083 |
+
if ( win ) {
|
| 7084 |
+
win.scrollTo(
|
| 7085 |
+
!i ? val : jQuery(win).scrollLeft(),
|
| 7086 |
+
i ? val : jQuery(win).scrollTop()
|
| 7087 |
+
);
|
| 7088 |
+
|
| 7089 |
+
} else {
|
| 7090 |
+
this[ method ] = val;
|
| 7091 |
+
}
|
| 7092 |
+
});
|
| 7093 |
+
} else {
|
| 7094 |
+
win = getWindow( elem );
|
| 7095 |
+
|
| 7096 |
+
// Return the scroll offset
|
| 7097 |
+
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
|
| 7098 |
+
jQuery.support.boxModel && win.document.documentElement[ method ] ||
|
| 7099 |
+
win.document.body[ method ] :
|
| 7100 |
+
elem[ method ];
|
| 7101 |
+
}
|
| 7102 |
+
};
|
| 7103 |
+
});
|
| 7104 |
+
|
| 7105 |
+
function getWindow( elem ) {
|
| 7106 |
+
return jQuery.isWindow( elem ) ?
|
| 7107 |
+
elem :
|
| 7108 |
+
elem.nodeType === 9 ?
|
| 7109 |
+
elem.defaultView || elem.parentWindow :
|
| 7110 |
+
false;
|
| 7111 |
+
}
|
| 7112 |
+
|
| 7113 |
+
|
| 7114 |
+
|
| 7115 |
+
|
| 7116 |
+
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
|
| 7117 |
+
jQuery.each([ "Height", "Width" ], function( i, name ) {
|
| 7118 |
+
|
| 7119 |
+
var type = name.toLowerCase();
|
| 7120 |
+
|
| 7121 |
+
// innerHeight and innerWidth
|
| 7122 |
+
jQuery.fn["inner" + name] = function() {
|
| 7123 |
+
return this[0] ?
|
| 7124 |
+
parseFloat( jQuery.css( this[0], type, "padding" ) ) :
|
| 7125 |
+
null;
|
| 7126 |
+
};
|
| 7127 |
+
|
| 7128 |
+
// outerHeight and outerWidth
|
| 7129 |
+
jQuery.fn["outer" + name] = function( margin ) {
|
| 7130 |
+
return this[0] ?
|
| 7131 |
+
parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
|
| 7132 |
+
null;
|
| 7133 |
+
};
|
| 7134 |
+
|
| 7135 |
+
jQuery.fn[ type ] = function( size ) {
|
| 7136 |
+
// Get window width or height
|
| 7137 |
+
var elem = this[0];
|
| 7138 |
+
if ( !elem ) {
|
| 7139 |
+
return size == null ? null : this;
|
| 7140 |
+
}
|
| 7141 |
+
|
| 7142 |
+
if ( jQuery.isFunction( size ) ) {
|
| 7143 |
+
return this.each(function( i ) {
|
| 7144 |
+
var self = jQuery( this );
|
| 7145 |
+
self[ type ]( size.call( this, i, self[ type ]() ) );
|
| 7146 |
+
});
|
| 7147 |
+
}
|
| 7148 |
+
|
| 7149 |
+
if ( jQuery.isWindow( elem ) ) {
|
| 7150 |
+
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
|
| 7151 |
+
return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
|
| 7152 |
+
elem.document.body[ "client" + name ];
|
| 7153 |
+
|
| 7154 |
+
// Get document width or height
|
| 7155 |
+
} else if ( elem.nodeType === 9 ) {
|
| 7156 |
+
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
|
| 7157 |
+
return Math.max(
|
| 7158 |
+
elem.documentElement["client" + name],
|
| 7159 |
+
elem.body["scroll" + name], elem.documentElement["scroll" + name],
|
| 7160 |
+
elem.body["offset" + name], elem.documentElement["offset" + name]
|
| 7161 |
+
);
|
| 7162 |
+
|
| 7163 |
+
// Get or set width or height on the element
|
| 7164 |
+
} else if ( size === undefined ) {
|
| 7165 |
+
var orig = jQuery.css( elem, type ),
|
| 7166 |
+
ret = parseFloat( orig );
|
| 7167 |
+
|
| 7168 |
+
return jQuery.isNaN( ret ) ? orig : ret;
|
| 7169 |
+
|
| 7170 |
+
// Set the width or height on the element (default to pixels if value is unitless)
|
| 7171 |
+
} else {
|
| 7172 |
+
return this.css( type, typeof size === "string" ? size : size + "px" );
|
| 7173 |
+
}
|
| 7174 |
+
};
|
| 7175 |
+
|
| 7176 |
+
});
|
| 7177 |
+
|
| 7178 |
+
|
| 7179 |
+
})(window);
|
| 7180 |
+
jQuery.noConflict();
|
skin/adminhtml/default/default/oopsprofile/js/jquery-ui-1.8.12.custom.min.js
ADDED
|
@@ -0,0 +1,783 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
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Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
/*!
|
| 2 |
+
* jQuery UI 1.8.12
|
| 3 |
+
*
|
| 4 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 6 |
+
* http://jquery.org/license
|
| 7 |
+
*
|
| 8 |
+
* http://docs.jquery.com/UI
|
| 9 |
+
*/
|
| 10 |
+
(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.12",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,
|
| 11 |
+
NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,
|
| 12 |
+
"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");
|
| 13 |
+
if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,
|
| 14 |
+
"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,
|
| 15 |
+
d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});
|
| 16 |
+
c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&
|
| 17 |
+
b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
|
| 18 |
+
;/*!
|
| 19 |
+
* jQuery UI Widget 1.8.12
|
| 20 |
+
*
|
| 21 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 22 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 23 |
+
* http://jquery.org/license
|
| 24 |
+
*
|
| 25 |
+
* http://docs.jquery.com/UI/Widget
|
| 26 |
+
*/
|
| 27 |
+
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
|
| 28 |
+
a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
|
| 29 |
+
e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
|
| 30 |
+
this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
|
| 31 |
+
widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
|
| 32 |
+
enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
|
| 33 |
+
;/*!
|
| 34 |
+
* jQuery UI Mouse 1.8.12
|
| 35 |
+
*
|
| 36 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 37 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 38 |
+
* http://jquery.org/license
|
| 39 |
+
*
|
| 40 |
+
* http://docs.jquery.com/UI/Mouse
|
| 41 |
+
*
|
| 42 |
+
* Depends:
|
| 43 |
+
* jquery.ui.widget.js
|
| 44 |
+
*/
|
| 45 |
+
(function(b){b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent=
|
| 46 |
+
a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,e=a.which==1,f=typeof this.options.cancel=="string"?b(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
|
| 47 |
+
this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(d){return c._mouseMove(d)};this._mouseUpDelegate=function(d){return c._mouseUp(d)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return a.originalEvent.mouseHandled=
|
| 48 |
+
true}},_mouseMove:function(a){if(b.browser.msie&&!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);
|
| 49 |
+
if(this._mouseStarted){this._mouseStarted=false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
|
| 50 |
+
;/*
|
| 51 |
+
* jQuery UI Position 1.8.12
|
| 52 |
+
*
|
| 53 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 54 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 55 |
+
* http://jquery.org/license
|
| 56 |
+
*
|
| 57 |
+
* http://docs.jquery.com/UI/Position
|
| 58 |
+
*/
|
| 59 |
+
(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
|
| 60 |
+
left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
|
| 61 |
+
k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
|
| 62 |
+
m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
|
| 63 |
+
d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
|
| 64 |
+
a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
|
| 65 |
+
g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
|
| 66 |
+
;/*
|
| 67 |
+
* jQuery UI Draggable 1.8.12
|
| 68 |
+
*
|
| 69 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 70 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 71 |
+
* http://jquery.org/license
|
| 72 |
+
*
|
| 73 |
+
* http://docs.jquery.com/UI/Draggables
|
| 74 |
+
*
|
| 75 |
+
* Depends:
|
| 76 |
+
* jquery.ui.core.js
|
| 77 |
+
* jquery.ui.mouse.js
|
| 78 |
+
* jquery.ui.widget.js
|
| 79 |
+
*/
|
| 80 |
+
(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper==
|
| 81 |
+
"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=
|
| 82 |
+
this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-
|
| 83 |
+
this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();
|
| 84 |
+
d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||
|
| 85 |
+
this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&
|
| 86 |
+
this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==
|
| 87 |
+
a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||
|
| 88 |
+
0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
|
| 89 |
+
this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-
|
| 90 |
+
(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),
|
| 91 |
+
height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[(a.containment=="document"?0:d(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(a.containment=="document"?0:d(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?
|
| 92 |
+
document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),
|
| 93 |
+
10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0),a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0),a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),
|
| 94 |
+
10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom]}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&
|
| 95 |
+
d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
|
| 96 |
+
this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])e=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=
|
| 97 |
+
this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;e=this.originalPageX+Math.round((e-this.originalPageX)/b.grid[0])*b.grid[0];e=this.containment?!(e-this.offset.click.left<this.containment[0]||e-this.offset.click.left>this.containment[2])?
|
| 98 |
+
e:!(e-this.offset.click.left<this.containment[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():
|
| 99 |
+
f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,
|
| 100 |
+
offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.12"});d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var g=d.data(this,"sortable");if(g&&!g.options.disabled){c.sortables.push({instance:g,shouldRevert:g.options.revert});g.refreshPositions();g._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},
|
| 101 |
+
b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=
|
| 102 |
+
d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=d(f).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};
|
| 103 |
+
a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&
|
| 104 |
+
this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",
|
| 105 |
+
{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","iframeFix",{start:function(){var a=d(this).data("draggable").options;d(a.iframeFix===true?"iframe":a.iframeFix).each(function(){d('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+
|
| 106 |
+
"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")})},stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",
|
| 107 |
+
a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+
|
| 108 |
+
c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-b.overflowOffset.left<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<
|
| 109 |
+
c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+
|
| 110 |
+
c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),
|
| 111 |
+
f=c.options,e=f.snapTolerance,g=b.offset.left,n=g+c.helperProportions.width,m=b.offset.top,o=m+c.helperProportions.height,h=c.snapElements.length-1;h>=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e<g&&g<k+e&&j-e<m&&m<l+e||i-e<g&&g<k+e&&j-e<o&&o<l+e||i-e<n&&n<k+e&&j-e<m&&m<l+e||i-e<n&&n<k+e&&j-e<o&&o<l+e){if(f.snapMode!="inner"){var p=Math.abs(j-o)<=e,q=Math.abs(l-m)<=e,r=Math.abs(i-n)<=e,s=Math.abs(k-g)<=e;if(p)b.position.top=
|
| 112 |
+
c._convertPositionTo("relative",{top:j-c.helperProportions.height,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k}).left-c.margins.left}var t=p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(j-m)<=e;q=Math.abs(l-o)<=e;r=Math.abs(i-g)<=e;s=Math.abs(k-n)<=e;if(p)b.position.top=
|
| 113 |
+
c._convertPositionTo("relative",{top:j,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l-c.helperProportions.height,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[h].snapping&&(p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),
|
| 114 |
+
{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=p||q||r||s||t}else{c.snapElements[h].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=
|
| 115 |
+
parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery);
|
| 116 |
+
;/*
|
| 117 |
+
* jQuery UI Droppable 1.8.12
|
| 118 |
+
*
|
| 119 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 120 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 121 |
+
* http://jquery.org/license
|
| 122 |
+
*
|
| 123 |
+
* http://docs.jquery.com/UI/Droppables
|
| 124 |
+
*
|
| 125 |
+
* Depends:
|
| 126 |
+
* jquery.ui.core.js
|
| 127 |
+
* jquery.ui.widget.js
|
| 128 |
+
* jquery.ui.mouse.js
|
| 129 |
+
* jquery.ui.draggable.js
|
| 130 |
+
*/
|
| 131 |
+
(function(d){d.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,b=a.accept;this.isover=0;this.isout=1;this.accept=d.isFunction(b)?b:function(c){return c.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this);
|
| 132 |
+
a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],b=0;b<a.length;b++)a[b]==this&&a.splice(b,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,b){if(a=="accept")this.accept=d.isFunction(b)?b:function(c){return c.is(b)};d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&
|
| 133 |
+
this.element.addClass(this.options.activeClass);b&&this._trigger("activate",a,this.ui(b))},_deactivate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);b&&this._trigger("deactivate",a,this.ui(b))},_over:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.addClass(this.options.hoverClass);
|
| 134 |
+
this._trigger("over",a,this.ui(b))}},_out:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("out",a,this.ui(b))}},_drop:function(a,b){var c=b||d.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return false;var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var g=
|
| 135 |
+
d.data(this,"droppable");if(g.options.greedy&&!g.options.disabled&&g.options.scope==c.options.scope&&g.accept.call(g.element[0],c.currentItem||c.element)&&d.ui.intersect(c,d.extend(g,{offset:g.element.offset()}),g.options.tolerance)){e=true;return false}});if(e)return false;if(this.accept.call(this.element[0],c.currentItem||c.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass);this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("drop",
|
| 136 |
+
a,this.ui(c));return this.element}return false},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}});d.extend(d.ui.droppable,{version:"1.8.12"});d.ui.intersect=function(a,b,c){if(!b.offset)return false;var e=(a.positionAbs||a.position.absolute).left,g=e+a.helperProportions.width,f=(a.positionAbs||a.position.absolute).top,h=f+a.helperProportions.height,i=b.offset.left,k=i+b.proportions.width,j=b.offset.top,l=j+b.proportions.height;
|
| 137 |
+
switch(c){case "fit":return i<=e&&g<=k&&j<=f&&h<=l;case "intersect":return i<e+a.helperProportions.width/2&&g-a.helperProportions.width/2<k&&j<f+a.helperProportions.height/2&&h-a.helperProportions.height/2<l;case "pointer":return d.ui.isOver((a.positionAbs||a.position.absolute).top+(a.clickOffset||a.offset.click).top,(a.positionAbs||a.position.absolute).left+(a.clickOffset||a.offset.click).left,j,i,b.proportions.height,b.proportions.width);case "touch":return(f>=j&&f<=l||h>=j&&h<=l||f<j&&h>l)&&(e>=
|
| 138 |
+
i&&e<=k||g>=i&&g<=k||e<i&&g>k);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f<c.length;f++)if(!(c[f].options.disabled||a&&!c[f].accept.call(c[f].element[0],a.currentItem||a.element))){for(var h=0;h<g.length;h++)if(g[h]==c[f].element[0]){c[f].proportions.height=0;continue a}c[f].visible=c[f].element.css("display")!=
|
| 139 |
+
"none";if(c[f].visible){e=="mousedown"&&c[f]._activate.call(c[f],b);c[f].offset=c[f].element.offset();c[f].proportions={width:c[f].element[0].offsetWidth,height:c[f].element[0].offsetHeight}}}},drop:function(a,b){var c=false;d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(this.options){if(!this.options.disabled&&this.visible&&d.ui.intersect(a,this,this.options.tolerance))c=c||this._drop.call(this,b);if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],a.currentItem||
|
| 140 |
+
a.element)){this.isout=1;this.isover=0;this._deactivate.call(this,b)}}});return c},drag:function(a,b){a.options.refreshPositions&&d.ui.ddmanager.prepareOffsets(a,b);d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var c=d.ui.intersect(a,this,this.options.tolerance);if(c=!c&&this.isover==1?"isout":c&&this.isover==0?"isover":null){var e;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");if(g.length){e=
|
| 141 |
+
d.data(g[0],"droppable");e.greedyChild=c=="isover"?1:0}}if(e&&c=="isover"){e.isover=0;e.isout=1;e._out.call(e,b)}this[c]=1;this[c=="isout"?"isover":"isout"]=0;this[c=="isover"?"_over":"_out"].call(this,b);if(e&&c=="isout"){e.isout=0;e.isover=1;e._over.call(e,b)}}}})}}})(jQuery);
|
| 142 |
+
;/*
|
| 143 |
+
* jQuery UI Resizable 1.8.12
|
| 144 |
+
*
|
| 145 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 146 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 147 |
+
* http://jquery.org/license
|
| 148 |
+
*
|
| 149 |
+
* http://docs.jquery.com/UI/Resizables
|
| 150 |
+
*
|
| 151 |
+
* Depends:
|
| 152 |
+
* jquery.ui.core.js
|
| 153 |
+
* jquery.ui.mouse.js
|
| 154 |
+
* jquery.ui.widget.js
|
| 155 |
+
*/
|
| 156 |
+
(function(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,
|
| 157 |
+
_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),
|
| 158 |
+
top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=
|
| 159 |
+
this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",
|
| 160 |
+
nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d<c.length;d++){var f=e.trim(c[d]),g=e('<div class="ui-resizable-handle '+("ui-resizable-"+f)+'"></div>');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor==
|
| 161 |
+
String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),k=0;k=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,k);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection();
|
| 162 |
+
this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){e(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};
|
| 163 |
+
if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),
|
| 164 |
+
d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=
|
| 165 |
+
this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:
|
| 166 |
+
this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis];if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",
|
| 167 |
+
b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;
|
| 168 |
+
f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f,{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");
|
| 169 |
+
this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateCache:function(b){this.offset=this.helper.offset();if(l(b.left))this.position.left=b.left;if(l(b.top))this.position.top=b.top;if(l(b.height))this.size.height=b.height;if(l(b.width))this.size.width=b.width},_updateRatio:function(b){var a=this.position,c=this.size,d=this.axis;if(b.height)b.width=c.height*this.aspectRatio;else if(b.width)b.height=c.width/this.aspectRatio;if(d=="sw"){b.left=a.left+(c.width-b.width);b.top=
|
| 170 |
+
null}if(d=="nw"){b.top=a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this.options,c=this.axis,d=l(b.width)&&a.maxWidth&&a.maxWidth<b.width,f=l(b.height)&&a.maxHeight&&a.maxHeight<b.height,g=l(b.width)&&a.minWidth&&a.minWidth>b.width,h=l(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+
|
| 171 |
+
this.size.height,k=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&k)b.left=i-a.minWidth;if(d&&k)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a<this._proportionallyResizeElements.length;a++){var c=this._proportionallyResizeElements[a];if(!this.borderDif){var d=
|
| 172 |
+
[c.css("borderTopWidth"),c.css("borderRightWidth"),c.css("borderBottomWidth"),c.css("borderLeftWidth")],f=[c.css("paddingTop"),c.css("paddingRight"),c.css("paddingBottom"),c.css("paddingLeft")];this.borderDif=e.map(d,function(g,h){g=parseInt(g,10)||0;h=parseInt(f[h],10)||0;return g+h})}e.browser.msie&&(e(b).is(":hidden")||e(b).parents(":hidden").length)||c.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=
|
| 173 |
+
this.options;this.elementOffset=this.element.offset();if(this._helper){this.helper=this.helper||e('<div style="overflow:hidden;"></div>');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,
|
| 174 |
+
a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,
|
| 175 |
+
c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]);b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,
|
| 176 |
+
originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.12"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(),10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=
|
| 177 |
+
b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top-f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var k=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:k.parents(a.originalElement[0]).length?["width","height"]:["width",
|
| 178 |
+
"height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(k.css("position"))){c._revertToRelativePosition=true;k.css({position:"absolute",top:"auto",left:"auto"})}k.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType?e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};
|
| 179 |
+
if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a=e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-
|
| 180 |
+
g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,
|
| 181 |
+
height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=
|
| 182 |
+
e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset;var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,
|
| 183 |
+
d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left:a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?
|
| 184 |
+
d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top-d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=
|
| 185 |
+
a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition,f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&
|
| 186 |
+
/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");
|
| 187 |
+
b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b=e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/
|
| 188 |
+
(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},l=function(b){return!isNaN(parseInt(b,10))}})(jQuery);
|
| 189 |
+
;/*
|
| 190 |
+
* jQuery UI Selectable 1.8.12
|
| 191 |
+
*
|
| 192 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 193 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 194 |
+
* http://jquery.org/license
|
| 195 |
+
*
|
| 196 |
+
* http://docs.jquery.com/UI/Selectables
|
| 197 |
+
*
|
| 198 |
+
* Depends:
|
| 199 |
+
* jquery.ui.core.js
|
| 200 |
+
* jquery.ui.mouse.js
|
| 201 |
+
* jquery.ui.widget.js
|
| 202 |
+
*/
|
| 203 |
+
(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),
|
| 204 |
+
selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX,
|
| 205 |
+
c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting",
|
| 206 |
+
c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d=
|
| 207 |
+
this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.right<b||a.top>i||a.bottom<g);else if(d.tolerance=="fit")k=a.left>b&&a.right<h&&a.top>g&&a.bottom<i;if(k){if(a.selected){a.$element.removeClass("ui-selected");a.selected=false}if(a.unselecting){a.$element.removeClass("ui-unselecting");
|
| 208 |
+
a.unselecting=false}if(!a.selecting){a.$element.addClass("ui-selecting");a.selecting=true;f._trigger("selecting",c,{selecting:a.element})}}else{if(a.selecting)if(c.metaKey&&a.startselected){a.$element.removeClass("ui-selecting");a.selecting=false;a.$element.addClass("ui-selected");a.selected=true}else{a.$element.removeClass("ui-selecting");a.selecting=false;if(a.startselected){a.$element.addClass("ui-unselecting");a.unselecting=true}f._trigger("unselecting",c,{unselecting:a.element})}if(a.selected)if(!c.metaKey&&
|
| 209 |
+
!a.startselected){a.$element.removeClass("ui-selected");a.selected=false;a.$element.addClass("ui-unselecting");a.unselecting=true;f._trigger("unselecting",c,{unselecting:a.element})}}}});return false}},_mouseStop:function(c){var f=this;this.dragged=false;e(".ui-unselecting",this.element[0]).each(function(){var d=e.data(this,"selectable-item");d.$element.removeClass("ui-unselecting");d.unselecting=false;d.startselected=false;f._trigger("unselected",c,{unselected:d.element})});e(".ui-selecting",this.element[0]).each(function(){var d=
|
| 210 |
+
e.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected");d.selecting=false;d.selected=true;d.startselected=true;f._trigger("selected",c,{selected:d.element})});this._trigger("stop",c);this.helper.remove();return false}});e.extend(e.ui.selectable,{version:"1.8.12"})})(jQuery);
|
| 211 |
+
;/*
|
| 212 |
+
* jQuery UI Sortable 1.8.12
|
| 213 |
+
*
|
| 214 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 215 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 216 |
+
* http://jquery.org/license
|
| 217 |
+
*
|
| 218 |
+
* http://docs.jquery.com/UI/Sortables
|
| 219 |
+
*
|
| 220 |
+
* Depends:
|
| 221 |
+
* jquery.ui.core.js
|
| 222 |
+
* jquery.ui.mouse.js
|
| 223 |
+
* jquery.ui.widget.js
|
| 224 |
+
*/
|
| 225 |
+
(function(d){d.widget("ui.sortable",d.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){this.containerCache={};this.element.addClass("ui-sortable");
|
| 226 |
+
this.refresh();this.floating=this.items.length?/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a==="disabled"){this.options[a]=
|
| 227 |
+
b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&&!b){var f=false;
|
| 228 |
+
d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-
|
| 229 |
+
this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};
|
| 230 |
+
this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!=
|
| 231 |
+
document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a);
|
| 232 |
+
return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop+b.scrollSpeed;else if(a.pageY-this.overflowOffset.top<
|
| 233 |
+
b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop-b.scrollSpeed;if(this.overflowOffset.left+this.scrollParent[0].offsetWidth-a.pageX<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft+b.scrollSpeed;else if(a.pageX-this.overflowOffset.left<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft-b.scrollSpeed}else{if(a.pageY-d(document).scrollTop()<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()-
|
| 234 |
+
b.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()+b.scrollSpeed);if(a.pageX-d(document).scrollLeft()<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()-b.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()+b.scrollSpeed)}c!==false&&d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,
|
| 235 |
+
a)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(b=this.items.length-1;b>=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0],
|
| 236 |
+
e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset();
|
| 237 |
+
c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp({target:null});this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):
|
| 238 |
+
this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}if(this.placeholder){this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null,
|
| 239 |
+
dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):d(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")},
|
| 240 |
+
toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+j<k&&b+l>g&&b+l<h;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||
|
| 241 |
+
this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?j:g<b+this.helperProportions.width/2&&c-this.helperProportions.width/2<h&&i<e+this.helperProportions.height/2&&f-this.helperProportions.height/2<k},_intersectsWithPointer:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left,a.width);b=b&&a;a=this._getDragVerticalDirection();
|
| 242 |
+
var c=this._getDragHorizontalDirection();if(!b)return false;return this.floating?c&&c=="right"||a=="down"?2:1:a&&(a=="down"?2:1)},_intersectsWithSides:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top+a.height/2,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left+a.width/2,a.width);var c=this._getDragVerticalDirection(),e=this._getDragHorizontalDirection();return this.floating&&e?e=="right"&&a||e=="left"&&!a:c&&(c=="down"&&b||c=="up"&&!b)},
|
| 243 |
+
_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return a!=0&&(a>0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith();
|
| 244 |
+
if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),
|
| 245 |
+
this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),b=0;b<this.items.length;b++)for(var c=0;c<a.length;c++)a[c]==this.items[b].item[0]&&this.items.splice(b,1)},_refreshItems:function(a){this.items=[];this.containers=[this];var b=this.items,c=[[d.isFunction(this.options.items)?this.options.items.call(this.element[0],a,{item:this.currentItem}):d(this.options.items,this.element),
|
| 246 |
+
this]],e=this._connectWith();if(e)for(var f=e.length-1;f>=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h<g;h++){i=d(e[h]);i.data("sortable-item",a);b.push({item:i,instance:a,width:0,height:0,left:0,top:0})}}},refreshPositions:function(a){if(this.offsetParent&&
|
| 247 |
+
this.helper)this.offset.parent=this._getParentOffset();for(var b=this.items.length-1;b>=0;b--){var c=this.items[b];if(!(c.instance!=this.currentContainer&&this.currentContainer&&c.item[0]!=this.currentItem[0])){var e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b=
|
| 248 |
+
this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f=
|
| 249 |
+
d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||
|
| 250 |
+
0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out",
|
| 251 |
+
a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h-
|
| 252 |
+
f)<b){b=Math.abs(h-f);e=this.items[g]}}if(e||this.options.dropOnEmpty){this.currentContainer=this.containers[c];e?this._rearrange(a,e,null,true):this._rearrange(a,null,this.containers[c].element,true);this._trigger("change",a,this._uiHash());this.containers[c]._trigger("change",a,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}}},_createHelper:function(a){var b=
|
| 253 |
+
this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a,this.currentItem])):b.helper=="clone"?this.currentItem.clone():this.currentItem;a.parents("body").length||d(b.appendTo!="parent"?b.appendTo:this.currentItem[0].parentNode)[0].appendChild(a[0]);if(a[0]==this.currentItem[0])this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};if(a[0].style.width==
|
| 254 |
+
""||b.forceHelperSize)a.width(this.currentItem.width());if(a[0].style.height==""||b.forceHelperSize)a.height(this.currentItem.height());return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=
|
| 255 |
+
this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a=
|
| 256 |
+
{top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),
|
| 257 |
+
10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,d(a.containment=="document"?
|
| 258 |
+
document:window).width()-this.helperProportions.width-this.margins.left,(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)){var b=d(a.containment)[0];a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),
|
| 259 |
+
10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(a,b){if(!b)b=
|
| 260 |
+
this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&
|
| 261 |
+
this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0]))this.offset.relative=this._getRelativeOffset();
|
| 262 |
+
var f=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])f=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-
|
| 263 |
+
this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;f=this.originalPageX+Math.round((f-this.originalPageX)/b.grid[0])*b.grid[0];f=this.containment?!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:!(f-this.offset.click.left<this.containment[0])?f-b.grid[0]:f+b.grid[0]:f}}return{top:g-
|
| 264 |
+
this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())}},_rearrange:function(a,b,c,e){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],
|
| 265 |
+
this.direction=="down"?b.item[0]:b.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var f=this,g=this.counter;window.setTimeout(function(){g==f.counter&&f.refreshPositions(!e)},0)},_clear:function(a,b){this.reverting=false;var c=[];!this._noFinalSort&&this.currentItem[0].parentNode&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var e in this._storedCSS)if(this._storedCSS[e]=="auto"||this._storedCSS[e]=="static")this._storedCSS[e]=
|
| 266 |
+
"";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!b&&c.push(function(f){this._trigger("receive",f,this._uiHash(this.fromOutside))});if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!b)c.push(function(f){this._trigger("update",f,this._uiHash())});if(!d.ui.contains(this.element[0],this.currentItem[0])){b||c.push(function(f){this._trigger("remove",
|
| 267 |
+
f,this._uiHash())});for(e=this.containers.length-1;e>=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this,
|
| 268 |
+
this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop",
|
| 269 |
+
a,this._uiHash());for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}return false}b||this._trigger("beforeStop",a,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!b){for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){d.Widget.prototype._trigger.apply(this,arguments)===false&&this.cancel()},
|
| 270 |
+
_uiHash:function(a){var b=a||this;return{helper:b.helper,placeholder:b.placeholder||d([]),position:b.position,originalPosition:b.originalPosition,offset:b.positionAbs,item:b.currentItem,sender:a?a.element:null}}});d.extend(d.ui.sortable,{version:"1.8.12"})})(jQuery);
|
| 271 |
+
;/*
|
| 272 |
+
* jQuery UI Accordion 1.8.12
|
| 273 |
+
*
|
| 274 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 275 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 276 |
+
* http://jquery.org/license
|
| 277 |
+
*
|
| 278 |
+
* http://docs.jquery.com/UI/Accordion
|
| 279 |
+
*
|
| 280 |
+
* Depends:
|
| 281 |
+
* jquery.ui.core.js
|
| 282 |
+
* jquery.ui.widget.js
|
| 283 |
+
*/
|
| 284 |
+
(function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");
|
| 285 |
+
a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
|
| 286 |
+
if(b.navigation){var d=a.element.find("a").filter(b.navigationFilter).eq(0);if(d.length){var h=d.closest(".ui-accordion-header");a.active=h.length?h:d.closest(".ui-accordion-content").prev()}}a.active=a._findActive(a.active||b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");a.active.next().addClass("ui-accordion-content-active");a._createIcons();a.resize();a.element.attr("role","tablist");a.headers.attr("role","tab").bind("keydown.accordion",
|
| 287 |
+
function(f){return a._keydown(f)}).next().attr("role","tabpanel");a.headers.not(a.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();a.active.length?a.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):a.headers.eq(0).attr("tabIndex",0);c.browser.safari||a.headers.find("a").attr("tabIndex",-1);b.event&&a.headers.bind(b.event.split(" ").join(".accordion ")+".accordion",function(f){a._clickHandler.call(a,f,this);f.preventDefault()})},_createIcons:function(){var a=
|
| 288 |
+
this.options;if(a.icons){c("<span></span>").addClass("ui-icon "+a.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex");
|
| 289 |
+
this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(a.autoHeight||a.fillHeight)b.css("height","");return c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons();
|
| 290 |
+
b&&this._createIcons()}if(a=="disabled")this.headers.add(this.headers.next())[b?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(a){if(!(this.options.disabled||a.altKey||a.ctrlKey)){var b=c.ui.keyCode,d=this.headers.length,h=this.headers.index(a.target),f=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:f=this.headers[(h+1)%d];break;case b.LEFT:case b.UP:f=this.headers[(h-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},a.target);
|
| 291 |
+
a.preventDefault()}if(f){c(a.target).attr("tabIndex",-1);c(f).attr("tabIndex",0);f.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+
|
| 292 |
+
c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height("").height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a==="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=this.options;
|
| 293 |
+
if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]===this.active[0];d.active=d.collapsible&&b?false:this.headers.index(a);if(!(this.running||!d.collapsible&&b)){var h=this.active;j=a.next();g=this.active.next();e={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):j,oldContent:g};var f=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(j,g,e,b,f);h.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);
|
| 294 |
+
if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);a.next().addClass("ui-accordion-content-active")}}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var g=this.active.next(),
|
| 295 |
+
e={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:g},j=this.active=c([]);this._toggle(j,g,e)}},_toggle:function(a,b,d,h,f){var g=this,e=g.options;g.toShow=a;g.toHide=b;g.data=d;var j=function(){if(g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data);g.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&h?{toShow:c([]),toHide:b,complete:j,down:f,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:j,down:f,autoHeight:e.autoHeight||
|
| 296 |
+
e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;h=c.ui.accordion.animations;var i=e.duration,k=e.animated;if(k&&!h[k]&&!c.easing[k])k="slide";h[k]||(h[k]=function(l){this.slide(l,{easing:k,duration:i||700})});h[k](d)}else{if(e.collapsible&&h)a.toggle();else{b.hide();a.show()}j(true)}b.prev().attr({"aria-expanded":"false",
|
| 297 |
+
"aria-selected":"false",tabIndex:-1}).blur();a.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length)this.toHide.parent()[0].className=this.toHide.parent()[0].className;this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,{version:"1.8.12",
|
| 298 |
+
animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),h=0,f={},g={},e;b=a.toShow;e=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(j,i){g[i]="hide";j=(""+c.css(a.toShow[0],i)).match(/^([\d+-.]+)(.*)$/);
|
| 299 |
+
f[i]={value:j[1],unit:j[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(g,{step:function(j,i){if(i.prop=="height")h=i.end-i.start===0?0:(i.now-i.start)/(i.end-i.start);a.toShow[0].style[i.prop]=h*f[i.prop].value+f[i.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css({width:e,overflow:d});a.complete()}})}else a.toHide.animate({height:"hide",
|
| 300 |
+
paddingTop:"hide",paddingBottom:"hide"},a);else a.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery);
|
| 301 |
+
;/*
|
| 302 |
+
* jQuery UI Autocomplete 1.8.12
|
| 303 |
+
*
|
| 304 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 305 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 306 |
+
* http://jquery.org/license
|
| 307 |
+
*
|
| 308 |
+
* http://docs.jquery.com/UI/Autocomplete
|
| 309 |
+
*
|
| 310 |
+
* Depends:
|
| 311 |
+
* jquery.ui.core.js
|
| 312 |
+
* jquery.ui.widget.js
|
| 313 |
+
* jquery.ui.position.js
|
| 314 |
+
*/
|
| 315 |
+
(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readonly"))){g=
|
| 316 |
+
false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=
|
| 317 |
+
a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};
|
| 318 |
+
this.menu=d("<ul></ul>").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&&
|
| 319 |
+
a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");
|
| 320 |
+
d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&
|
| 321 |
+
b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source=
|
| 322 |
+
this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==false)return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(!this.options.disabled&&a&&a.length){a=this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();
|
| 323 |
+
this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",a)}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return d.map(a,function(b){if(typeof b==="string")return{label:b,value:b};return d.extend({label:b.label||
|
| 324 |
+
b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();b.show();this._resizeMenu();b.position(d.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new d.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,b){var g=this;
|
| 325 |
+
d.each(b,function(c,f){g._renderItem(a,f)})},_renderItem:function(a,b){return d("<li></li>").data("item.autocomplete",b).append(d("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
|
| 326 |
+
"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery);
|
| 327 |
+
(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
|
| 328 |
+
-1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.attr("scrollTop"),c=this.element.height();if(b<0)this.element.attr("scrollTop",g+b);else b>=c&&this.element.attr("scrollTop",g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},
|
| 329 |
+
deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);
|
| 330 |
+
e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,
|
| 331 |
+
g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));
|
| 332 |
+
this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight")},select:function(e){this._trigger("selected",e,{item:this.active})}})})(jQuery);
|
| 333 |
+
;/*
|
| 334 |
+
* jQuery UI Button 1.8.12
|
| 335 |
+
*
|
| 336 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 337 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 338 |
+
* http://jquery.org/license
|
| 339 |
+
*
|
| 340 |
+
* http://docs.jquery.com/UI/Button
|
| 341 |
+
*
|
| 342 |
+
* Depends:
|
| 343 |
+
* jquery.ui.core.js
|
| 344 |
+
* jquery.ui.widget.js
|
| 345 |
+
*/
|
| 346 |
+
(function(a){var g,i=function(b){a(":ui-button",b.target.form).each(function(){var c=a(this).data("button");setTimeout(function(){c.refresh()},1)})},h=function(b){var c=b.name,d=b.form,f=a([]);if(c)f=d?a(d).find("[name='"+c+"']"):a("[name='"+c+"']",b.ownerDocument).filter(function(){return!this.form});return f};a.widget("ui.button",{options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",
|
| 347 |
+
i);if(typeof this.options.disabled!=="boolean")this.options.disabled=this.element.attr("disabled");this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var b=this,c=this.options,d=this.type==="checkbox"||this.type==="radio",f="ui-state-hover"+(!d?" ui-state-active":"");if(c.label===null)c.label=this.buttonElement.html();if(this.element.is(":disabled"))c.disabled=true;this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button",
|
| 348 |
+
function(){if(!c.disabled){a(this).addClass("ui-state-hover");this===g&&a(this).addClass("ui-state-active")}}).bind("mouseleave.button",function(){c.disabled||a(this).removeClass(f)}).bind("focus.button",function(){a(this).addClass("ui-state-focus")}).bind("blur.button",function(){a(this).removeClass("ui-state-focus")});d&&this.element.bind("change.button",function(){b.refresh()});if(this.type==="checkbox")this.buttonElement.bind("click.button",function(){if(c.disabled)return false;a(this).toggleClass("ui-state-active");
|
| 349 |
+
b.buttonElement.attr("aria-pressed",b.element[0].checked)});else if(this.type==="radio")this.buttonElement.bind("click.button",function(){if(c.disabled)return false;a(this).addClass("ui-state-active");b.buttonElement.attr("aria-pressed",true);var e=b.element[0];h(e).not(e).map(function(){return a(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed",false)});else{this.buttonElement.bind("mousedown.button",function(){if(c.disabled)return false;a(this).addClass("ui-state-active");
|
| 350 |
+
g=this;a(document).one("mouseup",function(){g=null})}).bind("mouseup.button",function(){if(c.disabled)return false;a(this).removeClass("ui-state-active")}).bind("keydown.button",function(e){if(c.disabled)return false;if(e.keyCode==a.ui.keyCode.SPACE||e.keyCode==a.ui.keyCode.ENTER)a(this).addClass("ui-state-active")}).bind("keyup.button",function(){a(this).removeClass("ui-state-active")});this.buttonElement.is("a")&&this.buttonElement.keyup(function(e){e.keyCode===a.ui.keyCode.SPACE&&a(this).click()})}this._setOption("disabled",
|
| 351 |
+
c.disabled)},_determineButtonType:function(){this.type=this.element.is(":checkbox")?"checkbox":this.element.is(":radio")?"radio":this.element.is("input")?"input":"button";if(this.type==="checkbox"||this.type==="radio"){var b=this.element.parents().filter(":last"),c="label[for="+this.element.attr("id")+"]";this.buttonElement=b.find(c);if(!this.buttonElement.length){b=b.length?b.siblings():this.element.siblings();this.buttonElement=b.filter(c);if(!this.buttonElement.length)this.buttonElement=b.find(c)}this.element.addClass("ui-helper-hidden-accessible");
|
| 352 |
+
(b=this.element.is(":checked"))&&this.buttonElement.addClass("ui-state-active");this.buttonElement.attr("aria-pressed",b)}else this.buttonElement=this.element},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-state-hover ui-state-active ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only").removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());
|
| 353 |
+
this.hasTitle||this.buttonElement.removeAttr("title");a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);if(b==="disabled")c?this.element.attr("disabled",true):this.element.removeAttr("disabled");this._resetButton()},refresh:function(){var b=this.element.is(":disabled");b!==this.options.disabled&&this._setOption("disabled",b);if(this.type==="radio")h(this.element[0]).each(function(){a(this).is(":checked")?a(this).button("widget").addClass("ui-state-active").attr("aria-pressed",
|
| 354 |
+
true):a(this).button("widget").removeClass("ui-state-active").attr("aria-pressed",false)});else if(this.type==="checkbox")this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed",true):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed",false)},_resetButton:function(){if(this.type==="input")this.options.label&&this.element.val(this.options.label);else{var b=this.buttonElement.removeClass("ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only"),
|
| 355 |
+
c=a("<span></span>").addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,f=d.primary&&d.secondary,e=[];if(d.primary||d.secondary){if(this.options.text)e.push("ui-button-text-icon"+(f?"s":d.primary?"-primary":"-secondary"));d.primary&&b.prepend("<span class='ui-button-icon-primary ui-icon "+d.primary+"'></span>");d.secondary&&b.append("<span class='ui-button-icon-secondary ui-icon "+d.secondary+"'></span>");if(!this.options.text){e.push(f?"ui-button-icons-only":
|
| 356 |
+
"ui-button-icon-only");this.hasTitle||b.attr("title",c)}}else e.push("ui-button-text-only");b.addClass(e.join(" "))}}});a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c);a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass("ui-corner-left").end().filter(":last").addClass("ui-corner-right").end().end()},
|
| 357 |
+
destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");a.Widget.prototype.destroy.call(this)}})})(jQuery);
|
| 358 |
+
;/*
|
| 359 |
+
* jQuery UI Dialog 1.8.12
|
| 360 |
+
*
|
| 361 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 362 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 363 |
+
* http://jquery.org/license
|
| 364 |
+
*
|
| 365 |
+
* http://docs.jquery.com/UI/Dialog
|
| 366 |
+
*
|
| 367 |
+
* Depends:
|
| 368 |
+
* jquery.ui.core.js
|
| 369 |
+
* jquery.ui.widget.js
|
| 370 |
+
* jquery.ui.button.js
|
| 371 |
+
* jquery.ui.draggable.js
|
| 372 |
+
* jquery.ui.mouse.js
|
| 373 |
+
* jquery.ui.position.js
|
| 374 |
+
* jquery.ui.resizable.js
|
| 375 |
+
*/
|
| 376 |
+
(function(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,
|
| 377 |
+
position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+
|
| 378 |
+
b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),
|
| 379 |
+
h=c('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("<span></span>")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("<span></span>").addClass("ui-dialog-title").attr("id",
|
| 380 |
+
e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");
|
| 381 |
+
a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==
|
| 382 |
+
b.uiDialog[0]){e=c(this).css("z-index");isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+=
|
| 383 |
+
1;d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===
|
| 384 |
+
f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,
|
| 385 |
+
function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;var i=c('<button type="button"></button>').click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.each(h,function(j,k){if(j!=="click")j in o?i[j](k):i.attr(j,k)});c.fn.button&&i.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",
|
| 386 |
+
handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,
|
| 387 |
+
originalSize:f.originalSize,position:f.position,size:f.size}}a=a===l?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",
|
| 388 |
+
f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):
|
| 389 |
+
[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f);
|
| 390 |
+
if(g in m)e=true;if(g in n)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):
|
| 391 |
+
e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||" "));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a=
|
| 392 |
+
this.options,b,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height-
|
| 393 |
+
b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.12",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),
|
| 394 |
+
create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()<c.ui.dialog.overlay.maxZ)return false})},1);c(document).bind("keydown.dialog-overlay",function(d){if(a.options.closeOnEscape&&d.keyCode&&d.keyCode===c.ui.keyCode.ESCAPE){a.close(d);d.preventDefault()}});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var b=(this.oldInstances.pop()||c("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),
|
| 395 |
+
height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);
|
| 396 |
+
b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a<b?c(window).height()+"px":a+"px"}else return c(document).height()+"px"},width:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);return a<b?c(window).width()+"px":a+"px"}else return c(document).width()+"px"},resize:function(){var a=c([]);c.each(c.ui.dialog.overlay.instances,
|
| 397 |
+
function(){a=a.add(this)});a.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
|
| 398 |
+
;/*
|
| 399 |
+
* jQuery UI Slider 1.8.12
|
| 400 |
+
*
|
| 401 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 402 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 403 |
+
* http://jquery.org/license
|
| 404 |
+
*
|
| 405 |
+
* http://docs.jquery.com/UI/Slider
|
| 406 |
+
*
|
| 407 |
+
* Depends:
|
| 408 |
+
* jquery.ui.core.js
|
| 409 |
+
* jquery.ui.mouse.js
|
| 410 |
+
* jquery.ui.widget.js
|
| 411 |
+
*/
|
| 412 |
+
(function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var b=this,a=this.options;this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");a.disabled&&this.element.addClass("ui-slider-disabled ui-disabled");
|
| 413 |
+
this.range=d([]);if(a.range){if(a.range===true){this.range=d("<div></div>");if(!a.values)a.values=[this._valueMin(),this._valueMin()];if(a.values.length&&a.values.length!==2)a.values=[a.values[0],a.values[0]]}else this.range=d("<div></div>");this.range.appendTo(this.element).addClass("ui-slider-range");if(a.range==="min"||a.range==="max")this.range.addClass("ui-slider-range-"+a.range);this.range.addClass("ui-widget-header")}d(".ui-slider-handle",this.element).length===0&&d("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");
|
| 414 |
+
if(a.values&&a.values.length)for(;d(".ui-slider-handle",this.element).length<a.values.length;)d("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");this.handles=d(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(c){c.preventDefault()}).hover(function(){a.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(a.disabled)d(this).blur();
|
| 415 |
+
else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(c){d(this).data("index.ui-slider-handle",c)});this.handles.keydown(function(c){var e=true,f=d(this).data("index.ui-slider-handle"),h,g,i;if(!b.options.disabled){switch(c.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:e=
|
| 416 |
+
false;if(!b._keySliding){b._keySliding=true;d(this).addClass("ui-state-active");h=b._start(c,f);if(h===false)return}break}i=b.options.step;h=b.options.values&&b.options.values.length?(g=b.values(f)):(g=b.value());switch(c.keyCode){case d.ui.keyCode.HOME:g=b._valueMin();break;case d.ui.keyCode.END:g=b._valueMax();break;case d.ui.keyCode.PAGE_UP:g=b._trimAlignValue(h+(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:g=b._trimAlignValue(h-(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(h===
|
| 417 |
+
b._valueMax())return;g=b._trimAlignValue(h+i);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(h===b._valueMin())return;g=b._trimAlignValue(h-i);break}b._slide(c,f,g);return e}}).keyup(function(c){var e=d(this).data("index.ui-slider-handle");if(b._keySliding){b._keySliding=false;b._stop(c,e);b._change(c,e);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");
|
| 418 |
+
this._mouseDestroy();return this},_mouseCapture:function(b){var a=this.options,c,e,f,h,g;if(a.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:b.pageX,y:b.pageY});e=this._valueMax()-this._valueMin()+1;h=this;this.handles.each(function(i){var j=Math.abs(c-h.values(i));if(e>j){e=j;f=d(this);g=i}});if(a.range===true&&this.values(1)===a.min){g+=1;f=d(this.handles[g])}if(this._start(b,
|
| 419 |
+
g)===false)return false;this._mouseSliding=true;h._handleIndex=g;f.addClass("ui-state-active").focus();a=f.offset();this._clickOffset=!d(b.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:b.pageX-a.left-f.width()/2,top:b.pageY-a.top-f.height()/2-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(b,g,c);return this._animateOff=true},_mouseStart:function(){return true},
|
| 420 |
+
_mouseDrag:function(b){var a=this._normValueFromMouse({x:b.pageX,y:b.pageY});this._slide(b,this._handleIndex,a);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(b){var a;
|
| 421 |
+
if(this.orientation==="horizontal"){a=this.elementSize.width;b=b.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{a=this.elementSize.height;b=b.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}a=b/a;if(a>1)a=1;if(a<0)a=0;if(this.orientation==="vertical")a=1-a;b=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+a*b)},_start:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=
|
| 422 |
+
this.values(a);c.values=this.values()}return this._trigger("start",b,c)},_slide:function(b,a,c){var e;if(this.options.values&&this.options.values.length){e=this.values(a?0:1);if(this.options.values.length===2&&this.options.range===true&&(a===0&&c>e||a===1&&c<e))c=e;if(c!==this.values(a)){e=this.values();e[a]=c;b=this._trigger("slide",b,{handle:this.handles[a],value:c,values:e});this.values(a?0:1);b!==false&&this.values(a,c,true)}}else if(c!==this.value()){b=this._trigger("slide",b,{handle:this.handles[a],
|
| 423 |
+
value:c});b!==false&&this.value(c)}},_stop:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(a);c.values=this.values()}this._trigger("stop",b,c)},_change:function(b,a){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(a);c.values=this.values()}this._trigger("change",b,c)}},value:function(b){if(arguments.length){this.options.value=
|
| 424 |
+
this._trimAlignValue(b);this._refreshValue();this._change(null,0)}else return this._value()},values:function(b,a){var c,e,f;if(arguments.length>1){this.options.values[b]=this._trimAlignValue(a);this._refreshValue();this._change(null,b)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;e=arguments[0];for(f=0;f<c.length;f+=1){c[f]=this._trimAlignValue(e[f]);this._change(null,f)}this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(b):
|
| 425 |
+
this.value();else return this._values()},_setOption:function(b,a){var c,e=0;if(d.isArray(this.options.values))e=this.options.values.length;d.Widget.prototype._setOption.apply(this,arguments);switch(b){case "disabled":if(a){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled");this.element.addClass("ui-disabled")}else{this.handles.removeAttr("disabled");this.element.removeClass("ui-disabled")}break;case "orientation":this._detectOrientation();
|
| 426 |
+
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<e;c+=1)this._change(null,c);this._animateOff=false;break}},_value:function(){var b=this.options.value;return b=this._trimAlignValue(b)},_values:function(b){var a,c;if(arguments.length){a=this.options.values[b];
|
| 427 |
+
return a=this._trimAlignValue(a)}else{a=this.options.values.slice();for(c=0;c<a.length;c+=1)a[c]=this._trimAlignValue(a[c]);return a}},_trimAlignValue:function(b){if(b<=this._valueMin())return this._valueMin();if(b>=this._valueMax())return this._valueMax();var a=this.options.step>0?this.options.step:1,c=(b-this._valueMin())%a;alignValue=b-c;if(Math.abs(c)*2>=a)alignValue+=c>0?a:-a;return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},
|
| 428 |
+
_refreshValue:function(){var b=this.options.range,a=this.options,c=this,e=!this._animateOff?a.animate:false,f,h={},g,i,j,l;if(this.options.values&&this.options.values.length)this.handles.each(function(k){f=(c.values(k)-c._valueMin())/(c._valueMax()-c._valueMin())*100;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";d(this).stop(1,1)[e?"animate":"css"](h,a.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(k===0)c.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},a.animate);
|
| 429 |
+
if(k===1)c.range[e?"animate":"css"]({width:f-g+"%"},{queue:false,duration:a.animate})}else{if(k===0)c.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},a.animate);if(k===1)c.range[e?"animate":"css"]({height:f-g+"%"},{queue:false,duration:a.animate})}g=f});else{i=this.value();j=this._valueMin();l=this._valueMax();f=l!==j?(i-j)/(l-j)*100:0;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";this.handle.stop(1,1)[e?"animate":"css"](h,a.animate);if(b==="min"&&this.orientation==="horizontal")this.range.stop(1,
|
| 430 |
+
1)[e?"animate":"css"]({width:f+"%"},a.animate);if(b==="max"&&this.orientation==="horizontal")this.range[e?"animate":"css"]({width:100-f+"%"},{queue:false,duration:a.animate});if(b==="min"&&this.orientation==="vertical")this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},a.animate);if(b==="max"&&this.orientation==="vertical")this.range[e?"animate":"css"]({height:100-f+"%"},{queue:false,duration:a.animate})}}});d.extend(d.ui.slider,{version:"1.8.12"})})(jQuery);
|
| 431 |
+
;/*
|
| 432 |
+
* jQuery UI Tabs 1.8.12
|
| 433 |
+
*
|
| 434 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 435 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 436 |
+
* http://jquery.org/license
|
| 437 |
+
*
|
| 438 |
+
* http://docs.jquery.com/UI/Tabs
|
| 439 |
+
*
|
| 440 |
+
* Depends:
|
| 441 |
+
* jquery.ui.core.js
|
| 442 |
+
* jquery.ui.widget.js
|
| 443 |
+
*/
|
| 444 |
+
(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading…</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&&
|
| 445 |
+
e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=
|
| 446 |
+
d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]||
|
| 447 |
+
(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
|
| 448 |
+
this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected=
|
| 449 |
+
this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");
|
| 450 |
+
if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));
|
| 451 |
+
this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+
|
| 452 |
+
g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal",
|
| 453 |
+
function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")};
|
| 454 |
+
this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected=
|
| 455 |
+
-1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";
|
| 456 |
+
d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=
|
| 457 |
+
d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b,
|
| 458 |
+
e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]);
|
| 459 |
+
j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();
|
| 460 |
+
if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=b}),function(h){return h>=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null,
|
| 461 |
+
this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this},
|
| 462 |
+
load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c,
|
| 463 |
+
"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},
|
| 464 |
+
url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.12"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k<a.anchors.length?k:0)},b);j&&j.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(j){j.clientX&&
|
| 465 |
+
a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow",h);this.anchors.bind(c.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(c.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);
|
| 466 |
+
;/*
|
| 467 |
+
* jQuery UI Datepicker 1.8.12
|
| 468 |
+
*
|
| 469 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 470 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 471 |
+
* http://jquery.org/license
|
| 472 |
+
*
|
| 473 |
+
* http://docs.jquery.com/UI/Datepicker
|
| 474 |
+
*
|
| 475 |
+
* Depends:
|
| 476 |
+
* jquery.ui.core.js
|
| 477 |
+
*/
|
| 478 |
+
(function(d,A){function K(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
|
| 479 |
+
"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
|
| 480 |
+
"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",
|
| 481 |
+
minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}function F(a,b){d.extend(a,b);for(var c in b)if(b[c]==
|
| 482 |
+
null||b[c]==A)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.12"}});var y=(new Date).getTime();d.extend(K.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){F(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase();
|
| 483 |
+
f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}},
|
| 484 |
+
_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&
|
| 485 |
+
b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==
|
| 486 |
+
""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,
|
| 487 |
+
c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),
|
| 488 |
+
true);this._updateDatepicker(b);this._updateAlternate(b);b.dpDiv.show()}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}F(a.settings,e||{});
|
| 489 |
+
b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);
|
| 490 |
+
this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",
|
| 491 |
+
this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().removeClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,
|
| 492 |
+
function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().addClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:
|
| 493 |
+
f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?d.extend({},
|
| 494 |
+
e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&this._hideDatepicker();var h=this._getDateDatepicker(a,true),i=this._getMinMaxDate(e,"min"),g=this._getMinMaxDate(e,"max");F(e.settings,f);if(i!==null&&f.dateFormat!==A&&f.minDate===A)e.settings.minDate=this._formatDate(e,i);if(g!==null&&f.dateFormat!==A&&f.maxDate===A)e.settings.maxDate=this._formatDate(e,g);this._attachments(d(a),e);this._autoSize(e);this._setDateDatepicker(a,h);this._updateDatepicker(e)}},
|
| 495 |
+
_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");
|
| 496 |
+
b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass+":not(."+d.datepicker._currentClass+")",b.dpDiv);c[0]?d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]):d.datepicker._hideDatepicker();return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),
|
| 497 |
+
"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?
|
| 498 |
+
-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,
|
| 499 |
+
+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));var c=String.fromCharCode(a.charCode==A?a.keyCode:a.charCode);return a.ctrlKey||a.metaKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);
|
| 500 |
+
if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);
|
| 501 |
+
d.datepicker._curInst&&d.datepicker._curInst!=b&&d.datepicker._curInst.dpDiv.stop(true,true);var c=d.datepicker._get(b,"beforeShow");F(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=
|
| 502 |
+
document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");
|
| 503 |
+
var f=d.datepicker._get(b,"duration"),h=function(){d.datepicker._datepickerShowing=true;var i=b.dpDiv.find("iframe.ui-datepicker-cover");if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=
|
| 504 |
+
b}}},_updateDatepicker:function(a){var b=this,c=d.datepicker._getBorders(a.dpDiv);a.dpDiv.empty().append(this._generateHTML(a));var e=a.dpDiv.find("iframe.ui-datepicker-cover");e.length&&e.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});a.dpDiv.find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){d(this).removeClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).removeClass("ui-datepicker-prev-hover");
|
| 505 |
+
this.className.indexOf("ui-datepicker-next")!=-1&&d(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){if(!b._isDisabledDatepicker(a.inline?a.dpDiv.parent()[0]:a.input[0])){d(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");d(this).addClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).addClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).addClass("ui-datepicker-next-hover")}}).end().find("."+
|
| 506 |
+
this._dayOverClass+" a").trigger("mouseover").end();c=this._getNumberOfMonths(a);e=c[1];e>1?a.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",17*e+"em"):a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");a.dpDiv[(c[0]!=1||c[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&
|
| 507 |
+
a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var f=a.yearshtml;setTimeout(function(){f===a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);f=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():
|
| 508 |
+
0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),
|
| 509 |
+
"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?
|
| 510 |
+
"fadeOut":"hide"](a?c:null,e);a||e();if(a=this._get(b,"onClose"))a.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a=
|
| 511 |
+
d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=
|
| 512 |
+
d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c==
|
| 513 |
+
"M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var b=this._getInst(d(a)[0]);b.input&&b._selectingMonthYear&&setTimeout(function(){b.input.focus()},0);b._selectingMonthYear=!b._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=
|
| 514 |
+
b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();
|
| 515 |
+
this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);
|
| 516 |
+
a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()%100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?
|
| 517 |
+
c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=z+1<a.length&&a.charAt(z+1)==p)&&z++;return p},m=function(p){var v=o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"&&v?4:p=="o"?3:2)+"}");p=b.substring(s).match(p);if(!p)throw"Missing number at position "+s;s+=p[0].length;return parseInt(p[0],10)},n=function(p,v,H){p=o(p)?H:v;for(v=0;v<p.length;v++)if(b.substr(s,p[v].length).toLowerCase()==p[v].toLowerCase()){s+=p[v].length;return v+1}throw"Unknown name at position "+
|
| 518 |
+
s;},r=function(){if(b.charAt(s)!=a.charAt(z))throw"Unexpected literal at position "+s;s++},s=0,z=0;z<a.length;z++)if(k)if(a.charAt(z)=="'"&&!o("'"))k=false;else r();else switch(a.charAt(z)){case "d":l=m("d");break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":j=m("m");break;case "M":j=n("M",i,g);break;case "y":c=m("y");break;case "@":var w=new Date(m("@"));c=w.getFullYear();j=w.getMonth()+1;l=w.getDate();break;case "!":w=new Date((m("!")-this._ticksTo1970)/1E4);c=w.getFullYear();j=w.getMonth()+
|
| 519 |
+
1;l=w.getDate();break;case "'":if(o("'"))r();else k=true;break;default:r()}if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}w=this._daylightSavingAdjust(new Date(c,j-1,l));if(w.getFullYear()!=c||w.getMonth()+1!=j||w.getDate()!=l)throw"Invalid date";return w},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",
|
| 520 |
+
RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=k+1<a.length&&
|
| 521 |
+
a.charAt(k+1)==o)&&k++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},j=function(o,m,n,r){return i(o)?r[m]:n[m]},l="",u=false;if(b)for(var k=0;k<a.length;k++)if(u)if(a.charAt(k)=="'"&&!i("'"))u=false;else l+=a.charAt(k);else switch(a.charAt(k)){case "d":l+=g("d",b.getDate(),2);break;case "D":l+=j("D",b.getDay(),e,f);break;case "o":l+=g("o",(b.getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864E5,3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=j("M",
|
| 522 |
+
b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+="'";else u=true;break;default:l+=a.charAt(k)}return l},_possibleChars:function(a){for(var b="",c=false,e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+=
|
| 523 |
+
"0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==A?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=
|
| 524 |
+
f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var e=function(h){var i=new Date;i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=
|
| 525 |
+
(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,j=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,k=u.exec(h);k;){switch(k[2]||"d"){case "d":case "D":g+=parseInt(k[1],10);break;case "w":case "W":g+=parseInt(k[1],10)*7;break;case "m":case "M":l+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break;case "y":case "Y":j+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break}k=u.exec(h)}return new Date(j,
|
| 526 |
+
l,g)};if(b=(b=b==null||b===""?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):new Date(b.getTime()))&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=
|
| 527 |
+
a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),
|
| 528 |
+
b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=
|
| 529 |
+
this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&n<k?k:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', -"+j+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+
|
| 530 |
+
(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>";var r=this._get(a,"nextText");r=!h?r:this.formatDate(r,this._daylightSavingAdjust(new Date(m,g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', +"+j+", 'M');\" title=\""+r+'"><span class="ui-icon ui-icon-circle-triangle-'+
|
| 531 |
+
(c?"w":"e")+'">'+r+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+r+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+r+"</span></a>";j=this._get(a,"currentText");r=this._get(a,"gotoCurrent")&&a.currentDay?u:b;j=!h?j:this.formatDate(j,r,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+y+'.datepicker._hideDatepicker();">'+this._get(a,
|
| 532 |
+
"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,r)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._gotoToday('#"+a.id+"');\">"+j+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");r=this._get(a,"dayNames");this._get(a,"dayNamesShort");var s=this._get(a,"dayNamesMin"),z=
|
| 533 |
+
this._get(a,"monthNames"),w=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),v=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var L=this._getDefaultDate(a),I="",D=0;D<i[0];D++){for(var M="",E=0;E<i[1];E++){var N=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",x="";if(l){x+='<div class="ui-datepicker-group';if(i[1]>1)switch(E){case 0:x+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-
|
| 534 |
+
1:x+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:x+=" ui-datepicker-group-middle";t="";break}x+='">'}x+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&D==0?c?f:n:"")+(/all|right/.test(t)&&D==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,D>0||E>0,z,w)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var B=j?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var q=
|
| 535 |
+
(t+h)%7;B+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+r[q]+'">'+s[q]+"</span></th>"}x+=B+"</tr></thead><tbody>";B=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,B);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;B=l?6:Math.ceil((t+B)/7);q=this._daylightSavingAdjust(new Date(m,g,1-t));for(var O=0;O<B;O++){x+="<tr>";var P=!j?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(q)+"</td>";for(t=0;t<7;t++){var G=
|
| 536 |
+
p?p.apply(a.input?a.input[0]:null,[q]):[true,""],C=q.getMonth()!=g,J=C&&!H||!G[0]||k&&q<k||o&&q>o;P+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(C?" ui-datepicker-other-month":"")+(q.getTime()==N.getTime()&&g==a.selectedMonth&&a._keyEvent||L.getTime()==q.getTime()&&L.getTime()==N.getTime()?" "+this._dayOverClass:"")+(J?" "+this._unselectableClass+" ui-state-disabled":"")+(C&&!v?"":" "+G[1]+(q.getTime()==u.getTime()?" "+this._currentClass:"")+(q.getTime()==b.getTime()?" ui-datepicker-today":
|
| 537 |
+
""))+'"'+((!C||v)&&G[2]?' title="'+G[2]+'"':"")+(J?"":' onclick="DP_jQuery_'+y+".datepicker._selectDay('#"+a.id+"',"+q.getMonth()+","+q.getFullYear()+', this);return false;"')+">"+(C&&!v?" ":J?'<span class="ui-state-default">'+q.getDate()+"</span>":'<a class="ui-state-default'+(q.getTime()==b.getTime()?" ui-state-highlight":"")+(q.getTime()==u.getTime()?" ui-state-active":"")+(C?" ui-priority-secondary":"")+'" href="#">'+q.getDate()+"</a>")+"</td>";q.setDate(q.getDate()+1);q=this._daylightSavingAdjust(q)}x+=
|
| 538 |
+
P+"</tr>"}g++;if(g>11){g=0;m++}x+="</tbody></table>"+(l?"</div>"+(i[0]>0&&E==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");M+=x}I+=M}I+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");a._keyEvent=false;return I},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='<div class="ui-datepicker-title">',
|
| 539 |
+
o="";if(h||!j)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+a.id+"');\">";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&(!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(k+=o+(h||!(j&&
|
| 540 |
+
l)?" ":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var r=(new Date).getFullYear();i=function(s){s=s.match(/c[+-].*/)?c+parseInt(s.substring(1),10):s.match(/[+-].*/)?r+parseInt(s,10):parseInt(s,10);return isNaN(s)?r:s};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+
|
| 541 |
+
a.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+a.id+"');\">";b<=g;b++)a.yearshtml+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";a.yearshtml+="</select>";if(d.browser.mozilla)k+='<select class="ui-datepicker-year"><option value="'+c+'" selected="selected">'+c+"</option></select>";else{k+=a.yearshtml;a.yearshtml=null}}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?" ":"")+o;k+="</div>";return k},_adjustInstDate:function(a,b,c){var e=
|
| 542 |
+
a.drawYear+(c=="Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,
|
| 543 |
+
"onChangeMonthYear");if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);
|
| 544 |
+
c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,
|
| 545 |
+
"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=
|
| 546 |
+
function(a){if(!this.length)return this;if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,
|
| 547 |
+
[this[0]].concat(b));return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new K;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.12";window["DP_jQuery_"+y]=d})(jQuery);
|
| 548 |
+
;/*
|
| 549 |
+
* jQuery UI Progressbar 1.8.12
|
| 550 |
+
*
|
| 551 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 552 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 553 |
+
* http://jquery.org/license
|
| 554 |
+
*
|
| 555 |
+
* http://docs.jquery.com/UI/Progressbar
|
| 556 |
+
*
|
| 557 |
+
* Depends:
|
| 558 |
+
* jquery.ui.core.js
|
| 559 |
+
* jquery.ui.widget.js
|
| 560 |
+
*/
|
| 561 |
+
(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");
|
| 562 |
+
this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*
|
| 563 |
+
this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.12"})})(jQuery);
|
| 564 |
+
;/*
|
| 565 |
+
* jQuery UI Effects 1.8.12
|
| 566 |
+
*
|
| 567 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 568 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 569 |
+
* http://jquery.org/license
|
| 570 |
+
*
|
| 571 |
+
* http://docs.jquery.com/UI/Effects/
|
| 572 |
+
*/
|
| 573 |
+
jQuery.effects||function(f,j){function n(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],
|
| 574 |
+
16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return o.transparent;return o[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return n(b)}function p(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,
|
| 575 |
+
a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function q(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d=
|
| 576 |
+
a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function m(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor",
|
| 577 |
+
"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=n(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var o={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,
|
| 578 |
+
0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,
|
| 579 |
+
211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},r=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,
|
| 580 |
+
d){if(f.isFunction(b)){d=b;b=null}return this.queue("fx",function(){var e=f(this),g=e.attr("style")||" ",h=q(p.call(this)),l,v=e.attr("className");f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});l=q(p.call(this));e.attr("className",v);e.animate(u(h,l),a,b,function(){f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)});h=f.queue(this);l=h.splice(h.length-1,1)[0];
|
| 581 |
+
h.splice(1,0,l);f.dequeue(this)})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,
|
| 582 |
+
a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.12",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,
|
| 583 |
+
a){var b;switch(c[0]){case "top":b=0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",
|
| 584 |
+
border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);
|
| 585 |
+
return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(m(c))return this._show.apply(this,arguments);
|
| 586 |
+
else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(m(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(m(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),
|
| 587 |
+
b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,
|
| 588 |
+
a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,
|
| 589 |
+
a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==
|
| 590 |
+
e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=
|
| 591 |
+
g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/
|
| 592 |
+
h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,
|
| 593 |
+
a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b;return f.easing.easeOutBounce(c,a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
|
| 594 |
+
;/*
|
| 595 |
+
* jQuery UI Effects Blind 1.8.12
|
| 596 |
+
*
|
| 597 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 598 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 599 |
+
* http://jquery.org/license
|
| 600 |
+
*
|
| 601 |
+
* http://docs.jquery.com/UI/Effects/Blind
|
| 602 |
+
*
|
| 603 |
+
* Depends:
|
| 604 |
+
* jquery.effects.core.js
|
| 605 |
+
*/
|
| 606 |
+
(function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","bottom","left","right"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a,
|
| 607 |
+
g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery);
|
| 608 |
+
;/*
|
| 609 |
+
* jQuery UI Effects Bounce 1.8.12
|
| 610 |
+
*
|
| 611 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 612 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 613 |
+
* http://jquery.org/license
|
| 614 |
+
*
|
| 615 |
+
* http://docs.jquery.com/UI/Effects/Bounce
|
| 616 |
+
*
|
| 617 |
+
* Depends:
|
| 618 |
+
* jquery.effects.core.js
|
| 619 |
+
*/
|
| 620 |
+
(function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","bottom","left","right"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/
|
| 621 |
+
3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a);
|
| 622 |
+
b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing,function(){e.effects.restore(a,l);e.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments)})}a.queue("fx",function(){a.dequeue()});a.dequeue()})}})(jQuery);
|
| 623 |
+
;/*
|
| 624 |
+
* jQuery UI Effects Clip 1.8.12
|
| 625 |
+
*
|
| 626 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 627 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 628 |
+
* http://jquery.org/license
|
| 629 |
+
*
|
| 630 |
+
* http://docs.jquery.com/UI/Effects/Clip
|
| 631 |
+
*
|
| 632 |
+
* Depends:
|
| 633 |
+
* jquery.effects.core.js
|
| 634 |
+
*/
|
| 635 |
+
(function(b){b.effects.clip=function(e){return this.queue(function(){var a=b(this),i=["position","top","bottom","left","right","height","width"],f=b.effects.setMode(a,e.options.mode||"hide"),c=e.options.direction||"vertical";b.effects.save(a,i);a.show();var d=b.effects.createWrapper(a).css({overflow:"hidden"});d=a[0].tagName=="IMG"?d:a;var g={size:c=="vertical"?"height":"width",position:c=="vertical"?"top":"left"};c=c=="vertical"?d.height():d.width();if(f=="show"){d.css(g.size,0);d.css(g.position,
|
| 636 |
+
c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,{queue:false,duration:e.duration,easing:e.options.easing,complete:function(){f=="hide"&&a.hide();b.effects.restore(a,i);b.effects.removeWrapper(a);e.callback&&e.callback.apply(a[0],arguments);a.dequeue()}})})}})(jQuery);
|
| 637 |
+
;/*
|
| 638 |
+
* jQuery UI Effects Drop 1.8.12
|
| 639 |
+
*
|
| 640 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 641 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 642 |
+
* http://jquery.org/license
|
| 643 |
+
*
|
| 644 |
+
* http://docs.jquery.com/UI/Effects/Drop
|
| 645 |
+
*
|
| 646 |
+
* Depends:
|
| 647 |
+
* jquery.effects.core.js
|
| 648 |
+
*/
|
| 649 |
+
(function(c){c.effects.drop=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right","opacity"],e=c.effects.setMode(a,d.options.mode||"hide"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a);var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true})/2:a.outerWidth({margin:true})/2);if(e=="show")a.css("opacity",0).css(f,b=="pos"?-g:g);var i={opacity:e==
|
| 650 |
+
"show"?1:0};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
|
| 651 |
+
;/*
|
| 652 |
+
* jQuery UI Effects Explode 1.8.12
|
| 653 |
+
*
|
| 654 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 655 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 656 |
+
* http://jquery.org/license
|
| 657 |
+
*
|
| 658 |
+
* http://docs.jquery.com/UI/Effects/Explode
|
| 659 |
+
*
|
| 660 |
+
* Depends:
|
| 661 |
+
* jquery.effects.core.js
|
| 662 |
+
*/
|
| 663 |
+
(function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f=
|
| 664 |
+
0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+
|
| 665 |
+
e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery);
|
| 666 |
+
;/*
|
| 667 |
+
* jQuery UI Effects Fade 1.8.12
|
| 668 |
+
*
|
| 669 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 670 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 671 |
+
* http://jquery.org/license
|
| 672 |
+
*
|
| 673 |
+
* http://docs.jquery.com/UI/Effects/Fade
|
| 674 |
+
*
|
| 675 |
+
* Depends:
|
| 676 |
+
* jquery.effects.core.js
|
| 677 |
+
*/
|
| 678 |
+
(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
|
| 679 |
+
;/*
|
| 680 |
+
* jQuery UI Effects Fold 1.8.12
|
| 681 |
+
*
|
| 682 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 683 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 684 |
+
* http://jquery.org/license
|
| 685 |
+
*
|
| 686 |
+
* http://docs.jquery.com/UI/Effects/Fold
|
| 687 |
+
*
|
| 688 |
+
* Depends:
|
| 689 |
+
* jquery.effects.core.js
|
| 690 |
+
*/
|
| 691 |
+
(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1],
|
| 692 |
+
10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery);
|
| 693 |
+
;/*
|
| 694 |
+
* jQuery UI Effects Highlight 1.8.12
|
| 695 |
+
*
|
| 696 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 697 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 698 |
+
* http://jquery.org/license
|
| 699 |
+
*
|
| 700 |
+
* http://docs.jquery.com/UI/Effects/Highlight
|
| 701 |
+
*
|
| 702 |
+
* Depends:
|
| 703 |
+
* jquery.effects.core.js
|
| 704 |
+
*/
|
| 705 |
+
(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&&
|
| 706 |
+
this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
|
| 707 |
+
;/*
|
| 708 |
+
* jQuery UI Effects Pulsate 1.8.12
|
| 709 |
+
*
|
| 710 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 711 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 712 |
+
* http://jquery.org/license
|
| 713 |
+
*
|
| 714 |
+
* http://docs.jquery.com/UI/Effects/Pulsate
|
| 715 |
+
*
|
| 716 |
+
* Depends:
|
| 717 |
+
* jquery.effects.core.js
|
| 718 |
+
*/
|
| 719 |
+
(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c<times;c++){b.animate({opacity:animateTo},duration,a.options.easing);animateTo=(animateTo+1)%2}b.animate({opacity:animateTo},duration,
|
| 720 |
+
a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery);
|
| 721 |
+
;/*
|
| 722 |
+
* jQuery UI Effects Scale 1.8.12
|
| 723 |
+
*
|
| 724 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 725 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 726 |
+
* http://jquery.org/license
|
| 727 |
+
*
|
| 728 |
+
* http://docs.jquery.com/UI/Effects/Scale
|
| 729 |
+
*
|
| 730 |
+
* Depends:
|
| 731 |
+
* jquery.effects.core.js
|
| 732 |
+
*/
|
| 733 |
+
(function(c){c.effects.puff=function(b){return this.queue(function(){var a=c(this),e=c.effects.setMode(a,b.options.mode||"hide"),g=parseInt(b.options.percent,10)||150,h=g/100,i={height:a.height(),width:a.width()};c.extend(b.options,{fade:true,mode:e,percent:e=="hide"?g:100,from:e=="hide"?i:{height:i.height*h,width:i.width*h}});a.effect("scale",b.options,b.duration,b.callback);a.dequeue()})};c.effects.scale=function(b){return this.queue(function(){var a=c(this),e=c.extend(true,{},b.options),g=c.effects.setMode(a,
|
| 734 |
+
b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:g=="hide"?0:100),i=b.options.direction||"both",f=b.options.origin;if(g!="effect"){e.origin=f||["middle","center"];e.restore=true}f={height:a.height(),width:a.width()};a.from=b.options.from||(g=="show"?{height:0,width:0}:f);h={y:i!="horizontal"?h/100:1,x:i!="vertical"?h/100:1};a.to={height:f.height*h.y,width:f.width*h.x};if(b.options.fade){if(g=="show"){a.from.opacity=0;a.to.opacity=1}if(g=="hide"){a.from.opacity=
|
| 735 |
+
1;a.to.opacity=0}}e.from=a.from;e.to=a.to;e.mode=g;a.effect("size",e,b.duration,b.callback);a.dequeue()})};c.effects.size=function(b){return this.queue(function(){var a=c(this),e=["position","top","bottom","left","right","width","height","overflow","opacity"],g=["position","top","bottom","left","right","overflow","opacity"],h=["width","height","overflow"],i=["fontSize"],f=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],k=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],
|
| 736 |
+
p=c.effects.setMode(a,b.options.mode||"effect"),n=b.options.restore||false,m=b.options.scale||"both",l=b.options.origin,j={height:a.height(),width:a.width()};a.from=b.options.from||j;a.to=b.options.to||j;if(l){l=c.effects.getBaseline(l,j);a.from.top=(j.height-a.from.height)*l.y;a.from.left=(j.width-a.from.width)*l.x;a.to.top=(j.height-a.to.height)*l.y;a.to.left=(j.width-a.to.width)*l.x}var d={from:{y:a.from.height/j.height,x:a.from.width/j.width},to:{y:a.to.height/j.height,x:a.to.width/j.width}};
|
| 737 |
+
if(m=="box"||m=="both"){if(d.from.y!=d.to.y){e=e.concat(f);a.from=c.effects.setTransition(a,f,d.from.y,a.from);a.to=c.effects.setTransition(a,f,d.to.y,a.to)}if(d.from.x!=d.to.x){e=e.concat(k);a.from=c.effects.setTransition(a,k,d.from.x,a.from);a.to=c.effects.setTransition(a,k,d.to.x,a.to)}}if(m=="content"||m=="both")if(d.from.y!=d.to.y){e=e.concat(i);a.from=c.effects.setTransition(a,i,d.from.y,a.from);a.to=c.effects.setTransition(a,i,d.to.y,a.to)}c.effects.save(a,n?e:g);a.show();c.effects.createWrapper(a);
|
| 738 |
+
a.css("overflow","hidden").css(a.from);if(m=="content"||m=="both"){f=f.concat(["marginTop","marginBottom"]).concat(i);k=k.concat(["marginLeft","marginRight"]);h=e.concat(f).concat(k);a.find("*[width]").each(function(){child=c(this);n&&c.effects.save(child,h);var o={height:child.height(),width:child.width()};child.from={height:o.height*d.from.y,width:o.width*d.from.x};child.to={height:o.height*d.to.y,width:o.width*d.to.x};if(d.from.y!=d.to.y){child.from=c.effects.setTransition(child,f,d.from.y,child.from);
|
| 739 |
+
child.to=c.effects.setTransition(child,f,d.to.y,child.to)}if(d.from.x!=d.to.x){child.from=c.effects.setTransition(child,k,d.from.x,child.from);child.to=c.effects.setTransition(child,k,d.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){n&&c.effects.restore(child,h)})})}a.animate(a.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){a.to.opacity===0&&a.css("opacity",a.from.opacity);p=="hide"&&a.hide();c.effects.restore(a,
|
| 740 |
+
n?e:g);c.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
|
| 741 |
+
;/*
|
| 742 |
+
* jQuery UI Effects Shake 1.8.12
|
| 743 |
+
*
|
| 744 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 745 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 746 |
+
* http://jquery.org/license
|
| 747 |
+
*
|
| 748 |
+
* http://docs.jquery.com/UI/Effects/Shake
|
| 749 |
+
*
|
| 750 |
+
* Depends:
|
| 751 |
+
* jquery.effects.core.js
|
| 752 |
+
*/
|
| 753 |
+
(function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","bottom","left","right"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]=
|
| 754 |
+
(h=="pos"?"-=":"+=")+e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++)b.animate(i,f,a.options.easing).animate(k,f,a.options.easing);b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery);
|
| 755 |
+
;/*
|
| 756 |
+
* jQuery UI Effects Slide 1.8.12
|
| 757 |
+
*
|
| 758 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 759 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 760 |
+
* http://jquery.org/license
|
| 761 |
+
*
|
| 762 |
+
* http://docs.jquery.com/UI/Effects/Slide
|
| 763 |
+
*
|
| 764 |
+
* Depends:
|
| 765 |
+
* jquery.effects.core.js
|
| 766 |
+
*/
|
| 767 |
+
(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right"],f=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var g=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var e=d.options.distance||(g=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(f=="show")a.css(g,b=="pos"?isNaN(e)?"-"+e:-e:e);
|
| 768 |
+
var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){f=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
|
| 769 |
+
;/*
|
| 770 |
+
* jQuery UI Effects Transfer 1.8.12
|
| 771 |
+
*
|
| 772 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
| 773 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
| 774 |
+
* http://jquery.org/license
|
| 775 |
+
*
|
| 776 |
+
* http://docs.jquery.com/UI/Effects/Transfer
|
| 777 |
+
*
|
| 778 |
+
* Depends:
|
| 779 |
+
* jquery.effects.core.js
|
| 780 |
+
*/
|
| 781 |
+
(function(e){e.effects.transfer=function(a){return this.queue(function(){var b=e(this),c=e(a.options.to),d=c.offset();c={top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth()};d=b.offset();var f=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments);
|
| 782 |
+
b.dequeue()})})}})(jQuery);
|
| 783 |
+
;
|
skin/adminhtml/default/default/oopsprofile/js/jquery.checkboxtree.js
ADDED
|
@@ -0,0 +1,628 @@
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
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Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
|
|
Â
|
| 1 |
+
/*!
|
| 2 |
+
* jQuery CheckboxTree
|
| 3 |
+
*
|
| 4 |
+
* @author Valerio Galano <v.galano@daredevel.it>
|
| 5 |
+
*
|
| 6 |
+
* @see http://checkboxtree.daredevel.it
|
| 7 |
+
*
|
| 8 |
+
* @version 0.5.2
|
| 9 |
+
*/
|
| 10 |
+
jQuery.noConflict();
|
| 11 |
+
jQuery.widget("daredevel.checkboxTree", {
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Check if all descendant of passed node are checked
|
| 15 |
+
*
|
| 16 |
+
* @private
|
| 17 |
+
*
|
| 18 |
+
* @param li node
|
| 19 |
+
*
|
| 20 |
+
* @return true if all descendant checked
|
| 21 |
+
*/
|
| 22 |
+
_allDescendantChecked: function(li) {
|
| 23 |
+
return (li.find('li input:checkbox:not(:checked)').length == 0);
|
| 24 |
+
},
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Initialize plugin
|
| 28 |
+
*
|
| 29 |
+
* @private
|
| 30 |
+
*/
|
| 31 |
+
_create: function() {
|
| 32 |
+
|
| 33 |
+
var t = this;
|
| 34 |
+
|
| 35 |
+
// setup collapse engine tree
|
| 36 |
+
if (this.options.collapsable) {
|
| 37 |
+
|
| 38 |
+
// build collapse engine's anchors
|
| 39 |
+
this.options.collapseAnchor = (this.options.collapseImage.length > 0) ? '<img src="' + this.options.collapseImage + '" />' : '';
|
| 40 |
+
this.options.expandAnchor = (this.options.expandImage.length > 0) ? '<img src="' + this.options.expandImage + '" />' : '';
|
| 41 |
+
this.options.leafAnchor = (this.options.leafImage.length > 0) ? '<img src="' + this.options.leafImage + '" />' : '';
|
| 42 |
+
|
| 43 |
+
// initialize leafs
|
| 44 |
+
this.element.find("li:not(:has(ul))").each(function() {
|
| 45 |
+
jQuery(this).prepend(jQuery('<span />'));
|
| 46 |
+
t._markAsLeaf(jQuery(this));
|
| 47 |
+
});
|
| 48 |
+
|
| 49 |
+
// initialize checked nodes
|
| 50 |
+
this.element.find("li:has(ul):has(input:checkbox:checked)").each(function() {
|
| 51 |
+
jQuery(this).prepend(jQuery('<span />'));
|
| 52 |
+
t.options.initializeChecked == 'collapsed' ? t.collapse(jQuery(this)) : t.expand(jQuery(this));
|
| 53 |
+
});
|
| 54 |
+
|
| 55 |
+
// initialize unchecked nodes
|
| 56 |
+
this.element.find("li:has(ul):not(:has(input:checkbox:checked))").each(function() {
|
| 57 |
+
jQuery(this).prepend(jQuery('<span />'));
|
| 58 |
+
t.options.initializeUnchecked == 'collapsed' ? t.collapse(jQuery(this)) : t.expand(jQuery(this));
|
| 59 |
+
});
|
| 60 |
+
|
| 61 |
+
// bind collapse/expand event
|
| 62 |
+
this.element.find('li span').live("click", function() {
|
| 63 |
+
var li = jQuery(this).parents("li:first");
|
| 64 |
+
|
| 65 |
+
if (li.hasClass('collapsed')) {
|
| 66 |
+
t.expand(li);
|
| 67 |
+
} else
|
| 68 |
+
|
| 69 |
+
if (li.hasClass('expanded')) {
|
| 70 |
+
t.collapse(li);
|
| 71 |
+
}
|
| 72 |
+
});
|
| 73 |
+
|
| 74 |
+
// bind collapse all element event
|
| 75 |
+
jQuery(this.options.collapseAllElement).bind("click", function() {
|
| 76 |
+
t.collapseAll();
|
| 77 |
+
});
|
| 78 |
+
|
| 79 |
+
// bind expand all element event
|
| 80 |
+
jQuery(this.options.expandAllElement).bind("click", function() {
|
| 81 |
+
t.expandAll();
|
| 82 |
+
});
|
| 83 |
+
|
| 84 |
+
// bind collapse on uncheck event
|
| 85 |
+
if (this.options.onUncheck.node == 'collapse') {
|
| 86 |
+
this.element.find('input:checkbox:not(:checked)').live("click", function() {
|
| 87 |
+
t.collapse(jQuery(this).parents("li:first"));
|
| 88 |
+
});
|
| 89 |
+
} else
|
| 90 |
+
|
| 91 |
+
// bind expand on uncheck event
|
| 92 |
+
if (this.options.onUncheck.node == 'expand') {
|
| 93 |
+
this.element.find('input:checkbox:not(:checked)').live("click", function() {
|
| 94 |
+
t.expand(jQuery(this).parents("li:first"));
|
| 95 |
+
});
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
// bind collapse on check event
|
| 99 |
+
if (this.options.onCheck.node == 'collapse') {
|
| 100 |
+
this.element.find('input:checkbox:checked').live("click", function() {
|
| 101 |
+
t.collapse(jQuery(this).parents("li:first"));
|
| 102 |
+
});
|
| 103 |
+
} else
|
| 104 |
+
|
| 105 |
+
// bind expand on check event
|
| 106 |
+
if (this.options.onCheck.node == 'expand') {
|
| 107 |
+
this.element.find('input:checkbox:checked').live("click", function() {
|
| 108 |
+
t.expand(jQuery(this).parents("li:first"));
|
| 109 |
+
});
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
// bind node uncheck event
|
| 114 |
+
this.element.find('input:checkbox:not(:checked)').live('click', function() {
|
| 115 |
+
var li = jQuery(this).parents('li:first');
|
| 116 |
+
t.uncheck(li);
|
| 117 |
+
});
|
| 118 |
+
|
| 119 |
+
// bind node check event
|
| 120 |
+
this.element.find('input:checkbox:checked').live('click', function() {
|
| 121 |
+
var li = jQuery(this).parents('li:first');
|
| 122 |
+
t.check(li);
|
| 123 |
+
});
|
| 124 |
+
|
| 125 |
+
// add essential css class
|
| 126 |
+
this.element.addClass('ui-widget-daredevel-checkboxTree');
|
| 127 |
+
|
| 128 |
+
// add jQueryUI css widget class
|
| 129 |
+
this.element.addClass('ui-widget ui-widget-content');
|
| 130 |
+
|
| 131 |
+
},
|
| 132 |
+
|
| 133 |
+
/**
|
| 134 |
+
* Check ancestors on passed node
|
| 135 |
+
*
|
| 136 |
+
* Don't use check() method because we won't trigger onCheck events
|
| 137 |
+
*
|
| 138 |
+
* @private
|
| 139 |
+
*
|
| 140 |
+
* @param li node
|
| 141 |
+
*/
|
| 142 |
+
_checkAncestors: function(li) {
|
| 143 |
+
li.parentsUntil(".ui-widget").filter('li').find('input:checkbox:first:not(:checked)').attr('checked', true).change();
|
| 144 |
+
},
|
| 145 |
+
|
| 146 |
+
/**
|
| 147 |
+
* Check descendants on passed node
|
| 148 |
+
*
|
| 149 |
+
* Don't use check() method because we won't trigger onCheck events
|
| 150 |
+
*
|
| 151 |
+
* @private
|
| 152 |
+
*
|
| 153 |
+
* @param li node
|
| 154 |
+
*/
|
| 155 |
+
_checkDescendants: function(li) {
|
| 156 |
+
li.find('li input:checkbox:not(:checked)').attr('checked', true).change();
|
| 157 |
+
},
|
| 158 |
+
|
| 159 |
+
/**
|
| 160 |
+
* Check nodes that are neither ancestors or descendants of passed node
|
| 161 |
+
*
|
| 162 |
+
* Don't use check() method because we won't trigger onCheck events
|
| 163 |
+
*
|
| 164 |
+
* @private
|
| 165 |
+
*
|
| 166 |
+
* @param li node
|
| 167 |
+
*/
|
| 168 |
+
_checkOthers: function(li) {
|
| 169 |
+
li.addClass('exclude');
|
| 170 |
+
li.parents('li').addClass('exclude');
|
| 171 |
+
li.find('li').addClass('exclude');
|
| 172 |
+
jQuery(this.element).find('li').each(function() {
|
| 173 |
+
if (!jQuery(this).hasClass('exclude')) {
|
| 174 |
+
jQuery(this).find('input:checkbox:first:not(:checked)').attr('checked', true).change();
|
| 175 |
+
}
|
| 176 |
+
});
|
| 177 |
+
jQuery(this.element).find('li').removeClass('exclude');
|
| 178 |
+
},
|
| 179 |
+
|
| 180 |
+
/**
|
| 181 |
+
* Destroy plugin
|
| 182 |
+
*
|
| 183 |
+
* @private
|
| 184 |
+
*/
|
| 185 |
+
_destroy: function() {
|
| 186 |
+
this.element.removeClass(this.options.cssClass);
|
| 187 |
+
|
| 188 |
+
jQuery.Widget.prototype.destroy.call(this);
|
| 189 |
+
},
|
| 190 |
+
|
| 191 |
+
/**
|
| 192 |
+
* Check if passed node is a root
|
| 193 |
+
*
|
| 194 |
+
* @private
|
| 195 |
+
*
|
| 196 |
+
* @param li node to check
|
| 197 |
+
*/
|
| 198 |
+
_isRoot: function(li) {
|
| 199 |
+
var parents = li.parentsUntil('.ui-widget-daredevel-checkboxTree');
|
| 200 |
+
return 0 == parents.length;
|
| 201 |
+
},
|
| 202 |
+
|
| 203 |
+
/**
|
| 204 |
+
* Mark node as collapsed
|
| 205 |
+
*
|
| 206 |
+
* @private
|
| 207 |
+
*
|
| 208 |
+
* @param li node to mark
|
| 209 |
+
*/
|
| 210 |
+
_markAsCollapsed: function(li) {
|
| 211 |
+
if (this.options.expandAnchor.length > 0) {
|
| 212 |
+
li.children("span").html(this.options.expandAnchor);
|
| 213 |
+
} else
|
| 214 |
+
if (this.options.collapseUiIcon.length > 0) {
|
| 215 |
+
li.children("span").removeClass(this.options.expandUiIcon).addClass('ui-icon ' + this.options.collapseUiIcon);
|
| 216 |
+
}
|
| 217 |
+
li.removeClass("expanded").addClass("collapsed");
|
| 218 |
+
},
|
| 219 |
+
|
| 220 |
+
/**
|
| 221 |
+
* Mark node as expanded
|
| 222 |
+
*
|
| 223 |
+
* @private
|
| 224 |
+
*
|
| 225 |
+
* @param li node to mark
|
| 226 |
+
*/
|
| 227 |
+
_markAsExpanded: function(li) {
|
| 228 |
+
if (this.options.collapseAnchor.length > 0) {
|
| 229 |
+
li.children("span").html(this.options.collapseAnchor);
|
| 230 |
+
} else
|
| 231 |
+
if (this.options.expandUiIcon.length > 0) {
|
| 232 |
+
li.children("span").removeClass(this.options.collapseUiIcon).addClass('ui-icon ' + this.options.expandUiIcon);
|
| 233 |
+
}
|
| 234 |
+
li.removeClass("collapsed").addClass("expanded");
|
| 235 |
+
},
|
| 236 |
+
|
| 237 |
+
/**
|
| 238 |
+
* Mark node as leaf
|
| 239 |
+
*
|
| 240 |
+
* @private
|
| 241 |
+
*
|
| 242 |
+
* @param li node to mark
|
| 243 |
+
*/
|
| 244 |
+
_markAsLeaf: function(li) {
|
| 245 |
+
if (this.options.leafAnchor.length > 0) {
|
| 246 |
+
li.children("span").html(this.options.leafAnchor);
|
| 247 |
+
} else
|
| 248 |
+
if (this.options.leafUiIcon.length > 0) {
|
| 249 |
+
li.children("span").addClass('ui-icon ' + this.options.leafUiIcon);
|
| 250 |
+
}
|
| 251 |
+
li.addClass("leaf");
|
| 252 |
+
},
|
| 253 |
+
|
| 254 |
+
/**
|
| 255 |
+
* Return parent li of the passed li
|
| 256 |
+
*
|
| 257 |
+
* @private
|
| 258 |
+
*
|
| 259 |
+
* @param li node
|
| 260 |
+
*
|
| 261 |
+
* @return parent li
|
| 262 |
+
*/
|
| 263 |
+
_parentNode: function(li) {
|
| 264 |
+
return li.parents('li:first');
|
| 265 |
+
},
|
| 266 |
+
|
| 267 |
+
/**
|
| 268 |
+
* Uncheck ancestors of passed node
|
| 269 |
+
*
|
| 270 |
+
* Don't use uncheck() method because we won't trigger onUncheck events
|
| 271 |
+
*
|
| 272 |
+
* @private
|
| 273 |
+
*
|
| 274 |
+
* @param li node
|
| 275 |
+
*/
|
| 276 |
+
_uncheckAncestors: function(li) {
|
| 277 |
+
li.parentsUntil(".ui-widget").filter('li').find('input:checkbox:first:checked').attr('checked', false).change();
|
| 278 |
+
},
|
| 279 |
+
|
| 280 |
+
/**
|
| 281 |
+
* Uncheck descendants of passed node
|
| 282 |
+
*
|
| 283 |
+
* Don't use uncheck() method because we won't trigger onUncheck events
|
| 284 |
+
*
|
| 285 |
+
* @private
|
| 286 |
+
*
|
| 287 |
+
* @param li node
|
| 288 |
+
*/
|
| 289 |
+
_uncheckDescendants: function(li) {
|
| 290 |
+
li.find('li input:checkbox:checked').attr('checked', false).change();
|
| 291 |
+
},
|
| 292 |
+
|
| 293 |
+
/**
|
| 294 |
+
* Uncheck nodes that are neither ancestors or descendants of passed node
|
| 295 |
+
*
|
| 296 |
+
* Don't use uncheck() method because we won't trigger onUncheck events
|
| 297 |
+
*
|
| 298 |
+
* @private
|
| 299 |
+
*
|
| 300 |
+
* @param li node
|
| 301 |
+
*/
|
| 302 |
+
_uncheckOthers: function(li) {
|
| 303 |
+
li.addClass('exclude');
|
| 304 |
+
li.parents('li').addClass('exclude');
|
| 305 |
+
li.find('li').addClass('exclude');
|
| 306 |
+
jQuery(this.element).find('li').each(function() {
|
| 307 |
+
if (!jQuery(this).hasClass('exclude')) {
|
| 308 |
+
jQuery(this).find('input:checkbox:first:checked').attr('checked', false).change();
|
| 309 |
+
}
|
| 310 |
+
});
|
| 311 |
+
jQuery(this.element).find('li').removeClass('exclude');
|
| 312 |
+
},
|
| 313 |
+
|
| 314 |
+
/**
|
| 315 |
+
* Check node
|
| 316 |
+
*
|
| 317 |
+
* @public
|
| 318 |
+
*
|
| 319 |
+
* @param li node to check
|
| 320 |
+
*/
|
| 321 |
+
check: function(li) {
|
| 322 |
+
|
| 323 |
+
li.find('input:checkbox:first:not(:checked)').attr('checked', true).change();
|
| 324 |
+
|
| 325 |
+
// handle others
|
| 326 |
+
if (this.options.onCheck.others == 'check') {
|
| 327 |
+
this._checkOthers(li);
|
| 328 |
+
} else
|
| 329 |
+
|
| 330 |
+
if (this.options.onCheck.others == 'uncheck') {
|
| 331 |
+
this._uncheckOthers(li);
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
// handle descendants
|
| 335 |
+
if (this.options.onCheck.descendants == 'check') {
|
| 336 |
+
this._checkDescendants(li);
|
| 337 |
+
} else
|
| 338 |
+
|
| 339 |
+
if (this.options.onCheck.descendants == 'uncheck') {
|
| 340 |
+
this._uncheckDescendants(li);
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
// handle ancestors
|
| 344 |
+
if (this.options.onCheck.ancestors == 'check') {
|
| 345 |
+
this._checkAncestors(li);
|
| 346 |
+
} else
|
| 347 |
+
|
| 348 |
+
if (this.options.onCheck.ancestors == 'uncheck') {
|
| 349 |
+
this._uncheckAncestors(li);
|
| 350 |
+
} else
|
| 351 |
+
|
| 352 |
+
if (this.options.onCheck.ancestors == 'checkIfFull') {
|
| 353 |
+
if (!this._isRoot(li) && this._allDescendantChecked(this._parentNode(li))) {
|
| 354 |
+
this.check(this._parentNode(li));
|
| 355 |
+
}
|
| 356 |
+
}
|
| 357 |
+
},
|
| 358 |
+
|
| 359 |
+
/**
|
| 360 |
+
* Check all tree elements
|
| 361 |
+
*
|
| 362 |
+
* Don't use check() method so it won't trigger onCheck events
|
| 363 |
+
*
|
| 364 |
+
* @public
|
| 365 |
+
*/
|
| 366 |
+
checkAll: function() {
|
| 367 |
+
jQuery(this.element).find('input:checkbox:not(:checked)').attr('checked', true).change();
|
| 368 |
+
},
|
| 369 |
+
|
| 370 |
+
/**
|
| 371 |
+
* Collapse node
|
| 372 |
+
*
|
| 373 |
+
* @public
|
| 374 |
+
*
|
| 375 |
+
* @param li node to collapse
|
| 376 |
+
*/
|
| 377 |
+
collapse: function(li) {
|
| 378 |
+
if (li.hasClass('collapsed') || (li.hasClass('leaf'))) {
|
| 379 |
+
return;
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
var t = this;
|
| 383 |
+
|
| 384 |
+
li.children("ul").hide(this.options.collapseEffect, {}, this.options.collapseDuration);
|
| 385 |
+
|
| 386 |
+
setTimeout(function() {
|
| 387 |
+
t._markAsCollapsed(li, t.options);
|
| 388 |
+
}, t.options.collapseDuration);
|
| 389 |
+
|
| 390 |
+
t._trigger('collapse', li);
|
| 391 |
+
},
|
| 392 |
+
|
| 393 |
+
/**
|
| 394 |
+
* Collapse all nodes of the tree
|
| 395 |
+
*
|
| 396 |
+
* @private
|
| 397 |
+
*/
|
| 398 |
+
collapseAll: function() {
|
| 399 |
+
var t = this;
|
| 400 |
+
jQuery(this.element).find('li.expanded').each(function() {
|
| 401 |
+
t.collapse(jQuery(this));
|
| 402 |
+
});
|
| 403 |
+
},
|
| 404 |
+
|
| 405 |
+
/**
|
| 406 |
+
* Expand node
|
| 407 |
+
*
|
| 408 |
+
* @public
|
| 409 |
+
*
|
| 410 |
+
* @param li node to expand
|
| 411 |
+
*/
|
| 412 |
+
expand: function(li) {
|
| 413 |
+
if (li.hasClass('expanded') || (li.hasClass('leaf'))) {
|
| 414 |
+
return;
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
+
var t = this;
|
| 418 |
+
|
| 419 |
+
li.children("ul").show(t.options.expandEffect, {}, t.options.expandDuration);
|
| 420 |
+
|
| 421 |
+
setTimeout(function() {
|
| 422 |
+
t._markAsExpanded(li, t.options);
|
| 423 |
+
}, t.options.expandDuration);
|
| 424 |
+
|
| 425 |
+
t._trigger('expand', li);
|
| 426 |
+
},
|
| 427 |
+
|
| 428 |
+
/**
|
| 429 |
+
* Expand all nodes of the tree
|
| 430 |
+
*
|
| 431 |
+
* @public
|
| 432 |
+
*/
|
| 433 |
+
expandAll: function() {
|
| 434 |
+
var t = this;
|
| 435 |
+
jQuery(this.element).find('li.collapsed').each(function() {
|
| 436 |
+
t.expand(jQuery(this));
|
| 437 |
+
});
|
| 438 |
+
},
|
| 439 |
+
|
| 440 |
+
/**
|
| 441 |
+
* Uncheck node
|
| 442 |
+
*
|
| 443 |
+
* @public
|
| 444 |
+
*
|
| 445 |
+
* @param li node to uncheck
|
| 446 |
+
*/
|
| 447 |
+
uncheck: function(li) {
|
| 448 |
+
|
| 449 |
+
li.find('input:checkbox:first:checked').attr('checked', false).change();
|
| 450 |
+
|
| 451 |
+
// handle others
|
| 452 |
+
if (this.options.onUncheck.others == 'check') {
|
| 453 |
+
this._checkOthers(li);
|
| 454 |
+
} else
|
| 455 |
+
|
| 456 |
+
if (this.options.onUncheck.others == 'uncheck') {
|
| 457 |
+
this._uncheckOthers(li);
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
// handle descendants
|
| 461 |
+
if (this.options.onUncheck.descendants == 'check') {
|
| 462 |
+
this._checkDescendants(li);
|
| 463 |
+
} else
|
| 464 |
+
|
| 465 |
+
if (this.options.onUncheck.descendants == 'uncheck') {
|
| 466 |
+
// this._uncheckDescendants(li);
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
// handle ancestors
|
| 470 |
+
if (this.options.onUncheck.ancestors == 'check') {
|
| 471 |
+
this._checkAncestors(li);
|
| 472 |
+
} else
|
| 473 |
+
|
| 474 |
+
if (this.options.onUncheck.ancestors == 'uncheck') {
|
| 475 |
+
this._uncheckAncestors(li);
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
},
|
| 479 |
+
|
| 480 |
+
/**
|
| 481 |
+
* Uncheck all tree elements
|
| 482 |
+
*
|
| 483 |
+
* Don't use uncheck() method so it won't trigger onUncheck events
|
| 484 |
+
*
|
| 485 |
+
* @public
|
| 486 |
+
*/
|
| 487 |
+
uncheckAll: function() {
|
| 488 |
+
jQuery(this.element).find('input:checkbox:checked').attr('checked', false).change();
|
| 489 |
+
},
|
| 490 |
+
|
| 491 |
+
/**
|
| 492 |
+
* Default options values
|
| 493 |
+
*/
|
| 494 |
+
options: {
|
| 495 |
+
/**
|
| 496 |
+
* Defines if tree has collapse capability.
|
| 497 |
+
*/
|
| 498 |
+
collapsable: true,
|
| 499 |
+
/**
|
| 500 |
+
* Defines an element of DOM that, if clicked, trigger collapseAll() method.
|
| 501 |
+
* Value can be either a jQuery object or a selector string.
|
| 502 |
+
* @deprecated will be removed in jquery 0.6.
|
| 503 |
+
*/
|
| 504 |
+
collapseAllElement: '',
|
| 505 |
+
/**
|
| 506 |
+
* Defines duration of collapse effect in ms.
|
| 507 |
+
* Works only if collapseEffect is not null.
|
| 508 |
+
*/
|
| 509 |
+
collapseDuration: 500,
|
| 510 |
+
/**
|
| 511 |
+
* Defines the effect used for collapse node.
|
| 512 |
+
*/
|
| 513 |
+
collapseEffect: 'blind',
|
| 514 |
+
/**
|
| 515 |
+
* Defines URL of image used for collapse anchor.
|
| 516 |
+
* @deprecated will be removed in jquery 0.6.
|
| 517 |
+
*/
|
| 518 |
+
collapseImage: '',
|
| 519 |
+
/**
|
| 520 |
+
* Defines jQueryUI icon class used for collapse anchor.
|
| 521 |
+
*/
|
| 522 |
+
collapseUiIcon: 'ui-icon-triangle-1-e',
|
| 523 |
+
// dataSourceType: '',
|
| 524 |
+
// dataSourceUrl: '',
|
| 525 |
+
/**
|
| 526 |
+
* Defines an element of DOM that, if clicked, trigger expandAll() method.
|
| 527 |
+
* Value can be either a jQuery object or a selector string.
|
| 528 |
+
* @deprecated will be removed in jquery 0.6.
|
| 529 |
+
*/
|
| 530 |
+
expandAllElement: '',
|
| 531 |
+
/**
|
| 532 |
+
* Defines duration of expand effect in ms.
|
| 533 |
+
* Works only if expandEffect is not null.
|
| 534 |
+
*/
|
| 535 |
+
expandDuration: 500,
|
| 536 |
+
/**
|
| 537 |
+
* Defines the effect used for expand node.
|
| 538 |
+
*/
|
| 539 |
+
expandEffect: 'blind',
|
| 540 |
+
/**
|
| 541 |
+
* Defines URL of image used for expand anchor.
|
| 542 |
+
* @deprecated will be removed in jquery 0.6.
|
| 543 |
+
*/
|
| 544 |
+
expandImage: '',
|
| 545 |
+
/**
|
| 546 |
+
* Defines jQueryUI icon class used for expand anchor.
|
| 547 |
+
*/
|
| 548 |
+
expandUiIcon: 'ui-icon-triangle-1-se',
|
| 549 |
+
/**
|
| 550 |
+
* Defines if checked node are collapsed or not at tree initializing.
|
| 551 |
+
*/
|
| 552 |
+
initializeChecked: 'expanded', // or 'collapsed'
|
| 553 |
+
/**
|
| 554 |
+
* Defines if unchecked node are collapsed or not at tree initializing.
|
| 555 |
+
*/
|
| 556 |
+
initializeUnchecked: 'expanded', // or 'collapsed'
|
| 557 |
+
/**
|
| 558 |
+
* Defines URL of image used for leaf anchor.
|
| 559 |
+
* @deprecated will be removed in jquery 0.6.
|
| 560 |
+
*/
|
| 561 |
+
leafImage: '',
|
| 562 |
+
/**
|
| 563 |
+
* Defines jQueryUI icon class used for leaf anchor.
|
| 564 |
+
*/
|
| 565 |
+
leafUiIcon: '',
|
| 566 |
+
/**
|
| 567 |
+
* Defines which actions trigger when a node is checked.
|
| 568 |
+
* Actions are triggered in the following order:
|
| 569 |
+
* 1) node
|
| 570 |
+
* 2) others
|
| 571 |
+
* 3) descendants
|
| 572 |
+
* 4) ancestors
|
| 573 |
+
*/
|
| 574 |
+
onCheck: {
|
| 575 |
+
/**
|
| 576 |
+
* Defines action to perform on ancestors of the checked node.
|
| 577 |
+
* Available values: null, 'check', 'uncheck', 'checkIfFull'.
|
| 578 |
+
*/
|
| 579 |
+
ancestors: 'check',
|
| 580 |
+
/**
|
| 581 |
+
* Defines action to perform on descendants of the checked node.
|
| 582 |
+
* Available values: null, 'check', 'uncheck'.
|
| 583 |
+
*/
|
| 584 |
+
descendants: 'check',
|
| 585 |
+
/**
|
| 586 |
+
* Defines action to perform on checked node.
|
| 587 |
+
* Available values: null, 'collapse', 'expand'.
|
| 588 |
+
*/
|
| 589 |
+
node: '',
|
| 590 |
+
/**
|
| 591 |
+
* Defines action to perform on each other node (checked one excluded).
|
| 592 |
+
* Available values: null, 'check', 'uncheck'.
|
| 593 |
+
*/
|
| 594 |
+
others: ''
|
| 595 |
+
},
|
| 596 |
+
/**
|
| 597 |
+
* Defines which actions trigger when a node is unchecked.
|
| 598 |
+
* Actions are triggered in the following order:
|
| 599 |
+
* 1) node
|
| 600 |
+
* 2) others
|
| 601 |
+
* 3) descendants
|
| 602 |
+
* 4) ancestors
|
| 603 |
+
*/
|
| 604 |
+
onUncheck: {
|
| 605 |
+
/**
|
| 606 |
+
* Defines action to perform on ancestors of the unchecked node.
|
| 607 |
+
* Available values: null, 'check', 'uncheck'.
|
| 608 |
+
*/
|
| 609 |
+
ancestors: '',
|
| 610 |
+
/**
|
| 611 |
+
* Defines action to perform on descendants of the unchecked node.
|
| 612 |
+
* Available values: null, 'check', 'uncheck'.
|
| 613 |
+
*/
|
| 614 |
+
descendants: 'uncheck',
|
| 615 |
+
/**
|
| 616 |
+
* Defines action to perform on unchecked node.
|
| 617 |
+
* Available values: null, 'collapse', 'expand'.
|
| 618 |
+
*/
|
| 619 |
+
node: '',
|
| 620 |
+
/**
|
| 621 |
+
* Defines action to perform on each other node (unchecked one excluded).
|
| 622 |
+
* Available values: null, 'check', 'uncheck'.
|
| 623 |
+
*/
|
| 624 |
+
others: ''
|
| 625 |
+
}
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
+
});
|
