How to get custom properties metadata ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2014 03:28 AM
Hi,
I'm trying to make a dashlet with a link which displaying a simple dialog.
The goal is to get my custom metadata on the simple dialog form.
I will edit and send them through POST method.
They will be in the document library site.
Now I can't see my simple dialog, what should I do to get it ?
And how to recover my custom metadata values before I POST them ?
Please help me, It's very URGENT !!! Thanks to all of you
I'm trying to make a dashlet with a link which displaying a simple dialog.
The goal is to get my custom metadata on the simple dialog form.
I will edit and send them through POST method.
They will be in the document library site.
Now I can't see my simple dialog, what should I do to get it ?
And how to recover my custom metadata values before I POST them ?
Please help me, It's very URGENT !!! Thanks to all of you

Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2014 02:03 PM
Read through this:
https://wiki.alfresco.com/wiki/Forms_Developer_Guide
Then find a dialog in Share or in an add-on that works like you want and then dive into its source.
Unfortunately, that's the best advice I can give you at the moment. We realize Share development documentation is a gap that we need to fill as fast as we can.
Someone else may be able to chime in with some code that they can point you to.
Jeff
https://wiki.alfresco.com/wiki/Forms_Developer_Guide
Then find a dialog in Share or in an add-on that works like you want and then dive into its source.
Unfortunately, that's the best advice I can give you at the moment. We realize Share development documentation is a gap that we need to fill as fast as we can.
Someone else may be able to chime in with some code that they can point you to.
Jeff
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2014 04:17 PM
I'm getting error on my code (client js) here is it.
I don't know if I have to modify my js, I can't go further all of this, I want to get my custom metadata properties display on SimpleDialog popUp, but when I click on my link I get an error : Uncaught TypeError: Cannot read property 'attributes' of null, attributes of the SimpleDialog.js ??? I don't understand this one ???
//list-news.js
<javascript>
if (typeof custom == "undefined" || !custom){
var custom = {};
custom.dashlet = {};
}
(function() {
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event;
//var $html = Alfresco.util.encodeHTML;
custom.dashlet.list_news = function list_news_constructor(htmlId) {
custom.dashlet.list_news.superclass.constructor.call(this, "custom.dashlet.list_news", htmlId);
//Register the component
Alfresco.util.ComponentManager.register(this);
//Load YUI components
Alfresco.util.YUILoaderHelper.require(["button", "container",
"datasource", "datatable", "paginator", "json", "history",
"tabview"], this.onComponentsLoaded, this);
return this;
};
YAHOO.extend(custom.dashlet.list_news, Alfresco.component.Base,
{
options:
{
componentId : "",
containerId : "documentlibrary",
},
configDialog: null,
widgets: {},
onReady: function list_news_onReady() {
var me = this;
// Add click handler to config news link that will be visible if user
// is site manager.
var configFeedLink = Dom.get(this.id + "-config-link");
if (configFeedLink) {
Event.addListener(configFeedLink, "click",this.onConfigListNewsClick, this, true);
}
},
onConfigListNewsClick : function list_news_onConfigListNewsClick(e) {
var actionUrl = Alfresco.constants.URL_SERVICECONTEXT + "modules/list-news/config/" +
encodeURIComponent(this.options.componentId);
function computeRedirectUrl(){
var scope = "window.parent.Alfresco.util.ComponentManager.get('" + this.id + "')";
var successCallback = "window.parent.Alfresco.util.ComponentManager.get('" + this.id + "-configDialog')" +
".options.onSuccess.fn";
var failureCallback = "window.parent.Alfresco.util.ComponentManager.get('" + this.id + "-configDialog')" +
".options.onFailure.fn";
var params = {
successCallback: successCallback,
successScope: scope,
failureCallback: failureCallback,
failureScope: scope
}
var url = Alfresco.constants.URL_SERVICECONTEXT + "api/multipartcallback?";
url += "params=" + JSON.stringify(params);
return url;
}
var templateUrl = YAHOO.lang.substitute(Alfresco.constants.URL_SERVICECONTEXT +
"components/form?itemKind={itemKind}&itemId={itemId}&htmlid={htmlid}&formId={formId}" +
"&destination={destination}&mode={mode}&submitType={submitType}&showCancelButton=true&redirect={redirect}",
{
itemKind: "type",
itemId: "ca:entryFormNews",
htmlid: "html",
formId: "custom-metadata",
//destination: destination,
mode: "create",
submitType: "json",//multipart
redirect: computeRedirectUrl()
});
if(!this.configDialog){
this.configDialog = new Alfresco.module.SimpleDialog(this.id + "-configDialog").setOptions(
{
width: "40em",
templateUrl: templateUrl,
actionUrl: actionUrl,
destroyOnHide: true,
onSuccess:
{
fn: function list_news_onConfig_success(response){
Alfresco.util.PopupManager.displayMessage(
{
text: this.msg("message.success")
});
},
scope: this
},
onFailure:
{
fn: function list_news_onConfig_failure(response){
Alfresco.util.PopupManager.displayMessage(
{
text: this.msg("message.failure")
});
},
scope: this
}
});
}
this.configDialog.setOptions(
{
actionUrl: actionUrl,
containerId: this.options.containerId
}).show();
},
});
})();
</javascript>
I don't know if I have to modify my js, I can't go further all of this, I want to get my custom metadata properties display on SimpleDialog popUp, but when I click on my link I get an error : Uncaught TypeError: Cannot read property 'attributes' of null, attributes of the SimpleDialog.js ??? I don't understand this one ???
//list-news.js
<javascript>
if (typeof custom == "undefined" || !custom){
var custom = {};
custom.dashlet = {};
}
(function() {
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event;
//var $html = Alfresco.util.encodeHTML;
custom.dashlet.list_news = function list_news_constructor(htmlId) {
custom.dashlet.list_news.superclass.constructor.call(this, "custom.dashlet.list_news", htmlId);
//Register the component
Alfresco.util.ComponentManager.register(this);
//Load YUI components
Alfresco.util.YUILoaderHelper.require(["button", "container",
"datasource", "datatable", "paginator", "json", "history",
"tabview"], this.onComponentsLoaded, this);
return this;
};
YAHOO.extend(custom.dashlet.list_news, Alfresco.component.Base,
{
options:
{
componentId : "",
containerId : "documentlibrary",
},
configDialog: null,
widgets: {},
onReady: function list_news_onReady() {
var me = this;
// Add click handler to config news link that will be visible if user
// is site manager.
var configFeedLink = Dom.get(this.id + "-config-link");
if (configFeedLink) {
Event.addListener(configFeedLink, "click",this.onConfigListNewsClick, this, true);
}
},
onConfigListNewsClick : function list_news_onConfigListNewsClick(e) {
var actionUrl = Alfresco.constants.URL_SERVICECONTEXT + "modules/list-news/config/" +
encodeURIComponent(this.options.componentId);
function computeRedirectUrl(){
var scope = "window.parent.Alfresco.util.ComponentManager.get('" + this.id + "')";
var successCallback = "window.parent.Alfresco.util.ComponentManager.get('" + this.id + "-configDialog')" +
".options.onSuccess.fn";
var failureCallback = "window.parent.Alfresco.util.ComponentManager.get('" + this.id + "-configDialog')" +
".options.onFailure.fn";
var params = {
successCallback: successCallback,
successScope: scope,
failureCallback: failureCallback,
failureScope: scope
}
var url = Alfresco.constants.URL_SERVICECONTEXT + "api/multipartcallback?";
url += "params=" + JSON.stringify(params);
return url;
}
var templateUrl = YAHOO.lang.substitute(Alfresco.constants.URL_SERVICECONTEXT +
"components/form?itemKind={itemKind}&itemId={itemId}&htmlid={htmlid}&formId={formId}" +
"&destination={destination}&mode={mode}&submitType={submitType}&showCancelButton=true&redirect={redirect}",
{
itemKind: "type",
itemId: "ca:entryFormNews",
htmlid: "html",
formId: "custom-metadata",
//destination: destination,
mode: "create",
submitType: "json",//multipart
redirect: computeRedirectUrl()
});
if(!this.configDialog){
this.configDialog = new Alfresco.module.SimpleDialog(this.id + "-configDialog").setOptions(
{
width: "40em",
templateUrl: templateUrl,
actionUrl: actionUrl,
destroyOnHide: true,
onSuccess:
{
fn: function list_news_onConfig_success(response){
Alfresco.util.PopupManager.displayMessage(
{
text: this.msg("message.success")
});
},
scope: this
},
onFailure:
{
fn: function list_news_onConfig_failure(response){
Alfresco.util.PopupManager.displayMessage(
{
text: this.msg("message.failure")
});
},
scope: this
}
});
}
this.configDialog.setOptions(
{
actionUrl: actionUrl,
containerId: this.options.containerId
}).show();
},
});
})();
</javascript>
