From: Maxious Date: Sat, 14 Jan 2012 09:31:24 +0000 Subject: Beginnings of visual conflict resolution X-Git-Url: https://maxious.lambdacomplex.org/git/?p=disclosr.git&a=commitdiff&h=2b921f90255f3b989b7ec071e310ebfe9dff3650 --- Beginnings of visual conflict resolution Former-commit-id: f8dfd63919aab30a6b99f6861e80a36b55f5af04 --- --- a/.gitmodules +++ b/.gitmodules @@ -7,4 +7,7 @@ [submodule "lib/springy"] path = lib/springy url = https://github.com/dhotson/springy.git +[submodule "lib/php-diff"] + path = lib/php-diff + url = https://github.com/chrisboulton/php-diff.git --- a/admin/import.php +++ b/admin/import.php @@ -1,6 +1,6 @@ create_db('disclosr-agencies'); } catch (SetteeRestClientException $e) { --- /dev/null +++ b/admin/resolveConflicts.php @@ -1,1 +1,43 @@ + + + + '; +require_once dirname(__FILE__) . '/../lib/php-diff/lib/Diff.php'; +// Generate a side by side diff +require_once dirname(__FILE__) . '/../lib/php-diff/lib/Diff/Renderer/Html/SideBySide.php'; +$renderer = new Diff_Renderer_Html_SideBySide; + + + +$db = $server->get_db('disclosr-agencies'); +$docs = Array(); +try { + $rows = $db->get_view("app", "getConflicts")->rows; + //print_r($rows); + foreach ($rows as $row) { + echo '

' . $row->id . '

'; + echo "Comparing " . $row->value[0] . " and " . $row->value[1]; + $docA = explode(",", json_encode($db->get($row->id . "?rev=" . $row->value[0]))); + $docB = explode(",", json_encode($db->get($row->id . "?rev=" . $row->value[1]))); + // Options for generating the diff + $options = array( + //'ignoreWhitespace' => true, + //'ignoreCase' => true, + ); + + // Initialize the diff class + $diff = new Diff($docA, $docB, $options); + echo $diff->Render($renderer); + } +} catch (SetteeRestClientException $e) { + setteErrorHandler($e); +} +include_footer(); +?> --- a/admin/verify.php +++ b/admin/verify.php @@ -1,6 +1,6 @@ get_db('disclosr-agencies'); --- a/include/common.inc.php +++ b/include/common.inc.php @@ -4,11 +4,9 @@ $basePath = ""; if (strstr($_SERVER['PHP_SELF'], "alaveteli/") - || strstr($_SERVER['PHP_SELF'], "myway/") + || strstr($_SERVER['PHP_SELF'], "admin/") || strstr($_SERVER['PHP_SELF'], "lib/") - || strstr($_SERVER['PHP_SELF'], "geo/") - || strstr($_SERVER['PHP_SELF'], "include/") - || strstr($_SERVER['PHP_SELF'], "servicealerts/")) + || strstr($_SERVER['PHP_SELF'], "include/")) $basePath = "../"; include_once ('couchdb.inc.php'); --- a/include/template.inc.php +++ b/include/template.inc.php @@ -1,6 +1,7 @@ @@ -18,11 +19,11 @@ Disclosr - - + + @@ -62,8 +63,8 @@ - - + + --- /dev/null +++ b/lib/php-diff