Permalink
Browse files

reverted revert and re-applied fix for db join elements field not pop…

…ulating
  • Loading branch information...
pollen8 committed Apr 23, 2013
1 parent b9ba6b9 commit b56a9d8d04592e1e32db8579f9455cbcc6ad640a
Showing with 868 additions and 328 deletions.
  1. +2 −0 administrator/components/com_fabrik/language/en-GB/en-GB.com_fabrik.ini
  2. +1 −1 administrator/components/com_fabrik/models/fields/fabrikmodalrepeat-min.js
  3. +120 −71 administrator/components/com_fabrik/models/fields/fabrikmodalrepeat.js
  4. +17 −8 administrator/components/com_fabrik/models/fields/fabrikmodalrepeat.php
  5. +1 −1 administrator/components/com_fabrik/models/fields/fabriktables-min.js
  6. +1 −1 administrator/components/com_fabrik/models/fields/listfields-min.js
  7. +41 −3 administrator/components/com_fabrik/models/fields/listfields.js
  8. +9 −4 administrator/components/com_fabrik/models/fields/listfields.php
  9. +2 −0 administrator/components/com_fabrik/models/forms/element.xml
  10. +9 −4 components/com_fabrik/helpers/arrayhelper.php
  11. +71 −17 components/com_fabrik/helpers/html.php
  12. +56 −12 components/com_fabrik/models/element.php
  13. +13 −6 components/com_fabrik/models/elementlist.php
  14. +1 −0 components/com_fabrik/models/list.php
  15. +4 −3 components/com_fabrik/models/plugin.php
  16. +38 −2 components/com_fabrik/models/visualization.php
  17. +28 −9 components/com_fabrik/models/webservice/rest.php
  18. +29 −10 components/com_fabrik/models/webservice/soap.php
  19. +1 −1 components/com_fabrik/views/form/tmpl/default/default.php
  20. +6 −2 media/com_fabrik/js/listfilter.js
  21. +1 −2 modules/mod_fabrik_list/language/en-GB/en-GB.mod_fabrik_list.ini
  22. +2 −2 modules/mod_fabrik_list/mod_fabrik_list.php
  23. +13 −7 plugins/fabrik_cron/importcsv/importcsv.php
  24. +11 −8 plugins/fabrik_element/checkbox/checkbox.php
  25. +1 −1 plugins/fabrik_element/colourpicker/colourpicker.php
  26. +8 −7 plugins/fabrik_element/count/count.php
  27. +17 −7 plugins/fabrik_element/databasejoin/databasejoin.php
  28. +13 −3 plugins/fabrik_element/date/date.php
  29. +4 −3 plugins/fabrik_element/display/display.php
  30. +1 −1 plugins/fabrik_element/fbactivityfeed/fbactivityfeed.php
  31. +3 −3 plugins/fabrik_element/fbcomment/fbcomment.php
  32. +1 −1 plugins/fabrik_element/fblike/fblike.php
  33. +1 −1 plugins/fabrik_element/fblikebox/fblikebox.php
  34. +1 −1 plugins/fabrik_element/fbrecommendations/fbrecommendations.php
  35. +1 −3 plugins/fabrik_element/fileupload/fileupload.php
  36. +1 −1 plugins/fabrik_element/folder/folder.php
  37. +23 −32 plugins/fabrik_element/googlemap/googlemap.php
  38. +35 −8 plugins/fabrik_element/googleometer/googleometer.php
  39. +2 −2 plugins/fabrik_element/internalid/internalid.php
  40. +1 −1 plugins/fabrik_element/ip/ip.php
  41. +23 −8 plugins/fabrik_element/kaltura/kaltura.php
  42. +6 −12 plugins/fabrik_element/link/link.php
  43. +12 −13 plugins/fabrik_element/notes/notes.php
  44. +17 −7 plugins/fabrik_element/user/user.php
  45. +36 −20 plugins/fabrik_element/yesno/yesno.php
  46. +52 −2 plugins/fabrik_form/rest/forms/fields.xml
  47. +1 −1 plugins/fabrik_list/caneditrow/caneditrow.php
  48. +8 −3 plugins/fabrik_visualization/fusionchart/models/fusionchart.php
  49. +99 −1 plugins/fabrik_visualization/googlemap/forms/fields.xml
  50. +24 −12 plugins/fabrik_visualization/googlemap/models/googlemap.php
