Hi I want to integrate the ckeditor into my small CMS. And I want to add a new option for internal sitelinks in the Link-Dialog is there any tutorial where I can read more about developing with/for ckeditor?
Thu, 09/03/2009 - 17:47
#1

Re: Additional Dialogs
First:
Second:
Third:
{ type : 'vbox', id : 'cmsOptions', padding : 1, children : [ { type : 'html', html : '<span>I am here - did I appear?</span>' }, ] }Fourth:
children: [ { type : 'html', html : '<span>I am here - did I appear?</span>' }, { type : 'text', id : 'cmsId', label : 'Your CMS Link', setup : function ( data ) { if( data.cms) this.setValue( data.cms.cmsId); } commit : function ( data ) { data.cms.cmsId = this.getValue(); } }, { type : 'button', id : 'browseCMS', label : editor.lang.link.cmsBrowse, onClick : function() { var dialog = this.getDialog(); var editor = dialog.getParentEditor(); editor._.filebrowserSe = this; var width = '80%'; var height = '70%'; var params = {};//this.filebrowser.params || {}; params.CKEditor = editor.name; params.CKEditorFuncNum = editor._.filebrowserFn; if ( !params.langCode ) params.langCode = editor.langCode; var tempurl = editor.config.filebrowser_cmsbrowse; var url = addQueryString( tempurl, params ); editor.popup( url, width, height ); }, filebrowser : 'info:cmsId' } ]function addQueryString( url, params ) { var queryString = []; if ( !params ) return url; else { for ( var i in params ) queryString.push( i + "=" + encodeURIComponent( params[ i ] ) ); } return url + ( ( url.indexOf( "?" ) != -1 ) ? "&" : "?" ) + queryString.join( "&" ); };Fifth:
var parseLink = function( editor, element ) { var href = element ? ( element.getAttribute( '_cke_saved_href' ) || element.getAttribute( 'href' ) ) : '', emailMatch = '', anchorMatch = '', urlMatch = false, cmsMatch = '', retval = {}; if ( href ) { emailMatch = href.match( emailRegex ); anchorMatch = href.match( anchorRegex ); urlMatch = href.match( urlRegex ); cmsMatch = href.match( cmsRegex ); } // Load the link type and URL. if ( emailMatch ) { var subjectMatch = href.match( emailSubjectRegex ), bodyMatch = href.match( emailBodyRegex ); retval.type = 'email'; retval.email = {}; retval.email.address = emailMatch[1]; subjectMatch && ( retval.email.subject = decodeURIComponent( subjectMatch[1] ) ); bodyMatch && ( retval.email.body = decodeURIComponent( bodyMatch[1] ) ); } else if ( anchorMatch ) { retval.type = 'anchor'; retval.anchor = {}; retval.anchor.name = retval.anchor.id = anchorMatch[1]; } else if ( cmsMatch ) { retval.type = 'cms'; retval.cms = {}; retval.cms.cmsId = cmsMatch[2]; retval.cms.wmsprefix = cmsMatch[1]; } else if ( href && urlMatch ) // urlRegex matches empty strings, so need to check for href as well. { retval.type = 'url'; retval.url = {}; retval.url.protocol = urlMatch[1]; retval.url.url = urlMatch[2]; } else retval.type = 'url';Sixth:
Re: Additional Dialogs
If you could show the sample code for the php or perl script that generates the set of cms links and the js code for how to trigger the right method in the opener once you select a cms link, that would be great.
Re: Additional Dialogs
I think cms.data is not even defined......
quite urgent guys.
Re: Additional Dialogs
if ( !data.cms ) data.cms = {};to the commit block.Re: Additional Dialogs
Unfortunately, I'm having trouble getting started though - in Step 1, when I add my new element to the linktype in /_source/plugins/link/dialogs/link.js as follows:
I save and reload the page, but the items in the linkType dropdown have not changed - they remain:
"URL"
"Link to anchor in the text"
"E-mail"
Obviously I need to get this part working before moving on to step two. Any suggestions? Is there another file that needs to be changed or refreshed in order to get the changes to appear?
Thanks in advance!
Re: Additional Dialogs
Added this to _source/lang/en.js ('en' is set as the language in config.js - even though it should be defaulting) :
And this to _source/plugins/link/dialogs/link.js :
Re: Additional Dialogs
Re: Additional Dialogs
{ type : 'button', id : 'browseCMS', label : "Find cms article...", onClick : function() { var dialog = this.getDialog(); var editor = dialog.getParentEditor(); editor._.filebrowserSe = this; var width = '80%'; var height = '70%'; var params = {};//this.filebrowser.params || {}; params.CKEditor = editor.name; params.CKEditorFuncNum = editor._.filebrowserFn; if ( !params.langCode ) params.langCode = editor.langCode; var tempurl = editor.config.filebrowserCmsBrowseUrl; var url = addQueryString( tempurl, params ); editor.popup( tempurl, width, height ); } ,filebrowser : 'info:cmsId' }filebrowser : 'info:cmsId'
filebrowser : { action : 'Browse', url : a.config.filebrowserCmsBrowseUrl // this set correct path to page }edit: i use this solution: viewtopic.php?f=11&t=18327
Re: Additional Dialogs
I am developing a CMS and I need help with the code in this topic. My article pages will be stored in mysql. Is there any way, I can populate a list from the db.
Let me know if it is possible and if anyone can help me with the code.
Thanks,
Darshan