Custom Fields - enhanced functionality for News Fields

All new Coranto Addons, updates and patches to addons, will be released here...also, get support for addons within!

Moderators: Spunkmeyer, Dale Ray, SrNupsen, Bluetooth, Jackanape

Custom Fields - enhanced functionality for News Fields

Postby Parahead » Tue Nov 04, 2003 10:21 am

Custom Fields is ment to enhance the functionality of the current News Fields but also adds a new type of Field - a Description Field - which can be used to group a bunch of fields at the News Submit Page or add a description of how to fill out a specific field.

The fields that are enhanced with the current version are:
* Drop Down Field: Possible to add new values "on the fly" at the Submit News Page, controlled by User privilage. Also possible to make the Drop Down Box work in Multiple selection mode.

* Single Line Input: Can now work as a timestamp field, which means it is updated with the current time when submitting/modifying a post. Possible to choose if it always should be updated or only at will.

* All Fields: Possible to validate a field before the post is being submitted, for example that an e-mailaddress is correct.

If you would like to take full advantage of the new "Description Field" with the current version of Coranto (1.22.1) you have to add a new HOOK into the Coranto-file crcore.pl. But do not be discourage, you can perfactly use the addon without these modifications if you like.

Though, it is only some lines of code in two subs and these modifications will be included in future releases of Coranto (next version in the 1.30.x-series) as stated from Cerberos76. This file contains the two updated subs, with version 1.22.1 as the source. If you don´t feel safe about updating the core, please do not! I will *not* take any responsibility for updates that doesn´t go your way... And please do a backup of crcore.pl before you do update it.

Please keep bugreports, feedbacks and requests regarding this addon in this thread. The latest version can be found at Coranto Factory.
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby Lawrence » Thu Nov 06, 2003 4:23 pm

Parahead, please post information on this new hook so i can update Coranto to include it :)
Stuff I'm working on:
- nothing

Addons:
http://sourceforge.net/projects/lw-craddons/
Lawrence
 
Posts: 1524
Joined: Sun Sep 16, 2001 4:24 am

Postby kriko » Thu Nov 06, 2003 5:55 pm

I believe that this topic explains it the best :)
Kristjan aka. kriko
now a wireless expert
User avatar
kriko
 
Posts: 3328
Joined: Sat Feb 24, 2007 8:13 pm

Postby Pirate Elf » Thu Nov 06, 2003 6:56 pm

I finally got around to testing this. Neat addon. I haven't gotten around to finding a use yet, but I only played with it for a few mins that I had to spare. Now once the user fields options come into play I will be using it heavily. lol
Nichts ist für dich
Nichts war für dich
Nichts bleibt für dich
Für immer
Pirate Elf
 
Posts: 732
Joined: Wed Jan 31, 2007 9:45 pm

Postby Parahead » Thu Nov 06, 2003 8:07 pm

Lawrence wrote:Parahead, please post information on this new hook so i can update Coranto to include it :)


Actually it is two hooks. cerberos76 has already got the code, so check with him, maybe he has already put them in...

Anyway, Coranto 1.22.1 as source for the modifications in crcore.pl below:
http://www.parahead.com/coranto/addons/ ... d_subs.txt
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby Parahead » Thu Nov 06, 2003 9:14 pm

Pirate Elf wrote:Now once the user fields options come into play I will be using it heavily. lol
Yeah, I will look into it, just havn´t gotten around to it yet, sorry...

Well, I also have another thing I am planning on implementing that maybe Cerberos or Lawrence want to have some influence on before the actual release of this.

The thing is that since I have made it possible to use the dropdown-box as a multiple select field as well (and planning on adding a multiple checkbox-field) it would be nice to get hold of the values in that hash in a "tag-style way" for the nonprogramers, so that the don´t have to use Perl...

Anyway, some examples of tags I already have implemeted in my local installation:
Code: Select all
<Foreach: Array: Key Array><Field: Key></Foreach>
<Foreach: Hash: Key Hash><Field: Key></Foreach>
<Sub: Name("value")>
<Sub: Name(Field)>


Comments on this? Should these suggestions go into the core? Or stay in the CustomFields-addon? Should they look like that?
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby LoneOwl » Thu Nov 06, 2003 9:31 pm

Code: Select all
<Foreach: Keys: Hash>
<Foreach: Values: Hash>
<Foreach: Array>
<Foreach: Hash: HashVar> -- Make this be ~~while (each %hash)~~
<Sub: Name: Field: Value> or even <Sub: Name: Field: Value; Field: Value>
<Sub: Name: "value">

That's just my recommendation...
User avatar
LoneOwl
 
Posts: 1465
Joined: Sun Mar 10, 2002 2:57 am
Location: That one place, you know?

Postby Parahead » Fri Nov 07, 2003 7:44 am

Pirate Elf, I was going "oups" when I saw your post about fields not disapering, thank you Dale Ray for clearing the source out... I think I will look into XMS and see what can be done about, if Lawrence hasn´t done it already. Keep the feedback and suggestions coming. :-)

