Commit 8449200d authored by Ludovic Dubost's avatar Ludovic Dubost

Fixes for nested spaces

Fixes for subdirectory in repository
parent 8e0ebd51
......@@ -189,7 +189,7 @@ public class GitLabGroovy {
public getFilePath(pagedoc, nested) {
// get page
def filePath = repsrcpath + "/" + ((nested) ? pagedoc.getSpace().replaceAll("[.]","/") : pagedoc.getSpace()) + "/" + pagedoc.getName();
def filePath = getSourcePath() + ((nested) ? pagedoc.getSpace().replaceAll("[.]","/") : pagedoc.getSpace()) + "/" + pagedoc.getName();
def language = pagedoc.getLanguage();
if (language!=null&&language!="")
filePath += "." + language;
......@@ -541,6 +541,14 @@ public class GitLabGroovy {
}
}
public containsSpace(spaceName, spaceList) {
for (item in spaceList) {
if (spaceName.startsWith(item))
return true;
}
return false;
}
public getChangedPages(String spaces, String savedlist) {
def changedMap = new TreeMap();
def gitlabEntries = getEntries(spaces);
......@@ -587,9 +595,11 @@ public class GitLabGroovy {
if (spaceList!=null) {
for (filePath in gitlabEntries.keySet()) {
def entry = gitlabEntries.get(filePath);
def i1 = filePath.indexOf("/");
def i0 = getSourcePath().size()
def i1 = filePath.lastIndexOf("/");
def i2 = filePath.indexOf(".xml");
def spaceName = (i1==-1) ? filePath : filePath.substring(0, i1);
def spaceName = (i1==-1) ? filePath : filePath.substring(i0, i1);
spaceName = spaceName.replaceAll("/", ".")
def page = (i2==-1) ? filePath : filePath.substring(i1+1, i2);
def language = "";
def pageName = page;
......@@ -598,8 +608,17 @@ public class GitLabGroovy {
language = page.substring(i3+1);
pageName = page.substring(0, i3);
}
if (spaceList.contains(spaceName)&&!samePages.contains(filePath)&&!changedMap.keySet().contains(spaceName + "." + page)) {
debug("SpaceName: ${spaceName} SpaceList: ${spaceList} SamePages: ${samePages} FilePath: ${filePath} Page: ${spaceName}.${page}")
if (containsSpace(spaceName, spaceList)&&!samePages.contains(filePath)&&!changedMap.keySet().contains(spaceName + "." + page)) {
changedMap.put(spaceName + "." + pageName, [ "fullname" : "${spaceName}.${pageName}", "language" : language, "status" : "N", "xwikiversion" : "", "gitlabsha" : entry.gitlabsha ])
debug("Adding page ${spaceName}.${page}")
} else {
if (!containsSpace(spaceName, spaceList))
debug("${spaceName} not in ${spaceList}")
if (samePages.contains(filePath))
debug("${filePath} already in list")
if (changedMap.keySet().contains(spaceName + "." + page))
debug("${spaceName}.${page} already in list")
}
}
}
......
......@@ -49,7 +49,7 @@
#set($ok = $newdoc.setTitle($request.title))
#set($ok = $newdoc.setContent('{{include document="GitLab.Code.GitLabConfigSheet" /}}'))
#set($ok = $newdoc.setParent("GitLab.WebHome"))
#set($ok = $newdoc.newObject("GitLab.Code.GitLanConfigClass"))
#set($ok = $newdoc.newObject("GitLab.Code.GitLabConfigClass"))
#set($ok = $newdoc.save())
$response.sendRedirect($newdoc.getURL())
#end
......
......@@ -290,10 +290,11 @@ GitLab.Code/GitLabConfigClass;5.29;-194487630;0
GitLab.Code/Translations.fr;3.2;-1345184648;0
GitLab.Code/GitLabConfigSheet;4.35;-448639615;0
GitLab.Code/Translations;4.3;1172122766;0
GitLab/HLSDescriptor;25.1;;
GitLab.Code/GitLabAuthClass;1.6;1180696900;0
GitLab.Code/SavedListSuggest;1.2;;
GitLab.Code/LicenceFile;2.2;-1093592173;0
GitLab/GitLabAppDescriptor;137.1;779468586;
GitLab/GitLabAppDescriptor;149.1;-1557815698;
GitLab.Code/GitLabGroovy;4.9;1881191348;0
GitLab/WebHome;3.1;731582271;0
</status>
......
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