Afg_LightboxMessages - Version 1.0.1

Version Notes

No notes

Download this release

Release Info

Developer Magento Core Team
Extension Afg_LightboxMessages
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

app/code/community/Afg/LightboxMessages/Block/Messages.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Core
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Messages block
29
+ *
30
+ * @category Afg
31
+ * @package Afg_LightboxMessages
32
+ * @author Jerome DIMANCHE <jdimanche@groupeafg.com>
33
+ */
34
+ class Afg_LightboxMessages_Block_Messages extends Mage_Core_Block_Messages
35
+ {
36
+ /**
37
+ * Retrieve messages in HTML format grouped by type
38
+ *
39
+ * @param string $type
40
+ * @return string
41
+ */
42
+ public function getGroupedHtml()
43
+ {
44
+ if(!$this->isActivated())
45
+ return parent::getGroupedHtml();
46
+ else
47
+ return $this->getAfgGroupedHtml();
48
+ }
49
+
50
+ /**
51
+ * @desc Draw specific messages
52
+ * @param Varien_Object $specificRules
53
+ */
54
+ public function getAfgGroupedHtml(Varien_Object $specificRules = null)
55
+ {
56
+ $types = array(
57
+ Mage_Core_Model_Message::ERROR,
58
+ Mage_Core_Model_Message::WARNING,
59
+ Mage_Core_Model_Message::NOTICE,
60
+ Mage_Core_Model_Message::SUCCESS
61
+ );
62
+ $html = '';
63
+ $lightbox = '';
64
+
65
+ foreach ($types as $type)
66
+ {
67
+ if ( $messages = $this->getMessages($type) )
68
+ {
69
+ if($this->useForce($type))
70
+ {
71
+ /*########## HTML LIGHTBOX ##########*/
72
+ if ( !$lightbox )
73
+ {
74
+ //UL general
75
+ $lightbox .= '<' . $this->_messagesFirstLevelTagName . ' class="messages">';
76
+ }
77
+ //LI - Type
78
+ //UL du type
79
+ $lightbox .= '<' . $this->_messagesSecondLevelTagName . ' class="' . $type . '-msg">';
80
+ $lightbox .= '<' . $this->_messagesFirstLevelTagName . '>';
81
+
82
+ foreach ( $messages as $message )
83
+ {
84
+ //Li du type
85
+ $lightbox.= '<' . $this->_messagesSecondLevelTagName . '>';
86
+ $lightbox.= '<' . $this->_messagesContentWrapperTagName . '>';
87
+ $lightbox.= ($this->_escapeMessageFlag) ? $this->htmlEscape($message->getText()) : $message->getText();
88
+ $lightbox.= '</' . $this->_messagesContentWrapperTagName . '>';
89
+ $lightbox.= '</' . $this->_messagesSecondLevelTagName . '>';
90
+ }
91
+ //UL du type
92
+ $lightbox .= '</' . $this->_messagesFirstLevelTagName . '>';
93
+ //UL general
94
+ $lightbox .= '</' . $this->_messagesSecondLevelTagName . '>';
95
+ /*########## END HTML LIGHTBOX ##########*/
96
+ }
97
+ else
98
+ {
99
+ /*########## HTML ##########*/
100
+ if ( !$html )
101
+ {
102
+ //UL general
103
+ $html .= '<' . $this->_messagesFirstLevelTagName . ' class="messages">';
104
+ }
105
+ //LI - Type
106
+ //UL du type
107
+ $html .= '<' . $this->_messagesSecondLevelTagName . ' class="' . $type . '-msg">';
108
+ $html .= '<' . $this->_messagesFirstLevelTagName . '>';
109
+
110
+ foreach ( $messages as $message )
111
+ {
112
+ //Li du type
113
+ $html.= '<' . $this->_messagesSecondLevelTagName . '>';
114
+ $html.= '<' . $this->_messagesContentWrapperTagName . '>';
115
+ $html.= ($this->_escapeMessageFlag) ? $this->htmlEscape($message->getText()) : $message->getText();
116
+ $html.= '</' . $this->_messagesContentWrapperTagName . '>';
117
+ $html.= '</' . $this->_messagesSecondLevelTagName . '>';
118
+ }
119
+ //UL du type
120
+ $html .= '</' . $this->_messagesFirstLevelTagName . '>';
121
+ //UL general
122
+ $html .= '</' . $this->_messagesSecondLevelTagName . '>';
123
+ /*########## END HTML ##########*/
124
+ }
125
+ }
126
+ }
127
+
128
+ if ($html)
129
+ {
130
+ $html .= '</' . $this->_messagesFirstLevelTagName . '>';
131
+ }
132
+
133
+ if ($lightbox)
134
+ {
135
+ $html .= "<script type='text/javascript'>
136
+ //<![CDATA[
137
+ if(typeof Modalbox != 'undefined')
138
+ {
139
+ Event.observe(window, 'load', function() {
140
+ Modalbox.show('$lightbox', {title: '".$this->getLightboxTitle()."'});
141
+ });
142
+ }
143
+ else alert('Afg Lightbox Messages needs ModalBox.js to run.');
144
+ //]]>
145
+ </script>";
146
+ }
147
+ return $html;
148
+ }
149
+ public function useForce($type)
150
+ {
151
+ switch($type)
152
+ {
153
+ case Mage_Core_Model_Message::ERROR :
154
+ return $this->forceError();
155
+ case Mage_Core_Model_Message::WARNING :
156
+ return $this->forceWarning();
157
+ case Mage_Core_Model_Message::NOTICE :
158
+ return $this->forceNotice();
159
+ case Mage_Core_Model_Message::SUCCESS :
160
+ return $this->forceSuccess();
161
+ default :
162
+ return false;
163
+ }
164
+ }
165
+
166
+ public function isActivated()
167
+ {
168
+ return ((Mage::app()->getStore()->isAdmin() && $this->isBackendActivated()) || (!Mage::app()->getStore()->isAdmin() && $this->isFrontendActivated()));
169
+ }
170
+ public function isFrontendActivated()
171
+ {
172
+ return Mage::getStoreConfig('afg_lightboxmessages/afg_lightboxmessages_group/lightboxmessages_activate_frontend');
173
+ }
174
+
175
+ public function isBackendActivated()
176
+ {
177
+ return Mage::getStoreConfig('afg_lightboxmessages/afg_lightboxmessages_group/lightboxmessages_activate_backend');
178
+ }
179
+
180
+ public function forceError()
181
+ {
182
+ return Mage::getStoreConfig('afg_lightboxmessages/afg_lightboxmessages_group/lightboxmessages_force_error');
183
+ }
184
+
185
+ public function forceNotice()
186
+ {
187
+ return Mage::getStoreConfig('afg_lightboxmessages/afg_lightboxmessages_group/lightboxmessages_force_notice');
188
+ }
189
+
190
+ public function forceWarning()
191
+ {
192
+ return Mage::getStoreConfig('afg_lightboxmessages/afg_lightboxmessages_group/lightboxmessages_force_warning');
193
+ }
194
+
195
+ public function forceSuccess()
196
+ {
197
+ return Mage::getStoreConfig('afg_lightboxmessages/afg_lightboxmessages_group/lightboxmessages_force_success');
198
+ }
199
+
200
+ public function getLightboxTitle()
201
+ {
202
+ return Mage::getStoreConfig('afg_lightboxmessages/afg_lightboxmessages_group/lightboxmessages_title');
203
+ }
204
+ }
app/code/community/Afg/LightboxMessages/etc/config.xml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Afg_LightboxMessages>
5
+ <version>1.0.0</version>
6
+ </Afg_LightboxMessages>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <core>
11
+ <rewrite>
12
+ <messages>Afg_LightboxMessages_Block_Messages</messages>
13
+ </rewrite>
14
+ </core>
15
+ </blocks>
16
+ <global>
17
+ <models>
18
+ <lightboxmessages>
19
+ <class>Afg_LightboxLessages_Model</class>
20
+ </lightboxmessages>
21
+ </models>
22
+ </global>
23
+ </global>
24
+ <adminhtml>
25
+ <acl>
26
+ <resources>
27
+ <all>
28
+ <title>Allow Everything</title>
29
+ </all>
30
+ <admin>
31
+ <children>
32
+ <system>
33
+ <children>
34
+ <config>
35
+ <children>
36
+ <afg_lightboxmessages>
37
+ <title>AFG Solutions - LightboxMessages</title>
38
+ </afg_lightboxmessages>
39
+ </children>
40
+ </config>
41
+ </children>
42
+ </system>
43
+ </children>
44
+ </admin>
45
+ </resources>
46
+ </acl>
47
+ <layout>
48
+ <updates>
49
+ <articles>
50
+ <file>lightboxMessages.xml</file>
51
+ </articles>
52
+ </updates>
53
+ </layout>
54
+ </adminhtml>
55
+ <frontend>
56
+ <layout>
57
+ <updates>
58
+ <articles>
59
+ <file>lightboxMessages.xml</file>
60
+ </articles>
61
+ </updates>
62
+ </layout>
63
+ </frontend>
64
+ <default>
65
+ <afg_lightboxmessages>
66
+ <afg_lightboxmessages_group>
67
+ <lightboxmessages_activate_frontend>0</lightboxmessages_activate_frontend>
68
+ <lightboxmessages_activate_backend>0</lightboxmessages_activate_backend>
69
+ <lightboxmessages_force_error>0</lightboxmessages_force_error>
70
+ <lightboxmessages_force_notice>0</lightboxmessages_force_notice>
71
+ <lightboxmessages_force_warning>0</lightboxmessages_force_warning>
72
+ <lightboxmessages_force_success>0</lightboxmessages_force_success>
73
+ <lightboxmessages_title>For your information</lightboxmessages_title>
74
+ </afg_lightboxmessages_group>
75
+ </afg_lightboxmessages>
76
+ </default>
77
+ </config>
app/code/community/Afg/LightboxMessages/etc/system.xml ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!-- /** * Magento * * NOTICE OF LICENSE * * This source file is subject
3
+ to the Academic Free License (AFL 3.0) * that is bundled with this package
4
+ in the file LICENSE_AFL.txt. * It is also available through the world-wide-web
5
+ at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not
6
+ receive a copy of the license and are unable to * obtain it through the world-wide-web,
7
+ please send an email * to license@magentocommerce.com so we can send you
8
+ a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if
9
+ you wish to upgrade Magento to newer * versions in the future. If you wish
10
+ to customize Magento for your * needs please refer to http://www.magentocommerce.com
11
+ for more information. * * @category Mage * @package Mage_Sales * @copyright
12
+ Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) * @license
13
+ http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
14
+ */ -->
15
+ <config>
16
+ <tabs>
17
+ <afg translate="label">
18
+ <label>AFG Solutions</label>
19
+ <sort_order>106</sort_order>
20
+ </afg>
21
+ </tabs>
22
+
23
+ <sections>
24
+ <afg_lightboxmessages translate="label">
25
+ <label>AFG Lightbox Messages</label>
26
+ <tab>afg</tab>
27
+ <frontend_type>text</frontend_type>
28
+ <sort_order>120</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>1</show_in_store>
32
+ <groups>
33
+ <afg_lightboxmessages_group translate="label">
34
+ <label>Lightbox Messages</label>
35
+ <sort_order>70</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <fields>
40
+ <lightboxmessages_activate_frontend translate="label, comment">
41
+ <label>Use Lightbox Messages in Frontend</label>
42
+ <sort_order>10</sort_order>
43
+ <frontend_type>select</frontend_type>
44
+ <source_model>adminhtml/system_config_source_yesno</source_model>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ <comment>
49
+ <![CDATA[Activate Lightbox Messages in <span style='color:green;font-weight:bold;'>Frontend</span>]]>
50
+ </comment>
51
+ </lightboxmessages_activate_frontend>
52
+ <lightboxmessages_activate_backend translate="label, comment">
53
+ <label>Use Lightbox Messages in Backend</label>
54
+ <sort_order>12</sort_order>
55
+ <frontend_type>select</frontend_type>
56
+ <source_model>adminhtml/system_config_source_yesno</source_model>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ <comment>
61
+ <![CDATA[Activate of Lightbox Messages in <span style='color:red;font-weight:bold;'>Backend</span>]]>
62
+ </comment>
63
+ </lightboxmessages_activate_backend>
64
+ <lightboxmessages_title translate="label, comment">
65
+ <label>Title for the lightbox</label>
66
+ <sort_order>15</sort_order>
67
+ <frontend_type>text</frontend_type>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ <comment>
72
+ <![CDATA[The title of the lightbox]]>
73
+ </comment>
74
+ </lightboxmessages_title>
75
+ <lightboxmessages_force_success translate="label, comment">
76
+ <label>Force Lightbox Messages for Success</label>
77
+ <sort_order>20</sort_order>
78
+ <frontend_type>select</frontend_type>
79
+ <source_model>adminhtml/system_config_source_yesno</source_model>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>1</show_in_store>
83
+ <comment>
84
+ <![CDATA[Use Lightbox Messages for all <span style='color:green;font-weight:bold;'>success</span> messages.]]>
85
+ </comment>
86
+ </lightboxmessages_force_success>
87
+ <lightboxmessages_force_error translate="label, comment">
88
+ <label>Force Lightbox Messages for Errors</label>
89
+ <sort_order>30</sort_order>
90
+ <frontend_type>select</frontend_type>
91
+ <source_model>adminhtml/system_config_source_yesno</source_model>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ <comment>
96
+ <![CDATA[Use Lightbox Messages for all <span style='color:red;font-weight:bold;'>error</span> messages.]]>
97
+ </comment>
98
+ </lightboxmessages_force_error>
99
+ <lightboxmessages_force_warning translate="label, comment">
100
+ <label>Force Lightbox Messages for Warnings</label>
101
+ <sort_order>40</sort_order>
102
+ <frontend_type>select</frontend_type>
103
+ <source_model>adminhtml/system_config_source_yesno</source_model>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>1</show_in_website>
106
+ <show_in_store>1</show_in_store>
107
+ <comment>
108
+ <![CDATA[Use Lightbox Messages for all <span style='color:orange;font-weight:bold;'>warning</span> messages.]]>
109
+ </comment>
110
+ </lightboxmessages_force_warning>
111
+ <lightboxmessages_force_notice translate="label, comment">
112
+ <label>Force Lightbox Messages for Notices</label>
113
+ <sort_order>50</sort_order>
114
+ <frontend_type>select</frontend_type>
115
+ <source_model>adminhtml/system_config_source_yesno</source_model>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>1</show_in_website>
118
+ <show_in_store>1</show_in_store>
119
+ <comment>
120
+ <![CDATA[Use Lightbox Messages for all <span style='color:black;font-weight:bold;'>notice</span> messages.]]>
121
+ </comment>
122
+ </lightboxmessages_force_notice>
123
+ </fields>
124
+ </afg_lightboxmessages_group>
125
+ </groups>
126
+ </afg_lightboxmessages>
127
+ </sections>
128
+ </config>
app/design/adminhtml/default/default/layout/lightboxMessages.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addJs"><script>prototype/modalbox.js</script></action>
6
+ <action method="addCss"><name>modalbox.css</name></action>
7
+ </reference>
8
+ </default>
9
+ </layout>
app/design/adminhtml/default/default/template/login.phtml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
28
+ <html lang="en">
29
+ <head>
30
+ <title><?php echo Mage::helper('adminhtml')->__('Log into Magento Admin Page') ?></title>
31
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" ></meta>
32
+ <link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl('reset.css') ?>" media="all" />
33
+ <link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl('modalbox.css') ?>" media="all" />
34
+ <link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl('boxes.css') ?>" media="all" />
35
+ <link rel="icon" href="<?php echo $this->getSkinUrl('favicon.ico') ?>" type="image/x-icon" />
36
+ <link rel="shortcut icon" href="<?php echo $this->getSkinUrl('favicon.ico') ?>" type="image/x-icon" />
37
+
38
+ <script type="text/javascript" src="<?php echo $this->getJsUrl('prototype/prototype.js') ?>"></script>
39
+ <script type="text/javascript" src="<?php echo $this->getJsUrl('prototype/validation.js') ?>"></script>
40
+ <script type="text/javascript" src="<?php echo $this->getJsUrl('scriptaculous/effects.js') ?>"></script>
41
+ <script type="text/javascript" src="<?php echo $this->getJsUrl('mage/adminhtml/form.js') ?>"></script>
42
+ <script type="text/javascript" src="<?php echo $this->getJsUrl('prototype/modalbox.js') ?>"></script>
43
+
44
+ <!--[if IE]> <link rel="stylesheet" href="<?php echo $this->getSkinUrl('iestyles.css') ?>" type="text/css" media="all" /> <![endif]-->
45
+ <!--[if lt IE 7]> <link rel="stylesheet" href="<?php echo $this->getSkinUrl('below_ie7.css') ?>" type="text/css" media="all" /> <![endif]-->
46
+ <!--[if IE 7]> <link rel="stylesheet" href="<?php echo $this->getSkinUrl('ie7.css') ?>" type="text/css" media="all" /> <![endif]-->
47
+ </head>
48
+ <body id="page-login" onload="document.forms.loginForm.username.focus();">
49
+ <div class="login-container">
50
+ <div class="login-box">
51
+ <form method="post" action="" id="loginForm">
52
+ <div class="login-form">
53
+ <input name="form_key" type="hidden" value="<?php echo $this->getFormKey() ?>" />
54
+ <h2><?php echo Mage::helper('adminhtml')->__('Log in to Admin Panel') ?></h2>
55
+ <div id="messages">
56
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
57
+ </div>
58
+ <div class="input-box input-left"><label for="username"><?php echo Mage::helper('adminhtml')->__('User Name:') ?></label><br/>
59
+ <input type="text" id="username" name="login[username]" value="" class="required-entry input-text" /></div>
60
+ <div class="input-box input-right"><label for="login"><?php echo Mage::helper('adminhtml')->__('Password:') ?></label><br />
61
+ <input type="password" id="login" name="login[password]" class="required-entry input-text" value="" /></div>
62
+ <div class="clear"></div>
63
+ <div class="form-buttons">
64
+ <a class="left" href="<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/index/forgotpassword', array('_nosecret' => true)) ?>"><?php echo Mage::helper('adminhtml')->__('Forgot your password?') ?></a>
65
+ <input type="submit" class="form-button" value="<?php echo Mage::helper('adminhtml')->__('Login') ?>" title="<?php echo Mage::helper('adminhtml')->__('Login') ?>" /></div>
66
+ </div>
67
+ <p class="legal"><?php echo Mage::helper('adminhtml')->__('Magento is a trademark of Magento Inc. Copyright &copy; %s Magento Inc.', date('Y')) ?></p>
68
+ </form>
69
+ <div class="bottom"></div>
70
+ <script type="text/javascript">
71
+ var loginForm = new varienForm('loginForm');
72
+ </script>
73
+ </div>
74
+ </div>
75
+ </body>
76
+ </html>
77
+
app/design/frontend/base/default/layout/lightboxMessages.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addJs"><script>prototype/modalbox.js</script></action>
6
+ <action method="addCss"><name>css/modalbox.css</name></action>
7
+ </reference>
8
+ </default>
9
+ </layout>
app/etc/modules/Afg_Informations.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Afg
23
+ * @package Afg_CleanOrders
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Afg_Informations>
31
+ <active>true</active>
32
+ <codePool>community</codePool>
33
+ </Afg_Informations>
34
+ </modules>
35
+ </config>
app/etc/modules/Afg_LightboxMessages.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Afg
23
+ * @package Afg_CleanOrders
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Afg_LightboxMessages>
31
+ <active>true</active>
32
+ <codePool>community</codePool>
33
+ </Afg_LightboxMessages>
34
+ </modules>
35
+ </config>
js/prototype/modalbox.js ADDED
@@ -0,0 +1,593 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //
2
+ // ModalBox - The pop-up window thingie with AJAX, based on Prototype JS framework.
3
+ //
4
+ // Created by Andrew Okonetchnikov
5
+ // Copyright 2006-2010 okonet.ru. All rights reserved.
6
+ //
7
+ // Licensed under MIT license.
8
+ //
9
+
10
+ if (Object.isUndefined(Prototype.Browser.IE6)) {
11
+ Prototype.Browser.IE6 = (navigator.appName.indexOf("Microsoft Internet Explorer") != -1 && navigator.appVersion.indexOf("MSIE 6.0") != -1 && !window.XMLHttpRequest);
12
+ }
13
+
14
+ if (!window.Modalbox)
15
+ var Modalbox = {};
16
+
17
+ Modalbox.Methods = {
18
+ overrideAlert: false, // Override standard browser alert message with ModalBox
19
+ focusableElements: [],
20
+ currFocused: 0,
21
+ initialized: false, // Modalbox is visible
22
+ active: true, // Modalbox is visible and active
23
+ options: {
24
+ title: "ModalBox Window", // Title of the ModalBox window
25
+ overlayClose: true, // Close modal box by clicking on overlay
26
+ width: 500, // Default width in px
27
+ height: 90, // Default height in px
28
+ overlayOpacity: 0.65, // Default overlay opacity
29
+ overlayDuration: 0.25, // Default overlay fade in/out duration in seconds
30
+ slideDownDuration: 0.5, // Default Modalbox appear slide down effect in seconds
31
+ slideUpDuration: 0.5, // Default Modalbox hiding slide up effect in seconds
32
+ resizeDuration: 0.25, // Default resize duration seconds
33
+ inactiveFade: true, // Fades MB window on inactive state
34
+ transitions: true, // Toggles transition effects. Transitions are enabled by default
35
+ loadingString: "Please wait. Loading...", // Default loading string message
36
+ closeString: "Close window", // Default title attribute for close window link
37
+ closeValue: "&times;", // Default string for close link in the header
38
+ params: {},
39
+ method: 'get', // Default Ajax request method
40
+ autoFocusing: true, // Toggles auto-focusing for form elements. Disable for long text pages.
41
+ aspnet: false, // Should be true when using with ASP.NET controls. When true Modalbox window will be injected into the first form element.
42
+ resizeCSSID: ''
43
+ },
44
+ _options: {},
45
+
46
+ setOptions: function(options) {
47
+ Object.extend(this.options, options || {});
48
+ },
49
+
50
+ _init: function(options) {
51
+ // Setting up original options with default options
52
+ Object.extend(this._options, this.options);
53
+ this.setOptions(options);
54
+
55
+ // Creating the overlay
56
+ this.MBoverlay = new Element("div", {id: "MB_overlay", style: "opacity: 0"});
57
+
58
+ // Creating the modal window
59
+ this.MBwindowwrapper = new Element("div", {id: "MB_windowwrapper"}).update(
60
+ this.MBwindow = new Element("div", {id: "MB_window", style: "display: none"}).update(
61
+ this.MBframe = new Element("div", {id: "MB_frame"}).update(
62
+ this.MBheader = new Element("div", {id: "MB_header"}).update(
63
+ this.MBcaption = new Element("div", {id: "MB_caption"})
64
+ )
65
+ )
66
+ )
67
+ );
68
+
69
+ this.MBclose = new Element("a", {id: "MB_close", title: this.options.closeString, href: "#"}).update("<span>" + this.options.closeValue + "</span>");
70
+ this.MBheader.insert({'bottom':this.MBclose});
71
+
72
+ this.MBcontent = new Element("div", {id: "MB_content"}).update(
73
+ this.MBloading = new Element("div", {id: "MB_loading"}).update(this.options.loadingString)
74
+ );
75
+ this.MBframe.insert({'bottom':this.MBcontent});
76
+
77
+ // Inserting into DOM. If parameter set and form element have been found will inject into it. Otherwise will inject into body as topmost element.
78
+ // Be sure to set padding and marging to null via CSS for both body and (in case of asp.net) form elements.
79
+ var injectToEl = this.options.aspnet ? $(document.body).down('form') : $(document.body);
80
+ injectToEl.insert({'top':this.MBwindowwrapper});
81
+ injectToEl.insert({'top':this.MBoverlay});
82
+
83
+ var scrollOffsets = document.viewport.getScrollOffsets();
84
+ if (scrollOffsets[1] > 0) {
85
+ $('MB_window').setStyle({top:scrollOffsets[1] + 'px'});
86
+ }
87
+
88
+ Event.observe(window, 'scroll', function() {
89
+ scrollOffsets = document.viewport.getScrollOffsets();
90
+ $('MB_window').setStyle({top:scrollOffsets[1] + 'px'});
91
+ });
92
+
93
+ // Initial scrolling position of the window. To be used for remove scrolling effect during ModalBox appearing
94
+ this.initScrollX = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft;
95
+ this.initScrollY = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
96
+
97
+ //Adding event observers
98
+ this.hideObserver = this._hide.bindAsEventListener(this);
99
+ this.kbdObserver = this._kbdHandler.bindAsEventListener(this);
100
+ this.resizeObserver = this._setWidthAndPosition.bindAsEventListener(this);
101
+ this._initObservers();
102
+
103
+ this.initialized = true; // Mark as initialized
104
+ },
105
+
106
+ show: function(content, options) {
107
+ if (!this.initialized) this._init(options); // Check if MB is already initialized
108
+
109
+ this._cleanUpContentIDs();
110
+
111
+ this.content = content;
112
+ this.setOptions(options);
113
+
114
+ if (this.options.title) { // Updating title of the MB
115
+ this.MBcaption.update(this.options.title);
116
+ } else { // If title isn't given, the header will not displayed
117
+ this.MBheader.hide();
118
+ this.MBcaption.hide();
119
+ }
120
+
121
+ if (this.MBwindow.style.display == "none") { // First modal box appearing
122
+ this._appear();
123
+ this.event("onShow"); // Passing onShow callback
124
+ } else { // If MB already on the screen, update it
125
+ this._update();
126
+ this.event("onUpdate"); // Passing onUpdate callback
127
+ }
128
+ },
129
+
130
+ hide: function(options) { // External hide method to use from external HTML and JS
131
+ if (this.initialized) {
132
+ // Reading for options/callbacks except if event given as a parameter
133
+ if (options && !Object.isFunction(options.element))
134
+ Object.extend(this.options, options);
135
+ this.event("beforeHide"); // Passing beforeHide callback
136
+ if (this.options.transitions) {
137
+ Effect.SlideUp(this.MBwindow, { duration: this.options.slideUpDuration, transition: Effect.Transitions.sinoidal, afterFinish: this._deinit.bind(this) });
138
+ } else {
139
+ this.MBwindow.hide();
140
+ this._deinit();
141
+ }
142
+ Event.stopObserving(window, 'scroll');
143
+ } else {
144
+ throw("Modalbox is not initialized.");
145
+ }
146
+ },
147
+
148
+ _hide: function(event) { // Internal hide method to use with overlay and close link
149
+ event.stop(); // Stop event propagation for link elements
150
+ // When clicked on overlay we'll check the option and in case of overlayClose == false we'll break hiding execution [Fix for #139]
151
+ if (event.element().id == 'MB_overlay' && !this.options.overlayClose) return false;
152
+ this.hide();
153
+ },
154
+
155
+ alert: function(message){
156
+ var html = '<div class="MB_alert"><p>' + message + '</p><input type="button" onclick="Modalbox.hide()" value="OK" /></div>';
157
+ Modalbox.show(html, {title: 'Alert: ' + document.title, width: 300});
158
+ },
159
+
160
+ _appear: function() { // First appearing of MB
161
+ if (Prototype.Browser.IE6) { // Preparing IE 6 for showing modalbox
162
+ window.scrollTo(0,0);
163
+ this._prepareIEHtml("100%", "hidden");
164
+ this._prepareIESelects("hidden");
165
+ }
166
+ this._setWidth();
167
+ if(this.options.transitions) {
168
+ this.MBoverlay.setOpacity(0);
169
+ new Effect.Fade(this.MBoverlay, {
170
+ from: 0,
171
+ to: this.options.overlayOpacity,
172
+ duration: this.options.overlayDuration,
173
+ afterFinish: (function() {
174
+ new Effect.SlideDown(this.MBwindow, {
175
+ duration: this.options.slideDownDuration,
176
+ transition: Effect.Transitions.sinoidal,
177
+ afterFinish: this.loadContent.bind(this)
178
+ });
179
+ }).bind(this)
180
+ });
181
+ } else {
182
+ this.MBoverlay.setOpacity(this.options.overlayOpacity);
183
+ this.MBwindow.show();
184
+ this.loadContent();
185
+ }
186
+ Event.observe(window, "resize", this.resizeObserver);
187
+ },
188
+
189
+ resize: function(byWidth, byHeight, options) { // Change size of MB without content reloading
190
+ var oWidth = $(this.MBoverlay).getWidth();
191
+ var wHeight = $(this.MBwindow).getHeight();
192
+ var wWidth = $(this.MBwindow).getWidth();
193
+ var hHeight = $(this.MBheader).getHeight();
194
+ var cHeight = $(this.MBcontent).getHeight();
195
+ var newHeight = ((wHeight - hHeight + byHeight) < cHeight) ? (cHeight + hHeight) : (wHeight + byHeight);
196
+
197
+ var el = $(this.MBwindow);
198
+ var contentEl = $(this.MBcontent);
199
+ var windowBottomMargin = 10;
200
+ newHeight += windowBottomMargin;
201
+ var windowOffset = (parseInt(el.getStyle('margin-top'), 0) + parseInt(el.getStyle('margin-bottom'), 0) + parseInt(el.getStyle('border-top-width'), 0) + parseInt(el.getStyle('border-bottom-width'), 0)) + windowBottomMargin;
202
+ var contentPadding = (parseInt(contentEl.getStyle('padding-top')) + parseInt(contentEl.getStyle('padding-bottom')));
203
+
204
+ if ((newHeight + windowOffset + contentPadding) > document.viewport.getHeight()) {
205
+ // adjust window height to account for margins and border widths
206
+ newHeight = document.viewport.getHeight() - windowOffset - windowBottomMargin;
207
+ // calculate content height including header height and padding values
208
+ newcHeight = newHeight - hHeight - parseInt($(this.MBframe).getStyle('padding-bottom'), 0) - parseInt($(this.MBcontent).getStyle('padding-bottom'), 0);
209
+ $(this.MBcontent).setStyle({height:newcHeight + 'px'});
210
+ } else if ($(this.MBcontent).getStyle('height')) {
211
+ // release any MB_content height set prior to establish scrollbars in content area
212
+ $(this.MBcontent).setStyle({height:''});
213
+ }
214
+
215
+ var newWidth = wWidth + byWidth;
216
+ //var newStyle = {width: newWidth + "px", height: newHeight + "px", left: (o.width - newWidth)/2 + "px"};
217
+ var newStyle = {width: newWidth + "px", height: newHeight + "px"};
218
+ this.options.width = newWidth;
219
+ if (options) this.setOptions(options); // Passing callbacks
220
+ if (this.options.transitions && !Modalbox.animating) {
221
+ Modalbox.animating = true;
222
+ new Effect.Morph(this.MBwindow, {
223
+ style: newStyle,
224
+ duration: this.options.resizeDuration,
225
+ beforeStart: function(fx){
226
+ fx.element.setStyle({overflow: "hidden"}); // Fix for MSIE 6 to resize correctly
227
+ },
228
+ afterFinish: (function(fx) {
229
+ fx.element.setStyle({overflow: "visible"});
230
+ this.event("_afterResize"); // Passing internal callback
231
+ this.event("afterResize"); // Passing callback
232
+ Modalbox.animating = false;
233
+ }).bind(this)
234
+ });
235
+ } else {
236
+ this.MBwindow.setStyle(newStyle);
237
+ (function() {
238
+ this.event("_afterResize"); // Passing internal callback
239
+ this.event("afterResize"); // Passing callback
240
+ }).bind(this).defer();
241
+ }
242
+ },
243
+
244
+ resizeToContent: function(options){
245
+ // Resizes the modalbox window to the actual content height.
246
+ // This might be useful to resize modalbox after some content modifications which were changed content height.
247
+
248
+ if (typeof options == "undefined") {
249
+ options = {};
250
+ }
251
+
252
+ // check to see if MB_content includes any images
253
+ var mbimages = $('MB_content').select('img');
254
+ var totalimages = mbimages.length;
255
+ if (mbimages[0]) {
256
+ if (typeof options.imagesloaded == "undefined") {
257
+
258
+ var loadedImages = $A();
259
+ var loadedImageTotal = 0;
260
+ mbimages.each(function(o,idx) {
261
+ loadedImages[idx] = new Image();
262
+ loadedImages[idx].src = o.src;
263
+ loadedImages[idx].onload = function() {
264
+ loadedImageTotal++;
265
+ if (loadedImageTotal == totalimages) {
266
+ // make sure all images have been rendered by checking their height
267
+ var imageincomplete = false;
268
+ mbimages.each(function(i) {
269
+ if (i.height == 0) {
270
+ imageincomplete = true;
271
+ }
272
+ });
273
+ if (imageincomplete || Modalbox.animating) {
274
+ // some image hasn't been rendered yet, trigger resize loop until it is
275
+ Modalbox.resizeToContent();
276
+ } else {
277
+ // trigger one final resize, but set imagesloaded option to skip inspection of images
278
+ options.imagesloaded = true;
279
+ Modalbox.resizeToContent(options);
280
+ }
281
+ }
282
+ }
283
+ })
284
+ }
285
+ }
286
+
287
+ var byWidth = 0, byHeight = this.options.height - this.MBwindow.getHeight();
288
+ if (options.resizeCSSID && $(options.resizeCSSID)) {
289
+ // byWidth is the amount of pixels needed to increase/decrease window to meet width of options.resizeCSSID
290
+ // plus a 10 pixel margin to accommodate scrollbars
291
+ byWidth = $(options.resizeCSSID).getWidth() - $(this.MBwindow).getWidth() + (parseInt($(this.MBcontent).getStyle('padding-left'), 0) + parseInt($(this.MBcontent).getStyle('padding-right'), 0)) + 15;
292
+ }
293
+ if (byHeight != 0) {
294
+ this.resize(byWidth, byHeight, options);
295
+ }
296
+ },
297
+
298
+ resizeToInclude: function(element, options){
299
+ // Resizes the modalbox window to the cumulative height of element. Calculations are using CSS properties for margins and border.
300
+ // This method might be useful to resize modalbox before including or updating content.
301
+
302
+ var el = $(element);
303
+ var elHeight = el.getHeight() + parseInt(el.getStyle('margin-top'), 0) + parseInt(el.getStyle('margin-bottom'), 0) + parseInt(el.getStyle('border-top-width'), 0) + parseInt(el.getStyle('border-bottom-width'), 0);
304
+ if (elHeight > 0) {
305
+ this.resize(0, elHeight, options);
306
+ }
307
+ },
308
+
309
+ _update: function() { // Updating MB in case of wizards
310
+ this.MBcontent.update($(this.MBloading).update(this.options.loadingString));
311
+ this.loadContent();
312
+ },
313
+
314
+ loadContent: function() {
315
+ if (this.event("beforeLoad") != false) { // If callback passed false, skip loading of the content
316
+ if (typeof this.content == 'string') {
317
+ var htmlRegExp = new RegExp(/<\/?[^>]+>/gi);
318
+ if (htmlRegExp.test(this.content)) { // Plain HTML given as a parameter
319
+ this._processContent(this.content);
320
+ } else { // URL given as a parameter. We'll request it via Ajax
321
+ new Ajax.Request(this.content, {
322
+ method: this.options.method.toLowerCase(),
323
+ parameters: this.options.params,
324
+ onComplete: (function(response) {
325
+ this._processContent(response.responseText);
326
+ }).bind(this),
327
+ onException: function(instance, exception){
328
+ Modalbox.hide();
329
+ throw('Modalbox Loading Error: ' + exception);
330
+ }
331
+ });
332
+ }
333
+ } else if (typeof this.content == 'object') { // HTML Object is given
334
+ this._insertContent(this.content);
335
+ } else {
336
+ this.hide();
337
+ throw('Modalbox Parameters Error: Please specify correct URL or HTML element (plain HTML or object)');
338
+ }
339
+ }
340
+ },
341
+
342
+ _processContent: function(content) {
343
+ var html = content.stripScripts(), scripts = content.extractScripts();
344
+ this._insertContent(html, function() {
345
+ scripts.map(function(script) {
346
+ return eval(script.replace("<!--", "").replace("// -->", ""));
347
+ }, window);
348
+ });
349
+ },
350
+
351
+ _insertContent: function(content, callback) {
352
+ this.MBcontent.hide().update();
353
+
354
+ if (typeof content == 'string') { // Plain HTML is given
355
+ this.MBcontent.insert(new Element("div", { style: "display: none" }).update(content)).down().show();
356
+ } else if (typeof content == 'object') { // HTML Object is given
357
+ var _htmlObj = content.cloneNode(true); // If node is already a part of DOM we'll clone it
358
+ // If cloneable element has ID attribute defined, modify it to prevent duplicates
359
+ if (content.id) content.id = "MB_" + content.id;
360
+ // Add prefix for IDs on all elements inside the DOM node
361
+ $(content).select('*[id]').each(function(el) { el.id = "MB_" + el.id; });
362
+ this.MBcontent.insert(_htmlObj).down('div').show();
363
+ if (Prototype.Browser.IE6) { // Toggling back visibility for hidden selects in IE
364
+ this._prepareIESelects("", "#MB_content ");
365
+ }
366
+ }
367
+
368
+ // Prepare and resize modal box for content
369
+ if (this.options.height == this._options.height) {
370
+ this.resize((this.options.width - $(this.MBwindow).getWidth()), this.MBcontent.getHeight() - $(this.MBwindow).getHeight() + this.MBheader.getHeight(), {
371
+ afterResize: (function() {
372
+ this._putContent.bind(this, callback).defer(); // MSIE fix
373
+ }).bind(this)
374
+ });
375
+ } else { // Height is defined. Creating a scrollable window
376
+ this._setWidth();
377
+ this.MBcontent.setStyle({
378
+ overflow: 'auto',
379
+ height: this.MBwindow.getHeight() - this.MBheader.getHeight() - 13 + 'px'
380
+ });
381
+ this._putContent.bind(this, callback).defer(); // MSIE fix
382
+ }
383
+ },
384
+
385
+ _putContent: function(callback) {
386
+ this.MBcontent.show();
387
+ this._findFocusableElements();
388
+ this._setFocus(); // Setting focus on first 'focusable' element in content (input, select, textarea, link or button)
389
+ if (Object.isFunction(callback))
390
+ callback(); // Executing internal JS from loaded content
391
+ this.event("afterLoad"); // Passing callback
392
+ },
393
+
394
+ activate: function(options) {
395
+ this.setOptions(options);
396
+ this.active = true;
397
+ if (this.options.overlayClose)
398
+ this.MBoverlay.observe("click", this.hideObserver);
399
+ this.MBclose.observe("click", this.hideObserver).show();
400
+ if (this.options.transitions && this.options.inactiveFade)
401
+ new Effect.Appear(this.MBwindow, {duration: this.options.slideUpDuration});
402
+ },
403
+
404
+ deactivate: function(options) {
405
+ this.setOptions(options);
406
+ this.active = false;
407
+ if (this.options.overlayClose)
408
+ this.MBoverlay.stopObserving("click", this.hideObserver);
409
+ this.MBclose.stopObserving("click", this.hideObserver).hide();
410
+ if (this.options.transitions && this.options.inactiveFade)
411
+ new Effect.Fade(this.MBwindow, {duration: this.options.slideUpDuration, to: 0.75});
412
+ },
413
+
414
+ _initObservers: function() {
415
+ this.MBclose.observe("click", this.hideObserver);
416
+ if (this.options.overlayClose)
417
+ this.MBoverlay.observe("click", this.hideObserver);
418
+ // Gecko and Opera are moving focus a way too fast, all other browsers are okay with keydown
419
+ var kbdEvent = (Prototype.Browser.Gecko || Prototype.Browser.Opera) ? "keypress" : "keydown";
420
+ Event.observe(document, kbdEvent, this.kbdObserver);
421
+ },
422
+
423
+ _removeObservers: function() {
424
+ this.MBclose.stopObserving("click", this.hideObserver);
425
+ if (this.options.overlayClose)
426
+ this.MBoverlay.stopObserving("click", this.hideObserver);
427
+ var kbdEvent = (Prototype.Browser.Gecko || Prototype.Browser.Opera) ? "keypress" : "keydown";
428
+ Event.stopObserving(document, kbdEvent, this.kbdObserver);
429
+ },
430
+
431
+ _setFocus: function() {
432
+ // Setting focus to the first 'focusable' element which is one with tabindex = 1 or the first in the form loaded.
433
+ if (this.focusableElements.length > 0 && this.options.autoFocusing == true) {
434
+ var firstEl = this.focusableElements.find(function (el){
435
+ return el.tabIndex == 1;
436
+ }) || this.focusableElements.first();
437
+ this.currFocused = this.focusableElements.toArray().indexOf(firstEl);
438
+ firstEl.focus(); // Focus on first focusable element except close button
439
+ } else if (this.MBclose.visible()) {
440
+ this.MBclose.focus(); // If no focusable elements exist focus on close button
441
+ }
442
+ },
443
+
444
+ _findFocusableElements: function() { // Collect form elements and links from MB content
445
+ if (this.options.autoFocusing === true) {
446
+ // TODO maybe add :enabled to select and textarea elements
447
+ this.MBcontent.select('input:not([type=hidden]):enabled, select, textarea, button, a[href]').invoke('addClassName', 'MB_focusable');
448
+ this.focusableElements = this.MBcontent.select('.MB_focusable');
449
+ }
450
+ },
451
+
452
+ _kbdHandler: function(event) {
453
+ var node = event.element();
454
+ switch(event.keyCode) {
455
+ case Event.KEY_TAB:
456
+ event.stop();
457
+
458
+ // Switching currFocused to the element which was focused by mouse instead of TAB-key. Fix for #134
459
+ if (node != this.focusableElements[this.currFocused])
460
+ this.currFocused = this.focusableElements.indexOf(node);
461
+
462
+ if (!event.shiftKey) { // Focusing in direct order
463
+ if (this.currFocused >= this.focusableElements.length - 1) {
464
+ this.currFocused = 0;
465
+ } else {
466
+ this.currFocused++;
467
+ }
468
+ } else { // Shift key is pressed. Focusing in reverse order
469
+ if (this.currFocused <= 0) {
470
+ this.currFocused = this.focusableElements.length - 1;
471
+ } else {
472
+ this.currFocused--;
473
+ }
474
+ }
475
+ this.focusableElements[this.currFocused].focus();
476
+ break;
477
+ case Event.KEY_ESC:
478
+ if (this.active) this._hide(event);
479
+ break;
480
+ case 32:
481
+ this._preventScroll(event);
482
+ break;
483
+ case 0: // For Gecko browsers compatibility
484
+ if (event.which == 32) this._preventScroll(event);
485
+ break;
486
+ case Event.KEY_UP:
487
+ case Event.KEY_DOWN:
488
+ case Event.KEY_PAGEDOWN:
489
+ case Event.KEY_PAGEUP:
490
+ case Event.KEY_HOME:
491
+ case Event.KEY_END:
492
+ var tagName = node.tagName.toLowerCase();
493
+ // Safari operates in slightly different way. This realization is still buggy in Safari.
494
+ if (Prototype.Browser.WebKit && !["textarea", "select"].include(tagName)) {
495
+ event.stop();
496
+ } else if ((tagName == "input" && ["submit", "button"].include(node.type)) || (tagName == "a")) {
497
+ event.stop();
498
+ }
499
+ break;
500
+ }
501
+ },
502
+
503
+ _preventScroll: function(event) { // Disabling scrolling by "space" key
504
+ if (!["input", "textarea", "select", "button"].include(event.element().tagName.toLowerCase()))
505
+ event.stop();
506
+ },
507
+
508
+ _deinit: function() {
509
+ this._removeObservers();
510
+ Event.stopObserving(window, "resize", this.resizeObserver);
511
+ if (this.options.transitions) {
512
+ Effect.toggle(this.MBoverlay, 'appear', {duration: this.options.overlayDuration, afterFinish: this._removeElements.bind(this) });
513
+ } else {
514
+ this.MBoverlay.hide();
515
+ this._removeElements();
516
+ }
517
+ this.MBcontent.setStyle({overflow: '', height: ''});
518
+ },
519
+
520
+ _cleanUpContentIDs: function() {
521
+ // Replace prefixes 'MB_' in IDs for the original content
522
+ if (typeof this.content == 'object') {
523
+ if (this.content.id && this.content.id.match(/MB_/)) {
524
+ this.content.id = this.content.id.replace(/MB_/, "");
525
+ }
526
+
527
+ this.content.select('*[id]').each(function(el) {
528
+ el.id = el.id.replace(/MB_/, "");
529
+ });
530
+ }
531
+ },
532
+
533
+ _removeElements: function() {
534
+ if (Prototype.Browser.Opera) { // Remove overlay after-effects in Opera
535
+ window.scrollBy(0, 0);
536
+ }
537
+ this.MBoverlay.remove();
538
+ $(this.MBwindowwrapper).remove();
539
+ if (Prototype.Browser.IE6) {
540
+ this._prepareIEHtml("", ""); // If set to auto MSIE will show horizontal scrolling
541
+ this._prepareIESelects("");
542
+ window.scrollTo(this.initScrollX, this.initScrollY);
543
+ }
544
+
545
+ this._cleanUpContentIDs();
546
+
547
+ // Initialized will be set to false
548
+ this.initialized = false;
549
+ this.event("afterHide"); // Passing afterHide callback
550
+ this.setOptions(this._options); // Settings options object into initial state
551
+ },
552
+
553
+ _setWidth: function() { // Set size
554
+ this.MBwindow.setStyle({width: this.options.width + "px", height: this.options.height + "px"});
555
+ },
556
+
557
+ _setWidthAndPosition: function() {
558
+ this.MBwindow.setStyle({
559
+ width: this.options.width + "px"
560
+ });
561
+ },
562
+
563
+ _prepareIEHtml: function(height, overflow) {
564
+ // IE6 requires width and height set to 100% and overflow hidden
565
+ $$('html, body').invoke('setStyle', {
566
+ width: height,
567
+ height: height,
568
+ overflow: overflow
569
+ });
570
+ },
571
+
572
+ _prepareIESelects: function(visibility, prefix) {
573
+ // Toggle visibility for select elements
574
+ $$((prefix || "") + "select").invoke('setStyle', {
575
+ 'visibility': visibility
576
+ });
577
+ },
578
+
579
+ event: function(eventName) {
580
+ var r = true;
581
+ if (this.options[eventName]) {
582
+ var returnValue = this.options[eventName](); // Executing callback
583
+ this.options[eventName] = null; // Removing callback after execution
584
+ if (!Object.isUndefined(returnValue))
585
+ r = returnValue;
586
+ }
587
+ return r;
588
+ }
589
+ };
590
+
591
+ Object.extend(Modalbox, Modalbox.Methods);
592
+
593
+ if (Modalbox.overrideAlert) window.alert = Modalbox.alert;
media/groupe-afg.png ADDED
Binary file
media/txt-groupeafg.png ADDED
Binary file
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Afg_LightboxMessages</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license>MIT</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Show session messages in lightbox</summary>
10
+ <description>Afg Lightbox Messages allow you to show error, warning, notice and success messages into a lightbox.</description>
11
+ <notes>No notes</notes>
12
+ <authors><author><name>Jerome DIMANCHE</name><user>auto-converted</user><email>jdimanche@groupeafg.com</email></author></authors>
13
+ <date>2011-05-02</date>
14
+ <time>15:38:10</time>
15
+ <contents><target name="magecommunity"><dir name="Afg"><dir name="LightboxMessages"><dir name="Block"><file name="Messages.php" hash="267d543e4d4c73e78c0053ff47479064"/></dir><dir name="etc"><file name="config.xml" hash="6c046caba898271ae30d5728f5249f0a"/><file name="system.xml" hash="d28eb3e9fbbc7fd4355ce83b113734b6"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Afg_LightboxMessages.xml" hash="e72a742fcad05e438fba3f7ba5d910e5"/><file name="Afg_Informations.xml" hash="59a9ec4eb0059dfdfc98784e50804bc6"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="lightboxMessages.xml" hash="2a11a9c144b89ca8da57f0c45e5f0e4a"/></dir><dir name="template"><file name="login.phtml" hash="806e515a093369e7e4e393fd7b559e1e"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="lightboxMessages.xml" hash="da6f932bb3bf87ad058690033198ba01"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="prototype"><file name="modalbox.js" hash="8b25242bc4fa182a8c5a03a17c7d06b2"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="modalbox.css" hash="ec73e146b72c8c7bb1e2baabd7ebeaa2"/></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="modalbox.css" hash="ec73e146b72c8c7bb1e2baabd7ebeaa2"/></dir></dir></dir></dir></target><target name="magemedia"><dir name="."><file name="groupe-afg.png" hash="953f603db2de1d0a7ab16eace11ae94d"/><file name="txt-groupeafg.png" hash="36ca561c5e1698ec435266466d23873f"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>
skin/adminhtml/default/default/modalbox.css ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ modalbox.css
3
+
4
+ Modalbox project
5
+
6
+ Created by Andrew Okonetchnikov.
7
+ Copyright 2006-2010 okonet.ru. All rights reserved.
8
+
9
+ Licensed under MIT license.
10
+ */
11
+
12
+ #MB_overlay {
13
+ position: absolute;
14
+ margin: auto;
15
+ top: 0; left: 0;
16
+ width: 100%; height: 100%;
17
+ z-index: 9999;
18
+ border: 0;
19
+ background-color: #000!important;
20
+ }
21
+ #MB_overlay[id] { position: fixed; }
22
+
23
+ #MB_windowwrapper {
24
+ position:absolute;
25
+ top:0;
26
+ width:100%;
27
+ }
28
+
29
+ #MB_window {
30
+ position:relative;
31
+ margin-left:auto;
32
+ margin-right:auto;
33
+ top:0;
34
+ left:0;
35
+ border: 0 solid;
36
+ text-align: left;
37
+ z-index: 10000;
38
+ }
39
+ #MB_window[id] { position: relative; }
40
+
41
+ #MB_frame {
42
+ position: relative;
43
+ background-color: #EFEFEF;
44
+ height: 100%;
45
+ }
46
+
47
+ #MB_header {
48
+ margin: 0;
49
+ padding: 0;
50
+ }
51
+
52
+ #MB_content {
53
+ position: relative;
54
+ padding: 6px .75em;
55
+ overflow: auto;
56
+ }
57
+
58
+ #MB_caption {
59
+ font: bold 100% "Lucida Grande", Arial, sans-serif;
60
+ text-shadow: #FFF 0 1px 0;
61
+ padding: .5em 2em .5em .75em;
62
+ margin: 0;
63
+ text-align: left;
64
+ }
65
+
66
+ #MB_close {
67
+ display: block;
68
+ position: absolute;
69
+ right: 5px; top: 4px;
70
+ padding: 2px 3px;
71
+ font-weight: bold;
72
+ text-decoration: none;
73
+ font-size: 13px;
74
+ }
75
+ #MB_close:hover {
76
+ background: transparent;
77
+ }
78
+
79
+ #MB_loading {
80
+ padding: 1.5em;
81
+ text-indent: -10000px;
82
+ background: transparent url(spinner.gif) 50% 0 no-repeat;
83
+ }
84
+
85
+ /* Color scheme */
86
+ #MB_window {
87
+ background-color: #EFEFEF;
88
+ color: #000;
89
+
90
+ -webkit-box-shadow: 0 0 64px #000;
91
+ -moz-box-shadow: #000 0 0 64px;
92
+ box-shadow: 0 0 64px #000;
93
+ }
94
+ #MB_frame {
95
+ padding-bottom: 4px;
96
+
97
+ -webkit-border-bottom-left-radius: 4px;
98
+ -webkit-border-bottom-right-radius: 4px;
99
+
100
+ -moz-border-radius-bottomleft: 4px;
101
+ -moz-border-radius-bottomright: 4px;
102
+
103
+ border-bottom-left-radius: 4px;
104
+ border-bottom-right-radius: 4px;
105
+ }
106
+
107
+ #MB_content { border-top: 1px solid #F9F9F9; }
108
+
109
+ #MB_header {
110
+ background-color: #DDD;
111
+ border-bottom: 1px solid #CCC;
112
+ }
113
+ #MB_caption { color: #000 }
114
+ #MB_close { color: #777 }
115
+ #MB_close:hover { color: #000 }
116
+
117
+
118
+ /* Alert message */
119
+ .MB_alert {
120
+ margin: 10px 0;
121
+ text-align: center;
122
+ }
skin/frontend/base/default/css/modalbox.css ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ modalbox.css
3
+
4
+ Modalbox project
5
+
6
+ Created by Andrew Okonetchnikov.
7
+ Copyright 2006-2010 okonet.ru. All rights reserved.
8
+
9
+ Licensed under MIT license.
10
+ */
11
+
12
+ #MB_overlay {
13
+ position: absolute;
14
+ margin: auto;
15
+ top: 0; left: 0;
16
+ width: 100%; height: 100%;
17
+ z-index: 9999;
18
+ border: 0;
19
+ background-color: #000!important;
20
+ }
21
+ #MB_overlay[id] { position: fixed; }
22
+
23
+ #MB_windowwrapper {
24
+ position:absolute;
25
+ top:0;
26
+ width:100%;
27
+ }
28
+
29
+ #MB_window {
30
+ position:relative;
31
+ margin-left:auto;
32
+ margin-right:auto;
33
+ top:0;
34
+ left:0;
35
+ border: 0 solid;
36
+ text-align: left;
37
+ z-index: 10000;
38
+ }
39
+ #MB_window[id] { position: relative; }
40
+
41
+ #MB_frame {
42
+ position: relative;
43
+ background-color: #EFEFEF;
44
+ height: 100%;
45
+ }
46
+
47
+ #MB_header {
48
+ margin: 0;
49
+ padding: 0;
50
+ }
51
+
52
+ #MB_content {
53
+ position: relative;
54
+ padding: 6px .75em;
55
+ overflow: auto;
56
+ }
57
+
58
+ #MB_caption {
59
+ font: bold 100% "Lucida Grande", Arial, sans-serif;
60
+ text-shadow: #FFF 0 1px 0;
61
+ padding: .5em 2em .5em .75em;
62
+ margin: 0;
63
+ text-align: left;
64
+ }
65
+
66
+ #MB_close {
67
+ display: block;
68
+ position: absolute;
69
+ right: 5px; top: 4px;
70
+ padding: 2px 3px;
71
+ font-weight: bold;
72
+ text-decoration: none;
73
+ font-size: 13px;
74
+ }
75
+ #MB_close:hover {
76
+ background: transparent;
77
+ }
78
+
79
+ #MB_loading {
80
+ padding: 1.5em;
81
+ text-indent: -10000px;
82
+ background: transparent url(spinner.gif) 50% 0 no-repeat;
83
+ }
84
+
85
+ /* Color scheme */
86
+ #MB_window {
87
+ background-color: #EFEFEF;
88
+ color: #000;
89
+
90
+ -webkit-box-shadow: 0 0 64px #000;
91
+ -moz-box-shadow: #000 0 0 64px;
92
+ box-shadow: 0 0 64px #000;
93
+ }
94
+ #MB_frame {
95
+ padding-bottom: 4px;
96
+
97
+ -webkit-border-bottom-left-radius: 4px;
98
+ -webkit-border-bottom-right-radius: 4px;
99
+
100
+ -moz-border-radius-bottomleft: 4px;
101
+ -moz-border-radius-bottomright: 4px;
102
+
103
+ border-bottom-left-radius: 4px;
104
+ border-bottom-right-radius: 4px;
105
+ }
106
+
107
+ #MB_content { border-top: 1px solid #F9F9F9; }
108
+
109
+ #MB_header {
110
+ background-color: #DDD;
111
+ border-bottom: 1px solid #CCC;
112
+ }
113
+ #MB_caption { color: #000 }
114
+ #MB_close { color: #777 }
115
+ #MB_close:hover { color: #000 }
116
+
117
+
118
+ /* Alert message */
119
+ .MB_alert {
120
+ margin: 10px 0;
121
+ text-align: center;
122
+ }