Joomla component "attachments" allow html in input - joomla

this question might be a bit special. I am using this Joomla 2.5 extensions to give authors the abilty to add Attachments to articles: Joomla Attachments
The extension renders an input field called "description" in a backend form to insert an file description for the provided file. Unfortunately it´s not taking HTML tags which I need. By saving the form it seems a strip_tags() or preg_replace() or something similar cleans the input. I combed through the code of the attachments extension but couldn´t find a place where the input is cleaned or saved.
To hopefully stay in the Question + Answer rule of Stackoverflow:
Is there a class which extensions inherit from the Joomla Core to save form data to a DB-table ( which also could be responsible to clean and validate user input )?
thanks for any idea,
tony

You should see how the field is defined first:
1. Form definition
look into the
administrator/component/yourcomponent/models/forms/somename.xml
there you could find a form definition, if so it will also specify the field type: depending on the type there are several available filters; for example the default textarea will strip html, and you need to set
filter="raw"
in order to enable it. see http://docs.joomla.org/Standard_form_field_and_parameter_types for a list of fields, click and you can find the available format options.
2. model
If the model inherits from JModelAdmin or JModelForm or other JModel* it will automatically handle binding of the forms' data to the database, look for the Save function which should receive the form $data.
3. more
There are at least another dozen possibilities. If the above didn't help, try finding the form: possibly you could find it just by looking at the markup. Once you have the form, check the following fields:
option
task
view
This should help you find the php code that is invoked based on the form:
if view is set, maybe in ./views/someview/view.html.php you could find the saving logic.
if task is set, look for a function with the same name in ./controller.php
if task contains a ".", look for the controller in the ./controllers/ folder.
if option is not the name of your component, your component is sending the data to another component for saving, and most likely set a return-url

Related

Adding custom data based attributes based on Response object

Halo ! I'm trying to implement dropzonejs in a very specific way. Actually I follow the standard implementation described on the official page. Everything works perfectly.
But I'm willing to attach the server's generated URI for each uploaded file directly when uploaded : when uploading it's creating a database entry with some stuff like a page uri with title etc. This mean that the server would return as a response the id of the database saved file in order to attach the href attribute with its value to the the element in front.
This is quite ok to do this when only one file is uploaded, but it becomes trickier when bulk uploading.
So maybe I didn't understand the documentation well (and I'm quite sure I didn't), but is there any way to add custom data-dz-like attributes based on my server's response ? I'd like something like data-dz-url where the url points to a database entity (not the file itself).
Or if not if there is an "easy way" to handle this.
Thanks a lot
Here is the answer :
myDropzone.on('success', (file, response) => {
file.previewElement.href = "/admin/media/"+response.id+"/show/"
})
file is reference to the current uploaded element. It's possible to extend it's html attributes through previewElement. Setting the data-type attribute in the template before, then assigning it the right value works aswell.
Hope this will help some.

Expression Engine Channels in CodeIgniter?

I need to build an application wherein the admin must be able to define forms for data entry. The data to be entered is unknown to me. But the system will need to be able to support all the possible form fields (minus hidden fields, I suppose). So text areas, text fields, radios (with ability to specify what the options are), checkboxes, etc. Also, it needs to be able to support line item entries (similar to EE’s Matrix plugin).
Obviously, I don’t want to try to build this from the ground up. Are there any libraries I can use in CI to make life easier for me?
If none exist, what are some database design patterns I should consider for such a problem?
The best database-design for this is the Entity-Attribute-Value Model. For use with a FORM, essentially your form is the ENTITY, the Attribute will have a type (used for deciding how input will be captured, and data interpreted). Make sure that you index properly.
Remember that you'll only need to data to change the form, don't read from this model everytime you need to show a form. Store a flat file (.json is handy) of the finished form and read that when displaying the form.

Adding Extra fields on Joomla Registration Form

