Commit 542dfdac authored by axold's avatar axold

[MOD] Improved tiki-manage-workspaces.php interface, and added some missing thins in sql

parent bc4dd28f
......@@ -426,6 +426,7 @@ CREATE TABLE `tiki_categories` (
`description` varchar(250) default NULL,
`parentId` int(12) default NULL,
`hits` int(8) default NULL,
`rootCategId` int(12) default Null,
PRIMARY KEY (`categId`)
) ENGINE=MyISAM AUTO_INCREMENT=1 ;
......@@ -1340,6 +1341,12 @@ INSERT INTO `tiki_menu_options` (`menuId`, `type`, `name`, `url`, `position`, `s
INSERT INTO `tiki_menu_options` (`menuId`, `type`, `name`, `url`, `position`, `section`, `perm`, `groupname`, `userlevel`) VALUES (42,'s','Newsletters','tiki-newsletters.php',900,'feature_newsletters','tiki_p_list_newsletters','',0);
INSERT INTO `tiki_menu_options` (`menuId`, `type`, `name`, `url`, `position`, `section`, `perm`, `groupname`, `userlevel`) VALUES (42,'o','Send Newsletters','tiki-send_newsletters.php',905,'feature_newsletters','tiki_p_send_newsletters','',0);
INSERT INTO `tiki_menu_options` (`menuId`, `type`, `name`, `url`, `position`, `section`, `perm`, `groupname`, `userlevel`) VALUES (42,'o','Admin Newsletters','tiki-admin_newsletters.php',910,'feature_newsletters','tiki_p_admin_newsletters','',0);
INSERT INTO `tiki_menu_options` (`menuId`, `type`, `name`, `url`, `position`, `section`, `perm`, `groupname`, `userlevel`) VALUES (42,'s','Workspaces','tiki-workspaces-index.php',920,'feature_workspaces','tiki_p_view_ws','',0);
INSERT INTO `tiki_menu_options` (`menuId`, `type`, `name`, `url`, `position`, `section`, `perm`, `groupname`, `userlevel`) VALUES (42,'o','Workspaces Home','tiki-workspaces-index.php',925,'feature_workspaces','tiki_p_view_ws','',0);
INSERT INTO `tiki_menu_options` (`menuId`, `type`, `name`, `url`, `position`, `section`, `perm`, `groupname`, `userlevel`) VALUES (42,'o','My Workspaces','tiki-my-workspaces.php',930,'feature_workspaces','tiki_p_view_ws','',0);
INSERT INTO `tiki_menu_options` (`menuId`, `type`, `name`, `url`, `position`, `section`, `perm`, `groupname`, `userlevel`) VALUES (42,'o','Manage Workspaces','tiki-manage-workspaces.php',935,'feature_workspaces','tiki_p_admin_ws.php','',0);
INSERT INTO `tiki_menu_options` (`menuId`, `type`, `name`, `url`, `position`, `section`, `perm`, `groupname`, `userlevel`) VALUES (42,'r','Admin','tiki-admin.php',1050,'','tiki_p_admin','',0);
INSERT INTO `tiki_menu_options` (`menuId`, `type`, `name`, `url`, `position`, `section`, `perm`, `groupname`, `userlevel`) VALUES (42,'r','Admin','tiki-admin.php',1050,'','tiki_p_admin_categories','',0);
INSERT INTO `tiki_menu_options` (`menuId`, `type`, `name`, `url`, `position`, `section`, `perm`, `groupname`, `userlevel`) VALUES (42,'r','Admin','tiki-admin.php',1050,'','tiki_p_admin_banners','',0);
......
......@@ -98,6 +98,7 @@ class CategLib extends ObjectLib {
return $retval;
}
//With this you can exclude certain types of categories (i.e ws)
function exclude_categs ($excludeCategId, $find, $showWS = false)
{
if ($excludeCategId)
......
......@@ -9,161 +9,8 @@
{/if}
{tabset name="manageWS"}
{if $editWS == "y"}
{tab name="{tr}Name & Description{/tr}"}
<div class="cbox" align="left">
<form action="tiki-manage-workspaces.php" method="post">
<div>
<label for="wsNewName">Name: <br/></label>
<input type="text" id="wsNewName" name="wsNewName" size="30" value="{$wsName}"/>
</div>
<div>
<label for="wsNewDesc">Description: <br/></label>
<textarea name="wsNewDesc" id="wsNewDesc" cols="40" rows="10" >{$wsDesc}</textarea>
</div>
</div>
<input type="hidden" id="editedWS" name="editedWS" value={$wsId} />
<input type="submit" value="Save" class="button" align="middle">
</form>
{/tab}
{tab name="{tr}Groups{/tr}"}
<table class='wikiplugin-split normal'>
<tr>
<td valign="top" width="60%" >
<h2>Groups in '{$wsName}'</h2>
<div class="cbox">
<table class="admin">
<tr>
<th>Group Name</th>
<th>Description</th>
</tr>
{foreach from=$groups item=data}
<tr>
<td><a>{$data.groupName}</a></td>
<td>{$data.groupDesc}</td>
</tr>
{/foreach}
</table>
</div>
{if not empty($prev_pageGroup)}
<a class="button" href = {$prev_pageGroup}>Back</a>
{/if}
{if not empty($next_pageGroup)}
<a class="button" href = {$next_pageGroup}>Next</a>
{/if}
</td>
<td valign="top" width="40%" >
<h2>Add Group in '{$wsName}'</h2>
<form action="tiki-manage-workspaces.php" method="post">
<div class="cbox" align="left">
Choose a group option: <br />
<input type="radio" name="addGroupSelect" id="addNew" value="addNew" />
<label for="new"> Create a new group:</label>
<input type="text" id="addNewGroup" name="addNewGroup" size="20" />
<label for="groupDescrition"><br />Description:</label>
<textarea name="addGroupDesc" id="addGroupDesc" cols="30" rows="1"></textarea>
<br />
<input type="radio" name="addGroupSelect" id="addOld" value="addOld" checked="checked"/>
<label for="addOld"> Select an old group:
</label>
<select name="addOldGroup" id="addOldGroup">
{foreach from=$listGroupsforAdd.data item=group}
<option value="{$group.groupName}">{$group.groupName}</option>
{/foreach}
</select>
</div>
<div>
<label for="addAdminPerms">Select an admin permission for this group (optional): <br /></label>
<select name="addAdminPerms" id="addAdminPerms">
<option> </option>
{foreach from=$listPerms item=perm}
<option value={$perm.permName}>{$perm.permName} - {$perm.permDesc}</option>
{/foreach}
</select>
</div>
<input type="submit" value="Add Group" class="button">
<input type="hidden" id="addGroupinWS" name="addGroupinWS" value={$wsId} />
</form>
</td>
</tr>
</table>
{/tab}
{tab name="{tr}Objects{/tr}"}
<table border='0' cellpadding='0' cellspacing='0' class='wikiplugin-split normal'>
<tr>
<td valign="top" width="60%" >
<h2>Objects in '{$wsName}'</h2>
<div class="cbox">
<table class="admin">
<tr>
<th>Object Name</th>
<th>Type</th>
<th>Description</th>
</tr>
{foreach from=$resources item=data}
<tr>
<td><a href = {$data.href}>{$data.name}</a></td>
<td>{$data.type}</td>
<td>{$data.description}</td>
</tr>
{/foreach}
</table>
</div>
{if not empty($prev_pageObj)}
<a class="button" href = {$prev_pageObj}>Back</a>
{/if}
{if not empty($next_pageObj)}
<a class="button" href = {$next_pageObj}>Next</a>
{/if}
</td>
<td valign="top" width="40%" >
<h2>Add Object in '{$wsName}'</h2>
<div class="cbox" align="left">
<form action="tiki-manage-workspaces.php" method="post">
<div>
<label for="objectName">Name: <br/></label>
<input type="text" id="objectName" name="objectName" size="30" />
</div>
<div>
<label for="selectType">Type: </br> </label>
<select name="selectType" id="selectType">
<option value="wiki page">Wiki Page</option>
<option value="forum">Forum</option>
<option value="blog">Blog</option>
<option value="fgal">File Gallery</option>
<option value="gallery">Image Gallery</option>
<option value="tracker">Tracker</option>
<option value="faq">Faq</option>
<option value="quiz">Quiz</option>
<option value="article">Article</option>
<option value="calendar">Calendar</option>
<option value="sheet">Sheet</option>
<option value="survey">Survey</option>
<option value="category">Category</option>
</select>
</div>
<div>
<label for="objectDesc">Description: <br/></label>
<textarea name="objectDesc" id="objectDesc" cols="30" rows="5" ></textarea>
</div>
</div>
<input type="submit" value="Create Object" class="button">
<input type="hidden" id="addObjectinWS" name="addObjectinWS" value={$wsId} />
</form>
</td>
</tr>
</table>
{/tab}
{else}
{tab name="{tr}List WorkSpaces{/tr}"}
{tab name="{tr}List WorkSpaces{/tr}"}
<div class="cbox">
<h2>{tr}List of Workspaces{/tr}</h2>
......@@ -171,16 +18,10 @@
{include file='find.tpl' find_show_num_rows='y'}
{* if $cant_pages > 1 or !empty($initial) or !empty($find) *}
{initials_filter_links}
{*initials_filter_links*}
{* /if *}
{if not empty($prev_pageWS)}
<a class="button" href="{$prev_pageWS}">Back</a>
{/if}
{if not empty($next_pageWS)}
<a class="button" href="{$next_pageWS}">Next</a>
{/if}
<form name="mult_edit" method="post" action="{$smarty.server.PHP_SELF}">
<table class ="normal">
<tr>
<th class="auto">{select_all checkbox_names='checked[]'}</th>
......@@ -193,15 +34,17 @@
{foreach from=$listWS item=data}
<tr class="{cycle}">
<td><input type="checkbox" name="checked[]" value="{$data.name}" /></td>
<td><a href ="{$data.href_edit}">{$data.name}</a></td>
<td><a href ="tiki-manage-workspaces.php?editWS={$data.href_edit}" title="View {$data.name}">{$data.name}</a></td>
<td>{$data.description}</td>
<td>{$data.categpath}</td>
<td>Something</td>
<td>
{self_link _class="link" editWS=$data.id _icon="page_edit" _title="{tr}Edit Workspace Settings{/tr}: `$data.name`"}{/self_link}
{self_link _class="link" deleteWS=$data.id _icon="cross" _title="{tr}Remove this Workspace and its childrens (if apply){/tr}"}{/self_link}
</td>
</tr>
{/foreach}
<tr>
<td class="form" colspan="18">
<form name="mult_edit" method="post" action="{$smarty.server.PHP_SELF}">
<p align="left">
{tr}Perform action with checked:{/tr}
<select name="submit_mult">
......@@ -210,10 +53,10 @@
</select>
<input type="submit" value="{tr}OK{/tr}" />
</p>
</form>
</td>
</tr>
</table>
</form>
</div>
{/tab}
......@@ -275,5 +118,4 @@
</form>
{/tab}
{/if}
{/tabset}
......@@ -265,7 +265,6 @@ if (isset($_REQUEST['batch']) && is_uploaded_file($_FILES['csvlist']['tmp_name']
$area = 'batchdeluser';
if ($prefs['feature_ticketlib2'] == 'n' or (isset($_REQUEST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
key_check($area);
var_dump($_REQUEST['checked']);
foreach($_REQUEST["checked"] as $deleteuser) if ($deleteuser != 'admin') {
$userlib->remove_user($deleteuser);
$logslib->add_log('users', sprintf(tra("Deleted account %s") , $deleteuser));
......
......@@ -64,54 +64,6 @@ if ( isset($_REQUEST['create']) )
$smarty->assign('type', 'note');
$smarty->assign('feedback', 'You have succesfully created the Workspace!');
}
// If WS Name and Description is edited
else if ( isset($_REQUEST['editedWS']))
{
$wsId = $_REQUEST['editedWS'];
$wsName = $_REQUEST['wsNewName'];
$wsDesc = $_REQUEST['wsNewDesc'];
$wslib->update_ws_data($wsId, $wsName, $wsDesc);
header("Location: ./tiki-manage-workspaces.php?editWS=".$wsId);
}
// If an object is added in the WS
else if ( isset($_REQUEST['addObjectinWS']))
{
$wsId = $_REQUEST['addObjectinWS'];
$name = $_REQUEST['objectName'];
$type = $_REQUEST['selectType'];
$description = $_REQUEST['objectDesc'];
$wslib->create_ws_object ($wsId, $name, $type, $description);
header("Location: ./tiki-manage-workspaces.php?editWS=".$wsId);
}
// If a group is added in the WS
else if ( isset($_REQUEST['addGroupinWS']))
{
$wsId = $_REQUEST['addGroupinWS'];
if ($_REQUEST['addAdminPerms'] != '')
$additionalPerms = array($_REQUEST['addAdminPerms']);
// If selected, create a new group
if ($_REQUEST['addGroupSelect'] == "addNew")
{
$groupName = $_REQUEST['addNewGroup'];
$groupDesc = $_REQUEST["addGroupDesc"];
$wslib->add_ws_group ($wsId, null, $groupName, $groupDesc, $additionalPerms);
}
// else, will select a previously created group
else if ($_REQUEST['addGroupSelect'] == "addOld")
{
$groupName = $_REQUEST['addOldGroup'];
$wslib->set_permissions_for_group_in_ws ($wsId, $groupName, array('tiki_p_ws_view'));
if ($additionalPerms != null)
$wslib->set_permissions_for_group_in_ws($wsId, $groupName, $additionalPerms);
}
header("Location: ./tiki-manage-workspaces.php?editWS=".$wsId);
}
else if ( isset($_REQUEST['editWS']))
{
$smarty->assign('editWS', "y");
......@@ -175,52 +127,54 @@ else if ( isset($_REQUEST['editWS']))
$href_next = "tiki-manage-workspaces.php?editWS=".$wsId."&maxRecordObj=".$maxRecordObj."&offsetObj=".$offsetObj_next;
}
}
else
{
require_once 'lib/userslib.php';
// List Workspaces Tab
if ((!isset($_REQUEST['maxRecords'])) || ($_REQUEST['maxRecords'] < 1))
$_REQUEST['maxRecords'] = 15;
if ((!isset($_REQUEST['offset'])) || ($_REQUEST['offset'] < 0))
$_REQUEST['offset'] = 0;
require_once 'lib/userslib.php';
$maxRecords = $_REQUEST['maxRecords'];
$offset = $_REQUEST['offset'];
// List Workspaces Tab
if (isset($_REQUEST['deleteWS']))
$wslib->remove_ws($_REQUEST['deleteWS']);
if (isset($_REQUEST['submit_mult']) && ($_REQUEST['submit_mult'] == 'remove_workspaces'))
{
foreach($_REQUEST["checked"] as $deleteWS)
{
$wslib->remove_ws($deleteWS);
}
}
if ((!isset($_REQUEST['maxRecords'])) || ($_REQUEST['maxRecords'] < 1))
$_REQUEST['maxRecords'] = 15;
if (isset($_REQUEST['sort_mode']))
$sort_mode = $_REQUEST['sort_mode'];
else
$sort_mode = 'name_asc';
if ((!isset($_REQUEST['offset'])) || ($_REQUEST['offset'] < 0))
$_REQUEST['offset'] = 0;
$listWS_temp = $wslib->list_all_ws($offset, $maxRecords, $sort_mode, "", "", "");
$listWS = array('data' =>array(), 'cant'=>$listWS_temp['cant']);
foreach ($listWS_temp["data"] as $res)
{
$res['href_edit'] = "tiki-manage-workspaces.php?editWS=".$res["categId"];
$listWS['data'][] = $res;
}
$smarty->assign('listWS', $listWS["data"]);
$maxRecords = $_REQUEST['maxRecords'];
$offset = $_REQUEST['offset'];
if (isset($_REQUEST['sort_mode']))
$sort_mode = $_REQUEST['sort_mode'];
else
$sort_mode = 'name_asc';
if ($offset > 0)
{
$offset_prev = (int) $offset- (int) $maxRecords;
$href_prev = "tiki-manage-workspaces.php?maxRecords=".$maxRecords."&offset=".$offset_prev;
}
if (((int) $offset + (int) $maxRecords) < (int) $listWS["cant"])
{
$offset_next = (int) $offset+ (int) $maxRecords;
$href_next = "tiki-manage-workspaces.php?maxRecords=".$maxRecords."&offset=".$offset_next;
}
$listWS_temp = $wslib->list_all_ws($offset, $maxRecords, $sort_mode, "", "", "");
$listWS = array('data' =>array(), 'cant'=>$listWS_temp['cant']);
foreach ($listWS_temp["data"] as $res)
{
$res['id'] = $res["categId"];
$listWS['data'][] = $res;
}
if (isset($_REQUEST['submit_mult']) && ($_REQUEST['submit_mult'] == 'remove_workspaces'))
{
var_dump($_REQUEST['checked']);
foreach($_REQUEST["checked"] as $deleteWS)
{
var_dump($deleteWS);
}
}
$smarty->assign('listWS', $listWS["data"]);
if ($offset > 0)
{
$offset_prev = (int) $offset- (int) $maxRecords;
$href_prev = "tiki-manage-workspaces.php?maxRecords=".$maxRecords."&offset=".$offset_prev;
}
if (((int) $offset + (int) $maxRecords) < (int) $listWS["cant"])
{
$offset_next = (int) $offset+ (int) $maxRecords;
$href_next = "tiki-manage-workspaces.php?maxRecords=".$maxRecords."&offset=".$offset_next;
}
$smarty->assign('prev_pageWS',$href_prev);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment