Jump to content

MIS Linked Documents widget


gbligh

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

Link to comment
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
Link to comment
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?!

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

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

Link to comment
Share on other sites

  • 1 year later...

@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

Link to comment
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!

Link to comment
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 

Link to comment
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

Link to comment
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?

Link to comment
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
Link to comment
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

Link to comment
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

Link to comment
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!

Link to comment
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>");
                    }
                });

                
            };

 

Link to comment
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
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...