Revision: 2195
Author: [email protected]
Date: Wed Mar 3 06:27:52 2010
Log: [No log message]
http://code.google.com/p/simplesamlphp/source/detail?r=2195
Added:
/trunk/modules/discopower/www/js/suggest.js
Modified:
/trunk/modules/discopower/config-templates/module_discopower.php
/trunk/modules/discopower/lib/PowerIdPDisco.php
/trunk/modules/discopower/templates/disco-tpl.php
=======================================
--- /dev/null
+++ /trunk/modules/discopower/www/js/suggest.js Wed Mar 3 06:27:52 2010
@@ -0,0 +1,23 @@
+var suggest_cache = new Array;
+
+String.prototype.score = function(abbreviation,offset) {
+ if (suggest_cache['abv'] != abbreviation) {
+ suggest_cache['abv'] = abbreviation;
+ var words = abbreviation.split(/\s/);
+ suggest_cache['len'] = words.length;
+ suggest_cache.re = new Array;
+
+ //words.each();
+ for ( var i=0; i<suggest_cache['len']; ++i ){
+ suggest_cache['re'][i] = new Array();
+ // /\b<x>/ doesn't work when <x> i a non-ascii - oddly enough \s
does ...
+ suggest_cache['re'][i]['initialword'] = new RegExp("^"+words[i],
"i");
+ suggest_cache['re'][i]['word'] = new RegExp("\\s"+words[i],
"i");
+ }
+ }
+
+ for ( var i=0; i<suggest_cache['len']; ++i ){
+ if (!(this.match(suggest_cache['re'][i]['initialword']) ||
this.match(suggest_cache['re'][i]['word']))) return 0;
+ }
+ return 1;
+}
=======================================
--- /trunk/modules/discopower/config-templates/module_discopower.php Fri
Feb 20 06:59:30 2009
+++ /trunk/modules/discopower/config-templates/module_discopower.php Wed
Mar 3 06:27:52 2010
@@ -20,6 +20,13 @@
*
* 'tabs' => array('norway', 'finland'),
*/
+
+ /**
+ * If you want to change the scoring algorithm to a more google suggest
like one
+ * (filters by start of words) uncomment this ...
+ *
+ * 'score' => 'suggest',
+ */
);
=======================================
--- /trunk/modules/discopower/lib/PowerIdPDisco.php Mon Sep 28 08:19:51 2009
+++ /trunk/modules/discopower/lib/PowerIdPDisco.php Wed Mar 3 06:27:52 2010
@@ -188,6 +188,7 @@
$t->data['rememberenabled'] =
$this->config->getBoolean('idpdisco.enableremember', FALSE);
$t->data['rememberchecked'] =
$this->config->getBoolean('idpdisco.rememberchecked', FALSE);
$t->data['defaulttab'] =
$this->discoconfig->getValue('defaulttab', 0);
+ $t->data['score'] = $this->discoconfig->getValue('score',
'quicksilver');
$t->show();
}
}
=======================================
--- /trunk/modules/discopower/templates/disco-tpl.php Wed Feb 10 03:32:00
2010
+++ /trunk/modules/discopower/templates/disco-tpl.php Wed Mar 3 06:27:52
2010
@@ -21,7 +21,7 @@
$this->data['head'] = '<link rel="stylesheet" media="screen"
type="text/css" href="' .
SimpleSAML_Module::getModuleUrl('discopower/style.css') . '" />';
$this->data['head'] .= '<script type="text/javascript" src="' .
SimpleSAML_Module::getModuleUrl('discopower/js/jquery.livesearch.js') . '"></script>';
-$this->data['head'] .= '<script type="text/javascript" src="' .
SimpleSAML_Module::getModuleUrl('discopower/js/quicksilver.js') . '"></script>';
+$this->data['head'] .= '<script type="text/javascript" src="' .
SimpleSAML_Module::getModuleUrl('discopower/js/' .
$this->data['score'] . '.js') . '"></script>';
$this->data['head'] .= '<script type="text/javascript">
@@ -108,12 +108,6 @@
} else {
return $metadata['name'];
}
- } elseif (array_key_exists('OrganizationDisplayName', $metadata)) {
- if (is_array($metadata['OrganizationDisplayName'])) {
- return
$t->getTranslation($metadata['OrganizationDisplayName']);
- } else {
- return $metadata['OrganizationDisplayName'];
- }
}
return $metadata['entityid'];
}
--
You received this message because you are subscribed to the Google Groups
"simpleSAMLphp commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/simplesamlphp-commits?hl=en.