Skip to content

Commit

Permalink
closes FabrikGH-7
Browse files Browse the repository at this point in the history
  • Loading branch information
pollen8 committed Aug 27, 2011
1 parent 2fdce7d commit 0a5c679
Show file tree
Hide file tree
Showing 10 changed files with 171 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ function getInput()
$bits = array();
$c = ElementHelper::getRepeatCounter($this);
$connection = $this->element['connection'];
$valueformat = JArrayHelper::getValue($this->element, 'valueformat', 'tableelement');
// 27/08/2011 - changed from default tableelement to id - for juser form plugin - might cause havock
//else where but loading elements by id as default seems more robust (and is the default behaviour in f2.1
$valueformat = JArrayHelper::getValue($this->element, 'valueformat', 'id');
$onlylistfields = (int)JArrayHelper::getValue($this->element, 'onlylistfields', 0);
switch ($controller)
{
Expand Down
12 changes: 8 additions & 4 deletions components/com_fabrik/models/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2050,7 +2050,6 @@ function render()
if (in_array(false, $res)) {
return false;
}

$this->_reduceDataForXRepeatedJoins();

JDEBUG ? $_PROFILER->mark('formmodel render end') : null;
Expand Down Expand Up @@ -2083,6 +2082,11 @@ protected function getMaxRowId()

function getData()
{
//if already set return it. If not was causing issues with the juser form plugin
// when it tried to modify the form->_data info, from within its onLoad method, when sync user option turned on.
if (isset($this->_data)) {
return $this->_data;
}
global $_PROFILER;
$this->_data = array();
$data = array(FArrayHelper::toObject(JRequest::get('request')));
Expand All @@ -2095,10 +2099,10 @@ function getData()
$data = JRequest::get('request');
} else {

$listModel =& $this->getListModel();
$fabrikDb =& $listModel->getDb();
$listModel = $this->getListModel();
$fabrikDb = $listModel->getDb();
JDEBUG ? $_PROFILER->mark('formmodel getData: db created') : null;
$table =& $listModel->getTable();
$table = $listModel->getTable();
JDEBUG ? $_PROFILER->mark('formmodel getData: table row loaded') : null;
$this->_aJoinObjs =& $listModel->getJoins();
JDEBUG ? $_PROFILER->mark('formmodel getData: joins loaded') : null;
Expand Down
7 changes: 3 additions & 4 deletions components/com_fabrik/models/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -5276,20 +5276,19 @@ function deleteRows(&$ids, $key = '')
$elementModel->onDeleteRows($rows);
}
}
$pluginManager = $this->getPluginManager();

// $$$ hugh - added onDeleteRowsForm plugin (needed it so fabrikjuser form plugin can delete users)
// NOTE - had to call it onDeleteRowsForm rather than onDeleteRows, otherwise runPlugins() automagically
// runs the element onDeleteRows(), which we already do above. And with the code as-is, that won't work
// from runPlugins() 'cos it won't pass it the $rows it needs. So i have to sidestep the issue by using
// a different trigger name. Added a default onDeleteRowsForm() to plugin-form.php, and implemented
// (and tested) user deletion in fabrikjuser.php using this trigger. All seems to work. 7/28/2009
$formModel =& $this->getFormModel();
$pluginManager =& $formModel->getPluginManager();
if (in_array(false, $pluginManager->runPlugins('onDeleteRowsForm', $formModel, 'form', $rows))) {

if (in_array(false, $pluginManager->runPlugins('onDeleteRowsForm', $this->getFormModel(), 'form', $rows))) {
return;
}

$pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel');
$pluginManager->getPlugInGroup('list');
if (in_array(false, $pluginManager->runPlugins('onDeleteRows', $this, 'list'))) {
return;
Expand Down
74 changes: 37 additions & 37 deletions components/com_fabrik/views/list/tmpl/default/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,36 @@
echo $this->loadTemplate('filter');
}?>

<div class="fabrikDataContainer" style="<?php echo $this->tableStyle?>">
<div class="fabrikDataContainer">

<?php foreach ($this->pluginBeforeList as $c) {
echo $c;
}?>
<div class="boxflex">
<table class="fabrikList" id="list_<?php echo $this->table->id;?>" >

<!-- not sure what this is for but should be in tbody or thead
<tr class="fabrikHide">
<?php foreach($this->headings as $key=>$heading) {?>
<td></td>
<?php }?>
</tr>
-->
<tfoot>
<tr class="fabrik___heading">
<td colspan="<?php echo count($this->headings);?>">
<?php echo $this->nav;?>
</td>
</tr>
</tfoot>
<?php
$gCounter = 0;
foreach ($this->rows as $groupedby => $group) {
if ($gCounter == 0) {
echo '<thead>'.$this->headingstmpl.'</thead>';
}
if ($this->isGrouped) {
echo $c;
}?>
<div class="boxflex">
<table class="fabrikList" id="list_<?php echo $this->table->id;?>" >
<tfoot>
<tr class="fabrik___heading">
<td colspan="<?php echo count($this->headings);?>">
<?php echo $this->nav;?>
</td>
</tr>
</tfoot>
<thead style="<?php echo $this->emptyStyle?>">
<tr>
<td colspan="<?php echo $this->colCount;?>">
<div class="emptyDataMessage">
<?php echo $this->emptyDataMessage; ?>
</div>
</td>
</tr>
</thead>
<?php
$gCounter = 0;
foreach ($this->rows as $groupedby => $group) {
if ($gCounter == 0) {
echo '<thead>'.$this->headingstmpl.'</thead>';
}
if ($this->isGrouped) {
?>
<tbody>
<tr class="fabrik_groupheading">
Expand All @@ -62,7 +63,9 @@
<tbody class="fabrik_groupdata">
<tr>
<td colspan="<?php echo count($this->headings)?>">
<div class="emptyDataMessage" style="<?php echo $this->emptyStyle?>"><?php echo $this->emptyDataMessage; ?></div>
<div class="emptyDataMessage" style="<?php echo $this->emptyStyle?>">
<?php echo $this->emptyDataMessage; ?>
</div>
</td>
</tr>
<?php
Expand All @@ -81,16 +84,13 @@
}
?>
</tr>
</tbody>
<?php }
$gCounter++;
}?>
</tbody>
<?php }
$gCounter++;
}?>
</table>
<?php

