FCKeditor 2.6.6
[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-2010 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 src="common/fck_dialog_common.js" type="text/javascript"></script>\r
38                 <script type="text/javascript">\r
39 \r
40 var oEditor = window.parent.InnerDialogLoaded() ;\r
41 \r
42 function OnLoad()\r
43 {\r
44         // First of all, translate the dialog box texts\r
45         oEditor.FCKLanguageManager.TranslatePage(document) ;\r
46 \r
47         CreateColorTable() ;\r
48 \r
49         window.parent.SetOkButton( true ) ;\r
50         window.parent.SetAutoSize( true ) ;\r
51 }\r
52 \r
53 function CreateColorTable()\r
54 {\r
55         // Get the target table.\r
56         var oTable = document.getElementById('ColorTable') ;\r
57 \r
58         // Create the base colors array.\r
59         var aColors = ['00','33','66','99','cc','ff'] ;\r
60 \r
61         // This function combines two ranges of three values from the color array into a row.\r
62         function AppendColorRow( rangeA, rangeB )\r
63         {\r
64                 for ( var i = rangeA ; i < rangeA + 3 ; i++ )\r
65                 {\r
66                         var oRow = oTable.insertRow(-1) ;\r
67 \r
68                         for ( var j = rangeB ; j < rangeB + 3 ; j++ )\r
69                         {\r
70                                 for ( var n = 0 ; n < 6 ; n++ )\r
71                                 {\r
72                                         AppendColorCell( oRow, '#' + aColors[j] + aColors[n] + aColors[i] ) ;\r
73                                 }\r
74                         }\r
75                 }\r
76         }\r
77 \r
78         // This function create a single color cell in the color table.\r
79         function AppendColorCell( targetRow, color )\r
80         {\r
81                 var oCell = targetRow.insertCell(-1) ;\r
82                 oCell.className = 'ColorCell' ;\r
83                 oCell.bgColor = color ;\r
84 \r
85                 oCell.onmouseover = function()\r
86                 {\r
87                         document.getElementById('hicolor').style.backgroundColor = this.bgColor ;\r
88                         document.getElementById('hicolortext').innerHTML = this.bgColor ;\r
89                 }\r
90 \r
91                 oCell.onclick = function()\r
92                 {\r
93                         document.getElementById('selhicolor').style.backgroundColor = this.bgColor ;\r
94                         document.getElementById('selcolor').value = this.bgColor ;\r
95                 }\r
96         }\r
97 \r
98         AppendColorRow( 0, 0 ) ;\r
99         AppendColorRow( 3, 0 ) ;\r
100         AppendColorRow( 0, 3 ) ;\r
101         AppendColorRow( 3, 3 ) ;\r
102 \r
103         // Create the last row.\r
104         var oRow = oTable.insertRow(-1) ;\r
105 \r
106         // Create the gray scale colors cells.\r
107         for ( var n = 0 ; n < 6 ; n++ )\r
108         {\r
109                 AppendColorCell( oRow, '#' + aColors[n] + aColors[n] + aColors[n] ) ;\r
110         }\r
111 \r
112         // Fill the row with black cells.\r
113         for ( var i = 0 ; i < 12 ; i++ )\r
114         {\r
115                 AppendColorCell( oRow, '#000000' ) ;\r
116         }\r
117 }\r
118 \r
119 function Clear()\r
120 {\r
121         document.getElementById('selhicolor').style.backgroundColor = '' ;\r
122         document.getElementById('selcolor').value = '' ;\r
123 }\r
124 \r
125 function ClearActual()\r
126 {\r
127         document.getElementById('hicolor').style.backgroundColor = '' ;\r
128         document.getElementById('hicolortext').innerHTML = '&nbsp;' ;\r
129 }\r
130 \r
131 function UpdateColor()\r
132 {\r
133         try               { document.getElementById('selhicolor').style.backgroundColor = document.getElementById('selcolor').value ; }\r
134         catch (e) { Clear() ; }\r
135 }\r
136 \r
137 function Ok()\r
138 {\r
139         if ( typeof(window.parent.Args().CustomValue) == 'function' )\r
140                 window.parent.Args().CustomValue( document.getElementById('selcolor').value ) ;\r
141 \r
142         return true ;\r
143 }\r
144                 </script>\r
145         </head>\r
146         <body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">\r
147                 <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">\r
148                         <tr>\r
149                                 <td align="center" valign="middle">\r
150                                         <table border="0" cellspacing="5" cellpadding="0" width="100%">\r
151                                                 <tr>\r
152                                                         <td valign="top" align="center" nowrap width="100%">\r
153                                                                 <table id="ColorTable" border="0" cellspacing="0" cellpadding="0" width="270" onmouseout="ClearActual();">\r
154                                                                 </table>\r
155                                                         </td>\r
156                                                         <td valign="top" align="left" nowrap>\r
157                                                                 <span fckLang="DlgColorHighlight">Highlight</span>\r
158                                                                 <div id="hicolor"></div>\r
159                                                                 <div id="hicolortext">&nbsp;</div>\r
160                                                                 <span fckLang="DlgColorSelected">Selected</span>\r
161                                                                 <div id="selhicolor"></div>\r
162                                                                 <input id="selcolor" type="text" maxlength="20" onchange="UpdateColor();">\r
163                                                                 <br>\r
164                                                                 <input id="btnClear" type="button" fckLang="DlgColorBtnClear" value="Clear" onclick="Clear();" />\r
165                                                         </td>\r
166                                                 </tr>\r
167                                         </table>\r
168                                 </td>\r
169                         </tr>\r
170                 </table>\r
171         </body>\r
172 </html>\r