Merge branch 'master' into v0.21-dev

Conflicts:
	resources/user/profileHeaderImageUpload.js
This commit is contained in:
Lucas Bartholemy 2015-11-12 11:13:16 +01:00
commit 9b439955bc
8 changed files with 86 additions and 16 deletions

View File

@ -5,10 +5,6 @@ Yii::setAlias('@tests', dirname(__DIR__) . '/tests');
return [
'id' => 'humhub-console',
'controllerNamespace' => 'humhub\commands',
'bootstrap' => ['gii'],
'modules' => [
'gii' => 'yii\gii\Module',
],
'components' => [
'user' => [
'class' => 'humhub\modules\user\components\User',

View File

@ -22,13 +22,15 @@ return [
?>
```
## Enable Gii
## Enable Gii
### Web
Add following block to your local web configuration (/protected/config/web.php)
```php
return [
...
// ...
'modules' => [
// ...
@ -41,4 +43,20 @@ return [
]
];
?>
```
### Console
Add following block to your local console configuration (/protected/config/console.php)
```php
return [
// ...
'bootstrap' => ['gii'],
'modules' => [
'gii' => 'yii\gii\Module',
],
// ...
];
```

View File

@ -108,9 +108,13 @@ class UrlOembed extends \yii\db\ActiveRecord
// Build OEmbed Preview
$jsonOut = UrlOembed::fetchUrl($urlOembed->getProviderUrl());
if ($jsonOut != "") {
$data = \yii\helpers\Json::decode($jsonOut);
if (isset($data['type']) && ($data['type'] === "video" || $data['type'] === 'rich' || $data['type'] === 'photo')) {
$html = "<div class='oembed_snippet'>" . $data['html'] . "</div>";
try {
$data = \yii\helpers\Json::decode($jsonOut);
if (isset($data['type']) && ($data['type'] === "video" || $data['type'] === 'rich' || $data['type'] === 'photo')) {
$html = "<div class='oembed_snippet'>" . $data['html'] . "</div>";
}
} catch (\yii\base\InvalidParamException $ex) {
Yii::warning($ex->getMessage());
}
}
}

View File

@ -113,18 +113,34 @@ class ContentActiveRecord extends ActiveRecord implements \humhub\modules\conten
/**
* Returns the wall output widget of this content.
*
* @param array $params optional parameters to WallEntryWidget
* @param array $params optional parameters for WallEntryWidget
* @return string
*/
public function getWallOut($params = [])
{
if ($this->wallEntryClass !== "") {
$wallEntryWidget = $this->getWallEntryWidget();
if ($wallEntryWidget !== null) {
Yii::configure($wallEntryWidget, $params);
return $wallEntryWidget->renderWallEntry();
}
return "";
}
/**
* Returns the assigned wall entry widget instance
*
* @return \humhub\modules\content\widgets\WallEntry
*/
public function getWallEntryWidget()
{
if ($this->wallEntryClass !== '') {
$class = $this->wallEntryClass;
$params['contentObject'] = $this;
return $class::widget($params);
$widget = new $class;
$widget->contentObject = $this;
return §widget;
}
return "";
return null;
}
/**

View File

@ -49,6 +49,11 @@ class WallEntry extends Widget
*/
public $wallEntryLayout = "@humhub/modules/content/widgets/views/wallEntry.php";
/**
* @var boolean show files widget containing a list of all assigned files
*/
public $showFiles = true;
/**
* @inheritdoc
*/
@ -83,4 +88,28 @@ class WallEntry extends Widget
return $this->contentObject->content->container->createUrl($this->editRoute, ['id' => $this->contentObject->id]);
}
/**
* Renders the wall entry output
*
* @return string the output
* @throws \Exception
*/
public function renderWallEntry()
{
ob_start();
ob_implicit_flush(false);
try {
$out = $this->render($this->wallEntryLayout, [
'content' => $this->run(),
'object' => $this->contentObject,
'wallEntryWidget' => $this
]);
} catch (\Exception $e) {
ob_end_clean();
throw $e;
}
return ob_get_clean() . $out;
}
}

View File

@ -23,6 +23,13 @@ class ShowFiles extends \yii\base\Widget
*/
public function run()
{
$widget = $this->object->getWallEntryWidget();
// File widget disabled in this wall entry
if ($widget->showFiles === false) {
return;
}
$blacklisted_objects = explode(',', Setting::GetText('showFilesWidgetBlacklist', 'file'));
if (!in_array(get_class($this->object), $blacklisted_objects)) {
$files = \humhub\modules\file\models\File::getFilesOfObject($this->object);

View File

@ -46,7 +46,7 @@ use yii\helpers\Url;
'bgColor' => 'black',
'bgOpacity' => '0.5',
'boxWidth' => '440',
'onChange' => new yii\web\JsExpression('function(c){ console.log("fooo"); $("#cropX").val(c.x);$("#cropY").val(c.y);$("#cropW").val(c.w);$("#cropH").val(c.h); }')
'onChange' => new yii\web\JsExpression('function(c){ $("#cropX").val(c.x);$("#cropY").val(c.y);$("#cropW").val(c.w);$("#cropH").val(c.h); }')
]
]);
?>

View File

@ -12,7 +12,7 @@ $user = $this->context->getUser();
<?= \humhub\modules\user\widgets\ProfileMenu::widget(['user' => $this->context->user]); ?>
</div>
<?php if (isset($this->hideSidebar) && $this->hideSidebar) : ?>
<?php if (isset($this->context->hideSidebar) && $this->context->hideSidebar) : ?>
<div class="col-md-10 layout-content-container">
<?php echo $content; ?>
</div>