src/snac/client/webui/WebUIExecutor.php
/**
     * Display MaybeSame Diff Page
     *
     * Fills the display object with the maybe-same diff page.  If the user has permission
     * and the server says that the constellations are mergeable, it will also add merge functionality.
     *
     * @param string[] $input Post/Get inputs from the webui
     * @param \snac\client\webui\display\Display $display The display object for page creation
     * @param boolean $forMerge optional Whether or not this display should include merging, default is false
     */
Display MaybeSame Diff Page
Fills the display object with the maybe-same diff page.  If the user has permission
and the server says that the constellations are mergeable, it will also add merge functionality.


Display MaybeSame Diff Page Fills the display object with the maybe - same diff page . If the user has permission and the server says that the constellations are mergeable it will also add merge functionality .
public function displayMaybeSameDiffPage(&$input, &$display, $forMerge=false) {
        $command = "constellation_diff";
        if ($forMerge)
            $command = "constellation_diff_merge";
        $query = array(
            "command" => $command,
            "constellationid1" => $input["constellationid1"],
            "constellationid2" => $input["constellationid2"]
        );
        $this->logger->addDebug("Sending query to the server", $query);
        $serverResponse = $this->connect->query($query);
        $this->logger->addDebug("Received server response", array($serverResponse));
        if (isset($serverResponse["intersection"])) {
            if ($forMerge === false || ($forMerge === true && $serverResponse["mergeable"] === true)) {
                $merging = $forMerge && $serverResponse["mergeable"];
                $mergeable = $serverResponse["mergeable"];
                $display->setTemplate("maybesame_diff_page");
                $displayData = array(
                    "constellation1" => $serverResponse["constellation1"],
                    "constellation2" => $serverResponse["constellation2"],
                    "intersection" => $serverResponse["intersection"],
                    "mergeable" => $mergeable,
                    "merging" => $merging
                );
                if (isset($serverResponse["assertion"]))
                    $displayData["assertion"] = $serverResponse["assertion"];
                if (\snac\Config::$DEBUG_MODE == true) {
                    $display->addDebugData("serverResponse", json_encode($serverResponse, JSON_PRETTY_PRINT));
                }
                $display->setData($displayData);
            } else {
                if (isset($serverResponse["assertion"])) {
                    $assert = new \snac\data\Assertion($serverResponse["assertion"]);
                    $message = "<p>Constellations were asserted to be different by <strong>" .
                        $assert->getUser()->getFullName() . "</strong>.  They gave the following reasoning for this assertion:</p>" .
                        $assert->getText();
                    $this->drawErrorPage(["error" => ["type" => "Constellation Merge Error", "message"=> $message]], $display);
                } else {
                    $this->drawErrorPage(["error" => ["type" => "Constellation Merge Error", "message"=> "Could not open both Constellations for editing to perform a merge."]], $display);
                }
            }
        } else {
            $this->logger->addDebug("Error page being drawn - no intersection");
            $this->drawErrorPage($serverResponse, $display);
        }
    }
public function displayMaybeSameDiffPage ( & $ input , & $ display , $ forMerge = false ) { $ command = " constellation_diff " ; if ( $ forMerge ) $ command = " constellation_diff_merge " ; $ query = array ( " command " => $ command , " constellationid1 " => $ input [ " constellationid1 " ] , " constellationid2 " => $ input [ " constellationid2 " ] ) ; $ this -> logger -> addDebug ( " Sending query to the server " , $ query ) ; $ serverResponse = $ this -> connect -> query ( $ query ) ; $ this -> logger -> addDebug ( " Received server response " , array ( $ serverResponse ) ) ; if ( isset ( $ serverResponse [ " intersection " ] ) ) { if ( $ forMerge === false || ( $ forMerge === true && $ serverResponse [ " mergeable " ] === true ) ) { $ merging = $ forMerge && $ serverResponse [ " mergeable " ] ; $ mergeable = $ serverResponse [ " mergeable " ] ; $ display -> setTemplate ( " maybesame_diff_page " ) ; $ displayData = array ( " constellation1 " => $ serverResponse [ " constellation1 " ] , " constellation2 " => $ serverResponse [ " constellation2 " ] , " intersection " => $ serverResponse [ " intersection " ] , " mergeable " => $ mergeable , " merging " => $ merging ) ; if ( isset ( $ serverResponse [ " assertion " ] ) ) $ displayData [ " assertion " ] = $ serverResponse [ " assertion " ] ; if ( \ snac \ Config :: $ DEBUG_MODE == true ) { $ display -> addDebugData ( " serverResponse " , json_encode ( $ serverResponse , JSON_PRETTY_PRINT ) ) ; } $ display -> setData ( $ displayData ) ; } else { if ( isset ( $ serverResponse [ " assertion " ] ) ) { $ assert = new \ snac \ data \ Assertion ( $ serverResponse [ " assertion " ] ) ; $ message = " <p>Constellations were asserted to be different by <strong> " . $ assert -> getUser ( ) -> getFullName ( ) . " </strong>.  They gave the following reasoning for this assertion:</p> " . $ assert -> getText ( ) ; $ this -> drawErrorPage ( [ " error " => [ " type " => " Constellation Merge Error " , " message " => $ message ] ] , $ display ) ; } else { $ this -> drawErrorPage ( [ " error " => [ " type " => " Constellation Merge Error " , " message " => " Could not open both Constellations for editing to perform a merge. " ] ] , $ display ) ; } } } else { $ this -> logger -> addDebug ( " Error page being drawn - no intersection " ) ; $ this -> drawErrorPage ( $ serverResponse , $ display ) ; } }
Display MaybeSame Diff Page
 Fills the display object with the maybe-same diff page.
Display MaybeSame Diff Page Fills the display object with the maybe - same diff page .
// Can only merge if the webUI has requested diff to merge (forMerge) and // the server says these two are mergeable // We were able to do the diff, the user wanted to merge, but the server told us we couldn't merge // We have a reason why