ajaxcallback - Version 0.1.0

Version Notes

first stable

Download this release

Release Info

Developer bxN5
Extension ajaxcallback
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/local/Psychose/CallBack/Block/Adminhtml/Callback.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Psychose_CallBack_Block_Adminhtml_Callback extends Mage_Adminhtml_Block_Widget_Grid_Container{
5
+
6
+ public function __construct()
7
+ {
8
+
9
+ $this->_controller = "adminhtml_callback";
10
+ $this->_blockGroup = "callback";
11
+ $this->_headerText = Mage::helper("callback")->__("Callback Manager");
12
+ $this->_addButtonLabel = Mage::helper("callback")->__("Add New Item");
13
+ parent::__construct();
14
+
15
+ }
16
+
17
+ }
app/code/local/Psychose/CallBack/Block/Adminhtml/Callback/Edit.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Psychose_CallBack_Block_Adminhtml_Callback_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+
8
+ parent::__construct();
9
+ $this->_objectId = "id";
10
+ $this->_blockGroup = "callback";
11
+ $this->_controller = "adminhtml_callback";
12
+ $this->_updateButton("save", "label", Mage::helper("callback")->__("Save Item"));
13
+ $this->_updateButton("delete", "label", Mage::helper("callback")->__("Delete Item"));
14
+
15
+ $this->_addButton("saveandcontinue", array(
16
+ "label" => Mage::helper("callback")->__("Save And Continue Edit"),
17
+ "onclick" => "saveAndContinueEdit()",
18
+ "class" => "save",
19
+ ), -100);
20
+
21
+
22
+
23
+ $this->_formScripts[] = "
24
+
25
+ function saveAndContinueEdit(){
26
+ editForm.submit($('edit_form').action+'back/edit/');
27
+ }
28
+ ";
29
+ }
30
+
31
+ public function getHeaderText()
32
+ {
33
+ if( Mage::registry("callback_data") && Mage::registry("callback_data")->getId() ){
34
+
35
+ return Mage::helper("callback")->__("Edit Item '%s'", $this->htmlEscape(Mage::registry("callback_data")->getId()));
36
+
37
+ }
38
+ else{
39
+
40
+ return Mage::helper("callback")->__("Add Item");
41
+
42
+ }
43
+ }
44
+ }
app/code/local/Psychose/CallBack/Block/Adminhtml/Callback/Edit/Form.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Psychose_CallBack_Block_Adminhtml_Callback_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ "id" => "edit_form",
8
+ "action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))),
9
+ "method" => "post",
10
+ "enctype" =>"multipart/form-data",
11
+ )
12
+ );
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+ }
app/code/local/Psychose/CallBack/Block/Adminhtml/Callback/Edit/Tab/Form.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Psychose_CallBack_Block_Adminhtml_Callback_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset("callback_form", array("legend"=>Mage::helper("callback")->__("Item information")));
10
+
11
+
12
+ $fieldset->addField("email", "text", array(
13
+ "label" => Mage::helper("callback")->__("email"),
14
+ "name" => "email",
15
+ ));
16
+
17
+ $fieldset->addField("phone", "text", array(
18
+ "label" => Mage::helper("callback")->__("phone"),
19
+ "name" => "phone",
20
+ ));
21
+ $fieldset->addField("name", "text", array(
22
+ "label" => Mage::helper("callback")->__("name"),
23
+ "name" => "name",
24
+ ));
25
+ $fieldset->addField("message", "textarea", array(
26
+ "label" => Mage::helper("callback")->__("message"),
27
+ "name" => "message",
28
+ 'type' => 'textarea'
29
+ ));
30
+ $fieldset->addField("status", "select", array(
31
+ "label" => Mage::helper("callback")->__("status"),
32
+ "name" => "status",
33
+ 'values' => array(
34
+ '0' => array(
35
+ 'value'=> 0,
36
+ 'label' => Mage::helper("callback")->__("processed")
37
+ ),
38
+ '1' => array(
39
+ 'value'=> 1,
40
+ 'label' => Mage::helper("callback")->__("new")
41
+ ),
42
+
43
+ ),
44
+ ));
45
+ $fieldset->addField('created_time', 'date', array(
46
+ 'name' => 'Date',
47
+ 'label' => Mage::helper("callback")->__("date"),
48
+ 'title' => Mage::helper("callback")->__("date"),
49
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
50
+ 'input_format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
51
+ 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
52
+ 'time' => false
53
+ ));
54
+
55
+
56
+
57
+ if (Mage::getSingleton("adminhtml/session")->getCallbackData())
58
+ {
59
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getCallbackData());
60
+ Mage::getSingleton("adminhtml/session")->setCallbackData(null);
61
+ }
62
+ elseif(Mage::registry("callback_data")) {
63
+ $form->setValues(Mage::registry("callback_data")->getData());
64
+ }
65
+ return parent::_prepareForm();
66
+ }
67
+ }
app/code/local/Psychose/CallBack/Block/Adminhtml/Callback/Edit/Tabs.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Psychose_CallBack_Block_Adminhtml_Callback_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId("callback_tabs");
8
+ $this->setDestElementId("edit_form");
9
+ $this->setTitle(Mage::helper("callback")->__("Item Information"));
10
+ }
11
+ protected function _beforeToHtml()
12
+ {
13
+ $this->addTab("form_section", array(
14
+ "label" => Mage::helper("callback")->__("Item Information"),
15
+ "title" => Mage::helper("callback")->__("Item Information"),
16
+ "content" => $this->getLayout()->createBlock("callback/adminhtml_callback_edit_tab_form")->toHtml(),
17
+ ));
18
+ return parent::_beforeToHtml();
19
+ }
20
+
21
+ }
app/code/local/Psychose/CallBack/Block/Adminhtml/Callback/Grid.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Psychose_CallBack_Block_Adminhtml_Callback_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId("callbackGrid");
10
+ $this->setDefaultSort("id");
11
+ $this->setDefaultDir("DESC");
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+
15
+ protected function _prepareCollection()
16
+ {
17
+ $collection = Mage::getModel("callback/callback")->getCollection();
18
+ $this->setCollection($collection);
19
+ return parent::_prepareCollection();
20
+ }
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn("id", array(
24
+ "header" => Mage::helper("callback")->__("ID"),
25
+ "align" =>"right",
26
+ "width" => "50px",
27
+ "type" => "number",
28
+ "index" => "id",
29
+ ));
30
+
31
+ $this->addColumn("email", array(
32
+ "header" => Mage::helper("callback")->__("email"),
33
+ "index" => "email",
34
+ ));
35
+ $this->addColumn("phone", array(
36
+ "header" => Mage::helper("callback")->__("phone"),
37
+ "index" => "phone",
38
+ ));
39
+ $this->addColumn("status", array(
40
+ "header" => Mage::helper("callback")->__("status"),
41
+ "index" => "status",
42
+ 'type' => 'options',
43
+ 'options'=> array (Mage::helper("callback")->__("processed"),Mage::helper("callback")->__("new"))
44
+ ));
45
+ $this->addColumn('created_time', array(
46
+ 'header' => Mage::helper('callback')->__('date'),
47
+ 'index' => 'created_time',
48
+ 'type' => 'date',
49
+ ));
50
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
51
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
52
+
53
+ return parent::_prepareColumns();
54
+ }
55
+
56
+ public function getRowUrl($row)
57
+ {
58
+ return $this->getUrl("*/*/edit", array("id" => $row->getId()));
59
+ }
60
+
61
+
62
+
63
+ protected function _prepareMassaction()
64
+ {
65
+ $this->setMassactionIdField('id');
66
+ $this->getMassactionBlock()->setFormFieldName('ids');
67
+ $this->getMassactionBlock()->setUseSelectAll(true);
68
+ $this->getMassactionBlock()->addItem('remove_callback', array(
69
+ 'label'=> Mage::helper('callback')->__('Remove Callback'),
70
+ 'url' => $this->getUrl('*/adminhtml_callback/massRemove'),
71
+ 'confirm' => Mage::helper('callback')->__('Are you sure?')
72
+ ));
73
+ return $this;
74
+ }
75
+
76
+
77
+ }
app/code/local/Psychose/CallBack/Block/Callbackwidget.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Psychose_CallBack_Block_Callbackwidget
3
+ extends Mage_Core_Block_Template
4
+ implements Mage_Widget_Block_Interface
5
+ {
6
+
7
+ protected function _toHtml()
8
+ {
9
+ return Mage::getSingleton('core/layout')->createBlock('core/template')->setTemplate('callback/index.phtml')->toHtml();;
10
+ }
11
+
12
+ }
app/code/local/Psychose/CallBack/Block/Index.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Psychose_CallBack_Block_Index extends Mage_Core_Block_Template{
3
+
4
+
5
+
6
+
7
+
8
+ }
app/code/local/Psychose/CallBack/Block/Left.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Psychose_CallBack_Block_Left extends Mage_Core_Block_Template{
3
+
4
+
5
+
6
+
7
+
8
+ }
app/code/local/Psychose/CallBack/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Psychose_CallBack_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
5
+
app/code/local/Psychose/CallBack/Model/Callback.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Psychose_CallBack_Model_Callback extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct(){
6
+
7
+ $this->_init("callback/callback");
8
+
9
+ }
10
+
11
+ }
12
+
app/code/local/Psychose/CallBack/Model/Mysql4/Callback.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Psychose_CallBack_Model_Mysql4_Callback extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("callback/callback", "id");
7
+ }
8
+ }
app/code/local/Psychose/CallBack/Model/Mysql4/Callback/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Psychose_CallBack_Model_Mysql4_Callback_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("callback/callback");
7
+ }
8
+
9
+
10
+
11
+ }
12
+
app/code/local/Psychose/CallBack/controllers/Adminhtml/CallbackkController.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Psychose_CallBack_Adminhtml_CallbackkController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ protected function _initAction()
6
+ {
7
+
8
+ $this->loadLayout()->_setActiveMenu("callback/callback")->_addBreadcrumb(Mage::helper("adminhtml")->__("Callback Manager"),Mage::helper("adminhtml")->__("Callback Manager"));
9
+ return $this;
10
+ }
11
+ public function indexAction()
12
+ {
13
+ $this->_title($this->__("CallBack"));
14
+ $this->_title($this->__("Manager Callback"));
15
+
16
+ $this->_initAction();
17
+ $this->renderLayout();
18
+ }
19
+ public function editAction()
20
+ {
21
+ $this->_title($this->__("CallBack"));
22
+ $this->_title($this->__("Callback"));
23
+ $this->_title($this->__("Edit Item"));
24
+
25
+ $id = $this->getRequest()->getParam("id");
26
+ $model = Mage::getModel("callback/callback")->load($id);
27
+ if ($model->getId()) {
28
+ Mage::register("callback_data", $model);
29
+ $this->loadLayout();
30
+ $this->_setActiveMenu("callback/callback");
31
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Callback Manager"), Mage::helper("adminhtml")->__("Callback Manager"));
32
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Callback Description"), Mage::helper("adminhtml")->__("Callback Description"));
33
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
34
+ $this->_addContent($this->getLayout()->createBlock("callback/adminhtml_callback_edit"))->_addLeft($this->getLayout()->createBlock("callback/adminhtml_callback_edit_tabs"));
35
+ $this->renderLayout();
36
+ }
37
+ else {
38
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("callback")->__("Item does not exist."));
39
+ $this->_redirect("*/*/");
40
+ }
41
+ }
42
+
43
+ public function newAction()
44
+ {
45
+
46
+ $this->_title($this->__("CallBack"));
47
+ $this->_title($this->__("Callback"));
48
+ $this->_title($this->__("New Item"));
49
+
50
+ $id = $this->getRequest()->getParam("id");
51
+ $model = Mage::getModel("callback/callback")->load($id);
52
+
53
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
54
+ if (!empty($data)) {
55
+ $model->setData($data);
56
+ }
57
+
58
+ Mage::register("callback_data", $model);
59
+
60
+ $this->loadLayout();
61
+ $this->_setActiveMenu("callback/callback");
62
+
63
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
64
+
65
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Callback Manager"), Mage::helper("adminhtml")->__("Callback Manager"));
66
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Callback Description"), Mage::helper("adminhtml")->__("Callback Description"));
67
+
68
+
69
+ $this->_addContent($this->getLayout()->createBlock("callback/adminhtml_callback_edit"))->_addLeft($this->getLayout()->createBlock("callback/adminhtml_callback_edit_tabs"));
70
+
71
+ $this->renderLayout();
72
+
73
+ }
74
+ public function saveAction()
75
+ {
76
+
77
+ $post_data=$this->getRequest()->getPost();
78
+
79
+
80
+ if ($post_data) {
81
+
82
+ try {
83
+
84
+
85
+
86
+ $model = Mage::getModel("callback/callback")
87
+ ->addData($post_data)
88
+ ->setId($this->getRequest()->getParam("id"))
89
+ ->save();
90
+
91
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Callback was successfully saved"));
92
+ Mage::getSingleton("adminhtml/session")->setCallbackData(false);
93
+
94
+ if ($this->getRequest()->getParam("back")) {
95
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
96
+ return;
97
+ }
98
+ $this->_redirect("*/*/");
99
+ return;
100
+ }
101
+ catch (Exception $e) {
102
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
103
+ Mage::getSingleton("adminhtml/session")->setCallbackData($this->getRequest()->getPost());
104
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
105
+ return;
106
+ }
107
+
108
+ }
109
+ $this->_redirect("*/*/");
110
+ }
111
+
112
+
113
+
114
+ public function deleteAction()
115
+ {
116
+ if( $this->getRequest()->getParam("id") > 0 ) {
117
+ try {
118
+ $model = Mage::getModel("callback/callback");
119
+ $model->setId($this->getRequest()->getParam("id"))->delete();
120
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
121
+ $this->_redirect("*/*/");
122
+ }
123
+ catch (Exception $e) {
124
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
125
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
126
+ }
127
+ }
128
+ $this->_redirect("*/*/");
129
+ }
130
+
131
+
132
+ public function massRemoveAction()
133
+ {
134
+ try {
135
+ $ids = $this->getRequest()->getPost('ids', array());
136
+ foreach ($ids as $id) {
137
+ $model = Mage::getModel("callback/callback");
138
+ $model->setId($id)->delete();
139
+ }
140
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item(s) was successfully removed"));
141
+ }
142
+ catch (Exception $e) {
143
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
144
+ }
145
+ $this->_redirect('*/*/');
146
+ }
147
+
148
+ /**
149
+ * Export order grid to CSV format
150
+ */
151
+ public function exportCsvAction()
152
+ {
153
+ $fileName = 'callback.csv';
154
+ $grid = $this->getLayout()->createBlock('callback/adminhtml_callback_grid');
155
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
156
+ }
157
+ /**
158
+ * Export order grid to Excel XML format
159
+ */
160
+ public function exportExcelAction()
161
+ {
162
+ $fileName = 'callback.xml';
163
+ $grid = $this->getLayout()->createBlock('callback/adminhtml_callback_grid');
164
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
165
+ }
166
+ }
app/code/local/Psychose/CallBack/controllers/IndexController.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Psychose_CallBack_IndexController extends Mage_Core_Controller_Front_Action{
3
+ const XML_PATH_EMAIL_RECIPIENT = 'contacts/email/recipient_email';
4
+ const XML_PATH_EMAIL_SENDER = 'contacts/email/sender_email_identity';
5
+ const XML_PATH_EMAIL_TEMPLATE = 'contacts/email/email_template';
6
+ const XML_PATH_ENABLED = 'contacts/contacts/enabled';
7
+ public function IndexAction() {
8
+
9
+ $this->loadLayout();
10
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Titlename"));
11
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
12
+ $breadcrumbs->addCrumb("home", array(
13
+ "label" => $this->__("Home Page"),
14
+ "title" => $this->__("Home Page"),
15
+ "link" => Mage::getBaseUrl()
16
+ ));
17
+
18
+ $breadcrumbs->addCrumb("titlename", array(
19
+ "label" => $this->__("Titlename"),
20
+ "title" => $this->__("Titlename")
21
+ ));
22
+
23
+ $this->renderLayout();
24
+
25
+ }
26
+
27
+ public function callbacksendAction() {
28
+
29
+ $isAjax = Mage::app()->getRequest()->isAjax();
30
+ if ($isAjax) {
31
+ $post = $this->getRequest()->getPost();
32
+ if ( $post ) {
33
+ $translate = Mage::getSingleton('core/translate');
34
+ /* @var $translate Mage_Core_Model_Translate */
35
+ $translate->setTranslateInline(false);
36
+ try {
37
+ $postObject = new Varien_Object();
38
+ $postObject->setData($post);
39
+
40
+ $error = false;
41
+
42
+ if (!Zend_Validate::is(trim($post['name']) , 'NotEmpty')) {
43
+ $error = true;
44
+ }
45
+
46
+ if (!Zend_Validate::is(trim($post['message']) , 'NotEmpty')) {
47
+ $error = true;
48
+ }
49
+ if (!Zend_Validate::is(trim($post['phone']) , 'NotEmpty')) {
50
+ $error = true;
51
+ }
52
+
53
+ if (!Zend_Validate::is(trim($post['email']), 'EmailAddress')) {
54
+ $error = true;
55
+ }
56
+
57
+ if (Zend_Validate::is(trim($post['hideit']), 'NotEmpty')) {
58
+ $error = true;
59
+ }
60
+
61
+ if ($error) {
62
+ $data = array('status' => 1, 'message'=>Mage::helper('contacts')->__('Unable to submit your request. Please, try again later'));
63
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($data));
64
+ return;
65
+ }
66
+ $mailTemplate = Mage::getModel('core/email_template');
67
+ /* @var $mailTemplate Mage_Core_Model_Email_Template */
68
+ $mailTemplate->setDesignConfig(array('area' => 'frontend'))
69
+ ->setReplyTo($post['email'])
70
+ ->sendTransactional(
71
+ Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
72
+ Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),
73
+ Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),
74
+ null,
75
+ array('data' => $postObject)
76
+ );
77
+
78
+ if (!$mailTemplate->getSentSuccess()) {
79
+ $data = array('status' => 1, 'message'=>Mage::helper('callback')->__('Unable to submit your request. Mail problem'));
80
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($data));
81
+ return;
82
+ }
83
+ $translate->setTranslateInline(true);
84
+ $now = Mage::getModel('core/date')->timestamp(time());
85
+ $post_to_model = array('name'=>$post['name'],'email'=>$post['email'],
86
+ 'phone'=>$post['phone'],'message' => $post['message'],
87
+ 'created_time'=>Mage::getModel('core/date')->date('Y-m-d')
88
+ ,'status'=>1);
89
+ $model = Mage::getModel('callback/callback')->setData($post_to_model);
90
+
91
+
92
+ try {
93
+ $insertid = $model->save()->getId();
94
+
95
+ }
96
+ catch (Exception $e){
97
+ $data = array('status' => 1, 'message'=>$e->getMessage());
98
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode());
99
+ return;
100
+ }
101
+
102
+ $output = array('status' => 0, 'message' => Mage::helper('contacts')->__('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.'));
103
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($output));
104
+
105
+ return;
106
+ } catch (Exception $e) {
107
+ $translate->setTranslateInline(true);
108
+
109
+
110
+
111
+ $output = array('status' => 1, 'message' => Mage::helper('contacts')->__('Unable to submit your request. Please, try again later'));
112
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($output));
113
+ return;
114
+ }
115
+
116
+ }
117
+
118
+ }
119
+ else {
120
+ Mage::getSingleton('customer/session')->addError(Mage::helper('contacts')->__('Unable to submit your request. Please, try again later'));
121
+ $this->_redirect('*/*/');
122
+ }
123
+ }
124
+ }
app/code/local/Psychose/CallBack/etc/config.xml ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Psychose_CallBack>
5
+ <version>0.1.0</version>
6
+ </Psychose_CallBack>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <callback>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Psychose_CallBack</module>
14
+ <frontName>callback</frontName>
15
+ </args>
16
+ </callback>
17
+ <callbacksend>
18
+ <use>standard</use>
19
+ <args>
20
+ <module>Psychose_CallBack</module>
21
+ <frontName>callbacksend</frontName>
22
+ </args>
23
+ </callbacksend>
24
+
25
+ </routers>
26
+ <layout>
27
+ <updates>
28
+ <callback>
29
+ <file>callback.xml</file>
30
+ </callback>
31
+ </updates>
32
+ </layout>
33
+ </frontend>
34
+ <global>
35
+ <helpers>
36
+ <callback>
37
+ <class>Psychose_CallBack_Helper</class>
38
+ </callback>
39
+ </helpers>
40
+ <blocks>
41
+ <callback>
42
+ <class>Psychose_CallBack_Block</class>
43
+ </callback>
44
+ </blocks>
45
+ <models>
46
+ <callback>
47
+ <class>Psychose_CallBack_Model</class>
48
+ <resourceModel>callback_mysql4</resourceModel>
49
+ </callback>
50
+ <callback_mysql4>
51
+ <class>Psychose_CallBack_Model_Mysql4</class>
52
+ <entities>
53
+ <callback>
54
+ <table>callbacks</table>
55
+ </callback>
56
+ </entities>
57
+ </callback_mysql4>
58
+ </models>
59
+ <resources>
60
+ <callback_setup>
61
+ <setup>
62
+ <module>Psychose_CallBack</module>
63
+ </setup>
64
+ <connection>
65
+ <use>core_setup</use>
66
+ </connection>
67
+ </callback_setup>
68
+ <callback_write>
69
+ <connection>
70
+ <use>core_write</use>
71
+ </connection>
72
+ </callback_write>
73
+ <callback_read>
74
+ <connection>
75
+ <use>core_read</use>
76
+ </connection>
77
+ </callback_read>
78
+ </resources>
79
+ </global>
80
+ <admin>
81
+ <routers>
82
+ <callbackk>
83
+ <use>admin</use>
84
+ <args>
85
+ <module>Psychose_CallBack</module>
86
+ <frontName>admin_callbackk</frontName>
87
+ </args>
88
+ </callbackk>
89
+ </routers>
90
+ </admin>
91
+ <adminhtml>
92
+ <menu>
93
+ <callback module="callback">
94
+ <title>CallBack</title>
95
+ <sort_order>100</sort_order>
96
+ <children>
97
+
98
+ <callback module="callback">
99
+ <title>Manage Callback</title>
100
+ <sort_order>0</sort_order>
101
+ <action>admin_callbackk/adminhtml_callbackk</action>
102
+ </callback>
103
+ </children>
104
+ </callback>
105
+ </menu>
106
+ <acl>
107
+ <resources>
108
+ <all>
109
+ <title>Allow Everything</title>
110
+ </all>
111
+ <admin>
112
+ <children>
113
+ <callback translate="title" module="callback">
114
+ <title>CallBacks</title>
115
+ <sort_order>1000</sort_order>
116
+ <children>
117
+
118
+ <callback translate="title">
119
+ <title>Manage Callbacks</title>
120
+ <sort_order>0</sort_order>
121
+ </callback>
122
+ </children>
123
+ </callback>
124
+ </children>
125
+ </admin>
126
+ </resources>
127
+ </acl>
128
+ <layout>
129
+ <updates>
130
+ <callback>
131
+ <file>callback.xml</file>
132
+ </callback>
133
+ </updates>
134
+ </layout>
135
+ </adminhtml>
136
+ </config>
app/code/local/Psychose/CallBack/etc/system.xml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <contacts translate="label" module="callback">
5
+ <label>Contacts</label>
6
+ <tab>general</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>100</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <callback translate="label">
14
+ <label>Callback</label>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>10</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <fields>
21
+ <callback translate="label">
22
+ <label>callback_enable</label>
23
+ <frontend_type>select</frontend_type>
24
+ <source_model>adminhtml/system_config_source_yesno</source_model>
25
+ <sort_order>0</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ </callback>
30
+ <header translate="label">
31
+ <label>Pop-up title</label>
32
+ <frontend_type>text</frontend_type>
33
+ <sort_order>10</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </header>
38
+ <link translate="label">
39
+ <label>Link name</label>
40
+ <frontend_type>text</frontend_type>
41
+ <sort_order>10</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </link>
46
+ </fields>
47
+ </callback>
48
+ </groups>
49
+ </contacts>
50
+ </sections>
51
+ </config>
app/code/local/Psychose/CallBack/etc/widget.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <widgets>
3
+ <callback_callbackwidget type="callback/callbackwidget" translate="name description" module="callback">
4
+ <name>Callback Widget</name>
5
+ <description type="desc">Callback Widget</description>
6
+ <parameters>
7
+ <template>
8
+ <values>
9
+ <block_right translate="label">
10
+ <value>callback/index.phtml</value>
11
+ <label>Callback form {custom name}</label>
12
+ </block_right>
13
+ </values>
14
+ </template>
15
+ </parameters>
16
+ </callback_callbackwidget>
17
+ </widgets>
app/code/local/Psychose/CallBack/sql/callback_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $sql=<<<SQLTEXT
5
+ create table callbacks(id int not null auto_increment, name varchar(100), phone varchar(30),email varchar(30),status int(1),message varchar(1000), created_time date, primary key(id));
6
+
7
+
8
+ SQLTEXT;
9
+
10
+ $installer->run($sql);
11
+
12
+ $installer->endSetup();
13
+
app/etc/modules/Psychose_CallBack.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Psychose_CallBack>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <depends>
8
+ <Mage_Cms />
9
+ </depends>
10
+ <version>0.1.0</version>
11
+ </Psychose_CallBack>
12
+ </modules>
13
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>ajaxcallback</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>callback/contact AJAX form </summary>
10
+ <description>callback/contact AJAX form </description>
11
+ <notes>first stable</notes>
12
+ <authors><author><name>bxN5</name><user>bxN5</user><email>bxN5@ua.fm</email></author></authors>
13
+ <date>2016-04-11</date>
14
+ <time>16:05:06</time>
15
+ <contents><target name="magelocal"><dir name="Psychose"><dir name="CallBack"><dir name="Block"><dir name="Adminhtml"><dir name="Callback"><dir name="Edit"><file name="Form.php" hash="cca24d365fa9ce1fce3f98dd43345523"/><dir name="Tab"><file name="Form.php" hash="45d337fc9fad132ccdeda030fd6d07c3"/></dir><file name="Tabs.php" hash="8d2cedf3936eed31673a47a92e056ff2"/></dir><file name="Edit.php" hash="5ce4d9e3894d63f09f45bfe341f28c26"/><file name="Grid.php" hash="b24900ee000f2e7756e40bd9f9afda31"/></dir><file name="Callback.php" hash="796b1aac77e89c97d1a8d609d59b0103"/></dir><file name="Callbackwidget.php" hash="537a1f0caec0adae2691dbb4bb58d6ad"/><file name="Index.php" hash="162180386c5359ee139f1cb9fd3d9305"/><file name="Left.php" hash="4b6da6de579326d109bc753c8f7b11ba"/></dir><dir name="Helper"><file name="Data.php" hash="2b61362c44c21a465cd2e2a505595168"/></dir><dir name="Model"><file name="Callback.php" hash="7e0c2f1ae29b41f73c173d08e43715a1"/><dir name="Mysql4"><dir name="Callback"><file name="Collection.php" hash="7824dd1220b4a5d4a92f0f9ea9cb1eb4"/></dir><file name="Callback.php" hash="ede8d79f70d1e73a82e9a7c6358554b3"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CallbackkController.php" hash="26e7ef73eb3e674196746570f34732a1"/></dir><file name="IndexController.php" hash="66b90d6bb6d8f2602bc075d92f7c62c3"/></dir><dir name="etc"><file name="config.xml" hash="81aea128d85a606f9d11ffe0ab47e79c"/><file name="system.xml" hash="93b5eae2c851057e639b5e41f5845beb"/><file name="widget.xml" hash="fe40456c46faba699f1fee15c8040a40"/></dir><dir name="sql"><dir name="callback_setup"><file name="mysql4-install-0.1.0.php" hash="0cb830d79f5f1df8b1773e03bf872f17"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="modal.css" hash="418c5831e0770d1b91500e11c00e3917"/></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Psychose_CallBack.xml" hash="515049e34ff7961721b42eb60e405e62"/></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.0</min><max>7.0.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/base/default/css/modal.css ADDED
@@ -0,0 +1,355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * CSS Modal
3
+ * http://drublic.github.com/css-modal
4
+ *
5
+ * @author Hans Christian Reinl - @drublic
6
+ */
7
+ /**
8
+ * CSS Modal Configuration
9
+ * http://drublic.github.com/css-modal
10
+ *
11
+ * @author Hans Christian Reinl - @drublic
12
+ */
13
+ html {
14
+ overflow-y: scroll;
15
+ -webkit-overflow-scrolling: touch;
16
+ }
17
+
18
+ .has-overlay {
19
+ overflow: hidden;
20
+ height: auto;
21
+ }
22
+ .has-overlay > body {
23
+ height: 100%;
24
+ overflow: hidden;
25
+ }
26
+
27
+ .modal--fade, .modal--show {
28
+ -webkit-transform: translate(0, 100%);
29
+ -moz-transform: translate(0, 100%);
30
+ -o-transform: translate(0, 100%);
31
+ -ms-transform: translate(0, 100%);
32
+ transform: translate(0, 100%);
33
+ -webkit-transform: translate3d(0, 100%, 0);
34
+ transform: translate3d(0, 100%, 0);
35
+ position: fixed;
36
+ top: 0;
37
+ left: 0;
38
+ right: 0;
39
+ bottom: 0;
40
+ z-index: 999;
41
+ width: 0;
42
+ height: 0;
43
+ overflow: hidden;
44
+ opacity: 0;
45
+ display: none\9;
46
+ }
47
+ .modal--fade:target, .modal--show:target, .is-active.modal--fade, .is-active.modal--show {
48
+ -webkit-transform: translate(0, 0);
49
+ -moz-transform: translate(0, 0);
50
+ -o-transform: translate(0, 0);
51
+ -ms-transform: translate(0, 0);
52
+ transform: translate(0, 0);
53
+ width: auto;
54
+ height: auto;
55
+ opacity: 1;
56
+ }
57
+ .is-active.modal--fade, .is-active.modal--show {
58
+ display: block\9;
59
+ height: 100% \9;
60
+ width: 100% \9;
61
+ }
62
+ .modal--fade:target, .modal--show:target, .is-active.modal--fade, .is-active.modal--show {
63
+ display: block\9;
64
+ }
65
+ .modal--fade .modal-inner, .modal--show .modal-inner {
66
+ position: absolute;
67
+ top: 60px;
68
+ left: 50%;
69
+ z-index: 20;
70
+ margin-left: -325px;
71
+ width: 650px;
72
+ overflow-x: hidden;
73
+ -webkit-overflow-scrolling: touch;
74
+ }
75
+ .modal--fade .modal-inner > img, .modal--show .modal-inner > img,
76
+ .modal--fade .modal-inner > video,
77
+ .modal--show .modal-inner > video,
78
+ .modal--fade .modal-inner > iframe,
79
+ .modal--show .modal-inner > iframe {
80
+ width: 100%;
81
+ height: auto;
82
+ min-height: 300px;
83
+ }
84
+ .modal--fade .modal-inner > img, .modal--show .modal-inner > img {
85
+ width: auto;
86
+ max-width: 100%;
87
+ }
88
+ .modal--fade .modal-inner iframe, .modal--show .modal-inner iframe {
89
+ display: block;
90
+ width: 100%;
91
+ border: 0;
92
+ }
93
+ .modal--fade .modal-content, .modal--show .modal-content {
94
+ position: relative;
95
+ max-height: 400px;
96
+ max-height: 60vh;
97
+ overflow-x: hidden;
98
+ overflow-y: auto;
99
+ -webkit-overflow-scrolling: touch;
100
+ }
101
+ .modal--fade .modal-content > *, .modal--show .modal-content > * {
102
+ max-width: 100%;
103
+ }
104
+ .modal--fade footer, .modal--show footer {
105
+ border-top: 1px solid white;
106
+ padding: 0 1.2em 18px;
107
+ background: #f0f0f0;
108
+ border-radius: 2px;
109
+ }
110
+ .modal--fade .modal-close, .modal--show .modal-close {
111
+ display: block;
112
+ height: 1px;
113
+ clip: rect(0 0 0 0);
114
+ margin: -1px;
115
+ overflow: hidden;
116
+ }
117
+ .modal--fade .modal-close:focus:after, .modal--show .modal-close:focus:after {
118
+ outline: 1px dotted;
119
+ outline: -webkit-focus-ring-color auto 5px;
120
+ }
121
+ .modal--fade .modal-close:before, .modal--show .modal-close:before {
122
+ content: '';
123
+ position: absolute;
124
+ top: 0;
125
+ left: 0;
126
+ right: 0;
127
+ bottom: 0;
128
+ z-index: 10;
129
+ }
130
+ .modal--fade .modal-close:after, .modal--show .modal-close:after {
131
+ content: '\00d7';
132
+ position: absolute;
133
+ top: 35px;
134
+ right: 50%;
135
+ z-index: 20;
136
+ margin-right: -325px;
137
+ }
138
+ @media screen and (max-width: 690px) {
139
+ .modal--fade .modal-inner, .modal--show .modal-inner {
140
+ width: auto;
141
+ left: 20px;
142
+ right: 20px;
143
+ margin-left: 0;
144
+ }
145
+ .modal--fade .modal-close:after, .modal--show .modal-close:after {
146
+ margin-right: 0 !important;
147
+ right: 20px;
148
+ }
149
+ }
150
+ @media screen and (max-width: 30em) {
151
+ .modal--fade, .modal--show {
152
+ -webkit-transform: translate(0, 400px);
153
+ -webkit-transform: translate3d(0, 100%, 0);
154
+ transform: translate3d(0, 100%, 0);
155
+ -webkit-transition: opacity 1ms .25s;
156
+ -moz-transition: opacity 1ms .25s;
157
+ -o-transition: opacity 1ms .25s;
158
+ -ms-transition: opacity 1ms .25s;
159
+ transition: opacity 1ms .25s;
160
+ display: block;
161
+ right: auto;
162
+ bottom: auto;
163
+ }
164
+ .modal--fade:target, .modal--show:target, .is-active.modal--fade, .is-active.modal--show {
165
+ width: 100%;
166
+ height: 100%;
167
+ }
168
+ .modal--fade:target .modal-close, .modal--show:target .modal-close, .is-active.modal--fade .modal-close, .is-active.modal--show .modal-close {
169
+ display: block;
170
+ }
171
+ .modal--fade .modal-inner, .modal--show .modal-inner {
172
+ -webkit-box-sizing: border-box;
173
+ -moz-box-sizing: border-box;
174
+ box-sizing: border-box;
175
+ top: 0;
176
+ left: 0;
177
+ right: 0;
178
+ height: 100%;
179
+ overflow: auto;
180
+ }
181
+ .modal--fade .modal-content, .modal--show .modal-content {
182
+ max-height: none;
183
+ -ms-word-break: break-all;
184
+ word-break: break-all;
185
+ word-break: break-word;
186
+ -webkit-hyphens: auto;
187
+ -moz-hyphens: auto;
188
+ hyphens: auto;
189
+ }
190
+ .modal--fade .modal-close, .modal--show .modal-close {
191
+ display: none;
192
+ right: auto;
193
+ }
194
+ .modal--fade .modal-close:before, .modal--show .modal-close:before {
195
+ content: '';
196
+ position: fixed;
197
+ top: 0;
198
+ left: 0;
199
+ right: 0;
200
+ z-index: 20;
201
+ }
202
+ .modal--fade .modal-close:after, .modal--show .modal-close:after {
203
+ top: 5px !important;
204
+ right: 5px;
205
+ left: auto;
206
+ margin-left: 0;
207
+ }
208
+ }
209
+ @media screen and (max-height: 46em) and (min-width: 30em) {
210
+ .modal--fade .modal-content, .modal--show .modal-content {
211
+ max-height: 340px;
212
+ max-height: 50vh;
213
+ }
214
+ }
215
+ @media screen and (max-height: 36em) and (min-width: 30em) {
216
+ .modal--fade .modal-content, .modal--show .modal-content {
217
+ max-height: 265px;
218
+ max-height: 40vh;
219
+ }
220
+ }
221
+ .is-stacked.modal--fade, .is-stacked.modal--show {
222
+ -webkit-transform: translate(0, 0) scale(1, 1);
223
+ -moz-transform: translate(0, 0) scale(1, 1);
224
+ -o-transform: translate(0, 0) scale(1, 1);
225
+ -ms-transform: translate(0, 0) scale(1, 1);
226
+ transform: translate(0, 0) scale(1, 1);
227
+ opacity: 1;
228
+ }
229
+ .is-stacked.modal--fade .modal-inner, .is-stacked.modal--show .modal-inner {
230
+ -webkit-animation: scaleDown .7s ease both;
231
+ -moz-animation: scaleDown .7s ease both;
232
+ animation: scaleDown .7s ease both;
233
+ }
234
+ .is-stacked.modal--fade .modal-close, .is-stacked.modal--show .modal-close {
235
+ opacity: 0;
236
+ }
237
+ @media screen and (max-width: 30em) {
238
+ .is-stacked.modal--fade, .is-stacked.modal--show {
239
+ -webkit-animation: scaleDown .7s ease both;
240
+ -moz-animation: scaleDown .7s ease both;
241
+ animation: scaleDown .7s ease both;
242
+ }
243
+ .is-stacked.modal--fade .modal-inner, .is-stacked.modal--show .modal-inner {
244
+ -webkit-animation: none;
245
+ -moz-animation: none;
246
+ animation: none;
247
+ }
248
+ .is-stacked.modal--fade .modal-close, .is-stacked.modal--show .modal-close {
249
+ opacity: 1;
250
+ }
251
+ }
252
+
253
+ /**
254
+ * All animations for CSS Modal
255
+ *
256
+ * Available:
257
+ * - %modal--transition-fade (fade)
258
+ * - %modal--transition-zoomIn (zooms in)
259
+ * - %modal--transition-plainScreen (hides background)
260
+ *
261
+ * Usage:
262
+ *
263
+ * .selector {
264
+ * @extend %modal--transition-fade;
265
+ * }
266
+ *
267
+ */
268
+ @media screen and (min-width: 30em) {
269
+ .modal--fade {
270
+ transition: opacity 0.4s;
271
+ }
272
+ }
273
+
274
+ /**
275
+ * CSS Modal Themes
276
+ * http://drublic.github.com/css-modal
277
+ *
278
+ * @author Hans Christian Reinl - @drublic
279
+ */
280
+ /*
281
+ * Global Theme Styles
282
+ */
283
+ .modal--fade, .modal--show {
284
+ color: #222;
285
+ line-height: 1.3;
286
+ }
287
+ .modal--fade .modal-inner, .modal--show .modal-inner {
288
+ border-radius: 2px;
289
+ background: #fff;
290
+ -webkit-box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
291
+ box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
292
+ max-width: 100%;
293
+ -webkit-transition: max-width 0.25s linear, margin-left 0.125s linear;
294
+ transition: max-width 0.25s linear, margin-left 0.125s linear;
295
+ }
296
+ .modal--fade header, .modal--show header {
297
+ border-bottom: 1px solid #ddd;
298
+ padding: 0 1.2em;
299
+ }
300
+ .modal--fade header > h2, .modal--show header > h2 {
301
+ margin: 0.5em 0;
302
+ }
303
+ .modal--fade .modal-content, .modal--show .modal-content {
304
+ border-bottom: 1px solid #ddd;
305
+ padding: 15px 1.2em;
306
+ }
307
+ .modal--fade footer, .modal--show footer {
308
+ border-top: 1px solid white;
309
+ padding: 0 1.2em 18px;
310
+ background: #f0f0f0;
311
+ border-radius: 2px;
312
+ }
313
+ .modal--fade .modal-close, .modal--show .modal-close {
314
+ text-indent: -100px;
315
+ }
316
+ .modal--fade .modal-close:before, .modal--show .modal-close:before {
317
+ background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAEUlEQVQoz2NgeEYAjioYSQoAzOTmAXhPhyoAAAAASUVORK5CYII=");
318
+ }
319
+ .modal--fade .modal-close:after, .modal--show .modal-close:after {
320
+ content: '\00d7';
321
+ background: #fff;
322
+ border-radius: 2px;
323
+ padding: 2px 8px;
324
+ font-size: 1.2em;
325
+ text-decoration: none;
326
+ text-indent: 0;
327
+ }
328
+ @media screen and (max-width: 30em) {
329
+ .modal--fade .modal-close:before, .modal--show .modal-close:before {
330
+ background: #27aae2;
331
+ height: 3em;
332
+ -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.6);
333
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.6);
334
+ }
335
+ .modal--fade .modal-inner, .modal--show .modal-inner {
336
+ padding-top: 3em;
337
+ -webkit-box-shadow: none;
338
+ box-shadow: none;
339
+ }
340
+ .modal--fade .modal-close, .modal--show .modal-close {
341
+ text-decoration: none;
342
+ }
343
+ .modal--fade .modal-close:after, .modal--show .modal-close:after {
344
+ content: attr(data-close);
345
+ font-size: 1em;
346
+ padding: 0.5em 1em;
347
+ }
348
+ }
349
+
350
+ /*
351
+ * Plain Screen Theme Styles
352
+ */
353
+ /**
354
+ * Apply the desired modal behavior to your container selector
355
+ */