<?php // $Id$

///////////////////////////////////////////////////////////////////////////
//                                                                       //
// NOTICE OF COPYRIGHT                                                   //
//                                                                       //
// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
//          http://moodle.com                                            //
//                                                                       //
// Copyright (C) 2001-3001 Martin Dougiamas        http://dougiamas.com  //
//           (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com  //
//                                                                       //
// This program 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.                                   //
//                                                                       //
// This program 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:                          //
//                                                                       //
//          http://www.gnu.org/copyleft/gpl.html                         //
//                                                                       //
///////////////////////////////////////////////////////////////////////////
?>

<tr valign="top">
    <td align="right" style="white-space:nowrap;">


<script type="text/javascript">
//<![CDATA[
    function showhide (id, set) {
        divobj = document.getElementById(id);
        butobj = document.getElementById(id+'button');
        prefobj = document.getElementById(id+'pref');
        if (set == true) {
            if (prefobj.value == '1') {
                divobj.style.display = 'block';
                butobj.value = '<?php print_string("hidesettings") ?>';
            } else {
                divobj.style.display = 'none';
                butobj.value = '<?php print_string("showsettings") ?>...';
            }
        } else {
            if (prefobj.value == '1') {
                divobj.style.display = 'none';
                butobj.value = '<?php print_string("showsettings") ?>...';
                prefobj.value = '0';
            } else {
                divobj.style.display = 'block';
                butobj.value = '<?php print_string("hidesettings") ?>';
                prefobj.value = '1';
            }
        }
    }
    
    function optiondeselector () {
        document.getElementById('menuparam_tableofcontents').disabled = false;
        document.getElementById('menuparam_skipsubmenus').disabled = false;
        document.getElementById('menuparam_navigationupbutton').disabled = false; 
        
        if (document.getElementById('menuparam_navigationmenu').value == 1) {
            document.getElementById('menuparam_tableofcontents').value = 0;
            document.getElementById('menuparam_skipsubmenus').value = 1;
            document.getElementById('menuparam_navigationupbutton').value = 0;
            document.getElementById('menuparam_tableofcontents').disabled = true;
            document.getElementById('menuparam_skipsubmenus').disabled = true;
            document.getElementById('menuparam_navigationupbutton').disabled = true;
        }
        
        if (document.getElementById('menuparam_navigationbuttons').value == 0) {
            document.getElementById('menuparam_navigationupbutton').value = 0;
            document.getElementById('menuparam_navigationupbutton').disabled = true;
        }

    }
//]]>
</script>


        <b><?php echo $strfilename ?>:</b>
    </td>
    <td>
    <?php
        $strbrowserepository = get_string('browserepository', 'resource');
        echo "<input type=\"text\" name=\"reference\" size=\"90\" value=\"$form->reference\" alt=\"reference\" /><br />";
        button_to_popup_window ("/files/index.php?id=$form->course&amp;choose=form.reference", "coursefiles", $strchooseafile, 500, 750, $strchooseafile);
        if ($CFG->repositoryactivate) button_to_popup_window ("/mod/resource/type/ims/finder.php?directory=", "", $strbrowserepository, 500, 750, "Browse repository");
    
    ?>
    </td>
</tr>

<tr><td colspan="2"><hr /></td></tr>

<tr>
    <td align="right"><b><?php print_string("display", "resource") ?>:</b></td>
    <td>
        <input type="button" value="hide settings" id="windowsettingsbutton" onclick="javascript: return showhide('windowsettings');" />
        <input type="hidden" name="windowsettingspref" id="windowsettingspref" 
               value="<?php echo get_user_preferences('resource_windowsettingspref', $CFG->resource_windowsettings); ?>" />
        <?php helpbutton("window", get_string("display", "resource"), "resource", true) ?>
    </td>
</tr>
<tr><td colspan="2">

    <div id="windowsettings">

<table class="boxaligncenter">


<tr valign="top">

    <td colspan="2">
        <script type="text/javascript">
        //<![CDATA[
            var popupitems = [<?php echo $popupoptions; ?>];
            var allitems = [<?php echo $alloptions; ?>];
        //]]>
        </script>
        <input type="radio" name="windowpopup" value="0" alt="<?php print_string('pagewindow', 'resource') ?>" <?php echo ($windowtype != "popup") ? "checked=\"checked\"" : "" ?> 
        onclick="lockoptions('form', 'windowpopup[1]', popupitems);" />
        <b title="<?php print_string("pagedisplay", "resource") ?>"><?php print_string("pagewindow", "resource") ?></b>
        <blockquote>
            <div>
            <input type="hidden" name="framepage" value="1" />
            </div>
        </blockquote>
    </td>
</tr>

