隐藏Edit Task页面的Save Draft按钮

Posted on by Changsheng

本来是需要隐藏同一页面的 Related List Item,找答案的时候顺便想到要去掉那个Save Draft 按钮,于是就在那个页面的源代码中去掉了一个 <td>,轻松搞定。下面是如何隐藏related list item

If you only want to hide the link button in a Workflow Task form, you can edit this form in SPD. After a new SPD workflow is created, there will create a new task form for this workflow in workflows folder: Open the Site using the SharePoint Designer >expand the Workflows in Folder List>expand the workflow that you created, you will find a new form page (“TaskName”.aspx) under the workflow> double-click the page and search for “Related list item” in Code view, and then set the <tr> tag to <tr style=”visibility:hidden”>. This will hide the “Related list item” in task form.

Hope it can help you.


原文链接 http://social.msdn.microsoft.com/Forums/en/sharepointworkflow/thread/eb045a53-87c4-475a-95fe-fdafde2322e2

用workflow更新hyperlink的方法

Posted on by Changsheng

终于找到了,做个备份,防止以后忘掉

figure it out by using SharePoint manager to look inside:

  • The format is “{Url}, {Descrition}”. The key is that after “,”, there is one space there!!!!

    Obivously, two different MS teams are working on hyperlink field and normal lookup field, respectively, therefore different separators used: “#;” vs “, “. 

       
  • JavaScript在sharepoint中进行表单验证实例

    Posted on by Changsheng

    对于sharepoint的list,有时候需要用户填写的条目比较多,sharepoint本身并没有比较好的前端验证的功能,可以通过工作流在后台进行验证,不过这样就得在用户提交表单之后了,很不方便,如果可以通过JavaScript在客户端对用户所填写内容进行实时验证就很完美了。把网上搜罗到的方法逐个拿来折腾,最后终于找到个可以用的。下图是效果

     

    具体做法是新建一个CEWP,然后把如下代码贴进去

    <script language=”javascript” type=”text/javascript”>

    function PreSaveAction()
    {
        var date1 = getTagFromIdentifierAndTitle(“INPUT”,”DateTimeFieldDate”,”Start Date”); 
        var date2 = getTagFromIdentifierAndTitle(“INPUT”,”DateTimeFieldDate”,”Due Date”);
        var arrDate1 = date1.value.split(“/”);
        var useDate1 = new Date(arrDate1[2], arrDate1[1]-1, arrDate1[0]);
        var arrDate2 = date2.value.split(“/”);
        var useDate2 = new Date(arrDate2[2], arrDate2[1]-1, arrDate2[0]);
        if(useDate1 > useDate2)
        {
            alert(“The end date cannot happen earlier than the start date”);
            return false; // Cancel the item save process
        }
        return true;  // OK to proceed with the save item
    }

    function getTagFromIdentifierAndTitle(tagName, identifier, title) {
    var len = identifier.length;
    var tags = document.getElementsByTagName(tagName);
    for (var i=0; i < tags.length; i++) {
    var tempString = tags[i].id;
    if (tags[i].title == title && (identifier == “” || tempString.indexOf(identifier) == tempString.length – len)) {
    return tags[i];
    }
    }
    return null;
    }

    </script>

    和电脑玩剪刀-石头-布

    Posted on by Changsheng

    看到纽约时报上的一个游戏,和电脑玩剪刀-石头-布,你可能想赢的机会会比较大,实际上,你玩的局数足够多的时候,你顶多和电脑玩个平手,还得你这个人完全不用脑子玩这个游戏,随心所欲得出牌,真正意义上做到随机才行。否则电脑会学习你的规律,这样你就会越输越多,不信的话你试试 http://www.nytimes.com/interactive/science/rock-paper-scissors.html

    我开始玩选novice还败得很惨,然后选择veteran,随机出牌(为了做到这一点,我用excel随机排列了1-100,然后用3求余数,再加上1,正好是1到3的随机数,分别对应石头,剪刀,布),上面这张图是100局下来的结果,估计要是玩个100局的话,应该非常接近和电脑玩平手,而且胜,平,负的局数应该也比较接近

    批量修改AD信息的工具

    Posted on by Changsheng

     

    你可以使用dsadd去批量添加用户,但有时候除了添加我们还需要批量修改,比如exchange服务器域名更换的时候需要批量修改用户邮箱,或者文件服务器更名而需要批量修改网络盘点路径。说到批量修改,常被提到的方法就是使用LDIFDE,你需要先把要修改的数据导出来,修改完了再导入,很不方便不说,还容易出错,何不使用微软的AD批量修改工具呢?

    如何向 sharepoint2007 日历中添加颜色

    Posted on by Changsheng

    你在用sharepoint去实现一个会议室预定管理功能,公司有几个会议室,你希望显示在一个日历界面上,为了区分明显,不同的会议室使预定使用不同的颜色来显示。本文告诉你如何不写代码,使用CEWP和计算栏目来实现,原文是英文的,原谅我不加整理共享如下: