PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
← All changes | admin/helpers/widgets/sticky_notes.php +21 -18 1.6.4 → 1.8.16 View file →
@@ -12,9 +12,9 @@
12 12
13 13 /**
14 14 * Class handler for admin widget "sticky notes". This widget has settings.
15 15 *
16 - * @since 1.4.0
16 + * @since 1.14.0 (J) - 1.4.0 (WP)
17 17 */
18 18 class VikBookingAdminWidgetStickyNotes extends VikBookingAdminWidget
19 19 {
20 20 /**
@@ -247,10 +247,25 @@
247 247
248 248 echo 'e4j.ok';
249 249 }
250 250
251 - public function render(VBOMultitaskData $data = null)
251 + /**
252 + * Preload the necessary assets.
253 + *
254 + * @return void
255 + */
256 + public function preload()
252 257 {
258 + // JS lang def
259 + JText::script('VBO_STICKYN_TITLE');
260 + JText::script('VBO_STICKYN_TEXT');
261 + JText::script('VBO_STICKYN_TEXT2');
262 + JText::script('VBO_STICKYN_CUSTOMURI');
263 + JText::script('VBO_WIDGETS_CONFRMELEM');
264 + }
265 +
266 + public function render(?VBOMultitaskData $data = null)
267 + {
253 268 // increase widget's instance counter
254 269 static::$instance_counter++;
255 270
256 271 // check whether the widget is being rendered via AJAX when adding it through the customizer
@@ -271,20 +286,8 @@
271 286 $needs_settings = true;
272 287 }
273 288 }
274 289
275 - /**
276 - * This widget requires the jQuery UI Sortable library, but we do not preload it
277 - * in order to save resources. We only load this JS asset when the widget is saved.
278 - * The page Dashboard always loads the Sortable library, but not the Multitask panel.
279 - *
280 - * @since 1.15.0 (J) - 1.5.0 (WP)
281 - */
282 - if (!$is_ajax) {
283 - // load assets (with no "preloading")
284 - JHtml::fetch('script', VBO_SITE_URI.'resources/jquery-ui.sortable.min.js');
285 - }
286 -
287 290 // generate a unique ID for the sticky notes wrapper instance
288 291 $wrapper_instance = !$is_ajax ? static::$instance_counter : rand();
289 292 $wrapper_id = 'vbo-widget-sticky-' . $wrapper_instance;
290 293
@@ -350,9 +353,9 @@
350 353 <script type="text/javascript">
351 354 // declare global variables for notes sorting
352 355 var vbo_stickynote_initial_pos = null;
353 356
354 - jQuery(document).ready(function() {
357 + jQuery(function() {
355 358
356 359 // register input event listener for each sticky note
357 360 var stickies<?php echo $wrapper_instance; ?> = document.querySelectorAll('#<?php echo $wrapper_id; ?> .vbo-widget-sticky-canvas');
358 361 for (var i = 0; i < stickies<?php echo $wrapper_instance; ?>.length; i++) {
@@ -428,9 +431,9 @@
428 431 <?php
429 432 if (static::$instance_counter === 0 || $is_ajax) {
430 433 ?>
431 434 <script type="text/javascript">
432 - jQuery(document).ready(function() {
435 + jQuery(function() {
433 436
434 437 /**
435 438 * Add event listener to keydown for shortcuts during typing on contenteditable elements.
436 439 */
@@ -677,13 +680,13 @@
677 680 * settings have been loaded, and if AJAX + multitask rendering is detected.
678 681 * It's assumed that the AJAX rendering of a multitask widget takes place one
679 682 * second before the AJAX event that updates the multitask map to push the widget.
680 683 *
681 - * @param VBOMultitaskData $data the data object injected to the widget.
684 + * @param ?VBOMultitaskData $data the data object injected to the widget.
682 685 *
683 686 * @return bool|int false on failure, guessed settings index otherwise.
684 687 */
685 - protected function guessMultitaskStickyInstance(VBOMultitaskData $data = null)
688 + protected function guessMultitaskStickyInstance(?VBOMultitaskData $data = null)
686 689 {
687 690 if (!is_array($this->widgetSettings) || !count($this->widgetSettings)) {
688 691 // nothing to guess if this widget has got no saved settings
689 692 return false;