field types...

Si vous avez une idée pour une future fonctionnalité
Specht
Messages : 9
Enregistré le : mer. 17 févr. 2010 20:14

field types...

Message par Specht »

Hey Steevo,

is it possible to have a field-typ for eMail and Weblink
when I'm using Typ simple field then I can't use it as Link, whe I use it as Text its to big and I have to create each link manually...

thanks in advance

Avatar du membre
steevo
Administrateur du site
Messages : 330
Enregistré le : jeu. 17 déc. 2009 22:59
Contact :

Re: field types...

Message par steevo »

I think that the interest in to have link on email and weblink.

If that's it, i would prefer to not add others field types, but i can do something : if you select a simple field and fill it with email address, i can recognize it and create link on it without specifying it's and email, and the same thing for weblinks. I think it's simpler.
What do you about that?

Specht
Messages : 9
Enregistré le : mer. 17 févr. 2010 20:14

Re: field types...

Message par Specht »

steevo a écrit :I think that the interest in to have link on email and weblink.

If that's it, i would prefer to not add others field types, but i can do something : if you select a simple field and fill it with email address, i can recognize it and create link on it without specifying it's and email, and the same thing for weblinks. I think it's simpler.
What do you about that?
Yes, exactly and Yes I think it's better like you proposed.
If then the Jommla funktion to hide mailadresses for Spamrobots will also work, then it's more then perfect ;-)
thanks in advance

Specht
Messages : 9
Enregistré le : mer. 17 févr. 2010 20:14

Re: field types...

Message par Specht »

Hey Steevo,

:idea: I found a way for email / weblinks (string "www." required in the data)
and placed it within the ../item/view.html.php

This modification is able to recognize within a simple Line field
email-adresses, creates a mailto: link and using email-cloake to hide it for robots...
Weblinks will be recognized in a simple line field, if they are containing
"www." within the string, if required "http://" will be added and a hyperlink
created...

maybe a little bit quick and dirty solution as far as my php knowllege is verry basic...
you#ll find the modifications in function createFieldDescription line 248-275:

Code : Tout sélectionner

// champ simple ligne
		// function for check if data is email-adress
		if ( $type == '1' )
		{  if(!empty($this->item->$name_field) && JMailHelper::isEmailAddress($this->item->$name_field)) 
       {
				    $this->item->$name_field = JHTML::_('email.cloak', $this->item->$name_field);
				    return $this->item->$name_field;
			 } 
       else 
       {
				     // function to check if an url is an valid url
            if(!empty($this->item->$name_field) && preg_match("=www.=", $this->item->$name_field))
                  {$url = $this->item->$name_field;
                  $url = trim($url);
                  if (!preg_match("=://=", $url)) $url = "http://$url";
                  if (!preg_match('#^http\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $url)) {
                        return htmlspecialchars($this->item->$name_field, ENT_QUOTES);//return false;
                  } else {
                      $urllink = "<a href=\"$url\">$url</a>";
                    return $urllink ; //return true;
                  }
                                       
                  } 
            else 
            { return htmlspecialchars($this->item->$name_field, ENT_QUOTES);
            }		    
			 }
		}
to use the Mail-check it's also required to add line 13:

Code : Tout sélectionner

jimport('joomla.mail.helper'); // added to enable check simple text fields for email-adress

attached pls find the modified view.html.php ;-)

I hope this will help you a littlebit in the further development...
Fichiers joints
view.html.zip
(3.59 Kio) Téléchargé 224 fois

Avatar du membre
steevo
Administrateur du site
Messages : 330
Enregistré le : jeu. 17 déc. 2009 22:59
Contact :

Re: field types...

Message par steevo »

Hi,

I made a change in svn (rev. 54):
http://joomlacode.org/gf/project/collector/scmsvn/

but your version is cleaner with function JMailHelper::isEmailAddress() and JHTML::_('email.cloak',...);

I added an option to disable link display. So i'm going to melt both methods to be added in future release with others improvements.

Thank you for your help.

Specht
Messages : 9
Enregistré le : mer. 17 févr. 2010 20:14

Re: field types...

Message par Specht »

steevo a écrit :Hi,

I made a change in svn (rev. 54):
http://joomlacode.org/gf/project/collector/scmsvn/
unfortunally all these entries are in french
and it's verry diffcult ( I think not only for me ) to find what I need...
I assume it would be not only for me an effort if you can make enties there in english...

So I need to wait for the next release - and until then I look how can improve
maybe issues they are described in the JoomlaCode Projed page ;-)

Avatar du membre
steevo
Administrateur du site
Messages : 330
Enregistré le : jeu. 17 déc. 2009 22:59
Contact :

Re: field types...

Message par steevo »

Specht a écrit : unfortunally all these entries are in french
and it's verry diffcult ( I think not only for me ) to find what I need...
I assume it would be not only for me an effort if you can make enties there in english...
Ok, we'll try to write both english and french.

Répondre