1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Adminhtml_Block_Cms_Wysiwyg_Images_Content extends Mage_Adminhtml_Block_Widget_Container
35: {
36: 37: 38:
39: public function __construct()
40: {
41: parent::__construct();
42: $this->_headerText = $this->helper('cms')->__('Media Storage');
43: $this->_removeButton('back')->_removeButton('edit');
44: $this->_addButton('newfolder', array(
45: 'class' => 'save',
46: 'label' => $this->helper('cms')->__('Create Folder...'),
47: 'type' => 'button',
48: 'onclick' => 'MediabrowserInstance.newFolder();'
49: ));
50:
51: $this->_addButton('delete_folder', array(
52: 'class' => 'delete no-display',
53: 'label' => $this->helper('cms')->__('Delete Folder'),
54: 'type' => 'button',
55: 'onclick' => 'MediabrowserInstance.deleteFolder();',
56: 'id' => 'button_delete_folder'
57: ));
58:
59: $this->_addButton('delete_files', array(
60: 'class' => 'delete no-display',
61: 'label' => $this->helper('cms')->__('Delete File'),
62: 'type' => 'button',
63: 'onclick' => 'MediabrowserInstance.deleteFiles();',
64: 'id' => 'button_delete_files'
65: ));
66:
67: $this->_addButton('insert_files', array(
68: 'class' => 'save no-display',
69: 'label' => $this->helper('cms')->__('Insert File'),
70: 'type' => 'button',
71: 'onclick' => 'MediabrowserInstance.insert();',
72: 'id' => 'button_insert_files'
73: ));
74: }
75:
76: 77: 78: 79: 80:
81: public function getContentsUrl()
82: {
83: return $this->getUrl('*/*/contents', array('type' => $this->getRequest()->getParam('type')));
84: }
85:
86: 87: 88: 89: 90:
91: public function getFilebrowserSetupObject()
92: {
93: $setupObject = new Varien_Object();
94:
95: $setupObject->setData(array(
96: 'newFolderPrompt' => $this->helper('cms')->__('New Folder Name:'),
97: 'deleteFolderConfirmationMessage' => $this->helper('cms')->__('Are you sure you want to delete current folder?'),
98: 'deleteFileConfirmationMessage' => $this->helper('cms')->__('Are you sure you want to delete the selected file?'),
99: 'targetElementId' => $this->getTargetElementId(),
100: 'contentsUrl' => $this->getContentsUrl(),
101: 'onInsertUrl' => $this->getOnInsertUrl(),
102: 'newFolderUrl' => $this->getNewfolderUrl(),
103: 'deleteFolderUrl' => $this->getDeletefolderUrl(),
104: 'deleteFilesUrl' => $this->getDeleteFilesUrl(),
105: 'headerText' => $this->getHeaderText()
106: ));
107:
108: return Mage::helper('core')->jsonEncode($setupObject);
109: }
110:
111: 112: 113: 114: 115:
116: public function getNewfolderUrl()
117: {
118: return $this->getUrl('*/*/newFolder');
119: }
120:
121: 122: 123: 124: 125:
126: protected function getDeletefolderUrl()
127: {
128: return $this->getUrl('*/*/deleteFolder');
129: }
130:
131: 132: 133: 134: 135: 136:
137: public function getDeleteFilesUrl()
138: {
139: return $this->getUrl('*/*/deleteFiles');
140: }
141:
142: 143: 144: 145: 146:
147: public function getOnInsertUrl()
148: {
149: return $this->getUrl('*/*/onInsert');
150: }
151:
152: 153: 154: 155: 156:
157: public function getTargetElementId()
158: {
159: return $this->getRequest()->getParam('target_element_id');
160: }
161: }
162: