Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 28
  1. #11
    Senior Member
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    190
    That was really very helpful.
    Now i get the buttons disable and, in addition, I learned a lot concerning LMS.
    Until now I just used it and was impressed. Now I am even more impressed about the way it works under the hood!

    Just another thing concerning handlers and HTML elements: Are they documented somewhere?

    There are two things I would like to implement now:
    - A popup that shows up and get just a "Ok" of "Abort" click by the user and the result shall be sent back to LMS.
    - Maybe I need a special handler for that.

    You already provided an example for special handlers that might be useful.

    Could you also give me a hint where I can find something about the popup?

    In any case: Thanks a lot so far!

    Once I got that pairing stuff done with the hue bridge I can start doing the "player".

  2. #12
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,489

    Code Explanation Needed: Disable Submit Buttons onWebUI. How to?

    > There are two things I would like to implement now:
    > - A popup that shows up and get just a "Ok" of "Abort" click by the user
    > and the result shall be sent back to LMS.


    You'd have to implement this in JS. Use eg. show (that's
    what some other parts of LMS is using). The callback to the alert box
    then would call your custom handler or whatever.

    See eg. https://github.com/Logitech/slimserv...ttings.js#L545

    --

    Michael
    Last edited by mherger; 2017-01-01 at 23:01.

  3. #13
    Senior Member
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    190
    I got the message box to appear...

    But the layout was scrambled, etc. Very "flat" my first try.
    There was no black background behind the header, I tried to get an image-file into the message box, etc...

    Is there a documentation about the JS stuff implemented in LMS for the topics:
    - getting the strings.txt values into the JS MessageBox,
    - making the layout look like LMS,
    - starting LMS-Perl-Plugin-Functions in the JS part,
    - exchanging LMS-Perl-Plugin-Vars in the JS part?

    All this "code" interactions is really hard to understand for me with just the source code which is very modular...

  4. #14
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,489

    Code Explanation Needed: Disable Submit Buttons onWebUI. How to?

    > But the layout was scrambled, etc. Very "flat" my first try.
    > There was no black background behind the header, I tried to get an
    > image-file into the message box, etc...


    A screenshot and some sample code certainly would help to understand
    your issues...

    > Is there a documentation about the JS stuff implemented in LMS for the
    > topics:


    There's admittedly little LMS specific documentation. There is some
    basic stuff in your LMS:

    http://yourLMS:9000/html/docs/skins.html

    To give you a better understanding:

    - LMS is written in Perl. So you obviously need some Perl know-how
    - we're using the Template Toolkit (TT) to create the HTML documents
    (http://template-toolkit.org/docs/index.html)
    - the Default skin is making heavy use of ExtJS as the JS framework
    (http://docs.sencha.com/extjs/3.4.0/#!/api/Ext)
    - we built our own SqueezeJS library on top of ExtJS
    (http://wiki.slimdevices.com/index.php/SqueezeJS), overriding styles etc.

    So...

    > - making the layout look like LMS,


    Make sure you include ExtJS and our stylesheets etc in your template.
    This should happen automatically if you use the default templates for
    page headers etc. (see eg.
    https://github.com/Logitech/slimserv...ver/basic.html).


    > - getting the strings.txt values into the JS MessageBox,


    Then use our custom TT extension to create localized strings in the page
    template, like eg. in
    https://github.com/Logitech/slimserv...eJS/Strings.js.


    > - starting LMS-Perl-Plugin-Functions in the JS part,


    Either execute them from the settings page handler, or call a custom
    page handler as outlined earlier. The interaction itself is pretty much
    standard web page development.

    > - exchanging LMS-Perl-Plugin-Vars in the JS part?


    The page handler usually has a reference to the page object, often
    referred to as $pageRef or $params. Any value you stuff in there would
    be available in the template. Eg.

    $pageRef->{myVariable}

    could be used in the skin like

    [% IF myVariable == 'something' %]...

    See the TT documentation linked above.

    > All this "code" interactions is really hard to understand for me with
    > just the source code which is very modular...


    Unfortunately the code is your best documentation...


    --

    Michael

  5. #15
    Senior Member
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    190
    Wow, thanks a lot for all the info & docs.
    I already went further on...

    The only thing I will postpone a bit is the message box. Maybe it will work without it in the first shot.

    One silly JS question: How do I put a statement for a page refresh/reload into the JS part where the rescan disables the domitems with the help of the task runner?

    All I found in the internet did not work (e.g. windows.location.href...). Is there a special LMS trick? I simply want to refresh the page automatically in the scope of the rescan check... I thought of putting a statement into the brackts where items.dom.disabled... is stated ( see top of basic.html: https://github.com/Logitech/slimserv...basic.html#L22).
    Last edited by chincheta0815; 2017-01-04 at 03:20. Reason: Added link with codeline.

  6. #16
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,489

    Code Explanation Needed: Disable Submit Buttons onWebUI. How to?

    > One silly JS question: How do I put a statement for a page
    > refresh/reload into the JS part where the rescan disables the domitems
    > with the help of the task runner?


    Can you describe what you're trying to achieve? I don't understand what
    you're saying there...

    > All I found in the internet did not work (e.g.
    > windows.location.href...). Is there a special LMS trick? I simply want


    the location change usually should indeed change the page shown, or
    re-load the one you're in. Again: some sample code of what you've tried
    would help to better understand the problem.

    BTW: are you German? Feel free to post to the German forums group.

    --

    Michael

  7. #17
    Senior Member
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    190
    Okay: Now I put it into the german section.

    http://forums.slimdevices.com/showth...164#post872164

  8. #18
    Senior Member meep's Avatar
    Join Date
    Aug 2007
    Location
    Ireland
    Posts
    165

    Working Code?

    Hi chincheta0815

    Reading through this thread with interest - I need to do something similar....


    When a user saves settings on my plugin, I send some data off to a web service which stores the data and checks if it can connect back to the plugin.

    I'd like to show a 'in progress' message and animated icon while this is happening and then display success or failure based on response from the web service.

    It seems like the functionality you've been working on here would be perfect for what I need to do. Would you be good enough to share the working code snippets from your plugin.pm and basic.html files?

    (I'm not too strong on JS and just learning perl so looking at working code rather than trying to figure it out is always helpful!)

    Peter


    ALEXA LMS SKILL: http://www.hab-tunes.com | Twitter: #habtunes
    Personal HA BLOG: http://mediaserver8.blogspot.com

    Squeezebox | Squeezebox Radio x 2 | Squeezebox Duet

  9. #19
    Senior Member
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    190
    Hey Peter,

    here we go, this is the repo:
    https://github.com/chincheta0815/HueLightning

    Be aware, that this is under heavy development. The last diff should show you the line for updating the web page.

    Once I hav eimplemented that correctly I also have to do saveSettings etc. But first things first

    Best regards

  10. #20
    Senior Member meep's Avatar
    Join Date
    Aug 2007
    Location
    Ireland
    Posts
    165
    Quote Originally Posted by chincheta0815 View Post
    Hey Peter,

    here we go, this is the repo:
    https://github.com/chincheta0815/HueLightning

    Be aware, that this is under heavy development. The last diff should show you the line for updating the web page.

    Once I hav eimplemented that correctly I also have to do saveSettings etc. But first things first

    Best regards
    Many thanks


    ALEXA LMS SKILL: http://www.hab-tunes.com | Twitter: #habtunes
    Personal HA BLOG: http://mediaserver8.blogspot.com

    Squeezebox | Squeezebox Radio x 2 | Squeezebox Duet

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •