CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#1856] Add new sub pages only to pages where you have edit permission

avatar
Created By: Simon (simonschaufi)
Date Submitted: 2007-10-06 08:48

Assigned To:
Resolution: None
State: Closed
Summary:
Add new sub pages only to pages where you have edit permission
Detailed Description:
please replace this function in class.contentoperations.inc.php:

function CreateHierarchyDropdown($current = '', $parent = '', $name =
'parent_id')
        {
                $userid = get_userid(); //added
               
                $result = '';

                $allcontent =& ContentOperations::GetAllContent();

                if ($allcontent !== FALSE && count($allcontent) > 0)
                {
                        $result .= '<select name="'.$name.'">';
                       
if(check_permission(get_userid(), 'Modify Any Page')){
//added
                                $result .= '<option value="-1">None</option>';
                        } //added
                       
                        $curhierarchy = '';

                        foreach ($allcontent as $one)
                        {
                                if ($one->Id() == $current)
                                {
#Grab hierarchy just in case we need to
check children
                                        #(which will always be after)
                                        $curhierarchy = $one->Hierarchy();

#Then jump out.  We don't want ourselves
in the list.
                                        continue;
                                }
#If it's a child of the current, we don't want
to show it as it
                                #could cause a deadlock.
if ($curhierarchy != '' &&
strstr($one->Hierarchy() . '.', $curhierarchy . '.') == $one->Hierarchy() . '.')
                                {
                                        continue;
                                }
                               
if(in_array($userid,
$one->GetAdditionalEditors()) || $userid == $one->Owner() ||
check_permission(get_userid(), 'Modify Any Page')){ //added
#Don't include content types that do not
want children either...
                                        if ($one->WantsChildren() == true)
                                        {
$result .= '<option
value="'.$one->Id().'"';

#Select current parent if it
exists
                                                if ($one->Id() == $parent)
                                                {
$result .= '
selected="selected"';
                                                }

$result .=
'>'.$one->Hierarchy().'. - '.$one->Name().'</option>';
                                        }
                                } //added
                        }

                        $result .= '</select>';
                }

                return $result;
        } 

History

Comments
avatar
Date: 2011-03-04 13:40
Posted By: Ronny Krijt (ronnyk)

This is in, since several releases. Cleanup of forge, closing this tracker.
      
Updates

Updated: 2011-03-04 13:40
resolution_id: => 5
state: Open => Closed