Commit c8d20a86 by Patrick Barroca

Merge remote-tracking branch…

Merge remote-tracking branch 'refs/remotes/afi/dev#56107_bonus_1655_retro_sprint_73_pb_plugin_pour_afficher_des_donnees_metier_dans_un_articles_integrer_une_notice_une_sitotheque_avec_des_boutons_ckeditor' into afi-master

# Conflicts:
#	library/Class/Feature/List.php
parents 967fbd38 cdba63d7
Pipeline #3330 passed with stage
in 26 minutes 40 seconds
- ticket #56107 : ajout d'un plugin à l'éditeur des articles pour insérer un kiosque de notices
......@@ -182,6 +182,36 @@ class Admin_WidgetController extends ZendAfi_Controller_Action {
}
public function updateStyleAction() {
$preferences = Class_Systeme_ModulesAccueil::getInstance()->getValeursParDefaut('KIOSQUE');
if ($id_module = $this->_getParam('id')) {
$profil = $this->extractProfilFromUrl();
$preferences = array_merge($preferences,
$profil->getModuleAccueilPreferences($id_module, 'KIOSQUE'));
}
$this->getHelper('ViewRenderer')->setNoRender();
$html = $this->view->imgObjectPropertiesReader($this->_getParam('style_liste',''),
$preferences,
true);
$html = Class_ScriptLoader::getInstance()->beAjax()->html() . $html;
$this->_helper->json(['content' => $html]);
}
public function getFormAction() {
$module = Class_Systeme_ModulesAccueil::moduleByCode($this->_getParam('code'));
$form_class = $module->getForm();
$this->view->form = (new $form_class())->populate(array_merge(
$module->getDefaultValues(),
$this->_request->getPost()));
}
protected function _readTemplates() {
$templates = file_get_contents(ROOT_PATH . 'public/opac/js/widget_templates/widget_templates.json');
return json_decode($templates, true);
......@@ -258,4 +288,6 @@ class Admin_WidgetController extends ZendAfi_Controller_Action {
public function formProvider($widget) {
return call_user_func_array([$widget->getForm(), 'newWith'], [$widget->forForm()]);
}
}
\ No newline at end of file
<?php echo $this->renderForm($this->form, ZendAfi_View_Helper_RenderForm::NO_BUTTONS) ?>
......@@ -30,10 +30,9 @@ class CmsController extends ZendAfi_Controller_Action {
public function init() {
parent::init();
$this->_helper->getHelper('AjaxContext')
->addActionContext('reseau', 'html')
->initContext();
->addActionContext('reseau', 'html')
->initContext();
}
......
......@@ -32,19 +32,22 @@ class JavaController extends ZendAfi_Controller_Action {
public function menuimageAction() {
// rien ici -> tout est fait par le view-helper
}
public function kiosqueAction() {
$preferences = array_merge(Class_Systeme_ModulesAccueil::getInstance()->getValeursParDefaut('KIOSQUE'),
$this->getRequest()->getParams());
$profil = $this->extractProfilFromUrl();
$id_module = $this->extractIdModuleFromUrl();
if ($id_module = $this->extractIdModuleFromUrl()) {
$preferences = array_merge($preferences,
$profil->getModuleAccueilPreferences($id_module, 'KIOSQUE'));
$preferences = Class_Systeme_ModulesAccueil_Kiosque::updatePreferencesForProfileRedirect($id_module,
$preferences);
}
$preferences = array_merge(Class_Systeme_ModulesAccueil::getInstance()->getValeursParDefaut('KIOSQUE'),
$profil->getModuleAccueilPreferences($id_module, 'KIOSQUE'));
$preferences = Class_Systeme_ModulesAccueil_Kiosque::updatePreferencesForProfileRedirect($id_module,
$preferences);
$this->view->notices = Class_Catalogue::getNoticesByPreferences($preferences);
$this->view->preferences = $preferences;
......
......@@ -2,55 +2,55 @@
* @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.addExternal('bokeh_kiosk' , CKEDITOR.basePath+'../public/opac/js/ckeditor_plugins/bokeh_kiosk/','plugin.js');
CKEDITOR.stylesSet.add('default',[
{ name:'Normal', element:'p' },
{ name:'Titre 1', element:'h1' },
{ name:'Titre 2', element:'h2' },
{ name:'Titre 3', element:'h3' },
{ name:'Titre 4', element:'h4' },
{ name:'Titre 5', element:'h5' },
{ name:'Titre 6', element:'h6' },
{ name:'Grand', element:'span', styles:{'font-size': '1.5em'}},
{ name:'Petit', element:'small' },
{ name:'Machine à écrire', element:'tt' },
{ name:'Code informatique', element:'code' },
{ name:'Texte supprimé', element:'del' },
{ name:'Texte inséré', element:'ins' },
{ name:'Citation', element:'cite' },
{ name:'Mise en avant', element:'div', attributes:{'class':'mise_en_avant'}},
{ name:'Ecriture droite à gauche', element:'span', attributes:{'dir':'rtl'}},
{ name:'Ecriture gauche à droite', element:'span', attributes:{'dir':'ltr'}},
{ name:'Image à Gauche', element:'img', attributes:{'border':'2', 'align':'left'},
styles:{'padding': '5px', 'margin-right': '5px'}},
{ name:'Image à Droite', element:'img', attributes:{'border':'2', 'align':'right'},
styles:{'padding': '5px', 'margin-left': '5px'}}
{ name:'Normal', element:'p' },
{ name:'Titre 1', element:'h1' },
{ name:'Titre 2', element:'h2' },
{ name:'Titre 3', element:'h3' },
{ name:'Titre 4', element:'h4' },
{ name:'Titre 5', element:'h5' },
{ name:'Titre 6', element:'h6' },
{ name:'Grand', element:'span', styles:{'font-size': '1.5em'}},
{ name:'Petit', element:'small' },
{ name:'Machine à écrire', element:'tt' },
{ name:'Code informatique', element:'code' },
{ name:'Texte supprimé', element:'del' },
{ name:'Texte inséré', element:'ins' },
{ name:'Citation', element:'cite' },
{ name:'Mise en avant', element:'div', attributes:{'class':'mise_en_avant'}},
{ name:'Ecriture droite à gauche', element:'span', attributes:{'dir':'rtl'}},
{ name:'Ecriture gauche à droite', element:'span', attributes:{'dir':'ltr'}},
{ name:'Image à Gauche', element:'img', attributes:{'border':'2', 'align':'left'},
styles:{'padding': '5px', 'margin-right': '5px'}},
{ name:'Image à Droite', element:'img', attributes:{'border':'2', 'align':'right'},
styles:{'padding': '5px', 'margin-left': '5px'}}
]);
CKEDITOR.on( 'dialogDefinition', function( ev )
{
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
{
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
var tabsToRemove = {
"image": ['Link', 'Upload'],
"flash": ['Upload', 'properties'],
"link" : ['upload']};
var tabsToRemove = {
"image": ['Link', 'Upload'],
"flash": ['Upload', 'properties'],
"link" : ['upload']};
for (var i in tabsToRemove[dialogName])
{
dialogDefinition.removeContents(tabsToRemove[dialogName][i]);
}
for (var i in tabsToRemove[dialogName])
{
dialogDefinition.removeContents(tabsToRemove[dialogName][i]);
}
if (dialogName == 'templates')
{
var contents = dialogDefinition.getContents('selectTpl');
var insertCheckBox = contents.get('chkInsertOpt');
insertCheckBox.style = "display:none";
dialogDefinition.minHeight = 280;
}
});
if (dialogName == 'templates')
{
var contents = dialogDefinition.getContents('selectTpl');
var insertCheckBox = contents.get('chkInsertOpt');
insertCheckBox.style = "display:none";
dialogDefinition.minHeight = 280;
}
});
CKEDITOR.editorConfig = function( config ) {
config.plugins = 'dialogui,dialog,about,a11yhelp,dialogadvtab,basicstyles,bidi,blockquote,clipboard,button,panelbutton,panel,floatpanel,colorbutton,colordialog,templates,menu,contextmenu,div,resize,toolbar,elementspath,enterkey,entities,popup,filebrowser,find,fakeobjects,flash,floatingspace,listblock,richcombo,font,forms,format,horizontalrule,htmlwriter,iframe,wysiwygarea,image,indent,indentblock,indentlist,smiley,justify,menubutton,language,link,list,liststyle,magicline,maximize,newpage,pagebreak,pastetext,pastefromword,preview,print,removeformat,save,selectall,showblocks,showborders,sourcearea,specialchar,scayt,stylescombo,tab,table,tabletools,undo,wsc,iframedialog,slideshow,videodetector,lineutils,widget,oembed';
......
......@@ -22,7 +22,7 @@
| Prototype | MIT | | kiosques | | http://www.prototypejs.org/ |
| jCarousel | MIT/GPL | | kiosques | | http://sorgalla.com/projects/jcarousel/ |
| jQuery Cycle | MIT/GPL | X | CMS / bib numérique | | http://jquery.malsup.com/cycle/ |
| jMyCarousel | GPL V3 | | kiosques | | http://www.enova-tech.net/lab/jMyCarousel |
| jMyCarousel | GPL V3 | | kiosques | X (compat JQuery 3.2 + responsive) | http://www.enova-tech.net/lab/jMyCarousel |
| Scriptaculous | MIT | | kiosques | | http://script.aculo.us |
| ProtoFlow | (open-terms) | | kiosques | | http://blog.deensoft.com |
| Image SlideShow | LGPL | | kiosques | | http://www.dhtmlgoodies.com/index.html?whichScript=image_slideshow |
......@@ -43,5 +43,5 @@
| php-redmine-api | MIT | - | A simple Object Oriented wrapper for Redmine API, written with PHP5. | | https://github.com/kbsali/php-redmine-api |
| jquery.timeline | MIT | - | Lister les réservations des postes multimédia. | | https://github.com/ka215/jquery.timeline |
| public/opac/java/leaflet-ajax-gh-pages/ | MIT | - | Afficher un fond geoJSON dans la boite bibliothèques | | https://github.com/calvinmetcalf/leaflet-ajax |
| | | | | | |
| icon slideshow by Javier Cabezas | CCBY | | editeur d'articles | | https://thenounproject.com/term/slideshow/6517/ |
......@@ -45,7 +45,7 @@ class Class_Feature_List {
'Category' => $this->_('Administration'),
'Right' => function($feature, $user) {
return $user->canAccessBackend();
},
},
'Wiki' => 'http://wiki.bokeh-library-portal.org/index.php?title=Explorateur_de_fichiers',
'Test' => '/admin/file-manager/full_screen/1/display_mode_browser/wall?browser=userfiles/image',
'Date' => '2017-09-22'],
......@@ -181,6 +181,17 @@ class Class_Feature_List {
'Test' => '',
'Date' => '2017-12-06'],
'56107' =>
['Label' => $this->_('Insérer un kiosque dans un article'),
'Desc' => $this->_('Permet d\'afficher un ou plusieurs kiosques de notices dans un article'),
'Image' => '',
'Video' => 'https://www.youtube.com/watch?v=EF7Ud4n_NQU',
'Category' => $this->_('Administration'),
'Right' => function($feature_description, $user) {return true;},
'Wiki' => 'http://wiki.bokeh-library-portal.org/index.php?title=Articles_-_Cr%C3%A9er,_r%C3%A9diger_et_ordonner#Ins.C3.A9rer_un_kiosque',
'Test' => '',
'Date' => '2017-12-25'],
];
}
}
\ No newline at end of file
......@@ -286,12 +286,17 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac
else
$html=$html_array["TITRE"].BR.$html_array["CONTENU"];
return '<div id="' . $this->_getBoxId() . '" class="boite '.strtolower($this->type_module).'">'.$html.'</div>';
return $this->_tag('div',
$html,
array_filter(['id' => $this->_getBoxId(),
'class' => 'boite '.strtolower($this->type_module)]));
}
public function _getBoxId() {
return 'boite_' . $this->id_module;
return $this->id_module
? ('boite_' . $this->id_module)
: null;
}
......
......@@ -238,12 +238,14 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba
public function getTitre() {
if (!$titre = $this->preferences['titre'])
return '';
$tris = ['0' => 'alpha_titre',
'1' => 'date_creation desc',
'2' => 'nb_visu desc',
'3' => 'annee desc'];
$titre = $this->preferences['titre'];
$this->preferences['titre'] = str_replace(['/', '%2F'], ' ', $this->preferences['titre']);
$url_options = array_merge(['controller' => 'recherche',
......
......@@ -28,7 +28,7 @@ class ZendAfi_View_Helper_Admin_ImgObjectPropertiesReader
protected $_properties_path, $_defaults_path;
public function imgObjectPropertiesReader($plugin, $preferences) {
public function imgObjectPropertiesReader($plugin, $preferences, $without_div=false) {
if (!$this->_hasProperties($plugin))
return '';
......@@ -38,16 +38,21 @@ class ZendAfi_View_Helper_Admin_ImgObjectPropertiesReader
$html = $this->_tag('div', $this->_('Propriétés de l\'objet'))
. $this->view->render($this->_properties_path);
if ($without_div)
return $html;
$html = $this->_tag('div',
$html,
['id' => 'objet_props',
'style' => 'display: none;']);
return Class_Admin_Skin::current()
->renderActionIconOn('box_configuration',
$this->view,
['title' => $this->_("propriétés de l'objet"),
'style' => 'cursor:pointer',
'onclick' => "$(this).next().slideToggle();"]) .
$this->_tag('div',
$html,
['id' => 'objet_props',
'style' => 'display: none;']);
$html
;
}
......
......@@ -45,6 +45,7 @@ abstract class ZendAfi_View_Helper_Article_RenderAbstract
}
public function tagArticleEvent($article) {
return $this->view->tagArticleEvent($article);
}
......@@ -90,10 +91,11 @@ abstract class ZendAfi_View_Helper_Article_RenderAbstract
public function renderContent($article) {
if (!$article->hasSummary())
return $article->getFullContent();
$content = ($article->hasSummary()) ?
$this->renderSummary($article)
: $article->getFullContent();
return $this->view->article_ReplaceWidgets($content);
return $this->renderSummary($article);
}
......
......@@ -28,7 +28,7 @@ class ZendAfi_View_Helper_Article_RenderFullContent extends ZendAfi_View_Helper_
}
public function renderContent($article) {
return $article->getFullContent();
return $this->view->article_ReplaceWidgets($article->getFullContent());
}
}
?>
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_Article_ReplaceWidgets extends ZendAfi_View_Helper_BaseHelper {
public function article_ReplaceWidgets($content) {
return preg_replace_callback(
'|(?P<allimg><img[^>]+data-code="(?P<code>\w+)"[^>]+data-form="(?P<form>[^"]+)[^>]*>)|',
function ($matches) {
return $this->_renderWidget($matches['code'],$matches['form']);
},
$content
);
}
protected function _renderWidget($code,$form) {
$prefs = [];
parse_str(html_entity_decode($form),$prefs);
$params=['type_module'=> $code,
'preferences' => $prefs];
$helper = ZendAfi_View_Helper_Accueil_Base::getModuleHelperFromParams(null,$params,$this->view);
return $helper->setFonctionAdminHelper(null)->getBoite();
}
}
?>
\ No newline at end of file
......@@ -66,7 +66,7 @@ class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper
'/',
['HorizontalRule'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','Iframe','oembed','Slideshow', 'SpecialChar'],
['Image','Flash','Table','Iframe','oembed','Slideshow', 'SpecialChar','Kiosk'],
];
$config['extraAllowedContent'] = [
......@@ -106,8 +106,12 @@ class ZendAfi_View_Helper_CkEditor extends ZendAfi_View_Helper_BaseHelper
['NumberedList','BulletedList','-','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock']
]);
$config['extraPlugins'] = 'colordialog';
$config['kiosk_widget_url'] = Class_Url::assemble(['module' => 'admin',
'controller' => 'widget',
'action' => 'get-form',
'code' => Class_Systeme_ModulesAccueil_Kiosque::CODE,
'render' => 'popup']);
$config['extraPlugins'] = 'colordialog,bokeh_kiosk';
$oCKeditor = new CKeditor(CKBASEURL);
......
......@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_RenderForm extends ZendAfi_View_Helper_BaseHelper {
const NO_BUTTONS = 'no_buttons';
/**
* @param Zend_Form $form
* @return string
......@@ -37,7 +39,9 @@ class ZendAfi_View_Helper_RenderForm extends ZendAfi_View_Helper_BaseHelper {
if ($this->_isFormContainsSubmit($form))
return $form->render();
return $this->_renderFormWithDefaultButtons($form, $buttons);
return $buttons == static::NO_BUTTONS
? $form->render()
: $this->_renderFormWithDefaultButtons($form, $buttons);
}
......
......@@ -22,7 +22,7 @@
class ZendAfi_View_Helper_TagObjetsImgProperties
extends ZendAfi_View_Helper_BaseHelper {
public function tagObjetsImgProperties($styles, $preferences) {
public function tagObjetsImgProperties($styles, $preferences, $only_properties = false) {
$html = $this->getComboStyles($styles, $preferences["style_liste"]);
$html.= (isset($preferences['style_liste'])
......@@ -33,44 +33,27 @@ class ZendAfi_View_Helper_TagObjetsImgProperties
: '');
return $html;
// Bouton des proprietes
$onclick = "oProp=getId('objet_props'); if(oProp.style.display=='block') oProp.style.display='none'; else oProp.style.display='block'";
$html .= sprintf('&nbsp;<img src="' . URL_ADMIN_IMG . 'ico/copier.gif" title="%s" style="cursor:pointer" onclick="%s">',
$this->_("Propriétés de l'objet"),
$onclick);
// Valoriser les variables
$defauts = file($path . $fic_defaut);
$this->loadDefaults($defauts, $preferences);
// Inclure le html
$template = file_get_contents($path . $fic_html);
while (false !== ($pos = strpos($template, '<?php'))) {
$pos_fin = strpos($template, '?>', $pos);
$commande = "\$bloc=" . substr($template, ($pos+6), ($pos_fin-$pos-7)) . ";";
eval($commande);
$template = substr($template, 0, $pos) . $bloc . substr($template, ($pos_fin+2));
}
// Bloc final
$html .= '<div id="objet_props" style="display:none;border:1px solid #7f9db9;min-height:15px;background-color:#ffffff;padding:2px;margin-top:3px">';
$html .= sprintf('<div style="color:#3C5188;background-color:#eeeeee;padding:4px;margin-bottom:3px;">%s</div>',
$this->_("Propriétés de l'objet"));
$html .= $template;
$html .= '</div>';
return $html;
}
private function getComboStyles($styles, $valeur_select) {
$submit_script = '$("select[name=\'style_liste\']").change(function() {$("#styles_reload").val("1");var form=$(this).closest("form"); form.submit();});';
$update_url = $this->view->url(['module' => 'admin',
'controller' => 'widget',
'action' => 'update-style']);
$script = '$("select[name=\'style_liste\']").change(
function() {
$.getJSON("' . $update_url . '/style_liste/" + $("#style_liste").val(),
function(data) {
$("#objet_props").empty().append(data["content"]);
});
});';
Class_ScriptLoader::getInstance()
->addJQueryReady($submit_script);
->addJQueryReady($script);
$combo = '<select name="style_liste">';
$combo = '<select id="style_liste" name="style_liste">';
$combo = $this->addOptGroupOn($combo,
$this->translate()->_('Objets javascript'),
......@@ -94,7 +77,7 @@ class ZendAfi_View_Helper_TagObjetsImgProperties
private function addOptGroupOn($html, $groupLabel, $options, $current) {
$html .= sprintf('<optgroup label="%s" style="font-style:normal;color:#FF6600">',
$groupLabel);
$options = $options ? $options : [];
foreach ($options as $clef => $libelle) {
$selected = ($current == $clef) ? ' selected="selected"' : '';
$html .= sprintf('<option style="color:#666666" value="%s"%s>%s</option>',
......
CKEDITOR.dialog.add( 'kioskDialog', function ( editor ) {
var icon_path = CKEDITOR.plugins.get( 'bokeh_kiosk' ).path + 'icons/placeholder.png';
var lang = editor.lang.bokeh_kiosk;
var dialog = {
title: lang.kioskProperties,
minWidth: 400,
minHeight: 200,
contents: [
{
elements: [
{
type: 'html',
className: 'bokeh-kiosk-form',
html: '',
setupForm: function () {
var htmlElement = this;
$.ajax({
url: editor.config['kiosk_widget_url'],
type: "POST",
data: this.getValue(),
datatype: 'json',
success: function (data) {
$('.bokeh-kiosk-form').html(data['content']);
},
error: function (xhr, status) {
alert(status);
}
});
},
setup: function( element ) {
this.setValue( element ? element.prevObject.attr( "data-form" ) : '');
this.setupForm();
},
}
// UI elements of the second tab will be defined here.
]
}
],
isBokehKiosk: function(element) {
var jqel = $(element.$);
return ( jqel.hasClass('bokeh_kiosk') || jqel.closest('bokeh_kiosk').length );
},
onShow: function() {
var selection = editor.getSelection();
var element = selection.getStartElement();
if (dialog.isBokehKiosk(element)) {
element = $(element.$).closest( 'bokeh_kiosk' );
return this.setupContent( element );
}
this.setupContent(null);
},
onOk: function() {
var selection = editor.getSelection();
var widget = selection.getStartElement();
if (!widget || !dialog.isBokehKiosk(widget)) {
widget = editor.document.createElement( 'img' );
widget.setAttribute('src', icon_path);
editor.insertElement( widget );
}
$('.bokeh-kiosk-form form').triggerHandler('submit');
setTimeout(function() {
widget
.setAttribute('data-form', $('.bokeh-kiosk-form form').serialize())
.setAttribute('data-code', 'KIOSQUE')
.setAttribute('title', lang.kioskTitle)
.setAttribute('class','bokeh_kiosk');
}, 10);
}
};
return dialog;
});
CKEDITOR.plugins.setLang( 'bokeh_kiosk', 'en', {
editKiosk: 'Edit kiosk',
addKiosk: 'Insert kiosk',
kioskProperties: 'Kiosk properties',
kioskTitle: 'Kiosk'
});
CKEDITOR.plugins.setLang( 'bokeh_kiosk', 'fr', {
editKiosk: 'Modifier le kiosque de notices',
addKiosk: 'Ins\351rer un kiosque de notices',
kioskProperties: 'Propri\351t\351s du kiosque',
kioskTitle: 'Kiosque de notices'
});
.bokeh_kiosk {
width: 100px;
border-radius: 5px;
background-color: #eee;
}
CKEDITOR.plugins.add( 'bokeh_kiosk', {
icons: 'kiosk',
lang : [ 'en', 'fr' ],
init: function( editor ) {
var lang = editor.lang['bokeh_kiosk'];
CKEDITOR.dialog.add( 'kioskDialog', this.path + 'dialogs/kiosk.js' );
editor.addCommand( 'insertKiosk', new CKEDITOR.dialogCommand( 'kioskDialog'));
editor.addCommand( 'editKiosk', new CKEDITOR.dialogCommand( 'kioskDialog'));
editor.addContentsCss( this.path + 'plugin.css' );
if ( editor.contextMenu ) {
editor.addMenuGroup( 'bokehKioskGroup' );
editor.addMenuItem( 'bokehKioskItem', {
label: lang.editKiosk,
icon: this.path + 'icons/kiosk.png',
command: 'editKiosk',
group: 'bokehKioskGroup'
});
editor.contextMenu.addListener( function( element ) {
if ( $(element.$).hasClass('bokeh_kiosk') || $(element.$).closest('bokeh_kiosk').length ) {
return { bokehKioskItem: CKEDITOR.TRISTATE_OFF };
}
});
}
// Create a toolbar button that executes the above command.
editor.ui.addButton( 'Kiosk', {
label: lang.addKiosk,
command: 'insertKiosk',
toolbar: 'insert',
});
}
});
......@@ -2294,4 +2294,128 @@ class WidgetControllerWidgetAddWidgetFromTemplateTest extends WidgetControllerWi
$this->assertEquals(6,
$this->_module_config['op_timeout']);
}
}
\ No newline at end of file
}
class WidgetControllerGetFormTest extends Admin_AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->dispatch('/admin/widget/get-form/code/KIOSQUE', true);
}
/** @test */
public function formShouldHaveFieldsetAndTable() {
$this->assertXPath('//fieldset/table');
}
/** @test */
public function formShouldNotHaveSubmitButtons() {
$this->assertNotXPath('//button');
}
}
class WidgetControllerUpdateStyleTest extends Admin_AbstractControllerTestCase {
protected
$_storm_default_to_volatile = true,
$_json,
$_xpath;
public function setUp() {
parent::setUp();
$this->_xpath = new Storm_Test_XPath();
}