1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 04:10:38 +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). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
| $Revision: 1.13 $ | $Revision: 1.14 $
| $Date: 2008-05-18 16:34:16 $ | $Date: 2008-05-31 17:55:22 $
| $Author: e107coders $ | $Author: e107steved $
+---------------------------------------------------------------+ +---------------------------------------------------------------+
*/ */
@@ -399,6 +399,8 @@ class newspost
if (e_WYSIWYG) 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'] .= "<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' />": ""; $_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>"; // </tr>";
// ##### ADDED FOR NEWS ARCHIVE -------------------------------------------------------------------- // ##### ADDED FOR NEWS ARCHIVE --------------------------------------------------------------------
// the possible archive values are from "0" to "< $pref['newsposts']" // 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'] ... // 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; global $rs, $ns, $tp;
$sql2 = new db; $sql2 = new db;
$text = "<div style='text-align: center'>"; $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."'> $text .= "<table class='fborder' style='".ADMIN_WIDTH."'>
<tr> <tr>
<td style='width:5%' class='fcaption'>ID</td> <td style='width:5%' class='fcaption'>ID</td>
<td style='width:70%' class='fcaption'>".NWSLAN_57."</td> <td style='width:70%' class='fcaption'>".NWSLAN_57."</td>
<td style='width:25%; text-align:center' class='fcaption'>".LAN_OPTIONS."</td> <td style='width:25%; text-align:center' class='fcaption'>".LAN_OPTIONS."</td>
</tr>"; </tr>";
while ($row = $sql2->db_Fetch()) { while ($row = $sql2->db_Fetch())
{
extract($row); 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> $text .= "<tr>
<td style='width:5%; text-align:center; vertical-align:top' class='forumheader3'>$submitnews_id</td> <td style='width:5%; text-align:center; vertical-align:top' class='forumheader3'>$submitnews_id</td>
<td style='width:70%' class='forumheader3'>"; <td style='width:70%' class='forumheader3'>";
@@ -1167,12 +1177,13 @@ class newspost
</tr>\n"; </tr>\n";
} }
$text .= "</table>"; $text .= "</table>";
} else { }
else
{
$text .= "<div style='text-align:center'>".NWSLAN_59."</div>"; $text .= "<div style='text-align:center'>".NWSLAN_59."</div>";
} }
$text .= "</div>"; $text .= "</div>";
$ns->tablerender(NWSLAN_47, $text); $ns->tablerender(NWSLAN_47, $text);
} }
} }

View File

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

View File

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