[prev in list] [next in list] [prev in thread] [next in thread] 

List:       midgard-dev
Subject:    [midgard-dev] [Aegir CMS 0000431]: Add optional 'index article' mode
From:       dev () midgard-project ! org
Date:       2003-04-30 3:28:42
[Download RAW message or body]


A BUGNOTE has been added to this bug.
=============================================================
http://bugs.midgard-project.org/view_bug_page.php?f_id=0000431
=============================================================
Reporter:             bergie
Handler:              
=============================================================
Project:              Aegir CMS
Bug ID:               0000431
Category:             core
Reproducibility:      always
Severity:             feature
Priority:             none
Status:               new
=============================================================
Date Submitted:       03 Apr 03 10:38 CEST
Last Modified:        30 Apr 03 05:28 CEST
=============================================================
Summary:              Add optional 'index article' mode
Description: 
Aegir CMS should support an "index article" mode where category content
would be stored to an article called "index" instead of the topic itself.

This would fix the issues with topics not having separate title fields or
approval functionality.
=============================================================

-------------------------------------------------------------
 Tony Lee - 08 Apr 03 01:57 CEST 
-------------------------------------------------------------
Working on it. 70% there. Still don't understand how to set the global
variable to turn the index method on/off.

-------------------------------------------------------------
 bergie - 09 Apr 03 11:10 CEST 
-------------------------------------------------------------
Config variables in Aegir CMS are read to array $set in
/AegirCore/config/config

-------------------------------------------------------------
 Tony Lee - 22 Apr 03 11:35 CEST 
-------------------------------------------------------------
Had another go at this today.

First try I pretty much ignored this file: snippet
/AegirCore/argv0/browse/browse_topic 

Hacking PHP straight onto:
styles /Aegir_Core_Style/view_topic_edit

Now coming back to it I have to admit I really don't understand how a
dynamic template can be set from 'browse topic'. In fact I'm pretty unclear
about the context of this snippet altogether. 

Any pointers?

-------------------------------------------------------------
 bergie - 22 Apr 03 14:06 CEST 
-------------------------------------------------------------
No PHP is allowed in the templates, use the dynamic stuff instead.

-------------------------------------------------------------
 Tony Lee - 23 Apr 03 03:39 CEST 
-------------------------------------------------------------
Um... yeah I got that. That's why I thought I could do it when I tried just
hacking the template but came unstuck trying to do it the right way. 

How does the dynamic stuff work? I know it would probably be user to just
do it yourself but please bear with me I'm getting there.

-------------------------------------------------------------
 Tony Lee - 23 Apr 03 12:16 CEST 
-------------------------------------------------------------
After talking to Henri the template system seems a little clearer, BUT.

Changing view_topic_edit does not seem to be the go. The concept of
'simpledhtmlonly' vs. 'dhtmlonly' overlaps with the sections of the
template that need to be edited out with dynamic 'indexarticle' ...

http://www.thewebmasters.net/php/FastTemplate.phtml#define_dynamic_Macro_ParentNa
"There are a few rules when using dynamic blocks - dynamic blocks should not
be nested inside other dynamic blocks - strange things WILL occur."

I'm thinking it would be better to make a separate style
'view_topic_index_edit', but have not been able to figure out where the
style is called from.

How does 'view_topic_edit' get included? I"ve looked through all the
related files but don't see it.

-------------------------------------------------------------
 bergie - 23 Apr 03 12:25 CEST 
-------------------------------------------------------------
view_topic_edit seems to be included in browse/browse using the following
system:

Line 471:
$tpltype = $type;

