Detecting custom user actions in alfresco - alfresco

Is it possible to identify which custom action button has the user clicked on an Alfresco document library page? I would like to recognize this in java class and do some action or condition.

Your question makes me think about this tutorial : https://docs.alfresco.com/6.0/tasks/dev-extensions-share-tutorials-add-action-doclib.html
You should be able to override existing actions and do whatever you like.

Related

How add verifications before update dados of an item using framework symfony?

I need to check information when updating an item, to know if saving is allowed or not. This must be done in the backend after the user have clicked on 'UPDATE' button. I'm using Symfony and the existing methods in CRUDController. Is there any method I can add in Controller or Entity so I can add code that does this check before saving?
You have multiple ways to set validation with Symfony.
If I understand well your question, you maybe need to look at the callbacks
https://symfony.com/doc/current/reference/constraints/Callback.html
The purpose is to create custom validation with dedicated functions (like only saving an item if it meets some requirement.)

Track login event with google analytics 4

There's already a question similar to mine, but it doesn't tackle my problem.
I'm trying to set the google tag manager to track login events in my website.
But I can't identify the action related to the login event on the tag assistant.
Here is a print of the actions when I login:
None seem to be strictly related to the login event.
I tried to track some of these actions, but they occur in many other actions.
(thus, I collect data I don't need, as if they were login events)
What of these actions is related to the login event?
How can I precisely identify the login action ?
You can automatically implement data layer events on form submissions with ListenLayer.com. In this case, you will likely need to use their Custom Forms Listener.
You have to create an account, place their script on your website, enable the Custom Forms listener and it's features and then identify your forms under the Listener's event settings. You would do this by writing a simple rule to match the CSS class, ID, or form Name element etc. (these things would exist in the <form> tag.
Here you can see I have set some rules to identify a form like this
<form class="form-container"> or <form class="listenlayer">
Publish and test on your website.
Now, when the form is submitted, the Listener will automatically push data into the data layer identifying the form and the action.
From there you would use GTM to register and read the data layer activity. I assume you know how to do that since you have the GTM debug view going, but basically you'll get a new message on the left side with an event name and you can create a Custom Event trigger in GTM and also register Data Layer Variables to use in your trigger. It's all down hill from there!
With tracking you are usually left out with two approaches :
Either you ask your developer to implement a dataLayer event on a specific action / interaction so that you can then use this as a "custom event" trigger in GTM. For instance, here, on the login success page, after the GTM snippet, the developer could invoke the following code:
dataLayer.push({ event: 'login' })
That will allow you to use 'login' as your event name in GTM custom event trigger.
As you began doing, if your developer cannot implement it, you may try to identify variables that will help you isolate that specific action / page. For instance here, maybe does your successful login page has a specific URL you could use in a page view event, targeting that specific page path.

How to save a view automatically in MVC

We have some views for an mvc application.we want to give save functionality on a particular view which will caputre everything from that view and save it in a folder on server eithier in pdf or html file type.
Save functionality should be called when user clicks on button on view.How can we achieve this.
Thanks in Advance.
First your view must be linked to your data model.
To manage the sync between both either you use binding mechanism if your framework supports it or you implement a observer/observable pattern.
Next you have to write an event handler to respond to the save event triggered by the save button.
This event handler must call the save functionality.
To be more precise you should tell which language/framework you are using.

Custom message display page?

In an Asp.Net Mvc 4 site, there may be various messages needed be shown to end users (e.g. "Thank you. The document has been submitted.", "The item and its depended items have been deleted.", "Cannot find the row with ID of xxx.", "Cannot delete this row because it's xxx is depended on it.", ... etc).
How to (and what's the best approach) define a generic page accept a message and display it? The page should be able to be used by all the controllers in the site.
Added:
How about create a ShowMessage controller and view which accept Query string/ViewData/TempData and display it. Other controllers redirect the page if needed. Is this a good solution?
I would also recommend this:
toastr
It was created by John Papa, who frequents SO on a fairly regular basis.
You may want to store message in ViewBag/ViewData or TempData and render it to your particular view. You can create extension method in baseController class and hence it will be accessible from all the controller. Check out below blog post that discusses the same.
http://blogs.taiga.nl/martijn/2011/05/03/keep-your-users-informed-with-asp-net-mvc/
You could use a client side notification plugin such as jGrowl or noty.

Where to intercept resolution of controller/view in ASP.Net MVC for customizations?

I am trying to figure out where the appropriate place is to intercept the resolution of what view + controller is being called in ASP.Net MVC 2. I have a situation where I have a controller and a corresponding set of views. I also have the possibility of a customized version of both the controller and N of the views sitting in the project (or we may use something like Portable Views from the MvcContrib project). If the customized version of the controller or view(s) exists at run time, and the user satisfies certain criteria, I need to call the customized controller and use the appropriate customized view. At design/compile time we don't know what customizations may be in place.
My first run at this was by using a custom controller factory that returns a custom controller if it exists. However, this controller is "wired up" to the standard view, and I cannot figure out how to return the customized view if it also exists.
To complicate matters, there may be no customized controller but customized views, and visa-versa.
Sounds like you're on the right track. You've got custom controller selection logic in place, but you need to also have custom View selection logic.
You can override and extend the default ViewEngine to plug into your app that uses your own logic to look for the view locations. Here's a good walkthrough of a simple ViewEngine that does exactly that.

Resources