| @@ -32,39 +32,15 @@ | ||
| 32 | 32 | add_action('wp_ajax_cjtoolbox_get_revision', array(&$this, '_doAction')); |
| 33 | 33 | add_action('wp_ajax_cjtoolbox_get_revisions', array(&$this, '_doAction')); |
| 34 | 34 | // Redirects |
| 35 | 35 | $this->registryAction('getBlockBy'); |
| 36 | - $this->registryAction('getAPOP'); | |
| 37 | - $this->registryAction('restoreRevision'); | |
| 38 | - $this->registryAction('loadUrl'); | |
| 39 | - $this->registryAction('downloadCodeFile'); | |
| 40 | 36 | } |
| 41 | - | |
| 37 | + | |
| 42 | 38 | /** |
| 43 | 39 | * put your comment there... |
| 44 | 40 | * |
| 45 | 41 | * @deprecated this is just a redirect to the CJTBlockContoller::getAction(). |
| 46 | 42 | */ |
| 47 | - protected function downloadCodeFileAction() { | |
| 48 | - // Pass to CJTBlockController! | |
| 49 | - $this->redirect('block'); | |
| 50 | - } | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * put your comment there... | |
| 54 | - * | |
| 55 | - * @deprecated this is just a redirect to the CJTBlockContoller::getAction(). | |
| 56 | - */ | |
| 57 | - protected function getAPOPAction() { | |
| 58 | - // Pass to CJTBlockController! | |
| 59 | - $this->redirect('block'); | |
| 60 | - } | |
| 61 | - | |
| 62 | - /** | |
| 63 | - * put your comment there... | |
| 64 | - * | |
| 65 | - * @deprecated this is just a redirect to the CJTBlockContoller::getAction(). | |
| 66 | - */ | |
| 67 | 43 | protected function getBlockByAction() { |
| 68 | 44 | // Pass to CJTBlockController! |
| 69 | 45 | $this->redirect('block'); |
| 70 | 46 | } |
| @@ -93,31 +69,13 @@ | ||
| 93 | 69 | * |
| 94 | 70 | * @deprecated All will be moved to other controllers in the future versions. |
| 95 | 71 | */ |
| 96 | 72 | public function getRevisionAction() { |
| 97 | - // Initialize | |
| 98 | 73 | $model = $this->getModel('blocks'); |
| 99 | - $tblCodeFile = new CJTBlockFilesTable(cssJSToolbox::getInstance()->getDBDriver()); | |
| 100 | - // Inputs. | |
| 101 | - $revisionId = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); | |
| 102 | 74 | // Get request parameters. |
| 103 | - $revision['id'] = $revisionId; | |
| 104 | - $revision['fields'] = array('id', 'links', 'expressions', 'masterFile'); | |
| 75 | + $revision['id'] = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); | |
| 76 | + $revision['fields'] = array('id', 'code', 'pinPoint', 'links', 'expressions'); | |
| 105 | 77 | $revision = $model->getBlock($revision['id'], array(), $revision['fields']); |
| 106 | - // Get revisioned code file. | |
| 107 | - $revision->code = $tblCodeFile->set('blockId', $revisionId) | |
| 108 | - ->set('id', $revision->masterFile) | |
| 109 | - ->load() | |
| 110 | - ->getData()->code; | |
| 111 | - // Discard Pins. | |
| 112 | - $customPins = array_keys( CJTBlockModel::getCustomPins() ); | |
| 113 | - | |
| 114 | - foreach ( $customPins as $customPinName ) | |
| 115 | - { | |
| 116 | - $revision->{$customPinName} = false; | |
| 117 | - } | |
| 118 | - | |
| 119 | - // Return revision. | |
| 120 | 78 | $this->response = $revision; |
| 121 | 79 | } |
| 122 | 80 | |
| 123 | 81 | /** |
| @@ -125,14 +83,12 @@ | ||
| 125 | 83 | * |
| 126 | 84 | * @deprecated All will be moved to other controllers in the future versions. |
| 127 | 85 | */ |
| 128 | 86 | public function getRevisionsAction() { |
| 129 | - // initialize. | |
| 130 | 87 | $model = $this->getModel('blocks'); |
| 131 | 88 | // Get request parameters. |
| 132 | 89 | $blockId = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); |
| 133 | 90 | // Get block revisions. |
| 134 | - $revisions['filter']['masterFile'] = $_GET['activeFileId']; | |
| 135 | 91 | $revisions['filter']['parent'] = $blockId; |
| 136 | 92 | $revisions['filter']['type'] = 'revision'; |
| 137 | 93 | // Its mandatory to select fields instead of using just .*. |
| 138 | 94 | // This is because id field must be first to be used as the array key |
| @@ -148,52 +104,9 @@ | ||
| 148 | 104 | $this->httpContentType = 'text/html'; |
| 149 | 105 | // Return view content. |
| 150 | 106 | $this->response = $view->getTemplate('default'); |
| 151 | 107 | } |
| 152 | - | |
| 153 | - /** | |
| 154 | - * put your comment there... | |
| 155 | - * | |
| 156 | - * @deprecated this is just a redirect to the CJTBlockContoller::getAction(). | |
| 157 | - */ | |
| 158 | - protected function loadUrlAction() { | |
| 159 | - // Pass to CJTBlockController! | |
| 160 | - $this->redirect('block'); | |
| 161 | - } | |
| 162 | - | |
| 163 | - /** | |
| 164 | - * put your comment there... | |
| 165 | - * | |
| 166 | - */ | |
| 167 | - protected function restoreRevisionAction() { | |
| 168 | - // Initialize. | |
| 169 | - $mdlBlocks = new CJTBlocksModel(); | |
| 170 | - $tblCodeFile = new CJTBlockFilesTable(cssJSToolbox::getInstance()->getDBDriver()); | |
| 171 | - // Get revision ID. | |
| 172 | - $rId = (int) $_GET['rid']; | |
| 173 | - $bId = (int) $_GET['bid']; | |
| 174 | - // Get Revision Block + Revision Code. | |
| 175 | - $revisionBlock = $mdlBlocks->getBlock($rId, array(), array('id', 'pinPoint', 'links', 'expressions', 'masterFile')); | |
| 176 | - $revisionBlock->code = $tblCodeFile->set('blockId', $rId) | |
| 177 | - ->set('id', $revisionBlock->masterFile) | |
| 178 | - ->load() | |
| 179 | - ->getData()->code; | |
| 180 | - // If code === null set it to empoty string '' as null woulod | |
| 181 | - // prevent the field from being in the query, cause SQL error. | |
| 182 | - if ($revisionBlock->code === null) { | |
| 183 | - $revisionBlock->code = ''; | |
| 184 | - } | |
| 185 | - // Code File Fields. | |
| 186 | - $revisionBlock->activeFileId = $revisionBlock->masterFile; | |
| 187 | - $revisionBlock->masterFile = null; // This is just for querying CodeFile. DONT UPDATE. | |
| 188 | - // Restore Block. | |
| 189 | - $revisionBlock->id = $bId; | |
| 190 | - $mdlBlocks->update($revisionBlock, true); | |
| 191 | - $mdlBlocks->save(); | |
| 192 | - // Return TRUE. | |
| 193 | - $this->response = true; | |
| 194 | - } | |
| 195 | - | |
| 108 | + | |
| 196 | 109 | /** |
| 197 | 110 | * Update exists block property value. |
| 198 | 111 | * |
| 199 | 112 | * |