How to Checkout a file in Tactic ?

11 posts / 0 new
Last post
twinstef
How to Checkout a file in Tactic ?

Hello,
When i try to checkout a file (.jpg) i have an "Applet is Null" error.
The Checkin was ok, so my file exists on the server "/home/apache/assets/test/03_Assets/CH/Roger_Turn01/Roger_Checkout.jpg"
But i can't checkout ... Do i need to develop specific java or python code to have the checkout working ?
 
Regards,
Stephane.
 
 

Image: 
bejoy

I'm facing the same problem, does anyone have a solution for this ?

Tacticians come to our rescue pls.... ;)

drew

Of course I'm facing the same problem. The Applet Null is a Java problem. This is why Tactic went to html5 format with the drag and drop method. This is good for uploading, but there is no method to downloading. Kinda sucks since I have a project server on an Amazon site and I depend on artists being able to download files to work on them.

The only solution I have right now is to stick with Tactic 4.1 and ask people to use Firefox version 33. This seems to be the last version to work well with Java. Of course this also presents a few security vulnerability  issues for those people. Some kind of solution would be appreciated here. I wouldn't want to stick with 4.5 only to have to provide some other way for artists to download the files.

 Andrew

drew

I'm not an expert when it comes to web development, but isn't it possible to create a custom Link Widget that will download a file instead of navagating to it? For example using the href download command.

This way you could create a column in the Snapshots to automatically link to that published file.

Image: 

 Andrew

bejoy

Thanks Drew, I assume souhtpaw abandoned the forum after they sell Tactic to ToonBoom. 

Will try this and let you know.

drew

Hi Bejoy,

What I ended up doing was to create a View show all the checkins (the search type is pointing to sthpw/snapshot). Then I copied their Submit tool (add_snapshot_to_review_wdg in the Layout Editor) to use it to find out the asset publish location and pass that to a Python script that creates a zip copy and adds that zip file to the snapshot. This way people can download the zip file. If you are interested I can post my workaround.

 Andrew

bejoy

Hello Drew,

Thats great, it would be very helpful if you can share it here in the forum.

Many thanks.

drew

First I open the Custom Layout and save one called "zip_it"

------  HTML  ----

<body>
  <div class="spt_top" style="height:100px; width:400px">
    <div class="spt_label_div"> </div>
    <br/>
    <div>
      <input type="button" value="ZIPIT" class="spt_submit_button"/>
    </div>
    <br/>
    <br/>
    <div class="spt_file_info">
        
          </div>
  </div>
</body>

--------  BEHAVIOURS  ---------

<behavior class="spt_top">{
      "type": "load",
      "cbjs_action": '''
          var server = TacticServerStub.get();
          //var applet = spt.Applet.get();
          var top_el = bvr.src_el;

          var search_key = bvr.kwargs.search_key;
          top_el.search_key = search_key;

          // Get the input snapshot info
          var snapshot = server.get_by_search_key(search_key);
          top_el.snapshot = snapshot;
        
          // Get the parent info
          var parent_sobject = server.get_parent(snapshot.__search_key__);
          top_el.parent_sobject = parent_sobject;

          // Get the file info
          var files = server.get_path_from_snapshot(snapshot.code);
          var file_info_el = top_el.getElement(".spt_file_info");
          //file_info_el.innerHTML = files;

          // Set the Label
         var label_text = "Zip this publish?: <b>" + parent_sobject.code + " ["+ snapshot.context +"- v" +snapshot.version + "]</b>"   
         label_div_el = top_el.getElement(".spt_label_div")
         label_div_el.innerHTML = label_text;

      '''
    }</behavior>

<behavior class="spt_submit_button">{
        "type": "click_up",
        "cbjs_action": '''
        // Setup
        var server = TacticServerStub.get();
        var top_el = bvr.src_el.getParent(".spt_top")
        var search_key = top_el.search_key
        var snapshot = top_el.snapshot;
        var snapshot_code = snapshot.code;
        var parent_sobject = top_el.parent_sobject;
        var parent_code = parent_sobject.code;
        var artist = spt.Environment.get().get_user(); 

        //console.log("parent_sobject = ");
        //console.log(parent_sobject);
        //console.log("Parent Sobject = " + parent_sobject.code);

        var data = {
          'parent_code': parent_code,
          'snapshot_code': snapshot_code,
          'artist': artist,
          'search_type': snapshot.search_type,
          'context': snapshot.context,
          'process': snapshot.process,
          'version': snapshot.version
        };
                console.log("Sending data as:");
        console.log(data);
        server.execute_python_script("utils/convert_to_zip",{data:data});

        alert("Done");
                var popup = spt.popup.get_popup( bvr.src_el );
        spt.popup.close(popup); 

        '''
    }</behavior>

 

