aboutsummaryrefslogtreecommitdiff
path: root/mod/thewire
diff options
context:
space:
mode:
Diffstat (limited to 'mod/thewire')
-rw-r--r--mod/thewire/actions/add.php63
-rw-r--r--mod/thewire/actions/delete.php38
-rw-r--r--mod/thewire/add.php28
-rw-r--r--mod/thewire/everyone.php27
-rw-r--r--mod/thewire/graphics/river_icon_thewire.gifbin0 -> 365 bytes
-rw-r--r--mod/thewire/graphics/thewire_speech_bubble.gifbin0 -> 560 bytes
-rw-r--r--mod/thewire/index.php38
-rw-r--r--mod/thewire/languages/en.php79
-rw-r--r--mod/thewire/manifest.xml11
-rw-r--r--mod/thewire/readme.txt13
-rw-r--r--mod/thewire/start.php221
-rw-r--r--mod/thewire/views/default/object/thewire.php102
-rw-r--r--mod/thewire/views/default/river/object/thewire/create.php17
-rw-r--r--mod/thewire/views/default/thewire/activity_view.php48
-rw-r--r--mod/thewire/views/default/thewire/css.php136
-rw-r--r--mod/thewire/views/default/thewire/forms/add.php44
-rw-r--r--mod/thewire/views/default/thewire/notfound.php21
-rw-r--r--mod/thewire/views/default/thewire/profile_status.php28
-rw-r--r--mod/thewire/views/default/thewire/scripts/counter.js19
-rw-r--r--mod/thewire/views/default/thewire/view.php27
-rw-r--r--mod/thewire/views/default/widgets/thewire/edit.php14
-rw-r--r--mod/thewire/views/default/widgets/thewire/view.php29
22 files changed, 1003 insertions, 0 deletions
diff --git a/mod/thewire/actions/add.php b/mod/thewire/actions/add.php
new file mode 100644
index 000000000..58589dc9a
--- /dev/null
+++ b/mod/thewire/actions/add.php
@@ -0,0 +1,63 @@
+<?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');
+ $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");
+
+ }
+
+?> \ No newline at end of file
diff --git a/mod/thewire/actions/delete.php b/mod/thewire/actions/delete.php
new file mode 100644
index 000000000..60f69d4e7
--- /dev/null
+++ b/mod/thewire/actions/delete.php
@@ -0,0 +1,38 @@
+<?php
+
+ /**
+ * Elgg thewire: delete note 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
+ $guid = (int) get_input('thewirepost');
+
+ // Make sure we actually have permission to edit
+ $thewire = get_entity($guid);
+ if ($thewire->getSubtype() == "thewire" && $thewire->canEdit()) {
+
+ // Get owning user
+ $owner = get_entity($thewire->getOwner());
+ // Delete it!
+ $rowsaffected = $thewire->delete();
+ if ($rowsaffected > 0) {
+ // Success message
+ system_message(elgg_echo("thewire:deleted"));
+ } else {
+ register_error(elgg_echo("thewire:notdeleted"));
+ }
+ // Forward to the main wire page
+ forward("mod/thewire/?username=" . $owner->username);
+
+ }
+
+?> \ No newline at end of file
diff --git a/mod/thewire/add.php b/mod/thewire/add.php
new file mode 100644
index 000000000..4702c9aa5
--- /dev/null
+++ b/mod/thewire/add.php
@@ -0,0 +1,28 @@
+<?php
+
+ /**
+ * Elgg thewire add entry page
+ *
+ * @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.com/
+ *
+ */
+
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ // If we're not logged in, forward to the front page
+ if (!isloggedin()) forward();
+
+ // choose the required canvas layout and items to display
+ $area2 = elgg_view_title(elgg_echo('thewire:add'));
+ $area2 .= elgg_view("thewire/forms/add");
+ $body = elgg_view_layout("two_column_left_sidebar", '',$area2);
+
+ // Display page
+ page_draw(elgg_echo('thewire:addpost'),$body);
+
+?> \ No newline at end of file
diff --git a/mod/thewire/everyone.php b/mod/thewire/everyone.php
new file mode 100644
index 000000000..a5214a212
--- /dev/null
+++ b/mod/thewire/everyone.php
@@ -0,0 +1,27 @@
+<?php
+
+ /**
+ * Elgg view all thewire posts from all users page
+ *
+ * @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.com/
+ */
+
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ $area2 = elgg_view_title(elgg_echo("thewire:everyone"));
+
+ //add form
+ $area2 .= elgg_view("thewire/forms/add");
+
+ $area2 .= elgg_list_entities(array('types' => 'object', 'subtypes' => 'thewire')); // elgg_view("thewire/view",array('entity' => $thewireposts));
+ $body = elgg_view_layout("two_column_left_sidebar", '', $area2);
+
+ // Display page
+ page_draw(elgg_echo('thewire:everyone'),$body);
+
+?> \ No newline at end of file
diff --git a/mod/thewire/graphics/river_icon_thewire.gif b/mod/thewire/graphics/river_icon_thewire.gif
new file mode 100644
index 000000000..59cc6bfaa
--- /dev/null
+++ b/mod/thewire/graphics/river_icon_thewire.gif
Binary files differ
diff --git a/mod/thewire/graphics/thewire_speech_bubble.gif b/mod/thewire/graphics/thewire_speech_bubble.gif
new file mode 100644
index 000000000..d0e8606a1
--- /dev/null
+++ b/mod/thewire/graphics/thewire_speech_bubble.gif
Binary files differ
diff --git a/mod/thewire/index.php b/mod/thewire/index.php
new file mode 100644
index 000000000..2514d7452
--- /dev/null
+++ b/mod/thewire/index.php
@@ -0,0 +1,38 @@
+<?php
+
+ /**
+ * Elgg thewire index page
+ *
+ * @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.com/
+ */
+
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ // 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());
+ }
+
+ // title
+ $area2 = elgg_view_title(elgg_echo("thewire:read"));
+
+ //add form
+ $area2 .= elgg_view("thewire/forms/add");
+
+ // Display the user's wire
+ $area2 .= list_user_objects($page_owner->getGUID(),'thewire'); // elgg_view("thewire/view",array('entity' => $thewire));
+
+ //select the correct canvas area
+ $body = elgg_view_layout("two_column_left_sidebar", '', $area2);
+
+ // Display page
+ page_draw(sprintf(elgg_echo('thewire:user'),$page_owner->name),$body);
+
+?> \ No newline at end of file
diff --git a/mod/thewire/languages/en.php b/mod/thewire/languages/en.php
new file mode 100644
index 000000000..da0fc222f
--- /dev/null
+++ b/mod/thewire/languages/en.php
@@ -0,0 +1,79 @@
+<?php
+
+ $english = array(
+
+ /**
+ * Menu items and titles
+ */
+
+ 'thewire' => "The wire",
+ 'thewire:user' => "%s's wire",
+ 'thewire:posttitle' => "%s's notes on the wire: %s",
+ 'thewire:everyone' => "All wire posts",
+
+ 'thewire:read' => "Wire posts",
+
+ 'thewire:strapline' => "%s",
+
+ 'thewire:add' => "Post to the wire",
+ 'thewire:text' => "A note on the wire",
+ 'thewire:reply' => "Reply",
+ 'thewire:via' => "via",
+ 'thewire:wired' => "Posted to the wire",
+ 'thewire:charleft' => "characters left",
+ 'item:object:thewire' => "Wire posts",
+ 'thewire:notedeleted' => "note deleted",
+ 'thewire:doing' => "What are you doing? Tell everyone on the wire:",
+ 'thewire:newpost' => 'New wire post',
+ 'thewire:addpost' => 'Post to the wire',
+
+
+ /**
+ * The wire river
+ **/
+
+ //generic terms to use
+ 'thewire:river:created' => "%s posted",
+
+ //these get inserted into the river links to take the user to the entity
+ 'thewire:river:create' => "on the wire.",
+
+ /**
+ * Wire widget
+ **/
+
+ '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: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',
+
+
+
+ /**
+ * Status messages
+ */
+
+ 'thewire:posted' => "Your message was successfully posted to the wire.",
+ 'thewire:deleted' => "Your wire post was successfully deleted.",
+
+ /**
+ * Error messages
+ */
+
+ 'thewire:blank' => "Sorry; you need to actually put something in the textbox before we can save it.",
+ 'thewire:notfound' => "Sorry; we could not find the specified wire post.",
+ 'thewire:notdeleted' => "Sorry; we could not delete this wire post.",
+
+
+ /**
+ * Settings
+ */
+ 'thewire:smsnumber' => "Your SMS number if different from your mobile number (mobile number must be set to public for the wire to be able to use it). All phone numbers must be in international format.",
+ 'thewire:channelsms' => "The number to send SMS messages to is <b>%s</b>",
+
+ );
+
+ add_translation("en",$english);
+
+?> \ No newline at end of file
diff --git a/mod/thewire/manifest.xml b/mod/thewire/manifest.xml
new file mode 100644
index 000000000..080b69b73
--- /dev/null
+++ b/mod/thewire/manifest.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest>
+ <field key="author" value="Curverider" />
+ <field key="version" value="1.7" />
+ <field key="description" value="Provides a microblogging service for your Elgg site." />
+ <field key="website" value="http://www.elgg.org/" />
+ <field key="copyright" value="(C) Curverider 2008-2010" />
+ <field key="licence" value="GNU Public License version 2" />
+ <field key="recommends" value="smsclient" />
+ <field key="elgg_version" value="2010030101" />
+</plugin_manifest>
diff --git a/mod/thewire/readme.txt b/mod/thewire/readme.txt
new file mode 100644
index 000000000..0971ee4a8
--- /dev/null
+++ b/mod/thewire/readme.txt
@@ -0,0 +1,13 @@
+/**
+ * Elgg the wire
+ *
+ * @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-2009
+ * @link http://elgg.com/
+*/
+
+This is a twitter style, short message service that allows users to post notes to the wire.
+
+Install: Just drop it into the mod directory and that should be it. \ No newline at end of file
diff --git a/mod/thewire/start.php b/mod/thewire/start.php
new file mode 100644
index 000000000..dfa57bd17
--- /dev/null
+++ b/mod/thewire/start.php
@@ -0,0 +1,221 @@
+<?php
+
+ /**
+ * Elgg wire plugin
+ * The wire is simple twitter like plugin that allows users to post notes to the wire
+ *
+ * @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.com/
+ */
+
+ /**
+ * thewire initialisation
+ *
+ * These parameters are required for the event API, but we won't use them:
+ *
+ * @param unknown_type $event
+ * @param unknown_type $object_type
+ * @param unknown_type $object
+ */
+
+ function thewire_init() {
+
+ // Load system configuration
+ global $CONFIG;
+
+ // Set up menu for logged in users
+ if (isloggedin()) {
+
+ add_menu(elgg_echo('thewire'), $CONFIG->wwwroot . "mod/thewire/everyone.php");
+
+ }
+
+ // Extend system CSS with our own styles, which are defined in the thewire/css view
+ elgg_extend_view('css','thewire/css');
+
+ //extend views
+ elgg_extend_view('activity/thewire', 'thewire/activity_view');
+ elgg_extend_view('profile/status', 'thewire/profile_status');
+
+ // Register a page handler, so we can have nice URLs
+ register_page_handler('thewire','thewire_page_handler');
+
+ // Register a URL handler for thewire posts
+ register_entity_url_handler('thewire_url','object','thewire');
+
+ // Your thewire widget
+ add_widget_type('thewire',elgg_echo("thewire:read"),elgg_echo("thewire:yourdesc"));
+
+ // Register entity type
+ register_entity_type('object','thewire');
+
+ // Listen for SMS create event
+ register_elgg_event_handler('create','object','thewire_incoming_sms');
+
+ // Register granular notification for this type
+ if (is_callable('register_notification_object'))
+ register_notification_object('object', 'thewire', elgg_echo('thewire:newpost'));
+
+ // Listen to notification events and supply a more useful message for SMS'
+ register_plugin_hook('notify:entity:message', 'object', 'thewire_notify_message');
+ }
+
+ function thewire_pagesetup() {
+
+ global $CONFIG;
+
+ //add submenu options
+ if (get_context() == "thewire") {
+ if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) {
+ add_submenu_item(elgg_echo('thewire:read'),$CONFIG->wwwroot."pg/thewire/" . $_SESSION['user']->username);
+ add_submenu_item(elgg_echo('thewire:everyone'),$CONFIG->wwwroot."mod/thewire/everyone.php");
+ //add_submenu_item(elgg_echo('thewire:add'),$CONFIG->wwwroot."mod/thewire/add.php");
+ }
+ }
+
+ }
+
+ /**
+ * thewire page handler; allows the use of fancy URLs
+ *
+ * @param array $page From the page_handler function
+ * @return true|false Depending on success
+ */
+ function thewire_page_handler($page) {
+
+ // The first component of a thewire URL is the username
+ if (isset($page[0])) {
+ set_input('username',$page[0]);
+ }
+
+ // The second part dictates what we're doing
+ if (isset($page[1])) {
+ switch($page[1]) {
+ case "friends": // TODO: add friends thewire page here
+ break;
+ }
+ // If the URL is just 'thewire/username', or just 'thewire/', load the standard thewire index
+ } else {
+ @include(dirname(__FILE__) . "/index.php");
+ return true;
+ }
+
+ return false;
+
+ }
+
+ function thewire_url($thewirepost) {
+
+ global $CONFIG;
+ return $CONFIG->url . "pg/thewire/" . $thewirepost->getOwnerEntity()->username;
+
+ }
+
+ /**
+ * Returns a more meaningful message for SMS messages.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ */
+ function thewire_notify_message($hook, $entity_type, $returnvalue, $params)
+ {
+ $entity = $params['entity'];
+ $to_entity = $params['to_entity'];
+ $method = $params['method'];
+ if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'thewire'))
+ {
+ $descr = $entity->description;
+ if ($method == 'sms') {
+ $owner = $entity->getOwnerEntity();
+ return $owner->username . ': ' . $descr;
+ }
+ if ($method == 'email') {
+ $owner = $entity->getOwnerEntity();
+ return $owner->username . ': ' . $descr . "\n\n" . $entity->getURL();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create a new wire post.
+ *
+ * @param string $post The post
+ * @param int $access_id Public/private etc
+ * @param int $parent Parent post (if any)
+ * @param string $method The method (default: 'site')
+ * @return bool
+ */
+ function thewire_save_post($post, $access_id, $parent=0, $method = "site")
+ {
+
+ global $SESSION;
+
+ // Initialise a new ElggObject
+ $thewire = new ElggObject();
+
+ // Tell the system it's a thewire post
+ $thewire->subtype = "thewire";
+
+ // Set its owner to the current user
+ $thewire->owner_guid = get_loggedin_userid();
+
+ // For now, set its access to public (we'll add an access dropdown shortly)
+ $thewire->access_id = $access_id;
+
+ // 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
+ $thewire->parent = $parent; //used if the note is a reply
+
+ //save
+ $save = $thewire->save();
+
+ if($save)
+ add_to_river('river/object/thewire/create','create',$SESSION['user']->guid,$thewire->guid);
+
+ return $save;
+
+ }
+
+ /**
+ * Listen and process incoming SMS'
+ */
+ function thewire_incoming_sms($event, $object_type, $object)
+ {
+ if (($object) && ($object->subtype == get_subtype_id('object', 'sms')))
+ {
+ // Get user from phone number
+ if ((is_plugin_enabled('smsclient')) && (is_plugin_enabled('smslogin')))
+ {
+ // By this stage the owner should be logged in (requires SMS Login)
+ if (thewire_save_post($object->description, get_default_access(), 0, 'sms'))
+ return false;
+
+ }
+ }
+
+ return true; // always create the shout even if it can't be sent
+ }
+
+ // Make sure the thewire initialisation function is called on initialisation
+ register_elgg_event_handler('init','system','thewire_init');
+ register_elgg_event_handler('pagesetup','system','thewire_pagesetup');
+
+ // Register actions
+ global $CONFIG;
+ register_action("thewire/add",false,$CONFIG->pluginspath . "thewire/actions/add.php");
+ register_action("thewire/delete",false,$CONFIG->pluginspath . "thewire/actions/delete.php");
+
+?> \ No newline at end of file
diff --git a/mod/thewire/views/default/object/thewire.php b/mod/thewire/views/default/object/thewire.php
new file mode 100644
index 000000000..3e8e53124
--- /dev/null
+++ b/mod/thewire/views/default/object/thewire.php
@@ -0,0 +1,102 @@
+<?php
+
+ /**
+ * Elgg thewire note view
+ *
+ * @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.com/
+ *
+ * @question - do we want users to be able to edit thewire?
+ *
+ * @uses $vars['entity'] Optionally, the note to view
+ */
+
+ if (isset($vars['entity'])) {
+
+ $user_name = $vars['entity']->getOwnerEntity()->name;
+
+ //if the note is a reply, we need some more info
+
+ $note_url = '';
+ $note_owner = elgg_echo("thewire:notedeleted");
+
+?>
+<div class="thewire-singlepage">
+ <div class="thewire-post">
+
+ <!-- the actual shout -->
+ <div class="note_body">
+
+ <div class="thewire_icon">
+ <?php
+ echo elgg_view("profile/icon",array('entity' => $vars['entity']->getOwnerEntity(), 'size' => 'small'));
+ ?>
+ </div>
+
+ <div class="thewire_options">
+
+ <a href="<?php echo $vars['url']; ?>mod/thewire/add.php?wire_username=<?php echo $vars['entity']->getOwnerEntity()->username; ?>" class="reply"><?php echo elgg_echo('thewire:reply'); ?></a>
+ <?php
+/* //only have a reply option for main notes, not other replies
+ if($vars['entity']->parent == 0){
+ ?>
+ <a href="<?php echo $vars['url']; ?>mod/thewire/reply.php?note_id=<?php echo $vars['entity']->guid; ?>" class="reply">reply</a>
+ <?php
+ }
+*/
+ ?>
+ <div class="clearfloat"></div>
+ <?php
+
+ // if the user looking at thewire post can edit, show the delete link
+ if ($vars['entity']->canEdit()) {
+
+
+ echo "<div class='delete_note'>" . elgg_view("output/confirmlink",array(
+ 'href' => $vars['url'] . "action/thewire/delete?thewirepost=" . $vars['entity']->getGUID(),
+ 'text' => elgg_echo('delete'),
+ 'confirm' => elgg_echo('deleteconfirm'),
+ )) . "</div>";
+
+ } //end of can edit if statement
+ ?>
+ </div>
+
+
+ <?php
+ echo "<b>{$user_name}: </b>";
+
+
+ $desc = $vars['entity']->description;
+
+ $desc = preg_replace('/\@([A-Za-z0-9\_\.\-]*)/i','@<a href="' . $vars['url'] . 'pg/thewire/$1">$1</a>',$desc);
+ echo parse_urls($desc);
+ ?>
+
+
+ <div class="clearfloat"></div>
+ </div>
+ <div class="note_date">
+
+ <?php
+
+ echo elgg_echo("thewire:wired") . " " . sprintf(elgg_echo("thewire:strapline"),
+ friendly_time($vars['entity']->time_created)
+ );
+
+ echo " via " . elgg_echo($vars['entity']->method) . ".";
+
+ ?>
+ </div>
+
+
+ </div>
+</div>
+<?php
+
+ }
+
+?> \ No newline at end of file
diff --git a/mod/thewire/views/default/river/object/thewire/create.php b/mod/thewire/views/default/river/object/thewire/create.php
new file mode 100644
index 000000000..9984e99e7
--- /dev/null
+++ b/mod/thewire/views/default/river/object/thewire/create.php
@@ -0,0 +1,17 @@
+<?php
+
+ $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject();
+ $object = get_entity($vars['item']->object_guid);
+ $url = $object->getURL();
+
+ $string = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}:</a> ";
+ $desc .= $object->description;
+ $desc = preg_replace('/\@([A-Za-z0-9\_\.\-]*)/i','@<a href="' . $vars['url'] . 'pg/thewire/$1">$1</a>',$desc);
+ $string .= parse_urls($desc);
+
+ $string .= " <span class=\"river_item_time\"><a href=\"{$vars['url']}mod/thewire/add.php?wire_username={$object->getOwnerEntity()->username}\" class=\"reply\">" . elgg_echo('thewire:reply') . "</a></span>";
+?>
+
+<?php
+ echo $string;
+?> \ No newline at end of file
diff --git a/mod/thewire/views/default/thewire/activity_view.php b/mod/thewire/views/default/thewire/activity_view.php
new file mode 100644
index 000000000..7edd64680
--- /dev/null
+++ b/mod/thewire/views/default/thewire/activity_view.php
@@ -0,0 +1,48 @@
+<?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
new file mode 100644
index 000000000..6491af2ed
--- /dev/null
+++ b/mod/thewire/views/default/thewire/css.php
@@ -0,0 +1,136 @@
+<?php
+
+ /**
+ * Elgg thewire CSS extender
+ *
+ * @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.com/
+ */
+
+?>
+/* widget */
+.thewire-singlepage {
+ margin:0 10px 0 10px;
+}
+.thewire-singlepage .note_body {
+ background: white;
+ -webkit-border-radius: 8px;
+ -moz-border-radius: 8px;
+}
+.collapsable_box_content .note_body {
+ line-height:1.2em;
+}
+.thewire-singlepage .thewire-post {
+ margin-bottom:5px;
+ background:transparent url(<?php echo $vars['url']; ?>mod/thewire/graphics/thewire_speech_bubble.gif) no-repeat right bottom;
+}
+.thewire-post {
+ background:#cccccc;
+ margin-bottom:10px;
+}
+.thewire-post .note_date {
+ font-size:90%;
+ color:#666666;
+ padding:0;
+}
+.thewire_icon {
+ float:left;
+ margin:0 8px 4px 2px;
+}
+.note_body {
+ margin:0;
+ padding:6px 4px 4px 4px;
+ min-height: 40px;
+ line-height: 1.4em;
+}
+.thewire_options {
+ float:right;
+ width:65px;
+}
+.thewire-post .reply {
+ font: 11px/100% Arial, Helvetica, sans-serif;
+ font-weight: bold;
+ color: #ffffff;
+ background:#999999;
+ border: 2px solid #999999;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ width: auto;
+ padding: 0 3px 2px 3px;
+ margin:0 0 5px 5px;
+ cursor: pointer;
+ float:right;
+}
+.thewire-post .reply:hover {
+ background: #4690d6;
+ border: 2px solid #4690d6;
+ color:white;
+ text-decoration: none;
+}
+.thewire-post .delete_note {
+ width:14px;
+ height:14px;
+ margin:3px 0 0 0;
+ float:right;
+}
+.thewire-post .delete_note a {
+ display:block;
+ cursor: pointer;
+ width:14px;
+ height:14px;
+ background: url("<?php echo $vars['url']; ?>_graphics/icon_customise_remove.png") no-repeat 0 0;
+ text-indent: -9000px;
+}
+.thewire-post .delete_note a:hover {
+ background-position: 0 -16px;
+}
+/* IE 6 fix */
+* html .thewire-post .delete_note a { background-position-y: 2px; }
+* html .thewire-post .delete_note a:hover { background-position-y: -14px; }
+
+.post_to_wire {
+ background: white;
+ -webkit-border-radius: 8px;
+ -moz-border-radius: 8px;
+ margin:0 10px 10px 10px;
+ padding:10px;
+}
+.post_to_wire input[type="submit"] {
+ margin:0;
+}
+
+/* reply form */
+textarea#thewire_large-textarea {
+ width: 664px;
+ height: 40px;
+ padding: 6px;
+ font-family: Arial, 'Trebuchet MS','Lucida Grande', sans-serif;
+ font-size: 100%;
+ color:#666666;
+}
+/* IE 6 fix */
+* html textarea#thewire_large-textarea {
+ width: 642px;
+}
+
+input.thewire_characters_remaining_field {
+ color:#333333;
+ border:none;
+ font-size: 100%;
+ font-weight: bold;
+ padding:0 2px 0 0;
+ margin:0;
+ text-align: right;
+ background: white;
+}
+input.thewire_characters_remaining_field:focus {
+ border:none;
+ background:white;
+}
+.thewire_characters_remaining {
+ text-align: right;
+}
+
diff --git a/mod/thewire/views/default/thewire/forms/add.php b/mod/thewire/views/default/thewire/forms/add.php
new file mode 100644
index 000000000..cf9ff15e6
--- /dev/null
+++ b/mod/thewire/views/default/thewire/forms/add.php
@@ -0,0 +1,44 @@
+<?php
+
+ /**
+ * Elgg thewire edit/add page
+ *
+ * @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.com/
+ *
+ */
+
+ $wire_user = get_input('wire_username');
+ if (!empty($wire_user)) { $msg = '@' . $wire_user . ' '; } else { $msg = ''; }
+
+?>
+<div class="post_to_wire">
+<h3><?php echo elgg_echo("thewire:doing"); ?></h3>
+<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>
+
+ <form action="<?php echo $vars['url']; ?>action/thewire/add" method="post" name="noteForm">
+ <?php
+ $display .= "<textarea name='note' value='' onKeyDown=\"textCounter(document.noteForm.note,document.noteForm.remLen1,140)\" onKeyUp=\"textCounter(document.noteForm.note,document.noteForm.remLen1,140)\" id=\"thewire_large-textarea\">{$msg}</textarea>";
+ $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>";
+ echo elgg_view('input/securitytoken');
+ ?>
+ <input type="hidden" name="method" value="site" />
+ <input type="submit" value="<?php echo elgg_echo('save'); ?>" />
+ </form>
+</div>
+<?php echo elgg_view('input/urlshortener'); ?> \ No newline at end of file
diff --git a/mod/thewire/views/default/thewire/notfound.php b/mod/thewire/views/default/thewire/notfound.php
new file mode 100644
index 000000000..bc53815fb
--- /dev/null
+++ b/mod/thewire/views/default/thewire/notfound.php
@@ -0,0 +1,21 @@
+<?php
+
+ /**
+ * Elgg shout not found page
+ *
+ * @package ElggShouts
+ * @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.com/
+ */
+
+?>
+
+ <p>
+ <?php
+
+ echo elgg_echo("thewire:notfound");
+
+ ?>
+ </p> \ No newline at end of file
diff --git a/mod/thewire/views/default/thewire/profile_status.php b/mod/thewire/views/default/thewire/profile_status.php
new file mode 100644
index 000000000..890b8b9c3
--- /dev/null
+++ b/mod/thewire/views/default/thewire/profile_status.php
@@ -0,0 +1,28 @@
+<?php
+
+ /**
+ * New wire post view for the activity stream
+ */
+
+ $owner = $vars['entity']->guid;
+ $url_to_wire = $vars['url'] . "pg/thewire/" . $vars['entity']->username;
+
+ //grab the users latest from the wire
+ $latest_wire = elgg_get_entities(array('types' => 'object', 'subtypes' => 'thewire', 'owner_guid' => $owner, 'limit' => 1));
+
+ if($latest_wire){
+ foreach($latest_wire as $lw){
+ $content = $lw->description;
+ $time = "<span> (" . friendly_time($lw->time_created) . ")</span>";
+ }
+ }
+
+ if($latest_wire){
+ echo "<div class=\"profile_status\">";
+ echo $content;
+ if($owner == $_SESSION['user']->guid)
+ echo " <a class=\"status_update\" href=\"{$url_to_wire}\">update</a>";
+ echo $time;
+ echo "</div>";
+ }
+?> \ No newline at end of file
diff --git a/mod/thewire/views/default/thewire/scripts/counter.js b/mod/thewire/views/default/thewire/scripts/counter.js
new file mode 100644
index 000000000..3a1ebdbc5
--- /dev/null
+++ b/mod/thewire/views/default/thewire/scripts/counter.js
@@ -0,0 +1,19 @@
+// I need to move this into a JS folder for the plugin
+
+/*
+<!-- Dynamic Version by: Nannette Thacker -->
+<!-- http://www.shiningstar.net -->
+<!-- Original by : Ronnie T. Moore -->
+<!-- Web Site: The JavaScript Source -->
+<!-- Limit the number of characters per textarea -->
+*/
+
+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;
+ }
+}
diff --git a/mod/thewire/views/default/thewire/view.php b/mod/thewire/views/default/thewire/view.php
new file mode 100644
index 000000000..e63f88fc6
--- /dev/null
+++ b/mod/thewire/views/default/thewire/view.php
@@ -0,0 +1,27 @@
+<?php
+
+ /**
+ * Elgg thewire view page
+ *
+ * @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.com/
+ *
+ * @uses $vars['entity'] An array of wire notes to view
+ *
+ */
+
+ // If there are any wire notes to view, view them
+ if (is_array($vars['entity']) && sizeof($vars['entity']) > 0) {
+
+ foreach($vars['entity'] as $shout) {
+
+ echo elgg_view_entity($shout);
+
+ }
+
+ }
+
+?> \ No newline at end of file
diff --git a/mod/thewire/views/default/widgets/thewire/edit.php b/mod/thewire/views/default/widgets/thewire/edit.php
new file mode 100644
index 000000000..32a5c8bf7
--- /dev/null
+++ b/mod/thewire/views/default/widgets/thewire/edit.php
@@ -0,0 +1,14 @@
+<?php
+
+?>
+ <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
diff --git a/mod/thewire/views/default/widgets/thewire/view.php b/mod/thewire/views/default/widgets/thewire/view.php
new file mode 100644
index 000000000..4821b854b
--- /dev/null
+++ b/mod/thewire/views/default/widgets/thewire/view.php
@@ -0,0 +1,29 @@
+
+ <?php
+
+ // 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);
+
+ }
+
+ }
+
+ ?>