diff options
Diffstat (limited to 'mod/thewire/views/default')
17 files changed, 363 insertions, 437 deletions
diff --git a/mod/thewire/views/default/forms/thewire/add.php b/mod/thewire/views/default/forms/thewire/add.php new file mode 100644 index 000000000..8607b3662 --- /dev/null +++ b/mod/thewire/views/default/forms/thewire/add.php @@ -0,0 +1,41 @@ +<?php +/** + * Wire add form body + * + * @uses $vars['post'] + */ + +elgg_load_js('elgg.thewire'); + +$post = elgg_extract('post', $vars); + +$text = elgg_echo('post'); +if ($post) { + $text = elgg_echo('thewire:reply'); +} + +if ($post) { + echo elgg_view('input/hidden', array( + 'name' => 'parent_guid', + 'value' => $post->guid, + )); +} + +echo elgg_view('input/plaintext', array( + 'name' => 'body', + 'class' => 'mtm', + 'id' => 'thewire-textarea', +)); +?> +<div id="thewire-characters-remaining"> + <span>140</span> <?php echo elgg_echo('thewire:charleft'); ?> +</div> +<div class="elgg-foot mts"> +<?php + +echo elgg_view('input/submit', array( + 'value' => $text, + 'id' => 'thewire-submit-button', +)); +?> +</div>
\ No newline at end of file diff --git a/mod/thewire/views/default/js/thewire.php b/mod/thewire/views/default/js/thewire.php new file mode 100644 index 000000000..ba8f35050 --- /dev/null +++ b/mod/thewire/views/default/js/thewire.php @@ -0,0 +1,86 @@ +<?php +/** + * The wire's JavaScript + */ + +$site_url = elgg_get_site_url(); + +?> + +elgg.provide('elgg.thewire'); + +elgg.thewire.init = function() { + $("#thewire-textarea").live('keydown', function() { + elgg.thewire.textCounter(this, $("#thewire-characters-remaining span"), 140); + }); + $("#thewire-textarea").live('keyup', function() { + elgg.thewire.textCounter(this, $("#thewire-characters-remaining span"), 140); + }); + + $(".thewire-previous").live('click', elgg.thewire.viewPrevious); +}; + +/** + * Update the number of characters left with every keystroke + * + * @param {Object} textarea + * @param {Object} status + * @param {integer} limit + * @return void + */ +elgg.thewire.textCounter = function(textarea, status, limit) { + + var remaining_chars = limit - $(textarea).val().length; + status.html(remaining_chars); + + if (remaining_chars < 0) { + status.parent().addClass("thewire-characters-remaining-warning"); + $("#thewire-submit-button").attr('disabled', 'disabled'); + $("#thewire-submit-button").addClass('elgg-state-disabled'); + } else { + status.parent().removeClass("thewire-characters-remaining-warning"); + $("#thewire-submit-button").removeAttr('disabled', 'disabled'); + $("#thewire-submit-button").removeClass('elgg-state-disabled'); + } +}; + +/** + * Display the previous wire post + * + * Makes Ajax call to load the html and handles changing the previous link + * + * @param {Object} event + * @return void + */ +elgg.thewire.viewPrevious = function(event) { + var $link = $(this); + var postGuid = $link.attr("href").split("/").pop(); + var $previousDiv = $("#thewire-previous-" + postGuid); + + if ($link.html() == elgg.echo('thewire:hide')) { + $link.html(elgg.echo('thewire:previous')); + $link.attr("title", elgg.echo('thewire:previous:help')); + $previousDiv.slideUp(400); + } else { + $link.html(elgg.echo('thewire:hide')); + $link.attr("title", elgg.echo('thewire:hide:help')); + + $.ajax({type: "GET", + url: elgg.config.wwwroot + "ajax/view/thewire/previous", + dataType: "html", + cache: false, + data: {guid: postGuid}, + success: function(htmlData) { + if (htmlData.length > 0) { + $previousDiv.html(htmlData); + $previousDiv.slideDown(600); + } + } + }); + + } + + event.preventDefault(); +}; + +elgg.register_hook_handler('init', 'system', elgg.thewire.init); diff --git a/mod/thewire/views/default/object/thewire.php b/mod/thewire/views/default/object/thewire.php index 3e8e53124..134c87243 100644 --- a/mod/thewire/views/default/object/thewire.php +++ b/mod/thewire/views/default/object/thewire.php @@ -1,102 +1,63 @@ <?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 +/** + * View a wire post + * + * @uses $vars['entity'] + */ + +elgg_load_js('elgg.thewire'); + +$full = elgg_extract('full_view', $vars, FALSE); +$post = elgg_extract('entity', $vars, FALSE); + +if (!$post) { + return true; +} + +// make compatible with posts created with original Curverider plugin +$thread_id = $post->wire_thread; +if (!$thread_id) { + $post->wire_thread = $post->guid; +} + +$owner = $post->getOwnerEntity(); + +$owner_icon = elgg_view_entity_icon($owner, 'tiny'); +$owner_link = elgg_view('output/url', array( + 'href' => "thewire/owner/$owner->username", + 'text' => $owner->name, + 'is_trusted' => true, +)); +$author_text = elgg_echo('byline', array($owner_link)); +$date = elgg_view_friendly_time($post->time_created); + +$metadata = elgg_view_menu('entity', array( + 'entity' => $post, + 'handler' => 'thewire', + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); + +$subtitle = "$author_text $date"; + +// do not show the metadata and controls in widget view +if (elgg_in_context('widgets')) { + $metadata = ''; +} + +$params = array( + 'entity' => $post, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + 'content' => thewire_filter($post->description), + 'tags' => false, +); +$params = $params + $vars; +$list_body = elgg_view('object/elements/summary', $params); + +echo elgg_view_image_block($owner_icon, $list_body); + +if ($post->reply) { + echo "<div class=\"thewire-parent hidden\" id=\"thewire-previous-{$post->guid}\">"; + echo "</div>"; +} diff --git a/mod/thewire/views/default/river/object/thewire/create.php b/mod/thewire/views/default/river/object/thewire/create.php index 9984e99e7..c75a42b3f 100644 --- a/mod/thewire/views/default/river/object/thewire/create.php +++ b/mod/thewire/views/default/river/object/thewire/create.php @@ -1,17 +1,31 @@ <?php +/** + * File river view. + */ - $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); - $object = get_entity($vars['item']->object_guid); - $url = $object->getURL(); +$object = $vars['item']->getObjectEntity(); +$excerpt = strip_tags($object->description); +$excerpt = thewire_filter($excerpt); - $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); +$subject = $vars['item']->getSubjectEntity(); +$subject_link = elgg_view('output/url', array( + 'href' => $subject->getURL(), + 'text' => $subject->name, + 'class' => 'elgg-river-subject', + 'is_trusted' => true, +)); - $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>"; -?> +$object_link = elgg_view('output/url', array( + 'href' => "thewire/owner/$subject->username", + 'text' => elgg_echo('thewire:wire'), + 'class' => 'elgg-river-object', + 'is_trusted' => true, +)); -<?php - echo $string; -?>
\ No newline at end of file +$summary = elgg_echo("river:create:object:thewire", array($subject_link, $object_link)); + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'message' => $excerpt, + 'summary' => $summary, +));
\ 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 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 6491af2ed..d11cce74a 100644 --- a/mod/thewire/views/default/thewire/css.php +++ b/mod/thewire/views/default/thewire/css.php @@ -1,122 +1,23 @@ <?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/ - */ +/** + * The Wire CSS + */ ?> -/* 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; +/******************************** +The Wire +*********************************/ +#thewire-textarea { 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; +#thewire-characters-remaining { + text-align: right; + float: right; + font-weight: bold; + color: #333333; } - -input.thewire_characters_remaining_field { +.thewire-characters-remaining { color:#333333; border:none; font-size: 100%; @@ -126,11 +27,9 @@ input.thewire_characters_remaining_field { text-align: right; background: white; } -input.thewire_characters_remaining_field:focus { - border:none; - background:white; +.thewire-characters-remaining-warning { + color: #D40D12 !important; } -.thewire_characters_remaining { - text-align: right; +.thewire-parent { + margin-left: 40px; } - diff --git a/mod/thewire/views/default/thewire/forms/add.php b/mod/thewire/views/default/thewire/forms/add.php deleted file mode 100644 index cf9ff15e6..000000000 --- a/mod/thewire/views/default/thewire/forms/add.php +++ /dev/null @@ -1,44 +0,0 @@ -<?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 deleted file mode 100644 index bc53815fb..000000000 --- a/mod/thewire/views/default/thewire/notfound.php +++ /dev/null @@ -1,21 +0,0 @@ -<?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/previous.php b/mod/thewire/views/default/thewire/previous.php new file mode 100644 index 000000000..e1ca83e24 --- /dev/null +++ b/mod/thewire/views/default/thewire/previous.php @@ -0,0 +1,11 @@ +<?php +/** + * Serve up html for a post + */ + +$guid = (int) get_input('guid'); + +$parent = thewire_get_parent($guid); +if ($parent) { + echo elgg_view_entity($parent); +} diff --git a/mod/thewire/views/default/thewire/profile_status.php b/mod/thewire/views/default/thewire/profile_status.php index 890b8b9c3..26e1403fe 100644 --- a/mod/thewire/views/default/thewire/profile_status.php +++ b/mod/thewire/views/default/thewire/profile_status.php @@ -1,28 +1,44 @@ <?php +/** + * Latest wire post on profile page + * + * @uses $vars['entity'] User that owns this profile page + */ - /** - * 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)); +$owner = $vars['entity']->guid; - 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>"; +//grab the user's latest from the wire +$params = array( + 'type' => 'object', + 'subtype' => 'thewire', + 'owner_guid' => $owner, + 'limit' => 1, +); +$latest_wire = elgg_get_entities($params); + +if ($latest_wire && count($latest_wire) > 0) { + $latest_wire = $latest_wire[0]; + $content = thewire_filter($latest_wire->description); + $time = "<p class='elgg-subtext'>(" . elgg_view_friendly_time($latest_wire->time_created) . ")</p>"; + + $button = ''; + if ($owner == elgg_get_logged_in_user_guid()) { + $url_to_wire = "thewire/owner/" . $vars['entity']->username; + $button = elgg_view('output/url', array( + 'text' => elgg_echo('thewire:update'), + 'href' => $url_to_wire, + 'class' => 'elgg-button elgg-button-action float-alt', + 'is_trusted' => true, + )); } -?>
\ No newline at end of file + + $body = $content . $time; + $content = elgg_view_image_block('', $body, array('image_alt' => $button)); + + echo <<< HTML +<div class="wire-status elgg-border-plain pam mbm clearfix"> + $content +</div> +HTML; + +} diff --git a/mod/thewire/views/default/thewire/reply.php b/mod/thewire/views/default/thewire/reply.php new file mode 100644 index 000000000..341b691b1 --- /dev/null +++ b/mod/thewire/views/default/thewire/reply.php @@ -0,0 +1,14 @@ +<?php +/** + * Reply header + */ + +$post = $vars['post']; +$poster = $post->getOwnerEntity(); +$poster_details = array( + htmlspecialchars($poster->name, ENT_QUOTES, 'UTF-8'), + htmlspecialchars($poster->username, ENT_QUOTES, 'UTF-8'), +); +?> +<b><?php echo elgg_echo('thewire:replying', $poster_details); ?>: </b> +<?php echo $post->description;
\ 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 index 3a1ebdbc5..0d416fa9a 100644 --- a/mod/thewire/views/default/thewire/scripts/counter.js +++ b/mod/thewire/views/default/thewire/scripts/counter.js @@ -1,6 +1,12 @@ -// I need to move this into a JS folder for the plugin +/** + * Elgg thewire text counter + * + * @package ElggTheWire + * + * @question - do we want users to be able to edit thewire? + * + * @uses $vars['entity'] Optionally, the note to view -/* <!-- Dynamic Version by: Nannette Thacker --> <!-- http://www.shiningstar.net --> <!-- Original by : Ronnie T. Moore --> diff --git a/mod/thewire/views/default/thewire/sidebar.php b/mod/thewire/views/default/thewire/sidebar.php new file mode 100644 index 000000000..a8aadd1f8 --- /dev/null +++ b/mod/thewire/views/default/thewire/sidebar.php @@ -0,0 +1,9 @@ +<?php +/** + * The wire sidebar + */ + +echo elgg_view('page/elements/tagcloud_block', array( + 'subtypes' => 'thewire', + 'owner_guid' => elgg_get_page_owner_guid(), +)); diff --git a/mod/thewire/views/default/thewire/view.php b/mod/thewire/views/default/thewire/view.php deleted file mode 100644 index e63f88fc6..000000000 --- a/mod/thewire/views/default/thewire/view.php +++ /dev/null @@ -1,27 +0,0 @@ -<?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/content.php b/mod/thewire/views/default/widgets/thewire/content.php new file mode 100644 index 000000000..7212d4397 --- /dev/null +++ b/mod/thewire/views/default/widgets/thewire/content.php @@ -0,0 +1,30 @@ +<?php +/** + * User wire post widget display view + */ + +$num = $vars['entity']->num_display; + +$options = array( + 'type' => 'object', + 'subtype' => 'thewire', + 'container_guid' => $vars['entity']->owner_guid, + 'limit' => $num, + 'full_view' => FALSE, + 'pagination' => FALSE, +); +$content = elgg_list_entities($options); + +echo $content; + +if ($content) { + $owner_url = "thewire/owner/" . elgg_get_page_owner_entity()->username; + $more_link = elgg_view('output/url', array( + 'href' => $owner_url, + 'text' => elgg_echo('thewire:moreposts'), + 'is_trusted' => true, + )); + echo "<span class=\"elgg-widget-more\">$more_link</span>"; +} else { + echo elgg_echo('thewire:noposts'); +} diff --git a/mod/thewire/views/default/widgets/thewire/edit.php b/mod/thewire/views/default/widgets/thewire/edit.php index 32a5c8bf7..cee3f769d 100644 --- a/mod/thewire/views/default/widgets/thewire/edit.php +++ b/mod/thewire/views/default/widgets/thewire/edit.php @@ -1,14 +1,22 @@ <?php +/** + * User wire widget edit view + */ + +// set default value +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 4; +} + +$params = array( + 'name' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), +); +$dropdown = elgg_view('input/dropdown', $params); ?> - <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 +<div> + <?php echo elgg_echo('thewire:num'); ?>: + <?php echo $dropdown; ?> +</div> diff --git a/mod/thewire/views/default/widgets/thewire/view.php b/mod/thewire/views/default/widgets/thewire/view.php deleted file mode 100644 index 4821b854b..000000000 --- a/mod/thewire/views/default/widgets/thewire/view.php +++ /dev/null @@ -1,29 +0,0 @@ - - <?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); - - } - - } - - ?> |
