CSS & JavaScript Toolbox - Version 6.1.1

Version Description

  • Fix: Validate block name when editing and adding blocks.
  • Fix: Code Blocks is not being applied on WPEngine servers and other servers related to the MYSQL query error.
  • Fix: Load block code one time after its first time opened as it was loaded every time the block is opened.
  • Enhance: Show User-PHP code errors only when WP_DEBUG is set to TRUE.
  • Enhance: Auto-Size edit-block-name text field to fit the current block-name, therefor display the name without the need of moving the cursor to the end.
  • Enhance: Disable new-block form fields while saving prevent user from duplicating block when traffic is slow.
Download this release

Release Info

Developer xpointer
Plugin Icon 128x128 CSS & JavaScript Toolbox
Version 6.1.1
Comparing to
See all releases

Code changes from version 6.1 to 6.1.1

css-js-toolbox.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: CSS & JavaScript Toolbox
4
  Plugin URI: http://css-javascript-toolbox.com/css-javascript-toolbox-free
5
  Description: CJT Plugin for WordPress to easily add custom CSS and JavaScript to individual pages
6
- Version: 6.1
7
  Author: Wipeout Media
8
  Author URI: http://css-javascript-toolbox.com/
9
  License:
@@ -95,7 +95,7 @@ class CJTPlugin extends CJTHookableClass {
95
  /**
96
  *
97
  */
98
- const VERSION = '6.1 CE';
99
 
100
  /**
101
  *
3
  Plugin Name: CSS & JavaScript Toolbox
4
  Plugin URI: http://css-javascript-toolbox.com/css-javascript-toolbox-free
5
  Description: CJT Plugin for WordPress to easily add custom CSS and JavaScript to individual pages
6
+ Version: 6.1.1
7
  Author: Wipeout Media
8
  Author URI: http://css-javascript-toolbox.com/
9
  License:
95
  /**
96
  *
97
  */
98
+ const VERSION = '6.1.1 CE';
99
 
100
  /**
101
  *
framework/php/evaluator/evaluator.inc.php CHANGED
@@ -49,16 +49,21 @@ class CJTPHPCodeEvaluator {
49
  // Evaluate PHP code and save the result!
50
  $beforeEvalError = error_get_last();
51
  $unusedResult = eval("?>{$code}");
 
52
  $evalOBuffer = ob_get_clean();
 
 
53
  // Handling errors!
54
- if ($beforeEvalError != error_get_last()) {
55
- if (ini_get('display_errors')) {
56
- $this->output = 'CJT PHP Code Error detected for the following block: <br><br>';
57
- $this->output .= "Name: {$block->name}<br>";
58
- $this->output .= "ID: #{$block->id}<br><br>";
59
- $this->output .= "PHP Error Details are listed below:<br>";
60
  $this->output .= $evalOBuffer;
61
  }
 
 
62
  }
63
  else { // Get evaludated code result!
64
  $this->output .= $evalOBuffer;
@@ -90,4 +95,4 @@ class CJTPHPCodeEvaluator {
90
  public function getOutput() {
91
  return $this->output;
92
  }
93
- } // End class.
49
  // Evaluate PHP code and save the result!
50
  $beforeEvalError = error_get_last();
51
  $unusedResult = eval("?>{$code}");
52
+ $afterEvalError = error_get_last();
53
  $evalOBuffer = ob_get_clean();
54
+ $showError = ini_get('display_errors') && WP_DEBUG;
55
+ $isError = $afterEvalError && ($beforeEvalError != $afterEvalError);
56
  // Handling errors!
57
+ if ($isError && $showError) {
58
+ $this->output = 'CJT PHP Code Error detected for the following block: <br><br>';
59
+ $this->output .= "Name: {$block->name}<br>";
60
+ $this->output .= "ID: #{$block->id}<br><br>";
61
+ if ($evalOBuffer) {
62
+ $this->output .= "PHP Error message:<br>";
63
  $this->output .= $evalOBuffer;
64
  }
65
+ $this->output .= "PHP Error tech Details:<br>";
66
+ $this->output .= print_r($afterEvalError, true);
67
  }
68
  else { // Get evaludated code result!
69
  $this->output .= $evalOBuffer;
95
  public function getOutput() {
96
  return $this->output;
97
  }
98
+ } // End class.
locals/languages/css-javascript-toolbox-en_US.mo CHANGED
Binary file
locals/languages/css-javascript-toolbox-en_US.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: CSS & Javascript Toolbox V6\n"
4
- "POT-Creation-Date: 2013-10-05 00:16+0200\n"
5
- "PO-Revision-Date: 2013-10-05 00:16+0200\n"
6
  "Last-Translator: \n"
7
  "Language-Team: CJT <development@css-javascript-toolbox.com>\n"
8
  "Language: English\n"
@@ -166,7 +166,7 @@ msgid "Set output location hook to header"
166
  msgstr ""
167
 
168
  #: views/blocks/block/public/js/jquery.block/jquery.block.localization.php:20
169
- msgid "Block name cannot be empty!"
170
  msgstr ""
171
 
172
  #: views/blocks/manager/public/js/blocks-page/blocks-page.localization.php:13
@@ -577,35 +577,23 @@ msgstr ""
577
  msgid "Pro Edition"
578
  msgstr ""
579
 
580
- #: views/blocks/manager/tmpl/blocks.html.tmpl:19
581
  msgid "Script Packages"
582
  msgstr ""
583
 
584
  #: views/blocks/manager/tmpl/blocks.html.tmpl:24
585
- msgid "Support"
586
  msgstr ""
587
 
588
  #: views/blocks/manager/tmpl/blocks.html.tmpl:26
589
- msgid "Request Feature"
590
  msgstr ""
591
 
592
  #: views/blocks/manager/tmpl/blocks.html.tmpl:30
593
  msgid "Rate & Review"
594
  msgstr ""
595
 
596
- #: views/blocks/manager/tmpl/blocks.html.tmpl:36
597
- msgid "Need Help?"
598
- msgstr ""
599
-
600
- #: views/blocks/manager/tmpl/blocks.html.tmpl:37
601
- msgid "How-To"
602
- msgstr ""
603
-
604
- #: views/blocks/manager/tmpl/blocks.html.tmpl:40
605
- msgid "User Manual"
606
- msgstr ""
607
-
608
- #: views/blocks/manager/tmpl/blocks.html.tmpl:53
609
  msgid ""
610
  "You have now restored the code blocks from the current backup. Nothing is "
611
  "saved until you click \"Restore\" button. To revert back to the previous "
@@ -613,11 +601,11 @@ msgid ""
613
  "button."
614
  msgstr ""
615
 
616
- #: views/blocks/manager/tmpl/blocks.html.tmpl:66
617
  msgid "Warning!"
618
  msgstr ""
619
 
620
- #: views/blocks/manager/tmpl/blocks.html.tmpl:66
621
  msgid ""
622
  "Please make sure to validate added CSS &amp; JavaScript codes, the plugin "
623
  "doesn't do that for you!"
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: CSS & Javascript Toolbox FREE\n"
4
+ "POT-Creation-Date: 2013-11-01 21:46+0200\n"
5
+ "PO-Revision-Date: 2013-11-01 21:46+0200\n"
6
  "Last-Translator: \n"
7
  "Language-Team: CJT <development@css-javascript-toolbox.com>\n"
8
  "Language: English\n"
166
  msgstr ""
167
 
168
  #: views/blocks/block/public/js/jquery.block/jquery.block.localization.php:20
169
+ msgid "Invalid block name"
170
  msgstr ""
171
 
172
  #: views/blocks/manager/public/js/blocks-page/blocks-page.localization.php:13
577
  msgid "Pro Edition"
578
  msgstr ""
579
 
580
+ #: views/blocks/manager/tmpl/blocks.html.tmpl:18
581
  msgid "Script Packages"
582
  msgstr ""
583
 
584
  #: views/blocks/manager/tmpl/blocks.html.tmpl:24
585
+ msgid "Need Help?"
586
  msgstr ""
587
 
588
  #: views/blocks/manager/tmpl/blocks.html.tmpl:26
589
+ msgid "User Manual"
590
  msgstr ""
591
 
592
  #: views/blocks/manager/tmpl/blocks.html.tmpl:30
593
  msgid "Rate & Review"
594
  msgstr ""
595
 
596
+ #: views/blocks/manager/tmpl/blocks.html.tmpl:44
 
 
 
 
 
 
 
 
 
 
 
 
597
  msgid ""
598
  "You have now restored the code blocks from the current backup. Nothing is "
599
  "saved until you click \"Restore\" button. To revert back to the previous "
601
  "button."
602
  msgstr ""
603
 
604
+ #: views/blocks/manager/tmpl/blocks.html.tmpl:57
605
  msgid "Warning!"
606
  msgstr ""
607
 
608
+ #: views/blocks/manager/tmpl/blocks.html.tmpl:57
609
  msgid ""
610
  "Please make sure to validate added CSS &amp; JavaScript codes, the plugin "
611
  "doesn't do that for you!"
readme.txt CHANGED
@@ -2,12 +2,12 @@
2
  Contributors: wipeoutmedia
3
  Author URL: http://css-javascript-toolbox.com
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EWDWF75JHT9Q6
5
- Tags: plug, customise, style, scripts, hack, Wordpress, contribute, enhancing, HTML, CSS, Javascript, PHP, execute, display, output, header, footer, apply, requests, match, hook, run
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  Requires at least: 3.6
9
- Tested up to: 3.6.1
10
- Stable tag: 6.1
11
 
12
  Easily add custom CSS, JavaScript, HTML and PHP code to unique CJT code blocks and assign them wherever you want.
13
 
@@ -128,6 +128,14 @@ Sometimes a bug decides to rear its ugly head and when this happens, this is whe
128
 
129
  == Changelog ==
130
 
 
 
 
 
 
 
 
 
131
  = 6.1 =
132
  * Enhance: Initially don't load Block assignment panel items: Speed up Blocks page loading time when its initially opened, also affect the browser performance as the items is not loaded or rendered before its required.
133
  * Enhance: Initially don't load Block code for the closed/minimised Blocks: Loading those Blocks will be done through AJAX once the Block is opened by user.
2
  Contributors: wipeoutmedia
3
  Author URL: http://css-javascript-toolbox.com
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EWDWF75JHT9Q6
5
+ Tags: Post, posts, admin, sidebar, page, pages, image, plug, plugin, customise, style, scripts, hack, Wordpress, HTML, CSS, JavaScript, HTML5, jQuery, PHP, code, script, scripts, manage, management, display, output, header, footer, apply, requests, match, hook, execute, run
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  Requires at least: 3.6
9
+ Tested up to: 3.7.1
10
+ Stable tag: 6.1.1
11
 
12
  Easily add custom CSS, JavaScript, HTML and PHP code to unique CJT code blocks and assign them wherever you want.
13
 
128
 
129
  == Changelog ==
130
 
131
+ = 6.1.1 =
132
+ * Fix: Validate block name when editing and adding blocks.
133
+ * Fix: Code Blocks is not being applied on WPEngine servers and other servers related to the MYSQL query error.
134
+ * Fix: Load block code one time after its first time opened as it was loaded every time the block is opened.
135
+ * Enhance: Show User-PHP code errors only when WP_DEBUG is set to TRUE.
136
+ * Enhance: Auto-Size edit-block-name text field to fit the current block-name, therefor display the name without the need of moving the cursor to the end.
137
+ * Enhance: Disable new-block form fields while saving prevent user from duplicating block when traffic is slow.
138
+
139
  = 6.1 =
140
  * Enhance: Initially don't load Block assignment panel items: Speed up Blocks page loading time when its initially opened, also affect the browser performance as the items is not loaded or rendered before its required.
141
  * Enhance: Initially don't load Block code for the closed/minimised Blocks: Loading those Blocks will be done through AJAX once the Block is opened by user.
tables/pins-blocks-view.php CHANGED
@@ -73,7 +73,7 @@ class CJTPinsBlockSQLView extends CJTSQLView {
73
  LEFT JOIN `{$pinsTable}` pins
74
  ON blocks.`id` = pins.`blockId`";
75
  $query['where'] = "(((`backupId` IS NULL) AND (blocks.`code` != '') AND (`state` = '{$filters->state}'){$excludes}) AND
76
- ((blocks.`pinPoint` & {$filters->pinPoint}){$customPins}));";
77
  // Combine all into one statement.
78
  $query = $this->buildQuery($query['from'], $query['where']);
79
  return $query;
73
  LEFT JOIN `{$pinsTable}` pins
74
  ON blocks.`id` = pins.`blockId`";
75
  $query['where'] = "(((`backupId` IS NULL) AND (blocks.`code` != '') AND (`state` = '{$filters->state}'){$excludes}) AND
76
+ ((blocks.`pinPoint` & {$filters->pinPoint}){$customPins}))";
77
  // Combine all into one statement.
78
  $query = $this->buildQuery($query['from'], $query['where']);
79
  return $query;
views/blocks/block/public/js/jquery.block/jquery.block.js CHANGED
@@ -266,6 +266,7 @@
266
  *
267
  */
268
  this._oneditname = function(event) {
 
269
  var editName = this.elements.editBlockName;
270
  var inputText = editName.find('input.block-name');
271
  // When block name clicked don't toggle postbox.
@@ -294,6 +295,13 @@
294
  'font-size' : this.elements.blockName.css('font-size'),
295
  'font-family' : this.elements.blockName.css('font-family')
296
  };
 
 
 
 
 
 
 
297
  inputText.css(styles);
298
  // Display.
299
  editName.css('display', 'block');
@@ -369,7 +377,7 @@
369
  // Remove loading state.
370
  this.block.aceEditor.setReadOnly(false);
371
  // Mark as loaded.
372
- jEditor.removeClass('iniially-loaded');
373
  }, this)
