silverstripe

Silverstripe File relation in ModelAdmin doesnt publish

。_饼干妹妹 提交于 2019-12-31 02:24:06
问题 Im using SilverStripe4 and the ModelAdmin to manage DataObjects. The DataObject has a has_one on File. Everything works so far but on frontend controller the File relation has an empty object. I see that the file is not in the File_Live table, so i guess its not published and therefor its not found on the frontend controller. How can i publish File relations from the ModelAdmin? Basically when a file is uploaded it should be automatically published. I guess if i use versioned DataObjects i

SilverStripe 3.6.1 unable to load TinyMCE

时间秒杀一切 提交于 2019-12-25 18:48:16
问题 A fresh installation of SilverStripe is not able to load TinyMCE correctly because the path to some files is not correct, see screenshot: https://www.imgpaste.net/image/Ds9Ve Does anyone know what I'm missing? 回答1: This is caused by gzip compression on the server clashing with the TinyMCE code used by HTMLEditorield . To disable gzip on our HTMLEditorield we can put the following in our config.yml file: HtmlEditorField: use_gzip: false 来源: https://stackoverflow.com/questions/45658301

Silverstripe REST API

耗尽温柔 提交于 2019-12-25 16:49:48
问题 I am using Silverstripe Restfulserver and want to make a GET request to get a collection of data objects. For example, /events should return a list of events in some logical order. I see in the docs that you can make a POST call to /[dataobject] and create a new object and /[dataobject]/[id] to GET a specific object but is there not a GET alternative to return a collection? I currently have a events method created on the page controller to return the list, but was wondering if anyone had a

Silverstripe 3 - Unable to implement controller access security from CMS

﹥>﹥吖頭↗ 提交于 2019-12-25 15:17:09
问题 Good afternoon, I'm still new to silverstripe and I'm trying to figure out some really simple tasks. Currently, I'm trying to implement the security restrictions from my page controller function that was already created within my DataObject and configured via the CMS. However, whether or not I grant the user access to view the object, the user sees it anyhow. See example below: class MyComponent extends DataObject implements PermissionProvider{ ///>... this is just a snippet not the full

Silverstripe 3 - Unable to implement controller access security from CMS

…衆ロ難τιáo~ 提交于 2019-12-25 15:16:21
问题 Good afternoon, I'm still new to silverstripe and I'm trying to figure out some really simple tasks. Currently, I'm trying to implement the security restrictions from my page controller function that was already created within my DataObject and configured via the CMS. However, whether or not I grant the user access to view the object, the user sees it anyhow. See example below: class MyComponent extends DataObject implements PermissionProvider{ ///>... this is just a snippet not the full

Select DISTINCT on a single column using Silverstripe ORM

笑着哭i 提交于 2019-12-25 08:34:59
问题 My table: ----------------------------------------- | ID | RoomTypeId | ChargeTypeId | Name | ----------------------------------------- | 1 | 23 | 32 | DD | | 2 | 26 | 32 | DD | | 3 | 28 | 31 | CC | ----------------------------------------- The ORM does already DISTINCT by default, but does so on every column and returns all 3 The return I need: ----------------------- | ChargeTypeId | Name | ----------------------- | 32 | DD | | 31 | CC | ----------------------- Hoping there is actually a

Setting the name of a file saved through a filefield

只愿长相守 提交于 2019-12-25 08:15:14
问题 I have a form that allows users to upload a resume through a form. The submit method saves the data into CareerApplication with the resume attached as a has_one relation. $submission = new CareerApplication(); $form->saveInto($submission); I would like to control the filename the resume is saved as. How can i set the filename of the uploaded file? 回答1: You could try this $up = new Upload(); $file = Object::create('File'); $file->setFileName('newname'); $up->loadIntoFile($data['FileName'],

Silverstripe 3.1 wont change to dev env

走远了吗. 提交于 2019-12-25 06:50:38
问题 My site is on live online server, after installing few modules ( user definded forms ) via SSH and Composer i get 500 internal server error. I try to run /dev/build/?flush but nothing is happening. Again the some error! I check in chrome to inspect in network tab and there is also 500. So dev env in not enabled. I try to enable it: _config.php Config::inst()->update("Director", "environment_type", "dev"); config/config.yml : Director: environment_type: 'dev' And nothing is happening. It wont

Silverstripe combine filterAny and filter to have an OR with an AND in it

情到浓时终转凉″ 提交于 2019-12-25 03:56:07
问题 I have a question and maybe somebody can help me figure out what the best way would be to achieve the solution. What i wanted to do is the reverse of: http://doc.silverstripe.com/framework/en/topics/datamodel#highlighter_745635 WHERE ("LastName" = 'Minnée' AND ("FirstName" = 'Sam' OR "Age" = '17')) I want to get something along the lines of: WHERE( ("LastName" = 'Minnée') OR ("FirstName" = 'Sam' AND "Age" = '17')) Now i cannot find any way to achieve this effect seeing as i cannot add a

SilverStripe password de/encrypting doesn't work

▼魔方 西西 提交于 2019-12-24 23:40:12
问题 Because of the huge help from 3dgoo here Store Sensitive Data in Silverstripe I was able to create this Dataobject to store ClientPasswords -> http://www.sspaste.com/paste/show/5257a5ccdf990 The Problem is, after creating the fields with getCMSFields the de/and encryption doesn't work anymore and the password is stored as plaintext in the database :/ Can someone help me to fix it? Where is the bug? 回答1: I can't spot a bug per se there as you have none, if you don't call an ideological one