<!-- Component CSV-Import begin -->
<script type="text/javascript" language="javascript">
    <!--
    function checkAll(el) {
        var objArray = document.getElementsByName("employee[]");
        if (objArray && objArray.length > 0) {
            for (i = 0; i < objArray.length; i++) {
                objArray[i].checked = el.checked;
            }
        }
    }

    function checkEmployee(id) {
        var objArray = document.getElementsByName("employee[]");
        if (objArray && objArray.length > 0) {
            for (i = 0; i < objArray.length; i++) {
                if (objArray[i].value == id) {
                    objArray[i].checked = (objArray[i].checked)
                        ? false : true;
                }
            }
        }
    }

    function switchPage(page) {
        document.getElementById('pos').value = page;
        submitForm();
    }

    function changeSort(sort) {
        var el  = document.getElementById("sort");
        var els = document.getElementById("order");
        if (el) {
            if (el.value == sort) {
                if (els) {
                    els.value = (els.value == "asc") ? "desc" : "asc";
                }
            } else {
                el.value = sort;
            }
            submitForm();
        }
    }

    function keyEvent(event) {
        if (event.keyCode == 13) submitForm();
    }

    var iMode = null;

    function importCheck(mode) {

        if (mode == 1 || isChecked()) {
               
            if(document.getElementById('csvFormat2') == undefined || !document.getElementById('csvFormat2').checked){
    [% if $ADUpdate %]
                    document.getElementById("iMode").value = mode;
                    submitForm();
    [% else %]
                    iMode = mode;
                    $("#dialog-PopUpFrameContent").dialog('open');
    [% /if %]
                } else {
                    document.getElementById("iMode").value = mode;

                    submitForm();
                }
            } else {
                alert("[% $user->gettext('Bitte selektieren Sie min. einen Mitarbeiter.') %]");
            }
        }

        function isChecked() {
            var objArray = document.getElementsByName("employee[]");
            if (objArray && objArray.length > 0) {
                for (i = 0; i < objArray.length; i++) {
                    if (objArray[i].checked) {
                        return true;
                    }
                }
            }
            return false;
        }

        function closePopUpFrame() {
            var el = document.getElementById("PopUpFrame");
            var obj = document.getElementById("PopUpFrameContent");
            el.style.visibility = "hidden";
            obj.style.visibility = "hidden";
        }

        function startImport() {
            var el1  = document.getElementById("uMode");
            var el2  = document.getElementById("cMode");
            
            var pwd1 = $("#passwd1").val();
            var pwd2 = $("#passwd2").val();

        if (el2.checked) {
            $("#FormcMode").val('Y');
        }
        if (el1.checked) {
            $("#FormuMode").val('Y');
        }     
            $("#Formpasswd1").val($("#passwd1").val());
            $("#Formpasswd2").val($("#passwd2").val());
        
            if (el1 && el2 && (el1.checked || el2.checked)) {
                if(el1.checked)
                {
                    [% if !$ADImport %]
                    if (pwd1 != pwd2) {
                        alert("[% $user->gettext('Passwörter stimmen nicht überein. Bitte kontrollieren Sie Ihre Eingabe.') %]");
                    } else {
                        if (pwd1 != '') {
                            document.getElementById("iMode").value = iMode;
                            submitForm();
                        } else {
                            alert("[% $user->gettext('Bitte geben Sie ein Standardpasswort ein') %]");
                        }
                    }
                    [% else %]
                      document.getElementById("iMode").value = iMode;
                      submitForm();
                    [% /if %]
                }
                else
                {
                    document.getElementById("iMode").value = iMode;
                    submitForm();
                    //$("#hm").submit();
                }

            } else {
                alert("[% $user->gettext('Bitte geben Sie an als was Sie den Mitarbeiter anlegen wollen') %]");
            }
        }

        function collapseTr() {
        [% if !$ADImport %]
            var el = document.getElementById('invisible2');
            if(el.style.display=="none") {
                el.style.display="";
                el.style.visibility='visible';
            } else {
                el.style.display="none";
                el.style.visibility='hidden';
            }
        
            var el = document.getElementById('invisible1');
            if(el.style.display=="none") {
                el.style.display="";
                el.style.visibility='visible';
            } else {
                el.style.display="none";
                el.style.visibility='hidden';
            }
            [% /if %]

        }


        // -->
