Example #1
0
     if (empty($_POST['password'])) {
         lovd_errorAdd('password', 'Please fill in the \'Enter your password for authorization\' field.');
     }
     // User had to enter his/her password for authorization.
     if ($_POST['password'] && !lovd_verifyPassword($_POST['password'], $_AUTH['password'])) {
         lovd_errorAdd('password', 'Please enter your correct password for authorization.');
     }
     if (!lovd_error()) {
         $_DATA->deleteEntry($nID);
         // Write to log...
         lovd_writeLog('Event', LOG_EVENT, 'Deleted announcement ' . $nID . ' (' . $zData['type'] . ') - ' . lovd_shortenString(strip_tags($zData['announcement']), 150));
         // Thank the user...
         header('Refresh: 3; url=' . lovd_getInstallURL() . $_PE[0]);
         $_T->printHeader();
         $_T->printTitle();
         lovd_showInfoTable('Successfully deleted the announcement!', 'success');
         $_T->printFooter();
         exit;
     } else {
         // Because we're sending the data back to the form, I need to unset the password fields!
         unset($_POST['password']);
     }
 }
 $_T->printHeader();
 $_T->printTitle();
 lovd_errorPrint();
 // Table.
 print '      <FORM action="' . CURRENT_PATH . '?' . ACTION . '" method="post">' . "\n";
 // Array which will make up the form table.
 $aForm = array(array('POST', '', '', '', '50%', '14', '50%'), array('Deleting announcement', '', 'print', lovd_shortenString(htmlspecialchars($zData['announcement']), 150)), 'skip', array('Enter your password for authorization', '', 'password', 'password', 20), array('', '', 'submit', 'Delete announcement'));
 lovd_viewForm($aForm);
Example #2
0
        $_GET['search_transcriptid'] = $nTranscriptID;
        $sMessage = 'The variants shown are described using the ' . $sTranscript . ' transcript reference sequence.';
    } else {
        // Create select box.
        // We would like to be able to link to this list, focussing on a certain transcript but without restricting the viewer, by sending a (numeric) get_transcriptid search term.
        if (!isset($_GET['search_transcriptid']) || !isset($aTranscripts[$_GET['search_transcriptid']])) {
            $_GET['search_transcriptid'] = $nTranscriptID;
        }
        $sSelect = '<SELECT id="change_transcript" onchange="$(\'input[name=\\\'search_transcriptid\\\']\').val($(this).val()); lovd_AJAX_viewListSubmit(\'' . $sViewListID . '\');">';
        foreach ($aTranscripts as $nTranscriptID => $sTranscript) {
            $sSelect .= '<OPTION value="' . $nTranscriptID . '"' . ($_GET['search_transcriptid'] != $nTranscriptID ? '' : ' selected') . '>' . $sTranscript . '</OPTION>';
        }
        $sTranscript = $sSelect . '</SELECT>';
        $sMessage = 'The variants shown are described using the ' . $sTranscript . ' transcript reference sequence.';
    }
    if (FORMAT == 'text/html') {
        lovd_showInfoTable($sMessage);
    }
    if ($nTranscripts > 0) {
        require ROOT_PATH . 'class/object_custom_viewlists.php';
        $_DATA = new LOVD_CustomViewList(array('VariantOnTranscript', 'VariantOnGenome', 'Screening', 'Individual'), $sGene);
        $_DATA->viewList($sViewListID, array('chromosome'), false, false, $_AUTH['level'] >= LEVEL_CURATOR, false, true);
        // Notes for the variant listings...
        if (!empty($_SETT['currdb']['note_listing'])) {
            print $_SETT['currdb']['note_listing'] . '<BR><BR>' . "\n\n";
        }
    }
    lovd_printGeneFooter();
    $_T->printFooter();
    exit;
}
Example #3
0
         lovd_errorAdd('password', 'Please fill in the \'Enter your password for authorization\' field.');
     }
     // User had to enter his/her password for authorization.
     if ($_POST['password'] && !lovd_verifyPassword($_POST['password'], $_AUTH['password'])) {
         lovd_errorAdd('password', 'Please enter your correct password for authorization.');
     }
     if (!lovd_error()) {
         // Query text.
         $_DATA->deleteEntry($sColumnID);
         // Write to log...
         lovd_writeLog('Event', LOG_EVENT, 'Deleted column ' . $sColumnID);
         // Thank the user...
         header('Refresh: 3; url=' . lovd_getInstallURL() . $_PE[0] . '/' . $sCategory);
         $_T->printHeader();
         $_T->printTitle();
         lovd_showInfoTable('Successfully deleted the column ' . $sColumnID . '!', 'success');
         $_T->printFooter();
         exit;
     } else {
         // Because we're sending the data back to the form, I need to unset the password field!
         unset($_POST['password']);
     }
 }
 $_T->printHeader();
 $_T->printTitle();
 lovd_errorPrint();
 // Table.
 print '      <FORM action="' . CURRENT_PATH . '?' . ACTION . '" method="post">' . "\n";
 // Array which will make up the form table.
 $aForm = array_merge(array(array('POST', '', '', '', '50%', '14', '50%'), array('Permanently deleting column', '', 'print', '<B>' . $sColumnID . '</B>'), 'skip', array('Enter your password for authorization', '', 'password', 'password', 20), array('', '', 'submit', 'Delete column permanently')));
 lovd_viewForm($aForm);
Example #4
0
         // Only when phenotype, individual and variant are marked or public.
         if ($zData['statusid'] >= STATUS_MARKED) {
             $aGenes = $_DB->query('SELECT DISTINCT t.geneid FROM ' . TABLE_TRANSCRIPTS . ' AS t ' . 'INNER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ON (vot.transcriptid = t.id) ' . 'INNER JOIN ' . TABLE_VARIANTS . ' AS vog ON (vog.id = vot.id) ' . 'INNER JOIN ' . TABLE_SCR2VAR . ' AS s2v ON (s2v.variantid = vog.id) ' . 'INNER JOIN ' . TABLE_SCREENINGS . ' AS s ON (s.id = s2v.screeningid) ' . 'INNER JOIN ' . TABLE_INDIVIDUALS . ' AS i ON (i.id = s.individualid) ' . 'INNER JOIN ' . TABLE_PHENOTYPES . ' AS p ON (p.individualid = i.id) ' . 'WHERE vog.statusid >= ? AND i.statusid >= ? AND p.id = ?', array(STATUS_MARKED, STATUS_MARKED, $nID))->fetchAllColumn();
         }
         $_DATA->deleteEntry($nID);
         if ($zData['statusid'] >= STATUS_MARKED && $aGenes) {
             // Change updated date for genes.
             lovd_setUpdatedDate($aGenes);
         }
         // Write to log...
         lovd_writeLog('Event', LOG_EVENT, 'Deleted phenotype information entry ' . $nID . ' (Owner: ' . $zData['owner'] . ')');
         // Thank the user...
         header('Refresh: 3; url=' . lovd_getInstallURL() . 'individuals/' . $zData['individualid']);
         $_T->printHeader();
         $_T->printTitle();
         lovd_showInfoTable('Successfully deleted the phenotype information entry!', 'success');
         $_T->printFooter();
         exit;
     } else {
         // Because we're sending the data back to the form, I need to unset the password fields!
         unset($_POST['password']);
     }
 }
 $_T->printHeader();
 $_T->printTitle();
 lovd_errorPrint();
 // Table.
 print '      <FORM action="' . CURRENT_PATH . '?' . ACTION . '" method="post">' . "\n";
 // Array which will make up the form table.
 $aForm = array_merge(array(array('POST', '', '', '', '40%', '14', '60%'), array('Deleting phenotype information entry', '', 'print', $nID . ' (Owner: ' . $zData['owner'] . ')'), 'skip', array('Enter your password for authorization', '', 'password', 'password', 20), array('', '', 'submit', 'Delete phenotype information entry')));
 lovd_viewForm($aForm);
Example #5
0
     if ($_POST['password'] && !lovd_verifyPassword($_POST['password'], $_AUTH['password'])) {
         lovd_errorAdd('password', 'Please enter your correct password for authorization.');
     }
     if (!lovd_error()) {
         // Query text.
         // This also deletes the entries in variants.
         $_DATA->deleteEntry($nID);
         // Change updated date for gene.
         lovd_setUpdatedDate($zData['geneid']);
         // Write to log...
         lovd_writeLog('Event', LOG_EVENT, 'Deleted transcript information entry ' . $nID . ' - ' . $zData['geneid'] . ' (' . $zData['name'] . ')');
         // Thank the user...
         header('Refresh: 3; url=' . lovd_getInstallURL() . $_PE[0]);
         $_T->printHeader();
         $_T->printTitle();
         lovd_showInfoTable('Successfully deleted the transcript information entry!', 'success');
         $_T->printFooter();
         exit;
     } else {
         // Because we're sending the data back to the form, I need to unset the password fields!
         unset($_POST['password']);
     }
 }
 $_T->printHeader();
 $_T->printTitle();
 lovd_errorPrint();
 // Table.
 print '      <FORM action="' . CURRENT_PATH . '?' . ACTION . '" method="post">' . "\n";
 // Array which will make up the form table.
 $aForm = array_merge(array(array('POST', '', '', '', '50%', '14', '50%'), array('Deleting transcript information entry', '', 'print', $nID . ' - ' . $zData['name'] . ' (' . $zData['geneid'] . ')'), 'skip', array('Enter your password for authorization', '', 'password', 'password', 20), array('', '', 'submit', 'Delete transcript information entry')));
 lovd_viewForm($aForm);
Example #6
0
             $_DB->query('DELETE FROM ' . TABLE_VARIANTS . ' WHERE id IN (?' . str_repeat(', ?', count($aVariantsRemovable) - 1) . ')', $aVariantsRemovable);
         }
         // This also deletes the entries in TABLE_SCR2GENES and TABLE_SCR2VAR.
         $_DATA->deleteEntry($nID);
         if ($aGenes) {
             // Change updated date for genes
             lovd_setUpdatedDate($aGenes);
         }
         $_DB->commit();
         // Write to log...
         lovd_writeLog('Event', LOG_EVENT, 'Deleted screening information entry ' . $nID);
         // Thank the user...
         header('Refresh: 3; url=' . lovd_getInstallURL() . 'individuals/' . $zData['individualid']);
         $_T->printHeader();
         $_T->printTitle();
         lovd_showInfoTable('Successfully deleted the screening information entry!', 'success');
         $_T->printFooter();
         exit;
     } else {
         // Because we're sending the data back to the form, I need to unset the password fields!
         unset($_POST['password']);
     }
 }
 $_T->printHeader();
 $_T->printTitle();
 lovd_errorPrint();
 // Table.
 print '      <FORM action="' . CURRENT_PATH . '?' . ACTION . '" method="post">' . "\n";
 $nVariants = $_DB->query('SELECT COUNT(variantid) FROM ' . TABLE_SCR2VAR . ' WHERE screeningid = ?', array($nID))->fetchColumn();
 $aOptions = array('remove' => 'Yes, Remove ' . ($nVariantsRemovable == 1 ? 'this variant' : 'these variants') . ' from this screening', 'keep' => 'No, Keep ' . ($nVariantsRemovable == 1 ? 'this variant' : 'these variants') . ' as separate entries');
 // Array which will make up the form table.
