@@ -30,6 +30,7 @@ public function &run(Router &$router, View &$view, array &$args) {
3030 $ model = new PacketEditModel ();
3131 $ model ->csrf_id = mt_rand ();
3232 $ model ->csrf_token = CSRF ::generate ($ model ->csrf_id , 7200 ); // 2 hours
33+ $ model ->deprecated = null ;
3334 $ model ->error = null ;
3435 $ model ->format = null ;
3536 $ model ->id = null ;
@@ -40,6 +41,7 @@ public function &run(Router &$router, View &$view, array &$args) {
4041 $ model ->products = Product::getAllProducts ();
4142 $ model ->published = null ;
4243 $ model ->remarks = null ;
44+ $ model ->research = null ;
4345 $ model ->used_by = null ;
4446 $ model ->user = Authentication::$ user ;
4547
@@ -54,15 +56,15 @@ public function &run(Router &$router, View &$view, array &$args) {
5456 if ($ model ->packet === null ) {
5557 $ model ->error = "NOT_FOUND " ;
5658 } 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 );
6668
6769 if ($ router ->getRequestMethod () == "POST " ) {
6870 $ this ->handlePost ($ router , $ model );
@@ -98,16 +100,20 @@ protected function handlePost(Router &$router, PacketEditModel &$model) {
98100 $ remarks = (isset ($ data ["remarks " ]) ? $ data ["remarks " ] : null );
99101 $ markdown = (isset ($ data ["markdown " ]) ? $ data ["markdown " ] : null );
100102 $ 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 );
103106 $ used_by = (isset ($ data ["used_by " ]) ? $ data ["used_by " ] : null );
104107
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 ;
111117
112118 if (!$ csrf_valid ) {
113119 $ model ->error = "INVALID_CSRF " ;
@@ -132,7 +138,9 @@ protected function handlePost(Router &$router, PacketEditModel &$model) {
132138 $ model ->packet ->setPacketFormat ($ model ->format );
133139 $ model ->packet ->setPacketRemarks ($ model ->remarks );
134140 $ 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 );
136144
137145 $ model ->packet ->setEditedCount (
138146 $ model ->packet ->getEditedCount () + 1
0 commit comments