function &getAddFormObject($record = null) { if (is_null($record)) { $record = $this->getObject(); } if (!$record->isNew()) { $formaction = 'updateFromTableRecord'; $formclass = 'updateFromTableForm'; $formactionval = $record->pk(); $formname = 'addFromTable__' . $this->table . $record->pk(); $update = $this->table . $record->pk(); $sub = "OK"; } else { $formaction = 'addFromTableRecord'; $formclass = 'addFromTableForm'; $formactionval = 1; $formname = 'addFromTable__' . $this->table; $update = 'endList__' . $this->table; $sub = "+"; } $form = new MyQuickForm($formname, 'POST', M_Office_Util::getQueryParams(array('module' => $this->table, 'filterField' => $this->field, 'filterValue' => $this->value, $formaction => $formactionval, 'ajaxfromtable' => 1), array_keys($_REQUEST), false)); $form->updateAttributes(array('class' => $formclass, 'target' => $update)); Mtpl::addJS('jquery.form'); $record->fb_requiredRuleMessage = __('The field "%s" is required'); $record->fb_ruleViolationMessage = __('The field "%s" is not valid'); $record->fb_formAddHeader = true; $record->fb_createSubmit = false; $record->fb_submitText = $sub; $this->fb =& MyFB::create($record); $this->fb->useForm($form); $this->fb->getForm(); if ($form->elementExists($this->field)) { $form->removeElement($this->field); } $form->addElement('submit', '__submit__', '+'); $form->addElement('hidden', $this->field, $this->value); // $form->addElement('static','st','','<pre>'.print_r($_REQUEST,true).'</pre>'); return $form; }
<?php Mtpl::addJS('livesearch'); Mtpl::addCSS('livesearch'); Mtpl::addJSinline('$("#chooseTable input").livesearch({autosearch:true,url:"' . ROOT_ADMIN_URL . ROOT_ADMIN_SCRIPT . '?livesearch=1"' . ',minchar:2});', 'ready'); ?> <!DOCTYPE html> <html lang="<?php echo T::getLocale(); ?> "> <head> <meta charset="utf-8" /> <title><?php echo $adminTitle; ?> </title> <link rel="stylesheet" type="text/css" media="screen,print" href="/css/reset-fonts-grids.css" /> <link rel="stylesheet" type="text/css" media="screen,print" href="/css/styleforms.css" /> <link rel="stylesheet" type="text/css" media="screen,print" href="/css/style_admin.css" /> <?php foreach (Mtpl::getCSS() as $css) { echo '<link rel="stylesheet" type="text/css" media="' . $css['media'] . '" href="/css/' . $css['name'] . '.css" />'; } Mtpl::printJS(); ?> <script type="text/javascript"> /*<![CDATA[*/ <?php
<link rel="stylesheet" type="text/css" media="screen" href="/css/otfimage.css" /> <?php Mtpl::addJS('jquery.block'); Mtpl::addJS('AjaxUpload.2.0'); ?> <?php $this->startCapture('js'); ?> var initpheditor; initpheditor = function(blockid) { $('#showimagelist_'+blockid).toggle(function(){$('#imagelist_'+blockid).hide()},function(){$('#imagelist_'+blockid).show()}); $('.otf_deletephoto').click(function(){ var link=this; if(confirm('Voulez-vous supprimer cette photo ?')) { $.get($(this).attr('href'),function(){ $(link).parent().remove(); }); } return false; }); $('.otf_setphotoasmain').click(function(){ var link=this; $.get($(this).attr('href'),function(){ $(link).parent().parent().find('.main').removeClass('main'); $(link).parent().addClass('main'); }); return false; }) new Ajax_upload($('#addphotolink_'+blockid),