// Define the list of VariantOnTranscript columns once and for all.
$aVOTCols = array('VariantOnTranscript/Distance_to_splice_site', 'VariantOnTranscript/GVS/Function', 'VariantOnTranscript/PolyPhen', 'VariantOnTranscript/Position');
// We also need to get a list of standard VariantOnTranscript columns.
$aColsStandard = $_DB->query('SELECT id FROM ' . TABLE_COLS . ' WHERE standard = 1 AND id IN ("' . implode('", "', $aVOTCols) . '")')->fetchAllColumn();
$sColumnMessage = '';
if (!$_DB->query('SELECT colid FROM ' . TABLE_ACTIVE_COLS . ' WHERE colid = "VariantOnGenome/Conservation_score/GERP"')->fetchColumn()) {
    // Check whether the GERP column is enabled.
    $sColumnMessage = '<BR>VariantOnGenome/Conservation_score/GERP: currently not enabled (<A href="#" onclick="lovd_openWindow(\'' . lovd_getInstallURL() . 'columns/VariantOnGenome/Conservation_score/GERP?add&amp;in_window=true\', \'col\', 800, 300); return false;">enable</A>)';
}
// Check if all VariantOnTranscript columns are activated for all genes and whether they are standard.
$nGenes = $_DB->query('SELECT COUNT(*) FROM ' . TABLE_GENES)->fetchColumn();
$aColCounts = $_DB->query('SELECT colid, COUNT(*) AS count FROM ' . TABLE_SHARED_COLS . ' WHERE colid IN ("' . implode('", "', $aVOTCols) . '") GROUP BY colid')->fetchAllCombine();
foreach ($aVOTCols as $sCol) {
    $b = true;
    if (!isset($aColCounts[$sCol]) && $nGenes || isset($aColCounts[$sCol]) && $aColCounts[$sCol] != $nGenes) {
        $sColumnMessage .= '<BR>' . $sCol . ': not enabled for some existing genes (<A href="#" onclick="lovd_openWindow(\'' . lovd_getInstallURL() . 'columns/' . $sCol . '?add&amp;in_window=true\', \'col\', 800, 450); return false;">enable</A>)';
        $b = false;
    }
    if (!in_array($sCol, $aColsStandard)) {
        if ($b) {
            $sColumnMessage .= '<BR>' . $sCol . ': ';
        } else {
            $sColumnMessage .= ' and ';
        }
        $sColumnMessage .= 'not enabled for new genes (<A href="#" onclick="lovd_setStandardColumn(\'' . $sCol . '\'); return false;">make standard</A>)';
    }
}
if (!empty($sColumnMessage)) {
    // Only show the infoTable if we have found problematic columns.
    lovd_showInfoTable('SeattleSeq files may contain additional annotations that can be imported into LOVD. To import this data into existing genes, the relevant columns need to be enabled for those genes.' . "\n" . 'To import this data into genes that will be created during import, the columns need to be set to \'standard\' so that they are enabled for the new genes.' . "\n" . '(<A href="#" onclick="lovd_checkColumns(); return false;">Re-check</A>)<BR>' . $sColumnMessage);
}
Example #8
0
     if ($aCurators) {
         // Create search string that hides the users currently selected to be curator or collaborator.
         $_GET['search_id'] = '!' . implode(' !', array_keys($aCurators));
     } else {
         // We must have something non-empty here, otherwise the JS fails when selecting users.
         $_GET['search_id'] = '!0';
     }
     $_GET['page_size'] = 10;
     $_DATA->setRowLink('Genes_AuthorizeUser', 'javascript:lovd_passAndRemoveViewListRow("{{ViewListID}}", "{{ID}}", {id: "{{ID}}", name: "{{zData_name}}", level: "{{zData_level}}"}, lovd_authorizeUser); return false;');
     $_DATA->viewList('Genes_AuthorizeUser', array('id', 'status_', 'last_login_', 'created_date_'), true);
     // Create known viewListID for lovd_unauthorizeUser().
     // Show curators, to sort and to select whether or not they can edit.
     print '      <BR><BR>' . "\n\n";
     lovd_showInfoTable('All users below have access to all data (public and non-public) of the ' . $sID . ' gene database. If you don\'t want to give the user access to <I>edit</I> any of the data that is not their own, deselect the "Allow edit" checkbox. Please note that users with level Manager or higher, cannot be restricted in their right to edit all information in the database.<BR>Users without edit rights are called Collaborators. Users having edit rights are called Curators; they receive email notifications of new submission and are shown on the gene\'s home page by default. You can disable that below by deselecting the "Shown" checkbox next to their name. To sort the list of curators for this gene, click and drag the <IMG src="gfx/drag_vertical.png" alt="" width="5" height="13"> icon up or down the list. Release the mouse button in the preferred location.', 'information');
 } else {
     lovd_showInfoTable('To sort the list of curators for this gene, click and drag the <IMG src="gfx/drag_vertical.png" alt="" width="5" height="13"> icon up or down the list. Release the mouse button in the preferred location. If you do not want a user to be shown on the list of curators on the gene homepage and on the top of the screen, deselect the checkbox on the right side of his/her name.', 'information');
 }
 // Form & table.
 print '      <TABLE class="sortable_head" style="width : 552px;"><TR><TH width="15">&nbsp;</TH><TH>Name</TH>';
 if (ACTION == 'authorize') {
     print '<TH width="100" style="text-align:right;">Allow edit</TH><TH width="75" style="text-align:right;">Shown</TH><TH width="30">&nbsp;</TH>';
 } else {
     print '<TH width="75" style="text-align:right;">Shown</TH>';
 }
 print '</TR></TABLE>' . "\n" . '      <FORM action="' . $_PE[0] . '/' . $sID . '?' . ACTION . '" method="post">' . "\n" . '        <UL id="curator_list" class="sortable" style="margin-top : 0px; width : 550px;">' . "\n";
 // Now loop the items in the order given.
 foreach ($aCurators as $nID => $aVal) {
     print '          <LI id="li_' . $nID . '"><INPUT type="hidden" name="curators[]" value="' . $nID . '"><TABLE width="100%"><TR><TD class="handle" width="13" align="center"><IMG src="gfx/drag_vertical.png" alt="" title="Click and drag to sort" width="5" height="13"></TD><TD>' . $aVal['name'] . ' (#' . $nID . ')</TD>';
     if (ACTION == 'authorize') {
         print '<TD width="100" align="right"><INPUT type="checkbox" name="allow_edit[]" value="' . $nID . '" onchange="if (this.checked == true) { this.parentNode.nextSibling.children[0].disabled = false; } else if (' . $aVal['level'] . ' >= ' . LEVEL_MANAGER . ') { this.checked = true; } else { this.parentNode.nextSibling.children[0].checked = false; this.parentNode.nextSibling.children[0].disabled = true; }"' . ($aVal['allow_edit'] || $aVal['level'] >= LEVEL_MANAGER ? ' checked' : '') . '></TD><TD width="75" align="right"><INPUT type="checkbox" name="shown[]" value="' . $nID . '"' . ($aVal['allow_edit'] ? $aVal['shown'] ? ' checked' : '' : ' disabled') . '></TD><TD width="30" align="right">' . ($aVal['level'] >= $_AUTH['level'] && $nID != $_AUTH['id'] ? '&nbsp;' : '<A href="#" onclick="lovd_unauthorizeUser(\'Genes_AuthorizeUser\', \'' . $nID . '\'); return false;"><IMG src="gfx/mark_0.png" alt="Remove" width="11" height="11" border="0"></A>') . '</TD>';
     } else {
Example #9
0
if ($_GET['step'] == 3) {
    // Get sequence from 2 and parse the coding DNA sequence.
    // 2009-03-09; 2.0-17; added by Gerard, need this for the g. numbering
    // 2009-09-15; 2.0-22; added else to prevent notice
    if (isset($_POST['aLengthsSequenceParts'])) {
        $aLengthsSequenceParts = unserialize(stripslashes($_POST['aLengthsSequenceParts']));
    } else {
        $aLengthsSequenceParts = array();
    }
    // We need to know if you came from step 2.
    if (isset($_POST['step2'])) {
        $bStep2 = $_POST['step2'];
    } else {
        $bStep2 = false;
        // Actually, not supported anymore.
        lovd_showInfoTable('Sorry, it is not supported to start at step 3.', 'stop');
        $_T->printFooter();
        exit;
    }
    if (isset($_GET['sent'])) {
        // Verification of the sequence.
        // Error check.
        lovd_errorClean();
        // Mandatory fields with their names.
        // 2009-06-22; 2.0-19; Removed gene.
        $aCheck = array('symbol' => 'Gene symbol', 'sequence' => 'Input sequence');
        foreach ($aCheck as $key => $val) {
            if (empty($_POST[$key])) {
                lovd_errorAdd($key, 'Please fill in the \'' . $val . '\' field.');
            }
        }
Example #10
0
                    lovd_errorAdd('password', 'Your account is now locked, since this is the third time a wrong password was provided.');
                }
                // The "Forgot my password" option.
                if ($_CONF['allow_unlock_accounts']) {
                    lovd_errorAdd('', 'Did you <A href="reset_password">forget your password</A>?');
                }
            }
        }
    }
}
if (!$_AUTH) {
    define('PAGE_TITLE', 'Log in');
    $_T->printHeader();
    $_T->printTitle();
    // Security check will be performed when actually logging in.
    if (empty($_POST['referer'])) {
        // Don't redirect a user to the logout!
        if (!empty($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] != lovd_getInstallURL() . 'logout') {
            $_POST['referer'] = $_SERVER['HTTP_REFERER'];
        } else {
            $_POST['referer'] = '';
        }
    }
    if ($_CONF['lovd_read_only']) {
        lovd_showInfoTable('This installation is currently configured to be read-only. Only Managers and higher level users can log in.', 'warning');
    }
    lovd_errorPrint();
    print '      <FORM action="login" method="post" id="login">' . "\n" . (!$_POST['referer'] ? '' : '        <INPUT type="hidden" name="referer" value="' . htmlspecialchars($_POST['referer']) . '">' . "\n") . '        <TABLE border="0" cellpadding="0" cellspacing="0" width="275">' . "\n" . '          <TR align="right">' . "\n" . '            <TD width="100" style="padding-right : 5px;">Username</TD>' . "\n" . '            <TD width="175"><INPUT type="text" name="username" size="20"></TD></TR>' . "\n" . '          <TR>' . "\n" . '            <TD colspan="2"><IMG src="gfx/trans.png" alt="" width="1" height="1"></TD></TR>' . "\n" . '          <TR align="right">' . "\n" . '            <TD width="100" style="padding-right : 5px;">Password</TD>' . "\n" . '            <TD width="175"><INPUT type="password" name="password" size="20"></TD></TR>' . "\n" . '          <TR>' . "\n" . '            <TD colspan="2"><IMG src="gfx/trans.png" alt="" width="1" height="1"></TD></TR>' . "\n" . '          <TR align="right">' . "\n" . '            <TD width="100">&nbsp;</TD>' . "\n" . '            <TD width="175"><INPUT type="submit" value="Log in"></TD></TR></TABLE>' . "\n" . '      </FORM>' . "\n\n" . '      <SCRIPT type="text/javascript">' . "\n" . '        document.forms[\'login\'].username.focus();' . "\n" . '      </SCRIPT>' . "\n\n";
    $_T->printFooter();
    exit;
}
Example #11
0
$nTotalVars = 0;
$q = $_DB->query('SELECT COUNT(*), statusid FROM ' . TABLE_VARIANTS . ' GROUP BY statusid ORDER BY statusid');
while ($r = $q->fetchRow()) {
    $aTotalVars[$r[1]] = $r[0];
    $nTotalVars += $r[0];
}
// Setup main table.
print '      <TABLE border="0" cellpadding="0" cellspacing="0" width="100%">' . "\n" . '        <TR>' . "\n" . '          <TD valign="top" style="padding-right : 10px; border-right : 1px solid #224488;">' . "\n" . '            <TABLE border="0" cellpadding="0" cellspacing="0" class="setup" width="250">' . "\n" . '              <TR>' . "\n" . '                <TH>Leiden Open Variation Database</TH></TR>' . "\n" . '              <TR>' . "\n" . '                <TD>' . "\n" . '                  Installed : ' . $_STAT['installed_date'] . '<BR>' . "\n" . '                  Updated : ' . ($_STAT['updated_date'] ? $_STAT['updated_date'] : '-') . '</TD></TR>' . "\n" . '              <TR>' . "\n" . '                <TH>Statistics</TH></TR>' . "\n" . '              <TR>' . "\n" . '                <TD>' . "\n" . '                  Users : ' . $nUsers . '<BR>' . "\n" . '                  Log entries : ' . $nLogs . '<BR>----------<BR>' . "\n" . '                  Individuals : ' . $nIndividuals . '<BR>' . "\n" . '                  Genes : ' . $nGenes . '</TD></TR>' . "\n" . '              <TR>' . "\n" . '                <TH>Variants</TH></TR>' . "\n" . '              <TR>' . "\n" . '                <TD>' . "\n" . '                  Total : ' . $nTotalVars;
foreach ($aTotalVars as $nStatus => $nVars) {
    print '<BR>' . "\n" . '                  ' . $_SETT['data_status'][$nStatus] . ' : ' . $nVars;
}
print '</TD></TR></TABLE><BR>' . "\n\n";
// Mention that LOVD can be updated!
if ($_STAT['update_level']) {
    $_STAT['update_level'] = 7;
    lovd_showInfoTable('LOVD update available:<BR><B>' . $_STAT['update_version'] . '</B><BR>' . ($_STAT['update_level'] >= 7 ? ' It is ' . strtolower($_SETT['update_levels'][$_STAT['update_level']]) . ' to upgrade!' : '') . '<BR><A href="#" onclick="lovd_openWindow(\'' . lovd_getInstallURL() . 'check_update\', \'CheckUpdate\', 650, 175); return false;">More information &raquo;</A>', $_STAT['update_level'] >= 7 ? 'warning' : 'information');
}
print '          </TD>' . "\n" . '          <TD valign="top" width="50%" style="padding-left : 10px; padding-right : 10px; border-right : 1px solid #224488;" id="setupLeft">' . "\n\n";
$aItems = array('General LOVD Setup' => array(array('settings?edit', 'lovd_settings.png', 'LOVD System settings', 'View and change LOVD System settings, including settings on statistics, security and the legend.'), 'uninstall' => array('uninstall', 'lovd_warning.png', 'Uninstall LOVD', 'Uninstall LOVD.')), 'Authorized users' => array(array('users?create', 'lovd_users_create.png', 'Create new authorized user', 'Create a new authorized user or submitter.'), array('users', 'lovd_users_edit.png', 'View all users', 'Manage authorized users and submitters.')), 'Custom data columns' => array(array('columns?create', 'lovd_columns_create.png', 'Create new custom data column', 'Create new custom data column.'), array('columns', 'lovd_columns_view.png', 'Browse all custom data columns', 'Browse all custom data columns already available to enable or disable them, or view or edit their settings.'), array('download/columns', 'lovd_save.png', 'Download all LOVD custom columns', 'Download all LOVD custom columns in the LOVD import format.')), 'Custom links' => array(array('links?create', 'lovd_links_create.png', 'Create new custom link', 'Create a new custom link. Custom links allow you to quickly insert references to other data sources, using short tags.'), array('links', 'lovd_links_edit.png', 'Browse all custom links', 'Browse all available custom links and view and edit their settings.')), 'Download & Import' => array(array('download/all', 'lovd_save.png', 'Download all data', 'Download all data in LOVD import format (custom columns, genes, transcripts, diseases, individuals, phenotypes, screenings &amp; variants).'), array('import', 'lovd_import.png', 'Import data', 'Import data using the LOVD import format (custom columns, diseases, individuals, phenotypes, screenings &amp; variants).')), 'System logs' => array(array('logs', 'lovd_logs.png', 'System logs', 'View, search and delete system logs.')));
// Remove uninstall.
if ($_CONF['lock_uninstall'] || $_AUTH['level'] < LEVEL_ADMIN) {
    unset($aItems['General LOVD Setup']['uninstall']);
}
foreach ($aItems as $sTitle => $aLinks) {
    print '            <TABLE border="0" cellpadding="2" cellspacing="0" class="setup" width="100%">' . "\n" . '              <TR>' . "\n" . '                <TH colspan="2">' . $sTitle . '</TH></TR>';
    foreach ($aLinks as $val) {
        list($sLink, $sIMG, $sAlt, $sText) = $val;
        print "\n" . '              <TR class="pointer" onclick="window.location.href=\'' . lovd_getInstallURL() . $sLink . '\';">' . "\n" . '                <TD align="center" width="40"><IMG src="gfx/' . $sIMG . '" alt="' . $sAlt . '" width="32" height="32"></TD>' . "\n" . '                <TD>' . $sText . '</TD></TR>';
    }
    print '</TABLE><BR>' . "\n\n";
}
 function loadAll($nID = false)
 {
     // Loads all variantOnTranscript entries from the database.
     global $_DB, $_T;
     if (empty($nID)) {
         // We were called, but the class wasn't initiated with an ID. Fail.
         lovd_displayError('LOVD-Lib', 'Objects::(' . $this->sObject . ')::loadEntry() - Method didn\'t receive ID');
     }
     $q = $_DB->query($this->sSQLLoadEntry, array($nID, $this->sObjectID), false);
     if ($q) {
         $z = $q->fetchAllAssoc();
     }
     if (!$q || !$z) {
         $sError = $_DB->formatError();
         // Save the PDO error before it disappears.
         $_T->printHeader();
         if (defined('PAGE_TITLE')) {
             $_T->printTitle();
         }
         if ($sError) {
             lovd_queryError($this->sObject . '::loadEntry()', $sSQL, $sError);
         }
         lovd_showInfoTable('No such ID!', 'stop');
         $_T->printFooter();
         exit;
     }
     $zData = array();
     foreach ($z as $aVariantOnTranscript) {
         $aVariantOnTranscript = $this->autoExplode($aVariantOnTranscript);
         foreach ($this->aColumns as $sColClean => $aCol) {
             $sCol = $aVariantOnTranscript['transcriptid'] . '_' . $sColClean;
             if ($aCol['form_type'][2] == 'select' && $aCol['form_type'][3] > 1) {
                 $zData[$sCol] = explode(';', $aVariantOnTranscript[$sColClean]);
             } else {
                 $zData[$sCol] = $aVariantOnTranscript[$sColClean];
             }
         }
         $zData[$aVariantOnTranscript['transcriptid'] . '_effectid'] = $aVariantOnTranscript['effectid'];
         $zData[$aVariantOnTranscript['transcriptid'] . '_position_c_start'] = $aVariantOnTranscript['position_c_start'];
         $zData[$aVariantOnTranscript['transcriptid'] . '_position_c_start_intron'] = $aVariantOnTranscript['position_c_start_intron'];
         $zData[$aVariantOnTranscript['transcriptid'] . '_position_c_end'] = $aVariantOnTranscript['position_c_end'];
         $zData[$aVariantOnTranscript['transcriptid'] . '_position_c_end_intron'] = $aVariantOnTranscript['position_c_end_intron'];
     }
     return $zData;
 }
Example #13
0
     }
     // User had to enter his/her password for authorization.
     if ($_POST['password'] && !lovd_verifyPassword($_POST['password'], $_AUTH['password'])) {
         lovd_errorAdd('password', 'Please enter your correct password for authorization.');
     }
     if (!lovd_error()) {
         // Query text.
         // This also deletes the entries in cols2links.
         $_DATA->deleteEntry($nID);
         // Write to log...
         lovd_writeLog('Event', LOG_EVENT, 'Deleted custom link ' . $nID . ' - ' . $zData['name'] . ' (' . $zData['pattern_text'] . ')');
         // Thank the user...
         header('Refresh: 3; url=' . lovd_getInstallURL() . $_PE[0]);
         $_T->printHeader();
         $_T->printTitle();
         lovd_showInfoTable('Successfully deleted the custom link!', 'success');
         $_T->printFooter();
         exit;
     } else {
         // Because we're sending the data back to the form, I need to unset the password fields!
         unset($_POST['password']);
     }
 }
 $_T->printHeader();
 $_T->printTitle();
 lovd_errorPrint();
 // Table.
 print '      <FORM action="' . CURRENT_PATH . '?' . ACTION . '" method="post">' . "\n";
 // Array which will make up the form table.
 $aForm = array(array('POST', '', '', '', '50%', '14', '50%'), array('Deleting custom link', '', 'print', $zData['name'] . ' (' . $zData['pattern_text'] . ')'), 'skip', array('Enter your password for authorization', '', 'password', 'password', 20), array('', '', 'submit', 'Delete custom link'));
 lovd_viewForm($aForm);
