<?xml version="1.0"?>
<record><wiki id="wiki?page_id=17">
	<page_name>getRegistrationActivationEmailInfo</page_name>
	<page_id>17</page_id>
	<page_title>getRegistrationActivationEmailInfo</page_title>
	<content>==getRegistrationActivationEmailInfo() Hook==

A hook that can be implemented in the [[Application Delegate Class]] or the [[Table Delegate Class]] to override the default information that is used to send the registration activation email (the email that the user receives when they register).

This should return an associative array with the keys:

* subject - The subject of the activation email.
* message - The message body of the activation email.
* parameters - The parameters to be used in the mail() function for the activation email.
* headers - The headers to use in the mail() function for the activation email.


===Signature===

function getRegistrationActivationEmailInfo( Dataface_Record &amp;$record, string $activationURL ) : array

====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.
|-
| $activationURL
| The URL where the user can go to activate their account.
|-
| 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 getRegistrationActivationEmailInfo(&amp;$record, $activationURL){
        return array(
            &apos;subject&apos; =&gt; &apos;Welcome to the site.. Activation required&apos;,
            &apos;message&apos; =&gt; &apos;Thanks for registering.  Visit &apos;.$activationURL.&apos; to activate your account&apos;,
            &apos;headers&apos; =&gt; &apos;From: webmaster@example.com&apos; . &quot;\r\n&quot; .
                          &apos;Reply-To: webmaster@example.com&apos; . &quot;\r\n&quot; .
                          &apos;X-Mailer: PHP/&apos; . phpversion()
             );
            
        
       
    }
}
&lt;/code&gt;

===Example 2: Only override the subject===

&lt;code&gt;
&lt;?php
class conf_ApplicationDelegate {

    function getRegistrationActivationEmailInfo(&amp;$record, $activationURL){
        return array(
            &apos;subject&apos; =&gt; &apos;Welcome to the site.. Activation required&apos;
             );
            
        
       
    }
}
&lt;/code&gt;


===See Also===
* [[beforeRegister]]
* [[afterRegister]]
* [[validateRegistrationForm]]
* [[sendRegistrationActivationEmail]]
* [[getRegistrationActivationEmailSubject]]
* [[getRegistrationActivationEmailMessage]]
* [[getRegistrationActivationEmailParameters]]
* [[getRegistrationActivationEmailHeaders]]</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=19">
	<page_name>getRegistrationActivationEmailMessage</page_name>
	<page_id>19</page_id>
	<page_title>getRegistrationActivationEmailMessage</page_title>
	<content>==getRegistrationActivationEmailSubject() Hook==

A hook that can be implemented in the [[Application Delegate Class]] or the [[Table Delegate Class]] to override the default registration activation email message body (the email that the user receives when they register).


===Signature===

function getRegistrationActivationEmailSubject( Dataface_Record &amp;$record, string $activationURL ) : string

====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.
|-
| $activationURL
| The URL where the user can go to activate their account.
|-
| 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 getRegistrationActivationEmailInfo(&amp;$record, $activationURL){
        return &apos;Thanks for registering.  Please visit &apos;.$activationURL.&apos; to activate.&apos;;   
    }
}
&lt;/code&gt;


===See Also===
* [[beforeRegister]]
* [[afterRegister]]
* [[validateRegistrationForm]]
* [[sendRegistrationActivationEmail]]
* [[getRegistrationActivationEmailInfo]]
* [[getRegistrationActivationEmailSubject]]
* [[getRegistrationActivationEmailParameters]]
* [[getRegistrationActivationEmailHeaders]]</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=18">
	<page_name>getRegistrationActivationEmailSubject</page_name>
	<page_id>18</page_id>
	<page_title>getRegistrationActivationEmailSubject</page_title>
	<content>==getRegistrationActivationEmailSubject() Hook==

A hook that can be implemented in the [[Application Delegate Class]] or the [[Table Delegate Class]] to override the default registration activation email subject line (the email that the user receives when they register).


===Signature===

function getRegistrationActivationEmailSubject( Dataface_Record &amp;$record, string $activationURL ) : string

====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.
|-
| $activationURL
| The URL where the user can go to activate their account.
|-
| 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 getRegistrationActivationEmailInfo(&amp;$record, $activationURL){
        reeturn &apos;Welcome to the site.. Activation required&apos;;   
    }
}
&lt;/code&gt;


===See Also===
* [[beforeRegister]]
* [[afterRegister]]
* [[validateRegistrationForm]]
* [[sendRegistrationActivationEmail]]
* [[getRegistrationActivationEmailInfo]]
* [[getRegistrationActivationEmailMessage]]
* [[getRegistrationActivationEmailParameters]]
* [[getRegistrationActivationEmailHeaders]]</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=122">
	<page_name>getResetPasswordEmailInfo</page_name>
	<page_id>122</page_id>
	<page_title>getResetPasswordEmailInfo Application Delegate Class Method</page_title>
	<content>Return to [[Application Delegate Class]]

[[toc]]

===Synopsis===

Optional method to define the settings for the email that is sent to the user when they request to reset their password.

Introduced in Xataface 1.3.  Exists in 1.3 or higher.


===Signature===

&lt;code&gt;
function getResetPasswordEmailInfo(Dataface_Record $user, string $reset_url){}
&lt;/code&gt;

===Parameters===

* &apos;&apos;&apos;$user&apos;&apos;&apos; - The Dataface_Record of the user whose password has been changed.
* &apos;&apos;&apos;$reset_url&apos;&apos;&apos; - The URL where the user should go to reset their password.  When they visit this URL they will receive a message saying that their password has been changed and the new password has been emailed to them.  That subsequent email can be customized using the [[getPasswordChangedEmailInfo]] method.

===Returns===

This method should return an associative array with 0 or more of the following keys:

* &apos;&apos;&apos;subject&apos;&apos;&apos; - The subject line of the email.
* &apos;&apos;&apos;message&apos;&apos;&apos; - The message content of the email.
* &apos;&apos;&apos;headers&apos;&apos;&apos; - The Email headers (as a string).
* &apos;&apos;&apos;parameters&apos;&apos;&apos; - Extra parameters for the mail function.

