Changeset 1097 for trunk


Ignore:
Timestamp:
12/27/09 01:24:58 (2 years ago)
Author:
bogdan2412
Message:

Admin edit button on task pages

Done by Toni. Solves ticket #308.
Review URL: http://reviewboard.infoarena.ro/r/129

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/common/security.php

    r1091 r1097  
    211211 
    212212    // Forward security to task. 
    213     if (preg_match("/^ \s* task: \s* (".IA_RE_TASK_ID.") \s* $/xi", $textsec, $matches)) { 
     213    if (($task_id = textblock_security_is_task($textsec))) { 
    214214        require_once(IA_ROOT_DIR . "common/db/task.php"); 
    215         $task = task_get($matches[1]); 
     215        $task = task_get($task_id); 
    216216        if ($task === null) { 
    217217            log_warn("Bad security descriptor, ask an admin."); 
     
    310310    // Convert action into a grader action if the textblock is a task 
    311311    // textblock and the attachment has the grader_ prefix. 
    312     if (preg_match("/^ \s* task: \s* (".IA_RE_TASK_ID.") \s* $/xi", $tb["security"]) && 
     312    if (textblock_security_is_task($tb['security']) && 
    313313        preg_match('/^grader\_/', $att_name)) { 
    314314        $newaction = preg_replace('/^attach/', 'grader', $action); 
  • trunk/common/textblock.php

    r1079 r1097  
    188188} 
    189189 
     190// Checks if the textblock is task and return the task_id if true or false if false 
     191function textblock_security_is_task($textblock) { 
     192    if (preg_match("/^ \s* task: \s* (".IA_RE_TASK_ID.") \s* $/xi", $textblock, $matches)) { 
     193        return $matches[1]; 
     194    } 
     195    return false; 
     196} 
     197 
    190198?> 
  • trunk/www/views/textblock_header.php

    r955 r1097  
    1010<div id="wikiOps"> 
    1111    <ul> 
     12<?php if (($task_id = textblock_security_is_task($textblock['security'])) && identity_can('task-edit', $task = task_get($task_id))) { ?> 
     13<li><?= format_link_access(url_task_edit($task['id']), 'Editeaza parametrii', 'p') ?></li> 
     14<?php } ?> 
     15<?php if ($task_id && identity_can('task-tag', $task)) { ?> 
     16<li><?= format_link_access(url_task_edit_tags($task['id']), 'Editeaza tag-uri', 't') ?></li> 
     17<?php } ?> 
    1218<?php if (identity_can('textblock-edit', $textblock)) { ?> 
    13 <li><?= format_link_access(url_textblock_edit($textblock['name']), 'Editeaza', 'e') ?></li> 
     19<li><?= format_link_access(url_textblock_edit($textblock['name']), ($task_id) ? 'Editeaza enunt' :'Editeaza', 'e') ?></li> 
    1420<?php } ?> 
    1521<?php if (identity_can('textblock-history', $textblock)) { ?> 
Note: See TracChangeset for help on using the changeset viewer.