Author: tmortagne Date: 2008-01-24 11:01:29 +0100 (Thu, 24 Jan 2008) New Revision: 7038
Modified: xwiki-platform/xwiki-applications/trunk/wiki-manager/src/main/resources/WikiManager/CreateNewWiki xwiki-platform/xwiki-applications/trunk/wiki-manager/src/main/resources/WikiResources/Translations Log: XAWM-50: Trying to create a wiki without wiki name should return error Modified: xwiki-platform/xwiki-applications/trunk/wiki-manager/src/main/resources/WikiManager/CreateNewWiki =================================================================== --- xwiki-platform/xwiki-applications/trunk/wiki-manager/src/main/resources/WikiManager/CreateNewWiki 2008-01-24 10:01:26 UTC (rev 7037) +++ xwiki-platform/xwiki-applications/trunk/wiki-manager/src/main/resources/WikiManager/CreateNewWiki 2008-01-24 10:01:29 UTC (rev 7038) @@ -12,9 +12,9 @@ <customClass></customClass> <contentAuthor>XWiki.Admin</contentAuthor> <creationDate>1186676964000</creationDate> -<date>1197555790000</date> -<contentUpdateDate>1199724181000</contentUpdateDate> -<version>1.1</version> +<date>1201167995000</date> +<contentUpdateDate>1201167995000</contentUpdateDate> +<version>6.1</version> <title></title> <template></template> <defaultTemplate></defaultTemplate> @@ -54,209 +54,209 @@ <tags/> </property> </object> -<content>############################################################################################ -#macro(getRequestList $paramlist $paramname) - #set($paramtable = []) - #set($paramtable = $request.getParameterValues($paramname)) - #if($paramtable) - #set($paramlist = []) - #foreach($paramvalue in $paramtable) - #set($ok = $paramlist.add($paramvalue)) - #end - #end -#end -## -#macro(printUsersAndGroups $users $groups $rightlevel $userlist $grouplist) - <select name="${rightlevel}users" id="${rightlevel}users" multiple="multiple"> - #foreach ($user in $users) - #if($context.database == $context.mainWikiName) #set($user = "${context.mainWikiName}:${user}") #end - <option value="$user" #if($userlist && $userlist.contains($user)) selected="selected" #end>$xwiki.getUserName($user, $xwiki.null, false)</option> - #end - </select> - <select name="${rightlevel}groups" id="${rightlevel}groups" multiple="multiple"> - #foreach ($group in $groups) - #if($context.database == $context.mainWikiName) #set($group = "${context.mainWikiName}:${group}") #end - #set($pointindex = $group.indexOf(".") + 1) - <option value="$group" #if($grouplist && $grouplist.contains($group)) selected="selected" #end>$group.substring($pointindex)</option> - #end - </select> -#end -## -#macro(addRights $prefdoc $userlist $grouplist $rights $needsave) - #set($users = "") - #foreach($user in $userlist) - #if($users != "") - #set($users = "${users},${user}") - #else - #set($users = $user) - #end - #end - #set($groups = "") - #foreach($group in $grouplist) - #if($groups != "") - #set($groups = "${groups},${group}") - #else - #set($groups = $group) - #end - #end - ## - #if(($users != "") || ($groups != "")) - #set ($rightsobj = $prefdoc.newObject("XWiki.XWikiGlobalRights")) - ## - #set ($ok = $rightsobj.set("users", $users)) - #set ($ok = $rightsobj.set("groups", $groups)) - #set ($ok = $rightsobj.set("levels", $rights)) - #set ($ok = $rightsobj.set("allow", 1)) - ## - #set($needsave = true) - #end -#end -############################################################################################ -#set($wikimanager = $xwiki.wikimanager) -#set($Exception = $wikimanager.DefaultException) -## -#set($domainname = "localdomain.com") -## -#set($wikidocument = $wikimanager.createWikiDocument()) -#set($wikidocumentobject = $wikidocument.updateObjectFromRequest("XWiki.XWikiServerClass")) -## -#set($action = $request.getParameter("action")) -## -#set($wikiname = $request.getParameter("wikiname")) -#set($wikitemplate = $request.getParameter("wikitemplate")) -#set($wikipackage = $request.getParameter("wikipackage")) -#if ($wikidocument.owner == "") - $wikidocument.set("owner", $context.user) -#end -#if ($wikidocument.server == "" && $wikiname && $wikiname != "") - $wikidocument.set("server", "${wikiname}.${domainname}") -#end -## -#getRequestList($readeruserlist "readersusers") -#getRequestList($readergrouplist "readersgroups") -#getRequestList($writeruserlist "writersusers") -#getRequestList($writergrouplist "writersgroups") -#getRequestList($adminuserlist "adminsusers") -#getRequestList($admingrouplist "adminsgroups") -## -############################################################################# -## -1 $msg.get("wikimanager.createwiki") -## -#if ($action && $action == "create") - #set($result = $wikimanager.createNewWiki($wikiname, $wikitemplate, $wikipackage, $wikidocument, true)) - ## - #if ($result == $Exception.ERROR_NOERROR) - ## Init new wiki global rights - #set($currentwiki = $context.database) - #set($ok = $context.setDatabase($wikidocument.wikiName)) - ## - #set($prefdoc = $xwiki.getDocument("XWiki.XWikiPreferences")) - ## - #set($needsave = false) - ## - #addRights($prefdoc $readeruserlist $readergrouplist "view, comment" $needsave) - #addRights($prefdoc $writeruserlist $writergrouplist "edit, view, comment" $needsave) - #addRights($prefdoc $adminuserlist $admingrouplist "admin" $needsave) - ## - #if($needsave) - $prefdoc.save() - #end - ## - #set($ok = $context.setDatabase($currentwiki)) - ## - #info($msg.get("wikimanager.successcreatewiki", [$wikiname, $wikidocument.getHomePageUrl()])) - #else - #if ($result == $Exception.ERROR_WM_WIKIALREADYEXISTS) - #error($msg.get("wikimanager.errorcreatewiki.ERROR_WM_WIKIALREADYEXISTS", [$wikiname, $result])) - #else - #error($msg.get("wikimanager.errorcreatewiki", [$wikiname, $result])) - #end - #end -#end -## -<form method="get" action="#"> - <fieldset> - <legend>$msg.get("wikimanager.legend.wiki")</legend> - <input type="hidden" name="action" value="create" /> - ## - <dl> - <dt>$msg.get("wikimanager.wikiname")</dt> - <dd><input size="30" id="wikiname" name="wikiname" type="text" /></dd> - </dl> - <dl> - <dt>$msg.get("wikimanager.wikidesc")</dt> - <dd>$wikidocument.display("description", "edit")</dd> - </dl> - <dl> - <dt>$msg.get("wikimanager.wikidomain")</dt> - <dd>$wikidocument.display("server", "edit")</dd> - </dl> - <dl> - <dt>$msg.get("wikimanager.wikiadmin")</dt> - <dd>$wikidocument.display("owner", "edit")</dd> - </dl> - <dl> - <dt>$msg.get("wikimanager.wikivisibility")</dt> - <dd>$wikidocument.display("visibility", "edit")</dd> - </dl> - <dl> - <dt>$msg.get("wikimanager.wikistate")</dt> - <dd>$wikidocument.display("state", "edit")</dd> - </dl> - </fieldset> - ############################################################################# - <fieldset> - <legend>$msg.get("wikimanager.legend.sources")</legend> - ## - <dl> - <dt><label for="wikitemplate">$msg.get("wikimanager.wikitemplate")</label></dt> - <dd> - <select name="wikitemplate" id="wikitemplate"> - <option value="">---</option> - #set($listtemplate=$wikimanager.getWikiTemplateList()) - #foreach ($template in $listtemplate) - <option value="$template.wikiName">$template.wikiName</option> - #end - </select> - </dd> - </dl> - <dl> - <dt><label for="wikipackage">$msg.get("wikimanager.wikipackage")</label></dt> - <dd> - <select name="wikipackage" id="wikipackage"> - <option value="">---</option> - #set($listpackage=$doc.getAttachmentList()) - #foreach ($package in $listpackage) - <option value="$package.getFilename()">$package.getFilename()</option> - #end - </select> - </dd> - </dl> - </fieldset> - ############################################################################# - #set($rightsmanager = $xwiki.rightsmanager) - #set($users = $rightsmanager.usersApi.allGlobalUsersNames) - #set($groups = $rightsmanager.groupsApi.allGlobalGroupsNames) - <fieldset> - <legend>$msg.get("wikimanager.legend.members")</legend> - ## - <dl> - <dt><label for="readersusers">$msg.get("wikimanager.readers")</label></dt> - <dd>#printUsersAndGroups($users $groups "readers" $readeruserlist $readergrouplist)</dd> - </dl> - <dl> - <dt><label for="writersusers">$msg.get("wikimanager.writers")</label></dt> - <dd>#printUsersAndGroups($users $groups "writers" $writeruserlist $writergrouplist)</dd> - </dl> - <dl> - <dt><label for="adminsusers">$msg.get("wikimanager.admins")</label></dt> - <dd>#printUsersAndGroups($users $groups "admins" $adminuserlist $admingrouplist)</dd> - </dl> - </fieldset> - <fieldset> - <legend>$msg.get("wikimanager.legend.validate")</legend> - <input type="submit" value="create" /> - </fieldset> +<content>############################################################################################ +#macro(getRequestList $paramlist $paramname) + #set($paramtable = []) + #set($paramtable = $request.getParameterValues($paramname)) + #if($paramtable) + #set($paramlist = []) + #foreach($paramvalue in $paramtable) + #set($ok = $paramlist.add($paramvalue)) + #end + #end +#end +## +#macro(printUsersAndGroups $users $groups $rightlevel $userlist $grouplist) + <select name="${rightlevel}users" id="${rightlevel}users" multiple="multiple"> + #foreach ($user in $users) + #if($context.database == $context.mainWikiName) #set($user = "${context.mainWikiName}:${user}") #end + <option value="$user" #if($userlist && $userlist.contains($user)) selected="selected" #end>$xwiki.getUserName($user, $xwiki.null, false)</option> + #end + </select> + <select name="${rightlevel}groups" id="${rightlevel}groups" multiple="multiple"> + #foreach ($group in $groups) + #if($context.database == $context.mainWikiName) #set($group = "${context.mainWikiName}:${group}") #end + #set($pointindex = $group.indexOf(".") + 1) + <option value="$group" #if($grouplist && $grouplist.contains($group)) selected="selected" #end>$group.substring($pointindex)</option> + #end + </select> +#end +## +#macro(addRights $prefdoc $userlist $grouplist $rights $needsave) + #set($users = "") + #foreach($user in $userlist) + #if($users != "") + #set($users = "${users},${user}") + #else + #set($users = $user) + #end + #end + #set($groups = "") + #foreach($group in $grouplist) + #if($groups != "") + #set($groups = "${groups},${group}") + #else + #set($groups = $group) + #end + #end + ## + #if(($users != "") || ($groups != "")) + #set ($rightsobj = $prefdoc.newObject("XWiki.XWikiGlobalRights")) + ## + #set ($ok = $rightsobj.set("users", $users)) + #set ($ok = $rightsobj.set("groups", $groups)) + #set ($ok = $rightsobj.set("levels", $rights)) + #set ($ok = $rightsobj.set("allow", 1)) + ## + #set($needsave = true) + #end +#end +############################################################################################ +#set($wikimanager = $xwiki.wikimanager) +#set($Exception = $wikimanager.DefaultException) +## +#set($domainname = "localdomain.com") +## +#set($wikidocument = $wikimanager.createWikiDocument()) +#set($wikidocumentobject = $wikidocument.updateObjectFromRequest("XWiki.XWikiServerClass")) +## +#set($action = $request.getParameter("action")) +## +#set($wikiname = $request.getParameter("wikiname")) +#set($wikitemplate = $request.getParameter("wikitemplate")) +#set($wikipackage = $request.getParameter("wikipackage")) +#if ($wikidocument.owner == "") + $wikidocument.set("owner", $context.user) +#end +#if ($wikidocument.server == "" && $wikiname && $wikiname != "") + $wikidocument.set("server", "${wikiname}.${domainname}") +#end +## +#getRequestList($readeruserlist "readersusers") +#getRequestList($readergrouplist "readersgroups") +#getRequestList($writeruserlist "writersusers") +#getRequestList($writergrouplist "writersgroups") +#getRequestList($adminuserlist "adminsusers") +#getRequestList($admingrouplist "adminsgroups") +## +############################################################################# +## +1 $msg.get("wikimanager.createwiki") +## +#if ($action && $action == "create") + #set($result = $wikimanager.createNewWiki($wikiname, $wikitemplate, $wikipackage, $wikidocument, true)) + ## + #if ($result == $Exception.ERROR_NOERROR) + ## Init new wiki global rights + #set($currentwiki = $context.database) + #set($ok = $context.setDatabase($wikidocument.wikiName)) + ## + #set($prefdoc = $xwiki.getDocument("XWiki.XWikiPreferences")) + ## + #set($needsave = false) + ## + #addRights($prefdoc $readeruserlist $readergrouplist "view, comment" $needsave) + #addRights($prefdoc $writeruserlist $writergrouplist "edit, view, comment" $needsave) + #addRights($prefdoc $adminuserlist $admingrouplist "admin" $needsave) + ## + #if($needsave) + $prefdoc.save() + #end + ## + #set($ok = $context.setDatabase($currentwiki)) + ## + #info($msg.get("wikimanager.successcreatewiki", [$wikiname, $wikidocument.getHomePageUrl()])) + #else + #if ($result == $Exception.ERROR_WM_WIKIALREADYEXISTS) + #error($msg.get("wikimanager.errorcreatewiki.ERROR_WM_WIKIALREADYEXISTS", [$wikiname, $result])) + #else + #error($msg.get("wikimanager.errorcreatewiki", [$wikiname, $context.lastexception])) + #end + #end +#end +## +<form method="get" action="#"> + <fieldset> + <legend>$msg.get("wikimanager.legend.wiki")</legend> + <input type="hidden" name="action" value="create" /> + ## + <dl> + <dt>$msg.get("wikimanager.wikiname")</dt> + <dd><input size="30" id="wikiname" name="wikiname" type="text" /></dd> + </dl> + <dl> + <dt>$msg.get("wikimanager.wikidesc")</dt> + <dd>$wikidocument.display("description", "edit")</dd> + </dl> + <dl> + <dt>$msg.get("wikimanager.wikidomain")</dt> + <dd>$wikidocument.display("server", "edit")</dd> + </dl> + <dl> + <dt>$msg.get("wikimanager.wikiadmin")</dt> + <dd>$wikidocument.display("owner", "edit")</dd> + </dl> + <dl> + <dt>$msg.get("wikimanager.wikivisibility")</dt> + <dd>$wikidocument.display("visibility", "edit")</dd> + </dl> + <dl> + <dt>$msg.get("wikimanager.wikistate")</dt> + <dd>$wikidocument.display("state", "edit")</dd> + </dl> + </fieldset> + ############################################################################# + <fieldset> + <legend>$msg.get("wikimanager.legend.sources")</legend> + ## + <dl> + <dt><label for="wikitemplate">$msg.get("wikimanager.wikitemplate")</label></dt> + <dd> + <select name="wikitemplate" id="wikitemplate"> + <option value="">---</option> + #set($listtemplate=$wikimanager.getWikiTemplateList()) + #foreach ($template in $listtemplate) + <option value="$template.wikiName">$template.wikiName</option> + #end + </select> + </dd> + </dl> + <dl> + <dt><label for="wikipackage">$msg.get("wikimanager.wikipackage")</label></dt> + <dd> + <select name="wikipackage" id="wikipackage"> + <option value="">---</option> + #set($listpackage=$doc.getAttachmentList()) + #foreach ($package in $listpackage) + <option value="$package.getFilename()">$package.getFilename()</option> + #end + </select> + </dd> + </dl> + </fieldset> + ############################################################################# + #set($rightsmanager = $xwiki.rightsmanager) + #set($users = $rightsmanager.usersApi.allGlobalUsersNames) + #set($groups = $rightsmanager.groupsApi.allGlobalGroupsNames) + <fieldset> + <legend>$msg.get("wikimanager.legend.members")</legend> + ## + <dl> + <dt><label for="readersusers">$msg.get("wikimanager.readers")</label></dt> + <dd>#printUsersAndGroups($users $groups "readers" $readeruserlist $readergrouplist)</dd> + </dl> + <dl> + <dt><label for="writersusers">$msg.get("wikimanager.writers")</label></dt> + <dd>#printUsersAndGroups($users $groups "writers" $writeruserlist $writergrouplist)</dd> + </dl> + <dl> + <dt><label for="adminsusers">$msg.get("wikimanager.admins")</label></dt> + <dd>#printUsersAndGroups($users $groups "admins" $adminuserlist $admingrouplist)</dd> + </dl> + </fieldset> + <fieldset> + <legend>$msg.get("wikimanager.legend.validate")</legend> + <input type="submit" value="create" /> + </fieldset> </form></content> </xwikidoc> Modified: xwiki-platform/xwiki-applications/trunk/wiki-manager/src/main/resources/WikiResources/Translations =================================================================== --- xwiki-platform/xwiki-applications/trunk/wiki-manager/src/main/resources/WikiResources/Translations 2008-01-24 10:01:26 UTC (rev 7037) +++ xwiki-platform/xwiki-applications/trunk/wiki-manager/src/main/resources/WikiResources/Translations 2008-01-24 10:01:29 UTC (rev 7038) @@ -12,9 +12,9 @@ <customClass></customClass> <contentAuthor>XWiki.Admin</contentAuthor> <creationDate>1186679007000</creationDate> -<date>1197474749000</date> -<contentUpdateDate>1199724180000</contentUpdateDate> -<version>1.1</version> +<date>1201168267000</date> +<contentUpdateDate>1201168267000</contentUpdateDate> +<version>2.1</version> <title></title> <template></template> <defaultTemplate></defaultTemplate> @@ -54,82 +54,82 @@ <tags/> </property> </object> -<content>{table} -## -# Wiki Manager translation page -## -wikimanager.wikimanager=Wiki Manager -## -wikimanager.wikinameneeded=A name for the wiki is necessary -## -# CONF -## -wikimanager.defaultdatetimeformat=yyyy MMMM dd 'at' HH:mm -## -# LABELS -## -wikimanager.createwiki=Create a new wiki -wikimanager.totalnumberofwiki=Total number of wiki -wikimanager.wikiname=Wiki name -wikimanager.wikidesc=Description -wikimanager.wikidomain=Domain -wikimanager.wikiadmin=Administrator -wikimanager.wikivisibility=Visibility -wikimanager.wikistate=State -wikimanager.wikitemplate=From wiki template -wikimanager.wikipackage=From package (attached file) -wikimanager.listwikiname=Name -wikimanager.listwikirank=Rank -wikimanager.listwikiadmin=Admin -wikimanager.listwikicreation=Creation -wikimanager.listwikistate=State -wikimanager.listwikivisibility=Visibility -wikimanager.legend.wiki=Wiki -wikimanager.legend.validate=Validate -wikimanager.legend.members=Members -wikimanager.legend.sources=Create new wiki from -wikimanager.readers=Readers -wikimanager.writers=Writers -wikimanager.admins=Administrators -## -# WIDGETS -## -wikimanager.widget.lastcreatedwikis.title=Last created wikis -wikimanager.widget.userwikisadmin.title=Wikis you administrate -wikimanager.widget.userwikisuser.title=Wikis you view -wikimanager.widget.userwikisowner.title=Wikis you own -wikimanager.widget.lastmodifications.title=Recent modifications -wikimanager.widget.mylastmodifications.title=My recent modifications -## -# ANSWERS -## -wikimanager.answer.deletewiki.title=Delete wiki -wikimanager.answer.deletewiki.msg=Are you sure you wish to delete wiki \"{0}\" ? -## -# ACTIONS -## -wikimanager.listwikiactions=Actions -wikimanager.listwikiactionspref=Pref -wikimanager.listwikiactionsmembers=Members -wikimanager.listwikiactionsrights=Rights -wikimanager.listwikiactionsgroups=Groups -wikimanager.listwikiactionsstat=Stat -wikimanager.action.setvisibility.public=Set as public -wikimanager.action.setvisibility.private=Set as private -wikimanager.action.setvisibility.template=Set as template -## -# MESSAGES -## -wikimanager.successdeletewiki=Wiki \"{0}\" deleted. -wikimanager.errordeletewiki=Wiki \"{0}\" delete failed with error code \"{1}\". -wikimanager.successsetvisibility=Wiki \"{0}\" visibility changed to \"{1}\". -wikimanager.errorsetvisibility=Wiki \"{0}' visibility changing failed with error code \"{1}\". -wikimanager.successcreatewiki=Your wiki \"{0}\" has been created. You can access it at the following address: {1}. -wikimanager.errorcreatewiki=Wiki \"{0}\" creation failed with error code \"{1}\". -wikimanager.errorcreatewiki.ERROR_WM_WIKIALREADYEXISTS=This wiki \"{0}\" already exist. Please choose another name. -wikimanager.listwikiempty=There are no open wikis. -## -# MOVE IN STANDARD XWIKI -error.ERROR_XWIKI_ACCESS_DENIED=You don't have permission to make this action. +<content>{table} +## +# Wiki Manager translation page +## +wikimanager.wikimanager=Wiki Manager +## +wikimanager.wikinameneeded=A name for the wiki is necessary +## +# CONF +## +wikimanager.defaultdatetimeformat=yyyy MMMM dd 'at' HH:mm +## +# LABELS +## +wikimanager.createwiki=Create a new wiki +wikimanager.totalnumberofwiki=Total number of wiki +wikimanager.wikiname=Wiki name +wikimanager.wikidesc=Description +wikimanager.wikidomain=Domain +wikimanager.wikiadmin=Administrator +wikimanager.wikivisibility=Visibility +wikimanager.wikistate=State +wikimanager.wikitemplate=From wiki template +wikimanager.wikipackage=From package (attached file) +wikimanager.listwikiname=Name +wikimanager.listwikirank=Rank +wikimanager.listwikiadmin=Admin +wikimanager.listwikicreation=Creation +wikimanager.listwikistate=State +wikimanager.listwikivisibility=Visibility +wikimanager.legend.wiki=Wiki +wikimanager.legend.validate=Validate +wikimanager.legend.members=Members +wikimanager.legend.sources=Create new wiki from +wikimanager.readers=Readers +wikimanager.writers=Writers +wikimanager.admins=Administrators +## +# WIDGETS +## +wikimanager.widget.lastcreatedwikis.title=Last created wikis +wikimanager.widget.userwikisadmin.title=Wikis you administrate +wikimanager.widget.userwikisuser.title=Wikis you view +wikimanager.widget.userwikisowner.title=Wikis you own +wikimanager.widget.lastmodifications.title=Recent modifications +wikimanager.widget.mylastmodifications.title=My recent modifications +## +# ANSWERS +## +wikimanager.answer.deletewiki.title=Delete wiki +wikimanager.answer.deletewiki.msg=Are you sure you wish to delete wiki \"{0}\" ? +## +# ACTIONS +## +wikimanager.listwikiactions=Actions +wikimanager.listwikiactionspref=Pref +wikimanager.listwikiactionsmembers=Members +wikimanager.listwikiactionsrights=Rights +wikimanager.listwikiactionsgroups=Groups +wikimanager.listwikiactionsstat=Stat +wikimanager.action.setvisibility.public=Set as public +wikimanager.action.setvisibility.private=Set as private +wikimanager.action.setvisibility.template=Set as template +## +# MESSAGES +## +wikimanager.successdeletewiki=Wiki \"{0}\" deleted. +wikimanager.errordeletewiki=Wiki \"{0}\" delete failed with error code \"{1}\". +wikimanager.successsetvisibility=Wiki \"{0}\" visibility changed to \"{1}\". +wikimanager.errorsetvisibility=Wiki \"{0}' visibility changing failed with error code \"{1}\". +wikimanager.successcreatewiki=Your wiki \"{0}\" has been created. You can access it at the following address: {1}. +wikimanager.errorcreatewiki=Wiki \"{0}\" creation failed ({1}). +wikimanager.errorcreatewiki.ERROR_WM_WIKIALREADYEXISTS=This wiki \"{0}\" already exist. Please choose another name. +wikimanager.listwikiempty=There are no open wikis. +## +# MOVE IN STANDARD XWIKI +error.ERROR_XWIKI_ACCESS_DENIED=You don't have permission to make this action. {table}</content> </xwikidoc> _______________________________________________ notifications mailing list notifications@xwiki.org http://lists.xwiki.org/mailman/listinfo/notifications