Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home/abledesi/domains/abledesign.com/public_html/navfiles/log.php on line 126

AbleDesign - Support Forum

AbleDesign Forum Index AbleDesign

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
AbleDesign Forum Index
MyCalendar Discussion
Instructions for adding a field & making it show on myca
Post new topic   Reply to topic

Goto page 1, 2, 3  Next
Post new topic   Reply to topic    AbleDesign Forum Index -> MyCalendar Discussion
View previous topic :: View next topic  
Author Message
mouschi
Window Shopper
Window Shopper


Joined: 18 May 2002
Posts: 24

PostPosted: Thu Jun 06, 2002 9:48 pm    Post subject: Instructions for adding a field & making it show on myca Reply with quote

Okay guys, I promised Dan that I would post up a full detailed list of how to add a field as well as making it show up on the calendar. Dan, if you can, please take note of any unnecessary updates that you find below and let us know. I have about 15 items to add, so the simpler the better! Please take note that ministry_name is the field I added, so you could probably just directly replace them with your new field. It would also probably be best to keep everything the same in terms of case sensitivity.


Adding into the database

config.php

line 226
"15" => array ("Ministry_Name", $LANG["ministry_name"], xvar("ministry_name"), "35", "75", "ministry_name", "", "", "=", "1")

line 243
define ("MINISTRY_NAME_ROW", 15); // IMPORTANT: set this equal to the # of the 'Category' array above

line 260
"14" => array ("Ministry_Name", $LANG["ministry_name"], xvar("ministry_name"), "35", "75", "ministry_name", "", "", "=", "")

line 276
define ("V_MINISTRY_NAME_ROW", 14); // IMPORTANT: set this equal to the # of the 'Holiday' array above

do_validate.php

line 70
$db_calendar[MINISTRY_NAME_ROW][2] = xvar("_".$value."_ministry_name");


language_english.php

(alphabetical)
"ministry_name" => "Ministry Name",

add_form.php

line 60
$am_array["ministry_name"] = "";

add_mod_form.php

line 181
$txt .= "<input type=\"text\" name=\"". $new_id ."ministry_name\" size=\"". $array["size"] ."\" maxlength=\"75\" value=\"". $array["ministry_name"] ."\">\n";

modify_form.php

line 53
$ministry_name = stripslashes($myrow["Ministry_Name"]);

line 116
$am_array["ministry_name"] = $ministry_name;

line 127
// echo add_mod_form("modify", $size, $time_start, $time_end, $subject, $ministry_name, $description, $myrow["Recurring"], $myrow["Daily"], $myrow["DOW"], $myrow["Incr"], $recurring_periods, $uid, $cat_array);

validate_form.php

line 75
$ministry_name = stripslashes($myrow["Ministry_Name"]);

line 120
$am_array["ministry_name"] = $ministry_name;


Making items show up on the calendar

Lib.php

Line 652
$ministry_name = stripslashes($row["Ministry_Name"]);

line 695
$txt .= "<b>". $LANG["time_start"] .":</b> $time &nbsp; | &nbsp; <b>". $LANG["subject"] .":</b> $subject &nbsp; | &nbsp; <b>Ministry Name:</b> $ministry_name\n";

line 719
$txt .= "<font color=\"". $CFG["firstrow_font_color"] ."\"><b>". $LANG["subject"] ."</b><b>". $LANG["ministry_name"] ."</b></font></td>\n";

[/i]
Back to top
View user's profile Send private message AIM Address
Dan
Admin / Developer
Admin / Developer


Joined: 19 Feb 2001
Posts: 2057

PostPosted: Sat Jun 08, 2002 12:00 pm    Post subject: Reply with quote

Thanks for taking the time to post that.

Everything looks good, just a few minor notes:

Quote:
language_english.php

(alphabetical)
"ministry_name" => "Ministry Name",

This should also be added to each of the language files in case a user selects a non-english language. Alternatively, if you're feeling lazy, you could just add $LANG["ministry_name"] = "Ministry Name"; to config.php after the language file include section and not have to worry about language translations.

