Ejemplo n.º 1
0
 /**
  * Get the template for a specific activity-event in the activities
  *
  * @param array $activity An array with all the activity data in it
  * @param return string
  */
 public static function show($activity)
 {
     $tmpl = new \OCP\Template('activity', 'activity.box');
     $tmpl->assign('formattedDate', \OCP\Util::formatDate($activity['timestamp']));
     $tmpl->assign('formattedTimestamp', \OCP\relative_modified_date($activity['timestamp']));
     $tmpl->assign('user', $activity['user']);
     $tmpl->assign('displayName', \OCP\User::getDisplayName($activity['user']));
     if ($activity['app'] === 'files') {
         // We do not link the subject as we create links for the parameters instead
         $activity['link'] = '';
     }
     $tmpl->assign('event', $activity);
     if ($activity['file']) {
         $rootView = new \OC\Files\View('');
         $exist = $rootView->file_exists('/' . $activity['user'] . '/files' . $activity['file']);
         $is_dir = $rootView->is_dir('/' . $activity['user'] . '/files' . $activity['file']);
         unset($rootView);
         // show a preview image if the file still exists
         if (!$is_dir && $exist) {
             $tmpl->assign('previewLink', \OCP\Util::linkTo('files', 'index.php', array('dir' => dirname($activity['file']))));
             $tmpl->assign('previewImageLink', \OCP\Util::linkToRoute('core_ajax_preview', array('file' => $activity['file'], 'x' => 150, 'y' => 150)));
         } else {
             if ($exist) {
                 $tmpl->assign('previewLink', \OCP\Util::linkTo('files', 'index.php', array('dir' => $activity['file'])));
                 $tmpl->assign('previewImageLink', \OC_Helper::mimetypeIcon('dir'));
                 $tmpl->assign('previewLinkIsDir', true);
             }
         }
     }
     return $tmpl->fetchPage();
 }
Ejemplo n.º 2
0
 public static function determineIcon($file)
 {
     if ($file['type'] === 'dir') {
         $dir = $file['directory'];
         $absPath = \OC\Files\Filesystem::getView()->getAbsolutePath($dir . '/' . $file['name']);
         $mount = \OC\Files\Filesystem::getMountManager()->find($absPath);
         if (!is_null($mount)) {
             $sid = $mount->getStorageId();
             if (!is_null($sid)) {
                 $sid = explode(':', $sid);
                 if ($sid[0] === 'shared') {
                     return \OC_Helper::mimetypeIcon('dir-shared');
                 }
                 if ($sid[0] !== 'local' and $sid[0] !== 'home') {
                     return \OC_Helper::mimetypeIcon('dir-external');
                 }
             }
         }
         return \OC_Helper::mimetypeIcon('dir');
     }
     if ($file['isPreviewAvailable']) {
         $pathForPreview = $file['directory'] . '/' . $file['name'];
         return \OC_Helper::previewIcon($pathForPreview) . '&c=' . $file['etag'];
     }
     return \OC_Helper::mimetypeIcon($file['mimetype']);
 }
Ejemplo n.º 3
0
 public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview)
 {
     $mimetype = $fileview->getMimeType($path);
     $path = \OC_Helper::mimetypeIcon($mimetype);
     $path = \OC::$SERVERROOT . substr($path, strlen(\OC::$WEBROOT));
     $svgPath = substr_replace($path, 'svg', -3);
     if (extension_loaded('imagick') && file_exists($svgPath) && count(@\Imagick::queryFormats("SVG")) === 1) {
         // http://www.php.net/manual/de/imagick.setresolution.php#85284
         $svg = new \Imagick();
         $svg->readImage($svgPath);
         $res = $svg->getImageResolution();
         $x_ratio = $res['x'] / $svg->getImageWidth();
         $y_ratio = $res['y'] / $svg->getImageHeight();
         $svg->removeImage();
         $svg->setResolution($maxX * $x_ratio, $maxY * $y_ratio);
         $svg->setBackgroundColor(new \ImagickPixel('transparent'));
         $svg->readImage($svgPath);
         $svg->setImageFormat('png32');
         $image = new \OC_Image();
         $image->loadFromData($svg);
     } else {
         $image = new \OC_Image($path);
     }
     return $image;
 }
