<?xml version="1.0"?>
<record><wiki id="wiki?page_id=45">
	<page_name>_output_cache</page_name>
	<page_id>45</page_id>
	<page_title>The Xataface Output Cache</page_title>
	<content>&lt;nowiki&gt;&lt;div class=&quot;portalMessage&quot;&gt;Note: There was a bug in the output cache affecting Xataface version 1.0 to 1.3rc1.  If you are using a version of Xataface older than 1.3rc2 then you should either disable the output cache, or replace the Dataface/OutputCache.php file with one from a newer version.&lt;/div&gt;&lt;/nowiki&gt;

[[toc]]

Xataface does quite a bit of heavy lifting on each page request.  If your application is getting a lot of traffic that is slowing your server down, you may want to look at enabling the Xataface output cache.

===Features===

* Improve speed of application dramatically - especially for seldom updated sites.
* Supports multiple languages.
* Supports multiple users (each user has own cache).
* Provides GZIP compression for improved performance.

===How it works?===

When you receive a request, Xataface will return a cached version of the page if the page has been accessed before.  If the page doesn&apos;t yet exist in the cache it generates the page, saves it to the cache and outputs it to the user transparently.  The cache is completely transparent to your users.

===Where is the cache stored?===

Xataface creates a table called &apos;&apos;__output_cache&apos;&apos; that stores all of the cached content for your application.  This table stores both a GZIPed and regular version of each page.  If the user&apos;s browser supports GZIP compression, Xataface will automatically return the GZIP version.  This results in further performance improvements.

===What if I make changes to the database?===

Xataface records which tables were in use when a page is cached.  If any of those tables are modified after the page is cached, Xataface will mark that cached page as &apos;&apos;out of date&apos;&apos; and regenerate it the next time that it is requested.

===What if I make changes to my configuration files and templates?===

The output cache will have to be manually cleared if you make any changes to your source files (e.g. PHP, templates, and INI files).  Clearing the cache is as easy as deleting or emptying the &apos;&apos;__output_cache&apos;&apos; table.

===How do I enable the Cache?===

Add the following to your [[conf.ini file]]:

&lt;code&gt;
[_output_cache]
    enabled=1
&lt;/code&gt;

===How do I disable the Cache?===

Simply comment out or remove the &apos;&apos;[_output_cache]&apos;&apos; section of your [[conf.ini file]].  E.g.
&lt;code&gt;
;[_output_cache]
;   enabled=1
&lt;/code&gt;

===Configuration Options===

The following directives can be added to the &apos;&apos;[_output_cache]&apos;&apos; section of your [[conf.ini file]] to customize how your output cache works.

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| lifeTime
| Number of seconds before cached page is considered &apos;&apos;out of date&apos;&apos;.
| 0.7
|-
| tableName
| The name of the table to store the cached pages.  Default &apos;__output_cache&apos;.
| 0.7
|-
| ignoredTables
| A comma-delimited list of tables that don&apos;t affect the output cache (i.e. these tables can be changed without causing the output cache to be refreshed.
| 0.7
|-
| observedTables
| A comma-delimited list of tables that should affect the status of the output cache for every page (whether the table is explicitly used by the page or not).  This is a useful way to tell Xataface to refresh your cache.
| 0.7
|-
| exemptActions
| A comma-delimited list of actions that are exempt from the output cache (and thus should not be cached).
| 0.7
|}</content>
	<keywords>output cache</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=44">
	<page_name>timestamp</page_name>
	<page_id>44</page_id>
	<page_title>timestamp</page_title>
	<content>Return to [[fields.ini file]]

A very simple sample of this could be your table contains the table date_created as a type of date.  In your fields.ini, you would include this:

&lt;code&gt;
[date_created]
timestamp=insert
widget:type=hidden
&lt;/code&gt;

The widget:type=hidden will make the field not visible during entry and editing.  And the timestamp=insert causes the field to be filled upon insertion of a new record.

===Possible Values===

* &apos;&apos;&apos;update&apos;&apos;&apos; - Causes timestamp to be updated whenever the record is modified.
* &apos;&apos;&apos;insert&apos;&apos;&apos; - Causes the timestamp to be updated only when the record is first inserted.</content>
	<keywords>timestamp, date, datetime</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=43">
	<page_name>Calendar_Action</page_name>
	<page_id>43</page_id>
	<page_title>Calendar_Action</page_title>
	<content>==Calendar Action==

[[toc]]

Xataface 1.0 includes a built-in calendar action that is disabled by default.  If enabled, it allows you to view the records in any found set as a calendar of events, as follows:

&lt;nowiki&gt;
&lt;div style=&quot;text-align:center;border: 1px solid #ccc; padding: 10px&quot;&gt;
&lt;img src=&quot;http://media.weblite.ca/files/photos/Picture -4.png?max_width=500&quot;
onmouseover=&quot;this.src=&apos;http://media.weblite.ca/files/photos/Picture -4.png&apos;;&quot;
onmouseout=&quot;this.src=&apos;http://media.weblite.ca/files/photos/Picture -4.png?max_width=500&apos;;&quot;/&gt;
&lt;/div&gt;
&lt;/nowiki&gt;

===Features===

* Monthly display
* Hourly schedule for any day by clicking on it.
* Show record details instantly by clicking on it in the calendar.
* Recognizes dates, start and end times for records when interpreted as calendar events.
* Respects searches (i.e. you can filter the records and the calendar will only show those records in the found set).

===Requirements===

Your table records should contain at least dates in order for them to be interpreted as events that can be placed in a calendar.

===Setting up the Calendar===

Suppose I have a table called &apos;&apos;Lessons&apos;&apos; that stores information about scheduled music lessons.  If I want to add the calendar to this table, then I would add an &apos;&apos;[[actions.ini file]]&apos;&apos; to the &apos;&apos;tables/Lessons&apos;&apos; directory with the following contents:&lt;code&gt;
[calendar &gt; calendar]
    condition=&quot;true&quot;
&lt;/code&gt;
This overrides the calendar action which is disabled by default, and enables it for the &apos;&apos;Lessons&apos;&apos; table.

Next I need to inform Xataface which fields store the event dates and times so that the records can be laid out in the calendar appropriately.  (Note that if you skip this step, Xataface will make a best guess based on column types and names - but it is better to specify these explicitly).

In the &apos;&apos;Lessons&apos;&apos; table I have the following fields that are relevant here:

* &apos;&apos;lesson_date&apos;&apos; - A date field containing the date and start time of the event.
* &apos;&apos;start_time&apos;&apos; - A time field with the start time of the lesson.

We can tell Xataface to treat these fields accordingly by adding the following directives to the appropriate field sections of the [[fields.ini file]] for the &apos;&apos;Lessons&apos;&apos; table:

* &apos;&apos;event.date=1&apos;&apos; - Specifies that the field stores the date of the event.
* &apos;&apos;event.start=1&apos;&apos; - Specifies that the field stores the start time of the event.

So in our case we&apos;ll modify the [[fields.ini file]] as follows:

&lt;code&gt;
[lesson_date]
    event.date=1

[start_time]
    event.start=1
&lt;/code&gt;

Now if we load up our application, we should now see a &apos;&apos;calendar&apos;&apos; tab along side &apos;&apos;list&apos;&apos;, &apos;&apos;details&apos;&apos;, and &apos;&apos;find&apos;&apos; for the &apos;&apos;Lessons&apos;&apos; table.  Click on this tab to see your records displayed in a calendar.

===Using a datetime field to store both date and start time===

You can also use a single field to store both the date and start time for an event.  In this case you just provide the &apos;&apos;event.date&apos;&apos; and &apos;&apos;event.start&apos;&apos; directives for the same field.  For example if the &apos;&apos;lesson_date&apos;&apos; was a datetime field that marked the date and time of the lesson, we would modify our [[fields.ini]] file as follows:

&lt;code&gt;
[lesson_date]
    event.date=1
    event.start=1
&lt;/code&gt;

===Available Fields===

The Calendar action will look for the following pieces of information in your records:

{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| event.date
| Indicates that the field contains the date of the event.
| 1.0
|-
| event.start
| Indicates that the field contains the start time of the event.
| 1.0
|-
| event.end
| Indicates that the field contains the end time of the event.
| 1.0
|-
| event.location
| Indicates that the field contains the location of the event.
| 1.0
|-
| event.category
| Indicates that the field contains the category of the event.
| 1.0
|}</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=42">
	<page_name>getFeed</page_name>
	<page_id>42</page_id>
	<page_title>getFeed</page_title>
	<content>==getFeed() Delegate Class Method==

[[toc]]

===Synopsis:===

The getFeed() method of a table [[Delegate class methods|delegate class]] or [[Application Delegate Class|application delegate class]] returns an associative array of parameters to configure the [[Introduction_to_RSS_Feeds_in_Xataface|RSS feed]] for a particular table .  An RSS feed consists of the following components:

# &apos;&apos;&apos;title&apos;&apos;&apos; - The title of the RSS feed as it should appear in the subscribers&apos; feed list.
# &apos;&apos;&apos;description&apos;&apos;&apos; - Describes the RSS feed.
# &apos;&apos;&apos;link&apos;&apos;&apos; - A link to the RSS feed
# &apos;&apos;&apos;syndicationURL&apos;&apos;&apos; - The URL to this RSS feed&apos;s site.

===Parameters===

# &apos;&apos;&apos;array&apos;&apos;&apos; $query - The HTTP query.  Contains information like the current table, current action, and search parameters.  This allows you to customize your RSS feed depending on the user&apos;s query parameters.

===Return Value===

The getFeed() method returns an associative array with the components of the RSS feed.  This array does not need to contain all possible keys, or even any keys.  Any keys that are omitted will simply use default values in the RSS feed.  The array may contain the following keys:

{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| title
| The title for the RSS feed.  If this omitted, it will try to use the &apos;&apos;title&apos;&apos; directive of the &apos;&apos;[_feed]&apos;&apos; section of the [[conf.ini file]].  Failing that, it will try to generate an appropriate title for the feed depending on the current query.
| 1.0
|-
| description
| A Description for this RSS feed.  If this is omitted, it will try to use the &apos;&apos;description&apos;&apos; directive of the &apos;&apos;[_feed]&apos;&apos; section of the [[conf.ini file]].
| 1.0
|-
| link
| A link to the source page of the RSS feed.  If this is omitted, it will try to use the &apos;&apos;link&apos;&apos; directive of the &apos;&apos;[_feed]&apos;&apos; section of the [[conf.ini file]].
| 1.0
|-
| syndicationURL
| A link to the source page of the RSS feed.  If this is omitted, it will try to use the &apos;&apos;syndicationURL&apos;&apos; directive of the &apos;&apos;[_feed]&apos;&apos; section of the [[conf.ini file]].
| 1.0
|}

===Example===

&lt;code&gt;
function getFeed(&amp;$query){
    return array(
        &apos;title&apos; =&gt; &quot;RSS feed for the &quot;.$query[&apos;-table&apos;].&quot; table.&quot;,
        &apos;description&apos; =&gt; &quot;News and updates for automobiles&quot;,
        &apos;link&apos; =&gt; df_absolute_url(DATAFACE_SITE_HREF),
        &apos;syndicationURL&apos; =&gt; df_absolute_url(DATAFACE_SITE_HREF)
    );
}

&lt;/code&gt;

&apos;&apos;&apos;Note that RSS feeds will work perfectly well without defining this method.  This just allows you to customize one or more parameters of the RSS feed&apos;&apos;&apos;.

===See Also:===

