コード例 #1
2
ファイル: ShopInvoice.php プロジェクト: pstaender/ShopSystem
 function generatePDF()
 {
     // tempfolder
     $tmpBaseFolder = TEMP_FOLDER . '/shopsystem';
     $tmpFolder = project() ? "{$tmpBaseFolder}/" . project() : "{$tmpBaseFolder}/site";
     if (is_dir($tmpFolder)) {
         Filesystem::removeFolder($tmpFolder);
     }
     if (!file_exists($tmpFolder)) {
         Filesystem::makeFolder($tmpFolder);
     }
     $baseFolderName = basename($tmpFolder);
     //Get site
     Requirements::clear();
     $link = Director::absoluteURL($this->pdfLink() . "/?view=1");
     $response = Director::test($link);
     $content = $response->getBody();
     $content = utf8_decode($content);
     $contentfile = "{$tmpFolder}/" . $this->PublicURL . ".html";
     if (!file_exists($contentfile)) {
         // Write to file
         if ($fh = fopen($contentfile, 'w')) {
             fwrite($fh, $content);
             fclose($fh);
         }
     }
     return $contentfile;
 }
コード例 #2
0
ファイル: DeploynautTest.php プロジェクト: ss23/deploynaut
 /**
  * Setup the environment to point to a temporary location
  *
  * @param type $path
  */
 protected function setTemporaryPath($path)
 {
     $this->envPath = $path;
     Filesystem::makeFolder($this->envPath);
     $this->envPath = realpath($this->envPath);
     Injector::inst()->load(array('DNData' => array('properties' => array('EnvironmentDir' => $this->envPath, 'KeyDir' => TEMP_FOLDER . '/deploynaut_test/gitkeys', 'DataTransferDir' => Director::baseFolder() . '/assets/transfers', 'GitUser' => ''))));
 }
コード例 #3
0
 public function setUp()
 {
     parent::setUp();
     $this->rootDir = ASSETS_PATH . '/AssetAdapterTest';
     Filesystem::makeFolder($this->rootDir);
     $this->originalServer = $_SERVER;
 }
コード例 #4
0
 public function setUp()
 {
     parent::setUp();
     // Set backend root to /ImageTest
     AssetStoreTest_SpyStore::activate('FileTest');
     // Create a test folders for each of the fixture references
     $folderIDs = $this->allFixtureIDs('Folder');
     foreach ($folderIDs as $folderID) {
         $folder = DataObject::get_by_id('Folder', $folderID);
         $filePath = ASSETS_PATH . '/FileTest/' . $folder->getFilename();
         SS_Filesystem::makeFolder($filePath);
     }
     // Create a test files for each of the fixture references
     $fileIDs = $this->allFixtureIDs('File');
     foreach ($fileIDs as $fileID) {
         $file = DataObject::get_by_id('File', $fileID);
         $root = ASSETS_PATH . '/FileTest/';
         if ($folder = $file->Parent()) {
             $root .= $folder->getFilename();
         }
         $path = $root . substr($file->getHash(), 0, 10) . '/' . basename($file->getFilename());
         SS_Filesystem::makeFolder(dirname($path));
         $fh = fopen($path, "w+");
         fwrite($fh, str_repeat('x', 1000000));
         fclose($fh);
     }
     // Conditional fixture creation in case the 'cms' module is installed
     if (class_exists('ErrorPage')) {
         $page = new ErrorPage(array('Title' => 'Page not Found', 'ErrorCode' => 404));
         $page->write();
         $page->publish('Stage', 'Live');
     }
 }
