aboutsummaryrefslogtreecommitdiff
path: root/mod/thewire
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-05 16:08:42 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-05 16:08:42 +0000
commit36ef345eb6425106f061fb866d9fa66d051e16df (patch)
tree53fb2bd05f8b5e2010f9e3d1e93075ad7071ec1e /mod/thewire
parent5571ca5b350fd1735f13af7ddfbb88afa6befb0c (diff)
downloadelgg-36ef345eb6425106f061fb866d9fa66d051e16df.tar.gz
elgg-36ef345eb6425106f061fb866d9fa66d051e16df.tar.bz2
Merged 5530:5604 from 1.7 to trunk.
git-svn-id: http://code.elgg.org/elgg/trunk@5622 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/thewire')
-rw-r--r--mod/thewire/actions/add.php102
-rw-r--r--mod/thewire/everyone.php4
-rw-r--r--mod/thewire/languages/en.php5
-rw-r--r--mod/thewire/start.php6
-rw-r--r--mod/thewire/views/default/thewire/activity_view.php48
-rw-r--r--mod/thewire/views/default/thewire/css.php1
-rw-r--r--mod/thewire/views/default/widgets/thewire/edit.php30
-rw-r--r--mod/thewire/views/default/widgets/thewire/view.php40
-rw-r--r--mod/thewire/views/rss/search/object/thewire/entity.php28
9 files changed, 110 insertions, 154 deletions
diff --git a/mod/thewire/actions/add.php b/mod/thewire/actions/add.php
index 1a59a979f..de2538e1e 100644
--- a/mod/thewire/actions/add.php
+++ b/mod/thewire/actions/add.php
@@ -1,63 +1,45 @@
<?php
- /**
- * Elgg thewire: add shout action
- *
- * @package Elggthewire
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.org/
- */
-
- // Make sure we're logged in (send us to the front page if not)
- if (!isloggedin()) forward();
-
- // Get input data
- $body = get_input('new_post_textarea');
- $tags = get_input('thewiretags');
- $access_id = (int)get_default_access();
- if ($access_id == ACCESS_PRIVATE)
- $access_id = ACCESS_LOGGED_IN; // Private wire messages are pointless
- $location = get_input('location');
- $method = get_input('method');
- $parent = (int)get_input('parent', 0);
- if(!$parent)
- $parent = 0;
-
- // convert the shout body into tags
- $tagarray = filter_string($body);
-
- // Make sure the title / description aren't blank
- if (empty($body)) {
- register_error(elgg_echo("thewire:blank"));
- forward("mod/thewire/add.php");
-
- // Otherwise, save the thewire post
- } else {
-
- if (!thewire_save_post($body, $access_id, $parent, $method)) {
- register_error(elgg_echo("thewire:error"));
- if($location == "activity")
- forward("mod/riverdashboard/");
- else
- forward("mod/thewire/add.php");
- }
-
- // Now let's add tags. We can pass an array directly to the object property! Easy.
- if (is_array($tagarray)) {
- $thewire->tags = $tagarray;
- }
-
- // Success message
- system_message(elgg_echo("thewire:posted"));
-
- // Forward
- if($location == "activity")
- forward("mod/riverdashboard/");
- else
- forward("mod/thewire/everyone.php");
-
- }
-
+/**
+ * Elgg thewire: add shout action
+ *
+ * @package Elggthewire
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
+
+// Make sure we're logged in (send us to the front page if not)
+if (!isloggedin()) forward();
+
+// Get input data
+$body = get_input('note');
+$access_id = (int)get_default_access();
+if ($access_id == ACCESS_PRIVATE) {
+ $access_id = ACCESS_LOGGED_IN; // Private wire messages are pointless
+}
+$method = get_input('method');
+$parent = (int)get_input('parent', 0);
+if (!$parent) {
+ $parent = 0;
+}
+// Make sure the body isn't blank
+if (empty($body)) {
+ register_error(elgg_echo("thewire:blank"));
+ forward("mod/thewire/add.php");
+}
+
+if (!thewire_save_post($body, $access_id, $parent, $method)) {
+ register_error(elgg_echo("thewire:error"));
+ forward("mod/thewire/add.php");
+}
+
+
+// Success message
+system_message(elgg_echo("thewire:posted"));
+
+// Forward
+forward("mod/thewire/everyone.php");
+
?> \ No newline at end of file
diff --git a/mod/thewire/everyone.php b/mod/thewire/everyone.php
index 030a9ece3..f2f557ee9 100644
--- a/mod/thewire/everyone.php
+++ b/mod/thewire/everyone.php
@@ -16,7 +16,9 @@
$area2 = elgg_view_title(elgg_echo("thewire:everyone"));
//add form
- $area2 .= elgg_view("thewire/forms/add");
+ if (isloggedin()) {
+ $area2 .= elgg_view("thewire/forms/add");
+ }
$offset = (int)get_input('offset', 0);
$area2 .= elgg_list_entities(array('types' => 'object', 'subtypes' => 'thewire', 'offset' => $offset));
diff --git a/mod/thewire/languages/en.php b/mod/thewire/languages/en.php
index 3540cef78..0fb114028 100644
--- a/mod/thewire/languages/en.php
+++ b/mod/thewire/languages/en.php
@@ -27,6 +27,7 @@
'thewire:doing' => "What are you doing? Tell everyone on the wire:",
'thewire:newpost' => 'New wire post',
'thewire:addpost' => 'Post to the wire',
+ 'thewire:by' => "Wire post by %s",
/**
@@ -44,11 +45,11 @@
**/
'thewire:sitedesc' => 'This widget shows the latest site notes posted to the wire',
- 'thewire:yourdesc' => 'This widget shows your latest notes posted to the wire',
+ 'thewire:yourdesc' => 'This widget displays your latest wire posts',
'thewire:friendsdesc' => 'This widget will show the latest from your friends on the wire',
'thewire:friends' => 'Your friends on the wire',
'thewire:num' => 'Number of items to display',
-
+ 'thewire:moreposts' => 'More wire posts',
/**
diff --git a/mod/thewire/start.php b/mod/thewire/start.php
index ef6564678..9e078fa58 100644
--- a/mod/thewire/start.php
+++ b/mod/thewire/start.php
@@ -94,7 +94,7 @@
}
// If the URL is just 'thewire/username', or just 'thewire/', load the standard thewire index
} else {
- @include(dirname(__FILE__) . "/index.php");
+ require(dirname(__FILE__) . "/index.php");
return true;
}
@@ -165,10 +165,6 @@
// Set its description appropriately
$thewire->description = elgg_substr(strip_tags($post), 0, 160);
- /*if (is_callable('mb_substr'))
- $thewire->description = mb_substr(strip_tags($post), 0, 160);
- else
- $thewire->description = substr(strip_tags($post), 0, 160);*/
// add some metadata
$thewire->method = $method; //method, e.g. via site, sms etc
diff --git a/mod/thewire/views/default/thewire/activity_view.php b/mod/thewire/views/default/thewire/activity_view.php
deleted file mode 100644
index 7edd64680..000000000
--- a/mod/thewire/views/default/thewire/activity_view.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
- /**
- * New wire post view for the activity stream
- */
-
- //grab the users latest from the wire
- $latest_wire = elgg_list_entities(array('types' => 'object', 'subtypes' => 'thewire', 'owner_guid' => $_SESSION['user']->getGUID(), 'limit' => 1, 'full_view' => TRUE, 'view_type_toggle' => FALSE, 'pagination' => FALSE));
-
-?>
-
-<script>
-function textCounter(field,cntfield,maxlimit) {
- // if too long...trim it!
- if (field.value.length > maxlimit) {
- field.value = field.value.substring(0, maxlimit);
- } else {
- // otherwise, update 'characters left' counter
- cntfield.value = maxlimit - field.value.length;
- }
-}
-</script>
-
-<div class="sidebarBox">
-
- <form action="<?php echo $vars['url']; ?>action/thewire/add" method="post" name="noteForm">
-
- <?php
- $display .= "<h3>" . elgg_echo('thewire:newpost') . "</h3><textarea name='note' value='' onKeyDown=\"textCounter(document.noteForm.note,document.noteForm.remLen1,140)\" onKeyUp=\"textCounter(document.noteForm.note,document.noteForm.remLen1,140)\" id=\"thewire_sidebarInputBox\">{$msg}</textarea><br />";
- $display .= "<div class='thewire_characters_remaining'><input readonly type=\"text\" name=\"remLen1\" size=\"3\" maxlength=\"3\" value=\"140\" class=\"thewire_characters_remaining_field\">";
- echo $display;
- echo elgg_echo("thewire:charleft") . "</div>";
- ?>
- <input type="hidden" name="method" value="site" />
- <input type="hidden" name="location" value="activity" />
- <input type="hidden" name="access_id" value="2" />
- <input type="submit" value="<?php echo elgg_echo('save'); ?>" id="thewire_submit_button" />
- </form>
-
- <div class="last_wirepost">
- <?php
- echo $latest_wire;
- ?>
- </div>
-
- <img src="<?php echo $vars['url']; ?>mod/thewire/graphics/river_icon_thewire.gif" alt="the wire" align="left" style="margin-right:5px;"/><a href="<?php echo $vars['url']; ?>mod/thewire/everyone.php" />Read the wire</a>
-
-</div> \ No newline at end of file
diff --git a/mod/thewire/views/default/thewire/css.php b/mod/thewire/views/default/thewire/css.php
index 8b46f4b18..30959e5d3 100644
--- a/mod/thewire/views/default/thewire/css.php
+++ b/mod/thewire/views/default/thewire/css.php
@@ -75,6 +75,7 @@
margin-top:-3px;
float:left;
width:620px;
+ overflow: hidden;
}
.wire_post_options {
float:right;
diff --git a/mod/thewire/views/default/widgets/thewire/edit.php b/mod/thewire/views/default/widgets/thewire/edit.php
index 32a5c8bf7..969015ab8 100644
--- a/mod/thewire/views/default/widgets/thewire/edit.php
+++ b/mod/thewire/views/default/widgets/thewire/edit.php
@@ -1,14 +1,22 @@
<?php
+// set default value
+if (!isset($vars['entity']->num_display)) {
+ $vars['entity']->num_display = 4;
+}
+?>
+<p>
+ <?php echo elgg_echo("thewire:num"); ?>
+ <select name="params[num_display]">
+<?php
+$options = array(1,2,3,4,5,6);
+foreach ($options as $option) {
+ $selected = '';
+ if ($vars['entity']->num_display == $option) {
+ $selected = "selected='selected'";
+ }
+ echo " <option value='{$option}' $selected >{$option}</option>\n";
+}
?>
- <p>
- <?php echo elgg_echo("thewire:num"); ?>
- <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>
- </select>
- </p> \ No newline at end of file
+ </select>
+</p> \ No newline at end of file
diff --git a/mod/thewire/views/default/widgets/thewire/view.php b/mod/thewire/views/default/widgets/thewire/view.php
index 4821b854b..39fe368d0 100644
--- a/mod/thewire/views/default/widgets/thewire/view.php
+++ b/mod/thewire/views/default/widgets/thewire/view.php
@@ -1,29 +1,15 @@
+<?php
+
+$num = $vars['entity']->num_display;
+if (!$num) {
+ $num = 4;
+}
- <?php
+$content = elgg_list_entities(array('types' => 'object', 'subtypes' => 'thewire', 'container_guid' => $vars['entity']->owner_guid, 'limit' => $num, 'full_view' => FALSE, 'pagination' => FALSE));
- // Get any wire notes to display
- // Get the current page's owner
- $page_owner = page_owner_entity();
- if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($page_owner->getGUID());
- }
-
- $num = $vars['entity']->num_display;
- if(!$num)
- $num = 4;
-
- $thewire = $page_owner->getObjects('thewire', $num);
-
- // If there are any thewire to view, view them
- if (is_array($thewire) && sizeof($thewire) > 0) {
-
- foreach($thewire as $shout) {
-
- echo elgg_view_entity($shout);
-
- }
-
- }
-
- ?>
+echo $content;
+
+if ($content) {
+ $blogurl = $vars['url'] . "pg/thewire/" . page_owner_entity()->username;
+ echo "<div class=\"shares_widget_wrapper\"><a href=\"{$blogurl}\">".elgg_echo('thewire:moreposts')."</a></div>";
+}
diff --git a/mod/thewire/views/rss/search/object/thewire/entity.php b/mod/thewire/views/rss/search/object/thewire/entity.php
new file mode 100644
index 000000000..ff0b5b480
--- /dev/null
+++ b/mod/thewire/views/rss/search/object/thewire/entity.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Elgg thewire.
+ * Search entity view for RSS feeds.
+ *
+ * @package ElggTheWire
+ * @link http://elgg.org/
+ */
+
+if (!array_key_exists('entity', $vars)) {
+ return FALSE;
+}
+
+$owner = $vars['entity']->getOwnerEntity();
+if ($owner) {
+ $title = sprintf(elgg_echo('thewire:by'), $owner->name);
+}
+$description = $vars['entity']->getVolatileData('search_matched_description');
+
+?>
+
+<item>
+ <guid isPermaLink='false'><?php echo $vars['entity']->getGUID(); ?></guid>
+ <pubDate><?php echo date("r", $vars['entity']->time_created) ?></pubDate>
+ <link><?php echo htmlspecialchars($vars['entity']->getURL()); ?></link>
+ <title><![CDATA[<?php echo $title; ?>]]></title>
+ <description><![CDATA[<?php echo $description; ?>]]></description>
+</item>