clienthandlers

package module
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2020 License: MIT Imports: 21 Imported by: 0

README

Go Report Card License Version Built with GoLang

Courses

An extension to GoBlender that allows for delivery of video based online courses.

Core Functionality

  • Video lectures
  • Create as many courses as needed
  • Static page lectures
  • Drag & drop page creation
  • Track student progress
  • All for submission of assignments
  • Allow for grading of assignments
  • Integration with MS Teams

Setup

First, install GoBlender.

All client specific code lives in ./client/clienthandlers, and is its own git repository. When working in JetBrains Goland, you must create (or clone) a git repository in this location, and then add the directory in Preferences -> Version Control.

Updating on server

Change update.sh in GoBlender root folder so as to enable git pull of client:

# uncomment if using custom client code
#cd ./client/clienthandlers
#git pull
#cd ../..

# run migrations for pg
# soda migrate -c ../../migrations-pg/database.yml

After changing, it should look like this (assuming you want to run postgres migrations):

# uncomment if using custom client code
cd ./client/clienthandlers
git pull
cd ../..

# run migrations for pg
soda migrate -c ../../migrations-pg/database.yml

#run client migrations for mariadb
# soda migrate -c ../../database.yml

Using custom templates

Inside of clientviews there are two folders: public and private. If you wish to use the base templates from GoBlender to create templates, do it like this:

For public pages:

{{template "base" .}}

{{define "title"}}Some title{{end}}

{{define "body"}}
    <p>Put whatever you want here</p>
{{end}}

For admin pages:

{{template "admin-base" .}}

{{define "title"}}Some Title - vMaintain Admin{{end}}

{{define "admin-title"}}Some title{{end}}
{{define "content-title"}}Some title{{end}}

{{define "content"}}
    <p>Some content</p>
{{end}}

Note

You can override anything in the base templates, or specific pages/partials, by putting a file in client/clientviews/public, client/clientviews/public/partials, client/clientviews/admin, or client/clientviews/admin/partials.

Client Specific Migrations

Migrations live in client/migrations. To run them, add the -c flag to soda, e.g.:

To generate Postgres migrations:

cd client/clienthandlers
soda -c ../../migrations-pg/database.yml generate fizz SomeMigrationName

To run Postgres migrations:

cd client/clienthandlers
soda -c ../../migrations-pg/database.yml migrate

To generate MariaDB/MySQL migrations:

cd client/clienthandlers
soda -c ../../database.yml generate fizz SomeMigration

To run MariaDB/MySQL migrations:

cd client/clienthandlers
soda -c ../../database.yml migrate

Middleware

Add custom middleware to ./client/clienthandlers/client-middleware.go, e.g.:

// SomeMiddleware is sample middleware
func SomeMiddleware(next http.Handler) http.Handler {
    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        ok := true
        // perform some logic to set ok
        
        if ok {
            next.ServeHTTP(w, r)
        } else {
         helpers.ClientError(w, http.StatusUnauthorized)
        }
    })
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminAllCourses

func AdminAllCourses(w http.ResponseWriter, r *http.Request)

AdminAllCourses shows list of all courses for admin

func AdminAllSections added in v1.4.0

func AdminAllSections(w http.ResponseWriter, r *http.Request)

AdminAllSections shows list of all sections for admin

func AdminCourse

func AdminCourse(w http.ResponseWriter, r *http.Request)

AdminCourse shows course for add/edit

func AdminLecture

func AdminLecture(w http.ResponseWriter, r *http.Request)

AdminLecture shows form for lecture

func AdminSection added in v1.4.0

func AdminSection(w http.ResponseWriter, r *http.Request)

AdminSection shows list of all sections for admin

func AllCourses

func AllCourses(w http.ResponseWriter, r *http.Request)

AllCourses lists all active courses with link to overview

func Assignment added in v1.1.0

func Assignment(w http.ResponseWriter, r *http.Request)

Assignment displays assignment in admin tool

func Assignments added in v1.0.2

func Assignments(w http.ResponseWriter, r *http.Request)

Assignments displays assignments in admin tool

func ClientInit

func ClientInit(conf config.AppConfig, parentDriver *driver.DB, rep *handlers.DBRepo)

ClientInit initializes client specific code

func ClientRoutes

func ClientRoutes(mux *pat.PatternServeMux, standardMiddleWare, dynamicMiddleware alice.Chain) (*pat.PatternServeMux, error)

ClientRoutes is used to handle custom routes for specific clients

func CourseSectionAccessHistory added in v1.4.0

func CourseSectionAccessHistory(w http.ResponseWriter, r *http.Request)

CourseSectionAccessHistory shows history of student access to course

func CourseTraffic added in v1.3.1

func CourseTraffic(w http.ResponseWriter, r *http.Request)

CourseTraffic displays a chart of course traffic (views)

