aboutsummaryrefslogtreecommitdiff
path: root/mod/messageboard/views/default/widgets
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-12 23:31:00 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-12 23:31:00 +0000
commit4ae064871ba9dca9f03e095671db48815632d070 (patch)
treeccccacdac0f608e2d262d1d3a8916408c033f132 /mod/messageboard/views/default/widgets
parent8618288ed51942c814f45c67354b14eec43c2422 (diff)
downloadelgg-4ae064871ba9dca9f03e095671db48815632d070.tar.gz
elgg-4ae064871ba9dca9f03e095671db48815632d070.tar.bz2
merging messageboard cleanup from 1.7 branch [5908],[5909],[5917]
git-svn-id: http://code.elgg.org/elgg/trunk@6019 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/messageboard/views/default/widgets')
-rw-r--r--mod/messageboard/views/default/widgets/messageboard/edit.php52
-rw-r--r--mod/messageboard/views/default/widgets/messageboard/view.php165
2 files changed, 108 insertions, 109 deletions
diff --git a/mod/messageboard/views/default/widgets/messageboard/edit.php b/mod/messageboard/views/default/widgets/messageboard/edit.php
index cf0741a36..4e3bb19bf 100644
--- a/mod/messageboard/views/default/widgets/messageboard/edit.php
+++ b/mod/messageboard/views/default/widgets/messageboard/edit.php
@@ -1,28 +1,36 @@
<?php
- /**
- * Elgg message board edit page
- *
- * @package ElggMessageBoard
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.com/
- */
+/**
+ * Elgg message board widget edit view
+ *
+ * @package ElggMessageBoard
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+// default value
+$num_display = 5;
+if (isset($vars['entity']->num_display)) {
+ $num_display = $vars['entity']->num_display;
+}
+
?>
<p>
- <?php echo elgg_echo("messageboard:num_display"); ?>:
- <select name="params[num_display]">
- <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option>
- <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option>
- <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option>
- <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option>
- <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option>
- <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option>
- <option value="7" <?php if($vars['entity']->num_display == 7) echo "SELECTED"; ?>>7</option>
- <option value="8" <?php if($vars['entity']->num_display == 8) echo "SELECTED"; ?>>8</option>
- <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option>
- <option value="10" <?php if($vars['entity']->num_display == 10) echo "SELECTED"; ?>>10</option>
- </select>
+ <?php echo elgg_echo("messageboard:num_display"); ?>:
+ <select name="params[num_display]">
+<?php
+$options = array(1,2,3,4,5,6,7,8,9,10);
+foreach ($options as $option) {
+ $selected = '';
+ if ($num_display == $option) {
+ $selected = "selected='selected'";
+ }
+
+ echo " <option value='{$option}' $selected >{$option}</option>\n";
+}
+?>
+ </select>
</p> \ No newline at end of file
diff --git a/mod/messageboard/views/default/widgets/messageboard/view.php b/mod/messageboard/views/default/widgets/messageboard/view.php
index 9a0d8e251..c05d6b618 100644
--- a/mod/messageboard/views/default/widgets/messageboard/view.php
+++ b/mod/messageboard/views/default/widgets/messageboard/view.php
@@ -1,93 +1,84 @@
<?php
- /**
- * Elgg messageboard plugin view page
- *
- * @todo let users choose how many messages they want displayed
- *
- * @package ElggMessageBoard
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.com/
- */
-
- // a couple of required variables
-
- //get the full page owner entity
- $entity = get_entity(page_owner());
-
- //the number of message to display
- $num_display = $vars['entity']->num_display;
-
- //if no num set, set to one
- if(!$num_display)
- $num_display = 5;
-
-//Just the loggedin user can send messages
-if(isloggedin()){
+/**
+ * Elgg messageboard widget view
+ *
+ *
+ * @package ElggMessageBoard
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+//get the full page owner entity
+$user = get_entity(page_owner());
+
+//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 (isloggedin()) {
?>
- <script type="text/JavaScript">
+<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 $vars['url']; ?>_graphics/ajax_loader.gif" />');
- $('#loader').html('<?php echo elgg_view('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 $vars['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" id="testing" value="" class="input_textarea"></textarea>
-
- <!-- the person posting an item on the message board -->
- <input type="hidden" name="guid" value="<?php echo $_SESSION['guid']; ?>" class="guid" />
-
- <!-- the page owner, this will be the profile owner -->
- <input type="hidden" name="pageOwner" value="<?php echo page_owner(); ?>" 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 $vars['url']; ?>pg/messageboard/<?php echo get_entity(page_owner())->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
+ $("#postit").click(function(){
+
+ //display the ajax loading gif at the start of the function call
+ //$('#loader').html('<img src="<?php echo $vars['url']; ?>_graphics/ajax_loader.gif" />');
+ $('#loader').html('<?php echo elgg_view('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 $vars['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="input_textarea"></textarea>
+
+ <!-- the page owner, this will be the profile owner -->
+ <input type="hidden" name="pageOwner" value="<?php echo page_owner(); ?>" 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 $vars['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(isloggedin())
-
- //this for the first time the page loads, grab the latest 5 messages.
- $contents = $entity->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>";
-
- }
-
-?> \ No newline at end of file
+
+//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>";
+
+}