CSS & JavaScript Toolbox - Version 11

Version Description

Download this release

Release Info

Developer wipeoutmedia
Plugin Icon 128x128 CSS & JavaScript Toolbox
Version 11
Comparing to
See all releases

Code changes from version 10.1 to 11

Files changed (80) hide show
  1. access.points/extensions.accesspoint.php +0 -104
  2. autoload.inc.php +2 -1
  3. controllers/block-ajax.php +11 -2
  4. controllers/block.php +57 -0
  5. controllers/blocks-ajax.php +5 -2
  6. controllers/blocks-coupling.php +57 -17
  7. controllers/templates-lookup.php +35 -6
  8. css-js-toolbox.php +5 -5
  9. framework/CouplingHookAttacher.php +218 -0
  10. framework/PluggableHelper.abstract.php +17 -4
  11. framework/css/toolbox.css +8 -8
  12. framework/extensions/extensions.class.php +79 -5
  13. framework/js/ajax/cjt-server-queue/cjt-server-queue.js +69 -51
  14. framework/js/misc/simple-error-dialog/simple-error-dialog.js +28 -28
  15. framework/js/ui/jquery.toolbox/jquery.toolbox.js +216 -67
  16. framework/mvc/controller-ajax.inc.php +1 -1
  17. includes/html/incompatible_cjtplus_version.html.php +38 -0
  18. includes/installer/upgrade/1.6/upgrade.class.php +46 -0
  19. models/block-templates.php +21 -0
  20. models/block.php +1 -1
  21. models/blocks.php +136 -69
  22. models/installer.php +1 -1
  23. readme.txt +52 -8
  24. vendor/autoload.php +1 -1
  25. vendor/composer/ClassLoader.php +74 -16
  26. vendor/composer/LICENSE +21 -0
  27. vendor/composer/autoload_classmap.php +1 -0
  28. vendor/composer/autoload_real.php +23 -18
  29. vendor/composer/autoload_static.php +142 -0
  30. vendor/composer/installed.json +1 -0
  31. views/blocks/block/public/css/block.css +261 -70
  32. views/blocks/block/public/css/codefile.css +17 -18
  33. views/blocks/block/public/images/toolbox/footer-hook.png +0 -0
  34. views/blocks/block/public/images/toolbox/header-hook.png +0 -0
  35. views/blocks/block/public/images/toolbox/hook.png +0 -0
  36. views/blocks/block/public/js/ajax/ajax.js +7 -7
  37. views/blocks/block/public/js/block/block.js +2 -2
  38. views/blocks/block/public/js/blockproperty/blockproperty.js +6 -0
  39. views/blocks/block/public/js/codefile-manager/codefile-manager.js +72 -32
  40. views/blocks/block/public/js/codefile-manager/codefile-manager.localization.php +1 -0
  41. views/blocks/block/public/js/codefile/codefile.js +29 -14
  42. views/blocks/block/public/js/jquery.block/jquery.block.js +710 -214
  43. views/blocks/block/public/js/jquery.block/jquery.block.localization.php +14 -4
  44. views/blocks/block/public/js/optional/revision/revision.js +22 -9
  45. views/blocks/block/public/js/plugins/dockmodule.js +6 -0
  46. views/blocks/block/tmpl/codefile/codefile.html.tmpl +43 -44
  47. views/blocks/block/tmpl/content.html.tmpl +44 -17
  48. views/blocks/block/tmpl/edit.html.tmpl +10 -15
  49. views/blocks/block/tmpl/templates/toolbox.html.tmpl +129 -29
  50. views/blocks/block/view.php +79 -39
  51. views/blocks/cjt-block/public/css/block.css +3 -2
  52. views/blocks/cjt-block/public/js/jquery.assignpanel/jquery.assignpanel.js +31 -4
  53. views/blocks/cjt-block/tmpl/assign-panel.html.tmpl +18 -0
  54. views/blocks/cjt-block/tmpl/default.html.tmpl +10 -5
  55. views/blocks/cjt-block/tmpl/new.html.tmpl +41 -4
  56. views/blocks/cjt-block/tmpl/templates/assign-panel/default.html.tmpl +5 -3
  57. views/blocks/cjt-block/view.php +10 -1
  58. views/blocks/create-metabox/public/js/metabox/metabox.js +12 -1
  59. views/blocks/create-metabox/tmpl/create.html.tmpl +30 -4
  60. views/blocks/info/tmpl/default.html.tmpl +41 -22
  61. views/blocks/manager/public/css/blocks.css +6 -5
  62. views/blocks/manager/public/images/css-js-toolbox-logo.png +0 -0
  63. views/blocks/manager/public/js/blocks-page/blocks-page.js +1 -2
  64. views/blocks/manager/public/js/blocks-page/blocks-page.localization.php +1 -1
  65. views/blocks/manager/tmpl/blocks.html.tmpl +11 -28
  66. views/blocks/metabox/public/css/metabox.css +7 -2
  67. views/blocks/metabox/public/js/jquery.block/jquery.block.js +40 -0
  68. views/blocks/metabox/public/js/metabox/metabox.js +40 -11
  69. views/blocks/metabox/public/js/metabox/metabox.localization.php +1 -0
  70. views/blocks/metabox/tmpl/metabox.html.tmpl +34 -5
  71. views/blocks/new/public/js/add-new-block/add-new-block.js +20 -20
  72. views/blocks/new/tmpl/default.html.tmpl +27 -12
  73. views/blocks/revisions/tmpl/default.html.tmpl +34 -0
  74. views/dashboard/metabox/statistics/tmpl/default.html.tmpl +7 -11
  75. views/installer/install/tmpl/upgrade.html.tmpl +3 -3
  76. views/installer/install/tmpl/upgrades/16.operations +12 -0
  77. views/templates/lookup/public/css/lookup.css +84 -19
  78. views/templates/lookup/public/js/lookup/lookup.js +23 -9
  79. views/templates/lookup/tmpl/default.html.tmpl +65 -68
  80. views/templates/lookup/view.php +19 -1
access.points/extensions.accesspoint.php DELETED
@@ -1,104 +0,0 @@
1
- <?php
2
- /**
3
- *
4
- */
5
-
6
- // Disallow direct access.
7
- defined('ABSPATH') or die("Access denied");
8
-
9
- /**
10
- *
11
- */
12
- class CJTExtensionsAccessPoint extends CJTAccessPoint {
13
-
14
- /**
15
- *
16
- */
17
- const MENU_POSITION_INDEX = 2;
18
-
19
- /**
20
- *
21
- */
22
- const PLUGINS_PAGE_SEARCH_TERM = 'css-javascript-toolbox';
23
-
24
- /**
25
- * put your comment there...
26
- *
27
- */
28
- public function __construct() {
29
- // Initialize Access Point base!
30
- parent::__construct();
31
- // Set access point name!
32
- $this->name = 'extensions';
33
- }
34
-
35
- /**
36
- * put your comment there...
37
- *
38
- */
39
- protected function doListen() {
40
- // Only if permitted!
41
- if ($this->hasAccess()) {
42
- // Add menu pages.
43
- add_action('admin_menu', array(&$this, 'menu'), 13);
44
- }
45
- }
46
-
47
- /**
48
- * put your comment there...
49
- *
50
- */
51
- public function menu() {
52
- // Extensions page.
53
- // add_submenu_page(CJTPlugin::PLUGIN_REQUEST_ID, null, cssJSToolbox::getText('Extensions'), 'administrator', null);
54
- // Hack Extensions menu item to point to Plugins page!
55
- // $GLOBALS['submenu'][CJTPlugin::PLUGIN_REQUEST_ID][self::MENU_POSITION_INDEX][2] = admin_url('plugins.php?s=' . self::PLUGINS_PAGE_SEARCH_TERM);
56
- // When plugins page loaded!
57
-
58
- /**
59
- * Need this to fix the menu issue with CJT PLUS 8.4 or lower.
60
- *
61
- */
62
- if ( class_exists( 'CJTPlus' ) ) :
63
- $reflector = new \ReflectionClass( 'CJTPlus' );
64
- $CJTPlusVersion = get_plugin_data( str_replace( 'plus.class', 'plus', $reflector->getFileName() ) )['Version'];
65
-
66
- if ( version_compare( $CJTPlusVersion, '8.4', '<=' ) ) {
67
- global $menu, $submenu;
68
-
69
- # Find CJT Menu and Sub Menu, ADD PLUS to the title
70
- foreach( $menu as & $menuItem )
71
- {
72
-
73
- if ( $menuItem[ 2 ] == 'cjtoolbox' )
74
- {
75
- $submenu[ 'cjtoolbox' ][ 0 ] [ 0 ] = $menuItem[ 0 ];
76
- $submenu[ 'cjtoolbox' ][ 0 ] [ 1 ] = 'administrator';
77
- $submenu[ 'cjtoolbox' ][ 0 ] [ 2 ] = 'cjtoolbox';
78
- }
79
- }
80
- }
81
- endif;
82
-
83
- add_action('load-plugins.php', array($this, 'route'), 10, 0);
84
- }
85
-
86
- /**
87
- * put your comment there...
88
- *
89
- */
90
- public function route($loadView = null, $request = array('view' => 'extensions/plugins-list')) {
91
- // Set as connected object!
92
- $this->connected();
93
- // Load extensions view throughjt the default controller!
94
- parent::route($loadView, $request)
95
- // Set Action name!
96
- ->setAction('extensions')
97
- // Dispatch the call!
98
- ->_doAction();
99
- }
100
-
101
- } // End class.
102
-
103
- // Hookable!
104
- CJTExtensionsAccessPoint::define('CJTExtensionsAccessPoint', array('hookType' => CJTWordpressEvents::HOOK_FILTER));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
autoload.inc.php CHANGED
@@ -24,7 +24,8 @@ $map->offsetSet( 'CJTBlockModel', 'models/block.php' );
24
  $map->offsetSet( 'CJTBlocksModel', 'models/blocks.php' );
25
  $map->offsetSet( 'CJTAccessPoint', 'framework/access-points/access-point.class.php' );
26
  $map->offsetSet( 'CJTPageAccessPoint', 'framework/access-points/page.class.php' );
 
27
 
28
 
29
  # Composer Autoloads (All the above autoloads is deprecated and will be revmoed later)
30
- require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
24
  $map->offsetSet( 'CJTBlocksModel', 'models/blocks.php' );
25
  $map->offsetSet( 'CJTAccessPoint', 'framework/access-points/access-point.class.php' );
26
  $map->offsetSet( 'CJTPageAccessPoint', 'framework/access-points/page.class.php' );
27
+ $map->offsetSet( 'CJTBlockTemplatesModel', 'models/block-templates.php' );
28
 
29
 
30
  # Composer Autoloads (All the above autoloads is deprecated and will be revmoed later)
31
+ require __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
controllers/block-ajax.php CHANGED
@@ -37,6 +37,7 @@ class CJTBlockAjaxController extends CJTAjaxController {
37
  $this->registryAction('restoreRevision');
38
  $this->registryAction('loadUrl');
39
  $this->registryAction('downloadCodeFile');
 
40
  }
41
 
42
  /**
@@ -49,6 +50,14 @@ class CJTBlockAjaxController extends CJTAjaxController {
49
  $this->redirect('block');
50
  }
51
 
 
 
 
 
 
 
 
 
52
  /**
53
  * put your comment there...
54
  *
@@ -68,7 +77,7 @@ class CJTBlockAjaxController extends CJTAjaxController {
68
  // Pass to CJTBlockController!
69
  $this->redirect('block');
70
  }
71
-
72
  /**
73
  * put your comment there...
74
  *
@@ -143,7 +152,7 @@ class CJTBlockAjaxController extends CJTAjaxController {
143
  $view = $this->getView('blocks/revisions');
144
  // Push view vars.
145
  $view->blockId = $blockId;
146
- $view->revisions = $revisions;
147
  // Set output header.
148
  $this->httpContentType = 'text/html';
149
  // Return view content.
37
  $this->registryAction('restoreRevision');
38
  $this->registryAction('loadUrl');
39
  $this->registryAction('downloadCodeFile');
40
+ $this->registryAction('getAllAssignment');
41
  }
42
 
43
  /**
50
  $this->redirect('block');
51
  }
52
 
53
+ /**
54
+ * put your comment there...
55
+ *
56
+ */
57
+ protected function getAllAssignmentAction() {
58
+ $this->redirect('block');
59
+ }
60
+
61
  /**
62
  * put your comment there...
63
  *
77
  // Pass to CJTBlockController!
78
  $this->redirect('block');
79
  }
80
+
81
  /**
82
  * put your comment there...
83
  *
152
  $view = $this->getView('blocks/revisions');
153
  // Push view vars.
154
  $view->blockId = $blockId;
155
+ $view->revisions = array_reverse($revisions);
156
  // Set output header.
157
  $this->httpContentType = 'text/html';
158
  // Return view content.
controllers/block.php CHANGED
@@ -37,6 +37,8 @@ class CJTBlockController extends CJTAjaxController {
37
  $this->registryAction('loadUrl');
38
  $this->registryAction('getCode');
39
  $this->registryAction('downloadCodeFile');
 
 
40
  }
41
 
42
  /**
@@ -75,6 +77,35 @@ class CJTBlockController extends CJTAjaxController {
75
  $this->response = $codeFile->code;
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  /**
79
  * Query single block based on the provided criteria!
80
  *
@@ -89,6 +120,32 @@ class CJTBlockController extends CJTAjaxController {
89
  $this->response = array_intersect_key((array) $this->model->getBlockBy(), $returns);
90
  }
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  /**
93
  * Get assigment panel objects page.
94
  *
37
  $this->registryAction('loadUrl');
38
  $this->registryAction('getCode');
39
  $this->registryAction('downloadCodeFile');
40
+ $this->registryAction('getAllAssignment');
41
+ $this->registryAction('getCodeFilesCount');
42
  }
43
 
44
  /**
77
  $this->response = $codeFile->code;
78
  }
79
 
80
+
81
+ /**
82
+ * put your comment there...
83
+ *
84
+ */
85
+ public function getAllAssignmentAction() {
86
+
87
+ $blockId = isset($_GET['blockId']) ? $_GET['blockId'] : null;
88
+
89
+ try {
90
+
91
+ if (!$blockId) {
92
+
93
+ throw new Exception('Invalid Request parameters');
94
+ }
95
+
96
+ $blocks = new CJTBlocksModel();
97
+
98
+ $block = $blocks->getBlock($blockId);
99
+
100
+ $this->response = count(CJTBlocksModel::getAllAssignments($block));
101
+ }
102
+ catch (Exception $exception) {
103
+
104
+
105
+ }
106
+
107
+ }
108
+
109
  /**
110
  * Query single block based on the provided criteria!
111
  *
120
  $this->response = array_intersect_key((array) $this->model->getBlockBy(), $returns);
121
  }
122
 
123
+ /**
124
+ * put your comment there...
125
+ *
126
+ */
127
+ protected function getCodeFilesCountAction() {
128
+
129
+
130
+ $blockId = isset($_GET['blockId']) ? $_GET['blockId'] : null;
131
+
132
+ try {
133
+
134
+ if (!$blockId) {
135
+
136
+ throw new Exception('Invalid Request parameters');
137
+ }
138
+
139
+ $this->response = count(CJTBlocksModel::getCodeFilesCount($blockId));
140
+ }
141
+ catch (Exception $exception) {
142
+
143
+
144
+ }
145
+
146
+
147
+ }
148
+
149
  /**
150
  * Get assigment panel objects page.
151
  *
controllers/blocks-ajax.php CHANGED
@@ -198,7 +198,7 @@ class CJTBlocksAjaxController extends CJTAjaxController {
198
  // make sure we're save.
199
  if ( is_array( $blocksToSave ) && ! empty( $blocksToSave ) )
200
  {
201
-
202
  foreach ( $blocksToSave as $id => $postedblockPartialData )
203
  {
204
  // Push block id into block data.
@@ -219,7 +219,9 @@ class CJTBlocksAjaxController extends CJTAjaxController {
219
  $this->model->save();
220
 
221
  // Send the changes properties back to client.
222
- foreach ( $postedblockPartialData as $property => $value )
 
 
223
  {
224
  $response[ $id ][ $property ][ 'value' ] = $value;
225
  }
@@ -234,6 +236,7 @@ class CJTBlocksAjaxController extends CJTAjaxController {
234
  // Save changes.
235
  $this->model->save();
236
 
 
237
  // Set response.
238
  $this->response = $response;
239
 
198
  // make sure we're save.
199
  if ( is_array( $blocksToSave ) && ! empty( $blocksToSave ) )
200
  {
201
+
202
  foreach ( $blocksToSave as $id => $postedblockPartialData )
203
  {
204
  // Push block id into block data.
219
  $this->model->save();
220
 
221
  // Send the changes properties back to client.
222
+ $updatedBlockData = $this->model->getBlock($id, null, array('*'), ARRAY_A);
223
+
224
+ foreach ( $updatedBlockData as $property => $value )
225
  {
226
  $response[ $id ][ $property ][ 'value' ] = $value;
227
  }
236
  // Save changes.
237
  $this->model->save();
238
 
239
+ // Return
240
  // Set response.
241
  $this->response = $response;
242
 
controllers/blocks-coupling.php CHANGED
@@ -24,9 +24,9 @@ class CJTBlocksCouplingController extends CJTController {
24
  *
25
  * @var mixed
26
  */
27
- protected $blocks = array(
28
- 'code' => array('header' => '', 'footer' => ''),
29
- 'scripts' => array('header' => array(), 'footer' => array()),
30
  );
31
 
32
  /**
@@ -43,6 +43,13 @@ class CJTBlocksCouplingController extends CJTController {
43
  */
44
  protected $filters = null;
45
 
 
 
 
 
 
 
 
46
  /**
47
  * put your comment there...
48
  *
@@ -232,23 +239,41 @@ class CJTBlocksCouplingController extends CJTController {
232
  * @return void
233
  */
234
  public function __construct() {
 
235
  // Only one instance is allowed.
236
  if (self::$instance) {
237
  throw new Exception('Trying to instantiate multiple coupling instances!!');
238
  }
 
239
  // Hold the single instance we've!
240
  self::$instance = $this;
241
  $siteHook = cssJSToolbox::$config->core->siteHook;
 
242
  // Initialize controller.
243
  parent::__construct(false);
 
244
  // Import related libraries
245
  CJTModel::import('block');
 
246
  // Not default action needed.
247
  $this->defaultAction = null;
 
 
 
 
 
 
 
 
 
 
 
 
248
  // Initialize controller.
249
  $initCouplingCallback = $this->onassigncouplingcallback(array(&$this, 'initCoupling'));
250
  add_action('admin_init', $initCouplingCallback);
251
  add_action($siteHook->tag, $initCouplingCallback, $siteHook->priority);
 
252
  // Add Shortcode callbacks.
253
  add_shortcode('cjtoolbox', array(&$this, 'shortcode'));
254
  }
@@ -281,7 +306,7 @@ class CJTBlocksCouplingController extends CJTController {
281
  $metaBoxesOrder = $this->onblocksorder( $this->model->getOrder() );
282
 
283
  // Get ORDER-INDEX <TO> BLOCK-ID mapping.
284
- preg_match_all( '/cjtoolbox-(\d+)/', $metaBoxesOrder[ 'normal' ], $blocksOrder, PREG_SET_ORDER );
285
 
286
  /**
287
  * append more to orders produced by CJTBlocksCouplingController::setRequestFilter().
@@ -332,6 +357,7 @@ class CJTBlocksCouplingController extends CJTController {
332
 
333
  foreach ( $blocksOrder as $blockOrder )
334
  {
 
335
  $blockId = (int) $blockOrder[1];
336
 
337
  // As mentioned above. Orders is for all blocks not just those queried from db.
@@ -418,6 +444,12 @@ class CJTBlocksCouplingController extends CJTController {
418
  // CODE UPDATED BY RBJ -- END
419
  }
420
 
 
 
 
 
 
 
421
  $this->blocks[ 'code' ][ $block->location ] .= $this->onappendcode( $evaluatedCode );
422
 
423
  // Store all used Ids in the CORRECT ORDER.
@@ -462,6 +494,14 @@ class CJTBlocksCouplingController extends CJTController {
462
  return $this->ongetfilters($this->filters);
463
  }
464
 
 
 
 
 
 
 
 
 
465
  /**
466
  * put your comment there...
467
  *
@@ -508,17 +548,20 @@ class CJTBlocksCouplingController extends CJTController {
508
  }
509
  // Get current application hook prefix.
510
  $actionsPrefix = is_admin() ? 'admin' : 'wp';
 
511
  // Get cache or get blocks if not cached.
512
  // If there is no cache or no blocks for output
513
  // do nothing.
514
  if ($this->getCached() || $this->getBlocks()) {
 
515
  // Output blocks on various locations!
516
- add_action("{$actionsPrefix}_head", array(&$this, 'outputBlocks'), 30);
517
- add_action("{$actionsPrefix}_footer", array(&$this, 'outputBlocks'), 30);
518
  // Links templates & styloes!
519
  add_action("{$actionsPrefix}_enqueue_scripts", array(&$this, 'linkTemplates'), 30);
520
  add_action("{$actionsPrefix}_print_styles", array(&$this, 'linkTemplates'), 30);
521
  }
 
522
  // Link style sheet in footer required custom implementation.
523
  add_action("{$actionsPrefix}_print_footer_scripts", array(&$this, 'linkFooterStyleSheets'), 9);
524
  // Make sure this is executed only once.
@@ -597,17 +640,14 @@ class CJTBlocksCouplingController extends CJTController {
597
  *
598
  */
599
  public function outputBlocks() {
600
- // Derived location name from wordpress filter name.
601
- $currentFilter = current_filter();
602
- // Map "wp hook location" to "block hook location".
603
- $locationsMap = array('head' => 'header', 'footer' => 'footer');
604
- // This hook is used across both ends, front and back ends.
605
- // Remove application prefix (wp_ or admin_).
606
- // Remining is head or footer.
607
- $location = str_replace(array('wp_', 'admin_'), '', $currentFilter);
608
- // Map to block location.
609
- $location = $locationsMap[$location];
610
- echo $this->onoutput($this->blocks['code'][$location], $location);
611
  }
612
 
613
  /**
24
  *
25
  * @var mixed
26
  */
27
+ public $blocks = array(
28
+ 'code' => array(),
29
+ 'scripts' => array(),
30
  );
31
 
32
  /**
43
  */
44
  protected $filters = null;
45
 
46
+ /**
47
+ * put your comment there...
48
+ *
49
+ * @var mixed
50
+ */
51
+ protected $hookAttacher;
52
+
53
  /**
54
  * put your comment there...
55
  *
239
  * @return void
240
  */
241
  public function __construct() {
242
+
243
  // Only one instance is allowed.
244
  if (self::$instance) {
245
  throw new Exception('Trying to instantiate multiple coupling instances!!');
246
  }
247
+
248
  // Hold the single instance we've!
249
  self::$instance = $this;
250
  $siteHook = cssJSToolbox::$config->core->siteHook;
251
+
252
  // Initialize controller.
253
  parent::__construct(false);
254
+
255
  // Import related libraries
256
  CJTModel::import('block');
257
+
258
  // Not default action needed.
259
  $this->defaultAction = null;
260
+ $this->hookAttacher = new CJTBlocksCouplingHookAttacher(array(&$this, 'outputBlocks'));
261
+
262
+ // Initialize Blocks array
263
+ foreach ($this->hookAttacher->getFiltersList() as $hooks) {
264
+
265
+ foreach ($hooks as $hook) {
266
+
267
+ $this->blocks['code'][$hook['locationName']] = '';
268
+ $this->blocks['script'][$hook['locationName']] = '';
269
+ }
270
+ }
271
+
272
  // Initialize controller.
273
  $initCouplingCallback = $this->onassigncouplingcallback(array(&$this, 'initCoupling'));
274
  add_action('admin_init', $initCouplingCallback);
275
  add_action($siteHook->tag, $initCouplingCallback, $siteHook->priority);
276
+
277
  // Add Shortcode callbacks.
278
  add_shortcode('cjtoolbox', array(&$this, 'shortcode'));
279
  }
306
  $metaBoxesOrder = $this->onblocksorder( $this->model->getOrder() );
307
 
308
  // Get ORDER-INDEX <TO> BLOCK-ID mapping.
309
+ if ( $metaBoxesOrder ) preg_match_all( '/cjtoolbox-(\d+)/', $metaBoxesOrder[ 'normal' ], $blocksOrder, PREG_SET_ORDER );
310
 
311
  /**
312
  * append more to orders produced by CJTBlocksCouplingController::setRequestFilter().
357
 
358
  foreach ( $blocksOrder as $blockOrder )
359
  {
360
+
361
  $blockId = (int) $blockOrder[1];
362
 
363
  // As mentioned above. Orders is for all blocks not just those queried from db.
444
  // CODE UPDATED BY RBJ -- END
445
  }
446
 
447
+ // Initialize block LOCATION array for the first time
448
+ if (!isset($this->blocks[ 'code' ][ $block->location ])) {
449
+
450
+ $this->blocks[ 'code' ][ $block->location ] = '';
451
+ }
452
+
453
  $this->blocks[ 'code' ][ $block->location ] .= $this->onappendcode( $evaluatedCode );
454
 
455
  // Store all used Ids in the CORRECT ORDER.
494
  return $this->ongetfilters($this->filters);
495
  }
496
 
497
+ /**
498
+ * put your comment there...
499
+ *
500
+ */
501
+ public function & getHooksAttacher() {
502
+ return $this->hookAttacher;
503
+ }
504
+
505
  /**
506
  * put your comment there...
507
  *
548
  }
549
  // Get current application hook prefix.
550
  $actionsPrefix = is_admin() ? 'admin' : 'wp';
551
+
552
  // Get cache or get blocks if not cached.
553
  // If there is no cache or no blocks for output
554
  // do nothing.
555
  if ($this->getCached() || $this->getBlocks()) {
556
+
557
  // Output blocks on various locations!
558
+ $this->hookAttacher->bind();
559
+
560
  // Links templates & styloes!
561
  add_action("{$actionsPrefix}_enqueue_scripts", array(&$this, 'linkTemplates'), 30);
562
  add_action("{$actionsPrefix}_print_styles", array(&$this, 'linkTemplates'), 30);
563
  }
564
+
565
  // Link style sheet in footer required custom implementation.
566
  add_action("{$actionsPrefix}_print_footer_scripts", array(&$this, 'linkFooterStyleSheets'), 9);
567
  // Make sure this is executed only once.
640
  *
641
  */
642
  public function outputBlocks() {
643
+
644
+ $hooks = $this->hookAttacher->getHooksByFilterName(current_filter());
645
+
646
+ foreach ($hooks as $hook) {
647
+
648
+ echo $this->onoutput($this->blocks['code'][$hook['locationName']], $hook['locationName']);
649
+ }
650
+
 
 
 
651
  }
652
 
653
  /**
controllers/templates-lookup.php CHANGED
@@ -39,6 +39,7 @@ class CJTTemplatesLookupController extends CJTAjaxController {
39
  $this->registryAction('link');
40
  $this->registryAction('unlink');
41
  $this->registryAction('unlinkAll');
 
42
  }
43
 
44
  /**
@@ -65,10 +66,36 @@ class CJTTemplatesLookupController extends CJTAjaxController {
65
  $this->response['code'] = $this->model->embedded();
66
  }
67
 
68
- /**
69
- * put your comment there...
70
- *
71
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  protected function linkAction() {
73
  // Read inputs.
74
  $this->model->inputs['templateId'] = $_REQUEST['templateId'];
@@ -79,7 +106,8 @@ class CJTTemplatesLookupController extends CJTAjaxController {
79
  $this->response['newState'] = array(
80
  'action' => 'unlink',
81
  'text' => cssJSToolbox::getText('Unlink'),
82
- 'className' => 'template-action unlink-template'
 
83
  );
84
  }
85
 
@@ -97,7 +125,8 @@ class CJTTemplatesLookupController extends CJTAjaxController {
97
  $this->response['newState'] = array(
98
  'action' => 'link',
99
  'text' => cssJSToolbox::getText('Link'),
100
- 'className' => 'template-action link-template'
 
101
  );
102
  }
103
 
39
  $this->registryAction('link');
40
  $this->registryAction('unlink');
41
  $this->registryAction('unlinkAll');
42
+ $this->registryAction('getBlockLinkedTemplates');
43
  }
44
 
45
  /**
66
  $this->response['code'] = $this->model->embedded();
67
  }
68
 
69
+ /**
70
+ * put your comment there...
71
+ *
72
+ */
73
+ protected function getBlockLinkedTemplatesAction() {
74
+
75
+
76
+ $blockId = isset($_GET['blockId']) ? $_GET['blockId'] : null;
77
+
78
+ try {
79
+
80
+ if (!$blockId) {
81
+
82
+ throw new Exception('Invalid Request parameters');
83
+ }
84
+
85
+ $this->response = CJTBlockTemplatesModel::getLinkedTemplatesCount($blockId);
86
+ }
87
+ catch (Exception $exception) {
88
+
89
+
90
+ }
91
+
92
+
93
+ }
94
+
95
+ /**
96
+ * put your comment there...
97
+ *
98
+ */
99
  protected function linkAction() {
100
  // Read inputs.
101
  $this->model->inputs['templateId'] = $_REQUEST['templateId'];
106
  $this->response['newState'] = array(
107
  'action' => 'unlink',
108
  'text' => cssJSToolbox::getText('Unlink'),
109
+ 'className' => 'template-action unlink-template',
110
+ 'count' => CJTBlockTemplatesModel::getLinkedTemplatesCount($_REQUEST['blockId'])
111
  );
112
  }
113
 
125
  $this->response['newState'] = array(
126
  'action' => 'link',
127
  'text' => cssJSToolbox::getText('Link'),
128
+ 'className' => 'template-action link-template',
129
+ 'count' => CJTBlockTemplatesModel::getLinkedTemplatesCount($_REQUEST['blockId'])
130
  );
131
  }
132
 
css-js-toolbox.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: CSS & JavaScript Toolbox
4
  Plugin URI: https://css-javascript-toolbox.com/
5
  Description: Easily add CSS, JavaScript, HTML and PHP code to unique CJT code blocks and assign them anywhere on your website.
6
- Version: 10.1
7
  Author: Wipeout Media
8
  Author URI: https://css-javascript-toolbox.com
9
  License:
@@ -81,7 +81,7 @@ class CJTPlugin extends CJTHookableClass
81
  /**
82
  *
83
  */
84
- const DB_VERSION = '1.6';
85
 
86
  /**
87
  * put your comment there...
@@ -93,12 +93,12 @@ class CJTPlugin extends CJTHookableClass
93
  /**
94
  *
95
  */
96
- const FW_Version = '4.0';
97
 
98
  /**
99
  *
100
  */
101
- const VERSION = '10';
102
 
103
  /**
104
  *
@@ -385,7 +385,7 @@ function deprecatedPHPCheck()
385
  </div>
386
  <?php }
387
 
388
- if ( version_compare( phpversion(), 7.3, '>=' ) ) {
389
  CJTPlugin::getInstance();
390
  } else {
391
  add_action( 'admin_notices', 'deprecatedPHPCheck' );
3
  Plugin Name: CSS & JavaScript Toolbox
4
  Plugin URI: https://css-javascript-toolbox.com/
5
  Description: Easily add CSS, JavaScript, HTML and PHP code to unique CJT code blocks and assign them anywhere on your website.
6
+ Version: 11
7
  Author: Wipeout Media
8
  Author URI: https://css-javascript-toolbox.com
9
  License:
81
  /**
82
  *
83
  */
84
+ const DB_VERSION = '1.7';
85
 
86
  /**
87
  * put your comment there...
93
  /**
94
  *
95
  */
96
+ const FW_Version = '5.0';
97
 
98
  /**
99
  *
100
  */
101
+ const VERSION = '11';
102
 
103
  /**
104
  *
385
  </div>
386
  <?php }
387
 
388
+ if ( version_compare( phpversion(), 7, '>=' ) ) {
389
  CJTPlugin::getInstance();
390
  } else {
391
  add_action( 'admin_notices', 'deprecatedPHPCheck' );
framework/CouplingHookAttacher.php ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+
7
+ /**
8
+ *
9
+ */
10
+ final class CJTBlocksCouplingHookAttacher {
11
+
12
+
13
+ const GROUP = 'cjt';
14
+
15
+ /**
16
+ * put your comment there...
17
+ *
18
+ * @var mixed
19
+ */
20
+ public $callback;
21
+
22
+ /**
23
+ * put your comment there...
24
+ *
25
+ * @var mixed
26
+ */
27
+ public $filters;
28
+
29
+ /**
30
+ * put your comment there...
31
+ *
32
+ * @var mixed
33
+ */
34
+ private $filtersMap = array();
35
+
36
+ /**
37
+ * put your comment there...
38
+ *
39
+ * @var mixed
40
+ */
41
+ public $groupMap = array();
42
+
43
+ /**
44
+ * put your comment there...
45
+ *
46
+ * @var mixed
47
+ */
48
+ public $textMap = array();
49
+
50
+ /**
51
+ *
52
+ */
53
+ public $typeHandler = null;
54
+
55
+ /**
56
+ * put your comment there...
57
+ *
58
+ * @param mixed $callback
59
+ * @return CJTBlocksCouplingHookAttacher
60
+ */
61
+ public function __construct($callback) {
62
+
63
+ $this->typeHandler = $this;
64
+ $this->callback = $callback;
65
+
66
+ // Initialize filters
67
+ $this->filters = array(
68
+
69
+ // Unattched hooks are attached (dynamically) to either Backend or Frontend by the coupling controller
70
+ 'unattached' => array(
71
+
72
+ /* Database location map name */ /* Wordpress Hook name Part */
73
+ 'header' => array(
74
+ 'name' => 'head',
75
+ 'handler' => $this->callback,
76
+ 'title' => cssJSToolbox::getText('Header'),
77
+ 'text' => cssJSToolbox::getText('Put Block code right before the HTML </header> tag'),
78
+ 'group' => self::GROUP,
79
+ ),
80
+ 'footer' => array(
81
+ 'name' => 'footer',
82
+ 'handler' => $this->callback,
83
+ 'title' => cssJSToolbox::getText('Footer'),
84
+ 'text' => cssJSToolbox::getText('Put Block code at the end of the page'),
85
+ 'group' => self::GROUP,
86
+ ),
87
+ ),
88
+ );
89
+
90
+ do_action(CJTPluggableHelper::ACTION_BLOCKS_COUPLING_INIT_ATTACHER, $this);
91
+
92
+ // Generate filters map even if not bind done yet
93
+ // so that filter names can be used elsewhere
94
+ $this->generateMap();
95
+ }
96
+
97
+ /**
98
+ * Bind all obtained (through the map) filters to Wordpress hooks
99
+ *
100
+ */
101
+ public function & bind() {
102
+
103
+ foreach ($this->filtersMap as $hookFullName => $hooks) {
104
+
105
+ foreach ($hooks as $hook) {
106
+
107
+ add_filter($hookFullName, $hook['handler'], 30);
108
+ }
109
+
110
+ }
111
+
112
+ return $this;
113
+ }
114
+
115
+ /**
116
+ * Generate Hook names by adding the passed prefix to the hook name(s)
117
+ *
118
+ * @param mixed $hooks
119
+ * @param mixed $prefix
120
+ */
121
+ public function genHooks($hooks, $prefix = '') {
122
+
123
+ // Bind hooks strighatly
124
+ foreach ($hooks as $locationName => $hook) {
125
+
126
+ // Create filters map
127
+ $hookFullName = "{$prefix}{$hook['name']}";
128
+
129
+ $hook['locationName'] = $locationName;
130
+ $this->filtersMap[$hookFullName][$locationName] = $hook;
131
+
132
+ // Generate localized text map
133
+ $this->textMap[$hook['locationName']]['title'] = $hook['title'];
134
+ $this->textMap[$hook['locationName']]['text'] = $hook['text'];
135
+
136
+ // Make Group map
137
+ $this->groupMap[$hook['group']][] = $hook['locationName'];
138
+ }
139
+
140
+ }
141
+
142
+ /**
143
+ * Generate unattached hook names by adding either (wp_ or admin_ prefix to the hook name(s)
144
+ *
145
+ * @param mixed $filters
146
+ * @return CJTBlocksCouplingHookAttacher
147
+ */
148
+ public function & genUnattachedHooks($filters) {
149
+
150
+ $this->genHooks($filters, is_admin() ? 'admin_' : 'wp_');
151
+
152
+ return $this;
153
+ }
154
+
155
+ /**
156
+ * Generate all filter names by calling the FILTER-TYPE-HANDLER method
157
+ *
158
+ */
159
+ public function generateMap() {
160
+
161
+ $typeHandler = $this->typeHandler;
162
+
163
+ foreach ($this->filters as $typeName => $filters) {
164
+
165
+ $typeName = ucfirst($typeName);
166
+
167
+ $attacherMethodName = "gen{$typeName}Hooks";
168
+
169
+ $typeHandler->$attacherMethodName($filters);
170
+ }
171
+ }
172
+
173
+ /**
174
+ * put your comment there...
175
+ *
176
+ */
177
+ public function getFiltersList() {
178
+
179
+ return $this->filtersMap;
180
+
181
+ }
182
+
183
+ /**
184
+ * put your comment there...
185
+ *
186
+ * @param mixed $group
187
+ */
188
+ public function getGroupMap($group) {
189
+
190
+ return $this->groupMap[$group];
191
+ }
192
+
193
+ /**
194
+ * put your comment there...
195
+ *
196
+ * @param mixed $filter
197
+ */
198
+ public function getHooksByFilterName($filterName) {
199
+
200
+ return $this->filtersMap[$filterName];
201
+
202
+ }
203
+
204
+ /**
205
+ * put your comment there...
206
+ *
207
+ * @param mixed $locationName
208
+ */
209
+ public function getHookText($locationName, $prop = 'text') {
210
+
211
+ $text = isset($this->textMap[$locationName]) ?
212
+ $this->textMap[$locationName][$prop] :
213
+ '';
214
+
215
+ return $text;
216
+ }
217
+
218
+ }
framework/PluggableHelper.abstract.php CHANGED
@@ -21,9 +21,12 @@ abstract class CJTPluggableHelper
21
  const FILTER_BLOCK_MODEL_PRE_UPDATE_BLOCK_PINS = 'cjt-block-model-pre-update-block-pins';
22
 
23
  const FILTER_BLOCKS_COUPLING_MODEL_BLOCKS_QUEUE = 'cjt-blocks-coupling-model-blocks-queue';
24
-
 
 
25
  const ACTION_BLOCK_CUSTOM_POST_TYPES = 'cjt-block-custom-post-types';
26
-
 
27
  const ACTION_BLOCKS_MANAGER_TOOLBOX_LEFT_BUTTONS = 'cjt-blocks-manager-toolbox-left-buttons';
28
  const ACTION_BLOCKS_MANAGER_TOOLBOX_ADMIN_TOOLS_TOP = 'cjt-blocks-manager-toolbox-tools-top';
29
  const ACTION_BLOCKS_MANAGER_TOOLBOX_RIGHT_BUTTONS = 'cjt-blocks-manager-toolbox-right-buttons';
@@ -31,6 +34,16 @@ abstract class CJTPluggableHelper
31
  const ACTION_BLOCK_SCREEN_INFO_TOP = 'cjt-block-screen-info-top';
32
 
33
  const ACTION_BLOCK_ASSIGN_PANEL_TAB_BOTTOM = 'cjt-block-assign-panel-tab-bottom';
34
-
35
- const ACTION_BLOCK_CODE_FILE_TEMPLATE_CREATE_NEW_FILE = 'cjt-block-code-file-template-create-bew-file';
 
 
 
 
 
 
 
 
 
 
36
  }
21
  const FILTER_BLOCK_MODEL_PRE_UPDATE_BLOCK_PINS = 'cjt-block-model-pre-update-block-pins';
22
 
23
  const FILTER_BLOCKS_COUPLING_MODEL_BLOCKS_QUEUE = 'cjt-blocks-coupling-model-blocks-queue';
24
+
25
+ const FILTER_LOCALIZE_SCRIPT = 'cjt-localize-script';
26
+
27
  const ACTION_BLOCK_CUSTOM_POST_TYPES = 'cjt-block-custom-post-types';
28
+ const ACTION_BLOCK_ASSIGN_PANEL = 'cjt-block-assign-panel';
29
+
30
  const ACTION_BLOCKS_MANAGER_TOOLBOX_LEFT_BUTTONS = 'cjt-blocks-manager-toolbox-left-buttons';
31
  const ACTION_BLOCKS_MANAGER_TOOLBOX_ADMIN_TOOLS_TOP = 'cjt-blocks-manager-toolbox-tools-top';
32
  const ACTION_BLOCKS_MANAGER_TOOLBOX_RIGHT_BUTTONS = 'cjt-blocks-manager-toolbox-right-buttons';
34
  const ACTION_BLOCK_SCREEN_INFO_TOP = 'cjt-block-screen-info-top';
35
 
36
  const ACTION_BLOCK_ASSIGN_PANEL_TAB_BOTTOM = 'cjt-block-assign-panel-tab-bottom';
37
+
38
+ const ACTION_BLOCK_BEFORE_INFO_BAR = 'cjt-block-before-info-bar';
39
+
40
+ const ACTION_BLOCK_CODE_FILE_TEMPLATE_CREATE_NEW_FILE = 'cjt-block-code-file-template-create-new-file';
41
+
42
+ const ACTION_BLOCK_TOOLBOX_TEMPLATE_INSIDE_BEFORE_FLAGS = 'cjt-toolbox-template-toolbox-inside-after-flags';
43
+ const ACTION_BLOCK_TOOLBOX_TEMPLATE_INSIDE_AFTER_FLAGS = 'cjt-toolbox-template-toolbox-inside-before-flags';
44
+
45
+ const ACTION_BLOCKS_COUPLING_INIT_ATTACHER = 'cjt-blocks-coupling-initialize-attacher';
46
+
47
+ const ACTION_BLOCK_INSIDE_TOOLBOX_TEMPLATES_MENU = 'cjt-block-inside-toolbox-templates-menu';
48
+ const ACTION_BLOCK_INFO_BAR_TOP_END = 'cjt-block-info-bar-top-end';
49
  }
framework/css/toolbox.css CHANGED
@@ -29,9 +29,10 @@
29
  }
30
  .cjt-toolbox .icons-group a.cjt-tb-text-link {
31
  padding-left: 30px;
32
- width: 100%;
33
  }
34
- .cjt-toolbox .icons-group .popup-menu {
 
35
  margin-top: -4px;
36
  z-index: 2;
37
  background-color: white;
@@ -43,12 +44,11 @@
43
  border-bottom-left-radius: 3px;
44
  }
45
  .cjt-toolbox .icons-group .popup-menu a.cjt-tb-text-link {
46
- width: 100%;
47
- background-position-x: left;
48
- padding-left: 35px;
49
- padding-top: 6px;
50
- display: flex;
51
- align-items: center;
52
  }
53
  .cjt-toolbox .icons-group a.l-127x23 {
54
  width: 105px;
29
  }
30
  .cjt-toolbox .icons-group a.cjt-tb-text-link {
31
  padding-left: 30px;
32
+ width: 119px;
33
  }
34
+ .cjt-toolbox .icons-group .popup-menu,
35
+ .block-toolbox-menu ul {
36
  margin-top: -4px;
37
  z-index: 2;
38
  background-color: white;
44
  border-bottom-left-radius: 3px;
45
  }
46
  .cjt-toolbox .icons-group .popup-menu a.cjt-tb-text-link {
47
+ background-position-x: left;
48
+ padding-left: 35px;
49
+ padding-top: 6px;
50
+ display: flex;
51
+ align-items: center;
 
52
  }
53
  .cjt-toolbox .icons-group a.l-127x23 {
54
  width: 105px;
framework/extensions/extensions.class.php CHANGED
@@ -54,6 +54,14 @@ class CJTExtensions extends CJTHookableClass {
54
  */
55
  protected $incompatibilies;
56
 
 
 
 
 
 
 
 
 
57
  /**
58
  * put your comment there...
59
  *
@@ -147,6 +155,7 @@ class CJTExtensions extends CJTHookableClass {
147
  * @param mixed $className
148
  */
149
  public function _autoload($className) {
 
150
  // Load only classed defined on the list!
151
  if (isset($this->extensions[$className])) {
152
  $classFile = $this->onautoload($this->extensions[$className]['runtime']['classFile'], $className);
@@ -165,6 +174,32 @@ class CJTExtensions extends CJTHookableClass {
165
  public function __construct($prefix = self::PREFIXS, $loadMethod = self::LOAD_METHOD) {
166
  // Hookable!
167
  parent::__construct();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  // Initializing!
169
  $this->prefix = explode( ',', $prefix );
170
  $this->loadMethod = $loadMethod;
@@ -247,10 +282,13 @@ class CJTExtensions extends CJTHookableClass {
247
  *
248
  */
249
  public function load() {
 
250
  // Initialize.
251
  $frameworkVersion = new CJT_Framework_Version_Version(CJTPlugin::FW_Version);
 
252
  // Auto load CJT extensions files when requested.
253
  spl_autoload_register($this->ontregisterautoload(array($this, '_autoload')));
 
254
  // Load all CJT extensions!
255
  foreach ($this->getExtensions() as $class => $extension) {
256
  // Filters!
@@ -279,6 +317,32 @@ class CJTExtensions extends CJTHookableClass {
279
  $callback = $this->onloadcallback($callback);
280
  // If auto load is speicifd then import class file and bind events.
281
  if ($extension['definition']['primary']['loadMethod'] == 'auto') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  // If frameworkVersion is not provided assume its 0 (Older version)
283
  // before frameworkversion chech even supported.
284
  // otherwise compare it with current frameworkversion
@@ -358,6 +422,8 @@ class CJTExtensions extends CJTHookableClass {
358
  * @TODO: REMOVE HTML-MARKUP. CJT PLUGIN NEVER WRITE MARKUP IMIXED WITH HTML. ITS VERY BAD PROGRAMMING PRACTICE. THIS WILL BE REMOVED NEXT TIME AS WE IN RUSH!!!
359
  */
360
  public function processIncompatibles() {
 
 
361
  // Proces only if in CJT page.
362
  if (!preg_match('/\/plugins\.php|page\=cjtoolbox/', $_SERVER['REQUEST_URI'])) {
363
  return;
@@ -374,14 +440,22 @@ class CJTExtensions extends CJTHookableClass {
374
  // Show details.
375
  $pluginInfo = get_plugin_data($extension['pluginFile']);
376
  // List item Markup
377
- $list .= "<li><a target='_blank' href='{$pluginInfo['PluginURI']}'>{$pluginInfo['Name']}</a> (Status: {$extension['incompatibleMessage']['flag']}, Message: {$extension['incompatibleMessage']['msg']})</li>\n";
 
 
378
  }
 
 
 
 
 
 
 
379
  // Output full message.
380
  // TODO: BAD PRACTICE1!!!!! NEVER MIX HTML WITH PHP, JUST TEMPORARY1!!!
381
- echo "<div class='cjt-incomaptible-extensions-notice updated' style='font-size:14px;font-weight:bold;padding-top:11px'>
382
- <span>{$message}</span>
383
- <ul style='list-style-type: circle;padding-left: 27px;font-size: 12px;'>{$list}</ul>
384
- </div>";
385
  }
386
 
387
  } // End class.
54
  */
55
  protected $incompatibilies;
56
 
57
+ /**
58
+ * put your comment there...
59
+ *
60
+ * @var mixed
61
+ */
62
+ protected $incompatibleAddons = array();
63
+
64
+
65
  /**
66
  * put your comment there...
67
  *
155
  * @param mixed $className
156
  */
157
  public function _autoload($className) {
158
+
159
  // Load only classed defined on the list!
160
  if (isset($this->extensions[$className])) {
161
  $classFile = $this->onautoload($this->extensions[$className]['runtime']['classFile'], $className);
174
  public function __construct($prefix = self::PREFIXS, $loadMethod = self::LOAD_METHOD) {
175
  // Hookable!
176
  parent::__construct();
177
+
178
+ // Initialize incomapiblt addons meta data
179
+ $this->incompatibleAddons = array(
180
+
181
+ 'css-javascript-toolbox-plus' => array(
182
+ '9.4',
183
+ '<',
184
+ 'Aborted',
185
+
186
+ function() {
187
+
188
+ ob_start();
189
+
190
+ require CJTOOLBOX_PATH . DIRECTORY_SEPARATOR . 'includes' .
191
+ DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR .
192
+ 'incompatible_cjtplus_version.html.php';
193
+
194
+ $content = ob_get_clean();
195
+
196
+ return $content;
197
+ }
198
+
199
+ ),
200
+
201
+ );
202
+
203
  // Initializing!
204
  $this->prefix = explode( ',', $prefix );
205
  $this->loadMethod = $loadMethod;
282
  *
283
  */
284
  public function load() {
285
+
286
  // Initialize.
287
  $frameworkVersion = new CJT_Framework_Version_Version(CJTPlugin::FW_Version);
288
+
289
  // Auto load CJT extensions files when requested.
290
  spl_autoload_register($this->ontregisterautoload(array($this, '_autoload')));
291
+
292
  // Load all CJT extensions!
293
  foreach ($this->getExtensions() as $class => $extension) {
294
  // Filters!
317
  $callback = $this->onloadcallback($callback);
318
  // If auto load is speicifd then import class file and bind events.
319
  if ($extension['definition']['primary']['loadMethod'] == 'auto') {
320
+
321
+ // Don't load Incompatible extensions/addons
322
+ if (isset($this->incompatibleAddons[$extension['name']])) {
323
+
324
+ require_once ABSPATH . DIRECTORY_SEPARATOR . 'wp-admin' .
325
+ DIRECTORY_SEPARATOR . 'includes' .
326
+ DIRECTORY_SEPARATOR . 'plugin.php';
327
+
328
+ $incomapatibleAddon = $this->incompatibleAddons[$extension['name']];
329
+ $addonVersion = get_plugin_data($extension['pluginFile'], false, false)['Version'];
330
+ $currentVersion = get_plugin_data( CJTOOLBOX_PLUGIN_FILE )['Version'];
331
+
332
+ if (version_compare($addonVersion,
333
+ $currentVersion,
334
+ $incomapatibleAddon[1])) {
335
+
336
+ $extension['incompatibleMessage']['flag'] = $incomapatibleAddon[2];
337
+ $extension['incompatibleMessage']['msg'] = $incomapatibleAddon[3];
338
+
339
+ $this->incompatibilies[$pluginPath] = $extension;
340
+
341
+ continue;
342
+ }
343
+
344
+ }
345
+
346
  // If frameworkVersion is not provided assume its 0 (Older version)
347
  // before frameworkversion chech even supported.
348
  // otherwise compare it with current frameworkversion
422
  * @TODO: REMOVE HTML-MARKUP. CJT PLUGIN NEVER WRITE MARKUP IMIXED WITH HTML. ITS VERY BAD PROGRAMMING PRACTICE. THIS WILL BE REMOVED NEXT TIME AS WE IN RUSH!!!
423
  */
424
  public function processIncompatibles() {
425
+ global $current_screen;
426
+
427
  // Proces only if in CJT page.
428
  if (!preg_match('/\/plugins\.php|page\=cjtoolbox/', $_SERVER['REQUEST_URI'])) {
429
  return;
440
  // Show details.
441
  $pluginInfo = get_plugin_data($extension['pluginFile']);
442
  // List item Markup
443
+ $list .= is_callable($extension['incompatibleMessage']['msg']) ?
444
+ "<li style='list-style-type:none'>{$extension['incompatibleMessage']['msg']()}</li>" :
445
+ "<li><a target='_blank' href='{$pluginInfo['PluginURI']}'>{$pluginInfo['Name']}</a> (Status: {$extension['incompatibleMessage']['flag']}, Message: {$extension['incompatibleMessage']['msg']})</li>\n";
446
  }
447
+
448
+ $noticeClasses = 'cjt-incomaptible-extensions-notice notice notice-error';
449
+
450
+ if ( $current_screen->id !== 'toplevel_page_cjtoolbox' ) {
451
+ $noticeClasses .= ' is-dismissible';
452
+ }
453
+
454
  // Output full message.
455
  // TODO: BAD PRACTICE1!!!!! NEVER MIX HTML WITH PHP, JUST TEMPORARY1!!!
456
+ echo "<div class='$noticeClasses' style='font-size:14px;font-weight:bold;margin-top: 20px;'>
457
+ <ul style='list-style-type: circle;font-size: 12px;'>{$list}</ul>
458
+ </div>";
 
459
  }
460
 
461
  } // End class.
framework/js/ajax/cjt-server-queue/cjt-server-queue.js CHANGED
@@ -1,40 +1,40 @@
1
  /**
2
  * @version $ Id; cjtserverqueue.js 21-03-2012 03:22:10 Ahmed Said $
3
- *
4
  * CJTServerQueue class.
5
  */
6
 
7
  /*
8
  * Put CJTServerQueue class at global scope.
9
- *
10
  * @var CJTServerQueue
11
  */
12
  var CJTServerQueue;
13
 
14
  /*
15
  * JQuery wrapper for the CJTServerQueue object.
16
- */
17
  (function($) {
18
 
19
  /*
20
  * Abstract base class for Ajax Queue classes.
21
- *
22
  * This is a prototype and cannot be used without a derivided class.
23
  * There is two abstract method must be implemented in the child class.
24
  *
25
  * Abstracts:
26
  * - getData() : This method get called when this.send method is called right before
27
- * sending the request to the server. The purpose of the method is to Encapsulate the
28
  * queues data and prepare it for sending.
29
  * - getResponseParameters(response, data): This method called when server response. The method will be called
30
  * for every added queue. The purpose of the method is to de-encapsulate response object
31
  * to pass for every queue.
32
- *
33
  * @author Ahmed Said
34
  * @version 6
35
  */
36
  CJTServerQueue = function() {
37
-
38
  /*
39
  * Operation Action.
40
  *
@@ -50,13 +50,13 @@ var CJTServerQueue;
50
  this.controller = null;
51
 
52
  /*
53
- * Queue object unique identifier.
54
- *
55
- * @internal
56
  * @var string
57
  */
58
  this.key = '';
59
-
60
  /*
61
  * Lock or Unlock queue object allow and disallow sending
62
  * the request to the server when .send() method is called.
@@ -64,23 +64,25 @@ var CJTServerQueue;
64
  * @var boolean
65
  */
66
  this.locked = false;
67
-
68
  /*
69
  * Operations queue.
70
- *
71
  * All queued operations are stored here waiting
72
  * for sending.
73
  *
74
  * @var object
75
  */
76
- this.queue = [];
77
-
 
 
78
  /*
79
  * Derived classed constructor.
80
- *
81
  * Call this from child classes for initialize objects.
82
- *
83
- * @param string Controller map name.
84
  * @param string Action name.
85
  * @param string Queue key.
86
  * @return void
@@ -93,10 +95,10 @@ var CJTServerQueue;
93
  this.queue = [];
94
  this.locked = false;
95
  }
96
-
97
  /*
98
  * Add request to the queue.
99
- *
100
  * The method push the new data to the queue list.
101
  *
102
  * The returned object is jQuery Ajax-Like object that has .success and .error
@@ -109,46 +111,61 @@ var CJTServerQueue;
109
  * endpoint is extension to send method when the object is locked.
110
  * This allow dispatch method to call deferred methods added through send method
111
  * when the object was locked.
112
- *
113
  * @param object Data to add to queue.
114
  * @param mixed context to be used for deferred callbacks (e.g success, error).
115
  * @param string Queue type.
116
  * @return CJTServer.getDeferredObject.promise()
117
  */
118
- this.add = function(data, context, type) {
119
- var queue = {
120
- deferred : CJTServer.getDeferredObject(),
121
- data : data,
122
- context : context,
123
- type : ((type == undefined) ? 'queue' : type)
124
- };
125
- var promise = queue.deferred.promise();
126
- // Add queue object to the queue.
127
- this.queue.push(queue);
128
- return promise;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  }
130
-
131
  /*
132
  * Clear queues list.
133
- *
134
  * The method quietly clear queue list.
135
  *
136
  * No callbacks called when queue is cleared.
137
- *
138
  * @return void
139
  */
140
  this.clear = function() {
141
  this.queue = [];
142
  }
143
-
144
  /*
145
  * Dispatch callbacks associated for the all the available queues.
146
- *
147
  * @internal
148
- *
149
  * state parameter possible values are:
150
  * - resolve
151
- * - reject
152
  *
153
  * @param string jQuery.Deferred states.
154
  * @param object Response Object to pass to the callbacks.
@@ -181,11 +198,11 @@ var CJTServerQueue;
181
 
182
  /*
183
  * Don't send the queue when send method is called.
184
- *
185
- * This method is great when an operation need to control the behavior of
186
  * another operation. An operation may prevent the queue from sending the request
187
  * and do that in alternative ways.
188
- *
189
  * @return void
190
  */
191
  this.lock = function() {
@@ -197,14 +214,14 @@ var CJTServerQueue;
197
  *
198
  * @param CJTServerQueue Queue object to merge to this queue.
199
  * @return void
200
- */
201
  this.merge = function(serverQueue) {
202
  this.queue = $.merge(this.queue, serverQueue.queue);
203
  }
204
-
205
  /*
206
  * Send queue data to server.
207
- *
208
  * If the object is locked nothing will happen at all.
209
  * If the object is unlocked a call to CJTServer.send method will be
210
  * processed with the data returned from the abstract method .getData().
@@ -216,7 +233,8 @@ var CJTServerQueue;
216
  this.send = function(method, data) {
217
  var ajaxPromise = null;
218
  // Process only of not locked.
219
- if (!this.locked) {
 
220
  var queue = this; // To be used inside .each().
221
  // Merge data param with derived class data for the final request.
222
  // But first mask usre data param is passed.
@@ -241,16 +259,16 @@ var CJTServerQueue;
241
  }
242
  return ajaxPromise;
243
  }
244
-
245
  /*
246
  * Unlock queue object.
247
- *
248
  * @return void
249
- */
250
  this.unlock = function() {
251
  this.locked = false;
252
  }
253
-
254
  } // End class.
255
-
256
  })(jQuery);
1
  /**
2
  * @version $ Id; cjtserverqueue.js 21-03-2012 03:22:10 Ahmed Said $
3
+ *
4
  * CJTServerQueue class.
5
  */
6
 
7
  /*
8
  * Put CJTServerQueue class at global scope.
9
+ *
10
  * @var CJTServerQueue
11
  */
12
  var CJTServerQueue;
13
 
14
  /*
15
  * JQuery wrapper for the CJTServerQueue object.
16
+ */
17
  (function($) {
18
 
19
  /*
20
  * Abstract base class for Ajax Queue classes.
21
+ *
22
  * This is a prototype and cannot be used without a derivided class.
23
  * There is two abstract method must be implemented in the child class.
24
  *
25
  * Abstracts:
26
  * - getData() : This method get called when this.send method is called right before
27
+ * sending the request to the server. The purpose of the method is to Encapsulate the
28
  * queues data and prepare it for sending.
29
  * - getResponseParameters(response, data): This method called when server response. The method will be called
30
  * for every added queue. The purpose of the method is to de-encapsulate response object
31
  * to pass for every queue.
32
+ *
33
  * @author Ahmed Said
34
  * @version 6
35
  */
36
  CJTServerQueue = function() {
37
+
38
  /*
39
  * Operation Action.
40
  *
50
  this.controller = null;
51
 
52
  /*
53
+ * Queue object unique identifier.
54
+ *
55
+ * @internal
56
  * @var string
57
  */
58
  this.key = '';
59
+
60
  /*
61
  * Lock or Unlock queue object allow and disallow sending
62
  * the request to the server when .send() method is called.
64
  * @var boolean
65
  */
66
  this.locked = false;
67
+
68
  /*
69
  * Operations queue.
70
+ *
71
  * All queued operations are stored here waiting
72
  * for sending.
73
  *
74
  * @var object
75
  */
76
+ this.queue = [];
77
+
78
+ this.errors = [];
79
+
80
  /*
81
  * Derived classed constructor.
82
+ *
83
  * Call this from child classes for initialize objects.
84
+ *
85
+ * @param string Controller map name.
86
  * @param string Action name.
87
  * @param string Queue key.
88
  * @return void
95
  this.queue = [];
96
  this.locked = false;
97
  }
98
+
99
  /*
100
  * Add request to the queue.
101
+ *
102
  * The method push the new data to the queue list.
103
  *
104
  * The returned object is jQuery Ajax-Like object that has .success and .error
111
  * endpoint is extension to send method when the object is locked.
112
  * This allow dispatch method to call deferred methods added through send method
113
  * when the object was locked.
114
+ *
115
  * @param object Data to add to queue.
116
  * @param mixed context to be used for deferred callbacks (e.g success, error).
117
  * @param string Queue type.
118
  * @return CJTServer.getDeferredObject.promise()
119
  */
120
+ this.add = function (data, context, type) {
121
+ // Check for special characters in block name.
122
+ if (data.property === 'name') {
123
+ if (!data.value.match(/^[A-Za-z0-9\!\#\@\$\&\*\(\)\[\]\x20\-\_\+\?\:\;\.]{1,50}$/)) {
124
+ alert('The block name cannot contain special characters. Please use A-Z, 0-9, -, _ and space characters only.')
125
+
126
+ this.errors = data.value
127
+ } else {
128
+ this.errors = []
129
+ }
130
+ }
131
+
132
+ if (this.errors.length <= 0) {
133
+ var queue = {
134
+ deferred: CJTServer.getDeferredObject(),
135
+ data: data,
136
+ context: context,
137
+ type: ((type == undefined) ? 'queue' : type)
138
+ };
139
+ var promise = queue.deferred.promise();
140
+ // Add queue object to the queue.
141
+ this.queue.push(queue);
142
+ return promise;
143
+ } else {
144
+ return CJTServer.getDeferredObject().promise()
145
+ }
146
  }
147
+
148
  /*
149
  * Clear queues list.
150
+ *
151
  * The method quietly clear queue list.
152
  *
153
  * No callbacks called when queue is cleared.
154
+ *
155
  * @return void
156
  */
157
  this.clear = function() {
158
  this.queue = [];
159
  }
160
+
161
  /*
162
  * Dispatch callbacks associated for the all the available queues.
163
+ *
164
  * @internal
165
+ *
166
  * state parameter possible values are:
167
  * - resolve
168
+ * - reject
169
  *
170
  * @param string jQuery.Deferred states.
171
  * @param object Response Object to pass to the callbacks.
198
 
199
  /*
200
  * Don't send the queue when send method is called.
201
+ *
202
+ * This method is great when an operation need to control the behavior of
203
  * another operation. An operation may prevent the queue from sending the request
204
  * and do that in alternative ways.
205
+ *
206
  * @return void
207
  */
208
  this.lock = function() {
214
  *
215
  * @param CJTServerQueue Queue object to merge to this queue.
216
  * @return void
217
+ */
218
  this.merge = function(serverQueue) {
219
  this.queue = $.merge(this.queue, serverQueue.queue);
220
  }
221
+
222
  /*
223
  * Send queue data to server.
224
+ *
225
  * If the object is locked nothing will happen at all.
226
  * If the object is unlocked a call to CJTServer.send method will be
227
  * processed with the data returned from the abstract method .getData().
233
  this.send = function(method, data) {
234
  var ajaxPromise = null;
235
  // Process only of not locked.
236
+
237
+ if (!this.locked && this.errors.length <= 0) {
238
  var queue = this; // To be used inside .each().
239
  // Merge data param with derived class data for the final request.
240
  // But first mask usre data param is passed.
259
  }
260
  return ajaxPromise;
261
  }
262
+
263
  /*
264
  * Unlock queue object.
265
+ *
266
  * @return void
267
+ */
268
  this.unlock = function() {
269
  this.locked = false;
270
  }
271
+
272
  } // End class.
273
+
274
  })(jQuery);
framework/js/misc/simple-error-dialog/simple-error-dialog.js CHANGED
@@ -1,46 +1,46 @@
1
  /**
2
- *
3
  */
4
 
5
  var CJTSimpleErrorDialog;
6
 
7
  /**
8
- *
9
  */
10
  (function($) {
11
-
12
  /**
13
  * put your comment there...
14
- *
15
  * @param form
16
  */
17
  CJTSimpleErrorDialog = function(form) {
18
-
19
  /**
20
  * put your comment there...
21
- *
22
  */
23
  var inlineElement;
24
-
25
  /**
26
  * put your comment there...
27
- *
28
  * @type String
29
  */
30
  var onset = '';
31
-
32
  /**
33
- *
34
  */
35
  this.errors = [];
36
-
37
  /**
38
- *
39
  */
40
  this.fields = {};
41
-
42
  /**
43
- *
44
  */
45
  this.add = function(name, expression, message) {
46
  // Set fieldset name.
@@ -52,17 +52,17 @@ var CJTSimpleErrorDialog;
52
  }
53
  return this;
54
  }
55
-
56
  /**
57
- *
58
  */
59
  this.clear = function() {
60
  this.errors = [];
61
  return this;
62
  }
63
-
64
  /**
65
- *
66
  */
67
  this.fetchFieldInfo = function(field) {
68
  // Initialize vars!
@@ -78,30 +78,30 @@ var CJTSimpleErrorDialog;
78
  // Make sure its jQuery object!
79
  field = $(field);
80
  //Fetch info.
81
- info.text = form.find('label[for=' + field.prop('id') + ']').text().replace('*', '');
82
  return info;
83
  }
84
-
85
  /**
86
- *
87
  */
88
  this.hasError = function() {
89
  return this.errors.length ? true : false;
90
  }
91
-
92
  /**
93
- *
94
  */
95
  this.onSet = function(name) {
96
  onset = name;
97
  return this;
98
  }
99
-
100
  /**
101
  * put your comment there...
102
- *
103
  * @param tab_name
104
- *
105
  * @returns {Boolean}
106
  */
107
  this.show = function(tbParams, showName) {
@@ -133,7 +133,7 @@ var CJTSimpleErrorDialog;
133
  }
134
 
135
  /**
136
- *
137
  */
138
  this.validate = function() {
139
  // Clear errors!
@@ -163,7 +163,7 @@ var CJTSimpleErrorDialog;
163
  );
164
  return this;
165
  }
166
-
167
  // If there is no form id use current time as unique Id.
168
  if (!(inlineElement = $(form).prop('id'))) {
169
  inlineElement = (new Date()).getTime();
1
  /**
2
+ *
3
  */
4
 
5
  var CJTSimpleErrorDialog;
6
 
7
  /**
8
+ *
9
  */
10
  (function($) {
11
+
12
  /**
13
  * put your comment there...
14
+ *
15
  * @param form
16
  */
17
  CJTSimpleErrorDialog = function(form) {
18
+
19
  /**
20
  * put your comment there...
21
+ *
22
  */
23
  var inlineElement;
24
+
25
  /**
26
  * put your comment there...
27
+ *
28
  * @type String
29
  */
30
  var onset = '';
31
+
32
  /**
33
+ *
34
  */
35
  this.errors = [];
36
+
37
  /**
38
+ *
39
  */
40
  this.fields = {};
41
+
42
  /**
43
+ *
44
  */
45
  this.add = function(name, expression, message) {
46
  // Set fieldset name.
52
  }
53
  return this;
54
  }
55
+
56
  /**
57
+ *
58
  */
59
  this.clear = function() {
60
  this.errors = [];
61
  return this;
62
  }
63
+
64
  /**
65
+ *
66
  */
67
  this.fetchFieldInfo = function(field) {
68
  // Initialize vars!
78
  // Make sure its jQuery object!
79
  field = $(field);
80
  //Fetch info.
81
+ info.text = form.find('label[for=' + field.prop('id') + ']').text().replace('*', '');
82
  return info;
83
  }
84
+
85
  /**
86
+ *
87
  */
88
  this.hasError = function() {
89
  return this.errors.length ? true : false;
90
  }
91
+
92
  /**
93
+ *
94
  */
95
  this.onSet = function(name) {
96
  onset = name;
97
  return this;
98
  }
99
+
100
  /**
101
  * put your comment there...
102
+ *
103
  * @param tab_name
104
+ *
105
  * @returns {Boolean}
106
  */
107
  this.show = function(tbParams, showName) {
133
  }
134
 
135
  /**
136
+ *
137
  */
138
  this.validate = function() {
139
  // Clear errors!
163
  );
164
  return this;
165
  }
166
+
167
  // If there is no form id use current time as unique Id.
168
  if (!(inlineElement = $(form).prop('id'))) {
169
  inlineElement = (new Date()).getTime();
framework/js/ui/jquery.toolbox/jquery.toolbox.js CHANGED
@@ -1,14 +1,14 @@
1
  /**
2
  * @version $ Id; cjttoolbox.jquery.js 21-03-2012 03:22:10 Ahmed Said $
3
- *
4
  * CJT Toolbox jQuery Plugin.
5
  */
6
 
7
  /*
8
  * JQuery wrapper for the CJTToolBox Plugin.
9
- */
10
  var CJTToolBoxNS = new (function ($) {
11
-
12
  /**
13
  *
14
  *
@@ -16,7 +16,7 @@ var CJTToolBoxNS = new (function ($) {
16
  *
17
  */
18
  this.ButtonBase = function() {
19
-
20
  /**
21
  *
22
  *
@@ -24,30 +24,30 @@ var CJTToolBoxNS = new (function ($) {
24
  *
25
  */
26
  this.callback = null;
27
-
28
  /**
29
  *
30
  *
31
  *
32
  *
33
- */
34
  this.cssClass = null;
35
-
36
  /**
37
  *
38
  *
39
  *
40
  */
41
  this.enabled = false;
42
-
43
  /**
44
  *
45
  *
46
  *
47
  *
48
- */
49
  this.jButton = null;
50
-
51
  /**
52
  *
53
  *
@@ -55,7 +55,7 @@ var CJTToolBoxNS = new (function ($) {
55
  *
56
  */
57
  this.name = '';
58
-
59
  /**
60
  *
61
  *
@@ -71,7 +71,7 @@ var CJTToolBoxNS = new (function ($) {
71
  *
72
  */
73
  this.toolbox = null;
74
-
75
  /**
76
  *
77
  *
@@ -101,7 +101,7 @@ var CJTToolBoxNS = new (function ($) {
101
  if (!this.enabled) {
102
  this.jButton.bind('click.CJTButton', null, $.proxy(this._onclick, this));
103
  this.jButton.unbind('click.cjtbe-disabled');
104
- this.jButton.removeClass(this.toolbox.params.disabledClass);
105
  this.enabled = true;
106
  }
107
  }
@@ -110,15 +110,15 @@ var CJTToolBoxNS = new (function ($) {
110
  this.jButton.unbind('click.CJTButton');
111
  // For link to act inactive.
112
  this.jButton.bind('click.cjtbe-disabled', (function() {return false;}));
113
- this.jButton.addClass(this.toolbox.params.disabledClass);
114
  this.enabled = false;
115
  }
116
  // Chaining.
117
  return this;
118
  }
119
-
120
  /**
121
- *
122
  */
123
  this.fireCallback = function(params) {
124
  // Proxy to button callback function.
@@ -130,17 +130,17 @@ var CJTToolBoxNS = new (function ($) {
130
  // Fire callback function cna change context to user specified.
131
  return proxyCallback(params);
132
  }
133
-
134
  /**
135
  *
136
  *
137
  *
138
  *
139
- */
140
  this.isEnabled = function() {
141
  return this.enabled;
142
  }
143
-
144
  }; // End class.
145
 
146
  /**
@@ -148,12 +148,12 @@ var CJTToolBoxNS = new (function ($) {
148
  *
149
  *
150
  *
151
- */
152
  this.Button = function(toolbox, name, callback, params) {
153
 
154
  /**
155
  * Event handler for this.params.linkClass.click() event.
156
- *
157
  * The click event is used to dispatch the call to the link handler.
158
  */
159
  this._onclick = function(event) {
@@ -164,20 +164,20 @@ var CJTToolBoxNS = new (function ($) {
164
  // For links to behave inactive (don't put # AND auto scroll to the button).
165
  return false;
166
  }
167
-
168
  /**
169
  *
170
  *
171
  *
172
  *
173
- */
174
  this.Button = function(toolbox, name, callback, params) {
175
  // Parent constructor.
176
  this.ButtonBase(toolbox, name, callback, params);
177
  // Enable/Disable Button events.
178
  this.enable(this.params.enable);
179
  }
180
-
181
  /**
182
  *
183
  *
@@ -201,24 +201,30 @@ var CJTToolBoxNS = new (function ($) {
201
  var method = load ? 'addClass' : 'removeClass';
202
  this.jButton[method](this.toolbox.params.loadingClass);
203
  }
204
-
205
  } // End class.
206
  // Extend ButtonBase Class.
207
  this.Button.prototype = new this.ButtonBase();
208
-
209
  /**
210
  *
211
  *
212
  *
213
  *
214
- */
215
  this.ButtonPopup = function(toolbox, name, callback, params) {
216
 
 
 
 
 
 
 
217
  /**
218
- *
219
  */
220
  this.popupTimer = null;
221
-
222
  /**
223
  *
224
  *
@@ -226,18 +232,25 @@ var CJTToolBoxNS = new (function ($) {
226
  *
227
  */
228
  this.targetElement = null;
229
-
230
  /**
231
  *
232
  *
233
  *
234
  *
235
- */
236
  this._onmouseenter = function() {
237
  var cbMouseOut = null;
 
 
 
 
 
 
238
  // Clear time out in case the mouse is out and entered again.
239
  // By mean don't close dialog if the mouse is out and quickly back again!
240
  clearTimeout(this.popupTimer);
 
241
  // Process only if target element is not visible yet.
242
  // This condition prevent Shaking!
243
  if (this.targetElement.css('display') == 'none') {
@@ -257,7 +270,7 @@ var CJTToolBoxNS = new (function ($) {
257
  *
258
  *
259
  *
260
- */
261
  this._onmouseout = function(event) {
262
  // In all cases just clear the timeout timer.
263
  // It has no effect if the popup is already opened.
@@ -276,7 +289,7 @@ var CJTToolBoxNS = new (function ($) {
276
  }, this)
277
  , 400);
278
  }
279
-
280
  /**
281
  *
282
  *
@@ -293,8 +306,8 @@ var CJTToolBoxNS = new (function ($) {
293
  .mouseenter($.proxy(this._onmouseenter, this))
294
  .click(function() {return false;}); // Behave inactive.
295
  // Prepare popup elements.
296
- this.targetElement = params._type.targetElementObject ?
297
- params._type.targetElement :
298
  this.toolbox.jToolbox.find(params._type.targetElement)
299
  // Be intelegant and don't close for just if the mouse got out
300
  // Please give User a break!!
@@ -303,15 +316,15 @@ var CJTToolBoxNS = new (function ($) {
303
 
304
  /**
305
  * put your comment there...
306
- *
307
  */
308
  this.close = function() {
309
  this.jButton.unbind('mouseout.CJTButtonTouchMouseOut');
310
  this.targetElement.unbind('mouseout.CJTButtonTouchMouseOut').hide();
311
  }
312
-
313
  /**
314
- *
315
  */
316
  this.showPopup = function() {
317
  var cbParams = [this.targetElement, this];
@@ -324,7 +337,7 @@ var CJTToolBoxNS = new (function ($) {
324
  }
325
  // Callback before displaying menu.
326
  if ($.isFunction(this.callback)) {
327
- this.fireCallback(cbParams);
328
  }
329
  // Display target element below button link if desired.
330
  if (this.params._type.setTargetPosition) {
@@ -333,11 +346,147 @@ var CJTToolBoxNS = new (function ($) {
333
  // Show popup form.
334
  this.targetElement.show();
335
  }
336
-
337
  } // End class.
338
  // Extend ButtonBase Class.
339
  this.ButtonPopup.prototype = new this.ButtonBase();
340
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
  /**
342
  *
343
  *
@@ -351,9 +500,9 @@ var CJTToolBoxNS = new (function ($) {
351
  *
352
  *
353
  *
354
- */
355
  this.currentValue = '';
356
-
357
  /**
358
  *
359
  *
@@ -361,7 +510,7 @@ var CJTToolBoxNS = new (function ($) {
361
  *
362
  */
363
  this.list = null;
364
-
365
  /**
366
  *
367
  *
@@ -375,7 +524,7 @@ var CJTToolBoxNS = new (function ($) {
375
  var currentClass = this.params._type.cssMap[this.currentValue];
376
  if (currentClass != undefined) {
377
  // Remove previous value class.
378
- this.jButton.removeClass(currentClass);
379
  }
380
  // Add new value class.
381
  this.jButton.addClass(newValueClass);
@@ -384,7 +533,7 @@ var CJTToolBoxNS = new (function ($) {
384
  this.fireCallback([event, this.params, newValue]);
385
  this.targetElement.hide('fast');
386
  }
387
-
388
  /**
389
  *
390
  *
@@ -412,25 +561,25 @@ var CJTToolBoxNS = new (function ($) {
412
  }
413
  )
414
  }
415
-
416
  }; // End class.
417
  // Extend ButtonBase Class.
418
  this.ButtonPopupList.prototype = new this.ButtonPopup();
419
-
420
  /**
421
  * jQuery Plugin interface.
422
  * version 6
423
  * @author Ahmed Said
424
  */
425
  $.fn.CJTToolBox = function(args) {
426
-
427
  /**
428
  * Process objects list.
429
  */
430
  return this.each(
431
-
432
  function() {
433
-
434
  // If first time to be called for this element
435
  // create new CJToolBox object for the this element.
436
  if (this.CJTToolBox == undefined) {
@@ -440,9 +589,9 @@ var CJTToolBoxNS = new (function ($) {
440
  * the jquery object below.
441
  *
442
  * @var DOMElement
443
- */
444
  var tbDOMElement = this;
445
-
446
  /**
447
  * CJToolbox class.
448
  *
@@ -469,16 +618,16 @@ var CJTToolBoxNS = new (function ($) {
469
  *
470
  */
471
  jToolbox : $(tbDOMElement),
472
-
473
  /**
474
  * Every toolbox may has a position value added as a css class.
475
  *
476
  * CSS position class name schema is : cjtb-position-[POSITION].
477
- *
478
  * @var string
479
- */
480
  position : 'default',
481
-
482
  /**
483
  * Object options.
484
  *
@@ -492,10 +641,10 @@ var CJTToolBoxNS = new (function ($) {
492
  linkClass : 'cjt-tb-link',
493
  loadingClass : 'cjttbs-loading'
494
  },
495
-
496
  /**
497
  * put your comment there...
498
- *
499
  */
500
  add : function(name, data) {
501
  // Get button class from type var.
@@ -513,10 +662,10 @@ var CJTToolBoxNS = new (function ($) {
513
  button[buttonClassName](CJTToolBox, name, data.callback, data.params);
514
  return button;
515
  },
516
-
517
  /**
518
  * Enable or Disable Toolbox user interactions.
519
- *
520
  * @param enabled
521
  */
522
  enable : function(enabled) {
@@ -528,7 +677,7 @@ var CJTToolBoxNS = new (function ($) {
528
  // Chaining.
529
  return this;
530
  },
531
-
532
  /**
533
  * Initialize Toolbox object.
534
  *
@@ -551,9 +700,9 @@ var CJTToolBoxNS = new (function ($) {
551
  }
552
  )
553
  },
554
-
555
  /**
556
- *
557
  */
558
  remove : function(name) {
559
  // Get button.
@@ -565,14 +714,14 @@ var CJTToolBoxNS = new (function ($) {
565
  // Chaining.
566
  return this;
567
  }
568
-
569
  }; // End Toolbox class.
570
-
571
  // Construct new ToolBox object.
572
  CJTToolBox.init();
573
  // Store DOMNode CJTToolBox Reference.
574
  this.CJTToolBox = CJTToolBox;
575
-
576
  } // end if(this.CJTToolBox == undefined)
577
  else {
578
  // Set options or dispatch methods.
1
  /**
2
  * @version $ Id; cjttoolbox.jquery.js 21-03-2012 03:22:10 Ahmed Said $
3
+ *
4
  * CJT Toolbox jQuery Plugin.
5
  */
6
 
7
  /*
8
  * JQuery wrapper for the CJTToolBox Plugin.
9
+ */
10
  var CJTToolBoxNS = new (function ($) {
11
+
12
  /**
13
  *
14
  *
16
  *
17
  */
18
  this.ButtonBase = function() {
19
+
20
  /**
21
  *
22
  *
24
  *
25
  */
26
  this.callback = null;
27
+
28
  /**
29
  *
30
  *
31
  *
32
  *
33
+ */
34
  this.cssClass = null;
35
+
36
  /**
37
  *
38
  *
39
  *
40
  */
41
  this.enabled = false;
42
+
43
  /**
44
  *
45
  *
46
  *
47
  *
48
+ */
49
  this.jButton = null;
50
+
51
  /**
52
  *
53
  *
55
  *
56
  */
57
  this.name = '';
58
+
59
  /**
60
  *
61
  *
71
  *
72
  */
73
  this.toolbox = null;
74
+
75
  /**
76
  *
77
  *
101
  if (!this.enabled) {
102
  this.jButton.bind('click.CJTButton', null, $.proxy(this._onclick, this));
103
  this.jButton.unbind('click.cjtbe-disabled');
104
+ this.jButton.removeClass(this.toolbox.params.disabledClass);
105
  this.enabled = true;
106
  }
107
  }
110
  this.jButton.unbind('click.CJTButton');
111
  // For link to act inactive.
112
  this.jButton.bind('click.cjtbe-disabled', (function() {return false;}));
113
+ this.jButton.addClass(this.toolbox.params.disabledClass);
114
  this.enabled = false;
115
  }
116
  // Chaining.
117
  return this;
118
  }
119
+
120
  /**
121
+ *
122
  */
123
  this.fireCallback = function(params) {
124
  // Proxy to button callback function.
130
  // Fire callback function cna change context to user specified.
131
  return proxyCallback(params);
132
  }
133
+
134
  /**
135
  *
136
  *
137
  *
138
  *
139
+ */
140
  this.isEnabled = function() {
141
  return this.enabled;
142
  }
143
+
144
  }; // End class.
145
 
146
  /**
148
  *
149
  *
150
  *
151
+ */
152
  this.Button = function(toolbox, name, callback, params) {
153
 
154
  /**
155
  * Event handler for this.params.linkClass.click() event.
156
+ *
157
  * The click event is used to dispatch the call to the link handler.
158
  */
159
  this._onclick = function(event) {
164
  // For links to behave inactive (don't put # AND auto scroll to the button).
165
  return false;
166
  }
167
+
168
  /**
169
  *
170
  *
171
  *
172
  *
173
+ */
174
  this.Button = function(toolbox, name, callback, params) {
175
  // Parent constructor.
176
  this.ButtonBase(toolbox, name, callback, params);
177
  // Enable/Disable Button events.
178
  this.enable(this.params.enable);
179
  }
180
+
181
  /**
182
  *
183
  *
201
  var method = load ? 'addClass' : 'removeClass';
202
  this.jButton[method](this.toolbox.params.loadingClass);
203
  }
204
+
205
  } // End class.
206
  // Extend ButtonBase Class.
207
  this.Button.prototype = new this.ButtonBase();
208
+
209
  /**
210
  *
211
  *
212
  *
213
  *
214
+ */
215
  this.ButtonPopup = function(toolbox, name, callback, params) {
216
 
217
+
218
+ /**
219
+ *
220
+ */
221
+ this.enabled = true;
222
+
223
  /**
224
+ *
225
  */
226
  this.popupTimer = null;
227
+
228
  /**
229
  *
230
  *
232
  *
233
  */
234
  this.targetElement = null;
235
+
236
  /**
237
  *
238
  *
239
  *
240
  *
241
+ */
242
  this._onmouseenter = function() {
243
  var cbMouseOut = null;
244
+
245
+ if (!this.enabled) {
246
+
247
+ return;
248
+ }
249
+
250
  // Clear time out in case the mouse is out and entered again.
251
  // By mean don't close dialog if the mouse is out and quickly back again!
252
  clearTimeout(this.popupTimer);
253
+
254
  // Process only if target element is not visible yet.
255
  // This condition prevent Shaking!
256
  if (this.targetElement.css('display') == 'none') {
270
  *
271
  *
272
  *
273
+ */
274
  this._onmouseout = function(event) {
275
  // In all cases just clear the timeout timer.
276
  // It has no effect if the popup is already opened.
289
  }, this)
290
  , 400);
291
  }
292
+
293
  /**
294
  *
295
  *
306
  .mouseenter($.proxy(this._onmouseenter, this))
307
  .click(function() {return false;}); // Behave inactive.
308
  // Prepare popup elements.
309
+ this.targetElement = params._type.targetElementObject ?
310
+ params._type.targetElement :
311
  this.toolbox.jToolbox.find(params._type.targetElement)
312
  // Be intelegant and don't close for just if the mouse got out
313
  // Please give User a break!!
316
 
317
  /**
318
  * put your comment there...
319
+ *
320
  */
321
  this.close = function() {
322
  this.jButton.unbind('mouseout.CJTButtonTouchMouseOut');
323
  this.targetElement.unbind('mouseout.CJTButtonTouchMouseOut').hide();
324
  }
325
+
326
  /**
327
+ *
328
  */
329
  this.showPopup = function() {
330
  var cbParams = [this.targetElement, this];
337
  }
338
  // Callback before displaying menu.
339
  if ($.isFunction(this.callback)) {
340
+ this.fireCallback(cbParams);
341
  }
342
  // Display target element below button link if desired.
343
  if (this.params._type.setTargetPosition) {
346
  // Show popup form.
347
  this.targetElement.show();
348
  }
349
+
350
  } // End class.
351
  // Extend ButtonBase Class.
352
  this.ButtonPopup.prototype = new this.ButtonBase();
353
+
354
+ /**
355
+ *
356
+ *
357
+ *
358
+ *
359
+ */
360
+ this.ButtonClickedPopup = function(toolbox, name, callback, params)
361
+ {
362
+
363
+ /**
364
+ *
365
+ */
366
+ this.popupTimer = null;
367
+
368
+ /**
369
+ *
370
+ *
371
+ *
372
+ *
373
+ */
374
+ this.targetElement = null;
375
+
376
+ /**
377
+ * put your comment there...
378
+ *
379
+ */
380
+ var _onclickbutton = function()
381
+ {
382
+
383
+ if (this.targetElement.css('display') == 'none')
384
+ {
385
+ this.showPopup();
386
+ }
387
+ else
388
+ {
389
+ this.close();
390
+ }
391
+
392
+ return false;
393
+ };
394
+
395
+ /**
396
+ * put your comment there...
397
+ *
398
+ */
399
+ var _onclickpopupbutton = function()
400
+ {
401
+
402
+ this.close();
403
+
404
+ return false;
405
+ };
406
+
407
+ /**
408
+ *
409
+ *
410
+ *
411
+ *
412
+ */
413
+ this.ButtonClickedPopup = function(toolbox, name, callback, params)
414
+ {
415
+ // Set type parameters.
416
+ params._type = $.extend(
417
+ {
418
+ setTargetPosition : true,
419
+ scope : toolbox.jToolbox
420
+ },
421
+ params._type);
422
+
423
+ // Initialize parent/prototype class.
424
+ this.ButtonBase(toolbox, name, callback, params);
425
+
426
+ // Show popup element when mouse entered button element.
427
+ this.jButton.click($.proxy(_onclickbutton, this)
428
+
429
+ ); // Behave inactive.
430
+
431
+ // Prepare popup elements.
432
+ this.targetElement = params._type.targetElementObject ?
433
+ params._type.targetElement :
434
+ params._type.scope.find(params._type.targetElement);
435
+
436
+ // Close when popup clicked
437
+ this.targetElement.find('.' + this.toolbox.params.linkClass).click($.proxy(_onclickpopupbutton, this));
438
+ }
439
+
440
+ /**
441
+ * put your comment there...
442
+ *
443
+ */
444
+ this.close = function()
445
+ {
446
+ this.targetElement.hide();
447
+ }
448
+
449
+ /**
450
+ *
451
+ */
452
+ this.showPopup = function()
453
+ {
454
+
455
+ var cbParams = [this.targetElement, this];
456
+
457
+ // Call onPopup event. If false is returned don't display the list.
458
+ if (this.params._type.onPopup !== undefined)
459
+ {
460
+
461
+ var openPopup = this.params._type.onPopup.apply(this.toolbox.params.context, cbParams);
462
+
463
+ if (!openPopup)
464
+ {
465
+ return false;
466
+ }
467
+ }
468
+
469
+ // Callback before displaying menu.
470
+ if ($.isFunction(this.callback))
471
+ {
472
+ this.fireCallback(cbParams);
473
+ }
474
+
475
+ // Display target element below button link if desired.
476
+ if (this.params._type.setTargetPosition)
477
+ {
478
+ this.targetElement.css ({left : (this.jButton.position().left + 'px')})
479
+ }
480
+
481
+ // Show popup form.
482
+ this.targetElement.show();
483
+ }
484
+
485
+ } // End class.
486
+
487
+ // Extend ButtonBase Class.
488
+ this.ButtonClickedPopup.prototype = new this.ButtonBase();
489
+
490
  /**
491
  *
492
  *
500
  *
501
  *
502
  *
503
+ */
504
  this.currentValue = '';
505
+
506
  /**
507
  *
508
  *
510
  *
511
  */
512
  this.list = null;
513
+
514
  /**
515
  *
516
  *
524
  var currentClass = this.params._type.cssMap[this.currentValue];
525
  if (currentClass != undefined) {
526
  // Remove previous value class.
527
+ this.jButton.removeClass(currentClass);
528
  }
529
  // Add new value class.
530
  this.jButton.addClass(newValueClass);
533
  this.fireCallback([event, this.params, newValue]);
534
  this.targetElement.hide('fast');
535
  }
536
+
537
  /**
538
  *
539
  *
561
  }
562
  )
563
  }
564
+
565
  }; // End class.
566
  // Extend ButtonBase Class.
567
  this.ButtonPopupList.prototype = new this.ButtonPopup();
568
+
569
  /**
570
  * jQuery Plugin interface.
571
  * version 6
572
  * @author Ahmed Said
573
  */
574
  $.fn.CJTToolBox = function(args) {
575
+
576
  /**
577
  * Process objects list.
578
  */
579
  return this.each(
580
+
581
  function() {
582
+
583
  // If first time to be called for this element
584
  // create new CJToolBox object for the this element.
585
  if (this.CJTToolBox == undefined) {
589
  * the jquery object below.
590
  *
591
  * @var DOMElement
592
+ */
593
  var tbDOMElement = this;
594
+
595
  /**
596
  * CJToolbox class.
597
  *
618
  *
619
  */
620
  jToolbox : $(tbDOMElement),
621
+
622
  /**
623
  * Every toolbox may has a position value added as a css class.
624
  *
625
  * CSS position class name schema is : cjtb-position-[POSITION].
626
+ *
627
  * @var string
628
+ */
629
  position : 'default',
630
+
631
  /**
632
  * Object options.
633
  *
641
  linkClass : 'cjt-tb-link',
642
  loadingClass : 'cjttbs-loading'
643
  },
644
+
645
  /**
646
  * put your comment there...
647
+ *
648
  */
649
  add : function(name, data) {
650
  // Get button class from type var.
662
  button[buttonClassName](CJTToolBox, name, data.callback, data.params);
663
  return button;
664
  },
665
+
666
  /**
667
  * Enable or Disable Toolbox user interactions.
668
+ *
669
  * @param enabled
670
  */
671
  enable : function(enabled) {
677
  // Chaining.
678
  return this;
679
  },
680
+
681
  /**
682
  * Initialize Toolbox object.
683
  *
700
  }
701
  )
702
  },
703
+
704
  /**
705
+ *
706
  */
707
  remove : function(name) {
708
  // Get button.
714
  // Chaining.
715
  return this;
716
  }
717
+
718
  }; // End Toolbox class.
719
+
720
  // Construct new ToolBox object.
721
  CJTToolBox.init();
722
  // Store DOMNode CJTToolBox Reference.
723
  this.CJTToolBox = CJTToolBox;
724
+
725
  } // end if(this.CJTToolBox == undefined)
726
  else {
727
  // Set options or dispatch methods.
framework/mvc/controller-ajax.inc.php CHANGED
@@ -109,7 +109,7 @@ abstract class CJTAjaxController extends CJTController {
109
  $method = ucfirst(str_replace('_', ' ', $method));
110
  $method = str_replace(' ', '', $method);
111
  // Lower case the first character.
112
- $method = strtolower($method{0}) . substr($method, 1);
113
  // Cahe method name for child classes to use!
114
  $this->methodName = $method;
115
  // Relying on the trailer "Action" for security.
109
  $method = ucfirst(str_replace('_', ' ', $method));
110
  $method = str_replace(' ', '', $method);
111
  // Lower case the first character.
112
+ $method = strtolower($method[0]) . substr($method, 1);
113
  // Cahe method name for child classes to use!
114
  $this->methodName = $method;
115
  // Relying on the trailer "Action" for security.
includes/html/incompatible_cjtplus_version.html.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ defined('ABSPATH') or die(-1);
7
+
8
+ ?>
9
+
10
+ <div style="font-size:14px;font-weight:bold;">
11
+ <h3 style="color: #0073aa;margin-top: 5px;font-size: 1.2em">WARNING: CJT Free and CJT PLUS are <span style="text-decoration: underline">NOT COMPATIBLE</span></h3><span style="font-weight:100;font-size:13px;">Since version 11, both CJT Free (on WordPress.org) and CJT PLUS (premium extension) has had a major UI and framework update to include many new Hooks. Clearing out your site or browser cache may resolve some issues, but not all. That’s because you are using an older CJT PLUS (version 10, 9.4 or earlier) with the latest CJT Free version 11 or higher. As a CJT PLUS owner, you have a number of options available as shown below. <a target="_blank" href="https://css-javascript-toolbox.com/welcome-to-cjt-plus-version-11">We also explain everything in this article on the CJT website</a>.</span>
12
+ <ul style="list-style-type: circle;padding-left: 27px;font-size: 12px;margin-top:10px;">
13
+ <li>You <span style="text-decoration: underline">MUST</span> update CJT PLUS to the latest version 11 or higher.</li>
14
+ <li>If it won't let you update, you may need to either: <a class="license-key-alt" href="#">activate your valid license key</a>, or <a target="_blank" href="https://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/pricing">purchase a new license key</a> if it has expired.</li>
15
+ <li>If you do not wish to update CJT PLUS to the latest version, then you will need to manually downgrade CJT Free to version 10: <a target="_blank" href="https://downloads.wordpress.org/plugin/css-javascript-toolbox.10.zip">Click to download</a>.</li>
16
+ </ul>
17
+ </div>
18
+
19
+ <script type="text/javascript">
20
+
21
+ jQuery('a.license-key-alt').click(jQuery.proxy(function() {
22
+ var _req = {
23
+ view: 'setup/activation-form',
24
+ component: {
25
+ pluginBase: "css-javascript-toolbox-plus/css-javascript-toolbox-plus.php",
26
+ title: "CJT PLUS"
27
+ },
28
+ TB_iframe: true,
29
+ height: 380
30
+ }
31
+
32
+ var _url = CJTServer.getRequestURL('setup', 'activationFormView', _req);
33
+
34
+ tb_show('CJT Extension License Activation Form', _url)
35
+
36
+ }))
37
+
38
+ </script>
includes/installer/upgrade/1.6/upgrade.class.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ // Disallow direct access.
7
+ defined('ABSPATH') or die("Access denied");
8
+
9
+ /**
10
+ *
11
+ */
12
+ class CJTV16Upgrade {
13
+
14
+ /**
15
+ * put your comment there...
16
+ *
17
+ */
18
+ public function database() {
19
+
20
+ global $wpdb;
21
+
22
+ $query = " ALTER TABLE {$wpdb->prefix}cjtoolbox_blocks
23
+ CHANGE COLUMN `location` `location` VARCHAR(70) NOT NULL DEFAULT 'header';";
24
+
25
+ $wpdb->query($query);
26
+
27
+ // Chaining.
28
+ return $this;
29
+ }
30
+
31
+ /**
32
+ * put your comment there...
33
+ *
34
+ */
35
+ public function finalize() {
36
+
37
+ // Upgrade database internal version number using
38
+ // installer class.
39
+ cssJSToolbox::import('includes:installer:installer:installer.class.php');
40
+ CJTInstaller::getInstance()->finalize();
41
+
42
+ // Chaining.
43
+ return $this;
44
+ }
45
+
46
+ } // End class.
models/block-templates.php CHANGED
@@ -11,6 +11,27 @@ defined('ABSPATH') or die('Access denied');
11
  */
12
  class CJTBlockTemplatesModel extends CJTHookableClass {
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  /**
15
  * Check weather a template is linked to specific block.
16
  *
11
  */
12
  class CJTBlockTemplatesModel extends CJTHookableClass {
13
 
14
+
15
+ /**
16
+ * put your comment there...
17
+ *
18
+ * @param mixed $blockId
19
+ */
20
+ public static function getLinkedTemplatesCount($blockId) {
21
+
22
+ global $wpdb;
23
+
24
+ $query = " SELECT count(*)
25
+ FROM {$wpdb->prefix}cjtoolbox_block_templates
26
+ WHERE blockId = %d;";
27
+
28
+ $query = $wpdb->prepare($query, $blockId);
29
+
30
+ $count = $wpdb->get_var($query);
31
+
32
+ return $count;
33
+ }
34
+
35
  /**
36
  * Check weather a template is linked to specific block.
37
  *
models/block.php CHANGED
@@ -140,7 +140,7 @@ class CJTBlockModel extends CJTModel {
140
  ( isset( $this->propertiesMeta[ $property ][ 'default' ] ) ) ) ?
141
 
142
  $this->propertiesMeta[ $property ][ 'default' ] :
143
- ( $this->properties[ $property ] ?? null );
144
 
145
  return $value;
146
  }
140
  ( isset( $this->propertiesMeta[ $property ][ 'default' ] ) ) ) ?
141
 
142
  $this->propertiesMeta[ $property ][ 'default' ] :
143
+ ( isset( $this->properties[ $property ] ) ? $this->properties[ $property ] : null );
144
 
145
  return $value;
146
  }
models/blocks.php CHANGED
@@ -13,39 +13,39 @@ require_once CJTOOLBOX_TABLES_PATH . '/blocks.php';
13
  require_once CJTOOLBOX_TABLES_PATH . '/block-pins.php';
14
  // MYSQL Queue Driver.
15
  require_once CJTOOLBOX_INCLUDE_PATH . '/db/mysql/queue-driver.inc.php';
16
-
17
  /**
18
  * Provide simple access (read or write) to all Blocks data.
19
- *
20
  * @author Ahmed Said
21
  * @version 6
22
  */
23
  class CJTBlocksModel {
24
-
25
  /**
26
- *
27
  */
28
- const MAX_REVISIONS_PER_BLOCK = 10;
29
-
30
  /**
31
  * put your comment there...
32
- *
33
  * @var mixed
34
  */
35
  protected $dbDriver = null;
36
-
37
  /**
38
  * put your comment there...
39
- *
40
  */
41
  public function __construct() {
42
  // Initialize CTTTable MYSQL Driver.
43
  $this->dbDriver = new CJTMYSQLQueueDriver($GLOBALS['wpdb']);
44
  }
45
-
46
  /**
47
  * put your comment there...
48
- *
49
  * @param mixed $block
50
  * @param mixed $forceAddCodeBlock
51
  */
@@ -77,10 +77,10 @@ class CJTBlocksModel {
77
  // Return Newly added block id.
78
  return $block['id'];
79
  }
80
-
81
  /**
82
  * put your comment there...
83
- *
84
  * @param mixed $blockId
85
  * @param mixed $activeFileId
86
  */
@@ -90,7 +90,7 @@ class CJTBlocksModel {
90
  $pins = new CJTBlockPinsTable($this->dbDriver);
91
  $codeFile = new CJTBlockFilesTable($this->dbDriver);
92
  // We allow only up to self::MAX_REVISIONS_PER_BLOCK revisions per
93
- // block code files So that a single block may has up to
94
  // self::MAX_REVISIONS_PER_BLOCK * count(codeFiles)
95
  $revisions['fields'] = array('id');
96
  $revisions['filters'] = array('type' => 'revision', 'parent' => $blockId, 'masterFile' => $activeFileId);
@@ -99,7 +99,7 @@ class CJTBlocksModel {
99
  if (count($revisions) == self::MAX_REVISIONS_PER_BLOCK) {
100
  $this->delete(array_shift($revisions)->id);
101
  }
102
- // Get block data.
103
  $block['fields'] = array('id', 'lastModified', 'pinPoint', 'links', 'expressions');
104
  // get() developed to return multiple blocks, fetch the first.
105
  $result = $blocks->get($blockId, $block['fields']);
@@ -110,7 +110,7 @@ class CJTBlocksModel {
110
  $block->type = 'revision';
111
  $block->created = current_time('mysql');
112
  $block->owner = get_current_user_id();
113
- $block->masterFile = $activeFileId; // Only the revisioned code file would be exists and must be
114
  // used as the masterFile!
115
  $block->id = $blocks->getNextId(); // Get new id for revision rrecord.
116
  // Add block data.
@@ -129,20 +129,20 @@ class CJTBlocksModel {
129
  ->set('blockId', $block->id)
130
  ->save(true, true);
131
  }
132
-
133
  /**
134
  * Put your comments here...
135
  *
136
  *
137
- * @return
138
- */
139
  public function dbDriver() {
140
  return $this->dbDriver;
141
  }
142
-
143
  /**
144
  * put your comment there...
145
- *
146
  * @param mixed $ids
147
  */
148
  public function delete($ids) {
@@ -186,10 +186,57 @@ class CJTBlocksModel {
186
  // Chaining!
187
  return $this;
188
  }
189
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  /**
191
  * put your comment there...
192
- *
193
  * @param mixed $id
194
  * @param mixed $fields
195
  */
@@ -198,10 +245,10 @@ class CJTBlocksModel {
198
  $block = !empty($blocks) ? reset($blocks) : null;
199
  return $block;
200
  }
201
-
202
  /**
203
  * put your comment there...
204
- *
205
  * @param mixed $ids
206
  */
207
  public function getBlocks($ids = array(), $filters = array(), $fields = array('*'), $returnType = OBJECT_K, $orderBy = array(), $useDefaultBackupFltr = true) {
@@ -247,10 +294,10 @@ class CJTBlocksModel {
247
  }
248
  return $blocks;
249
  }
250
-
251
  /**
252
  * put your comment there...
253
- *
254
  * @param mixed $blockId
255
  * @param mixed $authorId
256
  */
@@ -261,9 +308,29 @@ class CJTBlocksModel {
261
  return $activeFileId;
262
  }
263
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  /**
265
  * put your comment there...
266
- *
267
  * @param mixed $blockId
268
  * @param mixed $authorId
269
  */
@@ -273,60 +340,60 @@ class CJTBlocksModel {
273
 
274
  /**
275
  * put your comment there...
276
- *
277
  */
278
  public static function getCustomPostTypes()
279
  {
280
-
281
  static $postTypes = null;
282
-
283
  if ( $postTypes !== null )
284
  {
285
  return $postTypes;
286
  }
287
-
288
-
289
  $postTypes = array();
290
-
291
  // Create tabs for every custom post under the custom posts tab.
292
  // Get all registered custom posts.
293
  $customPosts = get_post_types( array( 'public' => 1, 'show_ui' => true, '_builtin' => false ), 'objects' );
294
 
295
  // Add tab for every custom post
296
  // Exclude 'Empty' Custom Post Types.
297
- foreach ( $customPosts as $typeName => $customPost )
298
  {
299
- // Check if has posts.
300
  $hasPosts = count( get_posts( array( 'post_type' => $typeName, 'offset' => 0, 'numberposts' => 1 ) ) );
301
-
302
  // Add only types with at least one post exists.
303
- if ( $hasPosts )
304
  {
305
  $postTypes[ $typeName ] = array
306
  (
307
  'title' => $customPost->labels->name,
308
  'renderer' => 'objects-list',
309
  'type' => array
310
- (
311
  'type' => $typeName,
312
  'group' => 'posts',
313
  'targetType' => 'post'
314
  )
315
-
316
  );
317
-
318
  }
319
-
320
  }
321
 
322
  do_action( CJTPluggableHelper::ACTION_BLOCK_CUSTOM_POST_TYPES, $postTypes );
323
-
324
  return $postTypes;
325
  }
326
-
327
  /**
328
  * put your comment there...
329
- *
330
  * @param mixed $id
331
  */
332
  public function getInfo($id) {
@@ -342,26 +409,26 @@ class CJTBlocksModel {
342
  $info->shortcode = "[cjtoolbox name='{$info->name}']";
343
  return $info;
344
  }
345
-
346
  /**
347
  * put your comment there...
348
- *
349
  */
350
  public function getOrder() {
351
  return get_option('meta-box-order_cjtoolbox');
352
  }
353
-
354
  /**
355
  * put your comment there...
356
- *
357
  */
358
  public function save() {
359
  $this->dbDriver->processQueue();
360
  }
361
-
362
  /**
363
  * put your comment there...
364
- *
365
  * @param mixed $order
366
  */
367
  public function setOrder($order) {
@@ -371,51 +438,51 @@ class CJTBlocksModel {
371
  // Update CENTRALIZED order in the options table!
372
  update_option($orderOptionName, $order);
373
  }
374
-
375
  /**
376
  * put your comment there...
377
- *
378
  * @param mixed $block
379
  */
380
- public function update( $block, $updatePins )
381
  {
382
-
383
  $block = ( array ) $block;
384
-
385
  $blocks = new CJTBlocksTable( $this->dbDriver );
386
  $pins = new CJTBlockPinsTable( $this->dbDriver );
387
-
388
  // Update block pins if requested.
389
- if ( $updatePins )
390
  {
391
  // Isolate block pins freom native block data.
392
  $pinsData = array_intersect_key( $block, array_flip( array_keys( CJTBlockModel::getCustomPins() ) ) );
393
-
394
  do_action( CJTPluggableHelper::FILTER_BLOCK_MODEL_PRE_UPDATE_BLOCK_PINS, $block, $pinsData );
395
-
396
  $pins->update( $block[ 'id' ], $pinsData );
397
 
398
  }
399
-
400
  // Update code file
401
- if ( isset( $block[ 'activeFileId' ] ) )
402
  {
403
-
404
  $codeFile = new CJTBlockFilesTable( $this->dbDriver );
405
-
406
  $codeFile->set( 'blockId', $block[ 'id' ] )
407
  ->set( 'id', $block[ 'activeFileId'] )
408
  ->set( 'code', $block[ 'code'] )
409
  ->save();
410
  }
411
-
412
  // Isolate block fields.
413
  $blockData = array_intersect_key($block, $blocks->getFields());
414
-
415
  do_action( CJTPluggableHelper::FILTER_BLOCK_MODEL_PRE_UPDATE_BLOCK, $updatePins, $blockData );
416
-
417
  $blocks->update( $blockData );
418
-
419
  }
420
-
421
  } // End class.
13
  require_once CJTOOLBOX_TABLES_PATH . '/block-pins.php';
14
  // MYSQL Queue Driver.
15
  require_once CJTOOLBOX_INCLUDE_PATH . '/db/mysql/queue-driver.inc.php';
16
+
17
  /**
18
  * Provide simple access (read or write) to all Blocks data.
19
+ *
20
  * @author Ahmed Said
21
  * @version 6
22
  */
23
  class CJTBlocksModel {
24
+
25
  /**
26
+ *
27
  */
28
+ const MAX_REVISIONS_PER_BLOCK = 99;
29
+
30
  /**
31
  * put your comment there...
32
+ *
33
  * @var mixed
34
  */
35
  protected $dbDriver = null;
36
+
37
  /**
38
  * put your comment there...
39
+ *
40
  */
41
  public function __construct() {
42
  // Initialize CTTTable MYSQL Driver.
43
  $this->dbDriver = new CJTMYSQLQueueDriver($GLOBALS['wpdb']);
44
  }
45
+
46
  /**
47
  * put your comment there...
48
+ *
49
  * @param mixed $block
50
  * @param mixed $forceAddCodeBlock
51
  */
77
  // Return Newly added block id.
78
  return $block['id'];
79
  }
80
+
81
  /**
82
  * put your comment there...
83
+ *
84
  * @param mixed $blockId
85
  * @param mixed $activeFileId
86
  */
90
  $pins = new CJTBlockPinsTable($this->dbDriver);
91
  $codeFile = new CJTBlockFilesTable($this->dbDriver);
92
  // We allow only up to self::MAX_REVISIONS_PER_BLOCK revisions per
93
+ // block code files So that a single block may has up to
94
  // self::MAX_REVISIONS_PER_BLOCK * count(codeFiles)
95
  $revisions['fields'] = array('id');
96
  $revisions['filters'] = array('type' => 'revision', 'parent' => $blockId, 'masterFile' => $activeFileId);
99
  if (count($revisions) == self::MAX_REVISIONS_PER_BLOCK) {
100
  $this->delete(array_shift($revisions)->id);
101
  }
102
+ // Get block data.
103
  $block['fields'] = array('id', 'lastModified', 'pinPoint', 'links', 'expressions');
104
  // get() developed to return multiple blocks, fetch the first.
105
  $result = $blocks->get($blockId, $block['fields']);
110
  $block->type = 'revision';
111
  $block->created = current_time('mysql');
112
  $block->owner = get_current_user_id();
113
+ $block->masterFile = $activeFileId; // Only the revisioned code file would be exists and must be
114
  // used as the masterFile!
115
  $block->id = $blocks->getNextId(); // Get new id for revision rrecord.
116
  // Add block data.
129
  ->set('blockId', $block->id)
130
  ->save(true, true);
131
  }
132
+
133
  /**
134
  * Put your comments here...
135
  *
136
  *
137
+ * @return
138
+ */
139
  public function dbDriver() {
140
  return $this->dbDriver;
141
  }
142
+
143
  /**
144
  * put your comment there...
145
+ *
146
  * @param mixed $ids
147
  */
148
  public function delete($ids) {
186
  // Chaining!
187
  return $this;
188
  }
189
+
190
+ /**
191
+ * put your comment there...
192
+ *
193
+ * @param mixed $block
194
+ */
195
+ public static function getAllAssignments($block) {
196
+
197
+ $inPages = $block->pages ? $block->pages : [];
198
+ $inPosts = $block->posts ? $block->posts : [];
199
+ $inCats = $block->categories ? $block->categories : [];
200
+ $inTags = $block->post_tags ? $block->post_tags : [];
201
+ $inLinks = ! empty( $block->links ) ? explode( "\n", $block->links ) : [];
202
+ $inExps = ! empty( $block->expressions ) ? explode( "\n", $block->expressions ) : [];
203
+ $inAux = array();
204
+
205
+ // Found selected Aux
206
+ $auxFlags = array(
207
+ CJTBlockModel::PINS_404_ERROR,
208
+ CJTBlockModel::PINS_ARCHIVE,
209
+ CJTBlockModel::PINS_ATTACHMENT,
210
+ CJTBlockModel::PINS_AUTHOR,
211
+ CJTBlockModel::PINS_BACKEND,
212
+ CJTBlockModel::PINS_CATEGORIES_ALL_CATEGORIES,
213
+ CJTBlockModel::PINS_EXPRESSIONS,
214
+ CJTBlockModel::PINS_FRONTEND,
215
+ CJTBlockModel::PINS_PAGES_ALL_PAGES,
216
+ CJTBlockModel::PINS_POSTS_ALL_POSTS,
217
+ CJTBlockModel::PINS_POSTS_BLOG_INDEX,
218
+ CJTBlockModel::PINS_POSTS_RECENT,
219
+ CJTBlockModel::PINS_SEARCH,
220
+ CJTBlockModel::PINS_TAG
221
+ );
222
+
223
+ foreach ($auxFlags as $auxFlag) {
224
+
225
+ if ($auxFlag & $block->pinPoint) {
226
+
227
+ $inAux[] = $auxFlag;
228
+ }
229
+
230
+ }
231
+
232
+ $allAssignment = array_merge( $inPages, $inPosts, $inCats, $inTags, $inLinks, $inExps, $inAux );
233
+
234
+ return $allAssignment;
235
+ }
236
+
237
  /**
238
  * put your comment there...
239
+ *
240
  * @param mixed $id
241
  * @param mixed $fields
242
  */
245
  $block = !empty($blocks) ? reset($blocks) : null;
246
  return $block;
247
  }
248
+
249
  /**
250
  * put your comment there...
251
+ *
252
  * @param mixed $ids
253
  */
254
  public function getBlocks($ids = array(), $filters = array(), $fields = array('*'), $returnType = OBJECT_K, $orderBy = array(), $useDefaultBackupFltr = true) {
294
  }
295
  return $blocks;
296
  }
297
+
298
  /**
299
  * put your comment there...
300
+ *
301
  * @param mixed $blockId
302
  * @param mixed $authorId
303
  */
308
  return $activeFileId;
309
  }
310
 
311
+ /**
312
+ * put your comment there...
313
+ *
314
+ * @param mixed $blockId
315
+ */
316
+ public static function getCodeFilesCount($blockId) {
317
+
318
+ global $wpdb;
319
+
320
+ $query = " SELECT count(*)
321
+ FROM {$wpdb->prefix}cjtoolbox_block_files f
322
+ WHERE f.blockId = %d;";
323
+
324
+ $query = $wpdb->prepare($query, $blockId);
325
+
326
+ $codeFilesCount = $wpdb->get_var($query);
327
+
328
+ return $codeFilesCount;
329
+ }
330
+
331
  /**
332
  * put your comment there...
333
+ *
334
  * @param mixed $blockId
335
  * @param mixed $authorId
336
  */
340
 
341
  /**
342
  * put your comment there...
343
+ *
344
  */
345
  public static function getCustomPostTypes()
346
  {
347
+
348
  static $postTypes = null;
349
+
350
  if ( $postTypes !== null )
351
  {
352
  return $postTypes;
353
  }
354
+
355
+
356
  $postTypes = array();
357
+
358
  // Create tabs for every custom post under the custom posts tab.
359
  // Get all registered custom posts.
360
  $customPosts = get_post_types( array( 'public' => 1, 'show_ui' => true, '_builtin' => false ), 'objects' );
361
 
362
  // Add tab for every custom post
363
  // Exclude 'Empty' Custom Post Types.
364
+ foreach ( $customPosts as $typeName => $customPost )
365
  {
366
+ // Check if has posts.
367
  $hasPosts = count( get_posts( array( 'post_type' => $typeName, 'offset' => 0, 'numberposts' => 1 ) ) );
368
+
369
  // Add only types with at least one post exists.
370
+ if ( $hasPosts )
371
  {
372
  $postTypes[ $typeName ] = array
373
  (
374
  'title' => $customPost->labels->name,
375
  'renderer' => 'objects-list',
376
  'type' => array
377
+ (
378
  'type' => $typeName,
379
  'group' => 'posts',
380
  'targetType' => 'post'
381
  )
382
+
383
  );
384
+
385
  }
386
+
387
  }
388
 
389
  do_action( CJTPluggableHelper::ACTION_BLOCK_CUSTOM_POST_TYPES, $postTypes );
390
+
391
  return $postTypes;
392
  }
393
+
394
  /**
395
  * put your comment there...
396
+ *
397
  * @param mixed $id
398
  */
399
  public function getInfo($id) {
409
  $info->shortcode = "[cjtoolbox name='{$info->name}']";
410
  return $info;
411
  }
412
+
413
  /**
414
  * put your comment there...
415
+ *
416
  */
417
  public function getOrder() {
418
  return get_option('meta-box-order_cjtoolbox');
419
  }
420
+
421
  /**
422
  * put your comment there...
423
+ *
424
  */
425
  public function save() {
426
  $this->dbDriver->processQueue();
427
  }
428
+
429
  /**
430
  * put your comment there...
431
+ *
432
  * @param mixed $order
433
  */
434
  public function setOrder($order) {
438
  // Update CENTRALIZED order in the options table!
439
  update_option($orderOptionName, $order);
440
  }
441
+
442
  /**
443
  * put your comment there...
444
+ *
445
  * @param mixed $block
446
  */
447
+ public function update( $block, $updatePins )
448
  {
449
+
450
  $block = ( array ) $block;
451
+
452
  $blocks = new CJTBlocksTable( $this->dbDriver );
453
  $pins = new CJTBlockPinsTable( $this->dbDriver );
454
+
455
  // Update block pins if requested.
456
+ if ( $updatePins )
457
  {
458
  // Isolate block pins freom native block data.
459
  $pinsData = array_intersect_key( $block, array_flip( array_keys( CJTBlockModel::getCustomPins() ) ) );
460
+
461
  do_action( CJTPluggableHelper::FILTER_BLOCK_MODEL_PRE_UPDATE_BLOCK_PINS, $block, $pinsData );
462
+
463
  $pins->update( $block[ 'id' ], $pinsData );
464
 
465
  }
466
+
467
  // Update code file
468
+ if ( isset( $block[ 'activeFileId' ] ) )
469
  {
470
+
471
  $codeFile = new CJTBlockFilesTable( $this->dbDriver );
472
+
473
  $codeFile->set( 'blockId', $block[ 'id' ] )
474
  ->set( 'id', $block[ 'activeFileId'] )
475
  ->set( 'code', $block[ 'code'] )
476
  ->save();
477
  }
478
+
479
  // Isolate block fields.
480
  $blockData = array_intersect_key($block, $blocks->getFields());
481
+
482
  do_action( CJTPluggableHelper::FILTER_BLOCK_MODEL_PRE_UPDATE_BLOCK, $updatePins, $blockData );
483
+
484
  $blocks->update( $blockData );
485
+
486
  }
487
+
488
  } // End class.
models/installer.php CHANGED
@@ -199,7 +199,7 @@ class CJTInstallerModel {
199
  */
200
  public function isUpgrade() {
201
  // If the version is not the same and not equal to current version then its upgrading!
202
- $isUpgrade = (($this->installedDbVersion != CJTPlugin::DB_VERSION) && ($this->installedDbVersion != ''));
203
  return $isUpgrade;
204
  }
205
 
199
  */
200
  public function isUpgrade() {
201
  // If the version is not the same and not equal to current version then its upgrading!
202
+ $isUpgrade = (($this->installedDbVersion <= CJTPlugin::DB_VERSION) && ($this->installedDbVersion != ''));
203
  return $isUpgrade;
204
  }
205
 
readme.txt CHANGED
@@ -1,14 +1,14 @@
1
- === CSS & JavaScript Toolbox Plus ===
2
  Contributors: wipeoutmedia
3
  Author URL: https://css-javascript-toolbox.com
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EWDWF75JHT9Q6
5
- Tags: CSS, JavaScript, JS, PHP, HTML, scripts, code, snippets, header, footer, widget, sidebar, shortcode, Gutenberg, code block
6
  License: GPLv2 or later
7
  License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
8
  Requires at least: 4.9 or higher
9
- Requires PHP: 7.3 or higher
10
  Tested up to: 5.5
11
- Stable tag: 10.1
12
 
13
  Add CSS, JavaScript, and even HTML and PHP to our unique code blocks, then choose exactly where you want the code to run. Supports Gutenberg.
14
 
@@ -33,6 +33,9 @@ Add CSS, JavaScript, and even HTML and PHP to our unique code blocks, then choos
33
  Our CJT PLUS premium plugin gives you more options, more tools, and more flexibility. [Click for CJT PLUS Mega Sale!!!](https://css-javascript-toolbox.com/pricing)
34
 
35
  ### BENEFITS OF CJT PLUS ###
 
 
 
36
  * Add code blocks via Shortcodes (includes embedder)
37
  * Add code blocks via Widgets (e.g. for your sidebar or footer)
38
  * Add code blocks via Gutenberg blocks
@@ -50,12 +53,21 @@ Our CJT PLUS premium plugin gives you more options, more tools, and more flexibi
50
 
51
  We have kept the price very low for over 10 years, and with our mega sale on now, the price is even lower. [Click for CJT PLUS Mega Sale!!!](https://css-javascript-toolbox.com/pricing)
52
 
 
 
 
 
 
 
53
  == Installation ==
54
  1. If you're upgrading from older versions its highly recommended to backup your database before upgrading.
55
  2. Upload the 'css-javascript-toolbox' folder to the '/wp-content/plugins/' directory
56
  3. Activate the plugin through the 'Plugins' menu in WordPress
57
  4. Click 'CSS & JavaScript Toolbox' link in the main navigation (left side of your Dashboard).
58
 
 
 
 
59
  == Frequently Asked Questions ==
60
  = Why was the CJT plugin developed and what is it used for? =
61
  The CJT plugin was created to help website authors write their own code. The plugin allows you to contribute to your Wordpress installation code via a simple web interface, where you can modify and extend the functionality and appearance of your website by writing code directly into CJT code blocks. A typical example of using the plugin can include changing the the way a specific Wordpress page is displayed, or making a page more interactive by adding some JavaScript (Dynamic HTML).
@@ -129,8 +141,24 @@ Due to the overwhelming amount of emails we get for users requesting support for
129
  21. See Code Block information at a glance (CJT PLUS ONLY)
130
 
131
  == Changelog ==
132
- = 10.1 =
133
- * Added: Check for PHP 7.3 or higher. Throw WordPress admin notice and abort CJT if less than PHP 7.3 to prevent site crash.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
 
135
  = 10.0 =
136
  * Fix: Styling fixes for WordPress version 5.5
@@ -406,5 +434,21 @@ Fix: Fatal error: 'break' not in the 'loop' or 'switch' context in /path/to/wp-c
406
  * Launch: This is the very first release of CSS & JavaScript Toolbox
407
 
408
  == Upgrade Notice ==
409
- = 10.1 =
410
- * Added: Check for PHP 7.3 or higher. Throw WordPress admin notice and abort CJT if less than PHP 7.3 to prevent site crash.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === CSS & JavaScript Toolbox ===
2
  Contributors: wipeoutmedia
3
  Author URL: https://css-javascript-toolbox.com
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EWDWF75JHT9Q6
5
+ Tags: CSS, JavaScript, JS, PHP, HTML, scripts, code, snippets, hooks, header, footer, widget, sidebar, shortcode, Gutenberg, code block, ads, AdSense, Analytics, GA, advertising, Google, chat, YouTube, Vimeo
6
  License: GPLv2 or later
7
  License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
8
  Requires at least: 4.9 or higher
9
+ Requires PHP: 7 or higher
10
  Tested up to: 5.5
11
+ Stable tag: 11
12
 
13
  Add CSS, JavaScript, and even HTML and PHP to our unique code blocks, then choose exactly where you want the code to run. Supports Gutenberg.
14
 
33
  Our CJT PLUS premium plugin gives you more options, more tools, and more flexibility. [Click for CJT PLUS Mega Sale!!!](https://css-javascript-toolbox.com/pricing)
34
 
35
  ### BENEFITS OF CJT PLUS ###
36
+ * NEW: 8 more Hooks added: Body Open, Before Post Content, After Post Content, Before Post, Excerpt, After Post Excerpt, Before Posts List, After Posts List, Before Post
37
+ * NEW: Upgraded Code Block Toolbar
38
+ * NEW: Upgraded Editor Toolbar
39
  * Add code blocks via Shortcodes (includes embedder)
40
  * Add code blocks via Widgets (e.g. for your sidebar or footer)
41
  * Add code blocks via Gutenberg blocks
53
 
54
  We have kept the price very low for over 10 years, and with our mega sale on now, the price is even lower. [Click for CJT PLUS Mega Sale!!!](https://css-javascript-toolbox.com/pricing)
55
 
56
+ ### WHAT'S NEW IN PLUS ###
57
+ CJT and CJT PLUS used to only have two Hooks, one for the Header and the other for the Footer. We have added another 8 new Hooks for even more flexibility. For example, you may want to include an Ad script (e.g. Google AdSense Ads) before or after your Post Content. Before, you would have had to do workarounds with custom PHP code, or use cumbersome shortcodes in your post. Now this can be done automatically with Hooks.
58
+
59
+ https://www.youtube.com/watch?v=aTq2wH16JNQ
60
+
61
+
62
  == Installation ==
63
  1. If you're upgrading from older versions its highly recommended to backup your database before upgrading.
64
  2. Upload the 'css-javascript-toolbox' folder to the '/wp-content/plugins/' directory
65
  3. Activate the plugin through the 'Plugins' menu in WordPress
66
  4. Click 'CSS & JavaScript Toolbox' link in the main navigation (left side of your Dashboard).
67
 
68
+ UPGRADE TO VERSION 11
69
+ If you have upgraded to the latest version 11, you will need to clear and refresh your browser cache to pull in the new scripts and stylesheets. This includes, clearing out and purging any caches made by third-party cache plugins. This version now supports PHP versions 7.0 or higher to make it even more compatible with earlier versions.
70
+
71
  == Frequently Asked Questions ==
72
  = Why was the CJT plugin developed and what is it used for? =
73
  The CJT plugin was created to help website authors write their own code. The plugin allows you to contribute to your Wordpress installation code via a simple web interface, where you can modify and extend the functionality and appearance of your website by writing code directly into CJT code blocks. A typical example of using the plugin can include changing the the way a specific Wordpress page is displayed, or making a page more interactive by adding some JavaScript (Dynamic HTML).
141
  21. See Code Block information at a glance (CJT PLUS ONLY)
142
 
143
  == Changelog ==
144
+ = 11.0 =
145
+ * Added: 8 More Hooks (Body Open, Before Post Content, After Post Content, Before Post, Excerpt, After Post Excerpt, Before Posts List, After Posts List, Before Post
146
+ * Enhancement: Assignments Panel
147
+ * Enhancement: Templates Panel
148
+ * Enhancement: Code Files Panel
149
+ * Enhancement: Revisions Panel
150
+ * Enhancement: Code Block Toolbar
151
+ * Enhancement: Code Block InfoBar (added Shortcode copy feature)
152
+ * Enhancement: Group Font Size Buttons
153
+ * Enable/Disable: Toolbox menu when block is saved
154
+ * Fix: Framework incompatibility version
155
+ * Fix: Metabox Block InfoBar elements
156
+ * Fix: Minifier was not working
157
+ * Moved: Code Block Toolbar buttons
158
+ * Moved: Code Block Toolbar editor menu (i.e. File, Edit, Settings) to Editor Toolbar as buttons
159
+ * Removed: Clear Block (clears all Code Block code) Editor Toolbar button
160
+ * Removed: Footer/Header All batch buttons
161
+ * Show: Incompatible Hooks "Warning" Notice
162
 
163
  = 10.0 =
164
  * Fix: Styling fixes for WordPress version 5.5
434
  * Launch: This is the very first release of CSS & JavaScript Toolbox
435
 
436
  == Upgrade Notice ==
437
+ = 11.0 =
438
+ * Added: 8 More Hooks (Body Open, Before Post Content, After Post Content, Before Post, Excerpt, After Post Excerpt, Before Posts List, After Posts List, Before Post
439
+ * Enhancement: Assignments Panel
440
+ * Enhancement: Templates Panel
441
+ * Enhancement: Code Files Panel
442
+ * Enhancement: Revisions Panel
443
+ * Enhancement: Code Block Toolbar
444
+ * Enhancement: Code Block InfoBar (added Shortcode copy feature)
445
+ * Enhancement: Group Font Size Buttons
446
+ * Enable/Disable: Toolbox menu when block is saved
447
+ * Fix: Framework incompatibility version
448
+ * Fix: Metabox Block InfoBar elements
449
+ * Fix: Minifier was not working
450
+ * Moved: Code Block Toolbar buttons
451
+ * Moved: Code Block Toolbar editor menu (i.e. File, Edit, Settings) to Editor Toolbar as buttons
452
+ * Removed: Clear Block (clears all Code Block code) Editor Toolbar button
453
+ * Removed: Footer/Header All batch buttons
454
+ * Show: Incompatible Hooks "Warning" Notice
vendor/autoload.php CHANGED
@@ -2,6 +2,6 @@
2
 
3
  // autoload.php @generated by Composer
4
 
5
- require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
  return ComposerAutoloaderInit9d35e2a877717aab14142e845cf84233::getLoader();
2
 
3
  // autoload.php @generated by Composer
4
 
5
+ require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
  return ComposerAutoloaderInit9d35e2a877717aab14142e845cf84233::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -13,9 +13,7 @@
13
  namespace Composer\Autoload;
14
 
15
  /**
16
- * ClassLoader implements a PSR-0 class loader
17
- *
18
- * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
19
  *
20
  * $loader = new \Composer\Autoload\ClassLoader();
21
  *
@@ -39,6 +37,8 @@ namespace Composer\Autoload;
39
  *
40
  * @author Fabien Potencier <fabien@symfony.com>
41
  * @author Jordi Boggiano <j.boggiano@seld.be>
 
 
42
  */
43
  class ClassLoader
44
  {
@@ -53,6 +53,9 @@ class ClassLoader
53
 
54
  private $useIncludePath = false;
55
  private $classMap = array();
 
 
 
56
 
57
  public function getPrefixes()
58
  {
@@ -145,7 +148,7 @@ class ClassLoader
145
  * appending or prepending to the ones previously set for this namespace.
146
  *
147
  * @param string $prefix The prefix/namespace, with trailing '\\'
148
- * @param array|string $paths The PSR-0 base directories
149
  * @param bool $prepend Whether to prepend the directories
150
  *
151
  * @throws \InvalidArgumentException
@@ -248,6 +251,47 @@ class ClassLoader
248
  return $this->useIncludePath;
249
  }
250
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  /**
252
  * Registers this instance as an autoloader.
253
  *
@@ -290,26 +334,34 @@ class ClassLoader
290
  */
291
  public function findFile($class)
292
  {
293
- // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
294
- if ('\\' == $class[0]) {
295
- $class = substr($class, 1);
296
- }
297
-
298
  // class map lookup
299
  if (isset($this->classMap[$class])) {
300
  return $this->classMap[$class];
301
  }
 
 
 
 
 
 
 
 
 
302
 
303
  $file = $this->findFileWithExtension($class, '.php');
304
 
305
  // Search for Hack files if we are running on HHVM
306
- if ($file === null && defined('HHVM_VERSION')) {
307
  $file = $this->findFileWithExtension($class, '.hh');
308
  }
309
 
310
- if ($file === null) {
 
 
 
 
311
  // Remember that this class does not exist.
312
- return $this->classMap[$class] = false;
313
  }
314
 
315
  return $file;
@@ -322,10 +374,14 @@ class ClassLoader
322
 
323
  $first = $class[0];
324
  if (isset($this->prefixLengthsPsr4[$first])) {
325
- foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
326
- if (0 === strpos($class, $prefix)) {
327
- foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
328
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
 
 
 
 
329
  return $file;
330
  }
331
  }
@@ -373,6 +429,8 @@ class ClassLoader
373
  if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
374
  return $file;
375
  }
 
 
376
  }
377
  }
378
 
13
  namespace Composer\Autoload;
14
 
15
  /**
16
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
 
 
17
  *
18
  * $loader = new \Composer\Autoload\ClassLoader();
19
  *
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see http://www.php-fig.org/psr/psr-0/
41
+ * @see http://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
53
 
54
  private $useIncludePath = false;
55
  private $classMap = array();
56
+ private $classMapAuthoritative = false;
57
+ private $missingClasses = array();
58
+ private $apcuPrefix;
59
 
60
  public function getPrefixes()
61
  {
148
  * appending or prepending to the ones previously set for this namespace.
149
  *
150
  * @param string $prefix The prefix/namespace, with trailing '\\'
151
+ * @param array|string $paths The PSR-4 base directories
152
  * @param bool $prepend Whether to prepend the directories
153
  *
154
  * @throws \InvalidArgumentException
251
  return $this->useIncludePath;
252
  }
253
 
254
+ /**
255
+ * Turns off searching the prefix and fallback directories for classes
256
+ * that have not been registered with the class map.
257
+ *
258
+ * @param bool $classMapAuthoritative
259
+ */
260
+ public function setClassMapAuthoritative($classMapAuthoritative)
261
+ {
262
+ $this->classMapAuthoritative = $classMapAuthoritative;
263
+ }
264
+
265
+ /**
266
+ * Should class lookup fail if not found in the current class map?
267
+ *
268
+ * @return bool
269
+ */
270
+ public function isClassMapAuthoritative()
271
+ {
272
+ return $this->classMapAuthoritative;
273
+ }
274
+
275
+ /**
276
+ * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
+ *
278
+ * @param string|null $apcuPrefix
279
+ */
280
+ public function setApcuPrefix($apcuPrefix)
281
+ {
282
+ $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
283
+ }
284
+
285
+ /**
286
+ * The APCu prefix in use, or null if APCu caching is not enabled.
287
+ *
288
+ * @return string|null
289
+ */
290
+ public function getApcuPrefix()
291
+ {
292
+ return $this->apcuPrefix;
293
+ }
294
+
295
  /**
296
  * Registers this instance as an autoloader.
297
  *
334
  */
335
  public function findFile($class)
336
  {
 
 
 
 
 
337
  // class map lookup
338
  if (isset($this->classMap[$class])) {
339
  return $this->classMap[$class];
340
  }
341
+ if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342
+ return false;
343
+ }
344
+ if (null !== $this->apcuPrefix) {
345
+ $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
+ if ($hit) {
347
+ return $file;
348
+ }
349
+ }
350
 
351
  $file = $this->findFileWithExtension($class, '.php');
352
 
353
  // Search for Hack files if we are running on HHVM
354
+ if (false === $file && defined('HHVM_VERSION')) {
355
  $file = $this->findFileWithExtension($class, '.hh');
356
  }
357
 
358
+ if (null !== $this->apcuPrefix) {
359
+ apcu_add($this->apcuPrefix.$class, $file);
360
+ }
361
+
362
+ if (false === $file) {
363
  // Remember that this class does not exist.
364
+ $this->missingClasses[$class] = true;
365
  }
366
 
367
  return $file;
374
 
375
  $first = $class[0];
376
  if (isset($this->prefixLengthsPsr4[$first])) {
377
+ $subPath = $class;
378
+ while (false !== $lastPos = strrpos($subPath, '\\')) {
379
+ $subPath = substr($subPath, 0, $lastPos);
380
+ $search = $subPath . '\\';
381
+ if (isset($this->prefixDirsPsr4[$search])) {
382
+ $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
+ foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
+ if (file_exists($file = $dir . $pathEnd)) {
385
  return $file;
386
  }
387
  }
429
  if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
430
  return $file;
431
  }
432
+
433
+ return false;
434
  }
435
  }
436
 
vendor/composer/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Copyright (c) Nils Adermann, Jordi Boggiano
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is furnished
9
+ to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+
vendor/composer/autoload_classmap.php CHANGED
@@ -10,6 +10,7 @@ return array(
10
  'CJTAccessPointsDirectorySpider' => $baseDir . '/framework/access-points/directory-spider.class.php',
11
  'CJTAjaxController' => $baseDir . '/framework/mvc/controller-ajax.inc.php',
12
  'CJTAttributes' => $baseDir . '/framework/types/attributes.class.php',
 
13
  'CJTController' => $baseDir . '/framework/mvc/controller.inc.php',
14
  'CJTDBFileInstaller' => $baseDir . '/framework/installer/dbfile.class.php',
15
  'CJTEEISubject' => $baseDir . '/framework/events/subjects/subject.interface.php',
10
  'CJTAccessPointsDirectorySpider' => $baseDir . '/framework/access-points/directory-spider.class.php',
11
  'CJTAjaxController' => $baseDir . '/framework/mvc/controller-ajax.inc.php',
12
  'CJTAttributes' => $baseDir . '/framework/types/attributes.class.php',
13
+ 'CJTBlocksCouplingHookAttacher' => $baseDir . '/framework/CouplingHookAttacher.php',
14
  'CJTController' => $baseDir . '/framework/mvc/controller.inc.php',
15
  'CJTDBFileInstaller' => $baseDir . '/framework/installer/dbfile.class.php',
16
  'CJTEEISubject' => $baseDir . '/framework/events/subjects/subject.interface.php',
vendor/composer/autoload_real.php CHANGED
@@ -13,6 +13,9 @@ class ComposerAutoloaderInit9d35e2a877717aab14142e845cf84233
13
  }
14
  }
15
 
 
 
 
16
  public static function getLoader()
17
  {
18
  if (null !== self::$loader) {
@@ -23,19 +26,26 @@ class ComposerAutoloaderInit9d35e2a877717aab14142e845cf84233
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
  spl_autoload_unregister(array('ComposerAutoloaderInit9d35e2a877717aab14142e845cf84233', 'loadClassLoader'));
25
 
26
- $map = require __DIR__ . '/autoload_namespaces.php';
27
- foreach ($map as $namespace => $path) {
28
- $loader->set($namespace, $path);
29
- }
30
-
31
- $map = require __DIR__ . '/autoload_psr4.php';
32
- foreach ($map as $namespace => $path) {
33
- $loader->setPsr4($namespace, $path);
34
- }
35
-
36
- $classMap = require __DIR__ . '/autoload_classmap.php';
37
- if ($classMap) {
38
- $loader->addClassMap($classMap);
 
 
 
 
 
 
 
39
  }
40
 
41
  $loader->register(true);
@@ -43,8 +53,3 @@ class ComposerAutoloaderInit9d35e2a877717aab14142e845cf84233
43
  return $loader;
44
  }
45
  }
46
-
47
- function composerRequire9d35e2a877717aab14142e845cf84233($file)
48
- {
49
- require $file;
50
- }
13
  }
14
  }
15
 
16
+ /**
17
+ * @return \Composer\Autoload\ClassLoader
18
+ */
19
  public static function getLoader()
20
  {
21
  if (null !== self::$loader) {
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
  spl_autoload_unregister(array('ComposerAutoloaderInit9d35e2a877717aab14142e845cf84233', 'loadClassLoader'));
28
 
29
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
+ if ($useStaticLoader) {
31
+ require_once __DIR__ . '/autoload_static.php';
32
+
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit9d35e2a877717aab14142e845cf84233::getInitializer($loader));
34
+ } else {
35
+ $map = require __DIR__ . '/autoload_namespaces.php';
36
+ foreach ($map as $namespace => $path) {
37
+ $loader->set($namespace, $path);
38
+ }
39
+
40
+ $map = require __DIR__ . '/autoload_psr4.php';
41
+ foreach ($map as $namespace => $path) {
42
+ $loader->setPsr4($namespace, $path);
43
+ }
44
+
45
+ $classMap = require __DIR__ . '/autoload_classmap.php';
46
+ if ($classMap) {
47
+ $loader->addClassMap($classMap);
48
+ }
49
  }
50
 
51
  $loader->register(true);
53
  return $loader;
54
  }
55
  }
 
 
 
 
 
vendor/composer/autoload_static.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_static.php @generated by Composer
4
+
5
+ namespace Composer\Autoload;
6
+
7
+ class ComposerStaticInit9d35e2a877717aab14142e845cf84233
8
+ {
9
+ public static $classMap = array (
10
+ 'CJTAccessPoint' => __DIR__ . '/../..' . '/framework/access-points/access-point.class.php',
11
+ 'CJTAccessPointsDirectorySpider' => __DIR__ . '/../..' . '/framework/access-points/directory-spider.class.php',
12
+ 'CJTAjaxController' => __DIR__ . '/../..' . '/framework/mvc/controller-ajax.inc.php',
13
+ 'CJTAttributes' => __DIR__ . '/../..' . '/framework/types/attributes.class.php',
14
+ 'CJTBlocksCouplingHookAttacher' => __DIR__ . '/../..' . '/framework/CouplingHookAttacher.php',
15
+ 'CJTController' => __DIR__ . '/../..' . '/framework/mvc/controller.inc.php',
16
+ 'CJTDBFileInstaller' => __DIR__ . '/../..' . '/framework/installer/dbfile.class.php',
17
+ 'CJTEEISubject' => __DIR__ . '/../..' . '/framework/events/subjects/subject.interface.php',
18
+ 'CJTEESubject' => __DIR__ . '/../..' . '/framework/events/subjects/subject.subject.php',
19
+ 'CJTEEWordpressHook' => __DIR__ . '/../..' . '/framework/events/subjects/hook.subject.php',
20
+ 'CJTEEWordpressHookAction' => __DIR__ . '/../..' . '/framework/events/subjects/action.subject.php',
21
+ 'CJTEEWordpressHookFilter' => __DIR__ . '/../..' . '/framework/events/subjects/filter.subject.php',
22
+ 'CJTEvents' => __DIR__ . '/../..' . '/framework/events/events.class.php',
23
+ 'CJTEventsDefinition' => __DIR__ . '/../..' . '/framework/events/definition.class.php',
24
+ 'CJTExceptionBase' => __DIR__ . '/../..' . '/framework/exceptions.inc.php',
25
+ 'CJTExtensions' => __DIR__ . '/../..' . '/framework/extensions/extensions.class.php',
26
+ 'CJTHTMLField' => __DIR__ . '/../..' . '/framework/html/field.inc.php',
27
+ 'CJTHookableClass' => __DIR__ . '/../..' . '/framework/events/hookable.class.php',
28
+ 'CJTIAccessPoint' => __DIR__ . '/../..' . '/framework/access-points/access-point.class.php',
29
+ 'CJTIHookable' => __DIR__ . '/../..' . '/framework/events/hookable.interface.php',
30
+ 'CJTIObserver' => __DIR__ . '/../..' . '/framework/events/observers/observer.interface.php',
31
+ 'CJTIncludes' => __DIR__ . '/../..' . '/framework/php/includes.class.php',
32
+ 'CJTInstallerReflection' => __DIR__ . '/../..' . '/framework/installer/reflection.class.php',
33
+ 'CJTListField' => __DIR__ . '/../..' . '/framework/html/list.php',
34
+ 'CJTMYSQLQuery' => __DIR__ . '/../..' . '/framework/db/mysql/single-table-simple-view.inc.php',
35
+ 'CJTMYSQLQueueDriver' => __DIR__ . '/../..' . '/framework/db/mysql/queue-driver.inc.php',
36
+ 'CJTModel' => __DIR__ . '/../..' . '/framework/mvc/model.inc.php',
37
+ 'CJTObserver' => __DIR__ . '/../..' . '/framework/events/observers/observer.observer.php',
38
+ 'CJTPHPCodeEvaluator' => __DIR__ . '/../..' . '/framework/php/evaluator/evaluator.inc.php',
39
+ 'CJTPackageFile' => __DIR__ . '/../..' . '/framework/packages/package.class.php',
40
+ 'CJTPageAccessPoint' => __DIR__ . '/../..' . '/framework/access-points/page.class.php',
41
+ 'CJTPluggableHelper' => __DIR__ . '/../..' . '/framework/PluggableHelper.abstract.php',
42
+ 'CJTPropertyNotFoundException' => __DIR__ . '/../..' . '/framework/exceptions.inc.php',
43
+ 'CJTSQLView' => __DIR__ . '/../..' . '/framework/db/mysql/sql-view.inc.php',
44
+ 'CJTServicesAPICallException' => __DIR__ . '/../..' . '/framework/ServicesAPI/Exceptions.class.php',
45
+ 'CJTServicesAjaxService' => __DIR__ . '/../..' . '/framework/ServicesFW/Ajax.Service.class.php',
46
+ 'CJTServicesClient' => __DIR__ . '/../..' . '/framework/ServicesAPI/Services.class.php',
47
+ 'CJTServicesClientModule' => __DIR__ . '/../..' . '/framework/ServicesAPI/Module.class.php',
48
+ 'CJTServicesDashboardPageService' => __DIR__ . '/../..' . '/framework/ServicesFW/Dashboard.Service.class.php',
49
+ 'CJTServicesEntityModel' => __DIR__ . '/../..' . '/framework/ServicesFW/EntityModel.class.php',
50
+ 'CJTServicesForm' => __DIR__ . '/../..' . '/framework/ServicesFW/Form.class.php',
51
+ 'CJTServicesHTTPRequestRouter' => __DIR__ . '/../..' . '/framework/ServicesFW/HTTPRequestRouter.class.php',
52
+ 'CJTServicesIPluginBase' => __DIR__ . '/../..' . '/framework/ServicesFW/PluginBase.interface.php',
53
+ 'CJTServicesInstaller' => __DIR__ . '/../..' . '/framework/ServicesFW/Installer.abstract.php',
54
+ 'CJTServicesMVCController' => __DIR__ . '/../..' . '/framework/ServicesFW/Controller.class.php',
55
+ 'CJTServicesMVCView' => __DIR__ . '/../..' . '/framework/ServicesFW/View.class.php',
56
+ 'CJTServicesMVCViewJson' => __DIR__ . '/../..' . '/framework/ServicesFW/ViewJson.class.php',
57
+ 'CJTServicesModel' => __DIR__ . '/../..' . '/framework/ServicesFW/Model.abstract.php',
58
+ 'CJTServicesPluginBase' => __DIR__ . '/../..' . '/framework/ServicesFW/PluginBase.class.php',
59
+ 'CJTServicesShortcodeService' => __DIR__ . '/../..' . '/framework/ServicesFW/Shortcode.service.class.php',
60
+ 'CJTServicesStorage' => __DIR__ . '/../..' . '/framework/ServicesFW/Storage.abstract.php',
61
+ 'CJTServicesWPService' => __DIR__ . '/../..' . '/framework/ServicesFW/Wordpress.service.abstract.php',
62
+ 'CJTSettingsPage' => __DIR__ . '/../..' . '/framework/settings/page.inc.php',
63
+ 'CJTStore' => __DIR__ . '/../..' . '/framework/ServicesAPI/Store.php',
64
+ 'CJTStoreUpdate' => __DIR__ . '/../..' . '/framework/CJTStoreUpdate.class.php',
65
+ 'CJTTable' => __DIR__ . '/../..' . '/framework/db/mysql/table.inc.php',
66
+ 'CJTView' => __DIR__ . '/../..' . '/framework/mvc/view.inc.php',
67
+ 'CJTWordpressActionHookObserver' => __DIR__ . '/../..' . '/framework/events/observers/wordpress-hook-action.observer.php',
68
+ 'CJTWordpressEvents' => __DIR__ . '/../..' . '/framework/events/wordpress.class.php',
69
+ 'CJTWordpressFilterHookObserver' => __DIR__ . '/../..' . '/framework/events/observers/wordpress-hook-filter.observer.php',
70
+ 'CJTWordpressHookObserver' => __DIR__ . '/../..' . '/framework/events/observers/wordpress-hook.observer.php',
71
+ 'CJT_Framework_Autoload_Loader' => __DIR__ . '/../..' . '/framework/autoload/loader.php',
72
+ 'CJT_Framework_DB_Mysql_Driver_Exception_Invalidkey' => __DIR__ . '/../..' . '/framework/db/mysql/driver/exception/invalidkey.php',
73
+ 'CJT_Framework_Developer_Developer' => __DIR__ . '/../..' . '/framework/developer/developer.php',
74
+ 'CJT_Framework_Developer_Interface_Block_Parameters_Parameters' => __DIR__ . '/../..' . '/framework/developer/interface/block/parameters/parameters.php',
75
+ 'CJT_Framework_Developer_Interface_Block_Parameters_Types_Array' => __DIR__ . '/../..' . '/framework/developer/interface/block/parameters/types/array.php',
76
+ 'CJT_Framework_Developer_Interface_Block_Parameters_Types_Base_Abstract' => __DIR__ . '/../..' . '/framework/developer/interface/block/parameters/types/base/abstract.php',
77
+ 'CJT_Framework_Developer_Interface_Block_Parameters_Types_Base_Factory' => __DIR__ . '/../..' . '/framework/developer/interface/block/parameters/types/base/factory.php',
78
+ 'CJT_Framework_Developer_Interface_Block_Parameters_Types_Base_List' => __DIR__ . '/../..' . '/framework/developer/interface/block/parameters/types/base/list.php',
79
+ 'CJT_Framework_Developer_Interface_Block_Parameters_Types_Base_Scalar' => __DIR__ . '/../..' . '/framework/developer/interface/block/parameters/types/base/scalar.php',
80
+ 'CJT_Framework_Developer_Interface_Block_Parameters_Types_Boolean' => __DIR__ . '/../..' . '/framework/developer/interface/block/parameters/types/boolean.php',
81
+ 'CJT_Framework_Developer_Interface_Block_Parameters_Types_Interface_Type' => __DIR__ . '/../..' . '/framework/developer/interface/block/parameters/types/interface/type.php',
82
+ 'CJT_Framework_Developer_Interface_Block_Parameters_Types_List' => __DIR__ . '/../..' . '/framework/developer/interface/block/parameters/types/list.php',
83
+ 'CJT_Framework_Developer_Interface_Block_Parameters_Types_Number' => __DIR__ . '/../..' . '/framework/developer/interface/block/parameters/types/number.php',
84
+ 'CJT_Framework_Developer_Interface_Block_Parameters_Types_Raw' => __DIR__ . '/../..' . '/framework/developer/interface/block/parameters/types/raw.php',
85
+ 'CJT_Framework_Developer_Interface_Block_Parameters_Types_Structure' => __DIR__ . '/../..' . '/framework/developer/interface/block/parameters/types/structure.php',
86
+ 'CJT_Framework_Developer_Interface_Block_Parameters_Types_Text' => __DIR__ . '/../..' . '/framework/developer/interface/block/parameters/types/text.php',
87
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Base_Abstract' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/parameters/base/abstract.php',
88
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Base_List' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/parameters/base/list.php',
89
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Base_Scalar' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/parameters/base/scalar.php',
90
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Factory' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/parameters/factory.php',
91
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Interface_Type' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/parameters/interface/type.php',
92
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Parameters' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/parameters/parameters.php',
93
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Types_Array' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/parameters/types/array.php',
94
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Types_Boolean' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/parameters/types/boolean.php',
95
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Types_List' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/parameters/types/list.php',
96
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Types_Number' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/parameters/types/number.php',
97
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Types_Raw' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/parameters/types/raw.php',
98
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Types_Structure' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/parameters/types/structure.php',
99
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Types_Text' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/parameters/types/text.php',
100
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Segments_Segments' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/segments/segments.php',
101
+ 'CJT_Framework_Developer_Interface_Block_Shortcode_Shortcode' => __DIR__ . '/../..' . '/framework/developer/interface/block/shortcode/shortcode.php',
102
+ 'CJT_Framework_Developer_Lib_Template' => __DIR__ . '/../..' . '/framework/developer/lib/template/template.php',
103
+ 'CJT_Framework_Extensions_Package_Activator' => __DIR__ . '/../..' . '/framework/extensions/package/activator.php',
104
+ 'CJT_Framework_Extensions_Package_Blocks' => __DIR__ . '/../..' . '/framework/extensions/package/blocks.php',
105
+ 'CJT_Framework_Extensions_Package_Extension' => __DIR__ . '/../..' . '/framework/extensions/package/extension.php',
106
+ 'CJT_Framework_Extensions_Package_State_Extension' => __DIR__ . '/../..' . '/framework/extensions/package/state/extension.php',
107
+ 'CJT_Framework_Extensions_Package_State_Packages' => __DIR__ . '/../..' . '/framework/extensions/package/state/packages.php',
108
+ 'CJT_Framework_Html_Dom_Element_Script' => __DIR__ . '/../..' . '/framework/html/dom/element/script.php',
109
+ 'CJT_Framework_Html_Dom_Elementbase' => __DIR__ . '/../..' . '/framework/html/dom/elementbase.php',
110
+ 'CJT_Framework_Version_Version' => __DIR__ . '/../..' . '/framework/version/version.php',
111
+ 'CJT_Framework_View_Block_Parameter_Base_Abstract' => __DIR__ . '/../..' . '/framework/view/block/parameter/base/abstract.php',
112
+ 'CJT_Framework_View_Block_Parameter_Base_List' => __DIR__ . '/../..' . '/framework/view/block/parameter/base/list.php',
113
+ 'CJT_Framework_View_Block_Parameter_Base_Scalar' => __DIR__ . '/../..' . '/framework/view/block/parameter/base/scalar.php',
114
+ 'CJT_Framework_View_Block_Parameter_Grouper_Factory' => __DIR__ . '/../..' . '/framework/view/block/parameter/grouper/factory.php',
115
+ 'CJT_Framework_View_Block_Parameter_Grouper_Tab_Tab' => __DIR__ . '/../..' . '/framework/view/block/parameter/grouper/tab/tab.php',
116
+ 'CJT_Framework_View_Block_Parameter_Interface_Type' => __DIR__ . '/../..' . '/framework/view/block/parameter/interface/type.php',
117
+ 'CJT_Framework_View_Block_Parameter_Parameters' => __DIR__ . '/../..' . '/framework/view/block/parameter/parameters.php',
118
+ 'CJT_Framework_View_Block_Parameter_Renderer_Array_Array' => __DIR__ . '/../..' . '/framework/view/block/parameter/renderer/array/array.php',
119
+ 'CJT_Framework_View_Block_Parameter_Renderer_Checkbox_Checkbox' => __DIR__ . '/../..' . '/framework/view/block/parameter/renderer/checkbox/checkbox.php',
120
+ 'CJT_Framework_View_Block_Parameter_Renderer_Dropdown_Dropdown' => __DIR__ . '/../..' . '/framework/view/block/parameter/renderer/dropdown/dropdown.php',
121
+ 'CJT_Framework_View_Block_Parameter_Renderer_Factory' => __DIR__ . '/../..' . '/framework/view/block/parameter/renderer/factory.php',
122
+ 'CJT_Framework_View_Block_Parameter_Renderer_Imageslist_Imageslist' => __DIR__ . '/../..' . '/framework/view/block/parameter/renderer/imageslist/imageslist.php',
123
+ 'CJT_Framework_View_Block_Parameter_Renderer_Input_Input' => __DIR__ . '/../..' . '/framework/view/block/parameter/renderer/input/input.php',
124
+ 'CJT_Framework_View_Block_Parameter_Renderer_List_List' => __DIR__ . '/../..' . '/framework/view/block/parameter/renderer/list/list.php',
125
+ 'CJT_Framework_View_Block_Parameter_Renderer_Structure_Structure' => __DIR__ . '/../..' . '/framework/view/block/parameter/renderer/structure/structure.php',
126
+ 'CJT_Framework_View_Block_Parameter_Renderer_Textarea_Textarea' => __DIR__ . '/../..' . '/framework/view/block/parameter/renderer/textarea/textarea.php',
127
+ 'CJT_Framework_Wordpress_Currentversion' => __DIR__ . '/../..' . '/framework/wordpress/currentversion.php',
128
+ 'CJT_Framework_Wordpress_Feed' => __DIR__ . '/../..' . '/framework/wordpress/feed.php',
129
+ 'CJT_Framework_Xml_Fetchscalars' => __DIR__ . '/../..' . '/framework/xml/fetchscalars.php',
130
+ 'CJTxTable' => __DIR__ . '/../..' . '/framework/db/mysql/xtable.inc.php',
131
+ 'HTMLCheckboxList' => __DIR__ . '/../..' . '/framework/html/components/checkbox-list/checkbox-list.class.php',
132
+ 'HTMLComponent' => __DIR__ . '/../..' . '/framework/html/component.class.php',
133
+ );
134
+
135
+ public static function getInitializer(ClassLoader $loader)
136
+ {
137
+ return \Closure::bind(function () use ($loader) {
138
+ $loader->classMap = ComposerStaticInit9d35e2a877717aab14142e845cf84233::$classMap;
139
+
140
+ }, null, ClassLoader::class);
141
+ }
142
+ }
vendor/composer/installed.json ADDED
@@ -0,0 +1 @@
 
1
+ []
views/blocks/block/public/css/block.css CHANGED
@@ -12,6 +12,7 @@ b, strong {
12
 
13
  .waitingToLoad{display: none !important;}
14
 
 
15
  .postbox.cjt-block a,
16
  .postbox.cjt-block a:hover,
17
  .postbox.cjt-block a:visited {text-decoration: none;}
@@ -23,7 +24,30 @@ b, strong {
23
 
24
  .postbox.cjt-block a:hover {color: #628ead !important;}
25
 
26
- .inside {color: #7c7c7c;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  #cjtoolbox-admin {font-size: 12px !important;}
29
  #cjtoolbox-admin div.postbox {
@@ -49,8 +73,8 @@ b, strong {
49
  /* Editor langauges list */
50
  .editor-langs {
51
  position: absolute;
52
- z-index: 2;
53
- width: 200px;
54
  overflow: hidden;
55
  margin-top: -2px;
56
  /* Border */
@@ -59,7 +83,6 @@ b, strong {
59
  border-right-style: solid;
60
  border-right-width: 1px;
61
  border-color: inactiveborder;
62
- margin-left: 33px;
63
  }
64
  .editor-langs select {
65
  height: 70px;
@@ -67,16 +90,28 @@ b, strong {
67
  }
68
  /** Toolbox **/
69
  .block-toolbox {
70
- height: 30px;
71
- position: absolute;
72
- right: 30px;
73
- top: 0px;
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
  .block-toolbox .icons-group {
76
  display: inline-block;
77
  }
78
  /* Push all icons by 1 pixel down Put not the info icon */
79
- .block-toolbox .icons-group.big-bar .cjt-tb-link{position: relative; top:1px}
80
  .block-toolbox .icons-group.big-bar .cjttbl-info{position: static;}
81
  .block-info .cjt-block-shortcode-text input {
82
  background: transparent;
@@ -84,6 +119,16 @@ b, strong {
84
  box-shadow: none;
85
  width: 200px;
86
  }
 
 
 
 
 
 
 
 
 
 
87
  .block-toolbox .icons-group a.cjt-tb-link {
88
  width: 24px;
89
  height: 24px;
@@ -107,15 +152,44 @@ b, strong {
107
  /** Toolbox buttons **/
108
 
109
  /* Editor languages classes */
110
- .block-toolbox a.cjttbl-switch-editor-language{}
111
- .block-toolbox a.cjttbl-editor-language-css { background: url(../images/toolbox/editor-languages/css.png); }
112
- .block-toolbox a.cjttbl-editor-language-html { background: url(../images/toolbox/editor-languages/html.png); }
113
- .block-toolbox a.cjttbl-editor-language-javascript { background: url(../images/toolbox/editor-languages/javascript.png); }
114
- .block-toolbox a.cjttbl-editor-language-php { background: url(../images/toolbox/editor-languages/php.png); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  /* Other buttons */
116
- .block-toolbox a.state-active { background: url(../images/toolbox/active.png); }
117
- .block-toolbox a.state-inactive { background-image: url(../images/toolbox/inactive.png); }
118
- .block-toolbox a.cjttbl-save {
119
  background: url(../images/toolbox/save.gif);
120
  background-position: left top !important;
121
  text-decoration: none;
@@ -127,11 +201,11 @@ b, strong {
127
  height: 18px !important;
128
  }
129
  /* Restore revision toolbox buttons. */
130
- .block-toolbox a.cjttblSW-restore {
131
  background: url(../images/toolbox/restore.png);
132
  width: 50px !important;
133
  }
134
- .block-toolbox a.cjttbl-cancel-restore {
135
  background: url(../images/toolbox/cancel-restore.png);
136
  background-position: left top !important;
137
  text-decoration: none;
@@ -144,19 +218,41 @@ b, strong {
144
  margin-right: 10px !important;
145
  }
146
 
147
- .block-toolbox a.cjttbl-save.cjttbs-loading {
148
- top: -2px;
 
 
 
 
 
 
 
 
 
 
149
  background-position: center center;
150
  }
151
 
152
- .block-toolbox a.cjttbl-save.cjttbs-disabled {background: url(../images/toolbox/save-inactive.png); }
153
- .block-toolbox a.cjttbl-delete { background-image: url(../images/toolbox/delete.png); }
154
- .block-toolbox a.location-header { background-image: url(../images/toolbox/header-hook.png); }
155
- .block-toolbox a.location-footer { background-image: url(../images/toolbox/footer-hook.png); }
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  .block-toolbox a.cjttbl-get-shortcode { background-image: url(../images/toolbox/shortcode.png); }
157
  .block-toolbox a.cjttbl-edit-name { background-image: url(../images/toolbox/edit-name.png); }
158
  .block-toolbox a.cjttbl-info { background-image: url(../images/toolbox/info.png); }
159
- .block-toolbox a.cjttbl-templates-lookup { background-image: url(../images/toolbox/templates-lookup.png); }
160
 
161
  /** Editor Toolbox */
162
  .cjt-toolbox.editor-toolbox {
@@ -169,63 +265,50 @@ b, strong {
169
  display: none;
170
  }
171
 
 
 
 
 
 
 
 
 
172
  .loading-block{
173
  font-weight: bold;
174
  font-size: 13px;
175
  color: #005da4;
 
 
176
  }
 
177
 
178
- /* Edit block name */
179
- .edit-block-name {
180
- position: absolute;
181
- height: 30px;
182
- top: 0px;
183
- display: none;
184
- font-size: 15px;
185
  }
186
- .hndle .file {
187
- font-size: 15px;
188
- margin-left: 7px;
189
- cursor: pointer;
190
- }
191
- .hndle .name-file-separator {
192
- font-size: 14px;
193
- position: relative;
194
- top: -1px;
195
- margin-left: 5px;
196
- cursor: pointer;
197
- }
198
- .edit-block-name .icons-group {
199
- display: inline-block;
200
- margin-left: 0px;
201
- position: relative;
202
- top: 3px;
203
- }
204
- .edit-block-name input.block-name {
205
- width: 200px;
206
- margin-right: 10px;
207
- height: 24px;
208
- position: relative;
209
- top: -3px;
210
- margin-left: -4px;
211
- }
212
- span.block-name {cursor: pointer; font-size: 15px;font-weight: normal;}
213
- .edit-block-name .cancel { background-image: url(../images/edit-block-name/cancel.png); }
214
- .edit-block-name .save { background-image: url(../images/edit-block-name/save.png); }
215
-
216
- .cjcodeblock { margin-right:30px; }
217
- .cjcontainer {min-width:700px;}
218
  .datablock {padding-top: 14px;}
219
  .datablock .code-editor { position: relative; width:auto; height:352px; }
220
  .cjt-info-bar {
221
- font-size: 11px;
222
- margin-top: 6px;
223
- color: #b5b5b5;
224
  }
225
- .cjt-info-bar span:not(:last-child) {
226
  margin-right: 20px;
227
  }
228
-
 
 
 
 
 
 
 
 
 
 
 
229
  a.button-secondary { float:left; }
230
  .linklist textarea { width:245px; font-size:11px; height:190px; }
231
  .cjtitle { float:left; width:245px; }
@@ -291,4 +374,112 @@ div[contains=setTheme]
291
 
292
  .cjt-block button[class^=handle-order] {
293
  display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  }
12
 
13
  .waitingToLoad{display: none !important;}
14
 
15
+ /* colors */
16
  .postbox.cjt-block a,
17
  .postbox.cjt-block a:hover,
18
  .postbox.cjt-block a:visited {text-decoration: none;}
24
 
25
  .postbox.cjt-block a:hover {color: #628ead !important;}
26
 
27
+ .hooks-dropdown .hooks-dropdown-list {background-color: white;}
28
+
29
+ .inside {
30
+ color: #7c7c7c;
31
+ }
32
+
33
+ .cjt-info-bar>span>span,
34
+ .cjt-info-bar>span>strong,
35
+ .cjt-info-bar>span>input,
36
+ .cjt-info-bar {
37
+ color: #9c9c9c !important;
38
+ }
39
+
40
+ input[type="text"].block-name {
41
+ border-color: #cccccc;
42
+ }
43
+
44
+ .postbox.cjt-block .cjt-info-bar a, .postbox.cjt-block .cjt-toolbox.cjt-info-bar .icons-group a:hover{color: #005DA4 !important;}
45
+
46
+ .postbox.cjt-block .cjt-toolbox .icons-group .popup-menu a {color: #7c7c7c !important;}
47
+
48
+ /* colors */
49
+
50
+ .cjpageblock {height: 100%; position: absolute; right: 3px; margin-top: 10px;}
51
 
52
  #cjtoolbox-admin {font-size: 12px !important;}
53
  #cjtoolbox-admin div.postbox {
73
  /* Editor langauges list */
74
  .editor-langs {
75
  position: absolute;
76
+ /*z-index: 2;*/
77
+ width: 150px;
78
  overflow: hidden;
79
  margin-top: -2px;
80
  /* Border */
83
  border-right-style: solid;
84
  border-right-width: 1px;
85
  border-color: inactiveborder;
 
86
  }
87
  .editor-langs select {
88
  height: 70px;
90
  }
91
  /** Toolbox **/
92
  .block-toolbox {
93
+ height: 30px;
94
+ position: absolute;
95
+ right: 39px;
96
+ top: 5px;
97
+ }
98
+ .cjt-info-bar.cjt-info-bar-top.cjt-toolbox.block-toolbox .icons-group>div,
99
+ .cjt-info-bar.cjt-info-bar-top.cjt-toolbox.block-toolbox .icons-group>span {
100
+ display: inline-block;
101
+ margin-right: 17px;
102
+ }
103
+ .cjt-toolbox.edit-block-toolbox {
104
+ display: inline-block;
105
+ margin-left: 17px;
106
+ margin-top: -9px;
107
+ position: relative;
108
+ top: 9px;
109
  }
110
  .block-toolbox .icons-group {
111
  display: inline-block;
112
  }
113
  /* Push all icons by 1 pixel down Put not the info icon */
114
+ .block-toolbox .icons-group.big-bar .cjt-tb-link{margin-right: 15px;}
115
  .block-toolbox .icons-group.big-bar .cjttbl-info{position: static;}
116
  .block-info .cjt-block-shortcode-text input {
117
  background: transparent;
119
  box-shadow: none;
120
  width: 200px;
121
  }
122
+ .block-info h4{
123
+ margin: 0 !important;
124
+ }
125
+ .block-info ul {
126
+ margin: 0;
127
+ }
128
+ .block-info ul.assignment-list {
129
+ margin: 6px 0 14px 8px;
130
+ }
131
+
132
  .block-toolbox .icons-group a.cjt-tb-link {
133
  width: 24px;
134
  height: 24px;
152
  /** Toolbox buttons **/
153
 
154
  /* Editor languages classes */
155
+ .cjt-toolbox.editor-langs-toolbox {
156
+ display: inline-block;
157
+ }
158
+ .cjt-toolbox.block-toolbox .cjt-tb-link.cjt-tb-text-link {
159
+ display: inline-block;
160
+ width: auto;
161
+ height: auto;
162
+ margin-top: 11px;
163
+ padding: 4px 4px 4px 0;
164
+ margin: 2px 0 0 0px;
165
+ }
166
+
167
+ .cjt-toolbox.block-toolbox .popup-menu.templates {
168
+ width: 185px;
169
+ margin-left: -70px;
170
+ }
171
+
172
+ .cjt-toolbox.block-toolbox .templates .cjt-tb-link.cjt-tb-text-link{
173
+ width: auto !important;
174
+ padding: 10px !important;
175
+ margin: 0;
176
+ }
177
+
178
+ .editor-langs-toolbox a.cjttbl-switch-editor-language{padding-left: 0 !important;}
179
+
180
+ .cjt-info-bar .block-editor-lang {display: inline-block;}
181
+ .cjt-info-bar .block-editor-lang>span {}
182
+ .cjt-info-bar .block-editor-lang .cjt-toolbox.editor-langs-toolbox {}
183
+
184
+ .editor-langs-toolbox a.cjttbl-editor-language-css { background: url(../images/toolbox/editor-languages/css.png); }
185
+ .editor-langs-toolbox a.cjttbl-editor-language-html { background: url(../images/toolbox/editor-languages/html.png); }
186
+ .editor-langs-toolbox a.cjttbl-editor-language-javascript { background: url(../images/toolbox/editor-languages/javascript.png); }
187
+ .editor-langs-toolbox a.cjttbl-editor-language-php { background: url(../images/toolbox/editor-languages/php.png); }
188
+
189
  /* Other buttons */
190
+ .flagged-actions-toolbox a.state-active { background: url(../images/toolbox/active.png); }
191
+ .flagged-actions-toolbox a.state-inactive { background-image: url(../images/toolbox/inactive.png); }
192
+ .edit-block-toolbox a.cjttbl-save {
193
  background: url(../images/toolbox/save.gif);
194
  background-position: left top !important;
195
  text-decoration: none;
201
  height: 18px !important;
202
  }
203
  /* Restore revision toolbox buttons. */
204
+ .edit-block-toolbox a.cjttblSW-restore {
205
  background: url(../images/toolbox/restore.png);
206
  width: 50px !important;
207
  }
208
+ .edit-block-toolbox a.cjttbl-cancel-restore {
209
  background: url(../images/toolbox/cancel-restore.png);
210
  background-position: left top !important;
211
  text-decoration: none;
218
  margin-right: 10px !important;
219
  }
220
 
221
+ .edit-block-toolbox a.cjttblSW-restore,
222
+ .edit-block-toolbox a.cjttbl-cancel-restore
223
+ {
224
+ width: 127px !important;
225
+ text-align: center;
226
+ padding-left: 0;
227
+ padding-top: 4px;
228
+ height: 20px !important;
229
+ }
230
+
231
+ .edit-block-toolbox a.cjttbl-save.cjttbs-loading {
232
+ top: 0px;
233
  background-position: center center;
234
  }
235
 
236
+ .block-toolbox span.bad-location-specified {
237
+ padding: 6px;
238
+ border: 1px solid red;
239
+ }
240
+ .block-toolbox a.bad-location-specified {
241
+ background-color: red;
242
+ }
243
+
244
+ .edit-block-toolbox a.cjttbl-save.cjttbs-disabled {background: url(../images/toolbox/save-inactive.png); }
245
+
246
+ .edit-block-toolbox a.cjttbl-delete {
247
+ background-image: url(../images/toolbox/delete.png);
248
+ position: relative;
249
+ left: 10px;
250
+ top: -1px;
251
+ }
252
+ .flagged-actions-toolbox a.cjttbl-location-switch { background-image: url(../images/toolbox/hook.png); width: 48px !important;}
253
  .block-toolbox a.cjttbl-get-shortcode { background-image: url(../images/toolbox/shortcode.png); }
254
  .block-toolbox a.cjttbl-edit-name { background-image: url(../images/toolbox/edit-name.png); }
255
  .block-toolbox a.cjttbl-info { background-image: url(../images/toolbox/info.png); }
 
256
 
257
  /** Editor Toolbox */
258
  .cjt-toolbox.editor-toolbox {
265
  display: none;
266
  }
267
 
268
+ .cjt-toolbox.flagged-actions-toolbox {
269
+ display: inline-block;
270
+ float: left;
271
+ margin-top: -5px;
272
+ position: relative;
273
+ top: 5px;
274
+ }
275
+
276
  .loading-block{
277
  font-weight: bold;
278
  font-size: 13px;
279
  color: #005da4;
280
+ border-style: solid;
281
+ border-width: 1px;
282
  }
283
+ /* Edit Block Name */
284
 
285
+ input[type="text"].block-name {
286
+ margin-left: 18px;
 
 
 
 
 
287
  }
288
+ /* Edit Block name */
289
+
290
+ .cjcontainer {/*min-width:700px;*/}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  .datablock {padding-top: 14px;}
292
  .datablock .code-editor { position: relative; width:auto; height:352px; }
293
  .cjt-info-bar {
294
+ font-size: 11px;
295
+ margin-top: 6px;
 
296
  }
297
+ .cjt-info-bar>*:not(:last-child) {
298
  margin-right: 20px;
299
  }
300
+ .cjt-info-bar>span>span {
301
+ line-height: 19px;
302
+ }
303
+ .cjt-info-bar .block-shortcode input[type="text"] {
304
+ border: none;
305
+ background-color: transparent;
306
+ width: 156px;
307
+ font: inherit;
308
+ margin-top: -4px;
309
+ padding: 0;
310
+ }
311
+
312
  a.button-secondary { float:left; }
313
  .linklist textarea { width:245px; font-size:11px; height:190px; }
314
  .cjtitle { float:left; width:245px; }
374
 
375
  .cjt-block button[class^=handle-order] {
376
  display: none;
377
+ }
378
+
379
+ /* Hooks Dropdown */
380
+ .hooks-dropdown {
381
+ width: 140px;
382
+ }
383
+
384
+ .hooks-dropdown .hooks-dropdown-list {
385
+ width: 100%;
386
+ z-index: 5;
387
+ margin: 0;
388
+ }
389
+
390
+ .hooks-dropdown .hooks-dropdown-list li {
391
+ margin: 0 !important;
392
+ padding: 0 !important;
393
+ }
394
+
395
+ .hooks-dropdown .hooks-dropdown-list li.selected a{
396
+ font-weight: bold;
397
+ }
398
+
399
+ .hooks-dropdown .hooks-dropdown-list li a,
400
+ .hooks-dropdown .hooks-dropdown-list li a:visited
401
+ {
402
+ display: inline-block;
403
+ width: 84%;
404
+ padding: 10px;
405
+ }
406
+
407
+ .hooks-dropdown .hooks-dropdown-list li a:hover {
408
+
409
+ }
410
+ /* Hooks Dropdown - end */
411
+
412
+ .cjt-panel-item.cjt-panel-window-templates-lookup {
413
+ height: 380px;
414
+ position: relative;
415
+ top: 24px;
416
+ }
417
+
418
+ .cjt-panel-item .panel-actions {
419
+ text-align: right;
420
+ padding-right: 18px;
421
+ margin-bottom: 6px;
422
+ }
423
+
424
+ .cjpageblock .close-panel-window {
425
+ display: none;
426
+ position: absolute;
427
+ right: 0px;
428
+ padding: 6px;
429
+ text-decoration: underline !important;
430
+ }
431
+
432
+ .cjpageblock .cjt-panel-item>div {
433
+ height: 93%;
434
+ overflow: auto;
435
+ width: 100%;
436
+ }
437
+
438
+ .postbox.cjt-block .cjt-info-bar a {
439
+ font-weight: bold;
440
+ }
441
+
442
+ .cjpageblock .cjt-panel-item.cjt-panel-genericwnd {
443
+ height: 357px;
444
+ margin-top: 26px;
445
+ padding: 2px 10px 10px 11px;
446
+ }
447
+
448
+ .cjt-info-bar>span>span,
449
+ .cjt-info-bar>span>strong,
450
+ .cjt-info-bar>span>input {
451
+ font-family: Helvetica !important;
452
+ }
453
+
454
+ .cjt-info-bar .cjt-toolbox .icons-group>*>a,
455
+ .cjt-info-bar .cjt-toolbox .icons-group>*>a:visited,
456
+
457
+ .cjt-info-bar .cjt-toolbox .icons-group>*>span>a,
458
+ .cjt-info-bar .cjt-toolbox .icons-group>*>span>a:visited,
459
+
460
+ .cjt-info-bar .cjt-toolbox .icons-group>*>strong>a,
461
+ .cjt-info-bar .cjt-toolbox .icons-group>*>strong>a:visited,
462
+ .cjt-info-bar.cjt-info-bar-bottom a,
463
+ .cjt-info-bar.cjt-info-bar-bottom a:visited {
464
+ color: #005DA4 !important;
465
+ text-decoration: underline;
466
+ }
467
+
468
+ .postbox.cjt-block .cjt-toolbox .icons-group .popup-menu.editor-langs a.cjt-tb-link.cjt-tb-text-link {
469
+ padding: 14px 14px 10px 35px;
470
+ background-position-y: 9px;
471
+ }
472
+
473
+ #block-revisions-form ul{
474
+ margin-top: 0px;
475
+ }
476
+
477
+ .postbox.cjt-block form#block-revisions-form a,
478
+ .postbox.cjt-block form#block-revisions-form a:visited {
479
+ font-size: 12px;
480
+ color: #005Da4 !important;
481
+ }
482
+
483
+ .postbox.cjt-block form#block-revisions-form a:hover {
484
+ color: #628ead !important;
485
  }
views/blocks/block/public/css/codefile.css CHANGED
@@ -1,16 +1,12 @@
1
  #code-files-manager {
2
- cursor: default;
3
- display: none;
4
- position: absolute;
5
- margin-left: 38px;
6
- margin-top: 8px;
7
- width: 400px;
8
- z-index: 5;
9
- border: 1px solid #bbb;
10
- overflow: auto;
11
- max-height: 348px;
12
- padding-bottom: 3px;
13
  }
 
14
  #code-files-manager > li.code-file-item {padding: 9px 9px 0px;}
15
  #code-files-manager > li.code-file-item a {font-size: 15px;text-decoration: none;cursor: pointer;}
16
  #code-files-manager > li.code-file-item a.active {font-weight: bold; cursor: default;}
@@ -28,10 +24,11 @@
28
 
29
  #code-files-manager > li.dialog-tool-buttons {
30
  position: absolute;
31
- width: 89px;
32
  height: 19px;
33
- right: 0px;
34
- top: 13px;
 
35
  }
36
  #code-files-manager > li.quick-toolbar > input {
37
  background-color: transparent;
@@ -77,17 +74,19 @@ input.show-selection {
77
  #code-files-manager > li.edit-code-file fieldset select {margin-left: -2px}
78
 
79
  #code-files-manager > li.edit-code-file fieldset > ul > li > label {
80
- width: 110px;
81
  display: inline-block;
82
  vertical-align: top;
83
  }
84
 
85
  #code-files-manager > li.overlay {
86
- position: absolute; width: 100%;
 
87
  background-color: transparent;
88
- height: 97%;
89
- top: 0;
90
  display: none;
 
91
  }
92
 
93
  li.code-file-item.create-file-row {padding-bottom: 16px !important;}
1
  #code-files-manager {
2
+ cursor: default;
3
+ width: 100%;
4
+ height: 83%;
5
+ margin-top: 26px;
6
+ display: none;
7
+ overflow: auto;
 
 
 
 
 
8
  }
9
+
10
  #code-files-manager > li.code-file-item {padding: 9px 9px 0px;}
11
  #code-files-manager > li.code-file-item a {font-size: 15px;text-decoration: none;cursor: pointer;}
12
  #code-files-manager > li.code-file-item a.active {font-weight: bold; cursor: default;}
24
 
25
  #code-files-manager > li.dialog-tool-buttons {
26
  position: absolute;
27
+ width: 43px;
28
  height: 19px;
29
+ right: 16px;
30
+ top: 37px;
31
+ z-index: 1;
32
  }
33
  #code-files-manager > li.quick-toolbar > input {
34
  background-color: transparent;
74
  #code-files-manager > li.edit-code-file fieldset select {margin-left: -2px}
75
 
76
  #code-files-manager > li.edit-code-file fieldset > ul > li > label {
77
+ width: 60px;;
78
  display: inline-block;
79
  vertical-align: top;
80
  }
81
 
82
  #code-files-manager > li.overlay {
83
+ position: absolute;
84
+ width: 100%;
85
  background-color: transparent;
86
+ height: 92%;
87
+ top: 29px;
88
  display: none;
89
+ left: 0;
90
  }
91
 
92
  li.code-file-item.create-file-row {padding-bottom: 16px !important;}
views/blocks/block/public/images/toolbox/footer-hook.png DELETED
Binary file
views/blocks/block/public/images/toolbox/header-hook.png DELETED
Binary file
views/blocks/block/public/images/toolbox/hook.png ADDED
Binary file
views/blocks/block/public/js/ajax/ajax.js CHANGED
@@ -17,10 +17,10 @@ var CJTBlocksServerQueue;
17
  *
18
  */
19
  CJTBlocksServerQueue = function(controller, action, key) {
20
-
21
  // Initialize base class.
22
  this._init(controller, action, key);
23
-
24
  /**
25
  *
26
  *
@@ -41,7 +41,7 @@ var CJTBlocksServerQueue;
41
  if (queue.type == 'queue') {
42
  var partialBlock = queue.data;
43
  blocks[partialBlock.id] = (blocks[partialBlock.id] != undefined) ? blocks[partialBlock.id] : {};
44
- blocks[partialBlock.id][partialBlock.property] = partialBlock.value;
45
  }
46
  }
47
  )
@@ -52,7 +52,7 @@ var CJTBlocksServerQueue;
52
  }
53
  return data;
54
  }
55
-
56
  /**
57
  *
58
  *
@@ -75,10 +75,10 @@ var CJTBlocksServerQueue;
75
  }
76
  return params;
77
  }
78
-
79
  } // End class.
80
-
81
  // Extend CJTServerQueue.
82
  CJTBlocksServerQueue.prototype = new CJTServerQueue();
83
-
84
  })(jQuery);
17
  *
18
  */
19
  CJTBlocksServerQueue = function(controller, action, key) {
20
+
21
  // Initialize base class.
22
  this._init(controller, action, key);
23
+
24
  /**
25
  *
26
  *
41
  if (queue.type == 'queue') {
42
  var partialBlock = queue.data;
43
  blocks[partialBlock.id] = (blocks[partialBlock.id] != undefined) ? blocks[partialBlock.id] : {};
44
+ blocks[partialBlock.id][partialBlock.property] = partialBlock.value;
45
  }
46
  }
47
  )
52
  }
53
  return data;
54
  }
55
+
56
  /**
57
  *
58
  *
75
  }
76
  return params;
77
  }
78
+
79
  } // End class.
80
+
81
  // Extend CJTServerQueue.
82
  CJTBlocksServerQueue.prototype = new CJTServerQueue();
83
+
84
  })(jQuery);
views/blocks/block/public/js/block/block.js CHANGED
@@ -109,10 +109,10 @@ var CJTBlockBase;
109
  // Initialize.
110
  this.blockPlugin = blockPlugin;
111
  this.box = $(element);
112
- this.id = parseInt(this.box.find('input:hidden[name="blocks[]"]').val())
113
  this.properties = {};
114
  // Define base properties.
115
- properties.name = {om : new CJTBlockPropertyHTMLNodeOM(), flags: 'rw', selector : 'input:hidden[name="cjtoolbox[{blockId}][name]"]'};
116
  properties.location = {om : new CJTBlockPropertyHTMLNodeOM(), flags: 'rw', selector : 'input:hidden[name="cjtoolbox[{blockId}][location]"]'};
117
  properties.state = {om : new CJTBlockPropertyHTMLNodeOM(), flags: 'rw', selector : 'input:hidden[name="cjtoolbox[{blockId}][state]"]'};
118
  // Initialize ALL (BASE, DERIVDED) properties.
109
  // Initialize.
110
  this.blockPlugin = blockPlugin;
111
  this.box = $(element);
112
+ this.id = parseInt(this.box.find('input:hidden[name="blocks[]"]').val());
113
  this.properties = {};
114
  // Define base properties.
115
+ properties.name = {om : new CJTBlockPropertyHTMLNodeOM(), flags: 'rws', selector : 'input:text[name="cjtoolbox[{blockId}][name]"]'};
116
  properties.location = {om : new CJTBlockPropertyHTMLNodeOM(), flags: 'rw', selector : 'input:hidden[name="cjtoolbox[{blockId}][location]"]'};
117
  properties.state = {om : new CJTBlockPropertyHTMLNodeOM(), flags: 'rw', selector : 'input:hidden[name="cjtoolbox[{blockId}][state]"]'};
118
  // Initialize ALL (BASE, DERIVDED) properties.
views/blocks/block/public/js/blockproperty/blockproperty.js CHANGED
@@ -124,6 +124,12 @@ var CJTBlockPropertyACEEditor;
124
  *
125
  */
126
  this.setValue = function(value) {
 
 
 
 
 
 
127
  block.block.aceEditor.getSession().setValue(value);
128
  };
129
 
124
  *
125
  */
126
  this.setValue = function(value) {
127
+
128
+ if (value === null) {
129
+
130
+ value = "";
131
+ }
132
+
133
  block.block.aceEditor.getSession().setValue(value);
134
  };
135
 
views/blocks/block/public/js/codefile-manager/codefile-manager.js CHANGED
@@ -21,8 +21,13 @@
21
  /**
22
  *
23
  */
24
- this.filesManager;
25
 
 
 
 
 
 
26
  /**
27
  *
28
  */
@@ -62,30 +67,38 @@
62
  *
63
  */
64
  var _onswitchfile = function(event) {
 
65
  // Initialize.
66
  var link = $(event.target);
67
  var codeFile = link.data('codeFile');
 
68
  // Disable Form.
69
  var overlay = this.filesManager.find('.overlay').show();
 
70
  // Switch.
71
  this.block.codeFile.switchFile(codeFile).done($.proxy(
 
72
  function(blockId, codeFileId) {
 
73
  // Process only if it still the current active block
74
  // otehrwise discard.
 
75
  if (blockId == this.block.block.get('id')) {
 
76
  // Switch editor language.
77
- this.block._onswitcheditorlang(undefined, {
78
- lang : codeFile.type ?
79
- codeFile.type :
80
- this.block.block.get('editorLang', 'css')
81
- });
82
- // Close.
83
- this.deattach();
84
  // Activate new switched code file.
85
- //===this.filesManager.find('li.codeFile a').removeClass('active');
86
- //===link.addClass('active');
 
87
  // Enable Form
88
  overlay.hide();
 
 
 
 
 
89
  }
90
  }, this)
91
  );
@@ -96,19 +109,13 @@
96
  *
97
  */
98
  var dialogToolButtons = function() {
 
99
  // Initialize Tool Buttons.
100
  this.dialogToolButtons = this.filesManager.find('.dialog-tool-buttons');
101
- // Close Dialog
102
- this.dialogToolButtons.find('.close').click($.proxy(
103
- function() {
104
- // Deattach from current block, free resources.
105
- this.deattach();
106
- // Inactive
107
- return false;
108
- }, this )
109
- );
110
  // Delete Seletced Files.
111
  this.dialogToolButtons.find('.delete').click($.proxy(
 
112
  function() {
113
  // Get all selected codeFiles ids.
114
  var ids = [];
@@ -129,11 +136,17 @@
129
  var overlay = this.filesManager.find('.overlay').show();
130
  // Once collected process deletion.
131
  this.block.codeFile.deleteCodeFile(ids).done($.proxy(
 
132
  function(response) {
 
133
  // Delete those codeFiles from Files Manager.
134
  checkboxes.parent().remove();
 
 
 
135
  // Enable Form.
136
  overlay.hide();
 
137
  }, this)
138
  );
139
  }
@@ -153,6 +166,12 @@
153
  // Edit Code File Dial object/
154
  this.editCodeFileDialog = new (function(codeFilesView) {
155
 
 
 
 
 
 
 
156
  /**
157
  *
158
  *
@@ -220,9 +239,14 @@
220
  }
221
  else { // Success
222
  codeFilesView.block.codeFile.save(data).done($.proxy(
 
223
  function(response) {
 
 
 
224
  // Response to caller (create/edit)
225
  promise.resolve(response);
 
226
  }, this)
227
  );
228
  }
@@ -292,15 +316,24 @@
292
  })(this);
293
  };
294
 
 
 
 
 
 
 
 
 
 
 
 
295
  /**
296
  *
297
  *
298
  */
299
  var filesManagerDialog = function() {
300
  // File Manager.
301
- this.filesManager = $('#code-files-manager')
302
- // Prevent Closing Metabox when interacting with the Code Files Manager.
303
- .click(function(event) {event.stopPropagation()});
304
  };
305
 
306
  /**
@@ -401,10 +434,12 @@
401
  *
402
  */
403
  this.deattach = function() {
404
- // Hide Manager.
405
- this.filesManager.css({'display' : 'none'}).detach();
 
406
  // Clear any previously added list
407
  this.filesManager.find('li.codeFile').remove();
 
408
  // Make sure edit/create form to be destructed.
409
  this.editCodeFileDialog.close();
410
  // Hide Quicktoolbar.
@@ -439,14 +474,24 @@
439
  if (block.revisionControl && (block.revisionControl.state == 'revision')) {
440
  return;
441
  }
 
442
  // Enter Deattached state.
443
- var oldBlock = this.deattach();
 
444
  // Display if not displayed.
445
- if (oldBlock !== block) {
 
446
  // Switch to block.
447
  this.block = block;
 
 
 
 
 
 
448
  // Fetch List
449
  block.codeFile.getList().done($.proxy(
 
450
  function(codeFiles) {
451
  // - Don't process is entered deattach state.
452
  // - Process only last switched block.
@@ -462,12 +507,7 @@
462
  }
463
  }, this)
464
  );
465
- // Set Location.
466
- this.block.block.box.find('.file').after(this.filesManager);
467
- // Aply theme
468
- this.applyTheme(this.block);
469
- // Display
470
- this.filesManager.css({'display' : 'block'});
471
  }
472
  }, this)
473
  );
21
  /**
22
  *
23
  */
24
+ this.filesManager;
25
 
26
+ /**
27
+ *
28
+ */
29
+ this.fileManagerPopup;
30
+
31
  /**
32
  *
33
  */
67
  *
68
  */
69
  var _onswitchfile = function(event) {
70
+
71
  // Initialize.
72
  var link = $(event.target);
73
  var codeFile = link.data('codeFile');
74
+
75
  // Disable Form.
76
  var overlay = this.filesManager.find('.overlay').show();
77
+
78
  // Switch.
79
  this.block.codeFile.switchFile(codeFile).done($.proxy(
80
+
81
  function(blockId, codeFileId) {
82
+
83
  // Process only if it still the current active block
84
  // otehrwise discard.
85
+
86
  if (blockId == this.block.block.get('id')) {
87
+
88
  // Switch editor language.
89
+ this.block._onswitcheditorlang({}, {lang : codeFile.type ? codeFile.type : this.block.block.get('editorLang', 'css')});
90
+
 
 
 
 
 
91
  // Activate new switched code file.
92
+ this.filesManager.find('li.codeFile a').removeClass('active');
93
+ link.addClass('active');
94
+
95
  // Enable Form
96
  overlay.hide();
97
+
98
+ this.filesManager.trigger('SwitchCodeFile', [this.block]);
99
+
100
+ // Close Code Files Manager Thick box
101
+ tb_remove();
102
  }
103
  }, this)
104
  );
109
  *
110
  */
111
  var dialogToolButtons = function() {
112
+
113
  // Initialize Tool Buttons.
114
  this.dialogToolButtons = this.filesManager.find('.dialog-tool-buttons');
115
+
 
 
 
 
 
 
 
 
116
  // Delete Seletced Files.
117
  this.dialogToolButtons.find('.delete').click($.proxy(
118
+
119
  function() {
120
  // Get all selected codeFiles ids.
121
  var ids = [];
136
  var overlay = this.filesManager.find('.overlay').show();
137
  // Once collected process deletion.
138
  this.block.codeFile.deleteCodeFile(ids).done($.proxy(
139
+
140
  function(response) {
141
+
142
  // Delete those codeFiles from Files Manager.
143
  checkboxes.parent().remove();
144
+
145
+ this.updateBlockInfoBar();
146
+
147
  // Enable Form.
148
  overlay.hide();
149
+
150
  }, this)
151
  );
152
  }
166
  // Edit Code File Dial object/
167
  this.editCodeFileDialog = new (function(codeFilesView) {
168
 
169
+ /**
170
+ * put your comment there...
171
+ *
172
+ */
173
+ this.codeFilesView = codeFilesView;
174
+
175
  /**
176
  *
177
  *
239
  }
240
  else { // Success
241
  codeFilesView.block.codeFile.save(data).done($.proxy(
242
+
243
  function(response) {
244
+
245
+ codeFilesView.block._onswitcheditorlang({}, {lang : data.type ? data.type : codeFilesView.block.block.get('editorLang', 'css')});
246
+
247
  // Response to caller (create/edit)
248
  promise.resolve(response);
249
+
250
  }, this)
251
  );
252
  }
316
  })(this);
317
  };
318
 
319
+ /**
320
+ *
321
+ */
322
+ this.updateBlockInfoBar = function() {
323
+
324
+ //
325
+ var codeFilesCount = this.filesManager.find('li.codeFile.code-file-item').length;
326
+
327
+ this.block.infoBar.find('.block-code-files a').text(codeFilesCount);
328
+ };
329
+
330
  /**
331
  *
332
  *
333
  */
334
  var filesManagerDialog = function() {
335
  // File Manager.
336
+ this.filesManager = $('#code-files-manager');
 
 
337
  };
338
 
339
  /**
434
  *
435
  */
436
  this.deattach = function() {
437
+
438
+ this.filesManager.detach();
439
+
440
  // Clear any previously added list
441
  this.filesManager.find('li.codeFile').remove();
442
+
443
  // Make sure edit/create form to be destructed.
444
  this.editCodeFileDialog.close();
445
  // Hide Quicktoolbar.
474
  if (block.revisionControl && (block.revisionControl.state == 'revision')) {
475
  return;
476
  }
477
+
478
  // Enter Deattached state.
479
+ this.deattach();
480
+
481
  // Display if not displayed.
482
+ if (this.block !== block) {
483
+
484
  // Switch to block.
485
  this.block = block;
486
+
487
+ this.block.block.box.find('.cjpageblock').append(this.filesManager);
488
+
489
+ // Aply theme
490
+ this.applyTheme(this.block);
491
+
492
  // Fetch List
493
  block.codeFile.getList().done($.proxy(
494
+
495
  function(codeFiles) {
496
  // - Don't process is entered deattach state.
497
  // - Process only last switched block.
507
  }
508
  }, this)
509
  );
510
+
 
 
 
 
 
511
  }
512
  }, this)
513
  );
views/blocks/block/public/js/codefile-manager/codefile-manager.localization.php CHANGED
@@ -14,4 +14,5 @@ return array(
14
  'noSelection' => cssJSToolbox::getText('Nothing selected!'),
15
  'nameIsNull' => cssJSToolbox::getText('Name cannot be null. Code File must has a unique name for each Block.'),
16
  'nameAlreadyExists' => cssJSToolbox::getText('Code File name is currently taken. Please choose another name.'),
 
17
  );
14
  'noSelection' => cssJSToolbox::getText('Nothing selected!'),
15
  'nameIsNull' => cssJSToolbox::getText('Name cannot be null. Code File must has a unique name for each Block.'),
16
  'nameAlreadyExists' => cssJSToolbox::getText('Code File name is currently taken. Please choose another name.'),
17
+ 'codeFilesDialogTitle' => cssJSToolbox::getText('Code Files'),
18
  );
views/blocks/block/public/js/codefile/codefile.js CHANGED
@@ -26,16 +26,34 @@
26
  */
27
  this.file = {};
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  /**
30
  * put your comment there...
31
  *
32
  *
33
  */
34
- var _onclickfilename = function(event) {
 
35
  // Switch Code Files Managed to current block.
36
- CJTBlockCodeFileView.switchTo(block);
37
- // Don't close or show Menu.
38
- event.stopPropagation();
 
 
39
  };
40
 
41
  /**
@@ -112,9 +130,7 @@
112
  // Make sure to recalculate changes after force ace editor to be unchanged.
113
  var isChanged = CJTBlocksPage.blocks.calculateChanges(block.changes, model.aceEditor.cjtBlockFieldId, false);
114
  CJTBlocksPage.blockContentChanged(blockId, isChanged);
115
- block.toolbox.buttons.save.enable(isChanged);
116
- // Chage Current File Name.
117
- this.currentFileName.text(this.file.name);
118
  // Reflect View State.
119
  promise.resolve(blockId, rCodeFile.id);
120
  }, this)
@@ -136,13 +152,12 @@
136
  fileInputs.remove();
137
 
138
  // Switch editor language.
139
- block._onswitcheditorlang(undefined, {lang : this.file.type ? this.file.type : block.block.get('editorLang', 'css')});
140
- /// Load block file related features ///
141
- // File name and files list.
142
- this.currentFileName = $('<a>').addClass('file').text(this.file.name)
143
- .insertAfter(block.elements.blockName)
144
- .before($('<span class="name-file-separator">|</span>'))
145
- .click($.proxy(_onclickfilename, this));
146
  };
147
 
148
  })(jQuery);
26
  */
27
  this.file = {};
28
 
29
+ /**
30
+ * put your comment there...
31
+ *
32
+ * @param event
33
+ * @param block
34
+ */
35
+ var _onbeforedeleteblock = function(event, block) {
36
+
37
+ if (block === CJTBlockCodeFileView.block) {
38
+
39
+ CJTBlockCodeFileView.deattach();
40
+ }
41
+
42
+ };
43
+
44
  /**
45
  * put your comment there...
46
  *
47
  *
48
  */
49
+ var _onopencodefiledialog = function(event) {
50
+
51
  // Switch Code Files Managed to current block.
52
+ CJTBlockCodeFileView.switchTo(block);
53
+
54
+ block._onPaneledItems(event);
55
+
56
+ return false;
57
  };
58
 
59
  /**
130
  // Make sure to recalculate changes after force ace editor to be unchanged.
131
  var isChanged = CJTBlocksPage.blocks.calculateChanges(block.changes, model.aceEditor.cjtBlockFieldId, false);
132
  CJTBlocksPage.blockContentChanged(blockId, isChanged);
133
+ block.editBlockActionsToolbox.buttons.save.enable(isChanged);
 
 
134
  // Reflect View State.
135
  promise.resolve(blockId, rCodeFile.id);
136
  }, this)
152
  fileInputs.remove();
153
 
154
  // Switch editor language.
155
+ block._onswitcheditorlang({}, {lang : this.file.type ? this.file.type : block.block.get('editorLang', 'css')});
156
+
157
+ block.toolbox.buttons['code-files'].callback = _onopencodefiledialog;
158
+
159
+ // Block Events
160
+ block.block.box.on('BeforeDeleteBlock', _onbeforedeleteblock);
 
161
  };
162
 
163
  })(jQuery);
views/blocks/block/public/js/jquery.block/jquery.block.js CHANGED
@@ -9,6 +9,154 @@
9
  */
10
  (function($) {
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  /**
13
  *
14
  */
@@ -22,34 +170,48 @@
22
  this.initDIFields = function() {
23
  // Initialize notification saqve change singlton object.
24
  block.changes = [];
 
25
  // Initialize vars.
26
  var model = block.block;
27
  var aceEditor = model.aceEditor;
28
  var fields = model.getDIFields();
29
- // Create common interface for ace editor to
30
- // be accessed like other HTML elements.
31
- aceEditor.type = 'aceEditor'; // Required for _oncontentchanged to behave correctly.
32
  /**
33
- * Bind method for bind events like HTML Elements.
 
 
 
 
 
34
  */
 
35
  aceEditor.bind = function(e, h) {
 
36
  this.getSession().doc.on(e, h);
37
  }
38
- /**
39
- * Method to get hash copy from stored content.
40
- */
41
  aceEditor.cjtSyncInputField = function() {
 
42
  this.cjtBlockSyncValue = hex_md5(this.getSession().getValue());
43
  }
 
44
  // Hack jQuery Object by pushing
45
  // ace Editor into fields list, increase length by 1.
46
  fields[fields.length++] = aceEditor;
 
47
  // For all fields call cjtSyncInputField and give a unique id.
48
  $.each(fields, $.proxy(
 
49
  function(index, field) {
 
50
  this.initElement(field);
 
51
  }, this)
 
52
  );
 
 
 
 
53
  // Chaining.
54
  return this;
55
  },
@@ -60,27 +222,42 @@
60
  * @param element
61
  */
62
  this.initElement = function(field) {
 
63
  // Assign weight number used to identify the field.
64
  field.cjtBlockFieldId = CJTBlocksPage.blocks.getUFI();
 
65
  // Create default cjtSyncInputField method if not exists.
66
  if (field.cjtSyncInputField == undefined) {
 
67
  if (field.type == 'checkbox') {
68
- field.cjtSyncInputField = function() {
69
- this.cjtBlockSyncValue = $(this).prop('checked');
70
- }
 
 
 
 
71
  }
72
  else {
73
- field.cjtSyncInputField = function() {
74
- this.cjtBlockSyncValue = this.value;
75
- }
 
 
 
76
  }
 
77
  // Create interface to "bind" too.
78
  field.bind = function(e, h) {
79
- $(this).bind(e, h);
 
80
  }
 
81
  }
 
82
  // Sync field.
83
  field.cjtSyncInputField();
 
84
  // Bind to change event.
85
  field.bind('change', $.proxy(block._oncontentchanged, block));
86
  }
@@ -139,6 +316,11 @@
139
  */
140
  this.defaultDocks;
141
 
 
 
 
 
 
142
  /**
143
  *
144
  */
@@ -163,6 +345,26 @@
163
  */
164
  this.features;
165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  /**
167
  *
168
  */
@@ -178,22 +380,25 @@
178
  // Block Plugins
179
  CJTBlockObjectPluginDockModule.plug(this);
180
 
181
- /**
182
- * Event handler for cancel edit block name.
183
- *
184
- * Cancel edit name can be done through two ways.
185
- * - Press Escape inside edit block name input.
186
- * - Click cancel edit name icon.
187
- */
188
- this._oncanceleditname = function() {
189
- var editName = this.elements.editBlockName;
190
- // Hide edit block area.
191
- editName.css('display', 'none')
192
- // Unbind events that binded when the edit block name form is displayed.
193
- .find('input.block-name').unbind('keydown.editName');
194
- // Hide CodeFile Name.
195
- this.block.box.find('.file').css({visibility : 'visible'});
196
- }
 
 
 
197
 
198
  /**
199
  *
@@ -231,7 +436,7 @@
231
  isFieldChanged = (newValue != syncValue);
232
  isChanged = CJTBlocksPage.blocks.calculateChanges(this.changes, id, isFieldChanged);
233
  // Enable button is there is a change not saved yet, disable it if not.
234
- this.toolbox.buttons.save.enable(isChanged);
235
  // Notify blocks page.
236
  CJTBlocksPage.blockContentChanged(this.block.id, isChanged);
237
  }
@@ -249,8 +454,13 @@
249
  confirmMessage = confirmMessage.replace('%s', this.block.get('name'));
250
  // Confirm deletion!
251
  if (confirm(confirmMessage)) {
 
 
 
252
  // Delete block.
253
  CJTBlocksPage.deleteBlocks(this.block.box);
 
 
254
  }
255
  }
256
 
@@ -260,7 +470,8 @@
260
  *
261
  *
262
  */
263
- this._ondisplayrevisions = function() {
 
264
  // Restore revision only when block is opened.
265
  if (this.block.box.hasClass('closed')) {
266
  return false;
@@ -268,73 +479,19 @@
268
  // Initialize form request.
269
  var revisionsFormParams = {
270
  id : this.block.get('id'),
271
- activeFileId : this.codeFile.file.activeFileId,
272
- width : 300,
273
- height : 250,
274
- TB_iframe : true
275
  };
276
  var url = CJTBlocksPage.server.getRequestURL('block', 'get_revisions', revisionsFormParams);
277
- tb_show(CJTJqueryBlockI18N.blockRevisionsDialogTitle, url);
278
- return false;
279
- }
280
 
281
- /**
282
- * Event handler for start editing block name.
283
- *
284
- * The method display edit block name box and and associate all
285
- * the required event for save or cancel editing.
286
- *
287
- */
288
- this._oneditname = function(event) {
289
- // Initialize.
290
- var editName = this.elements.editBlockName;
291
- var inputText = editName.find('input.block-name');
292
- // When block name clicked don't toggle postbox.
293
- event.stopPropagation();
294
- // Check if already in edit mode.
295
- if (editName.css('display') == 'none') {
296
- // Cancel or Save editing when ESCAPE or Enter button is pressed.
297
- inputText.bind('keydown.editName', $.proxy(
298
- function(event) {
299
- if (event.keyCode == 27) {
300
- // Cancel
301
- this._oncanceleditname();
302
- }
303
- else if (event.keyCode == 13) {
304
- // Save
305
- this._onsavename();
306
- event.preventDefault();
307
- }
308
- }, this)
309
- );
310
- // Put it exactly above the block name - padding.
311
- editName.css({
312
- 'left' : ((this.elements.blockName.position().left - 2) + 'px'),
313
- 'background-color' : this.theme.backgroundColor
314
- });
315
- // Hide CodeFile Name.
316
- this.block.box.find('.file').css({visibility : 'hidden'});
317
- // Set input styles
318
- var styles = {
319
- 'font-size' : this.elements.blockName.css('font-size'),
320
- 'font-family' : this.elements.blockName.css('font-family')
321
- };
322
- // Make the textbox wider in case the displayed name is
323
- // wider than the text field.
324
- var labelWidth = parseInt(this.elements.blockName.css('width'));
325
- var textWidh = parseInt(inputText.css('width'));
326
- if (labelWidth > textWidh) {
327
- styles.width = (labelWidth + 100) + 'px';
328
- }
329
- inputText.css(styles);
330
- // Display.
331
- editName.css('display', 'block');
332
- // When the input lost the focus cancel edit.
333
- // Get name.
334
- inputText.val(this.block.get('name'));
335
- // Set focus.
336
- inputText.focus();
337
- }
338
  }
339
 
340
  /**
@@ -343,51 +500,98 @@
343
  *
344
  *
345
  */
346
- this._ongetinfo = function() {
 
 
 
 
 
 
 
 
 
347
  // Server request.
348
  var requestData = {
 
349
  // Server paramerers.
350
  id : this.block.get('id'),
351
- // Thick box parameters.
352
- width : 500,
353
- height: 500
354
  };
 
355
  var url = CJTBlocksPage.server.getRequestURL('block', 'get_info_view', requestData);
356
- tb_show(CJTJqueryBlockI18N.blockInfoTitle, url);
 
357
  };
358
 
359
  /**
360
  *
361
  */
362
- this._onlookuptemplates = function(targetElement, tbButton) {
 
363
  // Initialize.
364
- var frameHeight = parseInt(targetElement.css('height'));
 
365
  var blockId = this.block.get('id');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  if (!CJTToolBox.forms.templatesLookupForm[blockId]) {
367
  CJTToolBox.forms.templatesLookupForm[blockId] = {};
368
  }
369
  var lookupForm = CJTToolBox.forms.templatesLookupForm[blockId];
370
  // This method will fired only once when the
371
  // Templates popup button is hovered for the first time.
372
- if (!targetElement.get(0).__cjt_loaded) {
373
  var request = {blockId : blockId};
374
  // Pass block object to the form when loaded.
375
- lookupForm.inputs = {block : this.block, button : tbButton, height : frameHeight};
376
  // Set frame Source to templates lookup view URL.
377
  var templatesLookupViewURL = CJTBlocksPage.server.getRequestURL('templatesLookup', 'display', request);
378
- targetElement.prop('src', templatesLookupViewURL);
379
  // Mark loaded.
380
- targetElement.get(0).__cjt_loaded = true;
381
  }
382
  else {
383
  // Pass frame height when refreshed.
384
- lookupForm.inputs.height = frameHeight;
385
  lookupForm.form.refresh();
386
  }
387
  /** @TODO Tell Block toolbox to deatach/unbind popup callback */
388
  return true; // Tell CJTToolBox to Show Popup menu as normal.
389
  }
390
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  /**
392
  * Don't show popup menus if Block is minimized!
393
  */
@@ -429,28 +633,45 @@
429
  *
430
  */
431
  this._onsavechanges = function() {
432
- var saveButton = this.toolbox.buttons['save'];
 
 
433
  // Dont save unless there is a change!
434
  if (saveButton.jButton.hasClass('cjttbs-disabled')) {
435
  // Return REsolved Dummy Object for standarizing sake!
436
  return CJTBlocksPage.server.getDeferredObject().resolve().promise();
437
  }
 
438
  // Queue User Direct Interact fields (code, etc...).
439
  var data = {calculatePinPoint : this.features.calculatePinPoint, createRevision : 1};
 
440
  // Push DiFields inside Ajax queue.
441
  this.block.queueDIFields();
 
442
  // Add code file flags to the queue.
443
  var queue = this.block.getOperationQueue('saveDIFields');
444
  queue.add({id : this.block.get('id'), property : 'activeFileId', value : this.codeFile.file.activeFileId});
 
445
  // But save button into load state (Inactive and Showing loading icon).
446
- saveButton.loading(true);
447
- this.enable(false);
 
 
 
 
 
448
  // Send request to server.
449
  return this.block.sync('saveDIFields', data)
 
450
  .success($.proxy(
451
- function() {
 
 
 
 
452
  // Stop loading effect and disable the button.
453
  saveButton.loading(false, false);
 
454
  // Sync fields with server value.
455
  // This refrssh required for notifying saving
456
  // change to detect changes.
@@ -462,52 +683,53 @@
462
  this.cjtSyncInputField();
463
  }
464
  );
 
465
  // Reset changes list.
466
  this.changes = [];
 
467
  // Tell blocks page that block is saved and has not changed yet.
468
  CJTBlocksPage.blockContentChanged(this.block.id, false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
469
  // Fire BlockSaved event.
470
  this.onBlockSaved();
 
 
 
471
  }, this)
472
  )
473
  .error($.proxy(
 
474
  function() {
 
475
  saveButton.loading(false);
 
476
  }, this)
 
477
  ).complete($.proxy(
478
- function() {
 
 
 
479
  this.enable(true);
 
480
  }, this)
 
481
  );
482
- }
483
 
484
- /**
485
- * Event handler for saveing block name.
486
- *
487
- * This method validate block name and send new block name to the server.
488
- */
489
- this._onsavename = function () {
490
- // Save only if new and old name are not same.
491
- var blockName = this.elements.editBlockName.find('input.block-name').val();
492
- // Name cannot be empty!
493
- if (!blockName.match(/^[A-Za-z0-9\!\#\@\$\&\*\(\)\[\]\x20\-\_\+\?\:\;\.]{1,50}$/)) {
494
- // Show message!
495
- alert(CJTJqueryBlockI18N.invalidBlockName);
496
- }
497
- else { // Simply save!
498
- // Change block name.
499
- this.block.set('name', blockName)
500
- .success($.proxy(
501
- function(rName) {
502
- // Update metabox title when sucess.
503
- this.elements.blockName.text(rName.value);
504
- }, this)
505
- );
506
- // Update on server.
507
- this.block.sync('name');
508
- // Hide edit name input field and tasks buttons.
509
- this._oncanceleditname();
510
- }
511
  }
512
 
513
  /**
@@ -517,30 +739,20 @@
517
  *
518
  */
519
  this._onswitcheditorlang = function(event, params) {
520
- var cssMap = {
521
- css : 'cjttbl-editor-language-css',
522
- html : 'cjttbl-editor-language-html',
523
- javascript : 'cjttbl-editor-language-javascript',
524
- php : 'cjttbl-editor-language-php'
525
- };
526
  var jLanguageSwitcher = this.block.box.find('.cjttbl-switch-editor-language');
527
  var languageSwitcher = jLanguageSwitcher.get(0);
 
528
  // Note: Event and params parameter is passed but unused,
529
  // we need only selectedValue.
530
  // Set editor mode.
531
  var editorMode = 'ace/mode/' + params.lang;
532
  this.block.aceEditor.getSession().setMode(editorMode);
 
533
  // Save editor language for block.
534
  this.block.set('editorLang', params.lang);
535
- /// Change switcher icon to the selected language ///
536
- // If there is previously selected language remove its css class.
537
- if (languageSwitcher.cjtbCurrentLangClass != undefined) {
538
- jLanguageSwitcher.removeClass(languageSwitcher.cjtbCurrentLangClass);
539
- }
540
- // Add new class.
541
- jLanguageSwitcher.addClass(cssMap[params.lang]);
542
- // Store current selected language for later use.
543
- languageSwitcher.cjtbCurrentLangClass = cssMap[params.lang];
544
  }
545
 
546
  /**
@@ -550,11 +762,15 @@
550
  * @param object Toolbox evenr parameters.
551
  */
552
  this._onswitchflag = function(event, params) {
 
 
553
  var target = $(event.target);
554
  var oldValue = this.block.get(params.flag);
555
- var flagButton = this.toolbox.buttons[params.flag + '-switch'];
 
556
  // Put the Flag button into load state (Inactive + loading icon).
557
  flagButton.loading(true);
 
558
  // Switch flag state.
559
  this.block.switchFlag(params.flag, params.newValue).success($.proxy(
560
  function(rState) {
@@ -565,13 +781,21 @@
565
  .attr('title', CJTJqueryBlockI18N[params.flag + '_' + rState.value + 'Title']);
566
  }, this)
567
  );
 
568
  // Update on server.
569
- this.block.sync(params.flag)
 
570
  .complete($.proxy(
 
571
  function() {
 
572
  flagButton.loading(false);
 
573
  }, this)
 
574
  );
 
 
575
  }
576
 
577
  /**
@@ -581,7 +805,7 @@
581
  *
582
  */
583
  this.enable = function(state) {
584
- var elements = this.block.box.find('input:checkbox, textarea, select');
585
  switch (state) {
586
  case true: // Enable block.
587
  elements.removeAttr('disabled');
@@ -590,6 +814,11 @@
590
  elements.attr('disabled', 'disabled');
591
  break;
592
  }
 
 
 
 
 
593
  // Enable or Disable ACEEditor.
594
  // Enable = true then setReadnly = false and vise versa.
595
  this.block.aceEditor.setReadOnly(!state);
@@ -610,11 +839,17 @@
610
  *
611
  */
612
  this.initCJTPluginBase = function(node, args) {
 
613
  // Initialize object properties!
614
  var model = this.block = new CJTBlock(this, node);
615
  this.features = $.extend(defaultOptions, args);
 
616
  // Initialize Events.
617
  this.onBlockSaved = function() {};
 
 
 
 
618
  // Load commonly used elements.
619
  this.elements = {};
620
  $.each(autoLoadElements, $.proxy(
@@ -622,70 +857,221 @@
622
  this.elements[name] = this.block.box.find(selector);
623
  }, this)
624
  );
 
625
  // Move edit-block-name edit area and tasks-bar outside Wordpress metabox "inside div".
626
  this.elements.insideMetabox.before(model.box.find('.edit-block-name, .block-toolbox'));
627
- var events = { // In-Place edit block name events.
628
- 'span.block-name' : $.proxy(this._oneditname, this),
629
- '.edit-block-name a.save' : $.proxy(this._onsavename, this),
630
- '.edit-block-name a.cancel' : $.proxy(this._oncanceleditname, this)
631
- };
632
- $.each(events, $.proxy(
633
- function(selector, handler) {
634
- model.box.find(selector).click(handler);
635
- }, this)
636
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
637
  // Activate toolbox.
638
  this.toolbox = model.box.find('.block-toolbox').CJTToolBox({
639
  context : this,
640
  handlers : {
641
- 'templates-lookup' : {
642
- type : 'Popup',
643
- callback : this._onlookuptemplates,
644
- params : {
645
- fitToScreen : true, /* Custom to be used inside this._onpopupmenu() method */
646
- _type : {
647
- onPopup : this._onpopupmenu,
648
- targetElement : '.templates-lookup',
649
- setTargetPosition : false
650
- }
651
- }
652
- },
653
- 'switch-editor-language' : {
654
- type : 'Popup',
655
- params : {
656
- // Parameters for PopupList type button.
657
- _type : {
658
- onPopup : this._onpopupmenu,
659
- targetElement : '.editor-langs',
660
- setTargetPosition : false
661
- }
662
- }
663
- },
664
- 'link-external' : {callback : this._onlinkexternal},
665
- 'editor-language-css' : {callback : this._onswitcheditorlang, params : {lang : 'css'}},
666
- 'editor-language-html' : {callback : this._onswitcheditorlang, params : {lang : 'html'}},
667
- 'editor-language-javascript' : {callback : this._onswitcheditorlang, params : {lang : 'javascript'}},
668
- 'editor-language-php' : {callback : this._onswitcheditorlang, params : {lang : 'php'}},
669
- 'state-switch' : {callback : this._onswitchflag, params : {flag : 'state'}},
670
- 'save' : {callback : this._onsavechanges, params : {enable : false}},
671
- 'delete' : {callback : this._ondelete},
672
- 'location-switch' : {callback : this._onswitchflag, params : {flag : 'location'}},
673
- 'get-shortcode' : {callback : this._ongetshortcode},
674
- 'edit-name' : {callback : this._oneditname},
675
- 'info' : {callback : this._ongetinfo},
676
  }
677
  }).get(0).CJTToolBox;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
678
  // If the code editor element is presented then
679
  // the block is already opened and no need to load later.
680
  if (model.box.find('.code-editor').length) {
681
- this.load();
 
 
 
682
  }
 
683
  // Display block.
684
  // !important: Blocks come from server response doesn't need this but the newly added blocks does.
685
  // need sometime to be ready for display.
686
  model.box.css({display : 'block'}).addClass('cjt-block');
687
  }
688
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689
  /**
690
  *
691
  */
@@ -698,14 +1084,16 @@
698
  CJTBlocksPage.server.send('blocksPage', 'loadBlock', {blockId : model.get('id'), isLoading : true})
699
  .success($.proxy(
700
  function(blockContent) {
 
701
  // Remove loading bloc progress.
702
  loadingPro.remove();
703
- // Add assignment panel at the most begning of the block.
704
- this.elements.insideMetabox.prepend(blockContent.assignPanel);
705
- // Add block content at the end.
706
  this.elements.insideMetabox.append(blockContent.content);
 
707
  // Load block.
708
- this.load();
 
709
  }, this)
710
  );
711
  };
@@ -726,39 +1114,125 @@
726
 
727
  // Editor default options.
728
  this.block.aceEditor.setOptions({showPrintMargin : false});
 
 
 
 
 
 
 
 
729
  // Initialize editor toolbox.
730
  this.editorToolbox = model.box.find('.editor-toolbox').CJTToolBox({
731
  context : this,
732
  handlers : {}
733
  }).get(0).CJTToolBox;
 
 
734
  // Default to DOCK!!
735
- this.defaultDocks = [{element : this.block.aceEditor.container, pixels : 7}];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
736
  // Show hidden toolbox buttons.
737
- this.toolbox.buttons['switch-editor-language'].jButton.removeClass('waitingToLoad');
738
- this.toolbox.buttons['link-external'].jButton.removeClass('waitingToLoad');
739
- this.toolbox.buttons['templates-lookup'].jButton.removeClass('waitingToLoad');
740
- this.toolbox.buttons['save'].jButton.removeClass('waitingToLoad');
741
  // Register COMMAND-KEYS.
742
  this.registerCommands();
 
743
  // Switch Block state if required, if state is empty nothing will happen.
744
  // Until now only 'restore' state is supported to prevent saving restored block.
745
  this.switchState(this.features.state);
 
746
  // Prepare input elements for notifying user changes.
747
  this.notifySaveChanges = (new notifySaveChangesProto(this)).initDIFields();
 
748
  // Set theme object.
 
749
  this.theme = {};
 
 
750
  this.theme.backgroundColor = 'white';
751
  this.theme.color = 'black';
 
 
752
 
753
  // LOAD EVENT.
754
  if (this.onLoad !== undefined) {
 
755
  this.onLoad();
756
  }
757
 
758
  // Block Code File.
759
  this.codeFile = new CJTBlockFile(this);
 
 
 
 
760
  }
761
 
 
 
 
 
 
 
 
 
 
 
 
 
 
762
  /**
763
  *
764
  */
@@ -796,6 +1270,28 @@
796
  this.features = features;
797
  };
798
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
799
  /*
800
  *
801
  *
9
  */
10
  (function($) {
11
 
12
+ /**
13
+ * put your comment there...
14
+ *
15
+ */
16
+ $.fn.CJTPLSHooksDropdown = function(arg) {
17
+
18
+ var result = this;
19
+ var args = arguments;
20
+
21
+ this.each(
22
+
23
+ function() {
24
+
25
+ // Initialize the Plugin only once for each element on the chain
26
+ if (this.CJTPLSHooksDropdown) {
27
+
28
+ result = this.CJTPLSHooksDropdown[arg].call($this, args);
29
+
30
+ return;
31
+ }
32
+
33
+ // Prepare PLugin vars
34
+ var $this = $(this);
35
+
36
+ options = arg;
37
+
38
+ // Initialize NEW Dropdown jQuery Plugin for the HTML element
39
+ this.CJTPLSHooksDropdown = new function() {
40
+
41
+ // Initialize object vars
42
+ var listValueElement;
43
+ var listElement;
44
+ var listElements;
45
+
46
+ /**
47
+ * put your comment there...
48
+ *
49
+ */
50
+ var getItemValue = function(link) {
51
+
52
+ var hookName = link.prop('href').match(/#(.+)/)[1];
53
+
54
+ return hookName
55
+ };
56
+
57
+ /**
58
+ * put your comment there...
59
+ *
60
+ */
61
+ var init = function() {
62
+
63
+ // Get list elements jQuery object
64
+ listValueElement = $this.find('.value>a');
65
+ listElement = $this.find('.hooks-dropdown-list');
66
+ listElements = listElement.find('li');
67
+
68
+ listValueElement.click(
69
+
70
+ function() {
71
+
72
+ listElement.toggle();
73
+
74
+ return false;
75
+ }
76
+ );
77
+
78
+ // list elements click event
79
+ listElements.find('a').click(
80
+
81
+ function(event) {
82
+
83
+ var link = $(this);
84
+
85
+ // Reflect selected value
86
+ var hookName = getItemValue(link);
87
+
88
+ listValueElement.text(link.text());
89
+
90
+ // Set selected value CSS
91
+ listElements.removeClass('selected');
92
+ link.parent().addClass('selected');
93
+
94
+ // ITem selection event
95
+ $this.trigger('change', [$this, hookName, link]);
96
+
97
+ return false;
98
+ }
99
+ );
100
+
101
+ // Initially select the selected element
102
+ listValueElement.text(listElements.filter('.selected').find('a').text());
103
+
104
+ };
105
+
106
+ /**
107
+ *
108
+ */
109
+ this.getOptions = function() {
110
+
111
+ return options;
112
+ };
113
+
114
+ /**
115
+ *
116
+ */
117
+ this.setValue = function(args) {
118
+
119
+ listElements.find('a').each(
120
+
121
+ function() {
122
+
123
+ var link = $(this);
124
+ var hookName = getItemValue(link);
125
+
126
+ if (hookName == args[1]) {
127
+
128
+ listValueElement.text(link.text());
129
+
130
+ listElements.removeClass('selected');
131
+ link.parent().addClass('selected');
132
+
133
+ return false;
134
+ }
135
+
136
+ }
137
+
138
+ );
139
+
140
+ };
141
+
142
+ this.toggle = function() {
143
+
144
+ listElement.toggle();
145
+
146
+ };
147
+
148
+ // Initialize on construction
149
+ init();
150
+
151
+ };
152
+
153
+ }
154
+ );
155
+
156
+ // Chaining
157
+ return result;
158
+ };
159
+
160
  /**
161
  *
162
  */
170
  this.initDIFields = function() {
171
  // Initialize notification saqve change singlton object.
172
  block.changes = [];
173
+
174
  // Initialize vars.
175
  var model = block.block;
176
  var aceEditor = model.aceEditor;
177
  var fields = model.getDIFields();
178
+
 
 
179
  /**
180
+ * Create common interface for ace editor to
181
+ * be accessed like other HTML elements.
182
+ *
183
+ *
184
+ * Bind method for bind events like HTML Elements +
185
+ * Method to get hash copy from stored content.
186
  */
187
+ aceEditor.type = 'aceEditor'; // Required for _oncontentchanged to behave correctly.
188
  aceEditor.bind = function(e, h) {
189
+
190
  this.getSession().doc.on(e, h);
191
  }
 
 
 
192
  aceEditor.cjtSyncInputField = function() {
193
+
194
  this.cjtBlockSyncValue = hex_md5(this.getSession().getValue());
195
  }
196
+
197
  // Hack jQuery Object by pushing
198
  // ace Editor into fields list, increase length by 1.
199
  fields[fields.length++] = aceEditor;
200
+
201
  // For all fields call cjtSyncInputField and give a unique id.
202
  $.each(fields, $.proxy(
203
+
204
  function(index, field) {
205
+
206
  this.initElement(field);
207
+
208
  }, this)
209
+
210
  );
211
+
212
+ // Notify Changes for Block name when key pressed
213
+ model.box.find('input:text.block-name').on('keyup', $.proxy(block._oncontentchanged, block));
214
+
215
  // Chaining.
216
  return this;
217
  },
222
  * @param element
223
  */
224
  this.initElement = function(field) {
225
+
226
  // Assign weight number used to identify the field.
227
  field.cjtBlockFieldId = CJTBlocksPage.blocks.getUFI();
228
+
229
  // Create default cjtSyncInputField method if not exists.
230
  if (field.cjtSyncInputField == undefined) {
231
+
232
  if (field.type == 'checkbox') {
233
+
234
+ field.cjtSyncInputField = function() {
235
+
236
+ this.cjtBlockSyncValue = $(this).prop('checked');
237
+
238
+ }
239
+
240
  }
241
  else {
242
+
243
+ field.cjtSyncInputField = function() {
244
+
245
+ this.cjtBlockSyncValue = this.value;
246
+ }
247
+
248
  }
249
+
250
  // Create interface to "bind" too.
251
  field.bind = function(e, h) {
252
+
253
+ $(this).bind(e, h);
254
  }
255
+
256
  }
257
+
258
  // Sync field.
259
  field.cjtSyncInputField();
260
+
261
  // Bind to change event.
262
  field.bind('change', $.proxy(block._oncontentchanged, block));
263
  }
316
  */
317
  this.defaultDocks;
318
 
319
+ /**
320
+ *
321
+ */
322
+ this.editBlockActionsToolbox;
323
+
324
  /**
325
  *
326
  */
345
  */
346
  this.features;
347
 
348
+ /**
349
+ *
350
+ */
351
+ this.editorLangsToolbox;
352
+
353
+ /**
354
+ *
355
+ */
356
+ this.flaggedActionsToolbox;
357
+
358
+ /**
359
+ *
360
+ */
361
+ this.hooksDropdown;
362
+
363
+ /**
364
+ *
365
+ */
366
+ this.infoBar;
367
+
368
  /**
369
  *
370
  */
380
  // Block Plugins
381
  CJTBlockObjectPluginDockModule.plug(this);
382
 
383
+ /**
384
+ *
385
+ */
386
+ this._onclosepanelwindow = function(event) {
387
+
388
+ var assignPanel = this.block.box.find('.cjt-panel-item.cjt-panel-window-assignments');
389
+ var panelWnds = this.block.box.find('.cjt-panel-item');
390
+
391
+ // Make sure all panel windows are hidden
392
+ panelWnds.hide();
393
+
394
+ // Always display the assignment panel
395
+ assignPanel.show();
396
+
397
+ // Hide close button
398
+ $(event.target).hide();
399
+
400
+ return false;
401
+ };
402
 
403
  /**
404
  *
436
  isFieldChanged = (newValue != syncValue);
437
  isChanged = CJTBlocksPage.blocks.calculateChanges(this.changes, id, isFieldChanged);
438
  // Enable button is there is a change not saved yet, disable it if not.
439
+ this.editBlockActionsToolbox.buttons.save.enable(isChanged);
440
  // Notify blocks page.
441
  CJTBlocksPage.blockContentChanged(this.block.id, isChanged);
442
  }
454
  confirmMessage = confirmMessage.replace('%s', this.block.get('name'));
455
  // Confirm deletion!
456
  if (confirm(confirmMessage)) {
457
+
458
+ this.block.box.trigger('BeforeDeleteBlock', [this]);
459
+
460
  // Delete block.
461
  CJTBlocksPage.deleteBlocks(this.block.box);
462
+
463
+ this.block.box.trigger('BlockDeleted', [this]);
464
  }
465
  }
466
 
470
  *
471
  *
472
  */
473
+ this._ondisplayrevisions = function(event) {
474
+
475
  // Restore revision only when block is opened.
476
  if (this.block.box.hasClass('closed')) {
477
  return false;
479
  // Initialize form request.
480
  var revisionsFormParams = {
481
  id : this.block.get('id'),
482
+ activeFileId : this.codeFile.file.activeFileId
 
 
 
483
  };
484
  var url = CJTBlocksPage.server.getRequestURL('block', 'get_revisions', revisionsFormParams);
 
 
 
485
 
486
+ var genericPanelWindow = $('.cjpageblock .cjt-panel-genericwnd');
487
+
488
+ genericPanelWindow
489
+ .empty()
490
+ .append('<iframe style="width:100%;height:100%;" src="' + url + '"></iframe>');
491
+
492
+ this._onPaneledItems(event);
493
+
494
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
  }
496
 
497
  /**
500
  *
501
  *
502
  */
503
+ this._ongetinfo = function(event) {
504
+
505
+ var sections = {
506
+ 'info' : 'info',
507
+ 'assignment-info' : 'assignment'
508
+ };
509
+
510
+ var windowName = $(event.target).prop('href').match(/#(.+)/)[1];
511
+ var sectionName = sections[windowName];
512
+
513
  // Server request.
514
  var requestData = {
515
+
516
  // Server paramerers.
517
  id : this.block.get('id'),
518
+ show_section : sectionName
 
 
519
  };
520
+
521
  var url = CJTBlocksPage.server.getRequestURL('block', 'get_info_view', requestData);
522
+
523
+ this.showPanelGenericWindow(event, url);
524
  };
525
 
526
  /**
527
  *
528
  */
529
+ this._onlookuptemplates = function(event) {
530
+
531
  // Initialize.
532
+ var panelWnd = this.block.box.find('.cjt-panel-item.cjt-panel-window-templates-lookup');
533
+ var frameHeight = parseInt(panelWnd.css('height'));
534
  var blockId = this.block.get('id');
535
+ var iframe = panelWnd.find('iframe');
536
+ var iframeHeight = frameHeight - 35
537
+
538
+ // Stay inactive if the toolbox is didsabled, as the toolbox
539
+ // has no class for enable/disable state we might use on of its buttons
540
+ if (this.toolbox.buttons['location-switch'].jButton.hasClass('cjttbs-disabled')) {
541
+
542
+ return;
543
+ }
544
+
545
+ this._onPaneledItems(event);
546
+
547
+ iframe.css('height', iframeHeight);
548
+
549
  if (!CJTToolBox.forms.templatesLookupForm[blockId]) {
550
  CJTToolBox.forms.templatesLookupForm[blockId] = {};
551
  }
552
  var lookupForm = CJTToolBox.forms.templatesLookupForm[blockId];
553
  // This method will fired only once when the
554
  // Templates popup button is hovered for the first time.
555
+ if (!iframe.get(0).__cjt_loaded) {
556
  var request = {blockId : blockId};
557
  // Pass block object to the form when loaded.
558
+ lookupForm.inputs = {blockPlugin : this, block : this.block, button : $(event.target), height : iframeHeight};
559
  // Set frame Source to templates lookup view URL.
560
  var templatesLookupViewURL = CJTBlocksPage.server.getRequestURL('templatesLookup', 'display', request);
561
+ iframe.prop('src', templatesLookupViewURL);
562
  // Mark loaded.
563
+ iframe.get(0).__cjt_loaded = true;
564
  }
565
  else {
566
  // Pass frame height when refreshed.
567
+ lookupForm.inputs.height = iframeHeight;
568
  lookupForm.form.refresh();
569
  }
570
  /** @TODO Tell Block toolbox to deatach/unbind popup callback */
571
  return true; // Tell CJTToolBox to Show Popup menu as normal.
572
  }
573
 
574
+ /**
575
+ *
576
+ */
577
+ this._onPaneledItems = function(event) {
578
+
579
+ var link = $(event.target);
580
+ var windowName = link.prop('href').match(/#(.+)/)[1];
581
+ var panelWindow = this.block.box.find('.cjt-panel-item.cjt-panel-window-' + windowName);
582
+ var panelArea = this.block.box.find('.cjpageblock');
583
+
584
+ // Hide all panel windows
585
+ panelArea.find('.cjt-panel-item').hide();
586
+
587
+ // Display panel
588
+ panelWindow.show();
589
+
590
+ // Display Close button
591
+ panelArea.find('.close-panel-window').show();
592
+ };
593
+
594
+
595
  /**
596
  * Don't show popup menus if Block is minimized!
597
  */
633
  *
634
  */
635
  this._onsavechanges = function() {
636
+
637
+ var saveButton = this.editBlockActionsToolbox.buttons['save'];
638
+
639
  // Dont save unless there is a change!
640
  if (saveButton.jButton.hasClass('cjttbs-disabled')) {
641
  // Return REsolved Dummy Object for standarizing sake!
642
  return CJTBlocksPage.server.getDeferredObject().resolve().promise();
643
  }
644
+
645
  // Queue User Direct Interact fields (code, etc...).
646
  var data = {calculatePinPoint : this.features.calculatePinPoint, createRevision : 1};
647
+
648
  // Push DiFields inside Ajax queue.
649
  this.block.queueDIFields();
650
+
651
  // Add code file flags to the queue.
652
  var queue = this.block.getOperationQueue('saveDIFields');
653
  queue.add({id : this.block.get('id'), property : 'activeFileId', value : this.codeFile.file.activeFileId});
654
+
655
  // But save button into load state (Inactive and Showing loading icon).
656
+ if (this.block.get('name').match(/^[A-Za-z0-9\!\#\@\$\&\*\(\)\[\]\x20\-\_\+\?\:\;\.]{1,50}$/)) {
657
+ saveButton.loading(true);
658
+ this.enable(false);
659
+
660
+ this.block.box.trigger('PreSaveBlock', [this]);
661
+ }
662
+
663
  // Send request to server.
664
  return this.block.sync('saveDIFields', data)
665
+
666
  .success($.proxy(
667
+
668
+ function(response) {
669
+
670
+ var responseBlockData = response[this.block.get('id')];
671
+
672
  // Stop loading effect and disable the button.
673
  saveButton.loading(false, false);
674
+
675
  // Sync fields with server value.
676
  // This refrssh required for notifying saving
677
  // change to detect changes.
683
  this.cjtSyncInputField();
684
  }
685
  );
686
+
687
  // Reset changes list.
688
  this.changes = [];
689
+
690
  // Tell blocks page that block is saved and has not changed yet.
691
  CJTBlocksPage.blockContentChanged(this.block.id, false);
692
+
693
+ // Reflect Info bar updated information
694
+ this.infoBar.find('.block-info-name>strong').text(responseBlockData.name.value);
695
+ this.infoBar.find('.block-shortcode > input:text').val('[cjtoolbox name="' + responseBlockData.name.value + '"]');
696
+
697
+ var blockModifiedDate = new Date(responseBlockData.lastModified.value);
698
+
699
+ this.infoBar.find('.block-modified-date>strong').text(
700
+ blockModifiedDate.getDate().toString().padStart(2, 0) + '-' +
701
+ (blockModifiedDate.getMonth() + 1).toString().padStart(2, 0) + '-' +
702
+ blockModifiedDate.getFullYear() + ', ' +
703
+ blockModifiedDate.getHours() + ':' +
704
+ blockModifiedDate.getMinutes()
705
+ );
706
+
707
  // Fire BlockSaved event.
708
  this.onBlockSaved();
709
+
710
+ this.block.box.trigger('BlockSaved', [this]);
711
+
712
  }, this)
713
  )
714
  .error($.proxy(
715
+
716
  function() {
717
+
718
  saveButton.loading(false);
719
+
720
  }, this)
721
+
722
  ).complete($.proxy(
723
+
724
+ function(response) {
725
+
726
+ // Enable block
727
  this.enable(true);
728
+
729
  }, this)
730
+
731
  );
 
732
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
733
  }
734
 
735
  /**
739
  *
740
  */
741
  this._onswitcheditorlang = function(event, params) {
742
+
 
 
 
 
 
743
  var jLanguageSwitcher = this.block.box.find('.cjttbl-switch-editor-language');
744
  var languageSwitcher = jLanguageSwitcher.get(0);
745
+
746
  // Note: Event and params parameter is passed but unused,
747
  // we need only selectedValue.
748
  // Set editor mode.
749
  var editorMode = 'ace/mode/' + params.lang;
750
  this.block.aceEditor.getSession().setMode(editorMode);
751
+
752
  // Save editor language for block.
753
  this.block.set('editorLang', params.lang);
754
+
755
+ jLanguageSwitcher.text(CJTJqueryBlockI18N['editorLang_' + params.lang]);
 
 
 
 
 
 
 
756
  }
757
 
758
  /**
762
  * @param object Toolbox evenr parameters.
763
  */
764
  this._onswitchflag = function(event, params) {
765
+
766
+ var promise;
767
  var target = $(event.target);
768
  var oldValue = this.block.get(params.flag);
769
+ var flagButton = this.flaggedActionsToolbox.buttons[params.flag + '-switch'];
770
+
771
  // Put the Flag button into load state (Inactive + loading icon).
772
  flagButton.loading(true);
773
+
774
  // Switch flag state.
775
  this.block.switchFlag(params.flag, params.newValue).success($.proxy(
776
  function(rState) {
781
  .attr('title', CJTJqueryBlockI18N[params.flag + '_' + rState.value + 'Title']);
782
  }, this)
783
  );
784
+
785
  // Update on server.
786
+ promise = this.block.sync(params.flag)
787
+
788
  .complete($.proxy(
789
+
790
  function() {
791
+
792
  flagButton.loading(false);
793
+
794
  }, this)
795
+
796
  );
797
+
798
+ return promise;
799
  }
800
 
801
  /**
805
  *
806
  */
807
  this.enable = function(state) {
808
+ var elements = this.block.box.find('input:checkbox,input:text, textarea, select');
809
  switch (state) {
810
  case true: // Enable block.
811
  elements.removeAttr('disabled');
814
  elements.attr('disabled', 'disabled');
815
  break;
816
  }
817
+
818
+ this.toolbox.enable(state);
819
+ this.flaggedActionsToolbox.enable(state);
820
+ this.editBlockActionsToolbox.buttons['delete'].enable(state);
821
+
822
  // Enable or Disable ACEEditor.
823
  // Enable = true then setReadnly = false and vise versa.
824
  this.block.aceEditor.setReadOnly(!state);
839
  *
840
  */
841
  this.initCJTPluginBase = function(node, args) {
842
+
843
  // Initialize object properties!
844
  var model = this.block = new CJTBlock(this, node);
845
  this.features = $.extend(defaultOptions, args);
846
+
847
  // Initialize Events.
848
  this.onBlockSaved = function() {};
849
+
850
+ // DOn't TOGGLE block when block name get/lost focus
851
+ model.box.find('input:text.block-name').click(function(event) {event.stopPropagation();});
852
+
853
  // Load commonly used elements.
854
  this.elements = {};
855
  $.each(autoLoadElements, $.proxy(
857
  this.elements[name] = this.block.box.find(selector);
858
  }, this)
859
  );
860
+
861
  // Move edit-block-name edit area and tasks-bar outside Wordpress metabox "inside div".
862
  this.elements.insideMetabox.before(model.box.find('.edit-block-name, .block-toolbox'));
863
+
864
+ /* Info bar won't be exists if the block is initially closed
865
+ * this is just for the code to avoid writing more IF conditions
866
+ * block info item will be queried again on the load method
867
+ */
868
+ this.infoBar = this.block.box.find('.cjt-info-bar');
869
+
870
+ // HInitialize ooks dropdown list
871
+ this.hooksDropdown = model.box.find('.hooks-dropdown').CJTPLSHooksDropdown({})
872
+
873
+ /* Revert item value is failed to change location value */
874
+ /* Reflect Hooks icon and text values when successfully changes hook */
875
+ .on('change', $.proxy(
876
+
877
+ function(event, dropdown, hookName, jItem) {
878
+
879
+ var currentHookName = model.get('location');
880
+
881
+ model.set('location', hookName).error($.proxy(
882
+
883
+ function() {
884
+
885
+ dropdown.CJTPLSHooksDropdown('setValue', currentHookName);
886
+
887
+ }), this)
888
+
889
+ .done($.proxy(
890
+
891
+ function() {
892
+
893
+ // Reflect Hook button status when hook changed
894
+ this.toolbox.buttons['location-switch'].jButton
895
+ .removeClass('location-' + currentHookName)
896
+ .addClass('location-' + hookName)
897
+
898
+ .prop('title', jItem.prop('title'))
899
+ .text(jItem.text())
900
+
901
+ .removeClass('bad-location-specified')
902
+ .prev().removeClass('bad-location-specified')
903
+
904
+ }, this)
905
+ );
906
+
907
+ model.sync('location');
908
+
909
+ }, this)
910
+
911
+ ).get(0).CJTPLSHooksDropdown;
912
+
913
  // Activate toolbox.
914
  this.toolbox = model.box.find('.block-toolbox').CJTToolBox({
915
  context : this,
916
  handlers : {
917
+
918
+ 'assignment-info' : {callback : this._ongetinfo},
919
+ 'block-info' : {callback : this._ongetinfo},
920
+
921
+ 'location-switch' : {
922
+ type : 'Popup',
923
+ params : {
924
+ _type : {
925
+ targetElement : '.hooks-dropdown',
926
+ setTargetPosition : false
927
+ }
928
+ }
929
+ },
930
+ 'templates' : {
931
+ type : 'Popup',
932
+ params : {
933
+ _type : {
934
+ onPopup : this._onpopupmenu,
935
+ targetElement : '.templates',
936
+ setTargetPosition : true
937
+ }
938
+ }
939
+ },
940
+ 'templates-lookup' : {callback : this._onlookuptemplates},
941
+ 'templates-manager' : {callback : CJTBlocksPage._onmanagetemplates},
942
+ 'code-files' : {callback : function() {}} /* This is dummy unless updated by code file controller object on the load method */
 
 
 
 
 
 
 
 
 
943
  }
944
  }).get(0).CJTToolBox;
945
+
946
+ this.toolbox.buttons['templates'].jButton.click($.proxy(this._onlookuptemplates, this));
947
+
948
+ // Editor Language Toolbox
949
+ this.editorLangsToolbox = model.box.find('.cjt-toolbox.editor-langs-toolbox').CJTToolBox({
950
+
951
+ context : this,
952
+ handlers : {
953
+
954
+ 'switch-editor-language' : {
955
+ type : 'Popup',
956
+ params : {
957
+ // Parameters for PopupList type button.
958
+ _type : {
959
+ onPopup : this._onpopupmenu,
960
+ targetElement : '.editor-langs',
961
+ setTargetPosition : false
962
+ }
963
+ }
964
+ },
965
+
966
+ 'editor-language-css' : {callback : this._onswitcheditorlang, params : {lang : 'css'}},
967
+ 'editor-language-html' : {callback : this._onswitcheditorlang, params : {lang : 'html'}},
968
+ 'editor-language-javascript' : {callback : this._onswitcheditorlang, params : {lang : 'javascript'}},
969
+ 'editor-language-php' : {callback : this._onswitcheditorlang, params : {lang : 'php'}}
970
+
971
+ }
972
+
973
+ }).get(0).CJTToolBox;
974
+
975
+ // Disable Toolbox until block is loaded
976
+ this.toolbox.enable(false);
977
+ this.editorLangsToolbox.enable(false);
978
+
979
+ // Move State and Location buttons to be before block name
980
+ this.flaggedActionsToolbox = model.box.find('.cjt-toolbox.flagged-actions-toolbox')
981
+ .insertBefore(model.box.find('.postbox-header .hndle .block-name'))
982
+ .CJTToolBox({
983
+
984
+ context : this,
985
+ handlers : {
986
+ 'state-switch' : {callback : this._onswitchflag, params : {flag : 'state'}},
987
+ }
988
+
989
+ }).get(0).CJTToolBox;
990
+
991
+ // Move State and Location buttons to be before block name
992
+ this.editBlockActionsToolbox = model.box.find('.cjt-toolbox.edit-block-toolbox')
993
+ .insertAfter(model.box.find('.postbox-header .hndle .block-name'))
994
+ .CJTToolBox({
995
+
996
+ context : this,
997
+ handlers : {
998
+
999
+ 'save' : {callback : this._onsavechanges, params : {enable : false}},
1000
+ 'delete' : {callback : this._ondelete},
1001
+
1002
+ }
1003
+
1004
+ }).get(0).CJTToolBox;
1005
+
1006
+ // Initialized-event (Regardless if loaded or not)
1007
+ this.block.box.trigger('Initialized', [this]);
1008
+
1009
  // If the code editor element is presented then
1010
  // the block is already opened and no need to load later.
1011
  if (model.box.find('.code-editor').length) {
1012
+
1013
+ // Load nd Trigger Load events
1014
+ this.loadTLE();
1015
+
1016
  }
1017
+
1018
  // Display block.
1019
  // !important: Blocks come from server response doesn't need this but the newly added blocks does.
1020
  // need sometime to be ready for display.
1021
  model.box.css({display : 'block'}).addClass('cjt-block');
1022
  }
1023
 
1024
+ /**
1025
+ *
1026
+ */
1027
+ this.initInfoBar = function() {
1028
+
1029
+ this.infoBar = this.block.box.find('.cjt-info-bar');
1030
+
1031
+ // Copy Shortcode
1032
+ this.infoBar.find('.block-shortcode .copyshortcode').click($.proxy(
1033
+
1034
+ function() {
1035
+
1036
+ var shortcodeEle = this.infoBar.find('.block-shortcode input');
1037
+
1038
+ shortcodeEle.focus();
1039
+ shortcodeEle.select();
1040
+
1041
+ document.execCommand('copy');
1042
+
1043
+ return false;
1044
+
1045
+ }, this)
1046
+ );
1047
+
1048
+ // Update Assignment count whenever the block is saved
1049
+ this.block.box.on('BlockSaved', $.proxy(
1050
+
1051
+ function() {
1052
+
1053
+ CJTBlocksPage.server.send('block', 'getAllAssignment', {blockId : this.block.get('id')}).done($.proxy(
1054
+
1055
+ function(response) {
1056
+
1057
+ this.infoBar.find('.block-assignment-count .show-assignment-info').text(response);
1058
+
1059
+ }, this)
1060
+
1061
+ );
1062
+
1063
+ }, this)
1064
+
1065
+ );
1066
+
1067
+
1068
+ // Editor Language
1069
+ this.infoBar.find('.block-editor-lang strong').text(this.block.get('editorLang'));
1070
+
1071
+ // Allow info bar to be extensible
1072
+ this.block.box.trigger('InitInfoBar', [this, this.infoBar]);
1073
+ };
1074
+
1075
  /**
1076
  *
1077
  */
1084
  CJTBlocksPage.server.send('blocksPage', 'loadBlock', {blockId : model.get('id'), isLoading : true})
1085
  .success($.proxy(
1086
  function(blockContent) {
1087
+
1088
  // Remove loading bloc progress.
1089
  loadingPro.remove();
1090
+
1091
+ // Add block content
 
1092
  this.elements.insideMetabox.append(blockContent.content);
1093
+
1094
  // Load block.
1095
+ this.loadTLE();
1096
+
1097
  }, this)
1098
  );
1099
  };
1114
 
1115
  // Editor default options.
1116
  this.block.aceEditor.setOptions({showPrintMargin : false});
1117
+
1118
+ // Initialize info bar
1119
+ this.initInfoBar();
1120
+
1121
+ // Enable HEader button Toolbox
1122
+ this.toolbox.enable(true);
1123
+ this.editorLangsToolbox.enable(true);
1124
+
1125
  // Initialize editor toolbox.
1126
  this.editorToolbox = model.box.find('.editor-toolbox').CJTToolBox({
1127
  context : this,
1128
  handlers : {}
1129
  }).get(0).CJTToolBox;
1130
+
1131
+
1132
  // Default to DOCK!!
1133
+ this.defaultDocks = [
1134
+ {
1135
+ element : $(this.block.aceEditor.container),
1136
+ pixels : 7
1137
+ },
1138
+ {
1139
+ element : this.block.box.find('.cjpageblock .cjt-panel-genericwnd'),
1140
+ pixels : 64
1141
+ },
1142
+ {
1143
+ element : this.block.box.find('.cjt-panel-item.cjt-panel-window-templates-lookup')
1144
+
1145
+ .on('CJTDockedItemResized',
1146
+
1147
+ function(event, item) {
1148
+
1149
+ if (CJTToolBox.forms.templatesLookupForm[model.get('id')] !== undefined) {
1150
+
1151
+ item.height = item.height - 35;
1152
+
1153
+ item.element.find('iframe').css('height', item.height);
1154
+ CJTToolBox.forms.templatesLookupForm[model.get('id')].inputs.height = item.height;
1155
+ CJTToolBox.forms.templatesLookupForm[model.get('id')].form.refresh();
1156
+
1157
+ }
1158
+
1159
+ }
1160
+ )
1161
+ .on('CJTBlockExitFullScreen',
1162
+
1163
+ function(event, item) {
1164
+
1165
+ if (CJTToolBox.forms.templatesLookupForm[model.get('id')] !== undefined) {
1166
+
1167
+ var originalHeight = item.element.height();
1168
+ var iframeHeight = originalHeight - 35;
1169
+
1170
+ item.element.css('height', originalHeight);
1171
+ item.element.find('iframe').css('height', iframeHeight);
1172
+
1173
+ CJTToolBox.forms.templatesLookupForm[model.get('id')].inputs.height = iframeHeight;
1174
+ CJTToolBox.forms.templatesLookupForm[model.get('id')].form.refresh();
1175
+
1176
+ }
1177
+
1178
+ }
1179
+ ),
1180
+ pixels : 27
1181
+ }
1182
+ ];
1183
+
1184
  // Show hidden toolbox buttons.
1185
+ this.editorLangsToolbox.buttons['switch-editor-language'].jButton.removeClass('waitingToLoad');
1186
+ this.block.box.find('.cjt-toolbox.block-toolbox').find('.waitingToLoad').removeClass('waitingToLoad');
1187
+ this.editBlockActionsToolbox.buttons['save'].jButton.removeClass('waitingToLoad');
1188
+
1189
  // Register COMMAND-KEYS.
1190
  this.registerCommands();
1191
+
1192
  // Switch Block state if required, if state is empty nothing will happen.
1193
  // Until now only 'restore' state is supported to prevent saving restored block.
1194
  this.switchState(this.features.state);
1195
+
1196
  // Prepare input elements for notifying user changes.
1197
  this.notifySaveChanges = (new notifySaveChangesProto(this)).initDIFields();
1198
+
1199
  // Set theme object.
1200
+
1201
  this.theme = {};
1202
+
1203
+ /*
1204
  this.theme.backgroundColor = 'white';
1205
  this.theme.color = 'black';
1206
+ this.theme.altTextColor = 'snow';
1207
+ */
1208
 
1209
  // LOAD EVENT.
1210
  if (this.onLoad !== undefined) {
1211
+
1212
  this.onLoad();
1213
  }
1214
 
1215
  // Block Code File.
1216
  this.codeFile = new CJTBlockFile(this);
1217
+
1218
+ this.block.box.find('.cjpageblock a.close-panel-window').click($.proxy(this._onclosepanelwindow, this));
1219
+
1220
+ this.block.box.trigger( 'cjtBlockPostLoading', [ this ] );
1221
  }
1222
 
1223
+ /**
1224
+ *
1225
+ */
1226
+ this.loadTLE = function() {
1227
+
1228
+ this.block.box.trigger('BlockBeforeLoadProc', [this]);
1229
+
1230
+ this.load();
1231
+
1232
+ this.block.box.trigger('BlockAfterLoadProc', [this]);
1233
+
1234
+ };
1235
+
1236
  /**
1237
  *
1238
  */
1270
  this.features = features;
1271
  };
1272
 
1273
+ /**
1274
+ *
1275
+ */
1276
+ this.showPanelGenericWindow = function(event, url) {
1277
+
1278
+ var genericPanelWindow = $('.cjpageblock .cjt-panel-genericwnd');
1279
+
1280
+ $.get(url).done($.proxy(
1281
+
1282
+ function(content) {
1283
+
1284
+ genericPanelWindow
1285
+ .empty()
1286
+ .append(content);
1287
+
1288
+ this._onPaneledItems(event);
1289
+
1290
+ }, this)
1291
+
1292
+ );
1293
+ };
1294
+
1295
  /*
1296
  *
1297
  *
views/blocks/block/public/js/jquery.block/jquery.block.localization.php CHANGED
@@ -9,14 +9,24 @@
9
  *
10
  * Localization text for backups script.
11
  */
12
- return array(
 
13
  'blockRevisionsDialogTitle' => cssJSToolbox::getText('Block revisions'),
14
  'blockInfoTitle' => cssJSToolbox::getText('CJT-Block Info'),
15
  'confirmDelete' => cssJSToolbox::getText('Are you sure you want to delete this (%s) code block?'),
 
16
  'state_activeTitle' => cssJSToolbox::getText('Deactivate (turn off) code block'),
17
  'state_inactiveTitle' => cssJSToolbox::getText('Activate (turn on) code block'),
18
- 'location_headerTitle' => cssJSToolbox::getText('Set output location hook to footer'),
19
- 'location_footerTitle' => cssJSToolbox::getText('Set output location hook to header'),
 
20
  'invalidBlockName' => cssJSToolbox::getText('Invalid block name'),
21
  'loadingBlock' => cssJSToolbox::getText('Loading'),
22
- );
 
 
 
 
 
 
 
9
  *
10
  * Localization text for backups script.
11
  */
12
+ $locals = array(
13
+
14
  'blockRevisionsDialogTitle' => cssJSToolbox::getText('Block revisions'),
15
  'blockInfoTitle' => cssJSToolbox::getText('CJT-Block Info'),
16
  'confirmDelete' => cssJSToolbox::getText('Are you sure you want to delete this (%s) code block?'),
17
+
18
  'state_activeTitle' => cssJSToolbox::getText('Deactivate (turn off) code block'),
19
  'state_inactiveTitle' => cssJSToolbox::getText('Activate (turn on) code block'),
20
+ 'state_active' => cssJSToolbox::getText('On'),
21
+ 'state_inactive' => cssJSToolbox::getText('Off'),
22
+
23
  'invalidBlockName' => cssJSToolbox::getText('Invalid block name'),
24
  'loadingBlock' => cssJSToolbox::getText('Loading'),
25
+
26
+ 'editorLang_css' => cssJSToolbox::getText('CSS'),
27
+ 'editorLang_html' => cssJSToolbox::getText('HTML'),
28
+ 'editorLang_php' => cssJSToolbox::getText('PHP'),
29
+ 'editorLang_javascript' => cssJSToolbox::getText('Javascript'),
30
+ );
31
+
32
+ return $locals;
views/blocks/block/public/js/optional/revision/revision.js CHANGED
@@ -77,7 +77,9 @@ var CJTBlockOptionalRevisionBase = null;
77
  // Initialize
78
  var block = this.block;
79
  var toolbox = block.toolbox;
80
- var saveButton = toolbox.buttons['save'];
 
 
81
  var mdlBlock = block.block;
82
  var properties = block.features.restoreRevision.fields;
83
  var pom;
@@ -93,10 +95,14 @@ var CJTBlockOptionalRevisionBase = null;
93
  }, this)
94
  );
95
  // Remove cancel button.
96
- toolbox.remove('cancel-restore');
 
97
  // Enable block components.
98
  block.enable(true);
99
  toolbox.enable(true);
 
 
 
100
  // Set notification changes back.
101
  block.changes = this.original.changes;
102
  var isChanged = CJTBlocksPage.blocks.calculateChanges(block.changes, 0, false);
@@ -121,13 +127,16 @@ var CJTBlockOptionalRevisionBase = null;
121
  this.display = function() {
122
  // Initialize.
123
  var block = this.block;
124
- var toolbox = block.toolbox;
125
- var saveButton = toolbox.buttons['save'];
 
 
126
  var mdlBlock = block.block;
127
  var properties = block.features.restoreRevision.fields;
128
  var pom;
 
129
  // Before switch state event.
130
- this.onBeforeSwitchState()
131
  // Cache 'Changes' array, don't reference it from block.changes
132
  // as both got the same variable reference.
133
  this.original.changes = block.changes; block.changes = [];
@@ -146,8 +155,13 @@ var CJTBlockOptionalRevisionBase = null;
146
  block.changes = [];
147
  // Force Notification Changes to detect that current block has changes.
148
  CJTBlocksPage.blockContentChanged(mdlBlock.get('id'), true);
 
149
  // DISABLE-ALL toolbox buttons
150
- toolbox.enable(false);
 
 
 
 
151
  // Except save button!
152
  saveButton.enable(true);
153
  saveButton._callback = saveButton.callback;
@@ -161,7 +175,7 @@ var CJTBlockOptionalRevisionBase = null;
161
  $('<a href="#" class="cjt-tb-link cjttbl-cancel-restore il-60x23"></a>')
162
  .text('Cancel')
163
  .insertBefore(saveButton.jButton);
164
- toolbox.add('cancel-restore', {callback : $.proxy(this.cancel, this)});
165
  // Disable block.
166
  block.enable(false);
167
  // Change state / Enter revision mode.
@@ -174,8 +188,7 @@ var CJTBlockOptionalRevisionBase = null;
174
  this.restore = function() {
175
  // Initialize.
176
  var block = this.block;
177
- var toolbox = block.toolbox;
178
- var saveButton = toolbox.buttons['save'];
179
  var server = CJTBlocksPage.server;
180
  var request = {rid : this.revision['id'], bid : block.block.get('id')};
181
  // Restore revision via server.
77
  // Initialize
78
  var block = this.block;
79
  var toolbox = block.toolbox;
80
+ var editBlockToolbox = block.editBlockActionsToolbox;
81
+ var flaggedActionsToolbox = block.flaggedActionsToolbox;
82
+ var saveButton = editBlockToolbox.buttons['save'];
83
  var mdlBlock = block.block;
84
  var properties = block.features.restoreRevision.fields;
85
  var pom;
95
  }, this)
96
  );
97
  // Remove cancel button.
98
+ editBlockToolbox.remove('cancel-restore');
99
+
100
  // Enable block components.
101
  block.enable(true);
102
  toolbox.enable(true);
103
+ editBlockToolbox.enable(true);
104
+ flaggedActionsToolbox.enable(true);
105
+
106
  // Set notification changes back.
107
  block.changes = this.original.changes;
108
  var isChanged = CJTBlocksPage.blocks.calculateChanges(block.changes, 0, false);
127
  this.display = function() {
128
  // Initialize.
129
  var block = this.block;
130
+ var toolbox = block.toolbox;
131
+ var editBlockToolbox = block.editBlockActionsToolbox;
132
+ var flaggedActionsToolbox = block.flaggedActionsToolbox;
133
+ var saveButton = block.editBlockActionsToolbox.buttons['save'];
134
  var mdlBlock = block.block;
135
  var properties = block.features.restoreRevision.fields;
136
  var pom;
137
+
138
  // Before switch state event.
139
+ this.onBeforeSwitchState();
140
  // Cache 'Changes' array, don't reference it from block.changes
141
  // as both got the same variable reference.
142
  this.original.changes = block.changes; block.changes = [];
155
  block.changes = [];
156
  // Force Notification Changes to detect that current block has changes.
157
  CJTBlocksPage.blockContentChanged(mdlBlock.get('id'), true);
158
+
159
  // DISABLE-ALL toolbox buttons
160
+ toolbox.enable(false); flaggedActionsToolbox.enable(false);
161
+
162
+ // Hide all Panel Windows and Display only Asisgnment panel window
163
+ block._onclosepanelwindow({target : block.block.box.find('.cjpageblock .close-panel-window')});
164
+
165
  // Except save button!
166
  saveButton.enable(true);
167
  saveButton._callback = saveButton.callback;
175
  $('<a href="#" class="cjt-tb-link cjttbl-cancel-restore il-60x23"></a>')
176
  .text('Cancel')
177
  .insertBefore(saveButton.jButton);
178
+ editBlockToolbox.add('cancel-restore', {callback : $.proxy(this.cancel, this)});
179
  // Disable block.
180
  block.enable(false);
181
  // Change state / Enter revision mode.
188
  this.restore = function() {
189
  // Initialize.
190
  var block = this.block;
191
+ var saveButton = block.editBlockActionsToolbox.buttons['save'];
 
192
  var server = CJTBlocksPage.server;
193
  var request = {rid : this.revision['id'], bid : block.block.get('id')};
194
  // Restore revision via server.
views/blocks/block/public/js/plugins/dockmodule.js CHANGED
@@ -18,15 +18,21 @@
18
  *
19
  */
20
  this.plug = function(block) {
 
21
  // Define Dock method
22
  block.dock = function(elements, pixelsToRemove) {
 
23
  // Initialize.
24
  var alwaysRemove = 33;
25
  pixelsToRemove = (pixelsToRemove != undefined) ? (pixelsToRemove + alwaysRemove) : alwaysRemove;
 
26
  // There're always 33 pixels need to be removed from the Code area
27
  var fixedHeight = this.block.box.height() - pixelsToRemove;
28
  var heightInPixels = fixedHeight + 'px';
 
29
  $(elements).css('height', heightInPixels);
 
 
30
  }
31
  };
32
 
18
  *
19
  */
20
  this.plug = function(block) {
21
+
22
  // Define Dock method
23
  block.dock = function(elements, pixelsToRemove) {
24
+
25
  // Initialize.
26
  var alwaysRemove = 33;
27
  pixelsToRemove = (pixelsToRemove != undefined) ? (pixelsToRemove + alwaysRemove) : alwaysRemove;
28
+
29
  // There're always 33 pixels need to be removed from the Code area
30
  var fixedHeight = this.block.box.height() - pixelsToRemove;
31
  var heightInPixels = fixedHeight + 'px';
32
+
33
  $(elements).css('height', heightInPixels);
34
+
35
+ return fixedHeight;
36
  }
37
  };
38
 
views/blocks/block/tmpl/codefile/codefile.html.tmpl CHANGED
@@ -1,48 +1,47 @@
1
- <ul id="code-files-manager">
2
- <li class="dialog-tool-buttons">
3
- <a class="delete" href="#" title="<?php echo cssJSToolbox::getText('Delete all selected Code Files') ?>"><?php echo cssJSToolbox::getText('Delete') ?></a> |
4
- <a class="close" href="#" title="<?php echo cssJSToolbox::getText('Close Code Files Manager Dialog') ?>"><?php echo cssJSToolbox::getText('Close') ?></a>
5
- </li>
6
- <li class="overlay"></li>
7
- <li class="edit-code-file">
8
- <input type="hidden" id="code-file-id" value="0" />
9
- <fieldset>
10
- <ul>
11
- <li><label title="<?php echo cssJSToolbox::getText('Code File Name should be unique for each Block. Use simple names that describe fow what Code File is used for.') ?>" for="codef-file-name"><?php echo cssJSToolbox::getText('Name') ?></label><input id="code-file-name" type="text" /></li>
12
- <li>
13
- <label for="code-file-type" title="<?php echo cssJSToolbox::getText('Type tells CJT how to handle applying the Code File to the Associated Request. It also automatically switch Code Editor language for you.') ?>"><?php echo cssJSToolbox::getText('Type') ?></label>
14
- <select id="code-file-type">
15
- <option value=""></option>
16
  <?php
17
- // List template types.
18
- $templateTypes =& cssJSToolbox::$config->templates->types;
19
- foreach ($templateTypes as $typeName => $type) :
20
  ?>
21
- <option value="<?php echo $typeName ?>"><?php echo $typeName ?></option>
22
- <?php endforeach; ?>
23
- </select>
24
- </li>
25
- <li>
26
- <label for="code-file-tag" title="<?php echo cssJSToolbox::getText('Its automatically generated when the Type is changed. In most cases you won\'t need to modify it manually, only change it when you know how to works. Please point out to CJT Web site documentation for more details about TAG field.') ?>"><?php echo cssJSToolbox::getText('Tag') ?></label>
27
- <textarea id="code-file-tag"></textarea>
28
- </li>
29
- <li>
30
- <label for="code-file-description" title="<?php echo cssJSToolbox::getText('Optionally Code File notes.') ?>"><?php echo cssJSToolbox::getText('Description') ?></label>
31
- <textarea id="code-file-description"></textarea>
32
- </li>
33
- <li>
34
- <input type="button" id="code-file-save-button" value="<?php echo cssJSToolbox::getText('Save') ?>" />
35
- <input type="button" id="code-file-cancel-button" value="<?php echo cssJSToolbox::getText('Close') ?>" />
36
- </li>
37
- </ul>
38
- </fieldset>
39
- </li>
40
- <li class="code-file-item create-file-row">
41
  <?php do_action( CJTPluggableHelper::ACTION_BLOCK_CODE_FILE_TEMPLATE_CREATE_NEW_FILE ); ?>
42
- </li>
43
- <li class="separator"></li>
44
- <li class="quick-toolbar">
45
- <input type="checkbox" class="select-code-file" /> |
46
- <a class="edit" href="#"><?php echo cssJSToolbox::getText('Edit') ?></a>
47
- </li>
48
  </ul>
1
+ <ul id="code-files-manager" class="cjt-panel-item cjt-panel-window-code-files">
2
+ <li class="dialog-tool-buttons">
3
+ <a class="delete" href="#" title="<?php echo cssJSToolbox::getText('Delete all selected Code Files') ?>"><?php echo cssJSToolbox::getText('Delete') ?></a>
4
+ </li>
5
+ <li class="overlay"></li>
6
+ <li class="edit-code-file">
7
+ <input type="hidden" id="code-file-id" value="0" />
8
+ <fieldset>
9
+ <ul>
10
+ <li><label title="<?php echo cssJSToolbox::getText('Code File Name should be unique for each Block. Use simple names that describe fow what Code File is used for.') ?>" for="codef-file-name"><?php echo cssJSToolbox::getText('Name') ?></label><input id="code-file-name" type="text" /></li>
11
+ <li>
12
+ <label for="code-file-type" title="<?php echo cssJSToolbox::getText('Type tells CJT how to handle applying the Code File to the Associated Request. It also automatically switch Code Editor language for you.') ?>"><?php echo cssJSToolbox::getText('Type') ?></label>
13
+ <select id="code-file-type">
14
+ <option value=""></option>
 
15
  <?php
16
+ // List template types.
17
+ $templateTypes =& cssJSToolbox::$config->templates->types;
18
+ foreach ($templateTypes as $typeName => $type) :
19
  ?>
20
+ <option value="<?php echo $typeName ?>"><?php echo $typeName ?></option>
21
+ <?php endforeach; ?>
22
+ </select>
23
+ </li>
24
+ <li>
25
+ <label for="code-file-tag" title="<?php echo cssJSToolbox::getText('Its automatically generated when the Type is changed. In most cases you won\'t need to modify it manually, only change it when you know how to works. Please point out to CJT Web site documentation for more details about TAG field.') ?>"><?php echo cssJSToolbox::getText('Tag') ?></label>
26
+ <textarea id="code-file-tag"></textarea>
27
+ </li>
28
+ <li>
29
+ <label for="code-file-description" title="<?php echo cssJSToolbox::getText('Optionally Code File notes.') ?>"><?php echo cssJSToolbox::getText('Description') ?></label>
30
+ <textarea id="code-file-description"></textarea>
31
+ </li>
32
+ <li>
33
+ <input type="button" id="code-file-save-button" value="<?php echo cssJSToolbox::getText('Save') ?>" />
34
+ <input type="button" id="code-file-cancel-button" value="<?php echo cssJSToolbox::getText('Close') ?>" />
35
+ </li>
36
+ </ul>
37
+ </fieldset>
38
+ </li>
39
+ <li class="code-file-item create-file-row">
40
  <?php do_action( CJTPluggableHelper::ACTION_BLOCK_CODE_FILE_TEMPLATE_CREATE_NEW_FILE ); ?>
41
+ </li>
42
+ <li class="separator"></li>
43
+ <li class="quick-toolbar">
44
+ <input type="checkbox" class="select-code-file" /> |
45
+ <a class="edit" href="#"><?php echo cssJSToolbox::getText('Edit') ?></a>
46
+ </li>
47
  </ul>
views/blocks/block/tmpl/content.html.tmpl CHANGED
@@ -5,17 +5,7 @@
5
 
6
  // Disallow direct access.
7
  defined('ABSPATH') or die("Access denied");
8
- $block = $this->getBlock($this->block->id, [], ['id', 'name', 'pinPoint', 'links', 'expressions', 'created']);
9
- $inPages = $block->pages ?? [];
10
- $inPosts = $block->posts ?? [];
11
- $inCats = $block->categories ?? [];
12
- $inTags = $block->post_tags ?? [];
13
- $inAux = [];
14
- $inLinks = ! empty( $block->links ) ? explode( "\n", $block->links ) : [];
15
- $inExps = ! empty( $block->expressions ) ? explode( "\n", $block->expressions ) : [];
16
- $allAssignment = array_merge( $inPages, $inPosts, $inCats, $inTags, $inLinks, $inExps );
17
- ?>
18
- <?php
19
  // Add activeFileId into codeFile object.
20
  $this->block->file->activeFileId = $this->block->activeFileId;
21
  // Hidden fields.
@@ -29,19 +19,56 @@ $allAssignment = array_merge( $inPages, $inPosts, $inCats, $inTags, $inLinks, $i
29
  }
30
  ?>
31
  <input type="hidden" name="cjtoolbox[<?php echo $this->block->id; ?>][file][<?php echo $field ?>]" value="<?php echo $fieldValue ?>" />
 
32
  <?php endforeach; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  <div class="cjcontainer">
34
  <div class="cjcodeblock">
35
  <?php echo $this->getTemplate('editor-toolbox', array(), 'tmpl/templates'); ?>
36
  <div class="datablock">
37
  <div id="editor-<?php echo $this->block->id ?>" class="code-editor"><?php echo htmlentities($this->block->file->code, null, 'UTF-8') ?></div>
38
 
39
- <div class="cjt-info-bar">
40
- <span>Code Block ID: <strong><?php echo $this->block->id; ?></strong></span>
41
- <span>Assignments: <strong><?php echo count( $allAssignment ); ?></strong></span>
42
- <span>User: <strong><?php echo get_userdata( $this->block->owner )->display_name; ?></strong></span>
43
- <span>Created: <strong><?php echo date( 'd-m-Y, H:i', strtotime( $this->block->created ) ); ?></strong></span>
44
- <span>Modified: <strong><?php echo date( 'd-m-Y, H:i', strtotime( $this->block->lastModified ) ); ?></strong></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  </div>
46
  </div>
47
  </div>
5
 
6
  // Disallow direct access.
7
  defined('ABSPATH') or die("Access denied");
8
+
 
 
 
 
 
 
 
 
 
 
9
  // Add activeFileId into codeFile object.
10
  $this->block->file->activeFileId = $this->block->activeFileId;
11
  // Hidden fields.
19
  }
20
  ?>
21
  <input type="hidden" name="cjtoolbox[<?php echo $this->block->id; ?>][file][<?php echo $field ?>]" value="<?php echo $fieldValue ?>" />
22
+
23
  <?php endforeach; ?>
24
+
25
+ <div class="cjpageblock">
26
+
27
+ <?php do_action(CJTPluggableHelper::ACTION_BLOCK_ASSIGN_PANEL . '-' . $this->block->id, $this) ?>
28
+
29
+ <a href="#close-panel-window" class="close-panel-window"><?php echo cssJSToolbox::getText('Close') ?></a>
30
+
31
+ <div class="cjt-panel-item cjt-panel-genericwnd cjt-panel-window-info cjt-panel-window-assignment-info" style="display: none;"></div>
32
+
33
+ <div class="cjt-panel-item cjt-panel-window-templates-lookup cjt-panel-window-templates" style="display: none;">
34
+
35
+ <iframe src="" class="popup-menu templates-lookup" NOBORDER="1"></iframe>
36
+
37
+ </div>
38
+
39
+ </div>
40
+
41
  <div class="cjcontainer">
42
  <div class="cjcodeblock">
43
  <?php echo $this->getTemplate('editor-toolbox', array(), 'tmpl/templates'); ?>
44
  <div class="datablock">
45
  <div id="editor-<?php echo $this->block->id ?>" class="code-editor"><?php echo htmlentities($this->block->file->code, null, 'UTF-8') ?></div>
46
 
47
+ <?php do_action(CJTPluggableHelper::ACTION_BLOCK_BEFORE_INFO_BAR, $this) ?>
48
+
49
+ <div class="cjt-info-bar cjt-info-bar-bottom">
50
+
51
+ <span class="block-owner">
52
+ <span class="infobar-item-title"><?php echo cssJSToolbox::getText('User:') ?> </span>
53
+ <strong><?php echo get_userdata( $this->block->owner )->display_name; ?></strong>
54
+ </span>
55
+
56
+ <span class="block-created-date">
57
+ <span class="infobar-item-title"><?php echo cssJSToolbox::getText('Created:') ?> </span>
58
+ <strong><?php echo date( 'd-m-Y, H:i', strtotime( $this->block->created ) ); ?></strong>
59
+ </span>
60
+
61
+ <span class="block-modified-date">
62
+ <span class="infobar-item-title"><?php echo cssJSToolbox::getText('Modified:') ?> </span>
63
+ <strong><?php echo date( 'd-m-Y, H:i', strtotime( $this->block->lastModified ) ); ?></strong>
64
+ </span>
65
+
66
+ <span class="block-shortcode">
67
+ <span class="infobar-item-title"><?php echo cssJSToolbox::getText('Shortcode:') ?> </span>
68
+ <input type="text" value="[cjtoolbox name='<?php echo $this->block->name ?>']" readonly="readonly" />
69
+ <a class="copyshortcode" href="#"><?php echo cssJSToolbox::getText('Copy') ?></a>
70
+ </span>
71
+
72
  </div>
73
  </div>
74
  </div>
views/blocks/block/tmpl/edit.html.tmpl CHANGED
@@ -6,24 +6,19 @@
6
  // Disallow direct access.
7
  defined('ABSPATH') or die("Access denied");
8
  ?>
9
- <div class="cjt-toolbox edit-block-name">
10
- <input type="text" class="block-name" value="" maxlength="50" />
11
- <div class="icons-group">
12
- <a class="cjt-tb-link cancel" title="<?php echo cssJSToolbox::getText('Cancel editing code block title') ?>"></a>
13
- <a class="cjt-tb-link save" title="<?php echo cssJSToolbox::getText('Save code block title') ?>"></a>
14
- </div>
15
- </div>
16
  <?php echo $this->getTemplate('toolbox', array(), 'tmpl/templates') ?>
 
17
  <input type="hidden" name="blocks[]" value="<?php echo $this->block->id ?>" />
18
  <?php
19
- // Hidden fields.
20
- $fields = array('name', 'state', 'location');
21
- foreach ($fields as $field) :
22
  ?>
23
- <input type="hidden" name="cjtoolbox[<?php echo $this->block->id; ?>][<?php echo $field ?>]" value="<?php echo $this->block->$field ?>" />
24
- <?php endforeach; ?>
25
- <?php
 
26
  if (!$this->isClosed) {
27
  echo $this->getTemplate('content');
28
- }
29
- ?>
6
  // Disallow direct access.
7
  defined('ABSPATH') or die("Access denied");
8
  ?>
9
+
 
 
 
 
 
 
10
  <?php echo $this->getTemplate('toolbox', array(), 'tmpl/templates') ?>
11
+
12
  <input type="hidden" name="blocks[]" value="<?php echo $this->block->id ?>" />
13
  <?php
14
+ // Hidden fields.
15
+ $fields = array('state', 'location');
16
+ foreach ($fields as $field) :
17
  ?>
18
+ <input type="hidden" name="cjtoolbox[<?php echo $this->block->id; ?>][<?php echo $field ?>]" value="<?php echo $this->block->$field ?>" />
19
+ <?php endforeach; ?>
20
+ <?php
21
+
22
  if (!$this->isClosed) {
23
  echo $this->getTemplate('content');
24
+ }
 
views/blocks/block/tmpl/templates/toolbox.html.tmpl CHANGED
@@ -1,34 +1,134 @@
1
- <div class="cjt-toolbox block-toolbox">
2
- <div class="empty-divider"></div>
3
 
4
- <div class="icons-group">
5
- <a href="#" class="cjt-tb-link cjttbl-state-switch state-<?php echo $this->block->state ?>" title="<?php echo $this->localization["state_{$this->block->state}Title"] ?>"></a>
6
- <a href="#" class="cjt-tb-link cjttbl-location-switch location-<?php echo $this->block->location ?>" title="<?php echo $this->localization["location_{$this->block->location}Title"] ?>"></a>
7
- </div>
 
8
 
9
- <div class="empty-divider"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- <div class="icons-group big-bar">
12
- <a href="#" class="cjt-tb-link waitingToLoad cjttbl-templates-lookup" title="<?php echo cssJSToolbox::getText('Template Lookup - Embed or link templates to code blocks') ?>"></a>
13
- <iframe src="" class="popup-menu templates-lookup" NOBORDER="1" style="display:none"></iframe>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
- <a href="#" class="cjt-tb-link cjttbl-info" title="<?php echo cssJSToolbox::getText('Show code block information') ?>"></a>
16
-
17
- <a href="#" class="cjt-tb-link waitingToLoad cjttbl-switch-editor-language" title="<?php echo cssJSToolbox::getText('Set editing language for syntax highlighting') ?>"></a>
18
- <div class="popup-menu editor-langs" style="display:none">
19
- <a href="#" class="cjt-tb-link cjt-tb-text-link cjttbl-editor-language-css" title="<?php echo cssJSToolbox::getText('Set editing language to CSS') ?>"><?php echo cssJSToolbox::getText('CSS') ?></a>
20
- <a href="#" class="cjt-tb-link cjt-tb-text-link cjttbl-editor-language-html" title="<?php echo cssJSToolbox::getText('Set editing language to HTML') ?>"><?php echo cssJSToolbox::getText('HTML') ?></a>
21
- <a href="#" class="cjt-tb-link cjt-tb-text-link cjttbl-editor-language-javascript" title="<?php echo cssJSToolbox::getText('Set editing language to JavaScript') ?>"><?php echo cssJSToolbox::getText('JavaScript') ?></a>
22
- <a href="#" class="cjt-tb-link cjt-tb-text-link cjttbl-editor-language-php" title="<?php echo cssJSToolbox::getText('Set editing language to PHP') ?>"><?php echo cssJSToolbox::getText('PHP') ?></a>
23
- </div>
24
-
25
- <a href="#" class="cjt-tb-link cjttbl-edit-name" title="<?php echo cssJSToolbox::getText('Edit code block title. Click Save to take affect') ?>"></a>
26
- <a href="#" class="cjt-tb-link cjttbl-delete" title="<?php echo cssJSToolbox::getText('Delete code block') ?>"></a>
27
- </div>
28
-
29
- <div class="empty-divider"></div>
30
-
31
- <div class="icons-group">
32
- <a href="#" class="cjt-tb-link waitingToLoad cjttbl-save il-60x23" title="<?php echo cssJSToolbox::getText('Save changes to code block') ?>"><?php echo cssJSToolbox::getText('Save') ?></a>
33
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  </div>
1
+ <?php
 
2
 
3
+ $hooksAttacher =& CJTBlocksCouplingController::theInstance()->getHooksAttacher();
4
+
5
+ extract($this->getHookStatus());
6
+
7
+ ?>
8
 
9
+ <?php $this->ontoolbox($this); // Trigger On Toolbox Hook ?>
10
+
11
+ <div class="cjt-toolbox flagged-actions-toolbox">
12
+
13
+ <div class="icons-group">
14
+ <?php do_action( CJTPluggableHelper::ACTION_BLOCK_TOOLBOX_TEMPLATE_INSIDE_BEFORE_FLAGS, $this ); ?>
15
+ <a href="#" class="cjt-tb-link cjttbl-state-switch state-<?php echo $this->block->state ?>" title="<?php echo $this->localization["state_{$this->block->state}Title"] ?>"></a>
16
+ <?php do_action( CJTPluggableHelper::ACTION_BLOCK_TOOLBOX_TEMPLATE_INSIDE_AFTER_FLAGS, $this ); ?>
17
+ </div>
18
+
19
+ </div>
20
+
21
+ <div class="cjt-toolbox edit-block-toolbox">
22
+
23
+ <div class="icons-group">
24
 
25
+ <a href="#" class="cjt-tb-link cjttbl-save il-60x23" title="<?php echo cssJSToolbox::getText('Save changes to code block') ?>"><?php echo cssJSToolbox::getText('Save') ?></a>
26
+ <a href="#" class="cjt-tb-link cjttbl-delete" title="<?php echo cssJSToolbox::getText('Delete code block') ?>"></a>
27
+
28
+ </div>
29
+
30
+ </div>
31
+
32
+ <div class="cjt-info-bar cjt-info-bar-top cjt-toolbox block-toolbox">
33
+
34
+ <div class="cjt-toolbox editor-langs-toolbox">
35
+
36
+ <div class="icons-group big-bar">
37
+
38
+ <span class="block-id">
39
+ <span class="infobar-item-title"><?php echo cssJSToolbox::getText('Block ID:') ?> </span>
40
+ <a href="#info" class="cjt-tb-link cjt-tb-text-link cjttbl-block-info"><?php echo $this->block->id; ?></a>
41
+ </span>
42
+
43
+ <div class="block-hook">
44
+
45
+ <span class="infobar-item-title <?php echo $badLocationClass ?>"><?php echo cssJSToolbox::getText('Hook:') ?> </span>
46
+
47
+ <a href="#" class="cjt-tb-link cjt-tb-text-link cjttbl-location-switch location-<?php echo $this->block->location ?> <?php echo $badLocationClass ?>" title="<?php echo $locationText ?>"><?php echo $locationTitle ?></a>
48
+ <div class="popup-menu hooks-dropdown" style="display:none">
49
+
50
+ <ul class="hooks-dropdown-list">
51
+
52
+ <?php
53
+
54
+ foreach($hooksAttacher->getFiltersList() as $hooks) :
55
+
56
+ foreach ($hooks as $hook) :
57
+
58
+ $isSelected = ($this->block->location == $hook['locationName']) ? "class='selected'" : '';
59
+
60
+ ?>
61
+
62
+ <li <?php echo $isSelected ?>>
63
+
64
+ <a href="#<?php echo $hook['locationName'] ?>" title="<?php echo $hook['text'] ?>"><?php echo $hook['title'] ?></a>
65
+
66
+ </li>
67
+
68
+ <?php endforeach; ?>
69
+
70
+ <?php endforeach; ?>
71
+
72
+ </ul>
73
 
74
+ </div>
75
+
76
+ </div>
77
+
78
+ <div class="block-editor-lang">
79
+ <span class="infobar-item-title"><?php echo cssJSToolbox::getText('Editor:') ?> </span>
80
+
81
+ <a href="#" class="cjt-tb-link cjt-tb-text-link cjttbl-switch-editor-language" title="<?php echo cssJSToolbox::getText('Set editing language for syntax highlighting') ?>">
82
+ <?php echo $this->block->file->type ? $this->block->file->type : 'PHP' ?>
83
+ </a>
84
+
85
+ <div class="popup-menu editor-langs" style="display:none">
86
+ <a href="#" class="cjt-tb-link cjt-tb-text-link cjttbl-editor-language-css" title="<?php echo cssJSToolbox::getText('Set editing language to CSS') ?>"><?php echo cssJSToolbox::getText('CSS') ?></a>
87
+ <a href="#" class="cjt-tb-link cjt-tb-text-link cjttbl-editor-language-html" title="<?php echo cssJSToolbox::getText('Set editing language to HTML') ?>"><?php echo cssJSToolbox::getText('HTML') ?></a>
88
+ <a href="#" class="cjt-tb-link cjt-tb-text-link cjttbl-editor-language-javascript" title="<?php echo cssJSToolbox::getText('Set editing language to JavaScript') ?>"><?php echo cssJSToolbox::getText('JavaScript') ?></a>
89
+ <a href="#" class="cjt-tb-link cjt-tb-text-link cjttbl-editor-language-php" title="<?php echo cssJSToolbox::getText('Set editing language to PHP') ?>"><?php echo cssJSToolbox::getText('PHP') ?></a>
90
+ </div>
91
+
92
+ </div>
93
+
94
+ <span class="block-assignment-count">
95
+ <span class="infobar-item-title"><?php echo cssJSToolbox::getText('Assignments:') ?> </span>
96
+ <strong>
97
+ <a class="cjt-tb-link cjt-tb-text-link cjttbl-assignment-info show-assignment-info" href="#assignment-info">
98
+ <?php echo count( $this->getAllAssignments() ); ?>
99
+ </a>
100
+ </strong>
101
+ </span>
102
+
103
+ <div class="templates-info">
104
+ <span class="infobar-item-title"><?php echo cssJSToolbox::getText('Templates') ?> </span>
105
+
106
+ <a href="#templates" class="cjt-tb-link cjt-tb-text-link cjttbl-templates" title="<?php echo cssJSToolbox::getText('Template Lookup - Embed or link templates to code blocks') ?>">
107
+ <?php echo CJTBlockTemplatesModel::getLinkedTemplatesCount($this->block->id) ?>
108
+ </a>
109
+ <div class="popup-menu templates" style="display:none">
110
+ <?php // FILTER MAY BE ?>
111
+ <a href="#templates-lookup" class="cjt-tb-link cjt-tb-text-link cjttbl-templates-lookup" title="">
112
+ <?php echo cssJSToolbox::getText('Embed / Link Templates') ?>
113
+ </a>
114
+ <?php do_action(CJTPluggableHelper::ACTION_BLOCK_INSIDE_TOOLBOX_TEMPLATES_MENU, $this) ?>
115
+ <a href="#templates-manager" class="cjt-tb-link cjt-tb-text-link cjttbl-templates-manager" title="">
116
+ <?php echo cssJSToolbox::getText('Templates Manager') ?>
117
+ </a>
118
+ <?php // FILTER MAY BE ?>
119
+ </div>
120
+
121
+ </div>
122
+
123
+ <span class="block-code-files">
124
+ <span class="infobar-item-title"><?php echo cssJSToolbox::getText('Files:') ?> </span>
125
+ <a href="#code-files" class="cjt-tb-link cjt-tb-text-link cjttbl-code-files"><?php echo CJTBlocksModel::getCodeFilesCount($this->block->id) ?></a>
126
+ </span>
127
+
128
+ <?php do_action(CJTPluggableHelper::ACTION_BLOCK_INFO_BAR_TOP_END, $this) ?>
129
+
130
+ </div>
131
+
132
+ </div>
133
+
134
  </div>
views/blocks/block/view.php CHANGED
@@ -10,48 +10,55 @@ defined('ABSPATH') or die("Access denied");
10
  * Blocks view
11
  */
12
  class CJTBlocksBlockView extends CJTView {
13
-
14
  /** */
15
  const META_BOX_PREFIX = 'cjtoolbox';
16
-
17
  /**
18
  * put your comment there...
19
- *
20
  * @var mixed
21
  */
22
  public $block = null;
23
-
24
  /**
25
  * put your comment there...
26
- *
27
  * @var mixed
28
  */
29
  public $isClosed;
30
-
31
  /**
32
  * put your comment there...
33
- *
34
  * @var mixed
35
  */
36
  protected $localization;
37
-
 
 
 
 
 
 
 
38
  /**
39
  * put your comment there...
40
- *
41
  * @var mixed
42
  */
43
  protected $params = array();
44
-
45
  /**
46
  * put your comment there...
47
- *
48
  * @var mixed
49
  */
50
  public $templateName = 'edit';
51
-
52
  /**
53
  * put your comment there...
54
- *
55
  */
56
  public function __construct($viewInfo) {
57
  parent::__construct($viewInfo);
@@ -63,27 +70,27 @@ class CJTBlocksBlockView extends CJTView {
63
  // Load localization text.
64
  $this->localization = require($this->getPath('public/js/jquery.block/jquery.block.localization.php'));
65
  }
66
-
67
  /**
68
  * put your comment there...
69
- *
70
  */
71
  public function display($template = null) {
72
  // Import template.
73
  echo $this->getTemplate($template ? $template : $this->templateName);
74
  }
75
-
76
  /**
77
  * put your comment there...
78
- *
79
  */
80
  public static function enqueueScripts() {
81
  // Use related scripts.
82
  self::useScripts(__CLASS__,
83
  'jquery',
84
- 'common',
85
- 'wp-lists',
86
- 'postbox',
87
  'thickbox',
88
  'framework:js:hash:{CJT-}md5',
89
  'framework:js:cookies:{CJT-}jquery.cookies.2.2.0',
@@ -99,13 +106,13 @@ class CJTBlocksBlockView extends CJTView {
99
  'views:blocks:block:public:js:{CJT-}codefile',
100
  'views:blocks:block:public:js:{CJT-}block',
101
  'views:blocks:block:public:js:plugins:{CJT-}_dockmodule',
102
- 'views:blocks:block:public:js:{CJT-}jquery.block'
103
  );
104
  }
105
-
106
  /**
107
  * put your comment there...
108
- *
109
  */
110
  public static function enqueueStyles() {
111
  // Initialize style.
@@ -122,45 +129,78 @@ class CJTBlocksBlockView extends CJTView {
122
  // Include styles.
123
  self::useStyles(__CLASS__, $styles);
124
  }
125
-
 
 
 
 
 
 
 
 
 
 
126
  /**
127
  * put your comment there...
128
- *
129
  */
130
  public function getBlock() {
131
- return $this->block;
132
  }
133
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  /**
135
  * put your comment there...
136
- *
137
  */
138
  public function getMetaboxName() {
139
  $tip = cssJSToolbox::getText('Click to update Block name');
140
- return "<span class='block-name' title='{$tip}'>{$this->block->name}</span>";
141
  }
142
-
143
  /**
144
  * put your comment there...
145
- *
146
  * @param mixed $id
147
  */
148
  public function getMetaboxId() {
149
  return self::META_BOX_PREFIX ."-{$this->block->id}";
150
  }
151
-
152
  /**
153
  * put your comment there...
154
- *
155
  * @param mixed $name
156
  */
157
  public function getOption($name) {
158
  return $this->params->{$name};
159
  }
160
-
161
  /**
162
- *
163
- *
164
  */
165
  public function setBlock($block) {
166
  // Set block.
@@ -170,10 +210,10 @@ class CJTBlocksBlockView extends CJTView {
170
  $closedMetaboxes = get_user_meta(get_current_user_id(), 'closedpostboxes_cjtoolbox', true);
171
  $this->isClosed = in_array($closedBlockId, ((array) $closedMetaboxes));
172
  }
173
-
174
  /**
175
  * put your comment there...
176
- *
177
  * @param mixed $name
178
  * @param mixed $value
179
  */
@@ -182,7 +222,7 @@ class CJTBlocksBlockView extends CJTView {
182
  // Chains!
183
  return $this;
184
  }
185
-
186
  } // End class.
187
 
188
  // Hookable!
10
  * Blocks view
11
  */
12
  class CJTBlocksBlockView extends CJTView {
13
+
14
  /** */
15
  const META_BOX_PREFIX = 'cjtoolbox';
16
+
17
  /**
18
  * put your comment there...
19
+ *
20
  * @var mixed
21
  */
22
  public $block = null;
23
+
24
  /**
25
  * put your comment there...
26
+ *
27
  * @var mixed
28
  */
29
  public $isClosed;
30
+
31
  /**
32
  * put your comment there...
33
+ *
34
  * @var mixed
35
  */
36
  protected $localization;
37
+
38
+ /**
39
+ * put your comment there...
40
+ *
41
+ * @var mixed
42
+ */
43
+ protected $ontoolbox = array('parameters' => array('block'));
44
+
45
  /**
46
  * put your comment there...
47
+ *
48
  * @var mixed
49
  */
50
  protected $params = array();
51
+
52
  /**
53
  * put your comment there...
54
+ *
55
  * @var mixed
56
  */
57
  public $templateName = 'edit';
58
+
59
  /**
60
  * put your comment there...
61
+ *
62
  */
63
  public function __construct($viewInfo) {
64
  parent::__construct($viewInfo);
70
  // Load localization text.
71
  $this->localization = require($this->getPath('public/js/jquery.block/jquery.block.localization.php'));
72
  }
73
+
74
  /**
75
  * put your comment there...
76
+ *
77
  */
78
  public function display($template = null) {
79
  // Import template.
80
  echo $this->getTemplate($template ? $template : $this->templateName);
81
  }
82
+
83
  /**
84
  * put your comment there...
85
+ *
86
  */
87
  public static function enqueueScripts() {
88
  // Use related scripts.
89
  self::useScripts(__CLASS__,
90
  'jquery',
91
+ 'common',
92
+ 'wp-lists',
93
+ 'postbox',
94
  'thickbox',
95
  'framework:js:hash:{CJT-}md5',
96
  'framework:js:cookies:{CJT-}jquery.cookies.2.2.0',
106
  'views:blocks:block:public:js:{CJT-}codefile',
107
  'views:blocks:block:public:js:{CJT-}block',
108
  'views:blocks:block:public:js:plugins:{CJT-}_dockmodule',
109
+ 'views:blocks:block:public:js:{CJT-}jquery.block'
110
  );
111
  }
112
+
113
  /**
114
  * put your comment there...
115
+ *
116
  */
117
  public static function enqueueStyles() {
118
  // Initialize style.
129
  // Include styles.
130
  self::useStyles(__CLASS__, $styles);
131
  }
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
+
143
  /**
144
  * put your comment there...
145
+ *
146
  */
147
  public function getBlock() {
148
+ return $this->block;
149
  }
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
+
174
  /**
175
  * put your comment there...
176
+ *
177
  */
178
  public function getMetaboxName() {
179
  $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' />";
181
  }
182
+
183
  /**
184
  * put your comment there...
185
+ *
186
  * @param mixed $id
187
  */
188
  public function getMetaboxId() {
189
  return self::META_BOX_PREFIX ."-{$this->block->id}";
190
  }
191
+
192
  /**
193
  * put your comment there...
194
+ *
195
  * @param mixed $name
196
  */
197
  public function getOption($name) {
198
  return $this->params->{$name};
199
  }
200
+
201
  /**
202
+ *
203
+ *
204
  */
205
  public function setBlock($block) {
206
  // Set block.
210
  $closedMetaboxes = get_user_meta(get_current_user_id(), 'closedpostboxes_cjtoolbox', true);
211
  $this->isClosed = in_array($closedBlockId, ((array) $closedMetaboxes));
212
  }
213
+
214
  /**
215
  * put your comment there...
216
+ *
217
  * @param mixed $name
218
  * @param mixed $value
219
  */
222
  // Chains!
223
  return $this;
224
  }
225
+
226
  } // End class.
227
 
228
  // Hookable!
views/blocks/cjt-block/public/css/block.css CHANGED
@@ -1,9 +1,10 @@
1
  .postbox .inside { margin-right: 6px !important; }
 
2
  /** reserve Objects Panel space */
3
  .cjcodeblock {margin-right:310px;}
4
 
5
  /* Pages Panel */
6
- .cjpageblock {width: 315px; height: 100%; position: absolute; right: 3px;}
7
 
8
  .cjpageblock .ui-tabs-panel {color: #7c7c7c !important;}
9
 
@@ -141,7 +142,7 @@ a.acc-header.ui-accordion-header-active {color: #652200 !important;}
141
  }
142
  .advanced-accordion a.acc-header {padding: 7px 4px; background: none !important; border: none !important}
143
 
144
- .advanced-accordion a.acc-header {color: #005DA4 !important;}
145
 
146
  .advanced-accordion a.acc-header:hover {color: #628ead !important;}
147
 
1
  .postbox .inside { margin-right: 6px !important; }
2
+
3
  /** reserve Objects Panel space */
4
  .cjcodeblock {margin-right:310px;}
5
 
6
  /* Pages Panel */
7
+ .cjpageblock {width: 315px;}
8
 
9
  .cjpageblock .ui-tabs-panel {color: #7c7c7c !important;}
10
 
142
  }
143
  .advanced-accordion a.acc-header {padding: 7px 4px; background: none !important; border: none !important}
144
 
145
+ .postbox.cjt-block .advanced-accordion a.acc-header {color: #005DA4 !important;}
146
 
147
  .advanced-accordion a.acc-header:hover {color: #628ead !important;}
148
 
views/blocks/cjt-block/public/js/jquery.assignpanel/jquery.assignpanel.js CHANGED
@@ -220,6 +220,12 @@
220
  map[groupName][objectId] = item;
221
  }
222
  }
 
 
 
 
 
 
223
  };
224
 
225
  /**
@@ -234,14 +240,35 @@
234
  var overlay = $(event.target);
235
  var checkbox = overlay.parent().find('.select-childs');
236
  var state = checkbox.prop('checked') ? '' : 'checked';
 
 
237
  // Work only if select-child checkbox is interactive!
238
  if (checkbox.attr('disabled') != 'disabled') {
 
239
  // Revert checkbox state.
240
  checkbox.prop('checked', state);
241
- // Clone state to parent checkbox.
242
- checkbox.parent().find('label>input:checkbox').prop('checked', state).trigger('change');
243
- //Clone state to all child checkboxes
244
- checkbox.parent().find('.children input:checkbox').prop('checked', state).trigger('change');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  }
246
  // For link to behave inactive.
247
  return false;
220
  map[groupName][objectId] = item;
221
  }
222
  }
223
+
224
+ // Set Assignment Counter
225
+ var assignmentCounterElement = options.block.infoBar.find('.block-assignment-count a');
226
+ var assignmentCount = parseInt(assignmentCounterElement.text());
227
+
228
+ assignmentCounterElement.text(assignmentCount + (item.value ? 1 : -1));
229
  };
230
 
231
  /**
240
  var overlay = $(event.target);
241
  var checkbox = overlay.parent().find('.select-childs');
242
  var state = checkbox.prop('checked') ? '' : 'checked';
243
+ var boolState = state == 'checked' ? true : false;
244
+
245
  // Work only if select-child checkbox is interactive!
246
  if (checkbox.attr('disabled') != 'disabled') {
247
+
248
  // Revert checkbox state.
249
  checkbox.prop('checked', state);
250
+
251
+ /**
252
+ * Clone state to parent checkbox.
253
+ * Clone state to all child checkboxes
254
+ */
255
+ var checkboxes = $.merge( checkbox.parent().find('>label>input:checkbox').get(),
256
+ checkbox.parent().find('.children input:checkbox').get());
257
+
258
+ $(checkboxes).each(
259
+
260
+ function() {
261
+
262
+ let panelCheckbox = $(this);
263
+
264
+ if (panelCheckbox.prop('checked') != boolState) {
265
+
266
+ panelCheckbox.prop('checked', state).trigger('change');
267
+ }
268
+
269
+ }
270
+ );
271
+
272
  }
273
  // For link to behave inactive.
274
  return false;
views/blocks/cjt-block/tmpl/assign-panel.html.tmpl ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ $assignPanelBlock = $block->getOption('assignPanelBlock');
7
+
8
+ if ($block->getOption('isLoading') || !$block->isClosed) {
9
+
10
+ // Get assignment panel template
11
+ echo $assignPanelBlock->structuredContent['assignPanel'] = $assignPanelBlock->getTemplate(
12
+ 'default',
13
+ array(
14
+ 'block' => $block->getBlock()
15
+ ),
16
+ 'tmpl/templates/assign-panel'
17
+ );
18
+ }
views/blocks/cjt-block/tmpl/default.html.tmpl CHANGED
@@ -8,11 +8,16 @@ defined('ABSPATH') or die('Restricted Access');
8
 
9
  // Block viee object.
10
  $blockView = $this->getBlockView();
 
11
 
12
- if ($this->isLoading || !$blockView->isClosed) {
13
- // Get assignment panel template
14
- echo $this->structuredContent['assignPanel'] = $this->getTemplate('default', array('block' => $blockView->getBlock()), 'tmpl/templates/assign-panel');
15
- }
 
 
 
 
16
 
17
  // Put the Objects Panel at the begning of the block content.
18
- echo $this->structuredContent['content'] = $blockView->getTemplate($this->isLoading ? 'content' : $blockView->templateName);
8
 
9
  // Block viee object.
10
  $blockView = $this->getBlockView();
11
+ $assignPanelBlock = $blockView->getOption('assignPanelBlock');
12
 
13
+ add_action(CJTPluggableHelper::ACTION_BLOCK_ASSIGN_PANEL . '-' . $blockView->block->id,
14
+
15
+ function($block) {
16
+
17
+ echo $block->getOption('assignPanelBlock')->getTemplate('assign-panel', array('block' => $block));
18
+ }
19
+
20
+ );
21
 
22
  // Put the Objects Panel at the begning of the block content.
23
+ echo $this->structuredContent['content'] = $blockView->getTemplate($this->isLoading ? 'content' : $blockView->templateName);
views/blocks/cjt-block/tmpl/new.html.tmpl CHANGED
@@ -10,11 +10,48 @@ defined('ABSPATH') or die('Restricted Access');
10
  $blockView = $this->getBlockView();
11
  ?>
12
  <div id="cjtoolbox-<?php echo $blockView->block->id; ?>" class="postbox">
13
- <div class="handlediv" title="Click to toggle"><br /></div>
14
- <h3 class='hndle'>
15
- <span><span class="block-name"><?php echo $blockView->block->name ?></span></span>
16
- </h3>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  <div class="inside">
 
18
  <?php echo $this->getTemplate('default') ?>
 
19
  </div>
20
  </div>
10
  $blockView = $this->getBlockView();
11
  ?>
12
  <div id="cjtoolbox-<?php echo $blockView->block->id; ?>" class="postbox">
13
+
14
+ <div class="postbox-header">
15
+
16
+ <h2 class="hndle">
17
+
18
+ <input name='cjtoolbox[<?php echo $blockView->block->id ?>][name]'
19
+ type='text'
20
+ class='block-name'
21
+ value='<?php echo $blockView->block->name ?>'
22
+ title='<?php echo cssJSToolbox::getText('Click to update Block name') ?>'
23
+ maxlength='50' />
24
+
25
+ </h2>
26
+
27
+ <div class="handle-actions hide-if-no-js">
28
+
29
+ <button type="button" class="handle-order-higher hidden" aria-disabled="false" aria-describedby="cjtoolbox-<?php echo $blockView->block->id ?>-handle-order-higher-description">
30
+ <span class="screen-reader-text"> <?php _e('Move up') ?></span>
31
+ <span class="order-higher-indicator" aria-hidden="true"></span>
32
+ </button>
33
+
34
+ <span class="hidden" id="cjtoolbox-<?php echo $blockView->block->id ?>-handle-order-higher-description"><?php _e('Move box up') ?></span>
35
+
36
+ <button type="button" class="handle-order-lower hidden" aria-disabled="false" aria-describedby="cjtoolbox-<?php echo $blockView->block->id ?>-handle-order-lower-description">
37
+ <span class="screen-reader-text"><?php _e('Move down') ?></span>
38
+ <span class="order-lower-indicator" aria-hidden="true"></span>
39
+ </button>
40
+
41
+ <span class="hidden" id="cjtoolbox-<?php echo $blockView->block->id ?>-handle-order-lower-description"><?php _e('Move box down') ?></span>
42
+
43
+ <button type="button" class="handlediv" aria-expanded="true">
44
+ <span class="screen-reader-text"><?php _e('Toggle panel') ?>: </span>
45
+ <span class="toggle-indicator" aria-hidden="true"></span>
46
+ </button>
47
+
48
+ </div>
49
+
50
+ </div>
51
+
52
  <div class="inside">
53
+
54
  <?php echo $this->getTemplate('default') ?>
55
+
56
  </div>
57
  </div>
views/blocks/cjt-block/tmpl/templates/assign-panel/default.html.tmpl CHANGED
@@ -43,9 +43,10 @@ $tabs = array(
43
  );
44
 
45
  $tabs[ 'tabs' ] = apply_filters( CJTPluggableHelper::FILTER_BLOCK_ASSIGN_PANEL_TABS, $tabs[ 'tabs' ] );
46
-
47
  ?>
48
- <div class="cjpageblock">
 
 
49
  <?php
50
  // Render assigment panel root tab. All nested tabs will be rendered
51
  // internally by the tab template.
@@ -55,4 +56,5 @@ $tabs[ 'tabs' ] = apply_filters( CJTPluggableHelper::FILTER_BLOCK_ASSIGN_PANEL_T
55
  );
56
  ?>
57
  <div style="clear:both;"></div>
58
- </div>
 
43
  );
44
 
45
  $tabs[ 'tabs' ] = apply_filters( CJTPluggableHelper::FILTER_BLOCK_ASSIGN_PANEL_TABS, $tabs[ 'tabs' ] );
 
46
  ?>
47
+
48
+ <div class="cjt-panel-item cjt-panel-window-assignments">
49
+
50
  <?php
51
  // Render assigment panel root tab. All nested tabs will be rendered
52
  // internally by the tab template.
56
  );
57
  ?>
58
  <div style="clear:both;"></div>
59
+
60
+ </div>
views/blocks/cjt-block/view.php CHANGED
@@ -46,16 +46,25 @@ class CJTBlocksCjtBlockView extends CJTView {
46
  * @return CJTBlocksCjtBlock
47
  */
48
  public function __construct($viewInfo) {
 
49
  parent::__construct($viewInfo);
 
50
  // Aggregate block view object!
51
  $this->blockView = self::create('blocks/block');
 
52
  // Register actions.
53
  add_action('admin_print_scripts', array(__CLASS__, 'enqueueScripts'));
54
  add_action('admin_print_styles', array(__CLASS__, 'enqueueStyles'));
 
55
  // Read input params.
56
  $this->isLoading = isset($_REQUEST['isLoading']) ? true : false;
 
 
 
 
 
57
  }
58
-
59
  /**
60
  * put your comment there...
61
  *
46
  * @return CJTBlocksCjtBlock
47
  */
48
  public function __construct($viewInfo) {
49
+
50
  parent::__construct($viewInfo);
51
+
52
  // Aggregate block view object!
53
  $this->blockView = self::create('blocks/block');
54
+
55
  // Register actions.
56
  add_action('admin_print_scripts', array(__CLASS__, 'enqueueScripts'));
57
  add_action('admin_print_styles', array(__CLASS__, 'enqueueStyles'));
58
+
59
  // Read input params.
60
  $this->isLoading = isset($_REQUEST['isLoading']) ? true : false;
61
+
62
+ // Inject Assignment Panel into THE BLOCK VIEW
63
+ $this->blockView->setOption('isLoading', $this->isLoading)
64
+ ->setOption('assignPanelBlock', $this);
65
+
66
  }
67
+
68
  /**
69
  * put your comment there...
70
  *
views/blocks/create-metabox/public/js/metabox/metabox.js CHANGED
@@ -71,18 +71,29 @@ var CJTBlocksPage;
71
  // Load Javascript files required for metabox-block to work.
72
  // After all metabox scripts are loaded display the view.
73
  (new ScriptsLoader(blockView.references.scripts)).loadAll().done($.proxy(
 
74
  function() {
 
75
  // Make the new poxtbox toggle-able!
76
  // Dont apply toggler twice for the extsis metaboxes.
77
  var metaboxes = $('#normal-sortables .postbox').removeClass('postbox');
 
 
 
 
 
78
  // Replace post metabox with the recevied metabox content.
79
- metabox.replaceWith(blockView.view);
 
80
  // Apply toggler on the new metabox.
81
  postboxes.add_postbox_toggles(pagenow);
 
82
  // Reset things back so the other metaboxes has the correct CSS class.
83
  metaboxes.addClass('postbox');
 
84
  // Reset tb_position to the one created by media-handler script.
85
  window.tb_position = mediaHandlerTBPosition;
 
86
  }, this)
87
  );
88
  }, this)
71
  // Load Javascript files required for metabox-block to work.
72
  // After all metabox scripts are loaded display the view.
73
  (new ScriptsLoader(blockView.references.scripts)).loadAll().done($.proxy(
74
+
75
  function() {
76
+
77
  // Make the new poxtbox toggle-able!
78
  // Dont apply toggler twice for the extsis metaboxes.
79
  var metaboxes = $('#normal-sortables .postbox').removeClass('postbox');
80
+
81
+ // Mark all CJT elements that comes along with Metabox Block View
82
+ blockView.view = $('<div>' + blockView.view + '</div>');
83
+ blockView.view.children().addClass('cjttoolbox-metabox-block-view-element');
84
+
85
  // Replace post metabox with the recevied metabox content.
86
+ metabox.replaceWith(blockView.view.children());
87
+
88
  // Apply toggler on the new metabox.
89
  postboxes.add_postbox_toggles(pagenow);
90
+
91
  // Reset things back so the other metaboxes has the correct CSS class.
92
  metaboxes.addClass('postbox');
93
+
94
  // Reset tb_position to the one created by media-handler script.
95
  window.tb_position = mediaHandlerTBPosition;
96
+
97
  }, this)
98
  );
99
  }, this)
views/blocks/create-metabox/tmpl/create.html.tmpl CHANGED
@@ -9,10 +9,36 @@ defined('ABSPATH') or die("Access denied");
9
  // Display as metabox without using Wordpress Metabox APIs.
10
  if ($this->getOption('customizeMetabox')) : ?>
11
  <div id="cjtoolbox-<?php echo $this->block->id; ?>" class="postbox">
12
- <div class="handlediv" title="Click to toggle"><br /></div>
13
- <h3 class='hndle'>
14
- <span><span class="block-name"><?php echo $this->block->name ?></span></span>
15
- </h3>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  <div class="inside">
17
  <?php endif; ?>
18
  <input type="hidden" name="blocks[]" value="<?php echo $this->getBlock()->id ?>" />
9
  // Display as metabox without using Wordpress Metabox APIs.
10
  if ($this->getOption('customizeMetabox')) : ?>
11
  <div id="cjtoolbox-<?php echo $this->block->id; ?>" class="postbox">
12
+
13
+ <div class="postbox-header">
14
+
15
+ <h2 class="hndle"><?php echo $this->block->name ?></h2>
16
+
17
+ <div class="handle-actions hide-if-no-js">
18
+
19
+ <button type="button" class="handle-order-higher hidden" aria-disabled="false" aria-describedby="cjtoolbox-<?php echo $blockView->block->id ?>-handle-order-higher-description">
20
+ <span class="screen-reader-text"> <?php _e('Move up') ?></span>
21
+ <span class="order-higher-indicator" aria-hidden="true"></span>
22
+ </button>
23
+
24
+ <span class="hidden" id="cjtoolbox-<?php echo $this->block->id ?>-handle-order-higher-description"><?php _e('Move box up') ?></span>
25
+
26
+ <button type="button" class="handle-order-lower hidden" aria-disabled="false" aria-describedby="cjtoolbox-<?php echo $this->block->id ?>-handle-order-lower-description">
27
+ <span class="screen-reader-text"><?php _e('Move down') ?></span>
28
+ <span class="order-lower-indicator" aria-hidden="true"></span>
29
+ </button>
30
+
31
+ <span class="hidden" id="cjtoolbox-<?php echo $this->block->id ?>-handle-order-lower-description"><?php _e('Move box down') ?></span>
32
+
33
+ <button type="button" class="handlediv" aria-expanded="true">
34
+ <span class="screen-reader-text"><?php _e('Toggle panel') ?>: </span>
35
+ <span class="toggle-indicator" aria-hidden="true"></span>
36
+ </button>
37
+
38
+ </div>
39
+
40
+ </div>
41
+
42
  <div class="inside">
43
  <?php endif; ?>
44
  <input type="hidden" name="blocks[]" value="<?php echo $this->getBlock()->id ?>" />
views/blocks/info/tmpl/default.html.tmpl CHANGED
@@ -21,17 +21,47 @@ $inLinks = !empty($block->links) ? explode("\n", $block->links) : [];
21
  $inExps = !empty($block->expressions) ? explode("\n", $block->expressions) : [];
22
  $allAssignment = array_merge( $inPages, $inPosts, $inCats, $inTags, $inLinks, $inExps );
23
 
 
 
 
 
24
  ?>
25
  <div class="block-info">
 
 
 
26
  <ul>
 
27
  <?php do_action( CJTPluggableHelper::ACTION_BLOCK_SCREEN_INFO_TOP, $this->info ); ?>
 
28
  <li><span style="font-weight:bold"><?php echo cssJSToolbox::getText('Shortcode') ?>: </span><span class="cjt-block-shortcode-text"><input type="text" readonly="readonly" value="<?php echo $this->info->shortcode; ?>"></span>
29
- <a class="copyshortcode" href="#">Copy Shortcode</a>
 
 
30
  </li>
 
31
  </ul>
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  <?php if (!empty($inPages)) : ?>
34
- <h3>- Assigned Pages</h3>
35
  <ul class="assignment-list">
36
  <?php foreach ($inPages as $pageID) : ?>
37
  <li><?php echo get_the_title($pageID); ?></li>
@@ -40,7 +70,7 @@ $allAssignment = array_merge( $inPages, $inPosts, $inCats, $inTags, $inLinks, $i
40
  <?php endif;
41
 
42
  if (!empty($inPosts)) : ?>
43
- <h3>- Assigned Posts</h3>
44
  <ul class="assignment-list">
45
  <?php foreach ($inPosts as $postID) : ?>
46
  <li><?php echo get_the_title($postID); ?></li>
@@ -49,7 +79,7 @@ $allAssignment = array_merge( $inPages, $inPosts, $inCats, $inTags, $inLinks, $i
49
  <?php endif;
50
 
51
  if (!empty($inCats)) : ?>
52
- <h3>- Assigned Categories</h3>
53
  <ul class="assignment-list">
54
  <?php foreach ($inCats as $catID) : ?>
55
  <li><?php echo get_cat_name($catID); ?></li>
@@ -58,7 +88,7 @@ $allAssignment = array_merge( $inPages, $inPosts, $inCats, $inTags, $inLinks, $i
58
  <?php endif;
59
 
60
  if (!empty($inTags)) : ?>
61
- <h3>- Assigned Tags</h3>
62
  <ul class="assignment-list">
63
  <?php foreach ($inTags as $tagID) :
64
  $theTag = get_tag($tagID); ?>
@@ -68,7 +98,7 @@ $allAssignment = array_merge( $inPages, $inPosts, $inCats, $inTags, $inLinks, $i
68
  <?php endif;
69
 
70
  if (!empty($inAux)) : ?>
71
- <h3>- Assigned Auxiliaries</h3>
72
  <ul class="assignment-list">
73
  <?php foreach ($inAux as $auxItem) : ?>
74
  <li><?php echo $auxItem; ?></li>
@@ -77,7 +107,7 @@ $allAssignment = array_merge( $inPages, $inPosts, $inCats, $inTags, $inLinks, $i
77
  <?php endif;
78
 
79
  if (!empty($inLinks)) : ?>
80
- <h3>- Assigned URLs</h3>
81
  <ul class="assignment-list">
82
  <?php foreach ($inLinks as $link) : ?>
83
  <li><?php echo $link; ?></li>
@@ -86,7 +116,7 @@ $allAssignment = array_merge( $inPages, $inPosts, $inCats, $inTags, $inLinks, $i
86
  <?php endif;
87
 
88
  if (!empty($inExps)) : ?>
89
- <h3>- Assigned Expressions</h3>
90
  <ul class="assignment-list">
91
  <?php foreach ($inExps as $exp) : ?>
92
  <li><?php echo $exp; ?></li>
@@ -99,17 +129,6 @@ $allAssignment = array_merge( $inPages, $inPosts, $inCats, $inTags, $inLinks, $i
99
  endif;
100
 
101
  ?>
102
- </div>
103
-
104
- <script>
105
-
106
- jQuery('a.copyshortcode').click(function() {
107
- var shortcodeEle = jQuery('.cjt-block-shortcode-text input:text')
108
-
109
- shortcodeEle.focus()
110
- shortcodeEle.select()
111
- document.execCommand('copy')
112
-
113
- return false
114
- })
115
- </script>
21
  $inExps = !empty($block->expressions) ? explode("\n", $block->expressions) : [];
22
  $allAssignment = array_merge( $inPages, $inPosts, $inCats, $inTags, $inLinks, $inExps );
23
 
24
+
25
+ $displaySection = isset($_GET['show_section']) ?
26
+ $_GET['show_section'] :
27
+ 'info';
28
  ?>
29
  <div class="block-info">
30
+
31
+ <?php if ($displaySection == 'info') : ?>
32
+
33
  <ul>
34
+
35
  <?php do_action( CJTPluggableHelper::ACTION_BLOCK_SCREEN_INFO_TOP, $this->info ); ?>
36
+
37
  <li><span style="font-weight:bold"><?php echo cssJSToolbox::getText('Shortcode') ?>: </span><span class="cjt-block-shortcode-text"><input type="text" readonly="readonly" value="<?php echo $this->info->shortcode; ?>"></span>
38
+
39
+ <a class="copyshortcode" href="#">Copy Shortcode</a>
40
+
41
  </li>
42
+
43
  </ul>
44
 
45
+ <script type="text/javascript">
46
+
47
+ jQuery('a.copyshortcode').click(function() {
48
+ var shortcodeEle = jQuery('.cjt-block-shortcode-text input:text')
49
+
50
+ shortcodeEle.focus()
51
+ shortcodeEle.select()
52
+ document.execCommand('copy')
53
+
54
+ return false
55
+ });
56
+
57
+ </script>
58
+
59
+ <?php endif; ?>
60
+
61
+ <?php if ($displaySection == 'assignment') : ?>
62
+
63
  <?php if (!empty($inPages)) : ?>
64
+ <h4>Assigned Pages</h4>
65
  <ul class="assignment-list">
66
  <?php foreach ($inPages as $pageID) : ?>
67
  <li><?php echo get_the_title($pageID); ?></li>
70
  <?php endif;
71
 
72
  if (!empty($inPosts)) : ?>
73
+ <h4>Assigned Posts</h4>
74
  <ul class="assignment-list">
75
  <?php foreach ($inPosts as $postID) : ?>
76
  <li><?php echo get_the_title($postID); ?></li>
79
  <?php endif;
80
 
81
  if (!empty($inCats)) : ?>
82
+ <h4>Assigned Categories</h4>
83
  <ul class="assignment-list">
84
  <?php foreach ($inCats as $catID) : ?>
85
  <li><?php echo get_cat_name($catID); ?></li>
88
  <?php endif;
89
 
90
  if (!empty($inTags)) : ?>
91
+ <h4>Assigned Tags</h4>
92
  <ul class="assignment-list">
93
  <?php foreach ($inTags as $tagID) :
94
  $theTag = get_tag($tagID); ?>
98
  <?php endif;
99
 
100
  if (!empty($inAux)) : ?>
101
+ <h4>Assigned Auxiliaries</h4>
102
  <ul class="assignment-list">
103
  <?php foreach ($inAux as $auxItem) : ?>
104
  <li><?php echo $auxItem; ?></li>
107
  <?php endif;
108
 
109
  if (!empty($inLinks)) : ?>
110
+ <h4>Assigned URLs</h4>
111
  <ul class="assignment-list">
112
  <?php foreach ($inLinks as $link) : ?>
113
  <li><?php echo $link; ?></li>
116
  <?php endif;
117
 
118
  if (!empty($inExps)) : ?>
119
+ <h4>Assigned Expressions</h4>
120
  <ul class="assignment-list">
121
  <?php foreach ($inExps as $exp) : ?>
122
  <li><?php echo $exp; ?></li>
129
  endif;
130
 
131
  ?>
132
+ </div>
133
+
134
+ <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
views/blocks/manager/public/css/blocks.css CHANGED
@@ -6,12 +6,13 @@ body{min-width: 700px;}
6
  #cjt-banner-bar-right {right: 0; position: absolute;top: 2px;}
7
  #cjt-banner-bar-right .cjt-banner-link {margin-bottom: 6px; font-size: 14px}
8
  #cjt-banner-bar-center {
9
- position: absolute;
10
  top: 4px;
11
- left: 35%;
12
- border: 2px solid #005EA5;
13
- padding: 6px 8px 0 8px;
14
- background-color: #f2f9ff;
 
15
  }
16
  #cjt-banner-bar-center p strong {
17
  color: #005EA5;
6
  #cjt-banner-bar-right {right: 0; position: absolute;top: 2px;}
7
  #cjt-banner-bar-right .cjt-banner-link {margin-bottom: 6px; font-size: 14px}
8
  #cjt-banner-bar-center {
9
+ position: absolute;
10
  top: 4px;
11
+ left: 35%;
12
+ border: 2px solid #005EA5;
13
+ padding: 6px 8px 0 8px;
14
+ background-color: #f2f9ff;
15
+ padding: 6px 8px 0 8px;
16
  }
17
  #cjt-banner-bar-center p strong {
18
  color: #005EA5;
views/blocks/manager/public/images/css-js-toolbox-logo.png CHANGED
Binary file
views/blocks/manager/public/js/blocks-page/blocks-page.js CHANGED
@@ -459,9 +459,8 @@ var CJTBlocksPage;
459
  var blockPlg = block.CJTBlock;
460
  var blockId = blockPlg.block.get('id');
461
  CJTBlocksPage.deletedBlocks.push(blockId);
462
- // Notify Menu and Code Files Manager.
463
  // Only for Loaded Blocks.
464
- blockPlg.menu && blockPlg.menu.ondeleteblock();
465
  blockPlg.codeFile && blockPlg.codeFile.ondeleteblock();
466
  $(block).remove();
467
  // Notify save change.
459
  var blockPlg = block.CJTBlock;
460
  var blockId = blockPlg.block.get('id');
461
  CJTBlocksPage.deletedBlocks.push(blockId);
462
+ // Notify Code Files Manager.
463
  // Only for Loaded Blocks.
 
464
  blockPlg.codeFile && blockPlg.codeFile.ondeleteblock();
465
  $(block).remove();
466
  // Notify save change.
views/blocks/manager/public/js/blocks-page/blocks-page.localization.php CHANGED
@@ -13,7 +13,7 @@ return array(
13
  'addNewBlockDialogTitle' => cssJSToolbox::getText('Create New Code Block'),
14
  'settingsFormTitle' => cssJSToolbox::getText('General settings'),
15
  'manageBackupsDialogTitle' => cssJSToolbox::getText('Backups'),
16
- 'confirmRestoreBlocks' => cssJSToolbox::getText('Restoring blocks backup will result in losing all the current blocks.')."\n\n".cssJSToolbox::getText('Are you sure, you\'d like to continue?'),
17
  'unableToRestoreBackup' => cssJSToolbox::getText('Backup could not be restored'),
18
  'manageTemplatesFormTitle' => cssJSToolbox::getText('Templates Manager'),
19
  'confirmNotSavedChanges' => cssJSToolbox::getText('The changes you made will be lost if you navigate away from this page.'),
13
  'addNewBlockDialogTitle' => cssJSToolbox::getText('Create New Code Block'),
14
  'settingsFormTitle' => cssJSToolbox::getText('General settings'),
15
  'manageBackupsDialogTitle' => cssJSToolbox::getText('Backups'),
16
+ 'confirmRestoreBlocks' => cssJSToolbox::getText('Restoring blocks backup will result in losing all the current blocks.')."\n\n".cssJSToolbox::getText('Are you sure, you\'d like to continue?'),
17
  'unableToRestoreBackup' => cssJSToolbox::getText('Backup could not be restored'),
18
  'manageTemplatesFormTitle' => cssJSToolbox::getText('Templates Manager'),
19
  'confirmNotSavedChanges' => cssJSToolbox::getText('The changes you made will be lost if you navigate away from this page.'),
views/blocks/manager/tmpl/blocks.html.tmpl CHANGED
@@ -5,6 +5,9 @@
5
 
6
  // Diallow direct access.
7
  defined('ABSPATH') or die("Access denied");
 
 
 
8
  ?>
9
  <div id="cjtoolbox-admin" class="wrap">
10
  <?php
@@ -28,37 +31,17 @@ defined('ABSPATH') or die("Access denied");
28
  <span class="cjt-ver"><?php echo $versionText; ?></span>
29
  </h2>
30
 
31
- <?php if ( class_exists( 'CJTPlusPluginInterface' ) && version_compare( $CJTPlusVersion, $CJTVersion, '<' ) ) : ?>
32
- <div id="cjt-banner-bar-center">
33
- <p style="font-size:16px;font-weight:600"><strong>IMPORTANT UPDATE REQUIRED:</strong> CJT PLUS v10 is now available!</p>
34
- <p class="license-key-alt">Includes major fixes for WordPress 5.5, and many improvements to the code block editor.<br>
35
- The latest CJT PLUS v10 also includes a number of important security and performance fixes.<br>
36
- Please <a href="#">add your license</a> and update CJT PLUS or <a href="https://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/pricing/" target="_blank">click for license renewal</a>.</p>
37
- </div>
38
- <script>
39
- jQuery('.license-key-alt a').click(jQuery.proxy(function() {
40
- var _req = {
41
- view: 'setup/activation-form',
42
- component: {
43
- pluginBase: "css-javascript-toolbox-plus/css-javascript-toolbox-plus.php",
44
- title: "CJT PLUS"
45
- },
46
- TB_iframe: true,
47
- height: 380
48
- }
49
- var _url = CJTServer.getRequestURL('setup', 'activationFormView', _req);
50
 
51
- tb_show('CJT Extension License Activation Form', _url)
52
- }, this))
53
- </script>
54
- <?php elseif ( ! class_exists( 'CJTPlusPluginInterface' ) ) : ?>
55
  <div id="cjt-banner-bar-center">
56
- <p style="font-size:16px;font-weight:600"><strong>CJT PLUS v10:</strong> - Launch special - save 50%</p>
57
- <p>Do you need an all-round solution to add, manage, assign and run all your custom code?<br>
58
- CJT PLUS gives you more editor tools and locations to run your code than the free version.<br>
59
- 1000's of customers have relied on CJT PLUS for over 10 years.
60
- <a href="https://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/pricing/" target="_blank">Click to see if it can help you</a>.</p>
61
  </div>
 
62
  <?php endif; ?>
63
 
64
  <div id="cjt-banner-bar-right">
5
 
6
  // Diallow direct access.
7
  defined('ABSPATH') or die("Access denied");
8
+
9
+ $isCJTPLUSInstalled = file_exists(WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'css-javascript-toolbox-plus');
10
+
11
  ?>
12
  <div id="cjtoolbox-admin" class="wrap">
13
  <?php
31
  <span class="cjt-ver"><?php echo $versionText; ?></span>
32
  </h2>
33
 
34
+ <?php
35
+
36
+ if ( ! class_exists( 'CJTPlus' ) ) : ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
 
 
 
 
38
  <div id="cjt-banner-bar-center">
39
+ <p style="font-size:16px;font-weight:600"><strong>CJT PLUS v11:</strong> - Launch special - save 50%</p>
40
+ <p>CJT PLUS version 11 now has another 8 new Hooks for even more flexibility.<br>
41
+ Many icon buttons are now textual buttons, with counters to help you keep tab of the stats.<br>
42
+ Vertical editor toolbar has also had a revamp. <a href="https://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/welcome-to-cjt-plus-version-11/" target="_blank">Click to see a quick video of CJT PLUS v11</a>.</p>
 
43
  </div>
44
+
45
  <?php endif; ?>
46
 
47
  <div id="cjt-banner-bar-right">
views/blocks/metabox/public/css/metabox.css CHANGED
@@ -7,6 +7,11 @@
7
  .cjcodeblock {
8
  margin-right: 0px !important; /* Override block.css style */
9
  }
10
-
11
  /** Editor toolbox */
12
- .editor-toolbox a.cjttbl-preview {background-image: url(../images/editor-toolbox/preview.png);}
 
 
 
 
 
7
  .cjcodeblock {
8
  margin-right: 0px !important; /* Override block.css style */
9
  }
10
+ .cjpageblock {right: 13px; margin-top: 4px;}
11
  /** Editor toolbox */
12
+ .editor-toolbox a.cjttbl-preview {background-image: url(../images/editor-toolbox/preview.png);}
13
+
14
+
15
+ .postbox.cjt-block .postbox-header .hndle {
16
+ justify-content: initial !important;
17
+ }
views/blocks/metabox/public/js/jquery.block/jquery.block.js CHANGED
@@ -14,10 +14,49 @@
14
  * @param args
15
  */
16
  CJTBlockPlugin = function(node, args) {
 
17
  // Code has been removed to CJTe Editor Toolbox extension
18
  // .
19
  // .
20
  // .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  // Initialize base class.
22
  this.initCJTPluginBase(node, args);
23
 
@@ -25,4 +64,5 @@
25
 
26
  // Extend CJTBlockPlugin class.
27
  CJTBlockPlugin.prototype = new CJTBlockPluginBase();
 
28
  })(jQuery);
14
  * @param args
15
  */
16
  CJTBlockPlugin = function(node, args) {
17
+
18
  // Code has been removed to CJTe Editor Toolbox extension
19
  // .
20
  // .
21
  // .
22
+
23
+
24
+ this._onclosepanelwindow = function() {
25
+
26
+ var codeArea = this.block.box.find('.cjcontainer');
27
+ var panelArea = this.block.box.find('.cjpageblock');
28
+
29
+ codeArea.css('margin-right', '0px');
30
+ panelArea.css('width', '0px').hide();
31
+
32
+ return false;
33
+ };
34
+
35
+
36
+ /**
37
+ *
38
+ */
39
+ this._onPaneledItems = function(event) {
40
+
41
+ var link = $(event.target);
42
+ var windowName = link.prop('href').match(/#(.+)/)[1];
43
+ var panelWindow = this.block.box.find('.cjt-panel-item.cjt-panel-window-' + windowName);
44
+ var codeArea = this.block.box.find('.cjcontainer');
45
+ var panelArea = this.block.box.find('.cjpageblock');
46
+ var closeButton = panelArea.find('.close-panel-window');
47
+
48
+ closeButton.show();
49
+
50
+ // Hide all panel windows
51
+ panelArea.find('.cjt-panel-item').hide();
52
+
53
+ panelWindow.show();
54
+
55
+ codeArea.css('margin-right', '310px');
56
+ panelArea.css('width', '300px').show();
57
+
58
+ };
59
+
60
  // Initialize base class.
61
  this.initCJTPluginBase(node, args);
62
 
64
 
65
  // Extend CJTBlockPlugin class.
66
  CJTBlockPlugin.prototype = new CJTBlockPluginBase();
67
+
68
  })(jQuery);
views/blocks/metabox/public/js/metabox/metabox.js CHANGED
@@ -82,12 +82,42 @@ var CJTBlocksPage;
82
  return msg;
83
  },
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  /**
86
  * put your comment there...
87
  *
88
  */
89
- _onshowthickbox : function(event) {
 
90
  var mediaUploadTbPosition = window.tb_position;
 
91
  // Use our custom method for positioning the Thickbox.
92
  window.tb_position = function() {
93
  // Call Thickbox original tb_position!
@@ -95,8 +125,7 @@ var CJTBlocksPage;
95
  // Restore to media-upload tb_position.
96
  window.tb_position = mediaUploadTbPosition;
97
  };
98
- // Call target function.
99
- CJTBlocksPage.blocks.getBlocks().get(0).CJTBlock[this.event](event);
100
  },
101
 
102
  /**
@@ -117,9 +146,8 @@ var CJTBlocksPage;
117
  id : block.get(0).CJTBlock.block.get('id'),
118
  post : $('#post_ID').val()
119
  };
 
120
  // Disable block while deleting and show Ajax loading progress.
121
- this.metaboxBlockToolbox.buttons['delete'].loading(true);
122
- this.metaboxBlockToolbox.enable(false);
123
  block.get(0).CJTBlock.enable(false);
124
  // Delete block.
125
  this.server.send('metabox', 'delete', requestData)
@@ -139,11 +167,17 @@ var CJTBlocksPage;
139
  function() {
140
  // Localize loaded scripts
141
  (new CJTWPScriptLocalizer(createMetaboxView.references.scripts)).localize();
 
142
  // Make the new poxtbox toggle-able!
143
  // Dont apply toggler twice for the exiss metaboxes.
144
  var metaboxes = $('#normal-sortables .postbox').removeClass('postbox');
 
 
 
 
145
  // Replace post metabox with the recevied metabox content.
146
  metabox.replaceWith(createMetaboxView.view);
 
147
  // Apply toggler on the new metabox.
148
  postboxes.add_postbox_toggles(pagenow);
149
  // Reset things back so the other metaboxes has the correct CSS class.
@@ -192,15 +226,10 @@ var CJTBlocksPage;
192
  CJTBlockCodeFileView.initialize();
193
 
194
  $( document ).trigger( 'cjtmanagerpreloadblocks', [ this.blocksForm, this.blocks.getBlocks() ] );
195
-
196
  // Put CJT code block into actions!
197
  var blocks = this.blocks.getBlocks().CJTBlock({calculatePinPoint : 0});
198
 
199
- // Fix thickbox issue caused by media-upload.js script.
200
- this.metaboxBlockToolbox = blocks.get(0).CJTBlock.toolbox;
201
-
202
- this.metaboxBlockToolbox.buttons['info'].callback = $.proxy(this._onshowthickbox, {event : '_ongetinfo'});
203
-
204
  // Notify saving changes.
205
  this.wpAutoSave.timer = window.setInterval($.proxy(this.detectWordpressAutoSaveAlertEvent, this), 100);
206
 
82
  return msg;
83
  },
84
 
85
+ /**
86
+ * put your comment there...
87
+ *
88
+ */
89
+ _onmanagetemplates : function() {
90
+ var params = {width: '100%', height: '100%', TB_iframe : true};
91
+ var url = CJTBlocksPage.server.getRequestURL('templatesManager', 'display', params);
92
+ tb_show(CJTMetaboxI18N.manageTemplatesFormTitle, url);
93
+ // Get thickbox form element.
94
+ var thickboxForm = $('#TB_window');
95
+ // Style thickbox.
96
+ thickboxForm.css({
97
+ 'position' : 'fixed',
98
+ 'left' : '0px',
99
+ 'top' : '4px',
100
+ 'margin-left' : '5px',
101
+ 'margin-top': '0px',
102
+ 'width' : '99%',
103
+ 'height' : ((jQuery(window).height() - 40) + 'px'),
104
+ 'z-index' : 1000000
105
+ });
106
+ // Set Iframe style.
107
+ thickboxForm.find('iframe').css({
108
+ width : '100%',
109
+ height : '100%'
110
+ });
111
+ },
112
+
113
  /**
114
  * put your comment there...
115
  *
116
  */
117
+ _onshowthickbox : function() {
118
+
119
  var mediaUploadTbPosition = window.tb_position;
120
+
121
  // Use our custom method for positioning the Thickbox.
122
  window.tb_position = function() {
123
  // Call Thickbox original tb_position!
125
  // Restore to media-upload tb_position.
126
  window.tb_position = mediaUploadTbPosition;
127
  };
128
+
 
129
  },
130
 
131
  /**
146
  id : block.get(0).CJTBlock.block.get('id'),
147
  post : $('#post_ID').val()
148
  };
149
+
150
  // Disable block while deleting and show Ajax loading progress.
 
 
151
  block.get(0).CJTBlock.enable(false);
152
  // Delete block.
153
  this.server.send('metabox', 'delete', requestData)
167
  function() {
168
  // Localize loaded scripts
169
  (new CJTWPScriptLocalizer(createMetaboxView.references.scripts)).localize();
170
+
171
  // Make the new poxtbox toggle-able!
172
  // Dont apply toggler twice for the exiss metaboxes.
173
  var metaboxes = $('#normal-sortables .postbox').removeClass('postbox');
174
+
175
+ // Delete all cjt metabox block related elements that comes out along with the block view
176
+ metabox.parent().find('.cjttoolbox-metabox-block-view-element').not(metabox).remove();
177
+
178
  // Replace post metabox with the recevied metabox content.
179
  metabox.replaceWith(createMetaboxView.view);
180
+
181
  // Apply toggler on the new metabox.
182
  postboxes.add_postbox_toggles(pagenow);
183
  // Reset things back so the other metaboxes has the correct CSS class.
226
  CJTBlockCodeFileView.initialize();
227
 
228
  $( document ).trigger( 'cjtmanagerpreloadblocks', [ this.blocksForm, this.blocks.getBlocks() ] );
229
+
230
  // Put CJT code block into actions!
231
  var blocks = this.blocks.getBlocks().CJTBlock({calculatePinPoint : 0});
232
 
 
 
 
 
 
233
  // Notify saving changes.
234
  this.wpAutoSave.timer = window.setInterval($.proxy(this.detectWordpressAutoSaveAlertEvent, this), 100);
235
 
views/blocks/metabox/public/js/metabox/metabox.localization.php CHANGED
@@ -11,4 +11,5 @@
11
  */
12
  return array(
13
  'notifySaveChanges' => cssJSToolbox::getText('You\'ve changed CJT block content but you didn\' save this changes yet!')."\n".cssJSToolbox::getText('Would you really like to leave the page without saving this chnages'),
 
14
  );
11
  */
12
  return array(
13
  'notifySaveChanges' => cssJSToolbox::getText('You\'ve changed CJT block content but you didn\' save this changes yet!')."\n".cssJSToolbox::getText('Would you really like to leave the page without saving this chnages'),
14
+ 'manageTemplatesFormTitle' => cssJSToolbox::getText('Templates Manager'),
15
  );
views/blocks/metabox/tmpl/metabox.html.tmpl CHANGED
@@ -13,13 +13,42 @@ echo CJTBlocksMetaBoxView::trigger( 'CJTBlocksMetaBoxView.loadglobalcomponents',
13
  // Block Templates.
14
  require CJTOOLBOX_VIEWS_PATH . '/blocks/block/tmpl/codefile/codefile.html.tmpl';
15
 
 
 
16
  // Display as metabox without using Wordpress Metabox APIs.
17
  if ($this->getOption('customizeMetabox')) : ?>
18
- <div id="cjtoolbox-<?php echo $this->getBlock()->id; ?>" class="postbox">
19
- <div class="handlediv" title="Click to toggle"><br /></div>
20
- <h3 class='hndle'>
21
- <span><?php echo $this->getMetaboxName(); ?></span>
22
- </h3>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  <div class="inside">
24
  <?php endif; ?>
25
  <input type="hidden" id="cjt-securityToken" value="<?php echo $this->getSecurityToken() ?>" />
13
  // Block Templates.
14
  require CJTOOLBOX_VIEWS_PATH . '/blocks/block/tmpl/codefile/codefile.html.tmpl';
15
 
16
+ $block = $this->getBlock();
17
+
18
  // Display as metabox without using Wordpress Metabox APIs.
19
  if ($this->getOption('customizeMetabox')) : ?>
20
+ <div id="cjtoolbox-<?php echo $block->id; ?>" class="postbox">
21
+
22
+
23
+ <div class="postbox-header">
24
+
25
+ <h2 class="hndle"><?php echo $this->getMetaboxName(); ?></h2>
26
+
27
+ <div class="handle-actions hide-if-no-js">
28
+
29
+ <button type="button" class="handle-order-higher hidden" aria-disabled="false" aria-describedby="cjtoolbox-<?php echo $block->id ?>-handle-order-higher-description">
30
+ <span class="screen-reader-text"> <?php _e('Move up') ?></span>
31
+ <span class="order-higher-indicator" aria-hidden="true"></span>
32
+ </button>
33
+
34
+ <span class="hidden" id="cjtoolbox-<?php echo $block->id ?>-handle-order-higher-description"><?php _e('Move box up') ?></span>
35
+
36
+ <button type="button" class="handle-order-lower hidden" aria-disabled="false" aria-describedby="cjtoolbox-<?php echo $block->id ?>-handle-order-lower-description">
37
+ <span class="screen-reader-text"><?php _e('Move down') ?></span>
38
+ <span class="order-lower-indicator" aria-hidden="true"></span>
39
+ </button>
40
+
41
+ <span class="hidden" id="cjtoolbox-<?php echo $block->id ?>-handle-order-lower-description"><?php _e('Move box down') ?></span>
42
+
43
+ <button type="button" class="handlediv" aria-expanded="true">
44
+ <span class="screen-reader-text"><?php _e('Toggle panel') ?>: </span>
45
+ <span class="toggle-indicator" aria-hidden="true"></span>
46
+ </button>
47
+
48
+ </div>
49
+
50
+ </div>
51
+
52
  <div class="inside">
53
  <?php endif; ?>
54
  <input type="hidden" id="cjt-securityToken" value="<?php echo $this->getSecurityToken() ?>" />
views/blocks/new/public/js/add-new-block/add-new-block.js CHANGED
@@ -6,7 +6,7 @@
6
 
7
  /**
8
  * jQuery Wrapper for Add New Block module.
9
- *
10
  *
11
  */
12
  (function($) {
@@ -17,10 +17,10 @@
17
  * @var CJTBlocksPage
18
  */
19
  CJTBlocksPage = window.parent.CJTBlocksPage;
20
-
21
  /**
22
  * Server New Block view actions/events.
23
- *
24
  * The rule of the module is to validate and submitting
25
  * new block data to server, check the response and notify the user.
26
  *
@@ -28,37 +28,37 @@
28
  * @version 6
29
  */
30
  CJTNewBlock = {
31
-
32
  /**
33
  * put your comment there...
34
- *
35
  */
36
  errors : null,
37
-
38
  /**
39
  * New Block form element.
40
  *
41
  * @var jqObject
42
- */
43
  form : null,
44
-
45
  /**
46
  * Event handler for closing the form.
47
- *
48
  * return void
49
  */
50
  _oncancel : function() {
51
  window.parent.tb_remove();
52
  },
53
-
54
  /**
55
  * Event handler for saving/adding the new block
56
- *
57
  * Method doesn't validate form data, form validation
58
  * should be done before this event is triggered.
59
  *
60
  * Method submit the data to the server and notify user based
61
- * on the response.
62
  *
63
  * return void
64
  */
@@ -87,7 +87,7 @@
87
  // Enable new form.
88
  this.form.find('input, select').prop('disabled', false);
89
  }, this)
90
- );
91
  }, this)
92
  ).fail($.proxy(
93
  function() {
@@ -95,10 +95,10 @@
95
  }, this)
96
  );
97
  },
98
-
99
  /**
100
  * Initialize New Block object when the document is ready.
101
- *
102
  * return void
103
  */
104
  init : function() {
@@ -113,10 +113,10 @@
113
  }, this)
114
  );
115
  },
116
-
117
  /**
118
  * Is the form data is valid for submission!
119
- *
120
  * @returns boolean
121
  */
122
  isValid : function() {
@@ -153,10 +153,10 @@
153
  }
154
  return promising;
155
  }
156
-
157
  } // End class.
158
-
159
  // Bind when documet ready.
160
  $($.proxy(CJTNewBlock.init, CJTNewBlock));
161
-
162
  })(jQuery);
6
 
7
  /**
8
  * jQuery Wrapper for Add New Block module.
9
+ *
10
  *
11
  */
12
  (function($) {
17
  * @var CJTBlocksPage
18
  */
19
  CJTBlocksPage = window.parent.CJTBlocksPage;
20
+
21
  /**
22
  * Server New Block view actions/events.
23
+ *
24
  * The rule of the module is to validate and submitting
25
  * new block data to server, check the response and notify the user.
26
  *
28
  * @version 6
29
  */
30
  CJTNewBlock = {
31
+
32
  /**
33
  * put your comment there...
34
+ *
35
  */
36
  errors : null,
37
+
38
  /**
39
  * New Block form element.
40
  *
41
  * @var jqObject
42
+ */
43
  form : null,
44
+
45
  /**
46
  * Event handler for closing the form.
47
+ *
48
  * return void
49
  */
50
  _oncancel : function() {
51
  window.parent.tb_remove();
52
  },
53
+
54
  /**
55
  * Event handler for saving/adding the new block
56
+ *
57
  * Method doesn't validate form data, form validation
58
  * should be done before this event is triggered.
59
  *
60
  * Method submit the data to the server and notify user based
61
+ * on the response.
62
  *
63
  * return void
64
  */
87
  // Enable new form.
88
  this.form.find('input, select').prop('disabled', false);
89
  }, this)
90
+ );
91
  }, this)
92
  ).fail($.proxy(
93
  function() {
95
  }, this)
96
  );
97
  },
98
+
99
  /**
100
  * Initialize New Block object when the document is ready.
101
+ *
102
  * return void
103
  */
104
  init : function() {
113
  }, this)
114
  );
115
  },
116
+
117
  /**
118
  * Is the form data is valid for submission!
119
+ *
120
  * @returns boolean
121
  */
122
  isValid : function() {
153
  }
154
  return promising;
155
  }
156
+
157
  } // End class.
158
+
159
  // Bind when documet ready.
160
  $($.proxy(CJTNewBlock.init, CJTNewBlock));
161
+
162
  })(jQuery);
views/blocks/new/tmpl/default.html.tmpl CHANGED
@@ -10,6 +10,9 @@ defined('ABSPATH') or die("Access denied");
10
  CJTBlocksNewView::enququeScripts();
11
  CJTBlocksNewView::enququeStyles();
12
  $this->suppressPrintScriptsHook();
 
 
 
13
  ?>
14
  <html xmlns="http://www.w3.org/1999/xhtml">
15
  <head>
@@ -30,39 +33,51 @@ $this->suppressPrintScriptsHook();
30
  <input type="checkbox" id="cjt-new-block-state" name="state" value="active" checked="checked" />
31
  </li>
32
  <li>
 
33
  <label for="cjt-new-block-hook" title="<?php echo cssJSToolbox::getText('Set location hook for code block output to: Header or Footer') ?>"><?php echo cssJSToolbox::getText('Location Hook') ?></label>
 
34
  <select name="location" id="cjt-new-block-hook">
35
  <?php
36
- $locations = array(
37
- 'header' => cssJSToolbox::getText('Header'),
38
- 'footer' => cssJSToolbox::getText('Footer'),
39
- );
40
- foreach ($locations as $key => $displayName) :
41
  ?>
42
- <option value="<?php echo $key ?>"><?php echo $displayName ?></option>
 
43
  <?php
44
- endforeach;
 
 
45
  ?>
46
- </select>
 
47
  </li>
 
48
  <li>
 
49
  <label for="cjt-new-block-position" title="<?php echo cssJSToolbox::getText('Set initial code block position to: First Block or Last Block') ?>"><?php echo cssJSToolbox::getText('Initial Block Position') ?></label>
 
50
  <select name="position" id="cjt-new-block-position">
51
  <?php
52
  // Static locations.
53
  $positions = array(
54
- 'top' => cssJSToolbox::getText('First Block'),
55
- 'bottom' => cssJSToolbox::getText('Last Block'),
56
  );
 
57
  // Display locations list.
58
  foreach ($positions as $position => $displayName) :
59
  ?>
60
  <option value="<?php echo $position ?>"<?php if ($this->position == $position) : ?> selected="selected"<?php endif; ?>><?php echo $displayName ?></option>
61
  <?php
62
- endforeach;
63
  ?>
64
- </select>
 
65
  </li>
 
66
  <li class="last">
67
  <input class="cjt-button cancel" type="button" value="<?php echo cssJSToolbox::getText('Cancel') ?>" />
68
  <input class="cjt-button save" type="submit" name="submit" value="<?php echo cssJSToolbox::getText('Create') ?>" />
10
  CJTBlocksNewView::enququeScripts();
11
  CJTBlocksNewView::enququeStyles();
12
  $this->suppressPrintScriptsHook();
13
+
14
+ $hooksAttacher =& CJTBlocksCouplingController::theInstance()->getHooksAttacher();
15
+
16
  ?>
17
  <html xmlns="http://www.w3.org/1999/xhtml">
18
  <head>
33
  <input type="checkbox" id="cjt-new-block-state" name="state" value="active" checked="checked" />
34
  </li>
35
  <li>
36
+
37
  <label for="cjt-new-block-hook" title="<?php echo cssJSToolbox::getText('Set location hook for code block output to: Header or Footer') ?>"><?php echo cssJSToolbox::getText('Location Hook') ?></label>
38
+
39
  <select name="location" id="cjt-new-block-hook">
40
  <?php
41
+
42
+ foreach ($hooksAttacher->getFiltersList() as $hooks) :
43
+
44
+ foreach ($hooks as $hook) :
45
+
46
  ?>
47
+ <option value="<?php echo $hook['locationName'] ?>" title="<?php echo $hook['text'] ?>"><?php echo $hook['title'] ?></option>
48
+
49
  <?php
50
+ endforeach;
51
+
52
+ endforeach;
53
  ?>
54
+ </select>
55
+
56
  </li>
57
+
58
  <li>
59
+
60
  <label for="cjt-new-block-position" title="<?php echo cssJSToolbox::getText('Set initial code block position to: First Block or Last Block') ?>"><?php echo cssJSToolbox::getText('Initial Block Position') ?></label>
61
+
62
  <select name="position" id="cjt-new-block-position">
63
  <?php
64
  // Static locations.
65
  $positions = array(
66
+ 'top' => cssJSToolbox::getText('First Block'),
67
+ 'bottom' => cssJSToolbox::getText('Last Block'),
68
  );
69
+
70
  // Display locations list.
71
  foreach ($positions as $position => $displayName) :
72
  ?>
73
  <option value="<?php echo $position ?>"<?php if ($this->position == $position) : ?> selected="selected"<?php endif; ?>><?php echo $displayName ?></option>
74
  <?php
75
+ endforeach;
76
  ?>
77
+ </select>
78
+
79
  </li>
80
+
81
  <li class="last">
82
  <input class="cjt-button cancel" type="button" value="<?php echo cssJSToolbox::getText('Cancel') ?>" />
83
  <input class="cjt-button save" type="submit" name="submit" value="<?php echo cssJSToolbox::getText('Create') ?>" />
views/blocks/revisions/tmpl/default.html.tmpl CHANGED
@@ -15,6 +15,40 @@ $this->suppressPrintScriptsHook();
15
  <head>
16
  <?php wp_print_head_scripts() ?>
17
  <?php wp_print_styles() ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  </head>
19
  <body>
20
  <div id="cjtoolbox_popup">
15
  <head>
16
  <?php wp_print_head_scripts() ?>
17
  <?php wp_print_styles() ?>
18
+
19
+ <style type="text/css">
20
+
21
+ body {
22
+ margin: 0;
23
+ font-size: 13px;
24
+ color: #7c7c7c;
25
+ }
26
+
27
+ #cjtoolbox_popup a,
28
+ #cjtoolbox_popup span {
29
+ line-height: 1.4;
30
+ }
31
+
32
+ #cjtoolbox_popup span {
33
+ color: #9c9c9c;
34
+ }
35
+
36
+ a, a:visited {
37
+ color: #005DA4;
38
+ }
39
+
40
+ a:hover {
41
+ color: #628ead;
42
+ }
43
+
44
+ ul {
45
+ margin: 0;
46
+ padding: 0;
47
+ height: 96%;
48
+ }
49
+
50
+ </style>
51
+
52
  </head>
53
  <body>
54
  <div id="cjtoolbox_popup">
views/dashboard/metabox/statistics/tmpl/default.html.tmpl CHANGED
@@ -49,22 +49,18 @@
49
  <td><?php echo cssJSToolbox::getText('Code Templates') ?></td>
50
  <td><strong><?php echo $this->templates ?></strong></td>
51
  </tr>
52
- <tr>
53
- <td><?php echo cssJSToolbox::getText('Script Packages') ?></td>
54
- <td><strong><?php echo $this->scriptsPackage ?></strong></td>
55
- </tr>
56
  </tbody>
57
  </table>
58
  </div>
59
  <hr />
60
  <div id="cjt-statcs-metabox-info">
61
- <span class="cjt-support-us-link">
62
- <?php echo cssJSToolbox::getText('Upgrade to') ?>: <a target="_blank" href="https://css-javascript-toolbox.com/pricing/"><?php echo cssJSToolbox::getText('CJT Core and CJT PLUS') ?></a>
63
- </span>
64
- <span class="cjt-support-us-link">
65
- <?php echo cssJSToolbox::getText('Learn with') ?>: <a target="_blank" href="https://css-javascript-toolbox.com/documentation/"><?php echo cssJSToolbox::getText('CJT Online Help') ?></a>
66
- </span>
67
  <div class="cjt-stat-metabox-version">
68
- <span><?php echo cssJSToolbox::getText('Version') ?>:&nbsp;&nbsp;<?php echo CJTPlugin::VERSION; ?></span>
 
 
 
 
 
 
69
  </div>
70
  </div>
49
  <td><?php echo cssJSToolbox::getText('Code Templates') ?></td>
50
  <td><strong><?php echo $this->templates ?></strong></td>
51
  </tr>
 
 
 
 
52
  </tbody>
53
  </table>
54
  </div>
55
  <hr />
56
  <div id="cjt-statcs-metabox-info">
 
 
 
 
 
 
57
  <div class="cjt-stat-metabox-version">
58
+ <span><?php echo cssJSToolbox::getText('CJT Version') ?>:&nbsp;&nbsp;<?php echo CJTPlugin::VERSION; ?>
59
+ <?php if ( class_exists( 'CJTPlusPluginInterface' ) ) {
60
+ $reflector = new \ReflectionClass( 'CJTPlus' );
61
+ $CJTPlusVersion = get_plugin_data( str_replace( 'plus.class', 'plus', $reflector->getFileName() ) )['Version'];
62
+ echo ' / ' . cssJSToolbox::getText('CJT PLUS Version') ?>:&nbsp;&nbsp;<?php echo $CJTPlusVersion;
63
+ } ?>
64
+ </span>
65
  </div>
66
  </div>
views/installer/install/tmpl/upgrade.html.tmpl CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- *
4
  */
5
 
6
  // Disallow direct access.
@@ -11,8 +11,8 @@ defined('ABSPATH') or die("Access denied");
11
  <form name="installation-form" action="">
12
  <input type="hidden" id="cjt-securityToken" value="<?php echo $this->securityToken ?>" />
13
  <h1><?php echo cssJSToolbox::getText('Upgrading CJT Plugin') ?></h1>
14
- <p><?php echo cssJSToolbox::getText('Please wait while we upgrading CJT Plugin installation! This process would take only a few seconds!') ?></p>
15
- <p><?php echo cssJSToolbox::getText('Its highly recommended to Backup your database before processing upgrade.') ?></p>
16
  <?php echo $this->getTemplate('upgrade', array('noHeaderMessage' => true), 'tmpl/upgrades'); ?>
17
  <input type="button" name="install" value="<?php echo cssJSToolbox::getText('Upgrade') ?>" />
18
  <?php else : ?>
1
  <?php
2
  /**
3
+ *
4
  */
5
 
6
  // Disallow direct access.
11
  <form name="installation-form" action="">
12
  <input type="hidden" id="cjt-securityToken" value="<?php echo $this->securityToken ?>" />
13
  <h1><?php echo cssJSToolbox::getText('Upgrading CJT Plugin') ?></h1>
14
+ <p><?php echo cssJSToolbox::getText('Please wait while CJT is upgrading. This process will only take a couple of seconds.') ?></p>
15
+ <p><?php echo cssJSToolbox::getText('It\'s highly recommended to take a backup of your database before upgrading.') ?></p>
16
  <?php echo $this->getTemplate('upgrade', array('noHeaderMessage' => true), 'tmpl/upgrades'); ?>
17
  <input type="button" name="install" value="<?php echo cssJSToolbox::getText('Upgrade') ?>" />
18
  <?php else : ?>
views/installer/install/tmpl/upgrades/16.operations ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ // Disallow direct access.
7
+ defined('ABSPATH') or die("Access denied");
8
+
9
+ // Return operatrions!
10
+ return array(
11
+ 'database' => array('text' => cssJSToolbox::getText('Upgrading database')),
12
+ );
views/templates/lookup/public/css/lookup.css CHANGED
@@ -3,12 +3,15 @@ body {margin: 0;padding: 0; font-size: 12px;font-family: Helvetica; overflow: hi
3
 
4
  a,
5
  a:hover,
6
- a:visited {text-decoration: none;}
7
 
8
- a,
9
- a:visited {color: #a0a0a0 !important;}
10
 
11
- a:hover {color: #628ead !important;}
 
 
 
 
 
12
 
13
  a.active {color: #005DA4 !important;}
14
 
@@ -33,20 +36,82 @@ form#templates-lookup {height: 100%;}
33
  .author-name a.name,
34
  .author-name a.name:hover
35
  .author-name a.name:visited {font-weight: bold;}
36
- .ui-accordion-header {
37
- height: 26px;
38
- font-weight: bold;
39
- font-size: 18px;
40
- padding: 4px 0 0 11px;
41
- border-left: 1px solid #bbb;
42
- border-right: 1px solid #bbb;
43
- border-top: 1px solid #bbb;
44
- margin: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
46
- .ui-accordion-content {
47
- border-left: 1px solid #bbb;
48
- border-right: 1px solid #bbb;
49
- border-top: 1px solid #bbb;
50
- padding: 9px;
 
 
 
 
 
51
  }
52
- .ui-accordion-header.ui-accordion-header-active a {color: #005DA4 !important;}
3
 
4
  a,
5
  a:hover,
6
+ a:visited {text-decoration: none; color: #a0a0a0}
7
 
 
 
8
 
9
+ .authors-list a:hover {
10
+ color: #628ead !important;
11
+ }
12
+ .authors-list a, .authors-list a:visited {
13
+ color: #005Da4 !important;
14
+ }
15
 
16
  a.active {color: #005DA4 !important;}
17
 
36
  .author-name a.name,
37
  .author-name a.name:hover
38
  .author-name a.name:visited {font-weight: bold;}
39
+
40
+ /* START OF TABS */
41
+
42
+ /*
43
+ * jQuery UI Tabs 1.8.16
44
+ *
45
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
46
+ * Dual licensed under the MIT or GPL Version 2 licenses.
47
+ * http://jquery.org/license
48
+ *
49
+ * http://docs.jquery.com/UI/Tabs#theming
50
+ */
51
+
52
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active a.prog-colored {color: transparent !important;}
53
+
54
+ .ui-tabs {
55
+ background: none !important;
56
+ border: none !important;
57
+ padding: 0px !important;
58
+ position: relative;
59
+ zoom: 1;
60
+ height: 331px;
61
+ } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
62
+
63
+ .ui-helper-clearfix:after {content: initial !important;}
64
+
65
+ .ui-tabs .ui-tabs-nav {
66
+ background: none !important;
67
+ border: none !important;
68
+ padding: 0px !important;
69
+ max-width: 315px;
70
+ max-height: 80px;
71
+ margin:0;
72
+ }
73
+
74
+ .ui-tabs .ui-tabs-nav li { border: none !important; position: static !important; float: none !important; list-style: none; top: 1px; margin: 0 .2em 1px 0; padding: 0; white-space: nowrap; }
75
+
76
+ /*-moz-border-radius:3px 3px 0 0;-webkit-border-top-right-radius:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-right-radius:3px;-khtml-border-top-left-radius:3px;border-top-right-radius:3px;border-top-left-radius:3px;*/
77
+ .ui-tabs .ui-tabs-nav li a
78
+ {
79
+ display: inline-block;
80
+ height: auto !important;
81
+ font-family: inherit !important;
82
+ margin:1px 1px 0 0;
83
+ float:right;
84
+ cursor:pointer;
85
+ border: 1px solid;
86
+ border-bottom: 0 !important;
87
+ border-left: 0 !important;
88
+ font-size: 12px;
89
+ float: left;
90
+ padding: 8px !important;
91
+ text-decoration: none;
92
+ }
93
+
94
+ .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
95
+
96
+
97
+ .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
98
+ .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; background:#E9E9E9; border-color:#CCCCCC #CCCCCC #E9E9E9; color:#333333; }
99
+
100
+ .ui-tabs .ui-tabs-panel {
101
+ display: block;
102
+ clear:both;
103
+ height: 87%;
104
+ padding: 12px 10px !important;
105
+ border: 1px solid;
106
  }
107
+
108
+ .ui-tabs .ui-tabs-hide { display: none !important; }
109
+
110
+ .ui-tabs .ui-tabs-nav li:first-child a {
111
+ border-left-width: 1px !important;
112
+ border-left-style: solid !important;
113
+ }
114
+
115
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active.ui-state-active a {
116
+ color: #005DA4 !important;
117
  }
 
views/templates/lookup/public/js/lookup/lookup.js CHANGED
@@ -12,7 +12,7 @@
12
  *
13
  */
14
  var blockId = parseInt(window.location.href.match(/\&blockId\=(\d+)/)[1]);
15
-
16
  /**
17
  * put your comment there...
18
  *
@@ -121,21 +121,32 @@
121
  // Do action!
122
  this.server.send('templatesLookup', actionInfo[1], request)
123
  .success(
 
124
  function(response) {
 
125
  // Special actions
126
  switch (actionInfo[1]) {
 
127
  case 'embedded':
 
128
  // Insert template at cursor.
129
  block.aceEditor.getSession().replace(block.aceEditor.getSelectionRange(), response.code);
 
130
  break;
131
  }
 
132
  // If the changes required reflect a state.
133
  var newState = response.newState;
 
134
  if (newState) {
135
- $(event.target).text(newState.text)
136
- .prop('href', '#' + newState.action + '(' + request.templateId + ')')
137
- .get(0).className = newState.className;
 
 
 
138
  }
 
139
  // Close the Popup after completing!
140
  //popupButton.close();
141
  // Set focus to ace editor.
@@ -165,7 +176,7 @@
165
  */
166
  init : function() {
167
  // Initialize accordion Plugin.
168
- $('#templates-list').accordion({fillSpace : true, heightStyle : "fill"})
169
  // Make author templates list toggle-able.
170
  .find('.author-name .name').click($.proxy(this._ontoggletemplates, this));
171
  // Actions!!
@@ -184,19 +195,22 @@
184
  */
185
  refresh : function() {
186
  // Set THEME color.
187
- var block = window.parent.CJTBlocksPage.blocks.getBlock(blockId).get(0).CJTBlock;
188
  var theme = block.theme;
189
  var blockElement = block.block.box;
190
  blockElement.find('iframe.templates-lookup').css('background-color', theme.backgroundColor);
191
  // Set the size of the Accordion Tab based on the Frame height!
192
  // Frame height might be changed by the Parent window.
193
- var accordionHeight = templatesLookupFormNS.inputs.height - ($('.sweep').height() + 5);
194
- $('#templates-lookup').css('height', (accordionHeight + 'px'));
 
 
 
195
  // Use accordion menu for templates types list.
196
  // @TODO: Select type corresponding to editor language type
197
  // (e.g if editor-lang = 'css' then select 'CSS', etc...).
198
  // var activeTypeSelector = '#templates-type-header-' + templatesLookupFormNS.inputs.block.get('editorLang');
199
- $('#templates-list').accordion('refresh');
200
  }
201
 
202
  } // End class.
12
  *
13
  */
14
  var blockId = parseInt(window.location.href.match(/\&blockId\=(\d+)/)[1]);
15
+
16
  /**
17
  * put your comment there...
18
  *
121
  // Do action!
122
  this.server.send('templatesLookup', actionInfo[1], request)
123
  .success(
124
+
125
  function(response) {
126
+
127
  // Special actions
128
  switch (actionInfo[1]) {
129
+
130
  case 'embedded':
131
+
132
  // Insert template at cursor.
133
  block.aceEditor.getSession().replace(block.aceEditor.getSelectionRange(), response.code);
134
+
135
  break;
136
  }
137
+
138
  // If the changes required reflect a state.
139
  var newState = response.newState;
140
+
141
  if (newState) {
142
+
143
+ $(event.target) .text(newState.text)
144
+ .prop('href', '#' + newState.action + '(' + request.templateId + ')')
145
+ .get(0).className = newState.className;
146
+
147
+ templatesLookupFormNS.inputs.blockPlugin.infoBar.find('.templates-info a.cjttbl-templates').text(newState.count);
148
  }
149
+
150
  // Close the Popup after completing!
151
  //popupButton.close();
152
  // Set focus to ace editor.
176
  */
177
  init : function() {
178
  // Initialize accordion Plugin.
179
+ $('#templates-list').tabs()
180
  // Make author templates list toggle-able.
181
  .find('.author-name .name').click($.proxy(this._ontoggletemplates, this));
182
  // Actions!!
195
  */
196
  refresh : function() {
197
  // Set THEME color.
198
+ var block = window.parent.CJTBlocksPage.blocks.getBlock(blockId).get(0).CJTBlock;
199
  var theme = block.theme;
200
  var blockElement = block.block.box;
201
  blockElement.find('iframe.templates-lookup').css('background-color', theme.backgroundColor);
202
  // Set the size of the Accordion Tab based on the Frame height!
203
  // Frame height might be changed by the Parent window.
204
+ var listHeight = templatesLookupFormNS.inputs.height - ($('.sweep').height() + 5);
205
+ $('#templates-lookup').css('height', (listHeight + 'px'));
206
+
207
+ $('#templates-list .ui-tabs-panel').css('height', (listHeight - 60) + 'px');
208
+
209
  // Use accordion menu for templates types list.
210
  // @TODO: Select type corresponding to editor language type
211
  // (e.g if editor-lang = 'css' then select 'CSS', etc...).
212
  // var activeTypeSelector = '#templates-type-header-' + templatesLookupFormNS.inputs.block.get('editorLang');
213
+ $('#templates-list').tabs('refresh');
214
  }
215
 
216
  } // End class.
views/templates/lookup/tmpl/default.html.tmpl CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- *
4
  */
5
 
6
  /**
@@ -14,83 +14,80 @@ $this->enqueueStyles();
14
  $this->suppressPrintScriptsHook();
15
  ?>
16
  <html xmlns="http://www.w3.org/1999/xhtml">
17
- <head>
18
  <?php wp_print_head_scripts() ?>
19
  <?php wp_print_styles() ?>
20
- </head>
21
- <body>
22
- <div id="cjtoolbox_popup">
23
- <form id="templates-lookup" class="cjt-form">
24
- <?php if (empty($this->items)) : ?>
 
 
 
25
 
26
- <?php else : ?>
27
- <div id="templates-list">
28
- <?php foreach ($this->items as $type => $authors) :
29
- $_txt = $type;
 
30
 
31
- switch ( $type ) :
32
- case 'javascript':
33
- $_txt = 'JavaScript';
34
- break;
35
- case 'css':
36
- $_txt = 'CSS';
37
- break;
38
- case 'html':
39
- $_txt = 'HTML';
40
- break;
41
- case 'php':
42
- $_txt = 'PHP';
43
- break;
44
- endswitch; ?>
45
- <h3 id="#templates-type-header-<?php echo $type ?>"><a href="#"><?php echo cssJSToolbox::getText($_txt) ?></a></h3>
46
- <div id="#templates-type-content-<?php echo $type ?>" class="templates-list">
47
- <ul class="authors-list">
48
- <?php
49
- foreach ($authors as $author => $templates) :
50
- $authorIdentifier ="{$type}_" . str_replace(array(' ', '-', '_'), '', $author);
51
  ?>
52
- <li>
53
- <span class="author-name"><?php echo cssJSToolbox::getText('User') ?>: <a class="name" href="#<?php echo "{$authorIdentifier}" ?>"><?php echo $author ?></a></span>
54
- <ul id="<?php echo "{$authorIdentifier}" ?>-author-templates" class="templates">
55
- <?php foreach ($templates as $id => $template) : ?>
56
- <li class="template-item">
57
- <div class="title" title="<?php echo $template->description ?>"><?php echo $template->name ?></div>
58
- <span class="options">
59
- <a href="#embedded(<?php echo $id ?>)" class="template-action"><?php echo cssJSToolbox::getText('Embed') ?></a>
60
  <?php if ($template->linked) : ?>
61
- | <a href="#unlink(<?php echo $id ?>)" class="template-action unlink-template"><?php echo cssJSToolbox::getText('Unlink') ?></a>
62
  <?php else : ?>
63
- | <a href="#link(<?php echo $id ?>)" class="template-action link-template"><?php echo cssJSToolbox::getText('Link') ?></a>
64
  <?php endif; ?>
65
  <?php if (!$template->systemTemplate) : // Allow editing noo-system templates only ?>
66
- | <a href="#edit(<?php echo $id ?>)" class="template-action edit-template"><?php echo cssJSToolbox::getText('Edit') ?></a>
67
  <?php endif; ?>
68
- </span>
69
- </li>
70
- <?php endforeach; ?>
71
- </ul>
72
- </li>
73
- <?php endforeach; ?>
74
- </ul>
75
- </div>
76
- <?php endforeach; ?>
77
- </div>
78
  <?php endif; ?>
79
- </form>
80
- <div class="sweep">
81
- <span class="wrap">
82
- <span class="filters-title"><?php echo cssJSToolbox::getText('Show') ?>: </span>
83
- <span class="filters">
84
- <a href="#linked"><?php echo cssJSToolbox::getText('Linked') ?></a> |
85
- <a href="#unlinked"><?php echo cssJSToolbox::getText('Unlinked') ?></a> |
86
- <a href="#all" class="active"><?php echo cssJSToolbox::getText('All') ?></a>
87
- </span>
88
- </span>
89
- <span class="actions">
90
- <a href="#unlink-all"><?php echo cssJSToolbox::getText('Unlink All') ?></a>
91
- </span>
92
- </div>
93
- </div>
 
 
94
  <?php wp_print_footer_scripts() ?>
95
- </body>
96
  </html>
1
  <?php
2
  /**
3
+ *
4
  */
5
 
6
  /**
14
  $this->suppressPrintScriptsHook();
15
  ?>
16
  <html xmlns="http://www.w3.org/1999/xhtml">
17
+ <head>
18
  <?php wp_print_head_scripts() ?>
19
  <?php wp_print_styles() ?>
20
+ </head>
21
+ <body>
22
+ <div id="cjtoolbox_popup">
23
+
24
+ <form id="templates-lookup" class="cjt-form">
25
+ <?php if (empty($this->items)) : ?>
26
+
27
+ <?php else : ?>
28
 
29
+ <div id="templates-list">
30
+
31
+ <ul>
32
+
33
+ <?php foreach (CJTTemplatesLookupView::$displayNames as $type => $displayName) : ?>
34
 
35
+ <li><a href="#templates-type-content-<?php echo $type ?>"><?php echo cssJSToolbox::_($displayName); ?></a></li>
36
+
37
+ <?php endforeach; ?>
38
+
39
+ </ul>
40
+ <?php foreach ($this->items as $type => $authors) : ?>
41
+ <div id="templates-type-content-<?php echo $type ?>" class="templates-list">
42
+ <ul class="authors-list">
43
+ <?php
44
+ foreach ($authors as $author => $templates) :
45
+ $authorIdentifier ="{$type}_" . str_replace(array(' ', '-', '_'), '', $author);
 
 
 
 
 
 
 
 
 
46
  ?>
47
+ <li>
48
+ <span class="author-name"><?php echo cssJSToolbox::_('User') ?>: <a class="name" href="#<?php echo "{$authorIdentifier}" ?>"><?php echo $author ?></a></span>
49
+ <ul id="<?php echo "{$authorIdentifier}" ?>-author-templates" class="templates">
50
+ <?php foreach ($templates as $id => $template) : ?>
51
+ <li class="template-item">
52
+ <div class="title" title="<?php echo $template->description ?>"><?php echo $template->name ?></div>
53
+ <span class="options">
54
+ <a href="#embedded(<?php echo $id ?>)" class="template-action"><?php echo cssJSToolbox::_('Embed') ?></a>
55
  <?php if ($template->linked) : ?>
56
+ | <a href="#unlink(<?php echo $id ?>)" class="template-action unlink-template"><?php echo cssJSToolbox::_('Unlink') ?></a>
57
  <?php else : ?>
58
+ | <a href="#link(<?php echo $id ?>)" class="template-action link-template"><?php echo cssJSToolbox::_('Link') ?></a>
59
  <?php endif; ?>
60
  <?php if (!$template->systemTemplate) : // Allow editing noo-system templates only ?>
61
+ | <a href="#edit(<?php echo $id ?>)" class="template-action edit-template"><?php echo cssJSToolbox::_('Edit') ?></a>
62
  <?php endif; ?>
63
+ </span>
64
+ </li>
65
+ <?php endforeach; ?>
66
+ </ul>
67
+ </li>
68
+ <?php endforeach; ?>
69
+ </ul>
70
+ </div>
71
+ <?php endforeach; ?>
72
+ </div>
73
  <?php endif; ?>
74
+ </form>
75
+ <div class="sweep">
76
+ <span class="wrap">
77
+ <span class="filters-title"><?php echo cssJSToolbox::_('Show') ?></span>
78
+ <span class="filters">
79
+ <a href="#linked"><?php echo cssJSToolbox::_('Linked') ?></a>
80
+ <span class="cjt-link-sep-pipe">|</span>
81
+ <a href="#unlinked"><?php echo cssJSToolbox::_('Unlinked') ?></a>
82
+ <span class="cjt-link-sep-pipe">|</span>
83
+ <a href="#all" class="active"><?php echo cssJSToolbox::_('All') ?></a>
84
+ </span>
85
+ </span>
86
+ <span class="actions">
87
+ <a href="#unlink-all"><?php echo cssJSToolbox::_('Unlink All') ?></a>
88
+ </span>
89
+ </div>
90
+ </div>
91
  <?php wp_print_footer_scripts() ?>
92
+ </body>
93
  </html>
views/templates/lookup/view.php CHANGED
@@ -17,6 +17,24 @@
17
  */
18
  class CJTTemplatesLookupView extends CJTView {
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  /**
21
  * put your comment there...
22
  *
@@ -42,7 +60,7 @@ class CJTTemplatesLookupView extends CJTView {
42
  protected function enqueueScripts() {
43
  // Get JQuery.
44
  self::useScripts(__CLASS__,
45
- 'jquery-ui-accordion',
46
  'views:templates:lookup:public:js:{CJT_TEMPLATES-}lookup'
47
  );
48
  }
17
  */
18
  class CJTTemplatesLookupView extends CJTView {
19
 
20
+ /**
21
+ * put your comment there...
22
+ *
23
+ * @var mixed
24
+ */
25
+ protected static $displayNames = array
26
+ (
27
+
28
+ 'css' => 'CSS',
29
+
30
+ 'javascript' => 'JavaScript',
31
+
32
+ 'html' => 'HTML',
33
+
34
+ 'php' => 'PHP',
35
+
36
+ );
37
+
38
  /**
39
  * put your comment there...
40
  *
60
  protected function enqueueScripts() {
61
  // Get JQuery.
62
  self::useScripts(__CLASS__,
63
+ 'jquery-ui-tabs',
64
  'views:templates:lookup:public:js:{CJT_TEMPLATES-}lookup'
65
  );
66
  }