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