helpcenter/Web/Controls/Help/Server/Community/CommunityServerCustomModules/CommunityServerCustomModules.ascx

106 lines
7.4 KiB
Plaintext

<%@ Control Language="C#" Inherits="BaseContentUserControls"%>
<%@ Register Namespace="TeamLab.Controls" Assembly="__Code" TagPrefix="cc" %>
<script runat="server">
protected override void Init()
{
PageTitle = PageCaption = "Adding custom modules to ONLYOFFICE Groups";
MetaKeyWords = "";
MetaDescription = "Find out how to add your own modules to ONLYOFFICE Groups.";
}
</script>
<div class="main_buscall_container dataBackup">
<div class="MainHelpCenter">
<h1 class="subHeaderFeaturesCaption TipsCaption">Adding custom modules to ONLYOFFICE Groups</h1>
<cc:LocalizeContent runat="Server" ControlName="~/Controls/Help/VariousControls/Versions/CommunityServer/CommunityServer_Current.ascx" />
<div class="keyword_block">
<ul>
<li><cc:LocalizeContent runat="Server" ControlName="~/Controls/Help/Tags/server-version/server-version.ascx" /></li>
<li><cc:LocalizeContent runat="Server" ControlName="~/Controls/Help/Tags/community-server/community-server.ascx" /></li>
</ul>
</div>
<h2 id="introduction">Introduction</h2>
<div class="block_of_step">
<div class="screen_text">
<p>If you want to create your own modules for ONLYOFFICE and add them to <b>ONLYOFFICE Groups</b>, now you can easily do that. Sample project is available here: <a target="_blank" href="https://github.com/ONLYOFFICE/CommunityServer/tree/master/web/studio/ASC.Web.Studio/Products/Sample">https://github.com/ONLYOFFICE/CommunityServer/tree/master/web/studio/ASC.Web.Studio/Products/Sample</a></p>
<p>You can modify this sample or create a new custom module on its base. Make sure that all necessary components are available in the specified folders and certain code lines are added to the specified files as it is described below.</p>
</div>
</div>
<h2 id="Howitworks">How it works</h2>
<div class="block_of_step">
<div class="screen_text">
<ol>
<li>Get <b>ONLYOFFICE Community Server</b> from <a target="_blank" href="https://github.com/ONLYOFFICE/CommunityServer">https://github.com/ONLYOFFICE/CommunityServer</a></li>
<li>The <code>Sample</code> project is available in the <code>Products</code> folder here:
<p><a target="_blank" href="https://github.com/ONLYOFFICE/CommunityServer/tree/master/web/studio/ASC.Web.Studio/Products">https://github.com/ONLYOFFICE/CommunityServer/tree/master/web/studio/ASC.Web.Studio/Products</a></p>
</li>
<li>The <code>ASC.Api.Sample</code> is available in the <code>ASC.Api</code> folder here:
<p><a target="_blank" href="https://github.com/ONLYOFFICE/CommunityServer/tree/master/module/ASC.Api">https://github.com/ONLYOFFICE/CommunityServer/tree/master/module/ASC.Api</a></p>
</li>
<li>The following code lines are added to the <a target="_blank" href="https://github.com/ONLYOFFICE/CommunityServer/blob/master/build/msbuild/build.proj">https://github.com/ONLYOFFICE/CommunityServer/blob/master/build/msbuild/build.proj</a> file:
<pre><code>&lt;!-- Sample --&gt;
&lt;ProjectToBuild Include="$(ASCDir)web\studio\ASC.Web.Studio\Products\Sample\ASC.Web.Sample.csproj"/&gt;
</code></pre>
<p>and</p>
<pre><code>&lt;ProjectToBuild Include="$(ASCDir)module\ASC.Api\ASC.Api.Sample\ASC.Api.Sample.csproj"/&gt;
</code></pre>
<p>You can also see other existing projects to find out where these lines should be added.</p>
<div class="notehelp nh_important"><span class="important_notice_label">Please note!</span> The order you type in the lines is very important.</div>
</li>
<li>The <code>ASC.Api.Sample.SampleApi</code> is added to the <code>web\studio\ASC.Web.Studio\web.autofac.config</code> file like this:
<pre><code>&lt;component
type="ASC.Api.Sample.SampleApi, ASC.Api.Sample"
service="ASC.Api.Interfaces.IApiEntryPoint, ASC.Api"
name="sample"/&gt;
</code></pre>
</li>
<li>The <code>Build.bat</code> file can be run here:
<p><a target="_blank" href="https://github.com/ONLYOFFICE/CommunityServer/blob/master/build/Build.bat">https://github.com/ONLYOFFICE/CommunityServer/blob/master/build/Build.bat</a></p>
</li>
</ol>
</div>
</div>
<h2 id="Ownmodules">How to create your own module for ONLYOFFICE</h2>
<div class="block_of_step">
<div class="screen_text">
<ol>
<li>Create an ASP.NET Web Application (ASC.Web.Sample) project and put it to the <code>...web\studio\ASC.Web.Studio\Products\Sample</code> folder.
<div class="notehelp nh_important"><span class="important_notice_label">IMPORTANT!!!</span> The output dll file name must be "ASC.Web.*.dll".</div>
</li>
<li>Connect the required references from <code>...\web\studio\ASC.Web.Studio\bin\</code>:
<pre><code>ASC.Common.dll
ASC.Core.Common.dll
ASC.Data.Storage.dll
ASC.Web.Core.dll
ASC.Web.Studio.dll
</code></pre>
</li>
<li>Implement the <code>IProduct</code> interface in the <code>ProductEntryPoint.cs</code> file.
<div class="notehelp nh_important"><span class="important_notice_label">IMPORTANT!!!</span> The ProductID must be unique Guid (in VS2012 it is generated as <code>TOOLS</code> -> <code>GUID</code> -> <code>New GUID</code>)</div>
</li>
<li><div class="notehelp nh_notice">Add the following lines to the <code>AssemblyInfo.cs</code> file:</div>
<pre><code>[assembly: Product(typeof(ASC.Web.Sample.Configuration.ProductEntryPoint))]
</code></pre>
</li>
<li>Inherit the Master from <code>web\studio\ASC.Web.Studio\Masters\BaseTemplate.master</code></li>
<li>Set the output path in the project properties like this:
<pre><code>&lt;OutputPath&gt;..\..\bin\&lt;/OutputPath&gt;
</code></pre>
<p>so that the builds were created at the <code>web\studio\ASC.Web.Studio\bin</code> folder.</p>
</li>
<li>The project can be built manually or using the builder. For the latter add the following lines to the <code>build\msbuild\build.proj</code> file:
<pre><code>&lt;ProjectToBuild Include="$(ASCDir)web\studio\ASC.Web.Studio\Products\Sample\ASC.Web.Sample.csproj"/&gt;
</code></pre>
<p>and run the <code>build\Build.bat</code> file.</p>
</li>
<li>After the build, run the website at the <code>localhost:port</code> address, go to the "Modules & Tools" <b>Settings</b> page (<a target="_blank" href="http://localhost:port/management.aspx?type=2">http://localhost:port/management.aspx?type=2</a>) and enable the new <b>Sample</b> module. It will be available in the portal header drop-down menu afterwards or using the direct link: <a target="_blank" href="http://localhost:port/products/sample/default.aspx">http://localhost:port/products/sample/default.aspx</a></li>
</ol>
<p>Now you can create API for your own module following <a target="_blank" href="<%=VirtualPathUtility.ToAbsolute("~/server/community/community-server-create-api.aspx")%>">these instructions</a>.</p>
</div>
</div>
</div>
</div>