@@ -30,6 +30,7 @@ public function &run(Router &$router, View &$view, array &$args) {
30
30
$ model = new PacketEditModel ();
31
31
$ model ->csrf_id = mt_rand ();
32
32
$ model ->csrf_token = CSRF ::generate ($ model ->csrf_id , 7200 ); // 2 hours
33
+ $ model ->deprecated = null ;
33
34
$ model ->error = null ;
34
35
$ model ->format = null ;
35
36
$ model ->id = null ;
@@ -40,6 +41,7 @@ public function &run(Router &$router, View &$view, array &$args) {
40
41
$ model ->products = Product::getAllProducts ();
41
42
$ model ->published = null ;
42
43
$ model ->remarks = null ;
44
+ $ model ->research = null ;
43
45
$ model ->used_by = null ;
44
46
$ model ->user = Authentication::$ user ;
45
47
@@ -54,15 +56,15 @@ public function &run(Router &$router, View &$view, array &$args) {
54
56
if ($ model ->packet === null ) {
55
57
$ model ->error = "NOT_FOUND " ;
56
58
} else {
57
- $ flags = $ model ->packet ->getOptionsBitmask ();
58
-
59
- $ model ->id = $ model ->packet ->getPacketId ();
60
- $ model ->name = $ model ->packet ->getPacketName ();
61
- $ model ->format = $ model ->packet ->getPacketFormat ( );
62
- $ model ->remarks = $ model ->packet ->getPacketRemarks ( false );
63
- $ model ->markdown = ( $ flags & Packet:: OPTION_MARKDOWN );
64
- $ model ->published = ( $ flags & Packet:: OPTION_PUBLISHED );
65
- $ model ->used_by = $ this ->getUsedBy ($ model ->packet );
59
+ $ model -> deprecated = $ model ->packet ->isDeprecated ();
60
+ $ model -> id = $ model -> packet -> getPacketId ();
61
+ $ model ->name = $ model ->packet ->getPacketName ();
62
+ $ model ->format = $ model ->packet ->getPacketFormat ();
63
+ $ model ->remarks = $ model ->packet ->getPacketRemarks ( false );
64
+ $ model ->research = $ model ->packet ->isInResearch ( );
65
+ $ model ->markdown = $ model -> packet -> isMarkdown ( );
66
+ $ model ->published = $ model -> packet -> isPublished ( );
67
+ $ model ->used_by = $ this ->getUsedBy ($ model ->packet );
66
68
67
69
if ($ router ->getRequestMethod () == "POST " ) {
68
70
$ this ->handlePost ($ router , $ model );
@@ -98,16 +100,20 @@ protected function handlePost(Router &$router, PacketEditModel &$model) {
98
100
$ remarks = (isset ($ data ["remarks " ]) ? $ data ["remarks " ] : null );
99
101
$ markdown = (isset ($ data ["markdown " ]) ? $ data ["markdown " ] : null );
100
102
$ content = (isset ($ data ["content " ]) ? $ data ["content " ] : null );
101
- $ publish = (isset ($ data ["publish " ]) ? $ data ["publish " ] : null );
102
- $ save = (isset ($ data ["save " ]) ? $ data ["save " ] : null );
103
+ $ deprecated = (isset ($ data ["deprecated " ]) ? $ data ["deprecated " ] : null );
104
+ $ research = (isset ($ data ["research " ]) ? $ data ["research " ] : null );
105
+ $ published = (isset ($ data ["published " ]) ? $ data ["published " ] : null );
103
106
$ used_by = (isset ($ data ["used_by " ]) ? $ data ["used_by " ] : null );
104
107
105
- $ model ->id = $ id ;
106
- $ model ->name = $ name ;
107
- $ model ->format = $ format ;
108
- $ model ->remarks = $ remarks ;
109
- $ model ->markdown = $ markdown ;
110
- $ model ->content = $ content ;
108
+ $ model ->id = $ id ;
109
+ $ model ->name = $ name ;
110
+ $ model ->format = $ format ;
111
+ $ model ->remarks = $ remarks ;
112
+ $ model ->markdown = $ markdown ;
113
+ $ model ->content = $ content ;
114
+ $ model ->deprecated = $ deprecated ;
115
+ $ model ->research = $ research ;
116
+ $ model ->published = $ published ;
111
117
112
118
if (!$ csrf_valid ) {
113
119
$ model ->error = "INVALID_CSRF " ;
@@ -132,7 +138,9 @@ protected function handlePost(Router &$router, PacketEditModel &$model) {
132
138
$ model ->packet ->setPacketFormat ($ model ->format );
133
139
$ model ->packet ->setPacketRemarks ($ model ->remarks );
134
140
$ model ->packet ->setMarkdown ($ model ->markdown );
135
- $ model ->packet ->setPublished ($ publish );
141
+ $ model ->packet ->setDeprecated ($ model ->deprecated );
142
+ $ model ->packet ->setInResearch ($ model ->research );
143
+ $ model ->packet ->setPublished ($ model ->published );
136
144
137
145
$ model ->packet ->setEditedCount (
138
146
$ model ->packet ->getEditedCount () + 1
0 commit comments