Hi,
How easy is it to add a drop down list to the toolbar via a plugin - more specifically a drop down list that is populated from a database (using ASP.Net)
I can handle the .Net stuff, but am unsure how to add the drop down list to the toolbar.
Any help would be appreciated.
Cheers,
Julian
How easy is it to add a drop down list to the toolbar via a plugin - more specifically a drop down list that is populated from a database (using ASP.Net)
I can handle the .Net stuff, but am unsure how to add the drop down list to the toolbar.
Any help would be appreciated.
Cheers,
Julian
RE: Adding Drop Down List into toolbar via pl
Hi Marcus,
THanks for that, although the link you give doesn't seem to work, but managed to run with this:
https://sourceforge.net/tracker/index.p ... tid=737639
I'm ultimately wanting to generate the items in the drop down from the database, but instead of having it paste code into the editor I want to use it to launch a dialog and then pass the selected item id along with the selected text from the editor to the dialog.
The functionality of the dialog will then be determined by the selected item id from the drop down.
The sample you highlighted should give me a good starting point, many thanks for that.
Cheers,
Julian
RE: Adding Drop Down List into toolbar via pl
Take a look at this plugin example:
https://sourceforge.net/tracker/index.p ... tid=737639
To customise it with items from the database you can use a javascript array that is generated server side and included into the parent document. Change the plugin script where the items are added to the combo to refer to the javascript array and load the items like this:
for (var i = 0; i < parent.arrSpecialLinks.length; i++)
this._Combo.AddItem(parent.arrComboItems[i][0], parent.arrComboItems[i][1]);
...and the array itself would be something like:
arrComboItems = new Array(
new Array('<a href="[subscriberupdate]" target="_blank">Item 1 text to insert</a>', '<span style="text-decoration: underline;color: #0000FF;font-size: 9pt;">Item 1</span>')
, new Array('<a href="[memberreferral]" target="_blank">Item 2 text to insert</a>', '<span style="text-decoration: underline;color: #0000FF;font-size: 9pt;">Item 2</span>')
);
I hope this helps.
RE: Adding Drop Down List into toolbar via pl
I have been trying your plugin with the older version of FCKeditor and it worked great.
I have just switched to the new Beta 2.3 and I have troubles. In Firefox I have the following error and I have no idea how to get rid of it:
FCK.ToolbarSet.CurrentInstance.Commands.GetCommand(this.CommandName) has no properties
Can you help?
Thanks
RE: Adding Drop Down List into toolbar via pl
I to do had this prob with my custom plugin..it was fixed after i applied an ID on the form field
note: id="txtName"
<select id="txtName" name="txtName" style="WIDTH: 100%">
and in the js above it... (note the getbyid)
function Ok()
{
if ( document.getElementById('txtName').value.length == 0 )
{
alert( oEditor.FCKLang.DlgClassifyErrorName ) ;
return false ;
}
//oEditor.FCK.InsertHtml( '<a name="' + GetE('txtName').value + '"><\/a>' ) ;
oEditor.FCK.InsertHtml( '<b>'+ document.getElementById('txtName').value + '</b>  ' ) ;
return true ;
}
RE: Adding Drop Down List into toolbar via pl
Here is a full example of my plugin...in case it might not be clear
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fck_Classify.html
* Classify dialog window.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*
*
* This plugin create by Terry Remsik remsikt@gmail.com
-->
<html> <head> <title>Class Name Picker</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta content="noindex, nofollow" name="robots"> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var oEditor = window.parent.InnerDialogLoaded() ; // Gets the document DOM var oDOM = oEditor.FCK.EditorDocument ; var oActiveEl = oEditor.FCKSelection.GetSelectedElement() ; window.onload = function() { // First of all, translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage(document) ; if ( oActiveEl && oActiveEl.tagName == 'A' && oActiveEl.name.length > 0 && oActiveEl.getAttribute('href').length == 0 ) document.getElementById('txtName').value = oActiveEl.name ; else oActiveEl = null ; window.parent.SetOkButton( true ) ; } function Ok() { if ( document.getElementById('txtName').value.length == 0 ) { alert( oEditor.FCKLang.DlgClassErrorName ) ; return false ; } //oEditor.FCK.InsertHtml( '<a name="' + GetE('txtName').value + '"><\/a>' ) ; oEditor.FCK.InsertHtml( '<b>'+ document.getElementById('txtName').value + '</b>  ' ) ; return true ; } </script> </head> <body style="OVERFLOW: hidden" scroll="no"> <table height="100%" width="100%"> <tr> <td align="center"> <table border="0" cellpadding="0" cellspacing="0" width="80%"> <tr> <td> <span fckLang="ClassName">Class Picker</span><BR> <select id="txtName" name="txtName" style="WIDTH: 100%"> <option value="">----Class Picker----</option> <? while($row1=mssql_fetch_array($class_result2)) { echo "<option value=\"$row1[name]\">$row1[name]</option>"; }; ?> </select> </td> </tr> </table> </td> </tr> </table> </body> </html>
RE: Adding Drop Down List into toolbar via pl
RE: Adding Drop Down List into toolbar via pl
I had the same problem yesterday after upgrading to 2.3 Beta. It's pretty easy to fix.
After this line in the plugin:
this.Command=FCKCommands.GetCommand('mycombocommand');
add:
this.CommandName = 'mycombocommand';
I have updated the file attached to the Plugin (https://sourceforge.net/tracker/index.p ... tid=737639)
RE: Adding Drop Down List into toolbar via pl