/**
 *	show a site to edit pages
 */
function controller_edit($args)
{
    handle_updates();
    // this is a good spot to log the server's php version as well
    log_msg('debug', 'controller_edit: running on php version ' . phpversion());
    // most of these checks are only necessary if the client calls
    // page/edit directly
    page_canonical($args[0][0]);
    $page = $args[0][0];
    if (!page_exists($page)) {
        log_msg('debug', 'controller_edit: page ' . quot($page) . ' does not exist, invoking controller_create_page');
        controller_create_page($args);
        return;
    }
    // create page on the fly
    load_modules('glue');
    default_html(true);
    html_add_js_var('$.glue.page', $page);
    html_add_css(base_url() . 'css/farbtastic.css', 2);
    html_add_css(base_url() . 'css/edit.css', 5);
    if (USE_MIN_FILES) {
        html_add_js(base_url() . 'js/jquery-ui-1.8.6.custom.min.js', 2);
    } else {
        html_add_js(base_url() . 'js/jquery-ui-1.8.6.custom.js', 2);
    }
    if (USE_MIN_FILES) {
        html_add_js(base_url() . 'js/farbtastic.min.js', 2);
    } else {
        html_add_js(base_url() . 'js/farbtastic.js', 2);
    }
    if (USE_MIN_FILES) {
        html_add_js(base_url() . 'js/jquery.xcolor-1.2.1.min.js', 2);
    } else {
        html_add_js(base_url() . 'js/jquery.xcolor-1.2.1.js', 2);
    }
    if (USE_MIN_FILES) {
        html_add_js(base_url() . 'js/edit.min.js', 4);
    } else {
        html_add_js(base_url() . 'js/edit.js', 4);
    }
    render_page(array('page' => $page, 'edit' => true));
    echo html_finalize();
    log_msg('debug', 'controller_edit: invoking check_auto_snapshot');
    check_auto_snapshot(array('page' => $page));
}
Beispiel #2
0
 $_SESSION["upload_folder"] = $folder;
 // store standard media folder in session
 // Insert the 1 FILE xxx record into the arrays used by function handle_updates()
 $glevels = array_merge(array("1"), $glevels);
 $tag = array_merge(array("FILE"), $tag);
 $islink = array_merge(array(0), $islink);
 $text = array_merge(array($folder . $filename), $text);
 if (!empty($pid)) {
     if (!isset($pgv_changes[$pid . "_" . $GEDCOM])) {
         $gedrec = find_gedcom_record($pid);
     } else {
         $gedrec = find_updated_record($pid);
     }
 }
 $newrec = "0 @{$pid}@ OBJE\n";
 $newrec = handle_updates($newrec);
 if (!$update_CHAN) {
     $newrec .= get_sub_record(1, "1 CHAN", $gedrec);
 }
 //print("[".$newrec."]");
 //-- look for the old record media in the file
 //-- if the old media record does not exist that means it was
 //-- generated at import and we need to append it
 if (replace_gedrec($pid, $newrec, $update_CHAN)) {
     AddToChangeLog("Media ID " . $pid . " successfully updated.");
 }
 if ($pid && $linktoid != "") {
     $link = linkMedia($pid, $linktoid, $level);
     if ($link) {
         AddToChangeLog("Media ID " . $pid . " successfully added to {$linktoid}.");
     }
/**
* Add new GEDCOM lines from the $xxxRest interface update arrays, which
* were produced by the splitSOUR() function.
*
* See the handle_updates() function for details.
*
*/
function updateRest($inputRec, $levelOverride = "no")
{
    global $glevels, $tag, $islink, $text;
    global $glevelsSOUR, $tagSOUR, $islinkSOUR, $textSOUR;
    global $glevelsRest, $tagRest, $islinkRest, $textRest;
    if (count($tagRest) == 0) {
        return $inputRec;
    }
    // No update required
    // Save original interface update arrays before replacing them with the xxxRest ones
    $glevelsSave = $glevels;
    $tagSave = $tag;
    $islinkSave = $islink;
    $textSave = $text;
    $glevels = $glevelsRest;
    $tag = $tagRest;
    $islink = $islinkRest;
    $text = $textRest;
    $myRecord = handle_updates($inputRec, $levelOverride);
    // Now do the update
    // Restore the original interface update arrays (just in case ...)
    $glevels = $glevelsSave;
    $tag = $tagSave;
    $islink = $islinkSave;
    $text = $textSave;
    return $myRecord;
}
Beispiel #4
0
     $controller->setPageTitle($person->getFullName() . ' - ' . WT_I18N::translate('Add a wife using an existing individual'));
 }
 $controller->pageHeader();
 if ($person->getSex() == 'M') {
     $gedcom = "0 @new@ FAM\n1 HUSB @" . $person->getXref() . "@\n1 WIFE @" . $spouse->getXref() . "@";
 } else {
     $gedcom = "0 @new@ FAM\n1 HUSB @" . $spouse->getXref() . "@\n1 WIFE @" . $person->getXref() . "@";
 }
 splitSOUR();
 $gedcom .= addNewFact('MARR');
 if (WT_Filter::postBool('SOUR_FAM') || count($tagSOUR) > 0) {
     // before adding 2 SOUR it needs to add 1 MARR Y first
     if (addNewFact('MARR') == '') {
         $gedcom .= "\n1 MARR Y";
     }
     $gedcom = handle_updates($gedcom);
 } else {
     // before adding level 2 facts it needs to add 1 MARR Y first
     if (addNewFact('MARR') == '') {
         $gedcom .= "\n1 MARR Y";
     }
     $gedcom = updateRest($gedcom);
 }
 $family = WT_GedcomRecord::createRecord($gedcom, WT_GED_ID);
 $person->createFact('1 FAMS @' . $family->getXref() . '@', true);
 $spouse->createFact('1 FAMS @' . $family->getXref() . '@', true);
 $controller->addInlineJavascript('closePopupAndReloadParent();');
 break;
 ////////////////////////////////////////////////////////////////////////////////
 // Create a new source record
 ////////////////////////////////////////////////////////////////////////////////
 case 'addopfchildaction':
     if (PGV_DEBUG) {
         phpinfo(INFO_VARIABLES);
     }
     splitSOUR();
     // separate SOUR record from the rest
     $newindixref = get_new_xref('INDI');
     $newfamxref = get_new_xref('FAM');
     $gedrec = "0 @{$newindixref}@ INDI\n1 FAMC @{$newfamxref}@\n" . addNewName() . addNewSex();
     if (preg_match_all('/([A-Z0-9_]+)/', $QUICK_REQUIRED_FACTS, $matches)) {
         foreach ($matches[1] as $match) {
             $gedrec .= addNewFact($match);
         }
     }
     if (safe_POST_bool('SOUR_INDI')) {
         $gedrec = handle_updates($gedrec);
     } else {
         $gedrec = updateRest($gedrec);
     }
     $famrec = "0 @{$newfamxref}@ FAM\n1 CHIL @{$newindixref}@";
     $person = Person::getInstance($pid);
     if ($person->getSex() == 'F') {
         $famrec .= "\n1 WIFE @{$pid}@";
     } else {
         $famrec .= "\n1 HUSB @{$pid}@";
     }
     if (!isset($pgv_changes[$pid . "_" . PGV_GEDCOM])) {
         $indirec = find_gedcom_record($pid, PGV_GED_ID);
     } else {
         $indirec = find_updated_record($pid, PGV_GED_ID);
     }