コード例 #5
0
 /**
  * writeTo
  *
  * @param string $path
  * @return void
  */
 public function writeTo($path)
 {
     Filesystem::makeFolder(dirname($path));
     if (is_dir(dirname($path))) {
         self::writeImage($path);
     }
 }
 /**
  *
  * @param SilverStripeContentItem $item
  * @param type $parentObject
  * @param type $duplicateStrategy
  * @return TransformResult 
  */
 public function transform($item, $parentObject, $duplicateStrategy)
 {
     $newFile = $this->getTypeForFile($item->Name);
     $newFile = new $newFile();
     $folderPath = $parentObject->getRelativePath();
     $parentId = $parentObject ? $parentObject->ID : 0;
     $filter = '"ParentID" = \'' . Convert::raw2sql($parentId) . '\' and "Title" = \'' . Convert::raw2sql($item->Name) . '\'';
     $existing = DataObject::get_one('File', $filter);
     if ($existing && $duplicateStrategy == ExternalContentTransformer::DS_SKIP) {
         // just return the existing children
         return new TransformResult($existing, null);
     } else {
         if ($existing && $duplicateStrategy == ExternalContentTransformer::DS_OVERWRITE) {
             $newFile = $existing;
         }
     }
     $newFile->Name = $item->Name;
     $newFile->RemoteNodeId = $item->getSS_ID();
     $newFile->RemoteSystemId = $item->getSource()->ID;
     $newFile->Title = $item->Title;
     $newFile->ParentID = $parentId;
     $newFile->write();
     $filepath = Director::baseFolder() . '/' . $newFile->Filename;
     Filesystem::makeFolder(dirname($filepath));
     $item->streamContent($filepath);
     return new TransformResult($newFile, null);
 }
コード例 #7
0
 public function setUp()
 {
     parent::setUp();
     $this->logInWithPermission('ADMIN');
     Versioned::reading_stage('Stage');
     // Set backend root to /AssetFieldTest
     AssetStoreTest_SpyStore::activate('AssetFieldTest');
     $create = function ($path) {
         Filesystem::makeFolder(dirname($path));
         $fh = fopen($path, "w+");
         fwrite($fh, str_repeat('x', 1000000));
         fclose($fh);
     };
     // Write all DBFile references
     foreach (AssetFieldTest_Object::get() as $object) {
         $path = AssetStoreTest_SpyStore::getLocalPath($object->File);
         $create($path);
     }
     // Create a test files for each of the fixture references
     $files = File::get()->exclude('ClassName', 'Folder');
     foreach ($files as $file) {
         $path = AssetStoreTest_SpyStore::getLocalPath($file);
         $create($path);
     }
 }
コード例 #8
0
 public function setUp()
 {
     parent::setUp();
     $this->loginWithPermission('ADMIN');
     // Save versioned state
     $this->oldReadingMode = Versioned::get_reading_mode();
     Versioned::set_stage(Versioned::DRAFT);
     // Set backend root to /UploadFieldTest
     AssetStoreTest_SpyStore::activate('UploadFieldTest');
     // Set the File Name Filter replacements so files have the expected names
     Config::inst()->update('FileNameFilter', 'default_replacements', array('/\\s/' => '-', '/_/' => '-', '/[^A-Za-z0-9+.\\-]+/' => '', '/[\\-]{2,}/' => '-', '/^[\\.\\-_]+/' => ''));
     // Create a test folders for each of the fixture references
     foreach (Folder::get() as $folder) {
         $path = AssetStoreTest_SpyStore::getLocalPath($folder);
         Filesystem::makeFolder($path);
     }
     // Create a test files for each of the fixture references
     $files = File::get()->exclude('ClassName', 'Folder');
     foreach ($files as $file) {
         $path = AssetStoreTest_SpyStore::getLocalPath($file);
         Filesystem::makeFolder(dirname($path));
         $fh = fopen($path, "w+");
         fwrite($fh, str_repeat('x', 1000000));
         fclose($fh);
     }
 }
