Commit 577656c3 authored by Gerd Schachtschneider's avatar Gerd Schachtschneider
Browse files

update 1.0.02 - ablageAll

parent c3efbef4
......@@ -33,7 +33,7 @@ name = "mpidb_mpg_gfk"
[_own]
dn = "mpi-magdeburg.mpg.de"
notify = 30
version = 1.0.00
version = 1.0.02
mailto = "db-responsable@<domain>.mpg.de"
mailname = "db-admin"
......
......@@ -59,6 +59,17 @@ a#record-tabs-chemAll-link:hover,
tr.listing.odd.view_chemAll td { background-color: #d9e6f2; }
tr.listing.even.view_chemAll td { background-color: #ecf2f9; }
td.Dataface_QuickForm-label-cell.view_ablageAll,
td.Dataface_QuickForm-label-cell.ablage { background-color: #e1c09e; }
td#dataface-sections-main-column.view_ablageAll,
td#dataface-sections-left-column.view_ablageAll,
#table_selection_tabs li.nav.view_ablageAll:hover,
#table_selection_tabs li.selected.view_ablageAll,
#status-bar.view_ablageAll,
td.Dataface_QuickForm-widget-cell.view_ablageAll,
tr.listing.odd.view_ablageAll td { background-color: #f3e6d8; }
tr.listing.even.view_ablageAll td { background-color: #f9f2ec; }
/* ueberschreibt vorherige listenfarbe links */
tr.listing.odd.sand td.row-actions-cell,
......
......@@ -3,9 +3,9 @@
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Mar 10, 2016 at 08:39 AM
-- Server version: 5.5.47-0ubuntu0.14.04.1-log
-- PHP Version: 5.5.9-1ubuntu4.14
-- Generation Time: May 03, 2016 at 01:51 PM
-- Server version: 5.5.49-0ubuntu0.14.04.1-log
-- PHP Version: 5.5.9-1ubuntu4.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
......@@ -44,12 +44,86 @@ END IF;
IF ( SELECT MAX(version) FROM dataface__version ) < '1000' THEN
TRUNCATE dataface__version;
INSERT INTO dataface__version (version) VALUES ('1000');
END IF;
IF ( SELECT MAX(version) FROM dataface__version ) < '1001' THEN
INSERT IGNORE INTO list_reiter (reiter, kategorie, favorit, history, bedeutung) VALUES ('view_ablageAll', 'View', '1', '0', 'Betriebsanw. und Sicherh.-Datenbl. andere Gruppen');
CREATE OR REPLACE VIEW view_chemAll AS
SELECT
mpg.tabID AS tabID,
mpg.substanz AS substanz,
mpg.reinheit AS reinheit,
mpg.lgk AS lgk,
mpg.cmr AS cmr,
mpg.cas AS cas,
mpg.einheit AS einheit,
LPAD(mpg.bFileID, 6, '0') AS bFileID,
(SELECT file_filename FROM mpidb_mpg_chem.mpi_ablage WHERE mpg.bFileID = ablageID) AS bFilename,
LPAD(mpg.sFileID, 6, '0') AS sFileID,
(SELECT file_filename FROM mpidb_mpg_chem.mpi_ablage WHERE mpg.sFileID = ablageID) AS sFilename,
'mpg' AS gruppe,
mpg.bearbeiter AS bearbeiter,
mpg.zeitstempel AS zeitstempel
FROM mpidb_mpg_chem.mpi_chemstoff AS mpg
;
TRUNCATE dataface__version;
INSERT INTO dataface__version (version) VALUES ('1001');
END IF;
IF ( SELECT MAX(version) FROM dataface__version ) < '1002' THEN
CREATE OR REPLACE VIEW view_ablageAll AS
SELECT
LPAD(mpg.ablageID, 6, '0') AS ablageID,
mpg.kategorie AS kategorie,
mpg.bezeichnung AS bezeichnung,
mpg.file_filename AS filename,
'mpg' AS gruppe,
mpg.bearbeiter AS bearbeiter,
mpg.zeitstempel AS zeitstempel
FROM
mpidb_mpg_chem.mpi_ablage AS mpg
WHERE
mpg.kategorie = 'Betriebsanweisung' OR mpg.kategorie = 'Sicherheitsdatenblatt'
ORDER BY
filename
;
TRUNCATE dataface__version;
INSERT INTO dataface__version (version) VALUES ('1002');
END IF;
END$$
DELIMITER ;
......@@ -92,26 +166,6 @@ CREATE TABLE IF NOT EXISTS `dataface__mtimes` (
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `dataface__mtimes`
--
INSERT INTO `dataface__mtimes` (`name`, `mtime`) VALUES
('dataface__failed_logins', 1456840851),
('dataface__modules', 1456840652),
('dataface__mtimes', 1456840652),
('dataface__version', 1456840652),
('list_gefahr', 1456840652),
('list_katReiter', 1456840652),
('list_lgk', 1456840652),
('list_reiter', 1456840652),
('mpi_users', 1456840652),
('view_chemAll', 1456840652),
('view_favorit', 1456840652),
('view_gefahr', 1456840652),
('view_reiter', 1456840652),
('view_user', 1456840652);
-- --------------------------------------------------------
--
......@@ -127,7 +181,7 @@ CREATE TABLE IF NOT EXISTS `dataface__version` (
--
INSERT INTO `dataface__version` (`version`) VALUES
(1000);
(1002);
-- --------------------------------------------------------
......@@ -337,7 +391,7 @@ CREATE TABLE IF NOT EXISTS `list_reiter` (
PRIMARY KEY (`autoID`),
UNIQUE KEY `reiter` (`reiter`),
KEY `kategorie` (`kategorie`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reiterlinks fuer Xataface' AUTO_INCREMENT=11 ;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reiterlinks fuer Xataface' AUTO_INCREMENT=12 ;
--
-- Dumping data for table `list_reiter`
......@@ -353,7 +407,8 @@ INSERT INTO `list_reiter` (`autoID`, `reiter`, `kategorie`, `favorit`, `history`
(000007, 'view_favorit', 'Programmierung', 0, 0, 'Für den schnelleren Zugriff unter dem Menüpunkt ''Favorit'),
(000008, 'view_reiter', 'Programmierung', 0, 0, 'Hole alle Tabellen von Datenbank von mysql'),
(000009, 'view_gefahr', 'View', 0, 0, 'Zeige von allen Chemie-DB''s die als gefaehrlich deklarierten Chemiestoffe'),
(000010, 'view_chemAll', 'View', 0, 0, 'Zeige alle Chemiestoffe von allen Chemie-DB''s');
(000010, 'view_chemAll', 'View', 0, 0, 'Zeige alle Chemiestoffe von allen Chemie-DB''s'),
(000011, 'view_ablageAll', 'View', 1, 0, 'Betriebsanw. und Sicherh.-Datenbl. andere Gruppen');
-- --------------------------------------------------------
......@@ -382,6 +437,20 @@ INSERT INTO `mpi_users` (`userID`, `username`, `password`, `role`, `email`, `zei
-- --------------------------------------------------------
--
-- Stand-in structure for view `view_ablageAll`
--
CREATE TABLE IF NOT EXISTS `view_ablageAll` (
`ablageID` varchar(6)
,`kategorie` varchar(17)
,`bezeichnung` varchar(30)
,`filename` varchar(6)
,`gruppe` varchar(3)
,`bearbeiter` varchar(7)
,`zeitstempel` varchar(19)
);
-- --------------------------------------------------------
--
-- Stand-in structure for view `view_chemAll`
--
......@@ -393,6 +462,10 @@ CREATE TABLE IF NOT EXISTS `view_chemAll` (
,`cmr` varchar(1)
,`cas` varchar(1)
,`einheit` varchar(1)
,`bFileID` varchar(1)
,`bFilename` varchar(1)
,`sFileID` varchar(1)
,`sFilename` varchar(1)
,`gruppe` varchar(3)
,`bearbeiter` varchar(7)
,`zeitstempel` varchar(19)
......@@ -415,13 +488,13 @@ CREATE TABLE IF NOT EXISTS `view_favorit` (
-- Stand-in structure for view `view_gefahr`
--
CREATE TABLE IF NOT EXISTS `view_gefahr` (
`autoID` varchar(1)
,`tabID` varchar(1)
,`substanz` varchar(30)
,`kategorie` varchar(1)
`autoID` smallint(6) unsigned zerofill
,`tabID` smallint(6)
,`substanz` varchar(50)
,`kategorie` varchar(30)
,`gruppe` varchar(3)
,`bearbeiter` varchar(7)
,`zeitstempel` varchar(19)
,`bearbeiter` varchar(20)
,`zeitstempel` timestamp
);
-- --------------------------------------------------------
......@@ -438,18 +511,27 @@ CREATE TABLE IF NOT EXISTS `view_reiter` (
-- Stand-in structure for view `view_user`
--
CREATE TABLE IF NOT EXISTS `view_user` (
`localID` varchar(5)
,`last_name` varchar(7)
,`first_name` varchar(3)
`localID` varchar(25)
,`last_name` varchar(30)
,`first_name` varchar(30)
);
-- --------------------------------------------------------
--
-- Structure for view `view_ablageAll`
--
DROP TABLE IF EXISTS `view_ablageAll`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_ablageAll` AS select '000001' AS `ablageID`,'Betriebsanweisung' AS `kategorie`,'Fake Eintrag wenn keine chemDB' AS `bezeichnung`,'noName' AS `filename`,'mpg' AS `gruppe`,'initial' AS `bearbeiter`,'2016-04-22 11:34:18' AS `zeitstempel`;
-- --------------------------------------------------------
--
-- Structure for view `view_chemAll`
--
DROP TABLE IF EXISTS `view_chemAll`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_chemAll` AS select '1' AS `tabID`,'Fake Eintrag wenn keine chemDB' AS `substanz`,'-' AS `reinheit`,'-' AS `lgk`,'0' AS `cmr`,'-' AS `cas`,'-' AS `einheit`,'mpg' AS `gruppe`,'initial' AS `bearbeiter`,'2016-03-02 11:34:18' AS `zeitstempel`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_chemAll` AS select '1' AS `tabID`,'Fake Eintrag wenn keine chemDB' AS `substanz`,'-' AS `reinheit`,'-' AS `lgk`,'0' AS `cmr`,'-' AS `cas`,'-' AS `einheit`,'-' AS `bFileID`,'-' AS `bFilename`,'-' AS `sFileID`,'-' AS `sFilename`,'mpg' AS `gruppe`,'initial' AS `bearbeiter`,'2016-03-02 11:34:18' AS `zeitstempel`;
-- --------------------------------------------------------
......@@ -467,7 +549,7 @@ CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW
--
DROP TABLE IF EXISTS `view_gefahr`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_gefahr` AS select '1' AS `autoID`,'1' AS `tabID`,'Noch nicht mit chemDB verlinkt' AS `substanz`,'-' AS `kategorie`,'mpg' AS `gruppe`,'initial' AS `bearbeiter`,'2016-03-02 11:34:18' AS `zeitstempel`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_gefahr` AS select `mpgT1`.`autoID` AS `autoID`,`mpgT2`.`tabID` AS `tabID`,`mpgT2`.`substanz` AS `substanz`,`mpgT1`.`kategorie` AS `kategorie`,'mpg' AS `gruppe`,`mpgT1`.`bearbeiter` AS `bearbeiter`,`mpgT1`.`zeitstempel` AS `zeitstempel` from (`mpidb_mpg_chem`.`mpi_gefahr` `mpgT1` join `mpidb_mpg_chem`.`mpi_chemstoff` `mpgT2`) where (`mpgT1`.`chemID` = `mpgT2`.`tabID`);
-- --------------------------------------------------------
......@@ -485,7 +567,7 @@ CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW
--
DROP TABLE IF EXISTS `view_user`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_user` AS select 'local' AS `localID`,'version' AS `last_name`,'mpg' AS `first_name` order by 'local';
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_user` AS select `mpidb_mpg_user`.`mpi_user`.`localID` AS `localID`,`mpidb_mpg_user`.`mpi_user`.`last_name` AS `last_name`,`mpidb_mpg_user`.`mpi_user`.`first_name` AS `first_name` from `mpidb_mpg_user`.`mpi_user` where (`mpidb_mpg_user`.`mpi_user`.`active` = 1) order by `mpidb_mpg_user`.`mpi_user`.`localID`;
--
-- Constraints for dumped tables
......
......@@ -28,13 +28,76 @@ IF ( SELECT MAX(version) FROM dataface__version ) < '1000' THEN
-- ****************
-- fs::rsync - mpg_lgk initial
TRUNCATE dataface__version;
INSERT INTO dataface__version (version) VALUES ('1000');
END IF;
-- CHANGES V1.0.01 - 2016-04-25
-- ****************************
-- fs::rsync - asi policy view BA und SDB
-- db::list_reiter - add table view_ablageAll
-- db::view_chemALL - add BA und SDB anderer gruppen
IF ( SELECT MAX(version) FROM dataface__version ) < '1001' THEN
-- add table view_ablageAll
INSERT IGNORE INTO list_reiter (reiter, kategorie, favorit, history, bedeutung) VALUES ('view_ablageAll', 'View', '1', '0', 'Betriebsanw. und Sicherh.-Datenbl. andere Gruppen');
-- change view_chemAll mpg-version
-- entsprechend erweitern/anpassen, wenn mehr chemie-db's existieren
-- siehe Beispiel mpi-dcts (4db's) in ../tables/view_chemAll/view_chemAll.sql
-- fake auf sich selbst, also ohne db_chem's
CREATE OR REPLACE VIEW view_chemAll AS
SELECT
'1' AS tabID,
'Fake Eintrag wenn keine chemDB' AS substanz,
'-' AS reinheit,
'-' AS lgk,
'0' AS cmr,
'-' AS cas,
'-' AS einheit,
'-' AS bFileID,
'-' AS bFilename,
'-' AS sFileID,
'-' AS sFilename,
'mpg' AS gruppe,
'initial' AS bearbeiter,
'2016-03-02 11:34:18' AS zeitstempel
;
TRUNCATE dataface__version;
INSERT INTO dataface__version (version) VALUES ('1001');
END IF;
-- CHANGES V1.0.02 - 2016-05-03
-- ****************************
-- fs::rsync - asi policy view BA und SDB
-- db::view_ablageALL - alle duerfen BA und SDB anderer gruppen sehen
IF ( SELECT MAX(version) FROM dataface__version ) < '1002' THEN
-- add view_ablageAll mpg-version
-- entsprechend erweitern/anpassen, wenn mehr chemie-db's existieren
-- siehe Beispiel mpi-dcts (4db's) in ../tables/view_ablageAll/view_ablageAll.sql
-- fake auf sich selbst, also ohne db_chem's
CREATE OR REPLACE VIEW view_ablageAll AS
SELECT
'000001' AS ablageID,
'Betriebsanweisung' AS kategorie,
'Fake Eintrag wenn keine chemDB' AS bezeichnung,
'noName' AS filename,
'mpg' AS gruppe,
'initial' AS bearbeiter,
'2016-04-22 11:34:18' AS zeitstempel
;
TRUNCATE dataface__version;
INSERT INTO dataface__version (version) VALUES ('1002');
END IF;
END;
......
# global valuelists.ini fuer gemeinsame verwendung verlinkt innerhalb tabellen
# meist steht immer daselbe in jeder valuelists
# Vorteil:
# eine aenderung fuer alle
# alles an einem ort
# alle haben dann die gleiche Programmierung
# bessere uebersicht
# wichtige erlaeuterungen in einer datei zusammengefasst
# Nachteil:
# man muss etwas aufpassen, weil aenderung dann alle betrifft
# nach aendeerung suchen wer es benutzt und alle testen
# einfaches loeschen geht nicht so schnell
# Syntax:
# individuelle vocabularies mit eigenen Namen oder bei Gleichheit vocabulary_<table>
# Suche:
# grep -ir 'vocabulary = <>' tables/*
# Wichtiges:
# - sort (ORDER BY) nicht fuer schnellfilter moeglich
# - das OTHER... hinter dem select, verschwindet wenn man diese sql's forumliert - wahrscheinlich wegen parser
# "SELECT IFNULL(field, '--') FROM list_table ORDER BY field"
# "SELECT tab.tabID, tab.name FROM view_pc AS tab ORDER BY tab.name"
# mittlerweile auch in php mit block_after moeglich
# Beispiele:
# Mehrfachbenutzung
##
## con_softInv
## mpi_install
## mpi_inventar
## sort_lizenzSoft
## view_invInst
## view_install
##
#[version]
#__sql__ = "SELECT verID, version FROM mpi_version ORDER BY orderID"
# Einzelbenutzung
##
## con_verLic
##
#[versionCon]
#__sql__ = "SELECT ver.verID, CONCAT(soft.software,' : ',ver.version) FROM mpi_version AS ver LEFT JOIN mpi_software AS soft ON ver.softID = soft.softID ORDER BY soft.software"
# BEGIN
#
# view_chemAll
#
[vFilename]
__sql__ = "SELECT ablageID, filename FROM view_ablageAll"
# ENDE
[__global__]
noLinkFromListView = 1
[ablageID]
Key = PRI
#widget:type = "hidden"
#visibility:list = "hidden"
#visibility:browse = "hidden"
visibility:find = "hidden"
noLinkFromListView = 0
order = 1
[kategorie]
filter = 1
order = 10
[gruppe]
Key = PRI
filter = 1
order = 20
[bezeichnung]
widget:atts:size = 75
widget:label = "Bezeichnung / Charge"
order = 30
[filename]
widget:type = "static"
widget:label = "Dateiname"
column:legend = "Zugriff auf Gruppen-DB muss erlaubt sein!"
visibility:browse = visible
filter = 1
order = 40
[bearbeiter]
widget:type = "static"
visibility:find = "hidden"
filter = 1
order = 50
[zeitstempel]
noLinkFromListView = 1
visibility:find = "hidden"
order = 60
<?php
class tables_view_ablageALL {
// 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');
}
// setze indiv. Farbe in listenansicht fuer tabelle
function css__tableRowClass( &$record ) {
$query = Dataface_Application::getInstance()->getQuery();
$table = $query['-table'].' ';
// return $table.'normal'; //mit color
return $table;
}
// glanceview
function getTitle(&$record) {
return $record->strval('filename').' : '.$record->strval('bezeichnung');
}
// link nach Substanz
function substanz__renderCell( &$record ) {
$subst = $record->strval('substanz');
$tabID = $record->strval('tabID');
$subdb = $record->strval('gruppe').'_chem';
$table = 'mpi_chemstoff';
return '<div style="white-space:nowrap"><a href="/'.$subdb.'/index.php?-table='.$table.'&-action=browse&tabID='.$tabID.'">'.$subst.'</a></div>';
}
function filename__renderCell( &$record ) {
$table = 'mpi_ablage';
$field = 'ablageID';
$tabID = $record->strval($field);
$subdb = $record->strval('gruppe').'_chem';
$name = $record->strval('filename');
return '<div style="text-align:right"><a href="/'.$subdb.'/index.php?-action=getBlob&-table='.$table.'&-field=file&-index=0&'.$field.'='.$tabID.'">'.$name.'</a></div>';
}
// Zeitanzeige aendern
function zeitstempel__display(&$record) {
if ($record->val('zeitstempel') == NULL) {
return "";
} else {
return date('d.m.Y', strtotime($record->strval('zeitstempel')));
}
}
}
?>
-- version alone
-- fake auf sich selbst, also ohne db_chem's
CREATE OR REPLACE VIEW view_ablageAll AS
SELECT
'000001' AS ablageID,
'Betriebsanweisung' AS kategorie,
'Fake Eintrag wenn keine chemDB' AS bezeichnung,
'noName' AS filename,
'mpg' AS gruppe,
'initial' AS bearbeiter,
'2016-04-22 11:34:18' AS zeitstempel
;
-- version mpg mit mpg_chem
-- entsprechend erweitern/anpassen, wenn mehr chemie-db's existieren
-- siehe Beispiel mpi-dcts (4db's) in ../tables/view_chemAll/view_chemAll.sql
CREATE OR REPLACE VIEW view_ablageAll AS
SELECT
LPAD(mpg.ablageID, 6, '0') AS ablageID,
mpg.kategorie AS kategorie,
mpg.bezeichnung AS bezeichnung,
mpg.file_filename AS filename,
'mpg' AS gruppe,
mpg.bearbeiter AS bearbeiter,
mpg.zeitstempel AS zeitstempel
FROM
mpidb_mpg_chem.mpi_ablage AS mpg
WHERE
mpg.kategorie = 'Betriebsanweisung' OR mpg.kategorie = 'Sicherheitsdatenblatt'
ORDER BY
filename
;
-- version mpi-dcts
CREATE OR REPLACE VIEW view_ablageAll AS
SELECT
LPAD(bio.ablageID, 6, '0') AS ablageID,
bio.kategorie AS kategorie,
bio.bezeichnung AS bezeichnung,
bio.file_filename AS filename,
'bio' AS gruppe,
bio.bearbeiter AS bearbeiter,
bio.zeitstempel AS zeitstempel
FROM
mpidb_bio_chem.mpi_ablage AS bio
WHERE
bio.kategorie = 'Betriebsanweisung' OR bio.kategorie = 'Sicherheitsdatenblatt'
UNION ALL
SELECT
LPAD(bpe.ablageID, 6, '0') AS ablageID,
bpe.kategorie AS kategorie,
bpe.bezeichnung AS bezeichnung,
bpe.file_filename AS filename,
'bpe' AS gruppe,
bpe.bearbeiter AS bearbeiter,
bpe.zeitstempel AS zeitstempel
FROM
mpidb_bpe_chem.mpi_ablage AS bpe
WHERE
bpe.kategorie = 'Betriebsanweisung' OR bpe.kategorie = 'Sicherheitsdatenblatt'
UNION ALL
SELECT
LPAD(pcg.ablageID, 6, '0') AS ablageID,
pcg.kategorie AS kategorie,
pcg.bezeichnung AS bezeichnung,
pcg.file_filename AS filename,
'pcg' AS gruppe,
pcg.bearbeiter AS bearbeiter,
pcg.zeitstempel AS zeitstempel
FROM
mpidb_pcg_chem.mpi_ablage AS pcg
WHERE
pcg.kategorie = 'Betriebsanweisung' OR pcg.kategorie = 'Sicherheitsdatenblatt'
UNION ALL
SELECT
LPAD(pse.ablageID, 6, '0') AS ablageID,
pse.kategorie AS kategorie,
pse.bezeichnung AS bezeichnung,
pse.file_filename AS filename,
'pse' AS gruppe,
pse.bearbeiter AS bearbeiter,
pse.zeitstempel AS zeitstempel
FROM
mpidb_pse_chem.mpi_ablage AS pse
WHERE
pse.kategorie = 'Betriebsanweisung' OR pse