Permalink
Browse files

logger name changed.

  • Loading branch information...
1 parent a40e830 commit 8841c0cee73f24df65888a84e2ba2dde8c360b2b Jonas Fiala committed Jun 30, 2010
Showing with 17 additions and 14 deletions.
  1. +3 −0 ella/newman/media/js/generic.suggest.js
  2. +14 −14 ella/newman/media/js/related_lookup.js
@@ -3,6 +3,9 @@
* requires: jQuery 1.4.2+,
* str_concat() function (effective string concatenation).
*
+ * provides:
+ * GenericSuggestLib object.
+ *
*/
/* TODO:
* neukazovat vybrané hodnoty v lupičce,
@@ -2,12 +2,9 @@
* Common utilities/functions and objects.
* requires: jQuery 1.4.2+,
* LoggingLib object (utils.js).
- *
- * provides:
- * GenericSuggestLib object.
*/
-// suggester logging
-log_suggester = new LoggingLib('SUGGESTER:', false);
+// related lookup logging
+log_lookup = new LoggingLib('RELATED LOOKUP:', true);
// Suggester input's lupicka
(function($) {
@@ -16,21 +13,21 @@ log_suggester = new LoggingLib('SUGGESTER:', false);
var content_type = /\/(\w+\/\w+)\/(?:\?|$)/.exec( $(this).attr('href') )[1];
if ( ! content_type ) {
- log_suggester.log('Lupicka has unexpected href format: '+this);
+ log_lookup.log('Lupicka has unexpected href format: '+this);
return false;
}
var input_id = this.id.replace(/lookup_/,'') + '_suggest';
var inp = document.getElementById(input_id);
if (!inp) {
- log_suggester.log('Could not get suggester input for '+this.id);
+ log_lookup.log('Could not get suggester input for '+this.id);
return;
}
open_overlay(content_type, function(id, arg) {
var str = arg.str;
if (!str) {
- ;;; log_suggester.log('No string representation of selected object received.');
+ ;;; log_lookup.log('No string representation of selected object received.');
return false;
}
@@ -52,7 +49,7 @@ log_suggester = new LoggingLib('SUGGESTER:', false);
if ($img.length == 0) return;
var json_result = JSON.parse(response_text);
if ( typeof(json_result.data) == 'undefined' ) {
- log_suggester.log('WARNING: No data in JSON received');
+ log_lookup.log('WARNING: No data in JSON received');
return;
}
var image_path = str_concat(DJANGO_MEDIA_URL, json_result.data.image);
@@ -90,24 +87,27 @@ log_suggester = new LoggingLib('SUGGESTER:', false);
$target_input.trigger('change', [extras]);
// try to change photo (if rawid-related-lookup is for photo)
rawid_related_lookup_update_photo($target_input, id, extras);
+ log_lookup.log('photo updated');
}
if (evt.button != 0) return;
// From '../../core/author/?pop' take 'core/author'
var re_res = /([^\/]+)\/([^\/]+)\/(?:$|[?#])/.exec( $(this).attr('href') );
if (!re_res) {
- log_suggester.log('Unexpected href of related lookup:', $(this).attr('href'));
+ log_lookup.log('Unexpected href of related lookup:', $(this).attr('href'));
return false;
}
var content_type = re_res[1] + '.' + re_res[2];
var $target_input = $( '#' + this.id.replace(/^lookup_/, '') );
if ($target_input.length == 0 || $target_input.attr('id') == this.id) {
- log_suggester.log('Could not get raw id input from lupicka icon #'+this.id);
+ log_lookup.log('Could not get raw id input from lupicka icon #'+this.id);
return false;
}
+ log_lookup.log('Opening overlay...');
open_overlay(content_type, overlay_callback);
+ log_lookup.log('overlay opened.');
return false;
}
@@ -120,7 +120,7 @@ log_suggester = new LoggingLib('SUGGESTER:', false);
function id2ct(id) {
var ct = AVAILABLE_CONTENT_TYPES[ id ];
if ( ! ct ) {
- log_suggester.log('Unrecognized Content-Type id: '+id);
+ log_lookup.log('Unrecognized Content-Type id: '+id);
return;
}
return ct.path;
@@ -154,7 +154,7 @@ log_suggester = new LoggingLib('SUGGESTER:', false);
}
function click_live_handler() {
// Look for the corresponding content type input and target id input
- log_suggester.log('CALL.generic-related-lookup');
+ log_lookup.log('CALL.generic-related-lookup');
var $id_input = $( '#' + this.id.replace(/^lookup_/, '') );
var $ct_input = get_corresponding_input($id_input);
if ($ct_input.length == 0) {
@@ -211,7 +211,7 @@ log_suggester = new LoggingLib('SUGGESTER:', false);
onsave: function(popped, action_table_obj) {
if (!action_table_obj.vars.object_id) {
ADR_STACK = [];
- log_suggester.log('Did not get ID of newly added object -- breaking ADR_STACK');
+ log_lookup.log('Did not get ID of newly added object -- breaking ADR_STACK');
return;
}
popped.oid = action_table_obj.vars.object_id;

0 comments on commit 8841c0c

Please sign in to comment.