Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117877001
kolab_client_task_sharedfolder.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
6 KB
Referenced Files
None
Subscribers
None
kolab_client_task_sharedfolder.php
View Options
<?php
/*
+--------------------------------------------------------------------------+
| This file is part of the Kolab Web Admin Panel |
| |
| Copyright (C) 2011-2012, Kolab Systems AG |
| |
| This program is free software: you can redistribute it and/or modify |
| it under the terms of the GNU Affero General Public License as published |
| by the Free Software Foundation, either version 3 of the License, or |
| (at your option) any later version. |
| |
| This program 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 Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public License |
| along with this program. If not, see <http://www.gnu.org/licenses/> |
+--------------------------------------------------------------------------+
| Author: Aleksander Machniak <machniak@kolabsys.com> |
+--------------------------------------------------------------------------+
*/
class
kolab_client_task_sharedfolder
extends
kolab_client_task
{
protected
$ajax_only
=
true
;
protected
$menu
=
array
(
'add'
=>
'sharedfolder.add'
,
);
protected
$list_attribs
=
array
(
'cn'
);
/**
* Default action.
*/
public
function
action_default
()
{
$this
->
output
->
set_object
(
'content'
,
'sharedfolder'
,
true
);
$this
->
output
->
set_object
(
'task_navigation'
,
$this
->
menu
());
$this
->
action_list
();
// display form to add a shared folder if logged-in user has right to do so
$caps
=
$this
->
get_capability
(
'actions'
);
if
(!
empty
(
$caps
[
'sharedfolder.add'
]))
{
$this
->
action_add
();
}
else
{
$this
->
output
->
command
(
'set_watermark'
,
'taskcontent'
);
}
}
/**
* Resource adding (form) action.
*/
public
function
action_add
()
{
$data
=
$this
->
get_input
(
'data'
,
'POST'
);
$output
=
$this
->
sharedfolder_form
(
null
,
$data
,
true
);
$this
->
output
->
set_object
(
'taskcontent'
,
$output
);
}
/**
* Resource information (form) action.
*/
public
function
action_info
()
{
$id
=
$this
->
get_input
(
'id'
,
'POST'
);
$result
=
$this
->
api_get
(
'sharedfolder.info'
,
array
(
'id'
=>
$id
));
$sharedfolder
=
$result
->
get
();
//console("action_info()", $sharedfolder);
$output
=
$this
->
sharedfolder_form
(
null
,
$sharedfolder
);
$this
->
output
->
set_object
(
'taskcontent'
,
$output
);
}
private
function
sharedfolder_form
(
$attribs
,
$data
=
array
())
{
if
(
empty
(
$attribs
[
'id'
]))
{
$attribs
[
'id'
]
=
'sharedfolder-form'
;
}
//console("sharedfolder_form(\$attribs, \$data)", $attribs, $data);
// Form sections
$sections
=
array
(
'system'
=>
'sharedfolder.system'
,
'other'
=>
'sharedfolder.other'
,
);
// field-to-section map and fields order
$fields_map
=
array
(
'type_id'
=>
'system'
,
'type_id_name'
=>
'system'
,
'cn'
=>
'system'
,
'ou'
=>
'system'
,
'preferredlanguage'
=>
'system'
,
'mail'
=>
'system'
,
'alias'
=>
'system'
,
'mailalternateaddress'
=>
'system'
,
'member'
=>
'system'
,
'uniquemember'
=>
'system'
,
'memberurl'
=>
'system'
,
'nsrole'
=>
'system'
,
'nsroledn'
=>
'system'
,
/* Kolab Settings */
'kolabhomeserver'
=>
'system'
,
'mailhost'
=>
'system'
,
'mailquota'
=>
'system'
,
'kolabfreebusyfuture'
=>
'system'
,
'kolabinvitationpolicy'
=>
'system'
,
'kolabdelegate'
=>
'system'
,
'kolaballowsmtprecipient'
=>
'system'
,
'kolaballowsmtpsender'
=>
'system'
,
);
// Prepare fields
list
(
$fields
,
$types
,
$type
)
=
$this
->
form_prepare
(
'sharedfolder'
,
$data
);
//console("Result from form_prepare", $fields, $types, $type);
$add_mode
=
empty
(
$data
[
'id'
]);
$accttypes
=
array
();
foreach
(
$types
as
$idx
=>
$elem
)
{
$accttypes
[
$idx
]
=
array
(
'value'
=>
$idx
,
'content'
=>
$elem
[
'name'
]);
}
// Add sharedfolder type id selector
$fields
[
'type_id'
]
=
array
(
'section'
=>
'system'
,
'type'
=>
kolab_form
::
INPUT_SELECT
,
'options'
=>
$accttypes
,
'onchange'
=>
"kadm.sharedfolder_save(true, 'system')"
,
);
//console($accttypes);
// Hide account type selector if there's only one type
if
(
count
(
$accttypes
)
<
2
||
!
$add_mode
)
{
//console("setting type_id form type to hidden");
$fields
[
'type_id'
][
'type'
]
=
kolab_form
::
INPUT_HIDDEN
;
}
// Create mode
if
(
$add_mode
)
{
// Page title
$title
=
$this
->
translate
(
'sharedfolder.add'
);
}
// Edit mode
else
{
$title
=
$data
[
'cn'
];
// Add sharedfolder type name
$fields
[
'type_id_name'
]
=
array
(
'label'
=>
'sharedfolder.type_id'
,
'section'
=>
'system'
,
'value'
=>
$accttypes
[
$type
][
'content'
],
);
}
// Create form object and populate with fields
$form
=
$this
->
form_create
(
'sharedfolder'
,
$attribs
,
$sections
,
$fields
,
$fields_map
,
$data
,
$add_mode
);
$form
->
set_title
(
kolab_html
::
escape
(
$title
));
return
$form
->
output
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Apr 5, 9:21 PM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18821489
Default Alt Text
kolab_client_task_sharedfolder.php (6 KB)
Attached To
Mode
rWAP webadmin
Attached
Detach File
Event Timeline