event refactor, landing on HEAD!
[freeside.git] / httemplate / elements / fckeditor / editor / dialog / fck_colorselector.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >\r
2 <!--\r
3  * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
4  * Copyright (C) 2003-2007 Frederico Caldeira Knabben\r
5  *\r
6  * == BEGIN LICENSE ==\r
7  *\r
8  * Licensed under the terms of any of the following licenses at your\r
9  * choice:\r
10  *\r
11  *  - GNU General Public License Version 2 or later (the "GPL")\r
12  *    http://www.gnu.org/licenses/gpl.html\r
13  *\r
14  *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
15  *    http://www.gnu.org/licenses/lgpl.html\r
16  *\r
17  *  - Mozilla Public License Version 1.1 or later (the "MPL")\r
18  *    http://www.mozilla.org/MPL/MPL-1.1.html\r
19  *\r
20  * == END LICENSE ==\r
21  *\r
22  * Color Selection dialog window.\r
23 -->\r
24 <html>\r
25         <head>\r
26                 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
27                 <meta name="robots" content="noindex, nofollow" />\r
28                 <style TYPE="text/css">\r
29                         #ColorTable             { cursor: pointer ; cursor: hand ; }\r
30                         #hicolor                { height: 74px ; width: 74px ; border-width: 1px ; border-style: solid ; }\r
31                         #hicolortext    { width: 75px ; text-align: right ; margin-bottom: 7px ; }\r
32                         #selhicolor             { height: 20px ; width: 74px ; border-width: 1px ; border-style: solid ; }\r
33                         #selcolor               { width: 75px ; height: 20px ; margin-top: 0px ; margin-bottom: 7px ; }\r
34                         #btnClear               { width: 75px ; height: 22px ; margin-bottom: 6px ; }\r
35                         .ColorCell              { height: 15px ; width: 15px ; }\r
36                 </style>\r
37                 <script type="text/javascript">\r
38 \r
39 var oEditor = window.parent.InnerDialogLoaded() ;\r
40 \r
41 function OnLoad()\r
42 {\r
43         // First of all, translate the dialog box texts\r
44         oEditor.FCKLanguageManager.TranslatePage(document) ;\r
45 \r
46         CreateColorTable() ;\r
47 \r
48         window.parent.SetOkButton( true ) ;\r
49         window.parent.SetAutoSize( true ) ;\r
50 }\r
51 \r
52 function CreateColorTable()\r
53 {\r
54         // Get the target table.\r
55         var oTable = document.getElementById('ColorTable') ;\r
56 \r
57         // Create the base colors array.\r
58         var aColors = ['00','33','66','99','cc','ff'] ;\r
59 \r
60         // This function combines two ranges of three values from the color array into a row.\r
61         function AppendColorRow( rangeA, rangeB )\r
62         {\r
63                 for ( var i = rangeA ; i < rangeA + 3 ; i++ )\r
64                 {\r
65                         var oRow = oTable.insertRow(-1) ;\r
66 \r
67                         for ( var j = rangeB ; j < rangeB + 3 ; j++ )\r
68                         {\r
69                                 for ( var n = 0 ; n < 6 ; n++ )\r
70                                 {\r
71                                         AppendColorCell( oRow, '#' + aColors[j] + aColors[n] + aColors[i] ) ;\r
72                                 }\r
73                         }\r
74                 }\r
75         }\r
76 \r
77         // This function create a single color cell in the color table.\r
78         function AppendColorCell( targetRow, color )\r
79         {\r
80                 var oCell = targetRow.insertCell(-1) ;\r
81                 oCell.className = 'ColorCell' ;\r
82                 oCell.bgColor = color ;\r
83 \r
84                 oCell.onmouseover = function()\r
85                 {\r
86                         document.getElementById('hicolor').style.backgroundColor = this.bgColor ;\r
87                         document.getElementById('hicolortext').innerHTML = this.bgColor ;\r
88                 }\r
89 \r
90                 oCell.onclick = function()\r
91                 {\r
92                         document.getElementById('selhicolor').style.backgroundColor = this.bgColor ;\r
93                         document.getElementById('selcolor').value = this.bgColor ;\r
94                 }\r
95         }\r
96 \r
97         AppendColorRow( 0, 0 ) ;\r
98         AppendColorRow( 3, 0 ) ;\r
99         AppendColorRow( 0, 3 ) ;\r
100         AppendColorRow( 3, 3 ) ;\r
101 \r
102         // Create the last row.\r
103         var oRow = oTable.insertRow(-1) ;\r
104 \r
105         // Create the gray scale colors cells.\r
106         for ( var n = 0 ; n < 6 ; n++ )\r
107         {\r
108                 AppendColorCell( oRow, '#' + aColors[n] + aColors[n] + aColors[n] ) ;\r
109         }\r
110 \r
111         // Fill the row with black cells.\r
112         for ( var i = 0 ; i < 12 ; i++ )\r
113         {\r
114                 AppendColorCell( oRow, '#000000' ) ;\r
115         }\r
116 }\r
117 \r
118 function Clear()\r
119 {\r
120         document.getElementById('selhicolor').style.backgroundColor = '' ;\r
121         document.getElementById('selcolor').value = '' ;\r
122 }\r
123 \r
124 function ClearActual()\r
125 {\r
126         document.getElementById('hicolor').style.backgroundColor = '' ;\r
127         document.getElementById('hicolortext').innerHTML = '&nbsp;' ;\r
128 }\r
129 \r
130 function UpdateColor()\r
131 {\r
132         try               { document.getElementById('selhicolor').style.backgroundColor = document.getElementById('selcolor').value ; }\r
133         catch (e) { Clear() ; }\r
134 }\r
135 \r
136 function Ok()\r
137 {\r
138         if ( typeof(window.parent.dialogArguments.CustomValue) == 'function' )\r
139                 window.parent.dialogArguments.CustomValue( document.getElementById('selcolor').value ) ;\r
140 \r
141         return true ;\r
142 }\r
143                 </script>\r
144         </head>\r
145         <body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">\r
146                 <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">\r
147                         <tr>\r
148                                 <td align="center" valign="middle">\r
149                                         <table border="0" cellspacing="5" cellpadding="0" width="100%">\r
150                                                 <tr>\r
151                                                         <td valign="top" align="center" nowrap width="100%">\r
152                                                                 <table id="ColorTable" border="0" cellspacing="0" cellpadding="0" width="270" onmouseout="ClearActual();">\r
153                                                                 </table>\r
154                                                         </td>\r
155                                                         <td valign="top" align="left" nowrap>\r
156                                                                 <span fckLang="DlgColorHighlight">Highlight</span>\r
157                                                                 <div id="hicolor"></div>\r
158                                                                 <div id="hicolortext">&nbsp;</div>\r
159                                                                 <span fckLang="DlgColorSelected">Selected</span>\r
160                                                                 <div id="selhicolor"></div>\r
161                                                                 <input id="selcolor" type="text" maxlength="20" onchange="UpdateColor();">\r
162                                                                 <br>\r
163                                                                 <input id="btnClear" type="button" fckLang="DlgColorBtnClear" value="Clear" onclick="Clear();" />\r
164                                                         </td>\r
165                                                 </tr>\r
166                                         </table>\r
167                                 </td>\r
168                         </tr>\r
169                 </table>\r
170         </body>\r
171 </html>\r