Skip to content

Conversation

@saadman30
Copy link
Collaborator

No description provided.

- Introduced a new question type 'draw_image' in the curriculum components.
- Updated Question, QuestionConditions, QuestionForm, and QuestionList to support the new question type.
- Implemented DrawImage component for handling drawing on images.
- Enhanced Quiz class to process answers for draw_image questions.
- Added necessary translations and icons for the new question type.
- Added support for 'draw_image' question type in the quiz, allowing users to draw on images.
- Updated JavaScript logic to handle answer validation and reveal mode for draw_image questions.
- Enhanced PHP classes to save and process the drawn image mask.
- Improved UI to display student submissions and instructor references for draw_image questions.
- Added necessary translations and updated quiz attempt details to reflect new functionality.
@saadman30 saadman30 self-assigned this Feb 2, 2026
@saadman30 saadman30 added the 4.0.0 Tutor v4.w0w label Feb 2, 2026
- Removed "(R&D)" from the label of the 'draw_image' question type in both QuestionConditions and QuestionList components for clarity and consistency.
- Ensured translations are updated accordingly in the 'tutor' text domain.
- Streamlined the logic for handling student-submitted masks in the 'draw_image' question type.
- Removed redundant code and ensured that the answer is processed correctly from the nested structure.
- Improved code readability and maintainability by consolidating answer extraction logic.
- Updated comments for clarity on handling raw base64 or URL inputs in the 'draw_image' question type.
- Ensured that the URL returned from saving the drawn image mask is properly sanitized using esc_url_raw.
- Enhanced code readability by clarifying the sanitization process for different input types.
- Improved handling of base64 and URL inputs for the 'draw_image' question type.
- Added security checks to ensure only local uploads are accepted, rejecting external URLs.
- Clarified comments and improved code readability regarding image saving and processing.
- Ensured that the saved image is always stored with a .png extension for consistency.
… type

- Updated comments to specify that masks are stored as local file URLs only.
- Improved condition checks to ensure only valid local URLs are processed for student and instructor submitted drawings.
- Enhanced code readability by removing redundant checks and ensuring consistent use of esc_url for outputting image URLs.
@saadman30 saadman30 marked this pull request as ready for review February 3, 2026 04:18

if ( $instructor_answer && $ref_mask_is_url ) {
$ref_bg = '';
if ( ! empty( $instructor_answer->image_id ) ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part of code is duplicate. We can reuse it by moving to to QuizModel with a method

- Refactored the draw image mask functionality by moving the saving logic from Utils to QuizModel for better organization.
- Updated references in Quiz and QuizBuilder classes to utilize the new QuizModel method.
- Improved code clarity by enhancing comments and ensuring consistent handling of base64 and URL inputs.
- Removed deprecated save_quiz_draw_image_mask method from Utils to streamline the codebase.
- Updated the URL validation logic for student and instructor submitted drawing masks to use wp_http_validate_url for enhanced security.
- Ensured consistent handling of URLs across the quiz attempt details view.
- Improved code clarity by maintaining a uniform approach to URL checks.
- Updated the upload_base64_image method to include an optional parameter for adding the uploaded file to the WordPress media library.
- Improved documentation to clarify the behavior of the method when the new parameter is set to false, ensuring it returns an ID of 0.
- Streamlined the image upload process in QuizModel by utilizing the updated method for handling base64 images.
- Added a new filter for processing draw image answers in the Quiz class to allow for custom handling.
- Introduced a method in QuizModel to retrieve the full image URL for quiz answers, improving code reusability and clarity.
- Updated the quiz attempt details view to utilize the new method for fetching image URLs, streamlining the code and enhancing maintainability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0.0 Tutor v4.w0w

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants