includes/pageutils.php
changeset 103 a8891e108c95
parent 102 d807dcd7aed7
child 112 008b1c42be72
equal deleted inserted replaced
102:d807dcd7aed7 103:a8891e108c95
  1941               <p><select name="data[target_id_grp]">';
  1941               <p><select name="data[target_id_grp]">';
  1942         foreach ( $response['groups'] as $group )
  1942         foreach ( $response['groups'] as $group )
  1943         {
  1943         {
  1944           echo '<option value="' . $group['id'] . '">' . $group['name'] . '</option>';
  1944           echo '<option value="' . $group['id'] . '">' . $group['name'] . '</option>';
  1945         }
  1945         }
       
  1946         // page group selector
       
  1947         $groupsel = '';
       
  1948         if ( count($response['page_groups']) > 0 )
       
  1949         {
       
  1950           $groupsel = '<p><label><input type="radio" name="data[scope]" value="page_group" /> A group of pages</label></p>
       
  1951                        <p><select name="data[pg_id]">';
       
  1952           foreach ( $response['page_groups'] as $grp )
       
  1953           {
       
  1954             $groupsel .= '<option value="' . $grp['id'] . '">' . htmlspecialchars($grp['name']) . '</option>';
       
  1955           }
       
  1956           $groupsel .= '</select></p>';
       
  1957         }
       
  1958         
  1946         echo '</select></p>
  1959         echo '</select></p>
  1947               <p><label><input type="radio" name="data[target_type]" value="' . ACL_TYPE_USER . '" /> A specific user</label></p>
  1960               <p><label><input type="radio" name="data[target_type]" value="' . ACL_TYPE_USER . '" /> A specific user</label></p>
  1948               <p>' . $template->username_field('data[target_id_user]') . '</p>
  1961               <p>' . $template->username_field('data[target_id_user]') . '</p>
  1949               <p>What should this access rule control?</p>
  1962               <p>What should this access rule control?</p>
  1950               <p><label><input name="data[scope]" value="only_this" type="radio" checked="checked" /> Only this page</p>
  1963               <p><label><input name="data[scope]" value="only_this" type="radio" checked="checked" /> Only this page</p>
       
  1964               ' . $groupsel . '
  1951               <p><label><input name="data[scope]" value="entire_site" type="radio" /> The entire site</p>
  1965               <p><label><input name="data[scope]" value="entire_site" type="radio" /> The entire site</p>
  1952               <div style="margin: 0 auto 0 0; text-align: right;">
  1966               <div style="margin: 0 auto 0 0; text-align: right;">
  1953                 <input name="data[mode]" value="seltarget" type="hidden" />
  1967                 <input name="data[mode]" value="seltarget" type="hidden" />
  1954                 <input type="hidden" name="data[page_id]" value="' . $paths->cpage['urlname_nons'] . '" />
  1968                 <input type="hidden" name="data[page_id]" value="' . $paths->cpage['urlname_nons'] . '" />
  1955                 <input type="hidden" name="data[namespace]" value="' . $paths->namespace . '" />
  1969                 <input type="hidden" name="data[namespace]" value="' . $paths->namespace . '" />
  1997         else
  2011         else
  1998         {
  2012         {
  1999           echo '<h3>Create new rule</h3>';
  2013           echo '<h3>Create new rule</h3>';
  2000         }
  2014         }
  2001         $type  = ( $response['target_type'] == ACL_TYPE_GROUP ) ? 'group' : 'user';
  2015         $type  = ( $response['target_type'] == ACL_TYPE_GROUP ) ? 'group' : 'user';
  2002         $scope = ( $response['page_id'] ) ? 'this page' : 'this entire site';
  2016         $scope = ( $response['page_id'] ) ? ( $response['namespace'] == '__PageGroup' ? 'this group of pages' : 'this page' ) : 'this entire site';
  2003         echo 'This panel allows you to edit what the '.$type.' "'.$response['target_name'].'" can do on <b>'.$scope.'</b>. Unless you set a permission to "Deny", these permissions may be overridden by other rules.';
  2017         echo 'This panel allows you to edit what the '.$type.' "'.$response['target_name'].'" can do on <b>'.$scope.'</b>. Unless you set a permission to "Deny", these permissions may be overridden by other rules.';
  2004         echo $formstart;
  2018         echo $formstart;
  2005         $parser = $template->makeParserText( $response['template']['acl_field_begin'] );
  2019         $parser = $template->makeParserText( $response['template']['acl_field_begin'] );
  2006         echo $parser->run();
  2020         echo $parser->run();
  2007         $parser = $template->makeParserText( $response['template']['acl_field_item'] );
  2021         $parser = $template->makeParserText( $response['template']['acl_field_item'] );
  2045                 <input type="hidden" name="data[page_id]" value="'   . (( $response['page_id']   ) ? $response['page_id']   : 'false') . '" />
  2059                 <input type="hidden" name="data[page_id]" value="'   . (( $response['page_id']   ) ? $response['page_id']   : 'false') . '" />
  2046                 <input type="hidden" name="data[namespace]" value="' . (( $response['namespace'] ) ? $response['namespace'] : 'false') . '" />
  2060                 <input type="hidden" name="data[namespace]" value="' . (( $response['namespace'] ) ? $response['namespace'] : 'false') . '" />
  2047                 <input type="hidden" name="data[target_type]" value="' . $response['target_type'] . '" />
  2061                 <input type="hidden" name="data[target_type]" value="' . $response['target_type'] . '" />
  2048                 <input type="hidden" name="data[target_id]" value="' . $response['target_id'] . '" />
  2062                 <input type="hidden" name="data[target_id]" value="' . $response['target_id'] . '" />
  2049                 <input type="hidden" name="data[target_name]" value="' . $response['target_name'] . '" />
  2063                 <input type="hidden" name="data[target_name]" value="' . $response['target_name'] . '" />
  2050                 <input type="submit" value="Save changes" />&nbsp;&nbsp;<input type="submit" name="data[act_delete_rule]" value="Delete rule" style="color: #AA0000;" onclick="return confirm(\'Do you really want to delete this ACL rule?\');" />
  2064                 ' . ( ( $response['type'] == 'edit' ) ? '<input type="submit" value="Save changes" />&nbsp;&nbsp;<input type="submit" name="data[act_delete_rule]" value="Delete rule" style="color: #AA0000;" onclick="return confirm(\'Do you really want to delete this ACL rule?\');" />' : '<input type="submit" value="Create rule" />' ) . '
  2051               </div>';
  2065               </div>';
  2052         echo $formend;
  2066         echo $formend;
  2053         break;
  2067         break;
  2054       case 'error':
  2068       case 'error':
  2055         ob_end_clean();
  2069         ob_end_clean();
  2095         if ( $parms['scope'] == 'entire_site' || ( $parms['page_id'] == 'false' && $parms['namespace'] == 'false' ) )
  2109         if ( $parms['scope'] == 'entire_site' || ( $parms['page_id'] == 'false' && $parms['namespace'] == 'false' ) )
  2096         {
  2110         {
  2097           $parms['page_id']   = false;
  2111           $parms['page_id']   = false;
  2098           $parms['namespace'] = false;
  2112           $parms['namespace'] = false;
  2099         }
  2113         }
       
  2114         else if ( $parms['scope'] == 'page_group' )
       
  2115         {
       
  2116           $parms['page_id'] = $parms['pg_id'];
       
  2117           $parms['namespace'] = '__PageGroup';
       
  2118         }
  2100         
  2119         
  2101         break;
  2120         break;
  2102     }
  2121     }
  2103     
  2122     
  2104     if ( isset($parms['act_go_stage1']) )
  2123     if ( isset($parms['act_go_stage1']) )