374
  );
375
  }
@@ -441,25 +449,24 @@
441
  // Save only if new and old name are not same.
442
  var blockName = this.elements.editBlockName.find('input.block-name').val();
443
  // Name cannot be empty!
444
- if (!blockName) {
445
- // Reset the name back!
446
- // fill name so the below code will be compatible to handle both cases.
447
- blockName = this.block.get('name');
448
  // Show message!
449
- alert(CJTJqueryBlockI18N.nameCantBeEmpty);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
  }
451
- // Change block name.
452
- this.block.set('name', blockName)
453
- .success($.proxy(
454
- function(rName) {
455
- // Update metabox title when sucess.
456
- this.elements.blockName.text(rName.value);
457
- }, this)
458
- );
459
- // Update on server.
460
- this.block.sync('name');
461
- // Hide edit name input field and tasks buttons.
462
- this._oncanceleditname();
463
  }
464
 
465
  /**
266
  *
267
  */
268
  this._oneditname = function(event) {
269
+ // Initialize.
270
  var editName = this.elements.editBlockName;
271
  var inputText = editName.find('input.block-name');
272
  // When block name clicked don't toggle postbox.
295
  'font-size' : this.elements.blockName.css('font-size'),
296
  'font-family' : this.elements.blockName.css('font-family')
297
  };
