Whishlist for the Hollidays... (will make a Donation.. ;) )
OK... thats it.... my humble mini Knowledge of PHP, Javascript and HTML is unable overcome this Hurdles... ;(
So I am searching for a programmer that could help me out here...
_It doesn't need to be perfect, quick & Dirty should also be ok.. _
1. How do I Save and load new Data fields with a new discussion:
I have this Date Field that I would like to save with a new Discussion... if you insert a Date or not, just save the data (when Empty = NULL)
Also I would like to show it when Editing, or in the Discussion Overview...
The Goal of this is to make a external Event Calendar, with the Event Date and the 1st Discussion Text as link:
I had this for my PhpBB3, and I urgently need it for Vanilla..
2. Emotify ant the Smilie/Cursor Problem:
If I place the Cursor somewhere in the Text, the Smilies I klick are NOT putted where the Cursor is, there where placed always at the End of the text...
I am Using the Plugin Emotify with the CLEditor
I am willing to pay for helping me here, I would even more be pleased, if you choose a Charity Organization I could send some Money...
To try it out:
http://caba.de/CaBaFoRuM/index.php?p=/discussion/1806/test#latest
Name= testuser
Passw= testuserpass
Thank you for any Help..
Comments
For an answer to your first question, look at that tutorial http://vanillawiki.homebrewforums.net/index.php/Practical_Example:_How_to_Extend_Existing_Forms
ThX, R_J...
I was struggling whit this, till i found a small Syntax in your Plugin:
(I corrected it in the Documentation)
So the plugin is now working, showing the Fields in the Profile...
But what Controller do I need to show the fields like in the above image, so the Date Field appears just over the Category List?
Is it the DiscussionController or the DiscussionsController?
I found this list:
http://codes-libres.org/apps/vanilla/nav.html?_functions/index.html
No clue where to start... still puzzling.. )
Thanx..
That's what a wiki is made for, thanks for your help!
Try the awesome eventi plugin (but not on your live installation!) to find out what event you would like to hook. I assume it will be one hook of a discussion view but eventi will show you some possibilities: just activate that plugin and open up a discussion.
My assumption concerning the discussion view was wrong, but if you've already activated eventi, you've noticed that. I think you would like to hook
PostController_BeforeBodyInput_Handler
to put the date below the discussion title.btw: don't forget to specify your version if you ask. I've seen that it is Vanilla 2.1b2 but not everybody would visit your homepage to look for that.
THIS IS SOOO EXITING!!!! Thank You Sooo Much R_J... let me send you an Virtual HUG...
As you see, my answers are coming with a big delay... I am working my *** off to understand and to make it work... at the end it's so little code and so simple... )
OK, here is my Code (default.php of Plugin):
This is working flawlessly... It inputs the Dates and show them again, when Edited...
here is the ALPHA Version of the Calendar:
http://www.caba.de/CaBaFoRuM/plugins/CaBaCaLeNDaR/Calendar/kalenderindex.php
I do still have issues, one of the biggest is, that when i do not enter any DATE into the input field, it saves as "0000-00-00" into the Database...
and then, when I stop XAMPP, it will not start again!!! MySQL will not Start!!!
So I left it as "Varchar" in my online forum...
I reinstalled XAMPP/Vanilla and put the DEFAULT Value of the date "1900-01-01", but it still saves "0000-00-00" when nothing is insertd in the Date Field of the Form.
I can't use VarChar, because I need to Order by Date.....
Is there a way to validate the inputs, before they are saved??
Thanks again, you saved my day...
p.s.: Yes, you're absolutley Right... usually I always specify the Vanilla Version and the Browsers I'm using, this time I forgot..;)
p.p.s.: Please tell me a Charity Organization of your choice, so i could donate something to them.. thx..
I also love the simplicity and I think that is what Garden really makes a great framework!
There are some things that come to my mind when looking at your code:
1. line 23 should be updated or deleted
2. you will learn a lot about what is possible if you look at the source code! Get a local copy of your forum and then search in that files for "function column". You'll find the documented function and you'll see that you can give default values to columns when you create them. So you could change
->Column('cabacalendardate', 'varchar(10)', TRUE)
to->Column('cabacalendardate', 'varchar(10)', '1900-01-01') 3. you've already planned to use a flag in order to tell if a discussion is an event or not but that line is commented out. Create a column for that information (I think there is no boolean datatype so use tinyint). Depending on the state of that checkbox you can show or hide the date input field with javascript. 4. It might look nicer to have that controls below the message window, because there will be more discussions than events, but I'm not sure about that... 5. You've started to make your plugin translatable, that's great! (You've used the function T(), if you don't know yet, what I'm talking about). But the Label function translates automatically. I have not known that when I wrote the wiki article so that should be changed there. I would write the plugin in English (just because it is Vanillas default language) and make a translation file for yourself. To make your plugin translatable, you have to add
'HasLocale' => TRUE,to the plugin info array. Create the file
CaBaCalendar/locale/de-DE/definitions.php` with following content:and change
echo $Sender->Form->Label(T("CaBa Eventdatum:"), 'cabacalendardate');
toecho $Sender->Form->Label('CaBa Event Date:', 'cabacalendardate');
6. Validation. Search for "function addrule" and "function applyrule". In general, you will have to add a new rule to the validation of the controller and afterwards apply it. But there is a standard rule called "Date" so you even do not have to add that rule. Just apply the standard rule to your field:
$Sender->Validation->ApplyRule('cabacalendardate', 'Date', T('You have to enter a date.'));
7. And after all that, try to follow the Vanilla conventions concerning variable names: make the column names CabaCalendarDate and CabaCalendarDateCheck.
Uh... I see... bye bye sleep, bye bye marvelous days of eating chips and watching TV while gently fondling my stomach ...
Ok, I'll try 2 work off your list...
Till then, I played on the Calendar Style... looking gooooddd....
To try it out you have to first login to the Forum::
http://caba.de/CaBaFoRuM/index.php?p=/discussion/1806/test#latest
Name= testuser
Passw= testuserpass
and then the Calendar:
http://www.caba.de/CaBaFoRuM/plugins/CaBaCaLeNDaR/Calendar/kalenderindex.php
or just look the Attachement..
I integrated an onklick event, so the rows show the 1st Disscussion on klick..
p.s.: Donation is on the way..
There are two checkboxes now.
You have
$PluginInfo['CaBaCaLeNDaR']
butclass CabaCalendar extends Gdn_Plugin
. I'm not sure if anything there is case sensitive, but it should be consistent.Here are some snippets you might find useful for your plugin:
If you want a sexy link to your calendar, you can set up a custom route. You can make the link dynamic if you make it translatable. Admins would only need to translate CalendarLink in order to set up the custom url where the calendar could be accessed (last line refers not to Plugin but to Vanilla, I'll come to that later)
Credits go to x00. The following code is a shortened version of something I've seen in his source code
That function will add a link to your menu with the function AddLink($Group, $Text, $Url...
If you want your plugin to render on a page that looks like it is vanilla, make it a vanilla page! Don't create your index from Plugin controller (because you will have to start from zero) but from Vanilla controller.
The following code sets up a default page, adds all standard css and your custom css and js files and a few modules to the sidebar. It sets the breadcrumb, gets the discussion data from database and calls the view you need. You can access the results you've stored with
$Sender->SetData('CabaCalendarEvents', $Result);
in your view with$this->Data('CabaCalendarEvents')
I have not fully tested anything of that, but simply copied most of it from a calendar plugin I was just about to write by myself and changed it in a way I think that could be helpful for you. So there might be some adjustments necessary...
Wow... you're killing me, Brother.. hehe.. i like it....
Please be patient with me, I'm slow as Hell... If my Mother could see my Code She would say: "This crap looks like your room... dirty, messy and full of Girls lingerie!!!"
I Integrated all my Stuff from PhpBB, like the "Dabeier" (affiliate system) ,the Table (for planning) and linked the Calendar to the Discussions... quick and Dirty of course...
http://www.caba.de/CaBaFoRuM/plugins/CaBaCaLeNDaR/Calendar/kalenderindex.php
Now let me do it step by step:
the first thing is the checkbox:
How do I integrate a "onklick" Event to Show/Hide the Data Field?
I had this working, but Wrong of course...
I put this into my Theme>view>post>discussion.php :
And Javascript:
How can I do this with the Checkbox, generated with Garden Framework??
Second Question:
When starting a new discussion, the new DATE Input field allows only "YYYY-MM-DD" Format....
How can I set it to accept German Format like "MM.DD.YYYY" ??
ThX..
These are the 2 Questions, that I have to solve soon... after that there will be no confusion among my Users and I can concentrate on "Pluginfying" the Calendar...
That's the HTML of your new discussion page right now:
Make it something like this:
The most cleanest way (to my opinion) would be to ceate a script, that will set/delete a class to CabaCalendarDateContainer depending of the state of the checkbox.
So you will need a CSS and a JS file. Create
yourplugin/design/yourplugin.css
andyourplugin/js/yourplugin.js
.Your CSS file should have something like that:
When you look at the sourcecode of a new discussion, you'll find the id of the Checkbox:
Form_CabaCalendarDateCheck
. So you'll have to create a script that will check if the class of the input box is set, delete it if yes and set it if no. The script you've posted doesn't use jQuery. If you know that you have to access to a library, you could use it's functions. jQuery is a library and as such slower than plain js, but you don't have to speed optimize that so using jQuery keeps the source small and readable:You'll have to add CSS an JS file to your source.
JS might be more complicated because I think it must be added after the DOM tree was built, but visitors arrived right now, so I have to stop now...
That happens when you don't look at what you have written... Quote my post to see the html I've used above.
Save that to your
yourplugin.js
:Add the following line to your
public function PostController_BeforeBodyInput_Handler($Sender) {
That should make it possible to toggle your event date input fields visibility
The German date is a problem, I think. You can validate it with that function (it is just a slight modification of the validation that's used for the standard "Date" rule):
But you have to use it in a custom rule:
$Sender->Validation->AddRule('GermanDate', 'function:ValidateGermanDate'));
and afterwards you can apply that rule$Sender->Validation->ApplyRule('cabacalendardate', 'GermanDate', T('You have to enter a date.'));
Maybe anyone else can help with that:
I think you'll have to use input as a string in the database, which is not very desirable. I don't know a way to accept "DD.MM.YYYY" as input for a date column.
If there will be no other solution, you could think of giving the user 3 drop down fields day|month|year to choose the date from
ThX, R_J, will look into that as soon as possible...
Had to do some Sports over the Weekend, Work is twisting my hairstyle AND have to Compose a Song for the Holidays, so muuuuuch to do but Time is lacking... ;(
For now, the CaBaCaLeNDaR it is really looking good... from the outside...
Inside is messy Coding, but I'll Clean that up before Pluginning it..
What about the others of the Vanilla Community? Is there a need for such kind of Calendar ?
Asking just out of interest..