+function labelColorReset() {
+ try {
+ var labels = getSelectedLabels();
+
+ var ok = confirm(__("Reset label colors to default?"));
+
+ if (ok) {
+
+ var query = "backend.php?op=pref-labels&subop=color-reset&ids="+
+ param_escape(labels.toString());
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ labellist_callback2(transport);
+ } });
+ }
+
+ } catch (e) {
+ exception_error("labelColorReset", e);
+ }
+}
+
+function labelColorAsk(id, kind) {
+ try {
+
+ var p = null
+
+ if (kind == "fg") {
+ p = prompt(__("Please enter new label foreground color:"));
+ } else {
+ p = prompt(__("Please enter new label background color:"));
+ }
+
+ if (p != null) {
+
+ var query = "backend.php?op=pref-labels&subop=color-set&kind=" + kind +
+ "&ids="+ param_escape(id) + "&color=" + param_escape(p);
+
+ selectPrefRows('label', false);
+
+ var e = $("LICID-" + id);
+
+ if (e) {
+ if (kind == "fg") {
+ e.style.color = p
+ } else {
+ e.style.backgroundColor = p;
+ }
+ }
+
+ new Ajax.Request(query);
+ }
+
+ } catch (e) {
+ exception_error("labelColorReset", e);
+ }
+}
+
+
+function colorPicker(id, fg, bg) {
+ try {
+ var picker = $("colorPicker-" + id);
+
+ if (picker) Element.show(picker);
+
+ } catch (e) {
+ exception_error("colorPicker", e);
+ }
+}
+
+function colorPickerHideAll() {
+ try {
+ if ($("prefLabelList")) {
+
+ var elems = $("prefLabelList").getElementsByTagName("DIV");
+
+ for (var i = 0; i < elems.length; i++) {
+ if (elems[i].id && elems[i].id.match("colorPicker-")) {
+ Element.hide(elems[i]);
+ }
+ }
+ }
+
+ } catch (e) {
+ exception_error("colorPickerHideAll", e);
+ }
+}
+
+function colorPickerDo(id, fg, bg) {
+ try {
+
+ var query = "backend.php?op=pref-labels&subop=color-set&kind=both"+
+ "&ids=" + param_escape(id) + "&fg=" + param_escape(fg) +
+ "&bg=" + param_escape(bg);
+
+ var e = $("LICID-" + id);
+
+ if (e) {
+ e.style.color = fg;
+ e.style.backgroundColor = bg;
+ }
+
+ new Ajax.Request(query);
+
+ } catch (e) {
+ exception_error("colorPickerDo", e);
+ }
+}
+
+function colorPickerActive(b) {
+ color_picker_active = b;
+}
+
+function mouse_down_handler(e) {
+ try {
+
+ /* do not prevent right click */
+ if (e.button && e.button == 2) return;
+
+ if (selection_disabled) {
+ document.onselectstart = function() { return false; };
+ return false;
+ }
+
+ } catch (e) {
+ exception_error("mouse_move_handler", e);
+ }
+}
+
+function mouse_up_handler(e) {
+ try {
+ mouse_is_down = false;
+
+ if (!selection_disabled) {
+ document.onselectstart = null;
+ }
+
+ if (!color_picker_active) {
+ colorPickerHideAll();
+ }
+
+ } catch (e) {
+ exception_error("mouse_move_handler", e);
+ }
+}
+