==See Also==

* [[getPasswordChangedEmailInfo]] - A delegate class method to define the email that is sent to the user once their password has been reset to a temporary password.  It informs the user of their new temporary password and should include instructions on how to change their password to their own choice.  This step immediately follows the reset password step.</content>
	<keywords>forgot password, reset password</keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<wiki id="wiki?page_id=158">
	<page_name>Grafted_fields</page_name>
	<page_id>158</page_id>
	<page_title>Grafted fields</page_title>
	<content>==Grafted Fields==

===Introduction===
When there are numerous tables, it is difficult for the user to see get an information that will help one to enter the right data in the right field. So instead of navigating in the relative tables and lose some time, it is more convenient to add a grafted field from that relative table in the table. To be able to sort a column by the content displayed when this content is extracted form a relative table, a grafted field is necessary because the real content is just an id, not the most convenient to sort in human-readable way.
===Procedure===
Two ways to add a grafted filed
* The first one is to add a __sql__ statement at the beginning of fields.ini, including the grafted field through a join.
&lt;code&gt;__sql__ = &quot;select p.*, d.total from programmation p left join dev d on p.id_programmation=d.id_programmation&quot; &lt;/code&gt;
* The second one is to create the function __sql__ in the delegate class
&lt;code&gt;function __sql__(){
return &quot;select p.*, d.total from programmation p left join dev d on p.id_programmation=d.id_programmation&quot;;
}
&lt;/code&gt;
===Sorting order based on relationship===
The solution is to hide the field with the id and to add the grafted field with the name in the fields.ini
&lt;code&gt;[name_programmation]
order=10

[id_programmation]
visibility:list=hidden
&lt;/code&gt;

===Debugging===
A couple of things to check for:
*1. If you have set blanket default permissions for your fields using the __field__permissions() method you could be disallowing access to the field.
*2. If you have set default field visibility in the fields.ini file via the [__global__] section....
*3. Check to make sure that your __sql__ directive is at the beginning of the file and that it is __sql__ and not _sql_
*4. Try to enter an obviously invalid SQL query for the __sql__ directive to see if you get an error (to confirm that it is picking up the __sql__ directive at all).
</content>
	<keywords>grafted fields, grafted, sorting columns, sort, relative records, relative tables</keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<wiki id="wiki?page_id=67">
	<page_name>grid</page_name>
	<page_id>67</page_id>
	<page_title>grid</page_title>
	<content>==widget:type = grid==

Suppose we have two tables, tbl_organisation and tbl_individuals, in the edit view for a record in the organisations table (tbl_organisations) we also want to be able to view and edit the individuals within this organisation we can use widget:type=grid

In the /tables/tbl_organisation/fields.ini we create a transient field by adding:

&lt;code&gt;
[Individuals]
widget:label = &quot;Individuals&quot;
transient=1
relationship=individuals
widget:type=grid
widget:columns=&quot;ind_firstname,ind_lastname,ind_tel&quot;
&lt;/code&gt;

The above assumes we have a relationship entry in our /tables/tbl_organisation/relationships.ini that looks like this:

&lt;code&gt;
[individuals]
__sql__ = &quot;SELECT * FROM tbl_individual WHERE org_id=&apos;$org_id&apos;&quot;
&lt;/code&gt;

The fields.ini will show the three columns shown in widget:columns from the table tbl_individual

Correct permissions need to be set to enable editing and deletion etc of these records.</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=28">
	<page_name>group</page_name>
	<page_id>28</page_id>
	<page_title>group</page_title>
	<content>==group directive in [[fields.ini file]]==

The group directive allows you to declare that certain fields of your table should be grouped together on the edit form and the view tab (and other logical places).  For example, fields like address, city, state, country, postal_code would likely be grouped together as address_info.  Grouping the fields together will make the fields appear in a section of their own in the view tab and the edit form.

E.g.  In your fields.ini file:

&lt;code&gt;
[address]
   group=address_info

[city]
    group=address_info

[state]
    group=address_info

[country]
    group=address_info

[postal_code]
    group=address_info

&lt;/code&gt;


===Configuring the Group as a Whole===

You can also configure your group in the fields.ini file by adding a &apos;&apos;&apos;fieldgroup:NAME&apos;&apos;&apos; section, where &apos;&apos;&apos;NAME&apos;&apos;&apos; is the name of the group.  E.g.
&lt;code&gt;
[fieldgroup:address_info]
    label=&quot;Address Information&quot;
    description = &quot;Please enter your address information below&quot;
&lt;/code&gt;

====See also:====

* [[fields.ini file]] - Scroll down to the &apos;&apos;&apos;Field Groups&apos;&apos;&apos; section.</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=177">
	<page_name>test_page_34</page_name>
	<page_id>177</page_id>
	<page_title>Hello World</page_title>
	<content>Hello world</content>
	<keywords></keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<wiki id="wiki?page_id=65">
	<page_name>LDAP_or_Active_Directory</page_name>
	<page_id>65</page_id>
	<page_title>How to authenticate users with LDAP or Active Directory</page_title>
	<content>[[toc]]

It is often easier to use the existing LDAP or Active Directory to authenticate users in Xataface than to create a new password for every user in the table users.

===In the conf.ini===

In the conf.ini file, in the [auth] part, you need to add your LDAP or AD configuration data :

&lt;code&gt;[_auth]
auth_type=ldap
users_table = xata_users
username_column = id
	ldap_host = &quot;xxx.xxx.xxx.xxx&quot;
	ldap_port = &quot;389&quot;
	ldap_base = &quot;OU=blabla,DC=blablabla&quot;&lt;/code&gt;