Also, the language file array elements do not need to be in alphabetical order. I have them that way for ease of reading/editing; simply output in order by the system I use for maintaining the language files.

Quote:
define ("MINISTRY_NAME_ROW", 15); // IMPORTANT: set this equal to the # of the 'Category' array above

Very minor note here: The above line (and corresponding entry in the $db_validate array) is copy and pasted from a similar line, so the "Category array" mention is a carry over from what it was copied from, not in any way indicative of the Ministry_Name entry. Just so no one is confused.

Quote:
add_mod_form.php
line 127
// echo add_mod_form("modify", $size, $time_start, $time_end, $subject, $ministry_name, $description, $myrow["Recurring"], $myrow["Daily"], $myrow["DOW"], $myrow["Incr"], $recurring_periods, $uid, $cat_array);

Don't worry about that line, it should have been removed in the previous release...

Note that the lib.php changes take place in the day_display() function, which handles the display of daily events, fittingly.

Cheers,
Dan
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sanguinarius
Regular
Regular


Joined: 05 Jul 2002
Posts: 49
Location: Kansas, USA

PostPosted: Mon Aug 05, 2002 5:08 pm    Post subject: help.. Reply with quote

Crud, I tried adding a field using these instructions, and when I looked at the add event form, the field was ABOVE the "Add the following entry to the Calendar" heading (plus no text to say what it was for, which is a text field to add a url, in this case).

I figured, what the heck, and tried to add it anyway. I get hte following errors:

Quote:

Record ID #21 could not be added to table 'Calendar_Calendar' on 2002-8-5.

Error Performing Query: Column count doesn't match value count at row 1

Error Performing Query: Unknown column 'Calendar_Calendar.URL' in 'field list'



I figured a url field would be good to add since a lot of places have a page with more info... If I messed up (which I obviously did...) then it is probably in the lib.php file, because I was not at all clear on where to add the stuff; not really familiar with php and the like. I can kind of tell when a subroutime begins or ends, but.... *dumb, helpless look*

---

Also, I looked in my database, and the field "URL" is not there.

I figure it should probably appear in Calendar_Calendar and Calendar_Validate but it's not in any of the Calendar_* tables.
_________________
--Sanguinarius
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Sanguinarius
Regular
Regular


Joined: 05 Jul 2002
Posts: 49
Location: Kansas, USA

PostPosted: Mon Aug 05, 2002 5:36 pm    Post subject: *sigh* Reply with quote

I had the additions in the function day_display($row) routine. I took them out of there and added them to the end of the function date_display($y, $m, $d, $preformatted_date) one. I tried adding an event, and still got the same message as before. Currently, my function date_display($y, $m, $d, $preformatted_date) routine looks like:

[code removed]

...if THAT is helpful in any way, or even the problem.

===

bleh. I converted copies of the files that get changed into text files and uploaded them at [links removed] becuase I figure it'd be easier to just show them.
_________________
--Sanguinarius
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Dan
Admin / Developer
Admin / Developer


Joined: 19 Feb 2001
Posts: 2057

PostPosted: Tue Aug 06, 2002 4:33 pm    Post subject: Reply with quote

Sorry for the slow reply. Just getting caught up on various things after getting back last night.

Let's see...

Quote:
plus no text to say what it was for, which is a text field to add a url

Most likely, that's because you haven't added a "url" entry to the langauge file(s). Note that you have $LANG["url"] in your $db_calendar definition in config.php. If you don't want to mess with the language files, just put URL in place of $LANG["url"] in the config array. Ditto for $db_validate.

The rest of config.php looks ok. Ah, this looks to be the reason why your URL text field is showing up outside the table:

Code:
$txt .= "<input type=\"text\" name=\"". $new_id ."url\" size=\"". $array["size"] ."\" maxlength=\"75\" value=\"". $array["url"] ."\">\n";

That should be:
Code:
$txt .= "<tr><td align=\"right\" bgcolor=\"". $CFG["column_header_color"] ."\">\n";
   $txt .= "<b>". $LANG["url"] ."</b>\n";
