123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458 |
- <?php
- /**
- * Simple Machines Forum (SMF)
- *
- * @package SMF
- * @author Simple Machines
- * @copyright 2012 Simple Machines
- * @license http://www.simplemachines.org/about/smf/license.php BSD
- *
- * @version 2.1 Alpha 1
- */
- function template_ask()
- {
- global $context, $settings, $options, $txt, $scripturl;
- echo '
- <div id="split_topics">
- <form action="', $scripturl, '?action=splittopics;sa=execute;topic=', $context['current_topic'], '.0" method="post" accept-charset="', $context['character_set'], '">
- <input type="hidden" name="at" value="', $context['message']['id'], '" />
- <div class="cat_bar">
- <h3 class="catbg">', $txt['split'], '</h3>
- </div>
- <div class="windowbg">
- <div class="content">
- <p class="split_topics">
- <strong><label for="subname">', $txt['subject_new_topic'], '</label>:</strong>
- <input type="text" name="subname" id="subname" value="', $context['message']['subject'], '" size="25" class="input_text" />
- </p>
- <ul class="reset split_topics">
- <li>
- <input type="radio" id="onlythis" name="step2" value="onlythis" checked="checked" class="input_radio" /> <label for="onlythis">', $txt['split_this_post'], '</label>
- </li>
- <li>
- <input type="radio" id="afterthis" name="step2" value="afterthis" class="input_radio" /> <label for="afterthis">', $txt['split_after_and_this_post'], '</label>
- </li>
- <li>
- <input type="radio" id="selective" name="step2" value="selective" class="input_radio" /> <label for="selective">', $txt['select_split_posts'], '</label>
- </li>
- </ul>
- <hr class="hrcolor" />
- <div class="auto_flow">
- <input type="submit" value="', $txt['split'], '" class="button_submit" />
- <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
- </div>
- </div>
- </div>
- </form>
- </div>';
- }
- function template_main()
- {
- global $context, $settings, $options, $txt, $scripturl;
- echo '
- <div id="split_topics">
- <div class="cat_bar">
- <h3 class="catbg">', $txt['split'], '</h3>
- </div>
- <div class="windowbg">
- <div class="content">
- <p>', $txt['split_successful'], '</p>
- <ul class="reset">
- <li>
- <a href="', $scripturl, '?board=', $context['current_board'], '.0">', $txt['message_index'], '</a>
- </li>
- <li>
- <a href="', $scripturl, '?topic=', $context['old_topic'], '.0">', $txt['origin_topic'], '</a>
- </li>
- <li>
- <a href="', $scripturl, '?topic=', $context['new_topic'], '.0">', $txt['new_topic'], '</a>
- </li>
- </ul>
- </div>
- </div>
- </div>';
- }
- function template_select()
- {
- global $context, $settings, $options, $txt, $scripturl;
- echo '
- <div id="split_topics">
- <form action="', $scripturl, '?action=splittopics;sa=splitSelection;board=', $context['current_board'], '.0" method="post" accept-charset="', $context['character_set'], '">
- <div id="not_selected" class="floatleft">
- <div class="cat_bar">
- <h3 class="catbg">', $txt['split'], ' - ', $txt['select_split_posts'], '</h3>
- </div>
- <div class="information">
- ', $txt['please_select_split'], '
- </div>
- <div class="pagesection">
- <span id="pageindex_not_selected">', $context['not_selected']['page_index'], '</span>
- </div>
- <ul id="messages_not_selected" class="split_messages smalltext reset">';
- foreach ($context['not_selected']['messages'] as $message)
- echo '
- <li class="windowbg', $message['alternate'] ? '2' : '', '" id="not_selected_', $message['id'], '">
- <div class="content">
- <div class="message_header">
- <a class="split_icon floatright" href="', $scripturl, '?action=splittopics;sa=selectTopics;subname=', $context['topic']['subject'], ';topic=', $context['topic']['id'], '.', $context['not_selected']['start'], ';start2=', $context['selected']['start'], ';move=down;msg=', $message['id'], '" onclick="return select(\'down\', ', $message['id'], ');"><img src="', $settings['images_url'], '/split_select.png" alt="->" /></a>
- <strong>', $message['subject'], '</strong> ', $txt['by'], ' <strong>', $message['poster'], '</strong><br />
- <em>', $message['time'], '</em>
- </div>
- <div class="post">', $message['body'], '</div>
- </div>
- </li>';
- echo '
- <li class="dummy" />
- </ul>
- </div>
- <div id="selected" class="floatright">
- <div class="cat_bar">
- <h3 class="catbg">
- ', $txt['split_selected_posts'], ' (<a href="', $scripturl, '?action=splittopics;sa=selectTopics;subname=', $context['topic']['subject'], ';topic=', $context['topic']['id'], '.', $context['not_selected']['start'], ';start2=', $context['selected']['start'], ';move=reset;msg=0" onclick="return select(\'reset\', 0);">', $txt['split_reset_selection'], '</a>)
- </h3>
- </div>
- <div class="information">
- ', $txt['split_selected_posts_desc'], '
- </div>
- <div class="pagesection">
- <span id="pageindex_selected">', $context['selected']['page_index'], '</span>
- </div>
- <ul id="messages_selected" class="split_messages smalltext reset">';
- if (!empty($context['selected']['messages']))
- foreach ($context['selected']['messages'] as $message)
- echo '
- <li class="windowbg', $message['alternate'] ? '2' : '', '" id="selected_', $message['id'], '">
- <div class="content">
- <div class="message_header">
- <a class="split_icon floatleft" href="', $scripturl, '?action=splittopics;sa=selectTopics;subname=', $context['topic']['subject'], ';topic=', $context['topic']['id'], '.', $context['not_selected']['start'], ';start2=', $context['selected']['start'], ';move=up;msg=', $message['id'], '" onclick="return select(\'up\', ', $message['id'], ');"><img src="', $settings['images_url'], '/split_deselect.png" alt="<-" /></a>
- <strong>', $message['subject'], '</strong> ', $txt['by'], ' <strong>', $message['poster'], '</strong><br />
- <em>', $message['time'], '</em>
- </div>
- <div class="post">', $message['body'], '</div>
- </div>
- </li>';
- echo '
- <li class="dummy" />
- </ul>
- </div>
- <br class="clear" />
- <div class="flow_auto">
- <input type="hidden" name="topic" value="', $context['current_topic'], '" />
- <input type="hidden" name="subname" value="', $context['new_subject'], '" />
- <input type="submit" value="', $txt['split'], '" class="button_submit" />
- <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
- </div>
- </form>
- </div>
-
- <script type="text/javascript"><!-- // --><![CDATA[
- var start = new Array();
- start[0] = ', $context['not_selected']['start'], ';
- start[1] = ', $context['selected']['start'], ';
- function select(direction, msg_id)
- {
- if (window.XMLHttpRequest)
- {
- getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + "action=splittopics;sa=selectTopics;subname=', $context['topic']['subject'], ';topic=', $context['topic']['id'], '." + start[0] + ";start2=" + start[1] + ";move=" + direction + ";msg=" + msg_id + ";xml", onDocReceived);
- return false;
- }
- else
- return true;
- }
- function onDocReceived(XMLDoc)
- {
- var i, j, pageIndex;
- for (i = 0; i < 2; i++)
- {
- pageIndex = XMLDoc.getElementsByTagName("pageIndex")[i];
- setInnerHTML(document.getElementById("pageindex_" + pageIndex.getAttribute("section")), pageIndex.firstChild.nodeValue);
- start[i] = pageIndex.getAttribute("startFrom");
- }
- var numChanges = XMLDoc.getElementsByTagName("change").length;
- var curChange, curSection, curAction, curId, curList, curData, newItem, sInsertBeforeId;
- for (i = 0; i < numChanges; i++)
- {
- curChange = XMLDoc.getElementsByTagName("change")[i];
- curSection = curChange.getAttribute("section");
- curAction = curChange.getAttribute("curAction");
- curId = curChange.getAttribute("id");
- curList = document.getElementById("messages_" + curSection);
- if (curAction == "remove")
- curList.removeChild(document.getElementById(curSection + "_" + curId));
- // Insert a message.
- else
- {
- // By default, insert the element at the end of the list.
- sInsertBeforeId = null;
- // Loop through the list to try and find an item to insert after.
- oListItems = curList.getElementsByTagName("LI");
- for (j = 0; j < oListItems.length; j++)
- {
- if (parseInt(oListItems[j].id.substr(curSection.length + 1)) < curId)
- {
- // This would be a nice place to insert the row.
- sInsertBeforeId = oListItems[j].id;
- // We\'re done for now. Escape the loop.
- j = oListItems.length + 1;
- }
- }
- // Let\'s create a nice container for the message.
- newItem = document.createElement("LI");
- newItem.className = "windowbg2";
- newItem.id = curSection + "_" + curId;
- newItem.innerHTML = "<div class=\\"content\\"><div class=\\"message_header\\"><a class=\\"split_icon float" + (curSection == "selected" ? "left" : "right") + "\\" href=\\"" + smf_prepareScriptUrl(smf_scripturl) + "action=splittopics;sa=selectTopics;subname=', $context['topic']['subject'], ';topic=', $context['topic']['id'], '.', $context['not_selected']['start'], ';start2=', $context['selected']['start'], ';move=" + (curSection == "selected" ? "up" : "down") + ";msg=" + curId + "\\" onclick=\\"return select(\'" + (curSection == "selected" ? "up" : "down") + "\', " + curId + ");\\"><img src=\\"', $settings['images_url'], '/split_" + (curSection == "selected" ? "de" : "") + "select.png\\" alt=\\"" + (curSection == "selected" ? "<-" : "->") + "\\" /></a><strong>" + curChange.getElementsByTagName("subject")[0].firstChild.nodeValue + "</strong> ', $txt['by'], ' <strong>" + curChange.getElementsByTagName("poster")[0].firstChild.nodeValue + "</strong><br /><em>" + curChange.getElementsByTagName("time")[0].firstChild.nodeValue + "</em></div><div class=\\"post\\">" + curChange.getElementsByTagName("body")[0].firstChild.nodeValue + "</div></div>";
- // So, where do we insert it?
- if (typeof sInsertBeforeId == "string")
- curList.insertBefore(newItem, document.getElementById(sInsertBeforeId));
- else
- curList.appendChild(newItem);
- }
- }
- // After all changes, make sure the window backgrounds are still correct for both lists.
- applyWindowClasses(document.getElementById("messages_selected"));
- applyWindowClasses(document.getElementById("messages_not_selected"));
- }
- // ]]></script>';
- }
- function template_merge_done()
- {
- global $context, $settings, $options, $txt, $scripturl;
- echo '
- <div id="merge_topics">
- <div class="cat_bar">
- <h3 class="catbg">', $txt['merge'], '</h3>
- </div>
- <div class="windowbg">
- <div class="content">
- <p>', $txt['merge_successful'], '</p>
- <br />
- <ul class="reset">
- <li>
- <a href="', $scripturl, '?board=', $context['target_board'], '.0">', $txt['message_index'], '</a>
- </li>
- <li>
- <a href="', $scripturl, '?topic=', $context['target_topic'], '.0">', $txt['new_merged_topic'], '</a>
- </li>
- </ul>
- </div>
- </div>
- </div>
- <br class="clear" />';
- }
- function template_merge()
- {
- global $context, $settings, $options, $txt, $scripturl;
- echo '
- <div id="merge_topics">
- <div class="cat_bar">
- <h3 class="catbg">', $txt['merge'], '</h3>
- </div>
- <div class="information">
- ', $txt['merge_desc'], '
- </div>
- <div class="windowbg">
- <div class="content">
- <dl class="settings merge_topic">
- <dt>
- <strong>', $txt['topic_to_merge'], ':</strong>
- </dt>
- <dd>
- ', $context['origin_subject'], '
- </dd>';
- if (!empty($context['boards']) && count($context['boards']) > 1)
- {
- echo '
- <dt>
- <strong>', $txt['target_board'], ':</strong>
- </dt>
- <dd>
- <form action="' . $scripturl . '?action=mergetopics;from=' . $context['origin_topic'] . ';targetboard=' . $context['target_board'] . ';board=' . $context['current_board'] . '.0" method="post" accept-charset="', $context['character_set'], '">
- <input type="hidden" name="from" value="' . $context['origin_topic'] . '" />
- <select name="targetboard" onchange="this.form.submit();">';
- foreach ($context['boards'] as $board)
- echo '
- <option value="', $board['id'], '"', $board['id'] == $context['target_board'] ? ' selected="selected"' : '', '>', $board['category'], ' - ', $board['name'], '</option>';
- echo '
- </select>
- <input type="submit" value="', $txt['go'], '" class="button_submit" />
- </form>
- </dd>';
- }
- echo '
- </dl>
- <hr class="hrcolor" />
- <dl class="settings merge_topic">
- <dt>
- <strong>', $txt['merge_to_topic_id'], ': </strong>
- </dt>
- <dd>
- <form action="', $scripturl , '?action=mergetopics;sa=options" method="post" accept-charset="', $context['character_set'], '">
- <input type="hidden" name="topics[]" value="', $context['origin_topic'], '" />
- <input type="text" name="topics[]" class="input_text" />
- <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
- <input type="submit" value="', $txt['merge'], '" class="button_submit" />
- </form>
- </dd>';
- echo '
- </dl>
- </div>
- </div><br />
- <div class="cat_bar">
- <h3 class="catbg">', $txt['target_topic'], '</h3>
- </div>
- <div class="pagesection">
- ', $context['page_index'], '
- </div>
- <div class="windowbg2">
- <div class="content">
- <ul class="reset merge_topics">';
- $merge_button = create_button('merge.png', 'merge', '');
- foreach ($context['topics'] as $topic)
- echo '
- <li>
- <a href="', $scripturl, '?action=mergetopics;sa=options;board=', $context['current_board'], '.0;from=', $context['origin_topic'], ';to=', $topic['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $merge_button, '</a>
- <a href="', $scripturl, '?topic=', $topic['id'], '.0" target="_blank" class="new_win">', $topic['subject'], '</a> ', $txt['started_by'], ' ', $topic['poster']['link'], '
- </li>';
- echo '
- </ul>
- </div>
- </div>
- <div class="pagesection">
- ', $context['page_index'], '
- </div>
- </div>';
- }
- function template_merge_extra_options()
- {
- global $context, $settings, $options, $txt, $scripturl;
- echo '
- <div id="merge_topics">
- <form action="', $scripturl, '?action=mergetopics;sa=execute;" method="post" accept-charset="', $context['character_set'], '">
- <div class="title_bar">
- <h3 class="titlebg">', $txt['merge_topic_list'], '</h3>
- </div>
- <table width="100%" class="bordercolor table_grid">
- <thead>
- <tr class="catbg">
- <th scope="col" class="first_th" align="center" width="10px">', $txt['merge_check'], '</th>
- <th scope="col" class="lefttext">', $txt['subject'], '</th>
- <th scope="col" class="lefttext">', $txt['started_by'], '</th>
- <th scope="col" class="lefttext">', $txt['last_post'], '</th>
- <th scope="col" class="last_th" width="20px">' . $txt['merge_include_notifications'] . '</th>
- </tr>
- </thead>
- <tbody>';
- foreach ($context['topics'] as $topic)
- echo '
- <tr class="windowbg2">
- <td align="center">
- <input type="checkbox" class="input_check" name="topics[]" value="' . $topic['id'] . '" checked="checked" />
- </td>
- <td>
- <a href="' . $scripturl . '?topic=' . $topic['id'] . '.0" target="_blank" class="new_win">' . $topic['subject'] . '</a>
- </td>
- <td>
- ', $topic['started']['link'], '<br />
- <span class="smalltext">', $topic['started']['time'], '</span>
- </td>
- <td>
- ' . $topic['updated']['link'] . '<br />
- <span class="smalltext">', $topic['updated']['time'], '</span>
- </td>
- <td align="center">
- <input type="checkbox" class="input_check" name="notifications[]" value="' . $topic['id'] . '" checked="checked" />
- </td>
- </tr>';
- echo '
- </tbody>
- </table>
- <br />
- <div class="windowbg">
- <div class="content">';
- echo '
- <fieldset id="merge_subject" class="merge_options">
- <legend>', $txt['merge_select_subject'], '</legend>
- <select name="subject" onchange="this.form.custom_subject.style.display = (this.options[this.selectedIndex].value != 0) ? \'none\': \'\' ;">';
- foreach ($context['topics'] as $topic)
- echo '
- <option value="', $topic['id'], '"' . ($topic['selected'] ? ' selected="selected"' : '') . '>', $topic['subject'], '</option>';
- echo '
- <option value="0">', $txt['merge_custom_subject'], ':</option>
- </select>
- <br /><input type="text" name="custom_subject" size="60" id="custom_subject" class="input_text custom_subject" style="display: none;" />
- <br />
- <label for="enforce_subject"><input type="checkbox" class="input_check" name="enforce_subject" id="enforce_subject" value="1" /> ', $txt['merge_enforce_subject'], '</label>
- </fieldset>';
- if (!empty($context['boards']) && count($context['boards']) > 1)
- {
- echo '
- <fieldset id="merge_board" class="merge_options">
- <legend>', $txt['merge_select_target_board'], '</legend>
- <ul class="reset">';
- foreach ($context['boards'] as $board)
- echo '
- <li>
- <input type="radio" name="board" value="' . $board['id'] . '"' . ($board['selected'] ? ' checked="checked"' : '') . ' class="input_radio" /> ' . $board['name'] . '
- </li>';
- echo '
- </ul>
- </fieldset>';
- }
- if (!empty($context['polls']))
- {
- echo '
- <fieldset id="merge_poll" class="merge_options">
- <legend>' . $txt['merge_select_poll'] . '</legend>
- <ul class="reset">';
- foreach ($context['polls'] as $poll)
- echo '
- <li>
- <input type="radio" name="poll" value="' . $poll['id'] . '"' . ($poll['selected'] ? ' checked="checked"' : '') . ' class="input_radio" /> ' . $poll['question'] . ' (' . $txt['topic'] . ': <a href="' . $scripturl . '?topic=' . $poll['topic']['id'] . '.0" target="_blank" class="new_win">' . $poll['topic']['subject'] . '</a>)
- </li>';
- echo '
- <li>
- <input type="radio" name="poll" value="-1" class="input_radio" /> (' . $txt['merge_no_poll'] . ')
- </li>
- </ul>
- </fieldset>';
- }
- echo '
- <div class="auto_flow">
- <input type="submit" value="' . $txt['merge'] . '" class="button_submit" />
- <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
- <input type="hidden" name="sa" value="execute" />
- </div>
- </div>
- </div>
- </form>
- </div>';
- }
- ?>
|