We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32241
    • 1,495 Posts
    Quote from: sottwell at Feb 03, 2006, 09:49 AM

    You could have the data source specified in the snippet tags with an argument, since a given calendar will be using a given data source. That would get it off the user interface and out of the user’s mind so he doesn’t have to stop and think about it every time he wants to make an entry.

    The only thing that still under development is the decision to have this different data sources to be combined together or not.

    I’ll start a little explanation of what I’m trying to accomplish in here. So far every calendar system is tight on one data source and basically the whole logic of displaying calendar is being tight together with the whole logic of retrieving the calendar data. To make a different kind of calendar, so that it looks unique I come up with this architecture.

    The whole calendar system is build on 2 different entity/engine.
    1. Calendar viewing engine
    2. Data source engine

    Both of this engine being combined by the snippet calling. FOr whatever need to be displayed on the calendar viewing engine need to be formated in certain way for it to be able to view it. So for display purposes, this will be the class/entity that needs to be hacked/modified.
    In terms about Data source engine, it’s all depend on the creator. IF you guys come up with a different data source backend for accessing data from access database for example, then all you need to do is change the snippet calling to connect both engine. One thing to note though, the data source engine always have to be able to return the right array format for the calendar viewing engine.

    Now the concern is when administering the data source. Basically it’s being done on Calendar viewing engine, but it needs to inter connect with data source engine, which in my opinion it’s suppose to be combined on the snippet, but I’m still haven’t got any idea on how to combine this nicely, instead of setting a pre-defined format, such as having a popup editor, and using that ugly alert box to pick and choose the reight data source engine to be edited. For now, that’s what I came up with, when you create new, it will always display that box, unless if you guys willing to hack into the Calendar viewing engine and makes it looks much better.

    To answer your concern of setting up calendar for different users, you can actually modified the snippet, without having to hack into the calendar class.
    Setup calendars on different pages, so they all will have their own data isolated from one another. Then create a new snippet which looks the same with the provided snippet, and change the data source to use multiple database source from different documentid. You might need to pass the document id that you have for each calendar and repeat it for each document id. You can also extend the method/function on data source engine for db that is called fetchData(&$data, $month, $year, $filter=’’). Overwrite the function to fetch the whole database, eliminating filtering for pageid. Use the extended class on the snippet, instead of the original one.

    Hope it’s now clear to all the coder ou there on how to extend this calendar beyond what most calendar system can do. I was hoping this flexibility can encourage all the coder out there to improve the system. I know the price of flexibility will be a complexity, like what we have right now with MODx, but it’s minimal, comparing to the amount of work that can be done.

    Regards,
      Wendy Novianto
      [font=Verdana]PT DJAMOER Technology Media
      [font=Verdana]Xituz Media
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I still don’t see why, on setting up a calendar on a page, it can’t have &dataSource=`db`. Then the snippet would pass this value on when loading up the classes, and it would already know which data source to use. Then, if you also have &dataSource=iCal, or &dataSource=file along with &dataPath=path-to-files (&dataPath could also be used to specify a table name if the dataSource is db) and pass those values to the class constructor, it’s all already available for the classes to work with.

      Can you imagine having, say, my homework app, and the teachers logging on to enter their assignments have to know this? I’ve already had enough experience with clients to know that there is no way it would ever fly.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 32241
        • 1,495 Posts
        I see your point. I never thought of that, because I’m so concern about the flexibility of the system. I will re-overhauled this calendar snippet again for the next release 0.3 with a whole different templating system. So for now, it will be best if you check the calendar.class.php, and set the javascript for header admin not to display the prompt box, instead it will directly open the popup editor with the right data source editor file.

        Thanks for the input, I will make sure to include this extra option on the next release for the snippet calling parameters.
          Wendy Novianto
          [font=Verdana]PT DJAMOER Technology Media
          [font=Verdana]Xituz Media
          • 17282
          • 283 Posts
          great snippet .. and just what im looking for for bands tour page ...

          Ive got it installed .. and appearing properly etc .. ive put the fixed document.parser.class.inc.php file in place ... and it all works EXCEPT! im not getting ANY POPUPS at all .. non .. makes managing a bit hard .. any ideas what ive done wrong ?

          thnx smiley

          Martyn
            Everytime you use Flash ... a puppy dies .....
            R.G Taylor
            • 17282
            • 283 Posts
            Oh this is AWESOME .. got it all fixed templated and working .. customer LOVES it well done ....


            one question .. is it possible to make the dates in the popups appear in this format : day month year ... ie : thursday 20th November 2006 ?
              Everytime you use Flash ... a puppy dies .....
              R.G Taylor
              • 17282
              • 283 Posts
              Ok couple of small what i presume are leftovers from earlier development :

              the code from lines 212 to 216 is :
              // Default $tplYearAdmin
              	var $tplDefaultYearAdmin = '
              <a href="javascript:;" {+ButtonEdit+}><img src="assets/modules/dbcalendar/images/icon_edit.png" alt="Edit Event" border="0" /></a>
              <a href="javascript:;" {+ButtonDelete+}><img src="assets/modules/dbcalendar/images/icon_del.png" alt="Delete Event" border="0" /></a>
              ';
              


              i may be wrong so someone correct me if i am but ive changed this to :
              	// Default $tplYearAdmin
              	var $tplDefaultYearAdmin = '
              <a href="javascript:;" {+ButtonEdit+}><img src="{+ModPath+}/images/icon_edit.png" alt="Edit Event" border="0" /></a>
              <a href="javascript:;" {+ButtonDelete+}><img src="{+ModPath+}/images/icon_del.png" alt="Delete Event" border="0" /></a>
              ';
              


              changed file attached
                Everytime you use Flash ... a puppy dies .....
                R.G Taylor
                • 32241
                • 1,495 Posts
                Lizard, thanks for the fix and liking the snippet.

                Sorry for not taking care of this snippet. Actually, I’ might back of a little bit on this, because I will do a REALLy2 major overhaul on the templating system again, and the way to make sure that this calendar will fit into MODx addon by not makeit too bloated, which most calendar system out there does. I will commit myself in making a usefull addon for MODx, so stay tune until I get my life back and able to cntinue working on this, but so far this calendar works and serve its purpose for one of my client.

                Feel free to make discussion, post suggestion, make a fix, and etc. I will surely appreciate those, especially if you decided to make the data source integration a lot more flexible.

                To answer your data fomrating question, that’s one of the major drawback in the current templating system, but you can hardcoded it into the calendar.class.php to output the format that you want.
                  Wendy Novianto
                  [font=Verdana]PT DJAMOER Technology Media
                  [font=Verdana]Xituz Media
                  • 17282
                  • 283 Posts
                  Quote from: Djamoer at Feb 20, 2006, 01:00 PM



                  To answer your data fomrating question, that’s one of the major drawback in the current templating system, but you can hardcoded it into the calendar.class.php to output the format that you want.

                  i could ..... if i had any clue how smiley

                  like ive stated before .. im a php retard

                  im gettin gto the point where i can read easier bits php and see what they do .. but as for writting it .. not a clue smiley

                    Everytime you use Flash ... a puppy dies .....
                    R.G Taylor
                    • 32241
                    • 1,495 Posts
                    Quote from: Lizard at Feb 20, 2006, 03:03 PM

                    i could ..... if i had any clue how smiley

                    like ive stated before .. im a php retard

                    im gettin gto the point where i can read easier bits php and see what they do .. but as for writting it .. not a clue smiley

                    Cool, then I’ll show you another trick to hack somebody else script to do what you want it to do wink Hope this will be helpful to you in the long run.

                    First you know that there has to be a statement in the program that will do the replacement of the template variables, and it’s suppose to look the same for all the variables, or it might slightly different, but the whole point it, it will have the same look and syntax. Usually I’ll look into a variable name that looks awkward and easy to be searched through the code. I might tried {+NextMonthLink+}, and for sure you won’t find any clue, because it only appears in the template. So my second attempt will be to eliminate the {++} prfix and suffix. Now I found this line of statement which suppose to be explainable.

                    $this->setTemplateVar(’NextMonthLink’, $nextMonth);
                    You can see that it basically call setTemplateVar
                    So I will look for that function on the code and I found a group of function to do the templating. So now I know that when the system call setTemplateVar, it will substitue the name of the var with specific data being passed on the second parameter. By knowing all this, I will get back to my plan, which is intercept the process before outputing the data into template var, so you can format it to whatever that you want.

                    Look for whatever template variable with this
                    $this->setTemplateVar(’var_name’
                    or you can use (notice the quote, because it’s identical with single quote)
                    $this->setTemplateVar("var_name"

                    Well it seems easy to me, because I build the code, lol. But when you look at someone else code, you’ll find this kind of habit to be quite usefull. You don’t have to understand the whole templating system in my calendar snippet work, but you can understand small little bit of it to change the current workflow into what you want this thing to do.

                    Let me know if you got stuck, then I will let you get the cheatsheet. grin

                    Here is a quick hint

                    For the month header formating on year view
                    	// Default $tplYearMonth
                    	var $tplDefaultYearMonth = '
                    <div>
                    <span><a href="{+MonthLink+}">{+Header+}</a></span>
                    </div>
                    {+Content+}
                    ';
                    


                    For the month header formating on month view
                    	// Default $tplMonth
                    	var $tplDefaultMonth = '
                    <div style="width:800px;">
                    <div style="margin:10px;">
                    <div style="float:left;"><a href="{+PrevMonthLink+}"><img src="{+ModPath+}/images/icon_prev.png" alt="Previous Month" border="0" /></a></div>
                    <div style="float:right;"><a href="{+NextMonthLink+}"><img src="{+ModPath+}/images/icon_next.png" alt="Previous Month" border="0" /></a></div>
                    <div style="text-align:center;"><a href="{+MonthLink+}" style="font-size:16px; font-weight:bold; color:#000; text-decoration:none;">{+Header+}</a></div>
                    </div>
                    {+Content+}
                    </div>
                    ';
                    


                    For the day header formating on day view
                    	// Default $tplDay
                    	var $tplDefaultDay = '
                    <div class="date"><span><a href="{+PrevDayLink+}"><<</a></span> {+Year+}-{+Month+}-{+Day+} <span><a href="{+NextDayLink+}">>></a></span></div>
                    <div class="daylist">
                    {+Content+}
                    </div>
                    ';
                    
                      Wendy Novianto
                      [font=Verdana]PT DJAMOER Technology Media
                      [font=Verdana]Xituz Media
                      • 4095
                      • 372 Posts
                      Hey Wendy, can this snippet output a list of events and all events based ona catagory. not just day, month & year?

                      Also does the Flexisearch find events? my guess is it wont as it’s in a seperate area of the database, but there needs to be some way to search for events.

                      Cheers.

                        [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
                        Admin Sandbox Login: sandbox Password: castle