Reading and updating data from outside the widget - elementor

Is it possible to first request the data of some widget, and then update the data or add new ones?
Example: Product card widget. There are several of them on the page. I go to the admin panel and by pressing the button the data in all widgets is updated based on those received from other sources (API of a third-party site). In short, the synchronization of data in some widgets based on some data received from another site.
Whatever the manager manually checks, does not waste time changing prices, the availability of balances based on data from a friendly site, from where I get the data.
How can one read widget data on some page via PHP?

Related

Wagtail MultiSite - Cross posting content

I am currently building two sites out of a single Wagtail installation. The sites are for a company and it's sister company and there is some overlap in content. Ideally we don't want to have to post the same content twice. In particular we have an Events page on both sites and there may be events that are relevant to both companies.
The problem is that a Wagtail page can only exist in one place in the tree at once. I have considered creating a "MirroredEventPage" model with only one foreign key field to the original EventPage model, although this approach has it's problems when it comes to writing the EventIndex page and reusing templates.
I've also considered creating Events as a vanilla Django model which isn't ideal either.
Has anyone had a similar issue and found a good solution?
An idea would be to use a mix of using Wagtail Snippets and the RoutablePageMixin on your Events Index Pages.
1. Make an Events Snippet
Make the shared content of your Events page into a Wagtail Snippet. You will loose the ability to access versions of changes but gain the ability to share across sites.
http://docs.wagtail.io/en/v1.13/topics/snippets.html
2. Update your Events Index page model to use the RoutablePageMixin
http://docs.wagtail.io/en/v1.13/reference/contrib/routablepage.html
You can then hook into the URL calls for any of the Events Index pages if they have something like mydomain.com/events/123-event-name-as-slug. This can load a custom template (which can be shared or not, depending on the site), with the events index and the event snippet sent via the context.
These URLs will be their own unique URL but not actually have a page behind them. Remember to consider your SEO implications, ensure that the admin editors can manage things like meta description on the snippet (or work through how that will propagate automatically).
You can also hook into the Wagtail button (called Wagtail Userbar) so that when editors click the front end Wagtail button and click 'edit Event' it can take them directly to the Snippet editing page in admin.
http://docs.wagtail.io/en/v1.13/reference/hooks.html#construct-wagtail-userbar
3. Update Events Index Listing
If there are some events you do not want on both sites, you could add checkboxes (both ticked by default) for the two sites you operate. This means the Events Index page will only show the events relevant to that site.
You can do this by overriding the serve method on the page model.
Note: In this example you are not explicitly linking each and every event to each site's event index page. You are simply loading a query of relevant events and passing it to the events index template.
4. More Complex Integration
If you really want an individual page for each 'Event' under each site, you could create a custom signal on Snippet create/edit/delete.
Intro to Wagtail Signals:
http://docs.wagtail.io/en/v1.13/reference/signals.html
You would want to ensure that the fields are non-editable on the Page edit, but would be editable under snippets. Then you just keep things in sync with your signals, bit messy but gives you an actual 'Page' in the Admin.

Silverlight Refresh data

I don't know what is the best way to force a browser refresh when using silverlight.
The scenario is like this:
We have a silverlight application hosted on IIS
Two users opens the same page and that page contains a grid with some records.
Only one of the users modify one record and save the data in the database
How can the other user see that the data has been modified unless he refreshes the page manually?
Should I implement some automatic refresh?
Thanks in advance
I would think long and hard about the requirements here before you open up a can of worms. Is the grid editable? With the automatic refresh idea what happens to the user who is in the middle of an edit? Think about alternatives. Could you possilbly check whether the data has changed at the point of saving data and then provide an appropriate message to the user? If you want the data to automatically refresh you are going to get into looking at server to client notifications e.g WCF duplex calls or constant polling and refreshing of the underlying bound observablecollection

How do I tackle ordered text widget on multiple pages in cakephp

Hey guys. so I'm not quite sure how to tackle my next big problem in this project.
I want to create an admin interface which allows my client to create a dynamic menu page for the food and drinks. Basically, I want him to be able to enter a short paragraph for the top of the page, and then 2-6 widgets that he can drag and drop onto the page. This menu will then render under owlhouse.com.au/food. I figure it'll be something to do with associations, but I have no idea how to construct a function which attaches dynamic data to the page on the fly.. and keep it in the layout the client wants (2 columns, diff modules for beer, wine, etc.)
HOW ON EARTH DO I GO ABOUT THIS?
thankyou,
~Harley
Dynamic Data
Build a "CRUD" interface that the client can log into. (Think blog entries). Store the content in the database (of course). Then provide a drag & drop interface that allows the client to order them, assign them to pages, or whatever is needed to meet the requirement. When the client clicks update, you simply add/remove IDs to the content for the given page. When the page loads (like a blog page) it loads the content for the given IDs.
Widgets
The same would apply for widgets. I would build an element that provides the basic layout for the widget. Then build it the same way as the content. The client will have CRUD functionality with drag & drop interface to show which widgets are displayed.
Send me a PM if you need to hire someone. ;)

iPad best practice to keep backend data model

I am developing iPad application,
A set of forms that user has to fill (roughly 500 text fields).
The form fields are displayed in a UITable view.
Once user fill the forms he/she can uploaded the data to the server.
Until its uploaded, the data should be persist in a temporary location in the local disk.
In my application design, I am using NSMutableDictionery, which is always being updated when the user updating the forms.
What is the best way to keep save NSMutableDictionery in the local disk.
SQL Lite or PList ?
/chatcja
If you are only ever saving one form at a time, a plist would be fine. If you would ever have the need to store multiple instances of the form and need to find them based on user-generated contents, using a more sophisticated storage mechanism like SQLite or CoreData would probably be more appropriate.

How to layout a subscriptions database (like youtube)?

Like youtube, i have a usertable, a table with objects (videos) and a table with categories.
Now, I want a user to be able to subscribe to a category, but how do I do this effectivly? I would need a table for keeping track of which categories a user subscibes to (many-to-many relationship), but I also need to keep track of which objects (videos) that a user hasn't watched yet, so how do I do that?
Just have another table that tracks which videos a user HAS watched. Then when selecting which videos to show to the user check them against the watched video table to make sure they haven't seen it yet.
You can then also use this table to show the user a list of all videos they have watched, or display a complete list of which videos are currently being watched on the site etc.
Why not use RSS? That way, a user can manage their own subscriptions and you don't have to store all the subscription info and then run a process based on these subscriptions. Their RSS reader will take care of that for you.
This CodeProject article has some details about how to serialize your classes into RSS.

Resources