From 3619332261b34e00448a0186f075a72b32bc15c5 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Sun, 10 May 2015 22:15:33 +0000 Subject: [PATCH] Add comment section. --- web/root/ecwebv3/pages/disabled/episode.ssjs | 53 ++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/web/root/ecwebv3/pages/disabled/episode.ssjs b/web/root/ecwebv3/pages/disabled/episode.ssjs index 447609232a..c5845b484c 100644 --- a/web/root/ecwebv3/pages/disabled/episode.ssjs +++ b/web/root/ecwebv3/pages/disabled/episode.ssjs @@ -1,4 +1,20 @@ //HIDDEN:Episode + +load('webInit.ssjs'); +load(webIni.WebDirectory + "/lib/forum.ssjs"); + +// TODO: Move into exec/load somewhere... +function encode_xml(str) +{ + str = str.toString(); + str=str.replace(/&/g, '&'); + str=str.replace(/</g, '<'); + str=str.replace(/>/g, '>'); + str=str.replace(/"/g, '"'); + str=str.replace(/'/g, '''); + return str; +} + if (js.global.podcast_get_info == undefined) js.global.load("podcast_routines.js"); if (js.global.podcast_opts == undefined) { @@ -14,13 +30,44 @@ if (!base.open()) { print('Error opening message base!'); exit(1); } -var hdrs = podcast_load_headers(base, podcast_opts.From, podcast_opts.To); +var all_hdrs={}; +var hdrs = podcast_load_headers(base, podcast_opts.From, podcast_opts.To, all_hdrs); var index = http_request.query.episode[0]-1; if (index < 0 || index > hdrs.length) { print("Invalid episode!"); exit(1); } var item_info = podcast_get_info(base, hdrs[index]); -print('<h1>'+item_info.title+'</h1>'); -print('<audio controls="controls"><source src="'+item_info.enclosure+'"></audio>'); +print('<h1>'+strftime("%B %e %Y", hdrs[index].when_written_time) + " " + item_info.title+'</h1>'); +print('<audio controls="controls"><source src="'+item_info.enclosure.url+'"></audio>'); print('<p>'+item_info.description+'</p>'); +print('<h2>Comments</h2>'); +var i; +var body; +for (i in all_hdrs) { + if (all_hdrs[i].thread_id != hdrs[index].thread_id) + continue; + if (all_hdrs[i].thread_id == i) + continue; + print('<div>'+html_encode(all_hdrs[i].subject,false, false, false)+' — <i>'+all_hdrs[i].from+'</i> '+system.timestr(all_hdrs[i].when_written_time)+' '+system.zonestr(all_hdrs[i].when_written_zone)+'<br>'); + body = base.get_msg_body(all_hdrs[i].number, true); + body = word_wrap(body, 65535, 79); + body = html_encode(body, false, false, false); + body = body.replace(/\r?\n/g, '<br>'); + print(body); + print('</div><br>'); +} +if (user.number != 0 && msg_area.sub[base.cfg.code].can_post) { + print('<div id="comment-post">'); + print('<form id="comment-form">'); + print('<input type="hidden" name="postmessage" value="true" />'); + print('<input type="hidden" name="sub" value="'+base.cfg.code+'" />'); + print('<input type="hidden" name="irt" value="'+hdrs[index].number+'" />'); + print('<input type="hidden" name="to" value="'+hdrs[index].to+'" />'); + print('<input type="hidden" name="from" value="'+user.alias+'" />'); + print('Subject: <input class="border" type="text" name="subject" value="'+hdrs[index].subject+'" />'); + print('<textarea class="border" name="body" cols="80" rows="10"></textarea><br />'); + print('<input type="button" value="Submit" onClick="submitForm(\'http://'+http_request.host+'/'+webIni.appendURL+'forum-async.ssjs\', \'comment-post\', \'comment-form\')">'); + print('</form>'); + print('</div>'); +} -- GitLab