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.082 seconds

Freakin' Awesome!!! J-Cook is simply awesome - whether you're a highly experienced developer or complete novice whether you're building a small inventory component or a complete community solution! The beauty comes from a fast slick and reliable platform that readily provides developers with everything they'll need to build the backbone of a solid and secure component with wizards for authoring access publishing aliasing created/modified by dates... you name it COOK provides it! J-Cook really surpasses all of the 'competition' as far as MVC tools are concerned! Try love it and get cooking!
learnthrusong (JED)
          

Get Started