Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formbuttons to switch between form and details view #487

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ COM_FABRIK_FIELD_APPLY_BUTTON_DESC="Fügt dem Formular einen 'Anwenden'-Button h
COM_FABRIK_FIELD_APPLY_BUTTON_LABEL="Anwenden-Button"
COM_FABRIK_FIELD_APPLY_BUTTON_LABEL_DESC="Der Text, der auf dem Anwenden-Button stehen soll"
COM_FABRIK_FIELD_APPLY_BUTTON_LABEL_LABEL="Anwenden-Button Beschriftung"
COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL="Details button"
COM_FABRIK_FIELD_DETAILS_BUTTON_DESC="Adds an 'Save and details' button to the form, which will submit the form and then return you to the details view of the submitted record"
COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL_LABEL="Details button label"
COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL_DESC="The text to use for the details button"
COM_FABRIK_FIELD_EDIT_BUTTON_LABEL="Edit button"
COM_FABRIK_FIELD_EDIT_BUTTON_DESC="Adds an 'Edit' button to the details view as direct way to edit the same data. This button is visible only if user can edit this record and only in details view."
COM_FABRIK_FIELD_EDIT_BUTTON_LABEL_LABEL="Edit button custom label"
COM_FABRIK_FIELD_EDIT_BUTTON_LABEL_DESC="The custom text to use for the edit button. Default is a global 'Edit'"
COM_FABRIK_FIELD_AUTHOR_DESC="Name des Autors"
COM_FABRIK_FIELD_AUTHOR_LABEL="Autor"
COM_FABRIK_FIELD_AUTO_INC_DESC="Wird der Primär-Schlüssel automatisch erhöht (auto increment)? Im Zweifelsfall = JA"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,14 @@ COM_FABRIK_FIELD_APPLY_BUTTON_DESC="Adds an 'apply' button to the form, which wi
COM_FABRIK_FIELD_APPLY_BUTTON_LABEL="Apply button"
COM_FABRIK_FIELD_APPLY_BUTTON_LABEL_DESC="The text to use for the apply button"
COM_FABRIK_FIELD_APPLY_BUTTON_LABEL_LABEL="Apply button label"
COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL="Details button"
COM_FABRIK_FIELD_DETAILS_BUTTON_DESC="Adds an 'Save and details' button to the form, which will submit the form and then return you to the details view of the submitted record"
COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL_LABEL="Details button label"
COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL_DESC="The text to use for the details button"
COM_FABRIK_FIELD_EDIT_BUTTON_LABEL="Edit button"
COM_FABRIK_FIELD_EDIT_BUTTON_DESC="Adds an 'Edit' button to the details view as direct way to edit the same data. This button is visible only if user can edit this record and only in details view."
COM_FABRIK_FIELD_EDIT_BUTTON_LABEL_LABEL="Edit button custom label"
COM_FABRIK_FIELD_EDIT_BUTTON_LABEL_DESC="The custom text to use for the edit button. Default is a global 'Edit'"
COM_FABRIK_FIELD_AUTHOR_DESC="The author name"
COM_FABRIK_FIELD_AUTHOR_LABEL="Author"
COM_FABRIK_FIELD_AUTO_INC_DESC="Is the primary key auto incrementing? If not sure select yes"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,14 @@ COM_FABRIK_FIELD_APPLY_BUTTON_DESC="Ajoute un bouton 'Appliquer' au formulaire q
COM_FABRIK_FIELD_APPLY_BUTTON_LABEL="Bouton appliquer"
COM_FABRIK_FIELD_APPLY_BUTTON_LABEL_DESC="Le texte à utiliser pour le bouton 'Appliquer'"
COM_FABRIK_FIELD_APPLY_BUTTON_LABEL_LABEL="Titre du bouton Appliquer"
COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL="Details button"
COM_FABRIK_FIELD_DETAILS_BUTTON_DESC="Adds an 'Save and details' button to the form, which will submit the form and then return you to the details view of the submitted record"
COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL_LABEL="Details button label"
COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL_DESC="The text to use for the details button"
COM_FABRIK_FIELD_EDIT_BUTTON_LABEL="Edit button"
COM_FABRIK_FIELD_EDIT_BUTTON_DESC="Adds an 'Edit' button to the details view as direct way to edit the same data. This button is visible only if user can edit this record and only in details view."
COM_FABRIK_FIELD_EDIT_BUTTON_LABEL_LABEL="Edit button custom label"
COM_FABRIK_FIELD_EDIT_BUTTON_LABEL_DESC="The custom text to use for the edit button. Default is a global 'Edit'"
COM_FABRIK_FIELD_AUTHOR_DESC="Le nom de l'auteur"
COM_FABRIK_FIELD_AUTHOR_LABEL="Auteur"
COM_FABRIK_FIELD_AUTO_INC_DESC="La clé primaire est-elle auto-incrémentale ? Dans le doute, choisissez OUI"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ COM_FABRIK_FIELD_APPLY_BUTTON_DESC="Adds an 'apply' button to the form, which wi
COM_FABRIK_FIELD_APPLY_BUTTON_LABEL="Кнопка подтверждения"
COM_FABRIK_FIELD_APPLY_BUTTON_LABEL_DESC="The text to use for the apply button"
COM_FABRIK_FIELD_APPLY_BUTTON_LABEL_LABEL="Apply button label"
COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL="Details button"
COM_FABRIK_FIELD_DETAILS_BUTTON_DESC="Adds an 'Save and details' button to the form, which will submit the form and then return you to the details view of the submitted record"
COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL_LABEL="Details button label"
COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL_DESC="The text to use for the details button"
COM_FABRIK_FIELD_EDIT_BUTTON_LABEL="Edit button"
COM_FABRIK_FIELD_EDIT_BUTTON_DESC="Adds an 'Edit' button to the details view as direct way to edit the same data. This button is visible only if user can edit this record and only in details view."
COM_FABRIK_FIELD_EDIT_BUTTON_LABEL_LABEL="Edit button custom label"
COM_FABRIK_FIELD_EDIT_BUTTON_LABEL_DESC="The custom text to use for the edit button. Default is a global 'Edit'"
COM_FABRIK_FIELD_AUTHOR_DESC="Имя автора"
COM_FABRIK_FIELD_AUTHOR_LABEL="Автор"
COM_FABRIK_FIELD_AUTO_INC_DESC="Is the primary key auto incrementing? If not sure select yes"
Expand Down
27 changes: 27 additions & 0 deletions administrator/components/com_fabrik/models/forms/form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,33 @@
label="COM_FABRIK_FIELD_APPLY_BUTTON_LABEL_LABEL"
description="COM_FABRIK_FIELD_APPLY_BUTTON_LABEL_DESC" />

