Fixed and closed #508: edit section link completely removed from output if current user does not have editing permissions.
This commit is contained in:
parent
2c00a1d10d
commit
df9cdacc66
2 changed files with 25 additions and 4 deletions
|
@ -16,5 +16,5 @@ using System.Reflection;
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("3.0.2.537")]
|
[assembly: AssemblyVersion("3.0.2.538")]
|
||||||
[assembly: AssemblyFileVersion("3.0.2.537")]
|
[assembly: AssemblyFileVersion("3.0.2.538")]
|
||||||
|
|
|
@ -2424,9 +2424,30 @@ namespace ScrewTurn.Wiki {
|
||||||
if(canEdit || canEditWithApproval) {
|
if(canEdit || canEditWithApproval) {
|
||||||
sb.Replace(EditSectionPlaceHolder, Exchanger.ResourceExchanger.GetResource("Edit"));
|
sb.Replace(EditSectionPlaceHolder, Exchanger.ResourceExchanger.GetResource("Edit"));
|
||||||
}
|
}
|
||||||
else sb.Replace(EditSectionPlaceHolder, "");
|
|
||||||
}
|
}
|
||||||
else sb.Replace(EditSectionPlaceHolder, "");
|
|
||||||
|
// Remove all placeholders left in the page and their wrapping link
|
||||||
|
try {
|
||||||
|
int editSectionPhIdx = 0;
|
||||||
|
do {
|
||||||
|
string tempString = sb.ToString();
|
||||||
|
editSectionPhIdx = tempString.IndexOf(EditSectionPlaceHolder);
|
||||||
|
if(editSectionPhIdx >= 0) {
|
||||||
|
// Find first '<' before index, and first '>' after index
|
||||||
|
int openingIndex = editSectionPhIdx;
|
||||||
|
while(openingIndex > 0 && tempString[openingIndex] != '<') {
|
||||||
|
openingIndex--;
|
||||||
|
}
|
||||||
|
int closingIndex = tempString.IndexOf('>', editSectionPhIdx);
|
||||||
|
|
||||||
|
sb.Remove(openingIndex, closingIndex - openingIndex + 1);
|
||||||
|
}
|
||||||
|
} while(editSectionPhIdx >= 0);
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
// Just in case
|
||||||
|
sb.Replace(EditSectionPlaceHolder, "");
|
||||||
|
}
|
||||||
|
|
||||||
match = SignRegex.Match(sb.ToString());
|
match = SignRegex.Match(sb.ToString());
|
||||||
while(match.Success) {
|
while(match.Success) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue