developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#514 closed bug (duplicate)

createapp command provides an overloaded html response and the user may not know it.

Reported by: Julien Owned by: bastnic
Priority: normal Milestone:
Component: jelix-scripts Version: trunk
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

The problem

Ticket #496 added a default page instead of a blank one for default action of default module.

The problem to me is that we have this code in the controller :

function index() {
    $rep = $this->getResponse('html');
    // this is a call for the 'welcome' zone after creating a new application
    // remove this line
    $rep->body->assignZone('MAIN', 'jelix~check_install'); 
    return $rep;
}

So following instructions in the code and the manual, the user will make such change :

function index() {
    $rep = $this->getResponse('html');
    $rep->bodyTpl = 'myOwnTemplate';
    return $rep;
}

and that won't work because

$rep->bodyTpl = 'myOwnTemplate';

is probably overwrited in the overloaded html response.

A solution ?

If think we should modify the following way :

when an app is created, we should have something like

startModule = "jelix"
startAction = "default:appCreated"

in config file.

This action will display the same information as now.

This page should also tell the user to modify both parameters in config file to "activate" their application.

Another good point is that we no longer need an overloaded response and that the "application created" action will no more duplicated for every application.

Change History (5)

comment:1 Changed 12 years ago by laurentj

I'm not agree with you

So following instructions in the code and the manual, the user will make such change :

The manual and tutorials will be updated when the 1.0.3 will be released. The user won't have to specify a new template because there is already a new template created for him. So he has the choice :

  • to modify the given template
  • to modify the overloaded response

The manual and tutorials will explain that choice

when an app is created, we should have something like

No, I don't like it. If we do this things, we have to explain that the user should modify his configuration to start to develop his first action etc... This is not the goal. The goal of createapp is to create an application which is ready. The developer just had its own line of code in the created controller. No other modification.

This page should also tell the user to modify both parameters in config file to "activate" their application.

No. Less we have to explain something to the developer, more jelix will appear powerful. The developer's application should be ready without doing many modifications.

Another good point is that we no longer need an overloaded response

This is a very bad point. In good practice and in most of case, the developer has to develop an overloaded response ! If we added an overloaded response in createapp, this is because we wanted it !

comment:2 Changed 12 years ago by laurentj

  • Component changed from jelix to jelix-scripts
  • Version changed from 1.0.2 to trunk

comment:3 Changed 12 years ago by Julien

Oh ok I didn't know that all.

So ok, there's no real problem about this, except, in my opinion, that we should still be able to change the template selector without overloading the response.

What about, in myHtmlResponse.class.php.tpl:

function _commonProcess() {
   if(!$this->bodyTpl)
       $this->bodyTpl = '%%appname%%~main';
   $this->body->assignIfNone('MAIN','<p>no content</p>');
}

If we do not implement such a change, users would have to change their config file (provide a different overloaded response) or modyfy the given overloaded response just to be able to change template selector (for default action and other).

I think it's quite problematic because it took me too much time to understand why my template selector wasn't applied when I demonstrated Jelix to students I'm teaching sometimes ;)

Or maybe we could change the controller template like this :

function %%method%%() {
    $rep = $this->getResponse('html');

    // this sets the template for the html page. Please update the template for you needs. You can also set another template if you need.
    $rep->bodyTpl = '%%appname%%~main';

    // this is a call for the 'welcome' zone after creating a new application
    // remove this line
    $rep->body->assignZone('MAIN', 'jelix~check_install');

    return $rep;
}

and forget about what I changed in myHtmlResponse.

If think this solves the problem I'm reporting and that is quite didactive for the user : he knows which template is used, why, and how to change it.

Sorry if I'm quite bothering ;)

comment:4 Changed 12 years ago by laurentj

  • Resolution set to duplicate
  • Status changed from new to closed

we should still be able to change the template selector without overloading the response.

Yes, Bastien and me saw that this morning : ticket #516.

What about, in myHtmlResponse.class.php.tpl:

It's better to change the property itself as shown in the patch of ticket #516 ;-)

Or maybe we could change the controller template like this :

No. A good practice is to not change the bodyTpl in actions if we have already an overloaded response, except for... exceptions :-)

Ok so this ticket become a duplicate of #516

comment:5 Changed 12 years ago by Julien

Ok thanks for change in #516

Note: See TracTickets for help on using tickets.