Changeset 2426245
- Timestamp:
- 11/26/2020 05:07:05 AM (5 years ago)
- Location:
- edunext-openedx-integrator/trunk
- Files:
-
- 14 edited
-
assets/js/commons.min.js (modified) (2 diffs)
-
assets/js/wcWorkflow.min.js (modified) (4 diffs)
-
assets/screenshot-1.jpg (modified) (previous)
-
assets/screenshot-2.jpg (modified) (previous)
-
assets/screenshot-3.jpg (modified) (previous)
-
assets/screenshot-4.jpg (modified) (previous)
-
assets/screenshot-5.jpg (modified) (previous)
-
assets/screenshot-6.jpg (modified) (previous)
-
assets/screenshot-7.jpg (modified) (previous)
-
includes/class-wp-edunext-marketing-site-settings.php (modified) (3 diffs)
-
includes/class-wp-edunext-marketing-site.php (modified) (1 diff)
-
includes/lib/class-wp-edunext-marketing-site-menu-items-attributes.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
wp-edunext-marketing-site.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
edunext-openedx-integrator/trunk/assets/js/commons.min.js
r2152571 r2426245 4 4 ENEXT.OPENEDX_DOMAIN = ENEXT_SRV.lms_base_url; 5 5 ENEXT.WP_LOGOUT_URL = ENEXT_SRV.wp_logout_url; 6 ENEXT.WP_USER_LOGGEDIN = Boolean(ENEXT_SRV.wp_user_logged_in); 6 7 ENEXT.ENROLLMENT_API_LOCATION = ENEXT.OPENEDX_DOMAIN + ENEXT_SRV.enrollment_api_location; 7 8 … … 46 47 47 48 ENEXT.assertSessionSynchrony = function() { 48 if (!ENEXT.amILoggedIn() ) {49 if (!ENEXT.amILoggedIn() && ENEXT.WP_USER_LOGGEDIN) { 49 50 jQuery.ajax({ 50 51 url: ENEXT.WP_LOGOUT_URL -
edunext-openedx-integrator/trunk/assets/js/wcWorkflow.min.js
r2152571 r2426245 1 1 'use strict'; 2 2 window.ENEXT = window.ENEXT || {}; 3 window.ENEXT_SRV = window.ENEXT_SRV || {}; 4 window.ENEXT_SC = window.ENEXT_SC || {}; 3 5 4 ENEXT.OPENEDX_DOMAIN = ENEXT_SRV.lms_base_url ;6 ENEXT.OPENEDX_DOMAIN = ENEXT_SRV.lms_base_url || ENEXT_SC.lms_base_url; 5 7 ENEXT.LOGIN_NEXT = ENEXT_SRV.lms_wp_return_path; 6 8 ENEXT.LOGIN_PATH = ENEXT_SRV.lms_login_path; 7 ENEXT.RUN_FUNCTIONS = ENEXT_SRV.run_functions; 9 ENEXT.RUN_FUNCTIONS = [].concat(ENEXT_SRV.run_functions).concat(ENEXT_SC.run_shortcode); 10 ENEXT.PREFILL_MAPPINGS = ENEXT_SRV.prefill_mappings; 8 11 9 12 ENEXT.CACHE = {}; 10 13 11 14 12 ENEXT.call MeAtOpenEdx = function() {13 if ('api_user_v1_ me'in ENEXT.CACHE) {14 return ENEXT.CACHE['api_user_v1_ me'];15 ENEXT.callApiAtOpenEdx = function(endpoint) { 16 if ('api_user_v1_' + endpoint in ENEXT.CACHE) { 17 return ENEXT.CACHE['api_user_v1_' + endpoint]; 15 18 } 16 ENEXT.CACHE['api_user_v1_ me'] = jQuery.ajax({17 url: ENEXT.OPENEDX_DOMAIN + "/api/user/v1/ me",19 ENEXT.CACHE['api_user_v1_' + endpoint] = jQuery.ajax({ 20 url: ENEXT.OPENEDX_DOMAIN + "/api/user/v1/" + endpoint, 18 21 method: "GET", 19 22 xhrFields: { … … 21 24 } 22 25 }) 23 return ENEXT.CACHE['api_user_v1_ me'];26 return ENEXT.CACHE['api_user_v1_' + endpoint]; 24 27 } 25 28 26 ENEXT.assertOpenEdxLoggedIn = function() { 27 ENEXT.callMeAtOpenEdx().fail(function(xhr) { 29 ENEXT.assertOpenEdxLoggedIn = function(includeData) { 30 var endpoint = 'me'; 31 if (includeData) { 32 var endpoint = 'accounts'; 33 } 34 35 ENEXT.callApiAtOpenEdx(endpoint).fail(function(xhr) { 28 36 if (xhr.status === 401) { 29 37 // Not logged in, redirecting … … 41 49 }; 42 50 43 ENEXT.addUsernameToCheckout = function() { 44 ENEXT.callMeAtOpenEdx().success(function(data) { 45 if ('username' in data) { 46 var apiUsername = data.username; 47 jQuery('form[name="checkout"]').append('<input type="hidden" name="wpt_oer_username" value="' + apiUsername + '">'); 51 ENEXT.assertOpenEdxLoggedInWithData = function(includeData) { 52 ENEXT.assertOpenEdxLoggedIn(true); 53 } 54 55 ENEXT.prefillVisibleFields = function() { 56 ENEXT.callApiAtOpenEdx('accounts').success(function(dataArray) { 57 var data = dataArray[0]; 58 var mappings = JSON.parse(ENEXT.PREFILL_MAPPINGS); 59 data['extended_profile'].map(( ({field_name, field_value}) => data[field_name] = field_value)); 60 61 for (let prop in mappings) { 62 jQuery('form[name="checkout"] #' + prop).val(data[mappings[prop]]); 48 63 } 49 else { 50 console.warn("The openedx integrator plugin could not find the username to insert to the checkout form."); 64 }); 65 } 66 67 ENEXT.replaceShortcodeFields = function() { 68 ENEXT.callApiAtOpenEdx('accounts').success(function(dataArray) { 69 var data = dataArray[0]; 70 jQuery('.js-order-info-sc').each(function(index, item){ 71 var $item = jQuery(item); 72 if ($item.data('field') in data) { 73 $item.html(data[$item.data('field')]); 74 } 75 }); 76 }); 77 } 78 79 ENEXT.addInfoToCheckout = function() { 80 ENEXT.callApiAtOpenEdx('accounts').success(function(dataArray) { 81 var data = dataArray[0]; 82 var fields = ['username', 'name', 'email']; 83 for (var i = fields.length - 1; i >= 0; i--) { 84 if (fields[i] in data) { 85 jQuery('form[name="checkout"]').append('<input type="hidden" name="wpt_oer_' + fields[i] + '" value="' + data[fields[i]] + '">'); 86 } 87 else { 88 console.warn("The openedx integrator plugin could not find the " + fields[i] + " to insert to the checkout form."); 89 } 51 90 } 52 91 }); … … 55 94 // Run the defined functions 56 95 for (var i = 0; i < ENEXT.RUN_FUNCTIONS.length; i++) { 57 ENEXT[ENEXT.RUN_FUNCTIONS[i]](); 96 if (ENEXT.RUN_FUNCTIONS[i] in ENEXT) { 97 ENEXT[ENEXT.RUN_FUNCTIONS[i]](); 98 } 58 99 } -
edunext-openedx-integrator/trunk/includes/class-wp-edunext-marketing-site-settings.php
r2152571 r2426245 204 204 array( 205 205 'id' => 'enable_session_existence_sync', 206 'label' => __( 'Log out of WP when openedxis not logged in', 'wp-edunext-marketing-site' ),207 'description' => __( 'This will force the users to login on openedxto mantain a valid session on WordPress.', 'wp-edunext-marketing-site' ),206 'label' => __( 'Log out of WP when Open edX is not logged in', 'wp-edunext-marketing-site' ), 207 'description' => __( 'This will force the users to login on Open edX to mantain a valid session on WordPress.', 'wp-edunext-marketing-site' ), 208 208 'type' => 'checkbox', 209 209 'default' => false, … … 661 661 array( 662 662 'id' => 'enable_wc_checkout_loggedin_intervention', 663 'label' => __( 'Get username information from openedxinto the checkout page', 'wp-edunext-marketing-site' ),663 'label' => __( 'Get username information from Open edX into the checkout page', 'wp-edunext-marketing-site' ), 664 664 'description' => __( 'Make sure that users have a valid session when they access the woocommerce checkout form. The username for said session is then used for the order fulfillment.', 'wp-edunext-marketing-site' ), 665 665 'type' => 'checkbox', … … 675 675 'default' => '/checkout', 676 676 'placeholder' => '/cart', 677 ), 678 array( 679 'id' => 'enable_wc_checkout_client_prefill', 680 'label' => __( 'Enable Checkout client-side fields pre-filling', 'wp-edunext-marketing-site' ), 681 'description' => __( 'Enables the pre-filling of the checkout form fields by the calls to the Open edX accounts API. Requires the users to have a valid Open edX session.', 'wp-edunext-marketing-site' ), 682 'type' => 'checkbox', 683 'default' => false, 684 'placeholder' => '', 685 'advanced_setting' => true, 686 ), 687 array( 688 'id' => 'enable_wc_checkout_client_prefill_mappings', 689 'label' => __( 'User Profile fields mapping for client-side pre-filling', 'wp-edunext-marketing-site' ), 690 'description' => __( 'Mapping of user fields for pre-filling, from the accounts api in Open edX to the to Woocommerce chekout form fields.', 'wp-edunext-marketing-site', 'wp-edunext-marketing-site' ), 691 'type' => 'textarea', 692 'default' => '{"billing_email": "email" , "billing_first_name": "name"}', 693 'placeholder' => '{"billing_email": "email" , "billing_first_name": "name", ...}', 694 'advanced_setting' => true, 677 695 ), 678 696 ), -
edunext-openedx-integrator/trunk/includes/class-wp-edunext-marketing-site.php
r2152571 r2426245 280 280 'user_enrollment_url' => get_option( 'wpt_user_enrollment_url' ), 281 281 'course_has_not_started_url' => get_option( 'wpt_course_has_not_started_url' ), 282 'wp_user_logged_in' => is_user_logged_in(), 282 283 'wp_logout_url' => false, 283 284 ); -
edunext-openedx-integrator/trunk/includes/lib/class-wp-edunext-marketing-site-menu-items-attributes.php
r2152571 r2426245 15 15 $item_output = ''; 16 16 parent::start_el( $item_output, $item, $depth, $args ); 17 17 18 // Inject $new_fields before: <div class="menu-item-actions description-wide submitbox">. 18 if ( $new_fields = Edx_Nav_Menu_Item_Custom_Fields::get_field( $item, $depth, $args ) ) { 19 $new_fields = Edx_Nav_Menu_Item_Custom_Fields::get_field( $item, $depth, $args ); 20 if ( $new_fields ) { 19 21 $label = '<p class="edx-hide-if">Hide if Open edX user is:</p>'; 20 22 $new_html = '<div class="clear">' . $label . $new_fields . '</div>'; -
edunext-openedx-integrator/trunk/readme.txt
r2152571 r2426245 3 3 Tags: wordpress, Open edX, LMS 4 4 Requires at least: 4.0 5 Tested up to: 5. 26 Stable tag: 2. 1.05 Tested up to: 5.5.3 6 Stable tag: 2.6.1 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 131 131 [edunext_enroll_button course_id="course-v1:organization+coursenumber+courserun" label_enroll="Enroll in the course now"] 132 132 133 == Screenshots == 134 1. General Settings 135 2. Configuration of the User Menu 136 3. Addition of the User Menu 137 4. Configuration of the course buttons 138 5. Addition of course buttons 139 6. Woocommerce integration 133 == Screenshots == 134 1. General Settings 135 2. Configuration of the User Menu 136 3. Addition of the User Menu 137 4. Configuration of the course buttons 138 5. Addition of course buttons 139 6. Woocommerce integration 140 140 7. EOX - API backend 141 141 … … 168 168 * Initial release 169 169 170 == Translations == 171 * English - default, always included 170 == Translations == 171 * English - default, always included 172 172 173 173 Note: All the strings in this plugins are localized / translateable by default. In case you need assistance with a particular localization issue, or want to contribute with one traslation, please reach out to eduNEXT (https://edunext.co) -
edunext-openedx-integrator/trunk/wp-edunext-marketing-site.php
r2152571 r2426245 2 2 /** 3 3 * Plugin Name: Open edX LMS and WordPress integrator (LITE) 4 * Version: 2. 1.04 * Version: 2.6.1 5 5 * Description: Set up your WordPress site as the front end site or marketing site for your online learning initiative powered by the open edX platform. 6 6 * Author: eduNEXT 7 7 * Author URI: https://edunext.co/ 8 8 * Requires at least: 4.0 9 * Tested up to: 5. 29 * Tested up to: 5.5.3 10 10 * 11 11 * Text Domain: wp-edunext-marketing-site … … 43 43 */ 44 44 function WP_eduNEXT_Marketing_Site() { 45 $instance = WP_eduNEXT_Marketing_Site::instance( __FILE__, '2. 1.0' );45 $instance = WP_eduNEXT_Marketing_Site::instance( __FILE__, '2.6.1' ); 46 46 47 47 if ( is_null( $instance->settings ) ) {
Note: See TracChangeset
for help on using the changeset viewer.