</script>


<form action="" method="post" name="hm" id="hm" enctype="multipart/form-data" style="margin:0;padding:0;">
    <input type="hidden" name="pos" id="pos" value="[% $pos %]" />
    <input type="hidden" name="sort" id="sort" value="[% $sort %]" />
    <input type="hidden" name="order" id="order" value="[% $order %]" />
    <input type="hidden" name="iMode" id="iMode" value="" />

    <input type="hidden" name="cMode" id="FormcMode" value="" />
    <input type="hidden" name="uMode" id="FormuMode" value="" />
    <input type="hidden" name="passwd1" id="Formpasswd1" value="" />
    <input type="hidden" name="passwd2" id="Formpasswd2" value="" />

    <!-- ###CONTENT### begin -->
    <div id="content" >
        <div class="wrapper" >

            <div class="border" >
                <table class="listview formview" id="EmployeeTable" cellspacing="0">
                    <thead>
                        <tr>
                            <th colspan="30">
                                <span style=" display:inline-block;" >
                                <strong>[% if $ADImport %][% $user->gettext('Mitarbeiter aus ActiveDirectory importieren') %][% else %][% if $ADUpdate %][% $user->gettext('Mitarbeiter aus ActiveDirectory aktualisieren') %][% else %][% $user->gettext('Mitarbeiter aus einer CSV-Datei importieren') %][% /if %][% /if %]</strong>
                                <br /> <span id="info">[% $entries %] [% $user->gettext('Mitarbeiter gefunden') %]</span>