<field name="details_button" type="radio"
default="0"
label="COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL"
description="COM_FABRIK_FIELD_DETAILS_BUTTON_DESC">
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>

<field name="details_button_label"
type="text"
default="Save and details"
label="COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL_LABEL"
description="COM_FABRIK_FIELD_DETAILS_BUTTON_LABEL_DESC" />

<field name="edit_button" type="radio"
default="1"
label="COM_FABRIK_FIELD_EDIT_BUTTON_LABEL"
description="COM_FABRIK_FIELD_EDIT_BUTTON_DESC">
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>

<field name="edit_button_label"
type="text"
label="COM_FABRIK_FIELD_EDIT_BUTTON_LABEL_LABEL"
description="COM_FABRIK_FIELD_EDIT_BUTTON_LABEL_DESC" />

<field name="delete_button"
type="radio"
default="0"
Expand Down
54 changes: 35 additions & 19 deletions components/com_fabrik/models/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -4762,47 +4762,63 @@ public function reset()
public function getRedirectURL($incSession = true, $isMambot = false)
{
$app = JFactory::getApplication();
$rowid = $app->input->get('rowid', '', 'string');
if ($app->isAdmin())
{
if (array_key_exists('apply', $this->_formData))
if (array_key_exists('apply', $this->_formData) || (!$this->_editable && $listModel->canEdit($this->_data) && array_key_exists('goedit', $this->_formData)))
{
$url = 'index.php?option=com_fabrik&task=form.view&formid=' . JRequest::getInt('formid') . '&rowid=' . JRequest::getInt('rowid');
$url = 'index.php?option=com_fabrik&task=form.view&formid=' . JRequest::getInt('formid') . '&rowid=' . $rowid;
}
else
{
$url = 'index.php?option=com_fabrik&task=list.view&listid=' . $this->getListModel()->getId();
{ //Jaanus: tried to add redirect urls that return details view from form and vice versa - here and below
if (array_key_exists('details', $this->_formData))
{
$url = 'index.php?option=com_fabrik&task=details.view&formid=' . JRequest::getInt('formid') . '&rowid=' . $rowid;
}
else
{
$url = 'index.php?option=com_fabrik&task=list.view&listid=' . $this->getListModel()->getId();
}
}
}
else
{
if (array_key_exists('apply', $this->_formData))
if (array_key_exists('apply', $this->_formData) || (JRequest::getVar('view') == 'details' && $listModel->canEdit($this->_data) && array_key_exists('goedit', $this->_formData)))
{
$url = 'index.php?option=com_fabrik&view=form&formid=' . JRequest::getInt('formid') . '&rowid=' . JRequest::getInt('rowid')
$url = 'index.php?option=com_fabrik&view=form&formid=' . JRequest::getInt('formid') . '&rowid=' . $rowid
. '&listid=' . JRequest::getInt('listid');
}
else
{
if ($isMambot)
if (array_key_exists('details', $this->_formData))
{
// Return to the same page
$url = JArrayHelper::getvalue($_SERVER, 'HTTP_REFERER', 'index.php');
$url = 'index.php?option=com_fabrik&view=details&formid=' . JRequest::getInt('formid') . '&rowid=' . $rowid
. '&listid=' . JRequest::getInt('listid');
}
else
{
// Return to the page that called the form
$url = urldecode(JRequest::getVar('fabrik_referrer', 'index.php', 'post'));
}
$Itemid = (int) @$app->getMenu('site')->getActive()->id;
if ($url == '')
{
if ($Itemid !== 0)
if ($isMambot)
{
$url = 'index.php?' . http_build_query($app->getMenu('site')->getActive()->query) . '&Itemid=' . $Itemid;
// Return to the same page
$url = JArrayHelper::getvalue($_SERVER, 'HTTP_REFERER', 'index.php');
}
else
{
// No menu link so redirect back to list view
$url = 'index.php?option=com_fabrik&view=list&listid=' . JRequest::getInt('listid');
// Return to the page that called the form
$url = urldecode(JRequest::getVar('fabrik_referrer', 'index.php', 'post'));
}
$Itemid = (int) @$app->getMenu('site')->getActive()->id;
if ($url == '')
{
if ($Itemid !== 0)
{
$url = 'index.php?' . http_build_query($app->getMenu('site')->getActive()->query) . '&Itemid=' . $Itemid;
}
else
{
// No menu link so redirect back to list view
$url = 'index.php?option=com_fabrik&view=list&listid=' . JRequest::getInt('listid');
}
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion components/com_fabrik/views/form/tmpl/admin/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
echo "<div class=\"fabrikMainError fabrikError$active\">$form->error</div>";?>

<?php
if ($form->editButton && $this->hasActions)
{
// Jaanus: and if user is allowed to edit data; visible only in details view
echo $form->editButton;
}
if ($this->showEmail) {
echo $this->emailLink;
}
Expand Down Expand Up @@ -78,7 +83,7 @@
?>
<div class="fabrikActions"><?php echo $form->resetButton;?> <?php echo $form->submitButton;?>
<?php echo $form->nextButton?> <?php echo $form->prevButton?>
<?php echo $form->applyButton;?>
<?php echo $form->applyButton . ' ' .$form->detailsButton;?>
<?php echo $form->copyButton . " " . $form->gobackButton . ' ' . $form->deleteButton . ' ' . $this->message ?>
</div>
<?php
Expand Down
7 changes: 6 additions & 1 deletion components/com_fabrik/views/form/tmpl/bluesky/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
echo FabrikHelperHTML::image('alert.png', 'form', $this->tmpl);
echo "$form->error</div>";?>
<?php
if ($form->editButton && $this->hasActions)
{
// Jaanus: and if user is allowed to edit data; visible only in details view
echo $form->editButton;
}
if ($this->showEmail) {
echo $this->emailLink;
}
Expand Down Expand Up @@ -86,7 +91,7 @@
<?php if ($this->hasActions) {?>
<div class="fabrikActions"><?php echo $form->resetButton;?> <?php echo $form->submitButton;?>
<?php echo $form->nextButton?> <?php echo $form->prevButton?>
<?php echo $form->applyButton;?>
<?php echo $form->applyButton . ' ' .$form->detailsButton;?>
<?php echo $form->copyButton . " " . $form->gobackButton . ' ' . $form->deleteButton . ' ' . $this->message ?>
</div>
<?php } ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
$active = ($form->error != '') ? '' : ' fabrikHide';
echo "<div class=\"fabrikMainError fabrikError$active\">$form->error</div>";?>
<?php
if ($form->editButton && $this->hasActions)
{
// Jaanus: and if user is allowed to edit data; visible only in details view
echo $form->editButton;
}
if ($this->showEmail) {
echo $this->emailLink;
}
Expand All @@ -57,7 +62,7 @@
?>
<div class="fabrikActions"><?php echo $form->resetButton;?> <?php echo $form->submitButton;?>
<?php echo $form->nextButton?> <?php echo $form->prevButton?>
<?php echo $form->applyButton;?>
<?php echo $form->applyButton . ' ' .$form->detailsButton;?>
<?php echo $form->copyButton . " " . $form->gobackButton . ' ' .$this->message ?>
</div>

Expand Down
7 changes: 6 additions & 1 deletion components/com_fabrik/views/form/tmpl/default/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
echo FabrikHelperHTML::image('alert.png', 'form', $this->tmpl);
echo "$form->error</div>";?>
<?php
if ($form->editButton && $this->hasActions)
{
// Jaanus: and if user is allowed to edit data; visible only in details view
echo $form->editButton;
}
if ($this->showEmail) {
echo $this->emailLink;
}
Expand Down Expand Up @@ -133,7 +138,7 @@
<?php if ($this->hasActions) {?>
<div class="fabrikActions"><?php echo $form->resetButton;?> <?php echo $form->submitButton;?>
<?php echo $form->nextButton?> <?php echo $form->prevButton?>
<?php echo $form->applyButton;?>
<?php echo $form->applyButton . ' ' .$form->detailsButton;?>
<?php echo $form->copyButton . " " . $form->gobackButton . ' ' . $form->deleteButton . ' ' . $this->message ?>
</div>
<?php } ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
echo FabrikHelperHTML::image('alert.png', 'form', $this->tmpl);
echo "$form->error</div>";?>
<?php
if ($form->editButton && $this->hasActions)
{
// Jaanus: and if user is allowed to edit data; visible only in details view
echo $form->editButton;
}
if ($this->showEmail) {
echo $this->emailLink;
}
Expand Down Expand Up @@ -87,7 +92,7 @@
<!-- This is where the buttons at the bottom of the form are set up -->
<div class="fabrikActions"><?php echo $form->resetButton;?> <?php echo $form->submitButton;?>
<?php echo $form->nextButton?> <?php echo $form->prevButton?>
<?php echo $form->applyButton;?>
<?php echo $form->applyButton . ' ' .$form->detailsButton;?>
<?php echo $form->copyButton . " " . $form->gobackButton . ' ' . $form->deleteButton . ' ' . $this->message ?>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
echo FabrikHelperHTML::image('alert.png', 'form', $this->tmpl);
echo "$form->error</div>";?>
<?php
if ($form->editButton && $this->hasActions)
{
// Jaanus: and if user is allowed to edit data; visible only in details view
echo $form->editButton;
}
if ($this->showEmail) {
echo $this->emailLink;
}
Expand Down Expand Up @@ -85,7 +90,7 @@
<?php echo $this->pluginbottom; ?>
<div class="fabrikActions"><?php echo $form->resetButton;?> <?php echo $form->submitButton;?>
<?php echo $form->nextButton?> <?php echo $form->prevButton?>
<?php echo $form->applyButton;?>
<?php echo $form->applyButton . ' ' .$form->detailsButton;?>
<?php echo $form->copyButton . " " . $form->gobackButton . ' ' . $form->deleteButton . ' ' . $this->message ?>
</div>

Expand Down
7 changes: 6 additions & 1 deletion components/com_fabrik/views/form/tmpl/f3/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
echo FabrikHelperHTML::image('alert.png', 'form', 'f3');
echo "$form->error</div>";?>
<?php
if ($form->editButton && $this->hasActions)
{
// Jaanus: and if user is allowed to edit data; visible only in details view
echo $form->editButton;
}
if ($this->showEmail) {
echo $this->emailLink;
}
Expand Down Expand Up @@ -86,7 +91,7 @@
<?php echo $this->pluginbottom; ?>
<div class="fabrikActions"><?php echo $form->resetButton;?> <?php echo $form->submitButton;?>
<?php echo $form->nextButton?> <?php echo $form->prevButton?>
<?php echo $form->applyButton;?>
<?php echo $form->applyButton . ' ' .$form->detailsButton;?>
<?php echo $form->copyButton . " " . $form->gobackButton . ' ' . $form->deleteButton . ' ' . $this->message ?>
</div>

Expand Down
5 changes: 5 additions & 0 deletions components/com_fabrik/views/form/tmpl/iwebkit/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@
$active = ($form->error != '') ? '' : ' fabrikHide';
echo "<div class=\"fabrikMainError fabrikError$active\">$form->error</div>";?>
<?php
if ($form->editButton && $this->hasActions)
{
// Jaanus: and if user is allowed to edit data; visible only in details view
echo $form->editButton;
}
if ($this->showEmail) {
echo $this->emailLink;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
echo FabrikHelperHTML::image('alert.png', 'form', $this->tmpl);
echo "$form->error</div>";?>
<?php
if ($form->editButton && $this->hasActions)
{
// Jaanus: and if user is allowed to edit data; visible only in details view
echo $form->editButton;
}
if ($this->showEmail) {
echo $this->emailLink;
}
Expand Down Expand Up @@ -90,7 +95,7 @@
<?php echo $this->pluginbottom; ?>
<div class="fabrikActions"><?php echo $form->resetButton;?> <?php echo $form->submitButton;?>
<?php echo $form->nextButton?> <?php echo $form->prevButton?>
<?php echo $form->applyButton;?>
<?php echo $form->applyButton . ' ' .$form->detailsButton;?>
<?php echo $form->copyButton . " " . $form->gobackButton . ' ' . $form->deleteButton . ' ' . $this->message ?>
</div>

Expand Down
7 changes: 6 additions & 1 deletion components/com_fabrik/views/form/tmpl/mint/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
echo FabrikHelperHTML::image('alert.png', 'form', $this->tmpl);
echo "$form->error</div>";?>
<?php
if ($form->editButton && $this->hasActions)
{
// Jaanus: and if user is allowed to edit data; visible only in details view
echo $form->editButton;
}
if ($this->showEmail) {
echo $this->emailLink;
}
Expand Down Expand Up @@ -85,7 +90,7 @@
<?php echo $this->pluginbottom; ?>
<div class="fabrikActions"><?php echo $form->resetButton;?> <?php echo $form->submitButton;?>
<?php echo $form->nextButton?> <?php echo $form->prevButton?>
<?php echo $form->applyButton;?>
<?php echo $form->applyButton . ' ' .$form->detailsButton;?>
<?php echo $form->copyButton . " " . $form->gobackButton . ' ' . $form->deleteButton . ' ' . $this->message ?>
</div>

Expand Down
7 changes: 6 additions & 1 deletion components/com_fabrik/views/form/tmpl/no-labels/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
echo FabrikHelperHTML::image('alert.png', 'form', $this->tmpl);
echo "$form->error</div>";?>
<?php
if ($form->editButton && $this->hasActions)
{
// Jaanus: and if user is allowed to edit data; visible only in details view
echo $form->editButton;
}
if ($this->showEmail) {
echo $this->emailLink;
}
Expand Down Expand Up @@ -85,7 +90,7 @@
<?php echo $this->pluginbottom; ?>
<div class="fabrikActions"><?php echo $form->resetButton;?> <?php echo $form->submitButton;?>
<?php echo $form->nextButton?> <?php echo $form->prevButton?>
<?php echo $form->applyButton;?>
<?php echo $form->applyButton . ' ' .$form->detailsButton;?>
<?php echo $form->copyButton . " " . $form->gobackButton . ' ' . $form->deleteButton . ' ' . $this->message ?>
</div>

Expand Down