Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
0f8b3f08
Commit
0f8b3f08
authored
Dec 15, 2009
by
Dongsheng Cai
Browse files
"MDL-19654, repository draft plugin removal"
parent
062d21cd
Changes
8
Hide whitespace changes
Inline
Side-by-side
repository/draft/db/access.php
deleted
100644 → 0
View file @
062d21cd
<?php
$capabilities
=
array
(
'repository/draft:view'
=>
array
(
'captype'
=>
'read'
,
'contextlevel'
=>
CONTEXT_SYSTEM
,
'legacy'
=>
array
(
'student'
=>
CAP_ALLOW
,
'teacher'
=>
CAP_ALLOW
,
'editingteacher'
=>
CAP_ALLOW
,
'admin'
=>
CAP_ALLOW
)
)
);
repository/draft/db/install.php
deleted
100755 → 0
View file @
062d21cd
<?php
function
xmldb_repository_draft_install
()
{
global
$CFG
;
$result
=
true
;
require_once
(
$CFG
->
dirroot
.
'/repository/lib.php'
);
$draft_plugin
=
new
repository_type
(
'draft'
,
array
(),
true
);
if
(
!
$id
=
$draft_plugin
->
create
(
true
))
{
$result
=
false
;
}
return
$result
;
}
repository/draft/db/upgrade.php
deleted
100755 → 0
View file @
062d21cd
<?php
function
xmldb_repository_draft_upgrade
(
$oldversion
)
{
global
$CFG
,
$DB
;
$dbman
=
$DB
->
get_manager
();
$result
=
true
;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return
$result
;
}
repository/draft/icon.png
deleted
100755 → 0
View file @
062d21cd
582 Bytes
repository/draft/repository.class.php
deleted
100755 → 0
View file @
062d21cd
<?php
/**
* repository_draft class
* This is a subclass of repository class
*
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
class
repository_draft
extends
repository
{
/**
* @param int $repositoryid
* @param int $context
* @param array $options
*/
public
function
__construct
(
$repositoryid
,
$context
=
SITEID
,
$options
=
array
())
{
parent
::
__construct
(
$repositoryid
,
$context
,
$options
);
}
/**
* @param boolean $ajax
* @return mixed
*/
public
function
print_login
()
{
return
$this
->
get_listing
();
}
/**
*
* @param string $path
* @param string $path not used by this plugin
* @return mixed
*/
public
function
get_listing
(
$path
=
'/'
,
$page
=
''
)
{
global
$CFG
,
$USER
,
$itemid
,
$OUTPUT
;
$ret
=
array
();
$ret
[
'dynload'
]
=
true
;
$ret
[
'nosearch'
]
=
true
;
$ret
[
'nologin'
]
=
true
;
$ret
[
'draftfiles'
]
=
true
;
$list
=
array
();
if
(
empty
(
$path
))
{
$path
=
'/'
;
}
$fs
=
get_file_storage
();
$user_context
=
get_context_instance
(
CONTEXT_USER
,
$USER
->
id
);
$files
=
$fs
->
get_directory_files
(
$user_context
->
id
,
'user_draft'
,
$itemid
,
$path
,
false
);
foreach
(
$files
as
$file
)
{
if
(
$file
->
get_filename
()
!=
'.'
)
{
$node
=
array
(
'title'
=>
$file
->
get_filename
(),
'size'
=>
0
,
'date'
=>
''
,
'source'
=>
$file
->
get_id
(),
'thumbnail'
=>
$OUTPUT
->
old_icon_url
(
'f/text-32'
)
);
$list
[]
=
$node
;
}
else
{
$foldername
=
explode
(
'/'
,
trim
(
$file
->
get_filepath
(),
'/'
));
$foldername
=
trim
(
array_pop
(
$foldername
),
'/'
);
$node
=
array
(
'title'
=>
$foldername
,
'size'
=>
0
,
'date'
=>
''
,
'path'
=>
$file
->
get_filepath
(),
'children'
=>
array
(),
'thumbnail'
=>
$OUTPUT
->
old_icon_url
(
'f/folder-32'
)
);
$list
[]
=
$node
;
}
}
$ret
[
'list'
]
=
$list
;
return
$ret
;
}
/**
* Return draft files information
*
* @global object $USER
* @param string $fid file id
* @param string $title
* @param string $itemid
* @return string the location of the file
*/
public
function
move_to_draft
(
$fid
,
$title
=
''
,
$itemid
=
''
)
{
global
$USER
;
$ret
=
array
();
$browser
=
get_file_browser
();
$user_context
=
get_context_instance
(
CONTEXT_USER
,
$USER
->
id
);
$ret
[
'itemid'
]
=
$itemid
;
$ret
[
'title'
]
=
$title
;
$ret
[
'contextid'
]
=
$user_context
->
id
;
return
$ret
;
}
/**
*
* @return string repository name
*/
public
function
get_name
(){
return
get_string
(
'repositoryname'
,
'repository_draft'
);;
}
public
function
supported_returntypes
()
{
return
(
FILE_INTERNAL
|
FILE_EXTERNAL
);
}
}
repository/draft/version.php
deleted
100755 → 0
View file @
062d21cd
<?php
$plugin
->
version
=
2009080101
;
repository/repository.src.js
View file @
0f8b3f08
...
...
@@ -1073,7 +1073,8 @@ repository_client.end = function(client_id, obj) {
repository_client
.
files
[
client_id
]
=
0
;
}
if
(
fp
.
env
==
'
filepicker
'
)
{
fp
.
target
.
value
=
obj
[
'
id
'
];
if
(
fp
.
target
)
fp
.
target
.
value
=
obj
[
'
id
'
];
}
else
if
(
fp
.
env
==
'
editor
'
){
if
(
obj
[
'
type
'
]
==
'
link
'
)
{
fp
.
target
.
value
=
obj
[
'
url
'
]
+
'
#
'
+
new_filename
;
...
...
repository/repository_ajax.php
View file @
0f8b3f08
...
...
@@ -65,28 +65,6 @@
/// Check for actions that do not need repository ID
switch
(
$action
)
{
// delete a file from filemanger
case
'delete'
:
try
{
if
(
!
$context
=
get_context_instance
(
CONTEXT_USER
,
$USER
->
id
))
{
}
$contextid
=
$context
->
id
;
$fs
=
get_file_storage
();
if
(
$file
=
$fs
->
get_file
(
$contextid
,
'user_draft'
,
$itemid
,
'/'
,
$title
))
{
if
(
$result
=
$file
->
delete
())
{
echo
$client_id
;
}
else
{
echo
''
;
}
}
else
{
echo
''
;
}
exit
;
}
catch
(
repository_exception
$e
)
{
$err
->
e
=
$e
->
getMessage
();
die
(
json_encode
(
$err
));
}
break
;
case
'gsearch'
:
// Global Search
$params
=
array
();
$params
[
'context'
]
=
array
(
get_context_instance_by_id
(
$contextid
),
get_system_context
());
...
...
@@ -230,7 +208,7 @@ EOD;
case
'download'
:
try
{
// we have two special repoisitory type need to deal with
if
(
$repo
->
options
[
'type'
]
==
'local'
or
$repo
->
options
[
'type'
]
==
'draft'
)
{
if
(
$repo
->
options
[
'type'
]
==
'local'
)
{
$fileinfo
=
$repo
->
move_to_draft
(
$file
,
$title
,
$itemid
,
$save_path
);
$info
=
array
();
$info
[
'client_id'
]
=
$client_id
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment