diff --git a/lms/lms/doctype/lms_class/lms_class.py b/lms/lms/doctype/lms_class/lms_class.py index 4a91416d..2896ffd8 100644 --- a/lms/lms/doctype/lms_class/lms_class.py +++ b/lms/lms/doctype/lms_class/lms_class.py @@ -5,6 +5,9 @@ import frappe from frappe.model.document import Document from frappe import _ from frappe.utils import cint +import requests +import urllib +from requests.auth import HTTPBasicAuth class LMSClass(Document): @@ -85,3 +88,22 @@ def update_course(class_name, course, value): else: frappe.db.delete("Class Course", {"parent": class_name, "course": course}) return True + + +@frappe.whitelist() +def create_live_class(class_name): + authenticate() + + +def authenticate(): + zoom = frappe.get_single("Zoom Settings") + if not zoom.enable: + frappe.throw(_("Please enable Zoom Settings to use this feature.")) + + authenticate_url = "https://zoom.us/oauth/token?grant_type=client_credentials" + print(authenticate_url) + breakpoint + r = requests.get( + authenticate_url, auth=HTTPBasicAuth(zoom.client_id, zoom.client_secret) + ) + return r diff --git a/lms/lms/doctype/zoom_settings/__init__.py b/lms/lms/doctype/zoom_settings/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lms/lms/doctype/zoom_settings/test_zoom_settings.py b/lms/lms/doctype/zoom_settings/test_zoom_settings.py new file mode 100644 index 00000000..3162d3dc --- /dev/null +++ b/lms/lms/doctype/zoom_settings/test_zoom_settings.py @@ -0,0 +1,9 @@ +# Copyright (c) 2023, Frappe and Contributors +# See license.txt + +# import frappe +from frappe.tests.utils import FrappeTestCase + + +class TestZoomSettings(FrappeTestCase): + pass diff --git a/lms/lms/doctype/zoom_settings/zoom_settings.js b/lms/lms/doctype/zoom_settings/zoom_settings.js new file mode 100644 index 00000000..70710042 --- /dev/null +++ b/lms/lms/doctype/zoom_settings/zoom_settings.js @@ -0,0 +1,8 @@ +// Copyright (c) 2023, Frappe and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("Zoom Settings", { +// refresh(frm) { + +// }, +// }); diff --git a/lms/lms/doctype/zoom_settings/zoom_settings.json b/lms/lms/doctype/zoom_settings/zoom_settings.json new file mode 100644 index 00000000..df8f69b3 --- /dev/null +++ b/lms/lms/doctype/zoom_settings/zoom_settings.json @@ -0,0 +1,65 @@ +{ + "actions": [], + "creation": "2023-02-27 14:30:28.696814", + "default_view": "List", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "enable", + "sb_00", + "client_id", + "client_secret" + ], + "fields": [ + { + "default": "0", + "fieldname": "enable", + "fieldtype": "Check", + "label": "Enable" + }, + { + "depends_on": "enable", + "fieldname": "sb_00", + "fieldtype": "Section Break", + "label": "OAuth Client ID" + }, + { + "description": "The Client ID obtained from the Google Cloud Console under \n\"APIs & Services\" > \"Credentials\"\n", + "fieldname": "client_id", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Client ID", + "mandatory_depends_on": "google_drive_picker_enabled" + }, + { + "fieldname": "client_secret", + "fieldtype": "Password", + "in_list_view": 1, + "label": "Client Secret" + } + ], + "issingle": 1, + "links": [], + "modified": "2023-02-27 14:30:28.696814", + "modified_by": "Administrator", + "module": "LMS", + "name": "Zoom Settings", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "ASC", + "states": [], + "track_changes": 1 +} \ No newline at end of file diff --git a/lms/lms/doctype/zoom_settings/zoom_settings.py b/lms/lms/doctype/zoom_settings/zoom_settings.py new file mode 100644 index 00000000..d7ed9efb --- /dev/null +++ b/lms/lms/doctype/zoom_settings/zoom_settings.py @@ -0,0 +1,9 @@ +# Copyright (c) 2023, Frappe and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class ZoomSettings(Document): + pass diff --git a/lms/lms/md.py b/lms/lms/md.py index 1a6b9ed7..e7830722 100644 --- a/lms/lms/md.py +++ b/lms/lms/md.py @@ -114,7 +114,7 @@ def sanitize_html(html, macro): any broken tags. This makes sures that all those things are fixed before passing to the etree parser. """ - soup = BeautifulSoup(html, features="lxml") + soup = BeautifulSoup(html, features="html5lib") nodes = soup.body.children classname = "" if macro == "YouTubeVideo": diff --git a/lms/www/classes/class.html b/lms/www/classes/class.html index 87a73f2d..fb418d99 100644 --- a/lms/www/classes/class.html +++ b/lms/www/classes/class.html @@ -74,6 +74,12 @@ +