<?xml version="1.0"?>
<record><wiki id="wiki?page_id=110">
	<page_name>Contribute_to_Xataface_Translation_Project</page_name>
	<page_id>110</page_id>
	<page_title>How to Contribute Translations</page_title>
	<content>[[toc]]

==Synopsis==

Xataface stores its translations in INI files in its lang directory, one for each language.  You can develop your own translation by first copying the en.ini file to xx.ini (where xx is the ISO language code for the language you are translating for), then modifying the translations into your target language. &apos;&apos;&apos;NOTE: THIS IS NOT THE PREFERRED WAY TO CONTRIBUTE TRANSLATIONS.  PLEASE SEE &quot;Adding Translations Using Google Spreadsheets&quot; BELOW&apos;&apos;&apos;.

==Anatomy of a Language .INI file==

The language .INI files (e.g. en.ini, es.ini, etc...) consist of key-value pairs, where the key is a unique identifier for a string in Xataface, and the value is the translation.  All language files should contain the same keys, however if you omit a key from your translation, Xataface will just fall back to the default value that is defined in the PHP source code.

===Example Snippet from en.ini file===

&lt;code&gt;
scripts.GLOBAL.FORMS.OPTION_PLEASE_SELECT = &quot;Please Select ...&quot;
save_button_label = &quot;Save&quot;
scripts.GLOBAL.MESSAGE.PERMISSION_DENIED = &quot;Permission Denied&quot;
scripts.GLOBAL.NO_RECORDS_MATCHED_REQUEST = &quot;No records matched your request.&quot;
&lt;/code&gt;

In this small segment you can see 4 strings that are translated.  The values on the left of the equals sign are the keys.  Their corresponding values are on the right of the equals signs.  A corresponding segment of the fr.ini (French) language file looks like:

&lt;code&gt;
scripts.GLOBAL.FORMS.OPTION_PLEASE_SELECT = &quot;SVP sélectionnez ...&quot;
save_button_label = &quot;Enregistrer&quot;
scripts.GLOBAL.MESSAGE.PERMISSION_DENIED = &quot;Permission Refusée&quot;
scripts.GLOBAL.NO_RECORDS_MATCHED_REQUEST = &quot;Aucun résultat ne correspond à votre requête.&quot;
&lt;/code&gt;

You can see that the keys (the values on the left) are identical to those in the en.ini snippet.  Only the values are changed (translated) into French.

&apos;&apos;&apos;NOTE: IT IS BETTER TO USE GOOGLE SPREADSHEETS TO EDIT TRANSLATIONS, THAN TO WORK WITH INI FILES DIRECTLY. PLEASE SEE &quot;Adding Translations Using Google Spreadsheets&quot; BELOW&apos;&apos;&apos;


==Gotchas: Things to watch out for==

When editing or adding translations in INI files, you need to be aware of a few gotchas related to how INI files work.  If you mess up a line by forgetting to add a quote, you could cause a parse error which would cause Xataface to ignore the language file altogether.  The following are a few common pitfalls:

===Use UTF-8 Encoding===

All ini files should use UTF-8 encoding, so make sure you are using a text editor that supports UTF-8 if you want to edit INI files.  (But it is better to just use Google Spreadsheets for the editing if possible, in which case you don&apos;t have to worry about this).

===Wrap Translations in Double Quotes===

All translations should be wrapped in double quotes.  E.g.
&lt;code&gt;
mykey=&quot;My Value&quot;
&lt;/code&gt;

If you forget to close a quote, it will likely cause a parse error and Xataface will fail to load the file.  E.g.
&lt;code&gt;
mykey=&quot;My Value
&lt;/code&gt;
would be a problem.


===Can&apos;t Use Double Quotes as Part of the Translation===

Since INI files use double quotes to wrap strings, you can&apos;t use a double quote inside your translation.  E.g. you can&apos;t do this:
&lt;code&gt;
mylink=&quot;&lt;a href=&quot;http://google.com&quot;&gt;Google&lt;/a&gt;&quot;
&lt;/code&gt;
because of the inline double quotes.

One way around this is to try to use single quotes where possible.  E.g.
&lt;code&gt;
mylink=&quot;&lt;a href=&apos;http://google.com&apos;&gt;Google&lt;/a&gt;&quot;
&lt;/code&gt;

Another way around this is to the &apos;&apos;&quot;_Q&quot;&apos;&apos; key sequence, which Xataface will
automatically convert to a double quote for you at runtime.  E.g. You could do:
&lt;code&gt;
mylink=&quot;&lt;a href=&quot;_Q&quot;http://google.com&quot;_Q&quot;&gt;Google&lt;/a&gt;&quot;
&lt;/code&gt;

&apos;&apos;&apos;NOTE: If you use Google Spreadsheets to edit your translations, you won&apos;t have this problem.  You can use double quotes inside your translations.  The [[csv2ini]] tool will automatically convert these to an appropriate form when the spreadsheet is converted to the INI files.&apos;&apos;&apos;


===Leave Variables Alone===

Some translated strings include variables that are meant to be replaced by Xataface at runtime.  These should be left intact across translations.  You can identify a variable by their resemblance to PHP variables (prefixed with a $).

E.g. In the en.ini file, the translation:
&lt;code&gt;
No action found = &quot;No action found named &apos;$name&apos;&quot;
&lt;/code&gt;
has the variable &apos;&apos;$name&apos;&apos;.

So the French translation should maintain this variable.  E.g. in the fr.ini file:
&lt;code&gt;
No action found = &quot;Aucune action nommée &apos;$name&apos;&quot;
&lt;/code&gt;


==Adding Translations Using Google Spreadsheets==

In order to help keep translations more up to date, we have developed a set of tools to enable us to use Google Spreadsheets to edit and add translations, and convert these spreadsheets on demand into an appropriate set of language INI files.

