- Add message if no records available for export using selected settings

- Improve export preview a little
This commit is contained in:
Nathan Gray 2013-01-07 18:25:53 +00:00
parent 442c3d605e
commit 89b4ce31e8
4 changed files with 69 additions and 35 deletions

View File

@ -345,6 +345,16 @@ class importexport_export_ui {
$plugin_object = new $definition->plugin;
$result = $plugin_object->export( $file, $definition );
if(is_object($result) && method_exists($result, 'get_num_of_records'))
{
$record_count = $result->get_num_of_records();
if($record_count == 0)
{
$response->addScript('alert("' . lang('No records selected') . '");');
return $response->getXML();
}
}
// Keep settings
$keep = array_diff_key($_content, array_flip(array('appname', 'definition', 'plugin', 'preview', 'export', $tabs)));
$GLOBALS['egw']->preferences->add('importexport',$definition->definition_id,serialize($keep));
@ -398,9 +408,12 @@ class importexport_export_ui {
$GLOBALS['egw']->translation->charset()
);
if($record_count)
{
$preview = "<div class='header'>".lang('Preview') . "<span class='count'>$record_count</span></div>".$preview;
}
$response->addAssign('exec[preview-box]','innerHTML',nl2br($preview));
$response->jquery('.preview-box','show');
$response->jquery('.preview-box-buttons','show');
$response->jquery('.preview_box','show');
$response->addScript("xajax_eT_wrapper();");
return $response->getXML();

View File

@ -334,7 +334,8 @@ class importexport_import_csv implements importexport_iface_import_record { //,
}
unset($results[$id]);
}
if($exact_count > 1)
// Too many exact matches, or none good enough
if($exact_count > 1 || count($results) == 0)
{
$warnings[] = lang('Unable to link to %1 "%2"',
lang($links[$name]), $record[$name]).

View File

@ -2,7 +2,7 @@
/**
* EGroupware - eTemplates for Application importexport
* http://www.egroupware.org
* generated by soetemplate::dump4setup() 2012-12-31 13:19
* generated by soetemplate::dump4setup() 2013-01-07 11:24
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package importexport
@ -59,26 +59,36 @@ $templ_data[] = array('name' => 'importexport.definition_index.row','template' =
cursor: pointer;
}','modified' => '1305674060',);
$templ_data[] = array('name' => 'importexport.export_dialog','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:7:{i:0;a:1:{s:2:"c3";s:15:"save_definition";}i:1;a:1:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";}}i:2;a:1:{s:1:"A";a:3:{s:4:"type";s:3:"tab";s:5:"label";s:25:"General|Selection|Options";s:4:"name";s:37:"general_tab|selection_tab|options_tab";}}i:3;a:1:{s:1:"A";a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:18:"Save as definition";s:4:"name";s:18:"save_as_definition";}}i:4;a:1:{s:1:"A";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:3:"all";i:1;a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Export";s:4:"name";s:6:"export";s:7:"onclick";s:36:"xajax_eT_wrapper(this);return false;";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:7:"Preview";s:4:"name";s:7:"preview";s:7:"onclick";s:36:"xajax_eT_wrapper(this);return false;";}}i:2;a:5:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:5:"align";s:5:"right";s:4:"name";s:6:"cancel";s:7:"onclick";s:29:"window.close(); return false;";}}}i:5;a:1:{s:1:"A";a:6:{s:4:"type";s:3:"box";s:4:"size";s:1:"1";s:4:"name";s:11:"preview-box";s:6:"needed";s:1:"1";i:1;a:1:{s:4:"type";s:5:"label";}s:4:"span";s:12:",preview-box";}}i:6;a:1:{s:1:"A";a:7:{s:4:"type";s:3:"box";s:4:"size";s:1:"1";s:4:"span";s:20:",preview-box-buttons";s:4:"name";s:19:"preview-box-buttons";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:2:"OK";s:5:"align";s:6:"center";s:7:"onclick";s:167:"document.getElementById(form::name(\'preview-box\')).style.display=\'none\'; document.getElementById(form::name(\'preview-box-buttons\')).style.display=\'none\'; return false;";}s:6:"needed";s:1:"1";s:5:"align";s:6:"center";}}}s:4:"rows";i:6;s:4:"cols";i:1;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '.preview-box {
$templ_data[] = array('name' => 'importexport.export_dialog','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:1:{s:2:"c3";s:15:"save_definition";}i:1;a:1:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";}}i:2;a:1:{s:1:"A";a:3:{s:4:"type";s:3:"tab";s:5:"label";s:25:"General|Selection|Options";s:4:"name";s:37:"general_tab|selection_tab|options_tab";}}i:3;a:1:{s:1:"A";a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:18:"Save as definition";s:4:"name";s:18:"save_as_definition";}}i:4;a:1:{s:1:"A";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:3:"all";i:1;a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Export";s:4:"name";s:6:"export";s:7:"onclick";s:36:"xajax_eT_wrapper(this);return false;";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:7:"Preview";s:4:"name";s:7:"preview";s:7:"onclick";s:36:"xajax_eT_wrapper(this);return false;";}}i:2;a:5:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:5:"align";s:5:"right";s:4:"name";s:6:"cancel";s:7:"onclick";s:29:"window.close(); return false;";}}}i:5;a:1:{s:1:"A";a:6:{s:4:"type";s:3:"box";s:4:"name";s:11:"preview_box";s:4:"size";s:1:"2";s:4:"span";s:15:"all,preview_box";i:1;a:6:{s:4:"type";s:3:"box";s:4:"size";s:1:"1";s:4:"name";s:11:"preview-box";s:6:"needed";s:1:"1";i:1;a:1:{s:4:"type";s:5:"label";}s:4:"span";s:8:",content";}i:2;a:6:{s:4:"type";s:3:"box";s:4:"size";s:1:"1";s:4:"span";s:20:",preview-box-buttons";s:4:"name";s:19:"preview-box-buttons";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:2:"OK";s:5:"align";s:6:"center";s:7:"onclick";s:86:"document.getElementById(form::name(\'preview_box\')).style.display=\'none\'; return false;";}s:5:"align";s:6:"center";}}}}s:4:"rows";i:5;s:4:"cols";i:1;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '.preview_box {
position: absolute;
top: 0px;
left: 0px;
width: 400px;
height: 360px;
overflow: scroll;
width: 97%;
height: 95%;
overflow: hidden;
background-color: white;
z-index: 999;
display: none;
border: 1px solid black;
margin: 1.5%;
}
.preview-box-buttons {
.preview_box .header {
font-size: 150%;
margin-bottom: 5px;
padding: 5px;
border-bottom: 1px outset;
}
.header .count {
float:right;
}
.preview_box>.content {
overflow: auto;
}
.preview-box-buttons {
position: absolute;
top: 365px;
left: 0px;
width: 400px;
height: 20px;
z-index: 999;
display: none;
bottom: 0px;
width: 100%;
margin-left: 50%;
}','modified' => '1296146438',);
$templ_data[] = array('name' => 'importexport.export_dialog.general_tab','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:1:{s:2:"c1";s:4:",top";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"image";s:4:"name";s:6:"export";}s:1:"B";a:2:{s:4:"type";s:8:"template";s:4:"name";s:46:"importexport.export_dialog.general_tab_content";}}}s:4:"rows";i:1;s:4:"cols";i:2;s:4:"size";s:6:",200px";s:7:"options";a:1:{i:1;s:5:"200px";}}}','size' => ',200px','style' => '','modified' => '1158223670',);

View File

@ -166,38 +166,48 @@
</hbox>
</row>
<row>
<box id="preview-box" needed="1" class="preview-box">
<description/>
</box>
</row>
<row>
<box align="center" id="preview-box-buttons" needed="1" class="preview-box-buttons">
<button align="center" label="OK" onclick="document.getElementById(form::name('preview-box')).style.display='none'; document.getElementById(form::name('preview-box-buttons')).style.display='none'; return false;"/>
<box id="preview_box" span="all" class="preview_box">
<box id="preview-box" needed="1" class="content">
<description/>
</box>
<box align="center" id="preview-box-buttons" class="preview-box-buttons">
<button align="center" label="OK" onclick="document.getElementById(form::name('preview_box')).style.display='none'; return false;"/>
</box>
</box>
</row>
</rows>
</grid>
<styles>
.preview-box {
.preview_box {
position: absolute;
top: 0px;
left: 0px;
width: 400px;
height: 360px;
overflow: scroll;
width: 97%;
height: 95%;
overflow: hidden;
background-color: white;
z-index: 999;
display: none;
border: 1px solid black;
margin: 1.5%;
}
.preview-box-buttons {
.preview_box .header {
font-size: 150%;
margin-bottom: 5px;
padding: 5px;
border-bottom: 1px outset;
}
.header .count {
float:right;
}
.preview_box&gt;.content {
overflow: auto;
}
.preview-box-buttons {
position: absolute;
top: 365px;
left: 0px;
width: 400px;
height: 20px;
z-index: 999;
display: none;
bottom: 0px;
width: 100%;
margin-left: 50%;
}
</styles>
</template>