Changeset 1098


Ignore:
Timestamp:
12/27/09 02:42:00 (2 years ago)
Author:
bogdan2412
Message:

Admin edit button on round textblocks.

Done by Toni.
Review URL: http://reviewboard.infoarena.ro/r/130/

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/common/security.php

    r1097 r1098  
    222222 
    223223    // Forward security to round. 
    224     if (preg_match("/^ \s* round: \s* (".IA_RE_ROUND_ID.") \s* $/xi", $textsec, $matches)) { 
     224    if (($round_id = textblock_security_is_round($textsec))) { 
    225225        require_once(IA_ROOT_DIR . "common/db/round.php"); 
    226         $round = round_get($matches[1]); 
     226        $round = round_get($round_id); 
    227227        if ($round === null) { 
    228228            log_warn("Bad security descriptor, ask an admin."); 
  • trunk/common/textblock.php

    r1097 r1098  
    188188} 
    189189 
    190 // Checks if the textblock is task and return the task_id if true or false if false 
     190// Checks if the textblock is task and returns the task_id if true or false if false 
    191191function textblock_security_is_task($textblock) { 
    192192    if (preg_match("/^ \s* task: \s* (".IA_RE_TASK_ID.") \s* $/xi", $textblock, $matches)) { 
     
    196196} 
    197197 
     198// Checks if the textblock is round and returns the round_id if true or false if false 
     199function textblock_security_is_round($textblock) { 
     200    if (preg_match("/^ \s* round: \s* (".IA_RE_ROUND_ID.") \s* $/xi", $textblock, $matches)) { 
     201        return $matches[1]; 
     202    } 
     203    return false; 
     204} 
     205 
     206 
    198207?> 
  • trunk/www/views/textblock_header.php

    r1097 r1098  
    1616<li><?= format_link_access(url_task_edit_tags($task['id']), 'Editeaza tag-uri', 't') ?></li> 
    1717<?php } ?> 
     18<?php if (($round_id = textblock_security_is_round($textblock['security'])) && identity_can('round-edit', $round = round_get($round_id))) { ?> 
     19<li><?= format_link_access(url_round_edit($round['id']), 'Editeaza parametrii', 'p') ?></li> 
     20<?php } ?> 
    1821<?php if (identity_can('textblock-edit', $textblock)) { ?> 
    19 <li><?= format_link_access(url_textblock_edit($textblock['name']), ($task_id) ? 'Editeaza enunt' :'Editeaza', 'e') ?></li> 
     22<li><?= format_link_access(url_textblock_edit($textblock['name']), ($task_id) ? 'Editeaza enunt' : 'Editeaza', 'e') ?></li> 
    2023<?php } ?> 
    2124<?php if (identity_can('textblock-history', $textblock)) { ?> 
Note: See TracChangeset for help on using the changeset viewer.