1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-14 01:22:13 +02:00

Cleanups on wysiwyg relating to news submit

This commit is contained in:
e107steved 2008-05-31 17:55:31 +00:00
parent 006c537122
commit d68ecc485a
3 changed files with 58 additions and 41 deletions

View File

@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
| $Revision: 1.13 $
| $Date: 2008-05-18 16:34:16 $
| $Author: e107coders $
| $Revision: 1.14 $
| $Date: 2008-05-31 17:55:22 $
| $Author: e107steved $
+---------------------------------------------------------------+
*/
@ -399,6 +399,8 @@ class newspost
if (e_WYSIWYG)
{
if (substr($_POST['data'],-7,7) == '[/html]') $_POST['data'] = substr($_POST['data'],0,-7);
if (substr($_POST['data'],0,6) == '[html]') $_POST['data'] = substr($_POST['data'],6);
$_POST['data'] .= "<br /><b>".NWSLAN_49." ".$submitnews_name."</b>";
$_POST['data'] .= ($submitnews_file)? "<br /><br /><img src='{e_IMAGE}newspost_images/".$submitnews_file."' style='float:right; margin-left:5px;margin-right:5px;margin-top:5px;margin-bottom:5px; border:1px solid' />": "";
}
@ -1039,6 +1041,9 @@ class newspost
// </tr>";
// ##### ADDED FOR NEWS ARCHIVE --------------------------------------------------------------------
// the possible archive values are from "0" to "< $pref['newsposts']"
// this should really be made as an onchange event on the selectbox for $pref['newsposts'] ...
@ -1139,19 +1144,24 @@ class newspost
function submitted_news($sub_action, $id) {
function submitted_news($sub_action, $id)
{
global $rs, $ns, $tp;
$sql2 = new db;
$text = "<div style='text-align: center'>";
if ($category_total = $sql2->db_Select("submitnews", "*", "submitnews_id !='' ORDER BY submitnews_id DESC")) {
if ($category_total = $sql2->db_Select("submitnews", "*", "submitnews_id !='' ORDER BY submitnews_id DESC"))
{
$text .= "<table class='fborder' style='".ADMIN_WIDTH."'>
<tr>
<td style='width:5%' class='fcaption'>ID</td>
<td style='width:70%' class='fcaption'>".NWSLAN_57."</td>
<td style='width:25%; text-align:center' class='fcaption'>".LAN_OPTIONS."</td>
</tr>";
while ($row = $sql2->db_Fetch()) {
while ($row = $sql2->db_Fetch())
{
extract($row);
if (substr($submitnews_item,-7,7) == '[/html]') $submitnews_item = substr($submitnews_item,0,-7);
if (substr($submitnews_item,0,6) == '[html]') $submitnews_item = substr($submitnews_item,6);
$text .= "<tr>
<td style='width:5%; text-align:center; vertical-align:top' class='forumheader3'>$submitnews_id</td>
<td style='width:70%' class='forumheader3'>";
@ -1167,12 +1177,13 @@ class newspost
</tr>\n";
}
$text .= "</table>";
} else {
}
else
{
$text .= "<div style='text-align:center'>".NWSLAN_59."</div>";
}
$text .= "</div>";
$ns->tablerender(NWSLAN_47, $text);
}
}

View File

@ -4,9 +4,9 @@
| e107 website system - Tiny MCE controller file.
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/wysiwyg.php,v $
| $Revision: 1.5 $
| $Date: 2007-04-12 23:37:21 $
| $Author: e107coders $
| $Revision: 1.6 $
| $Date: 2008-05-31 17:55:31 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -102,7 +102,7 @@ function tinymce_html_bbcode_control(type, source) {
source = source.replace(/^\s*|\s*$/g,'');
if(source != '')
{
source = '[html]\\n' + source + '\\n[/html]';
source = '[html]\\n' + source + '\\n[/html]';";
/*
source = source.replace(/<\/strong>/gi,'[/b]');
source = source.replace(/<strong>/gi,'[b]');
@ -115,7 +115,7 @@ function tinymce_html_bbcode_control(type, source) {
source = source.replace(/<\/strong>/gi,'[/b]');
source = source.replace(/<a href=\"(.*?)\"(.*?)>(.*?)<\/a>/gi,'[link=$1 $2]$3[/link]');
*/
$text .= "
}
// Convert e107 paths.
@ -140,11 +140,12 @@ function tinymce_html_bbcode_control(type, source) {
if (html_bbcode_check == '[/html]') {
source = source.slice(0, -7);
}
}";
/*
source = source.replace(/\[b\]/gi,'<strong>');
source = source.replace(/\[\/b\]/gi,'<\/strong>');
*/
$text .= "
source = source.replace(/\{e_IMAGE\}/gi,'".$IMAGES_DIRECTORY."');
source = source.replace(/\{e_PLUGIN\}/gi,'".$PLUGINS_DIRECTORY."');

View File

@ -11,12 +11,15 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/submitnews.php,v $
| $Revision: 1.5 $
| $Date: 2007-11-13 07:54:30 $
| $Author: e107coders $
| $Revision: 1.6 $
| $Date: 2008-05-31 17:55:22 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
require_once("class2.php");
$e_wysiwyg = varsettrue($pref['subnews_htmlarea']) ? 'e107_submitnews_item' : '';
require_once(HEADERF);
if (!isset($pref['subnews_class']))
@ -48,7 +51,7 @@ if (isset($_POST['submit']))
exit;
}
$itemtitle = $tp->toDB($_POST['itemtitle']);
$item = $tp->toDB($_POST['item']);
$item = $tp->toDB($_POST['e107_submitnews_item']);
$item = str_replace("src=&quot;e107_images", "src=&quot;" . SITEURL . "e107_images", $item);
// Process File Upload =================================================
if ($_FILES['file_userfile'] && $pref['subnews_attach'] && $pref['upload_enabled'] && check_class($pref['upload_class']) && FILE_UPLOADS)
@ -145,11 +148,11 @@ if (!$sql->db_Select("news_category"))
else
{
$text .= "
<select name='cat_id' class='tbox'>";
<select name='cat_id' class='tbox'>";
while (list($cat_id, $cat_name, $cat_icon) = $sql->db_Fetch())
{
$sel = ($_POST['cat_id'] == $cat_id) ? "selected='selected'" : "";
$text .= "<option value='$cat_id' $sel>" . $tp->toHTML($cat_name,FALSE,"defs") . "</option>";
$text .= "<option value='{$cat_id}' {$sel}>" . $tp->toHTML($cat_name,FALSE,"defs") . "</option>";
}
$text .= "</select>";
}
@ -157,28 +160,28 @@ $text .= "</td>
</tr><tr>
<td style='width:20%' class='forumheader3'>" . LAN_62 . "</td>
<td style='width:80%' class='forumheader3'>
<input class='tbox' type='text' id='itemtitle' name='itemtitle' size='60' value='$itemtitle' maxlength='200' style='width:90%' />
<input class='tbox' type='text' id='itemtitle' name='itemtitle' size='60' value='{$itemtitle}' maxlength='200' style='width:90%' />
</td>
</tr>";
if ($pref['subnews_htmlarea'])
if (e_WYSIWYG)
{
require_once(e_HANDLER . "tiny_mce/wysiwyg.php");
echo wysiwyg("item");
$insertjs = "rows='25' ";
}
else
{
require_once(e_HANDLER."ren_help.php");
require_once(e_HANDLER."ren_help.php");
$insertjs = "rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'";
}
$insertjs = (!$pref['subnews_htmlarea'])?"rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'" : "rows='25' ";
$text .= "
<tr>
<td style='width:20%' class='forumheader3'>" . LAN_135 . "</td>
<td style='width:80%' class='forumheader3'>
<textarea class='tbox' id='item' name='item' cols='80' style='max-width:95%' $insertjs></textarea><br />";
<textarea class='tbox' id='e107_submitnews_item' name='e107_submitnews_item' cols='80' style='max-width:95%' {$insertjs}></textarea><br />";
if (!$pref['subnews_htmlarea'])
if (!e_WYSIWYG)
{
$text .= display_help("helpb","submitnews");
}
@ -206,24 +209,26 @@ $text .= "
</div>";
$ns->tablerender(LAN_136, $text);
require_once(FOOTERF);
function headerjs()
{
$script = "<script type=\"text/javascript\">
$script = "<script type=\"text/javascript\">
function frmVerify()
{
if(document.getElementById('itemtitle').value == \"\")
{
alert('" . SUBNEWSLAN_1 . "');
return false;
}
if(document.getElementById('item').value == \"\")
{
alert('" . SUBNEWSLAN_2 . "');
return false;
}
if(document.getElementById('itemtitle').value == \"\")
{
alert('" . SUBNEWSLAN_1 . "');
return false;
}
if(document.getElementById('e107_submitnews_item').value == \"\")
{
alert('" . SUBNEWSLAN_2 . "');
return false;
}
}
</script>";
return $script;
}
?>
?>