LoneOwl, thank you for your feedback, I realized I was a bit hasty in my previous post and also shoudn´t have left out what I translate the tags to in Perl, so I do that now in a better way:
Code: Select all
<Foreach: Array: Value ArrayName> => foreach my $Value(@ArrayName) {
<Foreach: Hash: Key HashName> => foreach my $Key(keys %HashName) {
<Sub: Name("value")> => &Name("value");
<Sub: Name(Field)> => &Name($Field);


Could you please do the same for your examples, so there will be no missunderstanding, thanks...
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby kriko » Fri Nov 07, 2003 1:23 pm

Kristjan aka. kriko
now a wireless expert
User avatar
kriko
 
Posts: 3328
Joined: Sat Feb 24, 2007 8:13 pm

Postby faithless » Fri Nov 07, 2003 1:56 pm

Parahead wrote:Pirate Elf, I was going "oups" when I saw your post about fields not disapering, thank you Dale Ray for clearing the source out... I think I will look into XMS and see what can be done about, if Lawrence hasn´t done it already. Keep the feedback and suggestions coming. :-)

LoneOwl, thank you for your feedback, I realized I was a bit hasty in my previous post and also shoudn´t have left out what I translate the tags to in Perl, so I do that now in a better way:
Code: Select all
<Foreach: Array: Value ArrayName> => foreach my $Value(@ArrayName) {
<Foreach: Hash: Key HashName> => foreach my $Key(keys %HashName) {
<Sub: Name("value")> => &Name("value");
<Sub: Name(Field)> => &Name($Field);


Could you please do the same for your examples, so there will be no missunderstanding, thanks...


Foreach is old and deprecated. Using just For will do. But then it might look weird for C programmers thou.

<For: Hash: Key HashName> => for my $Key(keys %HashName) {
faithless
 
Posts: 1335
Joined: Wed Oct 16, 2002 4:17 pm
Location: Infront of the Computer

Postby Parahead » Fri Nov 07, 2003 2:44 pm

faithless wrote:Foreach is old and deprecated. Using just For will do. But then it might look weird for C programmers thou

Deprecated? Could you please give me more information about this, I was under the impression that the foreach keyword actually was a synonym for the for keyword, so you can use foreach for readability or for for brevity.

Also that Perl executes a foreach statement more rapidly than it would the equivalent for loop. But I don´t use Perl in my daily job, so I my be in error...

http://www.perldoc.com/perl5.8.0/pod/pe ... each-Loops
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby LoneOwl » Fri Nov 07, 2003 5:14 pm

I have 5.6.0 installed, more recent than what many web servers run, and I don't see anything about it being depreciated. The closest would be "The foreach keyword is actually a synonym for the for keyword, so you can use foreach for readability or for for brevity."

For yours, I'd suggest this...
Code: Select all
<Foreach: Array: ArrayName; Field: Value> => foreach my $Value (@ArrayName) {
<Foreach: HashKeys: HashName; Field: Key> => foreach my $Key(keys %HashName) {
<Sub: Name: "value"> => &Name("value");
<Sub: Name: Field: Var> => &Name($Var);


And for mine...
Code: Select all
<Foreach: Hash: HashVar; Field: Key; Field: Value> => while (my ($Key, $Value) = each %HashVar)
The others would either be vague for most users or, repeats.
User avatar
LoneOwl
 
Posts: 1465
Joined: Sun Mar 10, 2002 2:57 am
Location: That one place, you know?

Postby Parahead » Sat Nov 08, 2003 12:15 pm

Hmmm....

LoneOwl, what do you think about this approach instead, it´s something inbetween our suggestions:
Code: Select all
<Foreach: Array: ArrayName; Value: ValueField> => foreach my $ValueField (@ArrayName) {
<Foreach: Hash: HashName; Key: KeyField> => foreach my $KeyField(keys %HashName) {
<Foreach: Hash: HashName; Key: KeyField; Value: ValueField> => while (my ($KeyField, $ValueField) = each %HashName) {

This way the name of attributes is more descriptive, just not "Field". Also the syntax is more coherent throughout the Foreach-statements...

Regarding the Sub-tag, maybe this could be something? This way it is simpler to do a regular expression that can handle an arbitrary amount of input-fields. If there is " present, it is a value, if not, it is a field.
Code: Select all
<Sub: Name; Input: "value"> => &Name("value");
<Sub: Name; Input: FieldName> => &Name($FieldName);
<Sub: Name; Input: "value"; Input: FieldName> => &Name("value", $FieldName);


And I really do want your opinion about this hole idea in general. Do you think it is a stupid thing to implement from the begining? I think about your statement in the "Coranto Tutorial"-thread... Is this to complex for newbies? And if you are not a newbie, would you want to use this or is the PerlCode-tag the way to go then anyway?

The intention from my part is just to make life easier for everybody when using Coranto, but maybe I am trying to hard with this particular thing and making a solution that really isn´t needed?
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby faithless » Sat Nov 08, 2003 4:46 pm

Parahead wrote:
faithless wrote:Foreach is old and deprecated. Using just For will do. But then it might look weird for C programmers thou

Deprecated? Could you please give me more information about this, I was under the impression that the foreach keyword actually was a synonym for the for keyword, so you can use foreach for readability or for for brevity.

Also that Perl executes a foreach statement more rapidly than it would the equivalent for loop. But I don´t use Perl in my daily job, so I my be in error...

http://www.perldoc.com/perl5.8.0/pod/pe ... each-Loops


for me, typing "for" is faster than tping "foreach" and for sounds more readable to me than "foreach". anyway, "foreach" is a synonym and will work the same as "for" since it is "for" actually.

i'm getting myself confused. :x
faithless
 
Posts: 1335
Joined: Wed Oct 16, 2002 4:17 pm
Location: Infront of the Computer

Postby Parahead » Sat Nov 08, 2003 5:30 pm

Well, I still think foreach is more readable than for, then you know you will get each value in the for loop... Anywayit is no big issue, I just implement the regular expression so that both variants should work and we both could use the form we liked, just as it is working in Perl... :-D

Any opinion on the last syntax-suggestion I gave?
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Next

Return to Addon Release and Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron