Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

[ADDED] Custom Bricks 26 Jul 2012 10:03 #2902

  • arnar
  • arnar's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 20
  • Thank you received: 1
Hi,

I believe it would be useful to add the following bricks.
  1. Save & New. Works similar to Save & Close except it Saves and opens up a empty sheet.
  2. Save & Clone. Works similar to 1. except it Saves and opens up a copy of the Saved item with a new id.
  3. Custom Brick with label. Then once published the user could just call code from the brick action. It would make it easier to automatically replace code instead of having to manually change the files after publish.


Regards
Arnar
The following user(s) said Thank You: edwardcox

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

Last edit: by arnar.

Re: Custom Bricks 26 Jul 2012 12:47 #2907

+1 from me, I like the way he is thinking.

Edward.
Passionate Joomla! Developer and J-Cook pro evangelist.
www.jcombuilder.com - we build great Joomla!® Components so you don't have to.

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

Re: Custom Bricks 26 Jul 2012 16:48 #2908

  • arnar
  • arnar's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 20
  • Thank you received: 1
The save & new code is really simple

in view form add
if ($access->get('core.edit') || ($isNew && $access->get('core.create') || $access->get('core.edit.own')))
			$bar->appendButton( 'Standard', "save-new", "JTOOLBAR_SAVE_AND_NEW", "save2new", false);

then in controller add
in constructor
        $this->registerTask( 'save2new', 'save' );

in save function
        $task = $this->getTask();

      		if ($cid = parent::_save($post))
		{
			$vars = array();

            if ($task == 'save2new') {
                
                JRequest::setVar( 'cid', 0 );
                JRequest::setVar( 'view'  , 'clubitem');
                JRequest::setVar( 'layout', 'clubitem' );
            }
            else
            {
			    JRequest::setVar( 'view'  , 'clubs');
			    JRequest::setVar( 'layout', 'default' );
			    JRequest::setVar( 'cid', null );
            }
			$this->setRedirect(LpadHelper::urlRequest($vars));
		}
		else
			//Keep the post and stay on page
			parent::display();

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

Last edit: by arnar.
  • Page:
  • 1
Time to create page: 0.081 seconds

I jumped and started to work on a demo component... but 2 days later this demo component became the real component. I just showed today the end result to my customer and he turned to me and said... "this is more than I expected"... All of this is because Cook did cut about 70% of my work and provided me more ways to improve the usability of the component. The end result was 17 tables all related between than to generate a full dashboard for the travel agents. Thanks for Cook developers for such great tool. This component would not be possible to be done at short time with all the features in it
Griiettner (Forum)  

Get Started