Commit e2c01659 authored by Gerd Schachtschneider's avatar Gerd Schachtschneider
Browse files

Init basis xataface and common folder/files

parents
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<fileExtensions>
<add fileExtension=".ini" allowed="false" />
<add fileExtension=".css" allowed="false" />
<add fileExtension=".js" allowed="false" />
</fileExtensions>
</security>
</system.webServer>
</configuration>
<?php
class tables_view_favorit {
// check login & editieren nicht erlaubt
function getPermissions($record) {
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
if ( !isset($user) ) return Dataface_PermissionsTool::NO_ACCESS();
return Dataface_PermissionsTool::getRolePermissions('READ ONLY');
}
// table read only
function getRoles(&$record) {
return 'READ ONLY';
}
function reiter__renderCell( &$record ) {
$table = $record->strval('reiter');
return '<a href="'.DATAFACE_SITE_HREF.'?-table='.$table.'">'.$table.'</a>';
}
function block__after_result_list_content() {
$url = DATAFACE_SITE_HREF."?-table=list_reiter&-action=list";
echo 'Zum hinzuf&uuml;gen setze Checkbox Favorit in der gew&uuml;nschten Tabelle <a href='.$url.'>list_reiter</a>';
}
function autoID__renderCell(&$record) {
$table = 'list_reiter';
$action = 'edit';
$field = 'autoID';
$tabID = $record->val($field);
$name = $tabID;
$url = DATAFACE_SITE_HREF."?-table=${table}&-action=${action}&${field}=${tabID}";
return '<div style="text-align:left;"><a href="'.$url.'">'.$name.'</a></div>';
}
}
?>
# nur wegen sortierung, statt in index.php
__sql__ = "SELECT lst.*, IF(vReit.reiter IS NULL, 0, 1) AS exist FROM list_reiter AS lst LEFT JOIN view_reiter AS vReit ON lst.reiter = vReit.reiter ORDER BY reiter"
[__global__]
noLinkFromListView = 1
[autoID]
noLinkFromListView = 0
widget:type = hidden
widget:label = "TabID"
#visibility:list = hidden
#visibility:browse = hidden
#visibility:find = hidden"
order = 10
[reiter]
widget:type = select
vocabulary = tables
widget:label = "Tabelle"
column:legend = "[Link]"
filter = 1
order = 20
[kategorie]
widget:type = select
vocabulary = kategorie
filter = 1
order = 30
[favorit]
widget:type = checkbox
widget:label = "Favorit"
widget:description = "F&uuml;r den schnelleren Zugriff unter dem Men&uuml;punkt 'Favorit'"
filter = 1
order = 40
[history]
widget:type = checkbox
widget:label = "Historie"
widget:description = "Soll History-Tabelle erhalten bleiben. Per Default werden alle per Cronjob gel&ouml;scht. In Views unbedeutend"
filter = 1
order = 50
[bedeutung]
widget:atts:size = 75
order = 60
[exist]
#transient = 1
visibility:list = hidden
filter = 1
order = 70
[rss]
;; entspricht disabled
[record_rss > rss]
;; entspricht disabled
[related_rss]
;; entspricht disabled
[export_xml]
;; entspricht disabled
[view_xml]
;; entspricht disabled
[related_xml > export_xml]
;; entspricht disabled
[xml_list]
;; entspricht disabled
[printable_report]
icon="{$site_url}/images/printer.png"
category=result_list_actions
description="See this product list in a printable format"
url="{$app->url('-action=printable_report')}"
;; # bestimmte Tabellen nur
;; condition="$query['-table'] == 'mpi_kosten'"
;; # nur admin darf drucken
;; permission=reports
[new_lizenz]
description = Create a new lizenz record
condition="$query['-relationship'] == 'Install'"
url = "http://mpidb.mpi-magdeburg.mpg.de/it_licman/index.php?-action=new&-table=mpi_install&instID={$record->val('tabID')}"
icon = "{$dataface_url}/images/add_icon.gif"
category = related_list_actions
permission = add new related record
<div style="padding: 5px;">
<table>
<tr>
<td rowspan = "2">
<a href="{$ENV.SERVER.HOST_URI}">
<img title="Databases {$ENV.SERVER.HOST_URI}" alt="Databases {$ENV.SERVER.HOST_URI}" src="../master/images/mpi-banner.png"/>
</a>
</td>
<td style="padding-left: 40px; font-size: 140%;" valign="bottom">
Datenbank
</td>
<td style="padding-left: 5px; font-size: 140%;" valign="bottom">
<font color="Indigo">{$ENV.APPLICATION.title|escape}</font>
</td>
</tr>
<tr>
<td style="padding-left: 40px; font-size: 140%;" valign="top">
Tabelle
</td>
<td style="padding-left: 5px; font-size: 140%;" valign="top">
<font color="Indigo">{$ENV.table_object->getLabel()|escape}</font>
</td>
</tr>
</table>
</div>
<FilesMatch "\.ini$">
Deny from all
</FilesMatch>
\ No newline at end of file
/* plan_inv und pse_inv nicht farben veraendern - Wunsch tschroed */
tr.lesser td { background-color: #FF8000;}
tr.toless td { background-color: red;}
tr.enough td { background-color: green;}
tr.equal td { background-color: yellow;}
tr.narrow td { background-color: lime;}
tr.lineY td { background-color: yellow !important;}
/*#left_column { display: none;} */
/* .portlet { display: none;} */
/* #dataface-sections-left-column { display: none;} */
[userID]
#widget:type = "hidden"
visibility:list = "hidden"
visibility:browse = "hidden"
visibility:find = "hidden"
[username]
widget:type = select
vocabulary = user
#validators:lettersonly = "1"
#validators:lettersonly:message = "Username: Only letter here allowed"
widget:label = "Username"
column:legend = "User [Ext.]"
widget:description = "Daten von User-DB (view_user ggf. anpassen)"
[password]
encryption = "sha1"
widget:description = "Is empty, the last saved password will not be overwritten"
validators:regex = "/^.{8,31}$/"
validators:regex:message = "Password: Must be between 8 and 31 characters long"
[email]
widget:type = "Static"
#widget:description = "Important, if you want receive email from system"
validators:email = "1"
validators:email:message = "Email: Must contain a valid email address"
validators:minlength = "10"
validators:minlength:message = "Email: Must have minlength of 10 chars"
[role]
#widget:label = "Permissions"
widget:type = "select"
vocabulary = "roles"
widget:label = "Berechtigung"
<?php
class tables_list_reiter {
/*
// geht leider wegen xataface parser nicht, deshalb per view
function __sql__() {
$app = Dataface_Application::getInstance();
$db = $app->_conf['_database']['name'];
return "SELECT lst.*, IF(shw.reiter IS NULL, 0, 1) AS exist FROM list_reiter AS lst LEFT JOIN ( SELECT CONVERT(table_name USING utf8) COLLATE utf8_unicode_ci AS reiter, table_type FROM information_schema.tables WHERE table_schema = '$db' AND ( table_type = 'base table' OR table_type = 'view' ))AS shw ON lst.reiter = shw.reiter";
}
*/
// loeschen nur fuer admin oder manager erlaubt
function getPermissions($record) {
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
if ( !isset($user) ) return Dataface_PermissionsTool::NO_ACCESS();
$role = $user->val('role'); // get Role from mpi_users
if ( $role == 'MANAGER' or $role == 'ADMIN') return;
return Dataface_PermissionsTool::getRolePermissions('EDIT');
}
// zeige alle noch nicht erfassten tabellen als auswahl
function valuelist__tables() {
$app = Dataface_Application::getInstance();
$db = $app->_conf['_database']['name'];
static $user = -1;
if ( !is_array($tables) ) {
$tables = array();
$res = mysql_query("SHOW FULL TABLES FROM $db WHERE NOT EXISTS ( SELECT * FROM list_reiter AS lst WHERE lst.reiter = Tables_in_$db COLLATE utf8_unicode_ci )", df_db());
if ( !$res ) throw new Exception(mysql_error(df_db()));
while ($row = mysql_fetch_row($res)) $tables[$row[0]] = $row[1].' : '.$row[0];
}
return $tables;
}
function autoID__renderCell(&$record) {
$table = 'list_reiter';
$action = 'edit';
$field = 'autoID';
$tabID = $record->val($field);
$name = $tabID;
$url = DATAFACE_SITE_HREF."?-table=${table}&-action=${action}&${field}=${tabID}";
return '<div style="text-align:left;"><a href="'.$url.'">'.$name.'</a></div>';
}
function reiter__renderCell( &$record ) {
$table = $record->strval('reiter');
if ( $record->strval('exist') == '0' ) return '<font color="red">'.$table.'</font>';
return '<a href="'.DATAFACE_SITE_HREF.'?-table='.$table.'">'.$table.'</a>';
}
function beforeSave(&$record) {
if ($record->strval('bedeutung') == NULL) {
$record->setValue('bedeutung', $record->strval('reiter'));
}
}
}
?>
-- view auf list_reiter
CREATE OR REPLACE VIEW view_favorit AS
SELECT
*
FROM
list_reiter
WHERE
favorit = '1'
ORDER BY reiter
;
-- db::list_reiter - add checkbox field 'favorit' & kateg not null
ALTER TABLE list_reiter CHANGE kategorie kategorie VARCHAR(30) NOT NULL;
ALTER TABLE list_reiter ADD favorit TINYINT(1) NOT NULL DEFAULT '0' AFTER reiter;
ALTER TABLE list_reiter CHANGE autoID autoID SMALLINT(6) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT;
ALTER TABLE list_reiter MODIFY COLUMN kategorie VARCHAR(30) NOT NULL AFTER reiter;
ALTER TABLE list_reiter CHANGE bedeutung bedeutung VARCHAR(100) NULL;
<?php
class tables_mpi_users {
function getPermissions($record) {
$user = Dataface_AuthenticationTool::getInstance()->getLoggedInUser();
// first let's deal with the case that the user is not logged in.
if ( !$user ) return Dataface_PermissionsTool::NO_ACCESS();
$role = $user->val('role');
// if ( isAdmin($role) ) return Dataface_PermissionsTool::ALL();
if ( $role == 'MANAGER' ) return Dataface_PermissionsTool::getRolePermissions('MANAGER');
if ( $role == 'ADMIN' ) return Dataface_PermissionsTool::getRolePermissions('ADMIN');
// Everybody else gets read only access to the table.
// return Dataface_PermissionsTool::getRolePermissions('READ ONLY');
return Dataface_PermissionsTool::NO_ACCESS();
}
function email__renderCell( &$record ) {
$mail = $record->strval('email');
return '<a href="mailto:'.$mail.'">'.$mail.'</a>';
}
function email__htmlValue( &$record ) {
$mail = $record->strval('email');
return '<a href="mailto:'.$mail.'">'.$mail.'</a>';
}
// Formatiere Zeitstempel auf Deutsch
function zeitstempel__display(&$record) {
if ($record->strval('zeitstempel') == NULL) return;
return date('d.m.Y', strtotime($record->strval('zeitstempel')));
}
function beforeSave(&$record) {
if ($record->strval('email') == NULL) {
$app = Dataface_Application::getInstance();
$dn = $app->_conf['_own']['dn'];
$usr = $record->strval('username');
$record->setValue('email', $usr.'@'.$dn);
}
}
}
?>
{use_macro file="Dataface_Main_Template.html"}
{fill_slot name="main_column"}
<p>Schneller Zugriff per Tastenk&uuml;rzel mit SHIFT + ALT + TASTE. Hier werden nur diese beschrieben, welche nicht durch Unterstrich gekennzeichnet werden konnten.<br>
Alle anderen mit Unterstrich sind leicht erkkennbar und werden hier nicht angezeigt. Achtung: Tastenkombinationen sind browserabh&auml;ngig!</p>
<h2 style="background-color: #DEE7EC;">Global f&uuml;r angezeigte Tabelle</h2>
<dl>
<dt><u>H</u>otkeys</font></dt>
<dd>[Shift + Alt + h] &nbsp;&nbsp;&nbsp; <i>Diese Hilfeseite</i></dd>
<dt><font color="indigo"><u>S</u>uche</font></dt>
<dd>[Shift + Alt + s] &nbsp;&nbsp;&nbsp; <i>Suche in aktueller Tabelle</i></dd>
<dt>Reiter "<font color="indigo"><u>l</u>iste</font>"</dt>
<dd>[Shift + Alt + l] &nbsp;&nbsp;&nbsp; <i>Zeige alle Datens&auml;tze der aktuellen Tabelle</i></dd>
<dt>Reiter "<font color="indigo"><u>f</u>inden</font>"</dt>
<dd>[Shift + Alt + f] &nbsp;&nbsp;&nbsp; <i>Suche nach mehreren Kriterien</i></dd>
<dt>Icon "Drucker"</dt>
<dd>[Shift + Alt + p] &nbsp;&nbsp;&nbsp; <i>Drucke angezeigter Datens&auml;tze aus, es erfolgt eine Voransicht der druckbaren DS</i></dd>
</dl>
<h2 style="background-color: #CDE2A7;">Global f&uuml;r angezeigten Datensatz</h2>
<dl>
<dt>Reiter "<font color="indigo">Details</font>"</dt>
<dd>[Shift + Alt + b] &nbsp;&nbsp;&nbsp; <i>Zeige obersten (bei Listennsicht) Datensatz im Anzeige-Modus</i></dd>
<dt>Reiter "<font color="#578308"><u>n</u>euer Datensatz</font>"</dt>
<dd>[Shift + Alt + n] &nbsp;&nbsp;&nbsp; <i>Neuer Datensatz in aktueller Tabelle</i></dd>
<dt>Reiter "<font color="#578308"><u>a</u>lle zeigen</font>"</dt>
<dd>[Shift + Alt + a] &nbsp;&nbsp;&nbsp; <i>Alle Datens&auml;tze in Listenansicht anzeigen</i></dd>
<dt>Reiter "<font color="#578308">gruppe kopieren</font>"</dt>
<dd>[Shift + Alt + c] &nbsp;&nbsp;&nbsp; <i>Markierte oder angezeigte Datens&auml;tze kopieren</i></dd>
<dt>Reiter "<font color="#578308">l&ouml;schen</font>"</dt>
<dd>[Shift + Alt + d] &nbsp;&nbsp;&nbsp; <i>Markierte oder angezeigte Datens&auml;tze l&ouml;schen</i></dd>
<dt>Reiter "<font color="#578308">gruppe aktualisieren</font>"</dt>
<dd>[Shift + Alt + u] &nbsp;&nbsp;&nbsp; <i>Markierte oder angezeigte Datens&auml;tze bearbeiten</i></dd>
<dt>Reiter "<font color="indigo">ansehen</font>"</dt>
<dd>[Shift + Alt + v] &nbsp;&nbsp;&nbsp; <i>Aktuellen Datensatz im Ansichtmodus (View)</i></dd>
<dt>Reiter "<font color="indigo">&auml;nd<u>e</u>rn</font>"</dt>
<dd>[Shift + Alt + e] &nbsp;&nbsp;&nbsp; <i>Aktuellen Datensatz im Beabeitungsmodus (Edit)</i></dd>
</dl>
<!--
<h2>Individuell im Bearbeitungsmodus (&auml;ndern)</h2>
<h3 class="patient-label">Patient</h3>
<dl>
<dt>Feld: "<font color="#483D8B">Anrede:</font>"</dt>
<dd>[Shift + Alt + p] &nbsp;&nbsp;&nbsp; <i>Springe zum Auswahlfeld "Anrede"</i></dd>
<dt>Feld: "<font color="#483D8B">Plz:</font>"</dt>
<dd>[Shift + Alt + a] &nbsp;&nbsp;&nbsp; <i>Spring zum Eingabefeld "Postleitzahl"</i></dd>
<dt>Feld: "<font color="#483D8B">Kasse:</font>"</dt>
<dd>[Shift + Alt + k] &nbsp;&nbsp;&nbsp; <i>Spring zum Auswahlfeld "Kasse"</i></dd>
<dt>Feld: "<font color="#483D8B">Sonstiges:</font>"</dt>
<dd>[Shift + Alt + n] &nbsp;&nbsp;&nbsp; <i>Spring zum Eingabefeld "Sonstiges"</i></dd>
</dl>
<h3 class="rezept-label">Rezept</h3>
<dl>
<dt>Feld: "<font color="#483D8B">Ausgestellt:</font>"</dt>
<dd>[Shift + Alt + p] &nbsp;&nbsp;&nbsp; <i>Springe zum Datumfeld "Ausgestellt"</i></dd>
<dt>Feld: "<font color="#483D8B">Diagnoss:</font>"</dt>
<dd>[Shift + Alt + i] &nbsp;&nbsp;&nbsp; <i>Spring zum Eingabefeld "Diagnose"</i></dd>
<dt>Feld: "<font color="#483D8B">Begin Beh.:</font>"</dt>
<dd>[Shift + Alt + r] &nbsp;&nbsp;&nbsp; <i>Spring zum Datumfeld "Begin Beh."</i></dd>
<dt>Feld: "<font color="#483D8B">Notiz:</font>"</dt>
<dd>[Shift + Alt + n] &nbsp;&nbsp;&nbsp; <i>Spring zum Eingabefeld "Notiz"</i></dd>
</dl>
-->
{/fill_slot}
{/use_macro}
-- view auf list_reiter, weil COLLATE nicht erlaubt in xataface
-- !! achtung fuer jeden view einer datenbank eigenes TABLE_SCHAEMA !!
CREATE OR REPLACE VIEW view_reiter AS
SELECT
CONVERT(table_name USING utf8) COLLATE utf8_unicode_ci AS reiter,
table_type
FROM
information_schema.tables
WHERE
-- fuer jede db setzen
table_schema = 'mpidb_xxx_yyy' AND
( table_type = 'base table' OR table_type = 'view' )
;
-- user aus user-db
CREATE OR REPLACE VIEW view_user AS
SELECT
localID, last_name, first_name FROM mpidb_user.mpi_user
ORDER BY
localID
;
-- mpg-version ohne externe DB (licman)
CREATE OR REPLACE VIEW mpidb_mpg_licman.view_user AS
SELECT
'local' AS localID, 'version' AS last_name, 'mpg' AS first_name
ORDER BY
localID
;
-- mpg-version mit externe DB (licmann)
CREATE OR REPLACE VIEW mpidb_mpg_licman.view_user AS
SELECT
localID, last_name, first_name FROM mpidb_mpg_user.mpi_user
ORDER BY
localID
;
-- mpg-version ohne externe DB (inv)
CREATE OR REPLACE VIEW mpidb_mpg_inv.view_user AS
SELECT
'local' AS localID, 'version' AS last_name, 'mpg' AS first_name
ORDER BY
localID
;
-- mpg-version mit externe DB (inv)
CREATE OR REPLACE VIEW mpidb_mpg_inv.view_user AS
SELECT
localID, last_name, first_name FROM mpidb_mpg_user.mpi_user
ORDER BY
localID
;
[rss]
;; entspricht disabled
[record_rss > rss]
;; entspricht disabled
[related_rss]
;; entspricht disabled
[export_xml]
;; entspricht disabled
[view_xml]
;; entspricht disabled
[related_xml > export_xml]
;; entspricht disabled
[xml_list]
;; entspricht disabled
[printable_report]
icon="{$site_url}/images/printer.png"
category=result_list_actions
description="See this product list in a printable format"
url="{$app->url('-action=printable_report')}"
;; # bestimmte Tabellen nur
;; condition="$query['-table'] == 'mpi_kosten'"
;; # nur admin darf drucken
;; permission=reports
{*-------------------------------------------------------------------------------
* Dataface Web Application Framework
* Copyright (C) 2005-2006 Steve Hannah (shannah@sfu.ca)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*-------------------------------------------------------------------------------
*}{if !$ENV.APPLICATION_OBJECT->main_content_only}{define_slot name="doctype_tag"}<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">{/define_slot}
{define_slot name="html_tag"}<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{$ENV.language|escape}" lang="{$ENV.language|escape}">{/define_slot}
<head>
{if !$ENV.prefs.no_history}
{php}
$app =& Dataface_Application::getInstance();
$_SESSION['--redirect'] = $app->url('');
{/php}
{/if}
{define_slot name="html_head"}
<meta http-equiv="Content-Type" content="text/html; charset={$ENV.APPLICATION.oe}"/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>{define_slot name="html_title"}{$ENV.APPLICATION_OBJECT->getPageTitle()|escape}{/define_slot}</title>
{define_slot name="dataface_stylesheets"}<link rel="stylesheet" type="text/css" href="{$ENV.DATAFACE_URL}/plone.css"/>{/define_slot}
{define_slot name="custom_stylesheets"}<!-- Stylesheets go here -->{/define_slot}
{block name="custom_stylesheets2"}
{define_slot name="dataface_javascripts"}
<!-- Common Plone ECMAScripts -->
<script type="text/javascript" language="javascript"><!--
DATAFACE_URL = '{$ENV.DATAFACE_URL}';
DATAFACE_SITE_URL = '{$ENV.DATAFACE_SITE_URL}';
DATAFACE_SITE_HREF = '{$ENV.DATAFACE_SITE_HREF}';
//--></script>
<script type="text/javascript"
src="{$ENV.DATAFACE_URL}/plone_javascripts.js">
</script>
{if $ENV.APPLICATION.usage_mode == 'edit'}
<script type="text/javascript"
src="{$ENV.DATAFACE_URL}/js/editable.js">
</script>
{/if}
{/define_slot}
{* Add the head content that is to be inserted in the head of the document.
This was added in version 1.0 to provide an easier way to add custom
Stylesheets and javascripts to the pages.
*}
{foreach from=$ENV.APPLICATION_OBJECT->headContent item=headContent}
{$headContent}
{/foreach}
{define_slot name="custom_javascripts"}
<!-- custom javascripts can go in slot "custom_javascripts" -->
{/define_slot}
{define_slot name="head_slot"}
<!-- Place any other items in the head of the document by filling the "head_slot" slot -->
{/define_slot}
{include file="head_slot.html"}
{block name="head"}
{/define_slot}
</head>
<body onload="bodyOnload()" {block name="body_atts"}>
<link rel="alternate" href="{$ENV.APPLICATION_OBJECT->url('-action=feed&--format=RSS2.0')}"
title="RSS 1.0" type="application/rss+xml" />