func CourseTrafficData added in v1.3.1

func CourseTrafficData(w http.ResponseWriter, r *http.Request)

CourseTrafficData sends data for chart

func CourseTrafficDataForStudent added in v1.3.1

func CourseTrafficDataForStudent(w http.ResponseWriter, r *http.Request)

CourseTrafficDataForStudent sends data for chart

func CourseTrafficDataForStudentAdmin added in v1.3.1

func CourseTrafficDataForStudentAdmin(w http.ResponseWriter, r *http.Request)

CourseTrafficDataForStudentAdmin sends data for chart

func CoursesRole added in v1.4.1

func CoursesRole(next http.Handler) http.Handler

CoursesRole is a sample role

func DeleteSection added in v1.4.0

func DeleteSection(w http.ResponseWriter, r *http.Request)

DeleteSection deletes a section

func DownloadGradeAssignment added in v1.5.2

func DownloadGradeAssignment(w http.ResponseWriter, r *http.Request)

DownloadGradeAssignment downloads a graded assignment

func DownloadGradeAssignmentForStudent added in v1.5.2

func DownloadGradeAssignmentForStudent(w http.ResponseWriter, r *http.Request)

DownloadGradeAssignmentForStudent downloads a graded assignment for a student (validating access rights)

func GetCourseContentJSON added in v1.0.1

func GetCourseContentJSON(w http.ResponseWriter, r *http.Request)

GetCourseContentJSON gets html (description) for course on edit page

func GetLectureContentJSON added in v1.0.1

func GetLectureContentJSON(w http.ResponseWriter, r *http.Request)

GetLectureContentJSON gets html (notes) for lecture on edit page

func GradeAssignment added in v1.1.0

func GradeAssignment(w http.ResponseWriter, r *http.Request)

GradeAssignment grades an assignment

func MemberEdit added in v1.1.2

func MemberEdit(w http.ResponseWriter, r *http.Request)

MemberEdit displays the user for add/edit

func MembersAll added in v1.1.2

func MembersAll(w http.ResponseWriter, r *http.Request)

MembersAll overrides default function to include access time

func NewClientMiddleware

func NewClientMiddleware(app config.AppConfig)

NewClientMiddleware sets app config for middleware

func PostAdminCourse

func PostAdminCourse(w http.ResponseWriter, r *http.Request)

PostAdminCourse updates or adds a course

func PostAdminLecture

func PostAdminLecture(w http.ResponseWriter, r *http.Request)

PostAdminLecture posts a lecture

func PostAdminSection added in v1.4.0

func PostAdminSection(w http.ResponseWriter, r *http.Request)

PostAdminSection posts a section

func PostSectionStudents added in v1.4.0

func PostSectionStudents(w http.ResponseWriter, r *http.Request)

PostSectionStudents handles post of students for section

func PostSubmitAssignment added in v1.0.2

func PostSubmitAssignment(w http.ResponseWriter, r *http.Request)

PostSubmitAssignment handles assignment submission

func SaveCourse added in v1.0.1

func SaveCourse(w http.ResponseWriter, r *http.Request)

SaveCourse saves course html (description)

func SaveLecture added in v1.0.1

func SaveLecture(w http.ResponseWriter, r *http.Request)

SaveLecture saves lecture html (notes)

func SaveLectureSortOrder added in v1.1.3

func SaveLectureSortOrder(w http.ResponseWriter, r *http.Request)

SaveLectureSortOrder saves lecture sort order on drag/drop

func SectionStudents added in v1.4.0

func SectionStudents(w http.ResponseWriter, r *http.Request)

SectionStudents allows for enrollment of students in section

func ShowCourse

func ShowCourse(w http.ResponseWriter, r *http.Request)

ShowCourse shows one course

func ShowLecture

func ShowLecture(w http.ResponseWriter, r *http.Request)

ShowLecture shows one lecture

func StudentAssignments added in v1.0.2

func StudentAssignments(w http.ResponseWriter, r *http.Request)

StudentAssignments displays assignments in admin tool for a given student

func StudentLeftLecture added in v1.1.0

func StudentLeftLecture(w http.ResponseWriter, r *http.Request)

StudentLeftLecture records student leaving lecture

func StudentProfile added in v1.3.0

func StudentProfile(w http.ResponseWriter, r *http.Request)

StudentProfile shows profile page

func SubmitAssignment added in v1.0.2

func SubmitAssignment(w http.ResponseWriter, r *http.Request)

SubmitAssignment displays page to submit an assignment

func UnenrolStudent added in v1.4.0

func UnenrolStudent(w http.ResponseWriter, r *http.Request)

UnenrolStudent removes a student from a section

Types

type SortOrder

type SortOrder struct {
	ID    string `json:"id"`
	Order int    `json:"order"`
}

SortOrder is type for sorting

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL