Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with 2 time the same widget (Trac #590) #590

Closed
elgg-gitbot opened this issue Feb 16, 2013 · 3 comments
Closed

Problem with 2 time the same widget (Trac #590) #590

elgg-gitbot opened this issue Feb 16, 2013 · 3 comments

Comments

@elgg-gitbot
Copy link

@elgg-gitbot elgg-gitbot commented Feb 16, 2013

Original ticket http://trac.elgg.org/ticket/590 on 38903919-11-18 by trac user SGr33n, assigned to unknown.

Elgg version: 1.1

Hi,

Try to insert two times the status widget on a profile page (or the dashboard), then try to set a new status. The Status will work strange after this.

It would be nice to prevent the user install 2 times the same plugin on the same page (profile or dashboard).

Thanks :)

@elgg-gitbot
Copy link
Author

@elgg-gitbot elgg-gitbot commented Feb 16, 2013

trac user costelloc wrote on 39003343-10-09

To reproduce: add a widget to your dashboard, save, edit page again and add that same widget. Some widgets show some bad behavior when more than one exists on a page. The twitter widget is an example of that. The description above says the status widget is another.

The problem is that the multiple variable is not being used to prevent multiple widgets from being added to a page when a user edits a page more than once. views/default/canvas/layouts/widgets.php (or a function in the engine) would need to check what current widgets are on the page and then remove those from the widget list that have the multiple variable set to false.

@elgg-gitbot
Copy link
Author

@elgg-gitbot elgg-gitbot commented Feb 16, 2013

trac user costelloc wrote on 39005364-08-16

I just noticed that this is the same as #472.

Also, I wouldn't describe this as trivial for 2 reasons:

  1. This can create some very strange behavior with widgets and there is not anything that plugin developers can do about it.
  2. It points out there are some incomplete portions of the widget handling code. Even if the multiple flag is set in the widget handler array, it isn't used for anything as far as I can tell. If a plugin sets the multiple flag to true, a user still can't add that widget to a profile page more than once in a edit page session. (Tested with 1.2)

Related bug in views/default/canvas/layouts/widgets.php:

<input type="hidden" name="multiple" value="<?php if ((isset($widget->handler)) && (isset($widgettypes[$widget->handler]->multiple))) echo $widgettypes[$widget->handler]->multiple; ?>" />

The above doesn't work since a widget doesn't have a variable named handler. It should be:

<input type="hidden" name="multiple" value="<?php if (isset($widget->multiple)) echo $widget->multiple; ?>" />

The same goes for side and main hidden inputs but those might be vestigial code anyway since the profile and dashboard are 3 column.

@elgg-gitbot
Copy link
Author

@elgg-gitbot elgg-gitbot commented Feb 16, 2013

trac user marcus wrote on 39005491-09-12

Well spotted, closing this in favour of #472.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant