OSDN Git Service

import source-tree based svn r84.
[bluegriffon/BlueGriffon.git] / base / content / bluegriffon / dialogs / newPageWizard.js
1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * The contents of this file are subject to the Mozilla Public License Version
5  * 1.1 (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11  * for the specific language governing rights and limitations under the
12  * License.
13  *
14  * The Original Code is BlueGriffon.
15  *
16  * The Initial Developer of the Original Code is
17  * Disruptive Innovations SARL.
18  * Portions created by the Initial Developer are Copyright (C) 2008
19  * the Initial Developer. All Rights Reserved.
20  *
21  * Contributor(s):
22  *   Daniel Glazman <daniel.glazman@disruptive-innovations.com>, Original author
23  *
24  * Alternatively, the contents of this file may be used under the terms of
25  * either the GNU General Public License Version 2 or later (the "GPL"), or
26  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27  * in which case the provisions of the GPL or the LGPL are applicable instead
28  * of those above. If you wish to allow use of your version of this file only
29  * under the terms of either the GPL or the LGPL, and not to allow others to
30  * use your version of this file under the terms of the MPL, indicate your
31  * decision by deleting the provisions above and replace them with the notice
32  * and other provisions required by the GPL or the LGPL. If you do not delete
33  * the provisions above, a recipient may use your version of this file under
34  * the terms of any one of the MPL, the GPL or the LGPL.
35  *
36  * ***** END LICENSE BLOCK ***** */
37
38 Components.utils.import("resource://gre/modules/colourPickerHelper.jsm");
39
40 var gFpb = null;     // file picker
41 var gPreview = null; // preview iframe for colors
42 var gAuthor = "";
43 var gDescription = "";
44 var gKeywords = "";
45 var gRootElement;
46 var gTitleWasEdited = false;
47 var gAuthorWasEdited = false;
48 var gDescriptionWasEdited = false;
49 var gKeywordsWasEdited = false;
50 var gLanguageWasEdited = false;
51 var gPrefs;
52
53 var gUseSystemColors = true;
54
55 var gHorizPosition = "50%";
56 var gVertPosition = "50%";
57
58 function Startup()
59 {
60   GetUIElements();
61
62   var gFpb = gDialog["filepickerbutton"];
63   if (gFpb)
64     gFpb.appendFilters(Components.interfaces.nsIFilePicker.filterImages);
65
66   gPreview = gDialog["pagePreview"];
67
68   gRootElement = EditorUtils.getCurrentEditor().rootElement;
69   InitDialog();
70
71   SetTextboxFocus(gDialog.pageTitle);
72 }
73
74 function InitDialog()
75 {
76   gDialog.pageTitle.value = EditorUtils.getDocumentTitle();
77   try {
78     // Fill in with value from editor prefs
79     gPrefs = GetPrefs();
80     if (gPrefs) 
81       gAuthor = gPrefs.getCharPref("bluegriffon.author");
82   }
83   catch(e) {}
84   // if we still have no author name, use the system username if any
85   if (!gAuthor)
86     try {
87       gAuthor = Components.classes["@mozilla.org/userinfo;1"]
88                   .getService(Components.interfaces.nsIUserInfo).username;
89     }
90     catch(e) {}
91   gDialog.pageAuthor.value = gAuthor;
92
93   // COLORS
94   gUseSystemColors = gPrefs.getBoolPref("bluegriffon.display.use_system_colors");
95   gForegroundColor = gPrefs.getCharPref("bluegriffon.display.foreground_color");
96   gBackgroundColor = gPrefs.getCharPref("bluegriffon.display.background_color");
97   gActiveColor = gPrefs.getCharPref("bluegriffon.display.active_color");
98   gAnchorColor = gPrefs.getCharPref("bluegriffon.display.anchor_color");
99   gVisitedColor = gPrefs.getCharPref("bluegriffon.display.visited_color");
100   gDialog.underlineLinks.checked = gPrefs.getBoolPref("bluegriffon.display.underline_links");
101   gDialog.userDefinedColors.checked = !gUseSystemColors;
102   EnableUserDefinedColorsControls();
103 }
104
105 function EnableUserDefinedColorsControls()
106 {
107   var enabled = gDialog.userDefinedColors.checked;
108   gDialog.backgroundColorColorpicker.color = (enabled ? gBackgroundColor : "transparent");
109   gDialog.textColorColorpicker.color = (enabled ? gForegroundColor : "transparent");
110   gDialog.linksColorColorpicker.color = (enabled ? gAnchorColor : "transparent");
111   gDialog.activeLinksColorColorpicker.color = (enabled ? gActiveColor : "transparent");
112   gDialog.visitedLinksColorColorpicker.color = (enabled ? gVisitedColor : "transparent");
113
114   gDialog.pagePreview.style.backgroundColor = enabled ? gBackgroundColor : "#ffffff";
115   gDialog.textPreview.style.color = enabled ? gForegroundColor : "#000000";
116   gDialog.linksPreview.style.color = enabled ? gAnchorColor : "#0000ee";
117   gDialog.activeLinksPreview.style.color = enabled ? gActiveColor : "#ee0000";
118   gDialog.visitedLinksPreview.style.color = enabled ? gVisitedColor : "#551a8b";
119
120   var underline = gDialog.underlineLinks.checked || !enabled;
121   gDialog.linksPreview.style.textDecoration = underline ? "underline" : "none";
122   gDialog.activeLinksPreview.style.textDecoration = underline ? "underline" : "none";
123   gDialog.visitedLinksPreview.style.textDecoration = underline ? "underline" : "none";
124   
125   SetEnabledElement(gDialog.backgroundColorColorpickerLabel, enabled);
126   SetEnabledElement(gDialog.backgroundColorColorpicker, enabled);
127   SetEnabledElement(gDialog.textColorColorpickerLabel, enabled);
128   SetEnabledElement(gDialog.textColorColorpicker, enabled);
129   SetEnabledElement(gDialog.linksColorColorpickerLabel, enabled);
130   SetEnabledElement(gDialog.linksColorColorpicker, enabled);
131   SetEnabledElement(gDialog.activeLinksColorColorpickerLabel, enabled);
132   SetEnabledElement(gDialog.activeLinksColorColorpicker, enabled);
133   SetEnabledElement(gDialog.visitedLinksColorColorpickerLabel, enabled);
134   SetEnabledElement(gDialog.visitedLinksColorColorpicker, enabled);
135   SetEnabledElement(gDialog.textPreview, enabled);
136   SetEnabledElement(gDialog.linksPreview, enabled);
137   SetEnabledElement(gDialog.activeLinksPreview, enabled);
138   SetEnabledElement(gDialog.visitedLinksPreview, enabled);
139   SetEnabledElement(gDialog.underlineLinks, enabled);
140 }
141
142 function onColorChange(aColorPicker)
143 {
144   switch (aColorPicker.id)
145   {
146     case "backgroundColorColorpicker":
147       gBackgroundColor = aColorPicker.color;
148       break;
149     case "textColorColorpicker":
150       gForegroundColor = aColorPicker.color;
151       break;
152     case "linksColorColorpicker":
153       gAnchorColor = aColorPicker.color;
154       break;
155     case "activeLinksColorColorpicker":
156       gActiveColor = aColorPicker.color;
157       break;
158     case "visitedLinksColorColorpicker":
159       gVisitedColor = aColorPicker.color;
160       break;
161     default: break;  // sanity code
162   }
163   EnableUserDefinedColorsControls();
164 }
165
166 var gColorPicker = {};
167
168 function OpenColorDialog(aElt, aColorObjectId)
169 {
170   switch(aElt.id)
171   {
172     case "backgroundColorColorpicker":
173       ColorPickerHelper.openColorPickerPanel("backgroundColor", "", true,
174                                              "colorPickerPopup",
175                                              "colorPickerSheetIFrame",
176                                              aElt);
177       break;
178     default:
179       break;
180   }
181 }
182
183 function SelectLanguage(aElt)
184 {
185   var retValue = { lang: "" };
186   window.openDialog("chrome://bluegriffon/content/dialogs/languages.xul","_blank",
187                     "chrome,modal=no,dialog=yes,titlebar", null, retValue);
188   gDialog.pageLanguage.value = retValue.lang;
189 }
190
191 function ShowBackgroundPosition(aEvent)
192 {
193   var x = aEvent.screenX  - gDialog.backgroundPositionBox.boxObject.screenX;
194   var y = aEvent.screenY + 1 - gDialog.backgroundPositionBox.boxObject.screenY;
195   if (x < 0 || y < 0 || x > 100 | y > 100)
196     ExitBackgroundPosition(aEvent);
197
198   gDialog.horizPosition.value = x + "%";
199   gDialog.vertPosition.value  = y + "%";
200   gDialog.horizPosition.style.color = "";
201   gDialog.vertPosition.style.color = "";
202   gDialog.horizPosition.style.fontWeight = "";
203   gDialog.vertPosition.style.fontWeight = "";
204   gDialog.backgroundPositionBox.style.backgroundPosition = (100-x) + "% " + (100-y) +"%";
205 }
206
207 function SetBackgroundPosition(aEvent)
208 {
209   var x = aEvent.screenX  - gDialog.backgroundPositionBox.boxObject.screenX;
210   var y = aEvent.screenY + 1 - gDialog.backgroundPositionBox.boxObject.screenY;
211   if (x < 0 || y < 0 || x > 100 | y > 100)
212     ExitBackgroundPosition(aEvent);
213
214   ShowBackgroundPosition(aEvent)
215
216   gDialog.horizPosition.style.color = "red";
217   gDialog.vertPosition.style.color = "red";
218   gDialog.horizPosition.style.fontWeight = "bold";
219   gDialog.vertPosition.style.fontWeight = "bold";
220   gHorizPosition = gDialog.horizPosition.value;
221   gVertPosition = gDialog.vertPosition.value;
222   gDialog.backgroundImageBox.style.backgroundPosition = gHorizPosition + " " + gVertPosition;
223 }
224
225 function ExitBackgroundPosition(event)
226 {
227   gDialog.horizPosition.value = gHorizPosition;
228   gDialog.vertPosition.value  = gVertPosition;
229   gDialog.horizPosition.style.color = "";
230   gDialog.vertPosition.style.color = "";
231   gDialog.horizPosition.style.fontWeight = "";
232   gDialog.vertPosition.style.fontWeight = "";
233   var x = parseInt(gHorizPosition);
234   var y = parseInt(gVertPosition);
235   gDialog.backgroundPositionBox.style.backgroundPosition = (100-x) + "% " + (100-y) +"%";
236 }
237
238 function SetBackgroundRepeat(aElt)
239 {
240   gDialog.backgroundImageBox.style.backgroundRepeat = aElt.value;
241 }
242
243 function onUsePageLayoutChanged(aCheckbox)
244 {
245   var enabled = aCheckbox.checked;
246   SetEnabledElementAndControl(gDialog.LayoutTypeMenulistLabel, enabled);
247   SetEnabledElementAndControl(gDialog.LayoutSubtypeMenulistLabel, enabled);
248
249   SetEnabledElement(gDialog.ContentRowsListbox, enabled);
250
251   SetEnabledElement(gDialog.ContentRowsPlusButton, enabled);
252   SetEnabledElement(gDialog.ContentRowsMinusButton, enabled && gDialog.ContentRowsListbox.itemCount);
253   // SetEnabledElement(gDialog.ContentRowsConfigButton, enabled);
254
255   SetEnabledElement(gDialog.LoremIpsumCheckbox, enabled);
256 }
257
258 function AddContentRow(aEvent)
259 {
260   var item = aEvent.originalTarget;
261   var label = item.label;
262   var value = item.value;
263
264   var listItem = gDialog.ContentRowsListbox.appendItem(label, value);
265   gDialog.ContentRowsListbox.selectItem(listItem);
266   SetEnabledElement(gDialog.ContentRowsMinusButton, true);
267 }
268
269 function RemoveContentRow()
270 {
271   var listbox = gDialog.ContentRowsListbox;
272   var item = listbox.selectedItem;
273   if (item)
274   {
275     var index = listbox.getIndexOfItem(item);
276     listbox.removeItemAt(index);
277     var count = listbox.itemCount;
278     if (count)
279     {
280       if (index >= count)
281         index = count - 1;
282       item = listbox.getItemAtIndex(index);
283       listbox.selectItem(item);
284     }
285     else
286       SetEnabledElement(gDialog.ContentRowsMinusButton, false);
287   }
288 }
289
290 function Apply()
291 {
292   var doc = EditorUtils.getCurrentDocument();
293
294   // UI CSS GRID LAYOUT
295   if (gDialog.usePageLayout.checked)
296   {
297     var loremIpusm = gDialog.LoremIpsumCheckbox.checked;
298
299     var linkElt = doc.createElement("link");
300     linkElt.setAttribute("type", "text/css");
301     linkElt.setAttribute("rel", "stylesheet");
302     linkElt.setAttribute("href", "http://yui.yahooapis.com/2.6.0/build/reset-fonts-grids/reset-fonts-grids.css");
303     EditorUtils.getHeadElement().appendChild(linkElt);
304     linkElt = doc.createElement("link");
305     linkElt.setAttribute("type", "text/css");
306     linkElt.setAttribute("rel", "stylesheet");
307     linkElt.setAttribute("href", "http://yui.yahooapis.com/2.6.0/build/base/base-min.css");
308     EditorUtils.getHeadElement().appendChild(linkElt);
309
310     var docId    = gDialog.LayoutTypeMenulist.value;
311     var docClass = gDialog.LayoutSubtypeMenulist.value;
312     var outerDiv = doc.createElement("div");
313     outerDiv.setAttribute("id", docId);
314     outerDiv.setAttribute("class", docClass);
315     doc.body.innerHTML = "";
316     doc.body.appendChild(outerDiv);
317
318     var headerDiv = doc.createElement("div");
319     headerDiv.setAttribute("id", "hd");
320     var bodyDiv = doc.createElement("div");
321     bodyDiv.setAttribute("id", "bd");
322     var footerDiv = doc.createElement("div");
323     footerDiv.setAttribute("id", "ft");
324     outerDiv.appendChild(headerDiv);
325     outerDiv.appendChild(bodyDiv);
326     outerDiv.appendChild(footerDiv);
327
328     var loremIpsumStr = "<br>";
329     var navProse = "";
330     if (loremIpusm)
331     {
332       var loremIpsumProse = L10NUtils.getStringFromURL("loremIpsum",
333                                              "chrome://bluegriffon/locale/newPageWizard.properties");
334       var headerProse = L10NUtils.getStringFromURL("header",
335                                              "chrome://bluegriffon/locale/newPageWizard.properties");
336       var footerProse = L10NUtils.getStringFromURL("footer",
337                                              "chrome://bluegriffon/locale/newPageWizard.properties");
338       navProse =    L10NUtils.getStringFromURL("nav",
339                                              "chrome://bluegriffon/locale/newPageWizard.properties");
340
341       var h1 = doc.createElement("h1");
342       var headerTextNode = doc.createTextNode(headerProse);
343       h1.appendChild(headerTextNode);
344       headerDiv.appendChild(h1);
345       var p = doc.createElement("p");
346       var footerTextNode = doc.createTextNode(footerProse);
347       p.appendChild(footerTextNode);
348       footerDiv.appendChild(p);
349
350       loremIpsumStr = "<p>" + loremIpsumProse + "</p>";
351     }
352     else
353     {
354       var headerBr = doc.createElement("br");
355       headerDiv.appendChild(headerBr);
356       var footerBr = doc.createElement("br");
357       footerDiv.appendChild(footerBr);
358     }
359
360     var mainContainer = bodyDiv;
361     if (docClass != "yui-t7")
362     {
363       mainContainer = doc.createElement("div");
364       mainContainer.setAttribute("class", "yui-b");
365       mainContainerContainer = doc.createElement("div");
366       mainContainerContainer.setAttribute("id", "yui-main");
367
368       mainContainerContainer.appendChild(mainContainer);
369       bodyDiv.appendChild(mainContainerContainer);
370     }
371
372     var listbox = gDialog.ContentRowsListbox;
373     for (var i = 0 ; i < listbox.itemCount; i++)
374     {
375       var item = listbox.getItemAtIndex(i);
376       var value = item.value;
377       var ihtml = "";
378       switch (value)
379       {
380               case "1": // .yui-g
381           ihtml = "<div class='yui-g'>" + loremIpsumStr + "</div>";
382           break;  // oneColumn100
383
384         case "2": // .yui-g > .yui-u.first + .yui-u 
385           ihtml = "<div class='yui-g'><div class='yui-u first'>" + loremIpsumStr +
386                                "</div><div class='yui-u'>" + loremIpsumStr +
387                                "</div></div>";
388           break;  // twoColumns5050
389
390         case "3": // .yui-gc > .yui-u.first + .yui-u 
391           ihtml = "<div class='yui-gc'><div class='yui-u first'>" + loremIpsumStr +
392                                "</div><div class='yui-u'>" + loremIpsumStr +
393                                "</div></div>";
394           break;  // twoColumns6633
395
396         case "4": // .yui-gd > .yui-u.first + .yui-u 
397           ihtml = "<div class='yui-gd'><div class='yui-u first'>" + loremIpsumStr +
398                                "</div><div class='yui-u'>" + loremIpsumStr +
399                                "</div></div>";
400           break;  // twoColumns3366
401
402         case "5": // .yui-ge > .yui-u.first + .yui-u 
403           ihtml = "<div class='yui-ge'><div class='yui-u first'>" + loremIpsumStr +
404                                "</div><div class='yui-u'>" + loremIpsumStr +
405                                "</div></div>";
406           break;  // twoColumns7525
407
408         case "6": // .yui-gf > .yui-u.first + .yui-u 
409           ihtml = "<div class='yui-gf'><div class='yui-u first'>" + loremIpsumStr +
410                                "</div><div class='yui-u'>" + loremIpsumStr +
411                                "</div></div>";
412           break;  // twoColumns2575
413
414         case "7": // .yui-gb > .yui-u.first + .yui-u + .yui-u 
415           ihtml = "<div class='yui-gb'><div class='yui-u first'>" + loremIpsumStr +
416                                "</div><div class='yui-u'>" + loremIpsumStr +
417                                "</div><div class='yui-u'>" + loremIpsumStr +
418                                "</div></div>";
419           break;  // threeColumns333333
420
421         case "8": // .yui-g > .yui-u first + .yui-g > .yui-u.first + .yui-u
422           ihtml = "<div class='yui-g'><div class='yui-u first'>" + loremIpsumStr +
423                                "</div><div class='yui-g'><div class='yui-u first'>" + loremIpsumStr +
424                                                    "</div><div class='yui-u'>" + loremIpsumStr +
425                                        "</div></div></div>";
426           break;  // threeColumns502525
427
428         case "9": // .yui-g > .yui-g.first ( > .yui-u.first + .yui-u ) + .yui-u
429           ihtml = "<div class='yui-g'><div class='yui-g first'><div class='yui-u first'>" + loremIpsumStr +
430                                                    "</div><div class='yui-u'>" + loremIpsumStr +
431                                        "</div></div><div class='yui-u'>" + loremIpsumStr +
432                                "</div></div>";
433           break;  // threeColumns252550
434
435         case "10": // .yui-g > .yui-g.first ( > .yui-u.first + .yui-u ) + .yui-g ( > .yui-u.first + .yui-u )
436           ihtml = "<div class='yui-g'><div class='yui-g first'><div class='yui-u first'>" + loremIpsumStr +
437                                                    "</div><div class='yui-u'>" + loremIpsumStr +
438                                        "</div></div><div class='yui-g'><div class='yui-u first'>" + loremIpsumStr +
439                                                    "</div><div class='yui-u'>" + loremIpsumStr +
440                                        "</div></div></div>";
441           break;  // fourColumns25252525
442
443         default: break // should not happen
444       }
445       mainContainer.innerHTML += ihtml;
446     }
447
448     // the sidebar now...
449     if (docClass != "yui-t7")
450     {
451       bodyDiv.innerHTML += "<div class='yui-b'>" + navProse + "</div>";
452     }
453   }
454
455   // DOCUMENT METADATA
456   if (gDialog.pageTitle.value)
457   {
458     EditorUtils.setDocumentTitle(gDialog.pageTitle.value);
459   }
460
461   if (gDialog.pageAuthor.value)
462   {
463     var meta = EditorUtils.createMetaElement("author");
464     EditorUtils.insertMetaElement(meta, gDialog.pageAuthor.value, true, false);
465   }
466
467   if (gDialog.pageDescription.value)
468   {
469     meta = EditorUtils.createMetaElement("description");
470     EditorUtils.insertMetaElement(meta, gDialog.pageDescription.value, true, false);
471   }
472
473   if (gDialog.pageKeywords.value)
474   {
475     meta = EditorUtils.createMetaElement("keywords");
476     EditorUtils.insertMetaElement(meta, gDialog.pageKeywords.value, true, false);
477   }
478
479   meta = EditorUtils.createMetaElement("generator");
480   EditorUtils.insertMetaElement(meta, "BlueGriffon wysiwyg editor", true, false);
481
482   if (gDialog.pageLanguage.value)
483     EditorUtils.getCurrentDocument().documentElement.
484       setAttribute("lang", gDialog.pageLanguage.value);
485
486   // COLORS
487   var prefs = GetPrefs();
488   if (gDialog.makeColorsDefault.checked)
489     prefs.setBoolPref("bluegriffon.display.use_system_colors", !gDialog.userDefinedColors.checked)
490   if (gDialog.userDefinedColors.checked)
491   {
492     var bgColor      = gDialog.backgroundColorColorpicker.color;
493     var fgColor      = gDialog.textColorColorpicker.color;
494     var linksColor   = gDialog.linksColorColorpicker.color;
495     var activeColor  = gDialog.activeLinksColorColorpicker.color;
496     var visitedColor = gDialog.visitedLinksColorColorpicker.color;
497
498     CssUtils.getStyleSheetForScreen(doc);
499     CssUtils.addRuleForSelector(doc, "html", [ { property: "background-color",
500                                                  value: bgColor,
501                                                  priority: false } ] );
502     CssUtils.addRuleForSelector(doc, "body", [ { property: "background-color",
503                                                  value: bgColor,
504                                                  priority: false },
505                                                {
506                                                  property: "color",
507                                                  value: fgColor,
508                                                  priority: false } ] );
509     CssUtils.addRuleForSelector(doc, ":link", [ { property: "color",
510                                                  value: linksColor,
511                                                  priority: false } ] );
512     if (!gDialog.underlineLinks.checked)
513             CssUtils.addRuleForSelector(doc, ":link", [ { property: "text-decoration",
514                                                          value: "none",
515                                                          priority: false } ] );
516     CssUtils.addRuleForSelector(doc, ":link:active", [ { property: "color",
517                                                           value: activeColor,
518                                                           priority: false } ] );
519     CssUtils.addRuleForSelector(doc, ":link:visited", [ { property: "color",
520                                                           value: visitedColor,
521                                                           priority: false } ] );
522
523     if (gDialog.makeColorsDefault.checked)
524     {
525             prefs.setCharPref("bluegriffon.display.foreground_color", fgColor);
526             prefs.setCharPref("bluegriffon.display.background_color", bgColor);
527             prefs.setCharPref("bluegriffon.display.active_color", activeColor);
528             prefs.setCharPref("bluegriffon.display.anchor_color", linksColor);
529             prefs.setCharPref("bluegriffon.display.visited_color", visitedColor);
530             prefs.setBoolPref("bluegriffon.display.underline_links", gDialog.underlineLinks.checked);
531     }
532   }
533
534   // BACKGROUND IMAGE
535   var bgImage = gDialog.backgroundImage.value; 
536   if (bgImage)
537   {
538     var bgRepeat     = gDialog.backgroundTile.value;
539     var bgAttachment = gDialog.backgroundScroll.value;
540     var bgPosition   = gDialog.horizPosition.value + " " + gDialog.vertPosition.value;
541     CssUtils.addRuleForSelector(doc, "body", [ { property: "background-image",
542                                                  value: 'url("' + bgImage + '")',
543                                                  priority: false },
544                                                {
545                                                  property: "background-repeat",
546                                                  value: bgRepeat,
547                                                  priority: false },
548                                                {
549                                                  property: "background-attachment",
550                                                  value: bgAttachment,
551                                                  priority: false },
552                                                {
553                                                  property: "background-position",
554                                                  value: bgPosition,
555                                                  priority: false } ] );
556   }
557 }
558
559
560 function OpenColorDialog(aColorObjectId, aElt)
561 {
562   var cph = ColorPickerHelper;
563   cph.openColorPicker(window, aColorObjectId, "tagada", true);
564   if (!cph.isCancelled(aColorObjectId))
565   {
566     aElt.firstChild.style.backgroundColor = cph.getCurrentColor(aColorObjectId);
567   }
568 }