diff --git a/cms/admin.php b/cms/admin.php index a3fd40e65..4edb324ec 100644 --- a/cms/admin.php +++ b/cms/admin.php @@ -26,6 +26,7 @@ require_once('../include/functions.inc.php'); require_once('../include/sprache.class.php'); require_once('../include/gruppe.class.php'); require_once('../include/xsdformprinter/xsdformprinter.php'); +require_once('../include/organisationseinheit.class.php'); $user = get_uid(); ?> @@ -60,7 +61,8 @@ $user = get_uid(); width: 420, heigth: 400, resizable: "yes", - close_previous: "no" + close_previous: "no", + popup_css : false },{ window: win, input: field_name @@ -110,6 +112,31 @@ if(isset($_GET['method'])) { switch($_GET['method']) { + case 'add_new_content': + $oe = new organisationseinheit(); + $oe->getAll(); + if(!isset($oe->result[0])) + die('Es ist keine Organisationseinheit vorhanden'); + + $template = new template(); + $template->getAll(); + if(!isset($template->result[0])) + die('Es ist kein Template vorhanden'); + + $content = new content(); + $content->new = true; + $content->oe_kurzbz=$oe->result[0]->oe_kurzbz; + $content->template_kurzbz=$template->result[0]->template_kurzbz; + $content->titel = 'Neuer Eintrag'; + $content->content = ''; + $content->sichtbar=false; + $content->version='0'; + $content->sprache='German'; + $content->insertvon = $user; + $content->insertamum = date('Y-m-d H:i:s'); + + $content->save(); + break; case 'rights_add_group': if(!isset($_POST['gruppe_kurzbz'])) die('Fehlender Parameter'); @@ -137,6 +164,43 @@ if(isset($_GET['method'])) $message .= 'Gruppe wurde erfolgreich entfernt'; break; + case 'prefs_save': + $content = new content(); + $titel = $_POST['titel']; + $oe_kurzbz=$_POST['oe_kurzbz']; + $sichtbar=isset($_POST['sichtbar']); + + if($content->getContent($content_id, $sprache, $version)) + { + $content->titel = $titel; + $content->oe_kurzbz = $oe_kurzbz; + $content->sichtbar = $sichtbar; + $content->updateamum=date('Y-m-d H:i:s'); + $content->updatevon=$user; + + if($content->save()) + $message.='Daten erfolgreich gespeichert'; + else + $message.=''.$content->errormsg.''; + } + else + $message.=''.$content->errormsg.''; + break; + case 'childs_add': + $content = new content(); + $content->content_id = $content_id; + $content->child_content_id = $_POST['child_content_id']; + $content->insertamum = date('Y-m-d'); + $content->insertvon = $user; + if($content->addChild()) + $message.='Daten erfolgreich gespeichert'; + else + $message.=''.$content->errormsg.''; + break; + case 'childs_delete': + $content = new content(); + $content->deleteChild($content_id, $_GET['child_content_id']); + break; default: break; } } @@ -154,7 +218,7 @@ echo ' $db = new basis_db(); echo ' -Neuen Eintrag hinzufügen +Neuen Eintrag hinzufügen

'; $qry = "SELECT * FROM ( @@ -168,18 +232,19 @@ $qry = "SELECT * FROM ( ORDER BY contentchild_id, titel"; if($result = $db->db_query($qry)) { - echo ''; + while($row = $db->db_fetch_object($result)) { - + echo ''; $content = new content(); echo ''; drawsubmenu($row->content_id); + echo ''; } - echo ''; + } echo '
'; drawmenulink($row->content_id, $row->titel); echo '
'; @@ -193,13 +258,16 @@ if(!is_null($content_id)) echo ' | Inhalt'; echo ' | Vorschau'; echo ' | Rechte'; + echo ' | Childs'; echo '
'.$message.'
'; echo '

'; switch($action) { - case 'prefs': break; + case 'prefs': + print_prefs(); + break; case 'content': print_content(); break; @@ -209,6 +277,9 @@ if(!is_null($content_id)) case 'rights': print_rights(); break; + case 'childs': + print_childs(); + break; default: break; } @@ -221,7 +292,7 @@ echo ' function drawmenulink($id, $titel) { global $content_id, $action, $sprache, $version; - echo ''.$titel.''; + echo ''.$titel.' ('.$id.')'; } function drawsubmenu($content_id, $einrueckung="  ") @@ -244,7 +315,7 @@ function drawsubmenu($content_id, $einrueckung="  ") while($row = $db->db_fetch_object($result)) { - $vorhanden[]=$row->child_content_id; + //$vorhanden[]=$row->child_content_id; echo "\n"; echo ''; echo $einrueckung; @@ -259,6 +330,130 @@ function drawsubmenu($content_id, $einrueckung="  ") } } +function print_childs() +{ + global $content_id, $sprache, $version; + + $content = new content(); + $content->getChilds($content_id); + + echo 'Die Mitglieder der folgenden Gruppen dürfen die Seite ansehen:

'; + echo ' + '; + echo ' + + + + + + + + '; + foreach($content->result as $row) + { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + echo '
IDTitel
',$row->child_content_id,'',$row->titel,' + + + +
'; + + $content = new content(); + $content->getAll(); + echo '
'; + + echo ''; + echo ''; + echo '
'; +} + +function print_prefs() +{ + global $content_id, $sprache, $version; + + $content = new content(); + if(!$content->getContent($content_id, $sprache, $version)) + die($content->errormsg); + + echo '
+ + + + + + + + + + + + + + + + + + + + + +
Titel
Vorlage + +
Organisationseinheit + +
Sichtbarsichtbar?'checked':'').'>
'; + +} + function print_rights() { global $content_id, $sprache, $version; @@ -301,22 +496,22 @@ function print_rights() echo ''; } echo ''; - - $gruppe = new gruppe(); - $gruppe->getgruppe(null, null, null, null, true); - - echo ''; - echo 'Gruppe '; - echo ''; - echo '
'; } else - echo 'Diese Seite darf von allen angezeigt werden!'; + echo 'Diese Seite darf von allen angezeigt werden!

'; + + $gruppe = new gruppe(); + $gruppe->getgruppe(null, null, null, null, true); + + echo '
'; + echo 'Gruppe '; + echo ''; + echo '
'; } function print_content() diff --git a/cms/dms.php b/cms/dms.php index 45c4db772..852eafe34 100644 --- a/cms/dms.php +++ b/cms/dms.php @@ -33,7 +33,10 @@ if(!is_numeric($id)) $doc = new dms(); if(!$doc->load($id)) die('Dieses Dokument existiert nicht mehr'); - + +if(!isset($_GET['notimeupdate'])) + $doc->touch($doc->dms_id, $doc->version); + if($handle = fopen(DMS_PATH.$doc->filename,"r")) { header("Content-type: ".$doc->mimetype); diff --git a/cms/tinymce_dms.php b/cms/tinymce_dms.php index c0f649e3f..27ae39abf 100644 --- a/cms/tinymce_dms.php +++ b/cms/tinymce_dms.php @@ -59,11 +59,42 @@ require_once('../include/dms.class.php'); - -File 1 -File 2 -File 3 -File 4 - +Dokument Auswählen + + +
+ Kategorie:
'; +$dms = new dms(); +$dms->getKategorie(); +foreach($dms->result as $row) +{ + if($kategorie_kurzbz=='') + $kategorie_kurzbz=$row->kategorie_kurzbz; + echo ''.$row->bezeichnung.'
'; +} +echo '
'; +$dms = new dms(); +$dms->getDocuments($kategorie_kurzbz); +$mimetypes=array('application/pdf'=>'pdf.ico', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'=>'word2007.jpg', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation'=>'x-office-presentation.png', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'=>'excel.gif', + 'application/zip'=>'zippic.jpg'); +foreach($dms->result as $row) +{ + echo '
'; + echo ''; + if(array_key_exists($row->mimetype,$mimetypes)) + echo ''; + else + echo ''; + echo '
'.$row->name.'
'; + echo '
'; +} +echo '
'; +echo '
Neue Datei hochladen'; +?> \ No newline at end of file diff --git a/include/content.class.php b/include/content.class.php index 1ccb3ac75..cf1babc8e 100644 --- a/include/content.class.php +++ b/include/content.class.php @@ -52,8 +52,8 @@ class content extends basis_db { parent::__construct(); } - - public function getContent($content_id, $sprache='German', $version=null, $sichtbar=true) + + public function getContent($content_id, $sprache='German', $version=null, $sichtbar=null) { if(!is_numeric($content_id)) { @@ -82,6 +82,7 @@ class content extends basis_db { $this->content_id = $row->content_id; $this->titel = $row->titel; + $this->oe_kurzbz = $row->oe_kurzbz; $this->template_kurzbz = $row->template_kurzbz; $this->sprache = $row->sprache; $this->contentsprache_id = $row->contentsprache_id; @@ -343,5 +344,198 @@ class content extends basis_db else return false; } + + /** + * Speichert zusaetzliche Informationen zum Content + */ + public function save($new=null) + { + if(is_null($new)) + $new = $this->new; + + if($new) + { + $qry = "BEGIN;INSERT INTO campus.tbl_content(template_kurzbz, oe_kurzbz, titel, updatevon, updateamum, insertvon, insertamum) VALUES(". + $this->addslashes($this->template_kurzbz).','. + $this->addslashes($this->oe_kurzbz).','. + $this->addslashes($this->titel).','. + $this->addslashes($this->updatevon).','. + $this->addslashes($this->updateamum).','. + $this->addslashes($this->insertvon).','. + $this->addslashes($this->insertamum).');'. + 'INSERT INTO campus.tbl_contentsprache(content, sprache, content_id, version, sichtbar, insertamum, insertvon) VALUES('. + $this->addslashes($this->content).','. + $this->addslashes($this->sprache).','. + "currval('campus.seq_content_content_id'),". + $this->addslashes($this->version).','. + ($this->sichtbar?'true':'false').','. + $this->addslashes($this->insertamum).','. + $this->addslashes($this->insertvon).');'; + } + else + { + $qry = "UPDATE campus.tbl_content SET ". + " titel=".$this->addslashes($this->titel).','. + " updatevon=".$this->addslashes($this->updatevon).','. + " updateamum=".$this->addslashes($this->updateamum).','. + " oe_kurzbz=".$this->addslashes($this->oe_kurzbz). + " WHERE content_id='".addslashes($this->content_id)."';". + "UPDATE campus.tbl_contentsprache SET ". + " sichtbar=".($this->sichtbar?'true':'false'). + " WHERE contentsprache_id='".addslashes($this->contentsprache_id)."';"; + } + + if($this->db_query($qry)) + { + if($new) + { + $qry = "SELECT currval('campus.seq_content_content_id') as content_id, currval('campus.seq_contentsprache') as contentsprache_id"; + if($result = $this->db_query($qry)) + { + if($row = $this->db_fetch_object($result)) + { + $this->content_id = $row->content_id; + $this->contentsprache_id = $row->contentsprache_id; + $this->db_query('COMMIT;'); + return true; + } + else + { + $this->errormsg='Fehler beim Auslesen der Sequence'; + $this->db_query('ROLLBACK;'); + return false; + } + } + else + { + $this->errormsg='Fehler beim Auslesen der Sequence'; + $this->db_query('ROLLBACK;'); + return false; + } + } + else + return true; + } + else + { + $this->errormsg='Fehler beim Speichern der Daten'; + return false; + } + } + + /** + * Laedt die Child-Contents eines Eintrages + * + * @param $content_id + */ + public function getChilds($content_id) + { + $qry = "SELECT + * + FROM + campus.tbl_contentchild + JOIN campus.tbl_content ON(tbl_content.content_id=tbl_contentchild.child_content_id) + WHERE + tbl_contentchild.content_id='".addslashes($content_id)."' + ORDER BY titel"; + + if($result = $this->db_query($qry)) + { + while($row = $this->db_fetch_object($result)) + { + $obj = new content(); + + $obj->content_id = $row->content_id; + $obj->child_content_id = $row->child_content_id; + $obj->titel = $row->titel; + + $this->result[] = $obj; + } + } + } + + + /** + * Laedt alle Content Eintraege + * + */ + public function getAll() + { + $qry = "SELECT + * + FROM + campus.tbl_content + ORDER BY titel"; + + if($result = $this->db_query($qry)) + { + while($row = $this->db_fetch_object($result)) + { + $obj = new content(); + + $obj->content_id = $row->content_id; + $obj->titel = $row->titel; + $obj->oe_kurzbz = $row->oe_kurzbz; + $obj->template_kurzbz = $row->template_kurzbz; + $obj->updateamum = $row->updateamum; + $obj->updatevon = $row->updatevon; + $obj->insertamum = $row->insertamum; + $obj->insertvon = $row->insertvon; + + $this->result[] = $obj; + } + return true; + } + else + { + $this->errormsg = 'Fehler beim Laden des Contents'; + return false; + } + } + + /** + * Loescht eine Contentzuordnung + * + * @param $content_id + * @param $child_content_id + * @return boolean + */ + public function deleteChild($content_id, $child_content_id) + { + $qry = "DELETE FROM campus.tbl_contentchild WHERE content_id='".addslashes($content_id)."' AND child_content_id='".addslashes($child_content_id)."'"; + + if($this->db_query($qry)) + { + return true; + } + else + { + $this->errormsg = 'Fehler beim Löschen der Zuteilung'; + return false; + } + } + + /** + * Fuegt eine Gruppe zu einem Content hinzu + * @return boolean + */ + public function addChild() + { + $qry = 'INSERT INTO campus.tbl_contentchild (content_id, child_content_id, insertamum, insertvon) VALUES('. + $this->addslashes($this->content_id).','. + $this->addslashes($this->child_content_id).','. + $this->addslashes($this->insertamum).','. + $this->addslashes($this->insertvon).');'; + + if($this->db_query($qry)) + { + return true; + } + else + { + $this->errormsg = 'Fehler beim Zuteilen der Gruppe'; + return false; + } + } } ?> \ No newline at end of file diff --git a/include/dms.class.php b/include/dms.class.php index 202529f94..ecd313646 100644 --- a/include/dms.class.php +++ b/include/dms.class.php @@ -174,5 +174,96 @@ class dms extends basis_db return true; } } + + /** + * Setzt die Zeit des letzten Zugriffs auf die Datei + * + * @param $dms_id + * @param $version + */ + public function touch($dms_id, $version) + { + $qry ="UPDATE campus.tbl_dms SET letzterzugriff=now() + WHERE dms_id='".addslashes($dms_id)."' AND version='".addslashes($version)."';"; + + if($this->db_query($qry)) + return true; + else + { + $this->errormsg='Fehler beim Aktualisieren der Zugriffszeit'; + return false; + } + } + + /** + * Laedt alle Kategorien + * @return boolean + */ + public function getKategorie() + { + $qry = "SELECT * FROM campus.tbl_dms_kategorie ORDER BY bezeichnung"; + + if($result = $this->db_query($qry)) + { + while($row = $this->db_fetch_object($result)) + { + $obj = new dms(); + + $obj->kategorie_kurzbz = $row->kategorie_kurzbz; + $obj->bezeichnung = $row->bezeichnung; + $obj->beschreibung = $row->beschreibung; + + $this->result[] = $obj; + } + return true; + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } + + /** + * Laedt die Dokumente einer Kategorie + * + * @param $kategorie_kurzbz + */ + public function getDocuments($kategorie_kurzbz) + { + $qry = "SELECT * FROM ( + SELECT distinct on(dms_id) * + FROM campus.tbl_dms + WHERE kategorie_kurzbz='".addslashes($kategorie_kurzbz)."') as a + ORDER BY name;"; + + if($result = $this->db_query($qry)) + { + while($row = $this->db_fetch_object($result)) + { + $obj = new dms(); + + $obj->dms_id = $row->dms_id; + $obj->oe_kurzbz = $row->oe_kurzbz; + $obj->dokument_kurzbz = $row->dokument_kurzbz; + $obj->kategorie_kurzbz = $row->kategorie_kurzbz; + $obj->filename = $row->filename; + $obj->mimetype = $row->mimetype; + $obj->name = $row->name; + $obj->beschreibung = $row->beschreibung; + $obj->letzterzugriff = $row->letzterzugriff; + $obj->insertamum = $row->insertamum; + $obj->insertvon = $row->insertvon; + $obj->updateamum = $row->updateamum; + + $this->result[] = $obj; + } + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } } ?> \ No newline at end of file diff --git a/include/template.class.php b/include/template.class.php index 5938edfc9..25ec2d8ea 100644 --- a/include/template.class.php +++ b/include/template.class.php @@ -73,5 +73,39 @@ class template extends basis_db return false; } } + + /** + * Laedt alle Templates + */ + public function getAll() + { + $qry = 'SELECT + * + FROM + campus.tbl_template + ORDER BY bezeichnung'; + + if($result = $this->db_query($qry)) + { + while($row = $this->db_fetch_object($result)) + { + $obj = new template(); + + $obj->template_kurzbz = $row->template_kurzbz; + $obj->bezeichnung = $row->bezeichnung; + $obj->xsd = $row->xsd; + $obj->xslt_xhtml = $row->xslt_xhtml; + $obj->xslfo_pdf = $row->xslfo_pdf; + + $this->result[] = $obj; + } + return true; + } + else + { + $this->errormsg = 'Fehler beim Laden der Templates'; + return false; + } + } } ?> \ No newline at end of file diff --git a/skin/cis.css b/skin/cis.css index c3175f132..e1ce3d8bb 100644 --- a/skin/cis.css +++ b/skin/cis.css @@ -592,4 +592,10 @@ td.tdvertical color: #ff0000; } .ausblenden {display:none;} -.einblenden {display:block;} \ No newline at end of file +.einblenden {display:block;} + +/* Inaktive Elemente in einem DropDown */ +option.inactive +{ + text-decoration:line-through; +} \ No newline at end of file diff --git a/skin/styles/tw.css b/skin/styles/tw.css index 587e4225d..42a1cf334 100644 --- a/skin/styles/tw.css +++ b/skin/styles/tw.css @@ -631,4 +631,10 @@ img#layout color: #ff0000; } .ausblenden {display:none;} -.einblenden {display:block;} \ No newline at end of file +.einblenden {display:block;} + +/* Inaktive Elemente in einem DropDown */ +option.inactive +{ + text-decoration:line-through; +} \ No newline at end of file diff --git a/system/checksystem.php b/system/checksystem.php index e85b5793e..e3fe06327 100644 --- a/system/checksystem.php +++ b/system/checksystem.php @@ -2081,6 +2081,13 @@ if(!@$db->db_query("SELECT content_id FROM campus.tbl_content LIMIT 1")) GRANT SELECT, INSERT, UPDATE, DELETE ON public.tbl_statistik TO web; ALTER TABLE public.tbl_gruppe ADD COLUMN content_visible boolean NOT NULL DEFAULT false; + + GRANT SELECT, UPDATE ON SEQUENCE campus.seq_contentsprache TO admin; + GRANT SELECT, UPDATE ON SEQUENCE campus.seq_contentsprache TO web; + GRANT SELECT, UPDATE ON SEQUENCE campus.seq_contentchild TO admin; + GRANT SELECT, UPDATE ON SEQUENCE campus.seq_contentchild TO web; + GRANT SELECT, UPDATE ON SEQUENCE campus.seq_content_content_id TO admin; + GRANT SELECT, UPDATE ON SEQUENCE campus.seq_content_content_id TO web; "; if(!$db->db_query($qry)) @@ -2146,6 +2153,9 @@ if(!@$db->db_query("SELECT 1 FROM campus.tbl_dms LIMIT 1")) GRANT SELECT, UPDATE, INSERT, DELETE ON campus.tbl_dms_kategorie TO admin; GRANT SELECT, UPDATE, INSERT, DELETE ON campus.tbl_dms TO web; GRANT SELECT, UPDATE, INSERT, DELETE ON campus.tbl_dms TO admin; + + GRANT SELECT, UPDATE ON SEQUENCE campus.seq_dms_dms_id TO admin; + GRANT SELECT, UPDATE ON SEQUENCE campus.seq_dms_dms_id TO web; "; if(!$db->db_query($qry))