pyclient does not delete deleted schedules

Bug #673936 reported by Andrea
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Xibo
Fix Released
Low
Alex Harrington

Bug Description

Hi! I don't know if this is a bug, but I suppose so.
When a schedule is deleted from the web interface,
pyclient keeps showing it if it is the last schedule.

I think to have understood the reason.
In XmdsScheduler.run():

            if self.previousSchedule != schedule:
                self.previousSchedule = schedule
                doc = minidom.parseString(schedule)
                tmpLayouts = doc.getElementsByTagName('layout')
                defaultLayout = doc.getElementsByTagName('default')

                # Parse out the default layout and update if appropriate

                for l in defaultLayout:
                    layoutID = str(l.attributes['file'].value)

                    try:

                        if self.__defaultLayout.layoutID != layoutID:
                           self.__defaultLayout = XiboLayout(layoutID,True)
                    except:
                        self.__defaultLayout = XiboLayout(layoutID,True)

                newLayouts = []
                for l in tmpLayouts:
                    layoutID = str(l.attributes['file'].value)
                    layoutFromDT = str(l.attributes['fromdt'].value)
                    layoutToDT = str(l.attributes['todt'].value)
                    layoutPriority = int(l.attributes['priority'].value)
                    flag = True

                    # If the layout already exists, add this schedule to it
                    for g in newLayouts:
                        if g.layoutID == layoutID:
                            # Append Schedule
                            g.addSchedule(layoutFromDT,layoutToDT,layoutPriority)
                            flag = False

                    # The layout doesn't exist, add it and add a schedule for it
                    if flag:
                        tmpLayout = XiboLayout(layoutID,False)
                        tmpLayout.addSchedule(layoutFromDT,layoutToDT,layoutPriority)
                        newLayouts.append(tmpLayout)
                        scheduleText += str(layoutID) + ', '

                    # Swap the newLayouts array in to the live scheduler
                    self.__lock.acquire()
                    self.__layouts = newLayouts
                    self.__lock.release()

                    log.updateSchedule(scheduleText)
            # End if previousSchedule != schedule

the instructions:
self.__lock.acquire()
self.__layouts = newLayouts
self.__lock.release()

are placed in the loop "for l in tmpLayouts:", so they are executed
only if there is at least one layout in the schedule, event that doesn't
happen if there is only one schedule and it is deleted before its
natural end.

I solved it by de-indenting them.

By the way I have done a modification in the server too, since
I found annoying the labels in layout design page, so I tried to hide it,
unless the mouse enters in the region.

I don't know its browser compatibility, but if you find it useful you can
do whatever you want with it.

Related branches

Revision history for this message
Andrea (magnetto-andrea) wrote :
Revision history for this message
Alex Harrington (alexharrington) wrote :

Hi Andrea

That all looks right to me - I'll make sure it's fixed in the next release.

As to your stuff on the server, it would probably be better either logged as a separate bug or perhaps mailed to <email address hidden> so Dan can take a look at it.

Alex

Changed in xibo:
status: New → Confirmed
assignee: nobody → Alex Harrington (alexharrington)
importance: Undecided → Low
milestone: none → 1.2.1
Revision history for this message
Alex Harrington (alexharrington) wrote :

I've committed that in to the 1.2.1a1 branch.

Thanks for taking the time to report it and figuring out what was wrong!

Cheers

Alex

Changed in xibo:
status: Confirmed → Fix Committed
Revision history for this message
Rui Bernardino (rui-bernardino) wrote : Re: [Bug 673936] Re: pyclient does not delete deleted schedules

Hi,

