Changeset - 0b6f69a3ae0e
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 15 years ago 2010-10-16 13:00:32
ohnobinki@ohnopublishing.net
For autocompleting course departments, omit the trailing '-' so that the user has to type a space or other delimiter himself. This make the interface more intuitive.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
auto.php
Show inline comments
 
@@ -68,25 +68,25 @@ if (!$school['crawled'])
 
$term_strlen = strlen($term);
 
$dept_strlen = strlen($term_parts['department']);
 
$dept = $term_parts['department'];
 
if (!$getsections && count($term_parts) == 1 && $term_strlen == strlen($dept))
 
  {
 
    $dept_file = $cache_dir . '-depts';
 
    if (!file_exists($dept_file))
 
      clean_empty_exit();
 
    $deptartments = unserialize(file_get_contents($dept_file));
 
    foreach ($deptartments as $key => $department)
 
      {
 
	if (!strncmp($department, $dept, $term_strlen))
 
	  $departments[$key] = $department . '-';
 
	  $departments[$key] = $department;
 
	else
 
	  unset($departments[$key]);
 
      }
 
    echo json_encode($departments);
 
    exit(0);
 
  }
 

	
 
if ($getsections)
 
  {
 
    $section_file = $cache_dir . $dept . DIRECTORY_SEPARATOR . $term_parts['course'];
 
    if (file_exists($section_file))
 
      {
0 comments (0 inline, 0 general)