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 11 years ago

Closed 11 years ago

Last modified 11 years ago

#480 closed enhancement (fixed)

Add a default template in a new application

Reported by: laurentj Owned by: bastnic
Priority: normal Milestone: Jelix 1.0.3
Component: jelix-scripts Version: 1.0.2
Severity: normal Keywords: createapp
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

To display something after creating a new application and so to see if all is alright, the default controller should display something, a welcome message for example.

Attachments (4)

patch-480-496.diff (8.5 KB) - added by bastnic 11 years ago.
patch-480-496-2.diff (10.6 KB) - added by bastnic 11 years ago.
patch-480-496-3.diff (17.1 KB) - added by bastnic 11 years ago.
patch-480-496-4.diff (4.6 KB) - added by bastnic 11 years ago.
need a first review ;)

Download all attachments as: .zip

Change History (24)

comment:1 Changed 11 years ago by bastnic

I can take this ticket but I've one question before.

The default module is initiate with

$cmd = jxs_load_command('createmodule');
$cmd->init(array(),array('module'=>$GLOBALS['APPNAME']));
$cmd->run();

which initiate himself a new controller.

Do we have to had a parameter to the module init which will pass it to the creation of the default controller ??

the pb is for the add of

$rep->bodyTpl = 'mymodule~default.tpl'

it's heard that the default.tpl.tpl is added by the createapp ?

comment:2 Changed 11 years ago by laurentj

I propose to add a template in the jelix module (lib/jelix/core-modules/jelix), which displays the welcome page. So the default controller just show this template, and there isn't any new template to modify or delete.

