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>