<tr valign="top">
    
    <td colspan="2">
        <input name="windowpopup" type="radio" value="1" alt="<?php p($strnewwindow)?>" <?php echo ($windowtype == "popup") ? "checked=\"checked\"" : "" ?>
        onclick="lockoptions('form', 'windowpopup[1]', popupitems);" />
        <b title="<?php p($strnewwindowopen) ?>"><?php p($strnewwindow) ?></b>
        <blockquote>
        <fieldset class="invisiblefieldset">
        <?php
            foreach ($window as $name => $value) {
                if ($name == "height" or $name == "width") {
                    continue;
                }
                echo "<input name=\"h$name\" type=\"hidden\" value=\"0\" />";
                echo "<input name=\"$name\" type=\"checkbox\" value=\"1\" ".$window->$name." alt=\"$name\" />";
                $stringname = "str$name";
                echo $$stringname."<br />";
            }
        ?>

        <input name="hwidth" type="hidden" value="0" />
        <input name="width" type="text" size="4" value="<?php p($window->width) ?>" alt="<?php p($strwidth) ?>" />
        <?php p($strwidth) ?><br />

        <input name="hheight" type="hidden" value="0" />
        <input name="height" type="text" size="4" value="<?php p($window->height) ?>" alt="<?php p($strheight) ?>" />
        <?php p($strheight) ?><br />
        <?php
            if ($windowtype == "page") {
                echo "<script type=\"text/javascript\">\n//<![CDATA[\n";
                echo "lockoptions('form','windowpopup[1]', popupitems);";
                echo "\n//]]>\n</script>";
            }
        ?>
        </fieldset>
        </blockquote>
    </td>
</tr>

</table>

    </div>

</td></tr>

<tr>
    <td align="right"><b><?php print_string("parameters", "resource") ?>:</b></td>
    <td>
        <input type="button" value="hide settings" id="parametersettingsbutton" onclick="javascript: return showhide('parametersettings');" />
        <input type="hidden" name="parametersettingspref" id="parametersettingspref" 
               value="<?php echo get_user_preferences('resource_parametersettingspref', $CFG->resource_parametersettings); ?>" />
        <?php helpbutton("imsparameters", get_string("parameters", "resource"), "resource", true) ?>
    </td>
</tr>
<tr><td colspan="2">

    <div id="parametersettings">

<table class="boxaligncenter">

<?php

    $yesno = array();
    $yesno[0] = get_string('no');
    $yesno[1] = get_string('yes');
    
    echo "<tr>\n";
    echo "<td valign=\"top\" align=\"right\">\n";
    echo get_string('navigationmenu','resource').': ';
    echo "</td>\n";
    echo "<td valign=\"top\">\n";
    choose_from_menu($yesno, "param_navigationmenu", $form->param_navigationmenu, "", "optiondeselector();");
    echo "</td>\n";
    echo "</tr>\n";
    
    echo "<tr>\n";
    echo "<td valign=\"top\" align=\"right\">\n";
    echo get_string('tableofcontents','resource').': ';
    echo "</td>\n";
    echo "<td valign=\"top\">\n";
    choose_from_menu($yesno, "param_tableofcontents", $form->param_tableofcontents, "");
    echo "</td>\n";
    echo "</tr>\n";

    echo "<tr>\n";
    echo "<td valign=\"top\" align=\"right\">\n";
    echo get_string('navigationbuttons','resource').': ';
    echo "</td>\n";
    echo "<td valign=\"top\">\n";
    choose_from_menu($yesno, "param_navigationbuttons", $form->param_navigationbuttons, "", "optiondeselector();");
    echo "</td>\n";
    echo "</tr>\n";
    
    echo "<tr>\n";
    echo "<td valign=\"top\" align=\"right\">\n";
    echo get_string('skipsubmenus','resource').': ';
    echo "</td>\n";
    echo "<td valign=\"top\">\n";
    choose_from_menu($yesno, "param_skipsubmenus", $form->param_skipsubmenus, "");
    echo "</td>\n";
    echo "</tr>\n";
    
    echo "<tr>\n";
    echo "<td valign=\"top\" align=\"right\">\n";
    echo get_string('navigationup','resource').': ';
    echo "</td>\n";
    echo "<td valign=\"top\">\n";
    choose_from_menu($yesno, "param_navigationupbutton", $form->param_navigationupbutton, "");
    echo "</td>\n";
    echo "</tr>\n";
    
?>


</table>
    
    </div>

<script type="text/javascript"> 
//<![CDATA[
    optiondeselector();

    showhide('parametersettings', true);
    showhide('windowsettings', true);
//]]>
</script>


</td></tr>

<?php print_visible_setting($form); ?>