298
+ // Make the textbox wider in case the displayed name is
299
+ // wider than the text field.
300
+ var labelWidth = parseInt(this.elements.blockName.css('width'));
301
+ var textWidh = parseInt(inputText.css('width'));
302
+ if (labelWidth > textWidh) {
303
+ styles.width = (labelWidth + 100) + 'px';
304
+ }
305
  inputText.css(styles);
306
  // Display.
307
  editName.css('display', 'block');
377
  // Remove loading state.
378
  this.block.aceEditor.setReadOnly(false);
379
  // Mark as loaded.
380
+ jEditor.addClass('initially-loaded');
381
  }, this)
382
  );
383
  }
449
  // Save only if new and old name are not same.
450
  var blockName = this.elements.editBlockName.find('input.block-name').val();
451
  // Name cannot be empty!
452
+ if (!blockName.match(/^[A-Za-z0-9\!\#\@\$\&\*\(\)\[\]\x20\-\_\+\?\:\;\.]{1,50}$/)) {
 
 
 
453
  // Show message!
454
+ alert(CJTJqueryBlockI18N.invalidBlockName);
455
+ }
456
+ else { // Simply save!
457
+ // Change block name.
458
+ this.block.set('name', blockName)
459
+ .success($.proxy(
460
+ function(rName) {
461
+ // Update metabox title when sucess.
462
+ this.elements.blockName.text(rName.value);
463
+ }, this)
464
+ );
465
+ // Update on server.
466
+ this.block.sync('name');
467
+ // Hide edit name input field and tasks buttons.
468
+ this._oncanceleditname();
469
  }
 
 
 
 
 
 
 
 
 
 
 
 
470
  }
471
 
472
  /**
views/blocks/block/public/js/jquery.block/jquery.block.localization.php CHANGED
@@ -17,5 +17,5 @@ return array(
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
- 'nameCantBeEmpty' => cssJSToolbox::getText('Block name cannot be empty!'),
21
  );
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
  );
views/blocks/block/tmpl/edit.html.tmpl CHANGED
@@ -7,7 +7,7 @@
7
  defined('ABSPATH') or die("Access denied");
8
  ?>
9
  <div class="cjt-toolbox edit-block-name">
10
- <input type="text" class="block-name" value="">
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>
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>
views/blocks/manager/public/js/blocks-page/blocks-page.js CHANGED
@@ -560,6 +560,9 @@ var CJTBlocksPage;
560
  init : function() {
561
  // Initialize object vars.
562
  CJTBlocksPage.blocksForm = $('form#cjtoolbox-blocks-page-form');
 
 
 
563
  CJTBlocksPage.blocksContainer = $('div#normal-sortables');
564
  CJTBlocksPage.intro = CJTBlocksPage.blocksForm.find('#cjt-noblocks-intro');
565
  CJTBlocksPage.server = CJTServer;
560
  init : function() {
561
  // Initialize object vars.
562
  CJTBlocksPage.blocksForm = $('form#cjtoolbox-blocks-page-form');
563
+ // Prevent form submission, ALL is done through AJAX.
564
+ // Pressing Enter in text fields might caused the whole page to be refreshed.
565
+ CJTBlocksPage.blocksForm.get(0).onsubmit = function() {return false;}
566
  CJTBlocksPage.blocksContainer = $('div#normal-sortables');
567
  CJTBlocksPage.intro = CJTBlocksPage.blocksForm.find('#cjt-noblocks-intro');
568
  CJTBlocksPage.server = CJTServer;
views/blocks/manager/tmpl/blocks.html.tmpl CHANGED
@@ -12,18 +12,18 @@ defined('ABSPATH') or die("Access denied");
12
  <div id="cjt-banner-bar-left" class="cjt-banner-bar ">
13
  <span class="cjt-banner-link" style="margin-left: 47px;">
14
  <?php echo cssJSToolbox::getText('Click for') ?>:&nbsp;&nbsp;
15
- <a target="_blank" href="http://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/css-javascript-toolbox-pro/"><?php echo cssJSToolbox::getText('Pro Edition') ?></a>
16
  </span>&nbsp;&nbsp;|
17
  <span id="get-packages" class="cjt-banner-link">
18
- <span id="get-packages-icon"></span>
19
  <a target="_blank" href="http://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/category/scripts/"><?php echo cssJSToolbox::getText('Script Packages') ?></a>
 
20
  </span>
21
  </div>
22
  <div id="cjt-banner-bar-right" class="cjt-banner-bar">
23
  <span class="cjt-banner-link">
24
- <?php echo cssJSToolbox::getText('Support') ?>:&nbsp;&nbsp;&nbsp;
25
  <span class="cjt-banner-link">
26
- <a target="_blank" href="http://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/cjt-feature-requests/"><?php echo cssJSToolbox::getText('Request Feature') ?></a>
27
  </span>
28
  &nbsp;&nbsp;|&nbsp;&nbsp;
29
  <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/css-javascript-toolbox#postform">
@@ -31,15 +31,6 @@ defined('ABSPATH') or die("Access denied");
31
  <span id="review-icon"></span>
32
  </a>
33
  </span>
34
- <br>
35
- <span class="cjt-banner-link" style="float: right;">
36
- <?php echo cssJSToolbox::getText('Need Help?') ?>&nbsp;&nbsp;&nbsp;
37
- <a target="_blank" href="http://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/category/how-to/"><?php echo cssJSToolbox::getText('How-To') ?></a>
38
- &nbsp;&nbsp;|&nbsp;&nbsp;
39
- <span class="cjt-banner-link">
40
- <a target="_blank" href="<?php echo CJTOOLBOX_URL ?>/docs/CJTV6CEUserManual.pdf"><?php echo cssJSToolbox::getText('User Manual') ?></a>
41
- </span>
42
- </span>
43
  </div>
44
  <form id="cjtoolbox-blocks-page-form" method="post">
45
  <?php wp_nonce_field('cjtoolbox'); ?>
12
  <div id="cjt-banner-bar-left" class="cjt-banner-bar ">
13
  <span class="cjt-banner-link" style="margin-left: 47px;">
14
  <?php echo cssJSToolbox::getText('Click for') ?>:&nbsp;&nbsp;
15
+ <a target="_blank" href="http://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/"><?php echo cssJSToolbox::getText('Pro Edition') ?></a>
16
  </span>&nbsp;&nbsp;|
17
  <span id="get-packages" class="cjt-banner-link">
 
18
  <a target="_blank" href="http://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/category/scripts/"><?php echo cssJSToolbox::getText('Script Packages') ?></a>
19
+ <span id="get-packages-icon"></span>
20
  </span>
21
  </div>
22
  <div id="cjt-banner-bar-right" class="cjt-banner-bar">
23
  <span class="cjt-banner-link">
24
+ <?php echo cssJSToolbox::getText('Need Help?') ?>&nbsp;&nbsp;&nbsp;
25
  <span class="cjt-banner-link">
26
+ <a target="_blank" href="<?php echo CJTOOLBOX_URL ?>/docs/CJTV6CEUserManual.pdf"><?php echo cssJSToolbox::getText('User Manual') ?></a>
27
  </span>
28
  &nbsp;&nbsp;|&nbsp;&nbsp;
29
  <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/css-javascript-toolbox#postform">
31
  <span id="review-icon"></span>
32
  </a>
33
  </span>
 
 
 
 
 
 
 
 
 
34
  </div>
35
  <form id="cjtoolbox-blocks-page-form" method="post">
36
  <?php wp_nonce_field('cjtoolbox'); ?>
views/blocks/new/public/js/add-new-block/add-new-block.js CHANGED
@@ -70,6 +70,8 @@
70
  var formData = this.form.serializeObject();
71
  // Request parameters.
72
  var requestParams = $.extend({ids : CJTBlocksPage.blocks.getExistsIds(), viewName : 'cjt-block'}, formData);
 
 
73
  // Create block at the server.
74
  CJTBlocksPage.server.send('blocksPage', 'create_block', requestParams, 'get')
75
  .success($.proxy(
@@ -79,6 +81,12 @@
79
  // Close window.
80
  window.parent.tb_remove();
81
  }, this)
 
 
 
 
 
 
82
  );
83
  }, this)
84
  ).fail($.proxy(
@@ -96,7 +104,7 @@
96
  init : function() {
97
  this.form = $('form#cjtoolbox_new_block_form');
98
  this.errors = new CJTSimpleErrorDialog(this.form)
99
- .add('name', /^.+$/, CJTAddNewBlockI18N.invalidName);
100
  // Actions handled by this object.
101
  var events = {'.save' : this._onsave, '.cancel' : this._oncancel};
102
  $.each(events, $.proxy(
70
  var formData = this.form.serializeObject();
71
  // Request parameters.
72
  var requestParams = $.extend({ids : CJTBlocksPage.blocks.getExistsIds(), viewName : 'cjt-block'}, formData);
73
+ // Disable new form.
74
+ this.form.find('input, select').prop('disabled', true);
75
  // Create block at the server.
76
  CJTBlocksPage.server.send('blocksPage', 'create_block', requestParams, 'get')
77
  .success($.proxy(
81
  // Close window.
82
  window.parent.tb_remove();
83
  }, this)
84
+ // Request COMPLETE!
85
+ ).complete($.proxy(
86
+ function() {
87
+ // Enable new form.
88
+ this.form.find('input, select').prop('disabled', false);
89
+ }, this)
90
  );
91
  }, this)
92
  ).fail($.proxy(
104
  init : function() {
105
  this.form = $('form#cjtoolbox_new_block_form');
106
  this.errors = new CJTSimpleErrorDialog(this.form)
107
+ .add('name', /^[A-Za-z0-9\!\#\@\$\&\*\(\)\[\]\x20\-\_\+\?\:\;\.]{1,50}$/, CJTAddNewBlockI18N.invalidName);
108
  // Actions handled by this object.
109
  var events = {'.save' : this._onsave, '.cancel' : this._oncancel};
110
  $.each(events, $.proxy(