Levementum_Groupedproduct - Version 1.0.0

Version Notes

Display Attributes
- Ability to display custom attributes on the front-end
- Ability to sort your grouped products by attributes
- Adding and Removing display attributes as needed
Admin Controls
- Fully customizable controls using Magento Administrator Panel
- Simple drag and drop functionality
Environments Supported
- Magento Enterprise 1.12.x
Support
- Intuitive User Manual
- Grouped Product Grid extension’s functional logic is 100% Open Source

Download this release

Release Info

Developer Levementum, LLC
Extension Levementum_Groupedproduct
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (106) hide show
  1. app/code/community/Levementum/Groupedproduct/Block/Adminhtml/Sets.php +18 -0
  2. app/code/community/Levementum/Groupedproduct/Block/Adminhtml/Sets/Edit.php +52 -0
  3. app/code/community/Levementum/Groupedproduct/Block/Adminhtml/Sets/Edit/Form.php +105 -0
  4. app/code/community/Levementum/Groupedproduct/Block/Adminhtml/Sets/Grid.php +103 -0
  5. app/code/community/Levementum/Groupedproduct/Block/Adminhtml/System/Config/Form/Field/Primary.php +26 -0
  6. app/code/community/Levementum/Groupedproduct/Block/Catalog/Form/Renderer/Fieldset/Element.php +20 -0
  7. app/code/community/Levementum/Groupedproduct/Block/Catalog/Form/Renderer/Fieldset/Primary.php +30 -0
  8. app/code/community/Levementum/Groupedproduct/Block/Product/View/Type/Grouped.php +119 -0
  9. app/code/community/Levementum/Groupedproduct/Block/Toolbar.php +136 -0
  10. app/code/community/Levementum/Groupedproduct/Helper/Admin.php +58 -0
  11. app/code/community/Levementum/Groupedproduct/Helper/Config.php +91 -0
  12. app/code/community/Levementum/Groupedproduct/Helper/Data.php +259 -0
  13. app/code/community/Levementum/Groupedproduct/Helper/Sets.php +35 -0
  14. app/code/community/Levementum/Groupedproduct/Model/Backend/Option.php +11 -0
  15. app/code/community/Levementum/Groupedproduct/Model/Entity/Setup.php +46 -0
  16. app/code/community/Levementum/Groupedproduct/Model/ImportExport/Export/Entity/Product/Type/Grouped.php +54 -0
  17. app/code/community/Levementum/Groupedproduct/Model/Observer.php +40 -0
  18. app/code/community/Levementum/Groupedproduct/Model/PageCache/Container/Groupedproduct.php +53 -0
  19. app/code/community/Levementum/Groupedproduct/Model/Product/Type/Grouped.php +56 -0
  20. app/code/community/Levementum/Groupedproduct/Model/Resource/Sets.php +11 -0
  21. app/code/community/Levementum/Groupedproduct/Model/Resource/Sets/Collection.php +31 -0
  22. app/code/community/Levementum/Groupedproduct/Model/Sets.php +49 -0
  23. app/code/community/Levementum/Groupedproduct/Model/Source/Option.php +103 -0
  24. app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/AllNumber.php +20 -0
  25. app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/Attributes.php +45 -0
  26. app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/Datatables.php +14 -0
  27. app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/List.php +13 -0
  28. app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/Options.php +33 -0
  29. app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/Pagination.php +20 -0
  30. app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/PaginationDisplay.php +21 -0
  31. app/code/community/Levementum/Groupedproduct/controllers/Adminhtml/SetsController.php +161 -0
  32. app/code/community/Levementum/Groupedproduct/data/levementum_groupedproduct_setup/data-install-1.0.0.php +18 -0
  33. app/code/community/Levementum/Groupedproduct/etc/adminhtml.xml +47 -0
  34. app/code/community/Levementum/Groupedproduct/etc/cache.xml +11 -0
  35. app/code/community/Levementum/Groupedproduct/etc/config.xml +142 -0
  36. app/code/community/Levementum/Groupedproduct/etc/system.xml +298 -0
  37. app/code/community/Levementum/Groupedproduct/sql/levementum_groupedproduct_setup/mysql4-install-1.0.0.php +125 -0
  38. app/code/community/Levementum/LevCore/Block/Adminhtml/Widget/Grid/Column/Renderer/Nowrap.php +22 -0
  39. app/code/community/Levementum/LevCore/Block/Customer/Account/Navigation.php +17 -0
  40. app/code/community/Levementum/LevCore/Block/LevCore.php +8 -0
  41. app/code/community/Levementum/LevCore/Block/System/Html.php +65 -0
  42. app/code/community/Levementum/LevCore/Helper/Core/Data.php +69 -0
  43. app/code/community/Levementum/LevCore/Helper/Data.php +118 -0
  44. app/code/community/Levementum/LevCore/Model/PageCache/Container/Tabs.php +43 -0
  45. app/code/community/Levementum/LevCore/Model/System/Config/Source/Attributes.php +62 -0
  46. app/code/community/Levementum/LevCore/etc/adminhtml.xml +33 -0
  47. app/code/community/Levementum/LevCore/etc/config.xml +81 -0
  48. app/code/community/Levementum/LevCore/etc/system.xml +70 -0
  49. app/design/adminhtml/default/default/layout/levementum/groupedproduct.xml +8 -0
  50. app/design/adminhtml/default/default/layout/levementum/levcore.xml +13 -0
  51. app/design/frontend/enterprise/default/layout/levementum/groupedproduct.xml +33 -0
  52. app/design/frontend/enterprise/default/layout/levementum/levcore.xml +20 -0
  53. app/design/frontend/enterprise/default/template/levementum/groupedproduct/product/list/toolbar.phtml +124 -0
  54. app/design/frontend/enterprise/default/template/levementum/groupedproduct/product/view/addto.phtml +41 -0
  55. app/design/frontend/enterprise/default/template/levementum/groupedproduct/product/view/addtocart.phtml +38 -0
  56. app/design/frontend/enterprise/default/template/levementum/groupedproduct/product/view/tierprices-basic.phtml +213 -0
  57. app/design/frontend/enterprise/default/template/levementum/groupedproduct/product/view/type/grouped.phtml +593 -0
  58. app/etc/modules/Levementum_Groupedproduct.xml +13 -0
  59. app/etc/modules/Levementum_LevCore.xml +13 -0
  60. doc/Grouped Product Grid Overview.pdf +0 -0
  61. doc/Levementum Grouped Product Datasheet.pdf +0 -0
  62. doc/Levementum Groupedproduct Installation Doc.pdf +0 -0
  63. js/levementum/levcore/jquery-1.8.3.min.js +4 -0
  64. js/levementum/levcore/jquery-ui-1.10.0.custom.min.js +6 -0
  65. js/levementum/levcore/levcore.js +107 -0
  66. js/levementum/levcore/levcore.validation.js +98 -0
  67. js/levementum/levcore/ui.multiselect.js +965 -0
  68. js/levementum/levcore/ui.multiselect.min.js +1 -0
  69. package.xml +29 -0
  70. skin/adminhtml/default/default/levementum/css/jqueryui-custom.css +352 -0
  71. skin/adminhtml/default/default/levementum/css/levcore.css +5 -0
  72. skin/adminhtml/default/default/levementum/images/bkg_collapse.gif +0 -0
  73. skin/adminhtml/default/default/levementum/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  74. skin/adminhtml/default/default/levementum/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
  75. skin/adminhtml/default/default/levementum/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
  76. skin/adminhtml/default/default/levementum/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
  77. skin/adminhtml/default/default/levementum/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  78. skin/adminhtml/default/default/levementum/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  79. skin/adminhtml/default/default/levementum/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
  80. skin/adminhtml/default/default/levementum/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  81. skin/adminhtml/default/default/levementum/images/ui-icons_217bc0_256x240.png +0 -0
  82. skin/adminhtml/default/default/levementum/images/ui-icons_2e83ff_256x240.png +0 -0
  83. skin/adminhtml/default/default/levementum/images/ui-icons_469bdd_256x240.png +0 -0
  84. skin/adminhtml/default/default/levementum/images/ui-icons_6da8d5_256x240.png +0 -0
  85. skin/adminhtml/default/default/levementum/images/ui-icons_cd0a0a_256x240.png +0 -0
  86. skin/adminhtml/default/default/levementum/images/ui-icons_d8e7f3_256x240.png +0 -0
  87. skin/adminhtml/default/default/levementum/images/ui-icons_f9bd01_256x240.png +0 -0
  88. skin/frontend/enterprise/default/levementum/css/groupedproduct.css +166 -0
  89. skin/frontend/enterprise/default/levementum/datatables/css/jquery.dataTables.css +247 -0
  90. skin/frontend/enterprise/default/levementum/datatables/css/jquery.dataTables_themeroller.css +245 -0
  91. skin/frontend/enterprise/default/levementum/datatables/images/Sorting icons.psd +0 -0
  92. skin/frontend/enterprise/default/levementum/datatables/images/back_disabled.png +0 -0
  93. skin/frontend/enterprise/default/levementum/datatables/images/back_enabled.png +0 -0
  94. skin/frontend/enterprise/default/levementum/datatables/images/back_enabled_hover.png +0 -0
  95. skin/frontend/enterprise/default/levementum/datatables/images/favicon.ico +0 -0
  96. skin/frontend/enterprise/default/levementum/datatables/images/forward_disabled.png +0 -0
  97. skin/frontend/enterprise/default/levementum/datatables/images/forward_enabled.png +0 -0
  98. skin/frontend/enterprise/default/levementum/datatables/images/forward_enabled_hover.png +0 -0
  99. skin/frontend/enterprise/default/levementum/datatables/images/sort_asc.png +0 -0
  100. skin/frontend/enterprise/default/levementum/datatables/images/sort_asc_disabled.png +0 -0
  101. skin/frontend/enterprise/default/levementum/datatables/images/sort_both.png +0 -0
  102. skin/frontend/enterprise/default/levementum/datatables/images/sort_desc.png +0 -0
  103. skin/frontend/enterprise/default/levementum/datatables/images/sort_desc_disabled.png +0 -0
  104. skin/frontend/enterprise/default/levementum/datatables/js/jquery.dataTables.js +12092 -0
  105. skin/frontend/enterprise/default/levementum/datatables/js/jquery.dataTables.plugins.js +335 -0
  106. skin/frontend/enterprise/default/levementum/datatables/js/jquery.js +2 -0
app/code/community/Levementum/Groupedproduct/Block/Adminhtml/Sets.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 8/30/12 3:16 PM
5
+ */
6
+
7
+
8
+ class Levementum_Groupedproduct_Block_Adminhtml_Sets extends Mage_Adminhtml_Block_Widget_Grid_Container
9
+ {
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+ $this->_controller = 'adminhtml_sets';
14
+ $this->_blockGroup = 'groupedproduct';
15
+ $this->_headerText = Mage::helper('groupedproduct')->__('Default Columns by Set');
16
+ $this->removeButton('add');
17
+ }
18
+ }
app/code/community/Levementum/Groupedproduct/Block/Adminhtml/Sets/Edit.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 8/30/12 3:18 PM
5
+ */
6
+ class Levementum_Groupedproduct_Block_Adminhtml_Sets_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
7
+ {
8
+ public function __construct()
9
+ {
10
+ parent::__construct();
11
+
12
+ $this->_objectId = 'id';
13
+ $this->_blockGroup = 'groupedproduct';
14
+ $this->_controller = 'adminhtml_sets';
15
+ $this->_mode = 'edit';
16
+
17
+ if ($this->_isAllowedAction('save')) {
18
+ $this->_addButton('save_and_continue', array(
19
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
20
+ 'onclick' => 'saveAndContinueEdit()',
21
+ 'class' => 'save',
22
+ ), -100);
23
+ $this->_updateButton('save', 'label', Mage::helper('groupedproduct')->__('Save Set'));
24
+ $this->_formScripts[] = "
25
+ function saveAndContinueEdit(){
26
+ editForm.submit($('edit_form').action+'back/edit/');
27
+ }
28
+ ";
29
+ } else {
30
+ $this->_removeButton('save');
31
+ }
32
+
33
+ $this->_removeButton('delete');
34
+ }
35
+
36
+ public function getHeaderText()
37
+ {
38
+ return Mage::helper('groupedproduct')->__('Edit Set');
39
+ }
40
+
41
+ /**
42
+ * Check permission for passed action
43
+ *
44
+ * @param string $action
45
+ *
46
+ * @return bool
47
+ */
48
+ protected function _isAllowedAction($action)
49
+ {
50
+ return Mage::getSingleton('admin/session')->isAllowed('levementum/levementum_grouped_sets/'.$action);
51
+ }
52
+ }
app/code/community/Levementum/Groupedproduct/Block/Adminhtml/Sets/Edit/Form.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 8/30/12 3:19 PM
5
+ */
6
+
7
+ class Levementum_Groupedproduct_Block_Adminhtml_Sets_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
8
+ {
9
+ protected function _prepareForm()
10
+ {
11
+ if (Mage::registry('sets_data')) {
12
+ $data = Mage::registry('sets_data')->getData();
13
+ } else {
14
+ $data = array();
15
+ }
16
+
17
+ $form = new Varien_Data_Form(array(
18
+ 'id' => 'edit_form',
19
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
20
+ 'method' => 'post',
21
+ 'enctype' => 'multipart/form-data',
22
+ ));
23
+
24
+ $form->setUseContainer(true);
25
+
26
+ $this->setForm($form);
27
+
28
+ $setsSource = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
29
+
30
+ $fieldset = $form->addFieldset('groupedproduct_form', array(
31
+ 'legend' => Mage::helper('groupedproduct')->__('Set Information')
32
+ ));
33
+ $fieldset->addField('attribute_set_name', 'text', array(
34
+ 'label' => Mage::helper('groupedproduct')->__('Set'),
35
+ 'note' => 'Prefixing admin set name with origin is optional.',
36
+ 'class' => 'required-entry',
37
+ 'required' => true,
38
+ 'name' => 'attribute_set_name',
39
+ 'disabled' => true
40
+ ));
41
+
42
+ $disabled = !$this->_isAllowedAction('save');
43
+
44
+ if ($disabled) {
45
+ $multiSelectClass = '';
46
+ } else {
47
+ $multiSelectClass = 'levementum-ordered-multiselect';
48
+ }
49
+
50
+ $displayedAttributes = $fieldset->addField('attribute_codes', 'multiselect', array(
51
+ 'label' => Mage::helper('groupedproduct')->__('Frontend Set Name'),
52
+ 'note' => 'This overrides system configuration settings. This is overwritten by product selections. If this is left blank system configuration is used.',
53
+ 'class' => $multiSelectClass,
54
+ 'required' => false,
55
+ 'name' => 'attribute_codes',
56
+ 'values' => $this->getAttributeCodes($data['attribute_codes']),
57
+ 'disabled' => $disabled
58
+ ));
59
+ $primaryAttributes = $fieldset->addField('primary_attribute', 'select', array(
60
+ 'label' => Mage::helper('groupedproduct')->__('Primary Attribute'),
61
+ 'note' => 'The selected column will expand to fill the space, all others will be "minimized"',
62
+ 'required' => false,
63
+ 'name' => 'primary_attribute',
64
+ 'disabled' => $disabled,
65
+ ));
66
+
67
+ $fieldset->addField('is_active', 'select', array(
68
+ 'name' => 'is_active',
69
+ 'note' => 'This set will not be used if inactive.',
70
+ 'label' => Mage::helper('catalog')->__('Is Active'),
71
+ 'values' => $setsSource,
72
+ 'disabled' => $disabled
73
+ ), 'is_active');
74
+
75
+ $form->setValues($data);
76
+
77
+ $displayedAttributesId = $displayedAttributes->getHtmlId();
78
+ $primaryAttributesId = $primaryAttributes->getHtmlId();
79
+
80
+ $afterHtml = Mage::helper('groupedproduct/admin')
81
+ ->getPrimaryAttributeAfterHtml($displayedAttributesId,$primaryAttributesId,$primaryAttributes->getEscapedValue());
82
+
83
+ $primaryAttributes->setAfterElementHtml($afterHtml);
84
+
85
+ return parent::_prepareForm();
86
+ }
87
+
88
+ protected function getAttributeCodes($currentOptions)
89
+ {
90
+
91
+ return Mage::getSingleton('groupedproduct/system_config_source_attributes')->toOptionArray($currentOptions);
92
+ }
93
+
94
+ /**
95
+ * Check permission for passed action
96
+ *
97
+ * @param string $action
98
+ *
99
+ * @return bool
100
+ */
101
+ protected function _isAllowedAction($action)
102
+ {
103
+ return Mage::getSingleton('admin/session')->isAllowed('levementum/levementum_grouped_sets/'.$action);
104
+ }
105
+ }
app/code/community/Levementum/Groupedproduct/Block/Adminhtml/Sets/Grid.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 8/30/12 3:17 PM
5
+ */
6
+
7
+ class Levementum_Groupedproduct_Block_Adminhtml_Sets_Grid extends Mage_Adminhtml_Block_Widget_Grid
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setId('groupedproduct_grid');
13
+ $this->setDefaultSort('set');
14
+ $this->setDefaultDir('asc');
15
+ $this->setDefaultLimit(30);
16
+ $this->setSaveParametersInSession(true);
17
+ }
18
+
19
+ protected function _prepareCollection()
20
+ {
21
+ //Sync any new attribute sets into the grouped table.
22
+ Mage::helper('groupedproduct/sets')->syncAttributeSets();
23
+
24
+ /** @var $groupedproductCollection Levementum_Groupedproduct_Model_Resource_Sets_Collection */
25
+ $groupedproductCollection = Mage::getModel('groupedproduct/sets')->getCollection();
26
+ $groupedproductCollection->join(array('set' => 'eav/attribute_set'),'main_table.set_id = set.attribute_set_id');
27
+
28
+ $this->setCollection($groupedproductCollection);
29
+ return parent::_prepareCollection();
30
+ }
31
+
32
+ protected function _prepareMassaction()
33
+ {
34
+ $this->setMassactionIdField('set_id_selection');
35
+ $this->getMassactionBlock()->setFormFieldName('id');
36
+ $this->getMassactionBlock()->addItem('status', array(
37
+ 'label'=> Mage::helper('catalog')->__('Change status'),
38
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
39
+ 'additional' => array(
40
+ 'visibility' => array(
41
+ 'name' => 'status',
42
+ 'type' => 'select',
43
+ 'class' => 'required-entry',
44
+ 'label' => Mage::helper('catalog')->__('Status'),
45
+ 'values' => array(
46
+ 0 => '',
47
+ 1 => 'Enabled',
48
+ 2 => 'Disabled'
49
+ )
50
+ )
51
+ )
52
+ ));
53
+
54
+ Mage::dispatchEvent('adminhtml_levementum_groupedproduct_grid_prepare_massaction', array('block' => $this));
55
+ }
56
+
57
+ protected function _prepareColumns()
58
+ {
59
+ $this->addColumn('attribute_set_name', array(
60
+ 'header' => Mage::helper('groupedproduct')->__('Attribute Set'),
61
+ 'align' => 'left',
62
+ 'index' => 'attribute_set_name',
63
+ ));
64
+
65
+ $this->addColumn('is_active', array(
66
+ 'header' => Mage::helper('groupedproduct')->__('Is Active'),
67
+ 'align' => 'left',
68
+ 'index' => 'is_active',
69
+ 'type' => 'options',
70
+ 'width' => '50px',
71
+ 'options' => array(
72
+ 1 => 'Yes',
73
+ 0 => 'No'
74
+ )
75
+ ));
76
+
77
+ $this->addColumn('action',
78
+ array(
79
+ 'header' => Mage::helper('catalog')->__('Action'),
80
+ 'width' => '50px',
81
+ 'type' => 'action',
82
+ 'getter' => 'getId',
83
+ 'actions' => array(
84
+ array(
85
+ 'caption' => Mage::helper('groupedproduct')->__('Edit'),
86
+ 'url' => array(
87
+ 'base'=> '*/*/edit'
88
+ ),
89
+ 'field' => 'id'
90
+ )
91
+ ),
92
+ 'filter' => false,
93
+ 'sortable' => false,
94
+ ));
95
+
96
+ return parent::_prepareColumns();
97
+ }
98
+
99
+ public function getRowUrl($row)
100
+ {
101
+ return $this->getUrl('*/*/edit', array('id' => $row->getData('id')));
102
+ }
103
+ }
app/code/community/Levementum/Groupedproduct/Block/Adminhtml/System/Config/Form/Field/Primary.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: icoast@levementum.com
4
+ * Date: 11/30/12 4:41 PM
5
+ */
6
+
7
+ class Levementum_Groupedproduct_Block_Adminhtml_System_Config_Form_Field_Primary extends Mage_Adminhtml_Block_System_Config_Form_Field
8
+ {
9
+ /**
10
+ * Enter description here...
11
+ *
12
+ * @param Varien_Data_Form_Element_Abstract $element
13
+ * @return string
14
+ */
15
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
16
+ {
17
+ $displayedAttributesId = Levementum_Groupedproduct_Helper_Config::MODULE_XPATH_PREFIX.'_groupedproduct_displayed_attributes';
18
+ $primaryAttributesId = Levementum_Groupedproduct_Helper_Config::MODULE_XPATH_PREFIX.'_groupedproduct_primary_attribute';
19
+
20
+ $afterHtml = Mage::helper('groupedproduct/admin')
21
+ ->getPrimaryAttributeAfterHtml($displayedAttributesId,$primaryAttributesId,$element->getEscapedValue());
22
+ $element->setAfterElementHtml($afterHtml);
23
+
24
+ return $element->getElementHtml();
25
+ }
26
+ }
app/code/community/Levementum/Groupedproduct/Block/Catalog/Form/Renderer/Fieldset/Element.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Levementum_Groupedproduct_Block_Catalog_Form_Renderer_Fieldset_Element
4
+ extends Varien_Data_Form_Element_Multiselect
5
+ {
6
+
7
+ /**
8
+ * Retrieve Element HTML fragment
9
+ *
10
+ * @return string
11
+ */
12
+ public function getElementHtml()
13
+ {
14
+ $html = '<div class="levementum-ordered-multiselect">';
15
+ $html .= parent::getElementHtml();
16
+ $html .= '</div>';
17
+
18
+ return $html;
19
+ }
20
+ }
app/code/community/Levementum/Groupedproduct/Block/Catalog/Form/Renderer/Fieldset/Primary.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * User: ian.c
5
+ * Date: 11/30/12 1:59 PM
6
+ */
7
+ class Levementum_Groupedproduct_Block_Catalog_Form_Renderer_Fieldset_Primary
8
+ extends Varien_Data_Form_Element_Text
9
+ {
10
+ /**
11
+ * Retrieve Element HTML fragment
12
+ *
13
+ * @return string
14
+ */
15
+ public function getElementHtml()
16
+ {
17
+ $afterHtml = Mage::helper('groupedproduct/admin')
18
+ ->getPrimaryAttributeAfterHtml('lev_displayed_attributes','lev_primary_attribute',$this->getEscapedValue());
19
+
20
+ $this->addClass('select');
21
+
22
+ $html = '<select id="'.$this->getHtmlId().'" name="'.$this->getName().'" '.$this->serialize($this->getHtmlAttributes()).'>'."\n";
23
+
24
+ $html .= '</select>'."\n";
25
+ $html .= $this->getAfterElementHtml();
26
+ $html .= $afterHtml;
27
+
28
+ return $html;
29
+ }
30
+ }
app/code/community/Levementum/Groupedproduct/Block/Product/View/Type/Grouped.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Levementum_Groupedproduct_Block_Product_View_Type_Grouped extends Mage_Catalog_Block_Product_View_Type_Grouped
4
+ {
5
+ /** @var $toolbar Levementum_Groupedproduct_Block_Toolbar */
6
+ public $toolbar;
7
+ public $toolbar_made = false;
8
+
9
+ public function _construct()
10
+ {
11
+ parent::_construct();
12
+ $this->toolbar = Mage::app()->getLayout()->createBlock('groupedproduct/toolbar', microtime());
13
+
14
+ if (!Mage::registry('grouped-product-id')) {
15
+ Mage::register('grouped-product-id', $this->getProduct()->getId());
16
+ }
17
+
18
+ if ($this->toolbar->getCurrentMode() == 'grid' || $this->toolbar->getCurrentMode() == 'list') {
19
+ Mage::getSingleton('catalog/session')->unsDisplayMode();
20
+ }
21
+
22
+ $this->setChild('toolbar', $this->toolbar);
23
+ }
24
+
25
+ public function inCartConfigure() {
26
+ return Mage::helper('levcore')->inCurrentHandles('checkout_cart_configure');
27
+ }
28
+
29
+ public function getAssociatedProducts()
30
+ {
31
+ return $this->getProduct()->getTypeInstance(true)->getAssociatedProducts($this->getProduct(), $this);
32
+ }
33
+
34
+ /**
35
+ * Set preconfigured values to grouped associated products
36
+ * @return Mage_Catalog_Block_Product_View_Type_Grouped
37
+ */
38
+ public function setPreconfiguredValue()
39
+ {
40
+ $configValues = $this->getProduct()->getPreconfiguredValues()->getSuperGroup();
41
+ if (is_array($configValues)) {
42
+ $associatedProducts = $this->getAssociatedProducts();
43
+ foreach ($associatedProducts as $item) {
44
+ if (isset($configValues[$item->getId()])) {
45
+ $item->setQty($configValues[$item->getId()]);
46
+ }
47
+ }
48
+ }
49
+
50
+ return $this;
51
+ }
52
+
53
+ public function getPagerHtml()
54
+ {
55
+ if (!$this->toolbar_made) {
56
+ /* Change ian.c on 5/9/12 at 1:56 PM
57
+ * Description: added for custom toolbar/pagination
58
+ */
59
+ // use sortable parameters
60
+ if ($orders = $this->getAvailableOrders()) {
61
+ $this->toolbar->setAvailableOrders($orders);
62
+ }
63
+ if ($sort = $this->getDefaultOrder()) {
64
+ $this->toolbar->setDefaultOrder($sort);
65
+ }
66
+ if ($dir = $this->getDefaultDirection()) {
67
+ $this->toolbar->setDefaultDirection($dir);
68
+ }
69
+ /*
70
+ * end custom addition
71
+ */
72
+ }
73
+
74
+ return $this->getChildHtml('toolbar');
75
+ }
76
+
77
+ public function getDefaultDirection()
78
+ {
79
+ return 'asc';
80
+ }
81
+
82
+ public function getDefaultOrder()
83
+ {
84
+ return 'sku';
85
+ }
86
+
87
+ public function getMode()
88
+ {
89
+ return $this->getChild('toolbar')->getCurrentMode();
90
+ }
91
+
92
+ public function getToolbarHtml()
93
+ {
94
+ return $this->getChildHtml('toolbar');
95
+ }
96
+
97
+ /**
98
+ * Return reference to toolbar class.
99
+ * @return Levementum_Groupedproduct_Block_Toolbar
100
+ */
101
+ public function getToolbar()
102
+ {
103
+ return $this->toolbar;
104
+ }
105
+
106
+ protected function _getPriceBlock($productTypeId)
107
+ {
108
+ if (!isset($this->_priceBlock[$productTypeId])) {
109
+ $block = $this->_block;
110
+ if (isset($this->_priceBlockTypes[$productTypeId])) {
111
+ if ($this->_priceBlockTypes[$productTypeId]['block'] != '') {
112
+ $block = $this->_priceBlockTypes[$productTypeId]['block'];
113
+ }
114
+ }
115
+ $this->_priceBlock[$productTypeId] = Mage::app()->getLayout()->createBlock($block);
116
+ }
117
+ return $this->_priceBlock[$productTypeId];
118
+ }
119
+ }
app/code/community/Levementum/Groupedproduct/Block/Toolbar.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 5/9/12 2:10 PM
5
+ * File: Toolbar.php
6
+ */
7
+
8
+ class Levementum_Groupedproduct_Block_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar {
9
+
10
+ /**
11
+ * Init Toolbar
12
+ * Overwrite parent
13
+ */
14
+ protected function _construct()
15
+ {
16
+ parent::_construct();
17
+
18
+ $this->_availableMode = array(
19
+ 'grid' => $this->__('Grid'),
20
+ 'detail' => $this->__('Detail'),
21
+ 'list' => $this->__('List')
22
+ );
23
+ $this->setTemplate('levementum/groupedproduct/product/list/toolbar.phtml');
24
+ }
25
+
26
+ public function getPagerHtml()
27
+ {
28
+ /* @var $pagerBlock Mage_Page_Block_Html_Pager */
29
+ $pagerBlock = $this->getLayout()->createBlock('page/html_pager');
30
+
31
+ if ($pagerBlock instanceof Varien_Object) {
32
+ $pagerBlock->setAvailableLimit($this->getAvailableLimit());
33
+
34
+ $pagerBlock->setUseContainer(false)
35
+ ->setShowPerPage(false)
36
+ ->setShowAmounts(false)
37
+ ->setLimitVarName($this->getLimitVarName())
38
+ ->setPageVarName($this->getPageVarName())
39
+ ->setLimit($this->getLimit())
40
+ ->setCollection($this->getCollection());
41
+ return $pagerBlock->toHtml();
42
+ }
43
+ return '';
44
+ }
45
+
46
+ /**
47
+ * Get specified products limit display per page
48
+ *
49
+ * @return string
50
+ */
51
+ public function getLimit()
52
+ {
53
+ /* Change ian.c on 6/29/12 at 10:06 AM
54
+ * Description: If the current mode is list, paging will be done on client side, force to all.
55
+ */
56
+ if ($this->getCurrentMode() == 'list' || $this->getCurrentMode() == 'detail') {
57
+ $this->setData('_current_limit','all');
58
+ $this->setLimit('all');
59
+ }
60
+
61
+ $limit = $this->_getData('_current_limit');
62
+ if ($limit) {
63
+ return $limit;
64
+ }
65
+
66
+ $limits = $this->getAvailableLimit();
67
+ $defaultLimit = $this->getDefaultPerPageValue();
68
+ if (!$defaultLimit || !isset($limits[$defaultLimit])) {
69
+ $keys = array_keys($limits);
70
+ $defaultLimit = $keys[0];
71
+ }
72
+
73
+ $limit = $this->getRequest()->getParam($this->getLimitVarName());
74
+ if ($limit && isset($limits[$limit])) {
75
+ if ($limit == $defaultLimit) {
76
+ Mage::getSingleton('catalog/session')->unsLimitPage();
77
+ } else {
78
+ $this->_memorizeParam('limit_page', $limit);
79
+ }
80
+ } else {
81
+ $limit = Mage::getSingleton('catalog/session')->getLimitPage();
82
+ }
83
+ if (!$limit || !isset($limits[$limit])) {
84
+ /* Change ian.c on 5/15/12 at 4:51 PM
85
+ * Description: default limit set to all for grouped product
86
+ */
87
+ $limit = 'all';
88
+ }
89
+
90
+ $this->setData('_current_limit', $limit);
91
+ return $limit;
92
+ }
93
+
94
+ /**
95
+ * Retrieve current View mode
96
+ *
97
+ * @return string
98
+ */
99
+ public function getCurrentMode()
100
+ {
101
+ $mode = $this->_getData('_current_grid_mode');
102
+ if ($mode) {
103
+ return $mode;
104
+ }
105
+
106
+ $defaultMode = Mage::helper('groupedproduct/config')->getDefaultDisplayPage();
107
+ $mode = $this->getRequest()->getParam($this->getModeVarName());
108
+ if ($mode) {
109
+ if ($mode == $defaultMode) {
110
+ Mage::getSingleton('catalog/session')->unsDisplayMode();
111
+ } else {
112
+ $this->_memorizeParam('display_mode', $mode);
113
+ }
114
+ } else {
115
+ $mode = Mage::getSingleton('catalog/session')->getDisplayMode();
116
+ }
117
+
118
+ if (!$mode || !isset($this->_availableMode[$mode])) {
119
+ $mode = $defaultMode;
120
+ }
121
+
122
+ //If grid mode is disabled and the selected mode is grid, override it.
123
+ if ($mode == 'grid' && !Mage::helper('groupedproduct/config')->isGridViewEnabled()) {
124
+ //if the default grid mode in config is 'grid' and grid mode is disabled, default to list.
125
+ if ($defaultMode == 'grid') {
126
+ $mode = 'list';
127
+ } else {
128
+ $mode = $defaultMode;
129
+ }
130
+ }
131
+
132
+ $this->setData('_current_grid_mode', $mode);
133
+
134
+ return $mode;
135
+ }
136
+ }
app/code/community/Levementum/Groupedproduct/Helper/Admin.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: icoast@levementum.com
4
+ * Date: 11/30/12 4:44 PM
5
+ */
6
+
7
+ class Levementum_Groupedproduct_Helper_Admin extends Mage_Core_Helper_Abstract {
8
+ //$this->getEscapedValue()
9
+ public function getPrimaryAttributeAfterHtml($displayedAttributesId = 'lev_displayed_attributes',
10
+ $primaryAttributeValId = 'lev_primary_attribute',
11
+ $escapedValue = ''
12
+ )
13
+ {
14
+ $afterHtml = '
15
+
16
+ <input type="hidden" id="'.$primaryAttributeValId.'_val" value="'.$escapedValue.'" />
17
+ <script type="text/javascript">
18
+ var levDisplayedAttributes;
19
+ var levPrimaryAttribute;
20
+ (function($) {
21
+ $(document).ready(function() {
22
+ levDisplayedAttributes = $("#'.$displayedAttributesId.'");
23
+ levPrimaryAttribute = $("#'.$primaryAttributeValId.'");
24
+
25
+ levUpdatePrimaryAttribute();
26
+
27
+ //load initial selection
28
+ levPrimaryAttribute.val($("#'.$primaryAttributeValId.'_val").val());
29
+
30
+ $(levDisplayedAttributes).change(function() {
31
+ levUpdatePrimaryAttribute();
32
+ });
33
+ });
34
+
35
+ function levUpdatePrimaryAttribute() {
36
+ var levDisplayedAttributesSelected = $("#'.$displayedAttributesId.' option:selected");
37
+ var levPrimaryAttributeVal = levPrimaryAttribute.val();
38
+
39
+ levPrimaryAttribute.empty();
40
+ levPrimaryAttribute.append($("<option></option>"));
41
+
42
+ //populate with current selected
43
+ levDisplayedAttributesSelected.each(function() {
44
+ var element = $(this);
45
+ levPrimaryAttribute.append($("<option></option>").attr("value", element.val()).text(element.text()));
46
+ });
47
+
48
+ if (levPrimaryAttributeVal) {
49
+ levPrimaryAttribute.val(levPrimaryAttributeVal);
50
+ }
51
+ }
52
+ })(jQuery)
53
+ </script>
54
+ ';
55
+
56
+ return $afterHtml;
57
+ }
58
+ }
app/code/community/Levementum/Groupedproduct/Helper/Config.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 5/9/12 2:09 PM
5
+ * File: Data.php
6
+ * To change this template use File | Settings | File Templates.
7
+ */
8
+
9
+ class Levementum_Groupedproduct_Helper_Config extends Mage_Core_Helper_Abstract
10
+ {
11
+ const MODULE_XPATH_PREFIX = 'levementum_grouped';
12
+
13
+ public function isThisModuleEnabled()
14
+ {
15
+ return (bool) Mage::getStoreConfig(self::MODULE_XPATH_PREFIX.'/groupedproduct/enabled');
16
+ }
17
+
18
+ public function isGridViewEnabled()
19
+ {
20
+ return (bool) Mage::getStoreConfig(self::MODULE_XPATH_PREFIX.'/display/enabled_grid_view');
21
+ }
22
+
23
+ public function displayIndividualAddToCart()
24
+ {
25
+ return (bool) Mage::getStoreConfig(self::MODULE_XPATH_PREFIX.'/display/display_individual_add');
26
+ }
27
+
28
+ public function allowSortAllAttributes()
29
+ {
30
+ return (bool) Mage::getStoreConfig(self::MODULE_XPATH_PREFIX.'/groupedproduct/allow_sort_all_attributes');
31
+ }
32
+
33
+ public function getDefaultPageLengthAll($_mode = 'list')
34
+ {
35
+ if ($this->getToolbarDisplayMode($_mode, 'limiter') == 'none') {
36
+ return 'all';
37
+ }
38
+ return Mage::getStoreConfig(self::MODULE_XPATH_PREFIX.'/groupedproduct/default_page_length_all');
39
+ }
40
+
41
+ /**
42
+ * @return int
43
+ */
44
+ public function getDefaultPageLength()
45
+ {
46
+ return Mage::getStoreConfig(self::MODULE_XPATH_PREFIX.'/groupedproduct/default_page_length');
47
+ }
48
+
49
+ /**
50
+ * @param $mode string
51
+ *
52
+ * @return bool
53
+ */
54
+ public function displayFirstLast($mode)
55
+ {
56
+ return (bool) Mage::getStoreConfig(self::MODULE_XPATH_PREFIX.'/display_'.$mode.'/display_first_last');
57
+ }
58
+
59
+ /**
60
+ * @return string
61
+ */
62
+ public function getPaginationPrepend($_mode = 'list')
63
+ {
64
+ return Mage::getStoreConfig(self::MODULE_XPATH_PREFIX.'/display_'.$_mode.'/pagination_prepend');
65
+ }
66
+
67
+ public function getDefaultDisplayPage()
68
+ {
69
+ return Mage::getStoreConfig(self::MODULE_XPATH_PREFIX.'/groupedproduct/default_display_page');
70
+ }
71
+
72
+ public function allowAllAttributes()
73
+ {
74
+ return (bool) Mage::getStoreConfig(self::MODULE_XPATH_PREFIX.'/groupedproduct/allow_all_attributes');
75
+ }
76
+
77
+ public function getToolbarDisplayMode($mode, $type)
78
+ {
79
+ return Mage::getStoreConfig(self::MODULE_XPATH_PREFIX.'/display_'.$mode.'/'.$type);
80
+ }
81
+
82
+ public function getDefaultDisplayedAttributes()
83
+ {
84
+ return Mage::getStoreConfig(self::MODULE_XPATH_PREFIX.'/groupedproduct/displayed_attributes');
85
+ }
86
+
87
+ public function getDefaultPrimaryAttribute()
88
+ {
89
+ return Mage::getStoreConfig(self::MODULE_XPATH_PREFIX.'/groupedproduct/primary_attribute');
90
+ }
91
+ }
app/code/community/Levementum/Groupedproduct/Helper/Data.php ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 5/9/12 2:09 PM
5
+ * File: Data.php
6
+ * To change this template use File | Settings | File Templates.
7
+ */
8
+ class Levementum_Groupedproduct_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+ /** @var $_configHelper Levementum_Groupedproduct_Helper_Config */
11
+ protected $_configHelper;
12
+
13
+ protected $_options = array();
14
+ protected $_optionsArray = array();
15
+ protected $_attributeId;
16
+ protected $_attributes;
17
+
18
+ public function __construct()
19
+ {
20
+ $this->_configHelper = Mage::helper('groupedproduct/config');
21
+
22
+ $this->_attributeId = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product', 'lev_displayed_attributes');
23
+ $this->_options = Mage::getModel('eav/entity_attribute')->load($this->_attributeId)->getSource()->getUnprocessedOptions();
24
+
25
+ $this->_optionsArray = array();
26
+ foreach ($this->_options as $option) {
27
+ $this->_optionsArray[$option['label']] = $option['value'];
28
+ }
29
+
30
+ $this->_attributes = Mage::getSingleton('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
31
+ }
32
+
33
+ /**
34
+ * @param array $excludeAttr
35
+ *
36
+ * @return array
37
+ */
38
+ public function getAdditionalData(array $excludeAttr = array())
39
+ {
40
+ $unsorted_value = 1000;
41
+ $data = array();
42
+
43
+ /** @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
44
+ foreach ($this->_attributes as $attribute) {
45
+ if ($this->_configHelper->allowAllAttributes() || ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), $excludeAttr))) {
46
+ if (!in_array($attribute->getAttributeCode(), $excludeAttr)) {
47
+ $label = $attribute->getStoreLabel();
48
+ if (!empty($label)) {
49
+ $label = substr($label, 0, 40);
50
+
51
+ $data[$attribute->getAttributeCode()] = array(
52
+ 'label' => $label,
53
+ 'value' => $attribute->getAttributeCode(),
54
+ 'code' => $attribute->getAttributeCode(),
55
+ 'used_for_sort_by' => $attribute->getUsedForSortBy(),
56
+ 'sorted_value' => $unsorted_value++,
57
+ 'primary' => false
58
+ );
59
+ }
60
+ }
61
+ }
62
+ }
63
+
64
+ return $data;
65
+ }
66
+
67
+ /**
68
+ * @param $displayedAttributes
69
+ * @param null|Mage_Catalog_Model_Product $_product
70
+ * @param bool $fromSortBy
71
+ *
72
+ * @return array
73
+ */
74
+ public function getDisplayedAttributeList($displayedAttributes = array(), $_product = null, $fromSortBy = false)
75
+ {
76
+ //See if product is defined and try to get those displayed attributes.
77
+ $set = false;
78
+ if ($this->isEmpty($displayedAttributes) && !empty($_product)) {
79
+ if ($setId = $_product->getAttributeSetId()) {
80
+ /** @var $set Levementum_Groupedproduct_Model_Sets */
81
+ //load by set id
82
+ $set = Mage::getSingleton('groupedproduct/sets')->reset()->load($setId, 'set_id');
83
+
84
+ //if it exists, see if there are any defined.
85
+ if ($set->getId() && $set->isActive()) {
86
+ $displayedAttributes = $set->getAttributeCodes();
87
+ }
88
+ }
89
+ }
90
+
91
+ //If it is empty try to get default.
92
+ if ($this->isEmpty($displayedAttributes)) {
93
+ $displayedAttributes = $this->_configHelper->getDefaultDisplayedAttributes();
94
+ }
95
+
96
+ //if it is still empty, exit.
97
+ if ($this->isEmpty($displayedAttributes)) {
98
+ return array();
99
+ }
100
+
101
+ //If it is not an array, make it so.
102
+ if (!is_array($displayedAttributes)) {
103
+ $displayedAttributes = explode(',', $displayedAttributes);
104
+ }
105
+
106
+ $allAttributes = $this->getAdditionalData();
107
+ $attributes = array();
108
+
109
+ $productPrimaryCode = false;
110
+ $setPrimaryCode = false;
111
+ $defaultPrimaryCode = false;
112
+ foreach ($displayedAttributes as $displayedKey => $displayed) {
113
+ foreach ($allAttributes as $key => $attribute) {
114
+ if ($attribute['value'] == $displayed || $attribute['code'] == $displayed) {
115
+ if ($fromSortBy) {
116
+ if ($attribute['used_for_sort_by'] == false && !$this->_configHelper->allowSortAllAttributes()) {
117
+ unset($displayedAttributes[$displayedKey]);
118
+ continue;
119
+ }
120
+ }
121
+
122
+ $attributes[$attribute['code']] = $allAttributes[$key];
123
+
124
+ if (!$defaultPrimaryCode && $this->_configHelper->getDefaultPrimaryAttribute() == $attribute['code']) {
125
+ $defaultPrimaryCode = $attribute['code'];
126
+ }
127
+
128
+ if (!$setPrimaryCode && $set && $set->getPrimaryAttribute() == $attribute['code']) {
129
+ $setPrimaryCode = $attribute['code'];
130
+ }
131
+
132
+ if (!$productPrimaryCode && $_product && $_product->getLevPrimaryAttribute() == $attribute['code']) {
133
+ $productPrimaryCode = $attribute['code'];
134
+ }
135
+
136
+ //We've found it, don't need to continue searching.
137
+ break; //break one level
138
+ }
139
+ }
140
+ }
141
+
142
+ if ($productPrimaryCode && isset($attributes[$productPrimaryCode])) {
143
+ $attributes[$productPrimaryCode]['primary'] = true;
144
+ } elseif ($setPrimaryCode && isset($attributes[$setPrimaryCode])) {
145
+ $attributes[$setPrimaryCode]['primary'] = true;
146
+ } elseif ($defaultPrimaryCode && isset($attributes[$defaultPrimaryCode])) {
147
+ $attributes[$defaultPrimaryCode]['primary'] = true;
148
+ }
149
+
150
+ return $attributes;
151
+ }
152
+
153
+ /**
154
+ * @param null|array|string $displayedAttributes
155
+ *
156
+ * @return bool
157
+ */
158
+ protected function isEmpty($displayedAttributes)
159
+ {
160
+ return (empty($displayedAttributes) || (!is_array($displayedAttributes) && substr_count($displayedAttributes, ',') == strlen($displayedAttributes)));
161
+ }
162
+
163
+ /**
164
+ * @param $mode string list/detail
165
+ *
166
+ * @return string
167
+ */
168
+ public function getToolbarSDom($mode)
169
+ {
170
+ return $this->getToolbarPositionSDom($mode, 'top').'rt'.$this->getToolbarPositionSDom($mode, 'bottom').'<"clear">';
171
+ }
172
+
173
+ /**
174
+ * @param $mode string list/detail
175
+ * @param $position string top/bottom
176
+ *
177
+ * @return string
178
+ */
179
+ protected function getToolbarPositionSDom($mode, $position)
180
+ {
181
+ $pagination = '';
182
+ $limiter = '';
183
+ $information = '';
184
+
185
+ $informationConfig = $this->_configHelper->getToolbarDisplayMode($mode, 'information');
186
+ if ($informationConfig == $position || $informationConfig == 'both') {
187
+ $information = 'i';
188
+ }
189
+
190
+ $limiterConfig = $this->_configHelper->getToolbarDisplayMode($mode, 'limiter');
191
+ if ($limiterConfig == $position || $limiterConfig == 'both') {
192
+ $limiter = 'l';
193
+
194
+ //Pagination can only be displayed if the limiter is displayed.
195
+ $paginationConfig = $this->_configHelper->getToolbarDisplayMode($mode, 'pagination');
196
+ if ($paginationConfig == $position || $paginationConfig == 'both') {
197
+ $pagination = 'p';
198
+ }
199
+ }
200
+
201
+ if (empty($information) && empty($pagination) && empty($limiter)) {
202
+ return '';
203
+ } else {
204
+ return '<"dataTable-'.$position.'"'.$information.$pagination.$limiter.'>';
205
+ }
206
+ }
207
+
208
+ public function getPriceLabel()
209
+ {
210
+ return Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', 'price')->getStoreLabel();
211
+ }
212
+
213
+ /**
214
+ * @param $simpleProduct int|Mage_Catalog_Model_Product
215
+ *
216
+ * @return bool|Mage_Catalog_Model_Product
217
+ */
218
+ public function getGroupedProductFromSimple($simpleProduct)
219
+ {
220
+ $groupedParentIds = $this->getGroupedProductIdsFromSimple($simpleProduct);
221
+
222
+ if (empty($groupedParentIds)) {
223
+ return false;
224
+ }
225
+
226
+ if (is_array($groupedParentIds)) {
227
+ //find the first grouped product it is apart of.
228
+ foreach ($groupedParentIds as $id) {
229
+ $groupedParentId = $id;
230
+ break;
231
+ }
232
+ }
233
+
234
+ return Mage::getModel('catalog/product')->load($groupedParentId);
235
+ }
236
+
237
+ /**
238
+ * @param $simpleProduct
239
+ *
240
+ * @return array
241
+ */
242
+ public function getGroupedProductIdsFromSimple($simpleProduct)
243
+ {
244
+ if (is_numeric($simpleProduct)) {
245
+ $simpleProduct = Mage::getModel('catalog/product')->load($simpleProduct);
246
+ }
247
+
248
+ if (!($simpleProduct instanceof Mage_Catalog_Model_Product)
249
+ || !$simpleProduct->getId()
250
+ || $simpleProduct->getTypeId() != 'simple'
251
+ ) {
252
+ return array();
253
+ }
254
+
255
+ $groupedProductModel = Mage::getModel('catalog/product_type_grouped');
256
+
257
+ return $groupedProductModel->getParentIdsByChild($simpleProduct->getId());
258
+ }
259
+ }
app/code/community/Levementum/Groupedproduct/Helper/Sets.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: icoast@levementum.com
4
+ * Date: 1/10/13 5:18 PM
5
+ * File: Sets.php
6
+ */
7
+
8
+ class Levementum_Groupedproduct_Helper_Sets extends Mage_Core_Helper_Abstract {
9
+ /**
10
+ * Sync any new sets into the grouped set. Code assumes sets may not be in the table, that's ok.
11
+ *
12
+ * This also allows for sets to be added in other ways such as custom import/export script people may have.
13
+ */
14
+ public function syncAttributeSets()
15
+ {
16
+ //load current grouped sets
17
+ /** @var $groupedproductCollection Levementum_Groupedproduct_Model_Resource_Sets_Collection */
18
+ $groupedproductCollection = Mage::getModel('groupedproduct/sets')->getCollection();
19
+ $setIds = $groupedproductCollection->getAllSetIds();
20
+
21
+ $entityType = Mage::getModel('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY);
22
+ $entityTypeId = $entityType->getEntityTypeId();
23
+
24
+ /** @var $attributeSets Mage_Eav_Model_Resource_Entity_Attribute_Set_Collection */
25
+ $attributeSets = Mage::getModel('eav/entity_attribute_set')
26
+ ->getCollection()
27
+ ->addFieldToFilter('entity_type_id',$entityTypeId)
28
+ ->addFieldToFilter('attribute_set_id',array('nin'=>$setIds));
29
+
30
+ foreach ($attributeSets as $attributeSet) {
31
+ $model = Mage::getModel('groupedproduct/sets');
32
+ $model->setSetId($attributeSet->getId())->save();
33
+ }
34
+ }
35
+ }
app/code/community/Levementum/Groupedproduct/Model/Backend/Option.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 5/15/12 10:47 AM
5
+ * File: Option.php
6
+ */
7
+
8
+ class Levementum_Groupedproduct_Model_Backend_Option extends Mage_Eav_Model_Entity_Attribute_Backend_Array
9
+ {
10
+
11
+ }
app/code/community/Levementum/Groupedproduct/Model/Entity/Setup.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /**
5
+ * EAV Entity Setup Model
6
+ * @category Mage
7
+ * @package Mage_Eav
8
+ * @author Magento Core Team <core@magentocommerce.com>
9
+ */
10
+ class Levementum_Groupedproduct_Model_Entity_Setup extends Mage_Eav_Model_Entity_Setup
11
+ {
12
+ /**
13
+ * Prepare attribute values to save
14
+ *
15
+ * @param array $attr
16
+ *
17
+ * @return array
18
+ */
19
+ protected function _prepareValues($attr)
20
+ {
21
+ $data = array(
22
+ 'backend_model' => $this->_getValue($attr, 'backend'),
23
+ 'backend_type' => $this->_getValue($attr, 'type', 'varchar'),
24
+ 'backend_table' => $this->_getValue($attr, 'table'),
25
+ 'frontend_model' => $this->_getValue($attr, 'frontend'),
26
+ 'frontend_input' => $this->_getValue($attr, 'input', 'text'),
27
+ 'frontend_label' => $this->_getValue($attr, 'label'),
28
+ 'frontend_class' => $this->_getValue($attr, 'frontend_class'),
29
+ 'source_model' => $this->_getValue($attr, 'source'),
30
+ 'is_visible' => $this->_getValue($attr, 'visible',1),
31
+ 'is_required' => $this->_getValue($attr, 'required', 1),
32
+ 'is_user_defined' => $this->_getValue($attr, 'user_defined', 0),
33
+ 'default_value' => $this->_getValue($attr, 'default'),
34
+ 'is_unique' => $this->_getValue($attr, 'unique', 0),
35
+ 'note' => $this->_getValue($attr, 'note'),
36
+ 'is_global' => $this->_getValue($attr, 'global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL),
37
+ 'is_filterable' => $this->_getValue($attr, 'filterable', 0),
38
+ 'is_filterable_in_search' => $this->_getValue($attr, 'is_filterable_in_search', 0),
39
+ 'is_configurable' => $this->_getValue($attr, 'configurable', 0),
40
+ 'used_in_product_listing' => $this->_getValue($attr, 'used_in_product_listing', 1),
41
+ 'frontend_input_renderer' => $this->_getValue($attr, 'frontend_input_renderer'),
42
+ );
43
+
44
+ return $data;
45
+ }
46
+ }
app/code/community/Levementum/Groupedproduct/Model/ImportExport/Export/Entity/Product/Type/Grouped.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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_ImportExport
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+
27
+ /**
28
+ * Export entity product type grouped model
29
+ *
30
+ * @category Mage
31
+ * @package Mage_ImportExport
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ if (file_exists('Mage/ImportExport/Model/Export/Entity/Product/Type/Grouped')) {
35
+ include_once('Mage/ImportExport/Model/Export/Entity/Product/Type/Grouped');
36
+ }
37
+ class Levementum_Groupedproduct_Model_ImportExport_Export_Entity_Product_Type_Grouped
38
+ extends Mage_ImportExport_Model_Export_Entity_Product_Type_Grouped
39
+ {
40
+ public function __construct()
41
+ {
42
+ //incase they implement in the future.
43
+ if (method_exists('Mage_ImportExport_Model_Export_Entity_Product_Type_Grouped', '__construct')
44
+ || method_exists('Mage_ImportExport_Model_Export_Entity_Product_Type_Abstract', '__construct')) {
45
+ parent::__construct();
46
+ }
47
+
48
+ $this->mergeDisabledAttributes();
49
+ }
50
+
51
+ protected function mergeDisabledAttributes() {
52
+ $this->_disabledAttrs[] = 'lev_displayed_attributes';
53
+ }
54
+ }
app/code/community/Levementum/Groupedproduct/Model/Observer.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 7/18/12 12:41 PM
5
+ *
6
+ * The goal of this file is to keep the attribute list for "lev_displayed_attributes" in sync with current attribute list.
7
+ * This allows importing/exporting using built-in Magento.
8
+ */
9
+
10
+ class Levementum_Groupedproduct_Model_Observer
11
+ {
12
+ /**
13
+ * @param Varien_Event_Observer $observer
14
+ */
15
+ public function addLevementumGroupedHandle(Varien_Event_Observer $observer)
16
+ {
17
+ $product = Mage::registry('current_product');
18
+
19
+ /**
20
+ * Return if it is not product page
21
+ */
22
+ if (!($product instanceof Mage_Catalog_Model_Product)) {
23
+ return;
24
+ }
25
+
26
+ $update = $observer->getEvent()->getLayout()->getUpdate();
27
+
28
+ $currentHandles = $update->getHandles();
29
+
30
+ if (in_array('PRODUCT_TYPE_grouped', $currentHandles)) {
31
+ if (Mage::helper('groupedproduct/config')->isThisModuleEnabled()) {
32
+ $update->addHandle('LEVEMENTUM_PRODUCT_TYPE_grouped');
33
+ }
34
+ } elseif (in_array('PRODUCT_TYPE_simple', $currentHandles)) {
35
+ if (Mage::helper('groupedproduct/config')->isThisModuleEnabled()) {
36
+ $update->addHandle('LEVEMENTUM_PRODUCT_TYPE_simple');
37
+ }
38
+ }
39
+ }
40
+ }
app/code/community/Levementum/Groupedproduct/Model/PageCache/Container/Groupedproduct.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Levementum_Groupedproduct_Model_PageCache_Container_Groupedproduct extends Enterprise_PageCache_Model_Container_Abstract
4
+ {
5
+ const CACHE_TAG_PREFIX = 'LEVEMENTUM_GROUPED_TABLE_';
6
+
7
+ protected function _getIdentifier()
8
+ {
9
+ return $this->_getProductId().'_'.$this->_getMode();
10
+ }
11
+
12
+ protected function _getMode() {
13
+ $mode = Mage::app()->getRequest()->getParam('mode','list');
14
+ return $mode;
15
+ }
16
+
17
+ /**
18
+ * Get cache identifier
19
+ *
20
+ * @return string
21
+ */
22
+ protected function _getCacheId()
23
+ {
24
+ $id = self::CACHE_TAG_PREFIX . md5($this->_placeholder->getAttribute('cache_id') . $this->_getIdentifier());
25
+
26
+ return $id;
27
+ }
28
+
29
+ /**
30
+ * Render block content
31
+ *
32
+ * @return string
33
+ */
34
+ protected function _renderBlock()
35
+ {
36
+ $blockClass = $this->_placeholder->getAttribute('block');
37
+ $template = $this->_placeholder->getAttribute('template');
38
+
39
+ $productId = $this->_getProductId();
40
+ if ($productId && !Mage::registry('product')) {
41
+ $product = Mage::getModel('catalog/product')
42
+ ->setStoreId(Mage::app()->getStore()->getId())
43
+ ->load($productId);
44
+ if ($product) {
45
+ Mage::register('product', $product);
46
+ }
47
+ }
48
+
49
+ $block = new $blockClass;
50
+ $block->setTemplate($template);
51
+ return $block->toHtml();
52
+ }
53
+ }
app/code/community/Levementum/Groupedproduct/Model/Product/Type/Grouped.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Grouped product type implementation
5
+ * @category Mage
6
+ * @package Mage_Catalog
7
+ * @author Magento Core Team <core@magentocommerce.com>
8
+ */
9
+
10
+ if (is_file('Mage/Catalog/Model/Product/Type/Grouped.php')) {
11
+ include_once 'Mage/Catalog/Model/Product/Type/Grouped.php';
12
+ }
13
+
14
+ class Levementum_Groupedproduct_Model_Product_Type_Grouped extends Mage_Catalog_Model_Product_Type_Grouped
15
+ {
16
+ /**
17
+ * Retrieve array of associated products
18
+ *
19
+ * @param Mage_Catalog_Model_Product $product
20
+ * @param Levementum_Groupedproduct_Block_Product_View_Type_Grouped $block
21
+ *
22
+ * @return array
23
+ */
24
+ public function getAssociatedProducts($product = null, Levementum_Groupedproduct_Block_Product_View_Type_Grouped $block = null)
25
+ {
26
+ if (!$this->getProduct($product)->hasData($this->_keyAssociatedProducts)) {
27
+ $associatedProducts = array();
28
+
29
+ if (!Mage::app()->getStore()->isAdmin()) {
30
+ $this->setSaleableStatus($product);
31
+ }
32
+
33
+ $collection = $this->getAssociatedProductCollection($product)
34
+ ->addAttributeToSelect('*')
35
+ ->addFilterByRequiredOptions()
36
+ ->setPositionOrder()
37
+ ->addStoreFilter($this->getStoreFilter($product))
38
+ ->addAttributeToFilter('status', array('in' => $this->getStatusFilters($product)));
39
+
40
+ if (!is_null($block)) {
41
+ /* Change ian.c on 5/9/12 at 12:05 PM
42
+ * Description: Add custom pager, we need to get the collection.
43
+ */
44
+ $block->getToolbar()->setCollection($collection);
45
+ }
46
+
47
+ foreach ($collection as $item) {
48
+ $associatedProducts[] = $item;
49
+ }
50
+
51
+ $this->getProduct($product)->setData($this->_keyAssociatedProducts, $associatedProducts);
52
+ }
53
+
54
+ return $this->getProduct($product)->getData($this->_keyAssociatedProducts);
55
+ }
56
+ }
app/code/community/Levementum/Groupedproduct/Model/Resource/Sets.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 7/2/12 8:44 AM
5
+ * File: Groupedproduct.php
6
+ */
7
+ class Levementum_Groupedproduct_Model_Resource_Sets extends Mage_Core_Model_Resource_Db_Abstract {
8
+ public function _construct() {
9
+ $this->_init('groupedproduct/sets','id');
10
+ }
11
+ }
app/code/community/Levementum/Groupedproduct/Model/Resource/Sets/Collection.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 7/2/12 8:45 AM
5
+ * File: Collection.php
6
+ */
7
+
8
+ Class Levementum_Groupedproduct_Model_Resource_Sets_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
9
+ public function _construct() {
10
+ $this->_init('groupedproduct/sets');
11
+ }
12
+
13
+ public function delete()
14
+ {
15
+ foreach ($this->getItems() as $k=>$item) {
16
+ $item->delete();
17
+ unset($this->_items[$k]);
18
+ }
19
+ return $this;
20
+ }
21
+
22
+ public function getAllSetIds()
23
+ {
24
+ $setIds = array();
25
+ foreach ($this->getItems() as $set) {
26
+ $setIds[$set->getSetId()] = $set->getSetId();
27
+ }
28
+
29
+ return $setIds;
30
+ }
31
+ }
app/code/community/Levementum/Groupedproduct/Model/Sets.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 7/2/12 8:43 AM
5
+ * File: Groupedproduct.php
6
+ * To change this template use File | Settings | File Templates.
7
+ */
8
+
9
+ /**
10
+ * @method array getAttributeCodes()
11
+ */
12
+ class Levementum_Groupedproduct_Model_Sets extends Mage_Core_Model_Abstract
13
+ {
14
+ public function _construct()
15
+ {
16
+ parent::_construct();
17
+ $this->_init('groupedproduct/sets');
18
+ }
19
+
20
+ public function _afterLoad()
21
+ {
22
+ if ($this->getAttributeCodes()) {
23
+ $this->setAttributeCodes(explode(',', $this->getAttributeCodes()));
24
+ }
25
+ }
26
+
27
+ public function _beforeSave()
28
+ {
29
+ if ($this->getAttributeCodes()) {
30
+ $this->setAttributeCodes(implode(',', $this->getAttributeCodes()));
31
+ }
32
+ }
33
+
34
+ public function isActive()
35
+ {
36
+ return (bool) $this->getData('is_active');
37
+ }
38
+
39
+ /**
40
+ * Reset all model data
41
+ * @return Levementum_Groupedproduct_Model_Sets
42
+ */
43
+ public function reset()
44
+ {
45
+ $this->setData(array());
46
+
47
+ return $this;
48
+ }
49
+ }
app/code/community/Levementum/Groupedproduct/Model/Source/Option.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 5/15/12 12:46 PM
5
+ * File: Option.php
6
+ */
7
+
8
+ if (!function_exists('value_sort')) {
9
+ function value_sort($a, $b)
10
+ {
11
+ $a = $a['sorted_value'];
12
+ $b = $b['sorted_value'];
13
+ if ($a == $b) {
14
+ return 0;
15
+ }
16
+
17
+ return ($a < $b) ? -1 : 1;
18
+ }
19
+ }
20
+
21
+ class Levementum_Groupedproduct_Model_Source_Option extends Mage_Eav_Model_Entity_Attribute_Source_Table
22
+ {
23
+ public function getAllOptions()
24
+ {
25
+ return $this->getOptionFromTable();
26
+ }
27
+
28
+ private function getOptionFromTable()
29
+ {
30
+ $sorted_value = 1;
31
+
32
+ /* Change ian.c on 10/18/12 at 3:27 PM - Description: If no product is defined we are in a process other then import/export. Reverse the result. */
33
+ if (!Mage::registry('current_product') && !Mage::registry('product')) {
34
+ $attributes = Mage::getSingleton('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
35
+
36
+ $_options = array();
37
+ foreach ($attributes as $attribute) {
38
+ if (!$attribute->getStoreLabel()) {
39
+ continue;
40
+ }
41
+
42
+ $_options[] = array(
43
+ 'label' => $attribute->getStoreLabel(),
44
+ 'value' => $attribute->getAttributeCode()
45
+ );
46
+ }
47
+
48
+ return $_options;
49
+ }
50
+
51
+ /** @var $product Mage_Catalog_Model_Product */
52
+ $product = Mage::registry('current_product');
53
+ $attributeCodesInSet = $this->getAttributeCodesinSet($product->getAttributeSetId());
54
+
55
+ $data = $product->getData('lev_displayed_attributes');
56
+ if (gettype($data) == 'string') {
57
+ $data = explode(',', $data);
58
+ }
59
+ // echo '<pre>',print_r($data,true),'</pre>';
60
+
61
+ $attributes = Mage::helper('groupedproduct/data')->getAdditionalData();
62
+
63
+ if (!empty($data)) {
64
+ //this prioritizes the order of the data, not the attribute list.
65
+ foreach ($data as $datum) {
66
+ foreach ($attributes as $key => $attribute) {
67
+ if ($attribute['value'] == $datum) {
68
+ $attributes[$key]['sorted_value'] = $sorted_value++;
69
+ }
70
+ }
71
+ }
72
+
73
+ uasort($attributes, 'value_sort');
74
+ }
75
+
76
+ // echo '<pre>',print_r($attributes,true),'</pre>';
77
+ // die('File: '.__FILE__.' on Line: '.__LINE__);
78
+
79
+ return array_intersect_key($attributes, $attributeCodesInSet);
80
+ }
81
+
82
+ public function getUnprocessedOptions()
83
+ {
84
+ return parent::getAllOptions();
85
+ }
86
+
87
+ public function getAttributeCodesinSet($setid)
88
+ {
89
+
90
+ $attributes = Mage::getModel('catalog/product')->getResource()
91
+ ->loadAllAttributes()
92
+ ->getSortedAttributes($setid);
93
+ $result = array();
94
+
95
+ foreach ($attributes as $attribute) {
96
+ if ($attribute->getId()) {
97
+ $result[$attribute->getAttributeCode()] = true;
98
+ }
99
+ }
100
+
101
+ return $result;
102
+ }
103
+ }
app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/AllNumber.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Used in creating options for All|Specified config value selection
4
+ *
5
+ */
6
+ class Levementum_Groupedproduct_Model_System_Config_Source_AllNumber
7
+ {
8
+
9
+ /**
10
+ * @return array
11
+ */
12
+ public function toOptionArray()
13
+ {
14
+ return array(
15
+ array('value' => 'all', 'label'=>Mage::helper('adminhtml')->__('All')),
16
+ array('value' => 'other', 'label'=>Mage::helper('adminhtml')->__('Specified'))
17
+ );
18
+ }
19
+
20
+ }
app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/Attributes.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Levementum_Groupedproduct_Model_System_Config_Source_Attributes
4
+ {
5
+ protected $_options;
6
+
7
+ public function toOptionArray($currentOptions = array())
8
+ {
9
+ if (!$this->_options) {
10
+ if (!$currentOptions || is_bool($currentOptions)) {
11
+ $currentOptions = Mage::getStoreConfig('levementum_grouped/groupedproduct/displayed_attributes');
12
+ }
13
+
14
+ if (!is_array($currentOptions)) {
15
+ $currentOptions = explode(',', $currentOptions);
16
+ }
17
+
18
+ $currentOptions = array_flip($currentOptions);
19
+
20
+ /** @var $_attributes Mage_Eav_Model_Resource_Entity_Attribute_Collection */
21
+ $_attributes = Mage::getSingleton('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
22
+
23
+ /** @var $attribute Mage_Eav_Model_Entity_Attribute */
24
+ $this->_options = array();
25
+ foreach ($_attributes as $attribute) {
26
+ $tmpArray = array(
27
+ 'value' => $attribute->getAttributeCode(),
28
+ 'label' => $attribute->getStoreLabel(),
29
+ );
30
+
31
+ if (isset($currentOptions[$attribute->getAttributeCode()])) {
32
+ $currentOptions[$attribute->getAttributeCode()] = $tmpArray;
33
+ } else {
34
+ $this->_options[] = $tmpArray;
35
+ }
36
+ }
37
+
38
+ foreach ($currentOptions as $tmpArray) {
39
+ $this->_options[] = $tmpArray;
40
+ }
41
+ }
42
+
43
+ return $this->_options;
44
+ }
45
+ }
app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/Datatables.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Levementum_Groupedproduct_Model_System_Config_Source_Datatables
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value'=>'both', 'label'=>Mage::helper('adminhtml')->__('Both')),
9
+ array('value'=>'top', 'label'=>Mage::helper('adminhtml')->__('Top')),
10
+ array('value'=>'bottom', 'label'=>Mage::helper('adminhtml')->__('Bottom')),
11
+ array('value'=>'none', 'label'=>Mage::helper('adminhtml')->__('None')),
12
+ );
13
+ }
14
+ }
app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/List.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Levementum_Groupedproduct_Model_System_Config_Source_List
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value'=>'grid', 'label'=>Mage::helper('adminhtml')->__('Grid')),
9
+ array('value'=>'list', 'label'=>Mage::helper('adminhtml')->__('List')),
10
+ array('value'=>'detail', 'label'=>Mage::helper('adminhtml')->__('Detail')),
11
+ );
12
+ }
13
+ }
app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/Options.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Used in creating options for All|Specified config value selection
4
+ *
5
+ */
6
+ class Levementum_Groupedproduct_Model_System_Config_Source_Options
7
+ {
8
+
9
+ /**
10
+ * @return array
11
+ */
12
+ public function toOptionArray()
13
+ {
14
+ /** @var $collection Levementum_Groupedproduct_Model_Resource_Warehouses_Collection */
15
+ $collection = Mage::getModel('catalog/product_option')->getCollection()->getOptions(Mage::app()->getStore()->getStoreId());
16
+
17
+ $options = array();
18
+ $options[] = array(
19
+ 'value' => '',
20
+ 'label' => ''
21
+ );
22
+ foreach ($collection as $item) {
23
+ $options[$item->getTitle()] = array(
24
+ 'value' => $item->getTitle(),
25
+ 'label' => $item->getTitle()
26
+ );
27
+ }
28
+
29
+
30
+ return $options;
31
+ }
32
+
33
+ }
app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/Pagination.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Used in creating options for All|Specified config value selection
4
+ *
5
+ */
6
+ class Levementum_Groupedproduct_Model_System_Config_Source_AllNumber
7
+ {
8
+
9
+ /**
10
+ * @return array
11
+ */
12
+ public function toOptionArray()
13
+ {
14
+ return array(
15
+ array('value' => 'all', 'label'=>Mage::helper('adminhtml')->__('All')),
16
+ array('value' => 'other', 'label'=>Mage::helper('adminhtml')->__('Specified'))
17
+ );
18
+ }
19
+
20
+ }
app/code/community/Levementum/Groupedproduct/Model/System/Config/Source/PaginationDisplay.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (file_exists('Levementum/Groupedproduct/Model/System/Config/Source/Datatables.php')) {
4
+ include_once('Levementum/Groupedproduct/Model/System/Config/Source/Datatables.php');
5
+ }
6
+
7
+ class Levementum_Groupedproduct_Model_System_Config_Source_PaginationDisplay extends
8
+ Levementum_Groupedproduct_Model_System_Config_Source_Datatables
9
+ {
10
+ public function toOptionArray()
11
+ {
12
+ $options = parent::toOptionArray();
13
+ foreach ($options as $key => $option) {
14
+ if ($option['value'] == 'none') {
15
+ unset($options[$key]);
16
+ }
17
+ }
18
+
19
+ return $options;
20
+ }
21
+ }
app/code/community/Levementum/Groupedproduct/controllers/Adminhtml/SetsController.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Cms manage blocks controller
5
+ *
6
+ * @category Mage
7
+ * @package Mage_Adminhtml
8
+ * @author Magento Core Team <core@magentocommerce.com>
9
+ */
10
+
11
+ class Levementum_Groupedproduct_Adminhtml_SetsController extends Mage_Adminhtml_Controller_Action
12
+ {
13
+ /**
14
+ * Init actions
15
+ *
16
+ * @return Mage_Adminhtml_Cms_BlockController
17
+ */
18
+ protected function _initAction()
19
+ {
20
+ // load layout, set active menu and breadcrumbs
21
+ $this->loadLayout()->_setActiveMenu('groupedproduct/sets');
22
+ return $this;
23
+ }
24
+
25
+ /**
26
+ * Index action
27
+ */
28
+ public function indexAction()
29
+ {
30
+ $this->_title($this->__('groupedproduct'))->_title($this->__('Sets'));
31
+ $this->_initAction();
32
+ $this->renderLayout();
33
+ }
34
+
35
+ public function gridAction()
36
+ {
37
+ $this->_title($this->__('groupedproduct'))->_title($this->__('Sets'));
38
+ $this->_initAction();
39
+ $this->renderLayout();
40
+ }
41
+
42
+ public function editAction()
43
+ {
44
+ $id = $this->getRequest()->getParam('id');
45
+ $model = Mage::getModel('groupedproduct/sets')->load($id);
46
+
47
+ if ($model->getId() || $id == 0) {
48
+
49
+ $set = Mage::getModel('eav/entity_attribute_set')->load($model->getSetId());
50
+ $model->setData('attribute_set_name',$set->getAttributeSetName());
51
+
52
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
53
+ if (!empty($data)) {
54
+ $model->setData($data);
55
+ }
56
+
57
+ Mage::register('sets_data', $model);
58
+
59
+ $this->loadLayout();
60
+ $this->_setActiveMenu('groupedproduct/sets');
61
+
62
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
63
+
64
+ $this->_addContent($this->getLayout()->createBlock('groupedproduct/adminhtml_sets_edit'));
65
+
66
+ $this->renderLayout();
67
+ } else {
68
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('groupedproduct')->__('Set does not exist'));
69
+ $this->_redirect('*/*/');
70
+ }
71
+ }
72
+
73
+ public function saveAction()
74
+ {
75
+ if ($data = $this->getRequest()->getPost()) {
76
+ $setsModel = Mage::getModel('groupedproduct/sets'); /** @var $setsModel Levementum_Groupedproduct_Model_Groupedproduct */
77
+ $setId = $this->getRequest()->getParam('id');
78
+
79
+ $setsModel->setData($data);
80
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
81
+ try {
82
+ if ($setId) {
83
+ $setsModel->setId($setId);
84
+ }
85
+ $setsModel->save();
86
+
87
+ if (!$setsModel->getId()) {
88
+ Mage::throwException(Mage::helper('groupedproduct')->__('Error saving set'));
89
+ }
90
+
91
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('groupedproduct')->__('Set was successfully saved.'));
92
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
93
+
94
+ // The following line decides if it is a "save" or "save and continue"
95
+ if ($this->getRequest()->getParam('back')) {
96
+ $this->_redirect('*/*/edit', array('id' => $setId));
97
+ } else {
98
+ $this->_redirect('*/*/');
99
+ }
100
+ } catch (Exception $e) {
101
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
102
+ if ($setsModel && $setsModel->getId()) {
103
+ $this->_redirect('*/*/edit', array('id' => $setId));
104
+ } else {
105
+ $this->_redirect('*/*/');
106
+ }
107
+ }
108
+
109
+ return;
110
+ }
111
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('awesome')->__('No data found to save'));
112
+ $this->_redirect('*/*/');
113
+ }
114
+
115
+ /**
116
+ * Update product(s) status action
117
+ *
118
+ */
119
+ public function massStatusAction()
120
+ {
121
+ $setIds = (array)$this->getRequest()->getParam('id');
122
+ $status = (int)$this->getRequest()->getParam('status'); //1 = enabled, 2 = disabled
123
+
124
+ if ($status == 0) {
125
+ $this->_getSession()->addError($this->__('Please select status.'));
126
+ } elseif (!is_array($setIds)) {
127
+ $this->_getSession()->addError($this->__('Please select attribute set(s).'));
128
+ } else {
129
+ if (!empty($setIds)) {
130
+ //convert from 1 to 2 to 1 and 0 respectively.
131
+ $status = $status % 2;
132
+ try {
133
+ foreach ($setIds as $setId) {
134
+ $set = Mage::getSingleton('groupedproduct/sets')
135
+ ->reset()
136
+ ->load($setId)
137
+ ->setIsActive($status)
138
+ ->save();
139
+ }
140
+ $this->_getSession()->addSuccess(
141
+ $this->__('Total of %d sets(s) have been updated.', count($setIds))
142
+ );
143
+ } catch (Exception $e) {
144
+ $this->_getSession()->addError($e->getMessage());
145
+ }
146
+ }
147
+ }
148
+
149
+ $this->_redirect('*/*/index');
150
+ }
151
+
152
+ /**
153
+ * Check the permission to run it
154
+ *
155
+ * @return boolean
156
+ */
157
+ protected function _isAllowed($action)
158
+ {
159
+ return Mage::getSingleton('admin/session')->isAllowed('levementum/levementum_grouped_sets');
160
+ }
161
+ }
app/code/community/Levementum/Groupedproduct/data/levementum_groupedproduct_setup/data-install-1.0.0.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 10/12/12 4:02 PM
5
+ */
6
+ /** @var $this Levementum_Groupedproduct_Model_Entity_Setup_Model_Entity_Setup */
7
+
8
+ //0. get entity type id
9
+ $entityTypeId = $this->getEntityTypeId('catalog_product');
10
+
11
+ //1. capture attribute sets
12
+ /** @var $attributeSets Mage_Eav_Model_Resource_Entity_Attribute_Set_Collection */
13
+ $attributeSets = Mage::getModel('eav/entity_attribute_set')->getCollection()->addFieldToFilter('entity_type_id',$entityTypeId);
14
+
15
+ foreach ($attributeSets as $attributeSet) {
16
+ $model = Mage::getModel('groupedproduct/sets');
17
+ $model->setSetId($attributeSet->getId())->save();
18
+ }
app/code/community/Levementum/Groupedproduct/etc/adminhtml.xml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <levementum translate="title">
5
+ <children>
6
+ <levementum_grouped_sets>
7
+ <title>GroupedProduct Set Management</title>
8
+ <sort_order>20</sort_order>
9
+ <action>adminhtml/sets</action>
10
+ </levementum_grouped_sets>
11
+ </children>
12
+ </levementum>
13
+ </menu>
14
+ <acl>
15
+ <resources>
16
+ <admin>
17
+ <children>
18
+ <levementum>
19
+ <children>
20
+ <levementum_grouped_sets translate="title">
21
+ <title>Grouped Product Set Management</title>
22
+ <children>
23
+ <save translate="title">
24
+ <title>Save Set Default Columns</title>
25
+ <sort_order>0</sort_order>
26
+ </save>
27
+ </children>
28
+ </levementum_grouped_sets>
29
+ </children>
30
+ </levementum>
31
+ <system>
32
+ <children>
33
+ <config>
34
+ <children>
35
+ <levementum_grouped>
36
+ <title>Levementum GroupedProducts</title>
37
+ <sort_order>1</sort_order>
38
+ </levementum_grouped>
39
+ </children>
40
+ </config>
41
+ </children>
42
+ </system>
43
+ </children>
44
+ </admin>
45
+ </resources>
46
+ </acl>
47
+ </config>
app/code/community/Levementum/Groupedproduct/etc/cache.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <placeholders>
4
+ <levementum_grouped>
5
+ <block>groupedproduct/product_view_type_grouped</block>
6
+ <placeholder>LEVEMENTUM_GROUPED_TABLE</placeholder>
7
+ <container>Levementum_Groupedproduct_Model_PageCache_Container_Groupedproduct</container>
8
+ <cache_lifetime>86400</cache_lifetime>
9
+ </levementum_grouped>
10
+ </placeholders>
11
+ </config>
app/code/community/Levementum/Groupedproduct/etc/config.xml ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Levementum_Groupedproduct>
5
+ <version>1.0.0</version>
6
+ </Levementum_Groupedproduct>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <groupedproduct>
11
+ <class>Levementum_Groupedproduct_Block</class>
12
+ </groupedproduct>
13
+ </blocks>
14
+ <helpers>
15
+ <groupedproduct>
16
+ <class>Levementum_Groupedproduct_Helper</class>
17
+ </groupedproduct>
18
+ </helpers>
19
+ <models>
20
+ <groupedproduct>
21
+ <class>Levementum_Groupedproduct_Model</class>
22
+ <resourceModel>groupedproduct_resource</resourceModel>
23
+ </groupedproduct>
24
+ <groupedproduct_resource>
25
+ <class>Levementum_Groupedproduct_Model_Resource</class>
26
+ <entities>
27
+ <sets>
28
+ <table>levementum_groupedproduct_sets</table>
29
+ </sets>
30
+ </entities>
31
+ </groupedproduct_resource>
32
+ <catalog>
33
+ <rewrite>
34
+ <product_type_grouped>Levementum_Groupedproduct_Model_Product_Type_Grouped</product_type_grouped>
35
+ </rewrite>
36
+ </catalog>
37
+ <importexport>
38
+ <rewrite>
39
+ <export_entity_product_type_grouped>Levementum_Groupedproduct_Model_ImportExport_Export_Entity_Product_Type_Grouped</export_entity_product_type_grouped>
40
+ </rewrite>
41
+ </importexport>
42
+ </models>
43
+ <resources>
44
+ <levementum_groupedproduct_setup>
45
+ <setup>
46
+ <module>Levementum_Groupedproduct</module>
47
+ <class>Levementum_Groupedproduct_Model_Entity_Setup</class>
48
+ </setup>
49
+ <connection>
50
+ <use>core_setup</use>
51
+ </connection>
52
+ </levementum_groupedproduct_setup>
53
+ <groupedproduct_write>
54
+ <connection>
55
+ <use>core_write</use>
56
+ </connection>
57
+ </groupedproduct_write>
58
+ <groupedproduct_read>
59
+ <connection>
60
+ <use>core_read</use>
61
+ </connection>
62
+ </groupedproduct_read>
63
+ </resources>
64
+ <events>
65
+ <controller_action_layout_load_before>
66
+ <observers>
67
+ <groupedproductAddHandle>
68
+ <type>singleton</type>
69
+ <class>groupedproduct/observer</class>
70
+ <method>addLevementumGroupedHandle</method>
71
+ </groupedproductAddHandle>
72
+ </observers>
73
+ </controller_action_layout_load_before>
74
+ </events>
75
+ </global>
76
+ <admin>
77
+ <routers>
78
+ <adminhtml>
79
+ <args>
80
+ <modules>
81
+ <groupedproduct before="Mage_Adminhtml">Levementum_Groupedproduct_Adminhtml</groupedproduct>
82
+ </modules>
83
+ </args>
84
+ </adminhtml>
85
+ </routers>
86
+ </admin>
87
+ <frontend>
88
+ <layout>
89
+ <updates>
90
+ <groupedproduct>
91
+ <file>levementum/groupedproduct.xml</file>
92
+ </groupedproduct>
93
+ </updates>
94
+ </layout>
95
+ </frontend>
96
+ <adminhtml>
97
+ <layout>
98
+ <updates>
99
+ <groupedproduct>
100
+ <file>levementum/groupedproduct.xml</file>
101
+ </groupedproduct>
102
+ </updates>
103
+ </layout>
104
+ </adminhtml>
105
+ <default>
106
+ <levementum_grouped>
107
+ <groupedproduct>
108
+ <enabled>1</enabled>
109
+ <allow_all_attributes>1</allow_all_attributes>
110
+ <allow_sort_all_attributes>1</allow_sort_all_attributes>
111
+ <default_view>1</default_view>
112
+ <default_page_length_all>all</default_page_length_all>
113
+ <default_display_page>list</default_display_page>
114
+ <displayed_attributes>sku,name</displayed_attributes>
115
+ <primary_attribute>name</primary_attribute>
116
+ </groupedproduct>
117
+ <display>
118
+ <display_individual_add>0</display_individual_add>
119
+ <enabled_grid_view>0</enabled_grid_view>
120
+ </display>
121
+ <display_list>
122
+ <pagination>none</pagination>
123
+ <limiter>none</limiter>
124
+ <information>both</information>
125
+ <pagination_prepend><![CDATA[<strong>Page: </strong>]]></pagination_prepend>
126
+ <display_first_last>0</display_first_last>
127
+ </display_list>
128
+ <!--<display_grid>-->
129
+ <!--<pagination></pagination>-->
130
+ <!--<limiter></limiter>-->
131
+ <!--<information></information>-->
132
+ <!--</display_grid>-->
133
+ <display_detail>
134
+ <pagination>both</pagination>
135
+ <limiter>both</limiter>
136
+ <information>both</information>
137
+ <pagination_prepend><![CDATA[<strong>Page: </strong>]]></pagination_prepend>
138
+ <display_first_last>0</display_first_last>
139
+ </display_detail>
140
+ </levementum_grouped>
141
+ </default>
142
+ </config>
app/code/community/Levementum/Groupedproduct/etc/system.xml ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <levementum_grouped translate="label" module="groupedproduct">
5
+ <class>separator-top</class>
6
+ <label>Grouped Products</label>
7
+ <tab>levementum</tab>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>45</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>0</show_in_store>
13
+ <groups>
14
+ <groupedproduct translate="label">
15
+ <label>Grouped Product Options</label>
16
+ <frontend_type>text</frontend_type>
17
+ <sort_order>100</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>0</show_in_store>
21
+ <fields>
22
+ <enabled translate="label comment">
23
+ <label>Enable GroupedProduct Module</label>
24
+ <comment>If disabled default grouped product behavior will be restored.</comment>
25
+ <frontend_type>select</frontend_type>
26
+ <source_model>adminhtml/system_config_source_yesno</source_model>
27
+ <sort_order>0</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>0</show_in_store>
31
+ </enabled>
32
+
33
+ <displayed_attributes translate="label">
34
+ <label>Default Displayed Attributes</label>
35
+ <comment><![CDATA[Specify which attributes and in which order these will appear on the grouped product page by default.<br/><br/>If specified on the product that will override this.]]></comment>
36
+ <frontend_type>multiselect</frontend_type>
37
+ <frontend_class>levementum-ordered-multiselect</frontend_class>
38
+ <sort_order>10</sort_order>
39
+ <source_model>groupedproduct/system_config_source_attributes</source_model>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ <can_be_empty>1</can_be_empty>
44
+ </displayed_attributes>
45
+ <primary_attribute translate="label">
46
+ <label>Default Primary Attribute</label>
47
+ <comment><![CDATA[The selected column will expand to fill the space, all others will be "minimized"]]></comment>
48
+ <frontend_type>select</frontend_type>
49
+ <sort_order>11</sort_order>
50
+ <source_model>groupedproduct/system_config_source_attributes</source_model>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ <can_be_empty>1</can_be_empty>
55
+ <frontend_model>groupedproduct/adminhtml_system_config_form_field_primary</frontend_model>
56
+ </primary_attribute>
57
+
58
+ <allow_all_attributes translate="label comment">
59
+ <label>Allow all attributes on table.</label>
60
+ <comment><![CDATA[Yes - Allows you to display any attribute of the product in the table.<br/>No - Only allow attributes marked as "Visible on Frontend" to be...visible.]]></comment>
61
+ <frontend_type>select</frontend_type>
62
+ <source_model>adminhtml/system_config_source_yesno</source_model>
63
+ <sort_order>20</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>0</show_in_store>
67
+ </allow_all_attributes>
68
+ <allow_sort_all_attributes translate="label comment">
69
+ <label>Allow sorting by all attributes on table.</label>
70
+ <comment>If yes, allows sorting on each attribute. If no, sorting is controlled by the attributes value of "Used for Sorting in Product Listing".</comment>
71
+ <frontend_type>select</frontend_type>
72
+ <source_model>adminhtml/system_config_source_yesno</source_model>
73
+ <sort_order>30</sort_order>
74
+ <show_in_default>1</show_in_default>
75
+ <show_in_website>1</show_in_website>
76
+ <show_in_store>0</show_in_store>
77
+ </allow_sort_all_attributes>
78
+ <default_display_page translate="label comment">
79
+ <label>Default Display Page</label>
80
+ <comment>Defaults to list if "Grid View" is disabled.</comment>
81
+ <frontend_type>select</frontend_type>
82
+ <source_model>groupedproduct/system_config_source_list</source_model>
83
+ <sort_order>50</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>0</show_in_store>
87
+ </default_display_page>
88
+ <default_page_length_all translate="label comment">
89
+ <label>Default Pagination Length</label>
90
+ <comment>Display all products on page?</comment>
91
+ <frontend_type>select</frontend_type>
92
+ <source_model>groupedproduct/system_config_source_allNumber</source_model>
93
+ <sort_order>60</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>0</show_in_store>
97
+ </default_page_length_all>
98
+ <default_page_length translate="label comment">
99
+ <label>Default Page Listing (Custom)</label>
100
+ <comment>Enter the number of items you'd like displayed on the page by default.</comment>
101
+ <frontend_type>text</frontend_type>
102
+ <sort_order>70</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>0</show_in_store>
106
+ <depends>
107
+ <default_page_length_all>other</default_page_length_all>
108
+ </depends>
109
+ <validate>validate-digits</validate>
110
+ </default_page_length>
111
+ </fields>
112
+ </groupedproduct>
113
+ <display translate="label">
114
+ <label>General Display Options</label>
115
+ <frontend_type>text</frontend_type>
116
+ <sort_order>200</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>0</show_in_store>
120
+ <fields>
121
+ <display_individual_add translate="label">
122
+ <label>Display individual product "Add to Cart button"</label>
123
+ <frontend_type>select</frontend_type>
124
+ <source_model>adminhtml/system_config_source_yesno</source_model>
125
+ <sort_order>1</sort_order>
126
+ <show_in_default>1</show_in_default>
127
+ <show_in_website>1</show_in_website>
128
+ <show_in_store>0</show_in_store>
129
+ </display_individual_add>
130
+ <enabled_grid_view translate="label comment">
131
+ <label>Enable Grid View</label>
132
+ <comment>Enables an alternate Grid View on the grouped product page. This does not have a client-side sort. Recommended setting is off.</comment>
133
+ <frontend_type>select</frontend_type>
134
+ <source_model>adminhtml/system_config_source_yesno</source_model>
135
+ <sort_order>1</sort_order>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>1</show_in_website>
138
+ <show_in_store>0</show_in_store>
139
+ </enabled_grid_view>
140
+ </fields>
141
+ </display>
142
+ <!--<display_grid translate="label">-->
143
+ <!--<label>Grid Display Options</label>-->
144
+ <!--<frontend_type>text</frontend_type>-->
145
+ <!--<sort_order>700</sort_order>-->
146
+ <!--<show_in_default>1</show_in_default>-->
147
+ <!--<show_in_website>1</show_in_website>-->
148
+ <!--<show_in_store>1</show_in_store>-->
149
+ <!--<fields>-->
150
+ <!--<information translate="label comment">-->
151
+ <!--<label>Information Display</label>-->
152
+ <!--<frontend_type>select</frontend_type>-->
153
+ <!--<source_model>groupedproduct/system_config_source_datatables</source_model>-->
154
+ <!--<sort_order>2</sort_order>-->
155
+ <!--<show_in_default>1</show_in_default>-->
156
+ <!--<show_in_website>1</show_in_website>-->
157
+ <!--<show_in_store>1</show_in_store>-->
158
+ <!--</information>-->
159
+ <!--<limiter translate="label comment">-->
160
+ <!--<label>Limiter Display</label>-->
161
+ <!--<frontend_type>select</frontend_type>-->
162
+ <!--<source_model>groupedproduct/system_config_source_datatables</source_model>-->
163
+ <!--<sort_order>3</sort_order>-->
164
+ <!--<show_in_default>1</show_in_default>-->
165
+ <!--<show_in_website>1</show_in_website>-->
166
+ <!--<show_in_store>1</show_in_store>-->
167
+ <!--</limiter>-->
168
+ <!--<pagination translate="label comment">-->
169
+ <!--<label>Pagination Display</label>-->
170
+ <!--<frontend_type>select</frontend_type>-->
171
+ <!--<source_model>groupedproduct/system_config_source_datatables</source_model>-->
172
+ <!--<sort_order>4</sort_order>-->
173
+ <!--<show_in_default>1</show_in_default>-->
174
+ <!--<show_in_website>1</show_in_website>-->
175
+ <!--<show_in_store>1</show_in_store>-->
176
+ <!--</pagination>-->
177
+ <!--</fields>-->
178
+ <!--</display_grid>-->
179
+ <display_list translate="label">
180
+ <label>List View Display Options</label>
181
+ <frontend_type>text</frontend_type>
182
+ <sort_order>300</sort_order>
183
+ <show_in_default>1</show_in_default>
184
+ <show_in_website>1</show_in_website>
185
+ <show_in_store>0</show_in_store>
186
+ <fields>
187
+ <information translate="label comment">
188
+ <label>Information Display</label>
189
+ <frontend_type>select</frontend_type>
190
+ <source_model>groupedproduct/system_config_source_datatables</source_model>
191
+ <sort_order>2</sort_order>
192
+ <show_in_default>1</show_in_default>
193
+ <show_in_website>1</show_in_website>
194
+ <show_in_store>0</show_in_store>
195
+ </information>
196
+ <limiter translate="label comment">
197
+ <label>Limiter Display</label>
198
+ <frontend_type>select</frontend_type>
199
+ <source_model>groupedproduct/system_config_source_datatables</source_model>
200
+ <sort_order>3</sort_order>
201
+ <show_in_default>1</show_in_default>
202
+ <show_in_website>1</show_in_website>
203
+ <show_in_store>0</show_in_store>
204
+ </limiter>
205
+ <pagination translate="label comment">
206
+ <label>Pagination Display</label>
207
+ <frontend_type>select</frontend_type>
208
+ <source_model>groupedproduct/system_config_source_paginationDisplay</source_model>
209
+ <sort_order>4</sort_order>
210
+ <show_in_default>1</show_in_default>
211
+ <show_in_website>1</show_in_website>
212
+ <show_in_store>0</show_in_store>
213
+ <depends>
214
+ <limiter separator=",">both,top,bottom</limiter>
215
+ </depends>
216
+ </pagination>
217
+ <pagination_prepend>
218
+ <label>Pagination List Prepend Value</label>
219
+ <comment><![CDATA[Prepend the pagination list with this contents. Accepts HTML, leave blank for empty. Default is <strong>Page: </strong>]]></comment>
220
+ <frontend_type>text</frontend_type>
221
+ <sort_order>5</sort_order>
222
+ <show_in_default>1</show_in_default>
223
+ <show_in_website>1</show_in_website>
224
+ <show_in_store>0</show_in_store>
225
+ </pagination_prepend>
226
+ <display_first_last translate="label comment">
227
+ <label>Display First/Last Pagination Links</label>
228
+ <frontend_type>select</frontend_type>
229
+ <source_model>adminhtml/system_config_source_yesno</source_model>
230
+ <sort_order>6</sort_order>
231
+ <show_in_default>1</show_in_default>
232
+ <show_in_website>1</show_in_website>
233
+ <show_in_store>0</show_in_store>
234
+ </display_first_last>
235
+ </fields>
236
+ </display_list>
237
+ <display_detail translate="label">
238
+ <label>Detail View Display Options</label>
239
+ <frontend_type>text</frontend_type>
240
+ <sort_order>400</sort_order>
241
+ <show_in_default>1</show_in_default>
242
+ <show_in_website>1</show_in_website>
243
+ <show_in_store>0</show_in_store>
244
+ <fields>
245
+ <information translate="label comment">
246
+ <label>Information Display</label>
247
+ <frontend_type>select</frontend_type>
248
+ <source_model>groupedproduct/system_config_source_datatables</source_model>
249
+ <sort_order>2</sort_order>
250
+ <show_in_default>1</show_in_default>
251
+ <show_in_website>1</show_in_website>
252
+ <show_in_store>0</show_in_store>
253
+ </information>
254
+ <limiter translate="label comment">
255
+ <label>Limiter Display</label>
256
+ <frontend_type>select</frontend_type>
257
+ <source_model>groupedproduct/system_config_source_datatables</source_model>
258
+ <sort_order>3</sort_order>
259
+ <show_in_default>1</show_in_default>
260
+ <show_in_website>1</show_in_website>
261
+ <show_in_store>0</show_in_store>
262
+ </limiter>
263
+ <pagination translate="label comment">
264
+ <label>Pagination Display</label>
265
+ <frontend_type>select</frontend_type>
266
+ <source_model>groupedproduct/system_config_source_paginationDisplay</source_model>
267
+ <sort_order>4</sort_order>
268
+ <show_in_default>1</show_in_default>
269
+ <show_in_website>1</show_in_website>
270
+ <show_in_store>0</show_in_store>
271
+ <depends>
272
+ <limiter separator=",">both,top,bottom</limiter>
273
+ </depends>
274
+ </pagination>
275
+ <pagination_prepend>
276
+ <label>Pagination List Prepend Value</label>
277
+ <comment><![CDATA[Prepend the pagination list with this contents. Accepts HTML, leave blank for empty. Default is <strong>Page: </strong>]]></comment>
278
+ <frontend_type>text</frontend_type>
279
+ <sort_order>5</sort_order>
280
+ <show_in_default>1</show_in_default>
281
+ <show_in_website>1</show_in_website>
282
+ <show_in_store>0</show_in_store>
283
+ </pagination_prepend>
284
+ <display_first_last translate="label comment">
285
+ <label>Display First/Last Pagination Links</label>
286
+ <frontend_type>select</frontend_type>
287
+ <source_model>adminhtml/system_config_source_yesno</source_model>
288
+ <sort_order>6</sort_order>
289
+ <show_in_default>1</show_in_default>
290
+ <show_in_website>1</show_in_website>
291
+ <show_in_store>0</show_in_store>
292
+ </display_first_last>
293
+ </fields>
294
+ </display_detail>
295
+ </groups>
296
+ </levementum_grouped>
297
+ </sections>
298
+ </config>
app/code/community/Levementum/Groupedproduct/sql/levementum_groupedproduct_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: ian.c
4
+ * Date: 4/24/12 11:27 AM
5
+ * File: mysql4-install-0.1.1.php
6
+ */
7
+
8
+ /** @var $installer Levementum_Groupedproduct_Model_Entity_Setup_Model_Entity_Setup */
9
+ $installer = $this;
10
+ $installer->startSetup();
11
+
12
+
13
+ $installer->addAttribute(
14
+ Mage_Catalog_Model_Product::ENTITY,
15
+ 'lev_displayed_attributes',
16
+ array(
17
+ 'group' => 'Grouped Product Display',
18
+ 'backend' => 'groupedproduct/backend_option',
19
+ 'type' => 'varchar',
20
+ 'input' => 'multiselect',
21
+ 'label' => 'Displayed Attributes on Grouped Product Table',
22
+ 'source' => 'groupedproduct/source_option',
23
+ 'required' => false,
24
+ 'default' => null,
25
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
26
+ 'visible' => true,
27
+ 'apply_to' => 'grouped',
28
+ 'frontend_input_renderer' => 'groupedproduct/catalog_form_renderer_fieldset_element',
29
+ )
30
+ );
31
+
32
+ $installer->addAttribute(
33
+ Mage_Catalog_Model_Product::ENTITY,
34
+ 'lev_primary_attribute',
35
+ array(
36
+ 'group' => 'Grouped Product Display',
37
+ 'label' => 'Primary Attribute',
38
+ 'type' => 'varchar',
39
+ 'note' => 'The selected column will expand to fill the space, all others will be "minimized"',
40
+ 'input' => 'text',
41
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
42
+ 'required' => false,
43
+ 'user_defined' => false,
44
+ 'default' => null,
45
+ 'comparable' => false,
46
+ 'used_in_product_listing' => true,
47
+ 'apply_to' => 'grouped',
48
+ 'frontend_input_renderer' => 'groupedproduct/catalog_form_renderer_fieldset_primary',
49
+ )
50
+ );
51
+
52
+ $installer->addAttribute(
53
+ Mage_Catalog_Model_Product::ENTITY,
54
+ 'lev_display_availability',
55
+ array(
56
+ 'group' => 'Grouped Product Display',
57
+ 'label' => 'Display Availability',
58
+ 'type' => 'int',
59
+ 'input' => 'select',
60
+ 'source' => 'eav/entity_attribute_source_boolean',
61
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
62
+ 'required' => false,
63
+ 'user_defined' => false,
64
+ 'default' => 0,
65
+ 'comparable' => false,
66
+ 'used_in_product_listing' => true,
67
+ 'apply_to' => 'grouped',
68
+ )
69
+ );
70
+
71
+ $installer->addAttribute(
72
+ Mage_Catalog_Model_Product::ENTITY,
73
+ 'lev_display_qty',
74
+ array(
75
+ 'group' => 'Grouped Product Display',
76
+ 'label' => 'Display Quantity',
77
+ 'type' => 'int',
78
+ 'input' => 'select',
79
+ 'source' => 'eav/entity_attribute_source_boolean',
80
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
81
+ 'required' => false,
82
+ 'user_defined' => false,
83
+ 'default' => 0,
84
+ 'used_in_product_listing' => true,
85
+ 'unique' => false,
86
+ 'apply_to' => 'grouped',
87
+ )
88
+ );
89
+
90
+ $table = $installer->getConnection()
91
+ ->newTable($installer->getTable('groupedproduct/sets'))
92
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
93
+ 'identity' => true,
94
+ 'unsigned' => true,
95
+ 'nullable' => false,
96
+ 'primary' => true,
97
+ ), 'Id')
98
+ ->addColumn('set_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
99
+ 'unsigned' => true,
100
+ 'nullable' => false,
101
+ ), 'Set Id')
102
+ ->addColumn('attribute_codes', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
103
+ 'nullable' => true
104
+ ), 'Attribute Codes')
105
+ ->addColumn('primary_attribute', Varien_Db_Ddl_Table::TYPE_TEXT, 200, array(
106
+ 'nullable' => true
107
+ ), 'Primary Attribute')
108
+ ->addColumn('is_active', Varien_Db_Ddl_Table::TYPE_INTEGER, 1, array(
109
+ 'nullable' => false,
110
+ 'default' => 0,
111
+ 'comment' => 'Is Active'
112
+ ))
113
+ ->addIndex($installer->getIdxName('groupedproduct/sets', array('set_id')), array('set_id'))
114
+ ->addForeignKey($installer->getFkName('groupedproduct/sets', 'set_id', 'eav/attribute_set', 'attribute_set_id'),
115
+ 'set_id',
116
+ $installer->getTable('eav/attribute_set'),
117
+ 'attribute_set_id',
118
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
119
+ Varien_Db_Ddl_Table::ACTION_CASCADE)
120
+ ->setComment('Levementum Groupedproduct Sets');
121
+
122
+ $installer->getConnection()->createTable($table);
123
+
124
+ $installer->endSetup();
125
+
app/code/community/Levementum/LevCore/Block/Adminhtml/Widget/Grid/Column/Renderer/Nowrap.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: icoast@levementum.com
4
+ * Date: 11/12/12 3:19 PM
5
+ */
6
+
7
+ class Levementum_LevCore_Block_Adminhtml_Widget_Grid_Column_Renderer_Nowrap extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
8
+ {
9
+
10
+
11
+ /**
12
+ * Renders grid column
13
+ *
14
+ * @param Varien_Object $row
15
+ * @return string
16
+ */
17
+ public function render(Varien_Object $row)
18
+ {
19
+ $line = parent::_getValue($row);
20
+ return '<span class="nobr">'.$line.'</span>'.print_r($row->getData(),true);
21
+ }
22
+ }
app/code/community/Levementum/LevCore/Block/Customer/Account/Navigation.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: icoast@levementum.com
4
+ * Date: 1/31/13 1:48 PM
5
+ * File: ${FILE_NAME}
6
+ */
7
+ class Levementum_LevCore_Block_Customer_Account_Navigation extends Mage_Customer_Block_Account_Navigation {
8
+
9
+ public function removeLink($name, $path)
10
+ {
11
+ if (isset($this->_links[$name])) {
12
+ unset($this->_links[$name]);
13
+ }
14
+
15
+ return $this;
16
+ }
17
+ }
app/code/community/Levementum/LevCore/Block/LevCore.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** Levementum, LLC
3
+ *
4
+ */
5
+ class Levementum_LevCore_Block_LevCore extends Mage_Core_Block_Template
6
+ {
7
+
8
+ }
app/code/community/Levementum/LevCore/Block/System/Html.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WDCA
4
+ * NOTICE OF LICENSE
5
+ * This source file is subject to the Open Software License (OSL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://opensource.org/licenses/osl-3.0.php
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@magentocommerce.com so we can send you a copy immediately.
12
+ * DISCLAIMER
13
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
14
+ * versions in the future. If you wish to customize Magento for your
15
+ * needs please refer to http://www.magentocommerce.com for more information.
16
+ * @category WDCA
17
+ * @package TBT_Enhancedgrid
18
+ * @copyright Copyright (c) 2008-2010 WDCA (http://www.wdca.ca)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Levementum_LevCore_Block_System_Html extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
23
+ {
24
+ public function render(Varien_Data_Form_Element_Abstract $element)
25
+ {
26
+ $html = '';
27
+ $levCoreVersion = Mage::getConfig()->getNode('modules/Levementum_LevCore/version');
28
+
29
+ $modules = Mage::getConfig()->getNode('modules');
30
+
31
+ $levModules = array();
32
+ foreach ($modules->asArray() as $key => $valueArray) {
33
+ if (strpos($key, 'Levementum') !== false && $key != 'Levementum_LevCore') {
34
+ if (isset($valueArray['version'])) {
35
+ $levModules[] = array(
36
+ 'name' => $key,
37
+ 'version'=> $valueArray['version']
38
+ );
39
+ }
40
+ }
41
+ }
42
+
43
+ $html .= "
44
+ <div style=\" margin-bottom: 12px; width: 100%;\">
45
+ <p>You are currently using the following Levementum Modules:</p>
46
+ <ul>
47
+ <li>Core - v{$levCoreVersion}</li>";
48
+ foreach ($levModules as $module) {
49
+ $html .= "<li>{$module['name']} - v{$module['version']}</li>";
50
+ }
51
+
52
+ $html .= "
53
+ </ul>
54
+ <br/>
55
+ <p>Check out <a href='http://www.levementum.com/' target='_blank'>Levementum, LLC</a>
56
+
57
+ <p>Also take a look at <a href='http://blog.levementum.com/' target='_blank'>Levementum Blog</a>.</p>";
58
+
59
+ $html .= "
60
+ </div>
61
+ ";
62
+
63
+ return $html;
64
+ }
65
+ }
app/code/community/Levementum/LevCore/Helper/Core/Data.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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_Core
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+
27
+ /**
28
+ * Core data helper
29
+ *
30
+ * @author Magento Core Team <core@magentocommerce.com>
31
+ */
32
+ class Levementum_LevCore_Helper_Core_Data extends Mage_Core_Helper_Data
33
+ {
34
+ /**
35
+ * Format date using current locale options and time zone.
36
+ *
37
+ * @param date|Zend_Date|null $date
38
+ * @param string $format See Mage_Core_Model_Locale::FORMAT_TYPE_* constants
39
+ * @param bool $showTime Whether to include time
40
+ * @return string
41
+ */
42
+ public function formatDate($date = null, $format = Mage_Core_Model_Locale::FORMAT_TYPE_SHORT, $showTime = false)
43
+ {
44
+ if (!in_array($format, $this->_allowedFormats, true)) {
45
+ return $date;
46
+ }
47
+ if (!($date instanceof Zend_Date) && $date && !strtotime($date)) {
48
+ return '';
49
+ }
50
+ if (is_null($date)) {
51
+ $date = Mage::app()->getLocale()->date(Mage::getSingleton('core/date')->gmtTimestamp(), null, null);
52
+ } else if (!$date instanceof Zend_Date) {
53
+ if (is_numeric($date)) {
54
+ /* Change icoast@levementum.com on 10/26/12 at 1:56 PM - Description: If it is already a timestamp don't do it. */
55
+ $date = Mage::app()->getLocale()->date($date, null, null);
56
+ } else {
57
+ $date = Mage::app()->getLocale()->date(strtotime($date), null, null);
58
+ }
59
+ }
60
+
61
+ if ($showTime) {
62
+ $format = Mage::app()->getLocale()->getDateTimeFormat($format);
63
+ } else {
64
+ $format = Mage::app()->getLocale()->getDateFormat($format);
65
+ }
66
+
67
+ return $date->toString($format);
68
+ }
69
+ }
app/code/community/Levementum/LevCore/Helper/Data.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Levementum, LLC
5
+
6
+ */
7
+
8
+ class Levementum_LevCore_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+ protected $_tables = array();
11
+
12
+ public function getAttributeOptions($code, $asDropdown = true)
13
+ {
14
+ $_options = array();
15
+
16
+ /** @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
17
+ $attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_product', $code);
18
+
19
+ if ($attribute->usesSource()) {
20
+ if ($asDropdown) {
21
+ foreach ($attribute->getSource()->getAllOptions(false) as $option) {
22
+ $_options[$option['value']] = $option['label'];
23
+ }
24
+ } else {
25
+ $_options = $attribute->getSource()->getAllOptions(false);
26
+ }
27
+ }
28
+
29
+ return $_options;
30
+ }
31
+
32
+ public function inCurrentHandles($needle)
33
+ {
34
+ $currentHandles = Mage::app()->getLayout()->getUpdate()->getHandles();
35
+
36
+ return in_array($needle, $currentHandles);
37
+ }
38
+
39
+ public function getTable($tableName)
40
+ {
41
+ if (!isset($this->_tables[$tableName])) {
42
+ $this->_tables[$tableName] = Mage::getSingleton('core/resource')->getTableName($tableName);
43
+ }
44
+
45
+ return $this->_tables[$tableName];
46
+ }
47
+
48
+ /**
49
+ * Checks to see if the current user is a developer.
50
+ * Developer is assigned by IP listed in dev/restrict/allow_ips
51
+ * @return bool
52
+ */
53
+ public function isDeveloper()
54
+ {
55
+ return (strstr(Mage::getStoreConfig('dev/restrict/allow_ips'), Mage::helper('core/http')->getRemoteAddr())) ? true : false;
56
+ }
57
+
58
+ public function isCategoryPage()
59
+ {
60
+ return (bool) Mage::registry('current_category');
61
+ }
62
+
63
+ public function isProductPage()
64
+ {
65
+ return (Mage::registry('current_product') || Mage::registry('product'));
66
+ }
67
+
68
+ public function isAdmin()
69
+ {
70
+ if (Mage::app()->getStore()->isAdmin()) {
71
+ return true;
72
+ }
73
+
74
+ if (Mage::getDesign()->getArea() == 'adminhtml') {
75
+ return true;
76
+ }
77
+
78
+ return false;
79
+ }
80
+
81
+ /**
82
+ * @param $collection Mage_Core_Model_Resource_Db_Collection_Abstract
83
+ *
84
+ * @return array
85
+ */
86
+ public function outputCsvFromCollection($collection)
87
+ {
88
+
89
+ $io = new Varien_Io_File();
90
+
91
+ $path = Mage::getBaseDir('var') . DS . 'export' . DS;
92
+ $name = md5(microtime());
93
+ $file = $path . DS . $name . '.csv';
94
+
95
+ $io->setAllowCreateFolders(true);
96
+ $io->open(array('path' => $path));
97
+ $io->streamOpen($file, 'w+');
98
+ $io->streamLock(true);
99
+
100
+ //Capture headers
101
+ $_headers = array_keys($collection->getFirstItem()->getData());
102
+ $io->streamWriteCsv($_headers);
103
+
104
+ //write all items
105
+ foreach ($collection->getItems() as $item) {
106
+ $io->streamWriteCsv($item->getData());
107
+ }
108
+
109
+ $io->streamUnlock();
110
+ $io->streamClose();
111
+
112
+ return array(
113
+ 'type' => 'filename',
114
+ 'value' => $file,
115
+ 'rm' => true // can delete file after use
116
+ );
117
+ }
118
+ }
app/code/community/Levementum/LevCore/Model/PageCache/Container/Tabs.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: icoast@levementum.com
4
+ * Date: 11/14/12 1:54 PM
5
+ */
6
+
7
+ class Levementum_Levementum_Model_PageCache_Container_Tabs extends Enterprise_PageCache_Model_Container_Abstract
8
+ {
9
+ /**
10
+ * Get customer identifier from cookies
11
+ *
12
+ * @return string
13
+ */
14
+ protected function _getIdentifier()
15
+ {
16
+ return $this->_getCookieValue(Enterprise_PageCache_Model_Cookie::COOKIE_CART, '');
17
+ }
18
+
19
+ /**
20
+ * Get cache identifier
21
+ *
22
+ * @return string
23
+ */
24
+ protected function _getCacheId()
25
+ {
26
+ return 'LEVEMENTUM_TABS_' . md5($this->_placeholder->getAttribute('cache_id') . $this->_getIdentifier());
27
+ }
28
+
29
+ /**
30
+ * Render block content
31
+ *
32
+ * @return string
33
+ */
34
+ protected function _renderBlock()
35
+ {
36
+ $blockClass = $this->_placeholder->getAttribute('block');
37
+ $template = $this->_placeholder->getAttribute('template');
38
+
39
+ $block = new $blockClass;
40
+ $block->setTemplate($template);
41
+ return $block->toHtml();
42
+ }
43
+ }
app/code/community/Levementum/LevCore/Model/System/Config/Source/Attributes.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+
27
+
28
+ class Levementum_LevCore_Model_System_Config_Source_Attributes
29
+ {
30
+ protected $_options;
31
+
32
+ public function toOptionArray()
33
+ {
34
+ if (!$this->_options) {
35
+ $sortedArray = array();
36
+
37
+ /** @var $_attributes Mage_Eav_Model_Resource_Entity_Attribute_Collection */
38
+ $_attributes = Mage::getSingleton('eav/config')
39
+ ->getEntityType(Mage_Catalog_Model_Product::ENTITY)
40
+ ->getAttributeCollection();
41
+
42
+ /** @var $attribute Mage_Eav_Model_Entity_Attribute */
43
+ $this->_options = array();
44
+ foreach ($_attributes as $attribute) {
45
+ $tmpArray = array(
46
+ 'value' => $attribute->getAttributeCode(),
47
+ 'label' => $attribute->getFrontend()->getLabel(),
48
+ );
49
+
50
+ $this->_options[] = $tmpArray;
51
+ }
52
+
53
+ ksort($sortedArray);
54
+
55
+ foreach ($sortedArray as $tmpArray) {
56
+ $this->_options[] = $tmpArray;
57
+ }
58
+ }
59
+
60
+ return $this->_options;
61
+ }
62
+ }
app/code/community/Levementum/LevCore/etc/adminhtml.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <levementum translate="title" module="levcore">
5
+ <title>Levementum</title>
6
+ <sort_order>80</sort_order>
7
+ </levementum>
8
+ </menu>
9
+ <acl>
10
+ <resources>
11
+ <admin>
12
+ <children>
13
+ <levementum translate="title" module="levcore">
14
+ <title>Levementum Management</title>
15
+ <sort_order>80</sort_order>
16
+ </levementum>
17
+ <system>
18
+ <children>
19
+ <config>
20
+ <children>
21
+ <levementum>
22
+ <title>Levementum Core</title>
23
+ <sort_order>300</sort_order>
24
+ </levementum>
25
+ </children>
26
+ </config>
27
+ </children>
28
+ </system>
29
+ </children>
30
+ </admin>
31
+ </resources>
32
+ </acl>
33
+ </config>
app/code/community/Levementum/LevCore/etc/config.xml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Levementum_LevCore>
5
+ <version>1.0.0</version>
6
+ </Levementum_LevCore>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <levcore>
11
+ <class>Levementum_LevCore_Block</class>
12
+ </levcore>
13
+ <customer>
14
+ <rewrite>
15
+ <account_navigation>Levementum_LevCore_Block_Customer_Account_Navigation</account_navigation>
16
+ </rewrite>
17
+ </customer>
18
+ </blocks>
19
+ <helpers>
20
+ <levcore>
21
+ <class>Levementum_LevCore_Helper</class>
22
+ </levcore>
23
+ <core>
24
+ <rewrite>
25
+ <data>Levementum_LevCore_Helper_Core_Data</data>
26
+ </rewrite>
27
+ </core>
28
+ </helpers>
29
+ <models>
30
+ <levcore>
31
+ <class>Levementum_LevCore_Model</class>
32
+ </levcore>
33
+ </models>
34
+ </global>
35
+ <frontend>
36
+ <layout>
37
+ <updates>
38
+ <levcore>
39
+ <file>levementum/levcore.xml</file>
40
+ </levcore>
41
+ </updates>
42
+ </layout>
43
+ </frontend>
44
+ <adminhtml>
45
+ <layout>
46
+ <updates>
47
+ <levcore>
48
+ <file>levementum/levcore.xml</file>
49
+ </levcore>
50
+ </updates>
51
+ </layout>
52
+ <acl>
53
+ <resources>
54
+ <admin>
55
+ <children>
56
+ <system>
57
+ <children>
58
+ <config>
59
+ <children>
60
+ <levementum>
61
+ <title>Levementum Core</title>
62
+ <sort_order>300</sort_order>
63
+ </levementum>
64
+ </children>
65
+ </config>
66
+ </children>
67
+ </system>
68
+ </children>
69
+ </admin>
70
+ </resources>
71
+ </acl>
72
+ </adminhtml>
73
+ <default>
74
+ <levementum>
75
+ <includes>
76
+ <include_jquery_frontend>1</include_jquery_frontend>
77
+ <include_jquery_admin>1</include_jquery_admin>
78
+ </includes>
79
+ </levementum>
80
+ </default>
81
+ </config>
app/code/community/Levementum/LevCore/etc/system.xml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <levementum translate="label" module="levcore">
5
+ <label>Levementum</label>
6
+ <sort_order>0</sort_order>
7
+ </levementum>
8
+ </tabs>
9
+ <sections>
10
+ <levementum translate="label" module="levcore">
11
+ <class>separator-top</class>
12
+ <label>Core</label>
13
+ <tab>levementum</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>0</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <about translate="label">
21
+ <expanded>1</expanded>
22
+ <label>About Levementum</label>
23
+ <sort_order>10</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <fields>
27
+ <notice translate="label">
28
+ <label>Module by Levementum, LLC</label>
29
+ <frontend_type>text</frontend_type>
30
+ <frontend_model>levcore/system_html</frontend_model>
31
+ <sort_order>10</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </notice>
36
+ </fields>
37
+ </about>
38
+ <includes translate="label">
39
+ <expanded>1</expanded>
40
+ <label>Include Configurations</label>
41
+ <sort_order>20</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <fields>
45
+ <include_jquery_frontend translate="label comment">
46
+ <label>Include jQuery (Frontend)</label>
47
+ <comment>This will add an include file to the grouped page for jQuery. Select 'yes' if you do not have jQuery already on your system.</comment>
48
+ <frontend_type>select</frontend_type>
49
+ <source_model>adminhtml/system_config_source_yesno</source_model>
50
+ <sort_order>1</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ </include_jquery_frontend>
55
+ <include_jquery_admin translate="label comment">
56
+ <label>Include jQuery (Admin)</label>
57
+ <comment>This will add an include file to the edit product page in admin for jQuery. Select 'yes' if you do not have jQuery already on your system.</comment>
58
+ <frontend_type>select</frontend_type>
59
+ <source_model>adminhtml/system_config_source_yesno</source_model>
60
+ <sort_order>2</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ </include_jquery_admin>
65
+ </fields>
66
+ </includes>
67
+ </groups>
68
+ </levementum>
69
+ </sections>
70
+ </config>
app/design/adminhtml/default/default/layout/levementum/groupedproduct.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <adminhtml_sets_index>
4
+ <reference name="content">
5
+ <block type="groupedproduct/adminhtml_sets" name="groupedproduct.sets.index"/>
6
+ </reference>
7
+ </adminhtml_sets_index>
8
+ </layout>
app/design/adminhtml/default/default/layout/levementum/levcore.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addJs" ifconfig="levementum/includes/include_jquery_admin"><script>levementum/levcore/jquery-1.8.3.min.js</script></action>
6
+ <action method="addJs"><script>levementum/levcore/jquery-ui-1.10.0.custom.min.js</script></action>
7
+ <action method="addJs"><script>levementum/levcore/ui.multiselect.min.js</script></action>
8
+ <action method="addJs"><script>levementum/levcore/levcore.js</script></action>
9
+ <action method="addCss"><name>levementum/css/levcore.css</name></action>
10
+ <action method="addCss"><name>levementum/css/jqueryui-custom.css</name></action>
11
+ </reference>
12
+ </default>
13
+ </layout>
app/design/frontend/enterprise/default/layout/levementum/groupedproduct.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss"><stylesheet>levementum/css/groupedproduct.css</stylesheet></action>
6
+ <action method="addCss"><stylesheet>levementum/datatables/css/jquery.dataTables.css</stylesheet></action>
7
+ <action method="addItem"><type>skin_js</type><script>levementum/datatables/js/jquery.dataTables.js</script></action>
8
+ <action method="addItem"><type>skin_js</type><script>levementum/datatables/js/jquery.dataTables.plugins.js</script></action>
9
+ </reference>
10
+ </default>
11
+ <LEVEMENTUM_PRODUCT_TYPE_grouped translate="label" module="catalog">
12
+ <remove name="product.info.grouped" />
13
+ <remove name="product.info.addtocart" />
14
+
15
+ <reference name="product.info.additional">
16
+ <block type="groupedproduct/product_view_type_grouped" name="product.info.levementum.grouped" template="levementum/groupedproduct/product/view/type/grouped.phtml">
17
+ <block type="core/text_list" name="product.info.grouped.extra" as="product_type_data_extra" translate="label">
18
+ <label>Product Extra Info</label>
19
+ </block>
20
+
21
+ <block type="catalog/product_view" name="product.info.levementum.addtocart" as="addtocart" template="levementum/groupedproduct/product/view/addtocart.phtml">
22
+ <block type="page/html_wrapper" name="product.info.addtocart.paypal.wrapper" translate="label">
23
+ <label>PayPal Express Checkout Shortcut Wrapper</label>
24
+ <block type="paypal/express_shortcut" name="product.info.addtocart.paypal" template="paypal/express/shortcut.phtml">
25
+ <action method="setIsInCatalogProduct"><value>1</value></action>
26
+ </block>
27
+ </block>
28
+ </block>
29
+ <block type="catalog/product_view" name="product.info.addto" as="addto" template="levementum/groupedproduct/product/view/addto.phtml"/>
30
+ </block>
31
+ </reference>
32
+ </LEVEMENTUM_PRODUCT_TYPE_grouped>
33
+ </layout>
app/design/frontend/enterprise/default/layout/levementum/levcore.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addJs" ifconfig="levementum/includes/include_jquery_frontend"><script>levementum/levcore/jquery-1.8.3.min.js</script></action>
6
+ </reference>
7
+ </default>
8
+
9
+ <catalog_product_view>
10
+ <reference name="head">
11
+ <action method="removeItem" ifconfig="levementum/includes/include_jquery_frontend"><type>skin_js</type><name>js/jqzoom/jquery-1.3.1.min.js</name></action>
12
+ </reference>
13
+ </catalog_product_view>
14
+
15
+ <review_product_list translate="label">
16
+ <reference name="head">
17
+ <action method="removeItem" ifconfig="levementum/includes/include_jquery_frontend"><type>skin_js</type><name>js/jqzoom/jquery-1.3.1.min.js</name></action>
18
+ </reference>
19
+ </review_product_list>
20
+ </layout>
app/design/frontend/enterprise/default/template/levementum/groupedproduct/product/list/toolbar.phtml ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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 enterprise_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Product list toolbar
30
+ *
31
+ * @see Mage_Catalog_Block_Product_List_Toolbar
32
+ * @var $this Levementum_Groupedproduct_Block_Toolbar
33
+ */
34
+ $groupedTable = false;
35
+ if (Mage::registry('grouped-table') && is_numeric(Mage::registry('grouped-product-id'))) {
36
+ $groupedTable = true;
37
+ $_product = Mage::getModel('catalog/product')->load(Mage::registry('grouped-product-id'));
38
+ $attributes = Mage::helper('groupedproduct/data')->getDisplayedAttributeList($_product->getData('lev_displayed_attributes'),null,true);
39
+ }
40
+ $_modes = $this->getModes();
41
+ $_noGridClass = '';
42
+ if (!$this->helper('groupedproduct/config')->isGridViewEnabled() || !isset($_modes['grid'])) {
43
+ $_noGridClass = ' no-grid';
44
+ if (isset($_modes['grid'])) {
45
+ unset($_modes['grid']);
46
+ }
47
+ }
48
+ ?>
49
+ <?php if(is_object($this->getCollection()) && $this->getCollection()->getSize()): ?>
50
+ <div class="toolbar">
51
+ <?php if( $this->isExpanded() ): ?>
52
+ <div class="sorter">
53
+ <?php if( $this->isEnabledViewSwitcher() ): ?>
54
+ <p class="view-mode">
55
+ <?php if($_modes && count($_modes)>1): ?>
56
+ <label><?php echo $this->__('View as') ?>:</label>
57
+ <?php $_i=1; $_fix=''; foreach ($_modes as $_code=>$_label): ?>
58
+ <?php if($this->isModeActive($_code)): ?>
59
+ <strong class="<?php echo strtolower($_code); echo $_noGridClass; ?>" title="<?php echo $_label ?>"><?php echo $_label ?></strong>
60
+ <?php else: ?>
61
+ <a class="<?php echo strtolower($_code); echo $_noGridClass; ?>" title="<?php echo $_label ?>" href="<?php echo $this->getModeUrl($_code) ?>"><?php echo $_label ?></a>
62
+ <?php endif; ?>
63
+ <?php $_i++; endforeach; ?>
64
+ <?php endif; ?>
65
+ </p>
66
+ <?php endif; ?>
67
+
68
+ <?php if ($groupedTable && $this->getCurrentMode() != 'grid'): ?>
69
+ <div class="sort-by">
70
+ <label><?php echo $this->__('Sort By') ?></label>
71
+ <select class="grouped-select" onchange="groupedTableSort(jQuery('#grouped-sort-by-'+this.value).index(),this);">
72
+ <?php foreach($attributes as $attribute): ?>
73
+ <option value="<?php echo $attribute['code'] ?>">
74
+ <?php echo $this->__($attribute['label'])?>
75
+ </option>
76
+ <?php endforeach; ?>
77
+ <option value="price">Price</option>
78
+ <option value="availability">Availability</option>
79
+ </select>
80
+ </div>
81
+ <?php else: ?>
82
+ <div class="sort-by">
83
+ <label><?php echo $this->__('Sort By') ?></label>
84
+ <select onchange="setLocation(this.value)">
85
+ <?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
86
+ <option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
87
+ <?php echo $this->__($_order) ?>
88
+ </option>
89
+ <?php endforeach; ?>
90
+ </select>
91
+ <?php if($this->getCurrentDirection() == 'desc'): ?>
92
+ <a href="<?php echo $this->getOrderUrl(null, 'asc') ?>"><img src="<?php echo $this->getSkinUrl('images/sort_desc_arrow.gif') ?>" alt="<?php echo $this->__('Set Ascending Direction') ?>" class="v-middle" /></a>
93
+ <?php else: ?>
94
+ <a href="<?php echo $this->getOrderUrl(null, 'desc') ?>"><img src="<?php echo $this->getSkinUrl('images/sort_asc_arrow.gif') ?>" alt="<?php echo $this->__('Set Descending Direction') ?>" class="v-middle" /></a>
95
+ <?php endif; ?>
96
+ </div>
97
+ <?php endif; ?>
98
+ </div>
99
+ <?php endif; ?>
100
+ <?php if (!$groupedTable || $this->getCurrentMode() == 'grid'): ?>
101
+ <div class="pager">
102
+ <p class="amount">
103
+ <?php if($this->getLastPageNum()>1): ?>
104
+ <?php echo $this->__('Items %s-%s of %s', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
105
+ <?php else: ?>
106
+ <?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?>
107
+ <?php endif; ?>
108
+ </p>
109
+
110
+ <div class="limiter">
111
+ <label><?php echo $this->__('Show') ?></label>
112
+ <select onchange="setLocation(this.value)">
113
+ <?php foreach ($this->getAvailableLimit() as $_key=>$_limit): ?>
114
+ <option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
115
+ <?php echo $_limit ?>
116
+ </option>
117
+ <?php endforeach; ?>
118
+ </select> <?php echo $this->__('per page') ?>
119
+ </div>
120
+ <?php echo $this->getPagerHtml() ?>
121
+ </div>
122
+ <?php endif; ?>
123
+ </div>
124
+ <?php endif ?>
app/design/frontend/enterprise/default/template/levementum/groupedproduct/product/view/addto.phtml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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 base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+ ?>
27
+
28
+ <?php $_product = $this->getProduct(); ?>
29
+ <?php $_wishlistSubmitUrl = $this->helper('wishlist')->getAddUrl($_product); ?>
30
+
31
+ <ul class="add-to-links">
32
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
33
+ <li><a href="<?php echo $_wishlistSubmitUrl ?>" onclick="productAddToCartForm.submitLight(this, this.href); return false;" class="btn btn-small link-wishlist"><i class="icon-check"></i> <?php echo $this->__('Add to Wishlist') ?></a></li>
34
+ <?php endif; ?>
35
+ <?php
36
+ $_compareUrl = $this->helper('catalog/product_compare')->getAddUrl($_product);
37
+ ?>
38
+ <?php if($_compareUrl) : ?>
39
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="btn btn-small link-compare"><i class="icon-refresh"></i> <?php echo $this->__('Add to Compare') ?></a></li>
40
+ <?php endif; ?>
41
+ </ul>
app/design/frontend/enterprise/default/template/levementum/groupedproduct/product/view/addtocart.phtml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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 base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+ ?>
27
+ <?php $_product = $this->getProduct(); ?>
28
+ <?php $buttonTitle = $this->__('Add to Cart'); ?>
29
+ <?php if($_product->isSaleable()): ?>
30
+ <div class="add-to-cart">
31
+ <?php if(!$_product->isGrouped()): ?>
32
+ <label for="qty"><?php echo $this->__('Qty:') ?></label>
33
+ <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
34
+ <?php endif; ?>
35
+ <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="groupedProductAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
36
+ <?php echo $this->getChildHtml('', true, true) ?>
37
+ </div>
38
+ <?php endif; ?>
app/design/frontend/enterprise/default/template/levementum/groupedproduct/product/view/tierprices-basic.phtml ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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 base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+ ?>
27
+
28
+ <?php
29
+ /**
30
+ * @see Mage_Catalog_Block_Product_View
31
+ */
32
+ $_product = $this->getProduct();
33
+ $_tierPrices = $this->getTierPrices();
34
+ $_finalPriceInclTax = $this->helper('tax')->getPrice($_product, $_product->getFinalPrice(), true);
35
+ //echo $_product->getTierQty();
36
+ /** @var $_catalogHelper Mage_Catalog_Helper_Data */
37
+ $_catalogHelper = Mage::helper('catalog');
38
+
39
+ $_weeeTaxAmount = Mage::helper('weee')->getAmountForDisplay($_product);
40
+ if (Mage::helper('weee')->typeOfDisplay($_product, array(1,2,4))) {
41
+ $_weeeTaxAttributes = Mage::helper('weee')->getProductWeeeAttributesForDisplay($_product);
42
+ }
43
+
44
+ ?>
45
+ <?php if (count($_tierPrices) > 0): ?>
46
+ <ul class="<?php echo ($this->getInGrouped() ? 'tier-prices-grouped product-pricing-grouped' : 'tier-prices product-pricing'); ?>">
47
+ <?php if ($this->getInGrouped()): ?>
48
+ <?php $_tierPrices = $this->getTierPrices($_product); ?>
49
+ <?php endif; ?>
50
+ <?php Mage::helper('weee')->processTierPrices($_product, $_tierPrices); ?>
51
+ <?php foreach ($_tierPrices as $_index => $_price): ?>
52
+ <?php /* Change ian.c on 5/17/12 at 3:33 PM
53
+ * Description: If this isn't the tier qty we won't, dont process.
54
+ */?>
55
+ <?php if (!is_null($_product->getTierQty()) && $_price['price_qty'] != $_product->getTierQty()): continue; endif;?>
56
+ <li>
57
+ <?php if (!$_catalogHelper->canApplyMsrp($_product)): ?>
58
+ <?php if ($this->helper('tax')->displayBothPrices()): ?>
59
+ <?php if (Mage::helper('weee')->typeOfDisplay($_product, 0)): ?>
60
+ <?php echo $this->__('%1$s (%2$s incl. tax)', $_price['formated_price_incl_weee_only'], $_price['formated_price_incl_weee']) ?>
61
+ <?php elseif(Mage::helper('weee')->typeOfDisplay($_product, 1)): ?>
62
+ <?php echo $this->__('%1$s', $_price['formated_price_incl_weee_only']); ?>
63
+ <?php if ($_weeeTaxAttributes): ?>
64
+ (<small>
65
+ <?php echo $this->__('%1$s incl tax.', $_price['formated_price_incl_weee']); ?>
66
+ <?php $separator = ' + '; foreach ($_weeeTaxAttributes as $_attribute): ?>
67
+ <?php echo $separator; ?>
68
+ <?php echo $_attribute->getName(); ?>: <?php echo Mage::helper('core')->currency($_attribute->getAmount()); ?>
69
+ <?php endforeach; ?>
70
+ </small>)
71
+ <?php endif; ?>
72
+ <?php elseif(Mage::helper('weee')->typeOfDisplay($_product, 4)): ?>
73
+ <?php echo $this->__('%1$s', $_price['formated_price_incl_weee_only']); ?>
74
+ <?php if ($_weeeTaxAttributes): ?>
75
+ (<small>
76
+ <?php echo $this->__('%1$s incl tax.', $_price['formated_price_incl_weee']); ?>
77
+ <?php $separator = ' + '; foreach ($_weeeTaxAttributes as $_attribute): ?>
78
+ <?php echo $separator; ?>
79
+ <?php echo $_attribute->getName(); ?>: <?php echo Mage::helper('core')->currency($_attribute->getAmount()+$_attribute->getTaxAmount()); ?>
80
+ <?php endforeach; ?>
81
+ </small>)
82
+ <?php endif; ?>
83
+ <?php elseif(Mage::helper('weee')->typeOfDisplay($_product, 2)): ?>
84
+ <?php echo $this->__('%1$s', $_price['formated_price']); ?>
85
+ <?php if ($_weeeTaxAttributes): ?>
86
+ (<small>
87
+ <?php foreach ($_weeeTaxAttributes as $_attribute): ?>
88
+ <?php echo $_attribute->getName(); ?>: <?php echo Mage::helper('core')->currency($_attribute->getAmount()); ?>
89
+ <?php endforeach; ?>
90
+ <?php echo $this->__('incl. Tax: %1$s', $_price['formated_price_incl_weee']); ?>
91
+ </small>)
92
+ <?php endif; ?>
93
+ <?php else: ?>
94
+ <?php echo $this->__('%1$s (%2$s incl. tax)', $_price['formated_price'], $_price['formated_price_incl_tax']) ?>
95
+ <?php endif; ?>
96
+ <?php else: ?>
97
+ <?php if ($this->helper('tax')->displayPriceIncludingTax()): ?>
98
+ <?php if (Mage::helper('weee')->typeOfDisplay($_product, 0)): ?>
99
+ <?php echo $this->__('%1$s', $_price['formated_price_incl_weee']) ?>
100
+ <?php elseif(Mage::helper('weee')->typeOfDisplay($_product, 1)): ?>
101
+ <?php echo $this->__('%1$s', $_price['formated_price_incl_weee']); ?>
102
+ <?php if ($_weeeTaxAttributes): ?>
103
+ (<small>
104
+ <?php $separator = ''; foreach ($_weeeTaxAttributes as $_attribute): ?>
105
+ <?php echo $separator; ?>
106
+ <?php echo $_attribute->getName(); ?>: <?php echo Mage::helper('core')->currency($_attribute->getAmount()); ?>
107
+ <?php $separator = ' + '; endforeach; ?>
108
+ </small>)
109
+ <?php endif; ?>
110
+ <?php elseif(Mage::helper('weee')->typeOfDisplay($_product, 4)): ?>
111
+ <?php echo $this->__('%1$s', $_price['formated_price_incl_weee']); ?>
112
+ <?php if ($_weeeTaxAttributes): ?>
113
+ (<small>
114
+ <?php $separator = ''; foreach ($_weeeTaxAttributes as $_attribute): ?>
115
+ <?php echo $separator; ?>
116
+ <?php echo $_attribute->getName(); ?>: <?php echo Mage::helper('core')->currency($_attribute->getAmount()+$_attribute->getTaxAmount()); ?>
117
+ <?php $separator = ' + '; endforeach; ?>
118
+ </small>)
119
+ <?php endif; ?>
120
+ <?php elseif(Mage::helper('weee')->typeOfDisplay($_product, 2)): ?>
121
+ <?php echo $this->__('%1$s', $_price['formated_price_incl_tax']); ?>
122
+ <?php if ($_weeeTaxAttributes): ?>
123
+ (<small>
124
+ <?php foreach ($_weeeTaxAttributes as $_attribute): ?>
125
+ <?php echo $_attribute->getName(); ?>: <?php echo Mage::helper('core')->currency($_attribute->getAmount()); ?>
126
+ <?php endforeach; ?>
127
+ <?php echo $this->__('Total incl. Tax: %1$s', $_price['formated_price_incl_weee']); ?>
128
+ </small>)
129
+ <?php endif; ?>
130
+ <?php else: ?>
131
+ <?php echo $this->__('%1$s', $_price['formated_price_incl_tax']) ?>
132
+ <?php endif; ?>
133
+ <?php else: ?>
134
+ <?php if (Mage::helper('weee')->typeOfDisplay($_product, 0)): ?>
135
+ <?php echo $this->__('%1$s', $_price['formated_price_incl_weee_only']) ?>
136
+ <?php elseif(Mage::helper('weee')->typeOfDisplay($_product, 1)): ?>
137
+ <?php echo $this->__('%1$s', $_price['formated_price_incl_weee_only']); ?>
138
+ <?php if ($_weeeTaxAttributes): ?>
139
+ (<small>
140
+ <?php $separator = ''; foreach ($_weeeTaxAttributes as $_attribute): ?>
141
+ <?php echo $separator; ?>
142
+ <?php echo $_attribute->getName(); ?>: <?php echo Mage::helper('core')->currency($_attribute->getAmount()); ?>
143
+ <?php $separator = ' + '; endforeach; ?>
144
+ </small>)
145
+ <?php endif; ?>
146
+ <?php elseif(Mage::helper('weee')->typeOfDisplay($_product, 4)): ?>
147
+ <?php echo $this->__('%1$s', $_price['formated_price_incl_weee_only']); ?>
148
+ <?php if ($_weeeTaxAttributes): ?>
149
+ (<small>
150
+ <?php $separator = ''; foreach ($_weeeTaxAttributes as $_attribute): ?>
151
+ <?php echo $separator; ?>
152
+ <?php echo $_attribute->getName(); ?>: <?php echo Mage::helper('core')->currency($_attribute->getAmount()+$_attribute->getTaxAmount()); ?>
153
+ <?php $separator = ' + '; endforeach; ?>
154
+ </small>)
155
+ <?php endif; ?>
156
+ <?php elseif(Mage::helper('weee')->typeOfDisplay($_product, 2)): ?>
157
+ <?php echo $this->__('%1$s', $_price['formated_price']); ?>
158
+ <?php if ($_weeeTaxAttributes): ?>
159
+ (<small>
160
+ <?php foreach ($_weeeTaxAttributes as $_attribute): ?>
161
+ <?php echo $_attribute->getName(); ?>: <?php echo Mage::helper('core')->currency($_attribute->getAmount()); ?>
162
+ <?php endforeach; ?>
163
+ <?php echo $this->__('Total incl. Tax: %1$s', $_price['formated_price_incl_weee_only']); ?>
164
+ </small>)
165
+ <?php endif; ?>
166
+ <?php else: ?>
167
+ <?php echo $this->__('%1$s', $_price['formated_price']) ?>
168
+ <?php endif; ?>
169
+ <?php endif; ?>
170
+ <?php endif; ?>
171
+
172
+ <?php endif; // Can apply MSRP ?>
173
+
174
+ <?php if ($_catalogHelper->isShowPriceOnGesture($_product)):?>
175
+ <?php $popupId = 'msrp-popup-' . $_product->getId() . $this->helper('core')->getRandomString(20); ?>
176
+ <a href="#" id="<?php echo($popupId);?>"><?php echo $this->__('Click for price'); ?></a>
177
+ <script type="text/javascript">
178
+ <?php
179
+ $addToCartUrl = $this->getProduct()->isSalable()
180
+ ? $this->getAddToCartUrl($_product, array('qty' => $_price['price_qty']))
181
+ : '';
182
+ ?>
183
+ <?php if (!$this->getInGrouped()): ?>
184
+ var newLink = {
185
+ url: "<?php echo $addToCartUrl; ?>",
186
+ qty: "<?php echo $_price['price_qty']?>"
187
+ };
188
+ <?php else: ?>
189
+ var newLink = {
190
+ url: "<?php echo $addToCartUrl; ?>",
191
+ notUseForm: true
192
+ };
193
+ <?php endif ?>
194
+ Catalog.Map.addHelpLink(
195
+ $('<?php echo $popupId ?>'),
196
+ "<?php echo $_product->getName() ?>",
197
+ <?php echo json_encode($_price['real_price_html']) ?>,
198
+ "<?php echo $this->helper('core')->currency($_product->getMsrp(),true,false) ?>",
199
+ newLink
200
+ );
201
+ </script>
202
+ <?php else: ?>
203
+ <span class="msrp-price-hide-message">
204
+ <?php echo $_catalogHelper->getMsrpPriceMessage($_product) ?>
205
+ </span>
206
+ <?php endif; ?>
207
+
208
+
209
+ </li>
210
+
211
+ <?php endforeach ?>
212
+ </ul>
213
+ <?php endif;?>
app/design/frontend/enterprise/default/template/levementum/groupedproduct/product/view/type/grouped.phtml ADDED
@@ -0,0 +1,593 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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 base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+
27
+ /**
28
+ * Grouped product data template
29
+ *
30
+ * @see Mage_Catalog_Block_Product_View_Media
31
+ * @see Mage_Catalog_Block_Product_View_Type_Grouped
32
+ * @var $this Levementum_Groupedproduct_Block_Product_View_Type_Grouped
33
+ *
34
+ * ---Begin php doc for variable reference---
35
+ * @var $this Mage_Catalog_Model_Product
36
+ * @var $_toolbar Levementum_Groupedproduct_Block_Toolbar
37
+ */
38
+
39
+ $_taxHelper = $this->helper('tax');
40
+ $_outputHelper = $this->helper('catalog/output');
41
+ $_toolbar = $this->getToolbar();
42
+ $_wishlist = $this->helper('wishlist');
43
+ $_groupedHelper = $this->helper('groupedproduct'); /** @var $_groupedHelper Levementum_Groupedproduct_Helper_Data */
44
+ $_configHelper = $this->helper('groupedproduct/config'); /** @var $_configHelper Levementum_Groupedproduct_Helper_Config */
45
+
46
+ $this->setPreconfiguredValue();
47
+ $_product = $this->getProduct();
48
+ $_associatedProducts = $this->getAssociatedProducts();
49
+ $_associatedProductCount = count($_associatedProducts);
50
+ $_hasAssociatedProducts = $_associatedProductCount > 0;
51
+ $_productTiers = array();
52
+
53
+ $displayIndividualAddToCart = $_configHelper->displayIndividualAddToCart();
54
+
55
+ $sortAllAttributes = $_configHelper->allowSortAllAttributes();
56
+
57
+ //Get Displayed Attributes List
58
+ $displayedAttributes = $_product->getData('lev_displayed_attributes');
59
+ $attributes = $_groupedHelper->getDisplayedAttributeList($displayedAttributes, $_product);
60
+
61
+ ///**determine if some simples are on sale.**/
62
+ $onSale = false;
63
+ $tiered = false;
64
+ /** @var $_associatedProduct Mage_Catalog_Model_Product */
65
+ foreach ($_associatedProducts as $_associatedProduct) {
66
+ if (!$onSale && (($_associatedProduct->special_price !== null) or ($_associatedProduct->_rule_price !== null))) {
67
+ //has special price
68
+ $_simplePricesTax = ($_taxHelper->displayPriceIncludingTax() || $_taxHelper->displayBothPrices());
69
+ $_price = $_taxHelper->getPrice($_associatedProduct, $_associatedProduct->getPrice());
70
+ $_regularPrice = $_taxHelper->getPrice($_associatedProduct, $_associatedProduct->getPrice(), $_simplePricesTax);
71
+ $_finalPrice = $_taxHelper->getPrice($_associatedProduct, $_associatedProduct->getFinalPrice());
72
+
73
+ if ($_finalPrice < $_price) {
74
+ $onSale = true;
75
+ }
76
+ }
77
+
78
+ if ($_associatedProduct->getTierPriceCount() > 0) {
79
+ foreach($_associatedProduct->getFormatedTierPrice() as $tier) {
80
+ if (!isset($_productTiers[$tier['price_qty']]) && $tier['price_qty'] > 1) {
81
+ $_productTiers[$tier['price_qty']] = $tier['price_qty'];
82
+ $tiered = true;
83
+ }
84
+ }
85
+ }
86
+ }
87
+
88
+ //Sort - maintain key=>value pair
89
+ natsort($_productTiers);
90
+
91
+ $this->setTierPriceTemplate('levementum/groupedproduct/product/view/tierprices-basic.phtml');
92
+
93
+ Mage::register('grouped-table',true,true);
94
+
95
+ $_mode = $_toolbar->getCurrentMode();
96
+ $_columnCount = 5;
97
+
98
+ ?>
99
+ <div class="grouped-table grouped-table-<?php echo $_mode; ?>">
100
+ <?php if ($_mode == 'list'): ?>
101
+ <div class="box-collateral">
102
+ <div class="box-title">
103
+ <h2><?php echo $this->__('Purchase Items') ?></h2>
104
+ </div>
105
+ </div>
106
+ <?php endif;?>
107
+ <form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="grouped-product_addtocart_form">
108
+ <div class="no-display">
109
+ <input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
110
+ <input type="hidden" name="related_product" id="related-products-field" value="" />
111
+ </div>
112
+ <?php echo $this->getChildHtml('product_type_data_extra') ?>
113
+ <?php echo $this->getPagerHtml(); ?>
114
+ <?php if ($_mode == 'grid'): ?>
115
+ <table class="data-table grouped-items-table tablesorter" id="super-product-table">
116
+ <tbody>
117
+ <?php if ($_hasAssociatedProducts): ?>
118
+ <?php $index = 0;?>
119
+ <?php foreach ($_associatedProducts as $_item): ?>
120
+ <?php if ($index++ % $_columnCount == 0): ?>
121
+ <tr>
122
+ <?php endif; ?>
123
+
124
+ <td class="data-cell">
125
+ <ul>
126
+ <li class="grid-image"><a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_item, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_item, 'small_image'), null, true) ?>" /></a></li>
127
+ <li class="grid-name"><a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_item, 'small_image'), null, true) ?>" class="product-name"><?php echo $_item->getName();?></a></li>
128
+ <li class="grid-price"><?php echo $this->getPriceHtml($_item, true)?> </li>
129
+ <?php if($_product->isSaleable() && $displayIndividualAddToCart): ?>
130
+ <li class="grid-addtocart">
131
+ <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_item) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
132
+ </li>
133
+ <?php endif; ?>
134
+ <li>
135
+ <ul class="add-to-links">
136
+ <?php if ($_wishlist->isAllow()) : ?>
137
+ <li><a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
138
+ <?php endif; ?>
139
+ <li><span class="separator">|</span> <a href="<?php echo $this->getAddToCompareUrl($_item) ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
140
+ </ul>
141
+ </li>
142
+ </ul>
143
+ </td>
144
+
145
+ <?php if ($index % $_columnCount != 0): ?>
146
+ <td class="data-buffer"></td>
147
+ <?php endif; ?>
148
+ <?php if ($index % $_columnCount == 0): ?>
149
+ </tr>
150
+ <?php endif; ?>
151
+ <?php endforeach;?>
152
+ <?php echo str_repeat('<td>&nbsp;</td>',$_columnCount-$index % $_columnCount); ?>
153
+ <?php if ($index % $_columnCount != 0): ?>
154
+ <?php echo '</tr>'; ?>
155
+ <?php endif; ?>
156
+ <?php endif;?>
157
+ </tbody>
158
+ </table>
159
+
160
+ <script type="text/javascript">decorateTable('super-product-table')</script>
161
+ <?php elseif ($_mode == 'detail'): /*Should mimic magento default list view*/ ?>
162
+ <table class="data-table grouped-items-table tablesorter" id="super-product-table">
163
+ <thead>
164
+ <tr class="no-display">
165
+ <th class="no_sort product-image-header"></th>
166
+ <th class="no_sort product-detail-header"></th>
167
+ <?php foreach ($attributes as $attribute): ?>
168
+ <th class="no-display<?php if(!$attribute['used_for_sort_by'] && !$sortAllAttributes):?> no_sort<?php endif;?>" id="grouped-sort-by-<?php echo $attribute['code']?>">
169
+ <?php echo $this->__($attribute['label'])?>
170
+ </th>
171
+ <?php endforeach; ?>
172
+
173
+ <th class="no-display" id="grouped-sort-by-msrp"><?php echo $this->__('LIST') ?></th>
174
+ <th class="a-right" id="grouped-sort-by-price"><?php echo $this->__($_groupedHelper->getPriceLabel()) ?></th>
175
+ <?php if ($onSale): ?>
176
+ <th class="no-display "><?php echo $this->__('SALE');?></th>
177
+ <?php endif;?>
178
+ <?php if ($tiered): ?>
179
+ <?php foreach($_productTiers as $tier_qty): ?>
180
+ <th class="no-display "><?php echo floor($tier_qty);?>+</th>
181
+ <?php endforeach; ?>
182
+ <?php endif; ?>
183
+ <?php if ($_product->getData('lev_display_availability')): ?>
184
+ <th class="no-display " id="grouped-sort-by-availability"><?php echo $this->__('Availability') ?></th>
185
+ <?php endif; ?>
186
+ <th class="no-display <?php if (!$sortAllAttributes):?>no_sort<?php endif;?>"><?php echo $this->__('Qty') ?></th>
187
+ </tr>
188
+ </thead>
189
+ <tbody>
190
+ <?php if ($_hasAssociatedProducts): ?>
191
+ <?php foreach ($_associatedProducts as $_item): ?>
192
+ <?php $_finalPriceInclTax = $this->helper('tax')->getPrice($_item, $_item->getFinalPrice(), true) ?>
193
+ <tr>
194
+ <td class="product-image-cell"><a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_item, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(166,166); ?>" width="166" height="166" alt="<?php echo $this->stripTags($this->getImageLabel($_item, 'small_image'), null, true) ?>" /></a></td>
195
+ <td class="product-detail-cell">
196
+ <?php // Product description ?>
197
+ <div class="product-shop">
198
+ <div class="f-fix">
199
+ <?php $_itemNameStripped = $this->stripTags($_item->getName(), null, true); ?>
200
+ <h2 class="product-name"><a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $_itemNameStripped; ?>"><?php echo $_outputHelper->productAttribute($_item, $_item->getName() , 'name'); ?></a></h2>
201
+ <?php if($_item->getRatingSummary()): ?>
202
+ <?php echo $this->getReviewsSummaryHtml($_item) ?>
203
+ <?php endif; ?>
204
+ <?php echo $this->getPriceHtml($_item, true) ?>
205
+ <div class="desc std">
206
+ <?php echo $_outputHelper->productAttribute($_item, $_item->getShortDescription(), 'short_description') ?>
207
+ <a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $_itemNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
208
+ </div>
209
+
210
+ <?php if($_item->isSaleable()): ?>
211
+ <?php if ($displayIndividualAddToCart): ?>
212
+ <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_item) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
213
+ <?php endif; ?>
214
+ <?php else: ?>
215
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
216
+ <?php endif; ?>
217
+
218
+ <ul class="add-to-links">
219
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
220
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_item) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
221
+ <?php endif; ?>
222
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_item)): ?>
223
+ <li><a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
224
+ <?php endif; ?>
225
+ </ul>
226
+ </div>
227
+ </div>
228
+ </td>
229
+
230
+ <?php foreach($attributes as $attribute): ?>
231
+ <td class="no-display <?php echo $attribute['code']?>"><?php echo $_item->getResource()->getAttribute($attribute['code'])->getFrontend()->getValue($_item); ?></td>
232
+ <?php endforeach; ?>
233
+
234
+ <td class="no-display msrp"><?php echo Mage::helper('core')->currency($_taxHelper->getPrice($_item, $_item->getMsrp()),true,false) ?></td>
235
+ <?php if ($this->getCanShowProductPrice($_product)): ?>
236
+ <td class="no-display <?php if($onSale): ?> original-price<?php else: ?> price<?php endif;?>"><?php if ($this->getCanShowProductPrice($_item)): ?><?php echo Mage::helper('core')->currency($_taxHelper->getPrice($_item, $_item->getPrice()),true,false) ?><?php endif; ?></td>
237
+ <?php if($onSale): ?>
238
+ <td class="no-display sale-price">
239
+ <?php echo Mage::helper('core')->currency($_taxHelper->getPrice($_item, $_item->getFinalPrice()),true,false) ?>
240
+ </td>
241
+ <?php endif; ?>
242
+ <?php if($tiered): ?>
243
+ <?php foreach ($_productTiers as $tier_qty): ?>
244
+ <?php if ($_item->getTierPrice($tier_qty) < $_item->getFinalPrice()): ?>
245
+ <td class="no-display tier-price"><?php echo Mage::helper('core')->currency($_taxHelper->getPrice($_item, $_item->getTierPrice($tier_qty)),true,false) ?></td>
246
+ <?php else: ?>
247
+ <td class="no-display "></td>
248
+ <?php endif; ?>
249
+ <?php endforeach; ?>
250
+ <?php endif; ?>
251
+ <?php endif; ?>
252
+
253
+ <?php if ($_product->getData('lev_display_availability')): ?>
254
+ <td class="no-display">
255
+ <?php if ($_item->isSaleable()) : ?>
256
+ <p class="availability in-stock"><span><?php echo $this->__('In stock') ?></span></p>
257
+ <?php else: ?>
258
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
259
+ <?php endif; ?>
260
+ </td>
261
+ <?php endif; ?>
262
+ <td><input type="text" name="super_group[<?php echo $_item->getId() ?>]" maxlength="12"
263
+ value="<?php echo $_item->getQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>"
264
+ class="no-display input-text qty"/></td>
265
+ </tr>
266
+ <?php endforeach; ?>
267
+ <?php endif;?>
268
+ </tbody>
269
+ </table>
270
+ <?php else: /* if ($_mode == 'list') */ ?>
271
+ <table class="data-table grouped-items-table table table-bordered tablesorter" id="super-product-table">
272
+ <colgroup>
273
+ <?php foreach ($attributes as $attribute): ?>
274
+ <?php if ($attribute['primary']): ?>
275
+ <col />
276
+ <?php else: ?>
277
+ <col width="1"/>
278
+ <?php endif; ?>
279
+ <?php endforeach; ?>
280
+ <?php
281
+ $extraCols = 1;
282
+ if ($this->getCanShowProductPrice($_product)) {
283
+ $extraCols += 1 + ($onSale ? 1 : 0) + count($_productTiers);
284
+ }
285
+
286
+ //If can display availability, add 1
287
+ $extraCols += ($_product->getData('lev_display_availability') ? 1 : 0);
288
+
289
+ $extraCols += (($_product->getData('lev_display_qty')) ? 1 : 0); //increment one for 'qty' field.
290
+
291
+ echo str_repeat('<col width="1" />',$extraCols);
292
+ ?>
293
+ </colgroup>
294
+ <thead>
295
+ <tr>
296
+ <?php foreach ($attributes as $attribute): ?>
297
+ <th class="a-left<?php if(!$attribute['used_for_sort_by'] && !$sortAllAttributes):?> no_sort<?php endif;?>" id="grouped-sort-by-<?php echo $attribute['code']?>">
298
+ <?php echo str_ireplace(' ','&nbsp;',$this->__($attribute['label']))?>
299
+ </th>
300
+ <?php endforeach; ?>
301
+
302
+ <?php if ($this->getCanShowProductPrice($_product)): ?>
303
+ <th class="a-right" id="grouped-sort-by-price"><?php echo $this->__($_groupedHelper->getPriceLabel()) ?></th>
304
+
305
+ <?php if ($onSale): ?>
306
+ <th class="a-right"><?php echo $this->__('SALE');?></th>
307
+ <?php endif;?>
308
+ <?php if ($tiered): ?>
309
+ <?php foreach($_productTiers as $tier_qty): ?>
310
+ <th class="a-right"><?php echo floor($tier_qty);?>+</th>
311
+ <?php endforeach; ?>
312
+ <?php endif; ?>
313
+ <?php endif; ?>
314
+ <?php if ($_product->getData('lev_display_qty')):?>
315
+ <th class="a-left"><?php echo $this->__('Qty Available') ?></th>
316
+ <?php endif; ?>
317
+ <?php if ($_product->getData('lev_display_availability')): ?>
318
+ <th class="a-right" id="grouped-sort-by-availability">Availability</th>
319
+ <?php endif; ?>
320
+ <th class="a-center no_sort last"><?php echo $this->__('Add Qty To Cart') ?></th>
321
+ </tr>
322
+ </thead>
323
+ <tbody>
324
+ <?php if ($_hasAssociatedProducts): ?>
325
+ <?php foreach ($_associatedProducts as $_item): ?>
326
+ <?php $_finalPriceInclTax = $this->helper('tax')->getPrice($_item, $_item->getFinalPrice(), true) ?>
327
+ <tr>
328
+ <?php foreach($attributes as $attribute): ?>
329
+ <?php if ($_item->getResource()->getAttribute($attribute['code'])->getBackendModel() == 'catalog/product_attribute_backend_price'): ?>
330
+ <?php if ($attribute['code'] == 'price'): ?>
331
+ <?php if ($this->getCanShowProductPrice($_product)): ?>
332
+ <td class="a-right <?php if($onSale): ?> original-price<?php else: ?> price<?php endif;?>"><?php if ($this->getCanShowProductPrice($_item)): ?><?php echo Mage::helper('core')->currency($_taxHelper->getPrice($_item, $_item->getPrice()),true,false) ?><?php endif; ?></td>
333
+ <?php if($onSale): ?>
334
+ <td class="a-right sale-price">
335
+ <?php echo Mage::helper('core')->currency($_taxHelper->getPrice($_item, $_item->getFinalPrice()),true,false) ?>
336
+ </td>
337
+ <?php endif; ?>
338
+ <?php if($tiered): ?>
339
+ <?php foreach ($_productTiers as $tier_qty): ?>
340
+ <?php if ($_item->getTierPrice($tier_qty) < $_item->getFinalPrice()): ?>
341
+ <td class="a-right tier-price"><?php echo Mage::helper('core')->currency($_taxHelper->getPrice($_item, $_item->getTierPrice($tier_qty)),true,false) ?></td>
342
+ <?php else: ?>
343
+ <td></td>
344
+ <?php endif; ?>
345
+ <?php endforeach; ?>
346
+ <?php endif; ?>
347
+ <?php endif;?>
348
+ <?php else: ?>
349
+ <td class="<?php echo $attribute['code']?>"><?php echo Mage::helper('core')->currency($_item->getResource()->getAttribute($attribute['code'])->getFrontend()->getValue($_item)); ?></td>
350
+ <?php endif;?>
351
+ <?php elseif ($_item->getResource()->getAttribute($attribute['code'])->getFrontendInput() == 'media_image'): ?>
352
+ <td class="<?php echo $attribute['code']?>">
353
+ <?php echo '<img src="'.$this->helper('catalog/image')->init($_item, $attribute['code'])->resize(35,35).'" width="35" height="35" alt="'.$this->htmlEscape($_item->getImageLabel()).'" title="'.$this->htmlEscape($_item->getImageLabel()).'" />';?>
354
+ <?php else: ?>
355
+ <td class="<?php echo $attribute['code']?>"><?php echo $_item->getResource()->getAttribute($attribute['code'])->getFrontend()->getValue($_item); ?></td>
356
+ <?php endif; ?>
357
+ <?php endforeach; ?>
358
+
359
+ <?php if ($this->getCanShowProductPrice($_product)): ?>
360
+ <td class="a-right <?php if($onSale): ?> original-price<?php else: ?> price<?php endif;?>"><?php if ($this->getCanShowProductPrice($_item)): ?><?php echo Mage::helper('core')->currency($_taxHelper->getPrice($_item, $_item->getPrice()),true,false) ?><?php endif; ?></td>
361
+ <?php if($onSale): ?>
362
+ <td class="a-right sale-price">
363
+ <?php echo Mage::helper('core')->currency($_taxHelper->getPrice($_item, $_item->getFinalPrice()),true,false) ?>
364
+ </td>
365
+ <?php endif; ?>
366
+ <?php if($tiered): ?>
367
+ <?php foreach ($_productTiers as $tier_qty): ?>
368
+ <?php if ($_item->getTierPrice($tier_qty) < $_item->getFinalPrice()): ?>
369
+ <td class="a-right tier-price"><?php echo Mage::helper('core')->currency($_taxHelper->getPrice($_item, $_item->getTierPrice($tier_qty)),true,false) ?></td>
370
+ <?php else: ?>
371
+ <td>&nbsp;</td>
372
+ <?php endif; ?>
373
+ <?php endforeach; ?>
374
+ <?php endif; ?>
375
+ <?php endif; ?>
376
+
377
+ <?php if ($_product->getData('lev_display_qty')):?>
378
+ <td class="qty"><?php echo $_item->getStockItem()->getQty()*1 ?></td>
379
+ <?php endif; ?>
380
+ <?php if ($_product->getData('lev_display_availability')): ?>
381
+ <td class="a-center">
382
+ <?php if ($_item->isSaleable()) : ?>
383
+ <p class="availability in-stock"><span><?php echo $this->__('In stock') ?></span></p>
384
+ <?php else: ?>
385
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
386
+ <?php endif; ?>
387
+ </td>
388
+ <?php endif; ?>
389
+ <td class="a-center"><input type="text" name="super_group[<?php echo $_item->getId() ?>]" id="super_group_<?php echo $_item->getId() ?>" maxlength="12"
390
+ value="<?php echo $_item->getQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>"
391
+ class="input-text qty"/>
392
+ <?php if ($displayIndividualAddToCart): ?>
393
+ <span class="add-qty-to-cart"><button onclick="setLocation('<?php echo Mage::getUrl('checkout/cart/add', array('product' => $_item->getId())) ?>qty/'+jQuery('#super_group_<?php echo $_item->getId() ?>').val()+'/')" class="btn btn-success btn-cart" title="Add to Cart" type="button"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></span>
394
+ <?php endif; ?>
395
+ </td>
396
+ </tr>
397
+ <?php endforeach; ?>
398
+ <?php else: ?>
399
+ <tr>
400
+ <td colspan="<?php echo ($_product->isSaleable() ? 4 : 3) ?>"><?php echo $this->__('No options of this product are available.') ?></td>
401
+ </tr>
402
+ <?php endif; ?>
403
+ </tbody>
404
+ </table>
405
+ <?php endif; /* endif ($_mode == 'list') */?>
406
+
407
+ <div class="toolbar-bottom">
408
+ <?php echo $this->getPagerHtml(); ?>
409
+ </div>
410
+
411
+ <?php if ($_mode != 'grid'): ?>
412
+ <script type="text/javascript">
413
+ var dataTable;
414
+
415
+ <?php
416
+ /* Default values for drop down*/
417
+ $aLengthValues = array(10, 25, 50);
418
+ $aLengthLabels = array('10', '25', '50');
419
+ $all_found = false;
420
+ $index = 0;
421
+
422
+ /* Calculate from available limits */
423
+ foreach ($_toolbar->getAvailableLimit() as $_key=> $_limit) {
424
+ if ($index++ == 0) {
425
+ $aLengthValues = array();
426
+ $aLengthLabels = array();
427
+ }
428
+
429
+ if ($_key == 'all') {
430
+ $_key = -1;
431
+ $all_found = true;
432
+ }
433
+
434
+ array_push($aLengthValues, $_key);
435
+ array_push($aLengthLabels, '\'' . $_limit . '\'');
436
+ }
437
+
438
+ if ($_configHelper->getDefaultPageLengthAll($_mode) == 'other' && $_configHelper->getDefaultPageLength()) {
439
+ $defaultDisplayLength = $_configHelper->getDefaultPageLength();
440
+ if (!in_array($defaultDisplayLength,$aLengthValues)) {
441
+ array_push($aLengthValues, $defaultDisplayLength);
442
+ array_push($aLengthLabels, '\'' . $defaultDisplayLength . '\'');
443
+ }
444
+ } else {
445
+ $defaultDisplayLength = -1;
446
+ }
447
+
448
+ if (!$all_found) {
449
+ array_push($aLengthValues, -1);
450
+ array_push($aLengthLabels, '\'all\'');
451
+ }
452
+ $aLengthMenu = '[[' . implode(', ', $aLengthValues) . '], [' . implode(', ', $aLengthLabels) . ']]';
453
+ ?>
454
+
455
+ jQuery(document).ready(function () {
456
+ var aoColumns = [];
457
+ jQuery('#super-product-table thead th').each( function () {
458
+ if ( jQuery(this).hasClass( 'no_sort' )) {
459
+ aoColumns.push( { "bSortable": false } );
460
+ } else {
461
+ aoColumns.push( null );
462
+ }
463
+ });
464
+
465
+ <?php if ($_hasAssociatedProducts): ?>
466
+ <?php if (!$_configHelper->displayFirstLast($_mode)):?>
467
+ jQuery.fn.dataTableExt.oStdClasses.sPageFirst = "no-display";
468
+ jQuery.fn.dataTableExt.oStdClasses.sPageLast = "no-display";
469
+ <?php endif; ?>
470
+
471
+ jQuery.fn.dataTableExt.oStdClasses.sPagePrevious = "previous i-previous";
472
+ jQuery.fn.dataTableExt.oStdClasses.sPageNext = "next i-next";
473
+ jQuery.fn.dataTableExt.oStdClasses.sPaging = "pages dataTables_paginate paging_";
474
+ jQuery.fn.dataTableExt.oStdClasses.sWrapper = "pager dataTables_wrapper";
475
+ jQuery.fn.dataTableExt.oStdClasses.sPageButtonActive = "current paginate_button";
476
+ jQuery.fn.dataTableExt.oStdClasses.sSortColumn = "sorting_";
477
+ dataTable = jQuery('#super-product-table').dataTable({
478
+ "fnDrawCallback": function( oSettings ) {
479
+ var displayedRowCount = this[0].rows.length-1;
480
+ jQuery.each(this[0].rows, function() {
481
+ this.removeClassName('first');
482
+ this.removeClassName('last');
483
+ });
484
+ this[0].rows[1].addClassName('first');
485
+ this[0].rows[displayedRowCount].addClassName('last');
486
+ },
487
+ <?php
488
+ /*
489
+ * i = information
490
+ * p = pagination
491
+ * l = limiter
492
+ */
493
+ ?>
494
+ "sDom": '<?php echo $_groupedHelper->getToolbarSDom($_mode);?>',
495
+ "sPaginationType":"full_numbers",
496
+ "bProcessing":true,
497
+ "bFilter":false,
498
+ "iDisplayLength":<?php echo $defaultDisplayLength?>,
499
+ "oLanguage":{
500
+ "sLengthMenu":"Show _MENU_ per page",
501
+ "sInfo": "Items _START_ - _END_ of _TOTAL_",
502
+ "sInfoEmpty": "Items 0 to 0 of 0",
503
+ "oPaginate":{
504
+ "sNext":'<img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/>',
505
+ "sPrevious":'<img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/>'
506
+ }
507
+ },
508
+ "aLengthMenu": <?php echo $aLengthMenu;?>,
509
+ "aoColumns": aoColumns
510
+ });
511
+ jQuery('.grouped-table .dataTables_paginate').prepend('<?php echo str_ireplace("'","\'",$_configHelper->getPaginationPrepend($_mode));?>');
512
+ <?php endif; ?>
513
+ });
514
+
515
+ <?php
516
+ /* Change ian.c on 6/30/12 at 11:08 AM
517
+ * Description: This function connects the dropdown in the toolbar.phtml file to the datatable.
518
+ */
519
+ ?>
520
+ function groupedTableSort(column_index, select) {
521
+ dataTable.fnSort([
522
+ [column_index, 'asc']
523
+ ]);
524
+ jQuery('.grouped-select').val(select.value);
525
+ }
526
+ </script>
527
+ <?php endif; ?>
528
+
529
+ <?php
530
+ /*
531
+ * Add to cart for product list.
532
+ */
533
+ ?>
534
+ <?php if ($_mode == 'list'): ?>
535
+
536
+ <script type="text/javascript">
537
+ //<![CDATA[
538
+ var groupedProductAddToCartForm = new VarienForm('grouped-product_addtocart_form');
539
+
540
+
541
+ groupedProductAddToCartForm.submit = function(button, url) {
542
+ if (this.validator.validate()) {
543
+ var form = this.form;
544
+ var oldUrl = form.action;
545
+
546
+ if (url) {
547
+ form.action = url;
548
+ }
549
+ var e = null;
550
+ try {
551
+ this.form.submit();
552
+ } catch (e) {
553
+ }
554
+ this.form.action = oldUrl;
555
+ if (e) {
556
+ throw e;
557
+ }
558
+
559
+ if (button && button != 'undefined') {
560
+ button.disabled = true;
561
+ }
562
+ }
563
+ }.bind(groupedProductAddToCartForm);
564
+
565
+ groupedProductAddToCartForm.submitLight = function(button, url){
566
+ if(this.validator) {
567
+ var nv = Validation.methods;
568
+ delete Validation.methods['required-entry'];
569
+ delete Validation.methods['validate-one-required'];
570
+ delete Validation.methods['validate-one-required-by-name'];
571
+ /* Remove custom datetime validators*/
572
+ for (var methodName in Validation.methods) {
573
+ if (methodName.match(/^validate-datetime-.*/i)) {
574
+ delete Validation.methods[methodName];
575
+ }
576
+ }
577
+
578
+ if (this.validator.validate()) {
579
+ if (url) {
580
+ this.form.action = url;
581
+ }
582
+ this.form.submit();
583
+ }
584
+ Object.extend(Validation.methods, nv);
585
+ }
586
+ }.bind(groupedProductAddToCartForm);
587
+ //]]>
588
+ </script>
589
+ <?php endif;?>
590
+ <?php echo $this->getChildHtml('addtocart');?>
591
+ </form>
592
+ </div>
593
+ <?php Mage::unregister('grouped-table'); ?>
app/etc/modules/Levementum_Groupedproduct.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Levementum_Groupedproduct>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Levementum_LevCore/>
9
+ <Mage_Catalog/>
10
+ </depends>
11
+ </Levementum_Groupedproduct>
12
+ </modules>
13
+ </config>
app/etc/modules/Levementum_LevCore.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Levementum_LevCore>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Catalog/>
9
+ <Mage_Review/>
10
+ </depends>
11
+ </Levementum_LevCore>
12
+ </modules>
13
+ </config>
doc/Grouped Product Grid Overview.pdf ADDED
Binary file
doc/Levementum Grouped Product Datasheet.pdf ADDED
Binary file
doc/Levementum Groupedproduct Installation Doc.pdf ADDED
Binary file
js/levementum/levcore/jquery-1.8.3.min.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /*! jQuery v1.8.3 jquery.com | jquery.org/license */
2
+ (function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&v.extend(!0,e,i)}function An(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function On(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function Fn(){try{return new e.XMLHttpRequest}catch(t){}}function In(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $n(){return setTimeout(function(){qn=t},0),qn=v.now()}function Jn(e,t){v.each(t,function(t,n){var r=(Vn[t]||[]).concat(Vn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Kn(e,t,n){var r,i=0,s=0,o=Xn.length,u=v.Deferred().always(function(){delete a.elem}),a=function(){var t=qn||$n(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,i=1-r,s=0,o=f.tweens.length;for(;s<o;s++)f.tweens[s].run(i);return u.notifyWith(e,[f,i,n]),i<1&&o?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:v.extend({},t),opts:v.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:qn||$n(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=v.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Qn(l,f.opts.specialEasing);for(;i<o;i++){r=Xn[i].call(f,e,l,f.opts);if(r)return r}return Jn(f,l),v.isFunction(f.opts.start)&&f.opts.start.call(e,f),v.fx.timer(v.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Qn(e,t){var n,r,i,s,o;for(n in e){r=v.camelCase(n),i=t[r],s=e[n],v.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=v.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Gn(e,t,n){var r,i,s,o,u,a,f,l,c,h=this,p=e.style,d={},m=[],g=e.nodeType&&Gt(e);n.queue||(l=v._queueHooks(e,"fx"),l.unqueued==null&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,h.always(function(){h.always(function(){l.unqueued--,v.queue(e,"fx").length||l.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],v.css(e,"display")==="inline"&&v.css(e,"float")==="none"&&(!v.support.inlineBlockNeedsLayout||nn(e.nodeName)==="inline"?p.display="inline-block":p.zoom=1)),n.overflow&&(p.overflow="hidden",v.support.shrinkWrapBlocks||h.done(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Un.exec(s)){delete t[r],a=a||s==="toggle";if(s===(g?"hide":"show"))continue;m.push(r)}}o=m.length;if(o){u=v._data(e,"fxshow")||v._data(e,"fxshow",{}),"hidden"in u&&(g=u.hidden),a&&(u.hidden=!g),g?v(e).show():h.done(function(){v(e).hide()}),h.done(function(){var t;v.removeData(e,"fxshow",!0);for(t in d)v.style(e,t,d[t])});for(r=0;r<o;r++)i=m[r],f=h.createTween(i,g?u[i]:0),d[i]=u[i]||v.style(e,i),i in u||(u[i]=f.start,g&&(f.end=f.start,f.start=i==="width"||i==="height"?1:0))}}function Yn(e,t,n,r,i){return new Yn.prototype.init(e,t,n,r,i)}function Zn(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=$t[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function tr(e){return v.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.navigator,u=e.jQuery,a=e.$,f=Array.prototype.push,l=Array.prototype.slice,c=Array.prototype.indexOf,h=Object.prototype.toString,p=Object.prototype.hasOwnProperty,d=String.prototype.trim,v=function(e,t){return new v.fn.init(e,t,n)},m=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,g=/\S/,y=/\s+/,b=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,w=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(v.isPlainObject(i)||(s=v.isArray(i)))?(s?(s=!1,o=r&&v.isArray(r)?r:[]):o=r&&v.isPlainObject(r)?r:{},u[n]=v.extend(l,o,i)):i!==t&&(u[n]=i)}return u},v.extend({noConflict:function(t){return e.$===v&&(e.$=a),t&&e.jQuery===v&&(e.jQuery=u),v},isReady:!1,readyWait:1,holdReady:function(e){e?v.readyWait++:v.ready(!0)},ready:function(e){if(e===!0?--v.readyWait:v.isReady)return;if(!i.body)return setTimeout(v.ready,1);v.isReady=!0;if(e!==!0&&--v.readyWait>0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:d&&!d.call("\ufeff\u00a0")?function(e){return e==null?"":d.call(e)}:function(e){return e==null?"":(e+"").replace(b,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=v.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||v.isWindow(e)?f.call(r,e):v.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(c)return c.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof v||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),v.isFunction(e)?(i=l.call(arguments,2),s=function(){return e.apply(n,i.concat(l.call(arguments)))},s.guid=e.guid=e.guid||v.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)v.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&v.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(v(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),v.ready.promise=function(t){if(!r){r=v.Deferred();if(i.readyState==="complete")setTimeout(v.ready,1);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",A,!1),e.addEventListener("load",v.ready,!1);else{i.attachEvent("onreadystatechange",A),e.attachEvent("onload",v.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!v.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}v.ready()}}()}}return r.promise(t)},v.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){O["[object "+t+"]"]=t.toLowerCase()}),n=v(i);var M={};v.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):v.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){v.each(t,function(t,n){var i=v.type(n);i==="function"?(!e.unique||!c.has(n))&&a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&v.each(arguments,function(e,t){var n;while((n=v.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&v.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),v.support=function(){var t,n,r,s,o,u,a,f,l,c,h,p=i.createElement("div");p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&v.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),v.fn.extend({data:function(e,n){var r,i,s,o,u,a=this[0],f=0,l=null;if(e===t){if(this.length){l=v.data(a);if(a.nodeType===1&&!v._data(a,"parsedAttrs")){s=a.attributes;for(u=s.length;f<u;f++)o=s[f].name,o.indexOf("data-")||(o=v.camelCase(o.substring(5)),H(a,o,l[o]));v._data(a,"parsedAttrs",!0)}}return l}return typeof e=="object"?this.each(function(){v.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",v.access(this,function(n){if(n===t)return l=this.triggerHandler("getData"+i,[r[0]]),l===t&&a&&(l=v.data(a,e),l=H(a,e,l)),l===t&&r[1]?this.data(r[0]):l;r[1]=n,this.each(function(){var t=v(this);t.triggerHandler("setData"+i,r),v.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?v.queue(this[0],e):n===t?this:this.each(function(){var t=v.queue(this,e,n);v._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},delay:function(e,t){return e=v.fx?v.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=v.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=v._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var j,F,I,q=/[\t\r\n]/g,R=/\r/g,U=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,W=/^a(?:rea|)$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,V=v.support.getSetAttribute;v.fn.extend({attr:function(e,t){return v.access(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)s.indexOf(" "+t[o]+" ")<0&&(s+=t[o]+" ");i.className=v.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(v.isFunction(e))return this.each(function(t){v(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(y);for(u=0,a=this.length;u<a;u++){i=this[u];if(i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(q," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(q," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(v.support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!v.nodeName(n.parentNode,"optgroup"))){t=v(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n=v.makeArray(t);return v(e).find("option").each(function(){this.selected=v.inArray(v(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o<r.length;o++)i=r[o],i&&(n=v.propFix[i]||i,s=X.test(i),s||v.attr(e,i,""),e.removeAttribute(V?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(U.test(e.nodeName)&&e.parentNode)v.error("type property can't be changed");else if(!v.support.radioValue&&t==="radio"&&v.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return j&&v.nodeName(e,"button")?j.get(e,t):t in e?e.value:null},set:function(e,t,n){if(j&&v.nodeName(e,"button"))return j.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!v.isXMLDoc(e),o&&(n=v.propFix[n]||n,s=v.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):z.test(e.nodeName)||W.test(e.nodeName)&&e.href?0:t}}}}),F={get:function(e,n){var r,i=v.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?v.removeAttr(e,n):(r=v.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},V||(I={name:!0,id:!0,coords:!0},j=v.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(I[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=i.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},v.each(["width","height"],function(e,t){v.attrHooks[t]=v.extend(v.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),v.attrHooks.contenteditable={get:j.get,set:function(e,t,n){t===""&&(t="false"),j.set(e,t,n)}}),v.support.hrefNormalized||v.each(["href","src","width","height"],function(e,n){v.attrHooks[n]=v.extend(v.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),v.support.style||(v.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),v.support.optSelected||(v.propHooks.selected=v.extend(v.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),v.support.enctype||(v.propFix.enctype="encoding"),v.support.checkOn||v.each(["radio","checkbox"],function(){v.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]=v.extend(v.valHooks[this],{set:function(e,t){if(v.isArray(t))return e.checked=v.inArray(v(e).val(),t)>=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f<n.length;f++){l=J.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),g=v.event.special[c]||{},c=(s?g.delegateType:g.bindType)||c,g=v.event.special[c]||{},p=v.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&v.expr.match.needsContext.test(s),namespace:h.join(".")},d),m=a[c];if(!m){m=a[c]=[],m.delegateCount=0;if(!g.setup||g.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}g.add&&(g.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),v.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,m,g=v.hasData(e)&&v._data(e);if(!g||!(h=g.events))return;t=v.trim(Z(t||"")).split(" ");for(s=0;s<t.length;s++){o=J.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)v.event.remove(e,u+t[s],n,r,!0);continue}p=v.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)m=d[c],(i||a===m.origType)&&(!n||n.guid===m.guid)&&(!f||f.test(m.namespace))&&(!r||r===m.selector||r==="**"&&m.selector)&&(d.splice(c--,1),m.selector&&d.delegateCount--,p.remove&&p.remove.call(e,m));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,g.handle)===!1)&&v.removeEvent(e,u,g.handle),delete h[u])}v.isEmptyObject(h)&&(delete g.handle,v.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,s,o){if(!s||s.nodeType!==3&&s.nodeType!==8){var u,a,f,l,c,h,p,d,m,g,y=n.type||n,b=[];if(Y.test(y+v.event.triggered))return;y.indexOf("!")>=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f<m.length&&!n.isPropagationStopped();f++)l=m[f][0],n.type=m[f][1],d=(v._data(l,"events")||{})[n.type]&&v._data(l,"handle"),d&&d.apply(l,r),d=h&&l[h],d&&v.acceptData(l)&&d.apply&&d.apply(l,r)===!1&&n.preventDefault();return n.type=y,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(y!=="click"||!v.nodeName(s,"a"))&&v.acceptData(s)&&h&&s[y]&&(y!=="focus"&&y!=="blur"||n.target.offsetWidth!==0)&&!v.isWindow(s)&&(c=s[h],c&&(s[h]=null),v.event.triggered=y,s[y](),v.event.triggered=t,c&&(s[h]=c)),n.result}return},dispatch:function(n){n=v.event.fix(n||e.event);var r,i,s,o,u,a,f,c,h,p,d=(v._data(this,"events")||{})[n.type]||[],m=d.delegateCount,g=l.call(arguments),y=!n.exclusive&&!n.namespace,b=v.event.special[n.type]||{},w=[];g[0]=n,n.delegateTarget=this;if(b.preDispatch&&b.preDispatch.call(this,n)===!1)return;if(m&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<m;r++)c=d[r],h=c.selector,u[h]===t&&(u[h]=c.needsContext?v(h,this).index(s)>=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r<w.length&&!n.isPropagationStopped();r++){a=w[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){c=a.matches[i];if(y||!n.namespace&&!c.namespace||n.namespace_re&&n.namespace_re.test(c.namespace))n.data=c.data,n.handleObj=c,o=((v.event.special[c.origType]||{}).handle||c.handler).apply(a.elem,g),o!==t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return b.postDispatch&&b.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[v.expando])return e;var t,n,r=e,s=v.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=v.Event(r);for(t=o.length;t;)n=o[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){v.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=v.extend(new v.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?v.event.trigger(i,null,t):v.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},v.event.handle=v.event.dispatch,v.removeEvent=i.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?tt:et):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||v.now(),this[v.expando]=!0},v.Event.prototype={preventDefault:function(){this.isDefaultPrevented=tt;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=tt;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tt,this.stopPropagation()},isDefaultPrevented:et,isPropagationStopped:et,isImmediatePropagationStopped:et},v.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==r&&!v.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),v.support.submitBubbles||(v.event.special.submit={setup:function(){if(v.nodeName(this,"form"))return!1;v.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=v.nodeName(n,"input")||v.nodeName(n,"button")?n.form:t;r&&!v._data(r,"_submit_attached")&&(v.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),v._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&v.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(v.nodeName(this,"form"))return!1;v.event.remove(this,"._submit")}}),v.support.changeBubbles||(v.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")v.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),v.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),v.event.simulate("change",this,e,!0)});return!1}v.event.add(this,"beforeactivate._change",function(e){var t=e.target;$.test(t.nodeName)&&!v._data(t,"_change_attached")&&(v.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&v.event.simulate("change",this.parentNode,e,!0)}),v._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return v.event.remove(this,"._change"),!$.test(this.nodeName)}}),v.support.focusinBubbles||v.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){v.event.simulate(t,e.target,v.event.fix(e),!0)};v.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),v.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=et;else if(!i)return this;return s===1&&(o=i,i=function(e){return v().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=v.guid++)),this.each(function(){v.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,v(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=et),this.each(function(){v.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return v(this.context).on(e,this.selector,t,n),this},die:function(e,t){return v(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return v.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||v.guid++,r=0,i=function(n){var i=(v._data(this,"lastToggle"+e.guid)||0)%r;return v._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),v.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){v.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function ct(e,t,n,r,i,s){return r&&!r[d]&&(r=ct(r)),i&&!i[d]&&(i=ct(i,s)),N(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||dt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?lt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=lt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?T.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a<s;a++)if(n=i.relative[e[a].type])h=[at(ft(h),n)];else{n=i.filter[e[a].type].apply(null,e[a].matches);if(n[d]){r=++a;for(;r<s;r++)if(i.relative[e[r].type])break;return ct(a>1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a<r&&ht(e.slice(a,r)),r<s&&ht(e=e.slice(r)),r<s&&e.join(""))}h.push(n)}return ft(h)}function pt(e,t){var r=t.length>0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r<i;r++)nt(e,t[r],n);return n}function vt(e,t,n,r,s){var o,u,f,l,c,h=ut(e),p=h.length;if(!r&&h.length===1){u=h[0]=h[0].slice(0);if(u.length>2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},N=function(e,t){return e[d]=t==null||t,e},C=function(){var e={},t=[];return N(function(n,r){return t.push(n)>i.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="<a name='"+d+"'></a><div name='"+d+"'></div>",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:st(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:st(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},f=y.compareDocumentPosition?function(e,t){return e===t?(l=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return l=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,u=t.parentNode,a=o;if(o===u)return ot(e,t);if(!o)return-1;if(!u)return 1;while(a)i.unshift(a),a=a.parentNode;a=u;while(a)s.unshift(a),a=a.parentNode;n=i.length,r=s.length;for(var f=0;f<n&&f<r;f++)if(i[f]!==s[f])return ot(i[f],s[f]);return f===n?ot(e,s[f],-1):ot(i[f],t,1)},[0,0].sort(f),h=!l,nt.uniqueSort=function(e){var t,n=[],r=1,i=0;l=h,e.sort(f);if(l){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e},nt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},a=nt.compile=function(e,t){var n,r=[],i=[],s=A[d][e+" "];if(!s){t||(t=ut(e)),n=t.length;while(n--)s=ht(t[n]),s[d]?r.push(s):i.push(s);s=A(e,pt(i,r))}return s},g.querySelectorAll&&function(){var e,t=vt,n=/'|\\/g,r=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],s=[":active"],u=y.matchesSelector||y.mozMatchesSelector||y.webkitMatchesSelector||y.oMatchesSelector||y.msMatchesSelector;K(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(v.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,v.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=v(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(v.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1),"not",e)},filter:function(e){return this.pushStack(ft(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?st.test(e)?v(e,this.context).index(this[0])>=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/<tbody/i,gt=/<|&#?\w+;/,yt=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,wt=new RegExp("<(?:"+ct+")[\\s/>]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Nt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X<div>","</div>"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return ut(this[0])?this.length?this.pushStack(v(v.isFunction(e)?e():e),"replaceWith",e):this:v.isFunction(e)?this.each(function(t){var n=v(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=v(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;v(this).remove(),t?v(t).before(e):v(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o,u,a=0,f=e[0],l=[],c=this.length;if(!v.support.checkClone&&c>1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a<c;a++)r.call(n&&v.nodeName(this[a],"table")?Lt(this[a],"tbody"):this[a],a===u?o:v.clone(o,!0,!0))}o=s=null,l.length&&v.each(l,function(e,t){t.src?v.ajax?v.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):v.error("no ajax"):v.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Tt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),v.buildFragment=function(e,n,r){var s,o,u,a=e[0];return n=n||i,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof a=="string"&&a.length<512&&n===i&&a.charAt(0)==="<"&&!bt.test(a)&&(v.support.checkClone||!St.test(a))&&(v.support.html5Clone||!wt.test(a))&&(o=!0,s=v.fragments[a],u=s!==t),s||(s=n.createDocumentFragment(),v.clean(e,n,s,r),o&&(v.fragments[a]=u&&s)),{fragment:s,cacheable:o}},v.fragments={},v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(n){var r,i=0,s=[],o=v(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1></$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]==="<table>"&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("<div>").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,n=v.timers,r=0;qn=v.now();for(;r<n.length;r++)e=n[r],!e()&&n[r]===e&&n.splice(r--,1);n.length||v.fx.stop(),qn=t},v.fx.timer=function(e){e()&&v.timers.push(e)&&!Rn&&(Rn=setInterval(v.fx.tick,v.fx.interval))},v.fx.interval=13,v.fx.stop=function(){clearInterval(Rn),Rn=null},v.fx.speeds={slow:600,fast:200,_default:400},v.fx.step={},v.expr&&v.expr.filters&&(v.expr.filters.animated=function(e){return v.grep(v.timers,function(t){return e===t.elem}).length});var er=/^(?:body|html)$/i;v.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){v.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f={top:0,left:0},l=this[0],c=l&&l.ownerDocument;if(!c)return;return(r=c.body)===l?v.offset.bodyOffset(l):(n=c.documentElement,v.contains(n,l)?(typeof l.getBoundingClientRect!="undefined"&&(f=l.getBoundingClientRect()),i=tr(c),s=n.clientTop||r.clientTop||0,o=n.clientLeft||r.clientLeft||0,u=i.pageYOffset||n.scrollTop,a=i.pageXOffset||n.scrollLeft,{top:f.top+u-s,left:f.left+a-o}):f)},v.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return v.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(v.css(e,"marginTop"))||0,n+=parseFloat(v.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=v.css(e,"position");r==="static"&&(e.style.position="relative");var i=v(e),s=i.offset(),o=v.css(e,"top"),u=v.css(e,"left"),a=(r==="absolute"||r==="fixed")&&v.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window);
3
+
4
+ jQuery.noConflict();
js/levementum/levcore/jquery-ui-1.10.0.custom.min.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.10.0 - 2013-02-04
2
+ * http://jqueryui.com
3
+ * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js
4
+ * Copyright (c) 2013 jQuery Foundation and other contributors Licensed MIT */
5
+
6
+ (function(e,t){function i(t,n){var r,i,o,u=t.nodeName.toLowerCase();return"area"===u?(r=t.parentNode,i=r.name,!t.href||!i||r.nodeName.toLowerCase()!=="map"?!1:(o=e("img[usemap=#"+i+"]")[0],!!o&&s(o))):(/input|select|textarea|button|object/.test(u)?!t.disabled:"a"===u?t.href||n:n)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return e.css(this,"visibility")==="hidden"}).length}var n=0,r=/^ui-id-\d+$/;e.ui=e.ui||{};if(e.ui.version)return;e.extend(e.ui,{version:"1.10.0",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({_focus:e.fn.focus,focus:function(t,n){return typeof t=="number"?this.each(function(){var r=this;setTimeout(function(){e(r).focus(),n&&n.call(r)},t)}):this._focus.apply(this,arguments)},scrollParent:function(){var t;return e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?t=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):t=this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css("zIndex",n);if(this.length){var r=e(this[0]),i,s;while(r.length&&r[0]!==document){i=r.css("position");if(i==="absolute"||i==="relative"||i==="fixed"){s=parseInt(r.css("zIndex"),10);if(!isNaN(s)&&s!==0)return s}r=r.parent()}}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++n)})},removeUniqueId:function(){return this.each(function(){r.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),r=isNaN(n);return(r||n>=0)&&i(t,!r)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(n,r){function u(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.css(t,"padding"+this))||0,r&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var i=r==="Width"?["Left","Right"]:["Top","Bottom"],s=r.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+r]=function(n){return n===t?o["inner"+r].call(this):this.each(function(){e(this).css(s,u(this,n)+"px")})},e.fn["outer"+r]=function(t,n){return typeof t!="number"?o["outer"+r].call(this,t):this.each(function(){e(this).css(s,u(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(n){return arguments.length?t.call(this,e.camelCase(n)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n){var r,i=e.plugins[t];if(!i||!e.element[0].parentNode||e.element[0].parentNode.nodeType===11)return;for(r=0;r<i.length;r++)e.options[i[r][0]]&&i[r][1].apply(e.element,n)}},hasScroll:function(t,n){if(e(t).css("overflow")==="hidden")return!1;var r=n&&n==="left"?"scrollLeft":"scrollTop",i=!1;return t[r]>0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)}})})(jQuery);(function(e,t){var n=0,r=Array.prototype.slice,i=e.cleanData;e.cleanData=function(t){for(var n=0,r;(r=t[n])!=null;n++)try{e(r).triggerHandler("remove")}catch(s){}i(t)},e.widget=function(t,n,r){var i,s,o,u,a={},f=t.split(".")[0];t=t.split(".")[1],i=f+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][i.toLowerCase()]=function(t){return!!e.data(t,i)},e[f]=e[f]||{},s=e[f][t],o=e[f][t]=function(e,t){if(!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)},e.extend(o,s,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),u=new n,u.options=e.widget.extend({},u.options),e.each(r,function(t,r){if(!e.isFunction(r)){a[t]=r;return}a[t]=function(){var e=function(){return n.prototype[t].apply(this,arguments)},i=function(e){return n.prototype[t].apply(this,e)};return function(){var t=this._super,n=this._superApply,s;return this._super=e,this._superApply=i,s=r.apply(this,arguments),this._super=t,this._superApply=n,s}}()}),o.prototype=e.widget.extend(u,{widgetEventPrefix:s?u.widgetEventPrefix:t},a,{constructor:o,namespace:f,widgetName:t,widgetFullName:i}),s?(e.each(s._childConstructors,function(t,n){var r=n.prototype;e.widget(r.namespace+"."+r.widgetName,o,n._proto)}),delete s._childConstructors):n._childConstructors.push(o),e.widget.bridge(t,o)},e.widget.extend=function(n){var i=r.call(arguments,1),s=0,o=i.length,u,a;for(;s<o;s++)for(u in i[s])a=i[s][u],i[s].hasOwnProperty(u)&&a!==t&&(e.isPlainObject(a)?n[u]=e.isPlainObject(n[u])?e.widget.extend({},n[u],a):e.widget.extend({},a):n[u]=a);return n},e.widget.bridge=function(n,i){var s=i.prototype.widgetFullName||n;e.fn[n]=function(o){var u=typeof o=="string",a=r.call(arguments,1),f=this;return o=!u&&a.length?e.widget.extend.apply(null,[o].concat(a)):o,u?this.each(function(){var r,i=e.data(this,s);if(!i)return e.error("cannot call methods on "+n+" prior to initialization; "+"attempted to call method '"+o+"'");if(!e.isFunction(i[o])||o.charAt(0)==="_")return e.error("no such method '"+o+"' for "+n+" widget instance");r=i[o].apply(i,a);if(r!==i&&r!==t)return f=r&&r.jquery?f.pushStack(r.get()):r,!1}):this.each(function(){var t=e.data(this,s);t?t.option(o||{})._init():e.data(this,s,new i(o,this))}),f}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,r){r=e(r||this.defaultElement||this)[0],this.element=e(r),this.uuid=n++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),r!==this&&(e.data(r,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===r&&this.destroy()}}),this.document=e(r.style?r.ownerDocument:r.document||r),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(n,r){var i=n,s,o,u;if(arguments.length===0)return e.widget.extend({},this.options);if(typeof n=="string"){i={},s=n.split("."),n=s.shift();if(s.length){o=i[n]=e.widget.extend({},this.options[n]);for(u=0;u<s.length-1;u++)o[s[u]]=o[s[u]]||{},o=o[s[u]];n=s.pop();if(r===t)return o[n]===t?null:o[n];o[n]=r}else{if(r===t)return this.options[n]===t?null:this.options[n];i[n]=r}}return this._setOptions(i),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,e==="disabled"&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(t,n,r){var i,s=this;typeof t!="boolean"&&(r=n,n=t,t=!1),r?(n=i=e(n),this.bindings=this.bindings.add(n)):(r=n,n=this.element,i=this.widget()),e.each(r,function(r,o){function u(){if(!t&&(s.options.disabled===!0||e(this).hasClass("ui-state-disabled")))return;return(typeof o=="string"?s[o]:o).apply(s,arguments)}typeof o!="string"&&(u.guid=o.guid=o.guid||u.guid||e.guid++);var a=r.match(/^(\w+)\s*(.*)$/),f=a[1]+s.eventNamespace,l=a[2];l?i.delegate(l,f,u):n.bind(f,u)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function n(){return(typeof e=="string"?r[e]:e).apply(r,arguments)}var r=this;return setTimeout(n,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,n,r){var i,s,o=this.options[t];r=r||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],s=n.originalEvent;if(s)for(i in s)i in n||(n[i]=s[i]);return this.element.trigger(n,r),!(e.isFunction(o)&&o.apply(this.element[0],[n].concat(r))===!1||n.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,n){e.Widget.prototype["_"+t]=function(r,i,s){typeof i=="string"&&(i={effect:i});var o,u=i?i===!0||typeof i=="number"?n:i.effect||n:t;i=i||{},typeof i=="number"&&(i={duration:i}),o=!e.isEmptyObject(i),i.complete=s,i.delay&&r.delay(i.delay),o&&e.effects&&e.effects.effect[u]?r[t](i):u!==t&&r[u]?r[u](i.duration,i.easing,s):r.queue(function(n){e(this)[t](),s&&s.call(r[0]),n()})}})})(jQuery);(function(e,t){var n=!1;e(document).mouseup(function(){n=!1}),e.widget("ui.mouse",{version:"1.10.0",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(n){if(!0===e.data(n.target,t.widgetName+".preventClickEvent"))return e.removeData(n.target,t.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(n)return;this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var r=this,i=t.which===1,s=typeof this.options.cancel=="string"&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;if(!i||s||!this._mouseCapture(t))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){r.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)){this._mouseStarted=this._mouseStart(t)!==!1;if(!this._mouseStarted)return t.preventDefault(),!0}return!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return r._mouseMove(e)},this._mouseUpDelegate=function(e){return r._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),n=!0,!0},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||document.documentMode<9)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);(function(e,t){function h(e,t,n){return[parseInt(e[0],10)*(l.test(e[0])?t/100:1),parseInt(e[1],10)*(l.test(e[1])?n/100:1)]}function p(t,n){return parseInt(e.css(t,n),10)||0}function d(t){var n=t[0];return n.nodeType===9?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(n)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:n.preventDefault?{width:0,height:0,offset:{top:n.pageY,left:n.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,r=Math.max,i=Math.abs,s=Math.round,o=/left|center|right/,u=/top|center|bottom/,a=/[\+\-]\d+%?/,f=/^\w+/,l=/%$/,c=e.fn.position;e.position={scrollbarWidth:function(){if(n!==t)return n;var r,i,s=e("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return e("body").append(s),r=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,r===i&&(i=s[0].clientWidth),s.remove(),n=r-i},getScrollInfo:function(t){var n=t.isWindow?"":t.element.css("overflow-x"),r=t.isWindow?"":t.element.css("overflow-y"),i=n==="scroll"||n==="auto"&&t.width<t.element[0].scrollWidth,s=r==="scroll"||r==="auto"&&t.height<t.element[0].scrollHeight;return{width:i?e.position.scrollbarWidth():0,height:s?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var n=e(t||window),r=e.isWindow(n[0]);return{element:n,isWindow:r,offset:n.offset()||{left:0,top:0},scrollLeft:n.scrollLeft(),scrollTop:n.scrollTop(),width:r?n.width():n.outerWidth(),height:r?n.height():n.outerHeight()}}},e.fn.position=function(t){if(!t||!t.of)return c.apply(this,arguments);t=e.extend({},t);var n,l,v,m,g,y,b=e(t.of),w=e.position.getWithinInfo(t.within),E=e.position.getScrollInfo(w),S=(t.collision||"flip").split(" "),x={};return y=d(b),b[0].preventDefault&&(t.at="left top"),l=y.width,v=y.height,m=y.offset,g=e.extend({},m),e.each(["my","at"],function(){var e=(t[this]||"").split(" "),n,r;e.length===1&&(e=o.test(e[0])?e.concat(["center"]):u.test(e[0])?["center"].concat(e):["center","center"]),e[0]=o.test(e[0])?e[0]:"center",e[1]=u.test(e[1])?e[1]:"center",n=a.exec(e[0]),r=a.exec(e[1]),x[this]=[n?n[0]:0,r?r[0]:0],t[this]=[f.exec(e[0])[0],f.exec(e[1])[0]]}),S.length===1&&(S[1]=S[0]),t.at[0]==="right"?g.left+=l:t.at[0]==="center"&&(g.left+=l/2),t.at[1]==="bottom"?g.top+=v:t.at[1]==="center"&&(g.top+=v/2),n=h(x.at,l,v),g.left+=n[0],g.top+=n[1],this.each(function(){var o,u,a=e(this),f=a.outerWidth(),c=a.outerHeight(),d=p(this,"marginLeft"),y=p(this,"marginTop"),T=f+d+p(this,"marginRight")+E.width,N=c+y+p(this,"marginBottom")+E.height,C=e.extend({},g),k=h(x.my,a.outerWidth(),a.outerHeight());t.my[0]==="right"?C.left-=f:t.my[0]==="center"&&(C.left-=f/2),t.my[1]==="bottom"?C.top-=c:t.my[1]==="center"&&(C.top-=c/2),C.left+=k[0],C.top+=k[1],e.support.offsetFractions||(C.left=s(C.left),C.top=s(C.top)),o={marginLeft:d,marginTop:y},e.each(["left","top"],function(r,i){e.ui.position[S[r]]&&e.ui.position[S[r]][i](C,{targetWidth:l,targetHeight:v,elemWidth:f,elemHeight:c,collisionPosition:o,collisionWidth:T,collisionHeight:N,offset:[n[0]+k[0],n[1]+k[1]],my:t.my,at:t.at,within:w,elem:a})}),t.using&&(u=function(e){var n=m.left-C.left,s=n+l-f,o=m.top-C.top,u=o+v-c,h={target:{element:b,left:m.left,top:m.top,width:l,height:v},element:{element:a,left:C.left,top:C.top,width:f,height:c},horizontal:s<0?"left":n>0?"right":"center",vertical:u<0?"top":o>0?"bottom":"middle"};l<f&&i(n+s)<l&&(h.horizontal="center"),v<c&&i(o+u)<v&&(h.vertical="middle"),r(i(n),i(s))>r(i(o),i(u))?h.important="horizontal":h.important="vertical",t.using.call(this,e,h)}),a.offset(e.extend(C,{using:u}))})},e.ui.position={fit:{left:function(e,t){var n=t.within,i=n.isWindow?n.scrollLeft:n.offset.left,s=n.width,o=e.left-t.collisionPosition.marginLeft,u=i-o,a=o+t.collisionWidth-s-i,f;t.collisionWidth>s?u>0&&a<=0?(f=e.left+u+t.collisionWidth-s-i,e.left+=u-f):a>0&&u<=0?e.left=i:u>a?e.left=i+s-t.collisionWidth:e.left=i:u>0?e.left+=u:a>0?e.left-=a:e.left=r(e.left-o,e.left)},top:function(e,t){var n=t.within,i=n.isWindow?n.scrollTop:n.offset.top,s=t.within.height,o=e.top-t.collisionPosition.marginTop,u=i-o,a=o+t.collisionHeight-s-i,f;t.collisionHeight>s?u>0&&a<=0?(f=e.top+u+t.collisionHeight-s-i,e.top+=u-f):a>0&&u<=0?e.top=i:u>a?e.top=i+s-t.collisionHeight:e.top=i:u>0?e.top+=u:a>0?e.top-=a:e.top=r(e.top-o,e.top)}},flip:{left:function(e,t){var n=t.within,r=n.offset.left+n.scrollLeft,s=n.width,o=n.isWindow?n.scrollLeft:n.offset.left,u=e.left-t.collisionPosition.marginLeft,a=u-o,f=u+t.collisionWidth-s-o,l=t.my[0]==="left"?-t.elemWidth:t.my[0]==="right"?t.elemWidth:0,c=t.at[0]==="left"?t.targetWidth:t.at[0]==="right"?-t.targetWidth:0,h=-2*t.offset[0],p,d;if(a<0){p=e.left+l+c+h+t.collisionWidth-s-r;if(p<0||p<i(a))e.left+=l+c+h}else if(f>0){d=e.left-t.collisionPosition.marginLeft+l+c+h-o;if(d>0||i(d)<f)e.left+=l+c+h}},top:function(e,t){var n=t.within,r=n.offset.top+n.scrollTop,s=n.height,o=n.isWindow?n.scrollTop:n.offset.top,u=e.top-t.collisionPosition.marginTop,a=u-o,f=u+t.collisionHeight-s-o,l=t.my[1]==="top",c=l?-t.elemHeight:t.my[1]==="bottom"?t.elemHeight:0,h=t.at[1]==="top"?t.targetHeight:t.at[1]==="bottom"?-t.targetHeight:0,p=-2*t.offset[1],d,v;a<0?(v=e.top+c+h+p+t.collisionHeight-s-r,e.top+c+h+p>a&&(v<0||v<i(a))&&(e.top+=c+h+p)):f>0&&(d=e.top-t.collisionPosition.marginTop+c+h+p-o,e.top+c+h+p>f&&(d>0||i(d)<f)&&(e.top+=c+h+p))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,n,r,i,s,o=document.getElementsByTagName("body")[0],u=document.createElement("div");t=document.createElement(o?"div":"body"),r={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&e.extend(r,{position:"absolute",left:"-1000px",top:"-1000px"});for(s in r)t.style[s]=r[s];t.appendChild(u),n=o||document.documentElement,n.insertBefore(t,n.firstChild),u.style.cssText="position: absolute; left: 10.7432222px;",i=e(u).offset().left,e.support.offsetFractions=i>10&&i<11,t.innerHTML="",n.removeChild(t)}()})(jQuery);(function(e,t){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.0",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){this.options.helper==="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(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var n=this.options;return this.helper||n.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(n.iframeFix===!0?"iframe":n.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var n=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.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-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),n.containment&&this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,n){this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute");if(!n){var r=this._uiHash();if(this._trigger("drag",t,r)===!1)return this._mouseUp({}),!1;this.position=r.position}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";return e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var n,r=this,i=!1,s=!1;e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),n=this.element[0];while(n&&(n=n.parentNode))n===document&&(i=!0);return!i&&this.options.helper==="original"?!1:(this.options.revert==="invalid"&&!s||this.options.revert==="valid"&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){r._trigger("stop",t)!==!1&&r._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1)},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){var n=!this.options.handle||!e(this.options.handle,this.element).length?!0:!1;return e(this.options.handle,this.element).find("*").addBack().each(function(){this===t.target&&(n=!0)}),n},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t])):n.helper==="clone"?this.element.clone().removeAttr("id"):this.element;return r.parents("body").length||r.appendTo(n.appendTo==="parent"?this.element[0].parentNode:n.appendTo),r[0]!==this.element[0]&&!/(fixed|absolute)/.test(r.css("position"))&&r.css("position","absolute"),r},_adjustOffsetFromHelper:function(t){typeof t=="string"&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();this.cssPosition==="absolute"&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==="html"&&e.ui.ie)t={top:0,left:0};return{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition==="relative"){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}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(),height:this.helper.outerHeight()}},_setContainment:function(){var t,n,r,i=this.options;i.containment==="parent"&&(i.containment=this.helper[0].parentNode);if(i.containment==="document"||i.containment==="window")this.containment=[i.containment==="document"?0:e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,i.containment==="document"?0:e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(i.containment==="document"?0:e(window).scrollLeft())+e(i.containment==="document"?document:window).width()-this.helperProportions.width-this.margins.left,(i.containment==="document"?0:e(window).scrollTop())+(e(i.containment==="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(i.containment)&&i.containment.constructor!==Array){n=e(i.containment),r=n[0];if(!r)return;t=e(r).css("overflow")!=="hidden",this.containment=[(parseInt(e(r).css("borderLeftWidth"),10)||0)+(parseInt(e(r).css("paddingLeft"),10)||0),(parseInt(e(r).css("borderTopWidth"),10)||0)+(parseInt(e(r).css("paddingTop"),10)||0),(t?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(e(r).css("borderLeftWidth"),10)||0)-(parseInt(e(r).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(e(r).css("borderTopWidth"),10)||0)-(parseInt(e(r).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=n}else i.containment.constructor===Array&&(this.containment=i.containment)},_convertPositionTo:function(t,n){n||(n=this.position);var r=t==="absolute"?1:-1,i=this.cssPosition!=="absolute"||this.scrollParent[0]!==document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,s=/(html|body)/i.test(i[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():s?0:i.scrollTop())*r,left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():s?0:i.scrollLeft())*r}},_generatePosition:function(t){var n,r,i,s,o=this.options,u=this.cssPosition!=="absolute"||this.scrollParent[0]!==document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(u[0].tagName),f=t.pageX,l=t.pageY;return this.originalPosition&&(this.containment&&(this.relative_container?(r=this.relative_container.offset(),n=[this.containment[0]+r.left,this.containment[1]+r.top,this.containment[2]+r.left,this.containment[3]+r.top]):n=this.containment,t.pageX-this.offset.click.left<n[0]&&(f=n[0]+this.offset.click.left),t.pageY-this.offset.click.top<n[1]&&(l=n[1]+this.offset.click.top),t.pageX-this.offset.click.left>n[2]&&(f=n[2]+this.offset.click.left),t.pageY-this.offset.click.top>n[3]&&(l=n[3]+this.offset.click.top)),o.grid&&(i=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=n?i-this.offset.click.top>=n[1]||i-this.offset.click.top>n[3]?i:i-this.offset.click.top>=n[1]?i-o.grid[1]:i+o.grid[1]:i,s=o.grid[0]?this.originalPageX+Math.round((f-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,f=n?s-this.offset.click.left>=n[0]||s-this.offset.click.left>n[2]?s:s-this.offset.click.left>=n[0]?s-o.grid[0]:s+o.grid[0]:s)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():a?0:u.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():a?0:u.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=!1},_trigger:function(t,n,r){return r=r||this._uiHash(),e.ui.plugin.call(this,t,[n,r]),t==="drag"&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,n,r)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,n){var r=e(this).data("ui-draggable"),i=r.options,s=e.extend({},n,{item:r.element});r.sortables=[],e(i.connectToSortable).each(function(){var n=e.data(this,"ui-sortable");n&&!n.options.disabled&&(r.sortables.push({instance:n,shouldRevert:n.options.revert}),n.refreshPositions(),n._trigger("activate",t,s))})},stop:function(t,n){var r=e(this).data("ui-draggable"),i=e.extend({},n,{item:r.element});e.each(r.sortables,function(){this.instance.isOver?(this.instance.isOver=0,r.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,r.options.helper==="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,i))})},drag:function(t,n){var r=e(this).data("ui-draggable"),i=this;e.each(r.sortables,function(){var s=!1,o=this;this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(s=!0,e.each(r.sortables,function(){return this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this!==o&&this.instance._intersectsWith(this.instance.containerCache)&&e.ui.contains(o.instance.element[0],this.instance.element[0])&&(s=!1),s})),s?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(i).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return n.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=r.offset.click.top,this.instance.offset.click.left=r.offset.click.left,this.instance.offset.parent.left-=r.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=r.offset.parent.top-this.instance.offset.parent.top,r._trigger("toSortable",t),r.dropped=this.instance.element,r.currentItem=r.element,this.instance.fromOutside=r),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),r._trigger("fromSortable",t),r.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),n=e(this).data("ui-draggable").options;t.css("cursor")&&(n._cursor=t.css("cursor")),t.css("cursor",n.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,n){var r=e(n.helper),i=e(this).data("ui-draggable").options;r.css("opacity")&&(i._opacity=r.css("opacity")),r.css("opacity",i.opacity)},stop:function(t,n){var r=e(this).data("ui-draggable").options;r._opacity&&e(n.helper).css("opacity",r._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&t.scrollParent[0].tagName!=="HTML"&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var n=e(this).data("ui-draggable"),r=n.options,i=!1;if(n.scrollParent[0]!==document&&n.scrollParent[0].tagName!=="HTML"){if(!r.axis||r.axis!=="x")n.overflowOffset.top+n.scrollParent[0].offsetHeight-t.pageY<r.scrollSensitivity?n.scrollParent[0].scrollTop=i=n.scrollParent[0].scrollTop+r.scrollSpeed:t.pageY-n.overflowOffset.top<r.scrollSensitivity&&(n.scrollParent[0].scrollTop=i=n.scrollParent[0].scrollTop-r.scrollSpeed);if(!r.axis||r.axis!=="y")n.overflowOffset.left+n.scrollParent[0].offsetWidth-t.pageX<r.scrollSensitivity?n.scrollParent[0].scrollLeft=i=n.scrollParent[0].scrollLeft+r.scrollSpeed:t.pageX-n.overflowOffset.left<r.scrollSensitivity&&(n.scrollParent[0].scrollLeft=i=n.scrollParent[0].scrollLeft-r.scrollSpeed)}else{if(!r.axis||r.axis!=="x")t.pageY-e(document).scrollTop()<r.scrollSensitivity?i=e(document).scrollTop(e(document).scrollTop()-r.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<r.scrollSensitivity&&(i=e(document).scrollTop(e(document).scrollTop()+r.scrollSpeed));if(!r.axis||r.axis!=="y")t.pageX-e(document).scrollLeft()<r.scrollSensitivity?i=e(document).scrollLeft(e(document).scrollLeft()-r.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<r.scrollSensitivity&&(i=e(document).scrollLeft(e(document).scrollLeft()+r.scrollSpeed))}i!==!1&&e.ui.ddmanager&&!r.dropBehaviour&&e.ui.ddmanager.prepareOffsets(n,t)}}),e.ui.plugin.add("draggable","snap",{start:function(){var t=e(this).data("ui-draggable"),n=t.options;t.snapElements=[],e(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var n=e(this),r=n.offset();this!==t.element[0]&&t.snapElements.push({item:this,width:n.outerWidth(),height:n.outerHeight(),top:r.top,left:r.left})})},drag:function(t,n){var r,i,s,o,u,a,f,l,c,h,p=e(this).data("ui-draggable"),d=p.options,v=d.snapTolerance,m=n.offset.left,g=m+p.helperProportions.width,y=n.offset.top,b=y+p.helperProportions.height;for(c=p.snapElements.length-1;c>=0;c--){u=p.snapElements[c].left,a=u+p.snapElements[c].width,f=p.snapElements[c].top,l=f+p.snapElements[c].height;if(!(u-v<m&&m<a+v&&f-v<y&&y<l+v||u-v<m&&m<a+v&&f-v<b&&b<l+v||u-v<g&&g<a+v&&f-v<y&&y<l+v||u-v<g&&g<a+v&&f-v<b&&b<l+v)){p.snapElements[c].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=!1;continue}d.snapMode!=="inner"&&(r=Math.abs(f-b)<=v,i=Math.abs(l-y)<=v,s=Math.abs(u-g)<=v,o=Math.abs(a-m)<=v,r&&(n.position.top=p._convertPositionTo("relative",{top:f-p.helperProportions.height,left:0}).top-p.margins.top),i&&(n.position.top=p._convertPositionTo("relative",{top:l,left:0}).top-p.margins.top),s&&(n.position.left=p._convertPositionTo("relative",{top:0,left:u-p.helperProportions.width}).left-p.margins.left),o&&(n.position.left=p._convertPositionTo("relative",{top:0,left:a}).left-p.margins.left)),h=r||i||s||o,d.snapMode!=="outer"&&(r=Math.abs(f-y)<=v,i=Math.abs(l-b)<=v,s=Math.abs(u-m)<=v,o=Math.abs(a-g)<=v,r&&(n.position.top=p._convertPositionTo("relative",{top:f,left:0}).top-p.margins.top),i&&(n.position.top=p._convertPositionTo("relative",{top:l-p.helperProportions.height,left:0}).top-p.margins.top),s&&(n.position.left=p._convertPositionTo("relative",{top:0,left:u}).left-p.margins.left),o&&(n.position.left=p._convertPositionTo("relative",{top:0,left:a-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[c].snapping&&(r||i||s||o||h)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=r||i||s||o||h}}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,n=e(this).data("ui-draggable").options,r=e.makeArray(e(n.stack)).sort(function(t,n){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(n).css("zIndex"),10)||0)});if(!r.length)return;t=parseInt(r[0].style.zIndex,10)||0,e(r).each(function(e){this.style.zIndex=t+e}),this[0].style.zIndex=t+r.length}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,n){var r=e(n.helper),i=e(this).data("ui-draggable").options;r.css("zIndex")&&(i._zIndex=r.css("zIndex")),r.css("zIndex",i.zIndex)},stop:function(t,n){var r=e(this).data("ui-draggable").options;r._zIndex&&e(n.helper).css("zIndex",r._zIndex)}})})(jQuery);(function(e,t){function n(e,t,n){return e>t&&e<t+n}e.widget("ui.droppable",{version:"1.10.0",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t=this.options,n=t.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(n)?n:function(e){return e.is(n)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){var t=0,n=e.ui.ddmanager.droppables[this.options.scope];for(;t<n.length;t++)n[t]===this&&n.splice(t,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,n){t==="accept"&&(this.accept=e.isFunction(n)?n:function(e){return e.is(n)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),n&&this._trigger("activate",t,this.ui(n))},_deactivate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),n&&this._trigger("deactivate",t,this.ui(n))},_over:function(t){var n=e.ui.ddmanager.current;if(!n||(n.currentItem||n.element)[0]===this.element[0])return;this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(n)))},_out:function(t){var n=e.ui.ddmanager.current;if(!n||(n.currentItem||n.element)[0]===this.element[0])return;this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(n)))},_drop:function(t,n){var r=n||e.ui.ddmanager.current,i=!1;return!r||(r.currentItem||r.element)[0]===this.element[0]?!1:(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");if(t.options.greedy&&!t.options.disabled&&t.options.scope===r.options.scope&&t.accept.call(t.element[0],r.currentItem||r.element)&&e.ui.intersect(r,e.extend(t,{offset:t.element.offset()}),t.options.tolerance))return i=!0,!1}),i?!1:this.accept.call(this.element[0],r.currentItem||r.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(r)),this.element):!1)},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(e,t,r){if(!t.offset)return!1;var i,s,o=(e.positionAbs||e.position.absolute).left,u=o+e.helperProportions.width,a=(e.positionAbs||e.position.absolute).top,f=a+e.helperProportions.height,l=t.offset.left,c=l+t.proportions.width,h=t.offset.top,p=h+t.proportions.height;switch(r){case"fit":return l<=o&&u<=c&&h<=a&&f<=p;case"intersect":return l<o+e.helperProportions.width/2&&u-e.helperProportions.width/2<c&&h<a+e.helperProportions.height/2&&f-e.helperProportions.height/2<p;case"pointer":return i=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,s=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,n(s,h,t.proportions.height)&&n(i,l,t.proportions.width);case"touch":return(a>=h&&a<=p||f>=h&&f<=p||a<h&&f>p)&&(o>=l&&o<=c||u>=l&&u<=c||o<l&&u>c);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,n){var r,i,s=e.ui.ddmanager.droppables[t.options.scope]||[],o=n?n.type:null,u=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(r=0;r<s.length;r++){if(s[r].options.disabled||t&&!s[r].accept.call(s[r].element[0],t.currentItem||t.element))continue;for(i=0;i<u.length;i++)if(u[i]===s[r].element[0]){s[r].proportions.height=0;continue e}s[r].visible=s[r].element.css("display")!=="none";if(!s[r].visible)continue;o==="mousedown"&&s[r]._activate.call(s[r],n),s[r].offset=s[r].element.offset(),s[r].proportions={width:s[r].element[0].offsetWidth,height:s[r].element[0].offsetHeight}}},drop:function(t,n){var r=!1;return e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options)return;!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(r=this._drop.call(this,n)||r),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,n))}),r},dragStart:function(t,n){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)})},drag:function(t,n){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,n),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible)return;var r,i,s,o=e.ui.intersect(t,this,this.options.tolerance),u=!o&&this.isover?"isout":o&&!this.isover?"isover":null;if(!u)return;this.options.greedy&&(i=this.options.scope,s=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===i}),s.length&&(r=e.data(s[0],"ui-droppable"),r.greedyChild=u==="isover")),r&&u==="isover"&&(r.isover=!1,r.isout=!0,r._out.call(r,n)),this[u]=!0,this[u==="isout"?"isover":"isout"]=!1,this[u==="isover"?"_over":"_out"].call(this,n),r&&u==="isout"&&(r.isout=!1,r.isover=!0,r._over.call(r,n))})},dragStop:function(t,n){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)}}})(jQuery);(function(e,t){function n(e){return parseInt(e,10)||0}function r(e){return!isNaN(parseInt(e,10))}e.widget("ui.resizable",e.ui.mouse,{version:"1.10.0",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var t,n,r,i,s,o=this,u=this.options;this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!u.aspectRatio,aspectRatio:u.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:u.helper||u.ghost||u.animate?u.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(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(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,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=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=u.handles||(e(".ui-resizable-handle",this.element).length?{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",nw:".ui-resizable-nw"}:"e,s,se");if(this.handles.constructor===String){this.handles==="all"&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={};for(n=0;n<t.length;n++)r=e.trim(t[n]),s="ui-resizable-"+r,i=e("<div class='ui-resizable-handle "+s+"'></div>"),i.css({zIndex:u.zIndex}),"se"===r&&i.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[r]=".ui-resizable-"+r,this.element.append(i)}this._renderAxis=function(t){var n,r,i,s;t=t||this.element;for(n in this.handles){this.handles[n].constructor===String&&(this.handles[n]=e(this.handles[n],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(r=e(this.handles[n],this.element),s=/sw|ne|nw|se|n|s/.test(n)?r.outerHeight():r.outerWidth(),i=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join(""),t.css(i,s),this._proportionallyResize());if(!e(this.handles[n]).length)continue}},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=i&&i[1]?i[1]:"se")}),u.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){if(u.disabled)return;e(this).removeClass("ui-resizable-autohide"),o._handles.show()}).mouseleave(function(){if(u.disabled)return;o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,n=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(n(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),n(this.originalElement),this},_mouseCapture:function(t){var n,r,i=!1;for(n in this.handles){r=e(this.handles[n])[0];if(r===t.target||e.contains(r,t.target))i=!0}return!this.options.disabled&&i},_mouseStart:function(t){var r,i,s,o=this.options,u=this.element.position(),a=this.element;return this.resizing=!0,/absolute/.test(a.css("position"))?a.css({position:"absolute",top:a.css("top"),left:a.css("left")}):a.is(".ui-draggable")&&a.css({position:"absolute",top:u.top,left:u.left}),this._renderProxy(),r=n(this.helper.css("left")),i=n(this.helper.css("top")),o.containment&&(r+=e(o.containment).scrollLeft()||0,i+=e(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:r,top:i},this.size=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.originalPosition={left:r,top:i},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio=typeof o.aspectRatio=="number"?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor",s==="auto"?this.axis+"-resize":s),a.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var n,r=this.helper,i={},s=this.originalMousePosition,o=this.axis,u=this.position.top,a=this.position.left,f=this.size.width,l=this.size.height,c=t.pageX-s.left||0,h=t.pageY-s.top||0,p=this._change[o];if(!p)return!1;n=p.apply(this,[t,c,h]),this._updateVirtualBoundaries(t.shiftKey);if(this._aspectRatio||t.shiftKey)n=this._updateRatio(n,t);return n=this._respectSize(n,t),this._updateCache(n),this._propagate("resize",t),this.position.top!==u&&(i.top=this.position.top+"px"),this.position.left!==a&&(i.left=this.position.left+"px"),this.size.width!==f&&(i.width=this.size.width+"px"),this.size.height!==l&&(i.height=this.size.height+"px"),r.css(i),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(i)||this._trigger("resize",t,this.ui()),!1},_mouseStop:function(t){this.resizing=!1;var n,r,i,s,o,u,a,f=this.options,l=this;return this._helper&&(n=this._proportionallyResizeElements,r=n.length&&/textarea/i.test(n[0].nodeName),i=r&&e.ui.hasScroll(n[0],"left")?0:l.sizeDiff.height,s=r?0:l.sizeDiff.width,o={width:l.helper.width()-s,height:l.helper.height()-i},u=parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left)||null,a=parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top)||null,f.animate||this.element.css(e.extend(o,{top:a,left:u})),l.helper.height(l.size.height),l.helper.width(l.size.width),this._helper&&!f.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t,n,i,s,o,u=this.options;o={minWidth:r(u.minWidth)?u.minWidth:0,maxWidth:r(u.maxWidth)?u.maxWidth:Infinity,minHeight:r(u.minHeight)?u.minHeight:0,maxHeight:r(u.maxHeight)?u.maxHeight:Infinity};if(this._aspectRatio||e)t=o.minHeight*this.aspectRatio,i=o.minWidth/this.aspectRatio,n=o.maxHeight*this.aspectRatio,s=o.maxWidth/this.aspectRatio,t>o.minWidth&&(o.minWidth=t),i>o.minHeight&&(o.minHeight=i),n<o.maxWidth&&(o.maxWidth=n),s<o.maxHeight&&(o.maxHeight=s);this._vBoundaries=o},_updateCache:function(e){this.offset=this.helper.offset(),r(e.left)&&(this.position.left=e.left),r(e.top)&&(this.position.top=e.top),r(e.height)&&(this.size.height=e.height),r(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,n=this.size,i=this.axis;return r(e.height)?e.width=e.height*this.aspectRatio:r(e.width)&&(e.height=e.width/this.aspectRatio),i==="sw"&&(e.left=t.left+(n.width-e.width),e.top=null),i==="nw"&&(e.top=t.top+(n.height-e.height),e.left=t.left+(n.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,n=this.axis,i=r(e.width)&&t.maxWidth&&t.maxWidth<e.width,s=r(e.height)&&t.maxHeight&&t.maxHeight<e.height,o=r(e.width)&&t.minWidth&&t.minWidth>e.width,u=r(e.height)&&t.minHeight&&t.minHeight>e.height,a=this.originalPosition.left+this.originalSize.width,f=this.position.top+this.size.height,l=/sw|nw|w/.test(n),c=/nw|ne|n/.test(n);return o&&(e.width=t.minWidth),u&&(e.height=t.minHeight),i&&(e.width=t.maxWidth),s&&(e.height=t.maxHeight),o&&l&&(e.left=a-t.minWidth),i&&l&&(e.left=a-t.maxWidth),u&&c&&(e.top=f-t.minHeight),s&&c&&(e.top=f-t.maxHeight),!e.width&&!e.height&&!e.left&&e.top?e.top=null:!e.width&&!e.height&&!e.top&&e.left&&(e.left=null),e},_proportionallyResize:function(){if(!this._proportionallyResizeElements.length)return;var e,t,n,r,i,s=this.helper||this.element;for(e=0;e<this._proportionallyResizeElements.length;e++){i=this._proportionallyResizeElements[e];if(!this.borderDif){this.borderDif=[],n=[i.css("borderTopWidth"),i.css("borderRightWidth"),i.css("borderBottomWidth"),i.css("borderLeftWidth")],r=[i.css("paddingTop"),i.css("paddingRight"),i.css("paddingBottom"),i.css("paddingLeft")];for(t=0;t<n.length;t++)this.borderDif[t]=(parseInt(n[t],10)||0)+(parseInt(r[t],10)||0)}i.css({height:s.height()-this.borderDif[0]-this.borderDif[2]||0,width:s.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var t=this.element,n=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++n.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var n=this.originalSize,r=this.originalPosition;return{left:r.left+t,width:n.width-t}},n:function(e,t,n){var r=this.originalSize,i=this.originalPosition;return{top:i.top+n,height:r.height-n}},s:function(e,t,n){return{height:this.originalSize.height+n}},se:function(t,n,r){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,n,r]))},sw:function(t,n,r){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,n,r]))},ne:function(t,n,r){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,n,r]))},nw:function(t,n,r){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,n,r]))}},_propagate:function(t,n){e.ui.plugin.call(this,t,[n,this.ui()]),t!=="resize"&&this._trigger(t,n,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var n=e(this).data("ui-resizable"),r=n.options,i=n._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),o=s&&e.ui.hasScroll(i[0],"left")?0:n.sizeDiff.height,u=s?0:n.sizeDiff.width,a={width:n.size.width-u,height:n.size.height-o},f=parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left)||null,l=parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top)||null;n.element.animate(e.extend(a,l&&f?{top:l,left:f}:{}),{duration:r.animateDuration,easing:r.animateEasing,step:function(){var r={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};i&&i.length&&e(i[0]).css({width:r.width,height:r.height}),n._updateCache(r),n._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,r,i,s,o,u,a,f=e(this).data("ui-resizable"),l=f.options,c=f.element,h=l.containment,p=h instanceof e?h.get(0):/parent/.test(h)?c.parent().get(0):h;if(!p)return;f.containerElement=e(p),/document/.test(h)||h===document?(f.containerOffset={left:0,top:0},f.containerPosition={left:0,top:0},f.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(p),r=[],e(["Top","Right","Left","Bottom"]).each(function(e,i){r[e]=n(t.css("padding"+i))}),f.containerOffset=t.offset(),f.containerPosition=t.position(),f.containerSize={height:t.innerHeight()-r[3],width:t.innerWidth()-r[1]},i=f.containerOffset,s=f.containerSize.height,o=f.containerSize.width,u=e.ui.hasScroll(p,"left")?p.scrollWidth:o,a=e.ui.hasScroll(p)?p.scrollHeight:s,f.parentData={element:p,left:i.left,top:i.top,width:u,height:a})},resize:function(t){var n,r,i,s,o=e(this).data("ui-resizable"),u=o.options,a=o.containerOffset,f=o.position,l=o._aspectRatio||t.shiftKey,c={top:0,left:0},h=o.containerElement;h[0]!==document&&/static/.test(h.css("position"))&&(c=a),f.left<(o._helper?a.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-a.left:o.position.left-c.left),l&&(o.size.height=o.size.width/o.aspectRatio),o.position.left=u.helper?a.left:0),f.top<(o._helper?a.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-a.top:o.position.top),l&&(o.size.width=o.size.height*o.aspectRatio),o.position.top=o._helper?a.top:0),o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top,n=Math.abs((o._helper?o.offset.left-c.left:o.offset.left-c.left)+o.sizeDiff.width),r=Math.abs((o._helper?o.offset.top-c.top:o.offset.top-a.top)+o.sizeDiff.height),i=o.containerElement.get(0)===o.element.parent().get(0),s=/relative|absolute/.test(o.containerElement.css("position")),i&&s&&(n-=o.parentData.left),n+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-n,l&&(o.size.height=o.size.width/o.aspectRatio)),r+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-r,l&&(o.size.width=o.size.height*o.aspectRatio))},stop:function(){var t=e(this).data("ui-resizable"),n=t.options,r=t.containerOffset,i=t.containerPosition,s=t.containerElement,o=e(t.helper),u=o.offset(),a=o.outerWidth()-t.sizeDiff.width,f=o.outerHeight()-t.sizeDiff.height;t._helper&&!n.animate&&/relative/.test(s.css("position"))&&e(this).css({left:u.left-i.left-r.left,width:a,height:f}),t._helper&&!n.animate&&/static/.test(s.css("position"))&&e(this).css({left:u.left-i.left-r.left,width:a,height:f})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).data("ui-resizable"),n=t.options,r=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};typeof n.alsoResize=="object"&&!n.alsoResize.parentNode?n.alsoResize.length?(n.alsoResize=n.alsoResize[0],r(n.alsoResize)):e.each(n.alsoResize,function(e){r(e)}):r(n.alsoResize)},resize:function(t,n){var r=e(this).data("ui-resizable"),i=r.options,s=r.originalSize,o=r.originalPosition,u={height:r.size.height-s.height||0,width:r.size.width-s.width||0,top:r.position.top-o.top||0,left:r.position.left-o.left||0},a=function(t,r){e(t).each(function(){var t=e(this),i=e(this).data("ui-resizable-alsoresize"),s={},o=r&&r.length?r:t.parents(n.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(o,function(e,t){var n=(i[t]||0)+(u[t]||0);n&&n>=0&&(s[t]=n||null)}),t.css(s)})};typeof i.alsoResize=="object"&&!i.alsoResize.nodeType?e.each(i.alsoResize,function(e,t){a(e,t)}):a(i.alsoResize)},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).data("ui-resizable"),n=t.options,r=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:r.height,width:r.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof n.ghost=="string"?n.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).data("ui-resizable");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).data("ui-resizable");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t=e(this).data("ui-resizable"),n=t.options,r=t.size,i=t.originalSize,s=t.originalPosition,o=t.axis,u=typeof n.grid=="number"?[n.grid,n.grid]:n.grid,a=u[0]||1,f=u[1]||1,l=Math.round((r.width-i.width)/a)*a,c=Math.round((r.height-i.height)/f)*f,h=i.width+l,p=i.height+c,d=n.maxWidth&&n.maxWidth<h,v=n.maxHeight&&n.maxHeight<p,m=n.minWidth&&n.minWidth>h,g=n.minHeight&&n.minHeight>p;n.grid=u,m&&(h+=a),g&&(p+=f),d&&(h-=a),v&&(p-=f),/^(se|s|e)$/.test(o)?(t.size.width=h,t.size.height=p):/^(ne)$/.test(o)?(t.size.width=h,t.size.height=p,t.position.top=s.top-c):/^(sw)$/.test(o)?(t.size.width=h,t.size.height=p,t.position.left=s.left-l):(t.size.width=h,t.size.height=p,t.position.top=s.top-c,t.position.left=s.left-l)}})})(jQuery);(function(e,t){e.widget("ui.selectable",e.ui.mouse,{version:"1.10.0",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,n=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(n.options.filter,n.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),n=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:n.left,top:n.top,right:n.left+t.outerWidth(),bottom:n.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.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"),this._mouseDestroy()},_mouseStart:function(t){var n=this,r=this.options;this.opos=[t.pageX,t.pageY];if(this.options.disabled)return;this.selectees=e(r.filter,this.element[0]),this._trigger("start",t),e(r.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),r.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var r=e.data(this,"selectable-item");r.startselected=!0,!t.metaKey&&!t.ctrlKey&&(r.$element.removeClass("ui-selected"),r.selected=!1,r.$element.addClass("ui-unselecting"),r.unselecting=!0,n._trigger("unselecting",t,{unselecting:r.element}))}),e(t.target).parents().addBack().each(function(){var r,i=e.data(this,"selectable-item");if(i)return r=!t.metaKey&&!t.ctrlKey||!i.$element.hasClass("ui-selected"),i.$element.removeClass(r?"ui-unselecting":"ui-selected").addClass(r?"ui-selecting":"ui-unselecting"),i.unselecting=!r,i.selecting=r,i.selected=r,r?n._trigger("selecting",t,{selecting:i.element}):n._trigger("unselecting",t,{unselecting:i.element}),!1})},_mouseDrag:function(t){this.dragged=!0;if(this.options.disabled)return;var n,r=this,i=this.options,s=this.opos[0],o=this.opos[1],u=t.pageX,a=t.pageY;return s>u&&(n=u,u=s,s=n),o>a&&(n=a,a=o,o=n),this.helper.css({left:s,top:o,width:u-s,height:a-o}),this.selectees.each(function(){var n=e.data(this,"selectable-item"),f=!1;if(!n||n.element===r.element[0])return;i.tolerance==="touch"?f=!(n.left>u||n.right<s||n.top>a||n.bottom<o):i.tolerance==="fit"&&(f=n.left>s&&n.right<u&&n.top>o&&n.bottom<a),f?(n.selected&&(n.$element.removeClass("ui-selected"),n.selected=!1),n.unselecting&&(n.$element.removeClass("ui-unselecting"),n.unselecting=!1),n.selecting||(n.$element.addClass("ui-selecting"),n.selecting=!0,r._trigger("selecting",t,{selecting:n.element}))):(n.selecting&&((t.metaKey||t.ctrlKey)&&n.startselected?(n.$element.removeClass("ui-selecting"),n.selecting=!1,n.$element.addClass("ui-selected"),n.selected=!0):(n.$element.removeClass("ui-selecting"),n.selecting=!1,n.startselected&&(n.$element.addClass("ui-unselecting"),n.unselecting=!0),r._trigger("unselecting",t,{unselecting:n.element}))),n.selected&&!t.metaKey&&!t.ctrlKey&&!n.startselected&&(n.$element.removeClass("ui-selected"),n.selected=!1,n.$element.addClass("ui-unselecting"),n.unselecting=!0,r._trigger("unselecting",t,{unselecting:n.element})))}),!1},_mouseStop:function(t){var n=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-unselecting"),r.unselecting=!1,r.startselected=!1,n._trigger("unselected",t,{unselected:r.element})}),e(".ui-selecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-selecting").addClass("ui-selected"),r.selecting=!1,r.selected=!0,r.startselected=!0,n._trigger("selected",t,{selected:r.element})}),this._trigger("stop",t),this.helper.remove(),!1}})})(jQuery);(function(e,t){function n(e,t,n){return e>t&&e<t+n}e.widget("ui.sortable",e.ui.mouse,{version:"1.10.0",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?e.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_setOption:function(t,n){t==="disabled"?(this.options[t]=n,this.widget().toggleClass("ui-sortable-disabled",!!n)):e.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(t,n){var r=null,i=!1,s=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type==="static")return!1;this._refreshItems(t),e(t.target).parents().each(function(){if(e.data(this,s.widgetName+"-item")===s)return r=e(this),!1}),e.data(t.target,s.widgetName+"-item")===s&&(r=e(t.target));if(!r)return!1;if(this.options.handle&&!n){e(this.options.handle,r).find("*").addBack().each(function(){this===t.target&&(i=!0)});if(!i)return!1}return this.currentItem=r,this._removeCurrentsFromItems(),!0},_mouseStart:function(t,n,r){var i,s=this.options;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),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-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,s.cursorAt&&this._adjustOffsetFromHelper(s.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),s.containment&&this._setContainment(),s.cursor&&(e("body").css("cursor")&&(this._storedCursor=e("body").css("cursor")),e("body").css("cursor",s.cursor)),s.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",s.opacity)),s.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",s.zIndex)),this.scrollParent[0]!==document&&this.scrollParent[0].tagName!=="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!r)for(i=this.containers.length-1;i>=0;i--)this.containers[i]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!s.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var n,r,i,s,o=this.options,u=!1;this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&this.scrollParent[0].tagName!=="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=u=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=u=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=u=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=u=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-e(document).scrollTop()<o.scrollSensitivity?u=e(document).scrollTop(e(document).scrollTop()-o.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<o.scrollSensitivity&&(u=e(document).scrollTop(e(document).scrollTop()+o.scrollSpeed)),t.pageX-e(document).scrollLeft()<o.scrollSensitivity?u=e(document).scrollLeft(e(document).scrollLeft()-o.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<o.scrollSensitivity&&(u=e(document).scrollLeft(e(document).scrollLeft()+o.scrollSpeed))),u!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),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(n=this.items.length-1;n>=0;n--){r=this.items[n],i=r.item[0],s=this._intersectsWithPointer(r);if(!s)continue;if(r.instance!==this.currentContainer)continue;if(i!==this.currentItem[0]&&this.placeholder[s===1?"next":"prev"]()[0]!==i&&!e.contains(this.placeholder[0],i)&&(this.options.type==="semi-dynamic"?!e.contains(this.element[0],i):!0)){this.direction=s===1?"down":"up";if(this.options.tolerance!=="pointer"&&!this._intersectsWithSides(r))break;this._rearrange(t,r),this._trigger("change",t,this._uiHash());break}}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,n){if(!t)return;e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t);if(this.options.revert){var r=this,i=this.placeholder.offset();this.reverting=!0,e(this.helper).animate({left:i.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft),top:i.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){r._clear(t)})}else this._clear(t,n);return!1},cancel:function(){if(this.dragging){this._mouseUp({target:null}),this.options.helper==="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return 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(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},e(n).each(function(){var n=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);n&&r.push((t.key||n[1]+"[]")+"="+(t.key&&t.expression?n[1]:n[2]))}),!r.length&&t.key&&r.push(t.key+"="),r.join("&")},toArray:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},n.each(function(){r.push(e(t.item||this).attr(t.attribute||"id")||"")}),r},_intersectsWith:function(e){var t=this.positionAbs.left,n=t+this.helperProportions.width,r=this.positionAbs.top,i=r+this.helperProportions.height,s=e.left,o=s+e.width,u=e.top,a=u+e.height,f=this.offset.click.top,l=this.offset.click.left,c=r+f>u&&r+f<a&&t+l>s&&t+l<o;return this.options.tolerance==="pointer"||this.options.forcePointerForContainers||this.options.tolerance!=="pointer"&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?c:s<t+this.helperProportions.width/2&&n-this.helperProportions.width/2<o&&u<r+this.helperProportions.height/2&&i-this.helperProportions.height/2<a},_intersectsWithPointer:function(e){var t=this.options.axis==="x"||n(this.positionAbs.top+this.offset.click.top,e.top,e.height),r=this.options.axis==="y"||n(this.positionAbs.left+this.offset.click.left,e.left,e.width),i=t&&r,s=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return i?this.floating?o&&o==="right"||s==="down"?2:1:s&&(s==="down"?2:1):!1},_intersectsWithSides:function(e){var t=n(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),r=n(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),i=this._getDragVerticalDirection(),s=this._getDragHorizontalDirection();return this.floating&&s?s==="right"&&r||s==="left"&&!r:i&&(i==="down"&&t||i==="up"&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return e!==0&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return e!==0&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){var n,r,i,s,o=[],u=[],a=this._connectWith();if(a&&t)for(n=a.length-1;n>=0;n--){i=e(a[n]);for(r=i.length-1;r>=0;r--)s=e.data(i[r],this.widgetFullName),s&&s!==this&&!s.options.disabled&&u.push([e.isFunction(s.options.items)?s.options.items.call(s.element):e(s.options.items,s.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),s])}u.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(n=u.length-1;n>=0;n--)u[n][0].each(function(){o.push(this)});return e(o)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var n=0;n<t.length;n++)if(t[n]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var n,r,i,s,o,u,a,f,l=this.items,c=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],h=this._connectWith();if(h&&this.ready)for(n=h.length-1;n>=0;n--){i=e(h[n]);for(r=i.length-1;r>=0;r--)s=e.data(i[r],this.widgetFullName),s&&s!==this&&!s.options.disabled&&(c.push([e.isFunction(s.options.items)?s.options.items.call(s.element[0],t,{item:this.currentItem}):e(s.options.items,s.element),s]),this.containers.push(s))}for(n=c.length-1;n>=0;n--){o=c[n][1],u=c[n][0];for(r=0,f=u.length;r<f;r++)a=e(u[r]),a.data(this.widgetName+"-item",o),l.push({item:a,instance:o,width:0,height:0,left:0,top:0})}},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var n,r,i,s;for(n=this.items.length-1;n>=0;n--){r=this.items[n];if(r.instance!==this.currentContainer&&this.currentContainer&&r.item[0]!==this.currentItem[0])continue;i=this.options.toleranceElement?e(this.options.toleranceElement,r.item):r.item,t||(r.width=i.outerWidth(),r.height=i.outerHeight()),s=i.offset(),r.left=s.left,r.top=s.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(n=this.containers.length-1;n>=0;n--)s=this.containers[n].element.offset(),this.containers[n].containerCache.left=s.left,this.containers[n].containerCache.top=s.top,this.containers[n].containerCache.width=this.containers[n].element.outerWidth(),this.containers[n].containerCache.height=this.containers[n].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var n,r=t.options;if(!r.placeholder||r.placeholder.constructor===String)n=r.placeholder,r.placeholder={element:function(){var r=e(document.createElement(t.currentItem[0].nodeName)).addClass(n||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return n||(r.style.visibility="hidden"),r},update:function(e,i){if(n&&!r.forcePlaceholderSize)return;i.height()||i.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),i.width()||i.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10))}};t.placeholder=e(r.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),r.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var n,r,i,s,o,u,a,f,l,c=null,h=null;for(n=this.containers.length-1;n>=0;n--){if(e.contains(this.currentItem[0],this.containers[n].element[0]))continue;if(this._intersectsWith(this.containers[n].containerCache)){if(c&&e.contains(this.containers[n].element[0],c.element[0]))continue;c=this.containers[n],h=n}else this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",t,this._uiHash(this)),this.containers[n].containerCache.over=0)}if(!c)return;if(this.containers.length===1)this.containers[h]._trigger("over",t,this._uiHash(this)),this.containers[h].containerCache.over=1;else{i=1e4,s=null,o=this.containers[h].floating?"left":"top",u=this.containers[h].floating?"width":"height",a=this.positionAbs[o]+this.offset.click[o];for(r=this.items.length-1;r>=0;r--){if(!e.contains(this.containers[h].element[0],this.items[r].item[0]))continue;if(this.items[r].item[0]===this.currentItem[0])continue;f=this.items[r].item.offset()[o],l=!1,Math.abs(f-a)>Math.abs(f+this.items[r][u]-a)&&(l=!0,f+=this.items[r][u]),Math.abs(f-a)<i&&(i=Math.abs(f-a),s=this.items[r],this.direction=l?"up":"down")}if(!s&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[h],s?this._rearrange(t,s,null,!0):this._rearrange(t,null,this.containers[h].element,!0),this._trigger("change",t,this._uiHash()),this.containers[h]._trigger("change",t,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[h]._trigger("over",t,this._uiHash(this)),this.containers[h].containerCache.over=1}},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t,this.currentItem])):n.helper==="clone"?this.currentItem.clone():this.currentItem;return r.parents("body").length||e(n.appendTo!=="parent"?n.appendTo:this.currentItem[0].parentNode)[0].appendChild(r[0]),r[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")}),(!r[0].style.width||n.forceHelperSize)&&r.width(this.currentItem.width()),(!r[0].style.height||n.forceHelperSize)&&r.height(this.currentItem.height()),r},_adjustOffsetFromHelper:function(t){typeof t=="string"&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();this.cssPosition==="absolute"&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==="html"&&e.ui.ie)t={top:0,left:0};return{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition==="relative"){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),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 t,n,r,i=this.options;i.containment==="parent"&&(i.containment=this.helper[0].parentNode);if(i.containment==="document"||i.containment==="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e(i.containment==="document"?document:window).width()-this.helperProportions.width-this.margins.left,(e(i.containment==="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];/^(document|window|parent)$/.test(i.containment)||(t=e(i.containment)[0],n=e(i.containment).offset(),r=e(t).css("overflow")!=="hidden",this.containment=[n.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,n.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,n.left+(r?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,n.top+(r?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,n){n||(n=this.position);var r=t==="absolute"?1:-1,i=this.cssPosition!=="absolute"||this.scrollParent[0]!==document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,s=/(html|body)/i.test(i[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():s?0:i.scrollTop())*r,left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():s?0:i.scrollLeft())*r}},_generatePosition:function(t){var n,r,i=this.options,s=t.pageX,o=t.pageY,u=this.cssPosition!=="absolute"||this.scrollParent[0]!==document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(u[0].tagName);return this.cssPosition==="relative"&&(this.scrollParent[0]===document||this.scrollParent[0]===this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(s=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(s=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),i.grid&&(n=this.originalPageY+Math.round((o-this.originalPageY)/i.grid[1])*i.grid[1],o=this.containment?n-this.offset.click.top>=this.containment[1]&&n-this.offset.click.top<=this.containment[3]?n:n-this.offset.click.top>=this.containment[1]?n-i.grid[1]:n+i.grid[1]:n,r=this.originalPageX+Math.round((s-this.originalPageX)/i.grid[0])*i.grid[0],s=this.containment?r-this.offset.click.left>=this.containment[0]&&r-this.offset.click.left<=this.containment[2]?r:r-this.offset.click.left>=this.containment[0]?r-i.grid[0]:r+i.grid[0]:r)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():a?0:u.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():a?0:u.scrollLeft())}},_rearrange:function(e,t,n,r){n?n[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],this.direction==="down"?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var i=this.counter;this._delay(function(){i===this.counter&&this.refreshPositions(!r)})},_clear:function(t,n){this.reverting=!1;var r,i=[];!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null;if(this.helper[0]===this.currentItem[0]){for(r in this._storedCSS)if(this._storedCSS[r]==="auto"||this._storedCSS[r]==="static")this._storedCSS[r]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!n&&i.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),(this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!n&&i.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(n||(i.push(function(e){this._trigger("remove",e,this._uiHash())}),i.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),i.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer))));for(r=this.containers.length-1;r>=0;r--)n||i.push(function(e){return function(t){e._trigger("deactivate",t,this._uiHash(this))}}.call(this,this.containers[r])),this.containers[r].containerCache.over&&(i.push(function(e){return function(t){e._trigger("out",t,this._uiHash(this))}}.call(this,this.containers[r])),this.containers[r].containerCache.over=0);this._storedCursor&&e("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex==="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!n){this._trigger("beforeStop",t,this._uiHash());for(r=0;r<i.length;r++)i[r].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!1}n||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null;if(!n){for(r=0;r<i.length;r++)i[r].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var n=t||this;return{helper:n.helper,placeholder:n.placeholder||e([]),position:n.position,originalPosition:n.originalPosition,offset:n.positionAbs,item:n.currentItem,sender:t?t.element:null}}})})(jQuery);
js/levementum/levcore/levcore.js ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * User: Ian
3
+ * Date: 8/31/12
4
+ * Time: 10:44 AM
5
+ */
6
+
7
+
8
+ jQuery(document).ready(function () {
9
+ (function($){
10
+ var multiselectCallbacks = {
11
+ oldSetSelect: $.ui.multiselect.prototype._setSelected,
12
+ _setSelected: function(item, selected){
13
+ this.oldSetSelect(item, selected);
14
+ if (typeof this.options.onChangeCallback == 'function') {
15
+ this.options.onChangeCallback.call(this);
16
+ }
17
+ $(this.element).trigger('change');
18
+ }
19
+ };
20
+ $.extend($.ui.multiselect.prototype, multiselectCallbacks);
21
+ })(jQuery);
22
+
23
+ // choose either the full version
24
+ jQuery(".levementum-ordered-multiselect > .multiselect,.levementum-ordered-multiselect.multiselect").multiselect();
25
+ // or disable some features
26
+ // jQuery(".multiselect").multiselect({sortable: false, searchable: false});
27
+
28
+
29
+ });
30
+
31
+ function divToggle(details, switcher, expandedClassName)
32
+ {
33
+ if ($(details).style.display == 'none') {
34
+ $(details).show();
35
+ $(switcher).addClassName(expandedClassName);
36
+ } else {
37
+ $(details).hide();
38
+ $(switcher).removeClassName(expandedClassName);
39
+ }
40
+ }
41
+
42
+ function toggleCustomPrice(checkbox, elemId, tierBlock) {
43
+ if (checkbox.checked) {
44
+ $(elemId).disabled = false;
45
+ $(elemId).show();
46
+ if($(tierBlock)) $(tierBlock).hide();
47
+ } else {
48
+ $(elemId).disabled = true;
49
+ $(elemId).hide();
50
+ if($(tierBlock)) $(tierBlock).show();
51
+ }
52
+ }
53
+
54
+ function xorCheck(a, b){
55
+ return(( a && !b ) || (!a && b));
56
+ }
57
+
58
+ /**
59
+ * Checkbox Radio toggle fields. Only the box with the corresponding checkbox can be displayed.
60
+ * Makes two checkboxes behave as radio buttons for displaying an input field,
61
+ */
62
+
63
+ function checkboxRadiToggleField(checkbox1,checkbox1Block,checkbox2,checkbox2Block) {
64
+ var bothValid = false;
65
+ var boxes = {
66
+ 1:{
67
+ elm :$(checkbox1),
68
+ block:$(checkbox1Block)
69
+ },
70
+ 2:{
71
+ elm :$(checkbox2),
72
+ block:$(checkbox2Block)
73
+ }
74
+ };
75
+
76
+ $H(boxes).each(function (pair) {
77
+ if (pair.value.elm) {
78
+ pair.value.elm.observe('click', function (pair, event) {
79
+ var boxNumber = pair[0];
80
+ var box = pair[1];
81
+ var otherBox = boxes[Number(boxNumber) % 2 + 1];
82
+
83
+ disableBox(otherBox);
84
+
85
+ toggleCustomPrice(box.elm, box.block.readAttribute('id'));
86
+ }.bind(this, pair));
87
+ }
88
+ });
89
+
90
+ function enableBox(box) {
91
+ if (!box.elm || !box.block) {
92
+ return;
93
+ }
94
+ box.elm.checked = true;
95
+ box.block.disabled = false;
96
+ box.block.show();
97
+ }
98
+
99
+ function disableBox(box) {
100
+ if (!box.elm || !box.block) {
101
+ return;
102
+ }
103
+ box.elm.checked = false;
104
+ box.block.disabled = true;
105
+ box.block.hide();
106
+ }
107
+ }
js/levementum/levcore/levcore.validation.js ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ if (typeof Validation !== 'undefined') {
2
+ Validation.addAllThese(
3
+ [
4
+ //validates all fields that contain the class name "exclusive-attribute"
5
+ [
6
+ 'validate-exclusive-attribute',
7
+ 'Only one of these values may selected.',
8
+ function (v, elm) {
9
+ var result = true;
10
+ var expGroupedRegEx = /exclusive-attribute-[a-zA-Z][a-zA-Z0-9_]*/; //checks for "exclusive-attribute-attribute_code"
11
+ var match = expGroupedRegEx.exec(elm.className);
12
+ var currentValueIsEmpty = Validation.get('IsEmpty').test(v);
13
+ if (match) {
14
+ var attributeCode = match[0].substr(20);
15
+ if ($(attributeCode)) {
16
+ var secondValueIsEmpty = Validation.get('IsEmpty').test($(attributeCode).getValue());
17
+ if (currentValueIsEmpty && secondValueIsEmpty) {
18
+ Validation.methods['validate-exclusive-attribute'].error = 'Please enter a value in one of these fields.';
19
+ return false;
20
+ }
21
+ if (!(xorCheck(currentValueIsEmpty, secondValueIsEmpty))) {
22
+ return false;
23
+ }
24
+ }
25
+
26
+ }
27
+ $w(elm.className).each(function (name) {
28
+ if (name == 'exclusive-attribute') {
29
+ $$('.exclusive-attribute').each(function (elm) {
30
+ var secondValueIsEmpty = Validation.get('IsEmpty').test(elm.getValue());
31
+ if (!xorCheck(secondValueIsEmpty, currentValueIsEmpty)) {
32
+ return false;
33
+ }
34
+ });
35
+ }
36
+ });
37
+ return true;
38
+ }
39
+ ],
40
+ [
41
+ 'validate-date-range-closed',
42
+ 'Open-ended date range is not allowed. Please enter both a start and end date.',
43
+ //error code if validation fails.
44
+ function (v, elm) {
45
+ var paired = new RegExp(/^date-range-pair-[a-zA-Z][a-zA-Z0-9_]*$/);
46
+
47
+ var result = true;
48
+ $w(elm.className).each(function (name, index) {
49
+ if (name.match(paired) && result) {
50
+ var pairedId = name.split('-')[3];
51
+ var pairedElm = $(pairedId);
52
+
53
+ if (pairedElm == undefined) {
54
+ result = false;
55
+ return;
56
+ }
57
+
58
+ var pairedValue = pairedElm.getValue();
59
+
60
+ result = !((v == '' && pairedValue != '') || (v != '' && pairedValue == ''));
61
+ }
62
+ });
63
+
64
+ return result;
65
+ }
66
+ ],
67
+ [
68
+ 'validate-special-dates',
69
+ 'Open-ended specials are not allowed. Please enter both a start and end date.',
70
+ //error code if validation fails.
71
+ function (v, elm) {
72
+ var specialPrice = $('special_price').getValue();
73
+
74
+ //if no special price, no need to check further.
75
+ if (specialPrice <= 0 || specialPrice == '') {
76
+ return true;
77
+ }
78
+
79
+ var id = elm.readAttribute('id');
80
+ var otherId = false;
81
+ if (id == 'special_from_date') {
82
+ otherId = 'special_to_date';
83
+ } else {
84
+ otherId = 'special_from_date';
85
+ }
86
+
87
+ //if they aren't both here, just pass it.
88
+ if ($(id) == undefined || $(otherId) == undefined) {
89
+ return true;
90
+ }
91
+ elm.addClassName('date-range-pair-' + otherId);
92
+
93
+ return Validation.get('validate-date-range-closed').test(v, elm);
94
+ }
95
+ ]
96
+ ])
97
+ }
98
+
js/levementum/levcore/ui.multiselect.js ADDED
@@ -0,0 +1,965 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI Multiselect
3
+ *
4
+ * Authors:
5
+ * Michael Aufreiter (quasipartikel.at)
6
+ * Yanick Rochon (yanick.rochon[at]gmail[dot]com)
7
+ *
8
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
9
+ * and GPL (GPL-LICENSE.txt) licenses.
10
+ *
11
+ * http://yanickrochon.uuuq.com/multiselect/
12
+ *
13
+ *
14
+ * Depends:
15
+ * ui.core.js
16
+ * ui.draggable.js
17
+ * ui.droppable.js
18
+ * ui.sortable.js
19
+ * jquery.blockUI (http://github.com/malsup/blockui/)
20
+ * jquery.tmpl (http://andrew.hedges.name/blog/2008/09/03/introducing-jquery-simple-templates
21
+ *
22
+ * Optional:
23
+ * localization (http://plugins.jquery.com/project/localisation)
24
+ *
25
+ * Notes:
26
+ * The strings in this plugin use a templating engine to enable localization
27
+ * and allow flexibility in the messages. Read the documentation for more details.
28
+ *
29
+ * Todo:
30
+ * restore selected items on remote searchable multiselect upon page reload (same behavior as local mode)
31
+ * (is it worth it??) add a public function to apply the nodeComparator to all items (when using nodeComparator setter)
32
+ * support for option groups, disabled options, etc.
33
+ * speed improvements
34
+ * tests and optimizations
35
+ * - test getters/setters (including options from the defaults)
36
+ */
37
+
38
+
39
+ /********************************
40
+ * Default callbacks
41
+ ********************************/
42
+
43
+ // expect data to be "val1=text1[\nval2=text2[\n...]]"
44
+ var defaultDataParser = function(data) {
45
+ if ( typeof data == 'string' ) {
46
+ var pattern = /^(\s\n\r\t)*\+?$/, selected, line, lines = data.split(/\n/);
47
+ data = {};
48
+ for (var i in lines) {
49
+ line = lines[i].split("=");
50
+ // make sure the key is not empty
51
+ if (!pattern.test(line[0])) {
52
+ selected = (line[0].lastIndexOf('+') == line.length - 1);
53
+ if (selected) line[0] = line.substr(0,line.length-1);
54
+ // if no value is specified, default to the key value
55
+ data[line[0]] = {
56
+ selected: false,
57
+ value: line[1] || line[0]
58
+ };
59
+ }
60
+ }
61
+ } else {
62
+ this._messages($.ui.multiselect.constante.MESSAGE_ERROR, $.ui.multiselect.locale.errorDataFormat);
63
+ data = false;
64
+ }
65
+ return data;
66
+ };
67
+
68
+ var defaultNodeComparator = function(node1,node2) {
69
+ var text1 = node1.text(),
70
+ text2 = node2.text();
71
+ return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1);
72
+ };
73
+
74
+ (function($) {
75
+
76
+ $.widget("ui.multiselect", {
77
+ options: {
78
+ // sortable and droppable
79
+ sortable: 'left',
80
+ droppable: 'both',
81
+ // searchable
82
+ searchable: true,
83
+ searchDelay: 200,
84
+ remoteUrl: null,
85
+ remoteParams: {},
86
+ // animated
87
+ animated: 'fast',
88
+ show: 'slideDown',
89
+ hide: 'slideUp',
90
+ // ui
91
+ dividerLocation: 0.6,
92
+ // callbacks
93
+ dataParser: defaultDataParser,
94
+ nodeComparator: defaultNodeComparator,
95
+ nodeInserted: null,
96
+ hidden: false,
97
+ doubleClickable: true
98
+ },
99
+ _create: function() {
100
+ if( !this.options.hidden){
101
+ this.element.hide();
102
+ this.busy = false; // busy state
103
+ this.container = $('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);
104
+ this.selectedContainer = $('<div class="ui-widget-content list-container selected"></div>').appendTo(this.container);
105
+ this.availableContainer = $('<div class="ui-widget-content list-container available"></div>').appendTo(this.container);
106
+ this.selectedActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">'+$.tmpl($.ui.multiselect.locale.itemsCount,{count:0})+'</span><a href="#" class="remove-all">'+$.tmpl($.ui.multiselect.locale.removeAll)+'</a></div>').appendTo(this.selectedContainer);
107
+ this.availableActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><span class="busy">'+$.tmpl($.ui.multiselect.locale.busy)+'</span><input type="text" class="search ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+$.tmpl($.ui.multiselect.locale.addAll)+'</a></div>').appendTo(this.availableContainer);
108
+ this.selectedList = $('<ul class="list selected"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer);
109
+ this.availableList = $('<ul class="list available"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.availableContainer);
110
+
111
+ var that = this;
112
+
113
+ // initialize data cache
114
+ this.availableList.data('multiselect.cache', {});
115
+ this.selectedList.data('multiselect.cache', {});
116
+
117
+ if ( !this.options.animated ) {
118
+ this.options.show = 'show';
119
+ this.options.hide = 'hide';
120
+ }
121
+
122
+ // sortable / droppable / draggable
123
+ var dragOptions = {
124
+ selected: {
125
+ sortable: ('both' == this.options.sortable || 'left' == this.options.sortable),
126
+ droppable: ('both' == this.options.droppable || 'left' == this.options.droppable)
127
+ },
128
+ available: {
129
+ sortable: ('both' == this.options.sortable || 'right' == this.options.sortable),
130
+ droppable: ('both' == this.options.droppable || 'right' == this.options.droppable)
131
+ }
132
+ };
133
+ this._prepareLists('selected', 'available', dragOptions);
134
+ this._prepareLists('available', 'selected', dragOptions);
135
+
136
+ // set up livesearch
137
+ this._registerSearchEvents(this.availableContainer.find('input.search'), true);
138
+ // make sure that we're not busy yet
139
+ this._setBusy(false);
140
+
141
+ // batch actions
142
+ this.container.find(".remove-all").bind('click.multiselect', function() { that.selectNone(); return false; });
143
+ this.container.find(".add-all").bind('click.multiselect', function() { that.selectAll(); return false; });
144
+
145
+ // set dimensions
146
+ this.container.width(this.element.width()+281);
147
+ this._refreshDividerLocation();
148
+ // set max width of search input dynamically
149
+ this.availableActions.find('input').width(Math.max(this.availableActions.width() - this.availableActions.find('a.add-all').width() - 30, 100));
150
+ // fix list height to match <option> depending on their individual header's heights
151
+ this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1));
152
+ this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1));
153
+
154
+ // init lists
155
+ this._populateLists(this.element.find('option'));
156
+ } // end check for hidden attribute
157
+ },
158
+
159
+ /**************************************
160
+ * Public
161
+ **************************************/
162
+
163
+ slideToggle: function() {
164
+ if( this.options.hidden ){
165
+ this.options.hidden = !this.options.hidden; // this should no longer be hidden
166
+ this._create(); // now create it
167
+ }
168
+ else{
169
+ this.container.slideToggle(); // otherwise just toggle it
170
+ }
171
+
172
+ },
173
+
174
+ destroy: function() {
175
+ this.container.remove();
176
+ this.element.show();
177
+
178
+ $.widget.prototype.destroy.apply(this, arguments);
179
+ },
180
+ isBusy: function() {
181
+ return !!this.busy;
182
+ },
183
+ isSelected: function(item) {
184
+ if (this.enabled()) {
185
+ return !!this._findItem(item, this.selectedList);
186
+ } else {
187
+ return null;
188
+ }
189
+ },
190
+ // get all selected values in an array
191
+ selectedValues: function() {
192
+ return $.map( this.element.find('option[selected]'), function(item,i) { return $(item).val(); });
193
+ },
194
+ // get/set enable state
195
+ enabled: function(state, msg) {
196
+ if (undefined !== state) {
197
+ if (state) {
198
+ this.container.unblock();
199
+ this.element.removeAttr('disabled');
200
+ } else {
201
+ this.container.block({message:msg||null,overlayCSS:{backgroundColor:'#fff',opacity:0.4,cursor:'default'}});
202
+ this.element.attr('disabled', true);
203
+ }
204
+ }
205
+ return !this.element.attr('disabled');
206
+ },
207
+ selectAll: function() {
208
+ if (this.enabled()) {
209
+ this._batchSelect(this.availableList.children('li.ui-element:visible'), true);
210
+ }
211
+ },
212
+ selectNone: function() {
213
+ if (this.enabled()) {
214
+ this._batchSelect(this.selectedList.children('li.ui-element:visible'), false);
215
+ }
216
+ },
217
+ select: function(text) {
218
+ if (this.enabled()) {
219
+ var available = this._findItem(text, this.availableList);
220
+ if ( available ) {
221
+ this._setSelected(available, true);
222
+ }
223
+ }
224
+ },
225
+ deselect: function(text) {
226
+ if (this.enabled()) {
227
+ var selected = this._findItem(text, this.selectedList);
228
+ if ( selected ) {
229
+ this._setSelected(selected, false);
230
+ }
231
+ }
232
+ },
233
+ search: function(query) {
234
+ if (!this.busy && this.enabled() && this.options.searchable) {
235
+ var input = this.availableActions.children('input:first');
236
+ input.val(query);
237
+ input.trigger('keydown.multiselect');
238
+ }
239
+ },
240
+ // insert new <option> and _populate
241
+ // @return int the number of options added
242
+ addOptions: function(data) {
243
+ if (this.enabled()) {
244
+ this._setBusy(true);
245
+
246
+ // format data
247
+ var elements = [];
248
+ if (data = this.options.dataParser.call(this, data)) {
249
+ for (var key in data) {
250
+ // check if the option does not exist already
251
+ if (this.element.find('option[value="'+key+'"]').size()==0) {
252
+ elements.push( $('<option value="'+key+'"/>').text(data[key].value).appendTo(this.element)[0] );
253
+ }
254
+ }
255
+ }
256
+
257
+ if (elements.length>0) {
258
+ this._populateLists($(elements));
259
+ }
260
+
261
+ this._filter(this.availableList.children('li.ui-element'));
262
+
263
+ this._setBusy(false);
264
+ return elements.length;
265
+ } else {
266
+ return false;
267
+ }
268
+ },
269
+
270
+ /**************************************
271
+ * Private
272
+ **************************************/
273
+
274
+ _setData: function(key, value) {
275
+ switch (key) {
276
+ // special treatement must be done for theses values when changed
277
+ case 'dividerLocation':
278
+ this.options.dividerLocation = value;
279
+ this._refreshDividerLocation();
280
+ break;
281
+ case 'searchable':
282
+ this.options.searchable = value;
283
+ this._registerSearchEvents(this.availableContainer.find('input.search'), false);
284
+ break;
285
+
286
+ case 'droppable':
287
+ case 'sortable':
288
+ // readonly options
289
+ this._messages(
290
+ $.ui.multiselect.constants.MESSAGE_WARNING,
291
+ $.ui.multiselect.locale.errorReadonly,
292
+ {option: key}
293
+ );
294
+ default:
295
+ // default behavior
296
+ this.options[key] = value;
297
+ break;
298
+ }
299
+ },
300
+ _ui: function(type) {
301
+ var uiObject = {sender: this.element};
302
+ switch (type) {
303
+ // events: messages
304
+ case 'message':
305
+ uiObject.type = arguments[1];
306
+ uiObject.message = arguments[2];
307
+ break;
308
+
309
+ // events: selected, deselected
310
+ case 'selection':
311
+ uiObject.option = arguments[1];
312
+ break;
313
+ }
314
+ return uiObject;
315
+ },
316
+ _messages: function(type, msg, params) {
317
+ this._trigger('messages', null, this._ui('message', type, $.tmpl(msg, params)));
318
+ },
319
+
320
+ _refreshDividerLocation: function() {
321
+ this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation)+110);
322
+ this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation))+170);
323
+ },
324
+ _prepareLists: function(side, otherSide, opts) {
325
+ var that = this;
326
+ var itemSelected = ('selected' == side);
327
+ var list = this[side+'List'];
328
+ var otherList = this[otherSide+'List'];
329
+ var listDragHelper = opts[otherSide].sortable ? _dragHelper : 'clone';
330
+
331
+ list
332
+ .data('multiselect.sortable', opts[side].sortable )
333
+ .data('multiselect.droppable', opts[side].droppable )
334
+ .data('multiselect.draggable', !opts[side].sortable && (opts[otherSide].sortable || opts[otherSide].droppable) );
335
+
336
+ if (opts[side].sortable) {
337
+ list.sortable({
338
+ appendTo: this.container,
339
+ connectWith: otherList,
340
+ containment: this.container,
341
+ helper: listDragHelper,
342
+ items: 'li.ui-element',
343
+ revert: !(opts[otherSide].sortable || opts[otherSide].droppable),
344
+ receive: function(event, ui) {
345
+ // DEBUG
346
+ //that._messages(0, "Receive : " + ui.item.data('multiselect.optionLink') + ":" + ui.item.parent()[0].className + " = " + itemSelected);
347
+
348
+ // we received an element from a sortable to another sortable...
349
+ if (opts[otherSide].sortable) {
350
+ var optionLink = ui.item.data('multiselect.optionLink');
351
+
352
+ that._applyItemState(ui.item.hide(), itemSelected);
353
+
354
+ // if the cache already contain an element, remove it
355
+ if (otherList.data('multiselect.cache')[optionLink.val()]) {
356
+ delete otherList.data('multiselect.cache')[optionLink.val()];
357
+ }
358
+
359
+ ui.item.hide();
360
+ that._setSelected(ui.item, itemSelected, true);
361
+ } else {
362
+ // the other is droppable only, so merely select the element...
363
+ setTimeout(function() {
364
+ that._setSelected(ui.item, itemSelected);
365
+ }, 10);
366
+ }
367
+ },
368
+ stop: function(event, ui) {
369
+ // DEBUG
370
+ //that._messages(0, "Stop : " + (ui.item.parent()[0] == otherList[0]));
371
+ that._moveOptionNode(ui.item);
372
+ }
373
+ });
374
+ }
375
+
376
+ // cannot be droppable if both lists are sortable, it breaks the receive function
377
+ if (!(opts[side].sortable && opts[otherSide].sortable)
378
+ && (opts[side].droppable || opts[otherSide].sortable || opts[otherSide].droppable)) {
379
+ //alert( side + " is droppable ");
380
+ list.droppable({
381
+ accept: '.ui-multiselect li.ui-element',
382
+ hoverClass: 'ui-state-highlight',
383
+ revert: !(opts[otherSide].sortable || opts[otherSide].droppable),
384
+ greedy: true,
385
+ drop: function(event, ui) {
386
+ // DEBUG
387
+ //that._messages(0, "drop " + side + " = " + ui.draggable.data('multiselect.optionLink') + ":" + ui.draggable.parent()[0].className);
388
+
389
+ //alert( "drop " + itemSelected );
390
+ // if no optionLink is defined, it was dragged in
391
+ if (!ui.draggable.data('multiselect.optionLink')) {
392
+ var optionLink = ui.helper.data('multiselect.optionLink');
393
+ ui.draggable.data('multiselect.optionLink', optionLink);
394
+
395
+ // if the cache already contain an element, remove it
396
+ if (list.data('multiselect.cache')[optionLink.val()]) {
397
+ delete list.data('multiselect.cache')[optionLink.val()];
398
+ }
399
+ list.data('multiselect.cache')[optionLink.val()] = ui.draggable;
400
+
401
+ that._applyItemState(ui.draggable, itemSelected);
402
+
403
+ // received an item from a sortable to a droppable
404
+ } else if (!opts[side].sortable) {
405
+ setTimeout(function() {
406
+ ui.draggable.hide();
407
+ that._setSelected(ui.draggable, itemSelected);
408
+ }, 10);
409
+ }
410
+
411
+ }
412
+ });
413
+ }
414
+ },
415
+ _populateLists: function(options) {
416
+ this._setBusy(true);
417
+
418
+ var that = this;
419
+ // do this async so the browser actually display the waiting message
420
+ setTimeout(function() {
421
+ $(options.each(function(i) {
422
+ var list = (this.selected ? that.selectedList : that.availableList);
423
+ var item = that._getOptionNode(this).show();
424
+ that._applyItemState(item, this.selected);
425
+ item.data('multiselect.idx', i);
426
+
427
+ // cache
428
+ list.data('multiselect.cache')[item.data('multiselect.optionLink').val()] = item;
429
+
430
+ that._insertToList(item, list);
431
+ }));
432
+
433
+ // update count
434
+ that._setBusy(false);
435
+ that._updateCount();
436
+ }, 1);
437
+ },
438
+ _insertToList: function(node, list) {
439
+ var that = this;
440
+ this._setBusy(true);
441
+ // the browsers don't like batch node insertion...
442
+ var _addNodeRetry = 0;
443
+ var _addNode = function() {
444
+ var succ = (that.options.nodeComparator ? that._getSuccessorNode(node, list) : null);
445
+ try {
446
+ if (succ) {
447
+ node.insertBefore(succ);
448
+ } else {
449
+ list.append(node);
450
+ }
451
+ if (list === that.selectedList) that._moveOptionNode(node);
452
+
453
+ // callback after node insertion
454
+ if ('function' == typeof that.options.nodeInserted) that.options.nodeInserted(node);
455
+ that._setBusy(false);
456
+ } catch (e) {
457
+ // if this problem did not occur too many times already
458
+ if ( _addNodeRetry++ < 10 ) {
459
+ // try again later (let the browser cool down first)
460
+ setTimeout(function() { _addNode(); }, 1);
461
+ } else {
462
+ that._messages(
463
+ $.ui.multiselect.constants.MESSAGE_EXCEPTION,
464
+ $.ui.multiselect.locale.errorInsertNode,
465
+ {key:node.data('multiselect.optionLink').val(), value:node.text()}
466
+ );
467
+ that._setBusy(false);
468
+ }
469
+ }
470
+ };
471
+ _addNode();
472
+ },
473
+ _updateCount: function() {
474
+ var that = this;
475
+ // defer until system is not busy
476
+ if (this.busy) setTimeout(function() { that._updateCount(); }, 100);
477
+ // count only visible <li> (less .ui-helper-hidden*)
478
+ var count = this.selectedList.children('li:not(.ui-helper-hidden-accessible,.ui-sortable-placeholder):visible').size();
479
+ var total = this.availableList.children('li:not(.ui-helper-hidden-accessible,.ui-sortable-placeholder,.shadowed)').size() + count;
480
+ this.selectedContainer.find('span.count')
481
+ .text($.tmpl($.ui.multiselect.locale.itemsCount, {count:count}))
482
+ .attr('title', $.tmpl($.ui.multiselect.locale.itemsTotal, {count:total}));
483
+ },
484
+ _getOptionNode: function(option) {
485
+ option = $(option);
486
+ var node = $('<li class="ui-state-default ui-element"><span class="ui-icon"/>'+option.text()+'<a href="#" class="ui-state-default action"><span class="ui-corner-all ui-icon"/></a></li>').hide();
487
+ node.data('multiselect.optionLink', option);
488
+ return node;
489
+ },
490
+ _moveOptionNode: function(item) {
491
+ // call this async to let the item be placed correctly
492
+ setTimeout( function() {
493
+ var optionLink = item.data('multiselect.optionLink');
494
+ if (optionLink) {
495
+ var prevItem = item.prev('li:not(.ui-helper-hidden-accessible,.ui-sortable-placeholder):visible');
496
+ var prevOptionLink = prevItem.size() ? prevItem.data('multiselect.optionLink') : null;
497
+
498
+ if (prevOptionLink) {
499
+ optionLink.insertAfter(prevOptionLink);
500
+ } else {
501
+ optionLink.prependTo(optionLink.parent());
502
+ }
503
+ }
504
+ }, 100);
505
+ },
506
+ // used by select and deselect, etc.
507
+ _findItem: function(text, list) {
508
+ var found = null;
509
+ list.children('li.ui-element:visible').each(function(i,el) {
510
+ el = $(el);
511
+ if (el.text().toLowerCase() === text.toLowerCase()) {
512
+ found = el;
513
+ }
514
+ });
515
+ if (found && found.size()) {
516
+ return found;
517
+ } else {
518
+ return false;
519
+ }
520
+ },
521
+ // clones an item with
522
+ // didn't find a smarter away around this (michael)
523
+ // now using cache to speed up the process (yr)
524
+ _cloneWithData: function(clonee, cacheName, insertItem) {
525
+ var that = this;
526
+ var id = clonee.data('multiselect.optionLink').val();
527
+ var selected = ('selected' == cacheName);
528
+ var list = (selected ? this.selectedList : this.availableList);
529
+ var clone = list.data('multiselect.cache')[id];
530
+
531
+ if (!clone) {
532
+ clone = clonee.clone().hide();
533
+ this._applyItemState(clone, selected);
534
+ // update cache
535
+ list.data('multiselect.cache')[id] = clone;
536
+ // update <option> and idx
537
+ clone.data('multiselect.optionLink', clonee.data('multiselect.optionLink'));
538
+ // need this here because idx is needed in _getSuccessorNode
539
+ clone.data('multiselect.idx', clonee.data('multiselect.idx'));
540
+
541
+ // insert the node into it's list
542
+ if (insertItem) {
543
+ this._insertToList(clone, list);
544
+ }
545
+ } else {
546
+ // update idx
547
+ clone.data('multiselect.idx', clonee.data('multiselect.idx'));
548
+ }
549
+ return clone;
550
+ },
551
+ _batchSelect: function(elements, state) {
552
+ this._setBusy(true);
553
+
554
+ var that = this;
555
+ // do this async so the browser actually display the waiting message
556
+ setTimeout(function() {
557
+ var _backup = {
558
+ animated: that.options.animated,
559
+ hide: that.options.hide,
560
+ show: that.options.show
561
+ };
562
+
563
+ that.options.animated = null;
564
+ that.options.hide = 'hide';
565
+ that.options.show = 'show';
566
+
567
+ elements.each(function(i,element) {
568
+ that._setSelected($(element), state);
569
+ });
570
+
571
+ // filter available items
572
+ if (!state) that._filter(that.availableList.find('li.ui-element'));
573
+
574
+ // restore
575
+ $.extend(that.options, _backup);
576
+
577
+ that._updateCount();
578
+ that._setBusy(false);
579
+ }, 10);
580
+ },
581
+ // find the best successor the given item in the specified list
582
+ // TODO implement a faster sorting algorithm (and remove the idx dependancy)
583
+ _getSuccessorNode: function(item, list) {
584
+ // look for successor based on initial option index
585
+ var items = list.find('li.ui-element'), comparator = this.options.nodeComparator;
586
+ var itemsSize = items.size();
587
+
588
+ // no successor, list is null
589
+ if (items.size() == 0) return null;
590
+
591
+ var succ, i = Math.min(item.data('multiselect.idx'),itemsSize-1), direction = comparator(item, $(items[i]));
592
+
593
+ if ( direction ) {
594
+ // quick checks
595
+ if (0>direction && 0>=i) {
596
+ succ = items[0];
597
+ } else if (0<direction && itemsSize-1<=i) {
598
+ i++;
599
+ succ = null;
600
+ } else {
601
+ while (i>=0 && i<items.length) {
602
+ direction > 0 ? i++ : i--;
603
+ if (i<0) {
604
+ succ = item[0]
605
+ }
606
+ if ( direction != comparator(item, $(items[i])) ) {
607
+ // going up, go back one item down, otherwise leave as is
608
+ succ = items[direction > 0 ? i : i+1];
609
+ break;
610
+ }
611
+ }
612
+ }
613
+ } else {
614
+ succ = items[i];
615
+ }
616
+ // update idx
617
+ item.data('multiselect.idx', i);
618
+
619
+ return succ;
620
+ },
621
+ // @param DOMElement item is the item to set
622
+ // @param bool selected true|false (state)
623
+ // @param bool noclone (optional) true only if item should not be cloned on the other list
624
+ _setSelected: function(item, selected, noclone) {
625
+ var that = this, otherItem;
626
+ var optionLink = item.data('multiselect.optionLink');
627
+
628
+ if (selected) {
629
+ // already selected
630
+ if (optionLink.attr('selected')) return;
631
+ optionLink.attr('selected','selected');
632
+
633
+ if (noclone) {
634
+ otherItem = item;
635
+ } else {
636
+ // retrieve associatd or cloned item
637
+ otherItem = this._cloneWithData(item, 'selected', true).hide();
638
+ item.addClass('shadowed')[this.options.hide](this.options.animated, function() { that._updateCount(); });
639
+ }
640
+ otherItem[this.options.show](this.options.animated);
641
+ } else {
642
+ // already deselected
643
+ if (!optionLink.attr('selected')) return;
644
+ optionLink.removeAttr('selected');
645
+
646
+ if (noclone) {
647
+ otherItem = item;
648
+ } else {
649
+ // retrieve associated or clone the item
650
+ otherItem = this._cloneWithData(item, 'available', true).hide().removeClass('shadowed');
651
+ item[this.options.hide](this.options.animated, function() { that._updateCount() });
652
+ }
653
+ if (!otherItem.is('.filtered')) otherItem[this.options.show](this.options.animated);
654
+ }
655
+
656
+ if (!this.busy) {
657
+ if (this.options.animated) {
658
+ // pulse
659
+ //otherItem.effect("pulsate", { times: 1, mode: 'show' }, 400); // pulsate twice???
660
+ otherItem.fadeTo('fast', 0.3, function() { $(this).fadeTo('fast', 1); });
661
+ }
662
+ }
663
+
664
+ // fire selection event
665
+ this._trigger(selected ? 'selected' : 'deselected', null, this._ui('selection', optionLink));
666
+
667
+ return otherItem;
668
+ },
669
+ _setBusy: function(state) {
670
+ var input = this.availableActions.children('input.search');
671
+ var busy = this.availableActions.children('.busy');
672
+
673
+ this.busy = Math.max(state ? ++this.busy : --this.busy, 0);
674
+
675
+ this.container.find("a.remove-all, a.add-all")[this.busy ? 'hide' : 'show']();
676
+ if (state && (1 == this.busy)) {
677
+ if (this.options.searchable) {
678
+ // backup input state
679
+ input.data('multiselect.hadFocus', input.data('multiselect.hasFocus'));
680
+ // webkit needs to blur before hiding or it won't fire focus again in the else block
681
+ input.blur().hide();
682
+ }
683
+ busy.show();
684
+ } else if(!this.busy) {
685
+ if (this.options.searchable) {
686
+ input.show();
687
+ if (input.data('multiselect.hadFocus')) input.focus();
688
+ }
689
+ busy.hide();
690
+ }
691
+
692
+ // DEBUG
693
+ //this._messages(0, "Busy state changed to : " + this.busy);
694
+ },
695
+ _applyItemState: function(item, selected) {
696
+ if (selected) {
697
+ item.children('span').addClass('ui-helper-hidden').removeClass('ui-icon');
698
+ item.find('a.action span').addClass('ui-icon-minus').removeClass('ui-icon-plus');
699
+ this._registerRemoveEvents(item.find('a.action'));
700
+
701
+ } else {
702
+ item.children('span').addClass('ui-helper-hidden').removeClass('ui-icon');
703
+ item.find('a.action span').addClass('ui-icon-plus').removeClass('ui-icon-minus');
704
+ this._registerAddEvents(item.find('a.action'));
705
+ }
706
+
707
+ this._registerHoverEvents(item);
708
+ this._registerDoubleClickEvents(item);
709
+
710
+ return item;
711
+ },
712
+ // apply filter and return elements
713
+ _filter: function(elements) {
714
+ var input = this.availableActions.children('input.search');
715
+ var term = $.trim( input.val().toLowerCase() );
716
+
717
+ if ( !term ) {
718
+ elements.removeClass('filtered');
719
+ } else {
720
+ elements.each(function(i,element) {
721
+ element = $(element);
722
+ element[(element.text().toLowerCase().indexOf(term)>=0 ? 'remove' : 'add')+'Class']('filtered');
723
+ });
724
+ }
725
+
726
+ return elements.not('.filtered, .shadowed').show().end().filter('.filtered, .shadowed').hide().end();
727
+ },
728
+ _registerDoubleClickEvents: function(elements) {
729
+ if (!this.options.doubleClickable) return;
730
+ elements.dblclick(function(ev) {
731
+ if ($(ev.target).closest('.action').length === 0) {
732
+ // This may be triggered with rapid clicks on actions as well. In that
733
+ // case don't trigger an additional click.
734
+ elements.find('a.action').click();
735
+ }
736
+ });
737
+ },
738
+ _registerHoverEvents: function(elements) {
739
+ elements
740
+ .unbind('mouseover.multiselect').bind('mouseover.multiselect', function() {
741
+ $(this).find('a').andSelf().addClass('ui-state-hover');
742
+ })
743
+ .unbind('mouseout.multiselect').bind('mouseout.multiselect', function() {
744
+ $(this).find('a').andSelf().removeClass('ui-state-hover');
745
+ })
746
+ .find('a').andSelf().removeClass('ui-state-hover')
747
+ ;
748
+ },
749
+ _registerAddEvents: function(elements) {
750
+ var that = this;
751
+ elements.unbind('click.multiselect').bind('click.multiselect', function() {
752
+ // ignore if busy...
753
+ if (!this.busy) {
754
+ that._setSelected($(this).parent(), true);
755
+ }
756
+ return false;
757
+ });
758
+ if (this.availableList.data('multiselect.draggable')) {
759
+ // make draggable
760
+ elements.each(function() {
761
+ $(this).parent().draggable({
762
+ connectToSortable: that.selectedList,
763
+ helper: _dragHelper,
764
+ appendTo: that.container,
765
+ containment: that.container,
766
+ revert: 'invalid'
767
+ });
768
+ });
769
+ // refresh the selected list or the draggable will not connect to it first hand
770
+ if (this.selectedList.data('multiselect.sortable')) {
771
+ this.selectedList.sortable('refresh');
772
+ }
773
+ }
774
+ },
775
+ _registerRemoveEvents: function(elements) {
776
+ var that = this;
777
+ elements.unbind('click.multiselect').bind('click.multiselect', function() {
778
+ // ignore if busy...
779
+ if (!that.busy) {
780
+ that._setSelected($(this).parent(), false);
781
+ }
782
+ return false;
783
+ });
784
+ if (this.selectedList.data('multiselect.draggable')) {
785
+ // make draggable
786
+ elements.each(function() {
787
+ $(this).parent().draggable({
788
+ connectToSortable: that.availableList,
789
+ helper: _dragHelper,
790
+ appendTo: that.container,
791
+ containment: that.container,
792
+ revert: 'invalid'
793
+ });
794
+ });
795
+ // refresh the selected list or the draggable will not connect to it first hand
796
+ if (this.availableList.data('multiselect.sortable')) {
797
+ this.availableList.sortable('refresh');
798
+ }
799
+ }
800
+ },
801
+ _registerSearchEvents: function(input, searchNow) {
802
+ var that = this;
803
+ var previousValue = input.val(), timer;
804
+
805
+ var _searchNow = function(forceUpdate) {
806
+ if (that.busy) return;
807
+
808
+ var value = input.val();
809
+ if ((value != previousValue) || (forceUpdate)) {
810
+ that._setBusy(true);
811
+
812
+ if (that.options.remoteUrl) {
813
+ var params = $.extend({}, that.options.remoteParams);
814
+ try {
815
+ $.ajax({
816
+ url: that.options.remoteUrl,
817
+ data: $.extend(params, {q:escape(value)}),
818
+ success: function(data) {
819
+ that.addOptions(data);
820
+ that._setBusy(false);
821
+ },
822
+ error: function(request,status,e) {
823
+ that._messages(
824
+ $.ui.multiselect.constants.MESSAGE_ERROR,
825
+ $.ui.multiselect.locale.errorRequest,
826
+ {status:status}
827
+ );
828
+ that._setBusy(false);
829
+ }
830
+ });
831
+ } catch (e) {
832
+ that._messages($.ui.multiselect.constants.MESSAGE_EXCEPTION, e.message); // error message template ??
833
+ that._setBusy(false);
834
+ }
835
+ } else {
836
+ that._filter(that.availableList.children('li.ui-element'));
837
+ that._setBusy(false);
838
+ }
839
+
840
+ previousValue = value;
841
+ }
842
+ };
843
+
844
+ // reset any events... if any
845
+ input.unbind('focus.multiselect blur.multiselect keydown.multiselect keypress.multiselect');
846
+ if (this.options.searchable) {
847
+ input
848
+ .bind('focus.multiselect', function() {
849
+ $(this).addClass('ui-state-active').data('multiselect.hasFocus', true);
850
+ })
851
+ .bind('blur.multiselect', function() {
852
+ $(this).removeClass('ui-state-active').data('multiselect.hasFocus', false);
853
+ })
854
+ .bind('keydown.multiselect keypress.multiselect', function(e) {
855
+ if (timer) clearTimeout(timer);
856
+ switch (e.which) {
857
+ case 13: // enter
858
+ _searchNow(true);
859
+ return false;
860
+
861
+ default:
862
+ timer = setTimeout(function() { _searchNow(); }, Math.max(that.options.searchDelay,1));
863
+ }
864
+ })
865
+ .show();
866
+ } else {
867
+ input.val('').hide();
868
+ this._filter(that.availableList.find('li.ui-element'))
869
+ }
870
+ // initiate search filter (delayed)
871
+ var _initSearch = function() {
872
+ if (that.busy) {
873
+ setTimeout(function() { _initSearch(); }, 100);
874
+ }
875
+ _searchNow(true);
876
+ };
877
+
878
+ if (searchNow) _initSearch();
879
+ }
880
+ });
881
+ // END ui.multiselect
882
+
883
+
884
+ /********************************
885
+ * Internal functions
886
+ ********************************/
887
+
888
+ var _dragHelper = function(event, ui) {
889
+ var item = $(event.target);
890
+ var clone = item.clone().width(item.width());
891
+ clone
892
+ .data('multiselect.optionLink', item.data('multiselect.optionLink'))
893
+ .data('multiselect.list', item.parent() )
894
+ // node ui cleanup
895
+ .find('a').remove()
896
+ ;
897
+ return clone;
898
+ };
899
+
900
+
901
+
902
+ /****************************
903
+ * Settings
904
+ ****************************/
905
+
906
+ $.extend($.ui.multiselect, {
907
+ getter: 'selectedValues enabled isBusy',
908
+ locale: {
909
+ addAll:'Add all',
910
+ removeAll:'Remove all',
911
+ itemsCount:'#{count} items selected',
912
+ itemsTotal:'#{count} items total',
913
+ busy:'please wait...',
914
+ errorDataFormat:"Cannot add options, unknown data format",
915
+ errorInsertNode:"There was a problem trying to add the item:\n\n\t[#{key}] => #{value}\n\nThe operation was aborted.",
916
+ errorReadonly:"The option #{option} is readonly",
917
+ errorRequest:"Sorry! There seemed to be a problem with the remote call. (Type: #{status})"
918
+ },
919
+ constants: {
920
+ MESSAGE_WARNING: 0,
921
+ MESSAGE_EXCEPTION: 1,
922
+ MESSAGE_ERROR: 2
923
+ }
924
+ });
925
+
926
+ })(jQuery);
927
+
928
+ /*
929
+ * jQuery Simple Templates plugin 1.1.1
930
+ *
931
+ * http://andrew.hedges.name/tmpl/
932
+ * http://docs.jquery.com/Plugins/Tmpl
933
+ *
934
+ * Copyright (c) 2008 Andrew Hedges, andrew@hedges.name
935
+ *
936
+ * Usage: $.tmpl('<div class="#{classname}">#{content}</div>', { 'classname' : 'my-class', 'content' : 'My content.' });
937
+ * $.tmpl('<div class="#{1}">#{0}</div>', 'My content', 'my-class'); // placeholder order not important
938
+ *
939
+ * The changes for version 1.1 were inspired by the discussion at this thread:
940
+ * http://groups.google.com/group/jquery-ui/browse_thread/thread/45d0f5873dad0178/0f3c684499d89ff4
941
+ *
942
+ * Dual licensed under the MIT and GPL licenses:
943
+ * http://www.opensource.org/licenses/mit-license.php
944
+ * http://www.gnu.org/licenses/gpl.html
945
+ */
946
+
947
+ (function($) {
948
+ // regular expression for matching our placeholders; e.g., #{my-cLaSs_name77}
949
+ var regx = /#\{([^{}]*)}/g;
950
+
951
+ $.extend({
952
+ // public interface: $.tmpl
953
+ tmpl : function(tmpl) {
954
+ // default to doing no harm
955
+ tmpl = tmpl || '';
956
+ var vals = (2 === arguments.length && 'object' === typeof arguments[1] ? arguments[1] : Array.prototype.slice.call(arguments,1));
957
+ // function to making replacements
958
+ var repr = function (str, match) {
959
+ return typeof vals[match] === 'string' || typeof vals[match] === 'number' ? vals[match] : str;
960
+ };
961
+
962
+ return tmpl.replace(regx, repr);
963
+ }
964
+ });
965
+ })(jQuery);
js/levementum/levcore/ui.multiselect.min.js ADDED
@@ -0,0 +1 @@
 
1
+ var defaultDataParser=function(f){if(typeof f=="string"){var e=/^(\s\n\r\t)*\+?$/,d,b,a=f.split(/\n/);f={};for(var c in a){b=a[c].split("=");if(!e.test(b[0])){d=(b[0].lastIndexOf("+")==b.length-1);if(d){b[0]=b.substr(0,b.length-1);}f[b[0]]={selected:false,value:b[1]||b[0]};}}}else{this._messages($.ui.multiselect.constante.MESSAGE_ERROR,$.ui.multiselect.locale.errorDataFormat);f=false;}return f;};var defaultNodeComparator=function(b,a){var d=b.text(),c=a.text();return d==c?0:(d<c?-1:1);};(function(b){b.widget("ui.multiselect",{options:{sortable:"left",droppable:"both",searchable:true,searchDelay:200,remoteUrl:null,remoteParams:{},animated:"fast",show:"slideDown",hide:"slideUp",dividerLocation:0.6,dataParser:defaultDataParser,nodeComparator:defaultNodeComparator,nodeInserted:null,hidden:false,doubleClickable:true},_create:function(){if(!this.options.hidden){this.element.hide();this.busy=false;this.container=b('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);this.selectedContainer=b('<div class="ui-widget-content list-container selected"></div>').appendTo(this.container);this.availableContainer=b('<div class="ui-widget-content list-container available"></div>').appendTo(this.container);this.selectedActions=b('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">'+b.tmpl(b.ui.multiselect.locale.itemsCount,{count:0})+'</span><a href="#" class="remove-all">'+b.tmpl(b.ui.multiselect.locale.removeAll)+"</a></div>").appendTo(this.selectedContainer);this.availableActions=b('<div class="actions ui-widget-header ui-helper-clearfix"><span class="busy">'+b.tmpl(b.ui.multiselect.locale.busy)+'</span><input type="text" class="search ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+b.tmpl(b.ui.multiselect.locale.addAll)+"</a></div>").appendTo(this.availableContainer);this.selectedList=b('<ul class="list selected"><li class="ui-helper-hidden-accessible"></li></ul>').bind("selectstart",function(){return false;}).appendTo(this.selectedContainer);this.availableList=b('<ul class="list available"><li class="ui-helper-hidden-accessible"></li></ul>').bind("selectstart",function(){return false;}).appendTo(this.availableContainer);var d=this;this.availableList.data("multiselect.cache",{});this.selectedList.data("multiselect.cache",{});if(!this.options.animated){this.options.show="show";this.options.hide="hide";}var c={selected:{sortable:("both"==this.options.sortable||"left"==this.options.sortable),droppable:("both"==this.options.droppable||"left"==this.options.droppable)},available:{sortable:("both"==this.options.sortable||"right"==this.options.sortable),droppable:("both"==this.options.droppable||"right"==this.options.droppable)}};this._prepareLists("selected","available",c);this._prepareLists("available","selected",c);this._registerSearchEvents(this.availableContainer.find("input.search"),true);this._setBusy(false);this.container.find(".remove-all").bind("click.multiselect",function(){d.selectNone();return false;});this.container.find(".add-all").bind("click.multiselect",function(){d.selectAll();return false;});this.container.width(this.element.width()+281);this._refreshDividerLocation();this.availableActions.find("input").width(Math.max(this.availableActions.width()-this.availableActions.find("a.add-all").width()-30,100));this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1));this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1));this._populateLists(this.element.find("option"));}},slideToggle:function(){if(this.options.hidden){this.options.hidden=!this.options.hidden;this._create();}else{this.container.slideToggle();}},destroy:function(){this.container.remove();this.element.show();b.widget.prototype.destroy.apply(this,arguments);},isBusy:function(){return !!this.busy;},isSelected:function(c){if(this.enabled()){return !!this._findItem(c,this.selectedList);}else{return null;}},selectedValues:function(){return b.map(this.element.find("option[selected]"),function(d,c){return b(d).val();});},enabled:function(c,d){if(undefined!==c){if(c){this.container.unblock();this.element.removeAttr("disabled");}else{this.container.block({message:d||null,overlayCSS:{backgroundColor:"#fff",opacity:0.4,cursor:"default"}});this.element.attr("disabled",true);}}return !this.element.attr("disabled");},selectAll:function(){if(this.enabled()){this._batchSelect(this.availableList.children("li.ui-element:visible"),true);}},selectNone:function(){if(this.enabled()){this._batchSelect(this.selectedList.children("li.ui-element:visible"),false);}},select:function(d){if(this.enabled()){var c=this._findItem(d,this.availableList);if(c){this._setSelected(c,true);}}},deselect:function(d){if(this.enabled()){var c=this._findItem(d,this.selectedList);if(c){this._setSelected(c,false);}}},search:function(d){if(!this.busy&&this.enabled()&&this.options.searchable){var c=this.availableActions.children("input:first");c.val(d);c.trigger("keydown.multiselect");}},addOptions:function(e){if(this.enabled()){this._setBusy(true);var d=[];if(e=this.options.dataParser.call(this,e)){for(var c in e){if(this.element.find('option[value="'+c+'"]').size()==0){d.push(b('<option value="'+c+'"/>').text(e[c].value).appendTo(this.element)[0]);}}}if(d.length>0){this._populateLists(b(d));}this._filter(this.availableList.children("li.ui-element"));this._setBusy(false);return d.length;}else{return false;}},_setData:function(c,d){switch(c){case"dividerLocation":this.options.dividerLocation=d;this._refreshDividerLocation();break;case"searchable":this.options.searchable=d;this._registerSearchEvents(this.availableContainer.find("input.search"),false);break;case"droppable":case"sortable":this._messages(b.ui.multiselect.constants.MESSAGE_WARNING,b.ui.multiselect.locale.errorReadonly,{option:c});default:this.options[c]=d;break;}},_ui:function(d){var c={sender:this.element};switch(d){case"message":c.type=arguments[1];c.message=arguments[2];break;case"selection":c.option=arguments[1];break;}return c;},_messages:function(c,e,d){this._trigger("messages",null,this._ui("message",c,b.tmpl(e,d)));},_refreshDividerLocation:function(){this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation)+110);this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation))+170);},_prepareLists:function(e,c,h){var g=this;var j=("selected"==e);var i=this[e+"List"];var f=this[c+"List"];var d=h[c].sortable?a:"clone";i.data("multiselect.sortable",h[e].sortable).data("multiselect.droppable",h[e].droppable).data("multiselect.draggable",!h[e].sortable&&(h[c].sortable||h[c].droppable));if(h[e].sortable){i.sortable({appendTo:this.container,connectWith:f,containment:this.container,helper:d,items:"li.ui-element",revert:!(h[c].sortable||h[c].droppable),receive:function(k,m){if(h[c].sortable){var l=m.item.data("multiselect.optionLink");g._applyItemState(m.item.hide(),j);if(f.data("multiselect.cache")[l.val()]){delete f.data("multiselect.cache")[l.val()];}m.item.hide();g._setSelected(m.item,j,true);}else{setTimeout(function(){g._setSelected(m.item,j);},10);}},stop:function(k,l){g._moveOptionNode(l.item);}});}if(!(h[e].sortable&&h[c].sortable)&&(h[e].droppable||h[c].sortable||h[c].droppable)){i.droppable({accept:".ui-multiselect li.ui-element",hoverClass:"ui-state-highlight",revert:!(h[c].sortable||h[c].droppable),greedy:true,drop:function(k,m){if(!m.draggable.data("multiselect.optionLink")){var l=m.helper.data("multiselect.optionLink");m.draggable.data("multiselect.optionLink",l);if(i.data("multiselect.cache")[l.val()]){delete i.data("multiselect.cache")[l.val()];}i.data("multiselect.cache")[l.val()]=m.draggable;g._applyItemState(m.draggable,j);}else{if(!h[e].sortable){setTimeout(function(){m.draggable.hide();g._setSelected(m.draggable,j);},10);}}}});}},_populateLists:function(c){this._setBusy(true);var d=this;setTimeout(function(){b(c.each(function(e){var g=(this.selected?d.selectedList:d.availableList);var f=d._getOptionNode(this).show();d._applyItemState(f,this.selected);f.data("multiselect.idx",e);g.data("multiselect.cache")[f.data("multiselect.optionLink").val()]=f;d._insertToList(f,g);}));d._setBusy(false);d._updateCount();},1);},_insertToList:function(e,f){var d=this;this._setBusy(true);var g=0;var c=function(){var h=(d.options.nodeComparator?d._getSuccessorNode(e,f):null);try{if(h){e.insertBefore(h);}else{f.append(e);}if(f===d.selectedList){d._moveOptionNode(e);}if("function"==typeof d.options.nodeInserted){d.options.nodeInserted(e);}d._setBusy(false);}catch(i){if(g++<10){setTimeout(function(){c();},1);}else{d._messages(b.ui.multiselect.constants.MESSAGE_EXCEPTION,b.ui.multiselect.locale.errorInsertNode,{key:e.data("multiselect.optionLink").val(),value:e.text()});d._setBusy(false);}}};c();},_updateCount:function(){var e=this;if(this.busy){setTimeout(function(){e._updateCount();},100);}var d=this.selectedList.children("li:not(.ui-helper-hidden-accessible,.ui-sortable-placeholder):visible").size();var c=this.availableList.children("li:not(.ui-helper-hidden-accessible,.ui-sortable-placeholder,.shadowed)").size()+d;this.selectedContainer.find("span.count").text(b.tmpl(b.ui.multiselect.locale.itemsCount,{count:d})).attr("title",b.tmpl(b.ui.multiselect.locale.itemsTotal,{count:c}));},_getOptionNode:function(c){c=b(c);var d=b('<li class="ui-state-default ui-element"><span class="ui-icon"/>'+c.text()+'<a href="#" class="ui-state-default action"><span class="ui-corner-all ui-icon"/></a></li>').hide();d.data("multiselect.optionLink",c);return d;},_moveOptionNode:function(c){setTimeout(function(){var f=c.data("multiselect.optionLink");if(f){var d=c.prev("li:not(.ui-helper-hidden-accessible,.ui-sortable-placeholder):visible");var e=d.size()?d.data("multiselect.optionLink"):null;if(e){f.insertAfter(e);}else{f.prependTo(f.parent());}}},100);},_findItem:function(e,d){var c=null;d.children("li.ui-element:visible").each(function(f,g){g=b(g);if(g.text().toLowerCase()===e.toLowerCase()){c=g;}});if(c&&c.size()){return c;}else{return false;}},_cloneWithData:function(j,g,c){var e=this;var i=j.data("multiselect.optionLink").val();var d=("selected"==g);var f=(d?this.selectedList:this.availableList);var h=f.data("multiselect.cache")[i];if(!h){h=j.clone().hide();this._applyItemState(h,d);f.data("multiselect.cache")[i]=h;h.data("multiselect.optionLink",j.data("multiselect.optionLink"));h.data("multiselect.idx",j.data("multiselect.idx"));if(c){this._insertToList(h,f);}}else{h.data("multiselect.idx",j.data("multiselect.idx"));}return h;},_batchSelect:function(e,d){this._setBusy(true);var c=this;setTimeout(function(){var f={animated:c.options.animated,hide:c.options.hide,show:c.options.show};c.options.animated=null;c.options.hide="hide";c.options.show="show";e.each(function(h,g){c._setSelected(b(g),d);});if(!d){c._filter(c.availableList.find("li.ui-element"));}b.extend(c.options,f);c._updateCount();c._setBusy(false);},10);},_getSuccessorNode:function(g,j){var e=j.find("li.ui-element"),d=this.options.nodeComparator;var h=e.size();if(e.size()==0){return null;}var c,f=Math.min(g.data("multiselect.idx"),h-1),k=d(g,b(e[f]));if(k){if(0>k&&0>=f){c=e[0];}else{if(0<k&&h-1<=f){f++;c=null;}else{while(f>=0&&f<e.length){k>0?f++:f--;if(f<0){c=g[0];}if(k!=d(g,b(e[f]))){c=e[k>0?f:f+1];break;}}}}}else{c=e[f];}g.data("multiselect.idx",f);return c;},_setSelected:function(g,e,c){var f=this,d;var h=g.data("multiselect.optionLink");if(e){if(h.attr("selected")){return;}h.attr("selected","selected");if(c){d=g;}else{d=this._cloneWithData(g,"selected",true).hide();g.addClass("shadowed")[this.options.hide](this.options.animated,function(){f._updateCount();});}d[this.options.show](this.options.animated);}else{if(!h.attr("selected")){return;}h.removeAttr("selected");if(c){d=g;}else{d=this._cloneWithData(g,"available",true).hide().removeClass("shadowed");g[this.options.hide](this.options.animated,function(){f._updateCount();});}if(!d.is(".filtered")){d[this.options.show](this.options.animated);}}if(!this.busy){if(this.options.animated){d.fadeTo("fast",0.3,function(){b(this).fadeTo("fast",1);});}}this._trigger(e?"selected":"deselected",null,this._ui("selection",h));return d;},_setBusy:function(e){var c=this.availableActions.children("input.search");var d=this.availableActions.children(".busy");this.busy=Math.max(e?++this.busy:--this.busy,0);this.container.find("a.remove-all, a.add-all")[this.busy?"hide":"show"]();if(e&&(1==this.busy)){if(this.options.searchable){c.data("multiselect.hadFocus",c.data("multiselect.hasFocus"));c.blur().hide();}d.show();}else{if(!this.busy){if(this.options.searchable){c.show();if(c.data("multiselect.hadFocus")){c.focus();}}d.hide();}}},_applyItemState:function(d,c){if(c){d.children("span").addClass("ui-helper-hidden").removeClass("ui-icon");d.find("a.action span").addClass("ui-icon-minus").removeClass("ui-icon-plus");this._registerRemoveEvents(d.find("a.action"));}else{d.children("span").addClass("ui-helper-hidden").removeClass("ui-icon");d.find("a.action span").addClass("ui-icon-plus").removeClass("ui-icon-minus");this._registerAddEvents(d.find("a.action"));}this._registerHoverEvents(d);this._registerDoubleClickEvents(d);return d;},_filter:function(e){var c=this.availableActions.children("input.search");var d=b.trim(c.val().toLowerCase());if(!d){e.removeClass("filtered");}else{e.each(function(g,f){f=b(f);f[(f.text().toLowerCase().indexOf(d)>=0?"remove":"add")+"Class"]("filtered");});}return e.not(".filtered, .shadowed").show().end().filter(".filtered, .shadowed").hide().end();},_registerDoubleClickEvents:function(c){if(!this.options.doubleClickable){return;}c.dblclick(function(d){if(b(d.target).closest(".action").length===0){c.find("a.action").click();}});},_registerHoverEvents:function(c){c.unbind("mouseover.multiselect").bind("mouseover.multiselect",function(){b(this).find("a").andSelf().addClass("ui-state-hover");}).unbind("mouseout.multiselect").bind("mouseout.multiselect",function(){b(this).find("a").andSelf().removeClass("ui-state-hover");}).find("a").andSelf().removeClass("ui-state-hover");},_registerAddEvents:function(d){var c=this;d.unbind("click.multiselect").bind("click.multiselect",function(){if(!this.busy){c._setSelected(b(this).parent(),true);}return false;});if(this.availableList.data("multiselect.draggable")){d.each(function(){b(this).parent().draggable({connectToSortable:c.selectedList,helper:a,appendTo:c.container,containment:c.container,revert:"invalid"});});if(this.selectedList.data("multiselect.sortable")){this.selectedList.sortable("refresh");}}},_registerRemoveEvents:function(d){var c=this;d.unbind("click.multiselect").bind("click.multiselect",function(){if(!c.busy){c._setSelected(b(this).parent(),false);}return false;});if(this.selectedList.data("multiselect.draggable")){d.each(function(){b(this).parent().draggable({connectToSortable:c.availableList,helper:a,appendTo:c.container,containment:c.container,revert:"invalid"});});if(this.availableList.data("multiselect.sortable")){this.availableList.sortable("refresh");}}},_registerSearchEvents:function(e,g){var f=this;var d=e.val(),i;var h=function(j){if(f.busy){return;}var k=e.val();if((k!=d)||(j)){f._setBusy(true);if(f.options.remoteUrl){var m=b.extend({},f.options.remoteParams);try{b.ajax({url:f.options.remoteUrl,data:b.extend(m,{q:escape(k)}),success:function(n){f.addOptions(n);f._setBusy(false);},error:function(o,n,p){f._messages(b.ui.multiselect.constants.MESSAGE_ERROR,b.ui.multiselect.locale.errorRequest,{status:n});f._setBusy(false);}});}catch(l){f._messages(b.ui.multiselect.constants.MESSAGE_EXCEPTION,l.message);f._setBusy(false);}}else{f._filter(f.availableList.children("li.ui-element"));f._setBusy(false);}d=k;}};e.unbind("focus.multiselect blur.multiselect keydown.multiselect keypress.multiselect");if(this.options.searchable){e.bind("focus.multiselect",function(){b(this).addClass("ui-state-active").data("multiselect.hasFocus",true);}).bind("blur.multiselect",function(){b(this).removeClass("ui-state-active").data("multiselect.hasFocus",false);}).bind("keydown.multiselect keypress.multiselect",function(j){if(i){clearTimeout(i);}switch(j.which){case 13:h(true);return false;default:i=setTimeout(function(){h();},Math.max(f.options.searchDelay,1));}}).show();}else{e.val("").hide();this._filter(f.availableList.find("li.ui-element"));}var c=function(){if(f.busy){setTimeout(function(){c();},100);}h(true);};if(g){c();}}});var a=function(d,e){var c=b(d.target);var f=c.clone().width(c.width());f.data("multiselect.optionLink",c.data("multiselect.optionLink")).data("multiselect.list",c.parent()).find("a").remove();return f;};b.extend(b.ui.multiselect,{getter:"selectedValues enabled isBusy",locale:{addAll:"Add all",removeAll:"Remove all",itemsCount:"#{count} items selected",itemsTotal:"#{count} items total",busy:"please wait...",errorDataFormat:"Cannot add options, unknown data format",errorInsertNode:"There was a problem trying to add the item:\n\n\t[#{key}] => #{value}\n\nThe operation was aborted.",errorReadonly:"The option #{option} is readonly",errorRequest:"Sorry! There seemed to be a problem with the remote call. (Type: #{status})"},constants:{MESSAGE_WARNING:0,MESSAGE_EXCEPTION:1,MESSAGE_ERROR:2}});})(jQuery);(function(a){var b=/#\{([^{}]*)}/g;a.extend({tmpl:function(d){d=d||"";var e=(2===arguments.length&&"object"===typeof arguments[1]?arguments[1]:Array.prototype.slice.call(arguments,1));var c=function(g,f){return typeof e[f]==="string"||typeof e[f]==="number"?e[f]:g;};return d.replace(b,c);}});})(jQuery);
package.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Levementum_Groupedproduct</name>
4
+ <version>1.0.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>Levementum&#x2019;s Grouped Product Grid extension allows the addition of any attribute in any order with sorting functionality to the grouped product table.</summary>
10
+ <description>The grouped product page has no options for sorting, adding other attributes or any modification beyond adding additional products to it. In addition, the location on the product page allows very little space to add large number of products or additional columns. This extension solves both of those problems.</description>
11
+ <notes>Display Attributes &#xD;
12
+ - Ability to display custom attributes on the front-end&#xD;
13
+ - Ability to sort your grouped products by attributes&#xD;
14
+ - Adding and Removing display attributes as needed&#xD;
15
+ Admin Controls &#xD;
16
+ - Fully customizable controls using Magento Administrator Panel&#xD;
17
+ - Simple drag and drop functionality&#xD;
18
+ Environments Supported&#xD;
19
+ - Magento Enterprise 1.12.x&#xD;
20
+ Support&#xD;
21
+ - Intuitive User Manual&#xD;
22
+ - Grouped Product Grid extension&#x2019;s functional logic is 100% Open Source</notes>
23
+ <authors><author><name>Levementum, LLC</name><user>levementum</user><email>gmobisson@levementum.com</email></author><author><name>Ian Coast</name><user>icoast</user><email>icoast@levementum.com</email></author></authors>
24
+ <date>2013-02-08</date>
25
+ <time>21:01:03</time>
26
+ <contents><target name="mageetc"><dir name="modules"><file name="Levementum_LevCore.xml" hash="7764170422ae762e6a28ea7e345d8f94"/><file name="Levementum_Groupedproduct.xml" hash="2e6537bbcade774595aa6d45a9faa45b"/></dir></target><target name="magecommunity"><dir name="Levementum"><dir name="Groupedproduct"><dir name="Block"><dir name="Adminhtml"><dir name="Sets"><dir name="Edit"><file name="Form.php" hash="bdd9a99c152fbb15aebeec2e20421ae6"/></dir><file name="Edit.php" hash="b7c65585a8f78b764fcb83db4bc311cc"/><file name="Grid.php" hash="8f424c7a2ac307461cf5422b0ad7d2ee"/></dir><file name="Sets.php" hash="65be51c95cd9ed9dcaa3ef36cceee567"/><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Primary.php" hash="57d0697febfb39185de200808348342f"/></dir></dir></dir></dir></dir><dir name="Catalog"><dir name="Form"><dir name="Renderer"><dir name="Fieldset"><file name="Element.php" hash="ab41e65718ad6aef085e8711ddbc6d59"/><file name="Primary.php" hash="534755d4009feca7cd903a6be2dd86ee"/></dir></dir></dir></dir><dir name="Product"><dir name="View"><dir name="Type"><file name="Grouped.php" hash="ddb37e31406f8563f669a9227f7a8e1e"/></dir></dir></dir><file name="Toolbar.php" hash="e02b248f53d3f51ca54bebfae73f93f8"/></dir><dir name="Helper"><file name="Admin.php" hash="5ae87d13170f21bab33c682e0b953b4a"/><file name="Config.php" hash="0c717e7b20ed12f51e9ce68e946606c1"/><file name="Data.php" hash="0a801284fcd2f974e9f565675578a22e"/><file name="Sets.php" hash="431a4153d024c03d7d8cbac198ab7267"/></dir><dir name="Model"><dir name="Backend"><file name="Option.php" hash="c2af6b7b39d56297b66a27a936b524ca"/></dir><dir name="Entity"><file name="Setup.php" hash="dd1e4548151e4b1f82386daa8c9d94d4"/></dir><dir name="ImportExport"><dir name="Export"><dir name="Entity"><dir name="Product"><dir name="Type"><file name="Grouped.php" hash="bfd29b5209996625b657fcef4352bacf"/></dir></dir></dir></dir></dir><file name="Observer.php" hash="2eabfc8575eb9baf0fe576ce1f21a9f3"/><dir name="PageCache"><dir name="Container"><file name="Groupedproduct.php" hash="5fe42e7a725b6f1abe3ef3c2d3d5ca94"/></dir></dir><dir name="Product"><dir name="Type"><file name="Grouped.php" hash="fb6151ad2fa9c9a305906e1cac01b818"/></dir></dir><dir name="Resource"><dir name="Sets"><file name="Collection.php" hash="8c0ba8fbad124c4a4592a2d50a85033f"/></dir><file name="Sets.php" hash="4d373f3df306d46801df075a2cf2ba58"/></dir><file name="Sets.php" hash="b20f8383624318f725e962bd332af1fa"/><dir name="Source"><file name="Option.php" hash="1765cd36060d5c943488f9c914c5b00b"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="AllNumber.php" hash="63478a4f1b0cabbff4c5435481a58fc3"/><file name="Attributes.php" hash="2eb7e9b33bf9ead41b16140f1d6ba4a3"/><file name="Datatables.php" hash="205e56f8465ab5043b7103273bf4cbab"/><file name="List.php" hash="09e04d8ba7d0dbd4ae65cfaddc91ed10"/><file name="Options.php" hash="a391f38683aa3c90784e7dafd0eada49"/><file name="Pagination.php" hash="63478a4f1b0cabbff4c5435481a58fc3"/><file name="PaginationDisplay.php" hash="c3550af00f6a6daaf4be983b5fb96787"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="SetsController.php" hash="f751b14dfae2a3a0920a364f80e3084e"/></dir></dir><dir name="data"><dir name="levementum_groupedproduct_setup"><file name="data-install-1.0.0.php" hash="d51c45fb86fc2a67bbdd77b67e0002ac"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="9de6026b465afdcfda241be4f266916c"/><file name="cache.xml" hash="4bb08b8d82e0274dcb167f2bddba6cb6"/><file name="config.xml" hash="e250ee1d2c0c488075716e22c6b63a60"/><file name="system.xml" hash="edd1808bb8f92c8368b24b919b27cc83"/></dir><dir name="sql"><dir name="levementum_groupedproduct_setup"><file name="mysql4-install-1.0.0.php" hash="7550ab5913746bef592e949b4fb59f6c"/></dir></dir></dir><dir name="LevCore"><dir name="Block"><dir name="Adminhtml"><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Nowrap.php" hash="57a088ceba0081b39f9de1a5c0af6855"/></dir></dir></dir></dir></dir><dir name="Customer"><dir name="Account"><file name="Navigation.php" hash="0898228c6a013ba622f8c06d7cb0bca1"/></dir></dir><file name="LevCore.php" hash="3642b768319015885bfe8cf89936971e"/><dir name="System"><file name="Html.php" hash="778bf687c57c0903471a4e183b68f1c5"/></dir></dir><dir name="Helper"><dir name="Core"><file name="Data.php" hash="aac017ace8fc53b64bc6665f2a7f5beb"/></dir><file name="Data.php" hash="922fdccbd0eb581a2136edd0d1ffa50e"/></dir><dir name="Model"><dir name="PageCache"><dir name="Container"><file name="Tabs.php" hash="f42dd7766b197f8180e8052775b48d8a"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Attributes.php" hash="cc9766a4d479edf010f146e337a1efc6"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="2f1f470fbb9a3596953fedd992ba3d8c"/><file name="config.xml" hash="9572fbba4f810d3298b4d74e25f7bae7"/><file name="system.xml" hash="b13a3090262cb40a107cbcb724989d00"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="levementum"><file name="groupedproduct.xml" hash="669f3e2a42f50131e4a3d7dd6232fbcc"/><file name="levcore.xml" hash="86c38088e074ce50f1ae0c982ceaedc0"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="enterprise"><dir name="default"><dir name="layout"><dir name="levementum"><file name="groupedproduct.xml" hash="0c8f05dd3f11b3a3d8eeb933fff1e2f5"/><file name="levcore.xml" hash="31c97776ef7d46e031f547e0c7ac8ecf"/></dir></dir><dir name="template"><dir name="levementum"><dir name="groupedproduct"><dir name="product"><dir name="list"><file name="toolbar.phtml" hash="3b5b87094ccfc95e5af00d131524c728"/></dir><dir name="view"><file name="addto.phtml" hash="0e7352f26f57d280d2ee07166a0d621d"/><file name="addtocart.phtml" hash="f0432632a0c86a05e371c81b48bfe185"/><file name="tierprices-basic.phtml" hash="61ae342839c96e0b8b1f4ba24b26712e"/><dir name="type"><file name="grouped.phtml" hash="4938425a0318a03d2dd249f9b6dd13d2"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="levementum"><dir name="levcore"><file name="jquery-1.8.3.min.js" hash="247a7eaa388418ed0d74091f1ead7875"/><file name="jquery-ui-1.10.0.custom.min.js" hash="f2090c8c47e226dd473c64e02a85f7e5"/><file name="levcore.js" hash="ef9e849450d37cd2eff37d24c7ce6e54"/><file name="levcore.validation.js" hash="3b1f5faf0856a778009fa6b660ea2f0b"/><file name="ui.multiselect.js" hash="9a77ab76537e9d32af7f82774a14663f"/><file name="ui.multiselect.min.js" hash="cb7f63fffcea559245bf669115c8e985"/></dir></dir></dir><dir name="doc"><file name="Grouped Product Grid Overview.pdf" hash="85ef37a0103c929bf84be1984d771f15"/><file name="Levementum Grouped Product Datasheet.pdf" hash="b8565d0968ab2459260f6584a2e38e40"/><file name="Levementum Groupedproduct Installation Doc.pdf" hash="5018ef51246b21fbd41fcd25d0c4c543"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="levementum"><dir name="css"><file name="jqueryui-custom.css" hash="c0fe3310ed021d8f08e70b70304fbc84"/><file name="levcore.css" hash="e7cd904b4c19ea2995378c62e24a6225"/></dir><dir name="images"><file name="bkg_collapse.gif" hash="2333c68e38163ed4656da82b9bcf362b"/><file name="ui-bg_flat_0_aaaaaa_40x100.png" hash="2a44fbdb7360c60122bcf6dcef0387d8"/><file name="ui-bg_flat_55_fbec88_40x100.png" hash="2b8885da50e2324557185fb0890ce2b7"/><file name="ui-bg_glass_75_d0e5f5_1x400.png" hash="f5d28f9ed0eead945e114696ae7b4c67"/><file name="ui-bg_glass_85_dfeffc_1x400.png" hash="e4710322ded115c72efbd0756234b6f2"/><file name="ui-bg_glass_95_fef1ec_1x400.png" hash="5a3be2d8fff8324d59aec3df7b0a0c83"/><file name="ui-bg_gloss-wave_55_5c9ccc_500x100.png" hash="527d96cb51eaa54fa74a90db078008c4"/><file name="ui-bg_inset-hard_100_f5f8f9_1x100.png" hash="3964ec1cd6fcbc20fbc2ed63d320caf6"/><file name="ui-bg_inset-hard_100_fcfdfd_1x100.png" hash="2b6a88b05b94c56fb478fe70dad68cdc"/><file name="ui-icons_217bc0_256x240.png" hash="554c48c5f8473498722bb780a21a8ddb"/><file name="ui-icons_2e83ff_256x240.png" hash="2b99a5e48d3c3957d03027d36a25e8bb"/><file name="ui-icons_469bdd_256x240.png" hash="6572c4e13eaa937ff62163ee7faaf33f"/><file name="ui-icons_6da8d5_256x240.png" hash="e8c27ebeffa1fd7a6182f34603be7f87"/><file name="ui-icons_cd0a0a_256x240.png" hash="3e450c2a2c66328d9498e7001ad7197c"/><file name="ui-icons_d8e7f3_256x240.png" hash="d0ce317b678bef704b7732a35d1fedae"/><file name="ui-icons_f9bd01_256x240.png" hash="50200576c149315cf45b3293e427a671"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="enterprise"><dir name="default"><dir name="levementum"><dir name="css"><file name="groupedproduct.css" hash="f9194985204dd3c8ec4ddde4ab1aa9e1"/></dir><dir name="datatables"><dir name="css"><file name="jquery.dataTables.css" hash="e7a7a95f376ed26b22dbbcb30d66f7f0"/><file name="jquery.dataTables_themeroller.css" hash="5d897baa3dd4f490a9950b5f6fcfc98f"/></dir><dir name="images"><file name="Sorting icons.psd" hash="9c287dd51872df723c35176fdcb4893d"/><file name="back_disabled.png" hash="574c1fdbe98e07b336aeee94514cba7f"/><file name="back_enabled.png" hash="2998e23d43af7c7857149b0e725ccad6"/><file name="back_enabled_hover.png" hash="9d29134dd5e1c2192916ef9104dd877e"/><file name="favicon.ico" hash="c30dc560221bcc0645b55eff79b4741e"/><file name="forward_disabled.png" hash="72ead25432b5a84031b8333aa5fbf259"/><file name="forward_enabled.png" hash="a8c664b8219ffde978db3d8308713975"/><file name="forward_enabled_hover.png" hash="9be5f327f16bcad317c8ad0ae92635d8"/><file name="sort_asc.png" hash="6c56b94fd0540844a7118cdff565b0ae"/><file name="sort_asc_disabled.png" hash="64f2d23d70cb2b2810031880f554b13c"/><file name="sort_both.png" hash="94b34ff5224ba38210d67623bb1a1504"/><file name="sort_desc.png" hash="8f88d990024975797f96ce7648dacd2f"/><file name="sort_desc_disabled.png" hash="d48475e6c742940f44e62622e16865b9"/></dir><dir name="js"><file name="jquery.dataTables.js" hash="9431bf907932c515d76041fbae6db5ce"/><file name="jquery.dataTables.plugins.js" hash="420680fbcbeabcfdc5b398c8da4f41f3"/><file name="jquery.js" hash="2a410e352d5137af6e651365228eebbd"/></dir></dir><dir name="images"><dir name="levementum"><file name="bkg_pager.gif" hash="c0a6da7453b9e834973f71029adcaadb"/><file name="bkg_viewmode.gif" hash="c856e743e1ac799628160891385d12c4"/></dir></dir></dir></dir></dir></dir></target></contents>
27
+ <compatible/>
28
+ <dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
29
+ </package>
skin/adminhtml/default/default/levementum/css/jqueryui-custom.css ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery UI CSS Framework 1.8.20
3
+ *
4
+ * Copyright 2012, 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:before, .ui-helper-clearfix:after { content: ""; display: table; }
17
+ .ui-helper-clearfix:after { clear: both; }
18
+ .ui-helper-clearfix { zoom: 1; }
19
+ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
20
+
21
+
22
+ /* Interaction Cues
23
+ ----------------------------------*/
24
+ .ui-state-disabled { cursor: default !important; }
25
+
26
+
27
+ /* Icons
28
+ ----------------------------------*/
29
+
30
+ /* states and images */
31
+ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
32
+
33
+
34
+ /* Misc visuals
35
+ ----------------------------------*/
36
+
37
+ /* Overlays */
38
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
39
+
40
+
41
+ /*!
42
+ * jQuery UI CSS Framework 1.8.20
43
+ *
44
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
45
+ * Dual licensed under the MIT or GPL Version 2 licenses.
46
+ * http://jquery.org/license
47
+ *
48
+ * http://docs.jquery.com/UI/Theming/API
49
+ *
50
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=5px&bgColorHeader=5c9ccc&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=06_inset_hard.png&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=02_glass.png&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=06_inset_hard.png&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&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
51
+ */
52
+
53
+
54
+ /* Component containers
55
+ ----------------------------------*/
56
+ .ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; }
57
+ .ui-widget .ui-widget { font-size: 1em; }
58
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; }
59
+ .ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(../images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }
60
+ .ui-widget-content a { color: #222222; }
61
+ .ui-widget-header { border: 1px solid #4297d7; background: #5c9ccc url(../images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
62
+ .ui-widget-header a { color: #ffffff; }
63
+
64
+ /* Interaction states
65
+ ----------------------------------*/
66
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #c5dbec; background: #dfeffc url(../images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2e6e9e; }
67
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2e6e9e; text-decoration: none; }
68
+ .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 #79b7e7; background: #d0e5f5 url(../images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1d5987; }
69
+ .ui-state-hover a, .ui-state-hover a:hover { color: #1d5987; text-decoration: none; }
70
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #79b7e7; background: #f5f8f9 url(../images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #e17009; }
71
+ .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #e17009; text-decoration: none; }
72
+ .ui-widget :active { outline: none; }
73
+
74
+ /* Interaction Cues
75
+ ----------------------------------*/
76
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fad42e; background: #fbec88 url(../images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x; color: #363636; }
77
+ .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
78
+ .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; }
79
+ .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
80
+ .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
81
+ .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
82
+ .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
83
+ .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
84
+
85
+ /* Icons
86
+ ----------------------------------*/
87
+
88
+ /* states and images */
89
+ .ui-icon { width: 16px; height: 16px; background-image: url(../images/ui-icons_469bdd_256x240.png); }
90
+ .ui-widget-content .ui-icon {background-image: url(../images/ui-icons_469bdd_256x240.png); }
91
+ .ui-widget-header .ui-icon {background-image: url(../images/ui-icons_d8e7f3_256x240.png); }
92
+ .ui-state-default .ui-icon { background-image: url(../images/ui-icons_6da8d5_256x240.png); }
93
+ .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(../images/ui-icons_217bc0_256x240.png); }
94
+ .ui-state-active .ui-icon {background-image: url(../images/ui-icons_f9bd01_256x240.png); }
95
+ .ui-state-highlight .ui-icon {background-image: url(../images/ui-icons_2e83ff_256x240.png); }
96
+ .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(../images/ui-icons_cd0a0a_256x240.png); }
97
+
98
+ /* positioning */
99
+ .ui-icon-carat-1-n { background-position: 0 0; }
100
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
101
+ .ui-icon-carat-1-e { background-position: -32px 0; }
102
+ .ui-icon-carat-1-se { background-position: -48px 0; }
103
+ .ui-icon-carat-1-s { background-position: -64px 0; }
104
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
105
+ .ui-icon-carat-1-w { background-position: -96px 0; }
106
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
107
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
108
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
109
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
110
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
111
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
112
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
113
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
114
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
115
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
116
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
117
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
118
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
119
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
120
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
121
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
122
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
123
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
124
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
125
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
126
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
127
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
128
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
129
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
130
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
131
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
132
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
133
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
134
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
135
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
136
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
137
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
138
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
139
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
140
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
141
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
142
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
143
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
144
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
145
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
146
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
147
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
148
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
149
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
150
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
151
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
152
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
153
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
154
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
155
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
156
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
157
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
158
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
159
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
160
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
161
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
162
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
163
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
164
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
165
+ .ui-icon-extlink { background-position: -32px -80px; }
166
+ .ui-icon-newwin { background-position: -48px -80px; }
167
+ .ui-icon-refresh { background-position: -64px -80px; }
168
+ .ui-icon-shuffle { background-position: -80px -80px; }
169
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
170
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
171
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
172
+ .ui-icon-folder-open { background-position: -16px -96px; }
173
+ .ui-icon-document { background-position: -32px -96px; }
174
+ .ui-icon-document-b { background-position: -48px -96px; }
175
+ .ui-icon-note { background-position: -64px -96px; }
176
+ .ui-icon-mail-closed { background-position: -80px -96px; }
177
+ .ui-icon-mail-open { background-position: -96px -96px; }
178
+ .ui-icon-suitcase { background-position: -112px -96px; }
179
+ .ui-icon-comment { background-position: -128px -96px; }
180
+ .ui-icon-person { background-position: -144px -96px; }
181
+ .ui-icon-print { background-position: -160px -96px; }
182
+ .ui-icon-trash { background-position: -176px -96px; }
183
+ .ui-icon-locked { background-position: -192px -96px; }
184
+ .ui-icon-unlocked { background-position: -208px -96px; }
185
+ .ui-icon-bookmark { background-position: -224px -96px; }
186
+ .ui-icon-tag { background-position: -240px -96px; }
187
+ .ui-icon-home { background-position: 0 -112px; }
188
+ .ui-icon-flag { background-position: -16px -112px; }
189
+ .ui-icon-calendar { background-position: -32px -112px; }
190
+ .ui-icon-cart { background-position: -48px -112px; }
191
+ .ui-icon-pencil { background-position: -64px -112px; }
192
+ .ui-icon-clock { background-position: -80px -112px; }
193
+ .ui-icon-disk { background-position: -96px -112px; }
194
+ .ui-icon-calculator { background-position: -112px -112px; }
195
+ .ui-icon-zoomin { background-position: -128px -112px; }
196
+ .ui-icon-zoomout { background-position: -144px -112px; }
197
+ .ui-icon-search { background-position: -160px -112px; }
198
+ .ui-icon-wrench { background-position: -176px -112px; }
199
+ .ui-icon-gear { background-position: -192px -112px; }
200
+ .ui-icon-heart { background-position: -208px -112px; }
201
+ .ui-icon-star { background-position: -224px -112px; }
202
+ .ui-icon-link { background-position: -240px -112px; }
203
+ .ui-icon-cancel { background-position: 0 -128px; }
204
+ .ui-icon-plus { background-position: -16px -128px; }
205
+ .ui-icon-plusthick { background-position: -32px -128px; }
206
+ .ui-icon-minus { background-position: -48px -128px; }
207
+ .ui-icon-minusthick { background-position: -64px -128px; }
208
+ .ui-icon-close { background-position: -80px -128px; }
209
+ .ui-icon-closethick { background-position: -96px -128px; }
210
+ .ui-icon-key { background-position: -112px -128px; }
211
+ .ui-icon-lightbulb { background-position: -128px -128px; }
212
+ .ui-icon-scissors { background-position: -144px -128px; }
213
+ .ui-icon-clipboard { background-position: -160px -128px; }
214
+ .ui-icon-copy { background-position: -176px -128px; }
215
+ .ui-icon-contact { background-position: -192px -128px; }
216
+ .ui-icon-image { background-position: -208px -128px; }
217
+ .ui-icon-video { background-position: -224px -128px; }
218
+ .ui-icon-script { background-position: -240px -128px; }
219
+ .ui-icon-alert { background-position: 0 -144px; }
220
+ .ui-icon-info { background-position: -16px -144px; }
221
+ .ui-icon-notice { background-position: -32px -144px; }
222
+ .ui-icon-help { background-position: -48px -144px; }
223
+ .ui-icon-check { background-position: -64px -144px; }
224
+ .ui-icon-bullet { background-position: -80px -144px; }
225
+ .ui-icon-radio-off { background-position: -96px -144px; }
226
+ .ui-icon-radio-on { background-position: -112px -144px; }
227
+ .ui-icon-pin-w { background-position: -128px -144px; }
228
+ .ui-icon-pin-s { background-position: -144px -144px; }
229
+ .ui-icon-play { background-position: 0 -160px; }
230
+ .ui-icon-pause { background-position: -16px -160px; }
231
+ .ui-icon-seek-next { background-position: -32px -160px; }
232
+ .ui-icon-seek-prev { background-position: -48px -160px; }
233
+ .ui-icon-seek-end { background-position: -64px -160px; }
234
+ .ui-icon-seek-start { background-position: -80px -160px; }
235
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
236
+ .ui-icon-seek-first { background-position: -80px -160px; }
237
+ .ui-icon-stop { background-position: -96px -160px; }
238
+ .ui-icon-eject { background-position: -112px -160px; }
239
+ .ui-icon-volume-off { background-position: -128px -160px; }
240
+ .ui-icon-volume-on { background-position: -144px -160px; }
241
+ .ui-icon-power { background-position: 0 -176px; }
242
+ .ui-icon-signal-diag { background-position: -16px -176px; }
243
+ .ui-icon-signal { background-position: -32px -176px; }
244
+ .ui-icon-battery-0 { background-position: -48px -176px; }
245
+ .ui-icon-battery-1 { background-position: -64px -176px; }
246
+ .ui-icon-battery-2 { background-position: -80px -176px; }
247
+ .ui-icon-battery-3 { background-position: -96px -176px; }
248
+ .ui-icon-circle-plus { background-position: 0 -192px; }
249
+ .ui-icon-circle-minus { background-position: -16px -192px; }
250
+ .ui-icon-circle-close { background-position: -32px -192px; }
251
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
252
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
253
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
254
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
255
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
256
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
257
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
258
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
259
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
260
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
261
+ .ui-icon-circle-check { background-position: -208px -192px; }
262
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
263
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
264
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
265
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
266
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
267
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
268
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
269
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
270
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
271
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
272
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
273
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
274
+
275
+
276
+ /* Misc visuals
277
+ ----------------------------------*/
278
+
279
+ /* Corner radius */
280
+ .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; -khtml-border-top-left-radius: 5px; border-top-left-radius: 5px; }
281
+ .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; -khtml-border-top-right-radius: 5px; border-top-right-radius: 5px; }
282
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; -khtml-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; }
283
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; -khtml-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
284
+
285
+ /* Overlays */
286
+ .ui-widget-overlay { background: #aaaaaa url(../images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
287
+ .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; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*!
288
+ * jQuery UI Resizable 1.8.20
289
+ *
290
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
291
+ * Dual licensed under the MIT or GPL Version 2 licenses.
292
+ * http://jquery.org/license
293
+ *
294
+ * http://docs.jquery.com/UI/Resizable#theming
295
+ */
296
+ .ui-resizable { position: relative;}
297
+ .ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }
298
+ .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
299
+ .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
300
+ .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
301
+ .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
302
+ .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
303
+ .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
304
+ .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
305
+ .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
306
+ .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*!
307
+ * jQuery UI Selectable 1.8.20
308
+ *
309
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
310
+ * Dual licensed under the MIT or GPL Version 2 licenses.
311
+ * http://jquery.org/license
312
+ *
313
+ * http://docs.jquery.com/UI/Selectable#theming
314
+ */
315
+ .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
316
+
317
+ /* Multiselect
318
+ ----------------------------------*/
319
+
320
+ .ui-multiselect { border: solid 1px; font-size: 0.8em; }
321
+ .ui-multiselect ul { -moz-user-select: none; }
322
+ .ui-multiselect li { margin: 0; padding: 0; cursor: default; line-height: 20px; height: 20px; font-size: 11px; list-style: none; }
323
+ .ui-multiselect li a { color: #999; text-decoration: none; padding: 0; display: block; float: left; cursor: pointer;}
324
+ .ui-multiselect li.ui-draggable-dragging { padding-left: 10px; }
325
+
326
+ .ui-multiselect div.selected { position: relative; padding: 0; margin: 0; border: 0; float:left; }
327
+ .ui-multiselect ul.selected { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; position: relative; width: 100%; }
328
+ .ui-multiselect ul.selected li { }
329
+
330
+ .ui-multiselect div.available { position: relative; padding: 0; margin: 0; border: 0; float:left; border-left: 1px solid; }
331
+ .ui-multiselect ul.available { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; width: 100%; }
332
+ .ui-multiselect ul.available li { padding-left: 10px; }
333
+
334
+ .ui-multiselect .ui-state-default { border: none; margin-bottom: 1px; position: relative; padding-left: 20px;}
335
+ .ui-multiselect .ui-state-hover { border: none; }
336
+ .ui-multiselect .ui-widget-header {border: none; font-size: 11px; margin-bottom: 1px;}
337
+
338
+ .ui-multiselect .add-all { float: right; padding: 7px;}
339
+ .ui-multiselect .remove-all { float: right; padding: 7px;}
340
+ .ui-multiselect .search { float: left; padding: 4px;}
341
+ .ui-multiselect .count { float: left; padding: 7px;}
342
+
343
+ .ui-multiselect li span.ui-icon-arrowthick-2-n-s { position: absolute; left: 2px; }
344
+ .ui-multiselect li a.action { position: absolute; right: 2px; top: 2px; }
345
+
346
+ .ui-multiselect input.search { height: 14px; padding: 1px; opacity: 0.5; margin: 4px; width: 100px; }
347
+
348
+
349
+ .multiselect {
350
+ width: 460px;
351
+ height: 200px;
352
+ }
skin/adminhtml/default/default/levementum/css/levcore.css ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+
2
+ .form-list td.value .levementum-ordered-multiselect + .note { width: 550px; }
3
+
4
+ .cart-tax-total { display:block; padding-right:20px; background:url(../images/bkg_collapse.gif) 100% 3px no-repeat; cursor:pointer; }
5
+ .cart-tax-total-expanded { background-position:100% -54px; }
skin/adminhtml/default/default/levementum/images/bkg_collapse.gif ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-bg_flat_0_aaaaaa_40x100.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-bg_flat_55_fbec88_40x100.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-bg_glass_75_d0e5f5_1x400.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-bg_glass_85_dfeffc_1x400.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-bg_glass_95_fef1ec_1x400.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-bg_inset-hard_100_f5f8f9_1x100.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-bg_inset-hard_100_fcfdfd_1x100.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-icons_217bc0_256x240.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-icons_2e83ff_256x240.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-icons_469bdd_256x240.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-icons_6da8d5_256x240.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-icons_cd0a0a_256x240.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-icons_d8e7f3_256x240.png ADDED
Binary file
skin/adminhtml/default/default/levementum/images/ui-icons_f9bd01_256x240.png ADDED
Binary file
skin/frontend/enterprise/default/levementum/css/groupedproduct.css ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ .grouped-table .paging_full_numbers a.paginate_button.paginate_button_disabled { cursor: default; text-decoration: none; }
3
+ /*.sorter .view-mode strong.grid { background:url(../images/levementum/bkg_viewmode.gif) no-repeat 0 0; float:left; width:24px; height:17px; text-align:left; text-indent:-999em; overflow:hidden; margin:2px 0 0; }*/
4
+
5
+ .grouped-table.grouped-table-list .pager.dataTables_wrapper { padding:0; border-left: 0; border-right: 0;}
6
+
7
+ .pager .grouped-table-pager { width:250px; margin:0 auto;}
8
+ .pager td.grouped-table-pager {width:50%; text-align: center;}
9
+ .grouped-table-list .toolbar-bottom .sorter { border-top: none; border-bottom: 1px solid #d9d9d9; }
10
+
11
+
12
+ .grouped-table .sorter .view-mode a.list-fix,
13
+ .grouped-table .sorter .view-mode a.list,
14
+ .grouped-table .sorter .view-mode strong.list-fix,
15
+ .grouped-table .sorter .view-mode strong.list,
16
+ .grouped-table .sorter .view-mode a.grid-fix,
17
+ .grouped-table .sorter .view-mode a.grid,
18
+ .grouped-table .sorter .view-mode strong.grid-fix,
19
+ .grouped-table .sorter .view-mode strong.grid,
20
+ .grouped-table .sorter .view-mode a.detail-fix,
21
+ .grouped-table .sorter .view-mode a.detail,
22
+ .grouped-table .sorter .view-mode strong.detail-fix,
23
+ .grouped-table .sorter .view-mode strong.detail { background:url(../images/levementum/bkg_viewmode.gif) no-repeat 0 0; float:left; width:23px; height:17px; text-align:left; text-indent:-999em; overflow:hidden; margin:2px 0 -6px; }
24
+
25
+ .grouped-table .sorter .view-mode a.list { background-position: -48px -116px; }
26
+ .grouped-table .sorter .view-mode strong.list { background-position: -48px -145px; }
27
+ .grouped-table .sorter .view-mode a.grid { background-position: -1px 0px; }
28
+ .grouped-table .sorter .view-mode strong.grid { background-position: -1px -29px; }
29
+ .grouped-table .sorter .view-mode a.detail { background-position: -24px -116px; }
30
+ .grouped-table .sorter .view-mode strong.detail { background-position: -24px -145px; }
31
+
32
+ .grouped-table .sorter .view-mode a.list.no-grid { background-position: -48px -116px; }
33
+ .grouped-table .sorter .view-mode strong.list.no-grid { background-position: -48px -145px; }
34
+ .grouped-table .sorter .view-mode a.detail.no-grid { background-position: -2px -174px; }
35
+ .grouped-table .sorter .view-mode strong.detail.no-grid { background-position: -2px -203px; }
36
+
37
+ .grouped-table-list {}
38
+ .grouped-table-grid {}
39
+ .grouped-table-detail {}
40
+ .grouped-table-detail .data-table { border-collapse:collapse; }
41
+ .grouped-table .data-table {border-left: 0; border-right: 0;}
42
+ .grouped-table-grid .data-table {
43
+ /* width: 978px; */
44
+ margin: 25px 0 0 0 !important;
45
+ border-top: none;
46
+ padding: 0 20px;
47
+ border-right: 0;
48
+ border-left: 0;
49
+
50
+ }
51
+ .grouped-table td.sku { width: 20px; white-space: nowrap;}
52
+ .grouped-table table th { vertical-align: bottom; }
53
+ .grouped-table-list .data-table tr:last-child td,
54
+ .grouped-table-list .data-table tr:last-child th,
55
+ .grouped-table-grid .data-table tr:last-child td,
56
+ .grouped-table-grid .data-table tr:last-child th { border-bottom:none; }
57
+ .grouped-table .data-table tbody td {}
58
+ .grouped-table .data-table .data-cell { padding: 0 4px 5px 10px; height: 250px; vertical-align: top;}
59
+ .grouped-table-grid .data-table .data-cell .grid-price { margin: 5px 0 10px 0; }
60
+ .grouped-table-grid .data-table .data-cell .grid-name { }
61
+ .grouped-table-grid .data-table .data-cell .grid-image { margin: 0 0 10px; }
62
+ .grouped-table-grid .data-table .data-cell ul { margin: 0 0 40px 0; }
63
+ .grouped-table .data-table .data-buffer { padding:0 5px; }
64
+ grouped-table .grouped-table-grid .data-table .data-buffer { padding: 5px 12px; }
65
+ .grouped-table .data-table .ul
66
+ .grouped-table-list .box-collateral .box-title { margin:0 0; }
67
+ div.grouped-bottom-product-view {border-top: none; margin-top:-15px; padding-top:20px;}
68
+ div.grouped-bottom-product-view .box-collateral .block-content { padding:20px; }
69
+
70
+ .grouped-table .tier-price,
71
+ .grouped-table .sale-price {white-space:nowrap; color:#c73615; font-weight:bold;}
72
+ .grouped-table .original-price { text-decoration:line-through; color:#989696; }
73
+ .grouped-table .price {font-weight:bold;}
74
+ .grouped-table .special-price .price-label { display:none !important; }
75
+ .grouped-table .tier-prices-grouped .price { font-weight:bold; color:#c73615; }
76
+ .grouped-table .add-to-links li { display:inline-block; }
77
+ .grouped-table .add-to-links a { color:#333333; }
78
+ .grouped-table .add-to-cart { float:right; margin-left: 15px; }
79
+ .grouped-table .add-to-box { text-align: right; }
80
+ .grouped-table .add-to-box .add-to-links { float:right; }
81
+ .grouped-table-list .add-to-box .add-to-links { padding: 0 20px; }
82
+ .groped-product-type { position:relative; z-index:2; margin:20px -30px -20px; background:#fff; border-top:1px solid #cfcfcf; padding:20px 30px 0; }
83
+ .grouped-items-table td { vertical-align: middle; }
84
+ .grouped-table-list .grouped-items-table td { white-space: nowrap; }
85
+ .grouped-table-grid .grouped-items-table td { white-space: normal; }
86
+ .grouped-table-detail .grouped-items-table td { white-space: normal; padding: 0; }
87
+ .grouped-table-detail .grouped-items-table .product-image-cell { padding: 20px 0 20px 20px; }
88
+ .grouped-table-detail .grouped-items-table .product-detail-cell { padding: 20px 20px 20px 19px; vertical-align: top; }
89
+ .grouped-table-detail .product-name { margin-bottom: 5px; }
90
+ .grouped-table-detail .price-box { margin: 5px 0 10px 0; }
91
+ .grouped-table .price-box { font-size: 12px; }
92
+ .grouped-table-detail .desc { margin: 5px 0 10px 0; font-size: 12px; }
93
+ .grouped-table-detail .data-table {}
94
+ .grouped-table-detail .grouped-items-table td.last {display:none; visibility:hidden;}
95
+
96
+ /* Stock Message Styles For Grouped Product Page */
97
+ .grouped-table .customstatus-additionalinfo { display:none; }
98
+ .grouped-table-list .grouped-items-table td p {margin:0; white-space:pre-line; word-wrap:break-word; line-height:14px;}
99
+
100
+
101
+ .grouped-table { width: 100%; }
102
+ .grouped-table .toolbar {
103
+ margin:15px 0 0;
104
+ }
105
+
106
+ .grouped-table-list .toolbar {
107
+ margin: 0;
108
+ }
109
+
110
+ .grouped-table-detail .toolbar-bottom .toolbar {
111
+ margin: 0;
112
+ border-bottom: 1px solid #d9d9d9;
113
+ border-right: 1px solid #d9d9d9;
114
+ border-left: 1px solid #d9d9d9;
115
+ }
116
+
117
+ .grouped-table .old-price .price-label { display:none !important; }
118
+ .grouped-table .toolbar-bottom .toolbar { margin:0 0 15px;}
119
+ .grouped-table-list .toolbar-bottom .toolbar { }
120
+
121
+ .grouped-table .thumbnail { width: 120px; height: 28px; }
122
+ .grouped-table img.thumbnail { height:100%; width:100%; }
123
+ .grouped-table .msrp { color:#9a9a9a; }
124
+ .grouped-table .color { white-space:nowrap; }
125
+ .grouped-table input[type="text"] {margin-bottom:0; }
126
+ .grouped-table-list .add-qty-to-cart .btn-cart { padding:2px 4px; margin-left:5px; }
127
+
128
+ /*
129
+ *Custom Data Tables
130
+ */
131
+ .grouped-table-detail .dataTables_info {padding:3px 20px;}
132
+
133
+ .grouped-table-list table.dataTable tr.odd td.sorting_1 { background-color: #DDDEF2; }
134
+ .grouped-table-list table.dataTable tr.odd td.sorting_2 { background-color: #DADCFF; }
135
+ .grouped-table-list table.dataTable tr.odd td.sorting_3 { background-color: #E0E2FF; }
136
+ .grouped-table-list table.dataTable tr.even td.sorting_1 { background-color: #EAEBFF; }
137
+ .grouped-table-list table.dataTable tr.even td.sorting_2 { background-color: #F2F3FF; }
138
+ .grouped-table-list table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
139
+
140
+ .grouped-table-detail .dataTables_wrapper {
141
+ position: relative;
142
+ clear: both;
143
+ margin: 0 0 0 0;
144
+ border-bottom: none;
145
+ *zoom: 1;
146
+ }
147
+ .grouped-table-list .table th, .table td { line-height:21px; }
148
+ .grouped-table-list table.dataTable { border-bottom:1px solid #d9d9d9; }
149
+
150
+
151
+ .grouped-table-list table.dataTable tr.odd { }
152
+ .grouped-table-detail table.dataTable tr.even { border-top: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9; }
153
+
154
+ .grouped-table .dataTable-top { background: #f5f5f5 url(../images/levementum/bkg_pager.gif) repeat-x 0 0; height: 26px; }
155
+ .grouped-table .dataTable-bottom { background: #f5f5f5 url(../images/levementum/bkg_pager.gif) repeat-x 0 0; }
156
+
157
+ .grouped-table-detail .dataTable-top { border-bottom: 1px solid #d9d9d9; }
158
+
159
+ .grouped-table-list .dataTable-top {}
160
+
161
+ .grouped-table .dataTable-top div,
162
+ .grouped-table .dataTable-bottom div { width: 280px; text-align: center;}
163
+ .grouped-table .dataTable-top div:first-child,
164
+ .grouped-table .dataTable-bottom div:first-child { text-align: left;}
165
+
166
+ .grouped-table .dataTable-bottom .dataTables_info { margin-top:3px; }
skin/frontend/enterprise/default/levementum/datatables/css/jquery.dataTables.css ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /*
3
+ * Table
4
+ */
5
+ table.dataTable {
6
+ margin: 0 auto 0 0;
7
+ clear: both;
8
+ /*width: 100%;*/
9
+ }
10
+
11
+
12
+ table.dataTable thead th {
13
+ padding: 3px 18px 3px 10px;
14
+ border-bottom: 1px solid black;
15
+ font-weight: bold;
16
+ cursor: pointer;
17
+ *cursor: hand;
18
+ }
19
+
20
+ table.dataTable thead th:hover { background-color: #A0B385;}
21
+
22
+ table.dataTable thead th.last {
23
+ padding: 3px 10px 3px 10px;
24
+ }
25
+
26
+ table.dataTable thead th.no_sort {
27
+ cursor: default !important;
28
+ *cursor: default;
29
+ }
30
+
31
+ table.dataTable tfoot th {
32
+ padding: 3px 18px 3px 10px;
33
+ border-top: 1px solid black;
34
+ font-weight: bold;
35
+ }
36
+
37
+ table.dataTable td {
38
+ padding: 3px 10px;
39
+ }
40
+
41
+ table.dataTable td.thumbnail {
42
+ padding: 3px;
43
+ }
44
+
45
+ table.dataTable td.center,
46
+ table.dataTable td.dataTables_empty {
47
+ text-align: center;
48
+ }
49
+
50
+ table.dataTable tbody tr { }
51
+ table.dataTable tr.odd { }
52
+ table.dataTable tr.even { }
53
+
54
+ table.dataTable tr.odd td.sorting_1 { }
55
+ table.dataTable tr.odd td.sorting_2 { }
56
+ table.dataTable tr.odd td.sorting_3 { }
57
+ table.dataTable tr.even td.sorting_1 { }
58
+ table.dataTable tr.even td.sorting_2 { }
59
+ table.dataTable tr.even td.sorting_3 { }
60
+
61
+
62
+ /*
63
+ * Table wrapper
64
+ */
65
+ .dataTables_wrapper {
66
+ position: relative;
67
+ clear: both;
68
+ *zoom: 1;
69
+ margin: 0 0 0 0;
70
+ }
71
+
72
+
73
+ /*
74
+ * Page length menu
75
+ */
76
+ .dataTables_length {
77
+ float: right;
78
+ }
79
+
80
+ .dataTables_length label {
81
+ float: right;
82
+ }
83
+
84
+ /*
85
+ * Filter
86
+ */
87
+ .dataTables_filter {
88
+ float: right;
89
+ text-align: right;
90
+ }
91
+
92
+
93
+ /*
94
+ * Table information
95
+ */
96
+ .dataTables_info {
97
+ clear: both;
98
+ float: left;
99
+ text-align: left !important;
100
+ padding: 3px 0px;
101
+ }
102
+
103
+ .dataTable-bottom .dataTables_length {
104
+ margin-top: 5px;
105
+ }
106
+
107
+ /*
108
+ * Pagination
109
+ */
110
+ .dataTables_paginate {
111
+ float: left;
112
+ text-align: right;
113
+ }
114
+
115
+ .paginate_button_disabled { }
116
+
117
+ /* Two button pagination - previous / next */
118
+ .paginate_disabled_previous,
119
+ .paginate_enabled_previous,
120
+ .paginate_disabled_next,
121
+ .paginate_enabled_next {
122
+ height: 19px;
123
+ float: left;
124
+ cursor: pointer;
125
+ *cursor: hand;
126
+ color: #111 !important;
127
+ }
128
+ .paginate_disabled_previous:hover,
129
+ .paginate_enabled_previous:hover,
130
+ .paginate_disabled_next:hover,
131
+ .paginate_enabled_next:hover {
132
+ text-decoration: none !important;
133
+ }
134
+ .paginate_disabled_previous:active,
135
+ .paginate_enabled_previous:active,
136
+ .paginate_disabled_next:active,
137
+ .paginate_enabled_next:active {
138
+ outline: none;
139
+ }
140
+
141
+ .paginate_disabled_previous,
142
+ .paginate_disabled_next {
143
+ color: #666 !important;
144
+ }
145
+ .paginate_disabled_previous,
146
+ .paginate_enabled_previous {
147
+ padding-left: 23px;
148
+ }
149
+ .paginate_disabled_next,
150
+ .paginate_enabled_next {
151
+ padding-right: 23px;
152
+ margin-left: 10px;
153
+ }
154
+
155
+ .paginate_enabled_previous { background: url('../images/back_enabled.png') no-repeat top left; }
156
+ .paginate_enabled_previous:hover { background: url('../images/back_enabled_hover.png') no-repeat top left; }
157
+ .paginate_disabled_previous { background: url('../images/back_disabled.png') no-repeat top left; }
158
+
159
+ .paginate_enabled_next { background: url('../images/forward_enabled.png') no-repeat top right; }
160
+ .paginate_enabled_next:hover { background: url('../images/forward_enabled_hover.png') no-repeat top right; }
161
+ .paginate_disabled_next { background: url('../images/forward_disabled.png') no-repeat top right; }
162
+
163
+ /* Full number pagination */
164
+ .paging_full_numbers {
165
+ height: 22px;
166
+ margin: 0 !important;
167
+
168
+ }
169
+ .paging_full_numbers a:active {
170
+ outline: none
171
+ }
172
+ .paging_full_numbers a:hover {
173
+ }
174
+
175
+ .paging_full_numbers a.paginate_button,
176
+ .paging_full_numbers a.paginate_active {
177
+ -moz-border-radius: 5px;
178
+ *cursor: hand;
179
+ }
180
+
181
+ .paging_full_numbers a.paginate_button {
182
+ padding: 0 5px 0 0;
183
+ cursor: pointer;
184
+ }
185
+ .paging_full_numbers .next .arrow {
186
+ /*margin-left: 5px;*/
187
+ vertical-align: middle;
188
+ }
189
+ .paging_full_numbers .previous .arrow {
190
+ vertical-align: middle;
191
+ }
192
+
193
+ .paging_full_numbers a.paginate_button:hover {
194
+ }
195
+
196
+ .paging_full_numbers a.paginate_active {
197
+ background-color: #99B3FF;
198
+ }
199
+
200
+
201
+ /*
202
+ * Processing indicator
203
+ */
204
+ .dataTables_processing {
205
+ position: absolute;
206
+ top: 0%;
207
+ left: 50%;
208
+ width: 250px;
209
+ height: 30px;
210
+ margin: 50px 0 0 -100px;
211
+ z-index: 900;
212
+ padding: 14px 0 2px 0;
213
+ border: 1px solid
214
+ #DDD;
215
+ text-align: center;
216
+ color:#999;
217
+ font-size: 13px;
218
+ background-color:white;
219
+ }
220
+
221
+
222
+ /*
223
+ * Sorting
224
+ */
225
+ .sorting { background: url('../images/sort_both.png') no-repeat bottom right; }
226
+ .sorting_asc { background: url('../images/sort_asc.png') no-repeat bottom right; }
227
+ .sorting_desc { background: url('../images/sort_desc.png') no-repeat bottom right; }
228
+
229
+ .sorting_asc_disabled { background: url('../images/sort_asc_disabled.png') no-repeat center right; }
230
+ .sorting_desc_disabled { background: url('../images/sort_desc_disabled.png') no-repeat center right; }
231
+
232
+ table.dataTable th:active {
233
+ outline: none;
234
+ }
235
+
236
+
237
+ /*
238
+ * Scrolling
239
+ */
240
+ .dataTables_scroll {
241
+ clear: both;
242
+ }
243
+
244
+ .dataTables_scrollBody {
245
+ *margin-top: -1px;
246
+ -webkit-overflow-scrolling: touch;
247
+ }
skin/frontend/enterprise/default/levementum/datatables/css/jquery.dataTables_themeroller.css ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ /*
4
+ * Table
5
+ */
6
+ table.dataTable {
7
+ margin: 0 auto;
8
+ clear: both;
9
+ width: 100%;
10
+ border-collapse: collapse;
11
+ }
12
+
13
+ table.dataTable thead th {
14
+ padding: 3px 0px 3px 10px;
15
+ cursor: pointer;
16
+ *cursor: hand;
17
+ }
18
+
19
+ table.dataTable tfoot th {
20
+ padding: 3px 10px;
21
+ }
22
+
23
+ table.dataTable td {
24
+ padding: 3px 10px;
25
+ }
26
+
27
+ table.dataTable td.center,
28
+ table.dataTable td.dataTables_empty {
29
+ text-align: center;
30
+ }
31
+
32
+ table.dataTable tr.odd { background-color: #E2E4FF; }
33
+ table.dataTable tr.even { background-color: white; }
34
+
35
+ table.dataTable tr.odd td.sorting_1 { background-color: #D3D6FF; }
36
+ table.dataTable tr.odd td.sorting_2 { background-color: #DADCFF; }
37
+ table.dataTable tr.odd td.sorting_3 { background-color: #E0E2FF; }
38
+ table.dataTable tr.even td.sorting_1 { background-color: #EAEBFF; }
39
+ table.dataTable tr.even td.sorting_2 { background-color: #F2F3FF; }
40
+ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
41
+
42
+
43
+ /*
44
+ * Table wrapper
45
+ */
46
+ .dataTables_wrapper {
47
+ position: relative;
48
+ clear: both;
49
+ *zoom: 1;
50
+ }
51
+ .dataTables_wrapper .ui-widget-header {
52
+ font-weight: normal;
53
+ }
54
+ .dataTables_wrapper .ui-toolbar {
55
+ padding: 5px;
56
+ }
57
+
58
+
59
+ /*
60
+ * Page length menu
61
+ */
62
+ .dataTables_length {
63
+ float: left;
64
+ }
65
+
66
+
67
+ /*
68
+ * Filter
69
+ */
70
+ .dataTables_filter {
71
+ float: right;
72
+ text-align: right;
73
+ }
74
+
75
+
76
+ /*
77
+ * Table information
78
+ */
79
+ .dataTables_info {
80
+ padding-top: 3px;
81
+ clear: both;
82
+ float: left;
83
+ }
84
+
85
+
86
+ /*
87
+ * Pagination
88
+ */
89
+ .dataTables_paginate {
90
+ float: right;
91
+ text-align: right;
92
+ }
93
+
94
+ .dataTables_paginate .ui-button {
95
+ margin-right: -0.1em !important;
96
+ }
97
+
98
+ .paging_two_button .ui-button {
99
+ float: left;
100
+ cursor: pointer;
101
+ * cursor: hand;
102
+ }
103
+
104
+ .paging_full_numbers .ui-button {
105
+ padding: 2px 6px;
106
+ margin: 0;
107
+ cursor: pointer;
108
+ * cursor: hand;
109
+ color: #333 !important;
110
+ }
111
+
112
+ /* Two button pagination - previous / next */
113
+ .paginate_disabled_previous,
114
+ .paginate_enabled_previous,
115
+ .paginate_disabled_next,
116
+ .paginate_enabled_next {
117
+ height: 19px;
118
+ float: left;
119
+ cursor: pointer;
120
+ *cursor: hand;
121
+ color: #111 !important;
122
+ }
123
+ .paginate_disabled_previous:hover,
124
+ .paginate_enabled_previous:hover,
125
+ .paginate_disabled_next:hover,
126
+ .paginate_enabled_next:hover {
127
+ text-decoration: none !important;
128
+ }
129
+ .paginate_disabled_previous:active,
130
+ .paginate_enabled_previous:active,
131
+ .paginate_disabled_next:active,
132
+ .paginate_enabled_next:active {
133
+ outline: none;
134
+ }
135
+
136
+ .paginate_disabled_previous,
137
+ .paginate_disabled_next {
138
+ color: #666 !important;
139
+ }
140
+ .paginate_disabled_previous,
141
+ .paginate_enabled_previous {
142
+ padding-left: 23px;
143
+ }
144
+ .paginate_disabled_next,
145
+ .paginate_enabled_next {
146
+ padding-right: 23px;
147
+ margin-left: 10px;
148
+ }
149
+
150
+ .paginate_enabled_previous { background: url('../images/back_enabled.png') no-repeat top left; }
151
+ .paginate_enabled_previous:hover { background: url('../images/back_enabled_hover.png') no-repeat top left; }
152
+ .paginate_disabled_previous { background: url('../images/back_disabled.png') no-repeat top left; }
153
+
154
+ .paginate_enabled_next { background: url('../images/forward_enabled.png') no-repeat top right; }
155
+ .paginate_enabled_next:hover { background: url('../images/forward_enabled_hover.png') no-repeat top right; }
156
+ .paginate_disabled_next { background: url('../images/forward_disabled.png') no-repeat top right; }
157
+
158
+ /* Full number pagination */
159
+ .paging_full_numbers a:active {
160
+ outline: none
161
+ }
162
+ .paging_full_numbers a:hover {
163
+ text-decoration: none;
164
+ }
165
+
166
+ .paging_full_numbers a.paginate_button,
167
+ .paging_full_numbers a.paginate_active {
168
+ border: 1px solid #aaa;
169
+ -webkit-border-radius: 5px;
170
+ -moz-border-radius: 5px;
171
+ border-radius: 5px;
172
+ padding: 2px 5px;
173
+ margin: 0 3px;
174
+ cursor: pointer;
175
+ *cursor: hand;
176
+ color: #333 !important;
177
+ }
178
+
179
+ .paging_full_numbers a.paginate_button {
180
+ background-color: #ddd;
181
+ }
182
+
183
+ .paging_full_numbers a.paginate_button:hover {
184
+ background-color: #ccc;
185
+ text-decoration: none !important;
186
+ }
187
+
188
+ .paging_full_numbers a.paginate_active {
189
+ background-color: #99B3FF;
190
+ }
191
+
192
+
193
+ /*
194
+ * Processing indicator
195
+ */
196
+ .dataTables_processing {
197
+ position: absolute;
198
+ top: 50%;
199
+ left: 50%;
200
+ width: 250px;
201
+ height: 30px;
202
+ margin-left: -125px;
203
+ margin-top: -15px;
204
+ padding: 14px 0 2px 0;
205
+ border: 1px solid #ddd;
206
+ text-align: center;
207
+ color: #999;
208
+ font-size: 14px;
209
+ background-color: white;
210
+ }
211
+
212
+
213
+ /*
214
+ * Sorting
215
+ */
216
+ table.dataTable thead th div.DataTables_sort_wrapper {
217
+ position: relative;
218
+ padding-right: 20px;
219
+ padding-right: 20px;
220
+ }
221
+
222
+ table.dataTable thead th div.DataTables_sort_wrapper span {
223
+ position: absolute;
224
+ top: 50%;
225
+ margin-top: -8px;
226
+ right: 0;
227
+ }
228
+
229
+ table.dataTable th:active {
230
+ outline: none;
231
+ }
232
+
233
+
234
+ /*
235
+ * Scrolling
236
+ */
237
+ .dataTables_scroll {
238
+ clear: both;
239
+ }
240
+
241
+ .dataTables_scrollBody {
242
+ *margin-top: -1px;
243
+ -webkit-overflow-scrolling: touch;
244
+ }
245
+
skin/frontend/enterprise/default/levementum/datatables/images/Sorting icons.psd ADDED
Binary file
skin/frontend/enterprise/default/levementum/datatables/images/back_disabled.png ADDED
Binary file
skin/frontend/enterprise/default/levementum/datatables/images/back_enabled.png ADDED
Binary file
skin/frontend/enterprise/default/levementum/datatables/images/back_enabled_hover.png ADDED
Binary file
skin/frontend/enterprise/default/levementum/datatables/images/favicon.ico ADDED
Binary file
skin/frontend/enterprise/default/levementum/datatables/images/forward_disabled.png ADDED
Binary file
skin/frontend/enterprise/default/levementum/datatables/images/forward_enabled.png ADDED
Binary file
skin/frontend/enterprise/default/levementum/datatables/images/forward_enabled_hover.png ADDED
Binary file
skin/frontend/enterprise/default/levementum/datatables/images/sort_asc.png ADDED
Binary file
skin/frontend/enterprise/default/levementum/datatables/images/sort_asc_disabled.png ADDED
Binary file
skin/frontend/enterprise/default/levementum/datatables/images/sort_both.png ADDED
Binary file
skin/frontend/enterprise/default/levementum/datatables/images/sort_desc.png ADDED
Binary file
skin/frontend/enterprise/default/levementum/datatables/images/sort_desc_disabled.png ADDED
Binary file
skin/frontend/enterprise/default/levementum/datatables/js/jquery.dataTables.js ADDED
@@ -0,0 +1,12092 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @summary DataTables
3
+ * @description Paginate, search and sort HTML tables
4
+ * @version 1.9.3
5
+ * @file jquery.dataTables.js
6
+ * @author Allan Jardine (www.sprymedia.co.uk)
7
+ * @contact www.sprymedia.co.uk/contact
8
+ *
9
+ * @copyright Copyright 2008-2012 Allan Jardine, all rights reserved.
10
+ *
11
+ * This source file is free software, under either the GPL v2 license or a
12
+ * BSD style license, available at:
13
+ * http://datatables.net/license_gpl2
14
+ * http://datatables.net/license_bsd
15
+ *
16
+ * This source file is distributed in the hope that it will be useful, but
17
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
19
+ *
20
+ * For details please refer to: http://www.datatables.net
21
+ */
22
+
23
+ /*jslint evil: true, undef: true, browser: true */
24
+ /*globals $, jQuery,_fnExternApiFunc,_fnInitialise,_fnInitComplete,_fnLanguageCompat,_fnAddColumn,_fnColumnOptions,_fnAddData,_fnCreateTr,_fnGatherData,_fnBuildHead,_fnDrawHead,_fnDraw,_fnReDraw,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDraw,_fnServerParams,_fnAddOptionsHtml,_fnFeatureHtmlTable,_fnScrollDraw,_fnAdjustColumnSizing,_fnFeatureHtmlFilter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnBuildSearchArray,_fnBuildSearchRow,_fnFilterCreateSearch,_fnDataToSearch,_fnSort,_fnSortAttachListener,_fnSortingClasses,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlInfo,_fnUpdateInfo,_fnFeatureHtmlLength,_fnFeatureHtmlProcessing,_fnProcessingDisplay,_fnVisibleToColumnIndex,_fnColumnIndexToVisible,_fnNodeToDataIndex,_fnVisbleColumns,_fnCalculateEnd,_fnConvertToWidth,_fnCalculateColumnWidths,_fnScrollingWidthAdjust,_fnGetWidestNode,_fnGetMaxLenString,_fnStringToCss,_fnDetectType,_fnSettingsFromNode,_fnGetDataMaster,_fnGetTrNodes,_fnGetTdNodes,_fnEscapeRegex,_fnDeleteIndex,_fnReOrderIndex,_fnColumnOrdering,_fnLog,_fnClearTable,_fnSaveState,_fnLoadState,_fnCreateCookie,_fnReadCookie,_fnDetectHeader,_fnGetUniqueThs,_fnScrollBarWidth,_fnApplyToChildren,_fnMap,_fnGetRowData,_fnGetCellData,_fnSetCellData,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnApplyColumnDefs,_fnBindAction,_fnCallbackReg,_fnCallbackFire,_fnJsonString,_fnRender,_fnNodeToColumnIndex,_fnInfoMacros,_fnBrowserDetect,_fnGetColumns*/
25
+
26
+ (/** @lends <global> */function($, window, document, undefined) {
27
+ /**
28
+ * DataTables is a plug-in for the jQuery Javascript library. It is a
29
+ * highly flexible tool, based upon the foundations of progressive
30
+ * enhancement, which will add advanced interaction controls to any
31
+ * HTML table. For a full list of features please refer to
32
+ * <a href="http://datatables.net">DataTables.net</a>.
33
+ *
34
+ * Note that the <i>DataTable</i> object is not a global variable but is
35
+ * aliased to <i>jQuery.fn.DataTable</i> and <i>jQuery.fn.dataTable</i> through which
36
+ * it may be accessed.
37
+ *
38
+ * @class
39
+ * @param {object} [oInit={}] Configuration object for DataTables. Options
40
+ * are defined by {@link DataTable.defaults}
41
+ * @requires jQuery 1.3+
42
+ *
43
+ * @example
44
+ * // Basic initialisation
45
+ * $(document).ready( function {
46
+ * $('#example').dataTable();
47
+ * } );
48
+ *
49
+ * @example
50
+ * // Initialisation with configuration options - in this case, disable
51
+ * // pagination and sorting.
52
+ * $(document).ready( function {
53
+ * $('#example').dataTable( {
54
+ * "bPaginate": false,
55
+ * "bSort": false
56
+ * } );
57
+ * } );
58
+ */
59
+ var DataTable = function( oInit )
60
+ {
61
+
62
+
63
+ /**
64
+ * Add a column to the list used for the table with default values
65
+ * @param {object} oSettings dataTables settings object
66
+ * @param {node} nTh The th element for this column
67
+ * @memberof DataTable#oApi
68
+ */
69
+ function _fnAddColumn( oSettings, nTh )
70
+ {
71
+ var oDefaults = DataTable.defaults.columns;
72
+ var iCol = oSettings.aoColumns.length;
73
+ var oCol = $.extend( {}, DataTable.models.oColumn, oDefaults, {
74
+ "sSortingClass": oSettings.oClasses.sSortable,
75
+ "sSortingClassJUI": oSettings.oClasses.sSortJUI,
76
+ "nTh": nTh ? nTh : document.createElement('th'),
77
+ "sTitle": oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.innerHTML : '',
78
+ "aDataSort": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol],
79
+ "mData": oDefaults.mData ? oDefaults.oDefaults : iCol
80
+ } );
81
+ oSettings.aoColumns.push( oCol );
82
+
83
+ /* Add a column specific filter */
84
+ if ( oSettings.aoPreSearchCols[ iCol ] === undefined || oSettings.aoPreSearchCols[ iCol ] === null )
85
+ {
86
+ oSettings.aoPreSearchCols[ iCol ] = $.extend( {}, DataTable.models.oSearch );
87
+ }
88
+ else
89
+ {
90
+ var oPre = oSettings.aoPreSearchCols[ iCol ];
91
+
92
+ /* Don't require that the user must specify bRegex, bSmart or bCaseInsensitive */
93
+ if ( oPre.bRegex === undefined )
94
+ {
95
+ oPre.bRegex = true;
96
+ }
97
+
98
+ if ( oPre.bSmart === undefined )
99
+ {
100
+ oPre.bSmart = true;
101
+ }
102
+
103
+ if ( oPre.bCaseInsensitive === undefined )
104
+ {
105
+ oPre.bCaseInsensitive = true;
106
+ }
107
+ }
108
+
109
+ /* Use the column options function to initialise classes etc */
110
+ _fnColumnOptions( oSettings, iCol, null );
111
+ }
112
+
113
+
114
+ /**
115
+ * Apply options for a column
116
+ * @param {object} oSettings dataTables settings object
117
+ * @param {int} iCol column index to consider
118
+ * @param {object} oOptions object with sType, bVisible and bSearchable etc
119
+ * @memberof DataTable#oApi
120
+ */
121
+ function _fnColumnOptions( oSettings, iCol, oOptions )
122
+ {
123
+ var oCol = oSettings.aoColumns[ iCol ];
124
+
125
+ /* User specified column options */
126
+ if ( oOptions !== undefined && oOptions !== null )
127
+ {
128
+ /* Backwards compatibility for mDataProp */
129
+ if ( oOptions.mDataProp && !oOptions.mData )
130
+ {
131
+ oOptions.mData = oOptions.mDataProp;
132
+ }
133
+
134
+ if ( oOptions.sType !== undefined )
135
+ {
136
+ oCol.sType = oOptions.sType;
137
+ oCol._bAutoType = false;
138
+ }
139
+
140
+ $.extend( oCol, oOptions );
141
+ _fnMap( oCol, oOptions, "sWidth", "sWidthOrig" );
142
+
143
+ /* iDataSort to be applied (backwards compatibility), but aDataSort will take
144
+ * priority if defined
145
+ */
146
+ if ( oOptions.iDataSort !== undefined )
147
+ {
148
+ oCol.aDataSort = [ oOptions.iDataSort ];
149
+ }
150
+ _fnMap( oCol, oOptions, "aDataSort" );
151
+ }
152
+
153
+ /* Cache the data get and set functions for speed */
154
+ var mRender = oCol.mRender ? _fnGetObjectDataFn( oCol.mRender ) : null;
155
+ var mData = _fnGetObjectDataFn( oCol.mData );
156
+
157
+ oCol.fnGetData = function (oData, sSpecific) {
158
+ var innerData = mData( oData, sSpecific );
159
+
160
+ if ( oCol.mRender && (sSpecific && sSpecific !== '') )
161
+ {
162
+ return mRender( innerData, sSpecific, oData );
163
+ }
164
+ return innerData;
165
+ };
166
+ oCol.fnSetData = _fnSetObjectDataFn( oCol.mData );
167
+
168
+ /* Feature sorting overrides column specific when off */
169
+ if ( !oSettings.oFeatures.bSort )
170
+ {
171
+ oCol.bSortable = false;
172
+ }
173
+
174
+ /* Check that the class assignment is correct for sorting */
175
+ if ( !oCol.bSortable ||
176
+ ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) == -1) )
177
+ {
178
+ oCol.sSortingClass = oSettings.oClasses.sSortableNone;
179
+ oCol.sSortingClassJUI = "";
180
+ }
181
+ else if ( oCol.bSortable ||
182
+ ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) == -1) )
183
+ {
184
+ oCol.sSortingClass = oSettings.oClasses.sSortable;
185
+ oCol.sSortingClassJUI = oSettings.oClasses.sSortJUI;
186
+ }
187
+ else if ( $.inArray('asc', oCol.asSorting) != -1 && $.inArray('desc', oCol.asSorting) == -1 )
188
+ {
189
+ oCol.sSortingClass = oSettings.oClasses.sSortableAsc;
190
+ oCol.sSortingClassJUI = oSettings.oClasses.sSortJUIAscAllowed;
191
+ }
192
+ else if ( $.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) != -1 )
193
+ {
194
+ oCol.sSortingClass = oSettings.oClasses.sSortableDesc;
195
+ oCol.sSortingClassJUI = oSettings.oClasses.sSortJUIDescAllowed;
196
+ }
197
+ }
198
+
199
+
200
+ /**
201
+ * Adjust the table column widths for new data. Note: you would probably want to
202
+ * do a redraw after calling this function!
203
+ * @param {object} oSettings dataTables settings object
204
+ * @memberof DataTable#oApi
205
+ */
206
+ function _fnAdjustColumnSizing ( oSettings )
207
+ {
208
+ /* Not interested in doing column width calculation if auto-width is disabled */
209
+ if ( oSettings.oFeatures.bAutoWidth === false )
210
+ {
211
+ return false;
212
+ }
213
+
214
+ _fnCalculateColumnWidths( oSettings );
215
+ for ( var i=0 , iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
216
+ {
217
+ oSettings.aoColumns[i].nTh.style.width = oSettings.aoColumns[i].sWidth;
218
+ }
219
+ }
220
+
221
+
222
+ /**
223
+ * Covert the index of a visible column to the index in the data array (take account
224
+ * of hidden columns)
225
+ * @param {object} oSettings dataTables settings object
226
+ * @param {int} iMatch Visible column index to lookup
227
+ * @returns {int} i the data index
228
+ * @memberof DataTable#oApi
229
+ */
230
+ function _fnVisibleToColumnIndex( oSettings, iMatch )
231
+ {
232
+ var aiVis = _fnGetColumns( oSettings, 'bVisible' );
233
+
234
+ return typeof aiVis[iMatch] === 'number' ?
235
+ aiVis[iMatch] :
236
+ null;
237
+ }
238
+
239
+
240
+ /**
241
+ * Covert the index of an index in the data array and convert it to the visible
242
+ * column index (take account of hidden columns)
243
+ * @param {int} iMatch Column index to lookup
244
+ * @param {object} oSettings dataTables settings object
245
+ * @returns {int} i the data index
246
+ * @memberof DataTable#oApi
247
+ */
248
+ function _fnColumnIndexToVisible( oSettings, iMatch )
249
+ {
250
+ var aiVis = _fnGetColumns( oSettings, 'bVisible' );
251
+ var iPos = $.inArray( iMatch, aiVis );
252
+
253
+ return iPos !== -1 ? iPos : null;
254
+ }
255
+
256
+
257
+ /**
258
+ * Get the number of visible columns
259
+ * @param {object} oSettings dataTables settings object
260
+ * @returns {int} i the number of visible columns
261
+ * @memberof DataTable#oApi
262
+ */
263
+ function _fnVisbleColumns( oSettings )
264
+ {
265
+ return _fnGetColumns( oSettings, 'bVisible' ).length;
266
+ }
267
+
268
+
269
+ /**
270
+ * Get an array of column indexes that match a given property
271
+ * @param {object} oSettings dataTables settings object
272
+ * @param {string} sParam Parameter in aoColumns to look for - typically
273
+ * bVisible or bSearchable
274
+ * @returns {array} Array of indexes with matched properties
275
+ * @memberof DataTable#oApi
276
+ */
277
+ function _fnGetColumns( oSettings, sParam )
278
+ {
279
+ var a = [];
280
+
281
+ $.map( oSettings.aoColumns, function(val, i) {
282
+ if ( val[sParam] ) {
283
+ a.push( i );
284
+ }
285
+ } );
286
+
287
+ return a;
288
+ }
289
+
290
+
291
+ /**
292
+ * Get the sort type based on an input string
293
+ * @param {string} sData data we wish to know the type of
294
+ * @returns {string} type (defaults to 'string' if no type can be detected)
295
+ * @memberof DataTable#oApi
296
+ */
297
+ function _fnDetectType( sData )
298
+ {
299
+ var aTypes = DataTable.ext.aTypes;
300
+ var iLen = aTypes.length;
301
+
302
+ for ( var i=0 ; i<iLen ; i++ )
303
+ {
304
+ var sType = aTypes[i]( sData );
305
+ if ( sType !== null )
306
+ {
307
+ return sType;
308
+ }
309
+ }
310
+
311
+ return 'string';
312
+ }
313
+
314
+
315
+ /**
316
+ * Figure out how to reorder a display list
317
+ * @param {object} oSettings dataTables settings object
318
+ * @returns array {int} aiReturn index list for reordering
319
+ * @memberof DataTable#oApi
320
+ */
321
+ function _fnReOrderIndex ( oSettings, sColumns )
322
+ {
323
+ var aColumns = sColumns.split(',');
324
+ var aiReturn = [];
325
+
326
+ for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
327
+ {
328
+ for ( var j=0 ; j<iLen ; j++ )
329
+ {
330
+ if ( oSettings.aoColumns[i].sName == aColumns[j] )
331
+ {
332
+ aiReturn.push( j );
333
+ break;
334
+ }
335
+ }
336
+ }
337
+
338
+ return aiReturn;
339
+ }
340
+
341
+
342
+ /**
343
+ * Get the column ordering that DataTables expects
344
+ * @param {object} oSettings dataTables settings object
345
+ * @returns {string} comma separated list of names
346
+ * @memberof DataTable#oApi
347
+ */
348
+ function _fnColumnOrdering ( oSettings )
349
+ {
350
+ var sNames = '';
351
+ for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
352
+ {
353
+ sNames += oSettings.aoColumns[i].sName+',';
354
+ }
355
+ if ( sNames.length == iLen )
356
+ {
357
+ return "";
358
+ }
359
+ return sNames.slice(0, -1);
360
+ }
361
+
362
+
363
+ /**
364
+ * Take the column definitions and static columns arrays and calculate how
365
+ * they relate to column indexes. The callback function will then apply the
366
+ * definition found for a column to a suitable configuration object.
367
+ * @param {object} oSettings dataTables settings object
368
+ * @param {array} aoColDefs The aoColumnDefs array that is to be applied
369
+ * @param {array} aoCols The aoColumns array that defines columns individually
370
+ * @param {function} fn Callback function - takes two parameters, the calculated
371
+ * column index and the definition for that column.
372
+ * @memberof DataTable#oApi
373
+ */
374
+ function _fnApplyColumnDefs( oSettings, aoColDefs, aoCols, fn )
375
+ {
376
+ var i, iLen, j, jLen, k, kLen;
377
+
378
+ // Column definitions with aTargets
379
+ if ( aoColDefs )
380
+ {
381
+ /* Loop over the definitions array - loop in reverse so first instance has priority */
382
+ for ( i=aoColDefs.length-1 ; i>=0 ; i-- )
383
+ {
384
+ /* Each definition can target multiple columns, as it is an array */
385
+ var aTargets = aoColDefs[i].aTargets;
386
+ if ( !$.isArray( aTargets ) )
387
+ {
388
+ _fnLog( oSettings, 1, 'aTargets must be an array of targets, not a '+(typeof aTargets) );
389
+ }
390
+
391
+ for ( j=0, jLen=aTargets.length ; j<jLen ; j++ )
392
+ {
393
+ if ( typeof aTargets[j] === 'number' && aTargets[j] >= 0 )
394
+ {
395
+ /* Add columns that we don't yet know about */
396
+ while( oSettings.aoColumns.length <= aTargets[j] )
397
+ {
398
+ _fnAddColumn( oSettings );
399
+ }
400
+
401
+ /* Integer, basic index */
402
+ fn( aTargets[j], aoColDefs[i] );
403
+ }
404
+ else if ( typeof aTargets[j] === 'number' && aTargets[j] < 0 )
405
+ {
406
+ /* Negative integer, right to left column counting */
407
+ fn( oSettings.aoColumns.length+aTargets[j], aoColDefs[i] );
408
+ }
409
+ else if ( typeof aTargets[j] === 'string' )
410
+ {
411
+ /* Class name matching on TH element */
412
+ for ( k=0, kLen=oSettings.aoColumns.length ; k<kLen ; k++ )
413
+ {
414
+ if ( aTargets[j] == "_all" ||
415
+ $(oSettings.aoColumns[k].nTh).hasClass( aTargets[j] ) )
416
+ {
417
+ fn( k, aoColDefs[i] );
418
+ }
419
+ }
420
+ }
421
+ }
422
+ }
423
+ }
424
+
425
+ // Statically defined columns array
426
+ if ( aoCols )
427
+ {
428
+ for ( i=0, iLen=aoCols.length ; i<iLen ; i++ )
429
+ {
430
+ fn( i, aoCols[i] );
431
+ }
432
+ }
433
+ }
434
+
435
+
436
+
437
+ /**
438
+ * Add a data array to the table, creating DOM node etc. This is the parallel to
439
+ * _fnGatherData, but for adding rows from a Javascript source, rather than a
440
+ * DOM source.
441
+ * @param {object} oSettings dataTables settings object
442
+ * @param {array} aData data array to be added
443
+ * @returns {int} >=0 if successful (index of new aoData entry), -1 if failed
444
+ * @memberof DataTable#oApi
445
+ */
446
+ function _fnAddData ( oSettings, aDataSupplied )
447
+ {
448
+ var oCol;
449
+
450
+ /* Take an independent copy of the data source so we can bash it about as we wish */
451
+ var aDataIn = ($.isArray(aDataSupplied)) ?
452
+ aDataSupplied.slice() :
453
+ $.extend( true, {}, aDataSupplied );
454
+
455
+ /* Create the object for storing information about this new row */
456
+ var iRow = oSettings.aoData.length;
457
+ var oData = $.extend( true, {}, DataTable.models.oRow );
458
+ oData._aData = aDataIn;
459
+ oSettings.aoData.push( oData );
460
+
461
+ /* Create the cells */
462
+ var nTd, sThisType;
463
+ for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
464
+ {
465
+ oCol = oSettings.aoColumns[i];
466
+
467
+ /* Use rendered data for filtering / sorting */
468
+ if ( typeof oCol.fnRender === 'function' && oCol.bUseRendered && oCol.mData !== null )
469
+ {
470
+ _fnSetCellData( oSettings, iRow, i, _fnRender(oSettings, iRow, i) );
471
+ }
472
+ else
473
+ {
474
+ _fnSetCellData( oSettings, iRow, i, _fnGetCellData( oSettings, iRow, i ) );
475
+ }
476
+
477
+ /* See if we should auto-detect the column type */
478
+ if ( oCol._bAutoType && oCol.sType != 'string' )
479
+ {
480
+ /* Attempt to auto detect the type - same as _fnGatherData() */
481
+ var sVarType = _fnGetCellData( oSettings, iRow, i, 'type' );
482
+ if ( sVarType !== null && sVarType !== '' )
483
+ {
484
+ sThisType = _fnDetectType( sVarType );
485
+ if ( oCol.sType === null )
486
+ {
487
+ oCol.sType = sThisType;
488
+ }
489
+ else if ( oCol.sType != sThisType && oCol.sType != "html" )
490
+ {
491
+ /* String is always the 'fallback' option */
492
+ oCol.sType = 'string';
493
+ }
494
+ }
495
+ }
496
+ }
497
+
498
+ /* Add to the display array */
499
+ oSettings.aiDisplayMaster.push( iRow );
500
+
501
+ /* Create the DOM imformation */
502
+ if ( !oSettings.oFeatures.bDeferRender )
503
+ {
504
+ _fnCreateTr( oSettings, iRow );
505
+ }
506
+
507
+ return iRow;
508
+ }
509
+
510
+
511
+ /**
512
+ * Read in the data from the target table from the DOM
513
+ * @param {object} oSettings dataTables settings object
514
+ * @memberof DataTable#oApi
515
+ */
516
+ function _fnGatherData( oSettings )
517
+ {
518
+ var iLoop, i, iLen, j, jLen, jInner,
519
+ nTds, nTrs, nTd, aLocalData, iThisIndex,
520
+ iRow, iRows, iColumn, iColumns, sNodeName,
521
+ oCol, oData;
522
+
523
+ /*
524
+ * Process by row first
525
+ * Add the data object for the whole table - storing the tr node. Note - no point in getting
526
+ * DOM based data if we are going to go and replace it with Ajax source data.
527
+ */
528
+ if ( oSettings.bDeferLoading || oSettings.sAjaxSource === null )
529
+ {
530
+ nTrs = oSettings.nTBody.childNodes;
531
+ for ( i=0, iLen=nTrs.length ; i<iLen ; i++ )
532
+ {
533
+ if ( nTrs[i].nodeName.toUpperCase() == "TR" )
534
+ {
535
+ iThisIndex = oSettings.aoData.length;
536
+ nTrs[i]._DT_RowIndex = iThisIndex;
537
+ oSettings.aoData.push( $.extend( true, {}, DataTable.models.oRow, {
538
+ "nTr": nTrs[i]
539
+ } ) );
540
+
541
+ oSettings.aiDisplayMaster.push( iThisIndex );
542
+ nTds = nTrs[i].childNodes;
543
+ jInner = 0;
544
+
545
+ for ( j=0, jLen=nTds.length ; j<jLen ; j++ )
546
+ {
547
+ sNodeName = nTds[j].nodeName.toUpperCase();
548
+ if ( sNodeName == "TD" || sNodeName == "TH" )
549
+ {
550
+ _fnSetCellData( oSettings, iThisIndex, jInner, $.trim(nTds[j].innerHTML) );
551
+ jInner++;
552
+ }
553
+ }
554
+ }
555
+ }
556
+ }
557
+
558
+ /* Gather in the TD elements of the Table - note that this is basically the same as
559
+ * fnGetTdNodes, but that function takes account of hidden columns, which we haven't yet
560
+ * setup!
561
+ */
562
+ nTrs = _fnGetTrNodes( oSettings );
563
+ nTds = [];
564
+ for ( i=0, iLen=nTrs.length ; i<iLen ; i++ )
565
+ {
566
+ for ( j=0, jLen=nTrs[i].childNodes.length ; j<jLen ; j++ )
567
+ {
568
+ nTd = nTrs[i].childNodes[j];
569
+ sNodeName = nTd.nodeName.toUpperCase();
570
+ if ( sNodeName == "TD" || sNodeName == "TH" )
571
+ {
572
+ nTds.push( nTd );
573
+ }
574
+ }
575
+ }
576
+
577
+ /* Now process by column */
578
+ for ( iColumn=0, iColumns=oSettings.aoColumns.length ; iColumn<iColumns ; iColumn++ )
579
+ {
580
+ oCol = oSettings.aoColumns[iColumn];
581
+
582
+ /* Get the title of the column - unless there is a user set one */
583
+ if ( oCol.sTitle === null )
584
+ {
585
+ oCol.sTitle = oCol.nTh.innerHTML;
586
+ }
587
+
588
+ var
589
+ bAutoType = oCol._bAutoType,
590
+ bRender = typeof oCol.fnRender === 'function',
591
+ bClass = oCol.sClass !== null,
592
+ bVisible = oCol.bVisible,
593
+ nCell, sThisType, sRendered, sValType;
594
+
595
+ /* A single loop to rule them all (and be more efficient) */
596
+ if ( bAutoType || bRender || bClass || !bVisible )
597
+ {
598
+ for ( iRow=0, iRows=oSettings.aoData.length ; iRow<iRows ; iRow++ )
599
+ {
600
+ oData = oSettings.aoData[iRow];
601
+ nCell = nTds[ (iRow*iColumns) + iColumn ];
602
+
603
+ /* Type detection */
604
+ if ( bAutoType && oCol.sType != 'string' )
605
+ {
606
+ sValType = _fnGetCellData( oSettings, iRow, iColumn, 'type' );
607
+ if ( sValType !== '' )
608
+ {
609
+ sThisType = _fnDetectType( sValType );
610
+ if ( oCol.sType === null )
611
+ {
612
+ oCol.sType = sThisType;
613
+ }
614
+ else if ( oCol.sType != sThisType &&
615
+ oCol.sType != "html" )
616
+ {
617
+ /* String is always the 'fallback' option */
618
+ oCol.sType = 'string';
619
+ }
620
+ }
621
+ }
622
+
623
+ if ( typeof oCol.mData === 'function' )
624
+ {
625
+ nCell.innerHTML = _fnGetCellData( oSettings, iRow, iColumn, 'display' );
626
+ }
627
+
628
+ /* Rendering */
629
+ if ( bRender )
630
+ {
631
+ sRendered = _fnRender( oSettings, iRow, iColumn );
632
+ nCell.innerHTML = sRendered;
633
+ if ( oCol.bUseRendered )
634
+ {
635
+ /* Use the rendered data for filtering / sorting */
636
+ _fnSetCellData( oSettings, iRow, iColumn, sRendered );
637
+ }
638
+ }
639
+
640
+ /* Classes */
641
+ if ( bClass )
642
+ {
643
+ nCell.className += ' '+oCol.sClass;
644
+ }
645
+
646
+ /* Column visibility */
647
+ if ( !bVisible )
648
+ {
649
+ oData._anHidden[iColumn] = nCell;
650
+ nCell.parentNode.removeChild( nCell );
651
+ }
652
+ else
653
+ {
654
+ oData._anHidden[iColumn] = null;
655
+ }
656
+
657
+ if ( oCol.fnCreatedCell )
658
+ {
659
+ oCol.fnCreatedCell.call( oSettings.oInstance,
660
+ nCell, _fnGetCellData( oSettings, iRow, iColumn, 'display' ), oData._aData, iRow, iColumn
661
+ );
662
+ }
663
+ }
664
+ }
665
+ }
666
+
667
+ /* Row created callbacks */
668
+ if ( oSettings.aoRowCreatedCallback.length !== 0 )
669
+ {
670
+ for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
671
+ {
672
+ oData = oSettings.aoData[i];
673
+ _fnCallbackFire( oSettings, 'aoRowCreatedCallback', null, [oData.nTr, oData._aData, i] );
674
+ }
675
+ }
676
+ }
677
+
678
+
679
+ /**
680
+ * Take a TR element and convert it to an index in aoData
681
+ * @param {object} oSettings dataTables settings object
682
+ * @param {node} n the TR element to find
683
+ * @returns {int} index if the node is found, null if not
684
+ * @memberof DataTable#oApi
685
+ */
686
+ function _fnNodeToDataIndex( oSettings, n )
687
+ {
688
+ return (n._DT_RowIndex!==undefined) ? n._DT_RowIndex : null;
689
+ }
690
+
691
+
692
+ /**
693
+ * Take a TD element and convert it into a column data index (not the visible index)
694
+ * @param {object} oSettings dataTables settings object
695
+ * @param {int} iRow The row number the TD/TH can be found in
696
+ * @param {node} n The TD/TH element to find
697
+ * @returns {int} index if the node is found, -1 if not
698
+ * @memberof DataTable#oApi
699
+ */
700
+ function _fnNodeToColumnIndex( oSettings, iRow, n )
701
+ {
702
+ var anCells = _fnGetTdNodes( oSettings, iRow );
703
+
704
+ for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
705
+ {
706
+ if ( anCells[i] === n )
707
+ {
708
+ return i;
709
+ }
710
+ }
711
+ return -1;
712
+ }
713
+
714
+
715
+ /**
716
+ * Get an array of data for a given row from the internal data cache
717
+ * @param {object} oSettings dataTables settings object
718
+ * @param {int} iRow aoData row id
719
+ * @param {string} sSpecific data get type ('type' 'filter' 'sort')
720
+ * @param {array} aiColumns Array of column indexes to get data from
721
+ * @returns {array} Data array
722
+ * @memberof DataTable#oApi
723
+ */
724
+ function _fnGetRowData( oSettings, iRow, sSpecific, aiColumns )
725
+ {
726
+ var out = [];
727
+ for ( var i=0, iLen=aiColumns.length ; i<iLen ; i++ )
728
+ {
729
+ out.push( _fnGetCellData( oSettings, iRow, aiColumns[i], sSpecific ) );
730
+ }
731
+ return out;
732
+ }
733
+
734
+
735
+ /**
736
+ * Get the data for a given cell from the internal cache, taking into account data mapping
737
+ * @param {object} oSettings dataTables settings object
738
+ * @param {int} iRow aoData row id
739
+ * @param {int} iCol Column index
740
+ * @param {string} sSpecific data get type ('display', 'type' 'filter' 'sort')
741
+ * @returns {*} Cell data
742
+ * @memberof DataTable#oApi
743
+ */
744
+ function _fnGetCellData( oSettings, iRow, iCol, sSpecific )
745
+ {
746
+ var sData;
747
+ var oCol = oSettings.aoColumns[iCol];
748
+ var oData = oSettings.aoData[iRow]._aData;
749
+
750
+ if ( (sData=oCol.fnGetData( oData, sSpecific )) === undefined )
751
+ {
752
+ if ( oSettings.iDrawError != oSettings.iDraw && oCol.sDefaultContent === null )
753
+ {
754
+ _fnLog( oSettings, 0, "Requested unknown parameter "+
755
+ (typeof oCol.mData=='function' ? '{mData function}' : "'"+oCol.mData+"'")+
756
+ " from the data source for row "+iRow );
757
+ oSettings.iDrawError = oSettings.iDraw;
758
+ }
759
+ return oCol.sDefaultContent;
760
+ }
761
+
762
+ /* When the data source is null, we can use default column data */
763
+ if ( sData === null && oCol.sDefaultContent !== null )
764
+ {
765
+ sData = oCol.sDefaultContent;
766
+ }
767
+ else if ( typeof sData === 'function' )
768
+ {
769
+ /* If the data source is a function, then we run it and use the return */
770
+ return sData();
771
+ }
772
+
773
+ if ( sSpecific == 'display' && sData === null )
774
+ {
775
+ return '';
776
+ }
777
+ return sData;
778
+ }
779
+
780
+
781
+ /**
782
+ * Set the value for a specific cell, into the internal data cache
783
+ * @param {object} oSettings dataTables settings object
784
+ * @param {int} iRow aoData row id
785
+ * @param {int} iCol Column index
786
+ * @param {*} val Value to set
787
+ * @memberof DataTable#oApi
788
+ */
789
+ function _fnSetCellData( oSettings, iRow, iCol, val )
790
+ {
791
+ var oCol = oSettings.aoColumns[iCol];
792
+ var oData = oSettings.aoData[iRow]._aData;
793
+
794
+ oCol.fnSetData( oData, val );
795
+ }
796
+
797
+
798
+ // Private variable that is used to match array syntax in the data property object
799
+ var __reArray = /\[.*?\]$/;
800
+
801
+ /**
802
+ * Return a function that can be used to get data from a source object, taking
803
+ * into account the ability to use nested objects as a source
804
+ * @param {string|int|function} mSource The data source for the object
805
+ * @returns {function} Data get function
806
+ * @memberof DataTable#oApi
807
+ */
808
+ function _fnGetObjectDataFn( mSource )
809
+ {
810
+ if ( mSource === null )
811
+ {
812
+ /* Give an empty string for rendering / sorting etc */
813
+ return function (data, type) {
814
+ return null;
815
+ };
816
+ }
817
+ else if ( typeof mSource === 'function' )
818
+ {
819
+ return function (data, type, extra) {
820
+ return mSource( data, type, extra );
821
+ };
822
+ }
823
+ else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 || mSource.indexOf('[') !== -1) )
824
+ {
825
+ /* If there is a . in the source string then the data source is in a
826
+ * nested object so we loop over the data for each level to get the next
827
+ * level down. On each loop we test for undefined, and if found immediately
828
+ * return. This allows entire objects to be missing and sDefaultContent to
829
+ * be used if defined, rather than throwing an error
830
+ */
831
+ var fetchData = function (data, type, src) {
832
+ var a = src.split('.');
833
+ var arrayNotation, out, innerSrc;
834
+
835
+ if ( src !== "" )
836
+ {
837
+ for ( var i=0, iLen=a.length ; i<iLen ; i++ )
838
+ {
839
+ // Check if we are dealing with an array notation request
840
+ arrayNotation = a[i].match(__reArray);
841
+
842
+ if ( arrayNotation ) {
843
+ a[i] = a[i].replace(__reArray, '');
844
+
845
+ // Condition allows simply [] to be passed in
846
+ if ( a[i] !== "" ) {
847
+ data = data[ a[i] ];
848
+ }
849
+ out = [];
850
+
851
+ // Get the remainder of the nested object to get
852
+ a.splice( 0, i+1 );
853
+ innerSrc = a.join('.');
854
+
855
+ // Traverse each entry in the array getting the properties requested
856
+ for ( var j=0, jLen=data.length ; j<jLen ; j++ ) {
857
+ out.push( fetchData( data[j], type, innerSrc ) );
858
+ }
859
+
860
+ // If a string is given in between the array notation indicators, that
861
+ // is used to join the strings together, otherwise an array is returned
862
+ var join = arrayNotation[0].substring(1, arrayNotation[0].length-1);
863
+ data = (join==="") ? out : out.join(join);
864
+
865
+ // The inner call to fetchData has already traversed through the remainder
866
+ // of the source requested, so we exit from the loop
867
+ break;
868
+ }
869
+
870
+ if ( data === null || data[ a[i] ] === undefined )
871
+ {
872
+ return undefined;
873
+ }
874
+ data = data[ a[i] ];
875
+ }
876
+ }
877
+
878
+ return data;
879
+ };
880
+
881
+ return function (data, type) {
882
+ return fetchData( data, type, mSource );
883
+ };
884
+ }
885
+ else
886
+ {
887
+ /* Array or flat object mapping */
888
+ return function (data, type) {
889
+ return data[mSource];
890
+ };
891
+ }
892
+ }
893
+
894
+
895
+ /**
896
+ * Return a function that can be used to set data from a source object, taking
897
+ * into account the ability to use nested objects as a source
898
+ * @param {string|int|function} mSource The data source for the object
899
+ * @returns {function} Data set function
900
+ * @memberof DataTable#oApi
901
+ */
902
+ function _fnSetObjectDataFn( mSource )
903
+ {
904
+ if ( mSource === null )
905
+ {
906
+ /* Nothing to do when the data source is null */
907
+ return function (data, val) {};
908
+ }
909
+ else if ( typeof mSource === 'function' )
910
+ {
911
+ return function (data, val) {
912
+ mSource( data, 'set', val );
913
+ };
914
+ }
915
+ else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 || mSource.indexOf('[') !== -1) )
916
+ {
917
+ /* Like the get, we need to get data from a nested object */
918
+ var setData = function (data, val, src) {
919
+ var a = src.split('.'), b;
920
+ var arrayNotation, o, innerSrc;
921
+
922
+ for ( var i=0, iLen=a.length-1 ; i<iLen ; i++ )
923
+ {
924
+ // Check if we are dealing with an array notation request
925
+ arrayNotation = a[i].match(__reArray);
926
+
927
+ if ( arrayNotation )
928
+ {
929
+ a[i] = a[i].replace(__reArray, '');
930
+ data[ a[i] ] = [];
931
+
932
+ // Get the remainder of the nested object to set so we can recurse
933
+ b = a.slice();
934
+ b.splice( 0, i+1 );
935
+ innerSrc = b.join('.');
936
+
937
+ // Traverse each entry in the array setting the properties requested
938
+ for ( var j=0, jLen=val.length ; j<jLen ; j++ )
939
+ {
940
+ o = {};
941
+ setData( o, val[j], innerSrc );
942
+ data[ a[i] ].push( o );
943
+ }
944
+
945
+ // The inner call to setData has already traversed through the remainder
946
+ // of the source and has set the data, thus we can exit here
947
+ return;
948
+ }
949
+
950
+ // If the nested object doesn't currently exist - since we are
951
+ // trying to set the value - create it
952
+ if ( data[ a[i] ] === null || data[ a[i] ] === undefined )
953
+ {
954
+ data[ a[i] ] = {};
955
+ }
956
+ data = data[ a[i] ];
957
+ }
958
+
959
+ // If array notation is used, we just want to strip it and use the property name
960
+ // and assign the value. If it isn't used, then we get the result we want anyway
961
+ data[ a[a.length-1].replace(__reArray, '') ] = val;
962
+ };
963
+
964
+ return function (data, val) {
965
+ return setData( data, val, mSource );
966
+ };
967
+ }
968
+ else
969
+ {
970
+ /* Array or flat object mapping */
971
+ return function (data, val) {
972
+ data[mSource] = val;
973
+ };
974
+ }
975
+ }
976
+
977
+
978
+ /**
979
+ * Return an array with the full table data
980
+ * @param {object} oSettings dataTables settings object
981
+ * @returns array {array} aData Master data array
982
+ * @memberof DataTable#oApi
983
+ */
984
+ function _fnGetDataMaster ( oSettings )
985
+ {
986
+ var aData = [];
987
+ var iLen = oSettings.aoData.length;
988
+ for ( var i=0 ; i<iLen; i++ )
989
+ {
990
+ aData.push( oSettings.aoData[i]._aData );
991
+ }
992
+ return aData;
993
+ }
994
+
995
+
996
+ /**
997
+ * Nuke the table
998
+ * @param {object} oSettings dataTables settings object
999
+ * @memberof DataTable#oApi
1000
+ */
1001
+ function _fnClearTable( oSettings )
1002
+ {
1003
+ oSettings.aoData.splice( 0, oSettings.aoData.length );
1004
+ oSettings.aiDisplayMaster.splice( 0, oSettings.aiDisplayMaster.length );
1005
+ oSettings.aiDisplay.splice( 0, oSettings.aiDisplay.length );
1006
+ _fnCalculateEnd( oSettings );
1007
+ }
1008
+
1009
+
1010
+ /**
1011
+ * Take an array of integers (index array) and remove a target integer (value - not
1012
+ * the key!)
1013
+ * @param {array} a Index array to target
1014
+ * @param {int} iTarget value to find
1015
+ * @memberof DataTable#oApi
1016
+ */
1017
+ function _fnDeleteIndex( a, iTarget )
1018
+ {
1019
+ var iTargetIndex = -1;
1020
+
1021
+ for ( var i=0, iLen=a.length ; i<iLen ; i++ )
1022
+ {
1023
+ if ( a[i] == iTarget )
1024
+ {
1025
+ iTargetIndex = i;
1026
+ }
1027
+ else if ( a[i] > iTarget )
1028
+ {
1029
+ a[i]--;
1030
+ }
1031
+ }
1032
+
1033
+ if ( iTargetIndex != -1 )
1034
+ {
1035
+ a.splice( iTargetIndex, 1 );
1036
+ }
1037
+ }
1038
+
1039
+
1040
+ /**
1041
+ * Call the developer defined fnRender function for a given cell (row/column) with
1042
+ * the required parameters and return the result.
1043
+ * @param {object} oSettings dataTables settings object
1044
+ * @param {int} iRow aoData index for the row
1045
+ * @param {int} iCol aoColumns index for the column
1046
+ * @returns {*} Return of the developer's fnRender function
1047
+ * @memberof DataTable#oApi
1048
+ */
1049
+ function _fnRender( oSettings, iRow, iCol )
1050
+ {
1051
+ var oCol = oSettings.aoColumns[iCol];
1052
+
1053
+ return oCol.fnRender( {
1054
+ "iDataRow": iRow,
1055
+ "iDataColumn": iCol,
1056
+ "oSettings": oSettings,
1057
+ "aData": oSettings.aoData[iRow]._aData,
1058
+ "mDataProp": oCol.mData
1059
+ }, _fnGetCellData(oSettings, iRow, iCol, 'display') );
1060
+ }
1061
+
1062
+ /**
1063
+ * Create a new TR element (and it's TD children) for a row
1064
+ * @param {object} oSettings dataTables settings object
1065
+ * @param {int} iRow Row to consider
1066
+ * @memberof DataTable#oApi
1067
+ */
1068
+ function _fnCreateTr ( oSettings, iRow )
1069
+ {
1070
+ var oData = oSettings.aoData[iRow];
1071
+ var nTd;
1072
+
1073
+ if ( oData.nTr === null )
1074
+ {
1075
+ oData.nTr = document.createElement('tr');
1076
+
1077
+ /* Use a private property on the node to allow reserve mapping from the node
1078
+ * to the aoData array for fast look up
1079
+ */
1080
+ oData.nTr._DT_RowIndex = iRow;
1081
+
1082
+ /* Special parameters can be given by the data source to be used on the row */
1083
+ if ( oData._aData.DT_RowId )
1084
+ {
1085
+ oData.nTr.id = oData._aData.DT_RowId;
1086
+ }
1087
+
1088
+ if ( oData._aData.DT_RowClass )
1089
+ {
1090
+ $(oData.nTr).addClass( oData._aData.DT_RowClass );
1091
+ }
1092
+
1093
+ /* Process each column */
1094
+ for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
1095
+ {
1096
+ var oCol = oSettings.aoColumns[i];
1097
+ nTd = document.createElement( oCol.sCellType );
1098
+
1099
+ /* Render if needed - if bUseRendered is true then we already have the rendered
1100
+ * value in the data source - so can just use that
1101
+ */
1102
+ nTd.innerHTML = (typeof oCol.fnRender === 'function' && (!oCol.bUseRendered || oCol.mData === null)) ?
1103
+ _fnRender( oSettings, iRow, i ) :
1104
+ _fnGetCellData( oSettings, iRow, i, 'display' );
1105
+
1106
+ /* Add user defined class */
1107
+ if ( oCol.sClass !== null )
1108
+ {
1109
+ nTd.className = oCol.sClass;
1110
+ }
1111
+
1112
+ if ( oCol.bVisible )
1113
+ {
1114
+ oData.nTr.appendChild( nTd );
1115
+ oData._anHidden[i] = null;
1116
+ }
1117
+ else
1118
+ {
1119
+ oData._anHidden[i] = nTd;
1120
+ }
1121
+
1122
+ if ( oCol.fnCreatedCell )
1123
+ {
1124
+ oCol.fnCreatedCell.call( oSettings.oInstance,
1125
+ nTd, _fnGetCellData( oSettings, iRow, i, 'display' ), oData._aData, iRow, i
1126
+ );
1127
+ }
1128
+ }
1129
+
1130
+ _fnCallbackFire( oSettings, 'aoRowCreatedCallback', null, [oData.nTr, oData._aData, iRow] );
1131
+ }
1132
+ }
1133
+
1134
+
1135
+ /**
1136
+ * Create the HTML header for the table
1137
+ * @param {object} oSettings dataTables settings object
1138
+ * @memberof DataTable#oApi
1139
+ */
1140
+ function _fnBuildHead( oSettings )
1141
+ {
1142
+ var i, nTh, iLen, j, jLen;
1143
+ var iThs = oSettings.nTHead.getElementsByTagName('th').length;
1144
+ var iCorrector = 0;
1145
+ var jqChildren;
1146
+
1147
+ /* If there is a header in place - then use it - otherwise it's going to get nuked... */
1148
+ if ( iThs !== 0 )
1149
+ {
1150
+ /* We've got a thead from the DOM, so remove hidden columns and apply width to vis cols */
1151
+ for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
1152
+ {
1153
+ nTh = oSettings.aoColumns[i].nTh;
1154
+ nTh.setAttribute('role', 'columnheader');
1155
+ if ( oSettings.aoColumns[i].bSortable )
1156
+ {
1157
+ nTh.setAttribute('tabindex', oSettings.iTabIndex);
1158
+ nTh.setAttribute('aria-controls', oSettings.sTableId);
1159
+ }
1160
+
1161
+ if ( oSettings.aoColumns[i].sClass !== null )
1162
+ {
1163
+ $(nTh).addClass( oSettings.aoColumns[i].sClass );
1164
+ }
1165
+
1166
+ /* Set the title of the column if it is user defined (not what was auto detected) */
1167
+ if ( oSettings.aoColumns[i].sTitle != nTh.innerHTML )
1168
+ {
1169
+ nTh.innerHTML = oSettings.aoColumns[i].sTitle;
1170
+ }
1171
+ }
1172
+ }
1173
+ else
1174
+ {
1175
+ /* We don't have a header in the DOM - so we are going to have to create one */
1176
+ var nTr = document.createElement( "tr" );
1177
+
1178
+ for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
1179
+ {
1180
+ nTh = oSettings.aoColumns[i].nTh;
1181
+ nTh.innerHTML = oSettings.aoColumns[i].sTitle;
1182
+ nTh.setAttribute('tabindex', '0');
1183
+
1184
+ if ( oSettings.aoColumns[i].sClass !== null )
1185
+ {
1186
+ $(nTh).addClass( oSettings.aoColumns[i].sClass );
1187
+ }
1188
+
1189
+ nTr.appendChild( nTh );
1190
+ }
1191
+ $(oSettings.nTHead).html( '' )[0].appendChild( nTr );
1192
+ _fnDetectHeader( oSettings.aoHeader, oSettings.nTHead );
1193
+ }
1194
+
1195
+ /* ARIA role for the rows */
1196
+ $(oSettings.nTHead).children('tr').attr('role', 'row');
1197
+
1198
+ /* Add the extra markup needed by jQuery UI's themes */
1199
+ if ( oSettings.bJUI )
1200
+ {
1201
+ for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
1202
+ {
1203
+ nTh = oSettings.aoColumns[i].nTh;
1204
+
1205
+ var nDiv = document.createElement('div');
1206
+ nDiv.className = oSettings.oClasses.sSortJUIWrapper;
1207
+ $(nTh).contents().appendTo(nDiv);
1208
+
1209
+ var nSpan = document.createElement('span');
1210
+ nSpan.className = oSettings.oClasses.sSortIcon;
1211
+ nDiv.appendChild( nSpan );
1212
+ nTh.appendChild( nDiv );
1213
+ }
1214
+ }
1215
+
1216
+ if ( oSettings.oFeatures.bSort )
1217
+ {
1218
+ for ( i=0 ; i<oSettings.aoColumns.length ; i++ )
1219
+ {
1220
+ if ( oSettings.aoColumns[i].bSortable !== false )
1221
+ {
1222
+ _fnSortAttachListener( oSettings, oSettings.aoColumns[i].nTh, i );
1223
+ }
1224
+ else
1225
+ {
1226
+ $(oSettings.aoColumns[i].nTh).addClass( oSettings.oClasses.sSortableNone );
1227
+ }
1228
+ }
1229
+ }
1230
+
1231
+ /* Deal with the footer - add classes if required */
1232
+ if ( oSettings.oClasses.sFooterTH !== "" )
1233
+ {
1234
+ $(oSettings.nTFoot).children('tr').children('th').addClass( oSettings.oClasses.sFooterTH );
1235
+ }
1236
+
1237
+ /* Cache the footer elements */
1238
+ if ( oSettings.nTFoot !== null )
1239
+ {
1240
+ var anCells = _fnGetUniqueThs( oSettings, null, oSettings.aoFooter );
1241
+ for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
1242
+ {
1243
+ if ( anCells[i] )
1244
+ {
1245
+ oSettings.aoColumns[i].nTf = anCells[i];
1246
+ if ( oSettings.aoColumns[i].sClass )
1247
+ {
1248
+ $(anCells[i]).addClass( oSettings.aoColumns[i].sClass );
1249
+ }
1250
+ }
1251
+ }
1252
+ }
1253
+ }
1254
+
1255
+
1256
+ /**
1257
+ * Draw the header (or footer) element based on the column visibility states. The
1258
+ * methodology here is to use the layout array from _fnDetectHeader, modified for
1259
+ * the instantaneous column visibility, to construct the new layout. The grid is
1260
+ * traversed over cell at a time in a rows x columns grid fashion, although each
1261
+ * cell insert can cover multiple elements in the grid - which is tracks using the
1262
+ * aApplied array. Cell inserts in the grid will only occur where there isn't
1263
+ * already a cell in that position.
1264
+ * @param {object} oSettings dataTables settings object
1265
+ * @param array {objects} aoSource Layout array from _fnDetectHeader
1266
+ * @param {boolean} [bIncludeHidden=false] If true then include the hidden columns in the calc,
1267
+ * @memberof DataTable#oApi
1268
+ */
1269
+ function _fnDrawHead( oSettings, aoSource, bIncludeHidden )
1270
+ {
1271
+ var i, iLen, j, jLen, k, kLen, n, nLocalTr;
1272
+ var aoLocal = [];
1273
+ var aApplied = [];
1274
+ var iColumns = oSettings.aoColumns.length;
1275
+ var iRowspan, iColspan;
1276
+
1277
+ if ( bIncludeHidden === undefined )
1278
+ {
1279
+ bIncludeHidden = false;
1280
+ }
1281
+
1282
+ /* Make a copy of the master layout array, but without the visible columns in it */
1283
+ for ( i=0, iLen=aoSource.length ; i<iLen ; i++ )
1284
+ {
1285
+ aoLocal[i] = aoSource[i].slice();
1286
+ aoLocal[i].nTr = aoSource[i].nTr;
1287
+
1288
+ /* Remove any columns which are currently hidden */
1289
+ for ( j=iColumns-1 ; j>=0 ; j-- )
1290
+ {
1291
+ if ( !oSettings.aoColumns[j].bVisible && !bIncludeHidden )
1292
+ {
1293
+ aoLocal[i].splice( j, 1 );
1294
+ }
1295
+ }
1296
+
1297
+ /* Prep the applied array - it needs an element for each row */
1298
+ aApplied.push( [] );
1299
+ }
1300
+
1301
+ for ( i=0, iLen=aoLocal.length ; i<iLen ; i++ )
1302
+ {
1303
+ nLocalTr = aoLocal[i].nTr;
1304
+
1305
+ /* All cells are going to be replaced, so empty out the row */
1306
+ if ( nLocalTr )
1307
+ {
1308
+ while( (n = nLocalTr.firstChild) )
1309
+ {
1310
+ nLocalTr.removeChild( n );
1311
+ }
1312
+ }
1313
+
1314
+ for ( j=0, jLen=aoLocal[i].length ; j<jLen ; j++ )
1315
+ {
1316
+ iRowspan = 1;
1317
+ iColspan = 1;
1318
+
1319
+ /* Check to see if there is already a cell (row/colspan) covering our target
1320
+ * insert point. If there is, then there is nothing to do.
1321
+ */
1322
+ if ( aApplied[i][j] === undefined )
1323
+ {
1324
+ nLocalTr.appendChild( aoLocal[i][j].cell );
1325
+ aApplied[i][j] = 1;
1326
+
1327
+ /* Expand the cell to cover as many rows as needed */
1328
+ while ( aoLocal[i+iRowspan] !== undefined &&
1329
+ aoLocal[i][j].cell == aoLocal[i+iRowspan][j].cell )
1330
+ {
1331
+ aApplied[i+iRowspan][j] = 1;
1332
+ iRowspan++;
1333
+ }
1334
+
1335
+ /* Expand the cell to cover as many columns as needed */
1336
+ while ( aoLocal[i][j+iColspan] !== undefined &&
1337
+ aoLocal[i][j].cell == aoLocal[i][j+iColspan].cell )
1338
+ {
1339
+ /* Must update the applied array over the rows for the columns */
1340
+ for ( k=0 ; k<iRowspan ; k++ )
1341
+ {
1342
+ aApplied[i+k][j+iColspan] = 1;
1343
+ }
1344
+ iColspan++;
1345
+ }
1346
+
1347
+ /* Do the actual expansion in the DOM */
1348
+ aoLocal[i][j].cell.rowSpan = iRowspan;
1349
+ aoLocal[i][j].cell.colSpan = iColspan;
1350
+ }
1351
+ }
1352
+ }
1353
+ }
1354
+
1355
+
1356
+ /**
1357
+ * Insert the required TR nodes into the table for display
1358
+ * @param {object} oSettings dataTables settings object
1359
+ * @memberof DataTable#oApi
1360
+ */
1361
+ function _fnDraw( oSettings )
1362
+ {
1363
+ /* Provide a pre-callback function which can be used to cancel the draw is false is returned */
1364
+ var aPreDraw = _fnCallbackFire( oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings] );
1365
+ if ( $.inArray( false, aPreDraw ) !== -1 )
1366
+ {
1367
+ _fnProcessingDisplay( oSettings, false );
1368
+ return;
1369
+ }
1370
+
1371
+ var i, iLen, n;
1372
+ var anRows = [];
1373
+ var iRowCount = 0;
1374
+ var iStripes = oSettings.asStripeClasses.length;
1375
+ var iOpenRows = oSettings.aoOpenRows.length;
1376
+
1377
+ oSettings.bDrawing = true;
1378
+
1379
+ /* Check and see if we have an initial draw position from state saving */
1380
+ if ( oSettings.iInitDisplayStart !== undefined && oSettings.iInitDisplayStart != -1 )
1381
+ {
1382
+ if ( oSettings.oFeatures.bServerSide )
1383
+ {
1384
+ oSettings._iDisplayStart = oSettings.iInitDisplayStart;
1385
+ }
1386
+ else
1387
+ {
1388
+ oSettings._iDisplayStart = (oSettings.iInitDisplayStart >= oSettings.fnRecordsDisplay()) ?
1389
+ 0 : oSettings.iInitDisplayStart;
1390
+ }
1391
+ oSettings.iInitDisplayStart = -1;
1392
+ _fnCalculateEnd( oSettings );
1393
+ }
1394
+
1395
+ /* Server-side processing draw intercept */
1396
+ if ( oSettings.bDeferLoading )
1397
+ {
1398
+ oSettings.bDeferLoading = false;
1399
+ oSettings.iDraw++;
1400
+ }
1401
+ else if ( !oSettings.oFeatures.bServerSide )
1402
+ {
1403
+ oSettings.iDraw++;
1404
+ }
1405
+ else if ( !oSettings.bDestroying && !_fnAjaxUpdate( oSettings ) )
1406
+ {
1407
+ return;
1408
+ }
1409
+
1410
+ if ( oSettings.aiDisplay.length !== 0 )
1411
+ {
1412
+ var iStart = oSettings._iDisplayStart;
1413
+ var iEnd = oSettings._iDisplayEnd;
1414
+
1415
+ if ( oSettings.oFeatures.bServerSide )
1416
+ {
1417
+ iStart = 0;
1418
+ iEnd = oSettings.aoData.length;
1419
+ }
1420
+
1421
+ for ( var j=iStart ; j<iEnd ; j++ )
1422
+ {
1423
+ var aoData = oSettings.aoData[ oSettings.aiDisplay[j] ];
1424
+ if ( aoData.nTr === null )
1425
+ {
1426
+ _fnCreateTr( oSettings, oSettings.aiDisplay[j] );
1427
+ }
1428
+
1429
+ var nRow = aoData.nTr;
1430
+
1431
+ /* Remove the old striping classes and then add the new one */
1432
+ if ( iStripes !== 0 )
1433
+ {
1434
+ var sStripe = oSettings.asStripeClasses[ iRowCount % iStripes ];
1435
+ if ( aoData._sRowStripe != sStripe )
1436
+ {
1437
+ $(nRow).removeClass( aoData._sRowStripe ).addClass( sStripe );
1438
+ aoData._sRowStripe = sStripe;
1439
+ }
1440
+ }
1441
+
1442
+ /* Row callback functions - might want to manipulate the row */
1443
+ _fnCallbackFire( oSettings, 'aoRowCallback', null,
1444
+ [nRow, oSettings.aoData[ oSettings.aiDisplay[j] ]._aData, iRowCount, j] );
1445
+
1446
+ anRows.push( nRow );
1447
+ iRowCount++;
1448
+
1449
+ /* If there is an open row - and it is attached to this parent - attach it on redraw */
1450
+ if ( iOpenRows !== 0 )
1451
+ {
1452
+ for ( var k=0 ; k<iOpenRows ; k++ )
1453
+ {
1454
+ if ( nRow == oSettings.aoOpenRows[k].nParent )
1455
+ {
1456
+ anRows.push( oSettings.aoOpenRows[k].nTr );
1457
+ break;
1458
+ }
1459
+ }
1460
+ }
1461
+ }
1462
+ }
1463
+ else
1464
+ {
1465
+ /* Table is empty - create a row with an empty message in it */
1466
+ anRows[ 0 ] = document.createElement( 'tr' );
1467
+
1468
+ if ( oSettings.asStripeClasses[0] )
1469
+ {
1470
+ anRows[ 0 ].className = oSettings.asStripeClasses[0];
1471
+ }
1472
+
1473
+ var oLang = oSettings.oLanguage;
1474
+ var sZero = oLang.sZeroRecords;
1475
+ if ( oSettings.iDraw == 1 && oSettings.sAjaxSource !== null && !oSettings.oFeatures.bServerSide )
1476
+ {
1477
+ sZero = oLang.sLoadingRecords;
1478
+ }
1479
+ else if ( oLang.sEmptyTable && oSettings.fnRecordsTotal() === 0 )
1480
+ {
1481
+ sZero = oLang.sEmptyTable;
1482
+ }
1483
+
1484
+ var nTd = document.createElement( 'td' );
1485
+ nTd.setAttribute( 'valign', "top" );
1486
+ nTd.colSpan = _fnVisbleColumns( oSettings );
1487
+ nTd.className = oSettings.oClasses.sRowEmpty;
1488
+ nTd.innerHTML = _fnInfoMacros( oSettings, sZero );
1489
+
1490
+ anRows[ iRowCount ].appendChild( nTd );
1491
+ }
1492
+
1493
+ /* Header and footer callbacks */
1494
+ _fnCallbackFire( oSettings, 'aoHeaderCallback', 'header', [ $(oSettings.nTHead).children('tr')[0],
1495
+ _fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay ] );
1496
+
1497
+ _fnCallbackFire( oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0],
1498
+ _fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay ] );
1499
+
1500
+ /*
1501
+ * Need to remove any old row from the display - note we can't just empty the tbody using
1502
+ * $().html('') since this will unbind the jQuery event handlers (even although the node
1503
+ * still exists!) - equally we can't use innerHTML, since IE throws an exception.
1504
+ */
1505
+ var
1506
+ nAddFrag = document.createDocumentFragment(),
1507
+ nRemoveFrag = document.createDocumentFragment(),
1508
+ nBodyPar, nTrs;
1509
+
1510
+ if ( oSettings.nTBody )
1511
+ {
1512
+ nBodyPar = oSettings.nTBody.parentNode;
1513
+ nRemoveFrag.appendChild( oSettings.nTBody );
1514
+
1515
+ /* When doing infinite scrolling, only remove child rows when sorting, filtering or start
1516
+ * up. When not infinite scroll, always do it.
1517
+ */
1518
+ if ( !oSettings.oScroll.bInfinite || !oSettings._bInitComplete ||
1519
+ oSettings.bSorted || oSettings.bFiltered )
1520
+ {
1521
+ while( (n = oSettings.nTBody.firstChild) )
1522
+ {
1523
+ oSettings.nTBody.removeChild( n );
1524
+ }
1525
+ }
1526
+
1527
+ /* Put the draw table into the dom */
1528
+ for ( i=0, iLen=anRows.length ; i<iLen ; i++ )
1529
+ {
1530
+ nAddFrag.appendChild( anRows[i] );
1531
+ }
1532
+
1533
+ oSettings.nTBody.appendChild( nAddFrag );
1534
+ if ( nBodyPar !== null )
1535
+ {
1536
+ nBodyPar.appendChild( oSettings.nTBody );
1537
+ }
1538
+ }
1539
+
1540
+ /* Call all required callback functions for the end of a draw */
1541
+ _fnCallbackFire( oSettings, 'aoDrawCallback', 'draw', [oSettings] );
1542
+
1543
+ /* Draw is complete, sorting and filtering must be as well */
1544
+ oSettings.bSorted = false;
1545
+ oSettings.bFiltered = false;
1546
+ oSettings.bDrawing = false;
1547
+
1548
+ if ( oSettings.oFeatures.bServerSide )
1549
+ {
1550
+ _fnProcessingDisplay( oSettings, false );
1551
+ if ( !oSettings._bInitComplete )
1552
+ {
1553
+ _fnInitComplete( oSettings );
1554
+ }
1555
+ }
1556
+ }
1557
+
1558
+
1559
+ /**
1560
+ * Redraw the table - taking account of the various features which are enabled
1561
+ * @param {object} oSettings dataTables settings object
1562
+ * @memberof DataTable#oApi
1563
+ */
1564
+ function _fnReDraw( oSettings )
1565
+ {
1566
+ if ( oSettings.oFeatures.bSort )
1567
+ {
1568
+ /* Sorting will refilter and draw for us */
1569
+ _fnSort( oSettings, oSettings.oPreviousSearch );
1570
+ }
1571
+ else if ( oSettings.oFeatures.bFilter )
1572
+ {
1573
+ /* Filtering will redraw for us */
1574
+ _fnFilterComplete( oSettings, oSettings.oPreviousSearch );
1575
+ }
1576
+ else
1577
+ {
1578
+ _fnCalculateEnd( oSettings );
1579
+ _fnDraw( oSettings );
1580
+ }
1581
+ }
1582
+
1583
+
1584
+ /**
1585
+ * Add the options to the page HTML for the table
1586
+ * @param {object} oSettings dataTables settings object
1587
+ * @memberof DataTable#oApi
1588
+ */
1589
+ function _fnAddOptionsHtml ( oSettings )
1590
+ {
1591
+ /*
1592
+ * Create a temporary, empty, div which we can later on replace with what we have generated
1593
+ * we do it this way to rendering the 'options' html offline - speed :-)
1594
+ */
1595
+ var nHolding = $('<div></div>')[0];
1596
+ oSettings.nTable.parentNode.insertBefore( nHolding, oSettings.nTable );
1597
+
1598
+ /*
1599
+ * All DataTables are wrapped in a div
1600
+ */
1601
+ oSettings.nTableWrapper = $('<div id="'+oSettings.sTableId+'_wrapper" class="'+oSettings.oClasses.sWrapper+'" role="grid"></div>')[0];
1602
+ oSettings.nTableReinsertBefore = oSettings.nTable.nextSibling;
1603
+
1604
+ /* Track where we want to insert the option */
1605
+ var nInsertNode = oSettings.nTableWrapper;
1606
+
1607
+ /* Loop over the user set positioning and place the elements as needed */
1608
+ var aDom = oSettings.sDom.split('');
1609
+ var nTmp, iPushFeature, cOption, nNewNode, cNext, sAttr, j;
1610
+ for ( var i=0 ; i<aDom.length ; i++ )
1611
+ {
1612
+ iPushFeature = 0;
1613
+ cOption = aDom[i];
1614
+
1615
+ if ( cOption == '<' )
1616
+ {
1617
+ /* New container div */
1618
+ nNewNode = $('<div></div>')[0];
1619
+
1620
+ /* Check to see if we should append an id and/or a class name to the container */
1621
+ cNext = aDom[i+1];
1622
+ if ( cNext == "'" || cNext == '"' )
1623
+ {
1624
+ sAttr = "";
1625
+ j = 2;
1626
+ while ( aDom[i+j] != cNext )
1627
+ {
1628
+ sAttr += aDom[i+j];
1629
+ j++;
1630
+ }
1631
+
1632
+ /* Replace jQuery UI constants */
1633
+ if ( sAttr == "H" )
1634
+ {
1635
+ sAttr = oSettings.oClasses.sJUIHeader;
1636
+ }
1637
+ else if ( sAttr == "F" )
1638
+ {
1639
+ sAttr = oSettings.oClasses.sJUIFooter;
1640
+ }
1641
+
1642
+ /* The attribute can be in the format of "#id.class", "#id" or "class" This logic
1643
+ * breaks the string into parts and applies them as needed
1644
+ */
1645
+ if ( sAttr.indexOf('.') != -1 )
1646
+ {
1647
+ var aSplit = sAttr.split('.');
1648
+ nNewNode.id = aSplit[0].substr(1, aSplit[0].length-1);
1649
+ nNewNode.className = aSplit[1];
1650
+ }
1651
+ else if ( sAttr.charAt(0) == "#" )
1652
+ {
1653
+ nNewNode.id = sAttr.substr(1, sAttr.length-1);
1654
+ }
1655
+ else
1656
+ {
1657
+ nNewNode.className = sAttr;
1658
+ }
1659
+
1660
+ i += j; /* Move along the position array */
1661
+ }
1662
+
1663
+ nInsertNode.appendChild( nNewNode );
1664
+ nInsertNode = nNewNode;
1665
+ }
1666
+ else if ( cOption == '>' )
1667
+ {
1668
+ /* End container div */
1669
+ nInsertNode = nInsertNode.parentNode;
1670
+ }
1671
+ else if ( cOption == 'l' && oSettings.oFeatures.bPaginate && oSettings.oFeatures.bLengthChange )
1672
+ {
1673
+ /* Length */
1674
+ nTmp = _fnFeatureHtmlLength( oSettings );
1675
+ iPushFeature = 1;
1676
+ }
1677
+ else if ( cOption == 'f' && oSettings.oFeatures.bFilter )
1678
+ {
1679
+ /* Filter */
1680
+ nTmp = _fnFeatureHtmlFilter( oSettings );
1681
+ iPushFeature = 1;
1682
+ }
1683
+ else if ( cOption == 'r' && oSettings.oFeatures.bProcessing )
1684
+ {
1685
+ /* pRocessing */
1686
+ nTmp = _fnFeatureHtmlProcessing( oSettings );
1687
+ iPushFeature = 1;
1688
+ }
1689
+ else if ( cOption == 't' )
1690
+ {
1691
+ /* Table */
1692
+ nTmp = _fnFeatureHtmlTable( oSettings );
1693
+ iPushFeature = 1;
1694
+ }
1695
+ else if ( cOption == 'i' && oSettings.oFeatures.bInfo )
1696
+ {
1697
+ /* Info */
1698
+ nTmp = _fnFeatureHtmlInfo( oSettings );
1699
+ iPushFeature = 1;
1700
+ }
1701
+ else if ( cOption == 'p' && oSettings.oFeatures.bPaginate )
1702
+ {
1703
+ /* Pagination */
1704
+ nTmp = _fnFeatureHtmlPaginate( oSettings );
1705
+ iPushFeature = 1;
1706
+ }
1707
+ else if ( DataTable.ext.aoFeatures.length !== 0 )
1708
+ {
1709
+ /* Plug-in features */
1710
+ var aoFeatures = DataTable.ext.aoFeatures;
1711
+ for ( var k=0, kLen=aoFeatures.length ; k<kLen ; k++ )
1712
+ {
1713
+ if ( cOption == aoFeatures[k].cFeature )
1714
+ {
1715
+ nTmp = aoFeatures[k].fnInit( oSettings );
1716
+ if ( nTmp )
1717
+ {
1718
+ iPushFeature = 1;
1719
+ }
1720
+ break;
1721
+ }
1722
+ }
1723
+ }
1724
+
1725
+ /* Add to the 2D features array */
1726
+ if ( iPushFeature == 1 && nTmp !== null )
1727
+ {
1728
+ if ( typeof oSettings.aanFeatures[cOption] !== 'object' )
1729
+ {
1730
+ oSettings.aanFeatures[cOption] = [];
1731
+ }
1732
+ oSettings.aanFeatures[cOption].push( nTmp );
1733
+ nInsertNode.appendChild( nTmp );
1734
+ }
1735
+ }
1736
+
1737
+ /* Built our DOM structure - replace the holding div with what we want */
1738
+ nHolding.parentNode.replaceChild( oSettings.nTableWrapper, nHolding );
1739
+ }
1740
+
1741
+
1742
+ /**
1743
+ * Use the DOM source to create up an array of header cells. The idea here is to
1744
+ * create a layout grid (array) of rows x columns, which contains a reference
1745
+ * to the cell that that point in the grid (regardless of col/rowspan), such that
1746
+ * any column / row could be removed and the new grid constructed
1747
+ * @param array {object} aLayout Array to store the calculated layout in
1748
+ * @param {node} nThead The header/footer element for the table
1749
+ * @memberof DataTable#oApi
1750
+ */
1751
+ function _fnDetectHeader ( aLayout, nThead )
1752
+ {
1753
+ var nTrs = $(nThead).children('tr');
1754
+ var nCell;
1755
+ var i, j, k, l, iLen, jLen, iColShifted;
1756
+ var fnShiftCol = function ( a, i, j ) {
1757
+ while ( a[i][j] ) {
1758
+ j++;
1759
+ }
1760
+ return j;
1761
+ };
1762
+
1763
+ aLayout.splice( 0, aLayout.length );
1764
+
1765
+ /* We know how many rows there are in the layout - so prep it */
1766
+ for ( i=0, iLen=nTrs.length ; i<iLen ; i++ )
1767
+ {
1768
+ aLayout.push( [] );
1769
+ }
1770
+
1771
+ /* Calculate a layout array */
1772
+ for ( i=0, iLen=nTrs.length ; i<iLen ; i++ )
1773
+ {
1774
+ var iColumn = 0;
1775
+
1776
+ /* For every cell in the row... */
1777
+ for ( j=0, jLen=nTrs[i].childNodes.length ; j<jLen ; j++ )
1778
+ {
1779
+ nCell = nTrs[i].childNodes[j];
1780
+
1781
+ if ( nCell.nodeName.toUpperCase() == "TD" ||
1782
+ nCell.nodeName.toUpperCase() == "TH" )
1783
+ {
1784
+ /* Get the col and rowspan attributes from the DOM and sanitise them */
1785
+ var iColspan = nCell.getAttribute('colspan') * 1;
1786
+ var iRowspan = nCell.getAttribute('rowspan') * 1;
1787
+ iColspan = (!iColspan || iColspan===0 || iColspan===1) ? 1 : iColspan;
1788
+ iRowspan = (!iRowspan || iRowspan===0 || iRowspan===1) ? 1 : iRowspan;
1789
+
1790
+ /* There might be colspan cells already in this row, so shift our target
1791
+ * accordingly
1792
+ */
1793
+ iColShifted = fnShiftCol( aLayout, i, iColumn );
1794
+
1795
+ /* If there is col / rowspan, copy the information into the layout grid */
1796
+ for ( l=0 ; l<iColspan ; l++ )
1797
+ {
1798
+ for ( k=0 ; k<iRowspan ; k++ )
1799
+ {
1800
+ aLayout[i+k][iColShifted+l] = {
1801
+ "cell": nCell,
1802
+ "unique": iColspan == 1 ? true : false
1803
+ };
1804
+ aLayout[i+k].nTr = nTrs[i];
1805
+ }
1806
+ }
1807
+ }
1808
+ }
1809
+ }
1810
+ }
1811
+
1812
+
1813
+ /**
1814
+ * Get an array of unique th elements, one for each column
1815
+ * @param {object} oSettings dataTables settings object
1816
+ * @param {node} nHeader automatically detect the layout from this node - optional
1817
+ * @param {array} aLayout thead/tfoot layout from _fnDetectHeader - optional
1818
+ * @returns array {node} aReturn list of unique th's
1819
+ * @memberof DataTable#oApi
1820
+ */
1821
+ function _fnGetUniqueThs ( oSettings, nHeader, aLayout )
1822
+ {
1823
+ var aReturn = [];
1824
+ if ( !aLayout )
1825
+ {
1826
+ aLayout = oSettings.aoHeader;
1827
+ if ( nHeader )
1828
+ {
1829
+ aLayout = [];
1830
+ _fnDetectHeader( aLayout, nHeader );
1831
+ }
1832
+ }
1833
+
1834
+ for ( var i=0, iLen=aLayout.length ; i<iLen ; i++ )
1835
+ {
1836
+ for ( var j=0, jLen=aLayout[i].length ; j<jLen ; j++ )
1837
+ {
1838
+ if ( aLayout[i][j].unique &&
1839
+ (!aReturn[j] || !oSettings.bSortCellsTop) )
1840
+ {
1841
+ aReturn[j] = aLayout[i][j].cell;
1842
+ }
1843
+ }
1844
+ }
1845
+
1846
+ return aReturn;
1847
+ }
1848
+
1849
+
1850
+
1851
+ /**
1852
+ * Update the table using an Ajax call
1853
+ * @param {object} oSettings dataTables settings object
1854
+ * @returns {boolean} Block the table drawing or not
1855
+ * @memberof DataTable#oApi
1856
+ */
1857
+ function _fnAjaxUpdate( oSettings )
1858
+ {
1859
+ if ( oSettings.bAjaxDataGet )
1860
+ {
1861
+ oSettings.iDraw++;
1862
+ _fnProcessingDisplay( oSettings, true );
1863
+ var iColumns = oSettings.aoColumns.length;
1864
+ var aoData = _fnAjaxParameters( oSettings );
1865
+ _fnServerParams( oSettings, aoData );
1866
+
1867
+ oSettings.fnServerData.call( oSettings.oInstance, oSettings.sAjaxSource, aoData,
1868
+ function(json) {
1869
+ _fnAjaxUpdateDraw( oSettings, json );
1870
+ }, oSettings );
1871
+ return false;
1872
+ }
1873
+ else
1874
+ {
1875
+ return true;
1876
+ }
1877
+ }
1878
+
1879
+
1880
+ /**
1881
+ * Build up the parameters in an object needed for a server-side processing request
1882
+ * @param {object} oSettings dataTables settings object
1883
+ * @returns {bool} block the table drawing or not
1884
+ * @memberof DataTable#oApi
1885
+ */
1886
+ function _fnAjaxParameters( oSettings )
1887
+ {
1888
+ var iColumns = oSettings.aoColumns.length;
1889
+ var aoData = [], mDataProp, aaSort, aDataSort;
1890
+ var i, j;
1891
+
1892
+ aoData.push( { "name": "sEcho", "value": oSettings.iDraw } );
1893
+ aoData.push( { "name": "iColumns", "value": iColumns } );
1894
+ aoData.push( { "name": "sColumns", "value": _fnColumnOrdering(oSettings) } );
1895
+ aoData.push( { "name": "iDisplayStart", "value": oSettings._iDisplayStart } );
1896
+ aoData.push( { "name": "iDisplayLength", "value": oSettings.oFeatures.bPaginate !== false ?
1897
+ oSettings._iDisplayLength : -1 } );
1898
+
1899
+ for ( i=0 ; i<iColumns ; i++ )
1900
+ {
1901
+ mDataProp = oSettings.aoColumns[i].mData;
1902
+ aoData.push( { "name": "mDataProp_"+i, "value": typeof(mDataProp)==="function" ? 'function' : mDataProp } );
1903
+ }
1904
+
1905
+ /* Filtering */
1906
+ if ( oSettings.oFeatures.bFilter !== false )
1907
+ {
1908
+ aoData.push( { "name": "sSearch", "value": oSettings.oPreviousSearch.sSearch } );
1909
+ aoData.push( { "name": "bRegex", "value": oSettings.oPreviousSearch.bRegex } );
1910
+ for ( i=0 ; i<iColumns ; i++ )
1911
+ {
1912
+ aoData.push( { "name": "sSearch_"+i, "value": oSettings.aoPreSearchCols[i].sSearch } );
1913
+ aoData.push( { "name": "bRegex_"+i, "value": oSettings.aoPreSearchCols[i].bRegex } );
1914
+ aoData.push( { "name": "bSearchable_"+i, "value": oSettings.aoColumns[i].bSearchable } );
1915
+ }
1916
+ }
1917
+
1918
+ /* Sorting */
1919
+ if ( oSettings.oFeatures.bSort !== false )
1920
+ {
1921
+ var iCounter = 0;
1922
+
1923
+ aaSort = ( oSettings.aaSortingFixed !== null ) ?
1924
+ oSettings.aaSortingFixed.concat( oSettings.aaSorting ) :
1925
+ oSettings.aaSorting.slice();
1926
+
1927
+ for ( i=0 ; i<aaSort.length ; i++ )
1928
+ {
1929
+ aDataSort = oSettings.aoColumns[ aaSort[i][0] ].aDataSort;
1930
+
1931
+ for ( j=0 ; j<aDataSort.length ; j++ )
1932
+ {
1933
+ aoData.push( { "name": "iSortCol_"+iCounter, "value": aDataSort[j] } );
1934
+ aoData.push( { "name": "sSortDir_"+iCounter, "value": aaSort[i][1] } );
1935
+ iCounter++;
1936
+ }
1937
+ }
1938
+ aoData.push( { "name": "iSortingCols", "value": iCounter } );
1939
+
1940
+ for ( i=0 ; i<iColumns ; i++ )
1941
+ {
1942
+ aoData.push( { "name": "bSortable_"+i, "value": oSettings.aoColumns[i].bSortable } );
1943
+ }
1944
+ }
1945
+
1946
+ return aoData;
1947
+ }
1948
+
1949
+
1950
+ /**
1951
+ * Add Ajax parameters from plug-ins
1952
+ * @param {object} oSettings dataTables settings object
1953
+ * @param array {objects} aoData name/value pairs to send to the server
1954
+ * @memberof DataTable#oApi
1955
+ */
1956
+ function _fnServerParams( oSettings, aoData )
1957
+ {
1958
+ _fnCallbackFire( oSettings, 'aoServerParams', 'serverParams', [aoData] );
1959
+ }
1960
+
1961
+
1962
+ /**
1963
+ * Data the data from the server (nuking the old) and redraw the table
1964
+ * @param {object} oSettings dataTables settings object
1965
+ * @param {object} json json data return from the server.
1966
+ * @param {string} json.sEcho Tracking flag for DataTables to match requests
1967
+ * @param {int} json.iTotalRecords Number of records in the data set, not accounting for filtering
1968
+ * @param {int} json.iTotalDisplayRecords Number of records in the data set, accounting for filtering
1969
+ * @param {array} json.aaData The data to display on this page
1970
+ * @param {string} [json.sColumns] Column ordering (sName, comma separated)
1971
+ * @memberof DataTable#oApi
1972
+ */
1973
+ function _fnAjaxUpdateDraw ( oSettings, json )
1974
+ {
1975
+ if ( json.sEcho !== undefined )
1976
+ {
1977
+ /* Protect against old returns over-writing a new one. Possible when you get
1978
+ * very fast interaction, and later queries are completed much faster
1979
+ */
1980
+ if ( json.sEcho*1 < oSettings.iDraw )
1981
+ {
1982
+ return;
1983
+ }
1984
+ else
1985
+ {
1986
+ oSettings.iDraw = json.sEcho * 1;
1987
+ }
1988
+ }
1989
+
1990
+ if ( !oSettings.oScroll.bInfinite ||
1991
+ (oSettings.oScroll.bInfinite && (oSettings.bSorted || oSettings.bFiltered)) )
1992
+ {
1993
+ _fnClearTable( oSettings );
1994
+ }
1995
+ oSettings._iRecordsTotal = parseInt(json.iTotalRecords, 10);
1996
+ oSettings._iRecordsDisplay = parseInt(json.iTotalDisplayRecords, 10);
1997
+
1998
+ /* Determine if reordering is required */
1999
+ var sOrdering = _fnColumnOrdering(oSettings);
2000
+ var bReOrder = (json.sColumns !== undefined && sOrdering !== "" && json.sColumns != sOrdering );
2001
+ var aiIndex;
2002
+ if ( bReOrder )
2003
+ {
2004
+ aiIndex = _fnReOrderIndex( oSettings, json.sColumns );
2005
+ }
2006
+
2007
+ var aData = _fnGetObjectDataFn( oSettings.sAjaxDataProp )( json );
2008
+ for ( var i=0, iLen=aData.length ; i<iLen ; i++ )
2009
+ {
2010
+ if ( bReOrder )
2011
+ {
2012
+ /* If we need to re-order, then create a new array with the correct order and add it */
2013
+ var aDataSorted = [];
2014
+ for ( var j=0, jLen=oSettings.aoColumns.length ; j<jLen ; j++ )
2015
+ {
2016
+ aDataSorted.push( aData[i][ aiIndex[j] ] );
2017
+ }
2018
+ _fnAddData( oSettings, aDataSorted );
2019
+ }
2020
+ else
2021
+ {
2022
+ /* No re-order required, sever got it "right" - just straight add */
2023
+ _fnAddData( oSettings, aData[i] );
2024
+ }
2025
+ }
2026
+ oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
2027
+
2028
+ oSettings.bAjaxDataGet = false;
2029
+ _fnDraw( oSettings );
2030
+ oSettings.bAjaxDataGet = true;
2031
+ _fnProcessingDisplay( oSettings, false );
2032
+ }
2033
+
2034
+
2035
+
2036
+ /**
2037
+ * Generate the node required for filtering text
2038
+ * @returns {node} Filter control element
2039
+ * @param {object} oSettings dataTables settings object
2040
+ * @memberof DataTable#oApi
2041
+ */
2042
+ function _fnFeatureHtmlFilter ( oSettings )
2043
+ {
2044
+ var oPreviousSearch = oSettings.oPreviousSearch;
2045
+
2046
+ var sSearchStr = oSettings.oLanguage.sSearch;
2047
+ sSearchStr = (sSearchStr.indexOf('_INPUT_') !== -1) ?
2048
+ sSearchStr.replace('_INPUT_', '<input type="text" />') :
2049
+ sSearchStr==="" ? '<input type="text" />' : sSearchStr+' <input type="text" />';
2050
+
2051
+ var nFilter = document.createElement( 'div' );
2052
+ nFilter.className = oSettings.oClasses.sFilter;
2053
+ nFilter.innerHTML = '<label>'+sSearchStr+'</label>';
2054
+ if ( !oSettings.aanFeatures.f )
2055
+ {
2056
+ nFilter.id = oSettings.sTableId+'_filter';
2057
+ }
2058
+
2059
+ var jqFilter = $('input[type="text"]', nFilter);
2060
+
2061
+ // Store a reference to the input element, so other input elements could be
2062
+ // added to the filter wrapper if needed (submit button for example)
2063
+ nFilter._DT_Input = jqFilter[0];
2064
+
2065
+ jqFilter.val( oPreviousSearch.sSearch.replace('"','&quot;') );
2066
+ jqFilter.bind( 'keyup.DT', function(e) {
2067
+ /* Update all other filter input elements for the new display */
2068
+ var n = oSettings.aanFeatures.f;
2069
+ var val = this.value==="" ? "" : this.value; // mental IE8 fix :-(
2070
+
2071
+ for ( var i=0, iLen=n.length ; i<iLen ; i++ )
2072
+ {
2073
+ if ( n[i] != $(this).parents('div.dataTables_filter')[0] )
2074
+ {
2075
+ $(n[i]._DT_Input).val( val );
2076
+ }
2077
+ }
2078
+
2079
+ /* Now do the filter */
2080
+ if ( val != oPreviousSearch.sSearch )
2081
+ {
2082
+ _fnFilterComplete( oSettings, {
2083
+ "sSearch": val,
2084
+ "bRegex": oPreviousSearch.bRegex,
2085
+ "bSmart": oPreviousSearch.bSmart ,
2086
+ "bCaseInsensitive": oPreviousSearch.bCaseInsensitive
2087
+ } );
2088
+ }
2089
+ } );
2090
+
2091
+ jqFilter
2092
+ .attr('aria-controls', oSettings.sTableId)
2093
+ .bind( 'keypress.DT', function(e) {
2094
+ /* Prevent form submission */
2095
+ if ( e.keyCode == 13 )
2096
+ {
2097
+ return false;
2098
+ }
2099
+ }
2100
+ );
2101
+
2102
+ return nFilter;
2103
+ }
2104
+
2105
+
2106
+ /**
2107
+ * Filter the table using both the global filter and column based filtering
2108
+ * @param {object} oSettings dataTables settings object
2109
+ * @param {object} oSearch search information
2110
+ * @param {int} [iForce] force a research of the master array (1) or not (undefined or 0)
2111
+ * @memberof DataTable#oApi
2112
+ */
2113
+ function _fnFilterComplete ( oSettings, oInput, iForce )
2114
+ {
2115
+ var oPrevSearch = oSettings.oPreviousSearch;
2116
+ var aoPrevSearch = oSettings.aoPreSearchCols;
2117
+ var fnSaveFilter = function ( oFilter ) {
2118
+ /* Save the filtering values */
2119
+ oPrevSearch.sSearch = oFilter.sSearch;
2120
+ oPrevSearch.bRegex = oFilter.bRegex;
2121
+ oPrevSearch.bSmart = oFilter.bSmart;
2122
+ oPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive;
2123
+ };
2124
+
2125
+ /* In server-side processing all filtering is done by the server, so no point hanging around here */
2126
+ if ( !oSettings.oFeatures.bServerSide )
2127
+ {
2128
+ /* Global filter */
2129
+ _fnFilter( oSettings, oInput.sSearch, iForce, oInput.bRegex, oInput.bSmart, oInput.bCaseInsensitive );
2130
+ fnSaveFilter( oInput );
2131
+
2132
+ /* Now do the individual column filter */
2133
+ for ( var i=0 ; i<oSettings.aoPreSearchCols.length ; i++ )
2134
+ {
2135
+ _fnFilterColumn( oSettings, aoPrevSearch[i].sSearch, i, aoPrevSearch[i].bRegex,
2136
+ aoPrevSearch[i].bSmart, aoPrevSearch[i].bCaseInsensitive );
2137
+ }
2138
+
2139
+ /* Custom filtering */
2140
+ _fnFilterCustom( oSettings );
2141
+ }
2142
+ else
2143
+ {
2144
+ fnSaveFilter( oInput );
2145
+ }
2146
+
2147
+ /* Tell the draw function we have been filtering */
2148
+ oSettings.bFiltered = true;
2149
+ $(oSettings.oInstance).trigger('filter', oSettings);
2150
+
2151
+ /* Redraw the table */
2152
+ oSettings._iDisplayStart = 0;
2153
+ _fnCalculateEnd( oSettings );
2154
+ _fnDraw( oSettings );
2155
+
2156
+ /* Rebuild search array 'offline' */
2157
+ _fnBuildSearchArray( oSettings, 0 );
2158
+ }
2159
+
2160
+
2161
+ /**
2162
+ * Apply custom filtering functions
2163
+ * @param {object} oSettings dataTables settings object
2164
+ * @memberof DataTable#oApi
2165
+ */
2166
+ function _fnFilterCustom( oSettings )
2167
+ {
2168
+ var afnFilters = DataTable.ext.afnFiltering;
2169
+ var aiFilterColumns = _fnGetColumns( oSettings, 'bSearchable' );
2170
+
2171
+ for ( var i=0, iLen=afnFilters.length ; i<iLen ; i++ )
2172
+ {
2173
+ var iCorrector = 0;
2174
+ for ( var j=0, jLen=oSettings.aiDisplay.length ; j<jLen ; j++ )
2175
+ {
2176
+ var iDisIndex = oSettings.aiDisplay[j-iCorrector];
2177
+ var bTest = afnFilters[i](
2178
+ oSettings,
2179
+ _fnGetRowData( oSettings, iDisIndex, 'filter', aiFilterColumns ),
2180
+ iDisIndex
2181
+ );
2182
+
2183
+ /* Check if we should use this row based on the filtering function */
2184
+ if ( !bTest )
2185
+ {
2186
+ oSettings.aiDisplay.splice( j-iCorrector, 1 );
2187
+ iCorrector++;
2188
+ }
2189
+ }
2190
+ }
2191
+ }
2192
+
2193
+
2194
+ /**
2195
+ * Filter the table on a per-column basis
2196
+ * @param {object} oSettings dataTables settings object
2197
+ * @param {string} sInput string to filter on
2198
+ * @param {int} iColumn column to filter
2199
+ * @param {bool} bRegex treat search string as a regular expression or not
2200
+ * @param {bool} bSmart use smart filtering or not
2201
+ * @param {bool} bCaseInsensitive Do case insenstive matching or not
2202
+ * @memberof DataTable#oApi
2203
+ */
2204
+ function _fnFilterColumn ( oSettings, sInput, iColumn, bRegex, bSmart, bCaseInsensitive )
2205
+ {
2206
+ if ( sInput === "" )
2207
+ {
2208
+ return;
2209
+ }
2210
+
2211
+ var iIndexCorrector = 0;
2212
+ var rpSearch = _fnFilterCreateSearch( sInput, bRegex, bSmart, bCaseInsensitive );
2213
+
2214
+ for ( var i=oSettings.aiDisplay.length-1 ; i>=0 ; i-- )
2215
+ {
2216
+ var sData = _fnDataToSearch( _fnGetCellData( oSettings, oSettings.aiDisplay[i], iColumn, 'filter' ),
2217
+ oSettings.aoColumns[iColumn].sType );
2218
+ if ( ! rpSearch.test( sData ) )
2219
+ {
2220
+ oSettings.aiDisplay.splice( i, 1 );
2221
+ iIndexCorrector++;
2222
+ }
2223
+ }
2224
+ }
2225
+
2226
+
2227
+ /**
2228
+ * Filter the data table based on user input and draw the table
2229
+ * @param {object} oSettings dataTables settings object
2230
+ * @param {string} sInput string to filter on
2231
+ * @param {int} iForce optional - force a research of the master array (1) or not (undefined or 0)
2232
+ * @param {bool} bRegex treat as a regular expression or not
2233
+ * @param {bool} bSmart perform smart filtering or not
2234
+ * @param {bool} bCaseInsensitive Do case insenstive matching or not
2235
+ * @memberof DataTable#oApi
2236
+ */
2237
+ function _fnFilter( oSettings, sInput, iForce, bRegex, bSmart, bCaseInsensitive )
2238
+ {
2239
+ var i;
2240
+ var rpSearch = _fnFilterCreateSearch( sInput, bRegex, bSmart, bCaseInsensitive );
2241
+ var oPrevSearch = oSettings.oPreviousSearch;
2242
+
2243
+ /* Check if we are forcing or not - optional parameter */
2244
+ if ( !iForce )
2245
+ {
2246
+ iForce = 0;
2247
+ }
2248
+
2249
+ /* Need to take account of custom filtering functions - always filter */
2250
+ if ( DataTable.ext.afnFiltering.length !== 0 )
2251
+ {
2252
+ iForce = 1;
2253
+ }
2254
+
2255
+ /*
2256
+ * If the input is blank - we want the full data set
2257
+ */
2258
+ if ( sInput.length <= 0 )
2259
+ {
2260
+ oSettings.aiDisplay.splice( 0, oSettings.aiDisplay.length);
2261
+ oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
2262
+ }
2263
+ else
2264
+ {
2265
+ /*
2266
+ * We are starting a new search or the new search string is smaller
2267
+ * then the old one (i.e. delete). Search from the master array
2268
+ */
2269
+ if ( oSettings.aiDisplay.length == oSettings.aiDisplayMaster.length ||
2270
+ oPrevSearch.sSearch.length > sInput.length || iForce == 1 ||
2271
+ sInput.indexOf(oPrevSearch.sSearch) !== 0 )
2272
+ {
2273
+ /* Nuke the old display array - we are going to rebuild it */
2274
+ oSettings.aiDisplay.splice( 0, oSettings.aiDisplay.length);
2275
+
2276
+ /* Force a rebuild of the search array */
2277
+ _fnBuildSearchArray( oSettings, 1 );
2278
+
2279
+ /* Search through all records to populate the search array
2280
+ * The the oSettings.aiDisplayMaster and asDataSearch arrays have 1 to 1
2281
+ * mapping
2282
+ */
2283
+ for ( i=0 ; i<oSettings.aiDisplayMaster.length ; i++ )
2284
+ {
2285
+ if ( rpSearch.test(oSettings.asDataSearch[i]) )
2286
+ {
2287
+ oSettings.aiDisplay.push( oSettings.aiDisplayMaster[i] );
2288
+ }
2289
+ }
2290
+ }
2291
+ else
2292
+ {
2293
+ /* Using old search array - refine it - do it this way for speed
2294
+ * Don't have to search the whole master array again
2295
+ */
2296
+ var iIndexCorrector = 0;
2297
+
2298
+ /* Search the current results */
2299
+ for ( i=0 ; i<oSettings.asDataSearch.length ; i++ )
2300
+ {
2301
+ if ( ! rpSearch.test(oSettings.asDataSearch[i]) )
2302
+ {
2303
+ oSettings.aiDisplay.splice( i-iIndexCorrector, 1 );
2304
+ iIndexCorrector++;
2305
+ }
2306
+ }
2307
+ }
2308
+ }
2309
+ }
2310
+
2311
+
2312
+ /**
2313
+ * Create an array which can be quickly search through
2314
+ * @param {object} oSettings dataTables settings object
2315
+ * @param {int} iMaster use the master data array - optional
2316
+ * @memberof DataTable#oApi
2317
+ */
2318
+ function _fnBuildSearchArray ( oSettings, iMaster )
2319
+ {
2320
+ if ( !oSettings.oFeatures.bServerSide )
2321
+ {
2322
+ /* Clear out the old data */
2323
+ oSettings.asDataSearch = [];
2324
+
2325
+ var aiFilterColumns = _fnGetColumns( oSettings, 'bSearchable' );
2326
+ var aiIndex = (iMaster===1) ?
2327
+ oSettings.aiDisplayMaster :
2328
+ oSettings.aiDisplay;
2329
+
2330
+ for ( var i=0, iLen=aiIndex.length ; i<iLen ; i++ )
2331
+ {
2332
+ oSettings.asDataSearch[i] = _fnBuildSearchRow(
2333
+ oSettings,
2334
+ _fnGetRowData( oSettings, aiIndex[i], 'filter', aiFilterColumns )
2335
+ );
2336
+ }
2337
+ }
2338
+ }
2339
+
2340
+
2341
+ /**
2342
+ * Create a searchable string from a single data row
2343
+ * @param {object} oSettings dataTables settings object
2344
+ * @param {array} aData Row data array to use for the data to search
2345
+ * @memberof DataTable#oApi
2346
+ */
2347
+ function _fnBuildSearchRow( oSettings, aData )
2348
+ {
2349
+ var sSearch = aData.join(' ');
2350
+
2351
+ /* If it looks like there is an HTML entity in the string, attempt to decode it */
2352
+ if ( sSearch.indexOf('&') !== -1 )
2353
+ {
2354
+ sSearch = $('<div>').html(sSearch).text();
2355
+ }
2356
+
2357
+ // Strip newline characters
2358
+ return sSearch.replace( /[\n\r]/g, " " );
2359
+ }
2360
+
2361
+ /**
2362
+ * Build a regular expression object suitable for searching a table
2363
+ * @param {string} sSearch string to search for
2364
+ * @param {bool} bRegex treat as a regular expression or not
2365
+ * @param {bool} bSmart perform smart filtering or not
2366
+ * @param {bool} bCaseInsensitive Do case insensitive matching or not
2367
+ * @returns {RegExp} constructed object
2368
+ * @memberof DataTable#oApi
2369
+ */
2370
+ function _fnFilterCreateSearch( sSearch, bRegex, bSmart, bCaseInsensitive )
2371
+ {
2372
+ var asSearch, sRegExpString;
2373
+
2374
+ if ( bSmart )
2375
+ {
2376
+ /* Generate the regular expression to use. Something along the lines of:
2377
+ * ^(?=.*?\bone\b)(?=.*?\btwo\b)(?=.*?\bthree\b).*$
2378
+ */
2379
+ asSearch = bRegex ? sSearch.split( ' ' ) : _fnEscapeRegex( sSearch ).split( ' ' );
2380
+ sRegExpString = '^(?=.*?'+asSearch.join( ')(?=.*?' )+').*$';
2381
+ return new RegExp( sRegExpString, bCaseInsensitive ? "i" : "" );
2382
+ }
2383
+ else
2384
+ {
2385
+ sSearch = bRegex ? sSearch : _fnEscapeRegex( sSearch );
2386
+ return new RegExp( sSearch, bCaseInsensitive ? "i" : "" );
2387
+ }
2388
+ }
2389
+
2390
+
2391
+ /**
2392
+ * Convert raw data into something that the user can search on
2393
+ * @param {string} sData data to be modified
2394
+ * @param {string} sType data type
2395
+ * @returns {string} search string
2396
+ * @memberof DataTable#oApi
2397
+ */
2398
+ function _fnDataToSearch ( sData, sType )
2399
+ {
2400
+ if ( typeof DataTable.ext.ofnSearch[sType] === "function" )
2401
+ {
2402
+ return DataTable.ext.ofnSearch[sType]( sData );
2403
+ }
2404
+ else if ( sData === null )
2405
+ {
2406
+ return '';
2407
+ }
2408
+ else if ( sType == "html" )
2409
+ {
2410
+ return sData.replace(/[\r\n]/g," ").replace( /<.*?>/g, "" );
2411
+ }
2412
+ else if ( typeof sData === "string" )
2413
+ {
2414
+ return sData.replace(/[\r\n]/g," ");
2415
+ }
2416
+ return sData;
2417
+ }
2418
+
2419
+
2420
+ /**
2421
+ * scape a string such that it can be used in a regular expression
2422
+ * @param {string} sVal string to escape
2423
+ * @returns {string} escaped string
2424
+ * @memberof DataTable#oApi
2425
+ */
2426
+ function _fnEscapeRegex ( sVal )
2427
+ {
2428
+ var acEscape = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ];
2429
+ var reReplace = new RegExp( '(\\' + acEscape.join('|\\') + ')', 'g' );
2430
+ return sVal.replace(reReplace, '\\$1');
2431
+ }
2432
+
2433
+
2434
+
2435
+ /**
2436
+ * Generate the node required for the info display
2437
+ * @param {object} oSettings dataTables settings object
2438
+ * @returns {node} Information element
2439
+ * @memberof DataTable#oApi
2440
+ */
2441
+ function _fnFeatureHtmlInfo ( oSettings )
2442
+ {
2443
+ var nInfo = document.createElement( 'div' );
2444
+ nInfo.className = oSettings.oClasses.sInfo;
2445
+
2446
+ /* Actions that are to be taken once only for this feature */
2447
+ if ( !oSettings.aanFeatures.i )
2448
+ {
2449
+ /* Add draw callback */
2450
+ oSettings.aoDrawCallback.push( {
2451
+ "fn": _fnUpdateInfo,
2452
+ "sName": "information"
2453
+ } );
2454
+
2455
+ /* Add id */
2456
+ nInfo.id = oSettings.sTableId+'_info';
2457
+ }
2458
+ oSettings.nTable.setAttribute( 'aria-describedby', oSettings.sTableId+'_info' );
2459
+
2460
+ return nInfo;
2461
+ }
2462
+
2463
+
2464
+ /**
2465
+ * Update the information elements in the display
2466
+ * @param {object} oSettings dataTables settings object
2467
+ * @memberof DataTable#oApi
2468
+ */
2469
+ function _fnUpdateInfo ( oSettings )
2470
+ {
2471
+ /* Show information about the table */
2472
+ if ( !oSettings.oFeatures.bInfo || oSettings.aanFeatures.i.length === 0 )
2473
+ {
2474
+ return;
2475
+ }
2476
+
2477
+ var
2478
+ oLang = oSettings.oLanguage,
2479
+ iStart = oSettings._iDisplayStart+1,
2480
+ iEnd = oSettings.fnDisplayEnd(),
2481
+ iMax = oSettings.fnRecordsTotal(),
2482
+ iTotal = oSettings.fnRecordsDisplay(),
2483
+ sOut;
2484
+
2485
+ if ( iTotal === 0 && iTotal == iMax )
2486
+ {
2487
+ /* Empty record set */
2488
+ sOut = oLang.sInfoEmpty;
2489
+ }
2490
+ else if ( iTotal === 0 )
2491
+ {
2492
+ /* Empty record set after filtering */
2493
+ sOut = oLang.sInfoEmpty +' '+ oLang.sInfoFiltered;
2494
+ }
2495
+ else if ( iTotal == iMax )
2496
+ {
2497
+ /* Normal record set */
2498
+ sOut = oLang.sInfo;
2499
+ }
2500
+ else
2501
+ {
2502
+ /* Record set after filtering */
2503
+ sOut = oLang.sInfo +' '+ oLang.sInfoFiltered;
2504
+ }
2505
+
2506
+ // Convert the macros
2507
+ sOut += oLang.sInfoPostFix;
2508
+ sOut = _fnInfoMacros( oSettings, sOut );
2509
+
2510
+ if ( oLang.fnInfoCallback !== null )
2511
+ {
2512
+ sOut = oLang.fnInfoCallback.call( oSettings.oInstance,
2513
+ oSettings, iStart, iEnd, iMax, iTotal, sOut );
2514
+ }
2515
+
2516
+ var n = oSettings.aanFeatures.i;
2517
+ for ( var i=0, iLen=n.length ; i<iLen ; i++ )
2518
+ {
2519
+ $(n[i]).html( sOut );
2520
+ }
2521
+ }
2522
+
2523
+
2524
+ function _fnInfoMacros ( oSettings, str )
2525
+ {
2526
+ var
2527
+ iStart = oSettings._iDisplayStart+1,
2528
+ sStart = oSettings.fnFormatNumber( iStart ),
2529
+ iEnd = oSettings.fnDisplayEnd(),
2530
+ sEnd = oSettings.fnFormatNumber( iEnd ),
2531
+ iTotal = oSettings.fnRecordsDisplay(),
2532
+ sTotal = oSettings.fnFormatNumber( iTotal ),
2533
+ iMax = oSettings.fnRecordsTotal(),
2534
+ sMax = oSettings.fnFormatNumber( iMax );
2535
+
2536
+ // When infinite scrolling, we are always starting at 1. _iDisplayStart is used only
2537
+ // internally
2538
+ if ( oSettings.oScroll.bInfinite )
2539
+ {
2540
+ sStart = oSettings.fnFormatNumber( 1 );
2541
+ }
2542
+
2543
+ return str.
2544
+ replace('_START_', sStart).
2545
+ replace('_END_', sEnd).
2546
+ replace('_TOTAL_', sTotal).
2547
+ replace('_MAX_', sMax);
2548
+ }
2549
+
2550
+
2551
+
2552
+ /**
2553
+ * Draw the table for the first time, adding all required features
2554
+ * @param {object} oSettings dataTables settings object
2555
+ * @memberof DataTable#oApi
2556
+ */
2557
+ function _fnInitialise ( oSettings )
2558
+ {
2559
+ var i, iLen, iAjaxStart=oSettings.iInitDisplayStart;
2560
+
2561
+ /* Ensure that the table data is fully initialised */
2562
+ if ( oSettings.bInitialised === false )
2563
+ {
2564
+ setTimeout( function(){ _fnInitialise( oSettings ); }, 200 );
2565
+ return;
2566
+ }
2567
+
2568
+ /* Show the display HTML options */
2569
+ _fnAddOptionsHtml( oSettings );
2570
+
2571
+ /* Build and draw the header / footer for the table */
2572
+ _fnBuildHead( oSettings );
2573
+ _fnDrawHead( oSettings, oSettings.aoHeader );
2574
+ if ( oSettings.nTFoot )
2575
+ {
2576
+ _fnDrawHead( oSettings, oSettings.aoFooter );
2577
+ }
2578
+
2579
+ /* Okay to show that something is going on now */
2580
+ _fnProcessingDisplay( oSettings, true );
2581
+
2582
+ /* Calculate sizes for columns */
2583
+ if ( oSettings.oFeatures.bAutoWidth )
2584
+ {
2585
+ _fnCalculateColumnWidths( oSettings );
2586
+ }
2587
+
2588
+ for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
2589
+ {
2590
+ if ( oSettings.aoColumns[i].sWidth !== null )
2591
+ {
2592
+ oSettings.aoColumns[i].nTh.style.width = _fnStringToCss( oSettings.aoColumns[i].sWidth );
2593
+ }
2594
+ }
2595
+
2596
+ /* If there is default sorting required - let's do it. The sort function will do the
2597
+ * drawing for us. Otherwise we draw the table regardless of the Ajax source - this allows
2598
+ * the table to look initialised for Ajax sourcing data (show 'loading' message possibly)
2599
+ */
2600
+ if ( oSettings.oFeatures.bSort )
2601
+ {
2602
+ _fnSort( oSettings );
2603
+ }
2604
+ else if ( oSettings.oFeatures.bFilter )
2605
+ {
2606
+ _fnFilterComplete( oSettings, oSettings.oPreviousSearch );
2607
+ }
2608
+ else
2609
+ {
2610
+ oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
2611
+ _fnCalculateEnd( oSettings );
2612
+ _fnDraw( oSettings );
2613
+ }
2614
+
2615
+ /* if there is an ajax source load the data */
2616
+ if ( oSettings.sAjaxSource !== null && !oSettings.oFeatures.bServerSide )
2617
+ {
2618
+ var aoData = [];
2619
+ _fnServerParams( oSettings, aoData );
2620
+ oSettings.fnServerData.call( oSettings.oInstance, oSettings.sAjaxSource, aoData, function(json) {
2621
+ var aData = (oSettings.sAjaxDataProp !== "") ?
2622
+ _fnGetObjectDataFn( oSettings.sAjaxDataProp )(json) : json;
2623
+
2624
+ /* Got the data - add it to the table */
2625
+ for ( i=0 ; i<aData.length ; i++ )
2626
+ {
2627
+ _fnAddData( oSettings, aData[i] );
2628
+ }
2629
+
2630
+ /* Reset the init display for cookie saving. We've already done a filter, and
2631
+ * therefore cleared it before. So we need to make it appear 'fresh'
2632
+ */
2633
+ oSettings.iInitDisplayStart = iAjaxStart;
2634
+
2635
+ if ( oSettings.oFeatures.bSort )
2636
+ {
2637
+ _fnSort( oSettings );
2638
+ }
2639
+ else
2640
+ {
2641
+ oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
2642
+ _fnCalculateEnd( oSettings );
2643
+ _fnDraw( oSettings );
2644
+ }
2645
+
2646
+ _fnProcessingDisplay( oSettings, false );
2647
+ _fnInitComplete( oSettings, json );
2648
+ }, oSettings );
2649
+ return;
2650
+ }
2651
+
2652
+ /* Server-side processing initialisation complete is done at the end of _fnDraw */
2653
+ if ( !oSettings.oFeatures.bServerSide )
2654
+ {
2655
+ _fnProcessingDisplay( oSettings, false );
2656
+ _fnInitComplete( oSettings );
2657
+ }
2658
+ }
2659
+
2660
+
2661
+ /**
2662
+ * Draw the table for the first time, adding all required features
2663
+ * @param {object} oSettings dataTables settings object
2664
+ * @param {object} [json] JSON from the server that completed the table, if using Ajax source
2665
+ * with client-side processing (optional)
2666
+ * @memberof DataTable#oApi
2667
+ */
2668
+ function _fnInitComplete ( oSettings, json )
2669
+ {
2670
+ oSettings._bInitComplete = true;
2671
+ _fnCallbackFire( oSettings, 'aoInitComplete', 'init', [oSettings, json] );
2672
+ }
2673
+
2674
+
2675
+ /**
2676
+ * Language compatibility - when certain options are given, and others aren't, we
2677
+ * need to duplicate the values over, in order to provide backwards compatibility
2678
+ * with older language files.
2679
+ * @param {object} oSettings dataTables settings object
2680
+ * @memberof DataTable#oApi
2681
+ */
2682
+ function _fnLanguageCompat( oLanguage )
2683
+ {
2684
+ var oDefaults = DataTable.defaults.oLanguage;
2685
+
2686
+ /* Backwards compatibility - if there is no sEmptyTable given, then use the same as
2687
+ * sZeroRecords - assuming that is given.
2688
+ */
2689
+ if ( !oLanguage.sEmptyTable && oLanguage.sZeroRecords &&
2690
+ oDefaults.sEmptyTable === "No data available in table" )
2691
+ {
2692
+ _fnMap( oLanguage, oLanguage, 'sZeroRecords', 'sEmptyTable' );
2693
+ }
2694
+
2695
+ /* Likewise with loading records */
2696
+ if ( !oLanguage.sLoadingRecords && oLanguage.sZeroRecords &&
2697
+ oDefaults.sLoadingRecords === "Loading..." )
2698
+ {
2699
+ _fnMap( oLanguage, oLanguage, 'sZeroRecords', 'sLoadingRecords' );
2700
+ }
2701
+ }
2702
+
2703
+
2704
+
2705
+ /**
2706
+ * Generate the node required for user display length changing
2707
+ * @param {object} oSettings dataTables settings object
2708
+ * @returns {node} Display length feature node
2709
+ * @memberof DataTable#oApi
2710
+ */
2711
+ function _fnFeatureHtmlLength ( oSettings )
2712
+ {
2713
+ if ( oSettings.oScroll.bInfinite )
2714
+ {
2715
+ return null;
2716
+ }
2717
+
2718
+ /* This can be overruled by not using the _MENU_ var/macro in the language variable */
2719
+ var sName = 'name="'+oSettings.sTableId+'_length"';
2720
+ var sStdMenu = '<select size="1" '+sName+'>';
2721
+ var i, iLen;
2722
+ var aLengthMenu = oSettings.aLengthMenu;
2723
+
2724
+ if ( aLengthMenu.length == 2 && typeof aLengthMenu[0] === 'object' &&
2725
+ typeof aLengthMenu[1] === 'object' )
2726
+ {
2727
+ for ( i=0, iLen=aLengthMenu[0].length ; i<iLen ; i++ )
2728
+ {
2729
+ sStdMenu += '<option value="'+aLengthMenu[0][i]+'">'+aLengthMenu[1][i]+'</option>';
2730
+ }
2731
+ }
2732
+ else
2733
+ {
2734
+ for ( i=0, iLen=aLengthMenu.length ; i<iLen ; i++ )
2735
+ {
2736
+ sStdMenu += '<option value="'+aLengthMenu[i]+'">'+aLengthMenu[i]+'</option>';
2737
+ }
2738
+ }
2739
+ sStdMenu += '</select>';
2740
+
2741
+ var nLength = document.createElement( 'div' );
2742
+ if ( !oSettings.aanFeatures.l )
2743
+ {
2744
+ nLength.id = oSettings.sTableId+'_length';
2745
+ }
2746
+ nLength.className = oSettings.oClasses.sLength;
2747
+ nLength.innerHTML = '<label>'+oSettings.oLanguage.sLengthMenu.replace( '_MENU_', sStdMenu )+'</label>';
2748
+
2749
+ /*
2750
+ * Set the length to the current display length - thanks to Andrea Pavlovic for this fix,
2751
+ * and Stefan Skopnik for fixing the fix!
2752
+ */
2753
+ $('select option[value="'+oSettings._iDisplayLength+'"]', nLength).attr("selected", true);
2754
+
2755
+ $('select', nLength).bind( 'change.DT', function(e) {
2756
+ var iVal = $(this).val();
2757
+
2758
+ /* Update all other length options for the new display */
2759
+ var n = oSettings.aanFeatures.l;
2760
+ for ( i=0, iLen=n.length ; i<iLen ; i++ )
2761
+ {
2762
+ if ( n[i] != this.parentNode )
2763
+ {
2764
+ $('select', n[i]).val( iVal );
2765
+ }
2766
+ }
2767
+
2768
+ /* Redraw the table */
2769
+ oSettings._iDisplayLength = parseInt(iVal, 10);
2770
+ _fnCalculateEnd( oSettings );
2771
+
2772
+ /* If we have space to show extra rows (backing up from the end point - then do so */
2773
+ if ( oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay() )
2774
+ {
2775
+ oSettings._iDisplayStart = oSettings.fnDisplayEnd() - oSettings._iDisplayLength;
2776
+ if ( oSettings._iDisplayStart < 0 )
2777
+ {
2778
+ oSettings._iDisplayStart = 0;
2779
+ }
2780
+ }
2781
+
2782
+ if ( oSettings._iDisplayLength == -1 )
2783
+ {
2784
+ oSettings._iDisplayStart = 0;
2785
+ }
2786
+
2787
+ _fnDraw( oSettings );
2788
+ } );
2789
+
2790
+
2791
+ $('select', nLength).attr('aria-controls', oSettings.sTableId);
2792
+
2793
+ return nLength;
2794
+ }
2795
+
2796
+
2797
+ /**
2798
+ * Recalculate the end point based on the start point
2799
+ * @param {object} oSettings dataTables settings object
2800
+ * @memberof DataTable#oApi
2801
+ */
2802
+ function _fnCalculateEnd( oSettings )
2803
+ {
2804
+ if ( oSettings.oFeatures.bPaginate === false )
2805
+ {
2806
+ oSettings._iDisplayEnd = oSettings.aiDisplay.length;
2807
+ }
2808
+ else
2809
+ {
2810
+ /* Set the end point of the display - based on how many elements there are
2811
+ * still to display
2812
+ */
2813
+ if ( oSettings._iDisplayStart + oSettings._iDisplayLength > oSettings.aiDisplay.length ||
2814
+ oSettings._iDisplayLength == -1 )
2815
+ {
2816
+ oSettings._iDisplayEnd = oSettings.aiDisplay.length;
2817
+ }
2818
+ else
2819
+ {
2820
+ oSettings._iDisplayEnd = oSettings._iDisplayStart + oSettings._iDisplayLength;
2821
+ }
2822
+ }
2823
+ }
2824
+
2825
+
2826
+
2827
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2828
+ * Note that most of the paging logic is done in
2829
+ * DataTable.ext.oPagination
2830
+ */
2831
+
2832
+ /**
2833
+ * Generate the node required for default pagination
2834
+ * @param {object} oSettings dataTables settings object
2835
+ * @returns {node} Pagination feature node
2836
+ * @memberof DataTable#oApi
2837
+ */
2838
+ function _fnFeatureHtmlPaginate ( oSettings )
2839
+ {
2840
+ if ( oSettings.oScroll.bInfinite )
2841
+ {
2842
+ return null;
2843
+ }
2844
+
2845
+ var nPaginate = document.createElement( 'div' );
2846
+ nPaginate.className = oSettings.oClasses.sPaging+oSettings.sPaginationType;
2847
+
2848
+ DataTable.ext.oPagination[ oSettings.sPaginationType ].fnInit( oSettings, nPaginate,
2849
+ function( oSettings ) {
2850
+ _fnCalculateEnd( oSettings );
2851
+ _fnDraw( oSettings );
2852
+ }
2853
+ );
2854
+
2855
+ /* Add a draw callback for the pagination on first instance, to update the paging display */
2856
+ if ( !oSettings.aanFeatures.p )
2857
+ {
2858
+ oSettings.aoDrawCallback.push( {
2859
+ "fn": function( oSettings ) {
2860
+ DataTable.ext.oPagination[ oSettings.sPaginationType ].fnUpdate( oSettings, function( oSettings ) {
2861
+ _fnCalculateEnd( oSettings );
2862
+ _fnDraw( oSettings );
2863
+ } );
2864
+ },
2865
+ "sName": "pagination"
2866
+ } );
2867
+ }
2868
+ return nPaginate;
2869
+ }
2870
+
2871
+
2872
+ /**
2873
+ * Alter the display settings to change the page
2874
+ * @param {object} oSettings dataTables settings object
2875
+ * @param {string|int} mAction Paging action to take: "first", "previous", "next" or "last"
2876
+ * or page number to jump to (integer)
2877
+ * @returns {bool} true page has changed, false - no change (no effect) eg 'first' on page 1
2878
+ * @memberof DataTable#oApi
2879
+ */
2880
+ function _fnPageChange ( oSettings, mAction )
2881
+ {
2882
+ var iOldStart = oSettings._iDisplayStart;
2883
+
2884
+ if ( typeof mAction === "number" )
2885
+ {
2886
+ oSettings._iDisplayStart = mAction * oSettings._iDisplayLength;
2887
+ if ( oSettings._iDisplayStart > oSettings.fnRecordsDisplay() )
2888
+ {
2889
+ oSettings._iDisplayStart = 0;
2890
+ }
2891
+ }
2892
+ else if ( mAction == "first" )
2893
+ {
2894
+ oSettings._iDisplayStart = 0;
2895
+ }
2896
+ else if ( mAction == "previous" )
2897
+ {
2898
+ oSettings._iDisplayStart = oSettings._iDisplayLength>=0 ?
2899
+ oSettings._iDisplayStart - oSettings._iDisplayLength :
2900
+ 0;
2901
+
2902
+ /* Correct for under-run */
2903
+ if ( oSettings._iDisplayStart < 0 )
2904
+ {
2905
+ oSettings._iDisplayStart = 0;
2906
+ }
2907
+ }
2908
+ else if ( mAction == "next" )
2909
+ {
2910
+ if ( oSettings._iDisplayLength >= 0 )
2911
+ {
2912
+ /* Make sure we are not over running the display array */
2913
+ if ( oSettings._iDisplayStart + oSettings._iDisplayLength < oSettings.fnRecordsDisplay() )
2914
+ {
2915
+ oSettings._iDisplayStart += oSettings._iDisplayLength;
2916
+ }
2917
+ }
2918
+ else
2919
+ {
2920
+ oSettings._iDisplayStart = 0;
2921
+ }
2922
+ }
2923
+ else if ( mAction == "last" )
2924
+ {
2925
+ if ( oSettings._iDisplayLength >= 0 )
2926
+ {
2927
+ var iPages = parseInt( (oSettings.fnRecordsDisplay()-1) / oSettings._iDisplayLength, 10 ) + 1;
2928
+ oSettings._iDisplayStart = (iPages-1) * oSettings._iDisplayLength;
2929
+ }
2930
+ else
2931
+ {
2932
+ oSettings._iDisplayStart = 0;
2933
+ }
2934
+ }
2935
+ else
2936
+ {
2937
+ _fnLog( oSettings, 0, "Unknown paging action: "+mAction );
2938
+ }
2939
+ $(oSettings.oInstance).trigger('page', oSettings);
2940
+
2941
+ return iOldStart != oSettings._iDisplayStart;
2942
+ }
2943
+
2944
+
2945
+
2946
+ /**
2947
+ * Generate the node required for the processing node
2948
+ * @param {object} oSettings dataTables settings object
2949
+ * @returns {node} Processing element
2950
+ * @memberof DataTable#oApi
2951
+ */
2952
+ function _fnFeatureHtmlProcessing ( oSettings )
2953
+ {
2954
+ var nProcessing = document.createElement( 'div' );
2955
+
2956
+ if ( !oSettings.aanFeatures.r )
2957
+ {
2958
+ nProcessing.id = oSettings.sTableId+'_processing';
2959
+ }
2960
+ nProcessing.innerHTML = oSettings.oLanguage.sProcessing;
2961
+ nProcessing.className = oSettings.oClasses.sProcessing;
2962
+ oSettings.nTable.parentNode.insertBefore( nProcessing, oSettings.nTable );
2963
+
2964
+ return nProcessing;
2965
+ }
2966
+
2967
+
2968
+ /**
2969
+ * Display or hide the processing indicator
2970
+ * @param {object} oSettings dataTables settings object
2971
+ * @param {bool} bShow Show the processing indicator (true) or not (false)
2972
+ * @memberof DataTable#oApi
2973
+ */
2974
+ function _fnProcessingDisplay ( oSettings, bShow )
2975
+ {
2976
+ if ( oSettings.oFeatures.bProcessing )
2977
+ {
2978
+ var an = oSettings.aanFeatures.r;
2979
+ for ( var i=0, iLen=an.length ; i<iLen ; i++ )
2980
+ {
2981
+ an[i].style.visibility = bShow ? "visible" : "hidden";
2982
+ }
2983
+ }
2984
+
2985
+ $(oSettings.oInstance).trigger('processing', [oSettings, bShow]);
2986
+ }
2987
+
2988
+
2989
+
2990
+ /**
2991
+ * Add any control elements for the table - specifically scrolling
2992
+ * @param {object} oSettings dataTables settings object
2993
+ * @returns {node} Node to add to the DOM
2994
+ * @memberof DataTable#oApi
2995
+ */
2996
+ function _fnFeatureHtmlTable ( oSettings )
2997
+ {
2998
+ /* Check if scrolling is enabled or not - if not then leave the DOM unaltered */
2999
+ if ( oSettings.oScroll.sX === "" && oSettings.oScroll.sY === "" )
3000
+ {
3001
+ return oSettings.nTable;
3002
+ }
3003
+
3004
+ /*
3005
+ * The HTML structure that we want to generate in this function is:
3006
+ * div - nScroller
3007
+ * div - nScrollHead
3008
+ * div - nScrollHeadInner
3009
+ * table - nScrollHeadTable
3010
+ * thead - nThead
3011
+ * div - nScrollBody
3012
+ * table - oSettings.nTable
3013
+ * thead - nTheadSize
3014
+ * tbody - nTbody
3015
+ * div - nScrollFoot
3016
+ * div - nScrollFootInner
3017
+ * table - nScrollFootTable
3018
+ * tfoot - nTfoot
3019
+ */
3020
+ var
3021
+ nScroller = document.createElement('div'),
3022
+ nScrollHead = document.createElement('div'),
3023
+ nScrollHeadInner = document.createElement('div'),
3024
+ nScrollBody = document.createElement('div'),
3025
+ nScrollFoot = document.createElement('div'),
3026
+ nScrollFootInner = document.createElement('div'),
3027
+ nScrollHeadTable = oSettings.nTable.cloneNode(false),
3028
+ nScrollFootTable = oSettings.nTable.cloneNode(false),
3029
+ nThead = oSettings.nTable.getElementsByTagName('thead')[0],
3030
+ nTfoot = oSettings.nTable.getElementsByTagName('tfoot').length === 0 ? null :
3031
+ oSettings.nTable.getElementsByTagName('tfoot')[0],
3032
+ oClasses = oSettings.oClasses;
3033
+
3034
+ nScrollHead.appendChild( nScrollHeadInner );
3035
+ nScrollFoot.appendChild( nScrollFootInner );
3036
+ nScrollBody.appendChild( oSettings.nTable );
3037
+ nScroller.appendChild( nScrollHead );
3038
+ nScroller.appendChild( nScrollBody );
3039
+ nScrollHeadInner.appendChild( nScrollHeadTable );
3040
+ nScrollHeadTable.appendChild( nThead );
3041
+ if ( nTfoot !== null )
3042
+ {
3043
+ nScroller.appendChild( nScrollFoot );
3044
+ nScrollFootInner.appendChild( nScrollFootTable );
3045
+ nScrollFootTable.appendChild( nTfoot );
3046
+ }
3047
+
3048
+ nScroller.className = oClasses.sScrollWrapper;
3049
+ nScrollHead.className = oClasses.sScrollHead;
3050
+ nScrollHeadInner.className = oClasses.sScrollHeadInner;
3051
+ nScrollBody.className = oClasses.sScrollBody;
3052
+ nScrollFoot.className = oClasses.sScrollFoot;
3053
+ nScrollFootInner.className = oClasses.sScrollFootInner;
3054
+
3055
+ if ( oSettings.oScroll.bAutoCss )
3056
+ {
3057
+ nScrollHead.style.overflow = "hidden";
3058
+ nScrollHead.style.position = "relative";
3059
+ nScrollFoot.style.overflow = "hidden";
3060
+ nScrollBody.style.overflow = "auto";
3061
+ }
3062
+
3063
+ nScrollHead.style.border = "0";
3064
+ nScrollHead.style.width = "100%";
3065
+ nScrollFoot.style.border = "0";
3066
+ nScrollHeadInner.style.width = oSettings.oScroll.sXInner !== "" ?
3067
+ oSettings.oScroll.sXInner : "100%"; /* will be overwritten */
3068
+
3069
+ /* Modify attributes to respect the clones */
3070
+ nScrollHeadTable.removeAttribute('id');
3071
+ nScrollHeadTable.style.marginLeft = "0";
3072
+ oSettings.nTable.style.marginLeft = "0";
3073
+ if ( nTfoot !== null )
3074
+ {
3075
+ nScrollFootTable.removeAttribute('id');
3076
+ nScrollFootTable.style.marginLeft = "0";
3077
+ }
3078
+
3079
+ /* Move caption elements from the body to the header, footer or leave where it is
3080
+ * depending on the configuration. Note that the DTD says there can be only one caption */
3081
+ var nCaption = $(oSettings.nTable).children('caption');
3082
+ if ( nCaption.length > 0 )
3083
+ {
3084
+ nCaption = nCaption[0];
3085
+ if ( nCaption._captionSide === "top" )
3086
+ {
3087
+ nScrollHeadTable.appendChild( nCaption );
3088
+ }
3089
+ else if ( nCaption._captionSide === "bottom" && nTfoot )
3090
+ {
3091
+ nScrollFootTable.appendChild( nCaption );
3092
+ }
3093
+ }
3094
+
3095
+ /*
3096
+ * Sizing
3097
+ */
3098
+ /* When x-scrolling add the width and a scroller to move the header with the body */
3099
+ if ( oSettings.oScroll.sX !== "" )
3100
+ {
3101
+ nScrollHead.style.width = _fnStringToCss( oSettings.oScroll.sX );
3102
+ nScrollBody.style.width = _fnStringToCss( oSettings.oScroll.sX );
3103
+
3104
+ if ( nTfoot !== null )
3105
+ {
3106
+ nScrollFoot.style.width = _fnStringToCss( oSettings.oScroll.sX );
3107
+ }
3108
+
3109
+ /* When the body is scrolled, then we also want to scroll the headers */
3110
+ $(nScrollBody).scroll( function (e) {
3111
+ nScrollHead.scrollLeft = this.scrollLeft;
3112
+
3113
+ if ( nTfoot !== null )
3114
+ {
3115
+ nScrollFoot.scrollLeft = this.scrollLeft;
3116
+ }
3117
+ } );
3118
+ }
3119
+
3120
+ /* When yscrolling, add the height */
3121
+ if ( oSettings.oScroll.sY !== "" )
3122
+ {
3123
+ nScrollBody.style.height = _fnStringToCss( oSettings.oScroll.sY );
3124
+ }
3125
+
3126
+ /* Redraw - align columns across the tables */
3127
+ oSettings.aoDrawCallback.push( {
3128
+ "fn": _fnScrollDraw,
3129
+ "sName": "scrolling"
3130
+ } );
3131
+
3132
+ /* Infinite scrolling event handlers */
3133
+ if ( oSettings.oScroll.bInfinite )
3134
+ {
3135
+ $(nScrollBody).scroll( function() {
3136
+ /* Use a blocker to stop scrolling from loading more data while other data is still loading */
3137
+ if ( !oSettings.bDrawing && $(this).scrollTop() !== 0 )
3138
+ {
3139
+ /* Check if we should load the next data set */
3140
+ if ( $(this).scrollTop() + $(this).height() >
3141
+ $(oSettings.nTable).height() - oSettings.oScroll.iLoadGap )
3142
+ {
3143
+ /* Only do the redraw if we have to - we might be at the end of the data */
3144
+ if ( oSettings.fnDisplayEnd() < oSettings.fnRecordsDisplay() )
3145
+ {
3146
+ _fnPageChange( oSettings, 'next' );
3147
+ _fnCalculateEnd( oSettings );
3148
+ _fnDraw( oSettings );
3149
+ }
3150
+ }
3151
+ }
3152
+ } );
3153
+ }
3154
+
3155
+ oSettings.nScrollHead = nScrollHead;
3156
+ oSettings.nScrollFoot = nScrollFoot;
3157
+
3158
+ return nScroller;
3159
+ }
3160
+
3161
+
3162
+ /**
3163
+ * Update the various tables for resizing. It's a bit of a pig this function, but
3164
+ * basically the idea to:
3165
+ * 1. Re-create the table inside the scrolling div
3166
+ * 2. Take live measurements from the DOM
3167
+ * 3. Apply the measurements
3168
+ * 4. Clean up
3169
+ * @param {object} o dataTables settings object
3170
+ * @returns {node} Node to add to the DOM
3171
+ * @memberof DataTable#oApi
3172
+ */
3173
+ function _fnScrollDraw ( o )
3174
+ {
3175
+ var
3176
+ nScrollHeadInner = o.nScrollHead.getElementsByTagName('div')[0],
3177
+ nScrollHeadTable = nScrollHeadInner.getElementsByTagName('table')[0],
3178
+ nScrollBody = o.nTable.parentNode,
3179
+ i, iLen, j, jLen, anHeadToSize, anHeadSizers, anFootSizers, anFootToSize, oStyle, iVis,
3180
+ nTheadSize, nTfootSize,
3181
+ iWidth, aApplied=[], iSanityWidth,
3182
+ nScrollFootInner = (o.nTFoot !== null) ? o.nScrollFoot.getElementsByTagName('div')[0] : null,
3183
+ nScrollFootTable = (o.nTFoot !== null) ? nScrollFootInner.getElementsByTagName('table')[0] : null,
3184
+ ie67 = o.oBrowser.bScrollOversize;
3185
+
3186
+ /*
3187
+ * 1. Re-create the table inside the scrolling div
3188
+ */
3189
+
3190
+ /* Remove the old minimised thead and tfoot elements in the inner table */
3191
+ $(o.nTable).children('thead, tfoot').remove();
3192
+
3193
+ /* Clone the current header and footer elements and then place it into the inner table */
3194
+ nTheadSize = $(o.nTHead).clone()[0];
3195
+ o.nTable.insertBefore( nTheadSize, o.nTable.childNodes[0] );
3196
+
3197
+ if ( o.nTFoot !== null )
3198
+ {
3199
+ nTfootSize = $(o.nTFoot).clone()[0];
3200
+ o.nTable.insertBefore( nTfootSize, o.nTable.childNodes[1] );
3201
+ }
3202
+
3203
+ /*
3204
+ * 2. Take live measurements from the DOM - do not alter the DOM itself!
3205
+ */
3206
+
3207
+ /* Remove old sizing and apply the calculated column widths
3208
+ * Get the unique column headers in the newly created (cloned) header. We want to apply the
3209
+ * calculated sizes to this header
3210
+ */
3211
+ if ( o.oScroll.sX === "" )
3212
+ {
3213
+ nScrollBody.style.width = '100%';
3214
+ nScrollHeadInner.parentNode.style.width = '100%';
3215
+ }
3216
+
3217
+ var nThs = _fnGetUniqueThs( o, nTheadSize );
3218
+ for ( i=0, iLen=nThs.length ; i<iLen ; i++ )
3219
+ {
3220
+ iVis = _fnVisibleToColumnIndex( o, i );
3221
+ nThs[i].style.width = o.aoColumns[iVis].sWidth;
3222
+ }
3223
+
3224
+ if ( o.nTFoot !== null )
3225
+ {
3226
+ _fnApplyToChildren( function(n) {
3227
+ n.style.width = "";
3228
+ }, nTfootSize.getElementsByTagName('tr') );
3229
+ }
3230
+
3231
+ // If scroll collapse is enabled, when we put the headers back into the body for sizing, we
3232
+ // will end up forcing the scrollbar to appear, making our measurements wrong for when we
3233
+ // then hide it (end of this function), so add the header height to the body scroller.
3234
+ if ( o.oScroll.bCollapse && o.oScroll.sY !== "" )
3235
+ {
3236
+ nScrollBody.style.height = (nScrollBody.offsetHeight + o.nTHead.offsetHeight)+"px";
3237
+ }
3238
+
3239
+ /* Size the table as a whole */
3240
+ iSanityWidth = $(o.nTable).outerWidth();
3241
+ if ( o.oScroll.sX === "" )
3242
+ {
3243
+ /* No x scrolling */
3244
+ o.nTable.style.width = "100%";
3245
+
3246
+ /* I know this is rubbish - but IE7 will make the width of the table when 100% include
3247
+ * the scrollbar - which is shouldn't. When there is a scrollbar we need to take this
3248
+ * into account.
3249
+ */
3250
+ if ( ie67 && ($('tbody', nScrollBody).height() > nScrollBody.offsetHeight ||
3251
+ $(nScrollBody).css('overflow-y') == "scroll") )
3252
+ {
3253
+ o.nTable.style.width = _fnStringToCss( $(o.nTable).outerWidth() - o.oScroll.iBarWidth);
3254
+ }
3255
+ }
3256
+ else
3257
+ {
3258
+ if ( o.oScroll.sXInner !== "" )
3259
+ {
3260
+ /* x scroll inner has been given - use it */
3261
+ o.nTable.style.width = _fnStringToCss(o.oScroll.sXInner);
3262
+ }
3263
+ else if ( iSanityWidth == $(nScrollBody).width() &&
3264
+ $(nScrollBody).height() < $(o.nTable).height() )
3265
+ {
3266
+ /* There is y-scrolling - try to take account of the y scroll bar */
3267
+ o.nTable.style.width = _fnStringToCss( iSanityWidth-o.oScroll.iBarWidth );
3268
+ if ( $(o.nTable).outerWidth() > iSanityWidth-o.oScroll.iBarWidth )
3269
+ {
3270
+ /* Not possible to take account of it */
3271
+ o.nTable.style.width = _fnStringToCss( iSanityWidth );
3272
+ }
3273
+ }
3274
+ else
3275
+ {
3276
+ /* All else fails */
3277
+ o.nTable.style.width = _fnStringToCss( iSanityWidth );
3278
+ }
3279
+ }
3280
+
3281
+ /* Recalculate the sanity width - now that we've applied the required width, before it was
3282
+ * a temporary variable. This is required because the column width calculation is done
3283
+ * before this table DOM is created.
3284
+ */
3285
+ iSanityWidth = $(o.nTable).outerWidth();
3286
+
3287
+ /* We want the hidden header to have zero height, so remove padding and borders. Then
3288
+ * set the width based on the real headers
3289
+ */
3290
+ anHeadToSize = o.nTHead.getElementsByTagName('tr');
3291
+ anHeadSizers = nTheadSize.getElementsByTagName('tr');
3292
+
3293
+ _fnApplyToChildren( function(nSizer, nToSize) {
3294
+ oStyle = nSizer.style;
3295
+ oStyle.paddingTop = "0";
3296
+ oStyle.paddingBottom = "0";
3297
+ oStyle.borderTopWidth = "0";
3298
+ oStyle.borderBottomWidth = "0";
3299
+ oStyle.height = 0;
3300
+
3301
+ iWidth = $(nSizer).width();
3302
+ nToSize.style.width = _fnStringToCss( iWidth );
3303
+ aApplied.push( iWidth );
3304
+ }, anHeadSizers, anHeadToSize );
3305
+ $(anHeadSizers).height(0);
3306
+
3307
+ if ( o.nTFoot !== null )
3308
+ {
3309
+ /* Clone the current footer and then place it into the body table as a "hidden header" */
3310
+ anFootSizers = nTfootSize.getElementsByTagName('tr');
3311
+ anFootToSize = o.nTFoot.getElementsByTagName('tr');
3312
+
3313
+ _fnApplyToChildren( function(nSizer, nToSize) {
3314
+ oStyle = nSizer.style;
3315
+ oStyle.paddingTop = "0";
3316
+ oStyle.paddingBottom = "0";
3317
+ oStyle.borderTopWidth = "0";
3318
+ oStyle.borderBottomWidth = "0";
3319
+ oStyle.height = 0;
3320
+
3321
+ iWidth = $(nSizer).width();
3322
+ nToSize.style.width = _fnStringToCss( iWidth );
3323
+ aApplied.push( iWidth );
3324
+ }, anFootSizers, anFootToSize );
3325
+ $(anFootSizers).height(0);
3326
+ }
3327
+
3328
+ /*
3329
+ * 3. Apply the measurements
3330
+ */
3331
+
3332
+ /* "Hide" the header and footer that we used for the sizing. We want to also fix their width
3333
+ * to what they currently are
3334
+ */
3335
+ _fnApplyToChildren( function(nSizer) {
3336
+ nSizer.innerHTML = "";
3337
+ nSizer.style.width = _fnStringToCss( aApplied.shift() );
3338
+ }, anHeadSizers );
3339
+
3340
+ if ( o.nTFoot !== null )
3341
+ {
3342
+ _fnApplyToChildren( function(nSizer) {
3343
+ nSizer.innerHTML = "";
3344
+ nSizer.style.width = _fnStringToCss( aApplied.shift() );
3345
+ }, anFootSizers );
3346
+ }
3347
+
3348
+ /* Sanity check that the table is of a sensible width. If not then we are going to get
3349
+ * misalignment - try to prevent this by not allowing the table to shrink below its min width
3350
+ */
3351
+ if ( $(o.nTable).outerWidth() < iSanityWidth )
3352
+ {
3353
+ /* The min width depends upon if we have a vertical scrollbar visible or not */
3354
+ var iCorrection = ((nScrollBody.scrollHeight > nScrollBody.offsetHeight ||
3355
+ $(nScrollBody).css('overflow-y') == "scroll")) ?
3356
+ iSanityWidth+o.oScroll.iBarWidth : iSanityWidth;
3357
+
3358
+ /* IE6/7 are a law unto themselves... */
3359
+ if ( ie67 && (nScrollBody.scrollHeight >
3360
+ nScrollBody.offsetHeight || $(nScrollBody).css('overflow-y') == "scroll") )
3361
+ {
3362
+ o.nTable.style.width = _fnStringToCss( iCorrection-o.oScroll.iBarWidth );
3363
+ }
3364
+
3365
+ /* Apply the calculated minimum width to the table wrappers */
3366
+ nScrollBody.style.width = _fnStringToCss( iCorrection );
3367
+ nScrollHeadInner.parentNode.style.width = _fnStringToCss( iCorrection );
3368
+
3369
+ if ( o.nTFoot !== null )
3370
+ {
3371
+ nScrollFootInner.parentNode.style.width = _fnStringToCss( iCorrection );
3372
+ }
3373
+
3374
+ /* And give the user a warning that we've stopped the table getting too small */
3375
+ if ( o.oScroll.sX === "" )
3376
+ {
3377
+ _fnLog( o, 1, "The table cannot fit into the current element which will cause column"+
3378
+ " misalignment. The table has been drawn at its minimum possible width." );
3379
+ }
3380
+ else if ( o.oScroll.sXInner !== "" )
3381
+ {
3382
+ _fnLog( o, 1, "The table cannot fit into the current element which will cause column"+
3383
+ " misalignment. Increase the sScrollXInner value or remove it to allow automatic"+
3384
+ " calculation" );
3385
+ }
3386
+ }
3387
+ else
3388
+ {
3389
+ nScrollBody.style.width = _fnStringToCss( '100%' );
3390
+ nScrollHeadInner.parentNode.style.width = _fnStringToCss( '100%' );
3391
+
3392
+ if ( o.nTFoot !== null )
3393
+ {
3394
+ nScrollFootInner.parentNode.style.width = _fnStringToCss( '100%' );
3395
+ }
3396
+ }
3397
+
3398
+
3399
+ /*
3400
+ * 4. Clean up
3401
+ */
3402
+ if ( o.oScroll.sY === "" )
3403
+ {
3404
+ /* IE7< puts a vertical scrollbar in place (when it shouldn't be) due to subtracting
3405
+ * the scrollbar height from the visible display, rather than adding it on. We need to
3406
+ * set the height in order to sort this. Don't want to do it in any other browsers.
3407
+ */
3408
+ if ( ie67 )
3409
+ {
3410
+ nScrollBody.style.height = _fnStringToCss( o.nTable.offsetHeight+o.oScroll.iBarWidth );
3411
+ }
3412
+ }
3413
+
3414
+ if ( o.oScroll.sY !== "" && o.oScroll.bCollapse )
3415
+ {
3416
+ nScrollBody.style.height = _fnStringToCss( o.oScroll.sY );
3417
+
3418
+ var iExtra = (o.oScroll.sX !== "" && o.nTable.offsetWidth > nScrollBody.offsetWidth) ?
3419
+ o.oScroll.iBarWidth : 0;
3420
+ if ( o.nTable.offsetHeight < nScrollBody.offsetHeight )
3421
+ {
3422
+ nScrollBody.style.height = _fnStringToCss( o.nTable.offsetHeight+iExtra );
3423
+ }
3424
+ }
3425
+
3426
+ /* Finally set the width's of the header and footer tables */
3427
+ var iOuterWidth = $(o.nTable).outerWidth();
3428
+ nScrollHeadTable.style.width = _fnStringToCss( iOuterWidth );
3429
+ nScrollHeadInner.style.width = _fnStringToCss( iOuterWidth );
3430
+
3431
+ // Figure out if there are scrollbar present - if so then we need a the header and footer to
3432
+ // provide a bit more space to allow "overflow" scrolling (i.e. past the scrollbar)
3433
+ var bScrolling = $(o.nTable).height() > nScrollBody.clientHeight || $(nScrollBody).css('overflow-y') == "scroll";
3434
+ nScrollHeadInner.style.paddingRight = bScrolling ? o.oScroll.iBarWidth+"px" : "0px";
3435
+
3436
+ if ( o.nTFoot !== null )
3437
+ {
3438
+ nScrollFootTable.style.width = _fnStringToCss( iOuterWidth );
3439
+ nScrollFootInner.style.width = _fnStringToCss( iOuterWidth );
3440
+ nScrollFootInner.style.paddingRight = bScrolling ? o.oScroll.iBarWidth+"px" : "0px";
3441
+ }
3442
+
3443
+ /* Adjust the position of the header in case we loose the y-scrollbar */
3444
+ $(nScrollBody).scroll();
3445
+
3446
+ /* If sorting or filtering has occurred, jump the scrolling back to the top */
3447
+ if ( o.bSorted || o.bFiltered )
3448
+ {
3449
+ nScrollBody.scrollTop = 0;
3450
+ }
3451
+ }
3452
+
3453
+
3454
+ /**
3455
+ * Apply a given function to the display child nodes of an element array (typically
3456
+ * TD children of TR rows
3457
+ * @param {function} fn Method to apply to the objects
3458
+ * @param array {nodes} an1 List of elements to look through for display children
3459
+ * @param array {nodes} an2 Another list (identical structure to the first) - optional
3460
+ * @memberof DataTable#oApi
3461
+ */
3462
+ function _fnApplyToChildren( fn, an1, an2 )
3463
+ {
3464
+ for ( var i=0, iLen=an1.length ; i<iLen ; i++ )
3465
+ {
3466
+ for ( var j=0, jLen=an1[i].childNodes.length ; j<jLen ; j++ )
3467
+ {
3468
+ if ( an1[i].childNodes[j].nodeType == 1 )
3469
+ {
3470
+ if ( an2 )
3471
+ {
3472
+ fn( an1[i].childNodes[j], an2[i].childNodes[j] );
3473
+ }
3474
+ else
3475
+ {
3476
+ fn( an1[i].childNodes[j] );
3477
+ }
3478
+ }
3479
+ }
3480
+ }
3481
+ }
3482
+
3483
+
3484
+
3485
+ /**
3486
+ * Convert a CSS unit width to pixels (e.g. 2em)
3487
+ * @param {string} sWidth width to be converted
3488
+ * @param {node} nParent parent to get the with for (required for relative widths) - optional
3489
+ * @returns {int} iWidth width in pixels
3490
+ * @memberof DataTable#oApi
3491
+ */
3492
+ function _fnConvertToWidth ( sWidth, nParent )
3493
+ {
3494
+ if ( !sWidth || sWidth === null || sWidth === '' )
3495
+ {
3496
+ return 0;
3497
+ }
3498
+
3499
+ if ( !nParent )
3500
+ {
3501
+ nParent = document.getElementsByTagName('body')[0];
3502
+ }
3503
+
3504
+ var iWidth;
3505
+ var nTmp = document.createElement( "div" );
3506
+ nTmp.style.width = _fnStringToCss( sWidth );
3507
+
3508
+ nParent.appendChild( nTmp );
3509
+ iWidth = nTmp.offsetWidth;
3510
+ nParent.removeChild( nTmp );
3511
+
3512
+ return ( iWidth );
3513
+ }
3514
+
3515
+
3516
+ /**
3517
+ * Calculate the width of columns for the table
3518
+ * @param {object} oSettings dataTables settings object
3519
+ * @memberof DataTable#oApi
3520
+ */
3521
+ function _fnCalculateColumnWidths ( oSettings )
3522
+ {
3523
+ var iTableWidth = oSettings.nTable.offsetWidth;
3524
+ var iUserInputs = 0;
3525
+ var iTmpWidth;
3526
+ var iVisibleColumns = 0;
3527
+ var iColums = oSettings.aoColumns.length;
3528
+ var i, iIndex, iCorrector, iWidth;
3529
+ var oHeaders = $('th', oSettings.nTHead);
3530
+ var widthAttr = oSettings.nTable.getAttribute('width');
3531
+
3532
+ /* Convert any user input sizes into pixel sizes */
3533
+ for ( i=0 ; i<iColums ; i++ )
3534
+ {
3535
+ if ( oSettings.aoColumns[i].bVisible )
3536
+ {
3537
+ iVisibleColumns++;
3538
+
3539
+ if ( oSettings.aoColumns[i].sWidth !== null )
3540
+ {
3541
+ iTmpWidth = _fnConvertToWidth( oSettings.aoColumns[i].sWidthOrig,
3542
+ oSettings.nTable.parentNode );
3543
+ if ( iTmpWidth !== null )
3544
+ {
3545
+ oSettings.aoColumns[i].sWidth = _fnStringToCss( iTmpWidth );
3546
+ }
3547
+
3548
+ iUserInputs++;
3549
+ }
3550
+ }
3551
+ }
3552
+
3553
+ /* If the number of columns in the DOM equals the number that we have to process in
3554
+ * DataTables, then we can use the offsets that are created by the web-browser. No custom
3555
+ * sizes can be set in order for this to happen, nor scrolling used
3556
+ */
3557
+ if ( iColums == oHeaders.length && iUserInputs === 0 && iVisibleColumns == iColums &&
3558
+ oSettings.oScroll.sX === "" && oSettings.oScroll.sY === "" )
3559
+ {
3560
+ for ( i=0 ; i<oSettings.aoColumns.length ; i++ )
3561
+ {
3562
+ iTmpWidth = $(oHeaders[i]).width();
3563
+ if ( iTmpWidth !== null )
3564
+ {
3565
+ oSettings.aoColumns[i].sWidth = _fnStringToCss( iTmpWidth );
3566
+ }
3567
+ }
3568
+ }
3569
+ else
3570
+ {
3571
+ /* Otherwise we are going to have to do some calculations to get the width of each column.
3572
+ * Construct a 1 row table with the widest node in the data, and any user defined widths,
3573
+ * then insert it into the DOM and allow the browser to do all the hard work of
3574
+ * calculating table widths.
3575
+ */
3576
+ var
3577
+ nCalcTmp = oSettings.nTable.cloneNode( false ),
3578
+ nTheadClone = oSettings.nTHead.cloneNode(true),
3579
+ nBody = document.createElement( 'tbody' ),
3580
+ nTr = document.createElement( 'tr' ),
3581
+ nDivSizing;
3582
+
3583
+ nCalcTmp.removeAttribute( "id" );
3584
+ nCalcTmp.appendChild( nTheadClone );
3585
+ if ( oSettings.nTFoot !== null )
3586
+ {
3587
+ nCalcTmp.appendChild( oSettings.nTFoot.cloneNode(true) );
3588
+ _fnApplyToChildren( function(n) {
3589
+ n.style.width = "";
3590
+ }, nCalcTmp.getElementsByTagName('tr') );
3591
+ }
3592
+
3593
+ nCalcTmp.appendChild( nBody );
3594
+ nBody.appendChild( nTr );
3595
+
3596
+ /* Remove any sizing that was previously applied by the styles */
3597
+ var jqColSizing = $('thead th', nCalcTmp);
3598
+ if ( jqColSizing.length === 0 )
3599
+ {
3600
+ jqColSizing = $('tbody tr:eq(0)>td', nCalcTmp);
3601
+ }
3602
+
3603
+ /* Apply custom sizing to the cloned header */
3604
+ var nThs = _fnGetUniqueThs( oSettings, nTheadClone );
3605
+ iCorrector = 0;
3606
+ for ( i=0 ; i<iColums ; i++ )
3607
+ {
3608
+ var oColumn = oSettings.aoColumns[i];
3609
+ if ( oColumn.bVisible && oColumn.sWidthOrig !== null && oColumn.sWidthOrig !== "" )
3610
+ {
3611
+ nThs[i-iCorrector].style.width = _fnStringToCss( oColumn.sWidthOrig );
3612
+ }
3613
+ else if ( oColumn.bVisible )
3614
+ {
3615
+ nThs[i-iCorrector].style.width = "";
3616
+ }
3617
+ else
3618
+ {
3619
+ iCorrector++;
3620
+ }
3621
+ }
3622
+
3623
+ /* Find the biggest td for each column and put it into the table */
3624
+ for ( i=0 ; i<iColums ; i++ )
3625
+ {
3626
+ if ( oSettings.aoColumns[i].bVisible )
3627
+ {
3628
+ var nTd = _fnGetWidestNode( oSettings, i );
3629
+ if ( nTd !== null )
3630
+ {
3631
+ nTd = nTd.cloneNode(true);
3632
+ if ( oSettings.aoColumns[i].sContentPadding !== "" )
3633
+ {
3634
+ nTd.innerHTML += oSettings.aoColumns[i].sContentPadding;
3635
+ }
3636
+ nTr.appendChild( nTd );
3637
+ }
3638
+ }
3639
+ }
3640
+
3641
+ /* Build the table and 'display' it */
3642
+ var nWrapper = oSettings.nTable.parentNode;
3643
+ nWrapper.appendChild( nCalcTmp );
3644
+
3645
+ /* When scrolling (X or Y) we want to set the width of the table as appropriate. However,
3646
+ * when not scrolling leave the table width as it is. This results in slightly different,
3647
+ * but I think correct behaviour
3648
+ */
3649
+ if ( oSettings.oScroll.sX !== "" && oSettings.oScroll.sXInner !== "" )
3650
+ {
3651
+ nCalcTmp.style.width = _fnStringToCss(oSettings.oScroll.sXInner);
3652
+ }
3653
+ else if ( oSettings.oScroll.sX !== "" )
3654
+ {
3655
+ nCalcTmp.style.width = "";
3656
+ if ( $(nCalcTmp).width() < nWrapper.offsetWidth )
3657
+ {
3658
+ nCalcTmp.style.width = _fnStringToCss( nWrapper.offsetWidth );
3659
+ }
3660
+ }
3661
+ else if ( oSettings.oScroll.sY !== "" )
3662
+ {
3663
+ nCalcTmp.style.width = _fnStringToCss( nWrapper.offsetWidth );
3664
+ }
3665
+ else if ( widthAttr )
3666
+ {
3667
+ nCalcTmp.style.width = _fnStringToCss( widthAttr );
3668
+ }
3669
+ nCalcTmp.style.visibility = "hidden";
3670
+
3671
+ /* Scrolling considerations */
3672
+ _fnScrollingWidthAdjust( oSettings, nCalcTmp );
3673
+
3674
+ /* Read the width's calculated by the browser and store them for use by the caller. We
3675
+ * first of all try to use the elements in the body, but it is possible that there are
3676
+ * no elements there, under which circumstances we use the header elements
3677
+ */
3678
+ var oNodes = $("tbody tr:eq(0)", nCalcTmp).children();
3679
+ if ( oNodes.length === 0 )
3680
+ {
3681
+ oNodes = _fnGetUniqueThs( oSettings, $('thead', nCalcTmp)[0] );
3682
+ }
3683
+
3684
+ /* Browsers need a bit of a hand when a width is assigned to any columns when
3685
+ * x-scrolling as they tend to collapse the table to the min-width, even if
3686
+ * we sent the column widths. So we need to keep track of what the table width
3687
+ * should be by summing the user given values, and the automatic values
3688
+ */
3689
+ if ( oSettings.oScroll.sX !== "" )
3690
+ {
3691
+ var iTotal = 0;
3692
+ iCorrector = 0;
3693
+ for ( i=0 ; i<oSettings.aoColumns.length ; i++ )
3694
+ {
3695
+ if ( oSettings.aoColumns[i].bVisible )
3696
+ {
3697
+ if ( oSettings.aoColumns[i].sWidthOrig === null )
3698
+ {
3699
+ iTotal += $(oNodes[iCorrector]).outerWidth();
3700
+ }
3701
+ else
3702
+ {
3703
+ iTotal += parseInt(oSettings.aoColumns[i].sWidth.replace('px',''), 10) +
3704
+ ($(oNodes[iCorrector]).outerWidth() - $(oNodes[iCorrector]).width());
3705
+ }
3706
+ iCorrector++;
3707
+ }
3708
+ }
3709
+
3710
+ nCalcTmp.style.width = _fnStringToCss( iTotal );
3711
+ oSettings.nTable.style.width = _fnStringToCss( iTotal );
3712
+ }
3713
+
3714
+ iCorrector = 0;
3715
+ for ( i=0 ; i<oSettings.aoColumns.length ; i++ )
3716
+ {
3717
+ if ( oSettings.aoColumns[i].bVisible )
3718
+ {
3719
+ iWidth = $(oNodes[iCorrector]).width();
3720
+ if ( iWidth !== null && iWidth > 0 )
3721
+ {
3722
+ oSettings.aoColumns[i].sWidth = _fnStringToCss( iWidth );
3723
+ }
3724
+ iCorrector++;
3725
+ }
3726
+ }
3727
+
3728
+ var cssWidth = $(nCalcTmp).css('width');
3729
+ oSettings.nTable.style.width = (cssWidth.indexOf('%') !== -1) ?
3730
+ cssWidth : _fnStringToCss( $(nCalcTmp).outerWidth() );
3731
+ nCalcTmp.parentNode.removeChild( nCalcTmp );
3732
+ }
3733
+
3734
+ if ( widthAttr )
3735
+ {
3736
+ oSettings.nTable.style.width = _fnStringToCss( widthAttr );
3737
+ }
3738
+ }
3739
+
3740
+
3741
+ /**
3742
+ * Adjust a table's width to take account of scrolling
3743
+ * @param {object} oSettings dataTables settings object
3744
+ * @param {node} n table node
3745
+ * @memberof DataTable#oApi
3746
+ */
3747
+ function _fnScrollingWidthAdjust ( oSettings, n )
3748
+ {
3749
+ if ( oSettings.oScroll.sX === "" && oSettings.oScroll.sY !== "" )
3750
+ {
3751
+ /* When y-scrolling only, we want to remove the width of the scroll bar so the table
3752
+ * + scroll bar will fit into the area avaialble.
3753
+ */
3754
+ var iOrigWidth = $(n).width();
3755
+ n.style.width = _fnStringToCss( $(n).outerWidth()-oSettings.oScroll.iBarWidth );
3756
+ }
3757
+ else if ( oSettings.oScroll.sX !== "" )
3758
+ {
3759
+ /* When x-scrolling both ways, fix the table at it's current size, without adjusting */
3760
+ n.style.width = _fnStringToCss( $(n).outerWidth() );
3761
+ }
3762
+ }
3763
+
3764
+
3765
+ /**
3766
+ * Get the widest node
3767
+ * @param {object} oSettings dataTables settings object
3768
+ * @param {int} iCol column of interest
3769
+ * @returns {string} max string length for each column
3770
+ * @memberof DataTable#oApi
3771
+ */
3772
+ function _fnGetWidestNode( oSettings, iCol )
3773
+ {
3774
+ var iMaxIndex = _fnGetMaxLenString( oSettings, iCol );
3775
+ if ( iMaxIndex < 0 )
3776
+ {
3777
+ return null;
3778
+ }
3779
+
3780
+ if ( oSettings.aoData[iMaxIndex].nTr === null )
3781
+ {
3782
+ var n = document.createElement('td');
3783
+ n.innerHTML = _fnGetCellData( oSettings, iMaxIndex, iCol, '' );
3784
+ return n;
3785
+ }
3786
+ return _fnGetTdNodes(oSettings, iMaxIndex)[iCol];
3787
+ }
3788
+
3789
+
3790
+ /**
3791
+ * Get the maximum strlen for each data column
3792
+ * @param {object} oSettings dataTables settings object
3793
+ * @param {int} iCol column of interest
3794
+ * @returns {string} max string length for each column
3795
+ * @memberof DataTable#oApi
3796
+ */
3797
+ function _fnGetMaxLenString( oSettings, iCol )
3798
+ {
3799
+ var iMax = -1;
3800
+ var iMaxIndex = -1;
3801
+
3802
+ for ( var i=0 ; i<oSettings.aoData.length ; i++ )
3803
+ {
3804
+ var s = _fnGetCellData( oSettings, i, iCol, 'display' )+"";
3805
+ s = s.replace( /<.*?>/g, "" );
3806
+ if ( s.length > iMax )
3807
+ {
3808
+ iMax = s.length;
3809
+ iMaxIndex = i;
3810
+ }
3811
+ }
3812
+
3813
+ return iMaxIndex;
3814
+ }
3815
+
3816
+
3817
+ /**
3818
+ * Append a CSS unit (only if required) to a string
3819
+ * @param {array} aArray1 first array
3820
+ * @param {array} aArray2 second array
3821
+ * @returns {int} 0 if match, 1 if length is different, 2 if no match
3822
+ * @memberof DataTable#oApi
3823
+ */
3824
+ function _fnStringToCss( s )
3825
+ {
3826
+ if ( s === null )
3827
+ {
3828
+ return "0px";
3829
+ }
3830
+
3831
+ if ( typeof s == 'number' )
3832
+ {
3833
+ if ( s < 0 )
3834
+ {
3835
+ return "0px";
3836
+ }
3837
+ return s+"px";
3838
+ }
3839
+
3840
+ /* Check if the last character is not 0-9 */
3841
+ var c = s.charCodeAt( s.length-1 );
3842
+ if (c < 0x30 || c > 0x39)
3843
+ {
3844
+ return s;
3845
+ }
3846
+ return s+"px";
3847
+ }
3848
+
3849
+
3850
+ /**
3851
+ * Get the width of a scroll bar in this browser being used
3852
+ * @returns {int} width in pixels
3853
+ * @memberof DataTable#oApi
3854
+ */
3855
+ function _fnScrollBarWidth ()
3856
+ {
3857
+ var inner = document.createElement('p');
3858
+ var style = inner.style;
3859
+ style.width = "100%";
3860
+ style.height = "200px";
3861
+ style.padding = "0px";
3862
+
3863
+ var outer = document.createElement('div');
3864
+ style = outer.style;
3865
+ style.position = "absolute";
3866
+ style.top = "0px";
3867
+ style.left = "0px";
3868
+ style.visibility = "hidden";
3869
+ style.width = "200px";
3870
+ style.height = "150px";
3871
+ style.padding = "0px";
3872
+ style.overflow = "hidden";
3873
+ outer.appendChild(inner);
3874
+
3875
+ document.body.appendChild(outer);
3876
+ var w1 = inner.offsetWidth;
3877
+ outer.style.overflow = 'scroll';
3878
+ var w2 = inner.offsetWidth;
3879
+ if ( w1 == w2 )
3880
+ {
3881
+ w2 = outer.clientWidth;
3882
+ }
3883
+
3884
+ document.body.removeChild(outer);
3885
+ return (w1 - w2);
3886
+ }
3887
+
3888
+
3889
+
3890
+ /**
3891
+ * Change the order of the table
3892
+ * @param {object} oSettings dataTables settings object
3893
+ * @param {bool} bApplyClasses optional - should we apply classes or not
3894
+ * @memberof DataTable#oApi
3895
+ */
3896
+ function _fnSort ( oSettings, bApplyClasses )
3897
+ {
3898
+ var
3899
+ i, iLen, j, jLen, k, kLen,
3900
+ sDataType, nTh,
3901
+ aaSort = [],
3902
+ aiOrig = [],
3903
+ oSort = DataTable.ext.oSort,
3904
+ aoData = oSettings.aoData,
3905
+ aoColumns = oSettings.aoColumns,
3906
+ oAria = oSettings.oLanguage.oAria;
3907
+
3908
+ /* No sorting required if server-side or no sorting array */
3909
+ if ( !oSettings.oFeatures.bServerSide &&
3910
+ (oSettings.aaSorting.length !== 0 || oSettings.aaSortingFixed !== null) )
3911
+ {
3912
+ aaSort = ( oSettings.aaSortingFixed !== null ) ?
3913
+ oSettings.aaSortingFixed.concat( oSettings.aaSorting ) :
3914
+ oSettings.aaSorting.slice();
3915
+
3916
+ /* If there is a sorting data type, and a function belonging to it, then we need to
3917
+ * get the data from the developer's function and apply it for this column
3918
+ */
3919
+ for ( i=0 ; i<aaSort.length ; i++ )
3920
+ {
3921
+ var iColumn = aaSort[i][0];
3922
+ var iVisColumn = _fnColumnIndexToVisible( oSettings, iColumn );
3923
+ sDataType = oSettings.aoColumns[ iColumn ].sSortDataType;
3924
+ if ( DataTable.ext.afnSortData[sDataType] )
3925
+ {
3926
+ var aData = DataTable.ext.afnSortData[sDataType].call(
3927
+ oSettings.oInstance, oSettings, iColumn, iVisColumn
3928
+ );
3929
+ if ( aData.length === aoData.length )
3930
+ {
3931
+ for ( j=0, jLen=aoData.length ; j<jLen ; j++ )
3932
+ {
3933
+ _fnSetCellData( oSettings, j, iColumn, aData[j] );
3934
+ }
3935
+ }
3936
+ else
3937
+ {
3938
+ _fnLog( oSettings, 0, "Returned data sort array (col "+iColumn+") is the wrong length" );
3939
+ }
3940
+ }
3941
+ }
3942
+
3943
+ /* Create a value - key array of the current row positions such that we can use their
3944
+ * current position during the sort, if values match, in order to perform stable sorting
3945
+ */
3946
+ for ( i=0, iLen=oSettings.aiDisplayMaster.length ; i<iLen ; i++ )
3947
+ {
3948
+ aiOrig[ oSettings.aiDisplayMaster[i] ] = i;
3949
+ }
3950
+
3951
+ /* Build an internal data array which is specific to the sort, so we can get and prep
3952
+ * the data to be sorted only once, rather than needing to do it every time the sorting
3953
+ * function runs. This make the sorting function a very simple comparison
3954
+ */
3955
+ var iSortLen = aaSort.length;
3956
+ var fnSortFormat, aDataSort;
3957
+ for ( i=0, iLen=aoData.length ; i<iLen ; i++ )
3958
+ {
3959
+ for ( j=0 ; j<iSortLen ; j++ )
3960
+ {
3961
+ aDataSort = aoColumns[ aaSort[j][0] ].aDataSort;
3962
+
3963
+ for ( k=0, kLen=aDataSort.length ; k<kLen ; k++ )
3964
+ {
3965
+ sDataType = aoColumns[ aDataSort[k] ].sType;
3966
+ fnSortFormat = oSort[ (sDataType ? sDataType : 'string')+"-pre" ];
3967
+
3968
+ aoData[i]._aSortData[ aDataSort[k] ] = fnSortFormat ?
3969
+ fnSortFormat( _fnGetCellData( oSettings, i, aDataSort[k], 'sort' ) ) :
3970
+ _fnGetCellData( oSettings, i, aDataSort[k], 'sort' );
3971
+ }
3972
+ }
3973
+ }
3974
+
3975
+ /* Do the sort - here we want multi-column sorting based on a given data source (column)
3976
+ * and sorting function (from oSort) in a certain direction. It's reasonably complex to
3977
+ * follow on it's own, but this is what we want (example two column sorting):
3978
+ * fnLocalSorting = function(a,b){
3979
+ * var iTest;
3980
+ * iTest = oSort['string-asc']('data11', 'data12');
3981
+ * if (iTest !== 0)
3982
+ * return iTest;
3983
+ * iTest = oSort['numeric-desc']('data21', 'data22');
3984
+ * if (iTest !== 0)
3985
+ * return iTest;
3986
+ * return oSort['numeric-asc']( aiOrig[a], aiOrig[b] );
3987
+ * }
3988
+ * Basically we have a test for each sorting column, if the data in that column is equal,
3989
+ * test the next column. If all columns match, then we use a numeric sort on the row
3990
+ * positions in the original data array to provide a stable sort.
3991
+ */
3992
+ oSettings.aiDisplayMaster.sort( function ( a, b ) {
3993
+ var k, l, lLen, iTest, aDataSort, sDataType;
3994
+ for ( k=0 ; k<iSortLen ; k++ )
3995
+ {
3996
+ aDataSort = aoColumns[ aaSort[k][0] ].aDataSort;
3997
+
3998
+ for ( l=0, lLen=aDataSort.length ; l<lLen ; l++ )
3999
+ {
4000
+ sDataType = aoColumns[ aDataSort[l] ].sType;
4001
+
4002
+ iTest = oSort[ (sDataType ? sDataType : 'string')+"-"+aaSort[k][1] ](
4003
+ aoData[a]._aSortData[ aDataSort[l] ],
4004
+ aoData[b]._aSortData[ aDataSort[l] ]
4005
+ );
4006
+
4007
+ if ( iTest !== 0 )
4008
+ {
4009
+ return iTest;
4010
+ }
4011
+ }
4012
+ }
4013
+
4014
+ return oSort['numeric-asc']( aiOrig[a], aiOrig[b] );
4015
+ } );
4016
+ }
4017
+
4018
+ /* Alter the sorting classes to take account of the changes */
4019
+ if ( (bApplyClasses === undefined || bApplyClasses) && !oSettings.oFeatures.bDeferRender )
4020
+ {
4021
+ _fnSortingClasses( oSettings );
4022
+ }
4023
+
4024
+ for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
4025
+ {
4026
+ var sTitle = aoColumns[i].sTitle.replace( /<.*?>/g, "" );
4027
+ nTh = aoColumns[i].nTh;
4028
+ nTh.removeAttribute('aria-sort');
4029
+ nTh.removeAttribute('aria-label');
4030
+
4031
+ /* In ARIA only the first sorting column can be marked as sorting - no multi-sort option */
4032
+ if ( aoColumns[i].bSortable )
4033
+ {
4034
+ if ( aaSort.length > 0 && aaSort[0][0] == i )
4035
+ {
4036
+ nTh.setAttribute('aria-sort', aaSort[0][1]=="asc" ? "ascending" : "descending" );
4037
+
4038
+ var nextSort = (aoColumns[i].asSorting[ aaSort[0][2]+1 ]) ?
4039
+ aoColumns[i].asSorting[ aaSort[0][2]+1 ] : aoColumns[i].asSorting[0];
4040
+ nTh.setAttribute('aria-label', sTitle+
4041
+ (nextSort=="asc" ? oAria.sSortAscending : oAria.sSortDescending) );
4042
+ }
4043
+ else
4044
+ {
4045
+ nTh.setAttribute('aria-label', sTitle+
4046
+ (aoColumns[i].asSorting[0]=="asc" ? oAria.sSortAscending : oAria.sSortDescending) );
4047
+ }
4048
+ }
4049
+ else
4050
+ {
4051
+ nTh.setAttribute('aria-label', sTitle);
4052
+ }
4053
+ }
4054
+
4055
+ /* Tell the draw function that we have sorted the data */
4056
+ oSettings.bSorted = true;
4057
+ $(oSettings.oInstance).trigger('sort', oSettings);
4058
+
4059
+ /* Copy the master data into the draw array and re-draw */
4060
+ if ( oSettings.oFeatures.bFilter )
4061
+ {
4062
+ /* _fnFilter() will redraw the table for us */
4063
+ _fnFilterComplete( oSettings, oSettings.oPreviousSearch, 1 );
4064
+ }
4065
+ else
4066
+ {
4067
+ oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
4068
+ oSettings._iDisplayStart = 0; /* reset display back to page 0 */
4069
+ _fnCalculateEnd( oSettings );
4070
+ _fnDraw( oSettings );
4071
+ }
4072
+ }
4073
+
4074
+
4075
+ /**
4076
+ * Attach a sort handler (click) to a node
4077
+ * @param {object} oSettings dataTables settings object
4078
+ * @param {node} nNode node to attach the handler to
4079
+ * @param {int} iDataIndex column sorting index
4080
+ * @param {function} [fnCallback] callback function
4081
+ * @memberof DataTable#oApi
4082
+ */
4083
+ function _fnSortAttachListener ( oSettings, nNode, iDataIndex, fnCallback )
4084
+ {
4085
+ _fnBindAction( nNode, {}, function (e) {
4086
+ /* If the column is not sortable - don't to anything */
4087
+ if ( oSettings.aoColumns[iDataIndex].bSortable === false )
4088
+ {
4089
+ return;
4090
+ }
4091
+
4092
+ /*
4093
+ * This is a little bit odd I admit... I declare a temporary function inside the scope of
4094
+ * _fnBuildHead and the click handler in order that the code presented here can be used
4095
+ * twice - once for when bProcessing is enabled, and another time for when it is
4096
+ * disabled, as we need to perform slightly different actions.
4097
+ * Basically the issue here is that the Javascript engine in modern browsers don't
4098
+ * appear to allow the rendering engine to update the display while it is still executing
4099
+ * it's thread (well - it does but only after long intervals). This means that the
4100
+ * 'processing' display doesn't appear for a table sort. To break the js thread up a bit
4101
+ * I force an execution break by using setTimeout - but this breaks the expected
4102
+ * thread continuation for the end-developer's point of view (their code would execute
4103
+ * too early), so we only do it when we absolutely have to.
4104
+ */
4105
+ var fnInnerSorting = function () {
4106
+ var iColumn, iNextSort;
4107
+
4108
+ /* If the shift key is pressed then we are multiple column sorting */
4109
+ if ( e.shiftKey )
4110
+ {
4111
+ /* Are we already doing some kind of sort on this column? */
4112
+ var bFound = false;
4113
+ for ( var i=0 ; i<oSettings.aaSorting.length ; i++ )
4114
+ {
4115
+ if ( oSettings.aaSorting[i][0] == iDataIndex )
4116
+ {
4117
+ bFound = true;
4118
+ iColumn = oSettings.aaSorting[i][0];
4119
+ iNextSort = oSettings.aaSorting[i][2]+1;
4120
+
4121
+ if ( !oSettings.aoColumns[iColumn].asSorting[iNextSort] )
4122
+ {
4123
+ /* Reached the end of the sorting options, remove from multi-col sort */
4124
+ oSettings.aaSorting.splice( i, 1 );
4125
+ }
4126
+ else
4127
+ {
4128
+ /* Move onto next sorting direction */
4129
+ oSettings.aaSorting[i][1] = oSettings.aoColumns[iColumn].asSorting[iNextSort];
4130
+ oSettings.aaSorting[i][2] = iNextSort;
4131
+ }
4132
+ break;
4133
+ }
4134
+ }
4135
+
4136
+ /* No sort yet - add it in */
4137
+ if ( bFound === false )
4138
+ {
4139
+ oSettings.aaSorting.push( [ iDataIndex,
4140
+ oSettings.aoColumns[iDataIndex].asSorting[0], 0 ] );
4141
+ }
4142
+ }
4143
+ else
4144
+ {
4145
+ /* If no shift key then single column sort */
4146
+ if ( oSettings.aaSorting.length == 1 && oSettings.aaSorting[0][0] == iDataIndex )
4147
+ {
4148
+ iColumn = oSettings.aaSorting[0][0];
4149
+ iNextSort = oSettings.aaSorting[0][2]+1;
4150
+ if ( !oSettings.aoColumns[iColumn].asSorting[iNextSort] )
4151
+ {
4152
+ iNextSort = 0;
4153
+ }
4154
+ oSettings.aaSorting[0][1] = oSettings.aoColumns[iColumn].asSorting[iNextSort];
4155
+ oSettings.aaSorting[0][2] = iNextSort;
4156
+ }
4157
+ else
4158
+ {
4159
+ oSettings.aaSorting.splice( 0, oSettings.aaSorting.length );
4160
+ oSettings.aaSorting.push( [ iDataIndex,
4161
+ oSettings.aoColumns[iDataIndex].asSorting[0], 0 ] );
4162
+ }
4163
+ }
4164
+
4165
+ /* Run the sort */
4166
+ _fnSort( oSettings );
4167
+ }; /* /fnInnerSorting */
4168
+
4169
+ if ( !oSettings.oFeatures.bProcessing )
4170
+ {
4171
+ fnInnerSorting();
4172
+ }
4173
+ else
4174
+ {
4175
+ _fnProcessingDisplay( oSettings, true );
4176
+ setTimeout( function() {
4177
+ fnInnerSorting();
4178
+ if ( !oSettings.oFeatures.bServerSide )
4179
+ {
4180
+ _fnProcessingDisplay( oSettings, false );
4181
+ }
4182
+ }, 0 );
4183
+ }
4184
+
4185
+ /* Call the user specified callback function - used for async user interaction */
4186
+ if ( typeof fnCallback == 'function' )
4187
+ {
4188
+ fnCallback( oSettings );
4189
+ }
4190
+ } );
4191
+ }
4192
+
4193
+
4194
+ /**
4195
+ * Set the sorting classes on the header, Note: it is safe to call this function
4196
+ * when bSort and bSortClasses are false
4197
+ * @param {object} oSettings dataTables settings object
4198
+ * @memberof DataTable#oApi
4199
+ */
4200
+ function _fnSortingClasses( oSettings )
4201
+ {
4202
+ var i, iLen, j, jLen, iFound;
4203
+ var aaSort, sClass;
4204
+ var iColumns = oSettings.aoColumns.length;
4205
+ var oClasses = oSettings.oClasses;
4206
+
4207
+ for ( i=0 ; i<iColumns ; i++ )
4208
+ {
4209
+ if ( oSettings.aoColumns[i].bSortable )
4210
+ {
4211
+ $(oSettings.aoColumns[i].nTh).removeClass( oClasses.sSortAsc +" "+ oClasses.sSortDesc +
4212
+ " "+ oSettings.aoColumns[i].sSortingClass );
4213
+ }
4214
+ }
4215
+
4216
+ if ( oSettings.aaSortingFixed !== null )
4217
+ {
4218
+ aaSort = oSettings.aaSortingFixed.concat( oSettings.aaSorting );
4219
+ }
4220
+ else
4221
+ {
4222
+ aaSort = oSettings.aaSorting.slice();
4223
+ }
4224
+
4225
+ /* Apply the required classes to the header */
4226
+ for ( i=0 ; i<oSettings.aoColumns.length ; i++ )
4227
+ {
4228
+ if ( oSettings.aoColumns[i].bSortable )
4229
+ {
4230
+ sClass = oSettings.aoColumns[i].sSortingClass;
4231
+ iFound = -1;
4232
+ for ( j=0 ; j<aaSort.length ; j++ )
4233
+ {
4234
+ if ( aaSort[j][0] == i )
4235
+ {
4236
+ sClass = ( aaSort[j][1] == "asc" ) ?
4237
+ oClasses.sSortAsc : oClasses.sSortDesc;
4238
+ iFound = j;
4239
+ break;
4240
+ }
4241
+ }
4242
+ $(oSettings.aoColumns[i].nTh).addClass( sClass );
4243
+
4244
+ if ( oSettings.bJUI )
4245
+ {
4246
+ /* jQuery UI uses extra markup */
4247
+ var jqSpan = $("span."+oClasses.sSortIcon, oSettings.aoColumns[i].nTh);
4248
+ jqSpan.removeClass(oClasses.sSortJUIAsc +" "+ oClasses.sSortJUIDesc +" "+
4249
+ oClasses.sSortJUI +" "+ oClasses.sSortJUIAscAllowed +" "+ oClasses.sSortJUIDescAllowed );
4250
+
4251
+ var sSpanClass;
4252
+ if ( iFound == -1 )
4253
+ {
4254
+ sSpanClass = oSettings.aoColumns[i].sSortingClassJUI;
4255
+ }
4256
+ else if ( aaSort[iFound][1] == "asc" )
4257
+ {
4258
+ sSpanClass = oClasses.sSortJUIAsc;
4259
+ }
4260
+ else
4261
+ {
4262
+ sSpanClass = oClasses.sSortJUIDesc;
4263
+ }
4264
+
4265
+ jqSpan.addClass( sSpanClass );
4266
+ }
4267
+ }
4268
+ else
4269
+ {
4270
+ /* No sorting on this column, so add the base class. This will have been assigned by
4271
+ * _fnAddColumn
4272
+ */
4273
+ $(oSettings.aoColumns[i].nTh).addClass( oSettings.aoColumns[i].sSortingClass );
4274
+ }
4275
+ }
4276
+
4277
+ /*
4278
+ * Apply the required classes to the table body
4279
+ * Note that this is given as a feature switch since it can significantly slow down a sort
4280
+ * on large data sets (adding and removing of classes is always slow at the best of times..)
4281
+ * Further to this, note that this code is admittedly fairly ugly. It could be made a lot
4282
+ * simpler using jQuery selectors and add/removeClass, but that is significantly slower
4283
+ * (on the order of 5 times slower) - hence the direct DOM manipulation here.
4284
+ * Note that for deferred drawing we do use jQuery - the reason being that taking the first
4285
+ * row found to see if the whole column needs processed can miss classes since the first
4286
+ * column might be new.
4287
+ */
4288
+ sClass = oClasses.sSortColumn;
4289
+
4290
+ if ( oSettings.oFeatures.bSort && oSettings.oFeatures.bSortClasses )
4291
+ {
4292
+ var nTds = _fnGetTdNodes( oSettings );
4293
+
4294
+ /* Remove the old classes */
4295
+ if ( oSettings.oFeatures.bDeferRender )
4296
+ {
4297
+ $(nTds).removeClass(sClass+'1 '+sClass+'2 '+sClass+'3');
4298
+ }
4299
+ else if ( nTds.length >= iColumns )
4300
+ {
4301
+ for ( i=0 ; i<iColumns ; i++ )
4302
+ {
4303
+ if ( nTds[i].className.indexOf(sClass+"1") != -1 )
4304
+ {
4305
+ for ( j=0, jLen=(nTds.length/iColumns) ; j<jLen ; j++ )
4306
+ {
4307
+ nTds[(iColumns*j)+i].className =
4308
+ $.trim( nTds[(iColumns*j)+i].className.replace( sClass+"1", "" ) );
4309
+ }
4310
+ }
4311
+ else if ( nTds[i].className.indexOf(sClass+"2") != -1 )
4312
+ {
4313
+ for ( j=0, jLen=(nTds.length/iColumns) ; j<jLen ; j++ )
4314
+ {
4315
+ nTds[(iColumns*j)+i].className =
4316
+ $.trim( nTds[(iColumns*j)+i].className.replace( sClass+"2", "" ) );
4317
+ }
4318
+ }
4319
+ else if ( nTds[i].className.indexOf(sClass+"3") != -1 )
4320
+ {
4321
+ for ( j=0, jLen=(nTds.length/iColumns) ; j<jLen ; j++ )
4322
+ {
4323
+ nTds[(iColumns*j)+i].className =
4324
+ $.trim( nTds[(iColumns*j)+i].className.replace( " "+sClass+"3", "" ) );
4325
+ }
4326
+ }
4327
+ }
4328
+ }
4329
+
4330
+ /* Add the new classes to the table */
4331
+ var iClass = 1, iTargetCol;
4332
+ for ( i=0 ; i<aaSort.length ; i++ )
4333
+ {
4334
+ iTargetCol = parseInt( aaSort[i][0], 10 );
4335
+ for ( j=0, jLen=(nTds.length/iColumns) ; j<jLen ; j++ )
4336
+ {
4337
+ nTds[(iColumns*j)+iTargetCol].className += " "+sClass+iClass;
4338
+ }
4339
+
4340
+ if ( iClass < 3 )
4341
+ {
4342
+ iClass++;
4343
+ }
4344
+ }
4345
+ }
4346
+ }
4347
+
4348
+
4349
+
4350
+ /**
4351
+ * Save the state of a table in a cookie such that the page can be reloaded
4352
+ * @param {object} oSettings dataTables settings object
4353
+ * @memberof DataTable#oApi
4354
+ */
4355
+ function _fnSaveState ( oSettings )
4356
+ {
4357
+ if ( !oSettings.oFeatures.bStateSave || oSettings.bDestroying )
4358
+ {
4359
+ return;
4360
+ }
4361
+
4362
+ /* Store the interesting variables */
4363
+ var i, iLen, bInfinite=oSettings.oScroll.bInfinite;
4364
+ var oState = {
4365
+ "iCreate": new Date().getTime(),
4366
+ "iStart": (bInfinite ? 0 : oSettings._iDisplayStart),
4367
+ "iEnd": (bInfinite ? oSettings._iDisplayLength : oSettings._iDisplayEnd),
4368
+ "iLength": oSettings._iDisplayLength,
4369
+ "aaSorting": $.extend( true, [], oSettings.aaSorting ),
4370
+ "oSearch": $.extend( true, {}, oSettings.oPreviousSearch ),
4371
+ "aoSearchCols": $.extend( true, [], oSettings.aoPreSearchCols ),
4372
+ "abVisCols": []
4373
+ };
4374
+
4375
+ for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
4376
+ {
4377
+ oState.abVisCols.push( oSettings.aoColumns[i].bVisible );
4378
+ }
4379
+
4380
+ _fnCallbackFire( oSettings, "aoStateSaveParams", 'stateSaveParams', [oSettings, oState] );
4381
+
4382
+ oSettings.fnStateSave.call( oSettings.oInstance, oSettings, oState );
4383
+ }
4384
+
4385
+
4386
+ /**
4387
+ * Attempt to load a saved table state from a cookie
4388
+ * @param {object} oSettings dataTables settings object
4389
+ * @param {object} oInit DataTables init object so we can override settings
4390
+ * @memberof DataTable#oApi
4391
+ */
4392
+ function _fnLoadState ( oSettings, oInit )
4393
+ {
4394
+ if ( !oSettings.oFeatures.bStateSave )
4395
+ {
4396
+ return;
4397
+ }
4398
+
4399
+ var oData = oSettings.fnStateLoad.call( oSettings.oInstance, oSettings );
4400
+ if ( !oData )
4401
+ {
4402
+ return;
4403
+ }
4404
+
4405
+ /* Allow custom and plug-in manipulation functions to alter the saved data set and
4406
+ * cancelling of loading by returning false
4407
+ */
4408
+ var abStateLoad = _fnCallbackFire( oSettings, 'aoStateLoadParams', 'stateLoadParams', [oSettings, oData] );
4409
+ if ( $.inArray( false, abStateLoad ) !== -1 )
4410
+ {
4411
+ return;
4412
+ }
4413
+
4414
+ /* Store the saved state so it might be accessed at any time */
4415
+ oSettings.oLoadedState = $.extend( true, {}, oData );
4416
+
4417
+ /* Restore key features */
4418
+ oSettings._iDisplayStart = oData.iStart;
4419
+ oSettings.iInitDisplayStart = oData.iStart;
4420
+ oSettings._iDisplayEnd = oData.iEnd;
4421
+ oSettings._iDisplayLength = oData.iLength;
4422
+ oSettings.aaSorting = oData.aaSorting.slice();
4423
+ oSettings.saved_aaSorting = oData.aaSorting.slice();
4424
+
4425
+ /* Search filtering */
4426
+ $.extend( oSettings.oPreviousSearch, oData.oSearch );
4427
+ $.extend( true, oSettings.aoPreSearchCols, oData.aoSearchCols );
4428
+
4429
+ /* Column visibility state
4430
+ * Pass back visibility settings to the init handler, but to do not here override
4431
+ * the init object that the user might have passed in
4432
+ */
4433
+ oInit.saved_aoColumns = [];
4434
+ for ( var i=0 ; i<oData.abVisCols.length ; i++ )
4435
+ {
4436
+ oInit.saved_aoColumns[i] = {};
4437
+ oInit.saved_aoColumns[i].bVisible = oData.abVisCols[i];
4438
+ }
4439
+
4440
+ _fnCallbackFire( oSettings, 'aoStateLoaded', 'stateLoaded', [oSettings, oData] );
4441
+ }
4442
+
4443
+
4444
+ /**
4445
+ * Create a new cookie with a value to store the state of a table
4446
+ * @param {string} sName name of the cookie to create
4447
+ * @param {string} sValue the value the cookie should take
4448
+ * @param {int} iSecs duration of the cookie
4449
+ * @param {string} sBaseName sName is made up of the base + file name - this is the base
4450
+ * @param {function} fnCallback User definable function to modify the cookie
4451
+ * @memberof DataTable#oApi
4452
+ */
4453
+ function _fnCreateCookie ( sName, sValue, iSecs, sBaseName, fnCallback )
4454
+ {
4455
+ var date = new Date();
4456
+ date.setTime( date.getTime()+(iSecs*1000) );
4457
+
4458
+ /*
4459
+ * Shocking but true - it would appear IE has major issues with having the path not having
4460
+ * a trailing slash on it. We need the cookie to be available based on the path, so we
4461
+ * have to append the file name to the cookie name. Appalling. Thanks to vex for adding the
4462
+ * patch to use at least some of the path
4463
+ */
4464
+ var aParts = window.location.pathname.split('/');
4465
+ var sNameFile = sName + '_' + aParts.pop().replace(/[\/:]/g,"").toLowerCase();
4466
+ var sFullCookie, oData;
4467
+
4468
+ if ( fnCallback !== null )
4469
+ {
4470
+ oData = (typeof $.parseJSON === 'function') ?
4471
+ $.parseJSON( sValue ) : eval( '('+sValue+')' );
4472
+ sFullCookie = fnCallback( sNameFile, oData, date.toGMTString(),
4473
+ aParts.join('/')+"/" );
4474
+ }
4475
+ else
4476
+ {
4477
+ sFullCookie = sNameFile + "=" + encodeURIComponent(sValue) +
4478
+ "; expires=" + date.toGMTString() +"; path=" + aParts.join('/')+"/";
4479
+ }
4480
+
4481
+ /* Are we going to go over the cookie limit of 4KiB? If so, try to delete a cookies
4482
+ * belonging to DataTables. This is FAR from bullet proof
4483
+ */
4484
+ var sOldName="", iOldTime=9999999999999;
4485
+ var iLength = _fnReadCookie( sNameFile )!==null ? document.cookie.length :
4486
+ sFullCookie.length + document.cookie.length;
4487
+
4488
+ if ( iLength+10 > 4096 ) /* Magic 10 for padding */
4489
+ {
4490
+ var aCookies =document.cookie.split(';');
4491
+ for ( var i=0, iLen=aCookies.length ; i<iLen ; i++ )
4492
+ {
4493
+ if ( aCookies[i].indexOf( sBaseName ) != -1 )
4494
+ {
4495
+ /* It's a DataTables cookie, so eval it and check the time stamp */
4496
+ var aSplitCookie = aCookies[i].split('=');
4497
+ try { oData = eval( '('+decodeURIComponent(aSplitCookie[1])+')' ); }
4498
+ catch( e ) { continue; }
4499
+
4500
+ if ( oData.iCreate && oData.iCreate < iOldTime )
4501
+ {
4502
+ sOldName = aSplitCookie[0];
4503
+ iOldTime = oData.iCreate;
4504
+ }
4505
+ }
4506
+ }
4507
+
4508
+ if ( sOldName !== "" )
4509
+ {
4510
+ document.cookie = sOldName+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path="+
4511
+ aParts.join('/') + "/";
4512
+ }
4513
+ }
4514
+
4515
+ document.cookie = sFullCookie;
4516
+ }
4517
+
4518
+
4519
+ /**
4520
+ * Read an old cookie to get a cookie with an old table state
4521
+ * @param {string} sName name of the cookie to read
4522
+ * @returns {string} contents of the cookie - or null if no cookie with that name found
4523
+ * @memberof DataTable#oApi
4524
+ */
4525
+ function _fnReadCookie ( sName )
4526
+ {
4527
+ var
4528
+ aParts = window.location.pathname.split('/'),
4529
+ sNameEQ = sName + '_' + aParts[aParts.length-1].replace(/[\/:]/g,"").toLowerCase() + '=',
4530
+ sCookieContents = document.cookie.split(';');
4531
+
4532
+ for( var i=0 ; i<sCookieContents.length ; i++ )
4533
+ {
4534
+ var c = sCookieContents[i];
4535
+
4536
+ while (c.charAt(0)==' ')
4537
+ {
4538
+ c = c.substring(1,c.length);
4539
+ }
4540
+
4541
+ if (c.indexOf(sNameEQ) === 0)
4542
+ {
4543
+ return decodeURIComponent( c.substring(sNameEQ.length,c.length) );
4544
+ }
4545
+ }
4546
+ return null;
4547
+ }
4548
+
4549
+
4550
+
4551
+ /**
4552
+ * Return the settings object for a particular table
4553
+ * @param {node} nTable table we are using as a dataTable
4554
+ * @returns {object} Settings object - or null if not found
4555
+ * @memberof DataTable#oApi
4556
+ */
4557
+ function _fnSettingsFromNode ( nTable )
4558
+ {
4559
+ for ( var i=0 ; i<DataTable.settings.length ; i++ )
4560
+ {
4561
+ if ( DataTable.settings[i].nTable === nTable )
4562
+ {
4563
+ return DataTable.settings[i];
4564
+ }
4565
+ }
4566
+
4567
+ return null;
4568
+ }
4569
+
4570
+
4571
+ /**
4572
+ * Return an array with the TR nodes for the table
4573
+ * @param {object} oSettings dataTables settings object
4574
+ * @returns {array} TR array
4575
+ * @memberof DataTable#oApi
4576
+ */
4577
+ function _fnGetTrNodes ( oSettings )
4578
+ {
4579
+ var aNodes = [];
4580
+ var aoData = oSettings.aoData;
4581
+ for ( var i=0, iLen=aoData.length ; i<iLen ; i++ )
4582
+ {
4583
+ if ( aoData[i].nTr !== null )
4584
+ {
4585
+ aNodes.push( aoData[i].nTr );
4586
+ }
4587
+ }
4588
+ return aNodes;
4589
+ }
4590
+
4591
+
4592
+ /**
4593
+ * Return an flat array with all TD nodes for the table, or row
4594
+ * @param {object} oSettings dataTables settings object
4595
+ * @param {int} [iIndividualRow] aoData index to get the nodes for - optional
4596
+ * if not given then the return array will contain all nodes for the table
4597
+ * @returns {array} TD array
4598
+ * @memberof DataTable#oApi
4599
+ */
4600
+ function _fnGetTdNodes ( oSettings, iIndividualRow )
4601
+ {
4602
+ var anReturn = [];
4603
+ var iCorrector;
4604
+ var anTds;
4605
+ var iRow, iRows=oSettings.aoData.length,
4606
+ iColumn, iColumns, oData, sNodeName, iStart=0, iEnd=iRows;
4607
+
4608
+ /* Allow the collection to be limited to just one row */
4609
+ if ( iIndividualRow !== undefined )
4610
+ {
4611
+ iStart = iIndividualRow;
4612
+ iEnd = iIndividualRow+1;
4613
+ }
4614
+
4615
+ for ( iRow=iStart ; iRow<iEnd ; iRow++ )
4616
+ {
4617
+ oData = oSettings.aoData[iRow];
4618
+ if ( oData.nTr !== null )
4619
+ {
4620
+ /* get the TD child nodes - taking into account text etc nodes */
4621
+ anTds = [];
4622
+ for ( iColumn=0, iColumns=oData.nTr.childNodes.length ; iColumn<iColumns ; iColumn++ )
4623
+ {
4624
+ sNodeName = oData.nTr.childNodes[iColumn].nodeName.toLowerCase();
4625
+ if ( sNodeName == 'td' || sNodeName == 'th' )
4626
+ {
4627
+ anTds.push( oData.nTr.childNodes[iColumn] );
4628
+ }
4629
+ }
4630
+
4631
+ iCorrector = 0;
4632
+ for ( iColumn=0, iColumns=oSettings.aoColumns.length ; iColumn<iColumns ; iColumn++ )
4633
+ {
4634
+ if ( oSettings.aoColumns[iColumn].bVisible )
4635
+ {
4636
+ anReturn.push( anTds[iColumn-iCorrector] );
4637
+ }
4638
+ else
4639
+ {
4640
+ anReturn.push( oData._anHidden[iColumn] );
4641
+ iCorrector++;
4642
+ }
4643
+ }
4644
+ }
4645
+ }
4646
+
4647
+ return anReturn;
4648
+ }
4649
+
4650
+
4651
+ /**
4652
+ * Log an error message
4653
+ * @param {object} oSettings dataTables settings object
4654
+ * @param {int} iLevel log error messages, or display them to the user
4655
+ * @param {string} sMesg error message
4656
+ * @memberof DataTable#oApi
4657
+ */
4658
+ function _fnLog( oSettings, iLevel, sMesg )
4659
+ {
4660
+ var sAlert = (oSettings===null) ?
4661
+ "DataTables warning: "+sMesg :
4662
+ "DataTables warning (table id = '"+oSettings.sTableId+"'): "+sMesg;
4663
+
4664
+ if ( iLevel === 0 )
4665
+ {
4666
+ if ( DataTable.ext.sErrMode == 'alert' )
4667
+ {
4668
+ alert( sAlert );
4669
+ }
4670
+ else
4671
+ {
4672
+ throw new Error(sAlert);
4673
+ }
4674
+ return;
4675
+ }
4676
+ else if ( window.console && console.log )
4677
+ {
4678
+ console.log( sAlert );
4679
+ }
4680
+ }
4681
+
4682
+
4683
+ /**
4684
+ * See if a property is defined on one object, if so assign it to the other object
4685
+ * @param {object} oRet target object
4686
+ * @param {object} oSrc source object
4687
+ * @param {string} sName property
4688
+ * @param {string} [sMappedName] name to map too - optional, sName used if not given
4689
+ * @memberof DataTable#oApi
4690
+ */
4691
+ function _fnMap( oRet, oSrc, sName, sMappedName )
4692
+ {
4693
+ if ( sMappedName === undefined )
4694
+ {
4695
+ sMappedName = sName;
4696
+ }
4697
+ if ( oSrc[sName] !== undefined )
4698
+ {
4699
+ oRet[sMappedName] = oSrc[sName];
4700
+ }
4701
+ }
4702
+
4703
+
4704
+ /**
4705
+ * Extend objects - very similar to jQuery.extend, but deep copy objects, and shallow
4706
+ * copy arrays. The reason we need to do this, is that we don't want to deep copy array
4707
+ * init values (such as aaSorting) since the dev wouldn't be able to override them, but
4708
+ * we do want to deep copy arrays.
4709
+ * @param {object} oOut Object to extend
4710
+ * @param {object} oExtender Object from which the properties will be applied to oOut
4711
+ * @returns {object} oOut Reference, just for convenience - oOut === the return.
4712
+ * @memberof DataTable#oApi
4713
+ * @todo This doesn't take account of arrays inside the deep copied objects.
4714
+ */
4715
+ function _fnExtend( oOut, oExtender )
4716
+ {
4717
+ var val;
4718
+
4719
+ for ( var prop in oExtender )
4720
+ {
4721
+ if ( oExtender.hasOwnProperty(prop) )
4722
+ {
4723
+ val = oExtender[prop];
4724
+
4725
+ if ( typeof oInit[prop] === 'object' && val !== null && $.isArray(val) === false )
4726
+ {
4727
+ $.extend( true, oOut[prop], val );
4728
+ }
4729
+ else
4730
+ {
4731
+ oOut[prop] = val;
4732
+ }
4733
+ }
4734
+ }
4735
+
4736
+ return oOut;
4737
+ }
4738
+
4739
+
4740
+ /**
4741
+ * Bind an event handers to allow a click or return key to activate the callback.
4742
+ * This is good for accessibility since a return on the keyboard will have the
4743
+ * same effect as a click, if the element has focus.
4744
+ * @param {element} n Element to bind the action to
4745
+ * @param {object} oData Data object to pass to the triggered function
4746
+ * @param {function} fn Callback function for when the event is triggered
4747
+ * @memberof DataTable#oApi
4748
+ */
4749
+ function _fnBindAction( n, oData, fn )
4750
+ {
4751
+ $(n)
4752
+ .bind( 'click.DT', oData, function (e) {
4753
+ n.blur(); // Remove focus outline for mouse users
4754
+ fn(e);
4755
+ } )
4756
+ .bind( 'keypress.DT', oData, function (e){
4757
+ if ( e.which === 13 ) {
4758
+ fn(e);
4759
+ } } )
4760
+ .bind( 'selectstart.DT', function () {
4761
+ /* Take the brutal approach to cancelling text selection */
4762
+ return false;
4763
+ } );
4764
+ }
4765
+
4766
+
4767
+ /**
4768
+ * Register a callback function. Easily allows a callback function to be added to
4769
+ * an array store of callback functions that can then all be called together.
4770
+ * @param {object} oSettings dataTables settings object
4771
+ * @param {string} sStore Name of the array storage for the callbacks in oSettings
4772
+ * @param {function} fn Function to be called back
4773
+ * @param {string} sName Identifying name for the callback (i.e. a label)
4774
+ * @memberof DataTable#oApi
4775
+ */
4776
+ function _fnCallbackReg( oSettings, sStore, fn, sName )
4777
+ {
4778
+ if ( fn )
4779
+ {
4780
+ oSettings[sStore].push( {
4781
+ "fn": fn,
4782
+ "sName": sName
4783
+ } );
4784
+ }
4785
+ }
4786
+
4787
+
4788
+ /**
4789
+ * Fire callback functions and trigger events. Note that the loop over the callback
4790
+ * array store is done backwards! Further note that you do not want to fire off triggers
4791
+ * in time sensitive applications (for example cell creation) as its slow.
4792
+ * @param {object} oSettings dataTables settings object
4793
+ * @param {string} sStore Name of the array storage for the callbacks in oSettings
4794
+ * @param {string} sTrigger Name of the jQuery custom event to trigger. If null no trigger
4795
+ * is fired
4796
+ * @param {array} aArgs Array of arguments to pass to the callback function / trigger
4797
+ * @memberof DataTable#oApi
4798
+ */
4799
+ function _fnCallbackFire( oSettings, sStore, sTrigger, aArgs )
4800
+ {
4801
+ var aoStore = oSettings[sStore];
4802
+ var aRet =[];
4803
+
4804
+ for ( var i=aoStore.length-1 ; i>=0 ; i-- )
4805
+ {
4806
+ aRet.push( aoStore[i].fn.apply( oSettings.oInstance, aArgs ) );
4807
+ }
4808
+
4809
+ if ( sTrigger !== null )
4810
+ {
4811
+ $(oSettings.oInstance).trigger(sTrigger, aArgs);
4812
+ }
4813
+
4814
+ return aRet;
4815
+ }
4816
+
4817
+
4818
+ /**
4819
+ * JSON stringify. If JSON.stringify it provided by the browser, json2.js or any other
4820
+ * library, then we use that as it is fast, safe and accurate. If the function isn't
4821
+ * available then we need to built it ourselves - the inspiration for this function comes
4822
+ * from Craig Buckler ( http://www.sitepoint.com/javascript-json-serialization/ ). It is
4823
+ * not perfect and absolutely should not be used as a replacement to json2.js - but it does
4824
+ * do what we need, without requiring a dependency for DataTables.
4825
+ * @param {object} o JSON object to be converted
4826
+ * @returns {string} JSON string
4827
+ * @memberof DataTable#oApi
4828
+ */
4829
+ var _fnJsonString = (window.JSON) ? JSON.stringify : function( o )
4830
+ {
4831
+ /* Not an object or array */
4832
+ var sType = typeof o;
4833
+ if (sType !== "object" || o === null)
4834
+ {
4835
+ // simple data type
4836
+ if (sType === "string")
4837
+ {
4838
+ o = '"'+o+'"';
4839
+ }
4840
+ return o+"";
4841
+ }
4842
+
4843
+ /* If object or array, need to recurse over it */
4844
+ var
4845
+ sProp, mValue,
4846
+ json = [],
4847
+ bArr = $.isArray(o);
4848
+
4849
+ for (sProp in o)
4850
+ {
4851
+ mValue = o[sProp];
4852
+ sType = typeof mValue;
4853
+
4854
+ if (sType === "string")
4855
+ {
4856
+ mValue = '"'+mValue+'"';
4857
+ }
4858
+ else if (sType === "object" && mValue !== null)
4859
+ {
4860
+ mValue = _fnJsonString(mValue);
4861
+ }
4862
+
4863
+ json.push((bArr ? "" : '"'+sProp+'":') + mValue);
4864
+ }
4865
+
4866
+ return (bArr ? "[" : "{") + json + (bArr ? "]" : "}");
4867
+ };
4868
+
4869
+
4870
+ /**
4871
+ * From some browsers (specifically IE6/7) we need special handling to work around browser
4872
+ * bugs - this function is used to detect when these workarounds are needed.
4873
+ * @param {object} oSettings dataTables settings object
4874
+ * @memberof DataTable#oApi
4875
+ */
4876
+ function _fnBrowserDetect( oSettings )
4877
+ {
4878
+ /* IE6/7 will oversize a width 100% element inside a scrolling element, to include the
4879
+ * width of the scrollbar, while other browsers ensure the inner element is contained
4880
+ * without forcing scrolling
4881
+ */
4882
+ var n = $(
4883
+ '<div style="position:absolute; top:0; left:0; height:1px; width:1px; overflow:hidden">'+
4884
+ '<div style="position:absolute; top:1px; left:1px; width:100px; height:50px; overflow:scroll;">'+
4885
+ '<div id="DT_BrowserTest" style="width:100%; height:10px;"></div>'+
4886
+ '</div>'+
4887
+ '</div>')[0];
4888
+
4889
+ document.body.appendChild( n );
4890
+ oSettings.oBrowser.bScrollOversize = $('#DT_BrowserTest', n)[0].offsetWidth === 100 ? true : false;
4891
+ document.body.removeChild( n );
4892
+ }
4893
+
4894
+
4895
+
4896
+
4897
+ /**
4898
+ * Perform a jQuery selector action on the table's TR elements (from the tbody) and
4899
+ * return the resulting jQuery object.
4900
+ * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on
4901
+ * @param {object} [oOpts] Optional parameters for modifying the rows to be included
4902
+ * @param {string} [oOpts.filter=none] Select TR elements that meet the current filter
4903
+ * criterion ("applied") or all TR elements (i.e. no filter).
4904
+ * @param {string} [oOpts.order=current] Order of the TR elements in the processed array.
4905
+ * Can be either 'current', whereby the current sorting of the table is used, or
4906
+ * 'original' whereby the original order the data was read into the table is used.
4907
+ * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page
4908
+ * ("current") or not ("all"). If 'current' is given, then order is assumed to be
4909
+ * 'current' and filter is 'applied', regardless of what they might be given as.
4910
+ * @returns {object} jQuery object, filtered by the given selector.
4911
+ * @dtopt API
4912
+ *
4913
+ * @example
4914
+ * $(document).ready(function() {
4915
+ * var oTable = $('#example').dataTable();
4916
+ *
4917
+ * // Highlight every second row
4918
+ * oTable.$('tr:odd').css('backgroundColor', 'blue');
4919
+ * } );
4920
+ *
4921
+ * @example
4922
+ * $(document).ready(function() {
4923
+ * var oTable = $('#example').dataTable();
4924
+ *
4925
+ * // Filter to rows with 'Webkit' in them, add a background colour and then
4926
+ * // remove the filter, thus highlighting the 'Webkit' rows only.
4927
+ * oTable.fnFilter('Webkit');
4928
+ * oTable.$('tr', {"filter": "applied"}).css('backgroundColor', 'blue');
4929
+ * oTable.fnFilter('');
4930
+ * } );
4931
+ */
4932
+ this.$ = function ( sSelector, oOpts )
4933
+ {
4934
+ var i, iLen, a = [], tr;
4935
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
4936
+ var aoData = oSettings.aoData;
4937
+ var aiDisplay = oSettings.aiDisplay;
4938
+ var aiDisplayMaster = oSettings.aiDisplayMaster;
4939
+
4940
+ if ( !oOpts )
4941
+ {
4942
+ oOpts = {};
4943
+ }
4944
+
4945
+ oOpts = $.extend( {}, {
4946
+ "filter": "none", // applied
4947
+ "order": "current", // "original"
4948
+ "page": "all" // current
4949
+ }, oOpts );
4950
+
4951
+ // Current page implies that order=current and fitler=applied, since it is fairly
4952
+ // senseless otherwise
4953
+ if ( oOpts.page == 'current' )
4954
+ {
4955
+ for ( i=oSettings._iDisplayStart, iLen=oSettings.fnDisplayEnd() ; i<iLen ; i++ )
4956
+ {
4957
+ tr = aoData[ aiDisplay[i] ].nTr;
4958
+ if ( tr )
4959
+ {
4960
+ a.push( tr );
4961
+ }
4962
+ }
4963
+ }
4964
+ else if ( oOpts.order == "current" && oOpts.filter == "none" )
4965
+ {
4966
+ for ( i=0, iLen=aiDisplayMaster.length ; i<iLen ; i++ )
4967
+ {
4968
+ tr = aoData[ aiDisplayMaster[i] ].nTr;
4969
+ if ( tr )
4970
+ {
4971
+ a.push( tr );
4972
+ }
4973
+ }
4974
+ }
4975
+ else if ( oOpts.order == "current" && oOpts.filter == "applied" )
4976
+ {
4977
+ for ( i=0, iLen=aiDisplay.length ; i<iLen ; i++ )
4978
+ {
4979
+ tr = aoData[ aiDisplay[i] ].nTr;
4980
+ if ( tr )
4981
+ {
4982
+ a.push( tr );
4983
+ }
4984
+ }
4985
+ }
4986
+ else if ( oOpts.order == "original" && oOpts.filter == "none" )
4987
+ {
4988
+ for ( i=0, iLen=aoData.length ; i<iLen ; i++ )
4989
+ {
4990
+ tr = aoData[ i ].nTr ;
4991
+ if ( tr )
4992
+ {
4993
+ a.push( tr );
4994
+ }
4995
+ }
4996
+ }
4997
+ else if ( oOpts.order == "original" && oOpts.filter == "applied" )
4998
+ {
4999
+ for ( i=0, iLen=aoData.length ; i<iLen ; i++ )
5000
+ {
5001
+ tr = aoData[ i ].nTr;
5002
+ if ( $.inArray( i, aiDisplay ) !== -1 && tr )
5003
+ {
5004
+ a.push( tr );
5005
+ }
5006
+ }
5007
+ }
5008
+ else
5009
+ {
5010
+ _fnLog( oSettings, 1, "Unknown selection options" );
5011
+ }
5012
+
5013
+ /* We need to filter on the TR elements and also 'find' in their descendants
5014
+ * to make the selector act like it would in a full table - so we need
5015
+ * to build both results and then combine them together
5016
+ */
5017
+ var jqA = $(a);
5018
+ var jqTRs = jqA.filter( sSelector );
5019
+ var jqDescendants = jqA.find( sSelector );
5020
+
5021
+ return $( [].concat($.makeArray(jqTRs), $.makeArray(jqDescendants)) );
5022
+ };
5023
+
5024
+
5025
+ /**
5026
+ * Almost identical to $ in operation, but in this case returns the data for the matched
5027
+ * rows - as such, the jQuery selector used should match TR row nodes or TD/TH cell nodes
5028
+ * rather than any descendants, so the data can be obtained for the row/cell. If matching
5029
+ * rows are found, the data returned is the original data array/object that was used to
5030
+ * create the row (or a generated array if from a DOM source).
5031
+ *
5032
+ * This method is often useful in-combination with $ where both functions are given the
5033
+ * same parameters and the array indexes will match identically.
5034
+ * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on
5035
+ * @param {object} [oOpts] Optional parameters for modifying the rows to be included
5036
+ * @param {string} [oOpts.filter=none] Select elements that meet the current filter
5037
+ * criterion ("applied") or all elements (i.e. no filter).
5038
+ * @param {string} [oOpts.order=current] Order of the data in the processed array.
5039
+ * Can be either 'current', whereby the current sorting of the table is used, or
5040
+ * 'original' whereby the original order the data was read into the table is used.
5041
+ * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page
5042
+ * ("current") or not ("all"). If 'current' is given, then order is assumed to be
5043
+ * 'current' and filter is 'applied', regardless of what they might be given as.
5044
+ * @returns {array} Data for the matched elements. If any elements, as a result of the
5045
+ * selector, were not TR, TD or TH elements in the DataTable, they will have a null
5046
+ * entry in the array.
5047
+ * @dtopt API
5048
+ *
5049
+ * @example
5050
+ * $(document).ready(function() {
5051
+ * var oTable = $('#example').dataTable();
5052
+ *
5053
+ * // Get the data from the first row in the table
5054
+ * var data = oTable._('tr:first');
5055
+ *
5056
+ * // Do something useful with the data
5057
+ * alert( "First cell is: "+data[0] );
5058
+ * } );
5059
+ *
5060
+ * @example
5061
+ * $(document).ready(function() {
5062
+ * var oTable = $('#example').dataTable();
5063
+ *
5064
+ * // Filter to 'Webkit' and get all data for
5065
+ * oTable.fnFilter('Webkit');
5066
+ * var data = oTable._('tr', {"filter": "applied"});
5067
+ *
5068
+ * // Do something with the data
5069
+ * alert( data.length+" rows matched the filter" );
5070
+ * } );
5071
+ */
5072
+ this._ = function ( sSelector, oOpts )
5073
+ {
5074
+ var aOut = [];
5075
+ var i, iLen, iIndex;
5076
+ var aTrs = this.$( sSelector, oOpts );
5077
+
5078
+ for ( i=0, iLen=aTrs.length ; i<iLen ; i++ )
5079
+ {
5080
+ aOut.push( this.fnGetData(aTrs[i]) );
5081
+ }
5082
+
5083
+ return aOut;
5084
+ };
5085
+
5086
+
5087
+ /**
5088
+ * Add a single new row or multiple rows of data to the table. Please note
5089
+ * that this is suitable for client-side processing only - if you are using
5090
+ * server-side processing (i.e. "bServerSide": true), then to add data, you
5091
+ * must add it to the data source, i.e. the server-side, through an Ajax call.
5092
+ * @param {array|object} mData The data to be added to the table. This can be:
5093
+ * <ul>
5094
+ * <li>1D array of data - add a single row with the data provided</li>
5095
+ * <li>2D array of arrays - add multiple rows in a single call</li>
5096
+ * <li>object - data object when using <i>mData</i></li>
5097
+ * <li>array of objects - multiple data objects when using <i>mData</i></li>
5098
+ * </ul>
5099
+ * @param {bool} [bRedraw=true] redraw the table or not
5100
+ * @returns {array} An array of integers, representing the list of indexes in
5101
+ * <i>aoData</i> ({@link DataTable.models.oSettings}) that have been added to
5102
+ * the table.
5103
+ * @dtopt API
5104
+ *
5105
+ * @example
5106
+ * // Global var for counter
5107
+ * var giCount = 2;
5108
+ *
5109
+ * $(document).ready(function() {
5110
+ * $('#example').dataTable();
5111
+ * } );
5112
+ *
5113
+ * function fnClickAddRow() {
5114
+ * $('#example').dataTable().fnAddData( [
5115
+ * giCount+".1",
5116
+ * giCount+".2",
5117
+ * giCount+".3",
5118
+ * giCount+".4" ]
5119
+ * );
5120
+ *
5121
+ * giCount++;
5122
+ * }
5123
+ */
5124
+ this.fnAddData = function( mData, bRedraw )
5125
+ {
5126
+ if ( mData.length === 0 )
5127
+ {
5128
+ return [];
5129
+ }
5130
+
5131
+ var aiReturn = [];
5132
+ var iTest;
5133
+
5134
+ /* Find settings from table node */
5135
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5136
+
5137
+ /* Check if we want to add multiple rows or not */
5138
+ if ( typeof mData[0] === "object" && mData[0] !== null )
5139
+ {
5140
+ for ( var i=0 ; i<mData.length ; i++ )
5141
+ {
5142
+ iTest = _fnAddData( oSettings, mData[i] );
5143
+ if ( iTest == -1 )
5144
+ {
5145
+ return aiReturn;
5146
+ }
5147
+ aiReturn.push( iTest );
5148
+ }
5149
+ }
5150
+ else
5151
+ {
5152
+ iTest = _fnAddData( oSettings, mData );
5153
+ if ( iTest == -1 )
5154
+ {
5155
+ return aiReturn;
5156
+ }
5157
+ aiReturn.push( iTest );
5158
+ }
5159
+
5160
+ oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
5161
+
5162
+ if ( bRedraw === undefined || bRedraw )
5163
+ {
5164
+ _fnReDraw( oSettings );
5165
+ }
5166
+ return aiReturn;
5167
+ };
5168
+
5169
+
5170
+ /**
5171
+ * This function will make DataTables recalculate the column sizes, based on the data
5172
+ * contained in the table and the sizes applied to the columns (in the DOM, CSS or
5173
+ * through the sWidth parameter). This can be useful when the width of the table's
5174
+ * parent element changes (for example a window resize).
5175
+ * @param {boolean} [bRedraw=true] Redraw the table or not, you will typically want to
5176
+ * @dtopt API
5177
+ *
5178
+ * @example
5179
+ * $(document).ready(function() {
5180
+ * var oTable = $('#example').dataTable( {
5181
+ * "sScrollY": "200px",
5182
+ * "bPaginate": false
5183
+ * } );
5184
+ *
5185
+ * $(window).bind('resize', function () {
5186
+ * oTable.fnAdjustColumnSizing();
5187
+ * } );
5188
+ * } );
5189
+ */
5190
+ this.fnAdjustColumnSizing = function ( bRedraw )
5191
+ {
5192
+ var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);
5193
+ _fnAdjustColumnSizing( oSettings );
5194
+
5195
+ if ( bRedraw === undefined || bRedraw )
5196
+ {
5197
+ this.fnDraw( false );
5198
+ }
5199
+ else if ( oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "" )
5200
+ {
5201
+ /* If not redrawing, but scrolling, we want to apply the new column sizes anyway */
5202
+ this.oApi._fnScrollDraw(oSettings);
5203
+ }
5204
+ };
5205
+
5206
+
5207
+ /**
5208
+ * Quickly and simply clear a table
5209
+ * @param {bool} [bRedraw=true] redraw the table or not
5210
+ * @dtopt API
5211
+ *
5212
+ * @example
5213
+ * $(document).ready(function() {
5214
+ * var oTable = $('#example').dataTable();
5215
+ *
5216
+ * // Immediately 'nuke' the current rows (perhaps waiting for an Ajax callback...)
5217
+ * oTable.fnClearTable();
5218
+ * } );
5219
+ */
5220
+ this.fnClearTable = function( bRedraw )
5221
+ {
5222
+ /* Find settings from table node */
5223
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5224
+ _fnClearTable( oSettings );
5225
+
5226
+ if ( bRedraw === undefined || bRedraw )
5227
+ {
5228
+ _fnDraw( oSettings );
5229
+ }
5230
+ };
5231
+
5232
+
5233
+ /**
5234
+ * The exact opposite of 'opening' a row, this function will close any rows which
5235
+ * are currently 'open'.
5236
+ * @param {node} nTr the table row to 'close'
5237
+ * @returns {int} 0 on success, or 1 if failed (can't find the row)
5238
+ * @dtopt API
5239
+ *
5240
+ * @example
5241
+ * $(document).ready(function() {
5242
+ * var oTable;
5243
+ *
5244
+ * // 'open' an information row when a row is clicked on
5245
+ * $('#example tbody tr').click( function () {
5246
+ * if ( oTable.fnIsOpen(this) ) {
5247
+ * oTable.fnClose( this );
5248
+ * } else {
5249
+ * oTable.fnOpen( this, "Temporary row opened", "info_row" );
5250
+ * }
5251
+ * } );
5252
+ *
5253
+ * oTable = $('#example').dataTable();
5254
+ * } );
5255
+ */
5256
+ this.fnClose = function( nTr )
5257
+ {
5258
+ /* Find settings from table node */
5259
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5260
+
5261
+ for ( var i=0 ; i<oSettings.aoOpenRows.length ; i++ )
5262
+ {
5263
+ if ( oSettings.aoOpenRows[i].nParent == nTr )
5264
+ {
5265
+ var nTrParent = oSettings.aoOpenRows[i].nTr.parentNode;
5266
+ if ( nTrParent )
5267
+ {
5268
+ /* Remove it if it is currently on display */
5269
+ nTrParent.removeChild( oSettings.aoOpenRows[i].nTr );
5270
+ }
5271
+ oSettings.aoOpenRows.splice( i, 1 );
5272
+ return 0;
5273
+ }
5274
+ }
5275
+ return 1;
5276
+ };
5277
+
5278
+
5279
+ /**
5280
+ * Remove a row for the table
5281
+ * @param {mixed} mTarget The index of the row from aoData to be deleted, or
5282
+ * the TR element you want to delete
5283
+ * @param {function|null} [fnCallBack] Callback function
5284
+ * @param {bool} [bRedraw=true] Redraw the table or not
5285
+ * @returns {array} The row that was deleted
5286
+ * @dtopt API
5287
+ *
5288
+ * @example
5289
+ * $(document).ready(function() {
5290
+ * var oTable = $('#example').dataTable();
5291
+ *
5292
+ * // Immediately remove the first row
5293
+ * oTable.fnDeleteRow( 0 );
5294
+ * } );
5295
+ */
5296
+ this.fnDeleteRow = function( mTarget, fnCallBack, bRedraw )
5297
+ {
5298
+ /* Find settings from table node */
5299
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5300
+ var i, iLen, iAODataIndex;
5301
+
5302
+ iAODataIndex = (typeof mTarget === 'object') ?
5303
+ _fnNodeToDataIndex(oSettings, mTarget) : mTarget;
5304
+
5305
+ /* Return the data array from this row */
5306
+ var oData = oSettings.aoData.splice( iAODataIndex, 1 );
5307
+
5308
+ /* Update the _DT_RowIndex parameter */
5309
+ for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
5310
+ {
5311
+ if ( oSettings.aoData[i].nTr !== null )
5312
+ {
5313
+ oSettings.aoData[i].nTr._DT_RowIndex = i;
5314
+ }
5315
+ }
5316
+
5317
+ /* Remove the target row from the search array */
5318
+ var iDisplayIndex = $.inArray( iAODataIndex, oSettings.aiDisplay );
5319
+ oSettings.asDataSearch.splice( iDisplayIndex, 1 );
5320
+
5321
+ /* Delete from the display arrays */
5322
+ _fnDeleteIndex( oSettings.aiDisplayMaster, iAODataIndex );
5323
+ _fnDeleteIndex( oSettings.aiDisplay, iAODataIndex );
5324
+
5325
+ /* If there is a user callback function - call it */
5326
+ if ( typeof fnCallBack === "function" )
5327
+ {
5328
+ fnCallBack.call( this, oSettings, oData );
5329
+ }
5330
+
5331
+ /* Check for an 'overflow' they case for displaying the table */
5332
+ if ( oSettings._iDisplayStart >= oSettings.fnRecordsDisplay() )
5333
+ {
5334
+ oSettings._iDisplayStart -= oSettings._iDisplayLength;
5335
+ if ( oSettings._iDisplayStart < 0 )
5336
+ {
5337
+ oSettings._iDisplayStart = 0;
5338
+ }
5339
+ }
5340
+
5341
+ if ( bRedraw === undefined || bRedraw )
5342
+ {
5343
+ _fnCalculateEnd( oSettings );
5344
+ _fnDraw( oSettings );
5345
+ }
5346
+
5347
+ return oData;
5348
+ };
5349
+
5350
+
5351
+ /**
5352
+ * Restore the table to it's original state in the DOM by removing all of DataTables
5353
+ * enhancements, alterations to the DOM structure of the table and event listeners.
5354
+ * @param {boolean} [bRemove=false] Completely remove the table from the DOM
5355
+ * @dtopt API
5356
+ *
5357
+ * @example
5358
+ * $(document).ready(function() {
5359
+ * // This example is fairly pointless in reality, but shows how fnDestroy can be used
5360
+ * var oTable = $('#example').dataTable();
5361
+ * oTable.fnDestroy();
5362
+ * } );
5363
+ */
5364
+ this.fnDestroy = function ( bRemove )
5365
+ {
5366
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5367
+ var nOrig = oSettings.nTableWrapper.parentNode;
5368
+ var nBody = oSettings.nTBody;
5369
+ var i, iLen;
5370
+
5371
+ bRemove = (bRemove===undefined) ? false : true;
5372
+
5373
+ /* Flag to note that the table is currently being destroyed - no action should be taken */
5374
+ oSettings.bDestroying = true;
5375
+
5376
+ /* Fire off the destroy callbacks for plug-ins etc */
5377
+ _fnCallbackFire( oSettings, "aoDestroyCallback", "destroy", [oSettings] );
5378
+
5379
+ /* Restore hidden columns */
5380
+ for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
5381
+ {
5382
+ if ( oSettings.aoColumns[i].bVisible === false )
5383
+ {
5384
+ this.fnSetColumnVis( i, true );
5385
+ }
5386
+ }
5387
+
5388
+ /* Blitz all DT events */
5389
+ $(oSettings.nTableWrapper).find('*').andSelf().unbind('.DT');
5390
+
5391
+ /* If there is an 'empty' indicator row, remove it */
5392
+ $('tbody>tr>td.'+oSettings.oClasses.sRowEmpty, oSettings.nTable).parent().remove();
5393
+
5394
+ /* When scrolling we had to break the table up - restore it */
5395
+ if ( oSettings.nTable != oSettings.nTHead.parentNode )
5396
+ {
5397
+ $(oSettings.nTable).children('thead').remove();
5398
+ oSettings.nTable.appendChild( oSettings.nTHead );
5399
+ }
5400
+
5401
+ if ( oSettings.nTFoot && oSettings.nTable != oSettings.nTFoot.parentNode )
5402
+ {
5403
+ $(oSettings.nTable).children('tfoot').remove();
5404
+ oSettings.nTable.appendChild( oSettings.nTFoot );
5405
+ }
5406
+
5407
+ /* Remove the DataTables generated nodes, events and classes */
5408
+ oSettings.nTable.parentNode.removeChild( oSettings.nTable );
5409
+ $(oSettings.nTableWrapper).remove();
5410
+
5411
+ oSettings.aaSorting = [];
5412
+ oSettings.aaSortingFixed = [];
5413
+ _fnSortingClasses( oSettings );
5414
+
5415
+ $(_fnGetTrNodes( oSettings )).removeClass( oSettings.asStripeClasses.join(' ') );
5416
+
5417
+ $('th, td', oSettings.nTHead).removeClass( [
5418
+ oSettings.oClasses.sSortable,
5419
+ oSettings.oClasses.sSortableAsc,
5420
+ oSettings.oClasses.sSortableDesc,
5421
+ oSettings.oClasses.sSortableNone ].join(' ')
5422
+ );
5423
+ if ( oSettings.bJUI )
5424
+ {
5425
+ $('th span.'+oSettings.oClasses.sSortIcon
5426
+ + ', td span.'+oSettings.oClasses.sSortIcon, oSettings.nTHead).remove();
5427
+
5428
+ $('th, td', oSettings.nTHead).each( function () {
5429
+ var jqWrapper = $('div.'+oSettings.oClasses.sSortJUIWrapper, this);
5430
+ var kids = jqWrapper.contents();
5431
+ $(this).append( kids );
5432
+ jqWrapper.remove();
5433
+ } );
5434
+ }
5435
+
5436
+ /* Add the TR elements back into the table in their original order */
5437
+ if ( !bRemove && oSettings.nTableReinsertBefore )
5438
+ {
5439
+ nOrig.insertBefore( oSettings.nTable, oSettings.nTableReinsertBefore );
5440
+ }
5441
+ else if ( !bRemove )
5442
+ {
5443
+ nOrig.appendChild( oSettings.nTable );
5444
+ }
5445
+
5446
+ for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
5447
+ {
5448
+ if ( oSettings.aoData[i].nTr !== null )
5449
+ {
5450
+ nBody.appendChild( oSettings.aoData[i].nTr );
5451
+ }
5452
+ }
5453
+
5454
+ /* Restore the width of the original table */
5455
+ if ( oSettings.oFeatures.bAutoWidth === true )
5456
+ {
5457
+ oSettings.nTable.style.width = _fnStringToCss(oSettings.sDestroyWidth);
5458
+ }
5459
+
5460
+ /* If the were originally odd/even type classes - then we add them back here. Note
5461
+ * this is not fool proof (for example if not all rows as odd/even classes - but
5462
+ * it's a good effort without getting carried away
5463
+ */
5464
+ $(nBody).children('tr:even').addClass( oSettings.asDestroyStripes[0] );
5465
+ $(nBody).children('tr:odd').addClass( oSettings.asDestroyStripes[1] );
5466
+
5467
+ /* Remove the settings object from the settings array */
5468
+ for ( i=0, iLen=DataTable.settings.length ; i<iLen ; i++ )
5469
+ {
5470
+ if ( DataTable.settings[i] == oSettings )
5471
+ {
5472
+ DataTable.settings.splice( i, 1 );
5473
+ }
5474
+ }
5475
+
5476
+ /* End it all */
5477
+ oSettings = null;
5478
+ };
5479
+
5480
+
5481
+ /**
5482
+ * Redraw the table
5483
+ * @param {bool} [bComplete=true] Re-filter and resort (if enabled) the table before the draw.
5484
+ * @dtopt API
5485
+ *
5486
+ * @example
5487
+ * $(document).ready(function() {
5488
+ * var oTable = $('#example').dataTable();
5489
+ *
5490
+ * // Re-draw the table - you wouldn't want to do it here, but it's an example :-)
5491
+ * oTable.fnDraw();
5492
+ * } );
5493
+ */
5494
+ this.fnDraw = function( bComplete )
5495
+ {
5496
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5497
+ if ( bComplete === false )
5498
+ {
5499
+ _fnCalculateEnd( oSettings );
5500
+ _fnDraw( oSettings );
5501
+ }
5502
+ else
5503
+ {
5504
+ _fnReDraw( oSettings );
5505
+ }
5506
+ };
5507
+
5508
+
5509
+ /**
5510
+ * Filter the input based on data
5511
+ * @param {string} sInput String to filter the table on
5512
+ * @param {int|null} [iColumn] Column to limit filtering to
5513
+ * @param {bool} [bRegex=false] Treat as regular expression or not
5514
+ * @param {bool} [bSmart=true] Perform smart filtering or not
5515
+ * @param {bool} [bShowGlobal=true] Show the input global filter in it's input box(es)
5516
+ * @param {bool} [bCaseInsensitive=true] Do case-insensitive matching (true) or not (false)
5517
+ * @dtopt API
5518
+ *
5519
+ * @example
5520
+ * $(document).ready(function() {
5521
+ * var oTable = $('#example').dataTable();
5522
+ *
5523
+ * // Sometime later - filter...
5524
+ * oTable.fnFilter( 'test string' );
5525
+ * } );
5526
+ */
5527
+ this.fnFilter = function( sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseInsensitive )
5528
+ {
5529
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5530
+
5531
+ if ( !oSettings.oFeatures.bFilter )
5532
+ {
5533
+ return;
5534
+ }
5535
+
5536
+ if ( bRegex === undefined || bRegex === null )
5537
+ {
5538
+ bRegex = false;
5539
+ }
5540
+
5541
+ if ( bSmart === undefined || bSmart === null )
5542
+ {
5543
+ bSmart = true;
5544
+ }
5545
+
5546
+ if ( bShowGlobal === undefined || bShowGlobal === null )
5547
+ {
5548
+ bShowGlobal = true;
5549
+ }
5550
+
5551
+ if ( bCaseInsensitive === undefined || bCaseInsensitive === null )
5552
+ {
5553
+ bCaseInsensitive = true;
5554
+ }
5555
+
5556
+ if ( iColumn === undefined || iColumn === null )
5557
+ {
5558
+ /* Global filter */
5559
+ _fnFilterComplete( oSettings, {
5560
+ "sSearch":sInput+"",
5561
+ "bRegex": bRegex,
5562
+ "bSmart": bSmart,
5563
+ "bCaseInsensitive": bCaseInsensitive
5564
+ }, 1 );
5565
+
5566
+ if ( bShowGlobal && oSettings.aanFeatures.f )
5567
+ {
5568
+ var n = oSettings.aanFeatures.f;
5569
+ for ( var i=0, iLen=n.length ; i<iLen ; i++ )
5570
+ {
5571
+ $(n[i]._DT_Input).val( sInput );
5572
+ }
5573
+ }
5574
+ }
5575
+ else
5576
+ {
5577
+ /* Single column filter */
5578
+ $.extend( oSettings.aoPreSearchCols[ iColumn ], {
5579
+ "sSearch": sInput+"",
5580
+ "bRegex": bRegex,
5581
+ "bSmart": bSmart,
5582
+ "bCaseInsensitive": bCaseInsensitive
5583
+ } );
5584
+ _fnFilterComplete( oSettings, oSettings.oPreviousSearch, 1 );
5585
+ }
5586
+ };
5587
+
5588
+
5589
+ /**
5590
+ * Get the data for the whole table, an individual row or an individual cell based on the
5591
+ * provided parameters.
5592
+ * @param {int|node} [mRow] A TR row node, TD/TH cell node or an integer. If given as
5593
+ * a TR node then the data source for the whole row will be returned. If given as a
5594
+ * TD/TH cell node then iCol will be automatically calculated and the data for the
5595
+ * cell returned. If given as an integer, then this is treated as the aoData internal
5596
+ * data index for the row (see fnGetPosition) and the data for that row used.
5597
+ * @param {int} [iCol] Optional column index that you want the data of.
5598
+ * @returns {array|object|string} If mRow is undefined, then the data for all rows is
5599
+ * returned. If mRow is defined, just data for that row, and is iCol is
5600
+ * defined, only data for the designated cell is returned.
5601
+ * @dtopt API
5602
+ *
5603
+ * @example
5604
+ * // Row data
5605
+ * $(document).ready(function() {
5606
+ * oTable = $('#example').dataTable();
5607
+ *
5608
+ * oTable.$('tr').click( function () {
5609
+ * var data = oTable.fnGetData( this );
5610
+ * // ... do something with the array / object of data for the row
5611
+ * } );
5612
+ * } );
5613
+ *
5614
+ * @example
5615
+ * // Individual cell data
5616
+ * $(document).ready(function() {
5617
+ * oTable = $('#example').dataTable();
5618
+ *
5619
+ * oTable.$('td').click( function () {
5620
+ * var sData = oTable.fnGetData( this );
5621
+ * alert( 'The cell clicked on had the value of '+sData );
5622
+ * } );
5623
+ * } );
5624
+ */
5625
+ this.fnGetData = function( mRow, iCol )
5626
+ {
5627
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5628
+
5629
+ if ( mRow !== undefined )
5630
+ {
5631
+ var iRow = mRow;
5632
+ if ( typeof mRow === 'object' )
5633
+ {
5634
+ var sNode = mRow.nodeName.toLowerCase();
5635
+ if (sNode === "tr" )
5636
+ {
5637
+ iRow = _fnNodeToDataIndex(oSettings, mRow);
5638
+ }
5639
+ else if ( sNode === "td" )
5640
+ {
5641
+ iRow = _fnNodeToDataIndex(oSettings, mRow.parentNode);
5642
+ iCol = _fnNodeToColumnIndex( oSettings, iRow, mRow );
5643
+ }
5644
+ }
5645
+
5646
+ if ( iCol !== undefined )
5647
+ {
5648
+ return _fnGetCellData( oSettings, iRow, iCol, '' );
5649
+ }
5650
+ return (oSettings.aoData[iRow]!==undefined) ?
5651
+ oSettings.aoData[iRow]._aData : null;
5652
+ }
5653
+ return _fnGetDataMaster( oSettings );
5654
+ };
5655
+
5656
+
5657
+ /**
5658
+ * Get an array of the TR nodes that are used in the table's body. Note that you will
5659
+ * typically want to use the '$' API method in preference to this as it is more
5660
+ * flexible.
5661
+ * @param {int} [iRow] Optional row index for the TR element you want
5662
+ * @returns {array|node} If iRow is undefined, returns an array of all TR elements
5663
+ * in the table's body, or iRow is defined, just the TR element requested.
5664
+ * @dtopt API
5665
+ *
5666
+ * @example
5667
+ * $(document).ready(function() {
5668
+ * var oTable = $('#example').dataTable();
5669
+ *
5670
+ * // Get the nodes from the table
5671
+ * var nNodes = oTable.fnGetNodes( );
5672
+ * } );
5673
+ */
5674
+ this.fnGetNodes = function( iRow )
5675
+ {
5676
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5677
+
5678
+ if ( iRow !== undefined ) {
5679
+ return (oSettings.aoData[iRow]!==undefined) ?
5680
+ oSettings.aoData[iRow].nTr : null;
5681
+ }
5682
+ return _fnGetTrNodes( oSettings );
5683
+ };
5684
+
5685
+
5686
+ /**
5687
+ * Get the array indexes of a particular cell from it's DOM element
5688
+ * and column index including hidden columns
5689
+ * @param {node} nNode this can either be a TR, TD or TH in the table's body
5690
+ * @returns {int} If nNode is given as a TR, then a single index is returned, or
5691
+ * if given as a cell, an array of [row index, column index (visible)] is given.
5692
+ * @dtopt API
5693
+ *
5694
+ * @example
5695
+ * $(document).ready(function() {
5696
+ * $('#example tbody td').click( function () {
5697
+ * // Get the position of the current data from the node
5698
+ * var aPos = oTable.fnGetPosition( this );
5699
+ *
5700
+ * // Get the data array for this row
5701
+ * var aData = oTable.fnGetData( aPos[0] );
5702
+ *
5703
+ * // Update the data array and return the value
5704
+ * aData[ aPos[1] ] = 'clicked';
5705
+ * this.innerHTML = 'clicked';
5706
+ * } );
5707
+ *
5708
+ * // Init DataTables
5709
+ * oTable = $('#example').dataTable();
5710
+ * } );
5711
+ */
5712
+ this.fnGetPosition = function( nNode )
5713
+ {
5714
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5715
+ var sNodeName = nNode.nodeName.toUpperCase();
5716
+
5717
+ if ( sNodeName == "TR" )
5718
+ {
5719
+ return _fnNodeToDataIndex(oSettings, nNode);
5720
+ }
5721
+ else if ( sNodeName == "TD" || sNodeName == "TH" )
5722
+ {
5723
+ var iDataIndex = _fnNodeToDataIndex( oSettings, nNode.parentNode );
5724
+ var iColumnIndex = _fnNodeToColumnIndex( oSettings, iDataIndex, nNode );
5725
+ return [ iDataIndex, _fnColumnIndexToVisible(oSettings, iColumnIndex ), iColumnIndex ];
5726
+ }
5727
+ return null;
5728
+ };
5729
+
5730
+
5731
+ /**
5732
+ * Check to see if a row is 'open' or not.
5733
+ * @param {node} nTr the table row to check
5734
+ * @returns {boolean} true if the row is currently open, false otherwise
5735
+ * @dtopt API
5736
+ *
5737
+ * @example
5738
+ * $(document).ready(function() {
5739
+ * var oTable;
5740
+ *
5741
+ * // 'open' an information row when a row is clicked on
5742
+ * $('#example tbody tr').click( function () {
5743
+ * if ( oTable.fnIsOpen(this) ) {
5744
+ * oTable.fnClose( this );
5745
+ * } else {
5746
+ * oTable.fnOpen( this, "Temporary row opened", "info_row" );
5747
+ * }
5748
+ * } );
5749
+ *
5750
+ * oTable = $('#example').dataTable();
5751
+ * } );
5752
+ */
5753
+ this.fnIsOpen = function( nTr )
5754
+ {
5755
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5756
+ var aoOpenRows = oSettings.aoOpenRows;
5757
+
5758
+ for ( var i=0 ; i<oSettings.aoOpenRows.length ; i++ )
5759
+ {
5760
+ if ( oSettings.aoOpenRows[i].nParent == nTr )
5761
+ {
5762
+ return true;
5763
+ }
5764
+ }
5765
+ return false;
5766
+ };
5767
+
5768
+
5769
+ /**
5770
+ * This function will place a new row directly after a row which is currently
5771
+ * on display on the page, with the HTML contents that is passed into the
5772
+ * function. This can be used, for example, to ask for confirmation that a
5773
+ * particular record should be deleted.
5774
+ * @param {node} nTr The table row to 'open'
5775
+ * @param {string|node|jQuery} mHtml The HTML to put into the row
5776
+ * @param {string} sClass Class to give the new TD cell
5777
+ * @returns {node} The row opened. Note that if the table row passed in as the
5778
+ * first parameter, is not found in the table, this method will silently
5779
+ * return.
5780
+ * @dtopt API
5781
+ *
5782
+ * @example
5783
+ * $(document).ready(function() {
5784
+ * var oTable;
5785
+ *
5786
+ * // 'open' an information row when a row is clicked on
5787
+ * $('#example tbody tr').click( function () {
5788
+ * if ( oTable.fnIsOpen(this) ) {
5789
+ * oTable.fnClose( this );
5790
+ * } else {
5791
+ * oTable.fnOpen( this, "Temporary row opened", "info_row" );
5792
+ * }
5793
+ * } );
5794
+ *
5795
+ * oTable = $('#example').dataTable();
5796
+ * } );
5797
+ */
5798
+ this.fnOpen = function( nTr, mHtml, sClass )
5799
+ {
5800
+ /* Find settings from table node */
5801
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5802
+
5803
+ /* Check that the row given is in the table */
5804
+ var nTableRows = _fnGetTrNodes( oSettings );
5805
+ if ( $.inArray(nTr, nTableRows) === -1 )
5806
+ {
5807
+ return;
5808
+ }
5809
+
5810
+ /* the old open one if there is one */
5811
+ this.fnClose( nTr );
5812
+
5813
+ var nNewRow = document.createElement("tr");
5814
+ var nNewCell = document.createElement("td");
5815
+ nNewRow.appendChild( nNewCell );
5816
+ nNewCell.className = sClass;
5817
+ nNewCell.colSpan = _fnVisbleColumns( oSettings );
5818
+
5819
+ if (typeof mHtml === "string")
5820
+ {
5821
+ nNewCell.innerHTML = mHtml;
5822
+ }
5823
+ else
5824
+ {
5825
+ $(nNewCell).html( mHtml );
5826
+ }
5827
+
5828
+ /* If the nTr isn't on the page at the moment - then we don't insert at the moment */
5829
+ var nTrs = $('tr', oSettings.nTBody);
5830
+ if ( $.inArray(nTr, nTrs) != -1 )
5831
+ {
5832
+ $(nNewRow).insertAfter(nTr);
5833
+ }
5834
+
5835
+ oSettings.aoOpenRows.push( {
5836
+ "nTr": nNewRow,
5837
+ "nParent": nTr
5838
+ } );
5839
+
5840
+ return nNewRow;
5841
+ };
5842
+
5843
+
5844
+ /**
5845
+ * Change the pagination - provides the internal logic for pagination in a simple API
5846
+ * function. With this function you can have a DataTables table go to the next,
5847
+ * previous, first or last pages.
5848
+ * @param {string|int} mAction Paging action to take: "first", "previous", "next" or "last"
5849
+ * or page number to jump to (integer), note that page 0 is the first page.
5850
+ * @param {bool} [bRedraw=true] Redraw the table or not
5851
+ * @dtopt API
5852
+ *
5853
+ * @example
5854
+ * $(document).ready(function() {
5855
+ * var oTable = $('#example').dataTable();
5856
+ * oTable.fnPageChange( 'next' );
5857
+ * } );
5858
+ */
5859
+ this.fnPageChange = function ( mAction, bRedraw )
5860
+ {
5861
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5862
+ _fnPageChange( oSettings, mAction );
5863
+ _fnCalculateEnd( oSettings );
5864
+
5865
+ if ( bRedraw === undefined || bRedraw )
5866
+ {
5867
+ _fnDraw( oSettings );
5868
+ }
5869
+ };
5870
+
5871
+
5872
+ /**
5873
+ * Show a particular column
5874
+ * @param {int} iCol The column whose display should be changed
5875
+ * @param {bool} bShow Show (true) or hide (false) the column
5876
+ * @param {bool} [bRedraw=true] Redraw the table or not
5877
+ * @dtopt API
5878
+ *
5879
+ * @example
5880
+ * $(document).ready(function() {
5881
+ * var oTable = $('#example').dataTable();
5882
+ *
5883
+ * // Hide the second column after initialisation
5884
+ * oTable.fnSetColumnVis( 1, false );
5885
+ * } );
5886
+ */
5887
+ this.fnSetColumnVis = function ( iCol, bShow, bRedraw )
5888
+ {
5889
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
5890
+ var i, iLen;
5891
+ var aoColumns = oSettings.aoColumns;
5892
+ var aoData = oSettings.aoData;
5893
+ var nTd, bAppend, iBefore;
5894
+
5895
+ /* No point in doing anything if we are requesting what is already true */
5896
+ if ( aoColumns[iCol].bVisible == bShow )
5897
+ {
5898
+ return;
5899
+ }
5900
+
5901
+ /* Show the column */
5902
+ if ( bShow )
5903
+ {
5904
+ var iInsert = 0;
5905
+ for ( i=0 ; i<iCol ; i++ )
5906
+ {
5907
+ if ( aoColumns[i].bVisible )
5908
+ {
5909
+ iInsert++;
5910
+ }
5911
+ }
5912
+
5913
+ /* Need to decide if we should use appendChild or insertBefore */
5914
+ bAppend = (iInsert >= _fnVisbleColumns( oSettings ));
5915
+
5916
+ /* Which coloumn should we be inserting before? */
5917
+ if ( !bAppend )
5918
+ {
5919
+ for ( i=iCol ; i<aoColumns.length ; i++ )
5920
+ {
5921
+ if ( aoColumns[i].bVisible )
5922
+ {
5923
+ iBefore = i;
5924
+ break;
5925
+ }
5926
+ }
5927
+ }
5928
+
5929
+ for ( i=0, iLen=aoData.length ; i<iLen ; i++ )
5930
+ {
5931
+ if ( aoData[i].nTr !== null )
5932
+ {
5933
+ if ( bAppend )
5934
+ {
5935
+ aoData[i].nTr.appendChild(
5936
+ aoData[i]._anHidden[iCol]
5937
+ );
5938
+ }
5939
+ else
5940
+ {
5941
+ aoData[i].nTr.insertBefore(
5942
+ aoData[i]._anHidden[iCol],
5943
+ _fnGetTdNodes( oSettings, i )[iBefore] );
5944
+ }
5945
+ }
5946
+ }
5947
+ }
5948
+ else
5949
+ {
5950
+ /* Remove a column from display */
5951
+ for ( i=0, iLen=aoData.length ; i<iLen ; i++ )
5952
+ {
5953
+ if ( aoData[i].nTr !== null )
5954
+ {
5955
+ nTd = _fnGetTdNodes( oSettings, i )[iCol];
5956
+ aoData[i]._anHidden[iCol] = nTd;
5957
+ nTd.parentNode.removeChild( nTd );
5958
+ }
5959
+ }
5960
+ }
5961
+
5962
+ /* Clear to set the visible flag */
5963
+ aoColumns[iCol].bVisible = bShow;
5964
+
5965
+ /* Redraw the header and footer based on the new column visibility */
5966
+ _fnDrawHead( oSettings, oSettings.aoHeader );
5967
+ if ( oSettings.nTFoot )
5968
+ {
5969
+ _fnDrawHead( oSettings, oSettings.aoFooter );
5970
+ }
5971
+
5972
+ /* If there are any 'open' rows, then we need to alter the colspan for this col change */
5973
+ for ( i=0, iLen=oSettings.aoOpenRows.length ; i<iLen ; i++ )
5974
+ {
5975
+ oSettings.aoOpenRows[i].nTr.colSpan = _fnVisbleColumns( oSettings );
5976
+ }
5977
+
5978
+ /* Do a redraw incase anything depending on the table columns needs it
5979
+ * (built-in: scrolling)
5980
+ */
5981
+ if ( bRedraw === undefined || bRedraw )
5982
+ {
5983
+ _fnAdjustColumnSizing( oSettings );
5984
+ _fnDraw( oSettings );
5985
+ }
5986
+
5987
+ _fnSaveState( oSettings );
5988
+ };
5989
+
5990
+
5991
+ /**
5992
+ * Get the settings for a particular table for external manipulation
5993
+ * @returns {object} DataTables settings object. See
5994
+ * {@link DataTable.models.oSettings}
5995
+ * @dtopt API
5996
+ *
5997
+ * @example
5998
+ * $(document).ready(function() {
5999
+ * var oTable = $('#example').dataTable();
6000
+ * var oSettings = oTable.fnSettings();
6001
+ *
6002
+ * // Show an example parameter from the settings
6003
+ * alert( oSettings._iDisplayStart );
6004
+ * } );
6005
+ */
6006
+ this.fnSettings = function()
6007
+ {
6008
+ return _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
6009
+ };
6010
+
6011
+
6012
+ /**
6013
+ * Sort the table by a particular column
6014
+ * @param {int} iCol the data index to sort on. Note that this will not match the
6015
+ * 'display index' if you have hidden data entries
6016
+ * @dtopt API
6017
+ *
6018
+ * @example
6019
+ * $(document).ready(function() {
6020
+ * var oTable = $('#example').dataTable();
6021
+ *
6022
+ * // Sort immediately with columns 0 and 1
6023
+ * oTable.fnSort( [ [0,'asc'], [1,'asc'] ] );
6024
+ * } );
6025
+ */
6026
+ this.fnSort = function( aaSort )
6027
+ {
6028
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
6029
+ oSettings.aaSorting = aaSort;
6030
+ _fnSort( oSettings );
6031
+ };
6032
+
6033
+
6034
+ /**
6035
+ * Attach a sort listener to an element for a given column
6036
+ * @param {node} nNode the element to attach the sort listener to
6037
+ * @param {int} iColumn the column that a click on this node will sort on
6038
+ * @param {function} [fnCallback] callback function when sort is run
6039
+ * @dtopt API
6040
+ *
6041
+ * @example
6042
+ * $(document).ready(function() {
6043
+ * var oTable = $('#example').dataTable();
6044
+ *
6045
+ * // Sort on column 1, when 'sorter' is clicked on
6046
+ * oTable.fnSortListener( document.getElementById('sorter'), 1 );
6047
+ * } );
6048
+ */
6049
+ this.fnSortListener = function( nNode, iColumn, fnCallback )
6050
+ {
6051
+ _fnSortAttachListener( _fnSettingsFromNode( this[DataTable.ext.iApiIndex] ), nNode, iColumn,
6052
+ fnCallback );
6053
+ };
6054
+
6055
+
6056
+ /**
6057
+ * Update a table cell or row - this method will accept either a single value to
6058
+ * update the cell with, an array of values with one element for each column or
6059
+ * an object in the same format as the original data source. The function is
6060
+ * self-referencing in order to make the multi column updates easier.
6061
+ * @param {object|array|string} mData Data to update the cell/row with
6062
+ * @param {node|int} mRow TR element you want to update or the aoData index
6063
+ * @param {int} [iColumn] The column to update (not used of mData is an array or object)
6064
+ * @param {bool} [bRedraw=true] Redraw the table or not
6065
+ * @param {bool} [bAction=true] Perform pre-draw actions or not
6066
+ * @returns {int} 0 on success, 1 on error
6067
+ * @dtopt API
6068
+ *
6069
+ * @example
6070
+ * $(document).ready(function() {
6071
+ * var oTable = $('#example').dataTable();
6072
+ * oTable.fnUpdate( 'Example update', 0, 0 ); // Single cell
6073
+ * oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], 1, 0 ); // Row
6074
+ * } );
6075
+ */
6076
+ this.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction )
6077
+ {
6078
+ var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
6079
+ var i, iLen, sDisplay;
6080
+ var iRow = (typeof mRow === 'object') ?
6081
+ _fnNodeToDataIndex(oSettings, mRow) : mRow;
6082
+
6083
+ if ( $.isArray(mData) && iColumn === undefined )
6084
+ {
6085
+ /* Array update - update the whole row */
6086
+ oSettings.aoData[iRow]._aData = mData.slice();
6087
+
6088
+ /* Flag to the function that we are recursing */
6089
+ for ( i=0 ; i<oSettings.aoColumns.length ; i++ )
6090
+ {
6091
+ this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false );
6092
+ }
6093
+ }
6094
+ else if ( $.isPlainObject(mData) && iColumn === undefined )
6095
+ {
6096
+ /* Object update - update the whole row - assume the developer gets the object right */
6097
+ oSettings.aoData[iRow]._aData = $.extend( true, {}, mData );
6098
+
6099
+ for ( i=0 ; i<oSettings.aoColumns.length ; i++ )
6100
+ {
6101
+ this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false );
6102
+ }
6103
+ }
6104
+ else
6105
+ {
6106
+ /* Individual cell update */
6107
+ _fnSetCellData( oSettings, iRow, iColumn, mData );
6108
+ sDisplay = _fnGetCellData( oSettings, iRow, iColumn, 'display' );
6109
+
6110
+ var oCol = oSettings.aoColumns[iColumn];
6111
+ if ( oCol.fnRender !== null )
6112
+ {
6113
+ sDisplay = _fnRender( oSettings, iRow, iColumn );
6114
+ if ( oCol.bUseRendered )
6115
+ {
6116
+ _fnSetCellData( oSettings, iRow, iColumn, sDisplay );
6117
+ }
6118
+ }
6119
+
6120
+ if ( oSettings.aoData[iRow].nTr !== null )
6121
+ {
6122
+ /* Do the actual HTML update */
6123
+ _fnGetTdNodes( oSettings, iRow )[iColumn].innerHTML = sDisplay;
6124
+ }
6125
+ }
6126
+
6127
+ /* Modify the search index for this row (strictly this is likely not needed, since fnReDraw
6128
+ * will rebuild the search array - however, the redraw might be disabled by the user)
6129
+ */
6130
+ var iDisplayIndex = $.inArray( iRow, oSettings.aiDisplay );
6131
+ oSettings.asDataSearch[iDisplayIndex] = _fnBuildSearchRow(
6132
+ oSettings,
6133
+ _fnGetRowData( oSettings, iRow, 'filter', _fnGetColumns( oSettings, 'bSearchable' ) )
6134
+ );
6135
+
6136
+ /* Perform pre-draw actions */
6137
+ if ( bAction === undefined || bAction )
6138
+ {
6139
+ _fnAdjustColumnSizing( oSettings );
6140
+ }
6141
+
6142
+ /* Redraw the table */
6143
+ if ( bRedraw === undefined || bRedraw )
6144
+ {
6145
+ _fnReDraw( oSettings );
6146
+ }
6147
+ return 0;
6148
+ };
6149
+
6150
+
6151
+ /**
6152
+ * Provide a common method for plug-ins to check the version of DataTables being used, in order
6153
+ * to ensure compatibility.
6154
+ * @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note that the
6155
+ * formats "X" and "X.Y" are also acceptable.
6156
+ * @returns {boolean} true if this version of DataTables is greater or equal to the required
6157
+ * version, or false if this version of DataTales is not suitable
6158
+ * @method
6159
+ * @dtopt API
6160
+ *
6161
+ * @example
6162
+ * $(document).ready(function() {
6163
+ * var oTable = $('#example').dataTable();
6164
+ * alert( oTable.fnVersionCheck( '1.9.0' ) );
6165
+ * } );
6166
+ */
6167
+ this.fnVersionCheck = DataTable.ext.fnVersionCheck;
6168
+
6169
+
6170
+ /*
6171
+ * This is really a good bit rubbish this method of exposing the internal methods
6172
+ * publicly... - To be fixed in 2.0 using methods on the prototype
6173
+ */
6174
+
6175
+
6176
+ /**
6177
+ * Create a wrapper function for exporting an internal functions to an external API.
6178
+ * @param {string} sFunc API function name
6179
+ * @returns {function} wrapped function
6180
+ * @memberof DataTable#oApi
6181
+ */
6182
+ function _fnExternApiFunc (sFunc)
6183
+ {
6184
+ return function() {
6185
+ var aArgs = [_fnSettingsFromNode(this[DataTable.ext.iApiIndex])].concat(
6186
+ Array.prototype.slice.call(arguments) );
6187
+ return DataTable.ext.oApi[sFunc].apply( this, aArgs );
6188
+ };
6189
+ }
6190
+
6191
+
6192
+ /**
6193
+ * Reference to internal functions for use by plug-in developers. Note that these
6194
+ * methods are references to internal functions and are considered to be private.
6195
+ * If you use these methods, be aware that they are liable to change between versions
6196
+ * (check the upgrade notes).
6197
+ * @namespace
6198
+ */
6199
+ this.oApi = {
6200
+ "_fnExternApiFunc": _fnExternApiFunc,
6201
+ "_fnInitialise": _fnInitialise,
6202
+ "_fnInitComplete": _fnInitComplete,
6203
+ "_fnLanguageCompat": _fnLanguageCompat,
6204
+ "_fnAddColumn": _fnAddColumn,
6205
+ "_fnColumnOptions": _fnColumnOptions,
6206
+ "_fnAddData": _fnAddData,
6207
+ "_fnCreateTr": _fnCreateTr,
6208
+ "_fnGatherData": _fnGatherData,
6209
+ "_fnBuildHead": _fnBuildHead,
6210
+ "_fnDrawHead": _fnDrawHead,
6211
+ "_fnDraw": _fnDraw,
6212
+ "_fnReDraw": _fnReDraw,
6213
+ "_fnAjaxUpdate": _fnAjaxUpdate,
6214
+ "_fnAjaxParameters": _fnAjaxParameters,
6215
+ "_fnAjaxUpdateDraw": _fnAjaxUpdateDraw,
6216
+ "_fnServerParams": _fnServerParams,
6217
+ "_fnAddOptionsHtml": _fnAddOptionsHtml,
6218
+ "_fnFeatureHtmlTable": _fnFeatureHtmlTable,
6219
+ "_fnScrollDraw": _fnScrollDraw,
6220
+ "_fnAdjustColumnSizing": _fnAdjustColumnSizing,
6221
+ "_fnFeatureHtmlFilter": _fnFeatureHtmlFilter,
6222
+ "_fnFilterComplete": _fnFilterComplete,
6223
+ "_fnFilterCustom": _fnFilterCustom,
6224
+ "_fnFilterColumn": _fnFilterColumn,
6225
+ "_fnFilter": _fnFilter,
6226
+ "_fnBuildSearchArray": _fnBuildSearchArray,
6227
+ "_fnBuildSearchRow": _fnBuildSearchRow,
6228
+ "_fnFilterCreateSearch": _fnFilterCreateSearch,
6229
+ "_fnDataToSearch": _fnDataToSearch,
6230
+ "_fnSort": _fnSort,
6231
+ "_fnSortAttachListener": _fnSortAttachListener,
6232
+ "_fnSortingClasses": _fnSortingClasses,
6233
+ "_fnFeatureHtmlPaginate": _fnFeatureHtmlPaginate,
6234
+ "_fnPageChange": _fnPageChange,
6235
+ "_fnFeatureHtmlInfo": _fnFeatureHtmlInfo,
6236
+ "_fnUpdateInfo": _fnUpdateInfo,
6237
+ "_fnFeatureHtmlLength": _fnFeatureHtmlLength,
6238
+ "_fnFeatureHtmlProcessing": _fnFeatureHtmlProcessing,
6239
+ "_fnProcessingDisplay": _fnProcessingDisplay,
6240
+ "_fnVisibleToColumnIndex": _fnVisibleToColumnIndex,
6241
+ "_fnColumnIndexToVisible": _fnColumnIndexToVisible,
6242
+ "_fnNodeToDataIndex": _fnNodeToDataIndex,
6243
+ "_fnVisbleColumns": _fnVisbleColumns,
6244
+ "_fnCalculateEnd": _fnCalculateEnd,
6245
+ "_fnConvertToWidth": _fnConvertToWidth,
6246
+ "_fnCalculateColumnWidths": _fnCalculateColumnWidths,
6247
+ "_fnScrollingWidthAdjust": _fnScrollingWidthAdjust,
6248
+ "_fnGetWidestNode": _fnGetWidestNode,
6249
+ "_fnGetMaxLenString": _fnGetMaxLenString,
6250
+ "_fnStringToCss": _fnStringToCss,
6251
+ "_fnDetectType": _fnDetectType,
6252
+ "_fnSettingsFromNode": _fnSettingsFromNode,
6253
+ "_fnGetDataMaster": _fnGetDataMaster,
6254
+ "_fnGetTrNodes": _fnGetTrNodes,
6255
+ "_fnGetTdNodes": _fnGetTdNodes,
6256
+ "_fnEscapeRegex": _fnEscapeRegex,
6257
+ "_fnDeleteIndex": _fnDeleteIndex,
6258
+ "_fnReOrderIndex": _fnReOrderIndex,
6259
+ "_fnColumnOrdering": _fnColumnOrdering,
6260
+ "_fnLog": _fnLog,
6261
+ "_fnClearTable": _fnClearTable,
6262
+ "_fnSaveState": _fnSaveState,
6263
+ "_fnLoadState": _fnLoadState,
6264
+ "_fnCreateCookie": _fnCreateCookie,
6265
+ "_fnReadCookie": _fnReadCookie,
6266
+ "_fnDetectHeader": _fnDetectHeader,
6267
+ "_fnGetUniqueThs": _fnGetUniqueThs,
6268
+ "_fnScrollBarWidth": _fnScrollBarWidth,
6269
+ "_fnApplyToChildren": _fnApplyToChildren,
6270
+ "_fnMap": _fnMap,
6271
+ "_fnGetRowData": _fnGetRowData,
6272
+ "_fnGetCellData": _fnGetCellData,
6273
+ "_fnSetCellData": _fnSetCellData,
6274
+ "_fnGetObjectDataFn": _fnGetObjectDataFn,
6275
+ "_fnSetObjectDataFn": _fnSetObjectDataFn,
6276
+ "_fnApplyColumnDefs": _fnApplyColumnDefs,
6277
+ "_fnBindAction": _fnBindAction,
6278
+ "_fnExtend": _fnExtend,
6279
+ "_fnCallbackReg": _fnCallbackReg,
6280
+ "_fnCallbackFire": _fnCallbackFire,
6281
+ "_fnJsonString": _fnJsonString,
6282
+ "_fnRender": _fnRender,
6283
+ "_fnNodeToColumnIndex": _fnNodeToColumnIndex,
6284
+ "_fnInfoMacros": _fnInfoMacros,
6285
+ "_fnBrowserDetect": _fnBrowserDetect,
6286
+ "_fnGetColumns": _fnGetColumns
6287
+ };
6288
+
6289
+ $.extend( DataTable.ext.oApi, this.oApi );
6290
+
6291
+ for ( var sFunc in DataTable.ext.oApi )
6292
+ {
6293
+ if ( sFunc )
6294
+ {
6295
+ this[sFunc] = _fnExternApiFunc(sFunc);
6296
+ }
6297
+ }
6298
+
6299
+
6300
+ var _that = this;
6301
+ return this.each(function() {
6302
+
6303
+ var i=0, iLen, j, jLen, k, kLen;
6304
+ var sId = this.getAttribute( 'id' );
6305
+ var bInitHandedOff = false;
6306
+ var bUsePassedData = false;
6307
+
6308
+
6309
+ /* Sanity check */
6310
+ if ( this.nodeName.toLowerCase() != 'table' )
6311
+ {
6312
+ _fnLog( null, 0, "Attempted to initialise DataTables on a node which is not a "+
6313
+ "table: "+this.nodeName );
6314
+ return;
6315
+ }
6316
+
6317
+ /* Check to see if we are re-initialising a table */
6318
+ for ( i=0, iLen=DataTable.settings.length ; i<iLen ; i++ )
6319
+ {
6320
+ /* Base check on table node */
6321
+ if ( DataTable.settings[i].nTable == this )
6322
+ {
6323
+ if ( oInit === undefined || oInit.bRetrieve )
6324
+ {
6325
+ return DataTable.settings[i].oInstance;
6326
+ }
6327
+ else if ( oInit.bDestroy )
6328
+ {
6329
+ DataTable.settings[i].oInstance.fnDestroy();
6330
+ break;
6331
+ }
6332
+ else
6333
+ {
6334
+ _fnLog( DataTable.settings[i], 0, "Cannot reinitialise DataTable.\n\n"+
6335
+ "To retrieve the DataTables object for this table, pass no arguments or see "+
6336
+ "the docs for bRetrieve and bDestroy" );
6337
+ return;
6338
+ }
6339
+ }
6340
+
6341
+ /* If the element we are initialising has the same ID as a table which was previously
6342
+ * initialised, but the table nodes don't match (from before) then we destroy the old
6343
+ * instance by simply deleting it. This is under the assumption that the table has been
6344
+ * destroyed by other methods. Anyone using non-id selectors will need to do this manually
6345
+ */
6346
+ if ( DataTable.settings[i].sTableId == this.id )
6347
+ {
6348
+ DataTable.settings.splice( i, 1 );
6349
+ break;
6350
+ }
6351
+ }
6352
+
6353
+ /* Ensure the table has an ID - required for accessibility */
6354
+ if ( sId === null || sId === "" )
6355
+ {
6356
+ sId = "DataTables_Table_"+(DataTable.ext._oExternConfig.iNextUnique++);
6357
+ this.id = sId;
6358
+ }
6359
+
6360
+ /* Create the settings object for this table and set some of the default parameters */
6361
+ var oSettings = $.extend( true, {}, DataTable.models.oSettings, {
6362
+ "nTable": this,
6363
+ "oApi": _that.oApi,
6364
+ "oInit": oInit,
6365
+ "sDestroyWidth": $(this).width(),
6366
+ "sInstance": sId,
6367
+ "sTableId": sId
6368
+ } );
6369
+ DataTable.settings.push( oSettings );
6370
+
6371
+ // Need to add the instance after the instance after the settings object has been added
6372
+ // to the settings array, so we can self reference the table instance if more than one
6373
+ oSettings.oInstance = (_that.length===1) ? _that : $(this).dataTable();
6374
+
6375
+ /* Setting up the initialisation object */
6376
+ if ( !oInit )
6377
+ {
6378
+ oInit = {};
6379
+ }
6380
+
6381
+ // Backwards compatibility, before we apply all the defaults
6382
+ if ( oInit.oLanguage )
6383
+ {
6384
+ _fnLanguageCompat( oInit.oLanguage );
6385
+ }
6386
+
6387
+ oInit = _fnExtend( $.extend(true, {}, DataTable.defaults), oInit );
6388
+
6389
+ // Map the initialisation options onto the settings object
6390
+ _fnMap( oSettings.oFeatures, oInit, "bPaginate" );
6391
+ _fnMap( oSettings.oFeatures, oInit, "bLengthChange" );
6392
+ _fnMap( oSettings.oFeatures, oInit, "bFilter" );
6393
+ _fnMap( oSettings.oFeatures, oInit, "bSort" );
6394
+ _fnMap( oSettings.oFeatures, oInit, "bInfo" );
6395
+ _fnMap( oSettings.oFeatures, oInit, "bProcessing" );
6396
+ _fnMap( oSettings.oFeatures, oInit, "bAutoWidth" );
6397
+ _fnMap( oSettings.oFeatures, oInit, "bSortClasses" );
6398
+ _fnMap( oSettings.oFeatures, oInit, "bServerSide" );
6399
+ _fnMap( oSettings.oFeatures, oInit, "bDeferRender" );
6400
+ _fnMap( oSettings.oScroll, oInit, "sScrollX", "sX" );
6401
+ _fnMap( oSettings.oScroll, oInit, "sScrollXInner", "sXInner" );
6402
+ _fnMap( oSettings.oScroll, oInit, "sScrollY", "sY" );
6403
+ _fnMap( oSettings.oScroll, oInit, "bScrollCollapse", "bCollapse" );
6404
+ _fnMap( oSettings.oScroll, oInit, "bScrollInfinite", "bInfinite" );
6405
+ _fnMap( oSettings.oScroll, oInit, "iScrollLoadGap", "iLoadGap" );
6406
+ _fnMap( oSettings.oScroll, oInit, "bScrollAutoCss", "bAutoCss" );
6407
+ _fnMap( oSettings, oInit, "asStripeClasses" );
6408
+ _fnMap( oSettings, oInit, "asStripClasses", "asStripeClasses" ); // legacy
6409
+ _fnMap( oSettings, oInit, "fnServerData" );
6410
+ _fnMap( oSettings, oInit, "fnFormatNumber" );
6411
+ _fnMap( oSettings, oInit, "sServerMethod" );
6412
+ _fnMap( oSettings, oInit, "aaSorting" );
6413
+ _fnMap( oSettings, oInit, "aaSortingFixed" );
6414
+ _fnMap( oSettings, oInit, "aLengthMenu" );
6415
+ _fnMap( oSettings, oInit, "sPaginationType" );
6416
+ _fnMap( oSettings, oInit, "sAjaxSource" );
6417
+ _fnMap( oSettings, oInit, "sAjaxDataProp" );
6418
+ _fnMap( oSettings, oInit, "iCookieDuration" );
6419
+ _fnMap( oSettings, oInit, "sCookiePrefix" );
6420
+ _fnMap( oSettings, oInit, "sDom" );
6421
+ _fnMap( oSettings, oInit, "bSortCellsTop" );
6422
+ _fnMap( oSettings, oInit, "iTabIndex" );
6423
+ _fnMap( oSettings, oInit, "oSearch", "oPreviousSearch" );
6424
+ _fnMap( oSettings, oInit, "aoSearchCols", "aoPreSearchCols" );
6425
+ _fnMap( oSettings, oInit, "iDisplayLength", "_iDisplayLength" );
6426
+ _fnMap( oSettings, oInit, "bJQueryUI", "bJUI" );
6427
+ _fnMap( oSettings, oInit, "fnCookieCallback" );
6428
+ _fnMap( oSettings, oInit, "fnStateLoad" );
6429
+ _fnMap( oSettings, oInit, "fnStateSave" );
6430
+ _fnMap( oSettings.oLanguage, oInit, "fnInfoCallback" );
6431
+
6432
+ /* Callback functions which are array driven */
6433
+ _fnCallbackReg( oSettings, 'aoDrawCallback', oInit.fnDrawCallback, 'user' );
6434
+ _fnCallbackReg( oSettings, 'aoServerParams', oInit.fnServerParams, 'user' );
6435
+ _fnCallbackReg( oSettings, 'aoStateSaveParams', oInit.fnStateSaveParams, 'user' );
6436
+ _fnCallbackReg( oSettings, 'aoStateLoadParams', oInit.fnStateLoadParams, 'user' );
6437
+ _fnCallbackReg( oSettings, 'aoStateLoaded', oInit.fnStateLoaded, 'user' );
6438
+ _fnCallbackReg( oSettings, 'aoRowCallback', oInit.fnRowCallback, 'user' );
6439
+ _fnCallbackReg( oSettings, 'aoRowCreatedCallback', oInit.fnCreatedRow, 'user' );
6440
+ _fnCallbackReg( oSettings, 'aoHeaderCallback', oInit.fnHeaderCallback, 'user' );
6441
+ _fnCallbackReg( oSettings, 'aoFooterCallback', oInit.fnFooterCallback, 'user' );
6442
+ _fnCallbackReg( oSettings, 'aoInitComplete', oInit.fnInitComplete, 'user' );
6443
+ _fnCallbackReg( oSettings, 'aoPreDrawCallback', oInit.fnPreDrawCallback, 'user' );
6444
+
6445
+ if ( oSettings.oFeatures.bServerSide && oSettings.oFeatures.bSort &&
6446
+ oSettings.oFeatures.bSortClasses )
6447
+ {
6448
+ /* Enable sort classes for server-side processing. Safe to do it here, since server-side
6449
+ * processing must be enabled by the developer
6450
+ */
6451
+ _fnCallbackReg( oSettings, 'aoDrawCallback', _fnSortingClasses, 'server_side_sort_classes' );
6452
+ }
6453
+ else if ( oSettings.oFeatures.bDeferRender )
6454
+ {
6455
+ _fnCallbackReg( oSettings, 'aoDrawCallback', _fnSortingClasses, 'defer_sort_classes' );
6456
+ }
6457
+
6458
+ if ( oInit.bJQueryUI )
6459
+ {
6460
+ /* Use the JUI classes object for display. You could clone the oStdClasses object if
6461
+ * you want to have multiple tables with multiple independent classes
6462
+ */
6463
+ $.extend( oSettings.oClasses, DataTable.ext.oJUIClasses );
6464
+
6465
+ if ( oInit.sDom === DataTable.defaults.sDom && DataTable.defaults.sDom === "lfrtip" )
6466
+ {
6467
+ /* Set the DOM to use a layout suitable for jQuery UI's theming */
6468
+ oSettings.sDom = '<"H"lfr>t<"F"ip>';
6469
+ }
6470
+ }
6471
+ else
6472
+ {
6473
+ $.extend( oSettings.oClasses, DataTable.ext.oStdClasses );
6474
+ }
6475
+ $(this).addClass( oSettings.oClasses.sTable );
6476
+
6477
+ /* Calculate the scroll bar width and cache it for use later on */
6478
+ if ( oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "" )
6479
+ {
6480
+ oSettings.oScroll.iBarWidth = _fnScrollBarWidth();
6481
+ }
6482
+
6483
+ if ( oSettings.iInitDisplayStart === undefined )
6484
+ {
6485
+ /* Display start point, taking into account the save saving */
6486
+ oSettings.iInitDisplayStart = oInit.iDisplayStart;
6487
+ oSettings._iDisplayStart = oInit.iDisplayStart;
6488
+ }
6489
+
6490
+ /* Must be done after everything which can be overridden by a cookie! */
6491
+ if ( oInit.bStateSave )
6492
+ {
6493
+ oSettings.oFeatures.bStateSave = true;
6494
+ _fnLoadState( oSettings, oInit );
6495
+ _fnCallbackReg( oSettings, 'aoDrawCallback', _fnSaveState, 'state_save' );
6496
+ }
6497
+
6498
+ if ( oInit.iDeferLoading !== null )
6499
+ {
6500
+ oSettings.bDeferLoading = true;
6501
+ var tmp = $.isArray( oInit.iDeferLoading );
6502
+ oSettings._iRecordsDisplay = tmp ? oInit.iDeferLoading[0] : oInit.iDeferLoading;
6503
+ oSettings._iRecordsTotal = tmp ? oInit.iDeferLoading[1] : oInit.iDeferLoading;
6504
+ }
6505
+
6506
+ if ( oInit.aaData !== null )
6507
+ {
6508
+ bUsePassedData = true;
6509
+ }
6510
+
6511
+ /* Language definitions */
6512
+ if ( oInit.oLanguage.sUrl !== "" )
6513
+ {
6514
+ /* Get the language definitions from a file - because this Ajax call makes the language
6515
+ * get async to the remainder of this function we use bInitHandedOff to indicate that
6516
+ * _fnInitialise will be fired by the returned Ajax handler, rather than the constructor
6517
+ */
6518
+ oSettings.oLanguage.sUrl = oInit.oLanguage.sUrl;
6519
+ $.getJSON( oSettings.oLanguage.sUrl, null, function( json ) {
6520
+ _fnLanguageCompat( json );
6521
+ $.extend( true, oSettings.oLanguage, oInit.oLanguage, json );
6522
+ _fnInitialise( oSettings );
6523
+ } );
6524
+ bInitHandedOff = true;
6525
+ }
6526
+ else
6527
+ {
6528
+ $.extend( true, oSettings.oLanguage, oInit.oLanguage );
6529
+ }
6530
+
6531
+
6532
+ /*
6533
+ * Stripes
6534
+ */
6535
+ if ( oInit.asStripeClasses === null )
6536
+ {
6537
+ oSettings.asStripeClasses =[
6538
+ oSettings.oClasses.sStripeOdd,
6539
+ oSettings.oClasses.sStripeEven
6540
+ ];
6541
+ }
6542
+
6543
+ /* Remove row stripe classes if they are already on the table row */
6544
+ var bStripeRemove = false;
6545
+ var anRows = $(this).children('tbody').children('tr');
6546
+ for ( i=0, iLen=oSettings.asStripeClasses.length ; i<iLen ; i++ )
6547
+ {
6548
+ if ( anRows.filter(":lt(2)").hasClass( oSettings.asStripeClasses[i]) )
6549
+ {
6550
+ bStripeRemove = true;
6551
+ break;
6552
+ }
6553
+ }
6554
+
6555
+ if ( bStripeRemove )
6556
+ {
6557
+ /* Store the classes which we are about to remove so they can be re-added on destroy */
6558
+ oSettings.asDestroyStripes = [ '', '' ];
6559
+ if ( $(anRows[0]).hasClass(oSettings.oClasses.sStripeOdd) )
6560
+ {
6561
+ oSettings.asDestroyStripes[0] += oSettings.oClasses.sStripeOdd+" ";
6562
+ }
6563
+ if ( $(anRows[0]).hasClass(oSettings.oClasses.sStripeEven) )
6564
+ {
6565
+ oSettings.asDestroyStripes[0] += oSettings.oClasses.sStripeEven;
6566
+ }
6567
+ if ( $(anRows[1]).hasClass(oSettings.oClasses.sStripeOdd) )
6568
+ {
6569
+ oSettings.asDestroyStripes[1] += oSettings.oClasses.sStripeOdd+" ";
6570
+ }
6571
+ if ( $(anRows[1]).hasClass(oSettings.oClasses.sStripeEven) )
6572
+ {
6573
+ oSettings.asDestroyStripes[1] += oSettings.oClasses.sStripeEven;
6574
+ }
6575
+
6576
+ anRows.removeClass( oSettings.asStripeClasses.join(' ') );
6577
+ }
6578
+
6579
+
6580
+ /*
6581
+ * Columns
6582
+ * See if we should load columns automatically or use defined ones
6583
+ */
6584
+ var anThs = [];
6585
+ var aoColumnsInit;
6586
+ var nThead = this.getElementsByTagName('thead');
6587
+ if ( nThead.length !== 0 )
6588
+ {
6589
+ _fnDetectHeader( oSettings.aoHeader, nThead[0] );
6590
+ anThs = _fnGetUniqueThs( oSettings );
6591
+ }
6592
+
6593
+ /* If not given a column array, generate one with nulls */
6594
+ if ( oInit.aoColumns === null )
6595
+ {
6596
+ aoColumnsInit = [];
6597
+ for ( i=0, iLen=anThs.length ; i<iLen ; i++ )
6598
+ {
6599
+ aoColumnsInit.push( null );
6600
+ }
6601
+ }
6602
+ else
6603
+ {
6604
+ aoColumnsInit = oInit.aoColumns;
6605
+ }
6606
+
6607
+ /* Add the columns */
6608
+ for ( i=0, iLen=aoColumnsInit.length ; i<iLen ; i++ )
6609
+ {
6610
+ /* Short cut - use the loop to check if we have column visibility state to restore */
6611
+ if ( oInit.saved_aoColumns !== undefined && oInit.saved_aoColumns.length == iLen )
6612
+ {
6613
+ if ( aoColumnsInit[i] === null )
6614
+ {
6615
+ aoColumnsInit[i] = {};
6616
+ }
6617
+ aoColumnsInit[i].bVisible = oInit.saved_aoColumns[i].bVisible;
6618
+ }
6619
+
6620
+ _fnAddColumn( oSettings, anThs ? anThs[i] : null );
6621
+ }
6622
+
6623
+ /* Apply the column definitions */
6624
+ _fnApplyColumnDefs( oSettings, oInit.aoColumnDefs, aoColumnsInit, function (iCol, oDef) {
6625
+ _fnColumnOptions( oSettings, iCol, oDef );
6626
+ } );
6627
+
6628
+
6629
+ /*
6630
+ * Sorting
6631
+ * Check the aaSorting array
6632
+ */
6633
+ for ( i=0, iLen=oSettings.aaSorting.length ; i<iLen ; i++ )
6634
+ {
6635
+ if ( oSettings.aaSorting[i][0] >= oSettings.aoColumns.length )
6636
+ {
6637
+ oSettings.aaSorting[i][0] = 0;
6638
+ }
6639
+ var oColumn = oSettings.aoColumns[ oSettings.aaSorting[i][0] ];
6640
+
6641
+ /* Add a default sorting index */
6642
+ if ( oSettings.aaSorting[i][2] === undefined )
6643
+ {
6644
+ oSettings.aaSorting[i][2] = 0;
6645
+ }
6646
+
6647
+ /* If aaSorting is not defined, then we use the first indicator in asSorting */
6648
+ if ( oInit.aaSorting === undefined && oSettings.saved_aaSorting === undefined )
6649
+ {
6650
+ oSettings.aaSorting[i][1] = oColumn.asSorting[0];
6651
+ }
6652
+
6653
+ /* Set the current sorting index based on aoColumns.asSorting */
6654
+ for ( j=0, jLen=oColumn.asSorting.length ; j<jLen ; j++ )
6655
+ {
6656
+ if ( oSettings.aaSorting[i][1] == oColumn.asSorting[j] )
6657
+ {
6658
+ oSettings.aaSorting[i][2] = j;
6659
+ break;
6660
+ }
6661
+ }
6662
+ }
6663
+
6664
+ /* Do a first pass on the sorting classes (allows any size changes to be taken into
6665
+ * account, and also will apply sorting disabled classes if disabled
6666
+ */
6667
+ _fnSortingClasses( oSettings );
6668
+
6669
+
6670
+ /*
6671
+ * Final init
6672
+ * Cache the header, body and footer as required, creating them if needed
6673
+ */
6674
+
6675
+ /* Browser support detection */
6676
+ _fnBrowserDetect( oSettings );
6677
+
6678
+ // Work around for Webkit bug 83867 - store the caption-side before removing from doc
6679
+ var captions = $(this).children('caption').each( function () {
6680
+ this._captionSide = $(this).css('caption-side');
6681
+ } );
6682
+
6683
+ var thead = $(this).children('thead');
6684
+ if ( thead.length === 0 )
6685
+ {
6686
+ thead = [ document.createElement( 'thead' ) ];
6687
+ this.appendChild( thead[0] );
6688
+ }
6689
+ oSettings.nTHead = thead[0];
6690
+
6691
+ var tbody = $(this).children('tbody');
6692
+ if ( tbody.length === 0 )
6693
+ {
6694
+ tbody = [ document.createElement( 'tbody' ) ];
6695
+ this.appendChild( tbody[0] );
6696
+ }
6697
+ oSettings.nTBody = tbody[0];
6698
+ oSettings.nTBody.setAttribute( "role", "alert" );
6699
+ oSettings.nTBody.setAttribute( "aria-live", "polite" );
6700
+ oSettings.nTBody.setAttribute( "aria-relevant", "all" );
6701
+
6702
+ var tfoot = $(this).children('tfoot');
6703
+ if ( tfoot.length === 0 && captions.length > 0 && (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "") )
6704
+ {
6705
+ // If we are a scrolling table, and no footer has been given, then we need to create
6706
+ // a tfoot element for the caption element to be appended to
6707
+ tfoot = [ document.createElement( 'tfoot' ) ];
6708
+ this.appendChild( tfoot[0] );
6709
+ }
6710
+
6711
+ if ( tfoot.length > 0 )
6712
+ {
6713
+ oSettings.nTFoot = tfoot[0];
6714
+ _fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot );
6715
+ }
6716
+
6717
+ /* Check if there is data passing into the constructor */
6718
+ if ( bUsePassedData )
6719
+ {
6720
+ for ( i=0 ; i<oInit.aaData.length ; i++ )
6721
+ {
6722
+ _fnAddData( oSettings, oInit.aaData[ i ] );
6723
+ }
6724
+ }
6725
+ else
6726
+ {
6727
+ /* Grab the data from the page */
6728
+ _fnGatherData( oSettings );
6729
+ }
6730
+
6731
+ /* Copy the data index array */
6732
+ oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
6733
+
6734
+ /* Initialisation complete - table can be drawn */
6735
+ oSettings.bInitialised = true;
6736
+
6737
+ /* Check if we need to initialise the table (it might not have been handed off to the
6738
+ * language processor)
6739
+ */
6740
+ if ( bInitHandedOff === false )
6741
+ {
6742
+ _fnInitialise( oSettings );
6743
+ }
6744
+ } );
6745
+ };
6746
+
6747
+
6748
+
6749
+ /**
6750
+ * Provide a common method for plug-ins to check the version of DataTables being used, in order
6751
+ * to ensure compatibility.
6752
+ * @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note that the
6753
+ * formats "X" and "X.Y" are also acceptable.
6754
+ * @returns {boolean} true if this version of DataTables is greater or equal to the required
6755
+ * version, or false if this version of DataTales is not suitable
6756
+ * @static
6757
+ * @dtopt API-Static
6758
+ *
6759
+ * @example
6760
+ * alert( $.fn.dataTable.fnVersionCheck( '1.9.0' ) );
6761
+ */
6762
+ DataTable.fnVersionCheck = function( sVersion )
6763
+ {
6764
+ /* This is cheap, but effective */
6765
+ var fnZPad = function (Zpad, count)
6766
+ {
6767
+ while(Zpad.length < count) {
6768
+ Zpad += '0';
6769
+ }
6770
+ return Zpad;
6771
+ };
6772
+ var aThis = DataTable.ext.sVersion.split('.');
6773
+ var aThat = sVersion.split('.');
6774
+ var sThis = '', sThat = '';
6775
+
6776
+ for ( var i=0, iLen=aThat.length ; i<iLen ; i++ )
6777
+ {
6778
+ sThis += fnZPad( aThis[i], 3 );
6779
+ sThat += fnZPad( aThat[i], 3 );
6780
+ }
6781
+
6782
+ return parseInt(sThis, 10) >= parseInt(sThat, 10);
6783
+ };
6784
+
6785
+
6786
+ /**
6787
+ * Check if a TABLE node is a DataTable table already or not.
6788
+ * @param {node} nTable The TABLE node to check if it is a DataTable or not (note that other
6789
+ * node types can be passed in, but will always return false).
6790
+ * @returns {boolean} true the table given is a DataTable, or false otherwise
6791
+ * @static
6792
+ * @dtopt API-Static
6793
+ *
6794
+ * @example
6795
+ * var ex = document.getElementById('example');
6796
+ * if ( ! $.fn.DataTable.fnIsDataTable( ex ) ) {
6797
+ * $(ex).dataTable();
6798
+ * }
6799
+ */
6800
+ DataTable.fnIsDataTable = function ( nTable )
6801
+ {
6802
+ var o = DataTable.settings;
6803
+
6804
+ for ( var i=0 ; i<o.length ; i++ )
6805
+ {
6806
+ if ( o[i].nTable === nTable || o[i].nScrollHead === nTable || o[i].nScrollFoot === nTable )
6807
+ {
6808
+ return true;
6809
+ }
6810
+ }
6811
+
6812
+ return false;
6813
+ };
6814
+
6815
+
6816
+ /**
6817
+ * Get all DataTable tables that have been initialised - optionally you can select to
6818
+ * get only currently visible tables.
6819
+ * @param {boolean} [bVisible=false] Flag to indicate if you want all (default) or
6820
+ * visible tables only.
6821
+ * @returns {array} Array of TABLE nodes (not DataTable instances) which are DataTables
6822
+ * @static
6823
+ * @dtopt API-Static
6824
+ *
6825
+ * @example
6826
+ * var table = $.fn.dataTable.fnTables(true);
6827
+ * if ( table.length > 0 ) {
6828
+ * $(table).dataTable().fnAdjustColumnSizing();
6829
+ * }
6830
+ */
6831
+ DataTable.fnTables = function ( bVisible )
6832
+ {
6833
+ var out = [];
6834
+
6835
+ jQuery.each( DataTable.settings, function (i, o) {
6836
+ if ( !bVisible || (bVisible === true && $(o.nTable).is(':visible')) )
6837
+ {
6838
+ out.push( o.nTable );
6839
+ }
6840
+ } );
6841
+
6842
+ return out;
6843
+ };
6844
+
6845
+
6846
+ /**
6847
+ * Version string for plug-ins to check compatibility. Allowed format is
6848
+ * a.b.c.d.e where: a:int, b:int, c:int, d:string(dev|beta), e:int. d and
6849
+ * e are optional
6850
+ * @member
6851
+ * @type string
6852
+ * @default Version number
6853
+ */
6854
+ DataTable.version = "1.9.3";
6855
+
6856
+ /**
6857
+ * Private data store, containing all of the settings objects that are created for the
6858
+ * tables on a given page.
6859
+ *
6860
+ * Note that the <i>DataTable.settings</i> object is aliased to <i>jQuery.fn.dataTableExt</i>
6861
+ * through which it may be accessed and manipulated, or <i>jQuery.fn.dataTable.settings</i>.
6862
+ * @member
6863
+ * @type array
6864
+ * @default []
6865
+ * @private
6866
+ */
6867
+ DataTable.settings = [];
6868
+
6869
+ /**
6870
+ * Object models container, for the various models that DataTables has available
6871
+ * to it. These models define the objects that are used to hold the active state
6872
+ * and configuration of the table.
6873
+ * @namespace
6874
+ */
6875
+ DataTable.models = {};
6876
+
6877
+
6878
+ /**
6879
+ * DataTables extension options and plug-ins. This namespace acts as a collection "area"
6880
+ * for plug-ins that can be used to extend the default DataTables behaviour - indeed many
6881
+ * of the build in methods use this method to provide their own capabilities (sorting methods
6882
+ * for example).
6883
+ *
6884
+ * Note that this namespace is aliased to jQuery.fn.dataTableExt so it can be readily accessed
6885
+ * and modified by plug-ins.
6886
+ * @namespace
6887
+ */
6888
+ DataTable.models.ext = {
6889
+ /**
6890
+ * Plug-in filtering functions - this method of filtering is complimentary to the default
6891
+ * type based filtering, and a lot more comprehensive as it allows you complete control
6892
+ * over the filtering logic. Each element in this array is a function (parameters
6893
+ * described below) that is called for every row in the table, and your logic decides if
6894
+ * it should be included in the filtered data set or not.
6895
+ * <ul>
6896
+ * <li>
6897
+ * Function input parameters:
6898
+ * <ul>
6899
+ * <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
6900
+ * <li>{array|object} Data for the row to be processed (same as the original format
6901
+ * that was passed in as the data source, or an array from a DOM data source</li>
6902
+ * <li>{int} Row index in aoData ({@link DataTable.models.oSettings.aoData}), which can
6903
+ * be useful to retrieve the TR element if you need DOM interaction.</li>
6904
+ * </ul>
6905
+ * </li>
6906
+ * <li>
6907
+ * Function return:
6908
+ * <ul>
6909
+ * <li>{boolean} Include the row in the filtered result set (true) or not (false)</li>
6910
+ * </ul>
6911
+ * </il>
6912
+ * </ul>
6913
+ * @type array
6914
+ * @default []
6915
+ *
6916
+ * @example
6917
+ * // The following example shows custom filtering being applied to the fourth column (i.e.
6918
+ * // the aData[3] index) based on two input values from the end-user, matching the data in
6919
+ * // a certain range.
6920
+ * $.fn.dataTableExt.afnFiltering.push(
6921
+ * function( oSettings, aData, iDataIndex ) {
6922
+ * var iMin = document.getElementById('min').value * 1;
6923
+ * var iMax = document.getElementById('max').value * 1;
6924
+ * var iVersion = aData[3] == "-" ? 0 : aData[3]*1;
6925
+ * if ( iMin == "" && iMax == "" ) {
6926
+ * return true;
6927
+ * }
6928
+ * else if ( iMin == "" && iVersion < iMax ) {
6929
+ * return true;
6930
+ * }
6931
+ * else if ( iMin < iVersion && "" == iMax ) {
6932
+ * return true;
6933
+ * }
6934
+ * else if ( iMin < iVersion && iVersion < iMax ) {
6935
+ * return true;
6936
+ * }
6937
+ * return false;
6938
+ * }
6939
+ * );
6940
+ */
6941
+ "afnFiltering": [],
6942
+
6943
+
6944
+ /**
6945
+ * Plug-in sorting functions - this method of sorting is complimentary to the default type
6946
+ * based sorting that DataTables does automatically, allowing much greater control over the
6947
+ * the data that is being used to sort a column. This is useful if you want to do sorting
6948
+ * based on live data (for example the contents of an 'input' element) rather than just the
6949
+ * static string that DataTables knows of. The way these plug-ins work is that you create
6950
+ * an array of the values you wish to be sorted for the column in question and then return
6951
+ * that array. Which pre-sorting function is run here depends on the sSortDataType parameter
6952
+ * that is used for the column (if any). This is the corollary of <i>ofnSearch</i> for sort
6953
+ * data.
6954
+ * <ul>
6955
+ * <li>
6956
+ * Function input parameters:
6957
+ * <ul>
6958
+ * <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
6959
+ * <li>{int} Target column index</li>
6960
+ * </ul>
6961
+ * </li>
6962
+ * <li>
6963
+ * Function return:
6964
+ * <ul>
6965
+ * <li>{array} Data for the column to be sorted upon</li>
6966
+ * </ul>
6967
+ * </il>
6968
+ * </ul>
6969
+ *
6970
+ * Note that as of v1.9, it is typically preferable to use <i>mData</i> to prepare data for
6971
+ * the different uses that DataTables can put the data to. Specifically <i>mData</i> when
6972
+ * used as a function will give you a 'type' (sorting, filtering etc) that you can use to
6973
+ * prepare the data as required for the different types. As such, this method is deprecated.
6974
+ * @type array
6975
+ * @default []
6976
+ * @deprecated
6977
+ *
6978
+ * @example
6979
+ * // Updating the cached sorting information with user entered values in HTML input elements
6980
+ * jQuery.fn.dataTableExt.afnSortData['dom-text'] = function ( oSettings, iColumn )
6981
+ * {
6982
+ * var aData = [];
6983
+ * $( 'td:eq('+iColumn+') input', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
6984
+ * aData.push( this.value );
6985
+ * } );
6986
+ * return aData;
6987
+ * }
6988
+ */
6989
+ "afnSortData": [],
6990
+
6991
+
6992
+ /**
6993
+ * Feature plug-ins - This is an array of objects which describe the feature plug-ins that are
6994
+ * available to DataTables. These feature plug-ins are accessible through the sDom initialisation
6995
+ * option. As such, each feature plug-in must describe a function that is used to initialise
6996
+ * itself (fnInit), a character so the feature can be enabled by sDom (cFeature) and the name
6997
+ * of the feature (sFeature). Thus the objects attached to this method must provide:
6998
+ * <ul>
6999
+ * <li>{function} fnInit Initialisation of the plug-in
7000
+ * <ul>
7001
+ * <li>
7002
+ * Function input parameters:
7003
+ * <ul>
7004
+ * <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
7005
+ * </ul>
7006
+ * </li>
7007
+ * <li>
7008
+ * Function return:
7009
+ * <ul>
7010
+ * <li>{node|null} The element which contains your feature. Note that the return
7011
+ * may also be void if your plug-in does not require to inject any DOM elements
7012
+ * into DataTables control (sDom) - for example this might be useful when
7013
+ * developing a plug-in which allows table control via keyboard entry.</li>
7014
+ * </ul>
7015
+ * </il>
7016
+ * </ul>
7017
+ * </li>
7018
+ * <li>{character} cFeature Character that will be matched in sDom - case sensitive</li>
7019
+ * <li>{string} sFeature Feature name</li>
7020
+ * </ul>
7021
+ * @type array
7022
+ * @default []
7023
+ *
7024
+ * @example
7025
+ * // How TableTools initialises itself.
7026
+ * $.fn.dataTableExt.aoFeatures.push( {
7027
+ * "fnInit": function( oSettings ) {
7028
+ * return new TableTools( { "oDTSettings": oSettings } );
7029
+ * },
7030
+ * "cFeature": "T",
7031
+ * "sFeature": "TableTools"
7032
+ * } );
7033
+ */
7034
+ "aoFeatures": [],
7035
+
7036
+
7037
+ /**
7038
+ * Type detection plug-in functions - DataTables utilises types to define how sorting and
7039
+ * filtering behave, and types can be either be defined by the developer (sType for the
7040
+ * column) or they can be automatically detected by the methods in this array. The functions
7041
+ * defined in the array are quite simple, taking a single parameter (the data to analyse)
7042
+ * and returning the type if it is a known type, or null otherwise.
7043
+ * <ul>
7044
+ * <li>
7045
+ * Function input parameters:
7046
+ * <ul>
7047
+ * <li>{*} Data from the column cell to be analysed</li>
7048
+ * </ul>
7049
+ * </li>
7050
+ * <li>
7051
+ * Function return:
7052
+ * <ul>
7053
+ * <li>{string|null} Data type detected, or null if unknown (and thus pass it
7054
+ * on to the other type detection functions.</li>
7055
+ * </ul>
7056
+ * </il>
7057
+ * </ul>
7058
+ * @type array
7059
+ * @default []
7060
+ *
7061
+ * @example
7062
+ * // Currency type detection plug-in:
7063
+ * jQuery.fn.dataTableExt.aTypes.push(
7064
+ * function ( sData ) {
7065
+ * var sValidChars = "0123456789.-";
7066
+ * var Char;
7067
+ *
7068
+ * // Check the numeric part
7069
+ * for ( i=1 ; i<sData.length ; i++ ) {
7070
+ * Char = sData.charAt(i);
7071
+ * if (sValidChars.indexOf(Char) == -1) {
7072
+ * return null;
7073
+ * }
7074
+ * }
7075
+ *
7076
+ * // Check prefixed by currency
7077
+ * if ( sData.charAt(0) == '$' || sData.charAt(0) == '&pound;' ) {
7078
+ * return 'currency';
7079
+ * }
7080
+ * return null;
7081
+ * }
7082
+ * );
7083
+ */
7084
+ "aTypes": [],
7085
+
7086
+
7087
+ /**
7088
+ * Provide a common method for plug-ins to check the version of DataTables being used,
7089
+ * in order to ensure compatibility.
7090
+ * @type function
7091
+ * @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note
7092
+ * that the formats "X" and "X.Y" are also acceptable.
7093
+ * @returns {boolean} true if this version of DataTables is greater or equal to the
7094
+ * required version, or false if this version of DataTales is not suitable
7095
+ *
7096
+ * @example
7097
+ * $(document).ready(function() {
7098
+ * var oTable = $('#example').dataTable();
7099
+ * alert( oTable.fnVersionCheck( '1.9.0' ) );
7100
+ * } );
7101
+ */
7102
+ "fnVersionCheck": DataTable.fnVersionCheck,
7103
+
7104
+
7105
+ /**
7106
+ * Index for what 'this' index API functions should use
7107
+ * @type int
7108
+ * @default 0
7109
+ */
7110
+ "iApiIndex": 0,
7111
+
7112
+
7113
+ /**
7114
+ * Pre-processing of filtering data plug-ins - When you assign the sType for a column
7115
+ * (or have it automatically detected for you by DataTables or a type detection plug-in),
7116
+ * you will typically be using this for custom sorting, but it can also be used to provide
7117
+ * custom filtering by allowing you to pre-processing the data and returning the data in
7118
+ * the format that should be filtered upon. This is done by adding functions this object
7119
+ * with a parameter name which matches the sType for that target column. This is the
7120
+ * corollary of <i>afnSortData</i> for filtering data.
7121
+ * <ul>
7122
+ * <li>
7123
+ * Function input parameters:
7124
+ * <ul>
7125
+ * <li>{*} Data from the column cell to be prepared for filtering</li>
7126
+ * </ul>
7127
+ * </li>
7128
+ * <li>
7129
+ * Function return:
7130
+ * <ul>
7131
+ * <li>{string|null} Formatted string that will be used for the filtering.</li>
7132
+ * </ul>
7133
+ * </il>
7134
+ * </ul>
7135
+ *
7136
+ * Note that as of v1.9, it is typically preferable to use <i>mData</i> to prepare data for
7137
+ * the different uses that DataTables can put the data to. Specifically <i>mData</i> when
7138
+ * used as a function will give you a 'type' (sorting, filtering etc) that you can use to
7139
+ * prepare the data as required for the different types. As such, this method is deprecated.
7140
+ * @type object
7141
+ * @default {}
7142
+ * @deprecated
7143
+ *
7144
+ * @example
7145
+ * $.fn.dataTableExt.ofnSearch['title-numeric'] = function ( sData ) {
7146
+ * return sData.replace(/\n/g," ").replace( /<.*?>/g, "" );
7147
+ * }
7148
+ */
7149
+ "ofnSearch": {},
7150
+
7151
+
7152
+ /**
7153
+ * Container for all private functions in DataTables so they can be exposed externally
7154
+ * @type object
7155
+ * @default {}
7156
+ */
7157
+ "oApi": {},
7158
+
7159
+
7160
+ /**
7161
+ * Storage for the various classes that DataTables uses
7162
+ * @type object
7163
+ * @default {}
7164
+ */
7165
+ "oStdClasses": {},
7166
+
7167
+
7168
+ /**
7169
+ * Storage for the various classes that DataTables uses - jQuery UI suitable
7170
+ * @type object
7171
+ * @default {}
7172
+ */
7173
+ "oJUIClasses": {},
7174
+
7175
+
7176
+ /**
7177
+ * Pagination plug-in methods - The style and controls of the pagination can significantly
7178
+ * impact on how the end user interacts with the data in your table, and DataTables allows
7179
+ * the addition of pagination controls by extending this object, which can then be enabled
7180
+ * through the <i>sPaginationType</i> initialisation parameter. Each pagination type that
7181
+ * is added is an object (the property name of which is what <i>sPaginationType</i> refers
7182
+ * to) that has two properties, both methods that are used by DataTables to update the
7183
+ * control's state.
7184
+ * <ul>
7185
+ * <li>
7186
+ * fnInit - Initialisation of the paging controls. Called only during initialisation
7187
+ * of the table. It is expected that this function will add the required DOM elements
7188
+ * to the page for the paging controls to work. The element pointer
7189
+ * 'oSettings.aanFeatures.p' array is provided by DataTables to contain the paging
7190
+ * controls (note that this is a 2D array to allow for multiple instances of each
7191
+ * DataTables DOM element). It is suggested that you add the controls to this element
7192
+ * as children
7193
+ * <ul>
7194
+ * <li>
7195
+ * Function input parameters:
7196
+ * <ul>
7197
+ * <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
7198
+ * <li>{node} Container into which the pagination controls must be inserted</li>
7199
+ * <li>{function} Draw callback function - whenever the controls cause a page
7200
+ * change, this method must be called to redraw the table.</li>
7201
+ * </ul>
7202
+ * </li>
7203
+ * <li>
7204
+ * Function return:
7205
+ * <ul>
7206
+ * <li>No return required</li>
7207
+ * </ul>
7208
+ * </il>
7209
+ * </ul>
7210
+ * </il>
7211
+ * <li>
7212
+ * fnInit - This function is called whenever the paging status of the table changes and is
7213
+ * typically used to update classes and/or text of the paging controls to reflex the new
7214
+ * status.
7215
+ * <ul>
7216
+ * <li>
7217
+ * Function input parameters:
7218
+ * <ul>
7219
+ * <li>{object} DataTables settings object: see {@link DataTable.models.oSettings}.</li>
7220
+ * <li>{function} Draw callback function - in case you need to redraw the table again
7221
+ * or attach new event listeners</li>
7222
+ * </ul>
7223
+ * </li>
7224
+ * <li>
7225
+ * Function return:
7226
+ * <ul>
7227
+ * <li>No return required</li>
7228
+ * </ul>
7229
+ * </il>
7230
+ * </ul>
7231
+ * </il>
7232
+ * </ul>
7233
+ * @type object
7234
+ * @default {}
7235
+ *
7236
+ * @example
7237
+ * $.fn.dataTableExt.oPagination.four_button = {
7238
+ * "fnInit": function ( oSettings, nPaging, fnCallbackDraw ) {
7239
+ * nFirst = document.createElement( 'span' );
7240
+ * nPrevious = document.createElement( 'span' );
7241
+ * nNext = document.createElement( 'span' );
7242
+ * nLast = document.createElement( 'span' );
7243
+ *
7244
+ * nFirst.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sFirst ) );
7245
+ * nPrevious.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sPrevious ) );
7246
+ * nNext.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sNext ) );
7247
+ * nLast.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sLast ) );
7248
+ *
7249
+ * nFirst.className = "paginate_button first";
7250
+ * nPrevious.className = "paginate_button previous";
7251
+ * nNext.className="paginate_button next";
7252
+ * nLast.className = "paginate_button last";
7253
+ *
7254
+ * nPaging.appendChild( nFirst );
7255
+ * nPaging.appendChild( nPrevious );
7256
+ * nPaging.appendChild( nNext );
7257
+ * nPaging.appendChild( nLast );
7258
+ *
7259
+ * $(nFirst).click( function () {
7260
+ * oSettings.oApi._fnPageChange( oSettings, "first" );
7261
+ * fnCallbackDraw( oSettings );
7262
+ * } );
7263
+ *
7264
+ * $(nPrevious).click( function() {
7265
+ * oSettings.oApi._fnPageChange( oSettings, "previous" );
7266
+ * fnCallbackDraw( oSettings );
7267
+ * } );
7268
+ *
7269
+ * $(nNext).click( function() {
7270
+ * oSettings.oApi._fnPageChange( oSettings, "next" );
7271
+ * fnCallbackDraw( oSettings );
7272
+ * } );
7273
+ *
7274
+ * $(nLast).click( function() {
7275
+ * oSettings.oApi._fnPageChange( oSettings, "last" );
7276
+ * fnCallbackDraw( oSettings );
7277
+ * } );
7278
+ *
7279
+ * $(nFirst).bind( 'selectstart', function () { return false; } );
7280
+ * $(nPrevious).bind( 'selectstart', function () { return false; } );
7281
+ * $(nNext).bind( 'selectstart', function () { return false; } );
7282
+ * $(nLast).bind( 'selectstart', function () { return false; } );
7283
+ * },
7284
+ *
7285
+ * "fnUpdate": function ( oSettings, fnCallbackDraw ) {
7286
+ * if ( !oSettings.aanFeatures.p ) {
7287
+ * return;
7288
+ * }
7289
+ *
7290
+ * // Loop over each instance of the pager
7291
+ * var an = oSettings.aanFeatures.p;
7292
+ * for ( var i=0, iLen=an.length ; i<iLen ; i++ ) {
7293
+ * var buttons = an[i].getElementsByTagName('span');
7294
+ * if ( oSettings._iDisplayStart === 0 ) {
7295
+ * buttons[0].className = "paginate_disabled_previous";
7296
+ * buttons[1].className = "paginate_disabled_previous";
7297
+ * }
7298
+ * else {
7299
+ * buttons[0].className = "paginate_enabled_previous";
7300
+ * buttons[1].className = "paginate_enabled_previous";
7301
+ * }
7302
+ *
7303
+ * if ( oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay() ) {
7304
+ * buttons[2].className = "paginate_disabled_next";
7305
+ * buttons[3].className = "paginate_disabled_next";
7306
+ * }
7307
+ * else {
7308
+ * buttons[2].className = "paginate_enabled_next";
7309
+ * buttons[3].className = "paginate_enabled_next";
7310
+ * }
7311
+ * }
7312
+ * }
7313
+ * };
7314
+ */
7315
+ "oPagination": {},
7316
+
7317
+
7318
+ /**
7319
+ * Sorting plug-in methods - Sorting in DataTables is based on the detected type of the
7320
+ * data column (you can add your own type detection functions, or override automatic
7321
+ * detection using sType). With this specific type given to the column, DataTables will
7322
+ * apply the required sort from the functions in the object. Each sort type must provide
7323
+ * two mandatory methods, one each for ascending and descending sorting, and can optionally
7324
+ * provide a pre-formatting method that will help speed up sorting by allowing DataTables
7325
+ * to pre-format the sort data only once (rather than every time the actual sort functions
7326
+ * are run). The two sorting functions are typical Javascript sort methods:
7327
+ * <ul>
7328
+ * <li>
7329
+ * Function input parameters:
7330
+ * <ul>
7331
+ * <li>{*} Data to compare to the second parameter</li>
7332
+ * <li>{*} Data to compare to the first parameter</li>
7333
+ * </ul>
7334
+ * </li>
7335
+ * <li>
7336
+ * Function return:
7337
+ * <ul>
7338
+ * <li>{int} Sorting match: <0 if first parameter should be sorted lower than
7339
+ * the second parameter, ===0 if the two parameters are equal and >0 if
7340
+ * the first parameter should be sorted height than the second parameter.</li>
7341
+ * </ul>
7342
+ * </il>
7343
+ * </ul>
7344
+ * @type object
7345
+ * @default {}
7346
+ *
7347
+ * @example
7348
+ * // Case-sensitive string sorting, with no pre-formatting method
7349
+ * $.extend( $.fn.dataTableExt.oSort, {
7350
+ * "string-case-asc": function(x,y) {
7351
+ * return ((x < y) ? -1 : ((x > y) ? 1 : 0));
7352
+ * },
7353
+ * "string-case-desc": function(x,y) {
7354
+ * return ((x < y) ? 1 : ((x > y) ? -1 : 0));
7355
+ * }
7356
+ * } );
7357
+ *
7358
+ * @example
7359
+ * // Case-insensitive string sorting, with pre-formatting
7360
+ * $.extend( $.fn.dataTableExt.oSort, {
7361
+ * "string-pre": function(x) {
7362
+ * return x.toLowerCase();
7363
+ * },
7364
+ * "string-asc": function(x,y) {
7365
+ * return ((x < y) ? -1 : ((x > y) ? 1 : 0));
7366
+ * },
7367
+ * "string-desc": function(x,y) {
7368
+ * return ((x < y) ? 1 : ((x > y) ? -1 : 0));
7369
+ * }
7370
+ * } );
7371
+ */
7372
+ "oSort": {},
7373
+
7374
+
7375
+ /**
7376
+ * Version string for plug-ins to check compatibility. Allowed format is
7377
+ * a.b.c.d.e where: a:int, b:int, c:int, d:string(dev|beta), e:int. d and
7378
+ * e are optional
7379
+ * @type string
7380
+ * @default Version number
7381
+ */
7382
+ "sVersion": DataTable.version,
7383
+
7384
+
7385
+ /**
7386
+ * How should DataTables report an error. Can take the value 'alert' or 'throw'
7387
+ * @type string
7388
+ * @default alert
7389
+ */
7390
+ "sErrMode": "alert",
7391
+
7392
+
7393
+ /**
7394
+ * Store information for DataTables to access globally about other instances
7395
+ * @namespace
7396
+ * @private
7397
+ */
7398
+ "_oExternConfig": {
7399
+ /* int:iNextUnique - next unique number for an instance */
7400
+ "iNextUnique": 0
7401
+ }
7402
+ };
7403
+
7404
+
7405
+
7406
+
7407
+ /**
7408
+ * Template object for the way in which DataTables holds information about
7409
+ * search information for the global filter and individual column filters.
7410
+ * @namespace
7411
+ */
7412
+ DataTable.models.oSearch = {
7413
+ /**
7414
+ * Flag to indicate if the filtering should be case insensitive or not
7415
+ * @type boolean
7416
+ * @default true
7417
+ */
7418
+ "bCaseInsensitive": true,
7419
+
7420
+ /**
7421
+ * Applied search term
7422
+ * @type string
7423
+ * @default <i>Empty string</i>
7424
+ */
7425
+ "sSearch": "",
7426
+
7427
+ /**
7428
+ * Flag to indicate if the search term should be interpreted as a
7429
+ * regular expression (true) or not (false) and therefore and special
7430
+ * regex characters escaped.
7431
+ * @type boolean
7432
+ * @default false
7433
+ */
7434
+ "bRegex": false,
7435
+
7436
+ /**
7437
+ * Flag to indicate if DataTables is to use its smart filtering or not.
7438
+ * @type boolean
7439
+ * @default true
7440
+ */
7441
+ "bSmart": true
7442
+ };
7443
+
7444
+
7445
+
7446
+
7447
+ /**
7448
+ * Template object for the way in which DataTables holds information about
7449
+ * each individual row. This is the object format used for the settings
7450
+ * aoData array.
7451
+ * @namespace
7452
+ */
7453
+ DataTable.models.oRow = {
7454
+ /**
7455
+ * TR element for the row
7456
+ * @type node
7457
+ * @default null
7458
+ */
7459
+ "nTr": null,
7460
+
7461
+ /**
7462
+ * Data object from the original data source for the row. This is either
7463
+ * an array if using the traditional form of DataTables, or an object if
7464
+ * using mData options. The exact type will depend on the passed in
7465
+ * data from the data source, or will be an array if using DOM a data
7466
+ * source.
7467
+ * @type array|object
7468
+ * @default []
7469
+ */
7470
+ "_aData": [],
7471
+
7472
+ /**
7473
+ * Sorting data cache - this array is ostensibly the same length as the
7474
+ * number of columns (although each index is generated only as it is
7475
+ * needed), and holds the data that is used for sorting each column in the
7476
+ * row. We do this cache generation at the start of the sort in order that
7477
+ * the formatting of the sort data need be done only once for each cell
7478
+ * per sort. This array should not be read from or written to by anything
7479
+ * other than the master sorting methods.
7480
+ * @type array
7481
+ * @default []
7482
+ * @private
7483
+ */
7484
+ "_aSortData": [],
7485
+
7486
+ /**
7487
+ * Array of TD elements that are cached for hidden rows, so they can be
7488
+ * reinserted into the table if a column is made visible again (or to act
7489
+ * as a store if a column is made hidden). Only hidden columns have a
7490
+ * reference in the array. For non-hidden columns the value is either
7491
+ * undefined or null.
7492
+ * @type array nodes
7493
+ * @default []
7494
+ * @private
7495
+ */
7496
+ "_anHidden": [],
7497
+
7498
+ /**
7499
+ * Cache of the class name that DataTables has applied to the row, so we
7500
+ * can quickly look at this variable rather than needing to do a DOM check
7501
+ * on className for the nTr property.
7502
+ * @type string
7503
+ * @default <i>Empty string</i>
7504
+ * @private
7505
+ */
7506
+ "_sRowStripe": ""
7507
+ };
7508
+
7509
+
7510
+
7511
+ /**
7512
+ * Template object for the column information object in DataTables. This object
7513
+ * is held in the settings aoColumns array and contains all the information that
7514
+ * DataTables needs about each individual column.
7515
+ *
7516
+ * Note that this object is related to {@link DataTable.defaults.columns}
7517
+ * but this one is the internal data store for DataTables's cache of columns.
7518
+ * It should NOT be manipulated outside of DataTables. Any configuration should
7519
+ * be done through the initialisation options.
7520
+ * @namespace
7521
+ */
7522
+ DataTable.models.oColumn = {
7523
+ /**
7524
+ * A list of the columns that sorting should occur on when this column
7525
+ * is sorted. That this property is an array allows multi-column sorting
7526
+ * to be defined for a column (for example first name / last name columns
7527
+ * would benefit from this). The values are integers pointing to the
7528
+ * columns to be sorted on (typically it will be a single integer pointing
7529
+ * at itself, but that doesn't need to be the case).
7530
+ * @type array
7531
+ */
7532
+ "aDataSort": null,
7533
+
7534
+ /**
7535
+ * Define the sorting directions that are applied to the column, in sequence
7536
+ * as the column is repeatedly sorted upon - i.e. the first value is used
7537
+ * as the sorting direction when the column if first sorted (clicked on).
7538
+ * Sort it again (click again) and it will move on to the next index.
7539
+ * Repeat until loop.
7540
+ * @type array
7541
+ */
7542
+ "asSorting": null,
7543
+
7544
+ /**
7545
+ * Flag to indicate if the column is searchable, and thus should be included
7546
+ * in the filtering or not.
7547
+ * @type boolean
7548
+ */
7549
+ "bSearchable": null,
7550
+
7551
+ /**
7552
+ * Flag to indicate if the column is sortable or not.
7553
+ * @type boolean
7554
+ */
7555
+ "bSortable": null,
7556
+
7557
+ /**
7558
+ * When using fnRender, you have two options for what to do with the data,
7559
+ * and this property serves as the switch. Firstly, you can have the sorting
7560
+ * and filtering use the rendered value (true - default), or you can have
7561
+ * the sorting and filtering us the original value (false).
7562
+ *
7563
+ * *NOTE* It is it is advisable now to use mData as a function and make
7564
+ * use of the 'type' that it gives, allowing (potentially) different data to
7565
+ * be used for sorting, filtering, display and type detection.
7566
+ * @type boolean
7567
+ * @deprecated
7568
+ */
7569
+ "bUseRendered": null,
7570
+
7571
+ /**
7572
+ * Flag to indicate if the column is currently visible in the table or not
7573
+ * @type boolean
7574
+ */
7575
+ "bVisible": null,
7576
+
7577
+ /**
7578
+ * Flag to indicate to the type detection method if the automatic type
7579
+ * detection should be used, or if a column type (sType) has been specified
7580
+ * @type boolean
7581
+ * @default true
7582
+ * @private
7583
+ */
7584
+ "_bAutoType": true,
7585
+
7586
+ /**
7587
+ * Developer definable function that is called whenever a cell is created (Ajax source,
7588
+ * etc) or processed for input (DOM source). This can be used as a compliment to fnRender
7589
+ * allowing you to modify the DOM element (add background colour for example) when the
7590
+ * element is available (since it is not when fnRender is called).
7591
+ * @type function
7592
+ * @param {element} nTd The TD node that has been created
7593
+ * @param {*} sData The Data for the cell
7594
+ * @param {array|object} oData The data for the whole row
7595
+ * @param {int} iRow The row index for the aoData data store
7596
+ * @default null
7597
+ */
7598
+ "fnCreatedCell": null,
7599
+
7600
+ /**
7601
+ * Function to get data from a cell in a column. You should <b>never</b>
7602
+ * access data directly through _aData internally in DataTables - always use
7603
+ * the method attached to this property. It allows mData to function as
7604
+ * required. This function is automatically assigned by the column
7605
+ * initialisation method
7606
+ * @type function
7607
+ * @param {array|object} oData The data array/object for the array
7608
+ * (i.e. aoData[]._aData)
7609
+ * @param {string} sSpecific The specific data type you want to get -
7610
+ * 'display', 'type' 'filter' 'sort'
7611
+ * @returns {*} The data for the cell from the given row's data
7612
+ * @default null
7613
+ */
7614
+ "fnGetData": null,
7615
+
7616
+ /**
7617
+ * Custom display function that will be called for the display of each cell
7618
+ * in this column.
7619
+ * @type function
7620
+ * @param {object} o Object with the following parameters:
7621
+ * @param {int} o.iDataRow The row in aoData
7622
+ * @param {int} o.iDataColumn The column in question
7623
+ * @param {array} o.aData The data for the row in question
7624
+ * @param {object} o.oSettings The settings object for this DataTables instance
7625
+ * @returns {string} The string you which to use in the display
7626
+ * @default null
7627
+ */
7628
+ "fnRender": null,
7629
+
7630
+ /**
7631
+ * Function to set data for a cell in the column. You should <b>never</b>
7632
+ * set the data directly to _aData internally in DataTables - always use
7633
+ * this method. It allows mData to function as required. This function
7634
+ * is automatically assigned by the column initialisation method
7635
+ * @type function
7636
+ * @param {array|object} oData The data array/object for the array
7637
+ * (i.e. aoData[]._aData)
7638
+ * @param {*} sValue Value to set
7639
+ * @default null
7640
+ */
7641
+ "fnSetData": null,
7642
+
7643
+ /**
7644
+ * Property to read the value for the cells in the column from the data
7645
+ * source array / object. If null, then the default content is used, if a
7646
+ * function is given then the return from the function is used.
7647
+ * @type function|int|string|null
7648
+ * @default null
7649
+ */
7650
+ "mData": null,
7651
+
7652
+ /**
7653
+ * Partner property to mData which is used (only when defined) to get
7654
+ * the data - i.e. it is basically the same as mData, but without the
7655
+ * 'set' option, and also the data fed to it is the result from mData.
7656
+ * This is the rendering method to match the data method of mData.
7657
+ * @type function|int|string|null
7658
+ * @default null
7659
+ */
7660
+ "mRender": null,
7661
+
7662
+ /**
7663
+ * Unique header TH/TD element for this column - this is what the sorting
7664
+ * listener is attached to (if sorting is enabled.)
7665
+ * @type node
7666
+ * @default null
7667
+ */
7668
+ "nTh": null,
7669
+
7670
+ /**
7671
+ * Unique footer TH/TD element for this column (if there is one). Not used
7672
+ * in DataTables as such, but can be used for plug-ins to reference the
7673
+ * footer for each column.
7674
+ * @type node
7675
+ * @default null
7676
+ */
7677
+ "nTf": null,
7678
+
7679
+ /**
7680
+ * The class to apply to all TD elements in the table's TBODY for the column
7681
+ * @type string
7682
+ * @default null
7683
+ */
7684
+ "sClass": null,
7685
+
7686
+ /**
7687
+ * When DataTables calculates the column widths to assign to each column,
7688
+ * it finds the longest string in each column and then constructs a
7689
+ * temporary table and reads the widths from that. The problem with this
7690
+ * is that "mmm" is much wider then "iiii", but the latter is a longer
7691
+ * string - thus the calculation can go wrong (doing it properly and putting
7692
+ * it into an DOM object and measuring that is horribly(!) slow). Thus as
7693
+ * a "work around" we provide this option. It will append its value to the
7694
+ * text that is found to be the longest string for the column - i.e. padding.
7695
+ * @type string
7696
+ */
7697
+ "sContentPadding": null,
7698
+
7699
+ /**
7700
+ * Allows a default value to be given for a column's data, and will be used
7701
+ * whenever a null data source is encountered (this can be because mData
7702
+ * is set to null, or because the data source itself is null).
7703
+ * @type string
7704
+ * @default null
7705
+ */
7706
+ "sDefaultContent": null,
7707
+
7708
+ /**
7709
+ * Name for the column, allowing reference to the column by name as well as
7710
+ * by index (needs a lookup to work by name).
7711
+ * @type string
7712
+ */
7713
+ "sName": null,
7714
+
7715
+ /**
7716
+ * Custom sorting data type - defines which of the available plug-ins in
7717
+ * afnSortData the custom sorting will use - if any is defined.
7718
+ * @type string
7719
+ * @default std
7720
+ */
7721
+ "sSortDataType": 'std',
7722
+
7723
+ /**
7724
+ * Class to be applied to the header element when sorting on this column
7725
+ * @type string
7726
+ * @default null
7727
+ */
7728
+ "sSortingClass": null,
7729
+
7730
+ /**
7731
+ * Class to be applied to the header element when sorting on this column -
7732
+ * when jQuery UI theming is used.
7733
+ * @type string
7734
+ * @default null
7735
+ */
7736
+ "sSortingClassJUI": null,
7737
+
7738
+ /**
7739
+ * Title of the column - what is seen in the TH element (nTh).
7740
+ * @type string
7741
+ */
7742
+ "sTitle": null,
7743
+
7744
+ /**
7745
+ * Column sorting and filtering type
7746
+ * @type string
7747
+ * @default null
7748
+ */
7749
+ "sType": null,
7750
+
7751
+ /**
7752
+ * Width of the column
7753
+ * @type string
7754
+ * @default null
7755
+ */
7756
+ "sWidth": null,
7757
+
7758
+ /**
7759
+ * Width of the column when it was first "encountered"
7760
+ * @type string
7761
+ * @default null
7762
+ */
7763
+ "sWidthOrig": null
7764
+ };
7765
+
7766
+
7767
+
7768
+ /**
7769
+ * Initialisation options that can be given to DataTables at initialisation
7770
+ * time.
7771
+ * @namespace
7772
+ */
7773
+ DataTable.defaults = {
7774
+ /**
7775
+ * An array of data to use for the table, passed in at initialisation which
7776
+ * will be used in preference to any data which is already in the DOM. This is
7777
+ * particularly useful for constructing tables purely in Javascript, for
7778
+ * example with a custom Ajax call.
7779
+ * @type array
7780
+ * @default null
7781
+ * @dtopt Option
7782
+ *
7783
+ * @example
7784
+ * // Using a 2D array data source
7785
+ * $(document).ready( function () {
7786
+ * $('#example').dataTable( {
7787
+ * "aaData": [
7788
+ * ['Trident', 'Internet Explorer 4.0', 'Win 95+', 4, 'X'],
7789
+ * ['Trident', 'Internet Explorer 5.0', 'Win 95+', 5, 'C'],
7790
+ * ],
7791
+ * "aoColumns": [
7792
+ * { "sTitle": "Engine" },
7793
+ * { "sTitle": "Browser" },
7794
+ * { "sTitle": "Platform" },
7795
+ * { "sTitle": "Version" },
7796
+ * { "sTitle": "Grade" }
7797
+ * ]
7798
+ * } );
7799
+ * } );
7800
+ *
7801
+ * @example
7802
+ * // Using an array of objects as a data source (mData)
7803
+ * $(document).ready( function () {
7804
+ * $('#example').dataTable( {
7805
+ * "aaData": [
7806
+ * {
7807
+ * "engine": "Trident",
7808
+ * "browser": "Internet Explorer 4.0",
7809
+ * "platform": "Win 95+",
7810
+ * "version": 4,
7811
+ * "grade": "X"
7812
+ * },
7813
+ * {
7814
+ * "engine": "Trident",
7815
+ * "browser": "Internet Explorer 5.0",
7816
+ * "platform": "Win 95+",
7817
+ * "version": 5,
7818
+ * "grade": "C"
7819
+ * }
7820
+ * ],
7821
+ * "aoColumns": [
7822
+ * { "sTitle": "Engine", "mData": "engine" },
7823
+ * { "sTitle": "Browser", "mData": "browser" },
7824
+ * { "sTitle": "Platform", "mData": "platform" },
7825
+ * { "sTitle": "Version", "mData": "version" },
7826
+ * { "sTitle": "Grade", "mData": "grade" }
7827
+ * ]
7828
+ * } );
7829
+ * } );
7830
+ */
7831
+ "aaData": null,
7832
+
7833
+
7834
+ /**
7835
+ * If sorting is enabled, then DataTables will perform a first pass sort on
7836
+ * initialisation. You can define which column(s) the sort is performed upon,
7837
+ * and the sorting direction, with this variable. The aaSorting array should
7838
+ * contain an array for each column to be sorted initially containing the
7839
+ * column's index and a direction string ('asc' or 'desc').
7840
+ * @type array
7841
+ * @default [[0,'asc']]
7842
+ * @dtopt Option
7843
+ *
7844
+ * @example
7845
+ * // Sort by 3rd column first, and then 4th column
7846
+ * $(document).ready( function() {
7847
+ * $('#example').dataTable( {
7848
+ * "aaSorting": [[2,'asc'], [3,'desc']]
7849
+ * } );
7850
+ * } );
7851
+ *
7852
+ * // No initial sorting
7853
+ * $(document).ready( function() {
7854
+ * $('#example').dataTable( {
7855
+ * "aaSorting": []
7856
+ * } );
7857
+ * } );
7858
+ */
7859
+ "aaSorting": [[0,'asc']],
7860
+
7861
+
7862
+ /**
7863
+ * This parameter is basically identical to the aaSorting parameter, but
7864
+ * cannot be overridden by user interaction with the table. What this means
7865
+ * is that you could have a column (visible or hidden) which the sorting will
7866
+ * always be forced on first - any sorting after that (from the user) will
7867
+ * then be performed as required. This can be useful for grouping rows
7868
+ * together.
7869
+ * @type array
7870
+ * @default null
7871
+ * @dtopt Option
7872
+ *
7873
+ * @example
7874
+ * $(document).ready( function() {
7875
+ * $('#example').dataTable( {
7876
+ * "aaSortingFixed": [[0,'asc']]
7877
+ * } );
7878
+ * } )
7879
+ */
7880
+ "aaSortingFixed": null,
7881
+
7882
+
7883
+ /**
7884
+ * This parameter allows you to readily specify the entries in the length drop
7885
+ * down menu that DataTables shows when pagination is enabled. It can be
7886
+ * either a 1D array of options which will be used for both the displayed
7887
+ * option and the value, or a 2D array which will use the array in the first
7888
+ * position as the value, and the array in the second position as the
7889
+ * displayed options (useful for language strings such as 'All').
7890
+ * @type array
7891
+ * @default [ 10, 25, 50, 100 ]
7892
+ * @dtopt Option
7893
+ *
7894
+ * @example
7895
+ * $(document).ready( function() {
7896
+ * $('#example').dataTable( {
7897
+ * "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
7898
+ * } );
7899
+ * } );
7900
+ *
7901
+ * @example
7902
+ * // Setting the default display length as well as length menu
7903
+ * // This is likely to be wanted if you remove the '10' option which
7904
+ * // is the iDisplayLength default.
7905
+ * $(document).ready( function() {
7906
+ * $('#example').dataTable( {
7907
+ * "iDisplayLength": 25,
7908
+ * "aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]]
7909
+ * } );
7910
+ * } );
7911
+ */
7912
+ "aLengthMenu": [ 10, 25, 50, 100 ],
7913
+
7914
+
7915
+ /**
7916
+ * The aoColumns option in the initialisation parameter allows you to define
7917
+ * details about the way individual columns behave. For a full list of
7918
+ * column options that can be set, please see
7919
+ * {@link DataTable.defaults.columns}. Note that if you use aoColumns to
7920
+ * define your columns, you must have an entry in the array for every single
7921
+ * column that you have in your table (these can be null if you don't which
7922
+ * to specify any options).
7923
+ * @member
7924
+ */
7925
+ "aoColumns": null,
7926
+
7927
+ /**
7928
+ * Very similar to aoColumns, aoColumnDefs allows you to target a specific
7929
+ * column, multiple columns, or all columns, using the aTargets property of
7930
+ * each object in the array. This allows great flexibility when creating
7931
+ * tables, as the aoColumnDefs arrays can be of any length, targeting the
7932
+ * columns you specifically want. aoColumnDefs may use any of the column
7933
+ * options available: {@link DataTable.defaults.columns}, but it _must_
7934
+ * have aTargets defined in each object in the array. Values in the aTargets
7935
+ * array may be:
7936
+ * <ul>
7937
+ * <li>a string - class name will be matched on the TH for the column</li>
7938
+ * <li>0 or a positive integer - column index counting from the left</li>
7939
+ * <li>a negative integer - column index counting from the right</li>
7940
+ * <li>the string "_all" - all columns (i.e. assign a default)</li>
7941
+ * </ul>
7942
+ * @member
7943
+ */
7944
+ "aoColumnDefs": null,
7945
+
7946
+
7947
+ /**
7948
+ * Basically the same as oSearch, this parameter defines the individual column
7949
+ * filtering state at initialisation time. The array must be of the same size
7950
+ * as the number of columns, and each element be an object with the parameters
7951
+ * "sSearch" and "bEscapeRegex" (the latter is optional). 'null' is also
7952
+ * accepted and the default will be used.
7953
+ * @type array
7954
+ * @default []
7955
+ * @dtopt Option
7956
+ *
7957
+ * @example
7958
+ * $(document).ready( function() {
7959
+ * $('#example').dataTable( {
7960
+ * "aoSearchCols": [
7961
+ * null,
7962
+ * { "sSearch": "My filter" },
7963
+ * null,
7964
+ * { "sSearch": "^[0-9]", "bEscapeRegex": false }
7965
+ * ]
7966
+ * } );
7967
+ * } )
7968
+ */
7969
+ "aoSearchCols": [],
7970
+
7971
+
7972
+ /**
7973
+ * An array of CSS classes that should be applied to displayed rows. This
7974
+ * array may be of any length, and DataTables will apply each class
7975
+ * sequentially, looping when required.
7976
+ * @type array
7977
+ * @default null <i>Will take the values determined by the oClasses.sStripe*
7978
+ * options</i>
7979
+ * @dtopt Option
7980
+ *
7981
+ * @example
7982
+ * $(document).ready( function() {
7983
+ * $('#example').dataTable( {
7984
+ * "asStripeClasses": [ 'strip1', 'strip2', 'strip3' ]
7985
+ * } );
7986
+ * } )
7987
+ */
7988
+ "asStripeClasses": null,
7989
+
7990
+
7991
+ /**
7992
+ * Enable or disable automatic column width calculation. This can be disabled
7993
+ * as an optimisation (it takes some time to calculate the widths) if the
7994
+ * tables widths are passed in using aoColumns.
7995
+ * @type boolean
7996
+ * @default true
7997
+ * @dtopt Features
7998
+ *
7999
+ * @example
8000
+ * $(document).ready( function () {
8001
+ * $('#example').dataTable( {
8002
+ * "bAutoWidth": false
8003
+ * } );
8004
+ * } );
8005
+ */
8006
+ "bAutoWidth": true,
8007
+
8008
+
8009
+ /**
8010
+ * Deferred rendering can provide DataTables with a huge speed boost when you
8011
+ * are using an Ajax or JS data source for the table. This option, when set to
8012
+ * true, will cause DataTables to defer the creation of the table elements for
8013
+ * each row until they are needed for a draw - saving a significant amount of
8014
+ * time.
8015
+ * @type boolean
8016
+ * @default false
8017
+ * @dtopt Features
8018
+ *
8019
+ * @example
8020
+ * $(document).ready( function() {
8021
+ * var oTable = $('#example').dataTable( {
8022
+ * "sAjaxSource": "sources/arrays.txt",
8023
+ * "bDeferRender": true
8024
+ * } );
8025
+ * } );
8026
+ */
8027
+ "bDeferRender": false,
8028
+
8029
+
8030
+ /**
8031
+ * Replace a DataTable which matches the given selector and replace it with
8032
+ * one which has the properties of the new initialisation object passed. If no
8033
+ * table matches the selector, then the new DataTable will be constructed as
8034
+ * per normal.
8035
+ * @type boolean
8036
+ * @default false
8037
+ * @dtopt Options
8038
+ *
8039
+ * @example
8040
+ * $(document).ready( function() {
8041
+ * $('#example').dataTable( {
8042
+ * "sScrollY": "200px",
8043
+ * "bPaginate": false
8044
+ * } );
8045
+ *
8046
+ * // Some time later....
8047
+ * $('#example').dataTable( {
8048
+ * "bFilter": false,
8049
+ * "bDestroy": true
8050
+ * } );
8051
+ * } );
8052
+ */
8053
+ "bDestroy": false,
8054
+
8055
+
8056
+ /**
8057
+ * Enable or disable filtering of data. Filtering in DataTables is "smart" in
8058
+ * that it allows the end user to input multiple words (space separated) and
8059
+ * will match a row containing those words, even if not in the order that was
8060
+ * specified (this allow matching across multiple columns). Note that if you
8061
+ * wish to use filtering in DataTables this must remain 'true' - to remove the
8062
+ * default filtering input box and retain filtering abilities, please use
8063
+ * {@link DataTable.defaults.sDom}.
8064
+ * @type boolean
8065
+ * @default true
8066
+ * @dtopt Features
8067
+ *
8068
+ * @example
8069
+ * $(document).ready( function () {
8070
+ * $('#example').dataTable( {
8071
+ * "bFilter": false
8072
+ * } );
8073
+ * } );
8074
+ */
8075
+ "bFilter": true,
8076
+
8077
+
8078
+ /**
8079
+ * Enable or disable the table information display. This shows information
8080
+ * about the data that is currently visible on the page, including information
8081
+ * about filtered data if that action is being performed.
8082
+ * @type boolean
8083
+ * @default true
8084
+ * @dtopt Features
8085
+ *
8086
+ * @example
8087
+ * $(document).ready( function () {
8088
+ * $('#example').dataTable( {
8089
+ * "bInfo": false
8090
+ * } );
8091
+ * } );
8092
+ */
8093
+ "bInfo": true,
8094
+
8095
+
8096
+ /**
8097
+ * Enable jQuery UI ThemeRoller support (required as ThemeRoller requires some
8098
+ * slightly different and additional mark-up from what DataTables has
8099
+ * traditionally used).
8100
+ * @type boolean
8101
+ * @default false
8102
+ * @dtopt Features
8103
+ *
8104
+ * @example
8105
+ * $(document).ready( function() {
8106
+ * $('#example').dataTable( {
8107
+ * "bJQueryUI": true
8108
+ * } );
8109
+ * } );
8110
+ */
8111
+ "bJQueryUI": false,
8112
+
8113
+
8114
+ /**
8115
+ * Allows the end user to select the size of a formatted page from a select
8116
+ * menu (sizes are 10, 25, 50 and 100). Requires pagination (bPaginate).
8117
+ * @type boolean
8118
+ * @default true
8119
+ * @dtopt Features
8120
+ *
8121
+ * @example
8122
+ * $(document).ready( function () {
8123
+ * $('#example').dataTable( {
8124
+ * "bLengthChange": false
8125
+ * } );
8126
+ * } );
8127
+ */
8128
+ "bLengthChange": true,
8129
+
8130
+
8131
+ /**
8132
+ * Enable or disable pagination.
8133
+ * @type boolean
8134
+ * @default true
8135
+ * @dtopt Features
8136
+ *
8137
+ * @example
8138
+ * $(document).ready( function () {
8139
+ * $('#example').dataTable( {
8140
+ * "bPaginate": false
8141
+ * } );
8142
+ * } );
8143
+ */
8144
+ "bPaginate": true,
8145
+
8146
+
8147
+ /**
8148
+ * Enable or disable the display of a 'processing' indicator when the table is
8149
+ * being processed (e.g. a sort). This is particularly useful for tables with
8150
+ * large amounts of data where it can take a noticeable amount of time to sort
8151
+ * the entries.
8152
+ * @type boolean
8153
+ * @default false
8154
+ * @dtopt Features
8155
+ *
8156
+ * @example
8157
+ * $(document).ready( function () {
8158
+ * $('#example').dataTable( {
8159
+ * "bProcessing": true
8160
+ * } );
8161
+ * } );
8162
+ */
8163
+ "bProcessing": false,
8164
+
8165
+
8166
+ /**
8167
+ * Retrieve the DataTables object for the given selector. Note that if the
8168
+ * table has already been initialised, this parameter will cause DataTables
8169
+ * to simply return the object that has already been set up - it will not take
8170
+ * account of any changes you might have made to the initialisation object
8171
+ * passed to DataTables (setting this parameter to true is an acknowledgement
8172
+ * that you understand this). bDestroy can be used to reinitialise a table if
8173
+ * you need.
8174
+ * @type boolean
8175
+ * @default false
8176
+ * @dtopt Options
8177
+ *
8178
+ * @example
8179
+ * $(document).ready( function() {
8180
+ * initTable();
8181
+ * tableActions();
8182
+ * } );
8183
+ *
8184
+ * function initTable ()
8185
+ * {
8186
+ * return $('#example').dataTable( {
8187
+ * "sScrollY": "200px",
8188
+ * "bPaginate": false,
8189
+ * "bRetrieve": true
8190
+ * } );
8191
+ * }
8192
+ *
8193
+ * function tableActions ()
8194
+ * {
8195
+ * var oTable = initTable();
8196
+ * // perform API operations with oTable
8197
+ * }
8198
+ */
8199
+ "bRetrieve": false,
8200
+
8201
+
8202
+ /**
8203
+ * Indicate if DataTables should be allowed to set the padding / margin
8204
+ * etc for the scrolling header elements or not. Typically you will want
8205
+ * this.
8206
+ * @type boolean
8207
+ * @default true
8208
+ * @dtopt Options
8209
+ *
8210
+ * @example
8211
+ * $(document).ready( function() {
8212
+ * $('#example').dataTable( {
8213
+ * "bScrollAutoCss": false,
8214
+ * "sScrollY": "200px"
8215
+ * } );
8216
+ * } );
8217
+ */
8218
+ "bScrollAutoCss": true,
8219
+
8220
+
8221
+ /**
8222
+ * When vertical (y) scrolling is enabled, DataTables will force the height of
8223
+ * the table's viewport to the given height at all times (useful for layout).
8224
+ * However, this can look odd when filtering data down to a small data set,
8225
+ * and the footer is left "floating" further down. This parameter (when
8226
+ * enabled) will cause DataTables to collapse the table's viewport down when
8227
+ * the result set will fit within the given Y height.
8228
+ * @type boolean
8229
+ * @default false
8230
+ * @dtopt Options
8231
+ *
8232
+ * @example
8233
+ * $(document).ready( function() {
8234
+ * $('#example').dataTable( {
8235
+ * "sScrollY": "200",
8236
+ * "bScrollCollapse": true
8237
+ * } );
8238
+ * } );
8239
+ */
8240
+ "bScrollCollapse": false,
8241
+
8242
+
8243
+ /**
8244
+ * Enable infinite scrolling for DataTables (to be used in combination with
8245
+ * sScrollY). Infinite scrolling means that DataTables will continually load
8246
+ * data as a user scrolls through a table, which is very useful for large
8247
+ * dataset. This cannot be used with pagination, which is automatically
8248
+ * disabled. Note - the Scroller extra for DataTables is recommended in
8249
+ * in preference to this option.
8250
+ * @type boolean
8251
+ * @default false
8252
+ * @dtopt Features
8253
+ *
8254
+ * @example
8255
+ * $(document).ready( function() {
8256
+ * $('#example').dataTable( {
8257
+ * "bScrollInfinite": true,
8258
+ * "bScrollCollapse": true,
8259
+ * "sScrollY": "200px"
8260
+ * } );
8261
+ * } );
8262
+ */
8263
+ "bScrollInfinite": false,
8264
+
8265
+
8266
+ /**
8267
+ * Configure DataTables to use server-side processing. Note that the
8268
+ * sAjaxSource parameter must also be given in order to give DataTables a
8269
+ * source to obtain the required data for each draw.
8270
+ * @type boolean
8271
+ * @default false
8272
+ * @dtopt Features
8273
+ * @dtopt Server-side
8274
+ *
8275
+ * @example
8276
+ * $(document).ready( function () {
8277
+ * $('#example').dataTable( {
8278
+ * "bServerSide": true,
8279
+ * "sAjaxSource": "xhr.php"
8280
+ * } );
8281
+ * } );
8282
+ */
8283
+ "bServerSide": false,
8284
+
8285
+
8286
+ /**
8287
+ * Enable or disable sorting of columns. Sorting of individual columns can be
8288
+ * disabled by the "bSortable" option for each column.
8289
+ * @type boolean
8290
+ * @default true
8291
+ * @dtopt Features
8292
+ *
8293
+ * @example
8294
+ * $(document).ready( function () {
8295
+ * $('#example').dataTable( {
8296
+ * "bSort": false
8297
+ * } );
8298
+ * } );
8299
+ */
8300
+ "bSort": true,
8301
+
8302
+
8303
+ /**
8304
+ * Allows control over whether DataTables should use the top (true) unique
8305
+ * cell that is found for a single column, or the bottom (false - default).
8306
+ * This is useful when using complex headers.
8307
+ * @type boolean
8308
+ * @default false
8309
+ * @dtopt Options
8310
+ *
8311
+ * @example
8312
+ * $(document).ready( function() {
8313
+ * $('#example').dataTable( {
8314
+ * "bSortCellsTop": true
8315
+ * } );
8316
+ * } );
8317
+ */
8318
+ "bSortCellsTop": false,
8319
+
8320
+
8321
+ /**
8322
+ * Enable or disable the addition of the classes 'sorting_1', 'sorting_2' and
8323
+ * 'sorting_3' to the columns which are currently being sorted on. This is
8324
+ * presented as a feature switch as it can increase processing time (while
8325
+ * classes are removed and added) so for large data sets you might want to
8326
+ * turn this off.
8327
+ * @type boolean
8328
+ * @default true
8329
+ * @dtopt Features
8330
+ *
8331
+ * @example
8332
+ * $(document).ready( function () {
8333
+ * $('#example').dataTable( {
8334
+ * "bSortClasses": false
8335
+ * } );
8336
+ * } );
8337
+ */
8338
+ "bSortClasses": true,
8339
+
8340
+
8341
+ /**
8342
+ * Enable or disable state saving. When enabled a cookie will be used to save
8343
+ * table display information such as pagination information, display length,
8344
+ * filtering and sorting. As such when the end user reloads the page the
8345
+ * display display will match what thy had previously set up.
8346
+ * @type boolean
8347
+ * @default false
8348
+ * @dtopt Features
8349
+ *
8350
+ * @example
8351
+ * $(document).ready( function () {
8352
+ * $('#example').dataTable( {
8353
+ * "bStateSave": true
8354
+ * } );
8355
+ * } );
8356
+ */
8357
+ "bStateSave": false,
8358
+
8359
+
8360
+ /**
8361
+ * Customise the cookie and / or the parameters being stored when using
8362
+ * DataTables with state saving enabled. This function is called whenever
8363
+ * the cookie is modified, and it expects a fully formed cookie string to be
8364
+ * returned. Note that the data object passed in is a Javascript object which
8365
+ * must be converted to a string (JSON.stringify for example).
8366
+ * @type function
8367
+ * @param {string} sName Name of the cookie defined by DataTables
8368
+ * @param {object} oData Data to be stored in the cookie
8369
+ * @param {string} sExpires Cookie expires string
8370
+ * @param {string} sPath Path of the cookie to set
8371
+ * @returns {string} Cookie formatted string (which should be encoded by
8372
+ * using encodeURIComponent())
8373
+ * @dtopt Callbacks
8374
+ *
8375
+ * @example
8376
+ * $(document).ready( function () {
8377
+ * $('#example').dataTable( {
8378
+ * "fnCookieCallback": function (sName, oData, sExpires, sPath) {
8379
+ * // Customise oData or sName or whatever else here
8380
+ * return sName + "="+JSON.stringify(oData)+"; expires=" + sExpires +"; path=" + sPath;
8381
+ * }
8382
+ * } );
8383
+ * } );
8384
+ */
8385
+ "fnCookieCallback": null,
8386
+
8387
+
8388
+ /**
8389
+ * This function is called when a TR element is created (and all TD child
8390
+ * elements have been inserted), or registered if using a DOM source, allowing
8391
+ * manipulation of the TR element (adding classes etc).
8392
+ * @type function
8393
+ * @param {node} nRow "TR" element for the current row
8394
+ * @param {array} aData Raw data array for this row
8395
+ * @param {int} iDataIndex The index of this row in aoData
8396
+ * @dtopt Callbacks
8397
+ *
8398
+ * @example
8399
+ * $(document).ready( function() {
8400
+ * $('#example').dataTable( {
8401
+ * "fnCreatedRow": function( nRow, aData, iDataIndex ) {
8402
+ * // Bold the grade for all 'A' grade browsers
8403
+ * if ( aData[4] == "A" )
8404
+ * {
8405
+ * $('td:eq(4)', nRow).html( '<b>A</b>' );
8406
+ * }
8407
+ * }
8408
+ * } );
8409
+ * } );
8410
+ */
8411
+ "fnCreatedRow": null,
8412
+
8413
+
8414
+ /**
8415
+ * This function is called on every 'draw' event, and allows you to
8416
+ * dynamically modify any aspect you want about the created DOM.
8417
+ * @type function
8418
+ * @param {object} oSettings DataTables settings object
8419
+ * @dtopt Callbacks
8420
+ *
8421
+ * @example
8422
+ * $(document).ready( function() {
8423
+ * $('#example').dataTable( {
8424
+ * "fnDrawCallback": function( oSettings ) {
8425
+ * alert( 'DataTables has redrawn the table' );
8426
+ * }
8427
+ * } );
8428
+ * } );
8429
+ */
8430
+ "fnDrawCallback": null,
8431
+
8432
+
8433
+ /**
8434
+ * Identical to fnHeaderCallback() but for the table footer this function
8435
+ * allows you to modify the table footer on every 'draw' even.
8436
+ * @type function
8437
+ * @param {node} nFoot "TR" element for the footer
8438
+ * @param {array} aData Full table data (as derived from the original HTML)
8439
+ * @param {int} iStart Index for the current display starting point in the
8440
+ * display array
8441
+ * @param {int} iEnd Index for the current display ending point in the
8442
+ * display array
8443
+ * @param {array int} aiDisplay Index array to translate the visual position
8444
+ * to the full data array
8445
+ * @dtopt Callbacks
8446
+ *
8447
+ * @example
8448
+ * $(document).ready( function() {
8449
+ * $('#example').dataTable( {
8450
+ * "fnFooterCallback": function( nFoot, aData, iStart, iEnd, aiDisplay ) {
8451
+ * nFoot.getElementsByTagName('th')[0].innerHTML = "Starting index is "+iStart;
8452
+ * }
8453
+ * } );
8454
+ * } )
8455
+ */
8456
+ "fnFooterCallback": null,
8457
+
8458
+
8459
+ /**
8460
+ * When rendering large numbers in the information element for the table
8461
+ * (i.e. "Showing 1 to 10 of 57 entries") DataTables will render large numbers
8462
+ * to have a comma separator for the 'thousands' units (e.g. 1 million is
8463
+ * rendered as "1,000,000") to help readability for the end user. This
8464
+ * function will override the default method DataTables uses.
8465
+ * @type function
8466
+ * @member
8467
+ * @param {int} iIn number to be formatted
8468
+ * @returns {string} formatted string for DataTables to show the number
8469
+ * @dtopt Callbacks
8470
+ *
8471
+ * @example
8472
+ * $(document).ready( function() {
8473
+ * $('#example').dataTable( {
8474
+ * "fnFormatNumber": function ( iIn ) {
8475
+ * if ( iIn &lt; 1000 ) {
8476
+ * return iIn;
8477
+ * } else {
8478
+ * var
8479
+ * s=(iIn+""),
8480
+ * a=s.split(""), out="",
8481
+ * iLen=s.length;
8482
+ *
8483
+ * for ( var i=0 ; i&lt;iLen ; i++ ) {
8484
+ * if ( i%3 === 0 &amp;&amp; i !== 0 ) {
8485
+ * out = "'"+out;
8486
+ * }
8487
+ * out = a[iLen-i-1]+out;
8488
+ * }
8489
+ * }
8490
+ * return out;
8491
+ * };
8492
+ * } );
8493
+ * } );
8494
+ */
8495
+ "fnFormatNumber": function ( iIn ) {
8496
+ if ( iIn < 1000 )
8497
+ {
8498
+ // A small optimisation for what is likely to be the majority of use cases
8499
+ return iIn;
8500
+ }
8501
+
8502
+ var s=(iIn+""), a=s.split(""), out="", iLen=s.length;
8503
+
8504
+ for ( var i=0 ; i<iLen ; i++ )
8505
+ {
8506
+ if ( i%3 === 0 && i !== 0 )
8507
+ {
8508
+ out = this.oLanguage.sInfoThousands+out;
8509
+ }
8510
+ out = a[iLen-i-1]+out;
8511
+ }
8512
+ return out;
8513
+ },
8514
+
8515
+
8516
+ /**
8517
+ * This function is called on every 'draw' event, and allows you to
8518
+ * dynamically modify the header row. This can be used to calculate and
8519
+ * display useful information about the table.
8520
+ * @type function
8521
+ * @param {node} nHead "TR" element for the header
8522
+ * @param {array} aData Full table data (as derived from the original HTML)
8523
+ * @param {int} iStart Index for the current display starting point in the
8524
+ * display array
8525
+ * @param {int} iEnd Index for the current display ending point in the
8526
+ * display array
8527
+ * @param {array int} aiDisplay Index array to translate the visual position
8528
+ * to the full data array
8529
+ * @dtopt Callbacks
8530
+ *
8531
+ * @example
8532
+ * $(document).ready( function() {
8533
+ * $('#example').dataTable( {
8534
+ * "fnHeaderCallback": function( nHead, aData, iStart, iEnd, aiDisplay ) {
8535
+ * nHead.getElementsByTagName('th')[0].innerHTML = "Displaying "+(iEnd-iStart)+" records";
8536
+ * }
8537
+ * } );
8538
+ * } )
8539
+ */
8540
+ "fnHeaderCallback": null,
8541
+
8542
+
8543
+ /**
8544
+ * The information element can be used to convey information about the current
8545
+ * state of the table. Although the internationalisation options presented by
8546
+ * DataTables are quite capable of dealing with most customisations, there may
8547
+ * be times where you wish to customise the string further. This callback
8548
+ * allows you to do exactly that.
8549
+ * @type function
8550
+ * @param {object} oSettings DataTables settings object
8551
+ * @param {int} iStart Starting position in data for the draw
8552
+ * @param {int} iEnd End position in data for the draw
8553
+ * @param {int} iMax Total number of rows in the table (regardless of
8554
+ * filtering)
8555
+ * @param {int} iTotal Total number of rows in the data set, after filtering
8556
+ * @param {string} sPre The string that DataTables has formatted using it's
8557
+ * own rules
8558
+ * @returns {string} The string to be displayed in the information element.
8559
+ * @dtopt Callbacks
8560
+ *
8561
+ * @example
8562
+ * $('#example').dataTable( {
8563
+ * "fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {
8564
+ * return iStart +" to "+ iEnd;
8565
+ * }
8566
+ * } );
8567
+ */
8568
+ "fnInfoCallback": null,
8569
+
8570
+
8571
+ /**
8572
+ * Called when the table has been initialised. Normally DataTables will
8573
+ * initialise sequentially and there will be no need for this function,
8574
+ * however, this does not hold true when using external language information
8575
+ * since that is obtained using an async XHR call.
8576
+ * @type function
8577
+ * @param {object} oSettings DataTables settings object
8578
+ * @param {object} json The JSON object request from the server - only
8579
+ * present if client-side Ajax sourced data is used
8580
+ * @dtopt Callbacks
8581
+ *
8582
+ * @example
8583
+ * $(document).ready( function() {
8584
+ * $('#example').dataTable( {
8585
+ * "fnInitComplete": function(oSettings, json) {
8586
+ * alert( 'DataTables has finished its initialisation.' );
8587
+ * }
8588
+ * } );
8589
+ * } )
8590
+ */
8591
+ "fnInitComplete": null,
8592
+
8593
+
8594
+ /**
8595
+ * Called at the very start of each table draw and can be used to cancel the
8596
+ * draw by returning false, any other return (including undefined) results in
8597
+ * the full draw occurring).
8598
+ * @type function
8599
+ * @param {object} oSettings DataTables settings object
8600
+ * @returns {boolean} False will cancel the draw, anything else (including no
8601
+ * return) will allow it to complete.
8602
+ * @dtopt Callbacks
8603
+ *
8604
+ * @example
8605
+ * $(document).ready( function() {
8606
+ * $('#example').dataTable( {
8607
+ * "fnPreDrawCallback": function( oSettings ) {
8608
+ * if ( $('#test').val() == 1 ) {
8609
+ * return false;
8610
+ * }
8611
+ * }
8612
+ * } );
8613
+ * } );
8614
+ */
8615
+ "fnPreDrawCallback": null,
8616
+
8617
+
8618
+ /**
8619
+ * This function allows you to 'post process' each row after it have been
8620
+ * generated for each table draw, but before it is rendered on screen. This
8621
+ * function might be used for setting the row class name etc.
8622
+ * @type function
8623
+ * @param {node} nRow "TR" element for the current row
8624
+ * @param {array} aData Raw data array for this row
8625
+ * @param {int} iDisplayIndex The display index for the current table draw
8626
+ * @param {int} iDisplayIndexFull The index of the data in the full list of
8627
+ * rows (after filtering)
8628
+ * @dtopt Callbacks
8629
+ *
8630
+ * @example
8631
+ * $(document).ready( function() {
8632
+ * $('#example').dataTable( {
8633
+ * "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
8634
+ * // Bold the grade for all 'A' grade browsers
8635
+ * if ( aData[4] == "A" )
8636
+ * {
8637
+ * $('td:eq(4)', nRow).html( '<b>A</b>' );
8638
+ * }
8639
+ * }
8640
+ * } );
8641
+ * } );
8642
+ */
8643
+ "fnRowCallback": null,
8644
+
8645
+
8646
+ /**
8647
+ * This parameter allows you to override the default function which obtains
8648
+ * the data from the server ($.getJSON) so something more suitable for your
8649
+ * application. For example you could use POST data, or pull information from
8650
+ * a Gears or AIR database.
8651
+ * @type function
8652
+ * @member
8653
+ * @param {string} sSource HTTP source to obtain the data from (sAjaxSource)
8654
+ * @param {array} aoData A key/value pair object containing the data to send
8655
+ * to the server
8656
+ * @param {function} fnCallback to be called on completion of the data get
8657
+ * process that will draw the data on the page.
8658
+ * @param {object} oSettings DataTables settings object
8659
+ * @dtopt Callbacks
8660
+ * @dtopt Server-side
8661
+ *
8662
+ * @example
8663
+ * // POST data to server
8664
+ * $(document).ready( function() {
8665
+ * $('#example').dataTable( {
8666
+ * "bProcessing": true,
8667
+ * "bServerSide": true,
8668
+ * "sAjaxSource": "xhr.php",
8669
+ * "fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
8670
+ * oSettings.jqXHR = $.ajax( {
8671
+ * "dataType": 'json',
8672
+ * "type": "POST",
8673
+ * "url": sSource,
8674
+ * "data": aoData,
8675
+ * "success": fnCallback
8676
+ * } );
8677
+ * }
8678
+ * } );
8679
+ * } );
8680
+ */
8681
+ "fnServerData": function ( sUrl, aoData, fnCallback, oSettings ) {
8682
+ oSettings.jqXHR = $.ajax( {
8683
+ "url": sUrl,
8684
+ "data": aoData,
8685
+ "success": function (json) {
8686
+ if ( json.sError ) {
8687
+ oSettings.oApi._fnLog( oSettings, 0, json.sError );
8688
+ }
8689
+
8690
+ $(oSettings.oInstance).trigger('xhr', [oSettings, json]);
8691
+ fnCallback( json );
8692
+ },
8693
+ "dataType": "json",
8694
+ "cache": false,
8695
+ "type": oSettings.sServerMethod,
8696
+ "error": function (xhr, error, thrown) {
8697
+ if ( error == "parsererror" ) {
8698
+ oSettings.oApi._fnLog( oSettings, 0, "DataTables warning: JSON data from "+
8699
+ "server could not be parsed. This is caused by a JSON formatting error." );
8700
+ }
8701
+ }
8702
+ } );
8703
+ },
8704
+
8705
+
8706
+ /**
8707
+ * It is often useful to send extra data to the server when making an Ajax
8708
+ * request - for example custom filtering information, and this callback
8709
+ * function makes it trivial to send extra information to the server. The
8710
+ * passed in parameter is the data set that has been constructed by
8711
+ * DataTables, and you can add to this or modify it as you require.
8712
+ * @type function
8713
+ * @param {array} aoData Data array (array of objects which are name/value
8714
+ * pairs) that has been constructed by DataTables and will be sent to the
8715
+ * server. In the case of Ajax sourced data with server-side processing
8716
+ * this will be an empty array, for server-side processing there will be a
8717
+ * significant number of parameters!
8718
+ * @returns {undefined} Ensure that you modify the aoData array passed in,
8719
+ * as this is passed by reference.
8720
+ * @dtopt Callbacks
8721
+ * @dtopt Server-side
8722
+ *
8723
+ * @example
8724
+ * $(document).ready( function() {
8725
+ * $('#example').dataTable( {
8726
+ * "bProcessing": true,
8727
+ * "bServerSide": true,
8728
+ * "sAjaxSource": "scripts/server_processing.php",
8729
+ * "fnServerParams": function ( aoData ) {
8730
+ * aoData.push( { "name": "more_data", "value": "my_value" } );
8731
+ * }
8732
+ * } );
8733
+ * } );
8734
+ */
8735
+ "fnServerParams": null,
8736
+
8737
+
8738
+ /**
8739
+ * Load the table state. With this function you can define from where, and how, the
8740
+ * state of a table is loaded. By default DataTables will load from its state saving
8741
+ * cookie, but you might wish to use local storage (HTML5) or a server-side database.
8742
+ * @type function
8743
+ * @member
8744
+ * @param {object} oSettings DataTables settings object
8745
+ * @return {object} The DataTables state object to be loaded
8746
+ * @dtopt Callbacks
8747
+ *
8748
+ * @example
8749
+ * $(document).ready( function() {
8750
+ * $('#example').dataTable( {
8751
+ * "bStateSave": true,
8752
+ * "fnStateLoad": function (oSettings) {
8753
+ * var o;
8754
+ *
8755
+ * // Send an Ajax request to the server to get the data. Note that
8756
+ * // this is a synchronous request.
8757
+ * $.ajax( {
8758
+ * "url": "/state_load",
8759
+ * "async": false,
8760
+ * "dataType": "json",
8761
+ * "success": function (json) {
8762
+ * o = json;
8763
+ * }
8764
+ * } );
8765
+ *
8766
+ * return o;
8767
+ * }
8768
+ * } );
8769
+ * } );
8770
+ */
8771
+ "fnStateLoad": function ( oSettings ) {
8772
+ var sData = this.oApi._fnReadCookie( oSettings.sCookiePrefix+oSettings.sInstance );
8773
+ var oData;
8774
+
8775
+ try {
8776
+ oData = (typeof $.parseJSON === 'function') ?
8777
+ $.parseJSON(sData) : eval( '('+sData+')' );
8778
+ } catch (e) {
8779
+ oData = null;
8780
+ }
8781
+
8782
+ return oData;
8783
+ },
8784
+
8785
+
8786
+ /**
8787
+ * Callback which allows modification of the saved state prior to loading that state.
8788
+ * This callback is called when the table is loading state from the stored data, but
8789
+ * prior to the settings object being modified by the saved state. Note that for
8790
+ * plug-in authors, you should use the 'stateLoadParams' event to load parameters for
8791
+ * a plug-in.
8792
+ * @type function
8793
+ * @param {object} oSettings DataTables settings object
8794
+ * @param {object} oData The state object that is to be loaded
8795
+ * @dtopt Callbacks
8796
+ *
8797
+ * @example
8798
+ * // Remove a saved filter, so filtering is never loaded
8799
+ * $(document).ready( function() {
8800
+ * $('#example').dataTable( {
8801
+ * "bStateSave": true,
8802
+ * "fnStateLoadParams": function (oSettings, oData) {
8803
+ * oData.oSearch.sSearch = "";
8804
+ * }
8805
+ * } );
8806
+ * } );
8807
+ *
8808
+ * @example
8809
+ * // Disallow state loading by returning false
8810
+ * $(document).ready( function() {
8811
+ * $('#example').dataTable( {
8812
+ * "bStateSave": true,
8813
+ * "fnStateLoadParams": function (oSettings, oData) {
8814
+ * return false;
8815
+ * }
8816
+ * } );
8817
+ * } );
8818
+ */
8819
+ "fnStateLoadParams": null,
8820
+
8821
+
8822
+ /**
8823
+ * Callback that is called when the state has been loaded from the state saving method
8824
+ * and the DataTables settings object has been modified as a result of the loaded state.
8825
+ * @type function
8826
+ * @param {object} oSettings DataTables settings object
8827
+ * @param {object} oData The state object that was loaded
8828
+ * @dtopt Callbacks
8829
+ *
8830
+ * @example
8831
+ * // Show an alert with the filtering value that was saved
8832
+ * $(document).ready( function() {
8833
+ * $('#example').dataTable( {
8834
+ * "bStateSave": true,
8835
+ * "fnStateLoaded": function (oSettings, oData) {
8836
+ * alert( 'Saved filter was: '+oData.oSearch.sSearch );
8837
+ * }
8838
+ * } );
8839
+ * } );
8840
+ */
8841
+ "fnStateLoaded": null,
8842
+
8843
+
8844
+ /**
8845
+ * Save the table state. This function allows you to define where and how the state
8846
+ * information for the table is stored - by default it will use a cookie, but you
8847
+ * might want to use local storage (HTML5) or a server-side database.
8848
+ * @type function
8849
+ * @member
8850
+ * @param {object} oSettings DataTables settings object
8851
+ * @param {object} oData The state object to be saved
8852
+ * @dtopt Callbacks
8853
+ *
8854
+ * @example
8855
+ * $(document).ready( function() {
8856
+ * $('#example').dataTable( {
8857
+ * "bStateSave": true,
8858
+ * "fnStateSave": function (oSettings, oData) {
8859
+ * // Send an Ajax request to the server with the state object
8860
+ * $.ajax( {
8861
+ * "url": "/state_save",
8862
+ * "data": oData,
8863
+ * "dataType": "json",
8864
+ * "method": "POST"
8865
+ * "success": function () {}
8866
+ * } );
8867
+ * }
8868
+ * } );
8869
+ * } );
8870
+ */
8871
+ "fnStateSave": function ( oSettings, oData ) {
8872
+ this.oApi._fnCreateCookie(
8873
+ oSettings.sCookiePrefix+oSettings.sInstance,
8874
+ this.oApi._fnJsonString(oData),
8875
+ oSettings.iCookieDuration,
8876
+ oSettings.sCookiePrefix,
8877
+ oSettings.fnCookieCallback
8878
+ );
8879
+ },
8880
+
8881
+
8882
+ /**
8883
+ * Callback which allows modification of the state to be saved. Called when the table
8884
+ * has changed state a new state save is required. This method allows modification of
8885
+ * the state saving object prior to actually doing the save, including addition or
8886
+ * other state properties or modification. Note that for plug-in authors, you should
8887
+ * use the 'stateSaveParams' event to save parameters for a plug-in.
8888
+ * @type function
8889
+ * @param {object} oSettings DataTables settings object
8890
+ * @param {object} oData The state object to be saved
8891
+ * @dtopt Callbacks
8892
+ *
8893
+ * @example
8894
+ * // Remove a saved filter, so filtering is never saved
8895
+ * $(document).ready( function() {
8896
+ * $('#example').dataTable( {
8897
+ * "bStateSave": true,
8898
+ * "fnStateSaveParams": function (oSettings, oData) {
8899
+ * oData.oSearch.sSearch = "";
8900
+ * }
8901
+ * } );
8902
+ * } );
8903
+ */
8904
+ "fnStateSaveParams": null,
8905
+
8906
+
8907
+ /**
8908
+ * Duration of the cookie which is used for storing session information. This
8909
+ * value is given in seconds.
8910
+ * @type int
8911
+ * @default 7200 <i>(2 hours)</i>
8912
+ * @dtopt Options
8913
+ *
8914
+ * @example
8915
+ * $(document).ready( function() {
8916
+ * $('#example').dataTable( {
8917
+ * "iCookieDuration": 60*60*24; // 1 day
8918
+ * } );
8919
+ * } )
8920
+ */
8921
+ "iCookieDuration": 7200,
8922
+
8923
+
8924
+ /**
8925
+ * When enabled DataTables will not make a request to the server for the first
8926
+ * page draw - rather it will use the data already on the page (no sorting etc
8927
+ * will be applied to it), thus saving on an XHR at load time. iDeferLoading
8928
+ * is used to indicate that deferred loading is required, but it is also used
8929
+ * to tell DataTables how many records there are in the full table (allowing
8930
+ * the information element and pagination to be displayed correctly). In the case
8931
+ * where a filtering is applied to the table on initial load, this can be
8932
+ * indicated by giving the parameter as an array, where the first element is
8933
+ * the number of records available after filtering and the second element is the
8934
+ * number of records without filtering (allowing the table information element
8935
+ * to be shown correctly).
8936
+ * @type int | array
8937
+ * @default null
8938
+ * @dtopt Options
8939
+ *
8940
+ * @example
8941
+ * // 57 records available in the table, no filtering applied
8942
+ * $(document).ready( function() {
8943
+ * $('#example').dataTable( {
8944
+ * "bServerSide": true,
8945
+ * "sAjaxSource": "scripts/server_processing.php",
8946
+ * "iDeferLoading": 57
8947
+ * } );
8948
+ * } );
8949
+ *
8950
+ * @example
8951
+ * // 57 records after filtering, 100 without filtering (an initial filter applied)
8952
+ * $(document).ready( function() {
8953
+ * $('#example').dataTable( {
8954
+ * "bServerSide": true,
8955
+ * "sAjaxSource": "scripts/server_processing.php",
8956
+ * "iDeferLoading": [ 57, 100 ],
8957
+ * "oSearch": {
8958
+ * "sSearch": "my_filter"
8959
+ * }
8960
+ * } );
8961
+ * } );
8962
+ */
8963
+ "iDeferLoading": null,
8964
+
8965
+
8966
+ /**
8967
+ * Number of rows to display on a single page when using pagination. If
8968
+ * feature enabled (bLengthChange) then the end user will be able to override
8969
+ * this to a custom setting using a pop-up menu.
8970
+ * @type int
8971
+ * @default 10
8972
+ * @dtopt Options
8973
+ *
8974
+ * @example
8975
+ * $(document).ready( function() {
8976
+ * $('#example').dataTable( {
8977
+ * "iDisplayLength": 50
8978
+ * } );
8979
+ * } )
8980
+ */
8981
+ "iDisplayLength": 10,
8982
+
8983
+
8984
+ /**
8985
+ * Define the starting point for data display when using DataTables with
8986
+ * pagination. Note that this parameter is the number of records, rather than
8987
+ * the page number, so if you have 10 records per page and want to start on
8988
+ * the third page, it should be "20".
8989
+ * @type int
8990
+ * @default 0
8991
+ * @dtopt Options
8992
+ *
8993
+ * @example
8994
+ * $(document).ready( function() {
8995
+ * $('#example').dataTable( {
8996
+ * "iDisplayStart": 20
8997
+ * } );
8998
+ * } )
8999
+ */
9000
+ "iDisplayStart": 0,
9001
+
9002
+
9003
+ /**
9004
+ * The scroll gap is the amount of scrolling that is left to go before
9005
+ * DataTables will load the next 'page' of data automatically. You typically
9006
+ * want a gap which is big enough that the scrolling will be smooth for the
9007
+ * user, while not so large that it will load more data than need.
9008
+ * @type int
9009
+ * @default 100
9010
+ * @dtopt Options
9011
+ *
9012
+ * @example
9013
+ * $(document).ready( function() {
9014
+ * $('#example').dataTable( {
9015
+ * "bScrollInfinite": true,
9016
+ * "bScrollCollapse": true,
9017
+ * "sScrollY": "200px",
9018
+ * "iScrollLoadGap": 50
9019
+ * } );
9020
+ * } );
9021
+ */
9022
+ "iScrollLoadGap": 100,
9023
+
9024
+
9025
+ /**
9026
+ * By default DataTables allows keyboard navigation of the table (sorting, paging,
9027
+ * and filtering) by adding a tabindex attribute to the required elements. This
9028
+ * allows you to tab through the controls and press the enter key to activate them.
9029
+ * The tabindex is default 0, meaning that the tab follows the flow of the document.
9030
+ * You can overrule this using this parameter if you wish. Use a value of -1 to
9031
+ * disable built-in keyboard navigation.
9032
+ * @type int
9033
+ * @default 0
9034
+ * @dtopt Options
9035
+ *
9036
+ * @example
9037
+ * $(document).ready( function() {
9038
+ * $('#example').dataTable( {
9039
+ * "iTabIndex": 1
9040
+ * } );
9041
+ * } );
9042
+ */
9043
+ "iTabIndex": 0,
9044
+
9045
+
9046
+ /**
9047
+ * All strings that DataTables uses in the user interface that it creates
9048
+ * are defined in this object, allowing you to modified them individually or
9049
+ * completely replace them all as required.
9050
+ * @namespace
9051
+ */
9052
+ "oLanguage": {
9053
+ /**
9054
+ * Strings that are used for WAI-ARIA labels and controls only (these are not
9055
+ * actually visible on the page, but will be read by screenreaders, and thus
9056
+ * must be internationalised as well).
9057
+ * @namespace
9058
+ */
9059
+ "oAria": {
9060
+ /**
9061
+ * ARIA label that is added to the table headers when the column may be
9062
+ * sorted ascending by activing the column (click or return when focused).
9063
+ * Note that the column header is prefixed to this string.
9064
+ * @type string
9065
+ * @default : activate to sort column ascending
9066
+ * @dtopt Language
9067
+ *
9068
+ * @example
9069
+ * $(document).ready( function() {
9070
+ * $('#example').dataTable( {
9071
+ * "oLanguage": {
9072
+ * "oAria": {
9073
+ * "sSortAscending": " - click/return to sort ascending"
9074
+ * }
9075
+ * }
9076
+ * } );
9077
+ * } );
9078
+ */
9079
+ "sSortAscending": ": activate to sort column ascending",
9080
+
9081
+ /**
9082
+ * ARIA label that is added to the table headers when the column may be
9083
+ * sorted descending by activing the column (click or return when focused).
9084
+ * Note that the column header is prefixed to this string.
9085
+ * @type string
9086
+ * @default : activate to sort column ascending
9087
+ * @dtopt Language
9088
+ *
9089
+ * @example
9090
+ * $(document).ready( function() {
9091
+ * $('#example').dataTable( {
9092
+ * "oLanguage": {
9093
+ * "oAria": {
9094
+ * "sSortDescending": " - click/return to sort descending"
9095
+ * }
9096
+ * }
9097
+ * } );
9098
+ * } );
9099
+ */
9100
+ "sSortDescending": ": activate to sort column descending"
9101
+ },
9102
+
9103
+ /**
9104
+ * Pagination string used by DataTables for the two built-in pagination
9105
+ * control types ("two_button" and "full_numbers")
9106
+ * @namespace
9107
+ */
9108
+ "oPaginate": {
9109
+ /**
9110
+ * Text to use when using the 'full_numbers' type of pagination for the
9111
+ * button to take the user to the first page.
9112
+ * @type string
9113
+ * @default First
9114
+ * @dtopt Language
9115
+ *
9116
+ * @example
9117
+ * $(document).ready( function() {
9118
+ * $('#example').dataTable( {
9119
+ * "oLanguage": {
9120
+ * "oPaginate": {
9121
+ * "sFirst": "First page"
9122
+ * }
9123
+ * }
9124
+ * } );
9125
+ * } );
9126
+ */
9127
+ "sFirst": "First",
9128
+
9129
+
9130
+ /**
9131
+ * Text to use when using the 'full_numbers' type of pagination for the
9132
+ * button to take the user to the last page.
9133
+ * @type string
9134
+ * @default Last
9135
+ * @dtopt Language
9136
+ *
9137
+ * @example
9138
+ * $(document).ready( function() {
9139
+ * $('#example').dataTable( {
9140
+ * "oLanguage": {
9141
+ * "oPaginate": {
9142
+ * "sLast": "Last page"
9143
+ * }
9144
+ * }
9145
+ * } );
9146
+ * } );
9147
+ */
9148
+ "sLast": "Last",
9149
+
9150
+
9151
+ /**
9152
+ * Text to use when using the 'full_numbers' type of pagination for the
9153
+ * button to take the user to the next page.
9154
+ * @type string
9155
+ * @default Next
9156
+ * @dtopt Language
9157
+ *
9158
+ * @example
9159
+ * $(document).ready( function() {
9160
+ * $('#example').dataTable( {
9161
+ * "oLanguage": {
9162
+ * "oPaginate": {
9163
+ * "sNext": "Next page"
9164
+ * }
9165
+ * }
9166
+ * } );
9167
+ * } );
9168
+ */
9169
+ "sNext": "Next",
9170
+
9171
+
9172
+ /**
9173
+ * Text to use when using the 'full_numbers' type of pagination for the
9174
+ * button to take the user to the previous page.
9175
+ * @type string
9176
+ * @default Previous
9177
+ * @dtopt Language
9178
+ *
9179
+ * @example
9180
+ * $(document).ready( function() {
9181
+ * $('#example').dataTable( {
9182
+ * "oLanguage": {
9183
+ * "oPaginate": {
9184
+ * "sPrevious": "Previous page"
9185
+ * }
9186
+ * }
9187
+ * } );
9188
+ * } );
9189
+ */
9190
+ "sPrevious": "Previous"
9191
+ },
9192
+
9193
+ /**
9194
+ * This string is shown in preference to sZeroRecords when the table is
9195
+ * empty of data (regardless of filtering). Note that this is an optional
9196
+ * parameter - if it is not given, the value of sZeroRecords will be used
9197
+ * instead (either the default or given value).
9198
+ * @type string
9199
+ * @default No data available in table
9200
+ * @dtopt Language
9201
+ *
9202
+ * @example
9203
+ * $(document).ready( function() {
9204
+ * $('#example').dataTable( {
9205
+ * "oLanguage": {
9206
+ * "sEmptyTable": "No data available in table"
9207
+ * }
9208
+ * } );
9209
+ * } );
9210
+ */
9211
+ "sEmptyTable": "No data available in table",
9212
+
9213
+
9214
+ /**
9215
+ * This string gives information to the end user about the information that
9216
+ * is current on display on the page. The _START_, _END_ and _TOTAL_
9217
+ * variables are all dynamically replaced as the table display updates, and
9218
+ * can be freely moved or removed as the language requirements change.
9219
+ * @type string
9220
+ * @default Showing _START_ to _END_ of _TOTAL_ entries
9221
+ * @dtopt Language
9222
+ *
9223
+ * @example
9224
+ * $(document).ready( function() {
9225
+ * $('#example').dataTable( {
9226
+ * "oLanguage": {
9227
+ * "sInfo": "Got a total of _TOTAL_ entries to show (_START_ to _END_)"
9228
+ * }
9229
+ * } );
9230
+ * } );
9231
+ */
9232
+ "sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
9233
+
9234
+
9235
+ /**
9236
+ * Display information string for when the table is empty. Typically the
9237
+ * format of this string should match sInfo.
9238
+ * @type string
9239
+ * @default Showing 0 to 0 of 0 entries
9240
+ * @dtopt Language
9241
+ *
9242
+ * @example
9243
+ * $(document).ready( function() {
9244
+ * $('#example').dataTable( {
9245
+ * "oLanguage": {
9246
+ * "sInfoEmpty": "No entries to show"
9247
+ * }
9248
+ * } );
9249
+ * } );
9250
+ */
9251
+ "sInfoEmpty": "Showing 0 to 0 of 0 entries",
9252
+
9253
+
9254
+ /**
9255
+ * When a user filters the information in a table, this string is appended
9256
+ * to the information (sInfo) to give an idea of how strong the filtering
9257
+ * is. The variable _MAX_ is dynamically updated.
9258
+ * @type string
9259
+ * @default (filtered from _MAX_ total entries)
9260
+ * @dtopt Language
9261
+ *
9262
+ * @example
9263
+ * $(document).ready( function() {
9264
+ * $('#example').dataTable( {
9265
+ * "oLanguage": {
9266
+ * "sInfoFiltered": " - filtering from _MAX_ records"
9267
+ * }
9268
+ * } );
9269
+ * } );
9270
+ */
9271
+ "sInfoFiltered": "(filtered from _MAX_ total entries)",
9272
+
9273
+
9274
+ /**
9275
+ * If can be useful to append extra information to the info string at times,
9276
+ * and this variable does exactly that. This information will be appended to
9277
+ * the sInfo (sInfoEmpty and sInfoFiltered in whatever combination they are
9278
+ * being used) at all times.
9279
+ * @type string
9280
+ * @default <i>Empty string</i>
9281
+ * @dtopt Language
9282
+ *
9283
+ * @example
9284
+ * $(document).ready( function() {
9285
+ * $('#example').dataTable( {
9286
+ * "oLanguage": {
9287
+ * "sInfoPostFix": "All records shown are derived from real information."
9288
+ * }
9289
+ * } );
9290
+ * } );
9291
+ */
9292
+ "sInfoPostFix": "",
9293
+
9294
+
9295
+ /**
9296
+ * DataTables has a build in number formatter (fnFormatNumber) which is used
9297
+ * to format large numbers that are used in the table information. By
9298
+ * default a comma is used, but this can be trivially changed to any
9299
+ * character you wish with this parameter.
9300
+ * @type string
9301
+ * @default ,
9302
+ * @dtopt Language
9303
+ *
9304
+ * @example
9305
+ * $(document).ready( function() {
9306
+ * $('#example').dataTable( {
9307
+ * "oLanguage": {
9308
+ * "sInfoThousands": "'"
9309
+ * }
9310
+ * } );
9311
+ * } );
9312
+ */
9313
+ "sInfoThousands": ",",
9314
+
9315
+
9316
+ /**
9317
+ * Detail the action that will be taken when the drop down menu for the
9318
+ * pagination length option is changed. The '_MENU_' variable is replaced
9319
+ * with a default select list of 10, 25, 50 and 100, and can be replaced
9320
+ * with a custom select box if required.
9321
+ * @type string
9322
+ * @default Show _MENU_ entries
9323
+ * @dtopt Language
9324
+ *
9325
+ * @example
9326
+ * // Language change only
9327
+ * $(document).ready( function() {
9328
+ * $('#example').dataTable( {
9329
+ * "oLanguage": {
9330
+ * "sLengthMenu": "Display _MENU_ records"
9331
+ * }
9332
+ * } );
9333
+ * } );
9334
+ *
9335
+ * @example
9336
+ * // Language and options change
9337
+ * $(document).ready( function() {
9338
+ * $('#example').dataTable( {
9339
+ * "oLanguage": {
9340
+ * "sLengthMenu": 'Display <select>'+
9341
+ * '<option value="10">10</option>'+
9342
+ * '<option value="20">20</option>'+
9343
+ * '<option value="30">30</option>'+
9344
+ * '<option value="40">40</option>'+
9345
+ * '<option value="50">50</option>'+
9346
+ * '<option value="-1">All</option>'+
9347
+ * '</select> records'
9348
+ * }
9349
+ * } );
9350
+ * } );
9351
+ */
9352
+ "sLengthMenu": "Show _MENU_ entries",
9353
+
9354
+
9355
+ /**
9356
+ * When using Ajax sourced data and during the first draw when DataTables is
9357
+ * gathering the data, this message is shown in an empty row in the table to
9358
+ * indicate to the end user the the data is being loaded. Note that this
9359
+ * parameter is not used when loading data by server-side processing, just
9360
+ * Ajax sourced data with client-side processing.
9361
+ * @type string
9362
+ * @default Loading...
9363
+ * @dtopt Language
9364
+ *
9365
+ * @example
9366
+ * $(document).ready( function() {
9367
+ * $('#example').dataTable( {
9368
+ * "oLanguage": {
9369
+ * "sLoadingRecords": "Please wait - loading..."
9370
+ * }
9371
+ * } );
9372
+ * } );
9373
+ */
9374
+ "sLoadingRecords": "Loading...",
9375
+
9376
+
9377
+ /**
9378
+ * Text which is displayed when the table is processing a user action
9379
+ * (usually a sort command or similar).
9380
+ * @type string
9381
+ * @default Processing...
9382
+ * @dtopt Language
9383
+ *
9384
+ * @example
9385
+ * $(document).ready( function() {
9386
+ * $('#example').dataTable( {
9387
+ * "oLanguage": {
9388
+ * "sProcessing": "DataTables is currently busy"
9389
+ * }
9390
+ * } );
9391
+ * } );
9392
+ */
9393
+ "sProcessing": "Processing...",
9394
+
9395
+
9396
+ /**
9397
+ * Details the actions that will be taken when the user types into the
9398
+ * filtering input text box. The variable "_INPUT_", if used in the string,
9399
+ * is replaced with the HTML text box for the filtering input allowing
9400
+ * control over where it appears in the string. If "_INPUT_" is not given
9401
+ * then the input box is appended to the string automatically.
9402
+ * @type string
9403
+ * @default Search:
9404
+ * @dtopt Language
9405
+ *
9406
+ * @example
9407
+ * // Input text box will be appended at the end automatically
9408
+ * $(document).ready( function() {
9409
+ * $('#example').dataTable( {
9410
+ * "oLanguage": {
9411
+ * "sSearch": "Filter records:"
9412
+ * }
9413
+ * } );
9414
+ * } );
9415
+ *
9416
+ * @example
9417
+ * // Specify where the filter should appear
9418
+ * $(document).ready( function() {
9419
+ * $('#example').dataTable( {
9420
+ * "oLanguage": {
9421
+ * "sSearch": "Apply filter _INPUT_ to table"
9422
+ * }
9423
+ * } );
9424
+ * } );
9425
+ */
9426
+ "sSearch": "Search:",
9427
+
9428
+
9429
+ /**
9430
+ * All of the language information can be stored in a file on the
9431
+ * server-side, which DataTables will look up if this parameter is passed.
9432
+ * It must store the URL of the language file, which is in a JSON format,
9433
+ * and the object has the same properties as the oLanguage object in the
9434
+ * initialiser object (i.e. the above parameters). Please refer to one of
9435
+ * the example language files to see how this works in action.
9436
+ * @type string
9437
+ * @default <i>Empty string - i.e. disabled</i>
9438
+ * @dtopt Language
9439
+ *
9440
+ * @example
9441
+ * $(document).ready( function() {
9442
+ * $('#example').dataTable( {
9443
+ * "oLanguage": {
9444
+ * "sUrl": "http://www.sprymedia.co.uk/dataTables/lang.txt"
9445
+ * }
9446
+ * } );
9447
+ * } );
9448
+ */
9449
+ "sUrl": "",
9450
+
9451
+
9452
+ /**
9453
+ * Text shown inside the table records when the is no information to be
9454
+ * displayed after filtering. sEmptyTable is shown when there is simply no
9455
+ * information in the table at all (regardless of filtering).
9456
+ * @type string
9457
+ * @default No matching records found
9458
+ * @dtopt Language
9459
+ *
9460
+ * @example
9461
+ * $(document).ready( function() {
9462
+ * $('#example').dataTable( {
9463
+ * "oLanguage": {
9464
+ * "sZeroRecords": "No records to display"
9465
+ * }
9466
+ * } );
9467
+ * } );
9468
+ */
9469
+ "sZeroRecords": "No matching records found"
9470
+ },
9471
+
9472
+
9473
+ /**
9474
+ * This parameter allows you to have define the global filtering state at
9475
+ * initialisation time. As an object the "sSearch" parameter must be
9476
+ * defined, but all other parameters are optional. When "bRegex" is true,
9477
+ * the search string will be treated as a regular expression, when false
9478
+ * (default) it will be treated as a straight string. When "bSmart"
9479
+ * DataTables will use it's smart filtering methods (to word match at
9480
+ * any point in the data), when false this will not be done.
9481
+ * @namespace
9482
+ * @extends DataTable.models.oSearch
9483
+ * @dtopt Options
9484
+ *
9485
+ * @example
9486
+ * $(document).ready( function() {
9487
+ * $('#example').dataTable( {
9488
+ * "oSearch": {"sSearch": "Initial search"}
9489
+ * } );
9490
+ * } )
9491
+ */
9492
+ "oSearch": $.extend( {}, DataTable.models.oSearch ),
9493
+
9494
+
9495
+ /**
9496
+ * By default DataTables will look for the property 'aaData' when obtaining
9497
+ * data from an Ajax source or for server-side processing - this parameter
9498
+ * allows that property to be changed. You can use Javascript dotted object
9499
+ * notation to get a data source for multiple levels of nesting.
9500
+ * @type string
9501
+ * @default aaData
9502
+ * @dtopt Options
9503
+ * @dtopt Server-side
9504
+ *
9505
+ * @example
9506
+ * // Get data from { "data": [...] }
9507
+ * $(document).ready( function() {
9508
+ * var oTable = $('#example').dataTable( {
9509
+ * "sAjaxSource": "sources/data.txt",
9510
+ * "sAjaxDataProp": "data"
9511
+ * } );
9512
+ * } );
9513
+ *
9514
+ * @example
9515
+ * // Get data from { "data": { "inner": [...] } }
9516
+ * $(document).ready( function() {
9517
+ * var oTable = $('#example').dataTable( {
9518
+ * "sAjaxSource": "sources/data.txt",
9519
+ * "sAjaxDataProp": "data.inner"
9520
+ * } );
9521
+ * } );
9522
+ */
9523
+ "sAjaxDataProp": "aaData",
9524
+
9525
+
9526
+ /**
9527
+ * You can instruct DataTables to load data from an external source using this
9528
+ * parameter (use aData if you want to pass data in you already have). Simply
9529
+ * provide a url a JSON object can be obtained from. This object must include
9530
+ * the parameter 'aaData' which is the data source for the table.
9531
+ * @type string
9532
+ * @default null
9533
+ * @dtopt Options
9534
+ * @dtopt Server-side
9535
+ *
9536
+ * @example
9537
+ * $(document).ready( function() {
9538
+ * $('#example').dataTable( {
9539
+ * "sAjaxSource": "http://www.sprymedia.co.uk/dataTables/json.php"
9540
+ * } );
9541
+ * } )
9542
+ */
9543
+ "sAjaxSource": null,
9544
+
9545
+
9546
+ /**
9547
+ * This parameter can be used to override the default prefix that DataTables
9548
+ * assigns to a cookie when state saving is enabled.
9549
+ * @type string
9550
+ * @default SpryMedia_DataTables_
9551
+ * @dtopt Options
9552
+ *
9553
+ * @example
9554
+ * $(document).ready( function() {
9555
+ * $('#example').dataTable( {
9556
+ * "sCookiePrefix": "my_datatable_",
9557
+ * } );
9558
+ * } );
9559
+ */
9560
+ "sCookiePrefix": "SpryMedia_DataTables_",
9561
+
9562
+
9563
+ /**
9564
+ * This initialisation variable allows you to specify exactly where in the
9565
+ * DOM you want DataTables to inject the various controls it adds to the page
9566
+ * (for example you might want the pagination controls at the top of the
9567
+ * table). DIV elements (with or without a custom class) can also be added to
9568
+ * aid styling. The follow syntax is used:
9569
+ * <ul>
9570
+ * <li>The following options are allowed:
9571
+ * <ul>
9572
+ * <li>'l' - Length changing</li
9573
+ * <li>'f' - Filtering input</li>
9574
+ * <li>'t' - The table!</li>
9575
+ * <li>'i' - Information</li>
9576
+ * <li>'p' - Pagination</li>
9577
+ * <li>'r' - pRocessing</li>
9578
+ * </ul>
9579
+ * </li>
9580
+ * <li>The following constants are allowed:
9581
+ * <ul>
9582
+ * <li>'H' - jQueryUI theme "header" classes ('fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix')</li>
9583
+ * <li>'F' - jQueryUI theme "footer" classes ('fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix')</li>
9584
+ * </ul>
9585
+ * </li>
9586
+ * <li>The following syntax is expected:
9587
+ * <ul>
9588
+ * <li>'&lt;' and '&gt;' - div elements</li>
9589
+ * <li>'&lt;"class" and '&gt;' - div with a class</li>
9590
+ * <li>'&lt;"#id" and '&gt;' - div with an ID</li>
9591
+ * </ul>
9592
+ * </li>
9593
+ * <li>Examples:
9594
+ * <ul>
9595
+ * <li>'&lt;"wrapper"flipt&gt;'</li>
9596
+ * <li>'&lt;lf&lt;t&gt;ip&gt;'</li>
9597
+ * </ul>
9598
+ * </li>
9599
+ * </ul>
9600
+ * @type string
9601
+ * @default lfrtip <i>(when bJQueryUI is false)</i> <b>or</b>
9602
+ * <"H"lfr>t<"F"ip> <i>(when bJQueryUI is true)</i>
9603
+ * @dtopt Options
9604
+ *
9605
+ * @example
9606
+ * $(document).ready( function() {
9607
+ * $('#example').dataTable( {
9608
+ * "sDom": '&lt;"top"i&gt;rt&lt;"bottom"flp&gt;&lt;"clear"&gt;'
9609
+ * } );
9610
+ * } );
9611
+ */
9612
+ "sDom": "lfrtip",
9613
+
9614
+
9615
+ /**
9616
+ * DataTables features two different built-in pagination interaction methods
9617
+ * ('two_button' or 'full_numbers') which present different page controls to
9618
+ * the end user. Further methods can be added using the API (see below).
9619
+ * @type string
9620
+ * @default two_button
9621
+ * @dtopt Options
9622
+ *
9623
+ * @example
9624
+ * $(document).ready( function() {
9625
+ * $('#example').dataTable( {
9626
+ * "sPaginationType": "full_numbers"
9627
+ * } );
9628
+ * } )
9629
+ */
9630
+ "sPaginationType": "two_button",
9631
+
9632
+
9633
+ /**
9634
+ * Enable horizontal scrolling. When a table is too wide to fit into a certain
9635
+ * layout, or you have a large number of columns in the table, you can enable
9636
+ * x-scrolling to show the table in a viewport, which can be scrolled. This
9637
+ * property can be any CSS unit, or a number (in which case it will be treated
9638
+ * as a pixel measurement).
9639
+ * @type string
9640
+ * @default <i>blank string - i.e. disabled</i>
9641
+ * @dtopt Features
9642
+ *
9643
+ * @example
9644
+ * $(document).ready( function() {
9645
+ * $('#example').dataTable( {
9646
+ * "sScrollX": "100%",
9647
+ * "bScrollCollapse": true
9648
+ * } );
9649
+ * } );
9650
+ */
9651
+ "sScrollX": "",
9652
+
9653
+
9654
+ /**
9655
+ * This property can be used to force a DataTable to use more width than it
9656
+ * might otherwise do when x-scrolling is enabled. For example if you have a
9657
+ * table which requires to be well spaced, this parameter is useful for
9658
+ * "over-sizing" the table, and thus forcing scrolling. This property can by
9659
+ * any CSS unit, or a number (in which case it will be treated as a pixel
9660
+ * measurement).
9661
+ * @type string
9662
+ * @default <i>blank string - i.e. disabled</i>
9663
+ * @dtopt Options
9664
+ *
9665
+ * @example
9666
+ * $(document).ready( function() {
9667
+ * $('#example').dataTable( {
9668
+ * "sScrollX": "100%",
9669
+ * "sScrollXInner": "110%"
9670
+ * } );
9671
+ * } );
9672
+ */
9673
+ "sScrollXInner": "",
9674
+
9675
+
9676
+ /**
9677
+ * Enable vertical scrolling. Vertical scrolling will constrain the DataTable
9678
+ * to the given height, and enable scrolling for any data which overflows the
9679
+ * current viewport. This can be used as an alternative to paging to display
9680
+ * a lot of data in a small area (although paging and scrolling can both be
9681
+ * enabled at the same time). This property can be any CSS unit, or a number
9682
+ * (in which case it will be treated as a pixel measurement).
9683
+ * @type string
9684
+ * @default <i>blank string - i.e. disabled</i>
9685
+ * @dtopt Features
9686
+ *
9687
+ * @example
9688
+ * $(document).ready( function() {
9689
+ * $('#example').dataTable( {
9690
+ * "sScrollY": "200px",
9691
+ * "bPaginate": false
9692
+ * } );
9693
+ * } );
9694
+ */
9695
+ "sScrollY": "",
9696
+
9697
+
9698
+ /**
9699
+ * Set the HTTP method that is used to make the Ajax call for server-side
9700
+ * processing or Ajax sourced data.
9701
+ * @type string
9702
+ * @default GET
9703
+ * @dtopt Options
9704
+ * @dtopt Server-side
9705
+ *
9706
+ * @example
9707
+ * $(document).ready( function() {
9708
+ * $('#example').dataTable( {
9709
+ * "bServerSide": true,
9710
+ * "sAjaxSource": "scripts/post.php",
9711
+ * "sServerMethod": "POST"
9712
+ * } );
9713
+ * } );
9714
+ */
9715
+ "sServerMethod": "GET"
9716
+ };
9717
+
9718
+
9719
+
9720
+ /**
9721
+ * Column options that can be given to DataTables at initialisation time.
9722
+ * @namespace
9723
+ */
9724
+ DataTable.defaults.columns = {
9725
+ /**
9726
+ * Allows a column's sorting to take multiple columns into account when
9727
+ * doing a sort. For example first name / last name columns make sense to
9728
+ * do a multi-column sort over the two columns.
9729
+ * @type array
9730
+ * @default null <i>Takes the value of the column index automatically</i>
9731
+ * @dtopt Columns
9732
+ *
9733
+ * @example
9734
+ * // Using aoColumnDefs
9735
+ * $(document).ready( function() {
9736
+ * $('#example').dataTable( {
9737
+ * "aoColumnDefs": [
9738
+ * { "aDataSort": [ 0, 1 ], "aTargets": [ 0 ] },
9739
+ * { "aDataSort": [ 1, 0 ], "aTargets": [ 1 ] },
9740
+ * { "aDataSort": [ 2, 3, 4 ], "aTargets": [ 2 ] }
9741
+ * ]
9742
+ * } );
9743
+ * } );
9744
+ *
9745
+ * @example
9746
+ * // Using aoColumns
9747
+ * $(document).ready( function() {
9748
+ * $('#example').dataTable( {
9749
+ * "aoColumns": [
9750
+ * { "aDataSort": [ 0, 1 ] },
9751
+ * { "aDataSort": [ 1, 0 ] },
9752
+ * { "aDataSort": [ 2, 3, 4 ] },
9753
+ * null,
9754
+ * null
9755
+ * ]
9756
+ * } );
9757
+ * } );
9758
+ */
9759
+ "aDataSort": null,
9760
+
9761
+
9762
+ /**
9763
+ * You can control the default sorting direction, and even alter the behaviour
9764
+ * of the sort handler (i.e. only allow ascending sorting etc) using this
9765
+ * parameter.
9766
+ * @type array
9767
+ * @default [ 'asc', 'desc' ]
9768
+ * @dtopt Columns
9769
+ *
9770
+ * @example
9771
+ * // Using aoColumnDefs
9772
+ * $(document).ready( function() {
9773
+ * $('#example').dataTable( {
9774
+ * "aoColumnDefs": [
9775
+ * { "asSorting": [ "asc" ], "aTargets": [ 1 ] },
9776
+ * { "asSorting": [ "desc", "asc", "asc" ], "aTargets": [ 2 ] },
9777
+ * { "asSorting": [ "desc" ], "aTargets": [ 3 ] }
9778
+ * ]
9779
+ * } );
9780
+ * } );
9781
+ *
9782
+ * @example
9783
+ * // Using aoColumns
9784
+ * $(document).ready( function() {
9785
+ * $('#example').dataTable( {
9786
+ * "aoColumns": [
9787
+ * null,
9788
+ * { "asSorting": [ "asc" ] },
9789
+ * { "asSorting": [ "desc", "asc", "asc" ] },
9790
+ * { "asSorting": [ "desc" ] },
9791
+ * null
9792
+ * ]
9793
+ * } );
9794
+ * } );
9795
+ */
9796
+ "asSorting": [ 'asc', 'desc' ],
9797
+
9798
+
9799
+ /**
9800
+ * Enable or disable filtering on the data in this column.
9801
+ * @type boolean
9802
+ * @default true
9803
+ * @dtopt Columns
9804
+ *
9805
+ * @example
9806
+ * // Using aoColumnDefs
9807
+ * $(document).ready( function() {
9808
+ * $('#example').dataTable( {
9809
+ * "aoColumnDefs": [
9810
+ * { "bSearchable": false, "aTargets": [ 0 ] }
9811
+ * ] } );
9812
+ * } );
9813
+ *
9814
+ * @example
9815
+ * // Using aoColumns
9816
+ * $(document).ready( function() {
9817
+ * $('#example').dataTable( {
9818
+ * "aoColumns": [
9819
+ * { "bSearchable": false },
9820
+ * null,
9821
+ * null,
9822
+ * null,
9823
+ * null
9824
+ * ] } );
9825
+ * } );
9826
+ */
9827
+ "bSearchable": true,
9828
+
9829
+
9830
+ /**
9831
+ * Enable or disable sorting on this column.
9832
+ * @type boolean
9833
+ * @default true
9834
+ * @dtopt Columns
9835
+ *
9836
+ * @example
9837
+ * // Using aoColumnDefs
9838
+ * $(document).ready( function() {
9839
+ * $('#example').dataTable( {
9840
+ * "aoColumnDefs": [
9841
+ * { "bSortable": false, "aTargets": [ 0 ] }
9842
+ * ] } );
9843
+ * } );
9844
+ *
9845
+ * @example
9846
+ * // Using aoColumns
9847
+ * $(document).ready( function() {
9848
+ * $('#example').dataTable( {
9849
+ * "aoColumns": [
9850
+ * { "bSortable": false },
9851
+ * null,
9852
+ * null,
9853
+ * null,
9854
+ * null
9855
+ * ] } );
9856
+ * } );
9857
+ */
9858
+ "bSortable": true,
9859
+
9860
+
9861
+ /**
9862
+ * When using fnRender() for a column, you may wish to use the original data
9863
+ * (before rendering) for sorting and filtering (the default is to used the
9864
+ * rendered data that the user can see). This may be useful for dates etc.
9865
+ *
9866
+ * *NOTE* This property is now deprecated, and it is suggested that you use
9867
+ * mData and / or mRender to render data for the DataTable.
9868
+ * @type boolean
9869
+ * @default true
9870
+ * @dtopt Columns
9871
+ * @deprecated
9872
+ *
9873
+ * @example
9874
+ * // Using aoColumnDefs
9875
+ * $(document).ready( function() {
9876
+ * $('#example').dataTable( {
9877
+ * "aoColumnDefs": [
9878
+ * {
9879
+ * "fnRender": function ( oObj ) {
9880
+ * return oObj.aData[0] +' '+ oObj.aData[3];
9881
+ * },
9882
+ * "bUseRendered": false,
9883
+ * "aTargets": [ 0 ]
9884
+ * }
9885
+ * ]
9886
+ * } );
9887
+ * } );
9888
+ *
9889
+ * @example
9890
+ * // Using aoColumns
9891
+ * $(document).ready( function() {
9892
+ * $('#example').dataTable( {
9893
+ * "aoColumns": [
9894
+ * {
9895
+ * "fnRender": function ( oObj ) {
9896
+ * return oObj.aData[0] +' '+ oObj.aData[3];
9897
+ * },
9898
+ * "bUseRendered": false
9899
+ * },
9900
+ * null,
9901
+ * null,
9902
+ * null,
9903
+ * null
9904
+ * ]
9905
+ * } );
9906
+ * } );
9907
+ */
9908
+ "bUseRendered": true,
9909
+
9910
+
9911
+ /**
9912
+ * Enable or disable the display of this column.
9913
+ * @type boolean
9914
+ * @default true
9915
+ * @dtopt Columns
9916
+ *
9917
+ * @example
9918
+ * // Using aoColumnDefs
9919
+ * $(document).ready( function() {
9920
+ * $('#example').dataTable( {
9921
+ * "aoColumnDefs": [
9922
+ * { "bVisible": false, "aTargets": [ 0 ] }
9923
+ * ] } );
9924
+ * } );
9925
+ *
9926
+ * @example
9927
+ * // Using aoColumns
9928
+ * $(document).ready( function() {
9929
+ * $('#example').dataTable( {
9930
+ * "aoColumns": [
9931
+ * { "bVisible": false },
9932
+ * null,
9933
+ * null,
9934
+ * null,
9935
+ * null
9936
+ * ] } );
9937
+ * } );
9938
+ */
9939
+ "bVisible": true,
9940
+
9941
+
9942
+ /**
9943
+ * Developer definable function that is called whenever a cell is created (Ajax source,
9944
+ * etc) or processed for input (DOM source). This can be used as a compliment to fnRender
9945
+ * allowing you to modify the DOM element (add background colour for example) when the
9946
+ * element is available (since it is not when fnRender is called).
9947
+ * @type function
9948
+ * @param {element} nTd The TD node that has been created
9949
+ * @param {*} sData The Data for the cell
9950
+ * @param {array|object} oData The data for the whole row
9951
+ * @param {int} iRow The row index for the aoData data store
9952
+ * @param {int} iCol The column index for aoColumns
9953
+ * @dtopt Columns
9954
+ *
9955
+ * @example
9956
+ * $(document).ready( function() {
9957
+ * $('#example').dataTable( {
9958
+ * "aoColumnDefs": [ {
9959
+ * "aTargets": [3],
9960
+ * "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
9961
+ * if ( sData == "1.7" ) {
9962
+ * $(nTd).css('color', 'blue')
9963
+ * }
9964
+ * }
9965
+ * } ]
9966
+ * });
9967
+ * } );
9968
+ */
9969
+ "fnCreatedCell": null,
9970
+
9971
+
9972
+ /**
9973
+ * Custom display function that will be called for the display of each cell in
9974
+ * this column.
9975
+ * @type function
9976
+ * @param {object} o Object with the following parameters:
9977
+ * @param {int} o.iDataRow The row in aoData
9978
+ * @param {int} o.iDataColumn The column in question
9979
+ * @param {array} o.aData The data for the row in question
9980
+ * @param {object} o.oSettings The settings object for this DataTables instance
9981
+ * @param {object} o.mDataProp The data property used for this column
9982
+ * @param {*} val The current cell value
9983
+ * @returns {string} The string you which to use in the display
9984
+ * @dtopt Columns
9985
+ *
9986
+ * @example
9987
+ * // Using aoColumnDefs
9988
+ * $(document).ready( function() {
9989
+ * $('#example').dataTable( {
9990
+ * "aoColumnDefs": [
9991
+ * {
9992
+ * "fnRender": function ( o, val ) {
9993
+ * return o.aData[0] +' '+ o.aData[3];
9994
+ * },
9995
+ * "aTargets": [ 0 ]
9996
+ * }
9997
+ * ]
9998
+ * } );
9999
+ * } );
10000
+ *
10001
+ * @example
10002
+ * // Using aoColumns
10003
+ * $(document).ready( function() {
10004
+ * $('#example').dataTable( {
10005
+ * "aoColumns": [
10006
+ * { "fnRender": function ( o, val ) {
10007
+ * return o.aData[0] +' '+ o.aData[3];
10008
+ * } },
10009
+ * null,
10010
+ * null,
10011
+ * null,
10012
+ * null
10013
+ * ]
10014
+ * } );
10015
+ * } );
10016
+ */
10017
+ "fnRender": null,
10018
+
10019
+
10020
+ /**
10021
+ * The column index (starting from 0!) that you wish a sort to be performed
10022
+ * upon when this column is selected for sorting. This can be used for sorting
10023
+ * on hidden columns for example.
10024
+ * @type int
10025
+ * @default -1 <i>Use automatically calculated column index</i>
10026
+ * @dtopt Columns
10027
+ *
10028
+ * @example
10029
+ * // Using aoColumnDefs
10030
+ * $(document).ready( function() {
10031
+ * $('#example').dataTable( {
10032
+ * "aoColumnDefs": [
10033
+ * { "iDataSort": 1, "aTargets": [ 0 ] }
10034
+ * ]
10035
+ * } );
10036
+ * } );
10037
+ *
10038
+ * @example
10039
+ * // Using aoColumns
10040
+ * $(document).ready( function() {
10041
+ * $('#example').dataTable( {
10042
+ * "aoColumns": [
10043
+ * { "iDataSort": 1 },
10044
+ * null,
10045
+ * null,
10046
+ * null,
10047
+ * null
10048
+ * ]
10049
+ * } );
10050
+ * } );
10051
+ */
10052
+ "iDataSort": -1,
10053
+
10054
+
10055
+ /**
10056
+ * This parameter has been replaced by mData in DataTables to ensure naming
10057
+ * consistency. mDataProp can still be used, as there is backwards compatibility
10058
+ * in DataTables for this option, but it is strongly recommended that you use
10059
+ * mData in preference to mDataProp.
10060
+ * @name DataTable.defaults.columns.mDataProp
10061
+ */
10062
+
10063
+
10064
+ /**
10065
+ * This property can be used to read data from any JSON data source property,
10066
+ * including deeply nested objects / properties. mData can be given in a
10067
+ * number of different ways which effect its behaviour:
10068
+ * <ul>
10069
+ * <li>integer - treated as an array index for the data source. This is the
10070
+ * default that DataTables uses (incrementally increased for each column).</li>
10071
+ * <li>string - read an object property from the data source. Note that you can
10072
+ * use Javascript dotted notation to read deep properties / arrays from the
10073
+ * data source.</li>
10074
+ * <li>null - the sDefaultContent option will be used for the cell (null
10075
+ * by default, so you will need to specify the default content you want -
10076
+ * typically an empty string). This can be useful on generated columns such
10077
+ * as edit / delete action columns.</li>
10078
+ * <li>function - the function given will be executed whenever DataTables
10079
+ * needs to set or get the data for a cell in the column. The function
10080
+ * takes three parameters:
10081
+ * <ul>
10082
+ * <li>{array|object} The data source for the row</li>
10083
+ * <li>{string} The type call data requested - this will be 'set' when
10084
+ * setting data or 'filter', 'display', 'type', 'sort' or undefined when
10085
+ * gathering data. Note that when <i>undefined</i> is given for the type
10086
+ * DataTables expects to get the raw data for the object back</li>
10087
+ * <li>{*} Data to set when the second parameter is 'set'.</li>
10088
+ * </ul>
10089
+ * The return value from the function is not required when 'set' is the type
10090
+ * of call, but otherwise the return is what will be used for the data
10091
+ * requested.</li>
10092
+ * </ul>
10093
+ *
10094
+ * Note that prior to DataTables 1.9.2 mData was called mDataProp. The name change
10095
+ * reflects the flexibility of this property and is consistent with the naming of
10096
+ * mRender. If 'mDataProp' is given, then it will still be used by DataTables, as
10097
+ * it automatically maps the old name to the new if required.
10098
+ * @type string|int|function|null
10099
+ * @default null <i>Use automatically calculated column index</i>
10100
+ * @dtopt Columns
10101
+ *
10102
+ * @example
10103
+ * // Read table data from objects
10104
+ * $(document).ready( function() {
10105
+ * var oTable = $('#example').dataTable( {
10106
+ * "sAjaxSource": "sources/deep.txt",
10107
+ * "aoColumns": [
10108
+ * { "mData": "engine" },
10109
+ * { "mData": "browser" },
10110
+ * { "mData": "platform.inner" },
10111
+ * { "mData": "platform.details.0" },
10112
+ * { "mData": "platform.details.1" }
10113
+ * ]
10114
+ * } );
10115
+ * } );
10116
+ *
10117
+ * @example
10118
+ * // Using mData as a function to provide different information for
10119
+ * // sorting, filtering and display. In this case, currency (price)
10120
+ * $(document).ready( function() {
10121
+ * var oTable = $('#example').dataTable( {
10122
+ * "aoColumnDefs": [ {
10123
+ * "aTargets": [ 0 ],
10124
+ * "mData": function ( source, type, val ) {
10125
+ * if (type === 'set') {
10126
+ * source.price = val;
10127
+ * // Store the computed dislay and filter values for efficiency
10128
+ * source.price_display = val=="" ? "" : "$"+numberFormat(val);
10129
+ * source.price_filter = val=="" ? "" : "$"+numberFormat(val)+" "+val;
10130
+ * return;
10131
+ * }
10132
+ * else if (type === 'display') {
10133
+ * return source.price_display;
10134
+ * }
10135
+ * else if (type === 'filter') {
10136
+ * return source.price_filter;
10137
+ * }
10138
+ * // 'sort', 'type' and undefined all just use the integer
10139
+ * return source.price;
10140
+ * }
10141
+ * } ]
10142
+ * } );
10143
+ * } );
10144
+ */
10145
+ "mData": null,
10146
+
10147
+
10148
+ /**
10149
+ * This property is the rendering partner to mData and it is suggested that
10150
+ * when you want to manipulate data for display (including filtering, sorting etc)
10151
+ * but not altering the underlying data for the table, use this property. mData
10152
+ * can actually do everything this property can and more, but this parameter is
10153
+ * easier to use since there is no 'set' option. Like mData is can be given
10154
+ * in a number of different ways to effect its behaviour, with the addition of
10155
+ * supporting array syntax for easy outputting of arrays (including arrays of
10156
+ * objects):
10157
+ * <ul>
10158
+ * <li>integer - treated as an array index for the data source. This is the
10159
+ * default that DataTables uses (incrementally increased for each column).</li>
10160
+ * <li>string - read an object property from the data source. Note that you can
10161
+ * use Javascript dotted notation to read deep properties / arrays from the
10162
+ * data source and also array brackets to indicate that the data reader should
10163
+ * loop over the data source array. When characters are given between the array
10164
+ * brackets, these characters are used to join the data source array together.
10165
+ * For example: "accounts[, ].name" would result in a comma separated list with
10166
+ * the 'name' value from the 'accounts' array of objects.</li>
10167
+ * <li>function - the function given will be executed whenever DataTables
10168
+ * needs to set or get the data for a cell in the column. The function
10169
+ * takes three parameters:
10170
+ * <ul>
10171
+ * <li>{array|object} The data source for the row (based on mData)</li>
10172
+ * <li>{string} The type call data requested - this will be 'filter', 'display',
10173
+ * 'type' or 'sort'.</li>
10174
+ * <li>{array|object} The full data source for the row (not based on mData)</li>
10175
+ * </ul>
10176
+ * The return value from the function is what will be used for the data
10177
+ * requested.</li>
10178
+ * </ul>
10179
+ * @type string|int|function|null
10180
+ * @default null <i>Use mData</i>
10181
+ * @dtopt Columns
10182
+ *
10183
+ * @example
10184
+ * // Create a comma separated list from an array of objects
10185
+ * $(document).ready( function() {
10186
+ * var oTable = $('#example').dataTable( {
10187
+ * "sAjaxSource": "sources/deep.txt",
10188
+ * "aoColumns": [
10189
+ * { "mData": "engine" },
10190
+ * { "mData": "browser" },
10191
+ * {
10192
+ * "mData": "platform",
10193
+ * "mRender": "[, ].name"
10194
+ * }
10195
+ * ]
10196
+ * } );
10197
+ * } );
10198
+ *
10199
+ * @example
10200
+ * // Use as a function to create a link from the data source
10201
+ * $(document).ready( function() {
10202
+ * var oTable = $('#example').dataTable( {
10203
+ * "aoColumnDefs": [
10204
+ * {
10205
+ * "aTargets": [ 0 ],
10206
+ * "mData": "download_link",
10207
+ * "mRender": function ( data, type, full ) {
10208
+ * return '<a href="'+data+'">Download</a>';
10209
+ * }
10210
+ * ]
10211
+ * } );
10212
+ * } );
10213
+ */
10214
+ "mRender": null,
10215
+
10216
+
10217
+ /**
10218
+ * Change the cell type created for the column - either TD cells or TH cells. This
10219
+ * can be useful as TH cells have semantic meaning in the table body, allowing them
10220
+ * to act as a header for a row (you may wish to add scope='row' to the TH elements).
10221
+ * @type string
10222
+ * @default td
10223
+ * @dtopt Columns
10224
+ *
10225
+ * @example
10226
+ * // Make the first column use TH cells
10227
+ * $(document).ready( function() {
10228
+ * var oTable = $('#example').dataTable( {
10229
+ * "aoColumnDefs": [ {
10230
+ * "aTargets": [ 0 ],
10231
+ * "sCellType": "th"
10232
+ * } ]
10233
+ * } );
10234
+ * } );
10235
+ */
10236
+ "sCellType": "td",
10237
+
10238
+
10239
+ /**
10240
+ * Class to give to each cell in this column.
10241
+ * @type string
10242
+ * @default <i>Empty string</i>
10243
+ * @dtopt Columns
10244
+ *
10245
+ * @example
10246
+ * // Using aoColumnDefs
10247
+ * $(document).ready( function() {
10248
+ * $('#example').dataTable( {
10249
+ * "aoColumnDefs": [
10250
+ * { "sClass": "my_class", "aTargets": [ 0 ] }
10251
+ * ]
10252
+ * } );
10253
+ * } );
10254
+ *
10255
+ * @example
10256
+ * // Using aoColumns
10257
+ * $(document).ready( function() {
10258
+ * $('#example').dataTable( {
10259
+ * "aoColumns": [
10260
+ * { "sClass": "my_class" },
10261
+ * null,
10262
+ * null,
10263
+ * null,
10264
+ * null
10265
+ * ]
10266
+ * } );
10267
+ * } );
10268
+ */
10269
+ "sClass": "",
10270
+
10271
+ /**
10272
+ * When DataTables calculates the column widths to assign to each column,
10273
+ * it finds the longest string in each column and then constructs a
10274
+ * temporary table and reads the widths from that. The problem with this
10275
+ * is that "mmm" is much wider then "iiii", but the latter is a longer
10276
+ * string - thus the calculation can go wrong (doing it properly and putting
10277
+ * it into an DOM object and measuring that is horribly(!) slow). Thus as
10278
+ * a "work around" we provide this option. It will append its value to the
10279
+ * text that is found to be the longest string for the column - i.e. padding.
10280
+ * Generally you shouldn't need this, and it is not documented on the
10281
+ * general DataTables.net documentation
10282
+ * @type string
10283
+ * @default <i>Empty string<i>
10284
+ * @dtopt Columns
10285
+ *
10286
+ * @example
10287
+ * // Using aoColumns
10288
+ * $(document).ready( function() {
10289
+ * $('#example').dataTable( {
10290
+ * "aoColumns": [
10291
+ * null,
10292
+ * null,
10293
+ * null,
10294
+ * {
10295
+ * "sContentPadding": "mmm"
10296
+ * }
10297
+ * ]
10298
+ * } );
10299
+ * } );
10300
+ */
10301
+ "sContentPadding": "",
10302
+
10303
+
10304
+ /**
10305
+ * Allows a default value to be given for a column's data, and will be used
10306
+ * whenever a null data source is encountered (this can be because mData
10307
+ * is set to null, or because the data source itself is null).
10308
+ * @type string
10309
+ * @default null
10310
+ * @dtopt Columns
10311
+ *
10312
+ * @example
10313
+ * // Using aoColumnDefs
10314
+ * $(document).ready( function() {
10315
+ * $('#example').dataTable( {
10316
+ * "aoColumnDefs": [
10317
+ * {
10318
+ * "mData": null,
10319
+ * "sDefaultContent": "Edit",
10320
+ * "aTargets": [ -1 ]
10321
+ * }
10322
+ * ]
10323
+ * } );
10324
+ * } );
10325
+ *
10326
+ * @example
10327
+ * // Using aoColumns
10328
+ * $(document).ready( function() {
10329
+ * $('#example').dataTable( {
10330
+ * "aoColumns": [
10331
+ * null,
10332
+ * null,
10333
+ * null,
10334
+ * {
10335
+ * "mData": null,
10336
+ * "sDefaultContent": "Edit"
10337
+ * }
10338
+ * ]
10339
+ * } );
10340
+ * } );
10341
+ */
10342
+ "sDefaultContent": null,
10343
+
10344
+
10345
+ /**
10346
+ * This parameter is only used in DataTables' server-side processing. It can
10347
+ * be exceptionally useful to know what columns are being displayed on the
10348
+ * client side, and to map these to database fields. When defined, the names
10349
+ * also allow DataTables to reorder information from the server if it comes
10350
+ * back in an unexpected order (i.e. if you switch your columns around on the
10351
+ * client-side, your server-side code does not also need updating).
10352
+ * @type string
10353
+ * @default <i>Empty string</i>
10354
+ * @dtopt Columns
10355
+ *
10356
+ * @example
10357
+ * // Using aoColumnDefs
10358
+ * $(document).ready( function() {
10359
+ * $('#example').dataTable( {
10360
+ * "aoColumnDefs": [
10361
+ * { "sName": "engine", "aTargets": [ 0 ] },
10362
+ * { "sName": "browser", "aTargets": [ 1 ] },
10363
+ * { "sName": "platform", "aTargets": [ 2 ] },
10364
+ * { "sName": "version", "aTargets": [ 3 ] },
10365
+ * { "sName": "grade", "aTargets": [ 4 ] }
10366
+ * ]
10367
+ * } );
10368
+ * } );
10369
+ *
10370
+ * @example
10371
+ * // Using aoColumns
10372
+ * $(document).ready( function() {
10373
+ * $('#example').dataTable( {
10374
+ * "aoColumns": [
10375
+ * { "sName": "engine" },
10376
+ * { "sName": "browser" },
10377
+ * { "sName": "platform" },
10378
+ * { "sName": "version" },
10379
+ * { "sName": "grade" }
10380
+ * ]
10381
+ * } );
10382
+ * } );
10383
+ */
10384
+ "sName": "",
10385
+
10386
+
10387
+ /**
10388
+ * Defines a data source type for the sorting which can be used to read
10389
+ * real-time information from the table (updating the internally cached
10390
+ * version) prior to sorting. This allows sorting to occur on user editable
10391
+ * elements such as form inputs.
10392
+ * @type string
10393
+ * @default std
10394
+ * @dtopt Columns
10395
+ *
10396
+ * @example
10397
+ * // Using aoColumnDefs
10398
+ * $(document).ready( function() {
10399
+ * $('#example').dataTable( {
10400
+ * "aoColumnDefs": [
10401
+ * { "sSortDataType": "dom-text", "aTargets": [ 2, 3 ] },
10402
+ * { "sType": "numeric", "aTargets": [ 3 ] },
10403
+ * { "sSortDataType": "dom-select", "aTargets": [ 4 ] },
10404
+ * { "sSortDataType": "dom-checkbox", "aTargets": [ 5 ] }
10405
+ * ]
10406
+ * } );
10407
+ * } );
10408
+ *
10409
+ * @example
10410
+ * // Using aoColumns
10411
+ * $(document).ready( function() {
10412
+ * $('#example').dataTable( {
10413
+ * "aoColumns": [
10414
+ * null,
10415
+ * null,
10416
+ * { "sSortDataType": "dom-text" },
10417
+ * { "sSortDataType": "dom-text", "sType": "numeric" },
10418
+ * { "sSortDataType": "dom-select" },
10419
+ * { "sSortDataType": "dom-checkbox" }
10420
+ * ]
10421
+ * } );
10422
+ * } );
10423
+ */
10424
+ "sSortDataType": "std",
10425
+
10426
+
10427
+ /**
10428
+ * The title of this column.
10429
+ * @type string
10430
+ * @default null <i>Derived from the 'TH' value for this column in the
10431
+ * original HTML table.</i>
10432
+ * @dtopt Columns
10433
+ *
10434
+ * @example
10435
+ * // Using aoColumnDefs
10436
+ * $(document).ready( function() {
10437
+ * $('#example').dataTable( {
10438
+ * "aoColumnDefs": [
10439
+ * { "sTitle": "My column title", "aTargets": [ 0 ] }
10440
+ * ]
10441
+ * } );
10442
+ * } );
10443
+ *
10444
+ * @example
10445
+ * // Using aoColumns
10446
+ * $(document).ready( function() {
10447
+ * $('#example').dataTable( {
10448
+ * "aoColumns": [
10449
+ * { "sTitle": "My column title" },
10450
+ * null,
10451
+ * null,
10452
+ * null,
10453
+ * null
10454
+ * ]
10455
+ * } );
10456
+ * } );
10457
+ */
10458
+ "sTitle": null,
10459
+
10460
+
10461
+ /**
10462
+ * The type allows you to specify how the data for this column will be sorted.
10463
+ * Four types (string, numeric, date and html (which will strip HTML tags
10464
+ * before sorting)) are currently available. Note that only date formats
10465
+ * understood by Javascript's Date() object will be accepted as type date. For
10466
+ * example: "Mar 26, 2008 5:03 PM". May take the values: 'string', 'numeric',
10467
+ * 'date' or 'html' (by default). Further types can be adding through
10468
+ * plug-ins.
10469
+ * @type string
10470
+ * @default null <i>Auto-detected from raw data</i>
10471
+ * @dtopt Columns
10472
+ *
10473
+ * @example
10474
+ * // Using aoColumnDefs
10475
+ * $(document).ready( function() {
10476
+ * $('#example').dataTable( {
10477
+ * "aoColumnDefs": [
10478
+ * { "sType": "html", "aTargets": [ 0 ] }
10479
+ * ]
10480
+ * } );
10481
+ * } );
10482
+ *
10483
+ * @example
10484
+ * // Using aoColumns
10485
+ * $(document).ready( function() {
10486
+ * $('#example').dataTable( {
10487
+ * "aoColumns": [
10488
+ * { "sType": "html" },
10489
+ * null,
10490
+ * null,
10491
+ * null,
10492
+ * null
10493
+ * ]
10494
+ * } );
10495
+ * } );
10496
+ */
10497
+ "sType": null,
10498
+
10499
+
10500
+ /**
10501
+ * Defining the width of the column, this parameter may take any CSS value
10502
+ * (3em, 20px etc). DataTables apples 'smart' widths to columns which have not
10503
+ * been given a specific width through this interface ensuring that the table
10504
+ * remains readable.
10505
+ * @type string
10506
+ * @default null <i>Automatic</i>
10507
+ * @dtopt Columns
10508
+ *
10509
+ * @example
10510
+ * // Using aoColumnDefs
10511
+ * $(document).ready( function() {
10512
+ * $('#example').dataTable( {
10513
+ * "aoColumnDefs": [
10514
+ * { "sWidth": "20%", "aTargets": [ 0 ] }
10515
+ * ]
10516
+ * } );
10517
+ * } );
10518
+ *
10519
+ * @example
10520
+ * // Using aoColumns
10521
+ * $(document).ready( function() {
10522
+ * $('#example').dataTable( {
10523
+ * "aoColumns": [
10524
+ * { "sWidth": "20%" },
10525
+ * null,
10526
+ * null,
10527
+ * null,
10528
+ * null
10529
+ * ]
10530
+ * } );
10531
+ * } );
10532
+ */
10533
+ "sWidth": null
10534
+ };
10535
+
10536
+
10537
+
10538
+ /**
10539
+ * DataTables settings object - this holds all the information needed for a
10540
+ * given table, including configuration, data and current application of the
10541
+ * table options. DataTables does not have a single instance for each DataTable
10542
+ * with the settings attached to that instance, but rather instances of the
10543
+ * DataTable "class" are created on-the-fly as needed (typically by a
10544
+ * $().dataTable() call) and the settings object is then applied to that
10545
+ * instance.
10546
+ *
10547
+ * Note that this object is related to {@link DataTable.defaults} but this
10548
+ * one is the internal data store for DataTables's cache of columns. It should
10549
+ * NOT be manipulated outside of DataTables. Any configuration should be done
10550
+ * through the initialisation options.
10551
+ * @namespace
10552
+ * @todo Really should attach the settings object to individual instances so we
10553
+ * don't need to create new instances on each $().dataTable() call (if the
10554
+ * table already exists). It would also save passing oSettings around and
10555
+ * into every single function. However, this is a very significant
10556
+ * architecture change for DataTables and will almost certainly break
10557
+ * backwards compatibility with older installations. This is something that
10558
+ * will be done in 2.0.
10559
+ */
10560
+ DataTable.models.oSettings = {
10561
+ /**
10562
+ * Primary features of DataTables and their enablement state.
10563
+ * @namespace
10564
+ */
10565
+ "oFeatures": {
10566
+
10567
+ /**
10568
+ * Flag to say if DataTables should automatically try to calculate the
10569
+ * optimum table and columns widths (true) or not (false).
10570
+ * Note that this parameter will be set by the initialisation routine. To
10571
+ * set a default use {@link DataTable.defaults}.
10572
+ * @type boolean
10573
+ */
10574
+ "bAutoWidth": null,
10575
+
10576
+ /**
10577
+ * Delay the creation of TR and TD elements until they are actually
10578
+ * needed by a driven page draw. This can give a significant speed
10579
+ * increase for Ajax source and Javascript source data, but makes no
10580
+ * difference at all fro DOM and server-side processing tables.
10581
+ * Note that this parameter will be set by the initialisation routine. To
10582
+ * set a default use {@link DataTable.defaults}.
10583
+ * @type boolean
10584
+ */
10585
+ "bDeferRender": null,
10586
+
10587
+ /**
10588
+ * Enable filtering on the table or not. Note that if this is disabled
10589
+ * then there is no filtering at all on the table, including fnFilter.
10590
+ * To just remove the filtering input use sDom and remove the 'f' option.
10591
+ * Note that this parameter will be set by the initialisation routine. To
10592
+ * set a default use {@link DataTable.defaults}.
10593
+ * @type boolean
10594
+ */
10595
+ "bFilter": null,
10596
+
10597
+ /**
10598
+ * Table information element (the 'Showing x of y records' div) enable
10599
+ * flag.
10600
+ * Note that this parameter will be set by the initialisation routine. To
10601
+ * set a default use {@link DataTable.defaults}.
10602
+ * @type boolean
10603
+ */
10604
+ "bInfo": null,
10605
+
10606
+ /**
10607
+ * Present a user control allowing the end user to change the page size
10608
+ * when pagination is enabled.
10609
+ * Note that this parameter will be set by the initialisation routine. To
10610
+ * set a default use {@link DataTable.defaults}.
10611
+ * @type boolean
10612
+ */
10613
+ "bLengthChange": null,
10614
+
10615
+ /**
10616
+ * Pagination enabled or not. Note that if this is disabled then length
10617
+ * changing must also be disabled.
10618
+ * Note that this parameter will be set by the initialisation routine. To
10619
+ * set a default use {@link DataTable.defaults}.
10620
+ * @type boolean
10621
+ */
10622
+ "bPaginate": null,
10623
+
10624
+ /**
10625
+ * Processing indicator enable flag whenever DataTables is enacting a
10626
+ * user request - typically an Ajax request for server-side processing.
10627
+ * Note that this parameter will be set by the initialisation routine. To
10628
+ * set a default use {@link DataTable.defaults}.
10629
+ * @type boolean
10630
+ */
10631
+ "bProcessing": null,
10632
+
10633
+ /**
10634
+ * Server-side processing enabled flag - when enabled DataTables will
10635
+ * get all data from the server for every draw - there is no filtering,
10636
+ * sorting or paging done on the client-side.
10637
+ * Note that this parameter will be set by the initialisation routine. To
10638
+ * set a default use {@link DataTable.defaults}.
10639
+ * @type boolean
10640
+ */
10641
+ "bServerSide": null,
10642
+
10643
+ /**
10644
+ * Sorting enablement flag.
10645
+ * Note that this parameter will be set by the initialisation routine. To
10646
+ * set a default use {@link DataTable.defaults}.
10647
+ * @type boolean
10648
+ */
10649
+ "bSort": null,
10650
+
10651
+ /**
10652
+ * Apply a class to the columns which are being sorted to provide a
10653
+ * visual highlight or not. This can slow things down when enabled since
10654
+ * there is a lot of DOM interaction.
10655
+ * Note that this parameter will be set by the initialisation routine. To
10656
+ * set a default use {@link DataTable.defaults}.
10657
+ * @type boolean
10658
+ */
10659
+ "bSortClasses": null,
10660
+
10661
+ /**
10662
+ * State saving enablement flag.
10663
+ * Note that this parameter will be set by the initialisation routine. To
10664
+ * set a default use {@link DataTable.defaults}.
10665
+ * @type boolean
10666
+ */
10667
+ "bStateSave": null
10668
+ },
10669
+
10670
+
10671
+ /**
10672
+ * Scrolling settings for a table.
10673
+ * @namespace
10674
+ */
10675
+ "oScroll": {
10676
+ /**
10677
+ * Indicate if DataTables should be allowed to set the padding / margin
10678
+ * etc for the scrolling header elements or not. Typically you will want
10679
+ * this.
10680
+ * Note that this parameter will be set by the initialisation routine. To
10681
+ * set a default use {@link DataTable.defaults}.
10682
+ * @type boolean
10683
+ */
10684
+ "bAutoCss": null,
10685
+
10686
+ /**
10687
+ * When the table is shorter in height than sScrollY, collapse the
10688
+ * table container down to the height of the table (when true).
10689
+ * Note that this parameter will be set by the initialisation routine. To
10690
+ * set a default use {@link DataTable.defaults}.
10691
+ * @type boolean
10692
+ */
10693
+ "bCollapse": null,
10694
+
10695
+ /**
10696
+ * Infinite scrolling enablement flag. Now deprecated in favour of
10697
+ * using the Scroller plug-in.
10698
+ * Note that this parameter will be set by the initialisation routine. To
10699
+ * set a default use {@link DataTable.defaults}.
10700
+ * @type boolean
10701
+ */
10702
+ "bInfinite": null,
10703
+
10704
+ /**
10705
+ * Width of the scrollbar for the web-browser's platform. Calculated
10706
+ * during table initialisation.
10707
+ * @type int
10708
+ * @default 0
10709
+ */
10710
+ "iBarWidth": 0,
10711
+
10712
+ /**
10713
+ * Space (in pixels) between the bottom of the scrolling container and
10714
+ * the bottom of the scrolling viewport before the next page is loaded
10715
+ * when using infinite scrolling.
10716
+ * Note that this parameter will be set by the initialisation routine. To
10717
+ * set a default use {@link DataTable.defaults}.
10718
+ * @type int
10719
+ */
10720
+ "iLoadGap": null,
10721
+
10722
+ /**
10723
+ * Viewport width for horizontal scrolling. Horizontal scrolling is
10724
+ * disabled if an empty string.
10725
+ * Note that this parameter will be set by the initialisation routine. To
10726
+ * set a default use {@link DataTable.defaults}.
10727
+ * @type string
10728
+ */
10729
+ "sX": null,
10730
+
10731
+ /**
10732
+ * Width to expand the table to when using x-scrolling. Typically you
10733
+ * should not need to use this.
10734
+ * Note that this parameter will be set by the initialisation routine. To
10735
+ * set a default use {@link DataTable.defaults}.
10736
+ * @type string
10737
+ * @deprecated
10738
+ */
10739
+ "sXInner": null,
10740
+
10741
+ /**
10742
+ * Viewport height for vertical scrolling. Vertical scrolling is disabled
10743
+ * if an empty string.
10744
+ * Note that this parameter will be set by the initialisation routine. To
10745
+ * set a default use {@link DataTable.defaults}.
10746
+ * @type string
10747
+ */
10748
+ "sY": null
10749
+ },
10750
+
10751
+ /**
10752
+ * Language information for the table.
10753
+ * @namespace
10754
+ * @extends DataTable.defaults.oLanguage
10755
+ */
10756
+ "oLanguage": {
10757
+ /**
10758
+ * Information callback function. See
10759
+ * {@link DataTable.defaults.fnInfoCallback}
10760
+ * @type function
10761
+ * @default null
10762
+ */
10763
+ "fnInfoCallback": null
10764
+ },
10765
+
10766
+ /**
10767
+ * Browser support parameters
10768
+ * @namespace
10769
+ */
10770
+ "oBrowser": {
10771
+ /**
10772
+ * Indicate if the browser incorrectly calculates width:100% inside a
10773
+ * scrolling element (IE6/7)
10774
+ * @type boolean
10775
+ * @default false
10776
+ */
10777
+ "bScrollOversize": false
10778
+ },
10779
+
10780
+ /**
10781
+ * Array referencing the nodes which are used for the features. The
10782
+ * parameters of this object match what is allowed by sDom - i.e.
10783
+ * <ul>
10784
+ * <li>'l' - Length changing</li>
10785
+ * <li>'f' - Filtering input</li>
10786
+ * <li>'t' - The table!</li>
10787
+ * <li>'i' - Information</li>
10788
+ * <li>'p' - Pagination</li>
10789
+ * <li>'r' - pRocessing</li>
10790
+ * </ul>
10791
+ * @type array
10792
+ * @default []
10793
+ */
10794
+ "aanFeatures": [],
10795
+
10796
+ /**
10797
+ * Store data information - see {@link DataTable.models.oRow} for detailed
10798
+ * information.
10799
+ * @type array
10800
+ * @default []
10801
+ */
10802
+ "aoData": [],
10803
+
10804
+ /**
10805
+ * Array of indexes which are in the current display (after filtering etc)
10806
+ * @type array
10807
+ * @default []
10808
+ */
10809
+ "aiDisplay": [],
10810
+
10811
+ /**
10812
+ * Array of indexes for display - no filtering
10813
+ * @type array
10814
+ * @default []
10815
+ */
10816
+ "aiDisplayMaster": [],
10817
+
10818
+ /**
10819
+ * Store information about each column that is in use
10820
+ * @type array
10821
+ * @default []
10822
+ */
10823
+ "aoColumns": [],
10824
+
10825
+ /**
10826
+ * Store information about the table's header
10827
+ * @type array
10828
+ * @default []
10829
+ */
10830
+ "aoHeader": [],
10831
+
10832
+ /**
10833
+ * Store information about the table's footer
10834
+ * @type array
10835
+ * @default []
10836
+ */
10837
+ "aoFooter": [],
10838
+
10839
+ /**
10840
+ * Search data array for regular expression searching
10841
+ * @type array
10842
+ * @default []
10843
+ */
10844
+ "asDataSearch": [],
10845
+
10846
+ /**
10847
+ * Store the applied global search information in case we want to force a
10848
+ * research or compare the old search to a new one.
10849
+ * Note that this parameter will be set by the initialisation routine. To
10850
+ * set a default use {@link DataTable.defaults}.
10851
+ * @namespace
10852
+ * @extends DataTable.models.oSearch
10853
+ */
10854
+ "oPreviousSearch": {},
10855
+
10856
+ /**
10857
+ * Store the applied search for each column - see
10858
+ * {@link DataTable.models.oSearch} for the format that is used for the
10859
+ * filtering information for each column.
10860
+ * @type array
10861
+ * @default []
10862
+ */
10863
+ "aoPreSearchCols": [],
10864
+
10865
+ /**
10866
+ * Sorting that is applied to the table. Note that the inner arrays are
10867
+ * used in the following manner:
10868
+ * <ul>
10869
+ * <li>Index 0 - column number</li>
10870
+ * <li>Index 1 - current sorting direction</li>
10871
+ * <li>Index 2 - index of asSorting for this column</li>
10872
+ * </ul>
10873
+ * Note that this parameter will be set by the initialisation routine. To
10874
+ * set a default use {@link DataTable.defaults}.
10875
+ * @type array
10876
+ * @todo These inner arrays should really be objects
10877
+ */
10878
+ "aaSorting": null,
10879
+
10880
+ /**
10881
+ * Sorting that is always applied to the table (i.e. prefixed in front of
10882
+ * aaSorting).
10883
+ * Note that this parameter will be set by the initialisation routine. To
10884
+ * set a default use {@link DataTable.defaults}.
10885
+ * @type array|null
10886
+ * @default null
10887
+ */
10888
+ "aaSortingFixed": null,
10889
+
10890
+ /**
10891
+ * Classes to use for the striping of a table.
10892
+ * Note that this parameter will be set by the initialisation routine. To
10893
+ * set a default use {@link DataTable.defaults}.
10894
+ * @type array
10895
+ * @default []
10896
+ */
10897
+ "asStripeClasses": null,
10898
+
10899
+ /**
10900
+ * If restoring a table - we should restore its striping classes as well
10901
+ * @type array
10902
+ * @default []
10903
+ */
10904
+ "asDestroyStripes": [],
10905
+
10906
+ /**
10907
+ * If restoring a table - we should restore its width
10908
+ * @type int
10909
+ * @default 0
10910
+ */
10911
+ "sDestroyWidth": 0,
10912
+
10913
+ /**
10914
+ * Callback functions array for every time a row is inserted (i.e. on a draw).
10915
+ * @type array
10916
+ * @default []
10917
+ */
10918
+ "aoRowCallback": [],
10919
+
10920
+ /**
10921
+ * Callback functions for the header on each draw.
10922
+ * @type array
10923
+ * @default []
10924
+ */
10925
+ "aoHeaderCallback": [],
10926
+
10927
+ /**
10928
+ * Callback function for the footer on each draw.
10929
+ * @type array
10930
+ * @default []
10931
+ */
10932
+ "aoFooterCallback": [],
10933
+
10934
+ /**
10935
+ * Array of callback functions for draw callback functions
10936
+ * @type array
10937
+ * @default []
10938
+ */
10939
+ "aoDrawCallback": [],
10940
+
10941
+ /**
10942
+ * Array of callback functions for row created function
10943
+ * @type array
10944
+ * @default []
10945
+ */
10946
+ "aoRowCreatedCallback": [],
10947
+
10948
+ /**
10949
+ * Callback functions for just before the table is redrawn. A return of
10950
+ * false will be used to cancel the draw.
10951
+ * @type array
10952
+ * @default []
10953
+ */
10954
+ "aoPreDrawCallback": [],
10955
+
10956
+ /**
10957
+ * Callback functions for when the table has been initialised.
10958
+ * @type array
10959
+ * @default []
10960
+ */
10961
+ "aoInitComplete": [],
10962
+
10963
+
10964
+ /**
10965
+ * Callbacks for modifying the settings to be stored for state saving, prior to
10966
+ * saving state.
10967
+ * @type array
10968
+ * @default []
10969
+ */
10970
+ "aoStateSaveParams": [],
10971
+
10972
+ /**
10973
+ * Callbacks for modifying the settings that have been stored for state saving
10974
+ * prior to using the stored values to restore the state.
10975
+ * @type array
10976
+ * @default []
10977
+ */
10978
+ "aoStateLoadParams": [],
10979
+
10980
+ /**
10981
+ * Callbacks for operating on the settings object once the saved state has been
10982
+ * loaded
10983
+ * @type array
10984
+ * @default []
10985
+ */
10986
+ "aoStateLoaded": [],
10987
+
10988
+ /**
10989
+ * Cache the table ID for quick access
10990
+ * @type string
10991
+ * @default <i>Empty string</i>
10992
+ */
10993
+ "sTableId": "",
10994
+
10995
+ /**
10996
+ * The TABLE node for the main table
10997
+ * @type node
10998
+ * @default null
10999
+ */
11000
+ "nTable": null,
11001
+
11002
+ /**
11003
+ * Permanent ref to the thead element
11004
+ * @type node
11005
+ * @default null
11006
+ */
11007
+ "nTHead": null,
11008
+
11009
+ /**
11010
+ * Permanent ref to the tfoot element - if it exists
11011
+ * @type node
11012
+ * @default null
11013
+ */
11014
+ "nTFoot": null,
11015
+
11016
+ /**
11017
+ * Permanent ref to the tbody element
11018
+ * @type node
11019
+ * @default null
11020
+ */
11021
+ "nTBody": null,
11022
+
11023
+ /**
11024
+ * Cache the wrapper node (contains all DataTables controlled elements)
11025
+ * @type node
11026
+ * @default null
11027
+ */
11028
+ "nTableWrapper": null,
11029
+
11030
+ /**
11031
+ * Indicate if when using server-side processing the loading of data
11032
+ * should be deferred until the second draw.
11033
+ * Note that this parameter will be set by the initialisation routine. To
11034
+ * set a default use {@link DataTable.defaults}.
11035
+ * @type boolean
11036
+ * @default false
11037
+ */
11038
+ "bDeferLoading": false,
11039
+
11040
+ /**
11041
+ * Indicate if all required information has been read in
11042
+ * @type boolean
11043
+ * @default false
11044
+ */
11045
+ "bInitialised": false,
11046
+
11047
+ /**
11048
+ * Information about open rows. Each object in the array has the parameters
11049
+ * 'nTr' and 'nParent'
11050
+ * @type array
11051
+ * @default []
11052
+ */
11053
+ "aoOpenRows": [],
11054
+
11055
+ /**
11056
+ * Dictate the positioning of DataTables' control elements - see
11057
+ * {@link DataTable.model.oInit.sDom}.
11058
+ * Note that this parameter will be set by the initialisation routine. To
11059
+ * set a default use {@link DataTable.defaults}.
11060
+ * @type string
11061
+ * @default null
11062
+ */
11063
+ "sDom": null,
11064
+
11065
+ /**
11066
+ * Which type of pagination should be used.
11067
+ * Note that this parameter will be set by the initialisation routine. To
11068
+ * set a default use {@link DataTable.defaults}.
11069
+ * @type string
11070
+ * @default two_button
11071
+ */
11072
+ "sPaginationType": "two_button",
11073
+
11074
+ /**
11075
+ * The cookie duration (for bStateSave) in seconds.
11076
+ * Note that this parameter will be set by the initialisation routine. To
11077
+ * set a default use {@link DataTable.defaults}.
11078
+ * @type int
11079
+ * @default 0
11080
+ */
11081
+ "iCookieDuration": 0,
11082
+
11083
+ /**
11084
+ * The cookie name prefix.
11085
+ * Note that this parameter will be set by the initialisation routine. To
11086
+ * set a default use {@link DataTable.defaults}.
11087
+ * @type string
11088
+ * @default <i>Empty string</i>
11089
+ */
11090
+ "sCookiePrefix": "",
11091
+
11092
+ /**
11093
+ * Callback function for cookie creation.
11094
+ * Note that this parameter will be set by the initialisation routine. To
11095
+ * set a default use {@link DataTable.defaults}.
11096
+ * @type function
11097
+ * @default null
11098
+ */
11099
+ "fnCookieCallback": null,
11100
+
11101
+ /**
11102
+ * Array of callback functions for state saving. Each array element is an
11103
+ * object with the following parameters:
11104
+ * <ul>
11105
+ * <li>function:fn - function to call. Takes two parameters, oSettings
11106
+ * and the JSON string to save that has been thus far created. Returns
11107
+ * a JSON string to be inserted into a json object
11108
+ * (i.e. '"param": [ 0, 1, 2]')</li>
11109
+ * <li>string:sName - name of callback</li>
11110
+ * </ul>
11111
+ * @type array
11112
+ * @default []
11113
+ */
11114
+ "aoStateSave": [],
11115
+
11116
+ /**
11117
+ * Array of callback functions for state loading. Each array element is an
11118
+ * object with the following parameters:
11119
+ * <ul>
11120
+ * <li>function:fn - function to call. Takes two parameters, oSettings
11121
+ * and the object stored. May return false to cancel state loading</li>
11122
+ * <li>string:sName - name of callback</li>
11123
+ * </ul>
11124
+ * @type array
11125
+ * @default []
11126
+ */
11127
+ "aoStateLoad": [],
11128
+
11129
+ /**
11130
+ * State that was loaded from the cookie. Useful for back reference
11131
+ * @type object
11132
+ * @default null
11133
+ */
11134
+ "oLoadedState": null,
11135
+
11136
+ /**
11137
+ * Source url for AJAX data for the table.
11138
+ * Note that this parameter will be set by the initialisation routine. To
11139
+ * set a default use {@link DataTable.defaults}.
11140
+ * @type string
11141
+ * @default null
11142
+ */
11143
+ "sAjaxSource": null,
11144
+
11145
+ /**
11146
+ * Property from a given object from which to read the table data from. This
11147
+ * can be an empty string (when not server-side processing), in which case
11148
+ * it is assumed an an array is given directly.
11149
+ * Note that this parameter will be set by the initialisation routine. To
11150
+ * set a default use {@link DataTable.defaults}.
11151
+ * @type string
11152
+ */
11153
+ "sAjaxDataProp": null,
11154
+
11155
+ /**
11156
+ * Note if draw should be blocked while getting data
11157
+ * @type boolean
11158
+ * @default true
11159
+ */
11160
+ "bAjaxDataGet": true,
11161
+
11162
+ /**
11163
+ * The last jQuery XHR object that was used for server-side data gathering.
11164
+ * This can be used for working with the XHR information in one of the
11165
+ * callbacks
11166
+ * @type object
11167
+ * @default null
11168
+ */
11169
+ "jqXHR": null,
11170
+
11171
+ /**
11172
+ * Function to get the server-side data.
11173
+ * Note that this parameter will be set by the initialisation routine. To
11174
+ * set a default use {@link DataTable.defaults}.
11175
+ * @type function
11176
+ */
11177
+ "fnServerData": null,
11178
+
11179
+ /**
11180
+ * Functions which are called prior to sending an Ajax request so extra
11181
+ * parameters can easily be sent to the server
11182
+ * @type array
11183
+ * @default []
11184
+ */
11185
+ "aoServerParams": [],
11186
+
11187
+ /**
11188
+ * Send the XHR HTTP method - GET or POST (could be PUT or DELETE if
11189
+ * required).
11190
+ * Note that this parameter will be set by the initialisation routine. To
11191
+ * set a default use {@link DataTable.defaults}.
11192
+ * @type string
11193
+ */
11194
+ "sServerMethod": null,
11195
+
11196
+ /**
11197
+ * Format numbers for display.
11198
+ * Note that this parameter will be set by the initialisation routine. To
11199
+ * set a default use {@link DataTable.defaults}.
11200
+ * @type function
11201
+ */
11202
+ "fnFormatNumber": null,
11203
+
11204
+ /**
11205
+ * List of options that can be used for the user selectable length menu.
11206
+ * Note that this parameter will be set by the initialisation routine. To
11207
+ * set a default use {@link DataTable.defaults}.
11208
+ * @type array
11209
+ * @default []
11210
+ */
11211
+ "aLengthMenu": null,
11212
+
11213
+ /**
11214
+ * Counter for the draws that the table does. Also used as a tracker for
11215
+ * server-side processing
11216
+ * @type int
11217
+ * @default 0
11218
+ */
11219
+ "iDraw": 0,
11220
+
11221
+ /**
11222
+ * Indicate if a redraw is being done - useful for Ajax
11223
+ * @type boolean
11224
+ * @default false
11225
+ */
11226
+ "bDrawing": false,
11227
+
11228
+ /**
11229
+ * Draw index (iDraw) of the last error when parsing the returned data
11230
+ * @type int
11231
+ * @default -1
11232
+ */
11233
+ "iDrawError": -1,
11234
+
11235
+ /**
11236
+ * Paging display length
11237
+ * @type int
11238
+ * @default 10
11239
+ */
11240
+ "_iDisplayLength": 10,
11241
+
11242
+ /**
11243
+ * Paging start point - aiDisplay index
11244
+ * @type int
11245
+ * @default 0
11246
+ */
11247
+ "_iDisplayStart": 0,
11248
+
11249
+ /**
11250
+ * Paging end point - aiDisplay index. Use fnDisplayEnd rather than
11251
+ * this property to get the end point
11252
+ * @type int
11253
+ * @default 10
11254
+ * @private
11255
+ */
11256
+ "_iDisplayEnd": 10,
11257
+
11258
+ /**
11259
+ * Server-side processing - number of records in the result set
11260
+ * (i.e. before filtering), Use fnRecordsTotal rather than
11261
+ * this property to get the value of the number of records, regardless of
11262
+ * the server-side processing setting.
11263
+ * @type int
11264
+ * @default 0
11265
+ * @private
11266
+ */
11267
+ "_iRecordsTotal": 0,
11268
+
11269
+ /**
11270
+ * Server-side processing - number of records in the current display set
11271
+ * (i.e. after filtering). Use fnRecordsDisplay rather than
11272
+ * this property to get the value of the number of records, regardless of
11273
+ * the server-side processing setting.
11274
+ * @type boolean
11275
+ * @default 0
11276
+ * @private
11277
+ */
11278
+ "_iRecordsDisplay": 0,
11279
+
11280
+ /**
11281
+ * Flag to indicate if jQuery UI marking and classes should be used.
11282
+ * Note that this parameter will be set by the initialisation routine. To
11283
+ * set a default use {@link DataTable.defaults}.
11284
+ * @type boolean
11285
+ */
11286
+ "bJUI": null,
11287
+
11288
+ /**
11289
+ * The classes to use for the table
11290
+ * @type object
11291
+ * @default {}
11292
+ */
11293
+ "oClasses": {},
11294
+
11295
+ /**
11296
+ * Flag attached to the settings object so you can check in the draw
11297
+ * callback if filtering has been done in the draw. Deprecated in favour of
11298
+ * events.
11299
+ * @type boolean
11300
+ * @default false
11301
+ * @deprecated
11302
+ */
11303
+ "bFiltered": false,
11304
+
11305
+ /**
11306
+ * Flag attached to the settings object so you can check in the draw
11307
+ * callback if sorting has been done in the draw. Deprecated in favour of
11308
+ * events.
11309
+ * @type boolean
11310
+ * @default false
11311
+ * @deprecated
11312
+ */
11313
+ "bSorted": false,
11314
+
11315
+ /**
11316
+ * Indicate that if multiple rows are in the header and there is more than
11317
+ * one unique cell per column, if the top one (true) or bottom one (false)
11318
+ * should be used for sorting / title by DataTables.
11319
+ * Note that this parameter will be set by the initialisation routine. To
11320
+ * set a default use {@link DataTable.defaults}.
11321
+ * @type boolean
11322
+ */
11323
+ "bSortCellsTop": null,
11324
+
11325
+ /**
11326
+ * Initialisation object that is used for the table
11327
+ * @type object
11328
+ * @default null
11329
+ */
11330
+ "oInit": null,
11331
+
11332
+ /**
11333
+ * Destroy callback functions - for plug-ins to attach themselves to the
11334
+ * destroy so they can clean up markup and events.
11335
+ * @type array
11336
+ * @default []
11337
+ */
11338
+ "aoDestroyCallback": [],
11339
+
11340
+
11341
+ /**
11342
+ * Get the number of records in the current record set, before filtering
11343
+ * @type function
11344
+ */
11345
+ "fnRecordsTotal": function ()
11346
+ {
11347
+ if ( this.oFeatures.bServerSide ) {
11348
+ return parseInt(this._iRecordsTotal, 10);
11349
+ } else {
11350
+ return this.aiDisplayMaster.length;
11351
+ }
11352
+ },
11353
+
11354
+ /**
11355
+ * Get the number of records in the current record set, after filtering
11356
+ * @type function
11357
+ */
11358
+ "fnRecordsDisplay": function ()
11359
+ {
11360
+ if ( this.oFeatures.bServerSide ) {
11361
+ return parseInt(this._iRecordsDisplay, 10);
11362
+ } else {
11363
+ return this.aiDisplay.length;
11364
+ }
11365
+ },
11366
+
11367
+ /**
11368
+ * Set the display end point - aiDisplay index
11369
+ * @type function
11370
+ * @todo Should do away with _iDisplayEnd and calculate it on-the-fly here
11371
+ */
11372
+ "fnDisplayEnd": function ()
11373
+ {
11374
+ if ( this.oFeatures.bServerSide ) {
11375
+ if ( this.oFeatures.bPaginate === false || this._iDisplayLength == -1 ) {
11376
+ return this._iDisplayStart+this.aiDisplay.length;
11377
+ } else {
11378
+ return Math.min( this._iDisplayStart+this._iDisplayLength,
11379
+ this._iRecordsDisplay );
11380
+ }
11381
+ } else {
11382
+ return this._iDisplayEnd;
11383
+ }
11384
+ },
11385
+
11386
+ /**
11387
+ * The DataTables object for this table
11388
+ * @type object
11389
+ * @default null
11390
+ */
11391
+ "oInstance": null,
11392
+
11393
+ /**
11394
+ * Unique identifier for each instance of the DataTables object. If there
11395
+ * is an ID on the table node, then it takes that value, otherwise an
11396
+ * incrementing internal counter is used.
11397
+ * @type string
11398
+ * @default null
11399
+ */
11400
+ "sInstance": null,
11401
+
11402
+ /**
11403
+ * tabindex attribute value that is added to DataTables control elements, allowing
11404
+ * keyboard navigation of the table and its controls.
11405
+ */
11406
+ "iTabIndex": 0,
11407
+
11408
+ /**
11409
+ * DIV container for the footer scrolling table if scrolling
11410
+ */
11411
+ "nScrollHead": null,
11412
+
11413
+ /**
11414
+ * DIV container for the footer scrolling table if scrolling
11415
+ */
11416
+ "nScrollFoot": null
11417
+ };
11418
+
11419
+ /**
11420
+ * Extension object for DataTables that is used to provide all extension options.
11421
+ *
11422
+ * Note that the <i>DataTable.ext</i> object is available through
11423
+ * <i>jQuery.fn.dataTable.ext</i> where it may be accessed and manipulated. It is
11424
+ * also aliased to <i>jQuery.fn.dataTableExt</i> for historic reasons.
11425
+ * @namespace
11426
+ * @extends DataTable.models.ext
11427
+ */
11428
+ DataTable.ext = $.extend( true, {}, DataTable.models.ext );
11429
+
11430
+ $.extend( DataTable.ext.oStdClasses, {
11431
+ "sTable": "dataTable",
11432
+
11433
+ /* Two buttons buttons */
11434
+ "sPagePrevEnabled": "paginate_enabled_previous",
11435
+ "sPagePrevDisabled": "paginate_disabled_previous",
11436
+ "sPageNextEnabled": "paginate_enabled_next",
11437
+ "sPageNextDisabled": "paginate_disabled_next",
11438
+ "sPageJUINext": "",
11439
+ "sPageJUIPrev": "",
11440
+
11441
+ /* Full numbers paging buttons */
11442
+ "sPageButton": "paginate_button",
11443
+ "sPageButtonActive": "paginate_active",
11444
+ "sPageButtonStaticDisabled": "paginate_button paginate_button_disabled",
11445
+ "sPageFirst": "first",
11446
+ "sPagePrevious": "previous",
11447
+ "sPageNext": "next",
11448
+ "sPageLast": "last",
11449
+
11450
+ /* Striping classes */
11451
+ "sStripeOdd": "odd",
11452
+ "sStripeEven": "even",
11453
+
11454
+ /* Empty row */
11455
+ "sRowEmpty": "dataTables_empty",
11456
+
11457
+ /* Features */
11458
+ "sWrapper": "dataTables_wrapper",
11459
+ "sFilter": "dataTables_filter",
11460
+ "sInfo": "dataTables_info",
11461
+ "sPaging": "dataTables_paginate paging_", /* Note that the type is postfixed */
11462
+ "sLength": "dataTables_length",
11463
+ "sProcessing": "dataTables_processing",
11464
+
11465
+ /* Sorting */
11466
+ "sSortAsc": "sorting_asc",
11467
+ "sSortDesc": "sorting_desc",
11468
+ "sSortable": "sorting", /* Sortable in both directions */
11469
+ "sSortableAsc": "sorting_asc_disabled",
11470
+ "sSortableDesc": "sorting_desc_disabled",
11471
+ "sSortableNone": "sorting_disabled",
11472
+ "sSortColumn": "sorting_", /* Note that an int is postfixed for the sorting order */
11473
+ "sSortJUIAsc": "",
11474
+ "sSortJUIDesc": "",
11475
+ "sSortJUI": "",
11476
+ "sSortJUIAscAllowed": "",
11477
+ "sSortJUIDescAllowed": "",
11478
+ "sSortJUIWrapper": "",
11479
+ "sSortIcon": "",
11480
+
11481
+ /* Scrolling */
11482
+ "sScrollWrapper": "dataTables_scroll",
11483
+ "sScrollHead": "dataTables_scrollHead",
11484
+ "sScrollHeadInner": "dataTables_scrollHeadInner",
11485
+ "sScrollBody": "dataTables_scrollBody",
11486
+ "sScrollFoot": "dataTables_scrollFoot",
11487
+ "sScrollFootInner": "dataTables_scrollFootInner",
11488
+
11489
+ /* Misc */
11490
+ "sFooterTH": "",
11491
+ "sJUIHeader": "",
11492
+ "sJUIFooter": ""
11493
+ } );
11494
+
11495
+
11496
+ $.extend( DataTable.ext.oJUIClasses, DataTable.ext.oStdClasses, {
11497
+ /* Two buttons buttons */
11498
+ "sPagePrevEnabled": "fg-button ui-button ui-state-default ui-corner-left",
11499
+ "sPagePrevDisabled": "fg-button ui-button ui-state-default ui-corner-left ui-state-disabled",
11500
+ "sPageNextEnabled": "fg-button ui-button ui-state-default ui-corner-right",
11501
+ "sPageNextDisabled": "fg-button ui-button ui-state-default ui-corner-right ui-state-disabled",
11502
+ "sPageJUINext": "ui-icon ui-icon-circle-arrow-e",
11503
+ "sPageJUIPrev": "ui-icon ui-icon-circle-arrow-w",
11504
+
11505
+ /* Full numbers paging buttons */
11506
+ "sPageButton": "fg-button ui-button ui-state-default",
11507
+ "sPageButtonActive": "fg-button ui-button ui-state-default ui-state-disabled",
11508
+ "sPageButtonStaticDisabled": "fg-button ui-button ui-state-default ui-state-disabled",
11509
+ "sPageFirst": "first ui-corner-tl ui-corner-bl",
11510
+ "sPageLast": "last ui-corner-tr ui-corner-br",
11511
+
11512
+ /* Features */
11513
+ "sPaging": "dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi "+
11514
+ "ui-buttonset-multi paging_", /* Note that the type is postfixed */
11515
+
11516
+ /* Sorting */
11517
+ "sSortAsc": "ui-state-default",
11518
+ "sSortDesc": "ui-state-default",
11519
+ "sSortable": "ui-state-default",
11520
+ "sSortableAsc": "ui-state-default",
11521
+ "sSortableDesc": "ui-state-default",
11522
+ "sSortableNone": "ui-state-default",
11523
+ "sSortJUIAsc": "css_right ui-icon ui-icon-triangle-1-n",
11524
+ "sSortJUIDesc": "css_right ui-icon ui-icon-triangle-1-s",
11525
+ "sSortJUI": "css_right ui-icon ui-icon-carat-2-n-s",
11526
+ "sSortJUIAscAllowed": "css_right ui-icon ui-icon-carat-1-n",
11527
+ "sSortJUIDescAllowed": "css_right ui-icon ui-icon-carat-1-s",
11528
+ "sSortJUIWrapper": "DataTables_sort_wrapper",
11529
+ "sSortIcon": "DataTables_sort_icon",
11530
+
11531
+ /* Scrolling */
11532
+ "sScrollHead": "dataTables_scrollHead ui-state-default",
11533
+ "sScrollFoot": "dataTables_scrollFoot ui-state-default",
11534
+
11535
+ /* Misc */
11536
+ "sFooterTH": "ui-state-default",
11537
+ "sJUIHeader": "fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix",
11538
+ "sJUIFooter": "fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"
11539
+ } );
11540
+
11541
+
11542
+ /*
11543
+ * Variable: oPagination
11544
+ * Purpose:
11545
+ * Scope: jQuery.fn.dataTableExt
11546
+ */
11547
+ $.extend( DataTable.ext.oPagination, {
11548
+ /*
11549
+ * Variable: two_button
11550
+ * Purpose: Standard two button (forward/back) pagination
11551
+ * Scope: jQuery.fn.dataTableExt.oPagination
11552
+ */
11553
+ "two_button": {
11554
+ /*
11555
+ * Function: oPagination.two_button.fnInit
11556
+ * Purpose: Initialise dom elements required for pagination with forward/back buttons only
11557
+ * Returns: -
11558
+ * Inputs: object:oSettings - dataTables settings object
11559
+ * node:nPaging - the DIV which contains this pagination control
11560
+ * function:fnCallbackDraw - draw function which must be called on update
11561
+ */
11562
+ "fnInit": function ( oSettings, nPaging, fnCallbackDraw )
11563
+ {
11564
+ var oLang = oSettings.oLanguage.oPaginate;
11565
+ var oClasses = oSettings.oClasses;
11566
+ var fnClickHandler = function ( e ) {
11567
+ if ( oSettings.oApi._fnPageChange( oSettings, e.data.action ) )
11568
+ {
11569
+ fnCallbackDraw( oSettings );
11570
+ }
11571
+ };
11572
+
11573
+ var sAppend = (!oSettings.bJUI) ?
11574
+ '<a class="'+oSettings.oClasses.sPagePrevDisabled+'" tabindex="'+oSettings.iTabIndex+'" role="button">'+oLang.sPrevious+'</a>'+
11575
+ '<a class="'+oSettings.oClasses.sPageNextDisabled+'" tabindex="'+oSettings.iTabIndex+'" role="button">'+oLang.sNext+'</a>'
11576
+ :
11577
+ '<a class="'+oSettings.oClasses.sPagePrevDisabled+'" tabindex="'+oSettings.iTabIndex+'" role="button"><span class="'+oSettings.oClasses.sPageJUIPrev+'"></span></a>'+
11578
+ '<a class="'+oSettings.oClasses.sPageNextDisabled+'" tabindex="'+oSettings.iTabIndex+'" role="button"><span class="'+oSettings.oClasses.sPageJUINext+'"></span></a>';
11579
+ $(nPaging).append( sAppend );
11580
+
11581
+ var els = $('a', nPaging);
11582
+ var nPrevious = els[0],
11583
+ nNext = els[1];
11584
+
11585
+ oSettings.oApi._fnBindAction( nPrevious, {action: "previous"}, fnClickHandler );
11586
+ oSettings.oApi._fnBindAction( nNext, {action: "next"}, fnClickHandler );
11587
+
11588
+ /* ID the first elements only */
11589
+ if ( !oSettings.aanFeatures.p )
11590
+ {
11591
+ nPaging.id = oSettings.sTableId+'_paginate';
11592
+ nPrevious.id = oSettings.sTableId+'_previous';
11593
+ nNext.id = oSettings.sTableId+'_next';
11594
+
11595
+ nPrevious.setAttribute('aria-controls', oSettings.sTableId);
11596
+ nNext.setAttribute('aria-controls', oSettings.sTableId);
11597
+ }
11598
+ },
11599
+
11600
+ /*
11601
+ * Function: oPagination.two_button.fnUpdate
11602
+ * Purpose: Update the two button pagination at the end of the draw
11603
+ * Returns: -
11604
+ * Inputs: object:oSettings - dataTables settings object
11605
+ * function:fnCallbackDraw - draw function to call on page change
11606
+ */
11607
+ "fnUpdate": function ( oSettings, fnCallbackDraw )
11608
+ {
11609
+ if ( !oSettings.aanFeatures.p )
11610
+ {
11611
+ return;
11612
+ }
11613
+
11614
+ var oClasses = oSettings.oClasses;
11615
+ var an = oSettings.aanFeatures.p;
11616
+
11617
+ /* Loop over each instance of the pager */
11618
+ for ( var i=0, iLen=an.length ; i<iLen ; i++ )
11619
+ {
11620
+ if ( an[i].childNodes.length !== 0 )
11621
+ {
11622
+ an[i].childNodes[0].className = ( oSettings._iDisplayStart === 0 ) ?
11623
+ oClasses.sPagePrevDisabled : oClasses.sPagePrevEnabled;
11624
+
11625
+ an[i].childNodes[1].className = ( oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay() ) ?
11626
+ oClasses.sPageNextDisabled : oClasses.sPageNextEnabled;
11627
+ }
11628
+ }
11629
+ }
11630
+ },
11631
+
11632
+
11633
+ /*
11634
+ * Variable: iFullNumbersShowPages
11635
+ * Purpose: Change the number of pages which can be seen
11636
+ * Scope: jQuery.fn.dataTableExt.oPagination
11637
+ */
11638
+ "iFullNumbersShowPages": 5,
11639
+
11640
+ /*
11641
+ * Variable: full_numbers
11642
+ * Purpose: Full numbers pagination
11643
+ * Scope: jQuery.fn.dataTableExt.oPagination
11644
+ */
11645
+ "full_numbers": {
11646
+ /*
11647
+ * Function: oPagination.full_numbers.fnInit
11648
+ * Purpose: Initialise dom elements required for pagination with a list of the pages
11649
+ * Returns: -
11650
+ * Inputs: object:oSettings - dataTables settings object
11651
+ * node:nPaging - the DIV which contains this pagination control
11652
+ * function:fnCallbackDraw - draw function which must be called on update
11653
+ */
11654
+ "fnInit": function ( oSettings, nPaging, fnCallbackDraw )
11655
+ {
11656
+ var oLang = oSettings.oLanguage.oPaginate;
11657
+ var oClasses = oSettings.oClasses;
11658
+ var fnClickHandler = function ( e ) {
11659
+ if ( oSettings.oApi._fnPageChange( oSettings, e.data.action ) )
11660
+ {
11661
+ fnCallbackDraw( oSettings );
11662
+ }
11663
+ };
11664
+
11665
+ $(nPaging).append(
11666
+ '<a tabindex="'+oSettings.iTabIndex+'" class="'+oClasses.sPageButton+" "+oClasses.sPageFirst+'">'+oLang.sFirst+'</a>'+
11667
+ '<a tabindex="'+oSettings.iTabIndex+'" class="'+oClasses.sPageButton+" "+oClasses.sPagePrevious+'">'+oLang.sPrevious+'</a>'+
11668
+ '<span></span>'+
11669
+ '<a tabindex="'+oSettings.iTabIndex+'" class="'+oClasses.sPageButton+" "+oClasses.sPageNext+'">'+oLang.sNext+'</a>'+
11670
+ '<a tabindex="'+oSettings.iTabIndex+'" class="'+oClasses.sPageButton+" "+oClasses.sPageLast+'">'+oLang.sLast+'</a>'
11671
+ );
11672
+ var els = $('a', nPaging);
11673
+ var nFirst = els[0],
11674
+ nPrev = els[1],
11675
+ nNext = els[2],
11676
+ nLast = els[3];
11677
+
11678
+ oSettings.oApi._fnBindAction( nFirst, {action: "first"}, fnClickHandler );
11679
+ oSettings.oApi._fnBindAction( nPrev, {action: "previous"}, fnClickHandler );
11680
+ oSettings.oApi._fnBindAction( nNext, {action: "next"}, fnClickHandler );
11681
+ oSettings.oApi._fnBindAction( nLast, {action: "last"}, fnClickHandler );
11682
+
11683
+ /* ID the first elements only */
11684
+ if ( !oSettings.aanFeatures.p )
11685
+ {
11686
+ nPaging.id = oSettings.sTableId+'_paginate';
11687
+ nFirst.id =oSettings.sTableId+'_first';
11688
+ nPrev.id =oSettings.sTableId+'_previous';
11689
+ nNext.id =oSettings.sTableId+'_next';
11690
+ nLast.id =oSettings.sTableId+'_last';
11691
+ }
11692
+ },
11693
+
11694
+ /*
11695
+ * Function: oPagination.full_numbers.fnUpdate
11696
+ * Purpose: Update the list of page buttons shows
11697
+ * Returns: -
11698
+ * Inputs: object:oSettings - dataTables settings object
11699
+ * function:fnCallbackDraw - draw function to call on page change
11700
+ */
11701
+ "fnUpdate": function ( oSettings, fnCallbackDraw )
11702
+ {
11703
+ if ( !oSettings.aanFeatures.p )
11704
+ {
11705
+ return;
11706
+ }
11707
+
11708
+ var iPageCount = DataTable.ext.oPagination.iFullNumbersShowPages;
11709
+ var iPageCountHalf = Math.floor(iPageCount / 2);
11710
+ var iPages = Math.ceil((oSettings.fnRecordsDisplay()) / oSettings._iDisplayLength);
11711
+ var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
11712
+ var sList = "";
11713
+ var iStartButton, iEndButton, i, iLen;
11714
+ var oClasses = oSettings.oClasses;
11715
+ var anButtons, anStatic, nPaginateList;
11716
+ var an = oSettings.aanFeatures.p;
11717
+ var fnBind = function (j) {
11718
+ oSettings.oApi._fnBindAction( this, {"page": j+iStartButton-1}, function(e) {
11719
+ /* Use the information in the element to jump to the required page */
11720
+ oSettings.oApi._fnPageChange( oSettings, e.data.page );
11721
+ fnCallbackDraw( oSettings );
11722
+ e.preventDefault();
11723
+ } );
11724
+ };
11725
+
11726
+ /* Pages calculation */
11727
+ if ( oSettings._iDisplayLength === -1 )
11728
+ {
11729
+ iStartButton = 1;
11730
+ iEndButton = 1;
11731
+ iCurrentPage = 1;
11732
+ }
11733
+ else if (iPages < iPageCount)
11734
+ {
11735
+ iStartButton = 1;
11736
+ iEndButton = iPages;
11737
+ }
11738
+ else if (iCurrentPage <= iPageCountHalf)
11739
+ {
11740
+ iStartButton = 1;
11741
+ iEndButton = iPageCount;
11742
+ }
11743
+ else if (iCurrentPage >= (iPages - iPageCountHalf))
11744
+ {
11745
+ iStartButton = iPages - iPageCount + 1;
11746
+ iEndButton = iPages;
11747
+ }
11748
+ else
11749
+ {
11750
+ iStartButton = iCurrentPage - Math.ceil(iPageCount / 2) + 1;
11751
+ iEndButton = iStartButton + iPageCount - 1;
11752
+ }
11753
+
11754
+
11755
+ /* Build the dynamic list */
11756
+ for ( i=iStartButton ; i<=iEndButton ; i++ )
11757
+ {
11758
+ sList += (iCurrentPage !== i) ?
11759
+ '<a tabindex="'+oSettings.iTabIndex+'" class="'+oClasses.sPageButton+'">'+oSettings.fnFormatNumber(i)+'</a>' :
11760
+ '<a tabindex="'+oSettings.iTabIndex+'" class="'+oClasses.sPageButtonActive+'">'+oSettings.fnFormatNumber(i)+'</a>';
11761
+ }
11762
+
11763
+ /* Loop over each instance of the pager */
11764
+ for ( i=0, iLen=an.length ; i<iLen ; i++ )
11765
+ {
11766
+ if ( an[i].childNodes.length === 0 )
11767
+ {
11768
+ continue;
11769
+ }
11770
+
11771
+ /* Build up the dynamic list first - html and listeners */
11772
+ $('span:eq(0)', an[i])
11773
+ .html( sList )
11774
+ .children('a').each( fnBind );
11775
+
11776
+ /* Update the permanent button's classes */
11777
+ anButtons = an[i].getElementsByTagName('a');
11778
+ anStatic = [
11779
+ anButtons[0], anButtons[1],
11780
+ anButtons[anButtons.length-2], anButtons[anButtons.length-1]
11781
+ ];
11782
+
11783
+ $(anStatic).removeClass( oClasses.sPageButton+" "+oClasses.sPageButtonActive+" "+oClasses.sPageButtonStaticDisabled );
11784
+ $([anStatic[0], anStatic[1]]).addClass(
11785
+ (iCurrentPage==1) ?
11786
+ oClasses.sPageButtonStaticDisabled :
11787
+ oClasses.sPageButton
11788
+ );
11789
+ $([anStatic[2], anStatic[3]]).addClass(
11790
+ (iPages===0 || iCurrentPage===iPages || oSettings._iDisplayLength===-1) ?
11791
+ oClasses.sPageButtonStaticDisabled :
11792
+ oClasses.sPageButton
11793
+ );
11794
+ }
11795
+ }
11796
+ }
11797
+ } );
11798
+
11799
+ $.extend( DataTable.ext.oSort, {
11800
+ /*
11801
+ * text sorting
11802
+ */
11803
+ "string-pre": function ( a )
11804
+ {
11805
+ if ( typeof a != 'string' ) {
11806
+ a = (a !== null && a.toString) ? a.toString() : '';
11807
+ }
11808
+ return a.toLowerCase();
11809
+ },
11810
+
11811
+ "string-asc": function ( x, y )
11812
+ {
11813
+ return ((x < y) ? -1 : ((x > y) ? 1 : 0));
11814
+ },
11815
+
11816
+ "string-desc": function ( x, y )
11817
+ {
11818
+ return ((x < y) ? 1 : ((x > y) ? -1 : 0));
11819
+ },
11820
+
11821
+
11822
+ /*
11823
+ * html sorting (ignore html tags)
11824
+ */
11825
+ "html-pre": function ( a )
11826
+ {
11827
+ return a.replace( /<.*?>/g, "" ).toLowerCase();
11828
+ },
11829
+
11830
+ "html-asc": function ( x, y )
11831
+ {
11832
+ return ((x < y) ? -1 : ((x > y) ? 1 : 0));
11833
+ },
11834
+
11835
+ "html-desc": function ( x, y )
11836
+ {
11837
+ return ((x < y) ? 1 : ((x > y) ? -1 : 0));
11838
+ },
11839
+
11840
+
11841
+ /*
11842
+ * date sorting
11843
+ */
11844
+ "date-pre": function ( a )
11845
+ {
11846
+ var x = Date.parse( a );
11847
+
11848
+ if ( isNaN(x) || x==="" )
11849
+ {
11850
+ x = Date.parse( "01/01/1970 00:00:00" );
11851
+ }
11852
+ return x;
11853
+ },
11854
+
11855
+ "date-asc": function ( x, y )
11856
+ {
11857
+ return x - y;
11858
+ },
11859
+
11860
+ "date-desc": function ( x, y )
11861
+ {
11862
+ return y - x;
11863
+ },
11864
+
11865
+
11866
+ /*
11867
+ * numerical sorting
11868
+ */
11869
+ "numeric-pre": function ( a )
11870
+ {
11871
+ return (a=="-" || a==="") ? 0 : a*1;
11872
+ },
11873
+
11874
+ "numeric-asc": function ( x, y )
11875
+ {
11876
+ return x - y;
11877
+ },
11878
+
11879
+ "numeric-desc": function ( x, y )
11880
+ {
11881
+ return y - x;
11882
+ }
11883
+ } );
11884
+
11885
+
11886
+ $.extend( DataTable.ext.aTypes, [
11887
+ /*
11888
+ * Function: -
11889
+ * Purpose: Check to see if a string is numeric
11890
+ * Returns: string:'numeric' or null
11891
+ * Inputs: mixed:sText - string to check
11892
+ */
11893
+ function ( sData )
11894
+ {
11895
+ /* Allow zero length strings as a number */
11896
+ if ( typeof sData === 'number' )
11897
+ {
11898
+ return 'numeric';
11899
+ }
11900
+ else if ( typeof sData !== 'string' )
11901
+ {
11902
+ return null;
11903
+ }
11904
+
11905
+ var sValidFirstChars = "0123456789-";
11906
+ var sValidChars = "0123456789.";
11907
+ var Char;
11908
+ var bDecimal = false;
11909
+
11910
+ /* Check for a valid first char (no period and allow negatives) */
11911
+ Char = sData.charAt(0);
11912
+ if (sValidFirstChars.indexOf(Char) == -1)
11913
+ {
11914
+ return null;
11915
+ }
11916
+
11917
+ /* Check all the other characters are valid */
11918
+ for ( var i=1 ; i<sData.length ; i++ )
11919
+ {
11920
+ Char = sData.charAt(i);
11921
+ if (sValidChars.indexOf(Char) == -1)
11922
+ {
11923
+ return null;
11924
+ }
11925
+
11926
+ /* Only allowed one decimal place... */
11927
+ if ( Char == "." )
11928
+ {
11929
+ if ( bDecimal )
11930
+ {
11931
+ return null;
11932
+ }
11933
+ bDecimal = true;
11934
+ }
11935
+ }
11936
+
11937
+ return 'numeric';
11938
+ },
11939
+
11940
+ /*
11941
+ * Function: -
11942
+ * Purpose: Check to see if a string is actually a formatted date
11943
+ * Returns: string:'date' or null
11944
+ * Inputs: string:sText - string to check
11945
+ */
11946
+ function ( sData )
11947
+ {
11948
+ var iParse = Date.parse(sData);
11949
+ if ( (iParse !== null && !isNaN(iParse)) || (typeof sData === 'string' && sData.length === 0) )
11950
+ {
11951
+ return 'date';
11952
+ }
11953
+ return null;
11954
+ },
11955
+
11956
+ /*
11957
+ * Function: -
11958
+ * Purpose: Check to see if a string should be treated as an HTML string
11959
+ * Returns: string:'html' or null
11960
+ * Inputs: string:sText - string to check
11961
+ */
11962
+ function ( sData )
11963
+ {
11964
+ if ( typeof sData === 'string' && sData.indexOf('<') != -1 && sData.indexOf('>') != -1 )
11965
+ {
11966
+ return 'html';
11967
+ }
11968
+ return null;
11969
+ }
11970
+ ] );
11971
+
11972
+
11973
+ // jQuery aliases
11974
+ $.fn.DataTable = DataTable;
11975
+ $.fn.dataTable = DataTable;
11976
+ $.fn.dataTableSettings = DataTable.settings;
11977
+ $.fn.dataTableExt = DataTable.ext;
11978
+
11979
+
11980
+ // Information about events fired by DataTables - for documentation.
11981
+ /**
11982
+ * Draw event, fired whenever the table is redrawn on the page, at the same point as
11983
+ * fnDrawCallback. This may be useful for binding events or performing calculations when
11984
+ * the table is altered at all.
11985
+ * @name DataTable#draw
11986
+ * @event
11987
+ * @param {event} e jQuery event object
11988
+ * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
11989
+ */
11990
+
11991
+ /**
11992
+ * Filter event, fired when the filtering applied to the table (using the build in global
11993
+ * global filter, or column filters) is altered.
11994
+ * @name DataTable#filter
11995
+ * @event
11996
+ * @param {event} e jQuery event object
11997
+ * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
11998
+ */
11999
+
12000
+ /**
12001
+ * Page change event, fired when the paging of the table is altered.
12002
+ * @name DataTable#page
12003
+ * @event
12004
+ * @param {event} e jQuery event object
12005
+ * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
12006
+ */
12007
+
12008
+ /**
12009
+ * Sort event, fired when the sorting applied to the table is altered.
12010
+ * @name DataTable#sort
12011
+ * @event
12012
+ * @param {event} e jQuery event object
12013
+ * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
12014
+ */
12015
+
12016
+ /**
12017
+ * DataTables initialisation complete event, fired when the table is fully drawn,
12018
+ * including Ajax data loaded, if Ajax data is required.
12019
+ * @name DataTable#init
12020
+ * @event
12021
+ * @param {event} e jQuery event object
12022
+ * @param {object} oSettings DataTables settings object
12023
+ * @param {object} json The JSON object request from the server - only
12024
+ * present if client-side Ajax sourced data is used</li></ol>
12025
+ */
12026
+
12027
+ /**
12028
+ * State save event, fired when the table has changed state a new state save is required.
12029
+ * This method allows modification of the state saving object prior to actually doing the
12030
+ * save, including addition or other state properties (for plug-ins) or modification
12031
+ * of a DataTables core property.
12032
+ * @name DataTable#stateSaveParams
12033
+ * @event
12034
+ * @param {event} e jQuery event object
12035
+ * @param {object} oSettings DataTables settings object
12036
+ * @param {object} json The state information to be saved
12037
+ */
12038
+
12039
+ /**
12040
+ * State load event, fired when the table is loading state from the stored data, but
12041
+ * prior to the settings object being modified by the saved state - allowing modification
12042
+ * of the saved state is required or loading of state for a plug-in.
12043
+ * @name DataTable#stateLoadParams
12044
+ * @event
12045
+ * @param {event} e jQuery event object
12046
+ * @param {object} oSettings DataTables settings object
12047
+ * @param {object} json The saved state information
12048
+ */
12049
+
12050
+ /**
12051
+ * State loaded event, fired when state has been loaded from stored data and the settings
12052
+ * object has been modified by the loaded data.
12053
+ * @name DataTable#stateLoaded
12054
+ * @event
12055
+ * @param {event} e jQuery event object
12056
+ * @param {object} oSettings DataTables settings object
12057
+ * @param {object} json The saved state information
12058
+ */
12059
+
12060
+ /**
12061
+ * Processing event, fired when DataTables is doing some kind of processing (be it,
12062
+ * sort, filter or anything else). Can be used to indicate to the end user that
12063
+ * there is something happening, or that something has finished.
12064
+ * @name DataTable#processing
12065
+ * @event
12066
+ * @param {event} e jQuery event object
12067
+ * @param {object} oSettings DataTables settings object
12068
+ * @param {boolean} bShow Flag for if DataTables is doing processing or not
12069
+ */
12070
+
12071
+ /**
12072
+ * Ajax (XHR) event, fired whenever an Ajax request is completed from a request to
12073
+ * made to the server for new data (note that this trigger is called in fnServerData,
12074
+ * if you override fnServerData and which to use this event, you need to trigger it in
12075
+ * you success function).
12076
+ * @name DataTable#xhr
12077
+ * @event
12078
+ * @param {event} e jQuery event object
12079
+ * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
12080
+ * @param {object} json JSON returned from the server
12081
+ */
12082
+
12083
+ /**
12084
+ * Destroy event, fired when the DataTable is destroyed by calling fnDestroy or passing
12085
+ * the bDestroy:true parameter in the initialisation object. This can be used to remove
12086
+ * bound events, added DOM nodes, etc.
12087
+ * @name DataTable#destroy
12088
+ * @event
12089
+ * @param {event} e jQuery event object
12090
+ * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
12091
+ */
12092
+ }(jQuery, window, document, undefined));
skin/frontend/enterprise/default/levementum/datatables/js/jquery.dataTables.plugins.js ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * User: Ian
3
+ * Date: 5/21/12
4
+ * Time: 1:41 PM
5
+ * This file must be included after dataTables.js
6
+ */
7
+ jQuery.fn.dataTableExt.oSort['currency-asc'] = function (a, b) {
8
+ 'use strict';
9
+
10
+ var x, y;
11
+
12
+ /* Remove any commas (assumes that if present all strings will have a fixed number of d.p) */
13
+ x = (a === "-" || a === "--" || a === '' || a.toLowerCase().replace('/', '') === 'na') ? -1 : a.replace(/,/g, "");
14
+ y = (b === "-" || b === "--" || b === '' || b.toLowerCase().replace('/', '') === 'na') ? -1 : b.replace(/,/g, "");
15
+
16
+ /* Remove the currency sign */
17
+ if (typeof x === "string" && isNaN(x.substr(0, 1), 10)) {
18
+ x = x.substring(1);
19
+ }
20
+ if (typeof y === "string" && isNaN(y.substr(0, 1), 10)) {
21
+ y = y.substring(1);
22
+ }
23
+
24
+ /* Parse and return */
25
+ x = parseFloat(x, 10);
26
+ y = parseFloat(y, 10);
27
+
28
+ return x - y;
29
+ };
30
+ jQuery.fn.dataTableExt.oSort['currency-desc'] = function (a, b) {
31
+ 'use strict';
32
+
33
+ var x, y;
34
+
35
+ /* Remove any commas (assumes that if present all strings will have a fixed number of d.p) */
36
+ x = (a === "-" || a === "--" || a === '' || a.toLowerCase().replace('/', '') === 'na') ? -1 : a.replace(/,/g, "");
37
+ y = (b === "-" || b === "--" || b === '' || b.toLowerCase().replace('/', '') === 'na') ? -1 : b.replace(/,/g, "");
38
+
39
+ /* Remove the currency sign */
40
+ if (typeof x === "string" && isNaN(x.substr(0, 1), 10)) {
41
+ x = x.substring(1);
42
+ }
43
+ if (typeof y === "string" && isNaN(y.substr(0, 1), 10)) {
44
+ y = y.substring(1);
45
+ }
46
+
47
+ /* Parse and return */
48
+ x = parseFloat(x, 10);
49
+ y = parseFloat(y, 10);
50
+
51
+ return y - x;
52
+ };
53
+
54
+ /*Inches in format 1", 1-1/8", 1/8" or 16*/
55
+ jQuery.fn.dataTableExt.oSort['dimension-asc'] = function (a, b) {
56
+ 'use strict';
57
+
58
+ var x = a.toLowerCase(), y = b.toLowerCase();
59
+
60
+ /** Process x**/
61
+ //If it is not numeric, we need to process, if it is...already done!
62
+ if (!jQuery.isNumeric(x)) {
63
+ /*remove any "*/
64
+ x = x.replace('"', '');
65
+
66
+ if (!jQuery.isNumeric(x)) {
67
+ /*Search for format 1-1/8*/
68
+ var slashFound = false;
69
+ for (var i = 0; i < x.length; ++i) {
70
+ /*A "-" will be found first.*/
71
+ if (x.charAt(i) == '-') {
72
+ for (var j = i + 1; j < x.length; ++j) {
73
+ if (x.charAt(j) == '/') {
74
+ var arr = x.split("-");
75
+ var arr2 = arr[1].split("/");
76
+ x = parseFloat(arr[0], 10) + parseFloat(arr2[0], 10) / parseFloat(arr2[1], 10);
77
+ slashFound = true;
78
+ break;
79
+ }
80
+ }
81
+
82
+ /*If slash was found, we don't need to process /*/
83
+ if (slashFound) {
84
+ break;
85
+ }
86
+ } else if (x.charAt(i) == '/') {
87
+ var arr = x.split("/");
88
+ x = parseFloat(arr[0], 10) / parseFloat(arr[1], 10);
89
+ slashFound = true;
90
+ }
91
+ }
92
+
93
+ if (!slashFound) {
94
+ x = 0;
95
+ }
96
+ }
97
+ }
98
+ /** End Process x**/
99
+
100
+ /** Process y**/
101
+ /*If it is not numeric, we need to process, if it is...already done!*/
102
+ if (!jQuery.isNumeric(y)) {
103
+ /*remove any "*/
104
+ y = y.replace('"', '');
105
+
106
+ if (!jQuery.isNumeric(y)) {
107
+ /*Search for format 1-1/8*/
108
+ var slashFound = false;
109
+ for (var i = 0; i < y.length; ++i) {
110
+ /*A "-" will be found first.*/
111
+ if (y.charAt(i) == '-') {
112
+ for (var j = i + 1; j < y.length; ++j) {
113
+ if (y.charAt(j) == '/') {
114
+ var arr = y.split("-");
115
+ var arr2 = arr[1].split("/");
116
+ y = parseFloat(arr[0], 10) + parseFloat(arr2[0], 10) / parseFloat(arr2[1], 10);
117
+ slashFound = true;
118
+ break;
119
+ }
120
+ }
121
+
122
+ /*If slash was found, we don't need to process /*/
123
+ if (slashFound) {
124
+ break;
125
+ }
126
+ } else if (y.charAt(i) == '/') {
127
+ var arr = y.split("/");
128
+ y = parseFloat(arr[0], 10) / parseFloat(arr[1], 10);
129
+ slashFound = true;
130
+ }
131
+ }
132
+
133
+ if (!slashFound) {
134
+ y = 0;
135
+ }
136
+ }
137
+ }
138
+ /** End Process y**/
139
+
140
+ /* Parse and return */
141
+ x = parseFloat(x, 10);
142
+ y = parseFloat(y, 10);
143
+
144
+ return x - y;
145
+
146
+ };
147
+
148
+ /*Inches in format 1", 1-1/8", 1/8" or 16*/
149
+ jQuery.fn.dataTableExt.oSort['dimension-desc'] = function (a, b) {
150
+ 'use strict';
151
+
152
+ var x = a.toLowerCase(), y = b.toLowerCase();
153
+
154
+ if (x == '3/16"') {
155
+ x = x;
156
+ }
157
+ /** Process x**/
158
+ /*If it is not numeric, we need to process, if it is...already done!*/
159
+ if (!jQuery.isNumeric(x)) {
160
+ /*remove any "*/
161
+ x = x.replace('"', '');
162
+
163
+ if (!jQuery.isNumeric(x)) {
164
+ /*Search for format 1-1/8*/
165
+ var slashFound = false;
166
+ for (var i = 0; i < x.length; ++i) {
167
+ /*A "-" will be found first.*/
168
+ if (x.charAt(i) == '-') {
169
+ for (var j = i + 1; j < x.length; ++j) {
170
+ if (x.charAt(j) == '/') {
171
+ var arr = x.split("-");
172
+ var arr2 = arr[1].split("/");
173
+ x = parseFloat(arr[0], 10) + parseFloat(arr2[0], 10) / parseFloat(arr2[1], 10);
174
+ slashFound = true;
175
+ break;
176
+ }
177
+ }
178
+
179
+ /*If slash was found, we don't need to process /*/
180
+ if (slashFound) {
181
+ break;
182
+ }
183
+ } else if (x.charAt(i) == '/') {
184
+ var arr = x.split("/");
185
+ x = parseFloat(arr[0], 10) / parseFloat(arr[1], 10);
186
+ slashFound = true;
187
+ }
188
+ }
189
+
190
+ if (!slashFound) {
191
+ x = 0;
192
+ }
193
+ }
194
+ }
195
+ /** End Process x**/
196
+
197
+ /** Process y**/
198
+ /*If it is not numeric, we need to process, if it is...already done!*/
199
+ if (!jQuery.isNumeric(y)) {
200
+ /*remove any "*/
201
+ y = y.replace('"', '');
202
+
203
+ if (!jQuery.isNumeric(y)) {
204
+ /*Search for format 1-1/8*/
205
+ var slashFound = false;
206
+ for (var i = 0; i < y.length; ++i) {
207
+ /*A "-" will be found first.*/
208
+ if (y.charAt(i) == '-') {
209
+ for (var j = i + 1; j < y.length; ++j) {
210
+ if (y.charAt(j) == '/') {
211
+ var arr = y.split("-");
212
+ var arr2 = arr[1].split("/");
213
+ y = parseFloat(arr[0], 10) + parseFloat(arr2[0], 10) / parseFloat(arr2[1], 10);
214
+ slashFound = true;
215
+ break;
216
+ }
217
+ }
218
+
219
+ /*If slash was found, we don't need to process /*/
220
+ if (slashFound) {
221
+ break;
222
+ }
223
+ } else if (y.charAt(i) == '/') {
224
+ var arr = y.split("/");
225
+ y = parseFloat(arr[0], 10) / parseFloat(arr[1], 10);
226
+ slashFound = true;
227
+ }
228
+ }
229
+
230
+ if (!slashFound) {
231
+ y = 0;
232
+ }
233
+ }
234
+ }
235
+ /** End Process y**/
236
+
237
+ /* Parse and return */
238
+ x = parseFloat(x, 10);
239
+ y = parseFloat(y, 10);
240
+
241
+ return y - x;
242
+
243
+ };
244
+
245
+
246
+ jQuery.fn.dataTableExt.oSort['size-asc'] = function (a, b) {
247
+ 'use strict';
248
+
249
+ var x = a.match(/[0-9]+/g);
250
+ var y = b.match(/[0-9]+/g);
251
+
252
+ return x - y;
253
+ };
254
+
255
+ jQuery.fn.dataTableExt.oSort['size-desc'] = function (a, b) {
256
+ 'use strict';
257
+
258
+ var x = a.match(/[0-9]+/g);
259
+ var y = b.match(/[0-9]+/g);
260
+
261
+ return y - x;
262
+ };
263
+
264
+ /** currency **/
265
+ jQuery.fn.dataTableExt.aTypes.push(
266
+ function (sData) {
267
+ var sValidChars = "0123456789.-";
268
+ var Char;
269
+
270
+ /* Check the numeric part */
271
+ for (i = 1; i < sData.length; i++) {
272
+ Char = sData.charAt(i);
273
+ if (sValidChars.indexOf(Char) == -1) {
274
+ return null;
275
+ }
276
+ }
277
+
278
+ /* Check prefixed by currency */
279
+ if (sData.charAt(0) == '$' || sData.charAt(0) == '£') {
280
+ return 'currency';
281
+ }
282
+ return null;
283
+ }
284
+ );
285
+
286
+ /*Inches in format 1", 1-1/8", 1/8" or 16*/
287
+ jQuery.fn.dataTableExt.aTypes.push(
288
+ function (sData) {
289
+ var sValidChars = "0123456789.-/\"";
290
+ var Char;
291
+
292
+ /* Check the numeric part */
293
+ for (i = 1; i < sData.length; i++) {
294
+ Char = sData.charAt(i);
295
+ if (sValidChars.indexOf(Char) == -1) {
296
+ return null;
297
+ }
298
+ }
299
+
300
+ if (jQuery.isNumeric(sData.charAt(0)) || sData.charAt(sData.length - 1) == '"') {
301
+ return 'dimension';
302
+ }
303
+ return null;
304
+ }
305
+ );
306
+
307
+ /** size **/
308
+ /* Size format, "5 mL" OR "14 mL" OR "14 mL." */
309
+ jQuery.fn.dataTableExt.aTypes.push(
310
+ function (sData) {
311
+ var sValidChars = "0123456789\ mMlL\.";
312
+ var Char;
313
+
314
+ /* Check the numeric part */
315
+ for (i = 1; i < sData.length; i++) {
316
+ Char = sData.charAt(i);
317
+ if (sValidChars.indexOf(Char) == -1) {
318
+ return null;
319
+ }
320
+ }
321
+
322
+ if (sData == '5 ml.') {
323
+ sData = sData;
324
+ }
325
+ var size = sData.match(/[0-9]+/g);
326
+ if (/[0-9]+[\ ]+[m][L|l][\.]?/.test(sData) && size.length == 1) {
327
+ return 'size';
328
+ }
329
+
330
+ return null;
331
+ }
332
+ );
333
+
334
+
335
+ jQuery.fn.dataTableExt.aTypes.reverse();
skin/frontend/enterprise/default/levementum/datatables/js/jquery.js ADDED
@@ -0,0 +1,4 @@
 
 
1
+ /*! jQuery v1.7.1 jquery.com | jquery.org/license */
2
+ (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(