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

PHP Demo Application - Source Code

/Framework/Model/Vendor/CkEditor/_source/plugins/listblock/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'listblock',
{
	    requires : [ 'panel' ],
	    onLoad : function()
	    {
		        CKEDITOR.ui.panel.prototype.addListBlock = function( namedefinition )
		        {
			            return this.addBlockname, new CKEDITOR.ui.listBlockthis.getHolderElement(), definition ) );
			        };
		        CKEDITOR.ui.listBlock CKEDITOR.tools.createClass(
		            {
			                base CKEDITOR.ui.panel.block,
			                $ : function( blockHolderblockDefinition )
			                {
				                    blockDefinition blockDefinition || {};
				                    var attribs blockDefinition.attributes || ( blockDefinition.attributes {} );
				                    ( this.multiSelect = !!blockDefinition.multiSelect ) &&
				                        ( attribs'aria-multiselectable' ] = true );
				                    // Provide default role of 'listbox'.
				                    !attribs.role && ( attribs.role 'listbox' );
				                    // Call the base contructor.
				                    this.base.applythisarguments );
				                    var keys this.keys;
				                    keys40 ]    = 'next';
				                    // ARROW-DOWN
				                    keys]    = 'next';
				                    // TAB
				                    keys38 ]    = 'prev';
				                    // ARROW-UP
				                    keysCKEDITOR.SHIFT ]    = 'prev';
				    // SHIFT + TAB
				                    keys32 ]    = 'click';
				                    // SPACE
				                    this._.pendingHtml [];
				                    this._.items {};
				                    this._.groups {};
				                },
			                :
			                {
				                    close : function()
				                    {
					                        if ( this._.started )
					                        {
						                            this._.pendingHtml.push'</ul>' );
						                            delete this._.started;
						                        }
					                    },
				                    getClick : function()
				                    {
					                        if ( !this._.click )
					                        {
						                            this._.click CKEDITOR.tools.addFunction( function( value )
						                                {
							                                    var marked true;
							                                    if ( this.multiSelect )
							                                        marked this.togglevalue );
							                                    else
							                                        this.markvalue );
							                                    if ( this.onClick )
							                                        this.onClickvaluemarked );
							                                },
						                                this );
						                        }
					                        return this._.click;
					                    }
				                },
			                proto :
			                {
				                    add : function( valuehtmltitle )
				                    {
					                        var pendingHtml this._.pendingHtml,
					                            id 'cke_' CKEDITOR.tools.getNextNumber();
					                        if ( !this._.started )
					                        {
						                            pendingHtml.push'<ul role="presentation" class=cke_panel_list>' );
						                            this._.started 1;
						                            this._.size this._.size || 0;
						                        }
					                        this._.itemsvalue ] = id;
					                        pendingHtml.push(
					                            '<li id='id' class=cke_panel_listItem>' +
					                                '<a id="'id'_option" _cke_focus=1 hidefocus=true' +
					                                    ' title="'title || value'"' +
					                                    ' href="javascript:void(\''value'\')"' +
					                                    ' onclick="CKEDITOR.tools.callFunction('this._.getClick(), ',\''value'\');
					 return false;
					"',
					                                    ' role="option"' +
					                                    ' aria-posinset="' + ++this._.size '">',
					                                    html || value,
					                                '</a>' +
					                            '</li>' );
					                    },
				                    startGroup : function( title )
				                    {
					                        this._.close();
					                        var id 'cke_' CKEDITOR.tools.getNextNumber();
					                        this._.groupstitle ] = id;
					                        this._.pendingHtml.push'<h1 role="presentation" id='id' class=cke_panel_grouptitle>'title'</h1>' );
					                    },
				                    commit : function()
				                    {
					                        this._.close();
					                        this.element.appendHtmlthis._.pendingHtml.join'' ) );
					                        var items this._.items,
					                            doc this.element.getDocument();
					                        for ( var value in items )
					                            doc.getByIditemsvalue ] + '_option' ).setAttribute'aria-setsize'this._.size );
					                        delete this._.size;
					                        this._.pendingHtml [];
					                    },
				                    toggle : function( value )
				                    {
					                        var isMarked this.isMarkedvalue );
					                        if ( isMarked )
					                            this.unmarkvalue );
					                        else
					                            this.markvalue );
					                        return !isMarked;
					                    },
				                    hideGroup : function( groupTitle )
				                    {
					                        var group this.element.getDocument().getByIdthis._.groupsgroupTitle ] ),
					                            list = group && group.getNext();
					                        if ( group )
					                        {
						                            group.setStyle'display''none' );
						                            if ( list && list.getName() == 'ul' )
						                                list.setStyle'display''none' );
						                        }
					                    },
				                    hideItem : function( value )
				                    {
					                        this.element.getDocument().getByIdthis._.itemsvalue ] ).setStyle'display''none' );
					                    },
				                    showAll : function()
				                    {
					                        var items this._.items,
					                            groups this._.groups,
					                            doc this.element.getDocument();
					                        for ( var value in items )
					                        {
						                            doc.getByIditemsvalue ] ).setStyle'display''' );
						                        }
					                        for ( var title in groups )
					                        {
						                            var group doc.getByIdgroupstitle ] ),
						                                list = group.getNext();
						                            group.setStyle'display''' );
						                            if ( list && list.getName() == 'ul' )
						                                list.setStyle'display''' );
						                        }
					                    },
				                    mark : function( value )
				                    {
					                        if ( !this.multiSelect )
					                            this.unmarkAll();
					                        var itemId this._.itemsvalue ],
					                            item this.element.getDocument().getByIditemId );
					                        item.addClass'cke_selected' );
					                        this.element.getDocument().getByIditemId '_option' ).setAttribute'aria-selected'true );
					                        this.element.setAttribute'aria-activedescendant'itemId '_option' );
					                        this.onMark && this.onMarkitem );
					                    },
				                    unmark : function( value )
				                    {
					                        this.element.getDocument().getByIdthis._.itemsvalue ] ).removeClass'cke_selected' );
					                        this.onUnmark && this.onUnmarkthis._.itemsvalue ] );
					                    },
				                    unmarkAll : function()
				                    {
					                        var items this._.items,
					                            doc this.element.getDocument();
					                        for ( var value in items )
					                        {
						                            doc.getByIditemsvalue ] ).removeClass'cke_selected' );
						                        }
					                        this.onUnmark && this.onUnmark();
					                    },
				                    isMarked : function( value )
				                    {
					                        return this.element.getDocument().getByIdthis._.itemsvalue ] ).hasClass'cke_selected' );
					                    },
				                    focus : function( value )
				                    {
					                        this._.focusIndex = -1;
					                        if ( value )
					                        {
						                            var selected this.element.getDocument().getByIdthis._.itemsvalue ] ).getFirst();
						                            var links this.element.getElementsByTag'a' ),
						                                link,
						                                = -1;
						                            while ( ( link links.getItem( ++) ) )
						                            {
							                                if ( link.equalsselected ) )
							                                {
								                                    this._.focusIndex i;
								                                    break;
								                                }
							                            }
						                            setTimeout( function()
						                                {
							                                    selected.focus();
							                                },
						                                );
						                        }
					                    }
				                }
			            });
		    }
	});





PHP Demo Source Code Index