@@ -109,6 +109,7 @@ public function executeCommand(): void
109109
110110 $ next_class = $ ctrl ->getNextClass ($ this );
111111 $ cmd = $ ctrl ->getCmd ();
112+ $ this ->showMigrationState ();
112113 switch ($ next_class ) {
113114 default :
114115 if (in_array ($ cmd , [
@@ -118,12 +119,38 @@ public function executeCommand(): void
118119 "pasteCharacteristicsWithinStyle " , "pasteCharacteristicsFromOtherStyle " ,
119120 "saveStatus " , "setOutdated " , "removeOutdated " ,
120121 "editTagStyle " , "refreshTagStyle " , "updateTagStyle " ,
121- "editTagTitles " , "saveTagTitles " , "switchMQuery " ])) {
122+ "editTagTitles " , "saveTagTitles " , "switchMQuery " , " migrateImages " ])) {
122123 $ this ->$ cmd ();
123124 }
124125 }
125126 }
126127
128+ public function showMigrationState (): void
129+ {
130+ $ mt = $ this ->gui_service ->mainTemplate ();
131+ $ lng = $ this ->domain_service ->lng ();
132+ $ style_id = $ this ->object ->getId ();
133+ $ f = $ this ->gui_service ->ui ()->factory ();
134+ $ toolbar = $ this ->gui_service ->toolbar ();
135+ $ ctrl = $ this ->gui_service ->ctrl ();
136+ if (!$ this ->domain_service ->style ($ style_id )->isMigrated ()) {
137+ $ mt ->setOnScreenMessage ('info ' , $ lng ->txt ('sty_style_not_migrated ' ));
138+ } else {
139+ if ($ this ->domain_service ->image (
140+ $ style_id ,
141+ $ this ->access_manager
142+ )->hasLegacyDirAndNoImages ()) {
143+ $ mt ->setOnScreenMessage ('info ' , $ lng ->txt ('sty_legacy_image_directory_found ' ));
144+ $ toolbar ->addComponent (
145+ $ f ->button ()->standard (
146+ $ lng ->txt ('sty_migrate_images ' ),
147+ $ ctrl ->getLinkTarget ($ this , "migrateImages " )
148+ )
149+ );
150+ }
151+ }
152+ }
153+
127154 public function listCharacteristics (): void
128155 {
129156 $ lng = $ this ->domain_service ->lng ();
@@ -1338,4 +1365,11 @@ public function switchMQuery(): void
13381365 $ ctrl ->redirectByClass ("ilstylecharacteristicgui " , "editTagStyle " );
13391366 }
13401367
1368+ protected function migrateImages (): void
1369+ {
1370+ $ this ->domain_service ->style ($ this ->object ->getId ())->migrateImages ();
1371+ $ ctrl = $ this ->gui_service ->ctrl ();
1372+ $ ctrl ->redirectByClass (self ::class, "listCharacteristics " );
1373+ }
1374+
13411375}
0 commit comments