| version 1.38, 2004/01/21 16:35:09 |
version 1.39, 2004/01/26 17:16:11 |
|
|
| <!-- $Platon: phpMyEdit/doc/sgml/configuration.general.sgml,v 1.37 2003/12/20 15:06:49 nepto Exp $ --> |
<!-- $Platon: phpMyEdit/doc/sgml/configuration.general.sgml,v 1.38 2004/01/21 16:35:09 nepto Exp $ --> |
| |
|
| <sect1 id="configuration.mysql-options"> |
<sect1 id="configuration.mysql-options"> |
| <title id="configuration.mysql-options.title">Database connection</title> |
<title id="configuration.mysql-options.title">Database connection</title> |
| Line 63 $opts['key'] = 'id'; |
|
| Line 63 $opts['key'] = 'id'; |
|
| |
|
| <important><para> |
<important><para> |
| |
|
| There were problems reported by &name; users regarding to usage of MySQL |
There were problems reported by &name; users regarding the usage of MySQL |
| reserved word as an unique key name (the example for this is "key" name). Thus |
reserved word as an unique key name (the example for this is "key" name). Thus |
| we recommend you to use another name of unique key. Usage of "id" or "ID" |
we recommend using another name of unique key. Usage of "id" or "ID" |
| names should be safe and good idea. |
names should be safe and good idea. |
| |
|
| </para></important> |
</para></important> |
| Line 95 possible unique key types are 'real' or |
|
| Line 95 possible unique key types are 'real' or |
|
| |
|
| If you are using 'real' key type and some problems with record manipulaton have |
If you are using 'real' key type and some problems with record manipulaton have |
| occured, it is probably because your MySQL key datatype is 'float'. Comparsions |
occured, it is probably because your MySQL key datatype is 'float'. Comparsions |
| with this datatype is a common problem in most computer languages (SQL including), |
with this datatype is a common problem in most computer languages (including SQL), |
| because floating-point values are not exact values. In most cases, changing |
because floating-point values are not exact values. In most cases, changing |
| MySQL datatype from 'float' to 'double' and preserving 'real' as &name; key type |
the MySQL datatype from 'float' to 'double' and preserving 'real' as &name; key type |
| should solve this problem. |
should solve this problem. |
| |
|
| </para> |
</para> |
| Line 117 Matching Rows</> chapter in the MySQL ma |
|
| Line 117 Matching Rows</> chapter in the MySQL ma |
|
| <bridgehead id="configuration.page-name">Page name</bridgehead> |
<bridgehead id="configuration.page-name">Page name</bridgehead> |
| <para> |
<para> |
| |
|
| The page name option defines variable used for constructing page and form |
The page name option defines the variable used for constructing page and form |
| links. If not defined, default value <varname>$PHP_SELF</varname> will be |
links. If not defined, the default value <varname>$PHP_SELF</varname> will be |
| used. |
used. |
| |
|
| <example><title>Setting up the page name</title> |
<example><title>Setting up the page name</title> |
| Line 132 $opts['page_name'] = 'index.php'; |
|
| Line 132 $opts['page_name'] = 'index.php'; |
|
| <bridgehead id="configuration.displayed-records">Displayed records</bridgehead> |
<bridgehead id="configuration.displayed-records">Displayed records</bridgehead> |
| <para> |
<para> |
| |
|
| Option controls the number of records displayed on the screen. Change the |
This option controls the number of records displayed on the screen. Change the |
| argument for <varname>$opts['inc']</varname> in order to specify the maximum |
argument for <varname>$opts['inc']</varname> in order to specify the maximum |
| number of rows to display at one time. The default is 15 rows. To display all |
number of rows to display at one time. The default is 15 rows. To display all |
| found records, specify a value of -1 (negative 1). |
found records, specify a value of -1 (negative 1). |
| Line 205 $opts['display'] = array( |
|
| Line 205 $opts['display'] = array( |
|
| <para> |
<para> |
| |
|
| There is also one special <varname>$opts['display']['tabs']</varname> |
There is also one special <varname>$opts['display']['tabs']</varname> |
| variable, which generally controls TABs feature. For more information see |
variable, which generally controls the TABs feature. For more information see |
| <xref linkend="configuration.tabs-feature" |
<xref linkend="configuration.tabs-feature" |
| endterm="configuration.tabs-feature.title"> section. |
endterm="configuration.tabs-feature.title"> section. |
| |
|
| Line 335 administrator with the ability to delete |
|
| Line 335 administrator with the ability to delete |
|
| <para> |
<para> |
| |
|
| &name; offers powerful default and/or additional sorting capabilities via |
&name; offers powerful default and/or additional sorting capabilities via |
| <varname>$opts['sort_field']</varname> option. You can define column name or |
<varname>$opts['sort_field']</varname> option. You can define the column name or |
| column field number you'd prefer to sort on when the script is first loaded. To |
column field number that you'd prefer to sort on when the script is first loaded. To |
| get descending sort order, prefix the column name or field number with dash (-) |
get descending sort order, prefix the column name or field number with dash (-) |
| sign. Look at the following examples: |
sign. Look at the following examples: |
| |
|
| Line 351 $opts['sort_field'] = '-id'; // desc |
|
| Line 351 $opts['sort_field'] = '-id'; // desc |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| Now, let's assume you want to sort your table according to 'company' column, but |
Now, let's assume you want to sort your table according to the 'company' column, but |
| in addition also according to 'department' column. So the default sort order |
in addition also according to the 'department' column. So the default sort order |
| should be by company first, then department. For this purpose, you can set array |
should be by company first, then department. For this purpose, you can set an array |
| with column names and/or field numbers to <varname>$opts['sort_field']</varname> |
with column names and/or field numbers to <varname>$opts['sort_field']</varname> |
| variable. |
variable. |
| |
|
|
|
| <para> |
<para> |
| |
|
| This feature enables selecting more than one sort field on the fly. To clear |
This feature enables selecting more than one sort field on the fly. To clear |
| sort fields sequence and to initialize default one, click on |
sort fields sequence and to initialize the default one, click on |
| <GUIlabel>Clear</GUIlabel> link in left upper corner. This link could be enabled |
<GUIlabel>Clear</GUIlabel> link in left upper corner. This link could be enabled |
| by setting <varname>$opts['display']['sort']</varname> to |
by setting <varname>$opts['display']['sort']</varname> to |
| <constant>true</constant>. See <xref linkend="configuration.page-elements" |
<constant>true</constant>. See <xref linkend="configuration.page-elements" |
| Line 469 $opts['filters'] = 'PMEtable0.sessions_c |
|
| Line 469 $opts['filters'] = 'PMEtable0.sessions_c |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| When generating query, &name; redefines/aliases the table names for easy |
When generating a query, &name; redefines/aliases the table names for easy |
| accessing of particular table fields in the main table and in the tables used |
accessing of particular table fields in the main table and in the tables used |
| in JOIN clausules as well. The main table name is changed to <database |
in JOIN clauses as well. The main table name is changed to <database |
| class=table>PMEtable0</>, tables used in JOIN clausules have their name like |
class=table>PMEtable0</>, tables used in JOIN clauses have their name like |
| <database class=table>PMEjoinN</> where <varname>N</> is JOIN table order. |
<database class=table>PMEjoinN</> where <varname>N</> is JOIN table order. |
| |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| We recommend you to look at generated SQL queries in your MySQL log file in |
We recommend that you look at the generated SQL queries in your MySQL log file in |
| order you want to know how database table was aliased. Finally, described |
order to know how database the table was aliased. Finally, the described |
| approach is needed only if you are accessing field, which name occurs in more |
approach is needed only if you are accessing a field name which occurs in more |
| than one table of SQL query (thus MySQL cannot exactly determine what it is |
than one table of SQL query (thus MySQL cannot exactly determine what is |
| meant with "field_name"). |
meant by "field_name"). |
| |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| For future is planned initialization like the following one. |
For future development is planned an initialization like the following one. |
| |
|
| <programlisting><![CDATA[ |
<programlisting><![CDATA[ |
| $opts['filters'] = array( |
$opts['filters'] = array( |
| Line 499 $opts['filters'] = array( |
|
| Line 499 $opts['filters'] = array( |
|
| The main advantage of this approach will be that <varname>col_name_1</> and |
The main advantage of this approach will be that <varname>col_name_1</> and |
| <varname>col_name_2</> fields are automatically considered as read-only on |
<varname>col_name_2</> fields are automatically considered as read-only on |
| display record pages with pre-set <constant>value_1</>, <constant>value_2</> |
display record pages with pre-set <constant>value_1</>, <constant>value_2</> |
| and without need to enter them manually. |
and without the need to enter them manually. |
| |
|
| </para> |
</para> |
| </sect1> |
</sect1> |
| Line 509 and without need to enter them manually. |
|
| Line 509 and without need to enter them manually. |
|
| <para> |
<para> |
| |
|
| Triggers are files that are included via <function>include()</function> |
Triggers are files that are included via <function>include()</function> |
| statement that perform actions before or after insert, update, or delete of |
statement. SQL triggers are included before or after insert, update, or delete of |
| record. |
record. FORM triggers are included before displaying the form that will allow |
| |
the corresponding operation, or after the user canceled this form. |
| |
|
| |
</para> |
| |
<para> |
| |
|
| |
<itemizedlist spacing="compact"> |
| |
<listitem><simpara>View form is related to 'select' operation.</simpara></listitem> |
| |
<listitem><simpara>Add and Copy forms are related to 'insert' operation</simpara></listitem> |
| |
<listitem><simpara>Edit form is related to 'update' operation.</simpara></listitem> |
| |
<listitem><simpara>Delete form is related to 'delete' operation.</simpara></listitem> |
| |
</itemizedlist> |
| |
|
| |
</para> |
| |
<para> |
| |
|
| |
There are following types of &name; triggers: |
| |
|
| </para> |
</para> |
| <para> |
<para> |
|
|
| <itemizedlist> |
<itemizedlist> |
| <listitem><para> |
<listitem><para> |
| |
|
| |
'pre' triggers are usually used to check conditions before displaying |
| |
the operation's page. For example, users may be allowed to View all records but |
| |
can only Edit a subset of them. Another usage is to lock the record in |
| |
order to avoid other users to start to change it at the same time. |
| |
|
| |
</para></listitem> |
| |
<listitem><para> |
| |
|
| 'before' triggers are usually used to verify conditions prior to |
'before' triggers are usually used to verify conditions prior to |
| executing the main operation. |
executing the main operation. |
| |
For example, they can be of some use for input validation. |
| |
|
| </para></listitem> |
</para></listitem> |
| <listitem><para> |
<listitem><para> |
| |
|
| 'after' triggers are usually used to perform follow-on operations |
'after' triggers are usually used to perform follow-up operations |
| after the main operation. For example, to update secondary tables |
after the main operation. For example, to update secondary tables |
| to enforce referential integrity or to update aggregate tables. |
to enforce referential integrity or to update aggregate tables. |
| |
|
| </para></listitem> |
</para></listitem> |
| |
<listitem><para> |
| |
|
| |
'cancel' triggers are usually used to perform follow-up operations |
| |
after users cancel the form. For example, if a record is locked using a |
| |
'pre' triggers, then a 'cancel' trigger can unlock it. |
| |
|
| |
</para></listitem> |
| </itemizedlist> |
</itemizedlist> |
| |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| The operation sequence is this: before, main, after. If any |
If 'pre' triggers fail, users are sent back to the list, except for the |
| operation fails, not only should the next operation(s) not be |
'update' case, where users are sent back to view page if the pre-update |
| executed, but the previous ones are 'rolled back' as if they |
trigger fails. |
| never happened. If a database is not able to do this, it is |
|
| not 'transaction-safe'. |
</para> |
| |
<para> |
| |
|
| |
For SQL triggers, the operation sequence is this: before, main, after. If any |
| |
operation fails, not only should the next operation(s) not be executed, but |
| |
the previous ones are 'rolled back' as if they never happened. If a database |
| |
is not able to do this, it is not 'transaction-safe'. |
| |
|
| </para> |
</para> |
| <para> |
<para> |
| Line 546 not 'transaction-safe'. |
|
| Line 584 not 'transaction-safe'. |
|
| Triggers are risky in basic MySQL as there is no native transaction support. It |
Triggers are risky in basic MySQL as there is no native transaction support. It |
| is not transaction-safe by default. There are transaction-safe table types in |
is not transaction-safe by default. There are transaction-safe table types in |
| MySQL that can be conditionally built (see MySQL-Max), but &name; is currently |
MySQL that can be conditionally built (see MySQL-Max), but &name; is currently |
| not set up to support real transactions. What that means is that if an |
not set up to support real transactions. What that means is that if an |
| operation fails, the database may be left in an intermediate and invalid state. |
operation fails, the database may be left in an intermediate and invalid state. |
| |
|
| </para> |
</para> |
| Line 565 to indicate success or failure. |
|
| Line 603 to indicate success or failure. |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| <example><title>Triggers usage</title> |
<example><title>Select triggers</title> |
| |
<programlisting><![CDATA[ |
| |
// Before displaying the view page |
| |
$opts['triggers']['select']['pre'] = 'categories.TSP.inc'; |
| |
// After canceling the view page |
| |
$opts['triggers']['select']['cancel'] = 'categories.TSC.inc'; |
| |
]]></programlisting> |
| |
</example> |
| |
|
| |
<example><title>Insert triggers</title> |
| <programlisting><![CDATA[ |
<programlisting><![CDATA[ |
| |
// Before displaying the add/copy page |
| |
$opts['triggers']['insert']['pre'] = 'categories.TIP.inc'; |
| |
// After requesting save or more in the add/copy page |
| $opts['triggers']['insert']['before'] = 'categories.TIB.inc'; |
$opts['triggers']['insert']['before'] = 'categories.TIB.inc'; |
| $opts['triggers']['insert']['after'] = 'categories.TIA.inc'; |
$opts['triggers']['insert']['after'] = 'categories.TIA.inc'; |
| |
// After canceling the add/copy page |
| |
$opts['triggers']['insert']['cancel'] = 'categories.TIC.inc'; |
| |
]]></programlisting> |
| |
</example> |
| |
|
| |
<example><title>Update triggers</title> |
| |
<programlisting><![CDATA[ |
| |
// Before displaying the edit page |
| |
$opts['triggers']['update']['pre'] = 'categories.TUP.inc'; |
| |
// After requesting save or apply in the edit page |
| $opts['triggers']['update']['before'] = 'categories.TUB.inc'; |
$opts['triggers']['update']['before'] = 'categories.TUB.inc'; |
| $opts['triggers']['update']['after'] = 'categories.TUA.inc'; |
$opts['triggers']['update']['after'] = 'categories.TUA.inc'; |
| |
// After canceling the edit page |
| |
$opts['triggers']['update']['cancel'] = 'categories.TUC.inc'; |
| |
]]></programlisting> |
| |
</example> |
| |
|
| |
<example><title>Delete triggers</title> |
| |
<programlisting><![CDATA[ |
| |
// Before displaying the delete page |
| |
$opts['triggers']['delete']['pre'] = 'categories.TDP.inc'; |
| |
// After requesting delete in the delete page |
| $opts['triggers']['delete']['before'] = 'categories.TDB.inc'; |
$opts['triggers']['delete']['before'] = 'categories.TDB.inc'; |
| $opts['triggers']['delete']['after'] = 'categories.TDA.inc'; |
$opts['triggers']['delete']['after'] = 'categories.TDA.inc'; |
| |
// After canceling the delete page |
| |
$opts['triggers']['delete']['cancel'] = 'categories.TDC.inc'; |
| ]]></programlisting> |
]]></programlisting> |
| </example> |
</example> |
| |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| In every trigger file you have available following usable variables. Some from |
Please note that <varname>['select']['after']</varname> and |
| them are regarding only to particular performed action. |
<varname>['select']['before']</varname> triggers currently do not exist. |
| |
|
| |
</para> |
| |
<para> |
| |
|
| |
In the following sample are steps during a View, Edit, Apply and Cancel |
| |
operation described. All involved triggers return <constant>true</constant>. |
| |
|
| |
<itemizedlist spacing="compact"> |
| |
<listitem><simpara>user starts from the list page</simpara></listitem> |
| |
<listitem><simpara>user asks to view a record</simpara></listitem> |
| |
<listitem><simpara><varname>['select']['pre']</varname> trigger is included (if defined)</simpara></listitem> |
| |
<listitem><simpara>if <constant>true</constant> is returned than continue, else go back to list page</simpara></listitem> |
| |
|
| |
<listitem><simpara>user is now in the view page</simpara></listitem> |
| |
<listitem><simpara>user asks to edit the record</simpara></listitem> |
| |
<listitem><simpara><varname>['update']['pre']</varname> trigger is included (if defined)</simpara></listitem> |
| |
<listitem><simpara>if <constant>true</constant> is returned than continue, else go back to view page</simpara></listitem> |
| |
|
| |
<listitem><simpara>user is now in the edit page</simpara></listitem> |
| |
<listitem><simpara>user makes some changes and asks to apply (save and continue)</simpara></listitem> |
| |
<listitem><simpara><varname>['update']['before']</varname> trigger is included (if defined)</simpara></listitem> |
| |
<listitem><simpara>if <constant>true</constant> is returned than continue, else, back to list without updating</simpara></listitem> |
| |
<listitem><simpara>record is updated in the database</simpara></listitem> |
| |
<listitem><simpara><varname>['update']['after']</varname> trigger is included (if defined)</simpara></listitem> |
| |
<listitem><simpara><varname>['update']['pre']</varname> trigger is included (if defined)</simpara></listitem> |
| |
<listitem><simpara>if <constant>true</constant> is returned than continue, else go back to view page</simpara></listitem> |
| |
|
| |
<listitem><simpara>user is now back to the edit page</simpara></listitem> |
| |
<listitem><simpara>user makes some other changes but asks to cancel them</simpara></listitem> |
| |
<listitem><simpara><varname>['update']['cancel']</varname> trigger is included (if defined)</simpara></listitem> |
| |
|
| |
<listitem><simpara>user is back to the list page</simpara></listitem> |
| |
</itemizedlist> |
| |
|
| |
</para> |
| |
<para> |
| |
|
| |
In every trigger file you have available following usable variables. Some of |
| |
them affect only a particular action. |
| |
|
| <simplelist type=horiz columns=2> |
<simplelist type=horiz columns=2> |
| <member><varname>$this</varname></> |
<member><varname>$this</varname></> |
| Line 606 them are regarding only to particular pe |
|
| Line 717 them are regarding only to particular pe |
|
| There are also other variables available. For example every class property can |
There are also other variables available. For example every class property can |
| be accessed using <varname>$this</> object reference. All variables occurs in |
be accessed using <varname>$this</> object reference. All variables occurs in |
| 'before' triggers as well as in 'after' triggers. |
'before' triggers as well as in 'after' triggers. |
| |
Only class properties occurs in 'pre' and 'cancel' triggers currently. |
| |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| It is recommended to use <function>$this->myQuery()</function> method in order |
It is recommended to use the <function>$this->myQuery()</function> method in order |
| to perform database queries for fetching additional data or doing inserts or |
to perform database queries for fetching additional data or doing inserts or |
| updates to other database tables. |
updates to other database tables. |
| |
|
| Line 621 updates to other database tables. |
|
| Line 733 updates to other database tables. |
|
| <title id="configuration.logging.title">Logging user actions</title> |
<title id="configuration.logging.title">Logging user actions</title> |
| <para> |
<para> |
| |
|
| You can log performed user actions into special "changelog" table. You must have |
You can log user actions into a special "changelog" table. You must have |
| table created and specified for &name; using the <varname>$opts['logtable']</> |
table created and specified for &name; using the <varname>$opts['logtable']</> |
| option. |
option. |
| |
|
| Line 650 CREATE TABLE changelog ( |
|
| Line 762 CREATE TABLE changelog ( |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| &name; provides also possibility of notifying about performed user actions by |
&name; provides also the possibility of notifying about performed user actions by |
| sending informational e-mail. This feature configuration is done via |
sending informational e-mail. This feature configuration is done via |
| <varname>$opts['notify']</> array with following variables notation. Note that |
<varname>$opts['notify']</> array with following variables notation. Note that |
| on every place where one e-mail address should be written, it is possible to |
on every place where one e-mail address should be written, it is possible to |
| have array of multiple e-mail addresses there. This feature is provided for |
have array of multiple e-mail addresses there. This feature is provided for |
| informating more than one user about particular performed action. |
informing more than one user about particular performed action. |
| |
|
| <simplelist type=horiz columns=2> |
<simplelist type=horiz columns=2> |
| <member><varname>$opts['notify']['from']</></><member> sender envelope e-mail address (webmaster@SERVER_NAME by default)</> |
<member><varname>$opts['notify']['from']</></><member> sender envelope e-mail address (webmaster@SERVER_NAME by default)</> |
| Line 686 extracted from the variables in followin |
|
| Line 798 extracted from the variables in followin |
|
| <title id="configuration.languages.title">Languages</title> |
<title id="configuration.languages.title">Languages</title> |
| <para> |
<para> |
| |
|
| The default language setting is the user's web browser language setting and use |
The default language setting is the user's web browser language setting. Use |
| it if possible. The following example forces the English language version, and |
it if possible. The following example forces the English language version, and |
| the last forces the Slovak language version. |
the last forces the Slovak language version. |
| |
|
| |
|
| <example><title>Languages selection</title> |
<example><title>Languages selection</title> |
| <programlisting><![CDATA[ |
<programlisting><![CDATA[ |
| // client language (default) |
// client language (default) |
| Line 732 Available languages are: |
|
| Line 843 Available languages are: |
|
| <para> |
<para> |
| |
|
| Language codes are based on ISO-3166 standard, which is available on many |
Language codes are based on ISO-3166 standard, which is available on many |
| places, in example <ulink url="http://www.samspade.org/d/iso3166.html">here</>. |
places, for example <ulink url="http://www.samspade.org/d/iso3166.html">here</>. |
| |
|
| </para> |
</para> |
| </sect1> |
</sect1> |
|
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| This will turn on search filter on script initialization. However, it is |
This will activate the search filter on script initialization. However, it is |
| still possible to turn it off by explicit click on <GUIbutton>Hide</> or |
still possible to turn it off by explicit click on <GUIbutton>Hide</> or |
| <GUIbutton>Clear</> button. |
<GUIbutton>Clear</> button. |
| |
|
| Line 761 $opts['cgi']['append']['fl'] = 1 |
|
| Line 872 $opts['cgi']['append']['fl'] = 1 |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| Next example shows how to cause descending sorting according first field in all |
The next example shows how to cause descending sorting according first field in all |
| cases. Because <varname>['overwrite']</varname> is used, sorting column cannot |
cases. Because <varname>['overwrite']</varname> is used, sorting column cannot |
| be altered by user by clicking on column heading. |
be altered by the user by clicking on column heading. |
| |
|
| <example><title>CGI variables overwriting</title> |
<example><title>CGI variables overwriting</title> |
| <programlisting><![CDATA[ |
<programlisting><![CDATA[ |
| Line 773 $opts['cgi']['overwrite']['sfn'] = '-0'; |
|
| Line 884 $opts['cgi']['overwrite']['sfn'] = '-0'; |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| Using <varname>$opts['cgi']['persist']</> option you can tell &name; names and |
Using the <varname>$opts['cgi']['persist']</> option you can tell &name; names and |
| values of CGI variables which should be persistent during various pages |
values of CGI variables which should be persistent during various pages |
| reloading and serving. They will be included into all links and also into all |
reloading and serving. They will be included into all links and also into all |
| forms as appropriate hidden inputs. This feature is provided especially for |
forms as appropriate hidden inputs. This feature is provided especially for |
|
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| The phpMyEdit CSS class schema is displayed here: |
The &name; CSS class schema is displayed here: |
| |
|
| <example><title>CSS class name schema</title> |
<example><title>CSS class name schema</title> |
| <programlisting><![CDATA[ |
<programlisting><![CDATA[ |