Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 142 | Rev 144 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 142 Rev 143
Línea 840... Línea 840...
840
		e.stopPropagation();
840
		e.stopPropagation();
Línea 841... Línea 841...
841
 
841
 
842
		form_id =  $(this).data('id')
842
		form_id =  $(this).data('id')
Línea 843... Línea -...
843
		form_status = $(this).prop('checked') ? 'A' : 'D';
-
 
844
		
843
		form_status = $(this).prop('checked') ? 'A' : 'D';
845
        
844
		
846
		$.ajax({
845
		$.ajax({
847
        	'dataType': 'json',
846
        	'dataType': 'json',
848
            'method': 'post',
847
            'method': 'post',
Línea 888... Línea 887...
888
					
887
					
889
					
888
					
Línea 890... Línea 889...
890
					instanceName = 'form-text'; 
889
					instanceName = 'form-text'; 
891
					CKEDITOR.instances[instanceName ].setData(response['text']);
890
					CKEDITOR.instances[instanceName ].setData(response['text']);
Línea 892... Línea 891...
892
 
891
 
893
					$( '#form-main #form-language' ).val(response['language']),
892
					$('#form-main #form-language' ).val(response['language']),
894
					$( '#form-main #form-status' ).val(response['status']);
893
					$('#form-main #form-status' ).val(response['status']);
895
 
894
 
Línea 1022... Línea 1021...
1022
		    	
1021
		    	
1023
		    	for(i = 0; i < objFormGenerator.sections.length; i++) 
1022
		    	for(i = 0; i < objFormGenerator.sections.length; i++) 
Línea 1024... Línea 1023...
1024
		    	{
1023
		    	{
1025
		    		
1024
		    		
1026
		    		if(objFormGenerator.sections[i].questions.length == 0) {
1025
		    		if(objFormGenerator.sections[i].questions.length == 0) {
1027
		    			$.fn.showError( 'ERROR_QUESTION'.replace('%s', objFormGenerator.sections[i].name ));
1026
		    			$.fn.showError('ERROR_QUESTIONS'.replace('%s', objFormGenerator.sections[i].name ));
Línea 1028... Línea 1027...
1028
		    			break;
1027
		    			break;
1029
		    		}
1028
		    		}
Línea 1044... Línea 1043...
1044
		    				var numberCorrect = 0;
1043
		    				var numberCorrect = 0;
Línea 1045... Línea 1044...
1045
		    				
1044
		    				
Línea 1046... Línea 1045...
1046
		    				
1045
		    				
1047
		    				if(objFormGenerator.sections[i].questions[j].options.length == 0) {
1046
		    				if(objFormGenerator.sections[i].questions[j].options.length == 0) {
1048
 
1047
 
1049
								$.fn.showError( 'ERROR_OPTIONS'.replace('%s', objFormGenerator.sections[i].name ).replace('%n', questionNumber));
1048
								$.fn.showError('ERROR_OPTIONS'.replace('%s', objFormGenerator.sections[i].name ).replace('%n', questionNumber));
Línea 1050... Línea 1049...
1050
								error = true;
1049
								error = true;
Línea 1074... Línea 1073...
1074
		    				}
1073
		    				}
Línea 1075... Línea 1074...
1075
 
1074
 
Línea 1076... Línea 1075...
1076
		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' || objFormGenerator.sections[i].questions[j].type == 'multiple' ) {
1075
		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' || objFormGenerator.sections[i].questions[j].type == 'multiple' ) {
1077
		    				
1076
		    				
1078
    		    				if(numberCorrect == 0) {
1077
    		    				if(numberCorrect == 0) {
1079
    		    					$.fn.showError( 'ERROR_OPTIONS_CORRECT'.replace('%s', objFormGenerator.sections[i].name ).replace('%n', questionNumber));
1078
    		    					$.fn.showError('ERROR_OPTIONS_CORRECT'.replace('%s', objFormGenerator.sections[i].name ).replace('%n', questionNumber));
1080
    		    					error = true;
1079
    		    					error = true;
1081
    		    					break;
1080
    		    					break;
1082
    		    				}
1081
    		    				}
1083
    		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' && numberCorrect > 1) {
1082
    		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' && numberCorrect > 1) {
1084
    		    					$.fn.showError( 'ERROR_OPTIONS_DUPLICATE_CORRECT'.replace('%s', objFormGenerator.sections[i].name ).replace('%n', questionNumber));
1083
    		    					$.fn.showError('ERROR_OPTIONS_DUPLICATE_CORRECT'.replace('%s', objFormGenerator.sections[i].name ).replace('%n', questionNumber));
1085
    		    					error = true;
1084
    		    					error = true;
1086
    		    					break;
1085
    		    					break;
1087
    		    				}
1086
    		    				}
1088
    		    				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && numberCorrect == 1) {
1087
    		    				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && numberCorrect == 1) {
1089
    		    					$.fn.showError( 'ERROR_OPTIONS_ONE_CORRECT'.replace('%s', objFormGenerator.sections[i].name ).replace('%n', questionNumber));
1088
    		    					$.fn.showError('ERROR_OPTIONS_ONE_CORRECT'.replace('%s', objFormGenerator.sections[i].name ).replace('%n', questionNumber));
1090
    		    					error = true;
1089
    		    					error = true;
1091
    		    					break;
1090
    		    					break;
Línea 1092... Línea 1091...
1092
    		    				}
1091
    		    				}
Línea 1093... Línea 1092...
1093
		    				}
1092
		    				}
