Jump to content

pconkie

Frog Community Genius
  • Posts

    598
  • Joined

  • Last visited

Posts posted by pconkie

  1. 3 minutes ago, adamw said:

    Right, honest answer - at the moment, I don't know! It could be that the upload button press is performing some default html form-like action, which may be trying to submit the form. I'd need to see the code for the upload button. However, you could try changing the above bit of code to this:

    
    obj.modal.find("[data-name=file-upload]").click(function(el) {
    	el.preventDefault();

    Disclaimer - this is a wild-stab-in-the-dark-with-no-research-whatsoever-type-guess.

     

    Your guesses tend to be on the money though....

  2. Time lapse...

    1. form in a modal opens

    2. Upload button pressed

    1.PNG.ec85c1835733a430d60f267cfdf2b4f2.PNG

    3. Why does frog think i;m trying to leave?  This pop-up appears for some reason.

    4. Press the cancel button

    2.PNG.b91a5451b0d736cd5d66f80daddb964b.PNG

    5. Up-loader appears above the modal - thanks!

    3.PNG.a8fcf0a55fa297d3ef4801fede502b5c.PNG

    6. file(s) uploaded

    5.PNG.cbe308b9d4120bf30f43695deca4936a.PNG

    7. And attached.

    6.PNG.6e7df0bbc5daec2759433e35f352f9b0.PNG

     

    So how can i get rid of steps 3 & 4?  Looking in the consoles network panel for clues about what is triggering the page redirect, I can see that there is a call to preferences.profile.get (which I assume the up-loader makes, because i'm not).  Is this because i'm in an app when calling the uploader, but telling it to store the files in an unopened site?  In which case is it better (and I think I would prefer it) to store the documents in a shared folder - would that prevent the page navigation warning pop-up?  If so, what do i need to change to have the files upload to a folder?

    Full code...

    obj.modal = this.modal(title, this.view(body+'.ejs', frm_data), "modal-4FDC8814200489BB58471FBB81DE9B03CD461BECB489AFEC", null, false);
    obj.modal.find(".modal-footer").append("<button data-action='modal-save' class='btn btn-success'>Save</button>")
    if (edit == true) {
      obj.modal.find(".modal-footer").append("<button class='btn btn-danger' data-action='modal-delete'>Delete</button>");
    }
    obj.modal.find(".modal-footer").append("<button class='btn btn-default' data-action='modal-close'>Cancel</button>");
    obj.modal.find("[data-action=modal-delete]").click(function() {
      var rec = obj.modal.find("input[name=uuid]").val();
      this.deleteInt(rec);
      this.hideModal(obj.modal);
    }.bind(this));
    obj.modal.find("[data-action=modal-close]").click(function() {
      this.hideModal(obj.modal);
    }.bind(this));
    obj.modal.find("[data-name=file-upload]").click(function() {
      $('.os_core:first').trigger('os.app.upload', {
        "data": {
          "upload_type": "asset",
          "site_uuid": "62D4442D2002520CF7345F0960EDDD095847DB4C186723A6",
          "focusApp": this.element.closest('div.app_dialog'),
          "launchAboveModal": true,
          "callback": function(result) {
            if (result.files && result.files.length) {
              var $docholder = obj.modal.find("input[name=docs]");
              var docs = JSON.parse($docholder.val());
              $.each(result.files, function(i, file) {
                obj.modal.find("div[data-name=uploads]").append("<div style='clear:both'><div style='float:left' class='os-icon-ext os-icon-ext-"+file.attachment.file.mime.ext+" small'></div>&nbsp;"+file.attachment.name+"."+file.attachment.file.mime.ext+"</div>");
                docs.push({name:file.attachment.name,ext:file.attachment.file.mime.ext,url:file.external_url,uuid:file.uuid});
              });
              $docholder.val(JSON.stringify(docs));
            }
          }
        }
      });

     

  3. obj.modal = this.modal(title, this.view(body+'.ejs', frm_data), "modal-4FDC8814200489BB58471FBB81DE9B03CD461BECB489AFEC", null, false);

    This is the line i should have included to show that it is the built in modal,  The uploader app  called from the data-viewer app modals has some custom classes which presumably put it above the modal overlay.  It doesn't work when i add the same classes though...  

  4. Good idea and where I started but...

    All of the windows inside frog seem to be managed by a library which continually updates z values as sites and apps are opened, closed, resized and dragged. This is why sites appear on top of each other in the correct order etc 

    While I can change the z-index for a moment it quickly reverts back....

  5. I've put a non frog form inside a modal to turn it into a custom pop-up form.

    We have decided we need the ability to upload files to the form, so I have added a button which opens the file up-loader.

    The problem is the file up-loader opens beneath the modal and can not be interacted with.

    1.PNG.25ee67b40c223102636dbdf5cb6d0192.PNG

     

    Here is the code i'm using:

    obj.modal.find("[data-name=file-upload]").click(function() {
      $('.os_core:first').trigger('os.app.upload', {
        "data": {
          "upload_type": "asset",
          "site_uuid": "62D4442D2002520CF7345F0960EDDD095847DB4C186723A6",
          "focusApp": $('.modal'),
          "callback": function(result) {
            if (result.files && result.files.length) {
              $.each(result.files, function(i, file) {
                console.log(file.attachment.name);
              });
            }
          }
        }
      });

    I've tried playing around with the focusApp option, but no luck.

     

    How do I get the file up-loader above the modal.  The data-viewer app manages this -

    Capture.PNG.194904f8d8544c8c7feaea809c80d110.PNG

    So hoping there is just a quick option to set to get this to work properly!

    Thanks.

  6. 36 minutes ago, Jay said:

    Hi @pconkie

    Our Development Team are aware of this issue and are currently investigating this further, In the meantime I will create you a Support ticket and keep you updated with any progress regarding this particular issue.

    In regards to hiding the "Cog" icon I could suggest removing the "MIS Linked Documents" widget all together from the site for the meantime as a workaround whilst our Development Team investigate the issue. 

    In regards to the coding question I would suggest posting that in our Coding section of our Forums which I have provided a link to below;

    Link: https://forum.frogcommunity.com/index.php?/forum/6-coding/

    If you have any issues or questions in the meantime please let me know,

    Kind Regards,

    Jay 

    Thanks @Jay 

    As we no longer send paper reports home, this is the only way parents can view them.  To take the widget away all together, would make the situation far worse!  I think I'll stick with the cog hidden, safe in the knowledge that the development team are on it!

  7. Just got off the phone with another parent....At first I thought something else must be the case as I thought it was impossible to remove linked documents, but......

    If a parents opens a linked document like this...

    Capture2.PNG.06195d75ce5bea898d571c3f0666a939.PNG

    There is a (new?) edit option on the cog...

    Capture3.PNG.c6bd20b72a6fd4f3011a724cf57faf83.PNG

    and if they change anything and press the save button, the document is permanently removed form the linked document viewer.

    Inspecting the api call shows that the entire resource section of the record is blank!

    Capture.thumb.PNG.fff58b214c7a9a154dd6e41aed9ada38.PNG

    Above i have opened the first two linked documents.  Document 0 has had me edit the properties and the resource section is now blank "[ ]".  Document 2 has been left alone and looks like all of the others and appears (like all the others) in the linked document list.

    Two questions...

    How do we stop parents accessing the cog

    How do we get the linked documents that have been edited back? Syncing with SIMS doesn't work as the document hasn't been deleted, just the reference to it, that has been broken.

     

     

  8. @ADT Great idea and very much needed!

    @Graham Q sounds like your next project!

    1. Widget that only staff and admin can see * (like the button on the page viewer widget)

    * because if the widget is on the page that gets copied, then the widget will get copied too! 

    2. Essentially a button that when clicked gets the current page it is sat on and the ePortfolio collection * that the current site was the master for

    * May not be currently possible, so instead could provide a list of ePortfolio collections to select from

    3. Button uses the "copy page" functionality of the newly updated button widget as it loops around each ePortfolio in the collection adding the new page *

    * This requires passing the source page (which we would have) and a sibling page (which specifies where to insert the copied page).  We wouldn't have the sibling page, but could fudge this by always inserting at the end of the menu.

    What do you think?

    • Like 1
  9. 1 hour ago, adamw said:

    What API request are you making and which parameters are you sending?

    Frog.Model.api('groups.getMembers' etc etc
    //gets me all I need except pupil_number i.e. UPN
                   
    FrogOS.fdp({
    url: 'group/users/'+group_data[0],
    path: '/api/fdp/2/',
    type: 'GET'  etc etc
                   
    //gets me all I need (including pupil_number) except thumbnail 
    //none of the other fdp group apis seem to be better

    I can solve the problem by doing a second call to:

    Frog.Widget.Model.api('users.getSummary', { 'uuid' : uuids { etc etc

    which does include thumbnails

    Just wanted to know if I had missed a single api call that had everything i needed in return?

  10. I think we are there now:

    var data = JSON.parse(response.response[i].data);
    if (data[0].child in this.receipts) {
      for (var x = 0; x < data.length; x++) {
        this.receipts[data[0].child].push(data[x]);
      }
      this.receipts[data[0].child].sort(function(a, b){return b.datetime-a.datetime});
    } else {
      this.receipts[data[0].child] = data;
      this.receipts[data[0].child].sort(function(a, b){return b.datetime-a.datetime});
    }

    @Graham Quince please feel free to take the updated widget and app.

    @simon brahan thanks for your help!

    • Thanks 1
  11. Rather than this:

    var data = JSON.parse(response.response[i].data);
    this.receipts[data.child] = data;

    This seems to work:

    var data = JSON.parse(response.response[i].data);
    if (data[0].child in this.receipts) {
      for (var x = 0; x < data.length; x++) {
        this.receipts[data[0].child].push(data[x]);
      }
    } else {
      this.receipts[data[0].child] = data;
    }

    However, the receipts are not necessarily ion chronological order now, so we need to do a sort at some point...

  12. 24 minutes ago, simon brahan said:

    Hi again @pconkie.

    I've grabbed a copy of your code from Graham to take a look at what you're doing and how it could work with the current restrictions of the data store.

    In your widget you're storing the read around line 111:

    
    record.data.push({parent:currentuser.displayname,envir:environment,datetime:moment().unix()});

    In your app you're fetching all the report data and grouping it by user uuid around line 68:

    
    this.receipts[response.response[i].user_uuid] = JSON.parse(response.response[i].data);

    What if you added the child uuid to the payload content:

    
    record.data.push({parent:currentuser.displayname,envir:environment,datetime:moment().unix(),child:active_child});

    Then you could group by that when you fetch the results:

    
    var data = JSON.parse(response.response[i].data);
    this.receipts[data.child] = data;

    Would that work?

    Assuming both parents independently read the report we might lose the first parents data when we group the data in the app.  But we should be able to do something about that...

    Yes, I think this a really good suggestion, thanks.

  13. @Graham Quince I'm not sure I really follow.

    Yes, parents can currently write entries to the datastore, but only about themselves and not about their children.

    If they could write an entry regarding their child, it would still be 'theirs', no? I suppose you would need to implement a sort of "is this parent user the user who created this entry [created_by_uuid] or do they have a relationship to the user for whom it is about [user_uuid]" logic. If that logic isn't in the codebase then I think it should be considered. But if it's not, then I also agree there is no quick fix as it would inappropriate to grant 'global' read/write.

    We really need to work from lists of students (not lists of parents) with this - i'm struggling to work out how the app and widget can be re-written? I assume if the child has two parents and they both read the report the datastore will not allow for one parent to edit an entry made by the other(?) and there will therefore bu multiple entries relating to a single child.

    What I think you are suggesting would be very cumbersome - we would have to search through every datastore entry for a particular report looking in the data field for a child's uuid.  We would have to check them all, even if we found one because there could be multiple parents.

    So if we wanted a year group list (say 300 in a year group) and there were 500 entries for that particular report in the datastore.  This would involve doing 150,000 checks before rendering the list. Probably should avoid this.  If there is a way to return the members of a group with associated parent uuids then we could use an associative array to directly access the related parent views and avoid all that looping/checking. Is this possible? 

×
×
  • Create New...