steffen: server/kolab-horde-fbview/kolab-horde-fbview/fbview/templates/data csvinfo.inc, NONE, 1.1 csvmap.inc, NONE, 1.1 date.inc, NONE, 1.1 datemap.inc, NONE, 1.1 datetime.inc, NONE, 1.1 time.inc, NONE, 1.1 tsvinfo.inc, NONE, 1.1

cvs at intevation.de cvs at intevation.de
Mon Oct 31 12:43:35 CET 2005


Author: steffen

Update of /kolabrepository/server/kolab-horde-fbview/kolab-horde-fbview/fbview/templates/data
In directory doto:/tmp/cvs-serv18388/kolab-horde-fbview/kolab-horde-fbview/fbview/templates/data

Added Files:
	csvinfo.inc csvmap.inc date.inc datemap.inc datetime.inc 
	time.inc tsvinfo.inc 
Log Message:
Fbview in separate package

--- NEW FILE: csvinfo.inc ---
<form method="post" name="import_form" action="<?php echo Horde::applicationUrl('data.php') ?>">
<input type="hidden" name="actionID" value="<?php echo $next_step ?>" />
<input type="hidden" name="import_format" value="csv" />
<input type="hidden" name="import_step" value="<?php echo $import_step ?>" />
<?php Util::pformInput() ?>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
  <td>
    <table cellpadding="3" cellspacing="0" border="0" width="100%">
    <tr><td class="header" align="center"><?php echo sprintf(_("Import, Step %d"), $import_step) ?></td>
    </tr></table>
  </td>
</tr>
<tr>
  <td class="item">
  <table border="0"><tr><td>
    <?php echo _("Here is the beginning of the file:") ?><br />
    <pre><?php echo htmlspecialchars($_SESSION['import_data']['first_lines']) ?></pre>
    <label for="header"><?php echo _("Does the first row contain the field names? If yes, check this box:") ?></label>
    <input id="header" type="checkbox" name="header" value="1" /><br />
    <?php echo _("What is the delimiter character?") ?>
    <input type="text" name="sep" size="1" value="<?php echo htmlspecialchars($_SESSION['import_data']['sep']) ?>" /><br />
    <?php if (array_key_exists('quote', $_SESSION['import_data'])): ?>
    <?php echo _("What is the quote character?") ?>
    <input type="text" name="quote" size="1" value="<?php echo htmlspecialchars($_SESSION['import_data']['quote']) ?>" /><br />
    <?php endif; ?>
    <?php if (array_key_exists('fields', $_SESSION['import_data'])): ?>
    <?php echo _("How many fields (columns) are there?") ?>
    <input type="text" name="fields" size="2" value="<?php echo $_SESSION['import_data']['fields'] ?>" /><br />
    <?php endif; ?>
    <br />
    <input type="submit" value="<?php echo _("Next") ?>" class="button" />
  </td></tr></table>
  </td>
</tr>
</table>
</form>

--- NEW FILE: csvmap.inc ---
<script language="JavaScript" type="text/javascript">
<!--
function resetHidden()
{
    var form = document.mapform;
    var tmp = '';
    for (i = 0; i < form.selectData.length; i++) {
        tmp += form.selectData[i].value;
        if (i < form.selectData.length - 1)
            tmp += "\t";
    }
    form.dataKeys.value = tmp;
    tmp = '';
    for (i = 0; i < form.selectApp.length; i++) {
        tmp += form.selectApp[i].value;
        if (i < form.selectApp.length - 1)
            tmp += "\t";
    }
    form.appKeys.value = tmp;
}

function addPair()
{
    var form = document.mapform;
    if (form.select1.selectedIndex >= 0 && form.select2.selectedIndex >= 0) {
        form.selectData[form.selectData.length] = new Option(form.select1[form.select1.selectedIndex].text, form.select1[form.select1.selectedIndex].value);
        form.selectApp[form.selectApp.length] = new Option(form.select2[form.select2.selectedIndex].text, form.select2[form.select2.selectedIndex].value);
        form.select1[form.select1.selectedIndex] = null;
        form.select2[form.select2.selectedIndex] = null;
    }
    resetHidden();
}

function removePair()
{
    var form = document.mapform;
    if (form.selectData.selectedIndex >= 0 || form.selectApp.selectedIndex >= 0) {
        form.select1[form.select1.length] = new Option(form.selectData[form.selectData.selectedIndex].text, form.selectData[form.selectData.selectedIndex].value);
        form.select2[form.select2.length] = new Option(form.selectApp[form.selectApp.selectedIndex].text, form.selectApp[form.selectApp.selectedIndex].value);
        form.selectData[form.selectData.selectedIndex] = null;
        form.selectApp[form.selectApp.selectedIndex] = null;
    }
    resetHidden();
}
//-->
</script>

