protected function init() { parent::init(); $EMPTY = self::EMPTY_IMAGE; $js = <<<JS selenia.ext.imageField = { clear: function (id) { var e = \$('#'+id); e.find('img').prop('src','{$EMPTY}').css('background-image',''); e.find('input[type=hidden]').val(''); e.find('span').text(''); e.find('.clearBtn').hide(); }, onChange: function (id) { selenia.ext.imageField.clear(id); var e = \$('#'+id); var input = e.find('input[type=file]'); var name = input.val().replace(/^.*(\\/|\\\\)/, ''); e.find('span').text(name); e.find('.clearBtn').show(); if ('FileReader' in window) { var reader = new FileReader(); reader.onload = function (ev) { e.find('img').css('background-image', 'url('+ev.target.result+')'); }; reader.readAsDataURL(input[0].files[0]); } } }; JS; $this->context->getAssetsService()->addInlineScript($js, 'ImageFieldInit'); }
protected function init() { $prop = $this->props; if ($prop->confirm) { $this->useInteraction(); $this->autoId = true; } parent::init(); }
protected function init() { parent::init(); // Support custom colors by dynamically generating the required CSS rules. $class = self::CSS_CLASS; $color = $this->props->customColor; if ($color) { if ($color[0] != '#') { throw new ComponentException($this, "Invalid color value for <kbd>customColor</kbd>"); } $value = $color; $color = substr($color, 1); $this->context->getAssetsService()->addInlineCss("\n.{$class}-{$color} + .{$class}-label{\n /*box-shadow*/\n -webkit-box-shadow:inset 0 0 0 0px {$value},0 0 0 2px #dddddd;\n -moz-box-shadow:inset 0 0 0 0px {$value},0 0 0 2px #dddddd;\n box-shadow:inset 0 0 0 0px {$value},0 0 0 2px #dddddd;\n}\n.{$class}-{$color}:checked + .{$class}-label{\n /*box-shadow*/\n -webkit-box-shadow:inset 0 0 0 18px {$value},0 0 0 2px {$value};\n -moz-box-shadow:inset 0 0 0 18px {$value},0 0 0 2px {$value};\n box-shadow:inset 0 0 0 18px {$value},0 0 0 2px {$value};\n}\n.{$class}-{$color}:checked + .{$class}-label:after{\n color:{$value};\n}\n", "init-{$class}-{$color}"); } }
protected function init() { parent::init(); // $this->context->getAssetsService ()->addStylesheet ('modules/electro-modules/matisse-components/css/metisMenu.css'); // $this->context->getAssetsService ()->addScript ('modules/electro-modules/matisse-components/js/metisMenu.js'); }
protected function init() { parent::init(); $this->context->getAssetsService()->addStylesheet('lib/datatables.net-bs/css/dataTables.bootstrap.min.css', true)->addStylesheet('lib/datatables.net-responsive-bs/css/responsive.bootstrap.min.css')->addStylesheet('lib/datatables.net-buttons-bs/css/buttons.bootstrap.min.css')->addScript('lib/datatables.net/js/jquery.dataTables.min.js')->addScript('lib/datatables.net-bs/js/dataTables.bootstrap.min.js')->addScript('lib/datatables.net-responsive/js/dataTables.responsive.min.js')->addScript('lib/datatables.net-buttons/js/dataTables.buttons.min.js')->addScript('lib/datatables.net-buttons-bs/js/buttons.bootstrap.min.js'); }
protected function init() { parent::init(); $this->context->getAssetsService()->addStylesheet('lib/dropzone/dist/min/dropzone.min.css')->addScript('lib/dropzone/dist/min/dropzone.min.js')->addInlineScript(self::CLIENT_SIDE_CODE, 'init-dropzone'); }
protected function init() { parent::init(); $this->context->getAssetsService()->addStylesheet('lib/chosen/chosen.min.css', true)->addScript('lib/chosen/chosen.jquery.min.js')->addScript(self::PUBLIC_URI . '/js/select.js'); }
protected function init() { parent::init(); if ($this->props->multilang) { // Update labels on language selectors of mulilingual form input fields. $this->context->getAssetsService()->addInlineScript(<<<JS selenia.on ('languageChanged', function (lang) { function focusMultiInput (e) { \$ (e).next().children('input:visible,textarea:visible').eq(0).focus(); } \$ ('input[lang] + .input-group-btn button .lang') .add ('textarea[lang] + .input-group-btn button .lang') .html (lang.substr (-2)); }); JS , 'initFieldMulti'); } }
protected function init() { parent::init(); $ctx = $this->context; $assets = $ctx->getAssetsService(); switch ($this->props->get('type', 'text')) { case 'multiline': $assets->addScript('lib/textarea-autosize/dist/jquery.textarea_autosize.min.js'); break; case 'date': case 'time': case 'datetime': $assets->addScript('lib/moment/min/moment-with-locales.min.js'); $assets->addScript('lib/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js')->addStylesheet('lib/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css'); break; case 'color': $assets->addScript('lib/mjolnic-bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js')->addStylesheet('lib/mjolnic-bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css'); break; case 'number': $assets->addScript('lib/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.js')->addStylesheet('lib/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.css'); break; } $assets->addInlineScript(<<<JS function checkKeybAction(event,action) { if (event.keyCode == 13) setTimeout(function(){ selenia.doAction(action); },1); } JS , 'initInput'); }