diff options
Diffstat (limited to 'mod/thewire/views/default')
-rw-r--r-- | mod/thewire/views/default/forms/thewire/add.php | 64 | ||||
-rw-r--r-- | mod/thewire/views/default/object/thewire.php | 106 | ||||
-rw-r--r-- | mod/thewire/views/default/river/object/thewire/create.php | 2 | ||||
-rw-r--r-- | mod/thewire/views/default/thewire/css.php | 36 | ||||
-rw-r--r-- | mod/thewire/views/default/thewire/forms/add.php | 31 | ||||
-rw-r--r-- | mod/thewire/views/default/thewire/metadata.php | 56 | ||||
-rw-r--r-- | mod/thewire/views/default/thewire/notfound.php | 17 | ||||
-rw-r--r-- | mod/thewire/views/default/thewire/profile_status.php | 16 | ||||
-rw-r--r-- | mod/thewire/views/default/thewire/reply.php | 11 | ||||
-rw-r--r-- | mod/thewire/views/default/thewire/view.php | 23 | ||||
-rw-r--r-- | mod/thewire/views/default/widgets/thewire/content.php | 28 | ||||
-rw-r--r-- | mod/thewire/views/default/widgets/thewire/edit.php | 30 |
12 files changed, 250 insertions, 170 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..e34a8c0e5 --- /dev/null +++ b/mod/thewire/views/default/forms/thewire/add.php @@ -0,0 +1,64 @@ +<?php +/** + * Wire add form body + * + * @uses $vars['post'] + */ + +$post = elgg_get_array_value('post', $vars); + +$text = elgg_echo('post'); +if ($post) { + $text = elgg_echo('thewire:reply'); +} + +if ($post) { + echo elgg_view('input/hidden', array( + 'internalname' => 'parent_guid', + 'value' => $post->guid, + )); +} +?> +<textarea id="thewire-textarea" name="body" class="mtm"></textarea> +<div id="thewire-characters-remaining"> + <span>140</span> <?php echo elgg_echo('thewire:charleft'); ?> +</div> +<?php + +echo elgg_view('input/submit', array( + 'value' => $text, + 'internalid' => 'thewire-submit-button', +)); + +?> +<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> diff --git a/mod/thewire/views/default/object/thewire.php b/mod/thewire/views/default/object/thewire.php index d15454815..603870153 100644 --- a/mod/thewire/views/default/object/thewire.php +++ b/mod/thewire/views/default/object/thewire.php @@ -1,69 +1,53 @@ <?php +/** + * View a wire post + * + * @uses $vars['entity'] + */ - /** - * Elgg Wire Posts Listings - * - * @package thewire - * - * @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; +$full = elgg_get_array_value('full', $vars, FALSE); +$post = elgg_get_array_value('entity', $vars, FALSE); - //if the note is a reply, we need some more info - $note_url = ''; - $note_owner = elgg_echo("thewire:notedeleted"); -?> -<div class="wire_post"> - <div class="wire_post_contents clearfix radius8"> +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; +} - <div class="wire_post_icon"> - <?php - echo elgg_view("profile/icon",array('entity' => $vars['entity']->getOwnerEntity(), 'size' => 'tiny')); - ?> - </div> +$owner = $post->getOwnerEntity(); - <div class="wire_post_options"> - <?php - if(elgg_is_logged_in()){ - ?> - <a href="<?php echo elgg_get_site_url(); ?>mod/thewire/add.php?wire_username=<?php echo $vars['entity']->getOwnerEntity()->username; ?>" class="elgg-button-action reply small"><?php echo elgg_echo('thewire:reply'); ?></a> - <?php - }//close reply if statement - // if the user looking at thewire post can edit, show the delete link - if ($vars['entity']->canEdit()) { - echo "<span class='delete-button'>" . elgg_view("output/confirmlink",array( - 'href' => "action/thewire/delete?thewirepost=" . $vars['entity']->getGUID(), - 'text' => elgg_echo('delete'), - 'confirm' => elgg_echo('deleteconfirm'), - )) . "</span>"; - } - ?> - </div> +$owner_icon = elgg_view_entity_icon($owner, 'tiny'); +$owner_link = elgg_view('output/url', array( + 'href' => "pg/thewire/owner/$owner->username", + 'text' => $owner->name, +)); +$author_text = elgg_echo('blog:author_by_line', array($owner_link)); +$date = elgg_view_friendly_time($post->time_created); - <div class="wire_post_info"> - <a href="<?php echo elgg_get_site_url(); ?>pg/thewire/<?php echo $vars['entity']->getOwnerEntity()->username; ?>"><?php echo $user_name; ?></a> - <?php - $desc = $vars['entity']->description; - //$desc = preg_replace('/\@([A-Za-z0-9\_\.\-]*)/i','@<a href="' . elgg_get_site_url() . 'pg/thewire/$1">$1</a>',$desc); - echo parse_urls($desc); - ?> - <p class="entity-subtext"> - <?php - echo elgg_echo("thewire:wired") . " " . elgg_echo("thewire:strapline", - array(elgg_view_friendly_time($vars['entity']->time_created)) - ); - echo ' '; - echo elgg_echo('thewire:via_method', array(elgg_echo($vars['entity']->method))); - echo '.'; - ?> - </p> - </div> - </div> -</div> -<?php +$metadata = elgg_view('thewire/metadata', array( + 'entity' => $post, + 'handler' => 'thewire', +)); + +$subtitle = "$author_text $date"; + +// do not show the metadata and controls in widget view +if (elgg_in_context('widgets')) { + $metadata = ''; } -?>
\ No newline at end of file + +$params = array( + 'entity' => $post, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + 'content' => thewire_filter($post->description), + 'tags' => false, +); +$list_body = elgg_view('layout/objects/list/body', $params); + +echo elgg_view_image_block($owner_icon, $list_body); diff --git a/mod/thewire/views/default/river/object/thewire/create.php b/mod/thewire/views/default/river/object/thewire/create.php index b1142e0f4..d4dac38ee 100644 --- a/mod/thewire/views/default/river/object/thewire/create.php +++ b/mod/thewire/views/default/river/object/thewire/create.php @@ -5,7 +5,7 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); -$excerpt = elgg_get_excerpt($excerpt); +$excerpt = thewire_filter($excerpt); $params = array( 'href' => $object->getURL(), diff --git a/mod/thewire/views/default/thewire/css.php b/mod/thewire/views/default/thewire/css.php index d7beac105..c1c7b5bcb 100644 --- a/mod/thewire/views/default/thewire/css.php +++ b/mod/thewire/views/default/thewire/css.php @@ -1,12 +1,36 @@ <?php +/** + * The Wire CSS + */ - /** - * Elgg thewire CSS extender - * - * @package ElggTheWire - */ - ?> +/******************************** + The Wire +*********************************/ +#thewire-textarea { + height: 40px; + padding: 6px; +} +#thewire-characters-remaining { + text-align: right; + float: right; + font-weight: bold; + color: #333333; +} +.thewire-characters-remaining { + color:#333333; + border:none; + font-size: 100%; + font-weight: bold; + padding:0 2px 0 0; + margin:0; + text-align: right; + background: white; +} +<?php +return true; +?> + /* new wire post form */ .new_wire_post { margin:10px 0 15px 0; 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 3ad968b3b..000000000 --- a/mod/thewire/views/default/thewire/forms/add.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - - /** - * Elgg thewire edit/add page - * - * @package ElggTheWire - * - */ - - $wire_user = get_input('wire_username'); - if (!empty($wire_user)) { $msg = '@' . $wire_user . ' '; } else { $msg = ''; } - -?> -<div class="new_wire_post clearfix"> -<h3><?php echo elgg_echo("thewire:doing"); ?></h3> -<?php //@todo JS 1.8: no ?> -<script type="text/javascript" src="<?php echo elgg_get_site_url(); ?>mod/thewire/views/default/thewire/scripts/counter.js"></script> -<form action="<?php echo elgg_get_site_url(); ?>action/thewire/add" method="post" name="new_post"> - <?php - $action_txt = elgg_echo('post'); - $display .= "<textarea name='new_post_textarea' value='' onKeyDown=\"textCounter(document.new_post.new_post_textarea,document.new_post.remLen1,140)\" onKeyUp=\"textCounter(document.new_post.new_post_textarea,document.new_post.remLen1,140)\">{$msg}</textarea>"; - $display .= "<input type='submit' class='elgg-button-action' value='{$action_txt}' />"; - $display .= "<div class='character_count'><input readonly type=\"text\" name=\"remLen1\" size=\"3\" maxlength=\"3\" value=\"140\">"; - echo $display; - echo elgg_echo("thewire:charleft") . "</div>"; - echo elgg_view('input/securitytoken'); - ?> - <input type="hidden" name="method" value="site" /> -</form> -</div> -<?php echo elgg_view('input/urlshortener'); ?>
\ No newline at end of file diff --git a/mod/thewire/views/default/thewire/metadata.php b/mod/thewire/views/default/thewire/metadata.php new file mode 100644 index 000000000..f04345ed2 --- /dev/null +++ b/mod/thewire/views/default/thewire/metadata.php @@ -0,0 +1,56 @@ +<?php +/** + * + */ + +$entity = $vars['entity']; +$handler = elgg_get_array_value('handler', $vars, ''); + +?> +<ul class="elgg-list-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' => '<span class="elgg-icon elgg-icon-delete"></span>', + '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/notfound.php b/mod/thewire/views/default/thewire/notfound.php deleted file mode 100644 index a3d08fe18..000000000 --- a/mod/thewire/views/default/thewire/notfound.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - - /** - * Elgg shout not found page - * - * @package ElggShouts - */ - -?> - - <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 index 29dc69329..9ff0c4d59 100644 --- a/mod/thewire/views/default/thewire/profile_status.php +++ b/mod/thewire/views/default/thewire/profile_status.php @@ -1,12 +1,11 @@ <?php - /** - * Latest wire post on profile activity page + * Latest wire post on profile page */ $owner = $vars['entity']->guid; -$url_to_wire = elgg_get_site_url() . "pg/thewire/" . $vars['entity']->username; - +$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', @@ -16,11 +15,10 @@ $params = array( ); $latest_wire = elgg_get_entities($params); -if ($latest_wire) { - foreach ($latest_wire as $lw) { - $content = $lw->description; - $time = "<p class='entity-subtext'> (" . elgg_view_friendly_time($lw->time_created) . ")</p>"; - } +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>"; echo "<div class='wire_post'><div class='wire_post_contents clearfix radius8'>"; echo $content; diff --git a/mod/thewire/views/default/thewire/reply.php b/mod/thewire/views/default/thewire/reply.php new file mode 100644 index 000000000..3794e1454 --- /dev/null +++ b/mod/thewire/views/default/thewire/reply.php @@ -0,0 +1,11 @@ +<?php +/** + * Reply header + */ + +$post = $vars['post']; +$poster = $post->getOwnerEntity(); + +?> +<b><?php echo elgg_echo('thewire:replying', array($poster->name)); ?>: </b> +<?php echo $post->description;
\ No newline at end of file diff --git a/mod/thewire/views/default/thewire/view.php b/mod/thewire/views/default/thewire/view.php deleted file mode 100644 index 725643cd1..000000000 --- a/mod/thewire/views/default/thewire/view.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - - /** - * Elgg thewire view page - * - * @package ElggTheWire - * - * @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 index 6de5f1e64..a8471a4b1 100644 --- a/mod/thewire/views/default/widgets/thewire/content.php +++ b/mod/thewire/views/default/widgets/thewire/content.php @@ -1,15 +1,29 @@ <?php - +/** + * User wire post widget display view + */ + $num = $vars['entity']->num_display; -if (!$num) { - $num = 4; -} -$content = elgg_list_entities(array('types' => 'object', 'subtypes' => 'thewire', 'container_guid' => $vars['entity']->owner_guid, 'limit' => $num, 'full_view' => FALSE, 'pagination' => FALSE)); +$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) { - $blogurl = elgg_get_site_url() . "pg/thewire/" . elgg_get_page_owner_entity()->username; - echo "<div class=\"shares_widget_wrapper\"><a href=\"{$blogurl}\">".elgg_echo('thewire:moreposts')."</a></div>"; + $owner_url = "pg/thewire/owner/" . elgg_get_page_owner_entity()->username; + $more_link = elgg_view('output/url', array( + 'href' => $owner_url, + 'text' => elgg_echo('thewire:moreposts'), + )); + 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 969015ab8..8c93383ad 100644 --- a/mod/thewire/views/default/widgets/thewire/edit.php +++ b/mod/thewire/views/default/widgets/thewire/edit.php @@ -1,22 +1,22 @@ <?php +/** + * User wire widget edit view + */ + // 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"; -} +$params = array( + 'internalname' => '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); + ?> - </select> -</p>
\ No newline at end of file +<div> + <?php echo elgg_echo('thewire:num'); ?>: + <?php echo $dropdown; ?> +</div> |