angular.module('NodeForm.templates', []).run(['$templateCache', function($templateCache) { "use strict"; $templateCache.put("modules/core/views/header.client.view.html", "
"); $templateCache.put("modules/core/views/home.client.view.html", "

TellForm

Craft beautiful forms in seconds.

Craft beautiful forms.

TellForm is an opensource alternative to TypeForm that can create stunning forms from PDFs or from scratch

TellForm is an opensource alternative to TypeForm that can create stunning forms from PDFs or from scratch

Create your next ______.

Tell a story with a form.

"); $templateCache.put("modules/forms/admin/views/admin-form.client.view.html", "

"); $templateCache.put("../public/modules/forms/views/list-forms.client.view.html", ======= "

View Live Preview Form View Live Preview
"); $templateCache.put("modules/forms/admin/views/list-forms.client.view.html", >>>>>>> make it work "

Create a new form
Name
Language

Created on
"); <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 $templateCache.put("../public/modules/forms/views/submit-form.client.view.html", "
"); $templateCache.put("../public/modules/forms/views/adminTabs/analyze.html", ======= $templateCache.put("modules/forms/base/views/submit-form.client.view.html", "
"); $templateCache.put("modules/forms/admin/views/adminTabs/analyze.html", <<<<<<< 96591cc1e8fbb4fd9e1f61b6c8ba44f9aa5a02cf ======= ======= ======= >>>>>>> fix docker "

View Live Preview Form View Live Preview
"); $templateCache.put("modules/forms/admin/views/list-forms.client.view.html", "

Create a new form
Name
Language

Created on
"); $templateCache.put("modules/forms/base/views/submit-form.client.view.html", "
"); $templateCache.put("modules/forms/admin/views/adminTabs/analyze.html", <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 >>>>>>> make it work >>>>>>> make it work >>>>>>> make it work ======= >>>>>>> fix docker ""); $templateCache.put("modules/forms/admin/views/adminTabs/configure.html", ""); $templateCache.put("modules/forms/admin/views/adminTabs/create.html", ""); $templateCache.put("modules/forms/admin/views/adminTabs/design.html", "

Change how your Form Looks

Change how your Form Looks

Background Color
Question Text Color
Answer Text Color
Button Background Color
Button Text Color
"); $templateCache.put("modules/forms/admin/views/directiveViews/cgBusy/update-form-message-TypeA.html", "
{{$message}}
"); $templateCache.put("modules/forms/admin/views/directiveViews/cgBusy/update-form-message-TypeB.html", "
{{$message}}
"); <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c ======= <<<<<<< adb4e008930e5142044796081f66a1db54906706 >>>>>>> make it work $templateCache.put("../public/modules/forms/views/directiveViews/entryPage/startPage.html", "

{{pageData.introTitle}}

{{pageData.introParagraph}}

"); $templateCache.put("../public/modules/forms/views/directiveViews/field/date.html", "

{{index+1}} {{field.title}} optional

{{field.description}}

"); $templateCache.put("../public/modules/forms/views/directiveViews/field/dropdown.html", "
0\">

{{index+1}} {{field.title}} optional

{{field.description}}


"); $templateCache.put("../public/modules/forms/views/directiveViews/field/hidden.html", ""); $templateCache.put("../public/modules/forms/views/directiveViews/field/legal.html", "

{{index+1}} {{field.title}} optional


{{field.description}}


"); $templateCache.put("../public/modules/forms/views/directiveViews/field/radio.html", "
0\">

{{index+1}} {{field.title}} optional

{{field.description}}


"); $templateCache.put("../public/modules/forms/views/directiveViews/field/rating.html", "

{{index+1}} {{field.title}} optional

{{field.description}}

"); $templateCache.put("../public/modules/forms/views/directiveViews/field/statement.html", "

{{field.title}}

{{field.description}}

{{field.description}}


"); $templateCache.put("../public/modules/forms/views/directiveViews/field/textarea.html", "

{{index+1}} {{field.title}} optional

{{field.description}}

Press SHIFT+ENTER to add a newline
press ENTER
"); $templateCache.put("../public/modules/forms/views/directiveViews/field/textfield.html", "

{{index+1}} {{field.title}} (optional)

{{field.description}}

press ENTER
"); $templateCache.put("../public/modules/forms/views/directiveViews/field/yes_no.html", "

{{index+1}} {{field.title}} optional

{{field.description}}


"); $templateCache.put("../public/modules/forms/views/directiveViews/form/configure-form.client.view.html", <<<<<<< 96591cc1e8fbb4fd9e1f61b6c8ba44f9aa5a02cf "

PDF Generation/EMR

PDF Generation/EMR

Save Submissions as PDFs?
Upload Your PDF Template
{{myform.pdf.name}}
Upload your PDF
Autogenerate Form?
Use Oscarhost API?
Oscarhost API Username
Oscarhost API Password
Oscarhost API URL
Oscarhost API Update Type


Advanced Settings

Advanced Settings

Form Name
Form Status
Google Analytics Tracking Code
Language
* required
Display Form Footer?
Display Start Page?
"); ======= ======= $templateCache.put("modules/forms/admin/views/directiveViews/form/configure-form.client.view.html", >>>>>>> make it work "

PDF Generation/EMR

PDF Generation/EMR

Save Submissions as PDFs?
Upload Your PDF Template
{{myform.pdf.name}}
Upload your PDF
Autogenerate Form?
Use Oscarhost API?
Oscarhost API Username
Oscarhost API Password
Oscarhost API URL
Oscarhost API Update Type


Advanced Settings

Advanced Settings

Form Name
Form Status
Language
* required
Display Form Footer?
Display Start Page?
"); <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f >>>>>>> make it work $templateCache.put("../public/modules/forms/views/directiveViews/form/edit-form.client.view.html", "

Click to Add New Field

Add New Field

Add Field

Start Page

Preview Start Page

    {{myform.startPage.introTitle}}

    {{myform.startPage.introParagraph}}

Edit Start Page


Intro Title:
Intro Paragraph:
\n" + "
\n" + "\n" + "

\n" + "
\n" + "
Options:
\n" + "
\n" + "
\n" + " \n" + "\n" + " \n" + " \n" + " \n" + "
\n" + "
\n" + " \n" + "
\n" + "
\n" + "
\n" + "\n" + "\n" + "

\n" + "
\n" + "
Number of Steps:
\n" + "
\n" + " \n" + "
\n" + "
\n" + "
Shape:
\n" + "
\n" + " \n" + "
\n" + "
\n" + "\n" + "

\n" + "\n" + "
\n" + "
Required:
\n" + "
\n" + " \n" + "\n" + " \n" + "
\n" + "
\n" + "\n" + "
\n" + "
Disabled:
\n" + "
\n" + " \n" + "\n" + " \n" + "
\n" + "
\n" + "\n" + "
\n" + " \n" + "\n" + "
\n" + "
\n" + "

\n" + " Click on Fields to add them here\n" + "

\n" + "
\n" + "
\n" + "\n" + "
\n" + " \n" + "
\n" + "\n" + "
\n" + "
\n" + "
\n" + "
\n" + " \n" + " \n" + " \n" + "
\n" + "
\n" + "
\n" + "
\n" + "
\n" + "
\n" + "
\n" + "
\n" + " \n" + " \n" + " \n" + "
\n" + "
\n" + "
\n" + "
\n" + "\n" + "
\n" + "
\n" + "
\n" + " \n" + " \n" + "
\n" + "
\n" + "
\n" + "
\n" + "
\n" + "\n" + ""); <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c $templateCache.put("../public/modules/forms/views/directiveViews/form/edit-submissions-form.client.view.html", <<<<<<< 96591cc1e8fbb4fd9e1f61b6c8ba44f9aa5a02cf "
Total Views: {{myform.analytics.views}}
Submissions: {{myform.analytics.submissions}}
Conversion Rate: {{myform.analytics.conversionRate}}%

Field Title
Field Views
User dropoff rate at this field
{{fieldStats.field.title}}
{{fieldStats.totalViews}}
{{fieldStats.dropoffRate}}%

#{{value.title}}OscarEMR User ProfilePercentage CompleteTime ElapsedDeviceLocationIP AddressDate Submitted (UTC)Generated PDF
{{$index+1}}{{field.fieldValue.option_value}} {{field.fieldValue}}User Profile #{{row.oscarDemoNum}}{{row.percentageComplete}}%{{row.timeElapsed}}{{row.device.name}}, {{row.device.type}}{{row.geoLocation.city}}, {{row.geoLocation.country}}{{row.ipAddr}}{{row.created | date:'yyyy-MM-dd HH:mm:ss'}}Generated PDF
"); ======= "
#{{value.title}}OscarEMR User ProfilePercentage CompleteTime ElapsedDeviceLocationIP AddressDate Submitted (UTC)Generated PDF
{{$index+1}}{{field.fieldValue}}User Profile #{{row.oscarDemoNum}}{{row.percentageComplete}}%{{row.timeElapsed}}{{row.device.name}}, {{row.device.type}}{{row.geoLocation.city}}, {{row.geoLocation.country}}{{row.ipAddr}}{{row.created | date:'yyyy-MM-dd HH:mm:ss'}}Generated PDF
"); ======= $templateCache.put("modules/forms/admin/views/directiveViews/form/edit-submissions-form.client.view.html", "
#{{value.title}}OscarEMR User ProfilePercentage CompleteTime ElapsedDeviceLocationIP AddressDate Submitted (UTC)Generated PDF
{{$index+1}}{{field.fieldValue}}User Profile #{{row.oscarDemoNum}}{{row.percentageComplete}}%{{row.timeElapsed}}{{row.device.name}}, {{row.device.type}}{{row.geoLocation.city}}, {{row.geoLocation.country}}{{row.ipAddr}}{{row.created | date:'yyyy-MM-dd HH:mm:ss'}}Generated PDF
"); <<<<<<< 95d6fb967b8d351fe9e17be40be308a8fe73c55f >>>>>>> make it work >>>>>>> make it work $templateCache.put("../public/modules/forms/views/directiveViews/form/submit-form.client.view.html", "
{{form_fields_count - (myform | formValidity)}} answer(s) need completing
press ENTER

{{myform | formValidity}} out of {{form_fields_count}} answered

"); $templateCache.put("../public/modules/users/views/authentication/access-denied.client.view.html", ======= $templateCache.put("modules/forms/base/views/directiveViews/entryPage/startPage.html", "

{{pageData.introTitle}}

{{pageData.introParagraph}}

"); $templateCache.put("modules/forms/base/views/directiveViews/field/date.html", "

{{field.title}} {{ 'OPTIONAL' | translate }}

"); $templateCache.put("modules/forms/base/views/directiveViews/field/dropdown.html", "
0\">

{{field.title}} {{ 'OPTIONAL' | translate }}

{{$select.selected.option_value}}

"); $templateCache.put("modules/forms/base/views/directiveViews/field/file.html", "
{{field.title}} (* {{ 'REQUIRED' | translate }})
{{field.file.originalname}}
{{ UPLOAD_FILE | translate }}
"); $templateCache.put("modules/forms/base/views/directiveViews/field/hidden.html", ""); $templateCache.put("modules/forms/base/views/directiveViews/field/legal.html", "

{{field.title}} {{ 'OPTIONAL' | translate }}


{{field.description}}


"); $templateCache.put("modules/forms/base/views/directiveViews/field/radio.html", "
0\" on-enter-key=chooseDefaultOption()>

{{field.title}} {{ 'OPTIONAL' | translate }}


"); $templateCache.put("modules/forms/base/views/directiveViews/field/rating.html", "

{{field.title}} {{ 'OPTIONAL' | translate }}

"); $templateCache.put("modules/forms/base/views/directiveViews/field/statement.html", "

{{field.title}}

{{field.description}}


"); $templateCache.put("modules/forms/base/views/directiveViews/field/textarea.html", "

{{field.title}} {{ 'OPTIONAL' | translate }}

{{ 'ENTER' | translate }}
"); $templateCache.put("modules/forms/base/views/directiveViews/field/textfield.html", "

{{field.title}} ({{ 'OPTIONAL' | translate }})

{{ 'ENTER' | translate }}
"); $templateCache.put("modules/forms/base/views/directiveViews/field/yes_no.html", "

{{field.title}} *({{ REQUIRED | translate }})

{{field.description}}


"); $templateCache.put("modules/forms/base/views/directiveViews/form/submit-form.client.view.html", "
press ENTER

{{ 'ADVANCEMENT' | translate:translateAdvancementData }}

"); $templateCache.put("modules/users/views/authentication/access-denied.client.view.html", >>>>>>> make it work "

You need to be logged in to access this page

Login
"); <<<<<<< adb4e008930e5142044796081f66a1db54906706 $templateCache.put("../public/modules/users/views/authentication/signin.client.view.html", "

Sign into your account

Error:
  or  Sign up
"); $templateCache.put("../public/modules/users/views/authentication/signup-success.client.view.html", <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f "

Signup Successful

You've successfully registered an account at TellForm.

But your account is not activated yet



Before you continue, make sure to check your email for our verification. If you don't receive it within 24h drop us a line at polydaic@gmail.com

"); $templateCache.put("../public/modules/users/views/authentication/signup.client.view.html", ======= ======= >>>>>>> fix docker $templateCache.put("modules/forms/admin/views/directiveViews/form/edit-submissions-form.client.view.html", "
#{{value.title}}OscarEMR User ProfilePercentage CompleteTime ElapsedDeviceLocationIP AddressDate Submitted (UTC)Generated PDF
{{$index+1}}{{field.fieldValue.field_title}}{{field.fieldValue}}User Profile #{{row.oscarDemoNum}}{{row.percentageComplete}}%{{row.timeElapsed}}{{row.device.name}}, {{row.device.type}}{{row.geoLocation.city}}, {{row.geoLocation.country}}{{row.ipAddr}}{{row.created | date:'yyyy-MM-dd HH:mm:ss'}}Generated PDF
"); $templateCache.put("modules/forms/base/views/directiveViews/entryPage/startPage.html", "

{{pageData.introTitle}}

{{pageData.introParagraph}}

"); $templateCache.put("modules/forms/base/views/directiveViews/field/date.html", "

{{index+1}} {{field.title}} {{ 'OPTIONAL' | translate }}

"); $templateCache.put("modules/forms/base/views/directiveViews/field/dropdown.html", "
0\">

{{index+1}} {{field.title}} {{ 'OPTIONAL' | translate }}

{{$select.selected.option_value}}

"); $templateCache.put("modules/forms/base/views/directiveViews/field/file.html", "

{{index+1}} {{field.title}} {{ 'OPTIONAL' | translate }}

{{field.file.originalname}}
{{ UPLOAD_FILE | translate }}
"); $templateCache.put("modules/forms/base/views/directiveViews/field/hidden.html", ""); $templateCache.put("modules/forms/base/views/directiveViews/field/legal.html", "

{{index+1}} {{field.title}} {{ 'OPTIONAL' | translate }}


{{field.description}}


"); $templateCache.put("modules/forms/base/views/directiveViews/field/radio.html", "
0\">

{{index+1}} {{field.title}} {{ 'OPTIONAL' | translate }}


"); $templateCache.put("modules/forms/base/views/directiveViews/field/rating.html", "

{{index+1}} {{field.title}} {{ 'OPTIONAL' | translate }}

"); $templateCache.put("modules/forms/base/views/directiveViews/field/statement.html", "

{{field.title}}

{{field.description}}


"); $templateCache.put("modules/forms/base/views/directiveViews/field/textarea.html", "

{{index+1}} {{field.title}} {{ 'OPTIONAL' | translate }}

{{ 'NEWLINE' | translate }}
{{ 'ENTER' | translate }}
"); $templateCache.put("modules/forms/base/views/directiveViews/field/textfield.html", "

{{index+1}} {{field.title}} ({{ 'OPTIONAL' | translate }})

{{ 'ENTER' | translate }}
"); $templateCache.put("modules/forms/base/views/directiveViews/field/yes_no.html", "

{{index+1}} {{field.title}} {{ 'OPTIONAL' | translate }}

{{field.description}}


"); $templateCache.put("modules/forms/base/views/directiveViews/form/submit-form.client.view.html", "
{{ 'COMPLETING_NEEDED' | translate:translateAdvancementData }}
{{ 'ENTER' | translate }}

{{ 'ADVANCEMENT' | translate:translateAdvancementData }}

"); $templateCache.put("modules/users/views/authentication/access-denied.client.view.html", "

You need to be logged in to access this page

Login
"); $templateCache.put("modules/users/views/authentication/signin.client.view.html", "

Sign into your account

Error:
  or  Sign up
"); $templateCache.put("modules/users/views/authentication/signup-success.client.view.html", "

Signup Successful

You've successfully registered an account at TellForm.

But your account is not activated yet



Before you continue, make sure to check your email for our verification. If you don't receive it within 24h drop us a line at polydaic@gmail.com

"); $templateCache.put("modules/users/views/authentication/signup.client.view.html", "

Signup with your email

Couldn't submit form due to errors:

"); $templateCache.put("modules/users/views/password/forgot-password.client.view.html", "

Restore your password

Enter your account email.

{{error}}
{{success}}
"); $templateCache.put("modules/users/views/password/reset-password-invalid.client.view.html", "

Password reset is invalid

Ask for a new password reset
"); $templateCache.put("modules/users/views/password/reset-password-success.client.view.html", "

Password successfully reset

Continue to home page
"); $templateCache.put("modules/users/views/password/reset-password.client.view.html", "

Reset your password

{{error}}
{{success}}
"); $templateCache.put("modules/users/views/settings/change-password.client.view.html", "

Change your password


Password Changed Successfully
"); $templateCache.put("modules/users/views/settings/edit-profile.client.view.html", "

Edit your profile

Profile Saved Successfully
Couldn't Save Your Profile.
Error:
First Name
Last Name

Language
Email (also your username)
"); $templateCache.put("modules/users/views/settings/social-accounts.client.view.html", "

Connected social accounts:

Connect other social accounts:

"); $templateCache.put("modules/users/views/verify/resend-verify-email.client.view.html", "

Resend your account verification email

Enter your account email.

{{error}}

Verification Email has been Sent

A verification email has been sent to {{username}}.
But your account is still not activated yet

Check your email and click on the activation link to activate your account. If you have any questions drop us a line at polydaic@gmail.com

"); $templateCache.put("modules/users/views/verify/verify-account.client.view.html", "

Account successfuly activated

Continue to login page

Verification link is invalid or has expired

Resend your verification email Signin to your account
"); }]); 'use strict'; // Init the application configuration module for AngularJS application var ApplicationConfiguration = (function() { // Init module configuration options var applicationModuleName = 'NodeForm'; var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'cgBusy', 'ngSanitize', 'vButton', 'ngResource', 'NodeForm.templates', 'ui.router', 'ui.bootstrap', 'ui.utils']; // Add a new vertical module var registerModule = function(moduleName, dependencies) { // Create angular module angular.module(moduleName, dependencies || []); // Add the module to the AngularJS configuration file angular.module(applicationModuleName).requires.push(moduleName); }; return { applicationModuleName: applicationModuleName, applicationModuleVendorDependencies: applicationModuleVendorDependencies, registerModule: registerModule }; })(); 'use strict'; //Start by defining the main module and adding the module dependencies angular.module(ApplicationConfiguration.applicationModuleName, ApplicationConfiguration.applicationModuleVendorDependencies); // Setting HTML5 Location Mode angular.module(ApplicationConfiguration.applicationModuleName).config(['$locationProvider', function($locationProvider) { $locationProvider.hashPrefix('!'); } ]); //Permission Constants angular.module(ApplicationConfiguration.applicationModuleName).constant('APP_PERMISSIONS', { viewAdminSettings: 'viewAdminSettings', editAdminSettings: 'editAdminSettings', editForm: 'editForm', viewPrivateForm: 'viewPrivateForm' }); //User Role constants angular.module(ApplicationConfiguration.applicationModuleName).constant('USER_ROLES', { admin: 'admin', normal: 'user', superuser: 'superuser' }); //form url angular.module(ApplicationConfiguration.applicationModuleName).constant('FORM_URL', '/forms/:formId'); angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope', 'Auth', '$state', '$stateParams', function($rootScope, Auth, $state, $stateParams) { $rootScope.$state = $state; $rootScope.$stateParams = $stateParams; // add previous state property $rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState) { $state.previous = fromState; //console.log('toState: '+toState.name); var statesToIgnore = ['home', 'signin', 'resendVerifyEmail', 'verify', 'signup', 'signup-success', 'forgot', 'reset-invalid', 'reset', 'reset-success']; //Redirect to listForms if user is authenticated if(statesToIgnore.indexOf(toState.name) > 0){ if(Auth.isAuthenticated()){ event.preventDefault(); // stop current execution //console.log('go to forms'); $state.go('listForms'); // go to listForms page } } //Redirect to 'signup' route if user is not authenticated else if(toState.name !== 'access_denied' && !Auth.isAuthenticated() && toState.name !== 'submitForm'){ console.log('go to signup'); event.preventDefault(); // stop current execution $state.go('listForms'); // go to listForms page } }); } ]); //Page access/authorization logic angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope', 'Auth', 'User', 'Authorizer', '$state', '$stateParams', function($rootScope, Auth, User, Authorizer, $state, $stateParams) { $rootScope.$on('$stateChangeStart', function(event, next) { var authenticator, permissions, user; permissions = next && next.data && next.data.permissions ? next.data.permissions : null; Auth.ensureHasCurrentUser(User); user = Auth.currentUser; if(user){ authenticator = new Authorizer(user); //console.log('access denied: '+!authenticator.canAccess(permissions)); //console.log(permissions); if( (permissions != null) ){ if( !authenticator.canAccess(permissions) ){ event.preventDefault(); //console.log('access denied'); $state.go('access_denied'); } } } }); }]); //Then define the init function for starting up the application angular.element(document).ready(function() { //Fixing facebook bug with redirect if (window.location.hash === '#_=_') window.location.hash = '#!'; //Then init the app angular.bootstrap(document, [ApplicationConfiguration.applicationModuleName]); }); <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c ======= <<<<<<< adb4e008930e5142044796081f66a1db54906706 >>>>>>> make it work 'use strict'; // Use Application configuration module to register a new module ApplicationConfiguration.registerModule('core', ['users']); 'use strict'; // Use Application configuration module to register a new module ApplicationConfiguration.registerModule('forms', ['ngFileUpload', 'ui.router.tabs', 'colorpicker.module', 'ui.date', 'ui.sortable', 'angular-input-stars', 'users']); 'use strict'; // Use Application configuration module to register a new module ApplicationConfiguration.registerModule('users'); 'use strict'; // Setting up route angular.module('core').config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider, Authorization) { // Redirect to home view when route not found $urlRouterProvider.otherwise('/forms'); } ]); 'use strict'; angular.module('core').controller('HeaderController', ['$rootScope', '$scope', 'Menus', '$state', 'Auth', 'User', '$window', function ($rootScope, $scope, Menus, $state, Auth, User, $window) { $rootScope.signupDisabled = $window.signupDisabled; $scope.user = $rootScope.user = Auth.ensureHasCurrentUser(User); $scope.authentication = $rootScope.authentication = Auth; $rootScope.languages = $scope.languages = ['english', 'french', 'spanish']; $scope.isCollapsed = false; $rootScope.hideNav = false; $scope.menu = Menus.getMenu('topbar'); $scope.signout = function() { var promise = User.logout(); promise.then(function() { Auth.logout(); Auth.ensureHasCurrentUser(User); $scope.user = $rootScope.user = null; $state.go('listForms'); }, function(reason) { console.log('Logout Failed: ' + reason); }); }; $scope.toggleCollapsibleMenu = function() { $scope.isCollapsed = !$scope.isCollapsed; }; // Collapsing the menu after navigation $scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) { $scope.isCollapsed = false; $rootScope.hideNav = false; if ( angular.isDefined( toState.data ) ) { if ( angular.isDefined( toState.data.hideNav ) ) { $rootScope.hideNav = toState.data.hideNav; } } }); } ]); 'use strict'; angular.module('core').controller('HomeController', ['$rootScope', '$scope', 'User', '$state', function($rootScope, $scope, User, $state) { $scope = $rootScope; } ]); 'use strict'; //Menu service used for managing menus angular.module('core').service('Menus', [ function() { // Define a set of default roles this.defaultRoles = ['*']; // Define the menus object this.menus = {}; // A private function for rendering decision var shouldRender = function(user) { if (user) { if (~this.roles.indexOf('*')) { return true; } else { for (var userRoleIndex in user.roles) { for (var roleIndex in this.roles) { console.log(this.roles[roleIndex]); console.log( this.roles[roleIndex] === user.roles[userRoleIndex]); if (this.roles[roleIndex] === user.roles[userRoleIndex]) { return true; } } } } } else { return this.isPublic; } return false; }; // Validate menu existance this.validateMenuExistance = function(menuId) { if (menuId && menuId.length) { if (this.menus[menuId]) { return true; } else { throw new Error('Menu does not exists'); } } else { throw new Error('MenuId was not provided'); } return false; }; // Get the menu object by menu id this.getMenu = function(menuId) { // Validate that the menu exists this.validateMenuExistance(menuId); // Return the menu object return this.menus[menuId]; }; // Add new menu object by menu id this.addMenu = function(menuId, isPublic, roles) { // Create the new menu this.menus[menuId] = { isPublic: isPublic || false, roles: roles || this.defaultRoles, items: [], shouldRender: shouldRender }; // Return the menu object return this.menus[menuId]; }; // Remove existing menu object by menu id this.removeMenu = function(menuId) { // Validate that the menu exists this.validateMenuExistance(menuId); // Return the menu object delete this.menus[menuId]; }; // Add menu item object this.addMenuItem = function(menuId, menuItemTitle, menuItemURL, menuItemType, menuItemUIRoute, isPublic, roles, position) { // Validate that the menu exists this.validateMenuExistance(menuId); // Push new menu item this.menus[menuId].items.push({ title: menuItemTitle, link: menuItemURL, menuItemType: menuItemType || 'item', menuItemClass: menuItemType, uiRoute: menuItemUIRoute || ('/' + menuItemURL), isPublic: ((isPublic === null || typeof isPublic === 'undefined') ? this.menus[menuId].isPublic : isPublic), roles: ((roles === null || typeof roles === 'undefined') ? this.menus[menuId].roles : roles), position: position || 0, items: [], shouldRender: shouldRender }); // Return the menu object return this.menus[menuId]; }; // Add submenu item object this.addSubMenuItem = function(menuId, rootMenuItemURL, menuItemTitle, menuItemURL, menuItemUIRoute, isPublic, roles, position) { // Validate that the menu exists this.validateMenuExistance(menuId); // Search for menu item for (var itemIndex in this.menus[menuId].items) { if (this.menus[menuId].items[itemIndex].link === rootMenuItemURL) { // Push new submenu item this.menus[menuId].items[itemIndex].items.push({ title: menuItemTitle, link: menuItemURL, uiRoute: menuItemUIRoute || ('/' + menuItemURL), isPublic: ((isPublic === null || typeof isPublic === 'undefined') ? this.menus[menuId].items[itemIndex].isPublic : isPublic), roles: ((roles === null || typeof roles === 'undefined') ? this.menus[menuId].items[itemIndex].roles : roles), position: position || 0, shouldRender: shouldRender }); } } // Return the menu object return this.menus[menuId]; }; // Remove existing menu object by menu id this.removeMenuItem = function(menuId, menuItemURL) { // Validate that the menu exists this.validateMenuExistance(menuId); // Search for menu item to remove for (var itemIndex in this.menus[menuId].items) { if (this.menus[menuId].items[itemIndex].link === menuItemURL) { this.menus[menuId].items.splice(itemIndex, 1); } } <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 // Return the menu object return this.menus[menuId]; }; // Remove existing menu object by menu id this.removeSubMenuItem = function(menuId, submenuItemURL) { // Validate that the menu exists this.validateMenuExistance(menuId); // Search for menu item to remove for (var itemIndex in this.menus[menuId].items) { for (var subitemIndex in this.menus[menuId].items[itemIndex].items) { if (this.menus[menuId].items[itemIndex].items[subitemIndex].link === submenuItemURL) { this.menus[menuId].items[itemIndex].items.splice(subitemIndex, 1); } } } // Return the menu object return this.menus[menuId]; }; //Adding the topbar menu this.addMenu('topbar', false, ['*']); //Adding the bottombar menu for the Form-Footer view this.addMenu('bottombar', false, ['*']); } ]); (function () { 'use strict'; // Create the Socket.io wrapper service angular .module('core') .factory('Socket', Socket); Socket.$inject = ['$timeout', '$window']; function Socket($timeout, $window) { var service = { connect: connect, emit: emit, on: on, removeListener: removeListener, socket: null }; console.log('https://'+window.location.hostname+':'+$window.socketPort); connect('https://'+window.location.hostname+':'+$window.socketPort); return service; // Connect to Socket.io server function connect(url) { service.socket = io(); } // Wrap the Socket.io 'emit' method function emit(eventName, data) { if (service.socket) { service.socket.emit(eventName, data); } } // Wrap the Socket.io 'on' method function on(eventName, callback) { if (service.socket) { service.socket.on(eventName, function (data) { $timeout(function () { callback(data); }); }); } } // Wrap the Socket.io 'removeListener' method function removeListener(eventName) { if (service.socket) { service.socket.removeListener(eventName); } } } }()); 'use strict'; // Configuring the Forms drop-down menus angular.module('forms').run(['Menus', function(Menus) { // Set top bar menu items Menus.addMenuItem('topbar', 'My Forms', 'forms', '', '/forms', false); } ]).filter('formValidity', function(){ return function(formObj){ if(formObj && formObj.form_fields && formObj.visible_form_fields){ //get keys var formKeys = Object.keys(formObj); //we only care about things that don't start with $ var fieldKeys = formKeys.filter(function(key){ return key[0] !== '$'; }); var fields = formObj.form_fields; var valid_count = fields.filter(function(field){ if(typeof field === 'object' && field.fieldType !== 'statement' && field.fieldType !== 'rating'){ return !!(field.fieldValue); } }).length; return valid_count - (formObj.form_fields.length - formObj.visible_form_fields.length); } return 0; }; }).config(['$provide', function ($provide){ $provide.decorator('accordionDirective', ["$delegate", function($delegate) { var directive = $delegate[0]; directive.replace = true; return $delegate; }]); }]); 'use strict'; // Setting up route angular.module('forms').config(['$stateProvider', function($stateProvider) { // Forms state routing $stateProvider. state('listForms', { url: '/forms', templateUrl: 'modules/forms/views/list-forms.client.view.html' }). state('submitForm', { url: '/forms/:formId', templateUrl: 'modules/forms/views/submit-form.client.view.html', data: { hideNav: true }, resolve: { Forms: 'Forms', myForm: ["Forms", "$stateParams", function (Forms, $stateParams) { return Forms.get({formId: $stateParams.formId}).$promise; }] }, controller: 'SubmitFormController', controllerAs: 'ctrl' }).state('viewForm', { url: '/forms/:formId/admin', templateUrl: 'modules/forms/views/admin-form.client.view.html', data: { permissions: [ 'editForm' ] }, resolve: { Forms: 'Forms', myForm: ["Forms", "$stateParams", function (Forms, $stateParams) { return Forms.get({formId: $stateParams.formId}).$promise; }] }, controller: 'AdminFormController' }).state('viewForm.configure', { url: '/configure', templateUrl: 'modules/forms/views/adminTabs/configure.html' }).state('viewForm.design', { url: '/design', templateUrl: 'modules/forms/views/adminTabs/design.html' }).state('viewForm.analyze', { url: '/analyze', templateUrl: 'modules/forms/views/adminTabs/analyze.html', }).state('viewForm.create', { url: '/create', templateUrl: 'modules/forms/views/adminTabs/create.html' }); ======= ======= ======= >>>>>>> fix docker angular.module('NodeForm.templates', []).run(['$templateCache', function($templateCache) { "use strict"; $templateCache.put("../public/modules/core/views/header.client.view.html", "
"); $templateCache.put("../public/modules/core/views/home.client.view.html", "

TellForm

Craft beautiful forms in seconds.

Craft beautiful forms.

TellForm is an opensource alternative to TypeForm that can create stunning forms from PDFs or from scratch

TellForm is an opensource alternative to TypeForm that can create stunning forms from PDFs or from scratch

Create your next ______.

Tell a story with a form.

"); $templateCache.put("../public/modules/forms/views/admin-form.client.view.html", "
"); $templateCache.put("../public/modules/forms/views/list-forms.client.view.html", "

Create a new form
Name
Language

Created on
"); $templateCache.put("../public/modules/forms/views/submit-form.client.view.html", "
"); $templateCache.put("../public/modules/forms/views/adminTabs/analyze.html", ""); $templateCache.put("../public/modules/forms/views/adminTabs/configure.html", ""); $templateCache.put("../public/modules/forms/views/adminTabs/create.html", ""); $templateCache.put("../public/modules/forms/views/adminTabs/design.html", "

Change how your Form Looks

Change how your Form Looks

Background Color
Question Text Color
Answer Text Color
Button Background Color
Button Text Color
"); $templateCache.put("../public/modules/forms/views/directiveViews/cgBusy/update-form-message-TypeA.html", "
{{$message}}
"); $templateCache.put("../public/modules/forms/views/directiveViews/cgBusy/update-form-message-TypeB.html", "
{{$message}}
"); $templateCache.put("../public/modules/forms/views/directiveViews/entryPage/startPage.html", "

{{pageData.introTitle}}

{{pageData.introParagraph}}

"); $templateCache.put("../public/modules/forms/views/directiveViews/field/date.html", "

{{field.title}} *(required)

"); $templateCache.put("../public/modules/forms/views/directiveViews/field/dropdown.html", "
0\">

{{field.title}} *(required)

{{$select.selected.option_value}}

"); $templateCache.put("../public/modules/forms/views/directiveViews/field/file.html", "
{{field.title}} (* required)
{{field.file.originalname}}
Upload your File
"); $templateCache.put("../public/modules/forms/views/directiveViews/field/hidden.html", ""); $templateCache.put("../public/modules/forms/views/directiveViews/field/legal.html", "

{{field.title}} *(required)


{{field.description}}


"); $templateCache.put("../public/modules/forms/views/directiveViews/field/natural.html", "

{{field.title}} *(required)


"); $templateCache.put("../public/modules/forms/views/directiveViews/field/password.html", "

{{field.title}} *(required)

"); $templateCache.put("../public/modules/forms/views/directiveViews/field/radio.html", "
0\">

{{field.title}} *(required)


"); $templateCache.put("../public/modules/forms/views/directiveViews/field/rating.html", "

{{field.title}} *(required)

"); $templateCache.put("../public/modules/forms/views/directiveViews/field/statement.html", "

{{field.title}}

{{field.description}}


"); $templateCache.put("../public/modules/forms/views/directiveViews/field/textarea.html", "

{{field.title}} *(required)

press ENTER
"); $templateCache.put("../public/modules/forms/views/directiveViews/field/textfield.html", "

{{field.title}} *(required)

press ENTER
"); $templateCache.put("../public/modules/forms/views/directiveViews/field/yes_no.html", "

{{field.title}} *(required)

{{field.description}}


"); $templateCache.put("../public/modules/forms/views/directiveViews/form/configure-form.client.view.html", "

PDF Generation/EMR

PDF Generation/EMR

Save Submissions as PDFs?
Upload Your PDF Template
{{myform.pdf.originalname}}
Upload your PDF
Autogenerate Form?
Use Oscarhost API?
Oscarhost API Username
Oscarhost API Password
Oscarhost API URL
Oscarhost API Update Type


Advanced Settings

Advanced Settings

Form Name
Form Status
Language
* required
Display Form Footer?
Display Start Page?
"); $templateCache.put("../public/modules/forms/views/directiveViews/form/edit-form.client.view.html", "

Click to Add New Field

Add New Field

Add Field

Start Page

Preview Start Page

    {{myform.startPage.introTitle}}

    {{myform.startPage.introParagraph}}

Edit Start Page


Intro Title:
Intro Paragraph:
\n" + "
\n" + "\n" + "

\n" + "
\n" + "
Options:
\n" + "
\n" + "
\n" + " \n" + "\n" + " \n" + " \n" + " \n" + "
\n" + "
\n" + " \n" + "
\n" + "
\n" + "
\n" + "\n" + "

\n" + "\n" + "
\n" + "
Required:
\n" + "
\n" + " \n" + "\n" + " \n" + "
\n" + "
\n" + "\n" + "
\n" + "
Disabled:
\n" + "
\n" + " \n" + "\n" + " \n" + "
\n" + "
\n" + "\n" + "
\n" + " \n" + "\n" + "
\n" + "
\n" + "

\n" + " Click on Fields to add them here\n" + "

\n" + "
\n" + "
\n" + "\n" + "
\n" + " \n" + "
\n" + "\n" + "
\n" + "
\n" + "
\n" + "
\n" + " \n" + " \n" + " \n" + "
\n" + "
\n" + "
\n" + "
\n" + "
\n" + "
\n" + "
\n" + "
\n" + " \n" + " \n" + " \n" + "
\n" + "
\n" + "
\n" + "
\n" + "\n" + "
\n" + "
\n" + "
\n" + " \n" + " \n" + "
\n" + "
\n" + "
\n" + "
\n" + "
\n" + "\n" + ""); $templateCache.put("../public/modules/forms/views/directiveViews/form/edit-submissions-form.client.view.html", "
#{{value.title}}OscarEMR User ProfilePercentage CompleteTime ElapsedDeviceLocationIP AddressDate Submitted (UTC)Generated PDF
{{$index+1}}{{field.fieldValue}}User Profile #{{row.oscarDemoNum}}{{row.percentageComplete}}%{{row.timeElapsed}}{{row.device.name}}, {{row.device.type}}{{row.geoLocation.city}}, {{row.geoLocation.country}}{{row.ipAddr}}{{row.created | date:'yyyy-MM-dd HH:mm:ss'}}Generated PDF
"); $templateCache.put("../public/modules/forms/views/directiveViews/form/submit-form.client.view.html", "
press ENTER

{{myform | formValidity}} out of {{form_fields_count}} answered

"); $templateCache.put("../public/modules/users/views/authentication/access-denied.client.view.html", "

You need to be logged in to access this page

Login
"); $templateCache.put("../public/modules/users/views/authentication/signin.client.view.html", "

Sign into your account

Error:
  or  Sign up
"); $templateCache.put("../public/modules/users/views/authentication/signup-success.client.view.html", "

Signup Successful

You've successfully registered an account at TellForm.

But your account is not activated yet



Before you continue, make sure to check your email for our verification. If you don't receive it within 24h drop us a line at hi@TellForm.com

"); $templateCache.put("../public/modules/users/views/authentication/signup.client.view.html", "

Signup with your email

Couldn't submit form due to errors:

"); $templateCache.put("../public/modules/users/views/password/forgot-password.client.view.html", "

Restore your password

Enter your account email.

{{error}}
{{success}}
"); $templateCache.put("../public/modules/users/views/password/reset-password-invalid.client.view.html", "

Password reset is invalid

Ask for a new password reset
"); $templateCache.put("../public/modules/users/views/password/reset-password-success.client.view.html", "

Password successfully reset

Continue to home page
"); $templateCache.put("../public/modules/users/views/password/reset-password.client.view.html", "

Reset your password

{{error}}
{{success}}
"); $templateCache.put("../public/modules/users/views/settings/change-password.client.view.html", "

Change your password


Password Changed Successfully
"); $templateCache.put("../public/modules/users/views/settings/edit-profile.client.view.html", "

Edit your profile

Profile Saved Successfully
Couldn't Save Your Profile.
Error:
First Name
Last Name

Language
Email (also your username)
"); $templateCache.put("../public/modules/users/views/settings/social-accounts.client.view.html", "

Connected social accounts:

Connect other social accounts:

"); $templateCache.put("../public/modules/users/views/verify/resend-verify-email.client.view.html", "

Resend your account verification email

Enter your account email.

{{error}}

Verification Email has been Sent

A verification email has been sent to {{username}}.
But your account is still not activated yet

Check your email and click on the activation link to activate your account. If you have any questions drop us a line at hi@TellForm.com

"); $templateCache.put("../public/modules/users/views/verify/verify-account.client.view.html", "

Account successfuly activated

Continue to login page

Verification link is invalid or has expired

Resend your verification email Signin to your account
"); }]); 'use strict'; // Use Application configuration module to register a new module ApplicationConfiguration.registerModule('core', ['users']); 'use strict'; // Use Application configuration module to register a new module ApplicationConfiguration.registerModule('forms', [ 'ngFileUpload', 'ui.router.tabs', 'ui.date', 'ui.sortable', 'angular-input-stars', 'users', 'pascalprecht.translate' ]);//, 'colorpicker.module' @TODO reactivate this module 'use strict'; // Use Application configuration module to register a new module ApplicationConfiguration.registerModule('users'); 'use strict'; // Setting up route angular.module('core').config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider, Authorization) { // Redirect to home view when route not found $urlRouterProvider.otherwise('/forms'); } ]); 'use strict'; angular.module('core').controller('HeaderController', ['$rootScope', '$scope', 'Menus', '$state', 'Auth', 'User', '$window', function ($rootScope, $scope, Menus, $state, Auth, User, $window) { $rootScope.signupDisabled = $window.signupDisabled; $scope.user = $rootScope.user = Auth.ensureHasCurrentUser(User); $scope.authentication = $rootScope.authentication = Auth; $rootScope.languages = $scope.languages = ['english', 'french', 'spanish']; $scope.isCollapsed = false; $rootScope.hideNav = false; $scope.menu = Menus.getMenu('topbar'); $scope.signout = function() { var promise = User.logout(); promise.then(function() { Auth.logout(); Auth.ensureHasCurrentUser(User); $scope.user = $rootScope.user = null; $state.go('listForms'); }, function(reason) { console.log('Logout Failed: ' + reason); }); }; $scope.toggleCollapsibleMenu = function() { $scope.isCollapsed = !$scope.isCollapsed; }; // Collapsing the menu after navigation $scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) { $scope.isCollapsed = false; $rootScope.hideNav = false; if ( angular.isDefined( toState.data ) ) { if ( angular.isDefined( toState.data.hideNav ) ) { $rootScope.hideNav = toState.data.hideNav; } } }); } ]); 'use strict'; angular.module('core').controller('HomeController', ['$rootScope', '$scope', 'User', '$state', function($rootScope, $scope, User, $state) { $scope = $rootScope; >>>>>>> make it work } ]); 'use strict'; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< 96591cc1e8fbb4fd9e1f61b6c8ba44f9aa5a02cf <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 // Forms controller angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal', 'myForm', function($rootScope, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal, myForm) { $scope = $rootScope; $scope.animationsEnabled = true; $scope.myform = myForm; $rootScope.saveInProgress = false; CurrentForm.setForm($scope.myform); ======= <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c ======= <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c ======= <<<<<<< adb4e008930e5142044796081f66a1db54906706 >>>>>>> make it work >>>>>>> make it work $scope.tabData = [ { heading: 'Create', route: 'viewForm.create' }, { heading: 'Design', route: 'viewForm.design' }, { heading: 'Configure', route: 'viewForm.configure' }, { heading: 'Analyze', route: 'viewForm.analyze' } ]; <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 $scope.setForm = function(form){ $scope.myform = form; }; $rootScope.resetForm = function(){ $scope.myform = Forms.get({ formId: $stateParams.formId }); }; ======= ======= ======= >>>>>>> fix docker //Menu service used for managing menus angular.module('core').service('Menus', [ function() { // Define a set of default roles this.defaultRoles = ['*']; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c <<<<<<< 96591cc1e8fbb4fd9e1f61b6c8ba44f9aa5a02cf ======= ======= <<<<<<< adb4e008930e5142044796081f66a1db54906706 >>>>>>> make it work >>>>>>> make it work /* ** DeleteModal Functions */ $scope.openDeleteModal = function(){ $scope.deleteModal = $uibModal.open({ animation: $scope.animationsEnabled, templateUrl: 'myModalContent.html', controller: 'AdminFormController', resolve: { myForm: function(){ return $scope.myform; <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 } } }); $scope.deleteModal.result.then(function (selectedItem) { $scope.selected = selectedItem; }, function () { console.log('Modal dismissed at: ' + new Date()); }); }; $scope.cancelDeleteModal = function(){ if($scope.deleteModal){ $scope.deleteModal.dismiss('cancel'); } }; // Remove existing Form $scope.removeCurrentForm = function() { if($scope.deleteModal && $scope.deleteModal.opened){ ======= ======= ======= >>>>>>> fix docker // Define the menus object this.menus = {}; // A private function for rendering decision var shouldRender = function(user) { if (user) { if (~this.roles.indexOf('*')) { return true; } else { for (var userRoleIndex in user.roles) { for (var roleIndex in this.roles) { console.log(this.roles[roleIndex]); console.log( this.roles[roleIndex] === user.roles[userRoleIndex]); if (this.roles[roleIndex] === user.roles[userRoleIndex]) { return true; } } } } } else { return this.isPublic; } return false; }; // Validate menu existance this.validateMenuExistance = function(menuId) { if (menuId && menuId.length) { if (this.menus[menuId]) { return true; } else { throw new Error('Menu does not exists'); } } else { throw new Error('MenuId was not provided'); } return false; }; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c <<<<<<< 96591cc1e8fbb4fd9e1f61b6c8ba44f9aa5a02cf ======= ======= <<<<<<< adb4e008930e5142044796081f66a1db54906706 >>>>>>> make it work >>>>>>> make it work $scope.deleteModal.close(); var form_id = $scope.myform._id; if(!form_id) throw new Error('Error - removeCurrentForm(): $scope.myform._id does not exist'); $http.delete('/forms/'+form_id) .success(function(data, status, headers){ console.log('form deleted successfully'); $state.go('listForms', {}, {reload: true}); <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 }).error(function(error){ console.log('ERROR: Form could not be deleted.'); console.error(error); }); } }; // Update existing Form $scope.update = $rootScope.update = function(updateImmediately, cb){ ======= ======= ======= >>>>>>> fix docker // Get the menu object by menu id this.getMenu = function(menuId) { // Validate that the menu exists this.validateMenuExistance(menuId); // Return the menu object return this.menus[menuId]; }; // Add new menu object by menu id this.addMenu = function(menuId, isPublic, roles) { // Create the new menu this.menus[menuId] = { isPublic: isPublic || false, roles: roles || this.defaultRoles, items: [], shouldRender: shouldRender }; // Return the menu object return this.menus[menuId]; }; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c <<<<<<< 96591cc1e8fbb4fd9e1f61b6c8ba44f9aa5a02cf ======= ======= <<<<<<< adb4e008930e5142044796081f66a1db54906706 >>>>>>> make it work >>>>>>> make it work var continueUpdate = true; if(!updateImmediately){ continueUpdate = !$rootScope.saveInProgress; } //Update form **if we are not currently updating** or if **shouldUpdateNow flag is set** if(continueUpdate){ var err = null; <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 if(!updateImmediately){ $rootScope.saveInProgress = true; } ======= ======= ======= >>>>>>> fix docker // Remove existing menu object by menu id this.removeMenu = function(menuId) { // Validate that the menu exists this.validateMenuExistance(menuId); // Return the menu object delete this.menus[menuId]; }; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c <<<<<<< 96591cc1e8fbb4fd9e1f61b6c8ba44f9aa5a02cf ======= ======= <<<<<<< adb4e008930e5142044796081f66a1db54906706 >>>>>>> make it work >>>>>>> make it work $scope.updatePromise = $http.put('/forms/'+$scope.myform._id, {form: $scope.myform}) .then(function(response){ $rootScope.myform = $scope.myform = response.data; // console.log(response.data); }).catch(function(response){ console.log('Error occured during form UPDATE.\n'); // console.log(response.data); err = response.data; }).finally(function() { // console.log('finished updating'); if(!updateImmediately){$rootScope.saveInProgress = false; } if( (typeof cb) === 'function'){ return cb(err); } }); } }; ======= ======= >>>>>>> fix docker // Add menu item object this.addMenuItem = function(menuId, menuItemTitle, menuItemURL, menuItemType, menuItemUIRoute, isPublic, roles, position) { // Validate that the menu exists this.validateMenuExistance(menuId); // Push new menu item this.menus[menuId].items.push({ title: menuItemTitle, link: menuItemURL, menuItemType: menuItemType || 'item', menuItemClass: menuItemType, uiRoute: menuItemUIRoute || ('/' + menuItemURL), isPublic: ((isPublic === null || typeof isPublic === 'undefined') ? this.menus[menuId].isPublic : isPublic), roles: ((roles === null || typeof roles === 'undefined') ? this.menus[menuId].roles : roles), position: position || 0, items: [], shouldRender: shouldRender }); // Return the menu object return this.menus[menuId]; }; // Add submenu item object this.addSubMenuItem = function(menuId, rootMenuItemURL, menuItemTitle, menuItemURL, menuItemUIRoute, isPublic, roles, position) { // Validate that the menu exists this.validateMenuExistance(menuId); // Search for menu item for (var itemIndex in this.menus[menuId].items) { if (this.menus[menuId].items[itemIndex].link === rootMenuItemURL) { // Push new submenu item this.menus[menuId].items[itemIndex].items.push({ title: menuItemTitle, link: menuItemURL, uiRoute: menuItemUIRoute || ('/' + menuItemURL), isPublic: ((isPublic === null || typeof isPublic === 'undefined') ? this.menus[menuId].items[itemIndex].isPublic : isPublic), roles: ((roles === null || typeof roles === 'undefined') ? this.menus[menuId].items[itemIndex].roles : roles), position: position || 0, shouldRender: shouldRender }); } } // Return the menu object return this.menus[menuId]; }; // Remove existing menu object by menu id this.removeMenuItem = function(menuId, menuItemURL) { // Validate that the menu exists this.validateMenuExistance(menuId); // Search for menu item to remove for (var itemIndex in this.menus[menuId].items) { if (this.menus[menuId].items[itemIndex].link === menuItemURL) { this.menus[menuId].items.splice(itemIndex, 1); } } // Return the menu object return this.menus[menuId]; }; // Remove existing menu object by menu id this.removeSubMenuItem = function(menuId, submenuItemURL) { // Validate that the menu exists this.validateMenuExistance(menuId); // Search for menu item to remove for (var itemIndex in this.menus[menuId].items) { for (var subitemIndex in this.menus[menuId].items[itemIndex].items) { if (this.menus[menuId].items[itemIndex].items[subitemIndex].link === submenuItemURL) { this.menus[menuId].items[itemIndex].items.splice(subitemIndex, 1); } } } // Return the menu object return this.menus[menuId]; }; //Adding the topbar menu this.addMenu('topbar', false, ['*']); //Adding the bottombar menu for the Form-Footer view this.addMenu('bottombar', false, ['*']); } ]); 'use strict'; // Configuring the Forms drop-down menus angular.module('forms').run(['Menus', function(Menus) { // Set top bar menu items Menus.addMenuItem('topbar', 'My Forms', 'forms', '', '/forms', false); } ]).filter('formValidity', function(){ return function(formObj){ if(formObj && formObj.form_fields && formObj.visible_form_fields){ //get keys var formKeys = Object.keys(formObj); //we only care about things that don't start with $ var fieldKeys = formKeys.filter(function(key){ return key[0] !== '$'; }); var fields = formObj.form_fields; var valid_count = fields.filter(function(field){ if(typeof field === 'object' && field.fieldType !== 'statement' && field.fieldType !== 'rating'){ return !!(field.fieldValue); } }).length; return valid_count - (formObj.form_fields.length - formObj.visible_form_fields.length); } return 0; }; }).config(['$provide', function ($provide){ $provide.decorator('accordionDirective', ["$delegate", function($delegate) { var directive = $delegate[0]; directive.replace = true; return $delegate; }]); }]); <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 } ]); (function () { 'use strict'; // Create the SendVisitorData service angular .module('forms') .factory('SendVisitorData', SendVisitorData); SendVisitorData.$inject = ['Socket', '$state']; function SendVisitorData(Socket, $state) { // Create a controller method for sending visitor data function send(form, lastActiveIndex, timeElapsed) { console.log(lastActiveIndex); // Create a new message object var visitorData = { referrer: document.referrer, isSubmitted: form.submitted, formId: form._id, lastActiveField: form.form_fields[lastActiveIndex]._id, timeElapsed: timeElapsed }; Socket.emit('form-visitor-data', visitorData); } function init(){ // Make sure the Socket is connected if (!Socket.socket) { Socket.connect(); } } var service = { send: send }; init(); return service; } }()); ======= >>>>>>> make it work 'use strict'; // Setting up route angular.module('forms').config(['$stateProvider', function($stateProvider) { // Forms state routing $stateProvider. state('listForms', { url: '/forms', templateUrl: 'modules/forms/admin/views/list-forms.client.view.html' }). state('submitForm', { url: '/forms/:formId', templateUrl: 'modules/forms/base/views/submit-form.client.view.html', data: { hideNav: true }, resolve: { Forms: 'Forms', myForm: ["Forms", "$stateParams", function (Forms, $stateParams) { return Forms.get({formId: $stateParams.formId}).$promise; }] }, controller: 'SubmitFormController', controllerAs: 'ctrl' }).state('viewForm', { url: '/forms/:formId/admin', templateUrl: 'modules/forms/admin/views/admin-form.client.view.html', data: { permissions: [ 'editForm' ] }, resolve: { Forms: 'Forms', myForm: ["Forms", "$stateParams", function (Forms, $stateParams) { return Forms.get({formId: $stateParams.formId}).$promise; }] }, controller: 'AdminFormController' }).state('viewForm.configure', { url: '/configure', templateUrl: 'modules/forms/admin/views/adminTabs/configure.html' }).state('viewForm.design', { url: '/design', templateUrl: 'modules/forms/admin/views/adminTabs/design.html' }).state('viewForm.analyze', { url: '/analyze', templateUrl: 'modules/forms/admin/views/adminTabs/analyze.html', }).state('viewForm.create', { url: '/create', templateUrl: 'modules/forms/admin/views/adminTabs/create.html' }); } ]); 'use strict'; angular.module('forms').directive('keyToOption', function(){ return { restrict: 'A', scope: { field: '=' }, link: function($scope, $element, $attrs, $select) { $element.bind('keydown keypress', function(event) { var keyCode = event.which || event.keyCode; var index = parseInt(String.fromCharCode(keyCode))-1; //console.log($scope.field); if (index < $scope.field.fieldOptions.length) { event.preventDefault(); $scope.$apply(function () { $scope.field.fieldValue = $scope.field.fieldOptions[index].option_value; }); } }); } }; }); 'use strict'; angular.module('forms').directive('keyToTruthy', ['$rootScope', function($rootScope){ return { restrict: 'A', scope: { field: '=' }, link: function($scope, $element, $attrs) { $element.bind('keydown keypress', function(event) { var keyCode = event.which || event.keyCode; var truthyKeyCode = $attrs.keyCharTruthy.charCodeAt(0) - 32; var falseyKeyCode = $attrs.keyCharFalsey.charCodeAt(0) - 32; if(keyCode === truthyKeyCode ) { event.preventDefault(); $scope.$apply(function() { $scope.field.fieldValue = 'true'; }); }else if(keyCode === falseyKeyCode){ event.preventDefault(); $scope.$apply(function() { $scope.field.fieldValue = 'false'; }); } }); } }; }]); 'use strict'; // Config HTTP Error Handling angular.module('users').config(['$httpProvider', function($httpProvider) { $httpProvider.interceptors.push(["$q", "$location", function($q, $location) { return { responseError: function(response) { if( $location.path() !== '/users/me' && response.config){ if(response.config.url !== '/users/me'){ console.log('intercepted rejection of ', response.config.url, response.status); if (response.status === 401) { console.log($location.path()); // save the current location so that login can redirect back $location.nextAfterLogin = $location.path(); $location.path('/signin'); }else if(response.status === 403){ $location.path('/access_denied'); } } } return $q.reject(response); } }; }]); }]); 'use strict'; // Setting up route angular.module('users').config(['$stateProvider', function($stateProvider) { var checkLoggedin = function($q, $timeout, $state, User, Auth) { var deferred = $q.defer(); <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 //Autosave Form when model (specified in $attrs.autoSaveWatch) changes $scope.$watch($attrs.autoSaveWatch, function(newValue, oldValue) { ======= // console.log(Auth.ensureHasCurrentUser(User)); >>>>>>> make it work >>>>>>> make it work ======= //console.log(Auth.ensureHasCurrentUser(User)); >>>>>>> fix docker if (Auth.currentUser && Auth.currentUser.email) { $timeout(deferred.resolve); } else { Auth.currentUser = User.getCurrent( function() { Auth.login(); $timeout(deferred.resolve()); }, function() { Auth.logout(); $timeout(deferred.reject()); $state.go('signin', {reload: true}); }); } return deferred.promise; }; checkLoggedin.$inject = ["$q", "$timeout", "$state", "User", "Auth"]; var checkSignupDisabled = function($window, $timeout, $q) { var deferred = $q.defer(); if($window.signupDisabled) { $timeout(deferred.reject()); } else { $timeout(deferred.resolve()); } return deferred.promise; }; checkSignupDisabled.$inject = ["$window", "$timeout", "$q"]; // Users state routing $stateProvider. state('profile', { resolve: { loggedin: checkLoggedin }, url: '/settings/profile', templateUrl: 'modules/users/views/settings/edit-profile.client.view.html' }). state('password', { resolve: { loggedin: checkLoggedin }, url: '/settings/password', templateUrl: 'modules/users/views/settings/change-password.client.view.html' }). state('accounts', { resolve: { loggedin: checkLoggedin }, url: '/settings/accounts', templateUrl: 'modules/users/views/settings/social-accounts.client.view.html' }). state('signup', { resolve: { isDisabled: checkSignupDisabled }, url: '/signup', templateUrl: 'modules/users/views/authentication/signup.client.view.html' }). state('signup-success', { resolve: { isDisabled: checkSignupDisabled }, url: '/signup-success', templateUrl: 'modules/users/views/authentication/signup-success.client.view.html' }). state('signin', { url: '/signin', templateUrl: 'modules/users/views/authentication/signin.client.view.html' }). state('access_denied', { url: '/access_denied', templateUrl: 'modules/users/views/authentication/access-denied.client.view.html' }). state('verify', { resolve: { isDisabled: checkSignupDisabled }, url: '/verify/:token', templateUrl: 'modules/users/views/verify/verify-account.client.view.html' }). state('resendVerifyEmail', { resolve: { isDisabled: checkSignupDisabled }, url: '/verify', templateUrl: 'modules/users/views/verify/resend-verify-email.client.view.html' }). state('forgot', { url: '/password/forgot', templateUrl: 'modules/users/views/password/forgot-password.client.view.html' }). state('reset-invalid', { url: '/password/reset/invalid', templateUrl: 'modules/users/views/password/reset-password-invalid.client.view.html' }). state('reset-success', { url: '/password/reset/success', templateUrl: 'modules/users/views/password/reset-password-success.client.view.html' }). state('reset', { url: '/password/reset/:token', templateUrl: 'modules/users/views/password/reset-password.client.view.html' }); } ]); 'use strict'; 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() { $scope.credentials.email = $scope.credentials.username; User.login($scope.credentials).then( function(response) { Auth.login(response); $scope.user = $rootScope.user = Auth.ensureHasCurrentUser(User); if($state.previous.name !== 'home' && $state.previous.name !== 'verify' && $state.previous.name !== ''){ $state.go($state.previous.name); }else{ $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); if(error) { $scope.error = error; console.log(error); }else { console.log('No response received'); } } ); }; } ]); 'use strict'; angular.module('users').controller('PasswordController', ['$scope', '$stateParams', '$state', 'User', function($scope, $stateParams, $state, User) { $scope.error = ''; // Submit forgotten password account id $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; } ); }; // Change user password $scope.resetUserPassword = function() { $scope.success = $scope.error = null; User.resetPassword($scope.passwordDetails, $stateParams.token).then( function(response){ // If successful show success message and clear form $scope.success = response.message; $scope.passwordDetails = null; // And redirect to the index page $state.go('reset-success'); }, function(error){ $scope.error = error.message || error; $scope.passwordDetails = null; } ); }; } ]); 'use strict'; angular.module('users').controller('SettingsController', ['$scope', '$rootScope', '$http', '$state', 'Users', function($scope, $rootScope, $http, $state, Users) { $scope.user = $rootScope.user; // Check if there are additional accounts $scope.hasConnectedAdditionalSocialAccounts = function(provider) { for (var i in $scope.user.additionalProvidersData) { return true; } return false; }; // Check if provider is already in use with current user $scope.isConnectedSocialAccount = function(provider) { return $scope.user.provider === provider || ($scope.user.additionalProvidersData && $scope.user.additionalProvidersData[provider]); }; // Remove a user social account $scope.removeUserSocialAccount = function(provider) { $scope.success = $scope.error = null; $http.delete('/users/accounts', { params: { provider: provider } }).success(function(response) { // If successful show success message and clear form $scope.success = true; $scope.user = response; }).error(function(response) { $scope.error = response.message; }); }; // Update a user profile $scope.updateUserProfile = function(isValid) { if (isValid) { $scope.success = $scope.error = null; var user = new Users($scope.user); user.$update(function(response) { $scope.success = true; $scope.user = response; }, function(response) { $scope.error = response.data.message; }); } else { $scope.submitted = true; } }; // Change user password $scope.changeUserPassword = function() { $scope.success = $scope.error = null; $http.post('/users/password', $scope.passwordDetails).success(function(response) { // If successful show success message and clear form $scope.success = true; $scope.passwordDetails = null; }).error(function(response) { $scope.error = response.message; }); }; } ]); 'use strict'; angular.module('users').controller('VerifyController', ['$scope', '$state', '$rootScope', 'User', 'Auth', '$stateParams', function($scope, $state, $rootScope, User, Auth, $stateParams) { $scope.isResetSent = false; $scope.credentials = {}; $scope.error = ''; // Submit forgotten password account id $scope.resendVerifyEmail = function() { // console.log($scope.credentials); // console.log($scope.credentials.email); User.resendVerifyEmail($scope.credentials.email).then( function(response){ console.log(response); $scope.success = response.message; $scope.credentials = null; $scope.isResetSent = true; }, function(error){ $scope.error = error; $scope.credentials.email = null; $scope.isResetSent = false; } ); }; //Validate Verification Token $scope.validateVerifyToken = function() { if($stateParams.token){ console.log($stateParams.token); User.validateVerifyToken($stateParams.token).then( function(response){ console.log('Success: '+response.message); $scope.success = response.message; $scope.isResetSent = true; $scope.credentials.email = null; }, function(error){ console.log('Error: '+error.message); $scope.isResetSent = false; $scope.error = error; $scope.credentials.email = null; } ); } }; } ]); 'use strict'; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c ======= <<<<<<< adb4e008930e5142044796081f66a1db54906706 >>>>>>> make it work angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormFields', function ($rootScope, FormFields) { return { templateUrl: 'modules/forms/views/directiveViews/form/edit-form.client.view.html', restrict: 'E', scope: { myform:'=' }, controller: ["$scope", function($scope){ var field_ids = _($scope.myform.form_fields).pluck('_id'); for(var i=0; i>>>>>> fix docker angular.module('users').factory('Auth', ['$window', function($window) { var userState = { isLoggedIn: false }; var service = { _currentUser: null, get currentUser(){ return this._currentUser; }, // Note: we can't make the User a dependency of Auth // because that would create a circular dependency // Auth <- $http <- $resource <- LoopBackResource <- User <- Auth ensureHasCurrentUser: function(User) { if (service._currentUser && service._currentUser.username) { //console.log('Using local current user.'); //console.log(service._currentUser); return service._currentUser; } else if ($window.user){ //console.log('Using cached current user.'); //console.log($window.user); service._currentUser = $window.user; return service._currentUser; } else{ //console.log('Fetching current user from the server.'); User.getCurrent().then(function(user) { // success service._currentUser = user; userState.isLoggedIn = true; $window.user = service._currentUser; return service._currentUser; }, function(response) { userState.isLoggedIn = false; service._currentUser = null; $window.user = null; console.log('User.getCurrent() err', response); return null; }); } }, isAuthenticated: function() { return !!service._currentUser; }, getUserState: function() { return userState; }, login: function(new_user) { userState.isLoggedIn = true; service._currentUser = new_user; }, logout: function() { $window.user = null; userState.isLoggedIn = false; service._currentUser = null; } }; return service; } ]); 'use strict'; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c ======= <<<<<<< adb4e008930e5142044796081f66a1db54906706 >>>>>>> make it work /* ** FormFields (ui-sortable) drag-and-drop configuration */ <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 $scope.dropzone = { handle: '.handle', containment: '.dropzoneContainer', cursor: 'grabbing' }; ======= $scope.dropzone = { handle: ' .handle', containment: '.dropzoneContainer', cursor: 'grabbing' }; ======= ======= >>>>>>> fix docker angular.module('users').service('Authorizer', ["APP_PERMISSIONS", "USER_ROLES", function(APP_PERMISSIONS, USER_ROLES) { return function(user) { return { canAccess: function(permissions) { var i, len, permission; if (!angular.isArray(permissions)) { permissions = [permissions]; } for (i = 0, len = permissions.length; i < len; i++) { permission = permissions[i]; if (APP_PERMISSIONS[permission] === null) { throw 'Bad permission value'; } if (user && user.roles) { switch (permission) { case APP_PERMISSIONS.viewAdminSettings: case APP_PERMISSIONS.editAdminSettings: return user.roles.indexOf(USER_ROLES.admin) > -1; case APP_PERMISSIONS.viewPrivateForm: case APP_PERMISSIONS.editForm: return user.roles.indexOf(USER_ROLES.admin) > -1 || user.roles.indexOf(USER_ROLES.normal) > -1; } } else { return false; } } <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 >>>>>>> make it work >>>>>>> make it work ======= >>>>>>> fix docker return false; } }; }; }]); 'use strict'; <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 // increment lastAddedID counter $scope.addField.lastAddedID++; var fieldTitle; ======= angular.module('users').factory('User', ['$window', '$q', '$timeout', '$http', '$state', function($window, $q, $timeout, $http, $state) { >>>>>>> make it work <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c ======= <<<<<<< adb4e008930e5142044796081f66a1db54906706 >>>>>>> make it work for(var i = 0; i < $scope.addField.types.length; i++){ if($scope.addField.types[i].name === fieldType){ $scope.addField.types[i].lastAddedID++; fieldTitle = $scope.addField.types[i].value+$scope.addField.types[i].lastAddedID; break; } } var newField = { title: fieldTitle, fieldType: fieldType, fieldValue: '', required: true, disabled: false, deletePreserved: false }; if($scope.showAddOptions(newField)){ newField.fieldOptions = []; newField.fieldOptions.push({ 'option_id' : Math.floor(100000*Math.random()), //Generate pseudo-random option id 'option_title' : 'Option 0', 'option_value' : 'Option 0' }); } if(modifyForm){ //Add newField to form_fields array $scope.myform.form_fields.push(newField); } return newField; }; ======= ======= >>>>>>> fix docker var userService = { getCurrent: function() { var deferred = $q.defer(); $http.get('/users/me') .success(function(response) { deferred.resolve(response); }) .error(function() { deferred.reject('User\'s session has expired'); }); return deferred.promise; }, login: function(credentials) { var deferred = $q.defer(); $http.post('/auth/signin', credentials).success(function(response) { deferred.resolve(response); }).error(function(error) { deferred.reject(error.message || error); }); return deferred.promise; }, logout: function() { var deferred = $q.defer(); $http.get('/auth/signout').success(function(response) { deferred.resolve(null); }).error(function(error) { deferred.reject(error.message || error); }); return deferred.promise; }, signup: function(credentials) { var deferred = $q.defer(); $http.post('/auth/signup', credentials).success(function(response) { // If successful we assign the response to the global user model deferred.resolve(response); }).error(function(error) { deferred.reject(error.message || error); }); return deferred.promise; }, resendVerifyEmail: function(_email) { var deferred = $q.defer(); $http.post('/auth/verify', {email: _email}).success(function(response) { deferred.resolve(response); }).error(function(error) { deferred.reject(error.message || error); }); return deferred.promise; }, validateVerifyToken: function(token) { //DAVID: TODO: The valid length of a token should somehow be linked to server config values //DAVID: TODO: SEMI-URGENT: Should we even be doing this? var validTokenRe = /^([A-Za-z0-9]{48})$/g; if( !validTokenRe.test(token) ) throw new Error('Error token: '+token+' is not a valid verification token'); var deferred = $q.defer(); $http.get('/auth/verify/'+token).success(function(response) { deferred.resolve(response); }).error(function(error) { deferred.reject(error); }); <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c ======= <<<<<<< adb4e008930e5142044796081f66a1db54906706 >>>>>>> make it work // add new option to the field $scope.addOption = function(field_index){ var currField = $scope.myform.form_fields[field_index]; //console.log(field_index); //console.log(currField); if(currField.fieldType === 'checkbox' || currField.fieldType === 'dropdown' || currField.fieldType === 'radio'){ <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 if(!currField.fieldOptions){ $scope.myform.form_fields[field_index].fieldOptions = []; } var lastOptionID = $scope.myform.form_fields[field_index].fieldOptions.length+1; // new option's id ======= if(!currField.fieldOptions) $scope.myform.form_fields[field_index].fieldOptions = []; ======= ======= >>>>>>> fix docker return deferred.promise; }, resetPassword: function(passwordDetails, token) { var deferred = $q.defer(); $http.get('/auth/password/'+token, passwordDetails).success(function(response) { deferred.resolve(); }).error(function(error) { deferred.reject(error.message || error); }); return deferred.promise; }, >>>>>>> make it work // Submit forgotten password account id askForPasswordReset: function(credentials) { var deferred = $q.defer(); $http.post('/auth/forgot', credentials).success(function(response) { // Show user success message and clear form deferred.resolve(response); }).error(function(error) { // Show user error message deferred.reject(error.message || error); }); return deferred.promise; } }; return userService; } ]); 'use strict'; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< 96591cc1e8fbb4fd9e1f61b6c8ba44f9aa5a02cf <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 // decides whether field options block will be shown (true for dropdown and radio fields) $scope.showRatingOptions = function (field){ if(field.fieldType === 'rating'){ return true; } else { return false; } }; }] ======= ======= <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f >>>>>>> make it work <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c ======= <<<<<<< adb4e008930e5142044796081f66a1db54906706 >>>>>>> make it work }] >>>>>>> make it work }; } ======= ======= >>>>>>> fix docker // Users service used for communicating with the users REST endpoint angular.module('users').factory('Users', ['$resource', function($resource) { return $resource('users', {}, { update: { method: 'PUT' } }); } ]); 'use strict'; // Forms controller angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal', 'myForm', function($rootScope, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal, myForm) { $scope = $rootScope; $scope.animationsEnabled = true; $scope.myform = myForm; $rootScope.saveInProgress = false; CurrentForm.setForm($scope.myform); $scope.tabData = [ { heading: 'Create', route: 'viewForm.create' }, { heading: 'Design', route: 'viewForm.design' }, { heading: 'Configure', route: 'viewForm.configure' }, { heading: 'Analyze', route: 'viewForm.analyze' } ]; $scope.setForm = function(form){ $scope.myform = form; }; $rootScope.resetForm = function(){ $scope.myform = Forms.get({ formId: $stateParams.formId }); }; /* ** DeleteModal Functions */ $scope.openDeleteModal = function(){ $scope.deleteModal = $uibModal.open({ animation: $scope.animationsEnabled, templateUrl: 'myModalContent.html', controller: 'AdminFormController', resolve: { myForm: function(){ return $scope.myform; } } }); $scope.deleteModal.result.then(function (selectedItem) { $scope.selected = selectedItem; }, function () { console.log('Modal dismissed at: ' + new Date()); }); }; $scope.cancelDeleteModal = function(){ if($scope.deleteModal){ $scope.deleteModal.dismiss('cancel'); } }; // Remove existing Form $scope.removeCurrentForm = function() { if($scope.deleteModal && $scope.deleteModal.opened){ $scope.deleteModal.close(); var form_id = $scope.myform._id; if(!form_id) throw new Error('Error - removeCurrentForm(): $scope.myform._id does not exist'); $http.delete('/forms/'+form_id) .success(function(data, status, headers){ console.log('form deleted successfully'); $state.go('listForms', {}, {reload: true}); }).error(function(error){ console.log('ERROR: Form could not be deleted.'); console.error(error); }); } }; // Update existing Form $scope.update = $rootScope.update = function(updateImmediately, cb){ var continueUpdate = true; if(!updateImmediately){ continueUpdate = !$rootScope.saveInProgress; } //Update form **if we are not currently updating** or if **shouldUpdateNow flag is set** if(continueUpdate){ var err = null; if(!updateImmediately){ $rootScope.saveInProgress = true; } $scope.updatePromise = $http.put('/forms/'+$scope.myform._id, {form: $scope.myform}) .then(function(response){ $rootScope.myform = $scope.myform = response.data; // console.log(response.data); }).catch(function(response){ console.log('Error occured during form UPDATE.\n'); // console.log(response.data); err = response.data; }).finally(function() { // console.log('finished updating'); if(!updateImmediately){$rootScope.saveInProgress = false; } if( (typeof cb) === 'function'){ return cb(err); } }); } }; <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 angular.module('forms').directive('fieldIconDirective', function() { return { template: '', restrict: 'E', scope: { typeName: '@' }, controller: ["$scope", function($scope){ var iconTypeMap = { 'textfield': 'fa fa-pencil-square-o', 'dropdown': 'fa fa-th-list', 'date': 'fa fa-calendar', 'checkbox': 'fa fa-check-square-o', 'radio': 'fa fa-dot-circle-o', 'email': 'fa fa-envelope-o', 'textarea': 'fa fa-pencil-square', 'legal': 'fa fa-legal', 'file': 'fa fa-cloud-upload', 'rating': 'fa fa-star-half-o', 'link': 'fa fa-link', 'scale': 'fa fa-sliders', 'stripe': 'fa fa-credit-card', 'statement': 'fa fa-quote-left', 'yes_no': 'fa fa-toggle-on', 'number': 'fa fa-slack' }; $scope.typeIcon = iconTypeMap[$scope.typeName]; }] }; }); ======= } ]); >>>>>>> make it work 'use strict'; // Forms controller angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', function($rootScope, $scope, $stateParams, $state, Forms, CurrentForm, $http) { $scope = $rootScope; $scope.forms = {}; $scope.showCreateModal = false; // Return all user's Forms $scope.findAll = function() { Forms.query(function(_forms){ $scope.myforms = _forms; }); }; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c ======= <<<<<<< adb4e008930e5142044796081f66a1db54906706 >>>>>>> make it work var getTemplateUrl = function(fieldType) { var type = fieldType; var templateUrl = 'modules/forms/views/directiveViews/field/'; var supported_fields = [ 'textfield', 'textarea', 'date', 'dropdown', 'hidden', 'password', 'radio', 'legal', 'statement', 'rating', 'yes_no', 'number', 'natural' ]; if (__indexOf.call(supported_fields, type) >= 0) { templateUrl = templateUrl+type+'.html'; } return $templateCache.get('../public/'+templateUrl); }; ======= ======= >>>>>>> fix docker //Modal functions $scope.openCreateModal = function(){ if(!$scope.showCreateModal){ $scope.showCreateModal = true; } }; $scope.closeCreateModal = function(){ if($scope.showCreateModal){ $scope.showCreateModal = false; } }; <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 return { template: '
{{field.title}}
', restrict: 'E', scope: { field: '=', required: '&', design: '=', index: '=', forms: '=' }, link: function(scope, element) { ======= $scope.setForm = function (form) { $scope.myform = form; }; $scope.goToWithId = function(route, id) { $state.go(route, {'formId': id}, {reload: true}); }; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 >>>>>>> make it work >>>>>>> make it work ======= >>>>>>> fix docker $scope.duplicateForm = function(form_index){ var form = _.cloneDeep($scope.myforms[form_index]); delete form._id; $http.post('/forms', {form: form}) .success(function(data, status, headers){ $scope.myforms.splice(form_index+1, 0, data); }).error(function(errorResponse){ console.error(errorResponse); if(errorResponse === null){ $scope.error = errorResponse.data.message; } }); }; // Create new Form $scope.createNewForm = function(){ // console.log($scope.forms.createForm); var form = {}; form.title = $scope.forms.createForm.title.$modelValue; form.language = $scope.forms.createForm.language.$modelValue; if($scope.forms.createForm.$valid && $scope.forms.createForm.$dirty){ $http.post('/forms', {form: form}) .success(function(data, status, headers){ console.log('new form created'); // Redirect after save $scope.goToWithId('viewForm.create', data._id+''); }).error(function(errorResponse){ console.error(errorResponse); $scope.error = errorResponse.data.message; }); } }; <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 if(scope.field.fieldType === 'number' || scope.field.fieldType === 'textfield' || scope.field.fieldType === 'email' || scope.field.fieldType === 'link'){ switch(scope.field.fieldType){ case 'textfield': scope.field.input_type = 'text'; break; case 'email': scope.field.input_type = 'email'; scope.field.placeholder = 'joesmith@example.com'; break; case 'number': scope.field.input_type = 'text'; scope.field.validateRegex = /^-?\d+$/; break; default: scope.field.input_type = 'url'; scope.field.placeholder = 'http://example.com'; break; } fieldType = 'textfield'; } var template = getTemplateUrl(fieldType); element.html(template).show(); var output = $compile(element.contents())(scope); } }; }]); ======= $scope.removeForm = function(form_index) { if(form_index >= $scope.myforms.length || form_index < 0){ throw new Error('Error: form_index in removeForm() must be between 0 and '+$scope.myforms.length-1); } >>>>>>> make it work $http.delete('/forms/'+$scope.myforms[form_index]._id) .success(function(data, status, headers){ console.log('form deleted successfully'); $scope.myforms.splice(form_index, 1); }).error(function(error){ console.log('ERROR: Form could not be deleted.'); console.error(error); }); }; } ]); 'use strict'; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c ======= <<<<<<< 95d6fb967b8d351fe9e17be40be308a8fe73c55f >>>>>>> make it work angular.module('forms').directive('keyToOption', function(){ return { restrict: 'A', scope: { field: '=' }, link: function($scope, $element, $attrs, $select) { $element.bind('keydown keypress', function(event) { var keyCode = event.which || event.keyCode; var index = parseInt(String.fromCharCode(keyCode))-1; //console.log($scope.field); if (index < $scope.field.fieldOptions.length) { event.preventDefault(); $scope.$apply(function () { $scope.field.fieldValue = $scope.field.fieldOptions[index].option_value; }); } ======= function removeDateFieldsFunc(o) { var clone = _.clone(o); function eachObject(v,k){ if(k === 'lastModified' || k === 'created'){ delete clone[k]; } } >>>>>>> fix docker for(var i=0; i>>>>>> make it work <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 angular.module('forms').directive('onFinishRender', ["$rootScope", "$timeout", function ($rootScope, $timeout) { return { restrict: 'A', link: function (scope, element, attrs) { //Don't do anything if we don't have a ng-repeat on the current element if(!element.attr('ng-repeat') && !element.attr('data-ng-repeat')){ return; } ======= for(var i=0; i>>>>>> make it work angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', function($rootScope, $timeout) { ======= >>>>>>> fix docker return { require: ['^form'], restrict: 'AE', link: function($scope, $element, $attrs, $ctrls) { //DAVID: TODO: Do we really need to check if our directive element is ready everytime angular.element(document).ready(function() { var $formCtrl = $ctrls[0], savePromise = null; $rootScope.finishedRender = false; $scope.$on('editFormFields Started', function(ngRepeatFinishedEvent) { // console.log('hello'); $rootScope.finishedRender = false; }); $scope.$on('editFormFields Finished', function(ngRepeatFinishedEvent) { $rootScope.finishedRender = true; }); $scope.anyDirtyAndTouched = function(form){ var propCount = 0; for(var prop in form) { if(form.hasOwnProperty(prop) && prop[0] !== '$') { propCount++; if(form[prop].$touched && form[prop].$dirty) { return true; } } } return false; }; <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter', '$filter', '$rootScope', 'Auth', 'SendVisitorData', function ($http, TimeCounter, $filter, $rootScope, Auth, SendVisitorData) { return { templateUrl: 'modules/forms/views/directiveViews/form/submit-form.client.view.html', restrict: 'E', scope: { myform:'=' }, controller: ["$document", "$window", "$scope", function($document, $window, $scope){ $scope.authentication = $rootScope.authentication; $scope.noscroll = false; $scope.forms = {}; $scope.form_fields_count = $scope.myform.visible_form_fields.filter(function(field){ if(field.fieldType === 'statement' || field.fieldType === 'rating'){ return false; ======= var debounceSave = function () { $rootScope.saveInProgress = true; $rootScope[$attrs.autoSaveCallback](true, function(err){ if(!err){ //console.log('\n\nForm data persisted -- setting pristine flag'); $formCtrl.$setPristine(); $formCtrl.$setUntouched(); }else{ console.error('Error form data NOT persisted'); console.error(err); } }); }; //Update/Save Form if any Form fields are Dirty and Touched $scope.$watch(function(newValue, oldValue) { //console.log('introParagraphStartPage.$dirty: '+$scope.editForm.introParagraphStartPage.$dirty); //console.log('introParagraphStartPage.$touched: '+$scope.editForm.introParagraphStartPage.$touched); if($rootScope.finishedRender && $scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){ //console.log('Form saving started'); debounceSave(); <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 console.log('introParagraphStartPage.$dirty AFTER: '+$scope.editForm.introParagraphStartPage.$dirty); >>>>>>> make it work ======= //console.log('introParagraphStartPage.$dirty AFTER: '+$scope.editForm.introParagraphStartPage.$dirty); >>>>>>> fix docker } }); //Autosave Form when model (specificed in $attrs.autoSaveWatch) changes $scope.$watch($attrs.autoSaveWatch, function(newValue, oldValue) { newValue = angular.copy(newValue); oldValue = angular.copy(oldValue); newValue.form_fields = _.removeDateFields(newValue.form_fields); oldValue.form_fields = _.removeDateFields(oldValue.form_fields); var changedFields = !_.isEqual(oldValue.form_fields,newValue.form_fields) || !_.isEqual(oldValue.startPage, newValue.startPage); var changedFieldMap = false; <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 //Fire event when window is scrolled $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; ======= if(oldValue.hasOwnProperty('plugins.oscarhost.settings.fieldMap')){ changedFieldMap = !!oldValue.plugins.oscarhost.settings.fieldMap && !_.isEqual(oldValue.plugins.oscarhost.settings.fieldMap,newValue.plugins.oscarhost.settings.fieldMap); } >>>>>>> make it work //If our form is undefined, don't save form if( (!newValue && !oldValue) || !oldValue ){ return; } // console.log('Autosaving'); // console.log('\n\n----------'); // console.log('!$dirty: '+ !$formCtrl.$dirty ); // console.log('changedFields: '+changedFields); // console.log('changedFieldMap: '+changedFieldMap); // console.log('finishedRender: '+$rootScope.finishedRender); // console.log('!saveInProgress: '+!$rootScope.saveInProgress); // console.log('newValue: '+newValue); // console.log('oldValue: '+oldValue); // console.log(oldValue.form_fields); // console.log(newValue.form_fields); if(oldValue.form_fields.length === 0) { $rootScope.finishedRender = true; } //Save form ONLY IF rendering is finished, form_fields have been changed AND currently not save in progress if( $rootScope.finishedRender && ((changedFields && !$formCtrl.$dirty) || changedFieldMap) && !$rootScope.saveInProgress) { if(savePromise) { $timeout.cancel(savePromise); savePromise = null; } <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 savePromise = $timeout(function() { debounceSave(); }); <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f } //If we are finished rendering then form saving should be finished else if($rootScope.finishedRender && $rootScope.saveInProgress){ $rootScope.saveInProgress = false; } <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 ======= <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c $rootScope.setDropdownOption = function(){ console.log('setDropdownOption index: '); }; ======= ======= savePromise = $timeout(function() { debounceSave(); }); >>>>>>> fix docker } //If we are finished rendering then form saving should be finished else if($rootScope.finishedRender && $rootScope.saveInProgress){ $rootScope.saveInProgress = false; } <<<<<<< 96591cc1e8fbb4fd9e1f61b6c8ba44f9aa5a02cf >>>>>>> make it work ======= }, true); }); } }; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< 95d6fb967b8d351fe9e17be40be308a8fe73c55f >>>>>>> make it work /* ** Field Controls */ var getActiveField = function(){ if($scope.selected === null){ console.error('current active field is null'); throw new Error('current active field is null'); } if($scope.selected._id === 'submit_field') { return $scope.myform.form_fields.length - 1; } else { return $scope.selected.index; } }; $scope.setActiveField = $rootScope.setActiveField = function(field_id, field_index, animateScroll) { if($scope.selected === null || $scope.selected._id === field_id){ //console.log('not scrolling'); //console.log($scope.selected); return; } //console.log('field_id: '+field_id); //console.log('field_index: '+field_index); //console.log($scope.selected); ======= <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f }, true); }); } }; ======= >>>>>>> fix docker }]); 'use strict'; angular.module('forms').directive('configureFormDirective', ['$rootScope', '$http', 'Upload', 'CurrentForm', function ($rootScope, $http, Upload, CurrentForm) { return { templateUrl: 'modules/forms/admin/views/directiveViews/form/configure-form.client.view.html', restrict: 'E', scope: { myform:'=', user:'=', pdfFields:'@', formFields:'@' }, controller: ["$scope", function($scope){ console.log($scope.myform); if( CurrentForm.getForm().plugins){ if(CurrentForm.getForm().plugins.oscarhost.baseUrl) $scope.oscarhostAPI = true; }else{ $scope.oscarhostAPI = false; } $scope.log = ''; $scope.pdfLoading = false; $scope.languages = $rootScope.languages; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< d6b8995f6035723cf908d50b65e8b75b17f7190c ======= <<<<<<< 95d6fb967b8d351fe9e17be40be308a8fe73c55f >>>>>>> make it work if(animateScroll){ $scope.noscroll=true; setTimeout(function() { $document.scrollToElement(angular.element('.activeField'), -10, 200).then(function() { $scope.noscroll = false; setTimeout(function() { if (document.querySelectorAll('.activeField .focusOn').length) { //Handle default case document.querySelectorAll('.activeField .focusOn')[0].focus(); } else if(document.querySelectorAll('.activeField input').length) { //Handle case for rating input document.querySelectorAll('.activeField input')[0].focus(); } else { //Handle case for dropdown input document.querySelectorAll('.activeField .selectize-input')[0].focus(); } }); }); }); }else { setTimeout(function() { if (document.querySelectorAll('.activeField .focusOn')[0]) { //FIXME: DAVID: Figure out how to set focus without scroll movement in HTML Dom document.querySelectorAll('.activeField .focusOn')[0].focus(); } else { document.querySelectorAll('.activeField input')[0].focus(); } }); } SendVisitorData.send($scope.myform, getActiveField(), TimeCounter.getTimeElapsed()); }; ======= ======= >>>>>>> fix docker this._current_upload = null; $scope.resetForm = $rootScope.resetForm; $scope.update = $rootScope.update; this._unbindedPdfFields = $scope.pdfFields; <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 >>>>>>> make it work <<<<<<< adb4e008930e5142044796081f66a1db54906706 $rootScope.nextField = $scope.nextField = function(){ //console.log('nextfield'); //console.log($scope.selected.index); //console.log($scope.myform.visible_form_fields.length-1); var selected_index, selected_id; if($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, true); } else if($scope.selected.index === $scope.myform.visible_form_fields.length-1) { //console.log('Second last element'); selected_index = $scope.selected.index+1; selected_id = 'submit_field'; $rootScope.setActiveField(selected_id, selected_index, true); } }; ======= //DAVID: TODO: finish this so we can create a Form.pdfFieldMap // $scope.getUnbindedPdfFields = function(fieldType){ // this._unbindedPdfFields = $scope.pdfFields // } >>>>>>> make it work <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f $rootScope.prevField = $scope.prevField = function(){ if($scope.selected.index > 0){ var selected_index = $scope.selected.index - 1; var selected_id = $scope.myform.visible_form_fields[selected_index]._id; $scope.setActiveField(selected_id, selected_index, true); } }; /* ** Form Display Functions */ $scope.exitStartPage = function(){ $scope.myform.startPage.showStart = false; if($scope.myform.visible_form_fields.length > 0){ $scope.selected._id = $scope.myform.visible_form_fields[0]._id; } ======= //PDF Functions $scope.cancelUpload = function(){ this._current_upload.abort(); $scope.pdfLoading = false; $scope.removePDF(); >>>>>>> make it work }; <<<<<<< 96591cc1e8fbb4fd9e1f61b6c8ba44f9aa5a02cf $rootScope.goToInvalid = $scope.goToInvalid = function() { ======= <<<<<<< 95d6fb967b8d351fe9e17be40be308a8fe73c55f $scope.goToInvalid = function() { >>>>>>> make it work document.querySelectorAll('.ng-invalid.focusOn')[0].focus(); }; $rootScope.submitForm = $scope.submitForm = function() { var _timeElapsed = TimeCounter.stopClock(); $scope.loading = true; var form = _.cloneDeep($scope.myform); form.timeElapsed = _timeElapsed; ======= this._unbindedPdfFields = $scope.pdfFields; ======= >>>>>>> fix docker //DAVID: TODO: finish this so we can create a Form.pdfFieldMap // $scope.getUnbindedPdfFields = function(fieldType){ // this._unbindedPdfFields = $scope.pdfFields // } <<<<<<< 7fab87aeb2fac11c800978b13daeeb2629a02297 <<<<<<< 96591cc1e8fbb4fd9e1f61b6c8ba44f9aa5a02cf <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 for(var i=0; i < $scope.myform.form_fields.length; i++){ if($scope.myform.form_fields[i].fieldType === 'dropdown' && !$scope.myform.form_fields[i].deletePreserved){ $scope.myform.form_fields[i].fieldValue = $scope.myform.form_fields[i].fieldValue.option_value; } } setTimeout(function () { $scope.submitPromise = $http.post('/forms/' + $scope.myform._id, form) .success(function (data, status, headers) { console.log($scope.myform.form_fields[0]); $scope.myform.submitted = true; $scope.loading = false; SendVisitorData.send($scope.myform, getActiveField(), _timeElapsed); }) .error(function (error) { $scope.loading = false; console.error(error); $scope.error = error.message; }); }, 500); ======= ======= <<<<<<< afa26fde37ead7eff67e1cf9053c069ded63381f >>>>>>> make it work ======= >>>>>>> fix docker //PDF Functions $scope.cancelUpload = function(){ this._current_upload.abort(); $scope.pdfLoading = false; $scope.removePDF(); }; $scope.removePDF = function(){ $scope.myform.pdf = null; $scope.myform.isGenerated = false; $scope.myform.autofillPDFs = false; console.log('form.pdf: '+$scope.myform.pdf+' REMOVED'); }; $scope.uploadPDF = function(file) { if (file) { console.log(file); Upload.upload({ url: '/upload/pdf', data: { 'user': $scope.user, file: file } }).then(function (resp) { var data = resp.data; $scope.log = 'file ' + data.originalname + ' uploaded as ' + data.filename + '. JSON: ' + JSON.stringify(data) + '\n' + $scope.log; $scope.myform.pdf = angular.fromJson(angular.toJson(data)); //console.log($scope.myform.pdf); $scope.pdfLoading = false; console.log($scope.log); if (!$scope.$$phase && !$scope.$digest) { $scope.$apply(); } }, function(resp){ $scope.pdfLoading = false; console.log('Error occured during upload.\n'); console.log(resp.status); }, function (evt) { var progressPercentage = parseInt(100.0 * evt.loaded / evt.total, 10); $scope.log = 'progress: ' + progressPercentage + '% ' + evt.config.data.file.name + '\n' + $scope.log; console.log($scope.log); $scope.pdfLoading = true; }); } >>>>>>> make it work }; }] }; } ]); 'use strict'; angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormFields', function ($rootScope, FormFields) { return { templateUrl: 'modules/forms/admin/views/directiveViews/form/edit-form.client.view.html', restrict: 'E', scope: { myform:'=' }, controller: ["$scope", function($scope){ var field_ids = _($scope.myform.form_fields).pluck('_id'); for(var i=0; i FormFields $scope.oscarFieldsLeft = function(field_id){ if($scope.myform && $scope.myform.plugins.oscarhost.settings.validFields.length > 0){ if(!$scope.myform.plugins.oscarhost.settings.fieldMap) $scope.myform.plugins.oscarhost.settings.fieldMap = {}; var oscarhostFields = $scope.myform.plugins.oscarhost.settings.validFields; var currentFields = _($scope.myform.plugins.oscarhost.settings.fieldMap).invert().keys().value(); if( $scope.myform.plugins.oscarhost.settings.fieldMap.hasOwnProperty(field_id) ){ currentFields = _(currentFields).difference($scope.myform.plugins.oscarhost.settings.fieldMap[field_id]); } <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 //Forms service used for communicating with the forms REST endpoints angular.module('forms').factory('Forms', ['$resource', function($resource) { return $resource('/forms/:formId', { formId: '@_id' }, { 'query' : { method: 'GET', isArray: true //DAVID: TODO: Do we really need to get visible_form_fields for a Query? // transformResponse: function(data, header) { // var forms = angular.fromJson(data); // angular.forEach(forms, function(form, idx) { // form.visible_form_fields = _.filter(form.form_fields, function(field){ // return (field.deletePreserved === false); // }); // }); // return forms; // } }, 'get' : { method: 'GET', transformResponse: function(data, header) { var form = angular.fromJson(data); form.visible_form_fields = _.filter(form.form_fields, function(field){ return (field.deletePreserved === false); }); return form; } }, 'update': { method: 'PUT' }, 'save': { method: 'POST' } }); } ]); ======= //Get all oscarhostFields that haven't been mapped to a formfield return _(oscarhostFields).difference(currentFields).value(); } return []; }; /* ** FormFields (ui-sortable) drag-and-drop configuration */ $scope.dropzone = { handle: ' .handle', containment: '.dropzoneContainer', cursor: 'grabbing' }; >>>>>>> make it work /* ** Field CRUD Methods */ // Add a new field $scope.addNewField = function(modifyForm, fieldType){ // incr field_id counter $scope.addField.lastAddedID++; var fieldTitle; <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 angular.module('forms').service('TimeCounter', [ function(){ var _startTime, _endTime = null, that=this; ======= for(var i = 0; i < $scope.addField.types.length; i++){ if($scope.addField.types[i].name === fieldType){ $scope.addField.types[i].lastAddedID++; fieldTitle = $scope.addField.types[i].value+$scope.addField.types[i].lastAddedID; break; } } var newField = { title: fieldTitle, fieldType: fieldType, fieldValue: '', required: true, disabled: false, deletePreserved: false }; // console.log('\n\n---------\nAdded field CLIENT'); // console.log(newField); // newField._id = _.uniqueId(); >>>>>>> make it work // put newField into fields array if(modifyForm){ $scope.myform.form_fields.push(newField); } return newField; }; <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 this.restartClock = function(){ _startTime = Date.now(); _endTime = null; // console.log('Clock Started'); }; this.getTimeElapsed = function(){ if(_startTime) { return Math.abs(Date.now().valueOf() - _startTime.valueOf()) / 1000; } }; this.stopClock = function(){ if(_startTime && _endTime === null){ _endTime = Date.now(); this.timeSpent = Math.abs(_endTime.valueOf() - _startTime.valueOf())/1000; this._startTime = this._endTime = null; return this.timeSpent; }else{ return new Error('Clock has not been started'); } }; ======= // Delete particular field on button click $scope.deleteField = function (field_index){ //Delete field from field map var currFieldId = $scope.myform.form_fields[field_index]._id; if($scope.myform.hasOwnProperty('plugins.oscarhost.baseUrl')) delete $scope.myform.plugins.oscarhost.settings.fieldMap[currFieldId]; //Delete field $scope.myform.form_fields.splice(field_index, 1); }; $scope.duplicateField = function (field_index){ var currField = _.cloneDeep($scope.myform.form_fields[field_index]); currField._id = 'cloned'+_.uniqueId(); currField.title += ' copy'; //Insert field at selected index $scope.myform.form_fields.splice(field_index+1, 0, currField); }; >>>>>>> make it work <<<<<<< 89a4852b67e5d936da0821c12c28ec39c7c6d2b0 } ]); 'use strict'; ======= /* ** startPage Button Methods */ >>>>>>> make it work // add new Button to the startPage $scope.addButton = function(){ var newButton = {}; newButton.bgColor = '#ddd'; newButton.color = '#ffffff'; newButton.text = 'Button'; newButton._id = Math.floor(100000*Math.random()); $scope.myform.startPage.buttons.push(newButton); }; // delete particular Button from startPage $scope.deleteButton = function(button){ var currID; for(var i = 0; i < $scope.myform.startPage.buttons.length; i++){ currID = $scope.myform.startPage.buttons[i]._id; console.log(currID); if(currID === button._id){ $scope.myform.startPage.buttons.splice(i, 1); break; } } }; /* ** Field Option Methods */ // add new option to the field $scope.addOption = function(field_index){ var currField = $scope.myform.form_fields[field_index]; console.log(field_index); console.log(currField); if(currField.fieldType === 'checkbox' || currField.fieldType === 'dropdown' || currField.fieldType === 'radio'){ if(!currField.fieldOptions) $scope.myform.form_fields[field_index].fieldOptions = []; var lastOptionID = 0; if(currField.fieldOptions[currField.fieldOptions.length-1]){ lastOptionID = currField.fieldOptions[currField.fieldOptions.length-1].option_id; } // new option's id var option_id = lastOptionID + 1; var newOption = { 'option_id' : Math.floor(100000*Math.random()), 'option_title' : 'Option '+lastOptionID, 'option_value' : 'Option ' +lastOptionID }; // put new option into fieldOptions array $scope.myform.form_fields[field_index].fieldOptions.push(newOption); } }; // delete particular option $scope.deleteOption = function (field_index, option){ var currField = $scope.myform.form_fields[field_index]; if(currField.fieldType === 'checkbox' || currField.fieldType === 'dropdown' || currField.fieldType === 'radio'){ for(var i = 0; i < currField.fieldOptions.length; i++){ if(currField.fieldOptions[i].option_id === option.option_id){ $scope.myform.form_fields[field_index].fieldOptions.splice(i, 1); break; } } } }; // decides whether field options block will be shown (true for dropdown and radio fields) $scope.showAddOptions = function (field){ if(field.fieldType === 'dropdown' || field.fieldType === 'checkbox' || field.fieldType === 'radio'){ return true; } else { return false; } }; }] }; } ]); 'use strict'; angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope', '$http', function ($rootScope, $http) { return { templateUrl: 'modules/forms/admin/views/directiveViews/form/edit-submissions-form.client.view.html', restrict: 'E', scope: { myform:'=', user:'=' }, controller: ["$scope", function($scope){ $scope.table = { masterChecker: false, rows: [] }; /* ** Table Functions */ $scope.isAtLeastOneChecked = function(){ for(var i=0; i<$scope.table.rows.length; i++){ if($scope.table.rows[i].selected) return true; } return false; }; $scope.toggleAllCheckers = function(){ for(var i=0; i<$scope.table.rows.length; i++){ $scope.table.rows[i].selected = $scope.table.masterChecker; } }; $scope.toggleObjSelection = function($event, description) { $event.stopPropagation(); }; $scope.rowClicked = function(row_index) { $scope.table.rows[row_index].selected = !$scope.table.rows[row_index].selected; }; /* * Form Submission Methods */ //Fetch and display submissions of Form $scope.initFormSubmissions = function(){ $http.get('/forms/'+$scope.myform._id+'/submissions') .success(function(data, status, headers){ var _tmpSubFormFields, defaultFormFields = _.cloneDeep($scope.myform.form_fields); // console.log('before textField2: '+data[0].form_fields[1].fieldValue); //Iterate through form's submissions for(var i=0; i', restrict: 'E', scope: { typeName: '@' }, controller: ["$scope", function($scope){ var iconTypeMap = { 'textfield': 'fa fa-pencil-square-o', 'dropdown': 'fa fa-th-list', 'date': 'fa fa-calendar', 'checkbox': 'fa fa-check-square-o', 'radio': 'fa fa-dot-circle-o', 'email': 'fa fa-envelope-o', 'textarea': 'fa fa-pencil-square', 'legal': 'fa fa-legal', 'file': 'fa fa-cloud-upload', 'rating': 'fa fa-star-half-o', 'link': 'fa fa-link', 'scale': 'fa fa-sliders', 'stripe': 'fa fa-credit-card', 'statement': 'fa fa-quote-left', 'yes_no': 'fa fa-toggle-on', 'number': 'fa fa-slack' }; $scope.typeIcon = iconTypeMap[$scope.typeName]; }], }; }); 'use strict'; // coffeescript's for in loop var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; angular.module('forms').directive('fieldDirective', ['$http', '$compile', '$rootScope', '$templateCache', 'supportedFields', function($http, $compile, $rootScope, $templateCache, supportedFields) { var getTemplateUrl = function(fieldType) { var type = fieldType; var templateUrl = 'modules/forms/base/views/directiveViews/field/'; if (__indexOf.call(supportedFields, type) >= 0) { templateUrl = templateUrl+type+'.html'; } return $templateCache.get(templateUrl); }; return { template: '
{{field.title}}
', restrict: 'E', scope: { field: '=', required: '&', design: '=', index: '=', forms: '=' }, link: function(scope, element) { $rootScope.chooseDefaultOption = scope.chooseDefaultOption = function(type) { if(type === 'yes_no'){ scope.field.fieldValue = 'true'; }else if(type === 'rating'){ scope.field.fieldValue = 0; }else if(scope.field.fieldType === 'radio'){ console.log(scope.field); scope.field.fieldValue = scope.field.fieldOptions[0].option_value; console.log(scope.field.fieldValue); }else if(type === 'legal'){ scope.field.fieldValue = 'true'; $rootScope.nextField(); } }; scope.setActiveField = $rootScope.setActiveField; //Set format only if field is a date if(scope.field.fieldType === 'date'){ scope.dateOptions = { changeYear: true, changeMonth: true, altFormat: 'mm/dd/yyyy', yearRange: '1900:-0', defaultDate: 0 }; } var fieldType = scope.field.fieldType; if(scope.field.fieldType === 'number' || scope.field.fieldType === 'textfield' || scope.field.fieldType === 'email' || scope.field.fieldType === 'link'){ switch(scope.field.fieldType){ case 'textfield': scope.field.input_type = 'text'; break; case 'email': scope.field.input_type = 'email'; scope.field.placeholder = 'joesmith@example.com'; break; case 'number': scope.field.input_type = 'text'; scope.field.validateRegex = /^-?\d+$/; break; default: scope.field.input_type = 'url'; scope.field.placeholder = 'http://example.com'; break; } fieldType = 'textfield'; } var template = getTemplateUrl(fieldType); element.html(template).show(); $compile(element.contents())(scope); } }; }]); 'use strict'; angular.module('forms').directive('onEnterKey', ['$rootScope', function($rootScope){ return { restrict: 'A', link: function($scope, $element, $attrs) { $element.bind('keydown keypress', function(event) { var keyCode = event.which || event.keyCode; if(keyCode === 13 && !event.shiftKey) { event.preventDefault(); $rootScope.$apply(function() { $rootScope.$eval($attrs.onEnterKey); }); } }); } }; }]); 'use strict'; angular.module('forms').directive('onFinishRender', ["$rootScope", "$timeout", function ($rootScope, $timeout) { return { restrict: 'A', link: function (scope, element, attrs) { //Don't do anything if we don't have a ng-repeat on the current element if(!element.attr('ng-repeat') && !element.attr('data-ng-repeat')){ return; } var broadcastMessage = attrs.onFinishRender || 'ngRepeat'; if(scope.$first && !scope.$last) { scope.$evalAsync(function () { $rootScope.$broadcast(broadcastMessage+' Started'); }); }else if(scope.$last) { scope.$evalAsync(function () { // console.log(broadcastMessage+'Finished'); $rootScope.$broadcast(broadcastMessage+' Finished'); }); } } }; }]); 'use strict'; angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter', '$filter', '$rootScope', 'Auth', function ($http, TimeCounter, $filter, $rootScope, Auth) { return { templateUrl: 'modules/forms/base/views/directiveViews/form/submit-form.client.view.html', restrict: 'E', scope: { myform:'=' }, controller: ["$document", "$window", "$scope", function($document, $window, $scope){ $scope.authentication = $rootScope.authentication; $scope.noscroll = false; $scope.forms = {}; var form_fields_count = $scope.myform.visible_form_fields.filter(function(field){ if(field.fieldType === 'statement' || field.fieldType === 'rating'){ return false; } return true; }).length; var nb_valid = $filter('formValidity')($scope.myform); $scope.translateAdvancementData = { done: nb_valid, total: form_fields_count, answers_not_completed: form_fields_count - nb_valid }; $scope.reloadForm = function(){ //Reset Form $scope.myform.submitted = false; $scope.myform.form_fields = _.chain($scope.myform.visible_form_fields).map(function(field){ field.fieldValue = ''; return field; }).value(); $scope.loading = false; $scope.error = ''; $scope.selected = { _id: '', index: 0 }; $scope.setActiveField($scope.myform.visible_form_fields[0]._id, 0, false); //console.log($scope.selected); //Reset Timer 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; //console.log($scope.forms.myForm); var field_id; var field_index; if(!$scope.noscroll){ //Focus on submit button if( $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, false); } //Focus on field above submit button else if($scope.selected.index === $scope.myform.visible_form_fields.length){ if($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, false); } }else if( $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, false); }else if ( $scope.selected.index !== 0 && $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, false); } //console.log('$scope.selected.index: '+$scope.selected.index); //console.log('scroll pos: '+$scope.scrollPos+' fieldTop: '+$scope.fieldTop+' fieldBottom: '+$scope.fieldBottom); $scope.$apply(); } }; $rootScope.setDropdownOption = function(){ console.log('setDropdownOption index: '); }; /* ** Field Controls */ $scope.setActiveField = $rootScope.setActiveField = function(field_id, field_index, animateScroll) { if($scope.selected === null || $scope.selected._id === field_id){ //console.log('not scrolling'); //console.log($scope.selected); return; } //console.log('field_id: '+field_id); //console.log('field_index: '+field_index); //console.log($scope.selected); $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 }; if(animateScroll){ $scope.noscroll=true; setTimeout(function() { $document.scrollToElement(angular.element('.activeField'), -10, 200).then(function() { $scope.noscroll = false; setTimeout(function() { if (document.querySelectorAll('.activeField .focusOn')[0]) { //console.log(document.querySelectorAll('.activeField .focusOn')[0]); document.querySelectorAll('.activeField .focusOn')[0].focus(); } else { //console.log(document.querySelectorAll('.activeField input')[0]); document.querySelectorAll('.activeField input')[0].focus(); } }); }); }); }else { setTimeout(function() { if (document.querySelectorAll('.activeField .focusOn')[0]) { //console.log(document.querySelectorAll('.activeField .focusOn')[0]); document.querySelectorAll('.activeField .focusOn')[0].focus(); } else { document.querySelectorAll('.activeField input')[0].focus(); } }); } }; $rootScope.nextField = $scope.nextField = function(){ //console.log('nextfield'); //console.log($scope.selected.index); //console.log($scope.myform.visible_form_fields.length-1); var selected_index, selected_id; if($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, true); } else if($scope.selected.index === $scope.myform.visible_form_fields.length-1) { //console.log('Second last element'); selected_index = $scope.selected.index+1; selected_id = 'submit_field'; $rootScope.setActiveField(selected_id, selected_index, true); } }; $rootScope.prevField = $scope.prevField = function(){ if($scope.selected.index > 0){ var selected_index = $scope.selected.index - 1; var selected_id = $scope.myform.visible_form_fields[selected_index]._id; $scope.setActiveField(selected_id, selected_index, true); } }; /* ** Form Display Functions */ $scope.exitStartPage = function(){ $scope.myform.startPage.showStart = false; if($scope.myform.visible_form_fields.length > 0){ $scope.selected._id = $scope.myform.visible_form_fields[0]._id; } }; $scope.goToInvalid = function() { document.querySelectorAll('.ng-invalid.focusOn')[0].focus(); }; $scope.submitForm = function() { var _timeElapsed = TimeCounter.stopClock(); $scope.loading = true; var form = _.cloneDeep($scope.myform); form.timeElapsed = _timeElapsed; form.percentageComplete = $filter('formValidity')($scope.myform) / $scope.myform.visible_form_fields.length * 100; delete form.visible_form_fields; setTimeout(function () { $scope.submitPromise = $http.post('/forms/' + $scope.myform._id, form) .success(function (data, status, headers) { //console.log('form submitted successfully'); $scope.myform.submitted = true; $scope.loading = false; }) .error(function (error) { $scope.loading = false; //console.log(error); $scope.error = error.message; }); }, 500); }; //Reload our form $scope.reloadForm(); }] }; } ]); 'use strict'; //Forms service used for communicating with the forms REST endpoints angular.module('forms').service('CurrentForm', function(){ //Private variables var _form = {}; //Public Methods this.getForm = function() { return _form; }; this.setForm = function(form) { _form = form; }; } ); 'use strict'; //Forms service used for communicating with the forms REST endpoints angular.module('forms').factory('Forms', ['$resource', 'FORM_URL', function($resource, FORM_URL) { return $resource(FORM_URL, { formId: '@_id' }, { 'query' : { method: 'GET', isArray: true, //DAVID: TODO: Do we really need to get visible_form_fields for a Query? // transformResponse: function(data, header) { // var forms = angular.fromJson(data); // angular.forEach(forms, function(form, idx) { // form.visible_form_fields = _.filter(form.form_fields, function(field){ // return (field.deletePreserved === false); // }); // }); // return forms; // } }, 'get' : { method: 'GET', transformResponse: function(data, header) { var form = angular.fromJson(data); //console.log(form); form.visible_form_fields = _.filter(form.form_fields, function(field){ return (field.deletePreserved === false); }); return form; } }, 'update': { method: 'PUT' }, 'save': { method: 'POST' } }); } ]); 'use strict'; angular.module('forms').service('TimeCounter', [ function(){ var _startTime, _endTime, that=this; this.timeSpent = 0; this.restartClock = function(){ _startTime = Date.now(); _endTime = _startTime; // console.log('Clock Started'); }; this.stopClock = function(){ if(_startTime){ _endTime = Date.now(); that.timeSpent = Math.abs(_endTime.valueOf() - _startTime.valueOf())/1000; // console.log('Clock Ended'); return that.timeSpent; }else{ return new Error('Clock has not been started'); } }; this.clockStarted = function(){ return !!this._startTime; }; } ]);