function eventAjaxGetEditForm(EventControler $evtcl) { $Parsedown = new Parsedown(); $_SESSION['ContactNoteEditSave']->setApplyRegistry(false, "Form"); $html = ''; $curdiv = $evtcl->curdiv; $this->getId($evtcl->idnote); $vis_user = $this->note_visibility == 'user' ? 'checked' : ''; $vis_user_cw = $this->note_visibility == 'user coworker' ? 'checked' : ''; $vis_user_cont = $this->note_visibility == 'user contact' ? 'checked' : ''; $vis_user_cw_cont = $this->note_visibility == 'user coworker contact' ? 'checked' : ''; $do_cont = new Contact(); $contact_fullname = $do_cont->getContactName($evtcl->idcontact); if ($this->iduser == $_SESSION['do_User']->iduser) { $note_val = $this->note; $e_edit = new Event("ContactNoteEditSave->eventUpdate"); $e_edit->setLevel(110); $e_edit->addEventAction("mydb.gotoPage", 111); $e_edit->addEventAction("ContactNoteEditSave->eventHTMLCleanUp", 109); $e_edit->setGotFile(true); $html .= $e_edit->getFormHeader(); $html .= $e_edit->getFormEvent(); $_SESSION['ContactNoteEditSave']->setRegistry("ofuz_add_contact_note"); $_SESSION['ContactNoteEditSave']->setApplyRegistry(true, "Form"); $html .= '<br />' . _('Note :') . '<br /><textarea id="note_edit" name = "fields[note]" rows="3" cols="110">' . $Parsedown->text($note_val) . '</textarea><br />'; $html .= '<div width="100%">'; $html .= '<div id="edit_note_more" style="position:relative;float:left;text-align:left;width:50%"><a href="#" onclick ="fnEditNoteMoreOpts();return false;">' . _('More Options') . '</a></div>'; $html .= '<div style="position:relative;float:left;text-align:left;width:50%"><a href="javascript:;" onclick="showProjectList();">' . _('Attached to a project') . '</a>'; $html .= '<div id="cp_prj_list" style="position:relative;display:none;">'; $do_prjs = new Project(); $do_prjs->getAllProjects("open"); $num_prjs = $do_prjs->getNumRows(); $html .= '<select name="cpy_prjs" id="cpy_prjs" onchange="populateTasks();">'; if ($num_prjs > 0) { $html .= '<option value="">' . _('Select Project') . '</option>'; } else { $html .= '<option value="">' . _('You do not have Project.') . '</option>'; } while ($do_prjs->next()) { $html .= '<option value="' . $do_prjs->getData("idproject") . '">' . $do_prjs->getData("name") . '</option>'; } $html .= '</select>'; $html .= '</div>'; $html .= '<div id="cp_prj_tasks"></div>'; $html .= '</div></div>'; $html .= '<div class="div_right" id="edit_note_more_opts" style="display: none;"> '; $html .= 'File : ' . $_SESSION['ContactNoteEditSave']->document . '<br /><br />'; $html .= '</div>'; $html .= '<div id="edit_note_more_opts_vis" style="text-align: left; width: 50%;display: none;"> '; $html .= _('Who can view this note:') . '<br />'; $html .= '<input type="radio" name="fields[note_visibility]" value="user" ' . $vis_user . '> ' . _('Just me') . ' <br />'; $html .= '<input type="radio" name="fields[note_visibility]" value="user coworker" ' . $vis_user_cw . '> ' . _('My Co-Workers and I') . '<br />'; $html .= '<input type="radio" name="fields[note_visibility]" value="user contact" ' . $vis_user_cont . '> ' . $contact_fullname . _(' and I') . '<br />'; $html .= '<input type="radio" name="fields[note_visibility]" value="user coworker contact" ' . $vis_user_cw_cont . '> ' . _('Me, Co-Workers and ') . $contact_fullname; $html .= '</div>'; $html .= '<div style="text-align:right">'; $html .= '<input type="submit" name="Save" value = "' . _('Save') . '"> <a href="#" onclick = "fnCancelEdit(\'' . $curdiv . '\',' . $evtcl->idnote . ');return false;">' . _('close') . '</a>'; $html .= '</div>'; $html .= '</form>'; $evtcl->addOutputValue($html); } else { $msg = new Message(); $msg->getMessage("unauthorized_note_edit"); $html .= $msg->content . '<br /><br />'; $html .= '<a href="#" onclick = "fnCancelEdit(\'' . $curdiv . '\',' . $evtcl->idnote . ');return false;">' . _('close') . '</a>'; $evtcl->addOutputValue($html); } }