コード例 #9
0
 public function setUp()
 {
     if (get_class($this) == "ImageTest") {
         $this->skipTest = true;
     }
     parent::setUp();
     if ($this->skipTest) {
         return;
     }
     // Set backend root to /ImageTest
     AssetStoreTest_SpyStore::activate('ImageTest');
     // Copy test images for each of the fixture references
     $files = File::get()->exclude('ClassName', 'Folder');
     foreach ($files as $image) {
         $filePath = AssetStoreTest_SpyStore::getLocalPath($image);
         // Only correct for test asset store
         $sourcePath = BASE_PATH . '/framework/tests/model/testimages/' . $image->Name;
         if (!file_exists($filePath)) {
             SS_Filesystem::makeFolder(dirname($filePath));
             if (!copy($sourcePath, $filePath)) {
                 user_error('Failed to copy test images', E_USER_ERROR);
             }
         }
     }
 }
コード例 #10
0
 public function onSyncro($properties)
 {
     if (isset($properties->RAW_FILE)) {
         $path = $this->owner->getFullPath();
         Filesystem::makeFolder(dirname($path));
         file_put_contents($path, base64_decode($properties->RAW_FILE));
     }
 }
コード例 #11
0
ファイル: DNProjectTest.php プロジェクト: adrexia/deploynaut
 public function setUp()
 {
     parent::setUp();
     $this->envPath = '/tmp/deploynaut_test/envs';
     Filesystem::makeFolder($this->envPath);
     Config::inst()->update('Injector', 'DNData', array('constructor' => array(0 => $this->envPath, 1 => '/tmp/deploynaut_test/gitkeys', 2 => Director::baseFolder() . '/assets/transfers')));
     parent::setUp();
     $this->project = new DNProject();
     $this->project->Name = 'testproject';
 }
コード例 #12
0
 function setUp()
 {
     parent::setUp();
     $this->orig['ErrorPage_staticfilepath'] = ErrorPage::get_static_filepath();
     $this->tmpAssetsPath = sprintf('%s/_tmp_assets_%s', TEMP_FOLDER, rand());
     Filesystem::makeFolder($this->tmpAssetsPath . '/ErrorPageTest');
     ErrorPage::set_static_filepath($this->tmpAssetsPath . '/ErrorPageTest');
     $this->orig['Director_environmenttype'] = Director::get_environment_type();
     Director::set_environment_type('live');
 }
コード例 #13
0
 public function setUp()
 {
     parent::setUp();
     $this->orig['ErrorPage_staticfilepath'] = ErrorPage::config()->static_filepath;
     $this->tmpAssetsPath = sprintf('%s/_tmp_assets_%s', TEMP_FOLDER, rand());
     Filesystem::makeFolder($this->tmpAssetsPath . '/ErrorPageTest');
     ErrorPage::config()->static_filepath = $this->tmpAssetsPath . '/ErrorPageTest';
     $this->origEnvType = Config::inst()->get('Director', 'environment_type');
     Config::inst()->update('Director', 'environment_type', 'live');
 }
コード例 #14
0
 /**
  * Gets the path to the queuedjob cache directory
  */
 protected function getJobDir()
 {
     // make sure our temp dir is in place. This is what will be inotify watched
     $jobDir = Config::inst()->get('QueuedJobService', 'cache_dir');
     if ($jobDir[0] != '/') {
         $jobDir = getTempFolder() . '/' . $jobDir;
     }
     if (!is_dir($jobDir)) {
         Filesystem::makeFolder($jobDir);
     }
     return $jobDir;
 }
 public function setUp()
 {
     parent::setUp();
     AssetStoreTest_SpyStore::activate('SiteTreeHtmlEditorFieldTest');
     $this->logInWithPermission('ADMIN');
     // Write file contents
     $files = File::get()->exclude('ClassName', 'Folder');
     foreach ($files as $file) {
         $destPath = AssetStoreTest_SpyStore::getLocalPath($file);
         Filesystem::makeFolder(dirname($destPath));
         file_put_contents($destPath, str_repeat('x', 1000000));
     }
 }
