This file is indexed.

/usr/share/pyshared/zope/formlib/orderedSelectionList.pt is in python-zope.formlib 4.0.5-0ubuntu5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<script type="text/javascript">

function moveItems(from, to)
  {
  // shortcuts for selection fields
  var src = document.getElementById(from);
  var tgt = document.getElementById(to);

  if (src.selectedIndex == -1) selectionError();
  else
    {
    // iterate over all selected items
    // --> attribute "selectedIndex" doesn't support multiple selection.
    // Anyway, it works here, as a moved item isn't selected anymore,
    // thus "selectedIndex" indicating the "next" selected item :)
    while (src.selectedIndex > -1)
      if (src.options[src.selectedIndex].selected)
        {
        // create a new virtal object with values of item to copy
        temp = new Option(src.options[src.selectedIndex].text,
                      src.options[src.selectedIndex].value);
        // append virtual object to targe
        tgt.options[tgt.length] = temp;
        // want to select newly created item
        temp.selected = true;
        // delete moved item in source
        src.options[src.selectedIndex] = null;
      }
    }
  }

// move item from "from" selection to "to" selection
function from2to(name)
  {
  moveItems(name+".from", name+".to");
  copyDataForSubmit(name);
  }

// move item from "to" selection back to "from" selection
function to2from(name)
  {
  moveItems(name+".to", name+".from");
  copyDataForSubmit(name);
  }

function swapFields(a, b)
  {
  // swap text
  var temp = a.text;
  a.text = b.text;
  b.text = temp;
  // swap value
  temp = a.value;
  a.value = b.value;
  b.value = temp;
  // swap selection
  temp = a.selected;
  a.selected = b.selected;
  b.selected = temp;
  }

// move selected item in "to" selection one up
function moveUp(name)
  {
  // shortcuts for selection field
  var toSel = document.getElementById(name+".to");

  if (toSel.selectedIndex == -1)
      selectionError();
  else if (toSel.options[0].selected)
      alert("Cannot move further up!");
  else for (var i = 0; toSel.length > i; i++)
    if (toSel.options[i].selected)
      {
      swapFields(toSel.options[i-1], toSel.options[i]);
      copyDataForSubmit(name);
      }
  }

// move selected item in "to" selection one down
function moveDown(name)
  {
    // shortcuts for selection field
    var toSel = document.getElementById(name+".to");

    if (toSel.selectedIndex == -1) {
        selectionError();
    } else if (toSel.options[toSel.length-1].selected) {
        alert("Cannot move further down!");
    } else {
      for (var i = toSel.length-1; i >= 0; i--) {
        if (toSel.options[i].selected) {
          swapFields(toSel.options[i+1], toSel.options[i]);
        }
      }
      copyDataForSubmit(name);
    }
  }

// copy each item of "toSel" into one hidden input field
function copyDataForSubmit(name)
  {
  // shortcuts for selection field and hidden data field
  var toSel = document.getElementById(name+".to");
  var toDataContainer = document.getElementById(name+".toDataContainer");

  // delete all child nodes (--> complete content) of "toDataContainer" span
  while (toDataContainer.hasChildNodes())
      toDataContainer.removeChild(toDataContainer.firstChild);

  // create new hidden input fields - one for each selection item of
  // "to" selection
  for (var i = 0; toSel.options.length > i; i++)
    {
    // create virtual node with suitable attributes
    var newNode = document.createElement("input");
    var newAttr = document.createAttribute("name");
    newAttr.nodeValue = name;
    newNode.setAttributeNode(newAttr);

    newAttr = document.createAttribute("type");
    newAttr.nodeValue = "hidden";
    newNode.setAttributeNode(newAttr);

    newAttr = document.createAttribute("value");
    newAttr.nodeValue = toSel.options[i].value;
    newNode.setAttributeNode(newAttr);

    // actually append virtual node to DOM tree
    toDataContainer.appendChild(newNode);
    }
  }

// error message for missing selection
function selectionError()
  {alert("Must select something!")}

</script>

<table border="0" class="ordered-selection-field">
  <tr>
    <td>
      <select id="from" name="from" size="5" multiple="multiple"
          tal:attributes="name string:${view/name}.from;
                          id string:${view/name}.from;
                          size view/size"
                          >
        <option tal:repeat="entry view/choices"
                tal:attributes="value entry/value"
                tal:content="entry/text" i18n:translate=""/>
      </select>
    </td>
    <td>
      <button name="from2toButton" type="button" value=" -&gt;"
          onclick="javascript:from2to()"
          tal:attributes="onClick string:javascript:from2to('${view/name}')"
          >&nbsp;-&gt;</button>
      <br />
      <button name="to2fromButton" type="button" value="&lt;- "
          onclick="javascript:to2from()"
          tal:attributes="onClick string:javascript:to2from('${view/name}')"
          >&lt;-&nbsp;</button>
    </td>
    <td>
      <select id="to" name="to" size="5" multiple="multiple"
          tal:attributes="name string:${view/name}.to;
                          id string:${view/name}.to;
                          size view/size">
        <option tal:repeat="entry view/selected"
                tal:attributes="value entry/value"
                tal:content="entry/text" i18n:translate=""/>
      </select>
      <input name="foo-empty-marker" type="hidden"
        tal:attributes="name string:${view/name}-empty-marker"/>
      <span id="toDataContainer"
            tal:attributes="id string:${view/name}.toDataContainer">
        <script type="text/javascript" tal:content="string:
          copyDataForSubmit('${view/name}');">
          // initial copying of field "field.to" --> "field"
          copyDataForSubmit("<i tal:replace="${view/name}"/>");
        </script>
      </span>
    </td>
    <td>
      <button
          name="upButton" type="button" value="^"
          onclick="javascript:moveUp()"
          tal:attributes="onClick string:javascript:moveUp('${view/name}')"
          >^</button>
      <br />
      <button
          name="downButton" type="button" value="v"
          onclick="javascript:moveDown()"
          tal:attributes="onClick string:javascript:moveDown('${view/name}')"
          >v</button>
    </td>
  </tr>
</table>