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

PHP Demo Application - Source Code

/Framework/Model/Vendor/CkEditor/_source/plugins/link/dialogs/anchor.js



/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.dialog.add'anchor', function( editor )
{
	    // Function called in onShow to load selected element.
	    var loadElements = function( editorselectionelement )
	    {
		        this.editMode true;
		        this.editObj element;
		        var attributeValue this.editObj.getAttribute'name' );
		        if ( attributeValue )
		            this.setValueOf'info','txtName'attributeValue );
		        else
		            this.setValueOf'info','txtName'"" );
		    };
	    return {
		        title editor.lang.anchor.title,
		        minWidth 300,
		        minHeight 60,
		        onOk : function()
		        {
			            // Always create a new anchor, because of IE BUG.
			            var name this.getValueOf'info''txtName' ),
			                element CKEDITOR.env.ie ?
			                editor.document.createElement'<a name="' CKEDITOR.tools.htmlEncodename ) + '">' ) :
			                editor.document.createElement'a' );
			            // Move contents and attributes of old anchor to new anchor.
			            if ( this.editMode )
			            {
				                this.editObj.copyAttributeselement, { name 1
					} );
				                this.editObj.moveChildrenelement );
				            }
			            // Set name.
			            element.removeAttribute'_cke_saved_name' );
			            element.setAttribute'name'name );
			            // Insert a new anchor.
			            var fakeElement editor.createFakeElementelement'cke_anchor''anchor' );
			            if ( !this.editMode )
			                editor.insertElementfakeElement );
			            else
			            {
				                fakeElement.replacethis.fakeObj );
				                editor.getSelection().selectElementfakeElement );
				            }
			            return true;
			        },
		        onShow : function()
		        {
			            this.editObj false;
			            this.fakeObj false;
			            this.editMode false;
			            var selection editor.getSelection();
			            var element selection.getSelectedElement();
			            if ( element && element.getAttribute'_cke_real_element_type' ) && element.getAttribute'_cke_real_element_type' ) == 'anchor' )
			            {
				                this.fakeObj element;
				                element editor.restoreRealElementthis.fakeObj );
				                loadElements.applythis, [ editorselectionelement ] );
				                selection.selectElementthis.fakeObj );
				            }
			            this.getContentElement'info''txtName' ).focus();
			        },
		        contents : [
		            {
			                id 'info',
			                label editor.lang.anchor.title,
			                accessKey 'I',
			                elements :
			                [
			                    {
				                        type 'text',
				                        id 'txtName',
				                        label editor.lang.anchor.name,
				                        requiredtrue,
				                        validate : function()
				                        {
					                            if ( !this.getValue() )
					                            {
						                                alerteditor.lang.anchor.errorName );
						                                return false;
						                            }
					                            return true;
					                        }
				                    }
			                ]
			            }
		        ]
		    };
	} );





PHP Demo Source Code Index