Magazento_PriceProposal - Version 1.0.0

Version Notes

1.0.0

Download this release

Release Info

Developer Magento Core Team
Extension Magazento_PriceProposal
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (44) hide show
  1. app/code/community/Magazento/Priceproposal/Block/Admin/Item.php +22 -0
  2. app/code/community/Magazento/Priceproposal/Block/Admin/Item/Edit.php +58 -0
  3. app/code/community/Magazento/Priceproposal/Block/Admin/Item/Edit/Form.php +52 -0
  4. app/code/community/Magazento/Priceproposal/Block/Admin/Item/Edit/Tab/Form.php +110 -0
  5. app/code/community/Magazento/Priceproposal/Block/Admin/Item/Edit/Tab/Other.php +34 -0
  6. app/code/community/Magazento/Priceproposal/Block/Admin/Item/Edit/Tabs.php +35 -0
  7. app/code/community/Magazento/Priceproposal/Block/Admin/Item/Grid.php +170 -0
  8. app/code/community/Magazento/Priceproposal/Block/Admin/Item/Grid/Renderer/Action.php +32 -0
  9. app/code/community/Magazento/Priceproposal/Block/Developer.php +65 -0
  10. app/code/community/Magazento/Priceproposal/Block/Request.php +13 -0
  11. app/code/community/Magazento/Priceproposal/Helper/Data.php +85 -0
  12. app/code/community/Magazento/Priceproposal/Model/Data.php +41 -0
  13. app/code/community/Magazento/Priceproposal/Model/Item.php +49 -0
  14. app/code/community/Magazento/Priceproposal/Model/Mysql4/Item.php +71 -0
  15. app/code/community/Magazento/Priceproposal/Model/Mysql4/Item/Collection.php +41 -0
  16. app/code/community/Magazento/Priceproposal/Model/Wysiwyg/Config.php +26 -0
  17. app/code/community/Magazento/Priceproposal/controllers/Admin/ItemController.php +171 -0
  18. app/code/community/Magazento/Priceproposal/controllers/IndexController.php +23 -0
  19. app/code/community/Magazento/Priceproposal/etc/config.xml +158 -0
  20. app/code/community/Magazento/Priceproposal/etc/system.xml +55 -0
  21. app/code/community/Magazento/Priceproposal/sql/priceproposal_setup/mysql4-install-1.0.0.php +50 -0
  22. app/design/frontend/default/default/layout/magazento_priceproposal.xml +20 -0
  23. app/design/frontend/default/default/template/magazento/priceproposal/data.phtml +51 -0
  24. app/etc/modules/Magazento_Priceproposal.xml +9 -0
  25. app/locale/en_US/Magazento_Priceproposal.csv +1 -0
  26. package.xml +20 -0
  27. skin/frontend/default/default/magazento/priceproposal/colorbox.css +82 -0
  28. skin/frontend/default/default/magazento/priceproposal/help_desk.png +0 -0
  29. skin/frontend/default/default/magazento/priceproposal/images/border.png +0 -0
  30. skin/frontend/default/default/magazento/priceproposal/images/controls.png +0 -0
  31. skin/frontend/default/default/magazento/priceproposal/images/ie6/borderBottomCenter.png +0 -0
  32. skin/frontend/default/default/magazento/priceproposal/images/ie6/borderBottomLeft.png +0 -0
  33. skin/frontend/default/default/magazento/priceproposal/images/ie6/borderBottomRight.png +0 -0
  34. skin/frontend/default/default/magazento/priceproposal/images/ie6/borderMiddleLeft.png +0 -0
  35. skin/frontend/default/default/magazento/priceproposal/images/ie6/borderMiddleRight.png +0 -0
  36. skin/frontend/default/default/magazento/priceproposal/images/ie6/borderTopCenter.png +0 -0
  37. skin/frontend/default/default/magazento/priceproposal/images/ie6/borderTopLeft.png +0 -0
  38. skin/frontend/default/default/magazento/priceproposal/images/ie6/borderTopRight.png +0 -0
  39. skin/frontend/default/default/magazento/priceproposal/images/loading.gif +0 -0
  40. skin/frontend/default/default/magazento/priceproposal/images/loading_background.png +0 -0
  41. skin/frontend/default/default/magazento/priceproposal/images/overlay.png +0 -0
  42. skin/frontend/default/default/magazento/priceproposal/jquery.colorbox.js +815 -0
  43. skin/frontend/default/default/magazento/priceproposal/promo.jpg +0 -0
  44. skin/frontend/default/default/magazento/priceproposal/style.css +48 -0
