MRFC: Midgard site startup and configuration.

Tarjei Huse <tarjei-y/[email protected]>
Newsgroups gmane.comp.web.midgard.devel
Message-ID <1139245050.5007.152.camel@localhost>
Hi, out of frustration  with the current M-T I have written a draft mRFC
for how Midcom Templates should be handled in the future. Please read
through it and comment it. I haven't added it to the mRFC's list yet as
I want to see if the ideas presented are usefull in this form.

MRFC: Midgard site startup and configuration.

This is an outline for how future MidCOM Sites should be created and
configured.

Background: 
The current solution to set up MidCOM sites uses the Midgard Template to
create sites. The current template is slow and is hard to modify and
work with. 

For those who do not know, the following is an example of the setup of a
very basic MidCOM site.

Midcom goes through three stages:
1. initialization and startup
2. Content output
3. Ending. 

The most basic site template for use in MidCOM is this:
<?php 
$GLOBALS['midcom_config_local']['midcom_root_topic_guid'] =
"860f1b5af98b409abd916a80cdb0d68e";
require 'midcom.php';
$_MIDCOM->codeinit();
?>
<html>
<head>
<?php
  echo $_MIDCOM->print_head_elements();

?>
</head>
<body <?php echo $_MIDCOM->print_jsonload(); ?> > 

<?php echo $_MIDCOM->content(); ?>

</body></html>
<?php $_MIDCOM->finish(); ?>


Site configuration
Today site configuration is contained in parameters to the host. This is
fairly inefficient as this generates a large set of queries to the
database on every request. 

Instead of keeping the configuration in parameters it should be kept in
a simple snippet that may be included into the request.

This snippet should be named:
/sitegroup-config/hosts/<id-of-host> 

The following parameter must be set in the configuration:

$GLOBALS['midcom_config_local']['midcom_root_topic_guid'] =
"860f1b5af98b409abd916a80cdb0d68e";

Also, all of todays configuration options will be included. Setting of
the options will be handled through a datamanager2 schema in
midcom/config.

Site authentication
Today site authentication is handled by the old Nemein-Auth library.
This library is snippetbased and old. The new MidCOM authentication
libary exists and should be used instead. Thus there will not be
anything authentication related in the simple code-init.

The $GLOBALS['midcom_site'] array
Today, the template populates the midcom_site array with some objects as
well. It is my suggestion that this array is created when editing the
host settings but that the objects are left out. Another option is to
link the objects to objects within the MidCOM framework.

Placing the MidCOM elements in midgard-root.php. 
It is an option to place the MidCOM elements in midgard-root.php. As
long as there is a simple way to handle non-MidCOM applications I
strongly suggest this is done.

One way to do that is to make a mock MidCOM object that is used when the
site is a non MidCOM site. This would make the content in the
style/midgard-root.php cleaner. Another option is to branch
midgard-root.php for separate handling of MidCOM requests.



What are the best ways to mark/detect a MidCOM request from a non-midcom
request? Is it needed?

Site Configuration 
We will need a configuration editor to replace midcom-admin/settings.
The site editor should be based on dm2. 

Should the editor should be accessible through midcom-exec? This is
probably needed when a critical setting is wrong and needs to be reset.

This could be done today using a dummy topic[1] that could be set to run
MidCOM with a configuration module, and then run a normal MidCOM
session.

Sitewizard
The current MidCOM sitewizard needs to be improved. This should probably
be the content of a separate MRFC, but I'm including some thoughts
here. 

Todays sitewizard should be separated out into a number of tools:
a) A sitegroup creator/editor. The editor should make it possible to
create new sitegroups.
b) A host creator. The host creator creates a simple host entry. 
c) A site creator. The site creator should be used when the user wants
to create a new site. The site creator uses a set of templates to create
a site based on the template.


The site template should be a simple xml file like this:

<site title=ā€Simple siteā€ description=ā€A simple site with only one
pageā€>

<topic title=ā€Simpleā€ midcom=ā€de.linkm.taviewerā€ form=ā€topic-schemaā€>

<article name=ā€indexā€ title=ā€Welcome to Midgardā€ />

</topic>

</site>


It is suggested that any configuration variables should be set as
attributes and not values. 


The wizard should be runnable through midcom-exec using a
dummy-topic[1]. This could be used in situations where one does not know
what the site will be used for (f.x. because the customer hasn't said
so).

[1] Dummy topic
Midcom currently needs a topic to be able to run. By creating a set of
dummy topics and then setting the
$GLOBALS['midcom_config_local']['midcom_root_topic_guid'] it should be
possible to run a normal midcom component without having to create a
local topic for it. 

This is untested and **the component would have to be created with this
usage in mind**.




-- 
Tarjei Huse <tarjei-y/[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.