Jump to content
ADT

Department Homework Calander?

Recommended Posts

I suppose this is a question for you Geeky Freaky types... @Graham Quince @Chris.Smith @pconkie

I was wondering if there might be a way to force the homework calendar widget to show a specific department's homework???

Was thinking of putting a homework calendar widget on departmental sites....  so kids/parents could easily see what homework has been set for a subject!!

Just an idea....

Link to comment
Share on other sites

OK - you'll need to find a few things first.....

You will need to know what your subject uuids are.  I don't know if these are the same across different boxes?  e.g on my box (easy) science is 91364F1520031DB70162AFEE72134306E4B0D0CC582444B7 and computer science is: 91364ED12003103FC455BF3B2AC45F0F6387D3FC2A258A05

I found these by looking carefully at the code for the drop down box once the widget was on a page.  Or you could look in the network section of the chrome console like so

Capture.PNG.b91ac8bea38ebee7dee56df9daa82df8.PNG

 

Edited by pconkie
Link to comment
Share on other sites

1 minute ago, pconkie said:

@ADT I'm thinking this would be good for Heads of Department to have too (homework calendar has a Public mode)

That was my thinking....

Im sure it is fairly easy...  but nope...  I wouldn't know where to start!!  Thinking of ideas...  making them look pretty at the end...  im your man.... not the middle bit!

Link to comment
Share on other sites

Once you have a subject uuid you will need the data-content-uuid - this is unique for every widget, so we do not need to worry about other sites open with a homework calendar or two of the same widget on the same page.....

Fins this using the right click -- inspect in chrome     data-content-uuid

Capture.PNG.8421d1bc2988c93925366dda27087b86.PNG

Edited by pconkie
Link to comment
Share on other sites

6 minutes ago, pconkie said:

OK - you'll need to find a few things first.....

You will need to know what your subject uuids are.  I don't know if these are the same across different boxes?  e.g on my box (easy) science is 91364F1520031DB70162AFEE72134306E4B0D0CC582444B7 and computer science is: 91364ED12003103FC455BF3B2AC45F0F6387D3FC2A258A05

I found these by looking carefully at the code for the drop down box once the widget was on a page.  Or you could look in the network section of the chrome console like so

Capture.PNG.b91ac8bea38ebee7dee56df9daa82df8.PNG

 

Its the same...

 

91364ED12003103FC455BF3B2AC45F0F6387D3FC2A258A05

Link to comment
Share on other sites

<script>
var widget_content_uuid = "4DDA0D5B20028655EEB7CF568718800FE28B218C162B5AAD";
var subject_uuid = "91364F1520031DB70162AFEE72134306E4B0D0CC582444B7";
        
$("div [data-content-uuid="+widget_content_uuid+"] select[name=subject_name]:first").val(subject_uuid).change();
</script>

Finally this in a html widget at the bottom of the page the homework calendar is on ......

Change the two variables to match the subject you want it to show and which widget you want to target....

  • Thanks 1
Link to comment
Share on other sites

I have added a 1 second delay before the drop down is changed and triggered. I think the code i gave you before is running before the homework calendar has finished rendering...  This should do it:

<script>
var widget_content_uuid = "4DDA0D5B20028655EEB7CF568718800FE28B218C162B5AAD";
var subject_uuid = "91364F1520031DB70162AFEE72134306E4B0D0CC582444B7";

setTimeout(function(){ $("div [data-content-uuid="+widget_content_uuid+"] select[name=subject_name]:first").val(subject_uuid).change(); }, 1000); 
</script>

 

Link to comment
Share on other sites

1 hour ago, pconkie said:

I have added a 1 second delay before the drop down is changed and triggered. I think the code i gave you before is running before the homework calendar has finished rendering...  This should do it:


<script>
var widget_content_uuid = "4DDA0D5B20028655EEB7CF568718800FE28B218C162B5AAD";
var subject_uuid = "91364F1520031DB70162AFEE72134306E4B0D0CC582444B7";

