This commit is contained in:
Zel
2025-02-23 18:47:21 +08:00
parent eaaffeeccb
commit e46a7ca31c
104 changed files with 2630 additions and 2516 deletions

View File

@@ -6,14 +6,14 @@ namespace ZelWiki.Library
public static class ConfirmActionHelper
{
/// <summary>
/// Generates a link that navigates via GET to a "confirm action" page where the yes link is RED, but the NO button is still GREEN.
/// 生成一个链接通过GET导航到“确认操作”页面其中“是”链接为红色但“否”按钮仍为绿色。
/// </summary>
/// <param name="message">The message to be displayed.</param>
/// <param name="linkLabel">the label for the link that will redirect to this confirm action page.</param>
/// <param name="controllerURL">The URL which will handle the click of the "yes" or "no" for the confirm action page.</param>
/// <param name="parameter">An optional parameter to pass to the page and controller function.</param>
/// <param name="yesOrDefaultRedirectURL">The URL to redirect to AFTER the controller has been called if the user selected YES (or NO, if the NO link is not specified.</param>
/// <param name="noRedirectURL">The URL to redirect to AFTER the controller has been called if the user selected NO, if not specified, the same link that is provided to yesOrDefaultRedirectURL is used.</param>
/// <param name="basePath"></param>
/// <param name="message"></param>
/// <param name="linkLabel"></param>
/// <param name="controllerURL"></param>
/// <param name="yesOrDefaultRedirectURL"></param>
/// <param name="noRedirectURL"></param>
/// <returns></returns>
public static string GenerateDangerLink(string basePath, string message, string linkLabel, string controllerURL,
string? yesOrDefaultRedirectURL, string? noRedirectURL = null)
@@ -30,18 +30,19 @@ namespace ZelWiki.Library
param.Append($"&Message={Uri.EscapeDataString(message)}");
param.Append($"&Style=Danger");
return $"<a class=\"btn btn-danger btn-thin\" href=\"{basePath}/Utility/ConfirmAction?{param}\">{linkLabel}</a>";
return
$"<a class=\"btn btn-danger btn-thin\" href=\"{basePath}/Utility/ConfirmAction?{param}\">{linkLabel}</a>";
}
/// <summary>
/// Generates a link that navigates via GET to a "confirm action" page where the yes link is GREEN.
/// 生成一个链接通过GET导航到“确认操作”页面其中“是”链接为绿色。
/// </summary>
/// <param name="message">The message to be displayed.</param>
/// <param name="linkLabel">the label for the link that will redirect to this confirm action page.</param>
/// <param name="controllerURL">The URL which will handle the click of the "yes" or "no" for the confirm action page.</param>
/// <param name="parameter">An optional parameter to pass to the page and controller function.</param>
/// <param name="yesOrDefaultRedirectURL">The URL to redirect to AFTER the controller has been called if the user selected YES (or NO, if the NO link is not specified.</param>
/// <param name="noRedirectURL">The URL to redirect to AFTER the controller has been called if the user selected NO, if not specified, the same link that is provided to yesOrDefaultRedirectURL is used.</param>
/// <param name="basePath"></param>
/// <param name="message"></param>
/// <param name="linkLabel"></param>
/// <param name="controllerURL"></param>
/// <param name="yesOrDefaultRedirectURL"></param>
/// <param name="noRedirectURL"></param>
/// <returns></returns>
public static string GenerateSafeLink(string basePath, string message, string linkLabel, string controllerURL,
string? yesOrDefaultRedirectURL, string? noRedirectURL = null)
@@ -58,18 +59,19 @@ namespace ZelWiki.Library
param.Append($"&Message={Uri.EscapeDataString(message)}");
param.Append($"&Style=Safe");
return $"<a class=\"btn btn-success btn-thin\" href=\"{basePath}/Utility/ConfirmAction?{param}\">{linkLabel}</a>";
return
$"<a class=\"btn btn-success btn-thin\" href=\"{basePath}/Utility/ConfirmAction?{param}\">{linkLabel}</a>";
}
/// <summary>
/// Generates a link that navigates via GET to a "confirm action" page where the yes link is YELLOW, but the NO button is still GREEN.
/// 生成一个链接通过GET导航到“确认操作”页面其中“是”链接为黄色但“否”按钮仍为绿色。
/// </summary>
/// <param name="message">The message to be displayed.</param>
/// <param name="linkLabel">the label for the link that will redirect to this confirm action page.</param>
/// <param name="controllerURL">The URL which will handle the click of the "yes" or "no" for the confirm action page.</param>
/// <param name="parameter">An optional parameter to pass to the page and controller function.</param>
/// <param name="yesOrDefaultRedirectURL">The URL to redirect to AFTER the controller has been called if the user selected YES (or NO, if the NO link is not specified.</param>
/// <param name="noRedirectURL">The URL to redirect to AFTER the controller has been called if the user selected NO, if not specified, the same link that is provided to yesOrDefaultRedirectURL is used.</param>
/// <param name="basePath"></param>
/// <param name="message"></param>
/// <param name="linkLabel"></param>
/// <param name="controllerURL"></param>
/// <param name="yesOrDefaultRedirectURL"></param>
/// <param name="noRedirectURL"></param>
/// <returns></returns>
public static string GenerateWarnLink(string basePath, string message, string linkLabel, string controllerURL,
string? yesOrDefaultRedirectURL, string? noRedirectURL = null)
@@ -86,19 +88,19 @@ namespace ZelWiki.Library
param.Append($"&Message={Uri.EscapeDataString(message)}");
param.Append($"&Style=Warn");
return $"<a class=\"btn btn-warning btn-thin\" href=\"{basePath}/Utility/ConfirmAction?{param}\">{linkLabel}</a>";
return
$"<a class=\"btn btn-warning btn-thin\" href=\"{basePath}/Utility/ConfirmAction?{param}\">{linkLabel}</a>";
}
/*
/// <summary>
/// Generates a link that navigates via POST to a "confirm action" page where the yes button is RED, but the NO button is still GREEN.
///
/// </summary>
/// <param name="message">The message to be displayed.</param>
/// <param name="buttonLabel">the label for the button that will redirect to this confirm action page.</param>
/// <param name="controllerURL">The URL which will handle the click of the "yes" or "no" for the confirm action page.</param>
/// <param name="parameter">An optional parameter to pass to the page and controller function.</param>
/// <param name="yesOrDefaultRedirectURL">The URL to redirect to AFTER the controller has been called if the user selected YES (or NO, if the NO link is not specified.</param>
/// <param name="noRedirectURL">The URL to redirect to AFTER the controller has been called if the user selected NO, if not specified, the same link that is provided to yesOrDefaultRedirectURL is used.</param>
/// <param name="message"></param>
/// <param name="buttonLabel"></param>
/// <param name="controllerURL"></param>
/// <param name="yesOrDefaultRedirectURL"></param>
/// <param name="noRedirectURL"></param>
/// <returns></returns>
public static string GenerateDangerButton(string message, string buttonLabel, string controllerURL,
string? yesOrDefaultRedirectURL, string? noRedirectURL = null)
@@ -115,21 +117,22 @@ namespace ZelWiki.Library
html.Append($"<input type='hidden' name='NoRedirectURL' value='{noRedirectURL}' />");
html.Append($"<input type='hidden' name='Message' value='{message}' />");
html.Append($"<input type='hidden' name='Style' value='Danger' />");
html.Append($"<button type='submit' class='btn btn-danger rounded-0' name='ActionToConfirm' value='PurgeDeletedPages'>{buttonLabel}</button>");
html.Append(
$"<button type='submit' class='btn btn-danger rounded-0' name='ActionToConfirm' value='PurgeDeletedPages'>{buttonLabel}</button>");
html.Append("</form>");
return html.ToString();
}
/// <summary>
/// Generates a link that navigates via POST to a "confirm action" page where the yes and no buttons are GREEN.
///
/// </summary>
/// <param name="message">The message to be displayed.</param>
/// <param name="buttonLabel">the label for the button that will redirect to this confirm action page.</param>
/// <param name="controllerURL">The URL which will handle the click of the "yes" or "no" for the confirm action page.</param>
/// <param name="parameter">An optional parameter to pass to the page and controller function.</param>
/// <param name="yesOrDefaultRedirectURL">The URL to redirect to AFTER the controller has been called if the user selected YES (or NO, if the NO link is not specified.</param>
/// <param name="noRedirectURL">The URL to redirect to AFTER the controller has been called if the user selected NO, if not specified, the same link that is provided to yesOrDefaultRedirectURL is used.</param>
/// <param name="message"></param>
/// <param name="buttonLabel"></param>
/// <param name="controllerURL"></param>
/// <param name="yesOrDefaultRedirectURL"></param>
/// <param name="noRedirectURL"></param>
/// <returns></returns>
public static string GenerateSafeButton(string message, string buttonLabel, string controllerURL,
string? yesOrDefaultRedirectURL, string? noRedirectURL = null)
{
@@ -146,21 +149,22 @@ namespace ZelWiki.Library
html.Append($"<input type='hidden' name='NoRedirectURL' value='{noRedirectURL}' />");
html.Append($"<input type='hidden' name='Message' value='{message}' />");
html.Append($"<input type='hidden' name='Style' value='Safe' />");
html.Append($"<button type='submit' class='btn btn-success rounded-0' name='ActionToConfirm' value='PurgeDeletedPages'>{buttonLabel}</button>");
html.Append(
$"<button type='submit' class='btn btn-success rounded-0' name='ActionToConfirm' value='PurgeDeletedPages'>{buttonLabel}</button>");
html.Append("</form>");
return html.ToString();
}
/// <summary>
/// Generates a link that navigates via POST to a "confirm action" page where the yes button is YELLOW, but the NO button is still GREEN.
///
/// </summary>
/// <param name="message">The message to be displayed.</param>
/// <param name="buttonLabel">the label for the button that will redirect to this confirm action page.</param>
/// <param name="controllerURL">The URL which will handle the click of the "yes" or "no" for the confirm action page.</param>
/// <param name="parameter">An optional parameter to pass to the page and controller function.</param>
/// <param name="yesOrDefaultRedirectURL">The URL to redirect to AFTER the controller has been called if the user selected YES (or NO, if the NO link is not specified.</param>
/// <param name="noRedirectURL">The URL to redirect to AFTER the controller has been called if the user selected NO, if not specified, the same link that is provided to yesOrDefaultRedirectURL is used.</param>
/// <param name="message"></param>
/// <param name="buttonLabel"></param>
/// <param name="controllerURL"></param>
/// <param name="yesOrDefaultRedirectURL"></param>
/// <param name="noRedirectURL"></param>
/// <returns></returns>
public static string GenerateWarnButton(string message, string buttonLabel, string controllerURL,
string? yesOrDefaultRedirectURL, string? noRedirectURL = null)
{
@@ -177,11 +181,11 @@ namespace ZelWiki.Library
html.Append($"<input type='hidden' name='NoRedirectURL' value='{noRedirectURL}' />");
html.Append($"<input type='hidden' name='Message' value='{message}' />");
html.Append($"<input type='hidden' name='Style' value='Warn' />");
html.Append($"<button type='submit' class='btn btn-warning rounded-0' name='ActionToConfirm' value='PurgeDeletedPages'>{buttonLabel}</button>");
html.Append(
$"<button type='submit' class='btn btn-warning rounded-0' name='ActionToConfirm' value='PurgeDeletedPages'>{buttonLabel}</button>");
html.Append("</form>");
return html.ToString();
}
*/
}
}
}