</span>
                            <span style="display:inline-block; padding-left:5em;" >

                    [% if $updated %]<div style="text-align:center;"><h2>Daten wurden importiert...</h2></div>[% /if %]

                    [% if !$ADImport && !$ADUpdate %]
                        <a href="index.php?module=upload&event=SimpleFileUpload[% if ($hmcompany == "3D CAD GMBH" && $csvmode != 1 ) || $csvmode == 2 %]&mode=2[% /if %]" data-fancybox-type="iframe" class="button button-black dialog">[% $user->gettext('Datei hochladen') %]</a>
                    [% /if %]


                    [% if $ADUpdate %]
                        <a href="javascript:importCheck(0);"  class="button button-green" >[% $user->gettext('Auswahl aktualisieren') %]</a>
                        <a href="javascript:importCheck(1);"  class="button button-green" >[% $user->gettext('Alle aktualisieren') %]</a>
                    [% else %]
                        <a href="javascript:importCheck(0);" class="button button-green" >[% $user->gettext('Auswahl importieren') %]</a>
                        <a href="javascript:importCheck(1);" class="button button-green" >[% $user->gettext('Alle importieren') %]</a>

                    [% /if %]
                            </span>
                    </th>
                    </tr>

                    [% if !$ADImport && !$ADUpdate %]
                        <tr>
                            <th colspan="26">[% $user->gettext('Hier k&ouml;nnen Sie Kontakte und / oder Benutzer durch Datenimport aus einer CSV-Datei anlegen.') %]<br>
                                [% $user->gettext('Wählen Sie das Format, in dem die Daten in der CSV-Datei Vorliegen:') %]
                                <br>
                                    [% if $hmcompany != "3D CAD GMBH" %]
                                        <label for="csvFormat1">
                                            <input type="radio" id="csvFormat1" name="csvFormat" value="csvFormat1" [% if $hmcompany != "3D CAD GMBH" || $csvmode == 1 %]checked="checked"[% /if %] onchange="submitForm();">
                                            <strong>
                                            [% $user->gettext('Vorname') %];[% $user->gettext('Name') %];[% $user->gettext('Anmeldename') %];[% $user->gettext('Email') %];[% $user->gettext('Telefon') %];[% $user->gettext('FAX') %];
                                            [% $user->gettext('Mobil') %];[% $user->gettext('Personalnummer') %];[% $user->gettext('Firma') %];[% $user->gettext('Kostenstelle') %];[% $user->gettext('Abteilung') %];[% $user->gettext('Mandant') %];                                                                                        
                                            <br/>
                                            [% $user->gettext('Geb&auml;ude') %];[% $user->gettext('Raum') %];[% $user->gettext('Stockwerk') %];[% $user->gettext('Position') %];
                                            [% $user->gettext('Straße') %];[% $user->gettext('Plz') %];[% $user->gettext('Ort') %];[% $user->gettext('Bundesland') %];[% $user->gettext('Land') %];
                                            [% $user->gettext('Zusätzliche Informationen') %];
                                            [% $user->gettext('Wichtiger Kontakt (1 = Ja)') %];[% $user->gettext('Kontakt erhält E-Mails (1 = Ja)') %];[% $user->gettext('Lieferant (1 = Ja)') %];                                        
                                            </strong>                                            
                                        </label>
                                        <br />
                                    [% /if %]
                                    <label for="csvFormat2">
                                        <input type="radio" id="csvFormat2" name="csvFormat" value="csvFormat2" [% if ($hmcompany == "3D CAD GMBH" && $csvmode != 1 ) || $csvmode == 2 %]checked="checked"[% /if %] onchange="submitForm();">
                                        [% if $hmcompany == "3D CAD GMBH" %]
                                            [% $user->gettext('Vorname') %];[% $user->gettext('Name') %];[% $user->gettext('Anmeldename') %];[% $user->gettext('Passwort') %];[% $user->gettext('Email') %];[% $user->gettext('Telefon') %];[% $user->gettext('Firma') %];<span title="[% $user->gettext('Bezahlter Support') %]">[% $user->gettext('(Ja/Nein)') %]</span>;
                                            <span title="[% $user->gettext('Anwender CAD (Wartung) / Anwender CAD (keine Wartung)') %]" >[% $user->gettext('(Ja/Nein/Leer)') %]</span>;
                                            <span title="[% $user->gettext('Anwender DM Vault (Wartung) / Anwender DM Vault (keine Wartung)') %]" >[% $user->gettext('(Ja/Nein/Leer)') %]</span>;
                                            <span title="[% $user->gettext('Anwender DM ProFile (Wartung)') %]" >[% $user->gettext('(Ja/Nein/Leer)') %]</span></b>
                                        [% else %]
                                            [% $user->gettext('Vorname') %];[% $user->gettext('Name') %];[% $user->gettext('Anmeldename') %];[% $user->gettext('Passwort') %];[% $user->gettext('Email') %];[% $user->gettext('Telefon') %];[% $user->gettext('Firma') %];[% $user->gettext('Priorisierter Kontakt') %][% $user->gettext('(Ja/Nein)') %] [% $user->gettext('gefolgt von Benutzergruppen-Namen getrennt durch Semikolons') %]
                                        [% /if %]
                                </label>
                            </th>
                        </tr>
                    [% /if %]

                    <tr>
                        <th colspan="26">


                    <div style="display: inline;">
                        <label for="filter">[% $user->gettext('Filter:') %]</label>
                        <input type="text" class="textbox" id="filter" name="filter" value="[% $filter %]" size="20" onkeyup="keyEvent(event);" autocomplete="off" />
                    </div>

                    [% if $ADUpdate %]
                        <div>
                            <label>[% $user->gettext("Zu aktualisierende Felder:") %]</label>
                            &nbsp;<label><input type="checkbox" name="fields[Name]" value="1"[% if $fields.Name == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Name') %]</label>
                            &nbsp;<label><input type="checkbox" name="fields[Email]" value="1" [% if $fields.Email == 1 %] checked="checked"[% /if %] /> [% $user->gettext('E-Mail') %]</label>
                            &nbsp;<label><input type="checkbox" name="fields[Telefon]" value="1" [% if $fields.Telefon == 1 %] checked="checked"[% /if %]  /> [% $user->gettext('Telefon') %]</label>
                            &nbsp;<label><input type="checkbox" name="fields[Fax]" value="1" [% if $fields.Fax == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Fax') %]</label>
                            &nbsp;<label><input type="checkbox" name="fields[Handy]" value="1" [% if $fields.Handy == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Handy') %]</label>
                            &nbsp;<label><input type="checkbox" name="fields[Company]" value="1" [% if $fields.Company == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Firma') %]</label>
                            &nbsp;<label><input type="checkbox" name="fields[Room]" value="1" [% if $fields.Room == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Raum') %]</label>

                            [% if $CostCenter %]
                                &nbsp;<label><input type="checkbox" name="fields[CostCenter]" value="1" [% if $fields.CostCenter == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Kostenstelle') %]</label>
                                [% /if %]
                            &nbsp;<label><input type="checkbox" name="fields[Department]" value="1" [% if $fields.Department == 1 %] checked="checked"[% /if %] /> [% $user->gettext('Abteilung') %]</label>
                        </div>
                        <br class="clear" />

                    [% /if %]
                    </th>
                    </tr>
                    [% if $csvmode == 2 %]


                        <tr class="fields">
                            <td style="text-align:center !important;">
                                <input type="checkbox" id="checkall" onclick="checkAll(this);" />
                            </td>
                            <td onclick="changeSort('name');">
                                [% $user->gettext('Name') %]
                                [% if $sort == "name" %]
                                    &nbsp;
                                    <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                                [% /if %]
                            </td>
                            <td onclick="changeSort('username');">
                                [% $user->gettext('Anmeldename') %]
                                [% if $sort == "username" %]
                                    &nbsp;
                                    <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                                [% /if %]
                            </td>
                            <td onclick="changeSort('email');">
                                [% $user->gettext('E-Mail') %]
                                [% if $sort == "email" %]
                                    &nbsp;
                                    <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                                [% /if %]
                            </td>
                            <td onclick="changeSort('phone');">
                                [% $user->gettext('Telefon') %]
                                [% if $sort == "phone" %]
                                    &nbsp;
                                    <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                                [% /if %]
                            </td>

                            <td onclick="changeSort('company');">
                                [% $user->gettext('Firma') %]
                                [% if $sort == "company" %]
                                    &nbsp;
                                    <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                                [% /if %]
                            </td>


                            <td onclick="changeSort('password');">
                                [% $user->gettext('Passwort') %]
                                [% if $sort == "password" %]
                                    &nbsp;
                                    <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                                [% /if %]
                            </td>
                            <td onclick="changeSort('important');">
                                [% if $hmcompany == "3D CAD GMBH" %]
                                    [% $user->gettext('Bezahler Support') %]
                                [% else %]
                                    [% $user->gettext('Prio. Kontakt') %]
                                [% /if %]
                                [% if $sort == "important" %]
                                    &nbsp;
                                    <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                                [% /if %]
                            </td>
                            <td style="cursor: default;">
                                [% $user->gettext('Gruppen') %]
                            </td>

                        </tr>
                        </thead>
                        <tbody>
                            [% foreach from=$employees item=employee %]
                                <tr onmouseover="this.style.cursor = 'pointer';">
                                    <td style="text-align:center !important;"><input type="checkbox" name="employee[]" value="[% $employee.employeeid %]" /></td>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);"[% if $employee.importedFlag %]class="import" title="Erfolgreich importiert / aktualisiert"[% elseif $Tools->FCS_Count($employee.errors) %]class="error" title="Fehler beim Import"[% /if %]>[% $employee.name %]&nbsp;</td>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.username %]&nbsp;</td>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);" [% if $employee.emailErr %]class="error" title="Keine gültige Mailadresse" [% /if %]>[% $employee.email %]&nbsp;</td>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.phone %]&nbsp;</td>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.company %]&nbsp;</td>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.password %]&nbsp;</td>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);" style="text-align: center;">[% if $employee.important == 1 %]<img src="images/tick.png" alt="[% $user->gettext('Priorisierter Kontakt') %]" title="[% $user->gettext('Priorisierter Kontakt') %]" />[% /if %]&nbsp;</td>
                                    <td onclick="checkEmployee([% $employee.employeeid %]);">[% $Tools->FCS_Implode($employee.groups, '<br /> ') %]&nbsp;</td>
                                </tr>
                            [% foreachelse %]
                                <tr class="row1">
                                    <td colspan="[% if $ADImport %]14[% else %]12[% /if %]" style="text-align:center !important;">[% if $ADUpdate %][% $user->gettext('Keine Mitarbeiter zum aktualisieren gefunden...') %][% else %][% $user->gettext('Keine Mitarbeiter zum importieren gefunden...') %][% /if %]</td>
                                </tr>
                            [% /foreach %]
                        </tbody>
                    </table>

                [% else %]

                    <tr class="fields">
                        <td style="text-align:center !important;">
                            <input type="checkbox" id="checkall" onclick="checkAll(this);" />
                        </td>
                        <td onclick="changeSort('name');">
                            [% $user->gettext('Name') %]
                            [% if $sort == "name" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                        <td onclick="changeSort('username');">
                            [% $user->gettext('Benutzername') %]
                            [% if $sort == "username" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                        [% if $ADImport %]
                            <td onclick="changeSort('UsernameErr');">
                                [% $user->gettext('Benutzer') %]
                                [% if $sort == "UsernameErr" %]
                                    &nbsp;
                                    <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                                [% /if %]
                            </td>
                            <td onclick="changeSort('ContactExist');">
                                [% $user->gettext('Kontakt') %]
                                [% if $sort == "ContactExist" %]
                                    &nbsp;
                                    <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                                [% /if %]
                            </td>
                        [% /if %]
                        <td onclick="changeSort('email');">
                            [% $user->gettext('E-Mail') %]
                            [% if $sort == "email" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                        <td onclick="changeSort('telefon');">
                            [% $user->gettext('Telefon') %]
                            [% if $sort == "phone" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                        
                       
                        <td onclick="changeSort('fax');">
                            [% $user->gettext('Fax') %]
                            [% if $sort == "fax" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                        <td onclick="changeSort('handy');">
                            [% $user->gettext('Mobil') %]
                            [% if $sort == "mobil" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                        <td onclick="changeSort('personalno');">
                            [% $user->gettext('Personalnummer') %]
                            [% if $sort == "personalno" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>

                        <td onclick="changeSort('company');">
                            [% $user->gettext('Firma') %]
                            [% if $sort == "company" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                        
                        <td onclick="changeSort('CostCenter');">
                            [% $user->gettext('Kostenstelle') %]
                            [% if $sort == "CostCenter" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>

                        <td onclick="changeSort('department');">
                            [% $user->gettext('Abteilung') %]
                            [% if $sort == "department" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>    
                        <td onclick="changeSort('mandant');">
                            [% $user->gettext('Mandant') %]
                            [% if $sort == "mandant" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>                                                 

                        <td onclick="changeSort('building');">
                            [% $user->gettext('Geb&auml;ude') %]
                            [% if $sort == "building" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                        <td onclick="changeSort('room');">
                            [% $user->gettext('Raum') %]
                            [% if $sort == "room" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                        <td onclick="changeSort('floor');">
                            [% $user->gettext('Stockwerk') %]
                            [% if $sort == "floor" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                            <td onclick="changeSort('com_position');">
                                [% $user->gettext('Position') %]
                                [% if $sort == "com_position" %]
                                    &nbsp;
                                    <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                                [% /if %]
                            </td>
                        
                        <td onclick="changeSort('street');">
                            [% $user->gettext('Straße') %]
                            [% if $sort == "street" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                        <td onclick="changeSort('plz');">
                            [% $user->gettext('PLZ') %]
                            [% if $sort == "plz" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>        
                        <td onclick="changeSort('city');">
                            [% $user->gettext('Stadt') %]
                            [% if $sort == "city" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                        <td onclick="changeSort('state');">
                            [% $user->gettext('Bundesland') %]
                            [% if $sort == "state" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                        <td onclick="changeSort('country');">
                            [% $user->gettext('Land') %]
                            [% if $sort == "country" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>
                        
                        <td onclick="changeSort('misc');">
                            [% $user->gettext('Info') %]
                            [% if $sort == "misc" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>     
                        <td onclick="changeSort('important');">
                            [% $user->gettext('Wichtiger Kontakt') %]
                            [% if $sort == "important" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>        
                        <td onclick="changeSort('sendEmails');">
                            [% $user->gettext('Erhält Emails') %]
                            [% if $sort == "sendEmails" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>        
                        <td onclick="changeSort('eMailTicketAddress');">
                            [% $user->gettext('Lieferant') %]
                            [% if $sort == "eMailTicketAddress" %]
                                &nbsp;
                                <img src="images/sort[% $order %].gif" width="11" height="11" border="0" alt=""  />
                            [% /if %]
                        </td>                                
                        
                    </tr>
                    </thead>
                    <tbody>
                        [% foreach from=$employees item=employee %]
                            <tr onmouseover="this.style.cursor = 'pointer';" >
                                <td style="text-align:center !important;"><input type="checkbox" name="employee[]" value="[% $employee.employeeid %]" /></td>
                                <td onclick="checkEmployee([% $employee.employeeid %]);" [% if $employee.importedFlag %]class="import" title="Erfolgreich importiert" [% /if %]>[% $employee.prename %] [% $employee.name %]&nbsp;</td>
                                <td onclick="checkEmployee([% $employee.employeeid %]);" [% if $employee.usernameerr %]class="error" title="In DB schon vorhanden" [% /if %]>[% $employee.username %]&nbsp;</td>
                                [% if $ADImport %]
                                    <td style="text-align:center !important;" onclick="checkEmployee([% $employee.employeeid %]);" ><img src="images/[% if $employee.usernameerr %]tick.png" alt="[% $user->gettext('Der Benutzer existiert bereits') %]" title="[% $user->gettext('Der Benutzer existiert bereits') %]" [% else %]publish_x.png" alt="[% $user->gettext('Benutzer kann importiert werden') %]" title="[% $user->gettext('Benutzer kann importiert werden') %]"[% /if %]/></td>
                                    <td style="text-align:center !important;" onclick="checkEmployee([% $employee.employeeid %]);" ><img src="images/[% if $employee.contactexist %]tick.png"  alt="[% $user->gettext('Der Kontakt existiert bereits') %]" title="[% $user->gettext('Der Kontakt existiert bereits') %]" [% else %]publish_x.png"  alt="[% $user->gettext('Kontakt kann importiert werden') %]" title="[% $user->gettext('Kontakt kann importiert werden') %]" [% /if %]/></td>
                                    [% /if %]
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.email %]&nbsp;</td>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.phone %]&nbsp;</td>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.fax %]&nbsp;</td>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.mobil %]&nbsp;</td>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.personalno %]&nbsp;</td>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.company %]&nbsp;</td>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.CostCenter %]&nbsp;</td>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.department %]&nbsp;</td>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.mandant %]&nbsp;</td>                                
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.building %]&nbsp;</td>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.room %]&nbsp;</td>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.floor %]&nbsp;</td>
                                <td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.com_position %]&nbsp;</td>
                                
<td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.street %]&nbsp;</td>
<td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.plz %]&nbsp;</td>
<td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.city %]&nbsp;</td>
<td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.state %]&nbsp;</td>
<td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.country %]&nbsp;</td>
<td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.misc %]&nbsp;</td>
<td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.important %]&nbsp;</td>
<td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.sendEmails %]&nbsp;</td>
<td onclick="checkEmployee([% $employee.employeeid %]);">[% $employee.eMailTicketAddress %]&nbsp;</td>
                                
                            </tr>
                        [% foreachelse %]
                            <tr class="even">
                                <td colspan="[% if $ADImport %]14[% else %]13[% /if %]" style="text-align:center !important;">[% if $ADUpdate %][% $user->gettext('Keine Mitarbeiter zum aktualisieren gefunden...') %][% else %][% $user->gettext('Keine Mitarbeiter zum importieren gefunden...') %][% /if %]</td>
                            </tr>
                        [% /foreach %]
                        
                        [% if $pages > 1 %]
                            <tr>
                                <td colspan="14">
                                    <div class="navigation">
                                        <ul>
                                            <li>[% $user->gettext('Seite') %]:</li>
                                            <li><a href="#" onclick="switchPage([% $pos-1 %]);" class="button button-grey"><span>&laquo;</span></a></li>
                                            <li><href="#" onclick="switchPage(0);" class="button button-[% if 0 == $pos %]green[% else %]grey[% /if %]"><span>1</span></a></li>
                                                [% if $pages gt 1 %]
                                                    <li><a href="#" onclick="switchPage(1);" class="button button-[% if 1 == $pos %]green[% else %]grey[% /if %]"><span>2</span></a></li>
                                                    [% /if %]
                                                    [% if $pages gt 2 %]
                                                    <li><a href="#" onclick="switchPage(2);" class="button button-[% if 2 == $pos %]green[% else %]grey[% /if %]"><span>3</span></a></li>
                                                    [% /if %]
                                                    [% if $pages gt 3 %]
                                                    <li><a href="#" onclick="switchPage(3);" class="button button-[% if 3 == $pos %]green[% else %]grey[% /if %]"><span>4</span></a></li>
                                                    [% /if %]
                                                    [% if $pages gt 4 %]
                                                    <li><a href="#" onclick="switchPage(4);" class="button button-[% if 4 == $pos %]green[% else %]grey[% /if %]"><span>5</span></a></li>
                                                    [% /if %]
                                                    [% if $pages gt 5 %]
                                                    <li>...</li>
                                                    <li><a href="#" onclick="switchPage([% $pages-1 %]);" class="button button-[% if $pages == $pos %]green[% else %]grey[% /if %]"><span>[% $pages-1 %]</span></a></li>
                                                            [% /if %]
                                                <li><a href="#" onclick="switchPage([% $pos+1 %]);" class="button button-grey"><span>&raquo;</span></a></li>
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                        [% /if %]
                    </tbody>
                    </table>
                [% /if %]
            </div>
        </div>
    </div>
</form>


<div id="dialog-PopUpFrameContent" >
    <table class="listview formview" border="0" cellspacing="0" cellpadding="0">
        <thead>
            <tr>
                <th colspan="2"><strong>[% $user->gettext('Standardangaben f&uuml;r die Mitarbeiter') %]</strong>
            </tr>
        </thead>
        <tbody>
            <tr class="even">
                <td><label for="cMode">[% $user->gettext('Als Kontakt anlegen:') %]</label></td>
                <td><input type="checkbox" name="cMode" value="Y" id="cMode" /></td>
            </tr>
            <tr class="even">
                <td><label for="uMode">[% $user->gettext('Als Benutzer anlegen:') %]</label></td>
                <td><input type="checkbox" name="uMode" value="Y" id="uMode" onclick="collapseTr();"/></td>
            </tr>
            [% if !$ADImport %]
            <tr class="invisible_tr even" id="invisible1" style="display:none; visibility:hidden;">
                <td><label for="passwd1">[% $user->gettext('Passwort:') %]</label></td>
                <td><input type="password" class="textbox" name="passwd1" id="passwd1" autocomplete="off"  /></td>
            </tr>
            <tr class="invisible_tr even" id="invisible2" style="display:none; visibility:hidden;">
                <td><label for="passwd2">[% $user->gettext('Passwort best&auml;tigen:') %]</label></td>
                <td><input type="password" class="textbox" name="passwd2" id="passwd2" /></td>
            </tr>
            [% /if %]
            <tr class="even">
                <td colspan="2" style="text-align:right !important;">
                    <input type="button" class="button button-green" value="[% $user->gettext('Importieren') %]" onclick="startImport();" />
                    <input type="button" class="button button-green" value="[% $user->gettext('Abbruch') %]" onclick="$('#dialog-PopUpFrameContent').dialog('close');" />
                </td>
            </tr>
        </tbody>
    </table>
</div>

<!-- Component CSV-Import end -->
<script type="text/javascript" language="javascript">
    <!--
                        
    $(".dialog").fancybox({
        maxWidth  : 500,
        maxHeight : 300,
        closeClick : false,
        autoOpen: false,
        onClosed   : function() {
            parent.location.reload(true);
        }
    });
                    
    $("#dialog-PopUpFrameContent").dialog({
        autoOpen: false,
        maxWidth  : 500,
        maxHeight : 300,
        closeClick : false,
        onClosed   : function() {
            parent.location.reload(true);
        },
        beforeClose: function( event, ui ) {
                  
        }
    });
                    
                    
    // -->
</script>
