Version Notes
This extension adds new CMS content pages to Magento.
You can associate image, thumbnail and PDF file to every new content.
Download this release
Release Info
Developer | Magento Core Team |
Extension | MDWNewsAndTestimonialsExtension |
Version | 1.10 |
Comparing to | |
See all releases |
Version 1.10
- app/code/community/RichardMason/Profile/Block/Adminhtml/Profile.php +25 -0
- app/code/community/RichardMason/Profile/Block/Adminhtml/Profile/Edit.php +92 -0
- app/code/community/RichardMason/Profile/Block/Adminhtml/Profile/Edit/Form.php +28 -0
- app/code/community/RichardMason/Profile/Block/Adminhtml/Profile/Edit/Tab/Main.php +219 -0
- app/code/community/RichardMason/Profile/Block/Adminhtml/Profile/Edit/Tab/Meta.php +119 -0
- app/code/community/RichardMason/Profile/Block/Adminhtml/Profile/Edit/Tabs.php +28 -0
- app/code/community/RichardMason/Profile/Block/Adminhtml/Profile/Grid.php +120 -0
- app/code/community/RichardMason/Profile/Block/Profile.php +69 -0
- app/code/community/RichardMason/Profile/Helper/Data.php +80 -0
- app/code/community/RichardMason/Profile/Model/Mysql4/Profile.php +179 -0
- app/code/community/RichardMason/Profile/Model/Mysql4/Profile/Collection.php +96 -0
- app/code/community/RichardMason/Profile/Model/Profile.php +184 -0
- app/code/community/RichardMason/Profile/Model/Status.php +22 -0
- app/code/community/RichardMason/Profile/controllers/Adminhtml/ProfileController.php +274 -0
- app/code/community/RichardMason/Profile/controllers/IndexController.php +12 -0
- app/code/community/RichardMason/Profile/controllers/NewsController.php +32 -0
- app/code/community/RichardMason/Profile/controllers/PressarticlesController.php +30 -0
- app/code/community/RichardMason/Profile/controllers/PressreleasesController.php +32 -0
- app/code/community/RichardMason/Profile/controllers/TestimonialsController.php +17 -0
- app/code/community/RichardMason/Profile/etc/config.xml +143 -0
- app/code/community/RichardMason/Profile/sql/profile_setup/mysql4-install-0.1.0.php +50 -0
- app/design/adminhtml/default/default/layout/profile.xml +71 -0
- app/design/frontend/default/default/layout/profile.xml +45 -0
- app/design/frontend/default/default/template/profile/news.phtml +36 -0
- app/design/frontend/default/default/template/profile/pressarticles.phtml +131 -0
- app/design/frontend/default/default/template/profile/pressreleases.phtml +37 -0
- app/design/frontend/default/default/template/profile/readnews.phtml +26 -0
- app/design/frontend/default/default/template/profile/readpressrelease.phtml +31 -0
- app/design/frontend/default/default/template/profile/testimonials.phtml +25 -0
- app/etc/modules/RichardMason_Profile.xml +9 -0
- media/profile_examples/a1.jpg +0 -0
- media/profile_examples/a2.jpg +0 -0
- media/profile_examples/a3.jpg +0 -0
- media/profile_examples/a4.jpg +0 -0
- media/profile_examples/a5.jpg +0 -0
- media/profile_examples/article1.jpg +0 -0
- media/profile_examples/article1pic.jpg +0 -0
- media/profile_examples/article2.jpg +0 -0
- media/profile_examples/article2pic.jpg +0 -0
- media/profile_examples/article3.jpg +0 -0
- media/profile_examples/article3pic.jpg +0 -0
- media/profile_examples/article4.jpg +0 -0
- media/profile_examples/article4pic.jpg +0 -0
- media/profile_examples/press1.pdf +0 -0
- media/profile_examples/press2.pdf +0 -0
- media/profile_examples/press3.pdf +0 -0
- media/profile_examples/resized_a1.jpg +0 -0
- media/profile_examples/resized_a2.jpg +0 -0
- media/profile_examples/resized_a3.jpg +0 -0
- media/profile_examples/resized_a4.jpg +0 -0
- media/profile_examples/resized_a5.jpg +0 -0
- package.xml +23 -0
- skin/frontend/default/default/js/modalbox/modalbox.js +515 -0
app/code/community/RichardMason/Profile/Block/Adminhtml/Profile.php
ADDED
@@ -0,0 +1,25 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category RichardMason
|
6 |
+
* @package RichardMason_Profile
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
class RichardMason_Profile_Block_Adminhtml_Profile extends Mage_Adminhtml_Block_Widget_Grid_Container
|
11 |
+
{
|
12 |
+
public function __construct()
|
13 |
+
{
|
14 |
+
$this->_controller = 'adminhtml_profile';
|
15 |
+
$this->_blockGroup = 'profile';
|
16 |
+
|
17 |
+
$this->_headerText = Mage::helper('profile')->getText(Mage::registry('profile_category_id'), '_headerText');
|
18 |
+
parent::__construct();
|
19 |
+
parent::_addButton('add', array(
|
20 |
+
'label' => Mage::helper('profile')->getText(Mage::registry('profile_category_id'), 'New'),
|
21 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/edit', array('category_id' => Mage::registry('profile_category_id'))).'\')',
|
22 |
+
'class' => 'add',
|
23 |
+
));
|
24 |
+
}
|
25 |
+
}
|
app/code/community/RichardMason/Profile/Block/Adminhtml/Profile/Edit.php
ADDED
@@ -0,0 +1,92 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* Part of the code of this file was obtained from:
|
8 |
+
* -category Mage
|
9 |
+
* -package Mage_Adminhtml
|
10 |
+
* -copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
11 |
+
* -license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
*
|
13 |
+
* @category RichardMason
|
14 |
+
* @package RichardMason_Profile
|
15 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
class RichardMason_Profile_Block_Adminhtml_Profile_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
19 |
+
{
|
20 |
+
public function __construct()
|
21 |
+
{
|
22 |
+
$this->_objectId = 'profile_id';
|
23 |
+
$this->_blockGroup = 'profile';
|
24 |
+
$this->_controller = 'adminhtml_profile';
|
25 |
+
|
26 |
+
parent::__construct();
|
27 |
+
|
28 |
+
$url=Mage::registry('profile_profile')->getCategoryUrl(Mage::registry('profile_profile')->getData("category_id"));
|
29 |
+
parent::addButton('back', array(
|
30 |
+
'label' => Mage::helper('adminhtml')->__('Back'),
|
31 |
+
'onclick' => 'setLocation(\'' . $this->getUrl("*/*/".$url."/") . '\')',
|
32 |
+
'class' => 'back',
|
33 |
+
), -1);
|
34 |
+
|
35 |
+
if ($this->_isAllowedAction('save')) {
|
36 |
+
$this->_updateButton('save', 'label', Mage::helper('profile')->__('Save'));
|
37 |
+
$this->_addButton('saveandcontinue', array(
|
38 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
39 |
+
'onclick' => 'saveAndContinueEdit()',
|
40 |
+
'class' => 'save',
|
41 |
+
), -100);
|
42 |
+
} else {
|
43 |
+
$this->_removeButton('save');
|
44 |
+
}
|
45 |
+
|
46 |
+
if ($this->_isAllowedAction('delete')) {
|
47 |
+
$this->_updateButton('delete', 'label', Mage::helper('profile')->__('Delete'));
|
48 |
+
} else {
|
49 |
+
$this->_removeButton('delete');
|
50 |
+
}
|
51 |
+
|
52 |
+
$this->_formScripts[] = "
|
53 |
+
function toggleEditor() {
|
54 |
+
if (tinyMCE.getInstanceById('page_content') == null) {
|
55 |
+
tinyMCE.execCommand('mceAddControl', false, 'content');
|
56 |
+
} else {
|
57 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'content');
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
function saveAndContinueEdit(){
|
62 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
63 |
+
}
|
64 |
+
";
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Retrieve text for header element depending on loaded page
|
69 |
+
*
|
70 |
+
* @return string
|
71 |
+
*/
|
72 |
+
public function getHeaderText()
|
73 |
+
{
|
74 |
+
if (Mage::registry('profile_profile')->getId()) {
|
75 |
+
return Mage::helper('profile')->__("Edit '%s'", $this->htmlEscape(Mage::registry('profile_profile')->getData("content_heading")));
|
76 |
+
}
|
77 |
+
else {
|
78 |
+
return Mage::helper('profile')->getText(Mage::registry('profile_profile')->getData("category_id"), 'New');
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Check permission for passed action
|
84 |
+
*
|
85 |
+
* @param string $action
|
86 |
+
* @return bool
|
87 |
+
*/
|
88 |
+
protected function _isAllowedAction($action)
|
89 |
+
{
|
90 |
+
return Mage::getSingleton('admin/session')->isAllowed('profile/' . $action);
|
91 |
+
}
|
92 |
+
}
|
app/code/community/RichardMason/Profile/Block/Adminhtml/Profile/Edit/Form.php
ADDED
@@ -0,0 +1,28 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* Part of the code of this file was obtained from:
|
8 |
+
* -category Mage
|
9 |
+
* -package Mage_Adminhtml
|
10 |
+
* -copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
11 |
+
* -license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
*
|
13 |
+
* @category RichardMason
|
14 |
+
* @package RichardMason_Profile
|
15 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
class RichardMason_Profile_Block_Adminhtml_Profile_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
19 |
+
{
|
20 |
+
protected function _prepareForm()
|
21 |
+
{
|
22 |
+
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
|
23 |
+
$form->setUseContainer(true);
|
24 |
+
$this->setForm($form);
|
25 |
+
return parent::_prepareForm();
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
app/code/community/RichardMason/Profile/Block/Adminhtml/Profile/Edit/Tab/Main.php
ADDED
@@ -0,0 +1,219 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* Part of the code of this file was obtained from:
|
8 |
+
* -category Mage
|
9 |
+
* -package Mage_Adminhtml
|
10 |
+
* -copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
11 |
+
* -license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
*
|
13 |
+
* @category RichardMason
|
14 |
+
* @package RichardMason_Profile
|
15 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
class RichardMason_Profile_Block_Adminhtml_Profile_Edit_Tab_Main
|
19 |
+
extends Mage_Adminhtml_Block_Widget_Form
|
20 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
21 |
+
{
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Load Wysiwyg on demand and Prepare layout
|
25 |
+
*/
|
26 |
+
protected function _prepareLayout()
|
27 |
+
{
|
28 |
+
parent::_prepareLayout();
|
29 |
+
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
|
30 |
+
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
protected function _prepareForm()
|
35 |
+
{
|
36 |
+
/* @var $model Mage_Cms_Model_Page */
|
37 |
+
$model = Mage::registry('profile_profile');
|
38 |
+
|
39 |
+
/*
|
40 |
+
* Checking if user have permissions to save information
|
41 |
+
*/
|
42 |
+
if ($this->_isAllowedAction('save')) {
|
43 |
+
$isElementDisabled = false;
|
44 |
+
} else {
|
45 |
+
$isElementDisabled = true;
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
$form = new Varien_Data_Form();
|
50 |
+
|
51 |
+
$form->setHtmlIdPrefix('profile_');
|
52 |
+
|
53 |
+
$fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('profile')->__('Content')));
|
54 |
+
|
55 |
+
//profile_id
|
56 |
+
if ($model->getProfileId()) {
|
57 |
+
$fieldset->addField('profile_id', 'hidden', array(
|
58 |
+
'name' => 'profile_id',
|
59 |
+
));
|
60 |
+
}
|
61 |
+
//category_id
|
62 |
+
$fieldset->addField('category_id', 'hidden', array(
|
63 |
+
'name' => 'category_id',
|
64 |
+
));
|
65 |
+
//head of content
|
66 |
+
$fieldset->addField('content_heading', 'text', array(
|
67 |
+
'name' => 'content_heading',
|
68 |
+
'label' => Mage::helper('profile')->getText($model->getData("category_id"),'content_heading'),
|
69 |
+
'title' => Mage::helper('profile')->getText($model->getData("category_id"),'content_heading'),
|
70 |
+
'disabled' => $isElementDisabled
|
71 |
+
));
|
72 |
+
$dateFormatIso = Mage::app()->getLocale()->getDateFormat(
|
73 |
+
Mage_Core_Model_Locale::FORMAT_TYPE_SHORT
|
74 |
+
);
|
75 |
+
$fieldset->addField('creation_time', 'date', array(
|
76 |
+
'name' => 'creation_time',
|
77 |
+
'label' => Mage::helper('profile')->__('Date'),
|
78 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
79 |
+
'format' => $dateFormatIso
|
80 |
+
));
|
81 |
+
|
82 |
+
if($model->getData("category_id") != RichardMason_Profile_Model_Profile::CATEGORY_TESTIMONIALS) {
|
83 |
+
$fieldset->addField('thumbnail', 'image', array(
|
84 |
+
'label' => Mage::helper('profile')->__('Thumbnail (Max. 90x90px)'),
|
85 |
+
'required' => false,
|
86 |
+
'name' => 'thumbnail',
|
87 |
+
));
|
88 |
+
|
89 |
+
$fieldset->addField('thumbnail_position', 'select', array(
|
90 |
+
'label' => Mage::helper('profile')->__('Thumbnail Position'),
|
91 |
+
'title' => Mage::helper('profile')->__('Thumbnail Position'),
|
92 |
+
'name' => 'thumbnail_position',
|
93 |
+
'required' => true,
|
94 |
+
'options' => $model->getAvailableThumbnailPositions()
|
95 |
+
));
|
96 |
+
}
|
97 |
+
|
98 |
+
if($model->getData("category_id") == RichardMason_Profile_Model_Profile::CATEGORY_ARTICLES) {
|
99 |
+
$fieldset->addField('picture', 'image', array(
|
100 |
+
'label' => Mage::helper('profile')->__('Picture'),
|
101 |
+
'required' => false,
|
102 |
+
'name' => 'picture',
|
103 |
+
));
|
104 |
+
}
|
105 |
+
|
106 |
+
if($model->getData("category_id") == RichardMason_Profile_Model_Profile::CATEGORY_RELEASES) {
|
107 |
+
$fieldset->addField('file', 'image', array(
|
108 |
+
'label' => Mage::helper('profile')->__('PDF File'),
|
109 |
+
'required' => false,
|
110 |
+
'name' => 'file',
|
111 |
+
));
|
112 |
+
}
|
113 |
+
|
114 |
+
$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(
|
115 |
+
array('tab_id' => $this->getTabId())
|
116 |
+
);
|
117 |
+
$contentField = $fieldset->addField('content', 'editor', array(
|
118 |
+
'name' => 'content',
|
119 |
+
'style' => 'height:20em; width:50em;',
|
120 |
+
'required' => true,
|
121 |
+
'disabled' => $isElementDisabled,
|
122 |
+
'config' => $wysiwygConfig
|
123 |
+
));
|
124 |
+
// Setting custom renderer for content field to remove label column
|
125 |
+
$renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element')
|
126 |
+
->setTemplate('cms/page/edit/form/renderer/content.phtml');
|
127 |
+
$contentField->setRenderer($renderer);
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Check is single store mode
|
131 |
+
*/
|
132 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
133 |
+
$fieldset->addField('store_id', 'multiselect', array(
|
134 |
+
'name' => 'stores[]',
|
135 |
+
'label' => Mage::helper('cms')->__('Store View'),
|
136 |
+
'title' => Mage::helper('cms')->__('Store View'),
|
137 |
+
'required' => true,
|
138 |
+
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
|
139 |
+
'disabled' => $isElementDisabled
|
140 |
+
));
|
141 |
+
}
|
142 |
+
else {
|
143 |
+
$fieldset->addField('store_id', 'hidden', array(
|
144 |
+
'name' => 'stores[]',
|
145 |
+
'value' => Mage::app()->getStore(true)->getId()
|
146 |
+
));
|
147 |
+
$model->setStoreId(Mage::app()->getStore(true)->getId());
|
148 |
+
}
|
149 |
+
|
150 |
+
$fieldset->addField('is_active', 'select', array(
|
151 |
+
'label' => Mage::helper('profile')->__('Status'),
|
152 |
+
'title' => Mage::helper('profile')->__('Status'),
|
153 |
+
'name' => 'is_active',
|
154 |
+
'required' => true,
|
155 |
+
'options' => $model->getAvailableStatuses(),
|
156 |
+
'disabled' => $isElementDisabled,
|
157 |
+
));
|
158 |
+
if (!$model->getId()) {
|
159 |
+
$model->setData('is_active', $isElementDisabled ? '0' : '1');
|
160 |
+
}
|
161 |
+
|
162 |
+
Mage::dispatchEvent('adminhtml_profile_edit_tab_main_prepare_form', array('form' => $form));
|
163 |
+
$form->setValues($model->getData());
|
164 |
+
$this->setForm($form);
|
165 |
+
|
166 |
+
return parent::_prepareForm();
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Prepare label for tab
|
171 |
+
*
|
172 |
+
* @return string
|
173 |
+
*/
|
174 |
+
public function getTabLabel()
|
175 |
+
{
|
176 |
+
return Mage::helper('profile')->__('Content');
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Prepare title for tab
|
181 |
+
*
|
182 |
+
* @return string
|
183 |
+
*/
|
184 |
+
public function getTabTitle()
|
185 |
+
{
|
186 |
+
return Mage::helper('profile')->__('Content');
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Returns status flag about this tab can be shown or not
|
191 |
+
*
|
192 |
+
* @return true
|
193 |
+
*/
|
194 |
+
public function canShowTab()
|
195 |
+
{
|
196 |
+
return true;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Returns status flag about this tab hidden or not
|
201 |
+
*
|
202 |
+
* @return true
|
203 |
+
*/
|
204 |
+
public function isHidden()
|
205 |
+
{
|
206 |
+
return false;
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Check permission for passed action
|
211 |
+
*
|
212 |
+
* @param string $action
|
213 |
+
* @return bool
|
214 |
+
*/
|
215 |
+
protected function _isAllowedAction($action)
|
216 |
+
{
|
217 |
+
return Mage::getSingleton('admin/session')->isAllowed('profile/' . $action);
|
218 |
+
}
|
219 |
+
}
|
app/code/community/RichardMason/Profile/Block/Adminhtml/Profile/Edit/Tab/Meta.php
ADDED
@@ -0,0 +1,119 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* Part of the code of this file was obtained from:
|
8 |
+
* -category Mage
|
9 |
+
* -package Mage_Adminhtml
|
10 |
+
* -copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
11 |
+
* -license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
*
|
13 |
+
* @category RichardMason
|
14 |
+
* @package RichardMason_Profile
|
15 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
class RichardMason_Profile_Block_Adminhtml_Profile_Edit_Tab_Meta
|
19 |
+
extends Mage_Adminhtml_Block_Widget_Form
|
20 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
21 |
+
{
|
22 |
+
public function __construct()
|
23 |
+
{
|
24 |
+
parent::__construct();
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function _prepareForm()
|
28 |
+
{
|
29 |
+
/*
|
30 |
+
* Checking if user have permissions to save information
|
31 |
+
*/
|
32 |
+
if ($this->_isAllowedAction('save')) {
|
33 |
+
$isElementDisabled = false;
|
34 |
+
} else {
|
35 |
+
$isElementDisabled = true;
|
36 |
+
}
|
37 |
+
|
38 |
+
$form = new Varien_Data_Form();
|
39 |
+
|
40 |
+
$form->setHtmlIdPrefix('page_');
|
41 |
+
|
42 |
+
$model = Mage::registry('profile_profile');
|
43 |
+
|
44 |
+
$fieldset = $form->addFieldset('meta_fieldset', array('legend' => Mage::helper('profile')->__('Meta Data'), 'class' => 'fieldset-wide'));
|
45 |
+
|
46 |
+
$fieldset->addField('meta_keywords', 'textarea', array(
|
47 |
+
'name' => 'meta_keywords',
|
48 |
+
'label' => Mage::helper('profile')->__('Keywords'),
|
49 |
+
'title' => Mage::helper('profile')->__('Meta Keywords'),
|
50 |
+
'disabled' => $isElementDisabled
|
51 |
+
));
|
52 |
+
|
53 |
+
$fieldset->addField('meta_description', 'textarea', array(
|
54 |
+
'name' => 'meta_description',
|
55 |
+
'label' => Mage::helper('profile')->__('Description'),
|
56 |
+
'title' => Mage::helper('profile')->__('Meta Description'),
|
57 |
+
'disabled' => $isElementDisabled
|
58 |
+
));
|
59 |
+
|
60 |
+
Mage::dispatchEvent('adminhtml_profile_edit_tab_meta_prepare_form', array('form' => $form));
|
61 |
+
|
62 |
+
$form->setValues($model->getData());
|
63 |
+
|
64 |
+
$this->setForm($form);
|
65 |
+
|
66 |
+
return parent::_prepareForm();
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Prepare label for tab
|
71 |
+
*
|
72 |
+
* @return string
|
73 |
+
*/
|
74 |
+
public function getTabLabel()
|
75 |
+
{
|
76 |
+
return Mage::helper('profile')->__('Meta Data');
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Prepare title for tab
|
81 |
+
*
|
82 |
+
* @return string
|
83 |
+
*/
|
84 |
+
public function getTabTitle()
|
85 |
+
{
|
86 |
+
return Mage::helper('profile')->__('Meta Data');
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Returns status flag about this tab can be showen or not
|
91 |
+
*
|
92 |
+
* @return true
|
93 |
+
*/
|
94 |
+
public function canShowTab()
|
95 |
+
{
|
96 |
+
return true;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Returns status flag about this tab hidden or not
|
101 |
+
*
|
102 |
+
* @return true
|
103 |
+
*/
|
104 |
+
public function isHidden()
|
105 |
+
{
|
106 |
+
return false;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Check permission for passed action
|
111 |
+
*
|
112 |
+
* @param string $action
|
113 |
+
* @return bool
|
114 |
+
*/
|
115 |
+
protected function _isAllowedAction($action)
|
116 |
+
{
|
117 |
+
return Mage::getSingleton('admin/session')->isAllowed('profile/' . $action);
|
118 |
+
}
|
119 |
+
}
|
app/code/community/RichardMason/Profile/Block/Adminhtml/Profile/Edit/Tabs.php
ADDED
@@ -0,0 +1,28 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* Part of the code of this file was obtained from:
|
8 |
+
* -category Mage
|
9 |
+
* -package Mage_Adminhtml
|
10 |
+
* -copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
11 |
+
* -license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
*
|
13 |
+
* @category RichardMason
|
14 |
+
* @package RichardMason_Profile
|
15 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
class RichardMason_Profile_Block_Adminhtml_Profile_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
19 |
+
{
|
20 |
+
public function __construct()
|
21 |
+
{
|
22 |
+
parent::__construct();
|
23 |
+
$this->setId('profiles_tabs');
|
24 |
+
$this->setDestElementId('edit_form');
|
25 |
+
$this->setTitle(Mage::helper('profile')->__('Information'));
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
app/code/community/RichardMason/Profile/Block/Adminhtml/Profile/Grid.php
ADDED
@@ -0,0 +1,120 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* Part of the code of this file was obtained from:
|
8 |
+
* -category Mage
|
9 |
+
* -package Mage_Adminhtml
|
10 |
+
* -copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
11 |
+
* -license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
*
|
13 |
+
* @category RichardMason
|
14 |
+
* @package RichardMason_Profile
|
15 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
class RichardMason_Profile_Block_Adminhtml_Profile_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
19 |
+
{
|
20 |
+
public function __construct()
|
21 |
+
{
|
22 |
+
parent::__construct();
|
23 |
+
$this->setId('profileBlockGrid');
|
24 |
+
$this->setDefaultSort('profile_id');
|
25 |
+
$this->setDefaultDir('ASC');
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function _prepareCollection()
|
29 |
+
{
|
30 |
+
$collection = Mage::getModel('profile/profile')->getCollection();
|
31 |
+
$collection->addFieldToFilter('category_id', Mage::registry('profile_category_id'));
|
32 |
+
/* @var $collection Mage_Cms_Model_Mysql4_Block_Collection */
|
33 |
+
$this->setCollection($collection);
|
34 |
+
return parent::_prepareCollection();
|
35 |
+
}
|
36 |
+
|
37 |
+
protected function _prepareColumns()
|
38 |
+
{
|
39 |
+
$baseUrl = $this->getUrl();
|
40 |
+
|
41 |
+
$this->addColumn('content_heading', array(
|
42 |
+
'header' => Mage::helper('profile')->getText(Mage::registry('profile_category_id'),'content_heading'),
|
43 |
+
'align' => 'left',
|
44 |
+
'index' => 'content_heading'
|
45 |
+
));
|
46 |
+
|
47 |
+
/*
|
48 |
+
if(Mage::registry('profile_category_id') != RichardMason_Profile_Model_Profile::CATEGORY_RELEASES) {
|
49 |
+
$this->addColumn('content', array(
|
50 |
+
'header' => Mage::helper('profile')->getText(Mage::registry('profile_category_id'),'content'),
|
51 |
+
'align' => 'left',
|
52 |
+
'index' => 'content'
|
53 |
+
));
|
54 |
+
}
|
55 |
+
*/
|
56 |
+
|
57 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
58 |
+
$this->addColumn('store_id', array(
|
59 |
+
'header' => Mage::helper('profile')->__('Store View'),
|
60 |
+
'index' => 'store_id',
|
61 |
+
'type' => 'store',
|
62 |
+
'store_all' => true,
|
63 |
+
'store_view' => true,
|
64 |
+
'sortable' => false,
|
65 |
+
'filter_condition_callback'
|
66 |
+
=> array($this, '_filterStoreCondition'),
|
67 |
+
));
|
68 |
+
}
|
69 |
+
|
70 |
+
$this->addColumn('is_active', array(
|
71 |
+
'header' => Mage::helper('profile')->__('Status'),
|
72 |
+
'index' => 'is_active',
|
73 |
+
'type' => 'options',
|
74 |
+
'options' => array(
|
75 |
+
0 => Mage::helper('profile')->__('Disabled'),
|
76 |
+
1 => Mage::helper('profile')->__('Enabled')
|
77 |
+
),
|
78 |
+
));
|
79 |
+
|
80 |
+
$this->addColumn('creation_time', array(
|
81 |
+
'header' => Mage::helper('profile')->__('Date Created'),
|
82 |
+
'index' => 'creation_time',
|
83 |
+
'type' => 'datetime',
|
84 |
+
));
|
85 |
+
|
86 |
+
$this->addColumn('update_time', array(
|
87 |
+
'header' => Mage::helper('profile')->__('Last Modified'),
|
88 |
+
'index' => 'update_time',
|
89 |
+
'type' => 'datetime',
|
90 |
+
));
|
91 |
+
|
92 |
+
return parent::_prepareColumns();
|
93 |
+
}
|
94 |
+
|
95 |
+
protected function _afterLoadCollection()
|
96 |
+
{
|
97 |
+
$this->getCollection()->walk('afterLoad');
|
98 |
+
parent::_afterLoadCollection();
|
99 |
+
}
|
100 |
+
|
101 |
+
protected function _filterStoreCondition($collection, $column)
|
102 |
+
{
|
103 |
+
if (!$value = $column->getFilter()->getValue()) {
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
|
107 |
+
$this->getCollection()->addStoreFilter($value);
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Row click url
|
112 |
+
*
|
113 |
+
* @return string
|
114 |
+
*/
|
115 |
+
public function getRowUrl($row)
|
116 |
+
{
|
117 |
+
return $this->getUrl('*/*/edit', array('profile_id' => $row->getId(), 'category_id' => Mage::registry('profile_category_id') ));
|
118 |
+
}
|
119 |
+
|
120 |
+
}
|
app/code/community/RichardMason/Profile/Block/Profile.php
ADDED
@@ -0,0 +1,69 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* Part of the code of this file was obtained from:
|
8 |
+
* -category Mage
|
9 |
+
* -package Mage_Adminhtml
|
10 |
+
* -copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
11 |
+
* -license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
*
|
13 |
+
* @category RichardMason
|
14 |
+
* @package RichardMason_Profile
|
15 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
class RichardMason_Profile_Block_Profile extends Mage_Core_Block_Template
|
19 |
+
{
|
20 |
+
public function _prepareLayout(){
|
21 |
+
return parent::_prepareLayout();
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getNews(){
|
25 |
+
return $this->getProfiles(RichardMason_Profile_Model_Profile::CATEGORY_NEWS);
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getTestimonials(){
|
29 |
+
return $this->getProfiles(RichardMason_Profile_Model_Profile::CATEGORY_TESTIMONIALS);
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getPressarticles(){
|
33 |
+
return $this->getProfiles(RichardMason_Profile_Model_Profile::CATEGORY_ARTICLES);
|
34 |
+
}
|
35 |
+
|
36 |
+
public function getPressreleases(){
|
37 |
+
return $this->getProfiles(RichardMason_Profile_Model_Profile::CATEGORY_RELEASES);
|
38 |
+
}
|
39 |
+
|
40 |
+
/*
|
41 |
+
* Return a collection of profiles.
|
42 |
+
* @param category_id is the category of profile.
|
43 |
+
* @return Collection of Profile Model
|
44 |
+
*/
|
45 |
+
public function getProfiles($category_id) {
|
46 |
+
$profiles = Mage::getModel('profile/profile')->getCollection()
|
47 |
+
->addStoreFilter(Mage::app()->getStore()->getId());
|
48 |
+
$profiles->addFieldToFilter('category_id', $category_id);
|
49 |
+
$profiles->setOrder("creation_time", "DESC");
|
50 |
+
return $profiles;
|
51 |
+
}
|
52 |
+
|
53 |
+
/*
|
54 |
+
* Return a specific profile.
|
55 |
+
* @param GET or POST "id"
|
56 |
+
* @return Profile model class
|
57 |
+
*/
|
58 |
+
public function getProfile(){
|
59 |
+
if($profile_id = $this->getRequest()->getParam('id')){
|
60 |
+
if($profile_id != null && $profile_id != ''){
|
61 |
+
$profile = Mage::getModel('profile/profile')->load($profile_id);
|
62 |
+
} else {
|
63 |
+
$profile = null;
|
64 |
+
}
|
65 |
+
$this->setData('profile', $profile);
|
66 |
+
}
|
67 |
+
return $this->getData('profile');
|
68 |
+
}
|
69 |
+
}
|
app/code/community/RichardMason/Profile/Helper/Data.php
ADDED
@@ -0,0 +1,80 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category RichardMason
|
6 |
+
* @package RichardMason_Profile
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
class RichardMason_Profile_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
+
|
13 |
+
public function getText($category_id, $text){
|
14 |
+
switch ($text) {
|
15 |
+
case "New":
|
16 |
+
switch ($category_id) {
|
17 |
+
case 0:
|
18 |
+
return $this->__('Add a News Article');
|
19 |
+
case 1:
|
20 |
+
return $this->__('Add a Testimonial');
|
21 |
+
case 2:
|
22 |
+
return $this->__('Add a Press Release');
|
23 |
+
case 3:
|
24 |
+
return $this->__('Add a Press Article');
|
25 |
+
|
26 |
+
}
|
27 |
+
break;
|
28 |
+
case "_headerText":
|
29 |
+
switch ($category_id) {
|
30 |
+
case 0:
|
31 |
+
return $this->__('News Manager');
|
32 |
+
case 1:
|
33 |
+
return $this->__('Testimonials Manager');
|
34 |
+
case 2:
|
35 |
+
return $this->__('Press Releases Manager');
|
36 |
+
case 3:
|
37 |
+
return $this->__('Press Articles Manager');
|
38 |
+
|
39 |
+
}
|
40 |
+
break;
|
41 |
+
case "content_heading":
|
42 |
+
switch ($category_id) {
|
43 |
+
case 0:
|
44 |
+
return $this->__('Heading');
|
45 |
+
case 1:
|
46 |
+
return $this->__('Name');
|
47 |
+
case 2:
|
48 |
+
return $this->__('Title');
|
49 |
+
case 3:
|
50 |
+
return $this->__('Title');
|
51 |
+
|
52 |
+
}
|
53 |
+
break;
|
54 |
+
case "content":
|
55 |
+
switch ($category_id) {
|
56 |
+
case 0:
|
57 |
+
return $this->__('Content');
|
58 |
+
case 1:
|
59 |
+
return $this->__('Quote');
|
60 |
+
case 2:
|
61 |
+
return $this->__('Quote');
|
62 |
+
case 3:
|
63 |
+
return $this->__('Quote');
|
64 |
+
|
65 |
+
}
|
66 |
+
break;
|
67 |
+
case "thumbnail":
|
68 |
+
switch ($category_id) {
|
69 |
+
case 0:
|
70 |
+
return $this->__('Thumbnail (Max. 90x90px)');
|
71 |
+
case 1:
|
72 |
+
case 2:
|
73 |
+
case 3:
|
74 |
+
return $this->__('Thumbnail (Max. 100x130px)');
|
75 |
+
|
76 |
+
}
|
77 |
+
break;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
app/code/community/RichardMason/Profile/Model/Mysql4/Profile.php
ADDED
@@ -0,0 +1,179 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* Part of the code of this file was obtained from:
|
8 |
+
* -category Mage
|
9 |
+
* -package Mage_Adminhtml
|
10 |
+
* -copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
11 |
+
* -license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
*
|
13 |
+
* @category RichardMason
|
14 |
+
* @package RichardMason_Profile
|
15 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
class RichardMason_Profile_Model_Mysql4_Profile extends Mage_Core_Model_Mysql4_Abstract
|
19 |
+
{
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Store model
|
23 |
+
*
|
24 |
+
* @var null|Mage_Core_Model_Store
|
25 |
+
*/
|
26 |
+
protected $_store = null;
|
27 |
+
|
28 |
+
|
29 |
+
public function _construct()
|
30 |
+
{
|
31 |
+
// Note that the profiles_id refers to the key field in your database table.
|
32 |
+
$this->_init('profile/profile', 'profile_id');
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Process page data before saving
|
37 |
+
*
|
38 |
+
* @param Mage_Core_Model_Abstract $object
|
39 |
+
*/
|
40 |
+
protected function _beforeSave(Mage_Core_Model_Abstract $object)
|
41 |
+
{
|
42 |
+
|
43 |
+
if (! $object->getId() && $object->getCreationTime() == "") {
|
44 |
+
$object->setCreationTime(Mage::getSingleton('core/date')->gmtDate());
|
45 |
+
}
|
46 |
+
|
47 |
+
$format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
|
48 |
+
if ($date = $object->getData('creation_time')) {
|
49 |
+
$object->setData('creation_time', Mage::app()->getLocale()->date($date, $format, null, false)
|
50 |
+
->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
|
51 |
+
);
|
52 |
+
}
|
53 |
+
$object->setUpdateTime(Mage::getSingleton('core/date')->gmtDate());
|
54 |
+
|
55 |
+
return $this;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
*
|
60 |
+
* @param Mage_Core_Model_Abstract $object
|
61 |
+
*/
|
62 |
+
protected function _afterLoad(Mage_Core_Model_Abstract $object)
|
63 |
+
{
|
64 |
+
$select = $this->_getReadAdapter()->select()
|
65 |
+
->from($this->getTable('profile/profile_store'))
|
66 |
+
->where('profile_id = ?', $object->getId());
|
67 |
+
|
68 |
+
if ($data = $this->_getReadAdapter()->fetchAll($select)) {
|
69 |
+
$storesArray = array();
|
70 |
+
foreach ($data as $row) {
|
71 |
+
$storesArray[] = $row['store_id'];
|
72 |
+
}
|
73 |
+
$object->setData('store_id', $storesArray);
|
74 |
+
}
|
75 |
+
|
76 |
+
return parent::_afterLoad($object);
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Assign page to store views
|
81 |
+
*
|
82 |
+
* @param Mage_Core_Model_Abstract $object
|
83 |
+
*/
|
84 |
+
protected function _afterSave(Mage_Core_Model_Abstract $object)
|
85 |
+
{
|
86 |
+
$condition = $this->_getWriteAdapter()->quoteInto('profile_id = ?', $object->getId());
|
87 |
+
$this->_getWriteAdapter()->delete($this->getTable('profile/profile_store'), $condition);
|
88 |
+
|
89 |
+
foreach ((array)$object->getData('stores') as $store) {
|
90 |
+
$storeArray = array();
|
91 |
+
$storeArray['profile_id'] = $object->getId();
|
92 |
+
$storeArray['store_id'] = $store;
|
93 |
+
$this->_getWriteAdapter()->insert($this->getTable('profile/profile_store'), $storeArray);
|
94 |
+
}
|
95 |
+
|
96 |
+
return parent::_afterSave($object);
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Retrieve select object for load object data
|
101 |
+
*
|
102 |
+
* @param string $field
|
103 |
+
* @param mixed $value
|
104 |
+
* @return Zend_Db_Select
|
105 |
+
*/
|
106 |
+
protected function _getLoadSelect($field, $value, $object)
|
107 |
+
{
|
108 |
+
$select = parent::_getLoadSelect($field, $value, $object);
|
109 |
+
|
110 |
+
if ($object->getStoreId()) {
|
111 |
+
$select->join(
|
112 |
+
array('cps' => $this->getTable('profile/profile_store')),
|
113 |
+
$this->getMainTable().'.profile_id = `cps`.profile_id'
|
114 |
+
)
|
115 |
+
->where('is_active=1 AND `cps`.store_id in (' . Mage_Core_Model_App::ADMIN_STORE_ID . ', ?) ', $object->getStoreId())
|
116 |
+
->order('store_id DESC')
|
117 |
+
->limit(1);
|
118 |
+
}
|
119 |
+
return $select;
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Check if page identifier exist for specific store
|
124 |
+
* return page id if page exists
|
125 |
+
*
|
126 |
+
* @param string $identifier
|
127 |
+
* @param int $storeId
|
128 |
+
* @return int
|
129 |
+
*/
|
130 |
+
public function checkIdentifier($profile_id, $storeId)
|
131 |
+
{
|
132 |
+
$select = $this->_getReadAdapter()->select()->from(array('main_table'=>$this->getMainTable()), 'profile_id')
|
133 |
+
->join(
|
134 |
+
array('cps' => $this->getTable('profile/profile_store')),
|
135 |
+
'main_table.profile_id = `cps`.profile_id'
|
136 |
+
)
|
137 |
+
->where('main_table.profile_id=?', $profile_id)
|
138 |
+
->where('main_table.is_active=1 AND `cps`.store_id in (' . Mage_Core_Model_App::ADMIN_STORE_ID . ', ?) ', $storeId)
|
139 |
+
->order('store_id DESC');
|
140 |
+
|
141 |
+
return $this->_getReadAdapter()->fetchOne($select);
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Get store ids to which specified item is assigned
|
146 |
+
*
|
147 |
+
* @param int $id
|
148 |
+
* @return array
|
149 |
+
*/
|
150 |
+
public function lookupStoreIds($id)
|
151 |
+
{
|
152 |
+
return $this->_getReadAdapter()->fetchCol($this->_getReadAdapter()->select()
|
153 |
+
->from($this->getTable('profile/profile_store'), 'store_id')
|
154 |
+
->where("{$this->getIdFieldName()} = ?", $id)
|
155 |
+
);
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Set store model
|
160 |
+
*
|
161 |
+
* @param Mage_Core_Model_Store $store
|
162 |
+
* @return Mage_Cms_Model_Mysql4_Page
|
163 |
+
*/
|
164 |
+
public function setStore($store)
|
165 |
+
{
|
166 |
+
$this->_store = $store;
|
167 |
+
return $this;
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Retrieve store model
|
172 |
+
*
|
173 |
+
* @return Mage_Core_Model_Store
|
174 |
+
*/
|
175 |
+
public function getStore()
|
176 |
+
{
|
177 |
+
return Mage::app()->getStore($this->_store);
|
178 |
+
}
|
179 |
+
}
|
app/code/community/RichardMason/Profile/Model/Mysql4/Profile/Collection.php
ADDED
@@ -0,0 +1,96 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* Part of the code of this file was obtained from:
|
8 |
+
* -category Mage
|
9 |
+
* -package Mage_Adminhtml
|
10 |
+
* -copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
11 |
+
* -license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
*
|
13 |
+
* @category RichardMason
|
14 |
+
* @package RichardMason_Profile
|
15 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
class RichardMason_Profile_Model_Mysql4_Profile_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
19 |
+
{
|
20 |
+
|
21 |
+
protected $_previewFlag;
|
22 |
+
|
23 |
+
public function _construct()
|
24 |
+
{
|
25 |
+
parent::_construct();
|
26 |
+
$this->_init('profile/profile');
|
27 |
+
|
28 |
+
$this->_map['fields']['profile_id'] = 'main_table.profile_id';
|
29 |
+
}
|
30 |
+
|
31 |
+
public function setFirstStoreFlag($flag = false)
|
32 |
+
{
|
33 |
+
$this->_previewFlag = $flag;
|
34 |
+
return $this;
|
35 |
+
}
|
36 |
+
|
37 |
+
protected function _afterLoad()
|
38 |
+
{
|
39 |
+
if ($this->_previewFlag) {
|
40 |
+
$items = $this->getColumnValues('profile_id');
|
41 |
+
if (count($items)) {
|
42 |
+
$select = $this->getConnection()->select()
|
43 |
+
->from($this->getTable('profile/profile_store'))
|
44 |
+
->where($this->getTable('profile/profile_store').'.profile_id IN (?)', $items);
|
45 |
+
if ($result = $this->getConnection()->fetchPairs($select)) {
|
46 |
+
foreach ($this as $item) {
|
47 |
+
if (!isset($result[$item->getData('profile_id')])) {
|
48 |
+
continue;
|
49 |
+
}
|
50 |
+
if ($result[$item->getData('profile_id')] == 0) {
|
51 |
+
$stores = Mage::app()->getStores(false, true);
|
52 |
+
$storeId = current($stores)->getId();
|
53 |
+
$storeCode = key($stores);
|
54 |
+
} else {
|
55 |
+
$storeId = $result[$item->getData('profile_id')];
|
56 |
+
$storeCode = Mage::app()->getStore($storeId)->getCode();
|
57 |
+
}
|
58 |
+
$item->setData('_first_store_id', $storeId);
|
59 |
+
$item->setData('store_code', $storeCode);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
parent::_afterLoad();
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Add Filter by store
|
71 |
+
*
|
72 |
+
* @param int|Mage_Core_Model_Store $store
|
73 |
+
* @return Mage_Cms_Model_Mysql4_Page_Collection
|
74 |
+
*/
|
75 |
+
public function addStoreFilter($store, $withAdmin = true)
|
76 |
+
{
|
77 |
+
if (!$this->getFlag('store_filter_added')) {
|
78 |
+
if ($store instanceof Mage_Core_Model_Store) {
|
79 |
+
$store = array($store->getId());
|
80 |
+
}
|
81 |
+
|
82 |
+
$this->getSelect()->join(
|
83 |
+
array('store_table' => $this->getTable('profile/profile_store')),
|
84 |
+
'main_table.profile_id = store_table.profile_id',
|
85 |
+
array()
|
86 |
+
)
|
87 |
+
->where('store_table.store_id in (?)', ($withAdmin ? array(0, $store) : $store))
|
88 |
+
->group('main_table.profile_id');
|
89 |
+
|
90 |
+
$this->setFlag('store_filter_added', true);
|
91 |
+
}
|
92 |
+
|
93 |
+
return $this;
|
94 |
+
}
|
95 |
+
|
96 |
+
}
|
app/code/community/RichardMason/Profile/Model/Profile.php
ADDED
@@ -0,0 +1,184 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category RichardMason
|
6 |
+
* @package RichardMason_Profile
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
class RichardMason_Profile_Model_Profile extends Mage_Core_Model_Abstract
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Profile's Statuses
|
14 |
+
*/
|
15 |
+
const STATUS_ENABLED = 1;
|
16 |
+
const STATUS_DISABLED = 0;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Thumbnail's positions
|
20 |
+
*/
|
21 |
+
const THUMBNAIL_LEFT = 0;
|
22 |
+
const THUMBNAIL_RIGHT = 1;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Profile's Categories
|
26 |
+
*/
|
27 |
+
const CATEGORY_NEWS = 0;
|
28 |
+
const CATEGORY_TESTIMONIALS = 1;
|
29 |
+
const CATEGORY_RELEASES = 2;
|
30 |
+
const CATEGORY_ARTICLES = 3;
|
31 |
+
|
32 |
+
public function _construct()
|
33 |
+
{
|
34 |
+
parent::_construct();
|
35 |
+
$this->_init('profile/profile');
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Prepare profile thumbnail positions.
|
41 |
+
*
|
42 |
+
* @return array
|
43 |
+
*/
|
44 |
+
public function getAvailableThumbnailPositions()
|
45 |
+
{
|
46 |
+
$statuses = new Varien_Object(array(
|
47 |
+
self::THUMBNAIL_LEFT => Mage::helper('profile')->__('Left'),
|
48 |
+
self::THUMBNAIL_RIGHT => Mage::helper('profile')->__('Right'),
|
49 |
+
));
|
50 |
+
|
51 |
+
Mage::dispatchEvent('profile_get_available_statuses', array('statuses' => $statuses));
|
52 |
+
|
53 |
+
return $statuses->getData();
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Prepare profile's statuses.
|
59 |
+
* Available event cms_page_get_available_statuses to customize statuses.
|
60 |
+
*
|
61 |
+
* @return array
|
62 |
+
*/
|
63 |
+
public function getAvailableStatuses()
|
64 |
+
{
|
65 |
+
$statuses = new Varien_Object(array(
|
66 |
+
self::STATUS_ENABLED => Mage::helper('profile')->__('Enabled'),
|
67 |
+
self::STATUS_DISABLED => Mage::helper('profile')->__('Disabled'),
|
68 |
+
));
|
69 |
+
|
70 |
+
Mage::dispatchEvent('profile_get_available_statuses', array('statuses' => $statuses));
|
71 |
+
|
72 |
+
return $statuses->getData();
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Get the align position of the Thumnail picture
|
77 |
+
*/
|
78 |
+
public function getThumbnailAlign()
|
79 |
+
{
|
80 |
+
switch($this->getData("thumbnail_position")){
|
81 |
+
case self::THUMBNAIL_LEFT:
|
82 |
+
return "left";
|
83 |
+
case self::THUMBNAIL_RIGHT:
|
84 |
+
return "right";
|
85 |
+
}
|
86 |
+
return "";
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Return the URL of the Thumbnail new image resized to the params.
|
91 |
+
*
|
92 |
+
* @param $with With of the resized image
|
93 |
+
* @param $height Height of the resized image (Default: null)
|
94 |
+
* @return the Url of the new resized image.
|
95 |
+
*/
|
96 |
+
public function getThumbnailResize($with, $height = null) {
|
97 |
+
// actual path of image
|
98 |
+
$imageUrl = Mage::getBaseDir('media').DS.$this->getData("thumbnail");
|
99 |
+
|
100 |
+
// path of the resized image to be saved
|
101 |
+
// here, the resized image is saved in media/resized folder
|
102 |
+
$imageResized = Mage::getBaseDir('media').DS."resized_".$this->getData("thumbnail");
|
103 |
+
|
104 |
+
// resize image only if the image file exists and the resized image file doesn't exist
|
105 |
+
// the image is resized proportionally with the width/height 135px
|
106 |
+
if (!file_exists($imageResized)&&file_exists($imageUrl)) {
|
107 |
+
$imageObj = new Varien_Image($imageUrl);
|
108 |
+
$imageObj->constrainOnly(TRUE);
|
109 |
+
$imageObj->keepAspectRatio(TRUE);
|
110 |
+
$imageObj->keepFrame(FALSE);
|
111 |
+
$imageObj->resize($with, $height);
|
112 |
+
$imageObj->save($imageResized);
|
113 |
+
}
|
114 |
+
return (Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . "media/" . "resized_".$this->getData("thumbnail"));
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Return the Url key for the category
|
119 |
+
*
|
120 |
+
* @param category_id
|
121 |
+
* @return string
|
122 |
+
*/
|
123 |
+
public function getCategoryUrl($category_id)
|
124 |
+
{
|
125 |
+
$url="";
|
126 |
+
|
127 |
+
switch((int)$category_id){
|
128 |
+
case self::CATEGORY_NEWS:
|
129 |
+
$url = "news";
|
130 |
+
break;
|
131 |
+
case self::CATEGORY_TESTIMONIALS:
|
132 |
+
$url = "testimonials";
|
133 |
+
break;
|
134 |
+
case self::CATEGORY_RELEASES:
|
135 |
+
$url = "pressreleases";
|
136 |
+
break;
|
137 |
+
case self::CATEGORY_ARTICLES:
|
138 |
+
$url = "pressarticles";
|
139 |
+
break;
|
140 |
+
}
|
141 |
+
|
142 |
+
return($url);
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Check if page identifier exist for specific store
|
147 |
+
* return page id if page exists
|
148 |
+
*
|
149 |
+
* @param int $profile_id
|
150 |
+
* @param int $storeId
|
151 |
+
* @return int
|
152 |
+
*/
|
153 |
+
public function checkIdentifier($profile_id, $storeId)
|
154 |
+
{
|
155 |
+
return $this->_getResource()->checkIdentifier($profile_id, $storeId);
|
156 |
+
}
|
157 |
+
|
158 |
+
|
159 |
+
private function html_cut_text($text,$limit)
|
160 |
+
{
|
161 |
+
$max_code=8; // max for special code like ‰ á ...
|
162 |
+
|
163 |
+
if(($limit<>0)&&(strlen($text)>$limit))
|
164 |
+
{
|
165 |
+
$pos=strpos(substr($text,0,$limit+$max_code),';'); //find ;
|
166 |
+
if($pos) // cut when pass ;
|
167 |
+
$text=substr($text,0,$pos+1);
|
168 |
+
else //cut at limit
|
169 |
+
$text=substr($text,0,$limit);
|
170 |
+
return($text."...");
|
171 |
+
}
|
172 |
+
else
|
173 |
+
return($text); // return
|
174 |
+
}
|
175 |
+
|
176 |
+
public function getContent($limit = 0)
|
177 |
+
{
|
178 |
+
if($limit)
|
179 |
+
return $this->html_cut_text($this->getData("content"), $limit);
|
180 |
+
else
|
181 |
+
return ($this->getData("content"));
|
182 |
+
|
183 |
+
}
|
184 |
+
}
|
app/code/community/RichardMason/Profile/Model/Status.php
ADDED
@@ -0,0 +1,22 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category RichardMason
|
6 |
+
* @package RichardMason_Profile
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
class RichardMason_Profile_Model_Status extends Varien_Object
|
11 |
+
{
|
12 |
+
const STATUS_ENABLED = 1;
|
13 |
+
const STATUS_DISABLED = 2;
|
14 |
+
|
15 |
+
static public function getOptionArray()
|
16 |
+
{
|
17 |
+
return array(
|
18 |
+
self::STATUS_ENABLED => Mage::helper('profile')->__('Enabled'),
|
19 |
+
self::STATUS_DISABLED => Mage::helper('profile')->__('Disabled')
|
20 |
+
);
|
21 |
+
}
|
22 |
+
}
|
app/code/community/RichardMason/Profile/controllers/Adminhtml/ProfileController.php
ADDED
@@ -0,0 +1,274 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* Part of the code of this file was obtained from:
|
8 |
+
* -category Mage
|
9 |
+
* -package Mage_Adminhtml
|
10 |
+
* -copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
11 |
+
* -license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
12 |
+
*
|
13 |
+
* @category RichardMason
|
14 |
+
* @package RichardMason_Profile
|
15 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
class RichardMason_Profile_Adminhtml_ProfileController extends Mage_Adminhtml_Controller_action
|
19 |
+
{
|
20 |
+
|
21 |
+
protected function _initAction() {
|
22 |
+
$this->loadLayout()
|
23 |
+
->_setActiveMenu('profile/items')
|
24 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Profiles Manager'), Mage::helper('adminhtml')->__('Profile Manager'));
|
25 |
+
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
+
|
29 |
+
/*
|
30 |
+
* News Index
|
31 |
+
*/
|
32 |
+
public function newsAction(){
|
33 |
+
Mage::register('profile_category_id', RichardMason_Profile_Model_Profile::CATEGORY_NEWS);
|
34 |
+
$this->_initAction()
|
35 |
+
->renderLayout();
|
36 |
+
}
|
37 |
+
/*
|
38 |
+
* Testimonials Index
|
39 |
+
*/
|
40 |
+
public function testimonialsAction(){
|
41 |
+
Mage::register('profile_category_id', RichardMason_Profile_Model_Profile::CATEGORY_TESTIMONIALS);
|
42 |
+
$this->_initAction()
|
43 |
+
->renderLayout();
|
44 |
+
}
|
45 |
+
/*
|
46 |
+
* Press Releases Index
|
47 |
+
*/
|
48 |
+
public function pressreleasesAction(){
|
49 |
+
Mage::register('profile_category_id', RichardMason_Profile_Model_Profile::CATEGORY_RELEASES);
|
50 |
+
$this->_initAction()
|
51 |
+
->renderLayout();
|
52 |
+
}
|
53 |
+
/*
|
54 |
+
* Press Articles Index
|
55 |
+
*/
|
56 |
+
public function pressarticlesAction(){
|
57 |
+
Mage::register('profile_category_id', RichardMason_Profile_Model_Profile::CATEGORY_ARTICLES);
|
58 |
+
$this->_initAction()
|
59 |
+
->renderLayout();
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Edit CMS page
|
64 |
+
*/
|
65 |
+
public function editAction()
|
66 |
+
{
|
67 |
+
// 1. Get ID and create model
|
68 |
+
$id = $this->getRequest()->getParam('profile_id');
|
69 |
+
$model = Mage::getModel('profile/profile');
|
70 |
+
|
71 |
+
// 2. Initial checking
|
72 |
+
if ($id) {
|
73 |
+
$model->load($id);
|
74 |
+
if (! $model->getId()) {
|
75 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('profile')->__('This profile no longer exists'));
|
76 |
+
$this->_redirect('*/*/');
|
77 |
+
return;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
// 3. Set entered data if was error when we do save
|
82 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
83 |
+
if (! empty($data)) {
|
84 |
+
$model->setData($data);
|
85 |
+
}
|
86 |
+
if($this->getRequest()->getParam('category_id'))
|
87 |
+
$model->setData("category_id", $this->getRequest()->getParam('category_id'));
|
88 |
+
|
89 |
+
// 4. Register model to use later in blocks
|
90 |
+
Mage::register('profile_profile', $model);
|
91 |
+
|
92 |
+
// 5. Build edit form
|
93 |
+
$this->_initAction()
|
94 |
+
->_addBreadcrumb(Mage::helper('profile')->__('CMS'), Mage::helper('profile')->__('CMS'))
|
95 |
+
->_addContent($this->getLayout()->createBlock('profile/adminhtml_profile_edit'))
|
96 |
+
->_addLeft($this->getLayout()->createBlock('profile/adminhtml_profile_edit_tabs'));
|
97 |
+
|
98 |
+
$this->renderLayout();
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Save action
|
103 |
+
*/
|
104 |
+
public function saveAction()
|
105 |
+
{
|
106 |
+
// check if data sent
|
107 |
+
if ($data = $this->getRequest()->getPost()) {
|
108 |
+
//thumbnail file
|
109 |
+
if(isset($_FILES['thumbnail']['name']) && $_FILES['thumbnail']['name'] != '') {
|
110 |
+
try {
|
111 |
+
/* Starting upload */
|
112 |
+
$uploader = new Varien_File_Uploader('thumbnail');
|
113 |
+
// Any extention would work
|
114 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
115 |
+
$uploader->setAllowRenameFiles(false);
|
116 |
+
$uploader->setFilesDispersion(false);
|
117 |
+
// We set media as the upload dir
|
118 |
+
$path = Mage::getBaseDir('media') . DS ;
|
119 |
+
$uploader->save($path, $_FILES['thumbnail']['name'] );
|
120 |
+
} catch (Exception $e) {
|
121 |
+
$this->_getSession()->addException($e, Mage::helper('profile')->__('Error uploading image. Please try again later.'));
|
122 |
+
}
|
123 |
+
$data['thumbnail'] = $_FILES['thumbnail']['name'];
|
124 |
+
}
|
125 |
+
else
|
126 |
+
{
|
127 |
+
if(isset($data['thumbnail']['delete']) && $data['thumbnail']['delete'] == 1)
|
128 |
+
$data["thumbnail"]="";
|
129 |
+
else
|
130 |
+
unset($data["thumbnail"]);
|
131 |
+
}
|
132 |
+
//file pdf,...
|
133 |
+
if(isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') {
|
134 |
+
try {
|
135 |
+
$uploader = new Varien_File_Uploader('file');
|
136 |
+
// Any extention would work
|
137 |
+
$uploader->setAllowedExtensions(array('pdf'));
|
138 |
+
$uploader->setAllowRenameFiles(false);
|
139 |
+
$uploader->setFilesDispersion(false);
|
140 |
+
// We set media as the upload dir
|
141 |
+
$path = Mage::getBaseDir('media') . DS ;
|
142 |
+
$uploader->save($path, $_FILES['file']['name'] );
|
143 |
+
} catch (Exception $e) {
|
144 |
+
$this->_getSession()->addException($e, Mage::helper('profile')->__('Error uploading file. Please try again later.'));
|
145 |
+
}
|
146 |
+
$data['file'] = $_FILES['file']['name'];
|
147 |
+
}
|
148 |
+
else
|
149 |
+
{
|
150 |
+
if(isset($data['file']['delete']) && $data['file']['delete'] == 1)
|
151 |
+
$data["file"]="";
|
152 |
+
else
|
153 |
+
unset($data["file"]);
|
154 |
+
}
|
155 |
+
//picture file
|
156 |
+
if(isset($_FILES['picture']['name']) && $_FILES['picture']['name'] != '') {
|
157 |
+
try {
|
158 |
+
/* Starting upload */
|
159 |
+
$uploader = new Varien_File_Uploader('picture');
|
160 |
+
// Any extention would work
|
161 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
162 |
+
$uploader->setAllowRenameFiles(false);
|
163 |
+
$uploader->setFilesDispersion(false);
|
164 |
+
// We set media as the upload dir
|
165 |
+
$path = Mage::getBaseDir('media') . DS ;
|
166 |
+
$uploader->save($path, $_FILES['picture']['name'] );
|
167 |
+
} catch (Exception $e) {
|
168 |
+
$this->_getSession()->addException($e, Mage::helper('profile')->__('Error uploading image. Please try again later.'));
|
169 |
+
}
|
170 |
+
$data['picture'] = $_FILES['picture']['name'];
|
171 |
+
}
|
172 |
+
else
|
173 |
+
{
|
174 |
+
if(isset($data['picture']['delete']) && $data['picture']['delete'] == 1)
|
175 |
+
$data["picture"]="";
|
176 |
+
else
|
177 |
+
unset($data["picture"]);
|
178 |
+
}
|
179 |
+
|
180 |
+
//init model and set data
|
181 |
+
$model = Mage::getModel('profile/profile');
|
182 |
+
|
183 |
+
if ($id = $this->getRequest()->getParam('profile_id')) {
|
184 |
+
$model->load($id);
|
185 |
+
}
|
186 |
+
$model->setData($data);
|
187 |
+
|
188 |
+
$url = $model->getCategoryUrl($model->getData("category_id"));
|
189 |
+
|
190 |
+
Mage::dispatchEvent('profile_prepare_save', array('profile' => $model, 'request' => $this->getRequest()));
|
191 |
+
|
192 |
+
// try to save it
|
193 |
+
try {
|
194 |
+
// save the data
|
195 |
+
$model->save();
|
196 |
+
|
197 |
+
// display success message
|
198 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('profile')->__('Profile was successfully saved'));
|
199 |
+
// clear previously saved data from session
|
200 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
201 |
+
// check if 'Save and Continue'
|
202 |
+
if ($this->getRequest()->getParam('back')) {
|
203 |
+
$this->_redirect('*/*/edit', array('profile_id' => $model->getId()));
|
204 |
+
return;
|
205 |
+
}
|
206 |
+
// go to grid
|
207 |
+
$this->_redirect('*/*/'.$url);
|
208 |
+
return;
|
209 |
+
|
210 |
+
} catch (Mage_Core_Exception $e) {
|
211 |
+
$this->_getSession()->addError($e->getMessage());
|
212 |
+
}
|
213 |
+
catch (Exception $e) {
|
214 |
+
$this->_getSession()->addException($e, Mage::helper('profile')->__('Error while saving. Please try again later.'.$e));
|
215 |
+
}
|
216 |
+
|
217 |
+
$this->_getSession()->setFormData($data);
|
218 |
+
$this->_redirect('*/*/edit', array('profile_id' => $this->getRequest()->getParam('profile_id')));
|
219 |
+
return;
|
220 |
+
}
|
221 |
+
$this->_redirect('*/*/'.$url);
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Delete action
|
226 |
+
*/
|
227 |
+
public function deleteAction()
|
228 |
+
{
|
229 |
+
// check if we know what should be deleted
|
230 |
+
if ($id = $this->getRequest()->getParam('profile_id')) {
|
231 |
+
$title = "";
|
232 |
+
try {
|
233 |
+
// init model and delete
|
234 |
+
$model = Mage::getModel('profile/profile');
|
235 |
+
$model->load($id);
|
236 |
+
$title = $model->getTitle();
|
237 |
+
$model->delete();
|
238 |
+
// display success message
|
239 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('profile')->__('Profile was successfully deleted'));
|
240 |
+
// go to grid
|
241 |
+
Mage::dispatchEvent('adminhtml_cmspage_on_delete', array('title' => $title, 'status' => 'success'));
|
242 |
+
// go to grid
|
243 |
+
$url = $model->getCategoryUrl($model->getData("category_id"));
|
244 |
+
$this->_redirect('*/*/'.$url);
|
245 |
+
return;
|
246 |
+
|
247 |
+
} catch (Exception $e) {
|
248 |
+
Mage::dispatchEvent('adminhtml_profile_on_delete', array('title' => $title, 'status' => 'fail'));
|
249 |
+
// display error message
|
250 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
251 |
+
// go back to edit form
|
252 |
+
$this->_redirect('*/*/edit', array('profile_id' => $id));
|
253 |
+
return;
|
254 |
+
}
|
255 |
+
}
|
256 |
+
// display error message
|
257 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('profile')->__('Unable to find a profile to delete'));
|
258 |
+
// go to grid
|
259 |
+
$this->_redirect('*/*/');
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Filtering posted data. Converting localized data if needed
|
264 |
+
*
|
265 |
+
* @param array
|
266 |
+
* @return array
|
267 |
+
*/
|
268 |
+
protected function _filterPostData($data)
|
269 |
+
{
|
270 |
+
$data = $this->_filterDates($data, array('creation_time'));
|
271 |
+
return $data;
|
272 |
+
}
|
273 |
+
|
274 |
+
}
|
app/code/community/RichardMason/Profile/controllers/IndexController.php
ADDED
@@ -0,0 +1,12 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category RichardMason
|
6 |
+
* @package RichardMason_Profile
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
class RichardMason_Profile_IndexController extends Mage_Core_Controller_Front_Action
|
11 |
+
{
|
12 |
+
}
|
app/code/community/RichardMason/Profile/controllers/NewsController.php
ADDED
@@ -0,0 +1,32 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category RichardMason
|
6 |
+
* @package RichardMason_Profile
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
class RichardMason_Profile_NewsController extends Mage_Core_Controller_Front_Action
|
11 |
+
{
|
12 |
+
public function indexAction()
|
13 |
+
{
|
14 |
+
$this->loadLayout();
|
15 |
+
$this->renderLayout();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function readAction()
|
19 |
+
{
|
20 |
+
$this->loadLayout();
|
21 |
+
$block=Mage::getBlockSingleton('profile/profile');
|
22 |
+
//load profile
|
23 |
+
$profile = $block->getProfile();
|
24 |
+
if($profile) {
|
25 |
+
$this->getLayout()->getBlock('head')->setTitle($profile->getData("content_heading"))
|
26 |
+
->setDescription($profile->getData("meta_description"))
|
27 |
+
->setKeywords($profile->getData("meta_keywords"));
|
28 |
+
}
|
29 |
+
$this->renderLayout();
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
app/code/community/RichardMason/Profile/controllers/PressarticlesController.php
ADDED
@@ -0,0 +1,30 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category RichardMason
|
6 |
+
* @package RichardMason_Profile
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
class RichardMason_Profile_PressarticlesController extends Mage_Core_Controller_Front_Action
|
11 |
+
{
|
12 |
+
public function indexAction()
|
13 |
+
{
|
14 |
+
$this->loadLayout();
|
15 |
+
$this->renderLayout();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function readAction()
|
19 |
+
{
|
20 |
+
$block=Mage::getBlockSingleton('profile/profile');
|
21 |
+
$profile = $block->getProfile();
|
22 |
+
if($profile->getData("picture")){
|
23 |
+
echo " ";
|
24 |
+
echo "<img src=\"". Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . "media/" . $profile->getData("picture"). "\" width='950px' />";
|
25 |
+
echo " ";
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
app/code/community/RichardMason/Profile/controllers/PressreleasesController.php
ADDED
@@ -0,0 +1,32 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category RichardMason
|
6 |
+
* @package RichardMason_Profile
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
class RichardMason_Profile_PressreleasesController extends Mage_Core_Controller_Front_Action
|
11 |
+
{
|
12 |
+
public function indexAction()
|
13 |
+
{
|
14 |
+
$this->loadLayout();
|
15 |
+
$this->renderLayout();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function readAction()
|
19 |
+
{
|
20 |
+
$this->loadLayout();
|
21 |
+
$block=Mage::getBlockSingleton('profile/profile');
|
22 |
+
//load profile
|
23 |
+
$profile = $block->getProfile();
|
24 |
+
if($profile) {
|
25 |
+
$this->getLayout()->getBlock('head')->setTitle($profile->getData("content_heading"))
|
26 |
+
->setDescription($profile->getData("meta_description"))
|
27 |
+
->setKeywords($profile->getData("meta_keywords"));
|
28 |
+
}
|
29 |
+
$this->renderLayout();
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
app/code/community/RichardMason/Profile/controllers/TestimonialsController.php
ADDED
@@ -0,0 +1,17 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category RichardMason
|
6 |
+
* @package RichardMason_Profile
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
class RichardMason_Profile_TestimonialsController extends Mage_Core_Controller_Front_Action {
|
11 |
+
|
12 |
+
public function indexAction()
|
13 |
+
{
|
14 |
+
$this->loadLayout();
|
15 |
+
$this->renderLayout();
|
16 |
+
}
|
17 |
+
}
|
app/code/community/RichardMason/Profile/etc/config.xml
ADDED
@@ -0,0 +1,143 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<RichardMason_Profile>
|
5 |
+
<version>1.10</version>
|
6 |
+
</RichardMason_Profile>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<profile>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>RichardMason_Profile</module>
|
14 |
+
<frontName>profile</frontName>
|
15 |
+
</args>
|
16 |
+
</profile>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<profile>
|
21 |
+
<file>profile.xml</file>
|
22 |
+
</profile>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<profile>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>RichardMason_Profile</module>
|
32 |
+
<frontName>profile</frontName>
|
33 |
+
</args>
|
34 |
+
</profile>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<cms>
|
40 |
+
<children>
|
41 |
+
<news module="profile">
|
42 |
+
<title>News</title>
|
43 |
+
<sort_order>60</sort_order>
|
44 |
+
<action>profile/adminhtml_profile/news</action>
|
45 |
+
</news>
|
46 |
+
</children>
|
47 |
+
<children>
|
48 |
+
<testimonials module="profile">
|
49 |
+
<title>Testimonials</title>
|
50 |
+
<sort_order>61</sort_order>
|
51 |
+
<action>profile/adminhtml_profile/testimonials</action>
|
52 |
+
</testimonials>
|
53 |
+
</children>
|
54 |
+
<children>
|
55 |
+
<pressreleases module="profile">
|
56 |
+
<title>Press Releases</title>
|
57 |
+
<sort_order>62</sort_order>
|
58 |
+
<action>profile/adminhtml_profile/pressreleases</action>
|
59 |
+
</pressreleases>
|
60 |
+
</children>
|
61 |
+
<children>
|
62 |
+
<pressarticles module="profile">
|
63 |
+
<title>Press Articles</title>
|
64 |
+
<sort_order>63</sort_order>
|
65 |
+
<action>profile/adminhtml_profile/pressarticles</action>
|
66 |
+
</pressarticles>
|
67 |
+
</children>
|
68 |
+
</cms>
|
69 |
+
</menu>
|
70 |
+
<layout>
|
71 |
+
<updates>
|
72 |
+
<profile>
|
73 |
+
<file>profile.xml</file>
|
74 |
+
</profile>
|
75 |
+
</updates>
|
76 |
+
</layout>
|
77 |
+
<acl>
|
78 |
+
<resources>
|
79 |
+
<all>
|
80 |
+
<title>Allow Everything</title>
|
81 |
+
</all>
|
82 |
+
<admin>
|
83 |
+
<children>
|
84 |
+
<RichardMason_Profile>
|
85 |
+
<title>Profile Module</title>
|
86 |
+
<sort_order>10</sort_order>
|
87 |
+
</RichardMason_Profile>
|
88 |
+
</children>
|
89 |
+
</admin>
|
90 |
+
</resources>
|
91 |
+
</acl>
|
92 |
+
|
93 |
+
</adminhtml>
|
94 |
+
<global>
|
95 |
+
<models>
|
96 |
+
<profile>
|
97 |
+
<class>RichardMason_Profile_Model</class>
|
98 |
+
<resourceModel>profile_mysql4</resourceModel>
|
99 |
+
</profile>
|
100 |
+
<profile_mysql4>
|
101 |
+
<class>RichardMason_Profile_Model_Mysql4</class>
|
102 |
+
<entities>
|
103 |
+
<profile>
|
104 |
+
<table>profile</table>
|
105 |
+
</profile>
|
106 |
+
<profile_store>
|
107 |
+
<table>profile_store</table>
|
108 |
+
</profile_store>
|
109 |
+
</entities>
|
110 |
+
</profile_mysql4>
|
111 |
+
</models>
|
112 |
+
<resources>
|
113 |
+
<profile_setup>
|
114 |
+
<setup>
|
115 |
+
<module>RichardMason_Profile</module>
|
116 |
+
</setup>
|
117 |
+
<connection>
|
118 |
+
<use>core_setup</use>
|
119 |
+
</connection>
|
120 |
+
</profile_setup>
|
121 |
+
<profile_write>
|
122 |
+
<connection>
|
123 |
+
<use>core_write</use>
|
124 |
+
</connection>
|
125 |
+
</profile_write>
|
126 |
+
<profile_read>
|
127 |
+
<connection>
|
128 |
+
<use>core_read</use>
|
129 |
+
</connection>
|
130 |
+
</profile_read>
|
131 |
+
</resources>
|
132 |
+
<blocks>
|
133 |
+
<profile>
|
134 |
+
<class>RichardMason_Profile_Block</class>
|
135 |
+
</profile>
|
136 |
+
</blocks>
|
137 |
+
<helpers>
|
138 |
+
<profile>
|
139 |
+
<class>RichardMason_Profile_Helper</class>
|
140 |
+
</profile>
|
141 |
+
</helpers>
|
142 |
+
</global>
|
143 |
+
</config>
|
app/code/community/RichardMason/Profile/sql/profile_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,50 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
DROP TABLE IF EXISTS {$this->getTable('profile')};
|
9 |
+
CREATE TABLE {$this->getTable('profile')} (
|
10 |
+
`profile_id` smallint(6) NOT NULL AUTO_INCREMENT,
|
11 |
+
`category_id` int(11) NOT NULL,
|
12 |
+
`thumbnail` varchar(255) NOT NULL,
|
13 |
+
`thumbnail_position` int(11) NOT NULL,
|
14 |
+
`picture` varchar(255) NOT NULL,
|
15 |
+
`file` varchar(255) NOT NULL,
|
16 |
+
`content_heading` varchar(255) NOT NULL DEFAULT '',
|
17 |
+
`content` mediumtext,
|
18 |
+
`meta_keywords` text NOT NULL,
|
19 |
+
`meta_description` text NOT NULL,
|
20 |
+
`creation_time` datetime DEFAULT NULL,
|
21 |
+
`update_time` datetime DEFAULT NULL,
|
22 |
+
`is_active` tinyint(1) NOT NULL DEFAULT '1',
|
23 |
+
PRIMARY KEY (`profile_id`),
|
24 |
+
KEY `identifier` (`content_heading`)
|
25 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
26 |
+
|
27 |
+
DROP TABLE IF EXISTS `{$this->getTable('profile/profile_store')}`;
|
28 |
+
CREATE TABLE `{$this->getTable('profile/profile_store')}` (
|
29 |
+
`profile_id` smallint(6) NOT NULL,
|
30 |
+
`store_id` smallint(5) unsigned NOT NULL,
|
31 |
+
PRIMARY KEY (`profile_id`,`store_id`),
|
32 |
+
CONSTRAINT `FK_CMS_PROFILE_STORE_PAGE` FOREIGN KEY (`profile_id`) REFERENCES `{$this->getTable('profile')}` (`profile_id`) ON UPDATE CASCADE ON DELETE CASCADE,
|
33 |
+
CONSTRAINT `FK_CMS_PROFILE_STORE_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON UPDATE CASCADE ON DELETE CASCADE
|
34 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='CMS Profiles to Stores';
|
35 |
+
|
36 |
+
INSERT INTO `{$this->getTable('profile/profile_store')}` VALUES(1, 0, 'profile_examples/a5.jpg', 0, '', '', 'Example number 1', '<p><strong>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </strong>Vestibulum et neque neque. Vestibulum id aliquet dolor. Etiam porta nulla ac odio pharetra venenatis euismod risus pulvinar. Donec tempor molestie faucibus. Aenean tempus, mi sed scelerisque tincidunt, nunc dui tristique dui, auctor auctor eros ipsum nec augue. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec consectetur erat quis nisi feugiat sit amet tempus mi aliquam. Nam mattis tortor eu lectus laoreet eu dignissim turpis rhoncus. Proin eu mi neque, et hendrerit tellus. Ut sed tortor nisi, id sodales lacus. Nulla ac elit tortor. Nulla eleifend turpis ac dui venenatis convallis. Etiam quis augue justo. Nunc eget tortor magna.</p>', 'keywords, keywords,...', 'this is a new', '2010-05-24 00:00:00', '2010-05-25 11:16:10', 1);
|
37 |
+
INSERT INTO `{$this->getTable('profile/profile_store')}` VALUES(2, 0, 'profile_examples/a4.jpg', 0, '', '', 'Example number 2', '<p><strong>Donec vitae consequat nibh. </strong>Morbi blandit convallis rhoncus. Sed vel sapien urna, in rhoncus eros. In quis viverra urna. Donec bibendum nunc eget dolor scelerisque aliquam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse potenti. Proin dictum urna rutrum sapien pellentesque semper. Etiam vulputate odio et orci imperdiet eu sollicitudin neque sodales. Nunc quis quam tortor. Quisque viverra massa in tellus malesuada sed bibendum massa sollicitudin. Donec cursus purus aliquet nibh ultricies hendrerit. Suspendisse potenti. Vivamus egestas dictum arcu, vitae fringilla tortor egestas ac.</p>', '', '', '2010-05-25 00:00:00', '2010-05-25 11:15:47', 1);
|
38 |
+
INSERT INTO `{$this->getTable('profile/profile_store')}` VALUES(3, 0, 'profile_examples/a3.jpg', 1, '', '', 'Example number 3', '<p><strong>Phasellus feugiat euismod orci at adipiscing.</strong> Proin bibendum velit cursus mauris dapibus elementum. Mauris ultrices nisl felis. Sed lacinia tempor varius. Fusce venenatis rhoncus sem, et imperdiet lectus adipiscing sit amet. Pellentesque ut vulputate nisl. Sed ac mauris nunc, quis dignissim augue. Quisque et tincidunt augue. Vivamus in nisl id nulla pretium bibendum. Sed pharetra ullamcorper aliquam. Sed nec est diam, vel laoreet mauris.</p>', '', '', '2010-05-26 00:00:00', '2010-05-25 11:15:15', 1);
|
39 |
+
INSERT INTO `{$this->getTable('profile/profile_store')}` VALUES(4, 1, '', 0, '', '', 'Mr. Natoque et Magnis', '<p><em>'The service was brilliant! Ut luctus rhoncus mauris eu pharetra. Fusce dapibus aliquam nisl, non lacinia ligula pretium sit amet. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.'</em></p>\r\n<p><strong>Mr. Natoque et Magnis</strong></p>', '', '', '2010-05-25 00:00:00', '2010-05-25 11:23:40', 1);
|
40 |
+
INSERT INTO `{$this->getTable('profile/profile_store')}` VALUES(5, 1, '', 0, '', '', 'Mss. Nulla Amet', '<p><em>'Good quality of the products. Quisque fringilla diam quis lacus venenatis varius. Fusce imperdiet fringilla justo eu malesuada. Sed id nisl vulputate risus scelerisque suscipit. Nulla sit amet lorem non felis interdum venenatis. Fusce sollicitudin lorem ac erat varius sed mollis magna scelerisque.'</em></p>\r\n<p><strong>Mss. Nulla Amet</strong></p>', '', '', '2010-05-25 00:00:00', '2010-05-25 11:23:56', 1);
|
41 |
+
INSERT INTO `{$this->getTable('profile/profile_store')}` VALUES(6, 2, '', 0, '', 'profile_examples/press1.pdf', 'How can I capture credit card information without a payment gateway?', '<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>If you do not have a payment gateway, but still want to accept Credit Cards for processing offline you can capture the credit card information using the Saved Credit Card payment method.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>To set this up go to <strong>System</strong> -> <strong>Configuration</strong> and select <strong>Payment Methods</strong> from the left navigation. Once there you will see Saved CC as one of the available methods.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'><img style='padding: 0px; margin: 0px; border: 0px initial initial;' src='http://www.magentocommerce.com/images/uploads/admin_payment_savedcc.jpg' alt='image' /></p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>To enable this option you will want to set the Enabled dropdown to Yes.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>You can change the Title of the method to whatever you like in the Title field.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>Below this you can set the preferences of this payment method just as you do with all other payment methods. This includes the status of new orders placed with this method, the sort order as it will appear in the front-end in relation to the other methods, whether your customers must enter a card verification number, and the country and order amount filters for your customer to be able to use this method.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>When you are finished, select the Save Config button and you will be able to accept credit cards without integrating with a payment gateway.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>Orders placed using this method will appear in the admin with the card number, name on card and expiration date displayed to the store owner. You can then take this information and use it to charge your customers using your preferred method. </p>', '', '', '2010-02-09 00:00:00', '2010-05-25 11:36:50', 1);
|
42 |
+
INSERT INTO `{$this->getTable('profile/profile_store')}` VALUES(7, 2, '', 0, '', 'profile_examples/press2.pdf', 'How Do I Accept Checks and Money Orders as Payment? ', '<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>To accept checks and money orders as payment for orders go to <strong style='padding: 0px; margin: 0px;'>System</strong> -> <strong style='padding: 0px; margin: 0px;'>Configuration</strong>. Select Payment Methods from the left navigation. The current release of Magento supports offline payment using checks and money orders. Future releases will support the acceptance of electronic checks on the site.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'><img style='padding: 0px; margin: 0px; border: 0px initial initial;' src='http://www.magentocommerce.com/images/uploads/admin_payment_checks_thumb.jpg' alt='image' /></p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>To display this method to customers in the checkout process you must select Yes from the enabled dropdown.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>You are able to edit the title of the payment method by entering the text in the title field. The text entered here is what is displayed on the payment information page and on all order correspondence with the customer, including order confirmation emails, invoices, and the order history in the customer’s account. If you only want to accept Money Orders and not Checks, for example, you can rename the method to Money Orders.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>You can then select the status you want orders placed using Checks and Money Orders. Any orders placed using the Checks / Money Orders payment method will be displayed in the admin panel with this status.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>Enter the name and address of your company so that your customers know where the send the checks and to whom the checks will be payable. This information will appear in the checkout process for your customers to see.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>As with all payment methods, you can add country and order amount filters to determine which customers will be able to use this payment method. You will also be able to move the positioning of the Checks / Money Orders method around on the payment page by changing the sort order. The lowest number will be displayed in the highest position on the page.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>Below this payment method is the Purchase Orders option. This is also an offline method, but it is different from Checks and Money Orders. This is intended to be used when you and the customer have established a credit system, where they are given a Purchase Order number to enter during the checkout process and you can cross-reference this number with a payment option that you have or will arrange with the customer. </p>', '', '', '2010-05-25 00:00:00', '2010-05-25 11:33:08', 1);
|
43 |
+
INSERT INTO `{$this->getTable('profile/profile_store')}` VALUES(8, 2, '', 0, '', 'profile_examples/press3.pdf', 'What are Tax Rules and How Do I Use Them?', '<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>Tax Rules are defined as a combination of a Customer Tax Class and a Product Tax Class with a Tax Rate (see <a style='color: #0068b7; text-decoration: none; padding: 0px; margin: 0px;' title='What are tax classes? (product and customer)' href='http://www.magentocommerce.com/knowledge-base/entry/what-are-tax-classes-product-and-customer'>What are tax classes? (product and customer)</a>). Each customer will be assigned a class and each product is assigned a tax class. Each region is assigned a set of up to five tax rates. Based on the class of the customer and the class of the products in the shopping cart, and the region (this can be the shipping address, billing address, or shipping origin) the system will calculate out the appropriate tax.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>To create a Tax Rule go to <strong>Sales</strong> -> <strong>Tax</strong> -> <strong>Manage Tax Rules</strong>. Once there you will see a grid list of the Tax Rules you have created. To create a Tax Rule you will also have to create Tax Rates, along with the Tax Classes. See <a style='color: #0068b7; text-decoration: none; padding: 0px; margin: 0px;' title='How do I define tax rates?' href='http://www.magentocommerce.com/knowledge-base/entry/how-do-i-define-tax-rates-per-product-tax-rules/'>How do I define tax rates?</a> for more on setting Tax Rates.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>Once you have created your Tax Classes and Tax Rates you can create rules. In this case we are going to create four rules. We have two different customer types, Retail customers and Wholesale Customers, and two different types of products, taxable and downloadable.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>In this example we are a store in California and we have created a tax rate of 8.25%. (NOTE: This is for example purposes only. Consult your state laws for tax rates). We have also left a rate as being 0%.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>The first Tax Rule we create is for Retail Customers buying taxable goods.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'><img style='padding: 0px; margin: 0px; border: 0px initial initial;' src='http://www.magentocommerce.com/images/uploads/admin_tax_rule1.jpg' alt='image' width='455' height='210' /></p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>We select the Customer and Product class from the dropdowns and then select the Rate we want to use for this combination. In this case we want to use the first rate, 8.25%.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>Select Save Rule and Retail customers with a shipping address in California will be charged a rate of 8.25% on all items marked as being Taxable Goods. That is set, but let’s say we have downloadable items we don’t want charge tax on. We create a new rule with the combination of the Retail Customer Tax Class and the Downloadable Items Product Tax Class and select the rate we want to charge.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>In this case the rate is the second we created, 0.0%, so customers will not be charged tax on these items.</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>Now that we have our retail customers set up with tax rates we need to set up the two rules for Wholesale Customers. We select the Wholesale Customer from the tax class, select Taxable Items and Rate 2. Then we do the same for Downloadable Items and we have our four tax rates created:</p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'><img style='padding: 0px; margin: 0px; border: 0px initial initial;' src='http://www.magentocommerce.com/images/uploads/admin_taxrule2.jpg' alt='image' width='598' height='203' /></p>\r\n<p style='margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;'>If you need to charge tax on shipping, you can do so by creating a Tax Rule for shipping. This means that you should create a Product Tax Class that will be applied to shipping. Navigate to <strong>System -> Configuration</strong>, and click the Sales tab. In the Tax Calculation section, you can select which product tax class will be applied to the shipping, if you choose to tax shipping. You can also determine whether tax will apply before or after discounts, and how the region of the Tax Rate will be determined (billing address, shipping destination, or shipping origin).</p>', '', '', '2010-03-17 00:00:00', '2010-05-25 11:37:07', 1);
|
44 |
+
INSERT INTO `{$this->getTable('profile/profile_store')}` VALUES(9, 3, 'profile_examples/article1pic.jpg', 0, 'profile_examples/article1.jpg', '', 'cnet Wireless', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ut dolor sit amet nisl elementum rhoncus et at lorem. Pellentesque quis felis quis eros fermentum interdum. Curabitur nibh lacus, varius quis fermentum sit amet, pretium ut enim. Proin euismod enim a ligula tristique volutpat.</p>', '', '', '2010-05-25 00:00:00', '2010-05-25 11:54:31', 1);
|
45 |
+
INSERT INTO `{$this->getTable('profile/profile_store')}` VALUES(10, 3, 'profile_examples/article2pic.jpg', 0, 'profile_examples/article2.jpg', '', 'cnet Security', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ut dolor sit amet nisl elementum rhoncus et at lorem. Pellentesque quis felis quis eros fermentum interdum. Curabitur nibh lacus, varius quis fermentum sit amet, pretium ut enim. Proin euismod enim a ligula tristique volutpat.</p>', '', '', '2010-05-25 00:00:00', '2010-05-25 12:12:54', 1);
|
46 |
+
INSERT INTO `{$this->getTable('profile/profile_store')}` VALUES(11, 3, 'profile_examples/article3pic.jpg', 0, 'profile_examples/article3.jpg', '', 'cnet Webware', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ut dolor sit amet nisl elementum rhoncus et at lorem. Pellentesque quis felis quis eros fermentum interdum. Curabitur nibh lacus, varius quis fermentum sit amet, pretium ut enim. Proin euismod enim a ligula tristique volutpat.</p>', '', '', '2010-05-25 00:00:00', '2010-05-25 12:13:33', 1);
|
47 |
+
INSERT INTO `{$this->getTable('profile/profile_store')}` VALUES(12, 3, 'profile_examples/article4pic.jpg', 1, 'profile_examples/article4.jpg', '', 'cnet Business', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ut dolor sit amet nisl elementum rhoncus et at lorem. Pellentesque quis felis quis eros fermentum interdum. Curabitur nibh lacus, varius quis fermentum sit amet, pretium ut enim. Proin euismod enim a ligula tristique volutpat.</p>', '', '', '2010-05-25 00:00:00', '2010-05-25 12:14:21', 1);
|
48 |
+
");
|
49 |
+
|
50 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/profile.xml
ADDED
@@ -0,0 +1,71 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Mason Web Development
|
5 |
+
*
|
6 |
+
* @category design
|
7 |
+
* @package default_default
|
8 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
9 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
+
-->
|
11 |
+
<layout version="0.1.0">
|
12 |
+
<profile_adminhtml_profile_index>
|
13 |
+
<reference name="content">
|
14 |
+
<block type="profile/adminhtml_profile" name="profile" />
|
15 |
+
</reference>
|
16 |
+
</profile_adminhtml_profile_index>
|
17 |
+
|
18 |
+
<profile_adminhtml_profile_news>
|
19 |
+
<reference name="content">
|
20 |
+
<block type="profile/adminhtml_profile" name="profile" />
|
21 |
+
</reference>
|
22 |
+
</profile_adminhtml_profile_news>
|
23 |
+
|
24 |
+
<profile_adminhtml_profile_testimonials>
|
25 |
+
<reference name="content">
|
26 |
+
<block type="profile/adminhtml_profile" name="profile" />
|
27 |
+
</reference>
|
28 |
+
</profile_adminhtml_profile_testimonials>
|
29 |
+
|
30 |
+
<profile_adminhtml_profile_pressreleases>
|
31 |
+
<reference name="content">
|
32 |
+
<block type="profile/adminhtml_profile" name="profile" />
|
33 |
+
</reference>
|
34 |
+
</profile_adminhtml_profile_pressreleases>
|
35 |
+
|
36 |
+
<profile_adminhtml_profile_pressarticles>
|
37 |
+
<reference name="content">
|
38 |
+
<block type="profile/adminhtml_profile" name="profile" />
|
39 |
+
</reference>
|
40 |
+
</profile_adminhtml_profile_pressarticles>
|
41 |
+
|
42 |
+
<profile_adminhtml_profile_edit>
|
43 |
+
<update handle="editor"/>
|
44 |
+
<reference name="content">
|
45 |
+
<block type="profile/adminhtml_profile_edit" name="profile_edit"></block>
|
46 |
+
</reference>
|
47 |
+
<reference name="left">
|
48 |
+
<block type="profile/adminhtml_profile_edit_tabs" name="profile_edit_tabs">
|
49 |
+
<block type="profile/adminhtml_profile_edit_tab_main" name="profile_edit_tab_main" />
|
50 |
+
<block type="profile/adminhtml_profile_edit_tab_meta" name="profile_edit_tab_meta" />
|
51 |
+
<action method="addTab"><name>main_section</name><block>profile_edit_tab_main</block></action>
|
52 |
+
<action method="addTab"><name>meta_section</name><block>profile_edit_tab_meta</block></action>
|
53 |
+
</block>
|
54 |
+
</reference>
|
55 |
+
</profile_adminhtml_profile_edit>
|
56 |
+
|
57 |
+
<profile_cms_wysiwyg_images_index>
|
58 |
+
<remove name="footer" />
|
59 |
+
<remove name="head" />
|
60 |
+
<reference name="left">
|
61 |
+
<block name="wysiwyg_images.js" type="adminhtml/cms_wysiwyg_images_content" template="cms/browser/js.phtml" />
|
62 |
+
<block name="wysiwyg_images.tree" type="adminhtml/cms_wysiwyg_images_tree" template="cms/browser/tree.phtml" />
|
63 |
+
</reference>
|
64 |
+
<reference name="content">
|
65 |
+
<block name="wysiwyg_images.content" type="adminhtml/cms_wysiwyg_images_content" template="cms/browser/content.phtml">
|
66 |
+
<block name="wysiwyg_images.uploader" type="adminhtml/cms_wysiwyg_images_content_uploader" template="cms/browser/content/uploader.phtml" />
|
67 |
+
<block name="wysiwyg_images.newfolder" type="adminhtml/cms_wysiwyg_images_content_newfolder" template="cms/browser/content/newfolder.phtml" />
|
68 |
+
</block>
|
69 |
+
</reference>
|
70 |
+
</profile_cms_wysiwyg_images_index>
|
71 |
+
</layout>
|
app/design/frontend/default/default/layout/profile.xml
ADDED
@@ -0,0 +1,45 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
</default>
|
5 |
+
<profile_news_index>
|
6 |
+
<reference name="content">
|
7 |
+
<block type="profile/profile" name="profile" template="profile/news.phtml" />
|
8 |
+
</reference>
|
9 |
+
</profile_news_index>
|
10 |
+
<profile_news_read>
|
11 |
+
<reference name="content">
|
12 |
+
<block type="profile/profile" name="profile" template="profile/readnews.phtml" />
|
13 |
+
</reference>
|
14 |
+
</profile_news_read>
|
15 |
+
|
16 |
+
<profile_testimonials_index>
|
17 |
+
<reference name="content">
|
18 |
+
<block type="profile/profile" name="profile" template="profile/testimonials.phtml" />
|
19 |
+
</reference>
|
20 |
+
</profile_testimonials_index>
|
21 |
+
|
22 |
+
<profile_pressarticles_index>
|
23 |
+
<reference name="content">
|
24 |
+
<block type="profile/profile" name="profile" template="profile/pressarticles.phtml" />
|
25 |
+
</reference>
|
26 |
+
</profile_pressarticles_index>
|
27 |
+
<profile_pressarticles_read>
|
28 |
+
<reference name="content">
|
29 |
+
<block type="profile/profile" name="profile" template="profile/readpressarticle.phtml" />
|
30 |
+
</reference>
|
31 |
+
</profile_pressarticles_read>
|
32 |
+
|
33 |
+
<profile_pressreleases_index>
|
34 |
+
<reference name="content">
|
35 |
+
<block type="profile/profile" name="profile" template="profile/pressreleases.phtml" />
|
36 |
+
</reference>
|
37 |
+
</profile_pressreleases_index>
|
38 |
+
<profile_pressreleases_read>
|
39 |
+
<reference name="content">
|
40 |
+
<block type="profile/profile" name="profile" template="profile/readpressrelease.phtml" />
|
41 |
+
</reference>
|
42 |
+
</profile_pressreleases_read>
|
43 |
+
|
44 |
+
|
45 |
+
</layout>
|
app/design/frontend/default/default/template/profile/news.phtml
ADDED
@@ -0,0 +1,36 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category design
|
6 |
+
* @package default_default
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
?>
|
11 |
+
<?php
|
12 |
+
// get all News
|
13 |
+
$news = $this->getNews();
|
14 |
+
?>
|
15 |
+
<h1>News</h1>
|
16 |
+
<div style="float: left;">
|
17 |
+
<?php foreach($news as $n): ?>
|
18 |
+
<?php if ($n->getData("is_active")):?>
|
19 |
+
<div class="ColumnLeft" style="float: left; border-bottom: 1px solid #ddd; padding-bottom: 10px; padding-top: 10px; width: 400px;">
|
20 |
+
<?php $newsUrl = $this->getUrl('*/*/read', array("id" => $n->getData("profile_id")));?>
|
21 |
+
<?php if($n->getData("thumbnail")):?>
|
22 |
+
<a href="<?echo $newsUrl ?>">
|
23 |
+
<?php $marginPosition = ($n->getThumbnailAlign() == "left") ? "float: left; margin-right: 10px;" : "float: right; margin-left: 10px;";?>
|
24 |
+
<img src="<?php echo $n->getThumbnailResize(100) ?>" style="<?php echo $marginPosition; ?>"/>
|
25 |
+
</a>
|
26 |
+
<?php endif; ?>
|
27 |
+
<a href="<?echo $newsUrl ?>"><h2><?php echo $this->formatDate($n->getData("creation_time")); ?> - <?php echo $n->getData("content_heading"); ?></h2></a>
|
28 |
+
<p><?php echo $n->getContent(256); ?></p>
|
29 |
+
<?php if(strlen($n->getData("content")) > 256 ): ?>
|
30 |
+
<p align="right"><a href="<?php echo $newsUrl ?>" >Continue reading...</a></p>
|
31 |
+
<?php endif;?>
|
32 |
+
</div>
|
33 |
+
<div class=clearFloat></div>
|
34 |
+
<?php endif; ?>
|
35 |
+
<?php endforeach; ?>
|
36 |
+
</div>
|
app/design/frontend/default/default/template/profile/pressarticles.phtml
ADDED
@@ -0,0 +1,131 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category design
|
6 |
+
* @package default_default
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
?>
|
11 |
+
<?php
|
12 |
+
//get all Profiles
|
13 |
+
$pressarticles = $this->getPressarticles();
|
14 |
+
?>
|
15 |
+
<script type="text/javascript" src="<? echo $this->getSkinUrl("js/modalbox/modalbox.js") ?>"></script>
|
16 |
+
<style>
|
17 |
+
#MB_overlay {
|
18 |
+
position: absolute;
|
19 |
+
margin: auto;
|
20 |
+
top: 0; left: 0;
|
21 |
+
width: 100%; height: 100%;
|
22 |
+
z-index: 9999;
|
23 |
+
background-color: grey!important;
|
24 |
+
}
|
25 |
+
#MB_overlay[id] { position: fixed; }
|
26 |
+
|
27 |
+
#MB_window {
|
28 |
+
position:absolute;
|
29 |
+
top: 0;
|
30 |
+
border: 0 solid;
|
31 |
+
text-align:left;
|
32 |
+
z-index:10000;
|
33 |
+
}
|
34 |
+
#MB_window[id] { position: fixed!important; }
|
35 |
+
|
36 |
+
#MB_frame {
|
37 |
+
position:relative;
|
38 |
+
background-color: #FFF;
|
39 |
+
height:100%;
|
40 |
+
}
|
41 |
+
|
42 |
+
#MB_header {
|
43 |
+
margin:0;
|
44 |
+
height: 28px;
|
45 |
+
}
|
46 |
+
|
47 |
+
#MB_content {
|
48 |
+
padding: 6px .75em;
|
49 |
+
overflow:auto;
|
50 |
+
}
|
51 |
+
|
52 |
+
#MB_caption {
|
53 |
+
font: bold 85% "Verdana", Arial, sans-serif;
|
54 |
+
/*text-shadow: #FFF 0 1px 0;*/
|
55 |
+
padding: .5em 2em 0 .75em;
|
56 |
+
margin: 0;
|
57 |
+
text-align: left;
|
58 |
+
}
|
59 |
+
|
60 |
+
#MB_close {
|
61 |
+
display:block;
|
62 |
+
position:absolute;
|
63 |
+
right:5px; top:4px;
|
64 |
+
padding:2px 3px;
|
65 |
+
font-weight:bold;
|
66 |
+
text-decoration:none;
|
67 |
+
font-size:13px;
|
68 |
+
}
|
69 |
+
#MB_close:hover {
|
70 |
+
background:transparent;
|
71 |
+
}
|
72 |
+
|
73 |
+
#MB_loading {
|
74 |
+
padding: 1.5em;
|
75 |
+
text-indent: -10000px;
|
76 |
+
background: transparent url(spinner.gif) 50% 0 no-repeat;
|
77 |
+
}
|
78 |
+
|
79 |
+
/* Color scheme */
|
80 |
+
#MB_window {
|
81 |
+
background-color: #000;
|
82 |
+
color: grey;
|
83 |
+
}
|
84 |
+
#MB_content { border-top: 1px solid #F9F9F9; }
|
85 |
+
#MB_header {
|
86 |
+
background-color: grey;
|
87 |
+
border-bottom: 1px solid #CCC;
|
88 |
+
}
|
89 |
+
#MB_caption { color:#FFF }
|
90 |
+
#MB_close { color:#154C7C }
|
91 |
+
#MB_close:hover { color: grey }
|
92 |
+
|
93 |
+
|
94 |
+
/* Alert message */
|
95 |
+
.MB_alert {
|
96 |
+
margin: 10px 0;
|
97 |
+
text-align: center;
|
98 |
+
}
|
99 |
+
</style>
|
100 |
+
|
101 |
+
<h1>Press coverage</h1>
|
102 |
+
<div style="float: left; width: 400px; border: 0px solid black;">
|
103 |
+
<?php foreach($pressarticles as $n): ?>
|
104 |
+
<?php if ($n->getData("is_active")):?>
|
105 |
+
<?php if($n->getData("picture")):?>
|
106 |
+
<?php $pressarticlesUrl = $this->getUrl('*/*/read', array("id" => $n->getData("profile_id"))); ?>
|
107 |
+
<?php endif; ?>
|
108 |
+
<div class="ColumnLeft" style="float: left; border-bottom: 1px solid #ddd; padding-bottom: 10px; padding-top: 10px; width: 350px; border: 0px solid red;">
|
109 |
+
<table style="table-layout:fixed;">
|
110 |
+
<tr valign="top">
|
111 |
+
<td style="overflow:hidden;" width="100px">
|
112 |
+
<?php if($n->getData("thumbnail")):?>
|
113 |
+
<div id="<?php echo $n->getData("profile_id"); ?>" style="float: left; height: 90px; width: 90px; background-repeat:no-repeat; background-image: url('<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . "media/" . $n->getData("thumbnail") ?>');" />
|
114 |
+
<?php endif; ?>
|
115 |
+
</td>
|
116 |
+
<td style="padding-left: 10px">
|
117 |
+
<a href="<? echo $pressarticlesUrl ?>" title="<?php echo $n->getData("content_heading"); ?>" onclick="Modalbox.show(this.href, {title: this.title, transitions: false, width: 700, height: 600}); return false;">
|
118 |
+
<h2><?php echo $this->formatDate($n->getData("creation_time")); ?> - <?php echo $n->getData("content_heading"); ?></h2>
|
119 |
+
</a>
|
120 |
+
<p><?php echo $n->getContent(); ?></p>
|
121 |
+
</td>
|
122 |
+
</tr>
|
123 |
+
</table>
|
124 |
+
</div>
|
125 |
+
<?php endif; ?>
|
126 |
+
<?php endforeach; ?>
|
127 |
+
</div>
|
128 |
+
|
129 |
+
|
130 |
+
|
131 |
+
|
app/design/frontend/default/default/template/profile/pressreleases.phtml
ADDED
@@ -0,0 +1,37 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category design
|
6 |
+
* @package default_default
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
?>
|
11 |
+
<?php
|
12 |
+
//get all Profiles
|
13 |
+
$pressreleases = $this->getPressreleases();
|
14 |
+
?>
|
15 |
+
<h1>Press releases</h1>
|
16 |
+
<div style="float: left; width: 400px;">
|
17 |
+
<?php foreach($pressreleases as $n): ?>
|
18 |
+
<?php if ($n->getData("is_active")):?>
|
19 |
+
<div style="float: left; width: 400px; border-bottom: 1px solid #ddd; padding-bottom: 10px; padding-top: 10px;">
|
20 |
+
<?php $fileUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . "media/" . $n->getData("file")?>
|
21 |
+
<?php $readUrl = $this->getUrl('*/*/read', array("id" => $n->getData("profile_id"))); ?>
|
22 |
+
<?php if($n->getData("thumbnail")):?>
|
23 |
+
<a href="<?echo $fileUrl ?>">
|
24 |
+
<?php $marginPosition = ($n->getThumbnailAlign() == "left") ? "float: left; margin-right: 10px;" : "float: right; margin-left: 10px;";?>
|
25 |
+
<img src="<?php echo $n->getThumbnailResize(100) ?>" style="<?php echo $marginPosition; ?>"/>
|
26 |
+
</a>
|
27 |
+
<?php endif; ?>
|
28 |
+
<p><?php echo $this->formatDate($n->getData("creation_time"), 'full'); ?> <br/>
|
29 |
+
<a href="<?echo $readUrl ?>"><?php echo $n->getData("content_heading"); ?></a>
|
30 |
+
</p>
|
31 |
+
<a class="grey" href="<?echo $fileUrl ?>">
|
32 |
+
Click here to download PDF
|
33 |
+
</a>
|
34 |
+
</div>
|
35 |
+
<?php endif; ?>
|
36 |
+
<?php endforeach; ?>
|
37 |
+
</div>
|
app/design/frontend/default/default/template/profile/readnews.phtml
ADDED
@@ -0,0 +1,26 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category design
|
6 |
+
* @package default_default
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
?>
|
11 |
+
<?php
|
12 |
+
$profile = $this->getProfile();
|
13 |
+
?>
|
14 |
+
<?php if ($profile->getData("is_active")):?>
|
15 |
+
<?php if($profile->getData("thumbnail")):?>
|
16 |
+
<?php $marginPosition = ($profile->getThumbnailAlign() == "left") ? "float: left; margin-right: 10px;" : "float: right; margin-left: 10px;";?>
|
17 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . "media/" . $profile->getData("thumbnail") ?>" align="<?php echo $profile->getThumbnailAlign(); ?>" style="<?php echo $marginPosition;?> padding: 2px;"/>
|
18 |
+
<?php endif; ?>
|
19 |
+
<h1><?php echo $profile->getData("content_heading"); ?></h1>
|
20 |
+
<p><?php echo $this->formatDate($profile->getData("creation_time")); ?></p><br/>
|
21 |
+
<p><?php echo $profile->getData("content"); ?></p>
|
22 |
+
<br/>
|
23 |
+
<a href="<?php echo $this->getUrl("*/news/"); ?>" ><< back</a>
|
24 |
+
<br/>
|
25 |
+
<br/>
|
26 |
+
<?php endif;?>
|
app/design/frontend/default/default/template/profile/readpressrelease.phtml
ADDED
@@ -0,0 +1,31 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category design
|
6 |
+
* @package default_default
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
?>
|
11 |
+
<?php
|
12 |
+
$profile = $this->getProfile();
|
13 |
+
?>
|
14 |
+
<?php if ($profile->getData("is_active")):?>
|
15 |
+
<?php if($profile->getData("thumbnail")):?>
|
16 |
+
<?php $marginPosition = ($profile->getThumbnailAlign() == "left") ? "float: left; margin-right: 10px;" : "float: right; margin-left: 10px;";?>
|
17 |
+
<img src="<?php echo $profile->getThumbnailResize(100) ?>" style="<?php echo $marginPosition; ?>"/>
|
18 |
+
<?php endif; ?>
|
19 |
+
<h1><?php echo $profile->getData("content_heading"); ?></h1>
|
20 |
+
<?php $fileUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . "media/" . $profile->getData("file")?>
|
21 |
+
<p><?php echo $this->formatDate($profile->getData("creation_time"), 'full'); ?></p>
|
22 |
+
<a class="grey" href="<?echo $fileUrl ?>">
|
23 |
+
Click here to download PDF
|
24 |
+
</a>
|
25 |
+
<br/> <br/>
|
26 |
+
<p><?php echo $profile->getData("content"); ?></p>
|
27 |
+
<br/>
|
28 |
+
<a href="<?php echo $this->getUrl("*/pressreleases/"); ?>" ><< back</a>
|
29 |
+
<br/>
|
30 |
+
<br/>
|
31 |
+
<?php endif;?>
|
app/design/frontend/default/default/template/profile/testimonials.phtml
ADDED
@@ -0,0 +1,25 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Mason Web Development
|
4 |
+
*
|
5 |
+
* @category design
|
6 |
+
* @package default_default
|
7 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
?>
|
11 |
+
<?php
|
12 |
+
//get all Profiles
|
13 |
+
$testimonials = $this->getTestimonials();
|
14 |
+
?>
|
15 |
+
<h1>Testimonials</h1>
|
16 |
+
<div style="float: left; width: 400px;">
|
17 |
+
<?php foreach($testimonials as $n): ?>
|
18 |
+
<?php if ($n->getData("is_active")):?>
|
19 |
+
<div class="ColumnLeft" style="float: left; border-bottom: 1px solid #ddd; padding-bottom: 10px; padding-top: 10px;">
|
20 |
+
<h2><?php echo $this->formatDate($n->getData("creation_time")); ?> - <?php echo $n->getData("content_heading"); ?></h2>
|
21 |
+
<p><?php echo $n->getContent(); ?></p>
|
22 |
+
</div>
|
23 |
+
<?php endif; ?>
|
24 |
+
<?php endforeach; ?>
|
25 |
+
</div>
|
app/etc/modules/RichardMason_Profile.xml
ADDED
@@ -0,0 +1,9 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<RichardMason_Profile>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</RichardMason_Profile>
|
8 |
+
</modules>
|
9 |
+
</config>
|
media/profile_examples/a1.jpg
ADDED
Binary file
|
media/profile_examples/a2.jpg
ADDED
Binary file
|
media/profile_examples/a3.jpg
ADDED
Binary file
|
media/profile_examples/a4.jpg
ADDED
Binary file
|
media/profile_examples/a5.jpg
ADDED
Binary file
|
media/profile_examples/article1.jpg
ADDED
Binary file
|
media/profile_examples/article1pic.jpg
ADDED
Binary file
|
media/profile_examples/article2.jpg
ADDED
Binary file
|
media/profile_examples/article2pic.jpg
ADDED
Binary file
|
media/profile_examples/article3.jpg
ADDED
Binary file
|
media/profile_examples/article3pic.jpg
ADDED
Binary file
|
media/profile_examples/article4.jpg
ADDED
Binary file
|
media/profile_examples/article4pic.jpg
ADDED
Binary file
|
media/profile_examples/press1.pdf
ADDED
Binary file
|
media/profile_examples/press2.pdf
ADDED
Binary file
|
media/profile_examples/press3.pdf
ADDED
Binary file
|
media/profile_examples/resized_a1.jpg
ADDED
Binary file
|
media/profile_examples/resized_a2.jpg
ADDED
Binary file
|
media/profile_examples/resized_a3.jpg
ADDED
Binary file
|
media/profile_examples/resized_a4.jpg
ADDED
Binary file
|
media/profile_examples/resized_a5.jpg
ADDED
Binary file
|
package.xml
ADDED
@@ -0,0 +1,23 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>MDWNewsAndTestimonialsExtension</name>
|
4 |
+
<version>1.10</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">Extension license name (OSL v3.0)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Extra CMS Content</summary>
|
10 |
+
<description>CMS Content for:<br/>
|
11 |
+
- News<br/>
|
12 |
+
- Press Articles<br/>
|
13 |
+
- Press Releases<br/>
|
14 |
+
- Testimonials</description>
|
15 |
+
<notes>This extension adds new CMS content pages to Magento.
|
16 |
+
You can associate image, thumbnail and PDF file to every new content.</notes>
|
17 |
+
<authors><author><name>Mason Web Development</name><user>auto-converted</user><email>magentosupport@masonwebdevelopment.com</email></author><author><name>Mason Web Development</name><user>auto-converted</user><email>magentosupport@masonwebdevelopment.com</email></author></authors>
|
18 |
+
<date>2010-05-26</date>
|
19 |
+
<time>10:12:10</time>
|
20 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="profile.xml" hash="9d7fc6c6b74f8ccc7be9496a84f97e2d"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="profile.xml" hash="543044648eaebc0e64fc4eada31357d1"/></dir><dir name="template"><dir name="profile"><file name="news.phtml" hash="e6799636fcb0185c4fe87d72111cc74b"/><file name="pressarticles.phtml" hash="86db4942706c9a9ae8459e76105cef24"/><file name="pressreleases.phtml" hash="ba935db5e753427eda71c8f4ee26a0c4"/><file name="readnews.phtml" hash="685cd5d0e7320ed4a76039632013ed48"/><file name="readpressrelease.phtml" hash="9ecd7f3e6cfb588f5e8999f9a7614043"/><file name="testimonials.phtml" hash="d142e7b55ba27fc714aae504d1f665dd"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="js"><dir name="modalbox"><file name="modalbox.js" hash="6ce15ce42d632e480a20b3089ac26160"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="RichardMason_Profile.xml" hash="8faa16e60aa6324878a64deb636896e3"/></dir></target><target name="magemedia"><dir name="profile_examples"><file name="a1.jpg" hash="9e73ece51cda0b1ec13ea75be8abb8aa"/><file name="a2.jpg" hash="b0099cca5c06cad0436c72cbaf5c99d2"/><file name="a3.jpg" hash="aaaeff035f4f02f5ce2a933538994a00"/><file name="a4.jpg" hash="3c31383b949e1287db40c3101f655553"/><file name="a5.jpg" hash="0551492495b0f275159c37cc83ae4e29"/><file name="article1.jpg" hash="54c66ff52b7ca8bbb32f955dd4ff6b32"/><file name="article1pic.jpg" hash="b7baf4318905375cc9b5b93b4d34fc1d"/><file name="article2.jpg" hash="56bf09c97a6e4ed117096ddad741d62f"/><file name="article2pic.jpg" hash="f839aee6b6ad55b858bf8242103a2a2f"/><file name="article3.jpg" hash="7ec4a5ad05de75528b544fb5d4ae9e44"/><file name="article3pic.jpg" hash="6d05e50d55b939e8a942298983ca1c94"/><file name="article4.jpg" hash="80ae78daba07c16183738e6883403cf4"/><file name="article4pic.jpg" hash="b0e40dca8bab77f83bfda86c84da45d6"/><file name="press1.pdf" hash="c705ec4347e5a5f93da3ea2ad6d2eabd"/><file name="press2.pdf" hash="b0989b4ee09afda891f973de260991e1"/><file name="press3.pdf" hash="8a395e653aaac28355a24f20141d61c2"/><file name="resized_a1.jpg" hash="da3683422385dd18851905ededd1a350"/><file name="resized_a2.jpg" hash="51985439e4302c1c618ceb6b70b0cd8a"/><file name="resized_a3.jpg" hash="2c8bc03d673252af90372ea9ef2b8338"/><file name="resized_a4.jpg" hash="66c34c77a265111183f0734d2da0dfa8"/><file name="resized_a5.jpg" hash="917295923fc6716da27330d8ed0665dc"/></dir></target><target name="magecommunity"><dir name="RichardMason"><dir name="Profile"><dir name="Block"><dir name="Adminhtml"><dir name="Profile"><dir name="Edit"><dir name="Tab"><file name="Main.php" hash="d0d156cfc43d630dd863d6a9a579cf85"/><file name="Meta.php" hash="503fb0d50de7b463ec4c1b16adc5ce85"/></dir><file name="Form.php" hash="a8ecac34ed7de85972d134c928466e94"/><file name="Tabs.php" hash="ca1f7626079fdb811def6fb57ac6d364"/></dir><file name="Edit.php" hash="4cbed849629b0945314395d22f604a62"/><file name="Grid.php" hash="247e571159ee3c4087b2ac9a00d73e7f"/></dir><file name="Profile.php" hash="345024248a7640d9a9fd8e5c9bf686ea"/></dir><file name="Profile.php" hash="8bc064d3e9408d33444795057126185e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ProfileController.php" hash="6c95babeba2eba7ca4cd8b1d654b40e2"/></dir><file name="IndexController.php" hash="eedc3b3af262a3319e178fcf30516dc5"/><file name="NewsController.php" hash="dcc3c9dba4e8ce0987ef719877edb1fb"/><file name="PressarticlesController.php" hash="1986339149380ba7da1024c85bddecd8"/><file name="PressreleasesController.php" hash="c74babc7eebd457d19674268d9003fd6"/><file name="TestimonialsController.php" hash="7c9516d780449f11e7ff1c5d6b63aff7"/></dir><dir name="etc"><file name="config.xml" hash="a5f2f67b62b4ec5dd5953be034b8dcad"/></dir><dir name="Helper"><file name="Data.php" hash="c50f072bae13803ebf954c761b0648f9"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Profile"><file name="Collection.php" hash="e2e5ef61adc31deda69fd810f7b84a63"/></dir><file name="Profile.php" hash="563afa5d9e7ed2e5a9f60c2757c6d363"/></dir><file name="Profile.php" hash="8bf8c7234d5095c34d9cba62c0771607"/><file name="Status.php" hash="8f2e86119204c2ab3773f7d42ffe298f"/></dir><dir name="sql"><dir name="profile_setup"><file name="mysql4-install-0.1.0.php" hash="38b68ee314828fd4eb4e947f222b47ba"/></dir></dir></dir></dir></target></contents>
|
21 |
+
<compatible/>
|
22 |
+
<dependencies/>
|
23 |
+
</package>
|
skin/frontend/default/default/js/modalbox/modalbox.js
ADDED
@@ -0,0 +1,515 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
/*
|
2 |
+
ModalBox - The pop-up window thingie with AJAX, based on prototype and script.aculo.us.
|
3 |
+
|
4 |
+
Copyright Andrey Okonetchnikov (andrej.okonetschnikow@gmail.com), 2006-2007
|
5 |
+
All rights reserved.
|
6 |
+
|
7 |
+
VERSION 1.5.5
|
8 |
+
Last Modified: 09/06/2007
|
9 |
+
*/
|
10 |
+
|
11 |
+
if (!window.Modalbox)
|
12 |
+
var Modalbox = new Object();
|
13 |
+
|
14 |
+
Modalbox.Methods = {
|
15 |
+
overrideAlert: false, // Override standard browser alert message with ModalBox
|
16 |
+
focusableElements: new Array,
|
17 |
+
options: {
|
18 |
+
title: "ModalBox Window", // Title of the ModalBox window
|
19 |
+
overlayClose: true, // Close modal box by clicking on overlay
|
20 |
+
width: 500, // Default width in px
|
21 |
+
height: 90, // Default height in px
|
22 |
+
overlayOpacity: .75, // Default overlay opacity
|
23 |
+
overlayDuration: .25, // Default overlay fade in/out duration in seconds
|
24 |
+
slideDownDuration: .5, // Default Modalbox appear slide down effect in seconds
|
25 |
+
slideUpDuration: .15, // Default Modalbox hiding slide up effect in seconds
|
26 |
+
resizeDuration: .2, // Default resize duration seconds
|
27 |
+
inactiveFade: true, // Fades MB window on inactive state
|
28 |
+
transitions: true, // Toggles transition effects. Transitions are enabled by default
|
29 |
+
loadingString: "Please wait. Loading...", // Default loading string message
|
30 |
+
closeString: "Close window", // Default title attribute for close window link
|
31 |
+
params: {},
|
32 |
+
method: 'get' // Default Ajax request method
|
33 |
+
},
|
34 |
+
_options: new Object,
|
35 |
+
|
36 |
+
setOptions: function(options) {
|
37 |
+
Object.extend(this.options, options || {});
|
38 |
+
},
|
39 |
+
|
40 |
+
_init: function(options) {
|
41 |
+
// Setting up original options with default options
|
42 |
+
Object.extend(this._options, this.options);
|
43 |
+
this.setOptions(options);
|
44 |
+
//Create the overlay
|
45 |
+
this.MBoverlay = Builder.node("div", { id: "MB_overlay", opacity: "0" });
|
46 |
+
//Create the window
|
47 |
+
this.MBwindow = Builder.node("div", {id: "MB_window", style: "display: none"}, [
|
48 |
+
this.MBframe = Builder.node("div", {id: "MB_frame"}, [
|
49 |
+
this.MBheader = Builder.node("div", {id: "MB_header"}, [
|
50 |
+
this.MBcaption = Builder.node("div", {id: "MB_caption"}),
|
51 |
+
this.MBclose = Builder.node("a", {id: "MB_close", title: this.options.closeString, href: "#"}, [
|
52 |
+
Builder.build("<span>×</span>"),
|
53 |
+
]),
|
54 |
+
]),
|
55 |
+
this.MBcontent = Builder.node("div", {id: "MB_content"}, [
|
56 |
+
this.MBloading = Builder.node("div", {id: "MB_loading"}, this.options.loadingString),
|
57 |
+
]),
|
58 |
+
]),
|
59 |
+
]);
|
60 |
+
// Inserting into DOM
|
61 |
+
document.body.insertBefore(this.MBwindow, document.body.childNodes[0]);
|
62 |
+
document.body.insertBefore(this.MBoverlay, document.body.childNodes[0]);
|
63 |
+
|
64 |
+
// Initial scrolling position of the window. To be used for remove scrolling effect during ModalBox appearing
|
65 |
+
this.initScrollX = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft;
|
66 |
+
this.initScrollY = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
|
67 |
+
|
68 |
+
//Adding event observers
|
69 |
+
this.hide = this.hide.bindAsEventListener(this);
|
70 |
+
this.close = this._hide.bindAsEventListener(this);
|
71 |
+
this.kbdHandler = this.kbdHandler.bindAsEventListener(this);
|
72 |
+
this._initObservers();
|
73 |
+
|
74 |
+
this.initialized = true; // Mark as initialized
|
75 |
+
this.active = true; // Mark as active
|
76 |
+
this.currFocused = 0;
|
77 |
+
},
|
78 |
+
|
79 |
+
show: function(content, options) {
|
80 |
+
if(!this.initialized) this._init(options); // Check for is already initialized
|
81 |
+
|
82 |
+
this.content = content;
|
83 |
+
this.setOptions(options);
|
84 |
+
|
85 |
+
Element.update(this.MBcaption, this.options.title); // Updating title of the MB
|
86 |
+
|
87 |
+
if(this.MBwindow.style.display == "none") { // First modal box appearing
|
88 |
+
this._appear();
|
89 |
+
this.event("onShow"); // Passing onShow callback
|
90 |
+
}
|
91 |
+
else { // If MB already on the screen, update it
|
92 |
+
this._update();
|
93 |
+
this.event("onUpdate"); // Passing onUpdate callback
|
94 |
+
}
|
95 |
+
},
|
96 |
+
|
97 |
+
hide: function(options) { // External hide method to use from external HTML and JS
|
98 |
+
if(this.initialized) {
|
99 |
+
if(options) Object.extend(this.options, options); // Passing callbacks
|
100 |
+
if(this.options.transitions)
|
101 |
+
Effect.SlideUp(this.MBwindow, { duration: this.options.slideUpDuration, afterFinish: this._deinit.bind(this) } );
|
102 |
+
else {
|
103 |
+
Element.hide(this.MBwindow);
|
104 |
+
this._deinit();
|
105 |
+
}
|
106 |
+
} else throw("Modalbox isn't initialized");
|
107 |
+
},
|
108 |
+
|
109 |
+
alert: function(message){
|
110 |
+
var html = '<div class="MB_alert"><p>' + message + '</p><input type="button" onclick="Modalbox.hide()" value="OK" /></div>';
|
111 |
+
Modalbox.show(html, {title: 'Alert: ' + document.title, width: 300});
|
112 |
+
},
|
113 |
+
|
114 |
+
_hide: function(event) { // Internal hide method to use inside MB class
|
115 |
+
if(event) Event.stop(event);
|
116 |
+
this.hide();
|
117 |
+
},
|
118 |
+
|
119 |
+
_appear: function() { // First appearing of MB
|
120 |
+
if (navigator.appVersion.match(/\bMSIE\b/))
|
121 |
+
this._toggleSelects();
|
122 |
+
this._setOverlay();
|
123 |
+
this._setWidth();
|
124 |
+
this._setPosition();
|
125 |
+
if(this.options.transitions) {
|
126 |
+
Element.setStyle(this.MBoverlay, {opacity: 0});
|
127 |
+
new Effect.Fade(this.MBoverlay, {
|
128 |
+
from: 0,
|
129 |
+
to: this.options.overlayOpacity,
|
130 |
+
duration: this.options.overlayDuration,
|
131 |
+
afterFinish: function() {
|
132 |
+
new Effect.SlideDown(this.MBwindow, {
|
133 |
+
duration: this.options.slideDownDuration,
|
134 |
+
afterFinish: function(){
|
135 |
+
this._setPosition();
|
136 |
+
this.loadContent();
|
137 |
+
}.bind(this)
|
138 |
+
});
|
139 |
+
}.bind(this)
|
140 |
+
});
|
141 |
+
} else {
|
142 |
+
Element.setStyle(this.MBoverlay, {opacity: this.options.overlayOpacity});
|
143 |
+
Element.show(this.MBwindow);
|
144 |
+
this._setPosition();
|
145 |
+
this.loadContent();
|
146 |
+
}
|
147 |
+
this._setWidthAndPosition = this._setWidthAndPosition.bindAsEventListener(this);
|
148 |
+
Event.observe(window, "resize", this._setWidthAndPosition);
|
149 |
+
},
|
150 |
+
|
151 |
+
resize: function(byWidth, byHeight, options) { // Change size of MB without loading content
|
152 |
+
var wHeight = Element.getHeight(this.MBwindow);
|
153 |
+
var wWidth = Element.getWidth(this.MBwindow);
|
154 |
+
var hHeight = Element.getHeight(this.MBheader);
|
155 |
+
var cHeight = Element.getHeight(this.MBcontent);
|
156 |
+
var newHeight = ((wHeight - hHeight + byHeight) < cHeight) ? (cHeight + hHeight - wHeight) : byHeight;
|
157 |
+
this.setOptions(options); // Passing callbacks
|
158 |
+
if(this.options.transitions) {
|
159 |
+
new Effect.ScaleBy(this.MBwindow, byWidth, newHeight, {
|
160 |
+
duration: this.options.resizeDuration,
|
161 |
+
afterFinish: function() {
|
162 |
+
this.event("_afterResize"); // Passing internal callback
|
163 |
+
this.event("afterResize"); // Passing callback
|
164 |
+
}.bind(this)
|
165 |
+
});
|
166 |
+
} else {
|
167 |
+
this.MBwindow.setStyle({width: wWidth + byWidth + "px", height: wHeight + newHeight + "px"});
|
168 |
+
setTimeout(function() {
|
169 |
+
this.event("_afterResize"); // Passing internal callback
|
170 |
+
this.event("afterResize"); // Passing callback
|
171 |
+
}.bind(this), 1);
|
172 |
+
|
173 |
+
}
|
174 |
+
|
175 |
+
},
|
176 |
+
|
177 |
+
_update: function() { // Updating MB in case of wizards
|
178 |
+
Element.update(this.MBcontent, "");
|
179 |
+
this.MBcontent.appendChild(this.MBloading);
|
180 |
+
Element.update(this.MBloading, this.options.loadingString);
|
181 |
+
this.currentDims = [this.MBwindow.offsetWidth, this.MBwindow.offsetHeight];
|
182 |
+
Modalbox.resize((this.options.width - this.currentDims[0]), (this.options.height - this.currentDims[1]), {_afterResize: this._loadAfterResize.bind(this) });
|
183 |
+
},
|
184 |
+
|
185 |
+
loadContent: function () {
|
186 |
+
if(this.event("beforeLoad") != false) { // If callback passed false, skip loading of the content
|
187 |
+
if(typeof this.content == 'string') {
|
188 |
+
|
189 |
+
var htmlRegExp = new RegExp(/<\/?[^>]+>/gi);
|
190 |
+
if(htmlRegExp.test(this.content)) { // Plain HTML given as a parameter
|
191 |
+
this._insertContent(this.content);
|
192 |
+
this._putContent();
|
193 |
+
} else
|
194 |
+
new Ajax.Request( this.content, { method: this.options.method.toLowerCase(), parameters: this.options.params,
|
195 |
+
onComplete: function(transport) {
|
196 |
+
var response = new String(transport.responseText);
|
197 |
+
this._insertContent(transport.responseText.stripScripts());
|
198 |
+
response.extractScripts().map(function(script) {
|
199 |
+
return eval(script.replace("<!--", "").replace("// -->", ""));
|
200 |
+
}.bind(window));
|
201 |
+
this._putContent();
|
202 |
+
}.bind(this)
|
203 |
+
});
|
204 |
+
|
205 |
+
} else if (typeof this.content == 'object') {// HTML Object is given
|
206 |
+
this._insertContent(this.content);
|
207 |
+
this._putContent();
|
208 |
+
} else {
|
209 |
+
Modalbox.hide();
|
210 |
+
throw('Please specify correct URL or HTML element (plain HTML or object)');
|
211 |
+
}
|
212 |
+
}
|
213 |
+
},
|
214 |
+
|
215 |
+
_insertContent: function(content){
|
216 |
+
Element.extend(this.MBcontent);
|
217 |
+
this.MBcontent.update("");
|
218 |
+
if(typeof content == 'string')
|
219 |
+
this.MBcontent.hide().update(content);
|
220 |
+
else if (typeof this.content == 'object') { // HTML Object is given
|
221 |
+
var _htmlObj = content.cloneNode(true); // If node already a part of DOM we'll clone it
|
222 |
+
// If clonable element has ID attribute defined, modifying it to prevent duplicates
|
223 |
+
if(this.content.id) this.content.id = "MB_" + this.content.id;
|
224 |
+
/* Add prefix for IDs on all elements inside the DOM node */
|
225 |
+
this.content.getElementsBySelector('*[id]').each(function(el){ el.id = "MB_" + el.id });
|
226 |
+
this.MBcontent.hide().appendChild(_htmlObj);
|
227 |
+
this.MBcontent.down().show(); // Toggle visibility for hidden nodes
|
228 |
+
}
|
229 |
+
},
|
230 |
+
|
231 |
+
_putContent: function(){
|
232 |
+
// Prepare and resize modal box for content
|
233 |
+
if(this.options.height == this._options.height)
|
234 |
+
Modalbox.resize(0, this.MBcontent.getHeight() - Element.getHeight(this.MBwindow) + Element.getHeight(this.MBheader), {
|
235 |
+
afterResize: function(){
|
236 |
+
this.MBcontent.show();
|
237 |
+
this.focusableElements = this._findFocusableElements();
|
238 |
+
this._setFocus(); // Setting focus on first 'focusable' element in content (input, select, textarea, link or button)
|
239 |
+
this.event("afterLoad"); // Passing callback
|
240 |
+
}.bind(this)
|
241 |
+
});
|
242 |
+
else { // Height is defined. Creating a scrollable window
|
243 |
+
this._setWidth();
|
244 |
+
this.MBcontent.setStyle({overflow: 'auto', height: Element.getHeight(this.MBwindow) - Element.getHeight(this.MBheader) - 13 + 'px'});
|
245 |
+
this.MBcontent.show();
|
246 |
+
this.focusableElements = this._findFocusableElements();
|
247 |
+
this._setFocus(); // Setting focus on first 'focusable' element in content (input, select, textarea, link or button)
|
248 |
+
this.event("afterLoad"); // Passing callback
|
249 |
+
}
|
250 |
+
},
|
251 |
+
|
252 |
+
activate: function(options){
|
253 |
+
this.setOptions(options);
|
254 |
+
this.active = true;
|
255 |
+
Event.observe(this.MBclose, "click", this.close);
|
256 |
+
if(this.options.overlayClose) Event.observe(this.MBoverlay, "click", this.hide);
|
257 |
+
Element.show(this.MBclose);
|
258 |
+
if(this.options.transitions && this.options.inactiveFade) new Effect.Appear(this.MBwindow, {duration: this.options.slideUpDuration});
|
259 |
+
},
|
260 |
+
|
261 |
+
deactivate: function(options) {
|
262 |
+
this.setOptions(options);
|
263 |
+
this.active = false;
|
264 |
+
Event.stopObserving(this.MBclose, "click", this.close);
|
265 |
+
if(this.options.overlayClose) Event.stopObserving(this.MBoverlay, "click", this.hide);
|
266 |
+
Element.hide(this.MBclose);
|
267 |
+
if(this.options.transitions && this.options.inactiveFade) new Effect.Fade(this.MBwindow, {duration: this.options.slideUpDuration, to: .75});
|
268 |
+
},
|
269 |
+
|
270 |
+
_initObservers: function(){
|
271 |
+
Event.observe(this.MBclose, "click", this.close);
|
272 |
+
if(this.options.overlayClose) Event.observe(this.MBoverlay, "click", this.hide);
|
273 |
+
Event.observe(document, "keypress", Modalbox.kbdHandler );
|
274 |
+
},
|
275 |
+
|
276 |
+
_removeObservers: function(){
|
277 |
+
Event.stopObserving(this.MBclose, "click", this.close);
|
278 |
+
if(this.options.overlayClose) Event.stopObserving(this.MBoverlay, "click", this.hide);
|
279 |
+
Event.stopObserving(document, "keypress", Modalbox.kbdHandler );
|
280 |
+
},
|
281 |
+
|
282 |
+
_loadAfterResize: function() {
|
283 |
+
this._setWidth();
|
284 |
+
this._setPosition();
|
285 |
+
this.loadContent();
|
286 |
+
},
|
287 |
+
|
288 |
+
_setFocus: function() { // Setting focus to be looped inside current MB
|
289 |
+
if(this.focusableElements.length > 0) {
|
290 |
+
var i = 0;
|
291 |
+
var firstEl = this.focusableElements.find(function findFirst(el){
|
292 |
+
i++;
|
293 |
+
return el.tabIndex == 1;
|
294 |
+
}) || this.focusableElements.first();
|
295 |
+
this.currFocused = (i == this.focusableElements.length - 1) ? (i-1) : 0;
|
296 |
+
firstEl.focus(); // Focus on first focusable element except close button
|
297 |
+
} else
|
298 |
+
$("MB_close").focus(); // If no focusable elements exist focus on close button
|
299 |
+
},
|
300 |
+
|
301 |
+
_findFocusableElements: function(){ // Collect form elements or links from MB content
|
302 |
+
var els = this.MBcontent.getElementsBySelector('input:not([type~=hidden]), select, textarea, button, a[href]');
|
303 |
+
els.invoke('addClassName', 'MB_focusable');
|
304 |
+
return this.MBcontent.getElementsByClassName('MB_focusable');
|
305 |
+
},
|
306 |
+
|
307 |
+
kbdHandler: function(e) {
|
308 |
+
var node = Event.element(e);
|
309 |
+
switch(e.keyCode) {
|
310 |
+
case Event.KEY_TAB:
|
311 |
+
Event.stop(e);
|
312 |
+
if(!e.shiftKey) { //Focusing in direct order
|
313 |
+
if(this.currFocused == this.focusableElements.length - 1) {
|
314 |
+
this.focusableElements.first().focus();
|
315 |
+
this.currFocused = 0;
|
316 |
+
} else {
|
317 |
+
this.currFocused++;
|
318 |
+
this.focusableElements[this.currFocused].focus();
|
319 |
+
}
|
320 |
+
} else { // Shift key is pressed. Focusing in reverse order
|
321 |
+
if(this.currFocused == 0) {
|
322 |
+
this.focusableElements.last().focus();
|
323 |
+
this.currFocused = this.focusableElements.length - 1;
|
324 |
+
} else {
|
325 |
+
this.currFocused--;
|
326 |
+
this.focusableElements[this.currFocused].focus();
|
327 |
+
}
|
328 |
+
}
|
329 |
+
break;
|
330 |
+
case Event.KEY_ESC:
|
331 |
+
if(this.active) this._hide(e);
|
332 |
+
break;
|
333 |
+
case 32:
|
334 |
+
this._preventScroll(e);
|
335 |
+
break;
|
336 |
+
case 0: // For Gecko browsers compatibility
|
337 |
+
if(e.which == 32) this._preventScroll(e);
|
338 |
+
break;
|
339 |
+
case Event.KEY_UP:
|
340 |
+
case Event.KEY_DOWN:
|
341 |
+
case Event.KEY_PAGEDOWN:
|
342 |
+
case Event.KEY_PAGEUP:
|
343 |
+
case Event.KEY_HOME:
|
344 |
+
case Event.KEY_END:
|
345 |
+
// Safari operates in slightly different way. This realization is still buggy in Safari.
|
346 |
+
if(/Safari|KHTML/.test(navigator.userAgent) && !["textarea", "select"].include(node.tagName.toLowerCase()))
|
347 |
+
Event.stop(e);
|
348 |
+
else if( (node.tagName.toLowerCase() == "input" && ["submit", "button"].include(node.type)) || (node.tagName.toLowerCase() == "a") )
|
349 |
+
Event.stop(e);
|
350 |
+
break;
|
351 |
+
}
|
352 |
+
},
|
353 |
+
|
354 |
+
_preventScroll: function(event) { // Disabling scrolling by "space" key
|
355 |
+
if(!["input", "textarea", "select", "button"].include(Event.element(event).tagName.toLowerCase()))
|
356 |
+
Event.stop(event);
|
357 |
+
},
|
358 |
+
|
359 |
+
_deinit: function()
|
360 |
+
{
|
361 |
+
this._removeObservers();
|
362 |
+
Event.stopObserving(window, "resize", this._setWidthAndPosition );
|
363 |
+
if(this.options.transitions) {
|
364 |
+
Effect.toggle(this.MBoverlay, 'appear', {duration: this.options.overlayDuration, afterFinish: this._removeElements.bind(this) });
|
365 |
+
} else {
|
366 |
+
this.MBoverlay.hide();
|
367 |
+
this._removeElements();
|
368 |
+
}
|
369 |
+
Element.setStyle(this.MBcontent, {overflow: '', height: ''});
|
370 |
+
},
|
371 |
+
|
372 |
+
_removeElements: function () {
|
373 |
+
if (navigator.appVersion.match(/\bMSIE\b/)) {
|
374 |
+
this._prepareIE("", ""); // If set to auto MSIE will show horizontal scrolling
|
375 |
+
window.scrollTo(this.initScrollX, this.initScrollY);
|
376 |
+
}
|
377 |
+
Element.remove(this.MBoverlay);
|
378 |
+
Element.remove(this.MBwindow);
|
379 |
+
|
380 |
+
/* Replacing prefixes 'MB_' in IDs for the original content */
|
381 |
+
if(typeof this.content == 'object' && this.content.id && this.content.id.match(/MB_/)) {
|
382 |
+
this.content.getElementsBySelector('*[id]').each(function(el){ el.id = el.id.replace(/MB_/, ""); });
|
383 |
+
this.content.id = this.content.id.replace(/MB_/, "");
|
384 |
+
}
|
385 |
+
/* Initialized will be set to false */
|
386 |
+
this.initialized = false;
|
387 |
+
|
388 |
+
if (navigator.appVersion.match(/\bMSIE\b/))
|
389 |
+
this._toggleSelects(); // Toggle back 'select' elements in IE
|
390 |
+
this.event("afterHide"); // Passing afterHide callback
|
391 |
+
this.setOptions(this._options); //Settings options object into intial state
|
392 |
+
},
|
393 |
+
|
394 |
+
_setOverlay: function () {
|
395 |
+
if (navigator.appVersion.match(/\bMSIE\b/)) {
|
396 |
+
this._prepareIE("100%", "hidden");
|
397 |
+
if (!navigator.appVersion.match(/\b7.0\b/)) window.scrollTo(0,0); // Disable scrolling on top for IE7
|
398 |
+
}
|
399 |
+
},
|
400 |
+
|
401 |
+
_setWidth: function () { //Set size
|
402 |
+
Element.setStyle(this.MBwindow, {width: this.options.width + "px", height: this.options.height + "px"});
|
403 |
+
},
|
404 |
+
|
405 |
+
_setPosition: function () {
|
406 |
+
Element.setStyle(this.MBwindow, {left: Math.round((Element.getWidth(document.body) - Element.getWidth(this.MBwindow)) / 2 ) + "px"});
|
407 |
+
},
|
408 |
+
|
409 |
+
_setWidthAndPosition: function () {
|
410 |
+
Element.setStyle(this.MBwindow, {width: this.options.width + "px"});
|
411 |
+
this._setPosition();
|
412 |
+
},
|
413 |
+
|
414 |
+
_getScrollTop: function () { //From: http://www.quirksmode.org/js/doctypes.html
|
415 |
+
var theTop;
|
416 |
+
if (document.documentElement && document.documentElement.scrollTop)
|
417 |
+
theTop = document.documentElement.scrollTop;
|
418 |
+
else if (document.body)
|
419 |
+
theTop = document.body.scrollTop;
|
420 |
+
return theTop;
|
421 |
+
},
|
422 |
+
// For IE browsers -- IE requires height to 100% and overflow hidden (taken from lightbox)
|
423 |
+
_prepareIE: function(height, overflow){
|
424 |
+
var body = document.getElementsByTagName('body')[0];
|
425 |
+
body.style.height = height;
|
426 |
+
body.style.overflow = overflow;
|
427 |
+
|
428 |
+
var html = document.getElementsByTagName('html')[0];
|
429 |
+
html.style.height = height;
|
430 |
+
html.style.overflow = overflow;
|
431 |
+
},
|
432 |
+
// For IE browsers -- hiding all SELECT elements
|
433 |
+
_toggleSelects: function() {
|
434 |
+
var selects = $$("select");
|
435 |
+
if(this.initialized) {
|
436 |
+
selects.invoke('setStyle', {'visibility': 'hidden'});
|
437 |
+
} else {
|
438 |
+
selects.invoke('setStyle', {'visibility': ''});
|
439 |
+
}
|
440 |
+
|
441 |
+
},
|
442 |
+
event: function(eventName) {
|
443 |
+
if(this.options[eventName]) {
|
444 |
+
var returnValue = this.options[eventName](); // Executing callback
|
445 |
+
this.options[eventName] = null; // Removing callback after execution
|
446 |
+
if(returnValue != undefined)
|
447 |
+
return returnValue;
|
448 |
+
else
|
449 |
+
return true;
|
450 |
+
}
|
451 |
+
return true;
|
452 |
+
}
|
453 |
+
}
|
454 |
+
|
455 |
+
Object.extend(Modalbox, Modalbox.Methods);
|
456 |
+
|
457 |
+
if(Modalbox.overrideAlert) window.alert = Modalbox.alert;
|
458 |
+
|
459 |
+
Effect.ScaleBy = Class.create();
|
460 |
+
Object.extend(Object.extend(Effect.ScaleBy.prototype, Effect.Base.prototype), {
|
461 |
+
initialize: function(element, byWidth, byHeight, options) {
|
462 |
+
this.element = $(element)
|
463 |
+
var options = Object.extend({
|
464 |
+
scaleFromTop: true,
|
465 |
+
scaleMode: 'box', // 'box' or 'contents' or {} with provided values
|
466 |
+
scaleByWidth: byWidth,
|
467 |
+
scaleByHeight: byHeight
|
468 |
+
}, arguments[3] || {});
|
469 |
+
this.start(options);
|
470 |
+
},
|
471 |
+
setup: function() {
|
472 |
+
this.elementPositioning = this.element.getStyle('position');
|
473 |
+
|
474 |
+
this.originalTop = this.element.offsetTop;
|
475 |
+
this.originalLeft = this.element.offsetLeft;
|
476 |
+
|
477 |
+
this.dims = null;
|
478 |
+
if(this.options.scaleMode=='box')
|
479 |
+
this.dims = [this.element.offsetHeight, this.element.offsetWidth];
|
480 |
+
if(/^content/.test(this.options.scaleMode))
|
481 |
+
this.dims = [this.element.scrollHeight, this.element.scrollWidth];
|
482 |
+
if(!this.dims)
|
483 |
+
this.dims = [this.options.scaleMode.originalHeight,
|
484 |
+
this.options.scaleMode.originalWidth];
|
485 |
+
|
486 |
+
this.deltaY = this.options.scaleByHeight;
|
487 |
+
this.deltaX = this.options.scaleByWidth;
|
488 |
+
},
|
489 |
+
update: function(position) {
|
490 |
+
var currentHeight = this.dims[0] + (this.deltaY * position);
|
491 |
+
var currentWidth = this.dims[1] + (this.deltaX * position);
|
492 |
+
|
493 |
+
currentHeight = (currentHeight > 0) ? currentHeight : 0;
|
494 |
+
currentWidth = (currentWidth > 0) ? currentWidth : 0;
|
495 |
+
|
496 |
+
this.setDimensions(currentHeight, currentWidth);
|
497 |
+
},
|
498 |
+
|
499 |
+
setDimensions: function(height, width) {
|
500 |
+
var d = {};
|
501 |
+
d.width = width + 'px';
|
502 |
+
d.height = height + 'px';
|
503 |
+
|
504 |
+
var topd = Math.round((height - this.dims[0])/2);
|
505 |
+
var leftd = Math.round((width - this.dims[1])/2);
|
506 |
+
if(this.elementPositioning == 'absolute' || this.elementPositioning == 'fixed') {
|
507 |
+
if(!this.options.scaleFromTop) d.top = this.originalTop-topd + 'px';
|
508 |
+
d.left = this.originalLeft-leftd + 'px';
|
509 |
+
} else {
|
510 |
+
if(!this.options.scaleFromTop) d.top = -topd + 'px';
|
511 |
+
d.left = -leftd + 'px';
|
512 |
+
}
|
513 |
+
this.element.setStyle(d);
|
514 |
+
}
|
515 |
+
});
|