Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getDocumentVersionMarkup: function DocumentVersions_getDocumentVersionMarkup(doc)
- {
- var json = null;
- Alfresco.util.Ajax.jsonGet(
- {
- url: Alfresco.constants.PROXY_URI + "api/sites/" + Alfresco.constants.SITE + "/memberships/" + encodeURIComponent(Alfresco.constants.USERNAME),
- successCallback:
- {
- fn: function(response)
- {
- try {
- json = JSON.parse(response.serverResponse.responseText);
- Alfresco.util.PopupManager.displayMessage(
- {
- text: json
- });
- } catch (e) {
- // handle error
- }
- },
- scope: this
- },
- failureCallback:
- {
- fn: function(response)
- {
- // handle failure case
- },
- scope: this
- }
- });
- // Calling membership webscript for getting role of the current user
- //var json = remote.call("/api/sites/" + page.url.templateArgs.site + "/memberships/" + encodeURIComponent(user.name));
- Alfresco.logger.debug("Printing json object from Alfresco logger " + json);
- //console.log()("Printing json object from console.log " + json);
- var downloadURL = Alfresco.constants.PROXY_URI + 'api/node/content/' + doc.nodeRef.replace(":/", "") + '/' + doc.name + '?a=true',
- html = '';
- html += '<div class="version-panel-left">'
- html += ' <span class="document-version">' + $html(doc.label) + '</span>';
- html += '</div>';
- html += '<div class="version-panel-right">';
- html += ' <h3 class="thin dark" style="width:' + (Dom.getViewportWidth() * 0.25) + 'px;">' + $html(doc.name) + '</h3>';
- html += ' <span class="actions">';
- if (this.options.allowNewVersionUpload)
- {
- html += ' <a href="#" name=".onRevertVersionClick" rel="' + doc.label + '" class="' + this.id + ' revert" title="' + this.msg("label.revert") + '"> </a>';
- }
- if (json.role == "SiteViewer")
- {
- Alfresco.logger.debug("User has a Viewer role. Hiding donwload button");
- // do nothing
- }else{
- html += ' <a href="' + downloadURL + '" class="download" title="' + this.msg("label.download") + '"> </a>';
- }
- /*html += ' <a href="' + downloadURL + '" class="download" title="' + this.msg("label.download") + '"> </a>';*/
- html += ' <a href="#" name=".onViewHistoricPropertiesClick" rel="' + doc.nodeRef + '" class="' + this.id + ' historicProperties" title="' + this.msg("label.historicProperties") + '"> </a>';
- html += ' </span>';
- html += ' <div class="clear"></div>';
- html += ' <div class="version-details">';
- html += ' <div class="version-details-left">'
- html += $userAvatar(doc.creator.userName, 32);
- html += ' </div>';
- html += ' <div class="version-details-right">';
- html += $userProfileLink(doc.creator.userName, doc.creator.firstName + ' ' + doc.creator.lastName, 'class="theme-color-1"') + ' ';
- html += Alfresco.util.relativeTime(Alfresco.util.fromISO8601(doc.createdDateISO)) + '<br />';
- html += ((doc.description || "").length > 0) ? $html(doc.description, true) : '<span class="faded">(' + this.msg("label.noComment") + ')</span>';
- html += ' </div>';
- html += ' </div>';
- html += '</div>';
- html += '<div class="clear"></div>';
- return html;
- },
- /**
- * Called when a "onRevertVersionClick" link has been clicked for a version.
- * Will display the revert version dialog.
- *
- * @method onRevertVersionClick
- * @param version
- */
- onRevertVersionClick: function DocumentVersions_onRevertVersionClick(version)
- {
- // Find the version through the index and display the revert dialog for the version
- Alfresco.module.getRevertVersionInstance().show(
- {
- filename: this.latestVersion.name,
- nodeRef: this.options.nodeRef,
- version: version,
- onRevertVersionComplete:
- {
- fn: this.onRevertVersionComplete,
- scope: this
- }
- });
- },
- Response I am getting
- {
- "role": "SiteManager",
- "isMemberOfGroup": false,
- "authority":
- {
- "authorityType": "USER",
- "fullName": "admin",
- "userName": "admin",
- "firstName": "Administrator",
- "lastName": "",
- "url": "\/alfresco\/s\/api\/people\/admin"
- },
- "url": "\/alfresco\/s\/api\/sites\/testing\/memberships\/admin"
- }
Add Comment
Please, Sign In to add comment