@@ -58,6 +58,7 @@ COM_FABRIK_BEGINNING="Beginning"
COM_FABRIK_BOTH="Both"
COM_FABRIK_BUTTONS="Buttons"
COM_FABRIK_BUTTON_TEXT="Button text"
+COM_FABRIK_CHECKBOX="Checkbox"
COM_FABRIK_CODE="Code"
COM_FABRIK_COLUMNS_DESC="The number of columns you want to display your elements within"
COM_FABRIK_COLUMNS_LABEL="Columns"
@@ -830,6 +831,7 @@ COM_FABRIK_MEDIA_BOX_LABEL="Use mediabox instead of slimbox"
COM_FABRIK_MERGE_ROWS="Merge rows"
COM_FABRIK_MOBILE_LAYOUT="Mobile layout"
COM_FABRIK_MSG_BATCH_DONE="Batch process complete"
+COM_FABRIK_MULTISELECT="Multi-select list"
COM_FABRIK_NAME="Name"
COM_FABRIK_NAVIGATION="Navigation"
COM_FABRIK_NEW="New"

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -6,6 +6,9 @@ var FabrikModalRepeat = new Class({
this.content = false;
this.setup = false;
this.elid = el;
+ this.win = {};
+ this.el = {};
+ this.field = {};
// If the parent field is inserted via js then we delay the loading untill the html is present
if (!this.ready()) {
@@ -32,91 +35,137 @@ var FabrikModalRepeat = new Class({
setUp: function () {
this.button = document.id(this.elid + '_button');
- this.el = document.id(this.elid).getElement('table');
- this.el.id = this.elid + '-table';
- this.field = document.id(this.field);
- this.button.addEvent('click', function (e) {
- if (!this.win) {
- this.win = new Element('div', {'styles': {'padding': '5px', 'background-color': '#fff', 'display': 'none', 'z-index': 9999}}).inject(document.body);
- this.win.adopt(this.el);
- var close = new Element('button.btn.button').set('text', 'close');
- close.addEvent('click', function (e) {
- e.stop();
- this.store();
- this.close();
- }.bind(this));
- var controls = new Element('div.controls', {'styles': {'text-align': 'right'}}).adopt(close);
- this.win.adopt(controls);
- this.win.position();
- this.mask = new Mask(document.body, {style: {'background-color': '#000', 'opacity': 0.4, 'z-index': 9998}});
- this.content = this.el;
- this.build();
- this.watchButtons();
+ if (this.mask) {
+ this.mask.destroy();
+ }
+ this.mask = new Mask(document.body, {style: {'background-color': '#000', 'opacity': 0.4, 'z-index': 9998}});
+ document.addEvent('click:relay(*[data-modal=' + this.elid + '])', function (e, target) {
+ var tbl;
+ // Correct when in repeating group
+ var id = target.getNext('input').id;
+ this.field[id] = target.getNext('input');
+ var c = target.getParent('li');
+ this.origContainer = c;
+ tbl = c.getElement('table');
+ if (typeOf(tbl) !== 'null') {
+ this.el[id] = tbl;
}
- this.win.show();
- this.win.position();
- this.resizeWin(true);
- this.win.position();
- this.mask.show();
+ this.openWindow(id);
+ }.bind(this));
+ },
+
+ openWindow: function (target) {
+
+ var makeWin = false;
+ if (!this.win[target]) {
+ makeWin = true;
+ this.makeTarget(target);
+ }
+ this.el[target].inject(this.win[target], 'top');
+ this.el[target].show();
+
+ if (!this.win[target] || makeWin) {
+ this.makeWin(target);
+ }
+ // Testing moviing out of makeWin
+
+
+ //this.build(target);
+
+ this.win[target].show();
+ this.win[target].position();
+ this.resizeWin(true, target);
+ this.win[target].position();
+ this.mask.show();
+ },
+
+ makeTarget: function (target) {
+ this.win[target] = new Element('div', {'data-modal-content': target, 'styles': {'padding': '5px', 'background-color': '#fff', 'display': 'none', 'z-index': 9999}}).inject(document.body);
+ },
+
+ makeWin: function (target) {
+
+ // Testing adopting in.out on show/hide
+ //this.win[target].adopt(this.el[target]);
+ var close = new Element('button.btn.button').set('text', 'close');
+ close.addEvent('click', function (e) {
+ e.stop();
+ this.store(target);
+ this.el[target].hide();
+ this.el[target].inject(this.origContainer);
+ this.close();
}.bind(this));
+ var controls = new Element('div.controls', {'styles': {'text-align': 'right'}}).adopt(close);
+ this.win[target].adopt(controls);
+ this.win[target].position();
+ this.content = this.el[target];
+ this.build(target);
+ this.watchButtons(this.win[target], target);
},
- resizeWin: function (setup) {
- var size = this.el.getDimensions(true);
- var wsize = this.win.getDimensions(true);
- var y = setup ? wsize.y : size.y + 30;
- this.win.setStyles({'width': size.x + 'px', 'height': (y) + 'px'});
+ resizeWin: function (setup, target) {
+ console.log(target);
+
+ Object.each(this.win, function (win, key) {
+ var size = this.el[key].getDimensions(true);
+ var wsize = win.getDimensions(true);
+ var y = setup ? wsize.y : size.y + 30;
+ win.setStyles({'width': size.x + 'px', 'height': (y) + 'px'});
+ }.bind(this));
+
},
close: function () {
- this.win.hide();
+ Object.each(this.win, function (win, key) {
+ win.hide();
+ });
this.mask.hide();
},
- _getRadioValues: function () {
+ _getRadioValues: function (target) {
var radiovals = [];
- this.getTrs().each(function (tr) {
+ this.getTrs(target).each(function (tr) {
var v = (sel = tr.getElement('input[type=radio]:checked')) ? sel.get('value') : v = '';
radiovals.push(v);
});
return radiovals;
},
- _setRadioValues: function (radiovals) {
+ _setRadioValues: function (radiovals, target) {
// Reapply radio button selections
- this.getTrs().each(function (tr, i) {
+ this.getTrs(target).each(function (tr, i) {
if (r = tr.getElement('input[type=radio][value=' + radiovals[i] + ']')) {
r.checked = 'checked';
}
});
},
- watchButtons: function () {
- if (this.buttonsWatched) {
- return;
- }
- this.buttonsWatched = true;
- this.content.addEvent('click:relay(a.add)', function (e) {
+ watchButtons: function (win, target) {
+ win.addEvent('click:relay(a.add)', function (e) {
if (tr = this.findTr(e)) {
// Store radio button selections
- var radiovals = this._getRadioValues();
+ var radiovals = this._getRadioValues(target);
- if (tr.getChildren('th').length !== 0) {
- this.tmpl.clone().inject(tr, 'after');
+ var body = tr.getParent('table').getElement('tbody');
+ this.tmpl.clone(true, true).inject(body);
+
+ /*if (tr.getChildren('th').length !== 0) {
+ var body = tr.getParent('table').getElement('tbody');
+ this.tmpl.clone(true, true).inject(body);
} else {
- tr.clone().inject(tr, 'after');
- }
- this.stripe();
+ tr.clone(true, true).inject(tr, 'after');
+ }*/
+ this.stripe(target);
// Reapply values as renaming radio buttons
- this._setRadioValues(radiovals);
- this.resizeWin();
+ this._setRadioValues(radiovals, target);
+ this.resizeWin(false, target);
}
- this.win.position();
+ win.position();
e.stop();
}.bind(this));
- this.content.addEvent('click:relay(a.remove)', function (e) {
+ win.addEvent('click:relay(a.remove)', function (e) {
// If only one row -don't remove
var rows = this.content.getElements('tbody tr');
@@ -127,18 +176,18 @@ var FabrikModalRepeat = new Class({
if (tr = this.findTr(e)) {
tr.dispose();
}
- this.resizeWin();
- this.win.position();
+ this.resizeWin(false, target);
+ win.position();
e.stop();
}.bind(this));
},
- getTrs: function () {
- return this.content.getElement('tbody').getElements('tr');
+ getTrs: function (target) {
+ return this.win[target].getElement('tbody').getElements('tr');
},
- stripe: function () {
- trs = this.getTrs();
+ stripe: function (target) {
+ trs = this.getTrs(target);
for (var i = 0; i < trs.length; i ++) {
trs[i].removeClass('row1').removeClass('row0');
trs[i].addClass('row' + i % 2);
@@ -150,26 +199,26 @@ var FabrikModalRepeat = new Class({
}
},
- build: function () {
- if (this.setup) {
- return;
+ build: function (target) {
+ if (!this.win[target]) {
+ this.makeWin(target);
}
- var a = JSON.decode(this.field.get('value'));
+
+ var a = JSON.decode(this.field[target].get('value'));
if (typeOf(a) === 'null') {
a = {};
}
- var tr = this.content.getElement('tbody').getElement('tr');
+ var tr = this.win[target].getElement('tbody').getElement('tr');
var keys = Object.keys(a);
var newrow = keys.length === 0 || a[keys[0]].length === 0 ? true : false;
- //var rowcount = keys.length === 0 ? 1 : a[keys[0]].length;
var rowcount = newrow ? 1 : a[keys[0]].length;
// Build the rows from the json object
for (var i = 1; i < rowcount; i ++) {
tr.clone().inject(tr, 'after');
}
- this.stripe();
- var trs = this.getTrs();
+ this.stripe(target);
+ var trs = this.getTrs(target);
// Populate the cloned fields with the json values
for (i = 0; i < rowcount; i++) {
@@ -186,9 +235,7 @@ var FabrikModalRepeat = new Class({
});
});
}
- if (newrow || typeOf(this.tmpl) === 'null') {
- this.tmpl = tr;
- }
+ this.tmpl = tr;
if (newrow) {
tr.dispose();
}
@@ -201,13 +248,15 @@ var FabrikModalRepeat = new Class({
return (tr.length === 0) ? false : tr[0];
},
- store: function () {
+ store: function (target) {
+ var c = this.content;
+ c = this.el[target];
// Get the current values
var json = {};
for (var i = 0; i < this.names.length; i++) {
var n = this.names[i];
- var fields = this.content.getElements('*[name*=' + n + ']');
+ var fields = c.getElements('*[name*=' + n + ']');
json[n] = [];
fields.each(function (field) {
if (field.get('type') === 'radio') {
@@ -220,7 +269,7 @@ var FabrikModalRepeat = new Class({
}.bind(this));
}
// Store them in the parent field.
- this.field.value = JSON.encode(json);
+ this.field[target].value = JSON.encode(json);
return true;
}
Oops, something went wrong.

0 comments on commit b56a9d8

Please sign in to comment.