setTimeout(function(){ $("div [data-content-uuid="+widget_content_uuid+"] select[name=subject_name]:first").val(subject_uuid).change(); }, 1000); 
</script>

 

Nope no joy....

Link to comment
Share on other sites

1 hour ago, pconkie said:

I have added a 1 second delay before the drop down is changed and triggered. I think the code i gave you before is running before the homework calendar has finished rendering...  This should do it:


<script>
var widget_content_uuid = "4DDA0D5B20028655EEB7CF568718800FE28B218C162B5AAD";
var subject_uuid = "91364F1520031DB70162AFEE72134306E4B0D0CC582444B7";

setTimeout(function(){ $("div [data-content-uuid="+widget_content_uuid+"] select[name=subject_name]:first").val(subject_uuid).change(); }, 1000); 
</script>

 

It works when you've opened the HTML widget and saved it....  and then close and open the site..... but if you refresh it doesn't work again!!

Edited by ADT
Link to comment
Share on other sites

1 hour ago, pconkie said:

I have added a 1 second delay before the drop down is changed and triggered. I think the code i gave you before is running before the homework calendar has finished rendering...  This should do it:


<script>
var widget_content_uuid = "4DDA0D5B20028655EEB7CF568718800FE28B218C162B5AAD";
var subject_uuid = "91364F1520031DB70162AFEE72134306E4B0D0CC582444B7";

setTimeout(function(){ $("div [data-content-uuid="+widget_content_uuid+"] select[name=subject_name]:first").val(subject_uuid).change(); }, 1000); 
</script>

 

And if i were to add a class as well......?

 

 

Link to comment
Share on other sites

3 minutes ago, pconkie said:

Increase the delay until it works - change the 1000 (this means 1 second) to 2000 or 3000. See if that does it

It seams to be hitty miss!! >:(

I had been messing with the time....  i guessed it was seconds...  2000 seams to do the trick!! :D

Edited by ADT
Link to comment
Share on other sites

2 minutes ago, pconkie said:

This is a bit of a hack. We can ask our friend @Graham Quince for the source code, then we can add a preference for setting default values for these filters!

Or maybe these tweeks can be added on a more official level........  seams like a good evolution of the widget to me..... :)

Link to comment
Share on other sites

OK so i now have....

 

<script>
var widget_content_uuid = "2698582720028EC0417D0F46F28DC60BF2EE411C39240A98";
var subject_uuid = "FE43A21E2003151E1F67BFB693DCAD08CDDA308CD37F93E1";
setTimeout(function(){ $("div [data-content-uuid="+widget_content_uuid+"] select[name=subject_name]:first").val(subject_uuid).change(); }, 2000); 
</script>
<script>
var widget_content_uuid = "2698582720028EC0417D0F46F28DC60BF2EE411C39240A98";
var recipients_uuid= "group-6B1B023E200135E516B3CFC70157100034C2E29CA70F0228";
setTimeout(function(){ $("div [data-content-uuid="+widget_content_uuid+"] select[name=recipients]:first").val(recipients_uuid).change(); }, 3000); 
</script>

But no doubt i could simplify it...

Link to comment
Share on other sites

Clearly....

<script>
var widget_content_uuid = "5DF1AF3D200281D44D4E7F0680B57707C70701BC4DFC16D5";
var subject_uuid = "FE43A21E2003151E1F67BFB693DCAD08CDDA308CD37F93E1";
        var recipients_uuid= "group-4F2B17B0200138FC1A2E4F4E5494BB04E65810EC7A8FC42D";
setTimeout(function(){ $("div [data-content-uuid="+widget_content_uuid+"] select[name=subject_name]:first").val(subject_uuid).change(); }, 2000);  
    setTimeout(function(){ $("div [data-content-uuid="+widget_content_uuid+"] select[name=recipients]:first").val(recipients_uuid).change(); }, 3000);
</script>

is better...

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