* &apos;&apos;&apos;[[getFeedItem]]&apos;&apos;&apos; - A delegate class method available to both the [[Delegate class methods|table delegate classes]] to configure parameters for the particular items of the RSS feed.
* &apos;&apos;&apos;[[getRelatedFeed]]&apos;&apos;&apos; - A [[Delegate class methods|delegate class method]] available to both the [[Application Delegate Class|application delegate class]] and the [[Delegate class methods|table delegate classes]] to configure the [[Introduction to RSS Feeds in Xataface|RSS feed]] for a related records list.
* &apos;&apos;&apos;[[getRSSDescription]]&apos;&apos;&apos; - A delegate class method to override the description that appears for a particular record in an RSS feed.  (The same as the &apos;&apos;description&apos;&apos; parameter of the [[getFeedItem]] method.
* &apos;&apos;&apos;[[Introduction to RSS Feeds in Xataface]]&apos;&apos;&apos; - An overview of Xataface&apos;s RSS feed support.</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=41">
	<page_name>getFeedItem</page_name>
	<page_id>41</page_id>
	<page_title>getFeedItem</page_title>
	<content>==getFeedItem() Delegate Class Method==

[[toc]]

===Synopsis:===

The getFeedItem() method of a table [[Delegate class methods|delegate class]] returns an associative array of parameters for a record as it should appear as part of an [[Introduction_to_RSS_Feeds_in_Xataface|RSS feed]].  An RSS feed item consists of the following components:

# &apos;&apos;&apos;title&apos;&apos;&apos; - The title of the record as it appears in the RSS feed.
# &apos;&apos;&apos;description&apos;&apos;&apos; - The description of the record for the RSS feed.  This is really the body of the RSS feed item.
# &apos;&apos;&apos;link&apos;&apos;&apos; - The linkback URL if users want to know more about the record.
# &apos;&apos;&apos;date&apos;&apos;&apos; - The date that the record was posted/modified.
# &apos;&apos;&apos;author&apos;&apos;&apos; - The name of the person who posted this record.
# &apos;&apos;&apos;source&apos;&apos;&apos; - URL to the site where record originated from.

===Parameters===

# &apos;&apos;&apos;Dataface_Record&apos;&apos;&apos; &amp;$record - The record that is being represented in an RSS feed.

===Return Value===

The getFeedItem() method returns an associative array with the components of the RSS feed.  This array does not need to contain all possible keys, or even any keys.  Any keys that are omitted will simply use default values in the RSS feed.  The array may contain the following keys:

{| class=&quot;listing listing2&quot;
! Name
! Description
! Version
|-
| title
| The record title as it appears in RSS feeds.  If this is omitted, the RSS feed will simply use the output of [http://dataface.weblite.ca/Dataface_Record Dataface_Record&apos;s] [http://dataface.weblite.ca/getTitle getTitle()] method.
| 1.0
|-
| description
| The record description.  This is used in the main body of the RSS feed.   If this is omitted, the RSS feed will use an HTML table that shows all of the field data in the record.  This value can also be overridden using the [[getRSSDescription]] method of the delegate class.
| 1.0
|-
| link
| The URL to this record.  If this is omitted it just points to the &apos;&apos;view&apos;&apos; tab for this record.  However you can direct it anywhere you like.  When the user clicks on the &quot;More Info&quot; link in his RSS reader it will direct him to this link.
| 1.0
|-
| date
| The date that this record was posted or last modified.  This is the date that an RSS reader will use to decide if it has already loaded the record yet.  If this is omitted it will try the [http://dataface.weblite.ca/Dataface_Record Dataface_Record&apos;s] [http://dataface.weblite.ca/getLastModified getLastModified()] method to obtain the last modified date of the record.  Failing that, it will use [http://dataface.weblite.ca/Dataface_Record Dataface_Record&apos;s] [http://dataface.weblite.ca/getCreated getCreated()] method to try to obtain the creation date of the record.  This date should be a unix timestamp.
| 1.0
|-
| author
| The name of the user who posted this record.  If this is omitted, then it will try to use [http://dataface.weblite.ca/Dataface_Record Dataface_Record&apos;s] [http://dataface.weblite.ca/getCreator getCreator()] method.  Failing that, it will use the value of the &apos;&apos;default_author&apos;&apos; parameter in the &apos;&apos;[_feed]&apos;&apos; section of the [[conf.ini file]].  If that is not defined, then it simply uses the string &quot;Site Administrator&quot;.
| 1.0
|-
| source
| The source URL where the feed is to have originated.  If none is specified, then it will use the value of the &apos;&apos;source&apos;&apos; parameter in the &apos;&apos;[_feed]&apos;&apos; section of the [[conf.ini file]].  Failing that, it will simply use the URL to the application.

Note that you can alternatively define this value using the [[getFeedSource]] method.
| 1.0
|}

===Example===

&lt;code&gt;
function getFeedItem(&amp;$record){
    return array(
        &apos;title&apos; =&gt; &quot;News Item: &quot;.$record-&gt;getTitle(),
        &apos;description&apos; =&gt; $record-&gt;display(&apos;News Body&apos;),
        &apos;link&apos; =&gt; $record-&gt;getPublicLink(),
        &apos;date&apos; =&gt; strtotime($record-&gt;val(&apos;last_modified&apos;)),
        &apos;author&apos; =&gt; $record-&gt;val(&apos;posted_by&apos;),
        &apos;source&apos; =&gt; &apos;http://www.example.com&apos;
    );
}

&lt;/code&gt;

&apos;&apos;&apos;Note that RSS feeds will work perfectly well without defining this method.  This just allows you to customize one or more parameters of the RSS feed&apos;&apos;&apos;.

===See Also:===

* &apos;&apos;&apos;[[getFeed]]&apos;&apos;&apos; - A delegate class method available to both the [[Application Delegate Class]] and the [[Delegate class methods|table delegate classes]] to configure the RSS feed as a whole (not just for an individual item in the RSS feed.
* &apos;&apos;&apos;[[getRelatedFeed]]&apos;&apos;&apos; - A [[Delegate class methods|delegate class method]] available to both the [[Application Delegate Class|application delegate class]] and the [[Delegate class methods|table delegate classes]] to configure the [[Introduction to RSS Feeds in Xataface|RSS feed]] for a related records list.
* &apos;&apos;&apos;[[getRSSDescription]]&apos;&apos;&apos; - A delegate class method to override the description that appears for a particular record in an RSS feed.  (The same as the &apos;&apos;description&apos;&apos; parameter of the [[getFeedItem]] method.
* &apos;&apos;&apos;[[Introduction to RSS Feeds in Xataface]]&apos;&apos;&apos; - An overview of Xataface&apos;s RSS feed support.</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<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=39">
	<page_name>Drag_and_Drop_Reordering_of_Relationships</page_name>
	<page_id>39</page_id>
	<page_title>Drag_and_Drop_Reordering_of_Relationships</page_title>
	<content>==Drag and Drop Reordering of Related Records in Xataface==

One powerful aspect of Xataface is its abstraction of relationships between tables.  Once you define a relationship users can browse related records, add new and existing related records, and delete related records to or from the relationship.  For example, suppose you have a &apos;&apos;people&apos;&apos; table and a &apos;&apos;publications&apos;&apos;, you could define a relationship from &apos;&apos;people&apos;&apos; to &apos;&apos;publications&apos;&apos; to identify publications that belong to a particular person.  The table&apos;s might look something like:

===people table===

{| class=&quot;listing listing2&quot;
! person_id
! person_name
|-
| 1
| John Smith
|-
| 2
| Ben Stein
|-
| 3
| Harley Davidson
|-
| 4
| Trevor Linden
|}


===publications table===

{| class=&quot;listing listing2&quot;
! publication_id
! owner_id
! pub_title
|-
| 1
| 2
| Introduction to widgetry
|-
| 2
| 2
| Intermediate Widgetry
|-
| 3
| 2
| Advanced Widgetry
|-
| 4
| 3
| How to play the violin
|}


See http://xataface.com/documentation/tutorial/getting_started/relationships for an introduction to relationships in Xataface, and how to define them.

Our relationship definition in the  &apos;&apos;people&apos;&apos; table&apos;s [[relationships.ini file]] might look something like:

&lt;code&gt;
[my_pubications]
    publications.owner_id=&quot;$person_id&quot;
&lt;/code&gt;

This indicates that any publication whose &apos;&apos;owner_id&apos;&apos; column matches the current &apos;&apos;people&apos;&apos; record&apos;s &apos;&apos;person_id&apos;&apos; field is considered part of the relationship.  Using our example data above, this would mean that Ben Stein&apos;s &apos;&apos;my_publications&apos;&apos; relationship would contain 3 records: &quot;Introduction to Widgetry&quot;, &quot;Intermediate Widgetry&quot;, and &quot;Advanced Widgetry&quot;.  In our Xataface application this means that in the &quot;Details&quot; tab for the &quot;Ben Stein&quot; record, we would see a sub-tab &apos;&apos;My Publications&apos;&apos; which would contain a list of Ben Stein&apos;s publications.

===Adding Publication Order===

Now that we have our relationship, what if Ben Stein wants his publications to appear in a particular order whenever they are displayed to the user.  Xataface allows us to specify an &quot;order&quot; column for our relationship, which will cause the related records to be orderable by drag and drop (if the user has appropriate permissions).

# Add a field to the &apos;&apos;publications&apos;&apos; table named &quot;pub_order&quot;
# Change the relationship definition in the people table&apos;s [[relationships.ini file]] to tell Xataface to use the pub_order field for sorting:&lt;code&gt;
[my_pubications]
    publications.owner_id=&quot;$person_id&quot;
    metafields:order=&quot;pub_order&quot;
&lt;/code&gt;

Now load up your application and navigate to the &quot;My Publications&quot; tab for the &quot;Ben Stein&quot; record. Now you&apos;re able to drag and drop rows in your application to reorder them.

===Permission to Reorder Records===

Only users who have been assigned the &apos;&apos;reorder_related_records&apos;&apos; permission for a record&apos;s relationship are allowed to reorder records of that relationship.  By default the &apos;&apos;EDIT&apos;&apos; role contains this permission, as does any role that permits the user to edit the parent record of the relationship.  The &apos;&apos;READ ONLY&apos;&apos; role does not contain this permission.  If you want to explicitly deny this permission for all relationships in a record, you can simply set this permission to 0 in the associated role within your application&apos;s [[permissions.ini file]]:

&lt;code&gt;
[MY ROLE]
     reorder_related_records=0
&lt;/code&gt;

For more information about permssions see:

* [[permissions.ini file|The Permissions.ini file reference]]
* [http://xataface.com/documentation/tutorial/getting_started/permissions Introduction to Permissions]

===Loading Related Records using the Xataface API===

The ordering that is set via this drag and drop method is also honoured by the Xataface API when fetching related records.  You can load related records using the [http://dataface.weblite.ca/getRelatedRecordObjects getRelatedRecordObjects] method of the [http://dataface.weblite.ca/Dataface_Record Dataface_Record] class. E.g.

&lt;code&gt;
$benStein = df_get_record(&apos;people&apos;, array(&apos;person_id&apos;=&gt;2));
$pubs = $benStein-&gt;getRelatedRecordObjects(&apos;my_publications&apos;);
foreach ($pubs as $pub){
    echo $pub-&gt;val(&apos;pub_title&apos;).&apos;&lt;br/&gt;&apos;;
}
&lt;/code&gt;
This will list up to the first 30 publications of Ben stein in the order prescribed by our drag and drop ordering scheme.
</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=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=37">
	<page_name>URL_Conventions</page_name>
	<page_id>37</page_id>
	<page_title>URL_Conventions</page_title>
	<content>==Xataface URL Conventions==

[[toc]]

Xataface adheres to a few simple URL conventions for all of its actions.  When you understand how Xataface URLs work you begin to get far more out of your applications.  By specifying the appropriate query parameters to can jump directly to any point in your application, or produce a specific result set.

For example, the URL &apos;&apos;index.php?-table=people&apos;&apos; will take you to the &apos;&apos;people&apos;&apos; table (and since the default action for a Xataface application is &apos;&apos;list&apos;&apos;, it will take you to the &apos;&apos;list&apos;&apos; view.

You could be more explicit by specifying the action in the URL directly: &apos;&apos;index.php?-table=people&amp;-action=list&apos;&apos;.  This would take you to the same screen.  From this example, you see that you can specify such things as the table and action via GET parameters.  Xataface accepts many more GET parameters also, as you&apos;ll see in the next section.

===Available GET Parameters===


{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Default
! Version
|-
| -action
| Specifies the action to perform.  E.g. &apos;&apos;browse&apos;&apos;, &apos;&apos;list&apos;&apos;, &apos;&apos;find&apos;&apos;, &apos;&apos;edit&apos;&apos;, &apos;&apos;new&apos;&apos;, ... etc..
| list
| all
|-
| -table
| The name of the table to use as the context table.
| The first table in the [_tables] section of your [[conf.ini file]]
| all
|-
| -skip
| Skip a certain number of results in the current found set to display.  E.g. If there are 100 records in the table and you want to start browsing from the 30th record, you would set &apos;&apos;-skip=29&apos;&apos;.

Not to be confused with the &apos;&apos;-cursor&apos;&apos; parameter which is used to specify which record to view in the &apos;&apos;details&apos;&apos; tab.
| 0
| all
|-
| -limit
| The maximum number of records in the found set to display.
| 30
| all
|-
| -cursor
| The index of the record in the current found set that is treated as the &quot;current&quot; record.  This is used in the &apos;&apos;details&apos;&apos; tab to identify which record to act on.  E.g. which record to view or edit.
| 0
| all
|-
| -sort
| A comma-delimited list of columns to sort the result set on.
| null
| all
|-
| -relationship
| If we are browsing related records, this specifies the name of the relationship.
| null
| all
|-
| -related:start
| If we are browsing related records, this is the first record in the relationship to show.
| 0
| all
|-
| -related:limit
| If we are browsing related records, this is the number of records to show per page.
| 30
| all
|-
| -search
| A keyword search term to filter the found set on.  Any row containing any field that matches the query will be returned.
| null
| all
|-
| --no-query=1
| A flag to indicate that xataface should not query the database by default.  This flag is used in the new record form to prevent the form parameters from being interpreted as query parameters to search in the database.  If you set this flag, it likely result in a message saying &quot;No records found&quot;.  Generally you would only use this in a custom action where you are not relying on Xataface&apos;s default found set.
| 0
| 1.3
|}

There are many other GET parameters that are used in various contexts but the above parameters are available throughout the entire application.

===Finding Records using the URL===

Notice that all of the GET parameters mentioned in the previous section begin with a hyphen (i.e. &apos;-&apos;).  This is a convention Xataface uses to distinguish directives from search queries.  All parameters that do not begin with &apos;-&apos; are treated as a query to filter the found set.

For example, &apos;&apos;first_name=bob&apos;&apos; used as a GET parameter would cause the found set to be filtered so that only records where the &apos;&apos;first_name&apos;&apos; column contains the phrase &quot;bob&quot; are returned.  Putting this all together, suppose we wanted to show the list tab for the &apos;&apos;people&apos;&apos; table, but only wanted to show the people with first names containing &quot;bob&quot;:

index.php?-action=list&amp;-table=people&amp;first_name=bob

====Exact, Range, and Pattern Matching====

By default, queries on text columns look for partial matches.  I.e. if you search for &quot;bob&quot; it will match &quot;bob&quot;, &quot;bobby&quot;, &quot;rubob&quot;, and any other text that contains &quot;bob&quot;.  If you are only interested in finding records that match &apos;&apos;exactly&apos;&apos; &quot;bob&quot;, then you can prepend an &quot;=&quot; to the query.  E.g. &apos;&apos;first_name==bob&apos;&apos;, or the full URL:

index.php?-action=list&amp;-table=people&amp;first_name==bob

This should show the &apos;&apos;list&apos;&apos; tab for the &apos;&apos;people&apos;&apos; table with only records with first name exactly &quot;bob&quot;.

There are a number of modifiers that you can prepend to your query to modify how it is executed.  They are as follows:

=====Search Operators=====

{| class=&quot;listing listing2&quot;
|-
! Prefix
! Usage Example
! Description
|- 
| &gt;
| age=&gt;10
| Match records greater than search parameter.
|-
| &lt;
| age=&lt;10
| Match records less than search parameter.
|-
| &gt;=
| age=&gt;=10
| Match records greater than or equal to the search parameter.
|-
| &lt;=
| age=&lt;=10
| Match records less than or equal to the search parameter.
|-
| ..
| age=10..20
| Match records in a given range.
|-
| =
| first_name==bob
| Match records that exactly match the search parameter (if there is no prefix then it will search for partial matches on text/varchar/char fields.).
|-
| ~
| first_name=~a%
| Exact match, but you can include wildcards such as &apos;%&apos; and &apos;?&apos; in your search.
|}


=====Search Examples=====

Given the following data set:

{| class=&quot;listing listing2&quot;
|-
! first_name
! age
|-
| Bob
| 10
|-
| Cindy
| 12
|-
| Julie
| 6
|-
| Jake
| 8
|-
| Kabob
| 16
|}

Here are some example queries on this data set and their results:

{| class=&quot;listing listing2&quot;
|-
! Query
! Matches
|- 
| age=&gt;10 
| match records where &apos;&apos;age&apos;&apos; is greater than 10.  This includes &apos;&apos;Cindy&apos;&apos; and &apos;&apos;Kabob&apos;&apos;.
|-
| age=&lt;10 
| match records where &apos;&apos;age&apos;&apos; is less than 10.  This includes &apos;&apos;Julie&apos;&apos; and &apos;&apos;Jake&apos;&apos;
|-
| age=&gt;=10 
| match records where &apos;&apos;age&apos;&apos; is greater or equal to 10.  This includes &apos;&apos;Bob&apos;&apos;, &apos;&apos;Cindy&apos;&apos;, and &apos;&apos;Kabob&apos;&apos;.
|-
| age=&lt;=10
| match records where &apos;&apos;age&apos;&apos; is less than or equal to 10. This includes &apos;&apos;Bob&apos;&apos;, &apos;&apos;Julie&apos;&apos;, and &apos;&apos;Jake&apos;&apos;.
|-
| age=8..10
| match records where &apos;&apos;age&apos;&apos; is between 8 and 10.  This includes &apos;&apos;Bob&apos;&apos; and &apos;&apos;Jake&apos;&apos;.
|-
| first_name=bob
| Matches records where &apos;&apos;first_name&apos;&apos; contains &quot;bob&quot;.  This includes &apos;&apos;Bob&apos;&apos; and &apos;&apos;Kabob&apos;&apos;.
|-
| first_name==bob
| Matches records where &apos;&apos;first_name&apos;&apos; is exactly &quot;bob&quot;.  This includes &apos;&apos;Bob&apos;&apos; only.
|-
| first_name=~J%
| Matches records that begin with &quot;J&quot;.  This includes &apos;&apos;Jake&apos;&apos; and &apos;&apos;Julie&apos;&apos;
|}

====Matching on Related Records====

It is also possible to match records based on their related data (i.e. data that is not physically stored in the record itself, but in related records via a relationship).  For example if we want to find authors who have written about a particular topic, we would normally have to first find all of the articles that contain a topic, and then cross-reference that result against the &apos;&apos;authors&apos;&apos; table.  With Xataface we can perform this query directly from the &apos;&apos;authors&apos;&apos; table using something like the following query:
 index.php?-table=authors&amp;articles/title=sports
This assumes that the &apos;&apos;authors&apos;&apos; table has a relationship named &apos;&apos;articles&apos;&apos; that contains all of the articles that an author has written.  So the above query returns precisely those authors who have written at least one article whose &apos;&apos;title&apos;&apos; field contains the phrase &quot;sports&quot;.


=====Anatomy of a Related Query=====

 %relationship%/%field%=%query%
This matches all records in the current table such that at least one record in its &apos;&apos;&lt;relationship&gt;&apos;&apos; relationship matches the query: &apos;&apos;%field%=%query%&apos;&apos;.


====Using the &apos;&apos;OR&apos;&apos; Operator====

Xataface allows you to search for more than one value at a time using the &apos;&apos;OR&apos;&apos; operator.  E.g.
 first_name=bob+OR+steve
Would match all records with &apos;&apos;first_name&apos;&apos; containing &quot;bob&quot; or &quot;steve&quot;.
 first_name=bob+OR+=steve
Would match all records with &apos;&apos;first_name&apos;&apos; containing &quot;bob&quot; or exactly matching &quot;steve&quot;
 age=&lt;10+OR+&gt;20
Would match all records with age less than 10 or greater than 20.

====Combining Multiple Queries in One Request====

Xataface allows you to filter on more than one field at a time.  If you combine multiple queries in the same request it has the effect of strengthening the filter, matching only those rows that match &apos;&apos;both&apos;&apos; queries.  E.g.
 age=&gt;10&amp;first_name=bob
would match all records where &apos;&apos;age&apos;&apos; is greater than 10 &apos;&apos;&apos;AND&apos;&apos;&apos; that have &apos;&apos;first_name&apos;&apos; containing &quot;bob&quot;.

=====Examples of Combined Queries=====

Given the same data set as the previous set of examples:

{| class=&quot;listing listing2&quot;
|-
! first_name
! age
|-
| Bob
| 10
|-
| Cindy
| 12
|-
| Julie
| 6
|-
| Jake
| 8
|-
| Kabob
| 16
|}

 first_name=bob&amp;age=11
would return no matches because there are no records that contain both &apos;&apos;first_name&apos;&apos; &quot;bob&quot; and &apos;&apos;age&apos;&apos; 11.  However
 first_name=bob&amp;age=10
would return only &apos;&apos;Bob&apos;&apos; and
 first_name=bob&amp;age=16
would return only &apos;&apos;Kabob&apos;&apos;.

====Special Common Queries====

=====Search For Null or Blank Value=====

Searching for a null value or a blank value is an exact match for &quot;&quot;.  Therefore you can simply search for &quot;=&quot;.  E.g. To find records with a null or blank first_name you would use the query &apos;&apos;first_name==&apos;&apos;.  Or the full query:
 index.php?-table=people&amp;first_name==

=====Search for Non-blank Value=====

Searching for a non-blank value is the same as searching for a value greater than &quot;&quot;.  Therefore you can simply search for &quot;&gt;&quot;.  E.g. if you wanted to find records with a first_name, you would use the query &apos;&apos;first_name=&gt;&apos;&apos;.  Or the full query:
 index.php?-table=people&amp;first_name=&gt;

==Preserved vs Non-preserved Parameters==

As mentioned above any parameters that are prefixed by a hyphen (i.e. &quot;=&quot;) are treated as directives rather than search filters.  Hence if you want to use your own GET parameters you should always prefix them with a &quot;-&quot; to ensure that Xataface does not attempt to apply it as a search filter.  In order to keep a consistent context for users, all browsing within the same table preserves both search queries and directives.  Hence if you go to the URL:
 index.php?-table=people&amp;-action=list&amp;first_name=bob
It will show you the &apos;&apos;list&apos;&apos; tab of the &apos;&apos;people&apos;&apos; table with only those records with &apos;&apos;first_name&apos;&apos; &quot;bob&quot;.  Now if you click on the &apos;&apos;details&apos;&apos; tab it will preserve your query &apos;&apos;first_name&apos;&apos;.  The query will become something like:
 index.php?-table=people&amp;-action=details&amp;first_name=bob&amp;...etc... more parameters
(Although the parameters may appear in a different order).  This allows you to navigate forward and back to previous and next records and stay within the same found set.  It also ensures that if you click on the &apos;&apos;list&apos;&apos; tab to return to the list view, it will retain your place in the list.

Note that navigating within the same table it will also preserve your directives.  E.g. If you specify the &apos;&apos;-limit&apos;&apos; directive to show 100 records per page:
 index.php?-table=people&amp;-action=list&amp;-limit=100
And then you click on the &apos;&apos;details&apos;&apos; tab, it will retain your &apos;&apos;-limit&apos;&apos; parameter.  Of course the &apos;&apos;-limit&apos;&apos; parameter is not actually used by the &apos;&apos;details&apos;&apos; action because it works on only one record at a time (it uses the &apos;&apos;-cursor&apos;&apos; parameter instead), when you click back on the &apos;&apos;list&apos;&apos; tab it will still show you 100 records per page.

Because of this, we call the &apos;&apos;-limit&apos;&apos; parameter a preserved parameter.  It is retained when navigating within the same table.  &apos;&apos;&apos;Note:&apos;&apos;&apos; parameters are retained in the HTTP Query string, not in sessions or cookies.  This ensures that there are no surprises when you enter a URL to your Xataface application.

===Unpreserved Parameters===

If you &apos;&apos;don&apos;t&apos;&apos; want Xataface to preserve one of your parameters, you should prefix two hyphens to the parameter name.  I.e. &quot;--&quot;.  One example of an unpreserved parameters throughout Xataface applications is the &apos;&apos;--msg&apos;&apos; parameter.  The value of this parameter will be displayed on the page as an info message to the user.  Clearly you don&apos;t want this parameter preserved across requests, as you only want the user to see a message once.  E.g.
 index.php?--msg=Record+Successfully+saved.
Would didsplay the mesage &quot;Record Successfully Saved&quot; at the top of the page.  If you click on any link in the application, it will not retain the &apos;&apos;--msg&apos;&apos; parameter so you will not see the message on subsequent requests.

This parameter is useful if you want to give feedback to the user about an action that has been carried out.

===Summary===

{| class=&quot;listing listing2&quot;
|-
! Parameter Type
! Prefix
! Examples
! Description
|-
| Preserved
| -
| -limit, -skip, -cursor, -action, -table
| Parameter value is preserved when user navigates away from the page (within the same table).
|-
| Unpreserved Parameters
| --
| --msg
| Parameter is &apos;&apos;NOT&apos;&apos; retrained with the user navigates away from the page.
|}





</content>
	<keywords>URL Conventions, GET Parameters, POST parameters, Request Parameters</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=36">
	<page_name>about</page_name>
	<page_id>36</page_id>
	<page_title>about</page_title>
	<content>==About Xataface==

[[toc]]

Xataface is a flexible and shapable skin that sits on top of MySQL, making it accessible to every-day users. It automatically generates the appropriate forms, lists, and menus for a user to interact with the database without having to know any SQL. 

It is a full-featured Web application framework, and gives developers the flexibility to customize the features and behavior of their application via configuration files (using the simple INI-file syntax), templates, and plug-ins. A generic application with no customizations is completely functional, but the developer is free to customize things at his leisure.

===Who is Xataface for?===

Xataface is for web developers and database administrators who would like to build a front-end for their MySQL database.  However the resulting applications are targeted at non-technical users such as secretaries.

===Requirements===

====Xataface 1.1.x and below:====

* MySQL 3.23+
* PHP 4+

Some advanced features require MySQL version 4.1 or higher.

====Xataface 1.2 and higher====

* MySQL 3.23+
* PHP 5+

Some advanced features require MySQL version 5 or higher.

===At a Glance: Your first App===

# Create a directory for your app.
# Copy the &apos;&apos;xataface&apos;&apos; directory inside your application directory.
# Create a configuration file named &apos;&apos;conf.ini&apos;&apos; in your application directory with your database settings:&lt;code&gt;
[_database]
    host=localhost
    name=mydb
    user=me
    password=mypass

[_tables]
    ; A list of tables to include in your application&apos;s menu
    ; These tables must already exist in your database
    people=Profiles
    news=News Articles
&lt;/code&gt;
# Create an .htaccess file in your application directory to prevent access to your &apos;&apos;conf.ini&apos;&apos; file:&lt;code&gt;
&lt;FilesMatch &quot;\.ini$&quot;&gt;
Deny from all
&lt;/FilesMatch&gt;
&lt;/code&gt;
# Create a PHP script in your application directory as an access point for your app.  We&apos;ll call it &apos;&apos;index.php&apos;&apos;:&lt;code style=&quot;php&quot;&gt;
&lt;?php
// Include the Xataface API
require_once &apos;xataface/dataface-public-api.php&apos;;

// Initialize Xataface framework
df_init(__FILE__, &apos;xataface&apos;);
    // first parameter is always the same (path to the current script)
    // 2nd parameter is relative URL to xataface directory (used for CSS files and javascripts)

// Create a new application
$app =&amp; Dataface_Application::getInstance();

// Display the application
$app-&gt;display()
&lt;/code&gt;
# You&apos;re done.  Your app is ready to use!

This is just the beginning, though.  There is no limit to the customizations you can make on your application.

Read the [http://xataface.com/documentation/tutorial/getting_started Getting Started Tutorial] for more information on developing applications with Xataface.


===Product Comparison===

Xataface fits a niche that is not well covered by existing apps/frameworks.  Xataface is &apos;&apos;&apos;NOT&apos;&apos;&apos;:

* A database administration system like PHPMyAdmin
* Simply a software library/Framework like PHPCake
* Simply a content management system like Drupal
* A code generator

Xataface is a framework, but it is not a typical framework.  Most frameworks require a substantial amount of development before you get a usable application.  Xataface, on the other hand, provides you with a fully-functional application with as little as 4 lines of PHP code.  It doesn&apos;t generate any code so it is easy to maintain your application and expand on it later.

As a development framework, Xataface most closely resembles Django, a python framework for building data-driven applications.  As an application, Xataface most closely resembles Filemaker, a popular relational database that makes it easy for the end user to create layouts and manage their data.

===Features===

====General====

* &apos;&apos;&apos;Out-of-the-box Database Front-end&apos;&apos;&apos; - With as little as 4 lines of PHP code, you can have a full-featured web application for your database.
* &apos;&apos;&apos;Simple, Intuitive User interface&apos;&apos;&apos; - Default application is consistent and simple to use.  There is a &apos;tables&apos; menu, to select a table, and each table has &quot;details&quot;, &quot;list&quot;, and &quot;find&quot; tabs.  Very easy to navigate.
* &apos;&apos;&apos;Powerful configuration options&apos;&apos;&apos; - You can configure your application details (such as widget types) using simple configuration files.
* &apos;&apos;&apos;Extendible&apos;&apos;&apos; - You can modify your application as you see fit using configuration files and PHP delegate classes.
* &apos;&apos;&apos;Hooks&apos;&apos;&apos; - By observing simple conventions you can extend Xataface&apos;s functionality with hooks, triggers, and events.  E.g. add a function that is called after a record is inserted.
* &apos;&apos;&apos;Permissions&apos;&apos;&apos; - Powerful, pluggable permissions system.
* &apos;&apos;&apos;Authentication&apos;&apos;&apos; - Provides login/logout ability.  You just specify which table your users are stored in.
* &apos;&apos;&apos;Relationships&apos;&apos;&apos; - Tell Xataface how your tables are related to one another and it will provide you with more logical functionality for managing your data.
* &apos;&apos;&apos;Themeable&apos;&apos;&apos; - Xataface uses the Smarty template engine as a base, but extends it with some powerful new features such as extendable templates and theming support.
* &apos;&apos;&apos;Modular&apos;&apos;&apos; - There are several add-on modules available to extend the features of Xataface even further, and a simple API for writing your own modules.


====Editing====

* &apos;&apos;&apos;Automatic Form Generation&apos;&apos;&apos; - Automatically generates appropriate web forms to add new records and edit existing records.
* &apos;&apos;&apos;Widgets&apos;&apos;&apos; - Support for many different widget types including text fields, text areas, checkboxes, select lists, html editors, grids, file uploads, and more.
* &apos;&apos;&apos;Configurable&apos;&apos;&apos; - Customize forms using configuration files and delegate classes.
* &apos;&apos;&apos;Personalizable&apos;&apos;&apos; - Show different forms to different users depending on their permissions and preferences.
* &apos;&apos;&apos;Add Related Records&apos;&apos;&apos; - Insert records and automatically track their relationships to other tables.
* &apos;&apos;&apos;Editable Data Grid&apos;&apos;&apos; - Manage your data like a spreadsheet using the DataGrid module.
* &apos;&apos;&apos;Copy&apos;&apos;&apos; - Copy sets of records.
* &apos;&apos;&apos;Update Found Set&apos;&apos;&apos; - Update multiple records with one swipe.
* &apos;&apos;&apos;Fine-grained Permissions&apos;&apos;&apos; - Assign editing permission based on table, record, or field. 
* &apos;&apos;&apos;File uploads&apos;&apos;&apos; - Support for file uploads with storage either in a BLOB field or on the file system.
* &apos;&apos;&apos;Delete&apos;&apos;&apos; - Delete single record or delete the current found set.

====Searching====

* &apos;&apos;&apos;Automatic Find Form&apos;&apos;&apos; - The Xataface find form allows you to search a table on any field.
* &apos;&apos;&apos;Range Searches&apos;&apos;&apos; - Search for records matching values in a certain range (e.g. find all people between the ages of 20 and 30).
* &apos;&apos;&apos;Exact Matching&apos;&apos;&apos; - Search for exact matches.
* &apos;&apos;&apos;Partial Matching&apos;&apos;&apos; - Search for fields that contain a keyword phrase.
* &apos;&apos;&apos;Multi-field search&apos;&apos;&apos; - There is always a simple search field accessible which searches all fields in the current table.  E.g. a search for &quot;Tom&quot; would match any record in the current table that contained the phrase &quot;Tom&quot; in any of its columns.
* &apos;&apos;&apos;Related Record Searches&apos;&apos;&apos; - Find records that contain related records matching a search term.  (E.g. find all people who got an &apos;A&apos; in a particular course).


====Browsing====

* &apos;&apos;&apos;Automatic Details View&apos;&apos;&apos; - Each record has user-friendly details page to browse the contents of the record.
* &apos;&apos;&apos;AJAX Record Tree&apos;&apos;&apos; - Provides optional AJAX record tree to browse the data in your database by relationships.
* &apos;&apos;&apos;Expand for More&apos;&apos;&apos; - Quickly expand a row in list view to see the full record details.
* &apos;&apos;&apos;Drag and Drop Reordering&apos;&apos;&apos; - The details view for a record can be broken up into related sections.  Users can reorder these sections via drag and drop.

====Exporting====

* &apos;&apos;&apos;RSS&apos;&apos;&apos; - Support for RSS 1.0, 2.0 and Atom feeds of any found set.
* &apos;&apos;&apos;XML&apos;&apos;&apos; - Export any found set as XML so that the data can be interchanged with other products (e.g. desktop publishing suites).
* &apos;&apos;&apos;CSV&apos;&apos;&apos; - Export any found set to CSV (comma-separated-value) to open in a spreadsheet application like Excel.
* &apos;&apos;&apos;JSON&apos;&apos;&apos; - Export any found set to JSON.  This feature makes Xataface a good choice for serving the next generation of Web 2.0 AJAX applications.

====Internationalization====

* &apos;&apos;&apos;String Internationalization&apos;&apos;&apos; - Xataface fully supports internationalizing your application.  It provides you with language files to provide translations of all of the strings and labels in your application.
* &apos;&apos;&apos;Dynamic Data Translation&apos;&apos;&apos; - Xataface even allows you to internationalize your existing database data without having to change your database structure.
* &apos;&apos;&apos;Templates&apos;&apos;&apos; - Includes a {translate} tag for Smarty templates to easily translate template text.
* &apos;&apos;&apos;In the background&apos;&apos;&apos; - You can use Xataface to internationalize any PHP/MySQL website without having to make any drastic changes to your existing code.  Just include Xataface as a library and use some of its useful internationalization functions to convert your application into multiple languages.
* &apos;&apos;&apos;Translation Form&apos;&apos;&apos; - If multiple languages are enabled, Xataface provides a simple translation form to translate content between languages.
* &apos;&apos;&apos;Translation Status Tracking&apos;&apos;&apos; - Track the status of translations to mark whether they need to be retranslated.

====Importing====

* &apos;&apos;&apos;Import Filter API&apos;&apos;&apos; - Using delegate classes, it is easy to define an import filter to import any type of data into the database.
* &apos;&apos;&apos;User Preview&apos;&apos;&apos; - User can preview imported data before confirming that he wants to import it.

====History====

* &apos;&apos;&apos;Optional History Support&apos;&apos;&apos; - If history is enabled, all changes made to any data are recorded.
* &apos;&apos;&apos;Undo/Redo Support&apos;&apos;&apos; - Easily revert to an earlier version of a record.
* &apos;&apos;&apos;View Snapshot&apos;&apos;&apos; - Browse previous versions of records.
* &apos;&apos;&apos;View Diffs&apos;&apos;&apos; - View differences/changes between versions of records, similar to a wiki.

====Caching====

* &apos;&apos;&apos;Output cache&apos;&apos;&apos; - Supports output cache that caches output of pages to improve performance dramatically for busy sites.  Cache is automatically refreshed whenever changes are made to tables that are used to generate the page.
* &apos;&apos;&apos;APC Support&apos;&apos;&apos; - If APC (Alternate PHP Cache) is installed, Xataface will automatically use it to cache table configuration information.  This tends to increase performance by about 20%.


====Security====

* &apos;&apos;&apos;Fine-grained permissions&apos;&apos;&apos; - Define permissions to the entire application, a single table, by the record, or by the field.  Each feature has an associated permission that can be allowed or disallowed on a per-user basis.
* &apos;&apos;&apos;Cascading Permissions&apos;&apos;&apos; - You can very restrictive permissions to the application as a whole and then apply more permission permissions to specific tables or fields that you want uses to be able to access.  Table permissions override application permissions.  Field permissions override field permissions.
* &apos;&apos;&apos;Role-based permissions&apos;&apos;&apos; - You can define &quot;&quot;&quot;roles&quot;&quot;&quot; which are sets of permissions that can be assigned to users.
* &apos;&apos;&apos;Extendable Permissions Model&apos;&apos;&apos; - You can easily define your own permissions and roles, extending existing roles, custom for your application.
* &apos;&apos;&apos;Built-in Authentication&apos;&apos;&apos; - It is easy to set up login/logout features for your application.  Just tell Xataface which table you store your user records in, and Xataface will do the rest.
* &apos;&apos;&apos;Password Encryption&apos;&apos;&apos; - Xataface supports and is compatible with most of the standard password encryptions including MD5, SHA1, and MySQL Password.
* &apos;&apos;&apos;Pluggable Authentication&apos;&apos;&apos; - Easy to create your own authentication plugins in case you want to implement your own custom authentication.
* &apos;&apos;&apos;CAS&apos;&apos;&apos; - Module available for the Yale CAS (Central Authentication Service).
* &apos;&apos;&apos;LDAP&apos;&apos;&apos; - LDAP authentication module available.
* &apos;&apos;&apos;HTTP&apos;&apos;&apos; - Optional HTTP login support.  Standard login uses a web-based login form, but you can also use HTTP headers for authentication.

====Relationships====

* &apos;&apos;&apos;Powerful Relationship Model&apos;&apos;&apos; - It is easy to define relationships between your tables using simple configuration files.  Syntax is simple, but the results are powerful.
* &apos;&apos;&apos;Add New Related Record&apos;&apos;&apos; - Create a new record and add it to a parent record&apos;s relationship at the same time. (E.g. create a new &quot;course&quot; record and add it to a teacher&apos;s list of taught courses).
* &apos;&apos;&apos;Add Existing Related Record&apos;&apos;&apos; - Add an existing record to a parent record&apos;s relationship. (e.g. Add an existing course record to a teacher&apos;s list of taught courses).
* &apos;&apos;&apos;Remove related record&apos;&apos;&apos; - Remove a record from a relationship. (e.g. remove a course record from a teacher&apos;s list of taught courses).

====API====

Xataface includes a powerful API to allow you to more efficiently work with your database.

* &apos;&apos;&apos;Data Objects&apos;&apos;&apos; - Provides a simple API to work with database records.  Searching, loading, saving, editing, and deleting records supported.

====Templates====

* &apos;&apos;&apos;Smarty Template Engine&apos;&apos;&apos; - Xataface uses the Smarty template engine as a base, one of the fastest PHP template engines available.
* &apos;&apos;&apos;Template Inheritance&apos;&apos;&apos; - You can create templates that inherit from other templates, and replace the content in specified &quot;slots&quot; of the original template.  This drastically increases template reuse and development productivity.
* &apos;&apos;&apos;Cascading Support&apos;&apos;&apos; - All system templates are stored in the Dataface/templates directory.  Your application can have its own templates directory where you can place templates to override system templates.  All parts of the system can be overridden without modifying the original templates themselves.

====Themes====

Xataface includes a powerful themes API.  You can create multiple looks for your application and switch between them with a simple configuration setting.

====REST Support====

Xataface&apos;s intelligent URL protocols make it a powerful platform for REST web services.  You can specify a query directly in the URL to obtain the exact found-set that you want.  This is also very useful in standard web applications because you can easily create links to desired parts of your application.  Or you can use Xataface to provide missing functionality in your existing applications and link only to the parts of your Xataface app that you need.

===History===

Xataface (formerly Dataface) was originally created by Steve Hannah in 2005 to increase productivity created data-driven applications for Simon Fraser University.  He came from faculty that used Filemaker extensively for their databases.  As a PHP developer he preferred open technologies like MySQL as they provided fewer &quot;road blocks&quot;, but it was hard to deny the benefits of filemaker when it came to providing users with an instant user interface for their databases.  It was difficult to justify spending 3 weeks building an administration console for a MySQL application when it could have been done in 3 hours had Filemaker been used.

Xataface was designed to:

# Increase developer productivity to the point where MySQL applications could be created as quickly as Filemaker applications without sacrificing usability and functionality.
# Add an abstraction over a database to make is accessible to non-technical users.  The secretary shouldn&apos;t need to know SQL in order to interact with a database.
# Test the limits of PHP and MySQL

As it was built with the intention of providing an alternative for Filemaker, many implementation details and concepts have been inspired by Filemaker.  For example, Xataface&apos;s implementation of relationships is very similar to Filemaker relationships; as are valuelists.  In addition the method of searching follows many Filemaker conventions.

The first application built with Xataface was a group content management system for the Faculty of Applied Sciences at Simon Fraser University.  This system was used by faculty to manage their research profiles and their research groups.  The database itself pre-existed the Xataface implementation.   Xataface was used to build a new administrative interface to the system.  Since then Xataface has been used to develop many systems for SFU including website content management systems, auctions, event registration systems, research databases, shopping carts, and more.

==Where to go from here==

* [http://xataface.com/documentation/tutorial/getting_started Getting Started Tutorial]
* [http://xataface.com/videos Watch Demonstration Videos of Xataface]
* Sign up for the Xataface Maillist to receive free updates and development tips.  (See sign-up form in upper left of the page).</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=35">
	<page_name>widget:editor</page_name>
	<page_id>35</page_id>
	<page_title>widget:editor</page_title>
	<content>==widget:editor fields.ini directive==

Return to [[fields.ini file]]

[[toc]]

The widget:editor directive is applicable in the [[fields.ini file]].  It specifies the type of HTML editor that should be used.  This directive is only used when [[widget:type]] is set to [[widget:type htmlarea|htmlarea]].  Xataface currently supports FCKEditor, TinyMCE, and NicEdit.

===Allowed Values===

{| class=&quot;listing listing2&quot;
|-
! Value
! Description
! Version
|-
| fckeditor
| Use [http://www.fckeditor.net/ FCKEditor].  This is the default value.
| all
|-
| tinymce 
| Use [http://tinymce.moxiecode.com/ TinyMCE editor].
| 0.6
|-
| nicedit
| Use [http://www.nicedit.com/ NicEdit].
| 1.0.5
|}

===Examples===

====Example 1: Using FCKEditor====

Given a field &apos;content&apos; that you wish to be able to edit with FCKEditor, you would have the following section in your [[fields.ini file]]:

&lt;code&gt;
[content]
    widget:type=htmlarea
    widget:editor=fckeditor
&lt;/code&gt;

Note that since FCKEditor is the default editor, the above would give the same result as:

&lt;code&gt;
[content]
    widget:type=htmlarea
&lt;/code&gt;

====Example 2: Using TinyMCE====

Further from example 1, if we wanted to use TinyMCE editor, we would change our directive to:

&lt;code&gt;
[content]
    widget:type=htmlarea
    widget:editor=tinymce
&lt;/code&gt;

====Example 3: Using NicEdit====

Further from example 1:

&lt;code&gt;
[content]
    widget:type=htmlarea
    widget:editor=nicedit
&lt;/code&gt;

==Enabling Image Uploads==

By default image uploads are disabled in these WYSIWYG editors.

===Enabling Image Uploads in FCKEditor===

# Create a directory named &apos;&apos;uploads&apos;&apos; inside your application directory. e.g.&lt;code&gt;
cd /path/to/myapp/uploads
&lt;/code&gt;
# Make the &apos;&apos;uploads&apos;&apos; directory writable by the webserver. e.g. &lt;code&gt;
chmod 777 /path/to/myapp/uploads
&lt;/code&gt;
# Edit the &apos;&apos;lib/FCKeditor/editor/filemanager/connectors/php/config.php&apos;&apos; file inside your &apos;&apos;xataface&apos;&apos; directory so that:&lt;code&gt;
$Config[&apos;Enabled&apos;] = true ;
$Config[&apos;UserFilesPath&apos;] = &apos;/url/to/myapp/uploads/&apos; ;
    // The path portion of the URL to your uploads directory.
    // e.g. if your uploads directory is accessible at
    // http://example.com/myapp/uploads, then this value should
    // be /myapp/uploads/
$Config[&apos;UserFilesAbsolutePath&apos;] = &apos;/path/to/myapp/uploads/&apos; ;
    // The absolute file system path to your uploads directory.
    // e.g. if your uploads directory is located at
    // /home/myhome/www/myapp/uploads, then this value should be
    // /home/myhome/www/myapp/uploads
&lt;/code&gt;
# Now when you click on the &quot;Add Image&quot; link in your HTML editor, it will allow you to upload images and browse existing uploaded images.

</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=34">
	<page_name>examples</page_name>
	<page_id>34</page_id>
	<page_title>examples</page_title>
	<content>==Xataface Examples==

[[toc]]

This section includes concrete examples of how Xataface has been used in the past.

===Demo Applications===

{| class=&quot;listing listing2&quot;
|-
! Screenshot
! Title/Description
! Developed by
|-
| [[Image:http://images.websnapr.com/?size=150&amp;key=40f0knTakb1b&amp;url=http://demo.weblite.ca/apps/librariandb/]]
| &apos;&apos;&apos;Librarian DB&apos;&apos;&apos;

A searchable database of library books.  Useful for small libraries (e.g. Church Libraries).

Log in with:
username: admin
password: password

[http://demo.weblite.ca/apps/librariandb/ Try the app]
| [http://solutions.weblite.ca Web Lite Solutions Corp.]

|-
| [[Image:http://images.websnapr.com/?size=150&amp;key=40f0knTakb1b&amp;url=http://demo.weblite.ca/apps/webauction/]]
| &apos;&apos;&apos;Web Auction&apos;&apos;&apos;

A simple web-based auction application for organizations to hold auctions.

Login with:
username: admin
password: password

[http://demo.weblite.ca/apps/webauction/ Try the app]
| [http://solutions.weblite.ca Web Lite Solutions Corp.]


|}

===Websites Powered by Xataface===

{| class=&quot;listing listing2&quot;
|-
! Screenshot
! Title/Description
! Developed by
|-
| [[Image:http://images.websnapr.com/?size=150&amp;key=40f0knTakb1b&amp;url=http://fueleconomydb.com]]
| &apos;&apos;&apos;Fuel Economy Database&apos;&apos;&apos; - A searchable database of gas mileage and fuel economy statistics for automobiles from 1986 to present.

[http://fueleconomydb.com Visit the site]
| [http://solutions.weblite.ca Web Lite Solutions Corp.]
|-
| [[Image:http://images.websnapr.com/?size=150&amp;key=40f0knTakb1b&amp;url=http://physics.sfu.ca]]
| &apos;&apos;&apos;Department of Physics, Simon Fraser University&apos;&apos;&apos;
This website is completely powered by Xataface.  It is backed by a MySQL database that stores faculty members, research groups, news, events, and more.  Faculty members are able to update their personal profiles and research profiles through a Xataface administration console.

[http://physics.sfu.ca Visit the site]
| [http://fas.sfu.ca/ SFU Faculty of Applied Sciences]

|-
| [[Image:http://images.websnapr.com/?size=150&amp;key=40f0knTakb1b&amp;url=http://science.ca]]
| &apos;&apos;&apos;Science.ca&apos;&apos;&apos;

The source for science in Canada.  Includes profiles for prominent scientists as well as other useful science-related information.  Xataface is used to power the bilingual (English/French) capabilities of this site.  It includes web-based administrative console for the administrator to manage all content, and for translators to translate the content.

[http://science.ca Visit the site]
| Science.ca web team

|-

| [[Image:http://images.websnapr.com/?size=150&amp;key=40f0knTakb1b&amp;url=http://translation.weblite.ca]]
| &apos;&apos;&apos;Simple Website Translation Engine&apos;&apos;&apos;

A service that allows website owners to easily convert their website into multiple languages.  Support human and machine translation.  This service is powered by Xataface, and provides an administrative console for users to manage their website translations.

[http://translation.weblite.ca Visit the Site]

[http://swete.weblite.ca More about this service]

| [http://translation.weblite.ca Web Lite Translation Corp.]

|-
| [[Image:http://images.websnapr.com/?size=150&amp;key=40f0knTakb1b&amp;url=http://www.credituniondb.com]]
| &apos;&apos;&apos;Credit Union Database&apos;&apos;&apos;

A database of credit unions in the United States.  This site is powered by Xataface.

[http://www.credituniondb.com Visit the site]

| Vlad

|-
| [[Image:http://images.websnapr.com/?size=150&amp;key=40f0knTakb1b&amp;url=http://ierg.net/lessonplans/unit_plans.php]]
| &apos;&apos;&apos;IERG Lesson Plans Database&apos;&apos;&apos;

A searchable database of lesson plans created by the Imaginative Education Research Group.  This database is managed by Xataface.  It provides researchers with a web-based control panel to manage their lesson plans.

[http://ierg.net/lessonplans/unit_plans.php Visit the site]

| [http://solutions.weblite.ca Web Lite Solutions Corp.]

|-
| [[Image:http://images.websnapr.com/?size=150&amp;key=40f0knTakb1b&amp;url=http://ierg.net/people/]]
| &apos;&apos;&apos;IERG People Database&apos;&apos;&apos;

A simple database to manage the contributors and associates of the Imaginative Education Research Group.  Administrators have a web-based control panel to manage the people profiles in this database.

[http://ierg.net/people/ Visit the site]

| [http://solutions.weblite.ca Web Lite Solutions Corp.]

|-
| [[Image:http://images.websnapr.com/?size=150&amp;key=40f0knTakb1b&amp;url=http://sustain-gradnetwork.envr.sfu.ca/]]
| &apos;&apos;&apos;Sustainability Research Database&apos;&apos;&apos;

A database at Simon Fraser University for grad students to post and share research profiles.

[http://sustain-gradnetwork.envr.sfu.ca/ Visit the site]

| [http://fas.sfu.ca Faculty of Applied Sciences Web Team]

|-
| [[Image:http://images.websnapr.com/?size=150&amp;key=40f0knTakb1b&amp;url=http://apps.weblite.ca/]]
| &apos;&apos;&apos;Web Lite Applications Catalog&apos;&apos;&apos;

A catalog of applications available through Web Lite Solutions.  Allows users to set up their own online applications on Web Lite&apos;s servers.  This site is completely powered by Xataface.

[http://apps.weblite.ca/ Visit the site]

| [http://solutions.weblite.ca Web Lite Solutions Corp.]
|}


</content>
	<keywords>examples, samples</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=33">
	<page_name>after_action_new</page_name>
	<page_id>33</page_id>
	<page_title>after_action_new</page_title>
	<content>==after_action_new trigger==

[[toc]]

This trigger is called after the &apos;&apos;&apos;new&apos;&apos;&apos; action is successfully completed.  This trigger can be defined in the table [[Delegate class methods|delegate class]] and is often used to redirect to a particular page after a new record is submitted.  This should not be confused with the [[afterInsert]] trigger, which is executed after a record is inserted into the database (this can occur multiple times per request).  The after_action_new trigger is only executed once after the &apos;new&apos; action has been successfully completed.  i.e. a maximum of once per request.

===Signature===

&lt;code&gt;
function after_action_new($params=array()){ ... } : return void
&lt;/code&gt;

====Parameters====

This method takes a single associative array as a parameter. This array includes the following keys:

* &apos;&apos;&apos;record&apos;&apos;&apos; - The [http://dataface.weblite.ca/Dataface_Record Dataface_Record] object that was just inserted.


===Examples===

====Example 1: Redirect to the view tab for the inserted record====

&lt;code&gt;
function after_action_new($params=array()){
    $record =&amp; $params[&apos;record&apos;];
    header(&apos;Location: &apos;.$record-&gt;getURL(&apos;-action=view&apos;).&apos;&amp;--msg=&apos;.urlencode(&apos;Record successfully inserted.&apos;));
    exit;
}
&lt;/code&gt;
</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=32">
	<page_name>DataGrid</page_name>
	<page_id>32</page_id>
	<page_title>DataGrid</page_title>
	<content>==Xataface DataGrid Module==

Created by Steve Hannah, [http://weblite.ca Web Lite Solutions Corp.]

===Synopsis===

The Xataface DataGrid module uses the Ext DataGrid component (http://extjs.com) to add an editable grid component to your Xataface application.

[[toc collapse=0]]

===Requirements===

* PHP 4.3+
* MySQL 4.1+
* Xataface 0.8+

===License===

This module is distributed with ExtJS 2.2, which is distributed under the GPL v 3 (http://extjs.com/products/license.php).

In order to be compatible with the ExtJS license, this module is also distributed under the terms of the GPL v3 (http://www.gnu.org/copyleft/gpl.html).

===Demo Video===

&lt;nowiki&gt;
&lt;embed src=&quot;http://media.weblite.ca/lib/flvplayer.swf&quot; width=&quot;640&quot; height=&quot;500&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%2FDataGrid-640x480.flv&amp;image=http%3A%2F%2Fmedia.weblite.ca%2Ffiles%2Fphotos%2FDataGrid-640x480.flv.jpg&amp;showdigits=true&amp;autostart=false&quot; /&gt;
&lt;/nowiki&gt;

===Screenshots===

Click on image to enlarge

&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=8&amp;-cursor=0&amp;-skip=0&amp;-limit=30&amp;-mode=list&amp;-photo_max_width=640&amp;--format=js&quot;&gt;&lt;/script&gt;

&lt;div style=&quot;clear:both&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;/nowiki&gt;


===Demo===

# LibrarianDB Demo: http://demo.weblite.ca/apps/librariandb/index.php?-table=books&amp;-action=DataGrid_view , &apos;&apos;&apos;Log in with username &quot;admin&quot; and password &quot;password&quot;&apos;&apos;&apos;

===Download===

* [https://sourceforge.net/project/platformdownload.php?group_id=250381 DataGrid-0.2]
* SVN Repository: http://weblite.ca/svn/dataface/modules/DataGrid

===Installation===

# Download and extract the DataGrid directory into your xataface/modules directory.
# Add the following line to the [_modules] section of your application&apos;s [[conf.ini file]]:&lt;code&gt;
modules_DataGrid=modules/DataGrid/DataGrid.php
&lt;/code&gt;
# Ensure that your [[permissions]] are set up appropriately to allow your users to access the grid action (see next section).

===Setting Up Permissions===

This module defines the following [[permissions]]:

* DataGrid:view_grid  	- Permission to view the data grid for a table.
* DataGrid:create_grid	- Permission to create a new data grid
* DataGrid:edit_grid		- Permission to edit an existing data grid
* DataGrid:update			- Permission to update records via the grid
* DataGrid:manage_grids	- Permission to access the datagrid control panel

In order for a user to access/use the grid he must be granted at least the Datagrid:view_grid and DataGrid:update [[permissions]].  Both of these [[permissions]] are included in the following system roles by default:

* EDIT
* EDIT AND DELETE
* DELETE
* ADMIN
* MANAGER

And of course these [[permissions]] are included with the call to Dataface_PermissionsTool::ALL() .

If you have assigned your own custom roles and want to enable access to the grid, you can simply add the following to your role definition in your [[permissions.ini file]]:
&lt;code&gt;
[MY ROLE]
    DataGrid:view_grid=1
    DataGrid:update=1
&lt;/code&gt;

If you want to explicitly disable the grid for a role, you can extend the role and deny those same [[permissions]]:
&lt;code&gt;
[MY ROLE extends MY ROLE]
	DataGrid:view_grid=0
	DataGrid:update=0
&lt;/code&gt;

	
===Usage===

Once installed, log in as a user that has permission to access the grid. You should notice a new tab along with &quot;details&quot;, &quot;list&quot;, and &quot;find&quot;, called &quot;grid&quot;. Click on the &quot;grid&quot; tab to access the grid.

You can double click on any field to edit it.  Modified fields will be marked in red, and automatically saved every 5 seconds - after the changes are saved the field is no longer marked in red.

===Limitations===

Currently only fields with the following widget types are available to be edited in the grid:

# text
# textarea
# select
# date/datetime/time

Other types of fields will simply not be included in the grid.

===Support/Questions===

Visit the Xataface forum at http://xataface.com/forum
	

</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=31">
	<page_name>ShoppingCart</page_name>
	<page_id>31</page_id>
	<page_title>ShoppingCart</page_title>
	<content>==Xataface Shopping Cart Module==

[[toc]]

Status: Under development
Current Version: 0.2

===Synopsis===

Add a shopping cart to your xataface application.  You can treat any record as a product that can be sold.  Includes Paypal connectivity, shipping calculation, and more.

===Requirements===

* Xataface 1.0 or higher
* PHP 5 or higher
* MySQL 4.1 or higher

===Installation Instructions===

# Download the ShoppingCart module, extract it, and place the ShoppingCart directory in your Xataface modules directory. (i.e. /path/to/xataface/modules/ShoppingCart).
# Add the following line to the [_modules] section of your [[conf.ini file]]:&lt;code&gt;
modules_ShoppingCart=modules/ShoppingCart/ShoppingCart.php
&lt;/code&gt;
# Add the following to the beginning of your [[index.php file]]:&lt;code&gt;
function __autoload($class){
    if ( $class == &apos;ShoppingCart&apos; ) require_once &apos;modules/ShoppingCart/lib/ShoppingCart/ShoppingCart.class.php&apos;;
}
&lt;/code&gt;
# In the [[fields.ini file]] for any table whose records you wish to represent items for sale, add the following:&lt;code&gt;
[__implements__]
    InventoryItem=1
&lt;/code&gt;
# Specify which fields should be used for the item description, price, width, height, length, and weight in the [[fields.ini file]] for each table whose records you wish to represent items for sale by adding the following directives to the appropriate fields:&lt;code&gt;
ShoppingCart.description=1
ShoppingCart.unitPrice=1
ShoppingCart.weight=1
ShoppingCart.width=1
ShoppingCart.height=1
ShoppingCart.length=1
&lt;/code&gt; E.g. if your table has a field named &quot;&quot;price&quot;&quot; that you want to represent the unit price, you would have something like:&lt;code&gt;
[price]
    ShoppingCart.unitPrice=1
&lt;/code&gt;  The shopping cart module will make its best guess on which fields to use for these values if they are not explicitly specified.
# Specify the paypal account where money should be deposited by adding the following to your application&apos;s [[actions.ini file]]:&lt;code&gt;
[view_cart]
    paypal.account=&quot;youremail@example.com&quot;
&lt;/code&gt;


===Usage Instructions===

Once the Shopping Cart module is installed you can:

# Add items to your shopping cart
# View your cart contents
# Checkout and pay with paypal

====Adding Items to the Cart====

In the View tab of any salable record, you&apos;ll notice a little block on the left side of the page with the heading &quot;Add Item to Cart&quot;.  This includes a field to specify the quantity and a button to add the item to the shopping cart.

====Viewing Cart Contents====

The Shopping Cart module automatically introduces an action to view the cart contents.  This action is named &quot;view_cart&quot;.  Hence you can always view the cart contents by entering the URL: index.php?-action=view_cart .

====Checking Out====

# View the cart contents.
# Click &quot;Check out&quot;
# This will take you to a paypal page to pay for your items.


==Actions==

This module adds the following actions to your application.

{| class=&quot;listing listing2&quot;
|-
! Name
! Content-type
! Description
! Version
|-
| checkout
| text/html
| Sends user to paypal to pay for the contents of their cart.
| 0.1
|-
| calculate_shipping
| text/html
| Calculates the shipping charges for the cart.
| 0.1
|-
| add_to_cart
| text/html
| Adds an item to the cart.
| 0.1
|-
| clear_cart
| text/html
| Empties the shopping cart.
| 0.1
|-
| get_shipping_provinces
| text/json
| Returns JSON array of provinces for a given country.
| 0.1
|-
| invoices
| text/html
| Displays the current user&apos;s invoices.
| 0.1
|-
| payment_complete
| text/html
| Page that is displayed after a successful payment on paypal.
| 0.1
|-
| paypal_ipn
| none
| Handles paypal events such as successful payments.
| 0.1
|-
| refresh_shipping_methods
| text/html
| Refreshes the shipping methods available to the system.
| 0.1
|-
| set_shipping_method
| text/html
| Sets the selected shipping method to a particular method.
| 0.1
|- 
| view_cart
| text/html
| View the cart contents.
| 0.1
|}

==Blocks and Slots==

This module adds the following blocks and slots to your applications.

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| shipping_method
| A block with a form to select the shipping method.
| 0.1
|-
| add_to_cart
| A block with a form to add a record/item to the shopping cart.
| 0.1 
|}

==Application Delegate Class Hooks==

You can modify the shopping cart behavior by defining the following methods to the application delegate class.

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| isShippingMandatory
| Returns a boolean value indicating whether the user must select a shipping method.
| 0.1
|-
| getDefaultShippingMethod
| Returns a string with the name of the default shipping method to be used.
| 0.1
|}


==Table Delegate Class Hooks==

You can modify the behavior of the shopping cart by defining the following methods to the delegate class of any table that implements the InventoryItem ontology (i.e. any table that is to be used to store products that can be added to the cart).

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| field__taxes
| A calculated field that returns an associative array of all applicable taxes for a product.
| 0.1
|}

==Internal Storage==

This module creates the following tables to store its data:

===dataface__invoices===

The dataface__invoices table stores the actual invoices for purchases made.  An invoice is automatically created as soon as the user &quot;checks out&quot;.

{| class=&quot;listing listing2&quot;
|-
! Column Name
! Data Type
! Description
! Version
|-
| InvoiceID
| int(11)
| Auto incrementing primary key for the invoice.
| 0.1
|-
| dateCreated
| datetime
| The date that the invoice was created.
| 0.1
|-
| dateModified
| datetime
| The date that the invoice was last modified
| 0.1
|-
| status
| enum
| The status of the invoice (either PENDING, PAID, or APPROVED).
| 0.1
|-
| amount
| decimal(10,2)
| The total amount on the invoice.
| 0.1
|-
| paymentMethod
| varchar(32)
| The name of the payment method used.
| 0.1
|-
| referenceID
| varchar(64)
| ??
| 0.1
|-
| username
| varchar(32)
| The username of the user who owns this invoice.
| 0.1
|-
| firstName
| varchar(32)
| The first name of the payer.
| 0.1
|-
| lastName
| varchar(32)
| The last name of the payer.
| 0.1
|-
| address_name
| varchar(100)
| The name on the shipping address.
| 0.1
|-
| address1
| varchar(100)
| The shipping address line 1.
| 0.1
|-
| address2
| varchar(100)
| The shipping address line 2.
| 0.1
|-
| city
| varchar(40)
| The shipping address city.
| 0.1
|-
| province
| varchar(2)
| The shipping province or state.
| 0.1
|-
| country
| varchar(2)
| The shipping country.
| 0.1
|-
| postalCode
| varchar(32)
| The shipping postal code.
| 0.1
|-
| shipping_method
| varchar(50)
| The name of the shipping method to use.
| 0.1
|-
| phone
| varchar(32)
| The phone number of the payer.
| 0.1
|-
| email
| varchar(127)
| The email address of the buyer.
| 0.1
|-
| data
| text
| Serialize shopping cart data.
| 0.1
|}


===dataface__shipping_methods===

Stores the available shipping methods.

{| class=&quot;listing listing2&quot;
|-
! Column Name
! Data Type
! Description
! Version
|-
| shipping_method_id
| int(11)
| Auto increment ID for a shipping method.
| 0.1
|-
| shipping_method_name
| varchar(50)
| The name of the shipping method.
| 0.1
|-
| shipping_method_label
| varchar(100)
| The label for the shipping method (displayed to the user).
| 0.1
|-
| shipping_method_enabled
| tinyint(1)
| Whether or not this shipping method is currently enabled.
| 0.1
|-
| shipping_method_module
| varchar(32)
| The name of the handler that this shipping method belongs to.
| 0.1
|}

==Payment Handlers==

Information about payment handlers to be added here.

==Shipping Handlers==

The Shopping Cart module is itself modular, allowing you to develop custom shipping handlers for different types of shipping.  A shipping handler is responsible for calculating shipping costs to a destination address.  Currently only a UPS shipping handler has been created, but it is not difficult to create other handlers.

===Shipping Handler Public Interface===

{| class=&quot;listing listing2&quot;
|-
! Method
! Description
! Version
|-
| calculateShipping
| Calculates the shipping cost for the current shopping cart, and adds the shipping cost to the cart as a line item.
| 0.1
|-
| getInfo
| Returns an array of shipping methods that can be handled by this handler.
| 0.1
|}






</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=30">
	<page_name>modules</page_name>
	<page_id>30</page_id>
	<page_title>Xataface Modules</page_title>
	<content>[[toc]]

Xataface provides a number of hooks that allow developers to create modules to extend its functionality.  This page lists a handful of the currently available modules.

* [[ShoppingCart|Shopping Cart]] - Converts your application into a shopping cart.
* [[Filemaker]] - Export record sets as Filemaker XML.
* [[DataGrid|Data Grid]] - Editable Datagrid.
* [[Email]] - Convert your database into a email list.  Send email to any found set.
* [[reCAPTCHA module]] - A reCAPTCHA module to add CAPTCHA support to your Xataface forms.
* [[XataJax]] - Platform for building Web 2.0 AJAX applications with Xataface.  Will be a standard component for Xataface starting with version 1.3.

==Module Installation==

You can add modules in either:

# DATAFACE_PATH/modules directory (since 1.0)
# DATAFACE_SITE_PATH/modules directory (since 1.3)

Modules in the DATAFACE_SITE_PATH directory will supersede modules in the DATAFACE_PATH/modules directory (since 1.3).

To activate a module for your application you also need to add an entry to the [[_modules]] section of your [[conf.ini file]].  Each module will come with its own installation instructions.

==Authentication Modules==

Modules to add alternative authentication methods are added to the modules/Auth directory.

==Developing Your Own Modules==

See [[Module Developers Guide]].</content>
	<keywords>modules, captcha</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=29">
	<page_name>encryption</page_name>
	<page_id>29</page_id>
	<page_title>encryption</page_title>
	<content>==encryption [[fields.ini file]] directive==

The &apos;&apos;&apos;encryption&apos;&apos;&apos; directive is meant to be used on password fields only.  It specifies that a certain type of encryption is to be used in the storing of values in this field.  For example, many PHP/MySQL applications use MD5 encryption to store their passwords.  If you want your Xataface application to be able to use the same users tables, then you&apos;ll need to specify the &apos;&apos;&apos;encryption&apos;&apos;&apos; directive for the password field.

===Possible Values===

{| class=&quot;listing listing2&quot;
|-
! Value
! Meaning
! Version
|-
| md5
| MD5 encryption
| 0.6
|-
| sha1
| SHA1 encryption
| 1.0
|-
| encrypt
| MySQL encrypt function
| 1.0
|-
| password
| MySQL password encryption
| 1.0
|}


===E.g. in the users table [[fields.ini file]]===

&lt;code&gt;
[password]
   encryption=md5
&lt;/code&gt;
    </content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=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=27">
	<page_name>filter</page_name>
	<page_id>27</page_id>
	<page_title>filter</page_title>
	<content>==The filter attribute of the [[fields.ini file]]==

The filter attribute with a value of 1 specifies that a field should be used as a filter field in list view.  In list view, any filter fields will provide a select list with all of the possible values in that field.  Selecting one of the items in this list will filter the results to only show records of that value.

===Example 1: Year, Make, Model===

The Fuel Economy Database has three fields with filter=1 : Year, Make, and Model.  I.e., in their fields.ini file we have something like:

&lt;code&gt;
[Year]
    filter=1

[Make]
    filter=1

[Model]
    filter=1
&lt;/code&gt;

This causes 3 select lists to appear in list view.  See the application [http://fueleconomydb.com/index.php?-action=list here] and notice the select lists for Year, Make, and Model just above the list of results.

If you are filtering on a field where an ID is stored in the DB but you are using a vocabulary to associate it with a value, then it will still be sorted on the ID.

If you want to sort on value then you should add a [[Grafted fields|grafted field]] with the value using the __sql__ directive of the fields.ini file, then use that grafted field as your filter field, like the following:

&lt;code&gt;
__sql__ = &quot;select a.*, b.foo_name from a left join b on a.foo_id=b.foo_id&quot;

[foo_name]
filter=1
&lt;/code&gt;
</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=26">
	<page_name>permissions.ini_file</page_name>
	<page_id>26</page_id>
	<page_title>permissions.ini_file</page_title>
	<content>==The permissions.ini File==

[[toc]]

The permissions.ini file stores custom permissions and roles that can be used by an application.  It is an optional file that should be placed in the application root directory (i.e. the same directory where your conf.ini, and index.php files are located).

The permissions.ini file allows you to define two things:

# Permissions
# Roles (i.e. sets of permissions).

Permissions and roles are used throughout Xataface to limit access to actions, records, fields, and relationships.  For example, each action in your application can specify a permission that is necessary to perform the action.  Your delegate classes may include getPermissions() methods to define what permissions a user gets when interacting with different records.  This file (permissions.ini) simply defines the permissions that can be used by your application.  It doesn&apos;t actually assign those permissions.  Assigning permissions is the job of the getPermissions() (or getRoles()) method.

===Defining Permissions===

Permissions are defined by standalone properties in the beginning of the permissions.ini file.  For example, if you were desiging a proof-reading application, you might need permissions for &quot;submit_for_proof&quot;, or &quot;approve_text&quot; to correspond with the submitting a document to be proof-read, and approving a document&apos;s proof.  In this case we would have the following at the beginning of our permissions.ini file:

&lt;code&gt;
submit_for_proof = Submit a document to be proofread
approve_text = &quot;Approve this document&apos;s proof&quot;
&lt;/code&gt;

The left side of the equals sign is the name of the permission.  The right side contains a human readable description of the permission and what it is for.

===Limiting Access to Actions based on Permissions===

At this point these permissions don&apos;t do anything.  In order to be useful we need reference these permissions from an action or a section.  For example, let&apos;s create an action called &quot;submit_for_proof&quot; which displays a form for a user to submit a document record to be proofread.

Our actions.ini file entry might look something like:

&lt;code&gt;
[submit_for_proof]
    url=&quot;{$this-&gt;url(&apos;-action=submit_for_proof&apos;)}&quot;
    label=&quot;Submit document for proof&quot;
    category=record_actions
    permission=submit_for_proof
    template=submit_for_proof.html
&lt;/code&gt;

And for completeness, since this make-believe action specifies th &quot;submit_for_proof.html&quot; template, we&apos;ll create the &quot;submit_for_proof.html&quot; template in the templates directory:

&lt;code&gt;
&lt;html&gt;&lt;body&gt;You have permission to perform this action.&lt;/body&gt;&lt;/html&gt;
&lt;/code&gt;

===Defining Who Get&apos;s Which Permissions===

Finally, in order to benefit from permissions, your application has to decide that it is going to use permissions (unless you define a getPermissions() method, users are granted ALL permissions by default.  Hence if you try to access our submit_for_proof action, we&apos;ll see it without any problem.  Regardless of who we are.  So let&apos;s create a simple, but restrictive getPermissions() method in our application delegate class:

&lt;code&gt;
&lt;?php
class conf_ApplicationDelegate {
    function getPermissions(&amp;$record){
        return Dataface_PermissionsTool::READ_ONLY();
    }
}
&lt;/code&gt;

Now if we try to access our submit_for_proof action it will give us a &quot;Permission Denied&quot; message, because we are only granted READ ONLY permissions (which is a role that includes the view permission and some others - but not our custom &quot;submit_for_proof&quot; permission.

Now we&apos;ll make a small modification to our getPermissions() method to provide us with our submit_for_proof permission:

&lt;code&gt;
&lt;?php
class conf_ApplicationDelegate {
    function getPermissions(&amp;$record){
        $perms =  Dataface_PermissionsTool::READ_ONLY();
        $perms[&apos;submit_for_proof&apos;] = 1;
        return $perms;
    }
}
&lt;/code&gt;

Now if we try to access our submit_for_proof action, it will show us our template with no error messages (hopefully).


===Roles===

Roles are sets of permissions.  They are defined in the permissions.ini file as sections with lists of included permissions.  It might be handy to create roles such as EDITOR or MANAGER which contain sets of permissions that are meant to be assigned to users of those types.  For example an EDITOR may have the view and edit permissions, but not the delete permission.  A MANAGER might have the view, edit, and delete permissions.  You can define these two roles in the permissions.ini file as follows:

&lt;code&gt;
[EDITOR]
    view=1
    edit=1

[MANAGER]
    view=1
    edit=1
    delete=1
&lt;/code&gt;

Then we could assign these roles to users using the Dataface_PermissionsTool::getRolePermissions() method:

&lt;code&gt;
function getPermissions(&amp;$record){
    $user =&amp; Dataface_AuthenticationTool::getInstance()-&gt;getLoggedInUser();
    if ( $user and $user-&gt;val(&apos;role&apos;) == &apos;EDITOR&apos; ){
        return Dataface_PermissionsTool::getRolePermissions(&apos;EDITOR&apos;);
    } else if ( $user and $user-&gt;val(&apos;role&apos;) == &apos;MANAGER&apos; ){
        return Dataface_PermissionsTool::getRolePermissions(&apos;MANAGER&apos;);
    }
    return Dataface_PermissionsTool::READ_ONLY();
}
 &lt;/code&gt;

Or equivalently we could use the getRoles() method of our delegate class instead of getPermissions():

&lt;code&gt;
function getRoles(&amp;$record){
    $user =&amp; Dataface_AuthenticationTool::getInstance()-&gt;getLoggedInUser();
    if ( $user and $user-&gt;val(&apos;role&apos;) == &apos;EDITOR&apos; ){
        return &apos;EDITOR&apos;;
    } else if ( $user and $user-&gt;val(&apos;role&apos;) == &apos;MANAGER&apos; ){
        return &apos;MANAGER&apos;
    }
    return &apos;READ ONLY&apos;;
}
&lt;/code&gt;

===Xataface Core Permissions &amp; Roles===

Xataface is distributed with its own permissions.ini file that defines some core permissions and roles.  You can look at this permissions.ini file (located in the Xataface directory) to see what the format should look like.  Any settings you place in your application&apos;s permissions.ini file will augment or override settings in Xataface&apos;s file.

Some core permissions include:


{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| view
| Permission to view a record or field.  This permission is required to access the view tab, and several other details tabs.
| 0.6
|-
| list
| Permission to access the list tab.
| 0.6
|-
| calendar
| Permission to access the calendar tab.
| 0.6
|-
| edit
| Permission to edit a record or field.  This also gives access to the edit tab.
| 0.6
|-
| new
| Permission to edit a record or field for the purpose of creating a new record.  This permission is required to access the new record form.
| 0.6
|-
| select_rows
| Permission to select rows in list view to perform actions on them.
| 0.6
|-
| post
| Permission to post a record using HTTP POST
| 0.6
|-
| copy
| Permission to copy a record.
| 0.6
|-
| update_set
| Permission to perform an update on a result set (i.e. access the update set action).
| 0.8
|-
| add new related record
| Permission to add a new record to a relationship.  See [[Relationship Permissions]]
| 0.6
|-
| add existing related record
| Permission to add an existing record to a relationship.  See [[Relationship Permissions]]
| 0.6
|-
| view related records
| Permission to view the records in a relationship. See [[Relationship Permissions]]
| 1.0
|-
| delete
| Permission to delete a record.
| 0.6
|-
| delete found
| Permission to access the delete found set action (to delete multiple records at a time).
| 0.6
|-
| show all
| Permission to access show all records action.
| 0.6
|-
| remove related record
| Permission to remove a record from a relationship.  See [[Relationship Permissions]]
| 0.6
|-
| delete related record
| Permission to delete a record in a relationship.  This is stronger than the remove related record permission in that it allows the user to delete the record from the database.  See [[Relationship permissions]]
| 0.6
|-
| find
| Permission to perform the find action.
| 0.6
|-
| import
| Permission to perform the import action (to import records into the database).
| 0.6
|-
| export_csv
| Permission to perform the Export CSV action (to export the result set in comma-separated-value format).
| 0.6
|-
| export_xml
| Permission to perform the Export XML action (to export the result set as XML).
| 0.8
|-
| translate
| Permission to translate a record into another language.  This permission provides access to the &quot;translate&quot; tab.
| 0.8
|-
| history
| Permission to view history information for a record (e.g. the history tab).  This requires that history be enabled.
| 0.8
|-
| edit_history
| Permission to edit history information such as undo/redo support for a record.
| 0.8
|-
| navigate
| Permission to navigate through records of a table.
| 0.6
|-
| reorder_related_records
| Permission to reorder the records of a relationship (this is different than just sorting).  It sets a default order for the records.  Requires the metafields:order directive to be set for the relationship.
| 0.6
|-
| ajax_save
| Permission to save a record through AJAX.
| 0.8
|-
| ajax_load
| Permission to load a record through AJAX.
| 0.8
|-
| ajax_form
| Permission to access the inline editing ajax form for a record.
| 0.8
|-
| find_list
| Permission to search current table.
| 0.6
|-
| find_multi_table
| Permission to perform a site-wide search.
| 0.8
|-
| register
| Permission to register for an account.
| 0.8
|-
| xml_view
| Permission to view a result set as xml.
| 0.8
|-
| view_xml
| View the XML for an individual record.
| 0.8
|-
| manage_output_cache
| Management permission to clear the output cache.
| 0.8
|-
| manage_migrate
| Permission to access the migration tool to migrate between versions.
| 0.8
|-
| manage
| Permission to access the management control panel.
| 0.8
|-
| manage_build_index
| Permission to rebuild the search index.
| 0.8
|-
| expandable
| Whether the record can be expanded in the left nav menu
| N/A
|}

Some core roles include:

{| class=&quot;listing listing2&quot;
|-
! Name
! Permissions Included
! Version
|-
| READ ONLY
| view, list, calendar, view xml, show all, find, navigate, ajax_load, find_list, find_multi_table, rss, export_csv, export_xml, and export_json
| 0.6
|-
| EDIT
| All permissions in READ ONLY, and edit, add new related record, add existing related record, add new record, remove related record, reorder_related_records, import, translate, new, ajax_save, ajax_form, history, edit_history, copy, update_set, and select_rows
| 0.6
|-
| DELETE
| All permissions in EDIT, and delete and delete found.
| 0.6
|-
| OWNER
| All permissions in DELETE except navigate, new, and delete found.
| 0.6
|-
| REVIEWER
| All permissions in READ ONLY, and edit and translate.
| 0.6
|-
| USER
| All permissions in READ ONLY, and add new related record.
| 0.6
|-
| ADMIN
| All permissions in DELETE and xml_view
| 0.6
|-
| MANAGER
| All permissions in ADMIN and manage, manage_output_cache, manage_migrate, manage_build_index, and install.
| 0.6
|}

===Extending and Overriding Roles===

The cleanest and easiest way to define a new role is to extend an existing role.  Xataface allows you to extend roles via the &apos;&apos;&apos;extends&apos;&apos;&apos; keyword.  For example, if you wanted to create a role &apos;&apos;&apos;TEST ROLE&apos;&apos;&apos; that contained all of the same permissions as the READ ONLY role, you could define it as follows in your application&apos;s permissions.ini file:

&lt;code&gt;
[TEST ROLE extends READ ONLY]
&lt;/code&gt;

If we wanted it to contain the same permissions as READ ONLY but to also allow the edit permission we would define it as:
&lt;code&gt;
[TEST ROLE extends READ ONLY]
    edit=1
&lt;/code&gt;

If we wanted to disallow the list permission, we would do something like:

&lt;code&gt;
[TEST ROLE extends READ ONLY]
    edit=1
    list=0
&lt;/code&gt;

===Overriding Existing Roles===

You can also redefine existing roles:

&lt;code&gt;
[READ ONLY extends READ ONLY]
    my_permission=1
&lt;/code&gt;

This is handy if you have added your own custom permissions that you feel should be included in a core role.

Note that there are some caveats regarding the order of how these roles are defined. Please refer to this forum post for more details: 
[http://www.xataface.com/forum/viewtopic.php?t=6187 Overriding Roles / Permissions]

==See Also==

* [[Relationship Permissions]]
* [[getPermissions]] - The getPermissionsMethod
* [[Delegate class methods]] - Delegate class methods.
* [http://xataface.com/documentation/tutorial/getting_started/permissions Getting started with Xataface permissions]</content>
	<keywords>permissions.ini, getPermissions, permissions</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=25">
	<page_name>conf.ini_file</page_name>
	<page_id>25</page_id>
	<page_title>conf.ini_file</page_title>
	<content>==conf.ini File==

[[toc]]

The conf.ini file is where most of the application-level configuration information is stored for a Xataface application.  It contains information such as:

* database connection information
* which tables should appear in the tables menu.
* [[preferences|preference settings]]
* [[authentication]] settings
* which add-on [[modules]] are to be used
* output caching settings
* history/undo settings
* other misc settings.

Every conf.ini file must contain at least the following sections:


{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| _database
| Contains database connection info.
| all
|-
| _tables
| Contains a list of tables that are to be included in the navigation menu of the application.
| all
|}


The following optional sections may also be included:

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| [http://xataface.com/documentation/how-to/disallow_tables _allowed_tables]
| Specifies tables that should be explicitly allowed to override disallowed tables listed or matched in the [http://xataface.com/documentation/how-to/disallow_tables _disallowed_tables] section.
| 0.7
|-
| [[_auth]]
| Contains information about [[authentication]].
| 0.6
|-
| [http://xataface.com/documentation/how-to/disallow_tables _disallowed_tables]
| A list of tables or patterns that match tables that should be blocked from being accessed directly through the application.  By default any table beginning with an underscore, &apos;dataface_&apos;, or ending in &apos;__history&apos; are blocked.  This prevents unintended access to some of the automatically created tables in Xataface.
| 0.7
|-
| _feed
| Configuration options for [[Introduction_to_RSS_Feeds_in_Xataface|RSS feeds]] that are generated by the application.
| 1.0
|-
| _history
| Settings pertaining to the [http://xataface.com/documentation/how-to/history-howto history feature] (e.g. whether it has been enabled).
| 0.7
|-
| _index
| Settings for the full site search indexing.
| 1.0
|-
| _modules
| A list of [[modules]] that are enabled for this application.
| 1.0
|-
| [[_output_cache]]
| Output cache settings.  Using output caching can dramatically improve performance for busier sites.
| 0.8
|-
| _themes
| A list of the themes that are to be applied to the application.
| 0.8
|}

===Stand-alone Attributes===

Stand-alone attributes for an INI file must appear at the beginning of the INI file (before any of the sections).  The conf.ini may contain the following stand-alone attributes.

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Values
! Version
|-
| cache_queries
| Enables query caching.  Enabling this feature can yield drastic performance improvements especially on busy sites with large databases.
| boolean (0 or 1)
| 1.2

|-
| cache_queries_log
| Enables logging of query caching to the file /tmp/querylog.log so that you can tell whether your queries are being cached, and which ones are being cached.
| boolean (0 or 1)
| 1.2

|-
| default_action
| The default action to be performed if it is not explicitly specified in the query (e.g. &apos;list&apos;, &apos;find&apos;, &apos;edit&apos;).  Default is &apos;list&apos;.
| string
| 0.6
|-
| debug
| If this is set to 1, then the application will run in debug mode which displays the available slots and blocks on the screen, along with some other debug information.
| 0 or 1 (default is 0)
| 0.6

|-
| default_browse_action
| The default action to perform in the details tab.  E.g. When you click on the &quot;details&quot; tab there are a number of sub-tabs including &apos;view&apos;, &apos;edit&apos;, etc... .   The default value for this directive is &apos;view&apos;.  If you want to go directly to the edit form when clicking on a record in list view, you would set &apos;&apos;default_browse_action&apos;&apos; to &apos;edit&apos;.
| string
| 0.6
|-
| default_language
| The default language to use.  This is the 2-digit ISO language code.  If this value is not specified it defaults to the first language listed in the &apos;&apos;[languages]&apos;&apos; section.
| string (2-digit ISO language code)
| 0.6
|-
| default_limit
| The default limit (i.e. the number of records to show per page) if none is explicitly specified in the query.  Default is 30.
| int
| 0.6
|-
| default_table
| The default table to show if none is specified by the query.  If you do not define this value, then the first table in the &apos;&apos;[_tables]&apos;&apos; section is used.
| string
|0.6
|-
| disable_session_ip_check
| Default behaviour automatically tracks the IP address of the user when they log in.  If a request is made for a session from a different IP then the session is automatically destroyed and the user is logged out.
| boolean
| 1.3rc4

|-
| title
| A title for the application (appears in the browser title bar).
| string
| 0.6
|-
| usage_mode
| The usage mode of the application.  If this value is set to &apos;&apos;edit&apos;&apos;, then ajax inline editing is enabled (i.e. you can click on any value in the application to edit it inline.
| &apos;view&apos; or &apos;edit&apos;
| 0.6
|}

===Example 1: A simple conf.ini file===

&lt;code&gt;
[_database]
	host=&quot;localhost&quot;
	name=&quot;mydb&quot;
	user=&quot;mydbuser&quot;
	password=&quot;foo&quot;
	
[_tables]
webpage_sites=&quot;Websites&quot;
translations = &quot;Translations&quot;
packages=&quot;Packages&quot;
users=Users
proof_jobs=&quot;Jobs&quot;
webpage_status=&quot;Webpages Status&quot;

&lt;/code&gt;

===Example 2: A more complex conf.ini file===

&lt;code&gt;
;debug=1
;default_action=home
;google_translate_url=&quot;http://weblite-dns2.com/proxy.php&quot;
google_translate_url=&quot;http://ec2-75-101-244-123.compute-1.amazonaws.com/proxy.php&quot;
title=&quot;Web Lite Translate&quot;
default_price_per_word=0.15

;;Configuration settings for application
title=&quot;translation_weblite_ca&quot;
scriptUrl=&quot;http://translation.weblite.ca/index.php&quot;
multilingual_content=1


[_database]
	host=&quot;localhost&quot;
	name=&quot;mydb&quot;
	user=&quot;mydbuser&quot;
	password=&quot;foo&quot;
	
[_tables]
    webpage_sites=&quot;Websites&quot;
    translations = &quot;Translations&quot;
    packages=&quot;Packages&quot;
    users=Users
    proof_jobs=&quot;Jobs&quot;
    webpage_status=&quot;Webpages Status&quot;


[_auth]
	users_table=users
	username_column=username
	password_column=password
	secret_code=&quot;ljkasdfjkldsafliasdoiudsfoi&quot;
	allow_register=1
	session_timeout=999999999
	
[_modules]
	modules_ShoppingCart=&quot;modules/ShoppingCart/ShoppingCart.php&quot;

[ShoppingCart_taxes]
	;; This section is necessary to declare that we have NO taxes.
	
[metatags]
	keywords = &quot;translation, translate&quot;
	description = &quot;Good translation service&quot;
	
;[_output_cache]
;	enabled=1

[_mail]
	func=mail2
	
&lt;/code&gt;

</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=24">
	<page_name>templates:tags:use_macro</page_name>
	<page_id>24</page_id>
	<page_title>templates:tags:use_macro</page_title>
	<content>==use_macro Template Tag==

===Synopsis===

The use_macro tag includes another template into the current template with the option to override certain sections.

===Parameters===

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| file
| The path the template to include (within the templates directory).
| 0.6
|}

===Example===

In this example we will create a template for a user profile, but this template will include a slot that can be overridden by other templates to customize the user bio.

====user-profile.html====

&lt;code&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;User profile&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
   &lt;h1&gt;User bio&lt;/h1&gt;
   &lt;div id=&quot;bio&quot;&gt;
   {define_slot name=&quot;bio&quot;}
        This text will be overridden by other templates to place the correct
        bio information.
   {/define_slot}
&lt;/body&gt;
&lt;/html&gt;
&lt;/code&gt;

====steve-profile.html====

&lt;code&gt;
{use_macro file=&quot;user-profile.html&quot;}
    {fill_slot name=&quot;bio&quot;}
        This is Steve&apos;s bio.  It will override the text in the bio slot.
    {/fill_slot}
{/use_macro}
&lt;/code&gt;

===See also:===

* [[xataface templates|Xataface templates]]
* [[templates:tags:define_slot|The define_slot tag]]
* [[templates:tags:fill_slot|The fill_slot tag]]
* [http://www.xataface.com/documentation/tutorial/getting_started/changing-look-and-feel Changing the Look &amp; Feel of Xataface] (From the Getting Started Tutorial)
* [http://www.xataface.com/documentation/tutorial/customizing-the-dataface-look-and-feel Cusomizing the Xataface Look &amp; Feel] Tutorial
</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=23">
	<page_name>xataface_templates</page_name>
	<page_id>23</page_id>
	<page_title>xataface_templates</page_title>
	<content>==Xataface Templates==

[[toc]]

Xataface uses the [http://smarty.php.net Smarty Template Engine] to power all of its templates.  Templates are stored in the one of the following locations:

* %XATAFACE_ROOT%/Dataface/templates
* %SITE_ROOT%/templates

Where %XATAFACE_ROOT% is the Xataface directory (includes files such as dataface-public-api.php), and %SITE_ROOT% is the path to your application.

You may also have subdirectories within these templates directories.

===Cascading Templates===

Xataface uses a simple cascading technique for deciding which template to use.  If there are templates in the %SITE_ROOT%/templates and %XATAFACE_ROOT%/Dataface/templates directories with the same name, then Xataface will use the one in the %SITE_ROOT%/templates directory.  In this way, you are able to override any of Xataface&apos;s core templates by adding one of the same name to your %SITE_ROOT%/templates directory.

The most common template to override is the Dataface_Main_Template.html template which defines the look and feel for the entire application (e.g. header, footer, etc...).  Hence, if you wanted to customize the look &amp; feel of your application, you would likely start by copying %XATAFACE_ROOT%/Dataface/templates/Dataface_Main_Template.html into the %SITE_ROOT%/templates directory and make modifications to it as desired.

===Useful Smarty Tags introduced by Xataface===

In addition to the standard set of Smarty tags, Xataface templates provide some of its own.

==Xataface Templates==

Xataface uses the [http://smarty.php.net Smarty Template Engine] to power all of its templates.  Templates are stored in the one of the following locations:

* %XATAFACE_ROOT%/Dataface/templates
* %SITE_ROOT%/templates

Where %XATAFACE_ROOT% is the Xataface directory (includes files such as dataface-public-api.php), and %SITE_ROOT% is the path to your application.

You may also have subdirectories within these templates directories.

===Cascading Templates===

Xataface uses a simple cascading technique for deciding which template to use.  If there are templates in the %SITE_ROOT%/templates and %XATAFACE_ROOT%/Dataface/templates directories with the same name, then Xataface will use the one in the %SITE_ROOT%/templates directory.  In this way, you are able to override any of Xataface&apos;s core templates by adding one of the same name to your %SITE_ROOT%/templates directory.

The most common template to override is the Dataface_Main_Template.html template which defines the look and feel for the entire application (e.g. header, footer, etc...).  Hence, if you wanted to customize the look &amp; feel of your application, you would likely start by copying %XATAFACE_ROOT%/Dataface/templates/Dataface_Main_Template.html into the %SITE_ROOT%/templates directory and make modifications to it as desired.

===Useful Smarty Tags introduced by Xataface===

In addition to the standard set of Smarty tags, Xataface templates provide some of its own.

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| [[templates:tags:use_macro|use_macro]]
| Include another template with the option to override certain sections.
| 0.6
|-
| define_slot
| Marks a section that can be overridden by other templates that include this one via the use_macro tag.
| 0.6
|-
| fill_slot
| Overrides content in a template that has been included via the use_macro tag.
| 0.6
|-
| block
| Marks an insertion point where content can be inserted by delegate classes and modules.
| 0.6
|-
| load_record
| Loads a [http://dataface.weblite.ca Dataface_Record] object from the database to be used in the template.
| 0.6
|-
| group
| Groups an array of records together based on a field value.
| 0.6
|-
| img
| Displays a thumbnail of an image.
| 0.6
|-
| actions
| Loads an associative array of actions defined in the actions.ini file, based on certain criteria.
| 0.6
|-
| actions_menu
| Displays a menu of actions based on certain criteria.
| 0.6
|-
| record_actions
| A specialization of the actions_menu tag.  This displays a menu of actions only in the record_actions category.
| 0.6
|-
| record_tabs
| A specialization of the actions_menu tag.  This displays a menu of actions only in the record_tabs category.
| 0.6
|-
| result_controller
| Displays the paging controls for the current table&apos;s records.   Use this for any listing of records.
| 0.6
|-
| result_list
| Displays the result list (from the list tab) for the current request.
| 0.6
|-
| related_list
| Displays the related records list for the current request.
| 0.6
|-
| bread_crumbs
| Displays the bread crumbs for the current request.
| 0.6
|-
| search_form
| Displays the find form for the current table.
| 0.6
|-
| language_selector
| Displays a menu to select the user&apos;s preferred language.
| 0.6
|-
| next_link
| Displays a link to the next XXX records.
| 0.6
|-
| prev_link
| Displays a link to the previous XXX records.
| 0.6
|-
| jump_menu
| Displays the select list of the records found in this found-set so that the user can jump directly to any record.
| 0.6
|-
| limit_field
| Displays a text field for the user to select the number of records to display per page.
| 0.6
|-
| result_index
| Displays the index of pages (1 to XXX) for this query.
| 0.6
|-
| summary_list
| Displays a list of records in the current found set using a summary format rather than the regular table format.
| 0.6
|-
| sort_controller
| Displays a control to sort the results on any column.
| 0.6
|-
| glance_list
| Displays a simple, brief list of records matching certain criteria.
| 0.6
|-
| record_view
| Loads structured data for a record as required for the view tab.
| 0.6
|-
| feed
| Generates a link to an RSS feed based on certain criteria.
| 0.6
|-
| translate
| Display a section of text in the user&apos;s selected language. (i18n).
| 0.6
|-
| if_allowed
| The contents of this block are shown only if the user has certain permissions.
| 0.6
|-
| editable
| Make a section of the page editable using AJAX.
| 0.6
|-
| abs
| Convert a URL into an absolute URL.
| 0.6
|}


===Useful Template Variables===

Xataface makes certain variables available to every template:

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| $ENV.REQUEST
| Reference to the $_REQUEST array (HTTP Request parameters, both GET and POST)
| 0.6
|-
| $ENV.SESSION
| Reference to the $_SESSION array (the session variables)
| 0.6
|-
| $ENV.DATAFACE_PATH
| The file system path to the Xataface directory (i.e. the directory containing all of the Xataface files such as dataface-public-api.php).
| 0.6
|-
| $ENV.DATAFACE_URL
| The URL to the Xataface directory.
| 0.6
|-
| $ENV.DATAFACE_SITE_PATH
| The file system path to your application directory. (i.e. the directory containing your conf.ini and index.php files).
| 0.6
|-
| $ENV.DATAFACE_SITE_URL
| The URL to your application directory.
| 0.6
|-
| $ENV.DATAFACE_SITE_HREF
| The URL to your application&apos;s script.  This differs from the $ENV.DATAFACE_SITE_URL variable in that this also includes the script name.
| 0.6
|-
| $ENV.SCRIPT_NAME
| Same as $ENV.DATAFACE_SITE_HREF
| 0.6
|-
| $ENV.APPLICATION
| A reference to the application&apos;s conf array (i.e. the parsed contents of the conf.ini file).
| 0.6
|-
| $ENV.APPLICATION_OBJECT
| A reference to the Dataface_Application object for the application.
| 0.6
|-
| $ENV.SERVER
| A reference to the $_SERVER array.
| 0.6
|-
| $ENV.QUERY
| A reference to the current query (i.e.  Dataface_Application::getInstance()-&gt;getQuery())
| 0.6
|-
| $ENV.action
| The name of the current action as specified by the -action REQUEST parameter.
| 0.6
|-
| $ENV.table
| The name of the current table as specified by the -table REQUEST parameter.
| 0.6
|-
| $ENV.table_object
| A reference to the current table.
| 0.6
|-
| $ENV.relationship
| The name of the current relationship as specified by the -relationship REQUEST parameter.
| 0.6
|-
| $ENV.limit
| The value of the -limit REQUEST parameter.  This is the number of records to show per page.
| 0.6
|-
| $ENV.start
| The value of the -start REQUEST parmeter.  This is the starting point in the result set which is currently being displayed.
| 0.6
|-
| $ENV.resultSet
| A reference to the [http://dataface.weblite.ca/Dataface_QueryTool Dataface_QueryTool] object for this result set.
| 0.6
|-
| $ENV.record
| A reference to the [http://dataface.weblite.ca/Dataface_Record Dataface_Record] object that is matched by the current query.
| 0.6
|-
| $ENV.mode
| The name of the current mode.  e.g. find, list, browse
| 0.6
|-
| $ENV.language
| The 2-digit ISO language code that is currently selected as the user&apos;s preferred language.
| 0.6
|-
| $ENV.prefs
| A reference to the preferences array ($conf[&apos;_prefs&apos;])
| 0.6
|-
| $ENV.search
| The value of the current full-text search (i.e. the search that was entered into the upper right search field.
| 0.6
|}


==Smarty Plugins==

One of the most powerful features of [http://www.smarty.net Smarty] is its pluggable architecture.  You can easily add your own custom plugins to a registered &quot;plugins&quot; directory to add functions, modifiers, blocks, and other features to your templates.

Prior to Xataface 2.0, you Smarty plugins could only be placed in the  &apos;&apos;lib/Smarty/plugins&apos;&apos; directory of the Xataface distribution folder.  This is not very conducive to Xataface updates, though.  In general it is best practice to not change anything inside the xataface directory.  Most other configuration and extensions can be handled by making changes to your application&apos;s directory which override corresponding functionality in Xataface.

As of Xataface 2.0, you can create a directory named &apos;&apos;plugins&apos;&apos; to your application directory, Smarty knows to look in this directory for plugins.

For versions of Xataface prior to 2.0, you can make a small modification to the SkinTool to also add support as desribed in [http://xataface.com/forum/viewtopic.php?f=4&amp;t=6722 this post].

===Example Plugin===

The following is an example Smarty plugin adapted from [http://www.smarty.net/docs/en/plugins.functions.tpl this page] but modified slightly to work in Xataface.  It is a simple &quot;eightball&quot; plugin that adds a tag {eightball} to Xataface that you can use in any of your templates.  Whenever this tag is rendered it outputs one of a set of predefined strings randomly.

# Add a &apos;&apos;plugins&apos;&apos; directory to your application directory.  i.e.  &apos;&apos;path/to/app/plugins&apos;&apos;
# Add a file inside this &apos;&apos;plugins&apos;&apos; directory called &apos;&apos;&lt;nowiki&gt;function.eightball.php&lt;/nowiki&gt;&apos;&apos; with the following content:&lt;code&gt;
&lt;?php
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * File:     function.eightball.php
 * Type:     function
 * Name:     eightball
 * Purpose:  outputs a random magic answer
 * -------------------------------------------------------------
 */
function smarty_function_eightball($params, Dataface_SkinTool $template)
{
    $answers = array(&apos;Yes&apos;,
                     &apos;No&apos;,
                     &apos;No way&apos;,
                     &apos;Outlook not so good&apos;,
                     &apos;Ask again soon&apos;,
                     &apos;Maybe in your reality&apos;);

    $result = array_rand($answers);
    return $answers[$result];
}
&lt;/code&gt;
# If you compare this function to the original example in [http://www.smarty.net/docs/en/plugins.functions.tpl the smarty tutorial] you&apos;ll notice that the 2nd parameter has been changed to type &apos;&apos;Dataface_SkinTool&apos;&apos; from &apos;&apos;Smarty_Internal_Template&apos;&apos;. If you don&apos;t make this change, you will get a fatal error when you try to use the tag.  This function defines an &apos;&apos;{eightball}&apos;&apos; tag that can be added to any Smarty template in Xataface.
# Next we&apos;ll create a template that uses this tag.  If your application doesn&apos;t have a &apos;&apos;templates&apos;&apos; directory, create one now (i.e. path/to/app/templates).
# Add a file inside your templates directory called &apos;&apos;testing.html&apos;&apos; with the following content:&lt;code&gt;
The eight ball says {eightball}
&lt;/code&gt;
# Now we need to display this template somewhere in our interface.  In this case, we&apos;ll choose the &apos;&apos;before_record_content&apos;&apos; block.  (This will render the template before the main section of the view tab).  Add the following method to your [[Application_Delegate_Class]]:&lt;code&gt;
function block__before_record_content(){
    df_display(array(), &apos;testing.html&apos;);
}
&lt;/code&gt;
# Now if you load your application in a web browser and navigate to the details view for a record, you should see something like the following:
&lt;nowiki&gt;&lt;img src=&quot;http://media.weblite.ca/files/photos/Screen_Shot_2012-04-16_at_12.33.01_PM.png?max_width=640&quot;/&gt;&lt;/nowiki&gt;

===See also:===

* [http://www.xataface.com/documentation/tutorial/getting_started/changing-look-and-feel Changing the Look &amp; Feel of Xataface] (From the Getting Started Tutorial)
* [http://www.xataface.com/documentation/tutorial/customizing-the-dataface-look-and-feel Cusomizing the Xataface Look &amp; Feel] Tutorial</content>
	<keywords>templates, plugins, smarty</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=22">
	<page_name>Writing_Custom_Authentication_Plugins</page_name>
	<page_id>22</page_id>
	<page_title>Writing_Custom_Authentication_Plugins</page_title>
	<content>==Writing a Custom Authentication Plugin for Xataface==

[[toc]]

Xataface has a pluggable [[authentication]] framework that allows you to easily write your own custom [[authentication]] modules to tie in with other systems.  Several plugins have already been created including:

* [[CAS Authentication Module|Yale CAS]]
* [[LDAP Authentication Module|LDAP]]
* [[Facebook Authentication Module|Facebook]]
* [[HTTP Authentication Module|HTTP]]

===Example: Creating a custom authentication plugin===

Before we begin, a couple of conventions:

# &apos;&apos;&apos;%XATAFACE_ROOT%&apos;&apos;&apos; refers to your Xataface installation directory.  This is where all of the Xataface files are located includeing dataface-public-api.php
# &apos;&apos;&apos;%SITE_ROOT%&apos;&apos;&apos; refers to your Xataface application&apos;s installation directory.  This is where your conf.ini file, index.php, and other application files are stored.

====About our plugin====

Our plugin will be the simplest, most useless authentication plugin you can imagine.  It simply checks an array of usernames and passwords to see if the password that the user supplied is valid.

====Creating our plugin====

# Create the &apos;&apos;&apos;%XATAFACE_ROOT%/modules/Auth&apos;&apos;&apos; directory if it doesn&apos;t exist already.  This directory will store all of our Xataface authentication plugins.
#Create the &apos;&apos;&apos;%XATAFACE_ROOT%/modules/Auth/XDB&apos;&apos;&apos; directory if it doesn&apos;t exist already. This directory will house all of the scripts and files associated with our custom plugin.
#Create a new PHP file named &apos;&apos;&apos;XDB.php&apos;&apos;&apos; inside our &apos;&apos;&apos;XDB&apos;&apos;&apos; directory that we just created, with the following contents:&lt;code&gt;
class dataface_modules_XDB {
    var $passwords = array(
        &apos;steve&apos; =&gt; &apos;stevespass&apos;,
        &apos;mike&apos; =&gt; &apos;foo&apos;
    );
    function checkCredentials(){
        $auth =&amp; Dataface_AuthenticationTool::getInstance();
        $creds = $auth-&gt;getCredentials();
        if ( @$this-&gt;passwords[$creds[&apos;UserName&apos;]] == $creds[&apos;Password&apos;] ){
            return true;
        } else {
            return false;
        }
    }
}
&lt;/code&gt;
# Now, change the &apos;&apos;&apos;[_auth]&apos;&apos;&apos; section of the conf.ini file to let Xataface know that we want to use our custom module:&lt;code&gt;
[_auth]
    auth_type=XDB
&lt;/code&gt;
# Try to log into your application.  You&apos;ll notice that the only username/password combinations that are accepted are the ones that we specified in our &apos;&apos;&apos;$passwords&apos;&apos;&apos; array in our module.

This is just a simple example, but you can see how this can be expanded to provide more complex modules.

===checkCredentials() not enough?===

Some authentication plugins will need more control than simply checking credentials.  Some plugins may want to make use if their own login forms, or redirect to other sites to handle the authentication.  Xataface&apos;s [http://dataface.weblite.ca/Dataface_AuthenticationTool authentication tool] is up to the task, as virtually all parts of the login/logout process can be overridden and customized in your module.  The previous example shows how the getCredentials() method can be overridden, but there are other methods that can be implemented to customize the login process as well.

e.g.

* showLoginPrompt() - This method is called when it is time to display the login prompt for the user.  It could also be made to redirect to another site that has a login prompt.
* logout() - This is called when the user tries to log out.  If there are any special cookies of variables that need to be cleaned up to facilitate a successful logout, you could implement this method.
* [http://dataface.weblite.ca/getLoggedInUser getLoggedInUser()]
* [http://dataface.weblite.ca/getLoggedInUsername getLoggedInUsername()]
* getCredentials() - Handles the obtaining of credentials from the request or from the environment.
* authenticate() - Handles the whole login process

===See Also:===

* [[Application Delegate Class]] for before/after login/logout triggers that may be more appropriate in some circumstances than creating a custom authentication plugin.
* [[authentication|Xataface Authentication]]</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=21">
	<page_name>authentication</page_name>
	<page_id>21</page_id>
	<page_title>authentication</page_title>
	<content>==Xataface Authentication==

[[toc]]

Xataface comes with authentication ready to roll out of the box.  With a couple of [[_auth|configuration options]] in the [[conf.ini file]], you can activate the default authentication scheme which uses a table (of your choice) in the database to authenticate against.  It supports [[password encryption]], and even includes a [[registration form]] if you choose to allow registrations for your application.

In addition Xataface&apos;s authentication is pluggable, meaning you can write your own plug-ins to integrate your application with any authentication scheme you choose.  Some authentication modules that already exist include:

* [[CAS Authentication Module|Yale CAS]]
* [[LDAP_or_Active_Directory|LDAP]]
* [[Facebook Authentication Module|Facebook]]
* [[HTTP Authentication Module|HTTP]]

====See Also:====

* [[Writing Custom Authentication Plugins]]
* [[Authenticating Against the PHPBB Users table]]
* [[Authenticating Against the Joomla! Users Table]]

Depending on the complexity of the authentication scheme, these plugins may be easy or complex to create.

===Setting up Basic Authentication===

# Create a table (if you haven&apos;t already) to store your application&apos;s users.  At the bare minimum, this table should have fields to store the username and password (you may call these fields whatever you like).  An example table might be: &lt;code&gt;
CREATE TABLE `users` (
  `username` VARCHAR(32) NOT NULL,
  `password` VARCHAR(32) NOT NULL,
  PRIMARY KEY (`username`)
)
&lt;/code&gt;
# Add the following ([[_auth|_auth section]]) to your [[conf.ini file]]: &lt;code&gt;
[_auth]
     users_table=users
     username_column=username
     password_column=password
&lt;/code&gt;  This tell Xataface which table you are storing your user accounts in, and the names of the username and password columns.
# Add a sample user record to the users table if one does not exist yet.&lt;code&gt;
INSERT INTO `users` (`username`,`password`) VALUES (&apos;steve&apos;,&apos;mypass&apos;)
&lt;/code&gt;
# Load your application in your web browser and you&apos;ll notice a &quot;login&quot; link in the upper right that allows you to log in.


===Using MD5 Encryption for the Password===

It is good practice to perform some type of encryption on passwords that you store in a database, so that they will be safe, even if your server&apos;s security is compromised.  One common form of encryption it MD5.  You can apply encryption to your passwords by defining the &apos;&apos;&apos;encryption&apos;&apos;&apos; property to the &apos;&apos;&apos;[password]&apos;&apos;&apos; field&apos;s section of the users table [fields.ini file]. E.g.
&lt;code&gt;
[password]
    encryption=md5
&lt;/code&gt;

This tells Xataface to save data to the password field of the users table with MD5 encryption.

In order to switch to MD5 encryption with an existing Xataface installation, all un-encrypted (plain text) passwords must be first converted to MD5. There are several ways to do this. One method is to directly convert the passwords in the database with the MySQL MD5 function. This can be done from the command-line or using a tool such as phpMyAdmin. It can also be done solely within Xataface as follows, assuming a small number of users where you either know all of the passwords or are planning to change them:

# Log in to your Xataface application as an existing user with ADMIN-level access.
# Navigate to the users table. If you do not already have a link to it, modify your URL to include &quot;-table=&quot; and the name of your users table.
# While logged in, add the encryption=md5 parameter to the fields.ini file as described above.
# Select each user and re-enter or reset their password. It will now be stored with MD5 encryption.
# After completing the above step for all users, you may log out and log back in to verify the change.

===Limiting Access Based on User===

Authentication and permissions are distinct issues, but they are related.  It is quite common to require a user to log in to access a section of an application.  Permissions can be defined in either the Application delegate class or a table&apos;s delegate class - or both.

As an example, if we want to require users to log in to access our application we could define the following getPermissions() method to our application delegate class:

&lt;code&gt;
&lt;?php
class conf_ApplicationDelegate {
    function getPermissions(&amp;$record){
        // $record is a Dataface_Record object
        $auth =&amp; Dataface_AuthenticationTool::getInstance();
        $user =&amp; $auth-&gt;getLoggedInUser();
        if ( $user ) return Dataface_PermissionsTool::ALL();
        else return Dataface_PermissionsTool::NO_ACCESS();
    }
}
&lt;/code&gt;


===Checking Who Is Logged In===

The [http://dataface.weblite.ca/Dataface_AuthenticationTool Dataface_AuthenticationTool] class handles all of the dirty work of Xataface&apos;s authentication.  It provides public methods to check who is logged in and perform authentication if necessary.  Anywhere inside your Xataface application you can find out who is logged in using one of the following two methods:

* [http://dataface.weblite.ca/getLoggedInUser getLoggedInUser()] - Returns a [http://dataface.weblite.ca/Dataface_Record Dataface_Record] object representing a record from the users table.
* [http://dataface.weblite.ca/getLoggedInUsername getLoggedInUsername()] - Returns a string.

It is quite useful in the getPermissions() method of your delegate classes to find out who is logged in:

&lt;code&gt;
function getPermissions(&amp;$record){
    $auth =&amp; Dataface_AuthenticationTool::getInstance();
    $user =&amp; $auth-&gt;getLoggedInUser();
    if ( $user and $user-&gt;val(&apos;username&apos;) == &apos;shannah&apos; ){
        // Steve is logged in so we give him special permissions
        return Dataface_PermissionsTool::ALL();
    } else {
        // Steve is not logged in so we give only read only permissions
        return Dataface_PermissionsTool::READ_ONLY();
    }
}
&lt;/code&gt;

====Checking Who is Logged In from a Template====

All templates in Xataface have access to the *$ENV* array that contains references to lots of useful information, including the currently logged in user:

* &apos;&apos;&apos;$ENV.user&apos;&apos;&apos; - The user object of the currently logged in user (or null if nobody is logged in).  This is a [http://dataface.weblite.ca/Dataface_Record Dataface_Record] object.
* &apos;&apos;&apos;$ENV.username&apos;&apos;&apos; - The name of the currently logged in user.  A string.

For example:

&lt;code&gt;
&lt;!-- 
     Print &apos;Hello Steve&apos; if Steve is logged in,
     &apos;Hello Helen&apos; if Helen is logged in, or just 
     &apos;Hello&apos; if nobody is logged in. 
--&gt;
Hello {$ENV.username}

&lt;!-- Print some personal user info --&gt;
{if $ENV.user}
    Phone number: {$ENV.user-&gt;val(&apos;phone&apos;)}&lt;br/&gt;
    Email address: {$ENV.user-&gt;val(&apos;email&apos;)}&lt;br/&gt;
{/if}
&lt;/code&gt;
This example presumes that the users table has &apos;phone&apos; and &apos;email&apos; fields.


====See Also:====

* [http://xataface.com/documentation/tutorial/getting_started/permissions Permissions Section of Getting Started Tutorial]
* [http://xataface.com/documentation/how-to/disallow_tables How to disallow access to tables in conf.ini file]
* [http://xataface.com/documentation/how-to/security_filters How to use security filters to hide records from certain users]
* [[LDAP_or_Active_Directory| Using LDAP or Active Directory for Authentication]]
* [[_auth|_auth section directives in conf.ini file]]</content>
	<keywords>authentication, [_auth], CAS Authentication, Authentication Modules, Basic Authentication, Security</keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki>
<wiki id="wiki?page_id=20">
	<page_name>relationships.ini_file</page_name>
	<page_id>20</page_id>
	<page_title>relationships.ini_file</page_title>
	<content>==relationships.ini File Reference==

[[toc]]

===Overview===

The relationship.ini file is a configuration file which is associated with a single table of a database application.  It provides metadata about the table&apos;s relationships to other tables to help Xataface dictate how they should be included in the application.  

===Field Directives===

The following directives may be added to a field&apos;s section of the relationship.ini file to customize the field&apos;s behavior.  Some directives are not applicable to all fields.

{| class=&quot;listing listing2&quot;
|-
! Name
! Description
! Version
|-
| __sql__
| The SQL query that defines this relationship. 
| all
|-
| [[action:visible]]
| A boolean value (0 or 1) that indicates whether this relationship should be visible in the record tabs.
| all
|-
| [[action:condition]]
| An expression that evaluates to a boolean that determines at runtime whether the relationship&apos;s tab should appear in the record tabs.
| all
|-
| [[action:delegate]]
| The name of an alternative action that can be used instead of the standard related records list.  One possible value for this would be &quot;related_records_checkboxes&quot; which would provide the user with a checkbox group to select the records that should be part of the relationship rather than the usual related record list.
| 1.0
|-
| [[section:limit]]
| Integer.  The number of records to show in the related record sections (in the view tab).  Default is 5.
| 1.0
|-
| [[section:visible]]
| Boolean value (0 or 1) indicating whether the relationship information should appear as a section on the left side of the table.
| all
|-
| [[actions:addexisting]]
| Boolean value (0 or 1) indicating whether the action to add existing records should exist in this relationship.
| all
|-
| [[actions:addnew]]
| Boolean value (0 or 1) indicating whether the action to add news records should exist in this relationship.
| all
|-
| [[action:label]]
| The label that appears in the relationship tab for this relationship. 
| all
|-
| [[list:type]]
| Optional type of list to use for the related record list.  Possible value: &quot;treetable&quot;
| 0.8
|-
| [[meta:class]]
| An optional special class to assign to the relationship.  E.g. &quot;parent&quot; or &quot;children&quot;.
| 0.8
|-
| [[metafields:order]]
| If the relationship should have a default order this specifies the field that should be used for this sort. 
| all
|-
| [[visibility:fieldName]]
| If given the value hidden will make that particular fieldName disappear in the relationship.  This will only be applied for that particular relationship.  
| all
|-
| [[visibility:find]]
| If given the value hidden this will cause the related fields to not appear on the find form.  Normally each relationship is provided a section of the find form to enable users to find records that contain at least one match in the related records.  
| 1.3rc4
|-
| [[vocabulary:existing]]
| Specifies a valuelist that can be used to provide the set of records that can be added to this relationship.  If target table has a single column primary key then the valuelist should use the primary key for the value.  If it has a multi-column primary key, then the value should be in the form key1=value1&amp;key2=value2 etc...  See also [[relationshipname__getAddableValues]] delegate class method for a programatic solution.
| 1.0
|}

==Relationship Permissions==

See [[Relationship Permissions]]

==See Also==

* [http://xataface.com/documentation/tutorial/getting_started/relationships Getting started with relationships]</content>
	<keywords>relationships.ini file, relationships</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=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=16">
	<page_name>sendRegistrationActivationEmail</page_name>
	<page_id>16</page_id>
	<page_title>sendRegistrationActivationEmail</page_title>
	<content>==sendRegistrationActivationEmail() Hook==

A hook that can be implemented in the [[Application Delegate Class]] or the [[Table Delegate Class]] to override the sending of an activation email to the user.

===Signature===

function sendRegistrationActivationEmail( Dataface_Record &amp;$record, string $activationURL ) : mixed

====Parameters====

{| class=&quot;listing listing2&quot;
! Name
! Description
|-
| &amp;$record
| A Dataface_Record object encapsulating the record that is being inserted in the users table for this registration.
|-
| $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 sendRegistrationActivationEmail(&amp;$record, $activationURL){
        // mail the admin to let him know that the registration is occurring.
        $username = $record-&gt;val(&apos;username&apos;);
        $email = $record-&gt;val(&apos;email&apos;);
        
        mail($email, &apos;Welcome to the team&apos;, 
            &apos;Welcome &apos;.$record-&gt;val(&apos;username&apos;).
            &apos;.  You have been successfully registered.  
             Please visit &apos;.$activationURL.&apos; to activate your account&apos;
        );
    }
}
&lt;/code&gt;

===See Also===
* [[beforeRegister]]
* [[afterRegister]]
* [[validateRegistrationForm]]
* [[getRegistrationActivationEmailInfo]]
* [[getRegistrationActivationEmailSubject]]
* [[getRegistrationActivationEmailMessage]]
* [[getRegistrationActivationEmailParameters]]
* [[getRegistrationActivationEmailHeaders]]</content>
	<keywords></keywords>
	<language>en</language>
	<original_page>0</original_page>
</wiki></record>