Jump to content
gbligh

MIS Linked Documents widget

Recommended Posts

Hi all,

We are using the MIS Linked Documents widget but parents are struggling to realise that they have to select a date first for the documents to appear in the widget. They are used to the Frog3 one where they just used to list all of them in one place without having to select a date.

Does anyone know of a way around this?

Thanks

Share this post


Link to post
Share on other sites

Our parents have the same problem @gbligh . Made worse by the document extractor that appears to put incorrect dates on the pdf’s! (Yes ticket open).

I am half way through writing my own version of the widget that doesn’t need a date - just shows all documents with tabs for each academic year

Paul

  • Like 1

Share this post


Link to post
Share on other sites

Thanks Paul - would you be happy to share that widget once completed? I'm sure it would help our parents out loads.

Share this post


Link to post
Share on other sites
On 11/29/2017 at 11:39, gbligh said:

Thanks Paul - would you be happy to share that widget once completed? I'm sure it would help our parents out loads.

Happy to. But Christie release seems to have broken the frogcode editor so can't finish it at the moment.  Actually lots of things (both custom made and frog made) are currently broken :(

Lots of tickets open and lots more still coming in from staff.....

Biggest problem for us is the Parents Portal as the select a user widget seems to be broken.  Not sure if that is a frog thing or a me thing?!

Share this post


Link to post
Share on other sites

Our MIS Linked Docs widget is broken. The documents appear, but they can't actually be clicked on or opened.

Share this post


Link to post
Share on other sites

Lots of stuff is broken......  including the next release for FrogLabs schools!! :$

Share this post


Link to post
Share on other sites

Finally got round to making life so much easier for our parents.....

@gbligh if your still interested in this linked documents widget, i'm sure you can find a way to get a copy off our platform! Or i'll post all code here.

Paul

Untitled1.thumb.png.c7c22dd72d367470116c36d9a739011c.pngUntitled2.thumb.png.6427ba35ab3dd9187f3e16301de0927f.png

Share this post


Link to post
Share on other sites

I’m off now until the new year, so don’t have access to your platforms.  I’ll try to remember to grab this from Paul and we’ll make it available.

Graham

Share this post


Link to post
Share on other sites

I've just started at a Frog Learn school and one of my responsibilities is to develop the VLE.  At the moment we are having a push on parental engagement and part of this is using MIS linked documents.  I am slowly getting my head round how the APIs work and am very interested in the linked documents widget and the coding behind it, @pconkie would it be possible for you to send me the code behind the widget to learn from and use on our platform.  Thanks, Matt

Share this post


Link to post
Share on other sites

@adamw @Graham Quince I've had a problem reported to be by a parent regarding the Linked Document widget (mine not yours).  When using the MyFrog app, when a parent clicks to open a pdf, it opens, but can not be closed. You can not return to the dashboard either.  Only choice is to close the app and re-open.  The pdf either sits on top of the dashboard in a new transparent window or replaces the dashboard, but there in no back button or back gesture. The official widget opens the pdf in the frog document preview app. I was keen to see how other file downloads are handled by the app, so linked to an excel file using a text widget.  This open the file in a new window AND has a back button!  Please can you share how i could do one of the following: a) open the pdf in the frog document preview app; b) open the pdf the same way the cke editor does within the MyFrog app; c) send the pdf to open in the default browser e.g. safari for iOS.  Just to reiterate all works fine on desktop and mobile platforms, this is just an issue for users of the app.  I have tried variations of the target attribute with no effect.  I've tried the new html5 download attribute again with no effect.  For some reason the return key has stopped working for me on this forum, so sorry if this is hard to read!  Thanks Paul

Share this post


Link to post
Share on other sites
On 02/02/2019 at 20:36, pconkie said:

