--- a/web/data/cubicweb.ajax.box.js Mon Sep 13 09:56:10 2010 +0200
+++ b/web/data/cubicweb.ajax.box.js Mon Sep 13 10:01:43 2010 +0200
@@ -11,71 +11,71 @@
var holderid = cw.utils.domid(boxid) + eid + 'Holder';
var value = $('#' + holderid + 'Input').val();
if (separator) {
- value = $.map(value.split(separator), jQuery.trim);
+ value = $.map(value.split(separator), jQuery.trim);
}
var d = loadRemote('json', ajaxFuncArgs(fname, null, eid, value));
d.addCallback(function() {
- $('#' + holderid).empty();
- var formparams = ajaxFuncArgs('render', null, 'boxes', boxid, eid);
- $('#' + cw.utils.domid(boxid) + eid).loadxhtml('json', formparams);
- if (msg) {
- document.location.hash = '#header';
- updateMessage(msg);
- }
- });
+ $('#' + holderid).empty();
+ var formparams = ajaxFuncArgs('render', null, 'boxes', boxid, eid);
+ $('#' + cw.utils.domid(boxid) + eid).loadxhtml('json', formparams);
+ if (msg) {
+ document.location.hash = '#header';
+ updateMessage(msg);
+ }
+ });
}
function ajaxBoxRemoveLinkedEntity(boxid, eid, relatedeid, delfname, msg) {
var d = loadRemote('json', ajaxFuncArgs(delfname, null, eid, relatedeid));
d.addCallback(function() {
- var formparams = ajaxFuncArgs('render', null, 'boxes', boxid, eid);
- $('#' + cw.utils.domid(boxid) + eid).loadxhtml('json', formparams);
- if (msg) {
- document.location.hash = '#header';
- updateMessage(msg);
- }
+ var formparams = ajaxFuncArgs('render', null, 'boxes', boxid, eid);
+ $('#' + cw.utils.domid(boxid) + eid).loadxhtml('json', formparams);
+ if (msg) {
+ document.location.hash = '#header';
+ updateMessage(msg);
+ }
});
}
function ajaxBoxShowSelector(boxid, eid,
- unrelfname,
- addfname, msg,
- oklabel, cancellabel,
- separator) {
+ unrelfname,
+ addfname, msg,
+ oklabel, cancellabel,
+ separator) {
var holderid = cw.utils.domid(boxid) + eid + 'Holder';
var holder = $('#' + holderid);
if (holder.children().length) {
- holder.empty();
+ holder.empty();
}
else {
- var inputid = holderid + 'Input';
- var deferred = loadRemote('json', ajaxFuncArgs(unrelfname, null, eid));
- deferred.addCallback(function (unrelated) {
- var input = INPUT({'type': 'text', 'id': inputid, 'size': 20});
- holder.append(input).show();
- $input = $(input);
- $input.keypress(function (event) {
- if (event.keyCode == KEYS.KEY_ENTER) {
- // XXX not very user friendly: we should test that the suggestions
- // aren't visible anymore
- ajaxBoxValidateSelectorInput(boxid, eid, separator, addfname, msg);
- }
- });
- var buttons = DIV({'class' : "sgformbuttons"},
- A({'href' : "javascript: noop();",
- 'onclick' : cw.utils.strFuncCall('ajaxBoxValidateSelectorInput',
- boxid, eid, separator, addfname, msg)},
- oklabel),
- ' / ',
- A({'href' : "javascript: noop();",
- 'onclick' : '$("#' + holderid + '").empty()'},
- cancellabel));
- holder.append(buttons);
- $input.autocomplete(unrelated, {
- multiple: separator,
- max: 15
- });
- $input.focus();
- });
+ var inputid = holderid + 'Input';
+ var deferred = loadRemote('json', ajaxFuncArgs(unrelfname, null, eid));
+ deferred.addCallback(function (unrelated) {
+ var input = INPUT({'type': 'text', 'id': inputid, 'size': 20});
+ holder.append(input).show();
+ $input = $(input);
+ $input.keypress(function (event) {
+ if (event.keyCode == KEYS.KEY_ENTER) {
+ // XXX not very user friendly: we should test that the suggestions
+ // aren't visible anymore
+ ajaxBoxValidateSelectorInput(boxid, eid, separator, addfname, msg);
+ }
+ });
+ var buttons = DIV({'class' : "sgformbuttons"},
+ A({'href' : "javascript: noop();",
+ 'onclick' : cw.utils.strFuncCall('ajaxBoxValidateSelectorInput',
+ boxid, eid, separator, addfname, msg)},
+ oklabel),
+ ' / ',
+ A({'href' : "javascript: noop();",
+ 'onclick' : '$("#' + holderid + '").empty()'},
+ cancellabel));
+ holder.append(buttons);
+ $input.autocomplete(unrelated, {
+ multiple: separator,
+ max: 15
+ });
+ $input.focus();
+ });
}
}
--- a/web/data/cubicweb.ajax.js Mon Sep 13 09:56:10 2010 +0200
+++ b/web/data/cubicweb.ajax.js Mon Sep 13 10:01:43 2010 +0200
@@ -94,28 +94,28 @@
function _loadAjaxHtmlHead($node, $head, tag, srcattr) {
var jqtagfilter = tag + '[' + srcattr + ']';
if (cw['loaded_'+srcattr] === undefined) {
- cw['loaded_'+srcattr] = [];
- var loaded = cw['loaded_'+srcattr];
- jQuery('head ' + jqtagfilter).each(function(i) {
- loaded.push(this.getAttribute(srcattr));
- });
+ cw['loaded_'+srcattr] = [];
+ var loaded = cw['loaded_'+srcattr];
+ jQuery('head ' + jqtagfilter).each(function(i) {
+ loaded.push(this.getAttribute(srcattr));
+ });
} else {
- var loaded = cw['loaded_'+srcattr];
+ var loaded = cw['loaded_'+srcattr];
}
$node.find(tag).each(function(i) {
- var url = this.getAttribute(srcattr);
+ var url = this.getAttribute(srcattr);
if (url) {
if (jQuery.inArray(url, loaded) == -1) {
- // take care to <script> tags: jQuery append method script nodes
- // don't appears in the DOM (See comments on
- // http://api.jquery.com/append/), which cause undesired
- // duplicated load in our case. After trying to use bare DOM api
- // to avoid this, we switched to handle a list of already loaded
- // stuff ourselves, since bare DOM api gives bug with the
- // server-response event, since we loose control on when the
- // script is loaded (jQuery load it immediatly).
- loaded.push(url);
- jQuery(this).appendTo($head);
+ // take care to <script> tags: jQuery append method script nodes
+ // don't appears in the DOM (See comments on
+ // http://api.jquery.com/append/), which cause undesired
+ // duplicated load in our case. After trying to use bare DOM api
+ // to avoid this, we switched to handle a list of already loaded
+ // stuff ourselves, since bare DOM api gives bug with the
+ // server-response event, since we loose control on when the
+ // script is loaded (jQuery load it immediatly).
+ loaded.push(url);
+ jQuery(this).appendTo($head);
}
} else {
jQuery(this).appendTo($head);
@@ -441,7 +441,7 @@
var d = userCallback(cbname);
d.addCallback(function() {
$('#' + nodeid).loadxhtml('json', ajaxFuncArgs('render', {'rql': rql},
- registry, compid));
+ registry, compid));
if (msg) {
updateMessage(msg);
}
@@ -560,9 +560,9 @@
}
// several children => wrap them in a single node and return the wrap
return DIV({'cubicweb:type': "cwResponseWrapper"},
- $.map(children, function(node) {
- return jQuery(node).clone().context;})
- );
+ $.map(children, function(node) {
+ return jQuery(node).clone().context;})
+ );
}
/* DEPRECATED *****************************************************************/
--- a/web/data/cubicweb.edition.js Mon Sep 13 09:56:10 2010 +0200
+++ b/web/data/cubicweb.edition.js Mon Sep 13 10:01:43 2010 +0200
@@ -274,7 +274,7 @@
function selectForAssociation(tripletIdsString, originalEid) {
var tripletlist = $.map(tripletIdsString.split('-'),
- function(x) { return [x.split(':')] ;});
+ function(x) { return [x.split(':')] ;});
var d = loadRemote('json', ajaxFuncArgs('add_pending_inserts', null, tripletlist));
d.addCallback(function() {
var args = {
--- a/web/data/cubicweb.fckcwconfig-full.js Mon Sep 13 09:56:10 2010 +0200
+++ b/web/data/cubicweb.fckcwconfig-full.js Mon Sep 13 10:01:43 2010 +0200
@@ -1,28 +1,28 @@
// cf /usr/share/fckeditor/fckconfig.js
-FCKConfig.AutoDetectLanguage = false ;
+FCKConfig.AutoDetectLanguage = false ;
FCKConfig.ToolbarSets["Default"] = [
// removed : 'Save','NewPage','DocProps','-','Templates','-','Preview'
- ['Source'],
+ ['Source'],
// removed: 'Print','-','SpellCheck'
- ['Cut','Copy','Paste','PasteText','PasteWord'],
- ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
+ ['Cut','Copy','Paste','PasteText','PasteWord'],
+ ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
//['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],
- '/',
+ '/',
// ,'StrikeThrough','-','Subscript','Superscript'
- ['Bold','Italic','Underline'],
+ ['Bold','Italic','Underline'],
// ,'-','Outdent','Indent','Blockquote'
- ['OrderedList','UnorderedList'],
+ ['OrderedList','UnorderedList'],
// ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
- ['Link','Unlink','Anchor'],
+ ['Link','Unlink','Anchor'],
// removed : 'Image','Flash','Smiley','PageBreak'
- ['Table','Rule','SpecialChar']
+ ['Table','Rule','SpecialChar']
// , '/',
// ['Style','FontFormat','FontName','FontSize'],
// ['TextColor','BGColor'],
//,'ShowBlocks'
- // ['FitWindow','-','About'] // No comma for the last row.
+ // ['FitWindow','-','About'] // No comma for the last row.
] ;
// 'Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','Form',
--- a/web/data/cubicweb.goa.js Mon Sep 13 09:56:10 2010 +0200
+++ b/web/data/cubicweb.goa.js Mon Sep 13 10:01:43 2010 +0200
@@ -12,6 +12,5 @@
* overrides rql_for_eid function from htmlhelpers.hs
*/
function rql_for_eid(eid) {
- return 'Any X WHERE X eid "' + eid + '"';
+ return 'Any X WHERE X eid "' + eid + '"';
}
-
--- a/web/data/cubicweb.image.js Mon Sep 13 09:56:10 2010 +0200
+++ b/web/data/cubicweb.image.js Mon Sep 13 10:01:43 2010 +0200
@@ -1,4 +1,3 @@
-
jQuery.fn.autoResize = function() {
// remove enforced with / height (by CSS and/or HTML attributes)
this.css("width", "auto").css("height", "auto");
@@ -10,23 +9,23 @@
// we don't mind if content in [content]footer moved out of the screen
var maxVSize = $(window).height() - ($(document).height() - imgVSize) + $('#footer').height() + $('#contentfooter').height();
if (maxHSize > 0 && maxVSize > 0) {
- // if image don't fit screen, set width or height so that
- // browser keep img ratio, ensuring the other dimension will
- // also fit the screen
- if (imgHSize > maxHSize && ((imgVSize / imgHSize) * maxHSize) <= maxVSize) {
- this.css("width", maxHSize);
- } else if (imgVSize > maxVSize && ((imgHSize / imgVSize) * maxVSize) <= maxHSize) {
- this.css("height", maxVSize);
- }
- else {
- // image already fit in screen, don't scale it up
- }
+ // if image don't fit screen, set width or height so that
+ // browser keep img ratio, ensuring the other dimension will
+ // also fit the screen
+ if (imgHSize > maxHSize && ((imgVSize / imgHSize) * maxHSize) <= maxVSize) {
+ this.css("width", maxHSize);
+ } else if (imgVSize > maxVSize && ((imgHSize / imgVSize) * maxVSize) <= maxHSize) {
+ this.css("height", maxVSize);
+ }
+ else {
+ // image already fit in screen, don't scale it up
+ }
} else {
- // can't fit image in, don't do anything
+ // can't fit image in, don't do anything
}
};
$(document).ready(function() {
- $("img.contentimage").load(function() {$(this).autoResize()});
- });
+ $("img.contentimage").load(function() {$(this).autoResize()});
+});
--- a/web/data/cubicweb.reledit.js Mon Sep 13 09:56:10 2010 +0200
+++ b/web/data/cubicweb.reledit.js Mon Sep 13 10:01:43 2010 +0200
@@ -65,9 +65,9 @@
loadInlineEditionForm: function(formid, eid, rtype, role, divid, reload, vid, default_value) {
var args = {fname: 'reledit_form', rtype: rtype, role: role,
pageid: pageid,
- eid: eid, divid: divid, formid: formid,
- reload: reload, vid: vid, default_value: default_value,
- callback: function () {cw.reledit.showInlineEditionForm(divid);}};
+ eid: eid, divid: divid, formid: formid,
+ reload: reload, vid: vid, default_value: default_value,
+ callback: function () {cw.reledit.showInlineEditionForm(divid);}};
jQuery('#'+divid+'-reledit').parent().loadxhtml(JSON_BASE_URL, args, 'post');
}
});
--- a/web/test/jstests/test_ajax.js Mon Sep 13 09:56:10 2010 +0200
+++ b/web/test/jstests/test_ajax.js Mon Sep 13 10:01:43 2010 +0200
@@ -123,7 +123,7 @@
'Hello', 'world');
});
- test('test addErrback', function() {
+ test('test addErrback', function() {
expect(1);
stop();
var d = jQuery('#main').loadxhtml('/../ajax_url0.html');
@@ -165,10 +165,11 @@
});
});
- test('test already included resources are ignored (ajax_url2.html)', function() {
+ test('test already included resources are ignored (ajax_url1.html)', function() {
expect(10);
var scriptsIncluded = jsSources();
- equals(jQuery.inArray('http://foo.js', scriptsIncluded), - 1);
+ // NOTE:
+ equals(jQuery.inArray('http://foo.js', scriptsIncluded), -1);
equals(jQuery('head link').length, 1);
/* use endswith because in pytest context we have an absolute path */
ok(jQuery('head link').attr('href').endswith('/qunit.css'));
@@ -177,7 +178,7 @@
callback: function() {
var origLength = scriptsIncluded.length;
scriptsIncluded = jsSources();
- try {
+ try {
// check that foo.js has been inserted in <head>
equals(scriptsIncluded.length, origLength + 1);
equals(scriptsIncluded[origLength].indexOf('http://foo.js'), 0);
@@ -191,7 +192,7 @@
ok(jQuery('head link').attr('href').endswith('/qunit.css'));
} finally {
start();
- }
+ }
}
});
});