Skip to content

Commit

Permalink
fix new thread box
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreytierney committed Jun 15, 2011
1 parent edc32d5 commit 9e2ea06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 40 deletions.
15 changes: 11 additions & 4 deletions controllers/threads.php
Expand Up @@ -35,17 +35,24 @@ public function _new() {
SC::loginRequired();
global $current_user;

$type = $_GET["type"] or $type = "text";
$parent = new SCBoard($_GET["boardid"]);
$route_params = array("boardid"=>$parent->boardid);

$vars = array(
"subject"=>SC::getParam("subject", true),
"text"=>SC::getParam("text", true),
"boardid"=>$_GET["boardid"],
"board"=>new SCBoard($_GET["boardid"])
"type"=>$type,
"parent"=>$parent,
"controller"=>"threads",
"route_params"=>$route_params,
"action"=>SCRoutes::set("threads", "create", $route_params)
);

switch ($_GET["__content_type"]) {
case "json":
$output = array(
"content"=>SCPartial::renderToString("thread/new", $vars)
"content"=>SCPartial::renderToString("message/new", $vars)
);
echo SC::jsonify($output);
break;
Expand All @@ -56,7 +63,7 @@ public function _new() {
"title"=>"Create Thread",
"head"=>SCPartial::renderToString("shared/head"),
"util_links"=>SCPartial::renderToString("board/newthread_util_links", $vars),
"content"=>SCPartial::renderToString("thread/new", $vars)
"content"=>SCPartial::renderToString("message/new", $vars)
);

SCLayout::render("main", $vars, $cs);
Expand Down
36 changes: 0 additions & 36 deletions partials/thread/_new.php
@@ -1,36 +0,0 @@
<form id="createthread" method="POST" action="<?php echo SCRoutes::set("threads", "create", array("boardid"=>$boardid)); ?>">
<p>
<label for="thread_create_subject">Subject:</label>
<input type="text" id="thread_create_subject" name="subject" value="<?php echo $subject; ?>" />
</p>
<p>
<label for="thread_create_text">Message:</label>
<textarea id="thread_create_text" name="text" rows="5" cols="50"><?php echo $text; ?></textarea>
</p>
<p>
<label for="thread_create_type">Type:</label>
<select id="thread_create_type" name="type">
<option value="text">Text</option>
<option value="image">Image</option>
<option value="video">Video</option>
<option value="link">Link</option>
</select>
</p>
<p>
<label for="thread_create_url">Url:</label>
<input type="text" id="thread_create_url" name="url" />
</p>
<p>
<label for="thread_create_caption">Caption:</label>
<input type="text" id="thread_create_caption" name="caption" />
</p>
<p>
<label for="thread_create_upload_image">Upload Image:</label>
<input id="thread_create_upload_image" type="file" name="uploadmedia" />
<a href="mailto:<?php echo $board->emailAddress(); ?>"><?php echo $board->emailAddress(); ?></a>
</p>
<p>
<input type="hidden" name="method" value="PUT" />
<input type="submit" id="btn_create" value="Create" />
</p>
</form>

0 comments on commit 9e2ea06

Please sign in to comment.