From f8b8dda81a6e9dca883160366715658bbff00ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=A8=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=BC=D0=BE=D0=B2?= <solidovic@gmail.com> Date: Sat, 6 Sep 2014 18:53:08 +0400 Subject: [PATCH] add JS config --- ~dev_rating/application/views/base.twig | 1 + .../application/views/teacher/rating.twig | 2 +- ~dev_rating/media/js/config.js | 1 + ~dev_rating/media/js/discipline/create.js | 2 +- ~dev_rating/media/js/discipline/edit.js | 54 +++++++++---------- ~dev_rating/media/js/rating.js | 8 ++- 6 files changed, 38 insertions(+), 30 deletions(-) create mode 100644 ~dev_rating/media/js/config.js diff --git a/~dev_rating/application/views/base.twig b/~dev_rating/application/views/base.twig index a09295768..a25059d78 100644 --- a/~dev_rating/application/views/base.twig +++ b/~dev_rating/application/views/base.twig @@ -25,6 +25,7 @@ <title>{% block title %}{% endblock %} | {{ System.Title }}</title> {{ HTML.style('media/css/base.css')|raw }} {{ HTML.script('media/js/jquery-1.11.1.min.js')|raw }} + {{ HTML.script('media/js/config.js')|raw }} {{ HTML.script('media/js/profile.js')|raw }} {% block media %}{% endblock %} </head> diff --git a/~dev_rating/application/views/teacher/rating.twig b/~dev_rating/application/views/teacher/rating.twig index 81a01d2ba..6b488e091 100644 --- a/~dev_rating/application/views/teacher/rating.twig +++ b/~dev_rating/application/views/teacher/rating.twig @@ -73,7 +73,7 @@ </tr> <tr class="RatingTableSubmodulesHeadMaxRate"> {% set CellCount = 0 %} {% set col = 0 %} - <td class="title">Max. баллл</td> + <td class="title">Макс. балл</td> {% for i in 1..headerRate.ModulesCount %} {% set CellCount = CellCount + headerRate[i].SubmodulesCount %} {% for j in 1..headerRate[i].SubmodulesCount %} diff --git a/~dev_rating/media/js/config.js b/~dev_rating/media/js/config.js new file mode 100644 index 000000000..6aa184459 --- /dev/null +++ b/~dev_rating/media/js/config.js @@ -0,0 +1 @@ +var URLdir = '/~dev_rating'; \ No newline at end of file diff --git a/~dev_rating/media/js/discipline/create.js b/~dev_rating/media/js/discipline/create.js index 89a1aee1b..ba7d8c42f 100644 --- a/~dev_rating/media/js/discipline/create.js +++ b/~dev_rating/media/js/discipline/create.js @@ -4,7 +4,7 @@ $(function() { // Рзменения базовых параметров дисциплины $(".AddDiscipline").click(function(){ $.post( - '/~dev_rating/handler/map/AddDiscipline', + URLdir + '/handler/map/AddDiscipline', { 'Grade': $('.SelectGrade').val(), 'SubjectID': $('.SelectSubject').val(), diff --git a/~dev_rating/media/js/discipline/edit.js b/~dev_rating/media/js/discipline/edit.js index 3887d9246..237cf258b 100644 --- a/~dev_rating/media/js/discipline/edit.js +++ b/~dev_rating/media/js/discipline/edit.js @@ -66,7 +66,7 @@ $(function() { // Рзменение типа подмодуля function ChangeSubmoduleControlType(ID, ControlType){ $.post( - '/~dev_rating/handler/map/ChangeSubmoduleControlType', + URLdir + '/handler/map/ChangeSubmoduleControlType', { 'SubmoduleID': ID, 'ControlType': ControlType @@ -83,7 +83,7 @@ $(function() { // Рзменение макс. балла подмодуля function ChangeSubmoduleMaxRate(ID, NewMaxRate) { $.post( - '/~dev_rating/handler/map/ChangeSubmoduleMaxRate', + URLdir + '/handler/map/ChangeSubmoduleMaxRate', { 'SubmoduleID': ID, 'MaxRate': NewMaxRate @@ -155,7 +155,7 @@ $(function() { // Поменять местами РґРІР° модуля function SwapModuleOrder(ModuleID1, ModuleID2) { $.post( - '/~dev_rating/handler/map/SwapModuleOrder', + URLdir + '/handler/map/SwapModuleOrder', { 'ModuleID1': ModuleID1, 'ModuleID2': ModuleID2 @@ -172,7 +172,7 @@ $(function() { // Поменять местами РґРІР° мероприятия function SwapSubmoduleOrder(SubmoduleID1, SubmoduleID2) { $.post( - '/~dev_rating/handler/map/SwapSubmoduleOrder', + URLdir + '/handler/map/SwapSubmoduleOrder', { 'SubmoduleID1': SubmoduleID1, 'SubmoduleID2': SubmoduleID2 @@ -193,7 +193,7 @@ $(function() { // Рзменение предмета $('.SelectSubject').change(function(){ $.post( - '/~dev_rating/handler/map/ChangeDisciplineSubject', + URLdir + '/handler/map/ChangeDisciplineSubject', { 'DisciplineID': DisciplineID, 'SubjectID': $('.SelectSubject').val() @@ -210,7 +210,7 @@ $(function() { // Рзменение РєСѓСЂСЃР° $('.SelectDisGrade').change(function(){ // SelectGrade совпадает СЃ РґСЂСѓРіРёРј, поэтому SelectDisGrade $.post( - '/~dev_rating/handler/map/ChangeDisciplineGrade', + URLdir + '/handler/map/ChangeDisciplineGrade', { 'DisciplineID': DisciplineID, 'GradeID': $('.SelectDisGrade').val() @@ -227,7 +227,7 @@ $(function() { // Рзменение контроля $('.ExamType').change(function(){ $.post( - '/~dev_rating/handler/map/ChangeDisciplineControl', + URLdir + '/handler/map/ChangeDisciplineControl', { 'DisciplineID': DisciplineID, 'Control': $('input:radio[name=ExamType]:checked').val() @@ -244,7 +244,7 @@ $(function() { // Рзменение лекционных часов $('.InputLectionCount').focusout(function(){ $.post( - '/~dev_rating/handler/map/ChangeDisciplineHours', + URLdir + '/handler/map/ChangeDisciplineHours', { 'DisciplineID': DisciplineID, 'Hours': $('.InputLectionCount').val(), @@ -262,7 +262,7 @@ $(function() { // Рзменение практических часов $('.InputPracticeCount').focusout(function(){ $.post( - '/~dev_rating/handler/map/ChangeDisciplineHours', + URLdir + '/handler/map/ChangeDisciplineHours', { 'DisciplineID': DisciplineID, 'Hours': $('.InputPracticeCount').val(), @@ -280,7 +280,7 @@ $(function() { /* $(".ChangeDiscipline").click(function(){ $.post( - '/~dev_rating/handler/map/ChangeDiscipline', + URLdir + '/handler/map/ChangeDiscipline', { 'DisciplineID': DisciplineID, 'Grade': $('.SelectGrade').val(), @@ -359,7 +359,7 @@ $(function() { $('.addModule').click(function(){ var OrderNum = $('.moduleGroup', '.moduleList').last().index('.moduleGroup') + 2; $.post( - '/~dev_rating/handler/map/AddModule', + URLdir + '/handler/map/AddModule', { 'DisciplineID': DisciplineID, // 'OrderNum': OrderNum @@ -394,7 +394,7 @@ $(function() { var SubmodulesDIV = $(this).parent().parent().next('.subModules'); var OrderNum = SubmodulesDIV.children('.subModule').last().index() + 1; $.post( - '/~dev_rating/handler/map/AddSubmodule', + URLdir + '/handler/map/AddSubmodule', { 'ModuleID': ModuleID, 'OrderNum': OrderNum @@ -417,7 +417,7 @@ $(function() { var SubmodulesDIV = $(this).siblings('.subModules'); var OrderNum = SubmodulesDIV.children('.subModule').last().index() + 2; $.post( - '/~dev_rating/handler/map/AddSubmodule', + URLdir + '/handler/map/AddSubmodule', { 'ModuleID': ModuleID //'OrderNum': OrderNum @@ -460,7 +460,7 @@ $(function() { var ChangeOrderModulesID = '[' + AttrID.get() + ']'; // $.post( - '/~dev_rating/handler/map/DeleteModule', + URLdir + '/handler/map/DeleteModule', { 'ModuleID': $(this).parent('div').parent('div').parent('div').attr('id'), 'SubmodulesID': JSONSubmodules, @@ -498,7 +498,7 @@ $(function() { var ChangeOrderSubmodulesID = '[' + AttrID.get() + ']'; // $.post( - '/~dev_rating/handler/map/DeleteSubmodule', + URLdir + '/handler/map/DeleteSubmodule', { 'SubmoduleID': $(this).parent('div').parent('div').attr('id'), 'CurrentSubmoduleOrder': CurrentSubmoduleOrder, @@ -531,7 +531,7 @@ $(function() { if (NewModuleName != '' && ModuleName != NewModuleName) { var ID = $(this).parent('div').parent('div').parent('div').attr('id'); $.post( - '/~dev_rating/handler/map/ChangeModuleName', + URLdir + '/handler/map/ChangeModuleName', { 'ModuleID': ID, 'ModuleName': NewModuleName @@ -561,7 +561,7 @@ $(function() { if (NewSubmoduleName != '' && SubmoduleName != NewSubmoduleName) { var ID = $(this).parent('div').parent('div').attr('id'); $.post( - '/~dev_rating/handler/map/ChangeSubmoduleName', + URLdir + '/handler/map/ChangeSubmoduleName', { 'SubmoduleID': ID, 'SubmoduleName': NewSubmoduleName @@ -626,7 +626,7 @@ $('.AttachGroupButton').click(function(){ var StudyGroupID = $('.SelectStudyGroup').val(); var StudyGroupName = $(".SelectStudyGroup option:selected").text(); $.post( - '/~dev_rating/handler/map/BindGroup', + URLdir + '/handler/map/BindGroup', { 'StudyGroupID': StudyGroupID, 'DisciplineID': DisciplineID @@ -647,7 +647,7 @@ $('.AttachedGroupsList').on('click', '.UnbindGroup', function(){ var StudyGroupID = $(this).parent().attr('id'); var GroupDIV = $(this).parent(); $.post( - '/~dev_rating/handler/map/UnbindGroup', + URLdir + '/handler/map/UnbindGroup', { 'StudyGroupID': StudyGroupID, 'DisciplineID': DisciplineID @@ -688,7 +688,7 @@ function CallSearchStudents() { if ($('.InputStudentName ').val() > 0) Name = ($('.InputStudentName ').val()).split(' '); $.post( - '/~dev_rating/handler/map/SearchStudents', + URLdir + '/handler/map/SearchStudents', { 'GradeID': $('.SelectGrade').val(), 'GroupN': $('.SelectStudyGroup').val(), @@ -717,7 +717,7 @@ function CallSearchStudents() { $('.SelectGrade').change(function(){ $.post( - '/~dev_rating/handler/map/GetStudyGroups', + URLdir + '/handler/map/GetStudyGroups', { 'FacultyID': FacultyID, 'GradeID': $('.SelectGrade').val() @@ -770,7 +770,7 @@ $('.StudentsList').on('click', '.Action_BindStudent', function(){ .addClass('StatusBind'); var ID = $(this).parent().attr('id'); $.post( - '/~dev_rating/handler/map/BindStudent', + URLdir + '/handler/map/BindStudent', { 'StudentID': ID, 'DisciplineID': DisciplineID @@ -812,7 +812,7 @@ $('.StudentsList').on('click', '.Action_UnbindStudent', function(){ .addClass('StatusUnbind'); var ID = $(this).parent().attr('id'); $.post( - '/~dev_rating/handler/map/UnbindStudent', + URLdir + '/handler/map/UnbindStudent', { 'StudentID': ID, 'DisciplineID': DisciplineID @@ -857,7 +857,7 @@ function CallSearchTeachers(){ var Name = []; Name = ($('.InputTeacherName ').val()).split(' '); $.post( - '/~dev_rating/handler/map/SearchTeachers', + URLdir + '/handler/map/SearchTeachers', { 'FacultyID': $('.SelectFaculty').val(), 'DepartmentID': $('.SelectDepartment').val(), @@ -885,7 +885,7 @@ function CallSearchTeachers(){ // Выборка кафедр $('.SelectFaculty').change(function(){ $.post( - '/~dev_rating/handler/map/GetDepartments', + URLdir + '/handler/map/GetDepartments', { 'FacultyID': $('.SelectFaculty').val() }, @@ -934,7 +934,7 @@ $('.TeachersList').on('click', '.Action_UnbindTeacher', function(){ .remove(); var ID = $(this).parent().attr('id'); $.post( - '/~dev_rating/handler/map/UnbindTeacher', + URLdir + '/handler/map/UnbindTeacher', { 'BindingTeacher': ID, 'DisciplineID': DisciplineID @@ -956,7 +956,7 @@ $('.TeachersList').on('click', '.Action_BindTeacher', function(){ var ID = $(this).parent().attr('id'); var Name = $(this).siblings('.Name').text(); $.post( - '/~dev_rating/handler/map/BindTeacher', + URLdir + '/handler/map/BindTeacher', { 'BindingTeacher': ID, 'DisciplineID': DisciplineID diff --git a/~dev_rating/media/js/rating.js b/~dev_rating/media/js/rating.js index 21d309c08..410d3e840 100644 --- a/~dev_rating/media/js/rating.js +++ b/~dev_rating/media/js/rating.js @@ -46,7 +46,13 @@ $(function() { if (parseInt(NewRate) <= parseInt(MaxRate)) { - $.post('/~dev_rating/handler/rating/setRate', {'student': StudentID, 'submodule': SubmoduleID, 'rate': NewRate }, + $.post( + URLdir + '/handler/rating/setRate', + { + 'student': StudentID, + 'submodule': SubmoduleID, + 'rate': NewRate + }, function(data){ data = $.parseJSON(data); if(data.success === true) { -- GitLab