Ticket #480 (closed enhancement: fixed)

Opened 5 months ago

Last modified 4 months ago

Add a default template in a new application

Reported by: laurentj Assigned to: bastnic
Priority: normal Milestone: Jelix 1.0.3
Component: jelix-scripts Version: 1.0.2
Severity: normal Keywords: createapp
Cc: Php version:
Review: review+ Hosting Provider:
Documentation needed: 1 Blocking:
Blocked By: 496

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

patch-480-496.diff (8.5 kB) - added by bastnic on 03/12/08 23:28:46.
patch-480-496-2.diff (10.6 kB) - added by bastnic on 03/14/08 02:29:16.
patch-480-496-3.diff (17.1 kB) - added by bastnic on 03/16/08 15:08:35.
patch-480-496-4.diff (4.6 kB) - added by bastnic on 03/18/08 23:19:07.
need a first review ;)

Change History

03/06/08 02:11:21 changed 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 ?

03/10/08 23:26:33 changed 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.

03/11/08 09:59:16 changed 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.

03/11/08 16:12:47 changed by bastnic

  • status changed from new to assigned.
  • owner set to bastnic.

je vois ça ce soir.

(follow-up: ↓ 7 ) 03/12/08 11:51:36 changed 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 ?

03/12/08 12:50:39 changed 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.

(in reply to: ↑ 5 ) 03/12/08 14:37:22 changed 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.

03/12/08 15:27:49 changed by bastnic

  • blocking set to 496.

03/12/08 16:57:45 changed 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 ?

03/12/08 17:07:40 changed by laurentj

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

03/12/08 23:28:46 changed by bastnic

  • attachment patch-480-496.diff added.

03/12/08 23:36:26 changed 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 ?

03/13/08 10:34:19 changed 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.

03/14/08 02:29:16 changed by bastnic

  • attachment patch-480-496-2.diff added.

03/14/08 02:36:38 changed by bastnic

pas pu beaucoup bosser aujourd'hui :s.

Et toujours pas touché aux locales.

03/15/08 23:31:54 changed 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).

03/16/08 15:08:35 changed by bastnic

  • attachment patch-480-496-3.diff added.

03/16/08 16:21:29 changed by bastnic

  • blocking deleted.

03/18/08 23:19:07 changed by bastnic

  • attachment patch-480-496-4.diff added.

need a first review ;)

03/18/08 23:29:03 changed 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 ;-)

03/18/08 23:40:17 changed 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)

03/19/08 01:25:18 changed by bastnic

  • status changed from assigned to closed.
  • resolution set to fixed.

resolved, svn 819

03/19/08 01:32:03 changed by bastnic

  • docneeded set to 1.
Download in other formats: Comma-delimited Text Tab-delimited Text RSS Feed