Skip to content

Commit

Permalink
Merge pull request #2 from Fabrik/master
Browse files Browse the repository at this point in the history
Merging upstream commits
  • Loading branch information
kmgardner authored Nov 14, 2019
2 parents ea4d1c5 + 465ea62 commit 762d3fc
Show file tree
Hide file tree
Showing 24 changed files with 189 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
<element label="Update time" published="1" name="update_time" id="36" plugin="date" created="2015-12-23 14:48:24" width="0" height="0" default="" hidden="1" eval="0" ordering="9" show_in_list_summary="0" filter_type="" filter_exact_match="1" link_to_detail="0" primary_key="0" auto_increment="0" access="1" use_in_page_title="0" parent_id="0">
<params bootstrap_class="input-medium" date_showtime="0" date_time_format="H:i" bootstrap_time_class="input-medium" placeholder="" date_store_as_local="0" date_table_format="Y-m-d" date_form_format="Y-m-d H:i:s" date_defaulttotoday="1" date_alwaystoday="0" date_firstday="0" date_allow_typing_in_field="1" date_csv_offset_tz="0" date_advanced="0" date_allow_func="" date_allow_php_func="" date_observe="" show_in_rss_feed="0" show_label_in_rss_feed="0" use_as_rss_enclosure="0" rollover="" tipseval="0" tiplocation="top-left" labelindetails="0" labelinlist="0" comment="" edit_access="1" edit_access_user="" view_access="1" view_access_user="" list_view_access="1" encrypt="0" can_order="0" alt_list_heading="" custom_link="" custom_link_target="" custom_link_indetails="1" use_as_row_class="0" include_in_list_query="1" always_render="0" icon_folder="0" icon_hovertext="1" icon_file="" icon_subdir="" filter_length="20" filter_access="1" full_words_only="0" filter_required="0" filter_build_method="0" filter_groupby="text" inc_in_adv_search="1" filter_class="input-medium" filter_responsive_class="" tablecss_header_class="" tablecss_header="" tablecss_cell_class="" tablecss_cell="" sum_on="0" sum_label="Sum" sum_access="1" sum_split="" avg_on="0" avg_label="Average" avg_access="1" avg_round="0" avg_split="" median_on="0" median_label="Median" median_access="1" median_split="" count_on="0" count_label="Count" count_condition="" count_access="1" count_split="" custom_calc_on="0" custom_calc_label="Custom" custom_calc_query="" custom_calc_access="1" custom_calc_split="" custom_calc_php="" validations="[]"/>
</element>
<element label="Update time" published="1" name="update_time" id="37" plugin="date" created="2015-12-23 14:48:24" width="0" height="0" default="" hidden="1" eval="0" ordering="9" show_in_list_summary="0" filter_type="" filter_exact_match="1" link_to_detail="0" primary_key="0" auto_increment="0" access="1" use_in_page_title="0" parent_id="0">
<params bootstrap_class="input-medium" date_showtime="0" date_time_format="H:i" bootstrap_time_class="input-medium" placeholder="" date_store_as_local="0" date_table_format="Y-m-d" date_form_format="Y-m-d H:i:s" date_defaulttotoday="1" date_alwaystoday="1" date_firstday="0" date_allow_typing_in_field="1" date_csv_offset_tz="0" date_advanced="0" date_allow_func="" date_allow_php_func="" date_observe="" show_in_rss_feed="0" show_label_in_rss_feed="0" use_as_rss_enclosure="0" rollover="" tipseval="0" tiplocation="top-left" labelindetails="0" labelinlist="0" comment="" edit_access="1" edit_access_user="" view_access="1" view_access_user="" list_view_access="1" encrypt="0" can_order="0" alt_list_heading="" custom_link="" custom_link_target="" custom_link_indetails="1" use_as_row_class="0" include_in_list_query="1" always_render="0" icon_folder="0" icon_hovertext="1" icon_file="" icon_subdir="" filter_length="20" filter_access="1" full_words_only="0" filter_required="0" filter_build_method="0" filter_groupby="text" inc_in_adv_search="1" filter_class="input-medium" filter_responsive_class="" tablecss_header_class="" tablecss_header="" tablecss_cell_class="" tablecss_cell="" sum_on="0" sum_label="Sum" sum_access="1" sum_split="" avg_on="0" avg_label="Average" avg_access="1" avg_round="0" avg_split="" median_on="0" median_label="Median" median_access="1" median_split="" count_on="0" count_label="Count" count_condition="" count_access="1" count_split="" custom_calc_on="0" custom_calc_label="Custom" custom_calc_query="" custom_calc_access="1" custom_calc_split="" custom_calc_php="" validations="[]"/>
</element>
</group>
<database>
<source>events</source>
Expand Down
2 changes: 1 addition & 1 deletion components/com_fabrik/models/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ public function checkAccessFromListSettings()
$data = $this->getData();
$ret = 0;