app/code/community/Magazento/Priceproposal/Block/Admin/Item.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Priceproposal_Block_Admin_Item extends Mage_Adminhtml_Block_Widget_Grid_Container
12
+ {
13
+
14
+ public function __construct()
15
+ {
16
+ $this->_controller = 'admin_item';
17
+ $this->_blockGroup = 'priceproposal';
18
+ $this->_headerText = Mage::helper('priceproposal')->__('Priceproposal grid');
19
+ $this->setTemplate('widget/grid/container.phtml');
20
+ }
21
+
22
+ }
app/code/community/Magazento/Priceproposal/Block/Admin/Item/Edit.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Priceproposal_Block_Admin_Item_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
12
+ {
13
+
14
+ public function __construct()
15
+ {
16
+ $this->_objectId = 'item_id';
17
+ $this->_controller = 'admin_item';
18
+ $this->_blockGroup = 'priceproposal';
19
+
20
+ parent::__construct();
21
+
22
+ $this->_updateButton('save', 'label', Mage::helper('priceproposal')->__('Save Item'));
23
+ $this->_updateButton('delete', 'label', Mage::helper('priceproposal')->__('Delete Item'));
24
+
25
+ $this->_addButton('saveandcontinue', array(
26
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
27
+ 'onclick' => 'saveAndContinueEdit()',
28
+ 'class' => 'save',
29
+ ), -100);
30
+
31
+
32
+ $this->_formScripts[] = "
33
+ function toggleEditor() {
34
+ if (tinyMCE.getInstanceById('block_content') == null) {
35
+ tinyMCE.execCommand('mceAddControl', false, 'block_content');
36
+ } else {
37
+ tinyMCE.execCommand('mceRemoveControl', false, 'block_content');
38
+ }
39
+ }
40
+
41
+ function saveAndContinueEdit(){
42
+ editForm.submit($('edit_form').action+'back/edit/');
43
+ }
44
+
45
+ ";
46
+ }
47
+
48
+ public function getHeaderText()
49
+ {
50
+ if (Mage::registry('priceproposal_item')->getId()) {
51
+ return Mage::helper('priceproposal')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('priceproposal_item')->getTitle()));
52
+ }
53
+ else {
54
+ return Mage::helper('priceproposal')->__('New Item');
55
+ }
56
+ }
57
+
58
+ }
app/code/community/Magazento/Priceproposal/Block/Admin/Item/Edit/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Priceproposal_Block_Admin_Item_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
12
+ {
13
+
14
+
15
+ protected function _prepareLayout() {
16
+ parent::_prepareLayout();
17
+ if (Mage::helper('priceproposal')->versionUseWysiwig()) {
18
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
19
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
20
+
21
+ $this->getLayout()->getBlock('head')->addJs('mage/adminhtml/variables.js');
22
+ $this->getLayout()->getBlock('head')->addJs('mage/adminhtml/wysiwyg/widget.js');
23
+ $this->getLayout()->getBlock('head')->addJs('lib/flex.js');
24
+ $this->getLayout()->getBlock('head')->addJs('lib/FABridge.js');
25
+ $this->getLayout()->getBlock('head')->addJs('mage/adminhtml/flexuploader.js');
26
+ $this->getLayout()->getBlock('head')->addJs('mage/adminhtml/browser.js');
27
+ $this->getLayout()->getBlock('head')->addJs('extjs/ext-tree.js');
28
+ $this->getLayout()->getBlock('head')->addJs('extjs/ext-tree-checkbox.js');
29
+
30
+ $this->getLayout()->getBlock('head')->addItem('js_css', 'extjs/resources/css/ext-all.css');
31
+ $this->getLayout()->getBlock('head')->addItem('js_css', 'extjs/resources/css/ytheme-magento.css');
32
+ $this->getLayout()->getBlock('head')->addItem('js_css', 'prototype/windows/themes/default.css');
33
+ $this->getLayout()->getBlock('head')->addItem('js_css', 'prototype/windows/themes/magento.css');
34
+ }
35
+ }
36
+ }
37
+
38
+ protected function _prepareForm()
39
+ {
40
+ $form = new Varien_Data_Form(array(
41
+ 'id' => 'edit_form',
42
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
43
+ 'method' => 'post',
44
+ 'enctype' => 'multipart/form-data'
45
+ )
46
+ );
47
+
48
+ $form->setUseContainer(true);
49
+ $this->setForm($form);
50
+ return parent::_prepareForm();
51
+ }
52
+ }
app/code/community/Magazento/Priceproposal/Block/Admin/Item/Edit/Tab/Form.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Priceproposal_Block_Admin_Item_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
12
+
13
+
14
+ protected function _prepareForm() {
15
+ $model = Mage::registry('priceproposal_item');
16
+ $form = new Varien_Data_Form(array('id' => 'edit_form_item', 'action' => $this->getData('action'), 'method' => 'post'));
17
+ $form->setHtmlIdPrefix('item_');
18
+ $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('priceproposal')->__('General Information'), 'class' => 'fieldset-wide'));
19
+ if ($model->getItemId()) {
20
+ $fieldset->addField('item_id', 'hidden', array(
21
+ 'name' => 'item_id',
22
+ ));
23
+ }
24
+
25
+ $fieldset->addField('title', 'text', array(
26
+ 'name' => 'title',
27
+ 'label' => Mage::helper('priceproposal')->__('Title'),
28
+ 'title' => Mage::helper('priceproposal')->__('Title'),
29
+ 'required' => true,
30
+ ));
31
+ $fieldset->addField('url', 'text', array(
32
+ 'name' => 'url',
33
+ 'label' => Mage::helper('priceproposal')->__('Url'),
34
+ 'title' => Mage::helper('priceproposal')->__('Url'),
35
+ 'required' => false,
36
+ ));
37
+ $fieldset->addField('image', 'text', array(
38
+ 'name' => 'image',
39
+ 'label' => Mage::helper('priceproposal')->__('Image'),
40
+ 'title' => Mage::helper('priceproposal')->__('Image'),
41
+ 'required' => false,
42
+ ));
43
+
44
+ $fieldset->addField('position', 'select', array(
45
+ 'name' => 'position',
46
+ 'label' => Mage::helper('priceproposal')->__('Position'),
47
+ 'title' => Mage::helper('priceproposal')->__('Position'),
48
+ 'required' => true,
49
+ 'options' => Mage::helper('priceproposal')->numberArray(20,Mage::helper('priceproposal')->__('')),
50
+ ));
51
+ if (!Mage::app()->isSingleStoreMode()) {
52
+ $fieldset->addField('store_id', 'multiselect', array(
53
+ 'name' => 'stores[]',
54
+ 'label' => Mage::helper('priceproposal')->__('Store View'),
55
+ 'title' => Mage::helper('priceproposal')->__('Store View'),
56
+ 'required' => true,
57
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
58
+ 'style' => 'height:150px',
59
+ ));
60
+ } else {
61
+ $fieldset->addField('store_id', 'hidden', array(
62
+ 'name' => 'stores[]',
63
+ 'value' => Mage::app()->getStore(true)->getId()
64
+ ));
65
+ $model->setStoreId(Mage::app()->getStore(true)->getId());
66
+ }
67
+
68
+
69
+ $fieldset->addField('is_active', 'select', array(
70
+ 'label' => Mage::helper('priceproposal')->__('Status'),
71
+ 'title' => Mage::helper('priceproposal')->__('Status'),
72
+ 'name' => 'is_active',
73
+ 'required' => true,
74
+ 'options' => array(
75
+ '1' => Mage::helper('priceproposal')->__('Enabled'),
76
+ '0' => Mage::helper('priceproposal')->__('Disabled'),
77
+ ),
78
+ ));
79
+
80
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
81
+ $fieldset->addField('from_time', 'date', array(
82
+ 'name' => 'from_time',
83
+ 'time' => true,
84
+ 'label' => Mage::helper('priceproposal')->__('From Time'),
85
+ 'title' => Mage::helper('priceproposal')->__('From Time'),
86
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
87
+ 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT,
88
+ 'format' => $dateFormatIso,
89
+ ));
90
+
91
+ $fieldset->addField('to_time', 'date', array(
92
+ 'name' => 'to_time',
93
+ 'time' => true,
94
+ 'label' => Mage::helper('priceproposal')->__('To Time'),
95
+ 'title' => Mage::helper('priceproposal')->__('To Time'),
96
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
97
+ 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT,
98
+ 'format' => $dateFormatIso,
99
+ ));
100
+
101
+ // print_r($model->getData());
102
+ // exit();
103
+ // $form->setUseContainer(true);
104
+ $form->setValues($model->getData());
105
+ $this->setForm($form);
106
+
107
+ return parent::_prepareForm();
108
+ }
109
+
110
+ }
app/code/community/Magazento/Priceproposal/Block/Admin/Item/Edit/Tab/Other.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+ class Magazento_Priceproposal_Block_Admin_Item_Edit_Tab_Other extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ protected function _prepareForm()
13
+ {
14
+ $model = Mage::registry('priceproposal_item');
15
+ $form = new Varien_Data_Form();
16
+ $this->setForm($form);
17
+ $fieldset = $form->addFieldset('additional_form', array('legend'=>Mage::helper('priceproposal')->__('Additional information ')));
18
+
19
+
20
+
21
+ $fieldset->addField('samplefield', 'text', array(
22
+ 'name' => 'samplefield',
23
+ 'label' => Mage::helper('priceproposal')->__('Samplefield'),
24
+ 'title' => Mage::helper('priceproposal')->__('Samplefield'),
25
+ 'required' => false,
26
+ ));
27
+
28
+ // $form->setUseContainer(true);
29
+ $form->setValues($model->getData());
30
+ $this->setForm($form);
31
+
32
+ return parent::_prepareForm();
33
+ }
34
+ }
app/code/community/Magazento/Priceproposal/Block/Admin/Item/Edit/Tabs.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Priceproposal_Block_Admin_Item_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
12
+
13
+ public function __construct() {
14
+ parent::__construct();
15
+ $this->setId('priceproposal_tabs');
16
+ $this->setDestElementId('edit_form');
17
+ $this->setTitle(Mage::helper('priceproposal')->__('Item Information'));
18
+ }
19
+
20
+ protected function _beforeToHtml() {
21
+ $this->addTab('form_section_item', array(
22
+ 'label' => Mage::helper('priceproposal')->__('Item Information'),
23
+ 'title' => Mage::helper('priceproposal')->__('Item Information'),
24
+ 'content' => $this->getLayout()->createBlock('priceproposal/admin_item_edit_tab_form')->toHtml(),
25
+ ));
26
+ // $this->addTab('form_section_other', array(
27
+ // 'label' => Mage::helper('priceproposal')->__('Item Information additional'),
28
+ // 'title' => Mage::helper('priceproposal')->__('Item Information additional'),
29
+ // 'content' => $this->getLayout()->createBlock('priceproposal/admin_item_edit_tab_other')->toHtml(),
30
+ // ));
31
+
32
+ return parent::_beforeToHtml();
33
+ }
34
+
35
+ }
app/code/community/Magazento/Priceproposal/Block/Admin/Item/Grid.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Created on May 3, 2011
5
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
6
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
7
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
8
+ */
9
+ ?>
10
+ <?php
11
+
12
+ class Magazento_Priceproposal_Block_Admin_Item_Grid extends Mage_Adminhtml_Block_Widget_Grid {
13
+
14
+ public function __construct() {
15
+ parent::__construct();
16
+ $this->setId('PriceproposalGrid');
17
+ $this->setDefaultSort('item_id');
18
+ $this->setDefaultDir('ASC');
19
+ }
20
+
21
+ protected function _prepareCollection() {
22
+ $collection = Mage::getModel('priceproposal/item')->getCollection();
23
+ $this->setCollection($collection);
24
+ return parent::_prepareCollection();
25
+ }
26
+
27
+ protected function _prepareColumns() {
28
+
29
+ $baseUrl = $this->getUrl();
30
+ $this->addColumn('item_id', array(
31
+ 'header' => Mage::helper('priceproposal')->__('ID'),
32
+ 'align' => 'left',
33
+ 'index' => 'item_id',
34
+ ));
35
+ // $this->addColumn('product_id', array(
36
+ // 'header' => Mage::helper('priceproposal')->__('Product ID'),
37
+ // 'align' => 'left',
38
+ // 'index' => 'product_id',
39
+ // ));
40
+ $this->addColumn('product_name', array(
41
+ 'header' => Mage::helper('priceproposal')->__('Product'),
42
+ 'align' => 'left',
43
+ 'index' => 'product_name',
44
+ ));
45
+
46
+ $this->addColumn('competitior_name', array(
47
+ 'header' => Mage::helper('priceproposal')->__('Name'),
48
+ 'align' => 'left',
49
+ 'index' => 'competitior_name',
50
+ ));
51
+
52
+ $this->addColumn('competitior_price', array(
53
+ 'header' => Mage::helper('priceproposal')->__('Price'),
54
+ 'align' => 'left',
55
+ 'index' => 'competitior_price',
56
+ ));
57
+ $this->addColumn('competitior_link', array(
58
+ 'header' => Mage::helper('priceproposal')->__('URL'),
59
+ 'align' => 'left',
60
+ 'index' => 'competitior_link',
61
+ ));
62
+ $this->addColumn('user_email', array(
63
+ 'header' => Mage::helper('priceproposal')->__('Email'),
64
+ 'align' => 'left',
65
+ 'index' => 'user_email',
66
+ ));
67
+ $this->addColumn('user_phone', array(
68
+ 'header' => Mage::helper('priceproposal')->__('Phone'),
69
+ 'align' => 'left',
70
+ 'index' => 'user_phone',
71
+ ));
72
+ $this->addColumn('user_skype', array(
73
+ 'header' => Mage::helper('priceproposal')->__('Skype'),
74
+ 'align' => 'left',
75
+ 'index' => 'user_skype',
76
+ ));
77
+ $this->addColumn('comment', array(
78
+ 'header' => Mage::helper('priceproposal')->__('Comment'),
79
+ 'align' => 'left',
80
+ 'index' => 'comment',
81
+ ));
82
+ $this->addColumn('status', array(
83
+ 'header' => Mage::helper('priceproposal')->__('Status'),
84
+ 'index' => 'status',
85
+ 'type' => 'options',
86
+ 'options' => array(
87
+ 0 => Mage::helper('priceproposal')->__('New'),
88
+ 1 => Mage::helper('priceproposal')->__('Seen'),
89
+ ),
90
+ ));
91
+
92
+ if (!Mage::app()->isSingleStoreMode()) {
93
+ $this->addColumn('store_id', array(
94
+ 'header' => Mage::helper('priceproposal')->__('Store View'),
95
+ 'index' => 'store_id',
96
+ 'type' => 'store',
97
+ 'store_all' => true,
98
+ 'store_view' => true,
99
+ 'sortable' => false,
100
+ 'filter_condition_callback'
101
+ => array($this, '_filterStoreCondition'),
102
+ ));
103
+ }
104
+
105
+ $this->addColumn('from_time', array(
106
+ 'header' => Mage::helper('priceproposal')->__('Time'),
107
+ 'index' => 'from_time',
108
+ 'type' => 'datetime',
109
+ ));
110
+
111
+ $this->addColumn('action',
112
+ array(
113
+ 'header' => Mage::helper('priceproposal')->__('Action'),
114
+ 'index' => 'item_id',
115
+ 'sortable' => false,
116
+ 'filter' => false,
117
+ 'no_link' => true,
118
+ 'width' => '100px',
119
+ 'renderer' => 'priceproposal/admin_item_grid_renderer_action'
120
+ ));
121
+ $this->addExportType('*/*/exportCsv', Mage::helper('priceproposal')->__('CSV'));
122
+ $this->addExportType('*/*/exportXml', Mage::helper('priceproposal')->__('XML'));
123
+ return parent::_prepareColumns();
124
+ }
125
+
126
+ protected function _afterLoadCollection() {
127
+ $this->getCollection()->walk('afterLoad');
128
+ parent::_afterLoadCollection();
129
+ }
130
+
131
+ protected function _filterStoreCondition($collection, $column) {
132
+ if (!$value = $column->getFilter()->getValue()) {
133
+ return;
134
+ }
135
+ $this->getCollection()->addStoreFilter($value);
136
+ }
137
+
138
+ protected function _prepareMassaction() {
139
+ $this->setMassactionIdField('item_id');
140
+ $this->getMassactionBlock()->setFormFieldName('massaction');
141
+ $this->getMassactionBlock()->addItem('delete', array(
142
+ 'label' => Mage::helper('priceproposal')->__('Delete'),
143
+ 'url' => $this->getUrl('*/*/massDelete'),
144
+ 'confirm' => Mage::helper('priceproposal')->__('Are you sure?')
145
+ ));
146
+
147
+ $this->getMassactionBlock()->addItem('status', array(
148
+ 'label' => Mage::helper('priceproposal')->__('Change status'),
149
+ 'url' => $this->getUrl('*/*/massStatus', array('_current' => true)),
150
+ 'additional' => array(
151
+ 'visibility' => array(
152
+ 'name' => 'status',
153
+ 'type' => 'select',
154
+ 'class' => 'required-entry',
155
+ 'label' => Mage::helper('priceproposal')->__('Status'),
156
+ 'values' => array(
157
+ 0 => Mage::helper('priceproposal')->__('New'),
158
+ 1 => Mage::helper('priceproposal')->__('Seen'),
159
+ ),
160
+ )
161
+ )
162
+ ));
163
+ return $this;
164
+ }
165
+
166
+ // public function getRowUrl($row) {
167
+ // return $this->getUrl('*/*/edit', array('item_id' => $row->getId()));
168
+ // }
169
+
170
+ }
app/code/community/Magazento/Priceproposal/Block/Admin/Item/Grid/Renderer/Action.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+
12
+ class Magazento_Priceproposal_Block_Admin_Item_Grid_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
13
+ {
14
+ public function render(Varien_Object $row)
15
+ {
16
+
17
+ $actions[] = array(
18
+ 'url' => $this->getUrl('*/*/seen', array('item_id' => $row->getId())),
19
+ 'caption' => Mage::helper('priceproposal')->__('Seen')
20
+ );
21
+
22
+ $actions[] = array(
23
+ 'url' => $this->getUrl('*/*/delete', array('item_id' => $row->getId())),
24
+ 'caption' => Mage::helper('priceproposal')->__('Delete'),
25
+ 'confirm' => Mage::helper('priceproposal')->__('Are you sure you want to delete this item ?')
26
+ );
27
+
28
+ $this->getColumn()->setActions($actions);
29
+
30
+ return parent::render($row);
31
+ }
32
+ }
app/code/community/Magazento/Priceproposal/Block/Developer.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magazento_Priceproposal_Block_Developer extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
4
+
5
+ public function render(Varien_Data_Form_Element_Abstract $element) {
6
+ $content = '<p></p>';
7
+ $content.= '<style>';
8
+ $content.= '.magazento {
9
+ background:#FAFAFA;
10
+ border: 1px solid #CCCCCC;
11
+ margin-bottom: 10px;
12
+ padding: 10px;
13
+ height:auto;
14
+
15
+ }
16
+ .magazento h3 {
17
+ color: #EA7601;
18
+ }
19
+ .contact-type {
20
+ color: #EA7601;
21
+ font-weight:bold;
22
+ }
23
+ .magazento img {
24
+ border: 1px solid #CCCCCC;
25
+ float:left;
26
+ height:235px;
27
+ }
28
+ .magazento .info {
29
+ border: 1px solid #CCCCCC;
30
+ background:#E7EFEF;
31
+ padding: 5px 10px 0 5px;
32
+ margin-left:210px;
33
+ height:230px;
34
+ }
35
+ ';
36
+ $content.= '</style>';
37
+
38
+
39
+ $content.= '<div class="magazento">';
40
+ $content.= '<a href="http://www.magazento.com/" target="_blank"><img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'frontend/default/default/magazento/priceproposal/promo.jpg" alt="www.magazento.com" /></a>';
41
+ $content.= '<div class="info">';
42
+ $content.= '<h3>Magento extensions</h3>';
43
+ $content.= '<p><a href="http://www.magazento.com/" target="_blank">www.magazento.com</a> - experts are specializing in custom extension development for the world\'s fastest growing eCommerce platform - Magento. <br/>';
44
+ $content.= 'All extensions are designed for the Magento CMS archetecture, using native libraries and only the most efficient approaches to development.<br/>';
45
+ $content.= 'If you need Magento development or have a concept for an extension you\'d like developed for the Magento CMS platform, please contact us.</br></p>';
46
+ $content.= '--------------------------------------------------------<br>';
47
+ $content.= '<span class="contact-type">Company website:</span> <a href="http://www.magazento.com/" target="_blank">www.magazento.com</a> <br/>';
48
+ $content.= '<span class="contact-type">E-mail:</span> magazento@gmail.com <br/>';
49
+ $content.= '<span class="contact-type">Skype:</span> volgodark <br/>';
50
+ $content.= '<span class="contact-type">Phone:</span> +7 909389 2222 <br/>';
51
+ $content.= '<span class="contact-type">Magento:</span> <a href="http://www.magentocommerce.com/magento-connect/developer/Magazento" target="_blank">visit</a> <br/>';
52
+ $content.= '<span class="contact-type">Facebook:</span> <a href="http://www.facebook.com/ivan.proskuryakov" target="_blank">visit</a> <br/>';
53
+ // $content.= '<span class="contact-type">LinkedIn:</span> <a href="http://www.linkedin.com/pub/ivan-proskuryakov/31/200/316" target="_blank">visit</a> <br/>';
54
+
55
+ $content.= '</div>';
56
+
57
+ $content.= '</div>';
58
+
59
+ return $content;
60
+
61
+
62
+ }
63
+
64
+
65
+ }
app/code/community/Magazento/Priceproposal/Block/Request.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+ class Magazento_Priceproposal_Block_Request extends Mage_Core_Block_Template {
12
+
13
+ }
app/code/community/Magazento/Priceproposal/Helper/Data.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php class Magazento_Priceproposal_Helper_Data extends Mage_Core_Helper_Abstract {
10
+
11
+ public function formdata() {
12
+ $html = '
13
+ <div class="form-add-proposal" >
14
+ <form id="review-form" method="post" >
15
+ <fieldset class="proposal">
16
+ <ul class="form-list">
17
+ <!-- -->
18
+ <li>
19
+ <div class="field">
20
+ <label class="required" for="competitor_name"><em>*</em>Competitor name</label>
21
+ <div class="input-box">
22
+ <input type="text" value="" class="input-text" id="competitor_name" name="competitor_name">
23
+ </div>
24
+ </div>
25
+ <div class="field">
26
+ <label for="user_email">Your e-mail</label>
27
+ <div class="input-box">
28
+ <input type="text" value="" class="input-text" id="user_email" name="user_email">
29
+ </div>
30
+ </div>
31
+ </li>
32
+ <!-- -->
33
+ <li>
34
+ <div class="field">
35
+ <label class="required" for="competitor_price"><em>*</em>Product price</label>
36
+ <div class="input-box">
37
+ <input type="text" value="" class="input-text" id="competitor_price" name="competitor_price">
38
+ </div>
39
+ </div>
40
+ <div class="field">
41
+ <label for="user_phone">Your phone</label>
42
+ <div class="input-box">
43
+ <input type="text" value="" class="input-text" id="user_phone" name="user_phone">
44
+ </div>
45
+ </div>
46
+ </li>
47
+ <!-- -->
48
+ <li>
49
+ <div class="field">
50
+ <label class="required" for="competitor_url"><em>*</em>Product url</label>
51
+ <div class="input-box">
52
+ <input type="text" value="" class="input-text" id="competitor_url" name="competitor_url">
53
+ </div>
54
+ </div>
55
+ <div class="field">
56
+ <label for="user_skype">Your skype</label>
57
+ <div class="input-box">
58
+ <input type="text" value="" class="input-text" id="user_skype" name="user_skype">
59
+ </div>
60
+ </div>
61
+ </li>
62
+ <li>
63
+ <label for="comment">Your comment</label>
64
+ <div class="input-box">
65
+ <textarea class="required-entry" rows="3" cols="5" id="review_field" name="comment"></textarea>
66
+ </div>
67
+ </li>
68
+ </ul>
69
+ </fieldset>
70
+ <div class="proposal-information"> &nbsp; </div>
71
+ <div class="buttons-set">
72
+
73
+ <a href="javascript:submitForm();" class="proposal-btn" > Submit </a>
74
+
75
+ </div>
76
+ </form>
77
+ </div>
78
+
79
+ ';
80
+ return $html;
81
+ }
82
+
83
+
84
+
85
+ }
app/code/community/Magazento/Priceproposal/Model/Data.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+ Class Magazento_Priceproposal_Model_Data {
11
+
12
+ protected function getItemModel() {
13
+ return Mage::getModel('priceproposal/item');
14
+ }
15
+
16
+ protected function getItemCollection() {
17
+ $storeId = Mage::app()->getStore()->getId();
18
+ $collection = $this->getItemModel()->getCollection();
19
+ $collection->addFilter('is_active', 1);
20
+ $collection->addStoreFilter($storeId);
21
+ $collection->addOrder('position', 'ASC');
22
+
23
+ $ext = 'priceproposal';
24
+ $configserial = $ext.'/licence/serial';
25
+ $configlicence= $ext.'/licence/email';
26
+ $salt = 'magazento.com';
27
+ $serialmd5 = Mage::getStoreConfig($configserial);
28
+ $email = Mage::getStoreConfig($configlicence);
29
+ $emailmd5 = md5(md5($email.'.'.$ext.'.'.$salt));
30
+ $emailmd5 = mb_substr($emailmd5,2,24);
31
+ if ($emailmd5 != $serialmd5) {
32
+ Mage::getSingleton('core/session')->addError('This '.$ext.' extension copy is unregistered now. For serial key visit <a target="_blank" title="Magento Extension Developers, Magento exensions" href="http://www.magazento.com/">Magazento.com</a> website.');
33
+ }
34
+
35
+ return $collection;
36
+ }
37
+ public function getItems() {
38
+ return $this->getItemCollection();
39
+ }
40
+ }
41
+ ?>
app/code/community/Magazento/Priceproposal/Model/Item.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+ class Magazento_Priceproposal_Model_Item extends Mage_Core_Model_Abstract
11
+ {
12
+ const CACHE_TAG = 'priceproposal_admin_item';
13
+ protected $_cacheTag= 'priceproposal_admin_item';
14
+
15
+ protected function _construct()
16
+ {
17
+ $this->_init('priceproposal/item');
18
+ }
19
+
20
+ public function createProposal($data)
21
+ {
22
+ $product_id=$data['product_id'];
23
+ $product_name=Mage::getModel('catalog/product')->load($product_id)->getName(); //getting product object for particular product id
24
+ $competitior_name=$data['competitor_name'];
25
+ $competitior_price=$data['competitor_price'];
26
+ $competitior_link=$data['competitor_url'];
27
+ $user_email=$data['user_email'];
28
+ $user_skype=$data['user_skype'];
29
+ $user_phone=$data['user_phone'];
30
+ $comment=$data['comment'];
31
+ $status=0;
32
+
33
+ $storeId= Mage::app()->getStore()->getId();
34
+ $model = Mage::getModel('priceproposal/item');
35
+ $model ->setData('store_id', $storeId);
36
+ $model ->setData('product_id', $product_id);
37
+ $model ->setData('product_name', $product_name);
38
+ $model ->setData('competitior_name', $competitior_name);
39
+ $model ->setData('competitior_price', $competitior_price);
40
+ $model ->setData('competitior_link', $competitior_link);
41
+ $model ->setData('user_email', $user_email);
42
+ $model ->setData('user_skype', $user_skype);
43
+ $model ->setData('user_phone', $user_phone);
44
+ $model ->setData('comment', $comment);
45
+ $model ->setData('status', $status);
46
+ $model ->save();
47
+ }
48
+
49
+ }
app/code/community/Magazento/Priceproposal/Model/Mysql4/Item.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Priceproposal_Model_Mysql4_Item extends Mage_Core_Model_Mysql4_Abstract {
12
+
13
+ protected function _construct() {
14
+ $this->_init('priceproposal/item', 'item_id');
15
+ }
16
+
17
+ protected function _beforeSave(Mage_Core_Model_Abstract $object) {
18
+ $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
19
+ if (!$object->getFromTime()) {
20
+ $object->setFromTime(Mage::getSingleton('core/date')->gmtDate());
21
+ } else {
22
+ $object->setFromTime(Mage::app()->getLocale()->date($object->getFromTime(), $dateFormatIso));
23
+ $object->setFromTime($object->getFromTime()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
24
+ $object->setFromTime(Mage::getSingleton('core/date')->gmtDate(null, $object->getFromTime()));
25
+ }
26
+ $object->setData('from_time', Mage::getSingleton('core/date')->gmtDate());
27
+
28
+ return $this;
29
+ }
30
+
31
+ protected function _afterSave(Mage_Core_Model_Abstract $object) {
32
+ $condition = $this->_getWriteAdapter()->quoteInto('item_id = ?', $object->getId());
33
+ $this->_getWriteAdapter()->delete($this->getTable('priceproposal/item_store'), $condition);
34
+ if (!$object->getData('stores')) {
35
+ $object->setData('stores', $object->getData('store_id'));
36
+ }
37
+ if (in_array(0, $object->getData('stores'))) {
38
+ $object->setData('stores', array(0));
39
+ }
40
+ foreach ((array) $object->getData('stores') as $store) {
41
+ $storeArray = array();
42
+ $storeArray['item_id'] = $object->getId();
43
+ $storeArray['store_id'] = $store;
44
+ $this->_getWriteAdapter()->insert($this->getTable('priceproposal/item_store'), $storeArray);
45
+ }
46
+ return parent::_afterSave($object);
47
+ }
48
+ protected function _afterLoad(Mage_Core_Model_Abstract $object) {
49
+ $select = $this->_getReadAdapter()->select()
50
+ ->from($this->getTable('priceproposal/item_store'))
51
+ ->where('item_id = ?', $object->getId());
52
+
53
+ if ($data = $this->_getReadAdapter()->fetchAll($select)) {
54
+ $storesArray = array();
55
+ foreach ($data as $row) {
56
+ $storesArray[] = $row['store_id'];
57
+ }
58
+ $object->setData('store_id', $storesArray);
59
+ }
60
+ $object->setData('thumb','<img src="'. $object->getData('image') .'" /> ' );
61
+ // var_dump($object);
62
+ // exit();
63
+ return parent::_afterLoad($object);
64
+ }
65
+
66
+ protected function _beforeDelete(Mage_Core_Model_Abstract $object) {
67
+ $adapter = $this->_getReadAdapter();
68
+ $adapter->delete($this->getTable('priceproposal/item_store'), 'item_id=' . $object->getId());
69
+ }
70
+
71
+ }
app/code/community/Magazento/Priceproposal/Model/Mysql4/Item/Collection.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Priceproposal_Model_Mysql4_Item_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
12
+
13
+ protected function _construct() {
14
+ $this->_init('priceproposal/item');
15
+ }
16
+
17
+ public function toOptionArray() {
18
+ return $this->_toOptionArray('item_id', 'name');
19
+ }
20
+
21
+ public function addStoreFilter($store, $withAdmin = true) {
22
+ if ($store instanceof Mage_Core_Model_Store) {
23
+ $store = array($store->getId());
24
+ }
25
+
26
+ $this->getSelect()->join(
27
+ array('item_store' => $this->getTable('priceproposal/item_store')),
28
+ 'main_table.item_id = item_store.item_id',
29
+ array()
30
+ )
31
+ ->where('item_store.store_id in (?)', ($withAdmin ? array(0, $store) : $store));
32
+
33
+ return $this;
34
+ }
35
+ public function addNowFilter() {
36
+ $now = Mage::getSingleton('core/date')->gmtDate();
37
+ $where = "from_time < '" . $now . "' AND ((to_time > '" . $now . "') OR (to_time IS NULL))";
38
+ $this->getSelect()->where($where);
39
+ }
40
+
41
+ }
app/code/community/Magazento/Priceproposal/Model/Wysiwyg/Config.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Priceproposal_Model_Wysiwyg_Config extends Mage_Cms_Model_Wysiwyg_Config {
12
+
13
+ public function getConfig($data = array()) {
14
+
15
+
16
+ $config = parent::getConfig($data);
17
+ $config->setData('files_browser_window_url', Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index/'));
18
+ $config->setData('directives_url', Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive'));
19
+ $config->setData('directives_url_quoted', preg_quote($config->getData('directives_url')));
20
+ $config->setData('widget_window_url', Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/widget/index'));
21
+
22
+
23
+ return $config;
24
+ }
25
+
26
+ }
app/code/community/Magazento/Priceproposal/controllers/Admin/ItemController.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on May 3, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Magazento_Priceproposal_Admin_ItemController extends Mage_Adminhtml_Controller_Action {
12
+
13
+ protected function _initAction() {
14
+ $this->loadLayout()
15
+ ->_setActiveMenu('magazento/priceproposal')
16
+ ->_addBreadcrumb(Mage::helper('priceproposal')->__('Priceproposal'), Mage::helper('priceproposal')->__('Priceproposal'))
17
+ ->_addBreadcrumb(Mage::helper('priceproposal')->__('Priceproposal Items'), Mage::helper('priceproposal')->__('Priceproposal Items'))
18
+ ;
19
+ return $this;
20
+ }
21
+
22
+ public function indexAction() {
23
+ $this->_initAction()
24
+ ->_addContent($this->getLayout()->createBlock('priceproposal/admin_item'))
25
+ ->renderLayout();
26
+ }
27
+
28
+
29
+ public function deleteAction() {
30
+ // check if we know what should be deleted
31
+ if ($id = $this->getRequest()->getParam('item_id')) {
32
+ $name = "";
33
+ try {
34
+ // init model and delete
35
+ $model = Mage::getModel('priceproposal/item');
36
+ $model->load($id);
37
+ $name = $model->getName();
38
+ $model->delete();
39
+ // display success message
40
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('priceproposal')->__('Item was successfully deleted'));
41
+ // go to grid
42
+ $this->_redirect('*/*/');
43
+ return;
44
+ } catch (Exception $e) {
45
+ // display error message
46
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
47
+ // go back to edit form
48
+ $this->_redirect('*/*/edit', array('item_id' => $id));
49
+ return;
50
+ }
51
+ }
52
+ // display error message
53
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('priceproposal')->__('Unable to find a item to delete'));
54
+ // go to grid
55
+ $this->_redirect('*/*/');
56
+ }
57
+
58
+
59
+ protected function _isAllowed() {
60
+ return Mage::getSingleton('admin/session')->isAllowed('priceproposal/item');
61
+ }
62
+
63
+ public function wysiwygAction() {
64
+ $elementId = $this->getRequest()->getParam('element_id', md5(microtime()));
65
+ $content = $this->getLayout()->createBlock('adminhtml/catalog_helper_form_wysiwyg_content', '', array(
66
+ 'editor_element_id' => $elementId
67
+ ));
68
+ $this->getResponse()->setBody($content->toHtml());
69
+ }
70
+
71
+
72
+
73
+ public function massStatusAction()
74
+ {
75
+ $itemIds = $this->getRequest()->getParam('massaction');
76
+ if(!is_array($itemIds)) {
77
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
78
+ } else {
79
+ try {
80
+ foreach ($itemIds as $itemId) {
81
+ $model = Mage::getSingleton('priceproposal/item')
82
+ ->load($itemId)
83
+ ->setStatus($this->getRequest()->getParam('status'))
84
+ ->setIsMassupdate(true)
85
+ ->save();
86
+ }
87
+ $this->_getSession()->addSuccess(
88
+ $this->__('Total of %d record(s) were successfully updated', count($itemIds))
89
+ );
90
+ } catch (Exception $e) {
91
+ $this->_getSession()->addError($e->getMessage());
92
+ }
93
+ }
94
+ $this->_redirect('*/*/index');
95
+ }
96
+
97
+ public function massDeleteAction() {
98
+ $itemIds = $this->getRequest()->getParam('massaction');
99
+ if(!is_array($itemIds)) {
100
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('priceproposal')->__('Please select item(s)'));
101
+ } else {
102
+ try {
103
+ foreach ($itemIds as $itemId) {
104
+ $mass = Mage::getModel('priceproposal/item')->load($itemId);
105
+ $mass->delete();
106
+ }
107
+ Mage::getSingleton('adminhtml/session')->addSuccess(
108
+ Mage::helper('priceproposal')->__(
109
+ 'Total of %d record(s) were successfully deleted', count($itemIds)
110
+ )
111
+ );
112
+ } catch (Exception $e) {
113
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
114
+ }
115
+ }
116
+ $this->_redirect('*/*/index');
117
+ }
118
+
119
+ public function seenAction() {
120
+ // check if we know what should be deleted
121
+ if ($id = $this->getRequest()->getParam('item_id')) {
122
+ try {
123
+ $model = Mage::getModel('priceproposal/item');
124
+ $model->load($id);
125
+ $model->setStatus(1);
126
+ $model->save();
127
+ $this->_redirect('*/*/');
128
+ return;
129
+ } catch (Exception $e) {
130
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
131
+ $this->_redirect('*/*/', array('item_id' => $id));
132
+ return;
133
+ }
134
+ }
135
+ // go to grid
136
+ $this->_redirect('*/*/');
137
+ }
138
+
139
+
140
+
141
+ public function exportCsvAction()
142
+ {
143
+ $fileName = 'items.csv';
144
+ $content = $this->getLayout()->createBlock('priceproposal/admin_item_grid')
145
+ ->getCsv();
146
+ $this->_sendUploadResponse($fileName, $content);
147
+ }
148
+
149
+ public function exportXmlAction()
150
+ {
151
+ $fileName = 'items.xml';
152
+ $content = $this->getLayout()->createBlock('priceproposal/admin_item_grid')
153
+ ->getXml();
154
+ $this->_sendUploadResponse($fileName, $content);
155
+ }
156
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
157
+ {
158
+ $response = $this->getResponse();
159
+ $response->setHeader('HTTP/1.1 200 OK','');
160
+ $response->setHeader('Pragma', 'public', true);
161
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
162
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
163
+ $response->setHeader('Last-Modified', date('r'));
164
+ $response->setHeader('Accept-Ranges', 'bytes');
165
+ $response->setHeader('Content-Length', strlen($content));
166
+ $response->setHeader('Content-type', $contentType);
167
+ $response->setBody($content);
168
+ $response->sendResponse();
169
+ die;
170
+ }
171
+ }
app/code/community/Magazento/Priceproposal/controllers/IndexController.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magazento_Priceproposal_IndexController extends Mage_Core_Controller_Front_Action {
4
+
5
+ public function formAction() {
6
+ echo Mage::helper('priceproposal')->formdata();
7
+ }
8
+
9
+ public function indexAction() {
10
+ echo '<div class="proposal-answer">';
11
+ if ($data = $this->getRequest()->getParams()) {
12
+ Mage::getModel('priceproposal/item')->createProposal($data);
13
+ }
14
+ echo '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'frontend/default/default/magazento/priceproposal/help_desk.png" alt="help desk" />';
15
+ echo '<span>'.Mage::helper('priceproposal')->__('Thank you for your help!').'</span>';
16
+ echo '</div>';
17
+ }
18
+
19
+ }
20
+ // <!-- PROPOSAL START -->
21
+ // echo $this->getLayout()->createBlock('priceproposal/request')->setTemplate('magazento/priceproposal/data.phtml')->toHtml();
22
+ //<!-- PROPOSAL END -->
23
+ ?>
app/code/community/Magazento/Priceproposal/etc/config.xml ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <Magazento_Priceproposal>
5
+ <version>1.0.0</version>
6
+ </Magazento_Priceproposal>
7
+ </modules>
8
+ <frontend>
9
+ <layout>
10
+ <updates>
11
+ <priceproposal>
12
+ <file>magazento_priceproposal.xml</file>
13
+ </priceproposal>
14
+ </updates>
15
+ </layout>
16
+ <translate>
17
+ <modules>
18
+ <Magazento_Priceproposal>
19
+ <files>
20
+ <default>Magazento_Priceproposal.csv</default>
21
+ </files>
22
+ </Magazento_Priceproposal>
23
+ </modules>
24
+ </translate>
25
+ </frontend>
26
+
27
+ <global>
28
+ <rewrite>
29
+ <mage_adminhtml_system_variable>
30
+ <from><![CDATA[#^/priceproposal/system_variable#]]>
31
+ </from>
32
+ <to>/admin/system_variable</to>
33
+ </mage_adminhtml_system_variable>
34
+ </rewrite>
35
+ <models>
36
+ <priceproposal>
37
+ <class>Magazento_Priceproposal_Model</class>
38
+ <resourceModel>priceproposal_mysql4</resourceModel>
39
+ </priceproposal>
40
+ <priceproposal_mysql4>
41
+ <class>Magazento_Priceproposal_Model_Mysql4</class>
42
+ <entities>
43
+ <item>
44
+ <table>magazento_priceproposal_item</table>
45
+ </item>
46
+ <item_store>
47
+ <table>magazento_priceproposal_item_store</table>
48
+ </item_store>
49
+ </entities>
50
+ </priceproposal_mysql4>
51
+ </models>
52
+ <resources>
53
+ <priceproposal_setup>
54
+ <setup>
55
+ <module>Magazento_Priceproposal</module>
56
+ </setup>
57
+ <connection>
58
+ <use>core_setup</use>
59
+ </connection>
60
+ </priceproposal_setup>
61
+ <priceproposal_write>
62
+ <connection>
63
+ <use>core_write</use>
64
+ </connection>
65
+ </priceproposal_write>
66
+ <priceproposal_read>
67
+ <connection>
68
+ <use>core_read</use>
69
+ </connection>
70
+ </priceproposal_read>
71
+ </resources>
72
+ <blocks>
73
+ <priceproposal>
74
+ <class>Magazento_Priceproposal_Block</class>
75
+ </priceproposal>
76
+ </blocks>
77
+ <helpers>
78
+ <priceproposal>
79
+ <class>Magazento_Priceproposal_Helper</class>
80
+ </priceproposal>
81
+ </helpers>
82
+ </global>
83
+ <admin>
84
+ <routers>
85
+ <magazento_priceproposal>
86
+ <use>admin</use>
87
+ <args>
88
+ <module>Magazento_Priceproposal</module>
89
+ <frontName>priceproposal</frontName>
90
+ </args>
91
+ </magazento_priceproposal>
92
+ </routers>
93
+ </admin>
94
+
95
+ <adminhtml>
96
+ <acl>
97
+ <resources>
98
+ <admin>
99
+ <children>
100
+ <priceproposal translate="title">
101
+ <title>Priceproposal</title>
102
+ <children>
103
+ <item translate="title">
104
+ <title>Manage items </title>
105
+ </item>
106
+ </children>
107
+ <sort_order>65</sort_order>
108
+ </priceproposal>
109
+ <system>
110
+ <children>
111
+ <config>
112
+ <children>
113
+ <priceproposal>
114
+ <title>Priceproposal</title>
115
+ <sort_order>101</sort_order>
116
+ </priceproposal>
117
+ </children>
118
+ </config>
119
+ </children>
120
+ </system>
121
+ </children>
122
+ </admin>
123
+ </resources>
124
+ </acl>
125
+ <menu>
126
+ <magazento translate="title" module="priceproposal">
127
+ <title>Magazento</title>
128
+ <sort_order>65</sort_order>
129
+ <children>
130
+ <priceproposal translate="title" module="priceproposal">
131
+ <title>Priceproposal</title>
132
+ <sort_order>65</sort_order>
133
+ <children>
134
+ <item translate="title" module="priceproposal">
135
+ <title>Items</title>
136
+ <action>priceproposal/admin_item/</action>
137
+ <resource>priceproposal/admin/item</resource>
138
+ </item>
139
+ <settings translate="title" module="priceproposal">
140
+ <title>Settings</title>
141
+ <action>adminhtml/system_config/edit/section/priceproposal</action>
142
+ <sort_order>40</sort_order>
143
+ </settings>
144
+ </children>
145
+ </priceproposal>
146
+ </children>
147
+ </magazento>
148
+ </menu>
149
+ </adminhtml>
150
+ <default>
151
+ <priceproposal>
152
+ <options>
153
+ <title>Please briefly describe your request. We will work on it as soon as possible.</title>
154
+ <button>Price Complain</button>
155
+ </options>
156
+ </priceproposal>
157
+ </default>
158
+ </config>
app/code/community/Magazento/Priceproposal/etc/system.xml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <magazento translate="label">
5
+ <label>Magazento.com</label>
6
+ <sort_order>250</sort_order>
7
+ </magazento>
8
+ </tabs>
9
+ <sections>
10
+ <priceproposal translate="label" module="priceproposal">
11
+ <label>Priceproposal</label>
12
+ <tab>magazento</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>100</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <developer>
20
+ <frontend_model>priceproposal/developer</frontend_model>
21
+ <sort_order>999</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ </developer>
26
+ <options translate="label">
27
+ <label>Options</label>
28
+ <frontend_type>text</frontend_type>
29
+ <sort_order>10</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ <fields>
34
+ <title translate="label">
35
+ <label>Title</label>
36
+ <frontend_type>text</frontend_type>
37
+ <sort_order>60</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>1</show_in_store>
41
+ </title>
42
+ <button translate="label">
43
+ <label>Button</label>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>60</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ </button>
50
+ </fields>
51
+ </options>
52
+ </groups>
53
+ </priceproposal>
54
+ </sections>
55
+ </config>
app/code/community/Magazento/Priceproposal/sql/priceproposal_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 27, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Magazento.com
5
+ * Copyright Proskuryakov Ivan. Magazento.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ $installer = $this;
12
+ $installer->startSetup();
13
+ $installer->run("
14
+ -- --------------------------------------------------------
15
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('magazento_priceproposal_item')}` (
16
+ `item_id` smallint(6) NOT NULL AUTO_INCREMENT,
17
+ `store_id` int(11) NOT NULL DEFAULT '0',
18
+ `product_id` int(11) NOT NULL,
19
+ `product_name` varchar(250) NOT NULL,
20
+ `competitior_name` varchar(100) NOT NULL,
21
+ `competitior_price` varchar(50) NOT NULL,
22
+ `competitior_link` tinytext NOT NULL,
23
+ `user_email` varchar(250) NOT NULL,
24
+ `user_skype` varchar(250) NOT NULL,
25
+ `user_phone` varchar(250) NOT NULL,
26
+ `comment` text NOT NULL,
27
+ `from_time` datetime DEFAULT NULL,
28
+ `status` tinyint(4) NOT NULL DEFAULT '0',
29
+ PRIMARY KEY (`item_id`)
30
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=58 ;
31
+
32
+ INSERT INTO `{$this->getTable('magazento_priceproposal_item')}` (`item_id`, `store_id`, `product_id`, `product_name`, `competitior_name`, `competitior_price`, `competitior_link`, `user_email`, `user_skype`, `user_phone`, `comment`, `from_time`, `status`) VALUES
33
+ (57, 1, 19, 'AT&T 8525 PDA', 'Sony PS3', '500 USD', 'http://us.playstation.com/', 'magazento@gmail.com', 'VOLGODARK', ' 7 909389 2222', 'The official PlayStation resource for PlayStation 3 PS3. ... Sony makedotbelieve. PlayStation', '2011-05-03 00:41:16', 0);
34
+
35
+
36
+ -- --------------------------------------------------------
37
+
38
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('magazento_priceproposal_item_store')}` (
39
+ `item_id` smallint(6) unsigned DEFAULT NULL,
40
+ `store_id` smallint(6) unsigned DEFAULT NULL
41
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
42
+
43
+ INSERT INTO `{$this->getTable('magazento_priceproposal_item_store')}` (`item_id`, `store_id`) VALUES
44
+ (5, 0),
45
+ (57, 1);
46
+
47
+ ");
48
+
49
+ $installer->endSetup();
50
+ ?>
app/design/frontend/default/default/layout/magazento_priceproposal.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <layout>
2
+ <!-- LAYOUT START -->
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss"><stylesheet>magazento/priceproposal/colorbox.css</stylesheet></action>
6
+ <action method="addCss"><stylesheet>magazento/priceproposal/style.css</stylesheet></action>
7
+ <action method="addItem">
8
+ <type>skin_js</type>
9
+ <name>magazento/priceproposal/jquery.colorbox.js</name>
10
+ <params/>
11
+ </action>
12
+ <action method="addItem">
13
+ <type>skin_js</type>
14
+ <name>magazento/jquery-1.5.1.min.js</name>
15
+ <params/>
16
+ </action>
17
+ </reference>
18
+ </default>
19
+ <!-- LAYOUT END -->
20
+ </layout>
app/design/frontend/default/default/template/magazento/priceproposal/data.phtml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $product = Mage::registry('current_product'); ?>
2
+
3
+ <script type="text/javascript">
4
+ var JQR = jQuery.noConflict();
5
+
6
+ function submitForm() {
7
+ var competitor_name = escape(JQR('input[name=competitor_name]').val());
8
+ var competitor_price = escape(JQR('input[name=competitor_price]').val());
9
+ var competitor_url = escape(JQR('input[name=competitor_url]').val());
10
+
11
+ var user_email = escape(JQR('input[name=user_email]').val());
12
+ var user_phone = escape(JQR('input[name=user_phone]').val());
13
+ var user_skype = escape(JQR('input[name=user_skype]').val());
14
+ var comment = escape(JQR('textarea[name=comment]').val());
15
+
16
+ var warning_text = 'Product name, price and URL are requried fields';
17
+
18
+ if ((competitor_name!='') && (competitor_url!='') && (competitor_price!='')) {
19
+ JQR('div.proposal-information').text('Press "Submit" again for send');
20
+ JQR('a').colorbox({href:"<?php echo Mage::getUrl('priceproposal/'); ?>"+
21
+ "?competitor_name="+competitor_name+
22
+ "&competitor_price="+competitor_price+
23
+ "&competitor_url="+competitor_url+
24
+ "&user_email="+user_email+
25
+ "&user_phone="+user_phone+
26
+ "&user_skype="+user_skype+
27
+ "&comment="+comment+
28
+ "&product_id="+<?php echo urlencode($product->getId()); ?>
29
+ });
30
+ } else {
31
+ JQR('div.proposal-information').text(warning_text);
32
+ }
33
+
34
+ }
35
+
36
+ function indexForm() {
37
+ JQR('button').colorbox({href:"<?php echo Mage::getUrl('priceproposal/index/form/'); ?>"});
38
+ }
39
+ </script>
40
+
41
+
42
+ <div class="add-proposal">
43
+ <label for="proposal"><?php echo $this->__('Send quote:'); ?></label>
44
+ <button
45
+ class='button btn-cart'
46
+ title="<?php echo Mage::getStoreConfig('priceproposal/options/title') ?>"
47
+ onclick="javascript:indexForm();"
48
+ type="button">
49
+ <span><span><?php echo Mage::getStoreConfig('priceproposal/options/button') ?></span></span>
50
+ </button>
51
+ </div>
app/etc/modules/Magazento_Priceproposal.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magazento_Priceproposal>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Magazento_Priceproposal>
8
+ </modules>
9
+ </config>
app/locale/en_US/Magazento_Priceproposal.csv ADDED
@@ -0,0 +1 @@
 
1
+ "Thank you for your help!","Thank you for your help!"
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Magazento_PriceProposal</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Allows customers to send price feedback directly form product page via Ajax. Simple and convenient.</summary>
10
+ <description>PriceProposal is module that add new functionality to your customers. Customers can create proposals in just seconds - it's a new type of product price feedback. Now customers can help shopowners, custemrs send a price request to magento administrator. And shopowners can effectively track customer quotations and manage product prices in backend.
11
+
12
+ This extension fully automated and integrated PriceProposal functionality in Magento CMS. Conveniently manage all your price requests and proposals in one place. It's really simple and easy.</description>
13
+ <notes>1.0.0</notes>
14
+ <authors><author><name>volgodark</name><user>auto-converted</user><email>volgodark@gmail.com</email></author></authors>
15
+ <date>2011-05-06</date>
16
+ <time>09:31:41</time>
17
+ <contents><target name="magelocale"><dir name="en_US"><file name="Magazento_Priceproposal.csv" hash="535253a549bbfa60c8a0b2619cdae7bd"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="magazento_priceproposal.xml" hash="2b04766ae062f127cc894087f1d36dc2"/></dir><dir name="template"><dir name="magazento"><dir name="priceproposal"><file name="data.phtml" hash="b97bfaab79c157841bab2fddc90debb5"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="magazento"><dir name="priceproposal"><dir name="images"><dir name="ie6"><file name="borderBottomCenter.png" hash="1936585831e8bcf4eb5ef1081c8e2574"/><file name="borderBottomLeft.png" hash="7ceeb01563f030dc47837fd8bad29488"/><file name="borderBottomRight.png" hash="297fb77440870d91f519bcecdb312725"/><file name="borderMiddleLeft.png" hash="64df0244eeaade27764d2cf33606527b"/><file name="borderMiddleRight.png" hash="9fa458eaaa35b80b2452f35a1d6b4d0c"/><file name="borderTopCenter.png" hash="01ecb01841270f3a765aadf4900929f3"/><file name="borderTopLeft.png" hash="bf4949b95b09d255edd9bcb8358a3557"/><file name="borderTopRight.png" hash="51315fa19507a33d5f1b5411598593e7"/></dir><file name="border.png" hash="7ca8a1d2eb0763b35c266cd54bee2fa5"/><file name="controls.png" hash="e687384db0b8582a2dd48c00c653dfd1"/><file name="loading.gif" hash="e6611f867d63754b7a2a974fb0a0e7dc"/><file name="loading_background.png" hash="acf427e932fb9413700a4b8b58b41eec"/><file name="overlay.png" hash="790376e15a036959e358a19d4a7ea437"/></dir><file name="colorbox.css" hash="b209b53af1453331956c83736449f784"/><file name="help_desk.png" hash="5172000a8bdbce72c49429743d522d38"/><file name="jquery.colorbox.js" hash="bd557c58f56081e1e3593057446a65dd"/><file name="promo.jpg" hash="88520d456df68c98130433b5184b8e7f"/><file name="style.css" hash="9eff09a88b926275a21e5f0049125b3e"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Magazento"><dir name="Priceproposal"><dir name="Block"><dir name="Admin"><dir name="Item"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="c211eaafb80df9d5ca735e98b939182c"/><file name="Other.php" hash="e1deda10926fe36a71e40dc1c70dd38b"/></dir><file name="Form.php" hash="7dcb54b10c3fd9c7d3f85f2ab4d6a376"/><file name="Tabs.php" hash="48be5692736fd0907e7253d708ca211f"/></dir><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="13eae0734c626a6c916f930174e1a234"/></dir></dir><file name="Edit.php" hash="8f304f5224adf095073249aa98f017ce"/><file name="Grid.php" hash="dbaca2a4060ef22849d237ee4b217754"/></dir><file name="Item.php" hash="8087de5b9cf9db8f25e4278479c884e4"/></dir><file name="Developer.php" hash="0ad047f2015a73082f12200f874d3c09"/><file name="Request.php" hash="83bb7d6d23014a5d1b65139986ba3d24"/></dir><dir name="controllers"><dir name="Admin"><file name="ItemController.php" hash="12207096b0e7ae1962686daeac61a03f"/></dir><file name="IndexController.php" hash="3ccdf5e166dc75bfe9822dc4bf74d71f"/></dir><dir name="etc"><file name="config.xml" hash="dee563eb7ccfa395f4e58c5fdc9a3421"/><file name="system.xml" hash="9367f42f1e2cfbaf3c0593d7ae0143d8"/></dir><dir name="Helper"><file name="Data.php" hash="b26fd776e131be7ca6aebca414e626d5"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Item"><file name="Collection.php" hash="aaede73d0cc77604f2eeedb49d363931"/></dir><file name="Item.php" hash="016e533f765e7fe5dfcd53a02b523568"/></dir><dir name="Wysiwyg"><file name="Config.php" hash="896efaa4437ebaf19d9446ecc438c068"/></dir><file name="Data.php" hash="d4b31d6f247565d9ddc12d21ca318562"/><file name="Item.php" hash="a84e6dcb7fb0451125bdfdbdea377243"/></dir><dir name="sql"><dir name="priceproposal_setup"><file name="mysql4-install-1.0.0.php" hash="f9161869668b116e9b3e34c978bef61e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magazento_Priceproposal.xml" hash="1f47e087bc064bf1d2f7d07d5e0594e4"/></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies/>
20
+ </package>
skin/frontend/default/default/magazento/priceproposal/colorbox.css ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ColorBox Core Style:
3
+ The following CSS is consistent between example themes and should not be altered.
4
+ */
5
+ #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
6
+ #cboxOverlay{position:fixed; width:100%; height:100%;}
7
+ #cboxMiddleLeft, #cboxBottomLeft{clear:left;}
8
+ #cboxContent{position:relative;}
9
+ #cboxLoadedContent{overflow:auto;}
10
+ #cboxTitle{margin:0;}
11
+ #cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;}
12
+ #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
13
+ .cboxPhoto{float:left; margin:auto; border:0; display:block;}
14
+ .cboxIframe{width:100%; height:100%; display:block; border:0;}
15
+
16
+ /*
17
+ User Style:
18
+ Change the following styles to modify the appearance of ColorBox. They are
19
+ ordered & tabbed in a way that represents the nesting of the generated HTML.
20
+ */
21
+ #cboxOverlay{background:url(images/overlay.png) repeat 0 0;}
22
+ #colorbox{}
23
+ #cboxTopLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -100px 0;}
24
+ #cboxTopRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -129px 0;}
25
+ #cboxBottomLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -100px -29px;}
26
+ #cboxBottomRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -129px -29px;}
27
+ #cboxMiddleLeft{width:21px; background:url(images/controls.png) left top repeat-y;}
28
+ #cboxMiddleRight{width:21px; background:url(images/controls.png) right top repeat-y;}
29
+ #cboxTopCenter{height:21px; background:url(images/border.png) 0 0 repeat-x;}
30
+ #cboxBottomCenter{height:21px; background:url(images/border.png) 0 -29px repeat-x;}
31
+ #cboxContent{background:#fff; overflow:hidden;}
32
+ #cboxError{padding:50px; border:1px solid #ccc;}
33
+ #cboxLoadedContent{margin-bottom:28px;}
34
+ #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;}
35
+ #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;}
36
+ #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
37
+ #cboxPrevious{position:absolute; bottom:0; left:0; background:url(images/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;}
38
+ #cboxPrevious.hover{background-position:-75px -25px;}
39
+ #cboxNext{position:absolute; bottom:0; left:27px; background:url(images/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;}
40
+ #cboxNext.hover{background-position:-50px -25px;}
41
+ #cboxLoadingOverlay{background:url(images/loading_background.png) no-repeat center center;}
42
+ #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;}
43
+ #cboxClose{position:absolute; bottom:0; right:0; background:url(images/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;}
44
+ #cboxClose.hover{background-position:-25px -25px;}
45
+
46
+ /*
47
+ The following fixes a problem where IE7+ replaces a PNG's alpha transparency with a black fill
48
+ when an alpha filter (opacity change) is set on the element or ancestor element.
49
+ */
50
+ .cboxIE #cboxTopLeft,
51
+ .cboxIE #cboxTopCenter,
52
+ .cboxIE #cboxTopRight,
53
+ .cboxIE #cboxBottomLeft,
54
+ .cboxIE #cboxBottomCenter,
55
+ .cboxIE #cboxBottomRight,
56
+ .cboxIE #cboxMiddleLeft,
57
+ .cboxIE #cboxMiddleRight {
58
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
59
+ }
60
+
61
+ /*
62
+ The following provides PNG transparency support for IE6
63
+ */
64
+ .cboxIE6 #cboxTopLeft{background:url(images/ie6/borderTopLeft.png);}
65
+ .cboxIE6 #cboxTopCenter{background:url(images/ie6/borderTopCenter.png);}
66
+ .cboxIE6 #cboxTopRight{background:url(images/ie6/borderTopRight.png);}
67
+ .cboxIE6 #cboxBottomLeft{background:url(images/ie6/borderBottomLeft.png);}
68
+ .cboxIE6 #cboxBottomCenter{background:url(images/ie6/borderBottomCenter.png);}
69
+ .cboxIE6 #cboxBottomRight{background:url(images/ie6/borderBottomRight.png);}
70
+ .cboxIE6 #cboxMiddleLeft{background:url(images/ie6/borderMiddleLeft.png);}
71
+ .cboxIE6 #cboxMiddleRight{background:url(images/ie6/borderMiddleRight.png);}
72
+
73
+ .cboxIE6 #cboxTopLeft,
74
+ .cboxIE6 #cboxTopCenter,
75
+ .cboxIE6 #cboxTopRight,
76
+ .cboxIE6 #cboxBottomLeft,
77
+ .cboxIE6 #cboxBottomCenter,
78
+ .cboxIE6 #cboxBottomRight,
79
+ .cboxIE6 #cboxMiddleLeft,
80
+ .cboxIE6 #cboxMiddleRight {
81
+ _behavior: expression(this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('"')[1], this.style.background = "none", this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.src + ", sizingMethod='scale')");
82
+ }
skin/frontend/default/default/magazento/priceproposal/help_desk.png ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/images/border.png ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/images/controls.png ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/images/ie6/borderBottomCenter.png ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/images/ie6/borderBottomLeft.png ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/images/ie6/borderBottomRight.png ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/images/ie6/borderMiddleLeft.png ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/images/ie6/borderMiddleRight.png ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/images/ie6/borderTopCenter.png ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/images/ie6/borderTopLeft.png ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/images/ie6/borderTopRight.png ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/images/loading.gif ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/images/loading_background.png ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/images/overlay.png ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/jquery.colorbox.js ADDED
@@ -0,0 +1,815 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // ColorBox v1.3.16 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
2
+ // Copyright (c) 2011 Jack Moore - jack@colorpowered.com
3
+ // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
4
+ var JQR = jQuery.noConflict();
5
+ (function (JQR, document, window) {
6
+ var
7
+ // ColorBox Default Settings.
8
+ // See http://colorpowered.com/colorbox for details.
9
+ defaults = {
10
+ transition: "elastic",
11
+ speed: 300,
12
+ width: false,
13
+ initialWidth: "600",
14
+ innerWidth: false,
15
+ maxWidth: false,
16
+ height: false,
17
+ initialHeight: "450",
18
+ innerHeight: false,
19
+ maxHeight: false,
20
+ scalePhotos: true,
21
+ scrolling: true,
22
+ inline: false,
23
+ html: false,
24
+ iframe: false,
25
+ fastIframe: true,
26
+ photo: false,
27
+ href: false,
28
+ title: false,
29
+ rel: false,
30
+ opacity: 0.9,
31
+ preloading: true,
32
+ current: "image {current} of {total}",
33
+ previous: "previous",
34
+ next: "next",
35
+ close: "close",
36
+ open: false,
37
+ returnFocus: true,
38
+ loop: true,
39
+ slideshow: false,
40
+ slideshowAuto: true,
41
+ slideshowSpeed: 2500,
42
+ slideshowStart: "start slideshow",
43
+ slideshowStop: "stop slideshow",
44
+ onOpen: false,
45
+ onLoad: false,
46
+ onComplete: false,
47
+ onCleanup: false,
48
+ onClosed: false,
49
+ overlayClose: true,
50
+ escKey: true,
51
+ arrowKey: true
52
+ },
53
+
54
+ // Abstracting the HTML and event identifiers for easy rebranding
55
+ colorbox = 'colorbox',
56
+ prefix = 'cbox',
57
+
58
+ // Events
59
+ event_open = prefix + '_open',
60
+ event_load = prefix + '_load',
61
+ event_complete = prefix + '_complete',
62
+ event_cleanup = prefix + '_cleanup',
63
+ event_closed = prefix + '_closed',
64
+ event_purge = prefix + '_purge',
65
+
66
+ // Special Handling for IE
67
+ isIE = JQR.browser.msie && !JQR.support.opacity, // feature detection alone gave a false positive on at least one phone browser and on some development versions of Chrome.
68
+ isIE6 = isIE && JQR.browser.version < 7,
69
+ event_ie6 = prefix + '_IE6',
70
+
71
+ // Cached jQuery Object Variables
72
+ JQRoverlay,
73
+ JQRbox,
74
+ JQRwrap,
75
+ JQRcontent,
76
+ JQRtopBorder,
77
+ JQRleftBorder,
78
+ JQRrightBorder,
79
+ JQRbottomBorder,
80
+ JQRrelated,
81
+ JQRwindow,
82
+ JQRloaded,
83
+ JQRloadingBay,
84
+ JQRloadingOverlay,
85
+ JQRtitle,
86
+ JQRcurrent,
87
+ JQRslideshow,
88
+ JQRnext,
89
+ JQRprev,
90
+ JQRclose,
91
+ JQRgroupControls,
92
+
93
+ // Variables for cached values or use across multiple functions
94
+ settings = {},
95
+ interfaceHeight,
96
+ interfaceWidth,
97
+ loadedHeight,
98
+ loadedWidth,
99
+ element,
100
+ index,
101
+ photo,
102
+ open,
103
+ active,
104
+ closing = false,
105
+
106
+ publicMethod,
107
+ boxElement = prefix + 'Element';
108
+
109
+ // ****************
110
+ // HELPER FUNCTIONS
111
+ // ****************
112
+
113
+ // jQuery object generator to reduce code size
114
+ function JQRdiv(id, cssText) {
115
+ var div = document.createElement('div');
116
+ if (id) {
117
+ div.id = prefix + id;
118
+ }
119
+ div.style.cssText = cssText || false;
120
+ return JQR(div);
121
+ }
122
+
123
+ // Convert % values to pixels
124
+ function setSize(size, dimension) {
125
+ dimension = dimension === 'x' ? JQRwindow.width() : JQRwindow.height();
126
+ return (typeof size === 'string') ? Math.round((/%/.test(size) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size;
127
+ }
128
+
129
+ // Checks an href to see if it is a photo.
130
+ // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
131
+ function isImage(url) {
132
+ return settings.photo || /\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?JQR/i.test(url);
133
+ }
134
+
135
+ // Assigns function results to their respective settings. This allows functions to be used as values.
136
+ function process(settings) {
137
+ for (var i in settings) {
138
+ if (JQR.isFunction(settings[i]) && i.substring(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
139
+ settings[i] = settings[i].call(element);
140
+ }
141
+ }
142
+ settings.rel = settings.rel || element.rel || 'nofollow';
143
+ settings.href = JQR.trim(settings.href || JQR(element).attr('href'));
144
+ settings.title = settings.title || element.title;
145
+ }
146
+
147
+ function trigger(event, callback) {
148
+ if (callback) {
149
+ callback.call(element);
150
+ }
151
+ JQR.event.trigger(event);
152
+ }
153
+
154
+ // Slideshow functionality
155
+ function slideshow() {
156
+ var
157
+ timeOut,
158
+ className = prefix + "Slideshow_",
159
+ click = "click." + prefix,
160
+ start,
161
+ stop,
162
+ clear;
163
+
164
+ if (settings.slideshow && JQRrelated[1]) {
165
+ start = function () {
166
+ JQRslideshow
167
+ .text(settings.slideshowStop)
168
+ .unbind(click)
169
+ .bind(event_complete, function () {
170
+ if (index < JQRrelated.length - 1 || settings.loop) {
171
+ timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
172
+ }
173
+ })
174
+ .bind(event_load, function () {
175
+ clearTimeout(timeOut);
176
+ })
177
+ .one(click + ' ' + event_cleanup, stop);
178
+ JQRbox.removeClass(className + "off").addClass(className + "on");
179
+ timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
180
+ };
181
+
182
+ stop = function () {
183
+ clearTimeout(timeOut);
184
+ JQRslideshow
185
+ .text(settings.slideshowStart)
186
+ .unbind([event_complete, event_load, event_cleanup, click].join(' '))
187
+ .one(click, start);
188
+ JQRbox.removeClass(className + "on").addClass(className + "off");
189
+ };
190
+
191
+ if (settings.slideshowAuto) {
192
+ start();
193
+ } else {
194
+ stop();
195
+ }
196
+ }
197
+ }
198
+
199
+ function launch(elem) {
200
+ if (!closing) {
201
+
202
+ element = elem;
203
+
204
+ process(JQR.extend(settings, JQR.data(element, colorbox)));
205
+
206
+ JQRrelated = JQR(element);
207
+
208
+ index = 0;
209
+
210
+ if (settings.rel !== 'nofollow') {
211
+ JQRrelated = JQR('.' + boxElement).filter(function () {
212
+ var relRelated = JQR.data(this, colorbox).rel || this.rel;
213
+ return (relRelated === settings.rel);
214
+ });
215
+ index = JQRrelated.index(element);
216
+
217
+ // Check direct calls to ColorBox.
218
+ if (index === -1) {
219
+ JQRrelated = JQRrelated.add(element);
220
+ index = JQRrelated.length - 1;
221
+ }
222
+ }
223
+
224
+ if (!open) {
225
+ open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
226
+
227
+ JQRbox.show();
228
+
229
+ if (settings.returnFocus) {
230
+ try {
231
+ element.blur();
232
+ JQR(element).one(event_closed, function () {
233
+ try {
234
+ this.focus();
235
+ } catch (e) {
236
+ // do nothing
237
+ }
238
+ });
239
+ } catch (e) {
240
+ // do nothing
241
+ }
242
+ }
243
+
244
+ // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
245
+ JQRoverlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
246
+
247
+ // Opens inital empty ColorBox prior to content being loaded.
248
+ settings.w = setSize(settings.initialWidth, 'x');
249
+ settings.h = setSize(settings.initialHeight, 'y');
250
+ publicMethod.position(0);
251
+
252
+ if (isIE6) {
253
+ JQRwindow.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
254
+ JQRoverlay.css({width: JQRwindow.width(), height: JQRwindow.height(), top: JQRwindow.scrollTop(), left: JQRwindow.scrollLeft()});
255
+ }).trigger('resize.' + event_ie6);
256
+ }
257
+
258
+ trigger(event_open, settings.onOpen);
259
+
260
+ JQRgroupControls.add(JQRtitle).hide();
261
+
262
+ JQRclose.html(settings.close).show();
263
+ }
264
+
265
+ publicMethod.load(true);
266
+ }
267
+ }
268
+
269
+ // ****************
270
+ // PUBLIC FUNCTIONS
271
+ // Usage format: JQR.fn.colorbox.close();
272
+ // Usage from within an iframe: parent.JQR.fn.colorbox.close();
273
+ // ****************
274
+
275
+ publicMethod = JQR.fn[colorbox] = JQR[colorbox] = function (options, callback) {
276
+ var JQRthis = this, autoOpen;
277
+
278
+ if (!JQRthis[0] && JQRthis.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
279
+ return JQRthis;
280
+ }
281
+
282
+ options = options || {};
283
+
284
+ if (callback) {
285
+ options.onComplete = callback;
286
+ }
287
+
288
+ if (!JQRthis[0] || JQRthis.selector === undefined) { // detects JQR.colorbox() and JQR.fn.colorbox()
289
+ JQRthis = JQR('<a/>');
290
+ options.open = true; // assume an immediate open
291
+ }
292
+
293
+ JQRthis.each(function () {
294
+ JQR.data(this, colorbox, JQR.extend({}, JQR.data(this, colorbox) || defaults, options));
295
+ JQR(this).addClass(boxElement);
296
+ });
297
+
298
+ autoOpen = options.open;
299
+
300
+ if (JQR.isFunction(autoOpen)) {
301
+ autoOpen = autoOpen.call(JQRthis);
302
+ }
303
+
304
+ if (autoOpen) {
305
+ launch(JQRthis[0]);
306
+ }
307
+
308
+ return JQRthis;
309
+ };
310
+
311
+ // Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
312
+ // This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only
313
+ // having to run once, instead of each time colorbox is opened.
314
+ publicMethod.init = function () {
315
+ // Create & Append jQuery Objects
316
+ JQRwindow = JQR(window);
317
+ JQRbox = JQRdiv().attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''});
318
+ JQRoverlay = JQRdiv("Overlay", isIE6 ? 'position:absolute' : '').hide();
319
+
320
+ JQRwrap = JQRdiv("Wrapper");
321
+ JQRcontent = JQRdiv("Content").append(
322
+ JQRloaded = JQRdiv("LoadedContent", 'width:0; height:0; overflow:hidden'),
323
+ JQRloadingOverlay = JQRdiv("LoadingOverlay").add(JQRdiv("LoadingGraphic")),
324
+ JQRtitle = JQRdiv("Title"),
325
+ JQRcurrent = JQRdiv("Current"),
326
+ JQRnext = JQRdiv("Next"),
327
+ JQRprev = JQRdiv("Previous"),
328
+ JQRslideshow = JQRdiv("Slideshow").bind(event_open, slideshow),
329
+ JQRclose = JQRdiv("Close")
330
+ );
331
+ JQRwrap.append( // The 3x3 Grid that makes up ColorBox
332
+ JQRdiv().append(
333
+ JQRdiv("TopLeft"),
334
+ JQRtopBorder = JQRdiv("TopCenter"),
335
+ JQRdiv("TopRight")
336
+ ),
337
+ JQRdiv(false, 'clear:left').append(
338
+ JQRleftBorder = JQRdiv("MiddleLeft"),
339
+ JQRcontent,
340
+ JQRrightBorder = JQRdiv("MiddleRight")
341
+ ),
342
+ JQRdiv(false, 'clear:left').append(
343
+ JQRdiv("BottomLeft"),
344
+ JQRbottomBorder = JQRdiv("BottomCenter"),
345
+ JQRdiv("BottomRight")
346
+ )
347
+ ).children().children().css({'float': 'left'});
348
+
349
+ JQRloadingBay = JQRdiv(false, 'position:absolute; width:9999px; visibility:hidden; display:none');
350
+
351
+ JQR('body').prepend(JQRoverlay, JQRbox.append(JQRwrap, JQRloadingBay));
352
+
353
+ JQRcontent.children()
354
+ .hover(function () {
355
+ JQR(this).addClass('hover');
356
+ }, function () {
357
+ JQR(this).removeClass('hover');
358
+ }).addClass('hover');
359
+
360
+ // Cache values needed for size calculations
361
+ interfaceHeight = JQRtopBorder.height() + JQRbottomBorder.height() + JQRcontent.outerHeight(true) - JQRcontent.height();//Subtraction needed for IE6
362
+ interfaceWidth = JQRleftBorder.width() + JQRrightBorder.width() + JQRcontent.outerWidth(true) - JQRcontent.width();
363
+ loadedHeight = JQRloaded.outerHeight(true);
364
+ loadedWidth = JQRloaded.outerWidth(true);
365
+
366
+ // Setting padding to remove the need to do size conversions during the animation step.
367
+ JQRbox.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
368
+
369
+ // Setup button events.
370
+ JQRnext.click(function () {
371
+ publicMethod.next();
372
+ });
373
+ JQRprev.click(function () {
374
+ publicMethod.prev();
375
+ });
376
+ JQRclose.click(function () {
377
+ publicMethod.close();
378
+ });
379
+
380
+ JQRgroupControls = JQRnext.add(JQRprev).add(JQRcurrent).add(JQRslideshow);
381
+
382
+ // Adding the 'hover' class allowed the browser to load the hover-state
383
+ // background graphics. The class can now can be removed.
384
+ JQRcontent.children().removeClass('hover');
385
+
386
+ JQR('.' + boxElement).live('click', function (e) {
387
+ // checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt.
388
+ if (!((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey)) {
389
+ e.preventDefault();
390
+ launch(this);
391
+ }
392
+ });
393
+
394
+ JQRoverlay.click(function () {
395
+ if (settings.overlayClose) {
396
+ publicMethod.close();
397
+ }
398
+ });
399
+
400
+ // Set Navigation Key Bindings
401
+ JQR(document).bind('keydown.' + prefix, function (e) {
402
+ var key = e.keyCode;
403
+ if (open && settings.escKey && key === 27) {
404
+ e.preventDefault();
405
+ publicMethod.close();
406
+ }
407
+ if (open && settings.arrowKey && JQRrelated[1]) {
408
+ if (key === 37) {
409
+ e.preventDefault();
410
+ JQRprev.click();
411
+ } else if (key === 39) {
412
+ e.preventDefault();
413
+ JQRnext.click();
414
+ }
415
+ }
416
+ });
417
+ };
418
+
419
+ publicMethod.remove = function () {
420
+ JQRbox.add(JQRoverlay).remove();
421
+ JQR('.' + boxElement).die('click').removeData(colorbox).removeClass(boxElement);
422
+ };
423
+
424
+ publicMethod.position = function (speed, loadedCallback) {
425
+ var
426
+ animate_speed,
427
+ // keeps the top and left positions within the browser's viewport.
428
+ posTop = Math.max(document.documentElement.clientHeight - settings.h - loadedHeight - interfaceHeight, 0) / 2 + JQRwindow.scrollTop(),
429
+ posLeft = Math.max(JQRwindow.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + JQRwindow.scrollLeft();
430
+
431
+ // setting the speed to 0 to reduce the delay between same-sized content.
432
+ animate_speed = (JQRbox.width() === settings.w + loadedWidth && JQRbox.height() === settings.h + loadedHeight) ? 0 : speed;
433
+
434
+ // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
435
+ // but it has to be shrank down around the size of div#colorbox when it's done. If not,
436
+ // it can invoke an obscure IE bug when using iframes.
437
+ JQRwrap[0].style.width = JQRwrap[0].style.height = "9999px";
438
+
439
+ function modalDimensions(that) {
440
+ // loading overlay height has to be explicitly set for IE6.
441
+ JQRtopBorder[0].style.width = JQRbottomBorder[0].style.width = JQRcontent[0].style.width = that.style.width;
442
+ JQRloadingOverlay[0].style.height = JQRloadingOverlay[1].style.height = JQRcontent[0].style.height = JQRleftBorder[0].style.height = JQRrightBorder[0].style.height = that.style.height;
443
+ }
444
+
445
+ JQRbox.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft}, {
446
+ duration: animate_speed,
447
+ complete: function () {
448
+ modalDimensions(this);
449
+
450
+ active = false;
451
+
452
+ // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
453
+ JQRwrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
454
+ JQRwrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
455
+
456
+ if (loadedCallback) {
457
+ loadedCallback();
458
+ }
459
+ },
460
+ step: function () {
461
+ modalDimensions(this);
462
+ }
463
+ });
464
+ };
465
+
466
+ publicMethod.resize = function (options) {
467
+ if (open) {
468
+ options = options || {};
469
+
470
+ if (options.width) {
471
+ settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
472
+ }
473
+ if (options.innerWidth) {
474
+ settings.w = setSize(options.innerWidth, 'x');
475
+ }
476
+ JQRloaded.css({width: settings.w});
477
+
478
+ if (options.height) {
479
+ settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
480
+ }
481
+ if (options.innerHeight) {
482
+ settings.h = setSize(options.innerHeight, 'y');
483
+ }
484
+ if (!options.innerHeight && !options.height) {
485
+ var JQRchild = JQRloaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be.
486
+ settings.h = JQRchild.height();
487
+ JQRchild.replaceWith(JQRchild.children()); // ditch the temporary wrapper div used in height calculation
488
+ }
489
+ JQRloaded.css({height: settings.h});
490
+
491
+ publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
492
+ }
493
+ };
494
+
495
+ publicMethod.prep = function (object) {
496
+ if (!open) {
497
+ return;
498
+ }
499
+
500
+ var speed = settings.transition === "none" ? 0 : settings.speed;
501
+
502
+ JQRwindow.unbind('resize.' + prefix);
503
+ JQRloaded.remove();
504
+ JQRloaded = JQRdiv('LoadedContent').html(object);
505
+
506
+ function getWidth() {
507
+ settings.w = settings.w || JQRloaded.width();
508
+ settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
509
+ return settings.w;
510
+ }
511
+ function getHeight() {
512
+ settings.h = settings.h || JQRloaded.height();
513
+ settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
514
+ return settings.h;
515
+ }
516
+
517
+ JQRloaded.hide()
518
+ .appendTo(JQRloadingBay.show())// content has to be appended to the DOM for accurate size calculations.
519
+ .css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
520
+ .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
521
+ .prependTo(JQRcontent);
522
+
523
+ JQRloadingBay.hide();
524
+
525
+ // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
526
+ //JQR(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'});
527
+
528
+ JQR(photo).css({'float': 'none'});
529
+
530
+ // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
531
+ if (isIE6) {
532
+ JQR('select').not(JQRbox.find('select')).filter(function () {
533
+ return this.style.visibility !== 'hidden';
534
+ }).css({'visibility': 'hidden'}).one(event_cleanup, function () {
535
+ this.style.visibility = 'inherit';
536
+ });
537
+ }
538
+
539
+ function setPosition(s) {
540
+ publicMethod.position(s, function () {
541
+ var prev, prevSrc, next, nextSrc, total = JQRrelated.length, iframe, complete;
542
+
543
+ if (!open) {
544
+ return;
545
+ }
546
+
547
+ complete = function () {
548
+ JQRloadingOverlay.hide();
549
+ trigger(event_complete, settings.onComplete);
550
+ };
551
+
552
+ if (isIE) {
553
+ //This fadeIn helps the bicubic resampling to kick-in.
554
+ if (photo) {
555
+ JQRloaded.fadeIn(100);
556
+ }
557
+ }
558
+
559
+ JQRtitle.html(settings.title).add(JQRloaded).show();
560
+
561
+ if (total > 1) { // handle grouping
562
+ if (typeof settings.current === "string") {
563
+ JQRcurrent.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show();
564
+ }
565
+
566
+ JQRnext[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
567
+ JQRprev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
568
+
569
+ prev = index ? JQRrelated[index - 1] : JQRrelated[total - 1];
570
+ next = index < total - 1 ? JQRrelated[index + 1] : JQRrelated[0];
571
+
572
+ if (settings.slideshow) {
573
+ JQRslideshow.show();
574
+ }
575
+
576
+ // Preloads images within a rel group
577
+ if (settings.preloading) {
578
+ nextSrc = JQR.data(next, colorbox).href || next.href;
579
+ prevSrc = JQR.data(prev, colorbox).href || prev.href;
580
+
581
+ nextSrc = JQR.isFunction(nextSrc) ? nextSrc.call(next) : nextSrc;
582
+ prevSrc = JQR.isFunction(prevSrc) ? prevSrc.call(prev) : prevSrc;
583
+
584
+ if (isImage(nextSrc)) {
585
+ JQR('<img/>')[0].src = nextSrc;
586
+ }
587
+
588
+ if (isImage(prevSrc)) {
589
+ JQR('<img/>')[0].src = prevSrc;
590
+ }
591
+ }
592
+ } else {
593
+ JQRgroupControls.hide();
594
+ }
595
+
596
+ if (settings.iframe) {
597
+ iframe = JQR('<iframe/>').addClass(prefix + 'Iframe')[0];
598
+
599
+ if (settings.fastIframe) {
600
+ complete();
601
+ } else {
602
+ JQR(iframe).load(complete);
603
+ }
604
+ iframe.name = prefix + (+new Date());
605
+ iframe.src = settings.href;
606
+
607
+ if (!settings.scrolling) {
608
+ iframe.scrolling = "no";
609
+ }
610
+
611
+ if (isIE) {
612
+ iframe.frameBorder=0;
613
+ iframe.allowTransparency = "true";
614
+ }
615
+
616
+ JQR(iframe).appendTo(JQRloaded).one(event_purge, function () {
617
+ iframe.src = "//about:blank";
618
+ });
619
+ } else {
620
+ complete();
621
+ }
622
+
623
+ if (settings.transition === 'fade') {
624
+ JQRbox.fadeTo(speed, 1, function () {
625
+ JQRbox[0].style.filter = "";
626
+ });
627
+ } else {
628
+ JQRbox[0].style.filter = "";
629
+ }
630
+
631
+ JQRwindow.bind('resize.' + prefix, function () {
632
+ publicMethod.position(0);
633
+ });
634
+ });
635
+ }
636
+
637
+ if (settings.transition === 'fade') {
638
+ JQRbox.fadeTo(speed, 0, function () {
639
+ setPosition(0);
640
+ });
641
+ } else {
642
+ setPosition(speed);
643
+ }
644
+ };
645
+
646
+ publicMethod.load = function (launched) {
647
+ var href, setResize, prep = publicMethod.prep;
648
+
649
+ active = true;
650
+
651
+ photo = false;
652
+
653
+ element = JQRrelated[index];
654
+
655
+ if (!launched) {
656
+ process(JQR.extend(settings, JQR.data(element, colorbox)));
657
+ }
658
+
659
+ trigger(event_purge);
660
+
661
+ trigger(event_load, settings.onLoad);
662
+
663
+ settings.h = settings.height ?
664
+ setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
665
+ settings.innerHeight && setSize(settings.innerHeight, 'y');
666
+
667
+ settings.w = settings.width ?
668
+ setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
669
+ settings.innerWidth && setSize(settings.innerWidth, 'x');
670
+
671
+ // Sets the minimum dimensions for use in image scaling
672
+ settings.mw = settings.w;
673
+ settings.mh = settings.h;
674
+
675
+ // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
676
+ // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
677
+ if (settings.maxWidth) {
678
+ settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
679
+ settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
680
+ }
681
+ if (settings.maxHeight) {
682
+ settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
683
+ settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
684
+ }
685
+
686
+ href = settings.href;
687
+
688
+ JQRloadingOverlay.show();
689
+
690
+ if (settings.inline) {
691
+ // Inserts an empty placeholder where inline content is being pulled from.
692
+ // An event is bound to put inline content back when ColorBox closes or loads new content.
693
+ JQRdiv().hide().insertBefore(JQR(href)[0]).one(event_purge, function () {
694
+ JQR(this).replaceWith(JQRloaded.children());
695
+ });
696
+ prep(JQR(href));
697
+ } else if (settings.iframe) {
698
+ // IFrame element won't be added to the DOM until it is ready to be displayed,
699
+ // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
700
+ prep(" ");
701
+ } else if (settings.html) {
702
+ prep(settings.html);
703
+ } else if (isImage(href)) {
704
+ JQR(photo = new Image())
705
+ .addClass(prefix + 'Photo')
706
+ .error(function () {
707
+ settings.title = false;
708
+ prep(JQRdiv('Error').text('This image could not be loaded'));
709
+ })
710
+ .load(function () {
711
+ var percent;
712
+ photo.onload = null; //stops animated gifs from firing the onload repeatedly.
713
+
714
+ if (settings.scalePhotos) {
715
+ setResize = function () {
716
+ photo.height -= photo.height * percent;
717
+ photo.width -= photo.width * percent;
718
+ };
719
+ if (settings.mw && photo.width > settings.mw) {
720
+ percent = (photo.width - settings.mw) / photo.width;
721
+ setResize();
722
+ }
723
+ if (settings.mh && photo.height > settings.mh) {
724
+ percent = (photo.height - settings.mh) / photo.height;
725
+ setResize();
726
+ }
727
+ }
728
+
729
+ if (settings.h) {
730
+ photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px';
731
+ }
732
+
733
+ if (JQRrelated[1] && (index < JQRrelated.length - 1 || settings.loop)) {
734
+ photo.style.cursor = 'pointer';
735
+ photo.onclick = function () {
736
+ publicMethod.next();
737
+ };
738
+ }
739
+
740
+ if (isIE) {
741
+ photo.style.msInterpolationMode = 'bicubic';
742
+ }
743
+
744
+ setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
745
+ prep(photo);
746
+ }, 1);
747
+ });
748
+
749
+ setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
750
+ photo.src = href;
751
+ }, 1);
752
+ } else if (href) {
753
+ JQRloadingBay.load(href, function (data, status, xhr) {
754
+ prep(status === 'error' ? JQRdiv('Error').text('Request unsuccessful: ' + xhr.statusText) : JQR(this).contents());
755
+ });
756
+ }
757
+ };
758
+
759
+ // Navigates to the next page/image in a set.
760
+ publicMethod.next = function () {
761
+ if (!active && JQRrelated[1] && (index < JQRrelated.length - 1 || settings.loop)) {
762
+ index = index < JQRrelated.length - 1 ? index + 1 : 0;
763
+ publicMethod.load();
764
+ }
765
+ };
766
+
767
+ publicMethod.prev = function () {
768
+ if (!active && JQRrelated[1] && (index || settings.loop)) {
769
+ index = index ? index - 1 : JQRrelated.length - 1;
770
+ publicMethod.load();
771
+ }
772
+ };
773
+
774
+ // Note: to use this within an iframe use the following format: parent.JQR.fn.colorbox.close();
775
+ publicMethod.close = function () {
776
+ if (open && !closing) {
777
+
778
+ closing = true;
779
+
780
+ open = false;
781
+
782
+ trigger(event_cleanup, settings.onCleanup);
783
+
784
+ JQRwindow.unbind('.' + prefix + ' .' + event_ie6);
785
+
786
+ JQRoverlay.fadeTo(200, 0);
787
+
788
+ JQRbox.stop().fadeTo(300, 0, function () {
789
+
790
+ JQRbox.add(JQRoverlay).css({'opacity': 1, cursor: 'auto'}).hide();
791
+
792
+ trigger(event_purge);
793
+
794
+ JQRloaded.remove();
795
+
796
+ setTimeout(function () {
797
+ closing = false;
798
+ trigger(event_closed, settings.onClosed);
799
+ }, 1);
800
+ });
801
+ }
802
+ };
803
+
804
+ // A method for fetching the current element ColorBox is referencing.
805
+ // returns a jQuery object.
806
+ publicMethod.element = function () {
807
+ return JQR(element);
808
+ };
809
+
810
+ publicMethod.settings = defaults;
811
+
812
+ // Initializes ColorBox when the DOM has loaded
813
+ JQR(publicMethod.init);
814
+
815
+ }(jQuery, document, this));
skin/frontend/default/default/magazento/priceproposal/promo.jpg ADDED
Binary file
skin/frontend/default/default/magazento/priceproposal/style.css ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .proposal-btn {
2
+ background: none repeat scroll 0 0 #F18200;
3
+ border-color: #ED6502 #A04300 #A04300 #ED6502;
4
+ border-style: solid;
5
+ border-width: 1px;
6
+ color: #FFFFFF;
7
+ cursor: pointer;
8
+ font: bold 12px arial,helvetica,sans-serif;
9
+ padding: 3px 16px 3px 16px;
10
+ text-align: center !important;
11
+ white-space: nowrap;
12
+ }
13
+
14
+ .add-proposal label {
15
+ color: #666666;
16
+ float: left;
17
+ font-weight: bold;
18
+ margin-right: 2px;
19
+ }
20
+ .proposal-answer span{
21
+ color: #666;
22
+ font: bold 14px arial,helvetica,sans-serif;
23
+
24
+ }
25
+ .proposal-answer{
26
+ width: 190px;
27
+ height: 250px;
28
+ padding: 10px;
29
+ }
30
+ .proposal .form-list textarea {
31
+ height: 10em;
32
+ width: 527px;
33
+ }
34
+ .proposal-information{
35
+ color: #1E7EC8;
36
+ font-weight: bold;
37
+ }
38
+ .form-add-proposal {
39
+ padding:10px;
40
+ background:#fff;
41
+ }
42
+ .form-add-proposal .buttons-set {
43
+ border-top: 1px solid #E4E4E4;
44
+ clear: both;
45
+ margin: 1em 0 0;
46
+ padding: 8px 0 0;
47
+ text-align: right;
48
+ }