* @copyright Curverider Ltd 2008-2009 * @link http://elgg.com/ * * @uses $vars['object'] Optionally, the blog post to edit */ // Set title, form destination if (isset($vars['entity'])) { $title = sprintf(elgg_echo("blog:editpost"),$object->title); $action = "blog/edit"; $title = $vars['entity']->title; $body = $vars['entity']->description; $tags = $vars['entity']->tags; if ($vars['entity']->comments_on == 'Off') { $comments_on = false; } else { $comments_on = true; } $access_id = $vars['entity']->access_id; } else { $title = elgg_echo("blog:addpost"); $action = "blog/add"; $tags = ""; $title = ""; $comments_on = true; $description = ""; if (defined('ACCESS_DEFAULT')) $access_id = ACCESS_DEFAULT; else $access_id = 0; $container = $vars['container_guid'] ? elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid'])) : ""; } // Just in case we have some cached details if (empty($body)) { $body = $vars['user']->blogbody; if (!empty($body)) { $title = $vars['user']->blogtitle; $tags = $vars['user']->blogtags; } } // set the required variables $title_label = elgg_echo('title'); $title_textbox = elgg_view('input/text', array('internalname' => 'blogtitle', 'value' => $title)); $text_label = elgg_echo('blog:text'); $text_textarea = elgg_view('input/longtext', array('internalname' => 'blogbody', 'value' => $body)); $tag_label = elgg_echo('tags'); $tag_input = elgg_view('input/tags', array('internalname' => 'blogtags', 'value' => $tags)); $access_label = elgg_echo('access'); //$comments_select = elgg_view('input/checkboxes', array('internalname' => 'comments_on', 'value' => '')); if($comments_on) $comments_on_switch = "checked=\"checked\""; else $comment_on_switch = ""; $access_input = elgg_view('input/access', array('internalname' => 'access_id', 'value' => $access_id)); $submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('publish'))); $conversation = elgg_echo('Conversation'); $publish = elgg_echo('publish'); $cat = elgg_echo('categories'); $preview = elgg_echo('blog:preview'); $privacy = elgg_echo('access'); $savedraft = elgg_echo('blog:draft:save'); $draftsaved = elgg_echo('blog:draft:saved'); $never = elgg_echo('blog:never'); $allowcomments = elgg_echo('blog:comments:allow'); // INSERT EXTRAS HERE $extras = elgg_view('categories',$vars); if (!empty($extras)) $extras = '
'; ?> {$extras} $container EOT; echo elgg_view('input/form', array('action' => "{$vars['url']}action/$action", 'body' => $form_body, 'internalid' => 'blogPostForm')); ?>