ADT Posted October 2, 2017 Share Posted October 2, 2017 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 More sharing options...
pconkie Posted October 2, 2017 Share Posted October 2, 2017 Yes, this is possible Adrian and fairly easy. Surely you have now worked it out?! Link to comment Share on other sites More sharing options...
pconkie Posted October 2, 2017 Share Posted October 2, 2017 @ADT I'm thinking this would be good for Heads of Department to have too (homework calendar has a Public mode) Link to comment Share on other sites More sharing options...
pconkie Posted October 2, 2017 Share Posted October 2, 2017 (edited) 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 Edited October 2, 2017 by pconkie Link to comment Share on other sites More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 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 More sharing options...
pconkie Posted October 2, 2017 Share Posted October 2, 2017 (edited) 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 Edited October 2, 2017 by pconkie Link to comment Share on other sites More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 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 Its the same... 91364ED12003103FC455BF3B2AC45F0F6387D3FC2A258A05 Link to comment Share on other sites More sharing options...
pconkie Posted October 2, 2017 Share Posted October 2, 2017 <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.... 1 Link to comment Share on other sites More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 Clearly if you say it works... It works.... but I need to be off home to the wife and kids!! I'll have a play tonight!! Thanks Paul!! Link to comment Share on other sites More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 (edited) Stuff It I'll feel the rath of the Mrs for being late for tea....... I got it working!! Nice one Paul!! Edited October 2, 2017 by ADT 1 Link to comment Share on other sites More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 @pconkie I take it back... it did work... but when I've come home it doesn't!! Open the HTML widget... Close the widget it works again!!! Close the site and open the site.. doesn't work again!! Link to comment Share on other sites More sharing options...
pconkie Posted October 2, 2017 Share Posted October 2, 2017 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 More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 Great I'll give it a go after the kids go to sleep... I've just read The Gruffalo, The Gruffalo's Child and Room on a Broom!!! Now go to sleep........ ahhhhhh!! Link to comment Share on other sites More sharing options...
pconkie Posted October 2, 2017 Share Posted October 2, 2017 I prefer stick man... Link to comment Share on other sites More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 36 minutes ago, pconkie said: I prefer stick man... We've got that..... and a load of other Julia Donaldson books.... Link to comment Share on other sites More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 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 More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 (edited) 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 October 2, 2017 by ADT Link to comment Share on other sites More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 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 More sharing options...
pconkie Posted October 2, 2017 Share Posted October 2, 2017 Increase the delay until it works - change the 1000 (this means 1 second) to 2000 or 3000. See if that does it Link to comment Share on other sites More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 (edited) 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!! Edited October 2, 2017 by ADT Link to comment Share on other sites More sharing options...
pconkie Posted October 2, 2017 Share Posted October 2, 2017 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! Link to comment Share on other sites More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 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 More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 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 More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 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 More sharing options...
ADT Posted October 2, 2017 Author Share Posted October 2, 2017 Ive got the number down to 1125 and 1150... seams to work!! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now