mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
Fix deprecation warnings for master
This commit is contained in:
parent
c4586c7404
commit
aa190ea7a5
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
DMSDocument_versions::$enable_versions = true;
|
$config = Config::inst();
|
||||||
|
$config->update('DMSDocument_versions', 'enable_versions', true);
|
||||||
|
|
||||||
DMSSiteTreeExtension::show_documents_tab(); //show the Documents tab on all pages
|
DMSSiteTreeExtension::show_documents_tab(); //show the Documents tab on all pages
|
||||||
DMSSiteTreeExtension::no_documents_tab(); //and don't exclude it from any pages
|
DMSSiteTreeExtension::no_documents_tab(); //and don't exclude it from any pages
|
||||||
@ -8,15 +9,14 @@ DMSDocumentAddController::add_allowed_extensions(); //add an array of additional
|
|||||||
|
|
||||||
define('DMS_DIR', 'dms');
|
define('DMS_DIR', 'dms');
|
||||||
|
|
||||||
|
|
||||||
if (!file_exists(BASE_PATH . DIRECTORY_SEPARATOR . DMS_DIR)) user_error("DMS directory named incorrectly. Please install the DMS module into a folder named: ".DMS_DIR);
|
if (!file_exists(BASE_PATH . DIRECTORY_SEPARATOR . DMS_DIR)) user_error("DMS directory named incorrectly. Please install the DMS module into a folder named: ".DMS_DIR);
|
||||||
|
|
||||||
CMSMenu::remove_menu_item('DMSDocumentAddController');
|
CMSMenu::remove_menu_item('DMSDocumentAddController');
|
||||||
|
|
||||||
ShortcodeParser::get('default')->register('dms_document_link', array('DMSDocument_Controller', 'dms_link_shortcode_handler'));
|
ShortcodeParser::get('default')->register('dms_document_link', array('DMSDocument_Controller', 'dms_link_shortcode_handler'));
|
||||||
|
|
||||||
if (DMSDocument_versions::$enable_versions) {
|
if ($config->get('DMSDocument_versions', 'enable_versions')) {
|
||||||
//using the same db relations for the versioned documents, as for the actual documents
|
//using the same db relations for the versioned documents, as for the actual documents
|
||||||
Config::inst()->update('DMSDocument_versions', 'db', DMSDocument::$db);
|
$config->update('DMSDocument_versions', 'db', $config->get('DMSDocument', 'db'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
class DMSDocument extends DataObject implements DMSDocumentInterface {
|
class DMSDocument extends DataObject implements DMSDocumentInterface {
|
||||||
static $db = array(
|
private static $db = array(
|
||||||
"Filename" => "Varchar(255)", // eg. 3469~2011-energysaving-report.pdf
|
"Filename" => "Varchar(255)", // eg. 3469~2011-energysaving-report.pdf
|
||||||
"Folder" => "Varchar(255)", // eg. 0
|
"Folder" => "Varchar(255)", // eg. 0
|
||||||
"Title" => 'Varchar(1024)', // eg. "Energy Saving Report for Year 2011, New Zealand LandCorp"
|
"Title" => 'Varchar(1024)', // eg. "Energy Saving Report for Year 2011, New Zealand LandCorp"
|
||||||
@ -14,27 +14,27 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
|||||||
"ExpireAtDate" => 'SS_DateTime'
|
"ExpireAtDate" => 'SS_DateTime'
|
||||||
);
|
);
|
||||||
|
|
||||||
static $many_many = array(
|
private static $many_many = array(
|
||||||
'Pages' => 'SiteTree',
|
'Pages' => 'SiteTree',
|
||||||
'Tags' => 'DMSTag'
|
'Tags' => 'DMSTag'
|
||||||
);
|
);
|
||||||
|
|
||||||
static $many_many_extraFields = array(
|
private static $many_many_extraFields = array(
|
||||||
'Pages' => array(
|
'Pages' => array(
|
||||||
'DocumentSort' => 'Int'
|
'DocumentSort' => 'Int'
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
static $display_fields = array(
|
private static $display_fields = array(
|
||||||
'ID'=>'ID',
|
'ID'=>'ID',
|
||||||
'Title'=>'Title',
|
'Title'=>'Title',
|
||||||
'FilenameWithoutID'=>'Filename',
|
'FilenameWithoutID'=>'Filename',
|
||||||
'LastChanged'=>'LastChanged'
|
'LastChanged'=>'LastChanged'
|
||||||
);
|
);
|
||||||
|
|
||||||
static $singular_name = 'Document';
|
private static $singular_name = 'Document';
|
||||||
|
|
||||||
static $plural_name = 'Documents';
|
private static $plural_name = 'Documents';
|
||||||
|
|
||||||
|
|
||||||
public function canView($member = null) {
|
public function canView($member = null) {
|
||||||
|
@ -6,37 +6,37 @@
|
|||||||
*/
|
*/
|
||||||
class DMSDocument_versions extends DataObject {
|
class DMSDocument_versions extends DataObject {
|
||||||
|
|
||||||
static $enable_versions = true; //flag that turns on or off versions of documents when replacing them
|
public static $enable_versions = true; //flag that turns on or off versions of documents when replacing them
|
||||||
|
|
||||||
static $db = array(
|
private static $db = array(
|
||||||
'VersionCounter' => 'Int',
|
'VersionCounter' => 'Int',
|
||||||
'VersionViewCount' => 'Int'
|
'VersionViewCount' => 'Int'
|
||||||
); //config system call in _config creates this to mirror DMSDocument
|
); //config system call in _config creates this to mirror DMSDocument
|
||||||
|
|
||||||
static $has_one = array(
|
private static $has_one = array(
|
||||||
'Document' => 'DMSDocument' //ID of the original DMSDocument object this is a version of
|
'Document' => 'DMSDocument' //ID of the original DMSDocument object this is a version of
|
||||||
);
|
);
|
||||||
|
|
||||||
static $defaults = array(
|
private static $defaults = array(
|
||||||
'VersionCounter' => 0
|
'VersionCounter' => 0
|
||||||
);
|
);
|
||||||
|
|
||||||
static $display_fields = array(
|
private static $display_fields = array(
|
||||||
'VersionCounter' => 'Version Counter',
|
'VersionCounter' => 'Version Counter',
|
||||||
'FilenameWithoutID' => 'Filename',
|
'FilenameWithoutID' => 'Filename',
|
||||||
'LastChanged' => 'Last Changed'
|
'LastChanged' => 'Last Changed'
|
||||||
);
|
);
|
||||||
|
|
||||||
static $summary_fields = array(
|
private static $summary_fields = array(
|
||||||
'VersionCounter',
|
'VersionCounter',
|
||||||
'FilenameWithoutID'
|
'FilenameWithoutID'
|
||||||
);
|
);
|
||||||
|
|
||||||
static $field_labels = array(
|
private static $field_labels = array(
|
||||||
'FilenameWithoutID'=>'Filename'
|
'FilenameWithoutID'=>'Filename'
|
||||||
);
|
);
|
||||||
|
|
||||||
static $default_sort = array(
|
private static $default_sort = array(
|
||||||
'LastChanged' => 'DESC'
|
'LastChanged' => 'DESC'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -210,4 +210,4 @@ class DMSDocument_versions extends DataObject {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
class DMSSiteTreeExtension extends DataExtension {
|
class DMSSiteTreeExtension extends DataExtension {
|
||||||
|
|
||||||
static $belongs_many_many = array(
|
private static $belongs_many_many = array(
|
||||||
'Documents' => 'DMSDocument'
|
'Documents' => 'DMSDocument'
|
||||||
);
|
);
|
||||||
|
|
||||||
static $noDocumentsList = array();
|
private static $noDocumentsList = array();
|
||||||
static $showDocumentsList = array();
|
private static $showDocumentsList = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do not show the documents tab on the array of pages set here
|
* Do not show the documents tab on the array of pages set here
|
||||||
@ -153,4 +153,4 @@ class DMSSiteTreeExtension extends DataExtension {
|
|||||||
function getTitleWithNumberOfDocuments() {
|
function getTitleWithNumberOfDocuments() {
|
||||||
return $this->owner->Title . ' (' . $this->owner->Documents()->Count() . ')';
|
return $this->owner->Title . ' (' . $this->owner->Documents()->Count() . ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
*/
|
*/
|
||||||
class DMSTag extends DataObject {
|
class DMSTag extends DataObject {
|
||||||
|
|
||||||
static $db = array(
|
private static $db = array(
|
||||||
'Category' => 'Varchar(1024)',
|
'Category' => 'Varchar(1024)',
|
||||||
'Value' => 'Varchar(1024)',
|
'Value' => 'Varchar(1024)',
|
||||||
'MultiValue' => 'Boolean(1)'
|
'MultiValue' => 'Boolean(1)'
|
||||||
);
|
);
|
||||||
|
|
||||||
static $belongs_many_many = array(
|
private static $belongs_many_many = array(
|
||||||
'Documents' => 'DMSDocument'
|
'Documents' => 'DMSDocument'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user