示例#1
0
文件: compare.php 项目: rair/yacs
    // end of the form
    $context['text'] .= '</div></form>';
    // set the focus
    Page::insert_script('$("#original").focus();');
    // the original script has to be there
} elseif (!file_exists($context['path_to_root'] . $original)) {
    Logger::error(sprintf(i18n::s('Script %s does not exist'), $original));
    // the updatred script has to be there
} elseif (!file_exists($context['path_to_root'] . $updated)) {
    Logger::error(sprintf(i18n::s('Script %s does not exist'), $updated));
    // analyze two scripts
} else {
    // print the result of the analysis
    include_once 'scripts.php';
    if ($format == 'tabular') {
        $text = Scripts::diff($original, $updated);
        // the button to see the gdiff format
        $context['text'] .= '<div style="float:left;"><form method="post" action="' . $context['script_url'] . '">';
        $context['text'] .= '<input type="hidden" name="original" value="' . encode_field($original) . '" />';
        $context['text'] .= '<input type="hidden" name="updated" value="' . encode_field($updated) . '" />';
        $context['text'] .= '<input type="hidden" name="format" value="gdiff" />';
        $context['text'] .= Skin::build_submit_button(i18n::s('gdiff'));
        $context['text'] .= '</form></div>';
        // the button to see the merge format
        $context['text'] .= '<div style="float:left;"><form method="post" action="' . $context['script_url'] . '">';
        $context['text'] .= '<input type="hidden" name="original" value="' . encode_field($original) . '" />';
        $context['text'] .= '<input type="hidden" name="updated" value="' . encode_field($updated) . '" />';
        $context['text'] .= '<input type="hidden" name="format" value="merge" />';
        $context['text'] .= Skin::build_submit_button(i18n::s('Merge'));
        $context['text'] .= '</form></div>';
        $context['text'] .= '<br style="clear:left;" />' . "\n";