Plasma GitLab Archive
Projects Blog Knowledge

<?xml version="1.0" encoding="ISO-8859-1"?>

<!--
  - <COPYRIGHT>
  - Copyright 2003 Gerd Stolpmann
  -
  - <GPL>
  - This file is part of WTimer.
  - 
  - WTimer is free software; you can redistribute it and/or modify
  - it under the terms of the GNU General Public License as published by
  - the Free Software Foundation; either version 2 of the License, or
  - (at your option) any later version.
  -
  - WTimer is distributed in the hope that it will be useful,
  - but WITHOUT ANY WARRANTY; without even the implied warranty of
  - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  - GNU General Public License for more details.
  -
  - You should have received a copy of the GNU General Public License
  - along with WDialog; if not, write to the Free Software
  - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  - </>
  -->

<!--  $Id: admin_access.ui,v 1.4 2003/03/23 11:59:13 gerd Exp $
   -  ======================================================================
   - 
  -->

<!-- This file defines the dialog "admin-access". It is called "access" dialog
   - because of historic reasons.
  -->

<ui:dialog name="admin-access" start-page="access-list">
  <ui:variable name="session" type="dialog"/>
    <!-- The session pseudo dialog, see session.ui -->

  <ui:variable name="scroll_position"/>
    <!-- See explanations in definitions.ui, basic-grid -->

  <ui:enumeration name="bool">
    <ui:enum internal="no"/>
    <ui:enum internal="yes"/>
  </ui:enumeration>

  <ui:variable name="modified">
    <!-- Is there any unsaved modification of the data? yes/no/load -->
    <ui:string-value>load</ui:string-value>
  </ui:variable>

  <ui:variable name="checksum">
    <!-- The checksum of the contents as saved into the database. -->
  </ui:variable>

  <ui:variable name="inst-del" associative="yes" type="bool">
    <!-- The "Del?" checkboxes for every sheet -->
    <!--&admin-access-inst-del;-->  <!-- test data -->
  </ui:variable>

  <ui:variable name="inst-name" associative="yes">
    <!-- The name for every sheet -->
    <!--&admin-access-inst-name;-->  <!-- test data -->
  </ui:variable>

  <ui:variable name="inst-descr" associative="yes">
    <!-- The description for every sheet -->
    <!--&admin-access-inst-descr;-->  <!-- test data -->
  </ui:variable>

  <ui:variable name="inst-edit" associative="yes">
    <!-- Whether the row can be edited: yes/no/new -->
    <!--&admin-access-inst-edit;-->  <!-- test data -->
  </ui:variable>

  <ui:variable name="acl-edit" type="dynamic-enumerator"/>
    <!-- This is used for the "Edit?" radio. The internal values of the enum
       - have the format:
       - "r-<ID>", "w-<ID>", or "o-<ID>", if the time sheet <ID> is selected
       - for the read, write, and ownership privilege, respectively.
      -->

  <ui:variable name="acl-users" type="dynamic-enumerator">
    <!-- The list of all users -->
    <!--&admin-access-acl-users;-->           <!-- test data -->
  </ui:variable>

  <ui:variable name="acl-read" associative="yes" type="dynamic-enumerator">
    <!-- For every sheet, this variable enumerates the users with
       - read privilege
      -->
    <!--&admin-access-acl-read;-->            <!-- test data -->
  </ui:variable>

  <ui:variable name="acl-write" associative="yes" type="dynamic-enumerator">
    <!-- For every sheet, this variable enumerates the users with
       - write privilege
      -->
    <!--&admin-access-acl-write;-->           <!-- test data -->
  </ui:variable>

  <ui:variable name="acl-owner" associative="yes" type="dynamic-enumerator">
    <!-- For every sheet, this variable enumerates the users with
       - ownership privilege
      -->
    <!--&admin-access-acl-owner;-->           <!-- test data -->
  </ui:variable>


  <ui:enumeration name="message">
    <ui:enum internal="saved"
             external="The list has been saved into the database."/>
    <ui:enum internal="error-double-names"
             external="One of the sheet names is already used."/>
    <ui:enum internal="error-nothing-selected"
             external="Please select a row before editing it!"/>
    <ui:enum internal="error-bad-ownership"
             external="Primary sheets must (at least) be owned by the user with the same name!"/>
    <ui:enum internal="error-missing-ownership"
             external="Every sheet must have an owner!"/>
  </ui:enumeration>


  <ui:variable name="message" type="message">
    <!-- Messages to display -->
    <!--&admin-access-message;-->  <!-- test data -->
  </ui:variable>

  <ui:variable name="deferred-dialog" type="dialog"/>
    <!-- While the page "unsaved" is displayed, this variable stores the
       - dialog the user tried to call
      -->

  <ui:page name="access-list">
    <t:basic-grid have_scroll_position="yes">
      <p:nav-col>
	<t:admin-access-nav/>
      </p:nav-col>
      <p:headline>
	<t:admin-access-head/>
      </p:headline>
      <p:main-col>
	<div><a href="#help">Help</a></div>
	<ui:enumerate variable="message" template="message"/>
	<table class="acl">
	  <tr>
	    <th class="acl" bgcolor="#8B7E66">
	      <font color="white">Del?</font></th>
	    <th class="acl" bgcolor="#8B7E66">
	      <font color="white">Timesheet</font></th>
	    <th class="acl" bgcolor="#8B7E66">
	      <font color="white">Description</font></th>
	    <th class="acl" bgcolor="#8B7E66">
	      <font color="white">Privilege</font></th>
	    <th class="acl" bgcolor="#8B7E66">
	      <font color="white">Access granted to users</font></th>
	    <th class="acl" bgcolor="#8B7E66">
	      <font color="white">Edit ACL?</font></th>
	  </tr>
	  <ui:iterate variable="acl-read" template="access-row">
	    <ui:iter-empty>
	      <tr>
		<td class="acl-o" colspan="6"><i>The table is empty!</i></td>
	      </tr>
	    </ui:iter-empty>
	  </ui:iterate>
	</table>

	<div class="help">
	  <a name="help"/>
	  <div>
	    This dialog allows you to create additional sheets, delete sheets,
	    and to change the permissions associated with sheets (ACLs =
	    access control lists).
	  </div>
	  <div>
	    To <em>create</em> an additional sheet, press the button
	    "New Row", fill out the new row, and press "Save".</div>
	  <div>
	    To <em>delete</em> a sheet, select the sheet in the 
	    "Del?" column, and press "Save".</div>
	  <div>
	    To <em>change permissions</em> of a sheet, select the sheet
	    in the "Edit ACL?" column, and press "Edit ACL". After
	    changing the ACL, press "Save". The <em>Owner</em> is the
	    person who is allowed to delete the sheet, and to set the
	    ACL. The <em>Writers</em> can modify the contents of the
	    sheet. The <em>Readers</em> can only view the contents of
	    the sheet, but not change it. All other users (except
	    administrators) do not even see your sheets.</div>
	</div>

      </p:main-col>
    </t:basic-grid>
  </ui:page>

  <ui:page name="unsaved">
    <!-- When somebody tries to leave the access list without saving -->
    <t:basic-grid>
      <p:nav-col>
	<!-- empty nav-col: this is a modal dialog -->
      </p:nav-col>
      <p:headline>
	<t:admin-access-head/>
      </p:headline>
      <p:main-col>
	<q:message int="confirm-unsaved">
	  <div>
	    You try to leave this page, but there are unsaved changes.
	    Do you want to save the access list now?
	  </div>
	  <div class="buttonbox">
	    <ui:button name="unsaved-save"    label="Save list"/>
	    <ui:button name="unsaved-discard" label="Discard changes"/>
	    <ui:button name="unsaved-cancel"  label="Cancel"/>
	  </div>
	</q:message>
      </p:main-col>
    </t:basic-grid>
  </ui:page>


  <!-- ERROR HANDLING -->

  <!-- See also ocaml class error_behaviour that uses the following
       definitions
    -->

  <ui:variable name="runtime-error"/>

  <ui:page name="runtime-error">
    <t:basic-grid>
      <p:nav-col>
	<!-- empty nav-col: this is a modal dialog -->
      </p:nav-col>
      <p:headline>
	<t:admin-access-head/>
      </p:headline>
      <p:main-col>
	<t:error errid="$[runtime-error]"/>
	<ui:button name="cont-error" label="Continue"/>
      </p:main-col>
    </t:basic-grid>
  </ui:page>

