コード例 #1
0
 public ScatterViewWidgetContainerAdapter(
     IWidgetManager widgetManager,
     IWidgetContainerBehaviorFactory widgetContainerBehaviorFactory,
     IWidgetContainerAccessor containerAccessor)
     : base(widgetManager, widgetContainerBehaviorFactory, containerAccessor)
 {
 }
コード例 #2
0
 public DashboardController(IWidgetManager widgetManager, IProjectManagerService pmService,
                            IOrganizationProjectManager projectManager,
                            IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _projectManager = projectManager;
     _widgetManager  = widgetManager;
 }
コード例 #3
0
 public WidgetController(IWidgetManager widgetManager,
                         IAgencyOwner agencyOwner,
                         IServiceProvider provider) : base(provider)
 {
     _widgetManager = widgetManager;
     _agencyOwner   = agencyOwner;
 }
コード例 #4
0
        public IHttpActionResult AddNewWidgetToDashboard([FromBody] AddWidgetDTO model)
        {
            UnitOfWorkManager uowManager = new UnitOfWorkManager();

            widgetManager = new WidgetManager(uowManager);
            itemManager   = new ItemManager(uowManager);

            Dashboard dash = widgetManager.GetDashboard(User.Identity.GetUserId());

            List <PropertyTag> propertyTags = new List <PropertyTag> {
                new PropertyTag()
                {
                    Name = model.PropertyTag
                }
            };

            List <Item> items = itemManager.GetAllItems().Where(i => model.ItemIds.Contains(i.ItemId)).ToList();

            if (string.IsNullOrEmpty(model.Title))
            {
                model.Title = Resources.Title;
            }

            widgetManager.AddWidget(WidgetType.GraphType, model.Title, 0,
                                    0, propertyTags, graphType: model.GraphType, dashboardId: dash.DashboardId, items: items);

            uowManager.Save();

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #5
0
 public DashboardController(IWidgetManager widgetManager,
                            IOrganizationRecruiter recruiter,
                            IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _recruiter     = recruiter;
     _widgetManager = widgetManager;
 }
コード例 #6
0
 public DashboardController(IWidgetManager widgetManager, IMarketerService maService,
                            IOrganizationMarketer marketer,
                            IServiceProvider provider) : base(provider)
 {
     _widgetManager = widgetManager;
     _marketer      = marketer;
 }
コード例 #7
0
 public Migrations(
     IContentManager contentManager,
     IWidgetManager widgetManager)
 {
     _contentManager = contentManager;
     _widgetManager  = widgetManager;
 }
コード例 #8
0
        public WidgetsContainerPartDriver(
            ISiteThemeService siteThemeService,
            IWidgetsService widgetsService,
            IVirtualPathProvider virtualPathProvider,
            IShapeFactory shapeFactory,
            IWidgetManager widgetManager,
            IWorkContextAccessor wca,
            IContentManager contentManager,
            ILocalizationService localizationService,
            ICultureManager cultureManager,
            IAuthorizer authorizer,
            INotifier notifier)
        {
            _siteThemeService    = siteThemeService;
            _widgetsService      = widgetsService;
            _virtualPathProvider = virtualPathProvider;
            New                  = shapeFactory;
            _widgetManager       = widgetManager;
            _wca                 = wca;
            _contentManager      = contentManager;
            _localizationService = localizationService;
            _cultureManager      = cultureManager;
            _authorizer          = authorizer;
            _notifier            = notifier;

            T = NullLocalizer.Instance;
        }
コード例 #9
0
 public ScatterViewWidgetContainerAdapter(
     IWidgetManager widgetManager,
     IWidgetContainerBehaviorFactory widgetContainerBehaviorFactory,
     IWidgetContainerAccessor containerAccessor)
     : base(widgetManager, widgetContainerBehaviorFactory, containerAccessor)
 {
 }
コード例 #10
0
 public DashboardController(IWidgetManager widgetManager,
                            OrganizationCustomerOutput customer,
                            IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _customer      = customer;
     _widgetManager = widgetManager;
 }
コード例 #11
0
 public DashboardController(IWidgetManager widgetManager,
                            IOrganizationContractor contractor,
                            IServiceProvider provider) : base(provider)
 {
     _widgetManager = widgetManager;
     _contractor    = contractor;
 }
コード例 #12
0
 public WidgetController(IWidgetManager logicManager)
 {
     if (logicManager == null)
     {
         throw new ArgumentNullException("logicManager");
     }
     LogicManager = logicManager;
 }
コード例 #13
0
 public WidgetController(IWidgetManager logicManager)
 {
     if (logicManager == null)
     {
         throw new ArgumentNullException("logicManager");
     }
     LogicManager = logicManager;
 }
コード例 #14
0
        public WidgetsContainerPartHandler(IContentManager contentManager, IWidgetManager widgetManager)
        {
            _contentManager = contentManager;
            _widgetManager  = widgetManager;

            OnRemoved <WidgetsContainerPart>((context, part) => {
                DeleteWidgets(part);
            });
        }
コード例 #15
0
 public WidgetAdminController(IOrchardServices services, IWidgetsService widgetsService, IWidgetManager widgetManager, IContentManager contentManager)
 {
     _services       = services;
     _widgetsService = widgetsService;
     _widgetManager  = widgetManager;
     _contentManager = contentManager;
     T      = NullLocalizer.Instance;
     Logger = NullLogger.Instance;
 }
コード例 #16
0
        public WidgetsContainerPartLocalizationHandler(
            IWidgetManager widgetManager,
            IWorkContextAccessor wca)
        {
            _widgetManager = widgetManager;
            _wca           = wca;

            OnCloned <WidgetsContainerPart>(ResetWidgetsLocalization);
        }
コード例 #17
0
        public IHttpActionResult GetWidgets()
        {
            widgetManager = new WidgetManager();
            itemManager   = new ItemManager();

            Dashboard dashboard = widgetManager.GetDashboardWithAllDataForUserId(User.Identity.GetUserId());

            if (dashboard == null)
            {
                return(NotFound());
            }

            //Get all widgets for user
            List <UserWidget> userWidgets = widgetManager.GetWidgetsForDashboard(dashboard.DashboardId).ToList();

            if (userWidgets == null || userWidgets.Count() == 0)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }

            //Convert all widget to userWidgets (DTO's).
            List <UserWidgetViewModel> userWidgetDtos = Mapper.Map(userWidgets, new List <UserWidgetViewModel>());

            foreach (UserWidgetViewModel userWidgetVM in userWidgetDtos)
            {
                foreach (int itemId in userWidgetVM.ItemIds)
                {
                    //Get the topic of the graph of the userwidget.
                    string keyValue = widgetManager.GetWidgetWithAllData(userWidgetVM.WidgetId)?.WidgetDatas.FirstOrDefault()?.KeyValue;

                    //Get all widgets for each item in userWidgets.
                    IEnumerable <Widget> widgetsForItem = widgetManager.GetAllWidgetsWithAllDataForItem(itemId);

                    //Check if these widgets have graph data (WidgetData) on this topic, if they do add this data to the userWidget.
                    IEnumerable <WidgetData> widgetDatas = widgetsForItem.FirstOrDefault(w => w.WidgetDatas.Any(wd => wd.KeyValue == keyValue)).WidgetDatas;

                    //Convert the graphdata to a DTO.
                    List <WidgetDataDTO> widgetDataDtos = Mapper.Map(widgetDatas, new List <WidgetDataDTO>());

                    //Link the graphdata to the corresponding item.
                    widgetDataDtos.First().ItemName = itemManager.GetItem(itemId).Name;

                    if (userWidgetVM.WidgetDataDtos == null)
                    {
                        userWidgetVM.WidgetDataDtos = widgetDataDtos;
                    }
                    else
                    {
                        userWidgetVM.WidgetDataDtos.AddRange(widgetDataDtos);
                    }
                }
            }

            return(Ok(userWidgetDtos));
        }
        public WidgetsContainerPartHandler(
            IContentManager contentManager,
            IWidgetManager widgetManager,
            ILocalizationService localizationService,
            ShellSettings shellSettings,
            ITaxonomyService taxonomyService)
        {
            _contentManager      = contentManager;
            _widgetManager       = widgetManager;
            _localizationService = localizationService;
            _shellSettings       = shellSettings;
            _taxonomyService     = taxonomyService;
            if (!string.IsNullOrEmpty(_shellSettings.RequestUrlPrefix))
            {
                _urlPrefix = new UrlPrefix(_shellSettings.RequestUrlPrefix);
            }
            T = NullLocalizer.Instance;

            OnRemoved <WidgetsContainerPart>((context, part) => {
                DeleteWidgets(part);
            });
            OnUpdateEditorShape <WidgetsContainerPart>((context, part) => {
                var lPart = part.ContentItem.As <LocalizationPart>();
                if (lPart != null)
                {
                    var settings = part.Settings.GetModel <WidgetsContainerSettings>();
                    if (settings.TryToLocalizeItems)
                    {
                        var culture = lPart.Culture;
                        var widgets = _widgetManager.GetWidgets(part.ContentItem.Id, part.ContentItem.IsPublished())
                                      .Where(p => p.ContentItem.Has <LocalizationPart>() &&
                                             p.ContentItem.Get <LocalizationPart>().Culture == null);
                        foreach (var widget in widgets)
                        {
                            var ci = widget.ContentItem;
                            _localizationService.SetContentCulture(ci, culture.Culture);
                            // manage taxonomy field out of the normal flow:
                            // gets translations of selected terms in taxonomy fields before BuildEditor()
                            var translatedTaxo = TranslateTaxonomies(ci, culture, _localizationService);

                            // simulates a user that opens in edit model the widget and saves it
                            // to trigger all handlers and drivers
                            var shapeWidget = _contentManager.BuildEditor(ci);
                            var shapeUpdate = _contentManager.UpdateEditor(ci, new CustomUpdater(shapeWidget, culture.Culture, Logger));

                            // sets translated terms in taxonomy fields after UpdateEditor()
                            ApplyTranslatedTaxonomies(ci, translatedTaxo, _taxonomyService);

                            ci.VersionRecord.Published = false;
                            _contentManager.Publish(ci);
                        }
                    }
                }
            });
        }
