diff options
Diffstat (limited to 'mod/thewire/views/default')
| -rw-r--r-- | mod/thewire/views/default/forms/thewire/add.php | 45 | ||||
| -rw-r--r-- | mod/thewire/views/default/js/thewire.php | 86 | ||||
| -rw-r--r-- | mod/thewire/views/default/object/thewire.php | 18 | ||||
| -rw-r--r-- | mod/thewire/views/default/river/object/thewire/create.php | 31 | ||||
| -rw-r--r-- | mod/thewire/views/default/thewire/css.php | 101 | ||||
| -rw-r--r-- | mod/thewire/views/default/thewire/metadata.php | 56 | ||||
| -rw-r--r-- | mod/thewire/views/default/thewire/previous.php | 11 | ||||
| -rw-r--r-- | mod/thewire/views/default/thewire/profile_status.php | 33 | ||||
| -rw-r--r-- | mod/thewire/views/default/thewire/reply.php | 7 | ||||
| -rw-r--r-- | mod/thewire/views/default/thewire/sidebar.php | 9 | ||||
| -rw-r--r-- | mod/thewire/views/default/widgets/thewire/content.php | 3 |
11 files changed, 184 insertions, 216 deletions
diff --git a/mod/thewire/views/default/forms/thewire/add.php b/mod/thewire/views/default/forms/thewire/add.php index 956ec7c27..8607b3662 100644 --- a/mod/thewire/views/default/forms/thewire/add.php +++ b/mod/thewire/views/default/forms/thewire/add.php @@ -5,6 +5,8 @@ * @uses $vars['post'] */ +elgg_load_js('elgg.thewire'); + $post = elgg_extract('post', $vars); $text = elgg_echo('post'); @@ -18,49 +20,22 @@ if ($post) { 'value' => $post->guid, )); } + +echo elgg_view('input/plaintext', array( + 'name' => 'body', + 'class' => 'mtm', + 'id' => 'thewire-textarea', +)); ?> -<textarea id="thewire-textarea" name="body" class="mtm"></textarea> <div id="thewire-characters-remaining"> <span>140</span> <?php echo elgg_echo('thewire:charleft'); ?> </div> -<div class="mts"> +<div class="elgg-foot mts"> <?php echo elgg_view('input/submit', array( 'value' => $text, 'id' => 'thewire-submit-button', )); - ?> -</div> -<script type="text/javascript"> - -$(document).ready(function() { - $("#thewire-textarea").bind('keydown', function() { - textCounter(this, $("#thewire-characters-remaining span"), 140); - }); - $("#thewire-textarea").bind('keyup', function() { - textCounter(this, $("#thewire-characters-remaining span"), 140); - }); -}); - -function textCounter(textarea, status, limit) { - - var remaining_chars = limit - textarea.value.length; - status.html(remaining_chars); - - if (remaining_chars < 0) { - status.parent().css("color", "#D40D12"); - $("#thewire-submit-button").attr('disabled', 'disabled'); - $("#thewire-submit-button").css('background', '#999999'); - $("#thewire-submit-button").css('border-color', '#999999'); - $("#thewire-submit-button").css('cursor', 'default'); - } else { - status.parent().css("color", ""); - $("#thewire-submit-button").removeAttr('disabled', 'disabled'); - $("#thewire-submit-button").css('background', '#4690d6'); - $("#thewire-submit-button").css('border-color', '#4690d6'); - $("#thewire-submit-button").css('cursor', 'pointer'); - } -} -</script> +</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 2baadd30b..134c87243 100644 --- a/mod/thewire/views/default/object/thewire.php +++ b/mod/thewire/views/default/object/thewire.php @@ -5,8 +5,9 @@ * @uses $vars['entity'] */ +elgg_load_js('elgg.thewire'); -$full = elgg_extract('full', $vars, FALSE); +$full = elgg_extract('full_view', $vars, FALSE); $post = elgg_extract('entity', $vars, FALSE); if (!$post) { @@ -23,15 +24,18 @@ $owner = $post->getOwnerEntity(); $owner_icon = elgg_view_entity_icon($owner, 'tiny'); $owner_link = elgg_view('output/url', array( - 'href' => "pg/thewire/owner/$owner->username", + '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('thewire/metadata', array( +$metadata = elgg_view_menu('entity', array( 'entity' => $post, 'handler' => 'thewire', + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', )); $subtitle = "$author_text $date"; @@ -48,6 +52,12 @@ $params = array( 'content' => thewire_filter($post->description), 'tags' => false, ); -$list_body = elgg_view('page/components/list/body', $params); +$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 d4dac38ee..c75a42b3f 100644 --- a/mod/thewire/views/default/river/object/thewire/create.php +++ b/mod/thewire/views/default/river/object/thewire/create.php @@ -7,18 +7,25 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $excerpt = thewire_filter($excerpt); -$params = array( - 'href' => $object->getURL(), - 'text' => $object->title, -); -$link = elgg_view('output/url', $params); +$subject = $vars['item']->getSubjectEntity(); +$subject_link = elgg_view('output/url', array( + 'href' => $subject->getURL(), + 'text' => $subject->name, + 'class' => 'elgg-river-subject', + 'is_trusted' => true, +)); -echo elgg_echo('thewire:river:create'); +$object_link = elgg_view('output/url', array( + 'href' => "thewire/owner/$subject->username", + 'text' => elgg_echo('thewire:wire'), + 'class' => 'elgg-river-object', + 'is_trusted' => true, +)); -echo " $link"; +$summary = elgg_echo("river:create:object:thewire", array($subject_link, $object_link)); -if ($excerpt) { - echo '<div class="elgg-river-content">'; - echo $excerpt; - echo '</div>'; -} +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/css.php b/mod/thewire/views/default/thewire/css.php index 4f5a12874..d11cce74a 100644 --- a/mod/thewire/views/default/thewire/css.php +++ b/mod/thewire/views/default/thewire/css.php @@ -5,7 +5,7 @@ ?> /******************************** - The Wire +The Wire *********************************/ #thewire-textarea { height: 40px; @@ -27,100 +27,9 @@ text-align: right; background: white; } -<?php -return true; -?> - -/* new wire post form */ -.new_wire_post { - margin:10px 0 15px 0; - padding-bottom:15px; - border-bottom: 1px solid #dedede; -} -.new_wire_post input[type="submit"] { - margin:3px 0 0 0; - float:right; -} -.new_wire_post textarea { - width: 719px; - height: 52px; - padding: 2px 5px 5px 5px; - font-size: 120%; - color:#333333; -} -.character_count { - width: 642px; - color:#666666; -} -.character_count input { - color:#666666; - border:none; - font-size: 100%; - font-weight: bold; - padding:0 2px 0 0; - margin:0; - text-align: right; - background: white; -} -.character_count input:focus { - border:none; - background:white; -} - - -/* wire posts listings */ -.wire_post { - padding-bottom:10px; - margin-bottom:5px; - background-image: url(<?php echo elgg_get_site_url(); ?>mod/thewire/graphics/thewire_speech_bubble.gif); - background-repeat: no-repeat; - background-position: right bottom; -} -.members-list .wire_post { /* when displayed in lists of friends */ - margin-top:4px; -} -.wire_post_contents { - background-color: #eeeeee; - margin:0; - padding:5px; - line-height: 1.2em; - min-height: 34px; - position: relative; -} -.wire_post_icon { - float:left; - margin-right:8px; +.thewire-characters-remaining-warning { + color: #D40D12 !important; } -.wire_post_info { - margin-top:-3px; - float:left; - width:620px; - overflow: hidden; -} -.wire_post_options { - float:right; - width:65px; -} -.wire_post_options .elgg-button-action.reply.small { - float:right; -} -.wire_post_options .elgg-button-delete { - position: absolute; - bottom:5px; - right:5px; -} - - -/* latest wire post on profile page */ -.wire_post .elgg-button-action.update.small { - float:right; - padding:4px; - position: absolute; - bottom:5px; - right:5px; -} - -/* river wire entry */ -.river_item .reply_link { - display:block; +.thewire-parent { + margin-left: 40px; } diff --git a/mod/thewire/views/default/thewire/metadata.php b/mod/thewire/views/default/thewire/metadata.php deleted file mode 100644 index 6d871b05f..000000000 --- a/mod/thewire/views/default/thewire/metadata.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php -/** - * - */ - -$entity = $vars['entity']; -$handler = elgg_extract('handler', $vars, ''); - -?> -<ul class="elgg-menu elgg-menu-metadata"> -<?php -if (elgg_is_logged_in()) { - echo '<li>'; - echo elgg_view('output/url', array( - 'href' => "pg/thewire/reply/$entity->guid", - 'text' => elgg_echo('thewire:reply'), - )); - echo '</li>'; -} - -if ($entity->reply) { - echo '<li>'; - echo elgg_view('output/url', array( - 'href' => "pg/thewire/previous/$entity->guid", - 'text' => elgg_echo('thewire:previous'), - )); - echo '</li>'; -} - -echo '<li>'; -echo elgg_view('output/url', array( - 'href' => 'pg/thewire/thread/' . $entity->wire_thread, - 'text' => elgg_echo('thewire:thread'), -)); -echo '</li>'; - - -// links to delete or edit. -if ($entity->canEdit() && $handler) { - - $delete_url = "action/$handler/delete?guid={$entity->getGUID()}"; - $delete_link = elgg_view('output/confirmlink', array( - 'href' => $delete_url, - 'text' => elgg_view_icon('delete'), - 'title' => elgg_echo('delete'), - 'confirm' => elgg_echo('deleteconfirm'), - 'text_encode' => false, - )); - echo "<li>$delete_link</li>"; -} - -$likes = elgg_view_likes($entity); -echo "<li>$likes</li>"; - -?> -</ul>
\ 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 33b05f479..26e1403fe 100644 --- a/mod/thewire/views/default/thewire/profile_status.php +++ b/mod/thewire/views/default/thewire/profile_status.php @@ -1,15 +1,16 @@ <?php /** * Latest wire post on profile page + * + * @uses $vars['entity'] User that owns this profile page */ $owner = $vars['entity']->guid; -$url_to_wire = elgg_get_site_url() . "pg/thewire/owner/" . $vars['entity']->username; //grab the user's latest from the wire $params = array( - 'types' => 'object', - 'subtypes' => 'thewire', + 'type' => 'object', + 'subtype' => 'thewire', 'owner_guid' => $owner, 'limit' => 1, ); @@ -18,14 +19,26 @@ $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='entity-subtext'> (" . elgg_view_friendly_time($latest_wire->time_created) . ")</p>"; + $time = "<p class='elgg-subtext'>(" . elgg_view_friendly_time($latest_wire->time_created) . ")</p>"; - echo "<div class='wire_post'><div class='wire_post_contents clearfix radius8'>"; - echo $content; + $button = ''; if ($owner == elgg_get_logged_in_user_guid()) { - $text = elgg_echo('thewire:update'); - echo "<a class='elgg-button elgg-button-action update small' href=\"{$url_to_wire}\">$text</a>"; + $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, + )); } - echo $time; - echo "</div></div>"; + + $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 index 3794e1454..341b691b1 100644 --- a/mod/thewire/views/default/thewire/reply.php +++ b/mod/thewire/views/default/thewire/reply.php @@ -5,7 +5,10 @@ $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', array($poster->name)); ?>: </b> +<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/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/widgets/thewire/content.php b/mod/thewire/views/default/widgets/thewire/content.php index a8471a4b1..7212d4397 100644 --- a/mod/thewire/views/default/widgets/thewire/content.php +++ b/mod/thewire/views/default/widgets/thewire/content.php @@ -18,10 +18,11 @@ $content = elgg_list_entities($options); echo $content; if ($content) { - $owner_url = "pg/thewire/owner/" . elgg_get_page_owner_entity()->username; + $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 { |
