Changeset e60df7


Ignore:
Timestamp:
Jan 20, 2009, 3:54:40 AM (13 years ago)
Author:
rene <rene@…>
Branches:
lite_0.1, multiEdit, ng_0.6, ng_0.6_help, ng_0.8, ng_0.9
Children:
06d7d5
Parents:
5f3c9a
Message:

repaired sorting / prepared for ordering of filters

Location:
chrome/content/v_identity
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chrome/content/v_identity/vI_rdfDataTree.js

    r5f3c9a re60df7  
    3333function prepareForComparison (o) {
    3434    if (typeof o == "string") { return o.toLowerCase().replace(/\"/g,""); }
     35//  if (typeof o == "number") { return o; }
    3536    return "";
    3637};
     
    9293    addNewDatum : function(resource, name, localIdentityData, idData) {
    9394        var pref = {    recipientCol : name,
     95                indexCol : idData.length + 1 + ".",
    9496                senderCol : localIdentityData.combinedName,
    9597                smtpCol : localIdentityData.smtp.value,
     
    103105        idData.push(pref);
    104106    },
    105     sort : function(column) {
    106         var columnName;
     107    sort : function(columnName) {
     108        vI_notificationBar.dump("## sort: " + columnName + ".\n");
    107109        var order = this.treeElem.getAttribute("sortDirection") == "ascending" ? 1 : -1;
    108110        //if the column is passed and it's already sorted by that column, reverse sort
    109         if (column) {
    110             columnName = column.id;
    111             if (this.treeElem.getAttribute("sortResource") == columnName) {
     111        if (columnName && (this.treeElem.getAttribute("sortResource") == columnName)) {
    112112                order *= -1;
    113             }
    114         } else {
    115             columnName = this.treeElem.getAttribute("sortResource");
    116113        }
    117114       
     
    124121        }
    125122        this.idTable.sort(columnSort);
     123       
    126124        //setting these will make the sort option persist
    127125        this.treeElem.setAttribute("sortDirection", order == 1 ? "ascending" : "descending");
    128126        this.treeElem.setAttribute("sortResource", columnName);
     127       
    129128        this.treeElem.view = new vI_rdfDataTree.treeView(this.idTable);
     129       
    130130        //set the appropriate attributes to show to indicator
    131131        var cols = this.treeElem.getElementsByTagName("treecol");
    132132        for (var i = 0; i < cols.length; i++) {
    133133            cols[i].removeAttribute("sortDirection");
    134         }
    135         document.getElementById(columnName).setAttribute("sortDirection", order == 1 ? "ascending" : "descending");
     134            if (cols[i].id.match(columnName))
     135                cols[i].setAttribute("sortDirection", order == 1 ? "ascending" : "descending");
     136        }
    136137    },
    137138
     
    190191        this.rowCount = table.length;
    191192        this.getCellText = function(row, col) {
    192             return table[row][col.id];
     193            return table[row][col.id.substr(0,col.id.indexOf("_"))];
    193194        };
    194195        this.getCellValue = function(row, col) {
    195             return table[row][col.id];
     196            return table[row][col.id.substr(0,col.id.indexOf("_"))];
    196197        };
    197198        this.setTree = function(treebox) {
     
    210211        this.getColumnProperties = function(colid,col,props){};
    211212        this.cycleHeader = function(col, elem) {
    212             var tree = vI_rdfDataTree.trees[vI_rdfDataTree.tabbox.selectedPanel.id];
    213             tree.sort(col)
     213            var treeType = vI_rdfDataTree.tabbox.selectedPanel.id;
     214            if (treeType != "filter")
     215                vI_rdfDataTree.trees[treeType].sort(col.id.substr(0,col.id.indexOf("_")));
    214216        };
    215217    },
  • chrome/content/v_identity/vI_rdfDataTree.xul

    r5f3c9a re60df7  
    3737  <!ENTITY % messengercomposeDTD SYSTEM "chrome://messenger/locale/messengercompose/messengercompose.dtd" >
    3838%messengercomposeDTD;
     39<!ENTITY % filtersDTD SYSTEM "chrome://messenger/locale/FilterListDialog.dtd">%filtersDTD;
    3940]>
    4041
     
    9394<hbox align="center">
    9495    <spacer width="3px" />
    95     <vbox><spacer flex="1"/>
     96<!--    <vbox><spacer flex="1"/>
    9697    <menubar>
    9798        <menu id="editMenu" label="&vI_rdfDataTree.editMenu.label;"
     
    114115    </menubar>
    115116    <spacer flex="1"/></vbox>
    116     <spacer width="20px" />
     117    <spacer width="20px" />-->
    117118    <label value="&vI_rdfDataTree.filterPrefs.label;" accesskey="&vI_rdfDataTree.filterPrefs.accesskey;" control="filter"/>
    118119    <textbox id="filter" flex="1" oninput="vI_rdfDataTree.inputFilter(event);"/>
    119120    <button id="clearFilter" label="&vI_rdfDataTree.showAll.label;" accesskey="&vI_rdfDataTree.showAll.accesskey;" oncommand="vI_rdfDataTree.clearFilter();" disabled="true"/>
    120121</hbox>
     122
    121123<tabbox id="TreeTabbox" flex="1">
    122124<tabs onselect="vI_rdfDataTree.hideInfoBox();" >
     
    128130<tabpanels flex="1">
    129131<tabpanel id="email" flex="1">
     132<hbox flex="1">
    130133<tree id="rdfDataTree_email" flex="1" class="plain" seltype="multiple"
    131134    persist="sortDirection sortResource" sortDirection="ascending" sortResource="recipientCol"
    132135    enableColumnDrag="true" context="configContext" onselect="vI_rdfDataTree.onselect(this);">
    133     <treecols id="rdfDataTreeCols">
    134         <treecol id="recipientCol" label="&vI_rdfDataTree.recipientColumn.label;" flex="10"
    135             class="sortDirectionIndicator"
    136             ignoreincolumnpicker="true"
    137             persist="hidden width ordinal sortDirection"/>
    138         <splitter class="tree-splitter" />
    139         <treecol id="typeCol" label="&vI_rdfDataTree.typeColumn.label;" flex="5"
    140             class="sortDirectionIndicator"
    141             persist="hidden width ordinal sortDirection"/>
    142         <splitter class="tree-splitter" />
    143         <treecol id="senderCol" label="&vI_rdfDataTree.senderColumn.label;" flex="10"
    144             class="sortDirectionIndicator"
    145             persist="hidden width ordinal sortDirection"/>
    146         <splitter class="tree-splitter" />
    147         <treecol id="smtpCol" label="&vI_rdfDataTree.smtpColumn.label;" flex="5"
    148             class="sortDirectionIndicator"
    149             persist="hidden width ordinal sortDirection"/>
    150         <splitter class="tree-splitter" />
    151         <treecol id="idCol" label="&vI_rdfDataTree.idColumn.label;" flex="10"
     136    <treecols id="rdfDataTreeCols_email">
     137        <treecol id="recipientCol_email" label="&vI_rdfDataTree.recipientColumn.label;" flex="10"
     138            class="sortDirectionIndicator"
     139            ignoreincolumnpicker="true"
     140            persist="width ordinal sortDirection"/>
     141        <splitter class="tree-splitter" />
     142        <treecol id="senderCol_email" label="&vI_rdfDataTree.senderColumn.label;" flex="10"
     143            class="sortDirectionIndicator"
     144            persist="hidden width ordinal sortDirection"/>
     145        <splitter class="tree-splitter" />
     146        <treecol id="smtpCol_email" label="&vI_rdfDataTree.smtpColumn.label;" flex="5"
     147            class="sortDirectionIndicator"
     148            persist="hidden width ordinal sortDirection"/>
     149        <splitter class="tree-splitter" />
     150        <treecol id="idCol_email" label="&vI_rdfDataTree.idColumn.label;" flex="10"
    152151            class="sortDirectionIndicator"
    153152            persist="hidden width ordinal sortDirection"/>     
    154153    </treecols>
    155     <treechildren id="configTreeBody" ondblclick="if (event.button == 0) vI_rdfDataTree.modifySelected();" />
    156 </tree>
     154    <treechildren id="configTreeBody_email" ondblclick="if (event.button == 0) vI_rdfDataTree.modifySelected();" />
     155</tree>
     156<vbox>
     157          <button id="newButton_email" label="&newButton.label;" accesskey="&newButton.accesskey;"
     158                  oncommand="vI_rdfDataTree.newItem();"/>
     159          <button id="editButton_email" label="&editButton.label;" accesskey="&editButton.accesskey;"
     160                  oncommand="vI_rdfDataTree.modifySelected();"/>
     161          <button id="deleteButton_email" label="&deleteButton.label;" accesskey="&deleteButton.accesskey;"
     162                  oncommand="vI_rdfDataTree.removeSelected();"/>
     163          <spacer flex="1"/>
     164</vbox>
     165</hbox>
    157166</tabpanel>
    158167
    159168<tabpanel id="maillist" flex="1">
     169<hbox flex="1">
    160170<tree id="rdfDataTree_maillist" flex="1" class="plain" seltype="multiple"
    161171    persist="sortDirection sortResource" sortDirection="ascending" sortResource="recipientCol"
    162172    enableColumnDrag="true" context="configContext" onselect="vI_rdfDataTree.onselect();">
    163     <treecols id="rdfDataTreeCols">
    164         <treecol id="recipientCol" label="&vI_rdfDataTree.recipientColumn.label;" flex="10"
    165             class="sortDirectionIndicator"
    166             ignoreincolumnpicker="true"
    167             persist="hidden width ordinal sortDirection"/>
    168         <splitter class="tree-splitter" />
    169         <treecol id="typeCol" label="&vI_rdfDataTree.typeColumn.label;" flex="5"
    170             class="sortDirectionIndicator"
    171             persist="hidden width ordinal sortDirection"/>
    172         <splitter class="tree-splitter" />
    173         <treecol id="senderCol" label="&vI_rdfDataTree.senderColumn.label;" flex="10"
    174             class="sortDirectionIndicator"
    175             persist="hidden width ordinal sortDirection"/>
    176         <splitter class="tree-splitter" />
    177         <treecol id="smtpCol" label="&vI_rdfDataTree.smtpColumn.label;" flex="5"
    178             class="sortDirectionIndicator"
    179             persist="hidden width ordinal sortDirection"/>
    180         <splitter class="tree-splitter" />
    181         <treecol id="idCol" label="&vI_rdfDataTree.idColumn.label;" flex="10"
     173    <treecols id="rdfDataTreeCols_maillist">
     174        <treecol id="recipientCol_maillist" label="&vI_rdfDataTree.recipientColumn.label;" flex="10"
     175            class="sortDirectionIndicator"
     176            ignoreincolumnpicker="true"
     177            persist="width ordinal sortDirection"/>
     178        <splitter class="tree-splitter" />
     179        <treecol id="senderCol_maillist" label="&vI_rdfDataTree.senderColumn.label;" flex="10"
     180            class="sortDirectionIndicator"
     181            persist="hidden width ordinal sortDirection"/>
     182        <splitter class="tree-splitter" />
     183        <treecol id="smtpCol_maillist" label="&vI_rdfDataTree.smtpColumn.label;" flex="5"
     184            class="sortDirectionIndicator"
     185            persist="hidden width ordinal sortDirection"/>
     186        <splitter class="tree-splitter" />
     187        <treecol id="idCol_maillist" label="&vI_rdfDataTree.idColumn.label;" flex="10"
    182188            class="sortDirectionIndicator"
    183189            persist="hidden width ordinal sortDirection"/>     
    184190    </treecols>
    185     <treechildren id="configTreeBody" ondblclick="if (event.button == 0) vI_rdfDataTree.modifySelected();" />
    186 </tree>
     191    <treechildren id="configTreeBody_maillist" ondblclick="if (event.button == 0) vI_rdfDataTree.modifySelected();" />
     192</tree>
     193<vbox>
     194          <button id="newButton_maillist" label="&newButton.label;" accesskey="&newButton.accesskey;"
     195                  oncommand="vI_rdfDataTree.newItem();"/>
     196          <button id="editButton_maillist" label="&editButton.label;" accesskey="&editButton.accesskey;"
     197                  oncommand="vI_rdfDataTree.modifySelected();"/>
     198          <button id="deleteButton_maillist" label="&deleteButton.label;" accesskey="&deleteButton.accesskey;"
     199                  oncommand="vI_rdfDataTree.removeSelected();"/>
     200          <spacer flex="1"/>
     201</vbox>
     202</hbox>
    187203</tabpanel>
    188204<tabpanel id="newsgroup" flex="1">
     205<hbox flex="1">
    189206<tree id="rdfDataTree_newsgroup" flex="1" class="plain" seltype="multiple"
    190207    persist="sortDirection sortResource" sortDirection="ascending" sortResource="recipientCol"
    191208    enableColumnDrag="true" context="configContext" onselect="vI_rdfDataTree.onselect();">
    192     <treecols id="rdfDataTreeCols">
    193         <treecol id="recipientCol" label="&vI_rdfDataTree.recipientColumn.label;" flex="10"
    194             class="sortDirectionIndicator"
    195             ignoreincolumnpicker="true"
    196             persist="hidden width ordinal sortDirection"/>
    197         <splitter class="tree-splitter" />
    198         <treecol id="typeCol" label="&vI_rdfDataTree.typeColumn.label;" flex="5"
    199             class="sortDirectionIndicator"
    200             persist="hidden width ordinal sortDirection"/>
    201         <splitter class="tree-splitter" />
    202         <treecol id="senderCol" label="&vI_rdfDataTree.senderColumn.label;" flex="10"
    203             class="sortDirectionIndicator"
    204             persist="hidden width ordinal sortDirection"/>
    205         <splitter class="tree-splitter" />
    206         <treecol id="smtpCol" label="&vI_rdfDataTree.smtpColumn.label;" flex="5"
    207             class="sortDirectionIndicator"
    208             persist="hidden width ordinal sortDirection"/>
    209         <splitter class="tree-splitter" />
    210         <treecol id="idCol" label="&vI_rdfDataTree.idColumn.label;" flex="10"
     209    <treecols id="rdfDataTreeCols_newsgroup">
     210        <treecol id="recipientCol_newsgroup" label="&vI_rdfDataTree.recipientColumn.label;" flex="10"
     211            class="sortDirectionIndicator"
     212            ignoreincolumnpicker="true"
     213            persist="width ordinal sortDirection"/>
     214        <splitter class="tree-splitter" />
     215        <treecol id="senderCol_newsgroup" label="&vI_rdfDataTree.senderColumn.label;" flex="10"
     216            class="sortDirectionIndicator"
     217            persist="hidden width ordinal sortDirection"/>
     218        <splitter class="tree-splitter" />
     219        <treecol id="smtpCol_newsgroup" label="&vI_rdfDataTree.smtpColumn.label;" flex="5"
     220            class="sortDirectionIndicator"
     221            persist="hidden width ordinal sortDirection"/>
     222        <splitter class="tree-splitter" />
     223        <treecol id="idCol_newsgroup" label="&vI_rdfDataTree.idColumn.label;" flex="10"
    211224            class="sortDirectionIndicator"
    212225            persist="hidden width ordinal sortDirection"/>     
    213226    </treecols>
    214     <treechildren id="configTreeBody" ondblclick="if (event.button == 0) vI_rdfDataTree.modifySelected();" />
    215 </tree>
     227    <treechildren id="configTreeBody_newsgroup" ondblclick="if (event.button == 0) vI_rdfDataTree.modifySelected();" />
     228</tree>
     229<vbox>
     230          <button id="newButton_newsgroup" label="&newButton.label;" accesskey="&newButton.accesskey;"
     231                  oncommand="vI_rdfDataTree.newItem();"/>
     232          <button id="editButton_newsgroup" label="&editButton.label;" accesskey="&editButton.accesskey;"
     233                  oncommand="vI_rdfDataTree.modifySelected();"/>
     234          <button id="deleteButton_newsgroup" label="&deleteButton.label;" accesskey="&deleteButton.accesskey;"
     235                  oncommand="vI_rdfDataTree.removeSelected();"/>
     236          <spacer flex="1"/>
     237</vbox>
     238</hbox>
    216239</tabpanel>
    217240<tabpanel id="filter" flex="1">
    218 <hbox flex="1" >
     241<hbox flex="1">
    219242<tree id="rdfDataTree_filter" flex="1" class="plain" seltype="multiple"
    220     persist="sortDirection sortResource" sortDirection="ascending" sortResource="recipientCol"
     243    persist="sortDirection sortResource" sortDirection="ascending" sortResource="indexCol"
    221244    enableColumnDrag="true" context="configContext" onselect="vI_rdfDataTree.onselect();">
    222     <treecols id="rdfDataTreeCols">
    223         <treecol id="recipientCol" label="&vI_rdfDataTree.recipientColumn.label;" flex="10"
    224             class="sortDirectionIndicator"
    225             ignoreincolumnpicker="true"
    226             persist="hidden width ordinal sortDirection"/>
    227         <splitter class="tree-splitter" />
    228         <treecol id="typeCol" label="&vI_rdfDataTree.typeColumn.label;" flex="5"
    229             class="sortDirectionIndicator"
    230             persist="hidden width ordinal sortDirection"/>
    231         <splitter class="tree-splitter" />
    232         <treecol id="senderCol" label="&vI_rdfDataTree.senderColumn.label;" flex="10"
    233             class="sortDirectionIndicator"
    234             persist="hidden width ordinal sortDirection"/>
    235         <splitter class="tree-splitter" />
    236         <treecol id="smtpCol" label="&vI_rdfDataTree.smtpColumn.label;" flex="5"
    237             class="sortDirectionIndicator"
    238             persist="hidden width ordinal sortDirection"/>
    239         <splitter class="tree-splitter" />
    240         <treecol id="idCol" label="&vI_rdfDataTree.idColumn.label;" flex="10"
    241             class="sortDirectionIndicator"
    242             persist="hidden width ordinal sortDirection"/>     
    243     </treecols>
    244     <treechildren id="configTreeBody" ondblclick="if (event.button == 0) vI_rdfDataTree.modifySelected();" />
    245 </tree>
    246 <vbox>
    247     <button label="move up" />
    248     <button label="move down" />
    249     <spacer flex="1" />
     245    <treecols id="rdfDataTreeCols_filter">
     246        <treecol id="indexCol_filter" label="&vI_rdfDataTree.indexColumn.label;" flex="10"
     247            ignoreincolumnpicker="true"
     248            class="sortDirectionIndicator"
     249            persist="width ordinal"/>
     250        <splitter class="tree-splitter" />
     251        <treecol id="recipientCol_filter" label="&vI_rdfDataTree.recipientColumn.label;" flex="10"
     252            ignoreincolumnpicker="true"
     253            class="sortDirectionIndicator"
     254            persist="width ordinal"/>
     255        <splitter class="tree-splitter" />
     256        <treecol id="senderCol_filter" label="&vI_rdfDataTree.senderColumn.label;" flex="10"
     257            class="sortDirectionIndicator"
     258            persist="hidden width ordinal"/>
     259        <splitter class="tree-splitter" />
     260        <treecol id="smtpCol_filter" label="&vI_rdfDataTree.smtpColumn.label;" flex="5"
     261            class="sortDirectionIndicator"
     262            persist="hidden width ordinal"/>
     263        <splitter class="tree-splitter" />
     264        <treecol id="idCol_filter" label="&vI_rdfDataTree.idColumn.label;" flex="10"
     265            class="sortDirectionIndicator"
     266            persist="hidden width ordinal"/>       
     267    </treecols>
     268    <treechildren id="configTreeBody_filter" ondblclick="if (event.button == 0) vI_rdfDataTree.modifySelected();" />
     269</tree>
     270<vbox>
     271          <button id="newButton_filter" label="&newButton.label;" accesskey="&newButton.accesskey;"
     272                  oncommand="vI_rdfDataTree.newItem();"/>
     273          <button id="editButton_filter" label="&editButton.label;" accesskey="&editButton.accesskey;"
     274                  oncommand="vI_rdfDataTree.modifySelected();"/>
     275          <button id="deleteButton_filter" label="&deleteButton.label;" accesskey="&deleteButton.accesskey;"
     276                  oncommand="vI_rdfDataTree.removeSelected();"/>
     277          <spacer flex="1"/>
     278          <button id="reorderUpButton_filter" label="&reorderUpButton.label;" accesskey="&reorderUpButton.accesskey;"
     279                  class="up"
     280                  oncommand="vI_rdfDataTree.moveUp();"/>
     281          <button id="reorderDownButton_filter" label="&reorderDownButton.label;" accesskey="&reorderDownButton.accesskey;"
     282                  class="down"
     283                  oncommand="vI_rdfDataTree.moveDown();"/>
     284          <spacer flex="1"/>
    250285</vbox>
    251286</hbox>
     
    253288
    254289</tabpanels>
    255 </tabbox> -->
     290</tabbox>
    256291<!-- <splitter /> -->
    257292<browser id="vI_rdfDataTreeInfoBox" class="vI_htmlTextBox" cssSource="vI_rdfTreeInfo.css" disablehistory="true" onoverflow="vI_rdfDataTree.overflow();"/>
Note: See TracChangeset for help on using the changeset viewer.