Skip to content

Commit db88a3b

Browse files
committed
Open all user courses in LMS
1 parent 7f3fdec commit db88a3b

File tree

2 files changed

+60
-4
lines changed

2 files changed

+60
-4
lines changed

LMS.Form.User.dfm

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ object LMSUserForm: TLMSUserForm
22
Left = 0
33
Top = 0
44
Caption = 'LMSUserForm'
5-
ClientHeight = 255
6-
ClientWidth = 535
5+
ClientHeight = 399
6+
ClientWidth = 671
77
Color = clBtnFace
88
Font.Charset = DEFAULT_CHARSET
99
Font.Color = clWindowText
@@ -16,4 +16,42 @@ object LMSUserForm: TLMSUserForm
1616
OnClose = FormClose
1717
PixelsPerInch = 96
1818
TextHeight = 13
19+
object ActionToolBar1: TActionToolBar
20+
Left = 0
21+
Top = 0
22+
Width = 671
23+
Height = 23
24+
ActionManager = ActionManager1
25+
Caption = 'ActionToolBar1'
26+
Color = clMenuBar
27+
ColorMap.DisabledFontColor = 7171437
28+
ColorMap.HighlightColor = clWhite
29+
ColorMap.BtnSelectedFont = clBlack
30+
ColorMap.UnusedColor = clWhite
31+
Font.Charset = DEFAULT_CHARSET
32+
Font.Color = clBlack
33+
Font.Height = -11
34+
Font.Name = 'Tahoma'
35+
Font.Style = []
36+
ParentFont = False
37+
Spacing = 0
38+
end
39+
object ActionManager1: TActionManager
40+
ActionBars = <
41+
item
42+
Items = <
43+
item
44+
Action = Action1
45+
Caption = '&Open courses'
46+
end>
47+
ActionBar = ActionToolBar1
48+
end>
49+
Left = 520
50+
Top = 80
51+
StyleName = 'Platform Default'
52+
object Action1: TAction
53+
Caption = 'Open courses'
54+
OnExecute = Action1Execute
55+
end
56+
end
1957
end

LMS.Form.User.pas

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ interface
99
Vcl.StdCtrls,
1010

1111
LMS._interface.LMS,
12-
LMS.TreeView.UserCourses;
12+
LMS.TreeView.UserCourses, Vcl.ToolWin, Vcl.ActnMan, Vcl.ActnCtrls,
13+
Vcl.PlatformDefaultStyleActnCtrls, System.Actions, Vcl.ActnList;
1314

1415
type
1516
TLMSUserForm = class(TForm)
17+
ActionManager1: TActionManager;
18+
ActionToolBar1: TActionToolBar;
19+
Action1: TAction;
1620
procedure FormClose(Sender: TObject; var Action: TCloseAction);
21+
procedure Action1Execute(Sender: TObject);
1722
private
1823
fLMSUser: IUser;
1924
UserCoursesTreeView: TLMSUserCoursesTreeView;
@@ -26,8 +31,20 @@ TLMSUserForm = class(TForm)
2631

2732
implementation
2833

34+
uses
35+
LMS.Helper.Browser;
36+
2937
{$R *.dfm}
3038

39+
procedure TLMSUserForm.Action1Execute(Sender: TObject);
40+
begin
41+
for var aCourse in User.OtherEnrolledCourses do
42+
begin
43+
44+
OpenInBrowser(aCourse);
45+
end;
46+
end;
47+
3148
constructor TLMSUserForm.Create(Owner: TComponent);
3249
begin
3350
inherited;
@@ -48,7 +65,8 @@ procedure TLMSUserForm.SetLMSUser(const Value: IUser);
4865

4966
caption := fLMSUser.Full_Name;
5067

51-
UserCoursesTreeView.User := value; // . Courses := fLMSUser.OtherEnrolledCourses;
68+
UserCoursesTreeView.User := Value;
69+
// . Courses := fLMSUser.OtherEnrolledCourses;
5270
end;
5371

5472
end.

0 commit comments

Comments
 (0)