Skip to main content

Module pages

Module pages 

Source

StructsΒ§

CmsPageExercise
CmsPageExerciseSlide
CmsPageExerciseTask
CmsPageUpdate
ContentManagementPage
CourseMaterialPageContentFilterCache πŸ”’
CoursePageWithUserData
ExerciseTaskIdAndSpec πŸ”’
ExerciseWithExerciseTasks
HistoryRestoreData
IsChapterFrontPage
NewCoursePage
NewPage
Represents the subset of page fields that are required to create a new page.
NormalizedCmsExerciseTask
Page
PageAudioFiles
PageChapterAndCourseInformation
PageDetailsUpdate
Represents the subset of page fields that can be updated from the main frontend dialog β€œEdit page details”.
PageInfo
PageInfoSpecial
PageMetadata
PageNavigationInformation
PageRoutingData
PageSearchResult
PageUpdateArgs
PageWithExercises
RawPageSearchResult πŸ”’
SearchContentHeadlineRow πŸ”’
SearchRequest

EnumsΒ§

LockChapterContentState
PageSearchQueryType πŸ”’
PageVisibility

ConstantsΒ§

URL_PATH_ENCODE_SET πŸ”’

FunctionsΒ§

add_course_url_prefix_to_search_results πŸ”’
build_public_search_content_headlines πŸ”’
clean_url_path_segment πŸ”’
Cleans a single path segment (no /): whitespace runs become a single -, unsafe ASCII is dropped, runs of - collapse to one, and leading/trailing - are trimmed.
collect_searchable_text_from_content_value πŸ”’
create_for_course_id
decode_percent_runs πŸ”’
Decode each maximal run of %XX escapes as one UTF-8 unit, dropping a run that isn’t valid UTF-8 (rather than emitting U+FFFD). Non-escape characters pass through. Mirrors the migration’s safe_percent_decode, so storage and lookup agree on inputs like /%FF.
delete_page_and_exercises
extract_searchable_text_from_content_value πŸ”’
fetch_derived_spec πŸ”’
filter_course_material_page
filter_course_material_page_with_cache πŸ”’
filter_course_material_pages
filter_course_material_pages_with_exercises
find_page_by_requested_path πŸ”’
Looks up a non-deleted page in course_id whose stored url_path matches url_path in either the decoded-canonical or the legacy fully-encoded form (see url_path_lookup_candidates). Shared by the page lookup and its tests so both exercise the same candidate-matching logic.
fork_peer_or_self_review_config πŸ”’
Re-keys a custom peer-review config and its questions onto new_exercise_id with a fresh config id and fresh question ids, producing an independent copy for a within-page exercise duplicate so it does not collapse onto the original exercise’s config (#148). All questions must belong to config.
get_all_by_course_id_and_visibility
Gets all pages that belong to the given course that match the visibility filter.
get_by_exam_id
Gets the page that belongs to the given exam. For exams, the page visibility is ignored.
get_by_ids_and_visibility
get_by_ids_deleted_and_visibility
get_chapter_front_page_by_page_id
get_chapter_pages
get_chapters_pages_with_exercises
get_chapters_visible_pages_exclude_main_frontpage
get_course_and_exam_id
get_course_page_with_user_data_from_selected_page
get_course_pages_by_chapter_id_and_visibility
Gets all pages that belong to the given chapter that match the visibility filter.
get_course_top_level_pages_by_course_id_and_visibility
Gets all pages that belong to the given course but not in any chapter.
get_current_page_metadata πŸ”’
get_front_page_by_chapter_id
get_lock_chapter_content_state_for_page πŸ”’
get_next_order_number_for_courses_top_level_pages πŸ”’
get_next_page
get_next_page_by_chapter_number πŸ”’
get_next_page_by_order_number πŸ”’
get_next_page_order_number_in_chapter πŸ”’
get_organization_id
get_page
get_page_by_course_id_and_language_group
get_page_by_stored_path πŸ”’
get_page_chapter_and_course_information
get_page_info
get_page_info_special_for_course
get_page_navigation_data
get_page_search_results πŸ”’
get_page_search_results_for_phrase
Returns search results for a phrase i.e. looks for matches where the words come up right after each other
get_page_search_results_for_words
Returns search results for the given words. The words can appear in the source document in any order.
get_page_with_exercises
get_page_with_user_data_by_path
get_pages_by_course_id
get_previous_page
get_previous_page_by_chapter_number πŸ”’
get_previous_page_by_order_number πŸ”’
insert_course_page
insert_exam_page
insert_new_content_page
insert_page
is_chapter_front_page
is_unsafe_ascii πŸ”’
Whether ch is an ASCII char that URL_PATH_ENCODE_SET would encode. The set’s membership test is crate-private, so probe it via utf8_percent_encode (which encodes an ASCII char iff it’s in the set). ASCII-only: the caller keeps non-ASCII verbatim.
legacy_fully_encoded_url_path πŸ”’
Legacy lookup candidate: the oldest form, with non-ASCII percent-encoded too. Lets pages stored that way still resolve.
legacy_partially_encoded_url_path πŸ”’
Legacy lookup candidate: unsafe ASCII percent-encoded, non-ASCII kept decoded β€” the form used before paths were stored stripped. Lets pages written that way (notably exam pages, which the cleanup migration skips) still resolve.
normalize_url_path_for_storage πŸ”’
Canonical storage/lookup form: decode %xx, then per /-segment turn whitespace into -, strip the unsafe ASCII in URL_PATH_ENCODE_SET, and collapse/trim dashes. Case, non-ASCII and /, -, ., _, ~ are kept. Unsafe chars are removed, not %xx-encoded, so every save funnels through here and paths can’t re-accumulate escapes. Mirrors clean_url_path (page migration) and the frontend cleanUrlPath; keep the three in agreement.
percent_escape_byte_at πŸ”’
The byte a %XX escape at chars[i] decodes to, or None if there isn’t one there.
rekey_peer_or_self_review_questions πŸ”’
Gives questions fresh ids pointing at target_config_id when it differs from source_config_id (i.e. they are being cloned onto a different config); otherwise returns them untouched so the upsert reuses the existing rows.
reorder_chapters
reorder_pages
Makes the order numbers and chapter ids to match in the db what’s in the page objects Assumes that all pages belong to the given course id Also assumes the list of pages includes all nondeleted pages in the course, except chapter front pages, which cannot be moved, otherwise we will end up with random order numbers
restore
Restore page contents and exercises to a previous revision
restore_from_history_for_page_id
sanitized_searchable_text_for_public_page πŸ”’
set_chapter
try_to_find_redirected_page
try_to_find_redirected_page_by_stored_path πŸ”’
update_by_id_in_parent_context
update_page
update_page_content
Only used when testing.
update_page_details
upsert_exercise_slides πŸ”’
Remaps ids from updates to exercise slides that may have their ids changed.
upsert_exercise_tasks πŸ”’
Remaps ids from updates to exercise tasks that may have their ids changed.
upsert_exercises πŸ”’
Remaps ids from updates to exercises that may have their ids regenerated.
upsert_peer_or_self_review_configs
upsert_peer_or_self_review_questions
url_path_lookup_candidates πŸ”’
Stored url_path forms to try for a requested path: the strip-canonical form plus the two legacy encoded forms, deduped (an ASCII-only safe path yields a single candidate).