I wasn't too careful in cleaning this part up. If you see any mistakes let me know. As long as it passed the information I needed I was happy.

So in the Scripts I created utils/convert_to_zip

--------------------   convert_to_zip   -------------------------

import os
from tactic_client_lib import TacticServerStub
server = TacticServerStub.get()

#----------------  START  ------------------------------------#

#server.log("debug","Receiving data as: %s" % data)
snapshot_code = data["snapshot_code"]
file_path = server.get_path_from_snapshot(snapshot_code,mode='lib')
pub_name = os.path.basename(file_path)
pub_dir = os.path.dirname(file_path)
filename, file_extension = os.path.splitext(pub_name)
new_zip = '%s.zip' % filename
zip_to_path = os.path.join(pub_dir,new_zip)
zip_cmd = "zip %s %s" % (zip_to_path,file_path)
add_it = 0
try:
    os.system(zip_cmd)
    server.log("debug","Converted to zip: %s" % zip_to_path)
    add_it = 1
except Exception as e:
    msg = "Error zipping file :%s" % zip_to_path
    err_msg = str(e)
    server.log("error",msg)
    server.log("error",err_msg)
else:
    msg = "Converted to zip: %s" % zip_to_path
 
 
#Now that file is zipped, add it to the snapshot
if add_it == 1:
    server.add_file(snapshot_code, zip_to_path, file_type='file', use_handoff_dir=False, mode="inplace", create_icon=False)
return msg

--------------------   convert_to_zip   -------------------------

 

Then, in my Publish Review View:

<element name="publish_review" icon="INFO_OPEN" title="Publish Review">
  <display class="LinkWdg">
    <search_type>sthpw/snapshot</search_type>
    <simple_search_view>me_publish_filter</simple_search_view>
    <search_view>link_search:publish_review</search_view>
    <view>publish_review</view>
  </display>
</element>

I add a column called "zipit":

<element name="zipit" edit="false">
  <display widget="button">
    <cbjs_action>      kwargs = {
        'view': 'zip_it',
        'search_key': bvr.search_key
      };
      spt.panel.load_popup('Zip Publish', 'tactic.ui.panel.CustomLayoutWdg', kwargs);</cbjs_action>
    <icon>WRENCH</icon>
  </display>
</element>

-----------------------  END  ----------------

When you click on the button you will be able to create zip copy of the file that is published (checked-in) and then add that zip to the snapshot. Now when you look at the history you can click on the zip file.

 

 Andrew

bejoy

Awesome, Thank you so much Andrew.

We will test it out and get back to you on how it works.

remko

All the major browsers  increasingly made installing and using a java applet more difficult until we are now at a point where it is basically undeployable.   Without writing a plugin for every browser, there isn't currently a good way to achieve what was previously possible.  The applet contained a lot of functionality that manipulated the client file system, which, in general, is a security risk, but for what TACTIC was trying to do, it was acceptable.

Currently, we use 2 methods for people to get their files:

1. Use a direct link in the table: <a href=".../xyz.jpg" download>...</a> causes most browsers to force a download

2. A server side script which zips up all the files you want and provide a link to the zip file.

At present, there is no direct API support for this ... will need to look into this.

BTW: we (southpaw) haven't abandoned TACTIC ... we sold the TACTIC Studio product, but still maintain TACTIC Open Source and other commercial products (TACTIC Project / TACTIC Media Lbrary) all built on top of TACTIC.  Since the aquisition, we have been extremely busy refocusing the company to develop new products and that has taken all of our resources.  As we grow into our new products, we will continue to support TACTIC as well as the community as we ourselves are still highly dependent on the success of TACTIC Open Source.

 

bejoy

Hello Remko,

Thaks for getting back, and its good to know southpaw is still backing up the opensource platform. Tactic has been helping me for more than a year in organising our pipeline.

Sometimes we get stuck with lot of questions and with nobody to answer, hope to hear from you guys every now and then.

Wishing all success for your growth with the new products.