mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
improve compatibility with other ilias instances
Running against a custom Ilias instance files, folders and forms were not detected by the current implementation since the given Ilias instance uses URL paths instead of a target parameter
This commit is contained in:
parent
d512fc24c5
commit
723a82f617
@ -43,6 +43,8 @@ class IliasPageElement:
|
||||
regexes = [
|
||||
r"eid=(?P<id>[0-9a-z\-]+)",
|
||||
r"file_(?P<id>\d+)",
|
||||
r"fold_(?P<id>\d+)",
|
||||
r"frm_(?P<id>\d+)",
|
||||
r"ref_id=(?P<id>\d+)",
|
||||
r"target=[a-z]+_(?P<id>\d+)"
|
||||
]
|
||||
@ -773,6 +775,16 @@ class IliasPage:
|
||||
if "cmdClass=ilobjtestgui" in parsed_url.query:
|
||||
return IliasElementType.TEST
|
||||
|
||||
# other universities might have content type specified in URL path
|
||||
if "_file_" in parsed_url.path:
|
||||
return IliasElementType.FILE
|
||||
|
||||
if "_fold_" in parsed_url.path:
|
||||
return IliasElementType.FOLDER
|
||||
|
||||
if "_frm_" in parsed_url.path:
|
||||
return IliasElementType.FORUM
|
||||
|
||||
# Booking and Meeting can not be detected based on the link. They do have a ref_id though, so
|
||||
# try to guess it from the image.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user