Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: maestrosite.ru on October 21, 2012, 06:50:17 AM

Title: GenericControls
Post by: maestrosite.ru on October 21, 2012, 06:50:17 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=3482)

Default decoration elements

Display html-elemants with decoration as default theme

Example. Dispaly catalog title and "once-submit" form :
checkSubmitOnce('check');

in your template:
loadTemplate('maestrosite-GenericControls');
GenericControls::cat_bar( $txt['subcribe'] );
GenericControls::form_header( $post_url );
echo $txt['your_email'], ': <input type="text" name="email" value="" />';
GenericControls::form_footer();



Mod page and examples http://smf2.MaestroSite.ru/index.php/topic,49.0.html (http://smf2.maestrosite.ru/index.php/topic,49.0.html)
Support http://MaestroSite.ru/ (http://maestrosite.ru/)
E-mail [email protected]

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License (http://creativecommons.org/licenses/by-sa/3.0/).




Отображение html-элементов

Мод упрощает отображение информации и управляющих элементов в стандартном оформлении для любой темы оформления.

Пример. Вывод заголовка и "одноразовой" формы:
checkSubmitOnce('check');

В шаблоне:
loadTemplate('maestrosite-GenericControls');
GenericControls::cat_bar( $txt['subcribe'] );
GenericControls::form_header( $post_url );
echo $txt['your_email'], ': <input type="text" name="email" value="" />';
GenericControls::form_footer();



Страница мода и примеры http://smf2.MaestroSite.ru/index.php/topic,49.0.html (http://smf2.maestrosite.ru/index.php/topic,49.0.html)
Сопровождение http://MaestroSite.ru/ (http://maestrosite.ru/)
E-mail [email protected]

Этот мод доступен по лицензии Creative Commons Attribution-ShareAlike (Атрибуция — С сохранением условий) 3.0 Непортированная (http://creativecommons.org/licenses/by-sa/3.0/).
Title: Re: GenericControls
Post by: Shambles on October 21, 2012, 11:41:20 AM
Read the description several times, tried to make sense of the 'example', even downloaded and installed it, but still haven't a clue what it is or does. Shame on me.
Title: Re: GenericControls
Post by: Arantor on October 21, 2012, 11:52:36 AM
Don't worry, I'm still not sure I understand what it's supposed to do.
Title: Re: GenericControls
Post by: FrizzleFried on October 21, 2012, 11:59:28 AM
I am right there with you two... testing this does... nothing that I am aware of.

Title: Re: GenericControls
Post by: Arantor on October 21, 2012, 12:00:58 PM
Well, you're not supposed to just use it, you're supposed to use it and then write some code to make use of it, but anyone that can make use of the code of this mod can do it using SMF's own code to do much the same thing which would be only slightly longer anyway.
Title: Re: GenericControls
Post by: digger on October 21, 2012, 10:58:05 PM
maestrosite.ru,
Внятное описание мода очень помогает ему в дальнейшем распространении.
Умудриться написать так, что даже на родном языке не понятно для чего мод, пока код не посмотришь... :)
А уж бедным англосаксам, тем более не понять, да еще и с орфографическими и пунктуационными ошибками в трех строках описания... Стыдно, батенька.
Title: Re: GenericControls
Post by: Arantor on October 21, 2012, 11:01:24 PM
It's kind of rude to speak in Russian when everyone else is speaking English. I also hope the reference to spelling and punctuation errors isn't relating to me at all, since I didn't make any mistakes with spelling or punctuation.
Title: Re: GenericControls
Post by: digger on October 21, 2012, 11:07:07 PM
Quote from: Arantor on October 21, 2012, 11:01:24 PM
It's kind of rude to speak in Russian when everyone else is speaking English. I also hope the reference to spelling and punctuation errors isn't relating to me at all, since I didn't make any mistakes with spelling or punctuation.
All my worlds just about mod's description. I wrote that description is not very clear, even for a Russian. And have errors and not very clear for English.
Title: Re: GenericControls
Post by: Arantor on October 21, 2012, 11:09:26 PM
That's one of the downsides to using Google Translate - context is kind of lost :/ (I didn't mean to get accusatory, I'm sorry. It's just it looked, to me, like you were perhaps being not so nice about us that didn't get what the mod was for.)
Title: Re: GenericControls
Post by: digger on October 21, 2012, 11:18:32 PM
Quote from: Arantor on October 21, 2012, 11:09:26 PM
That's one of the downsides to using Google Translate - context is kind of lost :/ (I didn't mean to get accusatory, I'm sorry. It's just it looked, to me, like you were perhaps being not so nice about us that didn't get what the mod was for.)
Do not worry about it. It should be useful for me to write nickname when I reply to anybody without quote. It's my mistake.
Title: Re: GenericControls
Post by: hcfwesker on October 22, 2012, 11:16:51 AM
My Russian must be pretty good cause I got about  the same info out of both language descriptions.
Title: Re: GenericControls
Post by: maestrosite.ru on October 29, 2012, 11:35:01 PM
Quote from: digger on October 21, 2012, 10:58:05 PM
maestrosite.ru,
Внятное описание мода очень помогает ему в дальнейшем распространении.
Умудриться написать так, что даже на родном языке не понятно для чего мод, пока код не посмотришь... :)
А уж бедным англосаксам, тем более не понять, да еще и с орфографическими и пунктуационными ошибками в трех строках описания... Стыдно, батенька.
Замечания и предложения, как всегда, принимаются и рассматриваются. Указания на конкретные ошибки - приветствуются.


