diff --git a/lms/demo/demo_data.py b/lms/demo/demo_data.py new file mode 100644 index 00000000..829b3caa --- /dev/null +++ b/lms/demo/demo_data.py @@ -0,0 +1,357 @@ +import json + +import frappe + + +def create_demo_data(): + course = create_course() + create_chapter(course) + create_lessons(course) + + +def create_course(): + title = "A guide to Frappe Learning" + filters = {"title": title} + if frappe.db.exists("LMS Course", filters): + return frappe.get_doc("LMS Course", filters) + + instructor = create_instructor() + course = frappe.new_doc("LMS Course") + course.update( + { + "title": title, + "category": "Business", + "tags": "Frappe, Demo", + "published": 1, + "published_on": frappe.utils.now(), + "video_link": "VIt_bsbBjLI", + "instructors": [{"instructor": instructor.name}], + "short_introduction": "Learn the basics of Frappe Learning and how to get started.", + } + ) + + course.description = """ + This course will cover the fundamentals of Frappe Learning, including how to create and manage courses, enroll students, and track progress. + + You will learn about the following key features of the app: + +
https://www.youtube.com/watch?v=<video-id>'
+ },
+ },
+ {"id": "8hMi323AbM", "type": "paragraph", "data": {"text": "Example"}},
+ {
+ "id": "3H6BzIshWg",
+ "type": "paragraph",
+ "data": {
+ "text": 'https://www.youtube.com/watch?v=SLNSSz41v_o'
+ },
+ },
+ {"id": "yGSuw7Im0i", "type": "markdown", "data": {"text": ""}},
+ {"id": "WRVOABPAZO", "type": "header", "data": {"text": "Vimeo", "level": 2}},
+ {
+ "id": "AabHQjaQvo",
+ "type": "paragraph",
+ "data": {"text": "Vimeo videos are supported using the video URL."},
+ },
+ {"id": "q_9aNfNHEP", "type": "paragraph", "data": {"text": "Supported URL format"}},
+ {
+ "id": "1YYctmoyod",
+ "type": "paragraph",
+ "data": {"text": 'https://vimeo.com/<video-id>'},
+ },
+ {"id": "OX_NGBxJTY", "type": "paragraph", "data": {"text": "Example"}},
+ {
+ "id": "KZYnrs_Dnf",
+ "type": "paragraph",
+ "data": {"text": 'https://vimeo.com/825334862'},
+ },
+ {"id": "-mkC711EdF", "type": "markdown", "data": {"text": ""}},
+ {"id": "nSzyGY6f68", "type": "header", "data": {"text": "Cloudflare Stream", "level": 2}},
+ {
+ "id": "-cpNtfvP5T",
+ "type": "paragraph",
+ "data": {"text": "Cloudflare Stream provides secure video hosting with adaptive streaming."},
+ },
+ {"id": "e2fQ-DG6Nd", "type": "paragraph", "data": {"text": "Supported URL format"}},
+ {
+ "id": "av_Q4P66hb",
+ "type": "paragraph",
+ "data": {
+ "text": 'https://customer-<account-id>.cloudflarestream.com/<video-id>/watch'
+ },
+ },
+ {"id": "8KCsx40NpJ", "type": "paragraph", "data": {"text": "Example"}},
+ {
+ "id": "USi0pW91df",
+ "type": "paragraph",
+ "data": {
+ "text": 'https://customer-f33zs165nr7gyfy4.cloudflarestream.com/6b9e68b07dfee8cc2d116e4c51d6a957/watch'
+ },
+ },
+ {"id": "e6I0VuwXx9", "type": "markdown", "data": {"text": ""}},
+ {"id": "C-u44GnaTz", "type": "header", "data": {"text": "Bunny Stream", "level": 2}},
+ {
+ "id": "uR8XZtPVC5",
+ "type": "paragraph",
+ "data": {"text": "Bunny Stream allows fast, global video delivery with built-in analytics."},
+ },
+ {"id": "BYkm4Hy_v8", "type": "paragraph", "data": {"text": "Supported URL format"}},
+ {
+ "id": "TCM9COabp8",
+ "type": "paragraph",
+ "data": {
+ "text": 'https://iframe.mediadelivery.net/play/<library-id>/<video-id>'
+ },
+ },
+ {"id": "KCiA6zVRYf", "type": "paragraph", "data": {"text": "Example"}},
+ {
+ "id": "kYDFL8Dn1v",
+ "type": "paragraph",
+ "data": {
+ "text": 'https://iframe.mediadelivery.net/play/579970/54b3e5a1-cf95-4f88-96d3-8387d93dc2f2'
+ },
+ },
+ {"id": "jfnSgNAv5Q", "type": "markdown", "data": {"text": ""}},
+ {"id": "NCY3opj8uc", "type": "header", "data": {"text": "Important Notes", "level": 2}},
+ {
+ "id": "xHWE56ECqw",
+ "type": "paragraph",
+ "data": {"text": "Paste only the video URL, not iframe embed code"},
+ },
+ {
+ "id": "ZzrV99rSxJ",
+ "type": "paragraph",
+ "data": {"text": "The URL must match one of the supported formats above"},
+ },
+ {
+ "id": "jjg_inGE2B",
+ "type": "paragraph",
+ "data": {
+ "text": "Video privacy, access control, and streaming limits are managed by the video provider"
+ },
+ },
+ ],
+ "version": "2.29.0",
+ }
+
+
+def get_google_suite_content():
+ return {
+ "time": 1772450743148,
+ "blocks": [
+ {
+ "id": "73fFo3DS18",
+ "type": "paragraph",
+ "data": {
+ "text": "You can integrate live Google Docs, Sheets, and Slides into your lessons to provide dynamic, up-to-date documentation and presentations."
+ },
+ },
+ {"id": "Z6I1ZV7Fvr", "type": "markdown", "data": {"text": ""}},
+ {
+ "id": "hiJVoYEhfN",
+ "type": "header",
+ "data": {"text": "How to Embed Google Workspace Files", "level": 3},
+ },
+ {
+ "id": "v9_hXM3d8b",
+ "type": "list",
+ "data": {
+ "style": "ordered",
+ "items": [
+ {"content": "Open your Google Doc, Sheet, or Slide.", "items": []},
+ {"content": "Make sure your permissions are set properly", "items": []},
+ {"content": "Copy your URL from the top browser address bar", "items": []},
+ {"content": "Now paste it in your lesson", "items": []},
+ ],
+ },
+ },
+ {"id": "ycS1sd-0us", "type": "markdown", "data": {"text": ""}},
+ {"id": "NjN6_ixXRW", "type": "header", "data": {"text": "Integration Options", "level": 3}},
+ {
+ "id": "MgXDT0xV4X",
+ "type": "list",
+ "data": {
+ "style": "unordered",
+ "items": [
+ {
+ "content": "Google Slides: Perfect for presentations. These render with full navigation controls for the student.",
+ "items": [],
+ },
+ {
+ "content": "Google Sheets: Useful for sharing live data tables or interactive calculators.",
+ "items": [],
+ },
+ {
+ "content": "Google Docs: Best for course handouts, reading material, or live-updating documentation.",
+ "items": [],
+ },
+ ],
+ },
+ },
+ ],
+ "version": "2.29.0",
+ }
diff --git a/lms/install.py b/lms/install.py
index 9862f0dd..683d087d 100644
--- a/lms/install.py
+++ b/lms/install.py
@@ -1,6 +1,6 @@
import frappe
-from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
+from lms.demo.demo_data import create_demo_data
from lms.lms.api import give_discussions_permission
@@ -14,6 +14,7 @@ def after_sync():
create_lms_roles()
set_default_certificate_print_format()
give_lms_roles_to_admin()
+ create_demo_data()
def before_uninstall():