We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    Ok, thanks. Then I guess it’s just a matter of figuring out the argument lists and setting up the right user groups. And the template structure.
      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
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I am somewhat puzzled. managerGroupsAllowed is true by default. Does this refer to MODx manager groups, or to the fact that calendar manager groups are allowed, and you then need to supply the list of allowed MODx web user groups that will act as calendar manager groups?
        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
        Default, manager with index 1 will be able to administered the calendar. Then if you want other manager to have that access too, than you need to assign the user to the same document group with the calendar as well, for them to be able to admin the calendar.

        For the webuser, you need to assign them to any group that you want, but you need to call the web group that the user assigned to in the snippet to have an admin right, if it’s not setup in the snippet, than they won’t have any access to the administration part on the calendar.

        If you want to make the calendar hidden, just assign the document group for the calendar to a specific web group, and assign the allowed people for viewing the calendar to the same webgroup, but don’t call this webgroup on the snippet, so they won’t have access to the calendar administration on the frontend.

        It’s a little bit complicated, because we have 2 user base account, but so far it will make more sense when you guys already use it. I use the same Auth API that I build for my snippet, always. So if you guys try out the newsletter snippet, it will work the same way. Same thing with my future snippet I believe.

        Thanks for trying it out susan and garryn.
          Wendy Novianto
          [font=Verdana]PT DJAMOER Technology Media
          [font=Verdana]Xituz Media
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          So let me make sure that I have this right: Only MODx manager user 1 can automatically manage the calendar. If I log in to the MODx manager as any other manager user, I would also have to be logged in as a web user of one of the specified web user groups?
            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
            Nope, you don’t have to login twice as both manager and web user. If your web user being assigned to a group, than all you need is defined that group on the snippet calling. Then all the users inside this web group will have admin rights.

            If you want to make role based system, you can do that as well, just look on the snippet code, you will find a line where I have the object called a function to allow manager access before displaying the calendar. If yu call this function before displaying the calendar, then it will sho up the administration view, if it’s not being called at all, then the user won’t have admin priviledge.

            Have fun tweaking it to your needs. The snippet is just a way to communicate on MODx, while the real work is being done by the class. As long as you understand the way how the class work, you can actually create a simple snippet call a month calendar to be displayed on the side of your website for example. The data for the calendar can be extended as well, for you to fetch the ata from document on MODx or iCal maybe or even text files. I try to make it as flexible as possible, so feel free to judge the code and ask me any question you have.

            Thanks
              Wendy Novianto
              [font=Verdana]PT DJAMOER Technology Media
              [font=Verdana]Xituz Media
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Heh. Already did that. Set it to use role = 1 instead, so that any Manager full admin user works.

              Now...I got it to show me the manager forms, but they don’t seem to be doing anything. I presume "db" means that it will use the database table I created.

              I am pestering you so much because I’m documenting this as I go along, and want to make sure I know exactly what’s going on so I can better explain it.
                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
                • 6726
                • 7,075 Posts
                Wendy, I finally have time to install your snippet...

                I just have a problem with the SQL, I get an error : #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’’ at line 27

                CREATE TABLE `modx_dbcalendar` (
                  `calendardbid` int(11) NOT NULL auto_increment,
                  `datebegin` date default NULL,
                  `dateended` date default NULL,
                  `timebegin` time default NULL,
                  `timeended` time default NULL,
                  `description` varchar(255) default NULL,
                  `details` text,
                  `pageid` mediumint(9) default NULL,
                  `category` varchar(255) default NULL,
                  PRIMARY KEY  (`calendardbid`)
                ) ENGINE=MyISAM DEFAULT;


                I am running MySQL 4.1.14 here... any thoughts ?

                I have tried the alternative TYPE=MyISAM DEFAULT; but it changes nothing...

                Thanks !
                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l'outil id
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  I don’t think "myisam default" goes together like that, does it? I think that "default" should go with "default charset= " or something.

                  http://dev.mysql.com/doc/refman/5.0/en/create-table.html
                    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
                    Hemm.. Try to create your own table then, and set the column name the same as above. I just MySql dump from phpMyAdmin, and I didn’t alter any code at all.

                    Hope it works.

                    @Susan, yes db mean that you want to create a new event data to be inserted on the database. When we have other option, we can ical for example, than we will create a new event on the ical as the data source. I haven’t got any chance to make this looks much better, and showing a list of available data backend. We still need to work on that.

                    Btw, if you can’t see the evnts that you added, you need to clear the cache on the cache folder. I assume the cache system is broken for some reason, and I haven’t got a time to look into it yet. If you want to look into the cache mechanism, check the db class. It suppose to clean up the corresponding cache, when you add/delete/update an event, but it doesn’t clear up the cache files at all, after I make a major overhaul in separating the data layer and the calendar viewing layer.

                    Hope you know what’s the problem.

                    One more thing, can you post the modification that you made for user role 1, instead of user 1? I will add this to the next release of all my snippet smiley Thank you Susan
                      Wendy Novianto
                      [font=Verdana]PT DJAMOER Technology Media
                      [font=Verdana]Xituz Media
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Clearing the cache fixed the problem just fine. I’ll see if I can find where adding or editing is supposed to clear the cache, and maybe see if I can fix it.

                      I just changed the part in line 199

                      	if($_SESSION['mgrInternalKey'] == 1)
                      


                      to say ’mgrRole’ instead. I’m toying with the idea of adding another snippet argument for roleId, then have it be

                      	if($_SESSION['mgrRole'] == 1 || $_SESSION['mgrRole'] == $roleId)
                      


                      That way you could create a role just for calendar management. Now if there were a way to add permissions to the ones available for roles, you’d only have to check for manageCalendar permission in the SESSION.
                        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