1094
 
1093
 
1095
			 				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && totalOption > valueQuestion ) {
1094
			 				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && totalOption > valueQuestion ) {
1096
 
1095
 
Línea 1097... Línea 1096...
1097
								$.fn.showError( 'ERROR_OPTIONS_SUM_VALUES'.replace('%s', objFormGenerator.sections[i].name ).replace('%n', questionNumber));
1096
								$.fn.showError('ERROR_OPTIONS_SUM_VALUES'.replace('%s', objFormGenerator.sections[i].name ).replace('%n', questionNumber));
1098
		    					error = true;
1097
		    					error = true;
1099
		    					break;
1098
		    					break;
1100
			    			}
1099
			    			}
1101
 
1100
 
1102
		    				if(objFormGenerator.sections[i].questions[j].type == 'rating-open' && maxOption > valueQuestion ) {
1101
		    				if(objFormGenerator.sections[i].questions[j].type == 'rating-open' && maxOption > valueQuestion ) {
Línea 1103... Línea 1102...
1103
								$.fn.showError( 'ERROR_OPTIONS_MAX_OPTION'.replace('%s', objFormGenerator.sections[i].name ).replace('%n', questionNumber));
1102
								$.fn.showError('ERROR_OPTIONS_MAX_OPTION'.replace('%s', objFormGenerator.sections[i].name ).replace('%n', questionNumber));
Línea 1104... Línea 1103...
1104
		    					error = true;
1103
		    					error = true;
1105
		    					break;
1104
		    					break;
1106
			    			}
1105
			    			}
1107
						}
1106
						}
1108
	
1107
	
1109
		    		}
1108
		    		}
