Keyword

Frontend Save And New Button

  • Omar Ramos
  • Omar Ramos's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 8 months ago #78518 by Omar Ramos
Frontend Save And New Button was created by Omar Ramos
I was missing the Save and New button in the frontend so I added it.
3 Files needed to be modified:
administrator/components/com_k2/models/items.php around line 612
case 'saveAndNew':
    $msg = JText::_('Item saved');
    if ($front) {
$link = 'index.php?option=com_k2&view=item&task=add';
    } else {
$link = 'index.php?option=com_k2&view=item';
    }
    break;

components/com_k2/controllers/item.php around line 59:
Add in this new method:
function saveAndNew() {
$mainframe = &JFactory::getApplication();
JRequest::checkToken() or jexit('Invalid Token');
require_once(JPATH_COMPONENT_ADMINISTRATOR.DS.'models'.DS.'item.php');
$model= new K2ModelItem;
$model->save(true);
}

components/com_k2/views/item/tmpl/form.php around line 263 (my line numbers are a little different because I've added some lines to this file):
<td id="toolbar-save-and-new" class="button">
<a class="toolbar" href="#" onclick="javascript: submitbutton('saveAndNew'); return false;">
<span title="<?php echo JText::_('Save & New');?>" class="icon-32-save"></span>
<?php echo JText::_('Save & New');?>
</a>
</td>
(you'll want to add the above in between the Save and Cancel buttons).

I hope this helps someone!

Please Log in or Create an account to join the conversation.

More
14 years 8 months ago #78519 by Mark Banks
Replied by Mark Banks on topic Frontend Save And New Button
Will this same hack work for the 'Save and New' suggestions made here:
community.getk2.org/forum/topics/productivity-enhancements

Cheers,
Mark

Please Log in or Create an account to join the conversation.

More
14 years 8 months ago #78520 by rexkramer
Replied by rexkramer on topic Frontend Save And New Button
Nice one. I have another suggestion or request, cause the average user seems to be confused by the modal window, which stays open after hitting the save button... sounds strange, but i have almost the same feelings about the current behavior.

Is it possible to have an APPLY and a SAVE button... Or let the SAVE button close the modal window? It make much more sense to me. When the window stays open, i often think i have made a mistake in my entry.

Please Log in or Create an account to join the conversation.

More
14 years 7 months ago #78521 by k2k2k2
Replied by k2k2k2 on topic Frontend Save And New Button
be great if this is added, I currently have a showstopper problem with the cancel button itself, it's showing, can click on it , nothing happens, so if I ever edit, I am stuck (this is only with editing existing items)...

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #78522 by jeronimo
Replied by jeronimo on topic Re: Frontend Save And New Button
considero que seria util hacer la modificacion para que el guardar cierre la ventana, ya que muchos usuarios creen que lo han hecho mal al quedar el formulario ahi.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum