99use TechDivision \DocViewer \File \Parser ;
1010use TechDivision \DocViewer \File \Tree ;
1111
12+ use TechDivision \DocViewer \Util ;
1213use TYPO3 \Flow \Annotations as Flow ;
1314use TYPO3 \Neos \Controller \Module \AbstractModuleController ;
1415
@@ -38,11 +39,23 @@ class ModuleController extends AbstractModuleController
3839 */
3940 protected $ accessManager ;
4041
41- /**
42- * @return void
43- */
44- public function indexAction ()
45- {
42+ /**
43+ * Routes to list or show action depending on configuration
44+ * @return void
45+ */
46+ public function indexAction () {
47+ if (isset ($ this ->packagesConfiguration ['entryPackage ' ]) && $ this ->accessManager ->isPackageAccessable ($ this ->packagesConfiguration ['entryPackage ' ])) {
48+ $ this ->forward ('show ' , null , null , array ('package ' => $ this ->packagesConfiguration ['entryPackage ' ]));
49+ } else {
50+ $ this ->forward ('list ' );
51+ }
52+ }
53+
54+ /**
55+ * Lists packages with documentation depending on configuration
56+ * @return void
57+ */
58+ public function listAction () {
4659
4760 $ packageGroups = array ();
4861
@@ -63,7 +76,7 @@ public function indexAction()
6376 continue ;
6477 }
6578
66- $ tree = new Tree ($ packageGroup , $ package-> getPackageKey () , $ this ->controllerContext ->getRequest ()->getHttpRequest ()->getBaseUri ());
79+ $ tree = new Tree ($ package , $ this ->controllerContext ->getRequest ()->getHttpRequest ()->getBaseUri ());
6780
6881 if (!$ tree ->isDirectoryWithContent ()) {
6982 continue ;
@@ -74,37 +87,31 @@ public function indexAction()
7487 'version ' => $ package ->getInstalledVersion (),
7588 'name ' => $ package ->getComposerManifest ('name ' ),
7689 'type ' => $ package ->getComposerManifest ('type ' ),
77- 'description ' => $ package ->getPackageMetaData ()->getDescription (),
78- 'metaData ' => $ package ->getPackageMetaData (),
79- 'isActive ' => $ this ->packageManager ->isPackageActive ($ package ->getPackageKey ()),
80- 'isFrozen ' => $ this ->packageManager ->isPackageFrozen ($ package ->getPackageKey ()),
81- 'isProtected ' => $ package ->isProtected (),
82- 'hasDoc ' => $ tree ->isDirectoryWithContent ()
90+ 'description ' => $ package ->getPackageMetaData ()->getDescription ()
8391 );
8492
8593 }
8694
8795 $ this ->view ->assign ('packageGroups ' , $ packageGroups );
88-
8996 }
9097
9198 /**
92- * @param string $packageKey
93- * @param string $packageType
99+ * Shows documentation of given package
100+ * @param string $package
94101 * @param string $filePath
102+ * @throws PackageNotAccessableException
103+ * @return void
95104 */
96- public function showAction ($ packageKey , $ packageType , $ filePath = null ) {
97-
105+ public function showAction ($ package , $ filePath = null ) {
98106 $ baseUri = $ this ->controllerContext ->getRequest ()->getHttpRequest ()->getBaseUri ();
99107
100- if (!$ this ->accessManager ->isPackageAccessable ($ packageKey )) {
101- throw new PackageNotAccessableException ("You are not allowed to access the package " . $ packageKey );
108+ if (!$ this ->accessManager ->isPackageAccessable ($ package )) {
109+ throw new PackageNotAccessableException ("You are not allowed to access the package " . $ package );
102110 }
111+ $ package = $ this ->packageManager ->getPackage ($ package );
112+ $ this ->view ->assign ('packageKey ' , $ package ->getPackageKey ());
103113
104- $ this ->view ->assign ('packageKey ' , $ packageKey );
105- $ this ->view ->assign ('packageType ' , $ packageType );
106-
107- $ tree = new Tree ($ packageType , $ packageKey , $ baseUri );
114+ $ tree = new Tree ($ package , $ baseUri );
108115
109116 if (!$ tree ->isDirectoryWithContent ()) {
110117 $ this ->addFlashMessage ('No documention could be found ' );
0 commit comments