Example #14
0
    if (!empty($aSubmit['variants'])) {
        $aBody['variant_details'] = $aVariantDetails;
    }
    if (!empty($aSubmit['uploads'])) {
        $aBody['upload_details'] = $aUploadDetails;
    }
    require ROOT_PATH . 'inc-lib-form.php';
    $sBody = lovd_formatMail($aBody);
    // Set proper subject.
    $sSubject = 'LOVD submission' . (ACTION != 'edit' ? '' : ' update') . (!empty($aGenes) ? ' (' . implode(', ', array_slice($aGenes, 0, 20)) . (count($aGenes) > 20 ? ', ...' : '') . ')' : '');
    // Don't just change this; lovd_sendMail() is parsing it.
    $aCC = array();
    // Set submitter address.
    $aCC[] = array($_AUTH['name'], $_AUTH['email']);
    // Get owners address.
    if (!empty($aOwner)) {
        $aCC = array_merge($aCC, $_DB->query('SELECT name, email FROM ' . TABLE_USERS . ' WHERE id IN (?' . str_repeat(', ?', count($aOwner) - 1) . ')', $aOwner)->fetchAllRow());
    }
    // Send mail.
    $bMail = lovd_sendMail($aTo, $sSubject, $sBody, $_SETT['email_headers'], true, $_CONF['send_admin_submissions'], $aCC);
    // FIXME; When messaging system is built in, maybe queue message for curators?
    if ($bMail) {
        lovd_showInfoTable('Successfully processed your submission and sent an email notification to the relevant curator(s)!', 'success');
        // Forward only if there was no error sending the email.
        print '      <SCRIPT type="text/javascript">setTimeout("window.location.href=\'' . lovd_getInstallURL() . $sURI . $nID . '\'", 3000);</SCRIPT>' . "\n";
    } else {
        lovd_showInfoTable('Successfully processed your submission, but LOVD wasn\'t able to send an email notification to the relevant curator(s)!<BR>Please contact one of the relevant curators and notify them of your submission so that they can curate your data!', 'warning');
    }
    $_T->printFooter();
    exit;
}
Example #15
0
    $sManagers = '';
    $zManagers = $_DB->query('SELECT u.name, u.email FROM ' . TABLE_USERS . ' AS u WHERE u.level = ? ORDER BY u.name ASC', array(LEVEL_MANAGER))->fetchAllAssoc();
    if (!$zManagers) {
        // No managers found, then get the database admin.
        $zManagers = $_DB->query('SELECT u.name, u.email FROM ' . TABLE_USERS . ' AS u WHERE u.level = ? ORDER BY u.name ASC', array(LEVEL_ADMIN))->fetchAllAssoc();
    }
    $nManagers = count($zManagers);
    foreach ($zManagers as $i => $z) {
        $i++;
        $sManagers .= ($sManagers ? $i == $nManagers ? ' or ' : ', ' : '') . '<A href="mailto:' . str_replace(array("\r\n", "\r", "\n"), ', ', trim($z['email'])) . '">' . $z['name'] . '</A>';
    }
    lovd_showInfoTable('Your user level is curator, as a curator you can only simulate an import and check your LOVD tab-delimited file.<BR>To actually import the file, you have to contact the database manager(s): ' . $sManagers . '.', 'information', 760);
}
lovd_showInfoTable('If you\'re looking for importing data files containing variant data only, like VCF files and SeattleSeq annotated files, please <A href="submit">start a new submission</A>.', 'information', 760);
// FIXME: Since we can increase the memory limit anyways, maybe we can leave this message out if we nicely handle the memory?
lovd_showInfoTable('In some cases importing big files or importing files into big databases can cause LOVD to run out of available memory. In case this server hides these errors, LOVD would return a blank screen. If this happens, split your import file into smaller chunks or ask your system administrator to allow PHP to use more memory (currently allowed: ' . ini_get('memory_limit') . 'B).', 'warning', 760);
// Warnings were shown in the progress bar, but I'd like to have them here too. They are still in the source, so we can use JS.
if ($nWarnings) {
    lovd_errorAdd('', '<A href="#" onclick="$(\'#warnings\').toggle(); if ($(\'#warnings_action\').html() == \'Show\') { $(\'#warnings_action\').html(\'Hide\'); } else { $(\'#warnings_action\').html(\'Show\') } return false;"><SPAN id="warnings_action">Show</SPAN> ' . $nWarnings . ' warning' . ($nWarnings == 1 ? '' : 's') . '</A><DIV id="warnings"></DIV><SCRIPT type="text/javascript">$("#warnings").hide();$("#warnings").html($("#lovd_parser_progress_message_done").html());</SCRIPT>');
}
lovd_errorPrint();
// Tooltip JS code.
lovd_includeJS('inc-js-tooltip.php');
print '      <FORM action="' . CURRENT_PATH . '" method="post" enctype="multipart/form-data">' . "\n" . '        <INPUT type="hidden" name="MAX_FILE_SIZE" value="' . $nMaxSize . '">' . "\n";
$aForm = array(array('POST', '', '', '', '40%', '14', '60%'), array('', '', 'print', '<B>File selection</B> (LOVD tab-delimited format only!)'), 'hr', array('Select the file to import', '', 'file', 'import', 40), array('', 'Current file size limits:<BR>LOVD: ' . $nMaxSizeLOVD / (1024 * 1024) . 'M<BR>PHP (upload_max_filesize): ' . ini_get('upload_max_filesize') . '<BR>PHP (post_max_size): ' . ini_get('post_max_size'), 'note', 'The maximum file size accepted is ' . round($nMaxSize / pow(1024, 2), 1) . ' MB' . ($nMaxSize == $nMaxSizeLOVD ? '' : ', due to restrictions on this server. If you wish to have it increased, contact the server\'s system administrator') . '.'), 'hr', 'skip', array('', '', 'print', '<B>Import options</B>'), 'hr', array('Import mode', 'Available modes:<BR>' . '<B>' . $aModes['update'] . '</B>: LOVD will compare all IDs given in the file with the contents of the database. LOVD will search for differences between the file and the database, and update the entries in the database using the data in the file.<BR>' . '<B>' . $aModes['insert'] . '</B>: LOVD will use the IDs given in the file only to link the data together. All data in the file will be treated as new, and all data will receive new IDs once imported. The biggest advantage of this mode is that you do not need to know which IDs are free in the database.', 'select', 'mode', 1, $aModes, true, false, false), array('', '', 'note', 'Please select which import mode LOVD should use; <I>' . implode('</I> or <I>', $aModes) . '</I>. For more information on the modes, move your mouse over the ? icon.'), array('Character encoding of imported file', 'If your file contains special characters like &egrave;, &ouml; or even just fancy quotes like &ldquo; or &rdquo;, LOVD needs to know the file\'s character encoding to ensure the correct display of the data.', 'select', 'charset', 1, $aCharSets, false, false, false), array('', '', 'note', 'Please only change this setting in case you encounter problems with displaying special characters in imported data. Technical information about character encoding can be found <A href="http://en.wikipedia.org/wiki/Character_encoding" target="_blank">on Wikipedia</A>.'), array('Simulate (don\'t actually import the data)', 'To check your file for errors, without actually importing anything, select this checkbox. Currently only managers or higher are allowed to do an import. Curators are only allowed to simulate an import.', 'checkbox', 'simulate', 1), 'skip', array('', '', 'submit', 'Import file'));
lovd_viewForm($aForm);
print '</FORM>' . "\n\n";
// If user has level curator, the checkbox is disabled and via $_POST['simulate'] the checkbox is always set to true.
// The help icon shows some extra information to the user.
if ($_AUTH['level'] == LEVEL_CURATOR) {
    print '      <SCRIPT type="text/javascript">' . "\n" . '        $(function() {' . "\n" . '          document.getElementsByName("simulate")[0].disabled = true;' . "\n" . '        });' . "\n" . '      </SCRIPT>' . "\n\n";
Example #16
0
         }
         // Query text.
         $sSQL = 'UPDATE ' . TABLE_CONFIG . ' SET ';
         $aSQL = array();
         foreach ($aFields as $key => $sField) {
             $sSQL .= (!$key ? '' : ', ') . $sField . ' = ?';
             $aSQL[] = $_POST[$sField];
         }
         $q = $_DB->query($sSQL, $aSQL, true, true);
         // Write to log...
         lovd_writeLog('Event', LOG_EVENT, 'Edited system configuration');
         // Thank the user...
         header('Refresh: 3; url=' . lovd_getInstallURL() . 'setup');
         $_T->printHeader();
         $_T->printTitle();
         lovd_showInfoTable('Successfully edited the system settings!', 'success');
         $_T->printFooter();
         exit;
     }
 } else {
     // Load current values.
     $_POST = array_merge($_POST, $zData);
 }
 $_T->printHeader();
 $_T->printTitle();
 lovd_errorPrint();
 // Tooltip JS code.
 lovd_includeJS('inc-js-tooltip.php');
 // Allow checking the database URL.
 lovd_includeJS('inc-js-submit-settings.php');
 print '      <FORM action="' . CURRENT_PATH . '?' . ACTION . '" method="post" onsubmit="return lovd_checkForm();">' . "\n";
