mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 07:52:16 +00:00
CMS-System
- Versionierung - Review und Übersetzer Benachrichtigung - News Prototyp
This commit is contained in:
+592
-90
@@ -19,6 +19,7 @@
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Karl Burkhart <karl.burkhart@technikum-wien.at>.
|
||||
*/
|
||||
session_start();
|
||||
require_once('../config/cis.config.inc.php');
|
||||
require_once('../include/content.class.php');
|
||||
require_once('../include/template.class.php');
|
||||
@@ -26,9 +27,11 @@ require_once('../include/functions.inc.php');
|
||||
require_once('../include/sprache.class.php');
|
||||
require_once('../include/gruppe.class.php');
|
||||
require_once('../include/datum.class.php');
|
||||
require_once('../include/xsdformprinter/xsdformprinter.php');
|
||||
require_once('../include/mail.class.php');
|
||||
require_once('../include/benutzerfunktion.class.php');
|
||||
require_once('../include/organisationseinheit.class.php');
|
||||
require_once('../include/benutzerberechtigung.class.php');
|
||||
require_once('../include/xsdformprinter/xsdformprinter.php');
|
||||
require_once('../include/DifferenceEngine/DifferenceEngine.php');
|
||||
|
||||
$user = get_uid();
|
||||
@@ -38,6 +41,8 @@ $rechte->getBerechtigungen($user);
|
||||
|
||||
if(!$rechte->isBerechtigt('basis/cms'))
|
||||
die('Sie haben keine Berechtigung fuer diese Seite');
|
||||
|
||||
$berechtigte_oe = $rechte->getOEkurzbz('basis/cms')
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
@@ -63,7 +68,7 @@ if(!$rechte->isBerechtigt('basis/cms'))
|
||||
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_buttons1 : "code, 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",
|
||||
@@ -71,7 +76,10 @@ if(!$rechte->isBerechtigt('basis/cms'))
|
||||
theme_advanced_toolbar_align : "center",
|
||||
theme_advanced_statusbar_location : "bottom",
|
||||
theme_advanced_resizing : true,
|
||||
|
||||
force_br_newlines : true,
|
||||
force_p_newlines : false,
|
||||
forced_root_block : ''
|
||||
|
||||
}
|
||||
);
|
||||
function FHCFileBrowser(field_name, url, type, win)
|
||||
@@ -123,12 +131,45 @@ if(!is_null($method))
|
||||
{
|
||||
switch($method)
|
||||
{
|
||||
case 'add_new_content':
|
||||
$oe = new organisationseinheit();
|
||||
$oe->getAll();
|
||||
if(!isset($oe->result[0]))
|
||||
die('Es ist keine Organisationseinheit vorhanden');
|
||||
case 'content_sperre':
|
||||
if(!isset($_GET['contentsprache_id']))
|
||||
die('Falsche Parameteruebergabe');
|
||||
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
$contentsprache_id=$_GET['contentsprache_id'];
|
||||
if(isset($_POST['sperren']))
|
||||
{
|
||||
$content = new content();
|
||||
if($content->sperren($contentsprache_id, $user))
|
||||
$message.='<span class="ok">Eintrag gesperrt</span>';
|
||||
else
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
}
|
||||
elseif(isset($_POST['freigeben']))
|
||||
{
|
||||
$content = new content();
|
||||
if($content->freigeben($contentsprache_id, $user))
|
||||
$message.='<span class="ok">Eintrag freigegeben</span>';
|
||||
else
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Unbekannte Sperre</span>';
|
||||
}
|
||||
break;
|
||||
case 'add_new_content':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'sui'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
$template = new template();
|
||||
$template->getAll();
|
||||
if(!isset($template->result[0]))
|
||||
@@ -136,12 +177,14 @@ if(!is_null($method))
|
||||
|
||||
$content = new content();
|
||||
$content->new = true;
|
||||
$content->oe_kurzbz=$oe->result[0]->oe_kurzbz;
|
||||
$content->oe_kurzbz=$berechtigte_oe[0];
|
||||
$content->template_kurzbz=$template->result[0]->template_kurzbz;
|
||||
$content->titel = 'Neuer Eintrag';
|
||||
$content->aktiv=true;
|
||||
$content->menu_open=true;
|
||||
$content->content = '<?xml version="1.0" encoding="UTF-8" ?><content></content>';
|
||||
$content->sichtbar=false;
|
||||
$content->version='0';
|
||||
$content->version='1';
|
||||
$content->sprache='German';
|
||||
$content->insertvon = $user;
|
||||
$content->insertamum = date('Y-m-d H:i:s');
|
||||
@@ -155,8 +198,77 @@ if(!is_null($method))
|
||||
else
|
||||
$message .= '<span class="error">'.$content->errormsg.'</span>';
|
||||
|
||||
break;
|
||||
case 'add_uebersetzung':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'sui'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
$content = new content();
|
||||
$content->getContent($content_id);
|
||||
|
||||
$content->new = true;
|
||||
$content->sichtbar=false;
|
||||
$content->sprache=$_POST['sprache'];
|
||||
$content->insertvon = $user;
|
||||
$content->insertamum = date('Y-m-d H:i:s');
|
||||
$content->updatevon = $user;
|
||||
$content->updateamum = date('Y-m-d H:i:s');
|
||||
$content->reviewvon='';
|
||||
$content->reviewamum='';
|
||||
$content->gesperrt_uid='';
|
||||
|
||||
if($content->saveContentSprache())
|
||||
{
|
||||
$message .= '<span class="ok">Eintrag wurde erfolgreich angelegt</span>';
|
||||
$action='prefs';
|
||||
$sprache=$_POST['sprache'];
|
||||
}
|
||||
else
|
||||
$message .= '<span class="error">'.$content->errormsg.'</span>';
|
||||
|
||||
break;
|
||||
case 'add_newversion':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'sui'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
$content = new content();
|
||||
$content->getContent($content_id, $sprache);
|
||||
$maxversion = $content->getMaxVersion($content_id, $content->sprache);
|
||||
|
||||
$content->new = true;
|
||||
$content->sichtbar=false;
|
||||
$content->reviewvon='';
|
||||
$content->reviewamum='';
|
||||
$content->version=$maxversion+1;
|
||||
$content->insertvon = $user;
|
||||
$content->insertamum = date('Y-m-d H:i:s');
|
||||
$content->updatevon = $user;
|
||||
$content->updateamum = date('Y-m-d H:i:s');
|
||||
$content->gesperrt_uid='';
|
||||
|
||||
if($content->saveContentSprache())
|
||||
{
|
||||
$message .= '<span class="ok">Eintrag wurde erfolgreich angelegt</span>';
|
||||
$action='prefs';
|
||||
$version = $content->version;
|
||||
}
|
||||
else
|
||||
$message .= '<span class="error">'.$content->errormsg.'</span>';
|
||||
|
||||
break;
|
||||
case 'rights_add_group':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
if(!isset($_POST['gruppe_kurzbz']))
|
||||
die('Fehlender Parameter');
|
||||
|
||||
@@ -173,6 +285,12 @@ if(!is_null($method))
|
||||
|
||||
break;
|
||||
case 'rights_delete_group':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
if(!isset($_GET['gruppe_kurzbz']))
|
||||
die('Fehlender Parameter');
|
||||
|
||||
@@ -184,10 +302,18 @@ if(!is_null($method))
|
||||
|
||||
break;
|
||||
case 'prefs_save':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
$content = new content();
|
||||
$titel = $_POST['titel'];
|
||||
$oe_kurzbz=$_POST['oe_kurzbz'];
|
||||
$sichtbar=isset($_POST['sichtbar']);
|
||||
$aktiv=isset($_POST['aktiv']);
|
||||
$menu_open=isset($_POST['menu_open']);
|
||||
$template_kurzbz = $_POST['template_kurzbz'];
|
||||
|
||||
if($content->getContent($content_id, $sprache, $version))
|
||||
@@ -195,6 +321,8 @@ if(!is_null($method))
|
||||
$content->titel = $titel;
|
||||
$content->oe_kurzbz = $oe_kurzbz;
|
||||
$content->sichtbar = $sichtbar;
|
||||
$content->aktiv = $aktiv;
|
||||
$content->menu_open = $menu_open;
|
||||
$content->template_kurzbz = $template_kurzbz;
|
||||
$content->updateamum=date('Y-m-d H:i:s');
|
||||
$content->updatevon=$user;
|
||||
@@ -207,7 +335,167 @@ if(!is_null($method))
|
||||
else
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
break;
|
||||
case 'prefs_reviewed':
|
||||
$bf = new benutzerfunktion();
|
||||
if($bf->benutzerfunktion_exists($user, 'review'))
|
||||
{
|
||||
$content = new content();
|
||||
$content->getContent($content_id, $sprache, $version);
|
||||
|
||||
$content->reviewamum = date('Y-m-d H:i:s');
|
||||
$content->reviewvon = $user;
|
||||
|
||||
if($content->saveContentSprache(false))
|
||||
$message.='<span class="ok">Erfolgreich reviewed</span>';
|
||||
else
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Sie dürfen kein Review durchführen</span>';
|
||||
}
|
||||
break;
|
||||
case 'prefs_requestreview':
|
||||
$content = new content();
|
||||
$content->getContent($content_id, $sprache, $version);
|
||||
|
||||
$oe = new organisationseinheit();
|
||||
$oe_arr = $oe->getParents($content->oe_kurzbz);
|
||||
|
||||
foreach($oe_arr as $organisationseinheit)
|
||||
{
|
||||
echo $organisationseinheit;
|
||||
$fkt = new benutzerfunktion();
|
||||
$fkt->getBenutzerFunktionen('review', $organisationseinheit);
|
||||
if(count($fkt->result)>0)
|
||||
break;
|
||||
}
|
||||
|
||||
if(count($fkt->result)==0)
|
||||
$fkt->getBenutzerFunktionen('review');
|
||||
$to='';
|
||||
foreach($fkt->result as $row)
|
||||
{
|
||||
if($to!='')
|
||||
$to.=',';
|
||||
$to .= $row->uid.'@'.DOMAIN;
|
||||
}
|
||||
if($to!='')
|
||||
{
|
||||
$from = 'no-reply@'.DOMAIN;
|
||||
$subject = 'CMS Review Request';
|
||||
$text = "Dies ist eine automatisch generierte E-Mail.\n\n
|
||||
Es wurde ein Review für die Seite '$content->titel' ($sprache, Version $version) angefordert.\n
|
||||
\n
|
||||
(um den Link anzuzeigen müssen Sie in die HTML Ansicht wechseln)
|
||||
\n
|
||||
\n
|
||||
Mit freundlichen Grüßen\n
|
||||
\n
|
||||
FH Technikum Wien\n
|
||||
Hoechstaedtplatz 5, 1200 Wien, AUSTRIA";
|
||||
$texthtml = "Dies ist eine automatisch generierte E-Mail.<br><br>
|
||||
Es wurde ein Review für die Seite '$content->titel' ($sprache, Version $version) angefordert.<br>
|
||||
<br>
|
||||
<a href=\"".APP_ROOT."cms/admin.php?content_id=".$content->content_id."&sprache=$sprache&version=$version&action=content\">zum Artikel</a>
|
||||
<br>
|
||||
<br>
|
||||
Mit freundlichen Grüßen<br>
|
||||
<br>
|
||||
FH Technikum Wien<br>
|
||||
Hoechstaedtplatz 5, 1200 Wien, AUSTRIA
|
||||
";
|
||||
|
||||
$mail = new mail($to, $from, $subject, $text);
|
||||
$mail->setHTMLContent($texthtml);
|
||||
if($mail->send())
|
||||
{
|
||||
$message.='<span class="ok">Review Anforderung wurde an '.$to.' versendet</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Fehler beim Senden des Mails an '.$to.'</span>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Es ist kein Review Team vorhanden</span>';
|
||||
}
|
||||
break;
|
||||
case 'prefs_requesttranslate':
|
||||
$content = new content();
|
||||
$content->getContent($content_id, $sprache, $version);
|
||||
|
||||
$oe = new organisationseinheit();
|
||||
$oe_arr = $oe->getParents($content->oe_kurzbz);
|
||||
|
||||
foreach($oe_arr as $organisationseinheit)
|
||||
{
|
||||
echo $organisationseinheit;
|
||||
$fkt = new benutzerfunktion();
|
||||
$fkt->getBenutzerFunktionen('translate', $organisationseinheit);
|
||||
if(count($fkt->result)>0)
|
||||
break;
|
||||
}
|
||||
|
||||
if(count($fkt->result)==0)
|
||||
$fkt->getBenutzerFunktionen('translate');
|
||||
$to='';
|
||||
foreach($fkt->result as $row)
|
||||
{
|
||||
if($to!='')
|
||||
$to.=',';
|
||||
$to .= $row->uid.'@'.DOMAIN;
|
||||
}
|
||||
if($to!='')
|
||||
{
|
||||
$from = 'no-reply@'.DOMAIN;
|
||||
$subject = 'CMS Review Request';
|
||||
$text = "Dies ist eine automatisch generierte E-Mail.\n\n
|
||||
Es wurde ein Artikel angelegt/bearbeitet. Dieser kann nun übersetzt werden: '$content->titel'.\n
|
||||
\n
|
||||
(um den Link anzuzeigen müssen Sie in die HTML Ansicht wechseln)
|
||||
\n
|
||||
\n
|
||||
Mit freundlichen Grüßen\n
|
||||
\n
|
||||
FH Technikum Wien\n
|
||||
Hoechstaedtplatz 5, 1200 Wien, AUSTRIA";
|
||||
$texthtml = "Dies ist eine automatisch generierte E-Mail.<br><br>
|
||||
Es wurde ein Artikel angelegt/bearbeitet. Dieser kann nun übersetzt werden: '$content->titel'<br>
|
||||
<br>
|
||||
<a href=\"".APP_ROOT."cms/admin.php?content_id=".$content->content_id."&sprache=$sprache&version=$version)&action=content\">zum Artikel</a>
|
||||
<br>
|
||||
<br>
|
||||
Mit freundlichen Grüßen<br>
|
||||
<br>
|
||||
FH Technikum Wien<br>
|
||||
Hoechstaedtplatz 5, 1200 Wien, AUSTRIA
|
||||
";
|
||||
|
||||
$mail = new mail($to, $from, $subject, $text);
|
||||
$mail->setHTMLContent($texthtml);
|
||||
if($mail->send())
|
||||
{
|
||||
$message.='<span class="ok">Übersetzungsanforderung wurde an '.$to.' versendet</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Fehler beim Senden des Mails an '.$to.'</span>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Es ist kein Übersetzer eingetragen</span>';
|
||||
}
|
||||
break;
|
||||
case 'childs_add':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
$content = new content();
|
||||
$content->content_id = $content_id;
|
||||
$content->child_content_id = $_POST['child_content_id'];
|
||||
@@ -219,6 +507,12 @@ if(!is_null($method))
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
break;
|
||||
case 'childs_delete':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
if(isset($_GET['contentchild_id']))
|
||||
{
|
||||
$contentchild_id = $_GET['contentchild_id'];
|
||||
@@ -233,6 +527,48 @@ if(!is_null($method))
|
||||
$message.='<span class="error">Fehler: ID wurde nicht uebergeben</span>';
|
||||
}
|
||||
break;
|
||||
case 'childs_sort_up':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
if(isset($_GET['contentchild_id']))
|
||||
{
|
||||
$contentchild_id = $_GET['contentchild_id'];
|
||||
$content = new content();
|
||||
if($content->SortUp($contentchild_id))
|
||||
$message.='<span class="ok">Sortieren erfolgrecih</span>';
|
||||
else
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Fehler: ID wurde nicht uebergeben</span>';
|
||||
}
|
||||
break;
|
||||
case 'childs_sort_down':
|
||||
if(!$rechte->isBerechtigt('basis/cms', null, 'su'))
|
||||
{
|
||||
$message.='<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
if(isset($_GET['contentchild_id']))
|
||||
{
|
||||
$contentchild_id = $_GET['contentchild_id'];
|
||||
$content = new content();
|
||||
if($content->SortDown($contentchild_id))
|
||||
$message.='<span class="ok">Sortieren erfolgrecih</span>';
|
||||
else
|
||||
$message.='<span class="error">'.$content->errormsg.'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<span class="error">Fehler: ID wurde nicht uebergeben</span>';
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -252,34 +588,66 @@ $db = new basis_db();
|
||||
echo '
|
||||
<a href="'.$_SERVER['PHP_SELF'].'?action=prefs&method=add_new_content">Neuen Eintrag hinzufügen</a>
|
||||
<br><br>
|
||||
<table class="treetable">';
|
||||
$qry = "SELECT * FROM (
|
||||
SELECT
|
||||
distinct on(content_id) *
|
||||
FROM
|
||||
campus.tbl_content
|
||||
LEFT JOIN campus.tbl_contentchild USING(content_id)
|
||||
WHERE content_id NOT IN (SELECT child_content_id FROM campus.tbl_contentchild WHERE child_content_id=tbl_content.content_id)
|
||||
) as a
|
||||
ORDER BY contentchild_id, titel";
|
||||
if($result = $db->db_query($qry))
|
||||
|
||||
<a href="admin.php?content_id='.$content_id.'&action='.$action.'&sprache='.$sprache.'&menu=content">Content</a> |
|
||||
<a href="admin.php?content_id='.$content_id.'&action='.$action.'&sprache='.$sprache.'&menu=news">News</a>
|
||||
|
||||
<table class="treetable" >';
|
||||
|
||||
$menu='content';
|
||||
if(isset($_GET['menu']))
|
||||
{
|
||||
$_SESSION['cms/menu']=$_GET['menu'];
|
||||
$menu=$_GET['menu'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($_SESSION['cms/menu']))
|
||||
$menu=$_SESSION['cms/menu'];
|
||||
else
|
||||
$menu='content';
|
||||
}
|
||||
|
||||
$rootcontent = new content();
|
||||
$rootcontent->getRootContent();
|
||||
|
||||
foreach($rootcontent->result as $row)
|
||||
{
|
||||
$output='';
|
||||
$output.= '<tr>';
|
||||
$content = new content();
|
||||
$content->getContent($row->content_id, $sprache, null, null, true);
|
||||
|
||||
while($row = $db->db_fetch_object($result))
|
||||
if($menu=='news' && $content->template_kurzbz!='news')
|
||||
continue;
|
||||
if($menu=='content' && $content->template_kurzbz=='news')
|
||||
continue;
|
||||
|
||||
if($content->template_kurzbz=='news')
|
||||
{
|
||||
echo '<tr>';
|
||||
$content = new content();
|
||||
|
||||
echo '<td>';
|
||||
drawmenulink($row->content_id, $row->titel);
|
||||
echo '</td>';
|
||||
$output.= '<td>';
|
||||
$output.= drawmenulink($row->content_id, $content->titel.' '.$content->insertamum, $content->oe_kurzbz);
|
||||
|
||||
$output.= '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$output.= '<td><br>';
|
||||
$output.= drawmenulink($row->content_id, $content->titel, $content->oe_kurzbz);
|
||||
|
||||
$output.= '</td>';
|
||||
$submenu_depth=0;
|
||||
drawsubmenu($row->content_id);
|
||||
echo '</tr>';
|
||||
$output .= drawsubmenu($row->content_id);
|
||||
}
|
||||
|
||||
//Wenn im gesamten Subtree kein Eintrag vorhanden ist auf den eine Berechtigung vorhanden ist,
|
||||
//dann wird der ganze Subtree nicht angezeigt.
|
||||
if($output!='' && strstr($output,'<a href='))
|
||||
echo $output.'</tr>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '</td><td valign="top">';
|
||||
@@ -287,12 +655,13 @@ echo '</td><td valign="top">';
|
||||
//Editieren
|
||||
if(!is_null($content_id))
|
||||
{
|
||||
echo get_content_link('prefs','Eigenschaften').' | ';
|
||||
echo get_content_link('content','Inhalt').' | ';
|
||||
echo get_content_link('preview','Vorschau').' | ';
|
||||
echo get_content_link('rights','Rechte').' | ';
|
||||
echo get_content_link('childs','Childs').' | ';
|
||||
echo get_content_link('history','History');
|
||||
echo '<h2>Content ID: '.$content_id.' | Version:'.$version.' | Sprache:'.$sprache.'</h2>';
|
||||
$content = new content();
|
||||
$oe = $content->getOrganisationseinheit($content_id);
|
||||
if(!in_array($oe, $berechtigte_oe))
|
||||
die('Sie haben keine Berechtigung fuer diesen Eintrag');
|
||||
|
||||
drawheader();
|
||||
|
||||
echo '<div style="float: right;">'.$message.'</div>';
|
||||
echo '<br><br>';
|
||||
@@ -306,9 +675,9 @@ if(!is_null($content_id))
|
||||
case 'content':
|
||||
print_content();
|
||||
break;
|
||||
case 'preview':
|
||||
echo '<iframe src="content.php?content_id='.$content_id.'&version='.$version.'&sprache='.$sprache.'" style="width: 600px; height: 500px; border: 1px solid black;">';
|
||||
break;
|
||||
//case 'preview':
|
||||
|
||||
// break;
|
||||
case 'rights':
|
||||
print_rights();
|
||||
break;
|
||||
@@ -327,16 +696,95 @@ echo '</body>
|
||||
</html>';
|
||||
|
||||
/******* FUNCTIONS **********/
|
||||
/**
|
||||
* Header fuer Content
|
||||
*/
|
||||
function drawheader()
|
||||
{
|
||||
global $content_id, $action, $sprache, $version, $action;
|
||||
|
||||
//vorhandene Versionen dieser Sprache anzeigen
|
||||
$content = new content();
|
||||
$content->loadVersionen($content_id, $sprache);
|
||||
echo '<table width="100%">
|
||||
<tr>
|
||||
<td width="33%">';
|
||||
echo 'Versionen: ';
|
||||
|
||||
foreach($content->result as $row)
|
||||
{
|
||||
if($version=='')
|
||||
$version=$row->version;
|
||||
|
||||
if($version==$row->version)
|
||||
$class='marked';
|
||||
else
|
||||
$class='';
|
||||
|
||||
echo ' <a href="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&version='.$row->version.'&action='.$action.'" class="'.$class.'">';
|
||||
echo $row->version;
|
||||
echo '</a>, ';
|
||||
}
|
||||
echo '<br>';
|
||||
//vorhandene Sprachen dieses Contents anzeigen
|
||||
$content = new content();
|
||||
if(!$vorhandene_sprachen = $content->getLanguages($content_id, $version))
|
||||
die($content->errormsg);
|
||||
echo 'Sprachen: ';
|
||||
foreach($vorhandene_sprachen as $lang)
|
||||
{
|
||||
if($sprache==$lang)
|
||||
$class='marked';
|
||||
else
|
||||
$class='';
|
||||
echo ' <a href="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$lang.'&action='.$action.'" class="'.$class.'">'; //&version='.$version.'
|
||||
echo $lang;
|
||||
echo '</a>,';
|
||||
}
|
||||
echo '</td><td align="center" width="33%">';
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&action='.$action.'&method=add_newversion" method="POST">';
|
||||
echo '<input type="submit" value="Neue Version anlegen">';
|
||||
echo '</form>';
|
||||
echo '</td><td align="right" width="33%">';
|
||||
$sprache_obj = new sprache();
|
||||
$sprache_obj->getAll();
|
||||
|
||||
//Wenn noch nicht alle Uebersetzungen vorhanden sind,
|
||||
//wird ein Formular zum Erstellen der Uebersetzung angezeigt.
|
||||
if(count($vorhandene_sprachen)!=count($sprache_obj->result))
|
||||
{
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&action='.$action.'&method=add_uebersetzung" method="POST">';
|
||||
echo 'Übersetzung in <SELECT name="sprache">';
|
||||
foreach($sprache_obj->result as $row)
|
||||
{
|
||||
if(!in_array($row->sprache, $vorhandene_sprachen))
|
||||
echo '<option value="'.$row->sprache.'">'.$row->bezeichnung_arr[$sprache].'</option>';
|
||||
}
|
||||
echo '</SELECT>';
|
||||
echo '<input type="submit" value="anlegen">';
|
||||
echo '</form>';
|
||||
}
|
||||
echo '</td></tr>';
|
||||
echo '</table><hr>';
|
||||
|
||||
echo get_content_link('prefs','Eigenschaften').' | ';
|
||||
echo get_content_link('content','Inhalt').' | ';
|
||||
echo get_content_link('rights','Rechte').' | ';
|
||||
echo get_content_link('childs','Childs').' | ';
|
||||
echo get_content_link('history','History');
|
||||
}
|
||||
/**
|
||||
* Gibt einen Menue Link aus
|
||||
* @param $id
|
||||
* @param $titel
|
||||
*/
|
||||
function drawmenulink($id, $titel)
|
||||
function drawmenulink($id, $titel, $oe_kurzbz)
|
||||
{
|
||||
global $content_id, $action, $sprache, $version;
|
||||
echo '<a href="admin.php?content_id='.$id.'&action='.$action.'&sprache='.$sprache.'&version='.$version.'" '.($content_id==$id?'class="marked"':'').'>'.$titel.'</a> ('.$id.')';
|
||||
global $content_id, $action, $sprache, $berechtigte_oe;
|
||||
if(in_array($oe_kurzbz, $berechtigte_oe))
|
||||
return '<a href="admin.php?content_id='.$id.'&action='.$action.'&sprache='.$sprache.'" '.($content_id==$id?'class="marked"':'').'>'.$titel.'</a> ('.$id.')';
|
||||
else
|
||||
return $titel.' ('.$id.')';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -347,39 +795,30 @@ function drawmenulink($id, $titel)
|
||||
*/
|
||||
function drawsubmenu($content_id, $einrueckung=" ")
|
||||
{
|
||||
global $db, $action, $submenu_depth;
|
||||
global $db, $action, $submenu_depth, $sprache;
|
||||
$output='';
|
||||
$submenu_depth++;
|
||||
if($submenu_depth>20)
|
||||
if($submenu_depth>100)
|
||||
{
|
||||
echo 'Menürekursion?! -> Abbruch';
|
||||
return 0;
|
||||
}
|
||||
$qry = "SELECT
|
||||
tbl_contentchild.content_id,
|
||||
tbl_contentchild.child_content_id,
|
||||
tbl_content.titel
|
||||
FROM
|
||||
campus.tbl_contentchild
|
||||
JOIN campus.tbl_content ON(tbl_contentchild.child_content_id=tbl_content.content_id)
|
||||
WHERE
|
||||
tbl_contentchild.content_id='".addslashes($content_id)."'";
|
||||
if($result = $db->db_query($qry))
|
||||
$childcontent = new content();
|
||||
$childcontent->getChilds($content_id);
|
||||
|
||||
foreach($childcontent->result as $row)
|
||||
{
|
||||
if($db->db_num_rows($result)>0)
|
||||
{
|
||||
|
||||
while($row = $db->db_fetch_object($result))
|
||||
{
|
||||
echo "<tr>\n";
|
||||
echo '<td>';
|
||||
echo $einrueckung;
|
||||
drawmenulink($row->child_content_id, $row->titel);
|
||||
drawsubmenu($row->child_content_id, $einrueckung." ");
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
$content = new content();
|
||||
$content->getContent($row->content_id, $sprache, null, null, true);
|
||||
$output.= "<tr>\n";
|
||||
$output.= '<td>';
|
||||
$output.= $einrueckung;
|
||||
$output.=drawmenulink($row->child_content_id, $content->titel, $content->oe_kurzbz);
|
||||
$output.=drawsubmenu($row->child_content_id, $einrueckung." ");
|
||||
$output.= "</td>\n";
|
||||
$output.= "</tr>\n";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -389,8 +828,8 @@ function drawsubmenu($content_id, $einrueckung=" ")
|
||||
*/
|
||||
function get_content_link($key, $name)
|
||||
{
|
||||
global $action, $content_id;
|
||||
return '<a href="'.$_SERVER['PHP_SELF'].'?action='.$key.'&content_id='.$content_id.'" '.($action==$key?'class="marked"':'').'>'.$name.'</a>';
|
||||
global $action, $content_id, $sprache, $version;
|
||||
return '<a href="'.$_SERVER['PHP_SELF'].'?action='.$key.'&content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'" '.($action==$key?'class="marked"':'').'>'.$name.'</a>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -410,7 +849,7 @@ function print_childs()
|
||||
{
|
||||
$("#childs_table").tablesorter(
|
||||
{
|
||||
sortList: [[1,1]],
|
||||
sortList: [[0,0]],
|
||||
widgets: ["zebra"]
|
||||
});
|
||||
});
|
||||
@@ -418,6 +857,7 @@ function print_childs()
|
||||
echo '<table id="childs_table" class="tablesorter" style="width: auto;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Sortierung</th>
|
||||
<th>ID</th>
|
||||
<th>Titel</th>
|
||||
<th></th>
|
||||
@@ -426,9 +866,17 @@ function print_childs()
|
||||
<tbody>';
|
||||
foreach($content->result as $row)
|
||||
{
|
||||
$child = new content();
|
||||
$child->getContent($row->child_content_id);
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td>',$row->sort;
|
||||
echo ' <a href="'.$_SERVER['PHP_SELF'].'?action=childs&content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&contentchild_id='.$row->contentchild_id.'&method=childs_sort_up" title="Nach oben sortieren"><img src="../skin/images/up.png" alt="up"></a>';
|
||||
echo ' <a href="'.$_SERVER['PHP_SELF'].'?action=childs&content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&contentchild_id='.$row->contentchild_id.'&method=childs_sort_down" title="Nach unten sortieren"><img src="../skin/images/down.png" alt="down"></a>';
|
||||
echo '</td>';
|
||||
echo '<td>',$row->child_content_id,'</td>';
|
||||
echo '<td>',$row->titel,'</td>';
|
||||
echo '<td>',$child->titel,'</td>';
|
||||
|
||||
echo '<td>
|
||||
<a href="'.$_SERVER['PHP_SELF'].'?action=childs&content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&contentchild_id='.$row->contentchild_id.'&method=childs_delete" title="entfernen">
|
||||
<img src="../skin/images/delete_x.png">
|
||||
@@ -458,22 +906,19 @@ function print_childs()
|
||||
*/
|
||||
function print_prefs()
|
||||
{
|
||||
global $content_id, $sprache, $version;
|
||||
global $content_id, $sprache, $version, $user;
|
||||
|
||||
$content = new content();
|
||||
if(!$content->getContent($content_id, $sprache, $version))
|
||||
die($content->errormsg);
|
||||
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=prefs&method=prefs_save" method="POST">
|
||||
echo '<form name="form_pref" action="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=prefs&method=prefs_save" method="POST">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Titel</td>
|
||||
<td><input type="text" name="titel" size="40" maxlength="256" value="'.$content->titel.'"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Vorlage</td>
|
||||
<td>
|
||||
<SELECT name="template_kurzbz">';
|
||||
<SELECT name="template_kurzbz" onchange="alert(\'Achtung: Das Ändern der Vorlage kann zum Datenverlust des Contents führen!\n\nÄndern Sie die Vorlage nur wenn Sie wirklich wissen was sie tun.\');">';
|
||||
$template = new template();
|
||||
$template->getAll();
|
||||
foreach($template->result as $row)
|
||||
@@ -512,13 +957,47 @@ function print_prefs()
|
||||
</SELECT>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Aktiv</td>
|
||||
<td><input type="checkbox" name="aktiv" '.($content->aktiv?'checked':'').'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Menü offen</td>
|
||||
<td><input type="checkbox" name="menu_open" '.($content->menu_open?'checked':'').'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><hr></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Titel</td>
|
||||
<td><input type="text" name="titel" size="40" maxlength="256" value="'.$content->titel.'"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Sichtbar</td>
|
||||
<td><input type="checkbox" name="sichtbar" '.($content->sichtbar?'checked':'').'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" value="Speichern"></td>
|
||||
<td><input type="submit" value="Speichern">';
|
||||
if($content->reviewvon!='')
|
||||
{
|
||||
$datum_obj = new datum();
|
||||
echo 'Reviewed von '.$content->reviewvon.' am '.$datum_obj->formatDatum($content->reviewamum,'d.m.Y H:i');
|
||||
}
|
||||
|
||||
echo ' ';
|
||||
echo '<input type="submit" value="Review anfordern" onclick="document.form_pref.action=\''.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=prefs&method=prefs_requestreview\'">';
|
||||
$bf = new benutzerfunktion();
|
||||
if($bf->benutzerfunktion_exists($user, 'review'))
|
||||
echo '<input type="submit" value="Review OK" onclick="document.form_pref.action=\''.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=prefs&method=prefs_reviewed\'">';
|
||||
|
||||
echo '<input type="submit" value="Übersetzer benachrichtigen" onclick="document.form_pref.action=\''.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=prefs&method=prefs_requesttranslate\'">';
|
||||
|
||||
|
||||
echo '
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
@@ -598,21 +1077,44 @@ function print_rights()
|
||||
*/
|
||||
function print_content()
|
||||
{
|
||||
global $content_id, $sprache, $version;
|
||||
|
||||
global $content_id, $sprache, $version, $user;
|
||||
|
||||
$content = new content();
|
||||
|
||||
if(!$content->getContent($content_id, $sprache, $version))
|
||||
die($content->errormsg);
|
||||
|
||||
echo '<div>';
|
||||
$template = new template();
|
||||
$template->load($content->template_kurzbz);
|
||||
|
||||
$xfp = new XSDFormPrinter();
|
||||
$xfp->getparams='?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=content';
|
||||
$xfp->output($template->xsd,$content->content);
|
||||
echo '</div>';
|
||||
if($content->gesperrt_uid!='' && $content->gesperrt_uid!=$user)
|
||||
{
|
||||
$content->getSperrLog($content->contentsprache_id);
|
||||
echo "Dieser Content ist gesperrt von $content->uid seit $content->start!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'?content_id='.$content_id.'&contentsprache_id='.$content->contentsprache_id.'&sprache='.$sprache.'&version='.$version.'&action=content&method=content_sperre" method="POST">';
|
||||
if($content->gesperrt_uid=='')
|
||||
echo '<input type="submit" value="Zur Bearbeitung sperren" name="sperren">';
|
||||
else
|
||||
echo '<input type="submit" value="Sperre Freigeben" name="freigeben">';
|
||||
echo '</form>';
|
||||
|
||||
if($content->gesperrt_uid!='' && $content->gesperrt_uid==$user)
|
||||
{
|
||||
echo '<div>';
|
||||
$template = new template();
|
||||
$template->load($content->template_kurzbz);
|
||||
|
||||
$xfp = new XSDFormPrinter();
|
||||
$xfp->getparams='?content_id='.$content_id.'&sprache='.$sprache.'&version='.$version.'&action=content';
|
||||
$xfp->output($template->xsd,$content->content);
|
||||
echo '</div>';
|
||||
}
|
||||
echo '
|
||||
<br>
|
||||
<h3>Vorschau</h3>
|
||||
<iframe src="content.php?content_id='.$content_id.'&version='.$version.'&sprache='.$sprache.'&sichtbar" style="width: 800px; height: 500px; border: 1px solid black;">
|
||||
';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user