Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Version 1.1.3 #20

Merged
merged 5 commits into from
Jul 25, 2024
Merged

Release Version 1.1.3 #20

merged 5 commits into from
Jul 25, 2024

Conversation

MakinZeel
Copy link
Collaborator

@MakinZeel MakinZeel commented Jul 25, 2024

Changelog release 1.1.3

For Web Service Users
  • The web service function is renamed from block_booksearch_get_searched_locations to block_booksearch_search_course_book_content
  • The web service function block_booksearch_search_course_book_content no longer requires the parameter userid
    • We expect the web service user to check if the third user should have access to the information provided
    • Parameter Snippet:
/**
 * Returns description of method parameter
 * @return external_function_parameters
 */
public static function execute_parameters() {
	return new external_function_parameters(
		[
			'courseid' => new external_value(PARAM_INT, 'Id of the course the user wants to access', VALUE_REQUIRED),
			'searchstring' => new external_value(PARAM_TEXT, 'String to search for in the course', VALUE_REQUIRED),
			'contextlength' => new external_value(PARAM_INT, 'Number of words surrounding the found query word in each direction', VALUE_DEFAULT, 1),
		]
	);
}
  • As the web service may leak course information to non members, we now require the web service user has the capability to share course information with an unknown third user.
    • Therefore the web service user now requires to be a teacher, editing teacher or manager
    • Block usge via the ui still only requires course access
  • The web service function block_booksearch_search_course_book_content return value is no longer a JSON string but the datastructure itself.
    • Return Snippet:
/**
 * Returns description of the method return values.
 * @return external_value
 */
public static function execute_returns() {
	return new external_multiple_structure(
		new external_single_structure([
			'filename' => new external_value(PARAM_TEXT, 'name of the pdf file that has a matching book.'),
			'pagenumber' => new external_value(PARAM_INT, 'page number this searched occurance happens in filename book.'),
			'bookchapterurl' => new external_value(PARAM_RAW, 'url to pagenumber book chapter.'),
			'contextsnippet' => new external_value(PARAM_RAW, 'text snippet around the occurance.'),
		])
	);
}
For Developer
  • Reworked how the search works (amd\src\search_and_display.js and classes\search\search.php)
  • Updated the webservice, no longer in externallib.php, now in classes\external\search_book_content.php (More info in Changelog for Web Service Users)
  • Added styles.css
  • Refactored locallib.php in own classes classes\search\search.php for the content search and classes\data\data.php for the file search and book pdf matching
  • Removed german language file.
  • Now uses ESM module block_booksearch/search_and_display for the ui javascript capabilities instead of plain js in <script>

st143971 added 5 commits July 25, 2024 13:45
For Web Service Users
 - The web service function is renamed from *block_booksearch_get_searched_locations* to *block_booksearch_search_course_book_content*
 - The web service function *block_booksearch_search_course_book_content* no longer requires the parameter userid
	- We expect the web service user to check if the third user should have access to the information provided
	- Parameter Snippet:
		/**
		 * Returns description of method parameter
		 * @return external_function_parameters
		 */
		public static function execute_parameters() {
			return new external_function_parameters(
				[
					'courseid' => new external_value(PARAM_INT, 'Id of the course the user wants to access', VALUE_REQUIRED),
					'searchstring' => new external_value(PARAM_TEXT, 'String to search for in the course', VALUE_REQUIRED),
					'contextlength' => new external_value(PARAM_INT, 'Number of words surrounding the found query word in each direction', VALUE_DEFAULT, 1),
				]
			);
		}
 - As the web service may leak course information to non members, we now require the web service user has the capability to share course information with an unknown third user.
	- Therefore the web service user now requires to be a teacher, editing teacher or manager
	- Block usge via the ui still only requires course access
 - The web service function *block_booksearch_search_course_book_content* return value is no longer a JSON string but the datastructure itself.
	- Return Snippet:
		/**
		 * Returns description of the method return values.
		 * @return external_value
		 */
		public static function execute_returns() {
			return new external_multiple_structure(
				new external_single_structure([
					'filename' => new external_value(PARAM_TEXT, 'name of the pdf file that has a matching book.'),
					'pagenumber' => new external_value(PARAM_INT, 'page number this searched occurance happens in filename book.'),
					'bookchapterurl' => new external_value(PARAM_RAW, 'url to pagenumber book chapter.'),
					'contextsnippet' => new external_value(PARAM_RAW, 'text snippet around the occurance.'),
				])
			);
		}

For Developer
 - Reworked how the search works (*amd\src\search_and_display.js* and *classes\search\search.php*)
 - Updated the webservice, no longer in *externallib.php*, now in *classes\external\search_book_content.php* (More info in *Changelog for Web Service Users*
 - Added *styles.css*
 - Refactored *locallib.php* in own classes *classes\search\search.php* for the content search and *classes\data\data.php* for the file search and book pdf matching
 - Removed german language file.
 - Prepared .js search for ESM Module (*amd\src\search_and_display.js*), BUT it is still in *templates\search_and_display.mustache* via *<script>*
Ui search now works woth esm module instead of with <script>
@MakinZeel MakinZeel merged commit e680689 into main Jul 25, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant