Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Anderson <tony@traveler.(none)>2011-03-16 14:54:05 (GMT)
committer Tony Anderson <tony@traveler.(none)>2011-03-16 14:54:05 (GMT)
commit92045746efebd1477b3cc0d93c657809d10e6ad4 (patch)
treef8561cd364900050a05899166047a00fef1cf8ef
parent6da020e2c23ad617b7dee02845c1d94e9935f71c (diff)
version 12.7
-rwxr-xr-xactivity/activity.info2
-rwxr-xr-xcgi-bin/activities.py9
-rwxr-xr-xlaunch.py14
3 files changed, 19 insertions, 6 deletions
diff --git a/activity/activity.info b/activity/activity.info
index 28aec40..0a41d1f 100755
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -1,5 +1,5 @@
[Activity]
-#version = 12.6
+#version = 12.7
name = Learn
service_name = rw.olpc.Learn
icon = activity-learn
diff --git a/cgi-bin/activities.py b/cgi-bin/activities.py
index ea740cc..c797224 100755
--- a/cgi-bin/activities.py
+++ b/cgi-bin/activities.py
@@ -162,6 +162,15 @@ def getSubjects():
pth = SS
script = 'cd ' + str(pth) + '\nget subjects.js\nget index.html\nmget version-*'
(result,err) = sftp(script, folder)
+ #set mode
+ fin = open('content/subjects.js','r')
+ txt = fin.read()
+ fin.close()
+ txtout = "var mode = '" + mode + "'\n\n"
+ txtout += txt
+ fout = open('content/subjects.js','w')
+ fout.write(txtout)
+ fout.close()
def getKarma():
if USB.exists(): #get from usb drive
diff --git a/launch.py b/launch.py
index bd2ee58..8e4b7b2 100755
--- a/launch.py
+++ b/launch.py
@@ -63,9 +63,13 @@ class Learn(activity.Activity):
getKarma()
if not pth.exists():
print >> log, 'karma folder is not loaded'
+ if self.nickname[0] == 'F':
+ mode = 'Faculty'
+ else:
+ mode = self.nickname[:2]
pth = path('content') / 'subjects.js'
if not pth.exists():
- getSubjects()
+ getSubjects(mode)
if not pth.exists():
print >> log, 'subject.js not loaded'
fin = open(pth,'r')
@@ -73,11 +77,11 @@ class Learn(activity.Activity):
fin.close()
print >> log, 'subjects.js',txt
config = Config()
- if self.nickname[0] == 'F':
- config.setConfig('mode','Faculty')
+ if mode == 'Faculty':
+ config.setConfig('mode',mode)
else:
- config.setConfig('mode',self.nickname[:2])
- config.setConfig('course',self.nickname[:2])
+ config.setConfig('mode',mode)
+ config.setConfig('course',mode)
config.saveConfig()
#start localserver
#print >> log, 'close any open localserver'