The welcome page could have same colours of the design of jelix.org and could show the jelix logo (see http://jelix.org/design/). The logo and the css should be store in the lib/jelix-www/ directory. A message in the page should inform that, if the user doesn't see the logo, then he should create the "jelix" alias to lib/jelix-www, in his web server configuration (or he should copy this directory).

An other message could invite the user to modify the new controller. And we could add links to the documentation.

comment:3 Changed 11 years ago by laurentj

Other ideas :

  • the message which informs about the jelix alias to lib/jelix-www/, could be style with a display:none; in a css stylesheet. Because this stylesheet is stored in jelix-www, if the page can't load the stylesheet, it means the alias is not set or wrong, and then the message is displayed. But if the alias is ok, the message won't appear anymore.
  • we could use jInstallCheck (lib/jelix/core/jInstallCheck.class.php), to verify if all is ok and to display the results. See lib/jelix/checker.php for an example.

comment:4 Changed 11 years ago by bastnic

  • Owner set to bastnic
  • Status changed from new to assigned

je vois ça ce soir.

comment:5 follow-up: Changed 11 years ago by laurentj

In fact, about the template, I think it should have two template :

  • main.tpl in the default module, which contains a title (<h1>name of the application</h1>) and a {$MAIN}. so the default html response (ticket #496) should do $this->body->assignIfNone('MAIN','<p>no content</p>') or something like that.
  • the content of the welcome page could be added with a zone stored in the jelix module.
  • so the default controller has just do $rep->body->assignZone('MAIN', 'jelix~check');
  • in the template of the zone, it should have meta_html call to setup css stylesheet (or it can be done in the zone class...)

What do you think about it ?

comment:6 Changed 11 years ago by bballizlife

This proposal is ok for me as it will setup a good basis to start development (own response and a template calling a zone) and also a nice page to display to the developer ensuring the jelix install is ok.

comment:7 in reply to: ↑ 5 Changed 11 years ago by bastnic

  • main.tpl in the default module, which contains a title (<h1>name of the application</h1>) and a {$MAIN}. so the default html response (ticket #496) should do $this->body->assignIfNone('MAIN','<p>no content</p>') or something like that.

I ABSOLUTLY agree. I always think it was awful to create a template to display just the {$MAN}. For my article i will take this fonctionnality as implemented ok ?

  • the content of the welcome page could be added with a zone stored in the jelix module.
  • so the default controller has just do $rep->body->assignZone('MAIN', 'jelix~check');
  • in the template of the zone, it should have meta_html call to setup css stylesheet (or it can be done in the zone class...)

What do you think about it ?

ok for that too.

I look for this as soon as i can.

comment:8 Changed 11 years ago by bastnic

  • Blocking 496 added

comment:9 Changed 11 years ago by bastnic

I'm working on it right now. (i'm at university so irc is blocked). How can I add meta_html in a zone ?

comment:10 Changed 11 years ago by laurentj

$GLOBALS['gJCoord']->response->addCSS....

Changed 11 years ago by bastnic

comment:11 Changed 11 years ago by bastnic

Here is a beginning of the work on the two tickets #480 et #496.

  • a new zone with JCheckMachin customized. For the moment classes are in the zone file, I don't know where to put them called from default controller in the module. pb : always appears on each new controlle. I've to resolve that, perhaps with a new param.
  • use jelix-www/design/jelix.css
  • not yet a jelix style. I such at this.

what do you think about that ?

comment:12 Changed 11 years ago by laurentj

+++ lib/jelix-scripts/templates/main.tpl.tpl	(revision 0)
@@ -0,0 +1,3 @@
+<h1>Bienvenue dans votre nouvelle application Jelix : {$appname}</h1>
+

This should be localized.

lib/jelix-scripts/templates/controller.tpl:

         $rep = $this->getResponse('html');
-        
+        $rep->body->assignZone('MAIN', 'jelix~check'); 
         return $rep;

A comment should be added before the assignZone, to say that this line should be removed.

lib/jelix/core-modules/jelix/templates/check.tpl: many thing are missing in it. see previous comment. I prefer to name it fresh_install.tpl, or check_install.tpl. What do you think about it ? (the name of the zone should be change to, with a similar name)

lib/jelix/core-modules/jelix/zones/check.zone.php:

+class jHtmlInstallChecker implements jIInstallCheckReporter {

I prefer an other name, checkZoneInstallReporter for example.

+class jInstallCheckReturn extends jInstallCheck {
+    function run(){
+        parent::run();
+        return $this->reporter->trace;
+    }    
+}

No, it is not useful. Just do in the zone :

    protected function _prepareTpl() {
         $reporter = new checkZoneInstallReporter();
         $check = new jInstallCheck($reporter);
         $this->_tpl->assign('check',$reporter->trace);
    }
+        $GLOBALS['gJCoord']->response->addCSSLink('/jelix-www/design/jelix.css');

I prefer the use of a meta_html tag in the template. So we can change it easily by overloaded the template. So add this in check.tpl :

  {meta_html css $j_jelixwww.'design/jelix.css'}

(Note: the path '/jelix-www/' is wrong in many case!)

+++ lib/jelix/controllers/jControllerDaoCrud.class.php	

This modification shouldn't be a part of the patch ;-) Update your svn local copy :-)

For the moment classes are in the zone file,

it's ok for me

pb : always appears on each new controller

I don't see what you mean.

Changed 11 years ago by bastnic

comment:13 Changed 11 years ago by bastnic

pas pu beaucoup bosser aujourd'hui :s.

Et toujours pas touché aux locales.

comment:14 Changed 11 years ago by bastnic

This new patch included the #496 patch number 3.

all check_install locales are in French, i'm waiting a validation for french sentences before translates them in English. (perhaps i should do the contrary).

Changed 11 years ago by bastnic

comment:15 Changed 11 years ago by bastnic

  • Blocking 496 removed

Changed 11 years ago by bastnic

need a first review ;)

comment:16 Changed 11 years ago by laurentj

  • review set to review+

Since you have landed the patch of ticket #496, why did you include it into the current patch ? Because of this mistake, we cannot apply your patch. Please update your locale copy of the repository and generate a new patch.

There are lot of "static" messages to translate. I think it is better to provide localized templates instead of using lot of locales. So, create templates/fr_FR/check_install.tpl, templates/en_EN/check_install.tpl templates/en_US/check_install.tpl.

For messages, it seems ok to me. We could modify them after the checkin.

It's ok to land this patch into the trunk and the 1.0.x branch, after you create new templates ;-)

comment:17 Changed 11 years ago by bastnic

Laurentj : because I purposed to merge them. I worked on both in same time.

I asked for the review with the fourth. And he is ok with nothing from #480.

Very good idea for your idea. I like it (no locales yes yes yes) !

I commit that (with new templates)

comment:18 Changed 11 years ago by bastnic

  • Resolution set to fixed
  • Status changed from assigned to closed

resolved, svn 819

comment:19 Changed 11 years ago by bastnic

  • Documentation needed set

comment:20 Changed 11 years ago by laurentj

  • Documentation needed unset
Note: See TracTickets for help on using tickets.