]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5319 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 27 Jun 2022 15:55:42 +0000 (17:55 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 27 Jun 2022 15:55:42 +0000 (17:55 +0200)
app/Fields/SCORMVersion.php [new file with mode: 0644]
app/Models/FluidbookPublication.php
app/Models/Quiz.php
app/Models/Traits/PublicationSettings.php
app/Models/Traits/SCORMVersionTrait.php [new file with mode: 0644]
resources/emailconfig/spamassassin-rules.cf

diff --git a/app/Fields/SCORMVersion.php b/app/Fields/SCORMVersion.php
new file mode 100644 (file)
index 0000000..716eff7
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+namespace App\Fields;
+
+use Cubist\Backpack\Magic\Fields\SelectFromArray;
+
+class SCORMVersion extends SelectFromArray
+{
+
+    protected $_default = '1.2';
+
+
+    public function getOptions()
+    {
+        return [
+            '1.2' => __('SCORM 1.2'),
+            '2004.3' => __('SCORM 2004 3rd edition'),
+            2004 => __('SCORM 2004 4th edition'),
+        ];
+    }
+
+    public function getDefaultAttributes()
+    {
+        return array_merge(parent::getDefaultAttributes(), ['column_label' => 'SCORM',
+            'column_type' => 'model_function',
+            'column_view_namespace' => 'crud::columns',
+            'column_function_name' => 'getSCORMVersion']);
+    }
+}
index cf96f2907bc38b202b9f50f0739e34dd49728d78..8b7481f80f41a21305c8e268153ad34a919689ea 100644 (file)
@@ -9,6 +9,7 @@ use App\Fields\FluidbookTitle;
 use App\Fields\User;
 use App\Models\Base\ToolboxModel;
 use App\Models\Traits\PublicationSettings;
+use App\Models\Traits\SCORMVersionTrait;
 use Cubist\Backpack\Magic\Fields\Datetime;
 use Cubist\Backpack\Magic\Fields\FormBigSection;
 use Cubist\Backpack\Magic\Fields\FormSuperSection;
@@ -29,6 +30,7 @@ class FluidbookPublication extends ToolboxModel
     protected static $_permissionBase = 'fluidbook-publication';
 
     use PublicationSettings;
+    use SCORMVersionTrait;
 
     public function setFields()
     {
@@ -143,12 +145,5 @@ class FluidbookPublication extends ToolboxModel
         return '/data1/extranet/www/fluidbook/books/working/' . $this->id;
     }
 
-    public function getSCORMVersion()
-    {
-        if (!$this->scorm_enable) {
-            return '-';
-        }
-        $map = ['1.2' => '1.2', '2004' => '2004', '2004.3' => '2004 <sup>3rd ed.</sup>'];
-        return $map[$this->scorm_version];
-    }
+
 }
index 6ef32da29c8a124175d1bef4595b000cdae06db7..a6ec1f91c5f6f01ca3eb2df497168deb7632c6c9 100644 (file)
@@ -3,8 +3,10 @@
 
 namespace App\Models;
 
+use App\Fields\SCORMVersion;
 use App\Http\Controllers\Admin\Base\QuizController;
 use App\Models\Base\ToolboxModel;
+use App\Models\Traits\SCORMVersionTrait;
 use Cubist\Util\Files\Files;
 use Spatie\MediaLibrary\MediaCollections\Models\Media;
 use Spatie\Image\Manipulations;
@@ -25,6 +27,8 @@ class Quiz extends ToolboxModel
 
     public $registerMediaConversionsUsingModelInstance = false;
 