Ejemplo n.º 4
0
 /**
  * lists the documents the user has access to (including shared files, once the code in core has been fixed)
  * also adds session and member info for these files
  */
 public static function listAll()
 {
     self::preDispatch();
     $found = Storage::getDocuments();
     $fileIds = array();
     $documents = array();
     foreach ($found as $key => $document) {
         if (is_object($document)) {
             $documents[] = $document->getData();
         } else {
             $documents[$key] = $document;
         }
         $documents[$key]['icon'] = preg_replace('/\\.png$/', '.svg', \OC_Helper::mimetypeIcon($document['mimetype']));
         $fileIds[] = $document['fileid'];
     }
     usort($documents, function ($a, $b) {
         return @$b['mtime'] - @$a['mtime'];
     });
     $session = new Db\Session();
     $sessions = $session->getCollectionBy('file_id', $fileIds);
     $members = array();
     $member = new Db\Member();
     foreach ($sessions as $session) {
         $members[$session['es_id']] = $member->getActiveCollection($session['es_id']);
     }
     \OCP\JSON::success(array('documents' => $documents, 'sessions' => $sessions, 'members' => $members));
 }
Ejemplo n.º 5
0
 /**
  * Get the template for a specific activity-event in the activities
  *
  * @param array $activity An array with all the activity data in it
  * @return string
  */
 public static function show($activity)
 {
     $tmpl = new Template('activity', 'activity.box');
     $tmpl->assign('formattedDate', Util::formatDate($activity['timestamp']));
     $tmpl->assign('formattedTimestamp', \OCP\relative_modified_date($activity['timestamp']));
     $tmpl->assign('user', $activity['user']);
     $tmpl->assign('displayName', User::getDisplayName($activity['user']));
     if (strpos($activity['subjectformatted']['markup']['trimmed'], '<a ') !== false) {
         // We do not link the subject as we create links for the parameters instead
         $activity['link'] = '';
     }
     $tmpl->assign('event', $activity);
     if ($activity['file']) {
         $rootView = new View('/' . $activity['affecteduser'] . '/files');
         $exist = $rootView->file_exists($activity['file']);
         $is_dir = $rootView->is_dir($activity['file']);
         unset($rootView);
         // show a preview image if the file still exists
         $mimetype = \OC_Helper::getFileNameMimeType($activity['file']);
         if (!$is_dir && \OC::$server->getPreviewManager()->isMimeSupported($mimetype) && $exist) {
             $tmpl->assign('previewLink', Util::linkTo('files', 'index.php', array('dir' => dirname($activity['file']))));
             $tmpl->assign('previewImageLink', Util::linkToRoute('core_ajax_preview', array('file' => $activity['file'], 'x' => 150, 'y' => 150)));
         } else {
             $tmpl->assign('previewLink', Util::linkTo('files', 'index.php', array('dir' => $activity['file'])));
             $tmpl->assign('previewImageLink', \OC_Helper::mimetypeIcon($is_dir ? 'dir' : $mimetype));
             $tmpl->assign('previewLinkIsDir', true);
         }
     }
     return $tmpl->fetchPage();
 }
Ejemplo n.º 6
0
 /**
  * Determine icon for a given file
  *
  * @param \OCP\Files\FileInfo $file file info
  * @return string icon URL
  */
 public static function determineIcon($file)
 {
     if ($file['type'] === 'dir') {
         $icon = \OC_Helper::mimetypeIcon('dir');
         // TODO: move this part to the client side, using mountType
         if ($file->isShared()) {
             $icon = \OC_Helper::mimetypeIcon('dir-shared');
         } elseif ($file->isMounted()) {
             $icon = \OC_Helper::mimetypeIcon('dir-external');
         }
     } else {
         $icon = \OC_Helper::mimetypeIcon($file->getMimetype());
     }
     return substr($icon, 0, -3) . 'svg';
 }