Lines 478-480:
$tpl->define(
  array(
      "body" => "view_".$tpltype,

Line 981-982:
$tpl->parse(BODY, "body");
$tpl->FastPrint();

FastTemplate in Aegir CMS / Nadmin has been patched so that it parses the
templates from style elements instead of files.

See FastTemplate element, function is_safe on lines 139-172.

-------------------------------------------------------------
 Tony Lee - 24 Apr 03 08:36 CEST 
-------------------------------------------------------------
This work but may need improvement...

---------
snippet /AegirCore/argv0/tool_systemconfig/tool_systemconfig line 53:

"index_article" => "<B>Use 'index' articles?</B> (YES/NO: default NO)<BR>
Should category content be replaced with 'index' articles?");

---------
snippet /AegirCore/argv0/new/new:

689:         //create the index article
690:         if ($set["index_article"]=="YES"){
691:         $newarticlid = mgd_create_article("", $object->id, "index",
692:                                 "ReNameMe!", "", "",
693:                                 $mgd_login["uid"], "", "", "", "",
694:                                 "", "", "", "", "", 0);
695:         }

---------
snippet /AegirCore/argv0/browse/browse

473:     //if index article in on use the view_topic-ia_edit template
474:     if ($tpltype=="topic_edit" && $set["index_article"]=="YES"){
475:         $tpltype="topic-ia_edit";
476:     } 

---------
styles /AegirCoreStyles/view_topic-ia-edit

removes onload="copy_description_raw_to_dhtml()"
from <body>

swaps VISIBILITY: visible || VISIBILITY: hidden
for appropriate <divs>

from compared to view_topic_edit, file attached.

-------------------------------------------------------------
 Tony Lee - 24 Apr 03 08:44 CEST 
-------------------------------------------------------------
The main problem with this approach is that view_topic_edit and
view_topic-ia_edit are practically the same. However as noted it's not
possible to nest dyanamic template areas. So to get around it I would
either need to define a lot of new dynamic areas. ie. showdhtml-ia,
noshowdtml-ia etc. or write the switch into the template with php.

The duplication seems very un-OO. If I should do it another way please let
me know.

-------------------------------------------------------------
 solt - 24 Apr 03 09:23 CEST 
-------------------------------------------------------------
instead of duplicating style templates use define_dynamic:

473-479:

 if ($set[index_article]) {
    $tpl->define_dynamic(  "noindexarticle" , "body"  );
    $tpl->clear_dynamic("noindexarticle");
 } else {
    $tpl->define_dynamic(  "indexarticle" , "body"  );
    $tpl->clear_dynamic("indexarticle");
 }

and in view_topic_edit:

231:<!-- BEGIN DYNAMIC BLOCK: noindexarticle -->
232: <body bgcolor="#eeeeee" ...
onload="copy_description_raw_to_dhtml()">
233:<!-- END DYNAMIC BLOCK: noindexarticle -->
234:<!-- BEGIN DYNAMIC BLOCK: indexarticle -->
235: <body bgcolor="#eeeeee" ... >
236:<!-- BEGIN DYNAMIC BLOCK: indexarticle -->

and so on

-------------------------------------------------------------
 Tony Lee - 24 Apr 03 09:30 CEST 
-------------------------------------------------------------
Thanks Solt, I finally managed to figure that out, but it won't work
further down where there are already 3 dynamic blocks for details  ...since
dynamic block can't be nested.

It would be better to make new versions of these blocks (3 becomes 6) than
to duplicate the whole file?

-------------------------------------------------------------
 solt - 24 Apr 03 09:35 CEST 
-------------------------------------------------------------
Sure it would be better since in case of some general modification taht are
to applied to every style element (like latter visual design change) will
involve one element less. IMHO Duplacates are very very naughty :-)

If this implementenion needs a template rewrite I say - we have to do this.

-------------------------------------------------------------
 Tony Lee - 24 Apr 03 09:43 CEST 
-------------------------------------------------------------
Okay, don't want to be very very naughty. I'll do  it.

-------------------------------------------------------------
 Tony Lee - 24 Apr 03 11:43 CEST 
-------------------------------------------------------------
Turns out this was a LOT easier than I thought. I had it stuck in my head
that I HAD to use dynamic blocks...

--------- 
snippet /AegirCore/argv0/browse/browse 902-1006:

        if ($set["index_article"]=="YES") {
        	$jsonload = "";
         $iainfo = "visible";
                $iadescription = "hidden";
        } else {
        	$jsonload = "onload=\"copy_description_raw_to_dhtml()\"";
                $iainfo = "hidden";
                $iadescription = "visible";        	
        }

        $tpl->assign(
            array( 
            //stuff
            //stuff
            //stuff
            "jsonload" => $jsonload,
            "iainfo" => $iainfo,
            "iadescription" => $iadescription  
        )

------------
Comparing: view_topic_edit
To: view_topic_edit_new

275	 <! <body bgcolor="#eeeeee" leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0" link="#ffffff" vlink="#ffffff"
alink="#ffcc00" onload="copy_description_raw_to_dhtml()">
	 !> <body bgcolor="#eeeeee" leftmargin="0" topmargin="0" marginwidth="0"
marginheight="0" link="#ffffff" vlink="#ffffff" alink="#ffcc00"
{jsonload}>
321	 <! <div id="info" style="HEIGHT: 277px; POSITION: absolute;
VISIBILITY: hidden; Z-INDEX: 1">
	 !> <div id="info" style="HEIGHT: 277px; POSITION: absolute; VISIBILITY:
{iainfo}; Z-INDEX: 1">
600	 <! <div id="description" style="POSITION: absolute; VISIBILITY:
visible; Z-INDEX: 5">
	 !> <div id="description" style="POSITION: absolute; VISIBILITY:
{iadescription}; Z-INDEX: 5">
634	 <! <div id="description" style="POSITION: absolute; VISIBILITY:
visible; Z-INDEX: 5">
	 !> <div id="description" style="POSITION: absolute; VISIBILITY:
{iadescription}; Z-INDEX: 5">

-------------------------------------------------------------
 Tony Lee - 24 Apr 03 11:49 CEST 
-------------------------------------------------------------
I think it's okay to leave the description etc. available, we just didn't
want the field to come up first since it would confuse content authors.

One last question. How can I make $set["index_article"]=="YES" by default?
The way I have it now it's not set till the user types in YES. It wuold be
a logical default right?

-------------------------------------------------------------
 solt - 24 Apr 03 11:56 CEST 
-------------------------------------------------------------
Glonk! That seems to be the best way :-)

I think  /Aegir CMS/rcs page would be best:

21: $set[systemhostname] = $HTTP_HOST;
22: $set[stylename]="Aegir_Core_Style";
23: $set[defaultlanguage]="eng";
24: $set[language]=$cs[lang];
25: $set[debuglang] = 0;
26: $set[systemhostprefix] = "/attachment";
27: $set[stagingserver]=8001;
28: $set[techpac]=0;
29: if (!$set[rcsroot]) $set[rcsroot]="/var/cvs";
30: $set["index_article"]=="YES";

-------------------------------------------------------------
 bergie - 24 Apr 03 12:27 CEST 
-------------------------------------------------------------
Index article mode changes behaviour of Aegir CMS quite severely.

We can vote later whether we should go to it by default, but I say we
should require the following conditions to be met:

* Mode is merged to the development server
* Mode is tested
* Sample Site supports it
* There is a migration tool from topic description to index article

-------------------------------------------------------------
 Tony Lee - 24 Apr 03 13:16 CEST 
-------------------------------------------------------------
IMHO the ideal application of index article would change things severely.
It would hide the index articles altogether and map their functions/data to
the parent topic. At least as far as the UI is concerned. This would
require a migration tool, but all these changes do is 1) create the index
article for new topics 2) change the default view for topics. That's it.
Should 100% backward compatible. It just encourages people to take this
path not force them.

