2017-03-10 18:25:35 +00:00
"use strict" ; function removeDateFieldsFunc ( o ) { function eachObject ( v , k ) { "lastModified" !== k && "created" !== k || delete clone [ k ] } for ( var clone = _ . clone ( o ) , i = 0 ; i < clone . length ; i ++ ) _ . each ( clone [ i ] , eachObject ) ; return clone } function wait ( ms ) { for ( var start = ( new Date ) . getTime ( ) , end = start ; end < start + ms ; ) end = ( new Date ) . getTime ( ) } var ApplicationConfiguration = function ( ) { var applicationModuleName = "NodeForm" , applicationModuleVendorDependencies = [ "duScroll" , "ui.select" , "cgBusy" , "ngSanitize" , "vButton" , "ngResource" , "NodeForm.templates" , "ui.router" , "ui.bootstrap" , "ui.utils" , "pascalprecht.translate" , "ng.deviceDetector" ] , registerModule = function ( moduleName , dependencies ) { angular . module ( moduleName , dependencies || [ ] ) , angular . module ( applicationModuleName ) . requires . push ( moduleName ) } ; return { applicationModuleName : applicationModuleName , applicationModuleVendorDependencies : applicationModuleVendorDependencies , registerModule : registerModule } } ( ) ; angular . module ( ApplicationConfiguration . applicationModuleName , ApplicationConfiguration . applicationModuleVendorDependencies ) , angular . module ( ApplicationConfiguration . applicationModuleName ) . config ( [ "$locationProvider" , function ( $locationProvider ) { $locationProvider . hashPrefix ( "!" ) } ] ) , angular . module ( ApplicationConfiguration . applicationModuleName ) . constant ( "APP_PERMISSIONS" , { viewAdminSettings : "viewAdminSettings" , editAdminSettings : "editAdminSettings" , editForm : "editForm" , viewPrivateForm : "viewPrivateForm" } ) , angular . module ( ApplicationConfiguration . applicationModuleName ) . constant ( "USER_ROLES" , { admin : "admin" , normal : "user" , superuser : "superuser" } ) , angular . module ( ApplicationConfiguration . applicationModuleName ) . constant ( "FORM_URL" , "/forms/:formId" ) , angular . element ( document ) . ready ( function ( ) { "#_=_" === window . location . hash && ( window . location . hash = "#!" ) , angular . bootstrap ( document , [ ApplicationConfiguration . applicationModuleName ] ) } ) , angular . module ( "NodeForm.templates" , [ ] ) . run ( [ "$templateCache" , function ( $templateCache ) { $templateCache . put ( "modules/core/views/header.client.view.html" , '<section class="navbar navbar-inverse" data-ng-controller=HeaderController ng-hide=hideNav><div class=container><div class=navbar-header><button class=navbar-toggle type=button data-ng-click=toggleCollapsibleMenu()><span class=sr-only>Toggle navigation</span> <span>{{ \'MENU_BTN\' | translate }}</span></button> <a href="/#!/" class=navbar-brand><img src=/static/modules/core/img/logo_white.svg height=100%></a></div><nav class="collapse navbar-collapse" collapse=!isCollapsed role=navigation><ul class="nav navbar-nav navbar-right" data-ng-hide=authentication.isAuthenticated()><li ng-hide=$root.signupDisabled ui-route=/signup ng-class="{active: $uiRoute}"><a href=/#!/signup>{{ \'SIGNUP_TAB\' | translate }}</a></li><li class=divider-vertical></li><li ui-route=/signin ng-class="{active: $uiRoute}"><a href=/#!/signin>{{ \'SIGNIN_TAB\' | translate }}</a></li></ul><ul class="nav navbar-nav navbar-right" data-ng-show=authentication.isAuthenticated()><li class=dropdown uib-dropdown><a href=# class=dropdown-toggle data-toggle=dropdown dropdown-toggle><span>{{ \'MY_SETTINGS\' | translate }}</span> <b class=caret></b></a><ul class=dropdown-menu><li><a href=/#!/settings/profile>{{ \'EDIT_PROFILE\' | translate }}</a></li><li class=divider></li><li><a href=/#!/settings/password>{{ \'CHANGE_PASSWORD\' | translate }}</a></li></ul></li><li><a href="/" ng-click=signout()>{{ \'SIGNOUT_TAB\' | translate }}</a></li></ul></nav></div></section>' ) , $templateCache . put ( "modules/forms/admin/views/admin-form.client.view.html" , '<header data-ng-include="\'/static/modules/core/views/header.client.view.html\'"></header><div class=container cg-busy="{promise:updatePromise,templateUrl:\'modules/forms/admin/views/directiveViews/cgBusy/update-form-message-TypeB.html\',message:\'Updating form...\', backdrop:false, wrapperClass:\'.busy-updating-wrapper\'}"></div><section class=admin-form><script type=text/ng-template id=formDeleteModal.html><div class="modal-header">\n <h2 class="modal-title hidden-md hidden-lg">{{ \'ARE_YOU_SURE\' | translate } } < / h 2 > \ n < h 3 c l a s s = " m o d a l - t i t l e h i d d e n - x s h i
2017-03-10 00:18:18 +00:00
$templateCache . put ( "modules/forms/admin/views/directiveViews/form/edit-submissions-form.client.view.html" , "<div class=\"submissions-table container\"><div class=\"row text-center analytics\"><div class=\"col-xs-12 header-title\"><div class=col-xs-3>{{ 'TOTAL_VIEWS' | translate }}</div><div class=col-xs-3>{{ 'RESPONSES' | translate }}</div><div class=col-xs-3>{{ 'COMPLETION_RATE' | translate }}</div><div class=col-xs-3>{{ 'AVERAGE_TIME_TO_COMPLETE' | translate }}</div></div><div class=\"col-xs-12 header-numbers\"><div class=col-xs-3>{{myform.analytics.views}}</div><div class=col-xs-3>{{myform.analytics.submissions}}</div><div class=col-xs-3>{{myform.analytics.conversionRate | number:0}}%</div><div class=col-xs-3>{{ AverageTimeElapsed | secondsToDateTime | date:'mm:ss'}}</div></div><div class=\"col-xs-12 detailed-title\"><div class=col-xs-3>{{ 'DESKTOP_AND_LAPTOP' | translate }}</div><div class=col-xs-3>{{ 'TABLETS' | translate }}</div><div class=col-xs-3>{{ 'PHONES' | translate }}</div><div class=col-xs-3>{{ 'OTHER' | translate }}</div></div><div class=\"col-xs-12 detailed-row\"><div class=col-xs-3><div class=\"row header\">{{ 'UNIQUE_VISITS' | translate }}</div><div class=row>{{DeviceStatistics.desktop.visits}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'UNIQUE_VISITS' | translate }}</div><div class=row>{{DeviceStatistics.tablet.visits}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'UNIQUE_VISITS' | translate }}</div><div class=row>{{DeviceStatistics.tablet.visits}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'UNIQUE_VISITS' | translate }}</div><div class=row>{{DeviceStatistics.other.visits}}</div></div></div><div class=\"col-xs-12 detailed-row\"><div class=col-xs-3><div class=\"row header\">{{ 'RESPONSES' | translate }}</div><div class=row>{{DeviceStatistics.desktop.responses}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'RESPONSES' | translate }}</div><div class=row>{{DeviceStatistics.tablet.responses}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'RESPONSES' | translate }}</div><div class=row>{{DeviceStatistics.phone.responses}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'RESPONSES' | translate }}</div><div class=row>{{DeviceStatistics.other.responses}}</div></div></div><div class=\"col-xs-12 detailed-row\"><div class=col-xs-3><div class=\"row header\">{{ 'COMPLETION_RATE' | translate }}</div><div class=row>{{DeviceStatistics.desktop.completion}}%</div></div><div class=col-xs-3><div class=\"row header\">{{ 'COMPLETION_RATE' | translate }}</div><div class=row>{{DeviceStatistics.tablet.completion}}%</div></div><div class=col-xs-3><div class=\"row header\">{{ 'COMPLETION_RATE' | translate }}</div><div class=row>{{DeviceStatistics.phone.completion}}%</div></div><div class=col-xs-3><div class=\"row header\">{{ 'COMPLETION_RATE' | translate }}</div><div class=row>{{DeviceStatistics.other.completion}}%</div></div></div><div class=\"col-xs-12 detailed-row\"><div class=col-xs-3><div class=\"row header\">{{ 'AVERAGE_TIME_TO_COMPLETE' | translate }}</div><div class=row>{{DeviceStatistics.desktop.average_time | secondsToDateTime | date:'mm:ss'}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'AVERAGE_TIME_TO_COMPLETE' | translate }}</div><div class=row>{{DeviceStatistics.tablet.average_time | secondsToDateTime | date:'mm:ss'}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'AVERAGE_TIME_TO_COMPLETE' | translate }}</div><div class=row>{{DeviceStatistics.phone.average_time | secondsToDateTime | date:'mm:ss'}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'AVERAGE_TIME_TO_COMPLETE' | translate }}</div><div class=row>{{DeviceStatistics.other.average_time | secondsToDateTime | date:'mm:ss'}}</div></div></div><div class=\"col-xs-12 field-title-row\" > < div class = col - xs - 3 > < strong > { { 'FIELD_TITLE' | translate } } < / s t r o n g > < / d i v > < d i v c l a s s = c o l - x s - 3 > < s t r o n g > { { ' F I E L D _ V I E W S ' | t r a n s l a t e } } < / s t r o n g > < / d i v > < d i v c l a s s = c o l - x s - 3 > < s t r o n g > { { ' F I E L D _ R E S P O N S E S ' | t r a n s l a t e } } < / s t r o n g > < / d i v > < d i v c l a s s = c o l - x s - 3 > < s t r o n g > { {
2017-03-10 18:25:35 +00:00
$templateCache . put ( "modules/users/views/password/forgot-password.client.view.html" , '<section class="auth valign-wrapper" data-ng-controller=PasswordController><div class="row valign"><div class="col-md-4 col-md-offset-4"><div class="col-md-12 text-center" style="padding-bottom: 50px"><img src=/static/modules/core/img/logo_white.svg height=100px></div><div class=col-md-12><form data-ng-submit=askForPasswordReset() autocomplete=off><fieldset><div class=form-group><input id=username name=username class=form-control data-ng-model=credentials.username placeholder="{{ \'USERNAME_OR_EMAIL_LABEL\' | translate }}"></div><div class="text-center form-group"><button type=submit class="btn btn-signup btn-rounded btn-block">{{ \'PASSWORD_RESTORE_HEADER\' | translate }}</button></div><div data-ng-show=error class="text-center text-danger"><strong>{{error}}</strong></div><div data-ng-show=success class="text-center text-success"><strong>{{success}}</strong></div></fieldset></form></div></div></div></section>' ) , $templateCache . put ( "modules/users/views/password/reset-password-invalid.client.view.html" , "<section class=\"row text-center\"><h3 class=col-md-12>{{ 'PASSWORD_RESET_INVALID' | translate }}</h3><a href=/#!/password/forgot class=col-md-12>{{ 'ASK_FOR_NEW_PASSWORD' | translate }}</a></section>" ) , $templateCache . put ( "modules/users/views/password/reset-password-success.client.view.html" , "<section class=\"row text-center\"><h3 class=col-md-12>{{ 'PASSWORD_RESET_SUCCESS' | translate }}</h3><a href=\"/#!/\" class=col-md-12>{{ 'CONTINUE_TO_LOGIN' | translate }}</a></section>" ) , $templateCache . put ( "modules/users/views/password/reset-password.client.view.html" , '<section class="row auth" data-ng-controller=PasswordController><h3 class="col-md-12 text-center">Reset your password</h3><div class="col-xs-offset-2 col-xs-8 col-md-offset-3 col-md-6"><form data-ng-submit=resetUserPassword() class="signin form-horizontal" autocomplete=off><fieldset><div class=form-group><label for=newPassword>{{ \'NEW_PASSWORD_LABEL\' | translate }}</label><input type=password id=newPassword name=newPassword class=form-control data-ng-model=passwordDetails.newPassword placeholder="New Password"></div><div class=form-group><label for=verifyPassword>{{ \'VERIFY_PASSWORD_LABEL\' | translate }}</label><input type=password id=verifyPassword name=verifyPassword class=form-control data-ng-model=passwordDetails.verifyPassword placeholder="Verify Password"></div><div class="text-center form-group"><button type=submit class="btn btn-large btn-primary">Update Password</button></div><div data-ng-show=error class="text-center text-danger"><strong>{{error}}</strong></div><div data-ng-show=success class="text-center text-success"><strong>{{success}}</strong></div></fieldset></form></div></section>' ) , $templateCache . put ( "modules/users/views/settings/change-password.client.view.html" , '<header data-ng-include="\'/static/modules/core/views/header.client.view.html\'"></header><section class=row data-ng-controller=SettingsController><h3 class="col-md-12 text-center">Change your password</h3><div class="col-xs-offset-2 col-xs-8 col-md-offset-3 col-md-6"><form data-ng-submit=changeUserPassword() class="signin form-horizontal" autocomplete=off><fieldset><div class=form-group><label for=currentPassword>Current Password</label><input type=password id=currentPassword name=currentPassword class=form-control data-ng-model=passwordDetails.currentPassword placeholder="Current Password"></div><hr><div class=form-group><label for=newPassword>{{ \'NEW_PASSWORD_LABEL\' | translate }}</label><input type=password id=newPassword name=newPassword class=form-control data-ng-model=passwordDetails.newPassword placeholder="New Password"></div><div class=form-group><label for=verifyPassword>{{ \'VERIFY_PASSWORD_LABEL\' | translate }}</label><input type=password id=verifyPassword name=verifyPassword class=form-control data-ng-model=passwordDetails.verifyPassword placeholder="Verify Password"></div><div class="text-center form-group"><button type=submit class="btn btn-large btn-primary">{{ \'SAVE_PASSWORD_BTN\' |
} ) . state ( "reset" , { url : "/password/reset/:token" , templateUrl : "modules/users/views/password/reset-password.client.view.html" } ) } ] ) , angular . module ( "users" ) . controller ( "AuthenticationController" , [ "$scope" , "$location" , "$state" , "$rootScope" , "User" , "Auth" , function ( $scope , $location , $state , $rootScope , User , Auth ) { $scope = $rootScope , $scope . credentials = { } , $scope . error = "" , $scope . signin = function ( ) { User . login ( $scope . credentials ) . then ( function ( response ) { Auth . login ( response ) , $scope . user = $rootScope . user = Auth . ensureHasCurrentUser ( User ) , "home" !== $state . previous . name && "verify" !== $state . previous . name && "" !== $state . previous . name ? $state . go ( $state . previous . name ) : $state . go ( "listForms" ) } , function ( error ) { $rootScope . user = Auth . ensureHasCurrentUser ( User ) , $scope . user = $rootScope . user , $scope . error = error , console . log ( "loginError: " + error ) } ) } , $scope . signup = function ( ) { console . log ( $scope . credentials ) , User . signup ( $scope . credentials ) . then ( function ( response ) { console . log ( "signup-success" ) , $state . go ( "signup-success" ) } , function ( error ) { console . log ( "Error: " ) , console . log ( error ) , error ? ( $scope . error = error , console . log ( error ) ) : console . log ( "No response received" ) } ) } } ] ) , angular . module ( "users" ) . controller ( "PasswordController" , [ "$scope" , "$stateParams" , "$state" , "User" , function ( $scope , $stateParams , $state , User ) { $scope . error = "" , $scope . askForPasswordReset = function ( ) { User . askForPasswordReset ( $scope . credentials ) . then ( function ( response ) { $scope . success = response . message , $scope . credentials = null } , function ( error ) { $scope . error = error , $scope . credentials = null } ) } , $scope . resetUserPassword = function ( ) { $scope . success = $scope . error = null , User . resetPassword ( $scope . passwordDetails , $stateParams . token ) . then ( function ( response ) { $scope . success = response . message , $scope . passwordDetails = null , $state . go ( "reset-success" ) } , function ( error ) { $scope . error = error . message || error , $scope . passwordDetails = null } ) } } ] ) , angular . module ( "users" ) . controller ( "SettingsController" , [ "$scope" , "$rootScope" , "$http" , "$state" , "Users" , "Auth" , function ( $scope , $rootScope , $http , $state , Users , Auth ) { $scope . user = Auth . currentUser , $scope . hasConnectedAdditionalSocialAccounts = function ( provider ) { for ( var i in $scope . user . additionalProvidersData ) return ! 0 ; return ! 1 } , $scope . cancel = function ( ) { $scope . user = Auth . currentUser } , $scope . isConnectedSocialAccount = function ( provider ) { return $scope . user . provider === provider || $scope . user . additionalProvidersData && $scope . user . additionalProvidersData [ provider ] } , $scope . removeUserSocialAccount = function ( provider ) { $scope . success = $scope . error = null , $http [ "delete" ] ( "/users/accounts" , { params : { provider : provider } } ) . success ( function ( response ) { $scope . success = ! 0 , $scope . user = response } ) . error ( function ( response ) { $scope . error = response . message } ) } , $scope . updateUserProfile = function ( isValid ) { if ( isValid ) { $scope . success = $scope . error = null ; var user = new Users ( $scope . user ) ; user . $update ( function ( response ) { $scope . success = ! 0 , $scope . user = response } , function ( response ) { $scope . error = response . data . message } ) } else $scope . submitted = ! 0 } , $scope . changeUserPassword = function ( ) { $scope . success = $scope . error = null , $http . post ( "/users/password" , $scope . passwordDetails ) . success ( function ( response ) { $scope . success = ! 0 , $scope . passwordDetails = null } ) . error ( function ( response ) { $scope . error = response . message } ) } } ] ) , angular . module ( "users" ) . controller ( "VerifyController" , [ "$scope" , "$state" , "$rootScope" , "User" , "Auth" , "$stateParams" , function ( $scope , $state , $rootScope , User , Auth , $stateParams ) { $scope . isResetSent = ! 1 , $scope . credentials = { } , $scope . error = "" , $scope . resendVerifyEmail = function ( ) { User . resendVerifyEmail ( $scope . credentials . email ) . then ( function ( response ) { console . log ( response ) , $scope . success = response . message , $scope . credentials = null , $scope . isResetSent = ! 0 } , function ( error ) { $scope . error = error , $scope . credentials . email = null , $scope . isResetSent = ! 1 } ) } , $scope . validateVerifyToken = function ( ) { $stateParams . token && ( console . log ( $stateParams . token ) , User . validateVerifyToken ( $stateParams . token ) . then ( function ( response ) { console . log ( "Success: " + response . message ) , $scope . success = response . message , $scope . isResetSent = ! 0 , $scope . credentials . email = null } , function ( error ) { console . log ( "Error: " + error . message ) , $scope . isResetSent = ! 1 , $s
$scope . translateAdvancementData = { done : nb _valid , total : form _fields _count , answers _not _completed : form _fields _count - nb _valid } , $scope . reloadForm = function ( ) { $scope . myform . submitted = ! 1 , $scope . myform . form _fields = _ . chain ( $scope . myform . visible _form _fields ) . map ( function ( field ) { return field . fieldValue = "" , field } ) . value ( ) , $scope . loading = ! 1 , $scope . error = "" , $scope . selected = { _id : "" , index : 0 } , $scope . setActiveField ( $scope . myform . visible _form _fields [ 0 ] . _id , 0 , ! 1 ) , TimeCounter . restartClock ( ) } , $window . onscroll = function ( ) { $scope . scrollPos = document . body . scrollTop || document . documentElement . scrollTop || 0 ; var elemBox = document . getElementsByClassName ( "activeField" ) [ 0 ] . getBoundingClientRect ( ) ; $scope . fieldTop = elemBox . top , $scope . fieldBottom = elemBox . bottom ; var field _id , field _index ; $scope . noscroll || ( $scope . selected . index === $scope . myform . visible _form _fields . length - 1 && $scope . fieldBottom < 200 ? ( field _index = $scope . selected . index + 1 , field _id = "submit_field" , $scope . setActiveField ( field _id , field _index , ! 1 ) ) : $scope . selected . index === $scope . myform . visible _form _fields . length ? $scope . fieldTop > 200 && ( field _index = $scope . selected . index - 1 , field _id = $scope . myform . visible _form _fields [ field _index ] . _id , $scope . setActiveField ( field _id , field _index , ! 1 ) ) : $scope . fieldBottom < 0 ? ( field _index = $scope . selected . index + 1 , field _id = $scope . myform . visible _form _fields [ field _index ] . _id , $scope . setActiveField ( field _id , field _index , ! 1 ) ) : 0 !== $scope . selected . index && $scope . fieldTop > 0 && ( field _index = $scope . selected . index - 1 , field _id = $scope . myform . visible _form _fields [ field _index ] . _id , $scope . setActiveField ( field _id , field _index , ! 1 ) ) , $scope . $apply ( ) ) } ; var getActiveField = function ( ) { if ( null === $scope . selected ) throw console . error ( "current active field is null" ) , new Error ( "current active field is null" ) ; return "submit_field" === $scope . selected . _id ? $scope . myform . form _fields . length - 1 : $scope . selected . index } ; $scope . setActiveField = $rootScope . setActiveField = function ( field _id , field _index , animateScroll ) { if ( null !== $scope . selected && $scope . selected . _id !== field _id ) { $scope . selected . _id = field _id , $scope . selected . index = field _index ; var nb _valid = $filter ( "formValidity" ) ( $scope . myform ) ; $scope . translateAdvancementData = { done : nb _valid , total : form _fields _count , answers _not _completed : form _fields _count - nb _valid } , animateScroll ? ( $scope . noscroll = ! 0 , setTimeout ( function ( ) { $document . scrollToElement ( angular . element ( ".activeField" ) , - 10 , 200 ) . then ( function ( ) { $scope . noscroll = ! 1 , setTimeout ( function ( ) { document . querySelectorAll ( ".activeField .focusOn" ) . length ? document . querySelectorAll ( ".activeField .focusOn" ) [ 0 ] . focus ( ) : document . querySelectorAll ( ".activeField input" ) . length ? document . querySelectorAll ( ".activeField input" ) [ 0 ] . focus ( ) : document . querySelectorAll ( ".activeField .selectize-input" ) [ 0 ] . focus ( ) } ) } ) } ) ) : setTimeout ( function ( ) { document . querySelectorAll ( ".activeField .focusOn" ) [ 0 ] ? document . querySelectorAll ( ".activeField .focusOn" ) [ 0 ] . focus ( ) : document . querySelectorAll ( ".activeField input" ) [ 0 ] . focus ( ) } ) , SendVisitorData . send ( $scope . myform , getActiveField ( ) , TimeCounter . getTimeElapsed ( ) ) } } , $rootScope . nextField = $scope . nextField = function ( ) { var selected _index , selected _id ; $scope . selected . index < $scope . myform . visible _form _fields . length - 1 ? ( selected _index = $scope . selected . index + 1 , selected _id = $scope . myform . visible _form _fields [ selected _index ] . _id , $rootScope . setActiveField ( selected _id , selected _index , ! 0 ) ) : $scope . selected . index === $scope . myform . visible _form _fields . length - 1 && ( selected _index = $scope . selected . index + 1 , selected _id = "submit_field" , $rootScope . setActiveField ( selected _id , selected _index , ! 0 ) ) } , $rootScope . prevField = $scope . prevField = function ( ) { if ( $scope . selected . index > 0 ) { var selected _index = $scope . selected . index - 1 , selected _id = $scope . myform . visible _form _fields [ selected _index ] . _id ; $scope . setActiveField ( selected _id , selected _index , ! 0 ) } } , $scope . exitStartPage = function ( ) { $scope . myform . startPage . showStart = ! 1 , $scope . myform . visible _form _fields . length > 0 && ( $scope . selected . _id = $scope . myform . visible _form _fields [ 0 ] . _id ) } , $rootScope . goToInvalid = $scope . goToInvalid = function ( ) { document . querySelectorAll ( ".ng-invalid.focusOn" ) [ 0 ] . focus ( ) } , $rootScope . submitForm = $scope . submitForm = function ( ) { var _timeElapsed = T