The nav buttons won't auto-hide, I think you forgot to include something.
Anyway, I fixed it by adding 'Hidden' to the 'Nav buttons' class definition
on 'layout.js' to:
// Create the Nav Buttons
$('.previewNav',this.previewElement)
.append("<div class='prevSeq Hidden' style='position:absolute; left:1px;
top:"+ arrowsTop +"px'><img src='img/arrow_left.gif' /></div>")
.append("<div class='nextSeq Hidden' style='position:absolute; right:1px;
top:"+ arrowsTop +"px'><img src='img/arrow_right.gif' /></div>");

Thanks!

On Thu, Nov 11, 2010 at 9:52 AM, Andrea <email address hidden> wrote:

>
> ** Attachment added: "hidden_layout_info.txt"
>
> https://bugs.launchpad.net/bugs/673936/+attachment/1729888/+files/hidden_layout_info.txt
>
> --
> pyclient does not delete deleted schedules
> https://bugs.launchpad.net/bugs/673936
> You received this bug notification because you are subscribed to Xibo.
>

Revision history for this message
Andrea (magnetto-andrea) wrote :

Yes, you're right I forgot to include it, but it is exactly what I have done.

Thank you
Andrea

Revision history for this message
Dan Garner (dangarner) wrote :

Thanks for your efforts!

Always showing the nav buttons was deliberate as some users found that them appearing and disappearing was annoying, also the code to show/hide them did not appreciate drag and drop on the region itself (it created some sort of event chain that caused the buttons to flash).

Does your version have these same side effects? If not, I'd be more than happy to include it!

Revision history for this message
Andrea (magnetto-andrea) wrote :

As far I can see, there is no such effect. But I have tested it only with
firefox and chrome I've no idea about how it behaves with IE and older
versions of browsers.

The only problem is that Type/Duration and Sequence labels remain
hidden when you change the item, since this code is modified by
javascript and I did not touch it.

Revision history for this message
Alex Harrington (alexharrington) wrote :

Sharpio: please could you put the link back to the branch and refrain from
deleting the link in future.

Alex
On 25 Nov 2010 21:31, "Sharpio" <email address hidden> wrote:
> ** Branch unlinked: lp:~alexharrington/xibo/pyclient-1.2.1a1
>
> --
> pyclient does not delete deleted schedules
> https://bugs.launchpad.net/bugs/673936
> You received this bug notification because you are a member of Xibo
> Maintainters, which is the registrant for Xibo.
>
> Status in Xibo Open Source Digital Signage: Fix Committed
>
> Bug description:
> Hi! I don't know if this is a bug, but I suppose so.
> When a schedule is deleted from the web interface,
> pyclient keeps showing it if it is the last schedule.
>
> I think to have understood the reason.
> In XmdsScheduler.run():
>
> if self.previousSchedule != schedule:
> self.previousSchedule = schedule
> doc = minidom.parseString(schedule)
> tmpLayouts = doc.getElementsByTagName('layout')
> defaultLayout = doc.getElementsByTagName('default')
>
> # Parse out the default layout and update if appropriate
>
> for l in defaultLayout:
> layoutID = str(l.attributes['file'].value)
>
> try:
>
> if self.__defaultLayout.layoutID != layoutID:
> self.__defaultLayout = XiboLayout(layoutID,True)
> except:
> self.__defaultLayout = XiboLayout(layoutID,True)
>
> newLayouts = []
> for l in tmpLayouts:
> layoutID = str(l.attributes['file'].value)
> layoutFromDT = str(l.attributes['fromdt'].value)
> layoutToDT = str(l.attributes['todt'].value)
> layoutPriority = int(l.attributes['priority'].value)
> flag = True
>
> # If the layout already exists, add this schedule to it
> for g in newLayouts:
> if g.layoutID == layoutID:
> # Append Schedule
> g.addSchedule(layoutFromDT,layoutToDT,layoutPriority)
> flag = False
>
> # The layout doesn't exist, add it and add a schedule for it
> if flag:
> tmpLayout = XiboLayout(layoutID,False)
> tmpLayout.addSchedule(layoutFromDT,layoutToDT,layoutPriority)
> newLayouts.append(tmpLayout)
> scheduleText += str(layoutID) + ', '
>
> # Swap the newLayouts array in to the live scheduler
> self.__lock.acquire()
> self.__layouts = newLayouts
> self.__lock.release()
>
> log.updateSchedule(scheduleText)
> # End if previousSchedule != schedule
>
> the instructions:
> self.__lock.acquire()
> self.__layouts = newLayouts
> self.__lock.release()
>
> are placed in the loop "for l in tmpLayouts:", so they are executed
> only if there is at least one layout in the schedule, event that doesn't
> happen if there is only one schedule and it is deleted before its
> natural end.
>
> I solved it by de-indenting them.
>
>
> By the way I have done a modification in the server too, since
> I found annoying the labels in layout design page, so I tried to hide it,
> unless the mouse enters in the region.
>
> I don't know its browser compatibility, but if you find it useful you can
> do whatever you want with it.
>
>

Revision history for this message
Alex Harrington (alexharrington) wrote :

Put the link to branch back in. Sharpio: Please refrain from removing branch links from bugs unless you have a good reason to do so.

Changed in xibo:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.