Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 93 Rev 94
Línea 631... Línea 631...
631
    	                    'form-id' : form_id
631
    	                    'form-id' : form_id
632
    	                },
632
    	                },
633
    	            }).done(function(response) {
633
    	            }).done(function(response) {
Línea 634... Línea 634...
634
    
634
    
635
    	                if(response['success']) {
635
    	                if(response['success']) {
636
    	                	toastr['success'](response['message']);
636
    	                	$.fn.showSuccess(response['message']);
637
    	                	tableForm.fnDraw();
637
    	                	tableForm.fnDraw();
638
    	                } else {
638
    	                } else {
639
    	                	toastr['error'](response['message']);
639
    	                	$.fn.showError(response['message']);
640
    	                }
640
    	                }
641
    	            }).fail(function( jqXHR, textStatus, errorThrown) {
641
    	            }).fail(function( jqXHR, textStatus, errorThrown) {
642
    					toastr['error'](textStatus);
642
    					$.fn.showError(textStatus);
643
    	            });
643
    	            });
644
			    }
644
			    }
645
		    }
645
		    }
Línea 672... Línea 672...
672
    	                	 selected : d
672
    	                	 selected : d
673
    	                },
673
    	                },
674
    	            }).done(function(response) {
674
    	            }).done(function(response) {
Línea 675... Línea 675...
675
    
675
    
676
    	                if(response['success']) {
676
    	                if(response['success']) {
677
    	                	toastr['success'](response['message']);
677
    	                	$.fn.showSuccess(response['message']);
678
    	                	tableForm.fnDraw();
678
    	                	tableForm.fnDraw();
679
    	                } else {
679
    	                } else {
680
    	                	toastr['error'](response['message']);
680
    	                	$.fn.showError(response['message']);
681
    	                }
681
    	                }
682
    	            }).fail(function( jqXHR, textStatus, errorThrown) {
682
    	            }).fail(function( jqXHR, textStatus, errorThrown) {
683
    					toastr['error'](textStatus);
683
    					$.fn.showError(textStatus);
684
    	            });
684
    	            });
685
			    }
685
			    }
686
		    }
686
		    }
Línea 705... Línea 705...
705
            	'form-id' : form_id,
705
            	'form-id' : form_id,
706
            	'form-status' : form_status
706
            	'form-status' : form_status
707
            },
707
            },
708
        }).done(function(response) {
708
        }).done(function(response) {
709
	        if(response['success']) {
709
	        if(response['success']) {
710
	        	toastr['success'](response['message']);
710
	        	$.fn.showSuccess(response['message']);
711
	       } else {
711
	       } else {
712
    	       	toastr['error'](response['message']);
712
    	       	$.fn.showError(response['message']);
713
            }
713
            }
714
         }).fail(function( jqXHR, textStatus, errorThrown) {
714
         }).fail(function( jqXHR, textStatus, errorThrown) {
715
			toastr['error'](textStatus);
715
			$.fn.showError(textStatus);
716
        })
716
        })
717
    }); 
717
    }); 
Línea 718... Línea 718...
718
 
718
 
719
	$('body').on('click', 'a.btn-edit-form',function(e) {
719
	$('body').on('click', 'a.btn-edit-form',function(e) {
Línea 756... Línea 756...
756
					$('#row-edit').show();
756
					$('#row-edit').show();
Línea 757... Línea 757...
757
 
757
 
Línea 758... Línea 758...
758
					$('#form-main #form-name').focus();
758
					$('#form-main #form-name').focus();
759
					
759
					
760
				} else {
760
				} else {
761
					toastr['error'](response['message']);
761
					$.fn.showError(response['message']);
762
				}
762
				}
763
			}).fail(function( jqXHR, textStatus, errorThrown) {
763
			}).fail(function( jqXHR, textStatus, errorThrown) {
764
				toastr['error'](textStatus);
764
				$.fn.showError(textStatus);
Línea 765... Línea 765...
765
			});
765
			});
Línea 873... Línea 873...
873
		    //form.submit();
873
		    //form.submit();
Línea 874... Línea 874...
874
 
874
 
875
		    
875
		    
876
		    var error = false;
876
		    var error = false;
