diff --git a/ng2-components/ng2-activiti-form/README.md b/ng2-components/ng2-activiti-form/README.md index a8cb1de03b..8da8cbf5df 100644 --- a/ng2-components/ng2-activiti-form/README.md +++ b/ng2-components/ng2-activiti-form/README.md @@ -244,10 +244,17 @@ will also be executed after your custom code.** - Header * [x] Plain header * [x] Collapsible header -- [ ] Attach +- [x] Attach file ** - [x] Display value - [x] Display text +** Files may be uploaded from a user's device if the file source selected is +'Local file' or 'All sources' and 'link to files' is not selected. Alternatively +you can link to files in a configured Alfresco repository by selecting this source +explicitly from the list and making sure that 'link to files' is selected. Copying +files from Alfresco into Activiti via the control (no linking) is not currently +supported, nor is allowing the user to choose between more than one source. + ## Build from sources Alternatively you can build component from sources with the following commands: diff --git a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts index e2ae2ff507..d8d4c61755 100644 --- a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts +++ b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts @@ -26,6 +26,7 @@ import { import { MATERIAL_DESIGN_DIRECTIVES } from 'ng2-alfresco-core'; import { EcmModelService } from './../services/ecm-model.service'; import { FormService } from './../services/form.service'; +import { ActivitiAlfrescoContentService } from './../services/activiti-alfresco.service'; import { NodeService } from './../services/node.service'; import { FormModel, FormOutcomeModel, FormValues, FormFieldModel, FormOutcomeEvent } from './widgets/core/index'; @@ -85,7 +86,7 @@ import { WidgetVisibilityService } from './../services/widget-visibility.servic templateUrl: './activiti-form.component.html', styleUrls: ['./activiti-form.component.css'], directives: [MATERIAL_DESIGN_DIRECTIVES, ContainerWidget, TabsWidget], - providers: [EcmModelService, FormService, WidgetVisibilityService, NodeService] + providers: [EcmModelService, FormService, ActivitiAlfrescoContentService, WidgetVisibilityService, NodeService] }) export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/attach/attach.widget.css b/ng2-components/ng2-activiti-form/src/components/widgets/attach/attach.widget.css new file mode 100644 index 0000000000..8bb37584c6 --- /dev/null +++ b/ng2-components/ng2-activiti-form/src/components/widgets/attach/attach.widget.css @@ -0,0 +1,15 @@ +.attach-widget { + width:100% +} + +.attach-widget__icon { + float: left; +} + +.attach-widget__file { + margin-top: 4px; +} + +.attach-widget__reset { + margin-top: 4px; +} diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/attach/attach.widget.html b/ng2-components/ng2-activiti-form/src/components/widgets/attach/attach.widget.html new file mode 100644 index 0000000000..e79e98dbc7 --- /dev/null +++ b/ng2-components/ng2-activiti-form/src/components/widgets/attach/attach.widget.html @@ -0,0 +1,33 @@ +
+ + diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/attach/attach.widget.ts b/ng2-components/ng2-activiti-form/src/components/widgets/attach/attach.widget.ts new file mode 100644 index 0000000000..fbb2293625 --- /dev/null +++ b/ng2-components/ng2-activiti-form/src/components/widgets/attach/attach.widget.ts @@ -0,0 +1,146 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Component, OnInit, Input, Output, EventEmitter, ViewChild } from '@angular/core'; +import { WidgetComponent } from './../widget.component'; +import { ActivitiAlfrescoContentService } from '../../../services/activiti-alfresco.service'; +import { ExternalContent } from '../core/external-content'; +import { ExternalContentLink } from '../core/external-content-link'; +import { FormFieldModel } from '../core/form-field.model'; + +declare let __moduleName: string; +declare var componentHandler; + +@Component({ + moduleId: __moduleName, + selector: 'attach-widget', + templateUrl: './attach.widget.html', + styleUrls: ['./attach.widget.css'] +}) +export class AttachWidget extends WidgetComponent implements OnInit { + + selectedFolderPathId: string; + selectedFolderSiteId: string; + selectedFolderSiteName: string; + selectedFolderAccountId: string; + fileName: string; + hasFile: boolean; + selectedFolderNodes: [ExternalContent]; + selectedFile: ExternalContent; + + @Input() + field: FormFieldModel; + + @Output() + fieldChanged: EventEmitter