<form method="post" name="mapform" action="<?php echo Horde::applicationUrl('data.php') ?>">
<input type="hidden" name="actionID" value="<?php echo $next_step ?>" />
<input type="hidden" name="import_format" value="<?php echo Util::getFormData('import_format') ?>" />
<input type="hidden" name="import_step" value="<?php echo $import_step ?>" />
<?php Util::pformInput() ?>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
  <td>
    <table cellpadding="3" cellspacing="0" border="0" width="100%">
    <tr><td class="header" align="center"><?php echo sprintf(_("Import, Step %d"), $import_step) ?></td></tr>
    </table>
  </td>
</tr>
<tr>
  <td>
    <table cellpadding="2" cellspacing="0" border="0" width="100%">
    <tr><td class="smallheader"><b><?php echo _("Select two matching fields.") ?></b></td></tr>
    </table>
  </td>
</tr>
<tr>
  <td class="item">
  <table border="0"><tr><td>
    <table border="0" cellpadding="0" cellspacing="0"><tr>
      <td>
        <?php echo _("Imported fields:") ?><br />
        <select name="select1" size="10">
<?php foreach ($_SESSION['import_data']['data'][0] as $key => $value):
      if (!isset($app_fields[$key])): ?>
          <option value="<?php echo htmlspecialchars($key) ?>"><?php echo ($_SESSION['import_data']['header']) ? $key : $value ?></option>
<?php endif;
      endforeach; ?>
        </select>
      </td>
      <td>
        <?php echo _("Available fields:") ?><br />
        <select name="select2" size="10">
<?php foreach ($app_fields as $key => $value):
      if (!isset($_SESSION['import_data']['data'][0][$key])): ?>
          <option value="<?php echo $key ?>"><?php echo $value ?></option>
<?php endif;
      endforeach; ?>
        </select>
      </td>
    </tr></table>
    <input type="button" value="<?php echo _("Add pair") ?>" class="button" onclick="addPair()" />
  </td></tr></table>
  </td
</tr>
<tr>
  <td>
    <table cellpadding="2" cellspacing="0" border="0" width="100%">
    <tr><td class="item"> </td></tr>
    <tr><td class="smallheader"><b><?php echo _("Matching fields") ?></b></td></tr>
    </table>
  </td>
</tr>
<tr>
  <td class="item">
  <table border="0"><tr><td>
    <input type="hidden" name="dataKeys" />
    <input type="hidden" name="appKeys" />
    <input type="hidden" name="import_format" value="csv" />
    <select name="selectData" size="10" onchange="document.mapform.selectApp[this.selectedIndex].selected=true">
<?php
foreach ($_SESSION['import_data']['data'][0] as $key => $value):
    if (isset($app_fields[$key])):
        $matching[] = array($key, $app_fields[$key]);
?>
          <option value="<?php echo $key ?>"><?php echo ($_SESSION['import_data']['header']) ? $key : $value ?></option>
<?php endif; ?>
<?php endforeach; ?>
    </select>
    <select name="selectApp" size="10" onchange="document.mapform.selectData[this.selectedIndex].selected=true">
<?php foreach ($matching as $pair): ?>
          <option value="<?php echo $pair[0] ?>"><?php echo $pair[1] ?></option>
<?php endforeach; ?>
    </select><br />
    <input type="button" value="<?php echo _("Remove pair") ?>" class="button" onclick="removePair()" /><br /><br />
    <input type="submit" value="<?php echo _("Next") ?>" class="button" />
  </td></tr></table>
  </td>
</tr>
</table>
</form>
<script language="JavaScript" type="text/javascript">
<!--
resetHidden();
//-->
</script>

--- NEW FILE: date.inc ---
<?php
$i = 0;
while ($i < count($date['values']) && empty($date['values'][$i])) {
    $i++;
}
if (strpos($date['values'][$i], '/') !== false) {
    $del = '/';
} elseif (strpos($date['values'][$i], '.') !== false) {
    $del = ".";
} elseif (strpos($date['values'][$i], '-') !== false) {
    $del = "-";
} else {
    $del = "";
}
?>
<tr>
    <td><?php echo _("Select the date delimiter:") ?></td>
    <td>
        <select name="delimiter[<?php echo $key ?>]">
            <option value="/"<?php echo $del == '/' ? ' selected="selected"' : '' ?>>/</option>
            <option value="."<?php echo $del == '.' ? ' selected="selected"' : '' ?>>.</option>
            <option value="-"<?php echo $del == '-' ? ' selected="selected"' : '' ?>>-</option>
        </select>
    </td>
</tr>
<tr>
    <td><?php echo _("Select the date format:") ?></td>
    <td>
        <select name="format[<?php echo $key ?>]">
            <option value="mday/month/year"><?php echo _("DD") . $del . _("MM") . $del . _("YY") ?></option>
            <option value="month/mday/year"><?php echo _("MM") . $del . _("DD") . $del . _("YY") ?></option>
            <option value="year/month/mday"><?php echo _("YY") . $del . _("MM") . $del . _("DD") ?></option>
            <option value="year/mday/month"><?php echo _("YY") . $del . _("DD") . $del . _("MM") ?></option>
        </select>
    </td>