to all:
One more, sorry for my english.

This mod not for direct uses. But it helper for other mods. In other words, this mod for developers.

If you developer, do you want every time  type submit buttons or "sess-vars"? Maybe it is holy war, but i think, in example (start post) no places for mistakes. Such as loss css classes of theme, loss "accesskey", loss sess param and other.
Title: Re: GenericControls
Post by: live627 on October 30, 2012, 03:31:50 AM
Interesting. So, it is for developers only, average user won't care.

Seems like some kind of generic form template, with buttons and no other controls. Looks like this can be used to code in a form control, but without writing the form tags. So it relies heavily on template layers, and your template needs only the inputs, selects, etc.
Title: Re: GenericControls
Post by: maestrosite.ru on October 30, 2012, 03:55:03 AM
 also blocks decoration: windowbg+content, roundframe; catalog and title bars

PS In meaning, it must be in GenericControls, but I did not edit core files.
Title: Re: GenericControls
Post by: Shambles on October 30, 2012, 05:56:12 AM
Maybe the name of this "modification" could be changed to reflect what it's meant to be used for, rather than the vague and non-descriptive "GenericControls" it currently has...?
Title: Re: GenericControls
Post by: Arantor on October 30, 2012, 02:41:46 PM
I still maintain that any developer who is capable of using this mod will also be capable of doing it themselves anyway ;)
Title: Re: GenericControls
Post by: maestrosite.ru on October 30, 2012, 11:49:55 PM
One more mod for dev/custom in early beta - http://smf2.maestrosite.ru/index.php/topic,48.0.html (http://smf2.maestrosite.ru/index.php/topic,48.0.html). Description on russian only, but mod don`t use localization - only english: file names, fucntion names. In "full" mode require GenericControls mod.  Is it interesting?
Title: Re: GenericControls
Post by: Arantor on October 30, 2012, 11:52:21 PM
That description seems interesting, however forcing a dependence on this mod doesn't inspire me to use it... most people like to have *fewer* mods.
Title: Re: GenericControls
Post by: maestrosite.ru on October 31, 2012, 12:05:58 AM
Yes, dilemma. Copypaste mod by mod, or dependences. I understand your mind.
Title: Re: GenericControls
Post by: Arantor on October 31, 2012, 12:09:36 AM
I'd rather copy paste mod by mod than dependencies - partly because it reduces your support, partly because it would be faster for the user (not by much, but it would be faster) and partly because the amount of code you're actually saving is a few dozen lines per template - at most.

I'm aware of the issues of dealing with form headers and getting things like the session identifier... what about things like submit-once nonces? Are they handled?

I've done huge mods and I could see the benefit, but quite honestly this is stuff that should be implemented in the core, not the periphery of the system through a mod.
Title: Re: GenericControls
Post by: maestrosite.ru on October 31, 2012, 12:34:06 AM
Quote from: Arantor on October 31, 2012, 12:09:36 AM
I'm aware of the issues of dealing with form headers and getting things like the session identifier... what about things like submit-once nonces? Are they handled?
Sorry, i'm don't understand your questions.

Quote from: Arantor on October 31, 2012, 12:09:36 AM
that should be implemented in the core, not the periphery of the system through a mod.
Yes! Of cource!! Also:
- attach hooks by config - not in php code : add/remove_integration_function
- update mod settings -  not in php code : updateSettings
- change DB by config - not in php code : db_extend('packages')
and other
Title: Re: GenericControls
Post by: Arantor on October 31, 2012, 12:37:37 AM
QuoteSorry, i'm don't understand your questions.

Does the mod support things like checkSubmitOnce?

QuoteYes! Of cource!! Also:
- attach hooks by config - not in php code : add/remove_integration_function
- update mod settings -  not in php code : updateSettings
- change DB by config - not in php code : db_extend('packages')
and other

I know *exactly* what you mean. Probably better than most people here and had I had my way I would have implemented them in the package-info.xml file itself... oh wait...
Title: Re: GenericControls
Post by: maestrosite.ru on October 31, 2012, 01:02:16 AM
Quote from: Arantor on October 31, 2012, 12:37:37 AM
Does the mod support things like checkSubmitOnce?

Do you mean display "seqnum" and "session_*" fields:
if( !empty($context['form_sequence_number']) )
echo '
<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />';

or not?
Title: Re: GenericControls
Post by: Arantor on October 31, 2012, 10:16:47 AM
Yes, I do - but you can't just randomly insert that stuff.
Title: Re: GenericControls
Post by: maestrosite.ru on October 31, 2012, 10:27:05 AM
Sorry, i don't understand you again