This commit is contained in:
Andreas Österreicher
2011-04-01 09:52:34 +00:00
parent f658049f5b
commit 7448f4c028
8 changed files with 235 additions and 58 deletions
+29 -20
View File
@@ -27,8 +27,15 @@ require_once('../include/sprache.class.php');
require_once('../include/gruppe.class.php');
require_once('../include/xsdformprinter/xsdformprinter.php');
require_once('../include/organisationseinheit.class.php');
require_once('../include/benutzerberechtigung.class.php');
$user = get_uid();
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($user);
if(!$rechte->isBerechtigt('basis/cms'))
die('Sie haben keine Berechtigung fuer diese Seite');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
@@ -49,19 +56,33 @@ $user = get_uid();
{
mode : "textareas",
theme : "advanced",
file_browser_callback: "FHCFileBrowser"
file_browser_callback: "FHCFileBrowser",
plugins : "spellchecker,pagebreak,style,layer,table,advhr,advimage,advlink,inlinepopups,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,|,print,|,ltr,rtl,|,fullscreen",
//theme_advanced_buttons4 : "insertfile,insertimage",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "center",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
}
);
function FHCFileBrowser(field_name, url, type, win)
{
cmsURL = "<?php echo APP_ROOT;?>cms/tinymce_dms.php?type"+type;
cmsURL = "<?php echo APP_ROOT;?>cms/tinymce_dms.php?type="+type;
tinyMCE.activeEditor.windowManager.open({
file: cmsURL,
title : "FHComplete File Browser",
width: 420,
heigth: 400,
width: 550,
height: 550,
resizable: "yes",
close_previous: "no",
scrollbars: "yes",
popup_css : false
},{
window: win,
@@ -70,20 +91,6 @@ $user = get_uid();
return false;
}
</script>
<style>
ul
{
padding-left: 20px;
}
li
{
padding-left: 0px;
}
.marked
{
text-decoration: underline;
}
</style>
</head>
<body>
@@ -169,12 +176,14 @@ if(isset($_GET['method']))
$titel = $_POST['titel'];
$oe_kurzbz=$_POST['oe_kurzbz'];
$sichtbar=isset($_POST['sichtbar']);
$template_kurzbz = $_POST['template_kurzbz'];
if($content->getContent($content_id, $sprache, $version))
{
$content->titel = $titel;
$content->oe_kurzbz = $oe_kurzbz;
$content->sichtbar = $sichtbar;
$content->template_kurzbz = $template_kurzbz;
$content->updateamum=date('Y-m-d H:i:s');
$content->updatevon=$user;
@@ -337,7 +346,7 @@ function print_childs()
$content = new content();
$content->getChilds($content_id);
echo 'Die Mitglieder der folgenden Gruppen dürfen die Seite ansehen:<br><br>';
echo 'Folgende Einträge sind diesem Untergeordnet:<br><br>';
echo '
<script type="text/javascript">
$(document).ready(function()
@@ -527,7 +536,7 @@ function print_content()
$template = new template();
$template->load($content->template_kurzbz);
$xfp = new XSDFormPrinter\XSDFormPrinter();
$xfp = new XSDFormPrinter();
$xfp->getparams='?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=content';
$xfp->output($template->xsd,$content->content);
echo '</div>';
+151 -17
View File
@@ -20,6 +20,7 @@
* Karl Burkhart <karl.burkhart@technikum-wien.at>.
*/
require_once('../config/cis.config.inc.php');
require_once('../include/functions.inc.php');
require_once('../include/dms.class.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
@@ -27,7 +28,9 @@ require_once('../include/dms.class.php');
<head>
<title>FHComplete Document Management System</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../skin/fhcomplete.css" type="text/css">
<link rel="stylesheet" href="../skin/style.css.php" type="text/css">
<script type="text/javascript" src="../include/js/jquery.js"></script>
<script type="text/javascript" src="../include/tiny_mce/tiny_mce_popup.js"></script>
<script type="text/javascript">
var FileBrowserDialog={
@@ -55,46 +58,177 @@ require_once('../include/dms.class.php');
tinyMCEPopup.close();
}
};
tinyMCEPopup.onInit.add(FileBrowserDialog.init, FileBrowserDialog);
$(document).ready(function()
{
$('#divupload').hide();
});
function upload(id, name)
{
$('#divupload').show();
if(typeof(id)!='undefined')
{
$('#dms_id').val(id);
$('#ueberschrift').html('Neue Version von '+name);
}
else
{
$('#dms_id').val('');
$('#ueberschrift').html('Neue Datei:');
}
return false;
}
</script>
</head>
<body>
<?php
$kategorie_kurzbz = isset($_GET['kategorie_kurzbz'])?$_GET['kategorie_kurzbz']:'';
$user = get_uid();
$kategorie_kurzbz = isset($_REQUEST['kategorie_kurzbz'])?$_REQUEST['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/vnd.oasis.opendocument.text'=>'openoffice0.jpg',
'application/msword'=>'dotpic.gif',
'application/zip'=>'zippic.jpg',
);
if(isset($_POST['fileupload']))
{
$dms_id = $_POST['dms_id'];
$filename = uniqid();
$uploadfile = DMS_PATH.$filename;
if(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{
$dms = new dms();
if($dms_id!='')
{
if(!$dms->load($dms_id))
{
die($dms->errormsg);
}
$dms->version=$dms->version+1;
}
else
{
$dms->version='0';
}
$dms->insertamum=date('Y-m-d H:i:s');
$dms->insertvon = $user;
$dms->mimetype=$_FILES['userfile']['type'];
$dms->filename = $filename;
$dms->name = $_FILES['userfile']['name'];
$dms->kategorie_kurzbz=$kategorie_kurzbz;
if($dms->save(true))
{
echo 'File wurde erfolgreich hochgeladen. Filename:'.$filename.' ID:'.$dms->dms_id;
$dms_id=$dms->dms_id;
}
else
{
echo 'Fehler beim Speichern der Daten';
}
}
else
{
echo 'Fehler beim Hochladen der Datei';
}
}
echo '<h1>Dokument Auswählen</h1>
<table>
<tr>
<td valign="top">
<td valign="top" nowrap>
<b>Kategorie:</b><br>';
//Kategorien anzeigen
$dms = new dms();
$dms->getKategorie();
foreach($dms->result as $row)
{
if($kategorie_kurzbz=='')
$kategorie_kurzbz=$row->kategorie_kurzbz;
echo '<a href="'.$_SERVER['PHP_SELF'].'?kategorie_kurzbz='.$row->kategorie_kurzbz.'">'.$row->bezeichnung.'</a><br>';
if($kategorie_kurzbz==$row->kategorie_kurzbz)
$class='class="marked"';
else
$class='';
echo '
<a href="'.$_SERVER['PHP_SELF'].'?kategorie_kurzbz='.$row->kategorie_kurzbz.'" '.$class.'>';
echo $row->bezeichnung.'</a><br>';
}
echo '</td><td valign="top">';
echo '
</td>
<td valign="top">';
//Dokumente der Ausgewaehlten Kategorie laden und Anzeigen
$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');
echo '
<table>
<tr>';
$anzahl=0;
foreach($dms->result as $row)
{
echo '<div style="border: 1px solid black; text-align: center;">';
echo '<a href="#" onclick="FileBrowserDialog.mySubmit('.$row->dms_id.')" style="font-size: small">';
if($anzahl>2)
{
echo "
</tr>
<tr>";
$anzahl=0;
}
echo '
<td>';
echo '<a href="id://'.$row->dms_id.'/Auswahl" onclick="FileBrowserDialog.mySubmit('.$row->dms_id.'); return false;" style="font-size: small" title="'.$row->beschreibung.'">';
echo '<center>';
if(array_key_exists($row->mimetype,$mimetypes))
echo '<img src="../skin/images/'.$mimetypes[$row->mimetype].'" style="max-width: 100px">';
echo '<img src="../skin/images/'.$mimetypes[$row->mimetype].'" style="height: 15px">';
else
echo '<img src="dms.php?id='.$row->dms_id.'&notimeupdate" style="max-width: 100px">';
echo '<br>'.$row->name.'</a>';
echo '</div>';
echo '<img src="dms.php?id='.$row->dms_id.'&amp;notimeupdate" style="max-width: 100px">';
echo '<br>'.$row->name.'</a><br>';
//Upload einer neuen Version
echo '<a href="id://'.$row->dms_id.'/Upload" onclick="return upload(\''.$row->dms_id.'\',\''.$row->name.'\')" style="font-size:small">Upload</a> ';
echo '</center></td>';
$anzahl++;
}
echo '</table>';
echo '<br><a href="dms_upload.php" target="_blank">Neue Datei hochladen</a>';
echo '
</tr>
</table>
</td>
</tr>
</table>
<br>
<a href="#Upload" onclick="return upload()">Neue Datei hochladen</a>
<br><br>
<div id="divupload">
<hr>
<span id="ueberschrift"></span>
<form action="'.$_SERVER['PHP_SELF'].'" method="POST" enctype="multipart/form-data">
<input type="hidden" name="kategorie_kurzbz" id="kategorie_kurzbz" value="'.$kategorie_kurzbz.'">
<input type="hidden" name="dms_id" id="dms_id" value="">
<input type="file" name="userfile">
<input type="submit" name="fileupload" value="Upload">
</form>
</div>';
?>
</body>
</html>
+1
View File
@@ -378,6 +378,7 @@ class content extends basis_db
" titel=".$this->addslashes($this->titel).','.
" updatevon=".$this->addslashes($this->updatevon).','.
" updateamum=".$this->addslashes($this->updateamum).','.
" template_kurzbz=".$this->addslashes($this->template_kurzbz).','.
" oe_kurzbz=".$this->addslashes($this->oe_kurzbz).
" WHERE content_id='".addslashes($this->content_id)."';".
"UPDATE campus.tbl_contentsprache SET ".
+35 -13
View File
@@ -110,9 +110,22 @@ class dms extends basis_db
if($new)
{
$qry = "BEGIN;INSERT INTO campus.tbl_dms(version, oe_kurzbz, dokument_kurzbz, kategorie_kurzbz,
if($this->dms_id=='')
$dms_id="nextval('campus.seq_dms_dms_id')";
else
{
if(!is_numeric($this->dms_id))
{
$this->errormsg = 'dms_id ist ungueltig';
return false;
}
$dms_id=$this->dms_id;
}
$qry = "BEGIN;INSERT INTO campus.tbl_dms(dms_id, version, oe_kurzbz, dokument_kurzbz, kategorie_kurzbz,
filename, mimetype, name, beschreibung, letzterzugriff, insertamum, insertvon,
updateamum, updatevon) VALUES(".
$dms_id.','.
$this->addslashes($this->version).','.
$this->addslashes($this->oe_kurzbz).','.
$this->addslashes($this->dokument_kurzbz).','.
@@ -147,14 +160,23 @@ class dms extends basis_db
{
if($new)
{
$qry = "SELECT currval('campus.seq_dms_dms_id') as id;";
if($result = $this->db_query($qry))
if($this->dms_id=='')
{
if($row = $this->db_fetch_object($result))
$qry = "SELECT currval('campus.seq_dms_dms_id') as id;";
if($result = $this->db_query($qry))
{
$this->dms_id = $row->id;
$this->db_query('COMMIT;');
return true;
if($row = $this->db_fetch_object($result))
{
$this->dms_id = $row->id;
$this->db_query('COMMIT;');
return true;
}
else
{
$this->errormsg='Fehler beim Auslesen der Sequence';
$this->db_query('ROLLBACK');
return false;
}
}
else
{
@@ -165,9 +187,8 @@ class dms extends basis_db
}
else
{
$this->errormsg='Fehler beim Auslesen der Sequence';
$this->db_query('ROLLBACK');
return false;
$this->db_query('COMMIT;');
return true;
}
}
else
@@ -231,10 +252,11 @@ class dms extends basis_db
*/
public function getDocuments($kategorie_kurzbz)
{
$qry = "SELECT * FROM (
SELECT distinct on(dms_id) *
$qry = "SELECT * FROM campus.tbl_dms where (dms_id, version) in(
SELECT dms_id, max(version)
FROM campus.tbl_dms
WHERE kategorie_kurzbz='".addslashes($kategorie_kurzbz)."') as a
WHERE kategorie_kurzbz='".addslashes($kategorie_kurzbz)."'
GROUP BY dms_id)
ORDER BY name;";
if($result = $this->db_query($qry))
+9 -6
View File
@@ -17,7 +17,7 @@
*
* Authors: Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>
*/
namespace XSDFormPrinter;
//namespace XSDFormPrinter;
class XSDFormPrinter
{
@@ -28,7 +28,7 @@ class XSDFormPrinter
public function __construct()
{
$this->loadDefaultConfiguration();
require_once(__DIR__.'/types.php');
require_once(dirname(__FILE__).'/types.php');
}
/**
@@ -38,10 +38,10 @@ class XSDFormPrinter
*/
public function output($xsd, $xml)
{
$dom = new \DOMDocument();
$dom = new DOMDocument();
$dom->loadXML($xsd);
$this->xml_inhalt = new \DOMDocument();
$this->xml_inhalt = new DOMDocument();
$this->xml_inhalt->loadXML($xml);
if($dom===false)
@@ -94,7 +94,7 @@ class XSDFormPrinter
private function loadDefaultConfiguration()
{
require_once(__DIR__.'/config.inc.php');
require_once(dirname(__FILE__).'/config.inc.php');
}
/**
@@ -225,7 +225,10 @@ class XSDFormPrinter
//ToDo: Create a Unique reproduceable fieldid
$fieldid = $this->config['PREFIX'].'FIELD_'.$name;
$validatefunction = $this->createValidation($fieldid, $factory[$type][1]);
$value = $this->xml_inhalt->getElementsByTagName($name)->item(0)->nodeValue;
if($this->xml_inhalt->getElementsByTagName($name)->item(0))
$value = $this->xml_inhalt->getElementsByTagName($name)->item(0)->nodeValue;
else
$value='';
$output['html'].=sprintf($this->types[$ftype],$name, $fieldid,$validatefunction, $value);
$output['html'].= '</td>';
$output['html'].= '</tr>';
+5 -1
View File
@@ -28,4 +28,8 @@
{
color: green;
}
.marked
{
text-decoration: underline;
}
+4
View File
@@ -146,6 +146,10 @@ a
color: #008381; text-decoration: none;
cursor: pointer;
}
a:hover
{
color: Black; text-decoration: none;
}
a.ItemTesttool
{
color: #008381;
+1 -1
View File
@@ -2275,7 +2275,7 @@ $tabellen=array(
"public.tbl_firmatag" => array("firma_id","tag","insertamum","insertvon"),
"public.tbl_funktion" => array("funktion_kurzbz","beschreibung","aktiv","fachbereich","semester"),
"public.tbl_geschaeftsjahr" => array("geschaeftsjahr_kurzbz","start","ende","bezeichnung"),
"public.tbl_gruppe" => array("gruppe_kurzbz","studiengang_kz","semester","bezeichnung","beschreibung","sichtbar","lehre","aktiv","sort","mailgrp","generiert","updateamum","updatevon","insertamum","insertvon","ext_id","orgform_kurzbz","gid"),
"public.tbl_gruppe" => array("gruppe_kurzbz","studiengang_kz","semester","bezeichnung","beschreibung","sichtbar","lehre","aktiv","sort","mailgrp","generiert","updateamum","updatevon","insertamum","insertvon","ext_id","orgform_kurzbz","gid","content_visible"),
"public.tbl_kontakt" => array("kontakt_id","person_id","kontakttyp","anmerkung","kontakt","zustellung","updateamum","updatevon","insertamum","insertvon","ext_id","standort_id"),
"public.tbl_kontaktmedium" => array("kontaktmedium_kurzbz","beschreibung"),
"public.tbl_kontakttyp" => array("kontakttyp","beschreibung"),