I am trying to customize the simple contact form with files example. The form currently has 2 input fields with the same name that gets sent over as an array of files.
Is there some sample code to use one input field that accepts multiple files and uploads them?
There is no example to do that, and the current endpoint wouldn't do this by default, so you would have to make some changes to the endpoint to get this to work. For someone who knows c# it shouldn't be difficult, but if that's not your forte, I would go for multiple fields just because you will be able to get that to work.
Related
I have recently started developing with aikau in alfresco share.
I want to achieve a functionality wherein I can export search results to a CSV file.
For that, I can change the back-end repository web script to return csv data.
Now, At alfresco share end - I was successfully able to show the export link by adding a new widget to FCTSRCH_TOP_MENU_BAR. I used alfresco/renderers/PropertyLink to display this link. Now, the missing part for me is - how can I invoke the search web script passing additional param format=csv and alongwith that pass all the query parameters used to retrieve the results.
I am stuck with that. If I use the publishTopic as ALF_CRUD_GET_ALL and provide the URL there then it invokes the sample web script (I created to return sample csv response) and returns the response. However, the csv doesn't come as downloadable response. I am stuck here in order to how to achieve export csv functionality for search results.
It would be great if any of you can help me here and provide your guidance/suggestions.
This blog post provides an example on how you can custom the search page in Share. Although it specifically addresses changing the search queries the basic extension approach is more or less that same in that you will want to change the data that is used to send an XHR request. I think that the major difference here is that you may need to do more in-depth updates to the service - in particular with regards to the switch statement that is used to build the advanced search query object.
If you have extended or replaced the default search REST API then I would expect that you will need to call the same URL, but if you have provided an entirely new REST API to return the CSV data then you'll also need to change the URL that is used by the service.
In terms of providing a link for downloading the content we have previously implemented something in the DragAndDropModelCreationService (see the generateDownload function) but this only works with Chrome due to security limitations and the generation of files to download.
Your best bet may be temporarily store the CSV content on the repository in a hidden location and then use the standard download links to allow it to be downloaded - this would be more complex but would provide better cross browser support. Something similar is done for the "Download as ZIP" action.
OK, with the extra information provided I would do the following...
The information on the process of adding widgets to the search page are quite well detailed here (although you're not adding a view, you can follow the approach to add a new PropertyLink after the widget with the id "FCTSRCH_RESULTS_COUNT_LABEL").
The approach I would take would be to include an additional custom service on the page that subscribes to the "ALF_RETRIEVE_DOCUMENTS_REQUEST_SUCCESS" topic (which is published on a completed search). It should save the the search response in a variable in preparation for users clicking on the PropertyLink.
This custom service should also subscribe to a topic that is published by the PropertyLink (called say "DOWNLOAD_CSV"). This custom service could then generate a file download using the approach described in my previous answer using the CSV data that will have been provided in the payload. As I said though, this may only work with some browsers due to security reasons.
If your custom search WebScript were able to store the CSV data as a node on the Repository then you could just provide a the NodeRef of the CSV data in the search response and the PropertyLink could just publish the "ALF_DOWNLOAD" topic for the DocumentService to handle the download.
Trying to generate a file to download on the client side is going to be an issue for most browsers I think.
My first post here, I have always found the help I needed in previously asked questions ,thanks, but I'm stumped this time so here goes.
I'm still a novice relatively speaking to people on here, but I have developed a joomla 2.5 component and I need to store data in AES encrypted format.
Ok so for saving the data, I've done this by overriding the prepareTable function in the model when saving the data, and that works very well.
But where is the best place to decrypt the data when loading it back into the user forms?
For the list views I can just call my own decrypt function in the view or even the layout and that's ok too.
But when I go to actually edit an individual record, using the standard joomla myform.xml the data is loaded into the formfields unencrypted.
I need to override some built in part of Joomla so that I can decrypt the data before it is populated into the form fields.
Can anyone please advise what function I can override to change the data before it is displayed in the form.
Maybe I've missed something obvious but what I am looking for is the same as prepareTable but for loading data, rather than saving it.
Thanks in advance for any help.
Solved, with Elin's suggestion.
When saving data I encrypt the data using a php function in the override of prepareTable.
Then for reading the data back into the form I extend the JFormField to JFormFieldAes adding the decrypt logic in the getInput function.
For custom Select form fields I use the same logic but put it in the getOptions function.
I now have the ability to encrypt any fields I choose without having to use any database encryption. It was quick and easy in the end.
I just want to make a page where a moderator may edit a list of key/value corresponding to some string displayed on the site.
I really don't find module more user friendly than the module variable.
In addition, create a module just for that seems a little barbaric given the simplicity of the application.
Do you know any module able to do that on drupal 7 ?
EDIT : I finally created directly a module based on the variable module to manage a list of variable. Slightly longer than something ready but quite effective.
For the record. I would go with the Data module.
I would like to create a data entry form in Drupal 7 that is similar to Filemaker's List View. List View is a view that contains many records on a page. When Submit button is clicked, data entered in the fields will be assigned to the individual records.
For example, I have a list of students' names and a column field of grade type. The student's name will be created from Drupal View's filtering, but the grade field will be empty waiting for me to key in.
What is the proper Drupal's module that can enable this functionality? Or what can I do to create this functionality.
This approach is closer to your original request, im testing this out now and I think it should more than do the trick, much more interestingly too.
http://drupal.org/project/slickgrid
Edit:
I highly recommend trying this its awesome!!
A couple quick tips
Be sure to also install http://drupal.org/project/title so you can reset the title (make it a field), Basically with this editor you can only edit actual fields, so same goes for location module, you'll need to use the field option rather than node option.
One possible downer, at least for my site, it appears the drupal module does not support jquery 1.7 which my site uses, so a few buttons etc don't work as expected, also the drupal module does not support the latest slickgrid release either. I'd like to look into fixing that but I dont have the time just yet, possibly someone will before long. If jquery 1.7 is not required for your site then none of that will be a problem for you.
I just figured how to do something similar, although I went about it a different way then I think would be the most desirable, at any rate what I did works perfectly for me at the moment.
What I did...
Used a google docs spreadsheet for data entry, exported a CSV file, then used Feeds module to Import and Map it to my desired content type. I was even able to get location, taxonomy & image fields to map.
Modules & Stuff Used...
Feeds http://drupal.org/project/feeds which also includes Feeds
Importer, you'll want to read through all the instructions to be sure
you understand the import methodology, I could never explain it all
here!
Feeds Tamper http://drupal.org/project/feeds_tamper , I used this to
explode the cell which had a | separated | list of taxonomy terms (dont use comma), the
nice side effect is if the term doesn't exist it creates it for you!
Spreadsheet - Personally I created a Google Docs Spreadsheet, any type
will do. This spreadsheet has every field you want to map to fields
in your content type.
"More Better"
Currently I am on the hunt for a simple backend UI way to do this, but this is what I've settled on for now. I just couldn't imagine hand entering hundreds of nodes, page submit after page submit! I will post back if I figure another way to do it. Good luck!
I have just started with
https://www.drupal.org/project/editableviews
which enables the creation of views where all the fields are editable, including when no data exists in the related entity. At the first url is also documentation.
There a screencast which shows more
https://www.youtube.com/watch?v=g_D4z4Bw6iw
I'm currently pondering my options for the following problem:
I have a (relatively) simple but often changing configuration file for my application which I want users to be able to edit and change without have to "understand" xml. I do not want them to have know anything about encoding or understand that they have to close every node they opened. Here is an example of a section in the configuration file (defining facets for some arbitrary search engine):
<section name="facets">
<facet type="format" label="Format" max="4"/>
<facet type="marcfields" Label="Author" max="5">
<mfield name="df100" subfields="abcdjq"/>
</facet>
<facet type="language" max="4"/>
<facet type="pubdate" max="6" submax="8"/>
</section>
Editing this section, user should should be able to re-order the facets, delete facets, configure existing facets or add new ones. So far so good, but the xml is not completely free form and comes with a couple of restriction/structure:
Facets come from a pre-defined set of
types (forkamt, marcields, language &
pubdate above), so when people choose
to add a new one, they need to be
able to choose a type.
Each facet type comes with "parameters" - some common for all types some specific. For example in the above XML, one can edit the label & max attribute for each facet. For the "marcfields"facet, one can add sub-nodes (with two editable attributes). For the"pubdate" facet, one can edit the submax attribute.
I am looking for a way to take my configuration file and make it editable in ASP.NET web environment. All of this would be fine to program, but I except the configuration file to change often and I don't want to have to recode my site for every change. Therefore I'm looking for an open source frame work which can:
Take an XML file with a known structure and constraint (via an XML schema or anything else).
Generate a ASP.NET based editing environment , allowing people to safely manipulate the xml file.
Be very friendly where people make mistakes.
Any suggestions?
How about creating an HTML form using an XSL Transform of the XML file? This way, you can surface the parameters into form fields. Using JQuery, you would even be able to offer re-ordering and the like.
A framework may be a little heavy for this task.