helpcenter/helpcenter.r7-office.ru/Web/Controls/Help/Portals/method.ascx
2019-02-22 17:45:39 +03:00

144 lines
4.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ Control Language="C#" Inherits="BaseContentUserControls" %>
<script runat="server">
protected override void Init()
{
PageTitle = PageCaption = "";
MetaKeyWords = "";
MetaDescription = "";
}
</script>
<div class="MainHelpCenter PageGuides">
<% var section = Request["section"];
var type = Request["type"];
var url = Request["url"];
MsDocEntryPoint docsSection = null;
MsDocEntryPointMethod method = null;
if (!string.IsNullOrEmpty(section)
&& (docsSection = Documentation.GetDocs(section)) != null
&& !string.IsNullOrEmpty(type)
&& !string.IsNullOrEmpty(url))
{
method = docsSection.Methods.SingleOrDefault(x => x.Path.Equals(url, StringComparison.OrdinalIgnoreCase) && x.HttpMethod.Equals(type, StringComparison.OrdinalIgnoreCase));
}
if (method != null)
{ %>
<h1>
<a href="<%= VirtualPathUtility.ToAbsolute("~/api/portals/section.aspx?section=" + docsSection.Name + (string.IsNullOrEmpty(method.Category) ? null : ("&category=" + method.Category))) %>" class="up"></a>
<span class="hdr"><%= method.HttpMethod + " " + method.Path %></span>
<% if (method.Authentification)
{ %>
<span class="comment">Функция требует авторизации</span>
<% } %>
</h1>
<% if (!string.IsNullOrEmpty(method.Summary))
{ %>
<div class="header-gray">Описание</div>
<p class="dscr"><%= method.Summary %></p>
<% } %>
<div class="header-gray">Параметры</div>
<% if (method.Params.Any(x => x.Visible))
{ %>
<table class="table">
<colgroup>
<col style="width: 20%" />
<col />
<col style="width: 110px" />
<col style="width: 20%" />
</colgroup>
<thead>
<tr class="tablerow">
<td>Имя</td>
<td>Описание</td>
<td>Тип</td>
<td>Пример</td>
</tr>
</thead>
<tbody>
<% foreach (var param in method.Params.OrderByDescending(x => x.Method).Where(x => x.Visible))
{
var paramModel = ClassNamePluralizer.ToHumanName(param.Type); %>
<tr class="tablerow">
<td>
<%= param.Name %>
<div class="infotext">отправка в <%= param.Method %></div>
</td>
<td>
<%= param.Description %>
<% if (ClassNamePluralizer.IsOptional(param.Type) || param.IsOptional)
{ %>
<div class="infotext">необязательный</div>
<% } %>
</td>
<td>
<%= paramModel.Description %>
<% if (ClassNamePluralizer.IsCollection(param.Type) || paramModel.IsCollection)
{ %>
<div class="infotext">коллекция</div>
<% } %>
</td>
<td>
<% if (!string.IsNullOrEmpty(paramModel.Example))
{ %><%= paramModel.Example %><% } %>
<% if (!string.IsNullOrEmpty(paramModel.Note))
{ %>
<div class="infotext"><%= paramModel.Note %></div>
<% } %>
</td>
</tr>
<% } %>
</tbody>
</table>
<% }
else
{ %>
<p>У метода нет параметров</p>
<%} %>
<%if (!string.IsNullOrEmpty(method.Remarks))
{ %>
<div class="header-gray">Ремарка</div>
<p><%= method.Remarks %></p>
<% } %>
<%if (!string.IsNullOrEmpty(method.Notes))
{ %>
<div class="header-gray">Замечание</div>
<p><%= method.Notes %></p>
<% } %>
<%if (!string.IsNullOrEmpty(method.Example))
{ %>
<div class="header-gray">Пример</div>
<pre><%= method.Example%></pre>
<% } %>
<div class="header-gray">Возвращает</div>
<p><%= method.Returns %></p>
<% if (method.Response.Any())
{ %>
<div class="header-gray">Пример ответа</div>
<% foreach (var output in method.Response.First().Outputs)
{ %>
<p><%= HttpUtility.HtmlEncode(output.Key) %></p>
<pre><%= HttpUtility.HtmlEncode(output.Value) %></pre>
<% }
} %>
<% }
else
{ %>
<h2>Метод не найден</h2>
<p>Поиск в документации</p>
<% }
%>
</div>