mirror of https://github.com/acanas/swad-core.git
Version 23.28: Oct 06, 2023 New file swad_constant.c.
This commit is contained in:
parent
450f429c32
commit
e774a9c18e
8
Makefile
8
Makefile
|
@ -38,10 +38,10 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_action_list.o \
|
|||
swad_calendar.o swad_call_for_exam.o swad_call_for_exam_resource.o \
|
||||
swad_call_for_exam_database.o swad_center.o swad_center_config.o \
|
||||
swad_center_database.o swad_chat.o swad_chat_database.o swad_config.o \
|
||||
swad_connected.o swad_connected_database.o swad_cookie.o \
|
||||
swad_cookie_database.o swad_country.o swad_country_config.o \
|
||||
swad_country_database.o swad_course.o swad_course_config.o \
|
||||
swad_course_database.o swad_cryptography.o \
|
||||
swad_connected.o swad_connected_database.o swad_constant.o \
|
||||
swad_cookie.o swad_cookie_database.o swad_country.o \
|
||||
swad_country_config.o swad_country_database.o swad_course.o \
|
||||
swad_course_config.o swad_course_database.o swad_cryptography.o \
|
||||
swad_database.o swad_date.o swad_degree.o swad_degree_config.o \
|
||||
swad_degree_database.o swad_degree_type.o swad_department.o \
|
||||
swad_department_database.o swad_duplicate.o swad_duplicate_database.o \
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
{
|
||||
color:#A0A0A0;
|
||||
}
|
||||
.obsolete
|
||||
{
|
||||
color:#660000;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
|
@ -53,7 +57,7 @@
|
|||
<a href="http://creativecommons.org/licenses/by-sa/3.0/deed.es_ES"
|
||||
title="License of text on this page" class="COPYRIGHT"><img src="/img/cc-by-sa.png"
|
||||
style="width:88px; height=31px; vertical-align:middle;" alt="CC BY-SA" /></a>
|
||||
<a href="https://openswad.org/en?usr=@acanas" target="_blank">Antonio Cañas Vargas</a>, 1999-2018
|
||||
<a href="https://openswad.org/en?usr=@acanas" target="_blank">Antonio Cañas Vargas</a>, 1999-2021
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -62,7 +66,7 @@
|
|||
|
||||
<h2>Plugins</h2>
|
||||
|
||||
<p align="justify">
|
||||
<p style="text-align:justify">
|
||||
It is possible to develop plugins for <a href="http://openswad.org/">SWAD</a>.
|
||||
In this context, a <a href="http://en.wikipedia.org/wiki/Plug-in_(computing)">plugin</a>
|
||||
is a program external to SWAD,
|
||||
|
@ -72,7 +76,7 @@
|
|||
and other plugins are under development.
|
||||
</p>
|
||||
|
||||
<p align="justify">
|
||||
<p style="text-align:justify">
|
||||
SWAD has a form that allows administrators to add new plugins
|
||||
or edit the existing plugins.
|
||||
Each plugin is specified by the following elements:
|
||||
|
@ -89,7 +93,7 @@
|
|||
|
||||
<h2>Web service</h2>
|
||||
|
||||
<p align="justify">
|
||||
<p style="text-align:justify">
|
||||
The plugins interact with the program SWAD
|
||||
through a web service with several operations or functions.
|
||||
A <a href="http://en.wikipedia.org/wiki/Web_service">web service</a>
|
||||
|
@ -99,7 +103,7 @@
|
|||
and the plugin is the client that request one or several functions from the web service.
|
||||
</p>
|
||||
|
||||
<p align="justify">
|
||||
<p style="text-align:justify">
|
||||
There are two possible ways to access to a SWAD plugin:
|
||||
</p>
|
||||
<ul>
|
||||
|
@ -124,8 +128,8 @@
|
|||
|
||||
<h2>SOAP</h2>
|
||||
|
||||
<p align="justify">
|
||||
The exchange of informationn between the SWAD web service (server) and a plugin (client)
|
||||
<p style="text-align:justify">
|
||||
The exchange of information between the SWAD web service (server) and a plugin (client)
|
||||
is performed through <a href="http://en.wikipedia.org/wiki/XML">XML (Extensible Markup Language)</a> messages
|
||||
using the protocol <a href="http://en.wikipedia.org/wiki/SOAP">SOAP (Simple Object Access Protocol)</a>.
|
||||
The client sends a SOAP message to the server
|
||||
|
@ -134,7 +138,7 @@
|
|||
with the resulting data (users, courses, etc.).
|
||||
</p>
|
||||
|
||||
<p align="justify">
|
||||
<p style="text-align:justify">
|
||||
The main core of SWAD, <a href="/source/">written in C</a>,
|
||||
uses the tool <a href="http://www.cs.fsu.edu/~engelen/soap.html">gSOAP</a>
|
||||
to implement the SOAP server protocol.
|
||||
|
@ -144,7 +148,7 @@
|
|||
|
||||
<h2>WSDL</h2>
|
||||
|
||||
<p align="justify">
|
||||
<p style="text-align:justify">
|
||||
The interface of a web service is given in a format automatically processable written in
|
||||
<a href="http://en.wikipedia.org/wiki/Web_Services_Description_Language">WSDL (Web Services Description Language)</a>.
|
||||
The SWAD server provides to the clientes several operations or functions indicated
|
||||
|
@ -152,11 +156,11 @@
|
|||
</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://openswad.org/api/swad.wsdl">http://openswad.org/api/swad.wsdl</a></li>
|
||||
<li><a href="http://swad.ugr.es/ws/swad.wsdl">http://swad.ugr.es/ws/swad.wsdl</a></li>
|
||||
<li><a href="https://openswad.org/api/swad.wsdl">https://openswad.org/api/swad.wsdl</a></li>
|
||||
<li><a href="https://swad.ugr.es/api/swad.wsdl">https://swad.ugr.es/api/swad.wsdl</a></li>
|
||||
</ul>
|
||||
|
||||
<p align="justify">
|
||||
<p style="text-align:justify">
|
||||
At the end of the WSDL file you can find the URL to call the SWAD web service.
|
||||
The CGI executed as answer detects that a call to the web service (and not a normal web request) is performed
|
||||
if the variable <code>CONTENT_TYPE</code> is set to <code>text/xml</code>.
|
||||
|
@ -165,13 +169,14 @@
|
|||
|
||||
<h2>SWAD API (Application Programming Interface): functions provided by SWAD web service</h2>
|
||||
|
||||
<p align="justify">
|
||||
<p style="text-align:justify">
|
||||
The SWAD web service provides the following functions:
|
||||
</p>
|
||||
<ul>
|
||||
<li><a href="#createAccount"><code>createAccount</code></a></li>
|
||||
<li><a href="#loginByUserPasswordKey"><code>loginByUserPasswordKey</code></a></li>
|
||||
<li><a href="#loginBySessionKey"><code>loginBySessionKey</code></a></li>
|
||||
<li><a href="#getAvailableRoles"><code>getAvailableRoles</code></a></li>
|
||||
<li style="margin-bottom:1em;"><a href="#getNewPassword"><code>getNewPassword</code></a></li>
|
||||
|
||||
<li><a href="#getCourses"><code>getCourses</code></a></li>
|
||||
|
@ -189,6 +194,12 @@
|
|||
<li><a href="#getTests"><code>getTests</code></a></li>
|
||||
<li style="margin-bottom:1em;"><a href="#getTrivialQuestion"><code>getTrivialQuestion</code></a></li>
|
||||
|
||||
<li><a href="#getGames"><code>getGames</code></a></li>
|
||||
<li><a href="#getMatches"><code>getMatches</code></a></li>
|
||||
<!-- <li><a href="#playMatch"><code>playMatch</code></a></li> -->
|
||||
<li><a href="#getMatchStatus"><code>getMatchStatus</code></a></li>
|
||||
<li style="margin-bottom:1em;"><a href="#answerMatchQuestion"><code>answerMatchQuestion</code></a></li>
|
||||
|
||||
<li><a href="#getUsers"><code>getUsers</code></a></li>
|
||||
<li style="margin-bottom:1em;"><a href="#findUsers"><code>findUsers</code></a></li>
|
||||
|
||||
|
@ -202,13 +213,17 @@
|
|||
<li style="margin-bottom:1em;"><a href="#markNotificationsAsRead"><code>markNotificationsAsRead</code></a></li>
|
||||
|
||||
<li><a href="#sendNotice"><code>sendNotice</code></a></li>
|
||||
<li style="margin-bottom:1em;"><a href="#sendMessage"><code>sendMessage</code></a></li>
|
||||
<li style="margin-bottom:1em;"><a href="#sendMessage"><code>sendMessage</code></a></li>
|
||||
|
||||
<li><a href="#getLocation"><code>getLocation</code></a></li>
|
||||
<li><a href="#sendMyLocation"><code>sendMyLocation</code></a></li>
|
||||
<li><a href="#getLastLocation"><code>getLastLocation</code></a></li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="createAccount"><h3 class="WS_FUNCTION"><code>createAccount</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="createAccount">createAccount</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Create a new user account.
|
||||
</p>
|
||||
<ul>
|
||||
|
@ -216,7 +231,6 @@
|
|||
<ul>
|
||||
<li><strong>userNickname</strong>: string starting by @ (@nickname of the user).</li>
|
||||
<li><strong>userEmail</strong>: string (email of the user).</li>
|
||||
<!-- <li><strong>userID</strong>: string (DNI/passport of the user).</li> -->
|
||||
<li><strong>userPassword</strong>: string, plain password.</li>
|
||||
<li><strong>appKey</strong>: string, key used by the application.</li>
|
||||
</ul>
|
||||
|
@ -231,7 +245,7 @@
|
|||
<li>-2 → nickname registered by another user</li>
|
||||
<li>-3 → e-mail not valid</li>
|
||||
<li>-4 → e-mail registered by another user</li>
|
||||
<li>-5 → password not valid (too short, too trivial...)</li>
|
||||
<li>-5 → password not valid (too short, too trivial…)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>If > 0, the account has been successfully created
|
||||
|
@ -244,8 +258,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="loginByUserPasswordKey"><h3 class="WS_FUNCTION"><code>loginByUserPasswordKey</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="loginByUserPasswordKey">loginByUserPasswordKey</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns data of the user, given an identifier of the user (DNI/passport, @nickname or email),
|
||||
a password and an application key.
|
||||
</p>
|
||||
|
@ -288,8 +302,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="loginBySessionKey"><h3 class="WS_FUNCTION"><code>loginBySessionKey</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="loginBySessionKey">loginBySessionKey</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns data of the user and course of a session,
|
||||
given an identifier of session passed to the plugin from SWAD.
|
||||
</p>
|
||||
|
@ -332,9 +346,44 @@
|
|||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3 class="WS_FUNCTION"><code><a name="getAvailableRoles">getAvailableRoles</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Get available roles in a course.
|
||||
</p>
|
||||
<ul>
|
||||
<li>Call parameters:
|
||||
<ul>
|
||||
<li><strong>wsKey</strong>: string, identifier returned by
|
||||
<a href="#loginByUserPasswordKey"><code>loginByUserPasswordKey</code></a> or
|
||||
<a href="#loginBySessionKey"><code>loginBySessionKey</code></a>.</li>
|
||||
<li><strong>courseCode</strong>: integer.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>roles</strong>: integer, with bits set (bit <em>i</em> = 1) on available roles, or clear (bit <em>i</em> = 0) in unavailable roles:
|
||||
<ul>
|
||||
<li><var>bit 0</var>: Unknown: User not logged in</li>
|
||||
<li><var>bit 1</var>: Guest: User not belonging to any course</li>
|
||||
<li><var>bit 2</var>: User: Student or teacher outside of her/his courses</li>
|
||||
|
||||
<li><var>bit 3</var>: Student: Student in the selected course</li>
|
||||
<li><var>bit 4</var>: Non-editing teacher: Teacher in the selected course without permission to edit</li>
|
||||
<li><var>bit 5</var>: Teacher: Teacher in the selected course with permission to edit</li>
|
||||
|
||||
<li><var>bit 6</var>: Degree admin: Administrator of the degree to which the selected course belongs</li>
|
||||
<li><var>bit 7</var>: Center admin: Administrator of the center to which the selected course belongs</li>
|
||||
<li><var>bit 8</var>: Institution admin: Administrator of the institution to which the selected course belongs</li>
|
||||
<li><var>bit 9</var>: System admin: System administrator (also known as superuser)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="getNewPassword"><h3 class="WS_FUNCTION"><code>getNewPassword</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getNewPassword">getNewPassword</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Sends a new password by e-mail.
|
||||
</p>
|
||||
<ul>
|
||||
|
@ -346,17 +395,18 @@
|
|||
</li>
|
||||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>success</strong>: integer. For compatibility with other functions,
|
||||
this function returns a number > 0 (currently 1) on success,
|
||||
and a number <= 0 (currently 0) on error.</li>
|
||||
<li><strong>success</strong>: integer.
|
||||
If 0 ⇒ error (for example, if the event does not exist).
|
||||
If not 0 ⇒ success.
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="getCourses"><h3 class="WS_FUNCTION"><code>getCourses</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getCourses">getCourses</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns the list of courses to which the user belongs.
|
||||
</p>
|
||||
<ul>
|
||||
|
@ -390,8 +440,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="getCourseInfo"><h3 class="WS_FUNCTION"><code>getCourseInfo</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getCourseInfo">getCourseInfo</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns information about the course.
|
||||
</p>
|
||||
<ul>
|
||||
|
@ -439,8 +489,8 @@
|
|||
|
||||
<hr />
|
||||
|
||||
<a name="getGroupTypes"><h3 class="WS_FUNCTION"><code>getGroupTypes</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getGroupTypes">getGroupTypes</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns the list of types of group of a course.
|
||||
Before consulting the list of types of group,
|
||||
this function opens automatically
|
||||
|
@ -484,8 +534,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="getGroups"><h3 class="WS_FUNCTION"><code>getGroups</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getGroups">getGroups</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns the list of all the groups of a course.
|
||||
Before consulting the list of types of group,
|
||||
this function opens automatically
|
||||
|
@ -525,8 +575,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="sendMyGroups"><h3 class="WS_FUNCTION"><code>sendMyGroups</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="sendMyGroups">sendMyGroups</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
It sends to the server a list with all the groups in a course
|
||||
to which the requester wants to belong.
|
||||
It tries to enrol the user in those groups if possible,
|
||||
|
@ -551,10 +601,10 @@
|
|||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>success</strong>: integer.
|
||||
If 0 ⇒ it was impossible to satisfy all the requested changes,
|
||||
no change performed.
|
||||
If not 0 ⇒ all the requested changes
|
||||
have been performed with success.
|
||||
If 0 ⇒ error (it was impossible to satisfy all the requested changes,
|
||||
no change performed).
|
||||
If not 0 ⇒ success (all the requested changes
|
||||
have been performed).
|
||||
</li>
|
||||
<li><strong>numGroups</strong>: integer, number of groups.</li>
|
||||
<li><strong>groupsArray</strong>: list of elements,
|
||||
|
@ -567,8 +617,8 @@
|
|||
|
||||
<hr />
|
||||
|
||||
<a name="getDirectoryTree"><h3 class="WS_FUNCTION"><code>getDirectoryTree</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getDirectoryTree">getDirectoryTree</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns the full tree of a file zone (documents, shared files or marks) in a course or a group.
|
||||
The requester must belong to the course or the group.
|
||||
</p>
|
||||
|
@ -653,8 +703,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="getFile"><h3 class="WS_FUNCTION"><code>getFile</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getFile">getFile</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
This function must be called each time the user wants to download a file
|
||||
from a documents zone or a shared files zone in a course or a group.
|
||||
The requester must belong to the course or group.
|
||||
|
@ -709,8 +759,8 @@
|
|||
</ul>
|
||||
|
||||
|
||||
<a name="getMarks"><h3 class="WS_FUNCTION"><code>getMarks</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getMarks">getMarks</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns information about the marks (qualifications, scores) of the requester
|
||||
from a given HTML file of marks.
|
||||
This function is allowed <strong>only for students</strong>.
|
||||
|
@ -751,8 +801,8 @@
|
|||
|
||||
<hr />
|
||||
|
||||
<a name="getTestConfig"><h3 class="WS_FUNCTION"><code>getTestConfig</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getTestConfig">getTestConfig</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns the configuration of the tests of a course.
|
||||
</p>
|
||||
<ul>
|
||||
|
@ -777,7 +827,7 @@
|
|||
<li><strong>minQuestions</strong>: integer, minimum number of questions in an exam.</li>
|
||||
<li><strong>defQuestions</strong>: integer, default number of questions in an exam.</li>
|
||||
<li><strong>maxQuestions</strong>: integer, maximum number of questions in an exam.</li>
|
||||
<li><strong>feedback</strong>: string with the type of feedback for the user,
|
||||
<li class="obsolete"><strong>feedback</strong> (obsolete, to be removed in 2021): string with the type of feedback for the user,
|
||||
with one of the following 5 values:
|
||||
<ul>
|
||||
<li><var>nothing</var>: no feedback.</li>
|
||||
|
@ -787,12 +837,21 @@
|
|||
<li><var>fullFeedback</var>: maximum feedback: text of feedback.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>visibility</strong>: integer, with the following meaning for each bit:
|
||||
<ul>
|
||||
<li>Bit 0 = 1 ⇒ the questions and answers texts are visible in test results.</li>
|
||||
<li>Bit 1 = 1 ⇒ the feedback texts are visible in test results.</li>
|
||||
<li>Bit 2 = 1 ⇒ which are the correct answers is visible in test results.</li>
|
||||
<li>Bit 3 = 1 ⇒ the score of each question is visible in test results.</li>
|
||||
<li>Bit 4 = 1 ⇒ the total score of an exam is visible in test results.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="getTests"><h3 class="WS_FUNCTION"><code>getTests</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getTests">getTests</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns the self-assessment tests of a course.
|
||||
This function should not be callled if the download of tests is not allowed in this course
|
||||
(if the function <a href="#getTestConfig"><code>getTestConfig</code></a> returns pluggable = 0).
|
||||
|
@ -816,7 +875,7 @@
|
|||
</li>
|
||||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>tags</strong>: list of all the tags not hidden,
|
||||
<li><strong>tagsArray</strong>: list of all the tags not hidden,
|
||||
without having into account beginTime,
|
||||
where each tag is a data structure with the following fields:
|
||||
<ul>
|
||||
|
@ -825,7 +884,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
|
||||
<li><strong>questions</strong>: list of questions with an edition/change time later than or equal to beginTime,
|
||||
<li><strong>questionsArray</strong>: list of questions with an edition/change time later than or equal to beginTime,
|
||||
where each question is a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>questionCode</strong>: integer, unique identifier for the question.</li>
|
||||
|
@ -845,11 +904,11 @@
|
|||
</ul>
|
||||
</li>
|
||||
|
||||
<li><strong>answers</strong>: list of answers of the returned questions,
|
||||
<li><strong>answersArray</strong>: list of answers of the returned questions,
|
||||
where each answer is a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>questionCode</strong>: integer.</li>
|
||||
<li><strong>answerIndex</strong>: integer, index or position (0, 1, 2,...) of the answer inside the question.</li>
|
||||
<li><strong>answerIndex</strong>: integer, index or position (0, 1, 2…) of the answer inside the question.</li>
|
||||
<li><strong>correct</strong>: integer. If not 0 ⇒ the answer is correct.</li>
|
||||
<li><strong>answerText</strong>: string with the text of the answer.</li>
|
||||
<li><strong>answerFeedback</strong>: string with the feedback for this answer
|
||||
|
@ -857,19 +916,19 @@
|
|||
</ul>
|
||||
</li>
|
||||
|
||||
<li><strong>questionTags</strong>: list of tags of the returned questions:
|
||||
<li><strong>questionTagsArray</strong>: list of tags of the returned questions:
|
||||
<ul>
|
||||
<li><strong>questionCode</strong>: integer.</li>
|
||||
<li><strong>tagCode</strong>: integer.</li>
|
||||
<li><strong>tagIndex</strong>: integer, index or position (0, 1, 2,...) of the tag inside the question.</li>
|
||||
<li><strong>tagIndex</strong>: integer, index or position (0, 1, 2…) of the tag inside the question.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="getTrivialQuestion"><h3 class="WS_FUNCTION"><code>getTrivialQuestion</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getTrivialQuestion">getTrivialQuestion</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns a random test question, selected from the "uniqueChoice" questions
|
||||
in the courses of a given list of degrees,
|
||||
and with a score in the interval [<code>lowerScore</code>, <code>upperScore</code>].
|
||||
|
@ -899,10 +958,10 @@
|
|||
<li><strong>feedback</strong>: string with the feedback of the question.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>answers</strong>: list of answers of the returned question, where each answer is a data structure with the following fields:
|
||||
<li><strong>answersArray</strong>: list of answers of the returned question, where each answer is a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>questionCode</strong>: integer.</li>
|
||||
<li><strong>answerIndex</strong>: integer, index or position (0, 1, 2,...) of the answer inside the question.</li>
|
||||
<li><strong>answerIndex</strong>: integer, index or position (0, 1, 2%ellip;) of the answer inside the question.</li>
|
||||
<li><strong>correct</strong>: integer. If not 0 ⇒ the answer is correct.</li>
|
||||
<li><strong>answerText</strong>: string with the text of the answer.</li>
|
||||
<li><strong>answerFeedback</strong>: string with the feedback for this answer.
|
||||
|
@ -914,8 +973,215 @@
|
|||
|
||||
<hr />
|
||||
|
||||
<a name="getUsers"><h3 class="WS_FUNCTION"><code>getUsers</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getGames">getGames</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns the list of visible (not hidden) games in a given course.
|
||||
</p>
|
||||
<ul>
|
||||
<li>Call parameters:
|
||||
<ul>
|
||||
<li><strong>wsKey</strong>: string, identifier returned by
|
||||
<a href="#loginByUserPasswordKey"><code>loginByUserPasswordKey</code></a> or
|
||||
<a href="#loginBySessionKey"><code>loginBySessionKey</code></a>.</li>
|
||||
<li><strong>courseCode</strong>: integer.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>numGames</strong>: integer, number of games.</li>
|
||||
<li><strong>gamesArray</strong>: list of elements,
|
||||
where each element is a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>gameCode</strong>: integer, unique identifier for each game.</li>
|
||||
<li><strong>userSurname1</strong>: string.</li>
|
||||
<li><strong>userSurname2</strong>: string.</li>
|
||||
<li><strong>userFirstname</strong>: string.</li>
|
||||
<li><strong>userPhoto</strong>: string
|
||||
with the full URL of a JPG image
|
||||
of size 150 (width) × 200 (height).
|
||||
If it is a string empty, the user
|
||||
has no photo or it can not be shown.</li>
|
||||
<li><strong>startTime</strong>: integer of 32 bits with sign, <a href="http://en.wikipedia.org/wiki/Unix_time">Unix time</a>.</li>
|
||||
<li><strong>endTime</strong>: integer of 32 bits with sign, <a href="http://en.wikipedia.org/wiki/Unix_time">Unix time</a>.</li>
|
||||
<li><strong>title</strong>: string.</li>
|
||||
<li><strong>text</strong>: string.</li>
|
||||
<li><strong>numQuestions</strong>: integer, number of questions in game.</li>
|
||||
<li><strong>maxGrade</strong>: float ≥ 0, maximum grade in game.</li>
|
||||
<li><strong>visibility</strong>: integer, with the following meaning for each bit:
|
||||
<ul>
|
||||
<li>Bit 0 = 1 ⇒ the questions and answers texts are visible in match results.</li>
|
||||
<li>Bit 1 = 1 ⇒ the feedback texts are visible in match results.</li>
|
||||
<li>Bit 2 = 1 ⇒ which are the correct answers is visible in match results.</li>
|
||||
<li>Bit 3 = 1 ⇒ the score of each question is visible in match results.</li>
|
||||
<li>Bit 4 = 1 ⇒ the total score of the match is visible in match results.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3 class="WS_FUNCTION"><code><a name="getMatches">getMatches</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns the list of matches in a given game,
|
||||
associated to the whole course or to the groups to which the requester belongs.
|
||||
</p>
|
||||
<ul>
|
||||
<li>Call parameters:
|
||||
<ul>
|
||||
<li><strong>wsKey</strong>: string, identifier returned by
|
||||
<a href="#loginByUserPasswordKey"><code>loginByUserPasswordKey</code></a> or
|
||||
<a href="#loginBySessionKey"><code>loginBySessionKey</code></a>.</li>
|
||||
<li><strong>courseCode</strong>: integer.</li>
|
||||
<li><strong>gameCode</strong>: integer, identifier of the game.
|
||||
The code must be a valid value > 0 corresponding to an existing game
|
||||
returned by <a href="#getGames"><code>getGames</code></a>.
|
||||
The requester must be a student in the course.
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>numMatches</strong>: integer, number of matches.</li>
|
||||
<li><strong>matchesArray</strong>: list of elements,
|
||||
where each element is a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>matchCode</strong>: integer, unique identifier for each match.</li>
|
||||
<li><strong>userSurname1</strong>: string.</li>
|
||||
<li><strong>userSurname2</strong>: string.</li>
|
||||
<li><strong>userFirstname</strong>: string.</li>
|
||||
<li><strong>userPhoto</strong>: string
|
||||
with the full URL of a JPG image
|
||||
of size 150 (width) × 200 (height).
|
||||
If it is a string empty, the user
|
||||
has no photo or it can not be shown.</li>
|
||||
<li><strong>startTime</strong>: integer of 32 bits with sign, <a href="http://en.wikipedia.org/wiki/Unix_time">Unix time</a>.</li>
|
||||
<li><strong>endTime</strong>: integer of 32 bits with sign, <a href="http://en.wikipedia.org/wiki/Unix_time">Unix time</a>.</li>
|
||||
<li><strong>title</strong>: string.</li>
|
||||
<li><strong>questionIndex</strong>: integer.</li>
|
||||
<li><strong>groups</strong>: string.
|
||||
List of codes of groups (each code is an integer number)
|
||||
to which this match is applicable.
|
||||
If this list of group codes is empty ⇒
|
||||
this match is applicable to the whole course.
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3 class="WS_FUNCTION"><code><a name="getMatchStatus">getMatchStatus</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Get match status to be refreshed in student's screen.
|
||||
This function should be called:
|
||||
<ul>
|
||||
<li>from time to time (e.g. 3 seconds)</li>
|
||||
<li>just after calling <a href="#answerMatchQuestion"><code>answerMatchQuestion</code></a></li>
|
||||
</ul>
|
||||
and the screen should be refreshed according to the status returned.
|
||||
|
||||
</p>
|
||||
<ul>
|
||||
<li>Call parameters:
|
||||
<ul>
|
||||
<li><strong>wsKey</strong>: string, identifier returned by
|
||||
<a href="#loginByUserPasswordKey"><code>loginByUserPasswordKey</code></a> or
|
||||
<a href="#loginBySessionKey"><code>loginBySessionKey</code></a>.</li>
|
||||
<li><strong>courseCode</strong>: integer.</li>
|
||||
<li><strong>gameCode</strong>: integer, identifier of the game.
|
||||
The code must be a valid value > 0 corresponding to an existing game
|
||||
returned by <a href="#getGames"><code>getGames</code></a>.
|
||||
The requester must be a student in the course.
|
||||
</li>
|
||||
<li><strong>matchCode</strong>: integer, identifier of the match.
|
||||
The code must be a valid value > 0 corresponding to an existing match
|
||||
returned by <a href="#getMatches"><code>getMatches</code></a>.
|
||||
The requester must be a student in the course, and belong to the groups,
|
||||
to which this match is associated.
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>matchCode</strong>: integer, unique identifier of the match.
|
||||
<ul>
|
||||
<li>If > 0, the teacher's screen is showing the answers and the student has permission to answer.
|
||||
The caller may draw buttons for the options and call
|
||||
<a href="#answerMatchQuestion"><code>answerMatchQuestion</code></a>
|
||||
if the student either chooses an option or chooses to remove his/her answer.
|
||||
</li>
|
||||
<li>If = 0, the match is in a status where the student can not answer
|
||||
(the match has not started, or has finished, or is in pause, or is showing results).</li>
|
||||
<li>If < 0, an error has happened, the requester can not join the match.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>questionIndex</strong>: integer
|
||||
<ul>
|
||||
<li>0 ⇒ before first question, the match has not started</li>
|
||||
<li>1, 2, 3… ⇒ index of current question</li>
|
||||
<li>big number (currently 2<sup>31</sup> - 1 = 2147483647) ⇒ after last question, the match has finished</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>numAnswers</strong>: integer, number of options (a, b, c…) in question (only when questionIndex is 1, 2, 3…)</li>
|
||||
<li><strong>answerIndex</strong>: integer
|
||||
<ul>
|
||||
<li>If < 0 ⇒ no answer selected.</li>
|
||||
<li>If ≥ 0 ⇒ index (0, 1, 2…) of the answer selected (only when questionIndex is 1, 2, 3…).</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3 class="WS_FUNCTION"><code><a name="answerMatchQuestion">answerMatchQuestion</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Send an answer to the current question in a match.
|
||||
The requester should call this function only if <a href="#getMatchStatus"><code>getMatchStatus</code></a>
|
||||
has returned matchCode > 0.
|
||||
After calling this function, the requester should call
|
||||
<a href="#getMatchStatus"><code>getMatchStatus</code></a>
|
||||
again in order to get the current status of the match before refreshing the screen.
|
||||
</p>
|
||||
<ul>
|
||||
<li>Call parameters:
|
||||
<ul>
|
||||
<li><strong>wsKey</strong>: string, identifier returned by
|
||||
<a href="#loginByUserPasswordKey"><code>loginByUserPasswordKey</code></a> or
|
||||
<a href="#loginBySessionKey"><code>loginBySessionKey</code></a>.</li>
|
||||
<li><strong>courseCode</strong>: integer.</li>
|
||||
<li><strong>gameCode</strong>: integer, identifier of the game.
|
||||
The code must be a valid value > 0 corresponding to an existing game
|
||||
returned by <a href="#getGames"><code>getGames</code></a>.
|
||||
The requester must be a student in the course.
|
||||
</li>
|
||||
<li><strong>matchCode</strong>: integer, identifier of the match.</li>
|
||||
<li><strong>questionIndex</strong>: integer, index of question (1, 2, 3…).</li>
|
||||
<li><strong>answerIndex</strong>: integer.
|
||||
<ul>
|
||||
<li>If < 0 ⇒ no answer selected.</li>
|
||||
<li>If ≥ 0 ⇒ index (0, 1, 2…) of the answer selected.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>matchCode</strong>: integer, unique identifier of the match.
|
||||
<ul>
|
||||
<li>> 0 on success.</li>
|
||||
<li>≤ 0 on error.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
|
||||
<h3 class="WS_FUNCTION"><code><a name="getUsers">getUsers</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns the list of users with a given role (students or teachers)
|
||||
enroled in a course (and optionally in some groups of the course).
|
||||
</p>
|
||||
|
@ -965,8 +1231,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="findUsers"><h3 class="WS_FUNCTION"><code>findUsers</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="findUsers">findUsers</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns a list of users whose full name contains the words given in filter.
|
||||
</p>
|
||||
<ul>
|
||||
|
@ -1037,8 +1303,8 @@
|
|||
|
||||
<hr />
|
||||
|
||||
<a name="getAttendanceEvents"><h3 class="WS_FUNCTION"><code>getAttendanceEvents</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getAttendanceEvents">getAttendanceEvents</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns the list of the attendance events in a course available for the requester
|
||||
(associated to the whole course or to the groups to which the requester belongs).
|
||||
</p>
|
||||
|
@ -1084,8 +1350,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="sendAttendanceEvent"><h3 class="WS_FUNCTION"><code>sendAttendanceEvent</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="sendAttendanceEvent">sendAttendanceEvent</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Sends an attendance event.
|
||||
</p>
|
||||
<ul>
|
||||
|
@ -1123,14 +1389,18 @@
|
|||
</li>
|
||||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>attendanceEventCode</strong>: integer, unique identifier of the attendance event, > 0 on success.
|
||||
On error, this code will be <= 0.</li>
|
||||
<li><strong>attendanceEventCode</strong>: integer, unique identifier of the attendance event.
|
||||
<ul>
|
||||
<li>> 0 on success.</li>
|
||||
<li>≤ 0 on error.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="removeAttendanceEvent"><h3 class="WS_FUNCTION"><code>removeAttendanceEvent</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="removeAttendanceEvent">removeAttendanceEvent</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Removes an existing attendance event.
|
||||
</p>
|
||||
<ul>
|
||||
|
@ -1148,14 +1418,18 @@
|
|||
</li>
|
||||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>attendanceEventCode</strong>: integer, unique identifier of the attendance event, > 0 on success.
|
||||
On error, this code will be <= 0.</li>
|
||||
<li><strong>attendanceEventCode</strong>: integer, unique identifier of the attendance event.
|
||||
<ul>
|
||||
<li>> 0 on success.</li>
|
||||
<li>≤ 0 on error.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="getAttendanceUsers"><h3 class="WS_FUNCTION"><code>getAttendanceUsers</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getAttendanceUsers">getAttendanceUsers</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns the list of users (students) in an attendance event.
|
||||
</p>
|
||||
<ul>
|
||||
|
@ -1197,8 +1471,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="sendAttendanceUsers"><h3 class="WS_FUNCTION"><code>sendAttendanceUsers</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="sendAttendanceUsers">sendAttendanceUsers</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Send the list of users (students)
|
||||
who have attended to an attendance event.
|
||||
All users in this list will be marked as present;
|
||||
|
@ -1237,7 +1511,10 @@
|
|||
</li>
|
||||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>success</strong>: integer. 1 on success, 0 on error (for example, if the event does not exist).</li>
|
||||
<li><strong>success</strong>: integer.
|
||||
If 0 ⇒ error (for example, if the event does not exist).
|
||||
If not 0 ⇒ success.
|
||||
</li>
|
||||
<li><strong>numUsers</strong>: integer, number of users found in list and marked as present in the event.
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -1246,8 +1523,8 @@
|
|||
|
||||
<hr />
|
||||
|
||||
<a name="getNotifications"><h3 class="WS_FUNCTION"><code>getNotifications</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="getNotifications">getNotifications</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns the list of recent notifications for the requester.
|
||||
</p>
|
||||
<ul>
|
||||
|
@ -1371,8 +1648,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="markNotificationsAsRead"><h3 class="WS_FUNCTION"><code>markNotificationsAsRead</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="markNotificationsAsRead">markNotificationsAsRead</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
It marks several notifications as read.
|
||||
You should call this function when one or more notifications have been open / read by the user.
|
||||
</p>
|
||||
|
@ -1400,8 +1677,8 @@
|
|||
|
||||
<hr />
|
||||
|
||||
<a name="sendNotice"><h3 class="WS_FUNCTION"><code>sendNotice</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="sendNotice">sendNotice</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Sends a public notice (yellow note) to a course.
|
||||
The requester must be a teacher in the course.
|
||||
</p>
|
||||
|
@ -1423,8 +1700,8 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<a name="sendMessage"><h3 class="WS_FUNCTION"><code>sendMessage</code></h3></a>
|
||||
<p align="justify">
|
||||
<h3 class="WS_FUNCTION"><code><a name="sendMessage">sendMessage</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
It sends a message to one or more users.
|
||||
</p>
|
||||
<ul>
|
||||
|
@ -1482,6 +1759,122 @@
|
|||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
|
||||
<h3 class="WS_FUNCTION"><code><a name="getLocation">getLocation</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns a location (institution, center, building and room)
|
||||
for Wi-Fi-based positioning system given a MAC address.
|
||||
</p>
|
||||
<p style="text-align:justify">
|
||||
In order to fill the database that stores the MAC-location pairs,
|
||||
the client can call function <a href="#getAvailableRoles"><code>getAvailableRoles</code></a>
|
||||
to check if the logged user is allowed to see the MAC address of the nearest Wi-Fi access point.
|
||||
Only center, institution and system admins should be allowed to see it.
|
||||
</p>
|
||||
<ul>
|
||||
<li>Call parameters:
|
||||
<ul>
|
||||
<li><strong>wsKey</strong>: string, identifier returned by
|
||||
<a href="#loginByUserPasswordKey"><code>loginByUserPasswordKey</code></a> or
|
||||
<a href="#loginBySessionKey"><code>loginBySessionKey</code></a>.</li>
|
||||
<li><strong>MAC</strong>: string in <em>XXXXXXXXXXXX</em> format (12 hexadecimal digits)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>location</strong>: a data structure, corresponding to a location, with the following fields:
|
||||
<ul>
|
||||
<li><strong>institutionCode</strong>: integer, unique identifier of the institution.</li>
|
||||
<li><strong>institutionShortName</strong>: string.</li>
|
||||
<li><strong>institutionFullName</strong>: string.</li>
|
||||
<li><strong>centerCode</strong>: integer, unique identifier of the center.</li>
|
||||
<li><strong>centerShortName</strong>: string.</li>
|
||||
<li><strong>centerFullName</strong>: string.</li>
|
||||
<li><strong>buildingCode</strong>: integer, unique identifier of the building.</li>
|
||||
<li><strong>buildingShortName</strong>: string.</li>
|
||||
<li><strong>buildingFullName</strong>: string.</li>
|
||||
<li><strong>floor</strong>: signed integer.</li>
|
||||
<li><strong>roomCode</strong>: integer, unique identifier of the room
|
||||
(≤ 0 ⇒ no room found for this MAC;
|
||||
> 0 ⇒ room found).</li>
|
||||
<li><strong>roomShortName</strong>: string.</li>
|
||||
<li><strong>roomFullName</strong>: string.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3 class="WS_FUNCTION"><code><a name="sendMyLocation">sendMyLocation</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Sends user's current location (room).
|
||||
Periodically called from the client to send the user's current location to the server.
|
||||
</p>
|
||||
<ul>
|
||||
<li>Call parameters:
|
||||
<ul>
|
||||
<li><strong>wsKey</strong>: string, identifier returned by
|
||||
<a href="#loginByUserPasswordKey"><code>loginByUserPasswordKey</code></a> or
|
||||
<a href="#loginBySessionKey"><code>loginBySessionKey</code></a>.</li>
|
||||
<li><strong>roomCode</strong>: integer, unique identifier of the room
|
||||
returned by <a href="#getLocation"><code>getLocation</code></a>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>success</strong>: integer.
|
||||
If 0 ⇒ error (for example, if the room does not exist).
|
||||
If not 0 ⇒ success.
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3 class="WS_FUNCTION"><code><a name="getLastLocation">getLastLocation</a></code></h3>
|
||||
<p style="text-align:justify">
|
||||
Returns the more recent location (institution, center, building and room) of a given user.
|
||||
A user can only consult the location of another user
|
||||
if the intersection of the centers of their courses is not empty.
|
||||
Both users do not have to share any course,
|
||||
but at least some course of each one has to share center.
|
||||
</p>
|
||||
<ul>
|
||||
<li>Call parameters:
|
||||
<ul>
|
||||
<li><strong>wsKey</strong>: string, identifier returned by
|
||||
<a href="#loginByUserPasswordKey"><code>loginByUserPasswordKey</code></a> or
|
||||
<a href="#loginBySessionKey"><code>loginBySessionKey</code></a>.</li>
|
||||
<li><strong>userCode</strong>: unique identifier of the user
|
||||
returned, for example, by <a href="#findUsers"><code>findUsers</code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Returns a data structure with the following fields:
|
||||
<ul>
|
||||
<li><strong>location</strong>: a data structure, corresponding to a location, with the following fields:
|
||||
<ul>
|
||||
<li><strong>institutionCode</strong>: integer, unique identifier of the institution.</li>
|
||||
<li><strong>institutionShortName</strong>: string.</li>
|
||||
<li><strong>institutionFullName</strong>: string.</li>
|
||||
<li><strong>centerCode</strong>: integer, unique identifier of the center.</li>
|
||||
<li><strong>centerShortName</strong>: string.</li>
|
||||
<li><strong>centerFullName</strong>: string.</li>
|
||||
<li><strong>buildingCode</strong>: integer, unique identifier of the building.</li>
|
||||
<li><strong>buildingShortName</strong>: string.</li>
|
||||
<li><strong>buildingFullName</strong>: string.</li>
|
||||
<li><strong>floor</strong>: signed integer.</li>
|
||||
<li><strong>roomCode</strong>: integer, unique identifier of the room
|
||||
(≤ 0 ⇒ the user has no registered her/his last location, or you don't have permission to see it;
|
||||
> 0 ⇒ room found).</li>
|
||||
<li><strong>roomShortName</strong>: string.</li>
|
||||
<li><strong>roomFullName</strong>: string.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>checkinTime</strong>: integer of 32 bits with sign, <a href="http://en.wikipedia.org/wiki/Unix_time">Unix time</a>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<td align="center">
|
||||
<h1>Authors and collaborators (to be updated)</h1>
|
||||
<a href="http://creativecommons.org/licenses/by-sa/3.0/deed.es_ES" title="License of text on this page" class="COPYRIGHT"><img src="/img/cc-by-sa.png" style="width:88px; height=31px; vertical-align:middle;" alt="CC BY-SA" /></a>
|
||||
<a href="https://openswad.org/en?usr=@acanas" target="_blank">Antonio Cañas Vargas</a>, 1999-2018
|
||||
<a href="https://openswad.org/en?usr=@acanas" target="_blank">Antonio Cañas Vargas</a>, 1999-2019
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
|||
una orden que ejecutar<br />
|
||||
una misión que completar.<br />
|
||||
No sabemos si nos callarán<br />
|
||||
ni si estos sobrevivirán<br />
|
||||
ni si esto sobrevivirá<br />
|
||||
si alguien nos recordará.<br />
|
||||
</cite>
|
||||
<a href="https://www.youtube.com/watch?v=YxDlBAMUlGQ">NM, Niños Mutantes</a>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -33,13 +33,13 @@
|
|||
<div align="center" style="margin:0 auto;">
|
||||
<h1>Publications</h1>
|
||||
<a href="http://creativecommons.org/licenses/by-sa/3.0/deed.es_ES" title="License of text on this page" class="COPYRIGHT"><img src="/img/cc-by-sa.png" style="width:88px; height=31px; vertical-align:middle;" alt="CC BY-SA" /></a>
|
||||
<a href="https://openswad.org/en?usr=@acanas" target="_blank">Antonio Cañas Vargas</a>, 1999-2018
|
||||
<a href="https://openswad.org/?usr=@acanas" target="_blank">Antonio Cañas Vargas</a>, 1999-2019
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Please use one of the following references when you mention SWAD in your publications.
|
||||
If you know any other publication in which the SWAD platform is mentioned,
|
||||
contact <a href="http://www.ugr.es/~acanas/">Antonio Cañas Vargas</a>
|
||||
contact <a href="https://openswad.org/?usr=@acanas">Antonio Cañas Vargas</a>
|
||||
to include it in this list.
|
||||
</p>
|
||||
|
||||
|
@ -54,16 +54,81 @@ https://www.researchgate.net/publication/303804256_El_Tablon_de_Docencia_y_la_Pl
|
|||
|
||||
-->
|
||||
|
||||
<dt><h3>2019</h3></dt>
|
||||
|
||||
<dd><dl>
|
||||
|
||||
<dt>17. [Cañas et al. 2019]</dt>
|
||||
<dd>
|
||||
<a href="http://www.ugr.es/~acanas/">Cañas, A.</a>,
|
||||
<a href="http://directorio.ugr.es/static/PersonalUGR/*/show/1824b4c05eb4ef26142156036280265b">Martínez Ortigosa, E.</a>,
|
||||
Prieto, B.,
|
||||
Pino, B.,
|
||||
Prieto, A.<br />
|
||||
<strong>SWAD, an Open Learning Management System: Results and Challenges.</strong><br />
|
||||
In J. Theo Bastiaens (Ed.), Proceedings of EdMedia + Innovate Learning, pp. 1496-1509<br />
|
||||
Amsterdam, Netherlands: Association for the Advancement of Computing in Education (AACE), 2019.<br />
|
||||
URI: <a href="https://www.learntechlib.org/primary/p/210166/">https://www.learntechlib.org/primary/p/210166/</a>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
<dt><h3>2018</h3></dt>
|
||||
|
||||
<dd><dl>
|
||||
|
||||
<dt>16. [Cañas et al. 2018b]</dt>
|
||||
<dd>
|
||||
<a href="http://www.ugr.es/~acanas/">A. Cañas</a>,
|
||||
Boyero, J. M.,
|
||||
Calandria, D. J.,
|
||||
<a href="http://directorio.ugr.es/static/PersonalUGR/*/show/1824b4c05eb4ef26142156036280265b">Ortigosa, E. M.</a>,
|
||||
Fernández, J.,
|
||||
Díaz, A. F.,
|
||||
Romero, S.,
|
||||
Mesa, J.,
|
||||
Lara, A.<br />
|
||||
<strong>Funcionalidad, implementación y líneas de desarrollo
|
||||
de la plataforma educativa SWAD/OpenSWAD.</strong><br />
|
||||
Enseñanza y Aprendizaje de Ingeniería de Computadores, N.º 8, pp. 145-184, 2018.<br />
|
||||
|
||||
URI: <a href="http://hdl.handle.net/10481/53300">http://hdl.handle.net/10481/53300</a>
|
||||
</dd>
|
||||
|
||||
<dt>15. [Cañas et al. 2018a]</dt>
|
||||
<dd>
|
||||
<a href="http://www.ugr.es/~acanas/">A. Cañas</a>,
|
||||
<a href="http://directorio.ugr.es/static/PersonalUGR/*/show/1824b4c05eb4ef26142156036280265b">Ortigosa, E. M.</a>,
|
||||
Fernández, J.,
|
||||
Boyero, J. M.,
|
||||
Anguita, M.,
|
||||
Ocaña, F. A.,
|
||||
Gea, M.,
|
||||
Fernández, A. M.,
|
||||
García, J.,
|
||||
Damas, M.,
|
||||
Ortega, J.,
|
||||
Prieto, A.,<br />
|
||||
<strong>Uso y difusión de la plataforma educativa SWAD/OpenSWAD
|
||||
en la Universidad de Granada y en el mundo.</strong><br />
|
||||
Enseñanza y Aprendizaje de Ingeniería de Computadores, N.º 8, pp. 117-144, 2018.<br />
|
||||
|
||||
URI: <a href="http://hdl.handle.net/10481/53303">http://hdl.handle.net/10481/53303</a>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
<dt><h3>2017</h3></dt>
|
||||
|
||||
<dd><dl>
|
||||
|
||||
<dt>14. [Cañas 2017b]</dt>
|
||||
<dt>14. [Cañas et al. 2017b]</dt>
|
||||
<dd>
|
||||
<a href="http://www.ugr.es/~acanas/">A. Cañas</a>,
|
||||
D. J. Calandria,
|
||||
J. M. Boyero,
|
||||
E. M. Ortigosa,
|
||||
<a href="http://directorio.ugr.es/static/PersonalUGR/*/show/1824b4c05eb4ef26142156036280265b">E. M. Ortigosa</a>,
|
||||
J. Fernández,
|
||||
F. A. Ocaña<br />
|
||||
<strong>18 years of development and use of the SWAD educational platform</strong><br />
|
||||
|
@ -76,7 +141,7 @@ https://www.researchgate.net/publication/303804256_El_Tablon_de_Docencia_y_la_Pl
|
|||
<dt>13. [Cañas et al. 2017a]</dt>
|
||||
<dd>
|
||||
<a href="http://www.ugr.es/~acanas/">A. Cañas</a>,
|
||||
E. M. Ortigosa,
|
||||
<a href="http://directorio.ugr.es/static/PersonalUGR/*/show/1824b4c05eb4ef26142156036280265b">E. M. Ortigosa</a>,
|
||||
J. M. Boyero,
|
||||
J. Fernández,
|
||||
M. Anguita<br />
|
||||
|
@ -767,9 +832,64 @@ https://hera.ugr.es/tesisugr/2639280x.pdf
|
|||
|
||||
<h2>Other publications in which the SWAD platform is referred</h2>
|
||||
|
||||
<dl>
|
||||
<dt><h3>2018</h3></dt>
|
||||
|
||||
<dd><dl>
|
||||
|
||||
<!--
|
||||
Evaluación comparativa de la satisfacción del usuario de las plataformas Moodle y Edmodo, área matemática Aduni
|
||||
http://repositorio.ucv.edu.pe/bitstream/handle/UCV/12855/Reyes_PWW.pdf?sequence=1
|
||||
|
||||
"LA ALFABETIZACIÓN DIGITAL DOCENTE Y LA INTEGRACIÓN DE LAS TIC’S EN EL CURRÍCULO DE EDUCACIÓN GENERAL
|
||||
BÁSICA"
|
||||
http://repositorio.uta.edu.ec/bitstream/123456789/27839/1/0604643932FALCONI%20GAVLANES%20PABLO%20DAVID.pdf
|
||||
|
||||
USO DEL ENTORNO VIRTUAL DE APRENDIZAJE EN LOS ESTUDIANTES DE
|
||||
LA CARRERA PROFESIONAL DE EDUCACIÓN INICIAL DEL INSTITUTO
|
||||
SUPERIOR DE EDUCACIÓN PÚBLICO "IGNACIO AMADEO RAMOS OLIVERA"
|
||||
http://repositorio.uct.edu.pe/bitstream/123456789/309/1/018100271H_B_2018.pdf
|
||||
|
||||
Algunas reflexiones sobre la utilización de plataformas virtuales de enseñanza
|
||||
https://dialnet.unirioja.es/descarga/articulo/6759672.pdf
|
||||
|
||||
|
||||
ENTORNO VIRTUAL DE APRENDIZAJE CENTRADO EN LA METÁFORA EDUCATIVA
|
||||
http://www.uct.unexpo.edu.ve/index.php/uct/article/download/810/655
|
||||
|
||||
Ensayo sobre aulas virtuales: presente y futuro/Essay about virtual classroom: their present and future
|
||||
https://www.pag.org.mx/index.php/PAG/article/viewFile/777/1117
|
||||
|
||||
|
||||
Mixing Modern Teaching Methods with Online Marketing Tools for Romanian Students.
|
||||
-->
|
||||
<dt>96. [Trejo González 2018]</dt>
|
||||
<dd>
|
||||
Hugo Trejo González<br />
|
||||
|
||||
<strong>Plataformas LMS basadas en la Nube: Schoology, Edmodo y Google Classroom.</strong><br />
|
||||
In: Verbum et lingua, Revista electrónica, Departamento de Lenguas Modernas,
|
||||
Universidad de Guadalajara, México, año 6, núm. 12, julio / diciembre 2018, pp. 114-146, ISSN 2007-7319<br />
|
||||
<a href="http://www.verbumetlingua.cucsh.udg.mx/sites/default/files/VetL%2012.pdf">http://www.verbumetlingua.cucsh.udg.mx/sites/default/files/VetL%2012.pdf</a>
|
||||
</dd>
|
||||
|
||||
</dl></dd>
|
||||
|
||||
<dl>
|
||||
<dt><h3>2017</h3></dt>
|
||||
|
||||
<!--
|
||||
|
||||
Ana María Ramos-García
|
||||
English for Academic Purposes: A Proposal to Improve Listening Skills of Education Students
|
||||
https://link.springer.com/chapter/10.1007/978-3-319-68926-5_7
|
||||
|
||||
Cadena-Vela, S., Ortiz Herrera, J., & Torres Martínez, G. (2017). A step towards innovation at Central University of Ecuador: Implementation of the virtual educational platform. In J. M.
|
||||
Dodero, M. S. Ibarra Sáiz, & I. Ruiz Rube (Eds.), Fifth International Conference on Technological Ecosystems for Enhancing Multiculturality (TEEM’17) (Cádiz, Spain, October 18-20, 2017)
|
||||
(Article 75). New York, NY, USA: ACM. doi:10.1145/3144826.3145425
|
||||
|
||||
-->
|
||||
|
||||
<dd><dl>
|
||||
|
||||
<dt>95. [Pérez-Alonso et al. 2017b]</dt>
|
||||
|
@ -861,6 +981,9 @@ profesional, recurso didáctico en docencia de ciencias del deporte / Simulation
|
|||
performance,didactic tool in teaching sport sciences. Revista Internacional de Medicina y
|
||||
Ciencias de la Actividad Física y el Deporte vol. X (x) pp.xx Pendiente de publicación / In press.
|
||||
|
||||
La importancia del uso de plataformas educativas, Mariela Viñas
|
||||
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=23&ved=2ahUKEwjH9cGcmaDeAhWCzYUKHULqBYU4ChAWMAx6BAgEEAI&url=http%3A%2F%2Fsedici.unlp.edu.ar%2Fbitstream%2Fhandle%2F10915%2F61390%2FDocumento_completo__.pdf-PDFA.pdf%3Fsequence%3D1&usg=AOvVaw0L8Ui1M7SJL8OMFEnC7snQ
|
||||
|
||||
-->
|
||||
<dt><h3>2015</h3></dt>
|
||||
|
||||
|
|
|
@ -14,23 +14,6 @@ table {border-width:0px; border-style:none;}
|
|||
img {border-width:0px; border-style:none;}
|
||||
.SWAD{font-family:Arial,DejaVu LGC Sans,Bitstream Vera Sans,sans-serif;color:#F8B000;font-size:16pt;font-weight:bold;}
|
||||
</style>
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-40768375-1', 'openswad.org', {
|
||||
'anonymizeIp': true,
|
||||
'storage': 'none',
|
||||
'clientId': window.localStorage.getItem('ga_clientId')
|
||||
});
|
||||
ga(function(tracker) {
|
||||
window.localStorage.setItem('ga_clientID', tracker.get('clientId'));
|
||||
});
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -50,13 +33,23 @@ img {border-width:0px; border-style:none;}
|
|||
<td align="center" colspan="2">
|
||||
<h1>Presentations</h1>
|
||||
<a href="http://creativecommons.org/licenses/by-sa/3.0/deed.es_ES" title="License of text on this page" class="COPYRIGHT"><img src="/img/cc-by-sa.png" style="width:88px; height=31px; vertical-align:middle;" alt="CC BY-SA" /></a>
|
||||
<a href="https://openswad.org/en?usr=@acanas" target="_blank">Antonio Cañas Vargas</a>, 1999-2018
|
||||
<a href="https://openswad.org/en?usr=@acanas" target="_blank">Antonio Cañas Vargas</a>, 1999-2021
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center">
|
||||
|
||||
<div style="width:595px; margin-bottom:50px;">
|
||||
<h2>
|
||||
<a href="https:////www.slideshare.net/acanas/swad-an-open-learning-management-system-243335901"
|
||||
title="SWAD, an Open Learning Management System">
|
||||
SWAD, an Open Learning Management System</a>
|
||||
</h2>
|
||||
<iframe src="https:////www.slideshare.net/slideshow/embed_code/key/egKx4wlBYyqr62" width="595" height="485" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen>
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div style="width:595px; margin-bottom:50px;">
|
||||
<h2>
|
||||
<a href="https://www.slideshare.net/acanas/la-plataforma-educativa-libre-openswad"
|
||||
|
|
|
@ -44,6 +44,16 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center">
|
||||
<cite>
|
||||
Parece que es el fin<br />
|
||||
y solo es el comienzo.<br />
|
||||
</cite>
|
||||
<a href="https://www.youtube.com/watch?v=GiOhY8Oayxo">Nuestro tiempo, Amaral</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center">
|
||||
<cite>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 280 KiB |
|
@ -40,7 +40,7 @@
|
|||
<td align="center">
|
||||
<h1>Source code</h1>
|
||||
<a href="http://creativecommons.org/licenses/by-sa/3.0/deed.es_ES" title="License of text on this page" class="COPYRIGHT"><img src="/img/cc-by-sa.png" style="width:88px; height=31px; vertical-align:middle;" alt="CC BY-SA" /></a>
|
||||
<a href="https://openswad.org/en?usr=@acanas" target="_blank">Antonio Cañas Vargas</a>, 1999-2018
|
||||
<a href="https://openswad.org/en?usr=@acanas" target="_blank">Antonio Cañas Vargas</a>, 1999-2022
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -77,7 +77,7 @@
|
|||
|
||||
<p align="left">
|
||||
<em>"Cuando me preguntan cuándo estará listo un programa, contesto:
|
||||
depende de cuánto trabaje usted en ello."</em><br>
|
||||
depende de cuánto trabaje usted en ello."</em><br />
|
||||
--Richard Stallman
|
||||
<sup><a href="http://www.elmundo.es/navegante/2004/04/27/entrevistas/1083074999.html">1</a></sup>
|
||||
</p>
|
||||
|
@ -123,12 +123,12 @@
|
|||
The reader will probably think "a web application written in C?"
|
||||
Yes, it is not usual, <a href="http://www.youtube.com/watch?v=1S1fISh-pag">but... ;-)</a>
|
||||
A little more seriously, we could say that we have developed swad-core
|
||||
following the philosophy of <a href="http://handmadedev.org/manifesto/">The Handmade Manifesto</a>.
|
||||
following the philosophy of <a href="https://handmade.network/manifesto">The Handmade Manifesto</a>.
|
||||
</p>
|
||||
|
||||
<p align="justify">
|
||||
SWAD core has about 234 500 <a href="http://en.wikipedia.org/wiki/Source_lines_of_code">lines of source code</a>.
|
||||
Each executable program (one for each language) has a size of 2.2 <a href="http://en.wikipedia.org/wiki/Mebibyte">MiB</a>
|
||||
SWAD core has about 323 000 <a href="http://en.wikipedia.org/wiki/Source_lines_of_code">lines of source code</a>.
|
||||
Each executable program (one for each language) has a size of 2.7 <a href="http://en.wikipedia.org/wiki/Mebibyte">MiB</a>
|
||||
and in most of the possible actions
|
||||
generates the <a href="http://en.wikipedia.org/wiki/Web_page">page</a> in few milliseconds.
|
||||
</p>
|
||||
|
@ -139,7 +139,7 @@
|
|||
All versions are listed in the <a href="https://openswad.org/changelog/">change log</a>.
|
||||
</p>
|
||||
|
||||
<a href="img/lineas-codigo-modulo-principal.png"><img src="img/lineas-codigo-modulo-principal.png" width="100%" height="50%" border="0" alt="Main swad core code lines" align="right" hspace="30" vspace="30"></a>
|
||||
<a href="img/lineas-codigo-modulo-principal.png"><img src="img/lineas-codigo-modulo-principal.png" width="100%" height="50%" border="0" alt="Main swad core code lines" align="right" hspace="30" vspace="30" /></a>
|
||||
|
||||
<p align="justify">
|
||||
For <a href="http://en.wikipedia.org/wiki/Cryptography">encryption</a> of passwords
|
||||
|
@ -165,7 +165,8 @@
|
|||
<h3>Photo processing module (<code>fotomaton</code>)</h3>
|
||||
|
||||
<p align="justify">
|
||||
Programmed by <a href="http://es.linkedin.com/in/dcalandria">Daniel Jesús Calandria Hernández</a>.
|
||||
Programmed by <a href="http://es.linkedin.com/in/dcalandria">Daniel Jesús Calandria Hernández</a>
|
||||
and <a href="https://github.com/mesagon">Jesús Mesa González</a>.
|
||||
</p>
|
||||
|
||||
<p align="justify">
|
||||
|
@ -174,7 +175,8 @@
|
|||
The first version of this module was developed by former students of Computer Engineering
|
||||
Jesús Álvarez Martín and <a href="http://www.xing.com/profile/Alberto_RodrigoGamiz">Alberto Rodrigo Gámiz</a>.
|
||||
Currently it uses a version completely rewritten
|
||||
by <a href="http://es.linkedin.com/in/dcalandria">Daniel Jesús Calandria Hernández</a>.
|
||||
by <a href="http://es.linkedin.com/in/dcalandria">Daniel Jesús Calandria Hernández</a>
|
||||
and <a href="https://github.com/mesagon">Jesús Mesa González</a>.
|
||||
The module detects human faces present in the picture,
|
||||
resize the image, and performs various improvements
|
||||
such as checking the clarity of background, noise removal, contrast and saturation improvement, and white balance.
|
||||
|
|
16
swad_API.c
16
swad_API.c
|
@ -872,8 +872,8 @@ int swad__loginBySessionKey (struct soap *soap,
|
|||
loginBySessionKeyOut->userSurname2 = soap_malloc (soap,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1);
|
||||
loginBySessionKeyOut->userPhoto = soap_malloc (soap,Cns_MAX_BYTES_WWW + 1);
|
||||
loginBySessionKeyOut->userBirthday = soap_malloc (soap,Dat_LENGTH_YYYYMMDD + 1);
|
||||
loginBySessionKeyOut->degreeName = soap_malloc (soap,Hie_MAX_BYTES_FULL_NAME + 1);
|
||||
loginBySessionKeyOut->courseName = soap_malloc (soap,Hie_MAX_BYTES_FULL_NAME + 1);
|
||||
loginBySessionKeyOut->degreeName = soap_malloc (soap,Cns_MAX_BYTES_FULL_NAME + 1);
|
||||
loginBySessionKeyOut->courseName = soap_malloc (soap,Cns_MAX_BYTES_FULL_NAME + 1);
|
||||
|
||||
/***** Default values returned on error *****/
|
||||
loginBySessionKeyOut->userCode = -1;
|
||||
|
@ -916,7 +916,7 @@ int swad__loginBySessionKey (struct soap *soap,
|
|||
Crs_GetCourseDataByCod (&Gbl.Hierarchy.Node[Hie_CRS]);
|
||||
loginBySessionKeyOut->courseCode = (int) Gbl.Hierarchy.Node[Hie_CRS].HieCod;
|
||||
Str_Copy (loginBySessionKeyOut->courseName,Gbl.Hierarchy.Node[Hie_CRS].FullName,
|
||||
Hie_MAX_BYTES_FULL_NAME);
|
||||
Cns_MAX_BYTES_FULL_NAME);
|
||||
|
||||
/***** Get user code (row[0]) *****/
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
@ -927,7 +927,7 @@ int swad__loginBySessionKey (struct soap *soap,
|
|||
Deg_GetDegreeDataByCod (&Gbl.Hierarchy.Node[Hie_DEG]);
|
||||
loginBySessionKeyOut->degreeCode = (int) Gbl.Hierarchy.Node[Hie_DEG].HieCod;
|
||||
Str_Copy (loginBySessionKeyOut->degreeName,Gbl.Hierarchy.Node[Hie_DEG].FullName,
|
||||
Hie_MAX_BYTES_FULL_NAME);
|
||||
Cns_MAX_BYTES_FULL_NAME);
|
||||
}
|
||||
else
|
||||
UsrFound = false;
|
||||
|
@ -1155,13 +1155,13 @@ int swad__getCourses (struct soap *soap,
|
|||
/* Get course short name (row[1])
|
||||
and course full name (row[2]) */
|
||||
getCoursesOut->coursesArray.__ptr[NumCrs].courseShortName =
|
||||
soap_malloc (soap,Hie_MAX_BYTES_SHRT_NAME + 1);
|
||||
soap_malloc (soap,Cns_MAX_BYTES_SHRT_NAME + 1);
|
||||
getCoursesOut->coursesArray.__ptr[NumCrs].courseFullName =
|
||||
soap_malloc (soap,Hie_MAX_BYTES_FULL_NAME + 1);
|
||||
soap_malloc (soap,Cns_MAX_BYTES_FULL_NAME + 1);
|
||||
Str_Copy (getCoursesOut->coursesArray.__ptr[NumCrs].courseShortName,
|
||||
row[1],Hie_MAX_BYTES_SHRT_NAME);
|
||||
row[1],Cns_MAX_BYTES_SHRT_NAME);
|
||||
Str_Copy (getCoursesOut->coursesArray.__ptr[NumCrs].courseFullName,
|
||||
row[2],Hie_MAX_BYTES_FULL_NAME);
|
||||
row[2],Cns_MAX_BYTES_FULL_NAME);
|
||||
|
||||
/* Get role (row[3]) */
|
||||
if (sscanf (row[3],"%u",&Role) != 1) // Role in this course
|
||||
|
|
|
@ -441,7 +441,7 @@ static void Ban_ListBannersForEdition (struct Ban_Banners *Banners)
|
|||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActRenBanSho);
|
||||
ParCod_PutPar (ParCod_Ban,Banners->BanCodToEdit);
|
||||
HTM_INPUT_TEXT ("ShortName",Ban_MAX_CHARS_SHRT_NAME,Ban->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Ban->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -452,7 +452,7 @@ static void Ban_ListBannersForEdition (struct Ban_Banners *Banners)
|
|||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActRenBanFul);
|
||||
ParCod_PutPar (ParCod_Ban,Banners->BanCodToEdit);
|
||||
HTM_INPUT_TEXT ("FullName",Ban_MAX_CHARS_FULL_NAME,Ban->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Ban->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -613,74 +613,65 @@ void Ban_RenameBannerFull (void)
|
|||
static void Ban_RenameBanner (struct Ban_Banner *Ban,
|
||||
Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_banner_X_already_exists;
|
||||
extern const char *Txt_The_banner_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
const char *ParName = NULL; // Initialized to avoid warning
|
||||
const char *FldName = NULL; // Initialized to avoid warning
|
||||
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||
char *CurrentBanName = NULL; // Initialized to avoid warning
|
||||
char NewBanName[Ban_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
switch (ShrtOrFullName)
|
||||
char *CurrentName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
case Cns_SHRT_NAME:
|
||||
ParName = "ShortName";
|
||||
FldName = "ShortName";
|
||||
MaxBytes = Ban_MAX_BYTES_SHRT_NAME;
|
||||
CurrentBanName = Ban->ShrtName;
|
||||
break;
|
||||
case Cns_FULL_NAME:
|
||||
ParName = "FullName";
|
||||
FldName = "FullName";
|
||||
MaxBytes = Ban_MAX_BYTES_FULL_NAME;
|
||||
CurrentBanName = Ban->FullName;
|
||||
break;
|
||||
}
|
||||
[Cns_SHRT_NAME] = Ban->ShrtName,
|
||||
[Cns_FULL_NAME] = Ban->FullName,
|
||||
};
|
||||
char NewName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the code of the banner */
|
||||
Ban->BanCod = ParCod_GetAndCheckPar (ParCod_Ban);
|
||||
|
||||
/* Get the new name for the banner */
|
||||
Par_GetParText (ParName,NewBanName,MaxBytes);
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/***** Get banner data from the database *****/
|
||||
Ban_GetBannerDataByCod (Ban);
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (!NewBanName[0])
|
||||
if (!NewName[0])
|
||||
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
||||
else
|
||||
{
|
||||
/***** Check if old and new names are the same
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (strcmp (CurrentBanName,NewBanName)) // Different names
|
||||
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
|
||||
{
|
||||
/***** If banner was in database... *****/
|
||||
if (Ban_DB_CheckIfBannerNameExists (ParName,NewBanName,Ban->BanCod))
|
||||
if (Ban_DB_CheckIfBannerNameExists (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Ban->BanCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_banner_X_already_exists,
|
||||
NewBanName);
|
||||
NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Ban_DB_UpdateBanName (Ban->BanCod,FldName,NewBanName);
|
||||
Ban_DB_UpdateBanName (Ban->BanCod,Cns_FldShrtOrFullName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Write message to show the change made */
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_banner_X_has_been_renamed_as_Y,
|
||||
CurrentBanName,NewBanName);
|
||||
CurrentName[ShrtOrFullName],NewName);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
/* Write warning message */
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
Txt_The_name_X_has_not_changed,CurrentBanName);
|
||||
Txt_The_name_X_has_not_changed,CurrentName[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
/***** Update name *****/
|
||||
Str_Copy (CurrentBanName,NewBanName,MaxBytes);
|
||||
Str_Copy (CurrentName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -813,7 +804,7 @@ static void Ban_PutFormToCreateBanner (const struct Ban_Banner *Ban)
|
|||
|
||||
/* Banner short name */
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Ban_MAX_CHARS_SHRT_NAME,Ban->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Ban->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -822,7 +813,7 @@ static void Ban_PutFormToCreateBanner (const struct Ban_Banner *Ban)
|
|||
|
||||
/* Banner full name */
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Ban_MAX_CHARS_FULL_NAME,Ban->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Ban->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -897,8 +888,8 @@ void Ban_ReceiveFormNewBanner (void)
|
|||
Ban_ResetBanner (Ban);
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
Par_GetParText ("ShortName",Ban->ShrtName,Ban_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Ban->FullName,Ban_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParText ("ShortName",Ban->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Ban->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParText ("Img" ,Ban->Img ,Ban_MAX_BYTES_IMAGE);
|
||||
Par_GetParText ("WWW" ,Ban->WWW ,Cns_MAX_BYTES_WWW);
|
||||
|
||||
|
|
|
@ -35,12 +35,6 @@
|
|||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Ban_MAX_CHARS_SHRT_NAME (32 - 1) // 31
|
||||
#define Ban_MAX_BYTES_SHRT_NAME ((Ban_MAX_CHARS_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
|
||||
|
||||
#define Ban_MAX_CHARS_FULL_NAME (128 - 1) // 127
|
||||
#define Ban_MAX_BYTES_FULL_NAME ((Ban_MAX_CHARS_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
|
||||
#define Ban_MAX_CHARS_IMAGE NAME_MAX // 255
|
||||
#define Ban_MAX_BYTES_IMAGE Ban_MAX_CHARS_IMAGE // 255
|
||||
|
||||
|
@ -48,8 +42,8 @@ struct Ban_Banner
|
|||
{
|
||||
long BanCod;
|
||||
HidVis_HiddenOrVisible_t HiddenOrVisible;
|
||||
char ShrtName[Ban_MAX_BYTES_SHRT_NAME + 1];
|
||||
char FullName[Ban_MAX_BYTES_FULL_NAME + 1];
|
||||
char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1];
|
||||
char FullName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
char Img[Ban_MAX_BYTES_IMAGE + 1];
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
};
|
||||
|
|
|
@ -5282,7 +5282,7 @@ static void Brw_WriteCurrentClipboard (void)
|
|||
struct Prj_Project Prj;
|
||||
struct Usr_Data UsrDat;
|
||||
char TxtClipboardZone[1024 +
|
||||
Hie_MAX_BYTES_SHRT_NAME +
|
||||
Cns_MAX_BYTES_SHRT_NAME +
|
||||
Grp_MAX_BYTES_GROUP_TYPE_NAME +
|
||||
Grp_MAX_BYTES_GROUP_NAME +
|
||||
Usr_MAX_BYTES_FULL_NAME +
|
||||
|
|
|
@ -429,7 +429,7 @@ static void Bld_ListBuildingsForEdition (const struct Bld_Buildings *Buildings)
|
|||
HTM_TD_Begin ("class=\"LM\"");
|
||||
Frm_BeginFormAnchor (ActRenBldSho,Anchor);
|
||||
ParCod_PutPar (ParCod_Bld,Building->BldCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Bld_MAX_CHARS_SHRT_NAME,Building->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Building->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"size=\"10\" class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -440,7 +440,7 @@ static void Bld_ListBuildingsForEdition (const struct Bld_Buildings *Buildings)
|
|||
HTM_TD_Begin ("class=\"LM\"");
|
||||
Frm_BeginFormAnchor (ActRenBldFul,Anchor);
|
||||
ParCod_PutPar (ParCod_Bld,Building->BldCod);
|
||||
HTM_INPUT_TEXT ("FullName",Bld_MAX_CHARS_FULL_NAME,Building->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Building->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"size=\"20\" class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -536,73 +536,67 @@ void Bld_RenameBuildingFull (void)
|
|||
|
||||
static void Bld_RenameBuilding (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_building_X_already_exists;
|
||||
extern const char *Txt_The_building_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
const char *ParName = NULL; // Initialized to avoid warning
|
||||
const char *FldName = NULL; // Initialized to avoid warning
|
||||
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||
char *CurrentClaName = NULL; // Initialized to avoid warning
|
||||
char NewClaName[Bld_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
switch (ShrtOrFullName)
|
||||
char *CurrentName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
case Cns_SHRT_NAME:
|
||||
ParName = "ShortName";
|
||||
FldName = "ShortName";
|
||||
MaxBytes = Bld_MAX_BYTES_SHRT_NAME;
|
||||
CurrentClaName = Bld_EditingBuilding->ShrtName;
|
||||
break;
|
||||
case Cns_FULL_NAME:
|
||||
ParName = "FullName";
|
||||
FldName = "FullName";
|
||||
MaxBytes = Bld_MAX_BYTES_FULL_NAME;
|
||||
CurrentClaName = Bld_EditingBuilding->FullName;
|
||||
break;
|
||||
}
|
||||
[Cns_SHRT_NAME] = Bld_EditingBuilding->ShrtName,
|
||||
[Cns_FULL_NAME] = Bld_EditingBuilding->FullName,
|
||||
};
|
||||
char NewName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the code of the building */
|
||||
Bld_EditingBuilding->BldCod = ParCod_GetAndCheckPar (ParCod_Bld);
|
||||
|
||||
/* Get the new name for the building */
|
||||
Par_GetParText (ParName,NewClaName,MaxBytes);
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/***** Get from the database the old names of the building *****/
|
||||
Bld_GetBuildingDataByCod (Bld_EditingBuilding);
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (NewClaName[0])
|
||||
if (NewName[0])
|
||||
{
|
||||
/***** Check if old and new names are the same
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (strcmp (CurrentClaName,NewClaName)) // Different names
|
||||
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
|
||||
{
|
||||
/***** If building was in database... *****/
|
||||
if (Bld_DB_CheckIfBuildingNameExists (ParName,NewClaName,Bld_EditingBuilding->BldCod))
|
||||
if (Bld_DB_CheckIfBuildingNameExists (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Bld_EditingBuilding->BldCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_building_X_already_exists,
|
||||
NewClaName);
|
||||
NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Bld_DB_UpdateBuildingName (Bld_EditingBuilding->BldCod,FldName,NewClaName);
|
||||
Bld_DB_UpdateBuildingName (Bld_EditingBuilding->BldCod,
|
||||
Cns_FldShrtOrFullName[ShrtOrFullName],
|
||||
NewName);
|
||||
|
||||
/* Write message to show the change made */
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_building_X_has_been_renamed_as_Y,
|
||||
CurrentClaName,NewClaName);
|
||||
CurrentName[ShrtOrFullName],NewName);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
Txt_The_name_X_has_not_changed,CurrentClaName);
|
||||
Txt_The_name_X_has_not_changed,
|
||||
CurrentName[ShrtOrFullName]);
|
||||
}
|
||||
else
|
||||
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
||||
|
||||
/***** Update building name *****/
|
||||
Str_Copy (CurrentClaName,NewClaName,MaxBytes);
|
||||
Str_Copy (CurrentName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -613,7 +607,7 @@ void Bld_ChangeBuildingLocation (void)
|
|||
{
|
||||
extern const char *Txt_The_location_of_the_building_X_has_changed_to_Y;
|
||||
extern const char *Txt_The_location_of_the_building_X_has_not_changed;
|
||||
char NewLocation[Bld_MAX_BYTES_FULL_NAME + 1];
|
||||
char NewLocation[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
/***** Building constructor *****/
|
||||
Bld_EditingBuildingConstructor ();
|
||||
|
@ -688,7 +682,7 @@ static void Bld_PutFormToCreateBuilding (void)
|
|||
|
||||
/***** Building short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Bld_MAX_CHARS_SHRT_NAME,Bld_EditingBuilding->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Bld_EditingBuilding->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"size=\"10\" class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -697,7 +691,7 @@ static void Bld_PutFormToCreateBuilding (void)
|
|||
|
||||
/***** Building full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Bld_MAX_CHARS_FULL_NAME,Bld_EditingBuilding->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Bld_EditingBuilding->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"size=\"20\" class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -754,10 +748,10 @@ void Bld_ReceiveFormNewBuilding (void)
|
|||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get building short name */
|
||||
Par_GetParText ("ShortName",Bld_EditingBuilding->ShrtName,Bld_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("ShortName",Bld_EditingBuilding->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get building full name */
|
||||
Par_GetParText ("FullName",Bld_EditingBuilding->FullName,Bld_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParText ("FullName",Bld_EditingBuilding->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
|
||||
/* Get building location */
|
||||
Par_GetParText ("Location",Bld_EditingBuilding->Location,Bld_MAX_BYTES_LOCATION);
|
||||
|
|
|
@ -27,18 +27,13 @@
|
|||
/********************************** Headers **********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "swad_constant.h"
|
||||
#include "swad_string.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Bld_MAX_CHARS_SHRT_NAME (32 - 1) // 31
|
||||
#define Bld_MAX_BYTES_SHRT_NAME ((Bld_MAX_CHARS_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
|
||||
|
||||
#define Bld_MAX_CHARS_FULL_NAME (128 - 1) // 127
|
||||
#define Bld_MAX_BYTES_FULL_NAME ((Bld_MAX_CHARS_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
|
||||
#define Bld_MAX_CHARS_LOCATION (128 - 1) // 127
|
||||
#define Bld_MAX_BYTES_LOCATION ((Bld_MAX_CHARS_LOCATION + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
|
||||
|
@ -46,8 +41,8 @@ struct Bld_Building
|
|||
{
|
||||
long BldCod;
|
||||
long InsCod;
|
||||
char ShrtName[Bld_MAX_BYTES_SHRT_NAME + 1];
|
||||
char FullName[Bld_MAX_BYTES_FULL_NAME + 1];
|
||||
char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1];
|
||||
char FullName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
char Location[Bld_MAX_BYTES_LOCATION + 1]; // Examples: Campus North, City center
|
||||
};
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ static long Cfe_GetParsCallsForExams (struct Cfe_CallsForExams *CallsForExams)
|
|||
ExaCod = ParCod_GetPar (ParCod_Exa);
|
||||
|
||||
/***** Get the name of the course (it is allowed to be different from the official name of the course) *****/
|
||||
Par_GetParText ("CrsName",CallsForExams->CallForExam.CrsFullName,Hie_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParText ("CrsName",CallsForExams->CallForExam.CrsFullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
// If the parameter is not present or is empty, initialize the string to the full name of the current course
|
||||
if (!CallsForExams->CallForExam.CrsFullName[0])
|
||||
Str_Copy (CallsForExams->CallForExam.CrsFullName,
|
||||
|
@ -1001,7 +1001,7 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams,
|
|||
HTM_TD_Begin ("class=\"LB DAT_STRONG_%s\"",
|
||||
The_GetSuffix ());
|
||||
if (TypeViewCallForExam == Cfe_FORM_VIEW)
|
||||
HTM_INPUT_TEXT ("CrsName",Hie_MAX_CHARS_FULL_NAME,CallsForExams->CallForExam.CrsFullName,
|
||||
HTM_INPUT_TEXT ("CrsName",Cns_MAX_CHARS_FULL_NAME,CallsForExams->CallForExam.CrsFullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"id=\"CrsName\" size=\"30\" class=\"INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
|
|
@ -62,7 +62,7 @@ struct Cfe_CallForExam
|
|||
{
|
||||
long CrsCod;
|
||||
Cfe_Status_t Status;
|
||||
char CrsFullName[Hie_MAX_BYTES_FULL_NAME + 1];
|
||||
char CrsFullName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
unsigned Year; // Number of year (0 (N.A.), 1, 2, 3, 4, 5, 6) in the degree
|
||||
char Session[Cfe_MAX_BYTES_SESSION + 1]; // Exam session is june, september, etc.
|
||||
struct Dat_Date CallDate;
|
||||
|
|
|
@ -839,7 +839,7 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
|
|||
{
|
||||
Frm_BeginForm (ActRenCtrSho);
|
||||
ParCod_PutPar (ParCod_OthHie,Ctr->HieCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Ctr->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Ctr->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -855,7 +855,7 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
|
|||
{
|
||||
Frm_BeginForm (ActRenCtrFul);
|
||||
ParCod_PutPar (ParCod_OthHie,Ctr->HieCod);
|
||||
HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Ctr->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Ctr->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -1079,70 +1079,63 @@ void Ctr_RenameCenterFull (void)
|
|||
|
||||
void Ctr_RenameCenter (struct Hie_Node *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_center_X_already_exists;
|
||||
extern const char *Txt_The_center_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
const char *ParName = NULL; // Initialized to avoid warning
|
||||
const char *FldName = NULL; // Initialized to avoid warning
|
||||
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||
char *CurrentCtrName = NULL; // Initialized to avoid warning
|
||||
char NewCtrName[Hie_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
switch (ShrtOrFullName)
|
||||
char *CurrentName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
case Cns_SHRT_NAME:
|
||||
ParName = "ShortName";
|
||||
FldName = "ShortName";
|
||||
MaxBytes = Hie_MAX_BYTES_SHRT_NAME;
|
||||
CurrentCtrName = Ctr->ShrtName;
|
||||
break;
|
||||
case Cns_FULL_NAME:
|
||||
ParName = "FullName";
|
||||
FldName = "FullName";
|
||||
MaxBytes = Hie_MAX_BYTES_FULL_NAME;
|
||||
CurrentCtrName = Ctr->FullName;
|
||||
break;
|
||||
}
|
||||
[Cns_SHRT_NAME] = Ctr->ShrtName,
|
||||
[Cns_FULL_NAME] = Ctr->FullName,
|
||||
};
|
||||
char NewName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the new name for the center */
|
||||
Par_GetParText (ParName,NewCtrName,MaxBytes);
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/***** Get from the database the old names of the center *****/
|
||||
Ctr_GetCenterDataByCod (Ctr);
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (!NewCtrName[0])
|
||||
if (!NewName[0])
|
||||
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
||||
else
|
||||
{
|
||||
/***** Check if old and new names are the same
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (strcmp (CurrentCtrName,NewCtrName)) // Different names
|
||||
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
|
||||
{
|
||||
/***** If degree was in database... *****/
|
||||
if (Ctr_DB_CheckIfCtrNameExistsInIns (ParName,NewCtrName,Ctr->HieCod,
|
||||
if (Ctr_DB_CheckIfCtrNameExistsInIns (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Ctr->HieCod,
|
||||
Gbl.Hierarchy.Node[Hie_INS].HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_center_X_already_exists,
|
||||
NewCtrName);
|
||||
NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Ctr_DB_UpdateCtrName (Ctr->HieCod,FldName,NewCtrName);
|
||||
Ctr_DB_UpdateCtrName (Ctr->HieCod,
|
||||
Cns_FldShrtOrFullName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Write message to show the change made */
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_center_X_has_been_renamed_as_Y,
|
||||
CurrentCtrName,NewCtrName);
|
||||
CurrentName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Change current center name in order to display it properly */
|
||||
Str_Copy (CurrentCtrName,NewCtrName,MaxBytes);
|
||||
Str_Copy (CurrentName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
Txt_The_name_X_has_not_changed,CurrentCtrName);
|
||||
Txt_The_name_X_has_not_changed,
|
||||
CurrentName[ShrtOrFullName]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1325,7 +1318,7 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places)
|
|||
|
||||
/***** Center short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Ctr_EditingCtr->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Ctr_EditingCtr->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -1334,7 +1327,7 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places)
|
|||
|
||||
/***** Center full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Ctr_EditingCtr->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Ctr_EditingCtr->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -1522,8 +1515,8 @@ static void Ctr_ReceiveFormRequestOrCreateCtr (Hie_Status_t Status)
|
|||
Ctr_EditingCtr->Specific.PlcCod = ParCod_GetAndCheckParMin (ParCod_Plc,0); // 0 (another place) is allowed here
|
||||
|
||||
/* Get center short name and full name */
|
||||
Par_GetParText ("ShortName",Ctr_EditingCtr->ShrtName,Hie_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Ctr_EditingCtr->FullName,Hie_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParText ("ShortName",Ctr_EditingCtr->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Ctr_EditingCtr->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
|
||||
/* Get center WWW */
|
||||
Par_GetParText ("WWW",Ctr_EditingCtr->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
|
|
@ -260,7 +260,7 @@ long Ctr_DB_GetInsCodOfCenterByCod (long CtrCod)
|
|||
/*************** Get the short name of a center from its code ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ctr_DB_GetShortNameOfCenterByCod (long CtrCod,char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1])
|
||||
void Ctr_DB_GetShortNameOfCenterByCod (long CtrCod,char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1])
|
||||
{
|
||||
/***** Trivial check: center code should be > 0 *****/
|
||||
if (CtrCod <= 0)
|
||||
|
@ -270,7 +270,7 @@ void Ctr_DB_GetShortNameOfCenterByCod (long CtrCod,char ShrtName[Hie_MAX_BYTES_S
|
|||
}
|
||||
|
||||
/***** Get the short name of a center from database *****/
|
||||
DB_QuerySELECTString (ShrtName,Hie_MAX_BYTES_SHRT_NAME,
|
||||
DB_QuerySELECTString (ShrtName,Cns_MAX_BYTES_SHRT_NAME,
|
||||
"can not get the short name of a center",
|
||||
"SELECT ShortName"
|
||||
" FROM ctr_centers"
|
||||
|
|
|
@ -48,7 +48,7 @@ unsigned Ctr_DB_GetCtrsWithPendingDegs (MYSQL_RES **mysql_res);
|
|||
unsigned Ctr_DB_GetCenterDataByCod (MYSQL_RES **mysql_res,long CtrCod);
|
||||
unsigned Ctr_DB_GetCoordByCod (MYSQL_RES **mysql_res,long CtrCod);
|
||||
long Ctr_DB_GetInsCodOfCenterByCod (long CtrCod);
|
||||
void Ctr_DB_GetShortNameOfCenterByCod (long CtrCod,char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]);
|
||||
void Ctr_DB_GetShortNameOfCenterByCod (long CtrCod,char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1]);
|
||||
unsigned Ctr_DB_GetPhotoAttribution (MYSQL_RES **mysql_res,long CtrCod);
|
||||
bool Ctr_DB_CheckIfCtrNameExistsInIns (const char *FldName,const char *Name,
|
||||
long CtrCod,long InsCod);
|
||||
|
|
|
@ -632,10 +632,13 @@ TODO: Francisco Javier Fern
|
|||
Me sale este error, no sé si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así?
|
||||
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.26.1 (2023-10-05)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.28 (2023-10-06)"
|
||||
#define CSS_FILE "swad23.25.2.css"
|
||||
#define JS_FILE "swad22.49.js"
|
||||
/*
|
||||
Version 23.28: Oct 06, 2023 New file swad_constant.c.
|
||||
Changes in test and match results when a question is edited. Suggested by Francisco Javier Fernández Baldomero. (335920 lines)
|
||||
Version 23.27: Oct 06, 2023 Code refactoring. (335951 lines)
|
||||
Version 23.26.1: Oct 05, 2023 Code refactoring. (335938 lines)
|
||||
Version 23.26: Oct 04, 2023 Code refactoring in forum stats. (335965 lines)
|
||||
Version 23.25.4: Oct 03, 2023 Code refactoring. (336036 lines)
|
||||
|
|
|
@ -301,7 +301,7 @@ void Con_ShowConnectedUsrsBelongingToCurrentCrs (void)
|
|||
{
|
||||
extern const char *Txt_Connected_users;
|
||||
extern const char *Txt_from;
|
||||
char CourseName[Hie_MAX_BYTES_SHRT_NAME + 1];
|
||||
char CourseName[Cns_MAX_BYTES_SHRT_NAME + 1];
|
||||
struct Con_ConnectedUsrs Usrs;
|
||||
|
||||
/***** Trivial check *****/
|
||||
|
|
|
@ -33,6 +33,12 @@
|
|||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Cns_MAX_CHARS_SHRT_NAME (32 - 1) // 31
|
||||
#define Cns_MAX_BYTES_SHRT_NAME ((Cns_MAX_CHARS_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
|
||||
|
||||
#define Cns_MAX_CHARS_FULL_NAME (128 - 1) // 127
|
||||
#define Cns_MAX_BYTES_FULL_NAME ((Cns_MAX_CHARS_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
|
||||
#define Cns_MAX_CHARS_WWW (256 - 1) // 255: max. number of chars of a URL
|
||||
#define Cns_MAX_BYTES_WWW Cns_MAX_CHARS_WWW // 255
|
||||
|
||||
|
@ -106,6 +112,7 @@ typedef enum
|
|||
} Cns_QuietOrVerbose_t;
|
||||
|
||||
// Related with names of centers, degrees, courses,...
|
||||
#define Cns_NUM_SHRT_FULL_NAMES 2
|
||||
typedef enum
|
||||
{
|
||||
Cns_SHRT_NAME,
|
||||
|
|
|
@ -566,8 +566,8 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void)
|
|||
long CrsCod;
|
||||
long DegCod;
|
||||
long LastDegCod;
|
||||
char CrsShortName[Hie_MAX_BYTES_SHRT_NAME + 1];
|
||||
char DegShortName[Hie_MAX_BYTES_SHRT_NAME + 1];
|
||||
char CrsShortName[Cns_MAX_BYTES_SHRT_NAME + 1];
|
||||
char DegShortName[Cns_MAX_BYTES_SHRT_NAME + 1];
|
||||
|
||||
/***** Fill the list with the courses I belong to, if not filled *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
|
@ -1012,7 +1012,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
|
|||
{
|
||||
Frm_BeginForm (ActRenCrsSho);
|
||||
ParCod_PutPar (ParCod_OthHie,Crs->HieCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Crs->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Crs->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -1028,7 +1028,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
|
|||
{
|
||||
Frm_BeginForm (ActRenCrsFul);
|
||||
ParCod_PutPar (ParCod_OthHie,Crs->HieCod);
|
||||
HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Crs->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Crs->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -1147,7 +1147,7 @@ static void Crs_PutFormToCreateCourse (void)
|
|||
|
||||
/***** Course short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Crs_EditingCrs->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Crs_EditingCrs->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -1156,7 +1156,7 @@ static void Crs_PutFormToCreateCourse (void)
|
|||
|
||||
/***** Course full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Crs_EditingCrs->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Crs_EditingCrs->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -1341,10 +1341,10 @@ static void Crs_GetParsNewCourse (struct Hie_Node *Crs)
|
|||
Par_GetParText ("InsCrsCod",Crs->InstitutionalCod,Hie_MAX_BYTES_INSTITUTIONAL_COD);
|
||||
|
||||
/* Get course short name */
|
||||
Par_GetParText ("ShortName",Crs->ShrtName,Hie_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("ShortName",Crs->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get course full name */
|
||||
Par_GetParText ("FullName",Crs->FullName,Hie_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParText ("FullName",Crs->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1742,34 +1742,23 @@ void Crs_RenameCourseFull (void)
|
|||
|
||||
void Crs_RenameCourse (struct Hie_Node *Crs,Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_course_X_already_exists;
|
||||
extern const char *Txt_The_course_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
const char *ParName = NULL; // Initialized to avoid warning
|
||||
const char *FldName = NULL; // Initialized to avoid warning
|
||||
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||
char *CurrentCrsName = NULL; // Initialized to avoid warning
|
||||
char NewCrsName[Hie_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
switch (ShrtOrFullName)
|
||||
char *CurrentName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
case Cns_SHRT_NAME:
|
||||
ParName = "ShortName";
|
||||
FldName = "ShortName";
|
||||
MaxBytes = Hie_MAX_BYTES_SHRT_NAME;
|
||||
CurrentCrsName = Crs->ShrtName;
|
||||
break;
|
||||
case Cns_FULL_NAME:
|
||||
ParName = "FullName";
|
||||
FldName = "FullName";
|
||||
MaxBytes = Hie_MAX_BYTES_FULL_NAME;
|
||||
CurrentCrsName = Crs->FullName;
|
||||
break;
|
||||
}
|
||||
[Cns_SHRT_NAME] = Crs->ShrtName,
|
||||
[Cns_FULL_NAME] = Crs->FullName,
|
||||
};
|
||||
char NewName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the new name for the course */
|
||||
Par_GetParText (ParName,NewCrsName,MaxBytes);
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/***** Get from the database the data of the degree *****/
|
||||
Crs_GetCourseDataByCod (Crs);
|
||||
|
@ -1777,35 +1766,38 @@ void Crs_RenameCourse (struct Hie_Node *Crs,Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (NewCrsName[0])
|
||||
if (NewName[0])
|
||||
{
|
||||
/***** Check if old and new names are the same
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (strcmp (CurrentCrsName,NewCrsName)) // Different names
|
||||
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
|
||||
{
|
||||
/***** If course was in database... *****/
|
||||
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (ParName,NewCrsName,Crs->HieCod,
|
||||
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Crs->HieCod,
|
||||
Crs->PrtCod,Crs->Specific.Year))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_course_X_already_exists,
|
||||
NewCrsName);
|
||||
NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Crs_DB_UpdateCrsName (Crs->HieCod,FldName,NewCrsName);
|
||||
Crs_DB_UpdateCrsName (Crs->HieCod,
|
||||
Cns_FldShrtOrFullName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Create alert to show the change made */
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_course_X_has_been_renamed_as_Y,
|
||||
CurrentCrsName,NewCrsName);
|
||||
CurrentName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Change current course name in order to display it properly */
|
||||
Str_Copy (CurrentCrsName,NewCrsName,MaxBytes);
|
||||
Str_Copy (CurrentName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
Txt_The_name_X_has_not_changed,CurrentCrsName);
|
||||
Txt_The_name_X_has_not_changed,CurrentName[ShrtOrFullName]);
|
||||
}
|
||||
else
|
||||
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
||||
|
|
|
@ -161,8 +161,8 @@ long Crs_DB_GetCurrentDegCodFromCurrentCrsCod (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
void Crs_DB_GetShortNamesByCod (long CrsCod,
|
||||
char CrsShortName[Hie_MAX_BYTES_SHRT_NAME + 1],
|
||||
char DegShortName[Hie_MAX_BYTES_SHRT_NAME + 1])
|
||||
char CrsShortName[Cns_MAX_BYTES_SHRT_NAME + 1],
|
||||
char DegShortName[Cns_MAX_BYTES_SHRT_NAME + 1])
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
@ -185,8 +185,8 @@ void Crs_DB_GetShortNamesByCod (long CrsCod,
|
|||
{
|
||||
/***** Get the course short name and degree short name *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (CrsShortName,row[0],Hie_MAX_BYTES_SHRT_NAME);
|
||||
Str_Copy (DegShortName,row[1],Hie_MAX_BYTES_SHRT_NAME);
|
||||
Str_Copy (CrsShortName,row[0],Cns_MAX_BYTES_SHRT_NAME);
|
||||
Str_Copy (DegShortName,row[1],Cns_MAX_BYTES_SHRT_NAME);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
|
|
@ -43,8 +43,8 @@ unsigned Crs_DB_GetCrssInCurrentDegFull (MYSQL_RES **mysql_res);
|
|||
unsigned Crs_DB_GetCourseDataByCod (MYSQL_RES **mysql_res,long CrsCod);
|
||||
long Crs_DB_GetCurrentDegCodFromCurrentCrsCod (void);
|
||||
void Crs_DB_GetShortNamesByCod (long CrsCod,
|
||||
char CrsShortName[Hie_MAX_BYTES_SHRT_NAME + 1],
|
||||
char DegShortName[Hie_MAX_BYTES_SHRT_NAME + 1]);
|
||||
char CrsShortName[Cns_MAX_BYTES_SHRT_NAME + 1],
|
||||
char DegShortName[Cns_MAX_BYTES_SHRT_NAME + 1]);
|
||||
bool Crs_DB_CheckIfCrsCodExists (long CrsCod);
|
||||
bool Crs_DB_CheckIfCrsNameExistsInYearOfDeg (const char *FldName,const char *Name,long CrsCod,
|
||||
long DegCod,unsigned Year);
|
||||
|
|
|
@ -350,8 +350,8 @@ mysql> DESCRIBE ban_banners;
|
|||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS ban_banners ("
|
||||
"BanCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||
"ShortName VARCHAR(511) NOT NULL," // Ban_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) NOT NULL," // Ban_MAX_BYTES_FULL_NAME
|
||||
"ShortName VARCHAR(511) NOT NULL," // Cns_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) NOT NULL," // Cns_MAX_BYTES_FULL_NAME
|
||||
"Img VARCHAR(255) NOT NULL," // Ban_MAX_BYTES_IMAGE
|
||||
"WWW VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||
"UNIQUE INDEX(BanCod),"
|
||||
|
@ -374,8 +374,8 @@ mysql> DESCRIBE bld_buildings;
|
|||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS bld_buildings ("
|
||||
"BldCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"CtrCod INT NOT NULL,"
|
||||
"ShortName VARCHAR(511) NOT NULL," // Bld_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) NOT NULL," // Bld_MAX_BYTES_FULL_NAME
|
||||
"ShortName VARCHAR(511) NOT NULL," // Cns_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) NOT NULL," // Cns_MAX_BYTES_FULL_NAME
|
||||
"Location VARCHAR(2047) NOT NULL," // Bld_MAX_BYTES_LOCATION
|
||||
"UNIQUE INDEX(BldCod),"
|
||||
"INDEX(CtrCod))");
|
||||
|
@ -584,7 +584,7 @@ mysql> DESCRIBE cfe_exams;
|
|||
"CrsCod INT NOT NULL DEFAULT -1,"
|
||||
"Status TINYINT NOT NULL DEFAULT 0,"
|
||||
"NumNotif INT NOT NULL DEFAULT 0,"
|
||||
"CrsFullName VARCHAR(2047) NOT NULL," // Hie_MAX_BYTES_FULL_NAME
|
||||
"CrsFullName VARCHAR(2047) NOT NULL," // Cns_MAX_BYTES_FULL_NAME
|
||||
"Year TINYINT NOT NULL,"
|
||||
"ExamSession VARCHAR(2047) NOT NULL," // Cfe_MAX_BYTES_SESSION
|
||||
"CallDate DATETIME NOT NULL,"
|
||||
|
@ -642,8 +642,8 @@ mysql> DESCRIBE crs_courses;
|
|||
"InsCrsCod CHAR(7) NOT NULL,"
|
||||
"Status TINYINT NOT NULL DEFAULT 0,"
|
||||
"RequesterUsrCod INT NOT NULL DEFAULT -1,"
|
||||
"ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL," // Hie_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL," // Hie_MAX_BYTES_FULL_NAME
|
||||
"ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL," // Cns_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL," // Cns_MAX_BYTES_FULL_NAME
|
||||
"NumIndicators INT NOT NULL DEFAULT -1,"
|
||||
"UNIQUE INDEX(CrsCod),"
|
||||
"INDEX(DegCod,Year),"
|
||||
|
@ -977,8 +977,8 @@ mysql> DESCRIBE ctr_centers;
|
|||
"Latitude DOUBLE PRECISION NOT NULL DEFAULT 0,"
|
||||
"Longitude DOUBLE PRECISION NOT NULL DEFAULT 0,"
|
||||
"Altitude DOUBLE PRECISION NOT NULL DEFAULT 0,"
|
||||
"ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL," // Hie_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL," // Hie_MAX_BYTES_FULL_NAME
|
||||
"ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL," // Cns_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL," // Cns_MAX_BYTES_FULL_NAME
|
||||
"WWW VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||
"PhotoAttribution TEXT NOT NULL," // Med_MAX_BYTES_ATTRIBUTION
|
||||
"UNIQUE INDEX(CtrCod),"
|
||||
|
@ -1093,8 +1093,8 @@ mysql> DESCRIBE deg_degrees;
|
|||
"DegTypCod INT NOT NULL,"
|
||||
"Status TINYINT NOT NULL DEFAULT 0,"
|
||||
"RequesterUsrCod INT NOT NULL DEFAULT -1,"
|
||||
"ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL," // Hie_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL," // Hie_MAX_BYTES_FULL_NAME
|
||||
"ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL," // Cns_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL," // Cns_MAX_BYTES_FULL_NAME
|
||||
"WWW VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||
"UNIQUE INDEX(DegCod),"
|
||||
"INDEX(CtrCod),"
|
||||
|
@ -1118,8 +1118,8 @@ mysql> DESCRIBE dpt_departments;
|
|||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS dpt_departments ("
|
||||
"DptCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"InsCod INT NOT NULL,"
|
||||
"ShortName VARCHAR(511) NOT NULL," // Hie_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) NOT NULL," // Hie_MAX_BYTES_FULL_NAME
|
||||
"ShortName VARCHAR(511) NOT NULL," // Cns_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) NOT NULL," // Cns_MAX_BYTES_FULL_NAME
|
||||
"WWW VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||
"UNIQUE INDEX(DptCod),"
|
||||
"INDEX(InsCod))");
|
||||
|
@ -1852,8 +1852,8 @@ mysql> DESCRIBE ins_instits;
|
|||
"CtyCod INT NOT NULL,"
|
||||
"Status TINYINT NOT NULL DEFAULT 0,"
|
||||
"RequesterUsrCod INT NOT NULL DEFAULT -1,"
|
||||
"ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL," // Hie_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL," // Hie_MAX_BYTES_FULL_NAME
|
||||
"ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL," // Cns_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL," // Cns_MAX_BYTES_FULL_NAME
|
||||
"WWW VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||
"UNIQUE INDEX(InsCod),"
|
||||
"INDEX(CtyCod),"
|
||||
|
@ -1874,8 +1874,8 @@ mysql> DESCRIBE lnk_links;
|
|||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS lnk_links ("
|
||||
"LnkCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"ShortName VARCHAR(511) NOT NULL," // Lnk_MAX_BYTES_LINK_SHRT_NAME
|
||||
"FullName VARCHAR(2047) NOT NULL," // Lnk_MAX_BYTES_LINK_FULL_NAME
|
||||
"ShortName VARCHAR(511) NOT NULL," // Cns_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) NOT NULL," // Cns_MAX_BYTES_FULL_NAME
|
||||
"WWW VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||
"UNIQUE INDEX(LnkCod))");
|
||||
|
||||
|
@ -2434,8 +2434,8 @@ mysql> DESCRIBE plc_places;
|
|||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS plc_places ("
|
||||
"PlcCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"InsCod INT NOT NULL,"
|
||||
"ShortName VARCHAR(511) NOT NULL," // Plc_MAX_BYTES_PLACE_SHRT_NAME
|
||||
"FullName VARCHAR(2047) NOT NULL," // Plc_MAX_BYTES_PLACE_FULL_NAME
|
||||
"ShortName VARCHAR(511) NOT NULL," // Cns_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) NOT NULL," // Cns_MAX_BYTES_FULL_NAME
|
||||
"UNIQUE INDEX(PlcCod),"
|
||||
"INDEX(InsCod))");
|
||||
|
||||
|
@ -2719,8 +2719,8 @@ mysql> DESCRIBE roo_rooms;
|
|||
"'toilets',"
|
||||
"'virtual',"
|
||||
"'yard') NOT NULL DEFAULT 'no_type',"
|
||||
"ShortName VARCHAR(511) NOT NULL," // Roo_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) NOT NULL," // Roo_MAX_BYTES_FULL_NAME
|
||||
"ShortName VARCHAR(511) NOT NULL," // Cns_MAX_BYTES_SHRT_NAME
|
||||
"FullName VARCHAR(2047) NOT NULL," // Cns_MAX_BYTES_FULL_NAME
|
||||
"Capacity INT NOT NULL,"
|
||||
"UNIQUE INDEX(RooCod),"
|
||||
"INDEX(CtrCod,BldCod,Floor))");
|
||||
|
|
|
@ -384,7 +384,7 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
|
|||
{
|
||||
Frm_BeginForm (ActRenDegSho);
|
||||
ParCod_PutPar (ParCod_OthHie,DegInLst->HieCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,DegInLst->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,DegInLst->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -400,7 +400,7 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
|
|||
{
|
||||
Frm_BeginForm (ActRenDegFul);
|
||||
ParCod_PutPar (ParCod_OthHie,DegInLst->HieCod);
|
||||
HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,DegInLst->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,DegInLst->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -562,7 +562,7 @@ static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes)
|
|||
|
||||
/***** Degree short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Deg_EditingDeg->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Deg_EditingDeg->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -571,7 +571,7 @@ static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes)
|
|||
|
||||
/***** Degree full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Deg_EditingDeg->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Deg_EditingDeg->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -1081,8 +1081,8 @@ static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status)
|
|||
Deg_EditingDeg->PrtCod = Gbl.Hierarchy.Node[Hie_CTR].HieCod;
|
||||
|
||||
/* Get degree short name and full name */
|
||||
Par_GetParText ("ShortName",Deg_EditingDeg->ShrtName,Hie_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Deg_EditingDeg->FullName,Hie_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParText ("ShortName",Deg_EditingDeg->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Deg_EditingDeg->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
|
||||
/* Get degree type */
|
||||
Deg_EditingDeg->Specific.TypCod = ParCod_GetAndCheckPar (ParCod_OthDegTyp);
|
||||
|
@ -1319,67 +1319,60 @@ void Deg_RenameDegreeFull (void)
|
|||
|
||||
void Deg_RenameDegree (struct Hie_Node *Deg,Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_degree_X_already_exists;
|
||||
extern const char *Txt_The_degree_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
const char *ParName = NULL; // Initialized to avoid warning
|
||||
const char *FldName = NULL; // Initialized to avoid warning
|
||||
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||
char *CurrentDegName = NULL; // Initialized to avoid warning
|
||||
char NewDegName[Hie_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
switch (ShrtOrFullName)
|
||||
char *CurrentName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
case Cns_SHRT_NAME:
|
||||
ParName = "ShortName";
|
||||
FldName = "ShortName";
|
||||
MaxBytes = Hie_MAX_BYTES_SHRT_NAME;
|
||||
CurrentDegName = Deg->ShrtName;
|
||||
break;
|
||||
case Cns_FULL_NAME:
|
||||
ParName = "FullName";
|
||||
FldName = "FullName";
|
||||
MaxBytes = Hie_MAX_BYTES_FULL_NAME;
|
||||
CurrentDegName = Deg->FullName;
|
||||
break;
|
||||
}
|
||||
[Cns_SHRT_NAME] = Deg->ShrtName,
|
||||
[Cns_FULL_NAME] = Deg->FullName,
|
||||
};
|
||||
char NewName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the new name for the degree */
|
||||
Par_GetParText (ParName,NewDegName,MaxBytes);
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/***** Get data of degree *****/
|
||||
Deg_GetDegreeDataByCod (Deg);
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (NewDegName[0])
|
||||
if (NewName[0])
|
||||
{
|
||||
/***** Check if old and new names are the same
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (strcmp (CurrentDegName,NewDegName)) // Different names
|
||||
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
|
||||
{
|
||||
/***** If degree was in database... *****/
|
||||
if (Deg_DB_CheckIfDegNameExistsInCtr (ParName,NewDegName,Deg->HieCod,Deg->PrtCod))
|
||||
if (Deg_DB_CheckIfDegNameExistsInCtr (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Deg->HieCod,Deg->PrtCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_degree_X_already_exists,
|
||||
NewDegName);
|
||||
NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Deg_DB_UpdateDegNameDB (Deg->HieCod,FldName,NewDegName);
|
||||
Deg_DB_UpdateDegNameDB (Deg->HieCod,
|
||||
Cns_FldShrtOrFullName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Write message to show the change made */
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_degree_X_has_been_renamed_as_Y,
|
||||
CurrentDegName,NewDegName);
|
||||
CurrentName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Change current degree name in order to display it properly */
|
||||
Str_Copy (CurrentDegName,NewDegName,MaxBytes);
|
||||
Str_Copy (CurrentName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
Txt_The_name_X_has_not_changed,CurrentDegName);
|
||||
Txt_The_name_X_has_not_changed,
|
||||
CurrentName[ShrtOrFullName]);
|
||||
}
|
||||
else
|
||||
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
||||
|
@ -1647,7 +1640,7 @@ static void Deg_EditingDegreeDestructor (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
void Deg_GetUsrMainDeg (long UsrCod,
|
||||
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1],
|
||||
char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1],
|
||||
Rol_Role_t *MaxRole)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -1659,7 +1652,7 @@ void Deg_GetUsrMainDeg (long UsrCod,
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get degree name (row[0]) */
|
||||
Str_Copy (ShrtName,row[0],Hie_MAX_BYTES_SHRT_NAME);
|
||||
Str_Copy (ShrtName,row[0],Cns_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get maximum role (row[1]) */
|
||||
*MaxRole = Rol_ConvertUnsignedStrToRole (row[1]);
|
||||
|
|
|
@ -84,7 +84,7 @@ unsigned Deg_GetCachedNumDegsWithUsrs (Rol_Role_t Role);
|
|||
void Deg_ListDegsFound (MYSQL_RES **mysql_res,unsigned NumCrss);
|
||||
|
||||
void Deg_GetUsrMainDeg (long UsrCod,
|
||||
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1],
|
||||
char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1],
|
||||
Rol_Role_t *MaxRole);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -339,7 +339,7 @@ long Deg_DB_GetCtrCodOfDegreeByCod (long DegCod)
|
|||
/************* Get the short name of a degree from its code ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Deg_DB_GetShortNameOfDegreeByCod (long DegCod,char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1])
|
||||
void Deg_DB_GetShortNameOfDegreeByCod (long DegCod,char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1])
|
||||
{
|
||||
/***** Trivial check: degree code should be > 0 *****/
|
||||
if (DegCod <= 0)
|
||||
|
@ -349,7 +349,7 @@ void Deg_DB_GetShortNameOfDegreeByCod (long DegCod,char ShrtName[Hie_MAX_BYTES_S
|
|||
}
|
||||
|
||||
/***** Get the short name of a degree from database *****/
|
||||
DB_QuerySELECTString (ShrtName,Hie_MAX_BYTES_SHRT_NAME,
|
||||
DB_QuerySELECTString (ShrtName,Cns_MAX_BYTES_SHRT_NAME,
|
||||
"can not get the short name of a degree",
|
||||
"SELECT ShortName"
|
||||
" FROM deg_degrees"
|
||||
|
@ -689,7 +689,7 @@ void Deg_DB_UpdateDegTypName (long DegTypCod,
|
|||
/*****************************************************************************/
|
||||
|
||||
void Deg_DB_UpdateDegNameDB (long DegCod,const char *FldName,
|
||||
const char NewDegName[Hie_MAX_BYTES_FULL_NAME + 1])
|
||||
const char NewDegName[Cns_MAX_BYTES_FULL_NAME + 1])
|
||||
{
|
||||
DB_QueryUPDATE ("can not update the name of a degree",
|
||||
"UPDATE deg_degrees"
|
||||
|
|
|
@ -47,7 +47,7 @@ void Deg_DB_GetDegTypeNameByCod (struct DegTyp_DegreeType *DegTyp);
|
|||
unsigned Deg_DB_GetDegreeDataByCod (MYSQL_RES **mysql_res,long DegCod);
|
||||
long Deg_DB_GetInsCodOfDegreeByCod (long DegCod);
|
||||
long Deg_DB_GetCtrCodOfDegreeByCod (long DegCod);
|
||||
void Deg_DB_GetShortNameOfDegreeByCod (long DegCod,char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]);
|
||||
void Deg_DB_GetShortNameOfDegreeByCod (long DegCod,char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1]);
|
||||
bool Deg_DB_CheckIfDegreeTypeNameExists (const char *DegTypName,long DegTypCod);
|
||||
unsigned Deg_DB_GetNumDegsOfType (long DegTypCod);
|
||||
unsigned Deg_DB_GetDegsOfType (MYSQL_RES **mysql_res,long DegTypCod);
|
||||
|
@ -74,7 +74,7 @@ unsigned Deg_DB_GetNumDegsInCtr (long CtrCod);
|
|||
void Deg_DB_UpdateDegTypName (long DegTypCod,
|
||||
const char NewNameDegTyp[DegTyp_MAX_BYTES_DEGREE_TYPE_NAME + 1]);
|
||||
void Deg_DB_UpdateDegNameDB (long DegCod,const char *FldName,
|
||||
const char NewDegName[Hie_MAX_BYTES_FULL_NAME + 1]);
|
||||
const char NewDegName[Cns_MAX_BYTES_FULL_NAME + 1]);
|
||||
void Deg_DB_UpdateDegCtr (long DegCod,long NewCtrCod);
|
||||
void Deg_DB_UpdateDegTyp (long DegCod,long NewDegTypCod);
|
||||
void Deg_DB_UpdateDegWWW (long DegCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
|
||||
|
|
|
@ -536,7 +536,7 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm
|
|||
HTM_TD_Begin ("class=\"LM\"");
|
||||
Frm_BeginForm (ActRenDptSho);
|
||||
ParCod_PutPar (ParCod_Dpt,DptInLst->DptCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,DptInLst->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,DptInLst->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -547,7 +547,7 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm
|
|||
HTM_TD_Begin ("class=\"LM\"");
|
||||
Frm_BeginForm (ActRenDptFul);
|
||||
ParCod_PutPar (ParCod_Dpt,DptInLst->DptCod);
|
||||
HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,DptInLst->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,DptInLst->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -683,73 +683,66 @@ void Dpt_RenameDepartFull (void)
|
|||
|
||||
static void Dpt_RenameDepartment (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_department_X_already_exists;
|
||||
extern const char *Txt_The_department_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
const char *ParName = NULL; // Initialized to avoid warning
|
||||
const char *FldName = NULL; // Initialized to avoid warning
|
||||
size_t MaxBytes = 0; // Initialized to avoid warning
|
||||
char *CurrentDptName = NULL; // Initialized to avoid warning
|
||||
char NewDptName[Hie_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
switch (ShrtOrFullName)
|
||||
char *CurrentName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
case Cns_SHRT_NAME:
|
||||
ParName = "ShortName";
|
||||
FldName = "ShortName";
|
||||
MaxBytes = Hie_MAX_BYTES_SHRT_NAME;
|
||||
CurrentDptName = Dpt_EditingDpt->ShrtName;
|
||||
break;
|
||||
case Cns_FULL_NAME:
|
||||
ParName = "FullName";
|
||||
FldName = "FullName";
|
||||
MaxBytes = Hie_MAX_BYTES_FULL_NAME;
|
||||
CurrentDptName = Dpt_EditingDpt->FullName;
|
||||
break;
|
||||
}
|
||||
[Cns_SHRT_NAME] = Dpt_EditingDpt->ShrtName,
|
||||
[Cns_FULL_NAME] = Dpt_EditingDpt->FullName,
|
||||
};
|
||||
char NewName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the code of the department */
|
||||
Dpt_EditingDpt->DptCod = ParCod_GetAndCheckPar (ParCod_Dpt);
|
||||
|
||||
/* Get the new name for the department */
|
||||
Par_GetParText (ParName,NewDptName,MaxBytes);
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/***** Get from the database the old names of the department *****/
|
||||
Dpt_GetDepartmentDataByCod (Dpt_EditingDpt);
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (NewDptName[0])
|
||||
if (NewName[0])
|
||||
{
|
||||
/***** Check if old and new names are the same
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (strcmp (CurrentDptName,NewDptName)) // Different names
|
||||
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
|
||||
{
|
||||
/***** If degree was in database... *****/
|
||||
if (Dpt_DB_CheckIfDepartmentNameExists (ParName,NewDptName,Dpt_EditingDpt->DptCod))
|
||||
if (Dpt_DB_CheckIfDepartmentNameExists (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Dpt_EditingDpt->DptCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_department_X_already_exists,
|
||||
NewDptName);
|
||||
NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Dpt_DB_UpdateDptName (Dpt_EditingDpt->DptCod,FldName,NewDptName);
|
||||
Dpt_DB_UpdateDptName (Dpt_EditingDpt->DptCod,
|
||||
Cns_FldShrtOrFullName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Write message to show the change made */
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_department_X_has_been_renamed_as_Y,
|
||||
CurrentDptName,NewDptName);
|
||||
CurrentName[ShrtOrFullName],NewName);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
Txt_The_name_X_has_not_changed,CurrentDptName);
|
||||
Txt_The_name_X_has_not_changed,
|
||||
CurrentName[ShrtOrFullName]);
|
||||
}
|
||||
else
|
||||
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
||||
|
||||
/***** Update name *****/
|
||||
Str_Copy (CurrentDptName,NewDptName,MaxBytes);
|
||||
Str_Copy (CurrentName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -861,7 +854,7 @@ static void Dpt_PutFormToCreateDepartment (void)
|
|||
|
||||
/***** Department short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Dpt_EditingDpt->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Dpt_EditingDpt->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -870,7 +863,7 @@ static void Dpt_PutFormToCreateDepartment (void)
|
|||
|
||||
/***** Department full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Dpt_EditingDpt->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Dpt_EditingDpt->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -937,10 +930,10 @@ void Dpt_ReceiveFormNewDpt (void)
|
|||
Dpt_EditingDpt->InsCod = ParCod_GetAndCheckPar (ParCod_OthIns);
|
||||
|
||||
/* Get department short name */
|
||||
Par_GetParText ("ShortName",Dpt_EditingDpt->ShrtName,Hie_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("ShortName",Dpt_EditingDpt->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get department full name */
|
||||
Par_GetParText ("FullName",Dpt_EditingDpt->FullName,Hie_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParText ("FullName",Dpt_EditingDpt->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
|
||||
/* Get department WWW */
|
||||
Par_GetParText ("WWW",Dpt_EditingDpt->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
|
|
@ -37,8 +37,8 @@ struct Dpt_Department
|
|||
{
|
||||
long DptCod;
|
||||
long InsCod;
|
||||
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1];
|
||||
char FullName[Hie_MAX_BYTES_FULL_NAME + 1];
|
||||
char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1];
|
||||
char FullName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
unsigned NumTchs; // Non-editing teachers and teachers
|
||||
};
|
||||
|
|
|
@ -249,8 +249,8 @@ struct Globals
|
|||
struct
|
||||
{
|
||||
long HieCod;
|
||||
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1];
|
||||
char CtyName[Hie_MAX_BYTES_FULL_NAME + 1];
|
||||
char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1];
|
||||
char CtyName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
bool Valid;
|
||||
} InstitutionShrtNameAndCty;
|
||||
struct
|
||||
|
|
|
@ -67,7 +67,7 @@ struct GroupData
|
|||
struct
|
||||
{
|
||||
long RooCod; // Room code
|
||||
char ShrtName[Roo_MAX_BYTES_SHRT_NAME + 1]; // Room short name
|
||||
char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1]; // Room short name
|
||||
} Room;
|
||||
unsigned MaxStudents;
|
||||
int Vacant;
|
||||
|
@ -83,7 +83,7 @@ struct Group
|
|||
struct
|
||||
{
|
||||
long RooCod; // Room code
|
||||
char ShrtName[Roo_MAX_BYTES_SHRT_NAME + 1]; // Room short name
|
||||
char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1]; // Room short name
|
||||
} Room;
|
||||
unsigned NumUsrs[Rol_NUM_ROLES]; // Number of users in the group
|
||||
unsigned MaxStudents; // Maximum number of students in the group
|
||||
|
|
|
@ -102,7 +102,7 @@ void HieCfg_FullName (bool PutForm,Act_Action_t NextAction,Hie_Level_t Level,
|
|||
{
|
||||
/* Form to change full name */
|
||||
Frm_BeginForm (NextAction);
|
||||
HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,
|
||||
Gbl.Hierarchy.Node[Level].FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"id=\"FullName\""
|
||||
|
@ -140,7 +140,7 @@ void HieCfg_ShrtName (bool PutForm,Act_Action_t NextAction,Hie_Level_t Level)
|
|||
{
|
||||
/* Form to change short name */
|
||||
Frm_BeginForm (NextAction);
|
||||
HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,
|
||||
Gbl.Hierarchy.Node[Level].ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"id=\"ShortName\""
|
||||
|
|
|
@ -72,12 +72,6 @@ typedef enum
|
|||
#define Hie_MAX_CHARS_INSTITUTIONAL_COD (16 - 1) // 15
|
||||
#define Hie_MAX_BYTES_INSTITUTIONAL_COD ((Hie_MAX_CHARS_INSTITUTIONAL_COD + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 255
|
||||
|
||||
#define Hie_MAX_CHARS_SHRT_NAME (32 - 1) // 31
|
||||
#define Hie_MAX_BYTES_SHRT_NAME ((Hie_MAX_CHARS_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
|
||||
|
||||
#define Hie_MAX_CHARS_FULL_NAME (128 - 1) // 127
|
||||
#define Hie_MAX_BYTES_FULL_NAME ((Hie_MAX_CHARS_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
|
||||
struct Hie_MyNode
|
||||
{
|
||||
long HieCod; // Course/degree/center/institution/country code
|
||||
|
@ -98,8 +92,8 @@ struct Hie_Node
|
|||
Hie_Status_t Status; // Node status
|
||||
long RequesterUsrCod; // User code of the person who requested the creation of this node
|
||||
char InstitutionalCod[Hie_MAX_BYTES_INSTITUTIONAL_COD + 1]; // Institutional code of the node
|
||||
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]; // Short name of the node
|
||||
char FullName[Hie_MAX_BYTES_FULL_NAME + 1]; // Full name of the node
|
||||
char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1]; // Short name of the node
|
||||
char FullName[Cns_MAX_BYTES_FULL_NAME + 1]; // Full name of the node
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
struct
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ struct Hld_Holiday
|
|||
{
|
||||
long HldCod;
|
||||
long PlcCod;
|
||||
char PlaceFullName[Plc_MAX_BYTES_PLACE_FULL_NAME + 1];
|
||||
char PlaceFullName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
Hld_HolidayType_t HldTyp;
|
||||
struct Dat_Date StartDate;
|
||||
struct Dat_Date EndDate;
|
||||
|
|
|
@ -90,7 +90,7 @@ static void Ins_GetInstitDataFromRow (MYSQL_RES *mysql_res,
|
|||
static void Ins_ListInstitutionsForEdition (void);
|
||||
static bool Ins_CheckIfICanEdit (struct Hie_Node *Ins);
|
||||
|
||||
static void Ins_UpdateInsNameDB (long InsCod,const char *FldName,const char *NewInsName);
|
||||
static void Ins_UpdateInsNameDB (long InsCod,const char *FldName,const char *NewName);
|
||||
|
||||
static void Ins_ShowAlertAndButtonToGoToIns (void);
|
||||
|
||||
|
@ -638,7 +638,7 @@ void Ins_GetFullListOfInstitutions (long CtyCod)
|
|||
void Ins_WriteInstitutionNameAndCty (long InsCod)
|
||||
{
|
||||
struct Hie_Node Ins;
|
||||
char CtyName[Hie_MAX_BYTES_FULL_NAME + 1];
|
||||
char CtyName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
/***** Get institution short name and country name *****/
|
||||
Ins.HieCod = InsCod;
|
||||
|
@ -746,7 +746,7 @@ void Ins_FlushCacheFullNameAndCtyOfInstitution (void)
|
|||
}
|
||||
|
||||
void Ins_GetShrtNameAndCtyOfInstitution (struct Hie_Node *Ins,
|
||||
char CtyName[Hie_MAX_BYTES_FULL_NAME + 1])
|
||||
char CtyName[Cns_MAX_BYTES_FULL_NAME + 1])
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
@ -766,7 +766,7 @@ void Ins_GetShrtNameAndCtyOfInstitution (struct Hie_Node *Ins,
|
|||
Str_Copy (Ins->ShrtName,Gbl.Cache.InstitutionShrtNameAndCty.ShrtName,
|
||||
sizeof (Ins->ShrtName) - 1);
|
||||
Str_Copy (CtyName,Gbl.Cache.InstitutionShrtNameAndCty.CtyName,
|
||||
Hie_MAX_BYTES_FULL_NAME);
|
||||
Cns_MAX_BYTES_FULL_NAME);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -796,7 +796,7 @@ void Ins_GetShrtNameAndCtyOfInstitution (struct Hie_Node *Ins,
|
|||
Str_Copy (Ins->ShrtName,Gbl.Cache.InstitutionShrtNameAndCty.ShrtName,
|
||||
sizeof (Ins->ShrtName) - 1);
|
||||
Str_Copy (CtyName ,Gbl.Cache.InstitutionShrtNameAndCty.CtyName ,
|
||||
Hie_MAX_BYTES_FULL_NAME);
|
||||
Cns_MAX_BYTES_FULL_NAME);
|
||||
Gbl.Cache.InstitutionShrtNameAndCty.Valid = true;
|
||||
}
|
||||
|
||||
|
@ -946,7 +946,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
|||
{
|
||||
Frm_BeginForm (ActRenInsSho);
|
||||
ParCod_PutPar (ParCod_OthHie,Ins->HieCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Ins->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Ins->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -962,7 +962,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
|||
{
|
||||
Frm_BeginForm (ActRenInsFul);
|
||||
ParCod_PutPar (ParCod_OthHie,Ins->HieCod);
|
||||
HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Ins->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Ins->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -1160,67 +1160,60 @@ void Ins_RenameInsFull (void)
|
|||
|
||||
void Ins_RenameInstitution (struct Hie_Node *Ins,Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_institution_X_already_exists;
|
||||
extern const char *Txt_The_institution_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
const char *ParName = NULL; // Initialized to avoid warning
|
||||
const char *FldName = NULL; // Initialized to avoid warning
|
||||
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||
char *CurrentInsName = NULL; // Initialized to avoid warning
|
||||
char NewInsName[Hie_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
switch (ShrtOrFullName)
|
||||
char *CurrentName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
case Cns_SHRT_NAME:
|
||||
ParName = "ShortName";
|
||||
FldName = "ShortName";
|
||||
MaxBytes = Hie_MAX_BYTES_SHRT_NAME;
|
||||
CurrentInsName = Ins->ShrtName;
|
||||
break;
|
||||
case Cns_FULL_NAME:
|
||||
ParName = "FullName";
|
||||
FldName = "FullName";
|
||||
MaxBytes = Hie_MAX_BYTES_FULL_NAME;
|
||||
CurrentInsName = Ins->FullName;
|
||||
break;
|
||||
}
|
||||
[Cns_SHRT_NAME] = Ins->ShrtName,
|
||||
[Cns_FULL_NAME] = Ins->FullName,
|
||||
};
|
||||
char NewName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
/***** Get the new name for the institution from form *****/
|
||||
Par_GetParText (ParName,NewInsName,MaxBytes);
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/***** Get from the database the old names of the institution *****/
|
||||
Ins_GetInstitDataByCod (Ins);
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (NewInsName[0])
|
||||
if (NewName[0])
|
||||
{
|
||||
/***** Check if old and new names are the same
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (strcmp (CurrentInsName,NewInsName)) // Different names
|
||||
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
|
||||
{
|
||||
/***** If institution was in database... *****/
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty (ParName,NewInsName,Ins->HieCod,
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Ins->HieCod,
|
||||
Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
NewInsName);
|
||||
NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Ins_UpdateInsNameDB (Ins->HieCod,FldName,NewInsName);
|
||||
Ins_UpdateInsNameDB (Ins->HieCod,
|
||||
Cns_FldShrtOrFullName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Create message to show the change made */
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_institution_X_has_been_renamed_as_Y,
|
||||
CurrentInsName,NewInsName);
|
||||
CurrentName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Change current institution name in order to display it properly */
|
||||
Str_Copy (CurrentInsName,NewInsName,MaxBytes);
|
||||
Str_Copy (CurrentName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
Txt_The_name_X_has_not_changed,CurrentInsName);
|
||||
Txt_The_name_X_has_not_changed,
|
||||
CurrentName[ShrtOrFullName]);
|
||||
}
|
||||
else
|
||||
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
||||
|
@ -1230,10 +1223,10 @@ void Ins_RenameInstitution (struct Hie_Node *Ins,Cns_ShrtOrFullName_t ShrtOrFull
|
|||
/************ Update institution name in table of institutions ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Ins_UpdateInsNameDB (long InsCod,const char *FldName,const char *NewInsName)
|
||||
static void Ins_UpdateInsNameDB (long InsCod,const char *FldName,const char *NewName)
|
||||
{
|
||||
/***** Update institution changing old name by new name */
|
||||
Ins_DB_UpdateInsName (InsCod,FldName,NewInsName);
|
||||
Ins_DB_UpdateInsName (InsCod,FldName,NewName);
|
||||
|
||||
/***** Flush caches *****/
|
||||
Ins_FlushCacheFullNameAndCtyOfInstitution ();
|
||||
|
@ -1392,7 +1385,7 @@ static void Ins_PutFormToCreateInstitution (void)
|
|||
|
||||
/***** Institution short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Ins_EditingIns->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Ins_EditingIns->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -1401,7 +1394,7 @@ static void Ins_PutFormToCreateInstitution (void)
|
|||
|
||||
/***** Institution full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Ins_EditingIns->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Ins_EditingIns->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -1523,8 +1516,8 @@ static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status)
|
|||
Ins_EditingIns->PrtCod = Gbl.Hierarchy.Node[Hie_CTY].HieCod;
|
||||
|
||||
/* Get institution short name, full name and WWW */
|
||||
Par_GetParText ("ShortName",Ins_EditingIns->ShrtName,Hie_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Ins_EditingIns->FullName,Hie_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParText ("ShortName",Ins_EditingIns->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Ins_EditingIns->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParText ("WWW" ,Ins_EditingIns->WWW ,Cns_MAX_BYTES_WWW);
|
||||
|
||||
if (Ins_EditingIns->ShrtName[0] &&
|
||||
|
|
|
@ -51,7 +51,7 @@ void Ins_WriteInstitutionNameAndCty (long InsCod);
|
|||
bool Ins_GetInstitDataByCod (struct Hie_Node *Ins);
|
||||
void Ins_FlushCacheFullNameAndCtyOfInstitution (void);
|
||||
void Ins_GetShrtNameAndCtyOfInstitution (struct Hie_Node *Ins,
|
||||
char CtyName[Hie_MAX_BYTES_FULL_NAME + 1]);
|
||||
char CtyName[Cns_MAX_BYTES_FULL_NAME + 1]);
|
||||
|
||||
void Ins_WriteSelectorOfInstitution (void);
|
||||
|
||||
|
|
|
@ -97,14 +97,14 @@ void Ins_DB_UpdateInsStatus (long InsCod,Hie_Status_t Status)
|
|||
/*************************** Update institution name *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ins_DB_UpdateInsName (long InsCod,const char *FldName,const char *NewInsName)
|
||||
void Ins_DB_UpdateInsName (long InsCod,const char *FldName,const char *NewName)
|
||||
{
|
||||
/***** Update institution changing old name by new name */
|
||||
DB_QueryUPDATE ("can not update the name of an institution",
|
||||
"UPDATE ins_instits"
|
||||
" SET %s='%s'"
|
||||
" WHERE InsCod=%ld",
|
||||
FldName,NewInsName,
|
||||
FldName,NewName,
|
||||
InsCod);
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ unsigned Ins_DB_GetInsDataByCod (MYSQL_RES **mysql_res,long InsCod)
|
|||
/*********** Get the short name of an institution from its code **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ins_DB_GetInsShrtName (long InsCod,char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1])
|
||||
void Ins_DB_GetInsShrtName (long InsCod,char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1])
|
||||
{
|
||||
/***** Trivial check: institution code should be > 0 *****/
|
||||
if (InsCod <= 0)
|
||||
|
@ -158,7 +158,7 @@ void Ins_DB_GetInsShrtName (long InsCod,char ShrtName[Hie_MAX_BYTES_SHRT_NAME +
|
|||
}
|
||||
|
||||
/***** Get short name of institution from database *****/
|
||||
DB_QuerySELECTString (ShrtName,Hie_MAX_BYTES_SHRT_NAME,
|
||||
DB_QuerySELECTString (ShrtName,Cns_MAX_BYTES_SHRT_NAME,
|
||||
"can not get the short name of an institution",
|
||||
"SELECT ShortName"
|
||||
" FROM ins_instits"
|
||||
|
|
|
@ -40,11 +40,11 @@
|
|||
long Ins_DB_CreateInstitution (const struct Hie_Node *Ins,Hie_Status_t Status);
|
||||
void Ins_DB_UpdateInsCty (long InsCod,long CtyCod);
|
||||
void Ins_DB_UpdateInsStatus (long InsCod,Hie_Status_t Status);
|
||||
void Ins_DB_UpdateInsName (long InsCod,const char *FldName,const char *NewInsName);
|
||||
void Ins_DB_UpdateInsName (long InsCod,const char *FldName,const char *NewName);
|
||||
void Ins_DB_UpdateInsWWW (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
|
||||
|
||||
unsigned Ins_DB_GetInsDataByCod (MYSQL_RES **mysql_res,long InsCod);
|
||||
void Ins_DB_GetInsShrtName (long InsCod,char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]);
|
||||
void Ins_DB_GetInsShrtName (long InsCod,char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1]);
|
||||
unsigned Ins_DB_GetInsShrtNameAndCty (MYSQL_RES **mysql_res,long InsCod);
|
||||
bool Ins_DB_CheckIfInsNameExistsInCty (const char *FldName,
|
||||
const char *Name,
|
||||
|
|
63
swad_link.c
63
swad_link.c
|
@ -430,7 +430,7 @@ static void Lnk_ListLinksForEdition (const struct Lnk_Links *Links)
|
|||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActRenLnkSho);
|
||||
ParCod_PutPar (ParCod_Lnk,Lnk->LnkCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Lnk_MAX_CHARS_LINK_SHRT_NAME,Lnk->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Lnk->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -442,7 +442,7 @@ static void Lnk_ListLinksForEdition (const struct Lnk_Links *Links)
|
|||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActRenLnkFul);
|
||||
ParCod_PutPar (ParCod_Lnk,Lnk->LnkCod);
|
||||
HTM_INPUT_TEXT ("FullName",Lnk_MAX_CHARS_LINK_FULL_NAME,Lnk->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Lnk->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -536,73 +536,66 @@ void Lnk_RenameLinkFull (void)
|
|||
|
||||
static void Lnk_RenameLink (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_link_X_already_exists;
|
||||
extern const char *Txt_The_link_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
const char *ParName = NULL; // Initialized to avoid warning
|
||||
const char *FldName = NULL; // Initialized to avoid warning
|
||||
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||
char *CurrentLnkName = NULL; // Initialized to avoid warning
|
||||
char NewLnkName[Lnk_MAX_BYTES_LINK_FULL_NAME + 1];
|
||||
|
||||
switch (ShrtOrFullName)
|
||||
char *CurrentName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
case Cns_SHRT_NAME:
|
||||
ParName = "ShortName";
|
||||
FldName = "ShortName";
|
||||
MaxBytes = Lnk_MAX_BYTES_LINK_SHRT_NAME;
|
||||
CurrentLnkName = Lnk_EditingLnk->ShrtName;
|
||||
break;
|
||||
case Cns_FULL_NAME:
|
||||
ParName = "FullName";
|
||||
FldName = "FullName";
|
||||
MaxBytes = Lnk_MAX_BYTES_LINK_FULL_NAME;
|
||||
CurrentLnkName = Lnk_EditingLnk->FullName;
|
||||
break;
|
||||
}
|
||||
[Cns_SHRT_NAME] = Lnk_EditingLnk->ShrtName,
|
||||
[Cns_FULL_NAME] = Lnk_EditingLnk->FullName,
|
||||
};
|
||||
char NewName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the code of the link */
|
||||
Lnk_EditingLnk->LnkCod = ParCod_GetAndCheckPar (ParCod_Lnk);
|
||||
|
||||
/* Get the new name for the link */
|
||||
Par_GetParText (ParName,NewLnkName,MaxBytes);
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/***** Get link data from the database *****/
|
||||
Lnk_GetLinkDataByCod (Lnk_EditingLnk);
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (NewLnkName[0])
|
||||
if (NewName[0])
|
||||
{
|
||||
/***** Check if old and new names are the same
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (strcmp (CurrentLnkName,NewLnkName)) // Different names
|
||||
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
|
||||
{
|
||||
/***** If link was in database... *****/
|
||||
if (Lnk_DB_CheckIfLinkNameExists (ParName,NewLnkName,Lnk_EditingLnk->LnkCod))
|
||||
if (Lnk_DB_CheckIfLinkNameExists (Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName,Lnk_EditingLnk->LnkCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_link_X_already_exists,
|
||||
NewLnkName);
|
||||
NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Lnk_DB_UpdateLnkName (Lnk_EditingLnk->LnkCod,FldName,NewLnkName);
|
||||
Lnk_DB_UpdateLnkName (Lnk_EditingLnk->LnkCod,
|
||||
Cns_FldShrtOrFullName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Write message to show the change made */
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_link_X_has_been_renamed_as_Y,
|
||||
CurrentLnkName,NewLnkName);
|
||||
CurrentName[ShrtOrFullName],NewName);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
Txt_The_name_X_has_not_changed,CurrentLnkName);
|
||||
Txt_The_name_X_has_not_changed,
|
||||
CurrentName[ShrtOrFullName]);
|
||||
}
|
||||
else
|
||||
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
||||
|
||||
/***** Update name *****/
|
||||
Str_Copy (CurrentLnkName,NewLnkName,MaxBytes);
|
||||
Str_Copy (CurrentName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -685,7 +678,7 @@ static void Lnk_PutFormToCreateLink (void)
|
|||
|
||||
/***** Link short name *****/
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Lnk_MAX_CHARS_LINK_SHRT_NAME,Lnk_EditingLnk->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Lnk_EditingLnk->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -694,7 +687,7 @@ static void Lnk_PutFormToCreateLink (void)
|
|||
|
||||
/***** Link full name *****/
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Lnk_MAX_CHARS_LINK_FULL_NAME,Lnk_EditingLnk->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Lnk_EditingLnk->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -750,10 +743,10 @@ void Lnk_ReceiveFormNewLink (void)
|
|||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get link short name */
|
||||
Par_GetParText ("ShortName",Lnk_EditingLnk->ShrtName,Lnk_MAX_BYTES_LINK_SHRT_NAME);
|
||||
Par_GetParText ("ShortName",Lnk_EditingLnk->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get link full name */
|
||||
Par_GetParText ("FullName",Lnk_EditingLnk->FullName,Lnk_MAX_BYTES_LINK_FULL_NAME);
|
||||
Par_GetParText ("FullName",Lnk_EditingLnk->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
|
||||
/* Get link URL */
|
||||
Par_GetParText ("WWW",Lnk_EditingLnk->WWW,Cns_MAX_BYTES_WWW);
|
||||
|
|
10
swad_link.h
10
swad_link.h
|
@ -27,17 +27,11 @@
|
|||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Lnk_MAX_CHARS_LINK_SHRT_NAME (32 - 1) // 31
|
||||
#define Lnk_MAX_BYTES_LINK_SHRT_NAME ((Lnk_MAX_CHARS_LINK_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
|
||||
|
||||
#define Lnk_MAX_CHARS_LINK_FULL_NAME (128 - 1) // 127
|
||||
#define Lnk_MAX_BYTES_LINK_FULL_NAME ((Lnk_MAX_CHARS_LINK_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
|
||||
struct Lnk_Link
|
||||
{
|
||||
long LnkCod;
|
||||
char ShrtName[Lnk_MAX_BYTES_LINK_SHRT_NAME + 1];
|
||||
char FullName[Lnk_MAX_BYTES_LINK_FULL_NAME + 1];
|
||||
char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1];
|
||||
char FullName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
};
|
||||
|
||||
|
|
58
swad_mail.c
58
swad_mail.c
|
@ -590,71 +590,71 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName)
|
|||
extern const char *Txt_The_email_domain_X_already_exists;
|
||||
extern const char *Txt_The_email_domain_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_email_domain_X_has_not_changed;
|
||||
const char *ParName = NULL; // Initialized to avoid warning
|
||||
const char *FldName = NULL; // Initialized to avoid warning
|
||||
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||
char *CurrentMaiName = NULL; // Initialized to avoid warning
|
||||
char NewMaiName[Mai_MAX_BYTES_MAIL_INFO + 1];
|
||||
|
||||
switch (ShrtOrFullName)
|
||||
static const char *ParName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
case Cns_SHRT_NAME:
|
||||
ParName = "Domain";
|
||||
FldName = "Domain";
|
||||
MaxBytes = Cns_MAX_BYTES_EMAIL_ADDRESS;
|
||||
CurrentMaiName = Mai_EditingMai->Domain;
|
||||
break;
|
||||
case Cns_FULL_NAME:
|
||||
ParName = "Info";
|
||||
FldName = "Info";
|
||||
MaxBytes = Mai_MAX_BYTES_MAIL_INFO;
|
||||
CurrentMaiName = Mai_EditingMai->Info;
|
||||
break;
|
||||
}
|
||||
[Cns_SHRT_NAME] = "Domain",
|
||||
[Cns_FULL_NAME] = "Info",
|
||||
};
|
||||
static const char *FldName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = "Domain",
|
||||
[Cns_FULL_NAME] = "Info",
|
||||
};
|
||||
static unsigned MaxBytes[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Cns_MAX_BYTES_EMAIL_ADDRESS,
|
||||
[Cns_FULL_NAME] = Mai_MAX_BYTES_MAIL_INFO,
|
||||
};
|
||||
char *CurrentName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
[Cns_SHRT_NAME] = Mai_EditingMai->Domain,
|
||||
[Cns_FULL_NAME] = Mai_EditingMai->Info,
|
||||
};
|
||||
char NewName[Mai_MAX_BYTES_MAIL_INFO + 1];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the code of the mail */
|
||||
Mai_EditingMai->MaiCod = ParCod_GetAndCheckPar (ParCod_Mai);
|
||||
|
||||
/* Get the new name for the mail */
|
||||
Par_GetParText (ParName,NewMaiName,MaxBytes);
|
||||
Par_GetParText (ParName[ShrtOrFullName],NewName,MaxBytes[ShrtOrFullName]);
|
||||
|
||||
/***** Get from the database the old names of the mail *****/
|
||||
Mai_GetMailDomainDataByCod (Mai_EditingMai);
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (NewMaiName[0])
|
||||
if (NewName[0])
|
||||
{
|
||||
/***** Check if old and new names are the same
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (strcmp (CurrentMaiName,NewMaiName)) // Different names
|
||||
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
|
||||
{
|
||||
/***** If mail was in database... *****/
|
||||
if (Mai_DB_CheckIfMailDomainNameExists (ParName,NewMaiName,Mai_EditingMai->MaiCod))
|
||||
if (Mai_DB_CheckIfMailDomainNameExists (ParName[ShrtOrFullName],NewName,Mai_EditingMai->MaiCod))
|
||||
Ale_CreateAlert (Ale_WARNING,Mai_EMAIL_SECTION_ID,
|
||||
Txt_The_email_domain_X_already_exists,
|
||||
NewMaiName);
|
||||
NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Mai_DB_UpdateMailDomainName (Mai_EditingMai->MaiCod,FldName,NewMaiName);
|
||||
Mai_DB_UpdateMailDomainName (Mai_EditingMai->MaiCod,FldName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Write message to show the change made */
|
||||
Ale_CreateAlert (Ale_SUCCESS,Mai_EMAIL_SECTION_ID,
|
||||
Txt_The_email_domain_X_has_been_renamed_as_Y,
|
||||
CurrentMaiName,NewMaiName);
|
||||
CurrentName[ShrtOrFullName],NewName);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
Ale_CreateAlert (Ale_INFO,Mai_EMAIL_SECTION_ID,
|
||||
Txt_The_email_domain_X_has_not_changed,
|
||||
CurrentMaiName);
|
||||
CurrentName[ShrtOrFullName]);
|
||||
}
|
||||
else
|
||||
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
||||
|
||||
/***** Update name *****/
|
||||
Str_Copy (CurrentMaiName,NewMaiName,MaxBytes);
|
||||
Str_Copy (CurrentName[ShrtOrFullName],NewName,MaxBytes[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -63,7 +63,7 @@ typedef enum
|
|||
struct Msg_Course
|
||||
{
|
||||
long CrsCod;
|
||||
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1];
|
||||
char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1];
|
||||
}; // Distinct courses in my messages sent or received
|
||||
|
||||
struct Msg_Messages
|
||||
|
@ -72,7 +72,7 @@ struct Msg_Messages
|
|||
unsigned NumMsgs;
|
||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
|
||||
long FilterCrsCod; // Show only messages sent from this course code
|
||||
char FilterCrsShrtName[Hie_MAX_BYTES_SHRT_NAME + 1];
|
||||
char FilterCrsShrtName[Cns_MAX_BYTES_SHRT_NAME + 1];
|
||||
char FilterFromTo[Usr_MAX_BYTES_FULL_NAME + 1]; // Show only messages from/to these users
|
||||
char FilterContent[Msg_MAX_BYTES_FILTER_CONTENT + 1]; // Show only messages that match this content
|
||||
bool ShowOnlyUnreadMsgs; // Show only unread messages (this option is applicable only for received messages)
|
||||
|
|
|
@ -1072,9 +1072,9 @@ void Pho_BuildHTMLUsrPhoto (const struct Usr_Data *UsrDat,const char *PhotoURL,
|
|||
bool PutZoomCode = (Zoom == Pho_ZOOM) && // Make zoom
|
||||
BrowserTabIs1stTab; // Only in main browser tab (or AJAX)
|
||||
char IdCaption[Frm_MAX_BYTES_ID + 1];
|
||||
char CtyName[Hie_MAX_BYTES_FULL_NAME + 1];
|
||||
char CtyName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
struct Hie_Node Ins;
|
||||
char MainDegreeShrtName[Hie_MAX_BYTES_SHRT_NAME + 1];
|
||||
char MainDegreeShrtName[Cns_MAX_BYTES_SHRT_NAME + 1];
|
||||
Rol_Role_t MaxRole; // Maximum user's role in his/her main degree
|
||||
struct
|
||||
{
|
||||
|
@ -2368,7 +2368,7 @@ static void Pho_ShowDegreeAvgPhotoAndStat (const struct Hie_Node *Deg,
|
|||
unsigned PhotoHeight;
|
||||
char PathRelAvgPhoto[PATH_MAX + 1];
|
||||
char PhotoURL[Cns_MAX_BYTES_WWW + 1];
|
||||
char PhotoCaption[1024 + Hie_MAX_BYTES_SHRT_NAME];
|
||||
char PhotoCaption[1024 + Cns_MAX_BYTES_SHRT_NAME];
|
||||
bool ShowDegPhoto;
|
||||
char IdCaption[Frm_MAX_BYTES_ID + 1];
|
||||
|
||||
|
|
64
swad_place.c
64
swad_place.c
|
@ -481,7 +481,7 @@ static void Plc_ListPlacesForEdition (const struct Plc_Places *Places)
|
|||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActRenPlcSho);
|
||||
ParCod_PutPar (ParCod_Plc,Plc->PlcCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Plc_MAX_CHARS_PLACE_SHRT_NAME,Plc->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Plc->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -492,7 +492,7 @@ static void Plc_ListPlacesForEdition (const struct Plc_Places *Places)
|
|||
HTM_TD_Begin ("class=\"CM\"");
|
||||
Frm_BeginForm (ActRenPlcFul);
|
||||
ParCod_PutPar (ParCod_Plc,Plc->PlcCod);
|
||||
HTM_INPUT_TEXT ("FullName",Plc_MAX_CHARS_PLACE_FULL_NAME,Plc->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Plc->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -587,73 +587,67 @@ void Plc_RenamePlaceFull (void)
|
|||
|
||||
static void Plc_RenamePlace (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_place_X_already_exists;
|
||||
extern const char *Txt_The_place_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
const char *ParName = NULL; // Initialized to avoid warning
|
||||
const char *FldName = NULL; // Initialized to avoid warning
|
||||
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||
char *CurrentPlcName = NULL; // Initialized to avoid warning
|
||||
char NewPlcName[Plc_MAX_BYTES_PLACE_FULL_NAME + 1];
|
||||
|
||||
switch (ShrtOrFullName)
|
||||
char *CurrentName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
case Cns_SHRT_NAME:
|
||||
ParName = "ShortName";
|
||||
FldName = "ShortName";
|
||||
MaxBytes = Plc_MAX_BYTES_PLACE_SHRT_NAME;
|
||||
CurrentPlcName = Plc_EditingPlc->ShrtName;
|
||||
break;
|
||||
case Cns_FULL_NAME:
|
||||
ParName = "FullName";
|
||||
FldName = "FullName";
|
||||
MaxBytes = Plc_MAX_BYTES_PLACE_FULL_NAME;
|
||||
CurrentPlcName = Plc_EditingPlc->FullName;
|
||||
break;
|
||||
}
|
||||
[Cns_SHRT_NAME] = Plc_EditingPlc->ShrtName,
|
||||
[Cns_FULL_NAME] = Plc_EditingPlc->FullName,
|
||||
};
|
||||
char NewName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get the code of the place */
|
||||
Plc_EditingPlc->PlcCod = ParCod_GetAndCheckPar (ParCod_Plc);
|
||||
|
||||
/* Get the new name for the place */
|
||||
Par_GetParText (ParName,NewPlcName,MaxBytes);
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/***** Get place old names from database *****/
|
||||
Plc_GetPlaceDataByCod (Plc_EditingPlc);
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (NewPlcName[0])
|
||||
if (NewName[0])
|
||||
{
|
||||
/***** Check if old and new names are the same
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (strcmp (CurrentPlcName,NewPlcName)) // Different names
|
||||
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
|
||||
{
|
||||
/***** If place was in database... *****/
|
||||
if (Plc_DB_CheckIfPlaceNameExists (Plc_EditingPlc->PlcCod,ParName,NewPlcName))
|
||||
if (Plc_DB_CheckIfPlaceNameExists (Plc_EditingPlc->PlcCod,
|
||||
Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_place_X_already_exists,
|
||||
NewPlcName);
|
||||
NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Plc_DB_UpdatePlcName (Plc_EditingPlc->PlcCod,FldName,NewPlcName);
|
||||
Plc_DB_UpdatePlcName (Plc_EditingPlc->PlcCod,
|
||||
Cns_FldShrtOrFullName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Write message to show the change made */
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_place_X_has_been_renamed_as_Y,
|
||||
CurrentPlcName,NewPlcName);
|
||||
CurrentName[ShrtOrFullName],NewName);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
Txt_The_name_X_has_not_changed,CurrentPlcName);
|
||||
Txt_The_name_X_has_not_changed,
|
||||
CurrentName[ShrtOrFullName]);
|
||||
}
|
||||
else
|
||||
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
||||
|
||||
/***** Update place name *****/
|
||||
Str_Copy (CurrentPlcName,NewPlcName,MaxBytes);
|
||||
Str_Copy (CurrentName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -696,7 +690,7 @@ static void Plc_PutFormToCreatePlace (void)
|
|||
|
||||
/***** Place short name *****/
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Plc_MAX_CHARS_PLACE_SHRT_NAME,Plc_EditingPlc->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Plc_EditingPlc->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -705,7 +699,7 @@ static void Plc_PutFormToCreatePlace (void)
|
|||
|
||||
/***** Place full name *****/
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Plc_MAX_CHARS_PLACE_FULL_NAME,Plc_EditingPlc->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Plc_EditingPlc->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -757,10 +751,10 @@ void Plc_ReceiveFormNewPlace (void)
|
|||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get place short name */
|
||||
Par_GetParText ("ShortName",Plc_EditingPlc->ShrtName,Plc_MAX_BYTES_PLACE_SHRT_NAME);
|
||||
Par_GetParText ("ShortName",Plc_EditingPlc->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
|
||||
/* Get place full name */
|
||||
Par_GetParText ("FullName",Plc_EditingPlc->FullName,Plc_MAX_BYTES_PLACE_FULL_NAME);
|
||||
Par_GetParText ("FullName",Plc_EditingPlc->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
|
||||
if (Plc_EditingPlc->ShrtName[0] &&
|
||||
Plc_EditingPlc->FullName[0]) // If there's a place name
|
||||
|
|
10
swad_place.h
10
swad_place.h
|
@ -33,18 +33,12 @@
|
|||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Plc_MAX_CHARS_PLACE_SHRT_NAME (32 - 1) // 31
|
||||
#define Plc_MAX_BYTES_PLACE_SHRT_NAME ((Plc_MAX_CHARS_PLACE_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
|
||||
|
||||
#define Plc_MAX_CHARS_PLACE_FULL_NAME (128 - 1) // 127
|
||||
#define Plc_MAX_BYTES_PLACE_FULL_NAME ((Plc_MAX_CHARS_PLACE_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
|
||||
struct Plc_Place
|
||||
{
|
||||
long PlcCod;
|
||||
long InsCod;
|
||||
char ShrtName[Plc_MAX_BYTES_PLACE_SHRT_NAME + 1];
|
||||
char FullName[Plc_MAX_BYTES_PLACE_FULL_NAME + 1];
|
||||
char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1];
|
||||
char FullName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
unsigned NumCtrs;
|
||||
};
|
||||
|
||||
|
|
|
@ -484,7 +484,7 @@ static void Rep_WriteSectionUsrInfo (void)
|
|||
extern const char *Txt_Email;
|
||||
extern const char *Txt_Country;
|
||||
extern const char *Txt_Institution;
|
||||
char CtyName[Hie_MAX_BYTES_FULL_NAME + 1];
|
||||
char CtyName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
struct Hie_Node Ins;
|
||||
|
||||
/***** Begin section *****/
|
||||
|
|
63
swad_room.c
63
swad_room.c
|
@ -696,7 +696,7 @@ static void Roo_ListRoomsForEdition (const struct Bld_Buildings *Buildings,
|
|||
HTM_TD_Begin ("class=\"LT\"");
|
||||
Frm_BeginFormAnchor (ActRenRooSho,Anchor);
|
||||
ParCod_PutPar (ParCod_Roo,Room->RooCod);
|
||||
HTM_INPUT_TEXT ("ShortName",Roo_MAX_CHARS_SHRT_NAME,Room->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Room->ShrtName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"size=\"10\""
|
||||
" class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
||||
|
@ -708,7 +708,7 @@ static void Roo_ListRoomsForEdition (const struct Bld_Buildings *Buildings,
|
|||
HTM_TD_Begin ("class=\"LT\"");
|
||||
Frm_BeginFormAnchor (ActRenRooFul,Anchor);
|
||||
ParCod_PutPar (ParCod_Roo,Room->RooCod);
|
||||
HTM_INPUT_TEXT ("FullName",Roo_MAX_CHARS_FULL_NAME,Room->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Room->FullName,
|
||||
HTM_SUBMIT_ON_CHANGE,
|
||||
"size=\"20\""
|
||||
" class=\"INPUT_FULL_NAME INPUT_%s\"",
|
||||
|
@ -1056,75 +1056,68 @@ void Roo_RenameRoomFull (void)
|
|||
|
||||
static void Roo_RenameRoom (Cns_ShrtOrFullName_t ShrtOrFullName)
|
||||
{
|
||||
extern const char *Cns_ParShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Cns_FldShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern unsigned Cns_MaxBytesShrtOrFullName[Cns_NUM_SHRT_FULL_NAMES];
|
||||
extern const char *Txt_The_room_X_already_exists;
|
||||
extern const char *Txt_The_room_X_has_been_renamed_as_Y;
|
||||
extern const char *Txt_The_name_X_has_not_changed;
|
||||
const char *ParName = NULL; // Initialized to avoid warning
|
||||
const char *FldName = NULL; // Initialized to avoid warning
|
||||
unsigned MaxBytes = 0; // Initialized to avoid warning
|
||||
char *CurrentClaName = NULL; // Initialized to avoid warning
|
||||
char NewClaName[Roo_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
switch (ShrtOrFullName)
|
||||
char *CurrentName[Cns_NUM_SHRT_FULL_NAMES] =
|
||||
{
|
||||
case Cns_SHRT_NAME:
|
||||
ParName = "ShortName";
|
||||
FldName = "ShortName";
|
||||
MaxBytes = Roo_MAX_BYTES_SHRT_NAME;
|
||||
CurrentClaName = Roo_EditingRoom->ShrtName;
|
||||
break;
|
||||
case Cns_FULL_NAME:
|
||||
ParName = "FullName";
|
||||
FldName = "FullName";
|
||||
MaxBytes = Roo_MAX_BYTES_FULL_NAME;
|
||||
CurrentClaName = Roo_EditingRoom->FullName;
|
||||
break;
|
||||
}
|
||||
[Cns_SHRT_NAME] = Roo_EditingRoom->ShrtName,
|
||||
[Cns_FULL_NAME] = Roo_EditingRoom->FullName,
|
||||
};
|
||||
char NewName[Cns_MAX_BYTES_FULL_NAME + 1];
|
||||
|
||||
/***** Get parameters from form *****/
|
||||
/* Get room code */
|
||||
Roo_EditingRoom->RooCod = ParCod_GetAndCheckPar (ParCod_Roo);
|
||||
|
||||
/* Get the new name for the room */
|
||||
Par_GetParText (ParName,NewClaName,MaxBytes);
|
||||
Par_GetParText (Cns_ParShrtOrFullName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
|
||||
/***** Get from the database the old names of the room *****/
|
||||
Roo_GetRoomDataByCod (Roo_EditingRoom);
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (NewClaName[0])
|
||||
if (NewName[0])
|
||||
{
|
||||
/***** Check if old and new names are the same
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (strcmp (CurrentClaName,NewClaName)) // Different names
|
||||
if (strcmp (CurrentName[ShrtOrFullName],NewName)) // Different names
|
||||
{
|
||||
/***** If room was in database... *****/
|
||||
if (Roo_DB_CheckIfRoomNameExists (Gbl.Hierarchy.Node[Hie_CTR].HieCod,
|
||||
Roo_EditingRoom->RooCod,
|
||||
ParName,NewClaName))
|
||||
Cns_ParShrtOrFullName[ShrtOrFullName],
|
||||
NewName))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_room_X_already_exists,
|
||||
NewClaName);
|
||||
NewName);
|
||||
else
|
||||
{
|
||||
/* Update the table changing old name by new name */
|
||||
Roo_DB_UpdateRoomName (Roo_EditingRoom->RooCod,FldName,NewClaName);
|
||||
Roo_DB_UpdateRoomName (Roo_EditingRoom->RooCod,
|
||||
Cns_FldShrtOrFullName[ShrtOrFullName],NewName);
|
||||
|
||||
/* Write message to show the change made */
|
||||
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
||||
Txt_The_room_X_has_been_renamed_as_Y,
|
||||
CurrentClaName,NewClaName);
|
||||
CurrentName[ShrtOrFullName],NewName);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
Ale_CreateAlert (Ale_INFO,NULL,
|
||||
Txt_The_name_X_has_not_changed,CurrentClaName);
|
||||
Txt_The_name_X_has_not_changed,
|
||||
CurrentName[ShrtOrFullName]);
|
||||
}
|
||||
else
|
||||
Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
|
||||
|
||||
/***** Update room name *****/
|
||||
Str_Copy (CurrentClaName,NewClaName,MaxBytes);
|
||||
Str_Copy (CurrentName[ShrtOrFullName],NewName,
|
||||
Cns_MaxBytesShrtOrFullName[ShrtOrFullName]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1255,7 +1248,7 @@ static void Roo_PutFormToCreateRoom (const struct Bld_Buildings *Buildings)
|
|||
|
||||
/***** Room short name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("ShortName",Roo_MAX_CHARS_SHRT_NAME,Roo_EditingRoom->ShrtName,
|
||||
HTM_INPUT_TEXT ("ShortName",Cns_MAX_CHARS_SHRT_NAME,Roo_EditingRoom->ShrtName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"size=\"10\" class=\"INPUT_SHORT_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -1264,7 +1257,7 @@ static void Roo_PutFormToCreateRoom (const struct Bld_Buildings *Buildings)
|
|||
|
||||
/***** Room full name *****/
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_INPUT_TEXT ("FullName",Roo_MAX_CHARS_FULL_NAME,Roo_EditingRoom->FullName,
|
||||
HTM_INPUT_TEXT ("FullName",Cns_MAX_CHARS_FULL_NAME,Roo_EditingRoom->FullName,
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"size=\"20\" class=\"INPUT_FULL_NAME INPUT_%s\""
|
||||
" required=\"required\"",
|
||||
|
@ -1342,8 +1335,8 @@ void Roo_ReceiveFormNewRoom (void)
|
|||
Roo_EditingRoom->Type = Roo_GetParType ();
|
||||
|
||||
/* Get room short name and full name */
|
||||
Par_GetParText ("ShortName",Roo_EditingRoom->ShrtName,Roo_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Roo_EditingRoom->FullName,Roo_MAX_BYTES_FULL_NAME);
|
||||
Par_GetParText ("ShortName",Roo_EditingRoom->ShrtName,Cns_MAX_BYTES_SHRT_NAME);
|
||||
Par_GetParText ("FullName" ,Roo_EditingRoom->FullName,Cns_MAX_BYTES_FULL_NAME);
|
||||
|
||||
/* Get seating capacity */
|
||||
Roo_EditingRoom->Capacity = (unsigned)
|
||||
|
|
12
swad_room.h
12
swad_room.h
|
@ -34,12 +34,6 @@
|
|||
/************************** Public types and constants ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Roo_MAX_CHARS_SHRT_NAME (32 - 1) // 31
|
||||
#define Roo_MAX_BYTES_SHRT_NAME ((Roo_MAX_CHARS_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
|
||||
|
||||
#define Roo_MAX_CHARS_FULL_NAME (128 - 1) // 127
|
||||
#define Roo_MAX_BYTES_FULL_NAME ((Roo_MAX_CHARS_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||
|
||||
#define Roo_MAX_CAPACITY 10000 // If capacity of a room is greater than this, it is considered infinite
|
||||
#define Roo_UNLIMITED_CAPACITY INT_MAX // This number can be stored in database as an integer...
|
||||
// ...and means that a room has no limited capacity
|
||||
|
@ -79,11 +73,11 @@ struct Roo_Room
|
|||
long RooCod; // Room code
|
||||
long CtrCod; // Center code
|
||||
long BldCod; // Building code
|
||||
char BldShrtName[Bld_MAX_BYTES_SHRT_NAME + 1]; // Building short name
|
||||
char BldShrtName[Cns_MAX_BYTES_SHRT_NAME + 1]; // Building short name
|
||||
int Floor; // Room floor
|
||||
Roo_RoomType_t Type; // Room type
|
||||
char ShrtName[Roo_MAX_BYTES_SHRT_NAME + 1]; // Room short name
|
||||
char FullName[Roo_MAX_BYTES_FULL_NAME + 1]; // Room full name
|
||||
char ShrtName[Cns_MAX_BYTES_SHRT_NAME + 1]; // Room short name
|
||||
char FullName[Cns_MAX_BYTES_FULL_NAME + 1]; // Room full name
|
||||
unsigned Capacity; // Room seating capacity
|
||||
// (maximum people who fit in the room)
|
||||
unsigned long long MACnum;
|
||||
|
|
|
@ -674,6 +674,23 @@ static void TstPrn_WriteQstAndAnsExam (struct Usr_Data *UsrDat,
|
|||
TstPrn_ComputeAnswerScore (&PrintedQuestions[QstInd],Question);
|
||||
TstPrn_WriteAnswersExam (UsrDat,&PrintedQuestions[QstInd],Question,
|
||||
ICanView,"Qst_TXT","Qst_TXT_LIGHT");
|
||||
|
||||
/* Write score retrieved from database */
|
||||
if (ICanView[TstVis_VISIBLE_EACH_QST_SCORE])
|
||||
{
|
||||
HTM_DIV_Begin ("class=\"LM DAT_SMALL_%s\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TxtColonNBSP (Txt_Score);
|
||||
HTM_SPAN_Begin ("class=\"%s_%s\"",
|
||||
PrintedQuestions[QstInd].StrAnswers[0] ?
|
||||
(PrintedQuestions[QstInd].Score > 0 ? "Qst_ANS_OK" : // Correct
|
||||
"Qst_ANS_BAD") : // Wrong
|
||||
"Qst_ANS_0", // Blank answer
|
||||
The_GetSuffix ());
|
||||
HTM_Double2Decimals (PrintedQuestions[QstInd].Score);
|
||||
HTM_SPAN_End ();
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
}
|
||||
else
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_Question_modified);
|
||||
|
@ -681,23 +698,6 @@ static void TstPrn_WriteQstAndAnsExam (struct Usr_Data *UsrDat,
|
|||
else
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_Question_removed);
|
||||
|
||||
/* Write score retrieved from database */
|
||||
if (ICanView[TstVis_VISIBLE_EACH_QST_SCORE])
|
||||
{
|
||||
HTM_DIV_Begin ("class=\"LM DAT_SMALL_%s\"",
|
||||
The_GetSuffix ());
|
||||
HTM_TxtColonNBSP (Txt_Score);
|
||||
HTM_SPAN_Begin ("class=\"%s_%s\"",
|
||||
PrintedQuestions[QstInd].StrAnswers[0] ?
|
||||
(PrintedQuestions[QstInd].Score > 0 ? "Qst_ANS_OK" : // Correct
|
||||
"Qst_ANS_BAD") : // Wrong
|
||||
"Qst_ANS_0", // Blank answer
|
||||
The_GetSuffix ());
|
||||
HTM_Double2Decimals (PrintedQuestions[QstInd].Score);
|
||||
HTM_SPAN_End ();
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
|
||||
/* Question feedback */
|
||||
if (QuestionUneditedAfterExam)
|
||||
if (ICanView[TstVis_VISIBLE_FEEDBACK_TXT])
|
||||
|
|
Loading…
Reference in New Issue