Here in the table users, you need the login but the password can be just &apos;&apos;PASS&apos;&apos;, because the password will be fetched into the LDAP base.
You need to add the [http://weblite.ca/svn/dataface/modules/Auth/ldap/trunk/ auth module] in the conf/modules directory.

===See Also===

* [[authentication]] - Overview of Authenthentication features in Xataface</content>
	<keywords>LDAP,Active Directory,Authentication</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=85">
	<page_name>http://xataface.com/documentation/how-to/site_with_backoffice</page_name>
	<page_id>85</page_id>
	<page_title>How to build a site with an optional login form</page_title>
	<content>==How to build a site with an optional login form==
To publish a public site with data without any need to login to access, here is the code :
&lt;code&gt;
function getPermissions(&amp;$record){
    if ( isAdmin() ) return Dataface_PermissionsTool::ALL();
    else return Dataface_PermissionsTool::READ_ONLY();
} 
&lt;/code&gt;
In this way, you still can login to administrate your data.</content>
	<keywords></keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<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=180">
	<page_name>viewable_editable_fields</page_name>
	<page_id>180</page_id>
	<page_title>How to make a field editable for some users and only viewable for some other users</page_title>
	<content>If we want only some users to edit a field and some other users only to view that field, then we need to define a &apos;&apos;&apos;fieldX__permissions()&apos;&apos;&apos; method for that field which gives desired permissions for specific users.

One solution is as below.

==permissions.ini==
&lt;code&gt;
[Field Viewer]
view=1
edit=0
new=0

[Field Editor extends Field Viewer]
new=1
edit=1
&lt;/code&gt;

==TableX.php (Delegate class of TableX)==
&lt;code&gt;
function fieldX__permissions(&amp;$record) {
	$user=&amp;Dataface_AuthenticationTool::getInstance()-&gt;getLoggedInUser();
	
	if($user) {
		if($user-&gt;val(&apos;usernameField&apos;)==&quot;UserX&quot;)
			$role=&apos;Field Viewer&apos;;
		else if($user-&gt;val(&apos;usernameField&apos;)==&quot;UserY&quot;)
			$role=&apos;Field Editor&apos;;				

			return Dataface_PermissionsTool::getRolePermissions($role);
	}
		
	return Dataface_PermissionsTool::NO_ACCESS();
}
&lt;/code&gt;</content>
	<keywords></keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<wiki id="wiki?page_id=52">
	<page_name>How_to_Add_Custom_Sections_to_View_Tab</page_name>
	<page_id>52</page_id>
	<page_title>How_to_Add_Custom_Sections_to_View_Tab</page_title>
	<content>==How to Add Custom Sections to the View tab==

[[toc]]

The &apos;&apos;View&apos;&apos; tab is intended to give the user a detailed view of the contents of a record.  By default it shows the values of each non-empty field grouped into their appropriate field groups.  It also shows the most recent 5 related records from each relationship in the record.  You can also add your own sections by implementing the [[section__xxx]] method of the delegate class.

==Example 1: A &quot;Hello World&quot; Section==

We&apos;ll start by adding a simple section that simply displays &quot;Hello World&quot; to the user.  In the delegate class for your table, add the following method:
&lt;code&gt;
function section__hello(&amp;$record){
    return array(
        &apos;content&apos; =&gt; &apos;Hello World!!!&apos;,
        &apos;class&apos; =&gt; &apos;main&apos;
    );
}
&lt;/code&gt;

Now if you reload our application and click on the &quot;View&quot; tab for any of the records in the database, you&apos;ll notice a section labelled &apos;&apos;hello&apos;&apos; with the text &apos;&apos;Hello World!!!&apos;&apos; in it.

Let&apos;s dissect the above code so that we can better understand what is going on here.

# The function &apos;&apos;section__hello()&apos;&apos; defines a section named &apos;&apos;hello&apos;&apos;.  If you wanted to define a section named &apos;&apos;foo&apos;&apos; you would call the function &apos;&apos;section__foo()&apos;&apos;
# This function returns an array with the keys &apos;&apos;content&apos;&apos;, and &apos;&apos;class&apos;&apos;.
# The &apos;&apos;content&apos;&apos; key points to the actual HTML content of the section.  In this case it is simply the text &apos;&apos;Hello World!!!&apos;&apos;.
# The &apos;&apos;class&apos;&apos; key defines where the section should be displayed.  It accepts values of &apos;&apos;left&apos;&apos; and &apos;&apos;main&apos;&apos; only.  If it is set to &apos;&apos;left&apos;&apos;, then the section will be displayed in the left column.  A value of &apos;&apos;main&apos;&apos; indicates that it should be displayed in the main column.

===Customizing the Section Label===

&apos;&apos;hello&apos;&apos; is a boring label, so let&apos;s add our own custom label by adding the &apos;&apos;label&apos;&apos; key to the array returned by our method:
&lt;code&gt;
function section__hello(&amp;$record){
    return array(
        &apos;content&apos; =&gt; &apos;Hello World!!!&apos;,
        &apos;class&apos; =&gt; &apos;main&apos;,
        &apos;label&apos; =&gt; &apos;Message of the Day&apos;
    );
}
&lt;/code&gt;

Now if you load the view tab of your application, you&apos;ll notice that the section has a heading &quot;Message of the Day&quot;.

===Customizing the Section Order===

A section can also specify an &apos;&apos;order&apos;&apos; attribute to define the order in which this section should appear.  It defaults to 0 which may cause the section to appear at the top of the view tab.  You can push it to the bottom of the view tab by assiging a higher number to the &apos;&apos;order&apos;&apos; attribute:
&lt;code&gt;
&lt;code&gt;
function section__hello(&amp;$record){
    return array(
        &apos;content&apos; =&gt; &apos;Hello World!!!&apos;,
        &apos;class&apos; =&gt; &apos;main&apos;,
        &apos;label&apos; =&gt; &apos;Message of the Day&apos;,
        &apos;order&apos; =&gt; 10
    );
}
&lt;/code&gt;

Now if you reload the view tab you&apos;ll notice that the section has moved to the bottom of the page.</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=64">
	<page_name>How_to_authenticate_users_with_LDAP_or_Active_Directory</page_name>
	<page_id>64</page_id>
	<page_title>How_to_authenticate_users_with_LDAP_or_Active_Directory</page_title>
	<content>==How to authenticate users with LDAP or Active Directory==

</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=63">
	<page_name>How_to_granulate_permissions_on_each_field</page_name>
	<page_id>63</page_id>
	<page_title>How_to_granulate_permissions_on_each_field</page_title>
	<content>==How to granulate permissions on each field==

To reach this aim, there is the method fieldname__permissions to place into the delegate class of the table. 

===Getting the role===

First it is necessary to know the user&apos;s role. For this, the method getUser() is added in the class :
&lt;code&gt;function getUser(&amp;$record){
  $auth =&amp; Dataface_AuthenticationTool::getInstance();
    $user =&amp; $auth-&gt;getLoggedInUser();
return $user;
}&lt;/code&gt;


===Setting up the permissions for each field===

Next, the permissions are built for each column or field where they are needed, like in this example where the method name is formed with the field name, followed by 2 underscores then by &apos;&apos;permissions&apos;&apos; :

&lt;code&gt;function fieldname__permissions(&amp;$record){

$the_user =$this-&gt;getUser($record);
$user=$the_user-&gt;val(&apos;identifiant&apos;);
if ( !$user) return Dataface_PermissionsTool::NO_ACCESS();

    if ( $user==&apos;demande&apos; ){
        return Dataface_PermissionsTool::ALL();
    } elseif ($user==&apos;admin&apos;){
 return Dataface_PermissionsTool::ALL();
}
else {
        return Dataface_PermissionsTool::READ_ONLY();
    }
}&lt;/code&gt;


=== Also See ===

* [[viewable_editable_fields]] - How to make a field editable for some users and only viewable for some other users  
* [[no_access_text]] - Replace the default NO ACCESS permission text with another text.
* [[__field__permissions]] - Returns the default permissions for a field of a given record.
* [[Delegate_class_methods#toc5|Permissions]] - other Delegate class methods</content>
	<keywords></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=140">
	<page_name>init</page_name>
	<page_id>140</page_id>
	<page_title>init() Delegate Class Method</page_title>
	<content>== Synopsis ==

This method is called once, just after the table is loaded for the first time. It allows you to specify initialization details, such as [[setSecurityFilters|security filters]].

Note that it takes a single parameter: a Dataface_Table object of the table that is being initialized. 

== Example ==
&lt;code&gt;
function init(&amp;$table){

   ....
}
&lt;/code&gt;</content>
	<keywords></keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<wiki id="wiki?page_id=73">
	<page_name>GettingStarted:Installation</page_name>
	<page_id>73</page_id>
	<page_title>Installation</page_title>
	<content>==Installation==

Download and installation instructions for the Web Lite framework.
Xataface is a 100% PHP Framework that comes with all dependencies as part of the installation. The framework itself lives inside a single directory that should be placed inside the document root of your web server so that it can be accessed from the web. You can install a single copy of Xataface to be used by multiple applications on your web server. Each application just &quot;requires&quot; the key files from the Web Lite framework.

===Downloading===

# Go to the Xataface Sourceforge project file releases page
# Download the latest file release.

===Installing===

# Unpack the gzipped tar archive that you downloaded somewhere in your web server&apos;s document root (i.e., make sure that the &apos;dataface&apos; directory is in a web-accessible location).
# Make the dataface/Dataface/templates_c directory writable by the web server.  An unsafe way to do this is to 
 chmod 777 Dataface/templates_c
But it would be better to just give write access to the web server user.
# Confirm that the installation worked by pointing the web browser to http://yourdomain.com/path/to/dataface/dataface_info.php . If it worked OK, you should receive a web page that says &quot;Dataface is installed correctly&quot;, along with some basic instructions for creating a Xataface Application. (Note: Sometimes this page will give you a false positive. i.e., it may say the installation worked but then your Xataface application receives errors. Check the troubleshooting section below to deal with these issues).

===Troubleshooting===

If your installation is not going as planned, don&apos;t panic. There is a possiblity that your system has a slightly different configuration and you have to make some small adjustments to make the installation work.

The general procedure for troubleshooting the installation is as follows:

# Check the [[Troubleshooting]] page.
# Look through the [http://xataface.com/forum forum] to see if others have experienced the same thing.
# Post your question in the forum if you can&apos;t find the answer already.

</content>
	<keywords>installation troubleshooting downloading </keywords>
	<language>en</language>
	<original_page></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=71">
	<page_name>GettingStarted:Introduction</page_name>
	<page_id>71</page_id>
	<page_title>Introduction</page_title>
	<content>Web Lite is a simple framework for building data-driven web applications in PHP and MySQL. This section introduces some of the concepts and applications of Dataface.

To fully understand what Xataface is, we must first define a few key terms:

&apos;&apos;&apos;Framework&apos;&apos;&apos; - A set of software routines that provide a foundation structure for an application. Frameworks take the tedium out of writing an application from scratch. (From Answers.com)

&apos;&apos;&apos;Data-driven design&apos;&apos;&apos;- Designing an application around the data that it will store.

Xataface is a &apos;&apos;Framework&apos;&apos; in the sense that it is a set of classes and libraries that take the tedium out of writing web applications. It provides a simple web interface to a MySQL database enabling users to update, delete, and find data in the underlying database. The interface is targeted at secretaries and end-users as opposed to database administrators.

Xataface enables &apos;&apos;data-driven design&apos;&apos; because it allows developers to develop web sites by first designing the database that will be used to store the data on the website, and then design the pages used to display the data. The developer can focus on the data because he or she does not have to worry about having to build forms to update the data. If the requirements of the application change, the developer can simply add a field to the database table and all associated web forms will be updated automatically (because they are all dynamically generated using the database schema).


===Requirements===

* [http://php.net PHP] &gt;= 4.3
* [http://mysql.com MySQL] &gt;= 3.2.3

===Key Technologies===

* [http://pear.php.net PEAR class libraries] (HTML_QuickForm, etc...)
* [http://smarty.net Smarty Templating Engine]
* [http://plone.org Plone] Javascript and CSS style sheets

===Development Procedures===

# Identify the data that will need to be stored for a web site.
##[[Image:http://xataface.com/documentation/tutorial/getting_started/er-diagram.png]]
# Design the database using your favorite database administration program (e.g., PHPMyAdmin)
##[[Image:http://xataface.com/documentation/tutorial/getting_started/phpMyAdmin-1-small.gif]]
# Tell Xataface some DB connection info, and voila! You have an application:
##[[Image:http://xataface.com/documentation/tutorial/getting_started/new-record-form-1-small.gif]]

===Where to go from here===

This tutorial will teach you the basics of Xataface and how to construct a simple application using the Xataface. After reading this tutorial you will be ready to tackle some medium to large web sites with the help of the Xataface reference documentation. You are also encouraged to mail the [http://xataface.com/forum Xataface forum] if you have questions.</content>
	<keywords>introduction requirements getting started</keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<wiki id="wiki?page_id=101">
	<page_name>Introduction_to_the_Xataface_API</page_name>
	<page_id>101</page_id>
	<page_title>Introduction to the Xataface API</page_title>
	<content>Back to [http://xataface.com/wiki the wiki]

[[toc]]

===Synopsis===

Xataface is provides an API to help in developing your own custom actions.  This API includes objects and functions to more easily interact with the database (i.e. search, edit, delete, and save records), build forms, use templates, and more.  This section of the wiki endeavors to highlight some of the more useful and commonly used aspects of the API.

===The dataface-public-api.php Facade===

Much of the functionality provided by the Xataface API is wrapped up easy-to-use functions which are made available in the dataface-public-api.php script, which is always present in a Xataface application (it is loaded at the beginning of your index.php file).

===Some Common Tasks===

====Loading a Single Record from the Database====

&lt;code&gt;
// Load record from &apos;people&apos; table matching person_id=10
$record = df_get_record(&apos;people&apos;, array(&apos;person_id&apos;=&gt;10)); 

// Load record from people table with first_name &apos;John&apos; and last_name &apos;Smith&apos; 
$record2 = df_get_record(&apos;people&apos;, array(&apos;first_name&apos;=&gt;&apos;=John&apos;, &apos;last_name&apos;=&gt;&apos;=Smith&apos;));

// $record and $record2 are Dataface_Record objects.
echo &quot;Loaded Person: &quot;.$record-&gt;val(&apos;person_id&apos;).
      &quot; named &quot;.$record-&gt;val(&apos;first_name&apos;).&apos; &apos;.$record-&gt;val(&apos;last_name&apos;);
&lt;/code&gt;

In the above examples we load a [http://dataface.weblite.ca/Dataface_Record Dataface_Record] object and use the val() method to display particular field values.

The 2nd arguments of df_get_record() is an array which serves as a query.  See [[URL Conventions]] for more examples of the types of queries that you can provide here.

====Loading a set of records from the Database====

&lt;code&gt;
//  Load the first 30 canadians from the people table
$people = df_get_records_array(&apos;people&apos;, array(&apos;nationality&apos;=&gt;&apos;=canadian&apos;));
foreach ( $people as $person){
    // $person is a Dataface_Record object
    echo &quot;&lt;br&gt;Person &quot;.$person-&gt;val(&apos;person_id&apos;).&quot; is named &quot;.$person-&gt;val(&apos;first_name&apos;);
}
&lt;/code&gt;

&apos;&apos;&apos;Caveat:  Note that when loading records using df_get_records_array() it only loads a preview of each record for memory&apos;s sake.&apos;&apos;&apos;  A preview of the record is the same as a full record except that all fields are truncated to be less than 255 characters.  If you have long text fields that you need to load, then these will be truncated.  There are a few different solutions if you need to load the entire contents of a long field, including:

* Use df_get_record instead.  (This is only preferable if you are only loading a single record).
* Use the [[struct]] [[fields.ini file]] directive on the field to designative the field contents as a &apos;stucture&apos; that should never be truncated.
* Use the extended form of &apos;&apos;df_get_records_array()&apos;&apos; with the 5th parameter (preview) set to false.  E.g. &lt;code&gt;
$people = df_get_records_array(&apos;people&apos;,array(), null, null, false);
&lt;/code&gt;

====Editing and Saving a Record====

&lt;code&gt;
$person = df_get_record(&apos;people&apos;, array(&apos;person_id&apos;=&gt;10));

// Using setValue() to set a single field value.
$person-&gt;setValue(&apos;first_name&apos;, &apos;Peggy&apos;);

// Using setValues() to set multiple field values at once
$person-&gt;setValues(array(&apos;first_name&apos;=&gt;&apos;Peggy&apos;, &apos;last_name&apos;=&gt;&apos;Sue&apos;));

// Commit the changes to the database
$person-&gt;save();
&lt;/code&gt;

</content>
	<keywords>xataface api, df_get_record, df_get_records_array, Dataface_Record, Editing, Saving, Loading, Searching</keywords>
	<language>en</language>
	<original_page></original_page>
</wiki>
<wiki id="wiki?page_id=114">
	<page_name>XataJax_Compiler</page_name>
	<page_id>114</page_id>
	<page_title>Introduction to the XataJax Compiler</page_title>
	<content>Return to [[XataJax]]

&apos;&apos;&apos;DISCLAIMER&apos;&apos;&apos;: This page introduces features that require Xataface 1.3 or higher.  At present (Jan. 2011) only Xataface 1.2.6 has been released to the public.

[[toc]]

===Synopsis===

The XataJax compiler is a Javascript CSS compiler and linker that comes with the [[XataJax]] module and will be a standard part of Xataface starting in version 1.3.  It provides a mechanism to process and compile (or so to speak) all of the javascripts required for a page request at the time that the page is requested.  This results in a more scalable, manageable javascript and CSS source base - and in improved performance for your applications.

===Compiler Directives===

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| [[xatajax include directive|include]]
| Includes another javascript file inside the current one in place of this directive.  Sample code:&lt;code&gt;//include &lt;myscript.js&gt;&lt;/code&gt;
| XataJax 0.1 Xataface 1.3
|-
| [[xatajax require directive|require]]
| Includes another javscript file inside the current one only if that file hasn&apos;t already been included.  Sample code: &lt;code&gt;//require &lt;myscript.js&gt;&lt;/code&gt;
| XataJax 0.1 Xataface 1.3
|-
| [[xatajax require-css directive|require-css]]
| Includes a CSS script in the CSS file.  This will will search in the [[Dataface_CSSTool]] include path for the script.  Sample code: &lt;code&gt;//require-css &lt;mystyles.css&gt;&lt;/code&gt;
| XataJax 0.1 Xataface 1.3
|-
| [[xatajax load directive|load]]
| Loads the specified Javascript file in a separate script tag.  This enables you to reference other scripts without including them in the same bundle, allowing for more effective caching.  Sample code: &lt;code&gt;//load &lt;myscript.js&gt;&lt;/code&gt;
| XataJax 0.1 Xataface 1.3
|}


===How it Works===

The XataJax compiler works similar to a regular code compiler.  It provides 4 server-side directives to allow you to express dependencies between scripts and stylesheets:

# &apos;&apos;&apos;include&apos;&apos;&apos; : Includes another javascript file inside the current script in place of the &apos;&apos;&apos;include&apos;&apos; directive.
# &apos;&apos;&apos;require&apos;&apos;&apos; : Includes another javascript file inside the current script (if it hasn&apos;t already been included) - i.e. if a script is included twice with a require directive, it will only actually be included once.
# &apos;&apos;&apos;load&apos;&apos;&apos; : Registers a dependency to another script, but doesn&apos;t include it in the same bundle.  This may be used if your script requires code from another javascript, but you don&apos;t want it all to be bundled into the same javascript file.  This may help with caching in certain cases.
# &apos;&apos;&apos;require-css&apos;&apos;&apos; : Registers a dependency to a CSS file.   If your script depends on a CSS file, then it can be registered in this way.


===Brief Example===

&apos;&apos;scriptA.js&apos;&apos;:
&lt;code&gt;
//require &lt;scriptB.js&gt;
alert(&apos;You are in script A&apos;);
&lt;/code&gt;

&apos;&apos;scriptB.js&apos;&apos;:
&lt;code&gt;
alert(&apos;You are in script B&apos;);
&lt;/code&gt;

If you loaded &apos;&apos;scriptA.js&apos;&apos;, it would actually result in the following javascript being executed:
&lt;code&gt;
alert(&apos;You are in script B&apos;);
alert(&apos;You are in script A&apos;);
&lt;/code&gt;

Notice that it included &apos;&apos;scriptB.js&apos;&apos; inside script A before the alert of script A.  That is why script B&apos;s alert comes first.  Note that this example won&apos;t work if you simply try to load scriptA.js directly in Apache.  These directives are only evaluated if the scripts are served by Xataface.  Here is a simple Xataface action that demonstrates how to use this in your Xataface script.

====Creating a custom action====

In your application directory, create an &apos;&apos;actions&apos;&apos; directory if you don&apos;t already have one.  Then create a single file named &apos;&apos;hello.php&apos;&apos; with the following content:
&lt;code&gt;
class actions_hello {
    function handle($params){
        $jsTool = Dataface_JavascriptTool::getInstance();
        $jsTool-&gt;addPath(&apos;js&apos;, DATAFACE_SITE_URL.&apos;/js&apos;);
        $jsTool-&gt;import(&apos;scriptA.js&apos;);
        echo &apos;&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&apos;.$jsTool-&gt;getHtml().&apos;&lt;/body&gt;&lt;/html&gt;&apos;;
        exit;
    }
}
&lt;/code&gt;

&apos;&apos;&apos;About this code:&apos;&apos;&apos;

&lt;code&gt;$jsTool = Dataface_JavascriptTool::getInstance();&lt;/code&gt;
We start by obtaining an instance of the JavascriptTool.  This is the object that does all of the magic of compiling your scripts and managing dependencies.

&lt;code&gt;$jsTool-&gt;addPath(&apos;js&apos;, DATAFACE_SITE_URL.&apos;/js&apos;);&lt;/code&gt;
This line adds the &apos;&apos;js&apos;&apos; directory to the tool&apos;s include path, and specifies (with the 2nd parameter) the URL to reach this directory also.  The JavascriptTool works like most source code compilers.  You need to give it the path where it can expect to find its libraries and scripts.  Only paths that you add here will be searched for javascripts.  You can add as many paths as you like.  By default it will have the DATAFACE_PATH/js and the XATAJAX_PATH/js directories in the include path so you can directly reference any scripts in those directories always.

&lt;code&gt; $jsTool-&gt;import(&apos;scriptA.js&apos;);&lt;/code&gt;
This is where we declare that we want to use &apos;&apos;scriptA.js&apos;&apos; in the current request.  This line then assumes that the scriptA.js file is located in one of the directories of the current include path.  In our case we make sure that it resides in the DATAFACE_SITE_PATH/js directory.

&lt;code&gt;echo &apos;&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&apos;.$jsTool-&gt;getHtml().&apos;&lt;/body&gt;&lt;/html&gt;&apos;;&lt;/code&gt;
On this line we simply output the HTML script tags that the javascript tool generates linking to our resulting script.  


Now we can test our our action by going to the page index.php?-action=hello.  If everything worked correctly you should see the appropriate alert dialogs appear  - first telling you you&apos;re in Script B, then telling you you&apos;re in Script A.  If it doesn&apos;t work, you should check your javascript error logs to see what went wrong.

&apos;&apos;&apos;NOTE:&apos;&apos;&apos; - This simple example actually shows you the step of writing out the HTML tags explicitly with the getHtml() method.  If you are using a standard Xataface template that is based on the Dataface_Main_Template.html template, then this step is unnecessary because the XataJax module will automatically include this HTML just before the closing &lt;/body&gt; tag in your pages.



</content>
	<keywords>XataJax, compiler, javascript, css, compiler</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=40">
	<page_name>Introduction_to_RSS_Feeds_in_Xataface</page_name>
	<page_id>40</page_id>
	<page_title>Introduction_to_RSS_Feeds_in_Xataface</page_title>
	<content>==Introduction to RSS Feeds in Xataface==

[[toc]]

A default Xataface application provides RSS feeds to any found set in your application.  This article explains a little bit about RSS and how you can configure Xataface to give you the desired results for your RSS feed.

===What is RSS?===

From [http://en.wikipedia.org/wiki/RSS_(file_format) Wikipedia&apos;s RSS article]:

&quot;RSS is a family of Web feed formats used to publish frequently updated works such as blog entries, news headlines, audio, and videoin a standardized format.[2] An RSS document (which is called a &quot;feed&quot;, &quot;web feed&quot;,[3] or &quot;channel&quot;) includes full or summarized text, plus metadata such as publishing dates and authorship. Web feeds benefit publishers by letting them syndicate content automatically. They benefit readers who want to subscribe to timely updates from favored websites or to aggregate feeds from many sites into one place. RSS feeds can be read using software called an &quot;RSS reader&quot;, &quot;feed reader&quot;, or &quot;aggregator&quot;, which can be web-based or desktop-based. A standardized XML file format allows the information to be published once and viewed by many different programs. The user subscribes to a feed by entering the feed&apos;s URI (often referred to informally as a &quot;URL&quot;, although technically, those two terms are not exactly synonymous) into the reader or by clicking an RSS icon in a browser that initiates the subscription process. The RSS reader checks the user&apos;s subscribed feeds regularly for new work, downloads any updates that it finds, and provides a user interface to monitor and read the feeds.&quot;

In a way RSS replaces email subscriptions so that you can subscribe to receive updates when content is added or changed on websites that you monitory.  This way you can monitory these changes in your RSS reader so that your email box doesn&apos;t get clogged up.

===Using RSS in Xataface===

Xataface allows you to subscribe to:

# Entire tables
# Any found set
# Changes to a particular record
# Related record lists

====Example 1: Subscribing to receive news updates====

A user wants to be alerted whenever a new item is inserted into the &apos;&apos;news&apos;&apos; table, so he navigates to the &apos;&apos;list&apos;&apos; tab of the &apos;&apos;news&apos;&apos; table, and clicks the RSS Feed icon in the upper right.  If he has an RSS reader application set up, this is all he has to do to subscribe to the RSS feed for the &apos;&apos;news&apos;&apos; table.  When new records are inserted, he&apos;ll receive alerts in his RSS reader.

====Example 2: Subscribing to receive found set updates====

A user wants to be alerted whenever a new item is inserted into the &apos;&apos;news&apos;&apos; table that contains the phrase &quot;Buffalo Bills&quot;, because he is a Buffalo Bills fan.  So he navigates to the &apos;&apos;news&apos;&apos; table, and does a search for the phrase &quot;Buffalo Bills&quot;.  Then he clicks on the &quot;RSS Feed&quot; icon in the upper right of the result set list.  If he has an RSS reader application set up, this is all he has to do to subscribe to the RSS feed for &apos;&apos;news&apos;&apos; items containing the phrase &quot;Buffalo Bills&quot;.  Whenever a new item is posted with this phrase, he will be notified via RSS of the new record.

====Example 3: Subscribing to a related list====

Suppose you want to receive updates whenever a particular author adds a book to his list of published works.  Further suppose this is represented by a relationship between the &apos;&apos;authors&apos;&apos; table and the &apos;&apos;books&apos;&apos; table named &apos;&apos;publications&apos;&apos;.  You can subscribe to the RSS feed for his publications by navigating to the &apos;&apos;publications&apos;&apos; tab for that author, then clicking on the &quot;RSS Feed&quot; icon in the upper right.  Now whenever this author adds a new book to his publications list, you&apos;ll be notified via RSS.



===Example usage in Xataface===

# A user wants to be alerted whenever a new item is inserted into the &apos;&apos;news&apos;&apos; table, so he navigates to the &apos;&apos;list&apos;&apos; tab of the &apos;&apos;news&apos;&apos; table, and clicks the RSS Feed icon in the upper right.  If he has an RSS reader application set up, this is all he has to do to subscribe to the RSS feed for the &apos;&apos;news&apos;&apos; table.  When new records are inserted, he&apos;ll receive alerts in his RSS reader.
# A user wants to be alerted whenever a new record about &quot;Wayne Gretzky&quot; is inserted in to the &apos;&apos;news&apos;&apos; table.  He navigates to the &apos;&apos;news&apos;&apos; table, then performs a search for &quot;Wayne Gretzky&quot; using the top right search box.  Then, he clicks on the &quot;RSS Feed&quot; icon in the upper right of the result list.  Now, whenever a new item is inserted with the phrase &quot;Wayne Gretzky&quot;, the user will be notified via RSS.

===Configuring RSS Feeds===

As with everything else in Xataface, you can configure your RSS feeds to appear just as you want them to.  The following delegate class methods are available to be defined in the table delegate class for your feed:

{| 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
|-
| getRSSDescription
| Overrides the default generated RSS description for a record.
| 1.0
|-
| [[getSingleRecordSearchFeed]]
| Overrides the default feed for a subsearch within a record.  This works identically to the [[getFeed]] method except that it takes 2 parameters: one for the current record, and a second parameter for the query.
| 1.2.3
|}

==Example Configuration==

There are 2 parts to configuring your RSS feeds.

# Configuring the feed as a whole
# Configuring the feed items (that is each record that will appear in your RSS feed).

===Configuring the Feed as a whole===

For configuring the feed as a whole, we have 2 options.  We can specify the title, description, and link for the feed in the &apos;&apos;[_feed]&apos;&apos; section of your [[conf.ini file]].  This is sort of a &quot;one size fits all&quot; approach where all feeds generated from your application will share the same title.

E.g.

&lt;code&gt;
[_feed]
    title=&quot;My Site News&quot;
    description=&quot;News updates from my site&quot;
    link=&quot;http://www.example.com&quot;
&lt;/code&gt;

However, if we want our feed&apos;s information to depend on the user&apos;s query (e.g. what the user was searching for, or which table the feed is generated on, we have more flexibility if we define the [[getFeed]] method in either the [[Application Delegate Class|application delegate class]] or the [[Delegate class methods|table delegate class]].  E.g.

&lt;code&gt;
function getFeed($query=array()){
    $params = array();
    if ( @$query[&apos;-search&apos;] ) $params[&apos;title&apos;] = &apos;&quot;&apos;.$query[&apos;-search&apos;].&apos;&quot; results&apos;;
    else $params[&apos;title&apos;] = &apos;All records from my table&apos;;
    return $params;
}
&lt;/code&gt;

Notice that I don&apos;t need to define all possible parameters.  Any parameters that I don&apos;t define will be provided automatically by Xataface, or it will simply use the values specified in your &apos;&apos;[_feed]&apos;&apos; section of the [[conf.ini file]].

===Configuring Feed Items===

Configuring the feed items is quite important for ensuring that subscribers are seeing what you want them to see in the RSS feed.  Xataface tries to guess appropriate content for your feed items if you don&apos;t specify it explicitly, but you&apos;ll likely want to tweak it a little bit to make the feed look more polished for your purposes.

Use the [[getFeedItem]] [[Delegate class methods|delegate class method]] to specify how a feed item behaves (e.g. the title, content, date, author, link).

E.g.

&lt;code&gt;
function getFeedItem(&amp;$record)){
    return array(
        &apos;description&apos; =&gt; $record-&gt;val(&apos;body&apos;)
    );
}
&lt;/code&gt;

Once again, notice that we don&apos;t need to specify all available options.  Only those options that we want to override.  In this case we want the description of the feed item to simply display the body of our news item.  The description of an RSS feed item is effectively the body text that the user sees why they click on an item in their news reader, so this is quite important.


</content>
	<keywords>RSS Feeds</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=128">
	<page_name>list:type</page_name>
	<page_id>128</page_id>
	<page_title>list:type relationships.ini file directive</page_title>
	<content>Return to [[relationships.ini file]]

[[toc]]

The list:type directive allows you to override the default list that is used to display related records.  As of Xataface 1.3 there is only one possible value that will have any effect on this directive: &quot;treetable&quot;.  

Setting
&lt;code&gt;
list:type=treetable
&lt;/code&gt;
will cause the related records to be displayed as an expandable/collapsible tree table as shown here:
&lt;nowiki&gt;&lt;img src=&quot;http://media.weblite.ca/files/photos/Screen%20shot%202011-04-29%20at%2011.49.33%20AM.png?max_width=640&quot;/&gt;&lt;/nowiki&gt;

===Prerequisites===

The TreeTable component needs to be able to figure out the logical children of each record in order to know what to show when a row is expanded.  You can use either the [[meta:class]] directive of the [[relationships.ini]] file to specify a relationship as a &quot;children&quot; relationship, or you can implement the [[getChildren]] method of the table delegate class to manually define a record&apos;s child elements.

==See Also==

* [[getChildren]]
* [[meta:class]]
* [[getParent]]</content>
	<keywords></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=127">
	<page_name>meta:class</page_name>
	<page_id>127</page_id>
	<page_title>meta:class relationships.ini file directive</page_title>
	<content>Return to [[relationships.ini file]]

[[toc]]

The &apos;&apos;meta:class&apos;&apos; directive allows you to ascribe special meaning to a relationship which Xataface can use in various parts of your application to provide enhanced capabilities.

For example you can specify a relationship as a &quot;parent&quot; relationship, thereby using the relationship to obtain the &quot;parent&quot; of records of this table.  This can be used to help build breadcrumbs.

You can also specify a relationship as a &quot;children&quot; relationship which would treat records in the relationship as children of the current record.  This can be used in conjunction with the [[list:type]]=treetable directive of the [[relationships.ini file]] to build a tree table that navigates all child records and subtrees.

The Dataface_Record class contains some methods for retrieving the parent and children of records and these methods will take into account any settings you make here.

===Allowed Values===

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| parent
| Designates the relationship as a &apos;parent&apos; relationship, meaning that the first record in this relationship will be treated as the parent of the current record.  This setting can be overridden by the [[getParent]] method of the table delegate class if implemented.
| 0.8
|-
| children
| Designates the relationship as a &apos;children&apos; relationship meaning that records of the the relationship will be treated as a children.  This setting can be overridden by the [[getChildren]] method of the table delegate class if implemented.
| 0.8
|}


==See Also==

# &apos;&apos;&apos;[[list:type]]&apos;&apos;&apos; - [[relationships.ini file]] directive to use a treetable for the related record list of a relationship.
# &apos;&apos;&apos;[[getChildren]]&apos;&apos;&apos; - Delegate class method to explicitly define the Dataface_Record objects that are to be considered as child records of the current record.
# &apos;&apos;&apos;[[getParent]]&apos;&apos;&apos; - Delegate class method to explicitly define the Dataface_Record object that is to be considered as the parent record of the current record.
</content>
	<keywords></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=59">
	<page_name>no_access_text</page_name>
	<page_id>59</page_id>
	<page_title>no_access_text</page_title>
	<content>Whenever the NO_ACCESS permission is given for a field, normally the text NO ACCESS appears.  But we might want to display another text.  Here is an example of the text subscribe is used instead of NO ACCESS whenever the NO_ACCESS permissions is given.

&lt;code&gt;function no_access_text(&amp;$record){
		return &quot;Subscribe&quot;;
	}
&lt;/code&gt;</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki></record>