Commit c3f631f6 authored by Mario's avatar Mario
Browse files

files_ng: implement tag removal

parent 3e593180
Pipeline #368911 passed with stage
in 1 minute and 57 seconds
......@@ -51,9 +51,7 @@ class Attach_edit extends Controller {
attach_change_permissions($channel['channel_id'], $resource, $x['allow_cid'], $x['allow_gid'], $x['deny_cid'], $x['deny_gid'], $recurse, true);
if ($categories) {
$cat = explode(',', $categories);
if ($cat) {
foreach($cat as $term) {
$term = trim(escape_tags($term));
......@@ -64,6 +62,13 @@ class Attach_edit extends Controller {
}
}
}
else {
q("DELETE FROM term WHERE uid = %d AND oid = %d AND otype = %d",
intval($channel['channel_id']),
intval($attach_id),
intval(TERM_OBJ_FILE)
);
}
$sync = attach_export_data($channel, $resource, false);
......
......@@ -269,19 +269,22 @@ class Browser extends DAV\Browser\Plugin {
intval(TERM_OBJ_FILE)
);
$categories = [];
if($terms) {
foreach($terms as $t) {
$term = htmlspecialchars($t['term'],ENT_COMPAT,'UTF-8',false) ;
if(! trim($term))
continue;
$categories[] = array('term' => $term, 'url' => $t['url']);
if ($terms_str)
$terms_str .= ',';
$terms_str .= $term;
}
$ft['terms'] = replace_macros(get_markup_template('item_categories.tpl'),array(
'$categories' => $categories
));
unset($categories);
}
// put the array for this file together
$ft['attachId'] = $id;
$ft['fileStorageUrl'] = substr($relPath, 0, strpos($relPath, "cloud/")) . "filestorage/" . $this->auth->owner_nick;
......@@ -316,7 +319,7 @@ class Browser extends DAV\Browser\Plugin {
$ft['folder'] = $r[0]['folder'];
$ft['revision'] = $r[0]['revision'];
$ft['newfilename'] = ['newfilename_' . $id, t('Change filename to'), $displayName];
$ft['categories'] = ['categories_' . $id, t('Add categories'), ''];
$ft['categories'] = ['categories_' . $id, t('Categories'), $terms_str];
// create a copy of the list which we can alter for the current resource
$folders = $folder_list;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment