Example #1
0
/**
 * This function displays the form for adding a new wiki page.
 * @author Patrick Cool <*****@*****.**>, Ghent University
 * @return html code
 **/
function display_new_wiki_form()
{
    $_course = api_get_course_info();
    global $page;
    ?>
<script type="text/javascript">
    function CheckSend() {
        if (document.form1.title.value == "") {
            alert("<?php 
    echo get_lang('NoWikiPageTitle');
    ?>
");
            document.form1.title.focus();
            return false;
        }
        return true;
    }
    function setFocus() {
        $("#wiki_title").focus();
    }
    $(document).ready(function () {
        setFocus();
    });
</script>
<?php 
    //form
    echo '<form name="form1" method="post" onsubmit="return CheckSend()" action="' . api_get_self() . '?' . api_get_cidreq() . '&action=showpage&amp;title=' . api_htmlentities(urlencode(strtolower(str_replace(' ', '_', $page)))) . '&group_id=' . api_htmlentities($_GET['group_id']) . '">';
    echo '<div id="wikititle" style="min-height:30px;">';
    echo '<div style="width:70%;float:left;"><span class="form_required">*</span> ' . get_lang(Title) . ': <input type="text" id="wiki_title" name="title" value="' . api_htmlentities($_GET['title']) . '" size="40"></div>';
    if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
        $_clean['group_id'] = (int) $_SESSION['_gid'];
        // TODO: check if delete ?
        echo '<a href="javascript://" onclick="advanced_parameters()" ><span id="plus_minus" style="float:right">&nbsp;' . Display::return_icon('div_show.gif', get_lang('Show'), array('style' => 'vertical-align:middle')) . '&nbsp;' . get_lang('AdvancedParameters') . '</span></a>';
        echo '<div id="options" style="display:none; margin: 20px;" >';
        //task
        echo '<div>&nbsp;</div>';
        echo '<div style= "border : 1px dotted; padding:4px; margin-top:20px;">';
        echo '<input type="checkbox" value="1" name="checktask" onclick="javascript: if(this.checked){document.getElementById(\'option4\').style.display=\'block\';}else{document.getElementById(\'option4\').style.display=\'none\';}"/>&nbsp;
		' . Display::return_icon('wiki_task.png', get_lang('DefineTask'), '', ICON_SIZE_SMALL) . ' ' . get_lang('DescriptionOfTheTask') . '';
        echo '&nbsp;&nbsp;&nbsp;<span id="msg_error4" style="display:none;color:red"></span>';
        echo '<div id="option4" style="padding:4px; margin:5px; border:1px dotted; display:none;">';
        echo '<table border="0" style="font-weight:normal">';
        echo '<tr>';
        echo '<td>' . get_lang('DescriptionOfTheTask') . '</td>';
        echo '</tr>';
        echo '<tr>';
        //echo '<td><textarea name="task" cols="60" rows="4" >'.stripslashes($row['task']).'</textarea></td>';	// TODO: ¿delete?
        echo '<td>' . api_disp_html_area('task', '', '', '', null, array('ToolbarSet' => 'wiki_task', 'Width' => '580', 'Height' => '200')) . '</td>';
        echo '</tr>';
        echo '</table>';
        echo '</div>';
        //feedback
        echo '<div>&nbsp;</div><input type="checkbox" value="1" name="checkfeedback" onclick="javascript: if(this.checked){document.getElementById(\'option2\').style.display=\'block\';}else{document.getElementById(\'option2\').style.display=\'none\';}"/>&nbsp;' . get_lang('AddFeedback') . '';
        echo '&nbsp;&nbsp;&nbsp;<span id="msg_error2" style="display:none;color:red"></span>';
        echo '<div id="option2" style="padding:4px; margin:5px; border:1px dotted; display:none;">';
        echo '<table border="0" style="font-weight:normal" align="center">';
        echo '<tr>';
        echo '<td colspan="2">' . get_lang('Feedback1') . '</td>';
        echo '<td colspan="2">' . get_lang('Feedback2') . '</td>';
        echo '<td colspan="2">' . get_lang('Feedback3') . '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td colspan="2"><textarea name="feedback1" cols="21" rows="4"></textarea></td>';
        echo '<td colspan="2"><textarea name="feedback2" cols="21" rows="4"></textarea></td>';
        echo '<td colspan="2"><textarea name="feedback3" cols="21" rows="4"></textarea></td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td>' . get_lang('FProgress') . ':</td>';
        echo '<td><select name="fprogress1">
           <option value="0" selected>0</option>
           <option value="10">10</option>
           <option value="20">20</option>
           <option value="30">30</option>
           <option value="40">40</option>
           <option value="50">50</option>
           <option value="60">60</option>
           <option value="70">70</option>
           <option value="80">80</option>
           <option value="90">90</option>
           <option value="100">100</option>
           </select> %</td>';
        echo '<td>' . get_lang('FProgress') . ':</td>';
        echo '<td><select name="fprogress2">
           <option value="0" selected>0</option>
           <option value="10">10</option>
           <option value="20">20</option>
           <option value="30">30</option>
           <option value="40">40</option>
           <option value="50">50</option>
           <option value="60">60</option>
           <option value="70">70</option>
           <option value="80">80</option>
           <option value="90">90</option>
           <option value="100">100</option>
           </select> %</td>';
        echo '<td>' . get_lang('FProgress') . ':</td>';
        echo '<td><select name="fprogress3">
           <option value="0" selected>0</option>
           <option value="10">10</option>
           <option value="20">20</option>
           <option value="30">30</option>
           <option value="40">40</option>
           <option value="50">50</option>
           <option value="60">60</option>
           <option value="70">70</option>
           <option value="80">80</option>
           <option value="90">90</option>
           <option value="100">100</option>
           </select> %</td>';
        echo '</tr>';
        echo '</table>';
        echo '</div>';
        //time limit
        echo '<div>&nbsp;</div><input type="checkbox" value="1" name="checktimelimit" onclick="javascript: if(this.checked){document.getElementById(\'option1\').style.display=\'block\';}else{document.getElementById(\'option1\').style.display=\'none\';}"/>&nbsp;' . get_lang('PutATimeLimit') . '';
        echo '&nbsp;&nbsp;&nbsp;<span id="msg_error1" style="display:none;color:red"></span>';
        echo '<div id="option1" style="padding:4px; margin:5px; border:1px dotted; display:none;">';
        echo '<table width="100%" border="0" style="font-weight:normal">';
        echo '<tr>';
        echo '<td align="right">' . get_lang("StartDate") . ':</td>';
        echo '<td>';
        echo draw_date_picker('startdate_assig') . ' <input type="checkbox" name="initstartdate" value="1"> ' . get_lang('Yes') . '/' . get_lang('No') . '';
        echo '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td align="right">' . get_lang("EndDate") . ':</td>';
        echo '<td>';
        echo draw_date_picker('enddate_assig') . ' <input type="checkbox" name="initenddate" value="1"> ' . get_lang('Yes') . '/' . get_lang('No') . '';
        echo '</td>';
        echo '</tr>';
        echo '<tr>';
        echo '<td align="right">' . get_lang('AllowLaterSends') . ':</td>';
        echo '<td><input type="checkbox" name="delayedsubmit" value="1"></td>';
        echo '</tr>';
        echo '</table>';
        echo '</div>';
        //other limit
        echo '<div>&nbsp;</div><input type="checkbox" value="1" name="checkotherlimit" onclick="javascript: if(this.checked){document.getElementById(\'option3\').style.display=\'block\';}else{document.getElementById(\'option3\').style.display=\'none\';}"/>&nbsp;' . get_lang('OtherSettings') . '';
        echo '&nbsp;&nbsp;&nbsp;<span id="msg_error3" style="display:none;color:red"></span>';
        echo '<div id="option3" style="padding:4px; margin:5px; border:1px dotted; display:none;">';
        echo '<div style="font-weight:normal"; align="center">' . get_lang('NMaxWords') . ':&nbsp;<input type="text" name="max_text" size="3">&nbsp;&nbsp;' . get_lang('NMaxVersion') . ':&nbsp;<input type="text" name="max_version" size="3"></div>';
        echo '</div>';
        echo '</div>';
        //to define as an individual assignment
        echo '<div style= "border : 1px dotted; padding:4px; margin-top:20px;"><img src="../img/icons/22/wiki_assignment.png" title="' . get_lang('CreateAssignmentPage') . '" alt="' . get_lang('CreateAssignmentPage') . '"/>&nbsp;' . get_lang('DefineAssignmentPage') . ': <input type="checkbox" name="assignment" value="1"></div>';
        // 1= teacher 2 =student
        //
        echo '</div>';
    }
    echo '</div>';
    echo '<div id="wikicontent">';
    api_disp_html_area('content', '', '', '', null, api_is_allowed_to_edit(null, true) ? array('ToolbarSet' => 'Wiki', 'Width' => '100%', 'Height' => '400') : array('ToolbarSet' => 'WikiStudent', 'Width' => '100%', 'Height' => '400', 'UserStatus' => 'student'));
    echo '<br/>';
    echo '<br/>';
    echo get_lang('Comments') . ':&nbsp;&nbsp;<input type="text" name="comment" size="40"><br /><br />';
    echo get_lang('Progress') . ':&nbsp;&nbsp;<select name="progress" id="progress">
       <option value="0" selected>0</option>
       <option value="10">10</option>
       <option value="20">20</option>
       <option value="30">30</option>
       <option value="40">40</option>
       <option value="50">50</option>
       <option value="60">60</option>
       <option value="70">70</option>
       <option value="80">80</option>
       <option value="90">90</option>
       <option value="100">100</option>
       </select> %';
    echo '<br/><br/>';
    echo '<input type="hidden" name="wpost_id" value="' . md5(uniqid(rand(), true)) . '">';
    //prevent double post
    echo '<button class="save" type="submit" name="SaveWikiNew">' . get_lang('Save') . '</button>';
    //for button icon. Don't change name (see fckeditor/editor/plugins/customizations/fckplugin_compressed.js and fckplugin.js
    echo '</div>';
    echo '</form>';
}
Example #2
0
 /**
  * Displays the wysiwyg html editor.
  * @deprecated
  */
 public static function display_html_editor_area($name, $resp)
 {
     api_disp_html_area($name, get_lang('TypeYourMessage'), '', '', null, array('ToolbarSet' => 'Messages', 'Width' => '95%', 'Height' => '250'));
 }
