%#============================================================================
%# ePortal - WEB Based daily organizer
%# Author - S.Rusakov <rusakov_sa@users.sourceforge.net>
%#
%# Copyright (c) 2000-2003 Sergey Rusakov.  All rights reserved.
%# This program is free software; you can redistribute it
%# and/or modify it under the same terms as Perl itself.
%#
%#
%#----------------------------------------------------------------------------

&nbsp;
<% $dlg->dialog_start(
      title => pick_lang(rus => "Группа", eng => "Group"),
      width => 550) %>
<% $dlg->field( "recordtype", hidden => 1, value => "group" ) %>
<% $dlg->field( "parent_id")  %>
<% $dlg->field( "title" ) %>
<% $dlg->field( "nickname" ) %>
<% $dlg->field( "priority" ) %>
<% $dlg->field( "memo" ) %>

% if ($obj->xacl_check_admin) {
  <% $dlg->row( "<hr>" ) %>
  <% $dlg->field( "xacl_read" ) %>
  <% $dlg->field( "xacl_write" ) %>
  <% $dlg->field( "xacl_admin" ) %>
  <% $dlg->field( "including_children" ) %>
% }
<% $dlg->buttons() %>
<% $dlg->dialog_end %>
<p>


%#=== @METAGS attr =========================================================
<%attr>
Title => {rus => "Группа", eng => "Group"}
</%attr>


%#=== @METAGS onStartRequest ====================================================
<%method onStartRequest><%perl>
  $obj = new ePortal::Catalog;
  $obj->add_attribute( including_children => {
        type => 'Temp',
        dtype => 'YesNo',
        label => pick_lang(rus => "Заменить права подчиненных", eng => "Replace rights on children"),
  });

	$dlg = new ePortal::HTML::Dialog( obj => $obj);
  my $location = try {
    $dlg->handle_request( );
  } catch ePortal::Exception::DataNotValid with {
    my $E = shift;
    $session{ErrorMessage} = $E->text;
    '';
  };

  if ( $dlg->isButtonPressed('ok') and $obj->including_children) {
    $obj->xacl_set_r;
  }
	return $location if $location;

  #initialize ACL
  if ( ! $obj->check_id ) {                                 # new object
    $obj->parent_id( $ARGS{parent_id} ) if $ARGS{parent_id};
    my $parent = $obj->parent;
    $obj->set_acl_from_obj($parent) if $parent;
  }
</%perl></%method>



%#=== @metags once =========================================================
<%once>
my ($dlg, $obj);
</%once>

%#=== @metags cleanup =========================================================
<%cleanup>
($dlg, $obj) = ();
</%cleanup>

