*
*/
require_once dirname(__FILE__) . '/../../../../core/include/init.inc';
require_once dirname(__FILE__) . '/../../../../core/lib/html_form/html_form.inc';
$assetid = array_get_index($_GET, 'assetid');
if (is_null($assetid)) {
    return FALSE;
}
assert_valid_assetid($assetid);
$asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
if (is_null($asset) || !$asset->writeAccess()) {
    exit;
}
$all = array_get_index($_REQUEST, 'all', FALSE);
require_once dirname(__FILE__) . '/../../../../core/include/backend_outputter.inc';
$o = new Backend_Outputter();
$o->openSection('Metadata Keyword Replacements');
$o->openField('', 'wide_col');
?>

		<p>The following keyword replacements may be used for metadata values. Note that the percentage signs (%) are required.</p>

		<?php 
$o->openSection('Asset Information');
$o->openField('', 'wide_col');
?>

			<table class="sq-backend-table compact">
			<tr><th style="width: 250px;">Keyword</th><th>Description</th></tr>
			<tr><td><strong>%asset_assetid%</strong></td><td>The ID of the asset</td></tr>
			<tr><td><strong>%asset_name%</strong></td><td>Full name of the asset</td></tr>
    $user = $GLOBALS['SQ_SYSTEM']->user;
} else {
    $user = NULL;
}
//end if
// Check for at least simple edit access
if (is_null($user) || $user instanceof Public_User) {
    echo 'You are not allowed to access this page';
    exit;
}
?>

	<?php 
require_once SQ_SYSTEM_ROOT . '/core/include/backend_outputter.inc';
require_once SQ_SYSTEM_ROOT . '/core/include/asset_edit_interface.inc';
$o = new Backend_Outputter();
$o->openSection(translate('Keyword List for Simple Edit Keywords'));
$type_list = array();
$asset_type_list = $GLOBALS['SQ_SYSTEM']->am->getAssetTypes();
foreach ($asset_type_list as $key => $value) {
    if ($value['instantiable'] == 1) {
        $type_list[] = $key;
    }
}
$asset_types = array();
foreach ($type_list as $asset_type) {
    $type_info = $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($asset_type);
    $asset_types[$asset_type] = $type_info['name'];
}
asort($asset_types);
$o->openField('', 'wide_col');
			fieldset {
				padding:			0px 10px 5px 5px;
				border:				1px solid #E0E0E0;
			}

			legend {
				color:				#2086EA;
			}
		</style>
	</head>

	<body>
	<?php 
    require_once dirname(__FILE__) . '/../../../../core/include/backend_outputter.inc';
    // $backend = new Backend();
    $o = new Backend_Outputter();
    $o->openSection('Keyword List for \'' . $asset->attr('name') . '\' (#' . $asset->id . ')');
    $o->openField('&nbsp;');
    $questions = $asset->getQuestions();
    $sections = $asset->getSections();
    ?>
				<p>These keywords are available for use in Complex Formatting for insertion into the 'Page Contents' bodycopy, if it is enabled. The <b>'Question Field'</b> keywords (%question_field_*%) are replaced with the appropriate input field for that question. The <b>'Section Title'</b> keywords (%section_title_*%) will be replaced with the name of the section.</p>

		<p>
		<fieldset>
			<legend><b>Unattached Questions</b></legend>
			<table border="0" width="100%">
				<?php 
    foreach ($questions as $q_id => $question) {
        $q_asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($asset->id . ':q' . $q_id);
        $q_name = $q_asset->attr('name');
*
*/
require_once dirname(__FILE__) . '/../../../../core/include/init.inc';
require_once dirname(__FILE__) . '/../../../../core/lib/html_form/html_form.inc';
if (!isset($_GET['assetid'])) {
    return FALSE;
}
assert_valid_assetid($_GET['assetid']);
$asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($_GET['assetid']);
if (!$asset instanceof Form) {
    trigger_error('Asset is not a form');
    return FALSE;
}
require_once dirname(__FILE__) . '/../../../../core/include/backend_outputter.inc';
// $backend = new Backend();
$o = new Backend_Outputter();
$o->openSection('\'' . $asset->attr('name') . '\' Thank You / Emails Keyword Replacements');
$o->openField('', 'wide_col');
if ($asset->readAccess()) {
    $questions = $asset->getQuestions();
    $sections = $asset->getSections();
    ?>
		<p>These keywords are available for use in Complex Formatting for insertion into the 'Thank You' bodycopy, if it is enabled, as well as in emails sent from this form. The <b>'Response'</b> keywords (%response_*%) are replaced with the actual response for that question. The <b>'Section Title'</b> keywords (%section_title_*%) will be replaced with the name of the section.</p>

		<table class="sq-backend-table compact">
			<tr><th colspan="2">Unattached Questions</th></tr>
			<?php 
    foreach ($questions as $q_id => $question) {
        ?>
					<tr>
						<td>%response_<?php 
			if (displayedButtons.length == 0) {
					noMoreTags = document.getElementById('noMoreTags');
					noMoreTags.style.visibility = 'visible';

					addAll = document.getElementById('addAll');
					addAll.style.display = 'none';
			}
		}

		</script>
	</head>

	<body>
	<?php 
    require_once dirname(__FILE__) . '/../../include/backend_outputter.inc';
    $o = new Backend_Outputter();
    $o->addOnLoad('checkTagsLeft()');
    $o->openSection(sprintf(translate('Suggested tags for %s'), get_asset_tag_line($asset->id)));
    $o->openField('');
    ?>
				<p><?php 
    echo sprintf(translate('Suggested tags for %s'), get_asset_tag_line($asset->id));
    ?>
</p>
				<p><?php 
    echo translate('Click \'Add Tag\' to tag this asset with the term');
    ?>
</p>

		<p>
		<fieldset>
* $Id: keyword_extraction.php,v 1.1 2013/09/24 01:10:35 ewang Exp $
*
*/
define('SQ_SYSTEM_ROOT', dirname(dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))))));
require_once SQ_SYSTEM_ROOT . '/core/include/init.inc';
require_once SQ_SYSTEM_ROOT . '/core/lib/html_form/html_form.inc';
if (!isset($_GET['assetid'])) {
    return FALSE;
}
assert_valid_assetid($_GET['assetid']);
$asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($_GET['assetid']);
if (is_null($asset) || !$asset->writeAccess()) {
    exit;
}
require_once dirname(__FILE__) . '/../../../../core/include/backend_outputter.inc';
$o = new Backend_Outputter();
$o->openSection(sprintf(translate('keyword_extraction_for'), sprintf(translate('asset_format'), $asset->attr('name'), $asset->id)));
$o->openField('', 'wide_col');
?>

		<p><?php 
echo sprintf(translate('kewords_for_asset'), sprintf(translate('asset_format'), $asset->attr('name'), $asset->id));
?>
</p>
		<p><?php 
echo translate('use_keywords_in_metadata_fields');
?>
</p>

		<p>
		<fieldset>