Get rid of objectTypeID as parameter in edit history
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 9 Jul 2014 19:44:46 +0000 (21:44 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 9 Jul 2014 19:59:05 +0000 (21:59 +0200)
com.woltlab.wcf/templates/editHistory.tpl
wcfsetup/install/files/lib/page/EditHistoryPage.class.php

index 797ce4132b11837e7a4e02f3390b063b18941481..cdd73d96076d107237ec7f6e24d6119a70e38c79 100644 (file)
        
        <div class="formSubmit">
                {@SID_INPUT_TAG}
+               <input type="hidden" name="objectID" value="{$objectID}" />
+               <input type="hidden" name="objectType" value="{$objectType->objectType}" />
                <button class="button" data-type="submit">{lang}wcf.edit.button.compare{/lang}</button>
        </div>
 </form>
index 2094ebcda7789a53a3f2bd3355a3925bd1b3f8f4..8dbd378b30bde604ce9861d5d18f4089b2667bb7 100644 (file)
@@ -55,12 +55,6 @@ class EditHistoryPage extends AbstractPage {
         */
        public $diff = null;
        
-       /**
-        * object type id of the requested object
-        * @var integer
-        */
-       public $objectTypeID = 0;
-       
        /**
         * object type of the requested object
         * @var \wcf\data\object\type\ObjectType
@@ -105,17 +99,16 @@ class EditHistoryPage extends AbstractPage {
                        }
                        
                        $this->objectID = $this->old->objectID;
-                       $this->objectTypeID = $this->old->objectTypeID;
+                       $this->objectType = ObjectTypeCache::getInstance()->getObjectType($this->old->objectTypeID);
                }
-               else if (isset($_REQUEST['objectID']) && isset($_REQUEST['objectTypeID'])) {
+               else if (isset($_REQUEST['objectID']) && isset($_REQUEST['objectType'])) {
                        $this->objectID = intval($_REQUEST['objectID']);
-                       $this->objectTypeID = intval($_REQUEST['objectTypeID']);
+                       $this->objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.edit.historySavingObject', $_REQUEST['objectType']);
                }
                else {
                        throw new IllegalLinkException();
                }
                
-               $this->objectType = ObjectTypeCache::getInstance()->getObjectType($this->objectTypeID);
                if (!$this->objectType) throw new IllegalLinkException();
                $processor = $this->objectType->getProcessor();
                $this->object = $processor->getObjectByID($this->objectID);
@@ -137,7 +130,7 @@ class EditHistoryPage extends AbstractPage {
                
                $this->objectList = new EditHistoryEntryList();
                $this->objectList->sqlOrderBy = "time DESC";
-               $this->objectList->getConditionBuilder()->add('objectTypeID = ?', array($this->objectTypeID));
+               $this->objectList->getConditionBuilder()->add('objectTypeID = ?', array($this->objectType->objectTypeID));
                $this->objectList->getConditionBuilder()->add('objectID = ?', array($this->objectID));
                $this->objectList->readObjects();
                
@@ -162,7 +155,9 @@ class EditHistoryPage extends AbstractPage {
                        'new' => $this->new,
                        'object' => $this->object,
                        'diff' => $this->diff,
-                       'objects' => $this->objectList
+                       'objects' => $this->objectList,
+                       'objectID' => $this->objectID,
+                       'objectType' => $this->objectType
                ));
        }
 }