Author: bpoussin Date: 2008-05-14 16:23:27 +0000 (Wed, 14 May 2008) New Revision: 31 Added: trunk/lutinrss/src/main/resources/fckeditor/ trunk/lutinrss/src/main/resources/fckeditor/editor/ trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/ trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/ trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/README.txt trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/button.rss.gif trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fck_rssinclude.html trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fck_rssinclude.js trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fckplugin.js trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/lang/ trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/lang/en.js trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/lang/fr.js Log: ajout du code pour le plugin fckeditor Added: trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/README.txt =================================================================== --- trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/README.txt (rev 0) +++ trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/README.txt 2008-05-14 16:23:27 UTC (rev 31) @@ -0,0 +1,14 @@ +This plugin was developped by Code Lutin + +Installation Instructions +1. Copy rssinclude directory into "editor/plugins/" +2. In fckconfig.js make the following additions; +3. add the following line after where "FCKConfig.PluginsPath" is defined + FCKConfig.Plugins.Add("rssinclude", "en,fr"); +4. Add 'rssinclude' to your toolsbarset in fckconfig.js. E.G., + + FCKConfig.ToolbarSets["Default"] = [ + ['rssinclude', 'Bold', 'Italic'] + ] ; + +Please let me know if you experience any issues. Added: trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/button.rss.gif =================================================================== (Binary files differ) Property changes on: trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/button.rss.gif ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fck_rssinclude.html =================================================================== --- trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fck_rssinclude.html (rev 0) +++ trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fck_rssinclude.html 2008-05-14 16:23:27 UTC (rev 31) @@ -0,0 +1,133 @@ +<!-- + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2004 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_image.html + * Image Properties dialog window. + * + * Version: 2.0 Beta 2 + * Modified: 2004-06-19 00:24:56 + * + * File Authors: + * hmlyons (hmlyons@users.sourceforge.net) + * Andrey Grebnev (andrey.grebnev@blandware.com) +--> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> + <head> + <title>Rss Include Properties</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta name="robots" content="noindex, nofollow"> + <script src="../../dialog/common/fck_dialog_common.js" type="text/javascript"></script> + <script src="fck_rssinclude.js" type="text/javascript"></script> + <link href="../../dialog/common/fck_dialog_common.css" rel="stylesheet" type="text/css" /> + <script type="text/javascript"> + <!-- + document.writeln(FCK.TempBaseTag); + + --> + </script> + <script src="http://rssinclude/lutinrss-1.0/rssinclude_1.js" type="text/javascript"></script> + </head> + <body scroll="no"> + <div id="divInfo"> + <table cellspacing="1" cellpadding="1" border="0" width="100%" height="100%"> + <tr> + <td> + <table cellspacing="0" cellpadding="0" width="100%" border="0"> + <tr> + <td valign="top" width="100%"> + <span fckLang="DlgRssincludeFeedName">name or URL</span><br> + <div id="divFeedName"> + <input style="WIDTH: 100%" type="text" id="txtFeedName" onblur="updatePreview();"> + </div> + <script type="text/javascript"> + <!-- + /** lors de la sortie, on fixe l'url du lien edit pour ce qui est selectionné */ + function changeEdit() { + var input = document.getElementById("txtFeedName"); + var a = document.getElementById('editFeed'); + a.href = configSiteURL + '?action=doRss&rssAction=edit&rss_id=' + escape(input.value); + } + // --> + </script> + <a id="editFeed" href='' fckLang="DlgRssincludeFeedNameEdit" target="_editFeed" onclick='changeEdit();'>Edit</a> + <a id="addFeed" href='' fckLang="DlgRssincludeFeedNameAdd" target="_addFeed">Add</a> + <script type="text/javascript"> + var a = document.getElementById('editFeed'); + a.href = configSiteURL + '?action=doRss&rssAction=edit'; + a = document.getElementById('addFeed'); + a.href = configSiteURL + '?action=doRss&rssAction=edit'; + </script> + </td> + </tr> + </table> + <hr width="100%" color="#000000" size="2"> + </td> + </tr> + <tr height="100%"> + <td valign="top"> + <table cellspacing="0" cellpadding="0" width="100%" border="0" height="100%"> + <tr> + <td height="140" valign="top"> + <br> + <table cellspacing="2" cellpadding="1" border="0"> + <tr> + <td><span fckLang="DlgRssincludeNbItem">Item's number</span> </td> + <td><input type="text" size="3" id="txtNbItem" onblur="updatePreview();"></td> + </tr> + <tr> + <td><span fckLang="DlgRssincludeFeedRepr">feed representation</span> </td> + <td><input type="text" size="10" id="txtFeedRepr" onblur="updatePreview();"></td> + </tr> + </table> + </td> + <td> </td> + <td width="100%" valign="top"> + <table cellpadding="0" cellspacing="0"> + <tr> + <td><span fckLang="DlgImgPreview">Preview</span></td> + </tr> + <tr> + <td valign="top"> + <div class="ImagePreviewArea"> + <div + id="rssincludePreview" + name="rssinclude" + class="rssinclude"> + </div> + + Magnus es, domine, et laudabilis + valde: magna virtus tua, et sapientiae tuae non est numerus. et laudare te vult + homo, aliqua portio creaturae tuae, et homo circumferens mortalitem suam, + circumferens testimonium peccati sui et testimonium, quia superbis resistis: et + tamen laudare te vult homo, aliqua portio creaturae tuae.tu excitas, ut laudare + te delectet, quia fecisti nos ad te et inquietum est cor nostrum, donec + requiescat in te. da mihi, domine, scire et intellegere, utrum sit prius + invocare te an laudare te, et scire te prius sit an invocare te. sed quis te + invocat nesciens te? aliud enim pro alio potest invocare nesciens. an potius + invocaris, ut sciaris? quomodo autem invocabunt, in quem non crediderunt? aut + quomodo credent sine praedicante? et laudabunt dominum qui requirunt eum. + quaerentes enim inveniunt eum et invenientes laudabunt eum. quaeram te, domine, + invocans te, et invocem te credens in te: praedicatus enim es nobis. invocat + te, domine, fides mea, quam dedisti mihi, quam inspirasti mihi per humanitatem + filii tui, per ministerium praedicatoris tui. + </div> + </td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </table> + </div> + </body> +</html> Added: trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fck_rssinclude.js =================================================================== --- trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fck_rssinclude.js (rev 0) +++ trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fck_rssinclude.js 2008-05-14 16:23:27 UTC (rev 31) @@ -0,0 +1,144 @@ +var dialog = window.parent ; +var oEditor = dialog.InnerDialogLoaded() ; +var FCK = oEditor.FCK ; +var FCKLang = oEditor.FCKLang ; +var FCKConfig = oEditor.FCKConfig ; +var FCKTools = oEditor.FCKTools ; + +// L'url du service web permettant de recuperer les Feeds configures +var configSiteURL = '/srvwebsiteworkshop'; + +// Set the language direction. +window.document.dir = oEditor.FCKLang.Dir ; + +// Recuperation du feed selectionne +var oRss = dialog.Selection.GetSelectedElement() ; + +// Un peu de travail au chargement de la page +window.onload = function() +{ + // Translate the dialog box texts. + oEditor.FCKLanguageManager.TranslatePage(document) ; + + // chargement de la comba avec les feeds configures + LoadCombo(); + + // Load the selected element information (if any). + LoadSelection() ; + + // Activate the "OK" button. + window.parent.SetOkButton( true ) ; + + SelectField( 'txtFeedName' ) ; +} + +/** + * Remplace le textfield de saisie du nom d'un feed par une combo. + * Cela n'est fait que si le serveur peut etre contacte + */ +function LoadCombo() { + var xhr = null; + if(window.XMLHttpRequest) // Firefox + xhr = new window.XMLHttpRequest(); + else if(window.ActiveXObject) // Internet Explorer + xhr = new window.ActiveXObject("Microsoft.XMLHTTP"); + + if (xhr) { + var url = configSiteURL + "?action=doRss&rssAction=optionList&template=" + escape("<option id='%1' value='%1'>%2</option>"); + xhr.open("GET", url, false); + xhr.onreadystatechange = function() { + if(xhr.readyState == 4) { + if (xhr.status == 200) /* 200 : code HTTP pour OK */ + { + var div = document.getElementById("divFeedName"); + div.innerHTML = '<select style="WIDTH: 100%" id="txtFeedName" onblur="updatePreview();">' + + xhr.responseText + + '</input>'; + if (oRss) { + // on selectionne l'ancienne valeur + GetE('txtFeedName').value = GetAttribute( oRss, 'feedName', '' ); + } + } + } + } + xhr.send(null); + } +} + +/** + * Chargement du feed que l'on re-edite + */ +function LoadSelection() { + if (! oRss) return; + + GetE('txtFeedName').value = GetAttribute( oRss, 'feedName', '' ); + GetE('txtNbItem').value = GetAttribute( oRss, 'nbItem', '' ); + GetE('txtFeedRepr').value = GetAttribute( oRss, 'feedRepr', '' ); + + updatePreview(); +} + +/** + * Fonction appeler lors de la validation + */ +function Ok() +{ + if ( GetE('txtFeedName').value.length == 0 ) + { + GetE('txtFeedName').focus() ; + + alert( oEditor.FCKLang.DlgRssincludeAlertFeedName ) ; + return false ; + } + + oEditor.FCKUndo.SaveUndoStep() ; + if ( !oRss ) + { + oRss = FCK.InsertElement( 'DIV' ) ; + oScript = FCK.InsertElement('SCRIPT'); + SetAttribute( oScript, 'src', 'http://rssinclude/lutinrss-1.0/rssinclude_1.js'); + } + updateRss( oRss ) ; + + rssincludeUpdateDiv(oRss, false); + return true ; +} + +/** + * Mise a jour d'un div avec les informations trouvees dans l'interface + */ +function updateRss(e){ + e.contentEditable = false ; + + SetAttribute( e, 'class', 'rssinclude'); + SetAttribute( e, 'name', 'rssinclude'); + SetAttribute( e, 'feedName', GetE('txtFeedName').value ); + SetAttribute( e, 'nbItem', GetE('txtNbItem').value ); + SetAttribute( e, 'feedRepr', GetE('txtFeedRepr').value ); + e.innerHTML = 'RSS ' + GetE('txtFeedName').value; + e.style.backgroundColor = '#ffff00' ; +} + +// L'element servant a la preview +var ePreview ; + +/** + * Mise a jour du flux dans la preview + */ +function updatePreview(){ + + if ( !ePreview ) { + ePreview = GetE('rssincludePreview') ; + } + + if ( ! ePreview) { + return; + } + + if ( GetE('txtFeedName').value.length == 0 ) { + ePreview.innerHTML = 'Invalid RSS' ; + } else { + updateRss(ePreview); + rssincludeUpdateDiv(ePreview, true, true); + } +} Added: trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fckplugin.js =================================================================== --- trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fckplugin.js (rev 0) +++ trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fckplugin.js 2008-05-14 16:23:27 UTC (rev 31) @@ -0,0 +1,53 @@ +// Register the related commands. +var dialogPath = FCKConfig.PluginsPath + 'rssinclude/fck_rssinclude.html'; +var rssincludeDialogCmd = new FCKDialogCommand( FCKLang["DlgRssincludeTitle"], FCKLang["DlgRssincludeTitle"], dialogPath, 480, 470 ); +FCKCommands.RegisterCommand( 'rssinclude', rssincludeDialogCmd ) ; + +// Create the Rssinclude toolbar button. +var oRssincludeItem = new FCKToolbarButton( 'rssinclude', FCKLang["DlgRssincludeTitle"]) ; +oRssincludeItem.IconPath = FCKConfig.PluginsPath + 'rssinclude/button.rss.gif' ; + +FCKToolbarItems.RegisterItem( 'rssinclude', oRssincludeItem ) ; +// 'Rssinclude' is the name used in the Toolbar config. + +FCK.ContextMenu.RegisterListener( { + AddItems : function( menu, tag, tagName ) { + var e = tag; + if (! (e && e.nodeName == 'DIV' && e.getAttribute('class') == 'rssinclude' )) { + var selection = FCKSelection.GetSelection() ; + var range = selection.getRangeAt(0) ; + e = range.endContainer ; + while (e && (e.nodeName != 'DIV' || e.getAttribute('class') != 'rssinclude')) { + e = e.parentNode; + } + } + + // under what circumstances do we display this option + if (!!e && e.nodeName == 'DIV' && e.getAttribute('class') == 'rssinclude' ) { + FCKSelection.SelectNode(e); + // when the option is displayed, show a separator the command + menu.AddSeparator() ; + // the command needs the registered command name, the title for the context menu, and the icon path + menu.AddItem( 'rssinclude', FCKLang.DlgRssincludeTitle, oRssincludeItem.IconPath ) ; + } + } +} ); + +/** +OnClick = function( e ) +{ + if ( e.target.tagName == 'DIV' && e.target.getAttribute('class') == 'rssinclude' ) + FCKSelection.SelectNode( e.target ) ; +} + +FCK.EditorDocument.addEventListener( 'click', OnClick, true ) ; +**/ + +OnDoubleClick = function( e ) { + if ( e.tagName == 'DIV' && e.getAttribute('class') == 'rssinclude' ) { + FCKSelection.SelectNode(e); + FCKCommands.GetCommand( 'rssinclude' ).Execute() ; + } +} + +FCK.RegisterDoubleClickHandler( OnDoubleClick, 'DIV' ) ; Added: trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/lang/en.js =================================================================== --- trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/lang/en.js (rev 0) +++ trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/lang/en.js 2008-05-14 16:23:27 UTC (rev 31) @@ -0,0 +1,9 @@ +// Rssinclude Dialog +FCKLang["DlgRssincludeTitle"] = "Rss Include"; +FCKLang["DlgRssincludeFeedName"] = "name or URL" ; +FCKLang["DlgRssincludeFeedNameEdit"] = "Edit" ; +DFCKLang["DlgRssincludeFeedNameAdd"] = "Add" ; +FCKLang["DlgRssincludeNbItem"] = "item's number" ; +FCKLang["DlgRssincludeFeedRepr"] = "Feed representation" ; +FCKLang["DlgRssincludeAlertFeedName"] = "Please input the feed name or feed URL" +FCKLang["DlgRssincludeLoading"] = "Loading rss..." Added: trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/lang/fr.js =================================================================== --- trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/lang/fr.js (rev 0) +++ trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/lang/fr.js 2008-05-14 16:23:27 UTC (rev 31) @@ -0,0 +1,9 @@ +// Rssinclude Dialog +FCKLang["DlgRssincludeTitle"] = "Rss Include"; +FCKLang["DlgRssincludeFeedName"] = "nom ou URL" ; +FCKLang["DlgRssincludeFeedNameEdit"] = "Edition" ; +DFCKLang["DlgRssincludeFeedNameAdd"] = "Ajout" ; +FCKLang["DlgRssincludeNbItem"] = "nombre d'item" ; +FCKLang["DlgRssincludeFeedRepr"] = "Feed representation" ; +FCKLang["DlgRssincludeAlertFeedName"] = "Veuillez entrer un nom ou une URL pour le feed" +FCKLang["DlgRssincludeLoading"] = "Chargement du rss..."