I have not been able to integrate CkEditor with Moodle 2.9.1+. (I suspect the issue would apply to any text editor, not just CkEditor.)
Per the README instructions, I cloned moodle-ckeditor from https://github.com/electrolinux/moodle-ckeditor into the lib/editor directory of the moodle installation I administer.
I renamed the downloaded directory from moodle-ckeditor to ckeditor.
I added this line to config.php in the root moodle directory:
$CFG->texteditors='ckeditor,tinymce,htmlarea';
When I navigate to Admin > Plugins > Text editors > Manage editors, I only see the original 3 editors: TinyMCS HTML editor, Plain text area, and Atto HTML editor.
FWIW, when I experimentally removed "tinymce," from the shown line of config.php, it still showed up on the "Manage editors" page. That makes me think that $CFG->texteditors is not being used. I do know it is being read, because I get an error on the "Manage editors" page if I put a syntax error into that line.
I've appended a console session in case to call attention to or rule out mistakes due to typos, permissions, etc.:
[~/public_html]# grep ckeditor config.php
$CFG->texteditors='ckeditor,tinymce,htmlarea';
[~/public_html]# ls -l lib/editor
total 28
drwxr-xr-x 7 millscso millscso 4096 Jul 23 16:09 ./
drwxr-xr-x 48 millscso millscso 4096 Jul 16 02:16 ../
drwxr-xr-x 9 millscso millscso 4096 Jul 16 02:16 atto/
drwxr-xr-x 5 millscso millscso 4096 Jul 23 16:09 ckeditor/
drwxr-xr-x 7 millscso millscso 4096 Jul 23 15:59 ckeditor-/
-rw-r--r-- 1 millscso millscso 0 Jul 16 02:16 index.html
drwxr-xr-x 3 millscso millscso 4096 Jul 16 02:16 textarea/
drwxr-xr-x 9 millscso millscso 4096 Jul 16 02:16 tinymce/
Update
A few days after reverting the change to config.php, "CKEditor HTML editor" began showing up within Admin > Plugins > Text editors > Manage editors. Unfortunately, when I click on Settings [http://mills-cs.org/admin/settings.php?section=editorsettingsckeditor], I get a Section error.
Works for me with Moodle 2.7, here's what I did
git clone https://github.com/electrolinux/moodle-ckeditor.git
copied and pasted the folder /moodle-ckeditor/ into moodlewww/lib/editor/
renamed moodlewww/lib/editor/moodle-ckeditor/ to moodlewww/lib/editor/ckeditor/
Logged into my site and clicked on site admin -> notifications to install ckeditor
I skipped $CFG->texteditors='ckeditor,tinymce,htmlarea';
Instead went to site admin -> plugins -> editors -> manage editors then enabled ckeditor - this might be what's wrong in your case?
Then moved ckeditor up the list so it is first.
UPDATE:
I tried with an install of 2.9 and it failed because the version.php file is missing - I'm guessing this is a requirement in 2.9.
I always have the debugger on development. You might find it useful too, have these settings in config.php
// Developer settings - not for production!
error_reporting(E_ALL & ~E_STRICT);
ini_set('display_errors', 1);
$CFG->debug = E_ALL & ~E_STRICT;
$CFG->debugdisplay = true;
So I created the missing file /lib/editor/ckeditor/version.php with the contents below and it installed correctly in 2.9
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* CKEditor text editor integration version file.
*
* #package editor_ckeditor
* #copyright
* #license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2015073000; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2015051100; // Requires this Moodle version
$plugin->component = 'editor_ckeditor'; // Full name of the plugin (used for diagnostics)
Related
Context
I have deployed a Laravel app using Laradock. This app has the feature to generate certificates in PDF and attach them to an email notification.
Everything works fine in Laravel Homestead (development environment), however, that feature is not working in Laradock production mode.
Goal
I have implemented a functionality to send a PDF certificate through an email notification as an attachment like so (using Laravel Filament):
<?php
use Illuminate\Support\Facades\Notification;
use App\Notifications\Certificates\CertificateIssued;
Notification::route('mail',[
$certificate->participant->email=>$certificate->participant->name,
])->notify(new CertificateIssued($record));
Now in the notification class CertificateIssued I instantiate a Laravel Snappy PDF generator class
public function toMail($notifiable)
{
$generateCertificate = new GenerateCertificate();
//...
return
(new MailMessage)->markdown('emails.certificates.issued',[
//Some vars to be passed
])
->attachData($GenerateCertificate->attachPDF($this->certificate),$pdf_filename, [
'mime' => 'application/pdf',
]);
}
The Laravel Snappy PDF certificate class is like so:
use App\Models\Certificate;
use App\Services\Certificates\Qr\GenerateQr;
use Barryvdh\Snappy\Facades\SnappyPdf as PDF;
class GenerateCertificate
{
public function attachPdf(Certificate $certificate)
{
$pdf = $this->generate_pdf_certificate($certificate);
return $pdf->output();
}
public function generate_pdf_certificate(Certificate $certificate)
{
//QR code
$qr=$this->generate_png_qr($certificate);
//load blade view
$pdf = PDF::loadView('certificates.default',compact('certificate','qr'));
//Set PDF options. todo: abstract options away
$pdf = $this->setPdfOptions($pdf);
return $pdf;
}
public function genera_qr_png(Certificate $certificate)
{
$generateQR = new GenerateQr($this->generate_url_qr_verification($certificate),'png',130);
return $generateQR->image();
}
}
So I want the PDF attachment to be sent on an email notification. That piece of code is also used in a scheduler for newly generated certificates to be sent via email.
Error
But the email sending notification cannot be achieved due to an error in the wkhtmltopdf
[2022-05-19 16:40:53] production.ERROR: The exit status code '127' says something went wrong:
stderr: "sh: /usr/local/bin/wkhtmltopdf: not found
.env
I have actually installed the WKHTMLTOPDF in both the workspace and php-fpm containers.
###########################################################
################ Containers Customization #################
###########################################################
### WORKSPACE #############################################
WORKSPACE_INSTALL_WKHTMLTOPDF=true
### PHP_FPM ###############################################
PHP_FPM_INSTALL_WKHTMLTOPDF=true
Inside the container,
> docker exec -it --user=laradock project_workspace_1 zsh
➜ www git:(master) ✗ /usr/local/bin/wkhtmltopdf -V
wkhtmltopdf 0.12.6 (with patched qt)
➜ www git:(master) ✗ ls -lah /usr/local/bin
total 92M
drwxr-xr-x 1 root root 4.0K May 18 10:18 .
drwxr-xr-x 1 root root 4.0K Apr 16 2021 ..
-rwxr-xr-x 1 laradock www-data 2.6M Apr 22 19:48 composer
-rwxr-xr-x 1 root root 221 May 18 10:15 pip
-rwxr-xr-x 1 root root 221 May 18 10:15 pip3
-rwxr-xr-x 1 root root 221 May 18 10:15 pip3.10
-rwxr-xr-x 1 root root 221 May 18 10:15 pip3.8
-rwxr-xr-x 1 root root 238 May 18 10:15 virtualenv
-rwxr-xr-x 1 root root 208 May 18 10:15 wheel
-rwxr-xr-x 1 laradock www-data 45M Jun 10 2020 wkhtmltoimage
-rwxr-xr-x 1 laradock www-data 45M Jun 10 2020 wkhtmltopdf
I can see it is indeed installed in /usr/local/bin/ and I can actually execute it. Even if the owner is root:root, but I changed it to laradock:www-data but it made no difference.
What works and main question
I have another functionality to generate a certificate preview that works as a PDF download which does work. So why does this PDF preview download works and not the PDF attachment?
Here is a PDF generator preview that generates a PDF and prompts for download in the browser (using Laravel Filament):
public function certificate_preview(){
$event = Event::with('relationships...')->findOrFail($this->record->id);
$pdf = SnappyPdf::loadView('certificates.default',['event'=>$this->record])
->setPaper('Letter')
->setOrientation('Portrait')
->setOption('disable-external-links', false)
->setOption('enable-local-file-access', true)
->setOption('enable-internal-links' , true)
->output()
;
$disk = Storage::disk('pdf');
$disk->put('preview.pdf', $pdf);
return Storage::disk('pdf')->download('preview.pdf');//https://dev.to/fractalbit/tips-for-working-with-private-files-in-laravel-1g08
//dd(Storage::disk('pdf')->path('preview.pdf'));
//dd($this->record);
}
The previous code streams the PDF in the browser as a download option or it simply shows it right in the browser:
blob:https://myapp.com/long_uuid_string
where I can see perfectly the PDF! But why isn't the attachment working and outputs the
ERROR: The exit status code '127' says something went wrong: stderr: "sh: /usr/local/bin/wkhtmltopdf: not found" at /var/www/vendor/knplabs/knp-snappy/src/Knp/Snappy/AbstractGenerator.php:469
error?
Version info
The version of wkhtmltopdf is:
➜ www git:(master) ✗ /usr/local/bin/wkhtmltopdf -V
wkhtmltopdf 0.12.6 (with patched qt)
➜ www git:(master) ✗ php -v
PHP 8.1.5 (cli) (built: Apr 21 2022 10:14:45) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.5, Copyright (c) Zend Technologies
with Zend OPcache v8.1.5, Copyright (c), by Zend Technologies
Problem identified
I have tested to send an email notification without the queue in jobs and it worked!
Looks like the php-worker container should have the WKHTMLTOPDF installed, which is missing in the .env file.
I mean, there's no
### PHP_WORKER ############################################
PHP_WORKER_INSTALL_WKHTMLTOPDF=true
in the PHP-WORKERsection.
So now the question is, how to install that extension in the php-worker container?
I wanted to give CLion a try for working with the ROS source code. I created a ROS Workspace and have the following folder structure:
joesan#joesan-InfinityBook-S-14-v5:~/Projects/Private/ros-projects$ cd catkin_ws/
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:27 2020 .
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:10 2020 ..
.rw-rw-r-- joesan joesan 98 B Sun Aug 30 10:48:27 2020 .catkin_workspace
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:27 2020 build
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:26 2020 devel
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 12:13:50 2020 src
joesan#joesan-InfinityBook-S-14-v5:~/Projects/Private/ros-projects/catkin_ws$
I have sourced this location in the .bash_profile as below:
# Dynamically source all setup.bash files from multiple catkin ros workspaces
find /home/joesan/Projects/Private/ros-projects -wholename '*/devel/setup.bash' | xargs source
I then source the .bash_profile from within my .bashrc
Now, when I tried to open the project in CLion, I see the following error:
CMake Error at CMakeLists.txt:65 (message):
find_package(catkin) failed. catkin was neither found in the workspace nor
in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was
sourced before.
I launch CLion via a Desktop shortcut entry that I created. How do I make CLion aware of this .bash_profile such that it can find catkin?
I managed to fix this by doing the following, but make sure that you have a Desktop entry created for Jetbrains CLion beforehand!
Open the jetbrains-clion.desktop located in the .local folder:
~/.local/share/applications/jetbrains-clion.desktop
In this desktop entry, modify the Exec= line as:
Exec=bash -i -c "/opt/softwares/clion-2020.2.1/bin/clion.sh" %f
Any custom metasploit module I create isn't getting loaded.
I tried both of these demos:
https://www.offensive-security.com/metasploit-unleashed/building-module/ https://github.com/rapid7/metasploit-framework/wiki/Loading-External-Modules
and got the same result that the modules were NOT found.
Before posting here, I checked these out:
https://forums.kali.org/showthread.php?28940-Metasploit-modules-not-loading!
https://www.offensive-security.com/metasploit-unleashed/modules-and-locations
and from SO:
I can't get new modules to load in metasploit
How to add module in Metasploit?
no help
Just working with the github example, on the Kali host, I do indeed have the file in the right location (according to the demo):
root#kali:~/.msf4/modules/exploits/test# ls -al
total 12
drwxr-xr-x 2 root root 4096 Mar 19 13:59 .
drwxr-xr-x 3 root root 4096 Mar 19 13:58 ..
-rw-r--r-- 1 root root 9 Mar 19 13:59 test_module.rb
I then ran reload_all and when using this command:
use exploit/test/test_module it returns with Failed to load module.
I also tried to manually load that path and it failed too:
msf > loadpath ~/.msf4/modules/
Loaded 0 modules:
Posting the answer for anyone who may come across this. I'm kinda new to this; didn't know where metasploit info gets logged.
It's in: ~/.msf4/logs/framework.log
The log told me I had a syntax error... must have happened from copying and pasting the text from the browser. Cleaned that up and everything works.
I'm using the excellent Sublime Text 3 editor on my Mac for which I want to turn off word wrap. So I went to Preferences > Settings - Default, which opens up a settings file. Unfortunately I am unable to edit the file, so I wanted to lookup the file on the command line. I hovered over the file in Sublime, which shows me the location of the file:
I then tried to go to that folder, but to my surprise there is no Default folder in the ~/Library/Application Support/Sublime Text 3/Packages/ folder:
$ ls -la ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/
total 280
drwx------ 7 kramer65 staff 238 17 okt 13:48 .
drwx------ 8 kramer65 staff 272 8 okt 16:23 ..
-rw-r--r--# 1 kramer65 staff 6148 8 okt 16:25 .DS_Store
drwxr-xr-x# 18 kramer65 staff 612 14 jul 01:49 Jedi - Python autocompletion
-rw-r--r--# 1 kramer65 staff 132375 17 okt 13:45 Package Control.sublime-package
drwxr-xr-x 24 kramer65 staff 816 17 okt 13:48 SublimeCodeIntel
drwx------ 7 kramer65 staff 238 17 okt 13:48 User
and here I'm stuck. How can it be that I am looking at a file, which doesn't seem to exist?
Does anybody know what I'm doing wrong here? How can I find this file to disable the wordwrapping? All tips are welcome!
The file you were looking for is actually very close
~/Library/Application Support/Sublime Text
3/Packages/User/Preferences.sublime-settings
that's indeed the file shown through the menu. I agree its location isn't as intuitive as it could be.
The correct answer is: it depends on:
What OS you are using. (MacOS, Win, Cygwin, Linux)
How you installed it. (By default installer or as a stand-alone.)
Here's the default (installer) list:
MacOS: ~/Library/Application Support/Sublime Text 3/Packages/User/Preferences.sublime-settings
Linux: ~/Library/Application Support/Sublime Text 3/Packages/User/Preferences.sublime-settings
Windows: C:\Users\<username>\AppData\Roaming\Sublime Text 3\Packages\User\Preferences.sublime-settings
For a stand-alone installation, it will be in:
<install path>/Data/Packages/User/Preferences.sublime-settings.
The settings files are consulted in this order:
Packages/Default/Preferences.sublime-settings
Packages/Default/Preferences (<platform>).sublime-settings
Packages/User/Preferences.sublime-settings
<Project Settings>
Packages/<syntax>/<syntax>.sublime-settings
Packages/User/<syntax>.sublime-settings
<Buffer Specific Settings>
So generally you should place your settings in:
.../Packages/User/Preferences.sublime-settings.
PS. Yes, I know OP asked for MacOS, but everyone else will also end up on this page.
You must open Settings - User instead of Settings - Default. Settings - Default contains default settings and it should not be editable.
So just go to Preferences/Settings - User and add following content to disable word wrap:
{
"word_wrap": false
}
"The application has exited during startup (i.e. during the evaluation of config/environment.rb). The error message may have been written to the web server's log file. Please check the web server's log file (i.e. not the (Rails) application's log file) to find out why the application exited."
I'm getting the above error message when I try to access my test site.
Permission for config/* is
-rw-r--r-- 1 www-data root 2011 Aug 27 20:17 environment.rb
drwxr-xr-x 3 root root 4096 Aug 27 20:17 environments
drwxr-xr-x 3 root root 4096 Aug 27 20:17 initializers
drwxr-xr-x 3 root root 4096 Aug 27 20:17 locales
-rw-r--r-- 1 root root 2431 Aug 27 20:17 routes.rb
I've tried "root root 2011 Aug 27 20:17 environment.rb" as well but no success either.
I'm running Debian GNU/Linux and have other Rails sites running fine on the same server, I have tried to replicate the setup from one of the other sites, but it's not having any effect.
I encountered this same issue, and after killing passenger and apache ended up finding:
http://geminstallthat.wordpress.com/2009/03/01/passenger-with-rails-23-application-missingsourcefile/
Essentially the issue is for some versions of libapache2-mod-passenger the app/controllers/application.rb change to app/controllers/application_controller.rb (in Rails 2.3) explodes things (technical term).