UI to support links on unsaved entries

This commit is contained in:
Nathan Gray 2013-10-10 17:00:30 +00:00
parent 129eb91b3d
commit 8912d029a4
2 changed files with 28 additions and 2 deletions

View File

@ -157,7 +157,7 @@ class etemplate_widget_link extends etemplate_widget
$result = egw_link::link($app, $id, $links); $result = egw_link::link($app, $id, $links);
$response = egw_json_response::get(); $response = egw_json_response::get();
$response->data($result !== false); $response->data(is_array($id) ? $id : $result !== false);
} }
public function ajax_link_list($value) { public function ajax_link_list($value) {

View File

@ -315,16 +315,42 @@ var et2_link_to = et2_inputWidget.extend(
} }
this.file_upload.progress.empty(); this.file_upload.progress.empty();
// Server says it's OK, but didn't store - we'll send this again on submit
if(typeof success == "object" && success["Array:"])
{
this.options.value = success["Array:"];
var i = 0;
var fake_data = {
// Icon should be in registry
icon: egw.link_get_registry('addressbook','icon'),
app: this.options.value.app[i].app,
id: this.options.value.app[i].id
};
}
// Look for a link-list with the same ID, refresh it // Look for a link-list with the same ID, refresh it
var self = this; var self = this;
var list_widget = null;
this.getRoot().iterateOver( this.getRoot().iterateOver(
function(widget) { function(widget) {
if(widget.id == self.id) { if(widget.id == self.id) {
widget._get_links(); list_widget = widget;
if(success === true)
{
widget._get_links();
}
} }
}, },
this, et2_link_list this, et2_link_list
); );
if(list_widget && fake_data)
{
egw.link_title(fake_data.app, fake_data.id, function(title) {
fake_data.title = title;
list_widget._add_link(fake_data);
});
}
} }
else else
{ {