Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iks branch merge #50

Merged
merged 80 commits into from
Mar 25, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
590e077
Added support for subjects
fabian Nov 28, 2011
58b6c0c
Renamed to tags
fabian Nov 28, 2011
20f3979
adjustet markup for article settings
Nov 30, 2011
cd53ea4
added script for jackrabbit
Nov 30, 2011
0e96f74
Use iks branch
fabian Dec 1, 2011
2c299e9
Updated VIE
fabian Dec 1, 2011
1848d18
Use latest VieBundle from branch IKS
fabian Dec 1, 2011
7041d0c
Remove hiddenfield.js
fabian Dec 2, 2011
fca6278
Overlay settings
fabian Dec 2, 2011
e42dcfd
Added CSS for Link Panel
podlebar Dec 5, 2011
e7546d3
Show links
fabian Dec 7, 2011
e0f970f
Vie sometimes mixes them
fabian Dec 7, 2011
8110c2a
changed location of image.css
podlebar Dec 8, 2011
13f666d
Cleanup
fabian Dec 8, 2011
3b96def
fixed design for tags
Dec 8, 2011
a557cdf
cleanup: removed VIE stuff
Dec 8, 2011
7621f95
cleanup sorted css by id/class
Dec 8, 2011
5dc8d14
Proper menu in fixtures
fabian Dec 9, 2011
7f201c6
Some styling
fabian Dec 9, 2011
cac7fa6
Fixed navigation position
fabian Dec 12, 2011
151e0c3
Fixed Subpages save
Dec 12, 2011
a4dffea
Added base for image upload
fabian Dec 12, 2011
5f63ed0
Set vie_plugins_link_related_path
fabian Dec 12, 2011
9675131
dummy response
podlebar Dec 13, 2011
6dffdb0
fixed annotations
Dec 13, 2011
63ac2ce
WHITESPACE
Dec 13, 2011
1500e48
added Imagecontroller save image into jackrabbit
Dec 13, 2011
c75f4ac
fixed construct error
Dec 14, 2011
9556cdf
fixed controller return for image upload
Dec 14, 2011
c85c418
fixed Pathname problem when no file found
Dec 14, 2011
7285291
CMFE-69 Added tags and removed unneeded setContent method
fabian Dec 15, 2011
d0c1418
CMFE-69 Display image
fabian Dec 15, 2011
9d2aac5
added langageselecter to header
Dec 15, 2011
fb2b4bc
Fixed position of lang
fabian Dec 19, 2011
7eca9fa
Merge branch 'master' of github.com:liip/cmf-sandbox into iks
fabian Feb 6, 2012
8f16826
Updated VieBundle
fabian Feb 6, 2012
9236808
RDFa flexibility
fabian Feb 6, 2012
9164993
Merge branch 'refs/heads/master' into iks
fabian Feb 6, 2012
5060caa
Merge fixes
fabian Feb 6, 2012
5deb866
More merge fixes (in CSS)
fabian Feb 6, 2012
c94e453
Merge fault
fabian Feb 6, 2012
6766f3d
fixed height for navigation/content
Feb 6, 2012
da2c4f9
design navigation
Feb 6, 2012
376fbd3
added .DS_Store to .gitignore
Feb 6, 2012
520b0b8
removed old css stuff
Feb 6, 2012
5af67ea
deleted rest of NavigationBundle, which got deleted in f9a109eac0
Feb 6, 2012
d59fbd7
fixed background for breadcrumb
Feb 6, 2012
70eefb9
added css for createjs new tags
Feb 6, 2012
eeb8644
bump LiipVieBundle commit-id
rndstr Feb 6, 2012
632037d
added property to index.hmtl
Feb 6, 2012
f320b8c
updated jack script
Feb 7, 2012
1dcd4dc
make content textarea
Feb 7, 2012
5ac8675
bump LiipVieBundle
rndstr Feb 7, 2012
9d7718d
added Liip IP to dev array
Feb 7, 2012
1ff44df
remove deprecated `alias' annotation from Image
rndstr Feb 7, 2012
f857450
add clearfix to article paragraphs
rndstr Feb 7, 2012
1f007d8
bump LiipVieBundle
rndstr Feb 7, 2012
2fb05e0
changed to new VIEbundle
Feb 8, 2012
04bc953
updated css path to new theme
Feb 8, 2012
6b90bed
Fixed Tags CSS
fabian Feb 9, 2012
77941c5
Updated VieBundle
fabian Feb 9, 2012
77427b2
Fixed CSS
fabian Feb 9, 2012
bae0912
Updated LiipVieBundle
fabian Mar 9, 2012
ab0b939
Merge branch 'refs/heads/iks'
fabian Mar 9, 2012
4128afc
Moved vie_plugins_link_related_path to VieBundle
fabian Mar 9, 2012
c70358d
Updated VieBundle
fabian Mar 9, 2012
fd5ba4a
Fixed home link
fabian Mar 9, 2012
874a957
Updated VieBundle
fabian Mar 9, 2012
d072623
don't save tags twice
Mar 14, 2012
b1fb7fe
Updated VieBundle (Fix for Tags)
fabian Mar 14, 2012
d4a706e
Update VieBundle
fabian Mar 14, 2012
47f611c
Added missing path config
fabian Mar 14, 2012
12aa6d3
Updated VieBundle (Fixed Submodule)
fabian Mar 14, 2012
2e95d97
Updated VieBundle
fabian Mar 15, 2012
13dd45d
Updated VieBundle
fabian Mar 15, 2012
bc10a36
Updated VieBundle
fabian Mar 15, 2012
53eaea7
Merge branch 'master' into iks
lsmith77 Mar 20, 2012
4efa731
latest version is 2.4.0
lsmith77 Mar 20, 2012
18610a8
removing weird ip from app_dev.php and adding comments to warn about …
dbu Mar 23, 2012
2937c1a
Merge remote-tracking branch 'origin/master' into iks
lsmith77 Mar 25, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ app/config/parameters.yml
nbproject
.idea
vagrant/.vagrant
.DS_Store
3 changes: 3 additions & 0 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ liip_vie:
map:
'<http://rdfs.org/sioc/ns#Post>': 'Sandbox\MainBundle\Document\EditableStaticContent'
use_coffee: %liip_vie.use_coffee%
# TODO: these settings should come from the corresponding bundles, not be duplicated
base_path: /cms/routes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably come from the config value of the routing bundle. but thats a viebundle issue, not related to this merge.

cms_path: /cms/content/static

sonata_block:
default_contexts: [cms]
Expand Down
12 changes: 12 additions & 0 deletions app/config/routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ test:
pattern: /hello
defaults: { _controller: SandboxTestBundle:Test:index }

image_upload:
pattern: /image/upload/
defaults: { _controller: sandbox_main.image_controller:uploadAction, _format: json }
requirements:
_format: json

image_display:
pattern: /image/{id}
defaults: { _controller: sandbox_main.image_controller:displayAction }
requirements:
id: '[A-Za-z0-9\.]+'

vie:
resource: "@LiipVieBundle/Resources/config/routing/phpcr_odm.xml"

Expand Down
32 changes: 16 additions & 16 deletions deps.lock
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
symfony 632077aa819d0321e74a2f1b9d388af88bdcac0d
symfony ffddddb3ea7c03ac15f9e7725eb0b3aaa8bc26a6
twig 30929fde86f5ee12c863a3b572b0457ce52c140b
monolog b704c49a3051536f67f2d39f13568f74615b9922
MonologBundle 289442e385e7c0fe4aa2e8884d11e774a8f9ad99
doctrine-common d62352cc721fd05001eacdf0b527a142d3219e0f
jackalope 151cf1c4d88bd4daba521df6e947f80adc524f12
jackalope-jackrabbit a8043d466f7bb62ac9b9916fdf74df9ddbe741ab
jackalope-doctrine-dbal caec879788519cc6d0f9cfc2483e5b242c60f298
jackalope 6dc23881a12d3f98ce6cef240efd60e83c4caa12
jackalope-jackrabbit fa1f7e97f6041cf103cafcf122dd96b618895e1f
jackalope-doctrine-dbal f80826ace27bda81eea5f96cc1bb45ad6378775b
DoctrineBundle 90e39fb7ff5b4c13577602dab7e08c90067160b4
doctrine-dbal 220a5b0a05214d19dceea01e648d1413bba243c3
doctrine-dbal d9c3509e8d8fd8cb3887930c1d701ec118579289
doctrine 1b2b831febb780d8153bc4f8684baa763dd8f177
phpcr 09b07493dc60a45ce69108eb60f3eec50f8d9dd8
phpcr-utils 992b32af975ec7c3a3eb0032aa812487ea7172d4
doctrine-phpcr-odm 4c015c6aa48f58d0c35303e648c98d3810f098f7
DoctrinePHPCRBundle d221cd28dbb5287224b785b9e51fc1d59b3cfad1
phpcr 45bb7a8bbfbf175afb5abe64f115a9c5c8e454a2
phpcr-utils c9c4dcef8f3da099550a66d94120b68ed7dbfc1e
doctrine-phpcr-odm c4fc642c872e0eef699c50beeae90b821ea7cfbc
DoctrinePHPCRBundle 7213f0b8b02481b8d2811c0d488061dcf8b94081
DoctrineFixturesBundle 0e4e56b1da7981bcc7729e0f301a75195d34df18
doctrine-data-fixtures aea0b95a554188892f10d8f09ce3ae8150f28f8b
swiftmailer 982b4c9498b7dd85e70f6d35e65d909c888e6345
Expand All @@ -21,19 +21,19 @@ assetic 2634d29cc193981761e3daf28e1afc6358bb43b1
twig-extensions 1dfff8e793f50f651c4f74f796c2c68a4aee3147
metadata 84088bc4f6e2387ec8b549bffc1e037107572f5a
AsseticBundle b9cff021abc3d9433a892fa9908d9856393c0d09
FunctionalTestBundle a4ec2097dc375eb81e46c8608f920c7069414548
FunctionalTestBundle 14a4ee55fc49757f44382d15486f7c5e3eb9c3f6
VieBundle 0433d0fa6051e78bae872f1caeb213bc89cb8409
FOSRest 5eb800bd63ba84e5fc7028386cb66373bc3efafc
FOSRestBundle c95088f6207e37afbfa24c9c81b62baca5f4ef89
FOSRestBundle c11ab9d990a1e0e979b1c8ab72cc9793b4b2dcb5
FOSJsRoutingBundle bc61ffe5c4186a8ac206a8c68de221bc48e8a436
JMSSerializerBundle 27fbaafc4dcfa7dae2160b4efde5f8543e2bc3f4
knp-menu f818c58d89885c5eb1e305f5b7360588fd49fbab
KnpMenuBundle 462b7b40e5c17813a6d14929d7bca7d0511c7736
symfony-cmf 247292f8a357414df036ea6cc5d1e08de826b8fb
JMSSerializerBundle 93d9e6d50d6901632b6d5fa2280718733ce9c4f2
knp-menu f7970583d4da8776c037e2d49878d8160361e373
KnpMenuBundle c20933d2b988a3bd0944a0fd9e00068c30f0d27f
symfony-cmf 6e1e3eb018ee8b14eb39cb153b6119f0da1164ed
ChainRoutingBundle edd9f9544eadedb142fefd3ea9bb0c3b293c59d5
SonataCacheBundle f82a6d42052b226b09e16a0b7d519ee8906c6cdc
SonataBlockBundle ff34c3fe75bcedc739f3d4f8ad7f0a3b840b75e4
SonatajQueryBundle 01ffb8d1a7a4bb3971aed003e4f1ef050a0701aa
SonataAdminBundle 89b8a91ed81e555bf668947631718f4838ca1186
SonataAdminBundle abf2df4642937f063936f3a9de328ea12b20113c
SonataDoctrinePHPCRAdminBundle beb8d31ac03a89c811f25ecde18dbe3e3d31cf48
TreeBundle 10e8c1b15902990f51e62a2f94bf7cacaa956074
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the update to latest versions of all those? i assume that our branch had very outdated versions?

197 changes: 197 additions & 0 deletions jack
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
#!/bin/bash

cd $(dirname $0)

# use * for newest available locally
RABBITVERSION="2.4.0"

# one per line
MIRRORS="https://s3-eu-west-1.amazonaws.com/patched-jackrabbit/
http://mirror.switch.ch/mirror/apache/dist//jackrabbit/$RABBITVERSION"

action="$1"; shift
args="$*"

pidfile=${TMPDIR:-/tmp}/jack.pid

JAR=

usage() {
echo "usage: $(basename $0) <action> [args]"
echo
echo "actions:"
echo -e " start\t\tStarts jackrabbit in the background with the given arguments"
echo -e " stop\t\tStops jackrabbit"
echo -e " restart\tRestarts jackrabbit"
echo -e " status\tPrint current status of jackrabbit (running, stopped)"
echo -e " log\t\tTails the logfile"
echo -e " clear\t\tResets index"
echo -e " flush\t\tWipes the db"
echo -e " flush:article\tRemoves today's articles (alternatively, use 'all' for removing all articles or pass the subpath to delete, e.g., '2011/04/26')"

}

if [ -z "$action" ]; then
usage
exit 1
fi

# kills jackrabbit and sleeps till process dies
# prints the id of the process previously active process (or empty if it wasn't running)
stop_jackrabbit() {
local id=$(cat $pidfile 2>/dev/null)

if [ -n "$id" ]; then
kill $id 2>/dev/null

# wait till process dies
kill -0 $id
while [[ $? -eq 0 ]]; do
sleep 1
kill -0 $id 2>/dev/null
done
fi
rm -f $pidfile
echo $id
}

verify_jackrabbit() {
local name="jackrabbit-standalone-$RABBITVERSION.jar"
JAR="$(ls -1 $name 2>/dev/null | tail -n 1)"

if [ -z "$JAR" ]; then
if [ "$RABBITVERSION" = "*" ]; then
echo "No file found matching $name"
echo "Get it at http://mirror.switch.ch/mirror/apache/dist/jackrabbit/"
exit 1
fi

read -p "$name not found. Download? [y/N] "
echo
if [[ ! $REPLY =~ [Yy] ]]; then
exit
fi
JAR="$name"

echo "Be patient, this might take a minute..."
for m in $MIRRORS; do
url="${m%/}/$name"
echo -n "Downloading from $url"
code=$(curl -w %{http_code} -s $url -o jackrabbit.jar.tmp)
if [ $code != "200" ]; then
echo " [FAILED: $code]"
continue
fi
echo " [OKAY]"
mv jackrabbit.jar.tmp $name
done
rm -f jackrabbit.jar.tmp
fi
}

# starts jackrabbit in the background
start_jackrabbit() {

verify_jackrabbit

if [ -e "$JAR" ]; then

# already running?
if [ -e $pidfile ]; then
echo "jackrabbit seems to be running ($pidfile)"
echo "Use \`jack restart\` or \`jack stop\`"
exit 1
fi

echo "Starting in the background using: $JAR"
java -Xmx512m -Xms512m -jar $JAR $args &
echo $! > $pidfile

else
echo "File not found: $JAR"
exit 1
fi
}

status_jackrabbit() {
if [ ! -e $pidfile ]; then
echo "Not running ($pidfile not found)"
else
echo "Running ($pidfile says $(cat $pidfile))"
fi
}


case "$action" in
clear)
wasrunning=$(stop_jackrabbit)
rm -rf jackrabbit/repository/index
rm -rf jackrabbit/workspaces/nzz/index
rm -rf jackrabbit/workspaces/nzz_test/index
echo 'Cleared repository and workspace.'
[ $wasrunning ] && start_jackrabbit
;;
flush:article)
[ -z $args ] && args=$(date +%Y/%m/%d)
[ $args = "all" ] && args=""
# TODO extract port from $args
curl -X DELETE http://admin:admin@localhost:8080/server/nzz/jcr:root/article/$args
;;

flush)
read -p "This will truncate the DB. Continue? [y/N]"
if [[ ! $REPLY =~ [Yy] ]]; then
exit
fi
wasrunning=$(stop_jackrabbit)
rm -rf jackrabbit/repository/datastore
rm -rf jackrabbit/repository/index
rm -rf jackrabbit/workspaces/nzz/index
rm -rf jackrabbit/workspaces/nzz/db
rm -rf jackrabbit/version
echo 'Flushed repository and workspace.'
[ $wasrunning ] && start_jackrabbit
;;

flush:test)
read -p "This will truncate the test DB. Continue? [y/N]"
if [[ ! $REPLY =~ [Yy] ]]; then
exit
fi
wasrunning=$(stop_jackrabbit)
# rm -rf jackrabbit/repository/datastore
# rm -rf jackrabbit/repository/index
rm -rf jackrabbit/workspaces/nzz_test/index
rm -rf jackrabbit/workspaces/nzz_test/db
rm -rf jackrabbit/version
echo 'Flushed repository and workspace.'
[ $wasrunning ] && start_jackrabbit
;;

register)
app/console doctrine:phpcr:register-system-node-types --allow-update
app/console doctrine:phpcr:register-node-types ./script/nzz_unstructure.cnd --allow-update
;;
log)
tail -f jackrabbit/log/jackrabbit.log
;;
stop)
stop_jackrabbit >/dev/null
;;
restart)
stop_jackrabbit >/dev/null
start_jackrabbit
;;
start)
start_jackrabbit
;;
status)
status_jackrabbit
;;

*)
echo "Unknown action: $action"
usage
exit 1
esac

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a duplication of https://github.com/sixty-nine/Jackrabbit-startup-script
does not really belong into the sandbox imho.
maybe @sixty-nine could integrate some of the additional features into his script and then we could include that?

2 changes: 1 addition & 1 deletion src/Sandbox/AdminBundle/Admin/ContentAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function configureFormFields(FormMapper $formMapper)
->add('path', 'text')
->add('title')
->add('name')
->add('content', 'text')
->add('content', 'textarea')
->end();
}

Expand Down
99 changes: 99 additions & 0 deletions src/Sandbox/MainBundle/Controller/ImageController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?php

namespace Sandbox\MainBundle\Controller;

use Sandbox\MainBundle\Document\Image;

use Doctrine\ODM\PHPCR\DocumentManager;

use FOS\RestBundle\View\ViewHandlerInterface;
use FOS\RestBundle\View\View;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class ImageController extends Controller
{
protected $dm;

/**
* @var FOS\RestBundle\View\ViewHandlerInterface
*/
private $viewHandler;

protected $images_mime = array(
'image/png',
'image/jpeg',
'image/gif',
'image/bmp',
'image/vnd.microsoft.icon',
'image/tiff',
'image/svg+xml');

public function __construct(ContainerInterface $container, DocumentManager $dm, ViewHandlerInterface $viewHandler)
{
$this->container = $container;
$this->dm = $dm;
$this->viewHandler = $viewHandler;
}

public function displayAction($id)
{
$basepath = $this->container->getParameter('symfony_cmf_content.static_basepath');

$image = $this->dm->find(null, $basepath.'/'.$id);

$data = stream_get_contents($image->content);

$response = new Response($data);
$response->headers->set('Content-Type', 'image/jpeg');
$response->setPublic();

$date = new \DateTime();
$date->setTimestamp(time() + 332640000);
$response->setExpires($date);
$response->setMaxAge(332640000);

return $response;
}

public function uploadAction(Request $request)
{
$basepath = $this->container->getParameter('symfony_cmf_content.static_basepath');
$error = false;
$path = '';

$files = $request->files;

$id = '';
foreach ($files->all() as $file ) {
if (in_array($file->getClientMimeType(), $this->images_mime)) {
$name = $file->getClientOriginalName();
$path = $file->getPathname();
$id = md5(time());
$jcrPath = $basepath.'/'.$id;
if (!$this->dm->find(null, $jcrPath)) {
$image = new Image();
$image->setPath($jcrPath);
$image->name = $id;
$image->content = file_get_contents($path);
$image->tags = explode(',', $request->get('tags'));
} else {
$error = 'This file already exists in your backend.';
}

$this->dm->persist($image);
} else {
$error = "What you're trying to upload is not an image.";
}
}

$this->dm->flush();

return $this->redirect($this->generateUrl('image_display', array('id' => $id)));
}
}