[Building Sakai] fMath images

Daniel Merino daniel.merino at unavarra.es
Wed Jun 12 05:39:28 PDT 2013


I have created a related JIRA at 
https://jira.sakaiproject.org/browse/SAK-23686

Kevin, could you upload your patch there, please?

Thanks.
Best regards.

El 12/06/2013 11:10, Daniel Merino escribió:
> Thanks a lot, Kevin & Matthew!
>
> I will apply and test this patch ASAP.
>
> Best regards.
>
> El 11/06/2013 17:22, Kevin Takacs escribió:
>> I made a fix for this recently in the FCKConnectorServlet, it creates 
>> a folder called fmath in the root level of the resources tool the 
>> first time anyone creates an image in that site.  The diff for trunk 
>> is below, I'll add patches for trunk and 2.9.x when a Jira is available.
>>
>> Index: 
>> FCKeditor/connector/src/java/org/sakaiproject/connector/fck/FCKConnectorServlet.java
>> ===================================================================
>> --- 
>> FCKeditor/connector/src/java/org/sakaiproject/connector/fck/FCKConnectorServlet.java(revision 
>> 125597)
>> +++ 
>> FCKeditor/connector/src/java/org/sakaiproject/connector/fck/FCKConnectorServlet.java(working 
>> copy)
>> @@ -46,6 +46,8 @@
>>  import org.apache.commons.fileupload.DiskFileUpload;
>>  import org.apache.commons.fileupload.FileItem;
>>  import org.apache.commons.codec.binary.Base64;
>> +import org.apache.commons.logging.Log;
>> +import org.apache.commons.logging.LogFactory;
>>  import org.sakaiproject.authz.api.SecurityAdvisor;
>>  import org.sakaiproject.authz.api.SecurityService;
>>  import org.sakaiproject.component.cover.ComponentManager;
>> @@ -59,8 +61,7 @@
>>  import org.sakaiproject.entity.api.ResourcePropertiesEdit;
>>  import 
>> org.sakaiproject.entitybroker.entityprovider.extension.EntityData;
>>  import org.sakaiproject.event.api.NotificationService;
>> -import org.sakaiproject.exception.IdUsedException;
>> -import org.sakaiproject.exception.PermissionException;
>> +import org.sakaiproject.exception.*;
>>  import org.sakaiproject.tool.api.SessionManager;
>>  import org.sakaiproject.util.StringUtil;
>>  import org.sakaiproject.util.Validator;
>> @@ -100,6 +101,8 @@
>>       private static final long serialVersionUID = 1L;
>> +    protected final Log logger = LogFactory.getLog(getClass());
>> +
>>       private static final String MFORUM_FORUM_PREFIX = "/direct/forum/";
>>       private static final String MFORUM_TOPIC_PREFIX = 
>> "/direct/forum_topic/";
>>       private static final String MFORUM_MESSAGE_PREFIX = 
>> "/direct/forum_message/";
>> @@ -321,7 +324,25 @@
>>                 DiskFileUpload upload = new DiskFileUpload();
>>                 String mime;
>>                 byte [] bytes;
>> +               ContentCollectionEdit fmathFolder;
>> +               currentFolder = currentFolder + "fmath/";
>> +
>>                 try {
>> +                   SecurityAdvisor contentAdvisor = new 
>> SecurityAdvisor(){
>> +                       public SecurityAdvice isAllowed(String 
>> userId, String function, String reference){
>> +                           return 
>> function.equals("content.new")?SecurityAdvice.ALLOWED:SecurityAdvice.PASS;
>> +                       }
>> +                   };
>> +
>> + securityService.pushAdvisor(contentAdvisor);
>> +                   fmathFolder = 
>> contentHostingService.addCollection(currentFolder, "fmath");
>> + contentHostingService.commitCollection(fmathFolder);
>> + securityService.popAdvisor(contentAdvisor);
>> +               } catch (Exception e) {
>> +                   logger.warn("Caught exception while attempting to 
>> create fmath directory " + e, e);
>> +               }
>> +
>> +              try {
>>                     //Special case for uploading fmath equations
>>                     if (("QuickUploadEquation").equals(command)) {
>>                         String image = request.getParameter("image");
>>
>>
>>
>> On Tue, Jun 11, 2013 at 7:51 AM, Matthew Jones <matthew at longsight.com 
>> <mailto:matthew at longsight.com>> wrote:
>>
>>     Yea, file new jira(s) (or submit a patch).
>>
>>     Putting it in a subdirectory would be possible in here without
>>     changing the flash. However that random file name is generated by
>>     the flash applet and I'm not sure if that's possible to override.
>>     I am unable to make changes to the flash component, but the
>>     someone else had made a few necessary changes on it. You can
>>     alternatively use the jsp examples that are on the page
>>     (http://fmath.info/editor/image.jsp) to just have it save to a
>>     random location on the file system like every other math plugin
>>     does. I felt it was better putting it in Sakai and allowing them
>>     to re-use the images, but they really are just placeholders.
>>
>>     The majority work on this was done in
>>     https://jira.sakaiproject.org/browse/SAK-23266 and saving in
>>     https://source.sakaiproject.org/svn//textarea/trunk/FCKeditor/connector/src/java/org/sakaiproject/connector/fck/FCKConnectorServlet.java
>>     (QuickUploadEquation case)
>>
>>
>>     On Tue, Jun 11, 2013 at 8:09 AM, Daniel Merino
>>     <daniel.merino at unavarra.es <mailto:daniel.merino at unavarra.es>> wrote:
>>
>>         Hi everybody.
>>
>>         We are testing the new fMath plugin in Sakai 2.9.2 and we are
>>         experiencing several issues.
>>
>>         Images are stored in Resources at the root level if they are
>>         generated
>>         in syllabus, calendar, etc, or in the same folder that the
>>         web page
>>         which contains them. Their names are like these:
>>
>>         fmath-equation-36EC684C-5AAB-8BCC-C50F-C61BA0454950.png
>>         fmath-equation-129A1D1B-A982-559A-B6C7-B122862C19EC.png
>>         fmath-equation-CD0587B2-A886-CD61-6FA3-4D5442951F5D.png
>>
>>         And if one image is edited in fMath editor and is saved (with
>>         or wihout
>>         changes), a new image is generated.
>>
>>         I think that our users are going to complain by this
>>         behaviour and I'm
>>         interested in knowing if it can be configured some way. For
>>         example, we
>>         think that it would be far better if all images were stored in a
>>         sub-folder. Also it would be great if there were some
>>         mechanism to
>>         locate and remove unused images.
>>
>>         If this is not possible right now, should I create new JIRAs?
>>
>>         Thanks and best regards.
>>         --
>>         Daniel Merino Echeverría
>>         daniel.merino at unavarra.es <mailto:daniel.merino at unavarra.es>
>>         Gestor de teleformación - Centro Superior de Innovación
>>         Educativa.
>>         Tfno: 948-168489 - Universidad Pública de Navarra.
>>         _______________________________________________
>>         sakai-dev mailing list
>>         sakai-dev at collab.sakaiproject.org
>>         <mailto:sakai-dev at collab.sakaiproject.org>
>>         http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>>         TO UNSUBSCRIBE: send email to
>>         sakai-dev-unsubscribe at collab.sakaiproject.org
>>         <mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a
>>         subject of "unsubscribe"
>>
>>
>>
>>     _______________________________________________
>>     sakai-dev mailing list
>>     sakai-dev at collab.sakaiproject.org
>>     <mailto:sakai-dev at collab.sakaiproject.org>
>>     http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>>     TO UNSUBSCRIBE: send email to
>>     sakai-dev-unsubscribe at collab.sakaiproject.org
>>     <mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a
>>     subject of "unsubscribe"
>>
>>
>>
>>
>> -- 
>> Kevin Takacs
>> Software Engineer
>> *O **602-337-8408*
>> *M **480-544-1972*
>
> -- 
> Daniel Merino Echeverría
> daniel.merino at unavarra.es
> Gestor de teleformación - Centro Superior de Innovación Educativa.
> Tfno: 948-168489 - Universidad Pública de Navarra.
> --
> Cuando un hombre estúpido hace algo que le avergüenza, siempre dice 
> que cumplia con su deber. (Bernard Shaw)
>
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"

-- 
Daniel Merino Echeverría
daniel.merino at unavarra.es
Gestor de teleformación - Centro Superior de Innovación Educativa.
Tfno: 948-168489 - Universidad Pública de Navarra.
--
Nos creíamos que ibamos a cambiar el mundo y casi no podemos cambiar ni 
de compañía de móvil. (Forges)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130612/0a0596ed/attachment.html 


More information about the sakai-dev mailing list