rejetto forum
February 11, 2012, 01:31:35 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: 1 ... 4 5 [6]
  Print  
Author Topic: Admin Panel : Creating a proper admin panel.  (Read 15876 times)
0 Members and 1 Guest are viewing this topic.
r][m
Insane poster
*****
Offline Offline

United States United States

Posts: 339


View Profile
« Reply #75 on: June 07, 2009, 12:37:23 PM »

For those who haven't added a Admin Panel section that adds a user to a specific group
copy the text file attached, to your Admin Panel section. You will need to add the link to
the Admin Panel page,  your own css link, and change
{.if not | {.match|USER1;USER2|%user%.}| {:{.$error.}:} |
I find it quite useful when adding a new user, to be able to add them to a pre-defined
group, at least at first.
This is based on the early version of the Admin Panel posted by Mars.

Help ! please
I've tried to assemble a macro that would list the members of each group,
by group, as "Group 1: seth;tom;bill" "Group 2: joe;andy" so when I add a
new user he will show in the listing for the group he's added to.
I've tried combinations of
" {.member of |"  &  " {.get | accounts |"   etc,
but with no luck. " get | accounts"   produces a full list, but its ordered by
by the user window list, not by which group a user actually belongs to.
 
Rejetto, Mars, anyone have an example?

* usertogroup.txt (2.22 KB - downloaded 118 times.)
« Last Edit: June 07, 2009, 01:41:02 PM by r][m » Logged
bacter
Operator
Insane poster
*****
Offline Offline

Spain Spain

Posts: 677


View Profile
« Reply #76 on: June 07, 2009, 03:37:34 PM »

I have some macros that allow you to get the lists you want.

In the first place, the macro used to prepare the lists. I load this module when needed in [special:begin].

Code:
{.comment|------------------------------------------------------------------
macros related to users and groups
creates a list that is easy to use as csv
Note for group naming:
*name = regular group (associated to site, directory)
#name = attribute group (has no acces to anyting, is uses to distinguish
  users with special rights or tastes
examples: #auxadm - allowed to add accounts to his regular group(s)
          #techie - template shows only to them things like speeds,users conected,downloadcounters etc.
--------------------------------------------------------------------.}
{.set|accgroups|{.get|accounts|groups.}.}
{.set|accusers|{.get|accounts|users.}.}
{.set|tg|{.^accgroups.}.}
{.set|ng|{.add|{.count substring|*|{.^accgroups.}.}|{.count substring|#|{.^accgroups.}.}.}.}
{.set|group|.}
{.for|ii|1|{.^ng.}|
{:
{.set|tg2|{.substring||;|{.^tg.}.}.}{.set|tg|{.replace|{.^tg2.};||{.^tg.}.}.}
{.set append|group|[{.cut|2||{.^tg2.}.}:.}
{.set|tus|{.^accusers.}.}
{.set|nu|{.count substring|;|{.^accusers.}.}.}
{.for|jj|0|{.^nu.}|
{:
{.set|tu2|{.substring||;|{.^tus.}.}.}
{.if|{.member of|{.^tg2.}|user={.^tu2.}.}|{:{.set append |group|{.^tu2.};.}:}.}
{.set|tus|{.replace|{.^tu2.};||{.^tus.}.}.}
:}.}
:}.}
{.set append |group|][not in group:.}
{.set|tus|{.^accusers.}.}
{.for|jj|0|{.^nu.}|
{:
{.set|tu2|{.substring||;|{.^tus.}.}.}{.set|tus|{.replace|{.^tu2.};||{.^tus.}.}.}
{.if not|{.pos|{.^tu2.}|{.^group.}.}|{:{.set append |group|{.^tu2.};.}:}.}
:}.}
{.set append |group|].}


here you have some code to show your lists of user groups in different manners (to be placed or called in the section where you want to show the list in your template):

Code:
        Total groups:{.^ng.}<br />
Groups: {.^accgroups.}<br />
Users: {.replace|;|, |{.^accusers.}.}<br />
Full list:{.replace|;|, |{.get|accounts.}.}<br />
{.comment| the showcsv.. macros are in a separate macro module.}
{.^showcsvrows|{.replace|[|<br />|{.^group.}.}.}
{.^showcsvtable|{.replace|;| - |{.replace|:|,|{.^group.}.}.}.}

To see better the list or even a table, you can use and adapt to your need the following showcsv.. macros (must also be placed before first use!):

Code:
{.set|showcsvrows|{:{.replace|][|]<br />[|$1.}:}.}
{.set|showcsvtable|{:
{.set|ttab|{.replace|]|</td></tr>|$1.}.}
{.set|ttab|{.replace|[|<tr><td nowrap>|{.^ttab.}.}.}
{.set|ttab|{.replace|,|</td><td nowrap>|{.^ttab.}.}.}
<table border="1">{.^ttab.}</table>
:}.}

that's all  Smiley
Logged

your computer has no brain - use your own !
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #77 on: June 07, 2009, 05:22:08 PM »

wow bacter

let me suggest you a facility
{.set|#extract till|{:{.set|#temp|{.substring||$1|{.^$2.}.}.}{.set|$2|{.cut|{.add|2|{.length|var=#temp.}.}||{.^$2.}.}.}{.^#temp.}{.set|#asdtemp.}:}/set.}

so that you can
{.set|#gs|{.get|accounts|groups.}.}
{.while|#gs|{:{.^#extract till|;|#gs.} :}.}


i used #static vars because i used the "run script".
Logged
bacter
Operator
Insane poster
*****
Offline Offline

Spain Spain

Posts: 677


View Profile
« Reply #78 on: June 07, 2009, 06:16:55 PM »

Thank you rejetto.

All ideas to improve speed and size are welcome  Smiley.
Specially, as my macro-modules grow and grow. My templates seems not to be html with macro, but will end up being macro-scripts with some html. Grin

Also it's a good idea to use static vars for the lists - but my macro-scripts came from pre-static time  Smiley.
Logged

your computer has no brain - use your own !
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #79 on: June 08, 2009, 05:58:24 AM »

i don't suggest using them for this purpose.
i justified the fact i used them.
Logged
bacter
Operator
Insane poster
*****
Offline Offline

Spain Spain

Posts: 677


View Profile
« Reply #80 on: June 08, 2009, 06:51:12 AM »

Rejetto,

I understood that you used static vars only because you used 'run script', but as there may be more uses for this lists, it would be enough to build the list only when hfs starts and if users are added ore removed, so static var seems not to be a bad idea.

By the way, as i don't know the delphi-compiler, i would like to know if there is a any size limit for a single or list variable, as i project to load some huge files (several Mbytes) y want to process. If there are no limits, y will try to do all processes with macros, otherwise y would use the output of C or tcl programs started with {.exec.}.   
Logged

your computer has no brain - use your own !
rejetto forum
« Reply #80 on: June 08, 2009, 06:51:12 AM »

Do you like this software? Consider even $2
 Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #81 on: June 08, 2009, 07:11:40 AM »

no limits i know.
would you have speed problems, let me know.
Logged
r][m
Insane poster
*****
Offline Offline

United States United States

Posts: 339


View Profile
« Reply #82 on: June 08, 2009, 11:36:33 AM »

WOW....indeed !
Bacter, thanks for sharing. I'll give your code a try,
although I must confess I'd hoped for something
much simpler.  Smiley
Logged
DjNelutzu
Regular poster
**
Offline Offline

Romania Romania

Posts: 24


View Profile Email
« Reply #83 on: August 22, 2010, 06:18:00 AM »

and the final code would be all that is needed for administrators panel?
Logged
Pages: 1 ... 4 5 [6]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page January 29, 2012, 08:41:33 AM
anything