octobercms

Can't draw a chart

你。 提交于 2019-12-25 18:03:47
问题 According to the documentation, I can draw a chart control using the following code: <div class="control-chart centered wrap-legend" data-control="chart-pie" data-size="200" data-center-text="100"> <ul> <li>Label 1 <span>100</span></li> <li>Label 2 <span>100</span></li> <li>Label 3 <span>100</span></li> </ul> </div> But the output goes like this: Label 1 100 Label 2 100 Label 3 100 What should I do to make it work? 回答1: I suppose you are trying to do this on the frontend. However, the UI

how to insert login form in a restricted acces page with good security?

我怕爱的太早我们不能终老 提交于 2019-12-25 16:49:21
问题 i have to do the following stuff : My website have some restricted pages. Instead of redirecting the user to the login page, I would like the restricted access pages themselves displays the login form. I want this behaviour because i want the user have the information he is on his expected page and he have to login first. To do this, I have 2 layout: one for public pages and one for restricted acces page. Seems to be the best way to do. In both of them. I need to have the session component

Octobercms validation relation user

感情迁移 提交于 2019-12-24 21:17:17
问题 I have the following relation with the user model public $belongsTo = [ 'user' => [ 'Rainlab\User\Models\User', 'key' => 'user_id', 'order' => 'name asc' ] ]; config_relation.yaml user: label: Usuários view: form: $/rainlab/user/models/user/fields.yaml toolbarButtons: create|link manage: showSearch: true showCheckBoxes: true recordsPerPage: 10 list: $/rainlab/user/models/user/columns.yaml form: $/rainlab/user/models/user/fields.yaml I am doing the validation on the user field, but it is not

AJAX update div without creating partial

走远了吗. 提交于 2019-12-24 21:07:24
问题 I have some page: title = "page" url = "/page" layout = "default" == function onTest() { $this['result'] = 'Test string'; } == <!-- AJAX enabled form --> <form data-request="onTest" data-request-update="mypartial: '#myDiv'"></form> <!-- Result container --> <div id="myDiv"></div> After submitting the form I can get 'result' variable only in partial 'mypartial', where code is: Here is {{ result }} . And this code inserts into #myDiv. How can I get 'result' variable without creating partial?

How to change the front page & component image from the backend? how to get HTML tag attributes in php?

别说谁变了你拦得住时间么 提交于 2019-12-24 10:26:21
问题 my model Settings.php class Settings extends Model { public $implement = ['System.Behaviors.SettingsModel']; // A unique code public $settingsCode = 'dca_plugins_settings'; // Reference to field configuration public $settingsFields = 'fields.yaml'; /** * @var array Relations */ public $attachOne = [ 'avatar' => ['System\Models\File'] ]; } my Fields.yaml fields: id: label: ID disabled: true avatar: label: Avatar type: fileupload mode: image imageHeight: 150 imageWidth: 250 my Component comp

how to change the direction of a form dynamicly with ajax or javascript in octobercms

混江龙づ霸主 提交于 2019-12-24 10:25:04
问题 I have a form, and I would like it when I submit it, that it redirects me in another page, knowing that the redirection path must be dynamic, it means that I use a javascript function that takes the user's choice and return a string the ajax handler data-request-redirect only accept a string and execute not javascript code: title = "test" url = "/test" layout = "default" is_hidden = 0 == <?php function onStart() { $this['example'] = Session::get('example-key'); } function onTest() { Session:

October CMS disallowed file types

强颜欢笑 提交于 2019-12-24 07:05:14
问题 I'm trying to upload a .pptx file to the media library in October CMS and I'm getting an error because the filetype is not allowed. I have tried using the following suggestion from Stackoverflow: 'fileDefinitions' => [ 'assetExtensions' => array_merge(FileDefinitions::get('assetExtensions'), ['docx']), ], But I get an error message about FileDefinitions class not existing. I have also tried another suggestion of adding to a fileTypes array in /config/cms.php but that doesn't work either as

OctoberCMS plugin show all the validations at once

戏子无情 提交于 2019-12-24 06:06:49
问题 I am using Builder plugin to create plugins and did field validations in my model in one of my plugins which works fine. Let's say I have a validation something like this in one my plugin call it as Team . Model File: technobrave\team\models\Team.php <?php namespace Technobrave\Team\Models; use Model; /** * Model */ class Team extends Model { use \October\Rain\Database\Traits\Validation; /* * Validation */ public $rules = [ 'name' => 'required|unique:technobrave_team_', 'photo' => 'required',

OctoberCMS: How to maintain a two-way friendship relation?

前提是你 提交于 2019-12-24 06:03:11
问题 I'm extending the rainlab.user plugin to allow each user to have friends via a simple intermediate table with the following fields: user_id friend_id status I've extended the User model: use RainLab\User\Models\User as FrontUser; FrontUser::extend(function($model) { $model->belongsToMany['friends']=[ 'RainLab\User\Models\User', 'table' => 'meysam_social_friends', 'pivot' => ['status'], 'pivotModel' => 'Meysam\Social\Models\FriendsPivot', 'timestamps' => true, 'key' => 'user_id', 'otherKey' =>

OctoberCMS: How to maintain a two-way friendship relation?

不打扰是莪最后的温柔 提交于 2019-12-24 06:03:04
问题 I'm extending the rainlab.user plugin to allow each user to have friends via a simple intermediate table with the following fields: user_id friend_id status I've extended the User model: use RainLab\User\Models\User as FrontUser; FrontUser::extend(function($model) { $model->belongsToMany['friends']=[ 'RainLab\User\Models\User', 'table' => 'meysam_social_friends', 'pivot' => ['status'], 'pivotModel' => 'Meysam\Social\Models\FriendsPivot', 'timestamps' => true, 'key' => 'user_id', 'otherKey' =>