Ejemplo n.º 7
0
 /**
  * test rename of file/folder
  */
 function testRenameFolder()
 {
     $dir = '/';
     $oldname = 'oldname';
     $newname = 'newname';
     $this->viewMock->expects($this->any())->method('file_exists')->with($this->anything())->will($this->returnValueMap(array(array('/', true), array('/oldname', true))));
     $this->viewMock->expects($this->any())->method('getFileInfo')->will($this->returnValue(new \OC\Files\FileInfo('/new_name', new \OC\Files\Storage\Local(array('datadir' => '/')), '/', array('fileid' => 123, 'type' => 'dir', 'mimetype' => 'httpd/unix-directory', 'mtime' => 0, 'permissions' => 31, 'size' => 18, 'etag' => 'abcdef', 'directory' => '/', 'name' => 'new_name'), null)));
     $result = $this->files->rename($dir, $oldname, $newname);
     $this->assertTrue($result['success']);
     $this->assertEquals(123, $result['data']['id']);
     $this->assertEquals('new_name', $result['data']['name']);
     $this->assertEquals(18, $result['data']['size']);
     $this->assertEquals('httpd/unix-directory', $result['data']['mimetype']);
     $this->assertEquals('abcdef', $result['data']['etag']);
     $icon = \OC_Helper::mimetypeIcon('dir');
     $icon = substr($icon, 0, -3) . 'svg';
     $this->assertEquals($icon, $result['data']['icon']);
 }
Ejemplo n.º 8
0
 /**
  * get all shares
  *
  * @param array $params option 'file' to limit the result to a specific file/folder
  * @return \OC_OCS_Result share information
  */
 public static function getAllShares($params)
 {
     if (isset($_GET['shared_with_me']) && $_GET['shared_with_me'] !== 'false') {
         return self::getFilesSharedWithMe();
     }
     // if a file is specified, get the share for this file
     if (isset($_GET['path'])) {
         $params['itemSource'] = self::getFileId($_GET['path']);
         $params['path'] = $_GET['path'];
         $params['itemType'] = self::getItemType($_GET['path']);
         if (isset($_GET['reshares']) && $_GET['reshares'] !== 'false') {
             $params['reshares'] = true;
         } else {
             $params['reshares'] = false;
         }
         if (isset($_GET['subfiles']) && $_GET['subfiles'] !== 'false') {
             return self::getSharesFromFolder($params);
         }
         return self::collectShares($params);
     }
     $shares = \OCP\Share::getItemShared('file', null);
     if ($shares === false) {
         return new \OC_OCS_Result(null, 404, 'could not get shares');
     } else {
         foreach ($shares as &$share) {
             if ($share['item_type'] === 'file' && isset($share['path'])) {
                 $share['mimetype'] = \OC_Helper::getFileNameMimeType($share['path']);
                 if (\OC::$server->getPreviewManager()->isMimeSupported($share['mimetype'])) {
                     $share['isPreviewAvailable'] = true;
                 }
                 $share['icon'] = substr(\OC_Helper::mimetypeIcon($share['mimetype']), 0, -3) . 'svg';
             }
             if (!is_null($share['token'])) {
                 $share['url'] = \OC::$server->getURLGenerator()->linkToRouteAbsolute('files_sharing.sharecontroller.showShare', ['token' => $share['token']]);
             }
         }
         return new \OC_OCS_Result($shares);
     }
 }
 /**
  * lists the documents the user has access to (including shared files, once the code in core has been fixed)
  * also adds session and member info for these files
  */
 public static function listAll()
 {
     self::preDispatch();
     $documents = Storage::getDocuments();
     $fileIds = array();
     //$previewAvailable = \OCP\Preview::show($file);
     foreach ($documents as $key => $document) {
         //\OCP\Preview::show($document['path']);
         $documents[$key]['icon'] = preg_replace('/\\.png$/', '.svg', \OC_Helper::mimetypeIcon($document['mimetype']));
         $fileIds[] = $document['fileid'];
     }
     usort($documents, function ($a, $b) {
         return @$b['mtime'] - @$a['mtime'];
     });
     $session = new Db_Session();
     $sessions = $session->getCollectionBy('file_id', $fileIds);
     $members = array();
     $member = new Db_Member();
     foreach ($sessions as $session) {
         $members[$session['es_id']] = $member->getActiveCollection($session['es_id']);
     }
     \OCP\JSON::success(array('documents' => $documents, 'sessions' => $sessions, 'members' => $members));
 }
