[Lutinweb-commits] r54 - trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude
Author: tchemit Date: 2008-05-18 21:11:18 +0000 (Sun, 18 May 2008) New Revision: 54 Modified: trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fck_rssinclude.js Log: chargement dynamique du script d'update rss ajout de TODO reformat Modified: trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fck_rssinclude.js =================================================================== --- trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fck_rssinclude.js 2008-05-18 21:07:58 UTC (rev 53) +++ trunk/lutinrss/src/main/resources/fckeditor/editor/plugins/rssinclude/fck_rssinclude.js 2008-05-18 21:11:18 UTC (rev 54) @@ -8,6 +8,9 @@ // Set the language direction. window.document.dir = oEditor.FCKLang.Dir; +// load rssinclude script +document.writeln("<script type=\"text/javascript\" src=\""+FCKConfig.RssScriptURL+"\"></script>"); + // Recuperation du feed selectionne var oRss = dialog.Selection.GetSelectedElement(); @@ -16,7 +19,7 @@ { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document); - + // chargement de la comba avec les feeds configures LoadCombo(); @@ -78,38 +81,41 @@ { if ( GetE('txtFeedName').value.length == 0 ) { - GetE('txtFeedName').focus() ; + GetE('txtFeedName').focus(); - alert( oEditor.FCKLang.DlgRssincludeAlertFeedName ) ; + alert( oEditor.FCKLang.DlgRssincludeAlertFeedName ); return false ; } - - oEditor.FCKUndo.SaveUndoStep() ; + + oEditor.FCKUndo.SaveUndoStep(); if ( !oRss ) { oRss = FCK.InsertElement( 'DIV' ) ; + //TODO Il faut detecter si le script est deja present, + // car ajouter n script va provoquer n chargements... oScript = FCK.InsertElement('SCRIPT'); SetAttribute( oScript, 'src', FCKConfig.RssScriptURL); } - updateRss( oRss ) ; - - rssincludeUpdateDiv(oRss, false); - return true ; + 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 ; - + 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 ); - SetAttribute( e, 'forceReload', 'true' ); - e.innerHTML = 'RSS ' + GetE('txtFeedName').value; + //SetAttribute( e, 'forceReload', 'true' ); + e.innerHTML = 'RSS ' + GetE('txtFeedName').value + ' (items:'+GetE('txtNbItem').value+')'; + //TODO Il faudrait utiliser une class css, afin de ne pas poluer le contenu final e.style.backgroundColor = '#ffff00' ; } @@ -122,7 +128,7 @@ function updatePreview(){ if ( !ePreview ) { - ePreview = GetE('rssincludePreview') ; + ePreview = GetE('rssincludePreview'); } if ( ! ePreview) { @@ -130,7 +136,7 @@ } if ( GetE('txtFeedName').value.length == 0 ) { - ePreview.innerHTML = 'Invalid RSS' ; + ePreview.innerHTML = 'Invalid RSS'; } else { updateRss(ePreview); rssincludeUpdateDiv(ePreview, true);
participants (1)
-
tchemit@users.labs.libre-entreprise.org