function restore_stacktrace_by_file($stacktrace, $map_file) { $stack_info = get_stack_map($stacktrace); $stack = $stack_info->stack; $restore_map = get_restore_map($map_file); $map = array(); foreach ($stack as $info) { if (array_key_exists($info->method, $restore_map)) { $map[$info->method] = $restore_map[$info->method]; } } foreach ($map as $key => $value) { $stacktrace = str_replace($key, $key . '<~~' . $value . '~~>', $stacktrace); } return $stacktrace; }
function show_acra_detail_buttons_plugin() { require "ProjectAcraExt.php"; $id = gpc_get_string("id", ''); $t_bug = bug_get($id); $packages = get_project_package_list($t_bug->project_id); $t_bug_text = bug_get_text_field($id, 'description'); $t_restore_file = get_restore_file_by_version_name($t_bug->version); $restore_map = get_restore_map($t_restore_file); $t_bug_text = restore_stacktrace_by_map($t_bug_text, $restore_map); $t_bug_text = str_replace("\r", "", $t_bug_text); $bugnotes = bugnote_get_all_bugnotes($id); ?> <link rel="stylesheet" type="text/css" href="<?php echo plugin_file("chico.css"); ?> " /> <link rel="stylesheet" type="text/css" href="<?php echo plugin_file("acra_view_bug.css"); ?> " /> <script type="text/javascript" src="<?php echo plugin_file("acra_view_bug.js"); ?> "></script> <script type="text/javascript" src="<?php echo plugin_file("fancyBox/fancybox.js"); ?> "></script> <link rel="stylesheet" type="text/css" href="<?php echo plugin_file("fancyBox/fancybox.css"); ?> " media="screen"/> <style type="text/css"> .acra_popup { width: 800px; height: 400px; display: none; padding: 0px; } .acra_frame { width: 100%; height: 100%; } </style> <div id="acra_dialog" style="display:none"> <?php foreach ($bugnotes as $note) { if (strlen($note->note_attr) > 0) { echo '<div class="acra_popup" id="acra_'; echo sprintf("%06d", $note->note_attr); echo '" style="display: none;">'; echo '<iframe class="acra_frame" src="index.php?acra_page=detail.php&acra_id='; echo sprintf("%06d", $note->note_attr); echo '"></iframe></div>'; echo "\r\n"; } } ?> </div> <script> //update stack trace var packages = <?php echo json_encode(array_keys($packages)); ?> ; var list = jQuery(".category"); for (var i = 0; i < list.length; i++) { var e = list[i]; var txt = e.innerText; if ("Description" == txt) { e = e.nextSibling; e.innerHTML = acra_buildStacktraceDiv(<?php echo json_encode($t_bug_text); ?> , packages); break; } } //update notes var noteRow, noteCells, noteTextCell, restoredNoteHtml, acraDetailLink; <?php foreach ($bugnotes as $note) { $t_bug_text = restore_stacktrace_by_map($note->note, $restore_map); $t_bug_text = json_encode($t_bug_text); ?> noteRow = document.getElementById('c<?php echo $note->id; ?> '); noteCells = noteRow.getElementsByClassName("bugnote-note-public"); noteTextCell = noteCells[0]; noteTextCell.innerHTML = acra_buildStacktraceDiv(<?php echo $t_bug_text; ?> , packages); <?php if (strlen($note->note_attr)) { ?> acraDetailLink = document.createElement("div"); acraDetailLink.innerHTML = '<a class="fancybox" href="#acra_<?php echo sprintf("%06d", $note->note_attr); ?> " class="button-small">Acra Detail</a>'; noteRow.firstElementChild.lastElementChild.appendChild(acraDetailLink); <?php } ?> <?php } ?> var cells = jQuery("td"); var reg = new RegExp(/^\s*ID\s*$/); var idCell = null; for (var i = 0; i < cells.length; i++) { var str = cells[i].innerText; if (reg.test(str)) { idCell = cells[i]; break; } } if (idCell != null) { var shorts = idCell.parentElement.previousElementSibling.firstElementChild; jQuery(shorts).append('<span class="bracket-link">[ <a href="index.php?acra_page=test.php&acra_id=<?php echo gpc_get_string("id"); ?> ">View ACRA more info</a> ]</span>'); } jQuery('.fancybox').fancybox(); </script> <?php }