Simple Groupware Data Export and URL syntax
Simple Groupware stores its data on the database and the hard disk. In order to use the data together with other programs and systems, you can export datasets to other file formats.
Supported file formats
- HTML
- CSV
- XML
- RSS (used for news feeds)
- iCalendar (used for appointments)
- vCard (used for contacts)
- LDIF (LDAP data interchange format)
- Spreadsheet (used in OpenOffice Spreadsheet / MS-Excel)
- Text document (used in OpenOffice Writer / MS-Word)
- Flexigrid (Javascript grid component)
Building a custom export
In order to build a custom export, you need to construct a special URL in your browser. The common base is the Simple Groupware URL:
e.g. http://your_server/sgs/bin/index.php.
There are common parameters (like folder, view, username, password) and data specific parameters (like begin, end).
Navigating through the tree, you will see that every dataset is placed in a folder. Folders can be specified as a number or a string:
e.g. folder=10 or folder=/Workspace/Mails/
You can find out the number of a folder by clicking the folder in the tree and analyzing the URL in the browser. That's the same for views. Every folder can have several views presenting the data. Most folders have the views "display" and "details". "Display" uses one row for every dataset, "details" presents the datasets in more details with one row for every property of a dataset.
If you don't specify a folder, the folder you last visited will be used. That's the same for a view.
Note: Folder strings also work with mountpoints.
When fetching data from a different source (like a news feed program), you also need to provide your credentials within the URL:
e.g. username=myusername&password=mypassword
All the parameters are added to the URL and separated with a "&". The first parameter is introduced with a "?". Also you need to specify the export format:
| export=html | HTML |
| export=csv | CSV |
| export=xml | XML |
| export=rss | RSS |
| export=icalendar | iCalendar |
| export=vcard | vCard |
| export=ldif | LDIF |
| export=calc | Spreadsheet |
| export=writer | Text document |
| export=flexigrid | Flexigrid component |
An example URL can look like this:
http://your_server/sgs/bin/index.php
?folder=/Workspace/System/Events/
&view=display
&export=rss
&username=admin
&password=mypassword
Note: To make it more readable I added line-breaks. Normally you need to write the URL in one line in your browser.
The example exports data for a news feed program. The export format used is RSS. Display is chosen as the view. The folder is /Workspace/System/Events/. Normally only a super administrator (default: user "admin") is able to read the events. Therefore we switch from anonymous access to a highly privileged user and supply username and password in the URL. By default you will see all events happened today. This can be changed with the "markdate" parameter.
| markdate=day | shows events from today |
| markdate=week | shows events from the current week |
| markdate=month | shows events from the current month |
| markdate=year | shows events from the current year |
Also you can define a custom "today":
| e.g. today=01/02/06 | use 2nd of January 2006 as today |
In order to define a custom end date, use "tomorrow":
| e.g. tomorrow=02/03/06 | use 3rd of February 2006 as end date |
An example URL to export events for the year 2006 to rss:
http://your_server/sgs/bin/index.php
?folder=/Workspace/System/Events/
&view=display
&export=rss
&today=01/01/06
&tomorrow=01/01/07
&username=admin
&password=mypassword
Note: To make it more readable I added line-breaks. Normally you need to write the URL in one line in your browser.
Filters
Entries can be filtered individually by adding a filter to the URL.
Filter syntax:
field|operator|value
Filter chaining (get datasets that match all filters):
field|operator|value||field2|operator2|value2||field3|operator3|value3
Operators:
| eq | A equal B |
| neq | A not equal B |
| lt | A lesser than B |
| gt | A greater than B |
| like | A contains B |
| nlike | A not contains B |
| starts | A starts with B |
Example: get all appointments in a folder with a special organizer
http://your_server/sgs/bin/index.php
?folder=/Workspace/System/Events/
&view=display
&export=rss
&today=01/01/06
&tomorrow=01/01/07
&username=admin
&password=mypassword
&filters=organizer|eq|johndoe
Find
The find syntax can be used to find assets in folders. This is an easy way to get a structured search over all folders.
Basic syntax
find=table|field=value[,field2=value]
Example: find a task with closed=0 (not closed) and subject equal 'test'
index.php ?view=display &find=simple_tasks|closed=0,subject=test
Example: find a contact with email containing '@doecorp.com'
index.php
?view=display
&find=simple_contacts|email~@doecorp.com
Extended syntax: limit the number of results
index.php
?view=display
&find=asset|table|limit|field=value[|field2=value2]
Example: find one contact with email containing '@doecorp.com'
index.php
?view=display
&find=asset|simple_contacts|1|email~@doecorp.com
Syntax: combining two criteria
find[]=assets|table|limit|field=value
&find[]=assets|table|limit|field2=value2
Example: find all tasks assigned to John and Mary (no limit)
index.php
?view=display
&find[]=assets|tasks||responsibles~johndoe
&find[]=assets|tasks||responsibles~marydoe
Note: To match values in select fields, you need to use the containing operator "~" or enclose the value in "¦", e.g. field~value or field=¦value¦
Short syntax for finding an asset by its ID
find=type|id
Example: find a task with ID 201
index.php
?view=display
&find=tasks|201
Note: All tables can be written as "simple_type" or just "type", e.g. "simple_tasks" or "tasks".
Syntax: find a folder
find=folder|simple_sys_tree|1|field=value
Example: find one folder named "Demo"
index.php
?view=display
&find=folder|simple_sys_tree|1|ftitle=Demo
Other parameters
Return entries with a special order:
| orderby | order entries by a special field |
| order | asc / desc: order ascending, descending |
Example: show newest entries first, order by created descending
http://your_server/sgs/bin/index.php
...
&orderby=created
&order=desc
Limit the number of entries to return:
| limit | limit number of entries returned |
| page | return a certain page of items |
Example: return 10 entries beginning with page 2, gives items 11 to 20
http://your_server/sgs/bin/index.php
...
&limit=10
&page=2
Export only datasets with a special ID:
| item[] | specify a dataset ID |
Example: return datasets with IDs 101 and 201
http://your_server/sgs/bin/index.php
...
&item[]=101
&item[]=201
Hide some fields from the output:
| hide_fields | specify a comma separated list of fields |
The name of a field corresponds to the field name in the database.
Example: return a view without the fields "Description" and "Status"
http://your_server/sgs/bin/index.php
...
&hide_fields=description,status
Parameters for downloading, locking and unlocking files
In Simple Groupware multiple files can be assigned in one dataset. Files are saved in the file system and referenced by the filename in the database. Columns referenced by simple_type "files" in sgsML can carry one or more filenames separated by the pipe symbol "|". Datasets are identified by the "item" parameter, columns are referenced by the field parameter and the position inside a column is described by "subitem" (using numeric positions like 0,1,2,etc.).
download.php allows the following parameters to download a file:
| folder | see above |
| view | see above |
| item | dataset Id |
| field | defines the column name in the dataset where the filename is stored (default: filedata) |
| subitem | defines the position inside the column element (starting with 0) |
| dispo | noinline = download file as attachment, otherwise view in browser |
| image_width, image_height | numeric values in pixel used to resize images before downloading them |
Example:
http://your_server/sgs/bin/download.php
?folder=3601
&view=details
&filename=calc.xls
&field=filedata
&item[]=101
&subitem=0
&dispo=noinline
files.php allows the following parameters to lock or unlock a file:
| folder | see above |
| view | see above |
| item | dataset Id |
| field | defines the column name in the dataset where the filename is stored (default: filedata) |
| subitem | defines the position inside the column element (starting with 0) |
| action | can be "lock" or "unlock" |
| output | can be empty to return HTTP error codes (204=success) or "sh" to get shell output (bash) or "vbs" to a message box output (visual basic script). |
Parameters for system consoles (PHP, SYS, SQL)
The system consoles are small tools to execute any kind of PHP, SQL or shell command directly within Simple Groupware.
| console=php | PHP console |
| console=sys | System console (shell like) |
| console=sql | SQL console |
| code=<data> | PHP, SQL or shell command |
| no_gui | hide the GUI, show only results |
An example URL can look like this:
https://your_server/sgs/bin/console.php
?console=sql
&no_gui
&code=select * from simple_sys_tree
&username=admin
&password=secret
Note: The system consoles are only available for the super administrator. The no_gui parameter was added in version "0.402".
Parameters for the Simple Groupware setup
The setup contains 2 steps: First, the source code gets combined with the translations. And second, the database and some directories get created and populated. The "language" parameter is defined as a short country string, e.g. "en" for English, "de" for German, "es" for Spanish, "fr" for French, etc.
The first step is run with:
http://your_server/sgs/src/index.php?lang=<language>
The second step works like this:
http://your_server/sgs/src/index.php
?install
&language=<language>
&accept_gpl=yes
&admin_user=<admin_username>
&admin_pw=<admin_password>
&db_type=<database_type>
&db_host=<database_hostname>
&db_name=<database_name>
&db_user=<database_username>
&db_pw=<database_password>
The database type is defined by the name of the PHP module: "mysql" for MySQL, "oci8" for Oracle and "pgsql" for PostgreSQL.
Parameters for previewing Wiki content
Content from the Wiki module can be previewed with:
http://your_server/sgs/bin/preview.php
?data=<wiki content>
Parameters for creating bar charts
Bar charts (like those in /Workspace/System/Statistics) can be created by using these parameters:
| type | bar |
| stat | chart title |
| style | theme |
| data | comma separated data items |
| labels | comma separated label items |
| height | height in pixel |
| width | width in pixel |
Example:
http://your_server/sgs/bin/preview.php
?type=bar
&stat=Example
&style=core
&width=550
&height=175
&data=1,2,3,4,5
&labels=a,b,c,d,e
Other functions
These parameters are used for downloading layout components, including HTTP cache headers and browser specific processing.
Download open search profile:
<sgs-url>/bin/images.php?search
Download CSS style sheet:
| css_style | theme |
| browser | browser name |
Example:
<sgs-url>/bin/images.php
?css_style=core
&browser=firefox
Download icons:
| image | filename |
| color | color |
| cfolder | <empty>/adapt |
| tree_icons | 0/1 |
Example:
<sgs-url>/bin/images.php
?image=contacts1
&color=B6BDD2
&cfolder=
&tree_icons=1
Download Javascript functions:
| <sgs-url>/bin/images.php | |
| ?functions=dl | general functions |
| ?functions_edit=dl | new/edit functions |
| ?functions_sql=dl | sql auto complete functions |
Download Javascript menu functions:
| <sgs-url>/bin/images.php | |
| ?menu=dl | menu |
| ?menu_small=dl | minimized menu |