We already have a field of type "image" for JForm, but that field is
mostly broken. I'd like you to change this field to use the modal window
that you know from the image button below the normal editor windows to
select the image that you want.
If you have questions, just reply to this mail and I'll try to answer
them as soon as possible. If you are done with your work, either commit
it to a branch in the Joomla SVN or create a patch and submit it to the
Joomla Feature Tracker. If your code adheres to our coding standards,
I'll commit the patch to the trunk.
Thanks for your help.
Hannes
So I'm learning JForm now (it's still new for me).
Is this a known issue?
Does somebody work on this now? May I dive into com_media's image and
imagelist views if not?
Hannes
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
> We know about this issue and the idea was, that someone like you does
> exactly that and dive into the code, repairing this. ;-) I would be
> happy if you could take a look.
Ok. I've fixed com_media's popup window issue:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=19877
Here is my changelog:
- administrator/components/com_media/views/images/view.html.php (strings
30-31): Old-style use of JHTML::script and JHTML::style methods.
- administrator/components/com_media/views/imageslist/view.html.php
(strings 30-31): Old-style use of JHTML::style method.
- media/media/js/popup-imagemanager.js (string 16): Was " var
ImageManager = this.MediaManager" instead of "var ImageManager =
this.ImageManager" (possibly just a typo).
- media/media/js/popup-imagemanager.js (strings 137): MooTools does not
have "getValue" method now
- media/media/js/popup-imagemanager.js (string 89-93): MooTools does not
have "getValue" method now
- administrator/components/com_media/views/images/tmpl/default.php
(string 28): Now modal window shoud be closed with
"window.parent.SqueezeBox.close()"
So now I am able to work on image form field.
I have a question about this:
In the fields folder we can see "media.php" and "mediamanager.php". For
what are they?
Should I fix one of them (they all are broken) or provide a new file
("image.php)"?
Hannes
> Hi Artyom,
> sorry for not mentioning this here on the list, but after Ercan
> mentioned that he wanted to override the script/style/image functions, I
> changed all the occurences around the other way and made it
> JHTML::_('image') instead of JHTML::image().
> The idea is, that you fix the media/mediamanager fields and then you can
> extend those to only show images in an image field. :-)
Thanks for commiting com_media fix.
I am working on textmodal field now (in my spare time): "Generic form
field class to get values from another application's modal window and put
them into text input field". It will be ready soon.
Hannes
> Hi Artyom,
> could you give a status update on this change?
Hello.
The work on this patchwork have lead me to creation of generic modal field
type.
Here is the first version of it:
http://groups.google.com/group/joomla-dev-cms/browse_thread/thread/7654d772be989c7c/79ef873184bd293
This is the realization of the image field with that class (you can also
download this class by the link in the above thread):
class JFormFieldModalImage extends JFormFieldModal
{
protected $link =
'index.php?option=com_media&view=images&tmpl=component&e_name={FIELD_ID}';
static public $jsProxyFuncName = 'jInsertEditorText';
static public $jsProxyFuncArgs = array('value', 'id');
static protected function getJsProxyFunc($field) {
$script = <<<EOF
// Proxy function for the image field objects.
// Com_media should be rewriten to support field objects.
{$field->jsTypeStorageName}[id].insert(value);
EOF;
return $script;
}
static protected function getJsPreInsType() {
$script = <<<EOF
imgTag = this.value;
re = /src=['"]([^'"]+)['"]/;
re.test(imgTag);
this.value = RegExp.$1;
EOF;
return $script;
}
}
So we already can use it, but...
Now I work on refactoring JFormFieldModal to support different SqueezeBox
handlers (current version supports only "iframe" handler). I will finish
today or tomorrow.
With this class we will be able to easily create fields that receive their
values from modal windows.
Also I planning to work on issues with modal windows in Joomla! further.
Of course I don't know is somebody needs my intentions. I just think that
this is the right way to solve the issues with modal windows.
So some feedback will be a great help.
Hannes
> Thank you for your work and I really appreciate it. I will look into it
> right away. If you can make the more flexible squeezebox field, that
> would be cool, too.
Hello, Hannes.
I've finished refactoring of the first version of the JFormFieldModal. You
can find the results here:
http://zool.in.ua/shooting_range/jformfieldmodal2/jformfieldmodal2.tar.gz
So, when you will have spare time, take a look on it, please.
Of course some improvements to the classes are possible in the feature.
But I think that the classes are stable enough to use them as a base for
another form fields which use modal windows.
Also for those who don't want to bother with files and just wish take a
quick look on the new classes, here there is documentation for them (with
highlighted source):
http://zool.in.ua/shooting_range/jformfieldmodal2/doc/index.html
Thanks for your time!
--
Artyom