summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f7a252b)
raw | patch | inline | side by side (parent: f7a252b)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 8 Oct 2010 13:58:38 +0000 (13:58 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 8 Oct 2010 13:58:38 +0000 (13:58 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19958 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/FolderEditDialog.tpl b/gosa-plugins/groupware/personal/groupware/FolderWidget/FolderEditDialog.tpl
index 56152b86e3d69010641df8da073145d2c618108a..d7270b94e681ac907f8148edb22c80a14b4c0d6f 100644 (file)
-<h3>{t}Folder{/t}</h3>
+{if $isNew}
+
+<h3>{t}Create folder{/t}</h3>
+<table>
+ <tr>
+ <td>{t}Name{/t}: </td>
+ <td><input name='folderName' value="{$folderItem.name}" type="text"></td>
+ </tr>
+</table>
+
+{else}
+
+<h3>{t}Edit folder{/t}</h3>
<table>
<tr>
<td>{t}Name{/t}: </td>
<td>{$folderItem.path}</td>
</tr>
</table>
+{/if}
<hr>
diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderEditDialog.inc b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderEditDialog.inc
index 4af753839a76199c46fd65403265d10ec86ffe04..e4e3ab87e29509dd4e9b5cf37df44e79a00ba47e 100644 (file)
private $folderItem = NULL;
private $permissions = array();
- function __construct($config, $folderItem)
+ function __construct($config, $folderItem, $isNew = FALSE)
{
$this->config = $config;
$this->folderItem = $folderItem;
+ $this->isNew = $isNew;
+
+ // Prepare new item
+ if($this->isNew){
+ $entry = array();
+ $entry['name'] = "";
+ $entry['acls'] = array();
+ $this->folderItem = $entry;
+ }
}
function setPermissions($perms)
$smarty->assign('folderItem', $this->folderItem);
$smarty->assign('permissions', $this->permissions);
$smarty->assign('permissionCnt', count($this->permissions));
+ $smarty->assign('isNew', $this->isNew);
return($smarty->fetch(get_template_path("FolderEditDialog.tpl", TRUE, dirname(__FILE__))));
}
function save_object()
{
+ // Get folder name
+ if($this->is_new){
+ if(isset($_POST['folderName'])){
+ $this->folderItem['name'] = get_post('folderName');
+ }
+ }
+
// Get all posted value modifications
foreach($this->folderItem['acls'] as $id => $aclEntry){
$this->folderItem['acls'] = array_values($this->folderItem['acls']);
}
+ function isNew()
+ {
+ return($this->isNew);
+ }
+
function save()
{
return($this->folderItem);
diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc
index ae3c5f9e6cc0ac867fa8e454312c226bb69cebc4..4307d73055bb81f5f57f9468b3c6d301380c65e2 100644 (file)
// effect on the results.
$this->rootBase = $this->fakeCnAttr.$this->rootName;
- $this->accountPrefix = (empty($accountPrefix)) ? "" : rtrim($accountPrefix,$pathSeparator).$pathSeparator;
+ $this->accountPrefix = (empty($accountPrefix)) ? "" : rtrim($accountPrefix,$this->pathSeparator).$this->pathSeparator;
$this->rootBase = $this->pathToDn($accountPrefix);
// Update the folder list, initially.
$data[$this->accountPrefix]['name'] = $this->rootName;
$data[$this->accountPrefix]['status'] = '';
$data[$this->accountPrefix]['acls'] = array();
- $data[$this->accountPrefix]['path'] = $this->rootName;
+ $data[$this->accountPrefix]['path'] = $this->accountPrefix;
$data[$this->accountPrefix]['type'] = 'manual';
$data[$this->accountPrefix]['base'] = $this->rootBase;
$data[$this->accountPrefix]['parentPath'] = "";
$data[$this->accountPrefix]['children'] = array();
+ $this->baseEntryMap[$this->rootBase] = $this->accountPrefix;
$ret['linear'][$this->accountPrefix] = &$data[$this->accountPrefix];
$base = &$data[$this->accountPrefix]['children'];
$this->FolderWidgetListing->setFolderList($this->folderList);
}
+
+ function addFolder()
+ {
+ $this->currentlyEditedItem = NULL;
+ $this->dialog = new FolderEditDialog($this->config, array(), TRUE);
+ $this->dialog->setPermissions($this->permissions);
+ }
+
+
function _recursiveRemoveByBase(&$arr, $base)
{
$ret = array();
$this->FolderWidgetListing->save_object();
// Handle dialogs
- if(isset($_POST['FolderEditDialog_ok'])){
+ if(isset($_POST['FolderEditDialog_ok']) && is_object($this->dialog)){
$this->dialog->save_object();
$msgs = $this->dialog->check();
if(count($msgs)){
msg_dialog::displayChecks($msgs);
}else{
- $newItem = $this->dialog->save();
- $path = $this->currentlyEditedItem['path'];
- $this->folderList['linear'][$path]['acls'] = $newItem['acls'];
+ if($this->dialog->isNew()){
+ // Detect the current entry
+ $base = $this->FolderWidgetListing->getBase();
+
+ if(isset($this->baseEntryMap[$base])){
+ $entry = $this->folderList['linear'][$this->baseEntryMap[$base]];
+ $path = $entry['path'];
+ $newItem = $this->dialog->save();
+ $name = $newItem['name'];
+ $newPath = "{$path}{$this->pathSeparator}{$name}";
+ $newItem['status'] = 'added';
+ $newItem['type'] = 'real';
+ $newItem['children'] = array();
+ $newItem['path'] = $newPath;
+ $newItem['parentPath'] = $entry['path'];
+ $newItem['folderType'] = $this->getFolderType($newItem);
+ $newItem['base'] = $this->pathToDn($newPath);
+ $this->folderList['linear'][$path]['children'][$newPath] = $newItem;
+ $this->baseEntryMap[$newItem['base']] = $newPath;
+ }
+ }else{
+ $newItem = $this->dialog->save();
+ $path = $this->currentlyEditedItem['path'];
+ $this->folderList['linear'][$path]['acls'] = $newItem['acls'];
+ }
$this->dialog = NULL;
}
}
diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidgetListing.inc b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidgetListing.inc
index fbbf7a2dbf249e8823bb3ac5253b09c3ec910d23..c1c114656987e52d1a739c9831eef6cb46d90b54 100644 (file)
$this->parent->editByBase($target[0]);
}
+ function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
+ {
+ $this->parent->addFolder();
+ }
+
protected function removeEntryRequested($action="",$target=array(),$all=array())
{
foreach($target as $tar){