@adamw @Graham Quince I've had a problem reported to be by a parent regarding the Linked Document widget (mine not yours).  When using the MyFrog app, when a parent clicks to open a pdf, it opens, but can not be closed. You can not return to the dashboard either.  Only choice is to close the app and re-open.  The pdf either sits on top of the dashboard in a new transparent window or replaces the dashboard, but there in no back button or back gesture. The official widget opens the pdf in the frog document preview app. I was keen to see how other file downloads are handled by the app, so linked to an excel file using a text widget.  This open the file in a new window AND has a back button!  Please can you share how i could do one of the following: a) open the pdf in the frog document preview app; b) open the pdf the same way the cke editor does within the MyFrog app; c) send the pdf to open in the default browser e.g. safari for iOS.  Just to reiterate all works fine on desktop and mobile platforms, this is just an issue for users of the app.  I have tried variations of the target attribute with no effect.  I've tried the new html5 download attribute again with no effect.  For some reason the return key has stopped working for me on this forum, so sorry if this is hard to read!  Thanks Paul

I've also noticed this @pconkie - was meant to pick your brains about it!

Share this post


Link to post
Share on other sites
On 02/02/2019 at 20:36, pconkie said:

@adamw @Graham Quince I've had a problem reported to be by a parent regarding the Linked Document widget (mine not yours).  When using the MyFrog app, when a parent clicks to open a pdf, it opens, but can not be closed. You can not return to the dashboard either.  Only choice is to close the app and re-open.  The pdf either sits on top of the dashboard in a new transparent window or replaces the dashboard, but there in no back button or back gesture. The official widget opens the pdf in the frog document preview app. I was keen to see how other file downloads are handled by the app, so linked to an excel file using a text widget.  This open the file in a new window AND has a back button!  Please can you share how i could do one of the following: a) open the pdf in the frog document preview app; b) open the pdf the same way the cke editor does within the MyFrog app; c) send the pdf to open in the default browser e.g. safari for iOS.  Just to reiterate all works fine on desktop and mobile platforms, this is just an issue for users of the app.  I have tried variations of the target attribute with no effect.  I've tried the new html5 download attribute again with no effect.  For some reason the return key has stopped working for me on this forum, so sorry if this is hard to read!  Thanks Paul

Sounds like it needs a quick re-visit to see what's going on. @Matt 

Share this post


Link to post
Share on other sites

@Graham Quince looks like it's one for you if our version is ok (launches PDF preview) but the FrogCode one is launching the old way which can't then be closed....... ;)

Share this post


Link to post
Share on other sites

@Matt @adamw @Graham Quince  Let me simplify the question...

