Futher improved the redirect option to use return and stack the return path to take the user back to the original area from where they clicked away.
This commit is contained in:
@@ -3546,6 +3546,108 @@ abstract class ComponentbuilderHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the edit button
|
||||
*
|
||||
* @param int $item The item to edit
|
||||
* @param string $view The type of item to edit
|
||||
* @param string $views The list view controller name
|
||||
* @param string $ref The return path
|
||||
* @param string $headsup The message to show on click of button
|
||||
*
|
||||
* @return string On success the full html edit button
|
||||
*
|
||||
*/
|
||||
public static function getEditButton(&$item, $view, $views, $ref = '', $component = 'com_componentbuilder', $headsup = 'COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE')
|
||||
{
|
||||
// get URL
|
||||
$url = self::getEditURL($item, $view, $views, $ref, $component);
|
||||
// check if we found any
|
||||
if (self::checkString($url))
|
||||
{
|
||||
// check that we have the ID
|
||||
if (self::checkObject($item) && isset($item->id))
|
||||
{
|
||||
// check if the checked_out is available
|
||||
if (isset($item->checked_out))
|
||||
{
|
||||
$checked_out = (int) $item->checked_out;
|
||||
}
|
||||
}
|
||||
elseif (self::checkArray($item) && isset($item['id']))
|
||||
{
|
||||
// check if the checked_out is available
|
||||
if (isset($item['checked_out']))
|
||||
{
|
||||
$checked_out = (int) $item['checked_out'];
|
||||
}
|
||||
}
|
||||
// set the link title
|
||||
$title = self::safeString(JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W');
|
||||
// check that there is a check message
|
||||
if (self::checkString($headsup))
|
||||
{
|
||||
$href = 'onclick="UIkit.modal.confirm(\''.JText::_($headsup).'\', function(){ window.location.href = \'' . $url . '\' })" href="javascript:void(0)"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$href = 'href="' . $url . '"';
|
||||
}
|
||||
// check if it is checked out
|
||||
if (isset($checked_out) && $checked_out > 0)
|
||||
{
|
||||
// is this user the one who checked it out
|
||||
if ($checked_out == JFactory::getUser()->id)
|
||||
{
|
||||
return ' <a ' . $href . ' class="uk-icon-lock" title="' . $title . '"></a>';
|
||||
}
|
||||
return ' <a href="#" disabled class="uk-icon-lock" title="' . JText::sprintf('COM_COMPONENTBUILDER__HAS_BEEN_CHECKED_OUT_BY_S', self::safeString($view, 'W'), JFactory::getUser($checked_out)->name) . '"></a>';
|
||||
}
|
||||
// return normal edit link
|
||||
return ' <a ' . $href . ' class="uk-icon-pencil" title="' . $title . '"></a>';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the edit URL
|
||||
*
|
||||
* @param int $item The item to edit
|
||||
* @param string $view The type of item to edit
|
||||
* @param string $ref The return path
|
||||
*
|
||||
* @return string On success the edit url
|
||||
*
|
||||
*/
|
||||
public static function getEditURL(&$item, $view, $views, $ref = '', $component = 'com_componentbuilder')
|
||||
{
|
||||
// check that we have the ID
|
||||
if (self::checkObject($item) && isset($item->id))
|
||||
{
|
||||
$id = (int) $item->id;
|
||||
}
|
||||
elseif (self::checkArray($item) && isset($item['id']))
|
||||
{
|
||||
$id = (int) $item['id'];
|
||||
}
|
||||
elseif (is_numeric($item))
|
||||
{
|
||||
$id = (int) $item;
|
||||
}
|
||||
// check ID
|
||||
if (isset($id) && $id > 0)
|
||||
{
|
||||
// can edit
|
||||
if (JFactory::getUser()->authorise($view . '.edit', $component . '.' . $view . '.' . (int) $id))
|
||||
{
|
||||
// set the edit link
|
||||
return JRoute::_("index.php?option=" . $component . "&view=" . $views . "&task=" . $view . ".edit&id=" . $id . $ref);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* the Crypt objects
|
||||
**/
|
||||
|
@@ -1,5 +1,6 @@
|
||||
COM_COMPONENTBUILDER="Component Builder"
|
||||
COM_COMPONENTBUILDER_ACCESS_DENIED="Access denied!"
|
||||
COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE="All unsaved work on this page will be lost, are you sure you want to continue?"
|
||||
COM_COMPONENTBUILDER_API="Api"
|
||||
COM_COMPONENTBUILDER_API_DESC="Sync Portal API"
|
||||
COM_COMPONENTBUILDER_BACKUP_FAILED_PLEASE_TRY_AGAIN_IF_THE_ERROR_CONTINUE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="Backup failed, please try again. If the error continue, please contact your system administrator."
|
||||
@@ -21,6 +22,7 @@ COM_COMPONENTBUILDER_DTEMAILDTDDSDD="<dt>Email</dt><dd>%s</dd>"
|
||||
COM_COMPONENTBUILDER_DTLICENSEDTDDSDD="<dt>License</dt><dd>%s</dd>"
|
||||
COM_COMPONENTBUILDER_DTOWNERDTDDSDD="<dt>Owner</dt><dd>%s</dd>"
|
||||
COM_COMPONENTBUILDER_DTWEBSITEDTDDSDD="<dt>Website</dt><dd>%s</dd>"
|
||||
COM_COMPONENTBUILDER_EDIT="Edit"
|
||||
COM_COMPONENTBUILDER_EDIT_S="Edit %s"
|
||||
COM_COMPONENTBUILDER_EMAIL_S="Email: %s"
|
||||
COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SEND="Email with the new key was send"
|
||||
@@ -87,6 +89,7 @@ COM_COMPONENTBUILDER_WEBSITE_S="Website: %s"
|
||||
COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY_UNLESS_THEY_HAVE_THIS_KEY_ABOVE_SO_DO_KEEP_IT_SAFE="Your data is encrypted with a AES 128 bit encryption using the above 32 character key. Without this key it will take the current technology with a brute force attack method more then <a href="http://random-ize.com/how-long-to-hack-pass/" target="_blank" title="How long to hack pass">700 000 000 000 000 000 000 000 000 000 000</a> years to crack theoretically. Unless they have this key above, so do keep it safe."
|
||||
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_ACCESS_THE_SERVER_DETAILS_BS_DENIEDB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="You do not have permission to access the server details (<b>%s - denied</b>), please contact your system administrator for more info."
|
||||
COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS="You should add the correct owner details."
|
||||
COM_COMPONENTBUILDER__HAS_BEEN_CHECKED_OUT_BY_S="% has been checked out by %s"
|
||||
COM_CONTENT_FIELD_MODIFIED_DESC="The last date this item was modified."
|
||||
JGLOBAL_FIELD_ID_DESC="Record number in the database."
|
||||
JGLOBAL_FIELD_ID_LABEL="ID"
|
||||
|
Reference in New Issue
Block a user