Maarch Framework 3/Developer handbook/Baskets

De Maarch Wiki.

Aller à : Navigation, rechercher
Warning.gif Cette section du wiki est en cours de restructuration et de rédaction. Nous nous excusons pour la gêne occasionnée.
This section of the wiki is under heavy restructuring and writing. We're sorry for the inconvenience.

Sommaire

Summary

Installation

Quick Install

The tables for this module are defined in the file basket/sql/structure/ directory depending on your databasetype, and the mimimal data in the basket/sql/data/ directory. For the moment, we provide only mysql and postgresql scripts, but it is not difficult to build script for other database with existing scripts.

To load the module just add these lines in the apps config.xml file in the MODULES section :

<MODULES>
  <moduleid>basket</moduleid>
  <comment>_BASKETS</comment>
</MODULES>

Make sure the service is active (the <loaded> tag is set to true in basket/xml/config.xml).

Setting

config.xml file

<?xml version="1.0" encoding="utf-8"?>
<root>
	<CONFIG>
		<name>basket</name> <!-- module name : MUST BE THE DIRECTORY NAME OF THE MODULE -->
		<comment>_BASKET</comment> <!-- Label of the module, defined in the basket language file -->
		<file_prefix>bask</file_prefix>
		<loaded>true</loaded> <!-- must be true otherwise the services will not work -->
	</CONFIG>
	<TABLENAME> <!-- Module specific tables -->
		<bask_baskets>baskets</bask_baskets>
		<bask_groupbasket>groupbasket</bask_groupbasket>
		<bask_actions_groupbaskets>actions_groupbaskets</bask_actions_groupbaskets>
		<bask_entity>entities</bask_entity>
		<bask_listmodels>listmodels</bask_listmodels>
		<bask_listinstance>listinstance</bask_listinstance>
		<bask_users_abs>user_abs</bask_users_abs>
	</TABLENAME>
	<HISTORY> <!-- What will be traced in the module -->
		<basketadd>true</basketadd> <!-- Adding a new basket in the apps -->
		<basketup>true</basketup> <!-- Modifying a basket in the apps -->
		<basketdel>true</basketdel> <!-- Deleting a basket in the apps -->
		<entityadd>true</entityadd> <!-- Adding a new entity in the apps -->
		<entityup>true</entityup> <!-- Modifying an entity in the apps -->
		<entitydel>true</entitydel> <!-- Deleting an entity in the apps -->
		<userabs>true</userabs> <!-- User absences -->
	</HISTORY>
</root>

The <HISTORY> tag contains the list of all actions that can be saved in the application history. To disabled this, just set the action tag to false.

All the other setting can be done through the administration menu in the application.

basketpage.xml

<?xml version="1.0" encoding="utf-8"?>
<ROOT>
        <BASKETPAGE> <!-- Basket result page tag -->
		<ID>invoices_list</ID> <!-- Result page identifier -->
		<LABEL>_INVOICE_LIST_TO_VAL</LABEL> <!-- Result page label -->
    	        <NAME>invoices_list</NAME> <!-- Result page name -->
                <ORIGIN>module</ORIGIN> <!-- apps or module -->
		<MODULE>basket</MODULE> <!-- Module name if the page is in a module -->
        </BASKETPAGE>
	<BASKETPAGE>
		<ID>doc_list</ID>
		<LABEL>_POSTINDEXING_LIST</LABEL>
		<NAME>doc_list</NAME>
		<ORIGIN>module</ORIGIN> <!-- apps or module --> 
		<MODULE>basket</MODULE> 
    </BASKETPAGE>
</ROOT>

This file contains the baskets results pages, the scripts used as results when calling a basket. The list of results pages displayed in the basket administration corresponds to all the <BASKETPAGE> tag in this file.

The labels are defined in the module languages files.

Provided Services

All the localization constants used in service.xml are defined in the basket languages files.

All the css styles defined in the <style> tag are defined in css files of the basket/css directory.

By default, some service are defined as system services, it means that these services will be activated for all users. You can easily modify it by setting the <system_service> tag to false.

To deactivate a service, simply set the enabled tag to false.


Service Type System Service Description
#admin_baskets admin no Baskets administration
#admin_entities admin no Entities administration
#view_baskets use yes Menu item
#view_diff_list use yes View diffusion list

admin_baskets

This service gives access to the baskets administration.

<SERVICE>
   <id>admin_baskets</id> <!-- service identifier -->
   <name>_ADMIN_BASKETS</name> <!-- service label -->
   <comment>_ADMIN_BASKETS_DESC</comment> <!-- service description -->
   <servicepage>index.php?page=basket&amp;module=basket</servicepage> <!-- service page -->
   <servicetype>admin</servicetype> <!-- service type -->
    <system_service>false</system_service>
   <style>bask_admin_baskets</style> 
   <enabled>true</enabled>
   <WHEREAMIUSED>
     <page>admin.php</page>
     <nature>listelement</nature>
   </WHEREAMIUSED>
 </SERVICE>

This service is an admin service. This is not a system service by default.

admin_entities

This service gives access to the entities administration.

<SERVICE>
   <id>admin_entities</id>
   <name>_ADMIN_ENTITIES</name>
   <comment>_ADMIN_ENTITIES_DESC</comment>
   <servicepage>index.php?page=entity&amp;module=basket</servicepage>
   <servicetype>admin</servicetype>
    <system_service>false</system_service>
   <style>bask_admin_entities</style>
   <enabled>false</enabled>
   <WHEREAMIUSED>
     <page>admin.php</page>
     <nature>listelement</nature>
   </WHEREAMIUSED>
 </SERVICE>

This service is an admin service. This is not a system service by default.

view_baskets

This service gives access to the baskets of the current user.

 <SERVICE>
   <id>view_baskets</id> <!-- if servicetype = menu, this id must be equal to the id of the menu item -->
   <name>_VIEW_BASKETS</name>
   <comment>_VIEW_BASKETS_DESC</comment>
   <servicetype>menu</servicetype>
    <system_service>true</system_service>
   <enabled>true</enabled>
 </SERVICE>

This is a system service by default.

view_diff_list

This service allows to view the diffusion list of a document.

<SERVICE>
   <id>view_diff_list</id>
   <name>_VIEW_DIFF_LIST</name>
   <servicepage>view_diff_list.php</servicepage>
   <servicetype>use</servicetype>
   <system_service>true</system_service>
   <enabled>false</enabled>
   <WHEREAMIUSED>
     <page>details_documents.php</page>
     <nature>include</nature>
   </WHEREAMIUSED>
   <WHEREAMIUSED>
     <page>details_invoices.php</page>
     <nature>include</nature>
   </WHEREAMIUSED>
 </SERVICE>

This service displays the diffusion list in the details pages. This is a system service by default.

Customisation

Language