aboutsummaryrefslogtreecommitdiff
path: root/GradeBook_lib.tcl
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2012-01-21 10:16:13 -0500
committerEugeniy Mikhailov <evgmik@gmail.com>2012-01-21 10:16:13 -0500
commit5d2b13c7329383fe10366e1b68a24fb8e5d49df3 (patch)
tree4392f7487e4b02fb2548d73b0e9f341decca6d68 /GradeBook_lib.tcl
parentf388207e381fa801caf2753eb04882627607e668 (diff)
downloadGradeBook-5d2b13c7329383fe10366e1b68a24fb8e5d49df3.tar.gz
GradeBook-5d2b13c7329383fe10366e1b68a24fb8e5d49df3.zip
db list capability added
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-xGradeBook_lib.tcl37
1 files changed, 32 insertions, 5 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index 8d4fffc..c49ac19 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -928,6 +928,27 @@ proc htmlTop {permission_list} {
}
+proc html_Show_Classes_List {permission_list user} {
+ # list available class DBs
+ global GradebookServerConfig script_root_name
+ puts "<div>"
+ puts "Available classes are"
+ puts "<ul>"
+ foreach cdb [get_list_of_courses_db] {
+ set dbfile "$GradebookServerConfig(grades_db_dir)/$cdb"
+ if { ![file exists $dbfile] } { continue }
+
+ sqlite3 db $dbfile
+ set CourseTitle [SelectItemFromCourseInfoTable course_title]
+ set CourseYear [SelectItemFromCourseInfoTable course_year]
+ set CourseSemester [SelectItemFromCourseInfoTable course_semester]
+ puts "<li><a href=\"$script_root_name/$cdb\">$CourseYear $CourseSemester - $CourseTitle</a>"
+ db close
+ }
+ puts "</ul>"
+ puts "</div>"
+}
+
proc htmlFooter {permission_list} {
array set permission $permission_list
global VERSION
@@ -977,12 +998,12 @@ proc Greetings {} {
proc askToLogin {} {
global script_name
- global user password
+ global user_requested password
puts "<div class=\"login\">"
puts "Either you are here first time or you password and user name does not match. <br>"
puts "Please login <br>"
puts "<form name=\"input\" action=\"$script_name\" method=\"post\" />"
- puts "Login (email): <input type=\"text\" name=\"user\" value=\"$user\"><br>"
+ puts "Login (email): <input type=\"text\" name=\"user\" value=\"$user_requested\"><br>"
puts {Password: <input type="password" name="password"><br>}
puts {<input type="hidden" name="action" value="logon"/>}
puts {<input type="submit" value="Submit" />}
@@ -1040,11 +1061,12 @@ proc SendNewPassword2User { user password } {
}
proc LogMeOn {} {
- global user password
- set user [::ncgi::value user guest]
+ #more correctly set cookies
+ global user_requested password
+ set user_requested [::ncgi::value user guest]
set password [::ncgi::value password guest]
dbg "Logging in and setting cookies" 4
- ::ncgi::setCookie -name user -value $user
+ ::ncgi::setCookie -name user -value $user_requested
::ncgi::setCookie -name password -value $password
set subaction [::ncgi::value subaction {}]
@@ -1741,6 +1763,11 @@ proc ShowControls { permission_list user } {
puts "</div>"
}
+proc Authenticate_User { user_requested password } {
+ #return __non_existing_user_
+ return $user_requested
+}
+
proc AccessGroupRights {db user password } {
dbg "access rights check for user: $user"
set PasswordHash [::md5::md5 -hex $password]