Completed
Pull Request — master (#93)
by Janis
04:28
created
templates/settings-personal.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@
 block discarded – undo
8 8
  * @copyright Janis Koehr 2017
9 9
  */
10 10
 style('ocr', [
11
-        'ocrpersonal'
11
+		'ocrpersonal'
12 12
 ]);
13 13
 script('ocr', [
14
-        'dist/ocrpersonal'
14
+		'dist/ocrpersonal'
15 15
 ]);
16 16
 ?>
17 17
 
Please login to merge, or discard this patch.
appinfo/routes.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -8,47 +8,47 @@
 block discarded – undo
8 8
  * @copyright Janis Koehr 2017
9 9
  */
10 10
 return [
11
-        'routes' => [
12
-                [
13
-                        'name' => 'Job#process',
14
-                        'url' => '/',
15
-                        'verb' => 'POST'
16
-                ],
17
-                [
18
-                        'name' => 'Job#deleteJob',
19
-                        'url' => '/',
20
-                        'verb' => 'DELETE'
21
-                ],
22
-                [
23
-                        'name' => 'Job#getAllJobs',
24
-                        'url' => '/',
25
-                        'verb' => 'GET'
26
-                ],
27
-                [
28
-                        'name' => 'Status#getStatus',
29
-                        'url' => '/status',
30
-                        'verb' => 'GET'
31
-                ],
32
-                // settings
33
-                [
34
-                        'name' => 'AdminSettings#setLanguages',
35
-                        'url' => '/admin/languages',
36
-                        'verb' => 'POST'
37
-                ],
38
-                [
39
-                        'name' => 'AdminSettings#setRedis',
40
-                        'url' => '/admin/redis',
41
-                        'verb' => 'POST'
42
-                ],
43
-                [
44
-                        'name' => 'AdminSettings#getLanguages',
45
-                        'url' => '/languages',
46
-                        'verb' => 'GET'
47
-                ],
48
-                [
49
-                        'name' => 'AdminSettings#evaluateRedisSettings',
50
-                        'url' => '/redis',
51
-                        'verb' => 'GET'
52
-                ]
53
-        ]
11
+		'routes' => [
12
+				[
13
+						'name' => 'Job#process',
14
+						'url' => '/',
15
+						'verb' => 'POST'
16
+				],
17
+				[
18
+						'name' => 'Job#deleteJob',
19
+						'url' => '/',
20
+						'verb' => 'DELETE'
21
+				],
22
+				[
23
+						'name' => 'Job#getAllJobs',
24
+						'url' => '/',
25
+						'verb' => 'GET'
26
+				],
27
+				[
28
+						'name' => 'Status#getStatus',
29
+						'url' => '/status',
30
+						'verb' => 'GET'
31
+				],
32
+				// settings
33
+				[
34
+						'name' => 'AdminSettings#setLanguages',
35
+						'url' => '/admin/languages',
36
+						'verb' => 'POST'
37
+				],
38
+				[
39
+						'name' => 'AdminSettings#setRedis',
40
+						'url' => '/admin/redis',
41
+						'verb' => 'POST'
42
+				],
43
+				[
44
+						'name' => 'AdminSettings#getLanguages',
45
+						'url' => '/languages',
46
+						'verb' => 'GET'
47
+				],
48
+				[
49
+						'name' => 'AdminSettings#evaluateRedisSettings',
50
+						'url' => '/redis',
51
+						'verb' => 'GET'
52
+				]
53
+		]
54 54
 ];
55 55
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Db/OcrJob.php 1 patch
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -38,106 +38,106 @@
 block discarded – undo
38 38
  */
39 39
 class OcrJob extends Entity implements JsonSerializable {
40 40
 
41
-    /**
42
-     *
43
-     * @var string
44
-     */
45
-    protected $status;
41
+	/**
42
+	 *
43
+	 * @var string
44
+	 */
45
+	protected $status;
46 46
 
47
-    /**
48
-     *
49
-     * @var string
50
-     */
51
-    protected $source;
47
+	/**
48
+	 *
49
+	 * @var string
50
+	 */
51
+	protected $source;
52 52
 
53
-    /**
54
-     *
55
-     * @var string
56
-     */
57
-    protected $target;
53
+	/**
54
+	 *
55
+	 * @var string
56
+	 */
57
+	protected $target;
58 58
 
59
-    /**
60
-     *
61
-     * @var string
62
-     */
63
-    protected $tempFile;
59
+	/**
60
+	 *
61
+	 * @var string
62
+	 */
63
+	protected $tempFile;
64 64
 
65
-    /**
66
-     *
67
-     * @var string
68
-     */
69
-    protected $type;
65
+	/**
66
+	 *
67
+	 * @var string
68
+	 */
69
+	protected $type;
70 70
 
71
-    /**
72
-     *
73
-     * @var string
74
-     */
75
-    protected $userId;
71
+	/**
72
+	 *
73
+	 * @var string
74
+	 */
75
+	protected $userId;
76 76
 
77
-    /**
78
-     *
79
-     * @var boolean
80
-     */
81
-    protected $errorDisplayed;
77
+	/**
78
+	 *
79
+	 * @var boolean
80
+	 */
81
+	protected $errorDisplayed;
82 82
 
83
-    /**
84
-     *
85
-     * @var string
86
-     */
87
-    protected $originalFilename;
83
+	/**
84
+	 *
85
+	 * @var string
86
+	 */
87
+	protected $originalFilename;
88 88
 
89
-    /**
90
-     *
91
-     * @var string
92
-     */
93
-    protected $errorLog;
89
+	/**
90
+	 *
91
+	 * @var string
92
+	 */
93
+	protected $errorLog;
94 94
 
95
-    /**
96
-     * OcrJob constructor.
97
-     * 
98
-     * @param string $status            
99
-     * @param string $source            
100
-     * @param string $target            
101
-     * @param string $tempFile            
102
-     * @param string $type            
103
-     * @param string $userId            
104
-     * @param boolean $errorDisplayed            
105
-     * @param string $originalFilename            
106
-     * @param string $errorLog            
107
-     */
108
-    public function __construct($status = null, $source = null, $target = null, $tempFile = null, $type = null, $userId = null, 
109
-            $errorDisplayed = null, $originalFilename = null, $errorLog = null) {
110
-        $this->setStatus($status);
111
-        $this->setSource($source);
112
-        $this->setTarget($target);
113
-        $this->setTempFile($tempFile);
114
-        $this->setType($type);
115
-        $this->setUserId($userId);
116
-        $this->setErrorDisplayed($errorDisplayed);
117
-        $this->setOriginalFilename($originalFilename);
118
-        $this->setErrorLog($errorLog);
119
-    }
95
+	/**
96
+	 * OcrJob constructor.
97
+	 * 
98
+	 * @param string $status            
99
+	 * @param string $source            
100
+	 * @param string $target            
101
+	 * @param string $tempFile            
102
+	 * @param string $type            
103
+	 * @param string $userId            
104
+	 * @param boolean $errorDisplayed            
105
+	 * @param string $originalFilename            
106
+	 * @param string $errorLog            
107
+	 */
108
+	public function __construct($status = null, $source = null, $target = null, $tempFile = null, $type = null, $userId = null, 
109
+			$errorDisplayed = null, $originalFilename = null, $errorLog = null) {
110
+		$this->setStatus($status);
111
+		$this->setSource($source);
112
+		$this->setTarget($target);
113
+		$this->setTempFile($tempFile);
114
+		$this->setType($type);
115
+		$this->setUserId($userId);
116
+		$this->setErrorDisplayed($errorDisplayed);
117
+		$this->setOriginalFilename($originalFilename);
118
+		$this->setErrorLog($errorLog);
119
+	}
120 120
 
121
-    /**
122
-     * Specify data which should be serialized to JSON
123
-     * 
124
-     * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
125
-     * @return mixed data which can be serialized by <b>json_encode</b>,
126
-     *         which is a value of any type other than a resource.
127
-     * @since 5.4.0
128
-     */
129
-    function jsonSerialize() {
130
-        return [
131
-                'id' => $this->id,
132
-                'status' => $this->status,
133
-                'source' => $this->source,
134
-                'target' => $this->target,
135
-                'tempFile' => $this->tempFile,
136
-                'type' => $this->type,
137
-                'userId' => $this->userId,
138
-                'errorDisplayed' => $this->errorDisplayed,
139
-                'originalFilename' => $this->originalFilename,
140
-                'errorLog' => $this->errorLog
141
-        ];
142
-    }
121
+	/**
122
+	 * Specify data which should be serialized to JSON
123
+	 * 
124
+	 * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
125
+	 * @return mixed data which can be serialized by <b>json_encode</b>,
126
+	 *         which is a value of any type other than a resource.
127
+	 * @since 5.4.0
128
+	 */
129
+	function jsonSerialize() {
130
+		return [
131
+				'id' => $this->id,
132
+				'status' => $this->status,
133
+				'source' => $this->source,
134
+				'target' => $this->target,
135
+				'tempFile' => $this->tempFile,
136
+				'type' => $this->type,
137
+				'userId' => $this->userId,
138
+				'errorDisplayed' => $this->errorDisplayed,
139
+				'originalFilename' => $this->originalFilename,
140
+				'errorLog' => $this->errorLog
141
+		];
142
+	}
143 143
 }
144 144
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Db/Share.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@
 block discarded – undo
21 21
  */
22 22
 class Share extends Entity {
23 23
 
24
-    /**
25
-     *
26
-     * @var string
27
-     */
28
-    protected $fileTarget;
24
+	/**
25
+	 *
26
+	 * @var string
27
+	 */
28
+	protected $fileTarget;
29 29
 
30
-    /**
31
-     * Share constructor.
32
-     * 
33
-     * @param null $fileTarget            
34
-     */
35
-    public function __construct($fileTarget = null) {
36
-        $this->fileTarget = $fileTarget;
37
-    }
30
+	/**
31
+	 * Share constructor.
32
+	 * 
33
+	 * @param null $fileTarget            
34
+	 */
35
+	public function __construct($fileTarget = null) {
36
+		$this->fileTarget = $fileTarget;
37
+	}
38 38
 }
39 39
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Db/ShareMapper.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,29 +21,29 @@
 block discarded – undo
21 21
  */
22 22
 class ShareMapper extends Mapper {
23 23
 
24
-    /**
25
-     * ShareMapper constructor.
26
-     * 
27
-     * @param IDBConnection $db            
28
-     */
29
-    public function __construct(IDBConnection $db) {
30
-        parent::__construct($db, 'share', 'OCA\Ocr\Db\Share');
31
-    }
24
+	/**
25
+	 * ShareMapper constructor.
26
+	 * 
27
+	 * @param IDBConnection $db            
28
+	 */
29
+	public function __construct(IDBConnection $db) {
30
+		parent::__construct($db, 'share', 'OCA\Ocr\Db\Share');
31
+	}
32 32
 
33
-    /**
34
-     * Find the right name for a shared file
35
-     * 
36
-     * @param integer $fileid            
37
-     * @param string $shareWith            
38
-     * @param string $owner            
39
-     * @return Share
40
-     */
41
-    public function find($fileid, $shareWith, $owner) {
42
-        $sql = 'SELECT file_target FROM *PREFIX*share WHERE file_source = ? AND share_with = ? AND uid_owner = ?';
43
-        return $this->findEntity($sql, [
44
-                $fileid,
45
-                $shareWith,
46
-                $owner
47
-        ]);
48
-    }
33
+	/**
34
+	 * Find the right name for a shared file
35
+	 * 
36
+	 * @param integer $fileid            
37
+	 * @param string $shareWith            
38
+	 * @param string $owner            
39
+	 * @return Share
40
+	 */
41
+	public function find($fileid, $shareWith, $owner) {
42
+		$sql = 'SELECT file_target FROM *PREFIX*share WHERE file_source = ? AND share_with = ? AND uid_owner = ?';
43
+		return $this->findEntity($sql, [
44
+				$fileid,
45
+				$shareWith,
46
+				$owner
47
+		]);
48
+	}
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Db/OcrJobMapper.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -22,86 +22,86 @@
 block discarded – undo
22 22
  */
23 23
 class OcrJobMapper extends Mapper {
24 24
 
25
-    /**
26
-     * OcrJobMapper constructor.
27
-     * 
28
-     * @param IDBConnection $db            
29
-     */
30
-    public function __construct(IDBConnection $db) {
31
-        parent::__construct($db, 'ocr_jobs', 'OCA\Ocr\Db\OcrJob');
32
-    }
25
+	/**
26
+	 * OcrJobMapper constructor.
27
+	 * 
28
+	 * @param IDBConnection $db            
29
+	 */
30
+	public function __construct(IDBConnection $db) {
31
+		parent::__construct($db, 'ocr_jobs', 'OCA\Ocr\Db\OcrJob');
32
+	}
33 33
 
34
-    /**
35
-     * Find a specific job entity
36
-     * 
37
-     * @param
38
-     *            $id
39
-     * @return OcrJob
40
-     */
41
-    public function find($id) {
42
-        $sql = 'SELECT * FROM *PREFIX*ocr_jobs WHERE id = ?';
43
-        return $this->findEntity($sql, [
44
-                $id
45
-        ]);
46
-    }
34
+	/**
35
+	 * Find a specific job entity
36
+	 * 
37
+	 * @param
38
+	 *            $id
39
+	 * @return OcrJob
40
+	 */
41
+	public function find($id) {
42
+		$sql = 'SELECT * FROM *PREFIX*ocr_jobs WHERE id = ?';
43
+		return $this->findEntity($sql, [
44
+				$id
45
+		]);
46
+	}
47 47
 
48
-    /**
49
-     * Finds all user specific jobs entities
50
-     * 
51
-     * @param
52
-     *            $userId
53
-     * @return OcrJob[]
54
-     */
55
-    public function findAll($userId) {
56
-        $sql = 'SELECT * FROM *PREFIX*ocr_jobs WHERE user_id = ?';
57
-        return $this->findEntities($sql, [
58
-                $userId
59
-        ]);
60
-    }
48
+	/**
49
+	 * Finds all user specific jobs entities
50
+	 * 
51
+	 * @param
52
+	 *            $userId
53
+	 * @return OcrJob[]
54
+	 */
55
+	public function findAll($userId) {
56
+		$sql = 'SELECT * FROM *PREFIX*ocr_jobs WHERE user_id = ?';
57
+		return $this->findEntities($sql, [
58
+				$userId
59
+		]);
60
+	}
61 61
 
62
-    /**
63
-     * Finds all jobs PROCESSED entities for a given userid
64
-     * 
65
-     * @param
66
-     *            $userId
67
-     * @return OcrJob[]
68
-     */
69
-    public function findAllProcessed($userId) {
70
-        $sql = 'SELECT * FROM *PREFIX*ocr_jobs WHERE user_id = ? AND status = ?';
71
-        return $this->findEntities($sql, [
72
-                $userId,
73
-                OcrConstants::STATUS_PROCESSED
74
-        ]);
75
-    }
62
+	/**
63
+	 * Finds all jobs PROCESSED entities for a given userid
64
+	 * 
65
+	 * @param
66
+	 *            $userId
67
+	 * @return OcrJob[]
68
+	 */
69
+	public function findAllProcessed($userId) {
70
+		$sql = 'SELECT * FROM *PREFIX*ocr_jobs WHERE user_id = ? AND status = ?';
71
+		return $this->findEntities($sql, [
72
+				$userId,
73
+				OcrConstants::STATUS_PROCESSED
74
+		]);
75
+	}
76 76
 
77
-    /**
78
-     * Finds all jobs PENDING entities for a given userid.
79
-     * 
80
-     * @param
81
-     *            $userId
82
-     * @return OcrJob[]
83
-     */
84
-    public function findAllPending($userId) {
85
-        $sql = 'SELECT * FROM *PREFIX*ocr_jobs WHERE user_id = ? AND status = ?';
86
-        return $this->findEntities($sql, [
87
-                $userId,
88
-                OcrConstants::STATUS_PENDING
89
-        ]);
90
-    }
77
+	/**
78
+	 * Finds all jobs PENDING entities for a given userid.
79
+	 * 
80
+	 * @param
81
+	 *            $userId
82
+	 * @return OcrJob[]
83
+	 */
84
+	public function findAllPending($userId) {
85
+		$sql = 'SELECT * FROM *PREFIX*ocr_jobs WHERE user_id = ? AND status = ?';
86
+		return $this->findEntities($sql, [
87
+				$userId,
88
+				OcrConstants::STATUS_PENDING
89
+		]);
90
+	}
91 91
 
92
-    /**
93
-     * Finds all jobs FAILED entities for a given userid, which were not displayed yet.
94
-     * 
95
-     * @param
96
-     *            $userId
97
-     * @return OcrJob[]
98
-     */
99
-    public function findAllFailed($userId) {
100
-        $sql = 'SELECT * FROM *PREFIX*ocr_jobs WHERE user_id = ? AND status = ? AND error_displayed = ?';
101
-        return $this->findEntities($sql, [
102
-                $userId,
103
-                OcrConstants::STATUS_FAILED,
104
-                false
105
-        ]);
106
-    }
92
+	/**
93
+	 * Finds all jobs FAILED entities for a given userid, which were not displayed yet.
94
+	 * 
95
+	 * @param
96
+	 *            $userId
97
+	 * @return OcrJob[]
98
+	 */
99
+	public function findAllFailed($userId) {
100
+		$sql = 'SELECT * FROM *PREFIX*ocr_jobs WHERE user_id = ? AND status = ? AND error_displayed = ?';
101
+		return $this->findEntities($sql, [
102
+				$userId,
103
+				OcrConstants::STATUS_FAILED,
104
+				false
105
+		]);
106
+	}
107 107
 }
108 108
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Db/FileMapper.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -21,28 +21,28 @@
 block discarded – undo
21 21
  */
22 22
 class FileMapper extends Mapper {
23 23
 
24
-    /**
25
-     * FileMapper constructor.
26
-     * ATTENTION: the common methods like 'delete' 'update' and things like that will not work because we join and
27
-     * cleanup some columns!!!
28
-     * 
29
-     * @param IDBConnection $db            
30
-     */
31
-    public function __construct(IDBConnection $db) {
32
-        parent::__construct($db, 'filecache', 'OCA\Ocr\Db\File');
33
-    }
24
+	/**
25
+	 * FileMapper constructor.
26
+	 * ATTENTION: the common methods like 'delete' 'update' and things like that will not work because we join and
27
+	 * cleanup some columns!!!
28
+	 * 
29
+	 * @param IDBConnection $db            
30
+	 */
31
+	public function __construct(IDBConnection $db) {
32
+		parent::__construct($db, 'filecache', 'OCA\Ocr\Db\File');
33
+	}
34 34
 
35
-    /**
36
-     * Find a specific file entity
37
-     * 
38
-     * @param
39
-     *            $fileid
40
-     * @return File
41
-     */
42
-    public function find($fileid) {
43
-        $sql = 'SELECT f.fileid AS fileid, f.path AS path, f.name as name, m.mimetype AS mimetype, s.id AS storagename FROM *PREFIX*filecache AS f, *PREFIX*mimetypes AS m, *PREFIX*storages AS s WHERE f.fileid = ? AND f.mimetype = m.id AND f.storage = s.numeric_id';
44
-        return $this->findEntity($sql, [
45
-                $fileid
46
-        ]);
47
-    }
35
+	/**
36
+	 * Find a specific file entity
37
+	 * 
38
+	 * @param
39
+	 *            $fileid
40
+	 * @return File
41
+	 */
42
+	public function find($fileid) {
43
+		$sql = 'SELECT f.fileid AS fileid, f.path AS path, f.name as name, m.mimetype AS mimetype, s.id AS storagename FROM *PREFIX*filecache AS f, *PREFIX*mimetypes AS m, *PREFIX*storages AS s WHERE f.fileid = ? AND f.mimetype = m.id AND f.storage = s.numeric_id';
44
+		return $this->findEntity($sql, [
45
+				$fileid
46
+		]);
47
+	}
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Db/File.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -25,50 +25,50 @@
 block discarded – undo
25 25
  */
26 26
 class File extends Entity {
27 27
 
28
-    /**
29
-     *
30
-     * @var integer
31
-     */
32
-    protected $fileid;
28
+	/**
29
+	 *
30
+	 * @var integer
31
+	 */
32
+	protected $fileid;
33 33
 
34
-    /**
35
-     *
36
-     * @var string
37
-     */
38
-    protected $path;
34
+	/**
35
+	 *
36
+	 * @var string
37
+	 */
38
+	protected $path;
39 39
 
40
-    /**
41
-     *
42
-     * @var string
43
-     */
44
-    protected $name;
40
+	/**
41
+	 *
42
+	 * @var string
43
+	 */
44
+	protected $name;
45 45
 
46
-    /**
47
-     *
48
-     * @var string
49
-     */
50
-    protected $mimetype;
46
+	/**
47
+	 *
48
+	 * @var string
49
+	 */
50
+	protected $mimetype;
51 51
 
52
-    /**
53
-     *
54
-     * @var string
55
-     */
56
-    protected $storagename;
52
+	/**
53
+	 *
54
+	 * @var string
55
+	 */
56
+	protected $storagename;
57 57
 
58
-    /**
59
-     * File constructor.
60
-     * 
61
-     * @param null $fileid            
62
-     * @param null $path            
63
-     * @param null $name            
64
-     * @param null $mimetype            
65
-     * @param null $storagename            
66
-     */
67
-    public function __construct($fileid = null, $path = null, $name = null, $mimetype = null, $storagename = null) {
68
-        $this->fileid = $fileid;
69
-        $this->path = $path;
70
-        $this->name = $name;
71
-        $this->mimetype = $mimetype;
72
-        $this->storagename = $storagename;
73
-    }
58
+	/**
59
+	 * File constructor.
60
+	 * 
61
+	 * @param null $fileid            
62
+	 * @param null $path            
63
+	 * @param null $name            
64
+	 * @param null $mimetype            
65
+	 * @param null $storagename            
66
+	 */
67
+	public function __construct($fileid = null, $path = null, $name = null, $mimetype = null, $storagename = null) {
68
+		$this->fileid = $fileid;
69
+		$this->path = $path;
70
+		$this->name = $name;
71
+		$this->mimetype = $mimetype;
72
+		$this->storagename = $storagename;
73
+	}
74 74
 }
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
lib/AppInfo/Application.php 1 patch
Indentation   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -35,159 +35,159 @@
 block discarded – undo
35 35
  */
36 36
 class Application extends App {
37 37
 
38
-    /**
39
-     * Application constructor.
40
-     * 
41
-     * @param array $urlParams            
42
-     */
43
-    public function __construct(array $urlParams = array()) {
44
-        parent::__construct('ocr', $urlParams);
45
-        $container = $this->getContainer();
46
-        /**
47
-         * Add the js and style if OCA\Files app is loaded
48
-         */
49
-        $eventDispatcher = \OC::$server->getEventDispatcher();
50
-        $eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', 
51
-                function () {
52
-                    script('ocr', 'dist/ocrapp');
53
-                    style('ocr', 'ocrstyle');
54
-                    // if not loaded before - load select2 for multi select languages
55
-                    vendor_script('select2/select2');
56
-                    vendor_style('select2/select2');
57
-                });
58
-        /**
59
-         * Register core services
60
-         */
61
-        $container->registerService('CurrentUID', 
62
-                function (IContainer $c) {
63
-                    /** @var \OC\Server $server */
64
-                    $server = $c->query('ServerContainer');
65
-                    $user = $server->getUserSession()
66
-                        ->getUser();
67
-                    return ($user) ? $user->getUID() : '';
68
-                });
69
-        // Allow automatic DI for the View, until they migrated to Nodes API
70
-        $container->registerService(View::class, function () {
71
-            return new View('');
72
-        }, false);
73
-        /**
74
-         * Register the PHPUtil
75
-         */
76
-        $container->registerService('PHPUtil', 
77
-                function (IContainer $c) {
78
-                    /** @var \OC\Server $server */
79
-                    $server = $c->query('ServerContainer');
80
-                    return new PHPUtil($server->getL10N('ocr'), $server->getLogger());
81
-                });
82
-        /**
83
-         * Register the Ocr Job mapper
84
-         */
85
-        $container->registerService('OcrJobMapper', 
86
-                function (IContainer $c) {
87
-                    /** @var \OC\Server $server */
88
-                    $server = $c->query('ServerContainer');
89
-                    return new OcrJobMapper($server->getDatabaseConnection());
90
-                });
91
-        /**
92
-         * Register the File mapper
93
-         */
94
-        $container->registerService('FileMapper', 
95
-                function (IContainer $c) {
96
-                    /** @var \OC\Server $server */
97
-                    $server = $c->query('ServerContainer');
98
-                    return new FileMapper($server->getDatabaseConnection());
99
-                });
100
-        /**
101
-         * Register the Share mapper
102
-         */
103
-        $container->registerService('ShareMapper', 
104
-                function (IContainer $c) {
105
-                    /** @var \OC\Server $server */
106
-                    $server = $c->query('ServerContainer');
107
-                    return new ShareMapper($server->getDatabaseConnection());
108
-                });
109
-        /**
110
-         * Register the App Config Service
111
-         */
112
-        $container->registerService('AppConfigService', 
113
-                function (IAppContainer $c) {
114
-                    /** @var \OC\Server $server */
115
-                    $server = $c->query('ServerContainer');
116
-                    return new AppConfigService($server->getConfig(), $server->getL10N('ocr'));
117
-                });
118
-        /**
119
-         * Register the Job Service
120
-         */
121
-        $container->registerService('FileService', 
122
-                function (IAppContainer $c) {
123
-                    /** @var \OC\Server $server */
124
-                    $server = $c->query('ServerContainer');
125
-                    return new FileService($server->getL10N('ocr'), $server->getLogger(), $c->query('CurrentUID'), 
126
-                            $c->query('FileMapper'), $c->query('ShareMapper'));
127
-                });
128
-        /**
129
-         * Register the Redis Service
130
-         */
131
-        $container->registerService('RedisService', 
132
-                function (IAppContainer $c) {
133
-                    /** @var \OC\Server $server */
134
-                    $server = $c->query('ServerContainer');
135
-                    return new RedisService($c->query('OcrJobMapper'), $c->query('FileService'), $server->getConfig(), 
136
-                            $server->getL10N('ocr'), $server->getLogger());
137
-                });
138
-        /**
139
-         * Register the Job Service
140
-         */
141
-        $container->registerService('JobService', 
142
-                function (IAppContainer $c) {
143
-                    /** @var \OC\Server $server */
144
-                    $server = $c->query('ServerContainer');
145
-                    return new JobService($server->getL10N('ocr'), $server->getLogger(), $c->query('CurrentUID'), 
146
-                            new View('/' . $c->query('CurrentUID') . '/files'), $server->getTempManager(), 
147
-                            $c->query('RedisService'), $c->query('OcrJobMapper'), $c->query('FileService'), 
148
-                            $c->query('AppConfigService'), $c->query('PHPUtil'));
149
-                });
150
-        /**
151
-         * Register the Status Service
152
-         */
153
-        $container->registerService('StatusService', 
154
-                function (IAppContainer $c) {
155
-                    /** @var \OC\Server $server */
156
-                    $server = $c->query('ServerContainer');
157
-                    return new StatusService($server->getL10N('ocr'), $server->getLogger(), $c->query('CurrentUID'), 
158
-                            $c->query('OcrJobMapper'), $c->query('JobService'));
159
-                });
160
-        /**
161
-         * Controller
162
-         */
163
-        $container->registerService('StatusController', 
164
-                function (IAppContainer $c) {
165
-                    /** @var \OC\Server $server */
166
-                    $server = $c->query('ServerContainer');
167
-                    return new StatusController($c->getAppName(), $server->getRequest(), $c->query('StatusService'));
168
-                });
169
-        /**
170
-         * Controller
171
-         */
172
-        $container->registerService('JobController', 
173
-                function (IAppContainer $c) {
174
-                    /** @var \OC\Server $server */
175
-                    $server = $c->query('ServerContainer');
176
-                    return new JobController($c->getAppName(), $server->getRequest(), $c->query('JobService'), 
177
-                            $c->query('CurrentUID'));
178
-                });
179
-        /**
180
-         * Controller
181
-         */
182
-        $container->registerAlias('PersonalSettingsController', PersonalSettingsController::class);
183
-    }
38
+	/**
39
+	 * Application constructor.
40
+	 * 
41
+	 * @param array $urlParams            
42
+	 */
43
+	public function __construct(array $urlParams = array()) {
44
+		parent::__construct('ocr', $urlParams);
45
+		$container = $this->getContainer();
46
+		/**
47
+		 * Add the js and style if OCA\Files app is loaded
48
+		 */
49
+		$eventDispatcher = \OC::$server->getEventDispatcher();
50
+		$eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', 
51
+				function () {
52
+					script('ocr', 'dist/ocrapp');
53
+					style('ocr', 'ocrstyle');
54
+					// if not loaded before - load select2 for multi select languages
55
+					vendor_script('select2/select2');
56
+					vendor_style('select2/select2');
57
+				});
58
+		/**
59
+		 * Register core services
60
+		 */
61
+		$container->registerService('CurrentUID', 
62
+				function (IContainer $c) {
63
+					/** @var \OC\Server $server */
64
+					$server = $c->query('ServerContainer');
65
+					$user = $server->getUserSession()
66
+						->getUser();
67
+					return ($user) ? $user->getUID() : '';
68
+				});
69
+		// Allow automatic DI for the View, until they migrated to Nodes API
70
+		$container->registerService(View::class, function () {
71
+			return new View('');
72
+		}, false);
73
+		/**
74
+		 * Register the PHPUtil
75
+		 */
76
+		$container->registerService('PHPUtil', 
77
+				function (IContainer $c) {
78
+					/** @var \OC\Server $server */
79
+					$server = $c->query('ServerContainer');
80
+					return new PHPUtil($server->getL10N('ocr'), $server->getLogger());
81
+				});
82
+		/**
83
+		 * Register the Ocr Job mapper
84
+		 */
85
+		$container->registerService('OcrJobMapper', 
86
+				function (IContainer $c) {
87
+					/** @var \OC\Server $server */
88
+					$server = $c->query('ServerContainer');
89
+					return new OcrJobMapper($server->getDatabaseConnection());
90
+				});
91
+		/**
92
+		 * Register the File mapper
93
+		 */
94
+		$container->registerService('FileMapper', 
95
+				function (IContainer $c) {
96
+					/** @var \OC\Server $server */
97
+					$server = $c->query('ServerContainer');
98
+					return new FileMapper($server->getDatabaseConnection());
99
+				});
100
+		/**
101
+		 * Register the Share mapper
102
+		 */
103
+		$container->registerService('ShareMapper', 
104
+				function (IContainer $c) {
105
+					/** @var \OC\Server $server */
106
+					$server = $c->query('ServerContainer');
107
+					return new ShareMapper($server->getDatabaseConnection());
108
+				});
109
+		/**
110
+		 * Register the App Config Service
111
+		 */
112
+		$container->registerService('AppConfigService', 
113
+				function (IAppContainer $c) {
114
+					/** @var \OC\Server $server */
115
+					$server = $c->query('ServerContainer');
116
+					return new AppConfigService($server->getConfig(), $server->getL10N('ocr'));
117
+				});
118
+		/**
119
+		 * Register the Job Service
120
+		 */
121
+		$container->registerService('FileService', 
122
+				function (IAppContainer $c) {
123
+					/** @var \OC\Server $server */
124
+					$server = $c->query('ServerContainer');
125
+					return new FileService($server->getL10N('ocr'), $server->getLogger(), $c->query('CurrentUID'), 
126
+							$c->query('FileMapper'), $c->query('ShareMapper'));
127
+				});
128
+		/**
129
+		 * Register the Redis Service
130
+		 */
131
+		$container->registerService('RedisService', 
132
+				function (IAppContainer $c) {
133
+					/** @var \OC\Server $server */
134
+					$server = $c->query('ServerContainer');
135
+					return new RedisService($c->query('OcrJobMapper'), $c->query('FileService'), $server->getConfig(), 
136
+							$server->getL10N('ocr'), $server->getLogger());
137
+				});
138
+		/**
139
+		 * Register the Job Service
140
+		 */
141
+		$container->registerService('JobService', 
142
+				function (IAppContainer $c) {
143
+					/** @var \OC\Server $server */
144
+					$server = $c->query('ServerContainer');
145
+					return new JobService($server->getL10N('ocr'), $server->getLogger(), $c->query('CurrentUID'), 
146
+							new View('/' . $c->query('CurrentUID') . '/files'), $server->getTempManager(), 
147
+							$c->query('RedisService'), $c->query('OcrJobMapper'), $c->query('FileService'), 
148
+							$c->query('AppConfigService'), $c->query('PHPUtil'));
149
+				});
150
+		/**
151
+		 * Register the Status Service
152
+		 */
153
+		$container->registerService('StatusService', 
154
+				function (IAppContainer $c) {
155
+					/** @var \OC\Server $server */
156
+					$server = $c->query('ServerContainer');
157
+					return new StatusService($server->getL10N('ocr'), $server->getLogger(), $c->query('CurrentUID'), 
158
+							$c->query('OcrJobMapper'), $c->query('JobService'));
159
+				});
160
+		/**
161
+		 * Controller
162
+		 */
163
+		$container->registerService('StatusController', 
164
+				function (IAppContainer $c) {
165
+					/** @var \OC\Server $server */
166
+					$server = $c->query('ServerContainer');
167
+					return new StatusController($c->getAppName(), $server->getRequest(), $c->query('StatusService'));
168
+				});
169
+		/**
170
+		 * Controller
171
+		 */
172
+		$container->registerService('JobController', 
173
+				function (IAppContainer $c) {
174
+					/** @var \OC\Server $server */
175
+					$server = $c->query('ServerContainer');
176
+					return new JobController($c->getAppName(), $server->getRequest(), $c->query('JobService'), 
177
+							$c->query('CurrentUID'));
178
+				});
179
+		/**
180
+		 * Controller
181
+		 */
182
+		$container->registerAlias('PersonalSettingsController', PersonalSettingsController::class);
183
+	}
184 184
 
185
-    /**
186
-     * Registers the Personal Settings Page for deletion of status objects and such things.
187
-     * @codeCoverageIgnore
188
-     */
189
-    public function registerPersonal() {
190
-        \OCP\App::registerPersonal($this->getContainer()
191
-            ->getAppName(), 'personal');
192
-    }
185
+	/**
186
+	 * Registers the Personal Settings Page for deletion of status objects and such things.
187
+	 * @codeCoverageIgnore
188
+	 */
189
+	public function registerPersonal() {
190
+		\OCP\App::registerPersonal($this->getContainer()
191
+			->getAppName(), 'personal');
192
+	}
193 193
 }
Please login to merge, or discard this patch.