print_r($this->hiddenFields);
?>
</div>
<?php print_r($this->hiddenFields);?>
</div>
</div>

</form>
1 change: 0 additions & 1 deletion components/com_fabrik/views/list/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ function display($tpl = null)
$this->assign('showFilters', (count($this->filters) > 0 && $params->get('show-table-filters', 1)) && JRequest::getVar('showfilters', 1) == 1 ? 1 : 0);

$this->assign('emptyDataMessage', $this->get('EmptyDataMsg'));

$this->assignRef('groupheadings', $groupHeadings);
$this->assignRef('calculations', $this->_getCalculations($this->headings));
$this->assign('isGrouped', !($this->get('groupBy') == ''));
Expand Down
3 changes: 1 addition & 2 deletions components/com_fabrik/views/list/view.pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ function display($tpl = null)
$this->assign('showFilters', (count($this->filters) > 0 && $params->get('show-table-filters', 1)) && JRequest::getVar('showfilters', 1) == 1 ? 1 : 0);

$this->assign('requiredFiltersFound', $this->get('RequiredFiltersFound'));
$msg = (!$this->requiredFiltersFound) ? JText::_('PLEASE_SELECT_ALL_REQUIRED_FILTERS') : $params->get('empty_data_msg');
$this->assign('emptyDataMessage', $msg);
$this->assign('emptyDataMessage', $this->get('EmptyDataMsg'));
$this->calculations = $this->_getCalculations($this->headings);

$this->assign('isGrouped', $table->group_by);
Expand Down
2 changes: 1 addition & 1 deletion components/com_fabrik/views/list/view.raw.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function display()
$table = $model->getTable();
$params = $model->getParams();
$model->render();
$this->emptyDataMessage = $params->get('empty_data_msg');
$this->assign('emptyDataMessage', $this->get('EmptyDataMsg'));
$rowid = JRequest::getInt('rowid');
list($this->headings, $groupHeadings, $this->headingClass, $this->cellClass) = $this->get('Headings');
$data =& $model->getData();
Expand Down
52 changes: 26 additions & 26 deletions plugins/fabrik_form/juser/forms/fields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@
label="PLG_FABRIK_FORM_JUSER_EMAIL_FIELD_LABEL"
description="PLG_FABRIK_FORM_JUSER_EMAIL_FIELD_DESC"/>

<field name="juser_field_usertype"
type="listfields"
onlytablefields="0"
default="gid"
repeat="true"
label="PLG_FABRIK_FORM_JUSER_USERTYPE_FIELD_LABEL"
description="PLG_FABRIK_FORM_JUSER_USERTYPE_FIELD_DESC"/>

<field name="juser_field_block"
type="listfields"
onlytablefields="0"
Expand All @@ -51,11 +43,33 @@

<field name="juser_field_userid"
type="listfields"
onlytablefields="0"
default=""
onlytablefields="0"
repeat="true"
label="PLG_FABRIK_FORM_JUSER_USER_ID_FIELD_LABEL"
description="PLG_FABRIK_FORM_JUSER_USER_ID_FIELD_DESC"/>


<field name="juser_field_usertype"
type="listfields"
onlytablefields="0"
repeat="true"
label="PLG_FABRIK_FORM_JUSER_USERTYPE_FIELD_LABEL"
description="PLG_FABRIK_FORM_JUSER_USERTYPE_FIELD_DESC"/>

<field name="juser_field_default_group"
type="accesslevel"
default="1"
repeat="true"
label="PLG_FABRIK_FORM_JUSER_DEFAULT_USERTYPE_FIELD_LABEL"
description="PLG_FABRIK_FORM_JUSER_DEFAULT_USERTYPE_FIELD_DESC"/>

<field name="juser_usertype_max"
type="accesslevel"
default="1"
repeat="true"
label="PLG_FABRIK_FORM_JUSER_USERTYPE_MAX"
description="PLG_FABRIK_FORM_JUSER_USERTYPE_MAX_DESC" />

<field name="juser_delete_user"
type="radio"
default="0"
Expand Down Expand Up @@ -106,26 +120,12 @@
<option value="1">JYES</option>
</field>

<field name="juser_success_page"
type="text"
size="30"
repeat="true"
label="PLG_FABRIK_FORM_JUSER_SUCCESS_LINK_LABEL"
description="PLG_FABRIK_FORM_JUSER_SUCCESS_LINK_DESC"/>

<field name="juser_failure_page"
type="text"
size="30"
repeat="true"
label="PLG_FABRIK_FORM_JUSER_FAILURE_LINK_LABEL"
description="PLG_FABRIK_FORM_JUSER_FAILURE_LINKDESC"/>

<field name="synchro_users"
type="radio"
default="0"
repeat="true"
label="PLG_FABRIK_FORM_JUSER_SYNCRONIZE_USERES_LABEL"
description="PLG_FABRIK_FORM_JUSER_SYNCRONIZE_USERES_DESC">
label="PLG_FABRIK_FORM_JUSER_SYNCRONIZE_USERS_LABEL"
description="PLG_FABRIK_FORM_JUSER_SYNCRONIZE_USERS_DESC">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
Expand Down
Loading

0 comments on commit 0a5c679

Please sign in to comment.