We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1764
    • 680 Posts
    That is strange. I have a couple of ideas of what it could be but I’m at work now so I’ll have to wait until I get home tonight before I can look at it.

    I didn’t have any time to test the files I posted last night, they were meant mostly as an example of my thinking as to how to handle the caching issue, so there are probably still a few problems to work out.

    I’ll try to get to commenting all my code soon so that it’s not so difficult to wade through.
      • 34162
      • 1 Posts
      I did not look over your javascript or your css very closely but how about if you just add the id to the elements that you add to the page that way we can style it however we want. Also that would allow each admin to decide how he wants ot display the editable areas.

      One more note on this. I can already tell you what makes the pages act up. I have not looked at the javascript but with allot of css layouts not everything works well together so when the layout is cahnged by the css you add and then the css is used to modify the content it does not get along well all the time.

      So like I and ryan mentioned above jsut adding a div with an id and letting us decide how to style the content would work the best and would also be more compatable with layouts that use allot of css for positioning and whatnot.

        • 1764
        • 680 Posts
        There is a tv_edit class on every link but the difficulty is it’s not purely css. If you want to highligth the parent document you have to do it through the javascript parent object. Unfortunately you can’t just define a style in javascript as easily as you can in CSS. Or if you can, I don’t know how.

        In the javascript you have to define each CSS property you want to override, grab the elements current properties, override the properts and then revert the properties when the user mouses out. If there was a parent selector in CSS this would all be very simple but there isn’t. I might be able to write some code to simplify it into some sort of a js config file, I’ll look into it.

        Maybe the best option would just be a simple on/off option for parent highlighting?
          • 34162
          • 1 Posts
          Yes I know the real issue here is being able to support hover on an element that is not being hovered over. I do know javascript fairly well but have not had time to really look at your code and my javascript is rather rusty as I have not used it for a while.

          I would be interested to see how you work it out and I rather like it already thanks for your work on this.

          I wasn’t ignoring you about my site and a login I jsut didn’t get back to this thread for quite a while. Thanks again.
            • 1764
            • 680 Posts
            Okay, another update. I’ve fixed quite a few of the things that have previously been mentioned in this thread and others. Here is a short "changelog"


            • Permissions should be working 100% now

            • Caching issues should also be fixed including the template duplication issue that Dimmy had.

            • There is CSS in place to automatically hide the edit links for printing

            • A black font color is forced for highlighted parents to fix visibility issues

            • I have changed the format for specifying editable content to [*#tvname*]. [#tvname#] and [*tvname:editable*] will no longer work.

            • It is now simpler to implement custom styles for the edit links/highlighting although it still requires editing the php code.

            • Locking should be working. I had to add another action (307 for cancel frontend edit) and processor file (cancel_tplvar.processor.php) to make the locking work. It should also be noted that if you edit one TV the entire document is locked, not just the TV. We may want to change this in the future but it would probably require some changes to the core.

            • I have stated commenting on the code but still have some more things to cover.

            To do list..


            • Finish up commenting on the code

            • Implement basic manager theme support

            • Implement multi-lingual support

            On the extended to do list is converting it all to a plugin but that will probably have to wait until the next preview release.

            Is there anything else I’m missing? In the next release I will probably also include a snippet for editing hidden content like pagetitle, description etc. and include a manager login/logout snippet to be used for frontend logins.

            Hopefully this will take care of most of the weird bugs that some people have been experiencing. Let me know if you discover any other bugs. Thanks to everyone who has helped me with testing and advice. I think we’re very close to having a production worthy solution.
              • 7455
              • 2,204 Posts
              Nice work it works like a charm now
                follow me on twitter: @dimmy01
                • 1764
                • 680 Posts
                Here’s one more update to the frontend editor. I realized that I wasn’t donig anything about the rich text option. So now the rich text option will toggle between a textarea and richtext editor in the frontend also.

                edit_tplvar.dynamic.action.php is the only file that has changed so there’s no need to overwrite the other files if you have version 3 of the hack.

                  • 18397
                  • 3,250 Posts
                  Works great now. Thanks for the great code!

                  Any progress on

                  There is no way to edit those fields that don’t acutally appear visually on the page such as pagetitle and description (usually) but that would be a very simple snippet that I will throw together sometime.
                    • 1764
                    • 680 Posts
                    Okay, I’ve been working on turning the frontend editing hack into a legitimate module. Here is what I have so far. As far as I can tell everything is working fine. Editing a TV through the frontend will not lock the document, I should probably fix that down the road but I will probably just wait for an improved locking system.

                    The installation is a bit involved. Once we get an installer system worked out it should be very simple though. Here are the installation instructions...

                    1. Copy the QuickEditModule folder into the /assets/modules/ folder.
                    2. Run the SQL code below to create a new
                    3. Overwrite your document.parser.class.inc.php file as mentioned below
                    4. Copy the contents QuickEdit.module.php to a new module called QuickEdit
                    5. Check Enable parameter sharing on the Configuration tab
                    6. Copy the Parameters string from the module comments to the Parameters field
                    7. Copy the contents QuickEdit.plugin.php to a new plugin called QuickEdit
                    8. Check OnParseDocument and OnWebPagePrerender on the System Events tab
                    9. Edit the QuickEdit module again and add a dependency to the QuickEdit plugin
                    10. Edit the QuickEdit plugin again and choose QuickEdit from the Import module shared parameters list on the Configuration tab

                    There is still a hack required to the document.parser.class.inc.php file. The hack adds a OnParseDocument event that will be included in the next release. If you have Pre 3.1 installed you can just copy the document.parser.class.inc.php file below over your existing file. Otherwise look for my HACK comments.

                    I’ve also included a manager login snippet I wrote a while ago which compliments the frontend editing nicely.

                    Give it a try and let me know how it works. This is the first module I’ve actually written so if I’m way off on anything, please let me know. If you have any problems or questions feel free to PM or email me.

                    SQL to add the OnParseDocument event (you may have to change the table prefix from the default modx_):
                    INSERT INTO `modx_system_eventnames` ( `id` , `name` , `service` , `groupname` )
                    VALUES ('', 'OnParseDocument', '5', '');


                    UPDATE:
                    I updated the ManagerLogin snippet. I had it using PHP_SELF instead of REQUEST_URI in the form action. Doh! rolleyes
                      • 1764
                      • 680 Posts
                      Quote from: Mark at Aug 11, 2005, 01:19 AM

                      Works great now. Thanks for the great code!

                      Any progress on

                      There is no way to edit those fields that don’t acutally appear visually on the page such as pagetitle and description (usually) but that would be a very simple snippet that I will throw together sometime.


                      I just posted the plugin code I’ve been worknig on, which had taken up most of my coding time this last week. I’ll spend some time working out some bugs in the plugin and then I’ll work on the snippet for editing hidden content. After that I have a few modules/plugins I’ve been thinking about working on but more on that later grin