| @@ -9,57 +9,50 @@ | ||
| 9 | 9 | /** |
| 10 | 10 | * Blocks view |
| 11 | 11 | */ |
| 12 | 12 | class CJTBlocksBlockView extends CJTView { |
| 13 | - | |
| 13 | + | |
| 14 | 14 | /** */ |
| 15 | 15 | const META_BOX_PREFIX = 'cjtoolbox'; |
| 16 | - | |
| 16 | + | |
| 17 | 17 | /** |
| 18 | 18 | * put your comment there... |
| 19 | - * | |
| 19 | + * | |
| 20 | 20 | * @var mixed |
| 21 | 21 | */ |
| 22 | 22 | public $block = null; |
| 23 | - | |
| 23 | + | |
| 24 | 24 | /** |
| 25 | 25 | * put your comment there... |
| 26 | - * | |
| 26 | + * | |
| 27 | 27 | * @var mixed |
| 28 | 28 | */ |
| 29 | 29 | public $isClosed; |
| 30 | - | |
| 30 | + | |
| 31 | 31 | /** |
| 32 | 32 | * put your comment there... |
| 33 | - * | |
| 33 | + * | |
| 34 | 34 | * @var mixed |
| 35 | 35 | */ |
| 36 | 36 | protected $localization; |
| 37 | - | |
| 38 | - /** | |
| 39 | - * put your comment there... | |
| 40 | - * | |
| 41 | - * @var mixed | |
| 42 | - */ | |
| 43 | - protected $ontoolbox = array('parameters' => array('block')); | |
| 44 | - | |
| 37 | + | |
| 45 | 38 | /** |
| 46 | 39 | * put your comment there... |
| 47 | - * | |
| 40 | + * | |
| 48 | 41 | * @var mixed |
| 49 | 42 | */ |
| 50 | 43 | protected $params = array(); |
| 51 | - | |
| 44 | + | |
| 52 | 45 | /** |
| 53 | 46 | * put your comment there... |
| 54 | - * | |
| 47 | + * | |
| 55 | 48 | * @var mixed |
| 56 | 49 | */ |
| 57 | 50 | public $templateName = 'edit'; |
| 58 | - | |
| 51 | + | |
| 59 | 52 | /** |
| 60 | 53 | * put your comment there... |
| 61 | - * | |
| 54 | + * | |
| 62 | 55 | */ |
| 63 | 56 | public function __construct($viewInfo) { |
| 64 | 57 | parent::__construct($viewInfo); |
| 65 | 58 | // Enqueue Styles & Scripts. |
| @@ -69,29 +62,29 @@ | ||
| 69 | 62 | $this->params = (object) $this->params; |
| 70 | 63 | // Load localization text. |
| 71 | 64 | $this->localization = require($this->getPath('public/js/jquery.block/jquery.block.localization.php')); |
| 72 | 65 | } |
| 73 | - | |
| 66 | + | |
| 74 | 67 | /** |
| 75 | 68 | * put your comment there... |
| 76 | - * | |
| 69 | + * | |
| 77 | 70 | */ |
| 78 | 71 | public function display($template = null) { |
| 79 | 72 | // Import template. |
| 80 | 73 | echo $this->getTemplate($template ? $template : $this->templateName); |
| 81 | 74 | } |
| 82 | - | |
| 75 | + | |
| 83 | 76 | /** |
| 84 | 77 | * put your comment there... |
| 85 | - * | |
| 78 | + * | |
| 86 | 79 | */ |
| 87 | 80 | public static function enqueueScripts() { |
| 88 | 81 | // Use related scripts. |
| 89 | 82 | self::useScripts(__CLASS__, |
| 90 | 83 | 'jquery', |
| 91 | - 'common', | |
| 92 | - 'wp-lists', | |
| 93 | - 'postbox', | |
| 84 | + 'common', | |
| 85 | + 'wp-lists', | |
| 86 | + 'postbox', | |
| 94 | 87 | 'thickbox', |
| 95 | 88 | 'framework:js:hash:{CJT-}md5', |
| 96 | 89 | 'framework:js:cookies:{CJT-}jquery.cookies.2.2.0', |
| 97 | 90 | 'framework:js:ajax:{CJT-}cjt-server', |
| @@ -105,15 +98,15 @@ | ||
| 105 | 98 | 'views:blocks:block:public:js:{CJT-}codefile-manager', |
| 106 | 99 | 'views:blocks:block:public:js:{CJT-}codefile', |
| 107 | 100 | 'views:blocks:block:public:js:{CJT-}block', |
| 108 | 101 | 'views:blocks:block:public:js:plugins:{CJT-}_dockmodule', |
| 109 | - 'views:blocks:block:public:js:{CJT-}jquery.block' | |
| 102 | + 'views:blocks:block:public:js:{CJT-}jquery.block' | |
| 110 | 103 | ); |
| 111 | 104 | } |
| 112 | - | |
| 105 | + | |
| 113 | 106 | /** |
| 114 | 107 | * put your comment there... |
| 115 | - * | |
| 108 | + * | |
| 116 | 109 | */ |
| 117 | 110 | public static function enqueueStyles() { |
| 118 | 111 | // Initialize style. |
| 119 | 112 | $styles = array( |
| @@ -128,80 +121,47 @@ | ||
| 128 | 121 | } |
| 129 | 122 | // Include styles. |
| 130 | 123 | self::useStyles(__CLASS__, $styles); |
| 131 | 124 | } |
| 132 | - | |
| 133 | - /** | |
| 134 | - * put your comment there... | |
| 135 | - * | |
| 136 | - * @param mixed $block | |
| 137 | - */ | |
| 138 | - public function getAllAssignments() { | |
| 139 | - | |
| 140 | - return CJTBlocksModel::getAllAssignments($this->block); | |
| 141 | - } | |
| 142 | - | |
| 125 | + | |
| 143 | 126 | /** |
| 144 | 127 | * put your comment there... |
| 145 | - * | |
| 128 | + * | |
| 146 | 129 | */ |
| 147 | 130 | public function getBlock() { |
| 148 | - return $this->block; | |
| 131 | + return $this->block; | |
| 149 | 132 | } |
| 150 | - | |
| 151 | - /** | |
| 152 | - * put your comment there... | |
| 153 | - * | |
| 154 | - */ | |
| 155 | - public function getHookStatus() { | |
| 156 | - | |
| 157 | - $hooksAttacher =& CJTBlocksCouplingController::theInstance()->getHooksAttacher(); | |
| 158 | - | |
| 159 | - $locationText = $hooksAttacher->getHookText($this->block->location); | |
| 160 | - $locationTitle = $hooksAttacher->getHookText($this->block->location, 'title'); | |
| 161 | - $badLocationClass = ''; | |
| 162 | - | |
| 163 | - if(!$locationText) { | |
| 164 | - | |
| 165 | - $badLocationClass = 'bad-location-specified'; | |
| 166 | - $locationText = cssJSToolbox::getText('Hook is not supported, it might be assigned by some kind of CJT hooks extensions. You either need to re-enable/re-install that extension or change the hook value to one of the supported hooks'); | |
| 167 | - } | |
| 168 | - | |
| 169 | - $text = compact('badLocationClass', 'locationText', 'locationTitle'); | |
| 170 | - | |
| 171 | - return $text; | |
| 172 | - } | |
| 173 | - | |
| 133 | + | |
| 174 | 134 | /** |
| 175 | 135 | * put your comment there... |
| 176 | - * | |
| 136 | + * | |
| 177 | 137 | */ |
| 178 | 138 | public function getMetaboxName() { |
| 179 | 139 | $tip = cssJSToolbox::getText('Click to update Block name'); |
| 180 | - return "<input name='cjtoolbox[{$this->block->id}][name]' type='text' class='block-name' value='{$this->block->name}' title='{$tip}' maxlength='50' />"; | |
| 140 | + return "<span class='block-name' title='{$tip}'>{$this->block->name}</span>"; | |
| 181 | 141 | } |
| 182 | - | |
| 142 | + | |
| 183 | 143 | /** |
| 184 | 144 | * put your comment there... |
| 185 | - * | |
| 145 | + * | |
| 186 | 146 | * @param mixed $id |
| 187 | 147 | */ |
| 188 | 148 | public function getMetaboxId() { |
| 189 | 149 | return self::META_BOX_PREFIX ."-{$this->block->id}"; |
| 190 | 150 | } |
| 191 | - | |
| 151 | + | |
| 192 | 152 | /** |
| 193 | 153 | * put your comment there... |
| 194 | - * | |
| 154 | + * | |
| 195 | 155 | * @param mixed $name |
| 196 | 156 | */ |
| 197 | 157 | public function getOption($name) { |
| 198 | 158 | return $this->params->{$name}; |
| 199 | 159 | } |
| 200 | - | |
| 160 | + | |
| 201 | 161 | /** |
| 202 | - * | |
| 203 | - * | |
| 162 | + * | |
| 163 | + * | |
| 204 | 164 | */ |
| 205 | 165 | public function setBlock($block) { |
| 206 | 166 | // Set block. |
| 207 | 167 | $this->block = $block; |
| @@ -209,12 +169,12 @@ | ||
| 209 | 169 | $closedBlockId = "cjtoolbox-{$this->block->id}"; |
| 210 | 170 | $closedMetaboxes = get_user_meta(get_current_user_id(), 'closedpostboxes_cjtoolbox', true); |
| 211 | 171 | $this->isClosed = in_array($closedBlockId, ((array) $closedMetaboxes)); |
| 212 | 172 | } |
| 213 | - | |
| 173 | + | |
| 214 | 174 | /** |
| 215 | 175 | * put your comment there... |
| 216 | - * | |
| 176 | + * | |
| 217 | 177 | * @param mixed $name |
| 218 | 178 | * @param mixed $value |
| 219 | 179 | */ |
| 220 | 180 | public function setOption($name, $value) { |
| @@ -221,9 +181,9 @@ | ||
| 221 | 181 | $this->params->{$name} = $value; |
| 222 | 182 | // Chains! |
| 223 | 183 | return $this; |
| 224 | 184 | } |
| 225 | - | |
| 185 | + | |
| 226 | 186 | } // End class. |
| 227 | 187 | |
| 228 | 188 | // Hookable! |
| 229 | 189 | CJTBlocksBlockView::define('CJTBlocksBlockView'); |