I'm writing a Dokuwiki plugin to disallow a page from being edited under certain conditions. I've written a handler for ACTION_ACT_PREPROCESS-before to test for the condition. If the handler decides to disallow the edit, it calls msg($errmsg, -1). Then I want for the page the user was browsing to remain displayed.
I've added calls to
$event->preventDefault();
$event->stopPropagation();
return true;
as exemplified in the Discussion plugin, but DW displays an editor window instead.
What should I do to basically abort the command and remain on the current page?
The passed data is writable. You want to switch back to the show action. Eg.
$event->data = 'show';`
Related
I'm trying to track form completions on a page where the form's URL is the same as the confirmation page.
Form Page
Does anybody know if this can be done with Google Tag Manager/Google Analytics please?
Completion page
Simply tracking clicks of the Submit button will result in false positives because sometimes people will not type the security code correctly.
Is there a tracking code of some sort that can be added to the confirmation page, so that each time it loads the count goes up one?
I'm grateful of any help you can provide.
Thanks!
You can use the built-in visibility trigger - e.g. as soon as a link element with the link back to the homepage becomes visible you let the trigger fire. Specifics depend on the CSS id or class for that link (if any, else you'd have to test the click text).
In the visibility trigger you might have to enable "listen for DOM changes" if the confirmation message is loaded per Ajax (as opposed to just have their CSS display property set to 'none'.
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
In my page (which displays a list of information), I call a webapage that gets user information and then calls a webservice and a a stored proc for a database on a page (the stored proc inputs or updates a row of data in the db). WHen I click submit, the page is supposed to completely reload the first page with the new updated data and display it to the user. Well, the data does submit to the db, and service, but my page reloads with the old information for some reason, even though I make a call to the entire action that generated the first page. If I navigate back to the home page and then go to the page in question, the data does appear. Should I be waiting or something to call this action again or something?
I do in fact have
[OutputCache(CacheProfile = "ZeroCacheProfile")]
attribute peppered on my actions and in my web.config. Am I missing something? Are there any catches places where I should be carefull when doing this?
I actually recall the entire action that creates the first page.
If you're returning a view directly from the post it may be using the old data. Try redirecting to the GET action to show the results.
This seems to work right now.
Random number = number Random();
RedirectToAction("Action", "Controller", new { value1 = number.Next(0, 100)});
I will go with it for now.
I am iterating through data and generating parameterized URL's for links (to the same page, but with parameters) on a dashboard app. However, the way I'm doing it requires a page refresh when the user clicks the link.
Generating URL with a StringBuilder
Detailhtml.append("<a href=\"http://" + domain + "&service=" + count +"&day=" + day +"\"><img src=\"/info.jpg\" alt=\"Info\"/>");
Is there a way I can dynamically create GWT buttons, or trigger some javascript to add the parameters without a page refresh?
Any help would be great...
The page will refresh if any part of the URL before the fragment (#) changes. So if you go form foo.com#a to foo.com/?bar=baz#a, a page refresh will be triggered.
The best way to get around this is just to never change anything before the fragment. Change foo.com/?bar=baz to foo.com/#bar=baz (or some variant) and have your GWT app listen for History changes by calling History.addHistoryListener(...).
Then, when you hear a history change, parse the fragment in the URL and update your app accordingly.
Some libraries like gwt-platform provide a wrapper around this functionality and let you describe Places which will get triggered when the fragment updates to match them. If you end up doing a lot of complicated things with the fragment, it would be a good idea to look into places. But if you're just passing a few parameters around, you can get away with just listening for History changes.
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).