Commit 8ce653527f572910e3599c8bfcc0e6259a015231
1 parent
ade872da
KTS-1687
"Double quote to single quote conversion" Fixed. Reviewed by: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6242 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
48 additions
and
48 deletions
lib/browse/BrowseColumns.inc.php
| @@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
| 36 | * renderData returns the _content_ of the body row. | 36 | * renderData returns the _content_ of the body row. |
| 37 | */ | 37 | */ |
| 38 | 38 | ||
| 39 | -require_once(KT_LIB_DIR . "/database/dbutil.inc"); | 39 | +require_once(KT_LIB_DIR . '/database/dbutil.inc'); |
| 40 | require_once(KT_LIB_DIR . '/users/User.inc'); | 40 | require_once(KT_LIB_DIR . '/users/User.inc'); |
| 41 | 41 | ||
| 42 | require_once(KT_LIB_DIR . '/workflow/workflowutil.inc.php'); | 42 | require_once(KT_LIB_DIR . '/workflow/workflowutil.inc.php'); |
| @@ -46,8 +46,8 @@ require_once(KT_LIB_DIR . '/browse/browseutil.inc.php'); | @@ -46,8 +46,8 @@ require_once(KT_LIB_DIR . '/browse/browseutil.inc.php'); | ||
| 46 | class BrowseColumn { | 46 | class BrowseColumn { |
| 47 | var $label = null; | 47 | var $label = null; |
| 48 | var $sort_on = false; | 48 | var $sort_on = false; |
| 49 | - var $sort_direction = "asc"; | ||
| 50 | - var $name = "-"; | 49 | + var $sort_direction = 'asc'; |
| 50 | + var $name = '-'; | ||
| 51 | 51 | ||
| 52 | function BrowseColumn($sLabel, $sName) { | 52 | function BrowseColumn($sLabel, $sName) { |
| 53 | $this->label = $sLabel; | 53 | $this->label = $sLabel; |
| @@ -55,22 +55,22 @@ class BrowseColumn { | @@ -55,22 +55,22 @@ class BrowseColumn { | ||
| 55 | } | 55 | } |
| 56 | // FIXME is it _really_ worth using a template here? | 56 | // FIXME is it _really_ worth using a template here? |
| 57 | function renderHeader($sReturnURL) { | 57 | function renderHeader($sReturnURL) { |
| 58 | - $text = _kt("Abstract") . ": " . $this->label; | ||
| 59 | - $href = $sReturnURL . "&sort_on=" . $this->name . "&sort_order="; | 58 | + $text = _kt('Abstract') . ': ' . $this->label; |
| 59 | + $href = $sReturnURL . '&sort_on=' . $this->name . '&sort_order='; | ||
| 60 | if ($this->sort_on) { | 60 | if ($this->sort_on) { |
| 61 | - $href .= $this->sort_direction == "asc" ? "desc" : "asc" ; | 61 | + $href .= $this->sort_direction == 'asc' ? 'desc' : 'asc' ; |
| 62 | } else { | 62 | } else { |
| 63 | - $href .= $this->sort_direction = "asc"; | 63 | + $href .= $this->sort_direction = 'asc'; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | return '<a href="' . $href . '">'.$text.'</a>'; | 66 | return '<a href="' . $href . '">'.$text.'</a>'; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | function renderData($aDataRow) { | 69 | function renderData($aDataRow) { |
| 70 | - if ($aDataRow["type"] == "folder") { | ||
| 71 | - return $this->name . ": ". print_r($aDataRow["folder"]->getName(), true); | 70 | + if ($aDataRow['type'] == 'folder') { |
| 71 | + return $this->name . ': '. print_r($aDataRow['folder']->getName(), true); | ||
| 72 | } else { | 72 | } else { |
| 73 | - return $this->name . ": ". print_r($aDataRow["document"]->getName(), true); | 73 | + return $this->name . ': '. print_r($aDataRow['document']->getName(), true); |
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| 76 | function setSortedOn($bIsSortedOn) { $this->sort_on = $bIsSortedOn; } | 76 | function setSortedOn($bIsSortedOn) { $this->sort_on = $bIsSortedOn; } |
| @@ -91,12 +91,12 @@ class TitleColumn extends BrowseColumn { | @@ -91,12 +91,12 @@ class TitleColumn extends BrowseColumn { | ||
| 91 | } | 91 | } |
| 92 | // unlike others, this DOESN'T give its name. | 92 | // unlike others, this DOESN'T give its name. |
| 93 | function renderHeader($sReturnURL) { | 93 | function renderHeader($sReturnURL) { |
| 94 | - $text = _kt("Title"); | ||
| 95 | - $href = $sReturnURL . "&sort_on=" . $this->name . "&sort_order="; | 94 | + $text = _kt('Title'); |
| 95 | + $href = $sReturnURL . '&sort_on=' . $this->name . '&sort_order='; | ||
| 96 | if ($this->sort_on) { | 96 | if ($this->sort_on) { |
| 97 | - $href .= $this->sort_direction == "asc" ? "desc" : "asc" ; | 97 | + $href .= $this->sort_direction == 'asc' ? 'desc' : 'asc' ; |
| 98 | } else { | 98 | } else { |
| 99 | - $href .= $this->sort_direction = "asc"; | 99 | + $href .= $this->sort_direction = 'asc'; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | return '<a href="' . $href . '">'.$text.'</a>'; | 102 | return '<a href="' . $href . '">'.$text.'</a>'; |
| @@ -105,25 +105,25 @@ class TitleColumn extends BrowseColumn { | @@ -105,25 +105,25 @@ class TitleColumn extends BrowseColumn { | ||
| 105 | 105 | ||
| 106 | function renderFolderLink($aDataRow) { | 106 | function renderFolderLink($aDataRow) { |
| 107 | $outStr = '<a href="' . $this->buildFolderLink($aDataRow) . '">'; | 107 | $outStr = '<a href="' . $this->buildFolderLink($aDataRow) . '">'; |
| 108 | - $outStr .= htmlentities($aDataRow["folder"]->getName(), ENT_NOQUOTES, 'UTF-8'); | 108 | + $outStr .= htmlentities($aDataRow['folder']->getName(), ENT_NOQUOTES, 'UTF-8'); |
| 109 | $outStr .= '</a> '; | 109 | $outStr .= '</a> '; |
| 110 | return $outStr; | 110 | return $outStr; |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | function renderDocumentLink($aDataRow) { | 113 | function renderDocumentLink($aDataRow) { |
| 114 | - $outStr = '<a href="' . $this->buildDocumentLink($aDataRow) . '" title="' . $aDataRow["document"]->getFilename().'">'; | ||
| 115 | - $outStr .= htmlentities($aDataRow["document"]->getName(), ENT_NOQUOTES, 'UTF-8'); | 114 | + $outStr = '<a href="' . $this->buildDocumentLink($aDataRow) . '" title="' . $aDataRow['document']->getFilename().'">'; |
| 115 | + $outStr .= htmlentities($aDataRow['document']->getName(), ENT_NOQUOTES, 'UTF-8'); | ||
| 116 | $outStr .= '</a>'; | 116 | $outStr .= '</a>'; |
| 117 | return $outStr; | 117 | return $outStr; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | function buildDocumentLink($aDataRow) { | 120 | function buildDocumentLink($aDataRow) { |
| 121 | - return KTBrowseUtil::getUrlForDocument($aDataRow["document"]->getId()); | 121 | + return KTBrowseUtil::getUrlForDocument($aDataRow['document']->getId()); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | function buildFolderLink($aDataRow) { | 124 | function buildFolderLink($aDataRow) { |
| 125 | if (is_null(KTUtil::arrayGet($this->aOptions, 'direct_folder'))) { | 125 | if (is_null(KTUtil::arrayGet($this->aOptions, 'direct_folder'))) { |
| 126 | - return KTUtil::addQueryStringSelf('fFolderId='.$aDataRow["folder"]->getId()); | 126 | + return KTUtil::addQueryStringSelf('fFolderId='.$aDataRow['folder']->getId()); |
| 127 | } else { | 127 | } else { |
| 128 | return KTBrowseUtil::getUrlForFolder($aDataRow['folder']); | 128 | return KTBrowseUtil::getUrlForFolder($aDataRow['folder']); |
| 129 | } | 129 | } |
| @@ -132,12 +132,12 @@ class TitleColumn extends BrowseColumn { | @@ -132,12 +132,12 @@ class TitleColumn extends BrowseColumn { | ||
| 132 | // use inline, since its just too heavy to even _think_ about using smarty. | 132 | // use inline, since its just too heavy to even _think_ about using smarty. |
| 133 | function renderData($aDataRow) { | 133 | function renderData($aDataRow) { |
| 134 | $outStr = ''; | 134 | $outStr = ''; |
| 135 | - if ($aDataRow["type"] == "folder") { | 135 | + if ($aDataRow['type'] == 'folder') { |
| 136 | $outStr .= '<span class="contenttype folder">'; | 136 | $outStr .= '<span class="contenttype folder">'; |
| 137 | $outStr .= $this->renderFolderLink($aDataRow); | 137 | $outStr .= $this->renderFolderLink($aDataRow); |
| 138 | $outStr .= '</span>'; | 138 | $outStr .= '</span>'; |
| 139 | } else { | 139 | } else { |
| 140 | - $outStr .= '<span class="contenttype '.$this->_mimeHelper($aDataRow["document"]->getMimeTypeId()).'">'; | 140 | + $outStr .= '<span class="contenttype '.$this->_mimeHelper($aDataRow['document']->getMimeTypeId()).'">'; |
| 141 | $outStr .= $this->renderDocumentLink($aDataRow); | 141 | $outStr .= $this->renderDocumentLink($aDataRow); |
| 142 | $outStr .= ' (' . $this->prettySize($aDataRow["document"]->getSize()) . ')'; | 142 | $outStr .= ' (' . $this->prettySize($aDataRow["document"]->getSize()) . ')'; |
| 143 | $outStr .= '</span>'; | 143 | $outStr .= '</span>'; |
| @@ -174,11 +174,11 @@ class DateColumn extends BrowseColumn { | @@ -174,11 +174,11 @@ class DateColumn extends BrowseColumn { | ||
| 174 | 174 | ||
| 175 | function renderHeader($sReturnURL) { | 175 | function renderHeader($sReturnURL) { |
| 176 | $text = $this->label; | 176 | $text = $this->label; |
| 177 | - $href = $sReturnURL . "&sort_on=" . $this->name . "&sort_order="; | 177 | + $href = $sReturnURL . '&sort_on=' . $this->name . '&sort_order='; |
| 178 | if ($this->sort_on) { | 178 | if ($this->sort_on) { |
| 179 | - $href .= $this->sort_direction == "asc" ? "desc" : "asc" ; | 179 | + $href .= $this->sort_direction == 'asc' ? 'desc' : 'asc' ; |
| 180 | } else { | 180 | } else { |
| 181 | - $href .= $this->sort_direction = "asc"; | 181 | + $href .= $this->sort_direction = 'asc'; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | return '<a href="' . $href . '">'.$text.'</a>'; | 184 | return '<a href="' . $href . '">'.$text.'</a>'; |
| @@ -188,14 +188,14 @@ class DateColumn extends BrowseColumn { | @@ -188,14 +188,14 @@ class DateColumn extends BrowseColumn { | ||
| 188 | // use inline, since its just too heavy to even _think_ about using smarty. | 188 | // use inline, since its just too heavy to even _think_ about using smarty. |
| 189 | function renderData($aDataRow) { | 189 | function renderData($aDataRow) { |
| 190 | $outStr = ''; | 190 | $outStr = ''; |
| 191 | - if ($aDataRow["type"] == "folder") { | 191 | + if ($aDataRow['type'] == 'folder') { |
| 192 | $outStr = ' '; // no-op on folders. | 192 | $outStr = ' '; // no-op on folders. |
| 193 | } else { | 193 | } else { |
| 194 | $fn = $this->field_function; | 194 | $fn = $this->field_function; |
| 195 | - $dColumnDate = strtotime($aDataRow["document"]->$fn()); | 195 | + $dColumnDate = strtotime($aDataRow['document']->$fn()); |
| 196 | 196 | ||
| 197 | // now reformat this into something "pretty" | 197 | // now reformat this into something "pretty" |
| 198 | - $outStr = date("Y-m-d H:i", $dColumnDate); | 198 | + $outStr = date('Y-m-d H:i', $dColumnDate); |
| 199 | } | 199 | } |
| 200 | return $outStr; | 200 | return $outStr; |
| 201 | } | 201 | } |
| @@ -233,9 +233,9 @@ class UserColumn extends BrowseColumn { | @@ -233,9 +233,9 @@ class UserColumn extends BrowseColumn { | ||
| 233 | 233 | ||
| 234 | function renderHeader($sReturnURL) { | 234 | function renderHeader($sReturnURL) { |
| 235 | $text = $this->label; | 235 | $text = $this->label; |
| 236 | - $href = $sReturnURL . "&sort_on=" . $this->name . "&sort_order="; | 236 | + $href = $sReturnURL . '&sort_on=' . $this->name . '&sort_order='; |
| 237 | if ($this->sort_on) { | 237 | if ($this->sort_on) { |
| 238 | - $href .= $this->sort_direction == "asc" ? "desc" : "asc" ; | 238 | + $href .= $this->sort_direction == 'asc' ? 'desc' : 'asc' ; |
| 239 | } else { | 239 | } else { |
| 240 | $href .= $this->sort_direction = "asc"; | 240 | $href .= $this->sort_direction = "asc"; |
| 241 | } | 241 | } |
| @@ -249,7 +249,7 @@ class UserColumn extends BrowseColumn { | @@ -249,7 +249,7 @@ class UserColumn extends BrowseColumn { | ||
| 249 | $outStr = ''; | 249 | $outStr = ''; |
| 250 | $fn = $this->field_function; | 250 | $fn = $this->field_function; |
| 251 | $iUserId = null; | 251 | $iUserId = null; |
| 252 | - if ($aDataRow["type"] == "folder") { | 252 | + if ($aDataRow['type'] == 'folder') { |
| 253 | if (method_exists($aDataRow['folder'], $fn)) { | 253 | if (method_exists($aDataRow['folder'], $fn)) { |
| 254 | $iUserId = $aDataRow['folder']->$fn(); // FIXME this should check if the function exists first. | 254 | $iUserId = $aDataRow['folder']->$fn(); // FIXME this should check if the function exists first. |
| 255 | } | 255 | } |
| @@ -273,7 +273,7 @@ class UserColumn extends BrowseColumn { | @@ -273,7 +273,7 @@ class UserColumn extends BrowseColumn { | ||
| 273 | function addToDocumentQuery() { | 273 | function addToDocumentQuery() { |
| 274 | $sUsersTable = KTUtil::getTableName('users'); | 274 | $sUsersTable = KTUtil::getTableName('users'); |
| 275 | $sJoinSQL = "LEFT JOIN $sUsersTable AS users_order_join ON D.{$this->name} = users_order_join.id"; | 275 | $sJoinSQL = "LEFT JOIN $sUsersTable AS users_order_join ON D.{$this->name} = users_order_join.id"; |
| 276 | - return array($sJoinSQL, null, "users_order_join.name"); | 276 | + return array($sJoinSQL, null, 'users_order_join.name'); |
| 277 | } | 277 | } |
| 278 | } | 278 | } |
| 279 | 279 | ||
| @@ -292,7 +292,7 @@ class SelectionColumn extends BrowseColumn { | @@ -292,7 +292,7 @@ class SelectionColumn extends BrowseColumn { | ||
| 292 | function renderHeader($sReturnURL) { | 292 | function renderHeader($sReturnURL) { |
| 293 | // FIXME clean up access to oPage. | 293 | // FIXME clean up access to oPage. |
| 294 | global $main; | 294 | global $main; |
| 295 | - $main->requireJSResource("resources/js/toggleselect.js"); | 295 | + $main->requireJSResource('resources/js/toggleselect.js'); |
| 296 | 296 | ||
| 297 | return '<input type="checkbox" title="toggle all" onclick="toggleSelectFor(this, \''.$this->name.'\')">'; | 297 | return '<input type="checkbox" title="toggle all" onclick="toggleSelectFor(this, \''.$this->name.'\')">'; |
| 298 | 298 | ||
| @@ -302,16 +302,16 @@ class SelectionColumn extends BrowseColumn { | @@ -302,16 +302,16 @@ class SelectionColumn extends BrowseColumn { | ||
| 302 | function renderData($aDataRow) { | 302 | function renderData($aDataRow) { |
| 303 | $localname = $this->name; | 303 | $localname = $this->name; |
| 304 | 304 | ||
| 305 | - if (($aDataRow["type"] === "folder") && ($this->show_folders)) { | 305 | + if (($aDataRow['type'] === 'folder') && ($this->show_folders)) { |
| 306 | if ($this->show_documents) { | 306 | if ($this->show_documents) { |
| 307 | - $localname .= "_f[]"; | 307 | + $localname .= '_f[]'; |
| 308 | } | 308 | } |
| 309 | - $v = $aDataRow["folderid"]; | ||
| 310 | - } else if (($aDataRow["type"] === "document") && $this->show_documents) { | 309 | + $v = $aDataRow['folderid']; |
| 310 | + } else if (($aDataRow['type'] === 'document') && $this->show_documents) { | ||
| 311 | if ($this->show_folders) { | 311 | if ($this->show_folders) { |
| 312 | - $localname .= "_d[]"; | 312 | + $localname .= '_d[]'; |
| 313 | } | 313 | } |
| 314 | - $v = $aDataRow["docid"]; | 314 | + $v = $aDataRow['docid']; |
| 315 | } else { | 315 | } else { |
| 316 | return ' '; | 316 | return ' '; |
| 317 | } | 317 | } |
| @@ -340,16 +340,16 @@ class SingleSelectionColumn extends SelectionColumn { | @@ -340,16 +340,16 @@ class SingleSelectionColumn extends SelectionColumn { | ||
| 340 | function renderData($aDataRow) { | 340 | function renderData($aDataRow) { |
| 341 | $localname = $this->name; | 341 | $localname = $this->name; |
| 342 | 342 | ||
| 343 | - if (($aDataRow["type"] === "folder") && ($this->show_folders)) { | 343 | + if (($aDataRow['type'] === 'folder') && ($this->show_folders)) { |
| 344 | if ($this->show_documents) { | 344 | if ($this->show_documents) { |
| 345 | - $localname .= "_f"; | 345 | + $localname .= '_f'; |
| 346 | } | 346 | } |
| 347 | - $v = $aDataRow["folderid"]; | ||
| 348 | - } else if (($aDataRow["type"] === "document") && $this->show_documents) { | 347 | + $v = $aDataRow['folderid']; |
| 348 | + } else if (($aDataRow['type'] === 'document') && $this->show_documents) { | ||
| 349 | if ($this->show_folders) { | 349 | if ($this->show_folders) { |
| 350 | - $localname .= "_d"; | 350 | + $localname .= '_d'; |
| 351 | } | 351 | } |
| 352 | - $v = $aDataRow["docid"]; | 352 | + $v = $aDataRow['docid']; |
| 353 | } else { | 353 | } else { |
| 354 | return ' '; | 354 | return ' '; |
| 355 | } | 355 | } |
| @@ -364,11 +364,11 @@ class WorkflowColumn extends BrowseColumn { | @@ -364,11 +364,11 @@ class WorkflowColumn extends BrowseColumn { | ||
| 364 | 364 | ||
| 365 | function renderHeader($sReturnURL) { | 365 | function renderHeader($sReturnURL) { |
| 366 | $text = $this->label; | 366 | $text = $this->label; |
| 367 | - $href = $sReturnURL . "&sort_on=" . $this->name . "&sort_order="; | 367 | + $href = $sReturnURL . '&sort_on=' . $this->name . '&sort_order='; |
| 368 | if ($this->sort_on) { | 368 | if ($this->sort_on) { |
| 369 | - $href .= $this->sort_direction == "asc" ? "desc" : "asc" ; | 369 | + $href .= $this->sort_direction == 'asc' ? 'desc' : 'asc' ; |
| 370 | } else { | 370 | } else { |
| 371 | - $href .= $this->sort_direction = "asc"; | 371 | + $href .= $this->sort_direction = 'asc'; |
| 372 | } | 372 | } |
| 373 | 373 | ||
| 374 | return '<a href="' . $href . '">'.$text.'</a>'; | 374 | return '<a href="' . $href . '">'.$text.'</a>'; |
| @@ -380,7 +380,7 @@ class WorkflowColumn extends BrowseColumn { | @@ -380,7 +380,7 @@ class WorkflowColumn extends BrowseColumn { | ||
| 380 | 380 | ||
| 381 | 381 | ||
| 382 | // only _ever_ show this folder documents. | 382 | // only _ever_ show this folder documents. |
| 383 | - if ($aDataRow["type"] === "folder") { | 383 | + if ($aDataRow['type'] === 'folder') { |
| 384 | return ' '; | 384 | return ' '; |
| 385 | } | 385 | } |
| 386 | 386 |