Ich habe ein Ticket-Dashboard erstellt und es werden zwei Ticketzusammenfassungen angezeigt, nachdem ich mich mit meinem Administratorkonto angemeldet habe. Einer ist "Ihre Ticketzusammenfassung" und der andere "Alle Ticketzusammenfassung". Im Moment plane ich, meinem Administratorkonto zu erlauben, die Ticketzusammenfassung eines anderen Accounts zu sehen (wie this), aber ich weiß nicht, wie ich es dem Ticket-Dashboard hinzufügen kann, kann mir jemand zeigen, wie es geht?Wie man eine neue Ticketzusammenfassung im Obstgarten hinzufügt?
Antwort
Ich vermute, Sie haben die Frage auch als Kommentar im vorherigen Beitrag gestellt! aber egal,
gibt es mehrere Ansätze, dies zu tun. Orchard Collaboration verwendet ein Widget zur Darstellung von Ticket-Zusammenfassungen (sowohl für den Benutzer als auch für den Administrator). Die Hauptlogik befindet sich im DashboardDriver unter Module/Orchard.CRM.Core/Drivers.
private DriverResult DisplayDetail(DashboardPart part, dynamic shapeHelper)
{
if (this.services.WorkContext.CurrentUser == null)
{
return null;
}
var contentQuery = this.services.ContentManager.HqlQuery().ForVersion(VersionOptions.Published);
var statusRecords = this.basicDataService.GetStatusRecords().OrderBy(c => c.OrderId).ToList();
DashboardViewModel model = new DashboardViewModel();
model.CurrentUserId = this.services.WorkContext.CurrentUser.Id;
model.IsCustomer = this.crmContentOwnershipService.IsCurrentUserCustomer();
model.IsOperator = this.services.Authorizer.Authorize(Permissions.OperatorPermission);
dynamic state = new JObject();
// Query items created by customer
if (model.IsCustomer)
{
// Ticket contentType
state.ContentTypes = "Ticket";
contentQuery = this.projectionManagerWithDynamicSort.ApplyFilter(contentQuery, "Content", "ContentTypes", state);
state.RequestingUser_Id = model.CurrentUserId.ToString(CultureInfo.InvariantCulture);
contentQuery = this.projectionManagerWithDynamicSort.ApplyFilter(contentQuery, TicketFieldsFilter.CategoryName, TicketFieldsFilter.RequestingUserType, state);
var userTicketsCountByStateIds = groupQuery.GetCount(contentQuery, "TicketPartRecord", "StatusRecord.Id");
model.CurrentUserRequestingTickets = new Collection<dynamic>();
CRMHelper.AddStatusGroupRecordsToModel(statusRecords, userTicketsCountByStateIds, model.CurrentUserRequestingTickets);
// overrude items of current users
state.MaxDueDate = DateTime.UtcNow.Date;
contentQuery = this.projectionManagerWithDynamicSort.ApplyFilter(contentQuery, TicketFieldsFilter.CategoryName, TicketFieldsFilter.TicketDueDateType, state);
model.CurrentUserOverrudeRequestingTicketCount = contentQuery.Count();
}
// Query the counts of the current user tickets group by stateId
// *******************************************************
if (model.IsOperator)
{
// Ticket contentType
state.ContentTypes = "Ticket";
contentQuery = this.projectionManagerWithDynamicSort.ApplyFilter(contentQuery, "Content", "ContentTypes", state);
dynamic temp = new
{
Users = new int[] { model.CurrentUserId },
Teams = new int[] { },
BusinessUnits = new int[] { },
AccessType = ContentItemPermissionAccessTypes.Assignee
};
contentQuery = this.projectionManagerWithDynamicSort.ApplyFilter(contentQuery, ContentItemPermissionFilter.CategoryName, ContentItemPermissionFilter.AnySelectedUserTeamBusinessUnit, temp);
var userTicketsCountByStateIds = groupQuery.GetCount(contentQuery, "TicketPartRecord", "StatusRecord.Id");
model.CurrentUserTickets = new Collection<dynamic>();
CRMHelper.AddStatusGroupRecordsToModel(statusRecords, userTicketsCountByStateIds, model.CurrentUserTickets);
// overrude items of current users
state.MaxDueDate = DateTime.UtcNow.Date;
contentQuery = this.projectionManagerWithDynamicSort.ApplyFilter(contentQuery, TicketFieldsFilter.CategoryName, TicketFieldsFilter.TicketDueDateType, state);
model.CurrentUserOverrudeItemsCount = contentQuery.Count();
//*******************************************************
}
bool isAdmin = this.services.Authorizer.Authorize(Permissions.AdvancedOperatorPermission);
if (isAdmin)
{
// Query the counts of the whole tickets in the system based on stateId
state = new JObject();
contentQuery = this.services.ContentManager.HqlQuery().ForVersion(VersionOptions.Published);
state.ContentTypes = "Ticket";
contentQuery = this.projectionManagerWithDynamicSort.ApplyFilter(contentQuery, "Content", "ContentTypes", state);
var ticketCountsByStateIds = groupQuery.GetCount(contentQuery, "TicketPartRecord", "StatusRecord.Id");
model.AllTickets = new Collection<dynamic>();
CRMHelper.AddStatusGroupRecordsToModel(statusRecords, ticketCountsByStateIds, model.AllTickets);
state.MaxDueDate = DateTime.UtcNow.Date;
contentQuery = this.projectionManagerWithDynamicSort.ApplyFilter(contentQuery, TicketFieldsFilter.CategoryName, TicketFieldsFilter.TicketDueDateType, state);
model.AllOverrudeItemsCount = contentQuery.Count();
}
// get items without any owner
contentQuery = this.services.ContentManager.HqlQuery().ForVersion(VersionOptions.Published);
state.ContentTypes = "Ticket";
contentQuery = this.projectionManagerWithDynamicSort.ApplyFilter(contentQuery, "Content", "ContentTypes", state);
contentQuery = this.projectionManagerWithDynamicSort.ApplyFilter(contentQuery, ContentItemPermissionFilter.CategoryName, "ContentItemPermissionPartRecord.ItemsWithoutAnyOwner", state);
model.AllItemsWithoutOwnerCount = contentQuery.Count();
// get overrude items count
// display
// 1) Number of your open, new, in progress, and closed tickets
// 2) number of the unassigned, new, open, in progress and closed tickets in the system.
return ContentShape("Parts_Dashboard",
() => shapeHelper.Parts_Dashboard(
Model: model
));
}
Sie müssen ein neues Widget ähnlich wie dieses erstellen. DashboardDriver stellt Tickets des angemeldeten Benutzers sowie eine Zusammenfassung aller Tickets dar. In dem neuen Widget können Sie nur Zusammenfassungstickets des Benutzers darstellen. Das neue Widget muss über eine UserId-Eigenschaft verfügen und eine Ticketzusammenfassung dieses Benutzers anstelle des angemeldeten Benutzers darstellen. Etwas wie dieses:
private DriverResult DisplayDetail(NewUserDashboardPart part, dynamic shapeHelper)
{
if (this.services.WorkContext.CurrentUser == null)
{
return null;
}
var contentQuery = this.services.ContentManager.HqlQuery().ForVersion(VersionOptions.Published);
var statusRecords = this.basicDataService.GetStatusRecords().OrderBy(c => c.OrderId).ToList();
DashboardViewModel model = new DashboardViewModel();
model.CurrentUserId = NewUserDashboardPart.UserId;
dynamic state = new JObject();
// Query the counts of the current user tickets group by stateId
// *******************************************************
// Ticket contentType
state.ContentTypes = "Ticket";
contentQuery = this.projectionManagerWithDynamicSort.ApplyFilter(contentQuery, "Content", "ContentTypes", state);
dynamic temp = new
{
Users = new int[] { model.CurrentUserId },
Teams = new int[] { },
BusinessUnits = new int[] { },
AccessType = ContentItemPermissionAccessTypes.Assignee
};
contentQuery = this.projectionManagerWithDynamicSort.ApplyFilter(contentQuery, ContentItemPermissionFilter.CategoryName, ContentItemPermissionFilter.AnySelectedUserTeamBusinessUnit, temp);
var userTicketsCountByStateIds = groupQuery.GetCount(contentQuery, "TicketPartRecord", "StatusRecord.Id");
model.CurrentUserTickets = new Collection<dynamic>();
CRMHelper.AddStatusGroupRecordsToModel(statusRecords, userTicketsCountByStateIds, model.CurrentUserTickets);
// overrude items of current users
state.MaxDueDate = DateTime.UtcNow.Date;
contentQuery = this.projectionManagerWithDynamicSort.ApplyFilter(contentQuery, TicketFieldsFilter.CategoryName, TicketFieldsFilter.TicketDueDateType, state);
model.CurrentUserOverrudeItemsCount = contentQuery.Count();
//*******************************************************
// display
// 1) Number of your open, new, in progress, and closed tickets
// 2) number of the unassigned, new, open, in progress and closed tickets in the system.
return ContentShape("Parts_Dashboard",
() => shapeHelper.Parts_Dashboard(
Model: model
));
}
- 1. Wie man eine neue Tabelle zur Magento-Datenbank hinzufügt
- 2. Wie man den 'Blog' im Obstgarten gestaltet CMS
- 3. wie man jquery im Laravel Projekt hinzufügt
- 4. Wie man Emoji im Code hinzufügt?
- 5. Wie man Preisrabattprozentsatz durch eine Kategorie im Zen-Wagen hinzufügt?
- 6. Obstgarten Collaboration
- 7. Benutzerdefinierte Teileigenschaften fehlen im Export Obstgarten 1.6
- 8. Wie man eine 'on-click' Hintergrundänderung hinzufügt
- 9. Wie man eine Stoptaste zum Downloader hinzufügt
- 10. Wie man eine statische Nachricht hinzufügt ExtJS
- 11. wie man Listenansichtsdaten hinzufügt
- 12. Wie man Titel hinzufügt?
- 13. Wie man neue Gabeln im Kernel hört
- 14. Wie man eine Wallpaper-Galerie zu einer Android-Anwendung hinzufügt
- 15. Wie man CheckBox im Dialog hinzufügt und Wert erhält?
- 16. VelX und VelY im optischen Fluss (wie man sie hinzufügt)
- 17. Wie man eine Bewertung innerhalb einer TableView in JavaFX hinzufügt
- 18. Wie man eine neue Zeile in einem JLabel mit Variablen hinzufügt
- 19. Wie man den Standardwert in Drodown im Oktober cms hinzufügt?
- 20. Wie man D3 Tooltips hinzufügt
- 21. Skript Fehler in Obstgarten
- 22. Wie man eine neue UITableView öffnet, wenn man auf eine Tabellenzelle klickt und den Navigationscontroller dynamisch hinzufügt
- 23. Wie man eine geplante Aufgabe zu Celery Beat dynamisch hinzufügt
- 24. Rails 3 wie man eine benutzerdefinierte Methode zum Controller hinzufügt
- 25. PersistentBag Ausnahme in Obstgarten
- 26. Wie man neue Requisiten dynamisch zur Komponente hinzufügt, indem man den Navigator in React Native verwendet
- 27. KendoUI Grid - wie man eine Klasse zur generierten Tabelle hinzufügt
- 28. PHP Wie man eine Variable zu einem Array hinzufügt?
- 29. Wie man eine Klasse zum Zielbereich beim Klicken hinzufügt
- 30. Wie man eine Benachrichtigung zu einem MediaPlayer Service hinzufügt?