$txt .= "</td><td bgcolor=\"#000000\" colspan=\"2\">\n";
   $txt .= "<input type=\"text\" name=\"". $new_id ."url\" size=\"". $array["size"] ."\" maxlength=\"75\" value=\"". $array["url"] ."\">\n";
$txt .= "</td></tr>\n";

Otherwise, it isn't embedded in the table's cells.

Quote:
Also, I looked in my database, and the field "URL" is not there

That needs to be added by you, which I guess wasn't mentioned in the instructions above. Are you comfortable working with phpMyAdmin enough to manually add the column at the end of the table? If not, you could enter the following into the SQL monitor (textarea input box for the database the calendar tables are in):

Code:
ALTER TABLE Calendar_Calendar ADD URL varchar(255) NULL AFTER Holiday;
ALTER TABLE Calendar_Validate ADD URL varchar(255) NULL AFTER Category;


If you are allowing the URL field to be submitted by users, then you will also need to make changes to add_to_validate.php, which I think was covered in another thread.

Cheers,
Dan

p.s. I've edited the above messages to remove the link to the full files and code snippets, both for readability in this thread, site owner security (config file stuff), and to avoid sharing entire MyCalendar files publicly. The files did help see what the status is, though.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sanguinarius
Regular
Regular


Joined: 05 Jul 2002
Posts: 49
Location: Kansas, USA

PostPosted: Wed Aug 07, 2002 2:55 pm    Post subject: Reply with quote

OK, it's kind of working now. I made the change that puts the URL field in the right place (for the most part; it's at the bottom on the rest of the stuff. I'm not worried right now about figuring out how to move it to right under the Description box). I added the infos to the mySQL database. Now, at least the script is working so events can be added.

But when I go to add an event (as an admin or as a user), and I type in the url in the URL field, it does not appear anywhere: not in the listing of the event, or when Admin goes to validate User's submission.

You said something about needing to add some infos to add_to_validate.php which instructions are located in another thread, but I cannot find that thread (yes, I used the search function). I looked for add_to_validate.php and just add_to_validate. If the instruction is there, then I did not recognize it as being such, and it was all very confusing to read through, till everything just kind of starts chasing itself around in my head...

Would it be something simple like just adding to the add_to_validate.php file the same info that I added to the add_form.php file, maybe? Or what?

Oh, also, I removed the folder and text files I had put up to look at. I did not realize that was not a good idea..

