Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
switch (media.type) {
case 'video':
// add video
break;
default:
let photoUrl;
if (fieldProps.isAttachment) {
const attachmentUrl = Helper.attachmentUtils.getAttachmentUrlsByStringMatch({
layer: this.props.layer,
feature: this.props.feature,
match: media.field,
position: 0
})[0] || '';
photoUrl = Helper.attachmentUtils.checkForCredential({
url: attachmentUrl,
layer: this.props.layer
});
} else {
photoUrl = Helper.attachmentUtils.checkForCredential({
url: this.props.thumbnailUrlPrepend + attributes[media.field] + this.props.thumbnailUrlAppend,
layer: this.props.layer
});
}
return (
<div>
</div>
<button>
<p>{this.props.exploreText}</p>
<div></div>
</button>
: null;
let background;
switch (this.props.background.type) {
case 'photo':
const backgroundUrl = Helper.attachmentUtils.checkForCredential({
url: this.props.background.source,
portal: this.props.portal
});
background = ;
break;
}
return (
<div>
{builderText && !this.props.editingAllowed ? (
// TODO check builder mode instead of if builder text
<button></button></div>
uploadAttachment(data) {
const portal = lang.getObject('appState.app.portal',false,this);
let filename;
let attachment;
switch (data.type) {
case 'photo':
filename = data.id + data.attachment.ext;
attachment = Helper.attachmentUtils.dataURItoBlob(data.attachment.source);
break;
}
portal.uploadAppItemAttachments({
attachment,
filename
}).then((url) => {
if (data.removeAttachments) {
portal.removeAttachments({
keep: filename,
filter: data.removeFilter
});
}
if (typeof data.callback === 'function') {
data.callback(url);
}
Object.keys(graphic.attributes).forEach((key) => {
const value = graphic.attributes[key];
if (typeof value === 'object' && value.attachment && value.type) {
switch (value.type) {
case 'photo':
attachments.push({
field: key,
filename: key + value.ext,
attachment: Helper.attachmentUtils.dataURItoBlob(value.source),
url: false
});
delete graphic.attributes[key];
break;
default:
}
} else if (typeof value === 'object') {
graphic.attributes[key] = JSON.stringify(value);
} else if (typeof value === 'string') {
graphic.attributes[key] = value.sanitizeHtml();
}
});
$.each(g.attributes, (key,value) => {
if (typeof value === 'object' && value.attachment && value.type) {
switch (value.type) {
case 'photo':
g.attributes[key] = 'ATTACHMENT_' + key;
attachments.push({
field: key,
filename: key + value.ext,
attachment: Helper.attachmentUtils.dataURItoBlob(value.source)
});
break;
}
} else if (typeof value === 'object') {
g.attributes[key] = JSON.stringify(value);
}
});
}
render() {
const headerClass = Helper.classnames([this.props.className, 'header', 'navbar', 'main-app-header']);
const participateIconHtml = {
__html: getIcon('participate')
};
const participateBtn = this.props.showParticipateActionButton ? (
<button> this.participateBtn = ref} className={Helper.classnames(['participate', 'btn', 'btn-primary', 'nav-btn'],{
disabled: this.props.participationButtonDisabled
})} onClick={this.participateAction}>
<span></span>
<span>{this.props.participateShort}</span>
</button>
) : null;
const logoUrl = Helper.attachmentUtils.checkForCredential({
url: this.props.logo.source,
portal: this.props.portal
});
const includeSharing = Object.keys(this.props.sharing.services).filter((key) => {
return this.props.sharing.services[key] === true;
}).length > 0;
return (
<header>
<div>
{this.props.logo.type === 'none' || logoUrl.length === 0 ? null : (
<a href="{this.props.logo.link}">
<img alt="{this.props.logo.link}" src="{logoUrl}">
</a>
)}</div></header>
let photoUrl;
if (fieldProps.isAttachment) {
const attachmentUrl = Helper.attachmentUtils.getAttachmentUrlsByStringMatch({
layer: this.props.layer,
feature: this.props.feature,
match: media.field,
position: 0
})[0] || '';
photoUrl = Helper.attachmentUtils.checkForCredential({
url: attachmentUrl,
layer: this.props.layer
});
} else {
photoUrl = Helper.attachmentUtils.checkForCredential({
url: this.props.thumbnailUrlPrepend + attributes[media.field] + this.props.thumbnailUrlAppend,
layer: this.props.layer
});
}
return (
<div>
</div>
galleryItemRender(item,index) {
const attr = this.props.attributePath ? Helper.objectUtils.getDescendentProperty(item,this.props.attributePath) : item;
const endTile = index % this.state.tileSettings.tilesPerRow === 0;
let photoUrl;
if (this.props.thumbnailIsAttachment) {
const attachmentUrl = Helper.attachmentUtils.getAttachmentUrlsByStringMatch({
layer: this.props.layer,
feature: item,
match: this.props.thumbnailField,
position: 0
})[0] || '';
photoUrl = Helper.attachmentUtils.checkForCredential({
url: attachmentUrl,
layer: this.props.layer
});
} else {
photoUrl = Helper.attachmentUtils.checkForCredential({
url: this.props.thumbnailUrlPrepend + attr[this.props.thumbnailField] + this.props.thumbnailUrlAppend,
layer: this.props.layer
});
}
const itemStyle = {
height: this.state.tileSettings.tileSize,
width: endTile ? this.state.tileSettings.tileSize - 0.5 : this.state.tileSettings.tileSize
};
const itemClasses = Helper.classnames(['gallery-item', {
galleryItemRender(item,index) {
const attr = this.props.attributePath ? Helper.objectUtils.getDescendentProperty(item,this.props.attributePath) : item;
const endTile = index % this.state.tileSettings.tilesPerRow === 0;
let photoUrl;
if (this.props.thumbnailIsAttachment) {
const attachmentUrl = Helper.attachmentUtils.getAttachmentUrlsByStringMatch({
layer: this.props.layer,
feature: item,
match: this.props.thumbnailField,
position: 0
})[0] || '';
photoUrl = Helper.attachmentUtils.checkForCredential({
url: attachmentUrl,
layer: this.props.layer
});
} else {
photoUrl = Helper.attachmentUtils.checkForCredential({
url: this.props.thumbnailUrlPrepend + attr[this.props.thumbnailField] + this.props.thumbnailUrlAppend,
layer: this.props.layer
});
}