this.trigger('os.internal.launchapp', {
  name: appID,
  pollid: this.prefs.livepolls.value,
  view: this.prefs.studentview.value,
  appModel: new Com.Frog.Model({
    'uuid' : appID,
    'role_name': Object.values(_Roles.serialize()).filter(function(role) {
      return /app\.frogplay$/gim.test(role);
    })[0],
    'extended_data' : {
      'from_package' : true
    }
  })

This code successfully launches a frog app by appID  and passes it 2 values for it to consume.

How would I modify the code to open the document preview app and get it to display the pdf that I have the id/path for? 

Paul

Share this post


Link to post
Share on other sites
On 05/02/2019 at 09:01, pconkie said:

@Matt @adamw @Graham Quince  Let me simplify the question...


this.trigger('os.internal.launchapp', {
  name: appID,
  pollid: this.prefs.livepolls.value,
  view: this.prefs.studentview.value,
  appModel: new Com.Frog.Model({
    'uuid' : appID,
    'role_name': Object.values(_Roles.serialize()).filter(function(role) {
      return /app\.frogplay$/gim.test(role);
    })[0],
    'extended_data' : {
      'from_package' : true
    }
  })

This code successfully launches a frog app by appID  and passes it 2 values for it to consume.

How would I modify the code to open the document preview app and get it to display the pdf that I have the id/path for? 

Paul

@Graham Quince any thoughts?

Share this post


Link to post
Share on other sites
1 hour ago, Graham Quince said:

Sorry Paul - this is a bit beyond me.  I'll nudge @adamw

@pconkie

Sorry, I seem to have missed this. Assuming you have the resource object from an api call you can use something like this:

this.trigger('os.app.preview', {
	name: 'preview',
	resource: myResource,
	launchAboveModal: true,
	mode: 'fullscreen'
});

 

  • Like 1

Share this post


Link to post
Share on other sites

@adamw Got a slight problem - am I on the right tracks?

This code is in the response form the linkeddocuments.search api:

$.each(thisResponse.data, function(i,docs) {
  $mywrapper.find("[data-name=docstable] tbody").append("<tr class='clickable-row' data-resource='"+JSON.stringify(docs.resource)+"'><td><div class='os-icon-ext os-icon-ext-"+docs.resource.attachment.file.mime.ext+" small'></div> <div class='os-ellipsis title' title='"+docs.description+"'>"+docs.description+"</div></td><td>"+moment.unix(docs.date_created_external).format("DD/MM/YYYY")+"</td></tr>");
});

Here i append the resource object to the <tr> mark-up.  This looks right in the inspector once the table has rendered.

This is the code for the tr click event:

$mywrapper.on("click tap", ".clickable-row", function(ev) {
  var myResource = $(ev.currentTarget).data("resource");
  this.trigger('os.app.preview', {
    name: 'preview',
    resource: myResource,
    launchAboveModal: true,
    mode: 'fullscreen'
  });
}.bind(this));

This successfully opens the preview app. But.....

Capture.PNG.6852d4e7d80dd9093eb38ad92545796a.PNG

Capture.PNG.7eb3aa2e6681ad45525607045a67dead.PNG

Share this post


Link to post
Share on other sites

I think the resource needs to be a resource object - my front end knowledge in this dept is a bit weak, but I think the passed resource needs to be an instance of a:

Lib.Models.Resource

Hopefully that helps, let me know how you get on - as I may have to grab someone who knows that part of the system better than I if needed :P

Share this post


Link to post
Share on other sites
21 minutes ago, adamw said:

I think the resource needs to be a resource object - my front end knowledge in this dept is a bit weak, but I think the passed resource needs to be an instance of a:


Lib.Models.Resource

Hopefully that helps, let me know how you get on - as I may have to grab someone who knows that part of the system better than I if needed :P

Sorry @adamw this doesn't mean anything to me!

Share this post


Link to post
Share on other sites
Just now, pconkie said:

Sorry @adamw this doesn't mean anything to me!

Hehe, you and me both :p

Okay, can you post the method that does the api call to get the resource data? 

Share this post


Link to post
Share on other sites

i'm using this to get the linked documents of a child

//function to get linked documents of selected child
            var getDocs = function(anyuuid) {
            //wipe the table of docs
                $mywrapper.find("[data-name=docstable] tbody").empty();
                $mywrapper.find("[data-name=docstable] thead").empty();
                //call the api
                Frog.Model
                    .api(
                    'linkeddocuments.search',
                    {
                        //any date in the dim dark past will do for now...
                        date_created_external: "1200000000",
                        //get todays moment
                        date_created_external_before: today,
                        is_active: "true",
                        order_by: "date_created_external",
                        user_uuid: anyuuid
                    }
                ).done(function(thisResponse) {
                    //rebuild the table
                    if (thisResponse.data.length > 0) {
                        $mywrapper.find("[data-name=docstable] thead").append("<tr><th>Title</th><th class='date'>Date</th></tr>");
                        $.each(thisResponse.data, function(i,docs) {
                           $mywrapper.find("[data-name=docstable] tbody").append("<tr class='clickable-row' data-resource='"+JSON.stringify(docs.resource)+"' data-href='"+docs.resource.attachment.file.external_url+"'><td><div class='os-icon-ext os-icon-ext-"+docs.resource.attachment.file.mime.ext+" small'></div> <div class='os-ellipsis title' title='"+docs.description+"'>"+docs.description+"</div></td><td>"+moment.unix(docs.date_created_external).format("DD/MM/YYYY")+"</td></tr>");
                        });
                    } else {
                        $mywrapper.find("[data-name=docstable] tbody").append("<div class='nodocs'>No documents exist</div>");
                    }
                });

                
            };

 

Share this post


Link to post
Share on other sites

This is complete guess, without testing. but try this as the first line in your 'done' function:

thisResponse = Lib.Models.Resource.model(thisResponse.data);

That may give you an array of resource models, which you can then do stuff with. You might have to amend the rest of your code to cope with the new structure, but it should be fairly easy to do. That's if it works! Like I said, I usually leave the front-end stuff to those who are cleverer than me :P

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...