After this one, I'm probably not going to be adding any other fields. lol I'd kind of planned to add a field (like maybe a drop down menu -- with all time zones, not just the USA's) so users could select the time zone their event would be held in, buuuuuuuuuuut......

Er... In new releases, will it be necessary to always need to manually add all these items to the files each time? Maybe have some sort of function if possible that would allow admins to use an interface to add a field, to automate the process, maybe, maybe, maybe?
_________________
--Sanguinarius
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Sanguinarius
Regular
Regular


Joined: 05 Jul 2002
Posts: 49
Location: Kansas, USA

PostPosted: Thu Aug 08, 2002 11:33 am    Post subject: Reply with quote

If the following is helpful at all...

When Admin first went to validate the User's event, the source code snippet was:

<b>URL</b>
</td><td bgcolor="#000000" colspan="2">
<input type="text" name="_2_url" size="40" maxlength="75" value="http://www.sanguinarius.org/vampire.shtml">
</td>

==========

Admin: Modify an event:

relevant source code snippet:

<b>URL</b>
</td><td bgcolor="#000000" colspan="2">
<input type="text" name="url" size="40" maxlength="75" value="">
</td></tr>
<tr><td align="right" bgcolor="#000000"><b>Submitted by:</td></b></td><td bgcolor="#000000" colspan="2">

Also, when the page loaded, I got this stuff at the very top (and when I clicked "Refresh/Reload), it disappeared and page loaded normally):


Warning: Supplied argument is not a valid MySQL-Link resource in /home/sites/site18/web/calendar/session.php on line 87

Warning: Cannot add header information - headers already sent by (output started at /home/sites/site18/web/calendar/session.php:87) in /home/sites/site18/web/calendar/index.php on line 10

Warning: Cannot add header information - headers already sent by (output started at /home/sites/site18/web/calendar/session.php:87) in /home/sites/site18/web/calendar/index.php on line 11

Warning: Cannot add header information - headers already sent by (output started at /home/sites/site18/web/calendar/session.php:87) in /home/sites/site18/web/calendar/index.php on line 12

Warning: Cannot add header information - headers already sent by (output started at /home/sites/site18/web/calendar/session.php:87) in /home/sites/site18/web/calendar/index.php on line 13

==========

User: Modify / Edit the event:

relevant source html snippet:

<b>URL</b>
</td><td bgcolor="#000000" colspan="2">
<input type="text" name="url" size="40" maxlength="75" value="">

==========

Continuing to look for the thread you mentioned above...and not find *sigh*
_________________
--Sanguinarius
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Dan
Admin / Developer
Admin / Developer


Joined: 19 Feb 2001
Posts: 2057

PostPosted: Thu Aug 08, 2002 12:07 pm    Post subject: Reply with quote

Quote:
when I go to add an event (as an admin or as a user), and I type in the url in the URL field, it does not appear anywhere

You made the additions to day_display() in lib.php?

Quote:
You said something about needing to add some infos to add_to_validate.php which instructions are located in another thread, but I cannot find that thread (yes, I used the search function). I looked for add_to_validate.php and just add_to_validate.

Well, you get an A for effort at any rate! Looks like it was discussed but not addressed...

You shouldn't need to do much in add_to_validate.php other than echo the URL field to the browser after the user has submited the form. Somewhere around line 127, add:

Code:
echo "<br><b>". $LANG["url"] .":</b> ". stripslashes($db_validate[V_URL_ROW][2]) ."\n";


The rest should be handled internally, unless I'm overlooking something.

Quote:
Oh, also, I removed the folder and text files I had put up to look at. I did not realize that was not a good idea..

No problem. It's best for you to not share any server related info (lots of not so nice folks out there) and best for the programmer to not share more code than necessary.

Quote:
In new releases, will it be necessary to always need to manually add all these items to the files each time?

Unfortunately, yes. It's good to get in the practice (with any script, not just this one) to make note of the customizations you have made. I generally do so both in a separate file and where the actual changes are, using my initials or something as an easy thing to search through for those places. Much easier to carry forward customizations down the road that way, especially if they are extensive.

Quote:
Maybe have some sort of function if possible that would allow admins to use an interface to add a field, to automate the process, maybe, maybe, maybe?

If I can come up with a good way to do that, then I certainly would. The question is how to do it... Making it something that could be done online is risky, as it would require making a number of files writable (most people would not know or neglect to then change them back to read-only). There would also be the challenge of figuring out where to place display lines and what all to show.

From your last post, it looks like you managed to get the URL field added to the database, but the modify/validate forms do not look to be picking it up. What changes did you make to modify_form.php and validate_form.php?

Quote:
Also, when the page loaded, I got this stuff at the very top (and when I clicked "Refresh/Reload), it disappeared and page loaded normally):

I need to figure out one of these days why that happens from time to time... I've had a very difficult time duplicating it with any regularity, and nothing about the page changes (that I can see) the times it does happen. Seems to be a hiccup somewhere in PHP's session handling, which isn't exactly breaking news in PHP circles.

Cheers,
Dan
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sanguinarius
Regular
Regular


Joined: 05 Jul 2002
Posts: 49
Location: Kansas, USA

PostPosted: Sat Aug 10, 2002 11:30 am    Post subject: Reply with quote

So far, so good. I added the code to the add_to_validate.php and submitted an event as a user. The url is showing up in the screen following the submit form now:

Quote:

Thank you. You will be notified when your submission is validated.

Date: 2002-8-10 Time: NA End Time: NA
Title: test test test
Text: testing still...
URL: http://www.sanguinarius.org/~irc/
Recurring: one_time



Logged in as admin, and the url is now present in the url field.

Clicked on Validate and then Submit item; teh screen following says:

Quote:

Record ID #27 added to table 'Calendar_Calendar' on 2002-8-10.

Date & Time Subject
2002-08-10, NA test test test
testing still...


Item #3 deleted from the Validate table



(Should the url info show up there, as well, or no?

Went Back to Month. Clicked on the item listing link (that takes me to the modify item) and the url-text was not present in the url field.

Went back to month, and clicked on the Date # to view that day. The url was not listed there, either. (But I'm making progress, I guess)

I will go back and double check all my code alterations and that all the files are uploaded, to be thoroughly thorough and all that, just to eliminate any "human error" as a possibility-- knowing me, I suppose I theoretically *could* have made a mistake... :>
_________________
--Sanguinarius
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Dan
Admin / Developer
Admin / Developer


Joined: 19 Feb 2001
Posts: 2057

PostPosted: Sat Aug 10, 2002 12:10 pm    Post subject: Reply with quote

Sounds like we've got 2 of the 3 steps down, which brings me back to my previous question:

Quote:
You made the additions to day_display() in lib.php?

Cheers,
Dan
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sanguinarius
Regular
Regular


Joined: 05 Jul 2002
Posts: 49
Location: Kansas, USA

PostPosted: Sat Aug 10, 2002 12:11 pm    Post subject: Reply with quote

I've double checked that all the code is present (icluding the language files) and all files have been uploaded. Everything checks out.

In the Calendar_Calendar table in the database, the url text is present in the url field, at least.
_________________
--Sanguinarius
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Dan
Admin / Developer
Admin / Developer


Joined: 19 Feb 2001
Posts: 2057

PostPosted: Sat Aug 10, 2002 12:14 pm    Post subject: Reply with quote

Can you post the changes you made to day_display() ? That is the function that controls what is shown in the day display (fittingly), which is the component not yet working in your customization.

Cheers,
Dan
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sanguinarius
Regular
Regular


Joined: 05 Jul 2002
Posts: 49
Location: Kansas, USA

PostPosted: Sat Aug 10, 2002 12:25 pm    Post subject: Reply with quote

*confused look* I have some changes made to the date_display... I've included the date_display( and the day_diplay code that I have below (yeah, I know, so plz delete it when you're done looking at it?):
_________________
--Sanguinarius
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Dan
Admin / Developer
Admin / Developer


Joined: 19 Feb 2001
Posts: 2057

PostPosted: Sat Aug 10, 2002 12:34 pm    Post subject: Reply with quote

You actually copied both date_display() and day_display().

It would be easier for me to look through if you posted just the changes you made, not the entire function. Thanks.

Cheers,
Dan
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sanguinarius
Regular
Regular


Joined: 05 Jul 2002
Posts: 49
Location: Kansas, USA

PostPosted: Sat Aug 10, 2002 12:47 pm    Post subject: Reply with quote

in the date_display one, I added:

Code:

// hhh - to add a field

   $url = stripslashes($row["URL"]);
      $txt .= "<b>". $LANG["time_start"] .":</b> $time &nbsp; | &nbsp; <b>". $LANG["subject"] .":</b> $subject &nbsp; | &nbsp; <b>URL:</b> $url\n";
      $txt .= "<font color=\"". $CFG["firstrow_font_color"] ."\"><b>". $LANG["subject"] ."</b><b>". $LANG["url"] ."</b></font></td>\n";
}

// hhh - end date display function


After the very end of the original code.

Um, should I remove that code I added there, and put it at the end of the day_display code? Does it need to be present in BOTH codes? I think I had it in the day_display code at one point, but for some reason, I thought I needed to change it to to be present in date_display....I think.. I'm so confused at this point, I really do not remember what. (And thanks for being patient with me..)
_________________
--Sanguinarius
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    AbleDesign Forum Index -> MyCalendar Discussion All times are GMT - 5 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group


Home | Services | Pricing | Portfolio | About Us | Contact
Support | Programs | Purchase | Tutorials | Site Map

© 1999-2025 AbleDesign.com - Web Design that Can!