Example #3
0
     echo '</div>';
     //other limit
     echo '<div>&nbsp;</div><input type="checkbox" value="1" name="checkotherlimit" onclick="javascript: if(this.checked){document.getElementById(\'option3\').style.display=\'block\';}else{document.getElementById(\'option3\').style.display=\'none\';}"/>&nbsp;' . get_lang('OtherSettings') . '';
     echo '&nbsp;&nbsp;&nbsp;<span id="msg_error3" style="display:none;color:red"></span>';
     echo '<div id="option3" style="padding:4px; margin:5px; border:1px dotted; display:none;">';
     echo '<div style="font-weight:normal"; align="center">' . get_lang('NMaxWords') . ':&nbsp;<input type="text" name="max_text" size="3" value="' . $row['max_text'] . '">&nbsp;&nbsp;' . get_lang('NMaxVersion') . ':&nbsp;<input type="text" name="max_version" size="3" value="' . $row['max_version'] . '"></div>';
     echo '</div>';
     //
     echo '</div>';
 }
 echo '</div>';
 echo '<div id="wikicontent">';
 echo '<input type="hidden" name="page_id" value="' . $page_id . '">';
 echo '<input type="hidden" name="reflink" value="' . api_htmlentities($page) . '">';
 echo '<input type="hidden" name="title" value="' . api_htmlentities($title) . '">';
 api_disp_html_area('content', $content, '', '', null, api_is_allowed_to_edit(null, true) ? array('ToolbarSet' => 'Wiki', 'Width' => '100%', 'Height' => '400') : array('ToolbarSet' => 'WikiStudent', 'Width' => '100%', 'Height' => '400', 'UserStatus' => 'student'));
 echo '<br/>';
 echo '<br/>';
 //if(api_is_allowed_to_edit() || api_is_platform_admin()) //off for now
 //{
 echo get_lang('Comments') . ':&nbsp;&nbsp;<input type="text" name="comment" size="40">&nbsp;&nbsp;&nbsp;';
 //}
 echo '<INPUT TYPE="hidden" NAME="assignment" VALUE="' . $row['assignment'] . '"/>';
 echo '<INPUT TYPE="hidden" NAME="version" VALUE="' . $row['version'] . '"/>';
 //hack date for edit
 echo '<INPUT TYPE="hidden" NAME="startdate_assig" VALUE="' . $row['startdate_assig'] . '"/>';
 echo '<INPUT TYPE="hidden" NAME="enddate_assig" VALUE="' . $row['enddate_assig'] . '"/>';
 //
 echo get_lang('Progress') . ':&nbsp;&nbsp;<select name="progress" id="progress">';
 echo '<option value="' . api_htmlentities($row['progress']) . '" selected>' . api_htmlentities($row['progress']) . '</option>';
 echo '<option value="10">10</option>