How to remove participant profile link from participant name in moodle chat? - moodle

I am using moodle version 2.8, I have added chat activity in course. I wants to remove participants profile link on participants name which display right side of chat window.
So how can I display only name of participants without any link on its name?
Thanks in advance..!

The file you're looking for is /mod/chat/lib.php
I've not tested this but I think the line you're looking for is line 1037 (By GitHub count). You can find that and then change it from
$item['url'] = $CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$course->id;
to
$item['url'] = '#';
and then if you want to remove the URL from the list of users as well, go to line 1257 and change it from
$userlink = new moodle_url('/user/view.php', array('id' => $chatuser->id, 'course' => $course->id));
to
$userlink = '#';
There are more references to the profile page peppered around this file (seven reference in total). There's also another reference at the bottom of view.php for the module.
Please note that modifying those files means you'll be creating a
branch from the module's core and is not advised.

Related

Word addin, set filename

If one starts a blank file on Word you can usually see in the top bar a name such as "Document1", "Document2" and so on.
Yet, if you attempt to open a file using the Word JS API like this:
Word.run((context) => {
context.application.createDocument(documentB64).open()
return context.sync()
})
The top bar comes out like this:
No filename is set.
To set a filename/handle(?), I tried using the code given here Office JS - Add customProperty to new document but that didn't help.
My addin is usually used in conjunction with another (VSTO) add-on and that add-on can't work properly with the documents opened by my addin and I believe the lack of a filename (/handle?) explains it to some extent.
Is there something I can do about this?
Thank you
Currently you can't do this because the newly created document is just a temporary file and not saved. can you try to call the following code to make sure the newly created file is saved?
const documentCreated = context.application.createDocument(externalDoc);
documentCreated.save();
documentCreated.open();

Get a link to a specific line in a diff using GitHub API?

Using the GitHub API I'm looking for a way to generate a link to a specific line in a diff.
I can already contruct a "compare between commits" url, for example:
https://github.com/emmetog/feature-flags/compare/master...d8f9c29bfd0b87d26123b78b76feca8e4c87ad8
And visiting that url in a browser I can click on a specific line and I get this:
https://github.com/emmetog/feature-flags/compare/master...d8f9c29bfd0b87d26123b78b76feca8e4c87ad8#diff-21171d4ef87ca8e3591556dd18dfa456R26
However, I need to generate that last bit, the #diff-21171d4ef87ca8e3591556dd18dfa456R26 bit, programatically throught the github api, or else find another way of linking to the specific line in the diff without going through the browser.
Is this possible?
It is impossible.
I read https://developer.github.com/v3/repos/commits/#compare-two-commits
I tried
curl https://github.com/emmetog/feature-flags/compare/master...d8f9c29bfd0b87d26123b78b76feca8e4c87ad8
By using GitHub API, we can not specify what is the line 26th of different between new version and old version of file src/Emmetog/FeatureFlag/Entity/FeatureFlag.php
Because difference of 2 revisions doesn't happen at line 26, it is impossible for comparing. Or file src/Emmetog/FeatureFlag/Entity/FeatureFlag.php has only 10 lines of code, it is impossible for comparing.
In HTML webpage, id = diff-21171d4ef87ca8e3591556dd18dfa456R26 is auto-generated id. We can not specify intentional way before executing GitHub API request.
This may not be the best way to do it, but it looks like you can do some webscraping.
For example. In the link you provided. That line contains this element:
<td id="diff-21171d4ef87ca8e3591556dd18dfa456R26"
data-line-number="26" class="blob-num blob-num-addition
js-linkable-line-number selected-line"></td>
Which contains the diff hash. You also have the line number (26). Now you just need the 'R' between the diff hash and the line number. That, I believe, is given by whether the line has been added or removed. You can get that from the css class 'blob-num-addition'. It looks like 'blob-num-addition' corresponds to 'R' and 'blob-num-addition' corresponds to 'L'

SuiteCRM, SugarCRM : Many relationships "many-to-many" between same two modules

In the account module, I needed to create two relationships "many-to-many" with the same module "Opportunities",
When I access the account module I find that one of the subpanels of oppotunities doesn't contain the arrow icon
to allow me to select the opportunities. Is this normal ?
I am using suiteCRM 7.7.4 (Sugar Version 6.5.24)
Thank you for your help !
Best regards !
No it is not normal , Normally opportunities subpanel have button to select data, So solutions for that is following ,
1. If you installation is new re install it .
2. If it is preexisting than check the code of subpanel-list.php in your opportunities module , i think button will be hide, or find panel-top.php you will get the solution there.
Thank you again for your quick reply Amitesh.
I checked the file modules/Accounts/metadata/subpaneldefs.php,
and I find that there is no array('widget_class' => 'SubPanelTopSelectButton', 'mode' => 'MultiSelect')
in the declaration of $layout_defs['Accounts']['subpanel_setup']['opportunities'] array, so I add it manually and it works now.
There is also another alternative, this one consists of deleting the subpanel
and creating a new one.

Get path of uploaded image in Moodle

I have added custom column to store company logo. I have used file api of moodle like :
$mform->addElement('filepicker', 'certificatelogo', 'Company Logo', null,
array('maxbytes' => $maxbytes, 'accepted_types' => '*'));
$mform->setDefault('certificatelogo', '0');
$mform->addHelpButton('certificatelogo', 'certificatelogo', 'certificate');
Once the form is submitted itemid will be stored in custom column. Say "648557354"
Now I need to get image to print logo on certificate. How can I get image path from itemid? Do I need to store any other information to retrieve image?
The itemid returned is the temporary id of the draft area where the file is stored whilst the form is being displayed. You need to copy the file into its 'real' location, when the form is submitted, otherwise the file will be automatically deleted after a few days (and it will only be accessible to the user who originally uploaded it).
I'd always recommend using the filemanager element, if you are planning on keeping the file around (filepicker elements are for files you want to process and discard, such as when uploading a CSV file data to parse and add to the database).
Details of how to use it are here:
https://docs.moodle.org/dev/Using_the_File_API_in_Moodle_forms#filemanager
But the basic steps are:
Copy any existing files from the 'real' area to the draft area (file_prepare_standard_filemanager).
Display the form.
On submission, copy files from the draft area to the 'real' area (file_postupdate_standard_filemanager).
When you want to display the file to the user, get a list of files stored in the file area (defined by the component, filearea, context and, optionally, itemid, you used in file_prepare_standard_filemanager and file_postupdate_standard_filemanager). You can do this with: $fs = get_file_storage(); $fs->get_area_files().
For those files (maybe only 1 file, in your case), generate the URL with moodle_url::make_pluginfile_url.
Make sure your plugin has a PLUGINNAME_pluginfile() function in lib.php, to examine incoming file requests, do security checks on them, then serve the file.
There is a reasonable example of all of this at: https://github.com/AndyNormore/filemanager

How to add history item from Redmine plugin

I am trying to write a plugin for Redmine. The plugin will allow users to create Code Review Requests.
When the user creates / updates / deletes a request I want to add the event to history.
Anyone here familiar with creating a Journal object and attaching it to an issue?
I tried doing (using the console)
is = Issue.find(1234)
jr = Journal.new(:journalized => is)
jr.save
However jr.save returns false.
Please let me know what would be a correct way to do this?
Thanks!
To create issue history line on behalf of user(as a comment):
writing line by line, to show howto. You can combine in 1 line all this code
issue = Issue.find(1234)
user = User.current
journal = issue.init_journal(user, 'My text for history line')
journal.save