view · edit · sidebar · attach · print · history

20120705-fachinfo-image-parse-update-interaction-basket

<< | Index | >>


Summary

  • Added external link to Epha 3D into interaction basket.
  • Updated to allow comany user editing of their owned fachinfo.

Commits

Index


Added interaction basket link

commit

Update fachinfo edit form for company user

in src/state/drugs/fachinfo.rb

  class RootFachinfo < Fachinfo
  ...
  private
  def _has_editor_privilege?
    user = @session.user
    [   
      'org.oddb.RootUser',
      'org.oddb.AdminUser'
    ].each do |priv|
      return true if user.allowed?('login', priv)
    end 
    return false
  end
  ..

in src/view/drugs/fachinfo.rb

class RootFachinfoComposite < View::Drugs::FachinfoComposite
  ...
  def chapter_view(chapter)
    if(@model.company.invoiceable?)
  .  ..
  end

I enabled Comany User to edit fachinfo (their owned fachinfo only).

commit

Update word parser for images

Add img tag handling for doc.

rwv2

rwv2 gem have arleady picture handling.
It is called from cpp parser.

module Rwv2
  ...
  class TextHandler
    def section_start(section_properties); end 
    def section_end; end 
    def page_break; end 
    def paragraph_start(paragraph_properties); end 
    def paragraph_end; end 
    def run_of_text(text, character_properties); end 
    def picture(pict); end 
  end
  ...
end

But picture method are not called, expectedly.

wv2 -- pictureData handlir in TextHandler

I tried wv2-patch for picture data in rwv2 project.
I patched this patch against wv2-0.4.2
This patch are created against wv2-0.2.3.
It seems that patch is fine without word97_helper.cpp.

$ cmake
$ make
Scanning dependencies of target wv2
[  2%] Building CXX object src/CMakeFiles/wv2.dir/olestorage.cpp.o
In file included from /home/yasuhiro/Downloads/wv2-0.4.2/src/olestream.h:26:0,
                 from /home/yasuhiro/Downloads/wv2-0.4.2/src/olestorage.cpp:20:
/usr/include/glib-2.0/glib/giochannel.h:28:2: error: #error "Only <glib.h> can be included directly."
make[2]: *** [src/CMakeFiles/wv2.dir/olestorage.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/wv2.dir/all] Error 2
make: *** [all] Error 2
~/Downloads/wv2-0.4.2 591 $

Fixed this problem another patch from Ports project.
But I could not compile.

[ 30%] Building CXX object src/CMakeFiles/wv2.dir/parser9x.cpp.o
/home/yasuhiro/Downloads/wv2-0.4.2/src/parser9x.cpp: In member function ‘void wvWare::Parser9x::processSpecialCharacter(wvWare::UChar, wvWare::U32, wvWare::SharedPtr<const wvWare::Word97::CHP>)’:
/home/yasuhiro/Downloads/wv2-0.4.2/src/parser9x.cpp:758:14: error: ‘Drawing’ is not a member of ‘wvWare::TextHandler’
make[2]: *** [src/CMakeFiles/wv2.dir/parser9x.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/wv2.dir/all] Error 2
make: *** [all] Error 2

commented out this line.

 // It has to be one of the very special characters...
        //case TextHandler::Drawing:
        case TextHandler::Picture:

I could complie wv2.
I compiled also extension for rwv2 gem with this wv2.

But result was same :(
parser ignored all images.

wv2 -- PictureHandler

wv2-0.4.2 has PictureHandler.

I tried to parser image with this PictureHandler.
But parser got SEGV error.

-- C level backtrace information -------------------------------------------
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x17d1e8) [0x7ff34095b1e8] vm_dump.c:796
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x5f741) [0x7ff34083d741] error.c:258
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(rb_bug+0xb7) [0x7ff34083e527] error.c:277
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x111d4f) [0x7ff3408efd4f] signal.c:609
/lib64/libpthread.so.0(+0xfb90) [0x7ff3405d0b90]
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/x86_64-linux/rwv2.so(_ZN15Rwv2TextHandler11pictureDataEN6wvWare9SharedPtrIKNS0_6Word974PICFEEEPh+0xa5) [0x7ff3379f2905] /usr/local/include/wv2/sharedptr.h:112
/usr/lib64/libwv2.so.4(_ZN6wvWare8Parser9x16processParagraphEj+0x90c) [0x7ff3377be72c] hash.c:2600
/usr/lib64/libwv2.so.4(_ZN6wvWare8Parser9x12processPieceIhEEvPT_jjRKNS0_8PositionE+0x1ba) [0x7ff3377c067a] hash.c:221
/usr/lib64/libwv2.so.4(_ZN6wvWare8Parser9x11parseHelperENS0_8PositionE+0x1c8) [0x7ff3377beaf8] hash.c:2044
/usr/lib64/libwv2.so.4(_ZN6wvWare8Parser9x9parseBodyEv+0xe5) [0x7ff3377bf7d5] hash.c:243
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/x86_64-linux/rwv2.so(rwv2_parser_parse+0x1b) [0x7ff3379f2eab] rwv2_parser.cpp:39
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x176991) [0x7ff340954991] vm_insnhelper.c:404
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x16c709) [0x7ff34094a709] insns.def:1015
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x172b9a) [0x7ff340950b9a] vm.c:1220
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x1772af) [0x7ff3409552af] vm.c:624
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(rb_rescue2+0x16b) [0x7ff3408444fb] eval.c:647
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x16861e) [0x7ff34094661e] vm_eval.c:846
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x176991) [0x7ff340954991] vm_insnhelper.c:404
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x16c709) [0x7ff34094a709] insns.def:1015
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x172b9a) [0x7ff340950b9a] vm.c:1220
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x173b61) [0x7ff340951b61] vm.c:670
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x182f2e) [0x7ff340960f2e] thread.c:453
/home/yasuhiro/.rbenv/versions/1.9.3-p194/lib/libruby.so.1.9(+0x183089) [0x7ff340961089] thread_pthread.c:653
/lib64/libpthread.so.0(+0x7e6c) [0x7ff3405c8e6c] rwv2_properties.cpp:87
/lib64/libc.so.6(clone+0x6d) [0x7ff33fa46b1d] process.c:1600
...

"string contains null byte"
NOTE

re-compile wv2 with patch.

$ cd wv2-0.4.2/src
$ patch < /path/to/ports-patch.patch
patching file olestream.h
$ cd ../
$ cmake .
$ make
$ sudo make install
view · edit · sidebar · attach · print · history
Page last modified on July 05, 2012, at 01:34 PM