How to add extra fields in Joomla2.5 registration form? I am using profile plugin but i also want to change the order of the fields. Any Suggestion?
Copy the profile plugin and change it to do what you want, then install it and unpublish the old one.
You can add additional fields to the registration form by changing the database and a core component file.
First of all take a look of components\com_users\models\forms directory and there is a XML file called registration.xml. This is the file joomla creates the registration form fields. I hope you can understand this file and add what ever the necessary fields you want.
And after that check out your data base table called #__users and add the extra fields you want. (ex: if you want to add Telephone number add filed calld tp_no). And make sure to use the same name that you use in XML file "field name" for the database table column as well.
I imagine you are looking for something like this?
http://extensions.joomla.org/extensions/access-a-security/site-access/authentication/14303
Probably the safest solution in the short and long term. I've not used it but it looks like it does what you want and from an interface rather than changing hard code.
There is manual how do it. Turn on subtitles visit http://www.youtube.com/watch?v=a6xsKLiXF40

Joomla File Handling - Variable name not passed

I made a component with a "file" field type, but the content of that single field are not passed at all, I was under the impression it should save the file name as text at least, if I change the field type to "text" the name saves so I know everything else is functioning. All the other fields are being passed. What am I doing wrong?
File handling aside, I just want it to save the name.
A detailed explanation would be appreciated, or even better, can I get someone who knows what he's doing re-write this component using MVC so I can compare.
Thanks
Can't really help with what you have so far as you haven't provided any code, however our website have recently made a small simple component for Joomla 2.5 for file uploading using the SWFUpload framework, should you want to use it.
http://joomjunk.co.uk/products/component-home/swfupload.html

Posting a collection to MVC3 from Plupload

I've got a documents upload page in an MVC3 application that lets the user upload documents to be stored in a database and associated with a parent entity in the database. There are also some permissions that the user can customize to stipulate who can access the document.
I've implemented my document upload functionality with Plupload, The behavior that it's working with is that essentially it will take a queue of files, and upload them for me to a specific action dedicated to recieving this information, and when they are posted each file is given a unique name (something like p16kearti61rf31qb61fogjm2127i3.jpg for example.)
Once all of the files have been uploaded in plupload, the parent form is submitted with the information about the files plupload just uploaded as well as some other data for the documents like the Primary Key of the object they are to be associated with, and the groups that have been checked off for it's permissions aspect. Now this works fine except that I can't find a strongly typed object structure that MVC will bind my data to so that I can work with the posted back data. Here's an idea of what is in my Request.Form collection, what I'm looking for is some insight on how to best capture this information in my action. I have complete control over the naming of the controls for the document permissions, but the plupload controls are built in and I'd don't know if I can change them.
__RequestVerificationToken: "...XDsBA5oZA9Ku2oPPdyyi2J+DbvoKRY9HJ2...etc"
ownerId: "CCEE2ADF-633D-4D55-90EE-2829D352BEEB"
uploader_0_tmpname: "p16kearti61rf31qb61fogjm2127i3.jpg"
uploader_0_name: "picture1.jpg"
uploader_0_status: "done"
uploader_1_tmpname: "p16kearti61kqu8tsmja67911v44.jpg"
uploader_1_name: "picture2.jpg"
uploader_1_status: "done"
uploader_2_tmpname: "p16kebp785gci1e291i543cc1c8k4.jpg"
uploader_2_name: "picture3.jpg"
uploader_2_status: "done"
uploader_count: "3"
documentGroups[B8C97C5C-B1B8-43C2-89F1-B1DF353AF677]: "false"
documentGroups[A2C8331C-7068-4611-82BF-6F0C61C8BA7D]: "false"
documentGroups[6DCBF4A8-B863-49E6-AAE9-2A0E372FF622]: "true"
documentGroups[05C04E05-D7A8-45D6-8138-2FA36F0A5922]: "false"
documentGroups[3E2F2B1B-FAAA-420A-B9A1-F223ADF66AF0]: "true"
Any suggestions on how to write my action method? I was hoping for something like this but I can't get it to work.
public ActionResult Upload(Guid ownerId, IList<PluploadFile> uploader, IList<bool> documentGroups)
Just in case someone else was looking for an update on this (and since I got no response to my question what-so-ever), I ended up splitting my post into two; one handled by plUpload which I use to save the file(s) to a temp folder using the unique names pased in to the Action from plUpload (such as p16kearti61rf31qb61fogjm2127i3.jpg), and the other when I post the wrapping form which holds the information I need and the unique names plupload has as well as some fields indicating the status result of the original upload. The problem is that because it's two posts I now have to look at maintaining the contents of my temp folder in case the user uploads documents but doesn't submit the wrapping form. Not the solution I wanted but I can't an alternative working as expected.

Resources