20/04/23 - 16h

master
cherif 2023-04-20 15:42:46 +02:00
parent 1b8bec55bc
commit bb7a2b4e05
4 changed files with 1658 additions and 4 deletions

View File

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="15/04/23 - 14h">
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="15/04/23 - 22h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -103,7 +104,14 @@
<option name="project" value="LOCAL" />
<updated>1681566348906</updated>
</task>
<option name="localTasksCounter" value="7" />
<task id="LOCAL-00007" summary="15/04/23 - 22h">
<created>1681588140722</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1681588140722</updated>
</task>
<option name="localTasksCounter" value="8" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -123,6 +131,7 @@
<MESSAGE value="10/04/23 - 17h" />
<MESSAGE value="14/04/23 - 23h" />
<MESSAGE value="15/04/23 - 14h" />
<option name="LAST_COMMIT_MESSAGE" value="15/04/23 - 14h" />
<MESSAGE value="15/04/23 - 22h" />
<option name="LAST_COMMIT_MESSAGE" value="15/04/23 - 22h" />
</component>
</project>

File diff suppressed because one or more lines are too long

View File

@ -2206,4 +2206,54 @@ def LMS_Create_VirtualHost(diction):
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de créer une url (virtualhost) ", False, False
return False, " Impossible de créer une url (virtualhost) ", False, False
"""
Cette fonction retourne les theme du LMS.
Cela permettra à une personne de choisir le theme qu'il souhaite pour son
espace
"""
def Get_Lms_Themes(diction):
try:
"""
Verification de la liste des champs obligatoires
"""
field_list_obligatoire = ['token', ]
for val in field_list_obligatoire:
if val not in diction:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - : La valeur '" + val + "' n'est pas presente dans liste ")
return False, "Impossible de recuperer la liste des themes LMS "
# Recuperation du recid du partner
mytoken = ""
if ("token" in diction.keys()):
if diction['token']:
mytoken = diction['token']
partner_recid = mycommon.get_parnter_recid_from_token(mytoken)
if (partner_recid is False):
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible de recuperer la liste themes LMS (2)")
return False, "Impossible de recuperer la liste themes LMS (2) "
RetObject = []
local_cpt = 0
for ret_val in MYSY_GV.dbname['lms_theme'].find(
{"$or": [{"partner_recid": str(partner_recid), "valide": "1"},
{"partner_recid": 'default', "valide": "1"}]}):
if (ret_val and ret_val['_id']):
RetObject.append(mycommon.JSONEncoder().encode(ret_val))
local_cpt = local_cpt + 1
if (local_cpt == 0):
mycommon.myprint(str(inspect.stack()[0][3]) + " Aucun theme LMS trouvé ")
return False, " Aucun theme LMS trouvé "
return True, RetObject
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de recuperer les themes LMS "

13
main.py
View File

@ -2837,6 +2837,19 @@ def LMS_Create_VirtualHost():
return jsonify(status=localStatus, message=message, virtualHost_Id= virtualHost_Id, full_url=full_url)
"""
API qui permet de recuperer les theme lms pour permettre à l'utilisateur
de configurer le theme qu'il souhaite
"""
@app.route('/myclass/api/Get_Lms_Themes/', methods=['POST','GET'])
@crossdomain(origin='*')
def Get_Lms_Themes():
# On recupere le corps (payload) de la requete
payload = request.form.to_dict()
print(" ### Get_Lms_Themes : payload = ",payload)
localStatus, message = mysy_lms.Get_Lms_Themes(payload)
return jsonify(status=localStatus, message=message)
if __name__ == '__main__':
print(" debut api")