コード例 #16
0
 public function setUp()
 {
     parent::setUp();
     $this->alternateBasePath = $this->getCurrentAbsolutePath() . "/_fakewebroot";
     $this->alternateBaseSavePath = TEMP_FOLDER . '/i18nTextCollectorTest_webroot';
     Filesystem::makeFolder($this->alternateBaseSavePath);
     // Push a class and template loader running from the fake webroot onto
     // the stack.
     $this->manifest = new SS_ClassManifest($this->alternateBasePath, false, true, false);
     $manifest = new SS_TemplateManifest($this->alternateBasePath, null, false, true);
     $manifest->regenerate(false);
     SS_TemplateLoader::instance()->pushManifest($manifest);
 }
コード例 #17
0
 function export()
 {
     // specify custom baseurl for publishing to other webroot
     if (isset($_REQUEST['baseurl'])) {
         $base = $_REQUEST['baseurl'];
         if (substr($base, -1) != '/') {
             $base .= '/';
         }
         Director::setBaseURL($base);
     }
     // setup temporary folders
     $tmpBaseFolder = TEMP_FOLDER . '/static-export';
     $tmpFolder = project() ? "{$tmpBaseFolder}/" . project() : "{$tmpBaseFolder}/site";
     if (!file_exists($tmpFolder)) {
         Filesystem::makeFolder($tmpFolder);
     }
     $baseFolderName = basename($tmpFolder);
     // symlink /assets
     $f1 = ASSETS_PATH;
     $f2 = Director::baseFolder() . '/' . project();
     `cd {$tmpFolder}; ln -s {$f1}; ln -s {$f2}`;
     // iterate through all instances of SiteTree
     $pages = DataObject::get("SiteTree");
     foreach ($pages as $page) {
         $subfolder = "{$tmpFolder}/" . trim($page->RelativeLink(null, true), '/');
         $contentfile = "{$tmpFolder}/" . trim($page->RelativeLink(null, true), '/') . '/index.html';
         // Make the folder
         if (!file_exists($subfolder)) {
             Filesystem::makeFolder($subfolder);
         }
         // Run the page
         Requirements::clear();
         $link = Director::makeRelative($page->Link());
         $response = Director::test($link);
         // Write to file
         if ($fh = fopen($contentfile, 'w')) {
             fwrite($fh, $response->getBody());
             fclose($fh);
         }
     }
     // copy homepage (URLSegment: "home") to webroot
     copy("{$tmpFolder}/home/index.html", "{$tmpFolder}/index.html");
     // archive all generated files
     `cd {$tmpBaseFolder}; tar -czhf {$baseFolderName}.tar.gz {$baseFolderName}`;
     $archiveContent = file_get_contents("{$tmpBaseFolder}/{$baseFolderName}.tar.gz");
     // remove temporary files and folder
     Filesystem::removeFolder($tmpBaseFolder);
     // return as download to the client
     $response = SS_HTTPRequest::send_file($archiveContent, "{$baseFolderName}.tar.gz", 'application/x-tar-gz');
     echo $response->output();
 }
コード例 #18
0
 public function setUp()
 {
     parent::setUp();
     $this->alternateBasePath = $this->getCurrentAbsolutePath() . "/_fakewebroot";
     Config::inst()->update('Director', 'alternate_base_folder', $this->alternateBasePath);
     $this->alternateBaseSavePath = TEMP_FOLDER . '/i18nTextCollectorTest_webroot';
     Filesystem::makeFolder($this->alternateBaseSavePath);
     // Push a class and template loader running from the fake webroot onto
     // the stack.
     $this->manifest = new SS_ClassManifest($this->alternateBasePath, false, true, false);
     // Replace old template loader with new one with alternate base path
     $this->_oldLoader = ThemeResourceLoader::instance();
     ThemeResourceLoader::set_instance(new ThemeResourceLoader($this->alternateBasePath));
 }
コード例 #19
0
 public function write($content = null, $name = '')
 {
     $docopy = false;
     $reader = $this->getReaderWrapper($content);
     // this call will set $this->id so subsequent references to this will work
     $target = $this->getTarget($name);
     // SS specific
     Filesystem::makeFolder(dirname($target));
     if ($docopy) {
         @copy($content, $target);
     } else {
         file_put_contents($target, $reader->read());
     }
 }
