4
* Copyright (c) 2008 Zivios, LLC.
6
* This file is part of Zivios.
8
* Zivios is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
13
* Zivios is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with Zivios. If not, see <http://www.gnu.org/licenses/>.
22
* @copyright Copyright (c) 2008 Zivios, LLC. (http://www.zivios.org)
23
* @license http://www.zivios.org/legal/license
25
* @lastchangeddate $LastChangedDate$
29
class Samba_ShareController extends Ecl_Controller
32
public function dashboardAction()
35
$this->render('edit');
38
public function _init()
40
if ((!isset($this->json->operate_dn) || $this->json->operate_dn ==""))
41
throw new Ecl_Exception("Invalid called to _init(). Operate DN missing");
45
$this->view->obj = Ecl_Ldap_Cache::loadDn($this->json->operate_dn);
50
public function editAction()
52
if (isset($this->json)) {
53
if ($this->json->action == 'update') {
54
Ecl_Log::debug($this->json);
55
$sambashare = $this->view->obj;
56
$sambashare->setProperty('cn',$this->json->cn);
57
if (isset($this->json->browseable)) $browseable = 'yes'; else $browseable = 'no';
59
$sambashare->setProperty('emssharecfgcomment',$this->json->comment);
60
$sambashare->setProperty('emssharecfgbrowseable',$browseable);
62
if (isset($this->json->writeable)) $writeable = 'yes'; else $writeable = 'no';
63
$sambashare->setProperty('emssharecfgwriteable',$writeable);
64
$sambashare->setProperty('emssharecfgcreatemask','0700');
65
$sambashare->setProperty('emssharecfgdirmask','0700');
66
$sambashare->setProperty('emssharecfgvalidusers','%S');
67
if ($writeable == 'yes') $readonly = 'no'; else $readonly = 'yes';
68
$sambashare->setProperty('emssharecfgreadonly',$readonly);
70
if (isset($this->json->guestok)) $guestok = 'yes'; else $guestok = 'no';
71
$sambashare->setProperty('emssharecfgguestok',$guestok);
73
$sambashare->setProperty('emssharepath',$this->json->path);
74
$trans = $sambashare->update();
76
$this->_createPopupReturn(0, "Share Added Successfully");
77
$this->_jsCallBack('nodeDetails', array($sambashare->getdn()));
82
public function addShareAction()
85
if (isset($this->json)) {
86
if ($this->json->action == 'add') {
87
Ecl_Log::debug($this->json);
88
$sambashare = new SambaShare();
90
$sambashare->setProperty('cn',$this->json->cn);
91
if (isset($this->json->browseable)) $browseable = 'yes'; else $browseable = 'no';
93
$sambashare->setProperty('emssharecfgcomment',$this->json->comment);
94
$sambashare->setProperty('emssharecfgbrowseable',$browseable);
96
if (isset($this->json->writeable)) $writeable = 'yes'; else $writeable = 'no';
97
$sambashare->setProperty('emssharecfgwriteable',$writeable);
98
$sambashare->setProperty('emssharecfgcreatemask','0700');
99
$sambashare->setProperty('emssharecfgdirmask','0700');
100
$sambashare->setProperty('emssharecfgvalidusers','%S');
101
if ($writeable == 'yes') $readonly = 'no'; else $readonly = 'yes';
102
$sambashare->setProperty('emssharecfgreadonly',$readonly);
104
if (isset($this->json->guestok)) $guestok = 'yes'; else $guestok = 'no';
105
$sambashare->setProperty('emssharecfgguestok',$guestok);
107
$sambashare->setProperty('emssharepath',$this->json->path);
108
$trans = $sambashare->add($this->view->obj);
110
$this->_createPopupReturn(0, "Share Added Successfully");
111
$this->_jsCallBack('nodeDetails', array($sambashare->getdn()));
112
$this->_refreshTreeView($this->view->obj->getdn());
116
$this->render('add');