diff --git a/include/application.php b/include/application.php
index 34a8001..b4c8a61 100644
--- a/include/application.php
+++ b/include/application.php
@@ -957,11 +957,19 @@ class Application {
return 'appId';
}
- public static function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "appId", $bAscending = TRUE, $oFilters = null)
+ public static function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = 'default', $bAscending = TRUE, $oFilters = null)
{
$sLimit = "";
$sOrdering = $bAscending ? "ASC" : "DESC";
+ if($sOrderBy == 'default')
+ {
+ if($sState == 'queued')
+ $sOrderBy = 'appId';
+ else
+ $sOrderBy = 'appName';
+ }
+
$sExtraTables = '';
$sWhereFilter = $oFilters ? $oFilters->getWhereClause() : '';
$aOptions = $oFilters ? $oFilters->getOptions() : array('onlyDownloadable' => 'false', 'appCategory' => null);
diff --git a/include/objectManager.php b/include/objectManager.php
index cfabde9..e44f6cc 100644
--- a/include/objectManager.php
+++ b/include/objectManager.php
@@ -842,6 +842,33 @@ class ObjectManager
echo '';
}
+ /* Move the object to another parent entry */
+ public function change_parent($iNewId)
+ {
+ $oObject = new $this->sClass($this->iId);
+ $oParent = $oObject->objectGetParent();
+ $sParentClass = get_class($oParent);
+ $oNewParent = new $sParentClass($iNewId);
+
+ /* The user needs to have edit rights to both the old and the new object
+ If you have edit rights to an object then you should have edit rights
+ to its child objects as well */
+ if(!$oObject->canEdit() || !$oParent->canEdit() || !$oNewParent->canEdit())
+ return FALSE;
+
+ $oObject->objectSetParent($oNewParent->objectGetId());
+
+ if($oObject->update())
+ {
+ addmsg('The entry was moved successfully', 'green');
+ } else
+ {
+ addmsg('Failed to move the entry', 'red');
+ }
+
+ $this->return_to_url(APPDB_ROOT);
+ }
+
/* Move all the object's children to another object of the same type, and
delete the original object afterwards */
public function move_children($iNewId)
@@ -875,6 +902,56 @@ class ObjectManager
$this->delete_entry("Duplicate entry");
}
+ /* Display a page where the user can move the current object to another parent */
+ public function display_change_parent()
+ {
+ $oObject = new $this->sClass($this->iId);
+ if(!$oObject->canEdit())
+ {
+ echo "Insufficient privileges.
\n";
+ return FALSE;
+ }
+
+ /* Display some help text */
+ echo "
Move ".$oObject->objectMakeLink()." to the parent entry "; + echo "selected below:
\n"; + + echo "