コード例 #20
0
 public function setUp()
 {
     parent::setUp();
     // Set backend root to /HtmlEditorFieldTest
     AssetStoreTest_SpyStore::activate('HtmlEditorFieldTest');
     // Create a test files for each of the fixture references
     $files = File::get()->exclude('ClassName', 'Folder');
     foreach ($files as $file) {
         $fromPath = BASE_PATH . '/framework/tests/forms/images/' . $file->Name;
         $destPath = AssetStoreTest_SpyStore::getLocalPath($file);
         // Only correct for test asset store
         SS_Filesystem::makeFolder(dirname($destPath));
         copy($fromPath, $destPath);
     }
 }
コード例 #21
0
 public function setUp()
 {
     Config::nest();
     // additional nesting here necessary
     Config::inst()->update('File', 'migrate_legacy_file', false);
     parent::setUp();
     // Set backend root to /FileMigrationHelperTest/assets
     AssetStoreTest_SpyStore::activate('FileMigrationHelperTest/assets');
     // Ensure that each file has a local record file in this new assets base
     $from = FRAMEWORK_PATH . '/tests/model/testimages/test-image-low-quality.jpg';
     foreach (File::get()->exclude('ClassName', 'Folder') as $file) {
         $dest = AssetStoreTest_SpyStore::base_path() . '/' . $file->generateFilename();
         SS_Filesystem::makeFolder(dirname($dest));
         copy($from, $dest);
     }
 }
コード例 #22
0
 public function setUp()
 {
     parent::setUp();
     // Set backend root to /HTMLEditorFieldTest
     AssetStoreTest_SpyStore::activate('HTMLEditorFieldTest');
     // Set the File Name Filter replacements so files have the expected names
     Config::inst()->update('FileNameFilter', 'default_replacements', array('/\\s/' => '-', '/_/' => '-', '/[^A-Za-z0-9+.\\-]+/' => '', '/[\\-]{2,}/' => '-', '/^[\\.\\-_]+/' => ''));
     // Create a test files for each of the fixture references
     $files = File::get()->exclude('ClassName', 'Folder');
     foreach ($files as $file) {
         $fromPath = BASE_PATH . '/framework/tests/forms/images/' . $file->Name;
         $destPath = AssetStoreTest_SpyStore::getLocalPath($file);
         // Only correct for test asset store
         SS_Filesystem::makeFolder(dirname($destPath));
         copy($fromPath, $destPath);
     }
 }
コード例 #23
0
 /**
  * Finds the path for specified file
  *
  * @param string $fileOrUrl
  * @return string|bool
  */
 protected function path_for_file($fileOrUrl)
 {
     // only handle files in themes folder
     if (!Controller::has_curr() || is_a(Controller::curr(), 'LeftAndMain')) {
         return parent::path_for_file($fileOrUrl);
     } else {
         if (preg_match('{^//|http[s]?}', $fileOrUrl)) {
             return $fileOrUrl;
         } elseif (Director::fileExists($fileOrUrl)) {
             $filePath = preg_replace('/\\?.*/', '', Director::baseFolder() . '/' . $fileOrUrl);
             $baseurl = Director::baseURL();
             // url parameters
             if (strpos($fileOrUrl, '?') !== false) {
                 $parameters = '?' . substr($fileOrUrl, strpos($fileOrUrl, '?') + 1);
                 $fileOrUrl = substr($fileOrUrl, 0, strpos($fileOrUrl, '?'));
             } else {
                 $parameters = '';
             }
             // get base path
             $baseFolder = Director::baseFolder();
             // get combined files folder
             $combinedFilesFolder = rtrim($this->getCombinedFilesFolder(), '/');
             if (!file_exists($baseFolder . '/' . $combinedFilesFolder)) {
                 Filesystem::makeFolder($baseFolder . '/' . $combinedFilesFolder);
             }
             // get file name
             $fileName = substr($filePath, strrpos($filePath, '/') + 1);
             // get prefix
             $prefix = filemtime($filePath) . '-';
             $prefixedFilePath = $baseFolder . '/' . $combinedFilesFolder . '/' . $prefix . $fileName;
             // clean up and create file
             if (!file_exists($prefixedFilePath)) {
                 // remove old prefixed files
                 foreach (glob($baseFolder . '/' . $combinedFilesFolder . '/' . '[0-9]*-' . $fileName) as $file) {
                     unlink($file);
                 }
                 // copy standard file to prefixed file
                 copy($filePath, $prefixedFilePath);
             }
             return "{$baseurl}{$combinedFilesFolder}/{$prefix}{$fileName}{$parameters}";
         } else {
             return false;
         }
     }
 }