877
		    if(objFormGenerator.sections.length == 0) {
877
		    if(objFormGenerator.sections.length == 0) {
878
		    	toastr['error']('There are no sections');
878
		    	$.fn.showError('There are no sections');
Línea 879... Línea 879...
879
		    	error = true;
879
		    	error = true;
880
		    } else {
880
		    } else {
Línea 881... Línea 881...
881
		    	
881
		    	
882
		    	for(i = 0; i < objFormGenerator.sections.length; i++) 
882
		    	for(i = 0; i < objFormGenerator.sections.length; i++) 
883
		    	{
883
		    	{
884
		    		
884
		    		
Línea 885... Línea 885...
885
		    		if(objFormGenerator.sections[i].questions.length == 0) {
885
		    		if(objFormGenerator.sections[i].questions.length == 0) {
886
		    			toastr['error']('The "' + objFormGenerator.sections[i].name + '" section has no questions');
886
		    			$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section has no questions');
Línea 902... Línea 902...
902
		    				var questionNumber = j + 1;
902
		    				var questionNumber = j + 1;
903
		    				var numberCorrect = 0;
903
		    				var numberCorrect = 0;
Línea 904... Línea 904...
904
		    				
904
		    				
905
		    				
905
		    				
906
		    				if(objFormGenerator.sections[i].questions[j].options.length == 0) {
906
		    				if(objFormGenerator.sections[i].questions[j].options.length == 0) {
907
		    					toastr['error']('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + ' has no options');
907
		    					$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + ' has no options');
908
								error = true;
908
								error = true;
Línea 933... Línea 933...
933
		    				}
933
		    				}
Línea 934... Línea 934...
934
 
934
 
Línea 935... Línea 935...
935
		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' || objFormGenerator.sections[i].questions[j].type == 'multiple' ) {
935
		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' || objFormGenerator.sections[i].questions[j].type == 'multiple' ) {
936
		    				
936
		    				
937
    		    				if(numberCorrect == 0) {
937
    		    				if(numberCorrect == 0) {
938
    		    					toastr['error']('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + '  has no correct option');
938
    		    					$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + '  has no correct option');
939
    		    					error = true;
939
    		    					error = true;
940
    		    					break;
940
    		    					break;
941
    		    				}
941
    		    				}
942
    		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' && numberCorrect > 1) {
942
    		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' && numberCorrect > 1) {
943
    		    					toastr['error']('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + '   has more than one correct option');
943
    		    					$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + '   has more than one correct option');
944
    		    					error = true;
944
    		    					error = true;
945
    		    					break;
945
    		    					break;
946
    		    				}
946
    		    				}
947
    		    				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && numberCorrect == 1) {
947
    		    				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && numberCorrect == 1) {
948
    		    					toastr['error']('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + '    has only one correct option');
948
    		    					$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + '    has only one correct option');
949
    		    					error = true;
949
    		    					error = true;
950
    		    					break;
950
    		    					break;
Línea 951... Línea 951...
951
    		    				}
951
    		    				}
Línea 952... Línea 952...
952
		    				}
952
		    				}
953
 
953
 
954
			    			//console.log('totalOption = ' + totalOption + ' valueQuestion = ' + valueQuestion );
954
			    			//console.log('totalOption = ' + totalOption + ' valueQuestion = ' + valueQuestion );
955
			    			
955
			    			
956
			 				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && totalOption > valueQuestion ) {
956
			 				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && totalOption > valueQuestion ) {
Línea 957... Línea 957...
957
		     					toastr['error']('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + ' the sum of the values of the options is greater than the value of the question');
957
		     					$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + ' the sum of the values of the options is greater than the value of the question');
Línea 958... Línea 958...
958
		    					error = true;
958
		    					error = true;
959
		    					break;
959
		    					break;
960
			    			}
960
			    			}
961
 
961
 
962
							//console.log('maxOption = ' + maxOption + ' valueQuestion = ' + valueQuestion );
962
							//console.log('maxOption = ' + maxOption + ' valueQuestion = ' + valueQuestion );
963
			    			
963
			    			
Línea 964... Línea 964...
964
		    				if(objFormGenerator.sections[i].questions[j].type == 'rating-open' && maxOption > valueQuestion ) {
964
		    				if(objFormGenerator.sections[i].questions[j].type == 'rating-open' && maxOption > valueQuestion ) {
Línea 965... Línea 965...
965
		     					toastr['error']('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + ' the value of an option is greater than the value of the question');
965
		     					$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + ' the value of an option is greater than the value of the question');
966
		    					error = true;
966
		    					error = true;
967
		    					break;
967
		    					break;
968
			    			}
968
			    			}
969
						}
969
						}
970
 
970
 
Línea 1005... Línea 1005...
1005
                        'url' :  '/test/method-one',
1005
                        'url' :  '/test/method-one',
1006
                        'data' : data,
1006
                        'data' : data,
1007
                    }).done(function(response) {
1007
                    }).done(function(response) {
Línea 1008... Línea 1008...
1008
 
1008
 
1009
                        if(response['success']) {
1009
                        if(response['success']) {
1010
                        	toastr['success'](response['message']);
1010
                        	$.fn.showSuccess(response['message']);
1011
							if(formContinue == 1) {
1011
							if(formContinue == 1) {
1012
								$('#form-main #form-id').val(response['form-id']);
1012
								$('#form-main #form-id').val(response['form-id']);
1013
								$('#form-main #form-continue').val(0);
1013
								$('#form-main #form-continue').val(0);
1014
							} else {
1014
							} else {
Línea 1018... Línea 1018...
1018
 
1018
 
Línea 1019... Línea 1019...
1019
 
1019
 
1020
							tableForm.fnDraw();
1020
							tableForm.fnDraw();
1021
                        	
1021
                        	
1022
                        } else {
1022
                        } else {
1023
                        	toastr['error'](response['message']);
1023
                        	$.fn.showError(response['message']);
1024
                        }
1024
                        }
Línea 1025... Línea 1025...
1025
                    }).fail(function( jqXHR, textStatus, errorThrown) {
1025
                    }).fail(function( jqXHR, textStatus, errorThrown) {