![]() |
Frequently Asked Questions v2 |
| FAQ Main / Browse by Category |
There are two general kinds of benefits:
If hitting "Init" on the setup.php3 page just comes back to the same page, then its probably because your php.ini file contains
"register_globals = Off"
set this to On and restart Apache.
See the manual section 3.7 for instructions.
If you want to translate the ActionApps to another language, you can look at:
# mkdir perms, set by variable because constants don't work with octal values
$FILEMAN_MODE_DIR = 0770;
# create file perms
$FILEMAN_MODE_FILE = 0664;
define("FILEMAN_BASE_DIR","/www/apc-aa/wizard/");
define("FILEMAN_BASE_URL","http://work.ecn.cz/apc-aa/wizard/");
define("FILEMAN_UPLOAD_TIME_LIMIT",600);
FILEMAN_MODE sets the Unix rights for all files and directories
maintained by the File Manager. Specific directories for individual slices are
created in FILEMAN_BASE_DIR, specify the name of the directory
belonging to a slice in Slice Settings (only superadmins!!). The FILEMAN_BASE_URL
is the web path to the FILEMAN_BASE_DIR, and FILEMAN_UPLOAD_TIME_LIMIT
(in seconds) is useful when uploading large files.
Superadmins can set for each slice if administrators may access the File Manager and set the directory name. A directory name must be filled in order that administrators may use the File Manager. If the directory does not exist, it is created at the first usage of File Manager.
There is a difference between what a superadmin sees and what a slice
administrator sees. The base directory for superadmin is FILEMAN_BASE_DIR,
so you see the directory name when entering File Manager and you can jump to
the parent directory. But slice administrators have access only to the particular
directory and they don't see the directory name.
You can create templates consisting of several files. Some aliases are defined:
Create the templates in directory FILEMAN_BASE_DIR/templates,
each in another subdirectory. Use the AA admin / Wizard Templates page to fill
info about the templates into database. Write the subdirectory name (without
path) and a description.
The 'posted_by......' field must be recorded for each submitted item.
First, your System Administrator has to setup the apc-aa, see below
Then edit one of the fields, e.g. SliceAdmin-Fields-ImageURL-Edit
Set the type to "File upload" and use the Wizard to set the file type to for example image/* or */*
Set the Validate/Insert field to "File"
The field will then show up with a pair of fields, one where a URL can be entered, and the other where a file can be chosen. You may wish to take care on picking the help text for these fields as it can be confusing to figure out whether to fill out both fields or just one.
Why are slice IDs and item IDs so long?
Would it be possible to make them shorter?
The 32-digits hexadecimal IDs are quite standard in MySQL/PHP - see uniqid() and md5() functions. These identifiers are intended to be unique worldwide so that each item has an unique ID regardless of where it is stored, such as on Econnect's server or on Colnodo's. This feature helps us in cross-server feeding.
Internally (within the database) the IDs are stored as 16-character strings (for disk-space savings and a little better performance of the database), but this is only important for developers.
Because of long URLs, I made short_id in v1.8 - so that the auto-incremented short IDs are used by default. The URL for an item is now, for example:
http://kalendar.ecn.cz/index.shtml?AA_SL_Session=44ca275c691 842965745f90ab9aee24e&x=27968
or, even better:
http://kalendar.ecn.cz/index.shtml?x=27968
From Mitra (mitra[at]earth.path.net):
I am using alerts/mailman integration, - its one of the most painful AA admin procedures, basically you have to create an alert that goes to a mailman group. Here are the steps (note that I've SIMPLIFIED it, removing sub-steps).
This presumes you have:
Note that in practice you can only have ONE functioning reader management slice in an entire AA installation since it has email unique - apparently there are historical reasons for this, but it is unclear if there are current reasons.
This is essentially an admin nightmare, do anything even slightly wrong and the mail won't go through, and its very hard to debug.
I believe this could and should be dramatically simplified, we don't have the development resources to build our own mailing list manager in competition to all mailman's functions, better would be to allow an Alerts View to send mail direct to a mailing address - typically the email address of the mailman list.
Next suggested steps for the upgrading the FAQ:
Also need to get other language views and content going (e.g. Spanish).
I also plan to create a Requested Feautre slice in the near future that will use the same alert login.
Some help with updating FAQ content would be most appreciated. :^)
- JD- - - --
We have slice data and structure exported to AA.XML file and we want to import it back to the AA. The problem is, that the AA.XML file is 24 MB.
The solution:
The problem could be in PHP setting. Here's what I had to change in php.ini file to get it going:
1. post_max_size: increased from 8M to 32M
2. upload_max_filesize: increased from 2M to 32M
Those first two were key -- from the php log the upload was clearly
exceeding both of these parameters. Obviously, if the upload was bigger
than 32M (ours was about 24M) this might need to go even bigger.
I also increased these others. I think the upload wouldn't have
completed in the default times, but I'm not sure which parts of the
operation count towards which of these:
1. max_execution_time: changed from 30 to 120 seconds
2. max_input_time: changed from 30 to 120 seconds
3. memory_limit: changed to 32M
Reader Management is a special kind of slice that is designed to contain data about subscribed "readers" (aka public web site users). A Reader Management slice can be used to send automated email alerts of new AA items, personalize page views, send bulk target emails, and generally act as a contact database. Anonymous forms can be set-up to allow users to change their subscriptions and contact data in the Reader slice.
The HTML for a typical APC-AA site can come from many places which can confuse people used to doing all their HTML in a single place.
| Location | What to put there |
| .shtml file | static HTML that doesn't repeat, and is not changed often. Can be edited with any standard web editor by someone who has write permissions on the web server. The HTML has lines like <!--#include "/apc-aa/view.php3 --> (or apc-aa/slice.php3) to include a PHP file which will fetch information from the Slice's design. |
| Design section of the Slice | This is used to list a range of items in a slice, or display a single item. Someone with Admin permission on the slice can go to apc-aa/admin -> Admin -> Views or apc-aa/admin -> Admin -> Display/Index or Display/Fulltext. HTML can be placed here associated with the top and bottom of a listing, with each item, and with groupings of items. The HTML includes alias such as _#HEADLINE |
| Aliases such as _#HEADLINE | Each alias defines how to show a particular field, it does this by choosing a function (e.g. f_h) and parameters. For example _#HEADLINE is usually just output, while a Link might be output surrounded by <a href=" and ">. They can be edited by anyone with administrator priviliges on your slice by going to Admin->Fields->choose field ->Edit. A field can have several different ways of being output, for example a date could have aliases for both short (1/1/200) and long (1 January 2000) forms of output. |
| Functions such as f_h | These define functions certain common ways fields are output. They are defined in the PHP code, and so have to be edited by developers, except that there is an extension function f_u that calls functions from apc-aa/include/usr_aliasfnc.php3, these can be written by anyone who understands PHP3. |
| Data | Lastly of course, the HTML could be in specific fields in your data. |
Exceptions:
The output generated by AA is controlled by aliases. The aliases are 10
letters long words defined on 'Admin' -> 'Fields' -> 'Edit' page. Aliases
are obviously expanded to the content of some database field or its
modification (like How to use aliases alias). For modification of behavior of the
alias we use alias functions, as described on
http://apc-aa.sourceforge.net/faq/#216.
http://apc-aa.sourceforge.net/faq/#291.
Since the AA version 2.1 there is possibility to use the aliases NESTED,
which means that you can use another alias in the alias definition. For
example this Parameters to f_c alias functions are possible:
!:<img src=":" _#PHOTO_WI _#PHOTO_HE alt="photo">::
which displays image (if it is defined). The aliases _#PHOTO_WI _#PHOTO_HE
must be defined, of course.
You can use there not only the aliases, but it is possible to use any of
database field directly there. Imagine, we store type of record in
switch.........1 field (for example text/audio/video). If we create three
images - icon_text.gif, icon_audio.gif, icon_video.gif, we can add an icon
before each link by the following Parameters to f_m alias function:
<img src="img/icon_{switch.........1}.gif" width="14"> :text...........1::href:class="green10"
The AA version 2.2-pre (04/25/2002) give you new possibilities in alias definition - IN-LINE ALIAS DEFINITION. The parsing of format strings was rewritten, so now you can define aliases not only on 'Admin' -> 'Fields' -> 'Edit' page, but you can define it directly inside the format string (= 'Fulltext HTML code' on 'Design' -> 'Fulltext' page, for example). The new features are 100% backward compatible.
The alias definitions are surrounded by curly braces. There are the
possibilities:
... there is displayed headline: {headline........} <br> Source: ...{const_name:category.......1}, {const_description:category.......1}, which displays name (description) of constant stored in field category.......1.| const_short_id | short_id |
| const_name | name |
| const_value | value (the same as {category.......1} ) |
| const_pri | priority number |
| const_group | name of constant group |
| const_class | class (APC parent category) |
| const_id | long constant id |
| const_description | description (defined on hierarchy editor pages) |
... fields in AA could contain multiple values (categories, ...). It is possible to diesplay it:
The example is
directly in Item Manager of 'Test News' slice. The syntax is:
| {@category.......1} | displays list of 'values' - comma separated (comma is default) |
| {@category.......1:-} | displays list of 'values' - dash separated (it is usefull for example in display of related items: {view.php3?vid=11&cmd[11]=x-11-{@relation.......1:-}} |
| {@category.......1:,:<b>_#1</b>} | displays list of 'values' in bold - comma separated (_#1 is alias for the values) |
| {@category.......1:,:<a href="/category.shtm?conds[0][category.......1]=_#1">_#1</a>} | displays list of categories with link to the each category |
| {@category.......1(const_name,const_value,const_short_id):,:<a href="/category.shtm?conds[0][category.......1]=_#2">_#3 _#1</a>} | displays list of categories with link to the each category, but the text shows category name (and short_id) instead of value. You can use as many constant translations as you want in the parethes. See 'constant display' for list of possible values in previous paragraph. |
...view.php3?vid=123&als[heading]=My Page
and then ... <h1>{heading}</h1>... The previous example is good, but sometimes we need to modify the
database field before it is displayed. For example the date field is
displayed as number if seconds since begin of year 1970, which is probably
not exactly what we want to show to user. The solution is to use alias
function modification, which has the following syntax:
alias:<the field>:<alias function>:<parameters>
So, in text (format string) could be the publish date displayed by {alias:publish_date....:f_d:j.n.Y}. There you can use any alias function
with any parameters.
The parameters could be nested, so inside curly braces you can use any alias (How to use aliases), any other field ({headline........}) or any other in-line alias definition. There is no limit in level of nesting.
For example, conditional display of date could look:
{alias:switch.........1:f_c:text:{alias:publish_date....:f_d:j.n.Y}<!--:-->::}
or if we have 06/19/2002 alias defined:
{alias:switch.........1:f_c:text:06/19/2002<!--:-->::}
Both this constructs displays date only if switch.........1 is equal to 'text'. ...
... as addition to in-line aliases you can {# make comments} which is not displayed in result html code. It could be nested again, so you can {# comment out _#ALIASES_ as well as fields {headline........} or alias definitions } - nothing will be in result HTML code ...
... the really new and very useful construct is switch. Many of us knows
the troubles with conditional expressions, managed so far by f_c function.
Now there is much better solution, which allows more options, regular
expressions, ... The syntax is:
{switch(<condition>)<option1>:<output1>:<option2>:<output2>:...[:<default_output>]}
which we can explain on example:
{switch({number.........1})1:one:2:two:[3-7]:more:too much}.
This construct evaluates the condition, which is the content of the number.........1 field in our case. If content of the field is equal to 1, the 'one' is printed. Because 'options' are regular expression, we can specify the third option as [3-7] which means any number in range between 2 and 7. The default option is 'too much' in our case. The evaluation of options goes from left to right and the output is printed only for the first matching option.
The 'switch' could be used instead of f_c alias function in many cases:
{switch({switch.........1})text:06/19/2002}
This expression could replace the expression in the paragraph 2)
Another example displays text 'Continuos grant', if the field
unspecified....2 is filled by 'yes', 'on', 'true' or '1'. Else it displays
expiry date:
{switch({unspecified....2})yes|on|true|1:Continuos grant::12/11/2007}
Display of phone number, if specified (as obvious, '#:' stands for ':' if
you do not want to use it as argument separator:
{switch({con_phone......1}).+:Tel#:{con_phone......1}}
Last example demonstrates the fact, that there is no limit in <condition>.
There could be not only field (in curly braces), but there could be also
any alias, alias definition or its combination. The level of nesting of
'curly braces expressions' is again unlimited.
{switch({1})[1-9][0-9]*:There is discussion under this item}
{view.php3?vid=123}
Returns content of view 123. View uses the
... Sometimes we need to include some file or output of some script into the
page. Now, there is {include(<file>)}, which will be replaced by the
file. The file is called through HTTP request. No matter if included file is html, shtml, php, ...:
the page was visited {include(cgi/counter.pl?id=222)}
(the result of http://www.example.com/cgi/counter.pl?id=222 will be printed)
APC news: {include(http://apc.org/apps/aa/view.php3?vid=112)}
(the remote view (from APC site) will be printed)
If you want to include other slices, it could be usefull to pass the URL
parameters to the included file. In this case use the special URL_PARAMETERS
constant:
{include(fulltext.shtml?URL_PARAMETERS)}
The limits:
... If you want to compute some walue from datadase field, use the {math..} alias. The syntax is ...:
{math(result_formatting) description1: expression 1: description2: expression2:...:description x : expression x }
where:
| result_formatting | has 3 parameters separated by '#' (number of decimals # decimals separator # thousands separator) |
| description | can be any text or html and is displayed before result of expression ("#:" mean ":") |
| expression | in expression can be used numbers (decimal separator is ".". Aliases can be used of course) and characters: + - / * ^ . ( ) |
<img src="red.gif" height=10 width="{math(0#,#) : {_#ANSVER1_} / ({_#ANSVER1_} + {_#ANSVER2_} + {_#ANSVER3_})* 100}%"> _#ANSVER1_ <br> <img src="blue.gif" height=10 width="{math(0#,#) : {_#ANSVER2_} / ({_#ANSVER1_} + {_#ANSVER2_} + {_#ANSVER3_})* 100}%"> _#ANSVER2_ <br> <img src="green.gif" height=10 width="{math(0#,#) : {_#ANSVER3_} / ({_#ANSVER1_} + {_#ANSVER2_} + {_#ANSVER3_})* 100}%"> _#ANSVER3_ <br>if _#ANSVER1 = 25, _#ANSVER2 = 50, _#ANSVER3 = 250 result will be:<img src="red.gif" height=10 width="8%"> 25 <br> <img src="blue.gif" height=10 width="15%"> 50 <br> <img src="green.gif" height=10 width="77%"> 250 <br>
{math(2#,# ) <br>mails=:{_#NOOFEMAI}*{_#EMAPRICE}:
<br>web=:{_#WWWPRICE}:
<br>technical support=:{_#NOOFHOUR}*{_#HOURPRIC}:
<br><hr>total={_#NOOFEMAI}*{_#EMAPRICE}+{_#WWWPRICE}+{_#NOOFHOUR}*{_#HOURPRIC}
}
result:
mails=450,00
web=1500,00
technical support=2400,00
----------------------------
total=4350,00
In AA v2.6 is new Reader Management, where you can control access to
directory or file through AA admin interface
(see Reader Management). You
can then display informations about logged user by {user:} construct.
The syntax is following:
| {user:} | displays login of current user
(this option do not search in database, so it is quick) You can use this parameter even if you do not use Reader Management slice and you are using standard Apache's password file auth ... |
| {user:password} | displays password of current user (in plain text)
(this option also do not looks into database, but into internal server variable, so it is also quick) |
| {user:headline........} | displays headline........ field for current user, which is grabbed from
Reader Management
slice. There is no need to specify in which Reader Management slice user
is, because all users are unique in all Reader Management slices.
If the Reader Management slice is protected by password (see 'Slice Admin' -> 'Slice' -> 'Password for Reading'), you have to add slice_pwd parameter to view.php3 (or slice.php3), in which you want to display user's database info. You can of course display any field from Reader Management slice. |
| {user:role} | displays user's permission role (author/editor/administrator/super/undefined)
(usefull in AA admin interface when you want to display another informations to authors and editors - use it in switch() - like {switch({user:role})editor:_#POSTED_BY} )
|
Such construct you can use in any view or slice - just like any other aliases.
... If you want to use page scroller (Page 1 | 2 | 3 | ... ) in view , which is part of 'site'! (see site module), the {scroller} syntax construct is the right tool. You just add {scorller} to the view, there you want to usepage scroller - probably in the 'Bottom HTML' fileld of the view:
{scroller:Page ::class="blue"}
The syntax for {scroller} is:
{scroller:begin:end:add:nopage}
where:
| begin | text to be shown before page numbers |
| end | text to be shown after page numbers |
| add | option to be added to page number <a href=".." class="blue10v">1</a> |
| nopage | text to be shown wnen there are (yet) no pages (so the scroller is not displayed) |
Then you use quite normal view include using {p} state variable, which stores the page number in the site module's spot:
{view.php3?vid=32&set[]=page-{p},listlen-10}
Because it is sometimes unclear which substitutions are available at a certain point, {debug} will output some hopefully useful information
The state of the item is controlled by the field status_code....., which is quite normal AA field.
You can define default value for any field in slice now
Go to: Admin - Fields - Edit (status code) - Default.
The states are:
So, change the default value for the status_code..... field to 2 and the items will be posted directly into holding bin.
It is possible to display this field in inputform (possibly as selectbox), so the editors could be able to decide, where the item should go).
There are two (and should be more in the future) odd slices in slice listbox. Why?Both - the 'Action Aplication Core' and 'News (EN) Template' are only visible to superadmins and both should not have any items.
News (EN) Template
The 'News (EN) Template' slice is just a template for creating new slices.
This template is shown as an option in "Admin" -> "Add Slice"
dialog in templates listbox. If you feel a setting for the new created slices
is not optimal you have two possibilities:
Action Aplication Core
'Action Aplication Core' slice is something another. In this slice there are defined
the default values for each field type. These values are used when you
add some new field to a slice on the "Admin" -> "Main settins - Field"
page. Fill the field name, priority and field type. After you have clicked on
update, the new field is added to the database for the slice and the values (like validate
function, alias, help text, ...) are copied from the same field in the 'Action
Aplication Core' slice. It is a good idea to translate the help texts in the
'Action Aplication Core' slice too when you are translating the whole ActionApps
to some other language.
(This is confusing, and hopefully will get changed in a later version)
To add a new field, give it a text in the left hand box. And select which field to use (don't use one that you are already using in the list above), this will setup default display and things like this.
Click update, then click Edit next to this new field (which should now appear somewhere in the list). You can change many of the details, and will almost certainly want to set "Help for this field" to something to appear in the Add_Item function, and the first field of Alias_1 to a string you will use when defining Index, Full-Text or Views. To use the Rich Text Editor choose the Field Type "Rich Edit Text Area". It is a powerful editor allowing to work WYSIWYG. Currently it is running on Windows only. For more details see the Wizard with help near the Field Type select box.
Jump is a simple module with simple behavior. It jumps inside the AA control panel onto a page to which you otherwise need to go over several links. For example if you often edit a particular constants group (e.g. "Country"), you must use "Slice Admin" / "Fields" / "Edit" / "Edit".
Better possibility: create a Jump module on the AA Admin page and give
admin/se_constant.php3?group_id=Country
as URL and a name you like. The module name will appear in the select box within
slices names.
The wizard is available to AA Administrators only. It enables to
The wizard is closely related to the File Manager, which contains additional features.
The user is created immediately after clicking on "Add Slice". The next page with slice settings shows whether there was some error or the user was successfully added. If you don't fill any user information, she/he is not added. You can return to the wizard page by Back and try it again.
Only after successfully filling all the slice information (the same process as with the usual Create New Slice) the views and constants are copied and (optionally) the new user is assigned privileges to the slice.
The Email Welcome select box is filled from the wizard_welcome table. You can use these aliases in the "email", "subject", "from" fields:
A copy of the welcome mail message is sent to the administrator's address (_#ME_MAIL_), so that she/he may see the process went on successfully.
Edit the welcome messages on the "Wizard Welcomes" AA admin page. An example is:
| description | Generic Item Manager Welcome |
Welcome, you have been assigned an _#ROLE____ for the slice _#SLICNAME.
Your username is _#LOGIN___. See http://apc-aa.sf.net/faq for help on AA. |
|
| subject | Welcome, AA _#ROLE____ |
| mail_from | "_#ME_NAME_" <_#ME_MAIL_> |
The new constant group names are found by trying to add "_1", "_2", "_3", ... at the end of the group name until a group with such name does not exist.
The code used by the Wizard is shared with the Add Slice, Add User and Pemissions/Assign scripts, so you can expect the same behavior and AA developers may easily maintain it..
In this example, we are trying to only show alias for page numbers (_#NM_PAGES) when it is greater than zero.
The field input has Validate: Number, so it generates a zero when left blank. To not show the alias and label when zero, use:
{switch({_#NM_PAGES})^0:: _#NM_PAGES pages }
This switch will show nothing when the number starts with 0, otherwise it will show e.g. "15 pages". Since number validation removes preceeding zeros e.g. 0020, this should always work.
It depends on Fields - Edit -> Insert' setting. If you set it to 'Text', then the value is stored exactly, how it is send by form checkbox (which means 'on' or nothing). However, default and suggested setting is 'Boolean', which means '0' or '1' is inserted.
External SQL query should look like:
SELECT * FROM item, content
WHERE item.id = content.item_id // to join the tables
AND item.id = 'hey67s[o0-78z._d' // 16 characters long packed id
// see util.php3 - q_pack_id()
AND content.field_id = 'headline........';
This SQL query select all fields from item table (where are stored just the most common item fields - id, short_id, slice_id, status_code, post_date, publish_date, expiry_date, highlight, posted_by, edited_by, last_edit, display_count, flags, disc_count, disc_app, externally_fed) plus the content of 'headline........' field from content table (will be in content.text field). You can change 'headline........' to any field id, of course, just like 'category.......1' or 'source.........1'. Also you can use short_ids as well to identify the item.
Data for an item is not stored in one table, as it is obvious and as you probably expect. Data are divided to two tables - item and content. Item table stores the common fields, which is requiered for each item. All other columns are sored in related table content (relation 1:N). The content table is quite easy - item_id, field_id, number, text, flag. Each row holds contents (in 'text' or 'number' filed) of one field (identified by field_id - like 'headline........') for one item (identified by 'item_id' - related to id in 'item' table).
Such, say 'virtual table database structure' or 'object oriented database' allows to store items of any number of fields. It also allows to store multiple values for one field (you just add a row with the same item_id and field_id).
More complicated SQL query, which contain more fields from content table could
look like:
SELECT item.*, c1.text, c2.text FROM item, content as c1, content as c2
WHERE item.id = c1.item_id // to join the tables
AND item.id = c2.item_id // to join the tables
AND item.short_id = '13432' // we can use short id
AND c1.field_id = 'headline........';
AND c2.field_id = 'full_text.......';
To select all extended fields for the item use:
SELECT * FROM content WHERE item_id = 'hey67s[o0-78z._d';
It is important to know how the data are stored in database, but if you want to write some feature to AA, it is strongly recomended not to use direct database access, but rather use three main data API function to access data (especially for storing data into AA database). The functions are independent on database structure behind and it takes care about feeding, clearing the cache and other stuff.
Main AA data API functions are:
function QueryIDs($fields, $slice_id, $conds, $sort="", $group_by="",
$type="ACTIVE", $slices="", $neverAllItems=0,
$restrict_ids=array() )
- stored in include/searchlib.php3
function GetItemContent($ids, $use_short_ids=false)
- stored in include/util.php3
function StoreItem( $id, $slice_id, $content4id, $fields, $insert,
$invalidatecache=true, $feed=true )
- stored in include/itemfunc.php3
By QueryIDs function you will get array of IDs of items based on your conditions, possiblly sorted. Input conditions are stored in array which you already know from design of searchform (conds[0][publish_date....]=...). This function allows you to get IDs based on any number of conditions. Also it is completely database independent, so you need not to know, which field is stored in item table and which is stored in content table.
The content of an item you will get by GetItemContent function. As input parameter use the IDs of the items you want to get (possibly obtained by QueryIDs). The items are then returned in array structure, which is good to know about, because all data manipulation functions in AA uses this structure to access the item data. This structure is also used as parameter to StoreItem function.
Abstract Data Structure for data manipulation in AA (returned by
GetItemContent function):
$content[<unpacked_item_id>][<field_id>)][<alternative>][value|flag]
define( "FLAG_HTML", 1 ); # content is in HTML
define( "FLAG_FEED", 2 ); # item is fed
define( "FLAG_FREEZE", 4 ); # content can't be changed
define( "FLAG_OFFLINE", 8 ); # off-line filled
define( "FLAG_UPDATE", 16 ); # content should be updated
# if source is changed
# (after feeding)
So, to access content of 'headline.........' field for item number
5e72be7289a0be63820a8723837ce21a you can type:
$text = $content['5e72be7289a0be63820a8723837ce21a']['headline........'][0]['value'];
The script fillform.php3 allows to easily refill condition variables as well.
If you have some search form using the conds[] array, you may call fillform.php3?fillConds= 1 to create JavaScript, which will automaticallyrefill the condition input fields. You may use it by SSI, e.g.
<!--#include
virtual="/aaa/fillform.php3?form=formname&fillConds=1"-->
Place it after the HTML code for the search form, otherwise it will only make a JavaScript error. Replace "formname " with the name of the form containing input fields.
The script can refill multiple select boxes like
<select name="conds[0][value][]" multiple>
as well. Don't forget the [] after [value].
Don't use quotes around field IDs, otherwise some values will not refill (e.g. checkbox <INPUT TYPE="checkbox" NAME="conds[1][highlighted.....]"> must not be 'highlighted.....').
There are special dateConds[] parameters which I use to refill AA-like dates (three selectboxes for day, month and year), but this is a bit difficult. If you are interested, write me and I will explain.
<input type=hidden name="slices[0]" value="517d65d9936c98a1537a5fecbddc7d42">
<!-- news -->
<input type=hidden name="slices[1]" value="849d65d9936c98a1537a5fecbddc7d52">
<!-- events -->
The comments <!-- news --> are useful because you perhaps
don't remember, which slice has which id (value="slice_id").
All other settings remain the same as in the usual searchform. The only difficulty is that sometimes the field ids do exist in some slice and do not exist in another one. Than you must rename the fields (menu Slice Admin --- Change field IDs).
To view the items found, you must set the same aliases (Searchform extensions etc.) in all the slices searched through. Each item will be shown using the aliases of the slice to which it belongs.
Tip: If you want to show checkboxes to choose in which slices to search, use something like
<input type=checkbox name="slices[0]" value="517d65d9936c98a1537a5fecbddc7d42"
checked> News
<input type=checkbox name="slices[1]" value="849d65d9936c98a1537a5fecbddc7d52"
checked> Events
The discussions are not stored in the same database tables as other item content. You may use the conds[discussion][] parameters, e.g.
<input type=hidden name="conds[0][discussion][subject]"
value="1">
<input type=hidden name="conds[0][discussion][body]" value="1">
Specify the discussion fields in which to search: you may use this fields ---
date, subject, author, e_mail, body, state, flag, url_address,
url_description, remote_addr, free1 or free2. The other fields (conds[0][operator],
conds[0][value] etc.) remain the same as usual.
To view the discussion items found include aa/discussion.php3 by SSI. You must pass a view ID of some discussion view to the script, e.g. when the view ID is 22:
<!--#include virtual="/aa/discussion.php3?vid=22"-->
The top HTML code, index view code and bottom HTML code are used to create a listing of the items found, nothing other.
To show hierarchical constants like in the AA control panel Edit item, use the aa/hiercons.php3 script. You must send the following to the script:
The SSI include for a hierarchical constant group "Keywords" may look like
<!--#include virtual="/aa/hiercons.php3?varname=conds[1][value]¶m=Keywords:3:60:5:0:1&lang_file=cz_news_lang.php3"-->
Warning: constants in the multiple select box must be selected, otherwise they are not send to the server. Do this by JavaScript.
One benefit: fillform.php3 knows how to refill multiple select boxes as well.
The keywords selected by the user will be joined by OR or AND, that means any keyword or all keywords must be present in an item. You must specify the operator by conds[1][valuejoin], e.g.
<input type=hidden name="conds[1][valuejoin]" value="OR">
Tip: If you want to show a select box to choose whether the keywords should be joined by OR or AND, use something like
<select name="conds[1][valuejoin]">
<option value="OR">Find items with ANY keyword
<option value="AND">Find items with ALL keywords
</select>
If you want the user chooses keywords from a multiple select box, use the similar settings as in hierarchical constants: set the name of the select box to [value][], e.g.
<select name="conds[1][value][]" multiple>
and add the [valuejoin] field (see above).
It is possible to create searchform manually in HTML. There is no possibility to create it automaticaly as it is known from AA v1.2., yet. Special possibilities for searching in multiple slice at once, searching in discussions, choosing keywords from hierarchical constants and using a multiple select box are described at other places in this FAQ.
Form example:
<form action="index.shtml" method="get" name="sf" id="sf">
Search Author: <input type="text" name="conds[0][created_by......]"><br>
Search in Headline and Fulltext: <input type="text" name="conds[1][value]">
<input type="hidden" name="conds[1][operator]" value="LIKE">
<input type="hidden" name="conds[1][headline........]" value="1">
<input type="hidden" name="conds[1][full_text.......]" value="1">
<br>
<input type="hidden" name="sort[0][headline........]" value="a">
<input type="submit" value="Search" >
</form>
Let's notice:
The action atribute on first row points to some file, where slice.php3
script is included (by SSI)
There are two visible search fields on the form --- each of them uses a bit different syntax - conds[0] uses the simplified and conds[1] the extended syntax.
<input type="text" name="conds[i][field_id]">
(see conds[0][created_by......] in the example). It is easy and good, if you want to
search only in one field for that specified phrase
The extended syntax sets an [operator], [value] and one or more [field_id]
for each condition. See conds[1] in the example.
Contains the search phrase (like conds[1][value]="Prague"). Usually this is the only visible text box (<input type="text" name="conds[1][value]">). The search phrase may be a boolean expression, but you don"t need to think about it if you are using the standard LIKE [operator].
The phrase may contain ANDs, ORs, parenthesis ({[]}) and NOT. When the user gives apple OR cherry, she will get all items containing any or both of the two in any of the fields specified by [field_id] (see further).
Spaces are considered as AND:
Prague Spring becomes Prague AND Spring
With the standard LIKE operator this works fine: it finds all items containing both Prague and Spring at any place (not necessarily Prague space Spring).
Hyphen is considered as AND NOT if not between two letters:
North-West remains as it is, but
North -West becomes North AND NOT West because of the space on the left of the hyphen
To avoid this behavior, use quotes or single quotes:
"Prague Spring" or "North -West"
If you don't specify it, the default operator is LIKE. You can change the default by using the defaultCondsOperator parameter (e.g. defaultCondsOperator=RLIKE). Other
posibilities are:
| Operator | Description |
| = | equals (or "e:=" with modifiers) |
| <> | not equals |
| < | less than |
| > | more than |
| <= | less or equals |
| >= | more or equals |
| BETWEEN | in interval: the [value] must contain two numerical values, comma separated |
| LIKE | substring search (SQL: LIKE "%phrase%") |
| RLIKE | substring which begins with phrase (SQL: LIKE "phrase%") |
| LLIKE | substring which ends with phrase (SQL: LIKE "%phrase") |
| XLIKE | string (SQL: LIKE "phrase") |
| ISNULL | not set (good for boolean values - like values from checkbox) |
| NOTNULL | is set (the field must be filled - no match for NULL or epmty string '') |
Date values are stored in the database as UNIX timestamps (no. of seconds since 1.1.1970). You can use modifiers to convert it from human format. The modificators are written before a comparison operator separated by colon (like "d:>="). The possibilities are:
| Operator modificator | Example | Description |
| d | d:>= | Used for english style datum transformation. If used, the "value" can be in format like "06/24/2001" or "10 September 2000" see strtotime PHP function definition |
| e | e:>= | Used for european style datum transformation. If used, the "value" can be in format like "24.12.2001" |
| m | m:>= | Used for comparison with current time. If used, the "value" is substracted from current time (time()) and result value is used in comparison. The value should be in seconds. This modifier is good for displaying items newer than two days, for example. |
Specify the fields to be searched through by their IDs.
<input type="hidden" name="sort[0][headline........]" value="a">
<input type="hidden" name="sort[1][full_text.......]" value="d">
The value is "a" for ascending and "d" for descending order.
The items are sorted first by sort[0], second by sort[1] etc.
If no sort[] variable is defined, items are sorted by Publish date -
descending.
It is possible to sort items not only by the value, but there is possibility to sort by 'priority' for the fields which uses 'constants' (Slice Admin -> Fields -Edit -> Constants) - like category field:
<input type="hidden" name="sort[0][category........]" value="1">
<input type="hidden" name="sort[1][unspecified.....]" value="9">
The value is "1" for ascending sorting by priority and "9" for descending order.
See another example on the APC Demo Site, where publish date field is used.
There are CSS files in the root directory that you can modify or create a new CSS file and point to it from include/config.php3 (line 139). Using this method, you can, in the "add item" form, use an image from an existing URL or upload an image to use it.
1) Go to /apc-aa/misc/forgotten_pwd.php3 (may vary
depending
where AA is installed)
2) Enter either the username or email address
3) Check the email you will receive in case the user has been found and it's you
4) Visit the url in the email - in fact it's the same but with the temporary key that will let you change the password
5) Change your password
Note: The key expires after 90 minutes
Expired items are normaly not visible on the public website. However is it usefull to sometimes show expired items such as for archives.
There are two easy steps to show expired items in a view:
Example of condition fields in a view design:
set Condition 1 'expirary date' < 9999999999999
(this
is a unix date in far far far future - you'll be dead :^)
Example of view.php3 parameter:
.../view.php3?vid=23&cmd[23]=d-expiry_date.....-e:>-1.1.1998
If you realy think you need a logout, you have to create a
special directory
and Logout page under the restricted area of your
website. I've set up a little
example here http://marek.greennet.org.uk/protect/
type
jason:jason and you get in. Than you can click on logout ant it will
take you to the logout page. The trick is that the page is under the same
realm,
so in fact you relogin as user "logout" with
password "logout"
http://logout:logout@marek.greennet.org.uk/protect/logout/logout.html
http://logout:logout@marek.greennet.org.uk/protect/logout/logout.html">http://logout:logout@marek.greennet.org.uk/protect/logout/logout.html>The .htaccess file for the /protect/logout area looks like this
AuthType Basic
AuthName "Authenticate yourself"
AuthUserFile /home/httpd/htdocs/marek.gn.apc.org/protect/logout/.htpw
Require user logout
The
/home/httpd/htdocs/marek.gn.apc.org/protect/logout/.htpw contains only
user logout (the file was created using htpasswd), and only this user is
allowed
here.
Htaccess is updated by AuthMySQL module on the Apache server. The access is granted directly from AA (from auth_group and auth_user tables)
You need to:
1) Install mod_auth_mysql (
http://modauthmysql.sourceforge.net/)(This module is standard part of RedHat Linux distribution (rpm mod_auth_mysql). Be carefull, because there are at least two different modules with the same name but with different httpd.conf options and features. We need the described one and not the one described by Ram:
http://actionapps.org/faq/detail.shtml?x=1673 !!!)2) Then you need set auth_group...... field in Reader managment slice as described here:
http://actionapps.org/apc-aa/doc/reader.html#d0e2363) Set the apache to accept MySQL authentication - something like modifying httpd.conf file:
<Directory /data/www/htdocs/actionapps.org>
AllowOverride AuthConfig FileInfo Options Limit
# Authentication
AuthMySQLHost localhost
AuthMySQLUser aa_db_user
AuthMySQLPassword aa_db_password
AuthMySQLDB aa_db
AuthMySQLUserTable auth_user
AuthMySQLGroupTable auth_group
AuthMySQLNameField username
AuthMySQLPasswordField passwd
AuthMySQLGroupField groups
AuthMySQLNoPasswd off
AuthMySQLCryptedPasswords On
</Directory>
4) Protect the directory by .htaccess file or by similar lines in httpd.conf file:
AuthType Basic
AuthName "ActionApps Ariel Members Area"
<Limit GET>
require group ariel_members
</Limit>
or
AuthType Basic
AuthName "ActionApps Ariel Parnters Area"
<Limit GET>
require group ariel_partners
</Limit>
5) Done.
There is script /misc/oldDb2Db/move.php3. Script move.php3 is database trnansformation script, which copies whole slice from ActionApps v1.2- to the new database structure, which is used for ActionApps v1.5+.
What is Done:
Limitations:
After import you have to change the include lines in the pages in order the
new slice is called - for example change old line in *.shtml file:
<!--#include virtual="/aa12/slice.php3?slice_id=4e6577735f454e5f746d706c2e2e2e2e"-->
to point to new AAv2.0 installation directory:
<!--#include virtual="/aa20/slice.php3?slice_id=4e6577735f454e5f746d706c2e2e2e2e"-->
The slice id is the same. After that, you shoud review all public pages to make you sure, it works as expected. I do not expect many problems. All features of AAv1.2- as possible to implement in AAv2.0. The biggest problem should be the search form, but it is quite easy to create it manually.
THIS ITEM IS COMPLETELY DEPRECATED. A COMPLETELY NEW ALERTS DESIGN IS DESCRIBED IN THE NEW DOCUMENTATION. ALSO SEE READER MANAGEMENT DOCUMENTION AND DEMOS FOR USEFUL ALERTS DEMOS AND TUTORIALSRelated FAQ items:
AA Alerts are designed to deliver new AA items to users by e-mail. Slice Administrators choose the design and which kind of items from which slices to include, creating Collections. Users subscribe for Collections and receive them optionally once a day, week or month.
A user interface allows users to change their subscriptions. Users are identified by e-mail and they must confirm their e-mail address by a confirmation code received by e-mail to make sure the address is working.
The admin interface allows AA admins to define new Collections, list users subscribed to Collections and list Collections subscribed by users.
Collections are created by Slice Administrators on the page Slice Admin / Alerts / Collections. They are based on Filters, which are defined in the Digest type of Views.
A Collection is an ordered list of Filters. Each Filter is associated with one Digest and filters items to be sent by using the search form conds[] and sort[]. Digests are views suiting Alerts needs (see below).
You may define Editorial for each Collection, which will be printed before Digests' texts. In the Editorial you can use these aliases:
_#CONTENTS - will be replaced by a list of collection filters
Note: You create filters by typing their DESCRIPTION. You must type at least one description before you can create Collections.
Each view of type Alerts Digest has a set of Filters definitions. Create filters by typing their description. If you want to include all items in the filter, don't fill anything into the "conds[]" field. Otherwise you may fill any conds[] and sort[] definition in the URL shape, e.g.
conds[0][headline........]="human rights"&conds[1][fulltext........]=Bosna
is a filter sorting out items with "human rights" in headline and "Bosna" in fulltext. If you want to order the filtered items, use sort[] (see How to setup searchform in FAQ for details on conds[] and sort[]).
If you want to add more than 2 filters, use Update and than open the view definition again. Two new empty filter boxes will appear.
To send the alerts, you must have AA cron set on. Three entries are added to table cron by sql_update.php3, for daily, weekly and monthly sending. You can change the entries if you like. They define the time and date at which all mails are sent. You can't set individual sending times for collections.
E-mails are created so that in e-mail clients supporting HTML users see the HTML form and in clients supporting text only, users see text. The text form is created by deleting all HTML tags. Technically speaking, it is a MIME multi-part/alternative message with a text part and a HTML part.
E-mail headers From:, Reply-To:, Errors-To: and Sender: are configurable for each Collection. Also, you may set these fields for a fictive collection __default__, which is used whenever any of them is not filled for the active Collection. Another fictive collection __subscription__ sets e-mail headers which appear in e-mails sent on user subscription.
The login screen is shown by misc/alerts/index.php3, the main
interface is in misc/alerts/user_filter.php3. It allows to input
name and change password. In the other part there is a list of all subscribed
collections. A user may change contents of any of the collections. Until she
does so, the collection ID remains the same as in the Admin interface. This
allows to propagate changes to users: If you do any change in the Admin interface,
it will change to all users which didn't modify the collection. But when a user
changes a collection, its contents is copied not to modify the common Collection
storage. From the user point of view, she doesn't recognize it.
Two scripts are here to simplify subscription forms creation. The first one is add_user_collection.php3, which uses the following required parameters:
and the following optional parameters
The standard error page shows an error description. The standard OK page shows information about where to change subscriptions or that the user should confirm her email address if she didn't yet.
The second script print_collections_select.php3 prints a select box to choose a collection by description. It is not necessary to use it, the script only simplifies the maintainance because it gets the collection descriptions from database. It has these optional parameters:
c[]=17&c[]=25A simple subscription form may be:
<form name='f' method='post' action='http://www.ecn.cz/apc-aa/misc/alerts/add_user_collection.php3'>
<table>
<tr><td>E-mail:</td><td><input type=text name=email
size=50></td></tr>
<tr><td>How often:</td><td><select name=howoften>
<option value=daily>Daily
<option value=weekly>Weekly
<option value=monthly>Monthly
</select></td></tr>
<tr><td>Choose a collection:</td>
<td><!--#include virtual="/apc-aa/misc/alerts/print_collections_select.php3?c[]=7&c[]=11"--></td></tr>
</table>
<input type=submit value="Subscribe">
</form>
But mind the example address www.ecn.cz/aaa is not working, it is only an example.
You do not need to send e-mails manually, this part is useful for developers.
AA cron runs alerts.php3 with two parameters:
For example
alerts.php3?howoften=weekly
It will work on all items which appeared in Active bin from the last time this script was run. That includes items which were Pending and became Active (even if they are Expired at the moment of sending e-mail), items which were moved from Holding bin and new items added directly to Active bin. Look in the source alerts.php3 for the exact algorithm of selecting items (it's not as easy as described here).
The script itself does not check how often you run it, hence a user can receive a monthly digest every day if you are not careful.
You can use cron.php3 to run the script regularly.
Superadmins may as usually access everything.
Slice Admins may access:
All tables concerned with Alerts have a name starting with alerts_.
User information is stored in alerts_user, collections description in alerts_collection. Filters belonging to collections are in alerts_collection_filter.
Filters are in alerts_digest_filter which is linked 1:n to table view (1 view has n filters). The fields last_xx in alerts_digest_filter include last time when the digest of items filtered by the particular filter was created and text_xx temporarily store the digest text.
Users subscriptions are in alerts_user_filter, each line of which has either a filterid or a collecetionid filled. It allows the users to choose simple filters instead of whole collections but this is not implemented.
THIS ITEM IS COMPLETELY DEPRECATED. A COMPLETELY NEW ALERTS DESIGN IS DESCRIBED IN THE NEW DOCUMENTATION. ALSO SEE READER MANAGEMENT DOCUMENTION AND DEMOS FOR USEFUL ALERTS DEMOS AND TUTORIALSThis walkthrough does not describe all details, you must look into the FAQ item AA Alerts for them.
To set up Alerts on your computer, first ask some Superadmin to set up default Collections and cron:
__default__
and __subscription__. If you don't have them, something was wrong
with sql_update.php3. You should create them in Admin panel,
but you must change the "showme" field value to 0 in the database.misc/alerts/alerts.php3,
sending the daily, weekly and monthly digest. These are created by sql_update.php3.
Now any Slice Admin may work with Alerts:
conds[] and sort[]Hurrah, we have a new collection!
Now how to offer it to users? On any of your web pages, create a subscription form. See AA Alerts for details. If you want to see a list of users subscribed to your collection, click on Edit in Alerts / Collections.
THIS ITEM IS COMPLETELY DEPRECATED. A COMPLETELY NEW ALERTS DESIGN IS DESCRIBED IN THE NEW DOCUMENTATION ALSO SEE READER MANAGEMENT DOCUMENTION AND DEMOS FOR USEFUL ALERTS DEMOS AND TUTORIALS.
misc/alerts/admin_mails.php3. This row is added automatically by the sql_update.php3 script.
Error returns in AA are not consistent, there is a general, low priority, task to clean up the code as we work on it.
In general use the $err array to return errors.
Some specific examples follow, please add others here.
Each of the functions: insert_fnc_xxx sets for example
$err[image.....1] => "Wrong type of file"
This example uses 1 view, 3 categories, and 2 levels of constants. The catgories are not important but maybe you like to use them so I left them in there.
The view below manages a two level side bar menu. It highlights the branch you are in and the (sub)item you have selected. Example can be seen here http://pi.gn.apc.org
The constants are used as the menu entries. You have to use hierarchical constants and define the constants like this:
Level 0: Name Value
Terrorism Terrorism
Policy Policy ...
Level 1: Name Value
Politics of Terrorism Terrorism::Politics of Terrorism Defining
Terrorism and Emergencies Terrorism::Terrorism and Emergencies
IGOs and Laundering Policy Policy::IGOs and Laundering Policy
...
Now create a new constants view Paste the text below into Odd Rows. Set the Group by to "Value Select" the hierarchical constant group created above View 342 is the listing view I use to display items from my slice.
The slice has 3 categories. This menu only manages the selection of the first category (category........) which is set to use the constant group created above. Further it's first confition is set to LIKE (name of category........). You will have to replace 342 in the text below with your listing view. You can leave away most of the {country}-stuff. To work this just needs {theme} and {_parent_}.
TODO: use better names for the aliases. 'theme' and 'country' might be substrings in the constants. That would cause havoc! All left to do now is to create your style sheet. Have fun!
----------SNIP SNIP----------
{switch({_#LEVEL##_})0:<br>
{switch({theme}).*theme.*:
<div class="constView_ContentThemes_ListEntry">
:{_#NAME###_}.*:
<div class="constView_ContentThemes_ListEntry_Hl">
:<div class="constView_ContentThemes_ListEntry{switch({_parent_}){_#NAME###_}.*:_Hl}">
}
<a href="/index.shtml?cmd[342][]=c-1-{_#NAME###_}&als[theme]={_#NAME###_}&conds[1][category........]={_#NAME###_}{switch({_#VALUE##_}){theme}.*:&als[_parent_]={theme}}{switch({country}).*country.*::&cmd[342][]=c-3-{country}&als[country]={country}&conds[3][category.......2]={country}}" class="constView_ContentThemes_ListEntry_link">_#NAME###_</a>
</div>
:1:<!--{theme}--_#VALUE##_--_#NAME###_-->
{switch({_parent_}).*_parent_.*:
{switch({theme}).*theme.*::
{switch({_#VALUE##_}){theme}.*:<div class="constView_ContentThemes_SubListEntry{switch({theme}){_#NAME###_}.*:_Hl}"><a href="/index.shtml?cmd[342][]=c-1-{_#NAME###_}&als[theme]={_#NAME###_}&conds[1][category........]={_#NAME###_}&als[_parent_]={theme}{switch({country}).*country.*::&cmd[342][]=c-3-{country}&als[country]={country}&conds[3][category.......2]={country}}" class="constView_ContentThemes_SubListEntry_link">{_#NAME###_}</a></div>}
}
:{switch({theme}).*theme.*::
{switch({_#VALUE##_}){_parent_}.*:<div class="constView_ContentThemes_SubListEntry{switch({theme}){_#NAME###_}.*:_Hl}"><a href="/index.shtml?cmd[342][]=c-1-{_#NAME###_}&als[theme]={_#NAME###_}&conds[1][category........]={_#NAME###_}&als[_parent_]={_parent_}{switch({country}).*country.*::&cmd[342][]=c-3-{country}&als[country]={country}&conds[3][category.......2]={country}}" class="constView_ContentThemes_SubListEntry_link">{_#NAME###_}</a></div>}
}
}
}
----------SNIP SNIP----------
If you get the error: "No slice found for you" after logging into AA after doing a CVS update, then you may have forgotten to fill in the AA_ID in the config.php3 file
If you were a loser (like I have been) and did back-up your AA_ID, it can be retrieved from the AA database...
Using phpMyAdmin or your excellent MySQL skills:
Look for entries in "perms" table that have aa in "object_type" column, "objectid" is your installation ID.
Some fields have a predefined set of possible values --- a constant group. These are usually shown in a select box, multiple check / radio boxes etc. Edit them in Slice Admin -- Fields -- Constants -- Edit / New.
Categories are constants with some special properties. The constant table structure is:
CREATE TABLE constant (
id char(16) NOT NULL,
group_id char(16) NOT NULL,
name char(150) NOT NULL,
value char(150) NOT NULL,
class char(16),
pri smallint(5) DEFAULT '100' NOT NULL,
PRIMARY KEY (id),
KEY group_id (group_id)
);
For example the "State" select box (if you want to see it on input form) has the names and values of:
| Name | Value |
| Approved bin | 1 |
| Holding bin | 2 |
| Trash bin | 3 |
Another example, more real-life - colors select box. There can be names of "Red", "blue", "very bright green", ... and values will be "#FF0000", "#0000FF", "#EEFFEE". In input form you see Red... and on page is then #FF0000
The third example is kind of hint. Suppose you want to have different kinds of item - for example "public", "private", "other" and you want to see this words on compact view. No problem, but you want to see each in different color. So you can define:
name: PrivateYou can set the priority order in the constant editing page, and then if you want the output in this order as well, then in the View set the sorting to be "Ascending (or Descending) by Priority"
Usually if you change a constant value, the current items in the database remain the same. By checking this box you force the changes to be made on the items too. If you change "red" to "cyan", all items with color "red" will be changed to "cyan".
Remember that the constants may be shared by several slices --- if you change a value, the changes may be propagated to some places which you didn't count with. Another danger is that if there were some items with "cyan" before, you can never ever find which item are converted from "red" and which are not.
Changing the constant name doesn't have any effect in the database but changes the look in all Edit / New item pages using the constant group.
| _#NAME###_ | const_name | Constant name |
| _#VALUE##_ | const_value | Constant value |
| _#PRIORITY | const_pri | Constant priority |
| _#GROUP##_ | const_group | Constant group id |
| _#CLASS##_ | const_class | Category class (for categories only) |
| _#COUNTER_ | Constant number | |
| _#CONST_ID | const_id | Constant unique id (32-haxadecimal characters) |
| _#SHORT_ID | const_short_id | Constant unique short id (autoincremented from '1' for each constant in the system) |
| _#DESCRIPT | const_description | Constant description |
| _#LEVEL##_ | const_level | Constant level (used for hierachical constants). If you want to display hierarchical constants in its hierarchy (so constant on second level have two spaces before the name), you can use following AA expression:{switch({_#LEVEL##_})1: :2: :3: } |
The APC AA has a Two Layer category system:
1) One set of broad categories set at the network level
These are useful so that people can 'browse' and find the information they
are looking for without a specialized understanding of the content area.
2) Totally flexible page-specific categories
Individual page owners can setup any specialized categories that work for them. They 'map' their specialized categories to the APC-wide parent categories.
We also want to be able to map between different languages, so
categories can be displayed in the local language, but stored as a
universal constant.
This requires relating items in the first slice to the second, and using a related view.
What are hierarchical constants? Imagine some keywords allowing to quickly find items of interest --- you have a top-level keyword Country, a first-level keyword United Kingdom and a second-level keyword Leeds. The support has three parts: Editing of the constants and choosing them in the Add / Edit item in AA control panel is described here, using them in a search form is described elsewhere.
The new hierarchical editor is accessible from the standard constant editor by the button "Edit in Hierarchical editor".
The standard and the hierarchical editor are in some sense interchangeable --- you can edit constants in both and it will not damage the structure.
The hierachical editor shows several level boxes. When you choose an item in some level, the next level box will be updated. Because usually the constant Name and Value are the same, there is a check box "Copy value from name" which allows you to only edit the Name box. You can change the editor view by the options at the bottom of the page:
Changes to the view setting will take effect only after using "Save all changes to database".
To take advantage of the constants ordered into a hierarchy, use the "Hierachical constants" input type for a field containing the constants. This view allows the user to go through the constants by level boxes in the same way as in the hierarchical constant editor. The values chosen are filled into a multiple-select-box field.
Check the "wizard with help" about parameters.
There are several places where APC-AA sends mail, and it can be confusing, especially since it is really easy to configure them wrongly so they don't work, and little help for figuring out why. Lets consider 4 cases. The Bugs and Weaknesses of each method are shown because they may help pick which method to use, and also help guide as to places for further development.
Use the Email Notification functionality, here you can specify different messages to be sent when messages are added / edited to Active / Hold bins, and different recipient lists, so for example you can create a message to an Editor whenever a new message arrives in a Hold bin, and maybe a different message to the sysadmin when an item is moved into the Active bin (usually by the Editor). The message could be just something like "An item has been posted in Xyz slice" or by using aliases can include any fields of the item posted.
Bug/Weakness: You can't use aliases in Subject line, this might be fixed in
some version (but is unlikely to be a priority!)
Limitation: The members of the list can only be changed by a slice admin, so
don't use this for Alerts ...
Use a reader management slice (see doc/reader.html) in conjunction with Alerts (doc/alerts.html).
Bug/Weakness: its complex to setup, and frequently people don't succeed, if you don't follow the Tutorial Step by Step (in doc/alerts.html) you probably won't get it to work.
Bug/Weakness: In particular it requires creating an anonymous form, which depends very much on the way its being used (e.g. called from something.shtml or site.php3). One possible development fix would be creating a PHP3 script that took the slice-id of an Alerts module as a parameter and did this much more simply.
Bug/Weakness: documentation says 5.3a: View with type "Alerts Digest", when it means "Alerts Selection Set".
Use a Reader Management Slice (see doc/reader.html) in conjunction with Mailman, APC-AA is used to manage the mailman list
Bug/Weakness: you can no longer manage the lists (subscribe/unsubscribe) by email to the Mailman account once you've done this, mailman will almost certainly be sending out email telling the users they can!
Bug/Weakness: You have to understand both apc-aa AND mailman to get this to work since doc/reader.html refers to tasks that require knowing where to find and how to configure mailman.
Bug/Weakness: There is no link between information in a slice, or discussions, and the email discussion, i.e. this is not - like yahoo groups - a web OR mail interface to the same set of data.
Reports of failure (Jason Diceman) partly due to server setup
See "FAQ/Discussions as Mail List", this allows a field in each item to specify a mailing list.
Bug/Weakness: This field has to be added to every item, it can't be specified at the slice level (make the field Required but not Shown and set a default). This is particularly difficult if you want to retrofit discussions to an existing slice, or something coming in over RSS.
Bug/Weakness: This can only go to a single email address, so you have to manage the list somewhere else outside APC-AA (there is no way to for example link it to Alerts).
Bug/Weakness: It doesn't appear to work, sends blank emails.
| |
Template for Email | Who gets the email | How sent | Bugs, Limitation and further development |
| Notification | Admin -> Slice -> Email Notification | Directly from script updating |
Can't use aliases in Subject line |
|
| Alerts | Admin -> Slice -> Views -> Alerts View | Readers from Reader slice, who can choose which to recieve | By Cron | Complex to setup (anon forms) |
| Email Discussion | Not applicable - its email to email | Members managed by Reader Management slice | Mailman handles all sending |
Requires understanding mailman to setup, reports of failure partly due to server setup |
| Discussion -> Email | Admin -> Slice -> Views -> Discussion to Email | One hard-coded email address | Not sure, probably cron. | Doesn't integrate with Alerts so no recipient management at all Doesn't seem to work (Mitra). Has to be added to each item in slice. |
There is no integration for receiving email, although there has been discussion (where?) about posting articles by mail
In view you can specify "No item found" message, which is displayed if view (due to its current conditions) do not find an item to display.You can enter there:One recomendation is to write something that relates to the slice content, e.g. "No news found" or "No events found", with in visible HTML or a comment tag. This helps with both usability and view development problem solving.
The hit is counted in this cases:
1) with slice.php3
- if you will display an item with x=24425
url parameter
- if you will display an item with
sh_itm=42567a8736342562782abe782c
- if you will use banner url
parameter (banner=2-38)
2) with view.php3
- if you display an item with
cmd[22]=x-22-24425
Note 1: if you use more than one
item with x
command
(like cmd[23]=x-22-24425-24461-23612) only
first
item is counted)
Note 2: if you want to display an
item and do not want to
count
hit for such item, use 'o'
command
(like cmd[23]=o-22-24425), which works exactly in the
same
way as 'x', but it do not count hits.
- if you use random
parameter (ie. set[23]=random-1)
For speedup of database operations we use log table for hits count,
from
which it is time to time copied to item table. You can configure
this
behavior in include/constants.php3:
// CountHit probability - how offen write logged hits to item table
define
("COUNTHIT_PROBABILITY", 50);
This means that after 50 hits (approximately) (in whole AA) the hits
are
written to item table (= displayed to users).
For more info see CountHit() function in include/util.php3
No, it is not possible - at least yet.
There is a problem with characters encoding and different languages. Each language uses its own character encoding (like iso-8859-1 for English and Spanish, iso-8859-2 or windows-1250 for Czech, ...). If you select language for the slice, you also select (implicitly) the character encoding. If we allow users to use different language in the same slice, each item will be in different encoding, ... which means problems.
This a tutorial for creating a simple alert module and subscription form, similar to the Sandbox subscription demo at http://actionapps.org/reader_mngmt/sandbox_subscribe.shtml. The alert is for all new items in a slice and the subscription require s only email address and sending frequency inputs, no password or selection of slices in this version. Subscribers can update their alert settings (e.g. change email address, modify frequency, and unsubscribe) by clicking on a unique link at the bottom of each alert they recieve.
The tutorial assumes you are already comfrotable creating and administrating
slices and designing views in ActionApps.
First you must have a Reader Management slice to store subscriber information. If you already hace a Reader slice, then you can skip this step, but keep in mind the Reader slice used in this example is called "My Readers".
You now have a Readers slice called "My Readers" that will store each alert subscriber as one item. It also possible to add more fields to store additional data about your subscribers, but that's another tutorial (coming soon).
Next we need to select what items subscribers can be alerted to.
An alert modules requires selections from slices. A selection is a condition on an alerts view of a slice. It's a bit confusing but will make more sense once we go through the complete alert module production process.
In this case, we have selected to alert users about new items from the important slice called “My Slice”.
In My Slice, create a new view, type “Alerts Selection Set”. Set field vaules as:
Alerts Selection Set: “My Slice alert views”
Group by selections (ignore for now)
Alerts Selection 1 Description: “All My Slice Items”
conds[] (ignore for now)
Alerts Selection 2 Description and conds[] (ignore for now)
Fulltext URL: (URL of fulltext view use for _#HDLN_URL)
Fill the rest of the fields as a simple listing view, probably similar to your index view.
Click Update
You now have an alerts selection called “All My Slice Items”.
Once you are more comfortable with alerts, you can add more selections that
use conds[] to allow users to filter in only certain types of items, but that's
another tutorial (coming soon).
Next step is to create an alerts module that will send your newly created alert selection.
Your alert module now contains alert selection "All My Slice Items" and My Readers slice contains two new input fields: “How Often” and “Selections”. You can goto the My Readers fields admin page to see these new fields. If they don't show up, go back to alert module > Reader Management and click on ‘Add or refresh fields’.
More selections can be added later. Everytime you add a section you will need to go back to your alert module > Reader management and click on ‘Add or refresh fields’.
You can now test your alert module by subcribing yourself using: My Readers > Add New Item: input your email address, check "email confirmed", set "How Often" to "instant" and check "Selections: All My Slice Items"
Then go to My Slice and add a new item. You should shortly there after receive an emal from the alert module announcing the new addition. You will notice the alert module messages use ECN related text by default. You can customize your welcome and alert messages at any time (see Step 5). But first let's set-up some public subscription forms...
To allow users to subscribe to your alerts, you will need to create a form using ‘Anonymous Form Wizard’. You should also have an OK page that tells users to check their inbox for an email confirmation and a another page with an anonymous form for updating subscription settings. Thus you will need to create three files, e.g.:
http://mysite.com/myalerts/subscribe.shtml - Invitation to subscribe using anonymous form.
http://mysite.com/myalerts/subscribe_ok.shtml - A notice telling users to "Check your inbox for an email confirmation".
http://mysite.com/myalerts/update.shtml - A subscrition settings
update page using anonymous form, accessed only from a link within alert messages
generated using _#COLLFORM alias (set in Alerts Admin - Settings: form URL.
To create the required anonymous form for the subscribe.shtml and update.shtml pages...
You should now have a page for users to subscribe to the alert (e.g. origianl sandbox alert subscribe form) that when submitted correctly leads to the OK page saying "Check your inbox for an email confirmation". In the confirmation/welcome email there should be link with unique ID pointing to the the update.shtml URL. When visited, this page will confirm the email address and allow thye user to modify their subscription settings, inluding change their setting to "not subscribed".
You should test this subscritpion process, including updating subscription settings. Add some new items to My Slice and check that subscribers receive them as expeceted.
You may also want to simplify the anonymous form by hiding the selection check box and possibly the "how often" select box. To hide the selection checkbox, just change the input type from "checkbox" to "hidden", and remove the surrounding text. To hide the "how often" select box you need to create a hidden input with the name and one value pulled from the "how often" select box. The final cleaned up form could look like the sandbox alert subscribe form.
You may also want to similarily modify the update, see sandbox alert update form.
If you haven't already, you will want to customize the alert welcome message (sent once upon subscription for email confirmation) and the alert message template.
Like any important text, you should probably use a word processor to write and check spelling of the message to sent. You can use HTML or plain text. You will want to include:
To update the test, go to you Alert Module > Settings and click edit icon beside welcome email select box. Both the subject and body processes aliases and {} commands.
The alert message template is edited the same as Welcome Message, except that _#FILTERS_ will be replace by the views of the new selections. You will want to include:
The views of selections can accessed through My Alerts Module > Selections > click on selection name. It is probably best to put the introduction to each slice's items within the top HTML for each slices Alerts Selection Set view. This is more important when there are multiple selection options within an alert module.
Change the design of the Item
Manager in Slice Admin to show the alias _#MAILCONF. This alias shows “yes” or “no”.
But it is created by the f_c function and the values in the database are 0
or 1. Thus give “0” and not “no” into the Search box.
Filtering readers receiving a selection: Add the Alerts Selections to Item
Manager. Create an alias using the function f_h with the parameter , (comma).
You will see the selection IDs prefixed by f. Now you understand why you should
enter something like “f45” into the Search box.
To customize result messages, (i.e.. confirmation, error or update messages
at the top right of anonymous forms) use show_results.php3: Copy the script
from doc/script/show_result.php3 to the
same location where
you
created
myalerts.shtml.
When creating anon form: Fill the URL of yours show_result.php3 and check the
box “Use a PHP script ...”
This can be done thanks to function f_y - expanded string.
See an example.
see http://mimo.gn.apc.org/mlx for instructions The script /misc/file2slice/importer.php3 contains a function importer, which can import a CSV (comma-separated-values) file into your slice.
AUTHOR,TEXT,EMAIL,LANGUAGE,CATEGORY
Johny Bravo, he is a real good guy, johny@bravo.uk, fr, VIP+fools
France Newman, a noname boy, france.newman@noname.org, en, nonames+fools
$actions = array(
"created_by......" => array("action" => "store", "from" => "AUTHOR"),
"category.......1" => array("action" => "storeparsemulti", "delimiter" => "+", "from" => "CATEGORY"),
"language.......1" => array("action" => "storetrans", "from" => "LANGUAGE", "flag" => 1, "trans"=>array("en"=>"english","fr"=>"french"))
);
"flag" => 1 means HTML content) with any action."from" => array ("Name","Middle Name","Surname")"from" => array ("Name","Middle Name","Surname")"delimiter" => ", ""from" => array ("Bool1" => "Bold", "Bool2" => "Italic", "Bool3" => "Underline")
<?php
$actions = array(
"category.......1" => array("action" => "storeparsemulti", "delimiter" => ";", "from" => "Category"),
"headline........" => array("action" => "store", "from" => "Title"),
"created_by......" => array("action" => "store", "from" => "Author"),
"full_text......." => array("action" => "store", "from" => "Summary", "flag"=>1)
);
require "./importer.php3";
Importer ( "aa65a21b285c25f9fe0d4b662919b4b2", // slice iD
"./books.txt", // file name
"t", // field separator
$actions,
"uid=ada01,ou=People,ou=AA", // posted by (there should be a number for sql permissions)
true, // write to DB?
600); // time limit in seconds
?>
There are a number of tools for importing, each has different advantages and disadvantages and each needs configuring to specific requirements.The Item Listing View (View.php3) and Design-Index (slice.php3) provide overlapping features. Which to use will depend on which features you need. Here are some of the differences.
| Available features | View | Index |
| Search conditions from URL | Yes | Yes |
| Search Form | No | <#215>Yes |
| ?x=1699 | No (workaround) | Yes |
| Scroller | No | Yes |
| Slice id | Implicit, can be overridden by parameter | Parameter in include or URL |
| Copy with Template | Yes with new wizard, but may need to edit HTML because numbers change | Yes |
| Sorting | From Admin only | From URL parameters only |
Views are useful when you want functionality a little bit different from the standard Index, or Full-Text views. You can use them to customize sorting, or pick certain items or only a subset of the items.
Highlight is normal field, so You are able to display the icon or a text for highlighted items (on Item Manager or on website).You have to be the slice administrator, then from the standard admin page select Admin -> Views, then you select "Item Listing" and click New.
The first few items are the same as for creating Index views (see the manual). You can then specify how to sort items, and specify a condition (that can take a parameter in the URL).
<!--#include virtual="/aa/view.php3?vid=5"-->
Will embed view number 5 into your page. The view knows which slice it applies to, so this can be embedded in an Index or Full Text View.
View.php3 will take parameters either in the "include" line, or in the URL of the page to which it refers.
You can sort items by specifying in the definition of the view (Admin->Views then select an existing View or click New) which fields to sort by, and wether to sort ascending or descending. The primary sort is the main ordering, and the secondary sorts within this. So for example you might specify Category as the primary sort, and sub-category as the secondary. Note that if you sort on a field then there is a bug (or feature) where items without that field defined will not show up in the index view.
Because views do not currently use sessions. There is no way, how to add 'Previous 1 2 .. Next' scroller to the 'view'.
This is the biggest limitation of 'Views' and we have
to count with it.
To select just a sub-set of the items, specify a Condition, or set of conditions, you can then parameterise that in the include statement or URL. So for example, if you set Condition 1 to "Category" and "LIKE" then you can specify a parameter of "cmd[5]=c-1-News" to set the first condition on View 5 to "News" so that it would list any item with a category containing the string "News". This condition could be set in either the Include statement or the URL e.g.
<!--#include virtual="/aa/view.php3?vid=5&cmd[5]=c-1-News"-->
or in the URL.
?cmd[5]=c-1-News&.....
If there are special characters in the search term, i.e. dashes (as in E-mail) or spaces then quote it, and escape the quotes, for example to select a category=Social Ecology would require a URL of the form:
conds[0][category........]=%22Social%20Ecology%22
(%22 is a double quote (") and %20 is space). If you are constructing this URL from somewhere else and do not know what could be in the field then make sure to quote and urlencode the string.
If you want to put highlighted items on a page, you should create a view. In the view, one of the conditions is that highlight is not '' (note there is a bug so that once you've set the condition to '' if you try and edit this view, you will need to reset the condition to '' before you hit update or you will get a SQL syntax errorCreate a Full-Text view by going to Admin->Views and selecting "Full Text" and clicking "New". Then you can specify cmd[5]=i-5-1a2b3c4d in the URL or include statement. You can also use cmd[5]=x-5-934 where 934 is short _id
The right alias is _#ITEM_ID#.
For example, to show an item in a full text view, the view.php3 script should get the parameters like:
vid=110&cmd[110]=i-110-2548e4b7ae7b8874ee4a4bf
( the 'i' command to view.php3 script takes as argument unpacked (long) item
id)
So if we pass the vid parameter directly in fulltext.shtml page:
fulltext.shtml:
<!--#include virtual="/aaa/view.php3?vid=110"-->
Which then needs us to pass the cmd parameter through url:
<a href="fulltext.shtml?cmd[110]=i-110-2548e4b7ae7b8874ee4a4bf"> fulltext </a>
So we can generate this by placing in the Odd rows field of an index view
<a href="fulltext.shtml?cmd[110]=i-110-_#ITEM_ID#"> fulltext
</a>
If you want to link to a view appearing in the same place on the same page (as for the main index going to a full text), then if your Index view has vid=109 then the URL should be:
"?cmd[109]=i-110-_#ITEM_ID#"
which will redraw the same screen, replacing view 109 with view110, for the item specified.
Static Views are a bit like macros, they are not related to a specific item or slice, but can be used where the same content, or parameterised content is needed on many pages.
It is a view that only has one format - the 'Odd Row' format. It does not lookup the values for any items or fields, but just prints the 'Odd Row format'.
However they can take parameters from the URL
You can use aliases defined in the URL parameter 'als'. For a detailed description of the als parameter, see "What parameters can I use with slice.php3"
For example,
There are 13 navigation pages. For example, there is a page on 'Communication
Rights' which has a report on Internet Rights in general and links to the pages
'Communication Rights in South Africa'
'Communication Rights in Morocco'
'Communication Rights in Senegal'
etc...
I did not want to write 13 pages, so I used 2 static views -- one for country pages, and one for topic pages.
The topic page is /topic.shtml. It has this include
<!--#include virtual="/apc-aa/view.php3?vid=2-->
topic.shtml will be called with parameters. To create the 'Communication Rights' topic page, it will be called as
/topic.shtml?als[MY_TOPIC]=Communication+Rights&als[URLE_TOP]=Communication%2BRights
URLE_TOP is an alias similar to MY_TOPIC, but it double URL encodes the value. It will be used to generate links. %2B represents the +. A + in url encoding is a space.
In this topic.shtml I want to create links to these pages. To create these links, view #2 has this 'odd row' format:
<a href="/resource.shtml?cmd[1]=c-1-South%2BAfrica-c-2-_#URLE_TOP">South
Africa - _#MY_TOPIC </a>
<a href="/resource.shtml?cmd[1]=c-1-Morocco-c-2-_#URLE_TOP">Morocco
- _#MY_TOPIC </a>
<a href="/resource.shtml?cmd[1]=c-1-Senegal-c-2-_#URLE_TOP">Senegal
- _#MY_TOPIC </a>
and the MY_TOPIC and URLE_TOP are substituted from the als parameters in the
URL.
Views can be swapped in and out from the URL, using syntax like "cmd[5]=v-8" to display view 8 at the place where View 5 was expected (for example by <!--#include="/aa/view.php3?vid=5"-->
For example, if you want a navigation menu that redraws itself depending on
what is clicked on, you should create each of the different views you want to
appear and then include one view in the shtml page. Then you can switch between
displayed views using the url parameter.
For Example:
----------- index.shtml ----------
[...]
<h3>content</h3>
<!--#include virtual="/apc-aa/view.php3?vid=9"-->
<p> page footer... </p>
[...]
--------- code for this menu in the Odd row field of view #9-----
[...]
<a href="index.shtml?cmd[9]=v-13">News</a><br>
<a href="index.shtml?cmd[9]=v-14">Calendar</a><br>
<a href="index.shtml?cmd[9]=v-15">About us</a><br>
[...]
When the index.shtml page is redrawn the initial view #9 will be replaced by the appropriate view, for example view #13 will appear in the News slice and view #14 in the Calendar slice.
Because the PHP is interpreted via an include on the server, you cannot easily change the view at run-time, for example changing it based on a mouse-over event, it requires a page to be redrawn.
** Input (setting the admin interface)One Note on 'Related Item Window' - in fact it is the only one option to use if you want to use the field as 'Related Item' because other options shows all slice items on one page, which is usually too much. Another feature of 'Related Item Window' is, that it is possible to add items not only to the written item, but you can add '2 way relation' between items - written item (say 2) is not only related to assigned item 1, but the item 1 is then related to item 2 then.
The next problem is, how to display the related items on webpage.
** Output (1) - Standard use of views
This is the way, how to create link to related item view and also this is the way, how to create link to fulltext view
For related item however we expected another behavior. We want to display related items under the fulltext of the item (or directly under each item on index page). That's why we introduced 'view as alias feature':
** Output (2) - view as alias
steps 1) - 4) is exactly the same as in Output (1)
Output (2) describes how to create view alias. With such alias you can work as with any other aliases.
Tip:
In step 6) of Output (2) we used field content as list of displayed items:
vid=110&cmd[110]=i-110-_#this
In some cases we may want to switch between the views depending on field content. Then you can use parameter like:
vid=110&cmd[110]=v-_#this
or more complicated:vid=110&cmd[110]=i-_#unspecified.....-_#this
Then the fields <this> in example a) or unspecified..... in example b) should contain the ids of view to show (112, 113...).
How do I create a View which indexes all items that relate to that item.
An example might help..
I have two slices 'authors' and 'articles'.
In articles I have a field 'author' which relates to the slice 'authors' (in
it is stored ID or IDs of author/authors of the article).
So in articles on the web is displayed information from the 'authors' slice.
But now I would like to show references to articles on the pages of their authors.
And I don't want to make it by a new relation field in the slice 'articles',
because I would have to after addition of a new article go to the slice 'authors'
and edit the author's profile - make a relation to the new article.
Do you have some idea, how to display the information from the slice 'articles'
in the slice 'authors' if the relation field is in the slice 'articles'?
Yes, it should be possible to display author's articles, because there is the
"relation" field for Author (the created_by.....1 in your case) in
the Article slice. There are the ids of 'Author' records (items) stored in this
field. So, it is possible to create view (say number 123) in 'Article' slice
where the first condition will be
Author =
Then, you just create the page which includes the view:
---author.shtml ---
<!--#include virtual="/aaa/view.php3?vid=123"-->
The link to this page then should look like:
author.shtml?cmd[123]=c-1-5254422456eab4763bea34
where 5254422456eab4763bea34is item (=author) id in Author slice. Such link can be generated automaticaly Index - Odd row (for example):
<a href="author.shtml?cmd[123]=c-1-4f35cd6ab328690caffbe7d646eded78">_#NAME####</a>
Javascript item exchange View is a type of View. It works exactly the same as a standard view, but the primary usage for this type is to show items on any page around the Internet. For a simpler way of doing this, see "How do I use jsview.php3 to view pages on a site where AA is not installed."
The destination page should contain a HTML tag like:
<SCRIPT LANGUAGE= "JavaScript"SRC="http://aa.ecn.cz/apc-aa/view.php3?vid=1"></SCRIPT>
This tag includes the output of view to any page on Internet (there is no restriction to one server).
Because such tag requires javascript as output of view.php3, the format strings for the view (Admin -> View) should look like:
| Top HTML | document.write("<TABLE WIDTH='100%' BORDER='0' CELLPADDING='2' BGCOLOR='#FFFFFF'>") |
| Odd Rows: | document.write("<TR><TD VALIGN='TOP'>12/05/2001</TD><TD><a href='?x=1735'>How do I use a Javascript view to see pages on a site where AA is not installed</a></TD></TR>") |
|
Bottom HTML: |
document.write("</TABLE>") |
Note that there is (or was) a bug where if the item would generate no items then you'll get an error rather than empty Javascript.
The only required parameter to view.php3 script is number of view to show. This parameter is given by vid url variable. All remaining parameters are optional.
Each optional view parameter begins with cmd[x], where x is view number in which the parameter should be used. This is needed because of possibility to include more than view to one shtml page. That's why we need to specify, for which view the command should work.
It is impossible to specify more than one cmd for one view. If you
want to use cmd[]=d for the view, you can't use it with
combination with cmd[]=c, for example.
Above is still true, even after CVS snapshot 20031109,
since when you can also use this syntax: vid=x&cmd[x][]=c-1-<something>&cmd[x][]=c-2-<something>.
Note the extra [].
However, you can use more settings (set[x]) per view. Just seperate settings with a comma, like: set[23]=from-10,to-20.
After the cmd[x]= is always character, which specify which command is used - how modify the view. The c command modifies conditions, for example. The values after command character are user parameters and its meaning is different for each command. The parameters are separated by '-' character. If you need to use a hyphen '-' in a parameter, use 2 hyphens '--' instead. Description of parameters is in following table of examples.
| Parameter example | Description |
| vid=4 | id of displayed view |
| cmd[23]=v-25 | show view id 25 in place of view id 23 |
| cmd[23]=i-24-7464647 | view number 23 has to display item 7464647 in format defined in view 24 |
| cmd[23]=x-24-1589 | The same as i, but there you can use both - short_id or long item id (as the last parameter) |
| cmd[23]=x-24-1589-1545-1612 | Display all three specified items. You can use as many ids as you want (the same works also for 'i' and 'o' cmd). This behavior is used for related fields, where related fields are displayed by{view.php3?vid=33&cmd[33]=x-33-{@relation.......1:-}}. |
| cmd[23]=x-24-url | keyword url means, that item id is taken from url parameter 'x=...' |
| cmd[23]=o-24-1589 | The same as x, but the number of item display (countHit) is not increased (as opposite to 'x' or 'i') |
| cmd[23]=c-1-ICT | display view no 23 in place of view no 23 (that's normal), but change value for condition 1 to "ICT" |
| cmd[23]=c-1-ICT-2-%22Jane%20Smith%22 |
the same as above, but there are redefined two conditions.
All three conditions could be redefined, notice how "Jane Smith"
requires urlencoded double quotes %22 or the search won't work, and the
space turned urlencoded to %20 otherwise it would be interepreted as
Jane OR Smith Since CVS snapshot 20031109 you can also use this syntax: cmd[23][]=c-1-ICT&cmd[23][]=c-2-%22Jane%20Smith%22 You do need to use this e.g. when you want to specify the first condition in your .shtml file, while second one comes from the URL |
| cmd[23]=d-headline........-LIKE-Profit-source.........1-=-Ecn-publish_date....-m:>-86400 | displays view no 23 and redefines the conditions. The conditions are in format field-operator-value. For list of possible operators see search caption. The operators could be with its modifiers, too. The unlimited number of conditions should be there specified. The speciefied conditions allways replaces all conditions specified in view definition (through admin interface). There are three diferences from cmd[]-c command - 1)operators and fields are specified, 2) default view conditions are ingnored, 3) there can be unlimitted number of conditions. The example would show items in which the headline contains 'Profit' and source field is 'Ecn' and the item is newer that one day. |
| cmd[23]=d-headline.......1,category........-RLIKE-Enviro | You can use more than one field in one condition. Example displays items where headline.......1 OR category........ begins with Enviro |
| set[23]=listlen-20 | setings to modify view behavior (can be combined with cmd) - sets maximal number of viewed items in view 23 to 20 - there can be more settings - comma separated |
| set[23]=sort-headline.......1 | set item order (use 'sort-headline.......1-' for descending sort order |
| set[23]=from-10 | - displays items from 10-th (in view 23) - it can be combined with listlen, to, ... parameters (set[23]=listlen-20,from-5) |
| set[23]=to-15 | - displays items to 15-th (in view 23) - usefull if combined with from parameter (set[23]=from-2,to-9) |
| set[23]=page-2-3 | - displays second page from 3 (in view 23) - it didvides all matching items into 3 pages and displays the second one. If you do not specify the second parameter (3 in our example), the page will be listlen items long. |
| set[23]=random-1 set[23]=random-number.........1 |
selects item(s) to show randomly. If you use the 'random-1' parameter, any item in Active bin is displayed. If You use field_id instead of '1', then the content of field specified by field_id is used as probability to show the item. Let's have two items. The parameter looks like 'random-number.........1'. The first item has the number.........1 filled with number 10, the second with 50. Then the second item will be displayed 5x more offten than the first one. The 'weight numbers' and 'number of displayed items' are unlimited. This feature is very good for banners. |
| set[23]=banner-2-38 set[23]=banner-2-38-number.........1 set[23]=banner-2-38-norandom |
by this parameter you are able to display any view (38 in or case) inserted just after the second (2) item in view (number 23). The item shown in inserted view (38) is selected randomly, possibly with weight specified in weight field (number.........1) - just like in random parameter described above. If you do not want use random item (banner), use 'norandom' keyword in place of 'weight field' (good for displaying nested newsbox). See also banner parameter for slice.php3. The example of included banner is on http://ecn.cz. |
| set[23]=noitem-Not%20found | - redefines the 'Not item found' message in view. |
| set[23]=slice_id-79a69a0ad73c81ac332b0e8c4c3cea93 | - redefines the slice from which the items will be displayed. |
| set[23]=slices-79a69a0ad73c81ac332b0e8c4c3cea93-45639a0ad73c81ac332b0e8c4c3cea44 | - display items from specified two or more slices. |
| als[alias] | user alias definition - you can define your own aliases in
url (for both - slice.php3 and view.php3). Aliases names MUST!!! be 8
characters long. Don't forgot, that the alias value have to be
urlencoded. Example: als[MY_ALIAS]=Summary%20Page (or maybe better: als%5BMY_ALIAS%5D=Summary%20Page) defines alias _#MY_ALIAS. If used in formatstring ('Admin - Design Index' for example), it prints 'Summary Page' |
| nocache=1 | URL parameter for pagerefresh - the view is not taken from cache (- no matter if the view is allready cached or not). Cache is updated. |
_#CV_NUM_D is the number of the day (to be used in a day cell)_#CV_NUM_M is the number of the month (to be used in a day cell, usually in an URL link)_#CV_NUM_Y is the number of the year (to be used in a day cell, usually in an URL link)_#CV_TST_1 time stamp of the current day at 0:00 (to be used in a condition)_#CV_TST_2 time stamp of the next day at 0:00 (to be used in a condition)set[301]=month-3&year-2002<table> tag and may contain e.g. a table row with names of week days (Mon,Tue,...).
</table> tag.
_#COLOR___ contains a color, write bgcolor=_#COLOR___
<tr> tag. It contains a table cell tag with the day number, usually linked to an daily event list, e.g. <td><A href="calendar.shtml?vid=319&cmd[319]=c-1-_#CV_TST_2-2-_#CV_TST_1&month=_#CV_NUM_M&year=_#CV_NUM_Y&day=_#CV_NUM_D"><B>_#CV_NUM_D</B></A></td>cmd[319]=c-1-_#CV_TST_2-2-_#CV_TST_1 involve appropriate settings in the list view (no. 319 in my case) - see further. The month=_#CV_NUM_M&year=_#CV_NUM_Y&day=_#CV_NUM_D variables are used in the .php3 page to show the appropriate date - see the example in doc/example/calendar.php3
</tr>"Start date <" where Start date is the name of the field containing event start date, the second must be "End date >=" where End date is the name of the field containing event end date.cmd[319]=c-1-_#CV_TST_2-2-_#CV_TST_1 described above.
If you want to add functionality to the Add / Edit item page, you can use JavaScript code. This may be useful in many cases. JavaScript is executed on the client computer and works in most web browsers, e.g. Internet Explorer and Netscape on PC / Mac. There are many enhancements which work in IE only or in Netscape only but enough features are available for both. I assume you know about JavaScript or will look for some more info on web.
Some examples of what may be done:
Events lasting one or more days. You need two fields -- event start and event end. But most events are one-day events and the users hate to fill the same date twice. You can add a link "Copy date from Start date" which will copy the value. Or you can add an "aa_onSubmit" trigger, which will copy the value before submitting the form when End date is not changed.
Combining two fields. You want to join values from several fields into another field. You can do it just after leaving any of the fields by the "aa_onChange" trigger or just before form submit by the "aa_onSubmit" trigger.
Some useful functions are ready to work with fields. These are defined in indclude/fillform.js.
Have a look at the file to see other more general and more powerful functions.
The file is included with the Add / Edit item page if anything is defined on
the Field Javascript page. The two basic functions are:
setField (fieldid, newValue) -- sets a value to various control types, to a text box, text area, select box, check box etc. Works even with AA dates (shown by three select boxes for day, month and year) -- use a UNIX timestamp (number of seconds since 1.1.1970) to set a date.
getField (fieldid) -- gets the value from various control types. Works with AA dates, returns the UNIX timestamp.
If anything is written in this page, the file include/fillform.js
is included with the Add / Edit item page. You can write any JavaScript code
in the page. AA will look for triggers and add them to all controls if it founds
them. Each trigger must be defined with
function aa_onTrigger (fieldid) { trigger body
}
where Trigger is a name of any allowed trigger -- these
are listed at the bottom of the Field Javascript page. You can add whitespace
(spaces, tabs, line ends) but you must use the parameter fieldid.
The ID of the field to which a control belongs or the name of the form ("inputform")
is sent in it.
Combining two fields. You want to copy headline and expiry date to abstract after editing any of them:
function aa_onChange (fieldid) {
switch (fieldid) {
case 'headline........':
case 'expiry_date.....':
var
myDate = new Date (getField('expiry_date.....')*1000);
textdate
= myDate.getDate()+'.'+(myDate.getMonth()+1)+'.'+myDate.getYear();
setField
('abstract.......2',getField('headline........')+' '+textdate);
break;
}
}
Events lasting one or more days. Suppose you are using the Expiry date and Publish date as event end / start date. You can add this code to the Before HTML code in Admin -- configure Fields:
<tr><td></td><td class=tabtxt>
<a href="javascript:setField('expiry_date.....',getField ('publish_date....'));">Copy
from post date</a>
</td></tr>
Remember to add something to the Triggers page (e.g. "//" which is a commentary in JavaScript), otherwise fillform.js with the functions getField and setField won't be loaded.
If you want to use the trigger, add this code to the Field Triggers:
function aa_onSubmit (fieldid) {
var myDate = new Date (2001,0,1); // the
default date is 1.1.2001
if (getField('expiry_date.....') == myDate.getTime()
/ 1000)
setField('expiry_date.....',getField
('publish_date....'));
}
This will change the end date before submitting but only if it is set to 1.1.2001, which is default.
Content Pooling lets you exchange articles with any number of partner sites. You can create a pool with any number of partners. With Pooling, you always retain complete control: you can withold any item from your pool; and you can reject any item made available to you.Through Value field on
the Mapping page you can specify not only a new value, but also
any AA expression, which is
unaliased - example:
<a href="{source_href.....}">{source..........}</a>
In the Value field you can specify, which items should be
fed and which not. It is done by modifying the value of the ‘Status Code’ of the
receiving slice, according to field in the feeding slice.
Status codes are:
1=active, 2=Holding, 3=Trash, 4=Do not fed)
An example set-up:
1) Set Feeding, as usual ('Slice
Admin' -> 'Inner Node Feeds') (see feeding FAQ)
2) Go to 'Slice Admin' ->
'Mapping' and select the your source slice
3) fill something like:
{switch({category.......1})Enviro:1:4} for 'Status Code' and set FROM to '--
Value --'
After this all items from the source
slice with category 'Enviro' will be fed into Active ('Status Code' value=1).
Other will not be fed ('Status Code' value=4).
The offline filling currently works only in IE with Java support (there are some problems with Netscape and file manipulation permissions).
All files used for off-line filling are stored in /mics/offline2slice directory. All of them should be copied to local computer, where you want to use offline filling. There are a few steps to do for sucessfull installation.
The offline filling is now installed on your computer and you can try it (open your local fillform.html file in your browser). There you can fill as many items as you want and after all send it to the server.
Before sending the filled forms to server make you sure, that the slice you want import to, permit this operation (see 'Admin' - 'Slice' - 'Allow off-line item filling').
After the sucesfull sneding the items to server, your browser should be redirected to the page, where you can delete the file (offlinedata.txt). In this file the filled data are locally stored. The deletion is not necessary - the offline filling script offline.php3 will recignize, if the data for each item is already stored in database or not (the CRC for each item is computed). However, the better practice is to delete the file. This saves the capacity of line, because the data will not be transfered to server for second time.
You have prepared a public anonymous posting form and want to use it to edit items as well. How to do it?
There is a script fillform.php3 with associated JavaScript utilities in include/fillformutils.php3. This script takes the long item id from var my_item_id and calls JavaScript functions to look for the fields and fills them appropriately.
You may use it this way:
file anonymous.shtml
<!--#include virtual="/anonym.html"-->
<!--#include virtual="/aaa/fillform.php3"-->
<!--#include virtual="/bottom.html"-->
Than you can call anonymous.shtml?my_item_id=... to show the edit form filled with old values.
There are two additional parameters which most users will not need: use "form = formname" when you changed the name of the form containing the fields (usually it is "f"). Use "notrun = 1" if you want to fill the controls e.g. only after clicking somewhere.
Only items posted by public website and not updated in the AA admin can be edited this way - a flag ITEM_FLAG_ANONYMOUS_EDITABLE cares about it. It is reset every time you send an item with itemedit.php3.
The same script may be used to refill conditions on a search page - see this.
Abstract
Explains the basic idea, creation and settings of Anonymous forms. The name “anonymous” is in some cases not accurate, as the form is used for reader personal info and the readers must be authorized to edit their own info.
See also: doc/reader.html, doc/alerts.html, doc/script/show_result.php3
Anonymous forms are similar in function and design to the Add / Edit item page. The main difference is they are placed outside of the AA Control Panel and thus do not provide the AA authorization and have a design of their own.
The most common usage is to allow web readers to suggest new content. After filling the Anonymous form it is sent to the Holding Bin and a Thank you page appears. But you can also allow readers to edit items with the Anonymous form.
Two scripts handle the anonymous forms. The first, filler.php3, stores the info coming from the form into the database. It also validates the data and prooves permissions to edit or update the item. The second, fillform.php3, refills the data into the form shown to the reader. It retrieves the data from database or in some special cases directly from filler.
In the previous AA versions until version 2.4, the process of creating Anonymous forms was very simple: Copy the code of the “Add item” page with only a few necessary changes. But as the form now allows to edit items and to use several options for it, a new wizard was created. This wizard creates the HTML code for a complete form with the SSI include of fillform.php3 necessary to edit items. The resulting form differs depending on whether Anonymous editing is allowed or not.
You may change these settings in the wizard or later in hidden fields:
Table 1. Wizard settings
| err_url | The URL to which the script filler.php3 jumps when some error occurs. It may be the same page on which the form is shown. |
| ok_url | Like err_url, for successful changes. |
| show_result | The URL of a PHP script which receives the results from filler.php3. This allows for a completely free design of how the errors are presented to the user. See below. |
If you are interested to know more about what the form contains, here are some remarks:
If you want to edit items with anonymous forms, first you must allow to choose which item to edit. You can create a view and add a link to the headlines, which links to the anonymous form and contains the parameter my_item_id=11a7cc0908d77c22bf2c7ca43cdd8480. Another approach is used in Reader management slices, see below.
You must choose the correct setting in Slice Admin - Settings - Allow anonymous editing of items, which is used by the filler.php3 script on an item update request. The options are:
Table 2. Anonymous editing options
| Not allowed | Never allow to update items |
| All items | Always allow |
| Only items posted anonymously | For items posted anonymously, filler always sets the ITEM_FLAG_ANONYMOUS_EDITABLE flag. By choosing this option you allow only items with this flag set to be edited. |
| Only items posted anonymously and not edited in AA | Similar to the previous one, but when you edit the item in the control panel, the flag is cleared and thus the item is no more allowed to be edited anonymously. |
| Authorized by a password field | filler looks for a field of type Password (with Id beginning with password....) and requests the password sent by the user to match. The password may be set on item creation. If the field is not flagged required, an empty password may be used. The new Field Input Type, Field Insert Function and Field Validate Functions “Password and Change Password” provide the usual edit boxes for changing, deleting and entering password, which is stored encrypted. The disadvantage is the password must be sent on every update. |
| Readers, authorized by HTTP auth | This is a special option, useful only for Reader management slices. The username given to the browser on HTTP authentification is looked for in the database. Each reader may edit only his or her personal info. |
It is possible to send images and other files by the form (unlike the anonymous posting in version prior 1.5)
It is possible to set values to a non-displayed field by just adding a hidden field for such a field:
<input type=hidden name="v696d675f6865696768742e2e2e2e2e2e" value="Anonymous author">
Note: This solution is easy and good working in many cases, but it is by no means secure. Any experienced user can change the values of the hidden fields so do not rely on such data. A better solution is to completely omit such fields from the input form and set the default values for the fields in "Admin" -> "Main setting - Fields" -> "Edit" -> "Default". The values are than set directly from the database. This solution is a little bit more secure.
The inputs are validated as if they were typed in the standard itemedit.php3 form. When there are any invalid data, the whole item is not updated. The javascript validation used in itemedit.php3 is also included in the form created by the wizard
You can disable the standard AA validation by adding a hidden field notvalidate in the form:
<input type=hidden name="notvalidate" value="1">
Be cautious when using two anonymous forms on one page. You must rename the
form and the Javascript variables so that
they do not conflict with each
other.
If your form includes HTMLarea, you will need to include <body onload="HTMLArea.init()"> in your form page.
Each reader has her or his own item in the Reader management slice. Thus the HTTP authentication described above may be used directly to determine which item (reader personal details) to show in the form.
In this case two forms are needed, one being the publicly accessible subscribe form and the second being the HTTP protected “Change personal details” form. Because the fields on both the forms may be the same, you can use one form and include it into two different .shtml pages.
For webs not using Auth we need a way to ensure nobody not only edits but even views the data. This is achieved by assigning a special “Access Code” (see the Reader management documentation) to each reader, which must be added to the URL in order that the data are prefilled. The password authorization described above is than used on item update.
Sending the data to AA results in adding the data into database or in an error. Some of the errors may be excluded in advance by Javascript validation (function proove_fields). But some of them, like a username being already used, can not.
By default, the fillform.php3 script shows standard error messages. They always appear at the place where fillform.php3 is SSI-included in your shtml page.
You may create your own PHP script (see an example in doc/script/show_result.php3) and send its URL as a value of a show_result variable. Add it as a parameter to the fillform.php3 SSI include created by the Wizard, e.g.
<!--#include virtual="/aaa/fillform.php3?show_result=http://ecn.cz/show_result.php3&form=..."-->
An array $result with the results will be sent to the PHP script and you may print appropriate messages, see the example.
The $result array content is created at various places in filler.php3 array. Look there for accurate info. At this moment the messages are:
Table 3. Results from filler.php3
| fatal | Fatal error. Several messages related to the slice, not to the particular item. These errors help on creating the web page. |
| validate | Array with not validated fields, field_id => message, e.g. headline........ => This username is already used created on field validation. You may create your own messages depending on the field_id. |
| permissions | Missing permissions. Depending on the setting for Anonymous editing (see above), this item did not fullfill the requirements. |
| store | Some error in StoreItem. Usually this points to an inner AA error. |
| success | No error. The operation was successfully done. The value is “insert” or “update” (i.e. $result["success"] == "insert" or $result["success"] == "update" in the show results script). |
| email_confirmed | Added by fillform.php3 on Reader management slices: When the reader successfully confirms his or her email by using the URL sent in an email, fillform adds a message “email_confirmed => OK”. This message is added only when the email has not yet been confirmed. |
| unsubscribed | Added by fillform.php3 on Reader management slices: When the reader unsubscribes from Alerts (which is achieved by setting How often to an empty value). |
Discussion: A similar result may be achieved by adding several fields to the form, e.g. fields
err_page[validate][username......]="err_username.shtml"
err_page[validate][*]="err_validate.shtml"
err_page[*]="err_unrecognized.shtml"
and by creating the .shtml pages with a static message concerning the particular error. The main advantage of this approach is the web administrator may not know PHP. The disadvantage is the necessity of creating many pages but using SSI includes the pages could look only like:
<!--#include file="err_top.shtml"-->
The username you entered has already been used. Please try another username.
<!--#include file="err_bottom.shtml"-->
If you want to display some view on page, which is stored on site where is not installed AAs, you have three possibilities.
This answer covers point 3) - jsview.php3
The usage is easy. Just replace SSI include in original shtml age with the javascript one. The jsview.php3 takes exactly the same parameters as view.php3.
For example, if the old SSI code in page.shtml was:
<!--#include virtual="/apps/aa/view.php3?&vid=2&cmd[2]=c-1-APC" -->
the new javascript code in page.shtml would be:
<script type="text/javascript" src="http://www.apc.org/apps/aa/jsview.php3?vid=2&cmd[2]=c-1-APC"></script>
Manual feeding
In Item Manager select the items you want to send to another slice. Select "Export"
on the toolbar just below the itemlist. After clicking on "GO" a new
window is shown where you can select destination slices. (You must have a permission
in the destination slice - at least Author. If you are Editor or more in the
destination slice, you can set the "Active" checkbox, which means
to copy the items in the destination slice into the Active Bin. If the checkbox
stays unchecked, the item is copied to the Holding bin).
The feeding is error-safe, it is impossible to feed one item to the same destination slice more than once.
Automatical feeding
Each Feed needs to be configured in both the slice where the items are entered and which will export items, and for the slice where the items are imported.Select the slice where the items are entered. Select Admin->Content Pooling -> Inner Node Feeding. If you are willing for items to go to any other slice on the same host then check "Enable export to any slice". Otherwise uncheck this box, and move slices that you want to receive items to the Export Enable box.
Select the slice where items will be received. Make sure the slice you want to recieve from is in the Import box. As a courtesy send an email to the administrator of the slices you want to receive from.
The import process can be fine tuned in two ways.
In Admin->Content Pooling->Filters you can select which of the exporting slice's categories items come from, and to which categories of the importing slice they are delivered. Select the Active box if you want items in this category to be made Active, otherwise they will go in the Holding Bin for manual approval. There is currently no way to control which items are fed, only which category they go to.
In Admin->Content Pooling->Mapping you can control which fields of the source slice end up in which fields of the destination slice.
If you want to export items already in the slice, then go to the Item Manager, check the items to export, and choose "Export" and Go. This will give a choice of destination slices, which you can check along with whether they should be Active, or go to the Holding Bin for manual approval.
When you write an item which goes into the Active bin or when you approve an item, the feeding function is invoked. This function finds all slices where the item should be fed (depending on current feeding permissions ("Admin" -> "Content pooling - Import & Export") and feeding setings ("Admin" -> "Content pooling - Filters")). The feeding goes deeper and deeper between the slices until a cycle is detected or feeding into Holding bin is set.Feeding one item from one slice to another means:
Let's look in the constants.php3 file:
# content table flags
define( "FLAG_HTML", 1 );
define( "FLAG_FEED", 2 );
define( "FLAG_FREEZE", 4 );
define( "FLAG_OFFLINE", 8 );
define( "FLAG_UPDATE", 16 );
# states of feed field of field table
define( "STATE_FEEDABLE", 0 );
define( "STATE_UNFEEDABLE", 1 );
define( "STATE_FEEDNOCHANGE", 2 );
define( "STATE_FEEDABLE_UPDATE",3);
define( "STATE_FEEDABLE_UPDATE_LOCKED",4);
# relation table flags
define( "REL_FLAG_FEED", 2 ); # 2 - just to be compatible with content table
There you see how the various flags can be set. The most important are the flags
for the field table. For each field you can set whether this field is
After copying the contents, the relation table is updated. This table holds
information about the feeding tree (from which item is the content fed to another).
The relation table will be used for another purposes in future too (for holding
discussion threads, ...), so each record for feeding if flagged as REL_FLAG_FEED.
Developers note: The implementation is based on Moritz Both's specification:
http://plus.aldebaran.de/apc-aa/csn.html
http://plus.aldebaran.de/apc-aa/csnspec.html
--------------------------------------------------
A. Installation
Node = one installation of ActionApps.
Assume there are two nodes, which want to exchange items
Step 1 Set up the node details,
- must be done by sysdadmins, with shell access on both nodes, but they only
have to be done once, no matter how many slices and how many nodes are configured,
normally it will have be done when ActionApps was installed.
Set the ORG_NAME in config.php3 file to the name of your organization, e.g.:
define ("ORG_NAME","Econnect");
Step 2 Set the information about the collaborating nodes.
- must be done by a Superadmin on both nodes, once for each node that it imports
or exports to.
Step 3 Setting import and export
- this can be done by the Slice Admin
3.1 On the exporting node,
There you can set the permissions for remote users, who will have the rights to get items from the current slice.
3.2 On the importing node,
There you can set, from which remote nodes and slices will items be fed.
3.3. Set the filters and mapping on the importing node
Filters and mapping you can set exactly the same way as for local feeding. See 'Slice Admin -> Filters' and 'Admin -> Mapping'
Step 4. Set the cron
ActionApps adds the task for CSN to the AA Cron on its setup. If you are superadmin,
you can check it on AA -> Misc - Cron page. There should be task defined as:
* 8,23,38,53 * * * admin/xmlclient.php3
Normally you will want either a Item listing, Full text or Static Page view.
Link listing and Category listing views are used for Links module - you can customize the design of links listing and category listing just like jot normal AA items. The usage is analogous to Item listing and is quite simple, but deep documentation of those views wait for someone, who will have resources to document Links module.
This FAQ assumes you did the original installation from CVS (see Installation of ActionApps Doc )
First, check that you really want to update. There is usually a stable release and a developer release. The instructions below will update to the latest release from CVS - which is what most of the people discussing things on the apc-aa-general mailing list are using. This might not be as stable as a release you may be running.
The CVS will write over your current config file, usually located in /apc-aa/includes/config.php3. The key values you will need to re-enter after updating and may not be able to remember are: AA_ID, DB_HOST, DB_NAME, DB_USER, DB_PASSWORD. Without these correct values, AA will not work.
You should also back-up all your apc-aa files, encase the update fails and you need revert back.
Once you have done your back-ups, login to shell on you account and cd to the apc-aa directory and run
cvs -n update
This will display the changes and potential conflict - look for lines starting "C" these are conflicts that need a developer to figure out. You'll have to ask this list if you get one of these.
NOTE: It is common to get 'timed out' type errors from the CVS, which is hosted at SourceForge.net. Just keep trying every few minutes
If it all looks good, run
CVS update -dPAC
This will:
-d Build directories, like checkout does.
(if there is new directory in the repository, then it is
created)
-P Prune empty directories.
-A Reset any sticky tags/date/kopts.
(allways load HEAD branch of the CVS)
-C Overwrite locally modified files with clean repository copies.
(For more options try "cvs --help update")
You should then compare the version number at the top of /apc-aa/includes/config.php3 to see if it is newer then your backed up config.php3 file. If not, you can simplly upload your backed-up version over the new one. If the new config file is different, you will need to manually write in your settings, based on the backed-up version.
Access http://yourhost/apc-aa/sql_update.php3, this will update the database to the latest version. The script always refreshes the database structure to the newest version - no matter if you allready have the newest structure.
The script makes a backup of the tables, but there is not yet a documented way to restore the old version, and note that re-running the script overwrites the last copy of the backup.
On you index view...
Include _#ID_COUNT (number of found items) in the Top HTML and _#ITEMINDX (index of item within view) in front of each result item.
Also make sure the HTML code for "No item found" message says something that makes sense for the search type. Use the notshowall=1 [exact code] so blank searches show all items. Include multiple useful sorting options.
If you have one slice item with many discussion items, it may be used as a message board.
You can make AA send all new discussion items posted to this particular item to an email address. If the address is a mailinglist, you can use the discussion as a message board.
You need to:To do so, you have to
The DiscussionMailList field value is a parameter list in the usual format, separated by ":" and using "#:" instead of verbatim ":". The parameters are:
The program is implemented in discussion.php3, function send2mailList. It is called from filldisc.php3.
AA v2.0.0 supports discussions. The example, how the dicussions could look is on:
http://aa.ecn.cz/template/news.shtml?x=39124
Discussions are quite configurable (through views and aliases). Discussions can be easily managed in Item Manager - you can edit posted comments, Hide/Show them and Delete it.
Note, that each discussion is allways related to one item in slice.
There are some steps you have to do, if you want to add discussion to items, some of the steps depend on whether you are showing slices through slice.php3 or site.php3:
<form name=f method=post action="/apc-aa/filldisc.php3"...to point to directory, where your AA are installed (possibly: ...<form name=f method=post action="/aaa/filldisc.php3" ...)
<input type=hidden name=d_state value=1>after the
Open the view that shows the full-text, add for example:
{view.php3?vid=55&set[55]=sh_itm-{unpacked_id.....}}
Check in your site file (e.g. apc-aa/modules/site/sites/site_xxxx.php3) to see that the lines dealing with sh_item are not commented out e.g.
# Handle paging, takes from variable like scrl=24&scr_24_Go=3/
if( isset($scrl) ) { # page scroller
$pagevar = "scr_".$scrl."_Go";
$apc_state['p'] = $$pagevar;
}
if( ($apc_state["p"] <= 0) OR ($apc_state["p"]=='-') )
$apc_state["p"] = 1;
typically you want the number of comments, and a link to either View or Add Commends depending on whether there are any, code if called from site.php3 might look like....
<a href="?{relargs}&i=_#SITEM_ID({switch({disc_app........})0:&add_disc=1}#disc">{switch({disc_app........})0:Add::_#D_APPCNT} Comments.</a>
{alias:d_date..........:f_d:j. n. Y} expresssion, instead of the _#DATE###_ alias.| _#SUBJECT_ | d_subject....... | subject of the discussion comment |
| _#BODY###_ | d_body.......... | text of the discussion comment |
| _#AUTHOR#_ | d_author........ | written by |
| _#EMAIL##_ | d_e_mail........ | author's e-mail |
| _#WWW_URL_ | d_url_address... | url address of author's www site |
| _#WWW_DESC | d_url_descript.. | description of author's www site |
| _#DATE###_ | d_date.......... | publish date |
| _#IP_ADDR_ | d_remote_addr... | IP address of author's computer |
| _#CHECKBOX | checkbox used for choosing discussion comment | |
| _#TREEIMGS | images | |
| _#DITEM_ID | d_item_id....... | comment ID (the same as _#ITEM_ID_) |
| _#ITEM_ID_ | d_item_id....... | comment ID |
| _#DISC_ID_ | d_id............ | item ID |
| _#URL_BODY | link to text of the discussion comment | |
| _#URLREPLY | link to a form | |
| _#DISC_URL | link to discussion | |
| _#BUTTONS_ | buttons Show all, Show selected, Add new | |
| d_parent........ | id of parent discussion comment | |
| d_state......... | state of this discussion comment (0 - visible, 1 - hidden) |
If the default values for the view design are missing, here are some values that work:
Current APC ActionApps are very good for creation of small or not so complex database driven sites. It was not so easy to create complex websites with many cooperating slices and views, so far. The “site module” is the answer for those, who wants to build complex websites using APC AA.
At the time I wrote the text, the only sites driven by “site module” is the Econnect site http://ecn.cz. ChangeNet site http://changenet.sk and example site on Sourceforge http://action.org/slices/. I describe the site module on Econnect's site. You will see, that the principles are similar to all “site module” based websites.
The site module is part of AA admin interface, just like other modules are. You can access it from 'Switch to' selectbox, if you have permission to. Site module allows you to describe structure of the site – you modify there so called sitetree. Sites based on the module do not need any special files (like shtml, ...) - whole site could be managed using AA admin interface (there is no need for FTP access (with one exception – 'main control script' file described later)). How to describe the structure we will see latter in this text.
The first estimation in creation of
site module was the need to write it as fast as possible. The complex
sites used to be sites with many visitors a day. For better
performance is good to be able cache the generated pages. However, in
“pre-site module” approach each user gets its own session
id, which is unique for the user and help us to store the state,
where the user user is within the site (which page on page-scroller
she is on, ...). It is good, but it is extremely hard to cache such
informations. That's why we develop the site module without sessions
variables given to each user. We use “state string”
instead. There we store the state, where the user is within the
website.
State string is variable which we call “apc”
(stands for “Application Pointer Cache” :-) the name of
this variable is given – it have special behavior inside APC AA
(it is automatically added to all links generated by APC AA, for
example).
The “apc” variable is added to all links in
AA so you every time know, where the user was in step before.
For
example: if you get the link http://ecn.cz/index.stm?apc=zzvx1--&...,
you know, that user was in
“news-alerts-all_categories-all_regions-page1” page on
the site. How it is coded into “apc” state string is
another thing (and it is in most cases up to you) – will be
described in next caption.
As you can see, the Econnect's apc
state string consist of seven state variables – each character
in the string is one variable in our case, but it is not a rule (in
fact the fifth state variable - “p” - page could be more
than one character long). All the state variables are defined in main
control file for the site - /module/site/sites/site_xxx.php3 (or its
alternative called (for security reasons) through http:// call). In
this file you define not only the number of state variables, the
regular expression for extraction the variables from apc state
string, but you specify there also the ways, how we have to change
the state. For example, if the site_xxx.php3 file gets the following
url parameter:
http://ecn.cz/index.stm?apc=zzvx1--&p=3
the state variable is changed to apc=zzvx3--, which means that you are on the same webpage, but on the page 3.
Now we describe the variables used on Econnect's site, but keep in mind, that the variables used in your site could be different (if you will).
|
Position in apc state string |
Name of state variable |
Possible states of the variable |
description |
|---|---|---|---|
|
1 |
w (web) |
z,e,n |
Main classification of pages – Econnect's pages are
divided into three webs: |
|
2 |
s (subweb) |
z,m,k,t,a,s (for w=z) |
Each web (w) is divided into subwebs, so for example web z –
zpravodajstvi contains: |
|
3 |
f (filter) |
Any letter |
Primary use of this variable is to select category of shown items (environment, human rights, culture,...), but each page could utilize this variable for its own purpose (category of grant, job, ...) |
|
4 |
r (region) |
Any letter |
The same as f – primary use for region selection |
|
5 |
p (page) |
Any number |
Stores the page number, where user is (switched by page-scroller). Could be more than one character long in our case. |
|
6 |
t (type) |
Any letter |
Special type of output – like 'text only', 'printer friendly', ... |
|
7 |
x (item) |
Any number |
Id of item to show (like 24365) – as you see it could be again more than one character long |
You can use any number of any state variables in your site and combine it together into apc state string. The only thing you have to keep in mind is that apc state string must be splittable into state variables. In Econnect's example we are using following regular expression to get state variables from 'apc state string'.
{w} {s} {f} {r} {p} {t} {x} ereg( "^([a-zA-Z0-9_])([a-zA-Z0-9_])([a-zA-Z0-9_-])([a-zA-Z_]+)([-]|[0-9]+)([a-zA-Z_-])([0-9]*)", $apc, $vars ))
Main control file is the only file you will need to edit in the process of site creation. The file contains script (probably in PHP) and its purpose is just parse 'apc state string' into state variables and possibly change the state of the variables based on the parameters it gets through url.
The script is called before any page of the site is displayed. There is easy, but functional example of such script. All comments are inside.
If $apc is not defined, we probably access the main page (like http://ecn.cz).
if( !$apc ) $apc = 'zzvx--'; # initialize 'state string', if not set, yet
Split $apc state string into state variables (for now prefixed by 'o');
if( ereg( "^([a-zA-Z0-9_])([a-zA-Z0-9_])([a-zA-Z0-9_-])([a-zA-Z_]+)([-]|[0-9]+)([a-zA-Z_-])([0-9]*)", $apc, $vars ))
list($ostate,$ow,$os,$of,$or,$op,$ot,$ox) = $vars;
else # if the $apc is in wrong format, initialize it
list($ow,$os,$of,$or,$op,$ot) = array( 'z', 'z', 'v', 'x', '-', '-');
Now we have to program the reactions on special url requests. Wherever we are in the site and we click on the link containing w=z (like http://ecn.cz/index.stm?apc=zzvx1--&w=z), we change the state to 'news' section
if( isset($w) ) { # w stands for WEB
switch($w) {
case 'z':
list($ow,$os,$of,$or,$op,$ot,$ox)=array('z','z','v','x','-','-',''); break;
case 'n':
list($ow,$os,$of,$or,$op,$ot,$ox)=array('n','N','1','-','-','-',''); break;
case 'e':
list($ow,$os,$of,$or,$op,$ot,$ox)=array('e','1','1','-','-','-','73161');
break;
}
}
The same with state variable s, but we are switching within the same WEB (variable {w} remains unchanged)
if( isset($s) ) { # s stands for SUBWEB
$os=$s;
$ox=''; # $ow stays the same – we change subweb, not web
$op='1';
if( $old_w != 'z' ) # the format in zpravodajstvi stays the same
$old_f='';
}
Write rule for each possible url request.
if( isset($f) ) {$of=$f; $ox=''; $op='1';} # f stands for FILTER
if( isset($r) ) {$or=$r; $ox=''; $op='1';} # r stands for REGION
if( isset($p) ) {$op=$p; $ox='';} # page
if( isset($t) ) {$ot=$t; $ox='';} # switch to special mode
if( isset($x) ) {$ox=$x;} # item id to display
if( isset($scrl) ) { # page scroller
$pagevar = "scr_".$scrl."_Go";
$op = $$pagevar;
$ox='';
}
Finaly, save the final state of variables into $apc_state array. The key 'state' is used for storing new 'apc state string', other keys of the array are variables, which we can use in site module administration (in next chapter). There should be not only state variables, but any other variables which you want to use in site module, as well.
$apc_state = array ('state' => "$ow$os$of$or$op$ot$ox",
'w' => $ow,
's' => $os,
'f' => $of,
'r' => $or,
't' => $ot,
'p' => $op,
'x' => $ox,
# helper variables used in site module – you can define as many such
# variables as you want
'archive' => (($op>10)? 'archive' : ''),
);
You can find example of such file
in /modules/site/sites/ directory of ActionApps installation
The HTML code for the pages is managed from site administration page. The code is divided into pieces, which is structured into tree structure – called sitetree. The sitetree you can see on the left side of the administration interface. During the displaying of the page, AA starts with the first HTML piece and then goes down and prints the right branch of the tree, based on the state of state variables. The piece of HTML code could contain not only HTML code, but there could be incorporated results of some slice view, as we see later.
We recognize two kind of HTML pieces – 'spots' and 'choices'.
spot is HTML code which is simply displayed. AA prints the contents of the spot and then the evaluation continue with the spot just below. On the other hand 'spot' (as well as choice) could be also the root of some branches of code. You can make spot as root of branch by assigning any (decision) variable to the spot. For example, if you assign variable 'w' to the 'start' spot, you create the root of branches (choices). The evaluation will continue in the branch (choice), where w satisfy the conditions.
As you see, each choice belongs to a spot, where a 'decision variable' is defined. Each choice has defined a condition for the decision variable. AA prints only FIRST choice, which satisfy the conditions. After evaluation of the chioce (printing the output), AA continues with the spot on higher level of the sitetree.
You can use regular expressions in the conditions. You can also combine the condition for more than one 'decision' variable. The conditions are joined by the logical AND operator.
You can use not only HTML cote in the spots, but you can incorporate here the outputs from any slice. The slice output is always controlled by view in site module (we do not use Fulltext or Index in site module). To include slice output use the following construct:
{view.php3?vid=353}
This includes in the output the result of view number 353. Although the {view.php3...} is just language construct (it have only a little to do with view.php3 file), we can use all the well known parameters we know from view.php3. So, the following example is the one, we surely use in our site for displaying the fulltext of the item x:
{view.php3?vid=217&cmd[217]=x-217-{x}}
As you see from the example, we can use another language construct {x}, which is substituted by the content of variable x (x is the state variable defined in 'main control file' in $apc_state array).
|
Syntax |
description |
|---|---|
|
{<variable>} |
Returns content of variable (like {w}) |
|
{view.php3?vid=<vid>&<view parameters>} |
Returns content of view <vid>. View uses the <view parameters> just like the view.php3 script. (like {view.php3?vid=122&cmd[122]=c-1-{f}} ) |
|
{switch(var1,var2,..)val1,val2,..:<printed text1>:val1,val2,..:<printed text2>} |
Returns <printed text1> or <printed text2> or ... based on conditions val1,val2 for variables var1, var2, ... The only first matching text is printed. You can use regular expressions in conditions. (like {switch(w)z:News:e:Econnect:.*:NGO} ) |
|
{# any text} |
Comments – no output is printed |
The construct could be nested – the level of nesting is unlimited.
If you are using highlight field for displaying items on homepage and you want to allow people to be able to switch the highlight on and of quickly, then Live checkbox is the solution for you. It allows you to display checkbox directly in Item Manager, so users just check or uncheck in there. They do not need to go in item editing page and edit each item.
How to set it upWarning: Access denied for user: 'aadbuser@xxxxx' (Using password: YES) in /usr/local/web/phplib/db_mysql.inc on line 73 Database error: pconnect(xanadu.cyborganic.org, aa-user, $Password) failed. MySQL Error: 0 () Please contact foobar@somewhere.com and report the exact error message. Session halted.
Typically this means that the DB_HOST, DB_USER, DB_PASSWORD, DB_NAME setup during editing config.php3 in Install 4.1 don't match the one you gave permissions to in Install4.2. In particular note that if the DB_HOST is absolute e.g. "aa.apc.org" then the permissions are going to have to include the machine name that the Apache server runs on e.g. aadb@bigserver
ActionApps empower anyone to publish online, saving you the money you'd normally spend on web specialists (or training). ActionApps also make your team more efficient—since the people who create your group's information can publish it online themselves. Finally, ActionApps' Content Pooling technology, by letting you trade articles with partner sites, helps you access new content (theirs) and new audiences (for yours). About ActionApps presents more about benefits, while Strategic Uses offers tips on adapting ActionApps to your own needs.Web Networks' case studies can be viewed here
Also see our growing list of ActionApps examples
In Slice admin interface form for configuring fields there is an input box for parameters of insert function. For field with insert function "File = uploaded file", you can set these parameters:
type of file : maximum image width : maximum image height : secondary image fields delimited with ## separator
Example:
if you insert parameters:
image/*:450:600:image.....1##image......2
function will do these actions after submitting the item/article:
Limits of the function:
When we setting up aliases for database field on se_fields.php3 page, we sometimes need to change the behavior of alias in som way or we need to pass some parameter for alias handling function such as f_f. The Parameters field is the right place, how to do it. The list of parameters for each alias function follows.
In some cases we need to pass more than one parameter to alias function. In such case the aliases are separated by colon character. If we need to use colon inside parameter, we just use #: string instead of : character.
| Function | Parameter | Description |
| f_x | transformation | |
| content value (pairs) pairs | the content of the field and the value to return, the content can be a regular expression as in http://www.php.net/manual/en/ref.regex.php | |
| default | value returned if no match | |
| f_0 | null function (nothing shown) | |
| none | ||
| f_h | print field content due to html flag set (escape html special characters or just print) | |
| delimeter | if delimeter parameter is specified, the field with multiple values are displayed as list, delited by delimeter | |
| f_d | prints date in user defined format | |
| format | format string just like in PHP (like "m-d-Y") - see PHP manual | |
| f_i | prints image scr (<img src=...) - NO_PICTURE for none (the functionality of this alias function can be created as conditional f_c function as well) | |
| none | ||
| f_n | unpacked id | |
| none | ||
| f_g | prints image height atribut (img height=...) or clears it (the functionality of this alias function can be created as conditional f_c function as well) | |
| none | ||
| f_w | prints image width atribut (<img width=...) or clears it | |
| none | ||
| f_a | prints abstract or grabed fulltext text field | |
| length | length - number of characters taken from field_id (like "80:full_text.......") | |
| field_id | id of fulltex field | |
| f_f | prints link to fulltext (hedline url) | |
| link_only | field id (like "link_only.......") where switch between external and internal item is stored | |
| redirect | url of another page which shows the content of item (like "link_only.......:http#://www.ecn.cz/articles/solar.shtml") (note the #: in previous example!) this page should contain SSI include ../slice.php3 of course | |
| f_b | prints text with link to fulltext - more general version of f_f function param: link_only:url_field:redirect:txt:condition_fld (hedline url) | |
| link_only | field id (like "link_only.......") where switch between external and internal item is stored | |
| url_field | field id of external url for link_only (like hl_href.........) | |
| redirect | url of another page which shows the content of item (like "link_only.......:http#://www.ecn.cz/articles/solar.shtml") (note the #: in previous example!) this page should contain SSI include ../slice.php3 of course | |
| txt | if txt is field_id content is shown as link, else txt | |
| condition_fld | field id - if no content of this field, no link | |
| addition | additional parameter to <a tag (like "target=_blank") | |
| f_t | converts text to html or escape html (due to html flag) | |
| none | ||
| f_s | print database field or default value if empty (the functionality of this alias function can be created as conditional f_c function as well) | |
| default | default value (like "javascript: window.alert('No source url specified')") | |
| f_l | prints field as link, if field_id in $param is defined, else prints just field | |
| field_id | field_id of possible link (like "source_href.....") | |
| f_e | http://actionapps.org/aa/admin/itemedit.php3?AA_CP_Session=f48237b26098d261a71de80ded1c49c4&edit=1&encap=false&id=6525acb6a0ceb34e3db375618efe19f0 used on admin page index.php3 for itemedit url | |
| none | ||
| f_c | prints "begin".field."end" if field="condition", else prints "none" if no cond_col specified - this $col is used condition can be reversed (negated) by "!" character at the begin of condition param: condition:begin:end:none:cond_col | |
| condition | ||
| begin | ||
| end | ||
| none | ||
| cond_col | ||
| Example: 1:Yes<!--:-->:No This example is usable for example for Highlight field - it shows Yes or No depending on highlight field | ||
| Example: !:Email#::: If e-mail field is filled, it shows "Email: email@apc.org" (for example), but if it is not filled, it shows nothing | ||
| f_u | calls user defined function (see How to create new aliases) | |
| function | name of called function in include/usr_aliasfnc.php3 file | |
| parameter | parameters passed to function | |
| f_m | mailto link - prints: "begin<a href="(mailto:)$col">field/text</a>" if no $col is filled, prints "else_field/text" | |
| begin | text before link (for example "e-mail") | |
| field/text | if field id specified, the field is used as link text else the text is used insteed. | |
| else_field/text | if no e-mail addres specified in $col, the field content (or text) is displayed | |
| linktype | mailto / href (default is mailto) - it is possible to use this function for links, too - just type "href" as last parameter | |
| i_s | image size and other properties - as default prints: 'height="xxx" width="yyy"', where xxx and yyy are the height and width of the image in pixels. Other properties can be printed as well.
Returns empty string if it cannot determine the width or height. |
|
| information |
|
|
| f_y | Expanded string: expands the string in the parameter.
If you need use aliases in a database field. It can be used e.g. for including photographs from the slice "Photogallery" to the field "full_text......." in the slice "Articles". See an Example. |
|
| string to expand | If specified then this string is expanded, if not specified then expands the contents of the field. | |
The slice.php3 is the main script used to display items from database. The alternative for this script is view.php3. The main ussage of slice.php3 script is to include it into some .shtml file by the SSI include command - like:
<!--#includevirtual="/aaa/slice.php3?slice_id=a91256ed53287912d74495d781076bd6"-->
<!--#includevirtual="/aaa/slice.php3?slice_id=a91256ed53287912d74495d781076bd6&listlen=10&no_scr=1"-->
The slice.php3 is there from the beginning of ActionApps, so some of the parameters are quite old. Such parameters are still implemented, but in many cases it is better to use newer - more powerfull substitution for the parametr. That's why the list is prioritized from the most common parameters (which should be used) to the old parameters (which use is deprecated).
The only way, how to display data from slices, where 'Reading Password' is set. See: http://apc-aa.sourceforge.net/faq/#slice_pwd| Parameter | Required | Description |
| slice_id | Yes | id of displayed slice |
| conds[] | No | very usefull for complex conditions - see How to setup the searchform? for conds parameter setting (it can be used as url parameter too - not only form Forms, as described in search section) Example:conds[0][category........]=Environment&conds[1][category.......1]=Waste |
| defaultCondsOperator | No | replaces LIKE for conds with not specified operator - simplified syntax of conds[] uses LIKE operator as default - you can change it by this operator to RLIKE for example (RLIKE is better in many cases - at least it is much faster from database point of view) Example: defaultCondsOperator=RLIKE&conds[0][category........]=Environment |
| neverAllItems | No | if set, don't show anything when everything would be shown (if no conds[] are set) - good for search pages, where on the top (or bottom) is searchform - normaly, for the first time (when you did not send the searchform), all items are shown - if you want to have there only blank page intead, use this parameter |
| sort[] | No | see conds[] - very usefull for complex sorting Example:sort[0][pub_date........]=d&sort[1][headline........]=a (a ...ascending order; d ... descending order) |
| x | No | the same as sh_itm, but short_id is used instead (implemented for shorter item url (see 1767 alias)) |
| iview | No | changes the design of index item listing to the design defined in specified view. The view should be of 'Item listing' type. Example: iview=49 - listing of items generated by slice.php3 will use format-strings as defined in view No. 49 |
| fview | No | changes the design of fulltext to the design defined in specified view. The view should be of 'Fulltext view' type. Example: fview=48 - the item displayed by the slice.php3 script will use format-strings as defined in view No. 48 |
| dview | No | uses specified view for discussions instead of the one specified on 'Slice Admin' -> 'Design - Fulltext' page. (good for testing new discussion view, ...) Example: dview=18 - view 18 is used as tepmlate for discussion design in this slice |
| listlen | No | change number of listed items in compact view Example: listlen=10 |
| slice_pwd | No | Example: slice_pwd=VerySecret |
| no_scr | No | if true, no page scroller is displayed Example: no_scr=1 |
| group_n | No | displayes only the n-th group (in listings where items are grouped by some field (category, for example)) - good for display all the items of last magazine issue Example: ( group_n=1 ) |
| slicetext | No | displays just the text instead of any output - can be used for hiding the output of slice.php3 Example: slicetext=%20 |
| highlight | No | when true, shows only highlighted items in compact view Example: highlight=1 |
| als[alias] | No | user alias definition - you can define your own aliases in url (for both - slice.php3 and view.php3). Aliases names MUST!!! be 8 characters long. Don't forgot, that the alias value have to be urlencoded. Example: als[MY_ALIAS]=Summary%20Page (or maybe better: als%5BMY_ALIAS%5D=Summary%20Page) defines alias _#MY_ALIAS. If used in formatstring ('Admin - Design Index' for example), it prints 'Summary Page' |
| inc | No | for dispalying another file instead of slice data (for example some static html file) Example: inc=/contact.html |
| items[id] | No | array of items to show one after one as fulltext (ids are the long ones - see sh_itm, but there is special 'x' character before each index). Example: items[x5462876e8ab29ac95462876e8ab29ac9]=1&items[x65ac876e8a555b29543ea76e8ab29a34]=1 (doesn't matter which value is given to element (1 or 'on' or ...) - good for display of the form, where you select which item to show) |
| hidefulltext=1 | No | if you add this parameter to url, the fulltext is not shown when you go to page, where the specific item should be displayed. The discussions under the fulltext are not hidden. It is usefull, if you want to show discussions for the item on separate page. On the other hand, probably better results You can get by using fview parameter. |
| banner=2-38 | No | by this parameter you are able to display any view (38 in or case) inserted just after the second (2) item in view (number 23). The item shown in inserted view (38) is selected randomly, possibly with weight specified in weight field (number.........1) - just like in random parameter described above. If you do not want use random item (banner), use 'norandom' keyword in place of 'weight field' (good for displaying nested newsbox). See also banner parameter for view.php3. The example of included banner is on http://ecn.cz. Example: banner=2-38 or banner=2-38-number.........1 or banner=2-38-norandom |
| nocache=1 | No | URL parameter for page refresh - the items are not taken from cache (- no matter if allready cached or not). Cache is updated. |
| searchlog | No | if you add searchlog parameter to the slice.php3 script on some search page, all searches (by conds[]) are logged into database table searchlog. There are logged not only the conds[] parameters, but also the time, which database spent on the query. The access to the log is for superadministrators only, right now. You will find it on 'AA' -> 'Misc - ' page in AA admin interface (or you can look into searchlog table in the database). |
| scr_url=script_name | No | scr_url parameter is answer to problem mentioned in apc-aa-general mailinglist (apc-aa-general mailinglist). If you try to include the slice.php3 into your php3 script by calling include("http://www.sitename.org/apc-aa/slice.php3...");, the page scroller do not work, becouse the called script (slice.php3) do not know from which script it was called. But the scroller should know it - scroller should point to the same page - to the calling one. By scr_url parameter you can define the name of calling script. Example: include("http://www.sitename.org/apc-aa/slice.php3?...&scr_url=%2Fscripts%2Findex.php"); ('%2F' stands for ' / ' character). |
| sh_itm | No | id of item to show - if specified, selected item is shown in full text Example: index.shtml?sh_itm=01ac1b10fae13c0a61c5292ba72d70b1 |
| restrict | No | field id used with "res_val" and "exact" for restricted output (display only items with "restrict" field = "res_val" Example:restrict=category........&res_val=Environment&exact=1 |
| res_val | No | see restrict |
| exact | No | if set, restrict field must match res_val exactly (=) otherwise substring is sufficient (LIKE '%res_val%') |
| order | No | order field id - if other than publish date add minus sign for descending order Example: order=headline........- |
| timeorder | No | if rev - reverse publish date order (less priority than "order") Example: timeorder=rev |
| scr_go | No | sets page scroller to specified page Example: scr_go=2 |
| encap | Yes for not encapsulated | determines wheather this file is SSI included to .shtml file (<--#include virtual="... ) or called directly as slice.php3 Example:encap=false |
| cat_id | No | select only items in category with id cat_id Deprecated - better to use restrict and res_val parameters - or even better conds[] parameter |
| cat_name | No | select only items in category with name cat_name as substring Deprecated - better to use restrict and res_val parameters - or even better conds[] parameter |
| srch | No | true if this script have to show search results Not supported from AA v1.5 |
If you find no alias function is good enough for you, you can write your own. function. The alias functions are stored in include/item.php3 file and its names begins with f_ (but we can name it as g_* or such, as well) and they are three letters long (just like f_a()).
All you have to do for new function is:
If you find, that the new alias function is very proprietary (it is unusable for other people, you can create file /include/usr_aliasfnc.php3, which is automaticaly included to code (if exists). There you can define your own alias functions. The function name must be prefixed by 'usr_' prefix. The function have three parameters:
<?php //usr_aliasfnc.php3
/** Prints czech date (for Ekolist pages)
* @param columns - array of all field values for all ifelds in current item
* @param col - fileld id of field, for which the alias is defined
* @param param - possibly parameters to alias function passed in alias definition parameter (usr_cz_date:parameter)
*/
function usr_cz_date($columns, $col, $param="") {
$dte = $columns[$col][0][value];
$month = array( 1 => "ledna", "unora", "brezna", "dubna", "kvetna", "cervna", "cervence", "srpna", "zari", "rijna", "listopadu", "prosince");
$weekday = array("nedele","pondeli","utery","streda","ctvrtek","patek","sobota");
$m = $month[ date("n", $dte)];
$end = ( !$param ? "" : " (". $weekday[ date("w", $dte) ]. ")");
return date("j", $dte) .". $m ". date("Y", $dte). $end;
}
?>
Such alias function can be called by defining new alias for some field. Just define alias name (as obvious), alias function should be "f_u - user function" and the parameter should be the name of the function ("usr_cz_date" in our example). It is possible to pass parameters to the function. The parameters are separated by colon (usr_cz_date:parameters).
The script cron.php3 - similar to Unix cron - is able to run PHP scripts on given time. If you want to send e-mail notifications if some condition is satisfied or if you want to exchange items between slices regularly, you will find it useful.
The reason for this script to exist is that it's not easy to run PHP scripts by the Unix cron. It also allows us to use admin interface (AA -> Misc - Cron) to add/modify new tasks to run.
If you want to run some task on given time (like running admin/xmlclient.php3
for Cross Server Item Exchange each 15 minutes), you have to do two steps:
The task you can set/edit on cron admin page (AA -> Misc - Cron). The fields (their names are taken from PHP getdate()) have the following meaning: Let's call time units all from: minutes, hours, mday (month day, 1-31), month, wday (week day, 0-7, where 7 and 0 both mean Sunday). You may use three-letter month and week day names (like "jan","feb","sun","mon"). A time unit may be set to:
| * | not set - jump over this field |
| 10 | number: run only when time unit equals |
| 1-5 | range: run when time unit equals 1 or 2 or 3 or 4 or 5 |
| 0-59/15 | range with step: run when time unit (minutes in this case) equals 0 or 15 or 45 |
| 5,15-25/5,40 | you may combine numbers, ranges and ranges with steps, separated by comma |
The task table is allready prefilled on APC ActionApps setup, so you should see something like:
time script params * 1 * * * misc/alerts/alerts.php3 howoften=daily&lang=en (Alerts - daily diggest) * 1 * * 1 misc/alerts/alerts.php3 howoften=weekly&lang=en (Alerts - weekly diggest) * 1 1 * * misc/alerts/alerts.php3 howoften=monthly&lang=en (Alerts - monthly diggest) * 1 * * * misc/alerts/admin_mails.php3 (Alerts - sending of subscription e-mails,...) * 8,23,38,53 * * * admin/xmlclient.php3 (CSN - Item Exchange)(it is just an example - the set of task could be changed in next release of ActionApps)
This must be done by a system administrator (i.e. someone with root shell access), but only has to be done once no matter how many task are sheduled then.
In order we can shedule tasks from ActionApps we must run periodicaly the script cron.php3 (based in root apc-aa install directory). It is not so easy to start php scripts directly from unix cron, that's why you should use aa-http-request shell script (based in misc/ directory), which will start cron.php3 script for you.
The instructions for setup of the aa-http-request script is also inside the script. For setup
follow the nex few steps:
Requirements for ActionApps Unix Hosting
Optional:
Please add your comments below about AA installs that have and have not worked for you...
Here are some links you may find useful and interesting: The applications in v1.5+ can be created quite easy.
To edit a file, you should work on a copy of the full APC-AA distribution, make changes and then check back the changed files
To check out the whole of apc-aa into some directory or other, you need to do it differently from the standard installation instructions if you plan on editing files.
The first time you use a particular CVS host you need to do ....
$ ssh yourusername@cvs.apc-aa.sourceforge.net
It should log you in, and straight out again (accept the host key if it asks
you to)
$ export CVS_RSH=ssh #for bash for example
or
setenv CVS_RSH ssh # for tcsh for example
$ cvs -z3 -d:ext:yourusername@cvs.apc-aa.sourceforge.net:/cvsroot/apc-aa co apc-aa
yourusername@cvs.apc-aa.sourceforge.net's password:
If it doesn't ask for a password, but you get an error about connection refused its probably because it didn't see the CVS_RSH environment variable.
Edit the file, then
If the file is not already in the CVS repository, for example, because you have created a new file, then first add it to CVS with
$ cvs add myfile.htm
then upload with for example
$ cvs commit myfile.htm
Make sure to put in a useful comment when prompted by CVS.
Note, Its best NOT to do a plain
$ cvs commit
As this will commit files that you probably don't want to, especially config.php3
If you get the error:
Could not chdir to home directory /home/users/y/yo/yourusername:
No such file or directory
cvs [server aborted]: can't chdir(/home/users/y/yo/yourusernameNo such file
or directory
Then you need the ssh trick.
You can't use pserver: to check the files out, if you are going to commit them back again.
Yes - this works fine, (main) developer 2.1.0
stable 2.0.1
Production systems will probably want to work with 2.0.1, although 2.1.0 is fairly stable.
In theory, to discover which version you are using, look in "CHANGES", for example apc-aa.sourceforge.net/aa/CHANGES shows that Sourceforge is still running the stable branch, but note that CHANGES is frequently NOT updated to show the version number of the developer version, and the current developer version shows the same version 2.0.1 with just a few more dated changes.
If you check out the default method:
cvs -z3 -d:ext:yourusername@cvs.apc-aa.sourceforge.net:/cvsroot/apc-aa -r2_0_1
co apc-aa
OR
cvs -d:pserver:anonymous@cvs.apc-aa.sourceforge.net:/cvsroot/apc-aa co -rv2_0_1
apc-aa
you will get the developer branch, but
cvs -z3 -d:ext:yourusername@cvs.apc-aa.sourceforge.net:/cvsroot/apc-aa co apc-aa
OR
cvs -d:pserver:anonymous@cvs.apc-aa.sourceforge.net:/cvsroot/apc-aa co apc-aa
Note that you cannot assume that different branches will run with the same Database.
In particular to upgrade from 2.0.1 to 2.1.0 you need to run sql_update.php3 to upgrade the database fields.
If you are unable to edit php.ini, then you won't be able to change the include path to point at PHPLIB, in this case edit the APC-AA/include/config.php3 to add the following lines.The action apps software uses the mysql database engine to store its data. The mysql database system is very very reliable.
If the server is interrupted in the middle of a transaction, it can corrupt the database. For example, the servers at SangoNet had a power failure, and one of the mysql tables got corrupted. This shows itself in the actionapps by one of the pages not working and reporting a mysql error about a corrupted database.
It is usually easy to fix a mysql database that has been corrupted. In this case, I just went to /var/mysql (where databases are stored) and checked to see if there were any errors. Mysql uses a program called isamchk to detect and fix errors. This command checks to see if any of the table in any of the databases is corrupted:
/var/mysql > isamchk -s */*.ISM
In this case, the aadb/pagecache.ISM file had two errors. So I ran isamchk in recover mode to fix pagecache.ISM:
/var/mysql > isamchk -r aadb/pagecache.ISM
There was changed behavior of string removing in AA v2.6. Now we use much easier steps:
Removing of stings works before alias substitution - it never replaces the text filled by user in the field. If you have
=> _#HEADLINE (_#AUTHOR##)
and remove string "()", than it first looks for empty alias content and then removes such aliases.
Let _#HEADLINE = "Hi Ann"
and _#AUTHOR## = "" (empty)
In first step the emtpty aliases are removed:
=> _#HEADLINE ()
Then the "remove strings" are removed:
=> _#HEADLINE
and then the remaining aliases are substituted.
IIS is not a supported platform for APC-AA or at least it is not tested on this platform. There were some limitations in IIS v4.0 (I'm not sure, how it is in v5.0), which makes AA half-usable. There was a problem of not passing url parameters
to a script, which is included by SSI include into an shtml page.
The requirements are on:
<a href="http://apc-aa.sourceforge.net/apc-aa/doc/install-2.html">apc-aa.sourceforge.net/apc-aa/doc/install-2.html</a>
APC-AA is tested at least on Linux/Apache+MySQL+PHP and on Win98/Apache+MySQL+PHP (as a home developer installation).
The easiest way how to run AA on home Windows machine is to install PHPTriad (Apache, MySQL, PHP), which is really easy, see <a href=http://www.phpgeek.com>www.phpgeek.com</a>
The ? only shows if their is a URL in the morehelp field. This is setup automatically to be http://aa.ecn.cz/aa/doc/help.html.
You can remove it on fields individually via Admin->Fields->anyfield -> More help and deleting the text which is there.
If you are too lazy to do this on every field, then ask your system administrator to run:
UPDATE field SET input_morehlp='' WHERE input_morehlp = 'http://aa.ecn.cz/aa/doc/help.html'
For future refence, the function that creates this link to help is in include/formutil.php3 : function PrintMoreHelp
Sure - here is a little example that shows how to write a little Perl program to execute and return a SQL string.(c) Jakub Adámek, Econnect, January 2003
Since January 17 2003 AA is using the mini-gettext language environment. The
language files are in the directory include/lang/.
Each file is connected with one language and a series of PHP scripts. At run-time,
you can only use one file for translations at a time, but you can change freely
between files by using the bind_mgettext_domain() function in
include/mgettext.php3.
The files are maintained by people — translators and by the PHP function
xmgettext() in misc/mgettext/xmgettext.php3. Translators
add new translations and xmgettext() adds new strings to be translated which
it finds in the source files.
To add new translations, you only need to find empty strings ""
in your language files, e.g. $_m["not yet translated"] = "".
Please mind some following notes.
The language files are regular PHP files, you must not break the syntax. You must not change the ID string in _m["..."]. Even if it contains bad English, it may be changed only in the source code, not in the language file. There is also an English translations file, thus small changes may take place there.
You must follow the PHP syntax for strings, using \" and
\$ instead of " and $. You must quote the
translation with "". (You might quote it with single quotes as
well, but next time xmgettext() will be run, it will reformat
all strings to double quotes.)
Each language string is preceded by links to source code where it is used.
If you are not sure how to translate a string, go to the source code and have
a look. Some language strings contain parameters %1,%2 etc. which
will be replaced by some variable content at run-time. Place the parameters
appropriately in the translation.
The file begins with a list of "Unused messages" which are there only for your convenience so that you may use the text for the new translations if necessary. You can freely delete any unused messages.
Have a look at Notes for Translators. The explanation of using mini-gettext in code follows.
The simple syntax: A string becomes language string by enclosing into _m("
"), e.g.
_m("any string").
It is better to create long strings than to concatenate short ones, because translators may easier understand the meaning.
The parametrized syntax: You must not use variables in language strings. But
you can use parameters %1,%2,... with the syntax of
_m("... %1 ... %3 ... %2", array ($param1,$param2,$param3)), e.g.
_m("Click on %1 to get more help.", array ($url))or
_m("Error %1 in file %2 on line %3", array ($err,$file,$line)).
Always use the array() even when using only one parameter %1.
To update language files, use xmgettext(). Call it by the misc/mgettext/index.php3
script. Have a look on particular settings in the script. You need to provide
read-write access for PHP to language files in order to update them. Copy
them into another directory (I used ../php_rw/lang, i.e. not
a subdir of the AA installation), set permissions, run xmgettext
and copy the updated files back. A side remark: If you don't like this
overhead, just remember which overhead it took to create and copy all the
L_ language constants to new_news_lang.php3 ...
One more thing to take care of is the run-time switching between languages. If you fill in some include file a global variable with translated strings and than change language, it will remain in the old language. You must create a function returning the variable to avoid this.
Hope you will like my mgettext solution,
Jakub
Michael wrote a perl script called 'remote',( in apc-aa/misc/remote/remote)The coding standards are documented in doc/coding.html
We are moving to use phpDoc, the manual for this is at http://phpdoc.org/docs/HTMLframesConverter/default/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html, its pretty comprehensive, and there is a need for a brief version that shows how we use it - any volunteers!
Here are some hints on debugging APC-AA,With the concept of Reader management slices introduced it is important that
some data are not accessible for reading. This is achieved by setting a reading
password for slices containing sensitive data. If you fill the field "Reading
Password" in Slice Settings, you must always sent this password as a
parameter slice_pwd. This may be done by adding this parameter
to SSI includes like
<!--#include virtual="/aa/slice.php3?slice_pwd=the_password&slice_id=xy...."-->
If somebody tries to fetch read-protected data without the correct password, all fields are filled with an error message.
If you are interested, the password is prooved in the GetItemContent() function. For AA control panel pages (Item Manager and Item Edit), the function FetchSliceReadingPassword() is used.
In AA v2.6 or current CVS is introduced Reader Management slice and Auth Module. Users for Auth are stored in slice and each user is in fact slice item. So, you can create standard anonymous posting form into the "Reader manager" slice to allow user subscribtions.note, that you cannot use this if you also use the Headline URL to point to a file - you would get a link to that file instead, in this case create a new alias like ?x=1718 but with blank parameters.
Also note that inside a view, you'll need to use the URL as defined in the FAQ
The concept of Tagged IDS is simple - when we store an id in a field, we sometimes want to say something about it. the idea came from the directional/bidirectional links which in fact are not stored like that, but are used internally to store one or two uni-directional links.The File Manager enables Slice Administrators to modify their web pages on-line in the AA Control Panel. It appears only when an superadmin sets so in Slice Settings. The File Manager settings are hidden to anybody except superadmins. See File Manager Administration for more details.
Most of the features of the File Manager are very common:
If the superadmin creates some web templates, a select box "Copy template dir" appears. Templates are groups of web files which are copied to your root directory. If there is a file name conflict (a file with the same name already exists), the template is not copied and an error message appears. Rename or delete conflicting files. You can access and modify all the template files after you have copied it.
For most feeds you won't need to map them, unless you want the feed to go to Active rather than Hold bin.
To set the mapping, first create the feed in AA->RSS Feeds, then click on the feed and click Map. (or go to it directly from the AA->Mapping page.
If all you want to do is send it to the Active bin, then go to the bottom and change "Status" to "Value" and "1" (hold is "Value" and "2")
You can set quite complex feeding behavior by setting any field to "RSS field or expression" and then entering an RSS field name, or more complex expression.
Fields have a prefix and a value e.g. DC:TITLE, the allowed fields are:
| Prefix | Allowed Values | Where found in RSS |
| CHANNEL/ | title, description, language, timestamp (AA only), link | From the corresponding CHANNEL elements at the top of the feed except slice_id is from dc/identifier |
| ITEM/ | title,description,link,id, guid, pubdate | From the corresponding ITEM elements except id is from dc/identitifier) |
| DC/ | title,creator,subject,description,date,source,language,relation,coverage | From the corresponding DC elements within the ITEM |
In addition, the following syntax is supported:
| ITEM/DESCRIPTION|ITEM/TITLE | Will look for the Description, and if that is not present use the title |
| DATE(ITEM/pubdate) | Converts the specified field to a unix date |
| NOW | Uses the current date and time |
| CONTENT | Hard coded to find the content and determine if its HTML, given that the RSS standard makers keep moving things! Currently it looks in Item/encoded and and Item/items/bag/li/item/value |
| headline........ | Will look for an APC-AA field, this only works if the sending RSS feed is from APC site, in which case Inter-node feeding would be better anyway. |
This FAQ interface was developed by Jason at Commons.ca
|
| APC
ActionApps is a free software content management system initiated by
the Association for Progressive Communications (APC) APC - Internet and ICTs for social justice and development |