if ($listModel->canViewDetails(ArrayHelper::toObject($data)))
if ($listModel->canViewDetails(FArrayHelper::toObject($data)))
{
$ret = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion components/com_fabrik/models/group.php
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ public function repeatCount()
$d = ArrayHelper::fromObject($d);
}

$repeatGroup = count($d);
$repeatGroup = is_scalar($d) ? 1 : count($d);
}
else
{
Expand Down
37 changes: 30 additions & 7 deletions components/com_fabrik/models/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -5412,14 +5412,16 @@ public function storeRequestData($request)
}
}

$args = array (
'context' => $context,
'request' => $request
);

FabrikWorker::getPluginManager()->runPlugins(
'onStoreRequestData',
$this,
'list',
array (
'context' => $context,
'request' => $request
)
$args
);
}

Expand Down Expand Up @@ -5772,6 +5774,14 @@ private function showInList()
$showInList = $listElements->show_in_list;
}

$args = array(
$this,
&$showInList
);

$pluginManager = FabrikWorker::getPluginManager();
$pluginManager->runPlugins('onShowInList', $this, 'list', $args);

$showInList = (array) $input->get('fabrik_show_in_list', $showInList, 'array');

// Set it for use by groupModel->getPublishedListElements()
Expand Down Expand Up @@ -11009,13 +11019,26 @@ protected function formatForJoins(&$data)
{
if (is_array($v))
{
$notNull = false;

foreach ($v as &$v2)
{
$v2 = FabrikWorker::JSONtoData($v2);
if ($v2 !== null)
{
$notNull = true;
$v2 = FabrikWorker::JSONtoData($v2);
}
}

$v = json_encode($v);
$data[$gKey]->$k = $v;
if ($notNull)
{
$v = json_encode($v);
$data[$gKey]->$k = $v;
}
else
{
$data[$gKey]->$k = "";
}
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions libraries/fabrik/fabrik/Helpers/ArrayHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ public static function getValue(&$array, $name, $default = null, $type = '')

$result = null;

if (!is_scalar($name))
{
return $default;
}

if (isset($array[$name]))
{
$result = $array[$name];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
$d->checked = in_array($option->value, $d->default) ? 'checked="checked" ' : '';
if (($colSize * $colCounter) % 12 === 0 || $colCounter == 0) :
$rowStarted = true; ?>
<div class="row-fluid " data-role="fabrik-rowopts" data-optsperrow="<?php echo $d->optsPerRow; ?>">
<div class="row-fluid fabrik-option-value-<?php echo $option->value; ?>" data-role="fabrik-rowopts" data-optsperrow="<?php echo $d->optsPerRow; ?>">
<?php endif;
$d->option = $option;
$d->colCounter = $colCounter;
Expand Down
6 changes: 3 additions & 3 deletions plugins/fabrik_element/date/date.php
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,9 @@ public function getEmailValue($value, $data = array(), $repeatCounter = 0)
if ($time !== '')
{
$bits = explode(':', $time);
$h = FArrayHelper::getValue($bits, 0, 0);
$m = FArrayHelper::getValue($bits, 1, 0);
$s = FArrayHelper::getValue($bits, 2, 0);
$h = (int)FArrayHelper::getValue($bits, 0, 0);
$m = (int)FArrayHelper::getValue($bits, 1, 0);
$s = (int)FArrayHelper::getValue($bits, 2, 0);
$d->setTime($h, $m, $s);
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/fabrik_element/fileupload/fileupload-min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions plugins/fabrik_element/fileupload/fileupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ define(['jquery', 'fab/fileelement'], function (jQuery, FbFileElement) {
Extends : FbFileElement,
options : {
folderSelect: false,
ajax_upload: false
ajax_upload: false,
ajax_show_widget: true
},
initialize: function (element, options) {
var self = this;
Expand Down Expand Up @@ -334,7 +335,7 @@ define(['jquery', 'fab/fileelement'], function (jQuery, FbFileElement) {
var c = el.closest('.fabrikSubElementContainer');
this.container = c;

if (this.options.canvasSupport !== false) {
if (this.options.ajax_show_widget && this.options.canvasSupport !== false) {
this.widget = new ImageWidget(this.options.modalId, {

'imagedim': {
Expand Down
1 change: 1 addition & 0 deletions plugins/fabrik_element/fileupload/fileupload.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ public function elementJavascript($repeatCounter)
$opts->dir = JPATH_SITE . '/' . $params->get('ul_directory');
$opts->ajax_upload = $this->isAjax();
$opts->ajax_runtime = $params->get('ajax_runtime', 'html5');
$opts->ajax_show_widget = $params->get('ajax_show_widget', '1') === "1";
$opts->ajax_silverlight_path = COM_FABRIK_LIVESITE . 'plugins/fabrik_element/fileupload/lib/plupload/js/plupload.flash.swf';
$opts->ajax_flash_path = COM_FABRIK_LIVESITE . 'plugins/fabrik_element/fileupload/lib/plupload/js/plupload.flash.swf';
$opts->max_file_size = (float) $params->get('ul_max_file_size');
Expand Down
10 changes: 10 additions & 0 deletions plugins/fabrik_element/fileupload/forms/fields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,16 @@
<option value="1">JYES</option>
</field>

<field name="ajax_show_widget"
type="radio"
default="1"
class="btn-group"
description="PLG_ELEMENT_FILEUPLOAD_AJAX_SHOW_WIDGET_DESC"
label="PLG_ELEMENT_FILEUPLOAD_AJAX_SHOW_WIDGET_LABEL">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>

<field name="ajax_runtime"
type="text"
default="html5,html4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ PLG_ELEMENT_FILEUPLOAD_AJAX_MAX_DESC="The maximum number of files that can be up
PLG_ELEMENT_FILEUPLOAD_AJAX_MAX_LABEL="Max files"
PLG_ELEMENT_FILEUPLOAD_AJAX_RUNTIME_DESC="Comma separated list of runtimes to use. Possible values: html5,flash,silverlight,browserplus,html4"
PLG_ELEMENT_FILEUPLOAD_AJAX_RUNTIME_LABEL="Run times"
PLG_ELEMENT_FILEUPLOAD_AJAX_SHOW_WIDGET_DESC="Show a popup with a preview of the image for AJAX uploaded images"
PLG_ELEMENT_FILEUPLOAD_AJAX_SHOW_WIDGET_LABEL="Show Preview"
PLG_ELEMENT_FILEUPLOAD_BASE64_FILE_STREAM="Base 64 encoded file stream"
PLG_ELEMENT_FILEUPLOAD_CROP="Crop"
PLG_ELEMENT_FILEUPLOAD_CROP_DESC="Enabling the crop option allow for your users to create a cropped version of the file. You MUST use Ajax Upload for cropping to work. Not available in IE8 or lower"
Expand Down
5 changes: 5 additions & 0 deletions plugins/fabrik_element/googlemap/forms/fields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@
description="PLG_ELEMENT_GOOGLE_MAP_GEOCODE_FORMATTED_ADDRESS_DESC"
label="PLG_ELEMENT_GOOGLE_MAP_GEOCODE_FORMATTED_ADDRESS_LABEL" />

<field name="fb_gm_geocode_street_number"
type="listfields"
description="PLG_ELEMENT_GOOGLE_MAP_GEOCODE_STREET_NUMBER_DESC"
label="PLG_ELEMENT_GOOGLE_MAP_GEOCODE_STREET_NUMBER_LABEL" />

<field name="fb_gm_geocode_addr1"
type="listfields"
description="PLG_ELEMENT_GOOGLE_MAP_GEOCODE_ADDR1_DESC"
Expand Down
2 changes: 1 addition & 1 deletion plugins/fabrik_element/googlemap/googlemap-min.js

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions plugins/fabrik_element/googlemap/googlemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,14 @@ define(['jquery', 'fab/element', 'lib/debounce/jquery.ba-throttle-debounce', 'fa
}.bind(this));
}
}

this.watchTab();

Fabrik.addEvent('fabrik.form.page.change.end', function (form) {
this.redraw();
}.bind(this));

Fabrik.fireEvent('fabrik.map.make.end', this);
},

calcRoute: function () {
Expand Down Expand Up @@ -774,7 +778,7 @@ define(['jquery', 'fab/element', 'lib/debounce/jquery.ba-throttle-debounce', 'fa
result.address_components.each(function (component) {
component.types.each(function (type) {
if (type === 'street_number') {
if (this.options.reverse_geocode_fields.route) {
if (this.options.reverse_geocode_fields.street_number || this.options.reverse_geocode_fields.route) {
streetNumber = component.long_name;
}
}
Expand Down Expand Up @@ -816,11 +820,14 @@ define(['jquery', 'fab/element', 'lib/debounce/jquery.ba-throttle-debounce', 'fa
}.bind(this));
}.bind(this));

if (this.options.reverse_geocode_fields.route) {
if (this.options.reverse_geocode_fields.street_number) {
this.form.formElements.get(this.options.reverse_geocode_fields.street_number).update(streetNumber);
this.form.formElements.get(this.options.reverse_geocode_fields.route).update(streetRoute); }
else if (this.options.reverse_geocode_fields.route) {
/**
* Create the street address. I'm really not sure what the difference between 'route'
* and 'street_address' is in Google's component types, so for now just use 'street_address'
* as the prrefence, use 'route' if no 'street_address', and prepend 'street_number'
* as the preference, use 'route' if no 'street_address', and prepend 'street_number'
*/
if (streetRoute !== '')
{
Expand Down
13 changes: 7 additions & 6 deletions plugins/fabrik_element/googlemap/googlemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,14 @@ public function elementJavascript($repeatCounter)
if ($opts->reverse_geocode)
{
foreach (array(
'route' => 'addr1',
'neighborhood' => 'addr2',
'locality' => 'city',
'street_number' => 'street_number',
'route' => 'addr1',
'neighborhood' => 'addr2',
'locality' => 'city',
'administrative_area_level_1' => 'state',
'postal_code' => 'zip',
'country' => 'country',
'formatted_address' => 'formatted_address'
'postal_code' => 'zip',
'country' => 'country',
'formatted_address' => 'formatted_address'
) as $google_field => $which_field)
{
$field_id = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ PLG_ELEMENT_GOOGLE_MAP_GEOCODE_ON_LOAD_EDIT_ONLY="Only on edit"
PLG_ELEMENT_GOOGLE_MAP_GEOCODE_ON_LOAD_ALWAYS="Always"
PLG_ELEMENT_GOOGLE_MAP_GEOCODE_FORMATTED_ADDRESS_DESC="If using reverse geocoding, you can specify an element to hold the formatted_address component of the response from Google. This can be used either instead of, as as well as, the individual address components specified below"
PLG_ELEMENT_GOOGLE_MAP_GEOCODE_FORMATTED_ADDRESS_LABEL="Formatted Address"
PLG_ELEMENT_GOOGLE_MAP_GEOCODE_ADDR1_DESC="The element on your form to use as Address 1, if Use Fields is specified for the Geocode option. You should select as many of these fields as you need to build a complete comma separated address for Geocoding."
PLG_ELEMENT_GOOGLE_MAP_GEOCODE_STREET_NUMBER_DESC="The element on your form to use as Street Number. If selected, the street number will NOT be included in the 'Address 1' element. If not selected, the street number will be prepended to the 'Address 1' element."
PLG_ELEMENT_GOOGLE_MAP_GEOCODE_STREET_NUMBER_LABEL="Street Number"
PLG_ELEMENT_GOOGLE_MAP_GEOCODE_ADDR1_DESC="The element on your form to use as Address 1, if Use Fields is specified for the Geocode option. You should select as many of these fields as you need to build a complete comma separated address for Geocoding. If no 'Street Number' element is selected, this will include the number. Is 'Street Number' is selected, this will just be the 'route' (street name)"
PLG_ELEMENT_GOOGLE_MAP_GEOCODE_ADDR1_LABEL="Address 1"
PLG_ELEMENT_GOOGLE_MAP_GEOCODE_ADDR2_DESC="The element on your form to use as Address 2, if Use Fields is specified for the Geocode option. You should select as many of these fields as you need to build a complete comma separated address for Geocoding."
PLG_ELEMENT_GOOGLE_MAP_GEOCODE_ADDR2_LABEL="Address 2"
Expand Down
11 changes: 11 additions & 0 deletions plugins/fabrik_list/link/forms/fields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@
repeat="true"
size="60" />

<field name="table_link_new_tab"
type="radio"
class="btn-group"
default="0"
repeat="true"
label="PLG_FABRIK_LIST_LINK_NEW_TAB_LABEL"
description="PLG_FABRIK_LIST_LINK_NEW_TAB_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>

<field name="table_link_isfabrik"
type="radio"
class="btn-group"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ PLG_FABRIK_LIST_LINK_ISFABRIK_DESC="Is this a Fabrik link to a form or a list?
PLG_FABRIK_LIST_LINK_ISFABRIK_LABEL="Fabrik Link"
PLG_FABRIK_LIST_LINK_TITLE_DESC="Title for popup, if Fabrik link and AJAX enabled"
PLG_FABRIK_LIST_LINK_TITLE_LABEL="Popup Title"
PLG_FABRIK_LIST_LINK_NEW_TAB_DESC="Open the link in a new tab or not. Only applies if not Fabrik Link"
PLG_FABRIK_LIST_LINK_NEW_TAB_LABEL="New Tab"
;FRONT END

2 changes: 1 addition & 1 deletion plugins/fabrik_list/link/link-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion plugins/fabrik_list/link/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ define(['jquery', 'fab/list-plugin'], function (jQuery, FbListPlugin) {
options: {
'link': '',
'fabrikLink': false,
'newTab': false,
'windowTitle': ''
},

Expand Down Expand Up @@ -73,7 +74,12 @@ define(['jquery', 'fab/list-plugin'], function (jQuery, FbListPlugin) {
Fabrik.getWindow(winOpts);
}
else {
window.location = thisLink;
if (this.options.newTab) {
window.open(thisLink, '_blank');
}
else {
window.location = thisLink;
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions plugins/fabrik_list/link/link.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public function onLoadJavascriptInstance($args)
$opts = $this->getElementJSOptions();
$params = $this->getParams();
$opts->link = $params->get('table_link_link', '');
$opts->newTab = $params->get('table_link_new_tab', '0') === '1';
$opts->fabrikLink = $params->get('table_link_isfabrik', '0') === '1';
$opts->windowTitle = FText::_($params->get('table_link_fabrik_window_title', ''));
$opts = json_encode($opts);
Expand Down
Loading

0 comments on commit 762d3fc

Please sign in to comment.