Línea 1120... Línea 1119...
1120
    			if(error) {
1119
    			if(error) {
1121
    				return false;
1120
    				return false;
1122
    			} else {
1121
    			} else {
Línea 1123... Línea 1122...
1123
 
1122
 
1124
 
1123
 
Línea 1125... Línea 1124...
1125
    				var formId		= parseInt($( '#form-main #form-id' ).val());
1124
    				var formId		= parseInt($('#form-main #form-id' ).val());
1126
    				var formContinue = parseInt($( '#form-main #form-continue' ).val());
1125
    				var formContinue = parseInt($('#form-main #form-continue' ).val());
1127
        			
1126
        			
1128
    				var data = {
1127
    				var data = {
1129
    	    			'form-id'	: formId,
1128
    	    			'id'	: formId,
1130
        				'form-name' : $( '#form-main #form-name' ).val(),
1129
        				'name' : $('#form-main #form-name' ).val(),
1131
        				'form-description' : $( '#form-main #form-description' ).val(),
1130
        				'description' : $('#form-main #form-description' ).val(),
1132
        				'form-text' : $( '#form-main #form-text' ).val(),
1131
        				'text' : $('#form-main #form-text' ).val(),
1133
        				'form-language' : $( '#form-main #form-language' ).val(),
1132
        				'language' : $('#form-main #form-language' ).val(),
1134
        				'form-status' : $( '#form-main #form-status' ).val(),
-
 
1135
        				'sections' : objFormGenerator.sections
1133
        				'status' : $('#form-main #form-status' ).val(),
1136
    				}
1134
        				'sections' : objFormGenerator.sections
1137
 
1135
    				}
1138
					$.ajax({
1136
					$.ajax({
1139
						'dataType': 'json',
1137
						'dataType': 'json',
Línea 1404... Línea 1402...
1404
		$('#form-section #section-slug').val('');
1402
		$('#form-section #section-slug').val('');
1405
		$('#form-section #section-name').val('');
1403
		$('#form-section #section-name').val('');
Línea 1406... Línea 1404...
1406
 
1404
 
1407
		instanceName = 'section-text'; 
1405
		instanceName = 'section-text'; 
1408
		let editor = CKEDITOR.instances[instanceName ];
1406
		let editor = CKEDITOR.instances[instanceName ];
1409
		editor.setData( '', function() {
1407
		editor.setData('', function() {
1410
		    editor.focus();
1408
		    editor.focus();
Línea 1411... Línea 1409...
1411
		});
1409
		});
Línea 1488... Línea 1486...
1488
		$('#form-question #question-section').val(slug);
1486
		$('#form-question #question-section').val(slug);
1489
		$('#form-question #question-slug').val('');
1487
		$('#form-question #question-slug').val('');
Línea 1490... Línea 1488...
1490
 
1488
 
1491
		instanceName = 'question-text'; 
1489
		instanceName = 'question-text'; 
1492
		let editor = CKEDITOR.instances[instanceName ];
1490
		let editor = CKEDITOR.instances[instanceName ];
1493
		editor.setData( '', function() {
1491
		editor.setData('', function() {
1494
		    editor.focus();
1492
		    editor.focus();
Línea 1495... Línea 1493...
1495
		});
1493
		});
Línea 1631... Línea 1629...
1631
                		$('#form-option #option-question').val(slug_question);
1629
                		$('#form-option #option-question').val(slug_question);
1632
                		$('#form-option #option-slug').val('');
1630
                		$('#form-option #option-slug').val('');
Línea 1633... Línea 1631...
1633
						
1631
						
1634
                		instanceName = 'option-text'; 
1632
                		instanceName = 'option-text'; 
1635
	    	    		let editor = CKEDITOR.instances[instanceName ];
1633
	    	    		let editor = CKEDITOR.instances[instanceName ];
1636
	    	    		editor.setData( '', function() {
1634
	    	    		editor.setData('', function() {
1637
	    	    		    editor.focus();
1635
	    	    		    editor.focus();
Línea 1638... Línea 1636...
1638
	    	    		});
1636
	    	    		});
Línea 1810... Línea 1808...
1810
 
1808
 
1811
 
1809
 
Línea 1812... Línea 1810...
1812
		instanceName = 'form-description'; 
1810
		instanceName = 'form-description'; 
1813
		CKEDITOR.instances[instanceName ].setData('');
1811
		CKEDITOR.instances[instanceName ].setData('');
Línea 1814... Línea 1812...
1814
		
1812
		
1815
		$( '#form-main #form-language' ).val('EN'),
1813
		$('#form-main #form-language' ).val('EN'),
1816
		$( '#form-main #form-status' ).val('D');
1814
		$('#form-main #form-status' ).val('D');