FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
ui-picker.php
Go to the documentation of this file.
1 <?php
2 /***********************************************************
3  Copyright (C) 2010-2013 Hewlett-Packard Development Company, L.P.
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  version 2 as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 ***********************************************************/
18 
21 
32 function picker_name_cmp($rowa, $rowb)
33 {
34  return (strnatcasecmp($rowa['name'], $rowb['name']));
35 }
36 
37 
41 function picker_ufile_name_cmp($rowa, $rowb)
42 {
43  return (strnatcasecmp($rowa['ufile_name'], $rowb['ufile_name']));
44 }
45 
46 
47 class ui_picker extends FO_Plugin
48 {
49  var $HighlightColor = '#4bfe78';
51  private $uploadDao;
52 
53  function __construct()
54  {
55  $this->Name = "picker";
56  $this->Title = _("File Picker");
57  $this->Dependency = array("browse","view");
58  $this->DBaccess = PLUGIN_DB_READ;
59  $this->LoginFlag = 0;
60  parent::__construct();
61  $this->uploadDao = $GLOBALS['container']->get('dao.upload');
62  }
63 
64 
68  function Install()
69  {
70  global $PG_CONN;
71  if (empty($PG_CONN)) {
72  return(1);
73  } /* No DB */
74 
75  /* create it if it doesn't exist */
76  $this->Create_file_picker();
77 
78  return(0);
79  } // Install()
80 
84  function RegisterMenus()
85  {
86  $text = _("Compare this file to another.");
87  menu_insert("Browse-Pfile::Compare",0,$this->Name,$text);
88 
89  return 0;
90  } // RegisterMenus()
91 
92 
101  function Initialize()
102  {
103  if ($this->State != PLUGIN_STATE_INVALID) {
104  return (1);
105  } // don't re-run
106  if ($this->Name !== "") {
107  // Name must be defined
108  global $Plugins;
109  $this->State = PLUGIN_STATE_VALID;
110  array_push($Plugins,$this);
111  }
112  return($this->State == PLUGIN_STATE_VALID);
113  } // Initialize()
114 
115 
120  {
121  global $PG_CONN;
122 
123  /* If table exists, then we are done */
124  $sql = "SELECT typlen FROM pg_type where typname='file_picker' limit 1";
125  $result = pg_query($PG_CONN, $sql);
126  DBCheckResult($result, $sql, __FILE__, __LINE__);
127  if (pg_num_rows($result) > 0) {
128  pg_free_result($result);
129  return 0;
130  }
131  pg_free_result($result);
132 
133  /* Create table */
134  $sql = "CREATE TABLE file_picker (
135  file_picker_pk serial NOT NULL PRIMARY KEY,
136  user_fk integer NOT NULL,
137  uploadtree_fk1 integer NOT NULL,
138  uploadtree_fk2 integer NOT NULL,
139  last_access_date date NOT NULL
140  );
141  ALTER TABLE ONLY file_picker
142  ADD CONSTRAINT file_picker_user_fk_key UNIQUE (user_fk, uploadtree_fk1, uploadtree_fk2);";
143 
144  $result = pg_query($PG_CONN, $sql);
145  DBCheckResult($result, $sql, __FILE__, __LINE__);
146  pg_free_result($result);
147  }
148 
149 
157  function HTMLFileList($File1uploadtree_pk, $Children, $FolderContents)
158  {
159  global $PG_CONN;
160  global $Plugins;
161 
162  $OutBuf=""; // return values for file listing
163  $Uri = Traceback_uri() . "?mod=$this->Name";
164 
165  $OutBuf .= "<table style='text-align:left;' >";
166 
167  if (!empty($FolderContents)) {
168  usort($FolderContents, 'picker_name_cmp');
169 
170  /* write subfolders */
171  foreach ($FolderContents as $Folder) {
172  if ($Folder && array_key_exists('folder_pk', $Folder)) {
173  $folder_pk = $Folder['folder_pk'];
174  $folder_name = htmlentities($Folder['name']);
175  $OutBuf .= "<tr>";
176 
177  $OutBuf .= "<td></td>";
178 
179  $OutBuf .= "<td>";
180  $OutBuf .= "<a href='$Uri&folder=$folder_pk&item=$File1uploadtree_pk'><b>$folder_name</b></a>/";
181  $OutBuf .= "</td></tr>";
182  } else if ($Folder && array_key_exists('uploadtree_pk', $Folder)) {
183  $bitem = $Folder['uploadtree_pk'];
184  $upload_filename = htmlentities($Folder['name']);
185  $OutBuf .= "<tr>";
186  $OutBuf .= "<td>";
187  $text = _("Select");
188  $Options = "id=filepick2 onclick='AppJump($bitem)')";
189  $OutBuf .= "<button type='button' $Options> $text </button>\n";
190  $OutBuf .= "</td>";
191 
192  $OutBuf .= "<td>";
193  $OutBuf .= "<a href='$Uri&bitem=$bitem&item=$File1uploadtree_pk'><b>$upload_filename</b></a>/";
194  $OutBuf .= "</td></tr>";
195  }
196  }
197  } else {
198  if (empty($Children)) {
199  $text = _("No children to compare");
200  $OutBuf .= "<tr><td colspan=2>$text</td></tr>";
201  } else {
202  usort($Children, 'picker_ufile_name_cmp');
203  foreach ($Children as $Child) {
204  if (empty($Child)) {
205  continue;
206  }
207  $OutBuf .= "<tr>";
208 
209  $IsDir = Isdir($Child['ufile_mode']);
210  $IsContainer = Iscontainer($Child['ufile_mode']);
211 
212  $LinkUri = $Uri . "&bitem=$Child[uploadtree_pk]&item=$File1uploadtree_pk";
213 
214  $OutBuf .= "<td>";
215  $text = _("Select");
216  $Options = "id=filepick onclick='AppJump($Child[uploadtree_pk])')";
217  $OutBuf .= "<button type='button' $Options> $text </button>\n";
218  $OutBuf .= "</td>";
219  $OutBuf .= "<td>";
220  if ($IsContainer) {
221  $OutBuf .= "<a href='$LinkUri'> $Child[ufile_name]</a>";
222  } else {
223  $OutBuf .= $Child['ufile_name'];
224  }
225  if ($IsDir) {
226  $OutBuf .= "/";
227  }
228  $OutBuf .= "</td>";
229  $OutBuf .= "</tr>";
230  }
231  }
232  }
233  $OutBuf .= "</table>";
234  return($OutBuf);
235  } // HTMLFileList()
236 
237 
269  function HTMLPath($File1uploadtree_pk, $FolderList, $DirectoryList)
270  {
271  if (empty($FolderList)) {
272  return "__FILE__ __LINE__ No folder list specified";
273  }
274 
275  $OutBuf = "";
276  $Uri2 = Traceback_uri() . "?mod=$this->Name";
277 
278  /* Box decorations */
279  $OutBuf .= "<div style='border: thin dotted gray; background-color:lightyellow'>\n";
280 
281  /* write the FolderList */
282  $text = _("Folder");
283  $OutBuf .= "<b>$text</b>: ";
284 
285  foreach ($FolderList as $Folder) {
286  $folder_pk = $Folder['folder_pk'];
287  $folder_name = htmlentities($Folder['folder_name']);
288  $OutBuf .= "<a href='$Uri2&folder=$folder_pk&item=$File1uploadtree_pk'><b>$folder_name</b></a>/";
289  }
290 
291  /* write the DirectoryList */
292  if (! empty($DirectoryList)) {
293  $OutBuf .= "<br>";
294  $First = true; /* If $First is true, directory path starts a new line */
295 
296  /* Show the path within the upload */
297  foreach ($DirectoryList as $uploadtree_rec) {
298  if (! $First) {
299  $OutBuf .= "/ ";
300  }
301 
302  $href = "$Uri2&bitem=$uploadtree_rec[uploadtree_pk]&item=$File1uploadtree_pk";
303  $OutBuf .= "<a href='$href'>";
304 
305  if (!$First && Iscontainer($uploadtree_rec['ufile_mode'])) {
306  $OutBuf .= "<br>&nbsp;&nbsp;";
307  }
308 
309  $OutBuf .= "<b>" . $uploadtree_rec['ufile_name'] . "</b>";
310  $OutBuf .= "</a>";
311  $First = false;
312  }
313  }
314 
315  $OutBuf .= "</div>\n"; // box
316  return($OutBuf);
317  } // HTMLPath()
318 
319 
327  function HistoryPick($uploadtree_pk, &$rtncount)
328  {
329  global $PG_CONN;
330 
331  $PickerRows = array();
332 
333  /* select possible item2's from pick history for this user */
334  $user_pk = $_SESSION['UserId'];
335  if (empty($user_pk)) {
336  return $PickerRows;
337  }
338 
339  $sql = "select file_picker_pk, uploadtree_fk1, uploadtree_fk2 from file_picker
340  where user_fk= '$user_pk' and ($uploadtree_pk=uploadtree_fk1 or $uploadtree_pk=uploadtree_fk2)";
341  $result = pg_query($PG_CONN, $sql);
342  DBCheckResult($result, $sql, __FILE__, __LINE__);
343  $rtncount = pg_num_rows($result);
344  if ($rtncount > 0) {
345  $PickerRows = pg_fetch_all($result);
346  pg_free_result($result);
347  } else {
348  /* No rows in history for this item and user */
349  pg_free_result($result);
350  return "";
351  }
352 
353  /* reformat $PickHistRecs for select list */
354  $PickSelectArray = array();
355  foreach ($PickerRows as $PickRec) {
356  if ($PickRec['uploadtree_fk1'] == $uploadtree_pk) {
357  $item2 = $PickRec["uploadtree_fk2"];
358  } else {
359  $item2 = $PickRec["uploadtree_fk1"];
360  }
361  $PathArray = Dir2Path($item2, 'uploadtree');
362  $Path = $this->Uploadtree2PathStr($PathArray);
363  $PickSelectArray[$item2] = $Path;
364  }
365  $Options = "id=HistoryPick onchange='AppJump(this.value)')";
366  $SelectList = Array2SingleSelect($PickSelectArray, "HistoryPick", "", true,
367  true, $Options);
368  return $SelectList;
369  } /* End HistoryPick() */
370 
371 
380  function SuggestionsPick($FileName, $uploadtree_pk, &$rtncount)
381  {
382  global $PG_CONN;
383 
384  /* find the root of $FileName. Thats the beginning alpha part. */
385  $BaseFN = basename($FileName);
386  $delims= "/-.0123456789 \t\n\r\0\0xb";
387  $NameRoot = ltrim($BaseFN, $delims);
388  $NameRoot = strtok($NameRoot, $delims);
389 
390  /* Only make suggestions with matching file extensions */
391  $ext = GetFileExt($FileName);
392  $tail = ".$ext";
393 
394  if (empty($NameRoot)) {
395  return "";
396  }
397 
398  /* find non artifact containers with names similar to $FileName */
399  $sql = "select uploadtree_pk from uploadtree
400  where ((ufile_mode & (1<<29))!=0) AND ((ufile_mode & (1<<28))=0)
401  and (ufile_name like '$NameRoot%$tail')
402  and (uploadtree_pk != '$uploadtree_pk') limit 100";
403  $result = pg_query($PG_CONN, $sql);
404  DBCheckResult($result, $sql, __FILE__, __LINE__);
405  $SuggestionsArray = array();
406  while ($row = pg_fetch_assoc($result)) {
407  $PathArray = Dir2Path($row['uploadtree_pk'], 'uploadtree');
408  $SuggestionsArray[$row['uploadtree_pk']] = $this->Uploadtree2PathStr($PathArray);
409  }
410  pg_free_result($result);
411 
412  $rtncount = count($SuggestionsArray);
413  if ($rtncount == 0) {
414  return "";
415  }
416 
417  /* Order the select list by the beginning of the path */
418  natsort($SuggestionsArray);
419 
420  $Options = "id=SuggestPick onchange='AppJump(this.value)')";
421  $SelectList = Array2SingleSelect($SuggestionsArray, "SuggestionsPick", "",
422  true, true, $Options);
423  return $SelectList;
424  } /* End SuggestionsPick */
425 
426 
432  function BrowsePick($uploadtree_pk, $inBrowseuploadtree_pk, $infolder_pk, $PathArray)
433  {
434  $OutBuf = "";
435  if (empty($inBrowseuploadtree_pk)) {
436  $Browseuploadtree_pk = $uploadtree_pk;
437  } else {
438  $Browseuploadtree_pk = $inBrowseuploadtree_pk;
439  }
440 
441  if (empty($infolder_pk)) {
442  $folder_pk = GetFolderFromItem("", $Browseuploadtree_pk);
443  } else {
444  $folder_pk = $infolder_pk;
445  }
446 
447  // Get list of folders that this $Browseuploadtree_pk is in
448  $FolderList = Folder2Path($folder_pk);
449 
450  // If you aren't browsing folders,
451  // Get list of directories that this $Browseuploadtree_pk is in
452  if (empty($infolder_pk)) {
453  $DirectoryList = Dir2Path($Browseuploadtree_pk, 'uploadtree');
454  } else {
455  $DirectoryList = '';
456  }
457 
458  // Get HTML for folder/directory list.
459  // This is the stuff in the yellow bar.
460  $OutBuf .= $this->HTMLPath($uploadtree_pk, $FolderList, $DirectoryList);
461 
462  /*
463  * Get list of folders in this folder
464  * That is, $DirectoryList is empty
465  */
466  if (empty($infolder_pk)) {
467  $FolderContents = array();
468  $Children = GetNonArtifactChildren($Browseuploadtree_pk);
469  } else {
470  $Children = array();
471  $FolderContents = $this->GetFolderContents($folder_pk);
472  }
473  $OutBuf .= $this->HTMLFileList($uploadtree_pk, $Children, $FolderContents);
474 
475  return $OutBuf;
476  } /* End BrowsePick */
477 
478 
497  function GetFolderContents($folder_pk)
498  {
499  global $PG_CONN;
500 
501  $FolderContents = array();
502  $Uri2 = Traceback_uri() . "?mod=$this->Name";
503 
504  /* Display all the folders in this folder_pk */
505  $sql = "select * from foldercontents where parent_fk='$folder_pk'";
506  $FCresult = pg_query($PG_CONN, $sql);
507  DBCheckResult($FCresult, $sql, __FILE__, __LINE__);
508 
509  /* Display folder contents */
510  while ($FCrow = pg_fetch_assoc($FCresult)) {
511  switch ($FCrow['foldercontents_mode']) {
512  case 1: /******* child is folder *******/
513  $sql = "select folder_pk, folder_name as name from folder where folder_pk=$FCrow[child_id]";
514  $FolderResult = pg_query($PG_CONN, $sql);
515  DBCheckResult($FolderResult, $sql, __FILE__, __LINE__);
516  $FolderRow = pg_fetch_assoc($FolderResult);
517  pg_free_result($FolderResult);
518 
519  $FolderContents[] = $FolderRow;
520  break;
521  case 2: /******* child is upload *******/
522  $sql = "select upload_pk, upload_filename as name from upload"
523  . " where upload_pk=$FCrow[child_id] and ((upload_mode & (1<<5))!=0)";
524  $UpResult = pg_query($PG_CONN, $sql);
525  DBCheckResult($UpResult, $sql, __FILE__, __LINE__);
526  $NumRows = pg_num_rows($UpResult);
527  if ($NumRows) {
528  $UpRow = pg_fetch_assoc($UpResult);
529  pg_free_result($UpResult);
530  } else {
531  pg_free_result($UpResult);
532  break;
533  }
534 
535  /* get top level uploadtree_pk for this upload_pk */
536  $sql = "select uploadtree_pk from uploadtree where upload_fk=$FCrow[child_id] and parent is null";
537  $UtreeResult = pg_query($PG_CONN, $sql);
538  DBCheckResult($UtreeResult, $sql, __FILE__, __LINE__);
539  $UtreeRow = pg_fetch_assoc($UtreeResult);
540  pg_free_result($UtreeResult);
541  $UpRow['uploadtree_pk'] = $UtreeRow['uploadtree_pk'];
542  $FolderContents[] = $UpRow;
543  break;
544  case 4: /******* child_id is uploadtree_pk (unused) *******/
545  default:
546  }
547  }
548  pg_free_result($FCresult);
549  return $FolderContents;
550  } /* End GetFolderContents */
551 
552 
562  function HTMLout($RtnMod, $uploadtree_pk, $Browseuploadtree_pk, $folder_pk, $PathArray)
563  {
564  $OutBuf = '';
565  $uri = Traceback_uri() . "?mod=$this->Name";
566 
574  $OutBuf .= "<script language='javascript'>\n";
575  $OutBuf .= "function AppJump(val) {";
576  $OutBuf .= "var rtnmodelt = document.getElementById('apick');";
577  $OutBuf .= "var rtnmod = rtnmodelt.value;";
578  $OutBuf .= "var uri = '$uri' + '&rtnmod=' + rtnmod + '&item=' + $uploadtree_pk + '&item2=' + val;";
579  $OutBuf .= "window.location.assign(uri);";
580  $OutBuf .= "}";
581  $OutBuf .= "</script>\n";
582 
583  /* Explain what the picker is for */
584  $OutBuf .= "The purpose of the picker is to permit people to positively pick a pair of paths.";
585  $OutBuf .= "<br>Path pairs are used by reports that do file comparisons and "
586  . "differences between files (like isos, packages, directories, etc.).";
587 
588  $OutBuf .= "<hr>";
589 
590  /* Print file 1 so people know what they are comparing to */
591  $OutBuf .= "<div style=background-color:lavender>";
592  $OutBuf .= "<center><table style='border:5px groove red'>";
593  $OutBuf .= "<tr><td><b>File 1: </b></td><td>&nbsp;&nbsp;</td><td>";
594  $PathStr = $this->Uploadtree2PathStr($PathArray);
595  $OutBuf .= "$PathStr";
596  $OutBuf .= "</td></tr>";
597  $OutBuf .= "</table></center>";
598 
599  $text = _("Choose the program to run after you select the second file.");
600  $OutBuf .= "<b>$text</b><br>";
601  $OutBuf .= $this->ApplicationPick("PickRtnApp", $RtnMod, "will run after chosing a file");
602  $OutBuf .= "</div>";
603  $OutBuf .= "<br>";
604 
605  /* Display the history pick, if there is a history for this user. */
606  $HistPick = $this->HistoryPick($uploadtree_pk, $rtncount);
607  if (! empty($HistPick)) {
608  $text = _("Select from your pick history");
609  $OutBuf .= "<h3>$text ($rtncount):</h3>";
610  $OutBuf .= "$HistPick";
611  }
612 
621  /* Browse window */
622  $text = _("Browse");
623  $OutBuf .= "<hr><h3>$text:</h3>";
624 
625  /* Folder/directory bar */
626  $OutBuf .= $this->BrowsePick($uploadtree_pk, $Browseuploadtree_pk, $folder_pk, $PathArray);
627 
628  return $OutBuf;
629  }
630 
631 
635  function Output()
636  {
637  global $PG_CONN;
638  if ($this->State != PLUGIN_STATE_READY) {
639  return(0);
640  }
641 
646  $this->Create_file_picker();
647 
648  $RtnMod = GetParm("rtnmod",PARM_TEXT);
649  $uploadtree_pk = GetParm("item", PARM_INTEGER);
650  if (! $uploadtree_pk) {
651  return "<h2>Unidentified item 1</h2>";
652  }
653  $uploadtree_pk2 = GetParm("item2",PARM_INTEGER);
654  $folder_pk = GetParm("folder",PARM_INTEGER);
655  $user_pk = Auth::getUserId();
656 
657  /* Item to start Browse window on */
658  $Browseuploadtree_pk = GetParm("bitem",PARM_INTEGER);
659 
660  /* Check item1 and item2 upload permissions */
661  $Item1Row = GetSingleRec("uploadtree", "WHERE uploadtree_pk = $uploadtree_pk");
662  if (! $this->uploadDao->isAccessible($Item1Row['upload_fk'],
663  Auth::getGroupId())) {
664  $text = _("Permission Denied");
665  return "<h2>$text item 1</h2>";
666  }
667 
668  if (! empty($uploadtree_pk2)) {
669  $Item2Row = GetSingleRec("uploadtree", "WHERE uploadtree_pk = $uploadtree_pk2");
670  if (! $this->uploadDao->isAccessible($Item2Row['upload_fk'], Auth::getGroupId())) {
671  $text = _("Permission Denied");
672  return "<h2>$text item 2</h2>";
673  }
674  }
675 
681  if (!empty($user_pk) && !empty($RtnMod) && !empty($uploadtree_pk) && !empty($uploadtree_pk2)) {
682  $sql = "insert into file_picker (user_fk, uploadtree_fk1, uploadtree_fk2, last_access_date)
683  values($user_pk, $uploadtree_pk, $uploadtree_pk2, now())";
684  // ignore errors (most probably a duplicate key)
685  @$result = pg_query($PG_CONN, $sql);
686 
687  // Redirect to diff module
688  $uri = Traceback_uri() . "?mod=$RtnMod&item1=$uploadtree_pk&item2=$uploadtree_pk2";
689  echo "<script type='text/javascript'> window.location.assign('$uri');</script>";
690  exit();
691  }
692 
693  $OutBuf = "";
694 
695  if ($this->OutputType == 'HTML') {
696  if (empty($uploadtree_pk)) {
697  $OutBuf = "<h2>Picker URL is missing the first comparison file.</h2>";
698  } else {
699  $PathArray = Dir2Path($uploadtree_pk, 'uploadtree');
700  $OutBuf .= $this->HTMLout($RtnMod, $uploadtree_pk, $Browseuploadtree_pk, $folder_pk, $PathArray);
701  }
702  }
703 
704  return $OutBuf;
705  }
706 
715  private function Uploadtree2PathStr ($PathArray)
716  {
717  $Path = "";
718  if (count($PathArray)) {
719  foreach ($PathArray as $PathRow) {
720  $Path .= "/" . $PathRow['ufile_name'];
721  }
722  }
723  return $Path;
724  }
725 
739  protected function ApplicationPick($SLName, $SelectedVal, $label)
740  {
741  /* select the apps that are registered to accept item1, item2 pairs.
742  * At this time (pre 2.x) we don't know enough about the plugins
743  * to know if they can take a pair. Till then, the list is
744  * hardcoded.
745  */
746  $AppList = array("nomosdiff" => "License Difference",
747  "bucketsdiff" => "Bucket Difference");
748  $Options = "id=apick";
749  $SelectList = Array2SingleSelect($AppList, $SLName, $SelectedVal,
750  false, true, $Options);
751  $StrOut = "$SelectList $label";
752  return $StrOut;
753  }
754 }
755 
756 $NewPlugin = new ui_picker;
757 $NewPlugin->Initialize();
Traceback_uri()
Get the URI without query to this location.
const PARM_TEXT
Definition: common-parm.php:31
picker_ufile_name_cmp($rowa, $rowb)
Sort filenames.
Definition: ui-picker.php:41
Dir2Path($uploadtree_pk, $uploadtree_tablename='uploadtree')
Return the path (without artifacts) of an uploadtree_pk.
Definition: common-dir.php:233
Iscontainer($mode)
Definition: common-dir.php:49
GetSingleRec($Table, $Where="")
Retrieve a single database record.
Definition: common-db.php:102
Initialize()
This is called before the plugin is used.
Definition: ui-picker.php:101
Create_file_picker()
Create file_picker table.
Definition: ui-picker.php:119
Uploadtree2PathStr($PathArray)
Get string representation of uploadtree path. Use Dir2Path to get $PathArray.
Definition: ui-picker.php:715
SuggestionsPick($FileName, $uploadtree_pk, &$rtncount)
Search the whole repository for containers with names similar to $FileName (based on the beggining te...
Definition: ui-picker.php:380
Folder2Path($folder_pk)
Return an array of folder_pk, folder_name from the users.root_folder_fk to $folder_pk.
#define PLUGIN_DB_READ
Plugin requires read permission on DB.
Definition: libfossology.h:49
ApplicationPick($SLName, $SelectedVal, $label)
Generate html to pick the application that will be called after the items are identified.
Definition: ui-picker.php:739
picker_name_cmp($rowa, $rowb)
Sort folder and upload names.
Definition: ui-picker.php:32
Definition: state.hpp:26
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
Definition: common-parm.php:57
BrowsePick($uploadtree_pk, $inBrowseuploadtree_pk, $infolder_pk, $PathArray)
file browser
Definition: ui-picker.php:432
HTMLout($RtnMod, $uploadtree_pk, $Browseuploadtree_pk, $folder_pk, $PathArray)
the html format out info
Definition: ui-picker.php:562
GetFileExt($fname)
Get File Extension (text after last period)
Definition: common-ui.php:127
const PARM_INTEGER
Definition: common-parm.php:25
HTMLFileList($File1uploadtree_pk, $Children, $FolderContents)
Given an $File1uploadtree_pk, $Children are non artifact children of $File1uploadtree_pk.
Definition: ui-picker.php:157
Isdir($mode)
Definition: common-dir.php:31
This is the Plugin class. All plugins should:
Definition: FO_Plugin.php:67
HistoryPick($uploadtree_pk, &$rtncount)
pick history
Definition: ui-picker.php:327
GetFolderFromItem($upload_pk="", $uploadtree_pk="")
Find what folder an item is in.
menu_insert($Path, $LastOrder=0, $URI=NULL, $Title=NULL, $Target=NULL, $HTML=NULL)
Given a Path, order level for the last item, and optional plugin name, insert the menu item...
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN
RegisterMenus()
Customize submenus.
Definition: ui-picker.php:84
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
Definition: common-db.php:198
Install()
Create and configure database tables.
Definition: ui-picker.php:68
Array2SingleSelect($KeyValArray, $SLName="unnamed", $SelectedVal="", $FirstEmpty=false, $SelElt=true, $Options="", $ReturnKey=true)
Build a single choice select pulldown.
Definition: common-ui.php:41
Output()
The Picker page.
Definition: ui-picker.php:635