diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/indefero/src/IDF/Views/Project.php b/indefero/src/IDF/Views/Project.php index 545f787..a5aa913 100644 --- a/indefero/src/IDF/Views/Project.php +++ b/indefero/src/IDF/Views/Project.php @@ -32,7 +32,7 @@ Pluf::loadFunction('Pluf_Shortcuts_GetFormForModel'); class IDF_Views_Project { /** - * Home page of a project. + * Logo of a project. */ public $logo_precond = array('IDF_Precondition::baseAccess'); public function logo($request, $match) @@ -52,6 +52,25 @@ class IDF_Views_Project $info[0]); } + /** + * Logo of a project. + */ + public $logo64_precond = array('IDF_Precondition::baseAccess'); + public function logo64($request, $match) + { + $prj = $request->project; + + $logo = $prj->getConf()->getVal('logo'); + if (empty($logo)) { + $file = "./media/idf/img/no_logo.png"; + $info = IDF_FileUtil::getMimeType($file); + return new Pluf_HTTP_Response("data:" . $info[0] . ";base64," . base64_encode(file_get_contents($file)), "text/text"); + } + + $info = IDF_FileUtil::getMimeType($logo); + return new Pluf_HTTP_Response("data:" . $info[0] . ";base64," . base64_encode(file_get_contents(Pluf::f('upload_path') . '/' . $prj->shortname . $logo)), "text/text"); + } + /** * Home page of a project. */ diff --git a/indefero/src/IDF/conf/urls.php b/indefero/src/IDF/conf/urls.php index a3f464f..850d83c 100644 --- a/indefero/src/IDF/conf/urls.php +++ b/indefero/src/IDF/conf/urls.php @@ -97,11 +97,18 @@ $ctl[] = array('regex' => '#^/p/([\-\w]+)/$#', 'model' => 'IDF_Views_Project', 'method' => 'home'); +$ctl[] = array('regex' => '#^/p/([\-\w]+)/logo64/$#', + 'base' => $base, + 'model' => 'IDF_Views_Project', + 'method' => 'logo64'); + $ctl[] = array('regex' => '#^/p/([\-\w]+)/logo/$#', 'base' => $base, 'model' => 'IDF_Views_Project', 'method' => 'logo'); + + $ctl[] = array('regex' => '#^/p/([\-\w]+)/timeline/(\w+)/$#', 'base' => $base, 'model' => 'IDF_Views_Project', diff --git a/indefero/src/IDF/templates/idf/base-full.html b/indefero/src/IDF/templates/idf/base-full.html index 68a4f25..77f8998 100644 --- a/indefero/src/IDF/templates/idf/base-full.html +++ b/indefero/src/IDF/templates/idf/base-full.html @@ -32,12 +32,14 @@ {block extraheader}{/block}