1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221:
<?php
function template_ask()
{
global $context, $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">
<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">
</p>
<ul class="split_topics">
<li>
<input type="radio" id="onlythis" name="step2" value="onlythis" checked> <label for="onlythis">', $txt['split_this_post'], '</label>
</li>
<li>
<input type="radio" id="afterthis" name="step2" value="afterthis"> <label for="afterthis">', $txt['split_after_and_this_post'], '</label>
</li>
<li>
<input type="radio" id="selective" name="step2" value="selective"> <label for="selective">', $txt['select_split_posts'], '</label>
</li>
</ul>
<hr>
<div class="auto_flow">
<input type="submit" value="', $txt['split'], '" class="button">
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
</div>
</div><!-- .windowbg -->
</form>
</div><!-- #split_topics -->';
}
function template_main()
{
global $context, $txt, $scripturl;
echo '
<div id="split_topics">
<div class="cat_bar">
<h3 class="catbg">', $txt['split'], '</h3>
</div>
<div class="windowbg">
<p>', $txt['split_successful'], '</p>
<ul>
<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><!-- .windowbg -->
</div><!-- #split_topics -->';
}
function template_select()
{
global $context, $txt, $scripturl, $options;
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">';
foreach ($context['not_selected']['messages'] as $message)
echo '
<li class="windowbg" id="not_selected_', $message['id'], '">
<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'], ');"><span class="main_icons split_sel" title="->"></span></a>
', sprintf($txt['post_by_member'], $message['subject'], $message['poster']), '
<em>', $message['time'], '</em>
</div>
<div class="post">', $message['body'], '</div>
</li>';
echo '
</ul>
</div><!-- #not_selected -->
<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">';
if (!empty($context['selected']['messages']))
foreach ($context['selected']['messages'] as $message)
echo '
<li class="windowbg" id="selected_', $message['id'], '">
<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'], ');"><span class="main_icons split_desel" title="<-"></span></a>
', sprintf($txt['post_by_member'], $message['subject'], $message['poster']), '
<em>', $message['time'], '</em>
</div>
<div class="post">', $message['body'], '</div>
</li>';
echo '
</ul>
</div><!-- #selected -->
<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">
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
</div>
</form>
</div><!-- #split_topics -->
<script>
var start = new Array();
start[0] = ', $context['not_selected']['start'], ';
start[1] = ', $context['selected']['start'], ';
function select(direction, msg_id)
{
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;splitjs", onDocReceived);
return false;
}
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)) ' . (empty($options['view_newest_first']) ? '>' : '<') . ' 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 = "windowbg";
newItem.id = curSection + "_" + curId;
newItem.innerHTML = "<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 + ");\\"><span class=\\"main_icons split_" + (curSection == "selected" ? "de" : "") + "sel\\" title=\\"" + (curSection == "selected" ? "<-" : "->") + "\\"></span></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>";
// So, where do we insert it?
if (typeof sInsertBeforeId == "string")
curList.insertBefore(newItem, document.getElementById(sInsertBeforeId));
else
curList.appendChild(newItem);
}
}
}
</script>';
}
?>