06-18-2021 05:56 AM
Hi all, I need help customizing the default SitePicker.js of the Aikau library to show only the choice only to sites with a specific "site preset".
The process is i select a site type from the standard "Create Site" dialog:
When select the "Custom Preset" i show my custom form dialog:
Now i click on the button "Parent Site" a classical "SitePicker" form control of Aikau, but i need to show only site with a specific "site preset".
I based my example on the "site-hierarchy addon" :
And i need to make a customized version of the :
For filter by "site preset".
Can anyone help with this or link me to some similar example ?
06-21-2021 05:32 AM
That's really not trivial. You would have to
Note: I am the original author of the site hierarchy addon
06-21-2021 12:39 PM
Hi afaust, It must be me who don't know aikau well yet, but I still can't get what I want.
Here main resource file structure:
Here the attachment of the files: https://drive.google.com/drive/folders/1WEm73VpeZBq98kcAbDc83LAEPN1vIJnX?usp=sharing
I'm lost on the 3rd point of the list:
"Create a customisation of alfresco/forms/controls/SitePicker which uses your customised, non-form SitePicker instead of the default"
i don't get how can i connect the code i made on the " alfresco/forms/controls/SitePresetPicker":
{
name: "alfresco/menus/AlfMenuBarItem",
config: {
label: "picker.allSites.label",
publishTopic: "ALF_ADD_PICKER",
publishPayload: {
currentPickerDepth: 0,
pickerLabel: "SitesPreset",
picker: [
{
name: "alfresco/lists/AlfSortablePaginatedList",
config: {
noDataMessage: "sitePicker.list.noSitesFound",
dataFailureMessage: "sitePicker.list.errorLoadingSites",
itemsProperty: "",
loadDataPublishTopic: "ALF_GET_SITES_BY_SITE_PRESET",
waitForPageWidgets: false,
widgets: [sitesView]
}
}
]
}
}
}with method i made on "alfresco/services/SitePresetService"
getSitesBySitePreset: function alfresco_services_SitePresetService__getSites(payload) {
// TODO: Clean this up. Choose on or other as the Aikau standard.
var alfResponseTopic = payload.alfResponseTopic || payload.responseTopic;
var config = {
url: AlfConstants.PROXY_URI + "api/sites", // I'll do something here eventually
method: "GET",
alfTopic: alfResponseTopic
};
this.serviceXhr(config);
},for clarification here the code of my share custom configuration.
<config evaluator="string-compare" condition="WebFramework" replace="false">
<web-framework>
<dojo-pages>
<packages>
<package name="sitepresetservice" location="resources/service-site-hierarchy/aikau/alfresco/services/SitePresetService.js"/>
<package name="sitepresetpicker" location="resources/service-site-hierarchy/aikau/alfresco/pickers/SitePresetPicker.js"/>
<package name="sitepresetformcontrolpicker" location="resources/service-site-hierarchy/aikau/alfresco/forms/controls/SitePresetPicker.js"/>
</packages>
</dojo-pages>
</web-framework>
</config>Sorry for the inconvenience, but it is something that I have to solve at all costs. I'm willing ot pay a small bounty for this.
06-22-2021 08:49 AM
In your site service you must have mapped the new "getSitesBySitePreset" function to a pubsub topic, similar to how all the default functions are mapped/registered. That topic is the connection - a widget publishes to that topic to trigger the request, and the site service actually publishes to a similar response topic (original topic with an added suffix) to send back the results (handled transparently by "serviceXhr" in your case)
.
06-23-2021 07:04 AM
Ty again, i have already do that on the service file:
https://drive.google.com/drive/u/1/folders/1MVl6w-et7C9GLxoNE90qrkAIVjH0lWrP
this.alfSubscribe("ALF_GET_SITES_BY_SITE_PRESET", lang.hitch(this, this.getSitesBySitePreset));it's must be something else i'm not seeing or some dojo config i screwed up.
Like i said i'm willing to pay for a use case example on github, because I admit I'm completely lost.
If it helps you in your answers I am trying to add the following customizations to your "site-hierarchy" addon used as a starting point:
A site selector limited to sites of a specific type.
Show or hide elements of the site creation or display form depending on which value has been selected in the "type site" dropdown.
Ty for your help.
06-23-2021 01:11 PM
Ok maybe i find the problem i need to make a override of the site service:
var siteService = widgetUtils.findObject(model.jsonModel, "id", "SITE_SERVICE");
so on the file "share-header.get.js" i add this code:
//Change SiteService to Customized Module widgetUtils.findObject(model.jsonModel, "id", "SITE_SERVICE").name = "alfresco/services/SitePresetService”;make sense ?
Explore our Alfresco products with the links below. Use labels to filter content by product module.