Aleksander Machniak
2012-10-01 ab08544520cc47b8a63be1737d5d6edb02c511b4
Enable subscription option for already subscribed "virtual" folders,
small code improvements
1 files modified
14 ■■■■■ changed files
program/steps/settings/folders.inc 14 ●●●●● patch | view | raw | blame | history
program/steps/settings/folders.inc
@@ -299,8 +299,13 @@
        $disabled = (($protected && $subscribed) || $noselect);
        // Below we will disable subscription option for "virtual" folders
        // according to namespaces, but only if they aren't already subscribed.
        // User should be able to unsubscribe from the folder
        // even if it doesn't exists or is not accessible (OTRS:1000059)
        if (!$subscribed && !$disabled && !empty($namespace) && $folder['virtual']) {
        // check if the folder is a namespace prefix, then disable subscription option on it
        if (!$disabled && $folder['virtual'] && $folder['level'] == 0 && !empty($namespace)) {
            if (!$disabled && $folder['level'] == 0) {
            $fname = $folder['id'] . $delimiter;
            foreach ($namespace as $ns) {
                if (is_array($ns)) {
@@ -314,9 +319,7 @@
            }
        }
        // check if the folder is an other users virtual-root folder, then disable subscription option on it
        if (!$disabled && $folder['virtual'] && $folder['level'] == 1
            && !empty($namespace) && !empty($namespace['other'])
        ) {
            if (!$disabled && $folder['level'] == 1 && !empty($namespace['other'])) {
            $parts = explode($delimiter, $folder['id']);
            $fname = $parts[0] . $delimiter;
            foreach ($namespace['other'] as $item) {
@@ -327,7 +330,7 @@
            }
        }
        // check if the folder is shared, then disable subscription option on it (if not subscribed already)
        if (!$disabled && !$subscribed && $folder['virtual'] && !empty($namespace)) {
            if (!$disabled) {
            $tmp_ns = array_merge((array)$namespace['other'], (array)$namespace['shared']);
            foreach ($tmp_ns as $item) {
                if (strpos($folder['id'], $item[0]) === 0) {
@@ -336,6 +339,7 @@
                }
            }
        }
        }
        $table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes),
            'foldername' => $folder['id']));