CLICK HERE TO BUY IT TODAY! OR GET IT FREE VIA TRIALPAY  

PHP Demo Application - Source Code

/Framework/Model/Vendor/CkEditor/_source/plugins/richcombo/plugin.js



/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add'richcombo',
{
	    requires : [ 'floatpanel''listblock''button' ],
	    beforeInit : function( editor )
	    {
		        editor.ui.addHandlerCKEDITOR.UI_RICHCOMBOCKEDITOR.ui.richCombo.handler );
		    }
	});
/**
 * Button UI element.
 * @constant
 * @example
 */
CKEDITOR.UI_RICHCOMBO 3;
CKEDITOR.ui.richCombo CKEDITOR.tools.createClass(
{
	    $ : function( definition )
	    {
		        // Copy all definition properties to this object.
		        CKEDITOR.tools.extendthisdefinition,
		            // Set defaults.
		            {
			                title definition.label,
			                modes : { wysiwyg 1
				}
			            });
		        // We don't want the panel definition in this object.
		        var panelDefinition this.panel || {};
		        delete this.panel;
		        this.id CKEDITOR.tools.getNextNumber();
		        this.document = ( panelDefinition
		                            && panelDefinition.parent
		                            && panelDefinition.parent.getDocument() )
		                        || CKEDITOR.document;
		        panelDefinition.className = ( panelDefinition.className || '' ) + ' cke_rcombopanel';
		        panelDefinition.block =
		        {
			            multiSelect panelDefinition.multiSelect,
			            attributes panelDefinition.attributes
			        };
		        this.=
		        {
			            panelDefinition panelDefinition,
			            items {},
			            state CKEDITOR.TRISTATE_OFF
			        };
		    },
	    statics :
	    {
		        handler :
		        {
			            create : function( definition )
			            {
				                return new CKEDITOR.ui.richCombodefinition );
				            }
			        }
		    },
	    proto :
	    {
		        renderHtml : function( editor )
		        {
			            var output [];
			            this.rendereditoroutput );
			            return output.join'' );
			        },
		        /**
		         * Renders the combo.
		         * @param {CKEDITOR.editor} editor The editor instance which this button is
		         *        to be used by.
		         * @param {Array} output The output array to which append the HTML relative
		         *        to this button.
		         * @example
		         */
		        render : function( editoroutput )
		        {
			            var env CKEDITOR.env;
			            var id 'cke_' this.id;
			            var clickFn CKEDITOR.tools.addFunction( function( $element )
			                {
				                    var this._;
				                    if ( _.state == CKEDITOR.TRISTATE_DISABLED )
				                        return;
				                    this.createPaneleditor );
				                    if ( _.on )
				                    {
					                        _.panel.hide();
					                        return;
					                    }
				                    if ( !_.committed )
				                    {
					                        _.list.commit();
					                        _.committed 1;
					                    }
				                    var value this.getValue();
				                    if ( value )
				                        _.list.markvalue );
				                    else
				                        _.list.unmarkAll();
				                    _.panel.showBlockthis.id, new CKEDITOR.dom.element$element ), );
				                },
			                this );
			            var instance = {
				                id id,
				                combo this,
				                focus : function()
				                {
					                    var element CKEDITOR.document.getByIdid ).getChild);
					                    element.focus();
					                },
				                clickFn clickFn
				            };
			            editor.on'mode', function()
			                {
				                    this.setStatethis.modeseditor.mode ] ? CKEDITOR.TRISTATE_OFF CKEDITOR.TRISTATE_DISABLED );
				                },
			                this );
			            var keyDownFn CKEDITOR.tools.addFunction( function( evelement )
			                {
				                    ev = new CKEDITOR.dom.eventev );
				                    var keystroke ev.getKeystroke();
				                    switch ( keystroke )
				                    {
					                        case 13 :    // ENTER
					                        case 32 :    // SPACE
					                        case 40 :    // ARROW-DOWN
					                            // Show panel
					                            CKEDITOR.tools.callFunctionclickFnelement );
					                            break;
					                        default :
					                            // Delegate the default behavior to toolbar button key handling.
					                            instance.onkeyinstance,  keystroke );
					                    }
				                    // Avoid subsequent focus grab on editor document.
				                    ev.preventDefault();
				                });
			            // For clean up
			            instance.keyDownFn keyDownFn;
			            output.push(
			                '<span class="cke_rcombo">',
			                '<span id='id );
			            if ( this.className )
			                output.push' class="'this.className' cke_off"');
			            output.push(
			                '>',
			                    '<span id="' id'_label" class=cke_label>'this.label'</span>',
			                    '<a hidefocus=true title="'this.title'" tabindex="-1"',
			                        env.gecko && env.version >= 10900 && !env.hc '' ' href="javascript:void(\'' this.label '\')"',
			                        ' role="button" aria-labelledby="'id '_label" aria-describedby="'id'_text" aria-haspopup="true"' );
			            // Some browsers don't cancel key events in the keydown but in the
			            // keypress.
			            // TODO: Check if really needed for Gecko+Mac.
			            if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )
			            {
				                output.push(
				                    ' onkeypress="return false;
				"' );
				            }
			            // With Firefox, we need to force it to redraw, otherwise it
			            // will remain in the focus state.
			            if ( CKEDITOR.env.gecko )
			            {
				                output.push(
				                    ' onblur="this.style.cssText = this.style.cssText;
				"' );
				            }
			            output.push(
			                    ' onkeydown="CKEDITOR.tools.callFunction( 'keyDownFn', event, this );
			"' +
			                    ' onclick="CKEDITOR.tools.callFunction('clickFn', this);
			 return false;
			">' +
			                        '<span>' +
			                            '<span id="' id '_text" class="cke_text cke_inline_label">' this.label '</span>' +
			                        '</span>' +
			                        '<span class=cke_openbutton>' + ( CKEDITOR.env.hc '<span>&#9660;
			</span>' '' ) + '</span>' +    // BLACK DOWN-POINTING TRIANGLE
			                    '</a>' +
			                '</span>' +
			                '</span>' );
			            if ( this.onRender )
			                this.onRender();
			            return instance;
			        },
		        createPanel : function( editor )
		        {
			            if ( this._.panel )
			                return;
			            var panelDefinition this._.panelDefinition,
			                panelBlockDefinition this._.panelDefinition.block,
			                panelParentElement panelDefinition.parent || CKEDITOR.document.getBody(),
			                panel = new CKEDITOR.ui.floatPaneleditorpanelParentElementpanelDefinition ),
			                list = panel.addListBlockthis.idpanelBlockDefinition ),
			                me this;
			            panel.onShow = function()
			                {
				                    if ( me.className )
				                        this.element.getFirst().addClassme.className '_panel' );
				                    me.setStateCKEDITOR.TRISTATE_ON );
				                    list.focus( !me.multiSelect && me.getValue() );
				                    me._.on 1;
				                    if ( me.onOpen )
				                        me.onOpen();
				                };
			            panel.onHide = function()
			                {
				                    if ( me.className )
				                        this.element.getFirst().removeClassme.className '_panel' );
				                    me.setStateCKEDITOR.TRISTATE_OFF );
				                    me._.on 0;
				                    if ( me.onClose )
				                        me.onClose();
				                };
			            panel.onEscape = function()
			                {
				                    panel.hide();
				                    me.document.getById'cke_' me.id ).getFirst().getNext().focus();
				                };
			            list.onClick = function( valuemarked )
			                {
				                    // Move the focus to the main windows, otherwise it will stay
				                    // into the floating panel, even if invisible, and Safari and
				                    // Opera will go a bit crazy.
				                    me.document.getWindow().focus();
				                    if ( me.onClick )
				                        me.onClick.callmevaluemarked );
				                    if ( marked )
				                        me.setValuevalueme._.itemsvalue ] );
				                    else
				                        me.setValue'' );
				                    panel.hide();
				                };
			            this._.panel panel;
			            this._.list = list;
			            panel.getBlockthis.id ).onHide = function()
			                {
				                    me._.on 0;
				                    me.setStateCKEDITOR.TRISTATE_OFF );
				                };
			            if ( this.init )
			                this.init();
			        },
		        setValue : function( valuetext )
		        {
			            this._.value value;
			            var textElement this.document.getById'cke_' this.id '_text' );
			            if ( !( value || text ) )
			            {
				                text this.label;
				                textElement.addClass'cke_inline_label' );
				            }
			            else
			                textElement.removeClass'cke_inline_label' );
			            textElement.setHtmltypeof text != 'undefined' text value );
			        },
		        getValue : function()
		        {
			            return this._.value || '';
			        },
		        unmarkAll : function()
		        {
			            this._.list.unmarkAll();
			        },
		        mark : function( value )
		        {
			            this._.list.markvalue );
			        },
		        hideItem : function( value )
		        {
			            this._.list.hideItemvalue );
			        },
		        hideGroup : function( groupTitle )
		        {
			            this._.list.hideGroupgroupTitle );
			        },
		        showAll : function()
		        {
			            this._.list.showAll();
			        },
		        add : function( valuehtmltext )
		        {
			            this._.itemsvalue ] = text || value;
			            this._.list.addvaluehtmltext );
			        },
		        startGroup : function( title )
		        {
			            this._.list.startGrouptitle );
			        },
		        commit : function()
		        {
			            this._.list.commit();
			        },
		        setState : function( state )
		        {
			            if ( this._.state == state )
			                return;
			            this.document.getById'cke_' this.id ).setStatestate );
			            this._.state state;
			        }
		    }
	});
CKEDITOR.ui.prototype.addRichCombo = function( namedefinition )
{
	    this.addnameCKEDITOR.UI_RICHCOMBOdefinition );
	};





PHP Demo Source Code Index