setPageTitle(WT_I18N::translate('Add/edit journal/news entry')); $controller->pageHeader(); if (!WT_USER_ID) { echo WT_I18N::translate('Access Denied
You do not have access to this resource.'); exit; } $action =safe_GET('action', array('compose', 'save', 'delete'), 'compose'); $news_id =safe_GET('news_id'); $username=safe_REQUEST($_REQUEST, 'username'); $date =safe_POST('date', WT_REGEX_UNSAFE); $title =safe_POST('title', WT_REGEX_UNSAFE); $text =safe_POST('text', WT_REGEX_UNSAFE); if (empty($username)) $username=$GEDCOM; if ($action=="compose") { echo ''.WT_I18N::translate('Add/edit journal/news entry').''; ?>
"; if ($news_id) { $news = getNewsItem($news_id); } else { $news = array(); $news["username"] = $username; $news["date"] = client_time(); $news["title"] = ""; $news["text"] = ""; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
".WT_I18N::translate('Title:')."
".WT_I18N::translate('Entry Text:')."
"; if (array_key_exists('ckeditor', WT_Module::getActiveModules())) { require_once WT_ROOT.WT_MODULES_DIR.'ckeditor/ckeditor.php'; $oCKeditor = new CKEditor(); $oCKeditor->basePath = WT_MODULES_DIR.'ckeditor/'; $oCKeditor->config['width'] = 700; $oCKeditor->config['height'] = 250; $oCKeditor->config['AutoDetectLanguage'] = false ; $oCKeditor->config['DefaultLanguage'] = 'en'; $oCKeditor->editor('text', $news["text"]); } else { //use standard textarea echo ""; } echo "
"; echo "
"; } else if ($action=="save") { $date=time()-$_SESSION["timediff"]; if (empty($title)) $title="No Title"; if (empty($text)) $text="No Text"; $message = array(); if ($news_id) { $message["id"]=$news_id; } $message["username"] = $username; $message["date"]=$date; $message["title"] = $title; $message["text"] = $text; if (addNews($message)) { echo WT_I18N::translate('News/Journal entry successfully saved.'); } } else if ($action=="delete") { if (deleteNews($news_id)) echo WT_I18N::translate('The news/journal entry has been deleted.'); } echo "


".WT_I18N::translate('Close Window')."
";