Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

FOP2 Community Forum

  1. Home
  2. Support
  3. Display Order of Button Groups on Panel

Display Order of Button Groups on Panel

Scheduled Pinned Locked Moved Support
6 Posts 2 Posters 221 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P
    P
    photo_ted
    wrote on last edited by
    #1

    Currently groups are ordered by the lowest extension in the group. The SQL to simulate it is:

    select group from fop2buttons group by group order by min(exten);

    Is it possible to sort the groups alphabetically (with the exception of having the first group be the logged-in user's group as it is now)?

    Tx,
    Ted

    1 Reply Last reply
    0
    • N
      N
      nicolas
      wrote on last edited by
      #2

      It will be difficult to have the logged group shown first, it will require a source code change in the client. I will take a look when I get back from vacations.

      1 Reply Last reply
      0
      • P
        P
        photo_ted
        wrote on last edited by
        #3

        It could be done with a single SQL statement. If you assume a variable EXTEN has the extension of the FOP2 user:

        (select * from fop2buttons
        where `group` in (select `group` from fop2buttons where exten="148") and type="extension"
        order by exten)
        union
        (select * from fop2buttons
        where `group` not in (select `group` from fop2buttons where exten="148") and type="extension"
        order by `group`,exten)
        

        The first select gets the users in the same group and as there is only one group, it only has to sort by exten. The second selection gets all the extensions not in the same group as the current FOP2 and sorts them by the group name then the exten.

        Ted

        1 Reply Last reply
        0
        • N
          N
          nicolas
          wrote on last edited by
          #4

          Hi,

          Thanks for the clarification. The problem is that the fop2 client does not perform any sql queries at the moment you login, it generates a static config that is stored in memory. And at the moment of rendering the buttons, it just swaps positions IN the group with the 1st button. So you cannot change the group display based on the extension you are logged as unless I hack deep into the code...

          Best regards,

          1 Reply Last reply
          0
          • P
            P
            photo_ted
            wrote on last edited by
            #5

            As I don't see your internals, I can only guess how you get the underlying data. My previous post (which I just corrected; there were a couple of syntax errors) was an attempt to help, clarify, and collaborate not tell you how to write your software. I hope it didn't come across that way. While I mostly develop in Java, wild SQL statements have always appealed to me.

            Regards,
            Ted

            1 Reply Last reply
            0
            • N
              N
              nicolas
              wrote on last edited by
              #6

              Hi Ted,

              I really appreciate your post and help, and I also like this kind of SQL challenges.

              Although your solution does not apply because of the way fop2 is coded, it was an insightful post and I thank you for that, it adds richness to the forums. Proposing solutions is always a good thing in a forum.

              Now that I am back from vacations I will see if I can make the group sorting query and modification on the client to see if it is possible to change the group order on the display based on the logged extension.

              Best regards,

              1 Reply Last reply
              0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              Powered by NodeBB Contributors
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups