Use workflow-send button without using Form Builder/Runner - alfresco

I have a custom form that I wrote manually without using Orbeon Form Builder. I want to save the XML file to Alfresco when the form is submitted. This can be achieved with forms created with Form Builder using the workflow-send button. My question is how to use this button with forms that were writtin manually.

That button and the Alfresco functionality are part of Form Runner and they were not meant to work independently. This is not to say that it's not possible, but you will have to look at the source code and get at least a minimal understanding of it.
The place to start for Alfresco support is alfresco-model.xml. You might be able to start by including this model with XInclude in your own form. Then, that model has at least a dependency on an instance called fr-parameters-instance which provides the form and app name. This is used to read configuration properties.
The second place to look is persistence-model.xml, which is the place which actually uses alfresco-model.xml.

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.

Plone schema extender and custom content types

Is it possible to create an extender of a content type (just adding a couple new fields) that is also accepted by any custom content types using the original type's schema?
I am working on an idea I had for a new feature on PloneFormGen. I originally was going to fork and modify the core product, but figured it would be more acceptable to create a separate add-on that extends PFG. So, I started creating my extender.py and all the necessary bits with it to extend PloneFormGen Form Folder.
However, our company has a custom content type that is an extension of the form folder. That got me thinking instead of just accounting for the standard Form Folder, could I either account for all types using form folder as a base, or provide a control panel where the site admins can specify the types for the extender to apply to?
Or, is there a better way to create our custom types so it not only grabs the core schema, but any extenders for it as well?
To explain in more detail what I am adding, it is not a field, or an action adapter. Basically, it is a new feature called Skip Logic. It provides the ability to hide/display fields based on values of other fields live using jQuery. As opposed to creating custom JS overrides for each form, this allows a content editor, or whoever builds the forms, to control this functionality with no code. There is a JS file that is loaded, and it uses a JSON string to determine the hide/show functionality. I created a form template that can be used to manage this which pulls in all available form fields to choose from.
My idea for implementation was to add two new catalog indexes to the PFG form. One is a boolean which toggles skip logic enabled/disabled. The other is a string which holds the JSON string, which is created by using the form UI (think like a new tab similar to QuickEdit).
If anyone has a better solution for how to implement, I am all ears. Either modifying the core product, or extending it were the only two I could think of.
SchemaExtenders adapt an interface and not the class itself, so for your simple "extending FormFolder" example, you shouldn't need to do anything special. You can even adapt to a marker interface that doesn't do anything useful by itself and make classes implement that interface "externally" (just excerpts from local code here):
class IIllustratableContent(Interface):
"""This content has an image reference it sometimes might use"""
class IllustratableExtender(object):
adapts(IIllustratableContent)
implements(
ISchemaExtender,
IBrowserLayerAwareExtender,
)
# do stuff
and configure.zcml:
<adapter
name="illustratedContent"
factory=".illustratedContent.IllustratableExtender"
provides="archetypes.schemaextender.interfaces.ISchemaExtender"
/>
<five:implements
class="Products.ATContentTypes.content.document.ATDocument"
interface=".illustratedContent.IIllustratableContent"
/> <!-- and for some other classes, too -->

drupal form alter in webform forms

I know that there is possible to use some functions to alter drupal core forms: hook_form_alter().
Can we use this with Drupal forms that are created with the Webform module?
In Drupal 7, you can either use hook_form_alter() or hook_form_<formid>_alter(), which ever you prefer. Just make sure you get the naming and parameters right. Drupal 6 only supports hook_form_alter() however.
When you create these functions, also remember that Drupal may not always pick up on them until you've flushed the cache.
Another important thing to note is that if you want to make changes to the webform fields, you have to make changes in $form['submitted']. I made the mistake of originally trying to edit $form['#node']->webform['components'], which has no effect.
More information can be found here: http://drupal.org/node/1558246
Hope that can help.
You can do it,
you just need the id of the node and then use the id like in
hook_form_<FORMID>_alter()
the FORMID generated is webform_client_form_<NODEID>
where NODEID is the id of the node
so if you have a module named mymodule and a node with id 44 which has a webform
function mymodule_form_webform_client_form_44_alter(&$form, &$form_state) {
// code here;
}
You can use hook_form_alter(), accessing elements via $form['submitted'].
I am not quite sure what you are trying to do, but since webform module creates a content type - webform - you can alter forms created by webform purely through the admin interface - add new inputs and input types, specify whether they are required or not etc.
for example, a "contact us" form can have whatever inputs you want - unlike the core Drupal contact form which IIRC only has an email address and a textarea.
Yes, if for some reason you need to make a change to the webform which you can't do by editing the webform node, then you can use hook_form_alter to change the form as well, as the webform is created by the form api.
That said, do poke around in some of the corners of webform - it comes with a number of options for dynamically filling or changing parts of the form already.

Flex 3: Is It Possible to Use DeepLinking without a ViewStack?

I've got a Flex 3 project.
Does deep linking only work on viewStacks? (My project doesn't have any viewStacks). I'd like to use deeplinking based on what was selected in a comboBox. I'd like the user to be able to bookmark or use the back button based on what was selected in the comboBox.
The comboBox selection determines which data is pulled from the database.
Is this possible? I set-up deeplinking in another project, but it had viewStacks. And all of the deep linking examples that I've seen use viewStacks.
Thank you.
-Laxmidi
Look at the documentation for BrowserManager and deep linking.
You can use Flex deep linking without a component that has it built in, but you need to add the support manually.
You will need to create a BrowserManager instance and have it load the URL when your application loads. You can then use the URL to load the data requested.
You also need to make sure to update the URL using the BrowserManager each time your data changes in a way that you want to have a separate link for.

Resources