diff --git a/common/ASC.Api.Core/ASC.Api.Core.csproj b/common/ASC.Api.Core/ASC.Api.Core.csproj
index 70bbadfa74..9505d7d0c3 100644
--- a/common/ASC.Api.Core/ASC.Api.Core.csproj
+++ b/common/ASC.Api.Core/ASC.Api.Core.csproj
@@ -8,8 +8,13 @@
+
+
+
+
+
diff --git a/common/ASC.Api.Core/Core/CustomApiAttribute.cs b/common/ASC.Api.Core/Core/CustomApiAttribute.cs
deleted file mode 100644
index 1e1b92ac4f..0000000000
--- a/common/ASC.Api.Core/Core/CustomApiAttribute.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System;
-
-namespace ASC.Api.Core
-{
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- public class CustomApiAttribute : Attribute
- {
- }
-}
diff --git a/common/ASC.Common/DependencyInjection/AutofacExtension.cs b/common/ASC.Common/DependencyInjection/AutofacExtension.cs
new file mode 100644
index 0000000000..ed18b1c17f
--- /dev/null
+++ b/common/ASC.Common/DependencyInjection/AutofacExtension.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using Autofac;
+using Autofac.Configuration;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace ASC.Common.DependencyInjection
+{
+ internal class AutofacComponent
+ {
+ public string Type { get; set; }
+ public IEnumerable Services { get; set; }
+ }
+ internal class AutofacService
+ {
+ public string Type { get; set; }
+ }
+
+ public static class AutofacExtension
+ {
+ public static IContainer AddAutofac(this IServiceCollection services, IConfiguration configuration)
+ {
+ var sectionSettings = configuration.GetSection("components");
+
+ var cs = new List();
+ sectionSettings.Bind(cs);
+
+ var currentDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+
+ foreach (var component in cs)
+ {
+ try
+ {
+ LoadAssembly(component.Type);
+
+ foreach (var s in component.Services)
+ {
+ LoadAssembly(s.Type);
+ }
+ }
+ catch (System.Exception)
+ {
+ //TODO
+ }
+ }
+
+
+ var module = new ConfigurationModule(configuration);
+ var builder = new ContainerBuilder();
+ builder.RegisterModule(module);
+
+ var container = builder.Build();
+
+ services.AddSingleton(container);
+
+ return container;
+
+ void LoadAssembly(string type)
+ {
+ var path = Path.Combine(currentDir, type.Substring(type.IndexOf(",") + 1).Trim());
+ Assembly.LoadFrom($"{path}.dll");
+ }
+ }
+ }
+}
diff --git a/common/ASC.Common/Logging/Log.cs b/common/ASC.Common/Logging/Log.cs
index 18e397093c..fbdadd71d2 100644
--- a/common/ASC.Common/Logging/Log.cs
+++ b/common/ASC.Common/Logging/Log.cs
@@ -785,18 +785,9 @@ namespace ASC.Common.Logging
public static class LogExtension
{
- public static IServiceCollection AddLogManager(this IServiceCollection services, IConfiguration configuration)
+ public static IServiceCollection AddLogManager(this IServiceCollection services)
{
- var module = new ConfigurationModule(configuration);
- var builder = new ContainerBuilder();
- builder.RegisterModule(module);
-
- var container = builder.Build();
-
- services.AddSingleton(container)
- .AddSingleton();
-
- return services;
+ return services.AddSingleton();
}
}
}
diff --git a/common/ASC.Data.Storage/Configuration/Appender.cs b/common/ASC.Data.Storage/Configuration/Appender.cs
index b30a9ca57a..cc6bd85536 100644
--- a/common/ASC.Data.Storage/Configuration/Appender.cs
+++ b/common/ASC.Data.Storage/Configuration/Appender.cs
@@ -2,17 +2,15 @@
using System.Collections.Generic;
using System.Linq;
using ASC.Common.Utils;
+using Microsoft.Extensions.DependencyInjection;
namespace ASC.Data.Storage.Configuration
{
public static class StorageConfigFactory
{
- public static Storage Instance
+ public static IServiceCollection AddStorage(this IServiceCollection services)
{
- get
- {
- return ConfigurationManager.GetSetting("Storage");
- }
+ return services.AddSingleton(r => ConfigurationManager.GetSetting("Storage"));
}
}
diff --git a/common/ASC.Data.Storage/S3/S3UploadGuard.cs b/common/ASC.Data.Storage/S3/S3UploadGuard.cs
index 46d7ce66fe..9c31b20efa 100644
--- a/common/ASC.Data.Storage/S3/S3UploadGuard.cs
+++ b/common/ASC.Data.Storage/S3/S3UploadGuard.cs
@@ -30,8 +30,8 @@ using System.Threading.Tasks;
using Amazon;
using Amazon.S3;
using Amazon.S3.Model;
+using ASC.Common.DependencyInjection;
using ASC.Core;
-using ASC.Data.Storage.Configuration;
namespace ASC.Data.Storage.S3
{
@@ -121,7 +121,7 @@ namespace ASC.Data.Storage.S3
{
if (!configured)
{
- var config = StorageConfigFactory.Instance;
+ var config = CommonServiceProvider.GetService();
var handler = config.GetHandler("s3");
if (handler != null)
{
diff --git a/common/ASC.Data.Storage/StorageFactory.cs b/common/ASC.Data.Storage/StorageFactory.cs
index cf10bbf2dc..8f020df90f 100644
--- a/common/ASC.Data.Storage/StorageFactory.cs
+++ b/common/ASC.Data.Storage/StorageFactory.cs
@@ -26,8 +26,6 @@
using System;
using System.Collections.Generic;
-using System.Configuration;
-using System.IO;
using System.Linq;
using ASC.Common.Caching;
@@ -35,8 +33,6 @@ using ASC.Core;
using ASC.Data.Storage.Configuration;
using ASC.Core.Common.Configuration;
using ASC.Data.Storage.DiscStorage;
-
-using Microsoft.AspNetCore.Builder;
using ASC.Common.DependencyInjection;
using Microsoft.AspNetCore.Routing;
@@ -83,7 +79,7 @@ namespace ASC.Data.Storage
var store = DataStoreCache.Get(tenant, module);
if (store == null)
{
- var section = StorageConfigFactory.Instance;
+ var section = CommonServiceProvider.GetService();
if (section == null)
{
throw new InvalidOperationException("config section not found");
@@ -103,7 +99,7 @@ namespace ASC.Data.Storage
//Make tennant path
tenant = TennantPath.CreatePath(tenant);
- var section = StorageConfigFactory.Instance;
+ var section = CommonServiceProvider.GetService();
if (section == null)
{
throw new InvalidOperationException("config section not found");
@@ -116,7 +112,7 @@ namespace ASC.Data.Storage
public static IEnumerable GetModuleList(string configpath, bool exceptDisabledMigration = false)
{
- var section = StorageConfigFactory.Instance;
+ var section = CommonServiceProvider.GetService();
return section.Module
.Where(x => x.Visible)
.Where(x=> !exceptDisabledMigration || !x.DisableMigrate)
@@ -125,7 +121,7 @@ namespace ASC.Data.Storage
public static IEnumerable GetDomainList(string configpath, string modulename)
{
- var section = StorageConfigFactory.Instance;
+ var section = CommonServiceProvider.GetService();
if (section == null)
{
throw new ArgumentException("config section not found");
@@ -146,7 +142,7 @@ namespace ASC.Data.Storage
// throw new InvalidOperationException("Application not hosted.");
//}
- var section = StorageConfigFactory.Instance;
+ var section = CommonServiceProvider.GetService();
if (section != null)
{
//old scheme
@@ -224,7 +220,7 @@ namespace ASC.Data.Storage
private static IDataStore GetDataStore(string tenant, string module, DataStoreConsumer consumer, IQuotaController controller)
{
- var storage = StorageConfigFactory.Instance;
+ var storage = CommonServiceProvider.GetService();
var moduleElement = storage.GetModuleElement(module);
if (moduleElement == null)
{
diff --git a/common/ASC.Data.Storage/WebPath.cs b/common/ASC.Data.Storage/WebPath.cs
index 8fb0ae88bb..8a5bcfb134 100644
--- a/common/ASC.Data.Storage/WebPath.cs
+++ b/common/ASC.Data.Storage/WebPath.cs
@@ -46,7 +46,7 @@ namespace ASC.Data.Storage
static WebPath()
{
- var section = StorageConfigFactory.Instance;
+ var section = CommonServiceProvider.GetService();
if (section != null)
{
Appenders = section.Appender;
diff --git a/products/ASC.People/ASC.People.csproj b/products/ASC.People/ASC.People.csproj
index bf5124462d..af8bac2127 100644
--- a/products/ASC.People/ASC.People.csproj
+++ b/products/ASC.People/ASC.People.csproj
@@ -8,6 +8,10 @@
ClientApp\
$(DefaultItemExcludes);$(SpaRoot)node_modules\**
true
+ ASC.People
+ Ascensio System SIA
+ ASC.People
+ (c) Ascensio System SIA. All rights reserved
@@ -25,8 +29,7 @@
-
-
+
diff --git a/products/ASC.People/AssemblyInfo.cs b/products/ASC.People/AssemblyInfo.cs
deleted file mode 100644
index 235582bfd6..0000000000
--- a/products/ASC.People/AssemblyInfo.cs
+++ /dev/null
@@ -1,4 +0,0 @@
-
-using ASC.Api.Core;
-
-[assembly: CustomApi]
diff --git a/products/ASC.People/PeopleProduct.cs b/products/ASC.People/PeopleProduct.cs
new file mode 100644
index 0000000000..a2a379aedd
--- /dev/null
+++ b/products/ASC.People/PeopleProduct.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using ASC.Web.Core;
+
+namespace ASC.People
+{
+ public class PeopleProduct : Product
+ {
+ internal const string ProductPath = "/products/people/";
+
+ private ProductContext _context;
+
+ public static Guid ID
+ {
+ get { return new Guid("{F4D98AFD-D336-4332-8778-3C6945C81EA0}"); }
+ }
+
+ public override bool Visible { get { return true; } }
+
+ public override ProductContext Context
+ {
+ get { return _context; }
+ }
+
+ public override string Name
+ {
+ get { return "People"; }//PeopleResource.ProductName; }
+ }
+
+ public override string Description
+ {
+ get { return "People Description"; }//PeopleResource.ProductDescription; }
+ }
+
+ public override string ExtendedDescription
+ {
+ get { return "People ExtendedDescription"; }//PeopleResource.ProductDescription; }
+ }
+
+ public override Guid ProductID
+ {
+ get { return ID; }
+ }
+
+ public override string StartURL
+ {
+ get { return ProductPath; }
+ }
+
+ public override string HelpURL
+ {
+ get { return string.Concat(ProductPath, "help.aspx"); }
+ }
+
+ public override string ProductClassName
+ {
+ get { return "people"; }
+ }
+
+ public override void Init()
+ {
+ _context = new ProductContext
+ {
+ DisabledIconFileName = "product_disabled_logo.png",
+ IconFileName = "product_logo.png",
+ LargeIconFileName = "images/people_logolarge.png",
+ DefaultSortOrder = 50,
+ AdminOpportunities = () => new List(),//PeopleResource.ProductAdminOpportunities.Split('|').ToList(),
+ UserOpportunities = () => new List() //PeopleResource.ProductUserOpportunities.Split('|').ToList()
+ };
+
+ //SearchHandlerManager.Registry(new SearchHandler());
+ }
+ }
+}
diff --git a/web/ASC.Web.Api/ASC.Web.Api.csproj b/web/ASC.Web.Api/ASC.Web.Api.csproj
index 0aadaaf538..b0f21be3c0 100644
--- a/web/ASC.Web.Api/ASC.Web.Api.csproj
+++ b/web/ASC.Web.Api/ASC.Web.Api.csproj
@@ -14,6 +14,7 @@
+
diff --git a/web/ASC.Web.Api/Controllers/ModulesController.cs b/web/ASC.Web.Api/Controllers/ModulesController.cs
index 87764d9602..73c2bcb286 100644
--- a/web/ASC.Web.Api/Controllers/ModulesController.cs
+++ b/web/ASC.Web.Api/Controllers/ModulesController.cs
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using ASC.Web.Api.Models;
using ASC.Web.Api.Routing;
+using ASC.Web.Core;
+using ASC.Web.Core.WebZones;
using Microsoft.AspNetCore.Mvc;
-
+
namespace ASC.Web.Api.Controllers
{
[DefaultRoute]
@@ -13,8 +15,8 @@ namespace ASC.Web.Api.Controllers
[FormatIndexRoute()]
[FormatIndexRoute(false)]
public IEnumerable GetAll()
- {
- return new List {
+ {
+ var result = new List(){
new Module {
Title = "Documents",
Link = "/products/files/",
@@ -37,17 +39,25 @@ namespace ASC.Web.Api.Controllers
Link = "/products/mail/",
ImageUrl = "images/mail_logolarge.png"
},
- new Module {
- Title = "People",
- Link = "/products/people/",
- ImageUrl = "images/people_logolarge.png"
- },
new Module {
Title = "Community",
Link = "products/community/",
ImageUrl = "images/community_logolarge.png"
}
- };
+ };
+
+ foreach (var a in WebItemManager.Instance.GetItems(WebZoneType.StartProductList))
+ {
+ result.Add(new Module() {
+ Title = a.Name,
+ Description = a.Description,
+ ImageUrl = a.Context.LargeIconFileName,
+ Link = a.StartURL
+ });
+ }
+
+
+ return result;
}
}
}
diff --git a/web/ASC.Web.Api/Startup.cs b/web/ASC.Web.Api/Startup.cs
index 30a0613bab..310d5d86f9 100644
--- a/web/ASC.Web.Api/Startup.cs
+++ b/web/ASC.Web.Api/Startup.cs
@@ -1,6 +1,5 @@
using System.Linq;
-using System.Reflection;
-using System.IO;
+using System.Collections.Generic;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
@@ -12,15 +11,16 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-using ASC.Api.Core;
using ASC.Common.Logging;
using ASC.Web.Api.Handlers;
using ASC.Api.Core.Middleware;
using ASC.Common.Utils;
-using ASC.Core;
-using ASC.Core.Common;
-using ASC.Common;
using ASC.Common.DependencyInjection;
+using ASC.Web.Core;
+using ASC.Data.Storage.Configuration;
+
+using Autofac;
+
namespace ASC.Web.Api
{
@@ -55,16 +55,18 @@ namespace ASC.Web.Api
config.Filters.Add(new AuthorizeFilter(policy));
});
- var assemblies = Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ASC*.dll")
- .Select(Assembly.LoadFrom)
- .Where(r => r.GetCustomAttribute() != null);
+ var container = services.AddAutofac(Configuration);
+
+ var assemblies = container.Resolve>().Select(r=> r.GetType().Assembly).Distinct();
foreach (var a in assemblies)
{
builder.AddApplicationPart(a);
}
- services.AddLogManager(Configuration);
+ services.AddLogManager()
+ .AddStorage()
+ .AddWebItemManager();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
@@ -95,7 +97,8 @@ namespace ASC.Web.Api
app.InitCommonServiceProvider()
- .InitConfigurationManager();
+ .InitConfigurationManager()
+ .UseWebItemManager();
}
}
}
diff --git a/web/ASC.Web.Api/autofac.json b/web/ASC.Web.Api/autofac.json
index ccfe87ecaa..aa23907069 100644
--- a/web/ASC.Web.Api/autofac.json
+++ b/web/ASC.Web.Api/autofac.json
@@ -7,6 +7,14 @@
"type": "ASC.Common.Logging.ILog, ASC.Common"
}
]
+ },
+ {
+ "type": "ASC.People.PeopleProduct, ASC.People",
+ "services": [
+ {
+ "type": "ASC.Web.Core.IWebItem, ASC.Web.Core"
+ }
+ ]
}
]
}
diff --git a/web/ASC.Web.Components/example/stories/drop-down/base/README.md b/web/ASC.Web.Components/example/stories/drop-down/base/README.md
new file mode 100644
index 0000000000..6f9f289724
--- /dev/null
+++ b/web/ASC.Web.Components/example/stories/drop-down/base/README.md
@@ -0,0 +1,23 @@
+# DropDown
+
+## Usage
+
+```js
+import { DropDown } from 'asc-web-components';
+```
+
+#### Description
+
+Is a dropdown with any number of action
+
+#### Usage
+
+```js
+
+```
+
+#### Properties
+
+| Props | Type | Required | Values | Default | Description |
+| ------------------ | -------- | :------: | --------------------------- | -------------- | ----------------------------------------------------------------- |
+| `opened` | `bool` | - | - | `false` | Tells when the dropdown should be opened |
\ No newline at end of file
diff --git a/web/ASC.Web.Components/example/stories/drop-down/base/index.stories.js b/web/ASC.Web.Components/example/stories/drop-down/base/index.stories.js
new file mode 100644
index 0000000000..4a1259d295
--- /dev/null
+++ b/web/ASC.Web.Components/example/stories/drop-down/base/index.stories.js
@@ -0,0 +1,49 @@
+import React from 'react'
+import { action } from '@storybook/addon-actions';
+import { storiesOf } from '@storybook/react'
+import withReadme from 'storybook-readme/with-readme'
+import Readme from './README.md'
+import { Container, Row, Col } from 'reactstrap';
+import { GroupButton, Button, DropDown } from 'asc-web-components'
+
+const rowStyle = { marginTop: 8 };
+
+storiesOf('Components| DropDown', module)
+ .addDecorator(withReadme(Readme))
+ .add('base', () => (
+
+
+ Only dropdown
+ With Button
+
+
+
+ Used for demonstration without active button
+
+
+
+
+
+
+
+
+
+
+
+
+
+ console.log('Group button clicked')}
+ />
+
+
+
+
+
+ )
+);
\ No newline at end of file
diff --git a/web/ASC.Web.Components/example/stories/group-button/base/README.md b/web/ASC.Web.Components/example/stories/group-button/base/README.md
index ef46cb4019..fd39dde652 100644
--- a/web/ASC.Web.Components/example/stories/group-button/base/README.md
+++ b/web/ASC.Web.Components/example/stories/group-button/base/README.md
@@ -26,4 +26,5 @@ Base Button is used for a group action on a page.
| `isCheckbox` | `bool` | - | - | `false` | Tells when the button should present a checkbox state |
| `isDropdown` | `bool` | - | - | `false` | Tells when the button should present a dropdown state |
| `splitted` | `bool` | - | - | `false` | Tells when the button should present a dropdown state with button |
-| `opened` | `bool` | - | - | `false` | Tells when the button should be opened by default |
\ No newline at end of file
+| `opened` | `bool` | - | - | `false` | Tells when the button should be opened by default |
+| `clickAction` | `func` | - | - | - | What the button will trigger when clicked |
\ No newline at end of file
diff --git a/web/ASC.Web.Components/src/components/drop-down/index.js b/web/ASC.Web.Components/src/components/drop-down/index.js
new file mode 100644
index 0000000000..c03cb12dc6
--- /dev/null
+++ b/web/ASC.Web.Components/src/components/drop-down/index.js
@@ -0,0 +1,67 @@
+import React from 'react'
+import styled, { css } from 'styled-components'
+import PropTypes from 'prop-types'
+
+const StyledDropdown = styled.div`
+ position: absolute;
+ top: 100%;
+ left: 0;
+ z-index: 1000;
+ margin-top: 4px;
+ display: ${props => (props.isOpen || props.opened ? 'block' : 'none')};
+ padding: 4px;
+ border-radius: 4px;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ background: white;
+ border: 1px solid #d1d1d1;
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
+ -moz-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
+ -webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
+`;
+
+const StyledDropdownItem = styled.button`
+ background: none;
+ border: 0;
+ color: #333333;
+ cursor: pointer;
+ display: block;
+ font-size: 12px;
+ line-height: 24px;
+ margin: 0;
+ padding: 0 12px;
+ text-decoration: none;
+ user-select: none;
+ -o-user-select: none;
+ -moz-user-select: none;
+ -webkit-user-select: none;
+ white-space: nowrap;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ -o-user-select: none;
+ -webkit-user-select: none;
+ stroke: none;
+
+ &:hover{
+ background-color: #e9e9e9;
+ border-radius: 2px;
+ -moz-border-radius: 2px;
+ -webkit-border-radius: 2px;
+ }
+`;
+
+const DropDown = props => {
+ return (
+
+ {React.Children.map(props.children, (child) =>
+
+ {child.props.text || child.props.label}
+ )}
+
+ );
+}
+
+export default DropDown
\ No newline at end of file
diff --git a/web/ASC.Web.Components/src/components/group-button/index.js b/web/ASC.Web.Components/src/components/group-button/index.js
index d4e924df6a..d8221b2638 100644
--- a/web/ASC.Web.Components/src/components/group-button/index.js
+++ b/web/ASC.Web.Components/src/components/group-button/index.js
@@ -2,6 +2,7 @@ import React, { useState, useEffect, useRef } from 'react'
import styled, { css } from 'styled-components'
import PropTypes from 'prop-types'
import { Icons } from '../icons'
+import DropDown from '../drop-down'
const backgroundColor = '#ebebeb',
disabledBackgroundColor = '#f7f7f7',
@@ -101,54 +102,6 @@ const StyledButton = styled(StyledDropdownToggle)`
`}
`;
-const StyledDropdownMenu = styled.div`
- position: absolute;
- top: 100%;
- left: 0;
- z-index: 1000;
- margin-top: 4px;
- display: ${props => (props.isOpen || props.opened ? 'block' : 'none')};
- padding: 4px;
- border-radius: 4px;
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- background: white;
- border: 1px solid #d1d1d1;
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
- -moz-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
- -webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
-`;
-
-const StyledDropdownItem = styled.button`
- background: none;
- border: 0;
- color: #333333;
- cursor: pointer;
- display: block;
- font-size: 12px;
- line-height: 24px;
- margin: 0;
- padding: 0 12px;
- text-decoration: none;
- user-select: none;
- -o-user-select: none;
- -moz-user-select: none;
- -webkit-user-select: none;
- white-space: nowrap;
- -moz-user-select: none;
- -ms-user-select: none;
- -o-user-select: none;
- -webkit-user-select: none;
- stroke: none;
-
- &:hover{
- background-color: #e9e9e9;
- border-radius: 2px;
- -moz-border-radius: 2px;
- -webkit-border-radius: 2px;
- }
-`;
-
const Caret = styled(Icons.ExpanderDownIcon)`
width: 10px;
margin-left: 4px;
@@ -174,10 +127,6 @@ const Caret = styled(Icons.ExpanderDownIcon)`
}
`;
-const clickAction = (e) => {
- console.log('Button "' + e.target.innerText + '" clicked!');
-}
-
const useOuterClickNotifier = (onOuterClick, ref) => {
useEffect(() => {
const handleClick = (e) => !ref.current.contains(e.target) && onOuterClick(e);
@@ -193,19 +142,13 @@ const useOuterClickNotifier = (onOuterClick, ref) => {
}
const GroupButton = (props) => {
- const { text, children, splitted, isDropdown, isCheckbox, opened, disabled, primary } = props;
+ const { text, splitted, isDropdown, isCheckbox, opened, disabled, primary, clickAction } = props;
const [isOpen, toggle] = useState(opened);
const ref = useRef(null);
useOuterClickNotifier((e) => toggle(false), ref);
- const dropMenu =
-
- {React.Children.map(children, (child) =>
-
- {child.props.text}
- )}
- ;
+ const dropMenu = ;
const splittedDropButton =
<>
@@ -261,7 +204,8 @@ GroupButton.propTypes = {
splitted: PropTypes.bool,
isCheckbox: PropTypes.bool,
isDropdown: PropTypes.bool,
- tabIndex: PropTypes.number
+ tabIndex: PropTypes.number,
+ clickAction: PropTypes.func
};
GroupButton.defaultProps = {
@@ -274,7 +218,8 @@ GroupButton.defaultProps = {
splitted: false,
isCheckbox: false,
isDropdown: false,
- tabIndex: -1
+ tabIndex: -1,
+ clickAction: (e) => console.log('Button "' + e.target.innerText + '" clicked!')
};
export default GroupButton
\ No newline at end of file
diff --git a/web/ASC.Web.Components/src/index.js b/web/ASC.Web.Components/src/index.js
index bd35c672ad..adee33997b 100644
--- a/web/ASC.Web.Components/src/index.js
+++ b/web/ASC.Web.Components/src/index.js
@@ -7,6 +7,7 @@ export { default as ModuleTile } from './components/module-tile'
export { default as Loader } from './components/loader'
export { Icons } from './components/icons'
export { default as GroupButton } from './components/group-button'
+export { default as DropDown } from './components/drop-down'
export { default as TreeMenu } from './components/tree-menu'
export { default as TreeNode } from './components/tree-menu-node'
diff --git a/web/ASC.Web.Core/ASC.Web.Core.csproj b/web/ASC.Web.Core/ASC.Web.Core.csproj
index ab7a856e9b..31238f5ee5 100644
--- a/web/ASC.Web.Core/ASC.Web.Core.csproj
+++ b/web/ASC.Web.Core/ASC.Web.Core.csproj
@@ -10,7 +10,6 @@
-
diff --git a/web/ASC.Web.Core/IProduct.cs b/web/ASC.Web.Core/IProduct.cs
index 37493e81c0..f43ec2b54a 100644
--- a/web/ASC.Web.Core/IProduct.cs
+++ b/web/ASC.Web.Core/IProduct.cs
@@ -29,7 +29,7 @@ using ASC.Web.Core.WebZones;
namespace ASC.Web.Core
{
- [WebZoneAttribute(WebZoneType.TopNavigationProductList | WebZoneType.StartProductList)]
+ [WebZone(WebZoneType.TopNavigationProductList | WebZoneType.StartProductList)]
public interface IProduct : IWebItem
{
Guid ProductID { get; }
diff --git a/web/ASC.Web.Core/Product.cs b/web/ASC.Web.Core/Product.cs
index 5537ba058d..e1851c839d 100644
--- a/web/ASC.Web.Core/Product.cs
+++ b/web/ASC.Web.Core/Product.cs
@@ -27,12 +27,12 @@
using System;
using System.IO;
using ASC.Data.Storage;
-using ASC.Web.Core.Client.HttpHandlers;
+//using ASC.Web.Core.Client.HttpHandlers;
using ASC.Web.Core.WebZones;
namespace ASC.Web.Core
{
- [WebZoneAttribute(WebZoneType.TopNavigationProductList | WebZoneType.StartProductList)]
+ [WebZone(WebZoneType.TopNavigationProductList | WebZoneType.StartProductList)]
public abstract class Product : IProduct
{
public abstract Guid ProductID { get; }
@@ -61,7 +61,7 @@ namespace ASC.Web.Core
Guid IWebItem.ID { get { return ProductID; } }
- public virtual ClientScriptLocalization ClientScriptLocalization { get; protected set; }
+ //public virtual ClientScriptLocalization ClientScriptLocalization { get; protected set; }
public string GetResourcePath(string relativePath)
{
diff --git a/web/ASC.Web.Core/ProductAttribute.cs b/web/ASC.Web.Core/ProductAttribute.cs
deleted file mode 100644
index 00ee5b67cf..0000000000
--- a/web/ASC.Web.Core/ProductAttribute.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- * (c) Copyright Ascensio System Limited 2010-2018
- *
- * This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
- * In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
- * Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
- *
- * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
- * FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
- *
- * You can contact Ascensio System SIA by email at sales@onlyoffice.com
- *
- * The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
- * Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
- *
- * Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
- * relevant author attributions when distributing the software. If the display of the logo in its graphic
- * form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
- * in every copy of the program you distribute.
- * Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
- *
-*/
-
-
-using System;
-
-namespace ASC.Web.Core
-{
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- public class ProductAttribute : Attribute
- {
- public Type Type
- {
- get;
- private set;
- }
-
-
- public ProductAttribute(Type type)
- {
- this.Type = type;
- }
- }
-}
diff --git a/web/ASC.Web.Core/ProductContext.cs b/web/ASC.Web.Core/ProductContext.cs
index fa3cb95f7c..4e8b727c95 100644
--- a/web/ASC.Web.Core/ProductContext.cs
+++ b/web/ASC.Web.Core/ProductContext.cs
@@ -30,10 +30,6 @@ namespace ASC.Web.Core
{
public class ProductContext : WebItemContext
{
- public string MasterPageFile { get; set; }
-
- public string ProductHTMLOverview { get; set; }
-
private IProductSubscriptionManager _sunscriptionManager;
public new IProductSubscriptionManager SubscriptionManager
diff --git a/web/ASC.Web.Core/WebItemManager.cs b/web/ASC.Web.Core/WebItemManager.cs
index c62e77055c..952811f255 100644
--- a/web/ASC.Web.Core/WebItemManager.cs
+++ b/web/ASC.Web.Core/WebItemManager.cs
@@ -33,9 +33,12 @@ using ASC.Common;
using ASC.Common.DependencyInjection;
using ASC.Common.Logging;
using ASC.Common.Utils;
-using ASC.Web.Core.Utility;
using ASC.Web.Core.WebZones;
+using Autofac;
+using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Mvc.ApplicationParts;
+using Microsoft.Extensions.DependencyInjection;
namespace ASC.Web.Core
{
@@ -49,11 +52,16 @@ namespace ASC.Web.Core
public class WebItemManager
{
- private static readonly ILog log = LogManager.GetLogger("ASC.Web");
+ private static readonly ILog log;
private readonly Dictionary items = new Dictionary();
- private static readonly string disableItem = ConfigurationManager.AppSettings["web.disabled-items"] + ",";
+ private static readonly List disableItem;
+ static WebItemManager()
+ {
+ log = LogManager.GetLogger("ASC.Web");
+ disableItem = (ConfigurationManager.AppSettings["web:disabled-items"] ?? "").Split(",").ToList();
+ }
public static Guid CommunityProductID
{
@@ -105,7 +113,10 @@ namespace ASC.Web.Core
get { return new Guid("{46CFA73A-F320-46CF-8D5B-CD82E1D67F26}"); }
}
- public static WebItemManager Instance { get; private set; }
+ private static WebItemManager instance;
+ public static WebItemManager Instance { get { return instance ?? (instance = CommonServiceProvider.GetService()); } }
+ private ApplicationPartManager ApplicationPartManager { get; }
+ public IContainer Container { get; }
public IWebItem this[Guid id]
{
@@ -117,31 +128,23 @@ namespace ASC.Web.Core
}
}
- static WebItemManager()
- {
- Instance = new WebItemManager();
- }
-
- private WebItemManager()
+ public WebItemManager(IContainer container)
{
+ Container = container;
}
public void LoadItems()
{
- foreach (var file in GetFiles())
+ foreach (var webitem in Container.Resolve>())
{
+ var file = webitem.ID.ToString();
try
{
- if (EnabledWebItem(file))
+ if (DisabledWebItem(file)) continue;
+
+ if (RegistryItem(webitem))
{
- var webitems = LoadWebItem(file);
- foreach (var webitem in webitems)
- {
- if (RegistryItem(webitem))
- {
- log.DebugFormat("Web item {0} loaded", webitem.Name);
- }
- }
+ log.DebugFormat("Web item {0} loaded", webitem.Name);
}
}
catch (Exception exc)
@@ -165,14 +168,14 @@ namespace ASC.Web.Core
{
((IProduct)webitem).Init();
}
- if (webitem is IModule)
+
+ if (webitem is IModule module)
{
- //TODO
- //var module = (IModule)webitem;
- //if (module.Context != null && module.Context.SearchHandler != null)
- //{
- // SearchHandlerManager.Registry(module.Context.SearchHandler);
- //}
+ if (module.Context != null && module.Context.SearchHandler != null)
+ {
+ //TODO
+ //SearchHandlerManager.Registry(module.Context.SearchHandler);
+ }
}
items.Add(webitem.ID, webitem);
@@ -240,28 +243,23 @@ namespace ASC.Web.Core
return GetItemsAll().OfType().ToList();
}
- private IEnumerable LoadWebItem(string file)
+ private bool DisabledWebItem(string name)
{
- var assembly = Assembly.LoadFrom(file);
- var attributes = assembly.GetCustomAttributes(typeof(ProductAttribute), false).Cast();
- return attributes.Where(r=> r != null).Select(productAttribute => (IWebItem)Activator.CreateInstance(productAttribute.Type));
+ return disableItem.Contains(name);
}
+ }
- private IEnumerable GetFiles()
+ public static class WebItemManagerExtension
+ {
+ public static IServiceCollection AddWebItemManager(this IServiceCollection services)
{
- const string pattern = "ASC.Web.*.dll";
- if (HttpContext.Current != null)
- {
- return Directory.GetFiles(Path.Combine(CommonServiceProvider.GetService().ContentRootPath, "~/bin"), pattern);
- }
- return Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), pattern);
+ services.AddSingleton();
+ return services;
}
-
- private bool EnabledWebItem(string file)
+ public static IApplicationBuilder UseWebItemManager(this IApplicationBuilder applicationBuilder)
{
- var parts = file.Split('.');
- var name = 1 < parts.Length ? parts[parts.Length - 2] + "," : string.Empty;
- return disableItem.IndexOf(name, StringComparison.InvariantCultureIgnoreCase) == -1;
+ WebItemManager.Instance.LoadItems();
+ return applicationBuilder;
}
}
}
\ No newline at end of file
diff --git a/web/ASC.Web.Studio/Program.cs b/web/ASC.Web.Studio/Program.cs
index 6124cdd1f1..32d75c8211 100644
--- a/web/ASC.Web.Studio/Program.cs
+++ b/web/ASC.Web.Studio/Program.cs
@@ -1,12 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Hosting;
namespace ASC.Web.Studio
{
@@ -17,13 +11,16 @@ namespace ASC.Web.Studio
CreateWebHostBuilder(args).Build().Run();
}
- public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
- WebHost.CreateDefaultBuilder(args)
- .UseStartup()
- .ConfigureAppConfiguration((hostingContext, config) => {
- config
- .AddJsonFile("autofac.json")
- .AddJsonFile("storage.json");
- });
+ public static IHostBuilder CreateWebHostBuilder(string[] args) =>
+ Host.CreateDefaultBuilder(args)
+ .ConfigureWebHostDefaults(w=>
+ {
+ w.UseStartup();
+ })
+ .ConfigureAppConfiguration((hostingContext, config) => {
+ config
+ .AddJsonFile("autofac.json")
+ .AddJsonFile("storage.json");
+ });
}
}
diff --git a/web/ASC.Web.Studio/Startup.cs b/web/ASC.Web.Studio/Startup.cs
index 0e52cb7ce9..3f1204da23 100644
--- a/web/ASC.Web.Studio/Startup.cs
+++ b/web/ASC.Web.Studio/Startup.cs
@@ -2,6 +2,7 @@ using ASC.Common.DependencyInjection;
using ASC.Common.Logging;
using ASC.Common.Utils;
using ASC.Data.Storage;
+using ASC.Data.Storage.Configuration;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer;
@@ -39,8 +40,11 @@ namespace ASC.Web.Studio
configuration.RootPath = "ClientApp/build";
});
+ services.AddAutofac(Configuration);
+
services.AddHttpContextAccessor()
- .AddLogManager(Configuration);
+ .AddStorage()
+ .AddLogManager();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.