Index: openacs-4/packages/acs-core-docs/www/tutorial-admin-pages.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/tutorial-admin-pages.html,v diff -u -r1.15 -r1.16 --- openacs-4/packages/acs-core-docs/www/tutorial-admin-pages.html 7 Aug 2017 23:47:52 -0000 1.15 +++ openacs-4/packages/acs-core-docs/www/tutorial-admin-pages.html 8 Nov 2017 09:42:12 -0000 1.16 @@ -1,7 +1,10 @@ -Admin Pages

Admin Pages

+Admin Pages

Admin Pages

+ +

There are at least two flavors of admin user interface: -

  • Admins use same pages as all other users, except +

    +
    • Admins use same pages as all other users, except that they are offered admin links and buttons where appropriate. For example, if admins have privilege to bulk-delete items you could provide checkboxes next to every item seen on a list and the @@ -10,24 +13,31 @@ access to data that users aren't interested in or aren't allowed to see you will need dedicated admin pages. The conventional place to put those dedicated admin pages is in the - /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/www/admin + /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/www/admin directory. -

      [$OPENACS_SERVICE_NAME www]$ mkdir admin
      [$OPENACS_SERVICE_NAME www]$ cd admin

      +

      +
      [$OPENACS_SERVICE_NAME www]$ mkdir admin
      +
      [$OPENACS_SERVICE_NAME www]$ cd admin
      +

      Even if your application doesn't need any admin pages of its own you will usually need at least one simple page with a bunch of links to existing administration UI such as Category Management or standard Parameters UI. Adding the link to Category Management is described in the section on categories. The listing below adds a link to the Parameters UI of our package. -

      [$OPENACS_SERVICE_NAME admin]$ vi index.adp
      +      

      +
      [$OPENACS_SERVICE_NAME admin]$ vi index.adp
      +
       <master>
       <property name="title">@title;noquote@</property>
       <property name="context">@context;noquote@</property>
       
       <ul class="action-links">
         <li><a href="@parameters_url@" title="Set parameters" class="action_link">Set parameters</a></li>
       </ul>
      -
      [$OPENACS_SERVICE_NAME admin]$ vi index.tcl
      +
      +
      [$OPENACS_SERVICE_NAME admin]$ vi index.tcl
      +
       ad_page_contract {} {
       } -properties {
           context_bar
      @@ -47,7 +57,9 @@
         package_id { return_url [ad_return_url] }
       }]
       
      -

      +

      + +

      Now that you have the first admin page it would be nice to have a link to it somewhere in the system so that admins don't have to type in the /admin every time they need to reach it. You @@ -56,11 +68,13 @@ people who are not admins. Besides, some people consider it impolite to first offer a link and then display a nasty "You don't have permission to access this page" message. -

      +

      +

      In order to display the link to the admin page only to users that have admin privileges add the following code near the top of -/var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/www/admin/index.tcl: -

      +/var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/www/admin/index.tcl:
      +

      +
       
       set package_id [ad_conn package_id]
       
      @@ -71,11 +85,17 @@
           set admin_url "admin"
           set admin_title Administration
       }
      -

      +

      +

      In -/var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/www/admin/index.adp put: -

      +/var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/www/admin/index.adp put:
      +

      +
       <if @admin_p@ ne nil>
         <a href="@admin_url@">@admin_title@</a>
       </if>
      -
+ + +
+ +