Version Notes
Precious Metals Pricing Widgets from nFusion Solutions
Download this release
Release Info
Developer | nFusion Solutions |
Extension | Nfusionsolutions_NfusionWidgets |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/community/Nfusionsolutions/NfusionWidgets/Block/Adminhtml/Nfusionwidgets.php +17 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/Block/Adminhtml/Nfusionwidgets/Edit.php +44 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/Block/Adminhtml/Nfusionwidgets/Edit/Form.php +17 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/Block/Adminhtml/Nfusionwidgets/Edit/Tab/Form.php +56 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/Block/Adminhtml/Nfusionwidgets/Edit/Tabs.php +21 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/Block/Adminhtml/Nfusionwidgets/Grid.php +119 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/Block/Nfusionwidgets.php +18 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/Block/Widget/Block.php +107 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/Block/Widget/Fieldcustom.php +44 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/Helper/Data.php +5 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/Model/Mysql4/Nfusionwidgets.php +8 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/Model/Mysql4/Nfusionwidgets/Collection.php +12 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/Model/Nfusionwidgets.php +12 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/Model/Source/Widgetslist.php +52 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/controllers/Adminhtml/NfusionwidgetsController.php +165 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/etc/config.xml +114 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/etc/widget.xml +56 -0
- app/code/community/Nfusionsolutions/NfusionWidgets/sql/nfusionwidgets_setup/mysql4-install-0.1.0.php +15 -0
- app/design/adminhtml/default/default/layout/nfusionwidgets.xml +8 -0
- app/design/frontend/base/default/template/nfusionwidgets/widget/default.phtml +26 -0
- app/etc/modules/Nfusionsolutions_NfusionWidgets.xml +13 -0
- package.xml +18 -0
app/code/community/Nfusionsolutions/NfusionWidgets/Block/Adminhtml/Nfusionwidgets.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Nfusionsolutions_NfusionWidgets_Block_Adminhtml_Nfusionwidgets extends Mage_Adminhtml_Block_Widget_Grid_Container{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
|
9 |
+
$this->_controller = "adminhtml_nfusionwidgets";
|
10 |
+
$this->_blockGroup = "nfusionwidgets";
|
11 |
+
$this->_headerText = Mage::helper("nfusionwidgets")->__("nFusion Widgets Settings");
|
12 |
+
$this->_addButtonLabel = Mage::helper("nfusionwidgets")->__("Add New Item");
|
13 |
+
parent::__construct();
|
14 |
+
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
app/code/community/Nfusionsolutions/NfusionWidgets/Block/Adminhtml/Nfusionwidgets/Edit.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Nfusionsolutions_NfusionWidgets_Block_Adminhtml_Nfusionwidgets_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
|
8 |
+
parent::__construct();
|
9 |
+
$this->_objectId = "id";
|
10 |
+
$this->_blockGroup = "nfusionwidgets";
|
11 |
+
$this->_controller = "adminhtml_nfusionwidgets";
|
12 |
+
$this->_updateButton("save", "label", Mage::helper("nfusionwidgets")->__("Save Item"));
|
13 |
+
$this->_updateButton("delete", "label", Mage::helper("nfusionwidgets")->__("Delete Item"));
|
14 |
+
|
15 |
+
$this->_addButton("saveandcontinue", array(
|
16 |
+
"label" => Mage::helper("nfusionwidgets")->__("Save And Continue Edit"),
|
17 |
+
"onclick" => "saveAndContinueEdit()",
|
18 |
+
"class" => "save",
|
19 |
+
), -100);
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
$this->_formScripts[] = "
|
24 |
+
|
25 |
+
function saveAndContinueEdit(){
|
26 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
27 |
+
}
|
28 |
+
";
|
29 |
+
}
|
30 |
+
|
31 |
+
public function getHeaderText()
|
32 |
+
{
|
33 |
+
if( Mage::registry("nfusionwidgets_data") && Mage::registry("nfusionwidgets_data")->getId() ){
|
34 |
+
|
35 |
+
return Mage::helper("nfusionwidgets")->__("Edit Item '%s'", $this->htmlEscape(Mage::registry("nfusionwidgets_data")->getId()));
|
36 |
+
|
37 |
+
}
|
38 |
+
else{
|
39 |
+
|
40 |
+
return Mage::helper("nfusionwidgets")->__("Add Item");
|
41 |
+
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
app/code/community/Nfusionsolutions/NfusionWidgets/Block/Adminhtml/Nfusionwidgets/Edit/Form.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Nfusionsolutions_NfusionWidgets_Block_Adminhtml_Nfusionwidgets_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
3 |
+
{
|
4 |
+
protected function _prepareForm()
|
5 |
+
{
|
6 |
+
$form = new Varien_Data_Form(array(
|
7 |
+
"id" => "edit_form",
|
8 |
+
"action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))),
|
9 |
+
"method" => "post",
|
10 |
+
"enctype" =>"multipart/form-data",
|
11 |
+
)
|
12 |
+
);
|
13 |
+
$form->setUseContainer(true);
|
14 |
+
$this->setForm($form);
|
15 |
+
return parent::_prepareForm();
|
16 |
+
}
|
17 |
+
}
|
app/code/community/Nfusionsolutions/NfusionWidgets/Block/Adminhtml/Nfusionwidgets/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Nfusionsolutions_NfusionWidgets_Block_Adminhtml_Nfusionwidgets_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
3 |
+
{
|
4 |
+
protected function _prepareForm()
|
5 |
+
{
|
6 |
+
|
7 |
+
$form = new Varien_Data_Form();
|
8 |
+
$this->setForm($form);
|
9 |
+
$fieldset = $form->addFieldset("nfusionwidgets_form", array("legend"=>Mage::helper("nfusionwidgets")->__("Item information")));
|
10 |
+
|
11 |
+
|
12 |
+
$fieldset->addField("name", "text", array(
|
13 |
+
"label" => Mage::helper("nfusionwidgets")->__("Widget Name"),
|
14 |
+
"class" => "required-entry",
|
15 |
+
"required" => true,
|
16 |
+
"name" => "name",
|
17 |
+
));
|
18 |
+
|
19 |
+
$fieldset->addField("chart_code", "textarea", array(
|
20 |
+
"label" => Mage::helper("nfusionwidgets")->__("Widget URL"),
|
21 |
+
"class" => "required-entry",
|
22 |
+
"required" => true,
|
23 |
+
"name" => "chart_code",
|
24 |
+
));
|
25 |
+
|
26 |
+
/*$fieldset->addField('type', 'select', array(
|
27 |
+
'label' => Mage::helper('nfusionwidgets')->__('Chart Type'),
|
28 |
+
'values' => Nfusionsolutions_NfusionWidgets_Block_Adminhtml_Nfusionwidgets_Grid::getValueArray3(),
|
29 |
+
'name' => 'type',
|
30 |
+
"class" => "required-entry",
|
31 |
+
"required" => true,
|
32 |
+
));
|
33 |
+
$fieldset->addField("chart_width", "text", array(
|
34 |
+
"label" => Mage::helper("nfusionwidgets")->__("Width"),
|
35 |
+
"name" => "chart_width",
|
36 |
+
));
|
37 |
+
|
38 |
+
$fieldset->addField('status', 'select', array(
|
39 |
+
'label' => Mage::helper('nfusionwidgets')->__('Status'),
|
40 |
+
'values' => Nfusionsolutions_NfusionWidgets_Block_Adminhtml_Nfusionwidgets_Grid::getValueArray5(),
|
41 |
+
'name' => 'status',
|
42 |
+
"class" => "required-entry",
|
43 |
+
"required" => true,
|
44 |
+
));*/
|
45 |
+
|
46 |
+
if (Mage::getSingleton("adminhtml/session")->getNfusionwidgetsData())
|
47 |
+
{
|
48 |
+
$form->setValues(Mage::getSingleton("adminhtml/session")->getNfusionwidgetsData());
|
49 |
+
Mage::getSingleton("adminhtml/session")->setNfusionwidgetsData(null);
|
50 |
+
}
|
51 |
+
elseif(Mage::registry("nfusionwidgets_data")) {
|
52 |
+
$form->setValues(Mage::registry("nfusionwidgets_data")->getData());
|
53 |
+
}
|
54 |
+
return parent::_prepareForm();
|
55 |
+
}
|
56 |
+
}
|
app/code/community/Nfusionsolutions/NfusionWidgets/Block/Adminhtml/Nfusionwidgets/Edit/Tabs.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Nfusionsolutions_NfusionWidgets_Block_Adminhtml_Nfusionwidgets_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId("nfusionwidgets_tabs");
|
8 |
+
$this->setDestElementId("edit_form");
|
9 |
+
$this->setTitle(Mage::helper("nfusionwidgets")->__("Item Information"));
|
10 |
+
}
|
11 |
+
protected function _beforeToHtml()
|
12 |
+
{
|
13 |
+
$this->addTab("form_section", array(
|
14 |
+
"label" => Mage::helper("nfusionwidgets")->__("Item Information"),
|
15 |
+
"title" => Mage::helper("nfusionwidgets")->__("Item Information"),
|
16 |
+
"content" => $this->getLayout()->createBlock("nfusionwidgets/adminhtml_nfusionwidgets_edit_tab_form")->toHtml(),
|
17 |
+
));
|
18 |
+
return parent::_beforeToHtml();
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/community/Nfusionsolutions/NfusionWidgets/Block/Adminhtml/Nfusionwidgets/Grid.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Nfusionsolutions_NfusionWidgets_Block_Adminhtml_Nfusionwidgets_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId("nfusionwidgetsGrid");
|
10 |
+
$this->setDefaultSort("id");
|
11 |
+
$this->setDefaultDir("DESC");
|
12 |
+
$this->setSaveParametersInSession(true);
|
13 |
+
}
|
14 |
+
|
15 |
+
protected function _prepareCollection()
|
16 |
+
{
|
17 |
+
$collection = Mage::getModel("nfusionwidgets/nfusionwidgets")->getCollection();
|
18 |
+
$this->setCollection($collection);
|
19 |
+
return parent::_prepareCollection();
|
20 |
+
}
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn("id", array(
|
24 |
+
"header" => Mage::helper("nfusionwidgets")->__("ID"),
|
25 |
+
"align" =>"right",
|
26 |
+
"width" => "50px",
|
27 |
+
"type" => "number",
|
28 |
+
"index" => "id",
|
29 |
+
));
|
30 |
+
|
31 |
+
$this->addColumn("name", array(
|
32 |
+
"header" => Mage::helper("nfusionwidgets")->__("Widget Name"),
|
33 |
+
"index" => "name",
|
34 |
+
));
|
35 |
+
$this->addColumn("chart_code", array(
|
36 |
+
"header" => Mage::helper("nfusionwidgets")->__("Widget Code"),
|
37 |
+
"index" => "chart_code",
|
38 |
+
));
|
39 |
+
/*$this->addColumn('type', array(
|
40 |
+
'header' => Mage::helper('nfusionwidgets')->__('Chart Type'),
|
41 |
+
'index' => 'type',
|
42 |
+
'type' => 'options',
|
43 |
+
'options'=>Nfusionsolutions_NfusionWidgets_Block_Adminhtml_Nfusionwidgets_Grid::getOptionArray3(),
|
44 |
+
));
|
45 |
+
|
46 |
+
$this->addColumn("chart_width", array(
|
47 |
+
"header" => Mage::helper("nfusionwidgets")->__("Width"),
|
48 |
+
"index" => "chart_width",
|
49 |
+
));
|
50 |
+
$this->addColumn('status', array(
|
51 |
+
'header' => Mage::helper('nfusionwidgets')->__('Status'),
|
52 |
+
'index' => 'status',
|
53 |
+
'type' => 'options',
|
54 |
+
'options'=>Nfusionsolutions_NfusionWidgets_Block_Adminhtml_Nfusionwidgets_Grid::getOptionArray5(),
|
55 |
+
));*/
|
56 |
+
|
57 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
58 |
+
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
|
59 |
+
|
60 |
+
return parent::_prepareColumns();
|
61 |
+
}
|
62 |
+
|
63 |
+
public function getRowUrl($row)
|
64 |
+
{
|
65 |
+
return $this->getUrl("*/*/edit", array("id" => $row->getId()));
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
protected function _prepareMassaction()
|
71 |
+
{
|
72 |
+
$this->setMassactionIdField('id');
|
73 |
+
$this->getMassactionBlock()->setFormFieldName('ids');
|
74 |
+
$this->getMassactionBlock()->setUseSelectAll(true);
|
75 |
+
$this->getMassactionBlock()->addItem('remove_nfusionwidgets', array(
|
76 |
+
'label'=> Mage::helper('nfusionwidgets')->__('Remove Nfusionwidgets'),
|
77 |
+
'url' => $this->getUrl('*/adminhtml_nfusionwidgets/massRemove'),
|
78 |
+
'confirm' => Mage::helper('nfusionwidgets')->__('Are you sure?')
|
79 |
+
));
|
80 |
+
return $this;
|
81 |
+
}
|
82 |
+
|
83 |
+
static public function getOptionArray3()
|
84 |
+
{
|
85 |
+
$data_array=array();
|
86 |
+
$data_array[0]='Accordion Chart';
|
87 |
+
$data_array[1]='Scrolling Ticker';
|
88 |
+
$data_array[2]='Large Historical Chart';
|
89 |
+
return($data_array);
|
90 |
+
}
|
91 |
+
static public function getValueArray3()
|
92 |
+
{
|
93 |
+
$data_array=array();
|
94 |
+
foreach(Nfusionsolutions_NfusionWidgets_Block_Adminhtml_Nfusionwidgets_Grid::getOptionArray3() as $k=>$v){
|
95 |
+
$data_array[]=array('value'=>$k,'label'=>$v);
|
96 |
+
}
|
97 |
+
return($data_array);
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
static public function getOptionArray5()
|
102 |
+
{
|
103 |
+
$data_array=array();
|
104 |
+
$data_array[0]='Disable';
|
105 |
+
$data_array[1]='Enable';
|
106 |
+
return($data_array);
|
107 |
+
}
|
108 |
+
static public function getValueArray5()
|
109 |
+
{
|
110 |
+
$data_array=array();
|
111 |
+
foreach(Nfusionsolutions_NfusionWidgets_Block_Adminhtml_Nfusionwidgets_Grid::getOptionArray5() as $k=>$v){
|
112 |
+
$data_array[]=array('value'=>$k,'label'=>$v);
|
113 |
+
}
|
114 |
+
return($data_array);
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
}
|
app/code/community/Nfusionsolutions/NfusionWidgets/Block/Nfusionwidgets.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Nfusionsolutions_NfusionWidgets_Block_Nfusionwidgets
|
3 |
+
extends Mage_Core_Block_Template
|
4 |
+
implements Mage_Widget_Block_Interface
|
5 |
+
{
|
6 |
+
|
7 |
+
protected function _toHtml()
|
8 |
+
{
|
9 |
+
$html ='';
|
10 |
+
$html .= 'nfusionwidgets parameter1 = '.$this->getData('parameter1').'<br/>';
|
11 |
+
$html .= 'nfusionwidgets parameter2 = '.$this->getData('parameter2').'<br/>';
|
12 |
+
$html .= 'nfusionwidgets parameter3 = '.$this->getData('parameter3').'<br/>';
|
13 |
+
$html .= 'nfusionwidgets parameter4 = '.$this->getData('parameter4').'<br/>';
|
14 |
+
$html .= 'nfusionwidgets parameter5 = '.$this->getData('parameter5').'<br/>';
|
15 |
+
return $html;
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/community/Nfusionsolutions/NfusionWidgets/Block/Widget/Block.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Cms
|
23 |
+
* @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Cms Static Block Widget
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Cms
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Nfusionsolutions_NfusionWidgets_Block_Widget_Block extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Initialize cache
|
39 |
+
*
|
40 |
+
* @return null
|
41 |
+
*/
|
42 |
+
protected function _construct()
|
43 |
+
{
|
44 |
+
parent::_construct();
|
45 |
+
/*
|
46 |
+
* setting cache to save the cms block
|
47 |
+
*/
|
48 |
+
$this->setCacheTags(array(Mage_Cms_Model_Block::CACHE_TAG));
|
49 |
+
$this->setCacheLifetime(false);
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Storage for used widgets
|
54 |
+
*
|
55 |
+
* @var array
|
56 |
+
*/
|
57 |
+
static protected $_widgetUsageMap = array();
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Prepare block text and determine whether block output enabled or not
|
61 |
+
* Prevent blocks recursion if needed
|
62 |
+
*
|
63 |
+
* @return Mage_Cms_Block_Widget_Block
|
64 |
+
*/
|
65 |
+
protected function _beforeToHtml()
|
66 |
+
{
|
67 |
+
parent::_beforeToHtml();
|
68 |
+
$blockId = $this->getData('block_id');
|
69 |
+
$blockHash = get_class($this) . $blockId;
|
70 |
+
|
71 |
+
if (isset(self::$_widgetUsageMap[$blockHash])) {
|
72 |
+
return $this;
|
73 |
+
}
|
74 |
+
self::$_widgetUsageMap[$blockHash] = true;
|
75 |
+
|
76 |
+
if ($blockId) {
|
77 |
+
$block = Mage::getModel('cms/block')
|
78 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
79 |
+
->load($blockId);
|
80 |
+
if ($block->getIsActive()) {
|
81 |
+
/* @var $helper Mage_Cms_Helper_Data */
|
82 |
+
$helper = Mage::helper('cms');
|
83 |
+
$processor = $helper->getBlockTemplateProcessor();
|
84 |
+
$this->setText($processor->filter($block->getContent()));
|
85 |
+
$this->addModelTags($block);
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
unset(self::$_widgetUsageMap[$blockHash]);
|
90 |
+
return $this;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Retrieve values of properties that unambiguously identify unique content
|
95 |
+
*
|
96 |
+
* @return array
|
97 |
+
*/
|
98 |
+
public function getCacheKeyInfo()
|
99 |
+
{
|
100 |
+
$result = parent::getCacheKeyInfo();
|
101 |
+
$blockId = $this->getBlockId();
|
102 |
+
if ($blockId) {
|
103 |
+
$result[] = $blockId;
|
104 |
+
}
|
105 |
+
return $result;
|
106 |
+
}
|
107 |
+
}
|
app/code/community/Nfusionsolutions/NfusionWidgets/Block/Widget/Fieldcustom.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Cms
|
23 |
+
* @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Cms Static Block Widget
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Cms
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Nfusionsolutions_NfusionWidgets_Block_Widget_Fieldcustom extends Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element
|
36 |
+
{
|
37 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
38 |
+
{
|
39 |
+
$element->setType('text');
|
40 |
+
$element->setDescription('It must be unique identifier');
|
41 |
+
$element->addClass('validate-digits');
|
42 |
+
return parent::render($element);
|
43 |
+
}
|
44 |
+
}
|
app/code/community/Nfusionsolutions/NfusionWidgets/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Nfusionsolutions_NfusionWidgets_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
}
|
5 |
+
|
app/code/community/Nfusionsolutions/NfusionWidgets/Model/Mysql4/Nfusionwidgets.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Nfusionsolutions_NfusionWidgets_Model_Mysql4_Nfusionwidgets extends Mage_Core_Model_Mysql4_Abstract
|
3 |
+
{
|
4 |
+
protected function _construct()
|
5 |
+
{
|
6 |
+
$this->_init("nfusionwidgets/nfusionwidgets", "id");
|
7 |
+
}
|
8 |
+
}
|
app/code/community/Nfusionsolutions/NfusionWidgets/Model/Mysql4/Nfusionwidgets/Collection.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Nfusionsolutions_NfusionWidgets_Model_Mysql4_Nfusionwidgets_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
public function _construct(){
|
6 |
+
$this->_init("nfusionwidgets/nfusionwidgets");
|
7 |
+
}
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
}
|
12 |
+
|
app/code/community/Nfusionsolutions/NfusionWidgets/Model/Nfusionwidgets.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Nfusionsolutions_NfusionWidgets_Model_Nfusionwidgets extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct(){
|
6 |
+
|
7 |
+
$this->_init("nfusionwidgets/nfusionwidgets");
|
8 |
+
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
12 |
+
|
app/code/community/Nfusionsolutions/NfusionWidgets/Model/Source/Widgetslist.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Nfusionsolutions_NfusionWidgets_Model_Source_Widgetslist
|
4 |
+
{
|
5 |
+
/* NEW! Static variables to keep a cache of our data.
|
6 |
+
No point in going to the database more than once */
|
7 |
+
static $_all_options_cache = null;
|
8 |
+
static $_label_to_value_cache = null;
|
9 |
+
public function toOptionArray()
|
10 |
+
{
|
11 |
+
/* NEW! Check if we have a cached version of our data */
|
12 |
+
if(is_null(Nfusionsolutions_NfusionWidgets_Model_Source_Widgetslist::$_all_options_cache))
|
13 |
+
{
|
14 |
+
/* @var $collection Envalo_Warranty_Model_Resource_Warranty_Collection */
|
15 |
+
$collection = Mage::getModel('nfusionwidgets/nfusionwidgets')
|
16 |
+
->getCollection();
|
17 |
+
$collection->addFieldToSelect(array('id','name'));
|
18 |
+
$collection->load();
|
19 |
+
$result = array();
|
20 |
+
$map_result = array(); /* NEW! Used to cache the mapping of value=>text */
|
21 |
+
/* @var $warranty Envalo_Warranty_Model_Warranty */
|
22 |
+
foreach($collection as $warranty)
|
23 |
+
{
|
24 |
+
$result[] = array(
|
25 |
+
'value' => $warranty->getId(),
|
26 |
+
'label' => $warranty->getName()
|
27 |
+
);
|
28 |
+
$map_result[$warranty->getId()] = $warranty->getName();
|
29 |
+
}
|
30 |
+
/* NEW! Store a copy of our data */
|
31 |
+
Nfusionsolutions_NfusionWidgets_Model_Source_Widgetslist::$_all_options_cache = $result;
|
32 |
+
Nfusionsolutions_NfusionWidgets_Model_Source_Widgetslist::$_label_to_value_cache = $map_result;
|
33 |
+
}
|
34 |
+
|
35 |
+
return Nfusionsolutions_NfusionWidgets_Model_Source_Widgetslist::$_all_options_cache;
|
36 |
+
}
|
37 |
+
|
38 |
+
public function getOptionText($value)
|
39 |
+
{
|
40 |
+
/* If this is null, then nobody has called getAllOptions() yet. */
|
41 |
+
if(is_null(Nfusionsolutions_NfusionWidgets_Model_Source_Widgetslist::$_label_to_value_cache))
|
42 |
+
{
|
43 |
+
$this->getAllOptions();
|
44 |
+
}
|
45 |
+
|
46 |
+
if(isset(Nfusionsolutions_NfusionWidgets_Model_Source_Widgetslist::$_label_to_value_cache[$value]))
|
47 |
+
{
|
48 |
+
return Nfusionsolutions_NfusionWidgets_Model_Source_Widgetslist::$_label_to_value_cache[$value];
|
49 |
+
}
|
50 |
+
return 'No Warranty Available';
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Nfusionsolutions/NfusionWidgets/controllers/Adminhtml/NfusionwidgetsController.php
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Nfusionsolutions_NfusionWidgets_Adminhtml_NfusionwidgetsController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
protected function _initAction()
|
6 |
+
{
|
7 |
+
$this->loadLayout()->_setActiveMenu("nfusionwidgets/nfusionwidgets")->_addBreadcrumb(Mage::helper("adminhtml")->__("Nfusionwidgets Manager"),Mage::helper("adminhtml")->__("Nfusionwidgets Manager"));
|
8 |
+
return $this;
|
9 |
+
}
|
10 |
+
public function indexAction()
|
11 |
+
{
|
12 |
+
$this->_title($this->__("NfusionWidgets"));
|
13 |
+
$this->_title($this->__("Manager Nfusionwidgets"));
|
14 |
+
|
15 |
+
$this->_initAction();
|
16 |
+
$this->renderLayout();
|
17 |
+
}
|
18 |
+
public function editAction()
|
19 |
+
{
|
20 |
+
$this->_title($this->__("NfusionWidgets"));
|
21 |
+
$this->_title($this->__("Nfusionwidgets"));
|
22 |
+
$this->_title($this->__("Edit Item"));
|
23 |
+
|
24 |
+
$id = $this->getRequest()->getParam("id");
|
25 |
+
$model = Mage::getModel("nfusionwidgets/nfusionwidgets")->load($id);
|
26 |
+
if ($model->getId()) {
|
27 |
+
Mage::register("nfusionwidgets_data", $model);
|
28 |
+
$this->loadLayout();
|
29 |
+
$this->_setActiveMenu("nfusionwidgets/nfusionwidgets");
|
30 |
+
$this->_addBreadcrumb(Mage::helper("adminhtml")->__("Nfusionwidgets Manager"), Mage::helper("adminhtml")->__("Nfusionwidgets Manager"));
|
31 |
+
$this->_addBreadcrumb(Mage::helper("adminhtml")->__("Nfusionwidgets Description"), Mage::helper("adminhtml")->__("Nfusionwidgets Description"));
|
32 |
+
$this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
|
33 |
+
$this->_addContent($this->getLayout()->createBlock("nfusionwidgets/adminhtml_nfusionwidgets_edit"))->_addLeft($this->getLayout()->createBlock("nfusionwidgets/adminhtml_nfusionwidgets_edit_tabs"));
|
34 |
+
$this->renderLayout();
|
35 |
+
}
|
36 |
+
else {
|
37 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("nfusionwidgets")->__("Item does not exist."));
|
38 |
+
$this->_redirect("*/*/");
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
public function newAction()
|
43 |
+
{
|
44 |
+
|
45 |
+
$this->_title($this->__("NfusionWidgets"));
|
46 |
+
$this->_title($this->__("Nfusionwidgets"));
|
47 |
+
$this->_title($this->__("New Item"));
|
48 |
+
|
49 |
+
$id = $this->getRequest()->getParam("id");
|
50 |
+
$model = Mage::getModel("nfusionwidgets/nfusionwidgets")->load($id);
|
51 |
+
|
52 |
+
$data = Mage::getSingleton("adminhtml/session")->getFormData(true);
|
53 |
+
if (!empty($data)) {
|
54 |
+
$model->setData($data);
|
55 |
+
}
|
56 |
+
|
57 |
+
Mage::register("nfusionwidgets_data", $model);
|
58 |
+
|
59 |
+
$this->loadLayout();
|
60 |
+
$this->_setActiveMenu("nfusionwidgets/nfusionwidgets");
|
61 |
+
|
62 |
+
$this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
|
63 |
+
|
64 |
+
$this->_addBreadcrumb(Mage::helper("adminhtml")->__("Nfusionwidgets Manager"), Mage::helper("adminhtml")->__("Nfusionwidgets Manager"));
|
65 |
+
$this->_addBreadcrumb(Mage::helper("adminhtml")->__("Nfusionwidgets Description"), Mage::helper("adminhtml")->__("Nfusionwidgets Description"));
|
66 |
+
|
67 |
+
|
68 |
+
$this->_addContent($this->getLayout()->createBlock("nfusionwidgets/adminhtml_nfusionwidgets_edit"))->_addLeft($this->getLayout()->createBlock("nfusionwidgets/adminhtml_nfusionwidgets_edit_tabs"));
|
69 |
+
|
70 |
+
$this->renderLayout();
|
71 |
+
|
72 |
+
}
|
73 |
+
public function saveAction()
|
74 |
+
{
|
75 |
+
|
76 |
+
$post_data=$this->getRequest()->getPost();
|
77 |
+
|
78 |
+
|
79 |
+
if ($post_data) {
|
80 |
+
|
81 |
+
try {
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
$model = Mage::getModel("nfusionwidgets/nfusionwidgets")
|
86 |
+
->addData($post_data)
|
87 |
+
->setId($this->getRequest()->getParam("id"))
|
88 |
+
->save();
|
89 |
+
|
90 |
+
Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Nfusionwidgets was successfully saved"));
|
91 |
+
Mage::getSingleton("adminhtml/session")->setNfusionwidgetsData(false);
|
92 |
+
|
93 |
+
if ($this->getRequest()->getParam("back")) {
|
94 |
+
$this->_redirect("*/*/edit", array("id" => $model->getId()));
|
95 |
+
return;
|
96 |
+
}
|
97 |
+
$this->_redirect("*/*/");
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
catch (Exception $e) {
|
101 |
+
Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
|
102 |
+
Mage::getSingleton("adminhtml/session")->setNfusionwidgetsData($this->getRequest()->getPost());
|
103 |
+
$this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
|
107 |
+
}
|
108 |
+
$this->_redirect("*/*/");
|
109 |
+
}
|
110 |
+
|
111 |
+
|
112 |
+
|
113 |
+
public function deleteAction()
|
114 |
+
{
|
115 |
+
if( $this->getRequest()->getParam("id") > 0 ) {
|
116 |
+
try {
|
117 |
+
$model = Mage::getModel("nfusionwidgets/nfusionwidgets");
|
118 |
+
$model->setId($this->getRequest()->getParam("id"))->delete();
|
119 |
+
Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
|
120 |
+
$this->_redirect("*/*/");
|
121 |
+
}
|
122 |
+
catch (Exception $e) {
|
123 |
+
Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
|
124 |
+
$this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
|
125 |
+
}
|
126 |
+
}
|
127 |
+
$this->_redirect("*/*/");
|
128 |
+
}
|
129 |
+
|
130 |
+
|
131 |
+
public function massRemoveAction()
|
132 |
+
{
|
133 |
+
try {
|
134 |
+
$ids = $this->getRequest()->getPost('ids', array());
|
135 |
+
foreach ($ids as $id) {
|
136 |
+
$model = Mage::getModel("nfusionwidgets/nfusionwidgets");
|
137 |
+
$model->setId($id)->delete();
|
138 |
+
}
|
139 |
+
Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item(s) was successfully removed"));
|
140 |
+
}
|
141 |
+
catch (Exception $e) {
|
142 |
+
Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
|
143 |
+
}
|
144 |
+
$this->_redirect('*/*/');
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Export order grid to CSV format
|
149 |
+
*/
|
150 |
+
public function exportCsvAction()
|
151 |
+
{
|
152 |
+
$fileName = 'nfusionwidgets.csv';
|
153 |
+
$grid = $this->getLayout()->createBlock('nfusionwidgets/adminhtml_nfusionwidgets_grid');
|
154 |
+
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
|
155 |
+
}
|
156 |
+
/**
|
157 |
+
* Export order grid to Excel XML format
|
158 |
+
*/
|
159 |
+
public function exportExcelAction()
|
160 |
+
{
|
161 |
+
$fileName = 'nfusionwidgets.xml';
|
162 |
+
$grid = $this->getLayout()->createBlock('nfusionwidgets/adminhtml_nfusionwidgets_grid');
|
163 |
+
$this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
|
164 |
+
}
|
165 |
+
}
|
app/code/community/Nfusionsolutions/NfusionWidgets/etc/config.xml
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Nfusionsolutions_NfusionWidgets>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Nfusionsolutions_NfusionWidgets>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<nfusionwidgets>
|
11 |
+
<class>Nfusionsolutions_NfusionWidgets_Helper</class>
|
12 |
+
</nfusionwidgets>
|
13 |
+
</helpers>
|
14 |
+
<blocks>
|
15 |
+
<nfusionwidgets>
|
16 |
+
<class>Nfusionsolutions_NfusionWidgets_Block</class>
|
17 |
+
</nfusionwidgets>
|
18 |
+
</blocks>
|
19 |
+
<models>
|
20 |
+
<nfusionwidgets>
|
21 |
+
<class>Nfusionsolutions_NfusionWidgets_Model</class>
|
22 |
+
<resourceModel>nfusionwidgets_mysql4</resourceModel>
|
23 |
+
</nfusionwidgets>
|
24 |
+
<nfusionwidgets_mysql4>
|
25 |
+
<class>Nfusionsolutions_NfusionWidgets_Model_Mysql4</class>
|
26 |
+
<entities>
|
27 |
+
<nfusionwidgets>
|
28 |
+
<table>nfusion_widgets</table>
|
29 |
+
</nfusionwidgets>
|
30 |
+
</entities>
|
31 |
+
</nfusionwidgets_mysql4>
|
32 |
+
</models>
|
33 |
+
<resources>
|
34 |
+
<nfusionwidgets_setup>
|
35 |
+
<setup>
|
36 |
+
<module>Nfusionsolutions_NfusionWidgets</module>
|
37 |
+
</setup>
|
38 |
+
<connection>
|
39 |
+
<use>core_setup</use>
|
40 |
+
</connection>
|
41 |
+
</nfusionwidgets_setup>
|
42 |
+
<nfusionwidgets_write>
|
43 |
+
<connection>
|
44 |
+
<use>core_write</use>
|
45 |
+
</connection>
|
46 |
+
</nfusionwidgets_write>
|
47 |
+
<nfusionwidgets_read>
|
48 |
+
<connection>
|
49 |
+
<use>core_read</use>
|
50 |
+
</connection>
|
51 |
+
</nfusionwidgets_read>
|
52 |
+
</resources>
|
53 |
+
</global>
|
54 |
+
<admin>
|
55 |
+
<routers>
|
56 |
+
<nfusionwidgets>
|
57 |
+
<use>admin</use>
|
58 |
+
<args>
|
59 |
+
<module>Nfusionsolutions_NfusionWidgets</module>
|
60 |
+
<frontName>admin_nfusionwidgets</frontName>
|
61 |
+
</args>
|
62 |
+
</nfusionwidgets>
|
63 |
+
</routers>
|
64 |
+
</admin>
|
65 |
+
<adminhtml>
|
66 |
+
<menu>
|
67 |
+
<nfusionsolutions_currencyexchangerates module="nfusionwidgets">
|
68 |
+
<title>nFusion Solutions</title>
|
69 |
+
<sort_order>100</sort_order>
|
70 |
+
<children>
|
71 |
+
<nfusionwidgets module="nfusionwidgets">
|
72 |
+
<title>Widgets</title>
|
73 |
+
<sort_order>10</sort_order>
|
74 |
+
<children>
|
75 |
+
<nfusionwidgets module="nfusionwidgets">
|
76 |
+
<title>Manage nFusion Widgets</title>
|
77 |
+
<action>admin_nfusionwidgets/adminhtml_nfusionwidgets</action>
|
78 |
+
<sort_order>2</sort_order>
|
79 |
+
</nfusionwidgets>
|
80 |
+
</children>
|
81 |
+
</nfusionwidgets>
|
82 |
+
</children>
|
83 |
+
</nfusionsolutions_currencyexchangerates>
|
84 |
+
</menu>
|
85 |
+
<acl>
|
86 |
+
<resources>
|
87 |
+
<all>
|
88 |
+
<title>Allow Everything</title>
|
89 |
+
</all>
|
90 |
+
<admin>
|
91 |
+
<children>
|
92 |
+
<nfusionwidgets translate="title" module="nfusionwidgets">
|
93 |
+
<title>NfusionWidgets</title>
|
94 |
+
<sort_order>1000</sort_order>
|
95 |
+
<children>
|
96 |
+
<nfusionwidgets translate="title">
|
97 |
+
<title>Manage Nfusionwidgets</title>
|
98 |
+
<sort_order>0</sort_order>
|
99 |
+
</nfusionwidgets>
|
100 |
+
</children>
|
101 |
+
</nfusionwidgets>
|
102 |
+
</children>
|
103 |
+
</admin>
|
104 |
+
</resources>
|
105 |
+
</acl>
|
106 |
+
<layout>
|
107 |
+
<updates>
|
108 |
+
<nfusionwidgets>
|
109 |
+
<file>nfusionwidgets.xml</file>
|
110 |
+
</nfusionwidgets>
|
111 |
+
</updates>
|
112 |
+
</layout>
|
113 |
+
</adminhtml>
|
114 |
+
</config>
|
app/code/community/Nfusionsolutions/NfusionWidgets/etc/widget.xml
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<widgets>
|
3 |
+
<nfusionwidgets_nfusionwidgets type="nfusionwidgets/widget_block" translate="name description" module="nfusionwidgets">
|
4 |
+
<name>nFusion Widgets</name>
|
5 |
+
<description type="desc">List of Widgets</description>
|
6 |
+
<parameters>
|
7 |
+
<chart_id>
|
8 |
+
<label>Choose widget</label>
|
9 |
+
<visible>1</visible>
|
10 |
+
<required>1</required>
|
11 |
+
<type>select</type>
|
12 |
+
<source_model>nfusionwidgets/source_widgetslist</source_model>
|
13 |
+
</chart_id>
|
14 |
+
<chart_parameters>
|
15 |
+
<label>Parameters</label>
|
16 |
+
<visible>1</visible>
|
17 |
+
<type>text</type>
|
18 |
+
</chart_parameters>
|
19 |
+
<chart_layout>
|
20 |
+
<label>Full Width</label>
|
21 |
+
<visible>1</visible>
|
22 |
+
<required>1</required>
|
23 |
+
<type>select</type>
|
24 |
+
<value>1</value>
|
25 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
26 |
+
</chart_layout>
|
27 |
+
<chart_width>
|
28 |
+
<label>Fixed Width</label>
|
29 |
+
<visible>1</visible>
|
30 |
+
<required>1</required>
|
31 |
+
<type>text</type>
|
32 |
+
<depends><chart_layout><value>0</value></chart_layout></depends>
|
33 |
+
</chart_width>
|
34 |
+
<chart_code>
|
35 |
+
<label>Widget Code</label>
|
36 |
+
<description>It must be unique identifier</description>
|
37 |
+
<visible>1</visible>
|
38 |
+
<type>text</type>
|
39 |
+
</chart_code>
|
40 |
+
<template translate="label">
|
41 |
+
<label>Template</label>
|
42 |
+
<visible>0</visible>
|
43 |
+
<type>select</type>
|
44 |
+
<value>nfusionwidgets/widget/default.phtml</value>
|
45 |
+
<values>
|
46 |
+
<default translate="label">
|
47 |
+
<value>nfusionwidgets/widget/default.phtml</value>
|
48 |
+
<label>nFusion Widget Default Template</label>
|
49 |
+
</default>
|
50 |
+
</values>
|
51 |
+
<sort_order>10</sort_order>
|
52 |
+
</template>
|
53 |
+
|
54 |
+
</parameters>
|
55 |
+
</nfusionwidgets_nfusionwidgets>
|
56 |
+
</widgets>
|
app/code/community/Nfusionsolutions/NfusionWidgets/sql/nfusionwidgets_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
$sql=<<<SQLTEXT
|
5 |
+
create table nfusion_widgets(id int not null auto_increment, name varchar(100),chart_code text,type varchar(20),chart_width int,primary key(id));
|
6 |
+
|
7 |
+
|
8 |
+
SQLTEXT;
|
9 |
+
|
10 |
+
$installer->run($sql);
|
11 |
+
//demo
|
12 |
+
//Mage::getModel('core/url_rewrite')->setId(null);
|
13 |
+
//demo
|
14 |
+
$installer->endSetup();
|
15 |
+
|
app/design/adminhtml/default/default/layout/nfusionwidgets.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<nfusionwidgets_adminhtml_nfusionwidgets_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="nfusionwidgets/adminhtml_nfusionwidgets" name="nfusionwidgets" />
|
6 |
+
</reference>
|
7 |
+
</nfusionwidgets_adminhtml_nfusionwidgets_index>
|
8 |
+
</layout>
|
app/design/frontend/base/default/template/nfusionwidgets/widget/default.phtml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$chart_id = $this->getData('chart_id');
|
3 |
+
$parameters = $this->getData('chart_parameters');
|
4 |
+
$chart_code = $this->getData('chart_code');
|
5 |
+
|
6 |
+
$chart = Mage::getModel('nfusionwidgets/nfusionwidgets')->load($chart_id);
|
7 |
+
|
8 |
+
if($this->getData('chart_layout')==1)
|
9 |
+
$width = "100%";
|
10 |
+
else
|
11 |
+
$width = $this->getData('chart_width')."px";
|
12 |
+
|
13 |
+
|
14 |
+
if($parameters!='')
|
15 |
+
$parameters = '?'.$parameters;
|
16 |
+
$unique_id = uniqid('nfusion').$chart_code;
|
17 |
+
?>
|
18 |
+
<div style="width:<?php echo $width ?>" id="<?php echo $unique_id ?>"></div>
|
19 |
+
<script>
|
20 |
+
(function(){
|
21 |
+
var t = document.getElementsByTagName("script")[0];
|
22 |
+
var s = document.createElement("script"); s.async = true;
|
23 |
+
s.src = "<?php echo $chart->getData('chart_code')."/".$unique_id.$parameters ?>";
|
24 |
+
t.parentNode.insertBefore(s, t);
|
25 |
+
})();
|
26 |
+
</script>
|
app/etc/modules/Nfusionsolutions_NfusionWidgets.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Nfusionsolutions_NfusionWidgets>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Cms />
|
9 |
+
</depends>
|
10 |
+
<version>0.1.0</version>
|
11 |
+
</Nfusionsolutions_NfusionWidgets>
|
12 |
+
</modules>
|
13 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Nfusionsolutions_NfusionWidgets</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This extension adds the capability in Magento to add Precious Metals Pricing Widgets to your site using nFusion Solutions' reliable, enterprise-class cloud platform for global financial data.</summary>
|
10 |
+
<description>This extension adds capability to easily add nFusion Solutions Precious Metals Pricing Widgets to your Magento website. All settings are provided in the Magento admin.</description>
|
11 |
+
<notes>Precious Metals Pricing Widgets from nFusion Solutions</notes>
|
12 |
+
<authors><author><name>nFusion Solutions</name><user>nfusion</user><email>support@nfusionsolutions.com</email></author></authors>
|
13 |
+
<date>2016-06-03</date>
|
14 |
+
<time>04:02:51</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Nfusionsolutions"><dir name="NfusionWidgets"><dir name="Block"><dir name="Adminhtml"><dir name="Nfusionwidgets"><dir name="Edit"><file name="Form.php" hash="25fc57e86af309a16bf6642ced67c2ae"/><dir name="Tab"><file name="Form.php" hash="1a9ab5aeb7f2689944f0f82f577c665b"/></dir><file name="Tabs.php" hash="804cd4f46f65f119a4513419ae2f9e73"/></dir><file name="Edit.php" hash="41d9224c4f0290ffcc882331f54a7364"/><file name="Grid.php" hash="1762bd6a94d8e5b44ce55f01872ee3ac"/></dir><file name="Nfusionwidgets.php" hash="03e8a99a14d6c2d817cae28b5d037621"/></dir><file name="Nfusionwidgets.php" hash="3301d504c99ca83ae8fa1a868c27d9a2"/><dir name="Widget"><file name="Block.php" hash="da855dc76fef5baa44fb6fac70c90305"/><file name="Fieldcustom.php" hash="6f8f13e5924de026a462d4ffee48da03"/></dir></dir><dir name="Helper"><file name="Data.php" hash="8da8b7595591c08fca1308eea33acf69"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Nfusionwidgets"><file name="Collection.php" hash="045c8e6ea466e06c8972455d6779746d"/></dir><file name="Nfusionwidgets.php" hash="5e7cb4b543e324f20a60d02920bc3589"/></dir><file name="Nfusionwidgets.php" hash="0f93be591a16dcf65d91ab7399a2d43b"/><dir name="Source"><file name="Widgetslist.php" hash="2dd6a7a96852d3630b4a51dd60073e40"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="NfusionwidgetsController.php" hash="fcb65b11a0d188d579ce40fa3053bb84"/></dir></dir><dir name="etc"><file name="config.xml" hash="56ab7826c9e1c3181840cca270f76065"/><file name="widget.xml" hash="9c5b6cfc6182ff897582aa2539e5b583"/></dir><dir name="sql"><dir name="nfusionwidgets_setup"><file name="mysql4-install-0.1.0.php" hash="334fb7fd88fd549d2e39946de776ec38"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="nfusionwidgets.xml" hash="ad8869a7804ca74eb95d40993cce541a"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="nfusionwidgets"><dir name="widget"><file name="default.phtml" hash="4772a0ff70295e7c32a235860a1af178"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Nfusionsolutions_NfusionWidgets.xml" hash="c1d3254bf2983e88a1bd9aca95314a8b"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|