Location: PHPKode > projects > KORA > kora-2.0.0/schemeLayout.php
<?php
/**
Copyright (2008) Matrix: Michigan State University

This file is part of KORA.

KORA is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

KORA is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

// Initial Version: Matt Geimer, 2008

require_once('includes/utilities.php');

requireProject();

if(isset($_REQUEST['schemeid']))
{
	// verify that the passed id is in fact a valid scheme
	$squery = 'SELECT schemeid, schemeName FROM scheme WHERE schemeid='.escape($_REQUEST['schemeid']).' AND pid='.escape($_SESSION['currentProject']).' LIMIT 1';
	$squery = $db->query($squery);
	if ($squery->num_rows > 0) {
		$squery = $squery->fetch_assoc();
		$_SESSION['currentScheme'] = $squery['schemeid'];
		$_SESSION['currentSchemeName'] = htmlEscape($squery['schemeName']);
		// clear out any unfinished ingestion
		unset($_SESSION['lastIngestion']);
	}
}

requireScheme();

// check once for ability to edit scheme layout to prevent repeated database calls
$ePerm = hasPermissions(EDIT_LAYOUT);

include_once('includes/header.php');
echo '<h2>'.gettext('Scheme Layout for').' '.$_SESSION['currentSchemeName'].'</h2>';

if (isSystemAdmin())
{
	// See if the dublin core information is up-to-date
	$dcQuery = $db->query('SELECT dublinCoreOutOfDate FROM scheme WHERE schemeid='.$_SESSION['currentScheme'].' LIMIT 1');
	$dcQuery = $dcQuery->fetch_assoc();
	if ($dcQuery['dublinCoreOutOfDate'] > 0)
	{
		echo '<div class="error">'.gettext('Warning').': '.gettext('Dublin Core data for this scheme is out of date.  You should consider running the update script.').'</div><br />';
	}
}

if($ePerm)
{
	$controlQuery = $db->query('SELECT cid FROM p'.$_SESSION['currentProject'].'Control WHERE schemeid='.$_SESSION['currentScheme'].' LIMIT 1');
	if ($controlQuery->num_rows > 0)
	{
        echo '<a href="manageDublinCore.php">'.gettext('Edit Dublin Core scheme field associations').'</a><br />';
	} 
}

?>
<script type="text/javascript" src="<?php echo PROTOTYPE_URL?>"></script>
<script type="text/javascript">
//<![CDATA[
<?php  if ($ePerm) { ?>
function moveCollection(varcid, vardirection) {
    new Ajax.Updater('ajax', 'includes/schemeFunctions.php', { method:'post', parameters:{action:'moveCollection',source:'SchemeFunctions',cid:varcid,direction:vardirection }});
    return;
}

function moveControl(varcid, vardirection) {
    new Ajax.Updater('ajax', 'includes/schemeFunctions.php', { method:'post', parameters:{action:'moveControl',source:'SchemeFunctions',cid:varcid,direction:vardirection }});
    return;
}

function deleteCollection(varcid) {
    var answer = confirm("<?php echo gettext("Really delete collection?  Any data and Dublin Core associations to controls in this collection will be lost.");?>");
    if(answer) {
        new Ajax.Updater('ajax', 'includes/schemeFunctions.php', { method:'post', parameters:{action:'deleteCollection',source:'SchemeFunctions',cid:varcid }} );
    }
    return; 
}

function deleteControl(varcid) {
    var answer = confirm("<?php echo gettext("Really delete control?  Any data and Dublin Core associations will be lost.");?>");
    if(answer) {
        new Ajax.Updater('ajax', 'includes/schemeFunctions.php', { method:'post', parameters:{action:'deleteControl',source:'SchemeFunctions',cid:varcid }} );
    }
    return; 
}
<?php  } // endif $ePerm ?>


<?php  if (isProjectAdmin()) { ?>
function updateSchemePreset() {
    new Ajax.Updater('ajax', 'includes/schemeFunctions.php',{ method:'post', parameters:{action:'updateSchemePreset',source:'SchemeFunctions',sid:<?php echo $_SESSION['currentScheme']?>,preset:$('schemePreset').checked}});
}
<?php  } // endif isProjectAdmin ?>

new Ajax.Updater('ajax','includes/schemeFunctions.php',{method:'post',parameters:{action:'loadSchemeLayout',source:'SchemeFunctions'}});
//]]>
</script>
<div id="ajax"></div>
<?php 
include_once('includes/footer.php');

?>
Return current item: KORA