Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

How to add current site into content selector dialog?

Vote:
 

Hi,

I create a custom property that call "Image Gallery" and use "contentSelectorDialog" to select image content, but the problem is missing "For this site" folder and I want to include it into this.

Here is part of the code where to display dialog.

_onAddButtonClick: function (event) {
                    var contentRepositoryDescriptors = this.contentRepositoryDescriptors || dependency.resolve("epi.cms.contentRepositoryDescriptors");
                    this.roots = contentRepositoryDescriptors["pages"].roots;
                    debugger 
                    this.isShowingChildDialog = true;
                    this.contentSelectorDialog = new ContentSelectorDialog({
                        canSelectOwnerContent: false,
                        showButtons: false,                       
                        roots: this.roots,
                        //allowedTypes: ["episerver.core.icontentdata"],
                        //allowedTypes: ["episerver.core.mediadata"],
                        allowedTypes: ["episerver.core.icontentimage"],
                        showAllLanguages: true
                    });
                    this.dialog = new Dialog({
                        title: "Välj en bild",
                        dialogClass: "epi-dialog-portrait",
                        content: this.contentSelectorDialog,
                        destroyOnHide: true
                    });
                    this.connect(this.dialog, "onExecute", "_onDialogExecute");
                    this.connect(this.dialog, 'onHide', '_onDialogHide');
                    this.isShowingChildDialog = true;
                    this.dialog.show();
                },

I think there is some way to add current site start page in to this.roots. But I don't know how to get current page. Can anyone can help me with this?

Thank in advance,

#139442
Oct 02, 2015 10:37
Vote:
 

define([
"dojo/_base/declare"
"epi/shell/_ContextMixin"
], function (
declare,
_ContextMixin
) {
return declare("xyz",
[_ContextMixin], {
contextChanged: function (ctx, callerData) {
//Current Context
this.context = ctx;
},
context: null
});
});

Regards
/K

#139447
Edited, Oct 02, 2015 11:00
Vote:
 

Hi,

Thank for reply but the system do not run into contextChanged function, so they cannot assign ctx to this.context.

Edited: this function work in page not in block. This custom property I created in a block, so this function doesn't work. How I can get current site root of a block or site assets root?

#139449
Edited, Oct 02, 2015 11:20
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.