PluginProbe
CSS & JavaScript Toolbox / trunk
CSS & JavaScript Toolbox vtrunk
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
← All changes | controllers/block-ajax.php +11 -43 10trunk View file →
@@ -27,9 +27,8 @@
27 27 public function __construct() {
28 28 parent::__construct();
29 29 // Supported actions.
30 30 add_action('wp_ajax_cjtoolbox_get_info_view', array(&$this, '_doAction'));
31 - add_action('wp_ajax_cjtoolbox_set_property', array(&$this, '_doAction'));
32 31 add_action('wp_ajax_cjtoolbox_get_revision', array(&$this, '_doAction'));
33 32 add_action('wp_ajax_cjtoolbox_get_revisions', array(&$this, '_doAction'));
34 33 // Redirects
35 34 $this->registryAction('getBlockBy');
@@ -36,8 +35,9 @@
36 35 $this->registryAction('getAPOP');
37 36 $this->registryAction('restoreRevision');
38 37 $this->registryAction('loadUrl');
39 38 $this->registryAction('downloadCodeFile');
39 + $this->registryAction('getAllAssignment');
40 40 }
41 41
42 42 /**
43 43 * put your comment there...
@@ -48,8 +48,16 @@
48 48 // Pass to CJTBlockController!
49 49 $this->redirect('block');
50 50 }
51 51
52 + /**
53 + * put your comment there...
54 + *
55 + */
56 + protected function getAllAssignmentAction() {
57 + $this->redirect('block');
58 + }
59 +
52 60 /**
53 61 * put your comment there...
54 62 *
55 63 * @deprecated this is just a redirect to the CJTBlockContoller::getAction().
@@ -67,9 +75,9 @@
67 75 protected function getBlockByAction() {
68 76 // Pass to CJTBlockController!
69 77 $this->redirect('block');
70 78 }
71 -
79 +
72 80 /**
73 81 * put your comment there...
74 82 *
75 83 * @deprecated All will be moved to other controllers in the future versions.
@@ -142,9 +150,9 @@
142 150 // Create view.
143 151 $view = $this->getView('blocks/revisions');
144 152 // Push view vars.
145 153 $view->blockId = $blockId;
146 - $view->revisions = $revisions;
154 + $view->revisions = array_reverse($revisions);
147 155 // Set output header.
148 156 $this->httpContentType = 'text/html';
149 157 // Return view content.
150 158 $this->response = $view->getTemplate('default');
@@ -192,45 +200,5 @@
192 200 // Return TRUE.
193 201 $this->response = true;
194 202 }
195 203
196 - /**
197 - * Update exists block property value.
198 - *
199 - *
200 - * Call this method using POST method with the following parameters.
201 - * - id integer Block id.
202 - * - property string Property Name to change.
203 - * - value mixed Property value to change.
204 - *
205 - * Response body is array with the following elements.
206 - * - string oldValue Old property value.
207 - * - string value New value.
208 - *
209 - * @deprecated
210 - * @return void
211 - */
212 - public function setPropertyAction() {
213 - // Initialize.
214 - $response = array();
215 - $blocks = $this->getModel('blocks');
216 - // Prepare parameters.
217 - $blockId = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
218 - $property = filter_input(INPUT_POST, 'property', FILTER_SANITIZE_STRING);
219 - $newValue = filter_input(INPUT_POST, 'value', FILTER_UNSAFE_RAW);
220 - // Get old value.
221 - $block = $blocks->getBlock($blockId);
222 - $oldValue = $block->$property;
223 - // Update only if there is a change.
224 - if ($oldValue != $newValue) {
225 - // Update block property.
226 - $block->$property = $newValue;
227 - $blocks->setBlock($block);
228 - $blocks->save();
229 - // Set response object.
230 - $response['oldValue'] = $oldValue;
231 - $response['value'] = $newValue;
232 - }
233 - $this->response = $response;
234 - }
235 -
236 204 } // End class.