aboutsummaryrefslogtreecommitdiff
path: root/mod/messageboard/views/default/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'mod/messageboard/views/default/widgets')
-rw-r--r--mod/messageboard/views/default/widgets/messageboard/content.php70
1 files changed, 7 insertions, 63 deletions
diff --git a/mod/messageboard/views/default/widgets/messageboard/content.php b/mod/messageboard/views/default/widgets/messageboard/content.php
index 45d4426a2..5f0cc8676 100644
--- a/mod/messageboard/views/default/widgets/messageboard/content.php
+++ b/mod/messageboard/views/default/widgets/messageboard/content.php
@@ -1,81 +1,25 @@
<?php
-
/**
- * Elgg messageboard widget view
+ * Elgg messageboard widget view
*
*
* @package ElggMessageBoard
*/
-//get the full page owner entity
$user = elgg_get_page_owner_entity();
-
-//the number of message to display
$num_display = 5;
+
if (isset($vars['entity']->num_display)) {
$num_display = $vars['entity']->num_display;
}
-//Just the loggedin user can post messages
if (elgg_is_logged_in()) {
-?>
-<?php //@todo JS 1.8: no ?>
-<script type="text/javascript">
- $(document).ready(function(){
-
- $("#postit").click(function(){
-
- //display the ajax loading gif at the start of the function call
- //$('#loader').html('<img src="<?php echo elgg_get_site_url(); ?>_graphics/ajax-loader.gif" />');
- $('#loader').html('<?php echo elgg_view('graphics/ajax_loader', array('slashes' => TRUE)); ?>');
-
- //load the results back into the message board contents and remove the loading gif
- //remember that the actual div being populated is determined on views/default/messageboard/messageboard.php
- $("#messageboard_wrapper").load("<?php echo elgg_get_site_url(); ?>mod/messageboard/ajax_endpoint/load.php", {messageboard_content:$("[name=message_content]").val(), pageOwner:$("[name=pageOwner]").val(), numToDisplay:<?php echo $num_display; ?>}, function(){
- $('#loader').empty(); // remove the loading gif
- $('[name=message_content]').val(''); // clear the input textarea
- }); //end
-
- }); // end of the main click function
-
- }); //end of the document .ready function
-</script>
-
-<div id="mb_input_wrapper"><!-- start of mb_input_wrapper div -->
-
- <!-- message textarea -->
- <textarea name="message_content" class="elgg-input-textarea"></textarea>
-
- <!-- the page owner, this will be the profile owner -->
- <input type="hidden" name="pageOwner" value="<?php echo elgg_get_page_owner_guid(); ?>" class="pageOwner" />
-
- <!-- submit button -->
- <input type="submit" id="postit" value="<?php echo elgg_echo('messageboard:postit'); ?>">
-
- <!-- menu options -->
- <div id="messageboard_widget_menu">
- <a href="<?php echo elgg_get_site_url(); ?>pg/messageboard/<?php echo $user->username; ?>"><?php echo elgg_echo("messageboard:viewall"); ?></a>
- </div>
-
- <!-- loading graphic -->
- <div id="loader" class="loading"> </div>
-
-</div><!-- end of mb_input_wrapper div -->
-
- <?php
-} // if(elgg_is_logged_in())
+ echo elgg_view_form('messageboard/add', array('class' => 'elgg-messageboard'));
+}
//this for the first time the page loads, grab the latest messages.
$contents = $user->getAnnotations('messageboard', $num_display, 0, 'desc');
-//as long as there is some content to display, display it
-if (!empty($contents)) {
-
- echo elgg_view('messageboard/messageboard',array('annotation' => $contents));
-
-} else {
-
- //put the required div on the page for the first message
- echo "<div id=\"messageboard_wrapper\"></div>";
-
-}
+if ($contents) {
+ echo elgg_view('messageboard/messageboard', array('annotation' => $contents));
+} \ No newline at end of file