Created
September 8, 2010 09:59
-
-
Save siculars/569918 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//check a tag against the main tag list | |
checkSubmittedTag: function(submittedTag) { | |
//sys.log('checking : ' + submittedTag); | |
var origTags = this.getTags(tags); | |
//sys.log('origtags: ' + origTags); | |
//return 0 ; | |
//if ( origTags.search(submittedTag) > 0 ) return 1 ; | |
for ( var i = 0 ; i < origTags.length ; i++ ) { | |
//sys.log(i+'. ' + submittedTag +' == '+ origTags[i] + '?'); | |
if (submittedTag === origTags[i]) return origTags[i]; | |
} | |
//sys.log(submittedTag + ' : ' + checksOut); | |
return 0 ; | |
}, | |
//return an array with tags | |
getFilterTags: function(req) { | |
var submittedTags = JSON.parse(qs.parse(url.parse(req.url).query).tags); | |
//var submittedTags = url.parse(req.url, 1).query.tags; | |
var vettedSubmittedTags = []; | |
sys.log("getfiltertags. submitted tags: " + submittedTags + " , " + submittedTags.length); | |
//sys.log("orig tags: " + origTags + "length: " + origTags.length ); | |
for (var i = 0 ; i < submittedTags.length ; i++){ | |
if (this.checkSubmittedTag(submittedTags[i]) == submittedTags[i]) vettedSubmittedTags.push(submittedTags[i]) ; | |
} | |
sys.log('getfiltertags. vetted tags: ' + vettedSubmittedTags + ' , length : ' + vettedSubmittedTags.length) | |
return vettedSubmittedTags ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment