Drupal: Any way to detect if a view's path is changed? - drupal

A long shot..I know.
Is it possible to detect if a view's page display path is changed via views UI? Is there some kind of hook that I could use for this?

I'm not sure how the Views UI is implemented, but one idea is to implement hook_form_alter() on the view editing form and detect any changes to the values with a custom submit function.

Maybe you should make the short story long.
You can't to the best of my knowledge hook into changes in a view when they are made.
You can however create the view as a feature and detect any changes made that way by storing the view as code.

Related

cq:include default components in CQ form with server validation

I would like to customize start/end of OOTB CQ5 user form component to start with certain custom components pre-populated when the 'form' component is drag/dropped on to the page.
I currently have an over-laid /apps/foundation/components/form elements with start/end/actions customized. But I am to figure out way to add a component belonging to the FORM group, to the form start.......end to the page whenever a form is added to the page.
I have tried using a <cq:include path= "customComp" resourceType="/pathto/customComponent" /> to the jsp of the form-end component, this adds / shows the custom-component on display but does not perform the server-validations as it is not a separate node between the start and end nodes on the page, but a dynamically added one.
This is basically to enforce/mandate the use of my custom captcha component whenever a form is placed on a page.
thanks in Advance !
If you want to leave the form creation entirely to the author (as intended with OOTB components) there is no easy way to "sneak in" a mandatory captcha component. Even if you managed to put in the captcha component, the author can just delete it or move it out of your paragraph system.
Mingling the captcha with form-end might be possible, but not without reinventing the form-end component pretty much from scratch. I wouldn't want to do that.
I see three options that might be helpful to you:
Implement a jcr EventListener that will fire whenever a form is created or changed. Check the form data structure in jcr and when the mandatory captcha component is missing, add it and commit. This type of behaviour is of course a little shady and may suprise authors - but it's gonna work.
Build a wrapper form component that contains a paragraph system with a fully pre-configured form, including form-start, captcha and form-end. This approach my even save authors a bit of work and nobody will "forget" about the chaptcha easily. Nothing will stop an evil author from explicitly deleting the catpcha component however.
Build an entirely custom form component that does not utilizy any of the OOTB components. In this scenario you have full control over what the author can and cannot do. Most likely you will give up on a lot of flexibility in order to save development time and end up with a mostly static form where the author can edit a few cruicial parts.

Alfresco ajax advanced search

With alfresco advanced search form I would like to perform search by ajax and display the list of search results in the same page (without reloading the page).
Is it possible?
Is there a recommended way to do it?
Thank you in advance
So if I understand you clearly you don't want the page to reload.
Sure that's possible!
Do you start by hacking into the advanced search form or do you create a new page just for this is maybe the first question.
You can do it either way. Probably the latter is easier to maintain and less hacking and you can use a client-site Library of your preference.
If you want to keep the default form you just need to change the following files
advsearch.js, the client-side YUI file which gets run on the form and does the submit
/alfresco/site-webscripts/org/alfresco/components/search/advsearch.get.html.ftl, the html file which has all the div's etc. defined.
So change the client-side library to do the search directly to the repo, take a look at search.js and use the method.
Then define in your template the search results area from search.get.html.ftl.
So basically you're merging these 2 components into 1 big one.

How to display additional form during views bulk operation?

I want to use the Views Bulk Operations (VBO) module to get the possibility to select nodes from a view and then do an action on each of them. However, this action requires additional data to be supplied by user, so what I need is to put another form in between VBO submit and the actual action processing.
I am using the *hook_action_info* hook to define my action. However, as I went through the *hook_action_info* documentation it seems to me that this is not doable using this hook as there is no configuration option to suppress the action bulk ajax update.
Can somebody confirm and/or propose better solution?
In short: User selects nodes from a view using checkboxes, after submitting the form another form appears asking for some more details (having list of nodes as hidden elements in it) and after submitting this one, e-mail is sent per every node. The body of the e-mails is always a combination of node data and the second form data.
Thanks a lot.
Petiar.
So, I decided to forget Views and VBO (no hard feelings) and create my own, custom form. The major thing which actually convinced me that this is not going to be a big issue is the tableselect form element type. I think this has been invoked in Drupal 7 and it is magical. At least worth have a look:
http://api.drupal.org/api/drupal/developer%21topics%21forms_api_reference.html/7#tableselect
Thanks everybody for stopping by willing to help.

Drupal Views: How can I log searches?

Is there a module that allows me to log all the searches made on a view ?
Thanks !
I think you will need to write custom code to achieve that! I'm assuming you know some basics about writing Drupal custom code. You will need to use a hook that gets called before your view is displayed. In the hook you should log whatever information you want e.g. the keyword that was entered in the exposed filter.
Please see http://drupalcontrib.org/api/group/views_hooks/6 for the hooks that are available to you in Views.
I'm guessing you would probably use something like hook_views_pre_render

Drupal views: Allowing users to choose sort criteria on node display

I have some nodes I am displaying in a view. They are displayed as nodes, unformatted. I would like the user to be able to choose from some predefined sort criteria ( via drop down list or similar).
So they could pick recently active, most commented, newest, etc., and re-query for new results.
Its easy with tables because you can make the labels clickable, but I do not know how to have similar functionality with a raw node preview display.
Just a thought, from me to me, and for anyone else who may be trying to do this.
An easy, sleezy option would be to just add another page view for each of the required sorts, and provide a link to these other views in the header of each of the pages.
This could also allow for (easier) linking to the individual sorts, so say if you have a sidebar block displaying recently commented nodes, you could adjust the .tpl.php of the block to have the title link to the view displaying the full set of recently commented nodes.
also im pretty sure there should be a way to do this with arguments, but i dont know how
Views 3 supports exposing sort order (just like you can expose filters)
Select the sort order (e.g. add sort by node creation date, then click on the settings for that), you should be able to expose the sort order to the end user. This is just like clicking on the settings for a filter and then choosing to expose it.
Standard views isn't going to support this, so IMO you're best off implementing a custom solution using just a plain old view and this jQuery plugin. You can either do this at the theme layer (the same way as any other JS in a theme) or a custom module (via drupal_add_js() to add the plugin and your bit of custom code). Either way will work, although the custom module has the obvious benefit of being theme independent (and thus more portable).
If you go the custom module route, please consider releasing it as a contrib module on http://drupal.org.

Resources