Commit 039db5e98ad713b5a69ff85b6f719c2da5e8bdbf

Authored by Rodrigo Gonçalves
0 parents
Exists in master

Ajustes modulo de novo chamado

Showing 30 changed files with 2513 additions and 0 deletions   Show diff stats
.includepath 0 → 100644
  1 +++ a/.includepath
... ... @@ -0,0 +1,6 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<includepath>
  3 + <includepathentry path="${project_loc}" />
  4 + <includepathentry path="/opt/otrs/" />
  5 +</includepath>
  6 +
... ...
.project 0 → 100644
  1 +++ a/.project
... ... @@ -0,0 +1,17 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>otrs-new-ticket-wizard</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>org.epic.perleditor.perlbuilder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + </buildSpec>
  14 + <natures>
  15 + <nature>org.epic.perleditor.perlnature</nature>
  16 + </natures>
  17 +</projectDescription>
... ...
CreateOpm.sh 0 → 100755
  1 +++ a/CreateOpm.sh
... ... @@ -0,0 +1,5 @@
  1 +#!/bin/bash
  2 +LOCAL="$PWD"
  3 +cd /opt/otrs/bin
  4 +./otrs.PackageManager.pl -a build -p "$LOCAL"/NewTicketWizard.sopm -o "$LOCAL"/
  5 +cd $LOCAL
... ...
Kernel/Config/Files/NewTicketWizard.xml 0 → 100644
  1 +++ a/Kernel/Config/Files/NewTicketWizard.xml
... ... @@ -0,0 +1,213 @@
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<otrs_config init="Application"
  3 + version="1.0">
  4 + <!-- TODO: Transformar em módulo de usuário também -->
  5 + <ConfigItem Name="CustomerFrontend::Module###NewTicketWizard" Required="1" Valid="1">
  6 + <Description Translatable="1">FrontendModuleRegistration for NewTicketWizard module.</Description>
  7 + <Group>Ticket</Group>
  8 + <SubGroup>Frontend::Customer::ModuleRegistration</SubGroup>
  9 + <Setting>
  10 + <FrontendModuleReg>
  11 + <Description>Module for creating custom new ticket interfaces</Description>
  12 + <NavBarName>NewTicketWizard</NavBarName>
  13 + <NavBar>
  14 + <Description Translatable="1">New ticket wizard</Description>
  15 + <Name Translatable="1">New ticket</Name>
  16 + <Link>Action=NewTicketWizard</Link>
  17 + <NavBar>NewTicketWizard</NavBar>
  18 + <Type>Menu</Type>
  19 + <Prio>8400</Prio>
  20 + </NavBar>
  21 + <!-- Carrega o alpaca -->
  22 + <Loader>
  23 + <JavaScript>NewTicketWizard.js</JavaScript>
  24 + <JavaScript>thirdparty/alpaca/alpaca-full.min.js</JavaScript>
  25 + <JavaScript>thirdparty/jquery-ui-1.10.3/jquery-ui.js</JavaScript>
  26 + <JavaScript>thirdparty/jquery-validate-1.11.1/jquery.validate.js</JavaScript>
  27 + <CSS>alpaca/alpaca-newticketwizard.css</CSS>
  28 + <CSS>alpaca/alpaca-jqueryui-newticketwizard.css</CSS>
  29 + </Loader>
  30 + </FrontendModuleReg>
  31 + </Setting>
  32 + </ConfigItem>
  33 +
  34 + <ConfigItem Name="Frontend::Module###NewTicketWizardServiceForm" Required="0" Valid="1">
  35 + <Description Translatable="1">Frontend module registration for the agent interface.</Description>
  36 + <Group>Ticket</Group>
  37 + <SubGroup>Frontend::Admin::ModuleRegistration</SubGroup>
  38 + <Setting>
  39 + <FrontendModuleReg>
  40 + <Group>admin</Group>
  41 + <Description>Admin</Description>
  42 + <Title Translatable="1">Service forms</Title>
  43 + <NavBarName>Admin</NavBarName>
  44 + <NavBarModule>
  45 + <Module>Kernel::Output::HTML::NavBarModuleAdmin</Module>
  46 + <Name Translatable="1">Service forms</Name>
  47 + <Description Translatable="1">Create and manage service forms.</Description>
  48 + <Block>Ticket</Block>
  49 + <Prio>900</Prio>
  50 + </NavBarModule>
  51 + </FrontendModuleReg>
  52 + </Setting>
  53 + </ConfigItem>
  54 +
  55 + <ConfigItem Name="Ticket::Frontend::Customer::NewTicketWizard###BasicSchema"
  56 + Required="0" Valid="1">
  57 + <Description Lang="en">Describe the form basic schema. See documentation for examples.</Description>
  58 + <Description Lang="pt_BR">
  59 + Descreva o esquema básico do formulário. Veja a documentação para maiores detalhes.
  60 + </Description>
  61 + <Group>Ticket</Group>
  62 + <SubGroup>Frontend::Customer::NewTicketWizard</SubGroup>
  63 + <Setting>
  64 + <TextArea Regex="">
  65 + "service": {
  66 + "type": "string",
  67 + "required": "true"
  68 + },
  69 + "DF_unidade": {
  70 + "type": "string",
  71 + "enum": [
  72 + DF_unidade_values
  73 + ],
  74 + "required": "true"
  75 + },
  76 + "DF_local": {
  77 + "type": "string",
  78 + "required": "true"
  79 + },
  80 + "DF_telefone": {
  81 + "type": "string",
  82 + "required": "true"
  83 + },
  84 + "type": {
  85 + "type": "string",
  86 + "enum": [
  87 + OTRS_type_values
  88 + ],
  89 + "required": "true"
  90 + }
  91 + CF_SCHEMA
  92 + ,
  93 + "subject": {
  94 + "type": "string",
  95 + "required": "true"
  96 + },
  97 + "description": {
  98 + "type": "string",
  99 + "required": "true"
  100 + },
  101 + "attachment": {
  102 + "type": "string",
  103 + "format": "uri"
  104 + },
  105 + "Action": {
  106 + "type": "string",
  107 + "default": "NewTicketWizard"
  108 + },
  109 + "Subaction": {
  110 + "type": "string",
  111 + "default": "CreateTicket"
  112 + }
  113 + </TextArea>
  114 + </Setting>
  115 + </ConfigItem>
  116 +
  117 + <ConfigItem Name="Ticket::Frontend::Customer::NewTicketWizard###BasicForm"
  118 + Required="0" Valid="1">
  119 + <Description Lang="en">Describe the form basic fields. See documentation for examples.</Description>
  120 + <Description Lang="pt_BR">
  121 + Descreva os campos básicos do formulário. Veja a documentação para maiores detalhes.
  122 + </Description>
  123 + <Group>Ticket</Group>
  124 + <SubGroup>Frontend::Customer::NewTicketWizard</SubGroup>
  125 + <Setting>
  126 + <TextArea Regex="">
  127 + "DF_unidade": {
  128 + "type": "select",
  129 + "label": "Unidade:",
  130 + "optionLabels": [
  131 + DF_unidade_labels
  132 + ]
  133 + },
  134 + "DF_local": {
  135 + "type": "text",
  136 + "label": "Local:"
  137 + },
  138 + "DF_telefone": {
  139 + "type": "text",
  140 + "label": "Telefone:",
  141 + "control_width": 100
  142 + },
  143 + "type": {
  144 + "type": "select",
  145 + "label": "Motivo:",
  146 + "optionLabels": [
  147 + OTRS_type_labels
  148 + ]
  149 + },
  150 + "service": {
  151 + "type": "hidden"
  152 + }
  153 + CF_FORM,
  154 + "subject": {
  155 + "type": "text",
  156 + "label": "Assunto:",
  157 + "size": 80
  158 + },
  159 + "description": {
  160 + "type": "textarea",
  161 + "label": "Descrição:",
  162 + "cols": 80
  163 + },
  164 + "attachment": {
  165 + "type": "file",
  166 + "label": "Anexo:",
  167 + "helper": "Anexe um arquivo se necessário."
  168 + },
  169 + "Action": {
  170 + "type": "hidden"
  171 + },
  172 + "Subaction": {
  173 + "type": "hidden"
  174 + }
  175 + </TextArea>
  176 + </Setting>
  177 + </ConfigItem>
  178 +
  179 + <ConfigItem Name="Ticket::Frontend::Customer::NewTicketWizard###QueuePrefix"
  180 + Required="0" Valid="1">
  181 + <Description Lang="en">When the queue comes from a field in the form, a prefix can be attached to the value while searching for the queue. A space is added between this and the queue name.</Description>
  182 + <Description Lang="pt_BR">
  183 + Prefixo para ser anexado ao valor do campo que tem a fila para enviar o chamado. Um espaço é adicionado entre o prefixo e o valor o campo.
  184 + </Description>
  185 + <Group>Ticket</Group>
  186 + <SubGroup>Frontend::Customer::NewTicketWizard</SubGroup>
  187 + <Setting>
  188 + <String Regex="">Primeiro nível -</String>
  189 + </Setting>
  190 + </ConfigItem>
  191 +
  192 + <ConfigItem Name="Ticket::Frontend::Customer::NewTicketWizard###QueueField"
  193 + Required="0" Valid="1">
  194 + <Description Lang="en">Name of the field in the form which indicates the queue to send the form.</Description>
  195 + <Description Lang="pt_BR">Nome do campo no formulário que indica para qual fila enviar o chamado.</Description>
  196 + <Group>Ticket</Group>
  197 + <SubGroup>Frontend::Customer::NewTicketWizard</SubGroup>
  198 + <Setting>
  199 + <String Regex="">DF_unidade</String>
  200 + </Setting>
  201 + </ConfigItem>
  202 +
  203 + <ConfigItem Name="Ticket::Frontend::Customer::NewTicketWizard###MessageChooseService"
  204 + Required="0" Valid="1">
  205 + <Description Lang="en">Message to let the user choose a server.</Description>
  206 + <Description Lang="pt_BR">Mensagem para o usuário selecionar um serviço.</Description>
  207 + <Group>Ticket</Group>
  208 + <SubGroup>Frontend::Customer::NewTicketWizard</SubGroup>
  209 + <Setting>
  210 + <String Regex="">Escolha o serviço para o qual deseja suporte</String>
  211 + </Setting>
  212 + </ConfigItem>
  213 +</otrs_config>
0 214 \ No newline at end of file
... ...
Kernel/Language/pt_BR_NewTicketWizard.pm 0 → 100644
  1 +++ a/Kernel/Language/pt_BR_NewTicketWizard.pm
... ... @@ -0,0 +1,32 @@
  1 +# --
  2 +# Kernel/Modules/pt_BR_NewTicketWizard.pm - frontend module for creating custom new ticket interfaces
  3 +# Translations
  4 +#
  5 +# Copyright (C) 2014 (Rodrigo Goncalves) (rodrigo.g@ufsc.br)
  6 +# --
  7 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  8 +# the enclosed file COPYING for license information (AGPL). If you
  9 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  10 +# --
  11 +package Kernel::Language::pt_BR_NewTicketWizard;
  12 +
  13 +use strict;
  14 +use warnings;
  15 +
  16 +sub Data {
  17 + my $Self = shift;
  18 +
  19 + $Self->{Translation}->{'Your ticket has been registered with the number: '} = 'Seu chamado foi registrado com sucesso! O número é: ';
  20 + $Self->{Translation}->{'New ticket wizard'} = 'Assistente de novo chamado';
  21 + $Self->{Translation}->{'New ticket'} = 'Novo chamado';
  22 + $Self->{Translation}->{'Service forms'} = 'Formulários de serviços';
  23 + $Self->{Translation}->{'Service form'} = 'Formulários de serviço';
  24 + $Self->{Translation}->{'Create and manage service forms.'} = 'Criar e gerenciar formulários de serviços';
  25 + $Self->{Translation}->{'Introduction'} = 'Introdução';
  26 + $Self->{Translation}->{'Form'} = 'Formulário';
  27 + $Self->{Translation}->{'Choose the service to ask for support'} = 'Escolha o servi&ccedil;o para o qual deseja suporte';
  28 + $Self->{Translation}->{'Ticket created'} = 'Chamado criado com sucesso';
  29 +
  30 + return 1;
  31 +}
  32 +1;
0 33 \ No newline at end of file
... ...
Kernel/Modules/NewTicketWizard.pm 0 → 100644
  1 +++ a/Kernel/Modules/NewTicketWizard.pm
... ... @@ -0,0 +1,320 @@
  1 +# --
  2 +# Kernel/Modules/NewTicketWizard.pm - frontend module for creating custom new ticket interfaces
  3 +# Copyright (C) 2014 (Rodrigo Goncalves) (rodrigo.g@ufsc.br)
  4 +# --
  5 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  6 +# the enclosed file COPYING for license information (AGPL). If you
  7 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  8 +# --
  9 +package Kernel::Modules::NewTicketWizard;
  10 +
  11 +use strict;
  12 +use warnings;
  13 +
  14 +use Kernel::System::ServiceForm;
  15 +use Kernel::System::TicketWizard;
  16 +use Kernel::System::CustomerUser;
  17 +use Kernel::System::State;
  18 +use Kernel::System::SystemAddress;
  19 +use Kernel::System::Queue;
  20 +use Kernel::System::Web::UploadCache;
  21 +use Kernel::System::DynamicField;
  22 +use Kernel::System::DynamicField::Backend;
  23 +use Kernel::System::VariableCheck qw(:all);
  24 +use Data::Dumper;
  25 +
  26 +sub new {
  27 + my ( $Type, %Param ) = @_;
  28 +
  29 + # allocate new hash for object
  30 + my $Self = {%Param};
  31 + bless( $Self, $Type );
  32 +
  33 + # check needed objects
  34 + for (
  35 + qw(ParamObject DBObject TicketObject LayoutObject LogObject QueueObject ConfigObject)
  36 + )
  37 + {
  38 + if ( !$Self->{$_} ) {
  39 + $Self->{LayoutObject}->FatalError( Message => "Got no $_!" );
  40 + }
  41 + }
  42 +
  43 + # needed objects
  44 + $Self->{CustomerUserObject} = Kernel::System::CustomerUser->new(%Param);
  45 + $Self->{StateObject} = Kernel::System::State->new(%Param);
  46 + $Self->{SystemAddress} = Kernel::System::SystemAddress->new(%Param);
  47 + $Self->{UploadCacheObject} = Kernel::System::Web::UploadCache->new(%Param);
  48 + $Self->{DynamicFieldObject} = Kernel::System::DynamicField->new(%Param);
  49 + $Self->{BackendObject} = Kernel::System::DynamicField::Backend->new(%Param);
  50 + $Self->{TicketWizard} = Kernel::System::TicketWizard->new(%Param);
  51 + $Self->{ServiceFormObject} = Kernel::System::ServiceForm->new(%Param);
  52 + $Self->{ServiceObject} = Kernel::System::Service->new(%Param);
  53 +
  54 + return $Self;
  55 +}
  56 +
  57 +sub Run {
  58 + my ( $Self, %Param ) = @_;
  59 + my %Data = ();
  60 +
  61 + # Build service chooser
  62 + my %Services = $Self->{ServiceObject}->ServiceList( UserID => $Self->{ConfigObject}->Get('CustomerPanelUserID'), );
  63 + my @ServicesCombo = ();
  64 +
  65 + for my $serviceID ( keys %Services ) {
  66 + if ( grep { index( $Services{$_}, $Services{$serviceID} . "::" ) >= 0 } ( keys %Services ) ) {
  67 + my %serv = ();
  68 + $serv{Value} = $Services{$serviceID};
  69 + $serv{Key} = $serviceID;
  70 + $serv{Disabled} = 1;
  71 + push @ServicesCombo, \%serv;
  72 + }
  73 + else {
  74 + my %serv = ();
  75 + $serv{Value} = $Services{$serviceID};
  76 + $serv{Key} = $serviceID;
  77 + push @ServicesCombo, \%serv;
  78 + }
  79 + }
  80 +
  81 + @ServicesCombo = sort { $a->{Value} . "::" cmp $b->{Value} . "::" } @ServicesCombo;
  82 +
  83 + $Data{ServiceStrg} = $Self->{LayoutObject}->BuildSelection(
  84 + Data => \@ServicesCombo,
  85 + Name => 'ServiceID',
  86 + SelectedID => $Param{ServiceID},
  87 + Class => "Validate_Required " . ( $Param{Errors}->{ServiceIDInvalid} || '' ),
  88 + PossibleNone => 1,
  89 + TreeView => 1,
  90 + Sort => 'TreeView',
  91 + Translation => 0,
  92 + Max => 200
  93 + );
  94 + $Self->{Config} = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard");
  95 + my $msgChooseService = $Self->{Config}->{"MessageChooseService"};
  96 + $Data{MsgChooseService} = $msgChooseService;
  97 +
  98 + if ( $Self->{ParamObject}->GetParam( Param => "Subaction" ) ) {
  99 + if ( $Self->{ParamObject}->GetParam( Param => "Subaction" ) eq "CreateTicket" ) {
  100 + return $Self->CreateTicket();
  101 + }
  102 + elsif ( $Self->{ParamObject}->GetParam( Param => "Subaction" ) eq "GetFormJSON" ) {
  103 + return $Self->GetFormJSON( ServiceID => $Self->{ParamObject}->GetParam( Param => "ServiceID" ) );
  104 + }
  105 + }
  106 + else {
  107 + my ( $schema, $fields ) = $Self->GetForm();
  108 +
  109 + $Data{SchemaForm} = $schema;
  110 + $Data{FieldsForm} = $fields;
  111 +
  112 + # build output
  113 + my $Output =
  114 + $Self->{LayoutObject}
  115 + ->CustomerHeader( Title => $Self->{LayoutObject}->{LanguageObject}->Get("New ticket wizard") );
  116 +
  117 + $Output .= $Self->{LayoutObject}->CustomerNavigationBar();
  118 + $Output .= $Self->{LayoutObject}->Output(
  119 + Data => \%Data,
  120 + TemplateFile => 'NewTicketWizard',
  121 + );
  122 + $Output .= $Self->{LayoutObject}->CustomerFooter();
  123 + return $Output;
  124 + }
  125 +}
  126 +
  127 +sub GetFormJSON {
  128 + my ( $Self, %Param ) = @_;
  129 + my %serviceForm;
  130 +
  131 + if ( $Param{ServiceID} ) {
  132 + %serviceForm = $Self->{ServiceFormObject}->GetServiceForm( ServiceID => $Param{ServiceID} );
  133 + }
  134 +
  135 + my ( $schema, $fields, $introduction ) = $Self->GetForm( ServiceForm => \%serviceForm );
  136 +
  137 + return $Self->{LayoutObject}->Attachment(
  138 + ContentType => 'application/json; charset=' . $Self->{LayoutObject}->{Charset},
  139 + Content => "[{" . $schema . "}, {" . $fields . "}, \"" . $introduction . "\"]",
  140 + Type => 'inline',
  141 + NoCache => 1,
  142 + );
  143 +}
  144 +
  145 +sub GetForm {
  146 + my ( $Self, %Param ) = @_;
  147 +
  148 + my $schema = $Self->{TicketWizard}->GetBasicFieldsSchema();
  149 + my $fields = $Self->{TicketWizard}->GetBasicFieldsOptions();
  150 + my $introduction;
  151 +
  152 + ( $schema, $fields ) = $Self->{TicketWizard}->ReplaceOTRSValues(
  153 + Schema => $schema,
  154 + Options => $fields,
  155 + UserID => $Self->{ConfigObject}->Get('CustomerPanelUserID')
  156 + );
  157 + ( $schema, $fields ) = $Self->{TicketWizard}->ReplaceOTRSDynamicFields( Schema => $schema, Options => $fields );
  158 +
  159 + if ( !$Param{ServiceForm} ) {
  160 + $schema =~ s/CF_SCHEMA//g;
  161 + $fields =~ s/CF_FORM//g;
  162 + $introduction = "";
  163 + }
  164 + else {
  165 + my %serviceForm = %{ $Param{ServiceForm} };
  166 + $introduction = $serviceForm{Introduction};
  167 +
  168 + if ( !$Param{ServiceForm}{Schema} ) {
  169 + $schema =~ s/CF_SCHEMA//g;
  170 + $fields =~ s/CF_FORM//g;
  171 + }
  172 + else {
  173 + my $schemaForm = "," . $serviceForm{Schema};
  174 + my $fieldsForm = "," . $serviceForm{Form};
  175 + $schema =~ s/CF_SCHEMA/$schemaForm/g;
  176 + $fields =~ s/CF_FORM/$fieldsForm/g;
  177 + }
  178 + }
  179 +
  180 + return ( $schema, $fields, $introduction );
  181 +}
  182 +
  183 +sub GetQueueID() {
  184 + my ( $Self, %Param ) = @_;
  185 +
  186 + # Gets default Queue
  187 + my $ConfigTicket = $Self->{ConfigObject}->Get("Ticket::Frontend::CustomerTicketMessage");
  188 + my $ConfigTicketWizard = $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard");
  189 +
  190 + my $QueueDefault = $ConfigTicket->{"QueueDefault"};
  191 + my $QueueID = $Self->{QueueObject}->QueueLookup( Queue => $QueueDefault );
  192 + my $Queue = $QueueDefault;
  193 +
  194 + # Checks if there is a field for the queue
  195 + print STDERR Dumper($ConfigTicketWizard);
  196 +
  197 + my $QueuePrefix = $ConfigTicketWizard->{"QueuePrefix"};
  198 + my $QueueField = $ConfigTicketWizard->{"QueueField"};
  199 + $Self->{LogObject}->Log( Priority => 'info', Message => "Searching queue for - $QueuePrefix ($QueueField)!" );
  200 +
  201 + if ( $QueuePrefix && $QueueField ) {
  202 +
  203 + my $QueueSelected = $Self->{ParamObject}->GetParam( Param => $QueueField );
  204 + my $QueueName = "$QueuePrefix $QueueSelected";
  205 + $Self->{LogObject}
  206 + ->Log( Priority => 'info', Message => "Searching queue for - $QueuePrefix ($QueueField) - [$QueueName]!" );
  207 +
  208 + my %QueueList = reverse $Self->{QueueObject}->QueueList( Valid => 1 );
  209 +
  210 + if ( $QueueList{$QueueName} ) {
  211 + $QueueID = $QueueList{$QueueName};
  212 + $Queue = $QueueName;
  213 + $Self->{LogObject}->Log( Priority => 'info', Message => "Custom queue found - $QueueName ($QueueID)!" );
  214 + }
  215 +
  216 + }
  217 +
  218 + return ( $Queue, $QueueID );
  219 +}
  220 +
  221 +sub CreateTicket {
  222 + my ( $Self, %Param ) = @_;
  223 + my %Data = ();
  224 +
  225 + # Queue
  226 + my ( $Queue, $QueueID ) = $Self->GetQueueID(%Param);
  227 + $Self->{Config} = $Self->{ConfigObject}->Get("Ticket::Frontend::CustomerTicketMessage");
  228 +
  229 + my $TicketID = $Self->{TicketObject}->TicketCreate(
  230 + Title => $Self->{ParamObject}->GetParam( Param => "subject" ),
  231 + QueueID => $QueueID,
  232 + Priority => $Self->{Config}->{PriorityDefault},
  233 + Lock => 'unlock',
  234 + State => 'new',
  235 + ServiceID => $Self->{ParamObject}->GetParam( Param => "service" ),
  236 + TypeID => $Self->{ParamObject}->GetParam( Param => "type" ),
  237 + CustomerID => $Self->{UserCustomerID},
  238 + CustomerUser => $Self->{UserLogin},
  239 + OwnerID => $Self->{ConfigObject}->Get('CustomerPanelUserID'),
  240 + UserID => $Self->{ConfigObject}->Get('CustomerPanelUserID'),
  241 + );
  242 +
  243 + my $MimeType = 'text/plain';
  244 + my $serviceFields = "\n\n";
  245 +
  246 + # Service Fields
  247 + for ( $Self->{ParamObject}->GetParamNames() ) {
  248 + if ( substr( $_, 0, 3 ) eq "SF_" ) {
  249 + $serviceFields .= substr( $_, 3 ) . " = " . $Self->{ParamObject}->GetParam( Param => $_ ) . "\n";
  250 + }
  251 + }
  252 +
  253 + # Dynamic Fields
  254 + for ( $Self->{ParamObject}->GetParamNames() ) {
  255 + if ( substr( $_, 0, 3 ) eq "DF_" ) {
  256 + my $Success = $Self->{BackendObject}->ValueSet(
  257 + DynamicFieldConfig => $Self->{DynamicFieldObject}->DynamicFieldGet( Name => substr( $_, 3 ) ),
  258 + ObjectID => $TicketID,
  259 + Value => $Self->{ParamObject}->GetParam( Param => $_ ),
  260 + UserID => $Self->{ConfigObject}->Get('CustomerPanelUserID'),
  261 + );
  262 + }
  263 + }
  264 +
  265 + # Create article
  266 + my $FullName = $Self->{CustomerUserObject}->CustomerName( UserLogin => $Self->{UserLogin}, );
  267 + my $From = "\"$FullName\" <$Self->{UserEmail}>";
  268 + my $ArticleID = $Self->{TicketObject}->ArticleCreate(
  269 + TicketID => $TicketID,
  270 + ArticleType => $Self->{Config}->{ArticleType},
  271 + SenderType => $Self->{Config}->{SenderType},
  272 + From => $From,
  273 + To => $Queue,
  274 + Subject => $Self->{ParamObject}->GetParam( Param => "subject" ),
  275 + Body => $Self->{ParamObject}->GetParam( Param => "description" ) . $serviceFields,
  276 + MimeType => $MimeType,
  277 + Charset => $Self->{LayoutObject}->{UserCharset},
  278 + UserID => $Self->{ConfigObject}->Get('CustomerPanelUserID'),
  279 + HistoryType => $Self->{Config}->{HistoryType},
  280 + HistoryComment => $Self->{Config}->{HistoryComment} || '%%',
  281 + AutoResponseType => ( $Self->{ConfigObject}->Get('AutoResponseForWebTickets') )
  282 + ? 'auto reply'
  283 + : '',
  284 + OrigHeader => {
  285 + From => $From,
  286 + To => $Queue,
  287 + Subject => $Self->{ParamObject}->GetParam( Param => "subject" ),
  288 + Body => $Self->{ParamObject}->GetParam( Param => "description" ),
  289 + },
  290 + Queue => $Queue,
  291 + );
  292 +
  293 + # Attachments
  294 + my %UploadStuff = $Self->{ParamObject}->GetUploadAll( Param => "attachment" );
  295 +
  296 + # if (%UploadStuff) {
  297 + # print STDERR "\nTem anexo!\n";
  298 + $Self->{TicketObject}->ArticleWriteAttachment(
  299 + %UploadStuff,
  300 + ArticleID => $ArticleID,
  301 + UserID => $Self->{ConfigObject}->Get('CustomerPanelUserID'),
  302 + );
  303 +
  304 + # }
  305 +
  306 + $Data{TicketNumber} = $Self->{TicketObject}->TicketNumberLookup( TicketID => $TicketID );
  307 +
  308 + # build output
  309 + my $Output = $Self->{LayoutObject}->CustomerHeader( Title => "Ticket created" );
  310 + $Output .= $Self->{LayoutObject}->CustomerNavigationBar();
  311 + $Output .= $Self->{LayoutObject}->Output(
  312 + Data => \%Data,
  313 + TemplateFile => 'NewTicketWizardTicketCreated',
  314 + );
  315 + $Output .= $Self->{LayoutObject}->CustomerFooter();
  316 + return $Output;
  317 +
  318 +}
  319 +
  320 +1;
... ...
Kernel/Modules/NewTicketWizardServiceForm.pm 0 → 100644
  1 +++ a/Kernel/Modules/NewTicketWizardServiceForm.pm
... ... @@ -0,0 +1,151 @@
  1 +# --
  2 +# Kernel/Modules/NewTicketWizard.pm - frontend module for customizing service forms
  3 +# Copyright (C) 2014 (Rodrigo Goncalves) (rodrigo.g@ufsc.br)
  4 +# --
  5 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  6 +# the enclosed file COPYING for license information (AGPL). If you
  7 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  8 +# --
  9 +package Kernel::Modules::NewTicketWizardServiceForm;
  10 +
  11 +use strict;
  12 +use warnings;
  13 +
  14 +use Kernel::System::VariableCheck qw(:all);
  15 +use Data::Dumper;
  16 +use Kernel::System::ServiceForm;
  17 +use Kernel::System::Service;
  18 +
  19 +# TODO: Traducoes
  20 +
  21 +sub new {
  22 + my ( $Type, %Param ) = @_;
  23 +
  24 + # allocate new hash for object
  25 + my $Self = {%Param};
  26 + bless( $Self, $Type );
  27 +
  28 + # check needed objects
  29 + for (
  30 + qw(ParamObject DBObject LayoutObject LogObject ConfigObject)
  31 + )
  32 + {
  33 + if ( !$Self->{$_} ) {
  34 + $Self->{LayoutObject}->FatalError( Message => "Got no $_!" );
  35 + }
  36 + }
  37 +
  38 + # needed objects
  39 + $Self->{SystemAddress} = Kernel::System::SystemAddress->new(%Param);
  40 + $Self->{BackendObject} = Kernel::System::DynamicField::Backend->new(%Param);
  41 + $Self->{ServiceObject} = Kernel::System::Service->new(%Param);
  42 + $Self->{ServiceFormObject} = Kernel::System::ServiceForm->new(%Param);
  43 +
  44 + return $Self;
  45 +}
  46 +
  47 +sub Run {
  48 +
  49 + my ( $Self, %Param ) = @_;
  50 + my %Data = ();
  51 +
  52 + if ( $Self->{ParamObject}->GetParam( Param => "Subaction" ) ) {
  53 + if ( $Self->{Subaction} eq 'ServiceEdit' ) {
  54 +
  55 + # header
  56 + my $Output = $Self->{LayoutObject}->Header();
  57 + $Output .= $Self->{LayoutObject}->NavigationBar();
  58 +
  59 + my %serviceForm =
  60 + $Self->{ServiceFormObject}
  61 + ->GetServiceForm( ServiceID => $Self->{ParamObject}->GetParam( Param => "ServiceID" ) );
  62 +
  63 + $Data{Introduction} = $serviceForm{Introduction};
  64 + $Data{Form} = $serviceForm{Form};
  65 + $Data{Schema} = $serviceForm{Schema};
  66 + $Data{ServiceID} = $Self->{ParamObject}->GetParam( Param => "ServiceID" );
  67 +
  68 + $Output .= $Self->{LayoutObject}->Output(
  69 + Data => \%Data,
  70 + TemplateFile => 'NewTicketWizardServiceFormEdit',
  71 + );
  72 +
  73 + # html output
  74 + $Output .= $Self->{LayoutObject}->Footer();
  75 +
  76 + return $Output;
  77 + }
  78 + elsif ( $Self->{Subaction} eq 'ServiceSave' ) {
  79 +
  80 + # header
  81 + my $Output = $Self->{LayoutObject}->Header();
  82 + $Output .= $Self->{LayoutObject}->NavigationBar();
  83 +
  84 + $Self->{ServiceFormObject}->SaveServiceForm(
  85 + ServiceID => $Self->{ParamObject}->GetParam( Param => "ServiceID" ),
  86 + Introduction => $Self->{ParamObject}->GetParam( Param => "Introduction" ),
  87 + Form => $Self->{ParamObject}->GetParam( Param => "Form" ),
  88 + Schema => $Self->{ParamObject}->GetParam( Param => "Schema" ),
  89 + );
  90 +
  91 + return $Self->Overview();
  92 + }
  93 + }
  94 + else {
  95 + return $Self->Overview();
  96 + }
  97 +}
  98 +
  99 +sub Overview {
  100 +
  101 + my ( $Self, %Param ) = @_;
  102 +
  103 + my %Data = ();
  104 +
  105 + # build output
  106 + $Self->{LayoutObject}->Block(
  107 + Name => 'Overview',
  108 + Data => { %Param, },
  109 + );
  110 +
  111 + $Self->{LayoutObject}->Block(
  112 + Name => 'OverviewList',
  113 + Data => { %Param, },
  114 + );
  115 +
  116 + # get service list
  117 + my $ServiceList = $Self->{ServiceObject}->ServiceListGet(
  118 + Valid => 1,
  119 + UserID => $Self->{UserID},
  120 + );
  121 +
  122 + # if there are any services defined, they are shown
  123 + if ( @{$ServiceList} ) {
  124 +
  125 + # sort the service list by long service name
  126 + @{$ServiceList} = sort { $a->{Name} . '::' cmp $b->{Name} . '::' } @{$ServiceList};
  127 +
  128 + for my $ServiceData ( @{$ServiceList} ) {
  129 + if (! grep { index($_->{Name}, $ServiceData->{Name} . "::") >= 0} @{$ServiceList} ) {
  130 +
  131 + # output row
  132 + $Self->{LayoutObject}->Block(
  133 + Name => 'OverviewListRow',
  134 + Data => { %{$ServiceData} },
  135 + );
  136 + }
  137 + }
  138 + }
  139 +
  140 + my $Output = $Self->{LayoutObject}->Header( Title => $Self->{LayoutObject}->{LanguageObject}->Get("Service Form") );
  141 +
  142 + $Output .= $Self->{LayoutObject}->NavigationBar();
  143 + $Output .= $Self->{LayoutObject}->Output(
  144 + Data => \%Data,
  145 + TemplateFile => 'NewTicketWizardServiceForm',
  146 + );
  147 + $Output .= $Self->{LayoutObject}->Footer();
  148 + return $Output;
  149 +}
  150 +
  151 +1;
... ...
Kernel/Output/HTML/Standard/NewTicketWizard.dtl 0 → 100644
  1 +++ a/Kernel/Output/HTML/Standard/NewTicketWizard.dtl
... ... @@ -0,0 +1,42 @@
  1 +# --
  2 +# Kernel/Output/HTML/Standard/NewTicketWizard.dtl - template for new ticket wizard
  3 +# Copyright (C) (2014) (Rodrigo Goncalves) (rodrigo.g@ufsc.br)
  4 +# --
  5 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  6 +# the enclosed file COPYING for license information (AGPL). If you
  7 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  8 +# --
  9 +
  10 +<div style="margin: 5px; padding: 10px; width: 80%;">
  11 +$Data{"MsgChooseService"}
  12 +<div style="margin-top: 10px">
  13 +<form class="Field">
  14 + <span class="alpaca-field" >
  15 + <div class="alpaca-controlfield-label">
  16 + $Text{"Service"}:
  17 + </div>
  18 + $Data{"ServiceStrg"}
  19 + </span>
  20 +</form>
  21 +<div id="serviceDescription" style="margin: 5px; padding: 10px; width: 80%; border-style:solid; border-width: 1px; display: none"></div>
  22 +</div>
  23 +</div>
  24 +<div id="formTicket" style="padding-left: 15px; "></div>
  25 +
  26 +<!-- dtl:js_on_document_complete -->
  27 +<script type="text/javascript">
  28 + // To turn on debugging, uncomment this line
  29 + // Alpaca.logLevel = Alpaca.DEBUG;
  30 +
  31 +
  32 + Alpaca.registerMessages({
  33 + "disallowValue": "{0} não é um valor válido.",
  34 + "notOptional": "Este campo é obrigatório.",
  35 + "invalidValueOfEnum": ""
  36 + });
  37 +
  38 + $("#ServiceID").change(function() {
  39 + carregaForm(null, "$Text{"Send"}", "$Env{"CGIHandle"}");
  40 + });
  41 +</script>
  42 +<!-- dtl:js_on_document_complete -->
... ...
Kernel/Output/HTML/Standard/NewTicketWizardServiceForm.dtl 0 → 100644
  1 +++ a/Kernel/Output/HTML/Standard/NewTicketWizardServiceForm.dtl
... ... @@ -0,0 +1,47 @@
  1 +# --
  2 +# NewTicketWizardServiceForm.dtl - provides HTML form for NewTicketWizardServiceForm
  3 +# Copyright (C) 2014 UFSC
  4 +# --
  5 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  6 +# the enclosed file COPYING for license information (AGPL). If you
  7 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  8 +# --
  9 +
  10 +<!-- dtl:block:Overview -->
  11 +<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
  12 + <h1>$Text{"Service forms"}</h1>
  13 +
  14 +
  15 + <div class="ContentColumn">
  16 + <div class="WidgetSimple">
  17 +<!-- dtl:block:OverviewList -->
  18 + <div class="Content">
  19 +
  20 + <table class="DataTable">
  21 + <thead>
  22 + <tr>
  23 + <th>$Text{"Service"}</th>
  24 + </tr>
  25 + </thead>
  26 + <tbody>
  27 +<!-- dtl:block:NoDataFoundMsg -->
  28 + <tr>
  29 + <td colspan="5">
  30 + $Text{"No data found."}
  31 + </td>
  32 + </tr>
  33 +<!-- dtl:block:NoDataFoundMsg -->
  34 +<!-- dtl:block:OverviewListRow -->
  35 + <tr>
  36 + <td title="$QData{"Name"}">$QData{"LevelSpace"}<a class="AsBlock" href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=ServiceEdit;ServiceID=$LQData{"ServiceID"}">$QData{"Name", "80"}</a></td>
  37 + </tr>
  38 +<!-- dtl:block:OverviewListRow -->
  39 + </tbody>
  40 + </table>
  41 + </div>
  42 +<!-- dtl:block:OverviewList -->
  43 + </div>
  44 + </div>
  45 + <div class="Clear"></div>
  46 +</div>
  47 +<!-- dtl:block:Overview -->
0 48 \ No newline at end of file
... ...
Kernel/Output/HTML/Standard/NewTicketWizardServiceFormEdit.dtl 0 → 100644
  1 +++ a/Kernel/Output/HTML/Standard/NewTicketWizardServiceFormEdit.dtl
... ... @@ -0,0 +1,51 @@
  1 +# --
  2 +# NewTicketWizardServiceForm.dtl - provides HTML form for NewTicketWizardServiceForm
  3 +# Copyright (C) 2014 UFSC
  4 +# --
  5 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  6 +# the enclosed file COPYING for license information (AGPL). If you
  7 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  8 +# --
  9 +
  10 +
  11 +<!-- dtl:block:HeaderEdit -->
  12 + <h2>$Text{"Edit Service"} : $QData{"Name"}</h2>
  13 +<!-- dtl:block:HeaderEdit -->
  14 + </div>
  15 + <div class="Content">
  16 +
  17 + <form action="$Env{"CGIHandle"}" method="post" class="Validate">
  18 + <input type="hidden" name="Action" value="$Env{"Action"}"/>
  19 + <input type="hidden" name="Subaction" value="ServiceSave"/>
  20 + <input type="hidden" name="ServiceID" value="$QData{"ServiceID"}"/>
  21 +
  22 + <fieldset class="TableLike">
  23 +
  24 + <label for="Introduction">$Text{"Introduction"}: </label>
  25 + <div class="Field">
  26 + <textarea name="Introduction" id="Introduction" class="W50pc Validate_Required" rows="5">$QData{"Introduction"}</textarea>
  27 + </div>
  28 + <div class="Clear"></div>
  29 +
  30 + <label for="Form">$Text{"Form"}: </label>
  31 + <div class="Field">
  32 + <textarea name="Form" id="Form" class="W50pc " rows="20">$QData{"Form"}</textarea>
  33 + </div>
  34 + <div class="Clear"></div>
  35 +
  36 + <label for="Schema">$Text{"Schema"}: </label>
  37 + <div class="Field">
  38 + <textarea name="Schema" id="Schema" class="W50pc " rows="20">$QData{"Schema"}</textarea>
  39 + </div>
  40 + <div class="Clear"></div>
  41 +
  42 + <div class="Field SpacingTop">
  43 + <button class="Primary" type="submit" value="$Text{"Submit"}">$Text{"Submit"}</button>
  44 + $Text{"or"}
  45 + <a href="$Env{"Baselink"}Action=$Env{"Action"}">$Text{"Cancel"}</a>
  46 + </div>
  47 + <div class="Clear"></div>
  48 + </fieldset>
  49 +
  50 + </form>
  51 + </div>
... ...
Kernel/Output/HTML/Standard/NewTicketWizardTicketCreated.dtl 0 → 100644
  1 +++ a/Kernel/Output/HTML/Standard/NewTicketWizardTicketCreated.dtl
... ... @@ -0,0 +1,13 @@
  1 +# --
  2 +# Kernel/Output/HTML/Standard/NewTicketWizard.dtl - template for new ticket wizard
  3 +# Copyright (C) (2013) (Rodrigo Goncalves) (rodrigo.g@ufsc.br)
  4 +# --
  5 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  6 +# the enclosed file COPYING for license information (AGPL). If you
  7 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  8 +# --
  9 +<div style="margin: 5px; padding: 10px; width: 80%;">
  10 + <h1>$Text{"Your ticket has been registered with the number: "}$Data{"TicketNumber"}</h1>
  11 + </div>
  12 +<!-- dtl:js_on_document_complete -->
  13 +<!-- dtl:js_on_document_complete -->
0 14 \ No newline at end of file
... ...
Kernel/System/ServiceForm.pm 0 → 100644
  1 +++ a/Kernel/System/ServiceForm.pm
... ... @@ -0,0 +1,109 @@
  1 +# --
  2 +# Kernel/System/ServiceForm.pm - core module
  3 +# Copyright (C) (2013) (Rodrigo Goncalves) (rodrigo.g@ufsc.br)
  4 +# --
  5 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  6 +# the enclosed file COPYING for license information (AGPL). If you
  7 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  8 +# --
  9 +package Kernel::System::ServiceForm;
  10 +
  11 +use strict;
  12 +use warnings;
  13 +use utf8;
  14 +use Kernel::System::Service;
  15 +use Kernel::System::Type;
  16 +use Kernel::System::YAML;
  17 +use Data::Dumper;
  18 +use Kernel::System::DynamicField;
  19 +
  20 +sub new {
  21 + my ( $Type, %Param ) = @_;
  22 +
  23 + # allocate new hash for object
  24 + my $Self = {%Param};
  25 + bless( $Self, $Type );
  26 +
  27 + # check needed objects
  28 + for (
  29 + qw(DBObject LayoutObject LogObject QueueObject ConfigObject)
  30 + )
  31 + {
  32 + if ( !$Self->{$_} ) {
  33 + $Self->{LayoutObject}->FatalError( Message => "Got no $_!" );
  34 + }
  35 + }
  36 +
  37 + # required objects
  38 +
  39 + return $Self;
  40 +}
  41 +
  42 +=head
  43 +
  44 +Returns a service form
  45 +
  46 +=cut
  47 +
  48 +sub GetServiceForm {
  49 +
  50 + my ( $Self, %Param ) = @_;
  51 +
  52 + # get service form from db
  53 + $Self->{DBObject}->Prepare(
  54 + SQL => 'SELECT service_id, introduction, form, form_schema FROM service_form WHERE service_id = ?',
  55 + Bind => [ \$Param{ServiceID} ],
  56 + Limit => 1,
  57 + );
  58 +
  59 + # fetch the result
  60 + my %ServiceData;
  61 + while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
  62 + $ServiceData{ServiceID} = $Row[0];
  63 + $ServiceData{Introduction} = $Row[1];
  64 + $ServiceData{Form} = $Row[2];
  65 + $ServiceData{Schema} = $Row[3];
  66 + }
  67 +
  68 + return %ServiceData;
  69 +}
  70 +
  71 +=head
  72 +
  73 +Saves a service form.
  74 +
  75 +=cut
  76 +
  77 +sub SaveServiceForm {
  78 +
  79 + my ( $Self, %Param ) = @_;
  80 + for my $Argument (qw(ServiceID Introduction)) {
  81 + if ( !$Param{$Argument} ) {
  82 + $Self->{LogObject}->Log(
  83 + Priority => 'error',
  84 + Message => "Need $Argument!",
  85 + );
  86 + return;
  87 + }
  88 + }
  89 +
  90 + my %serviceForm = $Self->GetServiceForm(ServiceID => $Param{ServiceID});
  91 + my $update = ($serviceForm{ServiceID});
  92 +
  93 + if ($update) {
  94 + $Self->{DBObject}->Do(SQL => 'UPDATE service_form SET introduction=?,form=?,form_schema=? where service_id=?',
  95 + Bind => [
  96 + \$Param{Introduction}, \$Param{Form}, \$Param{Schema}, \$Param{ServiceID}
  97 + ]);
  98 + } else {
  99 + $Self->{DBObject}->Do(SQL => 'INSERT INTO service_form(service_id,introduction,form,form_schema) VALUES (?,?,?,?)',
  100 + Bind => [
  101 + \$Param{ServiceID}, \$Param{Introduction}, \$Param{Form}, \$Param{Schema}
  102 + ]);
  103 + }
  104 +
  105 + return 1;
  106 +
  107 +}
  108 +
  109 +1;
... ...
Kernel/System/TicketWizard.pm 0 → 100644
  1 +++ a/Kernel/System/TicketWizard.pm
... ... @@ -0,0 +1,183 @@
  1 +# --
  2 +# Kernel/System/TicketWizard.pm - core module
  3 +# Copyright (C) (2013) (Rodrigo Goncalves) (rodrigo.g@ufsc.br)
  4 +# --
  5 +# This software comes with ABSOLUTELY NO WARRANTY. For details, see
  6 +# the enclosed file COPYING for license information (AGPL). If you
  7 +# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
  8 +# --
  9 +package Kernel::System::TicketWizard;
  10 +
  11 +use strict;
  12 +use warnings;
  13 +use utf8;
  14 +use Kernel::System::Service;
  15 +use Kernel::System::Type;
  16 +use Kernel::System::YAML;
  17 +use Data::Dumper;
  18 +use Kernel::System::DynamicField;
  19 +
  20 +sub new {
  21 + my ( $Type, %Param ) = @_;
  22 +
  23 + # allocate new hash for object
  24 + my $Self = {%Param};
  25 + bless( $Self, $Type );
  26 +
  27 + # check needed objects
  28 + for (
  29 + qw(DBObject LayoutObject LogObject QueueObject ConfigObject)
  30 + )
  31 + {
  32 + if ( !$Self->{$_} ) {
  33 + $Self->{LayoutObject}->FatalError( Message => "Got no $_!" );
  34 + }
  35 + }
  36 +
  37 + # required objects
  38 + $Self->{YAMLObject} = Kernel::System::YAML->new(%Param);
  39 + $Self->{ServiceObject} = Kernel::System::Service->new(%Param);
  40 + $Self->{TypeObject} = Kernel::System::Type->new(%Param);
  41 + $Self->{TicketObject} = Kernel::System::Ticket->new(%Param);
  42 + $Self->{DynamicFieldObject} = Kernel::System::DynamicField->new(%Param);
  43 +
  44 + return $Self;
  45 +}
  46 +
  47 +=head
  48 +
  49 +Returns fields structure for new ticket form wizard
  50 +
  51 +=cut
  52 +
  53 +sub GetBasicFieldsOptions {
  54 + my ( $Self, %Param ) = @_;
  55 + return $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard")->{BasicForm};
  56 +}
  57 +
  58 +=head
  59 +
  60 +Returns fields schema for new ticket wizard
  61 +
  62 +=cut
  63 +
  64 +sub GetBasicFieldsSchema {
  65 + my ( $Self, %Param ) = @_;
  66 + return $Self->{ConfigObject}->Get("Ticket::Frontend::Customer::NewTicketWizard")->{BasicSchema};
  67 +}
  68 +
  69 +=head
  70 +
  71 +Replaces OTRS system field values (service and type)
  72 +
  73 +=cut
  74 +
  75 +sub ReplaceOTRSValues {
  76 + my ( $Self, %Param ) = @_;
  77 + my $schema = $Param{Schema};
  78 + my $options = $Param{Options};
  79 +
  80 + my ( $serviceNames, $serviceIDs ) = $Self->GetOTRSServicesData();
  81 + $schema =~ s/OTRS_service_values/$serviceIDs/g;
  82 + $options =~ s/OTRS_service_labels/$serviceNames/g;
  83 +
  84 + my ( $typeNames, $typeIDs ) = $Self->GetOTRSTypesData(UserID => $Param{UserID});
  85 + $schema =~ s/OTRS_type_values/$typeIDs/g;
  86 + $options =~ s/OTRS_type_labels/$typeNames/g;
  87 +
  88 + return ( $schema, $options );
  89 +}
  90 +
  91 +sub GetOTRSServicesData {
  92 + my ( $Self, %Param ) = @_;
  93 + my $services = $Self->{ServiceObject};
  94 +
  95 + my %serviceList = $services->ServiceList( Valid => 1, UserID => $Self->{ConfigObject}->Get('CustomerPanelUserID') );
  96 + my $serviceNames = "";
  97 + my $serviceIDs = "";
  98 +
  99 + ###print STDERR "\n\n\n Servicos: " . Dumper(\%serviceList) . "\n\n\n";
  100 +
  101 + foreach ( sort { ( $serviceList{$a} cmp $serviceList{$b} ) } keys %serviceList ) {
  102 + $serviceNames .= "\"$serviceList{$_}\",";
  103 + $serviceIDs .= "$_,";
  104 + }
  105 + $serviceNames = substr($serviceNames, 0, -1);
  106 + $serviceIDs = substr($serviceIDs, 0, -1);
  107 + return ( $serviceNames, $serviceIDs );
  108 +}
  109 +
  110 +sub GetOTRSTypesData {
  111 + my ( $Self, %Param ) = @_;
  112 + my $ticketObject = $Self->{TicketObject};
  113 +
  114 + my %typeList = $ticketObject->TicketTypeList( UserID => $Param{UserID} );
  115 + my $typeNames = "";
  116 + my $typeIDs = "";
  117 +
  118 + foreach ( sort { ( $typeList{$a} cmp $typeList{$b} ) } keys %typeList ) {
  119 + $typeNames .= "\"$typeList{$_}\",";
  120 + $typeIDs .= "$_,";
  121 + }
  122 +
  123 + $typeNames = substr($typeNames, 0, -1);
  124 + $typeIDs = substr($typeIDs, 0, -1);
  125 +
  126 + return ( $typeNames, $typeIDs );
  127 +}
  128 +
  129 +sub ReplaceOTRSDynamicFields {
  130 + my ( $Self, %Param ) = @_;
  131 + my $schema = $Param{Schema};
  132 + my $options = $Param{Options};
  133 +
  134 + my $dfields = $Self->{DynamicFieldObject};
  135 + my @dfieldList = @{ $dfields->DynamicFieldListGet( Valid => 1 ) };
  136 +
  137 + foreach (@dfieldList) {
  138 + my $campo = $_;
  139 +
  140 + #Debug("campo", $campo);
  141 + my $name = $campo->{Name};
  142 + my $config = $campo->{Config};
  143 + my $type = $campo->{FieldType};
  144 + my $idFieldValues = "DF_" . $name . "_values";
  145 + my $idFieldLabels = "DF_" . $name . "_labels";
  146 + if ( $type eq "Dropdown" ) {
  147 + my ( $dfValues, $dfLabels ) = $Self->GetDynamicFieldValues( ConfigDF => $config );
  148 + $schema =~ s/$idFieldValues/$dfValues/g;
  149 + $options =~ s/$idFieldLabels/$dfLabels/g;
  150 + }
  151 + }
  152 +
  153 + #Debug("schema", $schema);
  154 + #Debug("options", $options);
  155 + return ( $schema, $options );
  156 +}
  157 +
  158 +sub Debug {
  159 + my ( $id, $value ) = @_;
  160 + ###print STDERR "\n\n $id =" . Dumper($value) . "\n";
  161 +}
  162 +
  163 +sub GetDynamicFieldValues {
  164 + my ( $Self, %Param ) = @_;
  165 + my $config = $Param{ConfigDF};
  166 + my $values = $config->{PossibleValues};
  167 +
  168 + my $dfValues = "";
  169 + my $dfLabels = "";
  170 +
  171 + foreach ( sort { ( $values->{$a} cmp $values->{$b} ) } keys %{$values} ) {
  172 + $dfValues .= "\"$_\",";
  173 + $dfLabels .= "\"$values->{$_}\",";
  174 + }
  175 +
  176 + $dfValues = substr($dfValues, 0, -1);
  177 + $dfLabels = substr($dfLabels, 0, -1);
  178 + Debug( "dfvalues", $dfValues );
  179 + return ( $dfValues, $dfLabels );
  180 +
  181 +}
  182 +
  183 +1;
... ...
NewTicketWizard.sopm 0 → 100755
  1 +++ a/NewTicketWizard.sopm
... ... @@ -0,0 +1,64 @@
  1 +<?xml version="1.0" encoding="utf-8" ?>
  2 +<otrs_package version="1.0">
  3 + <Name>NewTicketWizard</Name>
  4 + <Version>1.0.5</Version>
  5 + <Framework>3.x.x</Framework>
  6 + <Vendor>SeTIC</Vendor>
  7 + <URL>http://www.setic.ufsc.br</URL>
  8 + <License>Free</License>
  9 + <Description Lang="pt-br">Assistente de chamados
  10 +
  11 + Versão 1.0.0 - Inicial
  12 + Versão 1.0.1 - Ajusta listagem de servicos do Service forms, correcao no formulario de edicao de servico
  13 + Versão 1.0.2 - Ajuste na hierarquia de servicos
  14 + </Description>
  15 + <IntroInstall Type="post" Lang="pt-br" Title="Obrigado">Módulo instalado com sucesso!</IntroInstall>
  16 + <Description Lang="en">New Ticket Wizard</Description>
  17 + <IntroInstall Type="post" Lang="en" Title="Thank you">New Ticket Wizard module installed successfully!</IntroInstall>
  18 + <BuildDate>?</BuildDate>
  19 + <BuildHost>?</BuildHost>
  20 + <Filelist>
  21 + <File Permission="644" Location="Kernel/Config/Files/NewTicketWizard.xml"></File>
  22 + <File Permission="644" Location="Kernel/Language/pt_BR_NewTicketWizard.pm"></File>
  23 + <File Permission="644" Location="Kernel/Modules/NewTicketWizard.pm"></File>
  24 + <File Permission="644" Location="Kernel/Modules/NewTicketWizardServiceForm.pm"></File>
  25 +
  26 + <File Permission="644" Location="Kernel/Output/HTML/Standard/NewTicketWizard.dtl"></File>
  27 + <File Permission="644" Location="Kernel/Output/HTML/Standard/NewTicketWizardServiceForm.dtl"></File>
  28 + <File Permission="644" Location="Kernel/Output/HTML/Standard/NewTicketWizardServiceFormEdit.dtl"></File>
  29 + <File Permission="644" Location="Kernel/Output/HTML/Standard/NewTicketWizardTicketCreated.dtl"></File>
  30 +
  31 + <File Permission="644" Location="Kernel/System/ServiceForm.pm"></File>
  32 + <File Permission="644" Location="Kernel/System/TicketWizard.pm"></File>
  33 +
  34 + <File Permission="644" Location="var/httpd/htdocs/js/thirdparty/alpaca/alpaca-full.min.js"></File>
  35 + <File Permission="644" Location="var/httpd/htdocs/js/NewTicketWizard.js"></File>
  36 +
  37 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/images/alpaca-icons.png"></File>
  38 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/images/date.png"></File>
  39 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/images/down.png"></File>
  40 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/images/email.png"></File>
  41 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/images/left.png"></File>
  42 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/images/phone.png"></File>
  43 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/images/time.png"></File>
  44 +
  45 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-core.min.css"></File>
  46 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-extras.min.css"></File>
  47 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-jqueryui-newticketwizard.css"></File>
  48 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-jqueryui.min.css"></File>
  49 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-newticketwizard.css"></File>
  50 + <File Permission="644" Location="var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca.min.css"></File>
  51 +
  52 + </Filelist>
  53 + <DatabaseInstall>
  54 + <TableCreate Name="service_form">
  55 + <Column Name="service_id" Required="true" PrimaryKey="true" Type="int"/>
  56 + <Column Name="introduction" Required="true" Type="text"/>
  57 + <Column Name="form" Required="true" Type="text"/>
  58 + <Column Name="form_schema" Required="true" Type="text"/>
  59 + <ForeignKey ForeignTable="service">
  60 + <Reference Local="service_id" Foreign="id"/>
  61 + </ForeignKey>
  62 + </TableCreate>
  63 + </DatabaseInstall>
  64 +</otrs_package>
0 65 \ No newline at end of file
... ...
db_schema.sql 0 → 100644
  1 +++ a/db_schema.sql
... ... @@ -0,0 +1 @@
  1 +CREATE TABLE service_form(service_id int primary key, introduction text, form text, form_schema text);
0 2 \ No newline at end of file
... ...
var/httpd/htdocs/js/NewTicketWizard.js 0 → 100644
  1 +++ a/var/httpd/htdocs/js/NewTicketWizard.js
... ... @@ -0,0 +1,111 @@
  1 +/**
  2 + * Variables
  3 + */
  4 +
  5 +var formAlpaca;
  6 +
  7 +
  8 +/**
  9 + * Build the form options (layout)
  10 + * @param fields
  11 + * @param sendText
  12 + * @returns {___anonymous58_421}
  13 + */
  14 +function buildOptions(fields, sendText, action) {
  15 + return {
  16 + "renderForm": true,
  17 + "fields": fields,
  18 + "form": {
  19 + "attributes" : {
  20 + "action" : action,
  21 + "method" : "post",
  22 + "enctype": "multipart/form-data"
  23 + },
  24 + "buttons": {
  25 + "submit": {
  26 + "value" : sendText
  27 + }
  28 + },
  29 + "toggleSubmitValidState": false
  30 +
  31 + }
  32 + };
  33 +}
  34 +
  35 +/**
  36 + * Build the form schema
  37 + *
  38 + * @param schema
  39 + * @returns {___anonymous510_571}
  40 + */
  41 +function buildSchema(schema) {
  42 + return {
  43 + "type": "object",
  44 + "properties": schema
  45 + };
  46 +}
  47 +
  48 +var postRenderCallback = function(form) {
  49 + formOptions = form.options.fields;
  50 + formAlpaca = form;
  51 +
  52 + Object.keys(formOptions).forEach(function (key) {
  53 + var value = formOptions[key];
  54 +
  55 + // Extension to set control width
  56 + if (value["control_width"]) {
  57 + $("[name='" + key + "']").width(value["control_width"]);
  58 + }
  59 + });
  60 +
  61 + if (form) {
  62 + form.form.registerSubmitHandler(function(e, form) {
  63 + // validate the entire form (top control + all children)
  64 + form.validate(true);
  65 +
  66 + // draw the validation state (top control + all children)
  67 + form.renderValidationState(true);
  68 +
  69 + // now display something
  70 + if (form.isFormValid()) {
  71 + return true;
  72 + } else {
  73 + return false;
  74 + }
  75 + e.stopPropagation();
  76 + return false;
  77 + });
  78 + }
  79 +};
  80 +
  81 +function carregaForm(dataForm, sendText, action) {
  82 + var url = "/otrs/customer.pl?Action=NewTicketWizard;Subaction=GetFormJSON";
  83 +
  84 + if (!(typeof formAlpaca === 'undefined')) {
  85 + formAlpaca.destroy();
  86 + } else {
  87 + //$("#formTicket").find("select").val("");
  88 + }
  89 +
  90 + url += ";ServiceID=" + $("#ServiceID").val();
  91 +
  92 + $.getJSON(url, function(data) {
  93 + ////formOptions = data[1];
  94 + $("#serviceDescription").html(data[2]);
  95 + $("#serviceDescription").show();
  96 +
  97 + $("#formTicket").alpaca({
  98 + "data": dataForm,
  99 + "schema": buildSchema(data[0]),
  100 + "options": buildOptions(data[1], sendText, action),
  101 + "postRender": postRenderCallback,
  102 + "view": "VIEW_JQUERYUI_CREATE",
  103 + "ui": "jquery-ui"
  104 + });
  105 +
  106 + $("[name='service']").val($("#ServiceID").val());
  107 +
  108 + }).fail(function(jqXHR, textStatus, errorThrown) {
  109 + alert(textStatus);
  110 + });
  111 +}
... ...
var/httpd/htdocs/js/thirdparty/alpaca/alpaca-full.min.js 0 → 100644
  1 +++ a/var/httpd/htdocs/js/thirdparty/alpaca/alpaca-full.min.js
... ... @@ -0,0 +1,72 @@
  1 +/*!
  2 +Alpaca Version 1.1.1
  3 +
  4 +Copyright 2013 Gitana Software, Inc.
  5 +
  6 +Licensed under the Apache License, Version 2.0 (the "License");
  7 +you may not use this file except in compliance with the License.
  8 +
  9 +You may obtain a copy of the License at
  10 + http://www.apache.org/licenses/LICENSE-2.0
  11 +
  12 +Unless required by applicable law or agreed to in writing, software
  13 +distributed under the License is distributed on an "AS IS" BASIS,
  14 +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 +See the License for the specific language governing permissions and
  16 +limitations under the License.
  17 +
  18 +For more information, please contact Gitana Software, Inc. at this
  19 +address:
  20 +
  21 + info@gitanasoftware.com
  22 +*/
  23 +(function(a,c,b){c[a]=b()})("Base",this,function(){var a=function(){};a.extend=function(c,f){var g=a.prototype.extend;a._prototyping=true;var e=new this();g.call(e,c);e.base=function(){};delete a._prototyping;var d=e.constructor;var b=e.constructor=function(){if(!a._prototyping){if(this._constructing||this.constructor===b){this._constructing=true;d.apply(this,arguments);delete this._constructing}else{if(arguments[0]!==null){return(arguments[0].extend||g).call(arguments[0],e)}}}};b.ancestor=this;b.extend=this.extend;b.forEach=this.forEach;b.implement=this.implement;b.prototype=e;b.toString=this.toString;b.valueOf=function(h){return(h==="object")?b:d.valueOf()};g.call(b,f);if(typeof b.init==="function"){b.init()}return b};a.prototype={extend:function(c,l){if(arguments.length>1){var g=this[c];if(g&&(typeof l==="function")&&(!g.valueOf||g.valueOf()!==l.valueOf())&&/\bbase\b/.test(l)){var b=l.valueOf();l=function(){var i=this.base||a.prototype.base;this.base=g;var h=b.apply(this,arguments);this.base=i;return h};l.valueOf=function(h){return(h==="object")?l:b};l.toString=a.toString}this[c]=l}else{if(c){var k=a.prototype.extend;if(!a._prototyping&&typeof this!=="function"){k=this.extend||k}var f={toSource:null};var j=["constructor","toString","valueOf"];for(var d=a._prototyping?0:1;d<j.length;d++){var e=j[d];if(c[e]!==f[e]){k.call(this,e,c[e])}}for(var m in c){if(!f[m]){k.call(this,m,c[m])}}}}return this}};a=a.extend({constructor:function(){this.extend(arguments[0])}},{ancestor:Object,version:"1.1",forEach:function(b,e,d){for(var c in b){if(this.prototype[c]===undefined){e.call(d,b[c],c,b)}}},implement:function(){for(var b=0;b<arguments.length;b++){if(typeof arguments[b]==="function"){arguments[b](this.prototype)}else{this.prototype.extend(arguments[b])}}return this},toString:function(){return String(this.valueOf())}});return a});if(typeof JSON!=="object"){JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==="string"){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());
  24 +/*!
  25 + * JSONSchema Validator - Validates JavaScript objects using JSON Schemas
  26 + * (http://www.json.com/json-schema-proposal/)
  27 + *
  28 + * Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com)
  29 + * Licensed under the MIT (MIT-LICENSE.txt) license.
  30 + To use the validator call the validate function with an instance object and an optional schema object.
  31 + If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
  32 + that schema will be used to validate and the schema parameter is not necessary (if both exist,
  33 + both validations will occur).
  34 + The validate method will return an array of validation errors. If there are no errors, then an
  35 + empty list will be returned. A validation error will have two properties:
  36 + "property" which indicates which property had the error
  37 + "message" which indicates what the error was
  38 + */
  39 +(function(a){Validator={validate:function(b,c){return Validator._validate(b,c,{changing:false})},checkPropertyChange:function(d,b,c){return Validator._validate(d,b,{changing:c||"property"})},_validate:function(c,g,d){if(!d){d={}}var b=d.changing;var h=[];function f(r,n,v,p){var m;v+=v?typeof p=="number"?"["+p+"]":typeof p=="undefined"?"":"."+p:p;function w(i){h.push({property:v,message:i})}if((typeof n!="object"||n instanceof Array)&&(v||typeof n!="function")&&!(n&&n.type)){if(typeof n=="function"){if(!(r instanceof n)){w("is not an instance of the class/constructor "+n.name)}}else{if(n){w("Invalid schema/property definition "+n)}}return null}if(b&&n.readonly){w("is a readonly field, it can not be changed")}if(n["extends"]){f(r,n["extends"],v,p)}function k(z,A){if(z){if(typeof z=="string"&&z!="any"&&(z=="null"?A!==null:typeof A!=z)&&!(A instanceof Array&&z=="array")&&!(A instanceof Date&&z=="date")&&!(z=="integer"&&A%1===0)){return[{property:v,message:(typeof A)+" value found, but a "+z+" is required"}]}if(z instanceof Array){var y=[];for(var x=0;x<z.length;x++){if(!(y=k(z[x],A)).length){break}}if(y.length){return y}}else{if(typeof z=="object"){var i=h;h=[];f(A,z,v);var l=h;h=i;return l}}}return[]}if(r===undefined){if(n.required){w("is missing and it is required")}}else{h=h.concat(k(n.type,r));if(n.disallow&&!k(n.disallow,r).length){w(" disallowed value was matched")}if(r!==null){if(r instanceof Array){if(n.items){var s=n.items instanceof Array;var u=n.items;for(p=0,m=r.length;p<m;p+=1){if(s){u=n.items[p]}if(d.coerce){r[p]=d.coerce(r[p],u)}h.concat(f(r[p],u,v,p))}}if(n.minItems&&r.length<n.minItems){w("There must be a minimum of "+n.minItems+" in the array")}if(n.maxItems&&r.length>n.maxItems){w("There must be a maximum of "+n.maxItems+" in the array")}}else{if(n.properties||n.additionalProperties){h.concat(e(r,n.properties,v,n.additionalProperties))}}if(n.pattern&&typeof r=="string"&&!r.match(n.pattern)){w("does not match the regex pattern "+n.pattern)}if(n.maxLength&&typeof r=="string"&&r.length>n.maxLength){w("may only be "+n.maxLength+" characters long")}if(n.minLength&&typeof r=="string"&&r.length<n.minLength){w("must be at least "+n.minLength+" characters long")}if(typeof n.minimum!==undefined&&typeof r==typeof n.minimum&&n.minimum>r){w("must have a minimum value of "+n.minimum)}if(typeof n.maximum!==undefined&&typeof r==typeof n.maximum&&n.maximum<r){w("must have a maximum value of "+n.maximum)}if(n["enum"]){var q=n["enum"];m=q.length;var t;for(var o=0;o<m;o++){if(q[o]===r){t=1;break}}if(!t){w("does not have a value in the enumeration "+q.join(", "))}}if(typeof n.maxDecimal=="number"&&(r.toString().match(new RegExp("\\.[0-9]{"+(n.maxDecimal+1)+",}")))){w("may only have "+n.maxDecimal+" digits of decimal places")}}}return null}function e(j,k,p,o){if(typeof k=="object"){if(typeof j!="object"||j instanceof Array){h.push({property:p,message:"an object is required"})}for(var l in k){if(k.hasOwnProperty(l)){var n=j[l];if(n===undefined&&d.existingOnly){continue}var q=k[l];if(n===undefined&&q["default"]){n=j[l]=q["default"]}if(d.coerce&&l in j){n=j[l]=d.coerce(n,q)}f(n,q,p,l)}}}for(l in j){if(j.hasOwnProperty(l)&&!(l.charAt(0)=="_"&&l.charAt(1)=="_")&&k&&!k[l]&&o===false){if(d.filter){delete j[l];continue}else{h.push({property:p,message:(typeof n)+"The property "+l+" is not defined in the schema and the schema does not allow additional properties"})}}var m=k&&k[l]&&k[l].requires;if(m&&!(m in j)){h.push({property:p,message:"the presence of the property "+l+" requires that "+m+" also be present"})}n=j[l];if(o&&(!(k&&typeof k=="object")||!(l in k))){if(d.coerce){n=j[l]=d.coerce(n,o)}f(n,o,p,l)}if(!b&&n&&n.$schema){h=h.concat(f(n,n.$schema,p,l))}}return h}if(g){f(c,g,"",b||"")}if(!b&&c&&c.$schema){f(c,c.$schema,"","")}return{valid:!h.length,errors:h}},mustBeValid:function(b){if(!b.valid){throw new TypeError(b.errors.map(function(c){return"for property "+c.property+": "+c.message}).join(", \n"))}}};String.type="string";Boolean.type="boolean";Number.type="number";Integer={type:"integer"};Object.type="object";Array.type="array";Date.type="date";a.validator=window.Validator=Validator})(jQuery);
  40 +/*!
  41 + * jQuery Templates Plugin 1.0.0pre
  42 + * http://github.com/jquery/jquery-tmpl
  43 + * Requires jQuery 1.4.2
  44 + *
  45 + * Copyright 2011, Software Freedom Conservancy, Inc.
  46 + * Dual licensed under the MIT or GPL Version 2 licenses.
  47 + * http://jquery.org/license
  48 + */
  49 +(function(i,f){var t=i.fn.domManip,h="_tmplitem",u=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,p={},e={},y,x={key:0,data:{}},w=0,q=0,g=[];function k(B,A,D,E){var C={data:E||(E===0||E===false)?E:(A?A.data:{}),_wrap:A?A._wrap:null,tmpl:null,parent:A||null,nodes:[],calls:c,nest:b,wrap:n,html:r,update:z};if(B){i.extend(C,B,{nodes:[],parent:A})}if(D){C.tmpl=D;C._ctnt=C._ctnt||C.tmpl(i,C);C.key=++w;(g.length?e:p)[w]=C}return C}i.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(A,B){i.fn[A]=function(C){var F=[],I=i(C),E,G,D,J,H=this.length===1&&this[0].parentNode;y=p||{};if(H&&H.nodeType===11&&H.childNodes.length===1&&I.length===1){I[B](this[0]);F=this}else{for(G=0,D=I.length;G<D;G++){q=G;E=(G>0?this.clone(true):this).get();i(I[G])[B](E);F=F.concat(E)}q=0;F=this.pushStack(F,A,I.selector)}J=y;y=null;i.tmpl.complete(J);return F}});i.fn.extend({tmpl:function(C,B,A){return i.tmpl(this[0],C,B,A)},tmplItem:function(){return i.tmplItem(this[0])},template:function(A){return i.template(A,this[0])},domManip:function(E,H,G,I){if(E[0]&&i.isArray(E[0])){var B=i.makeArray(arguments),A=E[0],F=A.length,C=0,D;while(C<F&&!(D=i.data(A[C++],"tmplItem"))){}if(D&&q){B[2]=function(J){i.tmpl.afterManip(this,J,G)}}t.apply(this,B)}else{t.apply(this,arguments)}q=0;if(!y){i.tmpl.complete(p)}return this}});i.extend({tmpl:function(C,F,E,B){var D,A=!B;if(A){B=x;C=i.template[C]||i.template(null,C);e={}}else{if(!C){C=B.tmpl;p[B.key]=B;B.nodes=[];if(B.wrapped){s(B,B.wrapped)}return i(m(B,null,B.tmpl(i,B)))}}if(!C){return[]}if(typeof F==="function"){F=F.call(B||{})}if(E&&E.wrapped){s(E,E.wrapped)}D=i.isArray(F)?i.map(F,function(G){return G?k(E,B,C,G):null}):[k(E,B,C,F)];return A?i(m(B,null,D)):D},tmplItem:function(B){var A;if(B instanceof i){B=B[0]}while(B&&B.nodeType===1&&!(A=i.data(B,"tmplItem"))&&(B=B.parentNode)){}return A||x},template:function(B,A){if(A){if(typeof A==="string"){A=l(A)}else{if(A instanceof i){A=A[0]||{}}}if(A.nodeType){A=i.data(A,"tmpl")||i.data(A,"tmpl",l(A.innerHTML))}return typeof B==="string"?(i.template[B]=A):A}return B?(typeof B!=="string"?i.template(null,B):(i.template[B]||i.template(null,u.test(B)?B:i(B)))):null},encode:function(A){return(""+A).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});i.extend(i.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(A){p={}},afterManip:function v(C,A,D){var B=A.nodeType===11?i.makeArray(A.childNodes):A.nodeType===1?[A]:[];D.call(C,A);o(B);q++}});function m(A,E,C){var D,B=C?i.map(C,function(F){return(typeof F==="string")?(A.key?F.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+h+'="'+A.key+'" $2'):F):m(F,A,F._ctnt)}):A;if(E){return B}B=B.join("");B.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(G,H,F,I){D=i(F).get();o(D);if(H){D=a(H).concat(D)}if(I){D=D.concat(a(I))}});return D?D:a(B)}function a(B){var A=document.createElement("div");A.innerHTML=B;return i.makeArray(A.childNodes)}function l(A){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+i.trim(A).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(I,C,G,D,E,J,F){var L=i.tmpl.tag[G],B,H,K;if(!L){throw"Unknown template tag: "+G}B=L._default||[];if(J&&!/\w$/.test(E)){E+=J;J=""}if(E){E=j(E);F=F?(","+j(F)+")"):(J?")":"");H=J?(E.indexOf(".")>-1?E+j(J):("("+E+").call($item"+F)):E;K=J?H:"(typeof("+E+")==='function'?("+E+").call($item):("+E+"))"}else{K=H=B.$1||"null"}D=j(D);return"');"+L[C?"close":"open"].split("$notnull_1").join(E?"typeof("+E+")!=='undefined' && ("+E+")!=null":"true").split("$1a").join(K).split("$1").join(H).split("$2").join(D||B.$2||"")+"__.push('"})+"');}return __;")}function s(B,A){B._wrap=m(B,true,i.isArray(A)?A:[u.test(A)?A:i(A).html()]).join("")}function j(A){return A?A.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function d(A){var B=document.createElement("div");B.appendChild(A.cloneNode(true));return B.innerHTML}function o(G){var I="_"+q,B,A,E={},F,D,C;for(F=0,D=G.length;F<D;F++){if((B=G[F]).nodeType!==1){continue}A=B.getElementsByTagName("*");for(C=A.length-1;C>=0;C--){H(A[C])}H(B)}function H(O){var L,N=O,M,J,K;if((K=O.getAttribute(h))){while(N.parentNode&&(N=N.parentNode).nodeType===1&&!(L=N.getAttribute(h))){}if(L!==K){N=N.parentNode?(N.nodeType===11?0:(N.getAttribute(h)||0)):0;if(!(J=p[K])){J=e[K];J=k(J,p[N]||e[N]);J.key=++w;p[w]=J}if(q){P(K)}}O.removeAttribute(h)}else{if(q&&(J=i.data(O,"tmplItem"))){P(J.key);p[J.key]=J;N=i.data(O.parentNode,"tmplItem");N=N?N.key:0}}if(J){M=J;while(M&&M.key!=N){M.nodes.push(O);M=M.parent}delete J._ctnt;delete J._wrap;i.data(O,"tmplItem",J)}function P(Q){Q=Q+I;J=E[Q]=(E[Q]||k(J,p[J.parent.key+I]||J.parent))}}}function c(C,A,D,B){if(!C){return g.pop()}g.push({_:C,tmpl:A,item:this,data:D,options:B})}function b(A,C,B){return i.tmpl(i.template(A),C,B,this)}function n(C,A){var B=C.options||{};B.wrapped=A;return i.tmpl(i.template(C.tmpl),C.data,B,C.item)}function r(B,C){var A=this._wrap;return i.map(i(i.isArray(A)?A.join(""):A).filter(B||"*"),function(D){return C?D.innerText||D.textContent:D.outerHTML||d(D)})}function z(){var A=this.nodes;i.tmpl(null,null,null,this).insertBefore(A[0]);i(A).remove()}})(jQuery);function hoozit(a){if(a.constructor===String){return"string"}else{if(a.constructor===Boolean){return"boolean"}else{if(a.constructor===Number){if(isNaN(a)){return"nan"}else{return"number"}}else{if(typeof a==="undefined"){return"undefined"}else{if(a===null){return"null"}else{if(a instanceof Array){return"array"}else{if(a instanceof Date){return"date"}else{if(a instanceof RegExp){return"regexp"}else{if(typeof a==="object"){return"object"}else{if(a instanceof Function){return"function"}else{return undefined}}}}}}}}}}}function bindCallbacks(c,b,a){var d=hoozit(c);if(d){if(hoozit(b[d])==="function"){return b[d].apply(b,a)}else{return b[d]}}}var equiv=function(){var b;var c=[];var a=function(){function d(e,f){if(e instanceof f.constructor||f instanceof e.constructor){return f==e}else{return f===e}}return{string:d,"boolean":d,number:d,"null":d,"undefined":d,nan:function(e){return isNaN(e)},date:function(e,f){return hoozit(e)==="date"&&f.valueOf()===e.valueOf()},regexp:function(e,f){return hoozit(e)==="regexp"&&f.source===e.source&&f.global===e.global&&f.ignoreCase===e.ignoreCase&&f.multiline===e.multiline},"function":function(){var e=c[c.length-1];return e!==Object&&typeof e!=="undefined"},array:function(f,g){var h;var e;if(!(hoozit(f)==="array")){return false}e=g.length;if(e!==f.length){return false}for(h=0;h<e;h++){if(!b(g[h],f[h])){return false}}return true},object:function(f,g){var j;var e=true;var h=[],k=[];if(g.constructor!==f.constructor){return false}c.push(g.constructor);for(j in g){h.push(j);if(!b(g[j],f[j])){e=false}}c.pop();for(j in f){k.push(j)}return e&&b(h.sort(),k.sort())}}}();b=function(){var d=Array.prototype.slice.apply(arguments);if(d.length<2){return true}return(function(f,e){if(f===e){return true}else{if(f===null||e===null||typeof f==="undefined"||typeof e==="undefined"||hoozit(f)!==hoozit(e)){return false}else{return bindCallbacks(f,a,[e,f])}}})(d[0],d[1])&&arguments.callee.apply(this,d.splice(1,d.length-1))};return b}();(function(e){function g(){var i=document.createElement("input"),h="onpaste";i.setAttribute(h,"");return(typeof i[h]==="function")?"paste":"input"}var b=g()+".mask",d=navigator.userAgent,c=/iphone/i.test(d),a=/android/i.test(d),f;e.mask={definitions:{"9":"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},dataName:"rawMaskFn",placeholder:"_"};e.fn.extend({caret:function(j,h){var i;if(this.length===0||this.is(":hidden")){return}if(typeof j=="number"){h=(typeof h==="number")?h:j;return this.each(function(){if(this.setSelectionRange){this.setSelectionRange(j,h)}else{if(this.createTextRange){i=this.createTextRange();i.collapse(true);i.moveEnd("character",h);i.moveStart("character",j);i.select()}}})}else{if(this[0].setSelectionRange){j=this[0].selectionStart;h=this[0].selectionEnd}else{if(document.selection&&document.selection.createRange){i=document.selection.createRange();j=0-i.duplicate().moveStart("character",-100000);h=j+i.text.length}}return{begin:j,end:h}}},unmask:function(){return this.trigger("unmask")},mask:function(j,n){var k,i,m,o,l,h;if(!j&&this.length>0){k=e(this[0]);return k.data(e.mask.dataName)()}n=e.extend({placeholder:e.mask.placeholder,completed:null},n);i=e.mask.definitions;m=[];o=h=j.length;l=null;e.each(j.split(""),function(p,q){if(q=="?"){h--;o=p}else{if(i[q]){m.push(new RegExp(i[q]));if(l===null){l=m.length-1}}else{m.push(null)}}});return this.trigger("unmask").each(function(){var y=e(this),t=e.map(j.split(""),function(C,B){if(C!="?"){return i[C]?n.placeholder:C}}),A=y.val();function x(B){while(++B<h&&!m[B]){}return B}function u(B){while(--B>=0&&!m[B]){}return B}function s(E,B){var D,C;if(E<0){return}for(D=E,C=x(B);D<h;D++){if(m[D]){if(C<h&&m[D].test(t[C])){t[D]=t[C];t[C]=n.placeholder}else{break}C=x(C)}}w();y.caret(Math.max(l,E))}function p(F){var D,E,B,C;for(D=F,E=n.placeholder;D<h;D++){if(m[D]){B=x(D);C=t[D];t[D]=E;if(B<h&&m[B].test(C)){E=C}else{break}}}}function v(E){var C=E.which,F,D,B;if(C===8||C===46||(c&&C===127)){F=y.caret();D=F.begin;B=F.end;if(B-D===0){D=C!==46?u(D):(B=x(D-1));B=C===46?x(B):B}q(D,B);s(D,B-1);E.preventDefault()}else{if(C==27){y.val(A);y.caret(0,r());E.preventDefault()}}}function z(E){var B=E.which,G=y.caret(),D,F,C;if(E.ctrlKey||E.altKey||E.metaKey||B<32){return}else{if(B){if(G.end-G.begin!==0){q(G.begin,G.end);s(G.begin,G.end-1)}D=x(G.begin-1);if(D<h){F=String.fromCharCode(B);if(m[D].test(F)){p(D);t[D]=F;w();C=x(D);if(a){setTimeout(e.proxy(e.fn.caret,y,C),0)}else{y.caret(C)}if(n.completed&&C>=h){n.completed.call(y)}}}E.preventDefault()}}}function q(D,B){var C;for(C=D;C<B&&C<h;C++){if(m[C]){t[C]=n.placeholder}}}function w(){y.val(t.join(""))}function r(C){var F=y.val(),E=-1,B,D;for(B=0,pos=0;B<h;B++){if(m[B]){t[B]=n.placeholder;while(pos++<F.length){D=F.charAt(pos-1);if(m[B].test(D)){t[B]=D;E=B;break}}if(pos>F.length){break}}else{if(t[B]===F.charAt(pos)&&B!==o){pos++;E=B}}}if(C){w()}else{if(E+1<o){y.val("");q(0,h)}else{w();y.val(y.val().substring(0,E+1))}}return(o?B:l)}y.data(e.mask.dataName,function(){return e.map(t,function(C,B){return m[B]&&C!=n.placeholder?C:null}).join("")});if(!y.attr("readonly")){y.one("unmask",function(){y.unbind(".mask").removeData(e.mask.dataName)}).bind("focus.mask",function(){clearTimeout(f);var C,B;A=y.val();if(A===""){q(0,h);w();C=0}else{C=r()}f=setTimeout(function(){w();if(C==j.length){y.caret(0,C)}else{y.caret(C)}},10)}).bind("blur.mask",function(){r();if(y.val()!=A){y.change()}}).bind("keydown.mask",v).bind("keypress.mask",z).bind(b,function(){setTimeout(function(){var B=r(true);y.caret(B);if(n.completed&&B==y.val().length){n.completed.call(y)}},0)})}r()})}})})(jQuery);(function(b){var a;a=function(){var g=a.makeArray(arguments);if(g.length===0){return a.throwDefaultError("You must supply at least one argument which is the element against which to apply the Alpaca generated form")}var e=g[0];var E=null;var s=null;var l=null;var o=null;var m=null;var h=null;var n=null;var c=null;var k=false;var D=false;var p={};var z=null;var v=null;var q=null;var f=null;if(g.length==1){var t=b(e).find(":first");var d=null;for(var x=0;x<t.length;x++){var B=t[x];var w=b(B).attr("alpaca-field-id");if(w){var u=a.fieldInstances[w];if(u){d=u}}}if(d!==null){return d}else{var j=b(e).html();b(e).html("");E=j}}if(g.length>=2){if(a.isObject(g[1])){E=g[1].data;s=g[1].schema;l=g[1].options;o=g[1].view;m=g[1].render;h=g[1].postRender;n=g[1].error;c=g[1].connector;z=g[1].dataSource;v=g[1].schemaSource;q=g[1].optionsSource;f=g[1].viewSource;if(g[1].ui){p.ui=g[1].ui}if(g[1].type){p.type=g[1].type}if(!a.isEmpty(g[1].notTopLevel)){k=g[1].notTopLevel}if(!a.isEmpty(g[1].isDynamicCreation)){D=g[1].isDynamicCreation}}else{E=g[1];if(a.isFunction(E)){E=E()}}}if(a.isEmpty(n)){n=a.defaultErrorCallback}if(a.isEmpty(c)){var y=a.getConnectorClass("default");c=new y("default")}if(e){if(a.isString(e)){e=b("#"+e)}}var A=c;if(k){var C=a.getConnectorClass("default");A=new C("default")}if(!l){l={}}if(a.isUndefined(l.focus)){l.focus=false}var r=function(i){if(l&&l.focus){if(l.focus===true){if(i.children&&i.children.length>0){if(i.children[0].field&&i.children[0].field[0]){b(i.children[0]).focus()}}}else{var F=i.getControlByPath(l.focus);if(F&&F.field){b(F).focus()}}}if(h){h(i)}};A.loadAll({data:E,schema:s,options:l,view:o,dataSource:z,schemaSource:v,optionsSource:q,viewSource:f},function(i,F,G,H){i=i?i:E;G=G?G:s;F=F?F:l;H=H?H:o;if(a.isEmpty(i)){if(a.isEmpty(G)&&(a.isEmpty(F)||a.isEmpty(F.type))){i="";if(a.isEmpty(F)){F="text"}else{if(l&&a.isObject(l)){F.type="text"}}}}return a.init(e,i,F,G,H,p,m,r,c,n,D)},function(i){n(i);return null});return b(e)};a.Fields={};a.Connectors={};b.extend(a,{VERSION:"0.1.0",makeArray:function(c){return Array.prototype.slice.call(c)},isFunction:function(c){return Object.prototype.toString.call(c)==="[object Function]"},isString:function(c){return(typeof c=="string")},isObject:function(c){if(c===true||c===false||a.isUndefined(c)||c===null){return false}return(typeof(c)==="object")&&(typeof(c.length)==="undefined")},isPlainObject:function(c){return b.isPlainObject(c)},isNumber:function(c){return(typeof c=="number")},isArray:function(c){if(c===true||c===false||a.isUndefined(c)||c===null){return false}return c.push&&c.slice},isBoolean:function(c){return(typeof c=="boolean")},isUndefined:function(c){return(typeof c=="undefined")},trim:function(d){var c=d;if(c&&a.isString(c)){c=c.replace(/^\s+|\s+$/g,"")}return c},safeDomParse:function(c){if(c&&a.isString(c)){c=a.trim(c);c=b(c)}return c},isEmpty:function(c){return a.isUndefined(c)||c===null},copyOf:function(d){var f=d;if(a.isArray(d)){f=[];for(var e=0;e<d.length;e++){f.push(a.copyOf(d[e]))}}else{if(a.isObject(d)){if(d instanceof Date){return new Date(d.getTime())}else{if(d instanceof RegExp){return new RegExp(d)}else{if(d.nodeType&&"cloneNode" in d){f=d.cloneNode(true)}else{if(b.isPlainObject(d)){f={};for(var c in d){if(d.hasOwnProperty(c)){f[c]=a.copyOf(d[c])}}}else{}}}}}}return f},cloneObject:function(c){return a.copyOf(c)},spliceIn:function(c,d,e){return c.substring(0,d)+e+c.substring(d,c.length)},compactArray:function(c){var f=[],d=c.length,e;for(e=0;e<d;e++){if(!lang.isNull(c[e])&&!lang.isUndefined(c[e])){f.push(c[e])}}return f},removeAccents:function(c){return c.replace(/[àáâãäå]/g,"a").replace(/[èéêë]/g,"e").replace(/[ìíîï]/g,"i").replace(/[òóôõö]/g,"o").replace(/[ùúûü]/g,"u").replace(/[ýÿ]/g,"y").replace(/[ñ]/g,"n").replace(/[ç]/g,"c").replace(/[œ]/g,"oe").replace(/[æ]/g,"ae")},indexOf:function(g,c,f){var d=c.length,e;if(!a.isFunction(f)){f=function(h,i){return h===i}}for(e=0;e<d;e++){if(f.call({},g,c[e])){return e}}return -1},log:function(c){if(typeof(console)!=="undefined"){console.log(c)}},uniqueIdCounter:0,defaultLocale:"en_US",setDefaultLocale:function(c){this.defaultLocale=c},defaultSchemaFieldMapping:{},registerDefaultSchemaFieldMapping:function(d,c){if(d&&c){this.defaultSchemaFieldMapping[d]=c}},defaultFormatFieldMapping:{},registerDefaultFormatFieldMapping:function(d,c){if(d&&c){this.defaultFormatFieldMapping[d]=c}},getSchemaType:function(c){if(a.isEmpty(c)){return"string"}if(a.isObject(c)){return"object"}if(a.isString(c)){return"string"}if(a.isNumber(c)){return"number"}if(a.isArray(c)){return"array"}if(a.isBoolean(c)){return"boolean"}if(typeof c=="object"){return"object"}},views:{},viewIdPrefix:"VIEW_",isValidViewId:function(c){return a.startsWith(c,this.viewIdPrefix)},generateViewId:function(){return this.viewIdPrefix+this.generateId()},registerView:function(d){var e=d.id;if(!e){return a.throwDefaultError("Cannot register view with missing view id: "+e)}var c=this.views[e];if(c){a.mergeObject(c,d)}else{this.views[e]=d}},defaultView:"VIEW_WEB_EDIT",setDefaultView:function(c){if(c&&this.views.hasOwnProperty(c)){this.defaultView=c}},getNormalizedView:function(c){return this.normalizedViews[c]},lookupNormalizedView:function(g,f){var d=null;for(var c in this.normalizedViews){var e=this.normalizedViews[c];if(e.ui==g&&e.type==f){d=c;break}}return d},registerTemplate:function(d,e,c){if(!c){c="VIEW_BASE"}if(!this.views[c]){this.views[c]={};this.views[c].id=c}if(!this.views[c].templates){this.views[c].templates={}}this.views[c].templates[d]=e},registerTemplates:function(e,c){for(var d in e){this.registerTemplate(d,e[d],c)}},registerMessage:function(d,e,c){if(!c){c="VIEW_BASE"}if(!this.views[c]){this.views[c]={};this.views[c].id=c}if(!this.views[c].messages){this.views[c].messages={}}this.views[c].messages[d]=e},registerMessages:function(e,c){for(var d in e){if(e.hasOwnProperty(d)){this.registerMessage(d,e[d],c)}}},fieldTemplatePostfix:{controlFieldMessageContainer:"-controlfield-message-container",controlFieldLabel:"-controlfield-label",controlFieldContainer:"-controlfield-container",controlFieldHelper:"-controlfield-helper",fieldSetLegend:"-fieldset-legend",fieldSetItemsContainer:"-fieldset-items-container",fieldSetHelper:"-fieldset-helper",fieldSetOuterEl:"-fieldset",formButtonsContainer:"-form-buttons-container",formFieldsContainer:"-form-fields-container"},fieldTemplate:function(e,c,d){var h=this;var k=e.data;var i=e.data.view;var g="";if(!c){c="controlFieldLabel"}var f=this.getTemplateDescriptor(i,c,k);if(d){var l=f.template.value;if(b(".alpaca"+this.fieldTemplatePostfix[c],a.safeDomParse(l)).length===0){if(this.fieldTemplatePostfix[c]){l=a.safeDomParse(l).addClass("alpaca"+this.fieldTemplatePostfix[c])}}g=a.safeDomParse(l).outerHTML(true)}else{var j=i.tmpl(f,e.data);if(j){if(this.fieldTemplatePostfix[c]){if(b(".alpaca"+this.fieldTemplatePostfix[c],j).length===0){j.addClass("alpaca"+this.fieldTemplatePostfix[c])}if(!j.attr("id")){j.attr("id",e.data.id+this.fieldTemplatePostfix[c])}}g=j.outerHTML(true)}else{g=""}}return g},defaultDateFormat:"mm/dd/yy",regexps:{email:/^[a-z0-9!\#\$%&'\*\-\/=\?\+\-\^_`\{\|\}~]+(?:\.[a-z0-9!\#\$%&'\*\-\/=\?\+\-\^_`\{\|\}~]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,6}$/i,url:/^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(\:[0-9]{1,5})?(([0-9]{1,5})?\/.*)?$/i,password:/^[0-9a-zA-Z\x20-\x7E]*$/,date:/^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.]\d\d$/,integer:/^([\+\-]?([1-9]\d*)|0)$/,number:/^([\+\-]?((([0-9]+(\.)?)|([0-9]*\.[0-9]+))([eE][+-]?[0-9]+)?))$/,phone:/^(\D?(\d{3})\D?\D?(\d{3})\D?(\d{4}))?$/,ipv4:/^(?:1\d?\d?|2(?:[0-4]\d?|[6789]|5[0-5]?)?|[3-9]\d?|0)(?:\.(?:1\d?\d?|2(?:[0-4]\d?|[6789]|5[0-5]?)?|[3-9]\d?|0)){3}$/,"zipcode-five":/^(\d{5})?$/,"zipcode-nine":/^(\d{5}(-\d{4})?)?$/},fieldInstances:{},fieldClassRegistry:{},registerFieldClass:function(c,d){this.fieldClassRegistry[c]=d},getFieldClass:function(c){return this.fieldClassRegistry[c]},getFieldClassType:function(d){for(var c in this.fieldClassRegistry){if(this.fieldClassRegistry.hasOwnProperty(c)){if(this.fieldClassRegistry[c]==d){return c}}}return null},connectorClassRegistry:{},registerConnectorClass:function(d,c){this.connectorClassRegistry[d]=c},getConnectorClass:function(c){return this.connectorClassRegistry[c]},replaceAll:function(e,c,d){return e.replace(new RegExp(c,"g"),d)},element:function(c,e,d,h){var g=b("<"+c+"/>");if(e){g.attr(e)}if(d){g.css(d)}if(h){for(var f in h){g.addClass(f)}}},elementFromTemplate:function(e,f){var d=e;if(f){for(var c in f){d=a.replaceAll(d,"${"+c+"}",f[c])}}return b(d)},generateId:function(){a.uniqueIdCounter++;return"alpaca"+a.uniqueIdCounter},later:function(l,e,n,h,i){l=l||0;e=e||{};var g=n,k=b.makeArray(h),j,c;if(typeof n==="string"){g=e[n]}if(!g){throw {name:"TypeError",message:"The function is undefined."}}j=function(){g.apply(e,k)};c=(i)?setInterval(j,l):setTimeout(j,l);return{id:c,interval:i,cancel:function(){if(this.interval){clearInterval(c)}else{clearTimeout(c)}}}},endsWith:function(d,c){return d.indexOf(c,d.length-c.length)!==-1},startsWith:function(d,c){return d.substr(0,c.length)===c},isUri:function(c){return a.isString(c)&&(a.startsWith(c,"http://")||a.startsWith(c,"https://")||a.startsWith(c,"/")||a.startsWith(c,"./")||a.startsWith(c,"../"))},traverseObject:function(c,g,f){if(a.isString(g)){g=g.split(".")}var e=null;var h=c;var d=null;do{d=g.shift();if(f&&d==f){d=g.shift()}if(!a.isEmpty(h[d])){h=h[d];if(g.length===0){e=h}}else{g=[]}}while(g.length>0);return e},each:function(f,e){if(a.isArray(f)){for(var d=0;d<f.length;d++){e.apply(f[d])}}else{if(a.isObject(f)){for(var c in f){e.apply(f[c])}}}},merge:function(g,f,d){if(!g){g={}}for(var c in f){var e=true;if(d){e=d(c)}if(e){if(a.isEmpty(f[c])){g[c]=f[c]}else{if(a.isObject(f[c])){if(!g[c]){g[c]={}}g[c]=a.merge(g[c],f[c])}else{g[c]=f[c]}}}}return g},mergeObject:function(d,c){if(!d){d={}}if(!c){c={}}this.mergeObject2(c,d);return d},mergeObject2:function(h,i){var d=a.isArray;var c=a.isObject;var f=a.isUndefined;var e=a.copyOf;var g=function(j,k){if(d(j)){if(d(k)){b.each(j,function(l){k.push(e(j[l]))})}else{}}else{if(c(j)){if(c(k)){b.each(j,function(l){if(f(k[l])){k[l]=e(j[l])}else{k[l]=g(j[l],k[l])}})}else{}}else{k=e(j)}}return k};g(h,i);return i},substituteTokens:function(h,d){if(!a.isEmpty(h)){for(var g=0;g<d.length;g++){var f="{"+g+"}";var c=h.indexOf(f);if(c>-1){var e=h.substring(0,c)+d[g]+h.substring(c+3);h=e}}}return h},compareObject:function(d,c){return equiv(d,c)},compareArrayContent:function(d,c){var e=d&&c&&(d.length==c.length);if(e){b.each(d,function(g,f){if(!e){return false}if(b.inArray(f,c)==-1){e=false}else{e=true}})}return e},isValEmpty:function(d){var c=false;if(a.isEmpty(d)){c=true}else{if(a.isString(d)&&d===""){c=true}if(a.isObject(d)&&b.isEmptyObject(d)){c=true}if(a.isArray(d)&&d.length===0){c=true}if(a.isNumber(d)&&isNaN(d)){c=true}}return c},init:function(c,g,p,f,l,d,n,j,e,i,k){var o=this;if(a.isObject(l)){var m=l.id;if(!m){l.id=this.generateViewId()}var h=l.parent;if(!h){l.parent="VIEW_WEB_EDIT"}this.registerView(l);l=l.id}this.compile(function(r){if(r.errors&&r.errors.length>0){for(var t=0;t<r.errors.length;t++){var q=r.errors[t].viewId;var s=r.errors[t].templateId;var u=r.errors[t].err;a.logError("The template: "+s+" for view: "+q+" failed to compile");a.logError(JSON.stringify(u))}return a.throwErrorWithCallback("View compilation failed, cannot initialize Alpaca. Please check the error logs.",i)}o._init(c,g,p,f,l,d,n,j,e,i,k)},i)},_init:function(e,t,g,q,m,n,i,f,c,j,s){var l=null;var p=null;var r=null;if(b.mobile){l="mobile";if(t){p="edit";r="VIEW_MOBILE_EDIT"}else{p="create";r="VIEW_MOBILE_CREATE"}}var k=(typeof b().modal=="function");if(k){l="bootstrap";if(t){p="edit";r="VIEW_BOOTSTRAP_EDIT"}else{p="create";r="VIEW_BOOTSTRAP_CREATE"}}if(!m){var o=n.ui;var h=n.type;if(!o){if(!l){l=a.defaultUI}if(l){o=l}}if(o){if(!h){h=p?p:"edit"}a.logDebug("No view provided but found request for UI: "+o+" and type: "+h);m=this.lookupNormalizedView(o,h);if(m){a.logDebug("Found view: "+m)}else{a.logDebug("No view found for UI: "+o+" and type: "+h)}}}if(!m){a.logDebug("A view was not specified.");if(r){a.logDebug("Falling back to detected view: "+r);m=r}else{a.logDebug("Falling back to default view: "+this.defaultView);m=this.defaultView}}if(a.isString(m)){if(!this.normalizedViews[m]){return a.throwErrorWithCallback("The desired view: "+m+" could not be loaded. Please make sure it is loaded and not misspelled.",j)}}var d=a.createFieldInstance(e,t,g,q,m,c,j);if(d){d.isDynamicCreation=s;a.fieldInstances[d.getId()]=d;d.allFieldInstances=function(){return a.fieldInstances};if(a.isEmpty(i)){i=d.view.render}if(a.isEmpty(f)){f=d.view.postRender}if(!a.isEmpty(i)){i(d,f)}else{d.render(f)}d.callback=i;d.renderedCallback=f}return d},createFieldInstance:function(c,f,k,e,j,d,g){if(a.isValEmpty(k)){k={}}if(a.isValEmpty(e)){e={}}if(k&&a.isString(k)){var h=k;k={};k.type=h}if(!k.type){if(!e.type){e.type=a.getSchemaType(f)}if(e&&e["enum"]){if(e["enum"].length>3){k.type="select"}else{k.type="radio"}}else{k.type=a.defaultSchemaFieldMapping[e.type]}if(e.format&&a.defaultFormatFieldMapping[e.format]){k.type=a.defaultFormatFieldMapping[e.format]}}var i=a.getFieldClass(k.type);if(!i){g({message:"Unable to find field class for type: "+k.type,reason:"FIELD_INSTANTIATION_ERROR"});return null}return new i(c,f,k,e,j,d,g)},parseJSON:function(c){if(!c){return null}return b.parseJSON(c)},compile:function(d,g){var k=this;var f={errors:[],count:0,successCount:0};var i=function(l){if(f.errors.length===0){for(var m in l){k.normalizedViews[m]=l[m]}}d(f)};var h=function(n,p,m,o,q,r){var l=m.id;f.count++;if(p){f.errors.push({view:l,template:o,err:p})}else{f.successCount++;m.compiledTemplates[o]=q}if(f.count==r){i(n)}};var c=function(v,r,t,u,m){var s=r.id;var p=null;if(a.isObject(u)){p=u.type;u=u.template}if(!p){p="text/x-jquery-tmpl"}var q=a.TemplateEngineRegistry.find(p);if(!q){a.logError("Cannot find template engine for type: "+p);var l=new Error("Cannot find template engine for type: "+p);h(v,l,r,t,n,m)}var n=s+"_"+t;if(q.isCached(n)){h(v,null,r,t,n,m)}else{var o=r.compiledTemplates["view-"+u];if(o){u=a.TemplateCache[o]}q.compile(n,u,function(w,x){h(v,w,r,t,n,m)})}};var j=function(s){var m=[];for(var q in s){var p=s[q];p.compiledTemplates={};if(p.templates){for(var l in p.templates){var r=p.templates[l];m.push(function(v,u,x,w){return function(y){c(v,u,x,w,y)}}(s,p,"view-"+l,r))}}if(p.fields){for(var t in p.fields){if(p.fields[t].templates){for(var l in p.fields[t].templates){var r=p.fields[t].templates[l];m.push(function(v,u,x,w){return function(y){c(v,u,x,w,y)}}(s,p,"field-"+t+"-"+l,r))}}}}if(p.layout&&p.layout.template){var r=p.layout.template;m.push(function(v,u,x,w){return function(y){c(v,u,x,w,y)}}(s,p,"layoutTemplate",r))}if(p.globalTemplate){var r=p.globalTemplate;m.push(function(v,u,x,w){return function(y){c(v,u,x,w,y)}}(s,p,"globalTemplate",r))}}var n=m.length;for(var o=0;o<m.length;o++){m[o](n)}};var e=function(){var m={};var o=0;if(!a.normalizedViews){a.normalizedViews={}}k.normalizedViews=a.normalizedViews;for(var l in k.views){if(!a.normalizedViews[l]){var n=new a.NormalizedView(l);if(n.normalize()){m[l]=n;o++}else{return a.throwErrorWithCallback("View normalization failed, cannot initialize Alpaca. Please check the error logs.",g)}}}if(o>0){j(m)}else{i(m)}};e()},getTemplateDescriptor:function(i,d,j){var c={};var m;var e;if(i.templates&&i.templates[d]){m=i.templates[d];e="view"}if(j&&j.path){var n=j.path;if(i&&i.fields&&i.fields[n]&&i.fields[n].templates&&i.fields[n].templates[d]){m=i.fields[n].templates[d];e="field"}}if(d=="globalTemplate"){m="globalTemplate";e="global"}if(d=="layoutTemplate"){m="layoutTemplate";e="layout"}c.template={};c.template.id=d;c.template.type=e;c.template.value=m;var g=null;var l=m;if(a.isObject(l)){g=l.type;l=l.template}if(!g){g="text/x-jquery-tmpl"}var h=a.TemplateEngineRegistry.find(g);if(!h){return a.throwDefaultError("Cannot find template engine for type: "+g)}c.engine={};c.engine.type=g;c.engine.id=h.id;var k=null;if(e=="view"){k="view-"+d}else{if(e=="field"){k="field-"+j.path+"-"+d}else{if(e=="layout"){k="layoutTemplate"}else{if(e=="global"){k="globalTemplate"}}}}c.compiledTemplateId=k;var f=i.compiledTemplates[k];if(!f||!h.isCached(f)){return null}c.cache={};c.cache.key=f;return c},tmpl:function(d,c,e){if(a.isString(d)){d=this.normalizedViews[d]}var i=c.engine.type;var h=c.compiledTemplateId;var g=a.TemplateEngineRegistry.find(i);if(!g){return a.throwDefaultError("Cannot find template engine for type: "+i)}var j=c.cache.key;var f=g.execute(j,e,function(k){return a.throwDefaultError("The compiled template: "+h+" for view: "+d.id+" failed to execute: "+JSON.stringify(k))});return a.safeDomParse(f)}});a.DEBUG=0;a.INFO=1;a.WARN=2;a.ERROR=3;a.logLevel=a.WARN;a.logDebug=function(c){a.log(a.DEBUG,c)};a.logInfo=function(c){a.log(a.INFO,c)};a.logWarn=function(c){a.log(a.WARN,c)};a.logError=function(c){a.log(a.ERROR,c)};a.log=function(f,c){var e={0:"debug",1:"info",2:"warn",3:"error"};if(a.logLevel<=f){var d=e[f];if(typeof console!=="undefined"&&console[d]){if("debug"==d){console.debug(c)}else{if("info"==d){console.info(c)}else{if("warn"==d){console.warn(c)}else{if("error"==d){console.error(c)}else{console.log(c)}}}}}}};a.checked=function(c,d){return a.attrProp(c,"checked",d)};a.attrProp=function(d,c,e){if(!(typeof(e)==="undefined")){if(b(d).prop){b(d).prop(c,e)}else{if(e){b(d).attr(c,e)}else{b(d).removeAttr(c)}}}if(b(d).prop){return b(d).prop(c)}return b(d).attr(c)};a.loadRefSchemaOptions=function(h,g,i){if(g.indexOf("#/definitions/")>-1){var d=g.substring(14);var c=null;if(h.schema.definitions){c=h.schema.definitions[d]}var f=null;if(h.options.definitions){f=h.options.definitions[d]}i(c,f)}else{var e=a.resolveReference(h.schema,h.options,g);if(e){i(e.schema,e.options)}else{i()}}};a.DEFAULT_ERROR_CALLBACK=function(c){if(c&&c.message){a.logError(c.message);throw new Error("Alpaca caught an error with the default error handler: "+c.message)}};a.defaultErrorCallback=a.DEFAULT_ERROR_CALLBACK;a.throwDefaultError=function(d){if(d&&a.isObject(d)){d=JSON.stringify(d)}var c={message:d};a.defaultErrorCallback(c)};a.throwErrorWithCallback=function(e,c){if(e&&a.isObject(e)){e=JSON.stringify(e)}var d={message:e};if(c){c(d)}else{a.defaultErrorCallback(d)}};a.resolveReference=function(g,e,h){if(g.id==h){var d={};if(g){d.schema=g}if(e){d.options=e}return d}else{if(g&&g.properties){for(var i in g.properties){var f=g.properties[i];var j=null;if(e&&e.fields&&e.fields[i]){j=e.fields[i]}var c=a.resolveReference(f,j,h);if(c){return c}}}}return null};b.alpaca=window.Alpaca=a;b.fn.alpaca=function(){var d=a.makeArray(arguments);var c=[].concat(this,d);return a.apply(this,c)};b.fn.outerHTML=function(c){if(c){return b("<div></div>").append(this).html()}else{return b("<div></div>").append(this.clone()).html()}};b.fn.swapWith=function(c){return this.each(function(){var d=b(c).clone();var e=b(this).clone();b(c).replaceWith(e);b(this).replaceWith(d)})};b.fn.attrProp=function(c,d){return a.attrProp(b(this),c,d)};b.event.special.destroyed={remove:function(c){if(c.handler){c.handler()}}}})(jQuery);(function(){Alpaca.TemplateEngineRegistry=function(){var a={};return{register:function(c,b){a[c]=b},find:function(d){var e=null;if(a[d]){e=a[d]}else{for(var f in a){var c=a[f].supportedMimetypes();for(var b=0;b<c.length;b++){if(d.toLowerCase()==c[b].toLowerCase()){e=a[f];break}}}}return e},ids:function(){var b=[];for(var c in a){b.push(c)}return b}}}()})();(function(a){if(typeof(Alpaca.TemplateCache)=="undefined"){Alpaca.TemplateCache={}}Alpaca.AbstractTemplateEngine=Base.extend({constructor:function(b){this.base();this.id=b;this.cleanMarkup=function(c){var d=Alpaca.safeDomParse(c);if(a(d).length==1){if(a(d)[0].nodeName.toLowerCase()=="script"){c=a(d).html()}}return c}},compile:function(h,f,i){var b=this;var e="html";if(Alpaca.isString(f)){if(f.indexOf("./")===0||f.indexOf("/")===0||f.indexOf("../")===0){e="uri"}else{if(f.indexOf("#")===0||f.indexOf(".")===0||f.indexOf("[")===0){e="selector"}}}else{}if(e=="selector"){b._compile(h,f,i)}else{if(e=="uri"){var g=b.fileExtension();var c=f;if(c.indexOf("."+g)===-1){c+="."+g}a.ajax({url:c,dataType:"html",success:function(j){j=b.cleanMarkup(j);b._compile(h,j,i)},failure:function(j){i(j,null)}})}else{if(e=="html"){var d=f;if(d instanceof jQuery){d=Alpaca.safeDomParse(f).outerHTML()}b._compile(h,d,i)}else{i(new Error("Template engine cannot determine how to handle type: "+e))}}}},_compile:function(c,b,d){if(Alpaca.isEmpty(b)){b=""}b=Alpaca.trim(b);if(b.toLowerCase().indexOf("<script")===0){}else{b="<script type='"+this.supportedMimetypes()[0]+"'>"+b+"<\/script>"}Alpaca.logDebug("Compiling template: "+this.id+", cacheKey: "+c+", template: "+b);this.doCompile(c,b,d)},doCompile:function(c,b,d){},execute:function(e,b,f){Alpaca.logDebug("Executing template for cache key: "+e);var c=this.doExecute(e,b,f);var d=function(g){var h=Alpaca.safeDomParse(g);if(a(h).length==1){if(a(h)[0].nodeName.toLowerCase()=="script"){return a(h).html()}}return g};c=d(c);return c},doExecute:function(c,b,d){},fileExtension:function(){return"html"},supportedMimetypes:function(){return[]},isCached:function(b){}})})(jQuery);(function(a){Alpaca.JQueryTemplateEngine=Alpaca.AbstractTemplateEngine.extend({fileExtension:function(){return"html"},supportedMimetypes:function(){return["text/x-jquery-template","text/x-jquery-tmpl"]},doCompile:function(d,b,f){try{a.template(d,b)}catch(c){f(c);return}Alpaca.TemplateCache[d]=b;f()},doExecute:function(k,g,l){var m=this;var f=null;try{var b=a.tmpl(k,g);b=b.outerHTML();var d=-1;do{d=b.indexOf("_tmplitem=");if(d>-1){var c=b.indexOf(" ",d);if(c==-1){c=b.indexOf(">",d)}if(c==-1){l({message:"Should have found closing whitespace or '>' for _tmplitem attribute"});return}b=b.substring(0,d)+b.substring(c)}}while(d>-1);f=Alpaca.safeDomParse(b)}catch(h){l({message:h.message});return null}return f},isCached:function(b){return(Alpaca.TemplateCache[b]?true:false)}});Alpaca.TemplateEngineRegistry.register("tmpl",new Alpaca.JQueryTemplateEngine("tmpl"))})(jQuery);(function(a){Alpaca.EJSTemplateEngine=Alpaca.AbstractTemplateEngine.extend({fileExtension:function(){return"ejs"},supportedMimetypes:function(){return["text/x-ejs-template","text/x-ejs-tmpl"]},doCompile:function(f,c,g){var b=null;try{b=new EJS({name:f,text:c})}catch(d){g(d);return}Alpaca.TemplateCache[f]=b;g()},doExecute:function(g,c,h){var b=Alpaca.TemplateCache[g];var d=null;try{d=b.render(c)}catch(f){h(f);return null}return d},isCached:function(b){return(Alpaca.TemplateCache[b]?true:false)}});Alpaca.TemplateEngineRegistry.register("ejs",new Alpaca.EJSTemplateEngine("ejs"))})(jQuery);(function(a){Alpaca.HandlebarsTemplateEngine=Alpaca.AbstractTemplateEngine.extend({fileExtension:function(){return"html"},supportedMimetypes:function(){return["text/x-handlebars-template","text/x-handlebars-tmpl"]},doCompile:function(f,b,g){var c=null;try{c=Handlebars.compile(b)}catch(d){g(d);return}Alpaca.TemplateCache[f]=c;g()},doExecute:function(g,b,h){var d=Alpaca.TemplateCache[g];var c=null;try{c=d(b)}catch(f){h(f);return null}return c},isCached:function(b){return(Alpaca.TemplateCache[b]?true:false)}});Alpaca.TemplateEngineRegistry.register("handlebars",new Alpaca.HandlebarsTemplateEngine("handlebars"))})(jQuery);(function(b){var a=b.alpaca;a.styleInjections={};a.registerView({id:"VIEW_BASE",title:"Abstract base view",description:"Foundation view which provides an abstract view from which all other views extend.",messages:{countries:{afg:"Afghanistan",ala:"Aland Islands",alb:"Albania",dza:"Algeria",asm:"American Samoa",and:"Andorra",ago:"Angola",aia:"Anguilla",ata:"Antarctica",atg:"Antigua and Barbuda",arg:"Argentina",arm:"Armenia",abw:"Aruba",aus:"Australia",aut:"Austria",aze:"Azerbaijan",bhs:"Bahamas",bhr:"Bahrain",bgd:"Bangladesh",brb:"Barbados",blr:"Belarus",bel:"Belgium",blz:"Belize",ben:"Benin",bmu:"Bermuda",btn:"Bhutan",bol:"Bolivia",bih:"Bosnia and Herzegovina",bwa:"Botswana",bvt:"Bouvet Island",bra:"Brazil",iot:"British Indian Ocean Territory",brn:"Brunei Darussalam",bgr:"Bulgaria",bfa:"Burkina Faso",bdi:"Burundi",khm:"Cambodia",cmr:"Cameroon",can:"Canada",cpv:"Cape Verde",cym:"Cayman Islands",caf:"Central African Republic",tcd:"Chad",chl:"Chile",chn:"China",cxr:"Christmas Island",cck:"Cocos (Keeling), Islands",col:"Colombia",com:"Comoros",cog:"Congo",cod:"Congo, the Democratic Republic of the",cok:"Cook Islands",cri:"Costa Rica",hrv:"Croatia",cub:"Cuba",cyp:"Cyprus",cze:"Czech Republic",civ:"Cote d'Ivoire",dnk:"Denmark",dji:"Djibouti",dma:"Dominica",dom:"Dominican Republic",ecu:"Ecuador",egy:"Egypt",slv:"El Salvador",gnq:"Equatorial Guinea",eri:"Eritrea",est:"Estonia",eth:"Ethiopia",flk:"Falkland Islands (Malvinas),",fro:"Faroe Islands",fji:"Fiji",fin:"Finland",fra:"France",guf:"French Guiana",pyf:"French Polynesia",atf:"French Southern Territories",gab:"Gabon",gmb:"Gambia",geo:"Georgia",deu:"Germany",gha:"Ghana",gib:"Gibraltar",grc:"Greece",grl:"Greenland",grd:"Grenada",glp:"Guadeloupe",gum:"Guam",gtm:"Guatemala",ggy:"Guernsey",gin:"Guinea",gnb:"Guinea-Bissau",guy:"Guyana",hti:"Haiti",hmd:"Heard Island and McDonald Islands",vat:"Holy See (Vatican City State),",hnd:"Honduras",hkg:"Hong Kong",hun:"Hungary",isl:"Iceland",ind:"India",idn:"Indonesia",irn:"Iran, Islamic Republic of",irq:"Iraq",irl:"Ireland",imn:"Isle of Man",isr:"Israel",ita:"Italy",jam:"Jamaica",jpn:"Japan",jey:"Jersey",jor:"Jordan",kaz:"Kazakhstan",ken:"Kenya",kir:"Kiribati",prk:"Korea, Democratic People's Republic of",kor:"Korea, Republic of",kwt:"Kuwait",kgz:"Kyrgyzstan",lao:"Lao People's Democratic Republic",lva:"Latvia",lbn:"Lebanon",lso:"Lesotho",lbr:"Liberia",lby:"Libyan Arab Jamahiriya",lie:"Liechtenstein",ltu:"Lithuania",lux:"Luxembourg",mac:"Macao",mkd:"Macedonia, the former Yugoslav Republic of",mdg:"Madagascar",mwi:"Malawi",mys:"Malaysia",mdv:"Maldives",mli:"Mali",mlt:"Malta",mhl:"Marshall Islands",mtq:"Martinique",mrt:"Mauritania",mus:"Mauritius",myt:"Mayotte",mex:"Mexico",fsm:"Micronesia, Federated States of",mda:"Moldova, Republic of",mco:"Monaco",mng:"Mongolia",mne:"Montenegro",msr:"Montserrat",mar:"Morocco",moz:"Mozambique",mmr:"Myanmar",nam:"Namibia",nru:"Nauru",npl:"Nepal",nld:"Netherlands",ant:"Netherlands Antilles",ncl:"New Caledonia",nzl:"New Zealand",nic:"Nicaragua",ner:"Niger",nga:"Nigeria",niu:"Niue",nfk:"Norfolk Island",mnp:"Northern Mariana Islands",nor:"Norway",omn:"Oman",pak:"Pakistan",plw:"Palau",pse:"Palestinian Territory, Occupied",pan:"Panama",png:"Papua New Guinea",pry:"Paraguay",per:"Peru",phl:"Philippines",pcn:"Pitcairn",pol:"Poland",prt:"Portugal",pri:"Puerto Rico",qat:"Qatar",rou:"Romania",rus:"Russian Federation",rwa:"Rwanda",reu:"Reunion",blm:"Saint Barthelemy",shn:"Saint Helena",kna:"Saint Kitts and Nevis",lca:"Saint Lucia",maf:"Saint Martin (French part)",spm:"Saint Pierre and Miquelon",vct:"Saint Vincent and the Grenadines",wsm:"Samoa",smr:"San Marino",stp:"Sao Tome and Principe",sau:"Saudi Arabia",sen:"Senegal",srb:"Serbia",syc:"Seychelles",sle:"Sierra Leone",sgp:"Singapore",svk:"Slovakia",svn:"Slovenia",slb:"Solomon Islands",som:"Somalia",zaf:"South Africa",sgs:"South Georgia and the South Sandwich Islands",esp:"Spain",lka:"Sri Lanka",sdn:"Sudan",sur:"Suriname",sjm:"Svalbard and Jan Mayen",swz:"Swaziland",swe:"Sweden",che:"Switzerland",syr:"Syrian Arab Republic",twn:"Taiwan, Province of China",tjk:"Tajikistan",tza:"Tanzania, United Republic of",tha:"Thailand",tls:"Timor-Leste",tgo:"Togo",tkl:"Tokelau",ton:"Tonga",tto:"Trinidad and Tobago",tun:"Tunisia",tur:"Turkey",tkm:"Turkmenistan",tca:"Turks and Caicos Islands",tuv:"Tuvalu",uga:"Uganda",ukr:"Ukraine",are:"United Arab Emirates",gbr:"United Kingdom",usa:"United States",umi:"United States Minor Outlying Islands",ury:"Uruguay",uzb:"Uzbekistan",vut:"Vanuatu",ven:"Venezuela",vnm:"Viet Nam",vgb:"Virgin Islands, British",vir:"Virgin Islands, U.S.",wlf:"Wallis and Futuna",esh:"Western Sahara",yem:"Yemen",zmb:"Zambia",zwe:"Zimbabwe"},empty:"",required:"This field is required",valid:"",invalid:"This field is invalid",months:["January","February","March","April","May","June","July","August","September","October","November","December"],timeUnits:{SECOND:"seconds",MINUTE:"minutes",HOUR:"hours",DAY:"days",MONTH:"months",YEAR:"years"}}})})(jQuery);(function(b){var a=b.alpaca;a.styleInjections={};a.registerView({id:"VIEW_WEB_DISPLAY",parent:"VIEW_BASE",title:"Default Web Display View",description:"Default web edit view which goes though field hierarchy.",type:"view",platform:"web",displayReadonly:true,templates:{controlField:'<div class="alpaca-data-container">{{if options.label}}<div class="alpaca-data-label">${options.label}</div>{{/if}}<div class="alpaca-data">&nbsp;${data}</div></div>',fieldSetOuterEl:'<div class="ui-widget ui-widget-content">{{html this.html}}</div>',fieldSetLegend:'{{if options.label}}<div class="{{if options.labelClass}}${options.labelClass}{{/if}}">${options.label}</div>{{/if}}',fieldSetItemsContainer:"<div>{{html this.html}}</div>",fieldSet:'{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetOuterEl",true)}}{{html Alpaca.fieldTemplate(this,"fieldSetLegend")}}{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetItemsContainer",true)}}{{/wrap}}{{/wrap}}',controlFieldContainer:"<div>{{html this.html}}</div>",arrayToolbar:"",arrayItemToolbar:""}});a.registerView({id:"VIEW_WEB_EDIT",parent:"VIEW_BASE",title:"Default Web Edit View",description:"Default web edit view which goes though field hierarchy.",type:"edit",platform:"web",displayReadonly:true,templates:{controlFieldOuterEl:"<span>{{html this.html}}</span>",controlFieldMessage:'<div><span class="ui-icon ui-icon-alert"></span><span class="alpaca-controlfield-message-text">${message}</span></div>',controlFieldLabel:'{{if options.label}}<div class="{{if options.labelClass}}${options.labelClass}{{/if}}"><div>${options.label}</div></div>{{/if}}',controlFieldHelper:'{{if options.helper}}<div class="{{if options.helperClass}}${options.helperClass}{{/if}}"><span class="ui-icon ui-icon-info"></span><span class="alpaca-controlfield-helper-text">${options.helper}</span></div>{{/if}}',controlFieldContainer:"<div>{{html this.html}}</div>",controlField:'{{wrap(null, {}) Alpaca.fieldTemplate(this,"controlFieldOuterEl",true)}}{{html Alpaca.fieldTemplate(this,"controlFieldLabel")}}{{wrap(null, {}) Alpaca.fieldTemplate(this,"controlFieldContainer",true)}}{{html Alpaca.fieldTemplate(this,"controlFieldHelper")}}{{/wrap}}{{/wrap}}',fieldSetOuterEl:"<fieldset>{{html this.html}}</fieldset>",fieldSetMessage:'<div><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span><span>${message}</span></div>',fieldSetLegend:'{{if options.label}}<legend class="{{if options.labelClass}}${options.labelClass}{{/if}}">${options.label}</legend>{{/if}}',fieldSetHelper:'{{if options.helper}}<div class="{{if options.helperClass}}${options.helperClass}{{/if}}">${options.helper}</div>{{/if}}',fieldSetItemsContainer:"<div>{{html this.html}}</div>",fieldSet:'{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetOuterEl",true)}}{{html Alpaca.fieldTemplate(this,"fieldSetLegend")}}{{html Alpaca.fieldTemplate(this,"fieldSetHelper")}}{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetItemsContainer",true)}}{{/wrap}}{{/wrap}}',fieldSetItemContainer:"<div></div>",formFieldsContainer:"<div>{{html this.html}}</div>",formButtonsContainer:'<div>{{if options.buttons}}{{each(k,v) options.buttons}}<button data-key="${k}" class="alpaca-form-button alpaca-form-button-${k}" {{each(k1,v1) v}}${k1}="${v1}"{{/each}}>${v.value}</button>{{/each}}{{/if}}</div>',form:'<form>{{html Alpaca.fieldTemplate(this,"formFieldsContainer")}}{{html Alpaca.fieldTemplate(this,"formButtonsContainer")}}</form>',wizardStep:'<div class="alpaca-clear"></div>',wizardNavBar:"<div></div>",wizardPreButton:"<button>Back</button>",wizardNextButton:"<button>Next</button>",wizardDoneButton:"<button>Done</button>",wizardStatusBar:'<ol id="${id}">{{each(i,v) titles}}<li id="stepDesc${i}"><div><strong><span>${v.title}</span>${v.description}</strong></div></li>{{/each}}</ol>'}});a.registerView({id:"VIEW_WEB_CREATE",parent:"VIEW_WEB_EDIT",title:"Default Web Create View",description:"Default web create view which doesn't bind initial data.",type:"create",displayReadonly:false})})(jQuery);(function(c){var b=c.alpaca;var a={controlFieldOuterEl:'<span class="alpaca-view-web-list">{{html this.html}}</span>',controlFieldMessage:'<div><span class="ui-icon ui-icon-alert"></span><span class="alpaca-controlfield-message-text">${message}</span></div>',controlFieldLabel:'{{if options.label}}<label for="${id}" class="{{if options.labelClass}}${options.labelClass}{{/if}}">${options.label}</label>{{/if}}',controlFieldHelper:'{{if options.helper}}<div class="{{if options.helperClass}}${options.helperClass}{{/if}}"><span class="ui-icon ui-icon-info"></span><span class="alpaca-controlfield-helper-text">${options.helper}</span></div>{{/if}}',controlFieldContainer:"<div>{{html this.html}}</div>",controlField:'{{wrap(null, {}) Alpaca.fieldTemplate(this,"controlFieldOuterEl",true)}}{{html Alpaca.fieldTemplate(this,"controlFieldLabel")}}{{wrap(null, {}) Alpaca.fieldTemplate(this,"controlFieldContainer",true)}}{{html Alpaca.fieldTemplate(this,"controlFieldHelper")}}{{/wrap}}{{/wrap}}',fieldSetOuterEl:'<fieldset class="alpaca-view-web-list">{{html this.html}}</fieldset>',fieldSetMessage:'<div><span class="ui-icon ui-icon-alert alpaca-fieldset-message-list-view"></span><span>${message}</span></div>',fieldSetLegend:'{{if options.label}}<legend class="{{if options.labelClass}}${options.labelClass}{{/if}}">${options.label}</legend>{{/if}}',fieldSetHelper:'{{if options.helper}}<div class="{{if options.helperClass}}${options.helperClass}{{/if}}">${options.helper}</div>{{/if}}',fieldSetItemsContainer:"<ol>{{html this.html}}</ol>",fieldSet:'{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetOuterEl",true)}}{{html Alpaca.fieldTemplate(this,"fieldSetLegend")}}{{html Alpaca.fieldTemplate(this,"fieldSetHelper")}}{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetItemsContainer",true)}}{{/wrap}}{{/wrap}}',fieldSetItemContainer:'<li style="list-style:none;"></li>',itemLabel:'{{if options.itemLabel}}<label for="${id}" class="alpaca-controlfield-label alpaca-controlfield-label-list-view"><span class="alpaca-controlfield-item-label-list-view">${options.itemLabel}{{if index}} <span class="alpaca-item-label-counter">${index}</span></span>{{/if}}</label>{{/if}}'};b.registerView({id:"VIEW_WEB_DISPLAY_LIST",parent:"VIEW_WEB_DISPLAY",title:"Web Display View List Style",description:"Web display view based on list styles.",legendStyle:"link",templates:a,styles:{},fields:{"/":{templates:{fieldSetItemsContainer:'<ol class="alpaca-fieldset-itemscontainer-list-view-top">{{html this.html}}</ol>',fieldSetItemContainer:'<li class="alpaca-fieldset-itemcontainer-list-view-top"></li>'}}}});b.registerView({id:"VIEW_WEB_EDIT_LIST",parent:"VIEW_WEB_EDIT",title:"Web Edit View List Style",description:"Web edit view based on list styles.",legendStyle:"link",templates:a,styles:{},fields:{"/":{templates:{fieldSetItemsContainer:'<ol class="alpaca-fieldset-itemscontainer-list-view-top">{{html this.html}}</ol>',fieldSetItemContainer:'<li class="alpaca-fieldset-itemcontainer-list-view-top"></li>'}}}});b.registerView({id:"VIEW_WEB_CREATE_LIST",parent:"VIEW_WEB_CREATE",title:"Web Create View List Style",description:"Web create view based on list styles.",legendStyle:"link",templates:a,styles:{},fields:{"/":{templates:{fieldSetItemsContainer:'<ol class="alpaca-fieldset-itemscontainer-list-view-top">{{html this.html}}</ol>',fieldSetItemContainer:'<li class="alpaca-fieldset-itemcontainer-list-view-top"></li>'}}}})})(jQuery);(function(b){var a=b.alpaca;a.styleInjections["jquery-ui"]={field:function(c){c.addClass("ui-widget")},required:function(c){b('<span class="ui-icon ui-icon-star"></span>').prependTo(c)},error:function(c){c.addClass("ui-state-error")},errorMessage:function(c){c.addClass("ui-state-error-text")},removeError:function(c){c.removeClass("ui-state-error")},container:function(c){c.addClass("ui-widget-content")},wizardStatusBar:function(c){c.addClass("ui-widget-header ui-corner-all")},wizardCurrentStep:function(c){c.addClass("ui-state-highlight ui-corner-all")},wizardUnCurrentStep:function(c){c.removeClass("ui-state-highlight ui-corner-all")},containerExpandedIcon:"ui-icon-circle-arrow-s",containerCollapsedIcon:"ui-icon-circle-arrow-e",commonIcon:"ui-icon",addIcon:"ui-icon-circle-plus",removeIcon:"ui-icon-circle-minus",upIcon:"ui-icon-circle-arrow-n",downIcon:"ui-icon-circle-arrow-s",wizardPreIcon:"ui-icon-triangle-1-w",wizardNextIcon:"ui-icon-triangle-1-e",wizardDoneIcon:"ui-icon-triangle-1-e",buttonBeautifier:function(d,c,f){d.addClass("ui-button ui-widget ui-state-default ui-corner-all");if(f){d.addClass("ui-button-text-icon-primary")}else{d.addClass("ui-button-icon-only")}var e=d.html();d.attr("title",e);d.empty().append('<span class="ui-button-icon-primary ui-icon alpaca-fieldset-legend-button '+c+'"></span><span class="ui-button-text">'+e+"</span>");d.hover(function(){if(!d.hasClass("alpaca-fieldset-array-item-toolbar-disabled")){b(this).addClass("ui-state-hover")}},function(){if(!d.hasClass("alpaca-fieldset-array-item-toolbar-disabled")){b(this).removeClass("ui-state-hover")}})}};a.registerView({id:"VIEW_JQUERYUI_DISPLAY",parent:"VIEW_WEB_DISPLAY",title:"Web Display View for jQuery UI",description:"Web Display View for jQuery UI",style:"jquery-ui",ui:"jquery-ui"});a.registerView({id:"VIEW_JQUERYUI_EDIT",parent:"VIEW_WEB_EDIT",title:"Web Edit View for jQuery UI",description:"Web Edit View for jQuery UI",style:"jquery-ui",ui:"jquery-ui"});a.registerView({id:"VIEW_JQUERYUI_CREATE",parent:"VIEW_WEB_CREATE",title:"Web Create View for jQuery UI",description:"Web Create View for jQuery UI",style:"jquery-ui",ui:"jquery-ui"});a.registerView({id:"VIEW_JQUERYUI_EDIT_LIST",parent:"VIEW_WEB_EDIT_LIST",title:"JQuery UI Edit View List Style",description:"JQuery UI edit view based on list styles.",style:"jquery-ui",ui:"jquery-ui"});a.registerView({id:"VIEW_JQUERYUI_CREATE_LIST",parent:"VIEW_WEB_CREATE_LIST",title:"JQuery UI Create View List Style",description:"JQuery UI create view based on list styles.",style:"jquery-ui",ui:"jquery-ui"})})(jQuery);(function(c){var b=c.alpaca;b.styleInjections["jquery-mobile"]={array:function(d){if(d){if(d.find('[data-role="fieldcontain"]').fieldcontain){d.find('[data-role="fieldcontain"]').fieldcontain();d.find('[data-role="fieldcontain"]').find("[type='radio'], [type='checkbox']").checkboxradio();d.find('[data-role="fieldcontain"]').find("button, [data-role='button'], [type='button'], [type='submit'], [type='reset'], [type='image']").not(".ui-nojs").button();d.find('[data-role="fieldcontain"]').find("input, textarea").not("[type='radio'], [type='checkbox'], button, [type='button'], [type='submit'], [type='reset'], [type='image']").textinput();d.find('[data-role="fieldcontain"]').find("input, select").filter("[data-role='slider'], [data-type='range']").slider();d.find('[data-role="fieldcontain"]').find("select:not([data-role='slider'])").selectmenu();d.find('[data-role="button"]').buttonMarkup();d.find('[data-role="controlgroup"]').controlgroup()}}}};b.registerView({id:"VIEW_MOBILE_DISPLAY",parent:"VIEW_WEB_DISPLAY",title:"Mobile DISPLAY View",description:"Mobile display view using JQuery Mobile Library",type:"view",platform:"mobile",style:"jquery-mobile",ui:"mobile",legendStyle:"link",toolbarStyle:"link",buttonType:"link",templates:{controlField:'<ul data-role="listview"><li>{{if options.label}}<h4>${options.label}</h4>{{/if}}<p><strong>${data}</strong></p></li></ul>',fieldSetOuterEl:'<fieldset data-role="collapsible" id="${id}" data-collapsed="{{if options.collapsed}}true{{else}}false{{/if}}">{{html this.html}}</fieldset>',fieldSetMessage:"<div>* ${message}</div>",fieldSetLegend:'{{if options.label}}<legend for="${id}" class="{{if options.labelClass}}${options.labelClass}{{/if}}">${options.label}</legend>{{/if}}',fieldSetHelper:'{{if options.helper}}<h3 class="{{if options.helperClass}}${options.helperClass}{{/if}}">${options.helper}</h3>{{/if}}',fieldSetItemsContainer:'<div data-role="controlgroup">{{html this.html}}</div>',fieldSet:'{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetOuterEl",true)}}{{html Alpaca.fieldTemplate(this,"fieldSetLegend")}}{{html Alpaca.fieldTemplate(this,"fieldSetHelper")}}{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetItemsContainer",true)}}{{/wrap}}{{/wrap}}',fieldSetItemContainer:"<div></div>"},messages:{required:"Required Field",invalid:"Invalid Field"},render:function(e,f){var d=this;e.render(e.view,function(g){a(g.getEl());if(f){f.call(d,g)}})}});b.registerView({id:"VIEW_MOBILE_EDIT",parent:"VIEW_WEB_EDIT",title:"Mobile Edit View",description:"Mobile edit view using JQuery Mobile Library",type:"edit",platform:"mobile",style:"jquery-mobile",ui:"mobile",legendStyle:"link",toolbarStyle:"link",buttonType:"link",toolbarSticky:true,templates:{controlFieldOuterEl:'<div data-role="fieldcontain">{{html this.html}}</div>',controlFieldMessage:"<div>* ${message}</div>",controlFieldLabel:'{{if options.label}}<label for="${id}" class="{{if options.labelClass}}${options.labelClass}{{/if}}">${options.label}</label>{{/if}}',controlFieldHelper:'{{if options.helper}}<div class="{{if options.helperClass}}${options.helperClass}{{/if}}">${options.helper}</div>{{/if}}',controlFieldContainer:'<div data-replace="true">{{html this.html}}</div>',controlField:'{{wrap(null, {}) Alpaca.fieldTemplate(this,"controlFieldOuterEl",true)}}{{html Alpaca.fieldTemplate(this,"controlFieldLabel")}}{{wrap(null, {}) Alpaca.fieldTemplate(this,"controlFieldContainer",true)}}{{/wrap}}{{html Alpaca.fieldTemplate(this,"controlFieldHelper")}}{{/wrap}}',fieldSetOuterEl:'<fieldset id="${id}" data-collapsed="{{if options.collapsed}}true{{else}}false{{/if}}">{{html this.html}}</fieldset>',fieldSetMessage:"<div>* ${message}</div>",fieldSetLegend:'{{if options.label}}<legend for="${id}" class="{{if options.labelClass}}${options.labelClass}{{/if}}">${options.label}</legend>{{/if}}',fieldSetHelper:'{{if options.helper}}<h3 class="{{if options.helperClass}}${options.helperClass}{{/if}}">${options.helper}</h3>{{/if}}',fieldSetItemsContainer:'<div data-role="controlgroup">{{html this.html}}</div>',fieldSet:'{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetOuterEl",true)}}{{html Alpaca.fieldTemplate(this,"fieldSetLegend")}}{{html Alpaca.fieldTemplate(this,"fieldSetHelper")}}{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetItemsContainer",true)}}{{/wrap}}{{/wrap}}',fieldSetItemContainer:"<div></div>",formFieldsContainer:'<div data-role="content">{{html this.html}}</div>',form:'<form>{{html Alpaca.fieldTemplate(this,"formFieldsContainer")}}{{html Alpaca.fieldTemplate(this,"formButtonsContainer")}}</form>',controlFieldRadio:'<fieldset data-role="controlgroup" class="alpaca-radio-fieldset" id="${id}">{{each selectOptions}}<input type="radio" {{if options.readonly}}readonly="readonly"{{/if}} name="${name}" id="${id}-${$index}" value="${value}" {{if value == data}}checked="checked"{{/if}}/><label for="${id}-${$index}">${text}</label>{{/each}}</fieldset>',controlFieldCheckbox:'<fieldset data-role="controlgroup" class="alpaca-radio-fieldset" id="${id}-0"><input type="checkbox" id="${id}-1" name="${id}-1" {{if options.readonly}}readonly="readonly"{{/if}} {{if name}}name="${name}"{{/if}} {{each options.data}}data-${fieldId}="${value}"{{/each}}/>{{if options.rightLabel}}<label for="${id}-1">${options.rightLabel}</label>{{else}}{{if options.label}}<label for="${id}-1">${options.label}?</label>{{/if}}{{/if}}</fieldset>',arrayItemToolbar:'<div class="alpaca-fieldset-array-item-toolbar" data-role="controlgroup" data-type="horizontal" data-mini="true"><span class="alpaca-fieldset-array-item-toolbar-add" data-role="button" data-icon="add" data-iconpos="notext">Add</span><span class="alpaca-fieldset-array-item-toolbar-remove" data-role="button" data-icon="delete" data-iconpos="notext">Delete</span><span class="alpaca-fieldset-array-item-toolbar-up" data-role="button" data-icon="arrow-u" data-iconpos="notext">Up</span><span class="alpaca-fieldset-array-item-toolbar-down" data-role="button" data-icon="arrow-d" data-iconpos="notext">Down</span></div>',arrayToolbar:'<div class="alpaca-fieldset-array-toolbar" data-role="controlgroup" data-mini="true"><span class="alpaca-fieldset-array-toolbar-icon alpaca-fieldset-array-toolbar-add" data-role="button" data-icon="add" data-inline="true" title="Add">Add</span></div>'},messages:{required:"Required Field",invalid:"Invalid Field"},render:function(e,f){var d=this;e.render(function(g){a(g.getEl());if(f){f.call(d,g)}})}});var a=function(e){var d=e;while(!b.isEmpty(d)&&d.attr("data-role")!=="page"){d=d.parent()}if(!b.isEmpty(d)){c(d).trigger("pagecreate")}};b.registerView({id:"VIEW_MOBILE_CREATE",parent:"VIEW_MOBILE_EDIT",title:"Default Mobile Create View",description:"Default mobile create view which doesn't bind initial data.",type:"create",displayReadonly:false})})(jQuery);(function(b){var a=b.alpaca;a.styleInjections.bootstrap={error:function(e){e.addClass("control-group error")},errorMessage:function(e){e.addClass("")},removeError:function(e){e.removeClass("error")},tooltipErrorMessage:function(f,e){if(b.fn.tooltip){f.tooltip({html:e}).click()}},field:function(e){e.addClass("control-group")},required:function(e){b('<span class="icon-star"></span>&nbsp;').prependTo(e)},container:function(e){e.addClass("")},wizardStatusBar:function(e){e.addClass("ui-widget-header ui-corner-all")},wizardCurrentStep:function(e){e.addClass("ui-state-highlight ui-corner-all")},wizardUnCurrentStep:function(e){e.removeClass("ui-state-highlight ui-corner-all")},commonIcon:"",addIcon:"icon-plus-sign",removeIcon:"icon-minus-sign",upIcon:"icon-chevron-up",downIcon:"icon-chevron-down",wizardPreIcon:"ui-icon-triangle-1-w",wizardNextIcon:"ui-icon-triangle-1-e",wizardDoneIcon:"ui-icon-triangle-1-e",containerExpandedIcon:"icon-circle-arrow-down",containerCollapsedIcon:"icon-circle-arrow-right",buttonBeautifier:function(g,e,i){var h=g.html();g.attr("title",h);var f=i?h:"";g.empty().append('<b class="alpaca-fieldset-legend-button '+e+'"></b><span>'+f+"</span>")}};var d={controlFieldLabel:'{{if options.label}}<label class="control-label {{if options.labelClass}}${options.labelClass}{{/if}}" for="${id}">${options.label}</label>{{/if}}',controlFieldHelper:'{{if options.helper}}<div class="{{if options.helperClass}}${options.helperClass}{{/if}}"><i class="icon-info-sign"></i> <span class="alpaca-controlfield-helper-text">${options.helper}</span></div>{{/if}}',controlFieldMessage:'<div><span class="icon-exclamation-sign"></span><span class="alpaca-controlfield-message-text help-inline">${message}</span></div>',arrayToolbar:'<span class="alpaca-fieldset-array-toolbar"><button class="btn alpaca-fieldset-array-toolbar-icon alpaca-fieldset-array-toolbar-add">${addItemLabel}</button></span>',arrayItemToolbar:'<div class="btn-toolbar alpaca-fieldset-array-item-toolbar"><div class="btn-group">{{each(k,v) buttons}}<button class="btn btn-small alpaca-fieldset-array-item-toolbar-icon alpaca-fieldset-array-item-toolbar-${v.feature}">${v.label}</button>{{/each}}</div></div>',controlFieldCheckbox:'<span>{{if options.rightLabel}}<label for="${id}" class="checkbox">{{/if}}<input type="checkbox" id="${id}" {{if options.readonly}}readonly="readonly"{{/if}} {{if name}}name="${name}"{{/if}} {{each(i,v) options.data}}data-${i}="${v}"{{/each}}/>{{if options.rightLabel}}${options.rightLabel}</label>{{/if}}</span>',controlFieldRadio:'<div id="${id}" class="alpaca-controlfield-radio">{{if !required}}<label class="alpaca-controlfield-radio-label radio inline"><input type="radio" {{if options.readonly}}readonly="readonly"{{/if}} name="${name}" value=""/>None</label>{{/if}}{{each selectOptions}}<label class="alpaca-controlfield-radio-label radio inline"><input type="radio" {{if options.readonly}}readonly="readonly"{{/if}} name="${name}" value="${value}" {{if value == data}}checked="checked"{{/if}}/>${text}</label>{{/each}}</div>',fieldSetHelper:'{{if options.helper}}<p class="{{if options.helperClass}}${options.helperClass}{{/if}}">${options.helper}</p>{{/if}}'};var c=function(f,g){var e=this;f.render(function(h){b("select,input,textarea",h.outerEl).addClass("input-xlarge");b("button:submit, button:reset, .alpaca-form-button").addClass("btn");if(g){g.call(e,h)}})};a.registerView({id:"VIEW_BOOTSTRAP_DISPLAY",parent:"VIEW_WEB_DISPLAY",title:"Display View for Bootstrap",description:"Display View for Bootstrap",style:"bootstrap",ui:"bootstrap",templates:d,render:c});a.registerView({id:"VIEW_BOOTSTRAP_EDIT",parent:"VIEW_WEB_EDIT",title:"Edit View for Bootstrap",description:"Edit View for Bootstrap",style:"bootstrap",ui:"bootstrap",templates:d,render:c});a.registerView({id:"VIEW_BOOTSTRAP_CREATE",parent:"VIEW_WEB_CREATE",title:"Create View for Bootstrap",description:"Create View for Bootstrap",style:"bootstrap",ui:"bootstrap",templates:d,render:c});a.registerView({id:"VIEW_BOOTSTRAP_DISPLAY_LIST",parent:"VIEW_WEB_DISPLAY_LIST",title:"Display List View for Bootstrap",description:"Display List View for Bootstrap",style:"bootstrap",ui:"bootstrap",templates:d,render:c});a.registerView({id:"VIEW_BOOTSTRAP_EDIT_LIST",parent:"VIEW_WEB_EDIT_LIST",title:"Edit List View for Bootstrap",description:"Edit List View for Bootstrap",style:"bootstrap",ui:"bootstrap",templates:d,render:c});a.registerView({id:"VIEW_BOOTSTRAP_CREATE_LIST",parent:"VIEW_WEB_CREATE_LIST",title:"Create List View for Bootstrap",description:"Create List View for Bootstrap",style:"bootstrap",ui:"bootstrap",templates:d,render:c})})(jQuery);(function(b){var a=b.alpaca;a.registerView({id:"VIEW_WEB_EDIT_TABLE",parent:"VIEW_WEB_EDIT",title:"Web Edit View Table Style",description:"Web edit view based on table styles.",type:"edit",displayReadonly:true,collapsible:false,legendStyle:"link",templates:{controlFieldOuterEl:null,controlFieldLabel:'<td>{{if options.label}}<label for="${id}" class="{{if options.labelClass}}${options.labelClass}{{/if}}">${options.label}</label>{{/if}}</td>',controlFieldContainer:'<td data-control="append">{{html this.html}}</td>',controlFieldMessage:'<div><span class="ui-icon ui-icon-alert"></span><span class="alpaca-controlfield-message-text">${message}</span></div>',controlFieldHelper:'{{if options.helper}}<div class="{{if options.helperClass}}${options.helperClass}{{/if}}"><span class="ui-icon ui-icon-info"></span><span class="alpaca-controlfield-helper-text">${options.helper}</span></div>{{/if}}',controlField:'{{html Alpaca.fieldTemplate(this,"controlFieldLabel")}}{{wrap(null, {}) Alpaca.fieldTemplate(this,"controlFieldContainer",true)}}{{html Alpaca.fieldTemplate(this,"controlFieldHelper")}}{{/wrap}}',fieldSetOuterEl:'<fieldset class="alpaca-view-web-edit-table">{{html this.html}}</fieldset>',fieldSetMessage:'<div><span class="ui-icon ui-icon-alert alpaca-fieldset-message-table-view"></span><span>${message}</span></div>',fieldSetLegend:'{{if options.label}}<legend class="{{if options.labelClass}}${options.labelClass}{{/if}}">${options.label}</legend>{{/if}}',fieldSetHelper:'{{if options.helper}}<div class="{{if options.helperClass}}${options.helperClass}{{/if}}">${options.helper}</div>{{/if}}',fieldSetItemsContainer:"<table><tbody>{{html this.html}}</tbody></table>",fieldSet:'{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetOuterEl",true)}}{{html Alpaca.fieldTemplate(this,"fieldSetLegend")}}{{html Alpaca.fieldTemplate(this,"fieldSetHelper")}}{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetItemsContainer",true)}}{{/wrap}}{{/wrap}}',fieldSetItemContainer:"<tr></tr>",itemLabel:'{{if options.itemLabel}}<label for="${id}" class="alpaca-controlfield-label alpaca-controlfield-label-list-view"><span class="alpaca-controlfield-item-label-list-view">${options.itemLabel}{{if index}} <span class="alpaca-item-label-counter">${index}</span></span>{{/if}}</label>{{/if}}'},styles:{},fields:{"/":{templates:{fieldSetItemsContainer:'<table class="alpaca-fieldset-itemscontainer-list-view-top">{{html this.html}}</table>',fieldSetItemContainer:'<tr class="alpaca-fieldset-itemscontainer-list-view-top"></tr>'}}}});a.registerView({id:"VIEW_WEB_CREATE_TABLE",parent:"VIEW_WEB_EDIT_TABLE",title:"Default Web Create View Table Stle",description:"Default web create view (Table Style) which doesn't bind initial data.",type:"create",displayReadonly:false})})(jQuery);(function(b){var a=b.alpaca;a.registerView({id:"VIEW_WEB_EDIT_YAML",parent:"VIEW_WEB_EDIT",title:"Web Edit View List Style",description:"Web edit list styled to look like a YAML editor.",type:"edit",displayReadonly:true,collapsible:true,legendStyle:"link",templates:{controlFieldOuterEl:'<span class="alpaca-view-web-edit-yaml" title="${options.helper}">{{html this.html}}</span>',controlFieldMessage:'<div><span class="ui-icon ui-icon-alert"></span><span class="alpaca-controlfield-message-text">${message}</span></div>',controlFieldLabel:'{{if options.label}}<label for="${id}" class="{{if options.labelClass}}${options.labelClass}{{/if}}">${options.label}:</label>{{/if}}',controlFieldHelper:'<span style="display:none" />',controlFieldContainer:"<div>{{html this.html}}</div>",controlField:'{{wrap(null, {}) Alpaca.fieldTemplate(this,"controlFieldOuterEl",true)}}{{html Alpaca.fieldTemplate(this,"controlFieldLabel")}}{{wrap(null, {}) Alpaca.fieldTemplate(this,"controlFieldContainer",true)}}{{html Alpaca.fieldTemplate(this,"controlFieldHelper")}}{{/wrap}}{{/wrap}}',fieldSetOuterEl:'<fieldset class="alpaca-view-web-edit-yaml">{{html this.html}}</fieldset>',fieldSetMessage:'<div><span class="ui-icon ui-icon-alert alpaca-fieldset-message-list-view"></span><span>${message}</span></div>',fieldSetLegend:'{{if options.label}}<legend class="{{if options.labelClass}}${options.labelClass}{{/if}}">${options.label}</legend>{{/if}}',fieldSetHelper:'{{if options.helper}}<div class="{{if options.helperClass}}${options.helperClass}{{/if}}">${options.helper}</div>{{/if}}',fieldSetItemsContainer:"<ol>{{html this.html}}</ol>",fieldSet:'{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetOuterEl",true)}}{{html Alpaca.fieldTemplate(this,"fieldSetLegend")}}{{html Alpaca.fieldTemplate(this,"fieldSetHelper")}}{{wrap(null, {}) Alpaca.fieldTemplate(this,"fieldSetItemsContainer",true)}}{{/wrap}}{{/wrap}}',fieldSetItemContainer:'<li style="list-style:none;"></li>',itemLabel:'{{if options.itemLabel}}<label for="${id}" class="alpaca-controlfield-label alpaca-controlfield-label-list-view"><span class="alpaca-controlfield-item-label-list-view">${options.itemLabel}{{if index}} <span class="alpaca-item-label-counter">${index}</span></span>{{/if}}</label>{{/if}}'},styles:{},fields:{"/":{templates:{fieldSetItemsContainer:'<ol class="alpaca-fieldset-itemscontainer-list-view-top">{{html this.html}}</ol>',fieldSetItemContainer:'<li class="alpaca-fieldset-itemcontainer-list-view-top"></li>'}}}})})(jQuery);(function(b){var a=b.alpaca;a.registerView({id:"VIEW_WEB_EDIT_INLINE",parent:"VIEW_WEB_EDIT",title:"Default Web Edit with fields inlining capabilities",description:"Edit template with form fields inlining capabilities, via options.inline level to display some forms parts inline. Useful to display for example an ArrayField containing ObjectField items in a compact manner.",type:"edit",platform:"web",style:"jquery-ui",displayReadonly:true,templates:{fieldSetOuterEl:'<fieldset class="{{if options.inline}}alpaca-inline{{/if}}">{{html this.html}}</fieldset>',fieldSetItemContainer:'<div class="alpaca-inline-item-container"></div>',arrayItemToolbar:'<div class="alpaca-fieldset-array-item-toolbar" data-role="controlgroup" data-type="horizontal" data-mini="true"><span class="alpaca-fieldset-array-item-toolbar-add" data-role="button" data-icon="add" data-iconpos="notext">Add</span><span class="alpaca-fieldset-array-item-toolbar-remove" data-role="button" data-icon="delete" data-iconpos="notext">Delete</span><span class="alpaca-fieldset-array-item-toolbar-up" data-role="button" data-icon="arrow-u" data-iconpos="notext">Up</span><span class="alpaca-fieldset-array-item-toolbar-down" data-role="button" data-icon="arrow-d" data-iconpos="notext">Down</span></div>'}})})(jQuery);(function(b){var a=b.alpaca;a.registerView({id:"VIEW_WEB_EDIT",templates:{twoColumnLayout:'<div class="alpaca-layout-two-column-mask">{{if options.label}}<h3>${options.label}</h3>{{/if}}{{if options.helper}}<h4>${options.helper}</h4>{{/if}}<div class="alpaca-layout-two-column-left alpaca-layout-region" id="leftcolumn"></div><div class="alpaca-layout-two-column-right alpaca-layout-region" id="rightcolumn"></div></div>'}});a.registerView({id:"VIEW_WEB_EDIT_LAYOUT_TWO_COLUMN",parent:"VIEW_WEB_EDIT",title:"Web Edit View with Two-Column Layout",description:"Web edit default view with two-column layout.",layout:{template:"twoColumnLayout"}});a.registerView({id:"VIEW_WEB_EDIT_LIST_LAYOUT_TWO_COLUMN",parent:"VIEW_WEB_EDIT_LIST",title:"Web List Edit View with Two-Column Layout",description:"Web edit list view with two-column layout.",layout:{template:"twoColumnLayout"}})})(jQuery);(function(b){var a=b.alpaca;a.NormalizedView=Base.extend({constructor:function(c){this.id=c},normalize:function(){var l=a.views[this.id];if(!l){a.logError("View compilation failed - view not found: "+this.id);return false}var c=[];var g=l;while(g){c.push(g);var f=g.parent;if(f){var j=a.views[g.parent];if(!j){a.logError("View compilation failed - cannot find parent view: "+f+" for view: "+g.id);return false}g=j}else{g=null}}c=c.reverse();var k=function(p,o,q){var n=o[q];var i=p[q];if(!a.isUndefined(i)&&!a.isUndefined(n)){a.logDebug("View property: "+q+" already has value: "+i+" and overwriting to: "+n)}if(!a.isUndefined(n)){p[q]=n}};var h=function(p,o,q){var n=o[q];var i=p[q];if(!a.isUndefined(i)&&!a.isUndefined(n)){a.logDebug("View property: "+q+" already has function, overwriting")}if(!a.isUndefined(n)){p[q]=n}};var m=function(n,i,p){var o=i[p];if(o){if(!n[p]){n[p]={}}a.mergeObject2(o,n[p])}};for(var e=0;e<c.length;e++){var d=c[e];k(this,d,"type");k(this,d,"displayReadonly");k(this,d,"platform");k(this,d,"device");k(this,d,"style");k(this,d,"ui");k(this,d,"collapsible");k(this,d,"legendStyle");k(this,d,"toolbarStyle");k(this,d,"buttonStyle");k(this,d,"toolbarSticky");k(this,d,"globalTemplate");h(this,d,"render");h(this,d,"postRender");m(this,d,"styles");m(this,d,"templates");m(this,d,"messages");m(this,d,"wizard");m(this,d,"fields");m(this,d,"layout");m(this,d,"compiledTemplates")}a.logDebug("View compilation complete for view: "+this.id);a.logDebug("Final view: ");a.logDebug(JSON.stringify(this,null," "));return true}})})(jQuery);(function(b){var a=b.alpaca;a.RuntimeView=Base.extend({constructor:function(c,d){this.field=d;this.setView(c)},setView:function(c){if(!c){this.id="VIEW_WEB_EDIT";return}var e=a.getNormalizedView(c);if(!e){throw new Error("Runtime view for view id: "+c+" could not find a normalized view")}for(var d in e){if(e.hasOwnProperty(d)){this[d]=e[d]}}},getWizard:function(){return this.getViewParam("wizard")},getGlobalTemplateDescriptor:function(){return this.getTemplateDescriptor("globalTemplate")},getLayout:function(){var c=this.getTemplateDescriptor("layoutTemplate");return{templateDescriptor:c,bindings:this.getViewParam(["layout","bindings"],true)}},getStyles:function(){return this.styles},getTemplateDescriptor:function(c){return a.getTemplateDescriptor(this,c)},getMessage:function(c){var d=this.getViewParam(["messages",a.defaultLocale,c]);return a.isEmpty(d)?this.getViewParam(["messages",c]):d},getViewParam:function(f,d){var c=this.field.path;if(this.fields&&this.fields[c]){var e=this._getConfigVal(this.fields[c],f);if(!a.isEmpty(e)){return e}}if(c&&c.indexOf("[")!=-1&&c.indexOf("]")!=-1){c=c.replace(/\[\d+\]/g,"[*]");if(this.fields&&this.fields[c]){var e=this._getConfigVal(this.fields[c],f);if(!a.isEmpty(e)){return e}}}if(!a.isEmpty(d)&&d&&this.field.path!="/"){return null}return this._getConfigVal(this,f)},_getConfigVal:function(d,e){if(a.isArray(e)){for(var c=0;c<e.length&&!a.isEmpty(d);c++){d=d[e[c]]}}else{if(!a.isEmpty(d)){d=d[e]}}return d},getInjectedStyle:function(f){var e=null;var c={};if(this.style){var d=a.styleInjections[this.style];if(d){a.mergeObject(d,c)}}return e[f]},tmpl:function(c,d){return a.tmpl(this,c,d)}})})(jQuery);(function(b){var a=b.alpaca;a.Field=Base.extend({constructor:function(d,h,l,g,j,f,i){var k=this;this.initializing=true;this.container=d;this.parent=null;this.data=h;this.options=l;this.schema=g;this.connector=f;this.errorCallback=function(m){if(i){i(m)}else{a.defaultErrorCallback.call(k,m)}};this.singleLevelRendering=false;this.view=new a.RuntimeView(j,this);var e=false;if(!this.options){this.options={};e=true}this.id=this.options.id;this.type=this.options.type;if(!this.id){this.id=a.generateId()}var c=false;if(!this.schema){this.schema={};c=true}if(!this.options.label&&this.schema.title!==null){this.options.label=this.schema.title}if(!this.options.helper&&this.schema.description!==null){this.options.helper=this.schema.description}if(a.isEmpty(this.options.readonly)&&!a.isEmpty(this.schema.readonly)){this.options.readonly=this.schema.readonly}if(a.isValEmpty(this.data)&&!a.isEmpty(this.schema["default"])){this.data=this.schema["default"];this.showingDefaultData=true}this.path="/";this.validation={};this._events={};this.isDisplayOnly=function(){return(k.view.type=="view")}},getDefaultFieldTemplateId:function(){return"controlField"},setDefaultTemplateDescriptor:function(){var c=this.view.getTemplateDescriptor(this.getDefaultFieldTemplateId());var d=this.view.getGlobalTemplateDescriptor();var e=this.view.getLayout();var f=false;if(!this.parent){if(d){this.setTemplateDescriptor(d);this.singleLevelRendering=true;f=true}else{if(e&&e.templateDescriptor){this.setTemplateDescriptor(e.templateDescriptor);f=true}}}if(!f&&c){this.setTemplateDescriptor(c)}},setup:function(){if(!this.initializing){this.data=this.getValue()}this.setDefaultTemplateDescriptor();if(a.isUndefined(this.schema.required)){this.schema.required=false}if(a.isUndefined(this.options.validate)){this.options.validate=true}if(a.isUndefined(this.options.disabled)){this.options.disabled=false}if(a.isUndefined(this.options.showMessages)){this.options.showMessages=true}},on:function(c,d){a.logDebug("Adding listener for event: "+c);this._events[c]=d;return this},triggerWithPropagation:function(c,d){this.trigger.call(this,c,d);if(this.parent){this.parent.triggerWithPropagation.call(this.parent,c,d)}},trigger:function(d,g){a.logDebug("Firing event: "+d);var f=this._events[d];var c=null;if(typeof(f)=="function"){a.logDebug("Found event handler, calling: "+d);try{c=f.call(this,g)}catch(h){a.logDebug("The event handler caught an exception: "+d)}}else{a.logDebug("Could not find an event handler for: "+d)}return c},bindData:function(){if(!a.isEmpty(this.data)){this.setValue(this.data)}},render:function(d,e){if(d&&(a.isString(d)||a.isObject(d))){this.view.setView(d)}else{if(a.isEmpty(e)&&a.isFunction(d)){e=d}}if(this.options.label===null&&this.propertyId){this.options.label=this.propertyId}if(this.options.name){this.name=this.options.name}if(!this.name){if(this.parent&&this.parent.name&&this.path){var c=this.path.substring(this.path.lastIndexOf("/")+1);if(c.indexOf("[")!=-1&&c.indexOf("]")!=-1){c=c.substring(c.indexOf("[")+1,c.indexOf("]"))}if(c){this.name=this.parent.name+"_"+c;this.nameCalculated=true}}else{if(this.path){this.name=this.path.replace(/\//g,"").replace(/\[/g,"_").replace(/\]/g,"");this.nameCalculated=true}}}this.setup();this._render(e)},_render:function(e){var d=this;if(this.getEl()){this.getEl().remove()}if(this.options.renderForm){this.options.form.viewType=this.view.type;var c=this.form;if(!c){c=new a.Form(this.container,this.options.form,this.view.id,this.connector,this.errorCallback)}c.render(function(f){d._processRender(f.formFieldsContainer,function(){d.getEl().appendTo(f.formFieldsContainer);f.topControl=d;if(d.view.type&&d.view.type!="view"){f.initEvents()}d.form=f;d.postRender();if(e&&a.isFunction(e)){e(d)}})})}else{this._processRender(this.container,function(){d.getEl().appendTo(d.container);d.postRender();if(e&&a.isFunction(e)){e(d)}})}},_processRender:function(e,h){var i=this;var d=this.getTemplateDescriptor();var c=this.data;if(this.isDisplayOnly()&&typeof(c)=="object"){c=JSON.stringify(c)}var f=i.view.tmpl(d,{id:this.getId(),options:this.options,schema:this.schema,data:c,view:this.view,path:this.path},{});f.appendTo(e);var g=f;if(f.size()>1){f.each(function(l,j){if(b(this).attr("data-control")=="append"){g=b(this)}})}this.setEl(g);if(!this.singleLevelRendering){if(!this.isDisplayOnly()||(!this.isControlField)){this.renderField(function(){if(h){h(this)}})}else{if(h){h(this)}}}else{if(h){h(this)}}},renderField:function(c){},getStyleInjection:function(e,f,d,c){if(this.view.style&&a.styleInjections[this.view.style]&&a.styleInjections[this.view.style][e]){a.styleInjections[this.view.style][e].call(this,f,d,c)}},postRender:function(){if(this.view.type!="view"){this.getStyleInjection("field",this.getEl());this.getEl().addClass("alpaca-field");if(this.getEl().attr("id")===null){this.getEl().attr("id",this.getId()+"-field-outer")}if(a.isEmpty(this.getEl().attr("alpaca-field-id"))){this.getEl().attr("alpaca-field-id",this.getId())}if(this.schema.required){this.getEl().addClass("alpaca-field-required")}else{this.getEl().addClass("alpaca-field-optional")}if(this.options.readonly){this.getEl().addClass("alpaca-field-readonly");b(":input",this.getEl()).attr("readonly","readonly");b("select",this.getEl()).attr("disabled","disabled");b(":radio",this.getEl()).attr("disabled","disabled");b(":checkbox",this.getEl()).attr("disabled","disabled")}var d=function(j,g){if(g){var h=0;var k=null;if(a.isArray(g)){for(h=0;h<g.length;h++){j.addClass(g[h])}}else{if(g.indexOf(",")>-1){k=g.split(",");for(h=0;h<k.length;h++){j.addClass(k[h])}}else{if(g.indexOf(" ")>-1){k=g.split(" ");for(h=0;h<k.length;h++){j.addClass(k[h])}}else{j.addClass(g)}}}}};d(this.getEl(),this.options.fieldClass);var e=this.view.getStyles();if(e){for(var c in e){b(c,this.container).css(e[c])}}if(this.labelDiv&&this.schema.required){this.getStyleInjection("required",this.labelDiv)}if(this.options.disabled){this.disable()}if(this.view.type&&this.view.type=="edit"){this.bindData()}else{if(this.showingDefaultData){this.bindData()}}if(this.view.type=="create"){a.logDebug("Skipping data binding for field: "+this.id+" since view mode is 'create'")}if(this.view.type&&this.view.type!="view"){this.initEvents()}}if(this.options.hidden){this.getEl().hide()}this.initializing=false;var f=(this.view.type=="create");this.hideInitValidationError=a.isValEmpty(this.options.hideInitValidationError)?f:this.options.hideInitValidationError;if(this.view.type!="view"){this.renderValidationState()}this.hideInitValidationError=false;if(!this.view.displayReadonly){b(".alpaca-field-readonly",this.getEl()).hide()}if(this.options.postRender){this.options.postRender(this)}},getEl:function(){return this.outerEl},setEl:function(c){this.outerEl=c},getId:function(){return this.id},getParent:function(){return this.parent},isTopLevel:function(){return a.isEmpty(this.parent)},getValue:function(){return this.data},setValue:function(c){this.data=c;this.triggerUpdate()},setDefault:function(){},getTemplateDescriptor:function(){return this.templateDescriptor},setTemplateDescriptor:function(c){this.templateDescriptor=c},displayMessage:function(d,c){var e=this;b("[id^='"+e.getId()+"-field-message']",e.getEl()).remove();if(d&&d.length>0){b.each(d,function(f,h){if(h.length>0){var g=e.view.getTemplateDescriptor("controlFieldMessage");if(g){e.messageElement=e.view.tmpl(g,{message:h});e.getStyleInjection("errorMessage",e.messageElement);if(e.hideInitValidationError){e.messageElement.addClass("alpaca-controlfield-message-hidden")}else{e.messageElement.addClass("alpaca-controlfield-message")}e.messageElement.attr("id",e.getId()+"-field-message-"+f);if(b(".alpaca-controlfield-message-container",e.getEl()).length){e.messageElement.appendTo(b(".alpaca-controlfield-message-container",e.getEl()))}else{e.messageElement.appendTo(e.getEl())}}e.getStyleInjection("tooltipErrorMessage",e.getEl(),h)}})}},renderValidationState:function(d){var c=function(g,n){if(this.options.validate){if(g&&this.children){for(var k=0;k<this.children.length;k++){c.call(this.children[k],g,true)}}var f=this.isValid();this.getStyleInjection("removeError",this.getEl());this.getEl().removeClass("alpaca-field-invalid alpaca-field-invalid-hidden alpaca-field-valid");if(this.validate()){this.triggerWithPropagation("validated");this.getEl().addClass("alpaca-field-valid")}else{this.triggerWithPropagation("invalidated");if(!this.options.readonly){if(!this.hideInitValidationError){this.getStyleInjection("error",this.getEl());this.getEl().addClass("alpaca-field-invalid")}else{this.getEl().addClass("alpaca-field-invalid-hidden")}}else{a.logWarn("The field (id="+this.getId()+", title="+this.getTitle()+", label="+this.options.label+") is invalid and also read-only")}}var e=this.isValid();if(this.options.showMessages){if(!this.initializing){if(!this.options.readonly){var j=[];for(var l in this.validation){if(!this.validation[l]["status"]){j.push(this.validation[l]["message"])}}this.displayMessage(j,f)}}}if(!n){var h=false;var m=this.parent;while(m){if(m.options&&(m.options.forceRevalidation||m.options.validator)){h=true}m=m.parent}if((f!=e&&this.parent&&this.parent.renderValidationState)||h){this.parent.renderValidationState()}}this._validateCustomValidator()}};c.call(this,d,false)},showHiddenMessages:function(){var c=b(".alpaca-field-invalid-hidden",this.outerEl);c.removeClass("alpaca-field-invalid-hidden");this.getStyleInjection("error",c);c.addClass("alpaca-field-invalid");b(".alpaca-controlfield-message-hidden",this.outerEl).removeClass("alpaca-controlfield-message-hidden").addClass("alpaca-controlfield-message")},updateValidationState:function(g,d){if(this.options.validate){var c=this.isValid();this.validation[g]=d;if(!this.hideInitValidationError){if(!this.options.readonly){if(d&&!d.status){this.getEl().removeClass("alpaca-field-valid");this.getStyleInjection("error",this.getEl());this.getEl().addClass("alpaca-field-invalid")}}}this.validation[g]=d;if(this.options.showMessages){if(!this.initializing){if(!this.hideInitValidationError){if(!this.options.readonly){var f=[];for(var e in this.validation){if(!this.validation[e]["status"]){f.push(this.validation[e]["message"])}}this.displayMessage(f,c)}}}}if(this.isValid()&&this.parent&&this.parent.renderValidationState){this.parent.renderValidationState()}}},validate:function(e){if(this.children&&e){for(var d=0;d<this.children.length;d++){var f=this.children[d];f.validate(e)}}var c=true;if(!this.initializing&&this.options.validate){c=this.handleValidate()}return c},handleValidate:function(){var d=this.validation;var c=this._validateOptional();d.notOptional={message:c?"":this.view.getMessage("notOptional"),status:c};c=this._validateDisallow();d.disallowValue={message:c?"":a.substituteTokens(this.view.getMessage("disallowValue"),[this.schema.disallow.join(",")]),status:c};return d.notOptional["status"]&&d.disallowValue["status"]},_validateCustomValidator:function(){var c=this;if(this.options.validator&&a.isFunction(this.options.validator)){this.options.validator(this,function(d){c.updateValidationState("customValidator",d)})}},_validateOptional:function(){if(this.schema.required&&this.isEmpty()){return false}return true},_validateDisallow:function(){if(!a.isValEmpty(this.schema.disallow)){var e=this.getValue();var d=this.schema.disallow;if(a.isArray(d)){var c=true;b.each(d,function(f,g){if((a.isObject(e)||a.isArray(e))&&a.isString(g)){g=a.parseJSON(g)}if(a.compareObject(e,g)){c=false}});return c}else{if((a.isObject(e)||a.isArray(e))&&a.isString(d)){d=a.parseJSON(d)}return !a.compareObject(e,d)}}return true},triggerUpdate:function(){this.getEl().trigger("fieldupdate")},disable:function(){},enable:function(){},focus:function(){},destroy:function(){if(a&&a.fieldInstances){if(a.fieldInstances[this.getId()]){delete a.fieldInstances[this.getId()]}}this.getEl().remove()},show:function(){if(this.options&&this.options.hidden){return}else{this.getEl().css({display:""});this.onShow()}},onShow:function(){},hide:function(){this.getEl().css({display:"none"});this.onHide()},onHide:function(){},isVisible:function(){return !this.isHidden()},isHidden:function(){return"none"==this.getEl().css("display")},print:function(){if(this.container.printArea){this.container.printArea()}},onDependentReveal:function(){},onDependentConceal:function(){},reload:function(){this.initializing=true;if(!a.isEmpty(this.callback)){this.callback(this,this.renderedCallback)}else{this.render(this.renderedCallback)}},clear:function(){var c=null;if(this.data){c=this.data}this.setValue(c)},isEmpty:function(){return a.isValEmpty(this.getValue())},isValid:function(c){if(c&&this.children){for(var e=0;e<this.children.length;e++){var f=this.children[e];if(!f.isValid(c)){return false}}}if(b.isEmptyObject(this.validation)){return true}else{for(var d in this.validation){if(!this.validation[d].status){return false}}return true}},initEvents:function(){var c=this;if(this.field){this.field.change(function(d){c.onChange.call(c,d);c.trigger("change",d)});this.field.focus(function(d){c.onFocus.call(c,d);c.trigger("focus",d)});this.field.blur(function(d){c.onBlur.call(c,d);c.trigger("blur",d)});this.field.mouseover(function(d){c.onMouseOver.call(c,d);c.trigger("mouseover",d)});this.field.mouseout(function(d){c.onMouseOut.call(c,d);c.trigger("mouseout",d)});b.each(this.options,function(d,f){if(a.startsWith(d,"onField")&&a.isFunction(f)){var e=d.substring(7).toLowerCase();c.field.on(e,function(g){f.call(c,g)})}})}},onFocus:function(c){this.getEl().removeClass("alpaca-field-empty");this.getEl().addClass("alpaca-field-focused")},onBlur:function(c){this.getEl().removeClass("alpaca-field-focused");this.renderValidationState()},onChange:function(c){this.data=this.getValue();this.triggerUpdate()},onMouseOver:function(c){},onMouseOut:function(c){},getControlByPath:function(f){var d=this;if(f){var e=f.split("/");for(var c=0;c<e.length;c++){if(!a.isValEmpty(e[c])){if(d&&d.childrenByPropertyId){if(d.childrenByPropertyId[e[c]]){d=d.childrenByPropertyId[e[c]]}else{return null}}else{return null}}else{return null}}return d}},getFieldType:function(){},getType:function(){},isContainer:function(){return false},getTitle:function(){},getDescription:function(){},getSchemaOfSchema:function(){var c={title:this.getTitle(),description:this.getDescription(),type:"object",properties:{title:{title:"Title",description:"Short description of the property.",type:"string"},description:{title:"Description",description:"Detailed description of the property.",type:"string"},readonly:{title:"Readonly",description:"Property will be readonly if true.",type:"boolean","default":false},required:{title:"Required",description:"Property value must be set if true.",type:"boolean","default":false},"default":{title:"Default",description:"Default value of the property.",type:"any"},type:{title:"Type",description:"Data type of the property.",type:"string",readonly:true},format:{title:"Format",description:"Data format of the property.",type:"string"},disallow:{title:"Disallowed Values",description:"List of disallowed values for the property.",type:"array"},dependencies:{title:"Dependencies",description:"List of property dependencies.",type:"array"}}};if(this.getType&&!a.isValEmpty(this.getType())){c.properties.type["default"]=this.getType();c.properties.type["enum"]=[this.getType()]}return c},getOptionsForSchema:function(){return{fields:{title:{helper:"Field short description",type:"text"},description:{helper:"Field detailed description",type:"textarea"},readonly:{helper:"Field will be read only if checked",rightLabel:"This field is read-only",type:"checkbox"},required:{helper:"Field value must be set if checked",rightLabel:"This field is required",type:"checkbox"},"default":{helper:"Field default value",type:"textarea"},type:{helper:"Field data type",type:"text"},format:{type:"select",dataSource:function(d,e){for(var c in a.defaultFormatFieldMapping){d.selectOptions.push({value:c,text:c})}if(e){e()}}},disallow:{helper:"Disallowed values for the field",itemLabel:"Value",type:"array"},dependencies:{helper:"Field Dependencies",multiple:true,size:3,type:"select",dataSource:function(d,e){if(d.parent&&d.parent.schemaParent&&d.parent.schemaParent.parent){for(var c in d.parent.schemaParent.parent.childrenByPropertyId){if(c!=d.parent.schemaParent.propertyId){d.selectOptions.push({value:c,text:c})}}}if(e){e()}}}}}},getSchemaOfOptions:function(){var c={title:"Options for "+this.getTitle(),description:this.getDescription()+" (Options)",type:"object",properties:{renderForm:{},form:{},id:{title:"Field Id",description:"Unique field id. Auto-generated if not provided.",type:"string"},type:{title:"Field Type",description:"Field type.",type:"string","default":this.getFieldType(),readonly:true},validate:{title:"Validation",description:"Field validation is required if true.",type:"boolean","default":true},showMessages:{title:"Show Messages",description:"Display validation messages if true.",type:"boolean","default":true},disabled:{title:"Disabled",description:"Field will be disabled if true.",type:"boolean","default":false},readonly:{title:"Readonly",description:"Field will be readonly if true.",type:"boolean","default":false},hidden:{title:"Hidden",description:"Field will be hidden if true.",type:"boolean","default":false},label:{title:"Label",description:"Field label.",type:"string"},helper:{title:"Helper",description:"Field help message.",type:"string"},fieldClass:{title:"CSS class",description:"Specifies one or more CSS classes that should be applied to the dom element for this field once it is rendered. Supports a single value, comma-delimited values, space-delimited values or values passed in as an array.",type:"string"},hideInitValidationError:{title:"Hide Initial Validation Errors",description:"Hide initial validation errors if true.",type:"boolean","default":false},focus:{title:"Focus",description:"If true, the initial focus for the form will be set to the first child element (usually the first field in the form). If a field name or path is provided, then the specified child field will receive focus. For example, you might set focus to 'name' (selecting the 'name' field) or you might set it to 'client/name' which picks the 'name' field on the 'client' object.",type:"checkbox","default":true},optionLabels:{title:"Enumerated Value Labels",description:"An array of string labels for items in the enum array",type:"array"}}};if(this.isTopLevel()){c.properties.renderForm={title:"Render Form",description:"Render a FORM tag as the container for the rest of fields if true.",type:"boolean","default":false};c.properties.form={title:"Form",description:"Options for rendering the FORM tag.",type:"object",dependencies:"renderForm",properties:{attributes:{title:"Form Attributes",description:"List of attributes for the FORM tag.",type:"object",properties:{id:{title:"Id",description:"Unique form id. Auto-generated if not provided.",type:"string"},action:{title:"Action",description:"Form submission endpoint",type:"string"},method:{title:"Method",description:"Form submission method","enum":["post","get"],type:"string"},name:{title:"Name",description:"Form name",type:"string"},focus:{title:"Focus",description:"Focus Setting",type:"any"}}},buttons:{title:"Form Buttons",description:"Configuration for form-bound buttons",type:"object",properties:{submit:{type:"object",title:"Submit Button",required:false},reset:{type:"object",title:"Reset button",required:false}}},toggleSubmitValidState:{title:"Toggle Submit Valid State",description:"Toggle the validity state of the Submit button",type:"boolean","default":true}}}}else{delete c.properties.renderForm;delete c.properties.form}return c},getOptionsForOptions:function(){var c={type:"object",fields:{id:{type:"text",readonly:true},type:{type:"text"},validate:{rightLabel:"Enforce validation",type:"checkbox"},showMessages:{rightLabel:"Show validation messages",type:"checkbox"},disabled:{rightLabel:"Disable this field",type:"checkbox"},hidden:{type:"checkbox",rightLabel:"Hide this field"},label:{type:"text"},helper:{type:"textarea"},fieldClass:{type:"text"},hideInitValidationError:{rightLabel:"Hide initial validation errors",type:"checkbox"},focus:{type:"checkbox",rightLabel:"Auto-focus first child field"},optionLabels:{type:"array",items:{type:"string"}}}};if(this.isTopLevel()){c.fields.renderForm={type:"checkbox",rightLabel:"Yes"};c.fields.form={type:"object",dependencies:{renderForm:true},fields:{attributes:{type:"object",fields:{id:{type:"text",readonly:true},action:{type:"text"},method:{type:"select"},name:{type:"text"}}}}}}return c}});a.registerMessages({disallowValue:"{0} are disallowed values.",notOptional:"This field is not optional."})})(jQuery);(function(b){var a=b.alpaca;a.ControlField=a.Field.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f);this.isControlField=true},setDefault:function(){var c=a.isEmpty(this.schema["default"])?"":this.schema["default"];this.setValue(c)},renderField:function(c){},injectField:function(e){var d=b(".alpaca-controlfield-container",this.outerEl);if(d.length){this.fieldContainer=d}else{this.fieldContainer=this.outerEl}var c=b(".alpaca-field-container-field",this.fieldContainer);if(c.length>0){if(c.attr("data-replace")=="true"){c.replaceWith(e)}else{e.appendTo(c)}}else{if(this.fieldContainer.attr("data-replace")=="true"){this.fieldContainer.replaceWith(e)}else{e.prependTo(this.fieldContainer)}}},postRender:function(){var d=b(".alpaca-controlfield-label",this.outerEl);if(d.length){this.labelDiv=d}var c=b(".alpaca-controlfield-helper",this.outerEl);if(c.length){this.helperDiv=c}this.base();this.outerEl.addClass("alpaca-controlfield")},_validateEnum:function(){if(this.schema["enum"]){var c=this.data;if(!this.schema.required&&a.isValEmpty(c)){return true}if(b.inArray(c,this.schema["enum"])>-1){return true}else{return false}}else{return true}},handleValidate:function(){var e=this.base();var d=this.validation;var c=this._validateEnum();d.invalidValueOfEnum={message:c?"":a.substituteTokens(this.view.getMessage("invalidValueOfEnum"),[this.schema["enum"].join(",")]),status:c};return e&&d.invalidValueOfEnum["status"]},initEvents:function(){this.base();var c=this;if(this.field){this.field.keypress(function(d){c.onKeyPress.call(c,d);c.trigger("keypress",d)});this.field.keyup(function(d){c.onKeyUp.call(c,d);c.trigger("keyup",d)});this.field.keydown(function(d){c.onKeyDown.call(c,d);c.trigger("keydown",d)});this.field.click(function(d){c.onClick.call(c,d);c.trigger("click",d)})}},onKeyPress:function(f){var c=this;var d=this.isValid();if(!d){window.setTimeout(function(){c.renderValidationState()},50)}},onKeyDown:function(c){},onKeyUp:function(c){},onClick:function(c){},getSchemaOfSchema:function(){return a.merge(this.base(),{properties:{"enum":{title:"Enumerated Values",description:"List of specific values for this property",type:"array"}}})},getOptionsForSchema:function(){return a.merge(this.base(),{fields:{"enum":{itemLabel:"Value",type:"array"}}})},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{name:{title:"Field Name",description:"Field Name.",type:"string"}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{name:{type:"text"}}})}});a.registerMessages({invalidValueOfEnum:"This field should have one of the values in {0}."})})(jQuery);(function(b){var a=b.alpaca;a.ContainerField=a.Field.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();var c=true;if(!a.isEmpty(this.view.collapsible)){c=this.view.collapsible}if(!a.isEmpty(this.options.collapsible)){c=this.options.collapsible}this.options.collapsible=c;var d="button";if(!a.isEmpty(this.view.legendStyle)){d=this.view.legendStyle}if(!a.isEmpty(this.options.legendStyle)){d=this.options.legendStyle}this.options.legendStyle=d;this.lazyLoading=false;if(!a.isEmpty(this.options.lazyLoading)){this.lazyLoading=this.options.lazyLoading;if(this.lazyLoading){this.options.collapsed=true}}this.children=[];this.childrenById=[];this.childrenByPropertyId=[];this.expandedIcon="";this.collapsedIcon="";this.commonIcon="";this.addIcon="";this.removeIcon="";this.upIcon="";this.downIcon="";if(this.view.style&&a.styleInjections[this.view.style]){if(a.styleInjections[this.view.style]["commonIcon"]){this.commonIcon=a.styleInjections[this.view.style]["commonIcon"]}if(a.styleInjections[this.view.style]["containerExpandedIcon"]){this.expandedIcon=a.styleInjections[this.view.style]["containerExpandedIcon"]}if(a.styleInjections[this.view.style]["containerCollapsedIcon"]){this.collapsedIcon=a.styleInjections[this.view.style]["containerCollapsedIcon"]}if(a.styleInjections[this.view.style]["buttonBeautifier"]){this.buttonBeautifier=a.styleInjections[this.view.style]["buttonBeautifier"]}if(a.styleInjections[this.view.style]["addIcon"]){this.addIcon=a.styleInjections[this.view.style]["addIcon"]}if(a.styleInjections[this.view.style]["removeIcon"]){this.removeIcon=a.styleInjections[this.view.style]["removeIcon"]}if(a.styleInjections[this.view.style]["upIcon"]){this.upIcon=a.styleInjections[this.view.style]["upIcon"]}if(a.styleInjections[this.view.style]["downIcon"]){this.downIcon=a.styleInjections[this.view.style]["downIcon"]}}},getDefaultFieldTemplateId:function(){return"fieldSet"},setDefaultTemplateDescriptor:function(){this.base()},addChild:function(d,c){if(!a.isEmpty(c)){this.children.splice(c,0,d)}else{this.children.push(d)}this.childrenById[d.getId()]=d;if(d.propertyId){this.childrenByPropertyId[d.propertyId]=d}d.parent=this},initEvents:function(){var d=this;if(this.labelDiv){if(this.options.collapsible){this.labelDiv.addClass("legend-expanded");this.fieldSetDiv.addClass("fieldset-expanded");var c=this.expandedIcon;if(!a.isEmpty(this.options.collapsed)&&this.options.collapsed){c=this.collapsedIcon;this.labelDiv.nextAll(".alpaca-fieldset-helper").slideToggle(500);this.labelDiv.nextAll(".alpaca-fieldset-items-container").slideToggle(500);this.labelDiv.nextAll(".alpaca-fieldset-array-toolbar").slideToggle(500);this.fieldSetDiv.toggleClass("fieldset-expanded");this.fieldSetDiv.toggleClass("fieldset-collapsed");this.labelDiv.toggleClass("legend-expanded");this.labelDiv.toggleClass("legend-collapsed")}if(this.options.legendStyle=="link"){b('<span class="'+this.commonIcon+" "+c+' alpaca-fieldset-legend-link"></span>').prependTo(this.labelDiv);this.labelDiv.click(function(){d.fieldSetDiv.toggleClass("fieldset-collapsed");d.fieldSetDiv.toggleClass("fieldset-expanded");b(this).toggleClass("legend-collapsed");b(this).toggleClass("legend-expanded");b(".alpaca-fieldset-legend-link",this).toggleClass(d.collapsedIcon).toggleClass(d.expandedIcon);b(this).nextAll(".alpaca-fieldset-helper").slideToggle(500);b(this).nextAll(".alpaca-fieldset-items-container").slideToggle(500);b(this).nextAll(".alpaca-fieldset-array-toolbar").slideToggle(500)})}if(this.options.legendStyle=="button"){if(this.buttonBeautifier){this.buttonBeautifier.call(this,this.labelDiv,c,true)}this.labelDiv.click(function(){d.fieldSetDiv.toggleClass("fieldset-collapsed");d.fieldSetDiv.toggleClass("fieldset-expanded");b(this).toggleClass("legend-collapsed");b(this).toggleClass("legend-expanded");b(".alpaca-fieldset-legend-button",this).toggleClass(d.collapsedIcon).toggleClass(d.expandedIcon);b(this).nextAll(".alpaca-fieldset-helper").slideToggle(500);b(this).nextAll(".alpaca-fieldset-items-container").slideToggle(500);b(this).nextAll(".alpaca-fieldset-array-toolbar").slideToggle(500)})}}}},clear:function(c){a.each(this.children,function(){this.clear(false)});if(!c){this.triggerUpdate()}},setDefault:function(){if(a.isEmpty(this.schema["default"])){a.each(this.children,function(){this.setDefault()})}else{this.setValue(this.schema["default"])}},destroy:function(){if(this.form){this.form.destroy(true);delete this.form}a.each(this.children,function(){this.destroy()});this.base()},renderItemContainer:function(k,j,f){var h=this;var g=this.view.getTemplateDescriptor("fieldSetItemContainer");if(g){var d=h.view.tmpl(g,{});if(d.attr("data-replace")=="true"){return this.fieldContainer}else{if(k){b("#"+k+"-item-container",this.outerEl).after(d)}else{var e=this.fieldContainer;var c=this.view.getLayout().bindings;if(c){var i=c[f];if(i&&b("#"+i,e).length>0){e=b("#"+i,e)}}d.appendTo(e)}}return d}else{return this.fieldContainer}},renderField:function(f){var g=this;this.getStyleInjection("container",this.outerEl);var d=b(".alpaca-fieldset-legend",this.outerEl);if(d.length){this.labelDiv=d}else{this.outerEl.addClass("alpaca-fieldset-no-legend")}var c=b(".alpaca-fieldset",this.outerEl);if(c.length){this.fieldSetDiv=c}else{this.fieldSetDiv=this.outerEl}var e=b(".alpaca-fieldset-items-container",this.outerEl);if(e.length){this.fieldContainer=e}else{this.fieldContainer=this.outerEl}if(!this.singleLevelRendering&&!this.lazyLoading){this.renderItems()}if(this.lazyLoading){if(this.labelDiv){b(this.labelDiv).click(function(){if(g.lazyLoading){g.renderItems();g.lazyLoading=false}})}}if(f){f()}},onDependentReveal:function(){for(var c=0;c<this.children.length;c++){this.children[c].onDependentReveal()}},onDependentConceal:function(){for(var c=0;c<this.children.length;c++){this.children[c].onDependentConceal()}},renderItems:function(c){},isContainer:function(){return true},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{lazyLoading:{title:"Lazy Loading",description:"Child fields will only be rendered when the fieldset is expanded if this option is set true.",type:"boolean","default":false},collapsible:{title:"Collapsible",description:"Field set is collapsible if true.",type:"boolean","default":true},collapsed:{title:"Collapsed",description:"Field set is initially collapsed if true.",type:"boolean","default":false},legendStyle:{title:"Legend Style",description:"Field set legend style.",type:"string","enum":["button","link"],"default":"button"}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{lazyLoading:{rightLabel:"Lazy loading child fields ?",helper:"Lazy loading will be enabled if checked.",type:"checkbox"},collapsible:{rightLabel:"Field set collapsible ?",helper:"Field set is collapsible if checked.",type:"checkbox"},collapsed:{rightLabel:"Field set initially collapsed ?",description:"Field set is initially collapsed if checked.",type:"checkbox"},legendStyle:{type:"select"}}})}})})(jQuery);(function(b){var a=b.alpaca;a.Connector=Base.extend({constructor:function(c){this.id=c},connect:function(d,c){if(d&&a.isFunction(d)){d()}},loadTemplate:function(d,e,c){if(!a.isEmpty(d)){if(a.isUri(d)){this.loadUri(d,false,function(f){if(e&&a.isFunction(e)){e(f)}},function(f){if(c&&a.isFunction(c)){c(f)}})}else{e(d)}}else{c({message:"Empty data source.",reason:"TEMPLATE_LOADING_ERROR"})}},loadData:function(f,c,d){var e=function(){return !a.isEmpty(f)&&a.isUri(f)};if(e()){this.loadJson(f,function(g){c(g)},d)}else{c(f)}},loadSchema:function(f,c,d){var e=function(){return !a.isEmpty(f)&&a.isUri(f)};if(e()){this.loadJson(f,function(g){c(g)},d)}else{c(f)}},loadOptions:function(f,c,d){var e=function(){return !a.isEmpty(f)&&a.isUri(f)};if(e()){this.loadJson(f,function(g){c(g)},d)}else{c(f)}},loadView:function(f,c,d){var e=function(){return !a.isEmpty(f)&&a.isUri(f)};if(e()){this.loadJson(f,function(g){c(g)},d)}else{c(f)}},loadAll:function(d,k,i){var c=d.dataSource;var l=d.schemaSource;var n=d.optionsSource;var j=d.viewSource;if(!l){l=d.schema}if(!n){n=d.options}if(!j){j=d.view}var g={};var e=0;var m=0;var f=function(){if(e===m){if(k&&a.isFunction(k)){k(g.data,g.options,g.schema,g.view)}}};var h=function(o){if(i&&a.isFunction(i)){i(o)}};if(c){m++}if(l){m++}if(n){m++}if(j){m++}if(m===0){f();return}if(c){this.loadData(c,function(o){g.data=o;e++;f()},h)}if(l){this.loadSchema(l,function(o){g.schema=o;e++;f()},h)}if(n){this.loadOptions(n,function(o){g.options=o;e++;f()},h)}if(j){this.loadView(j,function(o){g.view=o;e++;f()},h)}},loadJson:function(d,e,c){this.loadUri(d,true,e,c)},loadUri:function(e,c,g,d){var f={url:e,type:"get",success:function(h){if(g&&a.isFunction(g)){g(h)}},error:function(h,j,i){if(d&&a.isFunction(d)){d({message:"Unable to load data from uri : "+e,stage:"DATA_LOADING_ERROR",details:{jqXHR:h,textStatus:j,errorThrown:i}})}}};if(c){f.dataType="json"}else{f.dataType="text"}b.ajax(f)}});a.registerConnectorClass("default",a.Connector)})(jQuery);(function(b){var a=b.alpaca;a.Form=Base.extend({constructor:function(e,g,c,d,f){var h=this;this.container=e;this.parent=null;this.connector=d;this.errorCallback=f;this.options=g;if(this.options.attributes){this.attributes=this.options.attributes}else{this.attributes={}}if(this.options.buttons){if(this.options.buttons.submit){if(!this.options.buttons.submit.type){this.options.buttons.submit.type="submit"}if(!this.options.buttons.submit.name){this.options.buttons.submit.name="submit"}if(!this.options.buttons.submit.value){this.options.buttons.submit.value="Submit"}}if(this.options.buttons.reset){if(!this.options.buttons.reset.type){this.options.buttons.reset.type="reset"}if(!this.options.buttons.reset.name){this.options.buttons.reset.name="reset"}if(!this.options.buttons.reset.value){this.options.buttons.reset.value="Reset"}}}if(this.attributes.id){this.id=this.attributes.id}else{this.id=a.generateId();this.attributes.id=this.id}if(this.options.buttons&&this.options.buttons.submit&&a.isUndefined(this.options.toggleSubmitValidState)){this.options.toggleSubmitValidState=true}this.viewType=g.viewType;this.view=new a.RuntimeView(c,this)},render:function(c){var d=this;this.templateDescriptor=this.view.getTemplateDescriptor("form");if(this.outerEl){this.outerEl.remove()}this.processRender(this.container,function(){d.outerEl.appendTo(d.container);d.outerEl.addClass("alpaca-form");if(c){c(d)}})},isFormValid:function(){this.topControl.validate(true);var c=this.topControl.isValid(true);this.renderValidationState();return c},validate:function(c){return this.topControl.validate(c)},enableSubmitButton:function(){b(".alpaca-form-button-submit").attrProp("disabled",false);if(b.mobile){try{b(".alpaca-form-button-submit").button("refresh")}catch(c){}}},disableSubmitButton:function(){b(".alpaca-form-button-submit").attrProp("disabled",true);if(b.mobile){try{b(".alpaca-form-button-submit").button("refresh")}catch(c){}}},adjustSubmitButtonState:function(){this.disableSubmitButton();var c=this.isFormValid();console.log("isFormValid: "+c);if(this.isFormValid()){this.enableSubmitButton()}},processRender:function(e,g){var h=this;var c=this.getTemplateDescriptor();var d={id:this.getId(),options:this.options,view:this.view};var f=h.view.tmpl(c,d,{});f.appendTo(e);this.outerEl=f;if(a.isEmpty(this.outerEl.attr("id"))){this.outerEl.attr("id",this.getId()+"-form-outer")}if(a.isEmpty(this.outerEl.attr("alpaca-field-id"))){this.outerEl.attr("alpaca-field-id",this.getId())}if(b(".alpaca-form-fields-container",this.outerEl)){this.formFieldsContainer=b(".alpaca-form-fields-container",this.outerEl)}else{this.formFieldsContainer=this.outerEl}this.field=b("form",this.container);if(this.field){this.field.attr(this.attributes)}this.buttons={};b.each(b(".alpaca-form-button",this.container),function(j,i){b(i).mousedown(function(){var k=b(this);k.attr("button-pushed","true");setTimeout(function(){if(k.attr("button-pushed")&&k.attr("button-pushed")=="true"){k.click()}},150)});b(i).click(function(){b(this).removeAttr("button-pushed")});h.buttons[b(i).attr("data-key")]=b(i)});g()},getEl:function(){return this.outerEl},getId:function(){return this.id},getType:function(){return this.type},getParent:function(){return this.parent},getValue:function(){return this.topControl.getValue()},setValue:function(c){this.topControl.setValue(c)},initEvents:function(){var d=this;if(this.field){var c=this.getValue();b(this.field).submit(c,function(f){return d.onSubmit(f,d)})}if(this.options.toggleSubmitValidState){b(d.topControl.getEl()).bind("fieldupdate",function(){d.adjustSubmitButtonState()});this.adjustSubmitButtonState()}},onSubmit:function(f,d){if(this.submitHandler){f.stopPropagation();var c=this.submitHandler(f,d);if(a.isUndefined(c)){c=false}return c}},registerSubmitHandler:function(c){if(a.isFunction(c)){this.submitHandler=c}},renderValidationState:function(c){this.topControl.renderValidationState(c)},disable:function(){this.topControl.disable()},enable:function(){this.topControl.enable()},focus:function(){this.topControl.focus()},destroy:function(c){this.getEl().remove();if(!c){this.parent.destroy()}},show:function(){this.getEl().css({display:""})},hide:function(){this.getEl().css({display:"none"})},clear:function(c){this.topControl.clear(c)},isEmpty:function(){return this.topControl.isEmpty()},getTemplateDescriptor:function(){return this.templateDescriptor},setTemplateDescriptor:function(c){this.templateDescriptor=c}})})(jQuery);(function(b){var a=b.alpaca;a.Fields.TextField=a.ControlField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();if(!this.options.size){this.options.size=40}this.controlFieldTemplateDescriptor=this.view.getTemplateDescriptor("controlFieldText")},destroy:function(){this.base();if(this.field&&this.field.typeahead&&this.options.typeahead){b(this.field).typeahead("destroy")}},renderField:function(c){var d=this;if(this.controlFieldTemplateDescriptor){this.field=d.view.tmpl(this.controlFieldTemplateDescriptor,{id:this.getId(),name:this.name,options:this.options});this.injectField(this.field)}if(c){c()}},postRender:function(){var e=this;this.base();if(this.field){if(this.field&&this.field.mask&&this.options.maskString){this.field.mask(this.options.maskString)}if(this.field&&this.field.typeahead&&this.options.typeahead){var c={};for(var d in this.options.typeahead){c[d]=this.options.typeahead[d]}if(!c.name){c.name=this.getId()}b(this.field).typeahead(c);b(this.field).on("typeahead:autocompleted",function(g,f){e.setValue(f.value)});b(this.field).on("typeahead:selected",function(g,f){e.setValue(f.value)});if(c.events){if(c.events.autocompleted){b(this.field).on("typeahead:autocompleted",function(g,f){c.events.autocompleted(g,f)})}if(c.events.selected){b(this.field).on("typeahead:selected",function(g,f){c.events.selected(g,f)})}}}if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-text")}}},getValue:function(){var c=null;if(this.field){c=this.field.val()}else{c=this.base()}return c},setValue:function(c){if(this.field){if(a.isEmpty(c)){this.field.val("")}else{this.field.val(c)}}this.base(c)},handleValidate:function(){var e=this.base();var d=this.validation;var c=this._validatePattern();d.invalidPattern={message:c?"":a.substituteTokens(this.view.getMessage("invalidPattern"),[this.schema.pattern]),status:c};c=this._validateMaxLength();d.stringTooLong={message:c?"":a.substituteTokens(this.view.getMessage("stringTooLong"),[this.schema.maxLength]),status:c};c=this._validateMinLength();d.stringTooShort={message:c?"":a.substituteTokens(this.view.getMessage("stringTooShort"),[this.schema.minLength]),status:c};return e&&d.invalidPattern["status"]&&d.stringTooLong["status"]&&d.stringTooShort["status"]},_validatePattern:function(){if(this.schema.pattern){var c=this.getValue();if(c===""&&this.options.allowOptionalEmpty&&!this.schema.required){return true}if(a.isEmpty(c)){c=""}if(!c.match(this.schema.pattern)){return false}}return true},_validateMinLength:function(){if(!a.isEmpty(this.schema.minLength)){var c=this.getValue();if(c===""&&this.options.allowOptionalEmpty&&!this.schema.required){return true}if(a.isEmpty(c)){c=""}if(c.length<this.schema.minLength){return false}}return true},_validateMaxLength:function(){if(!a.isEmpty(this.schema.maxLength)){var c=this.getValue();if(c===""&&this.options.allowOptionalEmpty&&!this.schema.required){return true}if(a.isEmpty(c)){c=""}if(c.length>this.schema.maxLength){return false}}return true},disable:function(){if(this.field){this.field.disabled=true}},enable:function(){if(this.field){this.field.disabled=false}},focus:function(){if(this.field){this.field.focus()}},getSchemaOfSchema:function(){return a.merge(this.base(),{properties:{minLength:{title:"Minimal Length",description:"Minimal length of the property value.",type:"number"},maxLength:{title:"Maximum Length",description:"Maximum length of the property value.",type:"number"},pattern:{title:"Pattern",description:"Regular expression for the property value.",type:"string"}}})},getOptionsForSchema:function(){return a.merge(this.base(),{fields:{"default":{helper:"Field default value",type:"text"},minLength:{type:"integer"},maxLength:{type:"integer"},pattern:{type:"text"}}})},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{size:{title:"Field Size",description:"Field size.",type:"number","default":40},maskString:{title:"Mask Expression",description:"Expression for the field mask. Field masking will be enabled if not empty.",type:"string"},placeholder:{title:"Field Placeholder",description:"Field placeholder.",type:"string"},typeahead:{title:"Type Ahead",description:"Provides configuration for the $.typeahead plugin if it is available. For full configuration options, see: https://github.com/twitter/typeahead.js"},allowOptionalEmpty:{title:"Allow Optional Empty",description:"Allows this non-required field to validate when the value is empty"}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{size:{type:"integer"},maskString:{helper:"a - an alpha character;9 - a numeric character;* - an alphanumeric character",type:"text"},typeahead:{type:"object"},allowOptionalEmpty:{type:"checkbox"}}})},getTitle:function(){return"Single-Line Text"},getDescription:function(){return"Text field for single-line text."},getType:function(){return"string"},getFieldType:function(){return"text"}});a.registerTemplate("controlFieldText",'<input type="text" id="${id}" {{if options.placeholder}}placeholder="${options.placeholder}"{{/if}} {{if options.size}}size="${options.size}"{{/if}} {{if options.readonly}}readonly="readonly"{{/if}} {{if name}}name="${name}"{{/if}} {{each(i,v) options.data}}data-${i}="${v}"{{/each}}/>');a.registerMessages({invalidPattern:"This field should have pattern {0}",stringTooShort:"This field should contain at least {0} numbers or characters",stringTooLong:"This field should contain at most {0} numbers or characters"});a.registerFieldClass("text",a.Fields.TextField);a.registerDefaultSchemaFieldMapping("string","text")})(jQuery);(function(b){var a=b.alpaca;a.Fields.TextAreaField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();if(!this.options.rows){this.options.rows=5}if(!this.options.cols){this.options.cols=40}this.controlFieldTemplateDescriptor=this.view.getTemplateDescriptor("controlFieldTextarea")},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-textarea")}},handleValidate:function(){var e=this.base();var d=this.validation;var c=this._validateWordCount();d.wordLimitExceeded={message:c?"":a.substituteTokens(this.view.getMessage("wordLimitExceeded"),[this.options.wordlimit]),status:c};return e&&d.wordLimitExceeded["status"]},_validateWordCount:function(){if(this.options.wordlimit&&this.options.wordlimit>-1){var d=this.data;if(d){var c=d.split(" ").length;if(c>this.options.wordlimit){return false}}}return true},setValue:function(c){b(this.field).val(c);this.base(c)},getValue:function(){return b(this.field).val()},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{rows:{title:"Rows",description:"Number of rows",type:"number","default":5},cols:{title:"Columns",description:"Number of columns",type:"number","default":40},wordlimit:{title:"Word Limit",description:"Limits the number of words allowed in the text area.",type:"number","default":-1}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{rows:{type:"integer"},cols:{type:"integer"},wordlimit:{type:"integer"}}})},getTitle:function(){return"Multi-Line Text"},getDescription:function(){return"Textarea field for multiple line text."},getFieldType:function(){return"textarea"}});a.registerMessages({wordLimitExceeded:"The maximum word limit of {0} has been exceeded."});a.registerTemplate("controlFieldTextarea",'<textarea id="${id}" {{if options.rows}}rows="${options.rows}"{{/if}} {{if options.cols}}cols="${options.cols}"{{/if}} {{if options.readonly}}readonly="readonly"{{/if}} {{if name}}name="${name}"{{/if}} {{each options.data}}data-${fieldId}="${value}"{{/each}}/>');a.registerFieldClass("textarea",a.Fields.TextAreaField)})(jQuery);(function(b){var a=b.alpaca;a.Fields.CheckBoxField=a.ControlField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();if(!this.options.rightLabel){this.options.rightLabel=""}},onClick:function(c){this.renderValidationState()},renderField:function(d){var e=this;var c=this.view.getTemplateDescriptor("controlFieldCheckbox");if(c){this.field=e.view.tmpl(c,{id:this.getId(),name:this.name,options:this.options});this.injectField(this.field);this.field=b('input[id="'+this.getId()+'"]',this.field);if(this.data){this.setValue(true)}}if(d){d()}},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-checkbox")}},getValue:function(){return a.checked(this.field)},setValue:function(c){if(a.isString(c)){c=(c==="true")}a.checked(this.field,c);this.base(c)},disable:function(){this.field.disabled=true},enable:function(){this.field.disabled=false},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{rightLabel:{title:"Option Label",description:"Optional right-hand side label for checkbox field.",type:"string"}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{rightLabel:{type:"text"}}})},getTitle:function(){return"Checkbox Field"},getDescription:function(){return"Checkbox Field for boolean data."},getType:function(){return"boolean"},getFieldType:function(){return"checkbox"}});a.registerTemplate("controlFieldCheckbox",'<span><input type="checkbox" id="${id}" {{if options.readonly}}readonly="readonly"{{/if}} {{if name}}name="${name}"{{/if}} {{each(i,v) options.data}}data-${i}="${v}"{{/each}}/>{{if options.rightLabel}}<label for="${id}">${options.rightLabel}</label>{{/if}}</span>');a.registerFieldClass("checkbox",a.Fields.CheckBoxField);a.registerDefaultSchemaFieldMapping("boolean","checkbox")})(jQuery);(function(b){var a=b.alpaca;a.Fields.FileField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();this.controlFieldTemplateDescriptor=this.view.getTemplateDescriptor("controlFieldFile")},setValue:function(d){var c=this.field;this.field=b(".alpaca-filefield-control",this.fieldContainer);this.base(d);this.field=c},onChange:function(c){this.base(c);if(this.options.selectionHandler){this.processSelectionHandler(c.target.files)}},processSelectionHandler:function(g){if(g&&g.length>0){if(typeof(FileReader)!=="undefined"){var e=[];var f=0;var c=new FileReader();c.onload=(function(){var h=this;return function(j){var i=j.target.result;e.push(i);f++;if(f===g.length){h.options.selectionHandler.call(h,g,e)}}}).call(this);for(var d=0;d<g.length;d++){c.readAsDataURL(g[d])}}}},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-file")}},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{selectionHandler:{title:"Selection Handler",description:"Function that should be called when files are selected. Requires HTML5.",type:"boolean","default":false}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{selectionHandler:{type:"checkbox"}}})},getTitle:function(){return"File Field"},getDescription:function(){return"Field for uploading files."},getFieldType:function(){return"file"}});a.registerTemplate("controlFieldFile",'<input type="file" id="${id}" {{if options.size}}size="${options.size}"{{/if}} {{if options.readonly}}readonly="readonly"{{/if}} {{if name}}name="${name}"{{/if}} {{each(i,v) options.data}}data-${i}="${v}"{{/each}}/>');a.registerFieldClass("file",a.Fields.FileField)})(jQuery);(function(b){var a=b.alpaca;a.Fields.ListField=a.ControlField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){var c=this;c.base();c.selectOptions=[];if(c.getEnum()){b.each(c.getEnum(),function(d,e){var f=e;if(c.options.optionLabels){if(!a.isEmpty(c.options.optionLabels[d])){f=c.options.optionLabels[d]}else{if(!a.isEmpty(c.options.optionLabels[e])){f=c.options.optionLabels[e]}}}c.selectOptions.push({value:e,text:f})})}},getEnum:function(){if(this.schema&&this.schema["enum"]){return this.schema["enum"]}},getValue:function(c){var d=this;if(a.isArray(c)){b.each(c,function(e,f){b.each(d.selectOptions,function(h,g){if(g.value==f){c[e]=g.value}})})}else{b.each(this.selectOptions,function(f,e){if(e.value==c){c=e.value}})}return c},renderField:function(e){var f=this;if(this.options.dataSource){if(a.isFunction(this.options.dataSource)){this.options.dataSource(this,function(){f._renderField(e)})}else{if(a.isUri(this.options.dataSource)){b.ajax({url:this.options.dataSource,type:"get",dataType:"json",success:function(h){var g=h;if(f.options.dsTransformer&&a.isFunction(f.options.dsTransformer)){g=f.options.dsTransformer(g)}if(g){if(a.isArray(g)){b.each(g,function(i,j){f.selectOptions.push({value:j,text:j})})}if(a.isObject(g)){b.each(g,function(i,j){f.selectOptions.push({value:i,text:j})})}}f._renderField(e)},error:function(g,i,h){f.errorCallback({message:"Unable to load data from uri : "+f.options.dataSource,stage:"DATASOURCE_LOADING_ERROR",details:{jqXHR:g,textStatus:i,errorThrown:h}})}})}else{var d=this.options.dataSource;if(f.options.dsTransformer&&a.isFunction(f.options.dsTransformer)){d=f.options.dsTransformer(d)}if(d){if(a.isArray(d)){b.each(d,function(g,h){f.selectOptions.push({value:h,text:h})})}if(a.isObject(d)){for(var c in d){f.selectOptions.push({value:c,text:d[c]})}}f._renderField(e)}}}}else{this._renderField(e)}},getSchemaOfSchema:function(){return a.merge(this.base(),{properties:{"enum":{title:"Enumeration",description:"List of field value options",type:"array",required:true}}})},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{optionLabels:{title:"Option Labels",description:"Labels for options. It can either be a map object or an array field that maps labels to items defined by enum schema property one by one.",type:"array"},dataSource:{title:"Option Datasource",description:"Datasource for generating list of options.",type:"string"}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{optionLabels:{itemLabel:"Label",type:"array"},dataSource:{type:"text"}}})}})})(jQuery);(function(b){var a=b.alpaca;a.Fields.RadioField=a.Fields.ListField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();if(this.options.name){this.name=this.options.name}else{if(!this.name){this.name=this.getId()+"-name"}}if(a.isUndefined(this.options.emptySelectFirst)){this.options.emptySelectFirst=false}},getValue:function(){var c=this.base(b("input:radio[name="+this.name+"]:checked",this.field).val());b.each(this.selectOptions,function(){if(String(this["value"])==c){c=this["value"]}});return c},setValue:function(c){if(c!=this.getValue()){b.each(b("input:radio[name="+this.name+"]",this.field),function(){if(b(this).val()==c){b(this).attr("checked","checked")}else{b(this).removeAttr("checked")}});if(this.options.emptySelectFirst){if(b("input:radio:checked",this.field).length===0){b("input:radio:first",this.field).attr("checked","checked")}}this.base(c)}},_renderField:function(d){var e=this;var c=this.view.getTemplateDescriptor("controlFieldRadio");if(c){this.field=e.view.tmpl(c,{id:this.getId(),options:this.options,selectOptions:this.selectOptions,required:this.schema.required,name:this.name,data:this.data});if(this.options.emptySelectFirst&&this.selectOptions&&this.selectOptions.length>0){this.data=this.selectOptions[0].value;if(b("input:radio:checked",this.field).length===0){b("input:radio:first",this.field).attr("checked","checked")}}if(this.options.vertical){b(".alpaca-controlfield-radio-item",this.field).css("display","block")}this.injectField(this.field)}if(d){d()}},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-radio")}},onClick:function(c){this.base(c);var d=this;a.later(25,this,function(){var e=d.getValue();d.setValue(e);d.renderValidationState()})},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{name:{title:"Field name",description:"Field name.",type:"string"},emptySelectFirst:{title:"Empty Select First",description:"If the data is empty, then automatically select the first item in the list.",type:"boolean","default":false},vertical:{title:"Position the radio selector items vertically",description:"When true, the radio selector items will be stacked vertically and not horizontally",type:"boolean","default":false}}})},getTitle:function(){return"Radio Group Field"},getDescription:function(){return"Radio Group Field with list of options."},getFieldType:function(){return"radio"}});a.registerTemplate("controlFieldRadio",'<div id="${id}" class="alpaca-controlfield-radio">{{if !required}}<span class="alpaca-controlfield-radio-item"><input type="radio" {{if options.readonly}}readonly="readonly"{{/if}} name="${name}" value=""/><span class="alpaca-controlfield-radio-label">None</span></span>{{/if}}{{each selectOptions}}<span class="alpaca-controlfield-radio-item"><input type="radio" {{if options.readonly}}readonly="readonly"{{/if}} name="${name}" value="${value}" {{if value == data}}checked="checked"{{/if}}/><span class="alpaca-controlfield-radio-label">${text}</span></span>{{/each}}</div>');a.registerFieldClass("radio",a.Fields.RadioField)})(jQuery);(function(b){var a=b.alpaca;a.Fields.SelectField=a.Fields.ListField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();if(a.isUndefined(this.options.emptySelectFirst)){this.options.emptySelectFirst=false}},getValue:function(){if(this.field){return this.base(this.field.val())}},setValue:function(c){if(a.isArray(c)){if(!a.compareArrayContent(c,this.getValue())){if(!a.isEmpty(c)&&this.field){this.field.val(c)}this.base(c)}}else{if(c!=this.getValue()){if(!a.isEmpty(c)&&this.field){this.field.val(c)}this.base(c)}}},getEnum:function(){if(this.schema){if(this.schema["enum"]){return this.schema["enum"]}else{if(this.schema.type&&this.schema.type=="array"&&this.schema.items&&this.schema.items["enum"]){return this.schema.items["enum"]}}}},_renderField:function(d){var e=this;if(this.schema.type&&this.schema.type=="array"){this.options.multiple=true}var c;if(this.options.multiple&&a.isArray(this.data)){c=this.view.getTemplateDescriptor("controlFieldSelectMultiple")}else{c=this.view.getTemplateDescriptor("controlFieldSelect")}if(c){this.field=e.view.tmpl(c,{id:this.getId(),options:this.options,required:this.schema.required,selectOptions:this.selectOptions,name:this.name,data:this.data});if(a.isUndefined(this.data)&&this.options.emptySelectFirst&&this.selectOptions&&this.selectOptions.length>0){this.data=this.selectOptions[0].value}this.injectField(this.field);if(this.data){this.setValue(this.data)}}if(d){d()}},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-select")}},_validateEnum:function(){if(this.schema["enum"]){var d=this.data;if(!this.schema.required&&a.isValEmpty(d)){return true}if(this.options.multiple){var c=true;var e=this;b.each(d,function(g,f){if(b.inArray(f,e.schema["enum"])<=-1){c=false;return false}});return c}else{return(b.inArray(d,this.schema["enum"])>-1)}}else{return true}},onChange:function(c){this.base(c);var d=this;a.later(25,this,function(){var e=d.getValue();d.setValue(e);d.renderValidationState()})},_validateMinItems:function(){if(this.schema.items&&this.schema.items.minItems){if(b(":selected",this.field).length<this.schema.items.minItems){return false}}return true},_validateMaxItems:function(){if(this.schema.items&&this.schema.items.maxItems){if(b(":selected",this.field).length>this.schema.items.maxItems){return false}}return true},handleValidate:function(){var e=this.base();var d=this.validation;var c=this._validateMaxItems();d.tooManyItems={message:c?"":a.substituteTokens(this.view.getMessage("tooManyItems"),[this.schema.items.maxItems]),status:c};c=this._validateMinItems();d.notEnoughItems={message:c?"":a.substituteTokens(this.view.getMessage("notEnoughItems"),[this.schema.items.minItems]),status:c};return e&&d.tooManyItems["status"]&&d.notEnoughItems["status"]},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{multiple:{title:"Mulitple Selection",description:"Allow multiple selection if true.",type:"boolean","default":false},size:{title:"Displayed Options",description:"Number of options to be shown.",type:"number"},emptySelectFirst:{title:"Empty Select First",description:"If the data is empty, then automatically select the first item in the list.",type:"boolean","default":false}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{multiple:{rightLabel:"Allow mulitple selection ?",helper:"Allow multiple selection if checked",type:"checkbox"},size:{type:"integer"}}})},getTitle:function(){return"Dropdown Select"},getDescription:function(){return"Dropdown select field."},getFieldType:function(){return"select"}});a.registerTemplate("controlFieldSelect",'<select id="${id}" {{if options.readonly}}readonly="readonly"{{/if}} {{if options.multiple}}multiple{{/if}} {{if options.size}}size="${options.size}"{{/if}} {{if name}}name="${name}"{{/if}}><option value="">-</option>{{each(i,value) selectOptions}}<option value="${value}" {{if value == data}}selected="selected"{{/if}}>${text}</option>{{/each}}</select>');a.registerTemplate("controlFieldSelectMultiple",'<select id="${id}" {{if options.readonly}}readonly="readonly"{{/if}} {{if options.multiple}}multiple="multiple"{{/if}} {{if options.size}}size="${options.size}"{{/if}} {{if name}}name="${name}"{{/if}}>{{if !required}}<option value="">None</option>{{/if}}{{each(i,value) selectOptions}}<option value="${value}" {{each(j,val) data}}{{if value == val}}selected="selected"{{/if}}{{/each}}>${text}</option>{{/each}}</select>');a.registerFieldClass("select",a.Fields.SelectField)})(jQuery);(function(b){var a=b.alpaca;a.Fields.NumberField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},getValue:function(){var c=this.field.val();if(a.isValEmpty(c)){return -1}else{return parseFloat(c)}},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-number")}},handleValidate:function(){var e=this.base();var d=this.validation;var c=this._validateNumber();d.stringNotANumber={message:c?"":this.view.getMessage("stringNotANumber"),status:c};c=this._validateDivisibleBy();d.stringDivisibleBy={message:c?"":a.substituteTokens(this.view.getMessage("stringDivisibleBy"),[this.schema.divisibleBy]),status:c};c=this._validateMaximum();d.stringValueTooLarge={message:"",status:c};if(!c){if(this.schema.exclusiveMaximum){d.stringValueTooLarge["message"]=a.substituteTokens(this.view.getMessage("stringValueTooLargeExclusive"),[this.schema.maximum])}else{d.stringValueTooLarge["message"]=a.substituteTokens(this.view.getMessage("stringValueTooLarge"),[this.schema.maximum])}}c=this._validateMinimum();d.stringValueTooSmall={message:"",status:c};if(!c){if(this.schema.exclusiveMinimum){d.stringValueTooSmall["message"]=a.substituteTokens(this.view.getMessage("stringValueTooSmallExclusive"),[this.schema.minimum])}else{d.stringValueTooSmall["message"]=a.substituteTokens(this.view.getMessage("stringValueTooSmall"),[this.schema.minimum])}}return e&&d.stringNotANumber["status"]&&d.stringDivisibleBy["status"]&&d.stringValueTooLarge["status"]&&d.stringValueTooSmall["status"]},_validateNumber:function(){var c=this.field.val();if(a.isValEmpty(c)){return true}var d=this.getValue();if(isNaN(d)){return false}if(!c.match(a.regexps.number)){return false}return true},_validateDivisibleBy:function(){var c=this.getValue();if(!a.isEmpty(this.schema.divisibleBy)){if(c%this.schema.divisibleBy!==0){return false}}return true},_validateMaximum:function(){var c=this.getValue();if(!a.isEmpty(this.schema.maximum)){if(c>this.schema.maximum){return false}if(!a.isEmpty(this.schema.exclusiveMaximum)){if(c==this.schema.maximum&&this.schema.exclusiveMaximum){return false}}}return true},_validateMinimum:function(){var c=this.getValue();if(!a.isEmpty(this.schema.minimum)){if(c<this.schema.minimum){return false}if(!a.isEmpty(this.schema.exclusiveMinimum)){if(c==this.schema.minimum&&this.schema.exclusiveMinimum){return false}}}return true},getSchemaOfSchema:function(){return a.merge(this.base(),{properties:{minimum:{title:"Minimum",description:"Minimum value of the property.",type:"number"},maximum:{title:"Maximum",description:"Maximum value of the property.",type:"number"},exclusiveMinimum:{title:"Exclusive Minimum",description:"Property value can not equal the number defined by the minimum schema property.",type:"boolean","default":false},exclusiveMaximum:{title:"Exclusive Maximum",description:"Property value can not equal the number defined by the maximum schema property.",type:"boolean","default":false}}})},getOptionsForSchema:function(){return a.merge(this.base(),{fields:{minimum:{title:"Minimum",description:"Minimum value of the property",type:"number"},maximum:{title:"Maximum",description:"Maximum value of the property",type:"number"},exclusiveMinimum:{rightLabel:"Exclusive minimum ?",helper:"Field value must be greater than but not equal to this number if checked",type:"checkbox"},exclusiveMaximum:{rightLabel:"Exclusive Maximum ?",helper:"Field value must be less than but not equal to this number if checked",type:"checkbox"}}})},getTitle:function(){return"Number Field"},getDescription:function(){return"Field for float numbers."},getType:function(){return"number"},getFieldType:function(){return"number"}});a.registerMessages({stringValueTooSmall:"The minimum value for this field is {0}",stringValueTooLarge:"The maximum value for this field is {0}",stringValueTooSmallExclusive:"Value of this field must be greater than {0}",stringValueTooLargeExclusive:"Value of this field must be less than {0}",stringDivisibleBy:"The value must be divisible by {0}",stringNotANumber:"This value is not a number."});a.registerFieldClass("number",a.Fields.NumberField);a.registerDefaultSchemaFieldMapping("number","number")})(jQuery);(function(b){var a=b.alpaca;a.Fields.ArrayField=a.ContainerField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();this.options.toolbarStyle=a.isEmpty(this.view.toolbarStyle)?"button":this.view.toolbarStyle;if(!this.options.items){this.options.items={}}var c=false;if(!a.isEmpty(this.view.toolbarSticky)){c=this.view.toolbarSticky}if(!a.isEmpty(this.options.toolbarSticky)){c=this.options.toolbarSticky}if(a.isEmpty(this.options.items.showMoveUpItemButton)){this.options.items.showMoveUpItemButton=true}if(a.isEmpty(this.options.items.showMoveDownItemButton)){this.options.items.showMoveDownItemButton=true}this.options.toolbarSticky=c;if(this.schema.items&&this.schema.uniqueItems){a.mergeObject(this.options,{forceRevalidation:true})}if(a.isEmpty(this.data)){return}if(!a.isArray(this.data)){if(!a.isString(this.data)){return}else{try{this.data=a.parseJSON(this.data);if(!a.isArray(this.data)){a.logWarn("ArrayField parsed data but it was not an array: "+JSON.stringify(this.data));return}}catch(d){this.data=[this.data]}}}},setValue:function(e){var f=this;if(!e||!a.isArray(e)){return}for(var d=0;d<this.children.length;d++){var c=this.children[d];if(e.length>d){c.setValue(e[d])}else{this.removeItem(c.id)}}f.resolveItemSchemaOptions(function(h,g){while(d<e.length){f.addItem(d,h,g,e[d]);d++}})},getValue:function(){if(this.children.length===0&&!this.schema.required){return}var e=[];for(var d=0;d<this.children.length;d++){var c=this.children[d].getValue();if(typeof(c)!=="undefined"){e.push(c)}}return e},getSize:function(){return this.children.length},updateChildrenPathAndName:function(c){var d=this;if(c.children){b.each(c.children,function(f,e){if(c.prePath&&a.startsWith(e.path,c.prePath)){e.prePath=e.path;e.path=e.path.replace(c.prePath,c.path)}if(c.preName&&a.startsWith(e.name,c.preName)){e.preName=e.name;e.name=e.name.replace(c.preName,c.name);if(e.field){b(e.field).attr("name",e.name)}}d.updateChildrenPathAndName(e)})}},updatePathAndName:function(){var c=this;if(this.children){b.each(this.children,function(g,f){var d=f.path.lastIndexOf("/");var e=f.path.substring(d+1);if(e.indexOf("[")!=-1&&e.indexOf("]")!=-1){e=e.substring(e.indexOf("[")+1,e.indexOf("]"))}if(e!=g){f.prePath=f.path;f.path=f.path.substring(0,d)+"/["+g+"]"}if(f.nameCalculated){f.preName=f.name;if(f.parent&&f.parent.name&&f.path){f.name=f.parent.name+"_"+g}else{if(f.path){f.name=f.path.replace(/\//g,"").replace(/\[/g,"_").replace(/\]/g,"")}}b(f.field).attr("name",f.name)}if(!f.prePath){f.prePath=f.path}c.updateChildrenPathAndName(f)})}},moveItem:function(c,d){var e=this;if(this.childrenById[c]){b.each(this.children,function(g,l){if(l.getId()==c){var j;if(d===true){j=g-1;if(j<0){j=e.children.length-1}}else{j=g+1;if(j>=e.children.length){j=0}}if(e.children[j]){var f=e.children[j].getId();var k=b("#"+c+"-item-container");var i=b("#"+f+"-item-container");e.reRenderItem(e.children[g],i);e.reRenderItem(e.children[j],k);var h=e.children[g];e.children[g]=e.children[j];e.children[j]=h;e.updatePathAndName();return false}}})}},removeItem:function(c){if(this._validateEqualMinItems()){this.children=b.grep(this.children,function(e,d){return(e.getId()!=c)});delete this.childrenById[c];b("#"+c+"-item-container",this.outerEl).remove();this.renderValidationState();this.updateToolbarItemsStatus();this.updatePathAndName();this.triggerUpdate()}},updateToolbarItemsStatus:function(){var c=this;if(c._validateEqualMaxItems()){b(".alpaca-fieldset-array-item-toolbar-add",this.outerEl).each(function(d){b(this).removeClass("alpaca-fieldset-array-item-toolbar-disabled")})}else{b(".alpaca-fieldset-array-item-toolbar-add",this.outerEl).each(function(d){b(this).addClass("alpaca-fieldset-array-item-toolbar-disabled")})}if(c._validateEqualMinItems()){b(".alpaca-fieldset-array-item-toolbar-remove",this.outerEl).each(function(d){b(this).removeClass("alpaca-fieldset-array-item-toolbar-disabled")})}else{b(".alpaca-fieldset-array-item-toolbar-remove",this.outerEl).each(function(d){b(this).addClass("alpaca-fieldset-array-item-toolbar-disabled")})}if(this.getSize()===0){this.renderArrayToolbar(this.outerEl)}else{if(this.arrayToolbar){this.arrayToolbar.remove()}}b(".alpaca-item-label-counter",this.outerEl).each(function(d){b(this).html(d+1)})},renderToolbar:function(c){var k=this;if(!this.options.readonly){var j=c.attr("alpaca-id");var f=this.childrenById[j];var h=this.view.getTemplateDescriptor("arrayItemToolbar");if(h){var g=[{feature:"add",icon:k.addIcon,label:(k.options.items&&k.options.items.addItemLabel)?k.options.items.addItemLabel:"Add Item",clickCallback:function(l,i){k.resolveItemSchemaOptions(function(n,m){var o=i.addItem(c.index()+1,n,m,null,l,true);i.enrichElements(o)});return false}},{feature:"remove",icon:k.removeIcon,label:(k.options.items&&k.options.items.removeItemLabel)?k.options.items.removeItemLabel:"Remove Item",clickCallback:function(l,i){i.removeItem(l)}}];if((k.options.items&&k.options.items.showMoveUpItemButton)){g.push({feature:"up",icon:k.upIcon,label:(k.options.items&&k.options.items.moveUpItemLabel)?k.options.items.moveUpItemLabel:"Move Up",clickCallback:function(l,i){i.moveItem(l,true)}})}if((k.options.items&&k.options.items.showMoveDownItemButton)){g.push({feature:"down",icon:k.downIcon,label:(k.options.items&&k.options.items.moveDownItemLabel)?k.options.items.moveDownItemLabel:"Move Down",clickCallback:function(l,i){i.moveItem(l,false)}})}if(k.options.items&&k.options.items.extraToolbarButtons){g=b.merge(g,k.options.items.extraToolbarButtons)}var e=k.view.tmpl(h,{id:j,buttons:g});if(e.attr("id")===null){e.attr("id",j+"-item-toolbar")}for(var d in g){(function(l){var i=e.find(".alpaca-fieldset-array-item-toolbar-"+l.feature);i.click(function(m){return l.clickCallback(j,k,m)});if(k.buttonBeautifier){k.buttonBeautifier.call(k,i,l.icon)}})(g[d])}if(this.options.toolbarSticky){e.prependTo(c)}else{e.hide().prependTo(c);c.hover(function(){b(".alpaca-fieldset-array-item-toolbar",this).show()},function(){b(".alpaca-fieldset-array-item-toolbar",this).hide()})}}}},renderArrayToolbar:function(c){var h=this;var g=c.attr("alpaca-id");var f=this.view.getTemplateDescriptor("arrayToolbar");if(f){var e=h.view.tmpl(f,{id:g,addItemLabel:(h.options.items&&h.options.items.addItemLabel)?h.options.items.addItemLabel:"Add Item"});if(e.attr("id")===null){e.attr("id",g+"-array-toolbar")}if(this.options.toolbarStyle=="link"){b(".alpaca-fieldset-array-toolbar-add",e).click(function(){h.resolveItemSchemaOptions(function(j,i){var k=h.addItem(0,j,i,"",g,true);h.enrichElements(k)})})}else{var d=b(".alpaca-fieldset-array-toolbar-add",e);if(h.buttonBeautifier){h.buttonBeautifier.call(h,d,h.addIcon,true)}d.click(function(){h.resolveItemSchemaOptions(function(j,i){h.addItem(0,j,i,"",g,true)});return false}).wrap("<small></small>")}e.appendTo(c);this.arrayToolbar=e}},reRenderItem:function(d,c){d.container=c;d.render();c.attr("id",d.getId()+"-item-container");c.attr("alpaca-id",d.getId());c.addClass("alpaca-item-container");b(".alpaca-fieldset-array-item-toolbar",c).remove();this.renderToolbar(c);this.enrichElements(c)},addItem:function(d,f,e,c,g,h){return this._addItem(d,f,e,c,g,h)},_addItem:function(e,g,f,d,h,i){var j=this;if(j._validateEqualMaxItems()){if(f===null&&j.options&&j.options.fields&&j.options.fields.item){f=j.options.fields.item}var c=j.renderItemContainer(h);c.alpaca({data:d,options:f,schema:g,view:this.view.id?this.view.id:this.view,connector:this.connector,error:function(k){j.destroy();j.errorCallback.call(j,k)},notTopLevel:true,isDynamicCreation:(i||this.isDynamicCreation),render:function(m){m.parent=j;m.path=j.path+"["+e+"]";m.nameCalculated=true;m.render();c.attr("id",m.getId()+"-item-container");c.attr("alpaca-id",m.getId());c.addClass("alpaca-item-container");if(j.options&&j.options.itemLabel){var k=j.view.getTemplateDescriptor("itemLabel");var l=j.view.tmpl(k,{options:j.options,index:e?e+1:1,id:j.id});l.prependTo(c)}j.addChild(m,e);j.renderToolbar(c);j.renderValidationState();j.updatePathAndName();j.triggerUpdate();if(b(c).siblings().addBack().length>0){b(c).parent().removeClass("alpaca-fieldset-items-container-empty");b(c).siblings().addBack().removeClass("alpaca-item-container-first");b(c).siblings().addBack().removeClass("alpaca-item-container-last");b(c).siblings().addBack().first().addClass("alpaca-item-container-first");b(c).siblings().addBack().last().addClass("alpaca-item-container-last")}b(c).attr("data-alpaca-item-container-item-key",e)}});this.updateToolbarItemsStatus(this.outerEl);return c}},enrichElements:function(c){this.getStyleInjection("array",c)},resolveItemSchemaOptions:function(i){var h=this;var e;if(h.options&&h.options.fields&&h.options.fields.item){e=h.options.fields.item}var d;if(h.schema&&h.schema.items){d=h.schema.items}if(d&&d["$ref"]){var f=d["$ref"];var g=this;var c=[g];while(g.parent){g=g.parent;c.push(g)}a.loadRefSchemaOptions(g,f,function(n,m){var j=0;for(var k=0;k<c.length;k++){if(c[k].schema&&c[k].schema.id===f){j++}}var l=(j>1);if(n){n=a.copyOf(n);delete n.id}if(m){m=a.copyOf(m)}i(n,m,l)})}else{i(d,e)}},renderItems:function(){var c=this;b(this.fieldContainer).addClass("alpaca-fieldset-items-container-empty");if(this.data){c.resolveItemSchemaOptions(function(e,d){b.each(c.data,function(f,g){c.addItem(f,e,d,g,false)});c.updateToolbarItemsStatus()})}else{this.updateToolbarItemsStatus()}},_validateEqualMaxItems:function(){if(this.schema.items&&this.schema.items.maxItems){if(this.getSize()>=this.schema.items.maxItems){return false}}return true},_validateEqualMinItems:function(){if(this.schema.items&&this.schema.items.minItems){if(this.getSize()<=this.schema.items.minItems){return false}}return true},_validateMinItems:function(){if(this.schema.items&&this.schema.items.minItems){if(this.getSize()<this.schema.items.minItems){return false}}return true},_validateMaxItems:function(){if(this.schema.items&&this.schema.items.maxItems){if(this.getSize()>this.schema.items.maxItems){return false}}return true},_validateUniqueItems:function(){if(this.schema.items&&this.schema.uniqueItems){var e={};for(var d=0,c=this.children.length;d<c;++d){if(!e.hasOwnProperty(this.children[d])){e[this.children[d]]=true}else{return false}}}return true},handleValidate:function(){var e=this.base();var d=this.validation;var c=this._validateUniqueItems();d.valueNotUnique={message:c?"":this.view.getMessage("valueNotUnique"),status:c};c=this._validateMaxItems();d.tooManyItems={message:c?"":a.substituteTokens(this.view.getMessage("tooManyItems"),[this.schema.items.maxItems]),status:c};c=this._validateMinItems();d.notEnoughItems={message:c?"":a.substituteTokens(this.view.getMessage("notEnoughItems"),[this.schema.items.minItems]),status:c};return e&&d.valueNotUnique["status"]&&d.tooManyItems["status"]&&d.notEnoughItems["status"]},getSchemaOfSchema:function(){var c={properties:{items:{title:"Array Items",description:"Schema for array items.",type:"object",properties:{minItems:{title:"Minimum Items",description:"Minimum number of items.",type:"number"},maxItems:{title:"Maximum Items",description:"Maximum number of items.",type:"number"},uniqueItems:{title:"Items Unique",description:"Item values should be unique if true.",type:"boolean","default":false}}}}};if(this.children&&this.children[0]){a.merge(c.properties.items.properties,this.children[0].getSchemaOfSchema())}return a.merge(this.base(),c)},getOptionsForSchema:function(){return a.merge(this.base(),{fields:{items:{type:"object",fields:{minItems:{type:"integer"},maxItems:{type:"integer"},uniqueItems:{type:"checkbox"}}}}})},getSchemaOfOptions:function(){var c={properties:{toolbarSticky:{title:"Sticky Toolbar",description:"Array item toolbar will be aways on if true.",type:"boolean","default":false},items:{title:"Array Items",description:"Options for array items.",type:"object",properties:{extraToolbarButtons:{title:"Extra Toolbar buttons",description:"Buttons to be added next to add/remove/up/down, see examples",type:"array","default":undefined},moveUpItemLabel:{title:"Move Up Item Label",description:"The label to use for the toolbar's 'move up' button.",type:"string","default":"Move Up"},moveDownItemLabel:{title:"Move Down Item Label",description:"The label to use for the toolbar's 'move down' button.",type:"string","default":"Move Down"},removeItemLabel:{title:"Remove Item Label",description:"The label to use for the toolbar's 'remove item' button.",type:"string","default":"Remove Item"},addItemLabel:{title:"Add Item Label",description:"The label to use for the toolbar's 'add item' button.",type:"string","default":"Add Item"},showMoveDownItemButton:{title:"Show Move Down Item Button",description:"Whether to show to the 'Move Down' button on the toolbar.",type:"boolean","default":true},showMoveUpItemButton:{title:"Show Move Up Item Button",description:"Whether to show the 'Move Up' button on the toolbar.",type:"boolean","default":true}}}}};if(this.children&&this.children[0]){a.merge(c.properties.items.properties,this.children[0].getSchemaOfSchema())}return a.merge(this.base(),c)},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{toolbarSticky:{type:"checkbox"},items:{type:"object",fields:{}}}})},getTitle:function(){return"Array Field"},getDescription:function(){return"Field for list of items with same data type or structure."},getType:function(){return"array"},getFieldType:function(){return"array"}});a.registerTemplate("itemLabel",'{{if options.itemLabel}}<div class="alpaca-controlfield-label"><div>${options.itemLabel}{{if index}} <span class="alpaca-item-label-counter">${index}</span>{{/if}}</div></div>{{/if}}');a.registerTemplate("arrayToolbar",'<span class="ui-widget ui-corner-all alpaca-fieldset-array-toolbar"><button class="alpaca-fieldset-array-toolbar-icon alpaca-fieldset-array-toolbar-add">${addItemLabel}</button></span>');a.registerTemplate("arrayItemToolbar",'<div class="ui-widget-header ui-corner-all alpaca-fieldset-array-item-toolbar">{{each(k,v) buttons}}<button class="alpaca-fieldset-array-item-toolbar-icon alpaca-fieldset-array-item-toolbar-${v.feature}">${v.label}</button>{{/each}}</div>');a.registerMessages({notEnoughItems:"The minimum number of items is {0}",tooManyItems:"The maximum number of items is {0}",valueNotUnique:"Values are not unique",notAnArray:"This value is not an Array"});a.registerFieldClass("array",a.Fields.ArrayField);a.registerDefaultSchemaFieldMapping("array","array")})(jQuery);(function(b){var a=b.alpaca;a.Fields.ObjectField=a.ContainerField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();this.wizardPreIcon="";this.wizardNextIcon="";this.wizardDoneIcon="";if(this.view.style&&a.styleInjections[this.view.style]){if(a.styleInjections[this.view.style]["wizardPreIcon"]){this.wizardPreIcon=a.styleInjections[this.view.style]["wizardPreIcon"]}if(a.styleInjections[this.view.style]["wizardNextIcon"]){this.wizardNextIcon=a.styleInjections[this.view.style]["wizardNextIcon"]}if(a.styleInjections[this.view.style]["wizardDoneIcon"]){this.wizardDoneIcon=a.styleInjections[this.view.style]["wizardDoneIcon"]}}if(a.isEmpty(this.data)){return}if(!a.isObject(this.data)){if(!a.isString(this.data)){return}else{try{this.data=a.parseJSON(this.data);if(!a.isObject(this.data)){a.logWarn("ObjectField parsed data but it was not an object: "+JSON.stringify(this.data));return}}catch(c){return}}}},setValue:function(f){if(!f||!a.isObject(f)){return}for(var c in this.childrenById){var g=this.childrenById[c].propertyId;var e=a.traverseObject(f,g);if(!a.isEmpty(e)){var d=this.childrenById[c];d.setValue(e)}}},getValue:function(){if(this.children.length===0&&!this.schema.required){return}var f={};for(var c=0;c<this.children.length;c++){var e=this.children[c].propertyId;var d=this.children[c].getValue();if(typeof(d)!=="undefined"){if(this.determineAllDependenciesValid(e)){f[e]=d}}}return f},postRender:function(){this.base();if(this.isTopLevel()){if(this.view){this.wizardConfigs=this.view.getWizard();if(this.wizardConfigs){if(a.isUndefined(this.wizardConfigs.validation)){this.wizardConfigs.validation=true}if(!this.wizardConfigs.buttons){this.wizardConfigs.buttons={}}if(!this.wizardConfigs.buttons.done){this.wizardConfigs.buttons.done={}}if(a.isUndefined(this.wizardConfigs.buttons.done.validateOnClick)){this.wizardConfigs.buttons.done.validateOnClick=true}if(!this.wizardConfigs.buttons.prev){this.wizardConfigs.buttons.prev={}}if(a.isUndefined(this.wizardConfigs.buttons.prev.validateOnClick)){this.wizardConfigs.buttons.prev.validateOnClick=true}if(!this.wizardConfigs.buttons.next){this.wizardConfigs.buttons.next={}}if(a.isUndefined(this.wizardConfigs.buttons.next.validateOnClick)){this.wizardConfigs.buttons.next.validateOnClick=true}}var c=this.view.getLayout().templateDescriptor;if(this.wizardConfigs&&this.wizardConfigs.renderWizard){if(c){this.wizard()}else{this.autoWizard()}}}}},getIndex:function(e){if(a.isEmpty(e)){return -1}for(var d=0;d<this.children.length;d++){var c=this.children[d].propertyId;if(c==e){return d}}return -1},resolvePropertySchemaOptions:function(h,j){var i=this;var e=null;if(i.schema&&i.schema.properties&&i.schema.properties[h]){e=i.schema.properties[h]}var c={};if(i.options&&i.options.fields&&i.options.fields[h]){c=i.options.fields[h]}if(e&&e["$ref"]){var f=e["$ref"];var g=this;var d=[g];while(g.parent){g=g.parent;d.push(g)}a.loadRefSchemaOptions(g,f,function(n,l){var k=0;for(var m=0;m<d.length;m++){if(d[m].schema&&d[m].schema.id===f){k++}}var o=(k>1);if(n){n=a.copyOf(n);delete n.id}if(l){l=a.copyOf(l)}j(n,l,o)})}else{j(e,c)}},removeItem:function(d){this.children=b.grep(this.children,function(f,e){return(f.getId()!=d)});var c=this.childrenById[d];delete this.childrenById[d];if(c.propertyId){delete this.childrenByPropertyId[c.propertyId]}c.destroy();this.renderValidationState();this.triggerUpdate()},addItem:function(i,f,e,d,g,h){var j=this;var c=j.renderItemContainer(g,this,i);c.alpaca({data:d,options:e,schema:f,view:this.view.id?this.view.id:this.view,connector:this.connector,error:function(k){j.destroy();j.errorCallback.call(j,k)},notTopLevel:true,isDynamicCreation:(h||this.isDynamicCreation),render:function(l){l.parent=j;l.propertyId=i;if(j.path!="/"){l.path=j.path+"/"+i}else{l.path=j.path+i}l.render();c.attr("id",l.getId()+"-item-container");c.attr("alpaca-id",l.getId());c.addClass("alpaca-fieldset-item-container");if(a.isEmpty(g)){j.addChild(l)}else{var k=j.getIndex(g);if(k!=-1){j.addChild(l,k+1)}else{j.addChild(l)}}if(g){j.renderValidationState()}if(b(c).siblings().addBack().length>0){b(c).parent().removeClass("alpaca-fieldset-items-container-empty");b(c).siblings().addBack().removeClass("alpaca-item-container-first");b(c).siblings().addBack().removeClass("alpaca-item-container-last");b(c).siblings().addBack().first().addClass("alpaca-item-container-first");b(c).siblings().addBack().last().addClass("alpaca-item-container-last")}b(c).attr("data-alpaca-item-container-item-key",i);j.triggerUpdate()}})},renderItems:function(){var i=this;var f={};for(var g in i.data){f[g]=g}var j=i.data;if(i.schema&&i.schema.properties){j=i.schema.properties}var c=function(m){var n=[];for(var l in f){n.push(l)}if(n.length>0){a.logDebug("There were "+n.length+" extra data keys that were not part of the schema "+JSON.stringify(n))}for(var o in j){i.showOrHidePropertyBasedOnDependencies(o)}for(var o in j){i.bindDependencyFieldUpdateEvent(o)}i.renderValidationState()};var k=0;for(var h in j){k++}var d=0;for(var h in j){var e=null;if(i.data){e=i.data[h]}i.resolvePropertySchemaOptions(h,function(n,l,m){if(m){return a.throwErrorWithCallback("Circular reference detected for schema: "+n,i.errorCallback)}if(!n){a.logError("Unable to resolve schema for property: "+h)}i.addItem(h,n,l,e);delete f[h];d++;if(d===k){c()}})}},showOrHidePropertyBasedOnDependencies:function(f){var c=this;var e=this.childrenByPropertyId[f];if(!e){return a.throwErrorWithCallback("Missing property: "+f,c.errorCallback)}var d=this.determineAllDependenciesValid(f);if(d){e.show();e.onDependentReveal()}else{e.hide();e.onDependentConceal()}},determineAllDependenciesValid:function(g){var d=this;var f=this.childrenByPropertyId[g];if(!f){return a.throwErrorWithCallback("Missing property: "+g,d.errorCallback)}var c=f.schema.dependencies;if(!c){return true}var e=true;if(a.isString(c)){e=d.determineSingleDependencyValid(g,c)}else{if(a.isArray(c)){b.each(c,function(h,i){e=e&&d.determineSingleDependencyValid(g,i)})}}return e},bindDependencyFieldUpdateEvent:function(g){var d=this;var e=this.childrenByPropertyId[g];if(!e){return a.throwErrorWithCallback("Missing property: "+g,d.errorCallback)}var c=e.schema.dependencies;if(!c){return true}var f=function(j,i){var h=d.childrenByPropertyId[i];if(h){h.getEl().bind("fieldupdate",function(l){d.showOrHidePropertyBasedOnDependencies(j);for(var k in d.schema.properties){var n=d.schema.properties[k];if(n.dependencies){var m=d.childrenByPropertyId[k];if(a.isString(n.dependencies)&&n.dependencies==j){d.showOrHidePropertyBasedOnDependencies(k);m.triggerUpdate()}else{if(a.isArray(n.dependencies)){b.each(n.dependencies,function(o,p){if(p==j){d.showOrHidePropertyBasedOnDependencies(k);m.triggerUpdate()}})}}}}})}};if(a.isString(c)){f(g,c)}else{if(a.isArray(c)){b.each(c,function(h,i){f(g,i)})}}},determineSingleDependencyValid:function(h,j){var i=this.childrenByPropertyId[j];if(!i){return false}var f=false;var d=this.childrenByPropertyId[h].options.dependencies;if(!d||d.length===0){if(i.getType()==="boolean"&&!this.childrenByPropertyId[h].options.dependencies&&!i.data){f=false}else{f=!a.isValEmpty(i.data)}}else{var e=this.childrenByPropertyId[j];var c=e.data;if(e.getType()==="boolean"&&!c){c=false}if(!a.isEmpty(d[j])&&a.isFunction(d[j])){f=d[j].call(this,c)}else{f=true;if(a.isArray(d[j])){if(d[j]&&b.inArray(c,d[j])==-1){f=false}}else{if(!a.isEmpty(d[j])&&d[j]!=c){f=false}}}}var g=this.childrenByPropertyId[j];if(g&&g.isHidden()){f=false}return f},wizard:function(){var h=this;var f=this.outerEl;var d=b(".alpaca-wizard-step",f);var g=d.size();this.totalSteps=g;var e=[];if(this.wizardConfigs.stepTitles){e=this.wizardConfigs.stepTitles}else{d.each(function(k){var j={title:"",description:""};if(b(".alpaca-wizard-step-title",this)){j.title=b(".alpaca-wizard-step-title",this).html();b(".alpaca-wizard-step-title",this).hide()}if(b(".alpaca-wizard-step-description",this)){j.description=b(".alpaca-wizard-step-description",this).html();b(".alpaca-wizard-step-description",this).hide()}e.push(j)})}var c=this._renderWizardStatusBar(e);if(c){b(f).before(c)}d.each(function(o){var t=b(this).attr("id");var n="step"+o;var r=h.view.getTemplateDescriptor("wizardStep");if(r){var s=h.view.tmpl(r,{});s.attr("id",n);b(this).wrap(s)}var v=n+"-nav-bar";var q=h.view.getTemplateDescriptor("wizardNavBar");if(q){var j=h.view.tmpl(q,{});j.attr("id",v);j.addClass("alpaca-wizard-nav-bar");b(this).append(j)}var l={};var k=h.view.getLayout().bindings;for(var p in k){var u=k[p];if(u==t){l[p]=t}}var m=function(w,i){return function(){var x=true;if(h.wizardConfigs&&h.wizardConfigs.validation){if(i){b.each(i,function(z,y){x=x&h.childrenByPropertyId[z].validate();h.childrenByPropertyId[z].renderValidationState()})}}return x}}(o,l);if(o===0){h._createNextButton(o,true,m);h._selectStep(o)}else{if(o==g-1){b("#step"+o).hide();h._createPrevButton(o,false);h._createDoneButton(o,true,m)}else{b("#step"+o).hide();h._createPrevButton(o,false);h._createNextButton(o,true,m)}}})},autoWizard:function(){var l=this;var d=this.wizardConfigs.steps;if(!d){d=1}this.totalSteps=d;var e=this.wizardConfigs.bindings;if(!e){e={}}for(var k in this.childrenByPropertyId){if(!e.hasOwnProperty(k)){e[k]=1}}for(var j=0;j<d;j++){var f=j+1;var r=[];for(var k in e){if(e[k]==f){if(this.childrenByPropertyId&&this.childrenByPropertyId[k]){r.push("#"+this.childrenByPropertyId[k].container.attr("id"))}}}var h="step"+j;var n=this.view.getTemplateDescriptor("wizardStep");if(n){var o=l.view.tmpl(n,{});o.attr("id",h);b(r.join(",")).wrapAll(o)}var p=h+"-nav-bar";var m=this.view.getTemplateDescriptor("wizardNavBar");if(m){var c=l.view.tmpl(m,{});c.attr("id",p);c.addClass("alpaca-wizard-nav-bar");b("#"+h,this.outerEl).append(c)}}var q=this._renderWizardStatusBar(this.wizardConfigs.stepTitles);if(q){q.prependTo(this.fieldContainer)}for(var j=0;j<d;j++){var g=function(s,i){return function(){var t=true;if(l.view&&l.wizardConfigs&&l.wizardConfigs.validation){if(i){b.each(i,function(v,u){if(u==s+1&&t){t=l.childrenByPropertyId[v].validate();l.childrenByPropertyId[v].validate()}})}}return t}}(j,e);if(j===0){l._createNextButton(j,false,g);l._selectStep(j)}else{if(j==d-1){b("#step"+j).hide();l._createPrevButton(j,false);l._createDoneButton(j,true,g)}else{b("#step"+j).hide();l._createPrevButton(j,false);l._createNextButton(j,false,g)}}}},_renderWizardStatusBar:function(e){var g=this;var f=this.wizardConfigs.statusBar;if(f&&e){var d=this.view.getTemplateDescriptor("wizardStatusBar");if(d){var c=g.view.tmpl(d,{id:this.getId()+"-wizard-status-bar",titles:e});c.addClass("alpaca-wizard-status-bar");this.getStyleInjection("wizardStatusBar",c);return c}}},_createPrevButton:function(f,d,e){if(this.wizardConfigs.buttons&&this.wizardConfigs.buttons.prev){if(!this.wizardConfigs.buttons.prev.validateOnClick){e=null}}var j="step"+f;var h=this;var c=this.view.getTemplateDescriptor("wizardPreButton");if(c){var g=h.view.tmpl(c,{});g.attr("id",j+"-button-pre");g.addClass("alpaca-wizard-button-pre");if(h.buttonBeautifier){h.buttonBeautifier.call(h,g,this.wizardPreIcon,true)}g.click(function(l,k,i){return function(){var m=true;if(i){m=i(l,k)}if(m){b("#"+l).hide();b("#step"+(f-1)).show();h._selectStep(f-1);if(h.wizardConfigs.buttons.prev&&h.wizardConfigs.buttons.prev.onClick){h.wizardConfigs.buttons.prev.onClick()}}return false}}(j,f,e));b("#"+j+"-nav-bar").append(g);if(d){b("#"+j+"-nav-bar").parent().append("<div style='clear:both'></div>")}}},_createNextButton:function(f,c,d){if(this.wizardConfigs.buttons&&this.wizardConfigs.buttons.next){if(!this.wizardConfigs.buttons.next.validateOnClick){d=null}}var j="step"+f;var h=this;var g=this.view.getTemplateDescriptor("wizardNextButton");if(g){var e=h.view.tmpl(g,{});e.attr("id",j+"-button-next");e.addClass("alpaca-wizard-button-next");if(h.buttonBeautifier){h.buttonBeautifier.call(h,e,this.wizardNextIcon,true)}e.click(function(l,k,i){return function(){var m=true;if(i){m=i(l,k)}if(m){b("#"+l).hide();b("#step"+(k+1)).show();h._selectStep(k+1);if(h.wizardConfigs.buttons.next&&h.wizardConfigs.buttons.next.onClick){h.wizardConfigs.buttons.next.onClick()}}return false}}(j,f,d));b("#"+j+"-nav-bar").append(e);if(c){b("#"+j+"-nav-bar").parent().append("<div style='clear:both'></div>")}}},_createDoneButton:function(f,c,d){if(this.wizardConfigs.buttons&&this.wizardConfigs.buttons.done){if(!this.wizardConfigs.buttons.done.validateOnClick){d=null}}var j="step"+f;var h=this;var g=this.view.getTemplateDescriptor("wizardDoneButton");if(g){var e=h.view.tmpl(g,{});e.attr("id",j+"-button-done");e.addClass("alpaca-wizard-button-done");if(h.buttonBeautifier){h.buttonBeautifier.call(h,e,this.wizardDoneIcon,true)}e.click(function(l,k,i){return function(){var m=true;if(i){m=i(l,k)}if(m){b("#"+l+"-nav-bar").append(e);if(c){b("#"+l+"-nav-bar").parent().append("<div style='clear:both'></div>")}if(h.wizardConfigs.buttons.done&&h.wizardConfigs.buttons.done.onClick){h.wizardConfigs.buttons.done.onClick()}}return false}}(j,f,d));b("#"+j+"-nav-bar").append(e);if(c){b("#"+j+"-nav-bar").parent().append("<div style='clear:both'></div>")}}},_selectStep:function(d){var c=b("#"+this.getId()+"-wizard-status-bar li");c.removeClass("current current-has-next");this.getStyleInjection("wizardUnCurrentStep",c);var e=b("#stepDesc"+d);e.addClass("current");this.getStyleInjection("wizardCurrentStep",e);if(d<this.totalSteps-1){b("#stepDesc"+d).addClass("current-has-next")}},getSchemaOfSchema:function(){var e={properties:{properties:{title:"Properties",description:"List of child properties.",type:"object"}}};var c=e.properties.properties;c.properties={};if(this.children){for(var d=0;d<this.children.length;d++){var f=this.children[d].propertyId;c.properties[f]=this.children[d].getSchemaOfSchema();c.properties[f].title=f+" :: "+c.properties[f].title}}return a.merge(this.base(),e)},getSchemaOfOptions:function(){var f=a.merge(this.base(),{properties:{}});var e={properties:{fields:{title:"Field Options",description:"List of options for child fields.",type:"object"}}};var c=e.properties.fields;c.properties={};if(this.children){for(var d=0;d<this.children.length;d++){var g=this.children[d].propertyId;c.properties[g]=this.children[d].getSchemaOfOptions();c.properties[g].title=g+" :: "+c.properties[g].title}}return a.merge(f,e)},getTitle:function(){return"Composite Field"},getDescription:function(){return"Composite field for containing other fields"},getType:function(){return"object"},getFieldType:function(){return"object"}});a.registerFieldClass("object",a.Fields.ObjectField);a.registerDefaultSchemaFieldMapping("object","object")})(jQuery);(function(b){var a=b.alpaca;a.Fields.AnyField=a.ControlField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();this.controlFieldTemplateDescriptor=this.view.getTemplateDescriptor("controlFieldAny")},renderField:function(c){if(this.controlFieldTemplateDescriptor){this.field=this.view.tmpl(this.controlFieldTemplateDescriptor,{id:this.getId(),name:this.name,options:this.options});this.injectField(this.field)}if(c){c()}},postRender:function(){this.base()},getValue:function(){return this.field.val()},setValue:function(c){if(a.isEmpty(c)){this.field.val("")}else{this.field.val(c)}this.base(c)},handleValidate:function(){var c=this.base();return c},disable:function(){this.field.disabled=true},enable:function(){this.field.disabled=false},focus:function(){this.field.focus()},getSchemaOfSchema:function(){return a.merge(this.base(),{properties:{}})},getOptionsForSchema:function(){return a.merge(this.base(),{fields:{}})},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{}})},getTitle:function(){return"Any Field"},getDescription:function(){return"Any field."},getType:function(){return"any"},getFieldType:function(){return"any"}});a.registerTemplate("controlFieldAny",'<input type="text" id="${id}" size="40" {{if options.readonly}}readonly="readonly"{{/if}} {{if name}}name="${name}"{{/if}} {{each(i,v) options.data}}data-${i}="${v}"{{/each}}/>');a.registerFieldClass("any",a.Fields.AnyField);a.registerDefaultSchemaFieldMapping("any","any")})(jQuery);(function(b){var a=b.alpaca;a.Fields.HiddenField=a.ControlField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();if(!this.options.size){this.options.size=40}this.controlFieldTemplateDescriptor=this.view.getTemplateDescriptor("controlFieldHidden")},renderField:function(c){var d=this;if(this.controlFieldTemplateDescriptor){this.field=d.view.tmpl(this.controlFieldTemplateDescriptor,{id:this.getId(),name:this.name,options:this.options});this.injectField(this.field)}if(c){c()}},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-hidden")}},getValue:function(){return this.field.val()},setValue:function(c){if(a.isEmpty(c)){this.field.val("")}else{this.field.val(c)}this.base(c)},getTitle:function(){return"Hidden"},getDescription:function(){return"Field for a hidden HTML input"},getType:function(){return"string"},getFieldType:function(){return"hidden"}});a.registerTemplate("controlFieldHidden",'<input type="hidden" id="${id}" {{if name}}name="${name}"{{/if}} {{each(i,v) options.data}}data-${i}="${v}"{{/each}}/>');a.registerFieldClass("hidden",a.Fields.HiddenField)})(jQuery);(function(b){var a=b.alpaca;a.registerView({id:"VIEW_BASE",messages:{zh_CN:{required:"&#27492;&#22495;&#24517;&#39035;",invalid:"&#27492;&#22495;&#19981;&#21512;&#26684;",months:["&#19968;&#26376;","&#20108;&#26376;","&#19977;&#26376;","&#22235;&#26376;","&#20116;&#26376;","&#20845;&#26376;","&#19971;&#26376;","&#20843;&#26376;","&#20061;&#26376;","&#21313;&#26376;","&#21313;&#19968;&#26376;","&#21313;&#20108;&#26376;"],timeUnits:{SECOND:"&#31186;",MINUTE:"&#20998;",HOUR:"&#26102;",DAY:"&#26085;",MONTH:"&#26376;",YEAR:"&#24180;"},notOptional:"&#27492;&#22495;&#38750;&#20219;&#36873;",disallowValue:"&#38750;&#27861;&#36755;&#20837;&#21253;&#25324; {0}.",invalidValueOfEnum:"&#20801;&#35768;&#36755;&#20837;&#21253;&#25324; {0}.",notEnoughItems:"&#26368;&#23567;&#20010;&#25968; {0}",tooManyItems:"&#26368;&#22823;&#20010;&#25968; {0}",valueNotUnique:"&#36755;&#20837;&#20540;&#19981;&#29420;&#29305;",notAnArray:"&#19981;&#26159;&#25968;&#32452;",invalidDate:"&#26085;&#26399;&#26684;&#24335;&#22240;&#35813;&#26159; {0}",invalidEmail:"&#20234;&#22969;&#20799;&#26684;&#24335;&#19981;&#23545;, ex: info@cloudcms.com",stringNotAnInteger:"&#19981;&#26159;&#25972;&#25968;.",invalidIPv4:"&#19981;&#26159;&#21512;&#27861;IP&#22320;&#22336;, ex: 192.168.0.1",stringValueTooSmall:"&#26368;&#23567;&#20540;&#26159; {0}",stringValueTooLarge:"&#26368;&#22823;&#20540;&#26159; {0}",stringValueTooSmallExclusive:"&#20540;&#24517;&#39035;&#22823;&#20110; {0}",stringValueTooLargeExclusive:"&#20540;&#24517;&#39035;&#23567;&#20110; {0}",stringDivisibleBy:"&#20540;&#24517;&#39035;&#33021;&#34987; {0} &#25972;&#38500;",stringNotANumber:"&#19981;&#26159;&#25968;&#23383;.",invalidPassword:"&#38750;&#27861;&#23494;&#30721;",invalidPhone:"&#38750;&#27861;&#30005;&#35805;&#21495;&#30721;, ex: (123) 456-9999",invalidPattern:"&#27492;&#22495;&#39035;&#26377;&#26684;&#24335; {0}",stringTooShort:"&#27492;&#22495;&#33267;&#23569;&#38271;&#24230; {0}",stringTooLong:"&#27492;&#22495;&#26368;&#22810;&#38271;&#24230; {0}"}}})})(jQuery);(function(b){var a=b.alpaca;a.registerView({id:"VIEW_BASE",messages:{es_ES:{required:"Este campo es obligatorio",invalid:"Este campo es inválido",months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],timeUnits:{SECOND:"segundos",MINUTE:"minutos",HOUR:"horas",DAY:"días",MONTH:"meses",YEAR:"años"},notOptional:"Este campo no es opcional.",disallowValue:"{0} son los valores rechazados.",invalidValueOfEnum:"Este campo debe tener uno de los valores adentro {0}.",notEnoughItems:"El número mínimo de artículos es {0}",tooManyItems:"El número máximo de artículos es {0}",valueNotUnique:"Los valores no son únicos",notAnArray:"Este valor no es un arsenal",invalidDate:"Fecha inválida para el formato {0}",invalidEmail:"Email address inválido, ex: info@cloudcms.com",stringNotAnInteger:"Este valor no es un número entero.",invalidIPv4:"Dirección inválida IPv4, ex: 192.168.0.1",stringValueTooSmall:"El valor mínimo para este campo es {0}",stringValueTooLarge:"El valor míximo para este campo es {0}",stringValueTooSmallExclusive:"El valor de este campo debe ser mayor que {0}",stringValueTooLargeExclusive:"El valor de este campo debe ser menos que {0}",stringDivisibleBy:"El valor debe ser divisible cerca {0}",stringNotANumber:"Este valor no es un número.",invalidPassword:"Contraseña inválida",invalidPhone:"Número de teléfono inválido, ex: (123) 456-9999",invalidPattern:"Este campo debe tener patrón {0}",stringTooShort:"Este campo debe contener por lo menos {0} números o caracteres",stringTooLong:"Este campo debe contener a lo más {0} números o caracteres"}}})})(jQuery);(function(b){var a=b.alpaca;a.registerView({id:"VIEW_BASE",messages:{fr_FR:{required:"Ce champ est requis",invalid:"Ce champ est invalide",months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],timeUnits:{SECOND:"secondes",MINUTE:"minutes",HOUR:"heures",DAY:"jours",MONTH:"mois",YEAR:"années"},notOptional:"Ce champ n'est pas optionnel.",disallowValue:"{0} sont des valeurs interdites.",invalidValueOfEnum:"Ce champ doit prendre une des valeurs suivantes : {0}.",notEnoughItems:"Le nombre minimum d'éléments est {0}",tooManyItems:"Le nombre maximum d'éléments est {0}",valueNotUnique:"Les valeurs sont uniques",notAnArray:"Cette valeur n'est pas une liste",invalidDate:"Cette date ne correspond pas au format {0}",invalidEmail:"Adresse de courriel invalide, ex: info@cloudcms.com",stringNotAnInteger:"Cette valeur n'est pas un nombre entier.",invalidIPv4:"Adresse IPv4 invalide, ex: 192.168.0.1",stringValueTooSmall:"La valeur minimale pour ce champ est {0}",stringValueTooLarge:"La valeur maximale pour ce champ est {0}",stringValueTooSmallExclusive:"La valeur doit-être supérieure à {0}",stringValueTooLargeExclusive:"La valeur doit-être inférieure à {0}",stringDivisibleBy:"La valeur doit-être divisible par {0}",stringNotANumber:"Cette valeur n'est pas un nombre.",invalidPassword:"Mot de passe invalide",invalidPhone:"Numéro de téléphone invalide, ex: (123) 456-9999",invalidPattern:"Ce champ doit correspondre au motif {0}",stringTooShort:"Ce champ doit contenir au moins {0} caractères",stringTooLong:"Ce champ doit contenir au plus {0} caractères"}}})})(jQuery);(function(b){var a=b.alpaca;a.registerView({id:"VIEW_BASE",messages:{de_AT:{required:"Eingabe erforderlich",invalid:"Eingabe invalid",months:["Jänner","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],timeUnits:{SECOND:"Sekunden",MINUTE:"Minuten",HOUR:"Stunden",DAY:"Tage",MONTH:"Monate",YEAR:"Jahre"},notOptional:"Dieses Feld ist nicht optional",disallowValue:"Diese Werte sind nicht erlaubt: {0}",invalidValueOfEnum:"Diese Feld sollte einen der folgenden Werte enthalten: {0}",notEnoughItems:"Die Mindestanzahl von Elementen ist {0}",tooManyItems:"Die Maximalanzahl von Elementen ist {0}",valueNotUnique:"Diese Werte sind nicht eindeutig",notAnArray:"Keine Liste von Werten",invalidDate:"Falsches Datumsformat: {0}",invalidEmail:"Ungültige e-Mail Adresse, z.B.: info@cloudcms.com",stringNotAnInteger:"Eingabe ist keine Ganz Zahl.",invalidIPv4:"Ungültige IPv4 Adresse, z.B.: 192.168.0.1",stringValueTooSmall:"Die Mindestanzahl von Zeichen ist {0}",stringValueTooLarge:"Die Maximalanzahl von Zeichen ist {0}",stringValueTooSmallExclusive:"Die Anzahl der Zeichen muss größer sein als {0}",stringValueTooLargeExclusive:"Die Anzahl der Zeichen muss kleiner sein als {0}",stringDivisibleBy:"Der Wert muss durch {0} dividierbar sein",stringNotANumber:"Die Eingabe ist keine Zahl",invalidPassword:"Ungültiges Passwort.",invalidPhone:"Ungültige Telefonnummer, z.B.: (123) 456-9999",invalidPattern:"Diese Feld stimmt nicht mit folgender Vorgabe überein {0}",stringTooShort:"Dieses Feld sollte mindestens {0} Zeichen enthalten",stringTooLong:"Dieses Feld sollte höchstens {0} Zeichen enthalten"}}})})(jQuery);
  50 +/*!
  51 +Alpaca Version 1.1.1
  52 +
  53 +Copyright 2013 Gitana Software, Inc.
  54 +
  55 +Licensed under the Apache License, Version 2.0 (the "License");
  56 +you may not use this file except in compliance with the License.
  57 +
  58 +You may obtain a copy of the License at
  59 + http://www.apache.org/licenses/LICENSE-2.0
  60 +
  61 +Unless required by applicable law or agreed to in writing, software
  62 +distributed under the License is distributed on an "AS IS" BASIS,
  63 +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  64 +See the License for the specific language governing permissions and
  65 +limitations under the License.
  66 +
  67 +For more information, please contact Gitana Software, Inc. at this
  68 +address:
  69 +
  70 + info@gitanasoftware.com
  71 +*/
  72 +(function(b){var a=b.alpaca;a.Fields.AddressField=a.Fields.ObjectField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();this.schema={title:"Home Address",type:"object",properties:{street:{title:"Street",type:"array",items:{type:"string",maxLength:30,minItems:0,maxItems:3}},city:{title:"City",type:"string"},state:{title:"State",type:"string","enum":["AL","AK","AS","AZ","AR","CA","CO","CT","DE","DC","FM","FL","GA","GU","HI","ID","IL","IN","IA","KS","KY","LA","ME","MH","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","MP","OH","OK","OR","PW","PA","PR","RI","SC","SD","TN","TX","UT","VT","VI","VA","WA","WV","WI","WY"]},zip:{title:"Zip Code",type:"string",pattern:/^(\d{5}(-\d{4})?)?$/}}};a.merge(this.options,{fields:{zip:{maskString:"99999",size:5},state:{optionLabels:["ALABAMA","ALASKA","AMERICANSAMOA","ARIZONA","ARKANSAS","CALIFORNIA","COLORADO","CONNECTICUT","DELAWARE","DISTRICTOFCOLUMBIA","FEDERATEDSTATESOFMICRONESIA","FLORIDA","GEORGIA","GUAM","HAWAII","IDAHO","ILLINOIS","INDIANA","IOWA","KANSAS","KENTUCKY","LOUISIANA","MAINE","MARSHALLISLANDS","MARYLAND","MASSACHUSETTS","MICHIGAN","MINNESOTA","MISSISSIPPI","MISSOURI","MONTANA","NEBRASKA","NEVADA","NEWHAMPSHIRE","NEWJERSEY","NEWMEXICO","NEWYORK","NORTHCAROLINA","NORTHDAKOTA","NORTHERNMARIANAISLANDS","OHIO","OKLAHOMA","OREGON","PALAU","PENNSYLVANIA","PUERTORICO","RHODEISLAND","SOUTHCAROLINA","SOUTHDAKOTA","TENNESSEE","TEXAS","UTAH","VERMONT","VIRGINISLANDS","VIRGINIA","WASHINGTON","WESTVIRGINIA","WISCONSIN","WYOMING"]}}});if(a.isEmpty(this.options.addressValidation)){this.options.addressValidation=true}},getAddress:function(){var d=this.getValue();if(this.view.type=="view"){d=this.data}var c="";if(d){if(d.street){b.each(d.street,function(e,f){c+=f+" "})}if(d.city){c+=d.city+" "}if(d.state){c+=d.state+" "}if(d.zip){c+=d.zip}}return c},renderField:function(c){this.base();var e=this;b(this.fieldContainer).addClass("alpaca-addressfield");if(this.options.addressValidation&&!this.isDisplayOnly()){b('<div style="clear:both;"></div>').appendTo(this.fieldContainer);var d=b('<div class="alpaca-form-button">Google Map</div>').appendTo(this.fieldContainer);if(d.button){d.button({text:true})}d.click(function(){if(google&&google.maps){var g=new google.maps.Geocoder();var f=e.getAddress();if(g){g.geocode({address:f},function(k,i){if(i==google.maps.GeocoderStatus.OK){var j=e.getId()+"-map-canvas";if(b("#"+j).length===0){b("<div id='"+j+"' class='alpaca-controlfield-address-mapcanvas'></div>").appendTo(e.fieldContainer)}var l=new google.maps.Map(document.getElementById(e.getId()+"-map-canvas"),{zoom:10,center:k[0].geometry.location,mapTypeId:google.maps.MapTypeId.ROADMAP});var h=new google.maps.Marker({map:l,position:k[0].geometry.location})}else{e.displayMessage("Geocoding failed: "+i)}})}}else{e.displayMessage("Google Map API is not installed.")}}).wrap("<small/>");if(this.options.showMapOnLoad){d.click()}}if(c){c()}},isContainer:function(){return false},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{validateAddress:{title:"Address Validation",description:"Enable address validation if true",type:"boolean","default":true},showMapOnLoad:{title:"Whether to show the map when first loaded",type:"boolean"}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{validateAddress:{helper:"Address validation if checked",rightLabel:"Enable Google Map for address validation?",type:"checkbox"}}})},getTitle:function(){return"Address"},getDescription:function(){return"Standard US Address with Street, City, State and Zip. Also comes with support for Google map."},getType:function(){return"any"},getFieldType:function(){return"address"}});a.registerFieldClass("address",a.Fields.AddressField)})(jQuery);(function(b){var a=b.alpaca;a.Fields.DateField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();if(!this.options.dateFormat){this.options.dateFormat=a.defaultDateFormat}if(!this.options.dateFormatRegex){this.options.dateFormatRegex=a.regexps.date}},postRender:function(){this.base();if(this.field&&b.datepicker){var c=this.options.datepicker;if(!c){c={changeMonth:true,changeYear:true}}if(!c.dateFormat){c.dateFormat=this.options.dateFormat}this.field.datepicker(c);if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-date")}}},onChange:function(c){this.base();this.renderValidationState()},handleValidate:function(){var e=this.base();var d=this.validation;var c=this._validateDateFormat();d.invalidDate={message:c?"":a.substituteTokens(this.view.getMessage("invalidDate"),[this.options.dateFormat]),status:c};return e&&d.invalidDate["status"]},_validateDateFormat:function(){var c=this.field.val();if(b.datepicker){try{b.datepicker.parseDate(this.options.dateFormat,c);return true}catch(d){return false}}else{return c.match(this.options.dateFormatRegex)}},setValue:function(c){if(c===""){this.base(c);return}this.base(c)},getSchemaOfSchema:function(){return a.merge(this.base(),{properties:{format:{title:"Format",description:"Property data format",type:"string","default":"date","enum":["date"],readonly:true}}})},getOptionsForSchema:function(){return a.merge(this.base(),{fields:{format:{type:"text"}}})},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{dateFormat:{title:"Date Format",description:"Date format",type:"string","default":a.defaultDateFormat},dateFormatRegex:{title:"Format Regular Expression",description:"Regular expression for validation date format",type:"string","default":a.regexps.date},datepicker:{title:"Date Picker options",description:"Optional configuration to be passed to jQuery UI DatePicker control",type:"any"}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{dateFormat:{type:"text"},dateFormatRegex:{type:"text"},datetime:{type:"any"}}})},getTitle:function(){return"Date Field"},getDescription:function(){return"Date Field."},getFieldType:function(){return"date"}});a.registerMessages({invalidDate:"Invalid date for format {0}"});a.registerFieldClass("date",a.Fields.DateField);a.registerDefaultFormatFieldMapping("date","date")})(jQuery);(function(b){var a=b.alpaca;a.Fields.DatetimeField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base()},postRender:function(){var c=this;this.base();if(this.field){if(this.field.datetimepicker){this.field.hover(function(){if(!b(this).hasClass("hasDatepicker")){var d=c.options.timepicker;if(!d){d=c.options.timepicker}if(!d){d={changeYear:true,changeMonth:true}}b(this).datetimepicker(d)}});if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-datetime")}}}},setValue:function(c){if(c){if(a.isNumber()){c=new Date(c)}if(Object.prototype.toString.call(c)=="[object Date]"){this.base((c.getMonth()+1)+"/"+c.getDate()+"/"+c.getFullYear()+" "+c.getHours()+":"+c.getMinutes())}else{this.base(c)}}else{this.base(c)}},getValue:function(){return this.base()},getDatetime:function(){try{return this.field.datetimepicker("getDate")}catch(c){return this.getValue()}},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{timepicker:{title:"Timepicker options",description:"Options that are supported by the <a href='http://trentrichardson.com/examples/timepicker/'>jQuery timepicker addon</a>.",type:"any"}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{timepicker:{type:"any"}}})},getTitle:function(){return"Datetime Field"},getDescription:function(){return"Datetime Field based on Trent Richardson's <a href='http://trentrichardson.com/examples/timepicker/'>jQuery timepicker addon</a>."},getFieldType:function(){return"datetime"}});a.registerFieldClass("datetime",a.Fields.DatetimeField);a.registerDefaultFormatFieldMapping("datetime","datetime")})(jQuery);(function(b){var a=b.alpaca;a.Fields.EditorField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();this.controlFieldTemplateDescriptor=this.view.getTemplateDescriptor("controlFieldEditor")},postRender:function(){this.base();var d=this;if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-editor");b(this.fieldContainer).parent().css("width","100%");var e=this.options.aceHeight;if(e){b(this.fieldContainer).css("height",e)}var c=this.options.aceWidth;if(!c){c="100%"}b(this.fieldContainer).css("width",c)}var g=b(this.fieldContainer).find(".control-field-editor-el")[0];if(!ace&&window.ace){ace=window.ace}this.editor=ace.edit(g);var f=this.options.aceTheme;if(!f){f="ace/theme/chrome"}this.editor.setTheme(f);var i=this.options.aceMode;if(!i){i="ace/mode/json"}this.editor.getSession().setMode(i);this.editor.renderer.setHScrollBarAlwaysVisible(false);this.editor.setShowPrintMargin(false);this.editor.setValue(this.data);this.editor.clearSelection();if(this.options.aceFitContentHeight){var h=function(){var j=d.editor.getSession().getScreenLength()*d.editor.renderer.lineHeight+d.editor.renderer.scrollBar.getWidth();b(d.fieldContainer).height(j.toString()+"px");d.editor.resize()};h();d.editor.getSession().on("change",h)}if(this.schema.readonly){this.editor.setReadOnly(true)}b(g).bind("destroyed",function(){if(d.editor){d.editor.destroy();d.editor=null}})},destroy:function(){if(this.editor){this.editor.destroy();this.editor=null}this.base()},getEditor:function(){return this.editor},handleValidate:function(){var e=this.base();var d=this.validation;var c=this._validateWordCount();d.wordLimitExceeded={message:c?"":a.substituteTokens(this.view.getMessage("wordLimitExceeded"),[this.options.wordlimit]),status:c};return e&&d.wordLimitExceeded["status"]},_validateWordCount:function(){if(this.options.wordlimit&&this.options.wordlimit>-1){var d=this.editor.getValue();if(d){var c=d.split(" ").length;if(c>this.options.wordlimit){return false}}}return true},onDependentReveal:function(){this.editor.resize()},setValue:function(d){var c=this;if(this.editor){this.editor.setValue(d)}this.base(d)},getValue:function(){var c=null;if(this.editor){c=this.editor.getValue()}return c},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{aceTheme:{title:"ACE Editor Theme",description:"Specifies the theme to set onto the editor instance",type:"string","default":"ace/theme/twilight"},aceMode:{title:"ACE Editor Mode",description:"Specifies the mode to set onto the editor instance",type:"string","default":"ace/mode/javascript"},aceWidth:{title:"ACE Editor Height",description:"Specifies the width of the wrapping div around the editor",type:"string","default":"100%"},aceHeight:{title:"ACE Editor Height",description:"Specifies the height of the wrapping div around the editor",type:"string","default":"300px"},aceFitContentHeight:{title:"ACE Fit Content Height",description:"Configures the ACE Editor to auto-fit its height to the contents of the editor",type:"boolean","default":false},wordlimit:{title:"Word Limit",description:"Limits the number of words allowed in the text area.",type:"number","default":-1}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{aceTheme:{type:"text"},aceMode:{type:"text"},wordlimit:{type:"integer"}}})},getTitle:function(){return"Editor"},getDescription:function(){return"Editor"},getFieldType:function(){return"editor"}});a.registerMessages({wordLimitExceeded:"The maximum word limit of {0} has been exceeded."});a.registerTemplate("controlFieldEditor",'<div id="${id}" class="control-field-editor-el"></div>');a.registerFieldClass("editor",a.Fields.EditorField)})(jQuery);(function(b){var a=b.alpaca;a.Fields.EmailField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();if(!this.schema.pattern){this.schema.pattern=a.regexps.email}},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-email")}},handleValidate:function(){var d=this.base();var c=this.validation;if(!c.invalidPattern["status"]){c.invalidPattern["message"]=this.view.getMessage("invalidEmail")}return d},getSchemaOfSchema:function(){var c=(this.schema&&this.schema.pattern)?this.schema.pattern:a.regexps.email;return a.merge(this.base(),{properties:{pattern:{title:"Pattern",description:"Field Pattern in Regular Expression",type:"string","default":c,"enum":[c],readonly:true},format:{title:"Format",description:"Property data format",type:"string","default":"email","enum":["email"],readonly:true}}})},getOptionsForSchema:function(){return a.merge(this.base(),{fields:{format:{type:"text"}}})},getTitle:function(){return"Email Field"},getDescription:function(){return"Email Field."},getFieldType:function(){return"email"}});a.registerMessages({invalidEmail:"Invalid Email address e.g. info@cloudcms.com"});a.registerFieldClass("email",a.Fields.EmailField);a.registerDefaultFormatFieldMapping("email","email")})(jQuery);(function(b){var a=b.alpaca;a.Fields.IntegerField=a.Fields.NumberField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},getValue:function(){var c=this.field.val();if(a.isValEmpty(c)){return -1}else{return parseInt(c,10)}},onChange:function(c){this.base();if(this.slider){this.slider.slider("value",this.getValue())}},postRender:function(){this.base();var c=this;if(this.options.slider){if(!a.isEmpty(this.schema.maximum)&&!a.isEmpty(this.schema.minimum)){if(this.field){this.field.after('<div id="slider"></div>');this.slider=b("#slider",this.field.parent()).slider({value:this.getValue(),min:this.schema.minimum,max:this.schema.maximum,slide:function(d,e){c.setValue(e.value);c.renderValidationState()}})}}}if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-integer")}},handleValidate:function(){var d=this.base();var c=this.validation;if(!c.stringNotANumber["status"]){c.stringNotANumber["message"]=this.view.getMessage("stringNotAnInteger")}return d},_validateNumber:function(){var c=this.field.val();if(a.isValEmpty(c)){return true}var d=this.getValue();if(isNaN(d)){return false}if(!c.match(a.regexps.integer)){return false}return true},getSchemaOfSchema:function(){return a.merge(this.base(),{properties:{minimum:{title:"Minimum",description:"Minimum value of the property.",type:"integer"},maximum:{title:"Maximum",description:"Maximum value of the property.",type:"integer"},divisibleBy:{title:"Divisible By",description:"Property value must be divisible by this number.",type:"integer"}}})},getOptionsForSchema:function(){return a.merge(this.base(),{fields:{minimum:{helper:"Minimum value of the field.",type:"integer"},maximum:{helper:"Maximum value of the field.",type:"integer"},divisibleBy:{helper:"Property value must be divisible by this number.",type:"integer"}}})},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{slider:{title:"Slider",description:"Generate jQuery UI slider control with the field if true.",type:"boolean","default":false}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{slider:{rightLabel:"Slider control ?",helper:"Generate slider control if selected.",type:"checkbox"}}})},getTitle:function(){return"Integer Field"},getDescription:function(){return"Field for integers."},getType:function(){return"integer"},getFieldType:function(){return"integer"}});a.registerMessages({stringNotAnInteger:"This value is not an integer."});a.registerFieldClass("integer",a.Fields.IntegerField);a.registerDefaultSchemaFieldMapping("integer","integer")})(jQuery);(function(b){var a=b.alpaca;a.Fields.IPv4Field=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();if(!this.schema.pattern){this.schema.pattern=a.regexps.ipv4}},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-ipv4")}},handleValidate:function(){var d=this.base();var c=this.validation;if(!c.invalidPattern["status"]){c.invalidPattern["message"]=this.view.getMessage("invalidIPv4")}return d},getSchemaOfSchema:function(){var c=(this.schema&&this.schema.pattern)?this.schema.pattern:a.regexps.ipv4;return a.merge(this.base(),{properties:{pattern:{title:"Pattern",description:"Field Pattern in Regular Expression",type:"string","default":c,readonly:true},format:{title:"Format",description:"Property data format",type:"string","enum":["ip-address"],"default":"ip-address",readonly:true}}})},getOptionsForSchema:function(){return a.merge(this.base(),{fields:{format:{type:"text"}}})},getTitle:function(){return"IP Address Field"},getDescription:function(){return"IP Address Field."},getFieldType:function(){return"ipv4"}});a.registerMessages({invalidIPv4:"Invalid IPv4 address, e.g. 192.168.0.1"});a.registerFieldClass("ipv4",a.Fields.IPv4Field);a.registerDefaultFormatFieldMapping("ip-address","ipv4")})(jQuery);(function(b){var a=b.alpaca;a.Fields.JSONField=a.Fields.TextAreaField.extend({constructor:function(f,j,h,i,e,d,g){this.base(f,j,h,i,e,d,g)},setValue:function(d){if(a.isObject(d)||typeof(d)=="object"){d=JSON.stringify(d,null,3)}this.base(d)},getValue:function(){var d=this.base();if(d&&a.isString(d)){d=JSON.parse(d)}return d},handleValidate:function(){var f=this.base();var e=this.validation;var d=this._validateJSON();e.stringNotAJSON={message:d.status?"":this.view.getMessage("stringNotAJSON")+" "+d.message,status:d.status};return f&&e.stringNotAJSON["status"]},_validateJSON:function(){var d=this.field.val();if(a.isValEmpty(d)){return{status:true}}try{var g=JSON.parse(d);this.setValue(JSON.stringify(g,null,3));return{status:true}}catch(f){return{status:false,message:f.message}}},postRender:function(){this.base();var d=this;if(this.field){this.field.bind("keypress",function(f){if(f.which==34){d.field.insertAtCaret('"')}if(f.which==123){d.field.insertAtCaret("}")}if(f.which==91){d.field.insertAtCaret("]")}});this.field.bind("keypress","Ctrl+l",function(){d.getEl().removeClass("alpaca-field-focused");d.renderValidationState()});this.field.attr("title","Type Ctrl+L to format and validate the JSON string.")}if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-json")}},getTitle:function(){return"JSON Editor"},getDescription:function(){return"Editor for JSON objects with basic validation and formatting."},getFieldType:function(){return"json"}});a.registerMessages({stringNotAJSON:"This value is not a valid JSON string."});a.registerFieldClass("json",a.Fields.JSONField);b.fn.insertAtCaret=function(d){return this.each(function(){if(document.selection){this.focus();sel=document.selection.createRange();sel.text=d;this.focus()}else{if(this.selectionStart||this.selectionStart=="0"){var f=this.selectionStart;var e=this.selectionEnd;var g=this.scrollTop;this.value=this.value.substring(0,f)+d+this.value.substring(e,this.value.length);this.focus();this.selectionStart=f;this.selectionEnd=f;this.scrollTop=g}else{this.value+=d;this.focus()}}})};jQuery.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};function c(e){if(typeof e.data!=="string"){return}var d=e.handler,f=e.data.toLowerCase().split(" ");e.handler=function(o){if(this!==o.target&&(/textarea|select/i.test(o.target.nodeName)||o.target.type==="text")){return}var j=o.type!=="keypress"&&jQuery.hotkeys.specialKeys[o.which],p=String.fromCharCode(o.which).toLowerCase(),m,n="",h={};if(o.altKey&&j!=="alt"){n+="alt+"}if(o.ctrlKey&&j!=="ctrl"){n+="ctrl+"}if(o.metaKey&&!o.ctrlKey&&j!=="meta"){n+="meta+"}if(o.shiftKey&&j!=="shift"){n+="shift+"}if(j){h[n+j]=true}else{h[n+p]=true;h[n+jQuery.hotkeys.shiftNums[p]]=true;if(n==="shift+"){h[jQuery.hotkeys.shiftNums[p]]=true}}for(var k=0,g=f.length;k<g;k++){if(h[f[k]]){return d.apply(this,arguments)}}}}jQuery.each(["keydown","keyup","keypress"],function(){jQuery.event.special[this]={add:c}})})(jQuery);(function(b){var a=b.alpaca;a.Fields.IntegerField=a.Fields.NumberField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},getValue:function(){var c=this.field.val();if(a.isValEmpty(c)){return -1}else{return parseInt(c,10)}},onChange:function(c){this.base();if(this.slider){this.slider.slider("value",this.getValue())}},postRender:function(){this.base();var c=this;if(this.options.slider){if(!a.isEmpty(this.schema.maximum)&&!a.isEmpty(this.schema.minimum)){if(this.field){this.field.after('<div id="slider"></div>');this.slider=b("#slider",this.field.parent()).slider({value:this.getValue(),min:this.schema.minimum,max:this.schema.maximum,slide:function(d,e){c.setValue(e.value);c.renderValidationState()}})}}}if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-integer")}},handleValidate:function(){var d=this.base();var c=this.validation;if(!c.stringNotANumber["status"]){c.stringNotANumber["message"]=this.view.getMessage("stringNotAnInteger")}return d},_validateNumber:function(){var c=this.field.val();if(a.isValEmpty(c)){return true}var d=this.getValue();if(isNaN(d)){return false}if(!c.match(a.regexps.integer)){return false}return true},getSchemaOfSchema:function(){return a.merge(this.base(),{properties:{minimum:{title:"Minimum",description:"Minimum value of the property.",type:"integer"},maximum:{title:"Maximum",description:"Maximum value of the property.",type:"integer"},divisibleBy:{title:"Divisible By",description:"Property value must be divisible by this number.",type:"integer"}}})},getOptionsForSchema:function(){return a.merge(this.base(),{fields:{minimum:{helper:"Minimum value of the field.",type:"integer"},maximum:{helper:"Maximum value of the field.",type:"integer"},divisibleBy:{helper:"Property value must be divisible by this number.",type:"integer"}}})},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{slider:{title:"Slider",description:"Generate jQuery UI slider control with the field if true.",type:"boolean","default":false}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{slider:{rightLabel:"Slider control ?",helper:"Generate slider control if selected.",type:"checkbox"}}})},getTitle:function(){return"Integer Field"},getDescription:function(){return"Field for integers."},getType:function(){return"integer"},getFieldType:function(){return"integer"}});a.registerMessages({stringNotAnInteger:"This value is not an integer."});a.registerFieldClass("integer",a.Fields.IntegerField);a.registerDefaultSchemaFieldMapping("integer","integer")})(jQuery);(function(b){var a=b.alpaca;a.Fields.LowerCaseField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-lowercase")}},setValue:function(d){var c=d.toLowerCase();if(c!=this.getValue()){this.base(c)}},onKeyPress:function(c){this.base(c);var d=this;a.later(25,this,function(){var e=d.getValue();d.setValue(e)})},getTitle:function(){return"Lowercase Text"},getDescription:function(){return"Text field for lowercase text."},getFieldType:function(){return"lowercase"}});a.registerFieldClass("lowercase",a.Fields.LowerCaseField);a.registerDefaultFormatFieldMapping("lowercase","lowercase")})(jQuery);(function(b){var a=b.alpaca;a.Fields.MapField=a.Fields.ArrayField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();a.mergeObject(this.options,{forceRevalidation:true});if(a.isEmpty(this.data)){return}if(!a.isArray(this.data)){if(a.isObject(this.data)){var c=[];b.each(this.data,function(d,e){var f=a.copyOf(e);f._key=d;c.push(f)});this.data=c}}},getValue:function(){if(this.children.length===0&&!this.schema.required){return}var f={};for(var e=0;e<this.children.length;e++){var c=this.children[e].getValue();var d=c._key;if(d){delete c._key;f[d]=c}}return f},handleValidate:function(){var e=this.base();var d=this.validation;var f=this._validateMapKeysNotEmpty();d.keyMissing={message:f?"":this.view.getMessage("keyMissing"),status:f};var c=this._validateMapKeysUnique();d.keyNotUnique={message:c?"":this.view.getMessage("keyNotUnique"),status:c};return e&&d.keyMissing["status"]&&d.keyNotUnique["status"]},_validateMapKeysNotEmpty:function(){var f=true;for(var e=0;e<this.children.length;e++){var c=this.children[e].getValue();var d=c._key;if(!d){f=false;break}}return f},_validateMapKeysUnique:function(){var g=true;var f={};for(var e=0;e<this.children.length;e++){var c=this.children[e].getValue();var d=c._key;if(f[d]){g=false}f[d]=d}return g},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-map")}},getTitle:function(){return"Map Field"},getDescription:function(){return"Field for objects with key/value pairs that share the same schema for values."},getFieldType:function(){return"map"}});a.registerFieldClass("map",a.Fields.MapField);a.registerMessages({keyNotUnique:"Keys of map field are not unique.",keyMissing:"Map contains an empty key."})})(jQuery);(function(b){var a=b.alpaca;a.Fields.PasswordField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();if(!this.schema.pattern){this.schema.pattern=a.regexps.password}this.controlFieldTemplateDescriptor=this.view.getTemplateDescriptor("controlFieldPassword")},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-password")}},handleValidate:function(){var d=this.base();var c=this.validation;if(!c.invalidPattern["status"]){c.invalidPattern["message"]=this.view.getMessage("invalidPassword")}return d},getSchemaOfSchema:function(){var c=(this.schema&&this.schema.pattern)?this.schema.pattern:/^[0-9a-zA-Z\x20-\x7E]*$/;return a.merge(this.base(),{properties:{pattern:{title:"Pattern",description:"Field Pattern in Regular Expression",type:"string","default":this.schema.pattern,"enum":[c],readonly:true},format:{title:"Format",description:"Property data format",type:"string","default":"password","enum":["password"],readonly:true}}})},getOptionsForSchema:function(){return a.merge(this.base(),{fields:{format:{type:"text"}}})},getTitle:function(){return"Password Field"},getDescription:function(){return"Password Field."},getFieldType:function(){return"password"}});a.registerTemplate("controlFieldPassword",'<input type="password" id="${id}" {{if options.size}}size="${options.size}"{{/if}} {{if options.readonly}}readonly="readonly"{{/if}} {{if name}}name="${name}"{{/if}} {{each(i,v) options.data}}data-${i}="${v}"{{/each}}/>');a.registerMessages({invalidPassword:"Invalid Password"});a.registerFieldClass("password",a.Fields.PasswordField);a.registerDefaultFormatFieldMapping("password","password")})(jQuery);(function(b){var a=b.alpaca;a.Fields.PersonalNameField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-personalname")}},setValue:function(d){var e="";for(var c=0;c<d.length;c++){if(c===0){e+=d.charAt(c).toUpperCase()}else{if(d.charAt(c-1)==" "||d.charAt(c-1)=="-"||d.charAt(c-1)=="'"){e+=d.charAt(c).toUpperCase()}else{e+=d.charAt(c)}}}if(e!=this.getValue()){this.base(e)}},onKeyPress:function(c){this.base(c);var d=this;a.later(25,this,function(){var e=d.getValue();d.setValue(e)})},getTitle:function(){return"Personal Name"},getDescription:function(){return"Text Field for personal name with captical letter for first letter & after hyphen, space or apostrophe."},getFieldType:function(){return"personalname"}});a.registerFieldClass("personalname",a.Fields.PersonalNameField)})(jQuery);(function(b){var a=b.alpaca;a.Fields.PhoneField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();if(!this.schema.pattern){this.schema.pattern=a.regexps.phone}if(a.isEmpty(this.options.maskString)){this.options.maskString="(999) 999-9999"}},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-phone")}},handleValidate:function(){var d=this.base();var c=this.validation;if(!c.invalidPattern["status"]){c.invalidPattern["message"]=this.view.getMessage("invalidPhone")}return d},getSchemaOfSchema:function(){var c=(this.schema&&this.schema.pattern)?this.schema.pattern:a.regexps.phone;return a.merge(this.base(),{properties:{pattern:{title:"Pattern",description:"Field Pattern in Regular Expression",type:"string","default":c,"enum":[c],readonly:true},format:{title:"Format",description:"Property data format",type:"string","default":"phone","enum":["phone"],readonly:true}}})},getOptionsForSchema:function(){return a.merge(this.base(),{fields:{format:{type:"text"}}})},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{maskString:{title:"Field Mask String",description:"Expression for field mask",type:"string","default":"(999) 999-9999"}}})},getTitle:function(){return"Phone Field"},getDescription:function(){return"Phone Field."},getFieldType:function(){return"phone"}});a.registerMessages({invalidPhone:"Invalid Phone Number, e.g. (123) 456-9999"});a.registerFieldClass("phone",a.Fields.PhoneField);a.registerDefaultFormatFieldMapping("phone","phone")})(jQuery);(function(b){var a=b.alpaca;a.Fields.TagField=a.Fields.LowerCaseField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();if(!this.options.separator){this.options.separator=","}},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-tag")}},getValue:function(){var c=this.base();if(c===""){return[]}return c.split(this.options.separator)},setValue:function(c){if(c===""){return}this.base(c.join(this.options.separator))},onBlur:function(f){this.base(f);var c=this.getValue();var d=[];b.each(c,function(g,e){if(e.trim()!==""){d.push(e.trim())}});this.setValue(d)},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{separator:{title:"Separator",description:"Separator used to split tags.",type:"string","default":","}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{separator:{type:"text"}}})},getTitle:function(){return"Tag Field"},getDescription:function(){return"Text field for entering list of tags separated by delimiter."},getFieldType:function(){return"tag"}});a.registerFieldClass("tag",a.Fields.TagField)})(jQuery);(function(b){var a=b.alpaca;a.Fields.TimeField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.base();if(!this.options.timeFormat){this.options.timeFormat="hh:mm:ss"}if(!this.options.timeFormatRegex){this.options.timeFormatRegex=/^(([0-1][0-9])|([2][0-3])):([0-5][0-9]):([0-5][0-9])$/}if(a.isEmpty(this.options.maskString)){this.options.maskString="99:99:99"}},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-time")}},onChange:function(c){this.base();this.renderValidationState()},handleValidate:function(){var e=this.base();var d=this.validation;var c=this._validateTimeFormat();d.invalidTime={message:c?"":a.substituteTokens(this.view.getMessage("invalidTime"),[this.options.timeFormat]),status:c};return e&&d.invalidTime["status"]},_validateTimeFormat:function(){var c=this.field.val();if(!this.schema.required&&(a.isValEmpty(c)||c=="__:__:__")){return true}return c.match(this.options.timeFormatRegex)},setValue:function(c){if(c===""){this.base(c);return}this.base(c)},getSchemaOfSchema:function(){return a.merge(this.base(),{properties:{format:{title:"Format",description:"Property data format",type:"string","default":"time","enum":["time"],readonly:true}}})},getOptionsForSchema:function(){return a.merge(this.base(),{fields:{format:{type:"text"}}})},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{timeFormat:{title:"Time Format",description:"Time format",type:"string","default":"hh:mm:ss"},timeFormatRegex:{title:"Format Regular Expression",description:"Regular expression for validation time format",type:"string","default":/^(([0-1][0-9])|([2][0-3])):([0-5][0-9]):([0-5][0-9])$/},maskString:{"default":"99:99:99"}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{timeFormat:{type:"text"},timeFormatRegex:{type:"text"}}})},getTitle:function(){return"Time Field"},getDescription:function(){return"Field for time."},getFieldType:function(){return"time"}});a.registerMessages({invalidTime:"Invalid time for format {0}"});a.registerFieldClass("time",a.Fields.TimeField);a.registerDefaultFormatFieldMapping("time","time")})(jQuery);(function(b){var a=b.alpaca;a.Fields.UpperCaseField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-uppercase")}},setValue:function(c){var d=c.toUpperCase();if(d!=this.getValue()){this.base(d)}},onKeyPress:function(c){this.base(c);var d=this;a.later(25,this,function(){var e=d.getValue();d.setValue(e)})},getTitle:function(){return"Uppercase Text"},getDescription:function(){return"Text field for uppercase text."},getFieldType:function(){return"uppercase"}});a.registerFieldClass("uppercase",a.Fields.UpperCaseField);a.registerDefaultFormatFieldMapping("uppercase","uppercase")})(jQuery);(function(b){var a=b.alpaca;a.Fields.WysiwygField=a.Fields.TextAreaField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f);this.controlsConfig={};this.controlsConfig.simple={html:{visible:true},createLink:{visible:false},unLink:{visible:false},h1:{visible:false},h2:{visible:false},h3:{visible:false},indent:{visible:false},insertHorizontalRule:{visible:false},insertImage:{visible:false},insertOrderedList:{visible:false},insertTable:{visible:false},insertUnorderedList:{visible:false},justifyCenter:{visible:false},justifyFull:{visible:false},justifyLeft:{visible:false},justifyRight:{visible:false},outdent:{visible:false},redo:{visible:false},removeFormat:{visible:false},subscript:{visible:false},superscript:{visible:false},undo:{visible:false},code:{visible:false},strikeThrough:{visible:false}}},setup:function(){this.base();this.plugin=null},postRender:function(){this.base();var d=this;if(this.field&&b.wysiwyg){var c=this.options.wysiwyg?this.options.wysiwyg:{};if(c.controls){if(typeof(c.controls)==="string"){c.controls=this.controlsConfig[c.controls];if(!c.controls){c.controls={}}}}if(this.options.onDemand){this.outerEl.find("textarea").mouseover(function(){if(!d.plugin){d.plugin=b(this).wysiwyg(c);d.outerEl.find(".wysiwyg").mouseout(function(){if(d.plugin){d.plugin.wysiwyg("destroy")}d.plugin=null})}})}else{this.plugin=this.field.wysiwyg(c)}this.outerEl.find(".wysiwyg").mouseout(function(){d.data=d.getValue();d.renderValidationState()})}if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-wysiwyg")}},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{wysiwyg:{title:"Editor options",description:"Options that are supported by the <a href='https://github.com/akzhan/jwysiwyg'>jQuery WYSIWYG plugin</a>.",type:"any"},onDemand:{title:"On Demand",description:"If true, WYSIWYG editor will only be enabled when the field is hovered.",type:"boolean","default":false}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{wysiwyg:{type:"any"},onDemand:{type:"checkbox",rightLabel:"Make the editor on-demand?"}}})},getTitle:function(){return"Wysiwyg Editor"},getDescription:function(){return"Wysiwyg editor for multi-line text which is based on Akzhan Abdulin's <a href='https://github.com/akzhan/jwysiwyg'>jQuery WYSIWYG plugin</a>."},getFieldType:function(){return"wysiwyg"}});a.registerFieldClass("wysiwyg",a.Fields.WysiwygField)})(jQuery);(function(b){var a=b.alpaca;a.Fields.StateField=a.Fields.SelectField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){if(a.isUndefined(this.options.capitalize)){this.options.capitalize=false}if(a.isUndefined(this.options.includeStates)){this.options.includeStates=true}if(a.isUndefined(this.options.includeTerritories)){this.options.includeTerritories=true}if(a.isUndefined(this.options.format)){this.options.format="name"}if(this.options.format=="name"||this.options.format=="code"){}else{a.logError("The configured state format: "+this.options.format+" is not a legal value [name, code]");this.options.format="name"}var c=a.retrieveUSHoldings(this.options.includeStates,this.options.includeTerritories,(this.options.format=="code"),this.options.capitalize);this.schema["enum"]=c.keys;this.options.optionLabels=c.values;this.base()},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-state")}},handleValidate:function(){var c=this.base();return c},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{format:{title:"Format",description:"How to represent the state values in the selector",type:"string","default":"name","enum":["name","code"],readonly:true},capitalize:{title:"Capitalize",description:"Whether the values should be capitalized",type:"boolean","default":false,readonly:true},includeStates:{title:"Include States",description:"Whether to include the states of the United States",type:"boolean","default":true,readonly:true},includeTerritories:{title:"Include Territories",description:"Whether to include the territories of the United States",type:"boolean","default":true,readonly:true}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{format:{type:"text"},capitalize:{type:"checkbox"},includeStates:{type:"checkbox"},includeTerritories:{type:"checkbox"}}})},getTitle:function(){return"State Field"},getDescription:function(){return"Provides a dropdown selector of states and/or territories in the United States, keyed by their two-character code."},getFieldType:function(){return"state"}});a.registerFieldClass("state",a.Fields.StateField);a.registerDefaultFormatFieldMapping("state","state");a.retrieveUSHoldings=function(){var c=[];c.push({name:"Arkansas",code:"AK",state:true,territory:false});c.push({name:"Alabama",code:"AL",state:true,territory:false});c.push({name:"American Samoa",code:"AS",state:false,territory:true});c.push({name:"Arizona",code:"AR",state:true,territory:false});c.push({name:"California",code:"CA",state:true,territory:false});c.push({name:"Colorado",code:"CO",state:true,territory:false});c.push({name:"Connecticut",code:"CT",state:true,territory:false});c.push({name:"Delaware",code:"DE",state:true,territory:false});c.push({name:"Distict of Columbia",code:"DC",state:false,territory:true});c.push({name:"Federated States of Micronesia",code:"FM",state:false,territory:true});c.push({name:"Florida",code:"FL",state:true,territory:false});c.push({name:"Georgia",code:"GA",state:true,territory:false});c.push({name:"Guam",code:"GU",state:false,territory:true});c.push({name:"Georgia",code:"GA",state:true,territory:false});c.push({name:"Hawaii",code:"HI",state:true,territory:false});c.push({name:"Idaho",code:"ID",state:true,territory:false});c.push({name:"Illinois",code:"IL",state:true,territory:false});c.push({name:"Indiana",code:"IN",state:true,territory:false});c.push({name:"Iowa",code:"IA",state:true,territory:false});c.push({name:"Kansas",code:"KS",state:true,territory:false});c.push({name:"Kentucky",code:"KY",state:true,territory:false});c.push({name:"Louisiana",code:"LA",state:true,territory:false});c.push({name:"Maine",code:"ME",state:true,territory:false});c.push({name:"Marshall Islands",code:"MH",state:false,territory:true});c.push({name:"Maryland",code:"MD",state:true,territory:false});c.push({name:"Massachusetts",code:"MA",state:true,territory:false});c.push({name:"Michigan",code:"MI",state:true,territory:false});c.push({name:"Minnesota",code:"MN",state:true,territory:false});c.push({name:"Mississippi",code:"MS",state:true,territory:false});c.push({name:"Missouri",code:"MO",state:true,territory:false});c.push({name:"Montana",code:"MT",state:true,territory:false});c.push({name:"Nebraska",code:"NE",state:true,territory:false});c.push({name:"Nevada",code:"NV",state:true,territory:false});c.push({name:"New Hampshire",code:"NH",state:true,territory:false});c.push({name:"New Jersey",code:"NJ",state:true,territory:false});c.push({name:"New Mexico",code:"NM",state:true,territory:false});c.push({name:"New York",code:"NY",state:true,territory:false});c.push({name:"North Carolina",code:"NC",state:true,territory:false});c.push({name:"North Dakota",code:"ND",state:true,territory:false});c.push({name:"Northern Mariana Islands",code:"MP",state:true,territory:false});c.push({name:"Ohio",code:"OH",state:true,territory:false});c.push({name:"Oklahoma",code:"OK",state:true,territory:false});c.push({name:"Oregon",code:"OR",state:true,territory:false});c.push({name:"Palau",code:"PW",state:false,territory:true});c.push({name:"Pennsylvania",code:"PA",state:true,territory:false});c.push({name:"Puerto Rico",code:"PR",state:false,territory:true});c.push({name:"Rhode Island",code:"RI",state:true,territory:false});c.push({name:"South Carolina",code:"SC",state:true,territory:false});c.push({name:"South Dakota",code:"SD",state:true,territory:false});c.push({name:"Tennessee",code:"TN",state:true,territory:false});c.push({name:"Texas",code:"TX",state:true,territory:false});c.push({name:"Utah",code:"UT",state:true,territory:false});c.push({name:"Vermont",code:"VT",state:true,territory:false});c.push({name:"Virgin Islands",code:"VI",state:false,territory:true});c.push({name:"Virginia",code:"VA",state:true,territory:false});c.push({name:"Washington",code:"WA",state:true,territory:false});c.push({name:"West Virginia",code:"WV",state:true,territory:false});c.push({name:"Wisconsin",code:"WI",state:true,territory:false});c.push({name:"Wyoming",code:"WY",state:true,territory:false});return function(l,e,h,g){var m={keys:[],values:[]};for(var f=0;f<c.length;f++){var d=false;if(c[f].state&&l){d=true}else{if(c[f].territory&&e){d=true}}if(d){var k=c[f].code;var j=c[f].name;if(h){j=c[f].code}if(g){j=j.toUpperCase()}m.keys.push(k);m.values.push(j)}}return m}}()})(jQuery);(function(b){var a=b.alpaca;a.Fields.CountryField=a.Fields.SelectField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){if(a.isUndefined(this.options.capitalize)){this.options.capitalize=false}this.schema["enum"]=[];this.options.optionLabels=[];var e=this.view.getMessage("countries");if(e){for(var d in e){this.schema["enum"].push(d);var c=e[d];if(this.options.capitalize){c=c.toUpperCase()}this.options.optionLabels.push(c)}}this.base()},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-country")}},handleValidate:function(){var c=this.base();return c},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{capitalize:{title:"Capitalize",description:"Whether the values should be capitalized",type:"boolean","default":false,readonly:true}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{capitalize:{type:"checkbox"}}})},getTitle:function(){return"Country Field"},getDescription:function(){return"Provides a dropdown selector of countries keyed by their ISO3 code. The names of the countries are read from the I18N bundle for the current locale."},getFieldType:function(){return"country"}});a.registerFieldClass("country",a.Fields.CountryField);a.registerDefaultFormatFieldMapping("country","country")})(jQuery);(function(b){var a=b.alpaca;a.Fields.ZipcodeField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.options.format=(this.options.format?this.options.format:"nine");if(this.options.format=="nine"){this.schema.pattern=a.regexps["zipcode-nine"]}else{if(this.options.format=="five"){this.schema.pattern=a.regexps["zipcode-five"]}else{a.logError("The configured zipcode format: "+this.options.format+" is not a legal value [five, nine]");this.options.format="nine";this.schema.pattern=a.regexps["zipcode-nine"]}}if(this.options.format=="nine"){this.options.maskString="99999-9999"}else{if(this.options.format=="five"){this.options.maskString="99999"}}this.base()},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-zipcode")}},handleValidate:function(){var d=this.base();var c=this.validation;if(!c.invalidPattern["status"]){if(this.options.format=="nine"){c.invalidPattern["message"]=this.view.getMessage("invalidZipcodeFormatNine")}else{if(this.options.format=="five"){c.invalidPattern["message"]=this.view.getMessage("invalidZipcodeFormatFive")}}}return d},getSchemaOfOptions:function(){return a.merge(this.base(),{properties:{format:{title:"Format",description:"How to represent the zipcode field",type:"string","default":"five","enum":["five","nine"],readonly:true}}})},getOptionsForOptions:function(){return a.merge(this.base(),{fields:{format:{type:"text"}}})},getTitle:function(){return"Zipcode Field"},getDescription:function(){return"Provides a five or nine-digital US zipcode control with validation."},getFieldType:function(){return"zipcode"}});a.registerMessages({invalidZipcodeFormatFive:"Invalid Five-Digit Zipcode (#####)",invalidZipcodeFormatNine:"Invalid Nine-Digit Zipcode (#####-####)"});a.registerFieldClass("zipcode",a.Fields.ZipcodeField);a.registerDefaultFormatFieldMapping("zipcode","zipcode")})(jQuery);(function(b){var a=b.alpaca;a.Fields.URLField=a.Fields.TextField.extend({constructor:function(e,i,g,h,d,c,f){this.base(e,i,g,h,d,c,f)},setup:function(){this.schema.pattern=a.regexps.url;this.schema.format="uri";this.base()},postRender:function(){this.base();if(this.fieldContainer){this.fieldContainer.addClass("alpaca-controlfield-url")}},handleValidate:function(){var d=this.base();var c=this.validation;if(!c.invalidPattern["status"]){c.invalidPattern["message"]=this.view.getMessage("invalidURLFormat")}return d},getTitle:function(){return"URL Field"},getDescription:function(){return"Provides a text control with validation for an internet web address."},getFieldType:function(){return"url"}});a.registerMessages({invalidURLFormat:"The URL provided is not a valid web address."});a.registerFieldClass("url",a.Fields.URLField);a.registerDefaultFormatFieldMapping("url","url")})(jQuery);
0 73 \ No newline at end of file
... ...
var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-core.min.css 0 → 100644
  1 +++ a/var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-core.min.css
... ... @@ -0,0 +1,22 @@
  1 +/*!
  2 +Alpaca Version 1.1.1
  3 +
  4 +Copyright 2013 Gitana Software, Inc.
  5 +
  6 +Licensed under the Apache License, Version 2.0 (the "License");
  7 +you may not use this file except in compliance with the License.
  8 +
  9 +You may obtain a copy of the License at
  10 + http://www.apache.org/licenses/LICENSE-2.0
  11 +
  12 +Unless required by applicable law or agreed to in writing, software
  13 +distributed under the License is distributed on an "AS IS" BASIS,
  14 +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 +See the License for the specific language governing permissions and
  16 +limitations under the License.
  17 +
  18 +For more information, please contact Gitana Software, Inc. at this
  19 +address:
  20 +
  21 + info@gitanasoftware.com
  22 +*/.alpaca-clear{clear:both}.alpaca-controlfield{display:block;padding:2px;margin:2px}.alpaca-controlfield-container{display:block;padding-top:4px;padding-bottom:4px}.alpaca-controlfield-label{font-size:1.0em;font-weight:bold;text-align:left;margin-left:1px}.alpaca-controlfield-helper{font-size:.75em;margin-top:2px}.alpaca-controlfield-message{font-size:.85em}.alpaca-controlfield-message-hidden{display:none}.alpaca-field-required span.ui-icon-star{float:left;margin-right:.3em}.alpaca-controlfield-helper>span.ui-icon,.alpaca-controlfield-message>span.ui-icon{float:left;margin-right:.3em}input,textarea,select{border:1px solid #555;padding:2px;font-size:1em;border-radius:2px;-khtml-border-radius:2px;-moz-border-radius:2px;-webkit-border-radius:2px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.2);-moz-box-shadow:0 1px 2px rgba(0,0,0,.2);box-shadow:0 1px 2px rgba(0,0,0,.2)}input[type="checkbox"],input[type="radio"]{border:0}input[type="file"]{border:0;box-shadow:none}select{min-width:150px}input:focus,textarea:focus{outline:0;border:1px solid #058cf5}.alpaca-field-readonly input,.alpaca-field-readonly textarea,input[readonly],textarea[readonly]{background-color:#dcdcdc;cursor:default}DIV.alpaca-controlfield-text .twitter-typeahead .tt-dropdown-menu{background-color:white;border:1px #777 solid;padding-left:10px;margin-left:2px;padding-right:10px;color:#ccc}DIV.alpaca-controlfield-text .twitter-typeahead .tt-dropdown-menu P{font-size:1em}.tt-suggestion.tt-is-under-cursor{background-color:#ccc;color:#333}.alpaca-controlfield-email>span.ui-icon,.alpaca-controlfield-date>span.ui-icon,.alpaca-controlfield-phone>span.ui-icon{float:right;margin-left:.3em}.alpaca-controlfield-helper .alpaca-controlfield-helper-text,.alpaca-controlfield-message .alpaca-controlfield-message-text,.alpaca-controlfield-email>input,.alpaca-controlfield-date>input,.alpaca-controlfield-phone>input{line-height:16px}.alpaca-controlfield-address-mapcanvas{height:300px;width:300px;margin:10px}.alpaca-controlfield-checkbox{padding-top:.4em}.alpaca-controlfield-checkbox input{margin-right:1em}.alpaca-controlfield-checkbox{*padding-top:0}.alpaca-controlfield-radio{padding-top:.5em}.alpaca-controlfield-radio input{margin-right:.3em}.alpaca-controlfield-radio-label{margin-right:.3em}.alpaca-controlfield-file-custom-input{position:absolute;height:100px;cursor:pointer;background:transparent;border:0;opacity:0;-moz-opacity:0;filter:progid:DXImageTransform.Microsoft.Alpha(opacity = 0);z-index:999}.alpaca-controlfield-file-custom{width:350px;cursor:pointer;overflow:hidden;padding:2px;position:relative}.alpaca-controlfield-file-custom-disabled{opacity:.5;filter:progid:DXImageTransform.Microsoft.Alpha(opacity = 0);cursor:default}.alpaca-controlfield-file-custom-feedback{display:block;margin:1px 1px 1px 5px;font-style:italic;padding:.3em .6em}.alpaca-controlfield-file-custom-feedback-populated{font-style:normal;font-weight:bold;padding-left:20px}.alpaca-controlfield-editor{position:relative;width:100%;height:300px;border:1px #ccc solid}.alpaca-controlfield-editor .control-field-editor-el{position:absolute;top:0;bottom:0;left:0;right:0}.alpaca-controlfield .alpaca-controlfield-json textarea{font-family:"Courier New";font-size:.9em;font-style:italic}.alpaca-controlfield-hidden{display:none}.alpaca-fieldset{padding:4px;margin:4px;overflow:auto;position:relative}fieldset.alpaca-fieldset{margin-top:.5em;margin-right:0;margin-left:0;margin-bottom:.5em}legend.alpaca-fieldset-legend{font-size:1.1em;text-align:left;bottom:-1px}.alpaca-fieldset-legend{font-size:1.0em;font-weight:bold;text-align:left}.alpaca-fieldset-helper{padding-top:10px;padding-bottom:5px;clear:both}.alpaca-fieldset-items-container{padding-top:5px;clear:both}.alpaca-fieldset-legend-link{float:left;margin-right:.3em}.alpaca-fieldset-array-item-toolbar{padding:1px;margin:0 2px 0 2px;font-size:.75em}.alpaca-fieldset-array-toolbar{padding:10px 4px}.alpaca-fieldset-array-item-toolbar-disabled{opacity:.5}.alpaca-form{margin-top:15px;margin-left:15px}.alpaca-form-buttons-container{clear:both;display:block;margin:5px 0 5px 0}.alpaca-form-button-view-switcher{position:absolute;float:left;font-size:1em;padding:8px 3px 3px;zIndex:999999}.alpaca-form-button-view-switcher ul{listStyle:none;margin:0;padding:0;overflow:auto}.alpaca-form-button-view-switcher ul li{padding:2px;margin:1px;clear:left;float:left}.alpaca-form-button-view-switcher ul li a{text-decoration:none}.alpaca-form-buttons-container input{margin-right:4px}.alpaca-form-buttons-container input.alpaca-form-button:hover{background:#ffc}div.alpaca-fieldset{display:block;border:0;margin:1.5em 1em 1em 0}.alpaca-data-container{margin:5px 5px 5px 5px;padding:5px 5px 5px 5px;display:block}.alpaca-data{text-align:left;padding-left:10px}.alpaca-data-label{float:left;min-width:100px;clear:both;font-weight:bold;display:block}.alpaca-wizard-status-bar{list-style:none;overflow:hidden;margin:10px 0 10px 0;padding:0;counter-reset:step;float:left}.alpaca-wizard-status-bar li{float:left}.alpaca-wizard-status-bar li span{display:block;font-size:1.2em}.alpaca-wizard-status-bar li div{display:block;position:relative;padding:2px 25px 2px 30px}.alpaca-wizard-status-bar li div:before{font-size:1em;position:absolute;top:50%;left:5px;margin-top:-8px;text-align:center;font-weight:bold;padding:2px 6px;counter-increment:step;content:counter(step)}.alpaca-wizard-status-bar li div strong{font-weight:normal}.alpaca-wizard-title{font-size:1.2em;margin:0;padding:10px 0;font-weight:bold}.alpaca-wizard-desc{font-size:.9em;margin:0;padding:5px 0}.alpaca-wizard-step-title{font-size:1em;margin:0;padding:10px 0;text-decoration:underline;font-weight:bold}.alpaca-wizard-nav-bar{clear:both;float:right}fieldset.alpaca-view-web-list{border-left:none;border-bottom:0;border-right:0;padding-right:3em}fieldset.alpaca-view-web-list.fieldset-collapsed{border:solid 1px}.alpaca-view-web-list .alpaca-controlfield-label{display:inline-block;vertical-align:top;padding-top:.5em}.alpaca-view-web-list .alpaca-controlfield-label{width:130px}fieldset.alpaca-view-list legend{font-size:1.01em}.alpaca-controlfield.alpaca-view-web-list{display:inline-block}SPAN.alpaca-view-web-list label.alpaca-controlfield-label{font-size:1.0em;font-weight:bold!important;text-align:left;white-space:nowrap}.alpaca-view-web-list DIV.alpaca-controlfield-container{display:inline-block}.alpaca-controlfield-label-list-view{width:100px;display:inline-block;vertical-align:top;padding-top:.5em}.alpaca-fieldset-message-list-view{float:left;margin-right:.3em}.alpaca-controlfield-item-label-list-view{width:100px;display:inline-block;vertical-align:top;padding-top:.25em}ol.alpaca-fieldset-itemscontainer-list-view-top{padding-left:0}li.alpaca-fieldset-itemcontainer-list-view-top{list-style:none}.alpaca-fieldset-items-container-empty{padding-top:0;padding-bottom:0}.alpaca-layout-two-column-mask{overflow:auto;width:100%;min-width:600px;display:inline-block}.alpaca-layout-two-column-left{overflow:auto;display:inline-block;padding:5px;vertical-align:top}.alpaca-layout-two-column-right{overflow:auto;display:inline-block;padding:5px;vertical-align:top}fieldset.alpaca-fieldset-no-legend{border:0}fieldset.alpaca-view-web-edit-yaml.alpaca-fieldset{border:solid 1px;border-radius:5px;margin:1px 0 0 0;padding-top:4px;padding-bottom:2px}fieldset.alpaca-view-web-edit-yaml legend.alpaca-fieldset-legend span{display:none}fieldset.alpaca-view-web-edit-yaml legend.alpaca-fieldset-legend{font-size:1em}fieldset.alpaca-view-web-edit-yaml.fieldset-collapsed{border:0;margin:1px 1px 1px 1px}fieldset.alpaca-view-web-edit-yaml legend.alpaca-fieldset-legend.legend-expanded:after{content:url("./images/down.png");padding-left:5px}fieldset.alpaca-view-web-edit-yaml legend.alpaca-fieldset-legend.legend-collapsed:after{content:url("./images/left.png");padding-left:5px}fieldset.alpaca-view-web-edit-yaml span:not(.alpaca-field-focused) div.alpaca-controlfield-text input{background:0;border:0;box-shadow:none;margin-top:2px;margin-left:2px;margin-bottom:2px;margin-right:2px}fieldset.alpaca-view-web-edit-yaml{font-family:courier;padding-right:1em;padding-top:0}fieldset.alpaca-view-web-edit-yaml div.alpaca-controlfield-checkbox{margin-top:4px;margin-bottom:4px}fieldset.alpaca-view-web-edit-yaml div.alpaca-controlfield-select{margin-bottom:1px}fieldset.alpaca-view-web-edit-yaml div.alpaca-controlfield-radio div.alpaca-controlfield-radio{padding-top:3px;padding-bottom:4px}fieldset.alpaca-view-web-edit-yaml>input,fieldset.alpaca-view-web-edit-yaml>select,fieldset.alpaca-view-web-edit-yaml>label{font-family:courier}span.alpaca-view-web-edit-yaml .alpaca-controlfield-label{width:175px;padding-top:3px;padding-left:3px;display:inline-block;vertical-align:top}span.alpaca-view-web-edit-yaml div.alpaca-controlfield-container{padding-top:0;padding-bottom:0}span.alpaca-view-web-edit-yaml div.alpaca-controlfield-container>input,span.alpaca-view-web-edit-yaml div.alpaca-controlfield-container>select{padding:1px 1px 1px 1px}fieldset.alpaca-view-web-edit-yaml span.alpaca-field{padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0}fieldset.alpaca-view-web-edit-yaml ol.alpaca-fieldset-items-container{margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0}fieldset.alpaca-view-web-edit-yaml div.alpaca-fieldset-array-item-toolbar{position:absolute;z-index:99999;right:15px}fieldset.alpaca-view-web-edit-yaml .ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:2px}.alpaca-inline .alpaca-inline-item-container{float:left}.alpaca-inline-item-container .alpaca-inline .alpaca-fieldset,.alpaca-inline-item-container .alpaca-fieldset.alpaca-inline{margin:0 1.5em;padding:0}.alpaca-inline-item-container .alpaca-fieldset-array-item-toolbar{width:60px;float:right;margin-top:.7em}.alpaca-inline .alpaca-fieldset-items-container{margin:0 1em;padding:0}.alpaca-inline select{min-width:0}#module-settings input:focus,textarea:focus{border-width:1px}
0 23 \ No newline at end of file
... ...
var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-extras.min.css 0 → 100644
  1 +++ a/var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-extras.min.css
... ... @@ -0,0 +1,22 @@
  1 +/*!
  2 +Alpaca Version 1.1.1
  3 +
  4 +Copyright 2013 Gitana Software, Inc.
  5 +
  6 +Licensed under the Apache License, Version 2.0 (the "License");
  7 +you may not use this file except in compliance with the License.
  8 +
  9 +You may obtain a copy of the License at
  10 + http://www.apache.org/licenses/LICENSE-2.0
  11 +
  12 +Unless required by applicable law or agreed to in writing, software
  13 +distributed under the License is distributed on an "AS IS" BASIS,
  14 +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 +See the License for the specific language governing permissions and
  16 +limitations under the License.
  17 +
  18 +For more information, please contact Gitana Software, Inc. at this
  19 +address:
  20 +
  21 + info@gitanasoftware.com
  22 +*/
0 23 \ No newline at end of file
... ...
var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-jqueryui-newticketwizard.css 0 → 100644
  1 +++ a/var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-jqueryui-newticketwizard.css
... ... @@ -0,0 +1,43 @@
  1 +/*!
  2 +Alpaca Version 1.1.1
  3 +
  4 +Copyright 2013 Gitana Software, Inc.
  5 +
  6 +Licensed under the Apache License, Version 2.0 (the "License");
  7 +you may not use this file except in compliance with the License.
  8 +
  9 +You may obtain a copy of the License at
  10 + http://www.apache.org/licenses/LICENSE-2.0
  11 +
  12 +Unless required by applicable law or agreed to in writing, software
  13 +distributed under the License is distributed on an "AS IS" BASIS,
  14 +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 +See the License for the specific language governing permissions and
  16 +limitations under the License.
  17 +
  18 +For more information, please contact Gitana Software, Inc. at this
  19 +address:
  20 +
  21 + info@gitanasoftware.com
  22 +*/
  23 +/**
  24 + * Fix for jQuery datepicker initial state issue.
  25 + */
  26 +#ui-datepicker-div
  27 +{
  28 + display: none;
  29 + background-color:white;
  30 + z-index: 9999999 !important;
  31 + width: 22em !important;
  32 +}
  33 +
  34 +/* Fix for Chrome issue with Button text */
  35 +.ui-button .ui-button-text {
  36 + white-space: nowrap;
  37 +}
  38 +
  39 +.ui-datepicker
  40 +{
  41 + z-index: 100;
  42 +}
  43 +
... ...
var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-jqueryui.min.css 0 → 100644
  1 +++ a/var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-jqueryui.min.css
... ... @@ -0,0 +1,22 @@
  1 +/*!
  2 +Alpaca Version 1.1.1
  3 +
  4 +Copyright 2013 Gitana Software, Inc.
  5 +
  6 +Licensed under the Apache License, Version 2.0 (the "License");
  7 +you may not use this file except in compliance with the License.
  8 +
  9 +You may obtain a copy of the License at
  10 + http://www.apache.org/licenses/LICENSE-2.0
  11 +
  12 +Unless required by applicable law or agreed to in writing, software
  13 +distributed under the License is distributed on an "AS IS" BASIS,
  14 +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 +See the License for the specific language governing permissions and
  16 +limitations under the License.
  17 +
  18 +For more information, please contact Gitana Software, Inc. at this
  19 +address:
  20 +
  21 + info@gitanasoftware.com
  22 +*/#ui-datepicker-div{display:none;background-color:white;z-index:9999999!important;width:22em!important}.ui-button .ui-button-text{white-space:nowrap}.ui-datepicker{z-index:100}
0 23 \ No newline at end of file
... ...
var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-newticketwizard.css 0 → 100644
  1 +++ a/var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca-newticketwizard.css
... ... @@ -0,0 +1,945 @@
  1 +/*!
  2 +Alpaca Version 1.1.1
  3 +
  4 +Copyright 2013 Gitana Software, Inc.
  5 +
  6 +Licensed under the Apache License, Version 2.0 (the "License");
  7 +you may not use this file except in compliance with the License.
  8 +
  9 +You may obtain a copy of the License at
  10 + http://www.apache.org/licenses/LICENSE-2.0
  11 +
  12 +Unless required by applicable law or agreed to in writing, software
  13 +distributed under the License is distributed on an "AS IS" BASIS,
  14 +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 +See the License for the specific language governing permissions and
  16 +limitations under the License.
  17 +
  18 +For more information, please contact Gitana Software, Inc. at this
  19 +address:
  20 +
  21 + info@gitanasoftware.com
  22 +*/
  23 +.alpaca-hover {
  24 +}
  25 +
  26 +.alpaca-clear {
  27 + clear: both;
  28 +}
  29 +
  30 +/** Abstract Field **/
  31 +.alpaca-field {
  32 + padding-top: 0px;
  33 +}
  34 +
  35 +.alpaca-field-required {
  36 +}
  37 +
  38 +.alpaca-field-optional {
  39 +}
  40 +
  41 +.alpaca-field-valid {
  42 +}
  43 +
  44 +.alpaca-field-invalid {
  45 +}
  46 +
  47 +.alpaca-field-readonly {
  48 +}
  49 +
  50 +/**
  51 + * Control Field
  52 + */
  53 +.alpaca-controlfield {
  54 + display: block;
  55 + padding: 2px;
  56 + margin: 2px;
  57 + vertical-align: middle;
  58 +}
  59 +
  60 +.alpaca-controlfield * {
  61 + /*background: transparent;*/
  62 +}
  63 +
  64 +.alpaca-controlfield-container {
  65 + display: block;
  66 + padding-top: 4px;
  67 + padding-bottom: 4px;
  68 +}
  69 +
  70 +.alpaca-controlfield-label
  71 +{
  72 + font-size: 1.0em;
  73 + font-weight: bold;
  74 + text-align: right;
  75 + margin-left: 1px;
  76 + float: left;
  77 + width: 100px;
  78 + padding-top: 0px;
  79 + padding-bottom: 0px;
  80 + vertical-align: middle;
  81 +}
  82 +
  83 +.alpaca-controlfield-helper {
  84 + font-size: 0.75em;
  85 + margin-top: 2px;
  86 +}
  87 +
  88 +.alpaca-controlfield-message {
  89 + font-size: 0.85em;
  90 +}
  91 +
  92 +.alpaca-controlfield-message-hidden {
  93 + display: none;
  94 +}
  95 +
  96 +.alpaca-field-message-container {
  97 +}
  98 +
  99 +.alpaca-field-required span.ui-icon-star {
  100 + float: left;
  101 + margin-right: 0.3em;
  102 +}
  103 +
  104 +.alpaca-controlfield-helper > span.ui-icon, .alpaca-controlfield-message > span.ui-icon {
  105 + float: left;
  106 + margin-right: .3em;
  107 +}
  108 +
  109 +/**
  110 + * Form Controls
  111 + */
  112 +input, textarea, select {
  113 + border: 1px solid #555;
  114 + padding: 2px;
  115 + font-size: 1em;
  116 + border-radius: 2px;
  117 + -khtml-border-radius: 2px;
  118 + -moz-border-radius: 2px;
  119 + -webkit-border-radius: 2px;
  120 + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  121 + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  122 + box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  123 +}
  124 +
  125 +input[type="checkbox"], input[type="radio"] {
  126 + border: 0px;
  127 +}
  128 +
  129 +input[type="file"] {
  130 + border: none;
  131 + box-shadow: none;
  132 +}
  133 +
  134 +select {
  135 + min-width: 150px;
  136 +}
  137 +
  138 +input:focus, textarea:focus {
  139 + outline: none;
  140 + border: 1px solid #058cf5;
  141 +}
  142 +
  143 +.alpaca-field-readonly input, .alpaca-field-readonly textarea, input[readonly], textarea[readonly] {
  144 + background-color: #dcdcdc;
  145 + cursor: default;
  146 +}
  147 +
  148 +/* BEGIN styles for Text Field */
  149 +
  150 +.alpaca-controlfield-text {
  151 +}
  152 +
  153 +DIV.alpaca-controlfield-text .twitter-typeahead .tt-dropdown-menu
  154 +{
  155 + background-color: white;
  156 + border: 1px #777 solid;
  157 + padding-left: 10px;
  158 + margin-left: 2px;
  159 + padding-right: 10px;
  160 + color: #ccc;
  161 +}
  162 +
  163 +DIV.alpaca-controlfield-text .twitter-typeahead .tt-dropdown-menu P
  164 +{
  165 + font-size: 1em;
  166 +}
  167 +
  168 +.tt-suggestion.tt-is-under-cursor
  169 +{
  170 + background-color: #ccc;
  171 + color: #333;
  172 +}
  173 +
  174 +/* END styles for Text Field */
  175 +
  176 +/* BEGIN styles for Date Field, Phone Field, Password Field and Email Field */
  177 +
  178 +.alpaca-controlfield-date {
  179 +}
  180 +
  181 +.alpaca-controlfield-date input {
  182 +/* background: url("./images/alpaca-icons.png") no-repeat right -5px;*/
  183 +}
  184 +
  185 +.alpaca-controlfield-phone {
  186 +}
  187 +
  188 +.alpaca-controlfield-phone input {
  189 +/* background: url("./images/alpaca-icons.png") no-repeat right -85px;*/
  190 +}
  191 +
  192 +.alpaca-controlfield-email {
  193 +}
  194 +
  195 +.alpaca-controlfield-email input {
  196 +/* background: url("./images/alpaca-icons.png") no-repeat right -45px;*/
  197 +}
  198 +
  199 +.alpaca-controlfield-time {
  200 +}
  201 +
  202 +.alpaca-controlfield-time input {
  203 +/* background: url("./images/alpaca-icons.png") no-repeat right -125px;*/
  204 +}
  205 +
  206 +.alpaca-controlfield-password {
  207 +}
  208 +
  209 +.alpaca-controlfield-email > span.ui-icon, .alpaca-controlfield-date > span.ui-icon, .alpaca-controlfield-phone > span.ui-icon {
  210 + float: right;
  211 + margin-left: .3em;
  212 +}
  213 +
  214 +.alpaca-controlfield-helper .alpaca-controlfield-helper-text, .alpaca-controlfield-message .alpaca-controlfield-message-text, .alpaca-controlfield-email > input, .alpaca-controlfield-date > input, .alpaca-controlfield-phone > input {
  215 + line-height: 16px;
  216 +}
  217 +
  218 +/* END styles for Date Field, Phone Field, Password Field and Email Field */
  219 +
  220 +/* BEGIN styles for Address Map Field */
  221 +
  222 +.alpaca-controlfield-address-mapcanvas {
  223 + height: 300px;
  224 + width: 300px;
  225 + margin: 10px;
  226 +}
  227 +
  228 +/* END styles for Address Map Field */
  229 +
  230 +/* BEGIN styles for Checkbox Field */
  231 +
  232 +.alpaca-controlfield-checkbox {
  233 + padding-top: 0.4em;
  234 +}
  235 +
  236 +.alpaca-controlfield-checkbox input {
  237 + margin-right: 1em;
  238 +}
  239 +
  240 +/* IE < 8 */
  241 +.alpaca-controlfield-checkbox {
  242 + *padding-top: 0;
  243 +}
  244 +
  245 +/* END styles for Checkbox Field */
  246 +
  247 +/* BEGIN styles for Radio Field */
  248 +
  249 +.alpaca-controlfield-radio {
  250 + padding-top: 0.5em;
  251 +}
  252 +
  253 +.alpaca-controlfield-radio input {
  254 + margin-right: 0.3em;
  255 +}
  256 +
  257 +.alpaca-controlfield-radio-label {
  258 + margin-right: 0.3em;
  259 +}
  260 +
  261 +/* END styles for Radio Field */
  262 +
  263 +/* BEGIN styles for Select Field */
  264 +
  265 +.alpaca-controlfield-select {
  266 +}
  267 +
  268 +/* END styles for Select Field */
  269 +
  270 +/* BEGIN styles for Number Field */
  271 +
  272 +.alpaca-controlfield-number {
  273 +}
  274 +
  275 +/* END styles for Number Field */
  276 +
  277 +/* BEGIN styles for Integer Field */
  278 +
  279 +.alpaca-controlfield-integer {
  280 +}
  281 +
  282 +/* END styles for Integer Field */
  283 +
  284 +/* BEGIN styles for Textarea Field */
  285 +
  286 +.alpaca-controlfield-textarea {
  287 +}
  288 +
  289 +/* END styles for Textarea Field */
  290 +
  291 +/* BEGIN styles for WYSIWYG Field */
  292 +
  293 +.alpaca-controlfield-wysiwyg {
  294 +}
  295 +
  296 +/* END styles for WYSIWYG Field */
  297 +
  298 +/* BEGIN styles for Button Field */
  299 +
  300 +.alpaca-controlfield-button {
  301 +}
  302 +
  303 +/* END styles for Button Field */
  304 +
  305 +/* BEGIN styles for File Field */
  306 +
  307 +.alpaca-controlfield-file {
  308 +}
  309 +
  310 +.alpaca-controlfield-file-custom-input {
  311 + position: absolute;
  312 + height: 100px;
  313 + cursor: pointer;
  314 + background: transparent;
  315 + border: 0;
  316 + opacity: 0;
  317 + -moz-opacity: 0;
  318 + filter: progid:DXImageTransform.Microsoft.Alpha(opacity = 0);
  319 + z-index: 999;
  320 +}
  321 +
  322 +.alpaca-controlfield-file-custom {
  323 + width: 350px;
  324 + cursor: pointer;
  325 + overflow: hidden;
  326 + padding: 2px;
  327 + position: relative;
  328 +}
  329 +
  330 +.alpaca-controlfield-file-custom-disabled {
  331 + opacity: .5;
  332 + filter: progid:DXImageTransform.Microsoft.Alpha(opacity = 0);
  333 + cursor: default;
  334 +}
  335 +
  336 +.alpaca-controlfield-file-custom-feedback {
  337 + display: block;
  338 + margin: 1px 1px 1px 5px;
  339 + font-style: italic;
  340 + padding: .3em .6em;
  341 +}
  342 +
  343 +.alpaca-controlfield-file-custom-feedback-populated {
  344 + font-style: normal;
  345 + font-weight: bold;
  346 + padding-left: 20px;
  347 +}
  348 +
  349 +/* END styles for File Field */
  350 +
  351 +/* BEGIN styles for Editor Field */
  352 +
  353 +.alpaca-controlfield-editor
  354 +{
  355 + position: relative;
  356 + width: 100%;
  357 + height: 300px;
  358 + border: 1px #ccc solid;
  359 +}
  360 +
  361 +.alpaca-controlfield-editor .control-field-editor-el
  362 +{
  363 + position:absolute;
  364 + top:0;
  365 + bottom:0;
  366 + left: 0;
  367 + right:0
  368 +}
  369 +
  370 +/* END styles for Editor Field */
  371 +
  372 +/* BEGIN styles for JSON Field */
  373 +
  374 +.alpaca-controlfield .alpaca-controlfield-json textarea {
  375 + font-family: "Courier New";
  376 + font-size: 0.9em;
  377 + font-style: italic;
  378 +}
  379 +
  380 +/* END styles for JSON Field */
  381 +
  382 +/* BEGIN styles for Hidden Field */
  383 +.alpaca-controlfield-hidden {
  384 + display: none;
  385 +}
  386 +/* END styles for Hidden Field */
  387 +
  388 +/* BEGIN styles for Container Field (Fieldset) */
  389 +
  390 +.alpaca-fieldset {
  391 + padding: 4px;
  392 + margin: 4px;
  393 + overflow: auto;
  394 + position: relative;
  395 +}
  396 +
  397 +fieldset.alpaca-fieldset {
  398 + /*margin: 0.5em 1em 1em 0px;*/
  399 + margin-top: 0.5em;
  400 + margin-right: 0px;
  401 + margin-left: 0px;
  402 + margin-bottom: 0.5em;
  403 +}
  404 +
  405 +legend.alpaca-fieldset-legend {
  406 + font-size: 1.1em;
  407 + text-align: left;
  408 + bottom: -1px;
  409 +}
  410 +
  411 +.alpaca-fieldset-legend {
  412 + font-size: 1.0em;
  413 + font-weight: bold;
  414 + text-align: left;
  415 +}
  416 +
  417 +.alpaca-fieldset-helper {
  418 + padding-top: 10px;
  419 + padding-bottom: 5px;
  420 + clear: both;
  421 +}
  422 +
  423 +.alpaca-fieldset-items-container {
  424 + padding-top: 5px;
  425 + /**padding-bottom: 5px;**/
  426 + clear: both;
  427 +}
  428 +
  429 +.alpaca-fieldset-legend-link {
  430 + float: left;
  431 + margin-right: 0.3em;
  432 +}
  433 +
  434 +/* END styles for Container Field (Fieldset) */
  435 +
  436 +/* BEGIN styles for Array Field */
  437 +
  438 +.alpaca-fieldset-array-item-toolbar {
  439 + padding: 1px;
  440 + margin: 0px 2px 0px 2px;
  441 + font-size: 0.75em;
  442 +}
  443 +
  444 +.alpaca-fieldset-array-toolbar {
  445 + padding: 10px 4px;
  446 +}
  447 +
  448 +.alpaca-fieldset-array-item-toolbar-disabled {
  449 + opacity: .5;
  450 +}
  451 +
  452 +.alpaca-fieldset-array-item-toolbar-add {
  453 +}
  454 +
  455 +.alpaca-fieldset-array-item-toolbar-remove {
  456 +}
  457 +
  458 +.alpaca-fieldset-array-item-toolbar-up {
  459 +}
  460 +
  461 +.alpaca-fieldset-array-item-toolbar-down {
  462 +}
  463 +
  464 +/* END styles for Array Field */
  465 +
  466 +/* BEGIN styles for Form */
  467 +
  468 +.alpaca-form {
  469 + margin-top: 15px;
  470 + margin-left: 15px;
  471 +}
  472 +
  473 +.alpaca-form-buttons-container {
  474 + clear: both;
  475 + display: block;
  476 + margin: 5px 0 5px 0;
  477 + text-align: center;
  478 +}
  479 +
  480 +.alpaca-form-button {
  481 +}
  482 +
  483 +.alpaca-form-button-print {
  484 +}
  485 +
  486 +.alpaca-form-button-reload {
  487 +}
  488 +
  489 +.alpaca-form-button-save {
  490 +}
  491 +
  492 +.alpaca-form-button-view-switcher {
  493 + position: absolute;
  494 + float: left;
  495 + font-size: 1em;
  496 + padding: 8px 3px 3px;
  497 + zIndex: 999999;
  498 +}
  499 +
  500 +.alpaca-form-button-view-switcher ul {
  501 + listStyle: none;
  502 + margin: 0;
  503 + padding: 0;
  504 + overflow: auto;
  505 +}
  506 +
  507 +.alpaca-form-button-view-switcher ul li {
  508 + padding: 2px;
  509 + margin: 1px;
  510 + clear: left;
  511 + float: left;
  512 +}
  513 +
  514 +.alpaca-form-button-view-switcher ul li a {
  515 + text-decoration: none;
  516 +}
  517 +
  518 +.alpaca-form-buttons-container input {
  519 + margin-right: 4px;
  520 +}
  521 +
  522 +.alpaca-form-buttons-container input.alpaca-form-button:hover {
  523 + background: #FFFFCC;
  524 +}
  525 +
  526 +/* END styles for Form */
  527 +
  528 +/* BEGIN styles for VIEW: DISPLAY */
  529 +
  530 +div.alpaca-fieldset {
  531 + display: block;
  532 + border: none;
  533 + margin: 1.5em 1em 1em 0px;
  534 +}
  535 +
  536 +div.alpaca-fieldset-legend {
  537 +}
  538 +
  539 +.alpaca-data-container {
  540 + margin: 5px 5px 5px 5px;
  541 + padding: 5px 5px 5px 5px;
  542 + display: block;
  543 +}
  544 +
  545 +.alpaca-data {
  546 + text-align: left;
  547 + padding-left: 10px;
  548 +}
  549 +
  550 +.alpaca-data-label {
  551 + float: left;
  552 + min-width: 100px;
  553 + clear: both;
  554 + font-weight: bold;
  555 + display: block;
  556 +}
  557 +
  558 +/* END styles for VIEW: DISPLAY */
  559 +
  560 +/* BEGIN styles for Wizard */
  561 +
  562 +.alpaca-wizard-status-bar {
  563 + list-style: none;
  564 + overflow: hidden;
  565 + margin: 10px 0px 10px 0px;
  566 + padding: 0px;
  567 + counter-reset: step;
  568 + float: left;
  569 +}
  570 +
  571 +.alpaca-wizard-status-bar li {
  572 + float: left;
  573 +}
  574 +
  575 +.alpaca-wizard-status-bar li span {
  576 + display: block;
  577 + font-size: 1.2em;
  578 +}
  579 +
  580 +.alpaca-wizard-status-bar li div {
  581 + display: block;
  582 + position: relative;
  583 + padding: 2px 25px 2px 30px;
  584 +}
  585 +
  586 +.alpaca-wizard-status-bar li div:before {
  587 + font-size: 1em;
  588 + position: absolute;
  589 + top: 50%;
  590 + left: 5px;
  591 + margin-top: -8px;
  592 + text-align: center;
  593 + font-weight: bold;
  594 + padding: 2px 6px;
  595 + counter-increment: step;
  596 + content: counter(step);
  597 +}
  598 +
  599 +.alpaca-wizard-status-bar li div strong {
  600 + font-weight: normal
  601 +}
  602 +
  603 +.alpaca-wizard-status-bar li.current {
  604 +}
  605 +
  606 +.alpaca-wizard-status-bar li.current-has-next {
  607 +}
  608 +
  609 +.alpaca-wizard-title {
  610 + font-size: 1.2em;
  611 + margin: 0px;
  612 + padding: 10px 0px;
  613 + font-weight: bold;
  614 +}
  615 +
  616 +.alpaca-wizard-desc {
  617 + font-size: 0.9em;
  618 + margin: 0px;
  619 + padding: 5px 0px;
  620 +}
  621 +
  622 +.alpaca-wizard-step-title {
  623 + font-size: 1em;
  624 + margin: 0px;
  625 + padding: 10px 0px;
  626 + text-decoration: underline;
  627 + font-weight: bold;
  628 +}
  629 +
  630 +.alpaca-wizard-nav-bar {
  631 + clear: both;
  632 + float: right;
  633 +}
  634 +
  635 +.alpaca-wizard-button {
  636 +}
  637 +
  638 +.alpaca-wizard-button:hover {
  639 +}
  640 +
  641 +.alpaca-wizard-button-back {
  642 +}
  643 +
  644 +.alpaca-wizard-button-next {
  645 +}
  646 +
  647 +/* END styles for Wizard */
  648 +
  649 +/** BEGIN view-web-list **/
  650 +
  651 +fieldset.alpaca-view-web-list
  652 +{
  653 + border-left: none;
  654 + border-bottom: none;
  655 + border-right: none;
  656 + padding-right: 3em;
  657 +}
  658 +
  659 +fieldset.alpaca-view-web-list.fieldset-collapsed
  660 +{
  661 + border: solid 1px;
  662 +}
  663 +
  664 +.alpaca-view-web-list .alpaca-controlfield-label {
  665 + display: inline-block;
  666 + vertical-align: top;
  667 + padding-top: 0.5em;
  668 +}
  669 +
  670 +.alpaca-view-web-list .alpaca-controlfield-label {
  671 + width: 130px;
  672 +}
  673 +
  674 +fieldset.alpaca-view-list legend {
  675 + /* to make chrome not wrapping text */
  676 + font-size: 1.01em
  677 +}
  678 +
  679 +.alpaca-controlfield.alpaca-view-web-list
  680 +{
  681 + display:inline-block;
  682 +}
  683 +
  684 +SPAN.alpaca-view-web-list label.alpaca-controlfield-label
  685 +{
  686 + font-size: 1.0em;
  687 + font-weight: bold !important;
  688 + text-align: left;
  689 + white-space: nowrap;
  690 +}
  691 +
  692 +.alpaca-view-web-list DIV.alpaca-controlfield-container
  693 +{
  694 + display:inline-block;
  695 +}
  696 +
  697 +.alpaca-controlfield-label-list-view {
  698 + width: 100px;
  699 + display: inline-block;
  700 + vertical-align: top;
  701 + padding-top: 0.5em;
  702 +}
  703 +
  704 +.alpaca-fieldset-message-list-view {
  705 + float: left;
  706 + margin-right: .3em;
  707 +}
  708 +
  709 +.alpaca-controlfield-item-label-list-view {
  710 + width: 100px;
  711 + display: inline-block;
  712 + vertical-align: top;
  713 + padding-top: 0.25em;
  714 +}
  715 +
  716 +ol.alpaca-fieldset-itemscontainer-list-view-top {
  717 + padding-left :0;
  718 +}
  719 +
  720 +li.alpaca-fieldset-itemcontainer-list-view-top {
  721 + list-style:none;
  722 +}
  723 +
  724 +.alpaca-item-container-first
  725 +{
  726 +
  727 +}
  728 +
  729 +.alpaca-item-container-last
  730 +{
  731 +
  732 +}
  733 +
  734 +.alpaca-fieldset-items-container-empty
  735 +{
  736 + padding-top: 0px;
  737 + padding-bottom: 0px;
  738 +}
  739 +
  740 +/** END view-web-list **/
  741 +
  742 +/* BEGIN styles for VIEW: TWO COLUMN */
  743 +
  744 +.alpaca-layout-two-column-mask {
  745 + overflow: auto;
  746 + width: 100%;
  747 + min-width: 600px;
  748 + display: inline-block;
  749 +}
  750 +
  751 +.alpaca-layout-two-column-left {
  752 + overflow: auto;
  753 + display: inline-block;
  754 + padding: 5px;
  755 + vertical-align: top;
  756 +}
  757 +
  758 +.alpaca-layout-two-column-right {
  759 + overflow: auto;
  760 + display: inline-block;
  761 + padding: 5px;
  762 + vertical-align: top;
  763 +}
  764 +
  765 +
  766 +fieldset.alpaca-fieldset-no-legend {
  767 + border: none;
  768 +}
  769 +
  770 +/* END styles for VIEW: TWO COLUMN */
  771 +
  772 +/* BEGIN styles for VIEW: VIEW_WEB_EDIT_YAML */
  773 +
  774 +fieldset.alpaca-view-web-edit-yaml.alpaca-fieldset {
  775 + border: solid 1px;
  776 + border-radius: 5px;
  777 + margin: 1px 0 0 0;
  778 + padding-top: 4px;
  779 + padding-bottom: 2px;
  780 +}
  781 +
  782 +/*hide the arrow icon before the fieldset name*/
  783 +fieldset.alpaca-view-web-edit-yaml legend.alpaca-fieldset-legend span {
  784 + display: none;
  785 +}
  786 +
  787 +/* make the fonts the right size */
  788 +fieldset.alpaca-view-web-edit-yaml legend.alpaca-fieldset-legend {
  789 + font-size: 1em;
  790 +}
  791 +
  792 +fieldset.alpaca-view-web-edit-yaml.fieldset-collapsed {
  793 + border: none;
  794 + margin: 1px 1px 1px 1px;
  795 +}
  796 +
  797 +fieldset.alpaca-view-web-edit-yaml legend.alpaca-fieldset-legend.legend-expanded:after {
  798 + content: url("./images/down.png");
  799 + padding-left: 5px;
  800 +}
  801 +fieldset.alpaca-view-web-edit-yaml legend.alpaca-fieldset-legend.legend-collapsed:after {
  802 + content: url("./images/left.png");
  803 + padding-left: 5px;
  804 +}
  805 +
  806 +/*sort out the text boxes so that they disappear when not focused */
  807 +fieldset.alpaca-view-web-edit-yaml span:not(.alpaca-field-focused) div.alpaca-controlfield-text input {
  808 + background: none;
  809 + border: none;
  810 + box-shadow: none;
  811 + margin-top: 2px;
  812 + margin-left: 2px;
  813 + margin-bottom: 2px;
  814 + margin-right: 2px;
  815 +}
  816 +
  817 +fieldset.alpaca-view-web-edit-yaml {
  818 + font-family: courier;
  819 + padding-right: 1em;
  820 + padding-top: 0px;
  821 +}
  822 +
  823 +fieldset.alpaca-view-web-edit-yaml div.alpaca-controlfield-checkbox {
  824 + margin-top: 4px;
  825 + margin-bottom: 4px;
  826 +}
  827 +
  828 +fieldset.alpaca-view-web-edit-yaml div.alpaca-controlfield-select {
  829 + margin-bottom: 1px;
  830 +}
  831 +fieldset.alpaca-view-web-edit-yaml div.alpaca-controlfield-radio div.alpaca-controlfield-radio {
  832 + padding-top: 3px;
  833 + padding-bottom: 4px;
  834 +}
  835 +
  836 +fieldset.alpaca-view-web-edit-yaml > input,
  837 +fieldset.alpaca-view-web-edit-yaml > select,
  838 +fieldset.alpaca-view-web-edit-yaml > label
  839 +{
  840 + font-family: courier;
  841 +}
  842 +
  843 +span.alpaca-view-web-edit-yaml .alpaca-controlfield-label {
  844 + width: 175px;
  845 + padding-top: 0px;
  846 + padding-left: 3px;
  847 + display: inline-block;
  848 + vertical-align: top;
  849 +}
  850 +
  851 +span.alpaca-view-web-edit-yaml div.alpaca-controlfield-container {
  852 + padding-top: 0px;
  853 + padding-bottom: 0px;
  854 +}
  855 +
  856 +span.alpaca-view-web-edit-yaml div.alpaca-controlfield-container > input,
  857 +span.alpaca-view-web-edit-yaml div.alpaca-controlfield-container > select
  858 +{
  859 + padding: 1px 1px 1px 1px;
  860 +}
  861 +
  862 +fieldset.alpaca-view-web-edit-yaml span.alpaca-field {
  863 + padding-top: 0px;
  864 + padding-bottom: 0px;
  865 + margin-top: 0px;
  866 + margin-bottom: 0px;
  867 +}
  868 +
  869 +fieldset.alpaca-view-web-edit-yaml ol.alpaca-fieldset-items-container {
  870 + margin-top: 0px;
  871 + margin-bottom: 0px;
  872 + padding-top: 0px;
  873 + padding-bottom: 0px;
  874 +}
  875 +
  876 +
  877 +/* make the array item toolbar float, without displacing any other elements */
  878 +fieldset.alpaca-view-web-edit-yaml div.alpaca-fieldset-array-item-toolbar {
  879 + position: absolute;
  880 + z-index: 99999;
  881 + right: 15px;
  882 +}
  883 +
  884 +
  885 +fieldset.alpaca-view-web-edit-yaml .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text {
  886 + padding: 2px;
  887 +}
  888 +
  889 +/* END styles for the view VIEW_WEB_EDIT_YAML */
  890 +
  891 +/* BEGIN styles for the view VIEW_WEB_EDIT_INLINE */
  892 +
  893 +.alpaca-inline .alpaca-inline-item-container {
  894 + float: left;
  895 +}
  896 +
  897 +.alpaca-inline-item-container .alpaca-inline .alpaca-fieldset, .alpaca-inline-item-container .alpaca-fieldset.alpaca-inline {
  898 + margin: 0 1.5em;
  899 + padding: 0;
  900 +}
  901 +
  902 +.alpaca-inline-item-container .alpaca-fieldset-array-item-toolbar {
  903 + width: 60px;
  904 + float: right;
  905 + margin-top: 0.7em;
  906 +}
  907 +
  908 +.alpaca-inline .alpaca-fieldset-items-container {
  909 + margin: 0em 1em;
  910 + padding: 0;
  911 +}
  912 +
  913 +.alpaca-inline select {
  914 + min-width: 0px;
  915 +}
  916 +
  917 +#module-settings input:focus, textarea:focus {
  918 + border-width: 1px;
  919 +}
  920 +
  921 +
  922 +fieldset DIV {
  923 + padding-top: 0px !important;
  924 + vertical-align: middle !important;
  925 +}
  926 +
  927 +
  928 +/* To Remove up/down buttons on items
  929 +
  930 +.alpaca-inline-item-container .alpaca-fieldset-array-item-toolbar .alpaca-fieldset-array-item-toolbar-up,
  931 +.alpaca-inline-item-container .alpaca-fieldset-array-item-toolbar .alpaca-fieldset-array-item-toolbar-down {
  932 +{
  933 + display: none;
  934 +}
  935 +*/
  936 +
  937 +/* To hide labels of inlined fields
  938 +
  939 +.alpaca-inline-item-container .alpaca-inline .alpaca-controlfield-label, .alpaca-inline-item-container .alpaca-inline .alpaca-fieldset-legend {
  940 + display: none;
  941 +}
  942 +
  943 +*/
  944 +
  945 +/* END styles for VIEW: VIEW_WEB_EDIT_INLINE */
... ...
var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca.min.css 0 → 100644
  1 +++ a/var/httpd/htdocs/skins/Customer/default/css/alpaca/alpaca.min.css
... ... @@ -0,0 +1,22 @@
  1 +/*!
  2 +Alpaca Version 1.1.1
  3 +
  4 +Copyright 2013 Gitana Software, Inc.
  5 +
  6 +Licensed under the Apache License, Version 2.0 (the "License");
  7 +you may not use this file except in compliance with the License.
  8 +
  9 +You may obtain a copy of the License at
  10 + http://www.apache.org/licenses/LICENSE-2.0
  11 +
  12 +Unless required by applicable law or agreed to in writing, software
  13 +distributed under the License is distributed on an "AS IS" BASIS,
  14 +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 +See the License for the specific language governing permissions and
  16 +limitations under the License.
  17 +
  18 +For more information, please contact Gitana Software, Inc. at this
  19 +address:
  20 +
  21 + info@gitanasoftware.com
  22 +*/.alpaca-clear{clear:both}.alpaca-controlfield{display:block;padding:2px;margin:2px}.alpaca-controlfield-container{display:block;padding-top:4px;padding-bottom:4px}.alpaca-controlfield-label{font-size:1.0em;font-weight:bold;text-align:left;margin-left:1px}.alpaca-controlfield-helper{font-size:.75em;margin-top:2px}.alpaca-controlfield-message{font-size:.85em}.alpaca-controlfield-message-hidden{display:none}.alpaca-field-required span.ui-icon-star{float:left;margin-right:.3em}.alpaca-controlfield-helper>span.ui-icon,.alpaca-controlfield-message>span.ui-icon{float:left;margin-right:.3em}input,textarea,select{border:1px solid #555;padding:2px;font-size:1em;border-radius:2px;-khtml-border-radius:2px;-moz-border-radius:2px;-webkit-border-radius:2px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.2);-moz-box-shadow:0 1px 2px rgba(0,0,0,.2);box-shadow:0 1px 2px rgba(0,0,0,.2)}input[type="checkbox"],input[type="radio"]{border:0}input[type="file"]{border:0;box-shadow:none}select{min-width:150px}input:focus,textarea:focus{outline:0;border:1px solid #058cf5}.alpaca-field-readonly input,.alpaca-field-readonly textarea,input[readonly],textarea[readonly]{background-color:#dcdcdc;cursor:default}DIV.alpaca-controlfield-text .twitter-typeahead .tt-dropdown-menu{background-color:white;border:1px #777 solid;padding-left:10px;margin-left:2px;padding-right:10px;color:#ccc}DIV.alpaca-controlfield-text .twitter-typeahead .tt-dropdown-menu P{font-size:1em}.tt-suggestion.tt-is-under-cursor{background-color:#ccc;color:#333}.alpaca-controlfield-email>span.ui-icon,.alpaca-controlfield-date>span.ui-icon,.alpaca-controlfield-phone>span.ui-icon{float:right;margin-left:.3em}.alpaca-controlfield-helper .alpaca-controlfield-helper-text,.alpaca-controlfield-message .alpaca-controlfield-message-text,.alpaca-controlfield-email>input,.alpaca-controlfield-date>input,.alpaca-controlfield-phone>input{line-height:16px}.alpaca-controlfield-address-mapcanvas{height:300px;width:300px;margin:10px}.alpaca-controlfield-checkbox{padding-top:.4em}.alpaca-controlfield-checkbox input{margin-right:1em}.alpaca-controlfield-checkbox{*padding-top:0}.alpaca-controlfield-radio{padding-top:.5em}.alpaca-controlfield-radio input{margin-right:.3em}.alpaca-controlfield-radio-label{margin-right:.3em}.alpaca-controlfield-file-custom-input{position:absolute;height:100px;cursor:pointer;background:transparent;border:0;opacity:0;-moz-opacity:0;filter:progid:DXImageTransform.Microsoft.Alpha(opacity = 0);z-index:999}.alpaca-controlfield-file-custom{width:350px;cursor:pointer;overflow:hidden;padding:2px;position:relative}.alpaca-controlfield-file-custom-disabled{opacity:.5;filter:progid:DXImageTransform.Microsoft.Alpha(opacity = 0);cursor:default}.alpaca-controlfield-file-custom-feedback{display:block;margin:1px 1px 1px 5px;font-style:italic;padding:.3em .6em}.alpaca-controlfield-file-custom-feedback-populated{font-style:normal;font-weight:bold;padding-left:20px}.alpaca-controlfield-editor{position:relative;width:100%;height:300px;border:1px #ccc solid}.alpaca-controlfield-editor .control-field-editor-el{position:absolute;top:0;bottom:0;left:0;right:0}.alpaca-controlfield .alpaca-controlfield-json textarea{font-family:"Courier New";font-size:.9em;font-style:italic}.alpaca-controlfield-hidden{display:none}.alpaca-fieldset{padding:4px;margin:4px;overflow:auto;position:relative}fieldset.alpaca-fieldset{margin-top:.5em;margin-right:0;margin-left:0;margin-bottom:.5em}legend.alpaca-fieldset-legend{font-size:1.1em;text-align:left;bottom:-1px}.alpaca-fieldset-legend{font-size:1.0em;font-weight:bold;text-align:left}.alpaca-fieldset-helper{padding-top:10px;padding-bottom:5px;clear:both}.alpaca-fieldset-items-container{padding-top:5px;clear:both}.alpaca-fieldset-legend-link{float:left;margin-right:.3em}.alpaca-fieldset-array-item-toolbar{padding:1px;margin:0 2px 0 2px;font-size:.75em}.alpaca-fieldset-array-toolbar{padding:10px 4px}.alpaca-fieldset-array-item-toolbar-disabled{opacity:.5}.alpaca-form{margin-top:15px;margin-left:15px}.alpaca-form-buttons-container{clear:both;display:block;margin:5px 0 5px 0}.alpaca-form-button-view-switcher{position:absolute;float:left;font-size:1em;padding:8px 3px 3px;zIndex:999999}.alpaca-form-button-view-switcher ul{listStyle:none;margin:0;padding:0;overflow:auto}.alpaca-form-button-view-switcher ul li{padding:2px;margin:1px;clear:left;float:left}.alpaca-form-button-view-switcher ul li a{text-decoration:none}.alpaca-form-buttons-container input{margin-right:4px}.alpaca-form-buttons-container input.alpaca-form-button:hover{background:#ffc}div.alpaca-fieldset{display:block;border:0;margin:1.5em 1em 1em 0}.alpaca-data-container{margin:5px 5px 5px 5px;padding:5px 5px 5px 5px;display:block}.alpaca-data{text-align:left;padding-left:10px}.alpaca-data-label{float:left;min-width:100px;clear:both;font-weight:bold;display:block}.alpaca-wizard-status-bar{list-style:none;overflow:hidden;margin:10px 0 10px 0;padding:0;counter-reset:step;float:left}.alpaca-wizard-status-bar li{float:left}.alpaca-wizard-status-bar li span{display:block;font-size:1.2em}.alpaca-wizard-status-bar li div{display:block;position:relative;padding:2px 25px 2px 30px}.alpaca-wizard-status-bar li div:before{font-size:1em;position:absolute;top:50%;left:5px;margin-top:-8px;text-align:center;font-weight:bold;padding:2px 6px;counter-increment:step;content:counter(step)}.alpaca-wizard-status-bar li div strong{font-weight:normal}.alpaca-wizard-title{font-size:1.2em;margin:0;padding:10px 0;font-weight:bold}.alpaca-wizard-desc{font-size:.9em;margin:0;padding:5px 0}.alpaca-wizard-step-title{font-size:1em;margin:0;padding:10px 0;text-decoration:underline;font-weight:bold}.alpaca-wizard-nav-bar{clear:both;float:right}fieldset.alpaca-view-web-list{border-left:none;border-bottom:0;border-right:0;padding-right:3em}fieldset.alpaca-view-web-list.fieldset-collapsed{border:solid 1px}.alpaca-view-web-list .alpaca-controlfield-label{display:inline-block;vertical-align:top;padding-top:.5em}.alpaca-view-web-list .alpaca-controlfield-label{width:130px}fieldset.alpaca-view-list legend{font-size:1.01em}.alpaca-controlfield.alpaca-view-web-list{display:inline-block}SPAN.alpaca-view-web-list label.alpaca-controlfield-label{font-size:1.0em;font-weight:bold!important;text-align:left;white-space:nowrap}.alpaca-view-web-list DIV.alpaca-controlfield-container{display:inline-block}.alpaca-controlfield-label-list-view{width:100px;display:inline-block;vertical-align:top;padding-top:.5em}.alpaca-fieldset-message-list-view{float:left;margin-right:.3em}.alpaca-controlfield-item-label-list-view{width:100px;display:inline-block;vertical-align:top;padding-top:.25em}ol.alpaca-fieldset-itemscontainer-list-view-top{padding-left:0}li.alpaca-fieldset-itemcontainer-list-view-top{list-style:none}.alpaca-fieldset-items-container-empty{padding-top:0;padding-bottom:0}.alpaca-layout-two-column-mask{overflow:auto;width:100%;min-width:600px;display:inline-block}.alpaca-layout-two-column-left{overflow:auto;display:inline-block;padding:5px;vertical-align:top}.alpaca-layout-two-column-right{overflow:auto;display:inline-block;padding:5px;vertical-align:top}fieldset.alpaca-fieldset-no-legend{border:0}fieldset.alpaca-view-web-edit-yaml.alpaca-fieldset{border:solid 1px;border-radius:5px;margin:1px 0 0 0;padding-top:4px;padding-bottom:2px}fieldset.alpaca-view-web-edit-yaml legend.alpaca-fieldset-legend span{display:none}fieldset.alpaca-view-web-edit-yaml legend.alpaca-fieldset-legend{font-size:1em}fieldset.alpaca-view-web-edit-yaml.fieldset-collapsed{border:0;margin:1px 1px 1px 1px}fieldset.alpaca-view-web-edit-yaml legend.alpaca-fieldset-legend.legend-expanded:after{content:url("./images/down.png");padding-left:5px}fieldset.alpaca-view-web-edit-yaml legend.alpaca-fieldset-legend.legend-collapsed:after{content:url("./images/left.png");padding-left:5px}fieldset.alpaca-view-web-edit-yaml span:not(.alpaca-field-focused) div.alpaca-controlfield-text input{background:0;border:0;box-shadow:none;margin-top:2px;margin-left:2px;margin-bottom:2px;margin-right:2px}fieldset.alpaca-view-web-edit-yaml{font-family:courier;padding-right:1em;padding-top:0}fieldset.alpaca-view-web-edit-yaml div.alpaca-controlfield-checkbox{margin-top:4px;margin-bottom:4px}fieldset.alpaca-view-web-edit-yaml div.alpaca-controlfield-select{margin-bottom:1px}fieldset.alpaca-view-web-edit-yaml div.alpaca-controlfield-radio div.alpaca-controlfield-radio{padding-top:3px;padding-bottom:4px}fieldset.alpaca-view-web-edit-yaml>input,fieldset.alpaca-view-web-edit-yaml>select,fieldset.alpaca-view-web-edit-yaml>label{font-family:courier}span.alpaca-view-web-edit-yaml .alpaca-controlfield-label{width:175px;padding-top:3px;padding-left:3px;display:inline-block;vertical-align:top}span.alpaca-view-web-edit-yaml div.alpaca-controlfield-container{padding-top:0;padding-bottom:0}span.alpaca-view-web-edit-yaml div.alpaca-controlfield-container>input,span.alpaca-view-web-edit-yaml div.alpaca-controlfield-container>select{padding:1px 1px 1px 1px}fieldset.alpaca-view-web-edit-yaml span.alpaca-field{padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0}fieldset.alpaca-view-web-edit-yaml ol.alpaca-fieldset-items-container{margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0}fieldset.alpaca-view-web-edit-yaml div.alpaca-fieldset-array-item-toolbar{position:absolute;z-index:99999;right:15px}fieldset.alpaca-view-web-edit-yaml .ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:2px}.alpaca-inline .alpaca-inline-item-container{float:left}.alpaca-inline-item-container .alpaca-inline .alpaca-fieldset,.alpaca-inline-item-container .alpaca-fieldset.alpaca-inline{margin:0 1.5em;padding:0}.alpaca-inline-item-container .alpaca-fieldset-array-item-toolbar{width:60px;float:right;margin-top:.7em}.alpaca-inline .alpaca-fieldset-items-container{margin:0 1em;padding:0}.alpaca-inline select{min-width:0}#module-settings input:focus,textarea:focus{border-width:1px}
0 23 \ No newline at end of file
... ...
var/httpd/htdocs/skins/Customer/default/css/alpaca/images/alpaca-icons.png 0 → 100644

2.36 KB

var/httpd/htdocs/skins/Customer/default/css/alpaca/images/date.png 0 → 100644

3.42 KB

var/httpd/htdocs/skins/Customer/default/css/alpaca/images/down.png 0 → 100644

2.85 KB

var/httpd/htdocs/skins/Customer/default/css/alpaca/images/email.png 0 → 100644

3.24 KB

var/httpd/htdocs/skins/Customer/default/css/alpaca/images/left.png 0 → 100644

170 Bytes

var/httpd/htdocs/skins/Customer/default/css/alpaca/images/phone.png 0 → 100644

3.35 KB

var/httpd/htdocs/skins/Customer/default/css/alpaca/images/time.png 0 → 100644

963 Bytes