Changeset 545

Show
Ignore:
Timestamp:
09/13/06 15:32:21 (2 years ago)
Author:
ben
Message:

You can now filter your search to just resources or accounts (i.e., users and communities).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/_templates/Default_Template/pageshell

    r520 r545  
    4242                <div id="search_widget"><!-- open div search_widget --> 
    4343                <img src="{{url}}_templates/default_images/own_ad_top.gif" alt="" border="0" /> 
    44               <form name="searchform" action="{{url}}search/all.php"> 
     44              <form name="searchform" action="{{url}}search/index.php"> 
    4545                <script language="JavaScript" type="text/javascript"> 
    4646                        <!-- 
     
    5151                        --> 
    5252                </script> 
    53              <p><label>Search</label><br /><input type="text" size="20" name="tag" value="" /> <select name=""><option value="all">--- all ---</option></select> <br /><input type="submit" name="" value="search" /></p> 
     53             <p><label>Search</label><br /><input type="text" size="20" name="tag" value="" /> 
     54                <select name="user_type"> 
     55                    <option value="">--- all ---</option> 
     56                    <option value="person">People</option> 
     57                    <option value="community">Communities</option> 
     58                </select> <br /><input type="submit" name="" value="search" /></p> 
    5459             </form> 
    5560                <img src="{{url}}_templates/default_images/own_ad_bottom.gif" alt="" border="0" /> 
  • devel/search/index.php

    r543 r545  
    1919        $PAGE->search_type = $db->qstr($PAGE->search_type_unformatted); 
    2020         
     21        $PAGE->returned_items = optional_param('returned_items',''); 
     22         
    2123        $querystring = ""; 
    2224        if (isset($_GET) && !empty($_GET)) { 
     
    3436        $querystring = $CFG->wwwroot . "search/index.php?" . $querystring; 
    3537         
    36         $body .= "<p>" . gettext("Searching") . " "; 
     38        $body .= "<p>" . gettext("Search for results from:") . " "; 
    3739         
    3840        if ($PAGE->search_type  == "''") { 
     
    5759        $body .= "</p>"; 
    5860         
     61         
     62         
     63        $querystring = ""; 
     64        if (isset($_GET) && !empty($_GET)) { 
     65            foreach($_GET as $key => $value) { 
     66                if ($key != 'returned_items') { 
     67                    if (!empty($querystring)) { 
     68                        $querystring .= "&"; 
     69                    } 
     70                    $querystring .= urlencode($key); 
     71                    $querystring .= "="; 
     72                    $querystring .= urlencode(optional_param($key,'')); 
     73                } 
     74            } 
     75        } 
     76        $querystring = $CFG->wwwroot . "search/index.php?" . $querystring; 
     77         
     78        $body .= "<p>" . gettext("Filter by content type:") . " "; 
     79        if (empty($PAGE->returned_items)) { 
     80            $body .= "<b class=\"search_displaying_type\">"; 
     81        } 
     82        $body .= "<a href=\"$querystring\">" . gettext("Everything") . "</a> "; 
     83        if (empty($PAGE->returned_items)) { 
     84            $body .= "</b>"; 
     85        } 
     86        if ($PAGE->returned_items == 'accounts') { 
     87            $body .= "<b class=\"search_displaying_type\">"; 
     88        } 
     89        $body .= "<a href=\"$querystring&returned_items=accounts\">" . gettext("Users and communities") . "</a> "; 
     90        if ($PAGE->returned_items == 'accounts') { 
     91            $body .= "</b>"; 
     92        } 
     93        if ($PAGE->returned_items == 'resources') { 
     94            $body .= "<b class=\"search_displaying_type\">"; 
     95        } 
     96        $body .= "<a href=\"$querystring&returned_items=resources\">" . gettext("Resources") . "</a> "; 
     97        if ($PAGE->returned_items == 'resources') { 
     98            $body .= "</b>"; 
     99        } 
     100         
     101         
    59102        $body .= run("search:display"); 
    60103         
  • devel/units/files/function_search.php

    r543 r545  
    44global $search_exclusions; 
    55 
    6 if (isset($parameter) && $parameter[0] == "file") { 
     6 
     7$handle = 1; 
     8 
     9if (!empty($PAGE->returned_items) && $PAGE->returned_items == "accounts") { 
     10    $handle = 0; 
     11
     12 
     13if (isset($parameter) && $parameter[0] == "file" && $handle) { 
    714     
    815    $dbtag = $db->qstr($parameter[1]); 
  • devel/units/profile/function_search.php

    r543 r545  
    1313            } 
    1414        } 
    15      
     15         
     16        if (!empty($PAGE->returned_items) && $PAGE->returned_items == "resources") { 
     17            $handle = 0; 
     18        } 
     19         
    1620        if ($handle) { 
    1721             
  • devel/units/search/function_display.php

    r543 r545  
    1616     
    1717            foreach($query as $field => $value) { 
    18                 if ($field != user_session_name && $field != "ref" && $field != "owner" && $field != "psaContext" && $field != "PHPSESSID" && $field != "user_type") { 
     18                if ($field != user_session_name && $field != "ref" && $field != "owner"  
     19                    && $field != "psaContext" && $field != "PHPSESSID"  
     20                    && $field != "user_type" && $field != "returned_items") { 
    1921                    // $searchline = "tagtype = '".addslashes($field)."' and tag = '".addslashes($value)."'"; 
    2022                    $run_result .= run("search:display_results", array($field,$value)); 
  • devel/units/search/function_search_all_display.php

    r543 r545  
    1414         
    1515    } 
    16     if ($tag != "ref" && $tag != "owner" && $tag != user_session_name && $tag != "user_type") { 
     16    if ($tag != "ref" && $tag != "owner" && $tag != user_session_name && $tag != "user_type" && $tag != "returned_items") { 
    1717        $run_result .= run("search:tags:suggest",$tag); 
    1818        $run_result .= run("search:users:suggest",$tag); 
  • devel/units/weblogs/function_search.php

    r543 r545  
    99$otherUsers2 = gettext("Users with weblog posts in category"); // gettext variable 
    1010 
    11 if (isset($parameter) && $parameter[0] == "weblog" || $parameter[0] == "weblogall") { 
     11$handle = 1; 
     12 
     13if (!empty($PAGE->returned_items) && $PAGE->returned_items == "accounts") { 
     14    $handle = 0; 
     15
     16 
     17if ((isset($parameter) && $parameter[0] == "weblog" || $parameter[0] == "weblogall") && $handle) { 
    1218     
    1319    if ($parameter[0] == "weblog") {