Docs guide has been fixed.

This commit is contained in:
baleks 2019-02-06 17:36:28 +02:00
parent 8164e68649
commit 52279a7e31
23 changed files with 105 additions and 97 deletions

View File

@ -44,7 +44,7 @@ Supervisor is a process monitoring tool for Linux. It automatically starts, moni
Example configuration (e.g. /etc/supervisor/conf.d/humhub.conf):
```conf
```
[program:humhub-workers]
process_name=%(program_name)s_%(process_num)02d
command=/usr/bin/php <INSERT HUMHUB PATH HERE>/protected/yii queue/listen --verbose=1 --color=0
@ -151,4 +151,4 @@ To enable this driver you need to add following block to your local configuratio
### Sync and Instant Queue
The [[humhub\components\queue\driver\Sync]] and [[humhub\components\queue\driver\Instant]] queues are used in test and development environments without cron jobs.
The [[humhub\modules\queue\driver\Sync]] and [[humhub\modules\queue\driver\Instant]] queues are used in test and development environments without cron jobs.

View File

@ -33,14 +33,13 @@ public static function onConsoleApplicationInit($event) {
$application = $event->sender;
$application->controllerMap['translation'] = commands\TranslationController::className();
}
```
## Integrity Checker
The integrity checker is a command which validates and if necessary repairs the application database.
If you want to add own checking methods for your module to it, you can intercept the [[humhub\controllers\IntegrityController::EVENT_ON_RUN]] event.
If you want to add own checking methods for your module to it, you can intercept the [[humhub\commands\IntegrityController::EVENT_ON_RUN]] event.
Example callback implementation:

View File

@ -267,7 +267,7 @@ class Example extends ContentContainerActiveRecord
}
```
>Info: For more information about permissions, please see the [Permission Section](module-permissions.md).
> Info: For more information about permissions, please see the [Permission Section](module-permissions.md).
### Other content features
@ -400,7 +400,7 @@ TBD
- Always linked to particual Content, inherits access rules from it
- Examples: Like, File, Comment
- Can be nested (e.g. Container -> Content -> Addon (Comment) -> Addon (Like)
- Can be nested (e.g. `Container -> Content -> Addon (Comment) -> Addon (Like)`)
## Content Streams

View File

@ -59,7 +59,7 @@ if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->sa
```
### Read Files
To read mapped files of an ActiveRecord, use the [humhub\modules\file\components\FileManager]] via [[humhub\components\ActiveRecords::getFileManager]].
To read mapped files of an ActiveRecord, use the [[humhub\modules\file\components\FileManager]] via [[humhub\components\ActiveRecord::getFileManager]].
```php
@ -82,13 +82,15 @@ Converters are used to create variants (e.g. different file formats or images si
All converted files (variants) will be automatically stored with the original file.
Example usage:
```php
$file = \humhub\modules\file\models\File::findOne(['guid' => 'your file guid']);
$previewImage = new \humhub\modules\file\converter\PreviewImage();
if ($previewImage->applyFile($file)) {
// Can create preview of given file
echo $previewImage->getUrl();
// Can create preview of given file
echo $previewImage->getUrl();
}
```

View File

@ -25,4 +25,6 @@ Base Category Naming Examples:
Example message creation command for module with id *example*:
> php yii message/extract-module *example*
```
php yii message/extract-module *example*
```

View File

@ -8,7 +8,7 @@ The action handler uses the `client` module for calling an url defined by `data-
###### View:
```php
```html
<button data-action-click="example.myAction" data-action-url="<?= $myActionUrl ?>">Call my action!</button>
```
@ -99,7 +99,7 @@ var someAction = function(evt) {
- `$form`: In case your $trigger is of `type="submit"` or has a `data-action-submit` attribute, the action event will include a jquery instance of the sorrounding form or the form set by the $target.
###### View:
```php
```html
<?php $form = ActiveForm::begin(); ?>
<!-- ... Form Inputs ... -->
<button type="submit" data-action-click="example.submit" data-action-url="<?= $url ?>">Submit</button>

View File

@ -66,7 +66,6 @@ client.get(evt).then(...);
// Provide action event and additional ajax options
client.get(evt, {...}).then(...);
```
The `submit` function requires either an form selector, form jquery node or an action event as first argument.
@ -136,7 +135,6 @@ return [
'enablePjax' => false
]
]
```
##### Disable Pjax for specific links

View File

@ -11,7 +11,7 @@ Components consist of a root node, which can be accessed by `this.$` within your
###### View:
```php
```html
<div id="myComponent" data-action-component="example.MyComponent">
<div class="message"></div>
<button data-action-click="hello">Say Hi!</button>
@ -46,7 +46,7 @@ After clicking the button of the previous example the `action` module will searc
If you need the instance of your component, for example in another module, you can retrieve it by calling `Component.instance`:
```Javascript
```javascript
humhub.module('example.two', function(module, require, $) {
var Component = require('action').Component;
@ -66,7 +66,7 @@ Components can be nested, which can be handy for example if you want to implemen
###### View:
```php
```html
<div id="myComponent" data-action-component="example.mylist.List" data-some-setting="1">
<div data-action-component="example.mylist.ListEntry" data-id="1" >...</div>
<div data-action-component="example.mylist.ListEntry" data-id="2" >...</div>
@ -75,7 +75,7 @@ Components can be nested, which can be handy for example if you want to implemen
###### Module:
```Javascript
```javascript
humhub.module('example.mylist', function(module, require, $) {
var object = require('util').object;
var Component = require('action').Component;
@ -132,7 +132,7 @@ A Widgets `init` function is called once the widget is created. A Widget is crea
> Note: If you load a Widget by an ajax call, make sure to apply the `ui.additions` on your inserted dom nodes, otherwise the `data-ui-init` behavriour won't be recognized.
###### View:
```php
```html
<div id="myWidget" data-ui-widget="example.MyWidget" data-ui-init="1" style="display:none">
<!-- ... -->
</div>
@ -167,7 +167,7 @@ Your widgets option can be set by using `data-*` attributes on your Widgets root
The Widgets `getDefaultOptions()` method can be used to define default Widget options.
###### View:
```php
```html
<div id="myWidget" data-ui-widget="example.MyWidget" data-some-setting="0">
<!-- ... -->
</div>
@ -213,7 +213,7 @@ TBD
#### JsWidget class
In order to implement a Yii widget responsible for rendering your widgets markup, you can implement a PHP class derivated of [[humhub\widgets\JSWidget]] as in the following examples.
In order to implement a Yii widget responsible for rendering your widgets markup, you can implement a PHP class derivated of [[humhub\widgets\JsWidget]] as in the following examples.
Here are some of the available attributes of the JSWidget class:

View File

@ -86,7 +86,7 @@ class uninstall extends Migration
The integrity check is a command which validates and if necessary repairs the application database.
If you want to add own checking methods for your module to it, you can intercept the [[humhub\controllers\IntegrityController::EVENT_ON_RUN]] event.
If you want to add own checking methods for your module to it, you can intercept the [[humhub\commands\IntegrityController::EVENT_ON_RUN]] event.
Example callback implementation:

View File

@ -138,7 +138,7 @@ public static function onCreateSomeWidget($event)
### Append widget content
In some cases you may want to append or otherwise manipulate the output of a widget. For this use-case you can listen to the
[[yii\base\Widget::EVENT_AFTER_RUN]] event. The following example appends the output of `MyWidgetToAppend` to the result of
[yii\base\Widget::EVENT_AFTER_RUN](https://www.yiiframework.com/doc/api/2.0/yii-base-widget#EVENT_AFTER_RUN-detail) event. The following example appends the output of `MyWidgetToAppend` to the result of
`SomeWidgetIWantToExtend`:
**config.php:**

View File

@ -4,7 +4,7 @@ Users
User Component
---------------------
The [[\humhub\modules\user\component\User]] component can be accessed by `Yii::$app->user` and beside others provides the following
The [[\humhub\modules\user\components\User]] component can be accessed by `Yii::$app->user` and beside others provides the following
features:
- Access the [user identity](#user-identity) of the currently logged in user:
@ -84,7 +84,7 @@ public static function onUserSoftDelete(UserEvent $event)
The hard delete option will wipe all data in relation with the deleted user.
HumHub objects created by the user like comments, files, posts, notification or activities will automatically be removed with the user profile.
Example 'config.php':
Example '**config.php**':
```php
<?php

View File

@ -5,7 +5,7 @@ Notifications are used to inform one or a given set of users about a specific ev
Custom notification classes are derived from [[humhub\modules\notification\components\BaseNotification]].
A [[humhub\modules\notification\components\BaseNotification|BaseNotification]] usually is assigned with an
`$originator` user instance and a `$source` instance, which connects the Notification with a Content or any other kind of [[yii\db\ActiveRecord]].
`$originator` user instance and a `$source` instance, which connects the Notification with a Content or any other kind of [yii\db\ActiveRecord](https://www.yiiframework.com/doc/api/2.0/yii-db-activerecord).
A Notification can be sent to a user by calling the `send()` or `sendBulk()` function. This will persist an [[humhub\modules\notification\models\Notification]] instance for each user and send out a notification to all allowed `NotificationTargets`.
@ -70,7 +70,7 @@ echo Yii::t('SomethingHappend.views_notifications_somethingHappened', "%someUser
After an event was triggered, you'll have to instantiate your custom `BaseNotification` and call its
`send()` or `sendBulk()` function.
A notification can optionally be assigned with a `$source` model instance (e.g. a post or comment related to the notification) which has to be derived from [[yii\db\ActiveRecord]].
A notification can optionally be assigned with a `$source` model instance (e.g. a post or comment related to the notification) which has to be derived from [yii\db\ActiveRecord](https://www.yiiframework.com/doc/api/2.0/yii-db-activerecord).
```php
// Sending to a single user

View File

@ -23,13 +23,19 @@ HumHub extends several Yii base components such as:
- [[humhub\components\ActiveRecord|ActiveRecord]]
- [[humhub\components\Application|Application]]
- [[humhub\components\AssetManager|AssetManager]]
- [[humhub\components\Controller|Controller]]
- [[humhub\components\Event|Event]]
- [[humhub\components\Migration|Migration]]
- [[humhub\components\Module|Module]]
- [[humhub\components\ModuleEvent|ModuleEvent]]
- [[humhub\components\ModuleManager|ModuleManager]]
- [[humhub\components\Request|Request]]
- [[humhub\components\Response|Response]]
- [[humhub\components\SettingsManager|SettingsManager]]
- [[humhub\components\SocialActivity|SocialActivity]]
- [[humhub\components\Theme|Theme]]
- [[humhub\components\User|User]]
- [[humhub\components\UrlManager|UrlManager]]
- [[humhub\components\View|View]]
- [[humhub\components\Widget|Widget]]
- and more...

View File

@ -70,7 +70,7 @@ Space user-groups:
Example of `ContentContainerPermissions` are:
- [[humhub\modules\space\permissions\InviteUsers]] - Permission to invite users to a space.
- [[humhub\modules\mail\permissions\SendMail]] - Allows/Disallows other users to send messages.
- [[humhub\modules\mail\permissions\SendMail]] - Allows/Disallows other users to send messages. (Require to install [Mail](https://github.com/humhub/humhub-modules-mail) module)
- [[humhub\modules\content\permissions\ManageContent]] - Permission to archive, pin to top or delete content within a space.
### Verify ContentContainer Permissions

View File

@ -10,31 +10,27 @@ Example:
```php
use humhub\modules\content\components\ContentActiveRecord;
use humhub\modules\search\interfaces\Searchable;
class Post extends ContentActiveRecord implements Searchable
{
// ...
// ...
// This is required to display the search result
// This is required to display the search result
public $wallEntryClass = "humhub\modules\post\widgets\WallEntry";
// Searchable Attributes / Information
// Searchable Attributes / Information
public function getSearchAttributes()
{
return array(
'message' => $this->message,
'url' => $this->url,
'someTextField' => 'Some text'
'someTextField' => 'Some text'
);
}
// ...
// ...
}
```
@ -47,12 +43,10 @@ It's also required to handle/implement the [[\humhub\modules\search\engine\Searc
Example:
```php
public static function onSearchRebuild($event)
{
foreach (models\NonContent::find()->all() as $obj) {
\Yii::$app->search->add($obj);
}
}
```

View File

@ -38,7 +38,7 @@ Save a serialized setting:
$value = $module->settings->setSerialized($key, [['complex' => 'value']])
```
> Note `setSerialized` will use `Json::encode()` to serialize.
> Note: `setSerialized` will use `Json::encode()` to serialize.
**Delete setting:**

View File

@ -45,7 +45,7 @@ class WallEntry extends \humhub\modules\content\widgets\WallEntry
**mymodule\widgets\views\wallEntry.php**:
```php
```html
<div>
<?= $model->title ?>
<?= $model->myContent ?>

View File

@ -68,7 +68,9 @@ php yii migrate/up --includeModuleMigrations=1 --interactive=0
- Install test environment:
`php yii installer/auto`
```
php yii installer/auto
```
- Set `HUMHUB_PATH` system variable
@ -107,13 +109,9 @@ For running a test for a specific environment you'll have to set te `--env` argu
Example for running all functional tests of a tasks module in a master environment:
1. Create a file `@mymodule/tests/config/env/master/test.php` with the following content:
```
return [
'humhub_root' => '/pathToMasterBranch'
];
```
return [
'humhub_root' => '/pathToMasterBranch'
];
2. If needed set further HumHub settings in `tasks/tests/config/env/master/funtional.php`
3. Run `codecept run functional --env master`

View File

@ -168,7 +168,7 @@ your `SimpleWidget.prototype.init` function.
### Reloadable JsWidgets
Often you want to reload your widget in order to update parts of your view. This can be achieved by implementing the
[[humhub\widget\Reloadable]] interface and providing a reload-url in your `getReloadUrl()` as in the following example
[[humhub\widgets\Reloadable]] interface and providing a reload-url in your `getReloadUrl()` as in the following example
```php
class ReloadableWidget extends JsWidget implements Reloadable
@ -177,7 +177,7 @@ class ReloadableWidget extends JsWidget implements Reloadable
public function getReloadUrl()
{
return ['/mymodule/widget/reload', 'id' => $this->modle->id];
return ['/mymodule/widget/reload', 'id' => $this->id];
}
}
```

View File

@ -13,11 +13,13 @@ Since the CSS support in mail templates is very limited, you may need to access
You can access all CSS variables defined in `variables.less` by calling `Yii::$app->view->theme->variable('variableName');`.
Example:
```
```html
<html>
...
<body style="background-color:<?= Yii::$app->view->theme->variable('background-color-page') ?>; ">
...
</body>
...
</html>
</html>
```

View File

@ -6,19 +6,22 @@ Follow this steps to migrate an older theme ot 0.20:
1. Get the latest **style.css** [here](https://github.com/humhub/humhub/blob/v0.11/css/style.css) and copy it to **webroot/themes/yourtheme/css/**
2. Open the file ``head.php`` in **/themes/yourtheme/views/layouts/**
2. Open the file `head.php` in **/themes/yourtheme/views/layouts/**
3. Remove this code snippet:
``
<?php $ver = HVersion::VERSION; ?>
``
`<?php $ver = HVersion::VERSION; ?>`
4. To load the old **style.css**, insert this code to the first line:
``
<link href="<?php echo $this->theme->getBaseUrl() . '/css/style.css'; ?>" rel="stylesheet">
``
5. Change the structure of all reference calls for your additional theme files from
``<link href="<?php echo Yii::app()->theme->baseUrl; ?>/css/theme.css?ver=<?php echo $ver; ?>" rel="stylesheet">`` to ``<link href="<?php echo $this->theme->getBaseUrl() . '/css/theme.css'; ?>" rel="stylesheet">``.
`<link href="<?php echo $this->theme->getBaseUrl() . '/css/style.css'; ?>" rel="stylesheet">`
6. Check if everything works well, and fix optical issues at your theme file, if necessery.
5. Change the structure of all reference calls for your additional theme files from:
`<link href="<?php echo Yii::app()->theme->baseUrl; ?>/css/theme.css?ver=<?php echo $ver; ?>" rel="stylesheet">`
to:
`<link href="<?php echo $this->theme->getBaseUrl() . '/css/theme.css'; ?>" rel="stylesheet">`
6. Check if everything works well, and fix optical issues at your theme file, if necessary.

View File

@ -27,19 +27,19 @@ The new stream javascript rewrite requires some additional data-* attributes, wh
Please check the following files for changes, in case your theme does overwrite those files:
- protected/humhub/modules/stream/widget/views/stream.php
- protected/humhub/modules/content/views/layouts/wallEntry.php
- `protected/humhub/modules/stream/widget/views/stream.php`
- `protected/humhub/modules/content/views/layouts/wallEntry.php`
The same applies to the activity stream:
- protected/humhub/modules/activity/widget/views/activityStream.php
- protected/humhub/modules/activity/views/layouts/web.php
- `protected/humhub/modules/activity/widget/views/activityStream.php`
- `protected/humhub/modules/activity/views/layouts/web.php`
## Legacy Themes
Old themes, should check the following file for changes:
- humhub/themes/HumHub/css/theme.deprecated.less
- `humhub/themes/HumHub/css/theme.deprecated.less`
> Note: This file will not be maintained in the future.
@ -56,11 +56,13 @@ humhub module with an `init` function for your initialization logic.
You can also disable pjax by using the following configuration param in your `protected/config/common.php`:
```php
return [
'params' => [
'enablePjax' => false,
]
]
```
> Note: Since pjax provides a major performance boost, you should consider merging your Theme to the new pjax logic.
@ -76,44 +78,44 @@ The old **ekko lighbox** was replaced by the [blueimp ](https://blueimp.github.i
does overwrite a view with gallery images, you'll have to use the new **data-ui-gallery** attribute instead of the
**data-toggle** and **data-gallery** attributes. Please check the following files:
- modules/file/widgets/views/showFiles.php
- modules/space/widgets/views/header.php
- modules/tour/views/tour/welcome.php
- modules/user/widgets/views/profileHeader.php
- `modules/file/widgets/views/showFiles.php`
- `modules/space/widgets/views/header.php`
- `modules/tour/views/tour/welcome.php`
- `modules/user/widgets/views/profileHeader.php`
## JS Rewrite:
The JS Rewrite removed many inline script blocks from views and uses the new Javascript Module System with data-* attributes. Many UI Components and Widget had been rewritten.
- **General Rewrite**:
- modules/like/widget/views/likeLink.php
- modules/admin/views/setting/design.php
- modules/space/views/create/invite.php
- modules/space/views/membership/invite.php
- modules/comment/widget/views/showComment.php
- modules/files/widget/views/showFiles.php
- modules/post/widget/views/post.php
- `modules/like/widget/views/likeLink.php`
- `modules/admin/views/setting/design.php`
- `modules/space/views/create/invite.php`
- `modules/space/views/membership/invite.php`
- `modules/comment/widget/views/showComment.php`
- `modules/files/widget/views/showFiles.php`
- `modules/post/widget/views/post.php`
- **Richtext rewrite**:
- modules/comment/widget/views/form.php
- modules/comment/views/comment/edit.php
- modules/post/views/post/edit.php
- modules/post/widget/views/form.php
- `modules/comment/widget/views/form.php`
- `modules/comment/views/comment/edit.php`
- `modules/post/views/post/edit.php`
- `modules/post/widget/views/form.php`
- **UserPicker rewrite**:
- modules/admin/views/group/edit.php
- modules/admin/views/group/members.php
- modules/content/widgets/views/wallCreateContentForm.php
- `modules/admin/views/group/edit.php`
- `modules/admin/views/group/members.php`
- `modules/content/widgets/views/wallCreateContentForm.php`
- **TabbedForm**:
- modules/admin/views/user/add.php
- modules/admin/views/user/edit.php
- modules/user/views/account/_userProfileLayout.php
- modules/user/views/account/_userSettingsLayout.php
- `modules/admin/views/user/add.php`
- `modules/admin/views/user/edit.php`
- `modules/user/views/account/_userProfileLayout.php`
- `modules/user/views/account/_userSettingsLayout.php`
- **Space Picker**
- modules/admin/views/group/edit.php
- modules/admin/views/setting/basic.php
- modules/search/views/search/index.php
- `modules/admin/views/group/edit.php`
- `modules/admin/views/setting/basic.php`
- `modules/search/views/search/index.php`
- **Refactored**:
- modules/search/views/search/index.php
- `modules/search/views/search/index.php`
- **Pjax**
- modules/tour/widgets/views/tourPanel.php
- `modules/tour/widgets/views/tourPanel.php`
- **Notification**:
- modules/notification/widget/views/overview.php
- `modules/notification/widget/views/overview.php`

View File

@ -32,6 +32,7 @@ Once you created an own theme folder, you need to enable it in the administratio
This overview shows a complete theme folder structure including own less and view files.
```
/themes/
/mytheme/ - My Theme Name
/css/ - Your theme css files (optional)
@ -51,3 +52,4 @@ This overview shows a complete theme folder structure including own less and vie
/widgets/ - Links to /someModule/widgets/views/
someWidget.php - Overwritten widget view
/widgets/ - Links to /protected/widget/views
```