From: <ax...@us...> - 2009-08-18 15:44:51
|
Revision: 20961 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=20961&view=rev Author: axold Date: 2009-08-18 15:44:43 +0000 (Tue, 18 Aug 2009) Log Message: ----------- [MOD] Improvements over tiki-manage-workspaces.tpl Modified Paths: -------------- trunk/lib/workspaces/wslib.php trunk/templates/tiki-manage-workspaces.tpl trunk/tiki-manage-workspaces.php Modified: trunk/lib/workspaces/wslib.php =================================================================== --- trunk/lib/workspaces/wslib.php 2009-08-18 15:16:59 UTC (rev 20960) +++ trunk/lib/workspaces/wslib.php 2009-08-18 15:44:43 UTC (rev 20961) @@ -3,6 +3,8 @@ * wslib.php - TikiWiki CMS/GroupWare * * This library enables the basic management of workspaces (WS) + * TODO: Probably we need to modify this to adapt it to perspectives and + * new stuff added to Tiki in the last Tikifest. * * @package lib * @author Benjamin Palacios Gonzalo (mangapower) <man...@gm...> @@ -122,7 +124,7 @@ if (!$wsName) $wsName = $this->get_ws_name($ws_id); - $groupName = $nameGroup;//$this->generate_ws_group_name ($id_ws, $wsName, $nameGroup); //With this you can create two groups with same name in different ws + $groupName = $nameGroup; if ($userlib->add_group($groupName, $description)) { @@ -139,35 +141,6 @@ return false; } - /** Generate a group name specially created for WS. With this we can avoid the problems related to have two groups with the same name - * NOTE: For now is OK, if the future implementation of groups change, this would change! - * - * @param $id_ws The WS id - * @param $wsname The WS name - * @param $nameGroup The group name - * @return A string with this format: $id_ws::$wsName::$nameGroup - */ - public function generate_ws_group_name ($ws_id, $wsName, $nameGroup) - { - return $name = ((string) $ws_id)."::".$wsName."::".$nameGroup; - } - - /** Parse a group name with the form $ws_id<:>$wsName<:>$nameGroup - * Allowed characters in $ws_id are 0-9 with a variable length of 1 to 11 digits - * Allowed characters in $wsName are 0-9, A-Z, a-z, whitespace, -, < and > - * Allowed characters in $nameGroup are the same as above - * TODO: Work in progress, needs to be checked if works properly (I'm newbie to regex world :P) - * Yeah, I know, this exp is far from being perfect, but for testing purposes is OK - * - * @param $groupName The name of the group you want to parse - * @param $groupValues The values given in a reference array when you apply the function - * @return An array with the values in each position. If the parse was not succesful return false - */ - public function parse_ws_group_name ($groupName, &$groupValues) - { - return preg_match("%\b([\d]{1,11})\b::\b([\w\-<>\s]+)\b::\b([\w\-<>\s]+[^:]{2})\b%", $groupName, $groupValues); - } - /** Change a WS name and description * * @param $ws_id The WS id you want to update Modified: trunk/templates/tiki-manage-workspaces.tpl =================================================================== --- trunk/templates/tiki-manage-workspaces.tpl 2009-08-18 15:16:59 UTC (rev 20960) +++ trunk/templates/tiki-manage-workspaces.tpl 2009-08-18 15:44:43 UTC (rev 20961) @@ -2,6 +2,12 @@ {title help="Workspaces+Management" admpage="login"}{tr}Workspaces Management{/tr}{/title} +{if $feedback} + {remarksbox type="$type" title="{tr}Note{/tr}"} + {tr}{$feedback}{/tr} + {/remarksbox} +{/if} + {tabset name="manageWS"} {if $editWS == "y"} @@ -175,21 +181,36 @@ <a class="button" href = {$next_pageWS}>Next</a> {/if} - <table class = admin> + <table class ="normal"> <tr> - <th>Name</th> - <th>Description</th> - <th>Path</th> - <th>Actions</th> + <th class="auto">{select_all checkbox_names='checked[]'}</th> + <th>{self_link _sort_arg='sort_mode' _sort_field='wsName'}{tr}Name{/tr}{/self_link}</th> + <th>{tr}Description{/tr}</th> + <th>{tr}Path{/tr}</th> + <th>{tr}Actions{/tr}</th> </tr> {cycle print=false values="even,odd"} {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>{$data.description}</td> <td>{$data.categpath}</td> + <td>Something</td> </tr> {/foreach} + <tr> + <td class="form" colspan="18"> + <p align="left"> + {tr}Perform action with checked:{/tr} + <select name="submit_mult"> + <option value="" selected="selected">-</option> + <option value="remove_workspaces" >{tr}Remove these Workspaces{/tr}</option> + </select> + <input type="submit" value="{tr}OK{/tr}" /> + </p> + </td> + </tr> </table> </div> {/tab} @@ -247,7 +268,8 @@ </tr> </table> </div> - <input type="submit" value="Create" class="button" align="middle"> + <input type="hidden" value="create" name="create" /> + <input type="submit" value="Create" class="button" align="middle" /> </form> {/tab} Modified: trunk/tiki-manage-workspaces.php =================================================================== --- trunk/tiki-manage-workspaces.php 2009-08-18 15:16:59 UTC (rev 20960) +++ trunk/tiki-manage-workspaces.php 2009-08-18 15:44:43 UTC (rev 20961) @@ -11,7 +11,7 @@ die; } -if ( isset($_REQUEST['wsName'])) +if ( isset($_REQUEST['create']) ) { $name = $_REQUEST['wsName']; $description = $_REQUEST["wsDesc"]; @@ -33,43 +33,36 @@ } // Check if the name and the group are written - if (empty($name)) + if (empty($name) || empty($groupName)) { - $smarty->assign('msg', tra("Workspace can not be blank")); + $smarty->assign('msg', tra("Workspace name or group name can not be blank.")); $smarty->display("error.tpl"); die; } - else if (empty($groupName)) - { - $smarty->assign('msg', tra("Group name can not be blank")); - $smarty->display("error.tpl"); - die; - } // Check if a WS with the same name exists in the same level $wsid = $wslib->get_ws_id($name, $parentWS); if (!empty($wsid)) { - $smarty->assign('msg', tra("There already exists a Workspace with that name in the same level")); + $smarty->assign('msg', tra("There already exists a Workspace with that name in the same level. Please choose another name.")); $smarty->display("error.tpl"); die; } - // If everything is ok, then the Workspace is created - else - { - $perms = array($adminPerms); - $groups = array(); - $groups[] = array( - "groupName" => $groupName, - "groupDescription" => $groupDesc, - "noCreateNewGroup" => $noCreate, - "additionalPerms" => $perms - ); - $wslib->create_ws ($name, $groups, $parentWS, $description); - - header("Location: ./tiki-manage-workspaces.php"); - } + //If everything is ok, then we proceed to create the WS + $perms = array($adminPerms); + $groups = array(); + $groups[] = array( + "groupName" => $groupName, + "groupDescription" => $groupDesc, + "noCreateNewGroup" => $noCreate, + "additionalPerms" => $perms + ); + + $wslib->create_ws ($name, $groups, $parentWS, $description); + + $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'])) @@ -181,17 +174,6 @@ $offsetObj_next = (int) $offsetObj + (int) $maxRecordObj; $href_next = "tiki-manage-workspaces.php?editWS=".$wsId."&maxRecordObj=".$maxRecordObj."&offsetObj=".$offsetObj_next; } - $smarty->assign('prev_pageObj',$href_prev); - $smarty->assign('next_pageObj',$href_next); - - $listGroups = $userlib->get_groups(); - $smarty->assign('listGroupsforAdd', $listGroups); - - $listPerms = $wslib->get_ws_adminperms (); - $smarty->assign('listPerms', $listPerms); - - $smarty->assign('mid', 'tiki-manage-workspaces.tpl'); - $smarty->display('tiki.tpl'); } else { @@ -228,20 +210,21 @@ $href_next = "tiki-manage-workspaces.php?maxRecords=".$maxRecords."&offset=".$offset_next; } - $smarty->assign('prev_pageWS',$href_prev); - $smarty->assign('next_pageWS',$href_next); +} + +$smarty->assign('prev_pageWS',$href_prev); +$smarty->assign('next_pageWS',$href_next); - // Add Workspace Tab - $listGroups = $userlib->get_groups(); - $smarty->assign('listGroups', $listGroups); +// Add Workspace Tab +$listGroups = $userlib->get_groups(); +$smarty->assign('listGroups', $listGroups); - $listParentWS = $wslib->list_all_ws(-1,-1,'name_asc',null,'',''); - $smarty->assign('listParentWS', $listParentWS); +$listParentWS = $wslib->list_all_ws(-1,-1,'name_asc',null,'',''); +$smarty->assign('listParentWS', $listParentWS); - $listPerms = $wslib->get_ws_adminperms (); - $smarty->assign('listPerms', $listPerms); +$listPerms = $wslib->get_ws_adminperms (); +$smarty->assign('listPerms', $listPerms); - $smarty->assign('mid', 'tiki-manage-workspaces.tpl'); - $smarty->display('tiki.tpl'); -} +$smarty->assign('mid', 'tiki-manage-workspaces.tpl'); +$smarty->display('tiki.tpl'); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |