Example #1
0
 protected function action_delete($name, $data, $action, $item = false, $fields = array())
 {
     $res = parent::action_delete($name, $data, $action, $item, $fields);
     Events::call('admin.change');
     if ($res == 'ok') {
         return json_encode(array('success' => true));
     }
 }
Example #2
0
    protected function layout_preprocess($l, $name, $data)
    {
        $l->use_styles(CMS::stdfile_url('styles/fields/documents.css'), CMS::stdfile_url('styles/jquery/dform.css'));
        $l->use_scripts(CMS::stdfile_url('scripts/jquery/dform.js'), CMS::stdfile_url('scripts/tao/popup.js'), CMS::stdfile_url('scripts/fields/documents.js'), CMS::stdfile_url('scripts/jquery/json.js'), CMS::stdfile_url('scripts/jquery/tablednd.js'));
        $doc_fields = $this->get_doc_fields($name, $data);
        foreach ($doc_fields as $dname => $ddata) {
            if ($ddata['xtype'] == 'datefield' || $ddata['type'] == 'date') {
                $l->use_script(CMS::stdfile_url('scripts/jquery/ui.js'), array('weight' => -1));
                $l->use_style(CMS::stdfile_url('styles/jquery/ui.css'));
            }
        }
        $id = $this->url_class();
        $code = <<<JS
\t\t\$(function () { \$('.{$id}.field-{$name}').each(function() {TAO.fields.documents.process(\$(this))}) })
JS;
        $item = $this->get_item($name, $data);
        if ($item && method_exists($item, 'is_phantom') && !$item->is_phantom()) {
            $l->append_to('js', $code);
        }
        $l->with('url_class', $id);
        Templates_HTML::add_scripts_settings(array('fields' => array($name => array('fields' => $doc_fields, 'autoedit_on_upload' => isset($data['autoedit_on_upload']) ? $data['autoedit_on_upload'] : $this->autoedit_on_upload))));
        return parent::layout_preprocess($l, $name, $data);
    }