123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <!--
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2010 Frederico Caldeira Knabben
- *
- * == BEGIN LICENSE ==
- *
- * Licensed under the terms of any of the following licenses at your
- * choice:
- *
- * - GNU General Public License Version 2 or later (the "GPL")
- * http://www.gnu.org/licenses/gpl.html
- *
- * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
- * http://www.gnu.org/licenses/lgpl.html
- *
- * - Mozilla Public License Version 1.1 or later (the "MPL")
- * http://www.mozilla.org/MPL/MPL-1.1.html
- *
- * == END LICENSE ==
- *
- * Template selection dialog window.
- -->
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title></title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="robots" content="noindex, nofollow" />
- <style type="text/css">
-
- .TplList {
- border: #fff 2px solid;
- background-color: #ffffff;
- overflow: auto;
- width: 148px;
- }
-
- .TplItemPopupSelectionBox {
- background-color: #eee;
- }
- .TplItem, .TplItemPopupSelectionBox {
- margin: 5px;
- padding: 7px;
- border: #eeeeee 1px solid;
- text-decoration: none;
- }
- .TplItem table {
- display: inline;
- }
- .TplTitle {
- font-weight: bold;
- }
- .TplTitle a {
- color:000;
- text-decoration: none;
- }
- </style>
- <script src="common/fck_dialog_common.js" type="text/javascript"></script>
- <script type="text/javascript">
- var oEditor = window.parent.InnerDialogLoaded() ;
- var FCK = oEditor.FCK ;
- var FCKLang = oEditor.FCKLang ;
- var FCKConfig = oEditor.FCKConfig ;
- var Size = window.parent.WindowSize;
- // Added by Ivan Tcholakov, a temporary fix.
- // The following statement sets the Skin CSS.
- // This is needed only when this dialog is shown in the Documents tool.
- document.write( '<link href="' + FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ;
- //
- window.onload = function()
- {
- // Set the right box height (browser dependent).
- GetE('eList').style.height = document.all ? '100%' : Size ;
- // Translate the dialog box texts.
- oEditor.FCKLanguageManager.TranslatePage(document) ;
- //window.parent.SetAutoSize( true ) ;
- LoadTemplatesXml() ;
- // Select first by default (Chamilo customization)
- if ( window.top.load_default_template )
- SelectTemplate( 0 ) ;
- }
- function LoadTemplatesXml()
- {
- var oTemplate ;
- if ( !FCK._Templates )
- {
- GetE('eLoading').style.display = '' ;
- // Create the Templates array.
- FCK._Templates = new Array() ;
- // Load the XML file.
- var oXml = new oEditor.FCKXml() ;
- oXml.LoadUrl( FCKConfig.TemplatesXmlPath ) ;
- // Get the Images Base Path.
- var oAtt = oXml.SelectSingleNode( 'Templates/@imagesBasePath' ) ;
- var sImagesBasePath = oAtt ? oAtt.value : '' ;
- // Get the "Template" nodes defined in the XML file.
- var aTplNodes = oXml.SelectNodes( 'Templates/Template' ) ;
- for ( var i = 0 ; i < aTplNodes.length ; i++ )
- {
- var oNode = aTplNodes[i] ;
- oTemplate = new Object() ;
- var oPart ;
- // Get the Template Title.
- if ( (oPart = oNode.attributes.getNamedItem('title')) )
- oTemplate.Title = oPart.value ;
- else
- oTemplate.Title = 'Template ' + ( i + 1 ) ;
- // Get the Template Description.
- if ( (oPart = oXml.SelectSingleNode( 'Description', oNode )) )
- oTemplate.Description = oPart.text ? oPart.text : oPart.textContent ;
- // Get the Template Image.
- if ( (oPart = oNode.attributes.getNamedItem('image')) )
- oTemplate.Image = sImagesBasePath + oPart.value ;
- // Get the Template HTML.
- if ( (oPart = oXml.SelectSingleNode( 'Html', oNode )) )
- oTemplate.Html = oPart.text ? oPart.text : oPart.textContent ;
- else
- {
- alert( 'No HTML defined for template index ' + i + '. Please review the "' + FCKConfig.TemplatesXmlPath + '" file.' ) ;
- continue ;
- }
- FCK._Templates[ FCK._Templates.length ] = oTemplate ;
- }
- GetE('eLoading').style.display = 'none' ;
- }
- if ( FCK._Templates.length == 0 )
- GetE('eEmpty').style.display = '' ;
- else
- {
- for ( var j = 0 ; j < FCK._Templates.length ; j++ )
- {
- oTemplate = FCK._Templates[j] ;
- var oItemDiv = GetE('eList').appendChild( document.createElement( 'DIV' ) ) ;
- oItemDiv.TplIndex = j ;
- oItemDiv.className = 'TplItem' ;
- // Build the inner HTML of our new item DIV.
- var sInner = '<table><tr>' ;
- if ( oTemplate.Image )
- sInner += '<td valign="top"><img src="' + oTemplate.Image + '"><br />' ;
- else
- sInner += '<td valign="top"><img src="fck_template/images/noimage.gif"><br />' ;
- sInner += '<div class="TplTitle"><a href="javascript:void(0);" title="'+oTemplate.Description+'" >' + oTemplate.Title + '<\/a><\/div>';
- if ( oTemplate.Description )
- sInner += '<div>' + oTemplate.Description + '<\/div>' ;
- sInner += '<\/td><\/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()
- {
- SelectTemplate( this.TplIndex ) ;
- if (window.top.hide_bar) {
- window.top.hide_bar();
- }
- }
- function SelectTemplate( index )
- {
- oEditor.FCKUndo.SaveUndoStep() ;
- FCK.SetHTML( FCK._Templates[index].Html ) ;
- }
- </script>
- </head>
- <body scroll="no" style="overflow: hidden; background-color: #ffffff;">
- <table width="100%" style="height: 100%;" valign="top">
- <tr>
- <td height="100%" align="center" valign="top">
- <div id="eList" align="left" valign="top" class="TplList">
- <div id="eLoading" align="center" style="display: none"><br />
- <span fcklang="DlgTemplatesLoading">Loading templates list. Please wait...</span>
- </div>
- <div id="eEmpty" align="center" style="display: none"><br />
- <span fcklang="DlgTemplatesNoTpl">(No templates defined)</span>
- </div>
- </div>
- </td>
- </tr>
- </table>
- </body>
- </html>
|