diff --git a/CMakeLists.txt b/CMakeLists.txt index 647347b..45c0f06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ project (Viewer.js) cmake_minimum_required(VERSION 2.8.6) # At this point, the version number that is used throughout is defined -set(VIEWERJS_VERSION 0.2.0) +set(VIEWERJS_VERSION 0.2.1) if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) message(FATAL_ERROR "Compiling in the source directory is not supported. Use for example 'mkdir build; cd build; cmake ..'.") @@ -61,6 +61,9 @@ FILE ( MAKE_DIRECTORY ${VIEWER_BUILD_DIR}) SET ( VIEWERZIP ${CMAKE_BINARY_DIR}/Viewer.js-${VIEWERJS_VERSION}.zip) SET ( WEBODF_SOURCE_DIR ${CMAKE_BINARY_DIR}/WebODF-source ) +SET ( WORDPRESS_ZIP_DIR ${CMAKE_CURRENT_BINARY_DIR}/viewerjs-wordpress-${VIEWERJS_VERSION}) +SET ( WORDPRESSZIP ${WORDPRESS_ZIP_DIR}.zip) + ExternalProject_Add( WebODF GIT_REPOSITORY https://git.gitorious.org/webodf/webodf.git @@ -100,3 +103,23 @@ add_custom_target(Viewer ALL WebODF PDFjs ) + +configure_file(viewerjs-plugin.php.in ${CMAKE_CURRENT_BINARY_DIR}/viewerjs-plugin.php) + +add_custom_command( + OUTPUT ${WORDPRESSZIP} + COMMAND ${CMAKE_COMMAND} -E remove_directory ${WORDPRESS_ZIP_DIR} + COMMAND ${CMAKE_COMMAND} -E copy_directory ${VIEWER_BUILD_DIR} ${WORDPRESS_ZIP_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/viewerjs-plugin-README.txt ${WORDPRESS_ZIP_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/viewerjs-plugin.php ${WORDPRESS_ZIP_DIR} + COMMAND node ARGS ${WEBODF_SOURCE_DIR}/webodf/lib/runtime.js ${WEBODF_SOURCE_DIR}/webodf/tools/zipdir.js + ${WORDPRESS_ZIP_DIR} + ${WORDPRESSZIP} +) + +add_custom_target(wordpress-plugin ALL + DEPENDS + ${WORDPRESSZIP} + Viewer +) + diff --git a/README.md b/README.md index 3049611..9599aaa 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Viewer.js +# Viewer.JS -Viewer.js combines a number of excellent open source tools that are built on HTML and javascript. Viewer.js was funded by [NLnet foundation](http://nlnet.nl) and developed by [KO GmbH](http://kogmbh.com). +Viewer.JS combines a number of excellent open source tools that are built on HTML and javascript. Viewer.JS was funded by [NLnet foundation](http://nlnet.nl) and developed by [KO GmbH](http://kogmbh.com). -The heavy lifting in Viewer.js is done by these awesome projects: +The heavy lifting in Viewer.JS is done by these awesome projects: ### WebODF diff --git a/viewerjs-plugin-README.txt b/viewerjs-plugin-README.txt new file mode 100644 index 0000000..cde713b --- /dev/null +++ b/viewerjs-plugin-README.txt @@ -0,0 +1,39 @@ +=== ViewerJS WordPress Plugin === +Contributors: Tobias Hintze +Tags: ODF, PDF, Documents, open document, WebODF +Requires at least: 3.2 +Tested up to: 3.6.1 +Stable tag: 1.0 + + +This plugin embeds Viewer.JS into WordPress. + +== Description == +This is a combination of WebODF and PDF.js. +This plugin embeds Viewer.JS into WordPress. This is a combination of WebODF and PDF.js. See www.viewerjs.org for more details. + +== Usage == + +Navigate to a Document file (ODF or PDF) in your WP blog's media library and press the button "Insert with Viewer.JS". +Alternatively you can manually insert the WordPress shortcode `[viewerjs /path-to-some-file.pdf]` to embed +any `*.pdf`, `*.odt`, `*.odp`, or `*.ods` documents at that location. + +The plugin also provides a settings panel for adjusting the width and height of the embeded element (iframe). + +== Installation == + +1. Upload the whole `viewer.js-plugin` directory and content to the `/wp-content/plugins/` directory +2. Activate the plugin through the 'Plugins' menu in WordPress + +(or do the automatic stuff from the /wp-admin/...) + +== Screenshots == + +no screenshots available (yet) + +== Changelog == + += 0.1 = + +* first version forked from the WebODF version. + diff --git a/viewerjs-plugin.php.in b/viewerjs-plugin.php.in new file mode 100644 index 0000000..0f9a0b9 --- /dev/null +++ b/viewerjs-plugin.php.in @@ -0,0 +1,145 @@ +
width=' . $options['width'] . + ' height=' . $options['height'] .' Options saved.
'; + } + echo '