[44] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!--
|
---|
| 3 | * FCKeditor - The text editor for internet
|
---|
| 4 | * Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
---|
| 5 | *
|
---|
| 6 | * Licensed under the terms of the GNU Lesser General Public License:
|
---|
| 7 | * http://www.opensource.org/licenses/lgpl-license.php
|
---|
| 8 | *
|
---|
| 9 | * For further information visit:
|
---|
| 10 | * http://www.fckeditor.net/
|
---|
| 11 | *
|
---|
| 12 | * "Support Open Source software. What about a donation today?"
|
---|
| 13 | *
|
---|
| 14 | * File Name: fck_template.html
|
---|
| 15 | * Template selection dialog window.
|
---|
| 16 | *
|
---|
| 17 | * File Authors:
|
---|
| 18 | * Frederico Caldeira Knabben (fredck@fckeditor.net)
|
---|
| 19 | -->
|
---|
| 20 | <html xmlns="http://www.w3.org/1999/xhtml">
|
---|
| 21 | <head>
|
---|
| 22 | <title></title>
|
---|
| 23 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
---|
| 24 | <meta name="robots" content="noindex, nofollow" />
|
---|
| 25 | <style type="text/css">
|
---|
| 26 | .TplList
|
---|
| 27 | {
|
---|
| 28 | border: #dcdcdc 2px solid;
|
---|
| 29 | background-color: #ffffff;
|
---|
| 30 | overflow: auto;
|
---|
| 31 | width: 90%;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | .TplItem
|
---|
| 35 | {
|
---|
| 36 | margin: 5px;
|
---|
| 37 | padding: 7px;
|
---|
| 38 | border: #eeeeee 1px solid;
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | .TplItem TABLE
|
---|
| 42 | {
|
---|
| 43 | display: inline;
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | .TplTitle
|
---|
| 47 | {
|
---|
| 48 | font-weight: bold;
|
---|
| 49 | }
|
---|
| 50 | </style>
|
---|
| 51 | <script src="common/fck_dialog_common.js" type="text/javascript"></script>
|
---|
| 52 | <script type="text/javascript">
|
---|
| 53 |
|
---|
| 54 | var oEditor = window.parent.InnerDialogLoaded() ;
|
---|
| 55 | var FCK = oEditor.FCK ;
|
---|
| 56 | var FCKLang = oEditor.FCKLang ;
|
---|
| 57 | var FCKConfig = oEditor.FCKConfig ;
|
---|
| 58 |
|
---|
| 59 | window.onload = function()
|
---|
| 60 | {
|
---|
| 61 | // Set the right box height (browser dependent).
|
---|
| 62 | GetE('eList').style.height = document.all ? '100%' : '295px' ;
|
---|
| 63 |
|
---|
| 64 | // Translate the dialog box texts.
|
---|
| 65 | oEditor.FCKLanguageManager.TranslatePage(document) ;
|
---|
| 66 |
|
---|
| 67 | GetE('xChkReplaceAll').checked = ( FCKConfig.TemplateReplaceAll !== false ) ;
|
---|
| 68 |
|
---|
| 69 | if ( FCKConfig.TemplateReplaceCheckbox !== false )
|
---|
| 70 | GetE('xReplaceBlock').style.display = '' ;
|
---|
| 71 |
|
---|
| 72 | window.parent.SetAutoSize( true ) ;
|
---|
| 73 |
|
---|
| 74 | LoadTemplatesXml() ;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | function LoadTemplatesXml()
|
---|
| 78 | {
|
---|
| 79 | if ( !FCK._Templates )
|
---|
| 80 | {
|
---|
| 81 | GetE('eLoading').style.display = '' ;
|
---|
| 82 |
|
---|
| 83 | // Create the Templates array.
|
---|
| 84 | FCK._Templates = new Array() ;
|
---|
| 85 |
|
---|
| 86 | // Load the XML file.
|
---|
| 87 | var oXml = new oEditor.FCKXml() ;
|
---|
| 88 | oXml.LoadUrl( FCKConfig.TemplatesXmlPath ) ;
|
---|
| 89 |
|
---|
| 90 | // Get the Images Base Path.
|
---|
| 91 | var oAtt = oXml.SelectSingleNode( 'Templates/@imagesBasePath' ) ;
|
---|
| 92 | var sImagesBasePath = oAtt ? oAtt.value : '' ;
|
---|
| 93 |
|
---|
| 94 | // Get the "Template" nodes defined in the XML file.
|
---|
| 95 | var aTplNodes = oXml.SelectNodes( 'Templates/Template' ) ;
|
---|
| 96 |
|
---|
| 97 | for ( var i = 0 ; i < aTplNodes.length ; i++ )
|
---|
| 98 | {
|
---|
| 99 | var oNode = aTplNodes[i]
|
---|
| 100 |
|
---|
| 101 | var oTemplate = new Object() ;
|
---|
| 102 |
|
---|
| 103 | var oPart ;
|
---|
| 104 |
|
---|
| 105 | // Get the Template Title.
|
---|
| 106 | if ( oPart = oNode.attributes.getNamedItem('title') )
|
---|
| 107 | oTemplate.Title = oPart.value ;
|
---|
| 108 | else
|
---|
| 109 | oTemplate.Title = 'Template ' + ( i + 1 ) ;
|
---|
| 110 |
|
---|
| 111 | // Get the Template Description.
|
---|
| 112 | if ( oPart = oXml.SelectSingleNode( 'Description', oNode ) )
|
---|
| 113 | oTemplate.Description = oPart.text ? oPart.text : oPart.textContent ;
|
---|
| 114 |
|
---|
| 115 | // Get the Template Image.
|
---|
| 116 | if ( oPart = oNode.attributes.getNamedItem('image') )
|
---|
| 117 | oTemplate.Image = sImagesBasePath + oPart.value ;
|
---|
| 118 |
|
---|
| 119 | // Get the Template HTML.
|
---|
| 120 | if ( oPart = oXml.SelectSingleNode( 'Html', oNode ) )
|
---|
| 121 | oTemplate.Html = oPart.text ? oPart.text : oPart.textContent ;
|
---|
| 122 | else
|
---|
| 123 | {
|
---|
| 124 | alert( 'No HTML defined for template index ' + i + '. Please review the "' + FCKConfig.TemplatesXmlPath + '" file.' ) ;
|
---|
| 125 | continue ;
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 | FCK._Templates[ FCK._Templates.length ] = oTemplate ;
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 | GetE('eLoading').style.display = 'none' ;
|
---|
| 132 | }
|
---|
| 133 |
|
---|
| 134 | if ( FCK._Templates.length == 0 )
|
---|
| 135 | GetE('eEmpty').style.display = '' ;
|
---|
| 136 | else
|
---|
| 137 | {
|
---|
| 138 | for ( var i = 0 ; i < FCK._Templates.length ; i++ )
|
---|
| 139 | {
|
---|
| 140 | var oTemplate = FCK._Templates[i] ;
|
---|
| 141 |
|
---|
| 142 | var oItemDiv = GetE('eList').appendChild( document.createElement( 'DIV' ) ) ;
|
---|
| 143 | oItemDiv.TplIndex = i ;
|
---|
| 144 | oItemDiv.className = 'TplItem' ;
|
---|
| 145 |
|
---|
| 146 | // Build the inner HTML of our new item DIV.
|
---|
| 147 | var sInner = '<table><tr>' ;
|
---|
| 148 |
|
---|
| 149 | if ( oTemplate.Image )
|
---|
| 150 | sInner += '<td valign="top"><img src="' + oTemplate.Image + '"><\/td>' ;
|
---|
| 151 |
|
---|
| 152 | sInner += '<td valign="top"><div class="TplTitle">' + oTemplate.Title + '<\/div>' ;
|
---|
| 153 |
|
---|
| 154 | if ( oTemplate.Description )
|
---|
| 155 | sInner += '<div>' + oTemplate.Description + '<\/div>' ;
|
---|
| 156 |
|
---|
| 157 | sInner += '<\/td><\/tr><\/table>' ;
|
---|
| 158 |
|
---|
| 159 | oItemDiv.innerHTML = sInner ;
|
---|
| 160 |
|
---|
| 161 | oItemDiv.onmouseover = ItemDiv_OnMouseOver ;
|
---|
| 162 | oItemDiv.onmouseout = ItemDiv_OnMouseOut ;
|
---|
| 163 | oItemDiv.onclick = ItemDiv_OnClick ;
|
---|
| 164 | }
|
---|
| 165 | }
|
---|
| 166 | }
|
---|
| 167 |
|
---|
| 168 | function ItemDiv_OnMouseOver()
|
---|
| 169 | {
|
---|
| 170 | this.className += ' PopupSelectionBox' ;
|
---|
| 171 | }
|
---|
| 172 |
|
---|
| 173 | function ItemDiv_OnMouseOut()
|
---|
| 174 | {
|
---|
| 175 | this.className = this.className.replace( /\s*PopupSelectionBox\s*/, '' ) ;
|
---|
| 176 | }
|
---|
| 177 |
|
---|
| 178 | function ItemDiv_OnClick()
|
---|
| 179 | {
|
---|
| 180 | SelectTemplate( this.TplIndex ) ;
|
---|
| 181 | }
|
---|
| 182 |
|
---|
| 183 | function SelectTemplate( index )
|
---|
| 184 | {
|
---|
| 185 | oEditor.FCKUndo.SaveUndoStep() ;
|
---|
| 186 |
|
---|
| 187 | if ( GetE('xChkReplaceAll').checked )
|
---|
| 188 | FCK.SetHTML( FCK._Templates[index].Html ) ;
|
---|
| 189 | else
|
---|
| 190 | FCK.InsertHtml( FCK._Templates[index].Html ) ;
|
---|
| 191 |
|
---|
| 192 | window.parent.Cancel( true ) ;
|
---|
| 193 | }
|
---|
| 194 |
|
---|
| 195 | </script>
|
---|
| 196 | </head>
|
---|
| 197 | <body style="overflow: hidden">
|
---|
| 198 | <table width="100%" style="height: 100%">
|
---|
| 199 | <tr>
|
---|
| 200 | <td align="center">
|
---|
| 201 | <span fcklang="DlgTemplatesSelMsg">Please select the template to open in the editor<br />
|
---|
| 202 | (the actual contents will be lost):</span>
|
---|
| 203 | </td>
|
---|
| 204 | </tr>
|
---|
| 205 | <tr>
|
---|
| 206 | <td height="100%" align="center">
|
---|
| 207 | <div id="eList" align="left" class="TplList">
|
---|
| 208 | <div id="eLoading" align="center" style="display: none">
|
---|
| 209 | <br />
|
---|
| 210 | <span fcklang="DlgTemplatesLoading">Loading templates list. Please wait...</span>
|
---|
| 211 | </div>
|
---|
| 212 | <div id="eEmpty" align="center" style="display: none">
|
---|
| 213 | <br />
|
---|
| 214 | <span fcklang="DlgTemplatesNoTpl">(No templates defined)</span>
|
---|
| 215 | </div>
|
---|
| 216 | </div>
|
---|
| 217 | </td>
|
---|
| 218 | </tr>
|
---|
| 219 | <tr id="xReplaceBlock" style="display: none">
|
---|
| 220 | <td>
|
---|
| 221 | <table cellpadding="0" cellspacing="0">
|
---|
| 222 | <tr>
|
---|
| 223 | <td>
|
---|
| 224 | <input id="xChkReplaceAll" type="checkbox" /></td>
|
---|
| 225 | <td>
|
---|
| 226 | </td>
|
---|
| 227 | <td>
|
---|
| 228 | <label for="xChkReplaceAll" fcklang="DlgTemplatesReplace">
|
---|
| 229 | Replace actual contents</label></td>
|
---|
| 230 | </tr>
|
---|
| 231 | </table>
|
---|
| 232 | </td>
|
---|
| 233 | </tr>
|
---|
| 234 | </table>
|
---|
| 235 | </body>
|
---|
| 236 | </html>
|
---|