Getting the site name in alfresco email notification - alfresco-share

I am trying to notify users whenever a site is created in alfresco share. I created a rule for the site folder in the repository.
In Define Rule, I selected:
When: Items are created or entered in the folder
If all criteria are met: Description contains "a"
Perform Action: Send email
But in the message of the email I need to give the site name.
For example:
A new site named "Sample" is created. Click the link to join the site.
How can I get the site name and corresponding link to join the site?

You can do something like this.
var currentSite = Alfresco.constants.SITE;
var siteObject = siteService.getSite(currentSite );

If you are using javascript directly to send mail you you will have site object available .
You can also try this
siteId = page.url.templateArgs.site;
If you are using ftl you can probably pass sitename from script file to FTL file.
You have multiple options to get current site name depending on the context where you are trying to access it.

Related

Cannot add dynamic link firebase

I am trying to create my custom dynamic link: share.grabhotel.net of my custom domain : grabhotel.net. I follow these steps :
Step 1: Add URL Prefix
Step 2 : Verify domain
I passed TXT value to my DNS like this
Step 3 : Add custom domain in Firebase Hosting
Step 4 : Add A records in DNS
But when I go back to my dynamic links, I get this error
Can you show me how to fix it ? And how to add custom dynamic link successfully ? Thank you very much
Please click to the link:"[enter image description here]" for image
In your domain registrar, the first field to the left(either Name, Host, or Alias) is set to grabhotel.net This is the root domain. You want to create dynamic links on the subdomain share.grabhotel.net. You need to set the first field to share.grabhotel.net. Also, it can take a few days for DNS records to propagate. Let me know if you need any help.

What if I don't have domain name that we pass with link parameter for Firebase dynamic links

I am trying to create firebase dynamic links manually but I didn't understand which domain should I provide for 'link' parameter as shown below:
"https://YourDynamicLinkIdentifier.app.goo.gl/link=https://example.com?offer="+myOfferVar+"&apn=com.your.apn";
Here link = www.example.com but I don't have any domain and I am not intended to pass any.
I am just trying to pass a variable with this link so that the end user can receive the passed variable by clicking on the created dynamic link.
I am really stuck with this. Please help me with this.

ReferenceError: people is not defined in Alfresco Community

I am using Alfresco Community 5.0.d and I'm getting below error.
ReferenceError: people is not defined
For following code in people-finder.js file:
var currentUser = people.getPerson(person);
I want to use the people methods for further process. Is there anyway to achieve this?
Also my target is to get all groups for the current user and the search result too.
One way I know is making ajax call to /alfresco/service/api/people/{people}?groups=true but this is an expensive way to achieve this.
Is there an alternative to achieve this?
Thanks
The "people" root object as well as any other that depends on repository tier services can not be accessed directly from a web script running in Alfresco Share.
if you wanted to get all the current user details in share webscript then you can get it using user Object
example:
Currently i have logged in with admin user
my webscript files
test.get.js
model.user=user;
test.get.html.ftl
${user}
Output ::
{lastName=, userStatus=null, alfUserLoaded=1489745903574,
userStatusTime=null,
alfUserGroups=GROUP_ALFRESCO_ADMINISTRATORS,GROUP_ALFRESCO_MODEL_ADMINISTRATORS,GROUP_ALFRESCO_SEARCH_ADMINISTRATORS,GROUP_EMAIL_CONTRIBUTORS,GROUP_SITE_ADMINISTRATORS,
firstName=Administrator,
userHome=workspace://SpacesStore/7338666a-7a02-4ab6-aa3b-5a46d06074ee,
id=admin, email=admin#alfresco.com}
list of groups in output::
GROUP_ALFRESCO_ADMINISTRATORS,GROUP_ALFRESCO_MODEL_ADMINISTRATORS,GROUP_ALFRESCO_SEARCH_ADMINISTRATORS,GROUP_EMAIL_CONTRIBUTORS,GROUP_SITE_ADMINISTRATORS
By repo webscript
if you wanted to get all the current user details in repo webscript then you can get it by using
example:
Currently i have logged in with admin user
my repo webscript files
test1.get.js
var users = people.getPerson(person.properties.userName);
var groups=people.getContainerGroups(users);
model["groups"] = groups;
test1.get.html.ftl file
<#list groups as g>
${g.name}
</#list>
output::
GROUP_ALFRESCO_ADMINISTRATORS GROUP_ALFRESCO_MODEL_ADMINISTRATORS
GROUP_ALFRESCO_SEARCH_ADMINISTRATORS GROUP_EMAIL_CONTRIBUTORS
GROUP_SITE_ADMINISTRATORS

Drupal 7 Rules: how to send within an e-mail the url of an uploaded attachment (after node change)?

I have a Drupal 7 site with a custom node type with a custom attachment field. After a (kind of this custom) node has been published, I got an e-mail with the help of Rules module. I would like to set up an another rule, which sends me an another e-mail, when somebody edits this node and uploads an attachment. Inside the mail, I want to see the full url to the uploaded file.
After a several test, I'm not able to insert the full path to the uploaded file. The [node:field-attachment:file] doesn't work at all. I'm able to insert (manually) the url where this file resides, but after I can not insert the file name (so even the filename would be enough for me).
So with the [node:field-attachment:file] I got an error: *Fatal error: Call to a member function value() on a non-object in /home/xxx/sites/all/modules/entity/entity_token.tokens.inc on line 297.*
Which is exactly this:
/**
* Gets the token replacement by correctly obeying the options.
*/
function _entity_token_get_token($wrapper, $options) {
if ($wrapper->value() === NULL) {
// Do not provide a replacement if there is no value.
return NULL;
}
With the [node:field-attachment], I'm getting the e-mail, but it contains this: You can download the file from here: Property 0
Which token should I use to get the url (or the filename) of the actually uploaded file when I edit the node?
2 solutions
1 - You can write a simple module that hooks the node submit and handle the URL there and then mail it.
2 - You can create an action in rules module to execute a custom PHP code. There you will get all details of node in $node. You can also send an email using drupal mail API

How do I list all nodes created by user specified in argument using Views in Drupal?

I have been trying to create a page using views that will list down all the nodes authored by a specific user.
The user name will be specified in the path (like - stuff/[user-name] )
Can someone please tell me how to do this using Views.
I am stuck on a dead end
for the views url path specify: stuff/%
in the arguments section add: user -> user: name
Should do it, but I'm not sure if it isn't buggy (see this issue: http://drupal.org/node/744468)
If you use user:id instead of username, you will be fine.

Resources