[dokusite] Chapter Object: 1.4.1.2: Form again because a " was missing

"Roger Fischer" <[email protected]>
Newsgroups gmane.comp.cms.bitflux.general.german
Message-ID <[email protected]>
1.4.1.1. Database
1.4.1.2. Form
1.4.1.3. Structure XML
1.4.1.4. XSL Stylesheet


1.4.1.1 Form
============
- Location of the config.xml
- index.php
- config.xml
- Explanations concerning the config.xml

If we want to input some content working with the Poweruser Interface of the
Bitflux CMS, we need the Form Editor.
Unless the Bitflux Editor, which is wysiwyg - the Form Editor is just a HTML
form.

So we now want to create the form for our Chapter Object.
Guess what, it's not a HTML form we create, it's an XML configuration file.

Location of the config.xml
--------------------------
You find all of your config.xml Files, which define the how the form looks
in:
$PROJECT_DIR/www/admin/form

You will find all your objects there as well as Document and Section

Every folder - for example Article - contain 2 files:
- index.php
- config.xml


index.php
---------

In the index.php-file all classes needed for the transformation of the
config.xml into a html-form are included.
This looks as easy as this:

//include all the classes needed
include("$BITLIB_DIR/bitlib/admin/php/form.php");


config.xml
----------

The config.xml looks rather impressing on first sight, but you will quickly
understand it.
For beginners, just take another config.xml file and try to adapt it to your
needs.

NOTE
We created a namespace for the Bitflux Config Files. If you don't know
anything about namespaces, get an intro here:
Plan to use XML namespaces, Part 1,
(http://www-106.ibm.com/developerworks/library/x-nmspace.html)


<?xml version="1.0"?>
<bxco:config xmlns:bxco="http://bitflux.org/config/1.0">
	<bxco:fields table="Chapter">
        <bxco:field name="lang" type="text" descr="Language">de</bxco:field>
        <bxco:field name="title" type="text" descr="Title"/>
	  <bxco:field name="subtitle" type="text" descr="Subtitle"/>
	  <bxco:field name="chapterinfo_keywordset" type="abstract"
descr="Keywordset"/>
	  <bxco:field name="abstract" type="textarea" descr="Abstract"/>
        <bxco:field name="main" type="textarea" descr="Main">
			<![CDATA[
			<section>
				<titel> </titel>
				<para> </para>
			</section>
			]]>
	  </bxco:field>
	  <bxco:field name="Document2Object" type="n2m" alternativeDescr="Document"
descr="Parent::Document" defaultXpath="default/parentid">
          <bxco:n2m thisfield="foreignobjectid"
thatfield="foreigndocumentid" objectfield="objectname"
objectfieldvalue="Chapter"/>
          <bxco:foreign>
            <bxco:table name="Document"
                      field="title "
                	    orderby="title"
                     />
           </bxco:foreign>
         </bxco:field>

          <bxco:field name="created" alternativeDescr="CREATED"
descr="Created" type="fixed" subtype="datetime">
            <bxco:onnew default="sql:now()" />
          </bxco:field>

          <bxco:field name="createdby" alternativeDescr="CREATEDBY"
descr="Created by" type="fixed" >
            <bxco:onnew defaultXpath="auth/username" />
          </bxco:field>

          <bxco:field name="changed" alternativeDescr="CHANGED"
descr="Changed" type="fixed" subtype="datetime">
            <bxco:onnew default="sql:now()" />
            <bxco:onchange default="sql:now()" />
          </bxco:field>

          <bxco:field name="changedby" alternativeDescr="CHANGEDBY"
descr="Changed by" type="fixed">
            <bxco:onnew defaultXpath="auth/username" />
            <bxco:onchange defaultXpath="auth/username" />
          </bxco:field>
        </bxco:fields>

        <bxco:chooser field="concat(title,' (',lang,')')" orderby="title"
descr="Choose Chapter"/>

        <bxco:create>
          <bxco:table name="Document2Object" hide="yes">
            <bxco:field name="foreigndocumentid"
value="this:Document2Object:Value" notempty="1"/>
			<bxco:field name="objectname" value="Chapter"/>
            <bxco:field name="foreignobjectid" value="this:ID"
notempty="1"/>
          </bxco:table>
        </bxco:create>

</bxco:config>

Explanations concerning the config.xml
--------------------------------------

The config.xml file starts with the XML declaration like any XML file. The
first element bxco:config or rather config in the namespace
http://bitflux.org/config/1.0 declares the namespace and the prefix "bxco".

The next element is <bxco:fields table="Chapter">, which is the parent
element of all database fields you want to have in your form. That means
that you don't have to have all database fields in your form, if you don't
want to have them.

Your Database Table has fields, which are equivalent to: <bxco:field>.

Let's take the example title
<bxco:field name="title" type="text" descr="Title"/>

The attribute name has the value "title" which corresponds to your Database
field "title".
The attribute type has the value "text" which gives you the equivalent of
the form tag <input type="text">
The attribute descr has the value "Text". This will show the description
"Text" just before the <input type="text">


*Other values for the attribute type*

abstract for a larger text input field, mostly used for short texts
textarea for a even larger text input field
...




--
roger fischer | bitflux GmbH | schöneggstrasse 5 | ch-8004 zürich
tel +41 1 240 56 72 | mobil +41 78 607 75 06 | fax +41 1 240 56 71
http://www.bitflux.ch | [email protected]

OSCOM - Open Source Content Management
http://www.oscom.org
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.