Modificare il file:
\FckEditor\plugins\snippets\SnippetsBrowse.asp
<!-- * 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/ * * "Support Open Source software. What about a donation today?" * * File Name: SnippetBrowse.html * Snippet selection dialog window. * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) * Modified by greggp (greggp@pobox.com) --> <% SnippetFolder = request("SnippetFolder") 'SnippetFolder = "/Public/Snippets" SnippetFileName = "snippets.xml" if right(SnippetFolder,1)<>"/" then SnippetFolder = SnippetFolder & "/" end if SnippetPath = server.MapPath(SnippetFolder & SnippetFileName) 'response.Clear() 'response.write SnippetPath 'response.End() set Fs = server.CreateObject("Scripting.FileSystemObject") VerifyFileExists() Dim objSnippets set objSnippets = getSnippetsList() function getSnippetsList() dim objXML on error resume next Set objXML = Server.CreateObject("Microsoft.XMLDOM") if err <> 0 then response.Clear() response.write "You need XML services installed on this server...See <a href='http://www.microsoft.com/xml'>http://www.microsoft.com/xml</a> for more information..." response.end end if on error goto 0 objXML.validateOnParse = True objXML.async = False objXML.load(SnippetPath) set getSnippetsList = objXML.getElementsByTagName("Snippets") set objXML = nothing end function function VerifyFileExists() if not Fs.FileExists(SnippetPath) then set myFile = Fs.OpenTextFile(SnippetPath,2,true) myFile.writeLine("<?xml version=" & chr(34) & "1.0" & chr(34) & " encoding=" & chr(34) & "utf-8" & chr(34) & " ?>" & vbcrlf) myFile.writeLine("<Snippets>" & vbcrlf) myFile.writeLine("</Snippets>" & vbcrlf) myFile.close set myFile = nothing end if end function %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="robots" content="noindex, nofollow"> <style> .TplList { border: #dcdcdc 2px solid; background-color: #ffffff; overflow: auto; width: 90%; } .TplItem { margin: 5px; padding: 7px; border: #eeeeee 1px solid; } .TplItem TABLE { display: inline; } .TplTitle { font-weight: bold; } .PopupSelectionBox { border: #ff9933 1px solid; background-color: #fffacd; cursor: pointer; cursor: hand; } </style> <script language="javascript"> var oEditor = window.parent.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; var oEditor = window.parent.InnerDialogLoaded() ; var oDOM = oEditor.FCK.EditorDocument ; var oActiveEl = oEditor.FCKSelection.GetSelectedElement() ; <% if request.QueryString("Oper") = "AddToEditor" then J = clng(request.QueryString("IdSnippet")) 'response.Clear() 'response.write objSnippets(0).childNodes.length 'response.End() SnippetHTML = objSnippets(0).childNodes(J).childNodes(1).childNodes(0).text SnippetHTML = replace(SnippetHTML,"'","@_apici_@") SnippetHTML = replace(SnippetHTML,vbcrlf,"@_vbcrlf_@") SnippetHTML = replace(SnippetHTML,vbcr,"@_vbcr_@") SnippetHTML = replace(SnippetHTML,vblf,"@_vblf_@") SnippetHTML = replace(SnippetHTML,vbtab,"@_vbtab_@") %> var oSnippet = new Object() ; // Add a new placeholder at the actual selection. oSnippet.Add = function( html ) { var oSpan = FCK.CreateElement( 'DIV' ) ; this.SetupSpan( oSpan, html ) ; } oSnippet.SetupSpan = function( span, html ) { span.innerHTML = html ; } oEditor.FCKUndo.SaveUndoStep() ; //alert("If this wasn't in beta, the snippet code would have been loaded.") ; //oActiveEl = oEditor.FCK.EditorDocument.createElement( 'SPAN' ) ; //FCK.SetHTML( FCK._Snippets[index].Html ) ; var SnippetHTML = '<%=SnippetHTML%>' SnippetHTML = SnippetHTML.replace(/@_apici_@/gi,"'") SnippetHTML = SnippetHTML.replace(/@_vbcrlf_@/gi,'\n') SnippetHTML = SnippetHTML.replace(/@_vbcr_@/gi,'\n') SnippetHTML = SnippetHTML.replace(/@_vblf_@/gi,'\n') SnippetHTML = SnippetHTML.replace(/@_vbtab_@/gi,'\t') oSnippet.Add( SnippetHTML ) ; top.close() //window.parent.Cancel() ; <% response.write("</sc" & "ript>") response.End() end if %> window.onload = function() { // Set the right box height (browser dependent). GetE('eList').style.height = document.all ? '100%' : '295px' ; // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; window.parent.SetAutoSize( true ) ; if(location.href.indexOf("Back=yes")==-1){ window.parent.document.getElementById("ExtraButton").innerHTML += ' <input type="button" style=" WIDTH: 120px" class="Button" value="' + FCKLang.SnippetsBtn + '" onClick="frmMain.addSnippet()" />' }else{ window.parent.document.getElementById("ExtraButton").style.visibility = "visible" } //LoadSnippetsXml() ; } function addSnippet(){ window.parent.document.getElementById("ExtraButton").style.visibility = "hidden" location.href = FCKConfig.PluginsPath + "snippets/SnippetManager.asp?Oper=add&SnippetFolder=" + FCKConfig.SnippetsXmlPath } var modClick = false; function modSnippet(id){ modClick = true; window.parent.document.getElementById("ExtraButton").style.visibility = "hidden" location.href = "SnippetManager.asp?IdSnippet=" + id + "&SnippetFolder=" + FCKConfig.SnippetsXmlPath } //object setup //we put the entire snippen into a span tag /* var oSnippet = new Object() ; // Add a new placeholder at the actual selection. oSnippet.Add = function( html ) { var oSpan = FCK.CreateElement( 'SPAN' ) ; this.SetupSpan( oSpan, html ) ; } oSnippet.SetupSpan = function( span, html ) { span.innerHTML = html ; } function LoadSnippetsXml() { if ( !FCK._Snippets ) { GetE('eLoading').style.display = '' ; // Create the Snippets array. FCK._Snippets = new Array() ; // Load the XML file. var oXml = new oEditor.FCKXml() ; oXml.LoadUrl( FCKConfig.SnippetsXmlPath + 'Snippets.xml' ) ; // Get the Images Base Path. var sImagesBasePath = FCKConfig.PluginsPath + "snippets/images/" ; // Get the "Snippet" nodes defined in the XML file. var aTplNodes = oXml.SelectNodes( 'Snippets/Snippet' ) ; for ( var i = 0 ; i < aTplNodes.length ; i++ ) { var oNode = aTplNodes[i] var oSnippet = new Object() ; var oPart ; // Get the Snippet Title. if ( oPart = oNode.attributes.getNamedItem('title') ) oSnippet.Title = oPart.value ; else oSnippet.Title = 'Snippet ' + ( i + 1 ) ; // Get the Snippet Description. if ( oPart = oXml.SelectSingleNode( 'Description', oNode ) ) oSnippet.Description = oPart.text ? oPart.text : oPart.textContent ; // Get the Snippet Image. if ( oPart = oNode.attributes.getNamedItem('image') ) oSnippet.Image = sImagesBasePath + oPart.value ; // Get the Snippet HTML. if ( oPart = oXml.SelectSingleNode( 'Html', oNode ) ) oSnippet.Html = oPart.text ? oPart.text : oPart.textContent ; else { alert( 'No HTML defined for snippet index ' + i + '. Please review the "' + FCKConfig.SnippetsXmlPath + '" file.' ) ; continue ; } FCK._Snippets[ FCK._Snippets.length ] = oSnippet ; } GetE('eLoading').style.display = 'none' ; } if ( FCK._Snippets.length == 0 ) GetE('eEmpty').style.display = '' ; else { for ( var i = 0 ; i < FCK._Snippets.length ; i++ ) { var oSnippet = FCK._Snippets[i] ; var oItemDiv = GetE('eList').appendChild( document.createElement( 'DIV' ) ) ; oItemDiv.TplSnippet = i ; oItemDiv.className = 'TplItem' ; // Build the inner HTML of our new item DIV. var sInner = '<table width="280" border=0 cellspacing=1 cellpadding=1><tr>' ; //if ( oSnippet.Image ) // sInner += '<td valign="top"><img src="' + oSnippet.Image + '"><\/td>' ; sInner += '<td valign="top" aling="left"><div class="TplTitle">' + oSnippet.Title + '<\/div>' ; if ( oSnippet.Description ) sInner += '<div>' + oSnippet.Description + '<\/div>' ; sInner += '<\/td>' sInner += '<td width="30" valign="top" aling="right"><img src="Cestino.gif" border="0" alt="Modify/Delete snippet" onclick="modSnippet(' + "'" + i + "'" + ')" ><\/td>' ; sInner += '<\/tr><\/table>' ; oItemDiv.innerHTML = sInner ; oItemDiv.onmouseover = ItemDiv_OnMouseOver ; oItemDiv.onmouseout = ItemDiv_OnMouseOut ; oItemDiv.onclick = ItemDiv_OnClick ; } } } function ItemDiv_OnMouseOver() { this.className += ' PopupSelectionBox' ; } function ItemDiv_OnMouseOut() { <% 'this.className = this.className.replace( /\s*PopupSelectionBox\s*/, '' ) ; %> } */ function ItemDiv_OnClick(i) { if(modClick){return} SelectSnippet( i ) ; } function SelectSnippet( index ) { page = 'SnippetsBrowse.asp?Oper=AddToEditor&IdSnippet=' + index + '&SnippetFolder=' + FCKConfig.SnippetsXmlPath; //window.open(page) location.href = page; return /* oEditor.FCKUndo.SaveUndoStep() ; //alert("If this wasn't in beta, the snippet code would have been loaded.") ; oActiveEl = oEditor.FCK.EditorDocument.createElement( 'SPAN' ) ; //FCK.SetHTML( FCK._Snippets[index].Html ) ; oSnippet.Add( FCK._Snippets[index].Html ) ; window.parent.Cancel() ; */ } function GetE( elementId ) { return document.getElementById( elementId ) ; } function ShowE( element, isVisible ) { if ( typeof( element ) == 'string' ) element = GetE( element ) ; element.style.display = isVisible ? '' : 'none' ; } </script> </head> <body scroll="no" style="OVERFLOW: hidden"> <table width="100%" height="100%"> <tr> <td align="center"> <span fckLang="DlgSnippetsSelMsg">Please select the snippet to insert:</span> </td> </tr> <tr> <td height="100%" align="center"> <div id="eList" align="left" class="TplList"> <% if objSnippets(0).childNodes.length > 0 then %> <div id="eContainer" align="center" class="TplItem"> <table width="250" border=0 cellspacing=0 cellpadding=4> <% for J=0 to objSnippets(0).childNodes.length - 1 %> <tr onMouseOver="this.className='PopupSelectionBox'" onMouseOut="this.className=''"> <td height="45" valign="top" aling="left" onClick="javascript:ItemDiv_OnClick('<%=J%>')" > <div class="TplTitle"><%=objSnippets(0).childNodes(J).getAttribute("title")%></div> <div><%=objSnippets(0).childNodes(J).childNodes(0).text%></div> </td> <td width="30" height="45" valign="top" aling="right"><img src="edit.gif" alt="Modify/Delete snippet" width="30" height="30" border="0" onMouseOver="this.style.cursor='hand'" onMouseOut="this.style.cursor=''" onClick="modSnippet(<%=J%>)" ></td> </tr> <% next %> </table> </div> <% end if %> <% if objSnippets(0).childNodes.length < 1 then %> <div id="eEmpty" align="center" style="DISPLAY: block"> <br> <span fckLang="DlgSnippetsNoSnip">(No snippets defined)</span> </div> <% end if %> </div> </td> </tr> </table> </body> </html>
[
Íàçàä
]