Home > m > gui > ltpdaRepoGUI > callbacks > cb_submitBtn.m

cb_submitBtn

PURPOSE ^

Callback executed when the user clicks on the 'Submit' button

SYNOPSIS ^

function cb_submitBtn(varargin)

DESCRIPTION ^

 Callback executed when the user clicks on the 'Submit' button
 
 M Hewitson
 
 $Id: cb_submitBtn.html,v 1.10 2008/03/31 10:27:44 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function cb_submitBtn(varargin)
0002 
0003 % Callback executed when the user clicks on the 'Submit' button
0004 %
0005 % M Hewitson
0006 %
0007 % $Id: cb_submitBtn.html,v 1.10 2008/03/31 10:27:44 hewitson Exp $
0008 %
0009 
0010 myh     = varargin{1};
0011 mainfig = varargin{4};
0012 
0013 % get object list
0014 objlist = findobj('Tag', 'workspaceObjsList');
0015 objstr  = get(objlist, 'String');
0016 vals    = get(objlist, 'Value');
0017 
0018 % Build sinfo structure
0019 sinfo.conn                   = getappdata(mainfig, 'connection');
0020 sinfo.experiment_title       = get(findobj('Tag', 'experimentTitle'), 'String');
0021 sinfo.experiment_description = get(findobj('Tag', 'experimentDescription'), 'String');
0022 sinfo.analysis_description   = get(findobj('Tag', 'analysisDescription'), 'String');
0023 sinfo.quantity               = get(findobj('Tag', 'quantity'), 'String');
0024 sinfo.keywords               = get(findobj('Tag', 'keywords'), 'String');
0025 sinfo.reference_ids          = get(findobj('Tag', 'referenceIDs'), 'String');
0026 sinfo.additional_comments    = get(findobj('Tag', 'additionalComments'), 'String');
0027 sinfo.additional_authors     = get(findobj('Tag', 'additionalAuthors'), 'String');
0028 
0029 if ~isa(sinfo.conn, 'database')
0030   error('### Please connect to a database before trying to submit.');
0031 end
0032 
0033 
0034 % Build structure array
0035 k = 1;
0036 objs = {};
0037 for j=1:length(vals)
0038   
0039   objname = deblank(strtok(objstr{vals(j)}));
0040   cmd = sprintf('obj = evalin(''base'', ''%s'');', objname);
0041   eval(cmd);
0042   
0043   for l=1:numel(obj)
0044     objs = [objs {obj(l)}];
0045     k = k + 1;
0046   end
0047 end
0048 
0049 % Submit objects
0050 try
0051   [ids, cid] = ltpda_obj_submit(objs, sinfo);
0052   if isempty(ids)
0053     warning('!!! Failed to submit object: %s', objname);
0054   else
0055     disp(sprintf('++ Submitted object(s) %s (ref id = %s, collection id = %d)', objname, mat2str(ids), cid));
0056   end
0057 catch
0058   warning('!!! Failed to submit object: %s', objname);
0059   rethrow(lasterror)
0060 end
0061

Generated on Mon 31-Mar-2008 12:20:24 by m2html © 2003