Ejemplo n.º 10
0
            <?php 
p($l->t('Save SVG'));
?>
        </a></li>
		<li><a href="#pngExport">
            <img src="<?php 
print_unescaped(OC_Helper::mimetypeIcon("image/png"));
?>
" class="mimetypeTab" />
            <?php 
p($l->t('Export PNG'));
?>
        </a></li>
		<li><a href="#pdfExport">
            <img src="<?php 
print_unescaped(OC_Helper::mimetypeIcon("application/pdf"));
?>
" class="mimetypeTab" />
            <?php 
p($l->t('Export PDF'));
?>
        </a></li>
	</ul>
	<div id="svgSave">
		<input type="text" id="svgSavePath" value="" />
		<input type="button" id="svgSaveBtn" value="<?php 
p($l->t('Save'));
?>
" />
        <div class="separator"></div>
		<input type="button" id="svgDownloadBtn" value="<?php 
Ejemplo n.º 11
0
         $files[$key]['type'] = 'file';
         $files[$key]['date'] = \OCP\Util::formatDate($file['storage_mtime']);
         unset($files[$key]['storage_mtime']);
         $files[$key]['mtime'] = $file['mtime'] * 1000;
         $files[$key]['parentId'] = $file['parent'];
         unset($files[$key]['parent']);
         $files[$key]['permissions'] = (int) $file['permissions'];
         $files[$key]['isPreviewAvailable'] = true;
     }
 } else {
     //将mimetype转换为字符串
     foreach ($files as $key => $file) {
         foreach ($mimetypesrow as $mime) {
             if ($file['mimetype'] == $mime['id']) {
                 $files[$key]['mimetype'] = $mime['mimetype'];
                 $files[$key]['icon'] = \OC_Helper::mimetypeIcon($mime['mimetype']);
             }
         }
         $files[$key]['id'] = $file['fileid'];
         unset($files[$key]['path_hash']);
         //重组path
         if ($file['storage'] == $locastorage) {
             $files[$key]['path'] = "/";
         } else {
             foreach ($mounts as $mountkey => $mount) {
                 if ($file['storage'] == $mount['storage_id']) {
                     $newdir = substr($mountkey, strrpos($mountkey, '/'));
                     if (substr($file['path'], 0, strrpos($file['path'], '/')) != "") {
                         $files[$key]['path'] = $newdir . '/' . substr($file['path'], 0, strrpos($file['path'], '/'));
                     } else {
                         $files[$key]['path'] = $newdir;
Ejemplo n.º 12
0
 /**
  * test rename of file with tag
  */
 function testRenameFileWithTag()
 {
     $taggerMock = $this->getMock('\\OCP\\ITags');
     $taggerMock->expects($this->any())->method('getTagsForObjects')->with(array(123))->will($this->returnValue(array(123 => array('tag1', 'tag2'))));
     $tagManagerMock = $this->getMock('\\OCP\\ITagManager');
     $tagManagerMock->expects($this->any())->method('load')->with('files')->will($this->returnValue($taggerMock));
     $oldTagManager = \OC::$server->query('TagManager');
     \OC::$server->registerService('TagManager', function ($c) use($tagManagerMock) {
         return $tagManagerMock;
     });
     $dir = '/';
     $oldname = 'oldname.txt';
     $newname = 'newname.txt';
     $this->viewMock->expects($this->any())->method('file_exists')->with($this->anything())->will($this->returnValueMap(array(array('/', true), array('/oldname.txt', true))));
     $this->viewMock->expects($this->any())->method('getFileInfo')->will($this->returnValue(new \OC\Files\FileInfo('/new_name.txt', new \OC\Files\Storage\Local(array('datadir' => '/')), '/', array('fileid' => 123, 'type' => 'file', 'mimetype' => 'text/plain', 'mtime' => 0, 'permissions' => 31, 'size' => 18, 'etag' => 'abcdef', 'directory' => '/', 'name' => 'new_name.txt'), null)));
     $result = $this->files->rename($dir, $oldname, $newname);
     $this->assertTrue($result['success']);
     $this->assertEquals(123, $result['data']['id']);
     $this->assertEquals('new_name.txt', $result['data']['name']);
     $this->assertEquals(18, $result['data']['size']);
     $this->assertEquals('text/plain', $result['data']['mimetype']);
     $this->assertEquals('abcdef', $result['data']['etag']);
     $this->assertEquals(array('tag1', 'tag2'), $result['data']['tags']);
     $this->assertEquals('/', $result['data']['path']);
     $icon = \OC_Helper::mimetypeIcon('text');
     $icon = substr($icon, 0, -3) . 'svg';
     $this->assertEquals($icon, $result['data']['icon']);
     \OC::$server->registerService('TagManager', function ($c) use($oldTagManager) {
         return $oldTagManager;
     });
 }
Ejemplo n.º 13
0
 /**
  * Defines the media icon, for the media type of the original file, as the preview
  */
 private function getMimeIcon()
 {
     $image = new \OC_Image();
     $mimeIconWebPath = \OC_Helper::mimetypeIcon($this->mimeType);
     if (empty(\OC::$WEBROOT)) {
         $mimeIconServerPath = \OC::$SERVERROOT . $mimeIconWebPath;
     } else {
         $mimeIconServerPath = str_replace(\OC::$WEBROOT, \OC::$SERVERROOT, $mimeIconWebPath);
     }
     $image->loadFromFile($mimeIconServerPath);
     $this->preview = $image;
 }
Ejemplo n.º 14
0
 /**
  * @param string $messageId
  * @param $accountId
  * @param $folderId
  * @return callable
  */
 private function enrichDownloadUrl($accountId, $folderId, $messageId, $attachment)
 {
     $downloadUrl = \OCP\Util::linkToRoute('mail.messages.downloadAttachment', ['accountId' => $accountId, 'folderId' => $folderId, 'messageId' => $messageId, 'attachmentId' => $attachment['id']]);
     $downloadUrl = \OC::$server->getURLGenerator()->getAbsoluteURL($downloadUrl);
     $attachment['downloadUrl'] = $downloadUrl;
     $attachment['mimeUrl'] = \OC_Helper::mimetypeIcon($attachment['mime']);
     return $attachment;
 }
Ejemplo n.º 15
0
?>
" id="sharingToken">
<input type="hidden" name="filename" value="<?php 
p($_['filename']);
?>
" id="filename">
<input type="hidden" name="mimetype" value="<?php 
p($_['mimetype']);
?>
" id="mimetype">
<input type="hidden" name="previewSupported" value="<?php 
p($previewSupported);
?>
" id="previewSupported">
<input type="hidden" name="mimetypeIcon" value="<?php 
p(OC_Helper::mimetypeIcon($_['mimetype']));
?>
" id="mimetypeIcon">
<input type="hidden" name="filesize" value="<?php 
p($_['nonHumanFileSize']);
?>
" id="filesize">
<input type="hidden" name="maxSizeAnimateGif" value="<?php 
p($_['maxSizeAnimateGif']);
?>
" id="maxSizeAnimateGif">


<header><div id="header" class="<?php 
p(isset($_['folder']) ? 'share-folder' : 'share-file');
?>
Ejemplo n.º 16
0
 /**
  * @brief offer preview for download
  *
  * if no preview exists for this file, send icon instead
  * 
  * @param string $path full path to file
  * @param string type type of preview requested
  */
 public static function servePreview($path, $type)
 {
     \OCP\User::checkLoggedIn();
     \OC::$server->getSession()->close();
     $i = \OC\Files\Filesystem::getFileInfo($path, false);
     /* check for predefined cover, if found replace $path with that of cover file */
     $meta = Meta::get($i['fileid']);
     if ($meta['cover']) {
         $path = pathinfo($path)['dirname'] . '/' . $meta['cover'];
         $i = \OC\Files\Filesystem::getFileInfo($path, false);
     }
     if (\OC::$server->getPreviewManager()->isMimeSupported($i['mimetype'])) {
         $preview = new \OC\Preview(\OC_User::getUser(), 'files');
         $preview->setFile($path);
         switch ($type) {
             case 'cover':
                 $preview->setMaxX(Config::getApp('cover-x', '200'));
                 $preview->setMaxY(Config::getApp('cover-y', '200'));
                 break;
             case 'thumbnail':
                 $preview->setMaxX(Config::getApp('thumb-x', '36'));
                 $preview->setMaxY(Config::getApp('thumb-y', '36'));
                 break;
         }
         $preview->showPreview();
     } else {
         // no preview, serve icon instead
         $scheme = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http';
         header("Location: " . $scheme . "://" . $_SERVER['HTTP_HOST'] . \OC_Helper::mimetypeIcon($i->getMimeType()));
         /* Note: relative URL should be enough (RFC7231) but some OPDS clients
          * (especially those in dedicated book readers) might not support them
          * 
          * header("Location: " . \OC_Helper::mimetypeIcon($i->getMimeType()));
          */
     }
 }
Ejemplo n.º 17
0
 public static function post_shared($args)
 {
     // use this to debug sharing hook emits:
     //OCP\Util::writeLog("notify", "shared hook: " . print_r($args, true), OCP\Util::DEBUG);
     if (!$args["shareWith"]) {
         return;
     }
     switch ($args["itemType"]) {
         case "event":
             self::sendUserNotification("notify", "sharedEvent", $args["shareWith"], array("user" => $args["uidOwner"], "title" => $args["itemTarget"], "href" => OCP\Util::linkTo("calendar", "index.php"), "img" => OCP\Util::imagePath("calendar", "icon.svg")));
             break;
         case "calendar":
             self::sendUserNotification("notify", "sharedCal", $args["shareWith"], array("user" => $args["uidOwner"], "name" => $args["itemTarget"], "href" => OCP\Util::linkTo("calendar", "index.php"), "img" => OCP\Util::imagePath("calendar", "icon.svg")));
             break;
         case "file":
             $params = array("user" => $args["uidOwner"], "name" => $args["fileTarget"], "href" => OCP\Util::linkTo("files", "index.php", array("dir" => "/Shared" . rtrim(dirname($args["fileTarget"]), "/"))));
             // get the mime type icon:
             $fileMimeStmt = OCP\DB::prepare("SELECT mimetype FROM *PREFIX*fscache WHERE id = ?");
             $result = $fileMimeStmt->execute(array($args["fileSource"]));
             if ($result) {
                 $mime = $result->fetchColumn();
                 $mimeParts = explode("/", $mime);
                 if (strtolower($mimeParts[0]) == "image") {
                     $params["img"] = OCP\Util::linkTo("files", "ajax/download.php", array("files" => "/Shared" . $args["fileTarget"]));
                     $params["class"] = "notify_fullImg";
                 } else {
                     $params["img"] = OC_Helper::mimetypeIcon($mime);
                 }
             } else {
                 $mimeImg = OCP\Util::imagePath("core", "filetypes/file.png");
             }
             self::sendUserNotification("notify", "sharedFile", $args["shareWith"], $params);
             break;
         case "folder":
             self::sendUserNotification("notify", "sharedFolder", $args["shareWith"], array("user" => $args["uidOwner"], "name" => $args["fileTarget"], "href" => OCP\Util::linkTo("files", "index.php", array("dir" => "/Shared" . $args["fileTarget"])), "img" => OCP\Util::imagePath("core", "filetypes/folder.png")));
             break;
         case "addressbook":
             self::sendUserNotification("notify", "sharedAbook", $args["shareWith"], array("user" => $args["uidOwner"], "name" => $args["itemTarget"], "href" => OCP\Util::linkTo("contacts", "index.php"), "img" => OCP\Util::imagePath("settings", "users.svg")));
         default:
     }
 }
Ejemplo n.º 18
0
<?php

\OC::$server->getSession()->close();
$mime = isset($_GET['mime']) ? $_GET['mime'] : '';
print OC_Helper::mimetypeIcon($mime);
<?php

$attachment = $_['attachment'];
extract($attachment);
switch ($type) {
    case 'internal_file':
        //use: OC_Helper::previewIcon( $path ); OC_Helper::mimetypeIcon( $mimetype );
        $icon_url = OC_Helper::mimetypeIcon($mimetype);
        //$icon_url = OC::$WEBROOT . "/index.php/core/preview.png?x=36&y=36&file=" . urlencode($path);
        echo '<a href="' . $download_url . '"><img src="' . $icon_url . '" />' . $name . '</a>';
        break;
    case 'internal_image':
        $icon_url = OC::$WEBROOT . "/index.php/core/preview.png?x=200&y=200&file=" . urlencode($path);
        echo '<a href="' . $download_url . '" alt="' . $name . '" title="' . $name . '"><img src="' . $icon_url . '" /></a>';
        //echo '<a href="/owncloud/index.php/apps/gallery/ajax/image.php?file=simi%2Fphotos%2Fparis_neu.jpg" alt="'.$name.'" title="'.$name.'"><img src="/owncloud/index.php/apps/gallery/ajax/thumbnail.php?file=simi%2Fphotos%2Fparis_neu.jpg" /></a>';
        break;
    case 'external_file':
        # code...
        break;
    case 'external_image':
        # code...
        break;
    default:
        # code...
        break;
}
Ejemplo n.º 20
0
/**
 * make OC_Helper::mimetypeIcon available as a simple function
 * @param string $mimetype mimetype
 * @return string link to the image
 *
 * For further information have a look at OC_Helper::mimetypeIcon
 */
function mimetype_icon($mimetype)
{
    return OC_Helper::mimetypeIcon($mimetype);
}
Ejemplo n.º 21
0
            <?php 
echo $l->t('Save SVG');
?>
        </a></li>
		<li><a href="#pngExport">
            <img src="<?php 
echo OC_Helper::mimetypeIcon("image/png");
?>
" class="mimetypeTab" />
            <?php 
echo $l->t('Export PNG');
?>
        </a></li>
		<li><a href="#pdfExport">
            <img src="<?php 
echo OC_Helper::mimetypeIcon("application/pdf");
?>
" class="mimetypeTab" />
            <?php 
echo $l->t('Export PDF');
?>
        </a></li>
	</ul>
	<div id="svgSave">
		<input type="text" id="svgSavePath" value="" />
		<input type="button" id="svgSaveBtn" value="<?php 
echo $l->t('Save');
?>
" />
        <div class="separator"></div>
		<input type="button" id="svgDownloadBtn" value="<?php 
Ejemplo n.º 22
0
<?php

\OC::$session->close();
print OC_Helper::mimetypeIcon($_GET['mime']);
Ejemplo n.º 23
0
 /**
  * @brief test rename of file/folder
  */
 function testRenameFolder()
 {
     $dir = '/';
     $oldname = 'oldname';
     $newname = 'newname';
     $this->viewMock->expects($this->any())->method('getFileInfo')->will($this->returnValue(array('fileid' => 123, 'type' => 'dir', 'mimetype' => 'httpd/unix-directory', 'size' => 18, 'etag' => 'abcdef', 'directory' => '/', 'name' => 'new_name')));
     $result = $this->files->rename($dir, $oldname, $newname);
     $this->assertTrue($result['success']);
     $this->assertEquals(123, $result['data']['id']);
     $this->assertEquals('newname', $result['data']['name']);
     $this->assertEquals('/', $result['data']['directory']);
     $this->assertEquals(18, $result['data']['size']);
     $this->assertEquals('httpd/unix-directory', $result['data']['mime']);
     $this->assertEquals('abcdef', $result['data']['etag']);
     $this->assertEquals(\OC_Helper::mimetypeIcon('dir'), $result['data']['icon']);
     $this->assertFalse($result['data']['isPreviewAvailable']);
 }