if (strpos ($class, "Syj_") === 0) {
$segments = explode ('_', $class);
+ if (count($segments) < 2) {
+ return;
+ }
+
+ if (count($segments) == 2) {
+ $filename = APPLICATION_PATH . '/' . end($segments) . '.php';
+ if (Zend_Loader::isReadable($filename)) {
+ include_once $filename;
+ }
+ return;
+ }
+
if (count($segments) < 3) {
return;
}
--- /dev/null
+<?php
+/* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
+ and is published under the AGPL license. */
+
+class Syj_Version {
+ const VERSION = "$SYJVERSION$";
+}
scripts.list = OpenLayers, prototype, utils, list
scripts.account = prototype, utils, account
+css.idx = olstyle, generic, syj, syjprint:print
+css.rawidx = generic, syjraw, syjrawprint:print
+css.login = generic, form, login
+css.pending = generic, form, pending
+css.contact = generic, form, contact
+css.faq = generic, faq
+css.newpwd = generic, form, newpwd
+css.error = generic, error
+css.termsofuse = generic, termsofuse
+css.list = generic, list
+css.account = generic, form, account
+
[development:production]
public function init() {
$this->_helper->SyjUserManager->needsLogin();
$this->_helper->SyjMedias->addScripts('account');
+ $this->_helper->SyjMedias->addStyleSheets('account');
- $this->view->headLink()->appendStylesheet('css/generic.css', 'all');
- $this->view->headLink()->appendStylesheet('css/form.css', 'all');
- $this->view->headLink()->appendStylesheet('css/account.css', 'all');
$this->view->headTitle($this->view->translate("my account"));
}
public function init() {
$this->_helper->SyjMedias->addScripts('contact');
- $this->view->headLink()->appendStylesheet('css/generic.css', 'all');
- $this->view->headLink()->appendStylesheet('css/form.css', 'all');
- $this->view->headLink()->appendStylesheet('css/contact.css', 'all');
+ $this->_helper->SyjMedias->addStyleSheets('contact');
$this->view->headTitle($this->view->translate("contact form"));
}
public function init() {
$this->_helper->SyjReset->resetPlaceHolders();
- $this->view->headLink()->appendStylesheet('css/generic.css', 'all');
- $this->view->headLink()->appendStylesheet('css/error.css', 'all');
+ $this->_helper->SyjMedias->addStyleSheets('error');
}
public function errorAction() {
class FaqController extends Zend_Controller_Action
{
public function indexAction() {
- $this->view->headLink()->appendStylesheet('css/generic.css', 'all');
- $this->view->headLink()->appendStylesheet('css/faq.css', 'all');
+ $this->_helper->SyjMedias->addStyleSheets('faq');
$this->view->headTitle($this->view->translate("Frequently asked questions"));
}
}
public function init() {
$this->_helper->SyjMedias->addScripts('idx');
- $this->view->headLink()->appendStylesheet('css/olstyle.css', "all");
- $this->view->headLink()->appendStylesheet('css/generic.css', "all");
- $this->view->headLink()->appendStylesheet('css/syj.css', "all");
- $this->view->headLink()->appendStylesheet('css/syjprint.css', "print");
+ $this->_helper->SyjMedias->addStyleSheets('idx');
$this->view->headMeta()->appendName('viewport', 'width=640px');
}
public function rawmode(Syj_Model_Path $path) {
$this->_helper->SyjReset->resetPlaceHolders();
$this->_helper->SyjMedias->addScripts('rawidx');
+ $this->_helper->SyjMedias->addStyleSheets('rawidx');
- $this->view->headLink()->appendStylesheet('css/generic.css', "screen");
- $this->view->headLink()->appendStylesheet('css/syjraw.css', "screen");
- $this->view->headLink()->appendStylesheet('css/syjprint.css', "print");
$this->view->headTitle($path->displayTitle);
$this->_jsRawLocaleStrings();
$this->_helper->SyjUserManager->needsLogin();
$this->_helper->SyjMedias->addScripts('list');
+ $this->_helper->SyjMedias->addStyleSheets('list');
- $this->view->headLink()->appendStylesheet('css/generic.css', 'all');
- $this->view->headLink()->appendStylesheet('css/list.css', 'all');
$this->view->headTitle($this->view->translate("my routes"));
}
public function init() {
$this->view->headTitle($this->view->translate("login"));
$this->_helper->SyjMedias->addScripts('login');
- $this->view->headLink()->appendStylesheet('css/generic.css', 'all');
- $this->view->headLink()->appendStylesheet('css/form.css', 'all');
- $this->view->headLink()->appendStylesheet('css/login.css', 'all');
+ $this->_helper->SyjMedias->addStyleSheets('login');
}
public function loginAction() {
public function init() {
$this->_helper->SyjMedias->addScripts('newpwd');
- $this->view->headLink()->appendStylesheet('css/generic.css', 'all');
- $this->view->headLink()->appendStylesheet('css/form.css', 'all');
- $this->view->headLink()->appendStylesheet('css/newpwd.css', 'all');
+ $this->_helper->SyjMedias->addStyleSheets('newpwd');
}
public function indexAction() {
{
public function init() {
- $this->view->headLink()->appendStylesheet('css/generic.css', 'all');
- $this->view->headLink()->appendStylesheet('css/form.css', 'all');
- $this->view->headLink()->appendStylesheet('css/pending.css', 'all');
+ $this->_helper->SyjMedias->addStyleSheets('pending');
}
public function indexAction() {
class TermsofuseController extends Zend_Controller_Action
{
public function indexAction() {
- $this->view->headLink()->appendStylesheet('css/generic.css', 'all');
- $this->view->headLink()->appendStylesheet('css/termsofuse.css', 'all');
+ $this->_helper->SyjMedias->addStyleSheets('termsofuse');
$this->view->headTitle($this->view->translate("terms of use"));
$this->view->rawmode = ($this->getRequest()->getQuery('format') == 'raw');
}
public function addScripts($action) {
$view = $this->getActionController()->view;
if (APPLICATION_ENV == "production") {
- $view->headScript()->appendFile('js/' . $action . '.js');
+ $view->headScript()->appendFile('js/' . $action . '.js' . '?' . Syj_Version::VERSION);
return;
}
$scripts = explode(',', $this->_config->get('scripts')->get($action));
$view->headScript()->appendFile('js/' . trim($name) . '.js');
}
}
+
+ public function addStyleSheets($action) {
+ $view = $this->getActionController()->view;
+ if (APPLICATION_ENV == "production") {
+ $suffix = '?' . Syj_Version::VERSION;
+ } else {
+ $suffix = '';
+ }
+
+ $sheets = explode(',', $this->_config->get('css')->get($action));
+ foreach ($sheets as $sheet) {
+ $arr = explode(':', $sheet);
+ $arr = array_map('trim', $arr);
+ $href = 'css/' . $arr[0] . '.css' . $suffix;
+ $medias = array_slice($arr, 1);
+ if (!$medias) {
+ $medias = "all";
+ }
+ $view->headLink()->appendStylesheet($href, $medias);
+ }
+ }
}
/* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
and is published under the AGPL license. */
-.olControlPanZoom, .olControlAttribution, .olControlLayerSwitcher {
+.olControlPanZoom, .olControlLayerSwitcher {
display: none;
}
#message, #other-language, #menu, #user_area, #login_area, #newpwd_area, #termsofusearea, footer, #map-overlay {
--- /dev/null
+/* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
+ and is published under the AGPL license. */
+body, html {
+ margin: 0; padding: 0;
+ width: 100%;
+ height: 100%;
+}
+
+/* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
+ and is published under the AGPL license. */
+
+#map {
+ border: 1px solid;
+ position: static;
+ margin: 0;
+}
+
+@page {
+ size: landscape;
+}
+
+.olControlAttribution {
+ bottom: 0.5em;
+ left: 0.5em;
+ font-size: smaller;
+}
"mod_rewrite",
"mod_compress",
"mod_fastcgi",
- "mod_accesslog",
+ "mod_accesslog",
+ "mod_expire",
)
fastcgi.server += ( ".php" =>
compress.cache-dir = "/data/work/syj/lighttpd/lighttpd-cache"
compress.filetype = ( "application/javascript", "text/css")
+$HTTP["url"] =~ "\.js$|\.css$|\.png$" {
+ expire.url = ( "" => "access plus 1 years" )
+}
import shutil, os, sys, subprocess, tempfile, tarfile, glob, ConfigParser
pathjoin = os.path.join
+def updateversion():
+ try:
+ import git
+ repo = git.Repo('.')
+ master = repo.commits()[0]
+ tag = (filter(lambda tag: tag.commit.id == master.id, repo.tags) or [""])[0]
+ if tag:
+ version = tag.name
+ except ImportError:
+ version = subprocess.Popen(['git', 'tag', '-l', '--contains', 'master'], stdout=subprocess.PIPE).communicate()[0][:-1]
+ if not version:
+ raise AssertionError, "master is not tagged"
+
+ fd, fname = tempfile.mkstemp()
+ f = os.fdopen(fd, 'w')
+ versionfile = 'build/application/Version.php'
+ with open('build/application/Version.php') as source:
+ for line in source:
+ f.write(line.replace('$SYJVERSION$', version))
+ f.close()
+ shutil.move(fname, versionfile)
+
def compress(path):
tmpout = tempfile.TemporaryFile()
subprocess.Popen(['yui-compressor', path], stdout=tmpout).communicate()
install(source, target)
+ updateversion()
+
print "creating syj.tar.gz"
targz = tarfile.open("build/syj.tar.gz", "w:gz")
for path in glob.glob(pathjoin(__BUILD__, '*')):