Example #17
0
function lovd_requireAUTH($nLevel = 0)
{
    // Creates friendly output message if $_AUTH does not exist (or level too
    // low), and exits.
    // $_AUTH is for authorization; $_SETT is needed for the user levels.
    global $_AUTH, $_DB, $_SETT, $_T;
    $aKeys = array_keys($_SETT['user_levels']);
    if ($nLevel !== 0 && !in_array($nLevel, $aKeys)) {
        $nLevel = max($aKeys);
    }
    // $nLevel is now 0 (just existence of $_AUTH required) or taken from the levels list.
    if (!$_AUTH || $nLevel && $_AUTH['level'] < $nLevel) {
        $_T->printHeader();
        if (defined('PAGE_TITLE')) {
            $_T->printTitle();
        }
        $sMessage = 'To access this area, you need ' . (!$nLevel ? 'to <A href="login">log in</A>.' : ($nLevel == max($aKeys) ? '' : 'at least ') . $_SETT['user_levels'][$nLevel] . ' clearance.');
        // FIXME; extend this list?
        if (lovd_getProjectFile() == '/submit.php') {
            $sMessage .= '<BR>If you are not registered as a submitter, please <A href="users?register">do so here</A>.';
        }
        lovd_showInfoTable($sMessage, 'stop');
        $_T->printFooter();
        exit;
    }
}
Example #18
0
     } else {
         print '      <SCRIPT type="text/javascript">setTimeout(\'window.location.href=\\\'' . lovd_getInstallURL() . $_PE[0] . '/' . $nID . '\\\';\', 1000);</SCRIPT>' . "\n\n";
     }
     $_T->printFooter();
     exit;
 }
 $_T->printHeader();
 $_T->printTitle();
 // Retrieve column IDs in current order.
 $aColumns = $_DB->query('SELECT SUBSTRING(colid, LOCATE("/", colid)+1) FROM ' . TABLE_SHARED_COLS . ' WHERE ' . $sUnit . 'id = ? ORDER BY col_order ASC', array($nID))->fetchAllColumn();
 if (!count($aColumns)) {
     lovd_showInfoTable('No columns found!', 'stop');
     $_T->printFooter();
     exit;
 }
 lovd_showInfoTable('Below is a sorting list of all active columns. By clicking &amp; dragging the arrow next to the column up and down you can rearrange the columns. Re-ordering them will affect listings, detailed views and data entry forms in the same way.', 'information');
 // Form & table.
 print '      <TABLE cellpadding="0" cellspacing="0" class="sortable_head" style="width : 302px;"><TR><TH width="20">&nbsp;</TH><TH>Column ID</TH></TR></TABLE>' . "\n" . '      <FORM action="' . CURRENT_PATH . '?' . ACTION . (isset($_GET['in_window']) ? '&amp;in_window' : '') . '" method="post">' . "\n" . '        <UL id="column_list" class="sortable" style="width : 300px; margin-top : 0px;">' . "\n";
 // Now loop the items in the order given.
 foreach ($aColumns as $sID) {
     print '        <LI><INPUT type="hidden" name="columns[]" value="' . $sID . '"><TABLE width="100%"><TR><TD class="handle" width="13" align="center"><IMG src="gfx/drag_vertical.png" alt="" title="Click and drag to sort" width="5" height="13"></TD><TD>' . $sID . '</TD></TR></TABLE></LI>' . "\n";
 }
 print '        </UL>' . "\n" . '        <INPUT type="submit" value="Save">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="submit" value="Cancel" onclick="' . (isset($_GET['in_window']) ? 'self.close(); return false;' : 'window.location.href=\'' . lovd_getInstallURL() . $_PE[0] . '/' . $_PE[1] . '\'; return false;') . '" style="border : 1px solid #FF4422;">' . "\n" . '      </FORM>' . "\n\n";
 ?>
   <SCRIPT type='text/javascript'>
     $(function() {
       $('#column_list').sortable({
         containment: 'parent',
         tolerance: 'pointer',
         handle: 'TD.handle'
       });
Example #19
0
        $aVOT = $_DB->query('SELECT t.id, t.geneid, t.name, t.id_ncbi FROM ' . TABLE_TRANSCRIPTS . ' AS t LEFT OUTER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ON (t.id = vot.transcriptid) WHERE vot.id = ? ORDER BY t.geneid, id_ncbi', array($nID))->fetchAllAssoc();
    }
    $_GET['page_size'] = 10;
    $_GET['search_id'] = '';
    foreach ($aVOT as $aTranscript) {
        $_GET['search_id'] .= '!' . $aTranscript['id'] . ' ';
    }
    $_GET['search_id'] = !empty($_GET['search_id']) ? rtrim($_GET['search_id']) : '!0';
    $_GET['search_chromosome'] = '="' . $zData['chromosome'] . '"';
    require ROOT_PATH . 'class/object_custom_viewlists.php';
    $_DATA = new LOVD_CustomViewList(array('Gene', 'Transcript', 'DistanceToVar'), $zData['id']);
    // DistanceToVar needs the VariantID.
    $_DATA->setRowLink('VOT_map', 'javascript:lovd_addTranscript(\'{{ViewListID}}\', \'{{ID}}\', \'{{zData_geneid}}\', \'{{zData_name}}\', \'{{zData_id_ncbi}}\'); return false;');
    $_DATA->viewList('VOT_map', array(), true);
    print '      <BR><BR>' . "\n\n";
    lovd_showInfoTable('The variant entry is currently mapped to the following transcripts. Click on the cross at the right side of the transcript to remove the mapping.', 'information');
    print '      <TABLE class="sortable_head" style="width : 652px;"><TR><TH width="100">Gene</TH>' . '<TH style="text-align : left;">Name</TH><TH width="123" style="text-align : left;">Transcript ID</TH><TH width="20">&nbsp;</TH>' . '</TR></TABLE>' . "\n" . '      <FORM action="' . CURRENT_PATH . '?' . ACTION . '" method="post">' . "\n" . '        <UL id="transcript_list" class="sortable" style="margin-top : 0px; width : 650px;">' . "\n";
    // Now loop the items in the order given.
    foreach ($aVOT as $aTranscript) {
        print '          <LI id="li_' . $aTranscript['id'] . '"><INPUT type="hidden" name="transcripts[]" value="' . $aTranscript['id'] . '"><TABLE width="100%"><TR><TD width="98">' . $aTranscript['geneid'] . '</TD>' . '<TD align="left">' . $aTranscript['name'] . '</TD><TD width="120" align="left">' . $aTranscript['id_ncbi'] . '</TD><TD width="20" align="right"><A href="#" onclick="lovd_removeTranscript(\'VOT_map\', \'' . $aTranscript['id'] . '\', \'' . $aTranscript['id_ncbi'] . '\'); return false;"><IMG src="gfx/mark_0.png" alt="Remove" width="11" height="11" border="0"></A></TD>' . '</TR></TABLE></LI>' . "\n";
    }
    print '        </UL>' . "\n";
    // Array which will make up the form table.
    $aForm = array(array('POST', '', '', '', '0%', '0', '100%'), array('', '', 'print', 'Enter your password for authorization'), array('', '', 'password', 'password', 20), array('', '', 'print', '<INPUT type="submit" value="Save transcript list">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="submit" value="Cancel" onclick="window.location.href=\'' . lovd_getInstallURL() . CURRENT_PATH . '\'; return false;" style="border : 1px solid #FF4422;">'));
    lovd_viewForm($aForm);
    print "\n" . '      </FORM>' . "\n\n";
    ?>

      <SCRIPT type='text/javascript'>
        function lovd_addTranscript (sViewListID, nID, sGene, sName, sNM)
        {
Example #20
0
    if (!empty($aCategories['VariantOnGenome'])) {
        require ROOT_PATH . 'class/object_genome_variants.php';
        $_DATAvariants = new LOVD_GenomeVariant();
    }
    if (!empty($aCategories['Individual'])) {
        require ROOT_PATH . 'class/object_individuals.php';
        $_DATAindividuals = new LOVD_Individual();
    }
    print '   <SCRIPT type="text/javascript">' . "\n" . '       $(function() {' . "\n" . '           $("#tabs").tabs({active: ' . $nActiveTab . ', disabled: [' . $nDisabledTab . ']});' . "\n" . '       });' . "\n" . '   </SCRIPT>' . "\n" . '   <DIV id="tabs">' . "\n" . '       <UL>' . "\n" . '           <LI><A href="' . lovd_getInstallURL() . implode('/', $_PE) . '#tabs-variants">Variants</A></LI>' . "\n" . '           <LI><A href="' . lovd_getInstallURL() . implode('/', $_PE) . '#tabs-individuals">Individuals</A></LI>' . "\n" . '       </UL>' . "\n" . '       <DIV id="tabs-variants">' . "\n";
    if (!empty($_DATAvariants)) {
        $_DATAvariants->viewList('Variants_per_reference', $aColsToHide['VariantOnGenome'], true, true);
    }
    print '       </DIV>' . "\n" . '       <DIV id="tabs-individuals">' . "\n";
    if (!empty($_DATAindividuals)) {
        $_DATAindividuals->viewList('Individuals_per_reference', $aColsToHide['Individual'], true, true);
    }
    print '       </DIV>' . "\n" . '   </DIV>';
    $_T->printFooter();
    exit;
}
if ($bImage) {
    header('Content-type: image/png');
    readfile(ROOT_PATH . 'gfx/trans.png');
    exit;
}
define('PAGE_TITLE', 'View data for reference: ' . $aPathElements[1]);
$_T->printHeader();
$_T->printTitle();
lovd_showInfoTable('Unknown reference ' . $aPathElements[1], 'stop');
$_T->printFooter();
exit;
Example #21
0
    }
    list($aColleagues, $sColTable) = lovd_colleagueTableHTML($nID, $sUserListID, $aColleagues, $bAllowGrantEdit);
    $_T->printHeader();
    $_T->printTitle();
    lovd_errorPrint();
    lovd_showInfoTable('To share access with other users, find the user in the list below, click on
                       the user to add him to the selection. Then click <B>save</B> to save the
                       changes.', 'information');
    // Set number of items per page for viewlist.
    $_GET['page_size'] = 10;
    // Set filter for viewlist to hide current colleagues and the user being viewed.
    $_GET['search_userid'] = '!' . $nID;
    foreach ($aColleagues as $aColleague) {
        $_GET['search_userid'] .= ' !' . $aColleague['id'];
    }
    // Show viewlist to select new users to share access with.
    $_DATA = new LOVD_User();
    $_DATA->setRowLink('users_share_access', 'javascript:lovd_passAndRemoveViewListRow("{{ViewListID}}", "{{ID}}", {id: "{{ID}}", name: "{{zData_name}}"}, lovd_addUserShareAccess); return false;');
    // The columns hidden here are also specified (enforced) in ajax/viewlist.php to make sure Submitters can't hack their way into the users table.
    $_DATA->viewList($sUserListID, array('username', 'status_', 'last_login_', 'created_date_', 'curates', 'level_'), true);
    lovd_showInfoTable('<B>' . $zData['name'] . ' (' . $nID . ')</B> shares access to all
                       data owned by him with the users listed below.', 'information');
    print '<FORM action="users/' . $nID . '?share_access" method="post">' . "\n";
    // Array which will make up the form table.
    print $sColTable . "\n";
    $aForm = array(array('POST', '', '', '', '0%', '0', '100%'), array('', '', 'print', 'Enter your password for authorization'), array('', '', 'password', 'password', 20), array('', '', 'print', '<INPUT type="submit" value="Save access permissions">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="submit" value="Cancel" onclick="window.location.href=\'' . lovd_getInstallURL() . $_PE[0] . '/' . $nID . '\'; return false;" style="border : 1px solid #FF4422;">'));
    lovd_viewForm($aForm);
    print '</FORM>';
    $_T->printFooter();
    exit;
}
Example #22
0
    function viewList($sViewListID = false, $aColsToSkip = array(), $bNoHistory = false, $bHideNav = false, $bOptions = false, $bOnlyRows = false, $bFindReplace = false)
    {
        // Show a viewlist for the current object.
        // Params:
        // bFindReplace     if true, find & replace option is shown in viewlist options menu.
        // Views list of entries in the database, allowing search.
        global $_DB, $_INI, $_SETT;
        if (!defined('LOG_EVENT')) {
            define('LOG_EVENT', $this->sObject . '::viewList()');
        }
        if (FORMAT == 'text/plain' && !defined('FORMAT_ALLOW_TEXTPLAIN')) {
            die('text/plain not allowed here');
        }
        $bAjax = substr(lovd_getProjectFile(), 0, 6) == '/ajax/';
        // ViewLists need an ID to identify the specific viewList, in case there are a few in one document.
        if (!$sViewListID || !is_string($sViewListID)) {
            $sViewListID = lovd_generateRandomID();
        } else {
            $sViewListID = preg_replace('/[^A-Z0-9._-]+/i', '', $sViewListID);
        }
        if (!is_array($aColsToSkip)) {
            $aColsToSkip = array($aColsToSkip);
        }
        foreach ($this->aColumnsViewList as $sCol => $aCol) {
            if (!$aCol['view'] && !in_array($sCol, $aColsToSkip)) {
                $aColsToSkip[] = $sCol;
            }
        }
        require_once ROOT_PATH . 'inc-lib-viewlist.php';
        // First, check if entries are in the database at all.
        $nTotal = $this->getCount();
        if (!$nTotal && FORMAT == 'text/html') {
            if ($bOnlyRows) {
                die('0');
                // Silent error.
            }
            lovd_showInfoTable('No entries in the database yet!', 'stop');
            return 0;
        }
        // Process search fields (i.e. $_GET['search_...'] values) for viewlist.
        list($WHERE, $HAVING, $aArguments, $aBadSyntaxColumns, $aColTypes) = $this->processViewListSearchArgs($_GET);
        if ($WHERE) {
            $this->aSQLViewList['WHERE'] .= ($this->aSQLViewList['WHERE'] ? ' AND ' : '') . $WHERE;
        }
        if ($HAVING) {
            $this->aSQLViewList['HAVING'] .= ($this->aSQLViewList['HAVING'] ? ' AND ' : '') . $HAVING;
        }
        // SORT: Current settings, also implementing XSS check.
        if (!empty($_GET['order']) && $_GET['order'] === strip_tags($_GET['order'])) {
            $aOrder = explode(',', $_GET['order']);
        } else {
            $aOrder = array('', '');
        }
        // SORT: Verify request and set default.
        if (empty($this->aColumnsViewList[$aOrder[0]]['db'][1])) {
            $aOrder[0] = $this->sSortDefault;
        }
        if ($aOrder[1] != 'ASC' && $aOrder[1] != 'DESC') {
            $aOrder[1] = $this->aColumnsViewList[$aOrder[0]]['db'][1];
        }
        $sSQLOrderBy = $this->aColumnsViewList[$aOrder[0]]['db'][0] . ' ' . $aOrder[1];
        if (in_array($aOrder[0], array('chromosome', 'VariantOnGenome/DNA'))) {
            // 2014-03-07; 3.0-10; We need to find the table alias of the VOG or genes table, because otherwise MySQL fails here ('chromosome' is ambiguous) if both are joined.
            // 2014-04-28; 3.0-10; Prefer the genes table, since it joins to VOG as well, but may not have results which messes up the order.
            $sAlias = '';
            if (preg_match('/' . TABLE_GENES . ' AS ([a-z]+)/i', $this->aSQLViewList['FROM'], $aRegs)) {
                $sAlias = $aRegs[1];
            } elseif (preg_match('/' . TABLE_VARIANTS . ' AS ([a-z]+)/i', $this->aSQLViewList['FROM'], $aRegs)) {
                $sAlias = $aRegs[1];
            }
            $this->aSQLViewList['FROM'] .= ' LEFT OUTER JOIN ' . TABLE_CHROMOSOMES . ' AS chr ON (' . (!$sAlias ? '' : $sAlias . '.') . 'chromosome = chr.name)';
            $sSQLOrderBy = 'chr.sort_id ' . $aOrder[1];
            if ($aOrder[0] == 'VariantOnGenome/DNA') {
                $sSQLOrderBy .= ', position_g_start ' . $aOrder[1] . ', position_g_end ' . $aOrder[1] . ', `VariantOnGenome/DNA` ' . $aOrder[1];
            }
        } elseif ($aOrder[0] == 'VariantOnTranscript/DNA') {
            $sSQLOrderBy = 'position_c_start ' . $aOrder[1] . ', position_c_start_intron ' . $aOrder[1] . ', position_c_end ' . $aOrder[1] . ', position_c_end_intron ' . $aOrder[1] . ', `VariantOnTranscript/DNA` ' . $aOrder[1];
        }
        // At this point, we're not sure if we'll actually use the ORDER BY at all.
        $this->aSQLViewList['ORDER_BY'] = $sSQLOrderBy . (empty($this->aSQLViewList['ORDER_BY']) ? '' : ', ' . $this->aSQLViewList['ORDER_BY']);
        // Only print stuff if we're not in Ajax right now.
        if (!$bAjax && FORMAT == 'text/html') {
            // Keep the URL clean; disable any fields that are not used.
            lovd_includeJS('inc-js-viewlist.php' . (!$bNoHistory ? '' : '?nohistory'));
            lovd_includeJS('inc-js-tooltip.php');
            // Print form; required for sorting and searching.
            // Because we don't want the form to submit itself while we are waiting for the Ajax response, we need to kill the native submit() functionality.
            print '      <FORM action="' . CURRENT_PATH . '" method="get" id="viewlistForm_' . $sViewListID . '" style="margin : 0px;" onsubmit="return false;">' . "\n" . '        <INPUT type="hidden" name="viewlistid" value="' . $sViewListID . '">' . "\n" . '        <INPUT type="hidden" name="object" value="' . $this->sObject . '">' . "\n" . (!isset($this->sObjectID) ? '' : '        <INPUT type="hidden" name="object_id" value="' . $this->sObjectID . '">' . "\n") . (!isset($this->nID) ? '' : '        <INPUT type="hidden" name="id" value="' . $this->nID . '">' . "\n") . (!ACTION ? '' : '        <INPUT type="hidden" name="' . ACTION . '" value="">' . "\n") . '        <INPUT type="hidden" name="order" value="' . implode(',', $aOrder) . '">' . "\n";
            // Skipping (permanently hiding) columns.
            foreach ($aColsToSkip as $sCol) {
                if (array_key_exists($sCol, $this->aColumnsViewList)) {
                    // Internet Explorer refuses to submit input with equal names. If names are different, everything works fine.
                    // Somebody please tell me it's a bug and nobody's logical thinking. Had to include $sCol to make it work.
                    print '        <INPUT type="hidden" name="skip[' . $sCol . ']" value="' . $sCol . '">' . "\n";
                    // Check if we're skipping columns, that do have a search value. If so, it needs to be sent on like this.
                    if (isset($_GET['search_' . $sCol])) {
                        print '        <INPUT type="hidden" name="search_' . $sCol . '" value="' . htmlspecialchars($_GET['search_' . $sCol]) . '">' . "\n";
                    }
                }
            }
            if ($bHideNav) {
                print '        <INPUT type="hidden" name="hidenav" value="true">' . "\n";
            }
            if ($bOptions) {
                print '        <INPUT type="hidden" name="options" value="true">' . "\n";
            }
            print "\n";
        }
        // Make a reference variable of the session for cleaner code.
        $aSessionViewList =& $_SESSION['viewlists'][$sViewListID];
        // To make row ids persist when the viewList is refreshed, we must store the row id in $_SESSION.
        if (!empty($aSessionViewList['row_id'])) {
            $this->sRowID = $aSessionViewList['row_id'];
        } else {
            $aSessionViewList['row_id'] = $this->sRowID;
            // Implies array creation.
        }
        // To make row links persist when the viewList is refreshed, we must store the row link in $_SESSION.
        if (!empty($aSessionViewList['row_link'])) {
            $this->sRowLink = $aSessionViewList['row_link'];
        } else {
            $aSessionViewList['row_link'] = $this->sRowLink;
            // Implies array creation.
        }
        // Process input values regarding find & replace.
        // User clicked preview.
        $bFRPreview = !empty($_GET['FRPreviewClicked_' . $sViewListID]);
        // Selected field name for replace.
        $sFRFieldname = isset($_GET['FRFieldname_' . $sViewListID]) ? $_GET['FRFieldname_' . $sViewListID] : null;
        // Display name of selected field.
        $sFRFieldDisplayname = isset($_GET['FRFieldDisplayname_' . $sViewListID]) ? $_GET['FRFieldDisplayname_' . $sViewListID] : null;
        // Search query for find & replace.
        $sFRSearchValue = isset($_GET['FRSearch_' . $sViewListID]) ? $_GET['FRSearch_' . $sViewListID] : null;
        // Replace value for find & replace.
        $sFRReplaceValue = isset($_GET['FRReplace_' . $sViewListID]) ? $_GET['FRReplace_' . $sViewListID] : null;
        // Type of matching.
        $sFRMatchType = isset($_GET['FRMatchType_' . $sViewListID]) ? $_GET['FRMatchType_' . $sViewListID] : null;
        // Flag stating whether all field content sould be replaced.
        $bFRReplaceAll = !empty($_GET['FRReplaceAll_' . $sViewListID]);
        // Predicted affected row count.
        $nFRRowsAffected = null;
        // Find & replace options parameter.
        $aFROptions = array('sFRMatchType' => $sFRMatchType, 'bFRReplaceAll' => $bFRReplaceAll);
        $nTotal = 0;
        // Overwrites the previous $nTotal.
        if (!count($aBadSyntaxColumns)) {
            // Build argument list.
            $aArgs = array_merge($aArguments['WHERE'], $aArguments['HAVING']);
            if ($bFRPreview) {
                // User clicked 'preview' in Find&Replace form, add F&R changes as a separate
                // column in the query.
                $nFRRowsAffected = $this->previewColumnFindAndReplace($sFRFieldname, $sFRFieldDisplayname, $sFRSearchValue, $sFRReplaceValue, $aArgs, $aFROptions);
            }
            // First find the amount of rows returned. We can use the SQL_CALC_FOUND_ROWS()
            // function, but we'll try to avoid that due to extreme slowness in some cases.
            // getRowCountForViewList() will take care of that.
            // There is talk about a possible race condition using this technique on the mysql_num_rows man page, but I could find no evidence of it's existence on InnoDB tables.
            // Just to be sure, I'm implementing a serializable transaction, which should lock the table between the two SELECT queries to ensure proper results.
            // Last checked 2010-01-25, by Ivo Fokkema.
            $_DB->query('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE');
            $_DB->beginTransaction();
            // For ALL viewlists, we store the number of hits that we get, including the current filters.
            // For large tables, getting a count can take a long time (especially when using SQL_CALC_FOUND_ROWS).
            // ORDER BY is absolutely killing on large result sets.
            // So, long time to retrieve count (>1s) => don't count again, and no sort.
            // Count OK (<=1s), but big result set (250K) => no sort. ($_SETT['lists']['max_sortable_rows'])
            // 1) If we don't have a count in memory, request count separately.
            // Also if last count was >15min ago, request again.
            $bTrueCount = false;
            // Indicates whether or not we are sure about the number of results.
            $sFilterMD5 = md5($WHERE . '||' . $HAVING . '||' . implode('|', $aArgs));
            // A signature for the filters, NOTE that this depends on the column order!
            // FIXME: If this count takes longer than 1s, we don't estimate anymore like we used to (see line 1543).
            if (true || !isset($aSessionViewList['counts'][$sFilterMD5]['n'])) {
                $t = microtime(true);
                // Now, get the total number of hits if no LIMIT was used. Note that $nTotal gets overwritten here.
                $nTotal = $this->getRowCountForViewList($this->aSQLViewList, $aArgs);
                $tQ = microtime(true) - $t;
                $aSessionViewList['counts'][$sFilterMD5]['n'] = $nTotal;
                $aSessionViewList['counts'][$sFilterMD5]['t'] = $tQ;
                $aSessionViewList['counts'][$sFilterMD5]['d'] = time();
                $bTrueCount = true;
            }
            // Manipulate SELECT to include SQL_CALC_FOUND_ROWS.
            $bSQLCALCFOUNDROWS = false;
            // TODO: Remove this block. For now, this will be bypassed because $bTrueCount will always be true.
            if (!$bTrueCount && $_INI['database']['driver'] == 'mysql' && ($aSessionViewList['counts'][$sFilterMD5]['t'] < 1 || $aSessionViewList['counts'][$sFilterMD5]['d'] < time() - 60 * 15)) {
                // But only if we're using MySQL and it takes less than a second to get the correct number of results, or it's been more than 15 minutes since the last check!
                $this->aSQLViewList['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $this->aSQLViewList['SELECT'];
                $bSQLCALCFOUNDROWS = true;
            }
            if ($bOptions) {
                // If the session variable does not exist, create it!
                if (!isset($aSessionViewList['checked'])) {
                    $aSessionViewList['checked'] = array();
                }
                if (isset($_GET['ids_changed'])) {
                    if ($_GET['ids_changed'] == 'all') {
                        // If the select all button was clicked, fetch all entries and mark them as 'checked' in session.
                        // This query is the same as the viewList query, but without the ORDER BY and LIMIT, so that we can get the full result
                        // of the query.
                        $sSQL = $this->buildSQL(array('SELECT' => $this->aSQLViewList['SELECT'], 'FROM' => $this->aSQLViewList['FROM'], 'WHERE' => $this->aSQLViewList['WHERE'], 'GROUP_BY' => $this->aSQLViewList['GROUP_BY'], 'HAVING' => $this->aSQLViewList['HAVING']));
                        $q = $_DB->query($sSQL, $aArgs);
                        while ($zData = $q->fetchAssoc()) {
                            $zData = $this->generateRowID($zData);
                            // We only need the row_id here for knowing which ones we need to check.
                            // 2015-09-18; 3.0-14; We need to run rawurldecode() or else Columns are not selectable this way.
                            $aSessionViewList['checked'][] = rawurldecode($zData['row_id']);
                        }
                    } elseif ($_GET['ids_changed'] == 'none') {
                        // If the unselect all button was clicked, reset the 'checked' array.
                        $aSessionViewList['checked'] = array();
                    } else {
                        // Get the changed ids and remove them from or add them to the session.
                        $aIDsChanged = explode(';', $_GET['ids_changed']);
                        // Flip the keys & values, so that we can do a simple isset() to see if the id is already present.
                        $aSessionViewList['checked'] = array_flip($aSessionViewList['checked']);
                        // Determine the highest key number, so we can use that later when adding new values to the array.
                        $nIndex = count($aSessionViewList['checked']) ? max($aSessionViewList['checked']) + 1 : 0;
                        foreach ($aIDsChanged as $nID) {
                            if (isset($aSessionViewList['checked'][$nID])) {
                                // ID is found in the array, but is also in the 'ids_changed' array, so remove it!
                                unset($aSessionViewList['checked'][$nID]);
                            } else {
                                // ID is not found in the array, but IS in the 'ids_changed' array, so add it using the $nIndex as value we determined earlier.
                                // Also add 1 to the $nIndex so that the next id that needs to be added will not overwrite this one.
                                $aSessionViewList['checked'][$nID] = ++$nIndex;
                            }
                        }
                        // Flip the array back to its original state.
                        $aSessionViewList['checked'] = array_flip($aSessionViewList['checked']);
                    }
                }
            }
            // ORDER BY will only occur when we estimate we have time for it.
            if ($aSessionViewList['counts'][$sFilterMD5]['t'] < 1 && $aSessionViewList['counts'][$sFilterMD5]['n'] <= $_SETT['lists']['max_sortable_rows']) {
                $bSortableVL = true;
            } else {
                // Not sortable, indicate this on the VL...
                $aOrder = array('', '');
                $bSortableVL = false;
                // 2013-07-03; 3.0-07; However, we do try and sort because in principle, the order is random and this may cause confusion while paginating.
                //   So, as a result we'll try and sort on the PK. We attempt to determine this from the GROUP BY or ID col in the VL columns list.
                $sCol = '';
                if (isset($this->aSQLViewList['GROUP_BY'])) {
                    $sCol = $this->aSQLViewList['GROUP_BY'];
                } elseif ($this->aColumnsViewList['id']) {
                    $sCol = $this->aColumnsViewList['id']['db'][0];
                } elseif ($this->aColumnsViewList['id_']) {
                    $sCol = $this->aColumnsViewList['id_']['db'][0];
                }
                $this->aSQLViewList['ORDER_BY'] = $sCol;
            }
            if (!$bHideNav && FORMAT == 'text/html') {
                // Implement LIMIT only if navigation is not hidden.
                // We have a problem here, because we don't know how many hits there are,
                // because we're using SQL_CALC_FOUND_ROWS which only gives us the number
                // of hits AFTER we run the whole query. This means we should just assume
                // the page number is possible.
                $this->aSQLViewList['LIMIT'] = lovd_pagesplitInit();
                // Function requires variable names $_GET['page'] and $_GET['page_size'].
            }
            $sSQL = $this->buildSQL($this->aSQLViewList);
            // Run the viewList query.
            // FIXME; what if using AJAX? Probably we should generate a number here, if this query fails, telling the system to try once more. If that fails also, the JS should throw a general error, maybe.
            $q = $_DB->query($sSQL, $aArgs);
            // Now, get the total number of hits as if no LIMIT was used (when we have used the proper SELECT syntax). Note that $nTotal gets overwritten here.
            if ($bSQLCALCFOUNDROWS) {
                // FIXME: 't' needs to be recalculated as well!
                $nTotal = $_DB->query('SELECT FOUND_ROWS()')->fetchColumn();
                $aSessionViewList['counts'][$sFilterMD5]['n'] = $nTotal;
                $aSessionViewList['counts'][$sFilterMD5]['d'] = time();
                $bTrueCount = true;
            } else {
                // Estimate the number of results!
                $nTotal = $aSessionViewList['counts'][$sFilterMD5]['n'];
            }
            $_DB->commit();
            // To end the transaction and the locks that come with it.
        } else {
            // Set certain values that are needed for hiding notices, applicable for the "incorrect syntax" error message.
            $bTrueCount = true;
            // Yes, we're sure we have 0 results.
            $bSortableVL = false;
            // Sorting makes no sense when you have no results.
        }
        // If no results are found, try to figure out if it was because of the user's searching or not.
        if (!$nTotal) {
            $bSearched = false;
            $aHiddenSearch = array();
            foreach ($_GET as $key => $value) {
                if (substr($key, 0, 7) == 'search_') {
                    $sColumn = substr($key, 7);
                    if (!in_array($sColumn, $aColsToSkip)) {
                        $bSearched = true;
                    } elseif ($this->aColumnsViewList[$sColumn]['view']) {
                        $sColHeader = $this->aColumnsViewList[$sColumn]['view'][0];
                        // Make sure all hidden ID columns have "ID" in the header, so we can recognize them.
                        if (substr(rtrim($sColumn, '_'), -2) == 'id' && substr($sColHeader, -3) != ' ID') {
                            $sColHeader .= ' ID';
                        }
                        $aHiddenSearch[$sColHeader] = $value;
                    }
                }
            }
        }
        // FIXME; this is a temporary hack just to get the genes?authorize working when all users have been selected.
        //   There is no longer a viewList when all users have been selected, but we need one for the JS execution.
        //   Possibly, this code can be standardized a bit and, if necessary for other viewLists as well, can be kept here.
        if (!$nTotal && !$bSearched && ($this->sObject == 'User' && !empty($_GET['search_id']))) {
            // FIXME; Maybe check for JS contents of the rowlink?
            // There has been searched, but apparently the ID column is forced hidden. This must be the authorize page.
            $bSearched = true;
            // This will trigger the creation of the viewList table.
        }
        if (FORMAT == 'text/html' && ($nTotal || $bSearched)) {
            // Only print stuff if we're not just loading one entry right now.
            if (!$bOnlyRows) {
                if (!$bAjax) {
                    print '      <DIV id="viewlistDiv_' . $sViewListID . '">' . "\n";
                    // These contents will be replaced by Ajax.
                }
                // If we have a legend, create a hidden DIV that will be used for the full legend.
                print '      <DIV id="viewlistLegend_' . $sViewListID . '" title="Legend" style="display : none;">' . "\n" . '        <H2 class="LOVD">Legend</H2>' . "\n\n" . '        <I class="S11">Please note that a short description of a certain column can be displayed when you move your mouse cursor over the column\'s header and hold it still. Below, a more detailed description is shown per column.</I><BR><BR>' . "\n\n";
                $bLegend = false;
                // We need to check if we have a legend at all.
                foreach ($this->aColumnsViewList as $sField => $aCol) {
                    if (!empty($aCol['legend'])) {
                        $bLegend = true;
                        if (empty($aCol['legend'][1])) {
                            $aCol['legend'][1] = $aCol['legend'][0];
                        }
                        print '        <B>' . $aCol['view'][0] . '</B>: ' . $aCol['legend'][1];
                        if (substr($aCol['legend'][1], -5) == '</UL>') {
                            // No additional breaks, no possible listing of selection options. Column has its own UL already.
                            print "\n\n";
                            continue;
                        }
                        if (isset($this->aColumns[$sField]) && $this->aColumns[$sField]['form_type'][2] == 'select') {
                            // This is a custom column and it has a selection list with options. List the options below.
                            print '<BR>' . "\n" . '        All options:' . "\n" . '        <UL style="margin-top : 0px;">' . "\n";
                            foreach ($this->aColumns[$sField]['select_options'] as $sOption) {
                                print '          <LI>' . $sOption . '</LI>' . "\n";
                            }
                            print '      </UL>' . "\n\n";
                        } else {
                            print '<BR><BR>' . "\n\n";
                        }
                    }
                }
                print '      </DIV>' . "\n\n";
                if (!$bHideNav) {
                    lovd_pagesplitShowNav($sViewListID, $nTotal, $bTrueCount, $bSortableVL, $bLegend);
                }
                // 'checked' attribute values for find & replace menu options.
                $sFRMatchtypeCheck1 = !isset($sFRMatchType) || $sFRMatchType == '1' ? 'checked' : '';
                $sFRMatchtypeCheck2 = $sFRMatchType == '2' ? 'checked' : '';
                $sFRMatchtypeCheck3 = $sFRMatchType == '3' ? 'checked' : '';
                $sFRReplaceAllCheck = $bFRReplaceAll ? 'checked' : '';
                $sFRRowsAffected = !is_null($nFRRowsAffected) ? strval($nFRRowsAffected) : '';
                $sFRFieldname = htmlspecialchars($sFRFieldname);
                $sFRFieldDisplayname = htmlspecialchars($sFRFieldDisplayname);
                $sFRSearchValue = htmlspecialchars($sFRSearchValue);
                $sFRReplaceValue = htmlspecialchars($sFRReplaceValue);
                // Print options menu for find & replace (hidden by default).
                print <<<FROptions
<DIV id="viewlistFRFormContainer_{$sViewListID}" class="fnroptionsmenu" style="display: none;">
    <SPAN><B style="color: red">Note that find &amp; replace is still in BETA. Changes made using this feature are not checked for errors, therefore using find &amp; replace may have destructive consequences.<BR>Make a download or backup of the data you're about to edit. If uncertain, use the edit form of the data entries instead.</B><BR>
        Applying find &amp; replace to column
        &quot;<B id="viewlistFRColDisplay_{$sViewListID}">{$sFRFieldname}</B>&quot;.
        <INPUT id="FRFieldname_{$sViewListID}" type="hidden" name="FRFieldname_{$sViewListID}"
               value="{$sFRFieldname}" />
        <INPUT id="FRFieldDisplayname_{$sViewListID}" type="hidden"
               name="FRFieldDisplayname_{$sViewListID}" value="{$sFRFieldDisplayname}" />
        <INPUT id="FRRowsAffected_{$sViewListID}" type="hidden" value="{$sFRRowsAffected}" />
    </SPAN>
    <BR />
    <TABLE>
        <TR>
            <TD>Text to find</TD>
            <TD>
                <INPUT type="text" name="FRSearch_{$sViewListID}" value="{$sFRSearchValue}"
                       style="width: 110px" />
            </TD>
            <TD>
                <INPUT type="radio" name="FRMatchType_{$sViewListID}" value="1" {$sFRMatchtypeCheck1} />Match anywhere
                <INPUT type="radio" name="FRMatchType_{$sViewListID}" value="2" {$sFRMatchtypeCheck2} />Match at beginning of field
                <INPUT type="radio" name="FRMatchType_{$sViewListID}" value="3" {$sFRMatchtypeCheck3} />Match at end of field
            </TD>
        </TR>
        <TR>
            <TD>Replace with</TD>
            <TD>
                <INPUT type="text" name="FRReplace_{$sViewListID}" value="{$sFRReplaceValue}"
                       style="width: 110px" />
            </TD>
            <TD>
                <INPUT type="checkbox" name="FRReplaceAll_{$sViewListID}" value="1" {$sFRReplaceAllCheck} />Replace everything in field
            </TD>
        </TR>
    </TABLE>
    <INPUT id="FRPreview_{$sViewListID}" type="button" value="Preview" />
    <INPUT id="FRCancel_{$sViewListID}" type="button" value="Cancel" style="border : 1px solid #FF4422;" />
    <DIV id="FRSubmitDiv_{$sViewListID}">
        <BR>
        Enter your password to apply find and replace:<BR> 
        <INPUT type="password" name="password" size="20" />
        <INPUT id="FRSubmit_{$sViewListID}" type="submit" value="Submit" />
    </DIV>
</DIV>
FROptions;
                // Table and search headers (if applicable).
                print '      <TABLE border="0" cellpadding="0" cellspacing="1" class="data" id="viewlistTable_' . $sViewListID . '">' . "\n" . '        <THEAD>' . "\n" . '        <TR>' . ($bOptions ? "\n" . '          <TH valign="center" style="text-align:center;">' . "\n" . '            <IMG id="viewlistOptionsButton_' . $sViewListID . '" src="gfx/options.png" width="16" height="16" style="cursor : pointer;"></TH>' : '');
                foreach ($this->aColumnsViewList as $sField => $aCol) {
                    if (in_array($sField, $aColsToSkip)) {
                        continue;
                    }
                    $bSortable = !empty($aCol['db'][1]) && $bSortableVL;
                    // If we can't sort at all, nothing is sortable.
                    $bSearchable = !empty($aCol['db'][2]);
                    $nAllowFindAndReplace = (int) (!empty($aCol['allowfnr']));
                    // Later allow other columns as well, such as owned_by or statusid or so.
                    $sImg = '';
                    $sAlt = '';
                    if ($bSortable && $aOrder[0] == $sField) {
                        $sImg = $aOrder[1] == 'DESC' ? '_desc' : '_asc';
                        $sAlt = $aOrder[1] == 'DESC' ? 'Descending' : 'Ascending';
                    }
                    print "\n" . '          <TH valign="top"' . ($bSortable ? ' class="order' . ($aOrder[0] == $sField ? 'ed' : '') . '"' : '') . (empty($aCol['legend'][0]) ? '' : ' title="' . htmlspecialchars($aCol['legend'][0]) . '"') . ' data-allowfnr="' . $nAllowFindAndReplace . '" data-fieldname="' . $sField . '">' . "\n" . '            <IMG src="gfx/trans.png" alt="" width="' . $aCol['view'][1] . '" height="1" id="viewlistTable_' . $sViewListID . '_colwidth_' . $sField . '"><BR>' . (!$bSortable ? str_replace(' ', '&nbsp;', $aCol['view'][0]) . '<BR>' : "\n" . '            <DIV onclick="document.forms[\'viewlistForm_' . $sViewListID . '\'].order.value=\'' . $sField . ',' . ($aOrder[0] == $sField ? $aOrder[1] == 'ASC' ? 'DESC' : 'ASC' : $aCol['db'][1]) . '\'; if (document.forms[\'viewlistForm_' . $sViewListID . '\'].page) { document.forms[\'viewlistForm_' . $sViewListID . '\'].page.value=1; } lovd_AJAX_viewListSubmit(\'' . $sViewListID . '\');" style="position : relative;">' . "\n" . '              <IMG src="gfx/order_arrow' . $sImg . '.png" alt="' . $sAlt . '" title="' . $sAlt . '" width="13" height="12" style="position : absolute; top : 2px; right : 0px;">' . str_replace(' ', '&nbsp;', $aCol['view'][0]) . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</DIV>') . (!$bSearchable ? '' : "\n" . '            <INPUT type="text" name="search_' . $sField . '" value="' . (!isset($_GET['search_' . $sField]) ? '' : htmlspecialchars($_GET['search_' . $sField])) . '" title="' . $aCol['view'][0] . ' field should contain...' . (!empty($_GET['search_' . $sField]) ? "\nCurrent search:\n\n" . htmlspecialchars(lovd_formatSearchExpression($_GET['search_' . $sField], $aColTypes[$sField])) : '') . '" style="width : ' . ($aCol['view'][1] - 6) . 'px; font-weight : normal;" onkeydown="if (event.keyCode == 13) { if (document.forms[\'viewlistForm_' . $sViewListID . '\'].page) { document.forms[\'viewlistForm_' . $sViewListID . '\'].page.value=1; } setTimeout(\'lovd_AJAX_viewListSubmit(\\\'' . $sViewListID . '\\\')\', 0); return false;}">') . '</TH>';
                }
                print '</TR></THEAD>';
            }
        } elseif (FORMAT == 'text/plain') {
            // Download format: show headers.
            $sObject = $this->sObject == 'Custom_ViewList' ? $this->sObjectID : $this->sObject . 's';
            header('Content-type: text/plain; charset=UTF-8');
            header('Content-Disposition: attachment; filename="LOVD_' . $sObject . '_' . date('Y-m-d_H.i.s') . '.txt"');
            header('Pragma: public');
            print '### LOVD-version ' . lovd_calculateVersion($_SETT['system']['version']) . ' ### ' . $sObject . ' Quick Download format ### This file can not be imported ###' . "\r\n";
            // FIXME: this has to be done better, we can't see what we're filtering for, because it's in the arguments!
            $sFilter = $WHERE . ($WHERE && $HAVING ? ' AND ' : '') . $HAVING;
            if ($sFilter) {
                if (count($aArgs) == substr_count($sFilter, '?')) {
                    foreach ($aArgs as $sArg) {
                        $sFilter = preg_replace('/\\?/', ctype_digit($sArg) ? $sArg : '"' . $sArg . '"', $sFilter, 1);
                    }
                }
                print '## Filter: ' . $sFilter . "\r\n";
            }
            if (ACTION == 'downloadSelected') {
                print '## Filter: selected = ' . implode(',', $aSessionViewList['checked']) . "\r\n";
            }
            print '# charset=UTF-8' . "\r\n";
            $i = 0;
            foreach ($this->aColumnsViewList as $sField => $aCol) {
                if (in_array($sField, $aColsToSkip)) {
                    continue;
                }
                print ($i++ ? "\t" : '') . '"{{' . $sField . '}}"';
            }
            print "\r\n";
        }
        if (!$nTotal && FORMAT == 'text/html') {
            if ($bSearched) {
                // Searched, but no results. FIXME: link to the proper documentation entry about search expressions
                $sBadSyntaxColumns = implode(', ', array_unique($aBadSyntaxColumns));
                // FIXME; use an IF here.
                $sMessageNormal = 'No results have been found that match your criteria.<BR>Please redefine your search criteria.';
                $sMessageBadSyntax = 'Your search column' . (count($aBadSyntaxColumns) > 1 ? 's contain' : ' contains') . ' incorrect search expression syntax at: ' . $sBadSyntaxColumns . '.';
                $sMessage = empty($aBadSyntaxColumns) ? $sMessageNormal : $sMessageBadSyntax;
                if ($bOnlyRows) {
                    die('0');
                    // Silent error.
                }
                // FIXME; This code is sort of duplicated, some 100 lines below we also print this, *if* results are found.
                print '</TABLE><BR>' . "\n";
                // <BR> is necessary to keep the InfoTable apart from the data headers.
                if (!$bHideNav) {
                    print '        <INPUT type="hidden" name="total" value="' . $nTotal . '" disabled>' . "\n" . '        <INPUT type="hidden" name="page_size" value="' . $_GET['page_size'] . '">' . "\n" . '        <INPUT type="hidden" name="page" value="' . $_GET['page'] . '">' . "\n";
                }
                lovd_showInfoTable($sMessage, 'stop');
                print '      </DIV></FORM>' . "\n\n";
            } else {
                if ($bOnlyRows) {
                    die('0');
                    // Silent error.
                }
                print '      <DIV id="viewlistDiv_' . $sViewListID . '">' . "\n";
                // These contents will be replaced by Ajax.
                if (substr($this->sObject, -7) == 'Variant') {
                    $sUnit = 'variants' . (substr($this->sObject, 0, 10) == 'Transcript' ? ' on transcripts' : '');
                } elseif ($this->sObject == 'Custom_Viewlist') {
                    $sUnit = 'entries';
                } elseif ($this->sObject == 'Shared_Column') {
                    $sUnit = 'active columns';
                } else {
                    $sUnit = strtolower($this->sObject) . 's';
                }
                $sMessage = 'No ' . $sUnit . ' found';
                if (!empty($aHiddenSearch)) {
                    $sWhere = '';
                    foreach ($aHiddenSearch as $sCol => $sValue) {
                        // If the hidden column has "ID" in its name, it is the primary filter column.
                        if (substr($sCol, -3) == ' ID') {
                            $sWhere .= ($sWhere ? ' and ' : ' ') . 'for this ' . strtolower(substr($sCol, 0, -3));
                        } else {
                            $sWhere .= ($sWhere ? ' and ' : ' where ') . strtolower($sCol) . ' is "' . str_replace('|', '" or "', trim($sValue, '="') . '"');
                        }
                    }
                    $sMessage .= $sWhere;
                }
                lovd_showInfoTable($sMessage . '!', 'stop');
                print '      </DIV></FORM>' . "\n\n";
                return 0;
            }
        }
        // Now loop through the data and print. But check for $q to be set; if we had a bad search syntax, we end up here as well, but without an $q.
        while (isset($q) && $nTotal && ($zData = $q->fetchAssoc())) {
            // If row_id is not given by the database, but it should be created according to some format ($this->sRowID), put the data's ID in this format.
            $zData = $this->generateRowID($zData);
            // If row_link is not given by the database, but it should be created according to some format ($this->sRowLink), put the data's ID and the viewList's ID in this format.
            if (!isset($zData['row_link'])) {
                if ($this->sRowLink !== '' && $zData['row_id']) {
                    $zData['row_link'] = str_replace(array('{{ID}}', '{{ViewListID}}'), array(rawurlencode($zData['row_id']), $sViewListID), $this->sRowLink);
                    //$zData['row_link'] = preg_replace('/\{\{zData_(\w)+\}\}/', rawurlencode("$1"), $zData['row_link']);
                    //$zData['row_link'] = preg_replace_callback('/\{\{zData_(\w+)\}\}/', create_function('$aRegs', 'global $zData; return rawurlencode($zData[$aRegs[1]]);'), $zData['row_link']);
                    // FIXME; sorry, couldn't figure out how to do this in one line. Suggestions are welcome.
                    foreach ($zData as $key => $val) {
                        // Also allow data from $zData to be put into the row link & row id.
                        // FIXME; This is a temporary ugly solution, so we need to fix this later!!!!
                        $zData['row_link'] = preg_replace('/\\{\\{' . preg_quote($key, '/') . '\\}\\}/', rawurlencode($val), $zData['row_link']);
                        $zData['row_link'] = preg_replace('/\\{\\{zData_' . preg_quote($key, '/') . '\\}\\}/', rawurlencode($val), $zData['row_link']);
                    }
                } else {
                    $zData['row_link'] = '';
                }
            }
            $zData = $this->autoExplode($zData);
            // Only the CustomViewList object has this 3rd argument, but other objects' prepareData()
            // don't complain when called with this 3 argument they didn't define.
            $zData = $this->prepareData($zData, 'list', $sViewListID);
            if (FORMAT == 'text/html') {
                // FIXME; rawurldecode() in the line below should have a better solution.
                // IE (who else) refuses to respect the BASE href tag when using JS. So we have no other option than to include the full path here.
                print "\n" . '        <TR class="' . (empty($zData['class_name']) ? 'data' : $zData['class_name']) . '"' . (!$zData['row_id'] ? '' : ' id="' . $zData['row_id'] . '"') . ' valign="top"' . (!$zData['row_link'] ? '' : ' style="cursor : pointer;"') . (!$zData['row_link'] ? '' : ' onclick="' . (substr($zData['row_link'], 0, 11) == 'javascript:' ? rawurldecode(substr($zData['row_link'], 11)) : 'window.location.href = \'' . lovd_getInstallURL(false) . $zData['row_link'] . '\';') . '"') . '>';
                if ($bOptions) {
                    print "\n" . '          <TD align="center" class="checkbox" onclick="cancelParentEvent(event);"><INPUT id="check_' . $zData['row_id'] . '" class="checkbox" type="checkbox" name="check_' . $zData['row_id'] . '" onclick="lovd_recordCheckChanges(this, \'' . $sViewListID . '\');"' . (in_array($zData['row_id'], $aSessionViewList['checked']) ? ' checked' : '') . '></TD>';
                }
                foreach ($this->aColumnsViewList as $sField => $aCol) {
                    if (in_array($sField, $aColsToSkip)) {
                        continue;
                    }
                    print "\n" . '          <TD' . (!empty($aCol['view'][2]) ? ' ' . $aCol['view'][2] : '') . ($aOrder[0] == $sField ? ' class="ordered"' : '') . '>' . ($zData[$sField] === '' ? '-' : $zData[$sField]) . '</TD>';
                }
                print '</TR>';
            } elseif (FORMAT == 'text/plain') {
                // Download format: print contents.
                if (ACTION == 'downloadSelected' && !in_array($zData['row_id'], $aSessionViewList['checked'])) {
                    // Only selected entries should be downloaded. And this one is not selected.
                    continue;
                }
                $i = 0;
                foreach ($this->aColumnsViewList as $sField => $aCol) {
                    if (in_array($sField, $aColsToSkip)) {
                        continue;
                    }
                    print ($i++ ? "\t" : '') . '"' . str_replace(array("\r\n", "\r", "\n"), array('\\r\\n', '\\r', '\\n'), addslashes(html_entity_decode(strip_tags($zData[$sField])))) . '"';
                }
                print "\r\n";
            }
        }
        // Only print stuff if we're not just loading one entry right now.
        if ($nTotal && !$bOnlyRows && FORMAT == 'text/html') {
            print '</TABLE>' . "\n";
            if (!$bHideNav) {
                print '        <INPUT type="hidden" name="total" value="' . $nTotal . '" disabled>' . "\n" . '        <INPUT type="hidden" name="page_size" value="' . $_GET['page_size'] . '">' . "\n" . '        <INPUT type="hidden" name="page" value="' . $_GET['page'] . '">' . "\n\n";
                lovd_pagesplitShowNav($sViewListID, $nTotal, $bTrueCount, $bSortableVL, $bLegend);
            }
            if (!$bAjax) {
                print '      </DIV></FORM><BR>' . "\n";
                // These contents will be replaced by Ajax.
            }
        }
        if (!$bAjax && FORMAT == 'text/html') {
            // If sent using Ajax, the browser is not going to evaluate this code, anyways.
            print '      <SCRIPT type="text/javascript">' . "\n" . '        // This has to be run when the document has finished loading everything, because only then can it get the proper width from IE7 and lower!' . "\n" . '        $( function () {lovd_stretchInputs(\'' . $sViewListID . '\');});' . "\n";
            if ($bOptions) {
                $sFRMenuOption = '';
                if ($bFindReplace) {
                    // Add find & replace menu item to viewlist options menu.
                    $sFRMenuOption = <<<FRITEM
'            <LI class="icon">' +
'                <A click="lovd_FRColumnSelector(\\'{$sViewListID}\\');">' +
'                    <SPAN class="icon" style=""></SPAN>' +
'                    Find and replace text in column' +
'                </A>' +
'            </LI>' +
FRITEM;
                }
                print <<<OPMENU
        // If menu's UL doesn't exist yet, create it.
        if (\$('#viewlistMenu_{$sViewListID}').attr('id') == undefined) {
          var oUL = window.document.createElement('ul');
          oUL.setAttribute('id', 'viewlistMenu_{$sViewListID}');
          oUL.className = 'jeegoocontext jeegooviewlist';
          window.document.body.appendChild(oUL);
        }
        // Fix the top border that could not be set through jeegoo's style.css.
        \$('#viewlistMenu_{$sViewListID}').attr('style', 'border-top : 1px solid #000;');
        \$('#viewlistMenu_{$sViewListID}').prepend(
'            <LI class="icon">' +
'                <A click="check_list[\\'{$sViewListID}\\'] = \\'all\\'; lovd_AJAX_viewListSubmit(\\'{$sViewListID}\\');">' +
'                    <SPAN class="icon" style="background-image: url(gfx/check.png);"></SPAN>' +
'                    Select all <SPAN>entries</SPAN>' +
'                </A>' +
'            </LI>' +
'            <LI class="icon">' +
'                <A click="check_list[\\'{$sViewListID}\\'] = \\'none\\'; lovd_AJAX_viewListSubmit(\\'{$sViewListID}\\');">' +
'                    <SPAN class="icon" style="background-image: url(gfx/cross.png);"></SPAN>' +
'                    Unselect all' +
'                </A>' +
'            </LI>' +
{$sFRMenuOption}
'            ');
        \$('#viewlistMenu_{$sViewListID}').append(
'            <LI class="icon">' +
'                <A click="lovd_AJAX_viewListSubmit(\\'{$sViewListID}\\', function(){lovd_AJAX_viewListDownload(\\'{$sViewListID}\\', true);});">' +
'                    <SPAN class="icon" style="background-image: url(gfx/menu_save.png);"></SPAN>' +
'                    Download all entries (summary data)' +
'                </A>' +
'            </LI>' +
'            <LI class="icon">' +
'                <A click="lovd_AJAX_viewListSubmit(\\'{$sViewListID}\\', function(){lovd_AJAX_viewListDownload(\\'{$sViewListID}\\', false);});">' +
'                    <SPAN class="icon" style="background-image: url(gfx/menu_save.png);"></SPAN>' +
'                    Download selected entries (summary data)' +
'                </A>' +
'            </LI>');
        lovd_activateMenu('{$sViewListID}');
OPMENU;
            }
            print '        check_list[\'' . $sViewListID . '\'] = [];' . "\n" . '      </SCRIPT>' . "\n\n";
        }
        return $nTotal;
    }
Example #23
0
         if ($_POST['statusid'] >= STATUS_MARKED) {
             $aGenes = $_DB->query('SELECT DISTINCT t.geneid FROM ' . TABLE_TRANSCRIPTS . ' AS t ' . 'INNER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ON (vot.transcriptid = t.id) ' . 'INNER JOIN ' . TABLE_VARIANTS . ' AS vog ON (vog.id = vot.id) ' . 'INNER JOIN ' . TABLE_SCR2VAR . ' AS s2v ON (s2v.variantid = vog.id) ' . 'INNER JOIN ' . TABLE_SCREENINGS . ' AS s ON (s.id = s2v.screeningid) ' . 'WHERE vog.statusid >= ? AND s.individualid = ?', array(STATUS_MARKED, $nID))->fetchAllColumn();
         }
         $_DATA->deleteEntry($nID);
         if ($_POST['statusid'] >= STATUS_MARKED && $aGenes) {
             // Change updated date for genes.
             lovd_setUpdatedDate($aGenes);
         }
         $_DB->commit();
         // Write to log...
         lovd_writeLog('Event', LOG_EVENT, 'Deleted individual information entry ' . $nID . ' (Owner: ' . $zData['owner'] . ')');
         // Thank the user...
         header('Refresh: 3; url=' . lovd_getInstallURL() . $_PE[0]);
         $_T->printHeader();
         $_T->printTitle();
         lovd_showInfoTable('Successfully deleted the individual information entry!', 'success');
         $_T->printFooter();
         exit;
     } else {
         // Because we're sending the data back to the form, I need to unset the password field!
         unset($_POST['password']);
     }
 }
 $_T->printHeader();
 $_T->printTitle();
 lovd_errorPrint();
 // Table.
 print '      <FORM action="' . CURRENT_PATH . '?' . ACTION . '" method="post">' . "\n";
 $nVariants = $_DB->query('SELECT COUNT(DISTINCT s2v.variantid) FROM ' . TABLE_SCREENINGS . ' AS s LEFT OUTER JOIN ' . TABLE_SCR2VAR . ' AS s2v ON (s.id = s2v.screeningid) WHERE s.individualid = ? GROUP BY s.individualid', array($nID))->fetchColumn();
 $aOptions = array('remove' => 'Also remove all variants attached to this individual', 'keep' => 'Keep all attached variants as separate entries');
 // Array which will make up the form table.
Example #24
0
    function printHeaderHTML($bFull = true)
    {
        // Print the LOVD header, including the menu (if $bFull == true).
        global $_AUTH, $_CONF, $_DB, $_SETT, $_STAT;
        // Build menu, if tabs are shown.
        if ($bFull) {
            $this->buildMenu();
        }
        ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<HTML lang="en_US">
<HEAD>
  <TITLE><?php 
        echo (!defined('PAGE_TITLE') ? '' : PAGE_TITLE . ' - ') . $_CONF['system_title'];
        ?>
</TITLE>
  <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <META name="author" content="LOVD development team, LUMC, Netherlands">
  <META name="generator" content="gPHPEdit / GIMP @ GNU/Linux (Ubuntu)">
  <BASE href="<?php 
        echo lovd_getInstallURL();
        ?>
">
  <LINK rel="stylesheet" type="text/css" href="styles.css">
  <LINK rel="stylesheet" type="text/css" href="lib/jeegoocontext/style.css">
  <LINK rel="shortcut icon" href="favicon.ico" type="image/x-icon">

<?php 
        // FIXME; later?
        /*  <LINK rel="alternate" type="application/atom+xml" title="<?php echo $_CONF['system_title']; ?> Atom 1.0 feed" href="<?php echo ROOT_PATH; ?>api/feed.php" />*/
        lovd_includeJS('inc-js-openwindow.php', 1);
        lovd_includeJS('inc-js-toggle-visibility.js', 1);
        // Used on forms and variant overviews for small info tables.
        lovd_includeJS('lib/jQuery/jquery.min.js', 1);
        lovd_includeJS('lib/jQuery/jquery-ui.custom.min.js', 1);
        lovd_includeJS('lib/jeegoocontext/jquery.jeegoocontext.min.js', 1);
        if (!$bFull) {
            ?>
</HEAD>

<BODY style="margin : 10px;">

<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
  <TR>
    <TD>










<?php 
            return true;
        }
        $sCurrSymbol = $sCurrGene = '';
        if (!empty($_SESSION['currdb'])) {
            // FIXME; Currently we don't support "=GENE" matching (for instance, on the disease tab) because changing that value will not trigger a change in CURRDB... Yet.
            $sGeneSwitchURL = preg_replace('/(\\/)' . preg_quote($_SESSION['currdb'], '/') . '\\b/', "\$1{{GENE}}", $_SERVER['REQUEST_URI']);
            // Just use currently selected database.
            $sCurrSymbol = $_SESSION['currdb'];
            $sCurrGene = $_SETT['currdb']['name'];
        }
        // FIXME; how will we handle this? (if we'll handle this)
        // During submission, show the gene we're submitting to instead of the currently selected gene.
        //if (lovd_getProjectFile() == '/submit.php' && !empty($_POST['gene']) && $_POST['gene'] != $_SESSION['currdb']) {
        //    // Fetch gene's info from db... we don't have it anywhere yet.
        //    list($sCurrSymbol, $sCurrGene) = $_DB->query('SELECT id, gene FROM ' . TABLE_DBS . ' WHERE id = ?', array($_POST['gene']))->fetchRow();
        //}
        ?>

  <SCRIPT type="text/javascript">
    var geneSwitcher = '';

    function lovd_switchGene()
    {
        // Fetches the gene switcher data from LOVD. Might be a form with a
        // dropdown, or a form with a text field for autocomplete.
        $.get('ajax/get_gene_switcher.php', function (sData, sStatus)
        {
            geneSwitcher = sData;
            if (geneSwitcher === '<?php 
        echo AJAX_DATA_ERROR;
        ?>
') {
                alert('Error when retrieving a list of genes');
                return;
            }
            $('#gene_name').hide();

            $('#gene_switcher').html(geneSwitcher['html']);
            if (geneSwitcher['switchType'] === 'autocomplete') {
                $('#select_gene_autocomplete').autocomplete({
                    source: geneSwitcher['data'],
                    minLength: 3
                }).on('autocompleteselect', function (e, ui) { $(this).val(ui['item']['value']); $(this).parent().parent().submit(); }); // Auto submit on selecting the gene from the list.
                // And set focus to the field, too.
                $('#select_gene_autocomplete').focus();
            }
        },'json'
        ).fail(function (sData, sStatus)
        {
            alert('Error when retrieving a list of genes: ' + sStatus);
        });
    }

    function lovd_changeURL ()
    {
        // Replaces the gene in the current URL with the one selected.
        var sURL = '<?php 
        if (!empty($_SESSION['currdb'])) {
            echo $sGeneSwitchURL;
        }
        ?>
';
        // FIXME; It is very very difficult to keep the hash, it should be selective since otherwise you might be loading the EXACT SAME VL, BUT ON A DIFFERENT PAGE (viewing variants belonging to gene X, on a page that says you're looking at gene Y).
        if (geneSwitcher['switchType'] === 'autocomplete') {
            document.location.href = sURL.replace('{{GENE}}', $('#select_gene_autocomplete').val());
        } else {
            document.location.href = sURL.replace('{{GENE}}', $('#select_gene_dropdown').val());
        }
    }

  </SCRIPT>
  <LINK rel="stylesheet" type="text/css" href="lib/jQuery/css/cupertino/jquery-ui.custom.css">
</HEAD>

<BODY style="margin : 0px;">

<?php 
        // Check for announcements. Ignore errors, in case the table doesn't exist yet.
        $qAnnouncements = @$_DB->query('SELECT id, type, announcement FROM ' . TABLE_ANNOUNCEMENTS . ' WHERE start_date <= NOW() AND end_date >= NOW()', array(), false);
        if ($qAnnouncements) {
            $zAnnouncements = $qAnnouncements->fetchAllAssoc();
        } else {
            $zAnnouncements = array();
        }
        foreach ($zAnnouncements as $zAnnouncement) {
            lovd_showInfoTable($zAnnouncement['announcement'], $zAnnouncement['type'], '100%', !$_AUTH || $_AUTH['level'] < LEVEL_MANAGER ? '' : 'announcements/' . $zAnnouncement['id'], false);
        }
        ?>

<TABLE border="0" cellpadding="0" cellspacing="0" width="100%"><TR><TD>

<TABLE border="0" cellpadding="0" cellspacing="0" width="100%" class="logo" style="position : fixed; z-index : 10">
  <TR>
<?php 
        if (!is_readable(ROOT_PATH . $_CONF['logo_uri'])) {
            $_CONF['logo_uri'] = 'gfx/LOVD3_logo145x50.jpg';
        }
        $aImage = @getimagesize(ROOT_PATH . $_CONF['logo_uri']);
        if (!is_array($aImage)) {
            $aImage = array('130', '50', '', 'width="130" heigth="50"');
        }
        list($nWidth, $nHeight, $sType, $sSize) = $aImage;
        print '    <TD valign="top" width="' . ($nWidth + 20) . '" height="' . ($nHeight + 5) . '">' . "\n" . '      <IMG src="' . $_CONF['logo_uri'] . '" alt="LOVD - Leiden Open Variation Database" ' . $sSize . '>' . "\n" . '    </TD>' . "\n";
        print '    <TD valign="top" style="padding-top : 2px; white-space : nowrap; width : 100%">' . "\n" . '      <H2 style="margin-bottom : 2px;">' . $_CONF['system_title'] . '</H2>';
        if ($sCurrSymbol && $sCurrGene) {
            print '      <H5 id="gene_name" style="display:inline">' . $sCurrGene . ' (' . $sCurrSymbol . ')' . "\n";
            if (strpos($sGeneSwitchURL, '{{GENE}}') !== false) {
                print '        <A href="#" onclick="lovd_switchGene(); return false;">' . "\n" . '          <IMG src="gfx/lovd_genes_switch_inline.png" width="23" height="23" alt="Switch gene" title="Switch gene database" align="top">' . "\n" . '        </A>' . "\n";
            }
            print '      </H5>' . "\n";
        }
        // With an ajax call, the H5 with ID 'gene_switcher' is filled with a dropdown or an autocomplete field.
        // This is done with function lovd_switchGene().
        print '      <H5 id="gene_switcher"></H5>' . "\n" . '    </TD>' . "\n" . '    <TD valign="top" align="right" style="padding-right : 5px; padding-top : 2px; white-space: nowrap; padding-left: 20px;">' . "\n" . '      LOVD v.' . $_STAT['tree'] . ' Build ' . $_STAT['build'] . (!defined('NOT_INSTALLED') ? ' [ <A href="status">Current LOVD status</A> ]' : '') . '<BR>' . "\n";
        if (!(defined('NOT_INSTALLED') || ROOT_PATH == '../' && substr(lovd_getProjectFile(), 0, 9) == '/install/')) {
            if ($_AUTH) {
                print '      <B>Welcome, ' . $_AUTH['name'] . '</B><BR>' . "\n" . '      <A href="users/' . $_AUTH['id'] . '"><B>Your account</B></A> | ' . (false && $_AUTH['level'] == LEVEL_SUBMITTER && $_CONF['allow_submitter_mods'] ? '<A href="variants?search_created_by=' . $_AUTH['id'] . '"><B>Your submissions</B></A> | ' : '') . (!empty($_AUTH['saved_work']['submissions']['individual']) || !empty($_AUTH['saved_work']['submissions']['screening']) ? '<A href="users/' . $_AUTH['id'] . '?submissions"><B>Unfinished submissions</B></A> | ' : '') . '<A href="logout"><B>Log out</B></A>' . "\n";
            } else {
                print '      ' . (!$_CONF['allow_submitter_registration'] || $_CONF['lovd_read_only'] ? '' : '<A href="users?register"><B>Register as submitter</B></A> | ') . '<A href="login"><B>Log in</B></A>' . "\n";
            }
        }
        print '    </TD>' . "\n" . '  </TR>' . "\n" . '</TABLE>' . "\n\n";
        $nTotalTabWidth = 0;
        // Will stretch the page at least this far, so the tabs don't "break" if the window is narrow.
        print '<TABLE border="0" cellpadding="0" cellspacing="0" width="100%" class="logo" style="margin-top:55px;' . (count($this->aMenu) ? '' : ' border-bottom : 2px solid #000000;') . '">' . "\n";
        // Add curator info to header.
        if ($sCurrSymbol && $sCurrGene) {
            $sCurators = '';
            $aCurators = $_DB->query('SELECT u.name, u.email FROM ' . TABLE_USERS . ' AS u LEFT JOIN ' . TABLE_CURATES . ' AS u2g ON (u.id = u2g.userid) WHERE u2g.geneid = ? AND u2g.allow_edit = 1 AND u2g.show_order > 0 ORDER BY u2g.show_order ASC, u.level DESC, u.name ASC', array($sCurrSymbol))->fetchAllAssoc();
            $nCurators = count($aCurators);
            foreach ($aCurators as $i => $z) {
                $i++;
                $sCurators .= ($sCurators ? $i == $nCurators ? ' and ' : ', ' : '') . '<A href="mailto:' . str_replace(array("\r\n", "\r", "\n"), ', ', trim($z['email'])) . '">' . $z['name'] . '</A>';
            }
            if ($sCurators) {
                print '  <TR>' . "\n" . '    <TD width="150">&nbsp;</TD>' . "\n" . '    <TD valign="top" colspan="2" style="padding-bottom : 2px;"><B>Curator' . ($nCurators > 1 ? 's' : '') . ': ' . $sCurators . '</B></TD>' . "\n" . '  </TR>' . "\n";
            }
        }
        // Build menu tabs...
        print '  <TR>' . "\n" . '    <TD align="left" colspan="2" style="background : url(\'gfx/tab_fill.png\'); background-repeat : repeat-x;">' . "\n";
        // Loop menu.
        $n = 0;
        $bPrevSel = false;
        $aMenus = array();
        $bCurator = $_AUTH && (count($_AUTH['curates']) || $_AUTH['level'] > LEVEL_CURATOR);
        // We can't check LEVEL_CURATOR since it may not be set.
        foreach ($this->aMenu as $sPrefix => $Title) {
            // Arrays (children links of parent tabs) can only be processed if we still have the $sFile from the previous run.
            if (is_array($Title)) {
                if (empty($sFile)) {
                    continue;
                }
                $sPrefix = substr($sFile, 4);
                // Remove 'tab_'.
                // Menu will be built in an UL, that will be transformed into a dropdown menu by using the Jeegocontext script by www.planitworks.nl.
                $sUL = '<UL id="menu_' . $sFile . '" class="jeegoocontext">' . "\n";
                $bHR = false;
                foreach ($Title as $sURL => $aItem) {
                    if (!is_array($aItem)) {
                        if ($aItem == 'hr') {
                            $bHR = true;
                        }
                        continue;
                    }
                    list($sIMG, $sName, $nRequiredLevel) = $aItem;
                    $bDisabled = false;
                    if ($nRequiredLevel && ($nRequiredLevel == LEVEL_CURATOR && !$bCurator || $nRequiredLevel != LEVEL_CURATOR && $nRequiredLevel > $_AUTH['level'])) {
                        $bDisabled = true;
                    } else {
                        if (!$sURL) {
                            // Default action of default page.
                            $sURL = $sPrefix;
                        } elseif ($sURL[0] == '/') {
                            // Direct URL.
                            $sURL = substr($sURL, 1);
                        } else {
                            // Action given.
                            $sURL = $sPrefix . '?' . $sURL;
                        }
                    }
                    if (!$bDisabled) {
                        // IE (who else) refuses to respect the BASE href tag when using JS. So we have no other option than to include the full path here.
                        // Not using the "separator" class from the original code, since it's not compatible to our changes.
                        $sUL .= ($bHR ? '  <LI class="hr disabled"><HR></LI>' . "\n" : '') . '  <LI' . (!$sIMG ? '' : ' class="icon"') . '><A href="' . lovd_getInstallURL(false) . $sURL . '">' . (!$sIMG ? '' : '<SPAN class="icon" style="background-image: url(gfx/' . $sIMG . ');"></SPAN>') . $sName . '</A></LI>' . "\n";
                        $bHR = false;
                    }
                    // class disabled, disabled. Nu gewoon maar even weggehaald.
                    //                    $sUL .= '  <LI class="disabled">' .
                    //                        (!$sIMG? '' : '<SPAN class="icon" style="background-image: url(gfx/' . preg_replace('/(\.[a-z]+)$/', '_disabled' . "$1", $sIMG) . ');"></SPAN>') . $sName .
                    //                        '</LI>' . "\n";
                }
                $sUL .= '</UL>' . "\n";
                $aMenus[$sFile] = $sUL;
                continue;
            }
            // Determine if we're the current tab.
            if (defined('TAB_SELECTED')) {
                // Hard coded exceptions...
                $bSel = TAB_SELECTED == $sPrefix;
            } else {
                $bSel = substr(lovd_getProjectFile(), 1, strrpos(lovd_getProjectFile(), '.') - 1) == $sPrefix;
            }
            $sFile = 'tab_' . $sPrefix;
            // Print transition.
            $nTotalTabWidth += 25;
            print '      <IMG src="gfx/tab_' . (!$n ? '0' : ($bPrevSel ? 'F' : 'B')) . ($bSel ? 'F' : 'B') . '.png" alt="" width="25" height="25" align="left">' . "\n";
            // Get header info.
            $sFileName = 'gfx/' . $sFile . '_' . ($bSel ? 'F' : 'B') . '.png';
            $aImage = @getimagesize(ROOT_PATH . $sFileName);
            $sSize = $aImage[3];
            // Print header.
            $sURL = $sPrefix;
            // If a gene has been selected, some of the tabs get different default URLs.
            if ($_SESSION['currdb']) {
                if (in_array($sPrefix, array('configuration', 'genes', 'transcripts', 'variants', 'screenings', 'individuals'))) {
                    $sURL = $sPrefix . '/' . $_SESSION['currdb'];
                    if ($sPrefix == 'variants') {
                        $sURL .= '/unique';
                    }
                } elseif ($sPrefix == 'diseases') {
                    $sURL = $sPrefix . '?search_genes_=' . $_SESSION['currdb'];
                }
            }
            $nTotalTabWidth += $aImage[0];
            print '      <A href="' . $sURL . '"><IMG src="' . $sFileName . '" alt="' . $Title . '" id="' . $sFile . '" ' . $sSize . ' align="left"></A>' . "\n";
            $bPrevSel = $bSel;
            $n++;
        }
        // If we've had tabs at all, close the transition.
        if (count($this->aMenu)) {
            $nTotalTabWidth += 25;
            print '      <IMG src="gfx/tab_' . ($bPrevSel ? 'F' : 'B') . '0.png" alt="" width="25" height="25" align="left">' . "\n";
        }
        // Close menu table.
        print '    </TD>' . "\n" . '  </TR>' . "\n" . '</TABLE>' . "\n\n" . '<IMG src="gfx/trans.png" alt="" width="' . $nTotalTabWidth . '" height="0">' . "\n\n";
        // Attach dropdown menus.
        print '<!-- Start drop down menu definitions -->' . "\n";
        foreach ($aMenus as $sUL) {
            print $sUL . "\n";
        }
        print '
<SCRIPT type="text/javascript">
  $(function(){
    var aMenuOptions = {
        widthOverflowOffset: 0,
        heightOverflowOffset: 1,' . '
        startLeftOffset: -20,
        event: "mouseover",
        openBelowContext: true,
        autoHide: true,
        delay: 100,
        onSelect: function(e, context){
            if($(this).hasClass("disabled"))
            {
                return false;
            } else {
                window.location = $(this).find("a").attr("href");
                return false;
            }
        }
    };' . "\n";
        foreach (array_keys($aMenus) as $sTabID) {
            print '    $(\'#' . $sTabID . '\').jeegoocontext(\'menu_' . $sTabID . '\', aMenuOptions);' . "\n";
        }
        print '  });
</SCRIPT>' . "\n" . '<!-- End drop down menu definitions -->' . "\n";
        ?>



<DIV style="padding : 0px 10px;">
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
  <TR>
    <TD style="padding-top : 10px;">







<?php 
        return true;
    }
Example #25
0
        if ($q === false) {
            // Query to TABLE_COLLEAGUES failed (note: this table was introduced in 3.0-14e).
            // FIXME: This if can be removed (and the above query made required)
            // when we stop supporting upgrading from 3.0-15 or before.
            $_AUTH['colleagues_from'] = array();
        } else {
            $_AUTH['colleagues_from'] = $q->fetchAllCombine();
        }
    }
}
// IP based blocking.
if ($_AUTH && $_AUTH['allowed_ip']) {
    if (!lovd_validateIP($_AUTH['allowed_ip'], $_SERVER['REMOTE_ADDR'])) {
        // Log the user out.
        session_destroy();
        $_AUTH = false;
        $_SESSION['currdb'] = false;
        $_T->printHeader();
        $_T->printTitle('Access denied');
        lovd_showInfoTable('Your current IP address does not allow you access using this username.', 'stop');
        $_T->printFooter();
        exit;
    }
}
if (!$_AUTH) {
    // We need to check for cookies, so set whatever and check whether it's there later...
    if (!isset($_COOKIE['lovd_cookie_check'])) {
        // @ is to suppress errors in Travis test.
        @setcookie('lovd_cookie_check', 'OK');
    }
}
Example #26
0
function lovd_showPageAccessDenied($sLogMessage = null, $sPageTitle = 'Access denied', $sInfoText = 'You do not have access to this content.')
{
    // Show a page saying access denied.
    global $_T;
    $_T->printHeader();
    if (!is_null($sPageTitle)) {
        $_T->printTitle($sPageTitle);
    } else {
        $_T->printTitle();
    }
    if (!is_null($sLogMessage)) {
        lovd_writeLog('Error', 'HackAttempt', $sLogMessage);
    }
    lovd_showInfoTable($sInfoText, 'stop');
    $_T->printFooter();
}
Example #27
0
    }
    $sSMTP = '<IMG src="gfx/mark_' . (int) $bSMTP . '.png" alt="" width="11" height="11">&nbsp;' . ($bSMTP ? 'R' : 'No r') . 'esponse from mail server (recommended' . ($bSMTP ? '' : ', please check your PHP configuration') . ')';
    // 2012-02-01; 3.0-beta-02; Check for "MultiViews" or Apache's mod_rewrite, or anything some other webserver may have that does the same.
    $aResultNoExt = @lovd_php_file(lovd_getInstallURL() . 'setup');
    $aResultExt = @lovd_php_file(lovd_getInstallURL() . 'setup.php');
    $bMultiViews = !(!$aResultNoExt && $aResultExt);
    $sMultiViews = '<IMG src="gfx/mark_' . (int) $bMultiViews . '.png" alt="" width="11" height="11">&nbsp;MultiViews, mod_rewrite or equivalent : ' . ($bMultiViews ? 'en' : 'dis') . 'abled (required)';
    // FIXME; link to manual?
    if (!$bPHP || !$bPHPFunctions || !$bMySQL || !$bInnoDB || !$bMultiViews) {
        // Failure!
        lovd_showInfoTable('One or more requirements are not met!<BR>I will now bluntly refuse to install.<BR><BR>' . $sPHP . '<BR>' . $sPHPRequirements . $sMySQL . '<BR>' . $sInnoDB . '<BR>' . $sSMTP . '<BR>' . $sMultiViews, 'stop');
        $_T->printFooter();
        exit;
    } else {
        // Success!
        lovd_showInfoTable('System check for requirements all OK!<BR><BR>' . $sPHP . '<BR>' . $sPHPRequirements . $sMySQL . '<BR>' . $sInnoDB . '<BR>' . $sSMTP . '<BR>' . $sMultiViews, 'success');
    }
    print '      The installation of LOVD consists of ' . (count($aInstallSteps) - 1) . ' simple steps.
      This installer will create the LOVD tables in the MySQL database, create the Administrator account and will help you configure LOVD. Installation and initial configuration of LOVD should be simple for a relatively experienced computer user.<BR>
      <BR>
      The installation progress bar at the top of the screen shows how far you are in the installation process. The installation steps are shown at the left of the screen.<BR>
      <BR>' . "\n\n";
    lovd_printInstallForm();
    $_T->printFooter();
    exit;
} elseif ($_GET['step'] == 0) {
    $_GET['step']++;
}
if ($_GET['step'] == 1 && defined('NOT_INSTALLED')) {
    // Step 1: Administrator account details.
    if ($_DB->query('SHOW TABLES LIKE "' . TABLE_USERS . '"')->fetchColumn() && $_DB->query('SELECT COUNT(*) FROM ' . TABLE_USERS)->fetchColumn()) {
Example #28
0
            unset($_TABLES_cleaned['TABLE_HITS']);
            print '  Found ' . $nTables . '/' . count($_TABLES_cleaned) . ' tables.' . "\n";
            // FIXME; add more later.
            // General statistics...
            print "\n";
            // 2012-02-01; 3.0-beta-02; Exclude "LOVD" system user.
            $nUsers = $_DB->query('SELECT COUNT(*) FROM ' . TABLE_USERS . ' WHERE id > 0')->fetchColumn();
            $nIndividuals = $_DB->query('SELECT COUNT(*) FROM ' . TABLE_INDIVIDUALS)->fetchColumn();
            $nScreenings = $_DB->query('SELECT COUNT(*) FROM ' . TABLE_SCREENINGS)->fetchColumn();
            $nVars = $_DB->query('SELECT COUNT(*) FROM ' . TABLE_VARIANTS)->fetchColumn();
            $nGenes = count(lovd_getGeneList());
            print '  Found ' . $nUsers . ' user' . ($nUsers == 1 ? '' : 's') . '.' . "\n" . '  Found ' . $nIndividuals . ' individual' . ($nIndividuals == 1 ? '' : 's') . '.' . "\n" . '  Found ' . $nScreenings . ' screening' . ($nScreenings == 1 ? '' : 's') . '.' . "\n" . '  Found ' . $nVars . ' variant' . ($nVars == 1 ? '' : 's') . '.' . "\n" . '  Found ' . $nGenes . ' gene' . ($nGenes == 1 ? '' : 's') . '.' . "\n" . '      </PRE>' . "\n";
            if ($nGenes || $nIndividuals || $nVars) {
                lovd_showInfoTable('FINAL WARNING! If you did not download the variation and individual data stored in the LOVD system, everything will be lost!', 'warning');
            }
            print '      Please confirm uninstalling LOVD using your password.<BR>' . "\n" . '      <BR>' . "\n\n";
        }
        lovd_errorPrint();
        print '      <FORM action="' . $_PE[0] . '?confirm" method="post">' . "\n" . '        <TABLE border="0" cellpadding="0" cellspacing="0" width="300">' . "\n" . '          <TR align="right">' . "\n" . '            <TD width="125" style="padding-right : 5px;">Password</TD>' . "\n" . '            <TD width="175"><INPUT type="password" name="password" size="20"></TD></TR>' . "\n" . '          <TR align="right">' . "\n" . '            <TD width="125">&nbsp;</TD>' . "\n" . '            <TD width="175"><INPUT type="submit" value="Uninstall LOVD" style="font-weight : bold; font-size : 11px; width : 110px;"></TD></TR></TABLE></FORM>' . "\n\n";
        $_T->printFooter();
        exit;
    }
}
if (empty($_POST)) {
    print '      Welcome to the LOVD uninstaller. Please continue by providing your password.<BR>' . "\n" . '      <BR>' . "\n\n";
    lovd_showInfoTable('WARNING! If you did not download your data, you will lose all of it!', 'warning');
}
lovd_errorPrint();
print '      <FORM action="' . $_PE[0] . '" method="post">' . "\n" . '        <TABLE border="0" cellpadding="0" cellspacing="0" width="300">' . "\n" . '          <TR align="right">' . "\n" . '            <TD width="125" style="padding-right : 5px;">Password</TD>' . "\n" . '            <TD width="175"><INPUT type="password" name="password" size="20"></TD></TR>' . "\n" . '          <TR align="right">' . "\n" . '            <TD width="125">&nbsp;</TD>' . "\n" . '            <TD width="175">' . "\n" . '              <TABLE border="0" cellpadding="0" cellspacing="0" width="162">' . "\n" . '                <TR>' . "\n" . '                  <TD align="left"><INPUT type="button" value="&lt;&lt; Cancel" onclick="window.location.href=\'' . lovd_getInstallURL() . 'setup\';" style="font-weight : bold; font-size : 11px; width : 80px;"></TD>' . "\n" . '                  <TD align="right"><INPUT type="submit" value="Next &gt;&gt;" style="font-weight : bold; font-size : 11px; width : 70px;"></TD></TR></TABLE></TD></TR></TABLE></FORM>' . "\n\n";
$_T->printFooter();
exit;
Example #29
0
// It is important to have at least one transcript.
$nTranscript = $_DB->query('SELECT COUNT(*) FROM ' . TABLE_TRANSCRIPTS . ' WHERE geneid = ?', array($_SESSION['currdb']))->fetchColumn();
if (!$nTranscript) {
    lovd_showInfoTable('<SPAN class="S11">You currently do not have a transcript configured for the ' . $_SESSION['currdb'] . ' gene database. Without a transcript added, you can only store genomic variants, and thus you will not have any gene-specific variant overviews.<BR>Please <A href="transcripts?create&amp;target=' . $_SESSION['currdb'] . '">add a transcript to your gene</A>.</SPAN>', 'warning');
}
// Curators do not have access to the Users tab. But if needed, they should be able to contact the manager, when available.
$aManagers = $_DB->query('SELECT name, email FROM ' . TABLE_USERS . ' WHERE level = ? ORDER BY name', array(LEVEL_MANAGER))->fetchAllAssoc();
if (!$aManagers) {
    $aManagers = array($_SETT['admin']);
}
$sManagers = '<SPAN class="S11">For technical assistance, such as creating new custom columns, please contact ' . (count($aManagers) == 1 ? 'the system\'s manager' : 'one of the system\'s managers') . ':';
foreach ($aManagers as $aManager) {
    $sManagers .= '<BR><A href="mailto:' . str_replace(array("\r\n", "\r", "\n"), ', ', trim($aManager['email'])) . '">' . $aManager['name'] . '</A>';
}
$sManagers .= '</SPAN>';
lovd_showInfoTable($sManagers);
print '          </TD>' . "\n" . '          <TD valign="top" width="50%" style="padding-left : 10px; padding-right : 10px; border-right : 1px solid #224488;" id="configLeft">' . "\n\n";
$aItems = array('Curating ' . $_SESSION['currdb'] . ' variants' => array(array('view/' . $_SESSION['currdb'] . '?search_var_status=Submitted%7CNon%7CMarked', 'lovd_variants_curate.png', 'Curate ' . $_SESSION['currdb'] . ' variants', 'View all uncurated variant entries in the ' . $_SESSION['currdb'] . ' gene database (newly submitted, non public and marked entries).'), array('view/' . $_SESSION['currdb'], 'lovd_variants_edit.png', 'View ' . $_SESSION['currdb'] . ' variants', 'View all data submissions in the ' . $_SESSION['currdb'] . ' gene database.')), 'Custom columns for ' . $_SESSION['currdb'] => array(array('columns/VariantOnTranscript', 'lovd_columns_add.png', 'Add pre-configured custom column to the ' . $_SESSION['currdb'] . ' gene', 'View <B>all available pre-configured variant custom columns</B> to add to the ' . $_SESSION['currdb'] . ' gene database.'), array('genes/' . $_SESSION['currdb'] . '/columns', 'lovd_columns_view.png', 'Manage custom columns in the ' . $_SESSION['currdb'] . ' gene', 'View the variant custom columns <B>currently enabled</B> for the ' . $_SESSION['currdb'] . ' gene.')));
foreach ($aItems as $sTitle => $aLinks) {
    print '            <TABLE border="0" cellpadding="2" cellspacing="0" class="setup" width="100%">' . "\n" . '              <TR>' . "\n" . '                <TH colspan="2">' . $sTitle . '</TH></TR>';
    foreach ($aLinks as $val) {
        list($sLink, $sIMG, $sAlt, $sText) = $val;
        $sLink = substr($sLink, 0, 11) == 'javascript:' ? substr($sLink, 11) . ' return false;' : 'window.location.href=\'' . lovd_getInstallURL(false) . $sLink . '\'';
        print "\n" . '              <TR class="pointer" onclick="' . $sLink . '">' . "\n" . '                <TD align="center" width="40"><IMG src="gfx/' . $sIMG . '" alt="' . $sAlt . '" width="32" height="32"></TD>' . "\n" . '                <TD>' . $sText . '</TD></TR>';
    }
    print '</TABLE><BR>' . "\n\n";
}
print '          </TD>' . "\n" . '          <TD valign="top" width="50%" style="padding-left : 10px;" id="configRight">' . "\n\n";
$aItems = array('Gene settings' => array(array('genes/' . $_SESSION['currdb'] . '?edit', 'lovd_genes_edit.png', 'Edit ' . $_SESSION['currdb'] . ' gene database', 'Edit ' . $_SESSION['currdb'] . ' gene database.'), array('genes/' . $_SESSION['currdb'] . '?authorize', 'lovd_curator_sort.png', 'Sort ' . $_SESSION['currdb'] . ' gene database curator list', 'Edit or sort the list of curators for the ' . $_SESSION['currdb'] . ' gene database, and/or hide curators from the list of curators shown on the gene\'s homepage and in LOVD\'s header.'), array('genes/' . $_SESSION['currdb'] . '?empty', 'lovd_genes_empty.png', 'Empty ' . $_SESSION['currdb'] . ' gene database', 'Delete all variants and associated data from the ' . $_SESSION['currdb'] . ' gene database.<BR>Data associated with other genes as well will be kept.')), 'Download & Import' => array(array('download/all/gene/' . $_SESSION['currdb'], 'lovd_save.png', 'Download all data from the ' . $_SESSION['currdb'] . ' gene database', 'Download all data from the ' . $_SESSION['currdb'] . ' gene database.'), array('import', 'lovd_import.png', 'Import data', 'Import data using the LOVD import format (custom columns, diseases, individuals, phenotypes, screenings &amp; variants).')), 'LOVD scripts' => array(array('javascript:lovd_openWindow(\'' . lovd_getInstallURL() . 'scripts/refseq_parser.php?step=1&amp;symbol=' . $_SESSION['currdb'] . '\', \'RefseqParser\', 900, 500);', 'lovd_scripts.png', 'Reference Sequence Parser', 'The LOVD Reference sequence parser creates a nicely formatted HTML page of a coding DNA reference sequence, including exon/intron boundaries and separate files for upstream, intronic and downstream sequences. It accepts different input formats.')));
// Unset items not valid when there are no variants yet.
if (!$nTotalVars) {