forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ali Salman
authored and
Ali Salman
committed
Dec 1, 2023
1 parent
bd7ef76
commit ed6ae31
Showing
14 changed files
with
173 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
default_app_config = "openedx.features.google_cdn_uploads.apps:GoogleCDNUploadsConfig" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
Admin registration for Messenger. | ||
""" | ||
from django.contrib import admin | ||
|
||
from openedx.features.google_cdn_uploads.models import GoogleCDNUpload | ||
|
||
|
||
class GoogleCDNUploadAdmin(admin.ModelAdmin): | ||
""" | ||
Admin config clearesult credit providers. | ||
""" | ||
list_display = ("file_name", "course_id",) | ||
search_fields = ("file_name", "course_id",) | ||
|
||
|
||
admin.site.register(GoogleCDNUpload, GoogleCDNUploadAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
Meta Translations App Config | ||
""" | ||
from django.apps import AppConfig | ||
from edx_django_utils.plugins import PluginURLs, PluginSettings | ||
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType | ||
|
||
class GoogleCDNUploadsConfig(AppConfig): | ||
name = 'openedx.features.google_cdn_uploads' | ||
plugin_app = { | ||
PluginURLs.CONFIG: { | ||
ProjectType.CMS: { | ||
PluginURLs.NAMESPACE: 'google_cdn_uploads', | ||
PluginURLs.REGEX: '^google_cdn_uploads/', | ||
PluginURLs.RELATIVE_PATH: 'urls', | ||
}, | ||
}, | ||
PluginSettings.CONFIG: { | ||
ProjectType.CMS: { | ||
SettingsType.COMMON: {PluginSettings.RELATIVE_PATH: 'settings.common'}, | ||
}, | ||
} | ||
} | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
Meta Translations Models | ||
""" | ||
from django.db import models | ||
from opaque_keys.edx.django.models import CourseKeyField | ||
|
||
|
||
class GoogleCDNUpload(models.Model): | ||
""" | ||
Store course id and file name | ||
""" | ||
course_id = CourseKeyField(max_length=255, db_index=True) | ||
file_name = models.CharField(max_length=255) | ||
|
||
class Meta: | ||
app_label = 'google_cdn_uploads' | ||
verbose_name = "Google CDN Uploads" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
Common settings for Messenger | ||
""" | ||
|
||
|
||
def plugin_settings(settings): | ||
""" | ||
Common settings for uploading mp4 | ||
""" | ||
settings.MAKO_TEMPLATE_DIRS_BASE.append( | ||
settings.OPENEDX_ROOT / 'features' / 'google_cdn_uploads' / 'templates', | ||
) | ||
|
||
settings.STATICFILES_DIRS.append ( | ||
settings.OPENEDX_ROOT / 'features' / 'google_cdn_uploads' / 'static', | ||
) | ||
print('CDN App - Setting Updated') |
11 changes: 11 additions & 0 deletions
11
openedx/features/google_cdn_uploads/static/google_cdn_uploads/js/GoogleCDNUpload.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import UploadContext from "./UploadContext"; | ||
|
||
export default class GoogleCDNUpload { | ||
constructor() { | ||
ReactDOM.render(<UploadContext context={context} />, document.getElementById("root")); | ||
} | ||
} | ||
|
||
export { GoogleCDNUpload } |
11 changes: 11 additions & 0 deletions
11
openedx/features/google_cdn_uploads/static/google_cdn_uploads/js/UploadContext.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react'; | ||
|
||
function UploadContext({ context }) { | ||
return ( | ||
<div className="translations"> | ||
<p>kjasnxkajsnkxajns</p> | ||
</div> | ||
) | ||
} | ||
|
||
export default UploadContext; |
25 changes: 25 additions & 0 deletions
25
openedx/features/google_cdn_uploads/templates/uploads.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<%inherit file="base.html" /> | ||
<%namespace name='static' file='static_content.html'/> | ||
<%! | ||
from django.urls import reverse | ||
from django.utils.translation import ugettext as _ | ||
from openedx.core.djangolib.js_utils import js_escaped_string, dump_js_escaped_json | ||
%> | ||
|
||
<%def name="online_help_token()"><% return "home" %></%def> | ||
<%block name="title">${_("{studio_name} Home").format(studio_name=settings.STUDIO_SHORT_NAME)}</%block> | ||
<%block name="bodyclass">is-signedin index view-dashboard</%block> | ||
|
||
|
||
|
||
<%block name="content"> | ||
<div id="root" class="container"> | ||
hello | ||
</div> | ||
|
||
<%static:webpack entry="GoogleCDNUpload"> | ||
var context = {} | ||
|
||
new GoogleCDNUpload(context); | ||
</%static:webpack> | ||
</%block> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
Urls for Meta Translations | ||
""" | ||
from django.conf.urls import include, url | ||
|
||
from openedx.features.google_cdn_uploads.views import render_google_cdn_uploads_home | ||
|
||
app_name = 'google_cdn_uploads' | ||
|
||
urlpatterns = [ | ||
# url( | ||
# r'^course_blocks_mapping/$', | ||
# course_blocks_mapping, | ||
# name='course_blocks_mapping' | ||
# ), | ||
url( | ||
r'^$', | ||
render_google_cdn_uploads_home, | ||
name='google_cdn_uploads_home' | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Views for uploading mp4 | ||
""" | ||
import json | ||
from logging import getLogger | ||
from django.contrib.auth.decorators import login_required | ||
from django.views.decorators.http import require_http_methods | ||
from django.http import JsonResponse | ||
from xmodule.modulestore.django import modulestore | ||
from opaque_keys.edx.keys import CourseKey | ||
from django.conf import settings | ||
from common.djangoapps.edxmako.shortcuts import render_to_response | ||
|
||
from lms.djangoapps.courseware.courses import get_course_by_id | ||
log = getLogger(__name__) | ||
|
||
|
||
@login_required | ||
def render_google_cdn_uploads_home(request): | ||
return render_to_response('uploads.html', { | ||
'uses_bootstrap': True, | ||
'login_user_username': request.user.username, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters