signup-and-onboarding
This commit is contained in:
@@ -58,10 +58,13 @@ web_include_js = ["website.bundle.js"]
|
|||||||
# ------------
|
# ------------
|
||||||
|
|
||||||
# before_install = "lms.install.before_install"
|
# before_install = "lms.install.before_install"
|
||||||
|
after_install = "lms.install.after_install"
|
||||||
after_sync = "lms.install.after_sync"
|
after_sync = "lms.install.after_sync"
|
||||||
after_uninstall = "lms.install.after_uninstall"
|
after_uninstall = "lms.install.after_uninstall"
|
||||||
|
|
||||||
|
|
||||||
|
setup_wizard_requires = "assets/lms/js/setup_wizard.js"
|
||||||
|
|
||||||
# Desk Notifications
|
# Desk Notifications
|
||||||
# ------------------
|
# ------------------
|
||||||
# See frappe.core.notifications.get_notification_config
|
# See frappe.core.notifications.get_notification_config
|
||||||
@@ -284,4 +287,6 @@ profile_url_prefix = "/users/"
|
|||||||
|
|
||||||
signup_form_template = "lms.plugins.show_custom_signup"
|
signup_form_template = "lms.plugins.show_custom_signup"
|
||||||
|
|
||||||
on_login = "lms.overrides.user.set_country_from_ip"
|
on_login = "lms.overrides.user.on_login"
|
||||||
|
|
||||||
|
on_session_creation = "lms.overrides.user.on_session_creation"
|
||||||
|
|||||||
@@ -2,12 +2,48 @@ import frappe
|
|||||||
from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
|
from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
|
||||||
|
|
||||||
|
|
||||||
|
def after_install():
|
||||||
|
add_pages_to_nav()
|
||||||
|
|
||||||
|
|
||||||
def after_sync():
|
def after_sync():
|
||||||
create_lms_roles()
|
create_lms_roles()
|
||||||
set_default_home()
|
set_default_home()
|
||||||
add_all_roles_to("Administrator")
|
add_all_roles_to("Administrator")
|
||||||
|
|
||||||
|
|
||||||
|
def add_pages_to_nav():
|
||||||
|
pages = [
|
||||||
|
{"label": "Explore", "idx": 1},
|
||||||
|
{"label": "Courses", "url": "/courses", "parent": "Explore", "idx": 2},
|
||||||
|
{"label": "Classes", "url": "/classes", "parent": "Explore", "idx": 3},
|
||||||
|
{"label": "Statistics", "url": "/statistics", "parent": "Explore", "idx": 4},
|
||||||
|
{"label": "Jobs", "url": "/jobs", "parent": "Explore", "idx": 5},
|
||||||
|
{"label": "People", "url": "/community", "parent": "Explore", "idx": 6},
|
||||||
|
]
|
||||||
|
|
||||||
|
for page in pages:
|
||||||
|
filters = frappe._dict()
|
||||||
|
if page.get("url"):
|
||||||
|
filters["url"] = ["like", "%" + page.get("url") + "%"]
|
||||||
|
else:
|
||||||
|
filters["label"] = page.get("label")
|
||||||
|
|
||||||
|
if not frappe.db.exists("Top Bar Item", filters):
|
||||||
|
frappe.get_doc(
|
||||||
|
{
|
||||||
|
"doctype": "Top Bar Item",
|
||||||
|
"label": page.get("label"),
|
||||||
|
"url": page.get("url"),
|
||||||
|
"parent_label": page.get("parent"),
|
||||||
|
"idx": page.get("idx"),
|
||||||
|
"parent": "Website Settings",
|
||||||
|
"parenttype": "Website Settings",
|
||||||
|
"parentfield": "top_bar_items",
|
||||||
|
}
|
||||||
|
).save()
|
||||||
|
|
||||||
|
|
||||||
def after_uninstall():
|
def after_uninstall():
|
||||||
delete_custom_fields()
|
delete_custom_fields()
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
// Copyright (c) 2021, FOSS United and contributors
|
|
||||||
// For license information, please see license.txt
|
|
||||||
|
|
||||||
frappe.ui.form.on("LMS Course Enrollment", {
|
|
||||||
// refresh: function(frm) {
|
|
||||||
// }
|
|
||||||
});
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
{
|
|
||||||
"actions": [],
|
|
||||||
"creation": "2021-03-03 11:24:08.220185",
|
|
||||||
"doctype": "DocType",
|
|
||||||
"editable_grid": 1,
|
|
||||||
"engine": "InnoDB",
|
|
||||||
"field_order": [
|
|
||||||
"course",
|
|
||||||
"user"
|
|
||||||
],
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"fieldname": "course",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"label": "Course",
|
|
||||||
"options": "LMS Course"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "user",
|
|
||||||
"fieldtype": "Data",
|
|
||||||
"label": "User",
|
|
||||||
"options": "Email"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"index_web_pages_for_search": 1,
|
|
||||||
"links": [],
|
|
||||||
"modified": "2021-03-05 12:59:22.973826",
|
|
||||||
"modified_by": "Administrator",
|
|
||||||
"module": "LMS",
|
|
||||||
"name": "LMS Course Enrollment",
|
|
||||||
"owner": "Administrator",
|
|
||||||
"permissions": [
|
|
||||||
{
|
|
||||||
"create": 1,
|
|
||||||
"delete": 1,
|
|
||||||
"email": 1,
|
|
||||||
"export": 1,
|
|
||||||
"print": 1,
|
|
||||||
"read": 1,
|
|
||||||
"report": 1,
|
|
||||||
"role": "System Manager",
|
|
||||||
"share": 1,
|
|
||||||
"write": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"create": 1,
|
|
||||||
"delete": 1,
|
|
||||||
"email": 1,
|
|
||||||
"export": 1,
|
|
||||||
"print": 1,
|
|
||||||
"read": 1,
|
|
||||||
"report": 1,
|
|
||||||
"role": "Student",
|
|
||||||
"share": 1,
|
|
||||||
"write": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"sort_field": "modified",
|
|
||||||
"sort_order": "DESC",
|
|
||||||
"track_changes": 1
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
# Copyright (c) 2021, FOSS United and contributors
|
|
||||||
# For license information, please see license.txt
|
|
||||||
|
|
||||||
# import frappe
|
|
||||||
from frappe.model.document import Document
|
|
||||||
|
|
||||||
|
|
||||||
class LMSCourseEnrollment(Document):
|
|
||||||
pass
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
# Copyright (c) 2021, FOSS United and Contributors
|
|
||||||
# See license.txt
|
|
||||||
|
|
||||||
# import frappe
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
|
|
||||||
class TestLMSCourseEnrollment(unittest.TestCase):
|
|
||||||
pass
|
|
||||||
0
lms/lms/page/lms_home/__init__.py
Normal file
0
lms/lms/page/lms_home/__init__.py
Normal file
3
lms/lms/page/lms_home/lms_home.js
Normal file
3
lms/lms/page/lms_home/lms_home.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
frappe.pages['lms-home'].on_page_load = function(wrapper) {
|
||||||
|
window.location.href = '/courses'
|
||||||
|
}
|
||||||
19
lms/lms/page/lms_home/lms_home.json
Normal file
19
lms/lms/page/lms_home/lms_home.json
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"content": null,
|
||||||
|
"creation": "2022-12-15 13:45:06.602567",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Page",
|
||||||
|
"idx": 0,
|
||||||
|
"modified": "2022-12-15 13:45:06.602567",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "LMS",
|
||||||
|
"name": "lms-home",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"page_name": "lms-home",
|
||||||
|
"roles": [],
|
||||||
|
"script": null,
|
||||||
|
"standard": "Yes",
|
||||||
|
"style": null,
|
||||||
|
"system_page": 1,
|
||||||
|
"title": "LMS"
|
||||||
|
}
|
||||||
@@ -8,7 +8,6 @@ from frappe import _
|
|||||||
from frappe.core.doctype.user.user import User
|
from frappe.core.doctype.user.user import User
|
||||||
from frappe.utils import cint, escape_html, random_string
|
from frappe.utils import cint, escape_html, random_string
|
||||||
from frappe.website.utils import is_signup_disabled
|
from frappe.website.utils import is_signup_disabled
|
||||||
|
|
||||||
from lms.lms.utils import validate_image
|
from lms.lms.utils import validate_image
|
||||||
from lms.widgets import Widgets
|
from lms.widgets import Widgets
|
||||||
|
|
||||||
@@ -295,6 +294,14 @@ def get_country_code():
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def on_login(login_manager):
|
||||||
|
set_country_from_ip()
|
||||||
|
|
||||||
|
|
||||||
|
def on_session_creation(login_manager):
|
||||||
|
frappe.local.response["home_page"] = "/courses"
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def search_users(start=0, text=""):
|
def search_users(start=0, text=""):
|
||||||
or_filters = get_or_filters(text)
|
or_filters = get_or_filters(text)
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ lms.patches.v0_0.set_dashboard #11-10-2022
|
|||||||
lms.patches.v0_0.set_courses_page_as_home
|
lms.patches.v0_0.set_courses_page_as_home
|
||||||
lms.patches.v0_0.set_member_in_progress #09-11-2022
|
lms.patches.v0_0.set_member_in_progress #09-11-2022
|
||||||
lms.patches.v0_0.convert_progress_to_float
|
lms.patches.v0_0.convert_progress_to_float
|
||||||
|
lms.patches.v0_0.add_pages_to_nav #25-11-2022
|
||||||
lms.patches.v0_0.change_role_names
|
lms.patches.v0_0.change_role_names
|
||||||
lms.patches.v0_0.quiz_submission_result
|
lms.patches.v0_0.quiz_submission_result
|
||||||
lms.patches.v0_0.skill_to_user_skill
|
lms.patches.v0_0.skill_to_user_skill
|
||||||
|
|||||||
5
lms/public/js/setup_wizard.js
Normal file
5
lms/public/js/setup_wizard.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
frappe.provide("lms.setup");
|
||||||
|
|
||||||
|
// redirect to desk page 'lms' after setup wizard is complete
|
||||||
|
// 'lms' desk page redirects to '/courses'
|
||||||
|
frappe.setup.welcome_page = "/app/lms-home";
|
||||||
@@ -205,9 +205,9 @@
|
|||||||
<div class="course-home-headings"> {{ _("Role Settings") }} </div>
|
<div class="course-home-headings"> {{ _("Role Settings") }} </div>
|
||||||
<div class="medium">
|
<div class="medium">
|
||||||
<label class="role">
|
<label class="role">
|
||||||
<input type="checkbox" id="instructor" data-role="Instructor"
|
<input type="checkbox" id="course-creator" data-role="Course Creator"
|
||||||
{% if has_course_instructor_role(member.name) %} checked {% endif %}>
|
{% if has_course_instructor_role(member.name) %} checked {% endif %}>
|
||||||
{{ _("Instructor") }}
|
{{ _("Course Creator") }}
|
||||||
</label>
|
</label>
|
||||||
<label class="role">
|
<label class="role">
|
||||||
<input type="checkbox" id="moderator" data-role="Moderator"
|
<input type="checkbox" id="moderator" data-role="Moderator"
|
||||||
|
|||||||
Reference in New Issue
Block a user