-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chris McBride
committed
Mar 18, 2013
0 parents
commit ea87594
Showing
24 changed files
with
1,074 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
# Custom for Visual Studio | ||
*.cs diff=csharp | ||
*.sln merge=union | ||
*.csproj merge=union | ||
*.vbproj merge=union | ||
*.fsproj merge=union | ||
*.dbproj merge=union | ||
|
||
# Standard to msysgit | ||
*.doc diff=astextplain | ||
*.DOC diff=astextplain | ||
*.docx diff=astextplain | ||
*.DOCX diff=astextplain | ||
*.dot diff=astextplain | ||
*.DOT diff=astextplain | ||
*.pdf diff=astextplain | ||
*.PDF diff=astextplain | ||
*.rtf diff=astextplain | ||
*.RTF diff=astextplain |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
################# | ||
## Eclipse | ||
################# | ||
|
||
*.pydevproject | ||
.project | ||
.metadata | ||
bin/ | ||
tmp/ | ||
*.tmp | ||
*.bak | ||
*.swp | ||
*~.nib | ||
local.properties | ||
.classpath | ||
.settings/ | ||
.loadpath | ||
|
||
# External tool builders | ||
.externalToolBuilders/ | ||
|
||
# Locally stored "Eclipse launch configurations" | ||
*.launch | ||
|
||
# CDT-specific | ||
.cproject | ||
|
||
# PDT-specific | ||
.buildpath | ||
|
||
|
||
################# | ||
## Visual Studio | ||
################# | ||
|
||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.sln.docstates | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Rr]elease/ | ||
*_i.c | ||
*_p.c | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.pch | ||
*.pdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.vspscc | ||
.builds | ||
*.dotCover | ||
|
||
## TODO: If you have NuGet Package Restore enabled, uncomment this | ||
#packages/ | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opensdf | ||
*.sdf | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper* | ||
|
||
# Installshield output folder | ||
[Ee]xpress | ||
|
||
# DocProject is a documentation generator add-in | ||
DocProject/buildhelp/ | ||
DocProject/Help/*.HxT | ||
DocProject/Help/*.HxC | ||
DocProject/Help/*.hhc | ||
DocProject/Help/*.hhk | ||
DocProject/Help/*.hhp | ||
DocProject/Help/Html2 | ||
DocProject/Help/html | ||
|
||
# Click-Once directory | ||
publish | ||
|
||
# Others | ||
[Bb]in | ||
[Oo]bj | ||
sql | ||
TestResults | ||
*.Cache | ||
ClientBin | ||
stylecop.* | ||
~$* | ||
*.dbmdl | ||
Generated_Code #added for RIA/Silverlight projects | ||
|
||
# Backup & report files from converting an old project file to a newer | ||
# Visual Studio version. Backup files are not needed, because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML | ||
|
||
|
||
|
||
############ | ||
## Windows | ||
############ | ||
|
||
# Windows image file caches | ||
Thumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
|
||
############# | ||
## Python | ||
############# | ||
|
||
*.py[co] | ||
|
||
# Packages | ||
*.egg | ||
*.egg-info | ||
dist | ||
build | ||
eggs | ||
parts | ||
bin | ||
var | ||
sdist | ||
develop-eggs | ||
.installed.cfg | ||
|
||
# Installer logs | ||
pip-log.txt | ||
|
||
# Unit test / coverage reports | ||
.coverage | ||
.tox | ||
|
||
#Translations | ||
*.mo | ||
|
||
#Mr Developer | ||
.mr.developer.cfg | ||
|
||
# Mac crap | ||
.DS_Store |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
application: mcbridebadgeissuer | ||
version: 1 | ||
runtime: python27 | ||
api_version: 1 | ||
threadsafe: yes | ||
|
||
handlers: | ||
- url: /favicon\.ico | ||
static_files: favicon.ico | ||
upload: favicon\.ico | ||
|
||
- url: /images | ||
static_dir: images | ||
mime_type: image/png | ||
|
||
- url: /stylesheets | ||
static_dir: stylesheets | ||
|
||
- url: .* | ||
script: main.app | ||
|
||
libraries: | ||
- name: webapp2 | ||
version: "2.5.2" | ||
- name: jinja2 | ||
version: latest |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Copyright 2007 Google Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
#import cgi | ||
import webapp2 | ||
import datetime | ||
#import urllib | ||
import jinja2 | ||
import os | ||
import logging | ||
#import textwrap | ||
import hashlib | ||
import json | ||
|
||
jinja_environment = jinja2.Environment( | ||
loader=jinja2.FileSystemLoader(os.path.dirname(__file__))) | ||
|
||
now = datetime.datetime.now() | ||
|
||
|
||
class EvidenceHandler(webapp2.RequestHandler): | ||
"""Handles requests to view badge completion evidence for a specific user.""" | ||
def get(self): | ||
logging.info('EvidenceHandler.post') | ||
|
||
email = self.request.get('email') | ||
badgeid = self.request.get('badgeid') | ||
|
||
logging.info('Submitted values - [email=' + email + "], [badgeid='" + badgeid + "]") | ||
|
||
self.response.out.write("<h1>Badge Evidence (optional)</h1>") | ||
self.response.out.write("<b>Should contain information about how the specific Earner earned the badge.</b><br />") | ||
self.response.out.write("badge evidence for badgeid=" + badgeid + " and user=" + email + "<br />") | ||
|
||
|
||
class CriteriaHandler(webapp2.RequestHandler): | ||
"""Handles requests to view badge completion criteria.""" | ||
def get(self, badgeid=0): | ||
template = jinja_environment.get_template('/templates/criteria.html') | ||
self.response.out.write(template.render({"badgeName": "BadgeName", | ||
"badgeImageUrl": "http://mcbridebadgeissuer.appspot.com/images/badge0.png", | ||
"description": "This is the badge description. It is an awesome badge. I hope many people earn it.", | ||
"prerequisites": ["dog", "cat", "horse", "pig", "cow"]})) | ||
|
||
|
||
class TestHandler(webapp2.RequestHandler): | ||
"""Issues badges for testing purposes.""" | ||
def get(self): | ||
template = jinja_environment.get_template('/templates/issuebadge.html') | ||
self.response.out.write(template.render()) | ||
|
||
|
||
class AssertionHandler(webapp2.RequestHandler): | ||
"""Handles requests to view badge completion criteria.""" | ||
def head(self): | ||
"""Open Badge site requires support for HEAD and GET requests.""" | ||
self.get() | ||
|
||
def get(self): | ||
email = self.request.get('email') | ||
badgeid = self.request.get('badgeid') | ||
|
||
logging.info('Submitted values - [email=' + email + "], [badgeid='" + badgeid + "]") | ||
|
||
id = int(badgeid or 0) | ||
if id > -1: | ||
|
||
indexOfController = self.request.url.rfind('/badge') | ||
url = self.request.url[:indexOfController] | ||
#logging.info('url: %s' % url) | ||
|
||
self.response.headers['Content-Type'] = 'application/json; charset=utf-8' | ||
|
||
#todo: get issuer/badge/assertion details from DB where appropriate | ||
issuerName = "KapX" | ||
issuerOriginUrl = "http://mcbridebadgeissuer.appspot.com" | ||
|
||
#todo: get badge details from DB. | ||
badgeVersion = "1.0" | ||
badgeName = "Test Badge " + badgeid | ||
imageUrl = url + "/images/badge" + badgeid + ".png" | ||
description = "This is test badge " + badgeid + " issued by a temporary OpenBadge issuer." | ||
criteriaUrl = url + "/criteria/" + badgeid | ||
|
||
uid = badgeid | ||
salt = "bad_salt" | ||
recipient = u'sha256${0}'.format(hashlib.sha256(email + salt).hexdigest()) | ||
|
||
if id > -1 and id < 10: | ||
theIssuer = {'name': issuerName, 'origin': issuerOriginUrl} | ||
theBadge = {'version': badgeVersion, 'name': badgeName, 'image': imageUrl, 'description': description, 'criteria': criteriaUrl, 'issuer': theIssuer} | ||
theAssertion = {'uid': uid, 'recipient': recipient, 'salt': salt, 'badge': theBadge, 'issuer': theIssuer} | ||
|
||
self.response.out.write(json.dumps(theAssertion)) | ||
|
||
else: | ||
self.response.out.write('{ "error":"badge id out of range supplied"}') | ||
|
||
else: | ||
self.response.out.write('{ "error":"invalid badge id supplied"}') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Copyright 2007 Google Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
import webapp2 | ||
import datetime | ||
import jinja2 | ||
import os | ||
import logging | ||
import json | ||
|
||
from google.appengine.ext import ndb | ||
|
||
jinja_environment = jinja2.Environment( | ||
loader=jinja2.FileSystemLoader(os.path.dirname(__file__))) | ||
|
||
now = datetime.datetime.now() | ||
|
||
class Badge(ndb.Model): | ||
"""Model for an individual badge""" | ||
badgeid = ndb.KeyProperty() | ||
name = ndb.StringProperty() | ||
version = ndb.StringProperty() | ||
description = ndb.StringProperty() | ||
|
||
|
||
class BadgeAdminHandler(webapp2.RequestHandler): | ||
"""Handles requests to view badge completion evidence for a specific user.""" | ||
def get(self): | ||
logging.info('BadgeAdminHandler.get') | ||
badgeid = self.request.get('badgeid') | ||
|
||
if(badgeid): | ||
template = jinja_environment.get_template('/templates/badgeadmin.html') | ||
self.response.out.write(template.render()) | ||
|
||
def post(self): | ||
logging.info('BadgeAdminHandler.post') | ||
|
||
try: | ||
badgeJson = self.request.get('badge') | ||
logging.info("badgeJson: " + badgeJson) | ||
badge = json.loads(badgeJson) | ||
self.response.out.write(badge) | ||
except Exception, e: | ||
logging.exception(e) | ||
|
||
|
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.