Skip to content

Commit

Permalink
removes the old solution folder and some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ramarao9 committed Jan 13, 2020
1 parent 9324024 commit 042583c
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 184 deletions.
17 changes: 10 additions & 7 deletions AttachmentDragandDrop/Other/Solution.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,26 @@
<!-- Localized Solution Name in language code -->
<LocalizedName description="AttachmentDragandDrop" languagecode="1033" />
</LocalizedNames>
<Descriptions />
<Descriptions>
<!-- Description of Cds Publisher in language code -->
<Description description="https://github.com/ramarao9/AttachmentUploader" languagecode="1033" />
</Descriptions>
<Version>1.0</Version>
<!-- Solution Package Type: Unmanaged(0)/Managed(1)/Both(2)-->
<Managed>2</Managed>
<Publisher>
<!-- Unique Publisher Name of Cds Solution -->
<UniqueName>ramasolutions</UniqueName>
<UniqueName>ramakoneru</UniqueName>
<LocalizedNames>
<!-- Localized Cds Publisher Name in language code-->
<LocalizedName description="ramasolutions" languagecode="1033" />
<LocalizedName description="Rama Koneru" languagecode="1033" />
</LocalizedNames>
<Descriptions>
<!-- Description of Cds Publisher in language code -->
<Description description="ramasolutions" languagecode="1033" />
<Description description="" languagecode="1033" />
</Descriptions>
<EMailAddress xsi:nil="true"></EMailAddress>
<SupportingWebsiteUrl xsi:nil="true"></SupportingWebsiteUrl>
<SupportingWebsiteUrl xsi:nil="true">https://github.com/ramarao9/</SupportingWebsiteUrl>
<!-- Customization Prefix for the Cds Publisher-->
<CustomizationPrefix>ram</CustomizationPrefix>
<!-- Derived Option Value Prefix for the Customization Prefix of Cds Publisher -->
Expand All @@ -35,7 +38,7 @@
<AddressTypeCode>1</AddressTypeCode>
<City xsi:nil="true"></City>
<County xsi:nil="true"></County>
<Country xsi:nil="true"></Country>
<Country xsi:nil="true">USA</Country>
<Fax xsi:nil="true"></Fax>
<FreightTermsCode xsi:nil="true"></FreightTermsCode>
<ImportSequenceNumber xsi:nil="true"></ImportSequenceNumber>
Expand All @@ -49,7 +52,7 @@
<PostOfficeBox xsi:nil="true"></PostOfficeBox>
<PrimaryContactName xsi:nil="true"></PrimaryContactName>
<ShippingMethodCode>1</ShippingMethodCode>
<StateOrProvince xsi:nil="true"></StateOrProvince>
<StateOrProvince xsi:nil="true">MN</StateOrProvince>
<Telephone1 xsi:nil="true"></Telephone1>
<Telephone2 xsi:nil="true"></Telephone2>
<Telephone3 xsi:nil="true"></Telephone3>
Expand Down
2 changes: 1 addition & 1 deletion AttachmentUpload/ControlManifest.Input.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<manifest>
<control namespace="vij" constructor="AttachmentUpload" version="0.0.4" display-name-key="AttachmentUpload"
<control namespace="vij" constructor="AttachmentUpload" version="1.0.0" display-name-key="AttachmentUpload"
description-key="Upload attachments easily using drag and drop" control-type="standard">
<type-group name="flds">
<type>SingleLine.Text</type>
Expand Down
41 changes: 28 additions & 13 deletions AttachmentUpload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { IInputs, IOutputs } from "./generated/ManifestTypes";
import { AttachmentUploader, UploadProps } from './AttachmentUploader';


interface EntityRef {
id: string,
entityName: string
}

export class AttachmentUpload implements ComponentFramework.StandardControl<IInputs, IOutputs> {

private UploadIconName: string = "uploadicn.png";
Expand All @@ -29,18 +34,13 @@ export class AttachmentUpload implements ComponentFramework.StandardControl<IInp
* @param container If a control is marked control-type='standard', it will receive an empty div element within which it can render its content.
*/
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container: HTMLDivElement) {
let currentPageContext = context as any;
currentPageContext = currentPageContext ? currentPageContext["page"] : undefined;
if (currentPageContext && currentPageContext.entityId) {
this.uploadProps.id = currentPageContext.entityId;
this.uploadProps.entityName = currentPageContext.entityTypeName;
let entityRef = this.getEntityReference(context);
if (entityRef) {
this.uploadProps.id = entityRef.id
this.uploadProps.entityName = entityRef.entityName;
this.uploadProps.context = context;
this.uploadProps.controlToRefresh = context.parameters.ControlNameForRefresh.raw;
this.uploadProps.uploadIcon = this.getImageBase64();

// context.resources.getResource(this.UploadIconName,
// this.getImageResourceSuccess.bind(this, "png"),
// this.getImageResourceError.bind(this));
}
this.attachmentUploaderContainer = container;
}
Expand All @@ -60,17 +60,32 @@ export class AttachmentUpload implements ComponentFramework.StandardControl<IInp
}


private getEntityReference(context: ComponentFramework.Context<IInputs>): EntityRef | undefined {
let currentPageContext = context as any;
currentPageContext = currentPageContext ? currentPageContext["page"] : undefined;
if (currentPageContext && currentPageContext.entityId && currentPageContext.entityId !== "") {
var entityRef: EntityRef = { id: currentPageContext.entityId, entityName: currentPageContext.entityTypeName };
return entityRef;
}

return undefined;

}

/**
* Called when any value in the property bag has changed. This includes field values, data-sets, global values such as container height and width, offline status, control metadata values such as label, visible, etc.
* @param context The entire property bag available to control via Context Object; It contains values as set up by the customizer mapped to names defined in the manifest, as well as utility functions
*/
public updateView(context: ComponentFramework.Context<IInputs>): void {
this.uploadProps.context = context;
let currentPageContext = context as any;
currentPageContext = currentPageContext ? currentPageContext["page"] : undefined;
if (currentPageContext && currentPageContext.entityId) {
this.uploadProps.id = currentPageContext.entityId;

let entityRef = this.getEntityReference(context);
if (entityRef) {
this.uploadProps.id = entityRef.id;
this.uploadProps.entityName = entityRef.entityName;
}
this.uploadProps.uploadIcon = this.getImageBase64();//when initially a new record tha's transitioning to an existing record, so the UI is now being updated to enable the content

ReactDOM.render(
React.createElement(
AttachmentUploader,
Expand Down
5 changes: 0 additions & 5 deletions AttachmentUploader/.gitignore

This file was deleted.

44 changes: 0 additions & 44 deletions AttachmentUploader/AttachmentUploader.cdsproj

This file was deleted.

18 changes: 0 additions & 18 deletions AttachmentUploader/Other/Customizations.xml

This file was deleted.

2 changes: 0 additions & 2 deletions AttachmentUploader/Other/Relationships.xml

This file was deleted.

94 changes: 0 additions & 94 deletions AttachmentUploader/Other/Solution.xml

This file was deleted.

0 comments on commit 042583c

Please sign in to comment.