コード例 #24
0
 public function setUp()
 {
     parent::setUp();
     AssetStoreTest_SpyStore::activate('FileLinkTrackingTest');
     $this->logInWithPermission('ADMIN');
     // Write file contents
     $files = File::get()->exclude('ClassName', 'Folder');
     foreach ($files as $file) {
         $destPath = AssetStoreTest_SpyStore::getLocalPath($file);
         Filesystem::makeFolder(dirname($destPath));
         file_put_contents($destPath, str_repeat('x', 1000000));
     }
     // Since we can't hard-code IDs, manually inject image tracking shortcode
     $imageID = $this->idFromFixture('Image', 'file1');
     $page = $this->objFromFixture('Page', 'page1');
     $page->Content = sprintf('<p><img src="/assets/FileLinkTrackingTest/55b443b601/testscript-test-file.jpg" data-fileid="%d" /></p>', $imageID);
     $page->write();
 }
コード例 #25
0
    /**
     * Set up the controller, in particular, re-sync the File database with the assets folder./
     */
    function init()
    {
        parent::init();
        // Create base folder if it doesnt exist already
        if (!file_exists(ASSETS_PATH)) {
            Filesystem::makeFolder(ASSETS_PATH);
        }
        Requirements::javascript(CMS_DIR . "/javascript/AssetAdmin.js");
        Requirements::css(CMS_DIR . "/css/AssetAdmin.css");
        Requirements::customScript(<<<JS
\t\t\t_TREE_ICONS = {};
\t\t\t_TREE_ICONS['Folder'] = {
\t\t\t\t\tfileIcon: 'sapphire/javascript/tree/images/page-closedfolder.gif',
\t\t\t\t\topenFolderIcon: 'sapphire/javascript/tree/images/page-openfolder.gif',
\t\t\t\t\tclosedFolderIcon: 'sapphire/javascript/tree/images/page-closedfolder.gif'
\t\t\t};
JS
);
        CMSBatchActionHandler::register('delete', 'AssetAdmin_DeleteBatchAction', 'Folder');
    }
コード例 #26
0
 public function setUp()
 {
     parent::setUp();
     // Set backend root to /FolderTest
     AssetStoreTest_SpyStore::activate('FolderTest');
     // Create a test folders for each of the fixture references
     foreach (Folder::get() as $folder) {
         $path = AssetStoreTest_SpyStore::getLocalPath($folder);
         SS_Filesystem::makeFolder($path);
     }
     // Create a test files for each of the fixture references
     $files = File::get()->exclude('ClassName', 'Folder');
     foreach ($files as $file) {
         $path = AssetStoreTest_SpyStore::getLocalPath($file);
         SS_Filesystem::makeFolder(dirname($path));
         $fh = fopen($path, "w+");
         fwrite($fh, str_repeat('x', 1000000));
         fclose($fh);
     }
 }
