- Timestamp:
- 12/24/09 00:13:34 (2 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
-
common/db/round.php (modified) (1 diff)
-
common/db/user.php (modified) (2 diffs)
-
common/task.php (modified) (1 diff)
-
scripts/benchmark (modified) (1 diff)
-
scripts/migrate-authors-to-task-tags (modified) (1 diff)
-
www/controllers/task.php (modified) (2 diffs)
-
www/controllers/task_tags.php (modified) (2 diffs)
-
www/macros/macro_taskparam.php (modified) (4 diffs)
-
www/macros/macro_tasks.php (modified) (2 diffs)
-
www/url.php (modified) (1 diff)
-
www/views/task_tags.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/db/round.php
r1010 r1094 84 84 "task.`order` AS `order`, ". 85 85 "task.`title` AS `title`, ". 86 "task.`author` AS `author`, ".87 86 "task.`page_name` AS `page_name`, ". 88 87 "task.`source` AS `source`, ". -
trunk/common/db/user.php
r1091 r1094 16 16 log_assert_valid(user_validate($user)); 17 17 mem_cache_set("user-by-name:{$user['username']}", $user); 18 mem_cache_set("user-by-id:{$user[' username']}", $user);18 mem_cache_set("user-by-id:{$user['id']}", $user); 19 19 } 20 20 return $user; … … 25 25 log_assert_valid(user_validate($user)); 26 26 mem_cache_delete("user-by-name:{$user['username']}"); 27 mem_cache_delete("user-by-id:{$user[' username']}");27 mem_cache_delete("user-by-id:{$user['id']}"); 28 28 } 29 29 -
trunk/common/task.php
r1081 r1094 54 54 // User stuff. ugly 55 55 if (is_null($user)) { 56 $task['author'] = 'Unknown';57 56 $task['user_id'] = 0; 58 57 } else { 59 $task['author'] = $user['full_name'];60 58 $task['user_id'] = $user['id']; 61 59 } -
trunk/scripts/benchmark
r1001 r1094 8 8 // URLs to benchmark 9 9 $benchmark_urls = array( 10 IA_URL . "arhiva", 10 11 IA_URL . "utilizator/domino?action=download&file=avatar&resize=L32x32", 11 12 IA_URL . "template/preoni-2006?action=download&file=hlogo.gif", -
trunk/scripts/migrate-authors-to-task-tags
r1085 r1094 109 109 } 110 110 111 db_query("ALTER TABLE ia_task DROP COLUMN author"); 112 111 113 ?> -
trunk/www/controllers/task.php
r1089 r1094 145 145 if (!$errors) { 146 146 // FIXME: error handling? Is that even remotely possible in php? 147 task_update($new_task); 147 148 task_update_parameters($task_id, $new_task_params); 148 149 … … 159 160 } 160 161 } 161 $new_task["author"] = tag_build_list("task", $new_task["id"], "author"); 162 task_update($new_task); 162 mem_cache_delete("task-authors-by-id:".$new_task["id"]); 163 163 164 164 flash("Task-ul a fost modificat cu succes."); -
trunk/www/controllers/task_tags.php
r1085 r1094 114 114 115 115 $tag["name"] = $new_name; 116 // Check that the new tag doesn't already exist. 116 117 if (tag_get_id($tag)) { 117 118 flash_error("Tagul deja exista."); … … 119 120 } 120 121 tag_update_by_id($tag_id, $tag); 122 // Clear author cache for all tasks tagged with the tag. 123 if ($tag["type"] == "author") { 124 $task_ids = tag_get_objects("task", array($tag_id), false); 125 foreach ($task_ids as $task_id) { 126 mem_cache_delete("task-authors-by-id:".$task_id["id"]); 127 } 128 } 129 121 130 flash("Tag-ul a fost redenumit."); 122 131 redirect(url_task_tags()); -
trunk/www/macros/macro_taskparam.php
r996 r1094 3 3 require_once(IA_ROOT_DIR . "common/db/task.php"); 4 4 require_once(IA_ROOT_DIR . "common/db/user.php"); 5 require_once(IA_ROOT_DIR."www/format/format.php"); 5 require_once(IA_ROOT_DIR . "common/db/tags.php"); 6 require_once(IA_ROOT_DIR . "common/cache.php"); 7 require_once(IA_ROOT_DIR . "www/format/format.php"); 6 8 7 9 // Displays a task field, be it a hard-coded field such as task author or a grader parameter such as `timelimit`. … … 35 37 36 38 $task = task_get($task_id); 37 if ($task) {38 $params = task_get_parameters($task_id);39 }40 39 41 40 // validate task id … … 53 52 54 53 case 'author': 55 return html_escape($task['author']); 54 $authors = mem_cache_get("task-authors-by-id:".$task["id"]); 55 if ($authors === false) { 56 $authors = tag_get("task", $task["id"], "author"); 57 mem_cache_set("task-authors-by-id:".$task["id"], $authors); 58 } 59 function format_author($tag) { 60 return format_link(url_task_search(array($tag["id"])), $tag["name"]); 61 } 62 return implode(", ", array_map('format_author', $authors)); 56 63 57 64 case 'source': 65 // TODO: This should also be converted into tags. 58 66 return html_escape($task['source']); 59 67 … … 80 88 81 89 default: 90 $params = task_get_parameters($task_id); 82 91 if (!isset($params[$param])) { 83 92 if (isset($args['default_value'])) { -
trunk/www/macros/macro_tasks.php
r937 r1094 23 23 } 24 24 return $title; 25 } 26 27 function format_single_author($tag) { 28 return format_link(url_task_search(array($tag["id"])), $tag["name"]); 29 } 30 function format_author($row) { 31 $authors = mem_cache_get("task-authors-by-id:".$row["id"]); 32 if ($authors === false) { 33 $authors = tag_get("task", $row["id"], "author"); 34 mem_cache_set("task-authors-by-id:".$row["id"], $authors); 35 } 36 return implode(", ", array_map('format_single_author', $authors)); 25 37 } 26 38 … … 146 158 'title' => 'Autor', 147 159 'css_class' => 'author', 148 ' key' => 'author',160 'rowform' => 'format_author', 149 161 ); 150 162 } -
trunk/www/url.php
r1086 r1094 266 266 } 267 267 268 function url_task_search($tag_ids) { 269 // STUB 270 return "#" . implode("#", array_map('html_escape', $tag_ids)); 271 } 272 268 273 function url_task_list($page_name, $filter = null) { 269 274 $args = $filter ? array('filtru' => $filter) : array(); -
trunk/www/views/task_tags.php
r1085 r1094 14 14 ), 15 15 $row["name"], "Redenumește"); 16 $tag .= ' <a class="algorithm_tag" href="#">' . html_escape($row["name"]) . '</a>'; 16 $tag .= ' '.format_link( 17 url_task_search(array($row["id"])), $row["name"], true, 18 array("class" => "algorithm_tag") 19 ); 17 20 return $tag; 18 21 }
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)