Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

New person finder (of 2008) has been developed in PHP using a basic MVC pattern. There is a Trac instance - the code is in the trunk.

Search page functionality:

  • Search does not strip diacritics from search terms, but matches against both diacritic sensitive and insensitive fields for names. Hence a diacritic or non-diacritic search should return your match, but term with incorrect diacritics will not
  • First Name field will match both actual name and known as
  • All fields can take the wildcard (*) search option
  • Multiple * characters together are replaced with a single *
  • LDAP special characters and other regex characters are stripped out (list of characters - specialcharlist variable)
  • Some fields have wildcards built (see table below)

...

Note the anomaly in expected behaviour - first name searches the full name field in LDAP

External specific behavior:

  • Search returns a negative statement if no text (cannot get full department listings)
  • At least one of the search terms must contain a minimum of 2 characters (prevents a* searches)
  • If nothing in the Surname field, sets filter to Staff (can only list staff by title alone)

Search page options:

  • For an external view you can call the external script directly (add external.php to the url) - note that there is no external basic search
  • Embedded parameter gives the search results as a table omitting headers and footers. Data is given in external form.
  • Template parameter can be used to specify one of a set of predefined templates for the search results page. Currently there are 2 standard version2 and standarddev version2dev which loads header and footer includes from the live and dev cms respectively. The template used in both cases is the new external website template.

    Result page options:

    Additional options:

    Additional bits of information can be gathered from personfinder/dataquery/ (called from inside the firewall only)

    ...

    from /opt/www/apache2/conf/aliases.conf on sole

    Code Block
    
    # New Person Finder rewrites
    RewriteCond %{REMOTE_ADDR} ^138.38.* [OR]
    RewriteCond %{REMOTE_ADDR} ^172.1[6-9].* [OR]
    RewriteCond %{REMOTE_ADDR} ^172.2[0-9].* [OR]
    RewriteCond %{REMOTE_ADDR} ^172.3[0-1].*
    RewriteRule ^/contact(/.*)?$ http://www.bath.ac.uk/personfinder/contact/$1 [L,P]
    # does not take into account requests for /contact/personlookup.php
    RewriteRule ^/contact(/.*)?$ http://www.bath.ac.uk/personfinder/contact/external.php$1 [L,P]
    
    RewriteCond %{REMOTE_ADDR} ^138.38.* [OR]
    RewriteCond %{REMOTE_ADDR} ^172.1[6-9].* [OR]
    RewriteCond %{REMOTE_ADDR} ^172.2[0-9].* [OR]
    RewriteCond %{REMOTE_ADDR} ^172.3[0-1].*
    RewriteRule ^/person/(.+)$ http://www.bath.ac.uk/personfinder/person/person.php?id=$1 [L,P]
    RewriteRule ^/person/(.+)$ http://www.bath.ac.uk/personfinder/person/externalperson.php?id=$1 [L,P]
    
    RewriteRule ^/phone(/?)(.*)$ http://www.bath.ac.uk/personfinder/phone/$2 [L,P]
    RewriteRule ^/maintainers(/?)$ /www/bath-cgi-bin/maintainers [T=application/x-httpd-cgi,L]
    <Directory /www/vhosts/bath/personfinder>
      Options -Indexes
    </Directory>
    

    Also in /opt/www/apache2/conf/httpd-accesslocal.conf

    Code Block
    # Restrict external  access to the Person Finder live search JavaScript.
    <LocationMatch "^/personfinder/js/personLookup.js$">
      satisfy any
      order allow,deny
      allow from 138.38.
      allow from 172.16.0.0/12
      allow from 192.168.0.0/16
      allow from 193.63.76.
      ErrorDocument 403 /reports/errors/403.Forbidden.BathHostsOnly.shtml
    </LocationMatch>

    The live search code wasn't working for users off campus, and would also have needed tweaking to return non-internal only data (for information security purposes). This restriction stops the live search from even working, but the default Person Finder functionality of submitting the form to Person Finder itself still works.

    Apache bindings for dev personfinder:

    Code Block
    
    # dev personfinder redirects
    RewriteEngine On
    #RewriteCond %{REMOTE_ADDR} !^138.38.56.31
    RewriteCond %{REMOTE_ADDR} ^138.38.* [OR]
    RewriteCond %{REMOTE_ADDR} ^172.1[6-9].* [OR]
    RewriteCond %{REMOTE_ADDR} ^172.2[0-9].* [OR]
    RewriteCond %{REMOTE_ADDR} ^172.3[0-1].*
    RewriteRule ^/contact(/.*)?$ http://dev.bath.ac.uk/personfinder/contact/$1 [L,P]
    # does not take into account requests for /contact/personlookup.php
    RewriteRule ^/contact(/.*)?$ http://dev.bath.ac.uk/personfinder/contact/external.php$1 [L,P]
    
    #RewriteCond %{REMOTE_ADDR} !^138.38.56.31
    RewriteCond %{REMOTE_ADDR} ^138.38.* [OR]
    RewriteCond %{REMOTE_ADDR} ^172.1[6-9].* [OR]
    RewriteCond %{REMOTE_ADDR} ^172.2[0-9].* [OR]
    RewriteCond %{REMOTE_ADDR} ^172.3[0-1].*
    RewriteRule ^/person/(.+)$ http://dev.bath.ac.uk/personfinder/person/person.php?id=$1 [L,P]
    RewriteRule ^/person/(.+)$ http://dev.bath.ac.uk/personfinder/person/externalperson.php?id=$1 [L,P]
    
    RewriteRule ^/phone(/?)(.*)$ http://dev.bath.ac.uk/personfinder/phone/$2 [L,P]
    RewriteRule ^/maintainers(/?)$ /www/bath-cgi-bin/maintainers [T=application/x-httpd-cgi,L]
    <Directory /www/vhosts/bath/personfinder>
      Options -Indexes
    </Directory>
    

    ...

    Additionally, the livesearch javascript on the basic search page should be portable.