aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/search/start.php11
-rw-r--r--mod/search/views/default/search/comments/entity.php17
-rw-r--r--mod/search/views/default/search/css.php78
-rw-r--r--mod/search/views/default/search/entity.php22
-rw-r--r--mod/search/views/default/search/list.php44
5 files changed, 55 insertions, 117 deletions
diff --git a/mod/search/start.php b/mod/search/start.php
index 4f57a64c5..401bf84a5 100644
--- a/mod/search/start.php
+++ b/mod/search/start.php
@@ -249,8 +249,8 @@ function search_highlight_words($words, $string) {
$replace_html = array(
'strong' => rand(10000, 99999),
'class' => rand(10000, 99999),
- 'searchMatch' => rand(10000, 99999),
- 'searchMatchColor' => rand(10000, 99999)
+ 'search-highlight' => rand(10000, 99999),
+ 'search-highlight-color' => rand(10000, 99999)
);
foreach ($words as $word) {
@@ -262,16 +262,17 @@ function search_highlight_words($words, $string) {
$search = "/($word)/i";
+ // @todo
// must replace with placeholders in case one of the search terms is
// in the html string.
// later, will replace the placeholders with the actual html.
// Yeah this is hacky. I'm tired.
$strong = $replace_html['strong'];
$class = $replace_html['class'];
- $searchMatch = $replace_html['searchMatch'];
- $searchMatchColor = $replace_html['searchMatchColor'];
+ $highlight = $replace_html['search-highlight'];
+ $color = $replace_html['search-highlight-color'];
- $replace = "<$strong $class=\"$searchMatch $searchMatchColor{$i}\">$1</$strong>";
+ $replace = "<$strong $class=\"$highlight $color{$i}\">$1</$strong>";
$string = preg_replace($search, $replace, $string);
$i++;
}
diff --git a/mod/search/views/default/search/comments/entity.php b/mod/search/views/default/search/comments/entity.php
index eddb36547..005bb270c 100644
--- a/mod/search/views/default/search/comments/entity.php
+++ b/mod/search/views/default/search/comments/entity.php
@@ -1,6 +1,6 @@
<?php
/**
- * Default view for a comment
+ * Default search view for a comment
*
* @uses $vars['entity']
*/
@@ -46,14 +46,7 @@ $description = $entity->getVolatileData('search_matched_comment');
$tc = $entity->getVolatileData('search_matched_comment_time_created');;
$time = elgg_view_friendly_time($tc);
-echo <<<___END
- <div class="search_listing clearfix">
- <div class="search_listing_icon">$icon</div>
- <div class="search_listing_info">
- <p class="entity-title">$title</p>$description
- <p class="entity-subtext">$time</p>
- </div>
- </div>
-___END;
-
-?> \ No newline at end of file
+$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 d6e905bf0..02e43bf8b 100644
--- a/mod/search/views/default/search/css.php
+++ b/mod/search/views/default/search/css.php
@@ -2,10 +2,12 @@
/**
* Elgg Search css
*
- * @package search
*/
?>
+/**********************************
+ Search plugin
+***********************************/
.elgg-page-header .elgg-search {
bottom: 5px;
height: 23px;
@@ -15,6 +17,9 @@
.elgg-page-header .elgg-search input[type=text] {
width: 198px;
}
+.elgg-page-header .elgg-search input[type=submit] {
+ display: none;
+}
.elgg-search input[type=text] {
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
@@ -34,79 +39,30 @@
border: 1px solid white;
background-position: 2px -257px;
}
-.elgg-page-header .elgg-search input[type=submit] {
- display: none;
-}
-.search_listing {
- background:none;
- border-bottom:1px dotted #CCCCCC;
- clear:both;
- display:block;
- margin:0;
- padding:5px 0 7px;
- position:relative;
-}
-.search_listing_icon {
- float:left;
- margin-left:3px;
- margin-top:3px;
-}
-.search_listing_icon .avatar_menu_button img {
- width: 15px;
- margin:0;
-}
-.search_listing_info {
- float:left;
- margin-left:7px;
- min-height:28px;
- width:693px;
+.search-list li {
+ padding: 5px 0 0;
}
-.search_listing_info p {
- margin:0;
-}
-.search_listing_category_title {
- margin-top:20px;
-}
-.search_listing_category_title h2 {
- color:#666666;
-}
-.search_listing.more {
- display: block;
+.search-heading-category {
+ margin-top: 20px;
+ color: #666666;
}
-
-/* search matches */
-.searchtype {
- background: #FFFACD;
- color: black;
-}
-.searchtypes {
- border: 1px #EEEEEE solid;
- padding: 4px;
- margin: 6px;
-}
-.searchMatch {
+.search-highlight {
background-color: #bbdaf7;
}
-.searchMatchColor1 {
+.search-highlight-color1 {
background-color: #bbdaf7;
}
-.searchMatchColor2 {
+.search-highlight-color2 {
background-color: #A0FFFF;
}
-.searchMatchColor3 {
+.search-highlight-color3 {
background-color: #FDFFC3;
}
-.searchMatchColor4 {
+.search-highlight-color4 {
background-color: #cccccc;
}
-.searchMatchColor5 {
+.search-highlight-color5 {
background-color: #4690d6;
}
-
-/* formatting for the search results */
-
-.search_listing .item_timestamp {
- font-style: italic;
-}
diff --git a/mod/search/views/default/search/entity.php b/mod/search/views/default/search/entity.php
index ae3d43e01..2193a70d8 100644
--- a/mod/search/views/default/search/entity.php
+++ b/mod/search/views/default/search/entity.php
@@ -47,21 +47,11 @@ if (!$time) {
$tu = $entity->time_updated;
$time = elgg_view_friendly_time(($tu > $tc) ? $tu : $tc);
}
-?>
-<div class="search_listing clearfix">
- <div class="search_listing_icon">
- <?php echo $icon; ?>
- </div>
- <div class="search_listing_info">
- <p class="entity-title"><?php echo $title; ?></p>
- <?php echo $description; ?>
-<?php
+
+$body = "<p class=\"mbn\">$title</p>$description";
if ($extra_info) {
-?>
- <p class="entity-subtext"><?php echo $extra_info; ?></p>
-<?php
+ $body .= "<p class=\"elgg-subtext\">$extra_info</p>";
}
-?>
- <p class="entity-subtext"><?php echo $time; ?></p>
- </div>
-</div>
+$body .= "<p class=\"elgg-subtext\">$time</p>";
+
+echo elgg_view_image_block($icon, $body);
diff --git a/mod/search/views/default/search/list.php b/mod/search/views/default/search/list.php
index 27916a363..6f09ae521 100644
--- a/mod/search/views/default/search/list.php
+++ b/mod/search/views/default/search/list.php
@@ -10,8 +10,8 @@
* - 'type' Entity type
* - 'subtype' Entity subtype
* - 'search_type' Type of search: 'entities', 'comments', 'tags'
- * - 'offset'
- * - 'limit'
+ * - 'offset' Offset in search results
+ * - 'limit' Number of results per page
* - 'pagination' Display pagination?
*/
@@ -22,14 +22,13 @@ if (!is_array($entities) || !count($entities)) {
return FALSE;
}
-// @todo why are limit and offset pulled from input here and from $vars['params'] later
$query = 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),
+ 'limit' => $vars['params']['limit'],
+ 'offset' => $vars['params']['offset'],
'search_type' => $vars['params']['search_type'],
//@todo include vars for sorting, order, and friend-only.
)
@@ -76,18 +75,6 @@ if (array_key_exists('search_type', $vars['params'])
$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;
@@ -95,22 +82,33 @@ $more = ($more_check > 0) ? $more_check : 0;
if ($more) {
$title_key = ($more == 1) ? 'comment' : 'comments';
$more_str = elgg_echo('search:more', array($count, $type_str));
- $more_link = "<div class='search_listing'><a href=\"$url\">$more_str</a></div>";
+ $more_link = "<li class='elgg-list-item'><a href=\"$url\">$more_str</a></li>";
} else {
$more_link = '';
}
-$body = "<div class='search_listing_category_title'>" . elgg_view_title($type_str) . "</div>";
-
-foreach ($entities as $entity) {
- if ($view = search_get_search_view($vars['params'], 'entity')) {
+// @todo once elgg_view_title() supports passing a $vars array use it
+$body = elgg_view('layout/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-list-item\">";
$body .= elgg_view($view, array(
'entity' => $entity,
'params' => $vars['params'],
'results' => $vars['results']
));
+ $body .= '</li>';
}
+ $body .= $more_link;
+ $body .= '</ul>';
}
+
echo $body;
-echo $more_link;
echo $nav;