+    use SCORMVersionTrait;
+
     protected static function _getColors()
     {
         return [
@@ -94,6 +98,13 @@ class Quiz extends ToolboxModel
         $this->addColumnDateFields(__('Projet'));
         $this->addOwnerField(__('Projet'));
 
+        $this->addField(['name' => 'scorm_version',
+                'label' => __('Version SCORM'),
+                'column' => true,
+                'type' => SCORMVersion::class,
+                'tab' => __('Projet')]
+        );
+
         $this->addField(['name' => 'title',
             'label' => __('Titre du quiz'),
             'type' => 'Text',
index c81245b60f0ea0f59785db07a424d93b28d9798f..54d845bc7c396bc9666e2ee24bada3e863a85df8 100644 (file)
@@ -4,6 +4,7 @@ namespace App\Models\Traits;
 
 use App\Fields\FluidbookDevelopmentVersion;
 use App\Fields\FluidbookSignature;
+use App\Fields\SCORMVersion;
 use Cubist\Backpack\Magic\Fields\Checkbox;
 use Cubist\Backpack\Magic\Fields\FilesOrURL;
 use Cubist\Backpack\Magic\Fields\FormSection;
@@ -3067,14 +3068,8 @@ L,index',
             'store_in' => 'settings',
             'translatable' => false,
         ]);
-        $this->addField('scorm_version', SelectFromArray::class, $this->__('Version du standard SCORM'), [
+        $this->addField('scorm_version', SCORMVersion::class, $this->__('Version du standard SCORM'), [
             'v2' => '{"type":"combo","default":"1.2","editable":true,"label":"\\u00a7!\\u00a7Version du standard SCORM!\\u00a7!","grade":5,"datas":{"\\u00a7!\\u00a7SCORM 1.2!\\u00a7!":"1.2","\\u00a7!\\u00a7SCORM 2004 3rd edition!\\u00a7!":"2004.3","\\u00a7!\\u00a7SCORM 2004 4th edition!\\u00a7!":"2004"}}',
-            'options' => [
-                '1.2' => $this->__('SCORM 1.2'),
-                '2004.3' => $this->__('SCORM 2004 3rd edition'),
-                2004 => $this->__('SCORM 2004 4th edition'),
-            ],
-            'default' => '1.2',
             'fake' => true,
             'store_in' => 'settings',
             'translatable' => false,
diff --git a/app/Models/Traits/SCORMVersionTrait.php b/app/Models/Traits/SCORMVersionTrait.php
new file mode 100644 (file)
index 0000000..4c1f603
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+
+namespace App\Models\Traits;
+
+trait SCORMVersionTrait
+{
+    public function getSCORMVersion()
+    {
+        if ((property_exists($this, 'scorm_enable') && !$this->scorm_enable) || !$this->scorm_version) {
+            return '-';
+        }
+        $map = ['1.2' => '1.2', '2004' => '2004', '2004.3' => '2004 <sup>3rd ed.</sup>'];
+        return $map[$this->scorm_version];
+    }
+}
index a966f035b8907c3a18bc98eec415655038179a8f..73d4eb069028de36cee626363adf202b68201f89 100644 (file)
@@ -12,11 +12,11 @@ score BAYES_20          -2.0
 score BAYES_30          -1.0
 score BAYES_40          0.001
 score BAYES_50          1.0
-score BAYES_60          3.1
-score BAYES_80          4.1
-score BAYES_95          5.1
-score BAYES_99          5.5
-score BAYES_999         7.5
+score BAYES_60          2.1
+score BAYES_80          3.1
+score BAYES_95          4.1
+score BAYES_99          4.5
+score BAYES_999         9.5
 
 # TXRep
 
@@ -34,8 +34,8 @@ loadplugin Mail::SpamAssassin::Plugin::TextCat
 ifplugin Mail::SpamAssassin::Plugin::TextCat
 ok_locales en
 ok_languages en es fr de sv it pt
-score UNWANTED_LANGUAGE_BODY   1.25
-score CHARSET_FARAWAY          1.25
+score UNWANTED_LANGUAGE_BODY   3.0
+score CHARSET_FARAWAY          3.0
 endif
 
 $spam_whitelist
@@ -64,7 +64,7 @@ header __MIME_CONTENT_CYR Content-Type:raw =~ /charset=\"((((cs)?)koi8(-?)r)|(wi
 endif
 
 meta HDR_CYR __HDR_FROM_CYR || __HDR_TO_CYR || __HDR_SUBJECT_CYR || __MIME_CONTENT_CYR
-score HDR_CYR 1.25
+score HDR_CYR 3.0
 
 header __HDR_FROM_CYR_UTF8_CHARSET_DEFINITION From:raw =~ /=\?utf-8\?/i
 header __HDR_TO_CYR_UTF8_CHARSET_DEFINITION To:raw =~ /=\?utf-8\?/i
@@ -73,23 +73,23 @@ header __HDR_TO_CYR_UTF8_CONTENT To =~ /(((\xD0[\x81\x90-\xBF])|(\xD1[\x80-\x8F\
 meta __HDR_FROM_CYR_UTF8 __HDR_FROM_CYR_UTF8_CHARSET_DEFINITION && __HDR_FROM_CYR_UTF8_CONTENT
 meta __HDR_TO_CYR_UTF8 __HDR_TO_CYR_UTF8_CHARSET_DEFINITION && __HDR_TO_CYR_UTF8_CONTENT
 meta HDR_ADDR_CYR_UTF8 __HDR_FROM_CYR_UTF8 || __HDR_TO_CYR_UTF8
-score HDR_ADDR_CYR_UTF8 1.25
+score HDR_ADDR_CYR_UTF8 3.0
 
 header __HRD_SENDER_RU From:addr =~ /@((([a-zA-Z0-9])|\.|\-)+)\.ru(\.?)$/i
 header __HRD_RECIPIENT_RU From:addr =~ /@((([a-zA-Z0-9])|\.|\-)+)\.ru(\.?)$/i
 header __HDR_ENVFROM_RU EnvelopeFrom:addr =~ /@((([a-zA-Z0-9])|\.|\-)+)\.ru(\.?)$/i
 header __HDR_RCVD_RU Received:raw =~ /from([[:blank:]]+((([a-zA-Z0-9])|\.|\-)+)\.ru(\.?)[[:blank:]])/i
 meta HDR_CCTLD_RU __HRD_SENDER_RU || __HRD_RECIPIENT_RU || __HDR_ENVFROM_RU || __HDR_RCVD_RU
-score HDR_CCTLD_RU 1.25
+score HDR_CCTLD_RU 3.0
 
 uri URI_IN_RU /^(http(s?)\:\/\/)((([a-zA-Z0-9])|\.|\-)+)\.ru(\.?)($|\/)/i
-score URI_IN_RU 1.25
+score URI_IN_RU 3.0
 
 ifplugin Mail::SpamAssassin::Plugin::MIMEHeader
 mimeheader __MIMEPART_NAME_RU Content-Type:raw =~ /name=\"=\?((((cs)?)koi8(-?)r)|(windows-1251))/ims
 mimeheader __MIME_FILENAME_RU Content-Disposition:raw =~ /filename=\"=\?((((cs)?)koi8(-?)r)|(windows-1251))/ims
 meta MIMEPART_NAME_RU __MIMEPART_NAME_RU || __MIME_FILENAME_RU
-score MIMEPART_NAME_RU 1.25
+score MIMEPART_NAME_RU 3.0
 endif
 
 # Note, that when examining body of a message, SA adds header to it as the
@@ -104,4 +104,4 @@ endif
 meta __CONTENT_CYR_UTF8_CHARSET_DEFINITION __HDR_SUBJ_CYR_UTF8_CHARSET_DEFINITION || __HDR_CONTENTTYPE_CYR_UTF8_CHARSET_DEFINITION
 body __CONTENT_CYR_UTF8 /(((\xD0[\x81\x90-\xBF])|(\xD1[\x80-\x8F\x91]))([A-Za-z[:digit:][:blank:][:punct:]])?){3}/
 meta CONTENT_CYR_UTF8 __CONTENT_CYR_UTF8_CHARSET_DEFINITION && __CONTENT_CYR_UTF8
-score CONTENT_CYR_UTF8 1.25
+score CONTENT_CYR_UTF8 3.0