The spreadsheet containing the Xataface translations is public to view and is located  [https://spreadsheets.google.com/ccc?key=0AqJNZUI7flxSdFVLWDlnVVpQZ3dMaGZhVjVHN2c3bEE&amp;hl=en here].  If you would like to add your own translations or modify existing translations, please contact [mailto:steve@weblite.ca Steve Hannah] so that you can be given editor permission.  You will first need a google docs account, then we can give you permission to edit the spreadsheet.

This centralized spreadsheet is converted to INI files and merged into SVN before every release.  You can also export this spreadsheet as a CSV and convert it to Xataface&apos;s language INI files yourself using the [[csv2ini]] tool that is located in the tools directory of the Xataface distribution.


===Gotchas with Google Spreadsheets===

Editing translations with Google Spreadsheets is much safer than editing the INI files directly.  You don&apos;t have to worry about encoding issues, and you don&apos;t have to dance around double quotes like you do with INI files.  There is only one known thing to watch out for:

====Starting a translation with a Single Quote====

If you start a translation with a single quote, Google Spreadsheets will interpret this as a directive to indicate that the contents of that cell should be considered a string (and not a number for example).  E.g. If you enter the following into a Google Spreadsheets cell:
&lt;code&gt;
&apos;Help!&apos;, I exclaimed
&lt;/code&gt;
If you unfocus from that cell it will only say:
&lt;code&gt;
Help!&apos;, I exclaimed
&lt;/code&gt;
If you go back into edit mode of the cell again, you&apos;ll see your opening single quote again... and when you tab out, it will disappear again.  

You can work around this issue by just using two single-quotes for the first quote.  E.g.:
&lt;code&gt;
&apos;&apos;Help!&apos;, I exclaimed
&lt;/code&gt;

This way Google will interpret the first quote as a directive, and it will use the second one as an actual single quote.


====Converting the Google Translation Spreadsheet into INI Files====

So you&apos;ve contributed a number of translations to the [https://spreadsheets.google.com/ccc?key=0AqJNZUI7flxSdFVLWDlnVVpQZ3dMaGZhVjVHN2c3bEE&amp;hl=en Xataface Translations Google Spreadsheet], and you want to be able to use them in your installation of Xataface before the next release.  Just follow the steps below:

# Download the spreadsheet as a CSV file, using the &apos;&apos;File&apos;&apos; &gt; &apos;&apos;Download as&apos;&apos; &gt; &apos;&apos;CSV (Current Sheet)&apos;&apos; menu item in Google Spreadsheets.
# Run the [[csv2ini]] PHP script located in the xataface/tools directory to convert the xataface-translations.csv file that you downloaded from Google Spreadsheets in the previous step into INI files.  The conversion command looks like:
&lt;code&gt;
$ php /path/to/xataface/tools/csv2ini.php /path/to/xataface-translations.csv /path/to/destination/dir/
&lt;/code&gt;

This will convert the xataface-translations.csv file into a set of language INI files and place them the specified destination directory  (don&apos;t forget the trailing slash) on /destination/dir so that the script knows its a directory.  You can then copy these INI files into your xataface/lang directory to make them live.

&apos;&apos;&apos;Note: the [[csv2ini]] script has only been used in a unix/os x type environment.  Some small modifications would probably be necessary to make them work on Windows.&apos;&apos;&apos;




</content>
	<keywords>Translations, Google Spreadsheets, en.ini, fr.ini</keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<wiki id="wiki?page_id=112">
	<page_name>Module_Developers_Guide</page_name>
	<page_id>112</page_id>
	<page_title>Module Developers Guide</page_title>
	<content>[[toc]]

==Why Write a Xataface Module?==

Xataface modules are components that can be used to extend Xataface&apos;s functionality in a generic way so that it can be used on multiple applications.  If you find yourself trying to add the same functionality in multiple applications, you might consider writing a Xataface module so that you can share the functionality more easily.

==What can you do with a Xataface Module==

* Create custom authentication handlers.
* Provide custom actions and templates.
* Implement blocks and slots for existing templates.
* Respond to certain application triggers.


==Where do I place a Xataface Module?==

Xataface modules can be placed in the xataface/modules directory (i.e. DATAFACE_PATH/modules).  As of Xataface 1.3 they can also be placed directly in your application&apos;s modules directory (i.e. DATAFACE_SITE_PATH/modules).

==Your first module==

For our first module, we&apos;re going to create a simple module that adds &quot;hello world&quot; at the beginning of every page.

===Step 1: Create the Module Class===

In your modules directory, create a directory called &quot;Hello&quot;.  And in this directory, create a file named &quot;Hello.php&quot;, with the following contents:
&lt;code&gt;
&lt;?php
class modules_Hello  {
}
&lt;/code&gt;
(So this file would be located at DATAFACE_PATH/modules/Hello/Hello.php)

===Step 2: Implement the block__before_body method===

We are going to add the phrase &quot;hello world&quot; before every page of our application.  The easy way to do this is to fill the [[before_body]] slot of the [[Dataface_Main_Template.html]] template.  We do this by implementing the &apos;&apos;block__before_body&apos;&apos; method in your module (just as we would if we were trying to fill this slot from the [[Application Delegate Class]].

&lt;code&gt;
&lt;?php
class modules_Hello  {
    function block__before_body(){
        echo &quot;hello world&quot;;
        return true;
    }
}
&lt;/code&gt;

===Step 3: Activate the Module===

Xataface only loads the modules that have been enabled in the conf.ini.  We can enable our module by adding the following section to the [[conf.ini file]]:

&lt;code&gt;
[_modules]
modules_Hello=modules/Hello.php
&lt;/code&gt;

All this does is tell Xataface that the module class modules_Hello can be loaded from the location modules/Hello.php.

Now if you start up your application, you should see the phrase &quot;hello world&quot; written at the top of each page.


==Example 2: Adding a Custom Action==

Our first module shows an example of filling blocks and slots using a module.  Let&apos;s now extends that to include a custom action that displays Hello World on its own page.

Complete the following steps:

# Add an &apos;&apos;actions&apos;&apos; directory inside our new module directory.  i.e. modules/Hello/actions
# Add a file named hello.php inside the &apos;&apos;actions&apos;&apos; directory with the following contents:&lt;code&gt;
&lt;?php
class actions_hello {
    function handle($params){
        echo &quot;Hello World&quot;;
    }
}
&lt;/code&gt;
# Go to index.php?-action=hello To see the results of your action.  It should say &quot;Hello World&quot; on a blank page.

From here on you can improve this action just as you would if you defined the action inside the application&apos;s actions directory.  You can go on to restrict access to this action using permissions, or you could decide to use a template to display the action.

===Defining a Custom &quot;hello&quot; permission for our action===

Perhaps we want to create a special permission for our action so that regular users won&apos;t have access to this action unless they are specifically granted this permission.  Let&apos;s create a &quot;hello&quot; permission with which to limit access to our action.

# Create a file named &quot;permissions.ini&quot; inside your modules/Hello directory with the following contents:&lt;code&gt;
hello = Permission to access the hello action
&lt;/code&gt;

Now if you try to access your action (and you haven&apos;t been assigned ALL() permissions) you should receive either a login prompt or a permission denied message.

If you want users to be able to access your action, you will need to explicitly add this permission to one of the user&apos;s assigned roles or return it as part of the list of authorized permissions in the getPermissions() method.

===Granting the &quot;hello&quot; permission to the &quot;READ ONLY&quot; role===

If we want the default READ ONLY role to have access to the &quot;hello&quot; permission we can actually modify the READ ONLY role inside the [[permissions.ini file]] that we created inside the Hello module:

&lt;code&gt;
hello = Permission to access hello action

[READ ONLY extends READ ONLY]
    hello=1
&lt;/code&gt;


==Example 3: Using Module Templates==

Xataface, by default, stores its templates in the DATAFACE_SITE_PATH/templates and DATAFACE_PATH/templates directories.  However if you are writing a module you probably want to keep templates that are used by the module inside the module directory so that you don&apos;t break dependencies when you use the module in different applications.

You can use the [http://dataface.weblite.ca/df_register_skin df_register_skin] method to register additional directories for Xataface to look for templates in.  This will allow you to add a &apos;&apos;templates&apos;&apos; directory inside your module directory for use by your module&apos;s templates.

It is probably best to register this directory on demand (i.e. as part of individual actions) rather than register it globally.  

===Using a Template from the hello action===

Let&apos;s modify our hello action to use a template that we are going to store and distribute with our module.

# Create a directory named &quot;templates&quot; in the modules/Hello directory.
# Create a file named &quot;hello.html&quot; inside the templates directory with the following contents:&lt;code&gt;
{use_macro file=&quot;Dataface_Main_Template.html&quot;}
    {fill_slot name=&quot;main_section&quot;}
    	Hello World
    {/fill_slot}
{/use_macro}
&lt;/code&gt;  Notice that we are extending the Dataface_Main_Template.html template (which is located in the main Xataface install) so that our hello action can now take on the look and feel of the rest of the application.
# Modify the modules/Hello/actions/hello.php file to look like this:&lt;code&gt;&lt;?php
class actions_hello {
    function handle($params){
        df_register_skin(&apos;hello theme&apos;, dirname(__FILE__).&apos;../templates&apos;);
        df_display(array(), &apos;hello.html&apos;);
    }
}
&lt;/code&gt;  Notice that we call the df_register_skin function to register the templates directory that we created in the previous step.  Then we call df_display() to display the template.



==See Also===

* [[modules]] - A list of existing Xataface modules that you can download and install.
* [[block__blockname]] - A list of some of the available blocks that can be filled in the default Xataface templates.
* [http://xataface.com/documentation/tutorial/customizing-the-dataface-look-and-feel Customizing Xataface&apos;s Look and Feel with Templates] - A tutorial on how to use Xataface&apos;s built-in smarty template engine.  It has some sections on using delegate classes to override blocks and slots.
* [http://xataface.com/documentation/tutorial/getting_started/changing-look-and-feel Changing Xataface&apos;s Look and Feel] - Part of the Getting Started tutorial that shows how to use slots and blocks to customize the Xataface look and feel.</content>
	<keywords>modules</keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<wiki id="wiki?page_id=104">
	<page_name>field__pullValue</page_name>
	<page_id>104</page_id>
	<page_title>field__pullValue delegate class method</page_title>
	<content>[[toc]]

The field__pullValue() delegate class method can be used to transform database from the database for use in an edit/new record form.  Sometimes it is the case that we want users to be able to work with data differently than it is stored in the database.

This method should always be accompanied by a corresponding [[field__pushValue]] method which performs the inverse operation and is used to transform the value in an edit form into a format that can be stored in the database.

===Example===

Given a field &apos;&apos;start_ip&apos;&apos; that stores an IP address in the database as an unsigned INT, we want to be able to work with the data on the edit form in a friendlier format - the standard IP address dot notation, so we define pullValue and pushValue methods for the field in the table&apos;s delegate class.

&lt;code&gt;
class tables_ip_blocks {

	/**
	 * @param Dataface_Record $record The record we are pushing the value
	 *		into
	 * @param HTML_QuickForm_element $el The QuickForm widget that we are 
	 *      retrieving the value from.
	 */
	function start_ip__pushValue($record, $el){
		$val = ip2long($el-&gt;getValue());
		if ( $val !== false ){
			return sprintf(&apos;%u&apos;, $val );
		}
		return null;
	}
	
	function start_ip__pullValue($record, $el){
		$val = $record-&gt;val(&apos;start_ip&apos;);
		if ( $val )
			return long2ip($val);
		return $val;
	}
}
&lt;/code&gt;

==References==

* [[Delegate class methods]]
* [[Application Delegate Class]]
* [[http://dataface.weblite.ca/Dataface_Record Dataface_Record API docs]
* [http://xataface.com/documentation/how-to/how-to-define-custom-serialization-for-fields How to define custom serialization for fields] - A how-to document.
</content>
	<keywords>pushValue, pullValue</keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<wiki id="wiki?page_id=105">
	<page_name>field__pushValue</page_name>
	<page_id>105</page_id>
	<page_title></page_title>
	<content>[[toc]]

The field__pushValue() delegate class method can be used to transform a field value as entered in the edit form into a format that can be stored in the database..  Sometimes it is the case that we want users to be able to work with data differently than it is stored in the database.

This method should always be accompanied by a corresponding [[field__pullValue]] method which performs the inverse operation and is used to transform the value in the database into a format that can be edited in the edit form.

===Example===

Given a field &apos;&apos;start_ip&apos;&apos; that stores an IP address in the database as an unsigned INT, we want to be able to work with the data on the edit form in a friendlier format - the standard IP address dot notation, so we define pullValue and pushValue methods for the field in the table&apos;s delegate class.

&lt;code&gt;
class tables_ip_blocks {

	/**
	 * @param Dataface_Record $record The record we are pushing the value
	 *		into
	 * @param HTML_QuickForm_element $el The QuickForm widget that we are 
	 *      retrieving the value from.
	 */
	function start_ip__pushValue($record, $el){
		$val = ip2long($el-&gt;getValue());
		if ( $val !== false ){
			return sprintf(&apos;%u&apos;, $val );
		}
		return null;
	}
	
	function start_ip__pullValue($record, $el){
		$val = $record-&gt;val(&apos;start_ip&apos;);
		if ( $val )
			return long2ip($val);
		return $val;
	}
}
&lt;/code&gt;

==References==

* [[Delegate class methods]]
* [[Application Delegate Class]]
* [[http://dataface.weblite.ca/Dataface_Record Dataface_Record API docs]
* [http://xataface.com/documentation/how-to/how-to-define-custom-serialization-for-fields How to define custom serialization for fields] - A how-to document.
</content>
	<keywords>pullValue, pushValue</keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<wiki id="wiki?page_id=184">
	<page_name>loginFailed</page_name>
	<page_id>184</page_id>
	<page_title>loginFailed() Application Delegate Trigger</page_title>
	<content>[[toc]]

The loginFailed() method of the Application Delegate class is executed after a failed login attempt.

&apos;&apos;&apos;Available since 2.0.1&apos;&apos;&apos;

==Example==

&lt;code&gt;
function loginFailed($username, $userIp, $time){
    error_log(&quot;Failed login for username: $username at IP $userIp at time $time&quot;);
}
&lt;/code&gt;
</content>
	<keywords>login permissions failed password</keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<wiki id="wiki?page_id=113">
	<page_name>XataJax</page_name>
	<page_id>113</page_id>
	<page_title>Introduction to XataJax</page_title>
	<content>[[toc]]

Xataface 1.3 comes with a new module [[XataJax]] which comes installed standard.  [[XataJax]] serves as a foundation for Javascript/AJAX powered Xataface applications and will hopefully usher in a new fresh generation of Xataface powered applications.

===Features===

Xataface provides pieces of infrastructure:

# [[XataJax Compiler|A Javascript/CSS Compiler &amp; Linker]]
# A Javascript component library &amp; API

====The Javascript/CSS Compiler &amp; Linker====

Web 2.0 and HTML 5 is a great platform for application development, but it presents a challenge when it comes to developing large-scale, robust applications.  It can be difficult to manage applications that consist of dozens or even hundrends of javascript libraries, some of which depend on each other.

The XataJax compiler provides a solution to this problem by providing a just-in-time compilation of all of the javascripts that are necessary to service a particular request.  It doesn&apos;t actually compile your Javascript into machine code, it just aggregates and minifies all of the javascript code together into a single file at runtime so that you don&apos;t have to worry about figuring out exactly which libraries you need to import in each template.

This has 2 key benefits:

1. Load time.  By having all of the scripts grouped into a single file, it is much quicker for the client to load the your scripts.

2. Code organization.  Since the compiler will automatically resolve the script dependencies, you can keep your code nicely organized, which produces a far more maintainable source code base.


====The Javascript Component Library &amp; API====

The 2nd part of the XataJax module is a new API that will help you develop rich Web 2.0 applications that interact with your database.  The will allow you to build forms more dyanmically with Javascript, or load, update, and delete records directly using a javascript API.  

The goal is to eventually expose all important Xataface functionality via the XataJax API.

Additional modules may build on top of this API to produce alternative dynamic interfaces for Xataface using existing web UI component libraries like JQueryUI or Sencha.</content>
	<keywords>XataJax, Ajax, Web 2.0</keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<wiki id="wiki?page_id=55">
	<page_name>blob</page_name>
	<page_id>55</page_id>
	<page_title>blob</page_title>
	<content></content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=56">
	<page_name>struct</page_name>
	<page_id>56</page_id>
	<page_title>struct</page_title>
	<content></content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=60">
	<page_name>widget:type_textarea</page_name>
	<page_id>60</page_id>
	<page_title>widget:type_textarea</page_title>
	<content></content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=8">
	<page_name>Internet_Media_Manager</page_name>
	<page_id>8</page_id>
	<page_title>Internet Media Manager</page_title>
	<content>&apos;&apos;&apos;Manage your videos and photos all in one place&apos;&apos;&apos;

[[toc]]

===Watch the Guided Tour (6 minutes)===
&lt;nowiki&gt;
&lt;embed src=&quot;http://media.weblite.ca/lib/flvplayer.swf&quot; width=&quot;640&quot; height=&quot;448&quot; bgcolor=&quot;#FFFFFF&quot; type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; flashvars=&quot;file=http%3A%2F%2Fs3.amazonaws.com%2Fweblite_media%2Fintro_video.flv&amp;image=http%3A%2F%2Fmedia.weblite.ca%2Ffiles%2Fphotos%2Fintro_video.flv.AbpY0Y.jpg&amp;showdigits=true&amp;autostart=false&quot; /&gt;
&lt;/nowiki&gt;

===Introduction===

The Internet Media Manager is a web-based database application that allows webmasters to centrally store their images and videos to be served on their website(s).  It provides a Youtube-like interface whereby users can simply copy and paste code snippets to embed images and videos into their web pages.  It also provides a photo gallery component that allows users to easily embed a gallery of images into their web pages by simply copying and pasting a snippet of javascript code.

===Purpose===

I created this application because:

# I didn&apos;t want to have to resize images in Photoshop anymore before uploading them to the web.
# I wanted to be able to embed videos, images, and photo galleries into my web pages without having to muck around with HTML code.

IMM (Internet Media Manager) allows you to resize your photos to any size you want, and embed these resized images in your web pages by copying and pasting a snippet of HTML.  Similarly it makes embedding videos and photo galleries into your website a snap.

===Features===

* Add/Edit/Delete/Categorize images and videos in a searchable database.
* Import multiple images or videos at once by uploading a ZIP file.
* Large file imports via FTP/SSH.
* Embed video and images directly into other web pages by copying and pasting HTML snippets (like Youtube).
* Resize images and videos.
* FLV video support (like Youtube).
* Search media by content type, category, keyword, etc..
* Includes javascript photo gallery component that can be embedded into any web page.
* Amazon Simple Storage Service (S3) integration.

===Requirements===

* [http://www.php.net|PHP] 5.2+
* [http://www.mysql.com|MySQL] 4.1+
* [http://ca.php.net/gd|GD_Image_Processing_Library]
* [http://ffmpeg.mplayerhq.hu/|FFMPEG] (optional - if you want to automatically generate poster images for videos).

===Download===

* [https://sourceforge.net/projects/immgr/files/|Internet Media Manager 0.3]

===Installation===

# Download the latest version from Sourceforge.
# Extract the files and copy to your web server.
# Point your web browser to the install.php and follow the instructions. 

===Screenshots===

&lt;nowiki&gt;
&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;http://media.weblite.ca/index.php?-action=gallery&amp;-table=files&amp;categories=3&amp;-cursor=0&amp;-skip=0&amp;-limit=30&amp;-mode=list&amp;-photo_max_width=500&amp;--format=js&quot;&gt;&lt;/script&gt;
&lt;div style=&quot;clear:both&quot;&gt;&lt;/div&gt;
&lt;/nowiki&gt;

===Screencasts===

How to import multiple images at once in a ZIP archive.

&lt;nowiki&gt;&lt;iframe title=&quot;YouTube video player&quot; width=&quot;640&quot; height=&quot;510&quot; src=&quot;http://www.youtube.com/embed/0gfRJ5HkRsI&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;/nowiki&gt;

===Support===

Visit the [http://xataface.com/forum/viewforum.php?f=12|Support_forum].
</content>
	<keywords>Internet Media Manager,resize photos,image gallery,photo gallery,video gallery</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=38">
	<page_name>How_to_build_a_PHP_MySQL_Application_with_4_lines_of_code</page_name>
	<page_id>38</page_id>
	<page_title>How to build a PHP MySQL Application with 4 lines of code</page_title>
	<content>&apos;&apos;&apos;The [http://xataface.com Xataface Application Framework] allows you to convert your existing MySQL database into a full-fledged with as little as 4 lines of code.  And it&apos;s Not a code generator.&apos;&apos;&apos;

[[toc]]

This article is intended to spark interest in the [http://xataface.com Xataface Application Framework] amongst PHP developers by showing how easy it is to set up a full-featured front-end for your MySQL database.  If you are a PHP developer, surly you can identify with the situation where you&apos;ve built a snazzy website with PHP and MySQL but you need to create some way the website users to administer it.  I.e., you need to make an administrative back-end for your users.

You need to do this because PHP admin is too technical for your users, and it is an aweful lot of tedious work to create all of the necessary forms and lists for your users to edit the data themselves.

===Features for our Application===

* Create, edit and delete records using simple web forms.
* Browse through database and find records without any SQL.
* Lots of great widgets for editing records including html editors, select lists, grids, checkboxes, calendars and more.
* Sort records.
* Export result sets as CSV or XML.
* Fully configurable and extendable by you to implement more [[about|features]].

===Creating the Application===

Here are 6 steps to a full-featured front-end for your database:

# Create a directory for your application on your webserver.  Call it &apos;&apos;myapp&apos;&apos;.
# Download the latest version of [http://xataface.com Xataface] and copy it into your application directory that we just created.  (i.e. &apos;&apos;myapp/xataface&apos;&apos;.
# Create a configuration file named &apos;&apos;conf.ini&apos;&apos; inside your application directory (i.e. &apos;&apos;myapp/conf.ini&apos;&apos;) to store your database connection info:&lt;code&gt;
[_database]
    host=localhost
    name=mydb
    user=username
    password=mypass

[_tables]
    ;; This section lists the tables to include in your application menu
    table1=Label for table 1
    table2=Label for table 2
&lt;/code&gt;
# Create an .htaccess (i.e. &apos;&apos;myapp/.htaccess&apos;&apos;) file to prevent Apache from serving your &apos;&apos;conf.ini&apos;&apos; file:&lt;code&gt;
&lt;FilesMatch &quot;\.ini$&quot;&gt;
Deny from all
&lt;/FilesMatch&gt;
&lt;/code&gt;  &apos;&apos;&apos;Note:  If you are not using Apache as your web server you&apos;ll need to block access to the .ini files using a different mechanism.  E.g. On IIS you can create a Web.config file to block this access and place it inside your application&apos;s directory.&apos;&apos;&apos;  Download a sample Web.config file [http://weblite.ca/svn/dataface/core/trunk/site_skeleton/Web.config here].
# Create an index.php file (i.e. &apos;&apos;myapp/index.php&apos;&apos;) to serve as an access point for your application:&lt;code&gt;
&lt;?php
// Include the Xataface API
require_once &apos;xataface/dataface-public-api.php&apos;;

// Initialize Xataface framework
df_init(__FILE__, &apos;xataface&apos;)-&gt;display();
    // first parameter is always the same (path to the current script)
    // 2nd parameter is relative URL to xataface directory (used for CSS files and javascripts)
&lt;/code&gt;
# Create a &apos;&apos;templates_c&apos;&apos; directory to store cached smarty templates or your application (i.e. &apos;&apos;myapp/templates_c&apos;&apos;, and make sure that it is writable by the webserver:
 $ mkdir templates_c
 $ chmod 777 templates_c


That&apos;s all there is to it!  Point your web browser to the index.php file we just made, and check out your new app!

===Screenshots of Our App===

====Find Form====

[[Image:http://media.weblite.ca/files/photos/people-find.png?max_width=400]]

====New Record Form====

[[Image:http://media.weblite.ca/files/photos/people-new-record.png?max_width=400]]

====List View====

[[Image:http://media.weblite.ca/files/photos/people-list.png?max_width=400]]

===Where to go now===

# Sign up for the Xataface mailing list to receive exclusive development tips (see the left column for a signup form).
# Check out the [[about|About Xataface]] page for more information about features and requirements.
# Use the [http://xataface.com/documentation/getting_started Getting Started Tutorial] to get started making your own application.
# [http://xataface.com/videos Watch screencasts] showing Xataface in action.



</content>
	<keywords>tutorial, getting started, installation, first app, 4 lines of code</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=45">
	<page_name>_output_cache</page_name>
	<page_id>45</page_id>
	<page_title>The Xataface Output Cache</page_title>
	<content>&lt;nowiki&gt;&lt;div class=&quot;portalMessage&quot;&gt;Note: There was a bug in the output cache affecting Xataface version 1.0 to 1.3rc1.  If you are using a version of Xataface older than 1.3rc2 then you should either disable the output cache, or replace the Dataface/OutputCache.php file with one from a newer version.&lt;/div&gt;&lt;/nowiki&gt;

[[toc]]

Xataface does quite a bit of heavy lifting on each page request.  If your application is getting a lot of traffic that is slowing your server down, you may want to look at enabling the Xataface output cache.

===Features===

* Improve speed of application dramatically - especially for seldom updated sites.
* Supports multiple languages.
* Supports multiple users (each user has own cache).
* Provides GZIP compression for improved performance.

===How it works?===

When you receive a request, Xataface will return a cached version of the page if the page has been accessed before.  If the page doesn&apos;t yet exist in the cache it generates the page, saves it to the cache and outputs it to the user transparently.  The cache is completely transparent to your users.

===Where is the cache stored?===

Xataface creates a table called &apos;&apos;__output_cache&apos;&apos; that stores all of the cached content for your application.  This table stores both a GZIPed and regular version of each page.  If the user&apos;s browser supports GZIP compression, Xataface will automatically return the GZIP version.  This results in further performance improvements.

===What if I make changes to the database?===

Xataface records which tables were in use when a page is cached.  If any of those tables are modified after the page is cached, Xataface will mark that cached page as &apos;&apos;out of date&apos;&apos; and regenerate it the next time that it is requested.

===What if I make changes to my configuration files and templates?===

The output cache will have to be manually cleared if you make any changes to your source files (e.g. PHP, templates, and INI files).  Clearing the cache is as easy as deleting or emptying the &apos;&apos;__output_cache&apos;&apos; table.

===How do I enable the Cache?===

Add the following to your [[conf.ini file]]:

&lt;code&gt;
[_output_cache]
    enabled=1
&lt;/code&gt;

===How do I disable the Cache?===

Simply comment out or remove the &apos;&apos;[_output_cache]&apos;&apos; section of your [[conf.ini file]].  E.g.
&lt;code&gt;
;[_output_cache]
;   enabled=1
&lt;/code&gt;

===Configuration Options===

The following directives can be added to the &apos;&apos;[_output_cache]&apos;&apos; section of your [[conf.ini file]] to customize how your output cache works.

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| lifeTime
| Number of seconds before cached page is considered &apos;&apos;out of date&apos;&apos;.
| 0.7
|-
| tableName
| The name of the table to store the cached pages.  Default &apos;__output_cache&apos;.
| 0.7
|-
| ignoredTables
| A comma-delimited list of tables that don&apos;t affect the output cache (i.e. these tables can be changed without causing the output cache to be refreshed.
| 0.7
|-
| observedTables
| A comma-delimited list of tables that should affect the status of the output cache for every page (whether the table is explicitly used by the page or not).  This is a useful way to tell Xataface to refresh your cache.
| 0.7
|-
| exemptActions
| A comma-delimited list of actions that are exempt from the output cache (and thus should not be cached).
| 0.7
|}</content>
	<keywords>output cache</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=11">
	<page_name>block__blockname</page_name>
	<page_id>11</page_id>
	<page_title>block__blockname</page_title>
	<content>===Available Blocks===

This is a grep to show the blocks that are defined in Xataface templates:

* Dataface_ActionsMenu.html:actions_menu_head
* Dataface_ActionsMenu.html:actions_menu_tail
* Dataface_Add_Existing_Related_Record.html:before_add_existing_related_record_form
* Dataface_Add_Existing_Related_Record.html:before_add_existing_related_`$ENV.relationship`_form
* Dataface_Add_Existing_Related_Record.html:after_add_existing_related_`$ENV.relationship`_form
* Dataface_Add_Existing_Related_Record.html:after_add_existing_related_record_form
* Dataface_Add_New_Related_Record.html:before_add_new_related_record_form
* Dataface_Add_New_Related_Record.html:before_add_new_related_`$ENV.relationship`_form
* Dataface_Add_New_Related_Record.html:after_add_new_related_`$ENV.relationship`_form
* Dataface_Add_New_Related_Record.html:after_add_new_related_record_form
* Dataface_AjaxEventDetails.html:before_event_details
* Dataface_AjaxEventDetails.html:after_event_details
* Dataface_Delete_Record.html:before_delete_record_form
* Dataface_Delete_Record.html:after_delete_record_form
* Dataface_Edit_Record.html:before_edit_record_form
* Dataface_Edit_Record.html:after_edit_record_form
* Dataface_FindForm.html:findform_before_`$element.field.name`_row
* Dataface_FindForm.html:findform_before_`$element.field.name`_widget
* Dataface_FindForm.html:findform_after_`$element.field.name`_widget
* Dataface_FindForm.html:findform_after_`$element.field.name`_row
* Dataface_FindForm.html:before_findform_table
* Dataface_FindForm.html:findform_before_`$element.field.name`_row
* Dataface_FindForm.html:findform_before_`$element.field.name`_widget
* Dataface_FindForm.html:findform_after_`$element.field.name`_widget
* Dataface_FindForm.html:findform_after_`$element.field.name`_row
* Dataface_FindForm.html:after_findform_table
* Dataface_Find_View.html:before_find_form
* Dataface_Find_View.html:after_find_form
* Dataface_Form_Section_Template.html:before_quickform_table
* Dataface_Import_RelatedRecords.html:before_import_related_records_form
* Dataface_Import_RelatedRecords.html:before_import_related_`$ENV.relationship`_form
* Dataface_Import_RelatedRecords.html:after_import_related_`$ENV.relationship`_form
* Dataface_Import_RelatedRecords.html:after_import_related_records_form
* Dataface_List_View.html:before_result_list
* Dataface_List_View.html:after_result_list
* Dataface_Login_Prompt.html:before_login_form
* Dataface_Login_Prompt.html:after_login_form
* Dataface_Main_Template.html:custom_stylesheets2
* Dataface_Main_Template.html:head
* Dataface_Main_Template.html:body_atts
* Dataface_Main_Template.html:before_body
* Dataface_Main_Template.html:before_header
* Dataface_Main_Template.html:after_header
* Dataface_Main_Template.html:before_search
* Dataface_Main_Template.html:after_search_form_submit
* Dataface_Main_Template.html:after_search
* Dataface_Main_Template.html:before_nav_menu
* Dataface_Main_Template.html:after_nav_menu
* Dataface_Main_Template.html:before_language_selector
* Dataface_Main_Template.html:after_language_selector
* Dataface_Main_Template.html:before_user_status_logged_in
* Dataface_Main_Template.html:after_user_status_logged_in
* Dataface_Main_Template.html:before_user_status_not_logged_in
* Dataface_Main_Template.html:after_user_status_not_logged_in
* Dataface_Main_Template.html:before_personal_tools
* Dataface_Main_Template.html:after_personal_tools
* Dataface_Main_Template.html:before_bread_crumbs
* Dataface_Main_Template.html:after_bread_crumbs
* Dataface_Main_Template.html:before_main_table
* Dataface_Main_Template.html:before_left_column
* Dataface_Main_Template.html:before_record_tree
* Dataface_Main_Template.html:after_record_tree
* Dataface_Main_Template.html:before_nav_menu
* Dataface_Main_Template.html:after_nav_menu
* Dataface_Main_Template.html:before_application_menu
* Dataface_Main_Template.html:after_application_menu
* Dataface_Main_Template.html:after_left_column
* Dataface_Main_Template.html:before_main_column
* Dataface_Main_Template.html:before_message
* Dataface_Main_Template.html:message
* Dataface_Main_Template.html:after_message
* Dataface_Main_Template.html:before_errors
* Dataface_Main_Template.html:error
* Dataface_Main_Template.html:after_errors
* Dataface_Main_Template.html:before_table_tabs
* Dataface_Main_Template.html:before_menus
* Dataface_Main_Template.html:after_menus
* Dataface_Main_Template.html:before_main_section
* Dataface_Main_Template.html:before_recently_viewed
* Dataface_Main_Template.html:after_recently_viewed
* Dataface_Main_Template.html:before_record_content
* Dataface_Main_Template.html:after_record_content
* Dataface_Main_Template.html:after_main_section
* Dataface_Main_Template.html:before_fineprint
* Dataface_Main_Template.html:after_fineprint
* Dataface_Main_Template.html:before_global_footer
* Dataface_Main_Template.html:after_global_footer
* Dataface_Main_Template.html:before_main_section
* Dataface_Main_Template.html:before_recently_viewed
* Dataface_Main_Template.html:after_recently_viewed
* Dataface_Main_Template.html:before_record_content
* Dataface_Main_Template.html:after_record_content
* Dataface_Main_Template.html:after_main_section
* Dataface_NavMenu.html:tables_menu_head
* Dataface_NavMenu.html:tables_menu_tail
* Dataface_NavMenu.html:tables_menu_head
* Dataface_NavMenu.html:tables_menu_tail
* Dataface_New_Record.html:before_new_record_form
* Dataface_New_Record.html:after_new_record_form
* Dataface_Record_Template.html:before_details_controller
* Dataface_Record_Template.html:after_details_controller
* Dataface_Record_Template.html:before_record_heading
* Dataface_Record_Template.html:after_record_heading
* Dataface_Record_Template.html:before_record_tabs
* Dataface_Record_Template.html:before_record_content
* Dataface_Record_Template.html:after_record_content
* Dataface_Record_Template.html:before_record_footer
* Dataface_Record_Template.html:after_record_footer
* Dataface_Registration.html:before_registration_form
* Dataface_Registration.html:after_registration_form
* Dataface_Related_Records_List.html:before_related_`$ENV.relationship`_records_list
* Dataface_Related_Records_List.html:after_related_`$ENV.relationship`_records_list
* Dataface_Remove_Related_Record.html:before_remove_related_record_form
* Dataface_Remove_Related_Record.html:before_remove_related_`$ENV.relationship`_record_form
* Dataface_Remove_Related_Record.html:after_remove_related_`$ENV.relationship`_record_form
* Dataface_Remove_Related_Record.html:after_remove_related_record_form
* Dataface_View_Record.html:before_view_tab_content
* Dataface_View_Record.html:before_record_actions
* Dataface_View_Record.html:after_record_actions
* Dataface_View_Record.html:after_view_tab_content
* Dataface_related_records_checkboxes.html:before_related_`$ENV.relationship`_records_checkboxes
* Dataface_related_records_checkboxes.html:before_related_records_checkboxes
* Dataface_related_records_checkboxes.html:after_related_records_checkboxes
* Dataface_related_records_checkboxes.html:after_related_`$ENV.relationship`_records_checkboxes
* Dataface_set_translation_status.html:before_details_controller
* Dataface_set_translation_status.html:after_details_controller

===Available Slots===

* Dataface_ActionsMenu.html:actions_menu
* Dataface_Add_Existing_Related_Record.html:add_existing_related_`$ENV.relationship`_form
* Dataface_Add_Existing_Related_Record.html:add_existing_related_record_form
* Dataface_Add_New_Related_Record.html:add_new_related_`$ENV.relationship`_form
* Dataface_Add_New_Related_Record.html:add_new_related_record_form
* Dataface_AjaxEventDetails.html:event_details
* Dataface_Delete_Record.html:delete_record_form
* Dataface_Edit_Record.html:edit_record_form
* Dataface_FindForm.html:findform_`$element.field.name`_row
* Dataface_FindForm.html:findform_`$element.field.name`_widget
* Dataface_FindForm.html:findform_`$element.field.name`_row
* Dataface_FindForm.html:findform_`$element.field.name`_widget
* Dataface_Find_View.html:find_form
* Dataface_Import_RelatedRecords.html:import_related_`$ENV.relationship`_form
* Dataface_Import_RelatedRecords.html:import_related_records_form
* Dataface_List_View.html:result_list
* Dataface_List_View_summary.html:result_list
* Dataface_Login_Prompt.html:login_form
* Dataface_Main_Template.html:doctype_tag
* Dataface_Main_Template.html:html_tag
* Dataface_Main_Template.html:html_head
* Dataface_Main_Template.html:html_title
* Dataface_Main_Template.html:dataface_stylesheets
* Dataface_Main_Template.html:custom_stylesheets
* Dataface_Main_Template.html:dataface_javascripts
* Dataface_Main_Template.html:custom_javascripts
* Dataface_Main_Template.html:head_slot
* Dataface_Main_Template.html:html_body
* Dataface_Main_Template.html:global_header
* Dataface_Main_Template.html:search_form
* Dataface_Main_Template.html:language_selector
* Dataface_Main_Template.html:user_status_logged_in
* Dataface_Main_Template.html:user_status_not_logged_in
* Dataface_Main_Template.html:personal_tools
* Dataface_Main_Template.html:bread_crumbs
* Dataface_Main_Template.html:main_table
* Dataface_Main_Template.html:left_column
* Dataface_Main_Template.html:application_menu
* Dataface_Main_Template.html:main_column
* Dataface_Main_Template.html:table_tabs
* Dataface_Main_Template.html:menus
* Dataface_Main_Template.html:main_section
* Dataface_Main_Template.html:record_content
* Dataface_Main_Template.html:fineprint
* Dataface_Main_Template.html:global_footer
* Dataface_Main_Template.html:main_section
* Dataface_Main_Template.html:record_content
* Dataface_Main_Templateold.html:doctype_tag
* Dataface_Main_Templateold.html:html_tag
* Dataface_Main_Templateold.html:html_head
* Dataface_Main_Templateold.html:html_title
* Dataface_Main_Templateold.html:dataface_stylesheets
* Dataface_Main_Templateold.html:custom_stylesheets
* Dataface_Main_Templateold.html:dataface_javascripts
* Dataface_Main_Templateold.html:custom_javascripts
* Dataface_Main_Templateold.html:head_slot
* Dataface_Main_Templateold.html:html_body
* Dataface_Main_Templateold.html:global_header
* Dataface_Main_Templateold.html:search_form
* Dataface_Main_Templateold.html:language_selector
* Dataface_Main_Templateold.html:user_status_logged_in
* Dataface_Main_Templateold.html:user_status_not_logged_in
* Dataface_Main_Templateold.html:personal_tools
* Dataface_Main_Templateold.html:bread_crumbs
* Dataface_Main_Templateold.html:main_table
* Dataface_Main_Templateold.html:left_column
* Dataface_Main_Templateold.html:application_menu
* Dataface_Main_Templateold.html:main_column
* Dataface_Main_Templateold.html:table_tabs
* Dataface_Main_Templateold.html:menus
* Dataface_Main_Templateold.html:main_section
* Dataface_Main_Templateold.html:record_content
* Dataface_Main_Templateold.html:fineprint
* Dataface_Main_Templateold.html:global_footer
* Dataface_Main_Templateold.html:main_section
* Dataface_Main_Templateold.html:record_content
* Dataface_NavMenu.html:tables_menu_options
* Dataface_NavMenu.html:tables_menu_options
* Dataface_New_Record.html:new_record_form
* Dataface_Record_Template.html:record_heading
* Dataface_Record_Template.html:record_content
* Dataface_Record_Template.html:record_footer
* Dataface_Registration.html:registration_form
* Dataface_Related_Records_List.html:before_related_list
* Dataface_Related_Records_List.html:related_`$ENV.relationship`_records_list
* Dataface_Related_Records_List.html:related_records_list
* Dataface_Related_Records_List.html:after_related_list
* Dataface_Remove_Related_Record.html:remove_related_`$ENV.relationship`_record_form
* Dataface_Remove_Related_Record.html:remove_related_record_form
* Dataface_View_Record.html:view_tab_content
* Dataface_View_Record.html:record_actions
* Dataface_View_Record.html:record_search
* Dataface_View_Record.html:`$section.name`_section_content
* Dataface_View_Record.html:record_view_main_section
* Dataface_View_Record.html:`$section.name`_section_content
* Dataface_related_records_checkboxes.html:related_`$ENV.relationship`_records_checkbox_form
* Dataface_related_records_checkboxes.html:related_records_checkbox_form
* global_header.html:site_logo

</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=36">
	<page_name>about</page_name>
	<page_id>36</page_id>
	<page_title>about</page_title>
	<content>==About Xataface==

[[toc]]

Xataface is a flexible and shapable skin that sits on top of MySQL, making it accessible to every-day users. It automatically generates the appropriate forms, lists, and menus for a user to interact with the database without having to know any SQL. 

It is a full-featured Web application framework, and gives developers the flexibility to customize the features and behavior of their application via configuration files (using the simple INI-file syntax), templates, and plug-ins. A generic application with no customizations is completely functional, but the developer is free to customize things at his leisure.

===Who is Xataface for?===

Xataface is for web developers and database administrators who would like to build a front-end for their MySQL database.  However the resulting applications are targeted at non-technical users such as secretaries.

===Requirements===

====Xataface 1.1.x and below:====

* MySQL 3.23+
* PHP 4+

Some advanced features require MySQL version 4.1 or higher.

====Xataface 1.2 and higher====

* MySQL 3.23+
* PHP 5+

Some advanced features require MySQL version 5 or higher.

===At a Glance: Your first App===

# Create a directory for your app.
# Copy the &apos;&apos;xataface&apos;&apos; directory inside your application directory.
# Create a configuration file named &apos;&apos;conf.ini&apos;&apos; in your application directory with your database settings:&lt;code&gt;
[_database]
    host=localhost
    name=mydb
    user=me
    password=mypass

[_tables]
    ; A list of tables to include in your application&apos;s menu
    ; These tables must already exist in your database
    people=Profiles
    news=News Articles
&lt;/code&gt;
# Create an .htaccess file in your application directory to prevent access to your &apos;&apos;conf.ini&apos;&apos; file:&lt;code&gt;
&lt;FilesMatch &quot;\.ini$&quot;&gt;
Deny from all
&lt;/FilesMatch&gt;
&lt;/code&gt;
# Create a PHP script in your application directory as an access point for your app.  We&apos;ll call it &apos;&apos;index.php&apos;&apos;:&lt;code style=&quot;php&quot;&gt;
&lt;?php
// Include the Xataface API
require_once &apos;xataface/dataface-public-api.php&apos;;

// Initialize Xataface framework
df_init(__FILE__, &apos;xataface&apos;);
    // first parameter is always the same (path to the current script)
    // 2nd parameter is relative URL to xataface directory (used for CSS files and javascripts)

// Create a new application
$app =&amp; Dataface_Application::getInstance();

// Display the application
$app-&gt;display()
&lt;/code&gt;
# You&apos;re done.  Your app is ready to use!

This is just the beginning, though.  There is no limit to the customizations you can make on your application.

Read the [http://xataface.com/documentation/tutorial/getting_started Getting Started Tutorial] for more information on developing applications with Xataface.


===Product Comparison===

Xataface fits a niche that is not well covered by existing apps/frameworks.  Xataface is &apos;&apos;&apos;NOT&apos;&apos;&apos;:

* A database administration system like PHPMyAdmin
* Simply a software library/Framework like PHPCake
* Simply a content management system like Drupal
* A code generator

Xataface is a framework, but it is not a typical framework.  Most frameworks require a substantial amount of development before you get a usable application.  Xataface, on the other hand, provides you with a fully-functional application with as little as 4 lines of PHP code.  It doesn&apos;t generate any code so it is easy to maintain your application and expand on it later.

As a development framework, Xataface most closely resembles Django, a python framework for building data-driven applications.  As an application, Xataface most closely resembles Filemaker, a popular relational database that makes it easy for the end user to create layouts and manage their data.

===Features===

====General====

* &apos;&apos;&apos;Out-of-the-box Database Front-end&apos;&apos;&apos; - With as little as 4 lines of PHP code, you can have a full-featured web application for your database.
* &apos;&apos;&apos;Simple, Intuitive User interface&apos;&apos;&apos; - Default application is consistent and simple to use.  There is a &apos;tables&apos; menu, to select a table, and each table has &quot;details&quot;, &quot;list&quot;, and &quot;find&quot; tabs.  Very easy to navigate.
* &apos;&apos;&apos;Powerful configuration options&apos;&apos;&apos; - You can configure your application details (such as widget types) using simple configuration files.
* &apos;&apos;&apos;Extendible&apos;&apos;&apos; - You can modify your application as you see fit using configuration files and PHP delegate classes.
* &apos;&apos;&apos;Hooks&apos;&apos;&apos; - By observing simple conventions you can extend Xataface&apos;s functionality with hooks, triggers, and events.  E.g. add a function that is called after a record is inserted.
* &apos;&apos;&apos;Permissions&apos;&apos;&apos; - Powerful, pluggable permissions system.
* &apos;&apos;&apos;Authentication&apos;&apos;&apos; - Provides login/logout ability.  You just specify which table your users are stored in.
* &apos;&apos;&apos;Relationships&apos;&apos;&apos; - Tell Xataface how your tables are related to one another and it will provide you with more logical functionality for managing your data.
* &apos;&apos;&apos;Themeable&apos;&apos;&apos; - Xataface uses the Smarty template engine as a base, but extends it with some powerful new features such as extendable templates and theming support.
* &apos;&apos;&apos;Modular&apos;&apos;&apos; - There are several add-on modules available to extend the features of Xataface even further, and a simple API for writing your own modules.


====Editing====

* &apos;&apos;&apos;Automatic Form Generation&apos;&apos;&apos; - Automatically generates appropriate web forms to add new records and edit existing records.
* &apos;&apos;&apos;Widgets&apos;&apos;&apos; - Support for many different widget types including text fields, text areas, checkboxes, select lists, html editors, grids, file uploads, and more.
* &apos;&apos;&apos;Configurable&apos;&apos;&apos; - Customize forms using configuration files and delegate classes.
* &apos;&apos;&apos;Personalizable&apos;&apos;&apos; - Show different forms to different users depending on their permissions and preferences.
* &apos;&apos;&apos;Add Related Records&apos;&apos;&apos; - Insert records and automatically track their relationships to other tables.
* &apos;&apos;&apos;Editable Data Grid&apos;&apos;&apos; - Manage your data like a spreadsheet using the DataGrid module.
* &apos;&apos;&apos;Copy&apos;&apos;&apos; - Copy sets of records.
* &apos;&apos;&apos;Update Found Set&apos;&apos;&apos; - Update multiple records with one swipe.
* &apos;&apos;&apos;Fine-grained Permissions&apos;&apos;&apos; - Assign editing permission based on table, record, or field. 
* &apos;&apos;&apos;File uploads&apos;&apos;&apos; - Support for file uploads with storage either in a BLOB field or on the file system.
* &apos;&apos;&apos;Delete&apos;&apos;&apos; - Delete single record or delete the current found set.

====Searching====

* &apos;&apos;&apos;Automatic Find Form&apos;&apos;&apos; - The Xataface find form allows you to search a table on any field.
* &apos;&apos;&apos;Range Searches&apos;&apos;&apos; - Search for records matching values in a certain range (e.g. find all people between the ages of 20 and 30).
* &apos;&apos;&apos;Exact Matching&apos;&apos;&apos; - Search for exact matches.
* &apos;&apos;&apos;Partial Matching&apos;&apos;&apos; - Search for fields that contain a keyword phrase.
* &apos;&apos;&apos;Multi-field search&apos;&apos;&apos; - There is always a simple search field accessible which searches all fields in the current table.  E.g. a search for &quot;Tom&quot; would match any record in the current table that contained the phrase &quot;Tom&quot; in any of its columns.
* &apos;&apos;&apos;Related Record Searches&apos;&apos;&apos; - Find records that contain related records matching a search term.  (E.g. find all people who got an &apos;A&apos; in a particular course).


====Browsing====

* &apos;&apos;&apos;Automatic Details View&apos;&apos;&apos; - Each record has user-friendly details page to browse the contents of the record.
* &apos;&apos;&apos;AJAX Record Tree&apos;&apos;&apos; - Provides optional AJAX record tree to browse the data in your database by relationships.
* &apos;&apos;&apos;Expand for More&apos;&apos;&apos; - Quickly expand a row in list view to see the full record details.
* &apos;&apos;&apos;Drag and Drop Reordering&apos;&apos;&apos; - The details view for a record can be broken up into related sections.  Users can reorder these sections via drag and drop.

====Exporting====

* &apos;&apos;&apos;RSS&apos;&apos;&apos; - Support for RSS 1.0, 2.0 and Atom feeds of any found set.
* &apos;&apos;&apos;XML&apos;&apos;&apos; - Export any found set as XML so that the data can be interchanged with other products (e.g. desktop publishing suites).
* &apos;&apos;&apos;CSV&apos;&apos;&apos; - Export any found set to CSV (comma-separated-value) to open in a spreadsheet application like Excel.
* &apos;&apos;&apos;JSON&apos;&apos;&apos; - Export any found set to JSON.  This feature makes Xataface a good choice for serving the next generation of Web 2.0 AJAX applications.

====Internationalization====

* &apos;&apos;&apos;String Internationalization&apos;&apos;&apos; - Xataface fully supports internationalizing your application.  It provides you with language files to provide translations of all of the strings and labels in your application.
* &apos;&apos;&apos;Dynamic Data Translation&apos;&apos;&apos; - Xataface even allows you to internationalize your existing database data without having to change your database structure.
* &apos;&apos;&apos;Templates&apos;&apos;&apos; - Includes a {translate} tag for Smarty templates to easily translate template text.
* &apos;&apos;&apos;In the background&apos;&apos;&apos; - You can use Xataface to internationalize any PHP/MySQL website without having to make any drastic changes to your existing code.  Just include Xataface as a library and use some of its useful internationalization functions to convert your application into multiple languages.
* &apos;&apos;&apos;Translation Form&apos;&apos;&apos; - If multiple languages are enabled, Xataface provides a simple translation form to translate content between languages.
* &apos;&apos;&apos;Translation Status Tracking&apos;&apos;&apos; - Track the status of translations to mark whether they need to be retranslated.

====Importing====

* &apos;&apos;&apos;Import Filter API&apos;&apos;&apos; - Using delegate classes, it is easy to define an import filter to import any type of data into the database.
* &apos;&apos;&apos;User Preview&apos;&apos;&apos; - User can preview imported data before confirming that he wants to import it.

====History====

* &apos;&apos;&apos;Optional History Support&apos;&apos;&apos; - If history is enabled, all changes made to any data are recorded.
* &apos;&apos;&apos;Undo/Redo Support&apos;&apos;&apos; - Easily revert to an earlier version of a record.
* &apos;&apos;&apos;View Snapshot&apos;&apos;&apos; - Browse previous versions of records.
* &apos;&apos;&apos;View Diffs&apos;&apos;&apos; - View differences/changes between versions of records, similar to a wiki.

====Caching====

* &apos;&apos;&apos;Output cache&apos;&apos;&apos; - Supports output cache that caches output of pages to improve performance dramatically for busy sites.  Cache is automatically refreshed whenever changes are made to tables that are used to generate the page.
* &apos;&apos;&apos;APC Support&apos;&apos;&apos; - If APC (Alternate PHP Cache) is installed, Xataface will automatically use it to cache table configuration information.  This tends to increase performance by about 20%.


====Security====

* &apos;&apos;&apos;Fine-grained permissions&apos;&apos;&apos; - Define permissions to the entire application, a single table, by the record, or by the field.  Each feature has an associated permission that can be allowed or disallowed on a per-user basis.
* &apos;&apos;&apos;Cascading Permissions&apos;&apos;&apos; - You can very restrictive permissions to the application as a whole and then apply more permission permissions to specific tables or fields that you want uses to be able to access.  Table permissions override application permissions.  Field permissions override field permissions.
* &apos;&apos;&apos;Role-based permissions&apos;&apos;&apos; - You can define &quot;&quot;&quot;roles&quot;&quot;&quot; which are sets of permissions that can be assigned to users.
* &apos;&apos;&apos;Extendable Permissions Model&apos;&apos;&apos; - You can easily define your own permissions and roles, extending existing roles, custom for your application.
* &apos;&apos;&apos;Built-in Authentication&apos;&apos;&apos; - It is easy to set up login/logout features for your application.  Just tell Xataface which table you store your user records in, and Xataface will do the rest.
* &apos;&apos;&apos;Password Encryption&apos;&apos;&apos; - Xataface supports and is compatible with most of the standard password encryptions including MD5, SHA1, and MySQL Password.
* &apos;&apos;&apos;Pluggable Authentication&apos;&apos;&apos; - Easy to create your own authentication plugins in case you want to implement your own custom authentication.
* &apos;&apos;&apos;CAS&apos;&apos;&apos; - Module available for the Yale CAS (Central Authentication Service).
* &apos;&apos;&apos;LDAP&apos;&apos;&apos; - LDAP authentication module available.
* &apos;&apos;&apos;HTTP&apos;&apos;&apos; - Optional HTTP login support.  Standard login uses a web-based login form, but you can also use HTTP headers for authentication.

====Relationships====

* &apos;&apos;&apos;Powerful Relationship Model&apos;&apos;&apos; - It is easy to define relationships between your tables using simple configuration files.  Syntax is simple, but the results are powerful.
* &apos;&apos;&apos;Add New Related Record&apos;&apos;&apos; - Create a new record and add it to a parent record&apos;s relationship at the same time. (E.g. create a new &quot;course&quot; record and add it to a teacher&apos;s list of taught courses).
* &apos;&apos;&apos;Add Existing Related Record&apos;&apos;&apos; - Add an existing record to a parent record&apos;s relationship. (e.g. Add an existing course record to a teacher&apos;s list of taught courses).
* &apos;&apos;&apos;Remove related record&apos;&apos;&apos; - Remove a record from a relationship. (e.g. remove a course record from a teacher&apos;s list of taught courses).

====API====

Xataface includes a powerful API to allow you to more efficiently work with your database.

* &apos;&apos;&apos;Data Objects&apos;&apos;&apos; - Provides a simple API to work with database records.  Searching, loading, saving, editing, and deleting records supported.

====Templates====

* &apos;&apos;&apos;Smarty Template Engine&apos;&apos;&apos; - Xataface uses the Smarty template engine as a base, one of the fastest PHP template engines available.
* &apos;&apos;&apos;Template Inheritance&apos;&apos;&apos; - You can create templates that inherit from other templates, and replace the content in specified &quot;slots&quot; of the original template.  This drastically increases template reuse and development productivity.
* &apos;&apos;&apos;Cascading Support&apos;&apos;&apos; - All system templates are stored in the Dataface/templates directory.  Your application can have its own templates directory where you can place templates to override system templates.  All parts of the system can be overridden without modifying the original templates themselves.

====Themes====

Xataface includes a powerful themes API.  You can create multiple looks for your application and switch between them with a simple configuration setting.

====REST Support====

Xataface&apos;s intelligent URL protocols make it a powerful platform for REST web services.  You can specify a query directly in the URL to obtain the exact found-set that you want.  This is also very useful in standard web applications because you can easily create links to desired parts of your application.  Or you can use Xataface to provide missing functionality in your existing applications and link only to the parts of your Xataface app that you need.

===History===

Xataface (formerly Dataface) was originally created by Steve Hannah in 2005 to increase productivity created data-driven applications for Simon Fraser University.  He came from faculty that used Filemaker extensively for their databases.  As a PHP developer he preferred open technologies like MySQL as they provided fewer &quot;road blocks&quot;, but it was hard to deny the benefits of filemaker when it came to providing users with an instant user interface for their databases.  It was difficult to justify spending 3 weeks building an administration console for a MySQL application when it could have been done in 3 hours had Filemaker been used.

Xataface was designed to:

# Increase developer productivity to the point where MySQL applications could be created as quickly as Filemaker applications without sacrificing usability and functionality.
# Add an abstraction over a database to make is accessible to non-technical users.  The secretary shouldn&apos;t need to know SQL in order to interact with a database.
# Test the limits of PHP and MySQL

As it was built with the intention of providing an alternative for Filemaker, many implementation details and concepts have been inspired by Filemaker.  For example, Xataface&apos;s implementation of relationships is very similar to Filemaker relationships; as are valuelists.  In addition the method of searching follows many Filemaker conventions.

The first application built with Xataface was a group content management system for the Faculty of Applied Sciences at Simon Fraser University.  This system was used by faculty to manage their research profiles and their research groups.  The database itself pre-existed the Xataface implementation.   Xataface was used to build a new administrative interface to the system.  Since then Xataface has been used to develop many systems for SFU including website content management systems, auctions, event registration systems, research databases, shopping carts, and more.

==Where to go from here==

* [http://xataface.com/documentation/tutorial/getting_started Getting Started Tutorial]
* [http://xataface.com/videos Watch Demonstration Videos of Xataface]
* Sign up for the Xataface Maillist to receive free updates and development tips.  (See sign-up form in upper left of the page).</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=6">
	<page_name>actions.ini_file</page_name>
	<page_id>6</page_id>
	<page_title>actions.ini_file</page_title>
	<content>==actions.ini file Reference==

[[toc]]

The actions.ini file stores information about the various [[action]]s that can be performed by your application.  An action may be manifested in two ways:

# As a web page
# As a menu item

And there is no reason why an action cannot serve in both capacities simultaneously.  All menu items and functions that Xataface performs are defined in the Xataface actions.ini file (in the root of the Xataface installation dirctory).  You can also create an actions.ini file in your application&apos;s root directory to override existing Xataface actions, or to create your own.  If you want to modify an existing action instead of overriding it, you can use this syntax.

&lt;code&gt;
[browse &gt; browse]
	label = Browse
&lt;/code&gt;

The &amp;gt; symbol simply means to inherit from the existing browse action.  All the attributes are the same, and we just override the label to Browse (originally was Details)

Additionally, for actions that pertain only to a single table, an actions.ini file may be placed in any [[table configuration directory]].

===Syntax===

As with the [[fields.ini file]] and the [[valuelists.ini file]], the actions.ini file uses the simple [[INI file syntax]] to define its actions.  Each action is defined in its own section, and can have a number of directives to specify the action&apos;s behavior.

Here is a snippet from the Xataface actions.ini file to give you an idea:

&lt;code&gt;
;; Show the details of the current record
[browse]
	label = Details
	category = table_tabs
	url = &quot;{$this-&gt;url(&apos;-action=view&apos;)}&quot;
	accessKey = &quot;b&quot;
	mode = browse
	permission = view
	order=0

;; Show a list of the records in the current found set
[list]
	label = List
	category = table_tabs
	url = &quot;{$this-&gt;url(&apos;-action=list&apos;)}&quot;
	accessKey = &quot;l&quot;
	mode = list
	template = Dataface_List_View.html
	permission = list
	order=0.5

;; Show a &quot;Find Record Form&quot;
[find]
	label = Find
	category = table_tabs
	url = &quot;{$this-&gt;url(&apos;-action=find&apos;)}&quot;
	accessKey = &quot;f&quot;
	mode = find
	permission = find
	template = Dataface_Find_View.html
	order=0.75
&lt;/code&gt;

This snippet shows the definition of the browse, list, and find actions - three of the most central actions in a Xataface application.  Notice how each action has its own section (according to [[INI file syntax]]) with a number of directives which specify how the action behaves.  For instance, each action has a &quot;category&quot; value of &quot;table_tabs&quot;, which tells Xataface to display the actions as part of the table tabs in the user interface.

===Directives===

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| [[action allow_override|allow_override]]
| An optional directive to indicate that this action can be overridden by more specific directives in another ini file.  Currently there is only support for a value of &quot;relationships.ini&quot; indicating that the settings can be overridden in the relationships.ini file.  In order for this to work, related=1 must also be set.
| 1.3rc4
|-
| [[action label|label]]
| The label to display if the action is used as a menu item.
| all
|-
| [[action category|category]]
| The name of the action&apos;s category which can be used to group this action together with other similar actions to be used in a menu in the user interface.
| all
|-
| [[action url|url]]
| If the action appears as a menu item, this is the URL that the menu item points to.  This may contain PHP expressions inside curly braces.
| all
|-
| [[action accessKey|accessKey]]
| The key code to automatically select this action if it is included as a menu item.  I.e. ALT+accessKey calls the action.
| all
|-
| [[action mode|mode]]
| This indicates which tab of the table tabs (find, details, list, etc...) that this action should appear to be part of when the action is viewed as a web page.  If this is left undefined, or it does not match any existing visible action in the table tabs, then no tab will appear to be selected.
| all
|-
| [[action permission|permission]]
| The name of a permission required to both see the action as part of a menu and to access the action as a web page.
| all
|-
| [[action visible|visible]]
| A boolean value indicating whether the action should be visible as a menu item.
| all
|-
| [[action condition|condition]]
| A boolean value or a PHP expression evaluating to a boolean value to indicate whether the action should be visible as a menu item.
| all
|-
| [[action url_condition|url_condition]]
| A PHP expression evaluating to a boolean value to indicate whether the URL directive should be evaluated.  This basically checks to make sure that its OK to evaluate the &quot;url&quot; expression, just in case the current state of affairs would cause it to throw a fatal error.
| all
|-
| [[action order|order]]
| A numeric value indicating the order in which the action should be displayed as part of a menu.  Low numbers result in higher placement in the menu.
| all
|-
| [[action icon|icon]]
| The path to an icon that should be used when the action appears as a menu item.
| all
|-
| [[action template|template]]
| The path to the template that should be used when the action is displayed as a web page.
| all
|-
| [[action description|description]]
| Mouseover text for the action (when displayed as a menu item).
| all
|}

===PHP Expression Context===

Notice that the [[action url|url]], [[action condition|condition]], and [[action url_condition|url_condition]] directives allow you to use a PHP expression for their values.  In order for this to be helpful, you should know a little bit about the context and environment in which these expressions will be executed.  All expressions are evaluated immediately prior to being rendered, so the same action can be displayed multiple times in the same page, but have very different resulting values for their [[action url|urls]] and [[action condition|conditions]].

These expressions are all executed within the context of the Dataface_Application::parseString() method, with the following variables loaded in the local symbol table (i.e. you can use the following variables in your expressions).

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| [[action context:site_url|$site_url]]
| The URL to the current application&apos;s directory (not including &quot;index.php&quot;)
| all
|-
| $site_href
| The URL to the current application including &quot;index.php&quot;
| all
|-
| $dataface_url
| The URL to the xataface installation directory.
| all
|-
| $table
| The name of the current table (i.e. the value of the &quot;-table&quot; request parameter&quot;
| all
|-
| $query
| An associative array of the current query variables.
| all
|-
| $app
| A reference to the current Dataface_Application object.  Alias of &quot;$this&quot;
| all
|-
| $resultSet
| A reference to the Dataface_QueryTool object for the current query.
| all
|-
| [[action context:record|$record]]
| A reference to the current Dataface_Record object.
| all
|-
| [[action context:context|$context]]
| An associative array of context variables that are passed to the action from the context in which the action is called.
| all
|}</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=14">
	<page_name>afterRegister</page_name>
	<page_id>14</page_id>
	<page_title>afterRegister</page_title>
	<content>==afterRegister() Trigger==

A trigger that can be implemented in the [[Application Delegate Class]] or the [[Table Delegate Class]], to be executed after the registration form is saved.  This can be used to perform some custom actions like emailing the administrator.

===Signature===

function afterRegister( Dataface_Record &amp;$record ) : mixed

====Parameters====

{| class=&quot;listing listing2&quot;
! Name
! Description
|-
| &amp;$record
| A Dataface_Record object encapsulating the record that is being inserted in the users table for this registration.
|-
| returns
| Mixed. If this method returns a PEAR_Error object, then registration will fail with an error.
|}

===Example===

&lt;code&gt;
&lt;?php
class conf_ApplicationDelegate {
    function afterRegister(&amp;$record){
        // mail the admin to let him know that the registration is occurring.
        mail(&apos;admin@example.com&apos;, &apos;New registration&apos;, &apos;A new user &apos;.$record-&gt;val(&apos;username&apos;).&apos; has registered);
    }
}
&lt;/code&gt;

===See Also===

* [[beforeRegister]]
* [[validateRegistrationForm]]
* [[sendRegistrationActivationEmail]]
* [[getRegistrationActivationEmailInfo]]
* [[getRegistrationActivationEmailSubject]]
* [[getRegistrationActivationEmailMessage]]
* [[getRegistrationActivationEmailParameters]]
* [[getRegistrationActivationEmailHeaders]]</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=33">
	<page_name>after_action_new</page_name>
	<page_id>33</page_id>
	<page_title>after_action_new</page_title>
	<content>==after_action_new trigger==

[[toc]]

This trigger is called after the &apos;&apos;&apos;new&apos;&apos;&apos; action is successfully completed.  This trigger can be defined in the table [[Delegate class methods|delegate class]] and is often used to redirect to a particular page after a new record is submitted.  This should not be confused with the [[afterInsert]] trigger, which is executed after a record is inserted into the database (this can occur multiple times per request).  The after_action_new trigger is only executed once after the &apos;new&apos; action has been successfully completed.  i.e. a maximum of once per request.

===Signature===

&lt;code&gt;
function after_action_new($params=array()){ ... } : return void
&lt;/code&gt;

====Parameters====

This method takes a single associative array as a parameter. This array includes the following keys:

* &apos;&apos;&apos;record&apos;&apos;&apos; - The [http://dataface.weblite.ca/Dataface_Record Dataface_Record] object that was just inserted.


===Examples===

====Example 1: Redirect to the view tab for the inserted record====

&lt;code&gt;
function after_action_new($params=array()){
    $record =&amp; $params[&apos;record&apos;];
    header(&apos;Location: &apos;.$record-&gt;getURL(&apos;-action=view&apos;).&apos;&amp;--msg=&apos;.urlencode(&apos;Record successfully inserted.&apos;));
    exit;
}
&lt;/code&gt;
</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=13">
	<page_name>beforeRegister</page_name>
	<page_id>13</page_id>
	<page_title>beforeRegister</page_title>
	<content>==beforeRegister() Trigger==

A trigger that can be implemented in the [[Application Delegate Class]] or the [[Table Delegate Class]], to be executed before the registration form is saved.  This can be used to perform some custom actions like emailing the administrator.

===Signature===

function beforeRegister( Dataface_Record &amp;$record ) : mixed

====Parameters====

{| class=&quot;listing listing2&quot;
! Name
! Description
|-
| &amp;$record
| A Dataface_Record object encapsulating the record that is being inserted in the users table for this registration.
|-
| returns
| Mixed. If this method returns a PEAR_Error object, then registration will fail with an error.
|}

===Example===

&lt;code&gt;
&lt;?php
class conf_ApplicationDelegate {
    function beforeRegister(&amp;$record){
        // mail the admin to let him know that the registration is occurring.
        mail(&apos;admin@example.com&apos;, &apos;New registration&apos;, &apos;A new user &apos;.$record-&gt;val(&apos;username&apos;).&apos; has registered);
    }
}
&lt;/code&gt;

===See Also===

* [[afterRegister]]
* [[validateRegistrationForm]]
* [[sendRegistrationActivationEmail]]
* [[getRegistrationActivationEmailInfo]]
* [[getRegistrationActivationEmailSubject]]
* [[getRegistrationActivationEmailMessage]]
* [[getRegistrationActivationEmailParameters]]
* [[getRegistrationActivationEmailHeaders]]</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=43">
	<page_name>Calendar_Action</page_name>
	<page_id>43</page_id>
	<page_title>Calendar_Action</page_title>
	<content>==Calendar Action==

[[toc]]

Xataface 1.0 includes a built-in calendar action that is disabled by default.  If enabled, it allows you to view the records in any found set as a calendar of events, as follows:

&lt;nowiki&gt;
&lt;div style=&quot;text-align:center;border: 1px solid #ccc; padding: 10px&quot;&gt;
&lt;img src=&quot;http://media.weblite.ca/files/photos/Picture -4.png?max_width=500&quot;
onmouseover=&quot;this.src=&apos;http://media.weblite.ca/files/photos/Picture -4.png&apos;;&quot;
onmouseout=&quot;this.src=&apos;http://media.weblite.ca/files/photos/Picture -4.png?max_width=500&apos;;&quot;/&gt;
&lt;/div&gt;
&lt;/nowiki&gt;

===Features===

* Monthly display
* Hourly schedule for any day by clicking on it.
* Show record details instantly by clicking on it in the calendar.
* Recognizes dates, start and end times for records when interpreted as calendar events.
* Respects searches (i.e. you can filter the records and the calendar will only show those records in the found set).

===Requirements===

Your table records should contain at least dates in order for them to be interpreted as events that can be placed in a calendar.

===Setting up the Calendar===

Suppose I have a table called &apos;&apos;Lessons&apos;&apos; that stores information about scheduled music lessons.  If I want to add the calendar to this table, then I would add an &apos;&apos;[[actions.ini file]]&apos;&apos; to the &apos;&apos;tables/Lessons&apos;&apos; directory with the following contents:&lt;code&gt;
[calendar &gt; calendar]
    condition=&quot;true&quot;
&lt;/code&gt;
This overrides the calendar action which is disabled by default, and enables it for the &apos;&apos;Lessons&apos;&apos; table.

Next I need to inform Xataface which fields store the event dates and times so that the records can be laid out in the calendar appropriately.  (Note that if you skip this step, Xataface will make a best guess based on column types and names - but it is better to specify these explicitly).

In the &apos;&apos;Lessons&apos;&apos; table I have the following fields that are relevant here:

* &apos;&apos;lesson_date&apos;&apos; - A date field containing the date and start time of the event.
* &apos;&apos;start_time&apos;&apos; - A time field with the start time of the lesson.

We can tell Xataface to treat these fields accordingly by adding the following directives to the appropriate field sections of the [[fields.ini file]] for the &apos;&apos;Lessons&apos;&apos; table:

* &apos;&apos;event.date=1&apos;&apos; - Specifies that the field stores the date of the event.
* &apos;&apos;event.start=1&apos;&apos; - Specifies that the field stores the start time of the event.

So in our case we&apos;ll modify the [[fields.ini file]] as follows:

&lt;code&gt;
[lesson_date]
    event.date=1

[start_time]
    event.start=1
&lt;/code&gt;

Now if we load up our application, we should now see a &apos;&apos;calendar&apos;&apos; tab along side &apos;&apos;list&apos;&apos;, &apos;&apos;details&apos;&apos;, and &apos;&apos;find&apos;&apos; for the &apos;&apos;Lessons&apos;&apos; table.  Click on this tab to see your records displayed in a calendar.

===Using a datetime field to store both date and start time===

You can also use a single field to store both the date and start time for an event.  In this case you just provide the &apos;&apos;event.date&apos;&apos; and &apos;&apos;event.start&apos;&apos; directives for the same field.  For example if the &apos;&apos;lesson_date&apos;&apos; was a datetime field that marked the date and time of the lesson, we would modify our [[fields.ini]] file as follows:

&lt;code&gt;
[lesson_date]
    event.date=1
    event.start=1
&lt;/code&gt;

===Available Fields===

The Calendar action will look for the following pieces of information in your records:

{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| event.date
| Indicates that the field contains the date of the event.
| 1.0
|-
| event.start
| Indicates that the field contains the start time of the event.
| 1.0
|-
| event.end
| Indicates that the field contains the end time of the event.
| 1.0
|-
| event.location
| Indicates that the field contains the location of the event.
| 1.0
|-
| event.category
| Indicates that the field contains the category of the event.
| 1.0
|}</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=25">
	<page_name>conf.ini_file</page_name>
	<page_id>25</page_id>
	<page_title>conf.ini_file</page_title>
	<content>==conf.ini File==

[[toc]]

The conf.ini file is where most of the application-level configuration information is stored for a Xataface application.  It contains information such as:

* database connection information
* which tables should appear in the tables menu.
* [[preferences|preference settings]]
* [[authentication]] settings
* which add-on [[modules]] are to be used
* output caching settings
* history/undo settings
* other misc settings.

Every conf.ini file must contain at least the following sections:


{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| _database
| Contains database connection info.
| all
|-
| _tables
| Contains a list of tables that are to be included in the navigation menu of the application.
| all
|}


The following optional sections may also be included:

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| [http://xataface.com/documentation/how-to/disallow_tables _allowed_tables]
| Specifies tables that should be explicitly allowed to override disallowed tables listed or matched in the [http://xataface.com/documentation/how-to/disallow_tables _disallowed_tables] section.
| 0.7
|-
| [[_auth]]
| Contains information about [[authentication]].
| 0.6
|-
| [http://xataface.com/documentation/how-to/disallow_tables _disallowed_tables]
| A list of tables or patterns that match tables that should be blocked from being accessed directly through the application.  By default any table beginning with an underscore, &apos;dataface_&apos;, or ending in &apos;__history&apos; are blocked.  This prevents unintended access to some of the automatically created tables in Xataface.
| 0.7
|-
| _feed
| Configuration options for [[Introduction_to_RSS_Feeds_in_Xataface|RSS feeds]] that are generated by the application.
| 1.0
|-
| _history
| Settings pertaining to the [http://xataface.com/documentation/how-to/history-howto history feature] (e.g. whether it has been enabled).
| 0.7
|-
| _index
| Settings for the full site search indexing.
| 1.0
|-
| _modules
| A list of [[modules]] that are enabled for this application.
| 1.0
|-
| [[_output_cache]]
| Output cache settings.  Using output caching can dramatically improve performance for busier sites.
| 0.8
|-
| _themes
| A list of the themes that are to be applied to the application.
| 0.8
|}

===Stand-alone Attributes===

Stand-alone attributes for an INI file must appear at the beginning of the INI file (before any of the sections).  The conf.ini may contain the following stand-alone attributes.

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Values
! Version
|-
| cache_queries
| Enables query caching.  Enabling this feature can yield drastic performance improvements especially on busy sites with large databases.
| boolean (0 or 1)
| 1.2

|-
| cache_queries_log
| Enables logging of query caching to the file /tmp/querylog.log so that you can tell whether your queries are being cached, and which ones are being cached.
| boolean (0 or 1)
| 1.2

|-
| default_action
| The default action to be performed if it is not explicitly specified in the query (e.g. &apos;list&apos;, &apos;find&apos;, &apos;edit&apos;).  Default is &apos;list&apos;.
| string
| 0.6
|-
| debug
| If this is set to 1, then the application will run in debug mode which displays the available slots and blocks on the screen, along with some other debug information.
| 0 or 1 (default is 0)
| 0.6

|-
| default_browse_action
| The default action to perform in the details tab.  E.g. When you click on the &quot;details&quot; tab there are a number of sub-tabs including &apos;view&apos;, &apos;edit&apos;, etc... .   The default value for this directive is &apos;view&apos;.  If you want to go directly to the edit form when clicking on a record in list view, you would set &apos;&apos;default_browse_action&apos;&apos; to &apos;edit&apos;.
| string
| 0.6
|-
| default_language
| The default language to use.  This is the 2-digit ISO language code.  If this value is not specified it defaults to the first language listed in the &apos;&apos;[languages]&apos;&apos; section.
| string (2-digit ISO language code)
| 0.6
|-
| default_limit
| The default limit (i.e. the number of records to show per page) if none is explicitly specified in the query.  Default is 30.
| int
| 0.6
|-
| default_table
| The default table to show if none is specified by the query.  If you do not define this value, then the first table in the &apos;&apos;[_tables]&apos;&apos; section is used.
| string
|0.6
|-
| disable_session_ip_check
| Default behaviour automatically tracks the IP address of the user when they log in.  If a request is made for a session from a different IP then the session is automatically destroyed and the user is logged out.
| boolean
| 1.3rc4

|-
| title
| A title for the application (appears in the browser title bar).
| string
| 0.6
|-
| usage_mode
| The usage mode of the application.  If this value is set to &apos;&apos;edit&apos;&apos;, then ajax inline editing is enabled (i.e. you can click on any value in the application to edit it inline.
| &apos;view&apos; or &apos;edit&apos;
| 0.6
|}

===Example 1: A simple conf.ini file===

&lt;code&gt;
[_database]
	host=&quot;localhost&quot;
	name=&quot;mydb&quot;
	user=&quot;mydbuser&quot;
	password=&quot;foo&quot;
	
[_tables]
webpage_sites=&quot;Websites&quot;
translations = &quot;Translations&quot;
packages=&quot;Packages&quot;
users=Users
proof_jobs=&quot;Jobs&quot;
webpage_status=&quot;Webpages Status&quot;

&lt;/code&gt;

===Example 2: A more complex conf.ini file===

&lt;code&gt;
;debug=1
;default_action=home
;google_translate_url=&quot;http://weblite-dns2.com/proxy.php&quot;
google_translate_url=&quot;http://ec2-75-101-244-123.compute-1.amazonaws.com/proxy.php&quot;
title=&quot;Web Lite Translate&quot;
default_price_per_word=0.15

;;Configuration settings for application
title=&quot;translation_weblite_ca&quot;
scriptUrl=&quot;http://translation.weblite.ca/index.php&quot;
multilingual_content=1


[_database]
	host=&quot;localhost&quot;
	name=&quot;mydb&quot;
	user=&quot;mydbuser&quot;
	password=&quot;foo&quot;
	
[_tables]
    webpage_sites=&quot;Websites&quot;
    translations = &quot;Translations&quot;
    packages=&quot;Packages&quot;
    users=Users
    proof_jobs=&quot;Jobs&quot;
    webpage_status=&quot;Webpages Status&quot;


[_auth]
	users_table=users
	username_column=username
	password_column=password
	secret_code=&quot;ljkasdfjkldsafliasdoiudsfoi&quot;
	allow_register=1
	session_timeout=999999999
	
[_modules]
	modules_ShoppingCart=&quot;modules/ShoppingCart/ShoppingCart.php&quot;

[ShoppingCart_taxes]
	;; This section is necessary to declare that we have NO taxes.
	
[metatags]
	keywords = &quot;translation, translate&quot;
	description = &quot;Good translation service&quot;
	
;[_output_cache]
;	enabled=1

[_mail]
	func=mail2
	
&lt;/code&gt;

</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=58">
	<page_name>Selected_Records_Actions</page_name>
	<page_id>58</page_id>
	<page_title>Selected_Records_Actions</page_title>
	<content>==Creating a Custom &apos;&apos;Selected Records&apos;&apos; Action==

[[toc]]

If you view the &apos;&apos;list&apos;&apos; tab in any of your Xataface applications, you&apos;ll notice that there is a checkbox next to each row of the list, and there are a number of actions listed at the bottom of the list that you can perform on the selected records.  Xataface comes pre-built with only a few of these actions:

# Delete selected
# Update selected
# Copy selected

However it is quite easy to add your own actions here that are performed on selected records.  This article describes exactly how to do this.

===What is a &apos;&apos;Selected Record&apos;&apos; action?===

A &apos;&apos;Selected Record&apos;&apos; action is no different than any other action in Xataface, except that it is meant to act on the records that have been selected in the list tab.

==Example Action:  Approve Records==

Consider a news site where news stories are automatically imported into the database en masse, but each news story has a field &apos;&apos;approved&apos;&apos; to indicate whether the store has been approved to appear on the site yet.   The usage pattern of this application involves a lot of looking through lists of news stories and approving them.  Therefore it would be convenient if the user could just select the rows that he wants to approve and click a button to approve them all.

Out of the box Xataface would allow the user to select the records, click &apos;&apos;update selected records&apos;&apos;, then update them all via the &apos;&apos;update selected records&apos;&apos; form.  But avoiding this extra step will improve usability greatly.

===Step 1: Design the Action===

First we need to specifically decide how our action will work.  In this case, the flow goes as follows:

# User selects the news items they want to approve.
# User clicks the &apos;&apos;Approve Selected&apos;&apos; button. (to be created)
# Our action approves the selected records.
# User is automatically redirected back to the list tab with a message stating how many records were successfully approved, and whether there were any errors.

===Step 2: Gather Our Tools===

Before we actually create the action, let&apos;s look at a few tools that we&apos;ll be using from the Xataface framework to make this happen.

# In the [[actions.ini file]], the &apos;&apos;[[selected_result_actions]]&apos;&apos; category is reserved for actions that act on selected records of the list tab.  E.g.&lt;code&gt;
[delete_selected]
    ...
    category=selected_result_actions
    ...
&lt;/code&gt;
# The [http://dataface.weblite.ca/df_get_selected_records df_get_selected_records()] function returns an array of [http://dataface.weblite.ca/Dataface_Record Dataface_Record] objects that represent the rows that were selected to initiate the action.  E.g.&lt;code&gt;
$app =&amp; Dataface_Application::getInstance();
$query =&amp; $app-&gt;getQuery();
$records = df_get_selected_records($query);
foreach ($records as $record){
    ...
}
&lt;/code&gt;
# The [http://dataface.weblite.ca/checkPermission Dataface_Record::checkPermission()] method allows us to see if the current user has access to a specific permission on the given record.  We&apos;ll use this method to ensure that the user has permission to approve the news record. E.g.&lt;code&gt;
if ( !$record-&gt;checkPermission(&apos;edit&apos;, array(&apos;field&apos;=&gt;&apos;approved&apos;)) ){
    return PEAR::raiseError(&quot;You don&apos;t have permission to edit the approved field for this record.&quot;);
}
&lt;/code&gt;
# The Xataface will pass the redirect URL where your action should send the user upon completion of the action as the &apos;&apos;--redirect&apos;&apos; attribute of the &apos;&apos;POST&apos;&apos; variables.  This value is base64_encoded so you&apos;ll need to decode it before redirecting.  E.g.:&lt;code&gt;
if ( @$_POST[&apos;--redirect&apos;] ) 
    $url = base64_decode($_POST[&apos;--redirect&apos;]);
$url .= &apos;&amp;--msg=&apos;.urlencode($updated.&apos; records were deleted.&apos;);
header(&apos;Location: &apos;.$url);
exit;
&lt;/code&gt;

===Step 3: Create the Action===

We will call our action &apos;&apos;approve_news&apos;&apos; so we&apos;ll place it in the &apos;&apos;actions/approve_news.php&apos;&apos; file of our application:
&lt;code&gt;
&lt;?php
class actions_approve_news {
    function handle(&amp;$params){
        // First get the selected records
        $app =&amp; Dataface_Application::getInstance();
        $query =&amp; $app-&gt;getQuery();
        $records =&amp; df_get_selected_records($query);

        $updated = 0;  // Count the number of records we update
        $errs = array();   // Log the errors we encounter

        foreach ($records as $rec){
            if ( !$rec-&gt;checkPermission(&apos;edit&apos;), array(&apos;field&apos;=&gt;&apos;approved&apos;)) ){
                $errs[] = Dataface_Error::permissionDenied(
                    &quot;You do not have permission to approve &apos;&quot;.
                    $rec-&gt;getTitle().
                    &quot;&apos; because you do not have the &apos;edit&apos; permission.&quot;);
                continue;
            }
            $rec-&gt;setValue(&apos;approved&apos;, 1);
 
            $res = $rec-&gt;save(true /*secure*/);
            if ( PEAR::isError($res) ) $errs[] = $res-&gt;getMessage();
            else $updated++;
            
        }
        
        if ( $errs ){
            // Errors occurred.  Let&apos;s let the user know.
            // The $_SESSION[&apos;--msg&apos;] content will be displayed to the user as a message
            // in the next page request.
            $_SESSION[&apos;--msg&apos;] = &apos;Errors Occurred:&lt;br/&gt; &apos;.implode(&apos;&lt;br/&gt; &apos;, $errs);
        } else {
            $_SESSION[&apos;--msg&apos;] = &quot;No errors occurred&quot;;
        }
        

        $url = $app-&gt;url(&apos;-action=list&apos;);   // A default URL in case no redirect was supplied
        if ( @$_POST[&apos;--redirect&apos;] ) $url = base64_decode($_POST[&apos;--redirect&apos;]);
        $url .= &apos;&amp;--msg=&apos;.urlencode($updated.&apos; records were deleted.&apos;);

        // Redirect back to the previous page
        header(&apos;Location: &apos;.$url);
        exit;
    }
}
&lt;/code&gt;

===Step 4: Add the action to your actions.ini file===

The actions.ini file allows us to specify how and where this action is used, and by whom.  We can specify permissions that are required to perform the action, conditions that are required to display the action, confirmation messages that are to be displayed to the user when they are about to perform the action, and more.  Our [[actions.ini file]] entry looks like:

&lt;code&gt;
[approve_news]
    label=&quot;Approve&quot;
    description=&quot;Approve selected records&quot;
    permission = edit
    category=selected_result_actions
    confirm=&quot;Are you sure you want to approve the selected records?&quot;
    icon=&quot;${dataface_site_url}/images/approve.gif&quot;
    condition=&quot;$query[&apos;-table&apos;] == &apos;news&apos;&quot;
&lt;/code&gt;

This should be fairly straight forward.  The only special items here are the &apos;&apos;category&apos;&apos; and &apos;&apos;confirm&apos;&apos; directives.  The &apos;&apos;condition&apos;&apos; directive tells Xataface that this action should only be shown for the &apos;&apos;news&apos;&apos; table. 

The &apos;&apos;confirm&apos;&apos; directive defines a confirmation message that should be displayed to the user when they attempt to approve records.

The &apos;&apos;icon&apos;&apos; directive allows you to specify the path to an icon to display for the action.  In our case we have an icon located in the images directory of our application.

===Step 5: Trying it out===

Now when we go to the &apos;&apos;list&apos;&apos; tab of the &apos;&apos;news&apos;&apos; table there is an &apos;&apos;Approve&apos;&apos; button along the bottom where it says &quot;With Selected&quot;.  You we can click on this button to approve any of the selected rows.


	</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=57">
	<page_name>Creating_a_Dashboard</page_name>
	<page_id>57</page_id>
	<page_title>Creating_a_Dashboard</page_title>
	<content>==Creating a Dashboard for your Users==

[[toc]]

Xataface allows you to build powerful data-driven applications quickly, but these applications may be daunting to your users if they don&apos;t know what they can do with the application.  Most applications provide some sort of dashboard or control panel with some introductory instructions and links to commonly used actions in the application.  This makes the application more intuitive for users so that they can start using it right away, even without instruction from the developer.

===Characteristics of a Dashboard===

# Should be the default page when someone visits the application.
# Should be customized to show menus and content that are relevant to the current user.  (i.e. different users may see different links and content on their dashboard).
# Should contain at least some basic instructions so that the user understands what the application does when he visits the dashboard for the first time.
# Should contain links to frequently used actions.

===Strategies: 8 ways to skin the cat===

There are many viable strategies for adding a dashboard to your Xataface application.  This article presents only one.  It has been chosen because it satisfies all of the desired characteristics of a dashboard listed above, and it is easy to implement.

This strategy involves the following components:

# Create a dummy &apos;&apos;dashboard&apos;&apos; table.
# Create a dashboard action and associated template.
# Make sure our dashboard action is the default action for our application (more complex than just using the [[default_action]] directive in the [[conf.ini file]].

==Our Sample Application==

Consider our sample application, a publications management system for professors and research groups at a university.  It allows users to manage their publications using either BibTex format or a web-based form, and embed those publications into their webpage in a slick sortable format.  Currently, when the user accesses the application for the first time, they are shown the &apos;&apos;list&apos;&apos; tab of the &apos;&apos;bibliographies&apos;&apos; table.  This isn&apos;t all that informative and it may not be obvious to the user that their first step should be to create a new bibliography via the &apos;&apos;new record&apos;&apos; button.  Ideally we would like the user to go directly to a dashboard page with options to:

# Add New Bibliography
# Edit an Existing Bibliography
# Embed a Bibliography into their Webpage

And we want some basic instructions so that the user knows what to do when they first access the page.

==The Steps==

To create this dashboard we will follow the steps listed below (and mentioned above in the &apos;&apos;strategies&apos;&apos; section.

===Step 1: Create a dummy &apos;&apos;dashboard&apos;&apos; table===

This may seem unorthodox but it just happens to make our lives easier in the long run.  By creating a dummy table we are able to cause that table to be listed first in the &apos;&apos;_tables&apos;&apos; section of the [[conf.ini file]] and thus be the default table when users visit our application.

&lt;code&gt;
CREATE TABLE dashboard (
    dashboard_id int(11) not null auto_increment primary key
);
INSERT INTO dashboard values (1);
&lt;/code&gt;

===Step 2: Make &apos;&apos;dashboard&apos;&apos; table default===

We now modify the conf.ini file to list the &apos;&apos;dashboard&apos;&apos; table first:
&lt;code&gt;
[_tables]
    dashboard=Dashboard
    bibliographies=Bibliographies
&lt;/code&gt;

===Step 3: Create a Dashboard action and associated template===

This is the step where we actually create our dashboard action.  There are three parts to this story:

====Creating Action PHP Class====

The actual action will be located in the &apos;&apos;actions/dashboard.php&apos;&apos; file of our application, and looks like:

&lt;code&gt;
&lt;?php
class actions_dashboard {
    function handle(&amp;$params){
        $bibs = df_get_records_array(&apos;bibliographies&apos;, array());
        df_display(array(&apos;bibliographies&apos;=&gt;$bibs), &apos;dashboard.html&apos;);
    }
}
&lt;/code&gt;

All this does is loads the &apos;&apos;bibliographies&apos;&apos; records owned by the current user. Elsewhere we are using security filters so that the user can only see &apos;&apos;his&apos;&apos; bibliographies, which is why we don&apos;t need to specify any query here in the &apos;&apos;df_get_records_array&apos;&apos; function.

It then passes those bibliographies to the &apos;&apos;dashboard.html&apos;&apos; template that we create next.

====Creating the Action&apos;s Template====

The template for our action is located in the &apos;&apos;templates/dashboard.html&apos;&apos; file:
&lt;code&gt;
{use_macro file=&quot;Dataface_Main_Template.html&quot;}
    {fill_slot name=&quot;main_column&quot;}
        &lt;h1&gt;Welcome to the BibTeX Publication Management System (BPMS)&lt;/h1&gt;
        
        &lt;p&gt;This system allows you to manage your publications and publish
        them on the web.  Some common actions you may perform with this system
        include:
            &lt;ul&gt;
                &lt;li&gt;&lt;img src=&quot;{$ENV.DATAFACE_URL}/images/add_icon.gif&quot;/&gt;
                    &lt;a href=&quot;{$ENV.DATAFACE_SITE_HREF}?-table=bibliographies&amp;-action=new&quot;&gt;
                        Create New Bibliography&lt;/a&gt;
                &lt;/li&gt;
                &lt;li&gt;&lt;img src=&quot;{$ENV.DATAFACE_URL}/images/edit.gif&quot;/&gt; 
                   Edit existing bibliography: 
                   &lt;select onchange=&quot;window.location.href=this.options[this.selectedIndex].value&quot;&gt;
                    &lt;option value=&quot;&quot;&gt;Select ...&lt;/option&gt;
                    {foreach from=$bibliographies item=bibliography}
                        &lt;option value=&quot;{$bibliography-&gt;getURL(&apos;-action=edit&apos;)}&quot;&gt;
                            {$bibliography-&gt;getTitle()}
                        &lt;/option&gt;
                    
                    {/foreach}
                &lt;/select&gt;
                &lt;/li&gt;
                &lt;li&gt;&lt;img src=&quot;{$ENV.DATAFACE_URL}/images/file.gif&quot;/&gt; 
                    Embed your bibliography in a webpage:
                    &lt;select onchange=&quot;window.location.href=this.options[this.selectedIndex].value&quot;&gt;
                    &lt;option value=&quot;&quot;&gt;Select ...&lt;/option&gt;
                    {foreach from=$bibliographies item=bibliography}
                        &lt;option value=&quot;{$bibliography-&gt;getURL(&apos;-action=view&apos;)}#embed&quot;&gt;
                            {$bibliography-&gt;getTitle()}
                        &lt;/option&gt;
                    
                {/foreach}
                &lt;/select&gt;
                &lt;/li&gt;
                
            &lt;/ul&gt;
    {/fill_slot}
{/use_macro}
&lt;/code&gt;

A few key things to notice in this template:

# It extends the &apos;&apos;Dataface_Main_Template.html&apos;&apos; template placing its content in the &apos;&apos;main_column&apos;&apos; slot.  This allows our action to still display within the header and footer of our application.
# It makes use of the {$ENV.DATAFACE_SITE_URL} and {$ENV.DATAFACE_SITE_HREF} variables to refer to the site&apos;s base url and create links to the desired common actions.
# It provides a direct link to the &apos;&apos;new bibliography record&apos;&apos; form.
# It uses some slick javascript combined with select lists to allow the user to select any of his current bibliogaphies and edit them, or embed them into a webpage.

====Adding entry to the actions.ini file====

Currently our dashboard action has no permissions attached to it so users can see it whether they are logged in or not.  In this particular application we want to require users to log in, and we have set permissions for all logged in users to NO_ACCESS().  Unfortunately this permission setting is only helpful if our action requires a particular permission to access it.  We&apos;ll require the &apos;view&apos; permission for this action, by adding the following to the actions.ini file:

&lt;code&gt;
[dashboard]
    permission=view
&lt;/code&gt;


===Step 4: Specify permissions===

We still want to specify permissions for our &apos;&apos;dashboard&apos;&apos; table to ensure that only logged in users can access the dashboard.  So we create a delegate class for the &apos;&apos;dashboard&apos;&apos; table at &apos;&apos;tables/dashboard/dashboard.php&apos;&apos; with the following contents:

&lt;code&gt;
&lt;?php
class tables_dashboard {
    function getPermissions(&amp;$record){
        if ( getUser() ){
            return Dataface_PermissionsTool::ALL();
        }
        return null;
    }
}
&lt;/code&gt;

&apos;&apos;&apos;Note that we have defined the getUser() function elsewhere as a means of obtaining the current user and checking if a user is indeed logged in.&apos;&apos;&apos;

Notice that this [[getPermissions]] method returns all permissions only if the user is logged in.  Otherwise it returns null, which means that it should use the same permissions as the rest of the application as defined in the [[Application Delegate Class]].

===Step 6: Make &apos;&apos;dashboard&apos;&apos; the default action for the &apos;&apos;dashboard&apos;&apos; table===

Now we just have one more detail that needs to be taken care of.  We want the &apos;&apos;dashboard&apos;&apos; action to be the default action for the &apos;&apos;dashboard&apos;&apos; table only.  By default we would see the &apos;&apos;list&apos;&apos; action which isn&apos;t helpful at all, so we will want to add a rule in our application delegate class to ensure that the user only sees our custom &apos;&apos;dashboard&apos;&apos; action if they access the &apos;&apos;dashboard&apos;&apos; table.  We define a beforeHandleRequest() method in our conf/ApplicationDelegate.php (the application delegate class) file for this purpose:

&lt;code&gt;
&lt;?php
class conf_ApplicationDelegate {
    
...
    function beforeHandleRequest(){
        ...
        $app =&amp; Dataface_Application::getInstance();
	$query =&amp; $app-&gt;getQuery();
	if ( $query[&apos;-table&apos;] == &apos;dashboard&apos; and ($query[&apos;-action&apos;] == &apos;browse&apos; or $query[&apos;-action&apos;] == &apos;list&apos;) ){
	    $query[&apos;-action&apos;] = &apos;dashboard&apos;;
	}
        
        
    }
    
    ...
}
&lt;/code&gt;

This simply checks to see if the table is &apos;&apos;dashboard&apos;&apos; and changes the current action to &apos;&apos;dashboard&apos;&apos; if so.

===Step 7: Try it out===

At this point, we are ready to try out our new dashboard to see how it works.  When we load our application it should now go to the dashboard action that we created.  We should also see &apos;&apos;Dashboard&apos;&apos; listed as the first table in the tables menu.

This dashboard presents a major improvement to our application as it is now much more user friendly.

&lt;nowiki&gt;
&lt;img src=&quot;http://media.weblite.ca/files/photos/pub-dashboard.png?max_width=640&quot;/&gt;
&lt;/nowiki&gt;</content>
	<keywords>dashboard</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=7">
	<page_name>Delegate_class_methods</page_name>
	<page_id>7</page_id>
	<page_title>Delegate_class_methods</page_title>
	<content>==Delegate Class Reference==

[[toc]]

A delegate class is a PHP class that complements a particular table with custom bahaviors.  Basic table metadata can be supplied using the [[fields.ini file]], however some things are better customized using PHP.

===Delegate Class Location===

The delegate class should be located in a file named TABLENAME.php (where TABLENAME is the name of the table with which the delegate class is associated) inside the table&apos;s [[table configuration directory|configuration directory]].  E.g. given a table named &quot;people&quot;, you would place the delegate class in the file &quot;tables/people/people.php&quot;

===Basic Delegate Class===

&lt;code&gt;
&lt;?php
class tables_people {}
?&gt;
&lt;/code&gt;

===Available Methods===

====Table Settings====

{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| [[sql delegate method|__sql__]]
| Defines the SQL query that can be used to fetch records of this table.  This is identical to the [[fields.ini file]] [[__sql__]] directive, except that by defining it in the delegate class you have more flexibility.
| 1.0
|}

====Permissions====

{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| [[getPermissions]]
| Returns the permissions available for a given record.
| 0.6
|-
| getRoles
| Returns the roles allowed for a given record.
| 1.0
|-
| [[__field__permissions]]
| Returns the default permissions for a field of a given record.
| 1.0
|-
| __field__roles
| Returns the default roles for a field of a given record.
| 1.0
|-
| [[fieldname__permissions]]
| Returns the permissions that are allowed for the field &quot;fieldname&quot; on a given record.
| 0.7
|-
| fieldname__roles
| Returns the roles that are allowed for the field &quot;fieldname&quot; on a given record.
| 1.0
|-
| rel_relationshipname__permissions
| Returns the permissions pertaining to the relationship &apos;&apos;relationshipname&apos;&apos; on a given record.
| 1.0
|-
| rel_relationshipname__roles
| Returns the role or roles pertaining to the relationship &apos;&apos;relationshipname&apos;&apos; on a given record.
| 1.0
|}

====Triggers====

{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| [[after_action_edit]]
| Trigger called after the edit action is succesfully completed.
| 0.7
|-
| [[after_action_new]]
| Trigger called after the new action is successfully completed.
| 0.7
|-
| [[after_action_delete]]
| Trigger called after the delete action is successfully completed.
| 0.7
|-
| [[afterAddExistingRelatedRecord]]
| Trigger called after an existing related record is added.
| 0.5
|-
| [[aftereAddNewRelatedRecord]]
| Trigger called after a new related record is added.
| 0.5
|-
| [[afterCopy]]
| Trigger called after a record is copied.
| 1.3
|-
| [[afterDelete]]
| Trigger called after a record is deleted.
|0.5
|-
| [[afterAddRelatedRecord]]
| Trigger called after a related record of this table is added (either an existing record or a new record).
| 0.5
|-
| [[afterRemoveRelatedRecord]]
| Trigger called after a related record is removed from a relationship.
| 1.1.6
|-
| [[afterInsert]]
| Trigger called after a given record is inserted.
| 0.5
|-
| [[afterSave]]
| Trigger called after a given record is saved (insert or update).
| 0.5
|-
| [[afterUpdate]]
| Trigger called after a given record is updated.
| 0.5
|-
| [[beforeAddExistingRelatedRecord]]
| Trigger called before an existing related record is added.
| 0.5
|-
| [[beforeAddNewRelatedRecord]]
| Trigger called before a new related record is added.
| 0.5
|-
| [[beforeAddRelatedRecord]]
| Trigger called before a related record of this table is added (either an existing record or a new record).
| 0.5
|-
| [[beforeCopy]]
| Trigger called before a record is copied.
| 1.3
|-
| [[beforeDelete]]
| Trigger called before a record is deleted.
| 0.5
|-
| [[beforeRemoveRelatedRecord]]
| Trigger called before a related record is removed.
| 1.1.6
|-
| [[beforeSave]]
| Trigger called before a given record is saved (insert or update).
| 0.5
|-
| [[beforeInsert]]
| Trigger called before a given record is inserted.
| 0.5
|-
| [[beforeUpdate]]
| Trigger called before a given record is updated.
| 0.5
|-
| [[init]]
| This method is called the first time the table is loaded.  It allows you to specify initialization details.
| 0.8
|}


====Field Filters====

{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| fieldname__htmlValue
| Returns the value of the field &quot;fieldname&quot; for a given record as HTML.
| 0.5
|-
| fieldname__display
| Returns the value of the field &quot;fieldname&quot; appropriate for displaying.
| 0.5
|-
| [[fieldname__default]]
| Returns the default value for the field &apos;&apos;fieldname&apos;&apos;.  New record forms will be prepopulated with this value.
| 0.7
|-
| [[fieldname__validate]]
| Validates the input for the field &apos;&apos;fieldname&apos;&apos;.
| 0.6
|-
| fieldname__parse
| Parses the input value for the field &apos;&apos;fieldname&apos;&apos;.  This is called by Xataface inside the setValue() method or each record to normalize input values before they are stored in the object (not the database).
| 0.5
|-
| fieldname__toString
| Converts the value of the field &apos;&apos;fieldname&apos;&apos; to a string.  This string representation is used as the basis for most higher level data retrieval methods (such as serialize and display).  This could be treated as an inverse to the [[fieldname__parse]] method.
| 0.5
|-
| fieldname__serialize
| Converts a value of the field &apos;&apos;fieldname&apos;&apos; to be saved in the database.  This should return a string representation of the value that is suitable for database storage.
| 0.5
|-
| fieldname__link
| A link that appears beside the field &apos;&apos;fieldname&apos;&apos; on the edit form.
| 0.6
|-
| [[field__pushValue]]
| Converts form input for field &apos;&apos;fieldname&apos;&apos; to be ready to store in a Dataface_Record.
| 0.6
|-
| [[field__pullValue]]
| Converts a value for field &apos;&apos;fieldname&apos;&apos; in a Dataface_Record object to be ready to be inserted as a value on an HTML form.
| 0.6
|-
| [[field__fieldname]]
| Effectively creates a calculated field named &quot;fieldname&quot; available on the given record.
| 0.6
|-
| [[no_access_text]]
| Replace the default NO ACCESS permission text with another text.
| 1.1.6
|-
| [[no_access_link]]
| Replace the default link of the NO ACCESS permission link with another link.
| 1.1.6
|}

====Template Customization====
{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| [[block__blockname]]
| Outputs content that is meant to override a slot or a block named &quot;blockname&quot;.
| 0.6
|}

====List Tab Customization====

{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| css__tableHeaderCellClass
| Returns a custom CSS class for a table header cell (th tag) in the list view.  Takes the name of a table column as a parameter.
| 2.0alpha2
|-
| css__tableRowClass
| Returns a custom CSS class for a table row (tr tag) in list view.  Takes a Dataface record as a parameter.
| 1.2
|-
| fieldname__renderCell
| Overrides the table cell content for the &quot;fieldname&quot; field in list view with custom HTML.
| 1.0
|-
| renderRow
| Overrides the the html used for a row in list view for the given record.
| 0.7
|-
| renderRowHeader
| Overrides the header for the table in list view.
| 0.7
|-
| renderRelatedRow
| Overrides the html used for a row in a related record list for a given related record.
| 1.0 beta 4
|-
| renderRelatedRowHeader
| Overrides the html used for the header in a related list.
| 1.0 beta 4
|}

====Record Metadata====
{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| [[getBreadCrumbs]]
| Returns the bread crumbs (i.e. you are here) for a given record as an associative array of path parts.
| 0.6
|-
| [[getChildren]]
| Returns a list of Dataface_Record objects that are to be considered children of the given record.
| 0.8
|-
| [[getCreated]]
| Returns a unix timestamp marking the date that a record was created. 
| 0.9
|-
| getDescription
| Returns a string description summary of this record.  This is used for indexing, RSS feeds, and anywhere that a brief summary of a record is appropriate.
| 0.7
|-
| getPublicLink
| Returns the public URL of this record (in case it is different than the standard URL).
| 0.8
|-
| getTitle
| Returns the title for a given record.  The title is used in various parts of the application to represent the record.
| 0.5
|-
| [[getURL]]
| Overrides the getURL() method for a record.  Returns the URL that should be used to display the given record.
| 0.6
|-
| titleColumn
| Returns a string SQL select expression that is used to describe the title of records.
| 0.5
|}

====View Tab Customization====

{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| [[How_to_Add_Custom_Sections_to_View_Tab|section__sectionname]]
| Defines a section to be displayed in the view tab for the given record.
| 0.7
|}


====Search Setup====
{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| getSearchableText
| If [[_index|Indexing]] is turned on, then this returns the text that should be stored in the index for this record for searchability.
| 1.0
|}

====RSS Feed Customization====
{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| [[getFeedItem]]
| For RSS Feeds, overrides the defaults and returns an associative array with feed elements for a particular record
| 1.0
|-
| [[getFeed]]
| For RSS feeds, overrides the default feed for a query, returning an array of feed items.
| 1.0
|-
| getFeedSource
| Overrides the default feed source parameter for an RSS feed.
| 1.0
|-
| [[getRelatedFeed]]
| For RSS feeds, overrides the default feed for a related feed.
| 1.0
|-
| getRSSDescription
| Overrides the default generated RSS description for a record.
| 1.0
|}

===XML Output Customization===
{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| [[toXML]]
| Overrides the default XML produced for a record in the [[export xml]] action.  Returns an XML string.
| 1.2.7
|-
| [[getXMLHead]]
| Returns a string to be included at the beginning of XML output for a particular record. (just inside the opening tag).
| 1.2.7
|-
| [[xmlTail]]
| Returns a string to be included at the end of XML output for a particular record. (just inside the closing tag).
| 1.2.7
|}

====Valuelist Customization====
{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| [[valuelist__valuelistname]]
| Defines a valuelist named &apos;&apos;valuelistname&apos;&apos;.
| 0.7
|}


====Importing Records====
{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| [[__import__filtername]]
| Defines an import filter to named &apos;&apos;filtername&apos;&apos; which is used to import records into the table.
| 0.7
|}
</content>
	<keywords>RSS,Feeds,delegate classes, triggers</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=1">
	<page_name>index_page</page_name>
	<page_id>1</page_id>
	<page_title>index_page</page_title>
	<content>==Documentation==

[[toc]]

===Introductory===

* [[about|About Xataface]]
* [http://xataface.com/documentation/tutorial/getting_started Getting Started Tutorial]
* [[How to build a PHP MySQL Application with 4 lines of code]]
* [[Troubleshooting]]

===Reference===

* [http://dataface.weblite.ca API Docs]
* [[conf.ini file]] directives
* [[fields.ini file]] directives
* [[valuelists.ini file]] directives
* [[relationships.ini file]] directives
* [[Delegate class methods]]
* [[Application Delegate Class]]
* [[permissions.ini file]] directives
* [[actions.ini file]] directives
* [[preferences|User Preferences]] - options for customizing the application further via the getPreferences() method.
* [[xataface templates|templates]]
* &apos;&apos;&apos;[[URL Conventions]]&apos;&apos;&apos; - Learn how to use Xataface&apos;s URL conventions to form URLs that return exactly the result set that you want.
* &apos;&apos;&apos;[[Roadmap]]&apos;&apos;&apos; - What is planned for the next releases of Xataface

===Cook Book===

* [[Customizing Theme Based on IP Address]] - An article on storing IP addresses in the database and showing users a different theme depending on which range of IP addresses they are connecting from.

===By Topic===

====Installation====

* &apos;&apos;&apos;[http://xataface.com/documentation/tutorial/getting_started/installation Xataface Installation Instructions]&apos;&apos;&apos; - This document explains how to install Xataface on your system.  It does not describe how to create an application with Xataface.
* &apos;&apos;&apos;[http://xataface.com/documentation/tutorial/getting_started/first_application Creating your first App]&apos;&apos;&apos; - How to create an application using Xataface (from the Getting Started Tutorial)
* &apos;&apos;&apos;[[about|About Xataface]]&apos;&apos;&apos; - Quick overview of Xataface.  Includes a 6 step example of creating an application with Xataface.

====Configuration====

* &apos;&apos;&apos;[http://xataface.com/documentation/tutorial/getting_started/customizing Customizing field labels, descriptions, and widgets]&apos;&apos;&apos; - This document explains how to customize some basic aspects of your application&apos;s edit forms. (From the Getting Started tutorial).
* &apos;&apos;&apos;[http://xataface.com/documentation/tutorial/getting_started/valuelists Using Valuelists]&apos;&apos;&apos; - How to use valuelists to set up options for your select lists and checkbox groups.
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/list_tab Configuring and customizing the list tab]&apos;&apos;&apos; -     This document explains how to customize the display of the list tab using INI files, templates, and delegate classes.


====Internationalization====

* &apos;&apos;&apos;[[Contribute to Xataface Translation Project]]&apos;&apos;&apos; - We need translators to help us keep the Xataface translations up to date.  This page shows how you can help.
* &apos;&apos;&apos;[http://xataface.com/documentation/tutorial/internationalization-with-dataface-0.6 Internationalization with Xataface]&apos;&apos;&apos; (tutorial)
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/how-to-internationalize-your-application How to internationalize your application]&apos;&apos;&apos; (how to) - Xataface 0.6 contains a LanguageTool class that allows your applications to be presented in multiple languages
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/use-translations How to use other translations]&apos;&apos;&apos; - Xataface 0.7 includes German and French translations. This document explains how to allow your application to use these and other translations, rather than the default English translation.
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/unicode How to enable unicode support]&apos;&apos;&apos; -     As of Xataface 0.6, unicode is fully supported so that your dataface application will work with any and multiple languages simultaneously.
* &apos;&apos;&apos;[http://weblite.ca/svn/dataface/core/trunk/lang Download latest language files out of SVN]&apos;&apos;&apos; - If you want to make sure that you have the latest translations, you can download them from SVN and place them into your xataface lang directory.


====User Interface Customization====

* &apos;&apos;&apos;[[preferences|User Preferences]]&apos;&apos;&apos; - You can hide, show, enable, and disable features of the application selectively.
* &apos;&apos;&apos;[http://xataface.com/documentation/tutorial/getting_started/changing-look-and-feel Changing the Look and Feel]&apos;&apos;&apos; - Change the way your application looks by adding custom headers, footers, and sections, and by overriding the default templates with your own custom templates.  (From the Getting Started tutorial).
* [[xataface templates|templates]]
* &apos;&apos;&apos;[http://xataface.com/documentation/tutorial/customizing-the-dataface-look-and-feel Customizing the Xataface look and feel]&apos;&apos;&apos; tutorial
* &apos;&apos;&apos;[[Customizing the look and feel of a row or a cell| Customizing the look and feel of an element in the list view]]&apos;&apos;&apos; - Personnalize the aspect of each part of your list according to its content.
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/custom_javascripts How to include custom javascripts and stylesheets]&apos;&apos;&apos; - Use the custom_javascripts and custom_stylesheets blocks to include your own custom javascript and CSS files in your application.
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/hide_search How to hide the search box]&apos;&apos;&apos; -     The full-text search box that appears in the upper right can easily be removed.
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/list_tab Configuring and customizing the list tab]&apos;&apos;&apos; -     This document explains how to customize the display of the list tab using INI files, templates, and delegate classes.
* &apos;&apos;&apos;[[How to Add Custom Sections to View Tab]]&apos;&apos;&apos; - The &apos;&apos;View&apos;&apos; tab in a Xataface application can be configured in many ways.  This tutorial shows you how to add your own custom sections to the view tab.
* &apos;&apos;&apos;[[Creating a Dashboard]]&apos;&apos;&apos; - Create a dashboard action for your users to so that they have a logical starting point in your application.
* &apos;&apos;&apos;[[Grafted fields]]&apos;&apos;&apos; - Add a grafted field to your table for user convenience. You can use it also to be able to sort columns with relative tables content.
* &apos;&apos;&apos;[[Clean the html for the export]]&apos;&apos;&apos; - Clean the HTML tags and entities for the export in CSV or XML.

====Using the API====

* &apos;&apos;&apos;[[Introduction to the Xataface API]]&apos;&apos;&apos; - A short introduction to the classes, methods, and functions available in the Xataface API.
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/how-to-define-custom-serialization-for-fields How to define custom serialization for fields]&apos;&apos;&apos;

====Security====

* &apos;&apos;&apos;[[authentication]]&apos;&apos;&apos; - Overview of Xataface Authentication
* &apos;&apos;&apos;[[registration form]]&apos;&apos;&apos; - Enabling User Registration in Xataface
* &apos;&apos;&apos;[[permissions.ini file]]&apos;&apos;&apos; - Reference of the permissions.ini file directives.
* &apos;&apos;&apos;[http://xataface.com/documentation/tutorial/getting_started/permissions Permissions]&apos;&apos;&apos; - Use sessions and delegate classes to define permissions at the record and field level. (From the Getting Started tutorial).
* &apos;&apos;&apos;[[Cached permissions]]&apos;&apos;&apos; - Use cached perms for complex queries inside getPermissions()
* &apos;&apos;&apos;[[Delegate_class_methods#toc5|Delegate class methods]]&apos;&apos;&apos; - Permissions-related functions
* &apos;&apos;&apos;[[Relationship Permissions]]&apos;&apos;&apos; - Guide to permissions on related records.
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/disallow_tables How to disallow access to tables]&apos;&apos;&apos;
* &apos;&apos;&apos;[[site_with_backoffice]]&apos;&apos;&apos; - A site with a backoffice without obligation to log in
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/security_filters Security Filters]&apos;&apos;&apos; - Use security filters to block users from seeing certain records.
* &apos;&apos;&apos;[[How to granulate permissions on each field]]&apos;&apos;&apos; - Decide for each field who can edit, read...
** &apos;&apos;&apos;[[no_access_text]]&apos;&apos;&apos; - Replace the default NO ACCESS permission text with another text.
* &apos;&apos;&apos;[[LDAP or Active Directory]]&apos;&apos;&apos; - How to authenticate users with LDAP or Active Directory...

====Performance====

* &apos;&apos;&apos;[http://xataface.blogspot.com/2009/06/using-query-caching-in-xataface.html Using Query Caching]&apos;&apos;&apos; - Query caching can drastically improve performance of busy applications with large databases.  This article explains how to enable this caching in your Xataface application.
* &apos;&apos;&apos;[[_output_cache]]&apos;&apos;&apos; - Xataface does quite a bit of heavy lifting on each page request. If your application is getting a lot of traffic that is slowing your server down, you may want to look at enabling the Xataface output cache.

====Modules====

* [[modules]] - Available Xataface Modules.  This includes such things as CAPTCHA validation, editable javascript grids, and more.
* [[Module Developers Guide]] - A guide / Tutorial on how to develop your own Xataface modules.

====Preferences====

====Relationships====

* &apos;&apos;&apos;[http://xataface.com/documentation/tutorial/getting_started/relationships Relationships]&apos;&apos;&apos; - Xataface allows you to define relationships between tables using the relationships.ini file. (From the Getting Started Tutorial)
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/how-to-assign-order-to-related-records How to assign order to related records]&apos;&apos;&apos; -     Sometimes it is desirable for the records in a relationship to take on a particular default order. Dataface 0.6 makes this easy if you follow a few conventions.
* &apos;&apos;&apos;[[Drag and Drop Reordering of Relationships]]&apos;&apos;&apos; - A more in-depth tutorial about adding ordering to relationships.
* &apos;&apos;&apos;[[relationships.ini file]] reference
* &apos;&apos;&apos;[[Relationship Permissions]]


====Forms====

* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/DisableEnterKeyInFields How to disable the enter key in forms]&apos;&apos;&apos;
* &apos;&apos;&apos;[http://xataface.com/documentation/tutorial/getting_started/customizing Customizing field labels, descriptions, and widgets]&apos;&apos;&apos; - This document explains how to customize some basic aspects of your application&apos;s edit forms. (From the Getting Started tutorial).
* &apos;&apos;&apos;[http://xataface.com/documentation/tutorial/getting_started/valuelists Using Valuelists]&apos;&apos;&apos; - How to use valuelists to set up options for your select lists and checkbox groups. (From the Getting Started tutorial)
* &apos;&apos;&apos;[http://xataface.com/documentation/tutorial/getting_started/validation Form Validation]&apos;&apos;&apos; - Xataface allows you to add validation rules to fields using the fields.ini file.  (From the Getting Started tutorial).
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/how-to-handle-file-uploads How to handle file uploads]&apos;&apos;&apos; -     Xataface allows you to store file uploads in BLOB fields or on the file system.
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/custom_validation How to add custom validation with delegate classes]&apos;&apos;&apos; - If the standard validators (e.g., required, email, regex, etc..) don&apos;t quite cut it for your validation rules, Xataface allows you to define custom validation methods in the delegate class.
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/regex_validation Validating with regular expressions]&apos;&apos;&apos; - How to validate input into a field using regular expressions.
* &apos;&apos;&apos;[[Dynamic select boxes]]&apos;&apos;&apos; -     How to create two dynamic javascript select boxes from the valuelists.

====Importing====

* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/import_filters Import Filters]&apos;&apos;&apos; - It is common to need to import records en masse into a database. This is what import filters are for. (Since 0.7).

====Actions====

* &apos;&apos;&apos;[http://xataface.com/documentation/tutorial/getting_started/dataface_actions Actions I: The Basics]&apos;&apos;&apos; - Web Lite&apos;s actions framework allows you to customize existing actions (e.g. new, edit, find) and create your own new actions. (From the Getting Started Tutorial).
* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/after_action_triggers Adding triggers to actions]&apos;&apos;&apos; -     Xataface 0.6.1 adds some triggers to actions so that the developer can define custom functionality to be performed after an action has successfullly taken place.
* &apos;&apos;&apos;[[Calendar Action]]&apos;&apos;&apos; - Using the built-in calendar action to add a full-fledged event calendar to your application.
* &apos;&apos;&apos;[[Creating a Dashboard]]&apos;&apos;&apos; - Create a dashboard action for your users to so that they have a logical starting point in your application.
* &apos;&apos;&apos;[[Selected Records Actions]]&apos;&apos;&apos; - Create custom actions that are performed on records that have been selected in the list tab.
* &apos;&apos;&apos;[[Creating Printable Reports]]&apos;&apos;&apos; - Create a custom printable report using a custom action.
* &apos;&apos;&apos;[[Using RecordGrid]]&apos;&apos;&apos; - Using Dataface_RecordGrid to print data in tabular form.

====History====

* &apos;&apos;&apos;[http://xataface.com/documentation/how-to/history-howto How to activate history logging]&apos;&apos;&apos; -     Xataface 0.6.9 comes with support for managing the history of your records. This how-to shows you how to enable and use this feature.

====RSS Feeds====

* &apos;&apos;&apos;[[Introduction to RSS Feeds in Xataface]]&apos;&apos;&apos; - Xataface provides RSS feeds to any found set in your application.  This tutorial shows how it works and how you can configure these feeds to get your desired results.

====Event Calendar====

* &apos;&apos;&apos;[[Calendar Action]]&apos;&apos;&apos; - Introduction to the Xataface calendar action which can be used to convert your application into a full-fledged event calendar.
</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=39">
	<page_name>Drag_and_Drop_Reordering_of_Relationships</page_name>
	<page_id>39</page_id>
	<page_title>Drag_and_Drop_Reordering_of_Relationships</page_title>
	<content>==Drag and Drop Reordering of Related Records in Xataface==

One powerful aspect of Xataface is its abstraction of relationships between tables.  Once you define a relationship users can browse related records, add new and existing related records, and delete related records to or from the relationship.  For example, suppose you have a &apos;&apos;people&apos;&apos; table and a &apos;&apos;publications&apos;&apos;, you could define a relationship from &apos;&apos;people&apos;&apos; to &apos;&apos;publications&apos;&apos; to identify publications that belong to a particular person.  The table&apos;s might look something like:

===people table===

{| class=&quot;listing listing2&quot;
! person_id
! person_name
|-
| 1
| John Smith
|-
| 2
| Ben Stein
|-
| 3
| Harley Davidson
|-
| 4
| Trevor Linden
|}


===publications table===

{| class=&quot;listing listing2&quot;
! publication_id
! owner_id
! pub_title
|-
| 1
| 2
| Introduction to widgetry
|-
| 2
| 2
| Intermediate Widgetry
|-
| 3
| 2
| Advanced Widgetry
|-
| 4
| 3
| How to play the violin
|}


See http://xataface.com/documentation/tutorial/getting_started/relationships for an introduction to relationships in Xataface, and how to define them.

Our relationship definition in the  &apos;&apos;people&apos;&apos; table&apos;s [[relationships.ini file]] might look something like:

&lt;code&gt;
[my_pubications]
    publications.owner_id=&quot;$person_id&quot;
&lt;/code&gt;

This indicates that any publication whose &apos;&apos;owner_id&apos;&apos; column matches the current &apos;&apos;people&apos;&apos; record&apos;s &apos;&apos;person_id&apos;&apos; field is considered part of the relationship.  Using our example data above, this would mean that Ben Stein&apos;s &apos;&apos;my_publications&apos;&apos; relationship would contain 3 records: &quot;Introduction to Widgetry&quot;, &quot;Intermediate Widgetry&quot;, and &quot;Advanced Widgetry&quot;.  In our Xataface application this means that in the &quot;Details&quot; tab for the &quot;Ben Stein&quot; record, we would see a sub-tab &apos;&apos;My Publications&apos;&apos; which would contain a list of Ben Stein&apos;s publications.

===Adding Publication Order===

Now that we have our relationship, what if Ben Stein wants his publications to appear in a particular order whenever they are displayed to the user.  Xataface allows us to specify an &quot;order&quot; column for our relationship, which will cause the related records to be orderable by drag and drop (if the user has appropriate permissions).

# Add a field to the &apos;&apos;publications&apos;&apos; table named &quot;pub_order&quot;
# Change the relationship definition in the people table&apos;s [[relationships.ini file]] to tell Xataface to use the pub_order field for sorting:&lt;code&gt;
[my_pubications]
    publications.owner_id=&quot;$person_id&quot;
    metafields:order=&quot;pub_order&quot;
&lt;/code&gt;

Now load up your application and navigate to the &quot;My Publications&quot; tab for the &quot;Ben Stein&quot; record. Now you&apos;re able to drag and drop rows in your application to reorder them.

===Permission to Reorder Records===

Only users who have been assigned the &apos;&apos;reorder_related_records&apos;&apos; permission for a record&apos;s relationship are allowed to reorder records of that relationship.  By default the &apos;&apos;EDIT&apos;&apos; role contains this permission, as does any role that permits the user to edit the parent record of the relationship.  The &apos;&apos;READ ONLY&apos;&apos; role does not contain this permission.  If you want to explicitly deny this permission for all relationships in a record, you can simply set this permission to 0 in the associated role within your application&apos;s [[permissions.ini file]]:

&lt;code&gt;
[MY ROLE]
     reorder_related_records=0
&lt;/code&gt;

For more information about permssions see:

* [[permissions.ini file|The Permissions.ini file reference]]
* [http://xataface.com/documentation/tutorial/getting_started/permissions Introduction to Permissions]

===Loading Related Records using the Xataface API===

The ordering that is set via this drag and drop method is also honoured by the Xataface API when fetching related records.  You can load related records using the [http://dataface.weblite.ca/getRelatedRecordObjects getRelatedRecordObjects] method of the [http://dataface.weblite.ca/Dataface_Record Dataface_Record] class. E.g.

&lt;code&gt;
$benStein = df_get_record(&apos;people&apos;, array(&apos;person_id&apos;=&gt;2));
$pubs = $benStein-&gt;getRelatedRecordObjects(&apos;my_publications&apos;);
foreach ($pubs as $pub){
    echo $pub-&gt;val(&apos;pub_title&apos;).&apos;&lt;br/&gt;&apos;;
}
&lt;/code&gt;
This will list up to the first 30 publications of Ben stein in the order prescribed by our drag and drop ordering scheme.
</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=29">
	<page_name>encryption</page_name>
	<page_id>29</page_id>
	<page_title>encryption</page_title>
	<content>==encryption [[fields.ini file]] directive==

The &apos;&apos;&apos;encryption&apos;&apos;&apos; directive is meant to be used on password fields only.  It specifies that a certain type of encryption is to be used in the storing of values in this field.  For example, many PHP/MySQL applications use MD5 encryption to store their passwords.  If you want your Xataface application to be able to use the same users tables, then you&apos;ll need to specify the &apos;&apos;&apos;encryption&apos;&apos;&apos; directive for the password field.

===Possible Values===

{| class=&quot;listing listing2&quot;
|-
! Value
! Meaning
! Version
|-
| md5
| MD5 encryption
| 0.6
|-
| sha1
| SHA1 encryption
| 1.0
|-
| encrypt
| MySQL encrypt function
| 1.0
|-
| password
| MySQL password encryption
| 1.0
|}


===E.g. in the users table [[fields.ini file]]===

&lt;code&gt;
[password]
   encryption=md5
&lt;/code&gt;
    </content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=47">
	<page_name>visibility:fieldName</page_name>
	<page_id>47</page_id>
	<page_title>visibility:fieldName</page_title>
	<content>==Example==

&lt;code&gt;visibility:ConferenceID = hidden&lt;/code&gt;

This will make the ConferenceID in the relationship list view disappear.</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=53">
	<page_name>fieldname__permissions</page_name>
	<page_id>53</page_id>
	<page_title>fieldname__permissions</page_title>
	<content>==fieldname__permissions() method==

[[toc]]

The fieldname__permissions() methods will allow you to define custom permissions on a particular field in the [[delegate class]].  For example to specify permissions on a field named &apos;&apos;foo&apos;&apos; you would define the &apos;&apos;foo__permissions()&apos;&apos; method, and to define permissions on a field named &apos;&apos;role&apos;&apos; you would define the &apos;&apos;role__permissions()&apos;&apos; method.


==Example #1==

(Note this example needs to be refined to be more clear)

&lt;code&gt;
function approval_level__permissions(&amp;$record){
	return array(&apos;edit&apos;=&gt;0); //this is will merge with what the permissions for the normal record
}
&lt;/code&gt;

Here we are targeting the &apos;&apos;approval_level&apos;&apos; field of the [[delegate class]].  The permissions method takes a return value an array of permissions.  So for example:

&lt;code&gt;
$permissions[&apos;new&apos;] = 0;
$permissions[&apos;edit&apos;] = 0;
&lt;/code&gt;

Would be an example of an array of permissions which the key being the permission name and the value being a boolean to specify whether they have (1) or don&apos;t (0) have permissions to that field.  We don&apos;t have to specify a complete array of permissions (ie. permission of edit, new, readonly, etc, etc), but rather only the ones we want specifically.  The reason being that the permissions array in the return value gets merged with the permissions that this record normally gets from the record permissions.

So if the record normally gives the permissions new=0, edit=1.  Then the return value from approval_level will merge with the original permissions to produce an array like this:

&lt;code&gt;
$permissions[&apos;new&apos;] = 0;
$permissions[&apos;edit&apos;] = 1;
&lt;/code&gt;

=== Also See: ===

* [[How_to_granulate_permissions_on_each_field]]
* [[__field__permissions]]</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=3">
	<page_name>fields.ini_file</page_name>
	<page_id>3</page_id>
	<page_title>fields.ini_file</page_title>
	<content>==fields.ini File Reference==

[[toc]]

===Overview===

The fields.ini file is a configuration file which is associated with a single table of a database application.  It provides metadata about the table&apos;s fields to help Xataface dictate how they should be included in the application.  This includes metadata such as

* [[widget:type|Widget type]] - To specify the type of widget that should be used to edit content in the field (e.g. text, select, checkbox).
* [[widget:label|Label]] - The labels that can be used in column headers and on forms.
* [[widget:description|Help text]] - for forms to inform the user how data should be entered.
* [[group|Field Groupings]]
* [[widget:atts|widget:atts]] - To use javascripts in event handlers
* and more

Although a table doesn&apos;t need to have an associated fields.ini file in order for the application to work, each table can have one; and it is always located in the [[table configuration directory]].  For example, the fields.ini file for the [[people]] table would be located at [[Site Root]]/tables/people/fields.ini file.

===Syntax===

The fields.ini file uses [[standard INI syntax]] (just like the php.ini file), where each section corresponds to a column in the table. 

For example, consider a table &quot;people&quot; with columns &quot;first_name&quot;, &quot;last_name&quot;, and &quot;age&quot;.  The fields.ini file for the people table could then contain sections for each of its columns as follows:

&lt;code&gt;
[first_name]

[last_name]

[age]
&lt;/code&gt;

In this example the sections are empty (i.e. they have no directives, but we could easily add some directives:

&lt;code&gt;
[first_name]
    widget:description=&quot;Please enter your first name&quot;
    widget:label=&quot;Given Name&quot;

...etc...
&lt;/code&gt;

Here we have told Xataface that the first name field should include some help text (using the [[widget:description]] directive) on its edit form.

===Example fields.ini file===
&lt;code&gt;

;; Global directives applied to every field (requires Xataface 1.2.6)
[__global__]
	visibility:list=hidden

[isbn]
widget:label = ISBN
visibility:list=visible


[copyright_year]
widget:label = &quot;Year&quot;
widget:atts:size=4
visibility:list=visible

[categories]
widget:type=checkbox
vocabulary = book_categories

[media]
widget:type=checkbox
vocabulary = book_media

[borrower_id]
widget:type=select
vocabulary=users

[due_date]
widget:description = &quot;The date that the book is due to be returned to the library&quot;
visibility:list=visible


[cover_art_url_small]
visibility:browse=hidden


[cover_art_url_medium]
;visibility:browse=hidden


[cover_art_url_large]
visibility:browse=hidden
visibility:find=hidden

[amazon_description]
widget:label = Description


[amazon_reviews]


[amazon_url]

[amazon_refresh_timestamp]
widget:type=static

[date_created]
timestamp=insert
widget:type = static


[date_modified]
timestamp=update
widget:type=static


[created_by]
widget:type=static


[modified_by]
widget:type=static

[notes]

&lt;/code&gt;

This is an example from the [http://apps.weblite.ca/index.php?-action=view&amp;-table=packages&amp;package_id=%3D2 Library DB] application for the books table. 


===Field Directives===

The following directives may be added to a field&apos;s section of the fields.ini file to customize the field&apos;s behavior.  Some directives are not applicable to all fields.

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| [[column:label]]
| Specifies a custom label to use in list view for the column.  If this is not specified, then the value of [[widget:label]] will be used.
| 1.3
|-
| [[column:legend]]
| Adds a small amount of help text to the column header for this field in list view.  Default is blank.  E.g. &lt;nowiki&gt;&lt;br/&gt;&lt;img src=&quot;http://media.weblite.ca/files/photos/Screen%20shot%202011-02-08%20at%205.05.55%20PM.png?max_width=640&quot;/&gt;&lt;br/&gt;&lt;/nowiki&gt;In this photo it shows the text &quot;*Paper Uploaded&quot; set as the [[column:legend]] for &quot;field 1&quot;.
| 1.3
|-
| [[date_format]]
| Specifies how the field should be formatted when displayed.  Takes same parameters as PHP [http://php.net/strftime strftime] function.
| 2.0
|-
| [[display]]
| Specifies the layout of the field on the edit form.  Most fields have an implicit value of &quot;inline&quot; meaning the widget and its label appear on the same line.  Textareas and htmlareas have an implicit value of &quot;block&quot; meaning that the label and widget appear in separate rows (label above the widget).  You can set this value explicitly also to override the layout of a field.
| 0.8
|-
| [[display_format]]
| A pattern that can be used to define the display format of the field.  This takes the same parameters as the PHP [http://php.net/sprintf sprintf] function.
| 2.0
|-
| [[encryption]]
| Primarily used with password fields, indicates the type of encryption that should be used to save the field.  Supports &quot;md5&quot;, &quot;sha1&quot;, &quot;encrypt&quot;, and &quot;password&quot;.
| 0.6
|-
| event.date
| For use by the [[Calendar Action]].  Indicates that the field stores the date of the record when interpreted as an event.  Possible values &quot;0&quot; or &quot;1&quot;.
| 1.0
|-
| event.start
| For use by the [[Calendar Action]].  Indicates that the field stores the start time of the record when interpreted as an event.  Possible values &quot;0&quot; or &quot;1&quot;.
| 1.0
|-
| event.end
| For use by the [[Calendar Action]]. Indicates that the field stores the end time of the record when interpreted as an event.  Possible values &quot;0&quot; or &quot;1&quot;.
| 1.0
|-
| event.location
| For use by the [[Calendar Action]].  Indicates that the field stores the location of a record when interpreted as an event.  Possible values &quot;0&quot; or &quot;1&quot;.
| 1.0
|-
| [[filter]]
| Boolean value (0 or 1) indicating whether this field should be [[filterable]] in [[list view]].
| 0.8
|-
| [[frozen_description]]
| The field description shown when the widget is frozen (i.e. uneditable).  If this is not specified, no field description is shown in this case.
| 1.2
|-
| [[group]]
| The name of the field group that this field belongs to.  Fields with the same &quot;group&quot; value will be rendered in the same field group on the form.
| 0.5
|-
| [[Key]]
| If you are using a View for the table you need to explicitly mark the fields that comprise the primary key.  E.g. Key=PRI
| 0.6

|-
| [[label_link]]
| An optional URL for the field label to link to.  This would usually be some &quot;help&quot; page that explains what the field is for.  The link will be a link in both the view and edit tabs.
| 1.1.3
|-
| [[ignore]]
| Boolean value (0 or 1) indicating whether this field should be ignored on the edit form.  This is handy if the field is going to be constantly updated in the background (via a cron job perhaps) and you don&apos;t want the edit form to interfere.
| 1.0
|-
| [[logo]]
| Boolean value (0 or 1) to indicate if this field should be treated as a logo field.  Logo fields are displayed in the upper left of the [[view tab]] for a record, and are assumed to contain an image.  If no logo field is explicitly specified, Xataface will make a best guess as to which field should be used.
| 0.7
|-
| [[money_format]]
| For fields containing monetary amounts, this specifies the format.  Takes same parameters as PHP [http://php.net/money_format money_format] function.
| 2.0
|-
| [[noLinkFromListView]]
| Boolean value (0 or 1) to indicate if this field should be linked when in list view (or in a related list).  Default value is 0 to indicate that the field IS linked.  It is common to use this directive when using a custom xxx__renderCell() method that contains its own links.
| 1.1
|-
| [[not_findable]]
| A flag to indicate that this field can not be used as part of a query. This is helpful if you want a field to remain completely confidential to prevent people from finding records based on the value of this field.  This flag is even necessary if the permissions for the field don&apos;t permit viewing the value of the field.
| 1.1
|-
| [[number_format]]
| For numeric fields, this indicates the number of decimal places to display when displaying this field.  E.g. 2
| 2.0
|-
| [[order]]
| The order of the field when laid out on forms and lists.  Can contain any floating point number or integer (e.g. 0, 10, -10, 235.4)
| 0.6
|-
| [[relationship]]
| Used only with complex fields that involve editing related records (e.g. [[grid]]).  This is the name of the relationship that the field should be edited.
| 0.8
|-
| [[repeat]]
| Boolean value (0 or 1) used in conjunction with a select widget to indicate whether to enable a multi-select.
| ?
|-
| [[section]]
| The name of the section that this field should belong to in the [[view tab]].
| 0.7
|-
| [[secure]]
| A boolean flag for use with [[container fields]] to indicate that it should use secure URLs for the file downloads (i.e. it will obey the application permissions).  Without this directives, uploaded files are served directly by apache and don&apos;t obey the Xataface permissions defined per record.
| 1.3
|-
| [[struct]]
| A boolean (0 or 1) value indicating whether this field is considered a structure.  A value of 1 indicates that this field is a structure and should not be truncated under any circumstances.  Normally fields are truncated at 255 chars in list view.  This is useful if the field contains XML or other structured data so that attempts to truncate it would destroy integrity.
| 1.1.2
|-
| [[tab]]
| If tabbed forms are enabled, then this specifies the name of the tab that this field belongs to on the edit form.
| 0.8
|-
| [[timestamp]]
| Indicates when a timestamp should be set in the field (only applicable for date and time fields).  Possible values are &quot;insert&quot; and &quot;update&quot;
| 0.7
|}

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| [[title]]
| Boolean value (0 or 1) indicating whether this field should be treated as a title field.
| 0.7
|-
| [[transient]]
| Boolean value (0 or 1) indicating whether this field is a transient field or not.  A transient field is a field that is defined in the fields.ini file but not in the database.  Hence the values that are input into this field on the edit form are not saved to the database.
| 0.8
|-
| [[Type]]
| The data type of the field (note the capital &quot;T&quot; as Xataface is case sensitive).  This value is only overridden for [[container]] fields, however its value can be accessed programmatically for any field.
| 0.5
|-
| [[validators|validators:VALIDATOR_NAME]]
| A prefix for a validation type on the current field. (Replace &quot;VALIDATOR_NAME&quot; with the name of the validator to be used. e.g. required). There are many validators available to be used.
| 0.5
|-
| [[validators:VALIDATOR_NAME:message]]
| The message the should be displayed if the form fails to validator due to the &quot;VALIDATION_NAME&quot; validation rule.
| 0.5
|-
| [[viewgroup]]
| The name of the field grouping that this field will belong to in the view tab.  If this is not present, then it will be grouped according to the [[group]] directive.
| 1.0
|-
| [[visibility:browse]]
| Indicates whether the field should be visible in browse mode (i.e. in the &quot;view&quot; tab).  Possible values are &quot;visible&quot; and &quot;hidden&quot;.
| 0.6
|-
| [[visibility:csv]]
| Indicates whether the field should be included in CSV exports.  Possible values are &quot;visible&quot; and &quot;hidden&quot;. (1.0 beta 4)
| 1.0b4
|-
| [[visibility:find]]
| Indicates whether the field should be visible in find mode.  Possible values are &quot;visible&quot; and &quot;hidden&quot;
| 1.0
|-
| [[visibility:list]]
| Indicates whether the field should be visible in list view.  Possible values are &quot;visible&quot; and &quot;hidden&quot;.
| 0.6
|-
| [[visibility:update]]
| Indicates whether the field should be included in update and copy/replace forms.  Possible values are &quot;visible&quot; and &quot;hidden&quot;.
| 1.3
|-
| [[vocabulary]]
| The [[valuelist]] that should be used as the options to select.  This is only applicable for fields that have options to select like a select list or a checkbox group.
| 0.5
|-
| [[widget:atts]]
| A namespace for attributes that should be added to the HTML widget.  This allows you to specify things like javascript events, styles, widget size, etc..
| 0.5
|-
| [[widget:columns]]
| For checkbox groups, this specifies the number of columns to use for laying out the checkboxes.
| 1.0
|-
| [[widget:description]]
| Help text to give the user a hint about how to edit the field&apos;s content.
| 0.1
|-
| [[widget:editor]]
| The type of HTML editor that should be used.  This is used only when [[widget:type]] is set to [[widget:type htmlarea|htmlarea]]

Acceptable values include:

* [http://www.fckeditor.net/ fckeditor] (default)
* [http://tinymce.moxiecode.com/ tinymce]  (version 0.6 or higher)
* [http://www.nicedit.com/ nicedit] (version 1.0 or higher)
| all
|-
| [[widget:editvalues]]
| Used with select lists to allow users to add values to the select list.  E.g. widget:editvalues=1
| 0.8
|-
| widget:focus
| Sets default focus. 0 or 1. (Javascript focus in a form)
| 0.6
|-
| [[widget:label]]
| The label that should be used for the current field on edit forms, column headings, and other relevant locations.
| 0.1
|-
| [[widget:question]]
| Text displayed just before the widget.  This is almost the same as [[widget:description]] except that this text is guaranteed to be displayed before the widget, whereas [[widget:description]] may be displayed below or beside the widget.
| 0.1
|-
| [[widget:type]]
| The type of widget that should be used (e.g. checkbox, select, text, etc..)
| 0.1
|-
| [[xml]]
| A flag for use with calculated fields (i.e. fields defined in the [[delegate class]] via the [[field__fieldname]] method) that will include the field in XML output produced by the [[export xml action]].  Default is 0, but setting this value to 1 wil cause the field to be included.
| 1.2.7
|}

===Applying Directives to All fields (__global__)===

Xataface 1.2.6 includes support for a [[__global__]] section that allows you to specify directives that should be applied to all fields.  These directives can be overridden on a field by field basis.  The [[__global__]] section can take all the same directives that a normal field section takes.


===widget:atts:class Values===

The widget:atts:class directive allows you to assign a CSS class to a field&apos;s widget.  There
are certain CSS classes that have meaning to Xataface and will cause additional functionality
to automatically be added to the field.  These built-in classes are listed below:

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| [[passwordTwice]]
| Applicable only to password fields.  If you set widget:atts:class=passwordTwice, then this will convert the password field into two fields whereby both fields need to match in order for submission to continue on the edit form. This operates as a password verification field.&quot;
| 1.3rc2
|}



===Global Directives===

The following directives can be added to the beginning of the fields.ini file (before any field sections) to customize field groups and the table as a whole.

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| [[__dependencies__]]
| A comma-delimited list of tables that this table is dependent upon for caching purposes.  E.g. if any table in this list is modified, then the query cache is cleared for queries on this table.  See this [http://xataface.blogspot.com/2009/06/using-query-caching-in-xataface.html blog article] for more information about query caching.
| 1.2
|-
| [[__isa__]]
| The name of the parent table of the current table.  This directive allows you to have a heirarchical structure amongst the tables in your application.
| 0.8
|-
| [[__source_tables__]]
| A comma-delimited list of tables that this table/view is derived from.  This is used with the query caching feature and is necessary to use this directive if the table is actually a view.  If this directive is not set, then any queries involving this view will not use the query cache because Xataface would have no way to discern the update time of the view.  See this [http://xataface.blogspot.com/2009/06/using-query-caching-in-xataface.html blog article] for more information about query caching.
| 1.2
|-
| [[__sql__]]
| Defines a custom select query to override the default select query for the current table.  (The default select query is generally &quot;select * from tablename&quot;).
| 0.7
|-
| [[__prefs__]]
| Sets preferences for this table and its records.
| 1.0b4
|}


===Field Groups===

The [[group]] directive allows you to group multiple fields together so that they will be rendered in the same field group on forms.  
You can also configure these groups as a whole by defining a section named &quot;[fieldgroup:GROUPNAME]&quot; (where GROUPNAME is the name of the field group, corresponding to the [[group]] directive values for the fields)
in the fields.ini file.  This section provides a few basic directives to customize some aspects of the field group:

* label
* order
* description
* template
* more...

The most common use of these sections is to customize the label or order of groups, especially when there are multiple field groups in the table.
For example, suppose we have a table &quot;people&quot; with fields &quot;first_name&quot;, &quot;last_name&quot;, &quot;phone&quot;, &quot;fax&quot;, &quot;email&quot;, &quot;address&quot;, &quot;city&quot;, and &quot;country&quot;. 
Suppose these fields are grouped as follows:

* &quot;first_name&quot; and &quot;last_name&quot;
* &quot;phone&quot;, &quot;fax&quot;, and &quot;email&quot;
* &quot;address&quot;, &quot;city&quot;, and &quot;country&quot;

so that the fields.ini file looks like:

&lt;code&gt;
[first_name]
    group=name
    
[last_name]
    group=last_name
    
[phone]
    group=contact
    
[fax]
    group=contact
[email]
    group=contact
    
[address]
    group=address
    
[city]
    group=address
    
[country]
    group=address

&lt;/code&gt;

By default, the &quot;name&quot; group will appear first in the form, followed by &quot;contact&quot; and &quot;address&quot;.  If we want to place &quot;address&quot; first we could add the following section to our fields.ini file:

&lt;code&gt;
[fieldgroup:address]
    order=-1
&lt;/code&gt;

Since the default order value is 0 on other groups, setting the &quot;order&quot; parameter to -1 will place the &quot;address&quot; group before all others.

====Field Group Directives====

The following directives are applicable in a fieldgroup section:

{| class=&quot;listing listing2&quot;
|-
! name
! description
! version
|-
| [[fieldgroup order|order]]
| Specifies the order of the group with respect to other groups on the form.  Accepts any numerical value (e.g. 0, 1, -1, 25.43), with lower values appearing first.  Default value is 0.
| 0.6
|-
| [[fieldgroup label|label]]
| Specifies the label that should be used for the field group.
| 0.6
|-
| [[label_link]]
| Specifies a URL that the field group label should link to.
| 1.1.3
|- 
| [[fieldgroup template|template]]
| The path to a custom template that should be used to render the fields of the field group.
| 1.0
|-
| [[fieldgroup collapsed|collapsed]]
| Boolean value (0 or 1) indicating whether the field group should be collapsed by default (user can expand it).  
| 1.0
|}
</content>
	<keywords>fields.ini directives </keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=42">
	<page_name>getFeed</page_name>
	<page_id>42</page_id>
	<page_title>getFeed</page_title>
	<content>==getFeed() Delegate Class Method==

[[toc]]

===Synopsis:===

The getFeed() method of a table [[Delegate class methods|delegate class]] or [[Application Delegate Class|application delegate class]] returns an associative array of parameters to configure the [[Introduction_to_RSS_Feeds_in_Xataface|RSS feed]] for a particular table .  An RSS feed consists of the following components:

# &apos;&apos;&apos;title&apos;&apos;&apos; - The title of the RSS feed as it should appear in the subscribers&apos; feed list.
# &apos;&apos;&apos;description&apos;&apos;&apos; - Describes the RSS feed.
# &apos;&apos;&apos;link&apos;&apos;&apos; - A link to the RSS feed
# &apos;&apos;&apos;syndicationURL&apos;&apos;&apos; - The URL to this RSS feed&apos;s site.

===Parameters===

# &apos;&apos;&apos;array&apos;&apos;&apos; $query - The HTTP query.  Contains information like the current table, current action, and search parameters.  This allows you to customize your RSS feed depending on the user&apos;s query parameters.

===Return Value===

The getFeed() method returns an associative array with the components of the RSS feed.  This array does not need to contain all possible keys, or even any keys.  Any keys that are omitted will simply use default values in the RSS feed.  The array may contain the following keys:

{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| title
| The title for the RSS feed.  If this omitted, it will try to use the &apos;&apos;title&apos;&apos; directive of the &apos;&apos;[_feed]&apos;&apos; section of the [[conf.ini file]].  Failing that, it will try to generate an appropriate title for the feed depending on the current query.
| 1.0
|-
| description
| A Description for this RSS feed.  If this is omitted, it will try to use the &apos;&apos;description&apos;&apos; directive of the &apos;&apos;[_feed]&apos;&apos; section of the [[conf.ini file]].
| 1.0
|-
| link
| A link to the source page of the RSS feed.  If this is omitted, it will try to use the &apos;&apos;link&apos;&apos; directive of the &apos;&apos;[_feed]&apos;&apos; section of the [[conf.ini file]].
| 1.0
|-
| syndicationURL
| A link to the source page of the RSS feed.  If this is omitted, it will try to use the &apos;&apos;syndicationURL&apos;&apos; directive of the &apos;&apos;[_feed]&apos;&apos; section of the [[conf.ini file]].
| 1.0
|}

===Example===

&lt;code&gt;
function getFeed(&amp;$query){
    return array(
        &apos;title&apos; =&gt; &quot;RSS feed for the &quot;.$query[&apos;-table&apos;].&quot; table.&quot;,
        &apos;description&apos; =&gt; &quot;News and updates for automobiles&quot;,
        &apos;link&apos; =&gt; df_absolute_url(DATAFACE_SITE_HREF),
        &apos;syndicationURL&apos; =&gt; df_absolute_url(DATAFACE_SITE_HREF)
    );
}

&lt;/code&gt;

&apos;&apos;&apos;Note that RSS feeds will work perfectly well without defining this method.  This just allows you to customize one or more parameters of the RSS feed&apos;&apos;&apos;.

===See Also:===

* &apos;&apos;&apos;[[getFeedItem]]&apos;&apos;&apos; - A delegate class method available to both the [[Delegate class methods|table delegate classes]] to configure parameters for the particular items of the RSS feed.
* &apos;&apos;&apos;[[getRelatedFeed]]&apos;&apos;&apos; - A [[Delegate class methods|delegate class method]] available to both the [[Application Delegate Class|application delegate class]] and the [[Delegate class methods|table delegate classes]] to configure the [[Introduction to RSS Feeds in Xataface|RSS feed]] for a related records list.
* &apos;&apos;&apos;[[getRSSDescription]]&apos;&apos;&apos; - A delegate class method to override the description that appears for a particular record in an RSS feed.  (The same as the &apos;&apos;description&apos;&apos; parameter of the [[getFeedItem]] method.
* &apos;&apos;&apos;[[Introduction to RSS Feeds in Xataface]]&apos;&apos;&apos; - An overview of Xataface&apos;s RSS feed support.</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki></record>