FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ui-picker.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2010-2013 Hewlett-Packard Development Company, L.P.
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
10 
21 function picker_name_cmp($rowa, $rowb)
22 {
23  return (strnatcasecmp($rowa['name'], $rowb['name']));
24 }
25 
26 
30 function picker_ufile_name_cmp($rowa, $rowb)
31 {
32  return (strnatcasecmp($rowa['ufile_name'], $rowb['ufile_name']));
33 }
34 
35 
36 class ui_picker extends FO_Plugin
37 {
38  var $HighlightColor = '#4bfe78';
40  private $uploadDao;
41 
42  function __construct()
43  {
44  $this->Name = "picker";
45  $this->Title = _("File Picker");
46  $this->Dependency = array("browse","view");
47  $this->DBaccess = PLUGIN_DB_READ;
48  $this->LoginFlag = 0;
49  parent::__construct();
50  $this->uploadDao = $GLOBALS['container']->get('dao.upload');
51  }
52 
53 
57  function Install()
58  {
59  global $PG_CONN;
60  if (empty($PG_CONN)) {
61  return(1);
62  } /* No DB */
63 
64  /* create it if it doesn't exist */
65  $this->Create_file_picker();
66 
67  return(0);
68  } // Install()
69 
73  function RegisterMenus()
74  {
75  $text = _("Compare this file to another.");
76  menu_insert("Browse-Pfile::Compare",0,$this->Name,$text);
77 
78  return 0;
79  } // RegisterMenus()
80 
81 
90  function Initialize()
91  {
92  if ($this->State != PLUGIN_STATE_INVALID) {
93  return (1);
94  } // don't re-run
95  if ($this->Name !== "") {
96  // Name must be defined
97  global $Plugins;
98  $this->State = PLUGIN_STATE_VALID;
99  $Plugins[] = $this;
100  }
101  return($this->State == PLUGIN_STATE_VALID);
102  } // Initialize()
103 
104 
109  {
110  global $PG_CONN;
111 
112  /* If table exists, then we are done */
113  $sql = "SELECT typlen FROM pg_type where typname='file_picker' limit 1";
114  $result = pg_query($PG_CONN, $sql);
115  DBCheckResult($result, $sql, __FILE__, __LINE__);
116  if (pg_num_rows($result) > 0) {
117  pg_free_result($result);
118  return 0;
119  }
120  pg_free_result($result);
121 
122  /* Create table */
123  $sql = "CREATE TABLE file_picker (
124  file_picker_pk serial NOT NULL PRIMARY KEY,
125  user_fk integer NOT NULL,
126  uploadtree_fk1 integer NOT NULL,
127  uploadtree_fk2 integer NOT NULL,
128  last_access_date date NOT NULL
129  );
130  ALTER TABLE ONLY file_picker
131  ADD CONSTRAINT file_picker_user_fk_key UNIQUE (user_fk, uploadtree_fk1, uploadtree_fk2);";
132 
133  $result = pg_query($PG_CONN, $sql);
134  DBCheckResult($result, $sql, __FILE__, __LINE__);
135  pg_free_result($result);
136  }
137 
138 
146  function HTMLFileList($File1uploadtree_pk, $Children, $FolderContents)
147  {
148  global $PG_CONN;
149  global $Plugins;
150 
151  $OutBuf=""; // return values for file listing
152  $Uri = Traceback_uri() . "?mod=$this->Name";
153 
154  $OutBuf .= "<table style='text-align:left;' >";
155 
156  if (!empty($FolderContents)) {
157  usort($FolderContents, 'picker_name_cmp');
158 
159  /* write subfolders */
160  foreach ($FolderContents as $Folder) {
161  if ($Folder && array_key_exists('folder_pk', $Folder)) {
162  $folder_pk = $Folder['folder_pk'];
163  $folder_name = htmlentities($Folder['name']);
164  $OutBuf .= "<tr>";
165 
166  $OutBuf .= "<td></td>";
167 
168  $OutBuf .= "<td>";
169  $OutBuf .= "<a href='$Uri&folder=$folder_pk&item=$File1uploadtree_pk'><b>$folder_name</b></a>/";
170  $OutBuf .= "</td></tr>";
171  } else if ($Folder && array_key_exists('uploadtree_pk', $Folder)) {
172  $bitem = $Folder['uploadtree_pk'];
173  $upload_filename = htmlentities($Folder['name']);
174  $OutBuf .= "<tr>";
175  $OutBuf .= "<td>";
176  $text = _("Select");
177  $Options = "id=filepick2 onclick='AppJump($bitem)')";
178  $OutBuf .= "<button type='button' $Options> $text </button>\n";
179  $OutBuf .= "</td>";
180 
181  $OutBuf .= "<td>";
182  $OutBuf .= "<a href='$Uri&bitem=$bitem&item=$File1uploadtree_pk'><b>$upload_filename</b></a>/";
183  $OutBuf .= "</td></tr>";
184  }
185  }
186  } else {
187  if (empty($Children)) {
188  $text = _("No children to compare");
189  $OutBuf .= "<tr><td colspan=2>$text</td></tr>";
190  } else {
191  usort($Children, 'picker_ufile_name_cmp');
192  foreach ($Children as $Child) {
193  if (empty($Child)) {
194  continue;
195  }
196  $OutBuf .= "<tr>";
197 
198  $IsDir = Isdir($Child['ufile_mode']);
199  $IsContainer = Iscontainer($Child['ufile_mode']);
200 
201  $LinkUri = $Uri . "&bitem=$Child[uploadtree_pk]&item=$File1uploadtree_pk";
202 
203  $OutBuf .= "<td>";
204  $text = _("Select");
205  $Options = "id=filepick onclick='AppJump($Child[uploadtree_pk])')";
206  $OutBuf .= "<button type='button' $Options> $text </button>\n";
207  $OutBuf .= "</td>";
208  $OutBuf .= "<td>";
209  if ($IsContainer) {
210  $OutBuf .= "<a href='$LinkUri'> $Child[ufile_name]</a>";
211  } else {
212  $OutBuf .= $Child['ufile_name'];
213  }
214  if ($IsDir) {
215  $OutBuf .= "/";
216  }
217  $OutBuf .= "</td>";
218  $OutBuf .= "</tr>";
219  }
220  }
221  }
222  $OutBuf .= "</table>";
223  return($OutBuf);
224  } // HTMLFileList()
225 
226 
258  function HTMLPath($File1uploadtree_pk, $FolderList, $DirectoryList)
259  {
260  if (empty($FolderList)) {
261  return "__FILE__ __LINE__ No folder list specified";
262  }
263 
264  $OutBuf = "";
265  $Uri2 = Traceback_uri() . "?mod=$this->Name";
266 
267  /* Box decorations */
268  $OutBuf .= "<div class='alert alert-info' style='padding:5px;'>\n";
269 
270  /* write the FolderList */
271  $text = _("Folder");
272  $OutBuf .= "<b>$text</b>: ";
273 
274  foreach ($FolderList as $Folder) {
275  $folder_pk = $Folder['folder_pk'];
276  $folder_name = htmlentities($Folder['folder_name']);
277  $OutBuf .= "<a href='$Uri2&folder=$folder_pk&item=$File1uploadtree_pk'><b>$folder_name</b></a>/";
278  }
279 
280  /* write the DirectoryList */
281  if (! empty($DirectoryList)) {
282  $OutBuf .= "<br>";
283  $First = true; /* If $First is true, directory path starts a new line */
284 
285  /* Show the path within the upload */
286  foreach ($DirectoryList as $uploadtree_rec) {
287  if (! $First) {
288  $OutBuf .= "/ ";
289  }
290 
291  $href = "$Uri2&bitem=$uploadtree_rec[uploadtree_pk]&item=$File1uploadtree_pk";
292  $OutBuf .= "<a href='$href'>";
293 
294  if (!$First && Iscontainer($uploadtree_rec['ufile_mode'])) {
295  $OutBuf .= "<br>&nbsp;&nbsp;";
296  }
297 
298  $OutBuf .= "<b>" . $uploadtree_rec['ufile_name'] . "</b>";
299  $OutBuf .= "</a>";
300  $First = false;
301  }
302  }
303 
304  $OutBuf .= "</div>\n"; // box
305  return($OutBuf);
306  } // HTMLPath()
307 
308 
316  function HistoryPick($uploadtree_pk, &$rtncount)
317  {
318  global $PG_CONN;
319 
320  $PickerRows = array();
321 
322  /* select possible item2's from pick history for this user */
323  $user_pk = $_SESSION['UserId'];
324  if (empty($user_pk)) {
325  return $PickerRows;
326  }
327 
328  $sql = "select file_picker_pk, uploadtree_fk1, uploadtree_fk2 from file_picker
329  where user_fk= '$user_pk' and ($uploadtree_pk=uploadtree_fk1 or $uploadtree_pk=uploadtree_fk2)";
330  $result = pg_query($PG_CONN, $sql);
331  DBCheckResult($result, $sql, __FILE__, __LINE__);
332  $rtncount = pg_num_rows($result);
333  if ($rtncount > 0) {
334  $PickerRows = pg_fetch_all($result);
335  pg_free_result($result);
336  } else {
337  /* No rows in history for this item and user */
338  pg_free_result($result);
339  return "";
340  }
341 
342  /* reformat $PickHistRecs for select list */
343  $PickSelectArray = array();
344  foreach ($PickerRows as $PickRec) {
345  if ($PickRec['uploadtree_fk1'] == $uploadtree_pk) {
346  $item2 = $PickRec["uploadtree_fk2"];
347  } else {
348  $item2 = $PickRec["uploadtree_fk1"];
349  }
350  $PathArray = Dir2Path($item2, 'uploadtree');
351  $Path = $this->Uploadtree2PathStr($PathArray);
352  $PickSelectArray[$item2] = $Path;
353  }
354  $Options = "id=HistoryPick onchange='AppJump(this.value)')";
355  $SelectList = Array2SingleSelect($PickSelectArray, "HistoryPick", "", true,
356  true, $Options);
357  return $SelectList;
358  } /* End HistoryPick() */
359 
360 
369  function SuggestionsPick($FileName, $uploadtree_pk, &$rtncount)
370  {
371  global $PG_CONN;
372 
373  /* find the root of $FileName. Thats the beginning alpha part. */
374  $BaseFN = basename($FileName);
375  $delims= "/-.0123456789 \t\n\r\0\0xb";
376  $NameRoot = ltrim($BaseFN, $delims);
377  $NameRoot = strtok($NameRoot, $delims);
378 
379  /* Only make suggestions with matching file extensions */
380  $ext = GetFileExt($FileName);
381  $tail = ".$ext";
382 
383  if (empty($NameRoot)) {
384  return "";
385  }
386 
387  /* find non artifact containers with names similar to $FileName */
388  $sql = "select uploadtree_pk from uploadtree
389  where ((ufile_mode & (1<<29))!=0) AND ((ufile_mode & (1<<28))=0)
390  and (ufile_name like '$NameRoot%$tail')
391  and (uploadtree_pk != '$uploadtree_pk') limit 100";
392  $result = pg_query($PG_CONN, $sql);
393  DBCheckResult($result, $sql, __FILE__, __LINE__);
394  $SuggestionsArray = array();
395  while ($row = pg_fetch_assoc($result)) {
396  $PathArray = Dir2Path($row['uploadtree_pk'], 'uploadtree');
397  $SuggestionsArray[$row['uploadtree_pk']] = $this->Uploadtree2PathStr($PathArray);
398  }
399  pg_free_result($result);
400 
401  $rtncount = count($SuggestionsArray);
402  if ($rtncount == 0) {
403  return "";
404  }
405 
406  /* Order the select list by the beginning of the path */
407  natsort($SuggestionsArray);
408 
409  $Options = "id=SuggestPick onchange='AppJump(this.value)')";
410  $SelectList = Array2SingleSelect($SuggestionsArray, "SuggestionsPick", "",
411  true, true, $Options);
412  return $SelectList;
413  } /* End SuggestionsPick */
414 
415 
421  function BrowsePick($uploadtree_pk, $inBrowseuploadtree_pk, $infolder_pk, $PathArray)
422  {
423  $OutBuf = "";
424  if (empty($inBrowseuploadtree_pk)) {
425  $Browseuploadtree_pk = $uploadtree_pk;
426  } else {
427  $Browseuploadtree_pk = $inBrowseuploadtree_pk;
428  }
429 
430  if (empty($infolder_pk)) {
431  $folder_pk = GetFolderFromItem("", $Browseuploadtree_pk);
432  } else {
433  $folder_pk = $infolder_pk;
434  }
435 
436  // Get list of folders that this $Browseuploadtree_pk is in
437  $FolderList = Folder2Path($folder_pk);
438 
439  // If you aren't browsing folders,
440  // Get list of directories that this $Browseuploadtree_pk is in
441  if (empty($infolder_pk)) {
442  $DirectoryList = Dir2Path($Browseuploadtree_pk, 'uploadtree');
443  } else {
444  $DirectoryList = '';
445  }
446 
447  // Get HTML for folder/directory list.
448  // This is the stuff in the yellow bar.
449  $OutBuf .= $this->HTMLPath($uploadtree_pk, $FolderList, $DirectoryList);
450 
451  /*
452  * Get list of folders in this folder
453  * That is, $DirectoryList is empty
454  */
455  if (empty($infolder_pk)) {
456  $FolderContents = array();
457  $Children = GetNonArtifactChildren($Browseuploadtree_pk);
458  } else {
459  $Children = array();
460  $FolderContents = $this->GetFolderContents($folder_pk);
461  }
462  $OutBuf .= $this->HTMLFileList($uploadtree_pk, $Children, $FolderContents);
463 
464  return $OutBuf;
465  } /* End BrowsePick */
466 
467 
486  function GetFolderContents($folder_pk)
487  {
488  global $PG_CONN;
489 
490  $FolderContents = array();
491  $Uri2 = Traceback_uri() . "?mod=$this->Name";
492 
493  /* Display all the folders in this folder_pk */
494  $sql = "select * from foldercontents where parent_fk='$folder_pk'";
495  $FCresult = pg_query($PG_CONN, $sql);
496  DBCheckResult($FCresult, $sql, __FILE__, __LINE__);
497 
498  /* Display folder contents */
499  while ($FCrow = pg_fetch_assoc($FCresult)) {
500  switch ($FCrow['foldercontents_mode']) {
501  case 1: /******* child is folder *******/
502  $sql = "select folder_pk, folder_name as name from folder where folder_pk=$FCrow[child_id]";
503  $FolderResult = pg_query($PG_CONN, $sql);
504  DBCheckResult($FolderResult, $sql, __FILE__, __LINE__);
505  $FolderRow = pg_fetch_assoc($FolderResult);
506  pg_free_result($FolderResult);
507 
508  $FolderContents[] = $FolderRow;
509  break;
510  case 2: /******* child is upload *******/
511  $sql = "select upload_pk, upload_filename as name from upload"
512  . " where upload_pk=$FCrow[child_id] and ((upload_mode & (1<<5))!=0)";
513  $UpResult = pg_query($PG_CONN, $sql);
514  DBCheckResult($UpResult, $sql, __FILE__, __LINE__);
515  $NumRows = pg_num_rows($UpResult);
516  if ($NumRows) {
517  $UpRow = pg_fetch_assoc($UpResult);
518  pg_free_result($UpResult);
519  } else {
520  pg_free_result($UpResult);
521  break;
522  }
523 
524  /* get top level uploadtree_pk for this upload_pk */
525  $sql = "select uploadtree_pk from uploadtree where upload_fk=$FCrow[child_id] and parent is null";
526  $UtreeResult = pg_query($PG_CONN, $sql);
527  DBCheckResult($UtreeResult, $sql, __FILE__, __LINE__);
528  $UtreeRow = pg_fetch_assoc($UtreeResult);
529  pg_free_result($UtreeResult);
530  $UpRow['uploadtree_pk'] = $UtreeRow['uploadtree_pk'];
531  $FolderContents[] = $UpRow;
532  break;
533  case 4: /******* child_id is uploadtree_pk (unused) *******/
534  default:
535  }
536  }
537  pg_free_result($FCresult);
538  return $FolderContents;
539  } /* End GetFolderContents */
540 
541 
551  function HTMLout($RtnMod, $uploadtree_pk, $Browseuploadtree_pk, $folder_pk, $PathArray)
552  {
553  $OutBuf = '';
554  $uri = Traceback_uri() . "?mod=$this->Name";
555 
563  $OutBuf .= "<script language='javascript'>\n";
564  $OutBuf .= "function AppJump(val) {";
565  $OutBuf .= "var rtnmodelt = document.getElementById('apick');";
566  $OutBuf .= "var rtnmod = rtnmodelt.value;";
567  $OutBuf .= "var uri = '$uri' + '&rtnmod=' + rtnmod + '&item=' + $uploadtree_pk + '&item2=' + val;";
568  $OutBuf .= "window.location.assign(uri);";
569  $OutBuf .= "}";
570  $OutBuf .= "</script>\n";
571 
572  /* Explain what the picker is for */
573  $OutBuf .= "The purpose of the picker is to permit people to positively pick a pair of paths.";
574  $OutBuf .= "<br>Path pairs are used by reports that do file comparisons and "
575  . "differences between files (like isos, packages, directories, etc.).";
576 
577  $OutBuf .= "<hr>";
578 
579  /* Print file 1 so people know what they are comparing to */
580  $OutBuf .= "<div style=background-color:lavender>";
581  $OutBuf .= "<center><table style='border:5px groove red'>";
582  $OutBuf .= "<tr><td><b>File 1: </b></td><td>&nbsp;&nbsp;</td><td>";
583  $PathStr = $this->Uploadtree2PathStr($PathArray);
584  $OutBuf .= "$PathStr";
585  $OutBuf .= "</td></tr>";
586  $OutBuf .= "</table></center>";
587 
588  $text = _("Choose the program to run after you select the second file.");
589  $OutBuf .= "<b>$text</b><br>";
590  $OutBuf .= $this->ApplicationPick("PickRtnApp", $RtnMod, "will run after chosing a file");
591  $OutBuf .= "</div>";
592  $OutBuf .= "<br>";
593 
594  /* Display the history pick, if there is a history for this user. */
595  $HistPick = $this->HistoryPick($uploadtree_pk, $rtncount);
596  if (! empty($HistPick)) {
597  $text = _("Select from your pick history");
598  $OutBuf .= "<h3>$text ($rtncount):</h3>";
599  $OutBuf .= "$HistPick";
600  }
601 
610  /* Browse window */
611  $text = _("Browse");
612  $OutBuf .= "<hr><h3>$text:</h3>";
613 
614  /* Folder/directory bar */
615  $OutBuf .= $this->BrowsePick($uploadtree_pk, $Browseuploadtree_pk, $folder_pk, $PathArray);
616 
617  return $OutBuf;
618  }
619 
620 
624  function Output()
625  {
626  global $PG_CONN;
627  if ($this->State != PLUGIN_STATE_READY) {
628  return(0);
629  }
630 
635  $this->Create_file_picker();
636 
637  $RtnMod = GetParm("rtnmod",PARM_TEXT);
638  $uploadtree_pk = GetParm("item", PARM_INTEGER);
639  if (! $uploadtree_pk) {
640  return "<h2>Unidentified item 1</h2>";
641  }
642  $uploadtree_pk2 = GetParm("item2",PARM_INTEGER);
643  $folder_pk = GetParm("folder",PARM_INTEGER);
644  $user_pk = Auth::getUserId();
645 
646  /* Item to start Browse window on */
647  $Browseuploadtree_pk = GetParm("bitem",PARM_INTEGER);
648 
649  /* Check item1 and item2 upload permissions */
650  $Item1Row = GetSingleRec("uploadtree", "WHERE uploadtree_pk = $uploadtree_pk");
651  if (! $this->uploadDao->isAccessible($Item1Row['upload_fk'],
652  Auth::getGroupId())) {
653  $text = _("Permission Denied");
654  return "<h2>$text item 1</h2>";
655  }
656 
657  if (! empty($uploadtree_pk2)) {
658  $Item2Row = GetSingleRec("uploadtree", "WHERE uploadtree_pk = $uploadtree_pk2");
659  if (! $this->uploadDao->isAccessible($Item2Row['upload_fk'], Auth::getGroupId())) {
660  $text = _("Permission Denied");
661  return "<h2>$text item 2</h2>";
662  }
663  }
664 
670  if (!empty($user_pk) && !empty($RtnMod) && !empty($uploadtree_pk) && !empty($uploadtree_pk2)) {
671  $sql = "insert into file_picker (user_fk, uploadtree_fk1, uploadtree_fk2, last_access_date)
672  values($user_pk, $uploadtree_pk, $uploadtree_pk2, now())";
673  // ignore errors (most probably a duplicate key)
674  @$result = pg_query($PG_CONN, $sql);
675 
676  // Redirect to diff module
677  $uri = Traceback_uri() . "?mod=$RtnMod&item1=$uploadtree_pk&item2=$uploadtree_pk2";
678  echo "<script type='text/javascript'> window.location.assign('$uri');</script>";
679  exit();
680  }
681 
682  $OutBuf = "";
683 
684  if ($this->OutputType == 'HTML') {
685  if (empty($uploadtree_pk)) {
686  $OutBuf = "<h2>Picker URL is missing the first comparison file.</h2>";
687  } else {
688  $PathArray = Dir2Path($uploadtree_pk, 'uploadtree');
689  $OutBuf .= $this->HTMLout($RtnMod, $uploadtree_pk, $Browseuploadtree_pk, $folder_pk, $PathArray);
690  }
691  }
692 
693  return $OutBuf;
694  }
695 
704  private function Uploadtree2PathStr ($PathArray)
705  {
706  $Path = "";
707  if (count($PathArray)) {
708  foreach ($PathArray as $PathRow) {
709  $Path .= "/" . $PathRow['ufile_name'];
710  }
711  }
712  return $Path;
713  }
714 
728  protected function ApplicationPick($SLName, $SelectedVal, $label)
729  {
730  /* select the apps that are registered to accept item1, item2 pairs.
731  * At this time (pre 2.x) we don't know enough about the plugins
732  * to know if they can take a pair. Till then, the list is
733  * hardcoded.
734  */
735  $AppList = array("nomosdiff" => "License Difference",
736  "bucketsdiff" => "Bucket Difference");
737  $Options = "id=apick";
738  $SelectList = Array2SingleSelect($AppList, $SLName, $SelectedVal,
739  false, true, $Options);
740  $StrOut = "$SelectList $label";
741  return $StrOut;
742  }
743 }
744 
745 $NewPlugin = new ui_picker;
746 $NewPlugin->Initialize();
This is the Plugin class. All plugins should:
Definition: FO_Plugin.php:57
Contains the constants and helpers for authentication of user.
Definition: Auth.php:24
Definition: state.hpp:16
ApplicationPick($SLName, $SelectedVal, $label)
Generate html to pick the application that will be called after the items are identified.
Definition: ui-picker.php:728
Install()
Create and configure database tables.
Definition: ui-picker.php:57
__construct()
base constructor. Most plugins will just use this
Definition: ui-picker.php:42
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:369
Output()
The Picker page.
Definition: ui-picker.php:624
HTMLout($RtnMod, $uploadtree_pk, $Browseuploadtree_pk, $folder_pk, $PathArray)
the html format out info
Definition: ui-picker.php:551
Uploadtree2PathStr($PathArray)
Get string representation of uploadtree path. Use Dir2Path to get $PathArray.
Definition: ui-picker.php:704
RegisterMenus()
Customize submenus.
Definition: ui-picker.php:73
HTMLFileList($File1uploadtree_pk, $Children, $FolderContents)
Given an $File1uploadtree_pk, $Children are non artifact children of $File1uploadtree_pk.
Definition: ui-picker.php:146
HistoryPick($uploadtree_pk, &$rtncount)
pick history
Definition: ui-picker.php:316
BrowsePick($uploadtree_pk, $inBrowseuploadtree_pk, $infolder_pk, $PathArray)
file browser
Definition: ui-picker.php:421
Initialize()
This is called before the plugin is used.
Definition: ui-picker.php:90
Create_file_picker()
Create file_picker table.
Definition: ui-picker.php:108
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
Definition: common-db.php:187
GetSingleRec($Table, $Where="")
Retrieve a single database record.
Definition: common-db.php:91
Isdir($mode)
Definition: common-dir.php:20
Iscontainer($mode)
Definition: common-dir.php:38
Dir2Path($uploadtree_pk, $uploadtree_tablename='uploadtree')
Return the path (without artifacts) of an uploadtree_pk.
Definition: common-dir.php:222
GetFolderFromItem($upload_pk="", $uploadtree_pk="")
Find what folder an item is in.
Folder2Path($folder_pk)
Return an array of folder_pk, folder_name from the users.root_folder_fk to $folder_pk.
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.
Traceback_uri()
Get the URI without query to this location.
Definition: common-parm.php:97
const PARM_TEXT
Definition: common-parm.php:20
const PARM_INTEGER
Definition: common-parm.php:14
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
Definition: common-parm.php:46
Array2SingleSelect($KeyValArray, $SLName="unnamed", $SelectedVal="", $FirstEmpty=false, $SelElt=true, $Options="", $ReturnKey=true)
Build a single choice select pulldown.
Definition: common-ui.php:32
GetFileExt($fname)
Get File Extension (text after last period)
Definition: common-ui.php:142
#define PLUGIN_DB_READ
Plugin requires read permission on DB.
Definition: libfossology.h:37
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN
picker_ufile_name_cmp($rowa, $rowb)
Sort filenames.
Definition: ui-picker.php:30
picker_name_cmp($rowa, $rowb)
Sort folder and upload names.
Definition: ui-picker.php:21