<?php
include("../../../inc/claro_init_global.inc.php"); 

// Database definition
$tbl_wiki = "`".$_course['dbNameGlu']."wiki`";

	$sql='SELECT * FROM '.$tbl_wiki.' GROUP BY title ORDER BY reflink ASC';
	$result=api_sql_query($sql,__LINE__,__FILE__);
	echo '<select name="f_wiki">';
	while ($row=mysql_fetch_array($result))
	{
		$userinfo=Database::get_user_info_from_id($row['user_id']);
		echo '<option value="'.$row['reflink'].'">'.$row['title'].'</option>';
		//print_r($userinfo);
	}
	echo '</select>';	
?>
<input name="" type="Submit" name="OK" onclick="return onOK();" >
<script type="text/javascript" src="popup.js"></script>
<script type="text/javascript">
window.resizeTo(400, 100);

I18N = window.opener.HTMLArea.I18N.dialogs;

function i18n(str) {
  return (I18N[str] || str);
};

function Init() {
  __dlg_translate(I18N);
  __dlg_init();
  var param = window.dialogArguments;
  if (param) {
      document.getElementById("f_wiki").value = param["f_wiki"];
  }
};

function onOK() {
  var required = {
    "f_wiki": "You must enter the URL"
  };
  for (var i in required) {
    var el = document.getElementById(i);
    if (!el.value) {
      alert(required[i]);
      el.focus();
      return false;
    }
  }
</script>