(function()
{
Alfresco.doclib.Actions.prototype.onActionXxx = function DL_onActionXxx(assets)
{
if (!this.modules.xxx)
{
this.modules.xxx= new Alfresco.module.DoclibXxx(this.id + "-xxx");
}
this.modules.xxx.setOptions(
{
siteId: this.options.siteId,
containerId: this.options.containerId,
path: this.currentPath,
files: assets
}).showDialog();
};
})();
<div id="${args.htmlid}-dialog" class="xxx">
<div id="${args.htmlid}-title" class="hd"></div>
<div class="bd">
<form id="${args.htmlid}-form" action="" method="post" accept-charset="utf-8">
<div class="yui-g">
<h2>${msg("header.type")}</h2>
</div>
<div class="field">
<select id="${args.htmlid}-type" name="type" tabindex="2">
<option value="typearch:gen" selected="selected">generic</option>
<option value="typearch:alfrep">alfresco reports</option>
<option value="typearch:alfsec">alfresco screens</option>
<option value="typearch:pcrep">pcdoc reports</option>
<option value="typearch:pcsec">pcdoc screens</option>
</select>
</div>
<div class="bdft">
<input type="button" id="${args.htmlid}-ok" value="${msg("button.assign")}" tabindex="4" />
<input type="button" id="${args.htmlid}-cancel" value="${msg("button.cancel")}" tabindex="5" />
</div>
</form>
</div>
</div>
/**
* action xxx.
*
* @method onActionXxx
* @param assets {object} Object literal representing one or more file(s) or folder(s) to be actioned
*/
onActionXxx: function dlA_onActionXxx(assets)
{
if (!this.modules.xxx)
{
this.modules.xxx= new Alfresco.module.DoclibXxx(this.id + "-xxx");
}
this.modules.xxx.setOptions(
{
siteId: this.options.siteId,
containerId: this.options.containerId,
path: this.currentPath,
file: assets
}).showDialog();
}
(function()
{
/**
* YUI Library aliases
*/
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event,
//Element = YAHOO.util.Element;
/**
* Alfresco Slingshot aliases
*/
var $html = Alfresco.util.encodeHTML;
Alfresco.module.DoclibXxx = function(htmlId)
{
// Mandatory properties
this.name = "Alfresco.module.DoclibXxx";
this.id = htmlId;
// Initialise prototype properties
this.widgets = {};
this.modules = {};
// Register this component
Alfresco.util.ComponentManager.register(this);
// Load YUI Components
Alfresco.util.YUILoaderHelper.require(["button", "container"], this.onComponentsLoaded, this);
return this;
};
Alfresco.module.DoclibXxx.prototype =
{
/**
* Object container for initialization options
*/
options:
{
/**
* Current siteId.
*
* @property siteId
* @type string
*/
siteId: "",
/**
* ContainerId representing root container
*
* @property containerId
* @type string
* @default "documentLibrary"
*/
containerId: "documentLibrary",
/**
* Files to be included in Xxx
*
* @property: files
* @type: object
* @default: null
*/
file: null,
/**
* Width for the dialog
*
* @property: width
* @type: integer
* @default: 50em
*/
width: "50em"
},
/**
* Object container for storing YUI widget instances.
*
* @property widgets
* @type object
*/
widgets: null,
/**
* Object container for storing module instances.
*
* @property modules
* @type object
*/
modules: null,
/**
* Container element for template in DOM.
*
* @property containerDiv
* @type DOMElement
*/
containerDiv: null,
/**
* Set multiple initialization options at once.
*
* @method setOptions
* @param obj {object} Object literal specifying a set of options
* @return {Alfresco.module.DoclibXxx} returns 'this' for method chaining
*/
setOptions: function DLW_setOptions(obj)
{
this.options = YAHOO.lang.merge(this.options, obj);
return this;
},
/**
* Set messages for this component.
*
* @method setMessages
* @param obj {object} Object literal specifying a set of messages
* @return {Alfresco.module.DoclibXxx} returns 'this' for method chaining
*/
setMessages: function DLW_setMessages(obj)
{
Alfresco.util.addMessages(obj, this.name);
return this;
},
/**
* Fired by YUILoaderHelper when required component script files have
* been loaded into the browser.
* @method onComponentsLoaded
*/
onComponentsLoaded: function DLW_onComponentsLoaded()
{
},
/**
* Main entry point
* @method showDialog
*/
showDialog: function DLW_showDialog()
{
if (!this.containerDiv)
{
// Load the UI template from the server
Alfresco.util.Ajax.request(
{
url: Alfresco.constants.URL_SERVICECONTEXT + "modules/documentlibrary/xxx",
dataObj:
{
htmlid: this.id
},
successCallback:
{
fn: this.onTemplateLoaded,
scope: this
},
failureMessage: "Could not load Document Library Xxx template",
execScripts: true
});
}
else
{
// Show the dialog
this._showDialog();
}
},
/**
* Event callback when dialog template has been loaded
*
* @method onTemplateLoaded
* @param response {object} Server response from load template XHR request
*/
onTemplateLoaded: function DLW_onTemplateLoaded(response)
{
// Inject the template from the XHR request into a new DIV element
this.containerDiv = document.createElement("div");
this.containerDiv.setAttribute("style", "display:none");
this.containerDiv.innerHTML = response.serverResponse.responseText;
// The panel is created from the HTML returned in the XHR request, not the container
var dialogDiv = Dom.getFirstChild(this.containerDiv);
while (dialogDiv && dialogDiv.tagName.toLowerCase() != "div")
{
dialogDiv = Dom.getNextSibling(dialogDiv);
}
// Create and render the YUI dialog
this.widgets.dialog = Alfresco.util.createYUIPanel(dialogDiv,
{
width: this.options.width
},
{
type: YAHOO.widget.Dialog
});
this.widgets.dialog.cancelEvent.subscribe(this.onCancel, null, this);
);
},
/**
* Xxx form submit success handler
*
* @method onSuccess
* @param p_data {object} Server response object
*/
onSuccess: function DLW_onSuccess(p_data)
{
//var result;
this._hideDialog();
// Did the operation succeed?
if (!p_data.json.overallSuccess)
{
Alfresco.util.PopupManager.displayMessage(
{
text: this._msg("message.xxx.failure")
});
return;
}
Alfresco.util.PopupManager.displayMessage(
{
text: this._msg("message.xxx.success")
});
},
/**
* xxx form submit failure handler
*
* @method onFailure
* @param p_data {object} Server response object
*/
onFailure: function DLW_onFailure(p_data)
{
//this.widgets.feedbackMessage.destroy();
this.widgets.okButton.set("disabled", false);
this.widgets.cancelButton.set("disabled", false);
this.widgets.dialog.show();
Alfresco.util.PopupManager.displayPrompt(
{
text: this._msg("message.xxx.failure")
});
},
/**
* Dialog Cancel button event handler
*
* @method onCancel
* @param e {object} DomEvent
* @param p_obj {object} Object passed back from addListener method
*/
onCancel: function DLW_onCancel(e, p_obj)
{
this._hideDialog();
},
/**
* PRIVATE FUNCTIONS
*/
/**
* Internal show dialog function
* @method _showDialog
*/
_showDialog: function DLW__showDialog()
{
// Grab the form element
var formElement = Dom.get(this.id + "-form");
// Submission Url
formElement.attributes.action.nodeValue = Alfresco.constants.PROXY_URI + "/slingshot/doclib/action/xxx";
// Dialog title
var fileSpan = '<span class="light">' + $html(this.options.file.displayName) + '</span>';
Dom.get(this.id + "-title").innerHTML = this.msg("title", fileSpan);
// Enable buttons
this.widgets.okButton.set("disabled", false);
this.widgets.cancelButton.set("disabled", false);
// Initialise the Forms Runtime
this.modules.form.init();
// Show the dialog
this.widgets.dialog.show();
// Fix Firefox caret issue
Alfresco.util.caretFix(this.id + "-form");
// We're in a popup, so need the tabbing fix
this.modules.form.applyTabFix();
// Register the ESC key to close the dialog
var escapeListener = new YAHOO.util.KeyListener(document,
{
keys: YAHOO.util.KeyListener.KEY.ESCAPE
},
{
fn: function(id, keyEvent)
{
this.onCancel();
},
scope: this,
correctScope: true
});
escapeListener.enable();
// Set focus to xxx type input
//Dom.get(this.id + "-type").focus();
},
/**
* Hide the dialog, removing the caret-fix patch
*
* @method _hideDialog
* @private
*/
_hideDialog: function DLW__hideDialog()
{
// Grab the form element
var formElement = Dom.get(this.id + "-form");
// Ensure pop-up calendar is hidden
//this.widgets.calendarOverlay.hide();
// Undo Firefox caret issue
Alfresco.util.undoCaretFix(formElement);
this.widgets.dialog.hide();
},
/**
* Gets a custom message
*
* @method _msg
* @param messageId {string} The messageId to retrieve
* @return {string} The custom message
* @private
*/
_msg: function DLW__msg(messageId)
{
return Alfresco.util.message.call(this, messageId, this.name, Array.prototype.slice.call(arguments).slice(1));
}
};
})();
/* Dummy instance to load optional YUI components early */
new Alfresco.module.DoclibXxx(null);
/**
* Document Library "Details" module for Document Library.
*
* @namespace Alfresco.module
* @class Alfresco.module.DoclibXxx
*/
(function()
{
/** YUI Library aliases **/
var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event, KeyListener = YAHOO.util.KeyListener;
/** Alfresco Slingshot aliases **/
var $html = Alfresco.util.encodeHTML;
Alfresco.module.DoclibXxx = function(htmlId) {
return Alfresco.module.DoclibXxx.superclass.constructor.call(this, "Alfresco.module.DoclibXxx", htmlId, ["button", "container", "connection", "json", "calendar", "datatable"]);
};
YAHOO.extend(Alfresco.module.DoclibXxx, Alfresco.component.Base, {
/**
* Object container for initialization options
*/
options: {
/** Current siteId. **/
siteId: "",
/** ContainerId representing root container **/
containerId: "documentLibrary",
/** Files to be included in workflow **/
files: null,
/** Width for the dialog **/
width: "50em"
},
/** Container element for template in DOM. **/
containerDiv: null,
/**
* Main entry point
* @method showDialog
*/
showDialog: function MyDL_showDialog() {
if (!this.containerDiv)
{
// Load the UI template from the server
Alfresco.util.Ajax.request(
{
//FIXME: mettre l'adresse vers votre template
url: Alfresco.constants.URL_SERVICECONTEXT + "modules/documentlibrary/xxx",
dataObj: {
htmlid: this.id
},
successCallback: {
fn: this.onTemplateLoaded,
scope: this
},
failureMessage: "Could not load template",
execScripts: true
});
}
else
{
// Show the dialog
this._showDialog();
}
},
/**
* Event callback when dialog template has been loaded
*
* @method onTemplateLoaded
* @param response {object} Server response from load template XHR request
*/
onTemplateLoaded: function MyDL_onTemplateLoaded(response)
{
// Inject the template from the XHR request into a new DIV element
this.containerDiv = document.createElement("div");
this.containerDiv.setAttribute("style", "display:none");
this.containerDiv.innerHTML = response.serverResponse.responseText;
// The panel is created from the HTML returned in the XHR request, not the container
var dialogDiv = Dom.getFirstChild(this.containerDiv);
while (dialogDiv && dialogDiv.tagName.toLowerCase() != "div") {
dialogDiv = Dom.getNextSibling(dialogDiv);
}
// Create and render the YUI dialog
this.widgets.dialog = Alfresco.util.createYUIPanel(dialogDiv, {
width: this.options.width
},
{
type: YAHOO.widget.Dialog
});
// Cancel button
this.widgets.cancelButton = Alfresco.util.createYUIButton(this, "cancel", this.onCancel);
this.widgets.dialog.cancelEvent.subscribe(this.onCancel, null, this);
// Show the dialog
this._showDialog();
},
/**
* Dialog Cancel button event handler
*
* @method onCancel
* @param e {object} DomEvent
* @param p_obj {object} Object passed back from addListener method
*/
onCancel: function MyDL_onCancel(e, p_obj) {
this._hideDialog();
},
/**
* PRIVATE FUNCTIONS
*/
/**
* Internal show dialog function
* @method _showDialog
*/
_showDialog: function MyDL__showDialog() {
// Dialog title
var titleDiv = Dom.get(this.id + "-title");
if (YAHOO.lang.isArray(this.options.files)) {
titleDiv.innerHTML = this.msg("title.multi", this.options.files.length);
}
else {
titleDiv.innerHTML = this.msg("title.single", '<span class="light">' + $html(this.options.files.displayName) + '</span>');
}
// Show the dialog
this.widgets.dialog.show();
// Register the ESC key to close the dialog
var escapeListener = new KeyListener(document,
{
keys: KeyListener.KEY.ESCAPE
},
{
fn: function(id, keyEvent)
{
this.onCancel();
},
scope: this,
correctScope: true
});
escapeListener.enable();
},
/**
* Hide the dialog, removing the caret-fix patch
*
* @method _hideDialog
* @private
*/
_hideDialog: function MyDL__hideDialog() {
//TODO
this.widgets.dialog.hide();
}
});
/* Dummy instance to load optional YUI components early */
var dummyInstance = new Alfresco.module.DoclibXxx("null");
})();
<script type="text/javascript" src="${page.url.context}/modules/documentlibrary/xxx-action.js"></script>
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.