diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt index bfcf54b9..66c119fa 100644 --- a/programs/CMakeLists.txt +++ b/programs/CMakeLists.txt @@ -35,3 +35,4 @@ add_subdirectory(touchui) add_subdirectory(playbook) add_subdirectory(editor) add_subdirectory(viewer) +add_subdirectory(wordpressplugin) diff --git a/programs/wordpressplugin/CMakeLists.txt b/programs/wordpressplugin/CMakeLists.txt new file mode 100644 index 00000000..f9aa3795 --- /dev/null +++ b/programs/wordpressplugin/CMakeLists.txt @@ -0,0 +1,51 @@ + +set (RUNTIME ${CMAKE_CURRENT_SOURCE_DIR}/../../webodf/lib/runtime.js) +set (TOOLS ${CMAKE_CURRENT_SOURCE_DIR}/../../webodf/tools) + +# create zip file +set (WP_ZIP webodf-for-wordpress-${WEBODF_VERSION}.zip) +set (VIEWER ${CMAKE_CURRENT_BINARY_DIR}/../viewer) + +FILE( GLOB WP_VIEWER_IMAGES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/../viewer ${CMAKE_CURRENT_SOURCE_DIR}/../viewer/images/* ) +FOREACH(img ${WP_VIEWER_IMAGES}) + LIST(APPEND WP_VIEWER_IMAGES_WVPREFIX wv/${img}) +ENDFOREACH(img) + +add_custom_command( + OUTPUT ${WP_ZIP} + + COMMAND ${CMAKE_COMMAND} -E make_directory wv + COMMAND ${CMAKE_COMMAND} -E copy_directory ${VIEWER}/images wv/images + COMMAND ${CMAKE_COMMAND} -E copy ${VIEWER}/index.html wv/index.html + COMMAND ${CMAKE_COMMAND} -E copy ${VIEWER}/viewer.css wv/viewer.css + COMMAND ${CMAKE_COMMAND} -E copy ${VIEWER}/webodf.js wv/webodf.js + COMMAND ${CMAKE_COMMAND} -E copy ${VIEWER}/viewer.js wv/viewer.js + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/readme.txt readme.txt + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/webodf-viewer.php webodf-viewer.php + + + # zip using javascript code running in node.js + COMMAND ${NODE} ARGS ${RUNTIME} ${TOOLS}/zipper.js + ${WP_ZIP} + # defined in ../viewer/CMakeLists.txt + ${WP_VIEWER_IMAGES_WVPREFIX} + + wv/index.html + wv/viewer.css + wv/webodf.js + wv/viewer.js + + readme.txt + webodf-viewer.php + + DEPENDS NodeJS + ${TOOLS}/replaceByFileContents.js + ${CMAKE_CURRENT_SOURCE_DIR}/readme.txt + ${CMAKE_CURRENT_SOURCE_DIR}/webodf-viewer.php + ${VIEWER/index.html} + ${VIEWER/viewer.css} + ${VIEWER/viewer.js} + ${VIEWER/webodf.js} +) +add_custom_target(wordpresspluginzip ALL DEPENDS ${WP_ZIP}) + diff --git a/programs/wordpressplugin/readme.txt b/programs/wordpressplugin/readme.txt new file mode 100644 index 00000000..78a7c340 --- /dev/null +++ b/programs/wordpressplugin/readme.txt @@ -0,0 +1,39 @@ +=== WebODF Viewer === +Contributors: Tobias Hintze +Tags: ODF, open document, WebODF +Requires at least: 3.2 +Tested up to: 3.4.2 +Stable tag: 1.0 + + +This plugin embeds a WebODF Viewer into WordPress. + +== Description == + +This plugin embeds a WebODF Viewer into WordPress. See www.webodf.org for more details on WebODF. + +== Usage == + +Navigate to a Open Document file in your WP blog's media library and press the button "Insert WebODF Viewer". +Alternatively you can manually insert the WordPress shortcode `[webodf_viewer /path-to-some-file.odt]` to embed +any `*.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 `webodf-viewer` 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 hacked together. + diff --git a/programs/wordpressplugin/webodf-viewer.php b/programs/wordpressplugin/webodf-viewer.php new file mode 100644 index 00000000..52ded0f2 --- /dev/null +++ b/programs/wordpressplugin/webodf-viewer.php @@ -0,0 +1,166 @@ +
width=' . $options['width'] . + ' height=' . $options['height'] .' Options saved.
'; + } + echo '