diff options
Diffstat (limited to 'mod/search/views')
18 files changed, 360 insertions, 429 deletions
diff --git a/mod/search/views/default/page_elements/searchbox.php b/mod/search/views/default/page_elements/searchbox.php deleted file mode 100644 index f70a6ad97..000000000 --- a/mod/search/views/default/page_elements/searchbox.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -if (array_key_exists('value', $vars)) { - $value = $vars['value']; -} elseif ($value = get_input('q', get_input('tag', NULL))) { - $value = $value; -} else { - $value = elgg_echo('search'); -} - -$value = stripslashes($value); - -?> - -<form id="searchform" action="<?php echo $vars['url']; ?>pg/search/" method="get"> - <input type="text" size="21" name="q" value="<?php echo $value; ?>" onclick="if (this.value=='<?php echo elgg_echo('search'); ?>') { this.value='' }" class="search_input" /> - <input type="submit" value="<?php echo elgg_echo('search:go'); ?>" class="search_submit_button" /> -</form> diff --git a/mod/search/views/default/search/comments/entity.php b/mod/search/views/default/search/comments/entity.php index 8b4d286c9..77e950843 100644 --- a/mod/search/views/default/search/comments/entity.php +++ b/mod/search/views/default/search/comments/entity.php @@ -1,25 +1,26 @@ <?php /** - * Elgg search entity + * Default search view for a comment * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ + * @uses $vars['entity'] */ + $entity = $vars['entity']; +$comments_data = $entity->getVolatileData('search_comments_data'); +$comment_data = array_shift($comments_data); +$entity->setVolatileData('search_comments_data', $comments_data); -$owner = get_entity($entity->getVolatileData('search_matched_comment_owner_guid')); +$owner = get_entity($comment_data['owner_guid']); if ($owner instanceof ElggUser) { - $icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'small')); + $icon = elgg_view_entity_icon($owner, 'tiny'); } else { $icon = ''; } // @todo Sometimes we find comments on entities we can't display... if ($entity->getVolatileData('search_unavailable_entity')) { - $title = sprintf(elgg_echo('search:comment_on'), elgg_echo('search:unavailable_entity')); + $title = elgg_echo('search:comment_on', array(elgg_echo('search:unavailable_entity'))); // keep anchor for formatting. $title = "<a>$title</a>"; } else { @@ -37,23 +38,18 @@ if ($entity->getVolatileData('search_unavailable_entity')) { $title = elgg_echo('item:' . $entity->getType()); } - $title = sprintf(elgg_echo('search:comment_on'), $title); - $url = $entity->getURL() . '#annotation-' . $entity->getVolatileData('search_match_annotation_id'); + $title = elgg_echo('search:comment_on', array($title)); + + // @todo this should use something like $comment->getURL() + $url = $entity->getURL() . '#comment_' . $comment_data['annotation_id']; $title = "<a href=\"$url\">$title</a>"; } -$description = $entity->getVolatileData('search_matched_comment'); -$tc = $entity->getVolatileData('search_matched_comment_time_created');; -$time = friendly_time($tc); - -echo <<<___END - <div class="search_listing"> - <div class="search_listing_icon">$icon</div> - <div class="search_listing_info"> - <p class="ItemTitle">$title</p>$description - <p class="ItemTimestamp">$time</p> - </div> - </div> -___END; - -?>
\ No newline at end of file +$description = $comment_data['text']; +$tc = $comment_data['time_created']; +$time = elgg_view_friendly_time($tc); + +$body = "<p class=\"mbn\">$title</p>$description"; +$body .= "<p class=\"elgg-subtext\">$time</p>"; + +echo elgg_view_image_block($icon, $body); diff --git a/mod/search/views/default/search/css.php b/mod/search/views/default/search/css.php index 19cca02e8..30ff45172 100644 --- a/mod/search/views/default/search/css.php +++ b/mod/search/views/default/search/css.php @@ -1,100 +1,67 @@ -.searchtype { -background: #FFFACD; -color: black; -} - -.searchtypes { -border: 1px #EEEEEE solid; -padding: 4px; -margin: 6px; -} +<?php +/** + * Elgg Search css + * + */ +?> -.searchListing { - display: block; - margin-bottom: 2em; +/********************************** +Search plugin +***********************************/ +.elgg-search-header { + bottom: 5px; + height: 23px; + position: absolute; + right: 0; +} +.elgg-search input[type=text] { + width: 230px; +} +.elgg-search input[type=submit] { + display: none; +} +.elgg-search input[type=text] { + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + + border: 1px solid #71b9f7; + color: white; + font-size: 12px; + font-weight: bold; + padding: 2px 4px 2px 26px; + background: transparent url(<?php echo elgg_get_site_url(); ?>_graphics/elgg_sprites.png) no-repeat 2px -934px; +} +.elgg-search input[type=text]:focus, .elgg-search input[type=text]:active { + background-color: white; + background-position: 2px -916px; + border: 1px solid white; + color: #0054A7; } -.searchMatch { - background-color: #FFFF66; +.search-list li { + padding: 5px 0 0; } - -.searchMatchColor1 { - background-color: #FFFF66; +.search-heading-category { + margin-top: 20px; + color: #666666; } -.searchMatchColor2 { - background-color: #A0FFFF; +.search-highlight { + background-color: #bbdaf7; } - -.searchMatchColor3 { - background-color: #FF9999; +.search-highlight-color1 { + background-color: #bbdaf7; } - -.searchMatchColor4 { - background-color: #FF66FF; -} - -.searchMatchColor5 { - background-color: #99FF99; -} - -.searchTitle { - text-decoration: underline; -} - -#searchform input.search_input { - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - background-color:#FFFFFF; - border:1px solid #BBBBBB; - color:#999999; - font-size:12px; - font-weight:bold; - margin:0pt; - padding:2px; - width:180px; - height:12px; -} -#searchform input.search_submit_button { - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - color:#333333; - background: #cccccc; - border:none; - font-size:12px; - font-weight:bold; - margin:0px; - padding:2px; - width:auto; - height:18px; - cursor:pointer; -} -#searchform input.search_submit_button:hover { - color:#ffffff; - background: #4690d6; +.search-highlight-color2 { + background-color: #A0FFFF; } - - -.search_listing { - display: block; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - background:white; - margin:0 10px 5px 10px; - padding:5px; +.search-highlight-color3 { + background-color: #FDFFC3; } - -.entity_gallery_item .search_listing { - background: none; - text-align: center; +.search-highlight-color4 { + background-color: #ccc; } - -/* override the entity container piece */ -.search_listing .search_listing { - -webkit-border-radius: 0px; - -moz-border-radius: 0px; - background: transparent; - margin: 0; - padding: 0; +.search-highlight-color5 { + background-color: #4690d6; } - diff --git a/mod/search/views/default/search/entity.php b/mod/search/views/default/search/entity.php index 06dd54f39..e04d08836 100644 --- a/mod/search/views/default/search/entity.php +++ b/mod/search/views/default/search/entity.php @@ -1,41 +1,57 @@ <?php /** - * Elgg search entity + * Default view for an entity returned in a search * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ + * Display largely controlled by a set of overrideable volatile data: + * - search_icon (defaults to entity icon) + * - search_matched_title + * - search_matched_description + * - search_matched_extra + * - search_url (defaults to entity->getURL()) + * - search_time (defaults to entity->time_updated or entity->time_created) + * + * @uses $vars['entity'] Entity returned in a search */ $entity = $vars['entity']; -if ($owner = $entity->getOwnerEntity()) { - $icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'small')); -} elseif ($entity instanceof ElggUser) { - $icon = elgg_view('profile/icon', array('entity' => $entity, 'size' => 'small')); -} else { - $icon = ''; +$icon = $entity->getVolatileData('search_icon'); +if (!$icon) { + // display the entity's owner by default if available. + // @todo allow an option to switch to displaying the entity's icon instead. + $type = $entity->getType(); + if ($type == 'user' || $type == 'group') { + $icon = elgg_view_entity_icon($entity, 'tiny'); + } elseif ($owner = $entity->getOwnerEntity()) { + $icon = elgg_view_entity_icon($owner, 'tiny'); + } else { + // display a generic icon if no owner, though there will probably be + // other problems if the owner can't be found. + $icon = elgg_view_entity_icon($entity, 'tiny'); + } } $title = $entity->getVolatileData('search_matched_title'); $description = $entity->getVolatileData('search_matched_description'); $extra_info = $entity->getVolatileData('search_matched_extra'); -$url = $entity->getURL(); +$url = $entity->getVolatileData('search_url'); + +if (!$url) { + $url = $entity->getURL(); +} + $title = "<a href=\"$url\">$title</a>"; -$tc = $entity->time_created; -$tu = $entity->time_updated; -$time = friendly_time(($tu > $tc) ? $tu : $tc); +$time = $entity->getVolatileData('search_time'); +if (!$time) { + $tc = $entity->time_created; + $tu = $entity->time_updated; + $time = elgg_view_friendly_time(($tu > $tc) ? $tu : $tc); +} -echo <<<___END - <div class="search_listing"> - <div class="search_listing_icon">$icon</div> - <div class="search_listing_info"> - <p class="ItemTitle">$title</p>$description - <p class="ItemTimestamp">$time $extra_info</p> - </div> - </div> -___END; +$body = "<p class=\"mbn\">$title</p>$description"; +if ($extra_info) { + $body .= "<p class=\"elgg-subtext\">$extra_info</p>"; +} +$body .= "<p class=\"elgg-subtext\">$time</p>"; -// php bug. must have close tag after heredocs -?>
\ No newline at end of file +echo elgg_view_image_block($icon, $body); diff --git a/mod/search/views/default/search/entity_list.php b/mod/search/views/default/search/entity_list.php deleted file mode 100644 index 4a04aaf84..000000000 --- a/mod/search/views/default/search/entity_list.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -$context = $vars['context']; -$offset = $vars['offset']; -$entities = $vars['entities']; -$limit = $vars['limit']; -$count = $vars['count']; -$baseurl = $vars['baseurl']; -$context = $vars['context']; -$viewtype = $vars['viewtype']; -$pagination = $vars['pagination']; -$fullview = $vars['fullview']; - -$html = ""; -$nav = ""; -if (isset($vars['viewtypetoggle'])) { - $viewtypetoggle = $vars['viewtypetoggle']; -} else { - $viewtypetoggle = true; -} - -if ($context == "search" && $count > 0 && $viewtypetoggle) { - $nav .= elgg_view("navigation/viewtype",array( - - 'baseurl' => $baseurl, - 'offset' => $offset, - 'count' => $count, - 'viewtype' => $viewtype, - - )); -} - -if ($pagination) - $nav .= elgg_view('navigation/pagination',array( - - 'baseurl' => $baseurl, - 'offset' => $offset, - 'count' => $count, - 'limit' => $limit, - - )); - -if ($viewtype == "list") { - if (is_array($entities) && sizeof($entities) > 0) { - foreach($entities as $entity) { - // print out the entity - $ev = elgg_view_entity($entity, $fullview); - // then add the search decorations around it - $html .= elgg_view('search/listing', array('entity_view' => $ev, - 'search_types' => $entity->getVolatileData('search'))); - - } - } -} else if ($viewtype == "gallery") { - if (is_array($entities) && sizeof($entities) > 0) { - $html .= elgg_view("search/gallery",array('entities' => $entities)); - } -} - -if ($count) { - $html .= $nav; -} -echo $html; - -?> diff --git a/mod/search/views/default/search/gallery.php b/mod/search/views/default/search/gallery.php deleted file mode 100644 index 753a38684..000000000 --- a/mod/search/views/default/search/gallery.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - - /** - * Elgg gallery view - * - * @package Elgg - * @subpackage Core - - * @author Curverider Ltd - - * @link http://elgg.org/ - */ - - $entities = $vars['entities']; - if (is_array($entities) && sizeof($entities) > 0) { - -?> - - <table class="entity_gallery"> - -<?php - - $col = 0; - foreach($entities as $entity) { - if ($col == 0) { - - echo "<tr>"; - - } - echo "<td class=\"entity_gallery_item\">"; - - $ev = elgg_view_entity($entity, $fullview); - - echo elgg_view('search/listing', array('entity_view' => $ev, - 'search_types' => $entity->getVolatileData('search'))); - - - echo "</td>"; - $col++; - if ($col > 3) { - echo "</tr>"; - $col = 0; - } - } - if ($col > 0) echo "</tr>"; - -?> - - </table> - -<?php - - } - -?>
\ No newline at end of file diff --git a/mod/search/views/default/search/gallery_listing.php b/mod/search/views/default/search/gallery_listing.php deleted file mode 100644 index bbecaf202..000000000 --- a/mod/search/views/default/search/gallery_listing.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -/** - * Elgg search listing: gallery view - * - * DEPRECATED VIEW: use entities/gallery_listing instead - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - - - echo elgg_view('entities/gallery_listing', $vars); - -?>
\ No newline at end of file diff --git a/mod/search/views/default/search/header.php b/mod/search/views/default/search/header.php new file mode 100644 index 000000000..6f8654c13 --- /dev/null +++ b/mod/search/views/default/search/header.php @@ -0,0 +1,6 @@ +<?php +/** + * Search box in page header + */ + +echo elgg_view('search/search_box', array('class' => 'elgg-search-header'));
\ No newline at end of file diff --git a/mod/search/views/default/search/layout.php b/mod/search/views/default/search/layout.php index f79cfee12..eb597836e 100644 --- a/mod/search/views/default/search/layout.php +++ b/mod/search/views/default/search/layout.php @@ -1,11 +1,8 @@ <?php /** - * Elgg core search listing. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd <info@elgg.com>, The MITRE Corporation <http://www.mitre.org> - * @link http://elgg.org/ - */ + * The default search layout + * + * @uses $vars['body'] + */ -echo elgg_view_layout('two_column_left_sidebar', '', $vars['body']);
\ No newline at end of file +echo elgg_view_layout('one_sidebar', array('content' => $vars['body']));
\ No newline at end of file diff --git a/mod/search/views/default/search/list.php b/mod/search/views/default/search/list.php new file mode 100644 index 000000000..90aa28989 --- /dev/null +++ b/mod/search/views/default/search/list.php @@ -0,0 +1,115 @@ +<?php +/** + * List a section of search results corresponding in a particular type/subtype + * or search type (comments for example) + * + * @uses $vars['results'] Array of data related to search results including: + * - 'entities' Array of entities to be displayed + * - 'count' Total number of results + * @uses $vars['params'] Array of parameters including: + * - 'type' Entity type + * - 'subtype' Entity subtype + * - 'search_type' Type of search: 'entities', 'comments', 'tags' + * - 'offset' Offset in search results + * - 'limit' Number of results per page + * - 'pagination' Display pagination? + */ + +$entities = $vars['results']['entities']; +$count = $vars['results']['count'] - count($entities); + +if (!is_array($entities) || !count($entities)) { + return FALSE; +} + +$query = http_build_query( + array( + 'q' => $vars['params']['query'], + 'entity_type' => $vars['params']['type'], + 'entity_subtype' => $vars['params']['subtype'], + 'limit' => $vars['params']['limit'], + 'offset' => $vars['params']['offset'], + 'search_type' => $vars['params']['search_type'], + //@todo include vars for sorting, order, and friend-only. + ) +); + +$url = elgg_get_site_url() . "search?$query"; + +$more_items = $vars['results']['count'] - ($vars['params']['offset'] + $vars['params']['limit']); + +// get pagination +if (array_key_exists('pagination', $vars['params']) && $vars['params']['pagination']) { + $nav = elgg_view('navigation/pagination', array( + 'base_url' => $url, + 'offset' => $vars['params']['offset'], + 'count' => $vars['results']['count'], + 'limit' => $vars['params']['limit'], + )); + $show_more = false; +} else { + // faceted search page so no pagination + $nav = ''; + $show_more = $more_items > 0; +} + +// figure out what we're dealing with. +$type_str = NULL; + +if (array_key_exists('type', $vars['params']) && array_key_exists('subtype', $vars['params'])) { + $type_str_tmp = "item:{$vars['params']['type']}:{$vars['params']['subtype']}"; + $type_str_echoed = elgg_echo($type_str_tmp); + if ($type_str_echoed != $type_str_tmp) { + $type_str = $type_str_echoed; + } +} + +if (!$type_str && array_key_exists('type', $vars['params'])) { + $type_str = elgg_echo("item:{$vars['params']['type']}"); +} + +if (!$type_str) { + $type_str = elgg_echo('search:unknown_entity'); +} + +// allow overrides for titles +$search_type_str = elgg_echo("search_types:{$vars['params']['search_type']}"); +if (array_key_exists('search_type', $vars['params']) + && $search_type_str != "search_types:{$vars['params']['search_type']}") { + + $type_str = $search_type_str; +} + +if ($show_more) { + $more_str = elgg_echo('search:more', array($count, $type_str)); + $more_url = elgg_http_remove_url_query_element($url, 'limit'); + $more_link = "<li class='elgg-item'><a href=\"$more_url\">$more_str</a></li>"; +} else { + $more_link = ''; +} + +// @todo once elgg_view_title() supports passing a $vars array use it +$body = elgg_view('page/elements/title', array( + 'title' => $type_str, + 'class' => 'search-heading-category', +)); + +$view = search_get_search_view($vars['params'], 'entity'); +if ($view) { + $body .= '<ul class="elgg-list search-list">'; + foreach ($entities as $entity) { + $id = "elgg-{$entity->getType()}-{$entity->getGUID()}"; + $body .= "<li id=\"$id\" class=\"elgg-item\">"; + $body .= elgg_view($view, array( + 'entity' => $entity, + 'params' => $vars['params'], + 'results' => $vars['results'] + )); + $body .= '</li>'; + } + $body .= $more_link; + $body .= '</ul>'; +} + +echo $body; +echo $nav; diff --git a/mod/search/views/default/search/listing.php b/mod/search/views/default/search/listing.php deleted file mode 100644 index 5142e1fe5..000000000 --- a/mod/search/views/default/search/listing.php +++ /dev/null @@ -1,108 +0,0 @@ -<?php -/** - * Elgg search listing - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - */ - -$entities = $vars['results']['entities']; -$count = $vars['results']['count'] - count($entities); - -if (!is_array($entities) || !count($entities)) { - return FALSE; -} - -$query = htmlspecialchars(http_build_query( - array( - 'q' => $vars['params']['query'], - 'entity_type' => $vars['params']['type'], - 'entity_subtype' => $vars['params']['subtype'], - 'limit' => get_input('limit', 10), - 'offset' => get_input('offset', 0), - 'search_type' => $vars['params']['search_type'], - //@todo include vars for sorting, order, and friend-only. - ) -)); - -$url = "{$vars['url']}pg/search?$query"; - -// get pagination -if (array_key_exists('pagination', $vars) && $vars['pagination']) { - $nav .= elgg_view('navigation/pagination',array( - 'baseurl' => $url, - 'offset' => $vars['params']['offset'], - 'count' => $vars['results']['count'], - 'limit' => $vars['params']['limit'], - )); -} else { - $nav = ''; -} - -// figure out what we're dealing with. -$type_str = NULL; - -if (array_key_exists('type', $vars['params']) && array_key_exists('subtype', $vars['params'])) { - $type_str_tmp = "item:{$vars['params']['type']}:{$vars['params']['subtype']}"; - $type_str_echoed = elgg_echo($type_str_tmp); - if ($type_str_echoed != $type_str_tmp) { - $type_str = $type_str_echoed; - } -} - -if (!$type_str && array_key_exists('type', $vars['params'])) { - $type_str = elgg_echo("item:{$vars['params']['type']}"); -} - -if (!$type_str) { - $type_str = elgg_echo('search:unknown_entity'); -} - -// allow overrides for titles -$search_type_str = elgg_echo("search_types:{$vars['params']['search_type']}"); -if (array_key_exists('search_type', $vars['params']) - && $search_type_str != "search_types:{$vars['params']['search_type']}") { - - $type_str = $search_type_str; -} - -// get pagination -if (array_key_exists('pagination', $vars['params']) && $vars['params']['pagination']) { - $nav .= elgg_view('navigation/pagination',array( - 'baseurl' => $url, - 'offset' => $vars['params']['offset'], - 'count' => $vars['results']['count'], - 'limit' => $vars['params']['limit'], - )); -} else { - $nav = ''; -} - -// get any more links. -$more_check = $vars['results']['count'] - ($vars['params']['offset'] + $vars['params']['limit']); -$more = ($more_check > 0) ? $more_check : 0; - -if ($more) { - $title_key = ($more == 1) ? 'comment' : 'comments'; - $more_str = sprintf(elgg_echo('search:more'), $count, $type_str); - $more_link = "<div class='search_listing'><a href=\"$url\">$more_str</a></div>"; -} else { - $more_link = ''; -} - -$body = elgg_view_title($type_str); - -foreach ($entities as $entity) { - if ($view = search_get_search_view($vars['params'], 'entity')) { - $body .= elgg_view($view, array( - 'entity' => $entity, - 'params' => $vars['params'], - 'results' => $vars['results'] - )); - } -} -echo $body; -echo $more_link; -echo $nav; diff --git a/mod/search/views/default/search/no_results.php b/mod/search/views/default/search/no_results.php new file mode 100644 index 000000000..0e9a5e295 --- /dev/null +++ b/mod/search/views/default/search/no_results.php @@ -0,0 +1,6 @@ +<?php +/** + * No results from search + */ + +echo elgg_autop(elgg_echo('search:no_results')); diff --git a/mod/search/views/default/search/search_box.php b/mod/search/views/default/search/search_box.php new file mode 100644 index 000000000..7474a280c --- /dev/null +++ b/mod/search/views/default/search/search_box.php @@ -0,0 +1,43 @@ +<?php +/** + * Search box + * + * @uses $vars['value'] Current search query + * @uses $vars['class'] Additional class + */ + +if (array_key_exists('value', $vars)) { + $value = $vars['value']; +} elseif ($value = get_input('q', get_input('tag', NULL))) { + $value = $value; +} else { + $value = elgg_echo('search'); +} + +$class = "elgg-search"; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} + +// @todo - why the strip slashes? +$value = stripslashes($value); + +// @todo - create function for sanitization of strings for display in 1.8 +// encode <,>,&, quotes and characters above 127 +if (function_exists('mb_convert_encoding')) { + $display_query = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8'); +} else { + // if no mbstring extension, we just strip characters + $display_query = preg_replace("/[^\x01-\x7F]/", "", $value); +} +$display_query = htmlspecialchars($display_query, ENT_QUOTES, 'UTF-8', false); + +?> + +<form class="<?php echo $class; ?>" action="<?php echo elgg_get_site_url(); ?>search" method="get"> + <fieldset> + <input type="text" class="search-input" size="21" name="q" value="<?php echo $display_query; ?>" onblur="if (this.value=='') { this.value='<?php echo elgg_echo('search'); ?>' }" onfocus="if (this.value=='<?php echo elgg_echo('search'); ?>') { this.value='' };" /> + <input type="hidden" name="search_type" value="all" /> + <input type="submit" value="<?php echo elgg_echo('search:go'); ?>" class="search-submit-button" /> + </fieldset> +</form> diff --git a/mod/search/views/default/search/startblurb.php b/mod/search/views/default/search/startblurb.php index 82d2d62d1..d6394da0d 100644 --- a/mod/search/views/default/search/startblurb.php +++ b/mod/search/views/default/search/startblurb.php @@ -1,13 +1,6 @@ <?php /** - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ + * @todo This doesn't appear to be called by anything. Look into removing. */ -?> -<div class="contentWrapper"> -<?php - echo sprintf(elgg_echo("tag:search:startblurb"), $vars['query']); -?> -</div>
\ No newline at end of file + +echo elgg_echo("tag:search:startblurb", array($vars['query'])); diff --git a/mod/search/views/rss/search/comments/entity.php b/mod/search/views/rss/search/comments/entity.php new file mode 100644 index 000000000..e47afec4a --- /dev/null +++ b/mod/search/views/rss/search/comments/entity.php @@ -0,0 +1,54 @@ +<?php +/** + * Search comment view for RSS feeds. + * + * @uses $vars['entity'] + */ + +$entity = $vars['entity']; +$comments_data = $entity->getVolatileData('search_comments_data'); +$comment_data = array_shift($comments_data); +$entity->setVolatileData('search_comments_data', $comments_data); + +$author_name = ''; +$comment_author_guid = $comment_data['owner_guid']; +$author = get_user($comment_author_guid); +if ($author) { + $author_name = $author->name; +} + +// @todo Sometimes we find comments on entities we can't display... +if ($entity->getVolatileData('search_unavailable_entity')) { + $title = elgg_echo('search:comment_on', array(elgg_echo('search:unavailable_entity'))); +} else { + if ($entity->getType() == 'object') { + $title = $entity->title; + } else { + $title = $entity->name; + } + + if (!$title) { + $title = elgg_echo('item:' . $entity->getType() . ':' . $entity->getSubtype()); + } + + if (!$title) { + $title = elgg_echo('item:' . $entity->getType()); + } + + $title = elgg_echo('search:comment_on', array($title)); + $title .= ' ' . elgg_echo('search:comment_by') . ' ' . $author_name; + $url = $entity->getURL() . '#annotation-' . $comment_data['annotation_id']; +} + +$description = $comment_data['text']; +$tc = $comment_data['time_created']; + +?> + +<item> + <guid isPermaLink='true'><?php echo htmlspecialchars($url); ?></guid> + <pubDate><?php echo date("r", $tc) ?></pubDate> + <link><?php echo htmlspecialchars($url); ?></link> + <title><![CDATA[<?php echo $title; ?>]]></title> + <description><![CDATA[<?php echo $description; ?>]]></description> +</item> diff --git a/mod/search/views/rss/search/entity.php b/mod/search/views/rss/search/entity.php index a8f9ebcc4..10d28e8e1 100644 --- a/mod/search/views/rss/search/entity.php +++ b/mod/search/views/rss/search/entity.php @@ -1,12 +1,8 @@ <?php /** - * Elgg core search. * Search entity view for RSS feeds. * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd <info@elgg.com>, The MITRE Corporation <http://www.mitre.org> - * @link http://elgg.org/ + * @uses $vars['entity'] */ if (!array_key_exists('entity', $vars) || !($vars['entity'] instanceof ElggEntity)) { diff --git a/mod/search/views/rss/search/layout.php b/mod/search/views/rss/search/layout.php new file mode 100644 index 000000000..2c255a9cc --- /dev/null +++ b/mod/search/views/rss/search/layout.php @@ -0,0 +1,6 @@ +<?php +/** + * Search layout for RSS + */ + +echo $vars['body']; diff --git a/mod/search/views/rss/search/listing.php b/mod/search/views/rss/search/list.php index 40aae018d..32082fd31 100644 --- a/mod/search/views/rss/search/listing.php +++ b/mod/search/views/rss/search/list.php @@ -1,12 +1,9 @@ <?php /** - * Elgg core search. - * Search listing view for RSS feeds. + * List a section of search results for RSS feeds. * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd <info@elgg.com>, The MITRE Corporation <http://www.mitre.org> - * @link http://elgg.org/ + * @uses $vars['results'] + * @uses $vars['params'] */ $entities = $vars['results']['entities']; |