Other requirements:
Merging: aegir-cms.org is the development server? If so I can do it.
Sample Site support: My N misplaced posts to nadmin-dev on the 2nd contain
all the details of how the sample site differs from this approach. The
additions to NemienNavBar do most of the work. I can rework the sample site
on aegir-cms.org I've already work out most of the problems on my own site.

-------------------------------------------------------------
 bergie - 24 Apr 03 13:23 CEST 
-------------------------------------------------------------
I say keep index articles separate items in the tree widget, don't confuse
them to the topic content. This makes supporting both index articles on and
off easier, and allows for the possibility of keeping a topic without index
article, which should generate a "directory listing denied" error on the
live site.

Regarding merging:
The changes look reasonable (except for the "renameme" part, should default
to topic name), feel free to add them.
Notify me when this is done so I can do appropriate CVS commits, testing,
etc.

Feel free to also modify the sample site. I can merge the needed changes to
NemeinNavBar.

Another consideration: should we move to using $topic->extra as topic's
title field like MidCOM does?

-------------------------------------------------------------
 Tony Lee - 25 Apr 03 05:01 CEST 
-------------------------------------------------------------
Re: ReNameMe. My thinking on this point was that it's difficult for new
users--I have recent experience--to see where a value comes from when it's
the same in several places. How about using strtoupper() to distinguish the
value?

Re: Extra Info. Gee I don't know. Solt? Rambo? The only reason I could see
would for MidCOM compliance. With the index article approach details are
shown by default, having the name that's used in the URI shown with one
click seems intuitive and logical. Naming the topic with the URI string
seems easy to track too.

On a related topic. It would be good to move the article->title into plain
view too. Right now it's 'hidden' in details. It's an important part of
content. It's used all over the place, including NavBar and content titles.
IMHO ideally it would appear as a field on top of article/edit, perhaps
locked from editing by non-power users. 

Articles could really use an extra field to seperate NavBar etc. names from
page tiles. IMHO.

edited on: 25 Apr 05:01

-------------------------------------------------------------
 Tony Lee - 30 Apr 03 05:28 CEST 
-------------------------------------------------------------
There seems to be a problem with the index article implementation at
aegir-cms.org. Everything works fine except Sample Site > News. I'm
guessing it's because this topic contains source, but I can't see why yet.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@midgard-project.org
For additional commands, e-mail: dev-help@midgard-project.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic