'Varchar(2083)', // 2083 is the maximum length of a URL in Internet Explorer. 'HTTPCode' =>'Int' ); private static $has_one = array( 'Track' => 'BrokenExternalPageTrack', 'Status' => 'BrokenExternalPageTrackStatus' ); /** * @return SiteTree */ public function Page() { return $this->Track()->Page(); } public static $summary_fields = array( 'Page.Title' => 'Page', 'HTTPCodeDescription' => 'HTTP Code', 'Created' => 'Created' ); public static $searchable_fields = array( 'HTTPCode' => array('title' => 'HTTP Code') ); public function canEdit($member = false) { return false; } public function canView($member = false) { $member = $member ? $member : Member::currentUser(); $codes = array('content-authors', 'administrators'); return Permission::checkMember($member, $codes); } /** * Retrieve a human readable description of a response code * * @return string */ public function getHTTPCodeDescription() { $code = $this->HTTPCode; if(empty($code)) { // Assume that $code = 0 means there was no response $description = _t(__CLASS__.'.NOTAVAILABLE', 'Server Not Available'); } elseif( ($descriptions = Config::inst()->get('SS_HTTPResponse', 'status_codes')) && isset($descriptions[$code]) ) { $description = $descriptions[$code]; } else { $description = _t(__CLASS__.'.UNKNOWNRESPONSE', 'Unknown Response Code'); } return sprintf("%d (%s)", $code, $description); } }