From 321bc14ba3c94e979c02aedc696e86fc7f6ce37e Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 12 Nov 2014 21:54:58 +0000 Subject: [PATCH] Home progress: - Get new note to open edit dialog automatically --- home/inc/class.home_note_portlet.inc.php | 7 ++----- home/js/app.js | 13 ++++++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/home/inc/class.home_note_portlet.inc.php b/home/inc/class.home_note_portlet.inc.php index 8f19435c49..920bf8014b 100644 --- a/home/inc/class.home_note_portlet.inc.php +++ b/home/inc/class.home_note_portlet.inc.php @@ -89,10 +89,6 @@ class home_note_portlet extends home_portlet { $id = $id['id']; } - if($etemplate == null) - { - $etemplate = new etemplate_new(); - } $etemplate->read('home.note'); $etemplate->set_dom_id($id); @@ -101,6 +97,7 @@ class home_note_portlet extends home_portlet if(!$content['note']) { $content['note'] = ''; + egw_json_response::get()->apply('app.home.note_edit',array($id)); } $etemplate->exec('home.home_note_portlet.exec',$content,array(),array('__ALL__'=>true),array('id' =>$id)); @@ -117,7 +114,7 @@ class home_note_portlet extends home_portlet 'default' => true ), 'edit_settings' => array( - 'default' => false + 'enabled' => false ) ); return $actions; diff --git a/home/js/app.js b/home/js/app.js index 9f96b3c757..2349193ab7 100644 --- a/home/js/app.js +++ b/home/js/app.js @@ -507,7 +507,14 @@ app.classes.home = AppJS.extend( * @param {egwActionObject[]} Selected */ note_edit: function(action, selected) { - var id = selected[0].id; + if(!selected && typeof action == 'string') + { + var id = action; + } + else + { + var id = selected[0].id; + } // Aim to match the size var portlet_dom = $j('[id$='+id+'][data-sizex]',this.portlet_container.getDOMNode); @@ -522,8 +529,8 @@ app.classes.home = AppJS.extend( // Open popup, but add 30 to the height for the toolbar egw.open_link(egw.link('/index.php',{ menuaction: 'home.home_note_portlet.edit', - id: selected[0].id, + id: id, height: window_height - 70 - }),action.id+selected[0].id, window_width+'x'+window_height,'home'); + }),'home_'+id, window_width+'x'+window_height,'home'); } });