コード例 #19
0
        public IHttpActionResult Delete(int id)
        {
            widgetManager = new WidgetManager();

            if (widgetManager.GetWidget(id) == null)
            {
                return(NotFound());
            }

            widgetManager.RemoveWidget(id);
            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #20
0
ファイル: MainViewModel.cs プロジェクト: Kendry06/Gymnastika
 public MainViewModel(
     IUnityContainer container,
     IRegionManager regionManager,
     IWidgetManager widgetManager,
     INavigationManager navigationManager,
     INavigationService navigationService)
 {
     _container         = container;
     _regionManager     = regionManager;
     _widgetManager     = widgetManager;
     _navigationManager = navigationManager;
     _navigationService = navigationService;
 }
コード例 #21
0
ファイル: MainViewModel.cs プロジェクト: weiqiyiji/Gymnastika
 public MainViewModel(
     IUnityContainer container,
     IRegionManager regionManager,
     IWidgetManager widgetManager,
     INavigationManager navigationManager,
     INavigationService navigationService)
 {
     _container = container;
     _regionManager = regionManager;
     _widgetManager = widgetManager;
     _navigationManager = navigationManager;
     _navigationService = navigationService;
 }
コード例 #22
0
 public WidgetsContainerPartDriver(ISiteThemeService siteThemeService, IWidgetsService widgetsService, IVirtualPathProvider virtualPathProvider, IShapeFactory shapeFactory, IWidgetManager widgetManager, IWorkContextAccessor wca, IContentManager contentManager, IOrchardServices services, ILocalizationService localizationService, ICultureManager cultureManager)
 {
     _siteThemeService    = siteThemeService;
     _widgetsService      = widgetsService;
     _virtualPathProvider = virtualPathProvider;
     New                  = shapeFactory;
     _widgetManager       = widgetManager;
     _wca                 = wca;
     _contentManager      = contentManager;
     _services            = services;
     _localizationService = localizationService;
     _cultureManager      = cultureManager;
 }
コード例 #23
0
        public IHttpActionResult PutName(int id, string title)
        {
            widgetManager = new WidgetManager();

            if (widgetManager.GetWidget(id) == null)
            {
                return(NotFound());
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            widgetManager.ChangeWidgetTitle(id, title);
            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #24
0
 public WidgetsContainerPartDriver(
     ISiteThemeService siteThemeService,
     IWidgetsService widgetsService,
     IVirtualPathProvider virtualPathProvider,
     IShapeFactory shapeFactory,
     IWidgetManager widgetManager,
     IWorkContextAccessor wca,
     IContentManager contentManager)
 {
     _siteThemeService    = siteThemeService;
     _widgetsService      = widgetsService;
     _virtualPathProvider = virtualPathProvider;
     New             = shapeFactory;
     _widgetManager  = widgetManager;
     _wca            = wca;
     _contentManager = contentManager;
 }
コード例 #25
0
        /// <summary>
        ///Reads all widgets for a user dashboard and returns them
        /// </summary>
        public IHttpActionResult GetUserWidgets()
        {
            widgetManager = new WidgetManager();
            Dashboard dash = widgetManager.GetDashboard(User.Identity.GetUserId());

            try {
                List <UserWidget> widgets = widgetManager.GetWidgetsForDashboard(dash.DashboardId).ToList();

                if (widgets == null || widgets.Count() == 0)
                {
                    return(StatusCode(HttpStatusCode.NoContent));
                }

                return(Ok(Mapper.Map(widgets, new List <UserWidgetDTO>())));
            } catch (Exception e) {
                return(BadRequest(e.Message));
            }
        }
コード例 #26
0
        public IHttpActionResult GetItemWidgets(int itemId)
        {
            widgetManager = new WidgetManager();
            IEnumerable <Widget> widgets = widgetManager.GetItemwidgetsForItem(itemId);

            if (widgets == null || widgets.Count() == 0)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }

            List <UserWidgetDTO> uWidgets = Mapper.Map(widgets, new List <UserWidgetDTO>());

            foreach (UserWidgetDTO widgetDto in uWidgets)
            {
                widgetDto.DashboardId = -1;
            }

            return(Ok(uWidgets));
        }
コード例 #27
0
        public IHttpActionResult UpdateWidget([FromBody] UserWidgetDTO[] widgets)
        {
            widgetManager = new WidgetManager();

            foreach (UserWidgetDTO widget in widgets)
            {
                if (widget == null)
                {
                    return(BadRequest("No widget given"));
                }
                if (widgetManager.GetWidget(widget.WidgetId) == null)
                {
                    return(NotFound());
                }

                widgetManager.ChangeWidgetDetails(widget.WidgetId, widget.RowNumber, widget.ColumnNumber, widget.ItemIds.ToList(),
                                                  widget.RowSpan, widget.ColumnSpan, widget.GraphType);
            }
            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #28
0
        public IHttpActionResult GetActivityWidgets()
        {
            widgetManager = new WidgetManager();

            int suplatformID = -1;

            if (Request.Properties.TryGetValue("SubPlatformID", out object _customObject))
            {
                suplatformID = (int)_customObject;
            }

            List <Widget> widgets = widgetManager.GetWidgetsForActivities(suplatformID).ToList();

            if (widgets == null)
            {
                return(NotFound());
            }

            return(Ok(Mapper.Map(widgets.ToList(), new List <UserWidgetDTO>())));
        }
コード例 #29
0
        public IHttpActionResult CreateDataJson(int itemId)
        {
            widgetManager = new WidgetManager();
            string     val  = widgetManager.NoteboxData(itemId);
            List <int> vals = new List <int>();

            val.Split(',').ForEach(v => vals.Add(Int32.Parse(v)));

            Itemstats itemstats = new Itemstats
            {
                Male          = vals.ElementAt(0),
                Female        = vals.ElementAt(1),
                GenderUnknown = vals.ElementAt(2),
                Old           = vals.ElementAt(3),
                Young         = vals.ElementAt(4),
                AgeUnknown    = vals.ElementAt(5)
            };


            return(Ok(itemstats));
        }
コード例 #30
0
        public IHttpActionResult GetGraphs(int itemId, int widgetId)
        {
            widgetManager = new WidgetManager();
            itemManager   = new ItemManager();

            //Get widgets for item
            IEnumerable <Widget> widgets = widgetManager.GetAllWidgetsWithAllDataForItem(itemId);

            //Get keyvalue for the widgetid.
            string keyValue = widgetManager.GetWidgetWithAllData(widgetId)?.WidgetDatas.FirstOrDefault()?.KeyValue;

            if (keyValue == null)
            {
                keyValue = widgetManager.GetWidgetWithAllData(widgetId)?.PropertyTags.FirstOrDefault()?.Name;
            }

            try
            {
                IEnumerable <WidgetData>    widgetDatas    = widgets.FirstOrDefault(widget => widget.WidgetDatas.Any(data => data.KeyValue == keyValue)).WidgetDatas;
                IEnumerable <WidgetDataDTO> widgetDataDtos = Mapper.Map(widgetDatas, new List <WidgetDataDTO>());

                //Get item name
                widgetDataDtos.First().ItemName = itemManager.GetItem(itemId).Name;

                return(Ok(widgetDataDtos));

#pragma warning disable CS0168 // Variable is declared but never used
            }
            catch (Exception e)
#pragma warning restore CS0168 // Variable is declared but never used
            {
                IEnumerable <WidgetData>    widgetDatas    = new List <WidgetData>();
                IEnumerable <WidgetDataDTO> widgetDataDtos = Mapper.Map(widgetDatas, new List <WidgetDataDTO>());

                return(Ok(widgetDataDtos));
            }
        }
コード例 #31
0
        public IHttpActionResult GetWeeklyReview(string id)
        {
            //Determine subplatform
            int suplatformID = -1;

            if (Request.Properties.TryGetValue("SubPlatformID", out object _customObject))
            {
                suplatformID = (int)_customObject;
            }

            widgetManager = new WidgetManager();
            IEnumerable <Widget> widgets;

            if (id.Equals("0"))
            {
                widgets = widgetManager.GetWidgetsForWeeklyReview(suplatformID, null);
            }
            else
            {
                widgets = widgetManager.GetWidgetsForWeeklyReview(suplatformID, id);
            }

            return(Ok(Mapper.Map(widgets, new List <UserWidgetDTO>())));
        }
コード例 #32
0
 public IHttpActionResult MoveWidgetToDashboard([FromBody] UserWidgetDTO model)
 {
     widgetManager = new WidgetManager();
     widgetManager.MoveWidgetToDashBoard(model.WidgetId, model.GraphType, model.ItemIds, User.Identity.GetUserId());
     return(StatusCode(HttpStatusCode.NoContent));
 }
 public WidgetContainerPartDumperService(
     IWidgetManager widgetManager)
 {
     _widgetManager = widgetManager;
 }
コード例 #34
0
 public WidgetPanelViewModel(IWidgetManager widgetManager)
 {
     _widgetManager = widgetManager;
     _widgetManager.Add(typeof(DateWidget));
 }