Adding Maps to the Wall - for BusinessPage, Group Home and User

Peter Lane Posted in Component Development 1 year ago

I see I may need to add a button (Put on Map) beside the current menu on Add (beside the Location input) for each of the container.php files (6) under OssnWall component and potentially add js to ossn_wall.php under default.plugins/js.

Do I need to create a new component for each file I need to change?

Replies
gb Peter Lane Replied 1 year ago

Thank you! I am beginning to understand how to develop round the system.

I know you were good enough to help to add Mapbox to the system to validate Location. However, I favour Leaflet, although it may not be as functional, it is free and does most of what me and my contacts want! The Location field does appear in many place, but I have found that it is possible to have callbacks upon the creation of relevant objects, like posts.

I wonder if it will be quicker and sensible to ask the user at the point if they want the item to appear on a map from my new component. I could then call a second component to show the map from where they would click to record the location., using a third component.

Do you see this as feasible? If so I would like to drop an error log to see values as the user progress develops. Where are such logs shown? Or do I have to use var dumps and halt processing to see the results?

Breton Rafael [redcrested.net] Replied 1 year ago

You're right about crash the entire system with a single misplaced variable :-)

When I started the customization of my first OSSN site, I choose the path of customizing the main components (OssnWall, OssnMessage, WhiteTheme, etc). It's 1000 times easier than develop a new component. However, it has consequences. Now I need to do a file-by-file review before upgrading, if needed on those components.

Today I prefer to write a new component to do what I need. I use this options to make the replacement:
- using JS to remove original items on running page and then insert my version of item;
- take the original file from component and use ossnunregister* (can be action, class, menu, menuitem or, page) or ossnunload* (can be js, css, externaljs or, externalcss) and then loading the customized version of the file.
- According to OSSN documentation, the ossn
register_callback function has priority parameter. The default value is 200. So you can use this in your component to overwriting some visual file. I'm using 300 on my components nowadays.

I'm sure I'm forgetting some any other way around the existent code on components. Maybe Arsalan and Michael have another tip.

gb Peter Lane Replied 1 year ago

I do realise that if I am not careful, I could hit problems related to the main system design. Also, upgrades to the Wall would cause me additional work, so I would carefully document my changes (which should not be too dramatic, but they seem to be additions rather than process changes). Thankfully I have a separate dev system.

gb Peter Lane Replied 1 year ago

It seems that there are more dependencies than I thought. Do you think it may be easier to replicate the whole OssnWall component, disable the main one and then make all the changes I need? Otherwise I may continually going back and forth.

Breton Rafael [redcrested.net] Replied 1 year ago

The best approach is create a new component with all files you that you need. You can put in JS a command to remove the default location button and add a new one with the menu.

gb Peter Lane Replied 1 year ago

I will also need to add a "Show Map" Button on the Post menu.