Documentation

Below you will find documentation on how to use our software. This contains easy-to-use steps by step guides with helpful screenshots on how to configure and get the best results.
 

Categories

Chapter 5: Versioning [Step 1: Update XML with versioning section]

The first step is to add a versioning section to our XML manifest file at the bottom in the arkeditor section.

To explain this further, let us look at a live example by looking at what we did for our MyCCK extension.

<versioning>
	<versions>
		<version>
			<dbtable>#__mycck_items</dbtable>
			<type>item</type>
			<prefix>MyCCKTable</prefix>	
			<formFile>administrator/components/com_flexicontent/models/forms/item.xml</formFile>
			<fields>
				<field>id</field>
				<field>title</field>
				<field>introtext</field>
				<field>fulltext</field>
			</fields>
		</version>
		<version type="textarea">
			<dbtable>#__mycck_fields</dbtable>
			<type>fields</type>
			<prefix>MyCCKTable</prefix>	
			<formFile>administrator/components/com_flexicontent/models/forms/field.xml</formFile>
			<fields>
				<field>id</field>
				<field>name</field>
				<field>description</field>
			</fields>
		</version>
	</versions>
	<catdbtable>#__mycck_categories</catdbtable>
	<cattype>category</cattype>
	<catprefix>MyCKKTable</catprefix>	
	<catformFile>administrator/components/com_flexicontent/models/forms/category.xml</catformFile>
	<catfields>
		<field>id</field>
		<field>title</field>
		<field>description</field>
	</catfields>
</versioning>

Our component uses three tables to store data for our component:

We have an item table, a category table and a fields table for extra fields we may want for our article.

In the above XML segment, we add the structural details of the tables to explain to Joomla how to deal with storing and retrieving information from its history table for our components table.

In our example, you can see in the XML the versions section is used to store the structural information of our item table, where each version element is used to represent each table we want versioned.

The category table, as you can see in this example is stored outside of the versions element because there will only be one category table.

Okay, now let’s go through the required information we need to store for each table that we want versioned by Joomla:

XML Element

Requirement

Description

Dbtable

Mandatory

The name of the database table to be versioned by Joomla.

Type

Mandatory

The file name of your JTable file.

Prefix

Mandatory

Prefix used for your Jtable class.

Please note: that this element value can be left empty, but it must be present.

formFile

Optional

Used to label the fields used by Joomla from the fields you specified in the fields element.

This element and can be omitted as is not mandatory and is only used for cosmetic purposes.

Fields

Mandatory

This element will contain a list of field elements where each one contains the name of the database table field name you want Joomla to display in the version manager preview screen. Please see image below

 

The details above will be enclosed in a version tag for each table you want to add versioning for your component. The version tag has an optional attribute called type. If you supply a value for this attribute, the system will use that to generate a unique name for the alias for your content type: <component name>.<JTable type>.<type attribute name> .

Please note: You need to supply the type attribute to be used for the type alias for every additional table you want to be versioned. The value of the type attribute must be the same as an actual type you are using in your component, i.e. the type attribute values must be one defined in the types section of the XML manifest.

The entry without any type attribute, usually the first one, will be considered to be the main item table for your component and your component’s context will be used for creating the content type alias e.g. this will be ‘mycck’ for our component.

Joomla Version Manager preview screen

Similar if you have a category table that you want versioning as well, you will add the following details after the versions element in the versioning tag:

 

 

XML Element

Requirement

Description

catdbtable

Optional

The name of the database table to be versioned by Joomla

cattype

Mandatory only if catdbtable element is present

The file name of your JTable file.

catprefix

Mandatory only if catdtype element is present

Prefix used for your Jtable class.

Please note that this element value can be left empty, but it must be present.

catformFile

Optional

Used to label the fields used by Joomla from the fields you specified in the fields element.

This element and can be omitted as is not mandatory and  is only used for cosmetic purposes.

catfields

Mandatory only if catprefix element is present

This element will contain a list of field elements where each one contains the name of the database table field name you want Joomla to display in the version manager preview screen. Please see image below

 

So putting this all together and looking at our example for the MyCCK component, your XML manifest file should look something like the following:

<?xml version="1.0" encoding="utf-8"?>
<extension version="3.2" type="file" method="upgrade">
	<name>files_inlinezoo</name>
	<author>WebxSolution Ltd</author>
	<creationDate>March 2015</creationDate>
	<copyright>>Copyright (C) 2015 All rights reserved</copyright>
	<license>GNU General Public License version 2</license>
	<authorEmail>This email address is being protected from spambots. You need JavaScript enabled to view it.</authorEmail>
	<authorUrl>http://www.arkextensions.com</authorUrl>
	<version>1.0</version>
	<description>This plugin provides an extension for ARK inline editing to add support for ZOO CCK</description>
	
	
	<!-- set up data for  inline lookup table     //-->

	<arkeditor>	
		<extensionName>com_zoo</extensionName>
		<!-- allowable views for inline editing //-->
		<views>
			<view>item</view>
			<view>category</view>
		</views>
		
		<!-- add context element if context is different to extension Name //-->
	
		<!-- extension types to be used for inline editing //-->
		<types>
			<type>category</type>
			<type>item</type>
			<type>blog</type>
		</types>
		
		<!-- details for Joomla versioning system //-->
		
		<versioning>
			<versions>
				<version>
					<dbtable>#__items</dbtable>
					<type>item</type>
					<prefix>MyCCKTable</prefix>	
					<formFile>administrator/components/com_flexicontent/models/forms/item.xml</formFile>
					<fields>
						<field>id</field>
						<field>title</field>
						<field>introtext</field>
						<field>fulltext</field>
					</fields>
				</version>
				<version type="textarea">
					<dbtable>#__fields</dbtable>
					<type>fields</type>
					<prefix>MyCCKTable</prefix>	
					<formFile>administrator/components/com_flexicontent/models/forms/field.xml</formFile>
					<fields>
						<field>id</field>
						<field>name</field>
						<field>description</field>
					</fields>
				</version>
			</versions>
			<catdbtable>#__categories</catdbtable>
			<cattype>category</cattype>
			<catprefix>MyCKKTable</catprefix>	
			<catformFile>administrator/components/com_flexicontent/models/forms/category.xml</catformFile>
			<catfields>
				<field>id</field>
				<field>title</field>
				<field>description</field>
			</catfields>
		</versioning>
		
	</arkeditor>
	
	<fileset>
		
		<!-- location for MyCCK main inline editing extension type file //--> 
	
		<files folder="extensions" target="plugins/content/arkcontent/extensions">
			<file>mycck.php</file>
		</files>
	
		<!-- location for context types for MyCCK  inline editing extension //-->
	
		<files folder="contexts/mycck" target="plugins/ajax/inlinecontent/contexts/mycck">
			<file>category.php</file>
			<file>item.php</file>
			<file>blog.php</file>
		</files>
		
	</fileset>
	
</extension>

That is for part 1, now let us go onto part 2.

WebxSolution Ltd is not affiliated with or endorsed by the Joomla! Project or Open Source Matters. The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.

Copyright © 2009 - 2016 WebxSolution Ltd
Powered by JoomlaWired

 

Cron Job Starts