コード例 #27
0
 function setUp()
 {
     parent::setUp();
     $this->socks = $this->objFromFixture('Product', 'socks');
     $this->img1 = new Image();
     $this->img1->Filename = 'assets/ProductImageTest1.png';
     $this->img1->write();
     $this->img2 = new Image();
     $this->img2->Filename = 'assets/ProductImageTest2.png';
     $this->img2->write();
     $this->siteConfig = SiteConfig::current_site_config();
     $this->siteConfig->DefaultProductImageID = $this->img1->ID;
     $this->siteConfig->write();
     // Create assets/ folder if it doesn't exist
     if (!is_dir(ASSETS_PATH)) {
         Filesystem::makeFolder(ASSETS_PATH);
         $this->createdAssetsFolder = true;
     }
     file_put_contents($this->img1->getFullPath(), 'dummy file');
     file_put_contents($this->img2->getFullPath(), 'dummy file');
 }
 public function generateScriptFilesFor($type)
 {
     $typeConfig = $this->configFor($type);
     $files = array();
     foreach ($typeConfig as $target => $config) {
         $output = $this->generateScriptDataFor($type, $target);
         $target = $target == 'default' ? $target . '-' . $type . '.js' : $target;
         $targetFile = isset($config['target_path']) ? $config['target_path'] . DIRECTORY_SEPARATOR . $target : $this->defaultPath . DIRECTORY_SEPARATOR . $target;
         if (strlen($output) && $targetFile) {
             if ($targetFile[0] != '/') {
                 $files[] = $targetFile;
                 $targetFile = Director::baseFolder() . DIRECTORY_SEPARATOR . $targetFile;
             } else {
                 // only record the basename if it's not a relative folder to the project
                 $files[] = basename($targetFile);
             }
             Filesystem::makeFolder(dirname($targetFile));
             file_put_contents($targetFile, $output);
         }
     }
     return $files;
 }
コード例 #29
0
ファイル: AssetAdmin.php プロジェクト: miamollie/echoAerial
    /**
     * Set up the controller, in particular, re-sync the File database with the assets folder./
     */
    public function init()
    {
        parent::init();
        // Create base folder if it doesnt exist already
        if (!file_exists(ASSETS_PATH)) {
            Filesystem::makeFolder(ASSETS_PATH);
        }
        Requirements::javascript(CMS_DIR . "/javascript/AssetAdmin.js");
        Requirements::javascript(CMS_DIR . '/javascript/CMSMain.GridField.js');
        Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang', false, true);
        Requirements::css(CMS_DIR . "/css/screen.css");
        $frameworkDir = FRAMEWORK_DIR;
        Requirements::customScript(<<<JS
\t\t\t_TREE_ICONS = {};
\t\t\t_TREE_ICONS['Folder'] = {
\t\t\t\t\tfileIcon: '{$frameworkDir}/javascript/tree/images/page-closedfolder.gif',
\t\t\t\t\topenFolderIcon: '{$frameworkDir}/javascript/tree/images/page-openfolder.gif',
\t\t\t\t\tclosedFolderIcon: '{$frameworkDir}/javascript/tree/images/page-closedfolder.gif'
\t\t\t};
JS
);
        CMSBatchActionHandler::register('delete', 'AssetAdmin_DeleteBatchAction', 'Folder');
    }
コード例 #30
0
 public function setUp()
 {
     parent::setUp();
     // Set backend root to /ImageTest
     AssetStoreTest_SpyStore::activate('ProtectedFileControllerTest');
     // Create a test folders for each of the fixture references
     foreach (Folder::get() as $folder) {
         /** @var Folder $folder */
         $filePath = AssetStoreTest_SpyStore::getLocalPath($folder);
         \Filesystem::makeFolder($filePath);
     }
     // Create a test files for each of the fixture references
     foreach (File::get()->exclude('ClassName', 'Folder') as $file) {
         /** @var File $file */
         $path = AssetStoreTest_SpyStore::getLocalPath($file);
         \Filesystem::makeFolder(dirname($path));
         $fh = fopen($path, "w+");
         fwrite($fh, str_repeat('x', 1000000));
         fclose($fh);
         // Create variant for each file
         $this->getAssetStore()->setFromString(str_repeat('y', 100), $file->Filename, $file->Hash, 'variant');
     }
 }