</tr>

--- NEW FILE: datemap.inc ---
<form method="post" name="dateform" action="<?php echo Horde::applicationUrl('data.php') ?>">
<input type="hidden" name="actionID" value="<?php echo $next_step ?>" />
<input type="hidden" name="import_format" value="<?php echo Util::getFormData('import_format') ?>" />
<input type="hidden" name="import_step" value="<?php echo $import_step ?>" />
<?php Util::pformInput() ?>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
    <td>
        <table cellpadding="3" cellspacing="0" border="0" width="100%">
        <tr><td class="header" align="center"><?php echo sprintf(_("Import, Step %d"), $import_step) ?></td>
        </tr></table>
    </td>
</tr>
<?php foreach ($_SESSION['import_data']['dates'] as $key => $date): ?>
<?php if (count($date['values']) > 0): ?>
<tr>
    <td>
        <table cellpadding="2" cellspacing="0" border="0" width="100%">
        <tr><td class="item"> </td></tr>
        <tr><td class="smallheader"><b><?php echo sprintf(_("Imported field: %s"), $app_fields[$_SESSION['import_data']['map'][$key]]) ?></b></td></tr>
        </table>
    </td>
</tr>
<tr>
    <td class="item">
    <table border="0">
    <tr>
        <td><?php echo _("Example values:") ?></td>
        <td>
            <select>
<?php foreach ($date['values'] as $val): ?>
                <option><?php echo $val ?></option>
<?php endforeach; ?>
            </select>
        </td>
    </tr>
<?php include $registry->getParam('templates', 'horde') . '/data/' . $date['type'] . '.inc'; ?>
    </table>
    </td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
<tr>
    <td>
        <table cellpadding="2" cellspacing="0" border="0" width="100%">
        <tr><td class="item"><input type="submit" class="button" value="<?php echo _("Next") ?>" /></td></tr>
        </table>
    </td>
</tr>
</table>
</form>

--- NEW FILE: datetime.inc ---


--- NEW FILE: time.inc ---
<?php
$i = 0;
while ($i <= count($date['values']) && empty($date['values'][$i])) {
    $i++;
}
if (strpos($date['values'][$i], ':') !== false) {
    $del = ':';
} elseif (strpos($date['values'][$i], '.') !== false) {
    $del = ".";
} else {
    $del = "";
}
$ampm = (strpos(String::lower($date['values'][0]), 'am') !== false || strpos(String::lower($date['values'][0]), 'pm') !== false);
?>
<tr>
    <td><?php echo _("Select the time delimiter:") ?></td>
    <td>
        <select name="delimiter[<?php echo $key ?>]">
            <option value=":"<?php echo $del == ':' ? ' selected="selected"' : '' ?>>:</option>
            <option value="."<?php echo $del == '.' ? ' selected="selected"' : '' ?>>.</option>
        </select>
    </td>
</tr>
<tr>
    <td><?php echo _("Select the time format:") ?></td>
    <td>
        <select name="format[<?php echo $key ?>]">
            <option value="24hr"<?php echo $ampm ? '' : ' selected="selected"' ?>><?php echo _("24 hours") ?></option>
            <option value="ampm"<?php echo $ampm ? ' selected="selected"' : '' ?>><?php echo _("AM/PM") ?></option>
        </select>
    </td>
</tr>

--- NEW FILE: tsvinfo.inc ---
<form method="post" name="import_form" action="<?php echo Horde::applicationUrl('data.php') ?>">
<input type="hidden" name="actionID" value="<?php echo $next_step ?>" />
<input type="hidden" name="import_format" value="<?php echo Util::getFormData('import_format') ?>" />
<input type="hidden" name="import_step" value="<?php echo $import_step ?>" />
<?php Util::pformInput() ?>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
    <td>
        <table cellpadding="3" cellspacing="0" border="0" width="100%">
        <tr><td class="header" align="center"><?php echo sprintf(_("Import, Step %d"), $import_step) ?></td>
        </tr></table>
    </td>
</tr>
<tr>
    <td class="item">
    <table border="0"><tr><td>
        <?php echo _("Here is the beginning of the file:") ?><br />
        <pre><?php echo htmlspecialchars($_SESSION['import_data']['first_lines']) ?></pre>
        <label for="header"><?php echo _("Does the first row contain the field names? If yes, check this box:") ?></label>
        <input id="header" type="checkbox" name="header" value="1" /><br />
        <input type="submit" value="<?php echo _("Next") ?>" class="button" />
    </td></tr></table>
    </td>
</tr>
</table>
</form>





More information about the commits mailing list