</ui:dialog>

<!-- ********************************************************************** -->

<ui:template name="admin-access-head">
  <!-- The headline -->
  <t:admin-head>
    <p:suffix>
      Manage Sheets
      <t:head-modified-flag/>
    </p:suffix>
  </t:admin-head>
</ui:template>

<ui:template name="admin-access-nav">
  <!-- The navigation bar -->
  <t:admin-nav/>

  <q:nav-section head="Manage Sheets">
    <q:nav-entry title="Edit access control list (ALT-E)">
      <q:applink label="Edit ACL" name="access-edit" accesskey="E"/>
    </q:nav-entry>
    <q:nav-entry title="New row (ALT-N)">
      <q:applink label="New row" name="access-new" accesskey="N"/>
    </q:nav-entry>
    <q:nav-entry title="Save changes in database (ALT-S)">
      <q:applink label="Save" name="access-save" accesskey="S"/>
    </q:nav-entry>
<!--
    <q:nav-entry title="Test: Unsaved changes">
      <q:applink label="Test 1" name="access-test1"/>
    </q:nav-entry>
-->
  </q:nav-section>

</ui:template>

<!-- ********************************************************************** -->

<ui:template name="access-row" from-caller="int">
  <!-- int: the index of the sheet -->
  <tr bgcolor="#CDBA96">
    <td class="acl-r">
      <ui:ifvar variable="inst-edit" index="$int" value="no" op="ne">
	<ui:checkbox variable="inst-del" index="$int" value="yes" 
                     onchange="set_modified_flag()" />
      </ui:ifvar>
      &nbsp;
    </td>
    <td class="acl-r">
      <ui:cond>
	<ui:ifvar variable="inst-edit" index="$int" value="new">
	  <ui:text variable="inst-name" index="$int" 
                   onchange="set_modified_flag()" />
	</ui:ifvar>
	<ui:true>
	  $[assoc(inst-name,$int)]
	</ui:true>
      </ui:cond>
    </td>
    <td class="acl-r">
      <ui:ifvar variable="inst-edit" index="$int" value="no" op="ne">
	<ui:text variable="inst-descr" index="$int"
                 onchange="set_modified_flag()" />
      </ui:ifvar>
      &nbsp;
    </td>
    <td class="acl-r">Read</td>
    <td class="acl-r-users">
      <ui:cond>
	<ui:ifvar variable="acl-edit" value="r-$int" op="contains">
	  <ui:select size="$[size(acl-users)]" 
                     variable="acl-read" multiple="yes" base="acl-users"
	             onchange="set_modified_flag()" class="acl-box"
	             index="$int"/>&nbsp;
	</ui:ifvar>
	<ui:true>
	  <ui:enumerate variable="acl-read" index="$int" template="acl-user">
	    <ui:iter-separator>, </ui:iter-separator>
	  </ui:enumerate>
	</ui:true>
      </ui:cond>
    </td>
    <td class="acl-r">
      <ui:ifvar variable="inst-edit" index="$int" value="no" op="ne">
	<ui:radio variable="acl-edit" value="r-$int"
	          onchange="document.uiform.submit();"/>
      </ui:ifvar>
      &nbsp;
    </td>
  </tr>
  <tr bgcolor="#CDBA96">
    <td class="acl-w">&nbsp;</td>
    <td class="acl-w">&nbsp;</td>
    <td class="acl-w">&nbsp;</td>
    <td class="acl-w">Write</td>
    <td class="acl-w-users">
      <ui:cond>
	<ui:ifvar variable="acl-edit" value="w-$int" op="contains">
	  <ui:select size="$[size(acl-users)]" 
                     variable="acl-write" multiple="yes" base="acl-users"
	             onchange="set_modified_flag()" class="acl-box"
	             index="$int"/>&nbsp;
	</ui:ifvar>
	<ui:true>
	  <ui:enumerate variable="acl-write" index="$int" template="acl-user">
	    <ui:iter-separator>, </ui:iter-separator>
	  </ui:enumerate>
	</ui:true>
      </ui:cond>
    </td>
    <td class="acl-w">
      <ui:ifvar variable="inst-edit" index="$int" value="no" op="ne">
	<ui:radio variable="acl-edit" value="w-$int"
	          onchange="document.uiform.submit();"/>
      </ui:ifvar>
      &nbsp;
    </td>
  </tr>
  <tr bgcolor="#CDBA96">
    <td class="acl-o">&nbsp;</td>
    <td class="acl-o">&nbsp;</td>
    <td class="acl-o">&nbsp;</td>
    <td class="acl-o">Owner</td>
    <td class="acl-o-users">
      <ui:cond>
	<ui:ifvar variable="acl-edit" value="o-$int" op="contains">
	  <ui:select size="$[size(acl-users)]" 
                     variable="acl-owner" multiple="yes" base="acl-users"
	             onchange="set_modified_flag()" class="acl-box"
	             index="$int"/>&nbsp;
	</ui:ifvar>
	<ui:true>
	  <ui:enumerate variable="acl-owner" index="$int" template="acl-user">
	    <ui:iter-separator>, </ui:iter-separator>
	  </ui:enumerate>
	</ui:true>
      </ui:cond>
    </td>
    <td class="acl-o">
      <ui:ifvar variable="inst-edit" index="$int" value="no" op="ne">
	<ui:radio variable="acl-edit" value="o-$int"
	          onchange="document.uiform.submit();"/>
      </ui:ifvar>
      &nbsp;
    </td>
  </tr>
</ui:template>

<ui:template name="acl-user" from-caller="int">
  <!-- int: the name of the user -->
  $[translate(acl-users,$int)]
</ui:template>

<!-- ******************* For Emacs: ********************* -->
<!--
Local Variables:
mode: xml
sgml-parent-document: ("main.ui" "ui:application" "ui:dialog")
End:
-->

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml