fck_template.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <!--
  2. * FCKeditor - The text editor for internet
  3. * Copyright (C) 2003-2005 Frederico Caldeira Knabben
  4. *
  5. * Licensed under the terms of the GNU Lesser General Public License:
  6. * http://www.opensource.org/licenses/lgpl-license.php
  7. *
  8. * For further information visit:
  9. * http://www.fckeditor.net/
  10. *
  11. * "Support Open Source software. What about a donation today?"
  12. *
  13. * File Name: fck_template.html
  14. * Template selection dialog window.
  15. *
  16. * File Authors:
  17. * Frederico Caldeira Knabben (fredck@fckeditor.net)
  18. + Template's in frame changes by Julio Montoya Armas (gugli100@gmail.com)
  19. -->
  20. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  21. <html>
  22. <head>
  23. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  24. <meta name="robots" content="noindex, nofollow">
  25. <style>
  26. .TplList
  27. {
  28. /* border: #dcdcdc 2px solid; */
  29. background-color: #fff;
  30. overflow: auto;
  31. width: 165px;
  32. }
  33. .TplItem
  34. {
  35. margin: 3px;
  36. padding: 0px;
  37. border: #eeeeee 0px solid;
  38. text-align:right;
  39. text-decoration: none;
  40. font-weight :normal;
  41. }
  42. .TplItem TABLE
  43. {
  44. display: inline;
  45. text-align:right;
  46. }
  47. .TplTitle a
  48. {
  49. text-align:right;
  50. color:000;
  51. text-decoration: none;
  52. font-weight :normal;
  53. }
  54. </style>
  55. <script src="common/fck_dialog_common.js" type="text/javascript"></script>
  56. <script language="javascript">
  57. var oEditor = window.parent.InnerDialogLoaded() ;
  58. var FCK = oEditor.FCK ;
  59. var FCKLang = oEditor.FCKLang ;
  60. var FCKConfig = oEditor.FCKConfig ;
  61. var Size = window.parent.WindowSize;
  62. window.onload = function()
  63. {
  64. // Set the right box height (browser dependent).
  65. GetE('eList').style.height = document.all ? '100%' : Size ;
  66. // Translate the dialog box texts.
  67. oEditor.FCKLanguageManager.TranslatePage(document) ;
  68. //window.parent.SetAutoSize( true ) ;
  69. LoadTemplatesXml() ;
  70. }
  71. function LoadTemplatesXml()
  72. {
  73. if ( !FCK._Templates )
  74. {
  75. GetE('eLoading').style.display = '' ;
  76. // Create the Templates array.
  77. FCK._Templates = new Array() ;
  78. // Load the XML file.
  79. var oXml = new oEditor.FCKXml() ;
  80. oXml.LoadUrl( FCKConfig.TemplatesXmlPath ) ;
  81. // Get the Images Base Path.
  82. //var oAtt = oXml.SelectSingleNode( 'Templates/@imagesBasePath' ) ;
  83. //var sImagesBasePath = oAtt ? oAtt.value : '' ;
  84. // Get the "Template" nodes defined in the XML file.
  85. var aTplNodes = oXml.SelectNodes( 'Templates/Template' ) ;
  86. for ( var i = 0 ; i < aTplNodes.length ; i++ )
  87. {
  88. var oNode = aTplNodes[i];
  89. var oTemplate = new Object() ;
  90. var oPart ;
  91. // Get the Template Title.
  92. if ( oPart = oNode.attributes.getNamedItem('title') )
  93. oTemplate.Title = oPart.value ;
  94. else
  95. oTemplate.Title = 'Template ' + ( i + 1 ) ;
  96. // Get the Template Description.
  97. if ( oPart = oXml.SelectSingleNode( 'Description', oNode ) )
  98. oTemplate.Description = oPart.text ? oPart.text : oPart.textContent ;
  99. /*
  100. // Get the Template Image.
  101. if ( oPart = oNode.attributes.getNamedItem('image') )
  102. oTemplate.Image = sImagesBasePath + oPart.value ;
  103. */
  104. // Get the Template HTML.
  105. if ( oPart = oXml.SelectSingleNode( 'Html', oNode ) )
  106. oTemplate.Html = oPart.text ? oPart.text : oPart.textContent ;
  107. else
  108. {
  109. alert( 'No HTML defined for template index ' + i + '. Please review the "' + FCKConfig.TemplatesXmlPath + '" file.' ) ;
  110. continue ;
  111. }
  112. FCK._Templates[ FCK._Templates.length ] = oTemplate ;
  113. }
  114. GetE('eLoading').style.display = 'none' ;
  115. }
  116. if ( FCK._Templates.length == 0 )
  117. GetE('eEmpty').style.display = '' ;
  118. else
  119. {
  120. for ( var i = 0 ; i < FCK._Templates.length ; i++ )
  121. {
  122. var oTemplate = FCK._Templates[i];
  123. var oItemDiv = GetE('eList').appendChild( document.createElement( 'DIV' ) ) ;
  124. oItemDiv.TplIndex = i ;
  125. oItemDiv.className = 'TplItem' ;
  126. // Build the inner HTML of our new item DIV.
  127. var sInner = '<table><tr>' ;
  128. /*if ( oTemplate.Image )
  129. sInner += '<td valign="top"><img src="' + oTemplate.Image + '"><\/td>' ;
  130. */
  131. sInner += '<td valign="top"><div class="TplTitle"><a href="#" title="'+oTemplate.Description+'" >' + oTemplate.Title + '</a><\/div>';
  132. sInner += '<\/td><\/tr><\/table>' ;
  133. oItemDiv.innerHTML = sInner ;
  134. oItemDiv.onmouseover = ItemDiv_OnMouseOver ;
  135. oItemDiv.onmouseout = ItemDiv_OnMouseOut ;
  136. oItemDiv.onclick = ItemDiv_OnClick ;
  137. }
  138. }
  139. }
  140. function ItemDiv_OnMouseOver()
  141. {
  142. this.className += ' PopupSelectionBox' ;
  143. }
  144. function ItemDiv_OnMouseOut()
  145. {
  146. this.className = this.className.replace( /\s*PopupSelectionBox\s*/, '' ) ;
  147. }
  148. function ItemDiv_OnClick()
  149. {
  150. SelectTemplate( this.TplIndex ) ;
  151. }
  152. function SelectTemplate( index )
  153. {
  154. oEditor.FCKUndo.SaveUndoStep() ;
  155. FCK.SetHTML( FCK._Templates[index].Html ) ;
  156. }
  157. </script>
  158. </head>
  159. <body scroll="no" style="OVERFLOW: hidden">
  160. <table width="100%" height="100%" valign="top">
  161. <tr>
  162. <td height="100%" align="center" valign="top">
  163. <div id="eList" align="left" valign="top" class="TplList">
  164. <div id="eLoading" align="center" style="display: none"><br />
  165. <span fckLang="DlgTemplatesLoading">Loading templates list. Please wait...</span>
  166. </div>
  167. <div id="eEmpty" align="center" style="display: none"><br />
  168. <span fckLang="DlgTemplatesNoTpl">(No templates defined)</span>
  169. </div>
  170. </div>
  171. </td>
  172. </tr>
  173. </table>
  174. </body>
  175. </html>