How can I call a cstudio action from a webpage in Crafter - content-management-system

I've created a webpage in Crafter CMS (version 2.5.2) whose purpose is to help edit a Crafter Component. I'm doing this in my page instead of in the CStudio Panel because I want to search/filter for specific components (I have 1000s). I'm editing the components using Crafter's In Context Editing capabilities, but I want to be able to call actions such as Create New, Delete, Approve & Publish, History, etc on a selected component. Is there any way I can do that from my web page along with the UI (e.g. Create New pops up normal Create New modal dialog, History pops up history dialog, etc.).

Crafter CMS uses a message pump between the preview pane and the studio application to inform the application of actions taken "in-context." within the preview pane. Messages (operations with metadata) are pumped by the system automatically between the two contexts (the studio application and the preview pane.)
"Edit" is currently a valid message/op.
"Delete" is currently a valid message/op.
However in 2.5.2 there is no "New" message/op.
In order to fire a New Op message you would need to register the message and build the handler (all Javascript) that fires the appropriate javascript APIs for the app. To fire a New operation you only NEED a path to where the content will be created in the message as metadata. The App already has code to look up permissions and check if which content types are available at that path.
Javascript files of interest:
Fire the message
/static-assets/components/scripts/guest.js
Handle the message
/static-assets/components/scripts/host.js
Declare the valid messages
/static-assets/components/scripts/crafter.js

Related

Sendgrid not updating Dynamic templates

Send grid is not letting me update old dynamic template and also if i
create new Dynamic template, i am still facing this error
This is the error i am facing:
Your dynamic template version could not be updated.
If you open up the console in Developer Tools (F12 if you're using Google Chrome), try to see if it's a 401 Unauthorized error code. If this is the case, it just means that you need to reauthorize by logging in again.
To do this without losing the work on your template, just open a new tab in the same window, login again, and go back to the tab with your template id. If you click save, it should now allow you to save.

Needing to have a form in every instance of a content type that can be submitted once per node - Drupal 7

So here's the situation and I cannot figure out how to accomplish it.
I have a content type called "Alert". Each instance of this content type needs to have a webform (really just a submit button with hidden fields), that users click to acknowledge they have read and understand the alert. Ideally once submitted, the form should be replaced with a message along the lines of "You have marked this alert as read."
I do have a webform created (displaying as a block to be able to place within the variant page set up for the Alert type) and can get it to appear on each instance, but users can submit multiple times on each alert (submissions are set to unlimited as if i set it to 1 submission per user, the form does not render after the first submission on any alert). Additionally, once they click on one instance of the form, every additional instance will result in a message stating they have already submitted the form.
So I really have two issues. First, and most importanlty, allow a single submission per node (without the "already submitted" notice). Second, not required but would be nice, once it has been submitted for a specific node, the form no longer renders on that node for that particular user. Anyone have any ideas on the best way to accomplish these two aspects?
I'm running on Drupal 7.56, using the AT_Panels_Everywhere theme, Webform module Version: 7.x-4.15.
In drupal 7, with webform 7.x-4.0, you can enable webforms within a content type. To do so:
Go to Structure > Content Types
[Respective content type] > Edit
In the bottom left section, find the Webforms Tab and choose Enable webforms for this content type.
Based on your use case, I'd recommend enabling that and installing the node clone module. Then you can make one alert node, setup the webform, limited to one submission per user and allow content managers to clone content. That node can serve as a template.

Not able to unlock the AEM page in AEM6.2 for custom template

I am not able to unlock the page in touch UI editor. Created simple template and page component. There is no code inside the jsp . I am able to lock the page but when trying to unlock page, getting JS in console(please see attached scree shot). It is working fine with geometric template,
Step to produce.
create simple template and component as below
create a page out of this template
open the in touch ui mode.
lock the page
Now try to unlock the below. see the console by pressing f12. below error is displaying.
Try to see first the error.log located in your environment, for instance: AUTHOR_INSTANCE_DIR/crx-quickstart/logs/error.log.
This may provide more information about the issue. You should validate that you are logged in as an admin or at least you are the owner of lock, you can do this by going to the CRXDE Lite, and in the jcr:content node of your page you have to see jcr:lockOwner property with your username.

How to duplicate a application window in GWT/GXT?

we have a CRM-like application written in GWT/GXT with help of our library which wraps some GXT widgets like ComboBox or Grid from GXT to simplify interaction with relational database. When the application starts a user have to log in and after successfully login the user can see main horizontal menu and some welcome information. If the user want to do something (e. g. to find a customer) he/she has to click somewhere in the menu and a new GXT modal window appears. Now we want to give the user a possibility to open a new session (e. g. to handle a second customer and visually compare customer's data with the first customer) in a new browser window.
How to do it?
Best Regards,
Jacek
The best way I know to comunicate between browser tabs is to use HTML 5 localStorage. Here is a good tutorial. In GWT you can use gwt-storage to easily manipulate the localStorage.
If you want to open a new Window or browsertab you will need to solve two problems:
You will need to specify the session. This can be done by simply create some kind of session token-cookie. This should be flagged with http-only for security reasons). New windows will send the same cookie (and the user is logged in)
You need to specify the item, you want to show. This can be done by using the history API and store the token in the URL

Looking for input on GWT / MVP action w/o browser history change

I am trying to develop a GWT app with the MVP pattern. So far so good except for one specific case of actions: actions that do not change the url (no browser history change).
In the GWT MVP pattern, events are sent from presenters, the an app controller catches them and update the browser history. If the history has changed then the view updates.
** MVP with history change (Works well)**
Current URL is /list
User clicks on contactdelete button.
Fire DeleteContactAction event.
App controller catches, change history to 'delete'
onValueChange is called
if (token.equals("delete"))
delete contact screen, then delete contact
Fire ContactDeletedEvent
app controller catches and change the history to list
onValueChange is called: contact list refreshes
GWT MVP pattern for dialog box w/o history changes
** Issue ** - I use a dialog box and I don't want to change the browser history, so here is the problem:
Current URL is /list
User clicks on contactdelete button.
Contact is deleted
Fire ContactDeletedEvent.
App controller catches, change history to 'list'
**onValueChange is NOT called** because url is already /list and there is no change
# problem: contact list does not refresh
Question: does anyone know a pattern to implement this in the context of MVP?
Any help / idea appreciated.
Are you using some framework (aside from GWT) that automatically does history changes?
Regular GWT/MVP doesn't require a history change to be made, and in fact usually it's up to the app to update the history itself.
If you want to update the app's state without a history change, you can use an EventBus to publish events that other elements of the app can subscribe to, to update the app's state without a history change.
Basically, you will have to create your own PlaceHistoryHandler. Your custom PlaceHistoryHandler will ignore a particular type of PlaceChangeEvent (i.e. it will not update its Historian).