From cb6366032cc8a55a3cd0cf2861dd18aa48b0cfab Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sun, 16 Dec 2001 18:13:34 +0000 Subject: Moved remaining hard coded text in posting template to lang_main, smilies now from DB + external smilies window if > 20 git-svn-id: file:///svn/phpbb/trunk@1609 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/lang_english/lang_main.php | 47 ++++++- phpBB/posting.php | 142 +++++++++++++++++++- phpBB/templates/subSilver/posting_body.tpl | 136 ++++++++----------- phpBB/templates/subSilver/simple_header.tpl | 200 ++-------------------------- 4 files changed, 249 insertions(+), 276 deletions(-) diff --git a/phpBB/language/lang_english/lang_main.php b/phpBB/language/lang_english/lang_main.php index 632ea5d192..04038c65fa 100644 --- a/phpBB/language/lang_english/lang_main.php +++ b/phpBB/language/lang_english/lang_main.php @@ -337,8 +337,8 @@ $lang['Disable_Smilies_post'] = "Disable Smilies in this post"; $lang['HTML_is_ON'] = "HTML is ON"; $lang['HTML_is_OFF'] = "HTML is OFF"; -$lang['BBCode_is_ON'] = "BBCode is ON"; -$lang['BBCode_is_OFF'] = "BBCode is OFF"; +$lang['BBCode_is_ON'] = "%sBBCode%s is ON"; // %s are replaced with URI pointing to FAQ +$lang['BBCode_is_OFF'] = "%sBBCode%s is OFF"; $lang['Smilies_are_ON'] = "Smilies are ON"; $lang['Smilies_are_OFF'] = "Smilies are OFF"; @@ -353,6 +353,49 @@ $lang['Vote_cast'] = "Your vote has been cast"; $lang['Topic_reply_notification'] = "Topic Reply Notification"; +$lang['bbcode_b_help'] = "Bold text: [b]text[/b] (alt+b)"; +$lang['bbcode_i_help'] = "Italic text: [i]text[/i] (alt+i)"; +$lang['bbcode_u_help'] = "Underline text: [u]text[/u] (alt+u)"; +$lang['bbcode_q_help'] = "Quote text: [quote]text[/quote] (alt+q)"; +$lang['bbcode_c_help'] = "Code display: [code]code[/code] (alt+c)"; +$lang['bbcode_l_help'] = "List: [list]text[/list] (alt+l)"; +$lang['bbcode_o_help'] = "Ordered list: [list=]text[/list] (alt+o)"; +$lang['bbcode_p_help'] = "Insert image: [img]http://image_url[/img] (alt+p)"; +$lang['bbcode_w_help'] = "Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url] (alt+w)"; +$lang['bbcode_a_help'] = "Close all open bbCode tags"; +$lang['bbcode_s_help'] = "Font color: [color=red]text[/color] Tip: you can also use color=#FF0000"; +$lang['bbcode_f_help'] = "Font size: [size=x-small]small text[/size]"; + +$lang['Emoticons'] = "Emoticons"; +$lang['More_emoticons'] = "View more Emoticons"; + +$lang['Font_color'] = "Font colour"; +$lang['color_default'] = "Default"; +$lang['color_dark_red'] = "Dark Red"; +$lang['color_red'] = "Red"; +$lang['color_orange'] = "Orange"; +$lang['color_brown'] = "Brown"; +$lang['color_yellow'] = "Yellow"; +$lang['color_green'] = "Green"; +$lang['color_olive'] = "Olive"; +$lang['color_cyan'] = "Cyan"; +$lang['color_blue'] = "Blue"; +$lang['color_dark_blue'] = "Dark Blue"; +$lang['color_indigo'] = "Indigo"; +$lang['color_violet'] = "Violet"; +$lang['color_white'] = "White"; +$lang['color_black'] = "Black"; + +$lang['Font_size'] = "Font size"; +$lang['font_tiny'] = "Tiny"; +$lang['font_small'] = "Small"; +$lang['font_normal'] = "Normal"; +$lang['font_large'] = "Large"; +$lang['font_huge'] = "Huge"; + +$lang['Close_Tags'] = "Close Tags"; +$lang['Styles_tip'] = "Tip: Styles can be applied quickly to selected text"; + // // Private Messaging diff --git a/phpBB/posting.php b/phpBB/posting.php index a1a44cded4..9f5af2f4d1 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -571,6 +571,85 @@ function topic_review($topic_id, $is_inline_review) include($phpbb_root_path . 'includes/page_tail.'.$phpEx); } } + +function generate_smilies($mode) +{ + global $db, $board_config, $template, $lang, $images, $theme, $phpEx; + global $user_ip, $forum_id, $session_length; + global $userdata; + + if( $mode == 'window' ) + { + $userdata = session_pagestart($user_ip, $forum_id, $session_length); + init_userprefs($userdata); + + $gen_simple_header = TRUE; + + $page_title = $lang['Review_topic'] ." - $topic_title"; + include($phpbb_root_path . 'includes/page_header.'.$phpEx); + + $template->set_filenames(array( + "smiliesbody" => "posting_smilies.tpl") + ); + } + + $sql = "SELECT * + FROM " . SMILIES_TABLE . " + GROUP BY emoticon + ORDER BY smilies_id"; + if( $result = $db->sql_query($sql) ) + { + if( $num_smilies = $db->sql_numrows($result) ) + { + $rowset = $db->sql_fetchrowset($result); + + $j = 0; + $s_colspan = 0; + $smilies_count = ( $mode == 'inline' ) ? min(20, $num_smilies) : $num_smilies; + $smilies_split_row = ( $mode == 'inline' ) ? 3 : 7; + for($i = 0; $i < $smilies_count; $i++) + { + if( !$j ) + { + $template->assign_block_vars("smilies_row", array()); + } + + $template->assign_block_vars("smilies_row.smilies_col", array( + "SMILEY_CODE" => $rowset[$i]['code'], + "SMILEY_IMG" => "images/smiles/" . $rowset[$i]['smile_url'], + "SMILEY_DESC" => $rowset[$i]['emoticon']) + ); + + $s_colspan = max($s_colspan, $j + 1); + + $j = ( $j == $smilies_split_row ) ? 0 : $j + 1; + } + + if( $mode == 'inline' && $num_smilies > 20) + { + $template->assign_block_vars("switch_smilies_extra", array()); + + $template->assign_vars(array( + "L_MORE_SMILIES" => $lang['More_emoticons'], + "U_MORE_SMILIES" => append_sid("posting.$phpEx?mode=smilies")) + ); + } + + $template->assign_vars(array( + "L_EMOTICONS" => $lang['Emoticons'], + "L_CLOSE_WINDOW" => $lang['Close_window'], + "S_SMILIES_COLSPAN" => $s_colspan) + ); + } + } + + if( $mode == 'window' ) + { + $template->pparse("smiliesbody"); + + include($phpbb_root_path . 'includes/page_tail.'.$phpEx); + } +} // // End page specific functions // --------------------------- @@ -685,6 +764,11 @@ if( $mode == "topicreview" ) topic_review($topic_id, false); exit; } +else if( $mode == "smilies" ) +{ + generate_smilies('window'); + exit; +} // // Set toggles for various options @@ -2491,12 +2575,10 @@ $template->assign_vars(array( // if( $preview && !$error ) { - $orig_word = array(); $replacement_word = array(); $result = obtain_word_list($orig_word, $replacement_word); - if( $bbcode_on ) { $bbcode_uid = make_bbcode_uid(); @@ -2581,6 +2663,11 @@ if( $error ) // End error handling // +// +// Send smilies to template +// +generate_smilies('inline'); + // // User not logged in so offer up a username // field box @@ -2725,6 +2812,12 @@ if( !empty($post_message) && ( $preview || $error || $refresh ) ) $post_message = stripslashes(preg_replace($html_entities_match, $html_entities_replace, $post_message)); } +// +// This enables the forum/topic title to be output for posting +// but not for privmsg (where it makes no sense) +// +$template->assign_block_vars("switch_not_privmsg", array()); + // // Output the data to the template // @@ -2733,7 +2826,7 @@ $template->assign_vars(array( "SUBJECT" => preg_replace($html_entities_match, $html_entities_replace, $post_subject), "MESSAGE" => $post_message, "HTML_STATUS" => $html_status, - "BBCODE_STATUS" => $bbcode_status, + "BBCODE_STATUS" => sprintf($bbcode_status, '', ''), "SMILIES_STATUS" => $smilies_status, "POLL_TITLE" => preg_replace($html_entities_match, $html_entities_replace, $poll_title), "POLL_LENGTH" => $poll_length, @@ -2753,6 +2846,47 @@ $template->assign_vars(array( "L_NOTIFY_ON_REPLY" => $lang['Notify'], "L_DELETE_POST" => $lang['Delete_post'], + "L_BBCODE_B_HELP" => $lang['bbcode_b_help'], + "L_BBCODE_I_HELP" => $lang['bbcode_i_help'], + "L_BBCODE_U_HELP" => $lang['bbcode_u_help'], + "L_BBCODE_Q_HELP" => $lang['bbcode_q_help'], + "L_BBCODE_C_HELP" => $lang['bbcode_c_help'], + "L_BBCODE_L_HELP" => $lang['bbcode_l_help'], + "L_BBCODE_O_HELP" => $lang['bbcode_o_help'], + "L_BBCODE_P_HELP" => $lang['bbcode_p_help'], + "L_BBCODE_W_HELP" => $lang['bbcode_w_help'], + "L_BBCODE_A_HELP" => $lang['bbcode_a_help'], + "L_BBCODE_S_HELP" => $lang['bbcode_s_help'], + "L_BBCODE_F_HELP" => $lang['bbcode_f_help'], + "L_EMPTY_MESSAGE" => $lang['Empty_message'], + + "L_FONT_COLOR" => $lang['Font_color'], + "L_COLOR_DEFAULT" => $lang['color_default'], + "L_COLOR_DARK_RED" => $lang['color_dark_red'], + "L_COLOR_RED" => $lang['color_red'], + "L_COLOR_ORANGE" => $lang['color_orange'], + "L_COLOR_BROWN" => $lang['color_brown'], + "L_COLOR_YELLOW" => $lang['color_yellow'], + "L_COLOR_GREEN" => $lang['color_green'], + "L_COLOR_OLIVE" => $lang['color_olive'], + "L_COLOR_CYAN" => $lang['color_cyan'], + "L_COLOR_BLUE" => $lang['color_blue'], + "L_COLOR_DARK_BLUE" => $lang['color_dark_blue'], + "L_COLOR_INDIGO" => $lang['color_indigo'], + "L_COLOR_VIOLET" => $lang['color_violet'], + "L_COLOR_WHITE" => $lang['color_white'], + "L_COLOR_BLACK" => $lang['color_black'], + + "L_FONT_SIZE" => $lang['Font_size'], + "L_FONT_TINY" => $lang['font_tiny'], + "L_FONT_SMALL" => $lang['font_small'], + "L_FONT_NORMAL" => $lang['font_normal'], + "L_FONT_LARGE" => $lang['font_large'], + "L_FONT_HUGE" => $lang['font_huge'], + + "L_BBCODE_CLOSE_TAGS" => $lang['Close_Tags'], + "L_STYLES_TIP" => $lang['Styles_tip'], + "U_VIEWTOPIC" => ( $mode == "reply" ) ? append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postorder=desc") : "", "U_REVIEW_TOPIC" => ( $mode == "reply" ) ? append_sid("posting.$phpEx?mode=topicreview&" . POST_TOPIC_URL . "=$topic_id") : "", @@ -2830,4 +2964,4 @@ $template->pparse("body"); include($phpbb_root_path . 'includes/page_tail.'.$phpEx); -?> +?> \ No newline at end of file diff --git a/phpBB/templates/subSilver/posting_body.tpl b/phpBB/templates/subSilver/posting_body.tpl index 50fd95c0c8..f83dc1bf36 100644 --- a/phpBB/templates/subSilver/posting_body.tpl +++ b/phpBB/templates/subSilver/posting_body.tpl @@ -1,7 +1,7 @@ - + - +