fck_select.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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-2010 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. * Select dialog window.
  23. -->
  24. <html>
  25. <head>
  26. <title>Select Properties</title>
  27. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  28. <meta content="noindex, nofollow" name="robots">
  29. <script src="common/fck_dialog_common.js" type="text/javascript"></script>
  30. <script type="text/javascript" src="fck_select/fck_select.js"></script>
  31. <script type="text/javascript">
  32. var dialog = window.parent ;
  33. var oEditor = dialog.InnerDialogLoaded() ;
  34. // Gets the document DOM
  35. var oDOM = oEditor.FCK.EditorDocument ;
  36. var oActiveEl = dialog.Selection.GetSelectedElement() ;
  37. var oListText ;
  38. var oListValue ;
  39. window.onload = function()
  40. {
  41. // First of all, translate the dialog box texts
  42. oEditor.FCKLanguageManager.TranslatePage(document) ;
  43. oListText = document.getElementById( 'cmbText' ) ;
  44. oListValue = document.getElementById( 'cmbValue' ) ;
  45. // Fix the lists widths. (Bug #970)
  46. oListText.style.width = oListText.offsetWidth ;
  47. oListValue.style.width = oListValue.offsetWidth ;
  48. if ( oActiveEl && oActiveEl.tagName == 'SELECT' )
  49. {
  50. GetE('txtName').value = oActiveEl.name ;
  51. GetE('txtSelValue').value = oActiveEl.value ;
  52. GetE('txtLines').value = GetAttribute( oActiveEl, 'size' ) ;
  53. GetE('chkMultiple').checked = oActiveEl.multiple ;
  54. // Load the actual options
  55. for ( var i = 0 ; i < oActiveEl.options.length ; i++ )
  56. {
  57. var sText = HTMLDecode( oActiveEl.options[i].innerHTML ) ;
  58. var sValue = oActiveEl.options[i].value ;
  59. AddComboOption( oListText, sText, sText ) ;
  60. AddComboOption( oListValue, sValue, sValue ) ;
  61. }
  62. }
  63. else
  64. oActiveEl = null ;
  65. dialog.SetOkButton( true ) ;
  66. dialog.SetAutoSize( true ) ;
  67. SelectField( 'txtName' ) ;
  68. }
  69. function Ok()
  70. {
  71. oEditor.FCKUndo.SaveUndoStep() ;
  72. var sSize = GetE('txtLines').value ;
  73. if ( sSize == null || isNaN( sSize ) || sSize <= 1 )
  74. sSize = '' ;
  75. oActiveEl = CreateNamedElement( oEditor, oActiveEl, 'SELECT', {name: GetE('txtName').value} ) ;
  76. SetAttribute( oActiveEl, 'size' , sSize ) ;
  77. oActiveEl.multiple = ( sSize.length > 0 && GetE('chkMultiple').checked ) ;
  78. // Remove all options.
  79. while ( oActiveEl.options.length > 0 )
  80. oActiveEl.remove(0) ;
  81. // Add all available options.
  82. for ( var i = 0 ; i < oListText.options.length ; i++ )
  83. {
  84. var sText = oListText.options[i].value ;
  85. var sValue = oListValue.options[i].value ;
  86. if ( sValue.length == 0 ) sValue = sText ;
  87. var oOption = AddComboOption( oActiveEl, sText, sValue, oDOM ) ;
  88. if ( sValue == GetE('txtSelValue').value )
  89. {
  90. SetAttribute( oOption, 'selected', 'selected' ) ;
  91. oOption.selected = true ;
  92. }
  93. }
  94. return true ;
  95. }
  96. </script>
  97. <style type="text/css">
  98. body, td, input, textarea, select, label { font-family: Arial, Verdana, Geneva, helvetica, sans-serif; font-size: 11px; }
  99. </style>
  100. </head>
  101. <body style="overflow: hidden">
  102. <table width="100%" height="100%">
  103. <tr>
  104. <td>
  105. <table width="100%">
  106. <tr>
  107. <td nowrap><span fckLang="DlgSelectName">Name</span>&nbsp;</td>
  108. <td width="100%" colSpan="2"><input id="txtName" style="WIDTH: 100%" type="text"></td>
  109. </tr>
  110. <tr>
  111. <td nowrap><span fckLang="DlgSelectValue">Value</span>&nbsp;</td>
  112. <td width="100%" colSpan="2"><input id="txtSelValue" style="WIDTH: 100%; BACKGROUND-COLOR: buttonface" type="text" readonly></td>
  113. </tr>
  114. <tr>
  115. <td nowrap><span fckLang="DlgSelectSize">Size</span>&nbsp;</td>
  116. <td nowrap><input id="txtLines" type="text" size="2" value="">&nbsp;<span fckLang="DlgSelectLines">lines</span></td>
  117. <td nowrap align="right"><input id="chkMultiple" type="checkbox"><label for="chkMultiple" fckLang="DlgSelectChkMulti">Allow
  118. multiple selections</label></td>
  119. </tr>
  120. </table>
  121. <br>
  122. <hr style="POSITION: absolute">
  123. <span style="LEFT: 10px; POSITION: relative; TOP: -7px" class="BackColor">&nbsp;<span fckLang="DlgSelectOpAvail">Available
  124. Options</span>&nbsp;</span>
  125. <table width="100%">
  126. <tr>
  127. <td width="50%"><span fckLang="DlgSelectOpText">Text</span><br>
  128. <input id="txtText" style="WIDTH: 100%" type="text">
  129. </td>
  130. <td width="50%"><span fckLang="DlgSelectOpValue">Value</span><br>
  131. <input id="txtValue" style="WIDTH: 100%" type="text">
  132. </td>
  133. <td vAlign="bottom"><input onclick="Add();" type="button" fckLang="DlgSelectBtnAdd" value="Add"></td>
  134. <td vAlign="bottom"><input onclick="Modify();" type="button" fckLang="DlgSelectBtnModify" value="Modify"></td>
  135. </tr>
  136. <tr>
  137. <td rowSpan="2"><select id="cmbText" style="WIDTH: 100%" onchange="GetE('cmbValue').selectedIndex = this.selectedIndex;Select(this);"
  138. size="5"></select>
  139. </td>
  140. <td rowSpan="2"><select id="cmbValue" style="WIDTH: 100%" onchange="GetE('cmbText').selectedIndex = this.selectedIndex;Select(this);"
  141. size="5"></select>
  142. </td>
  143. <td vAlign="top" colSpan="2">
  144. </td>
  145. </tr>
  146. <tr>
  147. <td vAlign="bottom" colSpan="2"><input style="WIDTH: 100%" onclick="Move(-1);" type="button" fckLang="DlgSelectBtnUp" value="Up">
  148. <br>
  149. <input style="WIDTH: 100%" onclick="Move(1);" type="button" fckLang="DlgSelectBtnDown"
  150. value="Down">
  151. </td>
  152. </tr>
  153. <TR>
  154. <TD vAlign="bottom" colSpan="4"><INPUT onclick="SetSelectedValue();" type="button" fckLang="DlgSelectBtnSetValue" value="Set as selected value">&nbsp;&nbsp;
  155. <input onclick="Delete();" type="button" fckLang="DlgSelectBtnDelete" value="Delete"></TD>
  156. </TR>
  157. </table>
  158. </td>
  159. </tr>
  160. </table>
  161. </body>
  162. </html>